@hyperbook/markdown 0.43.0 → 0.43.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- var p5=function(){"use strict";const t=Math.PI,i="2.0.1",r="p2d",s="webgl",n="webgl2",a="default",o="simple",h="full",u="crosshair",l="pointer",c="move",p="text",d="wait",f=t/2,g=t,m=t/4,y=2*t,x=2*t,v=t/180,b=180/t,_="corner",w="corners",C="radius",D="right",E="left",A="center",S="bottom",F="alphabetic",T=0,M=1,k="quads",I="quad_strip",B="close",L="open",P="chord",O="pie",N="square",R="butt",V="round",U="bevel",G="miter",z="auto",j="source-over",$="destination-out",W="lighter",q="darken",H="lighten",X="difference",Y="subtract",Z="exclusion",K="multiply",J="screen",Q="copy",ee="overlay",te="hard-light",ie="soft-light",re="color-dodge",se="color-burn",ne="threshold",ae="gray",oe="opaque",he="invert",ue="posterize",le="dilate",ce="erode",pe="blur",de="normal",fe="WORD",ge="linear",me="fill",ye="texture",xe="image",ve="nearest",be="repeat",_e="clamp",we="mirror",Ce="flat",De="smooth",Ee="#000000",Ae="#FFFFFF",Se="grid",Fe="axes",Te="contain",Me="cover",ke="unsigned-byte",Ie="unsigned-int",Be="float",Le="half-float",Pe=Symbol("include"),Oe=Symbol("exclude"),Ne=Symbol("join");var Re=Object.freeze({__proto__:null,ADD:W,ALT:"Alt",ARROW:a,AUTO:z,AXES:Fe,BACKSPACE:"Backspace",BASELINE:F,BEVEL:U,BEZIER:"bezier",BLEND:j,BLUR:pe,BOLD:"bold",BOLDITALIC:"bold italic",BOTTOM:S,BURN:se,CENTER:A,CHAR:"CHAR",CHORD:P,CLAMP:_e,CLOSE:B,CONTAIN:Te,CONTROL:"Control",CORNER:_,CORNERS:w,COVER:Me,CROSS:u,CURVE:"curve",DARKEST:q,DEG_TO_RAD:v,DELETE:"Delete",DIFFERENCE:X,DILATE:le,DODGE:re,DOWN_ARROW:"ArrowDown",EMPTY_PATH:7,ENTER:"Enter",ERODE:ce,ESCAPE:"Escape",EXCLUDE:Oe,EXCLUSION:Z,FALLBACK:"fallback",FILL:me,FLAT:Ce,FLOAT:Be,FULL:h,GRAY:ae,GRID:Se,HALF_FLOAT:Le,HALF_PI:f,HAND:l,HARD_LIGHT:te,IMAGE:xe,IMMEDIATE:"immediate",INCLUDE:Pe,INVERT:he,ITALIC:"italic",JOIN:Ne,LABEL:"label",LANDSCAPE:"landscape",LEFT:E,LEFT_ARROW:"ArrowLeft",LIGHTEST:H,LINEAR:ge,LINES:M,LINE_LOOP:2,LINE_STRIP:3,MIRROR:we,MITER:G,MOVE:c,MULTIPLY:K,NEAREST:ve,NORMAL:de,OPAQUE:oe,OPEN:L,OPTION:"Alt",OVERLAY:ee,P2D:r,P2DHDR:"p2d-hdr",PATH:8,PI:g,PIE:O,POINTS:T,PORTRAIT:"portrait",POSTERIZE:ue,PROJECT:N,QUADRATIC:"quadratic",QUADS:k,QUAD_STRIP:I,QUARTER_PI:m,RADIUS:C,RAD_TO_DEG:b,REMOVE:$,REPEAT:be,REPLACE:Q,RETURN:"Enter",RIGHT:D,RIGHT_ARROW:"ArrowRight",ROUND:V,SCREEN:J,SHIFT:"Shift",SIMPLE:o,SMOOTH:De,SOFT_LIGHT:ie,SQUARE:R,STROKE:"stroke",SUBTRACT:Y,TAB:"Tab",TAU:y,TESS:"tess",TEXT:p,TEXTURE:ye,THRESHOLD:ne,TOP:"top",TRIANGLES:4,TRIANGLE_FAN:6,TRIANGLE_STRIP:5,TWO_PI:x,UNSIGNED_BYTE:ke,UNSIGNED_INT:Ie,UP_ARROW:"ArrowUp",VERSION:i,WAIT:d,WEBGL:s,WEBGL2:n,WORD:fe,_CTX_MIDDLE:"middle",_DEFAULT_FILL:Ae,_DEFAULT_LEADMULT:1.25,_DEFAULT_STROKE:Ee,_DEFAULT_TEXT_FILL:"#000000"});function Ve(e,t){t.applyMatrix=function(...e){let t=e[0]instanceof Object.getPrototypeOf(Uint8Array);return Array.isArray(e[0])||t?this._renderer.applyMatrix(...e[0]):this._renderer.applyMatrix(...e),this},t.resetMatrix=function(){return this._renderer.resetMatrix(),this},t.rotate=function(e,t){return this._renderer.rotate(this._toRadians(e),t),this},t.rotateX=function(e){return this._assert3d("rotateX"),this._renderer.rotateX(this._toRadians(e)),this},t.rotateY=function(e){return this._assert3d("rotateY"),this._renderer.rotateY(this._toRadians(e)),this},t.rotateZ=function(e){return this._assert3d("rotateZ"),this._renderer.rotateZ(this._toRadians(e)),this},t.scale=function(t,i,r){if(t instanceof e.Vector){const e=t;t=e.x,i=e.y,r=e.z}else if(Array.isArray(t)){const e=t;t=e[0],i=e[1],r=e[2]||1}return isNaN(i)?i=r=t:isNaN(r)&&(r=1),this._renderer.scale(t,i,r),this},t.shearX=function(e){const t=this._toRadians(e);return this._renderer.applyMatrix(1,0,Math.tan(t),1,0,0),this},t.shearY=function(e){const t=this._toRadians(e);return this._renderer.applyMatrix(1,Math.tan(t),0,1,0,0),this},t.translate=function(e,t,i){return this._renderer.isP3D?this._renderer.translate(e,t,i):this._renderer.translate(e,t),this},t.push=function(){this._renderer.push()},t.pop=function(){this._renderer.pop()}}function Ue(e,t){t.noLoop=function(){this._loop=!1},t.loop=function(){this._loop||(this._loop=!0,this._setupDone&&this._draw())},t.isLooping=function(){return this._loop},t.redraw=async function(e){if(this._inUserDraw||!this._setupDone)return;let t=parseInt(e);(isNaN(t)||t<1)&&(t=1);const i=this._isGlobal?window:this;if("function"==typeof i.draw){void 0===i.setup&&i.scale(i._pixelDensity,i._pixelDensity);for(let e=0;e<t;e++){i.resetMatrix(),(this._accessibleOutputs.grid||this._accessibleOutputs.text)&&this._updateAccsOutput(),this._renderer.isP3D&&this._renderer._update(),this.frameCount=i.frameCount+1,await this._runLifecycleHook("predraw"),this._inUserDraw=!0;try{await i.draw()}finally{this._inUserDraw=!1}await this._runLifecycleHook("postdraw")}}}}void 0!==p5&&Ve(p5,p5.prototype),void 0!==p5&&Ue(0,p5.prototype);const Ge=function(e,t){return 0!==e&&(this.x=this.x%e),0!==t&&(this.y=this.y%t),this},ze=function(e,t,i){return 0!==e&&(this.x=this.x%e),0!==t&&(this.y=this.y%t),0!==i&&(this.z=this.z%i),this};class je{constructor(...e){let t=e.map((e=>e||0));"function"==typeof e[0]&&(this.isPInst=!0,this._fromRadians=e[0],this._toRadians=e[1],t=e.slice(2).map((e=>e||0)));let i=t.length;0===i?(this.dimensions=2,this._values=[0,0,0]):(this.dimensions=i,this._values=t)}get values(){return this._values}set values(e){let t=e.length;0===t?(this.dimensions=2,this._values=[0,0,0]):(this.dimensions=t,this._values=e.slice())}get x(){return this._values[0]||0}getValue(e){if(e<this._values.length)return this._values[e];p5._friendlyError("The index parameter is trying to set a value outside the bounds of the vector","p5.Vector.setValue")}setValue(e,t){e<this._values.length?this._values[e]=t:p5._friendlyError("The index parameter is trying to set a value outside the bounds of the vector","p5.Vector.setValue")}get y(){return this._values[1]||0}get z(){return this._values[2]||0}get w(){return this._values[3]||0}set x(e){this._values.length>1&&(this._values[0]=e)}set y(e){this._values.length>1&&(this._values[1]=e)}set z(e){this._values.length>2&&(this._values[2]=e)}set w(e){this._values.length>3&&(this._values[3]=e)}toString(){return`[${this.values.join(", ")}]`}set(...e){return e[0]instanceof je?this.values=e[0].values.slice():Array.isArray(e[0])?this.values=e[0].map((e=>e||0)):this.values=e.map((e=>e||0)),this.dimensions=this.values.length,this}copy(){return this.isPInst?new je(this._fromRadians,this._toRadians,...this.values):new je(...this.values)}add(...e){return e[0]instanceof je?e=e[0].values:Array.isArray(e[0])&&(e=e[0]),e.forEach(((e,t)=>{this.values[t]=(this.values[t]||0)+(e||0)})),this}rem(e,t,i){if(e instanceof je){if([e.x,e.y,e.z].every(Number.isFinite)){const t=parseFloat(e.x),i=parseFloat(e.y),r=parseFloat(e.z);return ze.call(this,t,i,r)}}else if(Array.isArray(e)){if(e.every((e=>Number.isFinite(e)))){if(2===e.length)return Ge.call(this,e[0],e[1]);if(3===e.length)return ze.call(this,e[0],e[1],e[2])}}else if(1===arguments.length){if(Number.isFinite(arguments[0])&&0!==arguments[0])return this.x=this.x%arguments[0],this.y=this.y%arguments[0],this.z=this.z%arguments[0],this}else if(2===arguments.length){const e=[...arguments];if(e.every((e=>Number.isFinite(e)))&&2===e.length)return Ge.call(this,e[0],e[1])}else if(3===arguments.length){const e=[...arguments];if(e.every((e=>Number.isFinite(e)))&&3===e.length)return ze.call(this,e[0],e[1],e[2])}}sub(...e){return e[0]instanceof je?e[0].values.forEach(((e,t)=>{this.values[t]-=e||0})):Array.isArray(e[0])?e[0].forEach(((e,t)=>{this.values[t]-=e||0})):e.forEach(((e,t)=>{this.values[t]-=e||0})),this}mult(...e){if(1===e.length&&e[0]instanceof je){const t=e[0],i=Math.min(this.values.length,t.values.length);for(let e=0;e<i;e++){if(!Number.isFinite(t.values[e])||"number"!=typeof t.values[e])return console.warn("p5.Vector.prototype.mult:","v contains components that are either undefined or not finite numbers"),this;this._values[e]*=t.values[e]}}else if(1===e.length&&Array.isArray(e[0])){const t=e[0],i=Math.min(this.values.length,t.length);for(let e=0;e<i;e++){if(!Number.isFinite(t[e])||"number"!=typeof t[e])return console.warn("p5.Vector.prototype.mult:","arr contains elements that are either undefined or not finite numbers"),this;this._values[e]*=t[e]}}else if(1===e.length&&"number"==typeof e[0]&&Number.isFinite(e[0]))for(let t=0;t<this._values.length;t++)this._values[t]*=e[0];return this}div(...e){if(0===e.length)return this;if(1===e.length&&e[0]instanceof je){const t=e[0];if(t._values.every((e=>Number.isFinite(e)&&"number"==typeof e))){if(t._values.some((e=>0===e)))return console.warn("p5.Vector.prototype.div:","divide by 0"),this;this._values=this._values.map(((e,i)=>e/t._values[i]))}else console.warn("p5.Vector.prototype.div:","vector contains components that are either undefined or not finite numbers");return this}if(1===e.length&&Array.isArray(e[0])){const t=e[0];if(t.every((e=>Number.isFinite(e)&&"number"==typeof e))){if(t.some((e=>0===e)))return console.warn("p5.Vector.prototype.div:","divide by 0"),this;this._values=this._values.map(((e,i)=>e/t[i]))}else console.warn("p5.Vector.prototype.div:","array contains components that are either undefined or not finite numbers");return this}if(e.every((e=>Number.isFinite(e)&&"number"==typeof e))){if(e.some((e=>0===e)))return console.warn("p5.Vector.prototype.div:","divide by 0"),this;this._values=this._values.map(((t,i)=>t/e[0]))}else console.warn("p5.Vector.prototype.div:","arguments contain components that are either undefined or not finite numbers");return this}mag(){return Math.sqrt(this.magSq())}magSq(){return this._values.reduce(((e,t)=>e+t*t),0)}dot(...e){return e[0]instanceof je?this.dot(...e[0]._values):this._values.reduce(((t,i,r)=>t+i*(e[r]||0)),0)}cross(e){const t=this.y*e.z-this.z*e.y,i=this.z*e.x-this.x*e.z,r=this.x*e.y-this.y*e.x;return this.isPInst?new je(this._fromRadians,this._toRadians,t,i,r):new je(t,i,r)}dist(e){return e.copy().sub(this).mag()}normalize(){const e=this.mag();return 0!==e&&this.mult(1/e),this}limit(e){const t=this.magSq();return t>e*e&&this.div(Math.sqrt(t)).mult(e),this}setMag(e){return this.normalize().mult(e)}heading(){const e=Math.atan2(this.y,this.x);return this.isPInst?this._fromRadians(e):e}setHeading(e){this.isPInst&&(e=this._toRadians(e));let t=this.mag();return this.x=t*Math.cos(e),this.y=t*Math.sin(e),this}rotate(e){let t=this.heading()+e;this.isPInst&&(t=this._toRadians(t));const i=this.mag();return this.x=Math.cos(t)*i,this.y=Math.sin(t)*i,this}angleBetween(e){if(0===this.magSq()*e.magSq())return NaN;const t=this.cross(e);let i=Math.atan2(t.mag(),this.dot(e))*Math.sign(t.z||1);return this.isPInst&&(i=this._fromRadians(i)),i}lerp(e,t,i,r){return e instanceof je?this.lerp(e.x,e.y,e.z,t):(this.x+=(e-this.x)*r||0,this.y+=(t-this.y)*r||0,this.z+=(i-this.z)*r||0,this)}slerp(e,t){if(0===t)return this;if(1===t)return this.set(e);const i=this.mag(),r=e.mag();if(0===i*r)return this.mult(1-t).add(e.x*t,e.y*t,e.z*t),this;const s=this.cross(e),n=s.mag(),a=Math.atan2(n,this.dot(e));if(n>0)s.x/=n,s.y/=n,s.z/=n;else{if(a<.5*Math.PI)return this.mult(1-t).add(e.x*t,e.y*t,e.z*t),this;0===this.z&&0===e.z?s.set(0,0,1):0!==this.x?s.set(this.y,-this.x,0).normalize():s.set(1,0,0)}const o=s.cross(this),h=1-t+t*r/i,u=h*Math.cos(t*a),l=h*Math.sin(t*a);return this.x=this.x*u+o.x*l,this.y=this.y*u+o.y*l,this.z=this.z*u+o.z*l,this}reflect(e){const t=je.normalize(e);return this.sub(t.mult(2*this.dot(t)))}array(){return[this.x||0,this.y||0,this.z||0]}equals(...e){let t;t=e[0]instanceof je?e[0]._values:Array.isArray(e[0])?e[0]:e;for(let e=0;e<this._values.length;e++)if(this._values[e]!==(t[e]||0))return!1;return!0}clampToZero(){for(let e=0;e<this._values.length;e++)this._values[e]=this._clampToZero(this._values[e]);return this}_clampToZero(e){return Math.abs((e||0)-0)<=Number.EPSILON?0:e}static fromAngle(e,t){return void 0===t&&(t=1),new je(t*Math.cos(e),t*Math.sin(e),0)}static fromAngles(e,t,i){void 0===i&&(i=1);const r=Math.cos(t),s=Math.sin(t),n=Math.cos(e),a=Math.sin(e);return new je(i*a*s,-i*n,i*a*r)}static random2D(){return this.fromAngle(Math.random()*x)}static random3D(){const e=Math.random()*x,t=2*Math.random()-1,i=Math.sqrt(1-t*t),r=i*Math.cos(e),s=i*Math.sin(e);return new je(r,s,t)}static copy(e){return e.copy(e)}static add(e,t,i){return i?i.set(e):(i=e.copy(),3===arguments.length&&p5._friendlyError("The target parameter is undefined, it should be of type p5.Vector","p5.Vector.add")),i.add(t),i}static rem(e,t){if(e instanceof je&&t instanceof je){let i=e.copy();return i.rem(t),i}}static sub(e,t,i){return i?i.set(e):(i=e.copy(),3===arguments.length&&p5._friendlyError("The target parameter is undefined, it should be of type p5.Vector","p5.Vector.sub")),i.sub(t),i}static mult(e,t,i){return i?i.set(e):(i=e.copy(),3===arguments.length&&p5._friendlyError("The target parameter is undefined, it should be of type p5.Vector","p5.Vector.mult")),i.mult(t),i}static rotate(e,t,i){return 2===arguments.length?i=e.copy():(i instanceof je||p5._friendlyError("The target parameter should be of type p5.Vector","p5.Vector.rotate"),i.set(e)),i.rotate(t),i}static div(e,t,i){return i?i.set(e):(i=e.copy(),3===arguments.length&&p5._friendlyError("The target parameter is undefined, it should be of type p5.Vector","p5.Vector.div")),i.div(t),i}static dot(e,t){return e.dot(t)}static cross(e,t){return e.cross(t)}static dist(e,t){return e.dist(t)}static lerp(e,t,i,r){return r?r.set(e):(r=e.copy(),4===arguments.length&&p5._friendlyError("The target parameter is undefined, it should be of type p5.Vector","p5.Vector.lerp")),r.lerp(t,i),r}static slerp(e,t,i,r){return r?r.set(e):(r=e.copy(),4===arguments.length&&p5._friendlyError("The target parameter is undefined, it should be of type p5.Vector","p5.Vector.slerp")),r.slerp(t,i),r}static mag(e){return e.mag()}static magSq(e){return e.magSq()}static normalize(e,t){return arguments.length<2?t=e.copy():(t instanceof je||p5._friendlyError("The target parameter should be of type p5.Vector","p5.Vector.normalize"),t.set(e)),t.normalize()}static limit(e,t,i){return arguments.length<3?i=e.copy():(i instanceof je||p5._friendlyError("The target parameter should be of type p5.Vector","p5.Vector.limit"),i.set(e)),i.limit(t)}static setMag(e,t,i){return arguments.length<3?i=e.copy():(i instanceof je||p5._friendlyError("The target parameter should be of type p5.Vector","p5.Vector.setMag"),i.set(e)),i.setMag(t)}static heading(e){return e.heading()}static angleBetween(e,t){return e.angleBetween(t)}static reflect(e,t,i){return arguments.length<3?i=e.copy():(i instanceof je||p5._friendlyError("The target parameter should be of type p5.Vector","p5.Vector.reflect"),i.set(e)),i.reflect(t)}static array(e){return e.array()}static equals(e,t){let i;return e instanceof je?i=e:e instanceof Array?i=(new je).set(e):p5._friendlyError("The v1 parameter should be of type Array or p5.Vector","p5.Vector.equals"),i.equals(t)}}function $e(e,t){e.Vector=je}function We(e,t){const i=[a,u,l,c,p,d];t._frameRate=0,t._lastFrameTime=window.performance.now(),t._targetFrameRate=60;const s=window.print;let n=!1;function o(){return window.innerWidth||document.documentElement&&document.documentElement.clientWidth||document.body&&document.body.clientWidth||0}function h(){return window.innerHeight||document.documentElement&&document.documentElement.clientHeight||document.body&&document.body.clientHeight||0}t.print=function(...e){e.length?console.log(...e):n||(s(),window.confirm("You just tried to print the webpage. Do you want to prevent this from running again?")&&(n=!0))},t.frameCount=0,t.deltaTime=0,t.focused=document.hasFocus(),t.cursor=function(e,t,r){let s="auto";const n=this._curElement.elt;if(i.includes(e))s=e;else if("string"==typeof e){let i="";t&&r&&"number"==typeof t&&"number"==typeof r&&(i=`${t} ${r}`),s="http://"===e.substring(0,7)||"https://"===e.substring(0,8)||/\.(cur|jpg|jpeg|gif|png|CUR|JPG|JPEG|GIF|PNG)$/.test(e)?`url(${e}) ${i}, auto`:e}n.style.cursor=s},t.frameRate=function(e){return"number"!=typeof e||e<0?this._frameRate:(this._targetFrameRate=e,0===e&&(this._frameRate=e),this)},t.getFrameRate=function(){return this.frameRate()},t.setFrameRate=function(e){return this.frameRate(e)},t.getTargetFrameRate=function(){return this._targetFrameRate},t.noCursor=function(){this._curElement.elt.style.cursor="none"},t.webglVersion=r,t.displayWidth=screen.width,t.displayHeight=screen.height,t.windowWidth=0,t.windowHeight=0,t._onresize=function(e){this.windowWidth=o(),this.windowHeight=h();const t=this._isGlobal?window:this;let i;"function"==typeof t.windowResized&&(i=t.windowResized(e),void 0===i||i||e.preventDefault())},t._updateWindowSize=function(){this.windowWidth=o(),this.windowHeight=h()},Object.defineProperty(t,"width",{get(){return this._renderer.width}}),Object.defineProperty(t,"height",{get(){return this._renderer.height}}),t.fullscreen=function(e){if(void 0===e)return document.fullscreenElement||document.webkitFullscreenElement||document.mozFullScreenElement||document.msFullscreenElement;e?function(e){if(!(document.fullscreenEnabled||document.webkitFullscreenEnabled||document.mozFullScreenEnabled||document.msFullscreenEnabled))throw new Error("Fullscreen not enabled in this browser.");e.requestFullscreen?e.requestFullscreen():e.mozRequestFullScreen?e.mozRequestFullScreen():e.webkitRequestFullscreen?e.webkitRequestFullscreen():e.msRequestFullscreen&&e.msRequestFullscreen()}(document.documentElement):document.exitFullscreen?document.exitFullscreen():document.mozCancelFullScreen?document.mozCancelFullScreen():document.webkitExitFullscreen?document.webkitExitFullscreen():document.msExitFullscreen&&document.msExitFullscreen()},t.pixelDensity=function(e){let t;return"number"==typeof e?(e!==this._renderer._pixelDensity&&(this._renderer._pixelDensity=e),t=this,this.resizeCanvas(this.width,this.height,!0)):t=this._renderer._pixelDensity,t},t.displayDensity=()=>window.devicePixelRatio,t.getURL=()=>location.href,t.getURLPath=()=>location.pathname.split("/").filter((e=>""!==e)),t.getURLParams=function(){const e=/[?&]([^&=]+)(?:[&=])([^&=]+)/gim;let t;const i={};for(;null!=(t=e.exec(location.search));)t.index===e.lastIndex&&e.lastIndex++,i[t[1]]=t[2];return i},t.worldToScreen=function(e){"number"==typeof e&&(e=this.createVector(...arguments));return this._renderer.getWorldToScreenMatrix().multiplyAndNormalizePoint(e)},t.screenToWorld=function(e){"number"==typeof e&&(e=this.createVector(...arguments));const t=this._renderer.getWorldToScreenMatrix();if(2==e.dimensions){let i=t.mat4[14]/t.mat4[15];e=this.createVector(e.x,e.y,i)}return t.invert(t).multiplyAndNormalizePoint(e)}}function qe(e,t){let i=e.length;Array.isArray(e[0])||(e=[e]),Array.isArray(t[0])||(t=t.map((e=>[e])));let r=t[0].length,s=t[0].map(((e,i)=>t.map((e=>e[i])))),n=e.map((e=>s.map((t=>{let i=0;if(!Array.isArray(e)){for(let r of t)i+=e*r;return i}for(let r=0;r<e.length;r++)i+=e[r]*(t[r]||0);return i}))));return 1===i&&(n=n[0]),1===r?n.map((e=>e[0])):n}function He(e){return"string"===Xe(e)}function Xe(e){return(Object.prototype.toString.call(e).match(/^\[object\s+(.*?)\]$/)[1]||"").toLowerCase()}function Ye(e,{precision:t,unit:i}){return Ze(e)?"none":function(e,t){if(0===e)return 0;let i=~~e,r=0;i&&t&&(r=1+~~Math.log10(Math.abs(i)));const s=10**(t-r);return Math.floor(e*s+.5)/s}(e,t)+(i??"")}function Ze(e){return Number.isNaN(e)||e instanceof Number&&e?.none}void 0!==p5&&$e(p5),void 0!==p5&&We(0,p5.prototype);const Ke={deg:1,grad:.9,rad:180/Math.PI,turn:360};function Je(e){return e[e.length-1]}function Qe(e,t,i){return isNaN(e)?t:isNaN(t)?e:e+(t-e)*i}function et(e,t,i){return Qe(t[0],t[1],function(e,t,i){return(i-e)/(t-e)}(e[0],e[1],i))}function tt(e,t){return Math.sign(e)===Math.sign(t)?e:-e}function it(e,t){return tt(Math.abs(e)**t,e)}function rt(e,t){return 0===t?0:e/t}const st=new class{add(e,t,i){if("string"==typeof arguments[0])(Array.isArray(e)?e:[e]).forEach((function(e){this[e]=this[e]||[],t&&this[e][i?"unshift":"push"](t)}),this);else for(var e in arguments[0])this.add(e,arguments[0][e],arguments[1])}run(e,t){this[e]=this[e]||[],this[e].forEach((function(e){e.call(t&&t.context?t.context:t,t)}))}},nt={D50:[.3457/.3585,1,.2958/.3585],D65:[.3127/.329,1,.3583/.329]};function at(e){return Array.isArray(e)?e:nt[e]}function ot(e,t,i,r={}){if(e=at(e),t=at(t),!e||!t)throw new TypeError(`Missing white point to convert ${e?"":"from"}${e||t?"":"/"}${t?"":"to"}`);if(e===t)return i;let s={W1:e,W2:t,XYZ:i,options:r};if(st.run("chromatic-adaptation-start",s),s.M||(s.W1===nt.D65&&s.W2===nt.D50?s.M=[[1.0479297925449969,.022946870601609652,-.05019226628920524],[.02962780877005599,.9904344267538799,-.017073799063418826],[-.009243040646204504,.015055191490298152,.7518742814281371]]:s.W1===nt.D50&&s.W2===nt.D65&&(s.M=[[.955473421488075,-.02309845494876471,.06325924320057072],[-.0283697093338637,1.0099953980813041,.021041441191917323],[.012314014864481998,-.020507649298898964,1.330365926242124]])),st.run("chromatic-adaptation-end",s),s.M)return qe(s.M,s.XYZ);throw new TypeError("Only Bradford CAT with white points D50 and D65 supported for now.")}var ht={gamut_mapping:"css",precision:5,deltaE:"76",verbose:"test"!==globalThis?.process?.env?.NODE_ENV?.toLowerCase(),warn:function(e){this.verbose&&globalThis?.console?.warn?.(e)}};const ut=new Set(["<number>","<percentage>","<angle>"]);function lt(e,t,i,r){let s=Object.entries(e.coords).map((([e,s],n)=>{let a,o=t.coordGrammar[n],h=r[n],u=h?.type;if(a=h.none?o.find((e=>ut.has(e))):o.find((e=>e==u)),!a){let t=s.name||e;throw new TypeError(`${u??h.raw} not allowed for ${t} in ${i}()`)}let l=a.range;"<percentage>"===u&&(l||=[0,1]);let c=s.range||s.refRange;return l&&c&&(r[n]=et(l,c,r[n])),a}));return s}function ct(e,{meta:t}={}){let i={str:String(e)?.trim()};if(st.run("parse-start",i),i.color)return i.color;if(i.parsed=function(e){if(!e)return;e=e.trim();const t=/^-?[\d.]+$/,i=/%|deg|g?rad|turn$/,r=/\/?\s*(none|[-\w.]+(?:%|deg|g?rad|turn)?)/g;let s=e.match(/^([a-z]+)\((.+?)\)$/i);if(s){let e=[];return s[2].replace(r,((r,s)=>{let n=s.match(i),a=s;if(n){let e=n[0],t=a.slice(0,-e.length);"%"===e?(a=new Number(t/100),a.type="<percentage>"):(a=new Number(t*Ke[e]),a.type="<angle>",a.unit=e)}else t.test(a)?(a=new Number(a),a.type="<number>"):"none"===a&&(a=new Number(NaN),a.none=!0);r.startsWith("/")&&(a=a instanceof Number?a:new Number(a),a.alpha=!0),"object"==typeof a&&a instanceof Number&&(a.raw=s),e.push(a)})),{name:s[1].toLowerCase(),rawName:s[1],rawArgs:s[2],args:e}}}(i.str),i.parsed){let e=i.parsed.name;if("color"===e){let e=i.parsed.args.shift(),r=e.startsWith("--")?e.substring(2):`--${e}`,s=[e,r],n=i.parsed.rawArgs.indexOf("/")>0?i.parsed.args.pop():1;for(let r of dt.all){let a=r.getFormat("color");if(a&&(s.includes(a.id)||a.ids?.filter((e=>s.includes(e))).length)){const s=Object.keys(r.coords).map(((e,t)=>i.parsed.args[t]||0));let o;return a.coordGrammar&&(o=lt(r,a,"color",s)),t&&Object.assign(t,{formatId:"color",types:o}),a.id.startsWith("--")&&!e.startsWith("--")&&ht.warn(`${r.name} is a non-standard space and not currently supported in the CSS spec. Use prefixed color(${a.id}) instead of color(${e}).`),e.startsWith("--")&&!a.id.startsWith("--")&&ht.warn(`${r.name} is a standard space and supported in the CSS spec. Use color(${a.id}) instead of prefixed color(${e}).`),{spaceId:r.id,coords:s,alpha:n}}}let a="",o=e in dt.registry?e:r;if(o in dt.registry){let e=dt.registry[o].formats?.color?.id;e&&(a=`Did you mean color(${e})?`)}throw new TypeError(`Cannot parse color(${e}). `+(a||"Missing a plugin?"))}for(let r of dt.all){let s=r.getFormat(e);if(s&&"function"===s.type){let n=1;(s.lastAlpha||Je(i.parsed.args).alpha)&&(n=i.parsed.args.pop());let a,o=i.parsed.args;return s.coordGrammar&&(a=lt(r,s,e,o)),t&&Object.assign(t,{formatId:s.name,types:a}),{spaceId:r.id,coords:o,alpha:n}}}}else for(let e of dt.all)for(let r in e.formats){let s=e.formats[r];if("custom"!==s.type)continue;if(s.test&&!s.test(i.str))continue;let n=s.parse(i.str);if(n)return n.alpha??=1,t&&(t.formatId=r),n}throw new TypeError(`Could not parse ${e} as a color. Missing a plugin?`)}function pt(e){if(Array.isArray(e))return e.map(pt);if(!e)throw new TypeError("Empty color reference");He(e)&&(e=ct(e));let t=e.space||e.spaceId;return t instanceof dt||(e.space=dt.get(t)),void 0===e.alpha&&(e.alpha=1),e}class dt{constructor(e){this.id=e.id,this.name=e.name,this.base=e.base?dt.get(e.base):null,this.aliases=e.aliases,this.base&&(this.fromBase=e.fromBase,this.toBase=e.toBase);let t=e.coords??this.base.coords;for(let e in t)"name"in t[e]||(t[e].name=e);this.coords=t;let i=e.white??this.base.white??"D65";this.white=at(i),this.formats=e.formats??{};for(let e in this.formats){let t=this.formats[e];t.type||="function",t.name||=e}this.formats.color?.id||(this.formats.color={...this.formats.color??{},id:e.cssId||this.id}),e.gamutSpace?this.gamutSpace="self"===e.gamutSpace?this:dt.get(e.gamutSpace):this.isPolar?this.gamutSpace=this.base:this.gamutSpace=this,this.gamutSpace.isUnbounded&&(this.inGamut=(e,t)=>!0),this.referred=e.referred,Object.defineProperty(this,"path",{value:ft(this).reverse(),writable:!1,enumerable:!0,configurable:!0}),st.run("colorspace-init-end",this)}inGamut(e,{epsilon:t=75e-6}={}){if(!this.equals(this.gamutSpace))return e=this.to(this.gamutSpace,e),this.gamutSpace.inGamut(e,{epsilon:t});let i=Object.values(this.coords);return e.every(((e,r)=>{let s=i[r];if("angle"!==s.type&&s.range){if(Number.isNaN(e))return!0;let[i,r]=s.range;return(void 0===i||e>=i-t)&&(void 0===r||e<=r+t)}return!0}))}get isUnbounded(){return Object.values(this.coords).every((e=>!("range"in e)))}get cssId(){return this.formats?.color?.id||this.id}get isPolar(){for(let e in this.coords)if("angle"===this.coords[e].type)return!0;return!1}getFormat(e){if("object"==typeof e)return e=gt(e,this);let t;return t="default"===e?Object.values(this.formats)[0]:this.formats[e],t?(t=gt(t,this),t):null}equals(e){return!!e&&(this===e||this.id===e||this.id===e.id)}to(e,t){if(1===arguments.length){const i=pt(e);[e,t]=[i.space,i.coords]}if(e=dt.get(e),this.equals(e))return t;t=t.map((e=>Number.isNaN(e)?0:e));let i,r,s=this.path,n=e.path;for(let e=0;e<s.length&&s[e].equals(n[e]);e++)i=s[e],r=e;if(!i)throw new Error(`Cannot convert between color spaces ${this} and ${e}: no connection space was found`);for(let e=s.length-1;e>r;e--)t=s[e].toBase(t);for(let e=r+1;e<n.length;e++)t=n[e].fromBase(t);return t}from(e,t){if(1===arguments.length){const i=pt(e);[e,t]=[i.space,i.coords]}return(e=dt.get(e)).to(this,t)}toString(){return`${this.name} (${this.id})`}getMinCoords(){let e=[];for(let t in this.coords){let i=this.coords[t],r=i.range||i.refRange;e.push(r?.min??0)}return e}static registry={};static get all(){return[...new Set(Object.values(dt.registry))]}static register(e,t){if(1===arguments.length&&(e=(t=arguments[0]).id),t=this.get(t),this.registry[e]&&this.registry[e]!==t)throw new Error(`Duplicate color space registration: '${e}'`);if(this.registry[e]=t,1===arguments.length&&t.aliases)for(let e of t.aliases)this.register(e,t);return t}static get(e,...t){if(!e||e instanceof dt)return e;if("string"===Xe(e)){let t=dt.registry[e.toLowerCase()];if(!t)throw new TypeError(`No color space found with id = "${e}"`);return t}if(t.length)return dt.get(...t);throw new TypeError(`${e} is not a valid color space`)}static resolveCoord(e,t){let i,r,s=Xe(e);if("string"===s?e.includes(".")?[i,r]=e.split("."):[i,r]=[,e]:Array.isArray(e)?[i,r]=e:(i=e.space,r=e.coordId),i=dt.get(i),i||(i=t),!i)throw new TypeError(`Cannot resolve coordinate reference ${e}: No color space specified and relative references are not allowed here`);if(s=Xe(r),"number"===s||"string"===s&&r>=0){let e=Object.entries(i.coords)[r];if(e)return{space:i,id:e[0],index:r,...e[1]}}i=dt.get(i);let n=r.toLowerCase(),a=0;for(let e in i.coords){let t=i.coords[e];if(e.toLowerCase()===n||t.name?.toLowerCase()===n)return{space:i,id:e,index:a,...t};a++}throw new TypeError(`No "${r}" coordinate found in ${i.name}. Its coordinates are: ${Object.keys(i.coords).join(", ")}`)}static DEFAULT_FORMAT={type:"functions",name:"color"}}function ft(e){let t=[e];for(let i=e;i=i.base;)t.push(i);return t}function gt(e,{coords:t}={}){if(e.coords&&!e.coordGrammar){e.type||="function",e.name||="color",e.coordGrammar=e.coords.map((e=>e.split("|").map((e=>{let t=(e=e.trim()).match(/^(<[a-z]+>)\[(-?[.\d]+),\s*(-?[.\d]+)\]?$/);if(t){let e=new String(t[1]);return e.range=[+t[2],+t[3]],e}return e}))));let i=Object.entries(t).map((([t,i],r)=>{let s=e.coordGrammar[r][0],n=i.range||i.refRange,a=s.range,o="";return"<percentage>"==s?(a=[0,100],o="%"):"<angle>"==s&&(o="deg"),{fromRange:n,toRange:a,suffix:o}}));e.serializeCoords=(e,t)=>e.map(((e,r)=>{let{fromRange:s,toRange:n,suffix:a}=i[r];return s&&n&&(e=et(s,n,e)),e=Ye(e,{precision:t,unit:a})}))}return e}var mt=new dt({id:"xyz-d65",name:"XYZ D65",coords:{x:{name:"X"},y:{name:"Y"},z:{name:"Z"}},white:"D65",formats:{color:{ids:["xyz-d65","xyz"]}},aliases:["xyz"]});class yt extends dt{constructor(e){e.coords||(e.coords={r:{range:[0,1],name:"Red"},g:{range:[0,1],name:"Green"},b:{range:[0,1],name:"Blue"}}),e.base||(e.base=mt),e.toXYZ_M&&e.fromXYZ_M&&(e.toBase??=t=>{let i=qe(e.toXYZ_M,t);return this.white!==this.base.white&&(i=ot(this.white,this.base.white,i)),i},e.fromBase??=t=>(t=ot(this.base.white,this.white,t),qe(e.fromXYZ_M,t))),e.referred??="display",super(e)}}function xt(e,t){return e=pt(e),!t||e.space.equals(t)?e.coords.slice():(t=dt.get(t)).from(e)}function vt(e,t){e=pt(e);let{space:i,index:r}=dt.resolveCoord(t,e.space);return xt(e,i)[r]}function bt(e,t,i){return e=pt(e),t=dt.get(t),e.coords=t.to(e.space,i),e}function _t(e,t,i){if(e=pt(e),2===arguments.length&&"object"===Xe(arguments[1])){let t=arguments[1];for(let i in t)_t(e,i,t[i])}else{"function"==typeof i&&(i=i(vt(e,t)));let{space:r,index:s}=dt.resolveCoord(t,e.space),n=xt(e,r);n[s]=i,bt(e,r,n)}return e}bt.returns="color",_t.returns="color";var wt=new dt({id:"xyz-d50",name:"XYZ D50",white:"D50",base:mt,fromBase:e=>ot(mt.white,"D50",e),toBase:e=>ot("D50",mt.white,e)});const Ct=216/24389,Dt=24/116,Et=24389/27;let At=nt.D50;var St=new dt({id:"lab",name:"Lab",coords:{l:{refRange:[0,100],name:"Lightness"},a:{refRange:[-125,125]},b:{refRange:[-125,125]}},white:At,base:wt,fromBase(e){let t=e.map(((e,t)=>e/At[t])),i=t.map((e=>e>Ct?Math.cbrt(e):(Et*e+16)/116));return[116*i[1]-16,500*(i[0]-i[1]),200*(i[1]-i[2])]},toBase(e){let t=[];return t[1]=(e[0]+16)/116,t[0]=e[1]/500+t[1],t[2]=t[1]-e[2]/200,[t[0]>Dt?Math.pow(t[0],3):(116*t[0]-16)/Et,e[0]>8?Math.pow((e[0]+16)/116,3):e[0]/Et,t[2]>Dt?Math.pow(t[2],3):(116*t[2]-16)/Et].map(((e,t)=>e*At[t]))},formats:{lab:{coords:["<number> | <percentage>","<number> | <percentage>[-1,1]","<number> | <percentage>[-1,1]"]}}});function Ft(e){return(e%360+360)%360}var Tt=new dt({id:"lch",name:"LCH",coords:{l:{refRange:[0,100],name:"Lightness"},c:{refRange:[0,150],name:"Chroma"},h:{refRange:[0,360],type:"angle",name:"Hue"}},base:St,fromBase(e){let t,[i,r,s]=e;return t=Math.abs(r)<.02&&Math.abs(s)<.02?NaN:180*Math.atan2(s,r)/Math.PI,[i,Math.sqrt(r**2+s**2),Ft(t)]},toBase(e){let[t,i,r]=e;return i<0&&(i=0),isNaN(r)&&(r=0),[t,i*Math.cos(r*Math.PI/180),i*Math.sin(r*Math.PI/180)]},formats:{lch:{coords:["<number> | <percentage>","<number> | <percentage>","<number> | <angle>"]}}});const Mt=25**7,kt=Math.PI,It=180/kt,Bt=kt/180;function Lt(e){const t=e*e;return t*t*t*e}function Pt(e,t,{kL:i=1,kC:r=1,kH:s=1}={}){[e,t]=pt([e,t]);let[n,a,o]=St.from(e),h=Tt.from(St,[n,a,o])[1],[u,l,c]=St.from(t),p=Tt.from(St,[u,l,c])[1];h<0&&(h=0),p<0&&(p=0);let d=Lt((h+p)/2),f=.5*(1-Math.sqrt(d/(d+Mt))),g=(1+f)*a,m=(1+f)*l,y=Math.sqrt(g**2+o**2),x=Math.sqrt(m**2+c**2),v=0===g&&0===o?0:Math.atan2(o,g),b=0===m&&0===c?0:Math.atan2(c,m);v<0&&(v+=2*kt),b<0&&(b+=2*kt),v*=It,b*=It;let _,w=u-n,C=x-y,D=b-v,E=v+b,A=Math.abs(D);y*x==0?_=0:A<=180?_=D:D>180?_=D-360:D<-180?_=D+360:ht.warn("the unthinkable has happened");let S,F=2*Math.sqrt(x*y)*Math.sin(_*Bt/2),T=(n+u)/2,M=(y+x)/2,k=Lt(M);S=y*x==0?E:A<=180?E/2:E<360?(E+360)/2:(E-360)/2;let I=(T-50)**2,B=1+.015*I/Math.sqrt(20+I),L=1+.045*M,P=1;P-=.17*Math.cos((S-30)*Bt),P+=.24*Math.cos(2*S*Bt),P+=.32*Math.cos((3*S+6)*Bt),P-=.2*Math.cos((4*S-63)*Bt);let O=1+.015*M*P,N=30*Math.exp(-1*((S-275)/25)**2),R=2*Math.sqrt(k/(k+Mt)),V=(w/(i*B))**2;return V+=(C/(r*L))**2,V+=(F/(s*O))**2,V+=-1*Math.sin(2*N*Bt)*R*(C/(r*L))*(F/(s*O)),Math.sqrt(V)}const Ot=[[.819022437996703,.3619062600528904,-.1288737815209879],[.0329836539323885,.9292868615863434,.0361446663506424],[.0481771893596242,.2642395317527308,.6335478284694309]],Nt=[[1.2268798758459243,-.5578149944602171,.2813910456659647],[-.0405757452148008,1.112286803280317,-.0717110580655164],[-.0763729366746601,-.4214933324022432,1.5869240198367816]],Rt=[[.210454268309314,.7936177747023054,-.0040720430116193],[1.9779985324311684,-2.42859224204858,.450593709617411],[.0259040424655478,.7827717124575296,-.8086757549230774]],Vt=[[1,.3963377773761749,.2158037573099136],[1,-.1055613458156586,-.0638541728258133],[1,-.0894841775298119,-1.2914855480194092]];var Ut=new dt({id:"oklab",name:"Oklab",coords:{l:{refRange:[0,1],name:"Lightness"},a:{refRange:[-.4,.4]},b:{refRange:[-.4,.4]}},white:"D65",base:mt,fromBase(e){let t=qe(Ot,e).map((e=>Math.cbrt(e)));return qe(Rt,t)},toBase(e){let t=qe(Vt,e).map((e=>e**3));return qe(Nt,t)},formats:{oklab:{coords:["<percentage> | <number>","<number> | <percentage>[-1,1]","<number> | <percentage>[-1,1]"]}}});function Gt(e,t){[e,t]=pt([e,t]);let[i,r,s]=Ut.from(e),[n,a,o]=Ut.from(t),h=i-n,u=r-a,l=s-o;return Math.sqrt(h**2+u**2+l**2)}function zt(e,t,{epsilon:i=75e-6}={}){e=pt(e),t||(t=e.space),t=dt.get(t);let r=e.coords;return t!==e.space&&(r=t.from(e)),t.inGamut(r,{epsilon:i})}function jt(e){return{space:e.space,coords:e.coords.slice(),alpha:e.alpha}}const $t=Math.PI/180;var Wt=new dt({id:"xyz-abs-d65",cssId:"--xyz-abs-d65",name:"Absolute XYZ D65",coords:{x:{refRange:[0,9504.7],name:"Xa"},y:{refRange:[0,1e4],name:"Ya"},z:{refRange:[0,10888.3],name:"Za"}},base:mt,fromBase:e=>e.map((e=>Math.max(203*e,0))),toBase:e=>e.map((e=>Math.max(e/203,0)))});const qt=1.15,Ht=.66,Xt=2610/16384,Yt=16384/2610,Zt=.8359375,Kt=2413/128,Jt=18.6875,Qt=1.7*2523/32,ei=32/(1.7*2523),ti=-.56,ii=16295499532821565e-27,ri=[[.41478972,.579999,.014648],[-.20151,1.120649,.0531008],[-.0166008,.2648,.6684799]],si=[[1.9242264357876067,-1.0047923125953657,.037651404030618],[.35031676209499907,.7264811939316552,-.06538442294808501],[-.09098281098284752,-.3127282905230739,1.5227665613052603]],ni=[[.5,.5,0],[3.524,-4.066708,.542708],[.199076,1.096799,-1.295875]],ai=[[1,.1386050432715393,.05804731615611886],[.9999999999999999,-.1386050432715393,-.05804731615611886],[.9999999999999998,-.09601924202631895,-.8118918960560388]];var oi=new dt({id:"jzazbz",name:"Jzazbz",coords:{jz:{refRange:[0,1],name:"Jz"},az:{refRange:[-.5,.5]},bz:{refRange:[-.5,.5]}},base:Wt,fromBase(e){let[t,i,r]=e,s=qe(ri,[qt*t-(qt-1)*r,Ht*i-(Ht-1)*t,r]).map((function(e){return((Zt+Kt*(e/1e4)**Xt)/(1+Jt*(e/1e4)**Xt))**Qt})),[n,a,o]=qe(ni,s);return[(1+ti)*n/(1+ti*n)-ii,a,o]},toBase(e){let[t,i,r]=e,s=qe(ai,[(t+ii)/(1+ti-ti*(t+ii)),i,r]).map((function(e){return 1e4*((Zt-e**ei)/(Jt*e**ei-Kt))**Yt})),[n,a,o]=qe(si,s),h=(n+(qt-1)*o)/qt;return[h,(a+(Ht-1)*h)/Ht,o]},formats:{color:{coords:["<number> | <percentage>","<number> | <percentage>[-1,1]","<number> | <percentage>[-1,1]"]}}}),hi=new dt({id:"jzczhz",name:"JzCzHz",coords:{jz:{refRange:[0,1],name:"Jz"},cz:{refRange:[0,1],name:"Chroma"},hz:{refRange:[0,360],type:"angle",name:"Hue"}},base:oi,fromBase(e){let t,[i,r,s]=e;const n=2e-4;return t=Math.abs(r)<n&&Math.abs(s)<n?NaN:180*Math.atan2(s,r)/Math.PI,[i,Math.sqrt(r**2+s**2),Ft(t)]},toBase:e=>[e[0],e[1]*Math.cos(e[2]*Math.PI/180),e[1]*Math.sin(e[2]*Math.PI/180)]});const ui=.8359375,li=2413/128,ci=18.6875,pi=2610/16384,di=2523/32,fi=16384/2610,gi=32/2523,mi=[[.3592832590121217,.6976051147779502,-.035891593232029],[-.1920808463704993,1.100476797037432,.0753748658519118],[.0070797844607479,.0748396662186362,.8433265453898765]],yi=[[.5,.5,0],[6610/4096,-13613/4096,7003/4096],[17933/4096,-17390/4096,-543/4096]],xi=[[.9999999999999998,.0086090370379328,.111029625003026],[.9999999999999998,-.0086090370379328,-.1110296250030259],[.9999999999999998,.5600313357106791,-.3206271749873188]],vi=[[2.0701522183894223,-1.3263473389671563,.2066510476294053],[.3647385209748072,.6805660249472273,-.0453045459220347],[-.0497472075358123,-.0492609666966131,1.1880659249923042]];var bi=new dt({id:"ictcp",name:"ICTCP",coords:{i:{refRange:[0,1],name:"I"},ct:{refRange:[-.5,.5],name:"CT"},cp:{refRange:[-.5,.5],name:"CP"}},base:Wt,fromBase:e=>function(e){let t=e.map((function(e){return((ui+li*(e/1e4)**pi)/(1+ci*(e/1e4)**pi))**di}));return qe(yi,t)}(qe(mi,e)),toBase(e){let t=function(e){let t=qe(xi,e),i=t.map((function(e){return 1e4*(Math.max(e**gi-ui,0)/(li-ci*e**gi))**fi}));return i}(e);return qe(vi,t)}});const _i=nt.D65,wi=1/.42,Ci=2*Math.PI,Di=[[.401288,.650173,-.051461],[-.250268,1.204414,.045854],[-.002079,.048952,.953127]],Ei=[[1.8620678550872327,-1.0112546305316843,.14918677544445175],[.38752654323613717,.6214474419314753,-.008973985167612518],[-.015841498849333856,-.03412293802851557,1.0499644368778496]],Ai=[[460,451,288],[460,-891,-261],[460,-220,-6300]],Si={dark:[.8,.525,.8],dim:[.9,.59,.9],average:[1,.69,1]},Fi={h:[20.14,90,164.25,237.53,380.14],e:[.8,.7,1,1.2,.8],H:[0,100,200,300,400]},Ti=180/Math.PI,Mi=Math.PI/180;function ki(e,t){return e.map((e=>{const i=it(t*Math.abs(e)*.01,.42);return 400*tt(i,e)/(i+27.13)}))}function Ii(e,t,i,r,s){const n={};n.discounting=s,n.refWhite=e,n.surround=r;const a=e.map((e=>100*e));n.la=t,n.yb=i;const o=a[1],h=qe(Di,a),u=(r=Si[n.surround])[0];n.c=r[1],n.nc=r[2];const l=(1/(5*n.la+1))**4;n.fl=l*n.la+.1*(1-l)*(1-l)*Math.cbrt(5*n.la),n.flRoot=n.fl**.25,n.n=n.yb/o,n.z=1.48+Math.sqrt(n.n),n.nbb=.725*n.n**-.2,n.ncb=n.nbb;const c=Math.max(Math.min(u*(1-1/3.6*Math.exp((-n.la-42)/92)),1),0);n.dRgb=h.map((e=>Qe(1,o/e,c))),n.dRgbInv=n.dRgb.map((e=>1/e));const p=h.map(((e,t)=>e*n.dRgb[t])),d=ki(p,n.fl);return n.aW=n.nbb*(2*d[0]+d[1]+.05*d[2]),n}const Bi=Ii(_i,64/Math.PI*.2,20,"average",!1);function Li(e,t){if(!(void 0!==e.J^void 0!==e.Q))throw new Error("Conversion requires one and only one: 'J' or 'Q'");if(!(void 0!==e.C^void 0!==e.M^void 0!==e.s))throw new Error("Conversion requires one and only one: 'C', 'M' or 's'");if(!(void 0!==e.h^void 0!==e.H))throw new Error("Conversion requires one and only one: 'h' or 'H'");if(0===e.J||0===e.Q)return[0,0,0];let i=0;i=void 0!==e.h?Ft(e.h)*Mi:function(e){let t=(e%400+400)%400;const i=Math.floor(.01*t);t%=100;const[r,s]=Fi.h.slice(i,i+2),[n,a]=Fi.e.slice(i,i+2);return Ft((t*(a*r-n*s)-100*r*a)/(t*(a-n)-100*a))}(e.H)*Mi;const r=Math.cos(i),s=Math.sin(i);let n=0;void 0!==e.J?n=.1*it(e.J,.5):void 0!==e.Q&&(n=.25*t.c*e.Q/((t.aW+4)*t.flRoot));let a=0;void 0!==e.C?a=e.C/n:void 0!==e.M?a=e.M/t.flRoot/n:void 0!==e.s&&(a=4e-4*e.s**2*(t.aW+4)/t.c);const o=it(a*Math.pow(1.64-Math.pow(.29,t.n),-.73),10/9),h=.25*(Math.cos(i+2)+3.8),u=t.aW*it(n,2/t.c/t.z),l=5e4/13*t.nc*t.ncb*h,c=u/t.nbb,p=23*(c+.305)*rt(o,23*l+o*(11*r+108*s)),d=function(e,t){const i=100/t*2588.068098016295;return e.map((e=>{const t=Math.abs(e);return tt(i*it(t/(400-t),wi),e)}))}(qe(Ai,[c,p*r,p*s]).map((e=>1*e/1403)),t.fl);return qe(Ei,d.map(((e,i)=>e*t.dRgbInv[i]))).map((e=>e/100))}function Pi(e,t){const i=e.map((e=>100*e)),r=ki(qe(Di,i).map(((e,i)=>e*t.dRgb[i])),t.fl),s=r[0]+(-12*r[1]+r[2])/11,n=(r[0]+r[1]-2*r[2])/9,a=(Math.atan2(n,s)%Ci+Ci)%Ci,o=.25*(Math.cos(a+2)+3.8),h=it(5e4/13*t.nc*t.ncb*rt(o*Math.sqrt(s**2+n**2),r[0]+r[1]+1.05*r[2]+.305),.9)*Math.pow(1.64-Math.pow(.29,t.n),.73),u=it(t.nbb*(2*r[0]+r[1]+.05*r[2])/t.aW,.5*t.c*t.z),l=100*it(u,2),c=4/t.c*u*(t.aW+4)*t.flRoot,p=h*u,d=p*t.flRoot,f=Ft(a*Ti),g=function(e){let t=Ft(e);t<=Fi.h[0]&&(t+=360);const i=function(e,t,i=0,r=e.length){for(;i<r;){const s=i+r>>1;e[s]<t?i=s+1:r=s}return i}(Fi.h,t)-1,[r,s]=Fi.h.slice(i,i+2),[n,a]=Fi.e.slice(i,i+2),o=(t-r)/n;return Fi.H[i]+100*o/(o+(s-t)/a)}(f);return{J:l,C:p,h:f,s:50*it(t.c*h/(t.aW+4),.5),Q:c,M:d,H:g}}new dt({id:"cam16-jmh",cssId:"--cam16-jmh",name:"CAM16-JMh",coords:{j:{refRange:[0,100],name:"J"},m:{refRange:[0,105],name:"Colorfulness"},h:{refRange:[0,360],type:"angle",name:"Hue"}},base:mt,fromBase(e){const t=Pi(e,Bi);return[t.J,t.M,t.h]},toBase:e=>Li({J:e[0],M:e[1],h:e[2]},Bi)});const Oi=216/24389,Ni=24389/27;function Ri(e){return e>8?Math.pow((e+16)/116,3):e/Ni}function Vi(e,t){const i=116*((r=e[1])>Oi?Math.cbrt(r):(Ni*r+16)/116)-16;var r;if(0===i)return[0,0,0];const s=Pi(e,Ui);return[Ft(s.h),s.C,i]}const Ui=Ii(nt.D65,200/Math.PI*Ri(50),100*Ri(50),"average",!1);var Gi=new dt({id:"hct",name:"HCT",coords:{h:{refRange:[0,360],type:"angle",name:"Hue"},c:{refRange:[0,145],name:"Colorfulness"},t:{refRange:[0,100],name:"Tone"}},base:mt,fromBase:e=>Vi(e),toBase:e=>function(e,t){let[i,r,s]=e,n=[],a=0;if(0===s)return[0,0,0];let o=Ri(s);a=s>0?.00379058511492914*s**2+.608983189401032*s+.9155088574762233:9514440756550361e-21*s**2+.08693057439788597*s-21.928975842194614;let h=0,u=1/0;for(;h<=15;){n=Li({J:a,C:r,h:i},t);const e=Math.abs(n[1]-o);if(e<u){if(e<=2e-12)return n;u=e}a-=(n[1]-o)*a/(2*n[1]),h+=1}return Li({J:a,C:r,h:i},t)}(e,Ui),formats:{color:{id:"--hct",coords:["<number> | <angle>","<percentage> | <number>","<percentage> | <number>"]}}});const zi=Math.PI/180,ji=[1,.007,.0228];function $i(e){e[1]<0&&(e=Gi.fromBase(Gi.toBase(e)));const t=Math.log(Math.max(1+ji[2]*e[1]*Ui.flRoot,1))/ji[2],i=e[0]*zi,r=t*Math.cos(i),s=t*Math.sin(i);return[e[2],r,s]}var Wi={deltaE76:function(e,t){return function(e,t,i="lab"){let r=(i=dt.get(i)).from(e),s=i.from(t);return Math.sqrt(r.reduce(((e,t,i)=>{let r=s[i];return isNaN(t)||isNaN(r)?e:e+(r-t)**2}),0))}(e,t,"lab")},deltaECMC:function(e,t,{l:i=2,c:r=1}={}){[e,t]=pt([e,t]);let[s,n,a]=St.from(e),[,o,h]=Tt.from(St,[s,n,a]),[u,l,c]=St.from(t),p=Tt.from(St,[u,l,c])[1];o<0&&(o=0),p<0&&(p=0);let d=s-u,f=o-p,g=(n-l)**2+(a-c)**2-f**2,m=.511;s>=16&&(m=.040975*s/(1+.01765*s));let y,x=.0638*o/(1+.0131*o)+.638;Number.isNaN(h)&&(h=0),y=h>=164&&h<=345?.56+Math.abs(.2*Math.cos((h+168)*$t)):.36+Math.abs(.4*Math.cos((h+35)*$t));let v=Math.pow(o,4),b=Math.sqrt(v/(v+1900)),_=(d/(i*m))**2;return _+=(f/(r*x))**2,_+=g/(x*(b*y+1-b))**2,Math.sqrt(_)},deltaE2000:Pt,deltaEJz:function(e,t){[e,t]=pt([e,t]);let[i,r,s]=hi.from(e),[n,a,o]=hi.from(t),h=i-n,u=r-a;Number.isNaN(s)&&Number.isNaN(o)?(s=0,o=0):Number.isNaN(s)?s=o:Number.isNaN(o)&&(o=s);let l=s-o,c=2*Math.sqrt(r*a)*Math.sin(l/2*(Math.PI/180));return Math.sqrt(h**2+u**2+c**2)},deltaEITP:function(e,t){[e,t]=pt([e,t]);let[i,r,s]=bi.from(e),[n,a,o]=bi.from(t);return 720*Math.sqrt((i-n)**2+.25*(r-a)**2+(s-o)**2)},deltaEOK:Gt,deltaEHCT:function(e,t){[e,t]=pt([e,t]);let[i,r,s]=$i(Gi.from(e)),[n,a,o]=$i(Gi.from(t));return Math.sqrt((i-n)**2+(r-a)**2+(s-o)**2)}};const qi={hct:{method:"hct.c",jnd:2,deltaEMethod:"hct",blackWhiteClamp:{}},"hct-tonal":{method:"hct.c",jnd:0,deltaEMethod:"hct",blackWhiteClamp:{channel:"hct.t",min:0,max:100}}};function Hi(e,{method:t=ht.gamut_mapping,space:i,deltaEMethod:r="",jnd:s=2,blackWhiteClamp:n={}}={}){if(e=pt(e),He(arguments[1])?i=arguments[1]:i||(i=e.space),zt(e,i=dt.get(i),{epsilon:0}))return e;let a;if("css"===t)a=function(e,{space:t}={}){const i=.02,r=1e-4;e=pt(e),t||(t=e.space);t=dt.get(t);const s=dt.get("oklch");if(t.isUnbounded)return Yi(e,t);const n=Yi(e,s);let a=n.coords[0];if(a>=1){const i=Yi(Xi.WHITE,t);return i.alpha=e.alpha,Yi(i,t)}if(a<=0){const i=Yi(Xi.BLACK,t);return i.alpha=e.alpha,Yi(i,t)}if(zt(n,t,{epsilon:0}))return Yi(n,t);function o(e){const i=Yi(e,t),r=Object.values(t.coords);return i.coords=i.coords.map(((e,t)=>{if("range"in r[t]){const[i,s]=r[t].range;return function(e,t,i){return Math.max(Math.min(i,t),e)}(i,e,s)}return e})),i}let h=0,u=n.coords[1],l=!0,c=jt(n),p=o(c),d=Gt(p,c);if(d<i)return p;for(;u-h>r;){const e=(h+u)/2;if(c.coords[1]=e,l&&zt(c,t,{epsilon:0}))h=e;else if(p=o(c),d=Gt(p,c),d<i){if(i-d<r)break;l=!1,h=e}else u=e}return p}(e,{space:i});else{if("clip"===t||zt(e,i))a=Yi(e,i);else{Object.prototype.hasOwnProperty.call(qi,t)&&({method:t,jnd:s,deltaEMethod:r,blackWhiteClamp:n}=qi[t]);let o=Pt;if(""!==r)for(let e in Wi)if("deltae"+r.toLowerCase()===e.toLowerCase()){o=Wi[e];break}let h=Hi(Yi(e,i),{method:"clip",space:i});if(o(e,h)>s){if(3===Object.keys(n).length){let t=dt.resolveCoord(n.channel),i=vt(Yi(e,t.space),t.id);if(Ze(i)&&(i=0),i>=n.max)return Yi({space:"xyz-d65",coords:nt.D65},e.space);if(i<=n.min)return Yi({space:"xyz-d65",coords:[0,0,0]},e.space)}let r=dt.resolveCoord(t),h=r.space,u=r.id,l=Yi(e,h);l.coords.forEach(((e,t)=>{Ze(e)&&(l.coords[t]=0)}));let c=(r.range||r.refRange)[0],p=function(e){const t=e?Math.floor(Math.log10(Math.abs(e))):0;return Math.max(parseFloat("1e"+(t-2)),1e-6)}(s),d=c,f=vt(l,u);for(;f-d>p;){let e=jt(l);e=Hi(e,{space:i,method:"clip"}),o(l,e)-s<p?d=vt(l,u):f=vt(l,u),_t(l,u,(d+f)/2)}a=Yi(l,i)}else a=h}if("clip"===t||!zt(a,i,{epsilon:0})){let e=Object.values(i.coords).map((e=>e.range||[]));a.coords=a.coords.map(((t,i)=>{let[r,s]=e[i];return void 0!==r&&(t=Math.max(r,t)),void 0!==s&&(t=Math.min(t,s)),t}))}}return i!==e.space&&(a=Yi(a,e.space)),e.coords=a.coords,e}Hi.returns="color";const Xi={WHITE:{space:Ut,coords:[1,0,0]},BLACK:{space:Ut,coords:[0,0,0]}};function Yi(e,t,{inGamut:i}={}){e=pt(e);let r=(t=dt.get(t)).from(e),s={space:t,coords:r,alpha:e.alpha};return i&&(s=Hi(s,!0===i?void 0:i)),s}Yi.returns="color";var Zi=new yt({id:"p3-linear",cssId:"--display-p3-linear",name:"Linear P3",white:"D65",toXYZ_M:[[.4865709486482162,.26566769316909306,.1982172852343625],[.2289745640697488,.6917385218365064,.079286914093745],[0,.04511338185890264,1.043944368900976]],fromXYZ_M:[[2.493496911941425,-.9313836179191239,-.40271078445071684],[-.8294889695615747,1.7626640603183463,.023624685841943577],[.03584583024378447,-.07617238926804182,.9568845240076872]]});var Ki=new yt({id:"srgb-linear",name:"Linear sRGB",white:"D65",toXYZ_M:[[.41239079926595934,.357584339383878,.1804807884018343],[.21263900587151027,.715168678767756,.07219231536073371],[.01933081871559182,.11919477979462598,.9505321522496607]],fromXYZ_M:[[3.2409699419045226,-1.537383177570094,-.4986107602930034],[-.9692436362808796,1.8759675015077202,.04155505740717559],[.05563007969699366,-.20397695888897652,1.0569715142428786]]}),Ji={aliceblue:[240/255,248/255,1],antiquewhite:[250/255,235/255,215/255],aqua:[0,1,1],aquamarine:[127/255,1,212/255],azure:[240/255,1,1],beige:[245/255,245/255,220/255],bisque:[1,228/255,196/255],black:[0,0,0],blanchedalmond:[1,235/255,205/255],blue:[0,0,1],blueviolet:[138/255,43/255,226/255],brown:[165/255,42/255,42/255],burlywood:[222/255,184/255,135/255],cadetblue:[95/255,158/255,160/255],chartreuse:[127/255,1,0],chocolate:[210/255,105/255,30/255],coral:[1,127/255,80/255],cornflowerblue:[100/255,149/255,237/255],cornsilk:[1,248/255,220/255],crimson:[220/255,20/255,60/255],cyan:[0,1,1],darkblue:[0,0,139/255],darkcyan:[0,139/255,139/255],darkgoldenrod:[184/255,134/255,11/255],darkgray:[169/255,169/255,169/255],darkgreen:[0,100/255,0],darkgrey:[169/255,169/255,169/255],darkkhaki:[189/255,183/255,107/255],darkmagenta:[139/255,0,139/255],darkolivegreen:[85/255,107/255,47/255],darkorange:[1,140/255,0],darkorchid:[.6,50/255,.8],darkred:[139/255,0,0],darksalmon:[233/255,150/255,122/255],darkseagreen:[143/255,188/255,143/255],darkslateblue:[72/255,61/255,139/255],darkslategray:[47/255,79/255,79/255],darkslategrey:[47/255,79/255,79/255],darkturquoise:[0,206/255,209/255],darkviolet:[148/255,0,211/255],deeppink:[1,20/255,147/255],deepskyblue:[0,191/255,1],dimgray:[105/255,105/255,105/255],dimgrey:[105/255,105/255,105/255],dodgerblue:[30/255,144/255,1],firebrick:[178/255,34/255,34/255],floralwhite:[1,250/255,240/255],forestgreen:[34/255,139/255,34/255],fuchsia:[1,0,1],gainsboro:[220/255,220/255,220/255],ghostwhite:[248/255,248/255,1],gold:[1,215/255,0],goldenrod:[218/255,165/255,32/255],gray:[128/255,128/255,128/255],green:[0,128/255,0],greenyellow:[173/255,1,47/255],grey:[128/255,128/255,128/255],honeydew:[240/255,1,240/255],hotpink:[1,105/255,180/255],indianred:[205/255,92/255,92/255],indigo:[75/255,0,130/255],ivory:[1,1,240/255],khaki:[240/255,230/255,140/255],lavender:[230/255,230/255,250/255],lavenderblush:[1,240/255,245/255],lawngreen:[124/255,252/255,0],lemonchiffon:[1,250/255,205/255],lightblue:[173/255,216/255,230/255],lightcoral:[240/255,128/255,128/255],lightcyan:[224/255,1,1],lightgoldenrodyellow:[250/255,250/255,210/255],lightgray:[211/255,211/255,211/255],lightgreen:[144/255,238/255,144/255],lightgrey:[211/255,211/255,211/255],lightpink:[1,182/255,193/255],lightsalmon:[1,160/255,122/255],lightseagreen:[32/255,178/255,170/255],lightskyblue:[135/255,206/255,250/255],lightslategray:[119/255,136/255,.6],lightslategrey:[119/255,136/255,.6],lightsteelblue:[176/255,196/255,222/255],lightyellow:[1,1,224/255],lime:[0,1,0],limegreen:[50/255,205/255,50/255],linen:[250/255,240/255,230/255],magenta:[1,0,1],maroon:[128/255,0,0],mediumaquamarine:[.4,205/255,170/255],mediumblue:[0,0,205/255],mediumorchid:[186/255,85/255,211/255],mediumpurple:[147/255,112/255,219/255],mediumseagreen:[60/255,179/255,113/255],mediumslateblue:[123/255,104/255,238/255],mediumspringgreen:[0,250/255,154/255],mediumturquoise:[72/255,209/255,.8],mediumvioletred:[199/255,21/255,133/255],midnightblue:[25/255,25/255,112/255],mintcream:[245/255,1,250/255],mistyrose:[1,228/255,225/255],moccasin:[1,228/255,181/255],navajowhite:[1,222/255,173/255],navy:[0,0,128/255],oldlace:[253/255,245/255,230/255],olive:[128/255,128/255,0],olivedrab:[107/255,142/255,35/255],orange:[1,165/255,0],orangered:[1,69/255,0],orchid:[218/255,112/255,214/255],palegoldenrod:[238/255,232/255,170/255],palegreen:[152/255,251/255,152/255],paleturquoise:[175/255,238/255,238/255],palevioletred:[219/255,112/255,147/255],papayawhip:[1,239/255,213/255],peachpuff:[1,218/255,185/255],peru:[205/255,133/255,63/255],pink:[1,192/255,203/255],plum:[221/255,160/255,221/255],powderblue:[176/255,224/255,230/255],purple:[128/255,0,128/255],rebeccapurple:[.4,.2,.6],red:[1,0,0],rosybrown:[188/255,143/255,143/255],royalblue:[65/255,105/255,225/255],saddlebrown:[139/255,69/255,19/255],salmon:[250/255,128/255,114/255],sandybrown:[244/255,164/255,96/255],seagreen:[46/255,139/255,87/255],seashell:[1,245/255,238/255],sienna:[160/255,82/255,45/255],silver:[192/255,192/255,192/255],skyblue:[135/255,206/255,235/255],slateblue:[106/255,90/255,205/255],slategray:[112/255,128/255,144/255],slategrey:[112/255,128/255,144/255],snow:[1,250/255,250/255],springgreen:[0,1,127/255],steelblue:[70/255,130/255,180/255],tan:[210/255,180/255,140/255],teal:[0,128/255,128/255],thistle:[216/255,191/255,216/255],tomato:[1,99/255,71/255],turquoise:[64/255,224/255,208/255],violet:[238/255,130/255,238/255],wheat:[245/255,222/255,179/255],white:[1,1,1],whitesmoke:[245/255,245/255,245/255],yellow:[1,1,0],yellowgreen:[154/255,205/255,50/255]};let Qi=Array(3).fill("<percentage> | <number>[0, 255]"),er=Array(3).fill("<number>[0, 255]");var tr=new yt({id:"srgb",name:"sRGB",base:Ki,fromBase:e=>e.map((e=>{let t=e<0?-1:1,i=e*t;return i>.0031308?t*(1.055*i**(1/2.4)-.055):12.92*e})),toBase:e=>e.map((e=>{let t=e<0?-1:1,i=e*t;return i<=.04045?e/12.92:t*((i+.055)/1.055)**2.4})),formats:{rgb:{coords:Qi},rgb_number:{name:"rgb",commas:!0,coords:er,noAlpha:!0},color:{},rgba:{coords:Qi,commas:!0,lastAlpha:!0},rgba_number:{name:"rgba",commas:!0,coords:er},hex:{type:"custom",toGamut:!0,test:e=>/^#([a-f0-9]{3,4}){1,2}$/i.test(e),parse(e){e.length<=5&&(e=e.replace(/[a-f0-9]/gi,"$&$&"));let t=[];return e.replace(/[a-f0-9]{2}/gi,(e=>{t.push(parseInt(e,16)/255)})),{spaceId:"srgb",coords:t.slice(0,3),alpha:t.slice(3)[0]}},serialize:(e,t,{collapse:i=!0}={})=>{t<1&&e.push(t),e=e.map((e=>Math.round(255*e)));let r=i&&e.every((e=>e%17==0));return"#"+e.map((e=>r?(e/17).toString(16):e.toString(16).padStart(2,"0"))).join("")}},keyword:{type:"custom",test:e=>/^[a-z]+$/i.test(e),parse(e){let t={spaceId:"srgb",coords:null,alpha:1};if("transparent"===(e=e.toLowerCase())?(t.coords=Ji.black,t.alpha=0):t.coords=Ji[e],t.coords)return t}}}}),ir=new yt({id:"p3",cssId:"display-p3",name:"P3",base:Zi,fromBase:tr.fromBase,toBase:tr.toBase});function rr(e,t,i={}){if(function(e){return"function"===Xe(e)&&!!e.rangeArgs}(e)){let[i,r]=[e,t];return rr(...i.rangeArgs.colors,{...i.rangeArgs.options,...r})}let{space:r,outputSpace:s,progression:n,premultiplied:a}=i;e=pt(e),t=pt(t),e=jt(e),t=jt(t);let o={colors:[e,t],options:i};if(r=r?dt.get(r):dt.registry[ht.interpolationSpace]||e.space,s=s?dt.get(s):r,e=Yi(e,r),t=Yi(t,r),e=Hi(e),t=Hi(t),r.coords.h&&"angle"===r.coords.h.type){let s=i.hue=i.hue||"shorter",n=[r,"h"],[a,o]=[vt(e,n),vt(t,n)];isNaN(a)&&!isNaN(o)?a=o:isNaN(o)&&!isNaN(a)&&(o=a),[a,o]=function(e,t){if("raw"===e)return t;let[i,r]=t.map(Ft),s=r-i;return"increasing"===e?s<0&&(r+=360):"decreasing"===e?s>0&&(i+=360):"longer"===e?-180<s&&s<180&&(s>0?i+=360:r+=360):"shorter"===e&&(s>180?i+=360:s<-180&&(r+=360)),[i,r]}(s,[a,o]),_t(e,n,a),_t(t,n,o)}return a&&(e.coords=e.coords.map((t=>t*e.alpha)),t.coords=t.coords.map((e=>e*t.alpha))),Object.assign((i=>{i=n?n(i):i;let o=e.coords.map(((e,r)=>Qe(e,t.coords[r],i))),h=Qe(e.alpha,t.alpha,i),u={space:r,coords:o,alpha:h};return a&&(u.coords=u.coords.map((e=>e/h))),s!==r&&(u=Yi(u,s)),u}),{rangeArgs:o})}ht.interpolationSpace="lab";var sr=new dt({id:"hsl",name:"HSL",coords:{h:{refRange:[0,360],type:"angle",name:"Hue"},s:{range:[0,100],name:"Saturation"},l:{range:[0,100],name:"Lightness"}},base:tr,fromBase:e=>{let t=Math.max(...e),i=Math.min(...e),[r,s,n]=e,[a,o,h]=[NaN,0,(i+t)/2],u=t-i;if(0!==u){switch(o=0===h||1===h?0:(t-h)/Math.min(h,1-h),t){case r:a=(s-n)/u+(s<n?6:0);break;case s:a=(n-r)/u+2;break;case n:a=(r-s)/u+4}a*=60}return o<0&&(a+=180,o=Math.abs(o)),a>=360&&(a-=360),[a,100*o,100*h]},toBase:e=>{let[t,i,r]=e;function s(e){let s=(e+t/30)%12,n=i*Math.min(r,1-r);return r-n*Math.max(-1,Math.min(s-3,9-s,1))}return t%=360,t<0&&(t+=360),i/=100,r/=100,[s(0),s(8),s(4)]},formats:{hsl:{coords:["<number> | <angle>","<percentage>","<percentage>"]},hsla:{coords:["<number> | <angle>","<percentage>","<percentage>"],commas:!0,lastAlpha:!0}}}),nr=new dt({id:"hsv",name:"HSV",coords:{h:{refRange:[0,360],type:"angle",name:"Hue"},s:{range:[0,100],name:"Saturation"},v:{range:[0,100],name:"Value"}},base:sr,fromBase(e){let[t,i,r]=e;i/=100,r/=100;let s=r+i*Math.min(r,1-r);return[t,0===s?0:200*(1-r/s),100*s]},toBase(e){let[t,i,r]=e;i/=100,r/=100;let s=r*(1-i/2);return[t,0===s||1===s?0:(r-s)/Math.min(s,1-s)*100,100*s]},formats:{color:{id:"--hsv",coords:["<number> | <angle>","<percentage> | <number>","<percentage> | <number>"]}}}),ar=new dt({id:"hwb",name:"HWB",coords:{h:{refRange:[0,360],type:"angle",name:"Hue"},w:{range:[0,100],name:"Whiteness"},b:{range:[0,100],name:"Blackness"}},base:nr,fromBase(e){let[t,i,r]=e;return[t,r*(100-i)/100,100-r]},toBase(e){let[t,i,r]=e;i/=100,r/=100;let s=i+r;if(s>=1){return[t,0,100*(i/s)]}let n=1-r;return[t,100*(0===n?0:1-i/n),100*n]},formats:{hwb:{coords:["<number> | <angle>","<percentage> | <number>","<percentage> | <number>"]}}}),or=new dt({id:"oklch",name:"Oklch",coords:{l:{refRange:[0,1],name:"Lightness"},c:{refRange:[0,.4],name:"Chroma"},h:{refRange:[0,360],type:"angle",name:"Hue"}},white:"D65",base:Ut,fromBase(e){let t,[i,r,s]=e;const n=2e-4;return t=Math.abs(r)<n&&Math.abs(s)<n?NaN:180*Math.atan2(s,r)/Math.PI,[i,Math.sqrt(r**2+s**2),Ft(t)]},toBase(e){let t,i,[r,s,n]=e;return isNaN(n)?(t=0,i=0):(t=s*Math.cos(n*Math.PI/180),i=s*Math.sin(n*Math.PI/180)),[r,t,i]},formats:{oklch:{coords:["<percentage> | <number>","<number> | <percentage>[0,1]","<number> | <angle>"]}}}),hr=new dt({id:"hsb",name:"HSB",coords:{h:{refRange:[0,360],type:"angle",name:"Hue"},s:{range:[0,100],name:"Saturation"},b:{range:[0,100],name:"Brightness"}},base:tr,fromBase:e=>{const t=Math.max(...e),i=t-Math.min(...e);let r,s,[n,a,o]=e;return 0===i?(r=0,s=0):(s=i/t,n===t?r=(a-o)/i:a===t?r=2+(o-n)/i:o===t&&(r=4+(n-a)/i),r<0?r+=6:r>=6&&(r-=6)),[r/6*360,100*s,100*t]},toBase:ur,formats:{default:{type:"custom",serialize:(e,t)=>{const i=ur(e);let r=`rgb(${Math.round(100*i[0]*100)/100}% ${Math.round(100*i[1]*100)/100}% ${Math.round(100*i[2]*100)/100}%`;return t<1&&(r+=` / ${t}`),r+=")",r}},hsb:{coords:["<number> | <angle>","<percentage>","<percentage>"]},hsba:{coords:["<number> | <angle>","<percentage>","<percentage>"],commans:!0,lastAlpha:!0}}});function ur(e){const t=e[0]/360*6,i=e[1]/100,r=e[2]/100;let s=[];if(0===i)s=[r,r,r];else{const e=Math.floor(t),n=r*(1-i),a=r*(1-i*(t-e)),o=r*(1-i*(1+e-t));let h,u,l;1===e?(h=a,u=r,l=n):2===e?(h=n,u=r,l=o):3===e?(h=n,u=a,l=r):4===e?(h=o,u=n,l=r):5===e?(h=r,u=n,l=a):(h=r,u=o,l=n),s=[h,u,l]}return s}const lr=(e,t,i,r,s,n)=>{let a=(e-t)/(i-t)*(s-r)+r;return n&&(a=Math.max(a,Math.min(r,s)),a=Math.min(a,Math.max(r,s))),a},cr={};class pr{_color;mode;static colorMap={};static#e={};static#t={};static addColorMode(e,t){dt.register(t),pr.colorMap[e]=t.id,pr.#e[e]=Object.values(t.coords).reduce(((e,t)=>(e.push(t.refRange||t.range),e)),[]),pr.#e[e].push([0,1]),pr.#t[e]=t.fromGray}constructor(e,t,i,{clamp:r=!1}={}){if(this.mode=t||fr,e instanceof pr){const i=t?pr.colorMap[t]:pr.colorMap[e.mode];this._color=Yi(e._color,i),this.mode=i}else if("object"!=typeof e||Array.isArray(e)||null===e)if("string"==typeof e[0])try{this._color=ct(e[0]);const[t]=Object.entries(pr.colorMap).find((([e,t])=>t===this._color.spaceId));this.mode=t,this._color=Yi(this._color,this._color.spaceId)}catch(e){throw new Error("Invalid color string")}else{let t;if(i)if(4===e.length)t=pr.mapColorRange(e,this.mode,i,r);else if(3===e.length)t=pr.mapColorRange([e[0],e[1],e[2]],this.mode,i,r),t.push(1);else if(2===e.length){t=pr.#t[this.mode]?pr.#t[this.mode](e[0],i,r):pr.mapColorRange([e[0],e[0],e[0]],this.mode,i,r);const s=Array.isArray(i[i.length-1])?i[i.length-1]:[0,i[i.length-1]];t.push(lr(e[1],s[0],s[1],0,1,r))}else{if(1!==e.length)throw new Error("Invalid color");t=pr.#t[this.mode]?pr.#t[this.mode](e[0],i,r):pr.mapColorRange([e[0],e[0],e[0]],this.mode,i,r),t.push(1)}else t=e;const s=pr.colorMap[this.mode]||console.error("Invalid color mode"),n={space:s,coords:t.slice(0,3),alpha:t[3]};this._color=Yi(n,s)}else{const i=t?pr.colorMap[t]:e.spaceId;this._color=Yi(e,i),this.mode=t||Object.entries(pr.colorMap).find((([e,t])=>t===this._color.spaceId))}}static mapColorRange(e,t,i,r){const s=i.map((e=>Array.isArray(e)?e:[0,e])),n=pr.#e[t];return e.map(((e,t)=>lr(e,s[t][0],s[t][1],n[t][0],n[t][1],r)))}static unmapColorRange(e,t,i){const r=i.map((e=>Array.isArray(e)?e:[0,e])),s=pr.#e[t];return e.map(((e,t)=>lr(e,s[t][0],s[t][1],r[t][0],r[t][1])))}#i(e){return new pr(this._color,e)}get _array(){return this._getRGBA()}array(){return this._array}lerp(e,t,i){let r=-1;for(;(r+1<this._color.space.path.length||r+1<e._color.space.path.length)&&this._color.space.path[r+1]===e._color.space.path[r+1];)r+=1;if(-1===r)throw new Error("Cannot lerp colors. No common color space found");const s=rr(this._color,e._color,{space:this._color.space.path[r].id})(t);return new pr(s,i||this.mode)}toString(e){const t=`${this._color.space.id}-${this._color.coords.join(",")}-${this._color.alpha}-${e}`;let i=cr[t];return i||(i=function(e,{precision:t=ht.precision,format:i="default",inGamut:r=!0,...s}={}){let n,a=i;i=(e=pt(e)).space.getFormat(i)??e.space.getFormat("default")??dt.DEFAULT_FORMAT;let o=e.coords.slice();if(r||=i.toGamut,r&&!zt(e)&&(o=Hi(jt(e),!0===r?void 0:r).coords),"custom"===i.type){if(s.precision=t,!i.serialize)throw new TypeError(`format ${a} can only be used to parse colors, not for serialization`);n=i.serialize(o,e.alpha,s)}else{let r=i.name||"color";i.serializeCoords?o=i.serializeCoords(o,t):null!==t&&(o=o.map((e=>Ye(e,{precision:t}))));let s=[...o];if("color"===r){let t=i.id||i.ids?.[0]||e.space.id;s.unshift(t)}let a=e.alpha;null!==t&&(a=Ye(a,{precision:t}));let h=e.alpha>=1||i.noAlpha?"":`${i.commas?",":" /"} ${a}`;n=`${r}(${s.join(i.commas?", ":" ")}${h})`}return n}(this._color,{format:e}),cr[t]=i),i}setRed(e,t=[0,1]){Array.isArray(t)||(t=[0,t]);const i=pr.#e[fr][0],r=lr(e,t[0],t[1],i[0],i[1]);if(this.mode===fr||this.mode===gr)this._color.coords[0]=r;else{const e=this._color.space.id,t=Yi(this._color,"srgb");t.coords[0]=r,this._color=Yi(t,e)}}setGreen(e,t=[0,1]){Array.isArray(t)||(t=[0,t]);const i=pr.#e[fr][1],r=lr(e,t[0],t[1],i[0],i[1]);if(this.mode===fr||this.mode===gr)this._color.coords[1]=r;else{const e=this._color.space.id,t=Yi(this._color,"srgb");t.coords[1]=r,this._color=Yi(t,e)}}setBlue(e,t=[0,1]){Array.isArray(t)||(t=[0,t]);const i=pr.#e[fr][2],r=lr(e,t[0],t[1],i[0],i[1]);if(this.mode===fr||this.mode===gr)this._color.coords[2]=r;else{const e=this._color.space.id,t=Yi(this._color,"srgb");t.coords[2]=r,this._color=Yi(t,e)}}setAlpha(e,t=[0,1]){Array.isArray(t)||(t=[0,t]);const i=pr.#e[this.mode][3],r=lr(e,t[0],t[1],i[0],i[1]);this._color.alpha=r}_getRGBA(e=[1,1,1,1]){const t=pr.#e[fr];let i=structuredClone(Yi(this._color,"srgb").coords);i.push(this._color.alpha);const r=e.map((e=>Array.isArray(e)?e:[0,e]));return i=i.map(((e,i)=>lr(e,t[i][0],t[i][1],r[i][0],r[i][1]))),i}_getMode(){return this.mode}_getRed(e=[0,1]){if(Array.isArray(e)||(e=[0,e]),this.mode===fr||this.mode===gr){const t=pr.#e[this.mode][0];return lr(this._color.coords[0],t[0],t[1],e[0],e[1])}{const t=pr.#e[fr][0];return lr(Yi(this._color,"srgb").coords[0],t[0],t[1],e[0],e[1])}}_getGreen(e=[0,1]){if(Array.isArray(e)||(e=[0,e]),this.mode===fr||this.mode===gr){const t=pr.#e[this.mode][1];return lr(this._color.coords[1],t[0],t[1],e[0],e[1])}{const t=pr.#e[fr][1];return lr(Yi(this._color,"srgb").coords[1],t[0],t[1],e[0],e[1])}}_getBlue(e=[0,1]){if(Array.isArray(e)||(e=[0,e]),this.mode===fr||this.mode===gr){const t=pr.#e[this.mode][2];return lr(this._color.coords[2],t[0],t[1],e[0],e[1])}{const t=pr.#e[fr][2];return lr(Yi(this._color,"srgb").coords[2],t[0],t[1],e[0],e[1])}}_getAlpha(e=[0,1]){Array.isArray(e)||(e=[0,e]);const t=pr.#e[this.mode][3];return lr(this._color.alpha,t[0],t[1],e[0],e[1])}_getHue(e=[0,360]){if(Array.isArray(e)||(e=[0,e]),this.mode===mr||this.mode===yr){const t=pr.#e[this.mode][0];return lr(this._color.coords[0],t[0],t[1],e[0],e[1])}{const t=pr.#e[yr][0];return lr(Yi(this._color,"hsl").coords[0],t[0],t[1],e[0],e[1])}}_getSaturation(e=[0,100]){if(Array.isArray(e)||(e=[0,e]),this.mode===mr||this.mode===yr){const t=pr.#e[this.mode][1];return lr(this._color.coords[1],t[0],t[1],e[0],e[1])}{const t=pr.#e[yr][1];return lr(Yi(this._color,"hsl").coords[1],t[0],t[1],e[0],e[1])}}_getBrightness(e=[0,100]){if(Array.isArray(e)||(e=[0,e]),this.mode===mr){const t=pr.#e[this.mode][2];return lr(this._color.coords[2],t[0],t[1],e[0],e[1])}{const t=pr.#e[mr][2];return lr(Yi(this._color,"hsb").coords[2],t[0],t[1],e[0],e[1])}}_getLightness(e=[0,100]){if(Array.isArray(e)||(e=[0,e]),this.mode===yr){const t=pr.#e[this.mode][2];return lr(this._color.coords[2],t[0],t[1],e[0],e[1])}{const t=pr.#e[yr][2];return lr(Yi(this._color,"hsl").coords[2],t[0],t[1],e[0],e[1])}}}function dr(e,t,i){e.Color=pr,tr.fromGray=ir.fromGray=function(e,t,i){const r=t.map((e=>Array.isArray(e)?e:[0,e])),s=lr(e,r[2][0],r[2][1],0,1,i);return[s,s,s]},hr.fromGray=sr.fromGray=function(e,t,i){const r=t.map((e=>Array.isArray(e)?e:[0,e]));return[0,0,lr(e,r[2][0],r[2][1],0,100,i)]},ar.fromGray=function(e,t,i){const r=t.map((e=>Array.isArray(e)?e:[0,e])),s=Math.abs(r[1][0]-r[1][1])/2+Math.abs(r[2][0]-r[2][1])/2,n=lr(e,0,s,0,100);let a,o;return n<50?(o=n,a=100-n):n>=50&&(a=n,o=100-n),[0,a,o]},St.fromGray=Tt.fromGray=Ut.fromGray=or.fromGray=function(e,t,i){const r=t.map((e=>Array.isArray(e)?e:[0,e]));return[lr(e,r[0][0],r[0][1],0,100,i),0,0]},e.Color.addColorMode(fr,tr),e.Color.addColorMode(gr,ir),e.Color.addColorMode(mr,hr),e.Color.addColorMode(yr,sr),e.Color.addColorMode(xr,ar),e.Color.addColorMode(vr,St),e.Color.addColorMode(br,Tt),e.Color.addColorMode(_r,Ut),e.Color.addColorMode(wr,or),i.presetup=function(){const t=this,i=["Red","Green","Blue","Alpha"];for(let r in i){const s=i[r],n=e.Color.prototype["set"+s];e.Color.prototype["set"+s]=function(e,i){return i=i||t?._renderer?.states?.colorMaxes?.[fr][r],n.call(this,e,i)}}function r(i,r){const s=e.Color.prototype["_get"+i];e.Color.prototype["_get"+i]=function(e){if(Object.keys(r).includes(this.mode))e=e||t?._renderer?.states?.colorMaxes?.[this.mode][r[this.mode]];else{const i=Object.keys(r)[0];e=e||t?._renderer?.states?.colorMaxes?.[i][r[i]]}return s.call(this,e)}}r("Red",{[fr]:0,[gr]:0}),r("Green",{[fr]:1,[gr]:1}),r("Blue",{[fr]:2,[gr]:2}),r("Alpha",{[fr]:3,[gr]:3,[mr]:3,[yr]:3,[xr]:3,[vr]:3,[br]:3,[_r]:3,[wr]:3}),r("Hue",{[yr]:0,[mr]:0,[xr]:0,[br]:2,[wr]:2}),r("Saturation",{[yr]:1,[mr]:1}),r("Brightness",{[mr]:2}),r("Lightness",{[yr]:2})}}void 0!==p5&&dr(p5);const fr="rgb",gr="rgbhdr",mr="hsb",yr="hsl",xr="hwb",vr="lab",br="lch",_r="oklab",wr="oklch",Cr="rgba";function Dr(e,t){t.RGB=fr,t.RGBHDR=gr,t.HSB=mr,t.HSL=yr,t.HWB=xr,t.LAB=vr,t.LCH=br,t.OKLAB=_r,t.OKLCH=wr,t.RGBA=Cr,e.Renderer.states.colorMode=fr,e.Renderer.states.colorMaxes={[fr]:[255,255,255,255],[gr]:[255,255,255,255],[mr]:[360,100,100,1],[yr]:[360,100,100,1],[xr]:[360,100,100,1],[vr]:[100,[-125,125],[-125,125],1],[br]:[100,150,360,1],[_r]:[100,[-125,125],[-125,125],1],[wr]:[100,150,360,1],clone:function(){const e={...this};for(const t in e)e[t]instanceof Array&&(e[t]=[...e[t]]);return e}},t.color=function(...e){if(e[0]instanceof pr)return e[0];const t=Array.isArray(e[0])?e[0]:e;return new pr(t,this._renderer.states.colorMode,this._renderer.states.colorMaxes[this._renderer.states.colorMode],{clamp:!0})},t.red=function(e){return this.color(e)._getRed()},t.green=function(e){return this.color(e)._getGreen()},t.blue=function(e){return this.color(e)._getBlue()},t.alpha=function(e){return this.color(e)._getAlpha()},t.hue=function(e){return this.color(e)._getHue()},t.saturation=function(e){return this.color(e)._getSaturation()},t.brightness=function(e){return this.color(e)._getBrightness()},t.lightness=function(e){return this.color(e)._getLightness()},t.lerpColor=function(e,t,i){return e.lerp(t,i,this._renderer.states.colorMode)},t.paletteLerp=function(e,t){const i=e[0];if(t<i[1])return this.color(i[0]);for(let i=1;i<e.length;i++){const r=e[i];if(t<r[1]){const s=e[i-1];return this.lerpColor(this.color(s[0]),this.color(r[0]),(t-s[1])/(r[1]-s[1]))}}return this.color(e[e.length-1][0])}}void 0!==p5&&Dr(p5,p5.prototype);class Er{constructor(e){if(e)this.DOM=e;else{const e=document.implementation.createDocument(null,"doc");this.DOM=e.createElement("root")}}getParent(){return new Er(this.DOM.parentElement)}getName(){return this.DOM.tagName}setName(e){const t=this.DOM.innerHTML,i=this.DOM.attributes,r=document.implementation.createDocument(null,"default").createElement(e);r.innerHTML=t;for(let e=0;e<i.length;e++)r.setAttribute(i[e].nodeName,i[e].nodeValue);this.DOM=r}hasChildren(){return this.DOM.children.length>0}listChildren(){const e=[];for(let t=0;t<this.DOM.childNodes.length;t++)e.push(this.DOM.childNodes[t].nodeName);return e}getChildren(e){return Ar(e?this.DOM.getElementsByTagName(e):this.DOM.children)}getChild(e){if("string"!=typeof e)return new Er(this.DOM.children[e]);for(const t of this.DOM.children)if(t.tagName===e)return new Er(t)}addChild(e){e instanceof Er&&this.DOM.appendChild(e.DOM)}removeChild(e){let t=-1;if("string"==typeof e){for(let i=0;i<this.DOM.children.length;i++)if(this.DOM.children[i].tagName===e){t=i;break}}else t=e;-1!==t&&this.DOM.removeChild(this.DOM.children[t])}getAttributeCount(){return this.DOM.attributes.length}listAttributes(){const e=[];for(const t of this.DOM.attributes)e.push(t.nodeName);return e}hasAttribute(e){const t={};for(const e of this.DOM.attributes)t[e.nodeName]=e.nodeValue;return!!t[e]}getNum(e,t){const i={};for(const e of this.DOM.attributes)i[e.nodeName]=e.nodeValue;return Number(i[e])||t||0}getString(e,t){const i={};for(const e of this.DOM.attributes)i[e.nodeName]=e.nodeValue;return i[e]?String(i[e]):t||null}setAttribute(e,t){this.DOM.setAttribute(e,t)}getContent(e){let t;return t=this.DOM.textContent,t=t.replace(/\s\s+/g,","),t||e||null}setContent(e){this.DOM.children.length||(this.DOM.textContent=e)}serialize(){return(new XMLSerializer).serializeToString(this.DOM)}}function Ar(e){const t=[];for(let i=0;i<e.length;i++)t.push(new Er(e[i]));return t}function Sr(e,t){e.XML=Er}void 0!==p5&&Sr(p5);class Fr{constructor(e,t){this.file=e,this._pInst=t;const i=e.type.split("/");this.type=i[0],this.subtype=i[1],this.name=e.name,this.size=e.size,this.data=void 0}static _createLoader(e,t){const i=new FileReader;return i.onload=function(i){const r=new Fr(e);if("application/json"===r.file.type)r.data=JSON.parse(i.target.result);else if("text/xml"===r.file.type){const e=(new DOMParser).parseFromString(i.target.result,"text/xml");r.data=new Er(e.documentElement)}else r.data=i.target.result;t(r)},i}static _load(e,t){if(/^text\//.test(e.type)||"application/json"===e.type)Fr._createLoader(e,t).readAsText(e);else if(/^(video|audio)\//.test(e.type)){const i=new Fr(e);i.data=URL.createObjectURL(e),t(i)}else Fr._createLoader(e,t).readAsDataURL(e)}}function Tr(e,t){e.File=Fr}void 0!==p5&&Tr(p5);class Mr{width;height;elt;constructor(e,t){this.elt=e,this._pInst=this._pixelsState=t,this._events={},this.width=this.elt.offsetWidth,this.height=this.elt.offsetHeight}remove(){if(this.stop){this.stop();const e=this.elt.srcObject;if(null!==e){e.getTracks().forEach((e=>{e.stop()}))}}const e=this._pInst._elements.indexOf(this);-1!==e&&this._pInst._elements.splice(e,1);for(let e in this._events)this.elt.removeEventListener(e,this._events[e]);this.elt&&this.elt.parentNode&&this.elt.parentNode.removeChild(this.elt)}parent(e){return void 0===e?this.elt.parentNode:("string"==typeof e?("#"===e[0]&&(e=e.substring(1)),e=document.getElementById(e)):e instanceof Mr&&(e=e.elt),e.appendChild(this.elt),this)}child(e){return void 0===e?this.elt.childNodes:("string"==typeof e?("#"===e[0]&&(e=e.substring(1)),e=document.getElementById(e)):e instanceof Mr&&(e=e.elt),e instanceof HTMLElement&&this.elt.appendChild(e),this)}html(...e){return 0===e.length?this.elt.innerHTML:e[1]?(this.elt.insertAdjacentHTML("beforeend",e[0]),this):(this.elt.innerHTML=e[0],this)}id(e){return void 0===e?this.elt.id:(this.elt.id=e,this.width=this.elt.offsetWidth,this.height=this.elt.offsetHeight,this)}class(e){return void 0===e?this.elt.className:(this.elt.className=e,this)}addClass(e){return this.elt.className?this.hasClass(e)||(this.elt.className=this.elt.className+" "+e):this.elt.className=e,this}removeClass(e){return this.elt.classList.remove(e),this}hasClass(e){return this.elt.classList.contains(e)}toggleClass(e){return this.elt.classList.contains(e)?this.elt.classList.remove(e):this.elt.classList.add(e),this}center(e){const t=this.elt.style.display,i="none"===this.elt.style.display,r="none"===this.parent().style.display,s={x:this.elt.offsetLeft,y:this.elt.offsetTop};i&&this.show(),r&&this.parent().show(),this.elt.style.display="block",this.position(0,0);const n=Math.abs(this.parent().offsetWidth-this.elt.offsetWidth),a=Math.abs(this.parent().offsetHeight-this.elt.offsetHeight);return"both"===e||void 0===e?this.position(n/2+this.parent().offsetLeft,a/2+this.parent().offsetTop):"horizontal"===e?this.position(n/2+this.parent().offsetLeft,s.y):"vertical"===e&&this.position(s.x,a/2+this.parent().offsetTop),this.style("display",t),i&&this.hide(),r&&this.parent().hide(),this}position(...e){if(0===e.length)return{x:this.elt.offsetLeft,y:this.elt.offsetTop};{let t="absolute";return"static"!==e[2]&&"fixed"!==e[2]&&"relative"!==e[2]&&"sticky"!==e[2]&&"initial"!==e[2]&&"inherit"!==e[2]||(t=e[2]),this.elt.style.position=t,this.elt.style.left=e[0]+"px",this.elt.style.top=e[1]+"px",this.x=e[0],this.y=e[1],this}}show(){return this.elt.style.display="block",this}hide(){return this.elt.style.display="none",this}size(e,t){if(0===arguments.length)return{width:this.elt.offsetWidth,height:this.elt.offsetHeight};{let i=e,r=t;const s=z;if(i!==s||r!==s){if(i===s?i=t*this.width/this.height:r===s&&(r=e*this.height/this.width),this.elt instanceof HTMLCanvasElement){const e={},t=this.elt.getContext("2d");let s;for(s in t)e[s]=t[s];for(s in this.elt.setAttribute("width",i*this._pInst._pixelDensity),this.elt.setAttribute("height",r*this._pInst._pixelDensity),this.elt.style.width=i+"px",this.elt.style.height=r+"px",this._pInst.scale(this._pInst._pixelDensity,this._pInst._pixelDensity),e)this.elt.getContext("2d")[s]=e[s]}else this.elt.style.width=i+"px",this.elt.style.height=r+"px",this.elt.width=i,this.elt.height=r;this.width=i,this.height=r,this._pInst&&this._pInst._curElement&&this._pInst._curElement.elt===this.elt&&(this._pInst.width=i,this._pInst.height=r)}return this}}style(e,t){const i=this;if(t instanceof pr&&(t=t.toString()),void 0===t){if(-1===e.indexOf(":")){return window.getComputedStyle(i.elt).getPropertyValue(e)}{const t=e.split(";");for(let e=0;e<t.length;e++){const i=t[e].split(":");i[0]&&i[1]&&(this.elt.style[i[0].trim()]=i[1].trim())}}}else if(this.elt.style[e]=t,"width"===e||"height"===e||"left"===e||"top"===e){let t=window.getComputedStyle(i.elt).getPropertyValue(e).replace(/[^\d.]/g,"");this[e]=Math.round(parseFloat(t,10))}return this}_translate(...e){this.elt.style.position="absolute";let t="";return this.elt.style.transform&&(t=this.elt.style.transform.replace(/translate3d\(.*\)/g,""),t=t.replace(/translate[X-Z]?\(.*\)/g,"")),2===e.length?this.elt.style.transform="translate("+e[0]+"px, "+e[1]+"px)":e.length>2&&(this.elt.style.transform="translate3d("+e[0]+"px,"+e[1]+"px,"+e[2]+"px)",3===e.length?this.elt.parentElement.style.perspective="1000px":this.elt.parentElement.style.perspective=e[3]+"px"),this.elt.style.transform+=t,this}_rotate(...e){let t="";return this.elt.style.transform&&(t=this.elt.style.transform.replace(/rotate3d\(.*\)/g,""),t=t.replace(/rotate[X-Z]?\(.*\)/g,"")),1===e.length?this.elt.style.transform="rotate("+e[0]+"deg)":2===e.length?this.elt.style.transform="rotate("+e[0]+"deg, "+e[1]+"deg)":3===e.length&&(this.elt.style.transform="rotateX("+e[0]+"deg)",this.elt.style.transform+="rotateY("+e[1]+"deg)",this.elt.style.transform+="rotateZ("+e[2]+"deg)"),this.elt.style.transform+=t,this}attribute(e,t){if(null==this.elt.firstChild||"checkbox"!==this.elt.firstChild.type&&"radio"!==this.elt.firstChild.type)return void 0===t?this.elt.getAttribute(e):(this.elt.setAttribute(e,t),this);if(void 0===t)return this.elt.firstChild.getAttribute(e);for(let i=0;i<this.elt.childNodes.length;i++)this.elt.childNodes[i].setAttribute(e,t)}removeAttribute(e){if(null!=this.elt.firstChild&&("checkbox"===this.elt.firstChild.type||"radio"===this.elt.firstChild.type))for(let t=0;t<this.elt.childNodes.length;t++)this.elt.childNodes[t].removeAttribute(e);return this.elt.removeAttribute(e),this}value(...e){return e.length>0?(this.elt.value=e[0],this):"range"===this.elt.type?parseFloat(this.elt.value):this.elt.value}mousePressed(e){return Mr._adjustListener("pointerdown",(function(t){return this._pInst.mouseIsPressed=!0,this._pInst._activePointers.set(t.pointerId,t),this._pInst._setMouseButton(t),this._pInst._updatePointerCoords(t),e.call(this,t)}),this),this}doubleClicked(e){return Mr._adjustListener("dblclick",e,this),this}mouseWheel(e){return Mr._adjustListener("wheel",e,this),this}mouseReleased(e){return Mr._adjustListener("pointerup",e,this),this}mouseClicked(e){return Mr._adjustListener("click",e,this),this}mouseMoved(e){return Mr._adjustListener("pointermove",e,this),this}mouseOver(e){return Mr._adjustListener("pointerover",e,this),this}mouseOut(e){return Mr._adjustListener("pointerout",e,this),this}dragOver(e){return Mr._adjustListener("dragover",e,this),this}dragLeave(e){return Mr._adjustListener("dragleave",e,this),this}changed(e){return Mr._adjustListener("change",e,this),this}input(e){return Mr._adjustListener("input",e,this),this}drop(e,t){if(window.File&&window.FileReader&&window.FileList&&window.Blob){if(!this._dragDisabled){this._dragDisabled=!0;const e=function(e){e.preventDefault()};this.elt.addEventListener("dragover",e),this.elt.addEventListener("dragleave",e)}Mr._attachListener("drop",(function(i){i.preventDefault(),"function"==typeof t&&t.call(this,i);const r=i.dataTransfer.files;for(const t of r)Fr._load(t,e)}),this)}else console.log("The File APIs are not fully supported in this browser.");return this}draggable(e){let t,i="ontouchstart"in window,r=0,s=0,n=0,a=0,o=i?"touchstart":"mousedown",h=i?"touchend":"mouseup",u=i?"touchmove":"mousemove";function l(t){if(t=t||window.event,i){const e=t.changedTouches;r=n-parseInt(e[0].clientX),s=a-parseInt(e[0].clientY),n=parseInt(e[0].clientX),a=parseInt(e[0].clientY)}else r=n-parseInt(t.clientX),s=a-parseInt(t.clientY),n=parseInt(t.clientX),a=parseInt(t.clientY);e.style.left=e.offsetLeft-r+"px",e.style.top=e.offsetTop-s+"px"}function c(){document.removeEventListener(h,c,!1),document.removeEventListener(u,l,!1)}return void 0===e?t=e=this.elt:e!==this.elt&&e.elt!==this.elt&&(e=e.elt,t=this.elt),t.addEventListener(o,(function(e){if(e=e||window.event,i){const t=e.changedTouches;n=parseInt(t[0].clientX),a=parseInt(t[0].clientY)}else n=parseInt(e.clientX),a=parseInt(e.clientY);return document.addEventListener(h,c,!1),document.addEventListener(u,l,!1),!1}),!1),t.style.cursor="move",this}static _adjustListener(e,t,i){return!1===t?Mr._detachListener(e,i):Mr._attachListener(e,t,i),this}static _attachListener(e,t,i){i._events[e]&&Mr._detachListener(e,i);const r=t.bind(i);i.elt.addEventListener(e,r,!1),i._events[e]=r}static _detachListener(e,t){const i=t._events[e];t.elt.removeEventListener(e,i,!1),t._events[e]=null}}function kr(e,t){e.Element=Mr}void 0!==p5&&kr(p5);const Ir={_toPixels(e){if(e instanceof ImageData)return e.data;if(e.getContext("2d"))return e.getContext("2d").getImageData(0,0,e.width,e.height).data;if(e.getContext("webgl")){const t=e.getContext("webgl"),i=t.drawingBufferWidth*t.drawingBufferHeight*4,r=new Uint8Array(i);return t.readPixels(0,0,e.width,e.height,t.RGBA,t.UNSIGNED_BYTE,r),r}},_getARGB(e,t){const i=4*t;return e[i+3]<<24&4278190080|e[i]<<16&16711680|e[i+1]<<8&65280|255&e[i+2]},_setPixels(e,t){let i=0;for(let r=0,s=e.length;r<s;r++)i=4*r,e[i+0]=(16711680&t[r])>>>16,e[i+1]=(65280&t[r])>>>8,e[i+2]=255&t[r],e[i+3]=(4278190080&t[r])>>>24},_toImageData:e=>e instanceof ImageData?e:e.getContext("2d").getImageData(0,0,e.width,e.height),_createImageData(e,t){return Ir._tmpCanvas=document.createElement("canvas"),Ir._tmpCtx=Ir._tmpCanvas.getContext("2d"),this._tmpCtx.createImageData(e,t)},apply(e,t,i){const r=e.getContext("2d"),s=r.getImageData(0,0,e.width,e.height),n=t(s,i);n instanceof ImageData?r.putImageData(n,0,0,0,0,e.width,e.height):r.putImageData(s,0,0,0,0,e.width,e.height)},threshold(e,t=.5){const i=Ir._toPixels(e),r=Math.floor(255*t);for(let e=0;e<i.length;e+=4){let t;t=.2126*i[e]+.7152*i[e+1]+.0722*i[e+2]>=r?255:0,i[e]=i[e+1]=i[e+2]=t}},gray(e){const t=Ir._toPixels(e);for(let e=0;e<t.length;e+=4){const i=.2126*t[e]+.7152*t[e+1]+.0722*t[e+2];t[e]=t[e+1]=t[e+2]=i}},opaque(e){const t=Ir._toPixels(e);for(let e=0;e<t.length;e+=4)t[e+3]=255;return t},invert(e){const t=Ir._toPixels(e);for(let e=0;e<t.length;e+=4)t[e]=255-t[e],t[e+1]=255-t[e+1],t[e+2]=255-t[e+2]},posterize(e,t=4){const i=Ir._toPixels(e);if(t<2||t>255)throw new Error("Level must be greater than 2 and less than 255 for posterize");const r=t-1;for(let e=0;e<i.length;e+=4){const s=i[e],n=i[e+1],a=i[e+2];i[e]=255*(s*t>>8)/r,i[e+1]=255*(n*t>>8)/r,i[e+2]=255*(a*t>>8)/r}},dilate(e){const t=Ir._toPixels(e);let i=0;const r=t.length?t.length/4:0,s=new Int32Array(r);let n,a,o,h,u,l,c,p,d,f,g,m,y,x,v,b,_;for(;i<r;)for(n=i,a=i+e.width;i<a;)o=h=Ir._getARGB(t,i),c=i-1,l=i+1,p=i-e.width,d=i+e.width,c<n&&(c=i),l>=a&&(l=i),p<0&&(p=0),d>=r&&(d=i),m=Ir._getARGB(t,p),g=Ir._getARGB(t,c),y=Ir._getARGB(t,d),f=Ir._getARGB(t,l),u=77*(o>>16&255)+151*(o>>8&255)+28*(255&o),v=77*(g>>16&255)+151*(g>>8&255)+28*(255&g),x=77*(f>>16&255)+151*(f>>8&255)+28*(255&f),b=77*(m>>16&255)+151*(m>>8&255)+28*(255&m),_=77*(y>>16&255)+151*(y>>8&255)+28*(255&y),v>u&&(h=g,u=v),x>u&&(h=f,u=x),b>u&&(h=m,u=b),_>u&&(h=y,u=_),s[i++]=h;Ir._setPixels(t,s)},erode(e){const t=Ir._toPixels(e);let i=0;const r=t.length?t.length/4:0,s=new Int32Array(r);let n,a,o,h,u,l,c,p,d,f,g,m,y,x,v,b,_;for(;i<r;)for(n=i,a=i+e.width;i<a;)o=h=Ir._getARGB(t,i),c=i-1,l=i+1,p=i-e.width,d=i+e.width,c<n&&(c=i),l>=a&&(l=i),p<0&&(p=0),d>=r&&(d=i),m=Ir._getARGB(t,p),g=Ir._getARGB(t,c),y=Ir._getARGB(t,d),f=Ir._getARGB(t,l),u=77*(o>>16&255)+151*(o>>8&255)+28*(255&o),v=77*(g>>16&255)+151*(g>>8&255)+28*(255&g),x=77*(f>>16&255)+151*(f>>8&255)+28*(255&f),b=77*(m>>16&255)+151*(m>>8&255)+28*(255&m),_=77*(y>>16&255)+151*(y>>8&255)+28*(255&y),v<u&&(h=g,u=v),x<u&&(h=f,u=x),b<u&&(h=m,u=b),_<u&&(h=y,u=_),s[i++]=h;Ir._setPixels(t,s)},blur(e,t){!function(e,t){const i=Ir._toPixels(e),r=e.width,s=e.height,n=r*s,a=new Int32Array(n);for(let e=0;e<n;e++)a[e]=Ir._getARGB(i,e);let o,h,u,l,c,p,d,f,g,m;const y=new Int32Array(n),x=new Int32Array(n),v=new Int32Array(n),b=new Int32Array(n);let _,w,C,D,E=0;for(function(e){let t=3.5*e|0;if(t=t<1?1:t<248?t:248,Br!==t){Br=t,Lr=1+Br<<1,Pr=new Int32Array(Lr),Or=new Array(Lr);for(let e=0;e<Lr;e++)Or[e]=new Int32Array(256);let e,i,r,s;for(let e=1,n=t-1;e<t;e++){Pr[t+e]=Pr[n]=i=n*n,r=Or[t+e],s=Or[n--];for(let e=0;e<256;e++)r[e]=s[e]=i*e}e=Pr[t]=t*t,r=Or[t];for(let t=0;t<256;t++)r[t]=e*t}}(t),w=0;w<s;w++){for(_=0;_<r;_++){if(l=u=h=c=o=0,p=_-Br,p<0)m=-p,p=0;else{if(p>=r)break;m=0}for(C=m;C<Lr&&!(p>=r);C++){const e=a[p+E];D=Or[C],c+=D[(-16777216&e)>>>24],h+=D[(16711680&e)>>16],u+=D[(65280&e)>>8],l+=D[255&e],o+=Pr[C],p++}d=E+_,y[d]=c/o,x[d]=h/o,v[d]=u/o,b[d]=l/o}E+=r}for(E=0,f=-Br,g=f*r,w=0;w<s;w++){for(_=0;_<r;_++){if(l=u=h=c=o=0,f<0)m=d=-f,p=_;else{if(f>=s)break;m=0,d=f,p=_+g}for(C=m;C<Lr&&!(d>=s);C++)D=Or[C],c+=D[y[p]],h+=D[x[p]],u+=D[v[p]],l+=D[b[p]],o+=Pr[C],d++,p+=r;a[_+E]=c/o<<24|h/o<<16|u/o<<8|l/o}E+=r,g+=r,f++}Ir._setPixels(i,a)}(e,t)}};let Br,Lr,Pr,Or;var Nr="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function Rr(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Vr,Ur,Gr={exports:{}};Vr=Gr,Ur=Ur||function(e){if(!(void 0===e||"undefined"!=typeof navigator&&/MSIE [1-9]\./.test(navigator.userAgent))){var t=e.document,i=function(){return e.URL||e.webkitURL||e},r=t.createElementNS("http://www.w3.org/1999/xhtml","a"),s="download"in r,n=/constructor/i.test(e.HTMLElement)||e.safari,a=/CriOS\/[\d]+/.test(navigator.userAgent),o=function(t){(e.setImmediate||e.setTimeout)((function(){throw t}),0)},h=function(e){setTimeout((function(){"string"==typeof e?i().revokeObjectURL(e):e.remove()}),4e4)},u=function(e){return/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(e.type)?new Blob([String.fromCharCode(65279),e],{type:e.type}):e},l=function(t,l,c){c||(t=u(t));var p,d=this,f="application/octet-stream"===t.type,g=function(){!function(e,t){for(var i=(t=[].concat(t)).length;i--;){var r=e["on"+t[i]];if("function"==typeof r)try{r.call(e,e)}catch(e){o(e)}}}(d,"writestart progress write writeend".split(" "))};if(d.readyState=d.INIT,s)return p=i().createObjectURL(t),void setTimeout((function(){var e,t;r.href=p,r.download=l,e=r,t=new MouseEvent("click"),e.dispatchEvent(t),g(),h(p),d.readyState=d.DONE}));!function(){if((a||f&&n)&&e.FileReader){var r=new FileReader;return r.onloadend=function(){var t=a?r.result:r.result.replace(/^data:[^;]*;/,"data:attachment/file;");e.open(t,"_blank")||(e.location.href=t),t=void 0,d.readyState=d.DONE,g()},r.readAsDataURL(t),void(d.readyState=d.INIT)}p||(p=i().createObjectURL(t)),f?e.location.href=p:e.open(p,"_blank")||(e.location.href=p),d.readyState=d.DONE,g(),h(p)}()},c=l.prototype;return"undefined"!=typeof navigator&&navigator.msSaveOrOpenBlob?function(e,t,i){return t=t||e.name||"download",i||(e=u(e)),navigator.msSaveOrOpenBlob(e,t)}:(c.abort=function(){},c.readyState=c.INIT=0,c.WRITING=1,c.DONE=2,c.error=c.onwritestart=c.onprogress=c.onwrite=c.onabort=c.onerror=c.onwriteend=null,function(e,t,i){return new l(e,t||e.name||"download",i)})}}("undefined"!=typeof self&&self||"undefined"!=typeof window&&window||Nr.content),Vr.exports&&(Vr.exports.saveAs=Ur);var zr=Gr.exports;function jr(e,t,i){const r=$r(t,i)[0];let s=e;s instanceof Blob||(s=new Blob([e])),zr.saveAs(s,r)}function $r(e,t){t&&!0!==t&&"true"!==t||(t=""),e||(e="untitled");let i="";return e&&e.includes(".")&&(i=e.split(".").pop()),t&&i!==t&&(i=t,e=`${e}.${i}`),[e,i]}class Wr{constructor(e,t){this.width=e,this.height=t,this.canvas=document.createElement("canvas"),this.canvas.width=this.width,this.canvas.height=this.height,this.drawingContext=this.canvas.getContext("2d"),this._pixelsState=this,this._pixelDensity=1,this.gifProperties=null,this._modified=!1,this.pixels=[]}pixelDensity(e){return void 0!==e?(e<=0&&(e=1),this._pixelDensity=e,this.width/=e,this.height/=e,this):this._pixelDensity}_animateGif(e){const t=this.gifProperties,i=e._lastRealFrameTime||window.performance.now();if(0===t.lastChangeTime&&(t.lastChangeTime=i),t.playing){t.timeDisplayed=i-t.lastChangeTime;const e=t.frames[t.displayIndex].delay;if(t.timeDisplayed>=e){const r=Math.floor(t.timeDisplayed/e);if(t.timeDisplayed=0,t.lastChangeTime=i,t.displayIndex+=r,t.loopCount=Math.floor(t.displayIndex/t.numFrames),null!==t.loopLimit&&t.loopCount>=t.loopLimit)t.playing=!1;else{const e=t.displayIndex%t.numFrames;this.drawingContext.putImageData(t.frames[e].image,0,0),t.displayIndex=e,this.setModified(!0)}}}}loadPixels(){const e=this._pixelsState,t=this._pixelDensity,i=this.width*t,r=this.height*t,s=this.drawingContext.getImageData(0,0,i,r);e.imageData=s,this.pixels=e.pixels=s.data,this.setModified(!0)}updatePixels(e,t,i,r){const s=this._pixelsState,n=this._pixelDensity;void 0===e&&void 0===t&&void 0===i&&void 0===r&&(e=0,t=0,i=this.width,r=this.height),e*=n,t*=n,i*=n,r*=n,this.gifProperties&&(this.gifProperties.frames[this.gifProperties.displayIndex].image=s.imageData),this.drawingContext.putImageData(s.imageData,e,t,0,0,i,r),this.setModified(!0)}get(e,t,i,r){const s=this._pixelsState,n=this._pixelDensity,a=this.canvas;if(void 0===e&&void 0===t)e=t=0,i=s.width,r=s.height;else if(e*=n,t*=n,void 0===i&&void 0===r)return e<0||t<0||e>=a.width||t>=a.height?[0,0,0,0]:this._getPixel(e,t);const o=new Wr(i*n,r*n);return o.pixelDensity(n),o.canvas.getContext("2d").drawImage(a,e,t,i*n,r*n,0,0,i*n,r*n),o}_getPixel(e,t){let i,r;return i=this.drawingContext.getImageData(e,t,1,1).data,r=0,[i[0],i[1],i[2],i[3]]}set(e,t,i){e=Math.floor(e),t=Math.floor(t);const r=this._pixelsState;if(i instanceof Wr)this.drawingContext.save(),this.drawingContext.setTransform(1,0,0,1,0,0),this.drawingContext.scale(this._pixelDensity,this._pixelDensity),this.drawingContext.clearRect(e,t,i.width,i.height),this.drawingContext.drawImage(i.canvas,e,t),this.drawingContext.restore();else{let s=0,n=0,a=0,o=0,h=4*(t*this._pixelDensity*(this.width*this._pixelDensity)+e*this._pixelDensity);if(r.imageData||r.loadPixels(),"number"==typeof i)h<r.pixels.length&&(s=i,n=i,a=i,o=255);else if(Array.isArray(i)){if(i.length<4)throw new Error("pixel array must be of the form [R, G, B, A]");h<r.pixels.length&&(s=i[0],n=i[1],a=i[2],o=i[3])}else i instanceof p5.Color&&h<r.pixels.length&&([s,n,a,o]=i._getRGBA([255,255,255,255]));for(let i=0;i<this._pixelDensity;i++)for(let u=0;u<this._pixelDensity;u++)h=4*((t*this._pixelDensity+u)*this.width*this._pixelDensity+(e*this._pixelDensity+i)),r.pixels[h]=s,r.pixels[h+1]=n,r.pixels[h+2]=a,r.pixels[h+3]=o}this.setModified(!0)}resize(e,t){0===e&&0===t?(e=this.canvas.width,t=this.canvas.height):0===e?e=this.canvas.width*t/this.canvas.height:0===t&&(t=this.canvas.height*e/this.canvas.width),e=Math.floor(e),t=Math.floor(t);const i=document.createElement("canvas");if(i.width=e,i.height=t,this.gifProperties){const i=this.gifProperties,r=(e,t)=>{let i=0;for(let r=0;r<t.height;r++)for(let s=0;s<t.width;s++){const n=Math.floor(s*e.width/t.width);let a=4*(Math.floor(r*e.height/t.height)*e.width+n);t.data[i++]=e.data[a++],t.data[i++]=e.data[a++],t.data[i++]=e.data[a++],t.data[i++]=e.data[a++]}};for(let s=0;s<i.numFrames;s++){const n=this.drawingContext.createImageData(e,t);r(i.frames[s].image,n),i.frames[s].image=n}}i.getContext("2d").drawImage(this.canvas,0,0,this.canvas.width,this.canvas.height,0,0,i.width,i.height),this.canvas.width=this.width=e,this.canvas.height=this.height=t,this.drawingContext.drawImage(i,0,0,e,t,0,0,e,t),this.pixels.length>0&&this.loadPixels(),this.setModified(!0)}copy(...e){let t,i,r,s,n,a,o,h,u;if(9===e.length)t=e[0],i=e[1],r=e[2],s=e[3],n=e[4],a=e[5],o=e[6],h=e[7],u=e[8];else{if(8!==e.length)throw new Error("Signature not supported");t=this,i=e[0],r=e[1],s=e[2],n=e[3],a=e[4],o=e[5],h=e[6],u=e[7]}this._copyHelper(this,t,i,r,s,n,a,o,h,u)}_copyHelper(e,t,i,r,s,n,a,o,h,u){const l=t.canvas.width/t.width;let c=0,p=0;t._renderer&&t._renderer.isP3D&&(c=t.width/2,p=t.height/2),e._renderer&&e._renderer.isP3D?(e.push(),e.resetMatrix(),e.noLights(),e.blendMode(e.BLEND),e.imageMode(e.CORNER),e._renderer.image(t,i+c,r+p,s,n,a,o,h,u),e.pop()):e.drawingContext.drawImage(t.canvas,l*(i+c),l*(r+p),l*s,l*n,a,o,h,u)}mask(e){void 0===e&&(e=this);const t=this.drawingContext.globalCompositeOperation;let i=this._pixelDensity,r=1;e instanceof xs&&(r=e._pInst._renderer._pixelDensity);const s=[e,0,0,r*e.width,r*e.height,0,0,i*this.width,i*this.height];if(this.drawingContext.globalCompositeOperation="destination-in",this.gifProperties){for(let e=0;e<this.gifProperties.frames.length;e++)this.drawingContext.putImageData(this.gifProperties.frames[e].image,0,0),this.copy(...s),this.gifProperties.frames[e].image=this.drawingContext.getImageData(0,0,i*this.width,i*this.height);this.drawingContext.putImageData(this.gifProperties.frames[this.gifProperties.displayIndex].image,0,0)}else this.copy(...s);this.drawingContext.globalCompositeOperation=t,this.setModified(!0)}filter(e,t){Ir.apply(this.canvas,Ir[e],t),this.setModified(!0)}blend(...e){const t=this.drawingContext.globalCompositeOperation,i=e[e.length-1],r=Array.prototype.slice.call(e,0,e.length-1);this.drawingContext.globalCompositeOperation=i,this.copy(...r),this.drawingContext.globalCompositeOperation=t,this.setModified(!0)}setModified(e){this._modified=e}isModified(){return this._modified}save(e,t){if(this.gifProperties)!function(e,t){const i=e.gifProperties;let r=i.loopLimit;1===r?r=null:null===r&&(r=0);const s=new Uint8Array(e.width*e.height*i.numFrames),n=[],a={};for(let t=0;t<i.numFrames;t++){const r=new Set,s=i.frames[t].image.data,o=s.length,h=new Uint32Array(e.width*e.height);for(let e=0,t=0;e<o;e+=4,t++){const i=s[e+0]<<16|s[e+1]<<8|s[e+2];r.add(i),h[t]=i}const u=[...r].sort().toString();void 0===a[u]?a[u]={freq:1,frames:[t]}:(a[u].freq+=1,a[u].frames.push(t)),n.push(h)}let o=[];const h=Object.keys(a).sort((function(e,t){return a[t].freq-a[e].freq})),u=h[0].split(",").map((e=>parseInt(e)));o=o.concat(a[u].frames);const l=new Set(u);for(let e=1;e<h.length;e++){const t=h[e].split(",").map((e=>parseInt(e))).filter((e=>!l.has(e)));if(u.length+t.length<=256){for(let e=0;e<t.length;e++)u.push(t[e]),l.add(t[e]);o=o.concat(a[h[e]].frames)}}o=new Set(o);const c={};for(let e=0;e<u.length;e++)c[u[e]]||(c[u[e]]=e);let p=1;for(;p<u.length;)p<<=1;u.length=p;const d={loop:r,palette:new Uint32Array(u)},f=new omggif.GifWriter(s,e.width,e.height,d);let g={};for(let t=0;t<i.numFrames;t++){const r=!o.has(t),s=r?[]:u,a=new Uint8Array(e.width*e.height),h={},l=new Set;n[t].forEach(((e,i)=>{r?(void 0===h[e]&&(h[e]=s.length,s.push(e)),a[i]=h[e]):a[i]=c[e],t>0&&n[t-1][i]!==e&&l.add(e)}));const p={},d=s.filter((e=>!l.has(e)));if(d.length>0){const e=d[0],i=r?h[e]:c[e];if(t>0){for(let e=0;e<n[t].length;e++)n[t-1][e]===n[t][e]&&(a[e]=i);p.transparent=i,g.frameOpts.disposal=1}}if(p.delay=i.frames[t].delay/10,r){let e=1;for(;e<s.length;)e<<=1;s.length=e,p.palette=new Uint32Array(s)}t>0&&f.addFrame(0,0,e.width,e.height,g.pixelPaletteIndex,g.frameOpts),g={pixelPaletteIndex:a,frameOpts:p}}g.frameOpts.disposal=1,f.addFrame(0,0,e.width,e.height,g.pixelPaletteIndex,g.frameOpts);const m="gif";jr(new Blob([s.slice(0,f.end())],{type:"image/gif"}),t,m)}(this,e);else{let i,r=this.canvas;switch(t=t||$r(e,t)[1]||"png"){default:i="image/png";break;case"webp":i="image/webp";break;case"jpeg":case"jpg":i="image/jpeg"}r.toBlob((i=>{jr(i,e,t)}),i)}}async toBlob(){return new Promise((e=>{this.canvas.toBlob(e)}))}reset(){if(this.gifProperties){const e=this.gifProperties;e.playing=!0,e.timeSinceStart=0,e.timeDisplayed=0,e.lastChangeTime=0,e.loopCount=0,e.displayIndex=0,this.drawingContext.putImageData(e.frames[0].image,0,0)}}getCurrentFrame(){if(this.gifProperties){const e=this.gifProperties;return e.displayIndex%e.numFrames}}setFrame(e){if(this.gifProperties){const t=this.gifProperties;e<t.numFrames&&e>=0?(t.timeDisplayed=0,t.lastChangeTime=0,t.displayIndex=e,this.drawingContext.putImageData(t.frames[e].image,0,0)):console.log("Cannot set GIF to a frame number that is higher than total number of frames or below zero.")}}numFrames(){if(this.gifProperties)return this.gifProperties.numFrames}play(){this.gifProperties&&(this.gifProperties.playing=!0)}pause(){this.gifProperties&&(this.gifProperties.playing=!1)}delay(e,t){if(this.gifProperties){const i=this.gifProperties;if(t<i.numFrames&&t>=0)i.frames[t].delay=e;else for(const t of i.frames)t.delay=e}}}function qr(e,t){e.Image=Wr}function Hr(e){let t=0;for(let i=1;i<e.length;i++)t+=e[i-1].position.dist(e[i].position);return t}void 0!==p5&&qr(p5);class Xr{constructor(e){for(const[t,i]of Object.entries(e))this[t]=i}}class Yr{vertices;_shape=null;_primitivesIndex=null;_contoursIndex=null;isClosing=!1;constructor(...e){if(this.constructor===Yr)throw new Error("ShapePrimitive is an abstract class: it cannot be instantiated.");if(!(e.length>0))throw new Error("At least one vertex must be passed to the constructor.");this.vertices=e}get vertexCount(){return this.vertices.length}get vertexCapacity(){throw new Error("Getter vertexCapacity must be implemented.")}get _firstInterpolatedVertex(){return this.startVertex()}get canOverrideAnchor(){return!1}accept(e){throw new Error("Method accept() must be implemented.")}addToShape(e){let t=e.at(-1);if(0===t.primitives.length)t.primitives.push(this);else{let i,r,s=e.at(-1,-1),n=s instanceof this.constructor,a=s.vertexCapacity-s.vertexCount;n&&a>0?(i=this.vertices.splice(0,a),r=this.vertices,s.vertices.push(...i),r.length>0&&t.primitives.push(this)):t.primitives.push(this)}if(this.vertices.length>0){let t=e.at(-1);this._primitivesIndex=t.primitives.length-1,this._contoursIndex=e.contours.length-1,this._shape=e}return e.at(-1,-1)}get _nextPrimitive(){return this._belongsToShape?this._shape.at(this._contoursIndex,this._primitivesIndex+1):null}get _belongsToShape(){return null!==this._shape}handlesClose(){return!1}close(e){throw new Error("Unimplemented!")}}class Zr{#r;primitives;constructor(e=8){this.#r=e,this.primitives=[]}get kind(){const e=0===this.primitives.length,t=8===this.#r;return e&&t?7:this.#r}accept(e){for(const t of this.primitives)t.accept(e)}}class Kr extends Yr{#s=1;get vertexCapacity(){return this.#s}accept(e){e.visitAnchor(this)}getEndVertex(){return this.vertices[0]}}class Jr extends Yr{constructor(...e){if(super(...e),this.constructor===Jr)throw new Error("Segment is an abstract class: it cannot be instantiated.")}get _previousPrimitive(){return this._belongsToShape?this._shape.at(this._contoursIndex,this._primitivesIndex-1):null}getStartVertex(){return this._previousPrimitive.getEndVertex()}getEndVertex(){return this.vertices.at(-1)}}class Qr extends Jr{#s=1;get vertexCapacity(){return this.#s}accept(e){e.visitLineSegment(this)}}class es extends Jr{#n;#s;constructor(e,...t){super(...t);let i=Array.isArray(e)?e[0]:e;this.#n=i,this.#s=i}get order(){return this.#n}get vertexCapacity(){return this.#s}#a;hullLength(){return void 0===this.#a&&(this.#a=Hr([this.getStartVertex(),...this.vertices])),this.#a}accept(e){e.visitBezierSegment(this)}}class ts extends Jr{#s=1/0;_splineProperties={ends:Pe,tightness:0};get vertexCapacity(){return this.#s}accept(e){e.visitSplineSegment(this)}get _comesAfterSegment(){return this._previousPrimitive instanceof Jr}get canOverrideAnchor(){return this._splineProperties.ends===Oe}get _firstInterpolatedVertex(){return this._splineProperties.ends===Oe?this._comesAfterSegment?this.vertices[1]:this.vertices[0]:this.getStartVertex()}get _chainedToSegment(){if(this._belongsToShape&&this._comesAfterSegment){let e=this._firstInterpolatedVertex.position;return this.getStartVertex().position.equals(e)}return!1}addToShape(e){const t=super.addToShape(e);if(this._splineProperties.ends=e._splineProperties.ends,this._splineProperties.tightness=e._splineProperties.tightness,this._splineProperties.ends!==Oe)return t;let i=!this._belongsToShape,r=e.at(-1,-1);if(i&&2===r.vertices.length&&r._comesAfterSegment&&!r._chainedToSegment){let e=r._firstInterpolatedVertex.position,t=r.getStartVertex().position;console.warn((s=e.array(),n=t.array(),`Spline does not start where previous path segment ends:\n second spline vertex at (${s})\n expected to be at (${n}).`))}var s,n;return t}getEndVertex(){return this._splineProperties.ends===Pe?super.getEndVertex():this._splineProperties.ends===Oe?this.vertices.at(-2):this.getStartVertex()}getControlPoints(){let e=[];this._comesAfterSegment&&e.push(this.getStartVertex()),e.push(this.getStartVertex());for(const t of this.vertices)e.push(t);const t=this.getStartVertex();return this._splineProperties.ends===Pe?(e.unshift(t),e.push(this.vertices.at(-1))):this._splineProperties.ends===Ne&&(e.unshift(this.vertices.at(-1)),e.push(t,this.vertices.at(0))),e}handlesClose(){if(!this._belongsToShape)return!1;return 2===this._shape.at(this._contoursIndex).primitives.length&&1===this._primitivesIndex}close(){this._splineProperties.ends=Ne}}class is extends Yr{#s=1;get vertexCapacity(){return this.#s}accept(e){e.visitPoint(this)}}class rs extends Yr{#s=2;get vertexCapacity(){return this.#s}accept(e){e.visitLine(this)}}class ss extends Yr{#s=3;get vertexCapacity(){return this.#s}accept(e){e.visitTriangle(this)}}class ns extends Yr{#s=4;get vertexCapacity(){return this.#s}accept(e){e.visitQuad(this)}}class as extends Yr{#s=1/0;get vertexCapacity(){return this.#s}accept(e){e.visitTriangleFan(this)}}class os extends Yr{#s=1/0;get vertexCapacity(){return this.#s}accept(e){e.visitTriangleStrip(this)}}class hs extends Yr{#s=1/0;get vertexCapacity(){return this.#s}accept(e){e.visitQuadStrip(this)}}class us{creators;constructor(){let e=new Map;e.set("vertex-7",((...e)=>new Kr(...e))),e.set("vertex-8",((...e)=>new Qr(...e))),e.set(`vertex-${T}`,((...e)=>new is(...e))),e.set(`vertex-${M}`,((...e)=>new rs(...e))),e.set("vertex-4",((...e)=>new ss(...e))),e.set(`vertex-${k}`,((...e)=>new ns(...e))),e.set("vertex-6",((...e)=>new as(...e))),e.set("vertex-5",((...e)=>new os(...e))),e.set(`vertex-${I}`,((...e)=>new hs(...e))),e.set("bezierVertex-7",((e,...t)=>new Kr(...t))),e.set("bezierVertex-8",((e,...t)=>new es(e,...t))),e.set("splineVertex-7",((...e)=>new Kr(...e))),e.set("splineVertex-8",((...e)=>new ts(...e))),this.creators=e}get(e,t){const i=`${e}-${t}`;return this.creators.get(i)}set(e,t,i){const r=`${e}-${t}`;this.creators.set(r,i)}clear(){this.creators.clear()}}class ls{#o;#h;#u;#l=3;kind=null;contours=[];_splineProperties={tightness:0,ends:Pe};userVertexProperties=null;constructor(e,t=new us){this.#h=e,this.#o=e,this.#u=t;for(const e in this.#o)"position"!==e&&"textureCoordinates"!==e&&(this[e]=function(t){this.#o[e]=t})}serializeToArray(e){if(null==e)return[];if(e instanceof Number)return[e];if(e instanceof Array)return e;if(e.array instanceof Function)return e.array();throw new Error(`Can't convert ${e} to array!`)}vertexToArray(e){const t=[];for(const i in this.#o){if(this.userVertexProperties&&i in this.userVertexProperties)continue;const r=e[i];t.push(...this.serializeToArray(r))}for(const i in this.userVertexProperties)i in e?t.push(...this.serializeToArray(e[i])):t.push(...new Array(this.userVertexProperties[i]).fill(0));return t}hydrateValue(e,t){if(null===t)return null;if(t instanceof Number)return e.shift();if(t instanceof Array){const i=[];for(let r=0;r<t.length;r++)i.push(e.shift());return i}if(t instanceof je)return new je(e.shift(),e.shift(),e.shift());if(t instanceof pr){const t=[e.shift(),e.shift(),e.shift(),e.shift()];return new pr(t)}}arrayToVertex(e){const t={},i=[...e];for(const e in this.#o){if(this.userVertexProperties&&e in this.userVertexProperties)continue;const r=this.#o[e];t[e]=this.hydrateValue(i,r)}for(const e in this.userVertexProperties){const r=this.#o[e];t[e]=this.hydrateValue(i,r)}return t}arrayScale(e,t){return e.map((e=>e*t))}arraySum(e,...t){return e.map(((e,i)=>{let r=e;for(let e=0;e<t.length;e++)r+=t[e][i];return r}))}arrayMinus(e,t){return e.map(((e,i)=>e-t[i]))}evaluateCubicBezier([e,t,i,r],s){return this.arraySum(this.arrayScale(e,Math.pow(1-s,3)),this.arrayScale(t,3*Math.pow(1-s,2)*s),this.arrayScale(i,3*(1-s)*Math.pow(s,2)),this.arrayScale(r,Math.pow(s,3)))}evaluateQuadraticBezier([e,t,i],r){return this.arraySum(this.arrayScale(e,Math.pow(1-r,2)),this.arrayScale(t,2*(1-r)*r),this.arrayScale(i,r*r))}catmullRomToBezier(e,t){let i=1-t,r=[];for(let t=0;t+3<e.length;t++){const[s,n,a,o]=e.slice(t,t+4),h=this.arraySum(n,this.arrayScale(this.arrayMinus(a,s),i/6)),u=this.arraySum(a,this.arrayScale(this.arrayMinus(n,o),i/6)),l=a;r.push([h,u,l])}return r}at(e,t,i){let r,s;switch(r=this.contours.at(e),arguments.length){case 1:return r;case 2:return r.primitives.at(t);case 3:return s=r.primitives.at(t),s.vertices.at(i)}}reset(){this.#o={...this.#h},this.kind=null,this.contours=[],this.userVertexProperties=null}vertexProperty(e,t){this.userVertexProperties=this.userVertexProperties||{};const i=this.vertexPropertyKey(e),r=Array.isArray(t)?t:[t];this.userVertexProperties[i]||(this.userVertexProperties[i]=r.length),this.#o[i]=r}vertexPropertyName(e){return e.replace(/Src$/,"")}vertexPropertyKey(e){return e+"Src"}bezierOrder(...e){this.#l=e}splineProperty(e,t){this._splineProperties[e]=t}splineProperties(e){if(!e)return this._splineProperties;for(const t in e)this.splineProperty(t,e[t])}#c(e,t){return this.#o.position=e,void 0!==t&&(this.#o.textureCoordinates=t),new Xr(this.#o)}#p(e,t,...i){let r=this.#u.get(e,t);return"bezierVertex"===e?r(this.#l,...i):r(...i)}#d(e,t,i){let r=e,s=this.at(-1).kind,n=this.#c(t,i);return this.#p(r,s,n).addToShape(this)}vertex(e,t,{isClosing:i=!1}={}){this.#d("vertex",e,t).isClosing=i}bezierVertex(e,t){this.#d("bezierVertex",e,t)}splineVertex(e,t){this.#d("splineVertex",e,t)}arcVertex(e,t){this.#d("arcVertex",e,t)}beginContour(e=8){7===this.at(-1)?.kind&&this.contours.pop(),this.contours.push(new Zr(e))}endContour(e=L,t=this.contours.length-1){const i=this.at(t);if(e===B){const e=8===i.kind,r=this.at(t,0,0),s=Object.hasOwn(r,"position"),n=this.at(t,-1);if(e&&s)if(n.handlesClose())n.close(r);else{const e=this.contours.splice(t+1,this.contours.length-t-1),i=this.#o;this.#o={...i};for(const e in r)["position","textureCoordinates"].includes(e)||(this.#o[e]=r[e]);this.vertex(r.position,r.textureCoordinates,{isClosing:!0}),this.#o=i,this.contours.push(...e)}}}beginShape(e=8){this.kind=e,this.beginContour(e)}endShape(e=L){e===B&&this.endContour(e,0)}accept(e){for(const t of this.contours)t.accept(e)}}class cs{constructor(){if(this.constructor===cs)throw new Error("PrimitiveVisitor is an abstract class: it cannot be instantiated.")}visitAnchor(e){throw new Error("Method visitAnchor() has not been implemented.")}visitLineSegment(e){throw new Error("Method visitLineSegment() has not been implemented.")}visitBezierSegment(e){throw new Error("Method visitBezierSegment() has not been implemented.")}visitSplineSegment(e){throw new Error("Method visitSplineSegment() has not been implemented.")}visitArcSegment(e){throw new Error("Method visitArcSegment() has not been implemented.")}visitPoint(e){throw new Error("Method visitPoint() has not been implemented.")}visitLine(e){throw new Error("Method visitLine() has not been implemented.")}visitTriangle(e){throw new Error("Method visitTriangle() has not been implemented.")}visitQuad(e){throw new Error("Method visitQuad() has not been implemented.")}visitTriangleFan(e){throw new Error("Method visitTriangleFan() has not been implemented.")}visitTriangleStrip(e){throw new Error("Method visitTriangleStrip() has not been implemented.")}visitQuadStrip(e){throw new Error("Method visitQuadStrip() has not been implemented.")}}class ps extends cs{path=new Path2D;strokeWeight;constructor({strokeWeight:e}){super(),this.strokeWeight=e}visitAnchor(e){let t=e.getEndVertex();this.path.moveTo(t.position.x,t.position.y)}visitLineSegment(e){if(e.isClosing)this.path.closePath();else{let t=e.getEndVertex();this.path.lineTo(t.position.x,t.position.y)}}visitBezierSegment(e){let[t,i,r]=e.vertices;switch(e.order){case 2:this.path.quadraticCurveTo(t.position.x,t.position.y,i.position.x,i.position.y);break;case 3:this.path.bezierCurveTo(t.position.x,t.position.y,i.position.x,i.position.y,r.position.x,r.position.y)}}visitSplineSegment(e){const t=e._shape;if(e._splineProperties.ends===Oe&&!e._comesAfterSegment){let t=e._firstInterpolatedVertex;this.path.moveTo(t.position.x,t.position.y)}const i=e.getControlPoints().map((e=>t.vertexToArray(e)));let r=t.catmullRomToBezier(i,e._splineProperties.tightness).map((e=>e.map((e=>t.arrayToVertex(e)))));for(const e of r){const t=e.flatMap((e=>[e.position.x,e.position.y]));this.path.bezierCurveTo(...t)}}visitPoint(e){const{x:t,y:i}=e.vertices[0].position;this.path.moveTo(t,i),this.path.lineTo(t+1e-5,i)}visitLine(e){const{x:t,y:i}=e.vertices[0].position,{x:r,y:s}=e.vertices[1].position;this.path.moveTo(t,i),this.path.lineTo(r,s)}visitTriangle(e){const[t,i,r]=e.vertices;this.path.moveTo(t.position.x,t.position.y),this.path.lineTo(i.position.x,i.position.y),this.path.lineTo(r.position.x,r.position.y),this.path.closePath()}visitQuad(e){const[t,i,r,s]=e.vertices;this.path.moveTo(t.position.x,t.position.y),this.path.lineTo(i.position.x,i.position.y),this.path.lineTo(r.position.x,r.position.y),this.path.lineTo(s.position.x,s.position.y),this.path.closePath()}visitTriangleFan(e){const[t,...i]=e.vertices;for(let e=0;e<i.length-1;e++){const r=i[e],s=i[e+1];this.path.moveTo(t.position.x,t.position.y),this.path.lineTo(r.position.x,r.position.y),this.path.lineTo(s.position.x,s.position.y),this.path.closePath()}}visitTriangleStrip(e){for(let t=0;t<e.vertices.length-2;t++){const i=e.vertices[t],r=e.vertices[t+1],s=e.vertices[t+2];this.path.moveTo(i.position.x,i.position.y),this.path.lineTo(r.position.x,r.position.y),this.path.lineTo(s.position.x,s.position.y),this.path.closePath()}}visitQuadStrip(e){for(let t=0;t<e.vertices.length-3;t+=2){const i=e.vertices[t],r=e.vertices[t+1],s=e.vertices[t+2],n=e.vertices[t+3];this.path.moveTo(i.position.x,i.position.y),this.path.lineTo(r.position.x,r.position.y),this.path.lineTo(n.position.x,n.position.y),this.path.lineTo(s.position.x,s.position.y),this.path.closePath()}}}class ds extends cs{contours=[];curveDetail;constructor({curveDetail:e=1}={}){super(),this.curveDetail=e}lastContour(){return this.contours[this.contours.length-1]}visitAnchor(e){this.contours.push([]);const t=e._nextPrimitive;t?.canOverrideAnchor?this.lastContour().push(t._firstInterpolatedVertex):this.lastContour().push(e.getEndVertex())}visitLineSegment(e){this.lastContour().push(e.getEndVertex())}visitBezierSegment(e){const t=this.lastContour(),i=Math.max(1,Math.ceil(e.hullLength()*this.curveDetail)),r=[e.getStartVertex(),...e.vertices].map((t=>e._shape.vertexToArray(t)));for(let s=0;s<i;s++){const n=(s+1)/i;t.push(e._shape.arrayToVertex(3===e.order?e._shape.evaluateCubicBezier(r,n):e._shape.evaluateQuadraticBezier(r,n)))}}visitSplineSegment(e){const t=e._shape,i=this.lastContour(),r=e.getControlPoints().map((e=>t.vertexToArray(e)));let s=t.catmullRomToBezier(r,e._splineProperties.tightness),n=t.vertexToArray(e._firstInterpolatedVertex);for(const e of s){const r=[n,...e],s=Math.max(1,Math.ceil(Hr(r.map((e=>t.arrayToVertex(e))))*this.curveDetail));for(let e=0;e<s;e++){const n=(e+1)/s;i.push(t.arrayToVertex(t.evaluateCubicBezier(r,n)))}n=e[2]}}visitPoint(e){this.contours.push(e.vertices.slice())}visitLine(e){this.contours.push(e.vertices.slice())}visitTriangle(e){this.contours.push(e.vertices.slice())}visitQuad(e){this.contours.push(e.vertices.slice())}visitTriangleFan(e){this.contours.push(e.vertices.slice())}visitTriangleStrip(e){this.contours.push(e.vertices.slice())}visitQuadStrip(e){this.contours.push(e.vertices.slice())}}class fs extends cs{constructor(){super()}}function gs(e,t){e.Shape=ls,e.Contour=Zr,e.ShapePrimitive=Yr,e.Vertex=Xr,e.Anchor=Kr,e.Segment=Jr,e.LineSegment=Qr,e.BezierSegment=es,e.SplineSegment=ts,e.Point=is,e.Line=rs,e.Triangle=ss,e.Quad=ns,e.TriangleFan=as,e.TriangleStrip=os,e.QuadStrip=hs,e.PrimitiveVisitor=cs,e.PrimitiveToPath2DConverter=ps,e.PrimitiveToVerticesConverter=ds,e.PointAtLengthGetter=fs,t.bezierOrder=function(e){return this._renderer.bezierOrder(e)},t.splineVertex=function(...e){let t=0,i=0,r=0,s=0,n=0;2===e.length?[t,i]=e:4===e.length?[t,i,s,n]=e:3===e.length?[t,i,r]=e:5===e.length&&([t,i,r,s,n]=e),this._renderer.splineVertex(t,i,r,s,n)},t.splineProperty=function(e,t){return this._renderer.splineProperty(e,t)},t.splineProperties=function(e){return this._renderer.splineProperties(e)},t.vertex=function(e,t){let i,r,s;i=r=s=0,3===arguments.length?i=arguments[2]:4===arguments.length?(r=arguments[2],s=arguments[3]):5===arguments.length&&(i=arguments[2],r=arguments[3],s=arguments[4]),this._renderer.vertex(e,t,i,r,s)},t.beginContour=function(e){this._renderer.beginContour(e)},t.endContour=function(e=L){this._renderer.endContour(e)}}void 0!==p5&&gs(p5,p5.prototype);class ms{#f={};constructor(e){for(const t in e)this[t]=e[t]}setValue(e,t){e in this.#f||(this.#f[e]=this[e]),this[e]=t}getDiff(){const e=this.#f;return this.#f={},e}getModified(){return this.#f}applyDiff(e){for(const e in this.#f)this[e]=this.#f[e];this.#f=e}}class ys{constructor(e={}){for(const t in e)this[t]=e[t]}clone(){return new ys(this)}}class xs{static states={strokeColor:null,strokeSet:!1,fillColor:null,fillSet:!1,tint:null,imageMode:_,rectMode:_,ellipseMode:A,strokeWeight:1,textFont:{family:"sans-serif"},textLeading:15,leadingSet:!1,textSize:12,textAlign:E,textBaseline:F,bezierOrder:3,splineProperties:new ys({ends:Pe,tightness:0}),textWrap:fe,fontStyle:de,fontStretch:de,fontWeight:de,lineHeight:de,fontVariant:de,direction:"inherit"};constructor(e,t,i,r){this._pInst=e,this._isMainCanvas=r,this.pixels=[],this._pixelDensity=Math.ceil(window.devicePixelRatio)||1,this.width=t,this.height=i,this._events={},r&&(this._isMainCanvas=!0),this.states=new ms(xs.states),this.states.strokeColor=new pr([0,0,0]),this.states.fillColor=new pr([1,1,1]),this._pushPopStack=[],this._pushPopDepth=0,this._clipping=!1,this._clipInvert=!1,this._currentShape=void 0}get currentShape(){return this._currentShape||(this._currentShape=new ls(this.getCommonVertexProperties())),this._currentShape}remove(){}pixelDensity(e){let t;return"number"==typeof e?(e!==this._pixelDensity&&(this._pixelDensity=e),t=this,this.resize(this.width,this.height)):t=this._pixelDensity,t}push(){this._pushPopDepth++,this._pushPopStack.push(this.states.getDiff())}pop(){this._pushPopDepth--;const e=this._pushPopStack.pop()||{},t=this.states.getModified();this.states.applyDiff(e),this.updateShapeVertexProperties(t),this.updateShapeProperties(t)}bezierOrder(e){if(void 0===e)return this.states.bezierOrder;this.states.setValue("bezierOrder",e),this.updateShapeProperties()}bezierVertex(e,t,i=0,r=0,s=0){const n=new je(e,t,i),a=this.getSupportedIndividualVertexProperties().textureCoordinates?new je(r,s):void 0;this.currentShape.bezierVertex(n,a)}splineProperty(e,t){if(void 0===t)return this.states.splineProperties[e];this.states.setValue("splineProperties",this.states.splineProperties.clone()),this.states.splineProperties[e]=t,this.updateShapeProperties()}splineProperties(e){if(!e)return{...this.states.splineProperties};for(const t in e)this.splineProperty(t,e[t])}splineVertex(e,t,i=0,r=0,s=0){const n=new je(e,t,i),a=this.getSupportedIndividualVertexProperties().textureCoordinates?new je(r,s):void 0;this.currentShape.splineVertex(n,a)}curveDetail(e){if(void 0===e)return this.states.curveDetail;this.states.setValue("curveDetail",e)}beginShape(...e){this.currentShape.reset(),this.updateShapeVertexProperties(),this.currentShape.beginShape(...e)}endShape(...e){this.currentShape.endShape(...e),this.drawShape(this.currentShape)}beginContour(e){this.currentShape.beginContour(e)}endContour(e){this.currentShape.endContour(e)}drawShape(e,t){throw new Error("Unimplemented")}vertex(e,t,i=0,r=0,s=0){const n=new je(e,t,i),a=this.getSupportedIndividualVertexProperties().textureCoordinates?new je(r,s):void 0;this.currentShape.vertex(n,a)}bezier(e,t,i,r,s,n,a,o){const h=this._pInst.bezierOrder();return this._pInst.bezierOrder(h),this._pInst.beginShape(),this._pInst.bezierVertex(e,t),this._pInst.bezierVertex(i,r),this._pInst.bezierVertex(s,n),this._pInst.bezierVertex(a,o),this._pInst.endShape(),this}spline(...e){if(8===e.length){const[t,i,r,s,n,a,o,h]=e;this._pInst.beginShape(),this._pInst.splineVertex(t,i),this._pInst.splineVertex(r,s),this._pInst.splineVertex(n,a),this._pInst.splineVertex(o,h),this._pInst.endShape()}else if(12===e.length){const[t,i,r,s,n,a,o,h,u,l,c,p]=e;this._pInst.beginShape(),this._pInst.splineVertex(t,i,r),this._pInst.splineVertex(s,n,a),this._pInst.splineVertex(o,h,u),this._pInst.splineVertex(l,c,p),this._pInst.endShape()}return this}beginClip(e={}){if(this._clipping)throw new Error("It looks like you're trying to clip while already in the middle of clipping. Did you forget to endClip()?");this._clipping=!0,this._clipInvert=e.invert}endClip(){if(!this._clipping)throw new Error("It looks like you've called endClip() without beginClip(). Did you forget to call beginClip() first?");this._clipping=!1}resize(e,t){this.width=e,this.height=t}get(e,t,i,r){const s=this._pixelDensity,n=this.canvas;if(void 0===e&&void 0===t)e=t=0,i=this.width,r=this.height;else if(e*=s,t*=s,void 0===i&&void 0===r)return e<0||t<0||e>=n.width||t>=n.height?[0,0,0,0]:this._getPixel(e,t);const a=new Wr(i*s,r*s);return a.pixelDensity(s),a.canvas.getContext("2d").drawImage(n,e,t,i*s,r*s,0,0,i*s,r*s),a}scale(e,t){}fill(...e){this.states.setValue("fillSet",!0),this.states.setValue("fillColor",this._pInst.color(...e)),this.updateShapeVertexProperties()}noFill(){this.states.setValue("fillColor",null)}strokeWeight(e){if(void 0===e)return this.states.strokeWeight;this.states.setValue("strokeWeight",e)}stroke(...e){this.states.setValue("strokeSet",!0),this.states.setValue("strokeColor",this._pInst.color(...e)),this.updateShapeVertexProperties()}noStroke(){this.states.setValue("strokeColor",null)}getCommonVertexProperties(){return{}}getSupportedIndividualVertexProperties(){return{textureCoordinates:!1}}updateShapeProperties(e){if(!e||e.bezierOrder||e.splineProperties){const e=this.currentShape;e.bezierOrder(this.states.bezierOrder),e.splineProperty("ends",this.states.splineProperties.ends),e.splineProperty("tightness",this.states.splineProperties.tightness)}}updateShapeVertexProperties(e){const t=this.getCommonVertexProperties();if(!e||Object.keys(e).some((e=>e in t))){const e=this.currentShape;for(const i in t)e[i](t[i])}}_applyDefaults(){return this}}class vs extends Mr{constructor(e,t){super(e,t);const i=this;this.elt.crossOrigin="anonymous",this._prevTime=0,this._cueIDCounter=0,this._cues=[],this.pixels=[],this._pixelsState=this,this._pixelDensity=1,this._modified=!1,this._frameOnCanvas=-1,Object.defineProperty(i,"src",{get(){const e=i.elt.children[0].src,t=i.elt.src===window.location.href?"":i.elt.src;return e===window.location.href?t:e},set(t){for(let e=0;e<i.elt.children.length;e++)i.elt.removeChild(i.elt.children[e]);const r=document.createElement("source");r.src=t,e.appendChild(r),i.elt.src=t,i.modified=!0}}),i._onended=function(){},i.elt.onended=function(){i._onended(i)}}play(){let e;return this.elt.currentTime===this.elt.duration&&(this.elt.currentTime=0),this.elt.readyState>1||this.elt.load(),e=this.elt.play(),e&&e.catch&&e.catch((e=>{"NotAllowedError"===e.name?console.error(e):console.error("Media play method encountered an unexpected error",e)})),this}stop(){return this.elt.pause(),this.elt.currentTime=0,this}pause(){return this.elt.pause(),this}loop(){return this.elt.setAttribute("loop",!0),this.play(),this}noLoop(){return this.elt.removeAttribute("loop"),this}_setupAutoplayFailDetection(){const t=setTimeout((()=>{console.error(e)}),500);this.elt.addEventListener("play",(()=>clearTimeout(t)),{passive:!0,once:!0})}autoplay(e){const t=this.elt.getAttribute("autoplay");if(this.elt.setAttribute("autoplay",e),e&&!t){const e=()=>this._setupAutoplayFailDetection();4===this.elt.readyState?e():this.elt.addEventListener("canplay",e,{passive:!0,once:!0})}return this}volume(e){if(void 0===e)return this.elt.volume;this.elt.volume=e}speed(e){if(void 0===e)return this.presetPlaybackRate||this.elt.playbackRate;this.loadedmetadata?this.elt.playbackRate=e:this.presetPlaybackRate=e}time(e){return void 0===e?this.elt.currentTime:(this.elt.currentTime=e,this)}duration(){return this.elt.duration}_ensureCanvas(){this.canvas||(this.canvas=document.createElement("canvas"),this.drawingContext=this.canvas.getContext("2d"),this.setModified(!0));const e=this._frameOnCanvas!==this._pInst.frameCount;this.loadedmetadata&&e&&(this.canvas.width!==this.elt.width&&(this.canvas.width=this.elt.width,this.canvas.height=this.elt.height,this.width=this.canvas.width,this.height=this.canvas.height),this.drawingContext.clearRect(0,0,this.canvas.width,this.canvas.height),!0===this.flipped&&(this.drawingContext.save(),this.drawingContext.scale(-1,1),this.drawingContext.translate(-this.canvas.width,0)),this.drawingContext.drawImage(this.elt,0,0,this.canvas.width,this.canvas.height),!0===this.flipped&&this.drawingContext.restore(),this.setModified(!0),this._frameOnCanvas=this._pInst.frameCount)}loadPixels(...e){return this._ensureCanvas(),p5.Renderer2D.prototype.loadPixels.apply(this,e)}updatePixels(e,t,i,r){return this.loadedmetadata&&(this._ensureCanvas(),p5.Renderer2D.prototype.updatePixels.call(this,e,t,i,r)),this.setModified(!0),this}get(...e){return this._ensureCanvas(),p5.Renderer2D.prototype.get.apply(this,e)}_getPixel(...e){return this.loadPixels(),p5.Renderer2D.prototype._getPixel.apply(this,e)}set(e,t,i){this.loadedmetadata&&(this._ensureCanvas(),p5.Renderer2D.prototype.set.call(this,e,t,i),this.setModified(!0))}copy(...e){this._ensureCanvas(),fn.copy.apply(this,e)}mask(...e){this.loadPixels(),this.setModified(!0),p5.Image.prototype.mask.apply(this,e)}isModified(){return this._modified}setModified(e){this._modified=e}onended(e){return this._onended=e,this}connect(e){let t,i;if("function"==typeof fn.getAudioContext)t=fn.getAudioContext(),i=p5.soundOut.input;else try{t=e.context,i=t.destination}catch(e){throw"connect() is meant to be used with Web Audio API or p5.sound.js"}this.audioSourceNode||(this.audioSourceNode=t.createMediaElementSource(this.elt),this.audioSourceNode.connect(i)),e?e.input?this.audioSourceNode.connect(e.input):this.audioSourceNode.connect(e):this.audioSourceNode.connect(i)}disconnect(){if(!this.audioSourceNode)throw"nothing to disconnect";this.audioSourceNode.disconnect()}showControls(){this.elt.style["text-align"]="inherit",this.elt.controls=!0}hideControls(){this.elt.controls=!1}addCue(e,t,i){const r=this._cueIDCounter++,s=new bs(t,e,r,i);return this._cues.push(s),this.elt.ontimeupdate||(this.elt.ontimeupdate=this._onTimeUpdate.bind(this)),r}removeCue(e){for(let t=0;t<this._cues.length;t++)this._cues[t].id===e&&(console.log(e),this._cues.splice(t,1));0===this._cues.length&&(this.elt.ontimeupdate=null)}clearCues(){this._cues=[],this.elt.ontimeupdate=null}_onTimeUpdate(){const e=this.time();for(let t=0;t<this._cues.length;t++){const i=this._cues[t].time,r=this._cues[t].val;this._prevTime<i&&i<=e&&this._cues[t].callback(r)}this._prevTime=e}}class bs{constructor(e,t,i,r){this.callback=e,this.time=t,this.id=i,this.val=r}}function _s(e,t){function i(e,t,i){(t._userNode?t._userNode:document.body).appendChild(e);const r=i?new vs(e,t):new Mr(e,t);return t._elements.push(r),r}function r(e,t,r,s){const n=document.createElement(t);"string"==typeof(r=r||"")&&(r=[r]);for(const e of r){const t=document.createElement("source");t.setAttribute("src",e),n.appendChild(t)}if("function"==typeof s){const e=()=>{s(),n.removeEventListener("canplaythrough",e)};n.addEventListener("canplaythrough",e)}const a=i(n,e,!0);return a.loadedmetadata=!1,n.addEventListener("loadedmetadata",(()=>{a.width=n.videoWidth,a.height=n.videoHeight,0===a.elt.width&&(a.elt.width=n.videoWidth),0===a.elt.height&&(a.elt.height=n.videoHeight),a.presetPlaybackRate&&(a.elt.playbackRate=a.presetPlaybackRate,delete a.presetPlaybackRate),a.loadedmetadata=!0})),a}t.createVideo=function(e,t){return r(this,"video",e,t)},t.createAudio=function(e,t){return r(this,"audio",e,t)},t.VIDEO="video",t.AUDIO="audio",void 0===navigator.mediaDevices&&(navigator.mediaDevices={}),void 0===navigator.mediaDevices.getUserMedia&&(navigator.mediaDevices.getUserMedia=function(e){const t=navigator.webkitGetUserMedia||navigator.mozGetUserMedia;return t?new Promise((function(i,r){t.call(navigator,e,i,r)})):Promise.reject(new Error("getUserMedia is not implemented in this browser"))}),t.createCapture=function(...r){if(!navigator.mediaDevices||!navigator.mediaDevices.getUserMedia)throw new DOMException("getUserMedia not supported in this browser");let s,n,a=!0,o=!0,h=!1;for(const e of r)e===t.VIDEO?o=!1:e===t.AUDIO?a=!1:"object"==typeof e?(void 0!==e.flipped&&(h=e.flipped,delete e.flipped),s=Object.assign({},s,e)):"function"==typeof e&&(n=e);const u={video:a,audio:o};s=Object.assign({},u,s);const l=document.createElement("video");l.setAttribute("playsinline",""),navigator.mediaDevices.getUserMedia(s).then((function(e){try{"srcObject"in l?l.srcObject=e:l.src=window.URL.createObjectURL(e)}catch(t){l.src=e}})).catch((t=>{"NotFoundError"===t.name&&e._friendlyError("No webcam found on this device","createCapture"),"NotAllowedError"===t.name&&e._friendlyError("Access to the camera was denied","createCapture"),console.error(t)}));const c=i(l,this,!0);return c.loadedmetadata=!1,l.addEventListener("loadedmetadata",(function(){l.play(),l.width?(c.width=l.width,c.height=l.height,h&&(c.elt.style.transform="scaleX(-1)")):(c.width=c.elt.width=l.videoWidth,c.height=c.elt.height=l.videoHeight),c.loadedmetadata=!0,n&&n(l.srcObject)})),c.flipped=h,c},e.MediaElement=vs}void 0!==p5&&_s(p5,p5.prototype);var ws,Cs,Ds={modeAdjust:function(e,t,i,r,s){let n;return s===_?n={x:e,y:t,w:Math.abs(i),h:Math.abs(r)}:s===w?n={x:Math.min(e,i),y:Math.min(t,r),w:Math.abs(i-e),h:Math.abs(r-t)}:s===C?n={x:e-(i=Math.abs(i)),y:t-(r=Math.abs(r)),w:2*i,h:2*r}:s===A&&(n={x:e-.5*(i=Math.abs(i)),y:t-.5*(r=Math.abs(r)),w:i,h:r}),n}};function Es(e,t){t._normalizeArcAngles=(e,t,i,r,s)=>{let n;return e-=x*Math.floor(e/x),t-=x*Math.floor(t/x),n=Math.min(Math.abs(e-t),x-Math.abs(e-t)),s&&(e=e<=f?Math.atan(i/r*Math.tan(e)):e>f&&e<=3*f?Math.atan(i/r*Math.tan(e))+g:Math.atan(i/r*Math.tan(e))+x,t=t<=f?Math.atan(i/r*Math.tan(t)):t>f&&t<=3*f?Math.atan(i/r*Math.tan(t))+g:Math.atan(i/r*Math.tan(t))+x),e>t&&(t+=x),{start:e,stop:t,correspondToSamePoint:n<1e-5}},t.arc=function(e,t,i,r,s,n,a,o){if(!this._renderer.states.strokeColor&&!this._renderer.states.fillColor)return this;if(s===n)return this;s=this._toRadians(s),n=this._toRadians(n);const h=Ds.modeAdjust(e,t,i,r,this._renderer.states.ellipseMode),u=this._normalizeArcAngles(s,n,h.w,h.h,!0);return u.correspondToSamePoint?this._renderer.ellipse([h.x,h.y,h.w,h.h,o]):(this._renderer.arc(h.x,h.y,h.w,h.h,u.start,u.stop,a,o),(this._accessibleOutputs.grid||this._accessibleOutputs.text)&&this._accsOutput("arc",[h.x,h.y,h.w,h.h,u.start,u.stop,a])),this},t.ellipse=function(e,t,i,r,s){return this._renderEllipse(...arguments)},t.circle=function(...e){const t=e.slice(0,2);return t.push(e[2],e[2]),this._renderEllipse(...t)},t._renderEllipse=function(e,t,i,r,s){if(!this._renderer.states.strokeColor&&!this._renderer.states.fillColor)return this;void 0===r&&(r=i);const n=Ds.modeAdjust(e,t,i,r,this._renderer.states.ellipseMode);return this._renderer.ellipse([n.x,n.y,n.w,n.h,s]),(this._accessibleOutputs.grid||this._accessibleOutputs.text)&&this._accsOutput("ellipse",[n.x,n.y,n.w,n.h]),this},t.line=function(...e){return this._renderer.states.strokeColor&&this._renderer.line(...e),(this._accessibleOutputs.grid||this._accessibleOutputs.text)&&this._accsOutput("line",e),this},t.point=function(...t){return this._renderer.states.strokeColor&&(1===t.length&&t[0]instanceof e.Vector?this._renderer.point.call(this._renderer,t[0].x,t[0].y,t[0].z):(this._renderer.point(...t),(this._accessibleOutputs.grid||this._accessibleOutputs.text)&&this._accsOutput("point",t))),this},t.quad=function(...e){return(this._renderer.states.strokeColor||this._renderer.states.fillColor)&&(this._renderer.isP3D&&e.length<12?this._renderer.quad.call(this._renderer,e[0],e[1],0,e[2],e[3],0,e[4],e[5],0,e[6],e[7],0,e[8],e[9]):(this._renderer.quad(...e),(this._accessibleOutputs.grid||this._accessibleOutputs.text)&&this._accsOutput("quadrilateral",e))),this},t.rect=function(...e){return this._renderRect(...e)},t.square=function(e,t,i,r,s,n,a){return this._renderRect.call(this,e,t,i,i,r,s,n,a)},t._renderRect=function(){if(this._renderer.states.strokeColor||this._renderer.states.fillColor){3===arguments.length&&(arguments[3]=arguments[2]);const e=Ds.modeAdjust(arguments[0],arguments[1],arguments[2],arguments[3],this._renderer.states.rectMode);this._renderer.states.rectMode===_&&(e.w=arguments[2],e.h=arguments[3]);const t=[e.x,e.y,e.w,e.h];for(let e=4;e<arguments.length;e++)t[e]=arguments[e];this._renderer.rect(t),(this._accessibleOutputs.grid||this._accessibleOutputs.text)&&this._accsOutput("rectangle",[e.x,e.y,e.w,e.h])}return this},t.triangle=function(...e){return(this._renderer.states.strokeColor||this._renderer.states.fillColor)&&this._renderer.triangle(e),(this._accessibleOutputs.grid||this._accessibleOutputs.text)&&this._accsOutput("triangle",e),this}}function As(e,t){t.ellipseMode=function(e){return e!==_&&e!==w&&e!==C&&e!==A||this._renderer.states.setValue("ellipseMode",e),this},t.noSmooth=function(){return this._renderer.isP3D?this.setAttributes("antialias",!1):"imageSmoothingEnabled"in this.drawingContext&&(this.drawingContext.imageSmoothingEnabled=!1),this},t.rectMode=function(e){return e!==_&&e!==w&&e!==C&&e!==A||this._renderer.states.setValue("rectMode",e),this},t.smooth=function(){return this._renderer.isP3D?this.setAttributes("antialias",!0):"imageSmoothingEnabled"in this.drawingContext&&(this.drawingContext.imageSmoothingEnabled=!0),this},t.strokeCap=function(e){return e!==V&&e!==R&&e!==N||this._renderer.strokeCap(e),this},t.strokeJoin=function(e){return e!==V&&e!==U&&e!==G||this._renderer.strokeJoin(e),this},t.strokeWeight=function(e){return this._renderer.strokeWeight(e),this}}function Ss(e,t){t.bezier=function(...e){return this._renderer.states.strokeColor||this._renderer.states.fillColor?(this._renderer.bezier(...e),this):this},t.bezierPoint=function(e,t,i,r,s){const n=1-s;return Math.pow(n,3)*e+3*Math.pow(n,2)*s*t+3*n*Math.pow(s,2)*i+Math.pow(s,3)*r},t.bezierTangent=function(e,t,i,r,s){const n=1-s;return 3*r*Math.pow(s,2)-3*i*Math.pow(s,2)+6*i*n*s-6*t*n*s+3*t*Math.pow(n,2)-3*e*Math.pow(n,2)},t.spline=function(...e){return this._renderer.states.strokeColor||this._renderer.states.fillColor?(this._renderer.spline(...e),this):this},t.splinePoint=function(e,t,i,r,s){const n=this._renderer.states.splineProperties.tightness,a=s*s*s,o=s*s;return e*((n-1)/2*a+(1-n)*o+(n-1)/2*s)+t*((n+3)/2*a+(-5-n)/2*o+1)+i*((-3-n)/2*a+(n+2)*o+(1-n)/2*s)+r*((1-n)/2*a+(n-1)/2*o)},t.splineTangent=function(e,t,i,r,s){const n=this._renderer.states.splineProperties.tightness,a=s*s*3,o=2*s;return e*((n-1)/2*a+(1-n)*o+(n-1)/2)+t*((n+3)/2*a+(-5-n)/2*o)+i*((-3-n)/2*a+(n+2)*o+(1-n)/2)+r*((1-n)/2*a+(n-1)/2*o)}}function Fs(e,t){t.beginShape=function(e){this._renderer.beginShape(...arguments)},t.bezierVertex=function(...e){this._renderer.bezierVertex(...e)},t.endShape=function(e,t=1){t<1&&(console.log("🌸 p5.js says: You can not have less than one instance"),t=1),this._renderer.endShape(e,t)},t.normal=function(e,t,i){return this._assert3d("normal"),this._renderer.normal(...arguments),this},t.vertexProperty=function(e,t){this._renderer.vertexProperty(e,t)}}function Ts(e,t){t.beginClip=function(e={}){this._renderer.beginClip(e)},t.endClip=function(){this._renderer.endClip()},t.clip=function(e,t){this._renderer.beginClip(t),e(),this._renderer.endClip(t)},t.background=function(...e){return this._renderer.background(...e),this},t.clear=function(...e){const t=e[0]||0,i=e[1]||0,r=e[2]||0,s=e[3]||0;return this._renderer.clear(t,i,r,s),this},t.colorMode=function(e,t,i,r,s){if([fr,gr,mr,yr,xr,vr,br,_r,wr].includes(e)){this._renderer.states.setValue("colorMode",e),this._renderer.states.setValue("colorMaxes",this._renderer.states.colorMaxes.clone());const n=this._renderer.states.colorMaxes[e];2===arguments.length?(n[0]=t,n[1]=t,n[2]=t,n[3]=t):4===arguments.length?(n[0]=t,n[1]=i,n[2]=r):5===arguments.length&&(n[0]=t,n[1]=i,n[2]=r,n[3]=s)}return this._renderer.states.colorMode},t.fill=function(...e){return this._renderer.fill(...e),this},t.noFill=function(){return this._renderer.noFill(),this},t.noStroke=function(){return this._renderer.states.setValue("strokeColor",null),this},t.stroke=function(...e){return this._renderer.stroke(...e),this},t.erase=function(e=255,t=255){return this._renderer.erase(e,t),this},t.noErase=function(){return this._renderer.noErase(),this},t.blendMode=function(e){e===de&&(console.warn("NORMAL has been deprecated for use in blendMode. defaulting to BLEND instead."),e=j),this._renderer.blendMode(e)}}function Ms(e,t,i,r){for(var s=e[t++],n=1<<s,a=n+1,o=a+1,h=s+1,u=(1<<h)-1,l=0,c=0,p=0,d=e[t++],f=new Int32Array(4096),g=null;;){for(;l<16&&0!==d;)c|=e[t++]<<l,l+=8,1===d?d=e[t++]:--d;if(l<h)break;var m=c&u;if(c>>=h,l-=h,m!==n){if(m===a)break;for(var y=m<o?m:g,x=0,v=y;v>n;)v=f[v]>>8,++x;var b=v;if(p+x+(y!==m?1:0)>r)return void console.log("Warning, gif stream longer than expected.");i[p++]=b;var _=p+=x;for(y!==m&&(i[p++]=b),v=y;x--;)v=f[v],i[--_]=255&v,v>>=8;null!==g&&o<4096&&(f[o++]=g<<8|b,o>=u+1&&h<12&&(++h,u=u<<1|1)),g=m}else o=a+1,u=(1<<(h=s+1))-1,g=null}return p!==r&&console.log("Warning, gif stream shorter than expected."),i}void 0!==p5&&Es(p5,p5.prototype),void 0!==p5&&As(0,p5.prototype),void 0!==p5&&Ss(0,p5.prototype),void 0!==p5&&Fs(0,p5.prototype),void 0!==p5&&Ts(0,p5.prototype);try{Cs=function(e,t,i,r){var s=0,n=void 0===(r=void 0===r?{}:r).loop?null:r.loop,a=void 0===r.palette?null:r.palette;if(t<=0||i<=0||t>65535||i>65535)throw new Error("Width/Height invalid.");function o(e){var t=e.length;if(t<2||t>256||t&t-1)throw new Error("Invalid code/color length, must be power of 2 and 2 .. 256.");return t}e[s++]=71,e[s++]=73,e[s++]=70,e[s++]=56,e[s++]=57,e[s++]=97;var h=0,u=0;if(null!==a){for(var l=o(a);l>>=1;)++h;if(l=1<<h,--h,void 0!==r.background){if((u=r.background)>=l)throw new Error("Background index out of range.");if(0===u)throw new Error("Background index explicitly passed as 0.")}}if(e[s++]=255&t,e[s++]=t>>8&255,e[s++]=255&i,e[s++]=i>>8&255,e[s++]=(null!==a?128:0)|h,e[s++]=u,e[s++]=0,null!==a)for(var c=0,p=a.length;c<p;++c){var d=a[c];e[s++]=d>>16&255,e[s++]=d>>8&255,e[s++]=255&d}if(null!==n){if(n<0||n>65535)throw new Error("Loop count invalid.");e[s++]=33,e[s++]=255,e[s++]=11,e[s++]=78,e[s++]=69,e[s++]=84,e[s++]=83,e[s++]=67,e[s++]=65,e[s++]=80,e[s++]=69,e[s++]=50,e[s++]=46,e[s++]=48,e[s++]=3,e[s++]=1,e[s++]=255&n,e[s++]=n>>8&255,e[s++]=0}var f=!1;this.addFrame=function(t,i,r,n,h,u){if(!0===f&&(--s,f=!1),u=void 0===u?{}:u,t<0||i<0||t>65535||i>65535)throw new Error("x/y invalid.");if(r<=0||n<=0||r>65535||n>65535)throw new Error("Width/Height invalid.");if(h.length<r*n)throw new Error("Not enough pixels for the frame size.");var l=!0,c=u.palette;if(null==c&&(l=!1,c=a),null==c)throw new Error("Must supply either a local or global palette.");for(var p=o(c),d=0;p>>=1;)++d;p=1<<d;var g=void 0===u.delay?0:u.delay,m=void 0===u.disposal?0:u.disposal;if(m<0||m>3)throw new Error("Disposal out of range.");var y=!1,x=0;if(void 0!==u.transparent&&null!==u.transparent&&(y=!0,(x=u.transparent)<0||x>=p))throw new Error("Transparent color index.");if((0!==m||y||0!==g)&&(e[s++]=33,e[s++]=249,e[s++]=4,e[s++]=m<<2|(!0===y?1:0),e[s++]=255&g,e[s++]=g>>8&255,e[s++]=x,e[s++]=0),e[s++]=44,e[s++]=255&t,e[s++]=t>>8&255,e[s++]=255&i,e[s++]=i>>8&255,e[s++]=255&r,e[s++]=r>>8&255,e[s++]=255&n,e[s++]=n>>8&255,e[s++]=!0===l?128|d-1:0,!0===l)for(var v=0,b=c.length;v<b;++v){var _=c[v];e[s++]=_>>16&255,e[s++]=_>>8&255,e[s++]=255&_}return s=function(e,t,i,r){e[t++]=i;var s=t++,n=1<<i,a=n-1,o=n+1,h=o+1,u=i+1,l=0,c=0;function p(i){for(;l>=i;)e[t++]=255&c,c>>=8,l-=8,t===s+256&&(e[s]=255,s=t++)}function d(e){c|=e<<l,l+=u,p(8)}var f=r[0]&a,g={};d(n);for(var m=1,y=r.length;m<y;++m){var x=r[m]&a,v=f<<8|x,b=g[v];if(void 0===b){for(c|=f<<l,l+=u;l>=8;)e[t++]=255&c,c>>=8,l-=8,t===s+256&&(e[s]=255,s=t++);4096===h?(d(n),h=o+1,u=i+1,g={}):(h>=1<<u&&++u,g[v]=h++),f=x}else f=b}return d(f),d(o),p(1),s+1===t?e[s]=0:(e[s]=t-s-1,e[t++]=0),t}(e,s,d<2?2:d,h),s},this.end=function(){return!1===f&&(e[s++]=59,f=!0),s},this.getOutputBuffer=function(){return e},this.setOutputBuffer=function(t){e=t},this.getOutputBufferPosition=function(){return s},this.setOutputBufferPosition=function(e){s=e}},ws=function(e){var t=0;if(71!==e[t++]||73!==e[t++]||70!==e[t++]||56!==e[t++]||56!=(e[t++]+1&253)||97!==e[t++])throw new Error("Invalid GIF 87a/89a header.");var i=e[t++]|e[t++]<<8,r=e[t++]|e[t++]<<8,s=e[t++],n=s>>7,a=1<<1+(7&s);e[t++],e[t++];var o=null,h=null;n&&(o=t,h=a,t+=3*a);var u=!0,l=[],c=0,p=null,d=0,f=null;for(this.width=i,this.height=r;u&&t<e.length;)switch(e[t++]){case 33:switch(e[t++]){case 255:if(11!==e[t]||78==e[t+1]&&69==e[t+2]&&84==e[t+3]&&83==e[t+4]&&67==e[t+5]&&65==e[t+6]&&80==e[t+7]&&69==e[t+8]&&50==e[t+9]&&46==e[t+10]&&48==e[t+11]&&3==e[t+12]&&1==e[t+13]&&0==e[t+16])t+=14,f=e[t++]|e[t++]<<8,t++;else for(t+=12;;){if(!((S=e[t++])>=0))throw Error("Invalid block size");if(0===S)break;t+=S}break;case 249:if(4!==e[t++]||0!==e[t+4])throw new Error("Invalid graphics extension block.");var g=e[t++];c=e[t++]|e[t++]<<8,p=e[t++],1&g||(p=null),d=g>>2&7,t++;break;case 254:for(;;){if(!((S=e[t++])>=0))throw Error("Invalid block size");if(0===S)break;t+=S}break;default:throw new Error("Unknown graphic control label: 0x"+e[t-1].toString(16))}break;case 44:var m=e[t++]|e[t++]<<8,y=e[t++]|e[t++]<<8,x=e[t++]|e[t++]<<8,v=e[t++]|e[t++]<<8,b=e[t++],_=b>>6&1,w=1<<1+(7&b),C=o,D=h,E=!1;b>>7&&(E=!0,C=t,D=w,t+=3*w);var A=t;for(t++;;){var S;if(!((S=e[t++])>=0))throw Error("Invalid block size");if(0===S)break;t+=S}l.push({x:m,y:y,width:x,height:v,has_local_palette:E,palette_offset:C,palette_size:D,data_offset:A,data_length:t-A,transparent_index:p,interlaced:!!_,delay:c,disposal:d});break;case 59:u=!1;break;default:throw new Error("Unknown gif block: 0x"+e[t-1].toString(16))}this.numFrames=function(){return l.length},this.loopCount=function(){return f},this.frameInfo=function(e){if(e<0||e>=l.length)throw new Error("Frame index out of range.");return l[e]},this.decodeAndBlitFrameBGRA=function(t,r){var s=this.frameInfo(t),n=s.width*s.height,a=new Uint8Array(n);Ms(e,s.data_offset,a,n);var o=s.palette_offset,h=s.transparent_index;null===h&&(h=256);var u=s.width,l=i-u,c=u,p=4*(s.y*i+s.x),d=4*((s.y+s.height)*i+s.x),f=p,g=4*l;!0===s.interlaced&&(g+=4*i*7);for(var m=8,y=0,x=a.length;y<x;++y){var v=a[y];if(0===c&&(c=u,(f+=g)>=d&&(g=4*l+4*i*(m-1),f=p+(u+l)*(m<<1),m>>=1)),v===h)f+=4;else{var b=e[o+3*v],_=e[o+3*v+1],w=e[o+3*v+2];r[f++]=w,r[f++]=_,r[f++]=b,r[f++]=255}--c}},this.decodeAndBlitFrameRGBA=function(t,r){var s=this.frameInfo(t),n=s.width*s.height,a=new Uint8Array(n);Ms(e,s.data_offset,a,n);var o=s.palette_offset,h=s.transparent_index;null===h&&(h=256);var u=s.width,l=i-u,c=u,p=4*(s.y*i+s.x),d=4*((s.y+s.height)*i+s.x),f=p,g=4*l;!0===s.interlaced&&(g+=4*i*7);for(var m=8,y=0,x=a.length;y<x;++y){var v=a[y];if(0===c&&(c=u,(f+=g)>=d&&(g=4*l+4*i*(m-1),f=p+(u+l)*(m<<1),m>>=1)),v===h)f+=4;else{var b=e[o+3*v],_=e[o+3*v+1],w=e[o+3*v+2];r[f++]=b,r[f++]=_,r[f++]=w,r[f++]=255}--c}}}}catch(e){}function ks(e,t){t.createImage=function(t,i){return new e.Image(t,i)},t.saveCanvas=function(...e){let i,r,s,n,a;if(e[0]instanceof HTMLCanvasElement)i=e[0],e.shift();else if(e[0]instanceof Mr)i=e[0].elt,e.shift();else if(e[0]instanceof ma){const t=e[0];n=this.createGraphics(t.width,t.height),n.pixelDensity(t.pixelDensity()),t.loadPixels(),n.loadPixels(),n.pixels.set(t.pixels),n.updatePixels(),i=n._renderer.canvas,e.shift()}else i=this._curElement&&this._curElement.elt;switch(e.length>=1&&(r=e[0]),e.length>=2&&(s=e[1]),s=s||t._checkFileExtension(r,s)[1]||"png",s){default:a="image/png";break;case"webp":a="image/webp";break;case"jpeg":case"jpg":a="image/jpeg"}i.toBlob((e=>{t.downloadFile(e,r,s),n&&n.remove()}),a)},t.encodeAndDownloadGif=function(e,i){const r=e.gifProperties;let s=r.loopLimit;1===s?s=null:null===s&&(s=0);const n=new Uint8Array(e.width*e.height*r.numFrames),a=[],o={};for(let t=0;t<r.numFrames;t++){const i=new Set,s=r.frames[t].image.data,n=s.length,h=new Uint32Array(e.width*e.height);for(let e=0,t=0;e<n;e+=4,t++){const r=s[e+0]<<16|s[e+1]<<8|s[e+2];i.add(r),h[t]=r}const u=[...i].sort().toString();void 0===o[u]?o[u]={freq:1,frames:[t]}:(o[u].freq+=1,o[u].frames.push(t)),a.push(h)}let h=[];const u=Object.keys(o).sort((function(e,t){return o[t].freq-o[e].freq})),l=u[0].split(",").map((e=>parseInt(e)));h=h.concat(o[l].frames);const c=new Set(l);for(let e=1;e<u.length;e++){const t=u[e].split(",").map((e=>parseInt(e))).filter((e=>!c.has(e)));if(l.length+t.length<=256){for(let e=0;e<t.length;e++)l.push(t[e]),c.add(t[e]);h=h.concat(o[u[e]].frames)}}h=new Set(h);const p={};for(let e=0;e<l.length;e++)p[l[e]]||(p[l[e]]=e);let d=1;for(;d<l.length;)d<<=1;l.length=d;const f={loop:s,palette:new Uint32Array(l)},g=new Cs(n,e.width,e.height,f);let m={};for(let t=0;t<r.numFrames;t++){const i=!h.has(t),s=i?[]:l,n=new Uint8Array(e.width*e.height),o={},u=new Set;a[t].forEach(((e,r)=>{i?(void 0===o[e]&&(o[e]=s.length,s.push(e)),n[r]=o[e]):n[r]=p[e],t>0&&a[t-1][r]!==e&&u.add(e)}));const c={},d=s.filter((e=>!u.has(e)));if(d.length>0){const e=d[0],r=i?o[e]:p[e];if(t>0){for(let e=0;e<a[t].length;e++)a[t-1][e]===a[t][e]&&(n[e]=r);c.transparent=r,m.frameOpts.disposal=1}}if(c.delay=r.frames[t].delay/10,i){let e=1;for(;e<s.length;)e<<=1;s.length=e,c.palette=new Uint32Array(s)}t>0&&g.addFrame(0,0,e.width,e.height,m.pixelPaletteIndex,m.frameOpts),m={pixelPaletteIndex:n,frameOpts:c}}m.frameOpts.disposal=1,g.addFrame(0,0,e.width,e.height,m.pixelPaletteIndex,m.frameOpts);const y=new Blob([n.slice(0,g.end())],{type:"image/gif"});t.downloadFile(y,i,"gif")},t.saveFrames=function(e,i,r,s,n){let a=r||3;a=Math.max(Math.min(a,15),0),a*=1e3;let o=s||15;o=Math.max(Math.min(o,22),0);let h=0;const u=t._makeFrame,l=this._curElement.elt;let c=[];const p=setInterval((()=>{c.push(u(e+h,i,l)),h++}),1e3/o);setTimeout((()=>{if(clearInterval(p),n)n(c);else for(const e of c)t.downloadFile(e.imageData,e.filename,e.ext);c=[]}),a+.01)},t._makeFrame=function(e,t,i){let r,s;if(r=this?this._curElement.elt:i,t)switch(t.toLowerCase()){case"png":default:s="image/png";break;case"jpeg":case"jpg":s="image/jpeg"}else t="png",s="image/png";let n=r.toDataURL(s);n=n.replace(s,"image/octet-stream");const a={};return a.imageData=n,a.filename=e,a.ext=t,a}}function Is(e){const t=e.options.typed?function(e){switch(!0){case"true"===e:case"false"===e:return"true"===e;case/.\./.test(e):return parseFloat(e);case isFinite(e):return parseInt(e);default:return e}}(e.value):e.value;e.entry.push(e.reviver(t,e.row,e.col)),e.value="",e.col++}function Bs(e){e.output.push(e.entry),e.entry=[],e.row++,e.col=1}function Ls(e){return e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")}void 0!==p5&&ks(p5,p5.prototype);class Ps extends Error{status;response;ok}async function Os(e,t){try{const i=await fetch(e);if(i.ok){let e;switch(t){case"json":e=await i.json();break;case"text":e=await i.text();break;case"arrayBuffer":e=await i.arrayBuffer();break;case"blob":e=await i.blob();break;case"bytes":if(i.bytes)e=await i.bytes();else{const t=await i.arrayBuffer();e=new Uint8Array(t)}break;default:throw new Error("Unsupported response type")}return{data:e,headers:i.headers}}{const e=new Ps(i.statusText);throw e.status=i.status,e.response=i,e.ok=!1,e}}catch(e){throw e instanceof TypeError?console.log("You may have encountered a CORS error"):e instanceof Ps?console.log("You have encountered a HTTP error"):e instanceof SyntaxError&&console.log("There is an error parsing the response to requested data structure"),e}}function Ns(e,t){function i(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}t.loadJSON=async function(t,i,r){try{const{data:e}=await Os(t,"json");return i?i(e):e}catch(i){if(e._friendlyFileLoadError(5,t),r)return r(i);throw i}},t.loadStrings=async function(t,i,r){try{let{data:e}=await Os(t,"text");return e=e.split(/\r?\n/),i?i(e):e}catch(i){if(e._friendlyFileLoadError(3,t),r)return r(i);throw i}},t.loadTable=async function(t,i,r,s,n){"function"==typeof arguments[arguments.length-1]&&("function"==typeof arguments[arguments.length-2]?(s=arguments[arguments.length-2],n=arguments[arguments.length-1]):s=arguments[arguments.length-1]),"string"!=typeof i&&(i=","),"function"==typeof r&&(r=!1);try{let{data:n}=await Os(t,"text"),a=new e.Table;return n=function(e,t,i=e=>e){const r=Object.create(null);if(r.options=t||{},r.reviver=i,r.value="",r.entry=[],r.output=[],r.col=1,r.row=1,r.options.delimiter=void 0===r.options.delimiter?'"':t.delimiter,r.options.delimiter.length>1||0===r.options.delimiter.length)throw Error(`CSVError: delimiter must be one character [${r.options.separator}]`);if(r.options.separator=void 0===r.options.separator?",":t.separator,r.options.separator.length>1||0===r.options.separator.length)throw Error(`CSVError: separator must be one character [${r.options.separator}]`);const s=new RegExp(`${Ls(r.options.delimiter)}|${Ls(r.options.separator)}|\r\n|\n|\r|[^${Ls(r.options.delimiter)}${Ls(r.options.separator)}\r\n]+`,"y"),n=/^(\r\n|\n|\r)$/;let a=[],o="",h=0;for(;null!==(a=s.exec(e));)switch(o=a[0],h){case 0:switch(!0){case o===r.options.delimiter:h=3;break;case o===r.options.separator:h=0,Is(r);break;case n.test(o):h=0,Is(r),Bs(r);break;default:r.value+=o,h=2}break;case 2:switch(!0){case o===r.options.separator:h=0,Is(r);break;case n.test(o):h=0,Is(r),Bs(r);break;default:throw h=4,Error(`CSVError: Illegal state [row:${r.row}, col:${r.col}]`)}break;case 3:1==(o===r.options.delimiter)?h=4:(h=3,r.value+=o);break;case 4:switch(!0){case o===r.options.delimiter:h=3,r.value+=o;break;case o===r.options.separator:h=0,Is(r);break;case n.test(o):h=0,Is(r),Bs(r);break;default:throw Error(`CSVError: Illegal state [row:${r.row}, col:${r.col}]`)}}return 0!==r.entry.length&&(Is(r),Bs(r)),r.output}(n,{separator:i}),a.columns=r?n.shift():Array(n[0].length).fill(null),n.forEach((t=>{const i=new e.TableRow(t);a.addRow(i)})),s?s(a):a}catch(i){if(e._friendlyFileLoadError(2,t),n)return n(i);throw i}},t.loadXML=async function(t,i,r){try{const r=new DOMParser;let{data:s}=await Os(t,"text");const n=r.parseFromString(s,"application/xml");return s=new e.XML(n),i?i(s):s}catch(i){if(e._friendlyFileLoadError(1,t),r)return r(i);throw i}},t.loadBytes=async function(t,i,r){try{let{data:e}=await Os(t,"arrayBuffer");return e=new Uint8Array(e),i?i(e):e}catch(i){if(e._friendlyFileLoadError(6,t),r)return r(i);throw i}},t.loadBlob=async function(e,t,i){try{const{data:i}=await Os(e,"blob");return t?t(i):i}catch(e){if(i)return i(e);throw e}},t.httpGet=async function(e,t="text",i,r){return"function"==typeof t&&(r=i,i=t,t="text"),this.httpDo(e,"GET",t,i,r)},t.httpPost=async function(t,i,r="text",s,n){"function"==typeof i?(s=i,n=r,i=void 0,r="text"):"function"==typeof r&&(n=s,s=r,r="text");let a=i,o="text/plain";i instanceof e.XML?(a=i.serialize(),o="application/xml"):i instanceof e.Image?(a=await i.toBlob(),o="image/png"):"object"==typeof i&&(a=JSON.stringify(i),o="application/json");const h={method:"POST",body:a,headers:{"Content-Type":o}};a&&(h.body=a);const u=new Request(t,h);return this.httpDo(u,"POST",r,s,n)},t.httpDo=async function(e,t,i,r,s){if("function"==typeof i&&(s=r,r=i,i=void 0),!i){switch("string"==typeof e?e.split(".").pop():e.url.split(".").pop()){case"json":i="json";break;case"jpg":case"jpeg":case"png":case"webp":case"gif":i="blob";break;default:i="text"}}const n=new Request(e,{method:t});try{const{data:e}=await Os(n,i);return r?r(e):e}catch(e){if(s)return s(e);throw e}},t._pWriters=[],t.createWriter=function(i,r){let s;for(const n in t._pWriters)if(t._pWriters[n].name===i)return s=new e.PrintWriter(i+this.millis(),r),t._pWriters.push(s),s;return s=new e.PrintWriter(i,r),t._pWriters.push(s),s},e.PrintWriter=function(e,i){let r=this;this.name=e,this.content="",this.write=function(e){this.content+=e},this.print=function(e){this.content+=`${e}\n`},this.clear=function(){this.content=""},this.close=function(){const s=[];s.push(this.content),t.writeFile(s,e,i);for(const e in t._pWriters)t._pWriters[e].name===this.name&&t._pWriters.splice(e,1);r.clear(),r={}}},t.save=function(i,r,s){const n=arguments,a=this._curElement?this._curElement.elt:this.elt;if(0!==n.length)if(n[0]instanceof xs||n[0]instanceof ha)t.saveCanvas(n[0].canvas,n[1],n[2]);else if(1===n.length&&"string"==typeof n[0])t.saveCanvas(a,n[0]);else{switch($r(n[1],n[2])[1]){case"json":return void t.saveJSON(n[0],n[1],n[2]);case"txt":return void t.saveStrings(n[0],n[1],n[2]);default:n[0]instanceof Array?t.saveStrings(n[0],n[1],n[2]):n[0]instanceof e.Table?t.saveTable(n[0],n[1],n[2]):n[0]instanceof e.Image?t.saveCanvas(n[0].canvas,n[1]):n[0]instanceof e.SoundFile&&t.saveSound(n[0],n[1],n[2],n[3])}}else t.saveCanvas(a)},t.saveJSON=function(e,t,i){let r;r=i?JSON.stringify(e):JSON.stringify(e,void 0,2),this.saveStrings(r.split("\n"),t,"json")},t.saveStrings=function(t,i,r,s){const n=r||"txt",a=new e.PrintWriter(i,n);for(let e of t)s?a.write(e+"\r\n"):a.write(e+"\n");a.close(),a.clear()},t.saveTable=function(e,t,r){let s;void 0===r?(s=t.substring(t.lastIndexOf(".")+1,t.length),s===t&&(s="csv")):s=r;const n=this.createWriter(t,s),a=e.columns;let o=",";if("tsv"===s&&(o="\t"),"html"!==s){const t=e.toString(o);n.write(t)}else{n.print("<html>"),n.print("<head>");let t=' <meta http-equiv="content-type" content';if(t+='="text/html;charset=utf-8" />',n.print(t),n.print("</head>"),n.print("<body>"),n.print(" <table>"),"0"!==a[0]){n.print(" <tr>");for(let e=0;e<a.length;e++){const t=i(a[e]);n.print(` <td>${t}`),n.print(" </td>")}n.print(" </tr>")}for(let t=0;t<e.rows.length;t++){n.print(" <tr>");for(let r=0;r<e.columns.length;r++){const s=i(e.rows[t].getString(r));n.print(` <td>${s}`),n.print(" </td>")}n.print(" </tr>")}n.print(" </table>"),n.print("</body>"),n.print("</html>")}n.close(),n.clear()},t.writeFile=function(e,i,r){let s="application/octet-stream";t._isSafari()&&(s="text/plain");const n=new Blob(e,{type:s});t.downloadFile(n,i,r)},t.downloadFile=jr,t._checkFileExtension=$r,t._isSafari=function(){return/^((?!chrome|android).)*safari/i.test(navigator.userAgent)}}void 0!==p5&&Ns(p5,p5.prototype);var Rs=59;function Vs(e=256){let t=0,i=new Uint8Array(e);return{get buffer(){return i.buffer},reset(){t=0},bytesView:()=>i.subarray(0,t),bytes:()=>i.slice(0,t),writeByte(e){r(t+1),i[t]=e,t++},writeBytes(e,s=0,n=e.length){r(t+n);for(let r=0;r<n;r++)i[t++]=e[r+s]},writeBytesView(e,s=0,n=e.byteLength){r(t+n),i.set(e.subarray(s,s+n),t),t+=n}};function r(e){var r=i.length;if(r>=e)return;e=Math.max(e,r*(r<1048576?2:1.125)>>>0),0!=r&&(e=Math.max(e,256));let s=i;i=new Uint8Array(e),t>0&&i.set(s.subarray(0,t),0)}}var Us=[0,1,3,7,15,31,63,127,255,511,1023,2047,4095,8191,16383,32767,65535];var Gs=function(e,t,i,r,s=Vs(512),n=new Uint8Array(256),a=new Int32Array(5003),o=new Int32Array(5003)){let h=a.length,u=Math.max(2,r);n.fill(0),o.fill(0),a.fill(-1);let l=0,c=0,p=u+1,d=p,f=!1,g=d,m=(1<<g)-1,y=1<<p-1,x=y+1,v=y+2,b=0,_=i[0],w=0;for(let e=h;e<65536;e*=2)++w;w=8-w,s.writeByte(u),D(y);let C=i.length;for(let e=1;e<C;e++)e:{let t=i[e],r=(t<<12)+_,s=t<<w^_;if(a[s]===r){_=o[s];break e}let n=0===s?1:h-s;for(;a[s]>=0;)if(s-=n,s<0&&(s+=h),a[s]===r){_=o[s];break e}D(_),_=t,v<4096?(o[s]=v++,a[s]=r):(a.fill(-1),v=y+2,f=!0,D(y))}return D(_),D(x),s.writeByte(0),s.bytesView();function D(e){for(l&=Us[c],c>0?l|=e<<c:l=e,c+=g;c>=8;)n[b++]=255&l,b>=254&&(s.writeByte(b),s.writeBytesView(n,0,b),b=0),l>>=8,c-=8;if((v>m||f)&&(f?(g=d,m=(1<<g)-1,f=!1):(++g,m=12===g?1<<g:(1<<g)-1)),e==x){for(;c>0;)n[b++]=255&l,b>=254&&(s.writeByte(b),s.writeBytesView(n,0,b),b=0),l>>=8,c-=8;b>0&&(s.writeByte(b),s.writeBytesView(n,0,b),b=0)}}};function zs(e,t,i){return e<<8&63488|t<<2&992|i>>3}function js(e,t,i,r){return e>>4|240&t|(240&i)<<4|(240&r)<<8}function $s(e,t,i){return e>>4<<8|240&t|i>>4}function Ws(e,t,i){return e<t?t:e>i?i:e}function qs(e){return e*e}function Hs(e,t,i){var r=0,s=1e100;let n=e[t],a=n.cnt,o=n.rc,h=n.gc,u=n.bc;for(var l=n.fw;0!=l;l=e[l].fw){let t=e[l],i=t.cnt,n=a*i/(a+i);if(!(n>=s)){var c=0;!((c+=n*qs(t.rc-o))>=s)&&(!((c+=n*qs(t.gc-h))>=s)&&(!((c+=n*qs(t.bc-u))>=s)&&(s=c,r=l)))}}n.err=s,n.nn=r}function Xs(e,t,i={}){let{format:r="rgb565",clearAlpha:s=!0,clearAlphaColor:n=0,clearAlphaThreshold:a=0,oneBitAlpha:o=!1}=i;if(!e||!e.buffer)throw new Error("quantize() expected RGBA Uint8Array data");if(!(e instanceof Uint8Array||e instanceof Uint8ClampedArray))throw new Error("quantize() expected RGBA Uint8Array data");let h=new Uint32Array(e.buffer),u=!1!==i.useSqrt,l="rgba4444"===r,c=function(e,t){let i=new Array("rgb444"===t?4096:65536),r=e.length;if("rgba4444"===t)for(let t=0;t<r;++t){let r=e[t],s=r>>24&255,n=r>>16&255,a=r>>8&255,o=255&r,h=js(o,a,n,s),u=h in i?i[h]:i[h]={ac:0,rc:0,gc:0,bc:0,cnt:0,nn:0,fw:0,bk:0,tm:0,mtm:0,err:0};u.rc+=o,u.gc+=a,u.bc+=n,u.ac+=s,u.cnt++}else if("rgb444"===t)for(let t=0;t<r;++t){let r=e[t],s=r>>16&255,n=r>>8&255,a=255&r,o=$s(a,n,s),h=o in i?i[o]:i[o]={ac:0,rc:0,gc:0,bc:0,cnt:0,nn:0,fw:0,bk:0,tm:0,mtm:0,err:0};h.rc+=a,h.gc+=n,h.bc+=s,h.cnt++}else for(let t=0;t<r;++t){let r=e[t],s=r>>16&255,n=r>>8&255,a=255&r,o=zs(a,n,s),h=o in i?i[o]:i[o]={ac:0,rc:0,gc:0,bc:0,cnt:0,nn:0,fw:0,bk:0,tm:0,mtm:0,err:0};h.rc+=a,h.gc+=n,h.bc+=s,h.cnt++}return i}(h,r),p=c.length,d=p-1,f=new Uint32Array(p+1);for(var g=0,m=0;m<p;++m){let e=c[m];if(null!=e){var y=1/e.cnt;l&&(e.ac*=y),e.rc*=y,e.gc*=y,e.bc*=y,c[g++]=e}}qs(t)/g<.022&&(u=!1);for(m=0;m<g-1;++m)c[m].fw=m+1,c[m+1].bk=m,u&&(c[m].cnt=Math.sqrt(c[m].cnt));var x,v,b;for(u&&(c[m].cnt=Math.sqrt(c[m].cnt)),m=0;m<g;++m){Hs(c,m);var _=c[m].err;for(v=++f[0];v>1&&!(c[x=f[b=v>>1]].err<=_);v=b)f[v]=x;f[v]=m}var w=g-t;for(m=0;m<w;){for(var C;;){var D=f[1];if((C=c[D]).tm>=C.mtm&&c[C.nn].mtm<=C.tm)break;C.mtm==d?D=f[1]=f[f[0]--]:(Hs(c,D),C.tm=m);_=c[D].err;for(v=1;(b=v+v)<=f[0]&&(b<f[0]&&c[f[b]].err>c[f[b+1]].err&&b++,!(_<=c[x=f[b]].err));v=b)f[v]=x;f[v]=D}var E=c[C.nn],A=C.cnt,S=E.cnt;y=1/(A+S);l&&(C.ac=y*(A*C.ac+S*E.ac)),C.rc=y*(A*C.rc+S*E.rc),C.gc=y*(A*C.gc+S*E.gc),C.bc=y*(A*C.bc+S*E.bc),C.cnt+=E.cnt,C.mtm=++m,c[E.bk].fw=E.fw,c[E.fw].bk=E.bk,E.mtm=d}let F=[];var T=0;for(m=0;;++T){let e=Ws(Math.round(c[m].rc),0,255),t=Ws(Math.round(c[m].gc),0,255),i=Ws(Math.round(c[m].bc),0,255),r=255;if(l){if(r=Ws(Math.round(c[m].ac),0,255),o){r=r<=("number"==typeof o?o:127)?0:255}s&&r<=a&&(e=t=i=n,r=0)}let h=l?[e,t,i,r]:[e,t,i];if(Ys(F,h)||F.push(h),0==(m=c[m].fw))break}return F}function Ys(e,t){for(let i=0;i<e.length;i++){let r=e[i],s=r[0]===t[0]&&r[1]===t[1]&&r[2]===t[2],n=!(r.length>=4&&t.length>=4)||r[3]===t[3];if(s&&n)return!0}return!1}function Zs(e,t){var i,r=0;for(i=0;i<e.length;i++){let s=e[i]-t[i];r+=s*s}return r}function Ks(e,t,i=Zs){let r=1/0,s=-1;for(let n=0;n<e.length;n++){let a=i(t,e[n]);a<r&&(r=a,s=n)}return s}function Js(e={}){let{initialCapacity:t=4096,auto:i=!0}=e,r=Vs(t),s=new Uint8Array(256),n=new Int32Array(5003),a=new Int32Array(5003),o=!1;return{reset(){r.reset(),o=!1},finish(){r.writeByte(Rs)},bytes:()=>r.bytes(),bytesView:()=>r.bytesView(),get buffer(){return r.buffer},get stream(){return r},writeHeader:h,writeFrame(e,t,u,l={}){let{transparent:c=!1,transparentIndex:p=0,delay:d=0,palette:f=null,repeat:g=0,colorDepth:m=8,dispose:y=-1}=l,x=!1;if(i?o||(x=!0,h(),o=!0):x=Boolean(l.first),t=Math.max(0,Math.floor(t)),u=Math.max(0,Math.floor(u)),x){if(!f)throw new Error("First frame must include a { palette } option");(function(e,t,i,r,s=8){let n=1,a=0,o=rn(r.length)-1,h=n<<7|s-1<<4|a<<3|o,u=0,l=0;en(e,t),en(e,i),e.writeBytes([h,u,l])})(r,t,u,f,m),Qs(r,f),g>=0&&function(e,t){e.writeByte(33),e.writeByte(255),e.writeByte(11),tn(e,"NETSCAPE2.0"),e.writeByte(3),e.writeByte(1),en(e,t),e.writeByte(0)}(r,g)}let v=Math.round(d/10);!function(e,t,i,r,s){var n,a;e.writeByte(33),e.writeByte(249),e.writeByte(4),s<0&&(s=0,r=!1),r?(n=1,a=2):(n=0,a=0),t>=0&&(a=7&t),a<<=2;let o=0;e.writeByte(a|o|n),en(e,i),e.writeByte(s||0),e.writeByte(0)}(r,y,v,c,p);let b=Boolean(f)&&!x;(function(e,t,i,r){if(e.writeByte(44),en(e,0),en(e,0),en(e,t),en(e,i),r){let t=0,i=0,s=rn(r.length)-1;e.writeByte(128|t|i|s)}else e.writeByte(0)})(r,t,u,b?f:null),b&&Qs(r,f),function(e,t,i,r,s=8,n,a,o){Gs(i,r,t,s,e,n,a,o)}(r,e,t,u,m,s,n,a)}};function h(){tn(r,"GIF89a")}}function Qs(e,t){let i=1<<rn(t.length);for(let r=0;r<i;r++){let i=[0,0,0];r<t.length&&(i=t[r]),e.writeByte(i[0]),e.writeByte(i[1]),e.writeByte(i[2])}}function en(e,t){e.writeByte(255&t),e.writeByte(t>>8&255)}function tn(e,t){for(var i=0;i<t.length;i++)e.writeByte(t.charCodeAt(i))}function rn(e){return Math.max(Math.ceil(Math.log2(e)),1)}function sn(e,t){function i(e,t,i){const r=parseInt(i/2),s=4*t,n=new Uint8Array(4*t);for(let t=0;t<r;++t){const r=t*s,a=(i-t-1)*s;n.set(e.subarray(r,r+s)),e.copyWithin(r,a,a+s),e.set(n,a)}return e}function r(e,t,i,r,s,n,a,o,h,u,l){if(e===Me){const{x:e,y:r,w:s,h:c}=function(e,t,i,r,s,n,a,o){const h=Math.max(i/a,r/o),[u,l]=[i/h,r/h];let c=s,p=n;return e===A?c+=(a-u)/2:e===D&&(c+=a-u),t===A?p+=(o-l)/2:t===S&&(p+=o-l),{x:c,y:p,w:u,h:l}}(t,i,n,a,o,h,u,l);o=e,h=r,u=s,l=c}if(e===Te){const{x:e,y:o,w:h,h:c}=function(e,t,i,r,s,n,a,o){const h=Math.max(a/s,o/n),[u,l]=[a/h,o/h];let c=i,p=r;return e===A?c+=(s-u)/2:e===D&&(c+=s-u),t===A?p+=(n-l)/2:t===S&&(p+=n-l),{x:c,y:p,w:u,h:l}}(t,i,r,s,n,a,u,l);r=e,s=o,n=h,a=c}return{sx:o,sy:h,sw:u,sh:l,dx:r,dy:s,dw:n,dh:a}}function s(e,t){return e>0&&e<t?e:t}t.loadImage=async function(t,i,r){try{let r=new e.Image(1,1,this);const s=new Request(t,{method:"GET",mode:"cors"}),{data:n,headers:a}=await Os(s,"bytes"),o=a.get("content-type");if(null===o&&console.warn("The image you loaded does not have a Content-Type header. If you are using the online editor consider reuploading the asset."),o&&o.includes("image/gif"))await async function(t,i){const r=new ws(t);i.width=i.canvas.width=r.width,i.height=i.canvas.height=r.height;const s=[],n=r.numFrames();let a=new Uint8ClampedArray(i.width*i.height*4);const o=(t,r)=>{try{r.decodeAndBlitFrameRGBA(t,a)}catch(t){throw e._friendlyFileLoadError(8,i.src),t}};for(let e=0;e<n;e++){const t=r.frameInfo(e),n=i.drawingContext.getImageData(0,0,i.width,i.height);a=n.data.slice(),o(e,r);const h=new ImageData(a,i.width,i.height);i.drawingContext.putImageData(h,0,0);let u=t.delay;0===u&&(u=10),s.push({image:i.drawingContext.getImageData(0,0,i.width,i.height),delay:10*u}),2===t.disposal?i.drawingContext.clearRect(t.x,t.y,t.width,t.height):3===t.disposal&&i.drawingContext.putImageData(n,0,0,t.x,t.y,t.width,t.height)}let h=r.loopCount();null===h?h=1:0===h&&(h=null);i.drawingContext.putImageData(s[0].image,0,0),s.length>1&&(i.gifProperties={displayIndex:0,loopLimit:h,loopCount:0,frames:s,numFrames:n,playing:!0,timeDisplayed:0,lastChangeTime:0});return i}(n,r);else{const e=new Blob([n]),t=await createImageBitmap(e);r.width=r.canvas.width=t.width,r.height=r.canvas.height=t.height,r.drawingContext.drawImage(t,0,0)}return r.modified=!0,i?i(r):r}catch(i){if(e._friendlyFileLoadError(0,t),"function"==typeof r)return r(i);throw i}},t.saveGif=async function(r,s,n={delay:0,units:"seconds",silent:!1,notificationDuration:0,notificationID:"progressBar"}){if("string"!=typeof r)throw TypeError("fileName parameter must be a string");if("number"!=typeof s)throw TypeError("Duration parameter must be a number");const a=n&&n.delay||0,o=n&&n.units||"seconds",h=n&&n.silent||!1,u=n&&n.notificationDuration||0,l=n&&n.notificationID||"progressBar";if("number"!=typeof a)throw TypeError("Delay parameter must be a number");if("seconds"!==o&&"frames"!==o)throw TypeError('Units parameter must be either "frames" or "seconds"');if("boolean"!=typeof h)throw TypeError("Silent parameter must be a boolean");if("number"!=typeof u)throw TypeError("Notification duration parameter must be a number");if("string"!=typeof l)throw TypeError("Notification ID parameter must be a string");this._recording=!0;let c=this._targetFrameRate;c!==1/0&&void 0!==c&&0!==c||(c=60);let p=1/c*1e3;p=p<20?20:p;const d="seconds"===o?s*c:s,f="seconds"===o?a*c:a,g=d+f;let m=f;this.frameCount=m;const y=this._renderer._pixelDensity;this.pixelDensity(1);let x,v,b,_=[];for(null!==document.getElementById(l)&&document.getElementById(l).remove(),h||(x=this.createP(""),x.id(l),x.style("font-size","16px"),x.style("font-family","Montserrat"),x.style("background-color","#ffffffa0"),x.style("padding","8px"),x.style("border-radius","10px"),x.position(0,0)),this._renderer instanceof e.RendererGL&&(b=this.drawingContext,v=new Uint8Array(b.drawingBufferWidth*b.drawingBufferHeight*4)),this.noLoop(),await Promise.resolve();m<g;){let t;this.redraw(),this._renderer instanceof e.RendererGL?(v=new Uint8Array(b.drawingBufferWidth*b.drawingBufferHeight*4),b.readPixels(0,0,b.drawingBufferWidth,b.drawingBufferHeight,b.RGBA,b.UNSIGNED_BYTE,v),t=i(v,this.width,this.height)):t=this.drawingContext.getImageData(0,0,this.width,this.height).data,_.push(t),m++,h||x.html("Saved frame <b>"+_.length.toString()+"</b> out of "+d.toString()),await new Promise((e=>setTimeout(e,0)))}h||x.html("Frames processed, generating color palette..."),this.loop(),this.pixelDensity(y);const w=Js(),C=function(e){let t=new Uint8Array(e.length*e[0].length);for(let i=0;i<e.length;i++)t.set(e[i],i*e[0].length);let i=Xs(t,256,{format:"rgba4444",oneBitAlpha:!0});256===i.length?i[i.length-1]=[255*Math.random(),255*Math.random(),255*Math.random(),0]:i.push([255*Math.random(),255*Math.random(),255*Math.random(),0]);return i}(_),D={},E=e=>{const t=e.length/4,i=new Uint8Array(t);for(let r=0;r<t;r++){const t=e[4*r]<<24|e[4*r+1]<<16|e[4*r+2]<<8|e[4*r+3];void 0===D[t]&&(D[t]=Ks(C,e.slice(4*r,4*(r+1)))),i[r]=D[t]}return i},A=C.length-1;let S=[];for(let e=0;e<_.length;e++){const t=E(_[e]),i=t.slice();if(0===e)w.writeFrame(t,this.width,this.height,{palette:C,delay:p,dispose:1});else{for(let e=0;e<t.length;e++)t[e]===S[e]&&(t[e]=A);w.writeFrame(t,this.width,this.height,{delay:p,transparent:!0,transparentIndex:A,dispose:1})}S=i,h||x.html("Rendered frame <b>"+e.toString()+"</b> out of "+d.toString()),await new Promise((e=>setTimeout(e,0)))}w.finish();const F=w.bytesView(),T=new Blob([F],{type:"image/gif"});_=[],this._recording=!1,this.loop(),h||(x.html("Done. Downloading your gif!🌸"),u>0&&setTimeout((()=>x.remove()),1e3*u)),t.downloadFile(T,r,"gif")},t.image=function(e,t,i,n,a,o,h,u,l,c,p,d){let f=e.width,g=e.height;d=d||A,p=p||A,e.elt&&(f=void 0!==f?f:e.elt.width,g=void 0!==g?g:e.elt.height),e.elt&&e.elt.videoWidth&&!e.canvas&&(f=void 0!==f?f:e.elt.videoWidth,g=void 0!==g?g:e.elt.videoHeight);let m=t,y=i,x=n||f,v=a||g,b=o||0,_=h||0,w=void 0!==u?u:f,C=void 0!==l?l:g;w=s(w,f),C=s(C,g);let D=1;e.elt&&!e.canvas&&e.elt.style.width&&(D=e.elt.videoWidth&&!n?e.elt.videoWidth:e.elt.width,D/=parseInt(e.elt.style.width,10)),b*=D,_*=D,C*=D,w*=D;let E=Ds.modeAdjust(m,y,x,v,this._renderer.states.imageMode);E=r(c,p,d,E.x,E.y,E.w,E.h,b,_,w,C),this._renderer.image(e,E.sx,E.sy,E.sw,E.sh,E.dx,E.dy,E.dw,E.dh)},t.tint=function(...e){const t=this.color(...e);this._renderer.states.setValue("tint",t._getRGBA([255,255,255,255]))},t.noTint=function(){this._renderer.states.setValue("tint",null)},t.imageMode=function(e){e!==_&&e!==w&&e!==A||this._renderer.states.setValue("imageMode",e)}}function nn(e,t){t.blend=function(...t){this._renderer?this._renderer.blend(...t):e.Renderer2D.prototype.blend.apply(this,t)},t.copy=function(...e){let i,r,s,n,a,o,h,u,l;if(9===e.length)i=e[0],r=e[1],s=e[2],n=e[3],a=e[4],o=e[5],h=e[6],u=e[7],l=e[8];else{if(8!==e.length)throw new Error("Signature not supported");i=this,r=e[0],s=e[1],n=e[2],a=e[3],o=e[4],h=e[5],u=e[6],l=e[7]}t._copyHelper(this,i,r,s,n,a,o,h,u,l)},t._copyHelper=(e,t,i,r,s,n,a,o,h,u)=>{const l=t.canvas.width/t.width;let c=0,p=0;t._renderer&&t._renderer.isP3D&&(c=t.width/2,p=t.height/2),e._renderer&&e._renderer.isP3D?(e.push(),e.resetMatrix(),e.noLights(),e.blendMode(e.BLEND),e.imageMode(e.CORNER),e._renderer.image(t,i+c,r+p,s,n,a,o,h,u),e.pop()):e.drawingContext.drawImage(t.canvas,l*(i+c),l*(r+p),l*s,l*n,a,o,h,u)},t.getFilterGraphicsLayer=function(){return this._renderer.getFilterGraphicsLayer()},t.filter=function(...t){let{shader:i,operation:r,value:s,useWebGL:n}=function(...t){let i={shader:void 0,operation:void 0,value:void 0,useWebGL:!0};if(t[0]instanceof e.Shader)return i.shader=t[0],i;i.operation=t[0];t.length>1&&"number"==typeof t[1]&&(i.value=t[1]);!1===t[t.length-1]&&(i.useWebGL=!1);return i}(...t);this._renderer.isP3D&&i?this._renderer.filter(i):n||this._renderer.isP3D?(!n&&this._renderer.isP3D&&console.warn("filter() with useWebGL=false is not supported in WEBGL"),this._renderer.isP3D?this._renderer.filter(r,s):(i?this._renderer.filterRenderer.setOperation(r,s,i):this._renderer.filterRenderer.setOperation(r,s),this._renderer.filterRenderer.applyFilter())):void 0!==this.canvas?Ir.apply(this.canvas,Ir[r],s):Ir.apply(this.elt,Ir[r],s)},t.get=function(e,t,i,r){return this._renderer.get(...arguments)},t.loadPixels=function(...e){this._renderer.loadPixels()},t.set=function(e,t,i){this._renderer.set(e,t,i)},t.updatePixels=function(e,t,i,r){0!==this.pixels.length&&this._renderer.updatePixels(e,t,i,r)}}void 0!==p5&&sn(p5,p5.prototype),void 0!==p5&&nn(p5,p5.prototype);class an{#g=null;constructor(...e){if(this.constructor===an)throw new Error("Class is of abstract type and can't be instantiated");["add","setElement","reset","set","get","copy","clone","diagonal","row","column","transpose","mult","multiplyVec","invert","createSubMatrix3x3","inverseTranspose4x4","apply","scale","rotate4x4","translate","rotateX","rotateY","rotateZ","perspective","ortho","multiplyVec4","multiplyPoint","multiplyAndNormalizePoint","multiplyDirection","multiplyVec3"].forEach((e=>{if(void 0===this[e])throw new Error(`${e}() method must be implemented`)}))}}const on=e=>{if(Math.sqrt(Array.from(e).length)%1!=0)throw new Error("Array length must be a perfect square.");return!0};let hn=Array,un=e=>Array.isArray(e);"undefined"!=typeof Float32Array&&(hn=Float32Array,un=e=>Array.isArray(e)||e instanceof Float32Array);class ln extends an{matrix;#m;constructor(...e){if(super(...e),un(e[0])&&on(e[0])){const t=Math.sqrt(Array.from(e[0]).length);this.#m=t,this.matrix=hn.from(e[0])}else"number"==typeof e[0]&&(this.#m=Number(e[0]),this.matrix=this.#y(e[0]));return this}get mat3(){return 3===this.#m?this.matrix:void 0}get mat4(){return 4===this.#m?this.matrix:void 0}add(e){if(this.matrix.length!==e.matrix.length)throw new Error("Matrices must be of the same dimension to add.");for(let t=0;t<this.matrix.length;t++)this.matrix[t]+=e.matrix[t];return this}setElement(e,t){return e>=0&&e<this.matrix.length&&(this.matrix[e]=t),this}reset(){return this.matrix=this.#y(this.#m),this}set(e){let t=hn.from([...arguments]);return e instanceof ln?t=hn.from(e.matrix):un(e)&&(t=hn.from(e)),t.length!==this.matrix.length?(p5._friendlyError(`Expected same dimensions values but received different ${t.length}.`,"p5.Matrix.set"),this):(this.matrix=t,this)}get(){return new ln(this.matrix)}copy(){return new ln(this.matrix)}clone(){return this.copy()}diagonal(){const e=[];for(let t=0;t<this.#m;t++)e.push(this.matrix[t*(this.#m+1)]);return e}row(e){const t=[];for(let i=0;i<this.#m;i++)t.push(this.matrix[i*this.#m+e]);return new je(...t)}column(e){const t=[];for(let i=0;i<this.#m;i++)t.push(this.matrix[e*this.#m+i]);return new je(...t)}transpose(e){return 4===this.#m?this.#x(e):3===this.#m?this.#v(e):this.#b(e)}mult(e){let t;return e===this||e===this.matrix?t=this.copy().matrix:e instanceof ln?t=e.matrix:un(e)&&on(e)?t=e:on(arguments)&&(t=Array.from(arguments)),4===this.#m&&16===t.length?this.#_(t):3===this.#m&&9===t.length?this.#w(t):this.#C(t)}multiplyVec(e,t){void 0===t&&(t=e.copy());for(let i=0;i<this.#m;i++)t.values[i]=this.row(i).dot(e);return t}invert(e){if(4===this.#m)return this.#D(e);if(3===this.#m)return this.#E(e);throw new Error("Invert is not implemented for N>4 at the moment, we are working on it")}createSubMatrix3x3(){if(4===this.#m){const e=new ln(3);return e.mat3[0]=this.matrix[0],e.mat3[1]=this.matrix[1],e.mat3[2]=this.matrix[2],e.mat3[3]=this.matrix[4],e.mat3[4]=this.matrix[5],e.mat3[5]=this.matrix[6],e.mat3[6]=this.matrix[8],e.mat3[7]=this.matrix[9],e.mat3[8]=this.matrix[10],e}throw new Error("Matrix dimension must be 4 to create a 3x3 submatrix.")}inverseTranspose4x4({mat4:e}){if(3!==this.#m)throw new Error("This function only works with 3×3 matrices.");this.matrix[0]=e[0],this.matrix[1]=e[1],this.matrix[2]=e[2],this.matrix[3]=e[4],this.matrix[4]=e[5],this.matrix[5]=e[6],this.matrix[6]=e[8],this.matrix[7]=e[9],this.matrix[8]=e[10];const t=this.invert();if(t)t.transpose(this.matrix);else for(let e=0;e<9;e++)this.matrix[e]=0;return this}apply(e){let t;if(e===this||e===this.matrix)t=this.copy().matrix;else if(e instanceof ln)t=e.matrix;else if(un(e))t=e;else{if(16!==arguments.length)return;t=arguments}const i=this.matrix,r=i[0],s=i[4],n=i[8],a=i[12];i[0]=t[0]*r+t[1]*s+t[2]*n+t[3]*a,i[4]=t[4]*r+t[5]*s+t[6]*n+t[7]*a,i[8]=t[8]*r+t[9]*s+t[10]*n+t[11]*a,i[12]=t[12]*r+t[13]*s+t[14]*n+t[15]*a;const o=i[1],h=i[5],u=i[9],l=i[13];i[1]=t[0]*o+t[1]*h+t[2]*u+t[3]*l,i[5]=t[4]*o+t[5]*h+t[6]*u+t[7]*l,i[9]=t[8]*o+t[9]*h+t[10]*u+t[11]*l,i[13]=t[12]*o+t[13]*h+t[14]*u+t[15]*l;const c=i[2],p=i[6],d=i[10],f=i[14];i[2]=t[0]*c+t[1]*p+t[2]*d+t[3]*f,i[6]=t[4]*c+t[5]*p+t[6]*d+t[7]*f,i[10]=t[8]*c+t[9]*p+t[10]*d+t[11]*f,i[14]=t[12]*c+t[13]*p+t[14]*d+t[15]*f;const g=i[3],m=i[7],y=i[11],x=i[15];return i[3]=t[0]*g+t[1]*m+t[2]*y+t[3]*x,i[7]=t[4]*g+t[5]*m+t[6]*y+t[7]*x,i[11]=t[8]*g+t[9]*m+t[10]*y+t[11]*x,i[15]=t[12]*g+t[13]*m+t[14]*y+t[15]*x,this}scale(e,t,i){return e instanceof je?(t=e.y,i=e.z,e=e.x):e instanceof Array&&(t=e[1],i=e[2],e=e[0]),this.matrix[0]*=e,this.matrix[1]*=e,this.matrix[2]*=e,this.matrix[3]*=e,this.matrix[4]*=t,this.matrix[5]*=t,this.matrix[6]*=t,this.matrix[7]*=t,this.matrix[8]*=i,this.matrix[9]*=i,this.matrix[10]*=i,this.matrix[11]*=i,this}rotate4x4(e,t,i,r){t instanceof je?(i=t.y,r=t.z,t=t.x):t instanceof Array&&(i=t[1],r=t[2],t=t[0]);const s=Math.sqrt(t*t+i*i+r*r);t*=1/s,i*=1/s,r*=1/s;const n=this.matrix[0],a=this.matrix[1],o=this.matrix[2],h=this.matrix[3],u=this.matrix[4],l=this.matrix[5],c=this.matrix[6],p=this.matrix[7],d=this.matrix[8],f=this.matrix[9],g=this.matrix[10],m=this.matrix[11],y=Math.sin(e),x=Math.cos(e),v=1-x,b=t*t*v+x,_=i*t*v+r*y,w=r*t*v-i*y,C=t*i*v-r*y,D=i*i*v+x,E=r*i*v+t*y,A=t*r*v+i*y,S=i*r*v-t*y,F=r*r*v+x;return this.matrix[0]=n*b+u*_+d*w,this.matrix[1]=a*b+l*_+f*w,this.matrix[2]=o*b+c*_+g*w,this.matrix[3]=h*b+p*_+m*w,this.matrix[4]=n*C+u*D+d*E,this.matrix[5]=a*C+l*D+f*E,this.matrix[6]=o*C+c*D+g*E,this.matrix[7]=h*C+p*D+m*E,this.matrix[8]=n*A+u*S+d*F,this.matrix[9]=a*A+l*S+f*F,this.matrix[10]=o*A+c*S+g*F,this.matrix[11]=h*A+p*S+m*F,this}translate(e){const t=e[0],i=e[1],r=e[2]||0;return this.matrix[12]+=this.matrix[0]*t+this.matrix[4]*i+this.matrix[8]*r,this.matrix[13]+=this.matrix[1]*t+this.matrix[5]*i+this.matrix[9]*r,this.matrix[14]+=this.matrix[2]*t+this.matrix[6]*i+this.matrix[10]*r,this.matrix[15]+=this.matrix[3]*t+this.matrix[7]*i+this.matrix[11]*r,this}rotateX(e){this.rotate4x4(e,1,0,0)}rotateY(e){this.rotate4x4(e,0,1,0)}rotateZ(e){this.rotate4x4(e,0,0,1)}perspective(e,t,i,r){const s=1/Math.tan(e/2),n=1/(i-r);return this.matrix[0]=s/t,this.matrix[1]=0,this.matrix[2]=0,this.matrix[3]=0,this.matrix[4]=0,this.matrix[5]=s,this.matrix[6]=0,this.matrix[7]=0,this.matrix[8]=0,this.matrix[9]=0,this.matrix[10]=(r+i)*n,this.matrix[11]=-1,this.matrix[12]=0,this.matrix[13]=0,this.matrix[14]=2*r*i*n,this.matrix[15]=0,this}ortho(e,t,i,r,s,n){const a=1/(e-t),o=1/(i-r),h=1/(s-n);return this.matrix[0]=-2*a,this.matrix[1]=0,this.matrix[2]=0,this.matrix[3]=0,this.matrix[4]=0,this.matrix[5]=-2*o,this.matrix[6]=0,this.matrix[7]=0,this.matrix[8]=0,this.matrix[9]=0,this.matrix[10]=2*h,this.matrix[11]=0,this.matrix[12]=(e+t)*a,this.matrix[13]=(r+i)*o,this.matrix[14]=(n+s)*h,this.matrix[15]=1,this}multiplyVec4(e,t,i,r){const s=new Array(4),n=this.matrix;return s[0]=n[0]*e+n[4]*t+n[8]*i+n[12]*r,s[1]=n[1]*e+n[5]*t+n[9]*i+n[13]*r,s[2]=n[2]*e+n[6]*t+n[10]*i+n[14]*r,s[3]=n[3]*e+n[7]*t+n[11]*i+n[15]*r,s}multiplyPoint({x:e,y:t,z:i}){const r=this.multiplyVec4(e,t,i,1);return new je(r[0],r[1],r[2])}multiplyAndNormalizePoint({x:e,y:t,z:i}){const r=this.multiplyVec4(e,t,i,1);return r[0]/=r[3],r[1]/=r[3],r[2]/=r[3],new je(r[0],r[1],r[2])}multiplyDirection({x:e,y:t,z:i}){const r=this.multiplyVec4(e,t,i,0);return new je(r[0],r[1],r[2])}multiplyVec3(e,t){return void 0===t&&(t=e.copy()),t.x=this.row(0).dot(e),t.y=this.row(1).dot(e),t.z=this.row(2).dot(e),t}#y(e){if(3===e)return new hn([1,0,0,0,1,0,0,0,1]);if(4===e)return new hn([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]);const t=new hn(e*e).fill(0);for(let i=0;i<e;i++)t[i*e+i]=1;return t}#_(e){let t=this.matrix[0],i=this.matrix[1],r=this.matrix[2],s=this.matrix[3];return this.matrix[0]=t*e[0]+i*e[4]+r*e[8]+s*e[12],this.matrix[1]=t*e[1]+i*e[5]+r*e[9]+s*e[13],this.matrix[2]=t*e[2]+i*e[6]+r*e[10]+s*e[14],this.matrix[3]=t*e[3]+i*e[7]+r*e[11]+s*e[15],t=this.matrix[4],i=this.matrix[5],r=this.matrix[6],s=this.matrix[7],this.matrix[4]=t*e[0]+i*e[4]+r*e[8]+s*e[12],this.matrix[5]=t*e[1]+i*e[5]+r*e[9]+s*e[13],this.matrix[6]=t*e[2]+i*e[6]+r*e[10]+s*e[14],this.matrix[7]=t*e[3]+i*e[7]+r*e[11]+s*e[15],t=this.matrix[8],i=this.matrix[9],r=this.matrix[10],s=this.matrix[11],this.matrix[8]=t*e[0]+i*e[4]+r*e[8]+s*e[12],this.matrix[9]=t*e[1]+i*e[5]+r*e[9]+s*e[13],this.matrix[10]=t*e[2]+i*e[6]+r*e[10]+s*e[14],this.matrix[11]=t*e[3]+i*e[7]+r*e[11]+s*e[15],t=this.matrix[12],i=this.matrix[13],r=this.matrix[14],s=this.matrix[15],this.matrix[12]=t*e[0]+i*e[4]+r*e[8]+s*e[12],this.matrix[13]=t*e[1]+i*e[5]+r*e[9]+s*e[13],this.matrix[14]=t*e[2]+i*e[6]+r*e[10]+s*e[14],this.matrix[15]=t*e[3]+i*e[7]+r*e[11]+s*e[15],this}#C(e){if(e.length!==this.matrix.length)throw new Error("Matrices must be of the same dimension to multiply.");const t=new hn(this.matrix.length).fill(0);for(let i=0;i<this.#m;i++)for(let r=0;r<this.#m;r++)for(let s=0;s<this.#m;s++)t[i*this.#m+r]+=this.matrix[i*this.#m+s]*e[s*this.#m+r];return this.matrix=t,this}#w(e){let t=this.mat3[0],i=this.mat3[1],r=this.mat3[2];return this.mat3[0]=t*e[0]+i*e[3]+r*e[6],this.mat3[1]=t*e[1]+i*e[4]+r*e[7],this.mat3[2]=t*e[2]+i*e[5]+r*e[8],t=this.mat3[3],i=this.mat3[4],r=this.mat3[5],this.mat3[3]=t*e[0]+i*e[3]+r*e[6],this.mat3[4]=t*e[1]+i*e[4]+r*e[7],this.mat3[5]=t*e[2]+i*e[5]+r*e[8],t=this.mat3[6],i=this.mat3[7],r=this.mat3[8],this.mat3[6]=t*e[0]+i*e[3]+r*e[6],this.mat3[7]=t*e[1]+i*e[4]+r*e[7],this.mat3[8]=t*e[2]+i*e[5]+r*e[8],this}#b(){const e=this.#m;for(let t=0;t<e;t++)for(let i=0;i<e;i++)this.matrix[t*e+i]=this.matrix[i*e+t];return this}#x(e){let t,i,r,s,n,a;return console.log("====> 4x4"),e instanceof ln?(t=e.matrix[1],i=e.matrix[2],r=e.matrix[3],s=e.matrix[6],n=e.matrix[7],a=e.matrix[11],this.matrix[0]=e.matrix[0],this.matrix[1]=e.matrix[4],this.matrix[2]=e.matrix[8],this.matrix[3]=e.matrix[12],this.matrix[4]=t,this.matrix[5]=e.matrix[5],this.matrix[6]=e.matrix[9],this.matrix[7]=e.matrix[13],this.matrix[8]=i,this.matrix[9]=s,this.matrix[10]=e.matrix[10],this.matrix[11]=e.matrix[14],this.matrix[12]=r,this.matrix[13]=n,this.matrix[14]=a,this.matrix[15]=e.matrix[15]):un(e)&&(t=e[1],i=e[2],r=e[3],s=e[6],n=e[7],a=e[11],this.matrix[0]=e[0],this.matrix[1]=e[4],this.matrix[2]=e[8],this.matrix[3]=e[12],this.matrix[4]=t,this.matrix[5]=e[5],this.matrix[6]=e[9],this.matrix[7]=e[13],this.matrix[8]=i,this.matrix[9]=s,this.matrix[10]=e[10],this.matrix[11]=e[14],this.matrix[12]=r,this.matrix[13]=n,this.matrix[14]=a,this.matrix[15]=e[15]),this}#v(e){void 0===e&&(e=this.mat3);const t=e[1],i=e[2],r=e[5];return this.mat3[0]=e[0],this.mat3[1]=e[3],this.mat3[2]=e[6],this.mat3[3]=t,this.mat3[4]=e[4],this.mat3[5]=e[7],this.mat3[6]=i,this.mat3[7]=r,this.mat3[8]=e[8],this}#D(e){let t,i,r,s,n,a,o,h,u,l,c,p,d,f,g,m;e instanceof ln?(t=e.matrix[0],i=e.matrix[1],r=e.matrix[2],s=e.matrix[3],n=e.matrix[4],a=e.matrix[5],o=e.matrix[6],h=e.matrix[7],u=e.matrix[8],l=e.matrix[9],c=e.matrix[10],p=e.matrix[11],d=e.matrix[12],f=e.matrix[13],g=e.matrix[14],m=e.matrix[15]):un(e)&&(t=e[0],i=e[1],r=e[2],s=e[3],n=e[4],a=e[5],o=e[6],h=e[7],u=e[8],l=e[9],c=e[10],p=e[11],d=e[12],f=e[13],g=e[14],m=e[15]);const y=t*a-i*n,x=t*o-r*n,v=t*h-s*n,b=i*o-r*a,_=i*h-s*a,w=r*h-s*o,C=u*f-l*d,D=u*g-c*d,E=u*m-p*d,A=l*g-c*f,S=l*m-p*f,F=c*m-p*g;let T=y*F-x*S+v*A+b*E-_*D+w*C;return T?(T=1/T,this.matrix[0]=(a*F-o*S+h*A)*T,this.matrix[1]=(r*S-i*F-s*A)*T,this.matrix[2]=(f*w-g*_+m*b)*T,this.matrix[3]=(c*_-l*w-p*b)*T,this.matrix[4]=(o*E-n*F-h*D)*T,this.matrix[5]=(t*F-r*E+s*D)*T,this.matrix[6]=(g*v-d*w-m*x)*T,this.matrix[7]=(u*w-c*v+p*x)*T,this.matrix[8]=(n*S-a*E+h*C)*T,this.matrix[9]=(i*E-t*S-s*C)*T,this.matrix[10]=(d*_-f*v+m*y)*T,this.matrix[11]=(l*v-u*_-p*y)*T,this.matrix[12]=(a*D-n*A-o*C)*T,this.matrix[13]=(t*A-i*D+r*C)*T,this.matrix[14]=(f*x-d*b-g*y)*T,this.matrix[15]=(u*b-l*x+c*y)*T,this):null}#E(){const e=this.mat3[0],t=this.mat3[1],i=this.mat3[2],r=this.mat3[3],s=this.mat3[4],n=this.mat3[5],a=this.mat3[6],o=this.mat3[7],h=this.mat3[8],u=h*s-n*o,l=-h*r+n*a,c=o*r-s*a;let p=e*u+t*l+i*c;return p?(p=1/p,this.mat3[0]=u*p,this.mat3[1]=(-h*t+i*o)*p,this.mat3[2]=(n*t-i*s)*p,this.mat3[3]=l*p,this.mat3[4]=(h*e-i*a)*p,this.mat3[5]=(-n*e+i*r)*p,this.mat3[6]=c*p,this.mat3[7]=(-o*e+t*a)*p,this.mat3[8]=(s*e-t*r)*p,this):null}#A(){if(4!==this.#m)throw new Error("Determinant is only implemented for 4x4 matrices. We are working on it.");const e=this.matrix[0]*this.matrix[5]-this.matrix[1]*this.matrix[4],t=this.matrix[0]*this.matrix[6]-this.matrix[2]*this.matrix[4],i=this.matrix[0]*this.matrix[7]-this.matrix[3]*this.matrix[4],r=this.matrix[1]*this.matrix[6]-this.matrix[2]*this.matrix[5],s=this.matrix[1]*this.matrix[7]-this.matrix[3]*this.matrix[5],n=this.matrix[2]*this.matrix[7]-this.matrix[3]*this.matrix[6],a=this.matrix[8]*this.matrix[13]-this.matrix[9]*this.matrix[12],o=this.matrix[8]*this.matrix[14]-this.matrix[10]*this.matrix[12],h=this.matrix[8]*this.matrix[15]-this.matrix[11]*this.matrix[12],u=this.matrix[9]*this.matrix[14]-this.matrix[10]*this.matrix[13],l=this.matrix[9]*this.matrix[15]-this.matrix[11]*this.matrix[13];return e*(this.matrix[10]*this.matrix[15]-this.matrix[11]*this.matrix[14])-t*l+i*u+r*h-s*o+n*a}}function cn(e,t){e.Matrix=ln}void 0!==p5&&cn(p5);class pn{constructor(e=128){this.length=0,this.data=new Float32Array(e),this.initialLength=e}dataArray(){return this.subArray(0,this.length)}clear(){this.length=0}rescale(){if(this.length<this.data.length/2){const e=1<<Math.ceil(Math.log2(this.length)),t=new Float32Array(e);t.set(this.data.subarray(0,this.length),0),this.data=t}}reset(){this.clear(),this.data=new Float32Array(this.initialLength)}push(...e){this.ensureLength(this.length+e.length),this.data.set(e,this.length),this.length+=e.length}slice(e,t){return this.data.slice(e,Math.min(t,this.length))}subArray(e,t){return this.data.subarray(e,Math.min(t,this.length))}ensureLength(e){for(;this.data.length<e;){const e=new Float32Array(2*this.data.length);e.set(this.data,0),this.data=e}}}function dn(e,t){e.DataArray=pn}void 0!==p5&&dn(p5);class gn{constructor(e,t,i,r){this.renderer=r,this.vertices=[],this.boundingBoxCache=null,this.lineVertices=new pn,this.lineTangentsIn=new pn,this.lineTangentsOut=new pn,this.lineSides=new pn,this.vertexNormals=[],this.faces=[],this.uvs=[],this.edges=[],this.vertexColors=[],this.vertexStrokeColors=[],this.userVertexProperties={},this.lineVertexColors=new pn,this.detailX=void 0!==e?e:1,this.detailY=void 0!==t?t:1,this.dirtyFlags={},this._hasFillTransparency=void 0,this._hasStrokeTransparency=void 0,this.gid=`_p5_Geometry_${gn.nextId}`,gn.nextId++,i instanceof Function&&i.call(this)}calculateBoundingBox(){if(this.boundingBoxCache)return this.boundingBoxCache;let e=new je(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE),t=new je(Number.MIN_VALUE,Number.MIN_VALUE,Number.MIN_VALUE);for(let i=0;i<this.vertices.length;i++){let r=this.vertices[i];e.x=Math.min(e.x,r.x),e.y=Math.min(e.y,r.y),e.z=Math.min(e.z,r.z),t.x=Math.max(t.x,r.x),t.y=Math.max(t.y,r.y),t.z=Math.max(t.z,r.z)}let i=new je(t.x-e.x,t.y-e.y,t.z-e.z),r=new je((e.x+t.x)/2,(e.y+t.y)/2,(e.z+t.z)/2);return this.boundingBoxCache={min:e,max:t,size:i,offset:r},this.boundingBoxCache}reset(){this._hasFillTransparency=void 0,this._hasStrokeTransparency=void 0,this.lineVertices.clear(),this.lineTangentsIn.clear(),this.lineTangentsOut.clear(),this.lineSides.clear(),this.vertices.length=0,this.edges.length=0,this.vertexColors.length=0,this.vertexStrokeColors.length=0,this.lineVertexColors.clear(),this.vertexNormals.length=0,this.uvs.length=0;for(const e in this.userVertexProperties)this.userVertexProperties[e].delete();this.userVertexProperties={},this.dirtyFlags={}}hasFillTransparency(){if(void 0===this._hasFillTransparency){this._hasFillTransparency=!1;for(let e=0;e<this.vertexColors.length;e+=4)if(this.vertexColors[e+3]<1){this._hasFillTransparency=!0;break}}return this._hasFillTransparency}hasStrokeTransparency(){if(void 0===this._hasStrokeTransparency){this._hasStrokeTransparency=!1;for(let e=0;e<this.lineVertexColors.length;e+=4)if(this.lineVertexColors[e+3]<1){this._hasStrokeTransparency=!0;break}}return this._hasStrokeTransparency}clearColors(){return this.vertexColors=[],this}saveObj(e="model.obj"){let t="";if(this.vertices.forEach((e=>{t+=`v ${e.x} ${e.y} ${e.z}\n`})),this.uvs&&this.uvs.length>0)for(let e=0;e<this.uvs.length;e+=2)t+=`vt ${this.uvs[e]} ${this.uvs[e+1]}\n`;this.vertexNormals&&this.vertexNormals.length>0&&this.vertexNormals.forEach((e=>{t+=`vn ${e.x} ${e.y} ${e.z}\n`})),this.faces.forEach((e=>{let i="f";e.forEach((e=>{i+=" ",i+=e+1,(this.vertexNormals.length>0||this.uvs.length>0)&&(i+="/",this.uvs.length>0&&(i+=e+1),i+="/",this.vertexNormals.length>0&&(i+=e+1))})),t+=i+"\n"}));const i=new Blob([t],{type:"text/plain"});fn.downloadFile(i,e,"obj")}saveStl(e="model.stl",{binary:t=!1}={}){let i,r=e.substring(0,e.lastIndexOf(".")),s=[];for(let e of this.faces){const t=je.sub(this.vertices[e[1]],this.vertices[e[0]]),i=je.sub(this.vertices[e[2]],this.vertices[e[0]]),r=t.y*i.z-t.z*i.y,n=t.z*i.x-t.x*i.z,a=t.x*i.y-t.y*i.x;s.push(new je(r,n,a).normalize())}if(t){let e=80;const t=2*this.faces.length+3*this.faces.length*4*4+80+4,r=new ArrayBuffer(t);i=new DataView(r),i.setUint32(e,this.faces.length,!0),e+=4;for(const[t,r]of Object.entries(this.faces)){const n=s[t];i.setFloat32(e,n.x,!0),e+=4,i.setFloat32(e,n.y,!0),e+=4,i.setFloat32(e,n.z,!0),e+=4;for(let t of r){const r=this.vertices[t];i.setFloat32(e,r.x,!0),e+=4,i.setFloat32(e,r.y,!0),e+=4,i.setFloat32(e,r.z,!0),e+=4}i.setUint16(e,0,!0),e+=2}}else{i="solid "+r+"\n";for(const[e,t]of Object.entries(this.faces)){const r=s[e];i+=" facet norm "+r.x+" "+r.y+" "+r.z+"\n",i+=" outer loop\n";for(let e of t){const t=this.vertices[e];i+=" vertex "+t.x+" "+t.y+" "+t.z+"\n"}i+=" endloop\n",i+=" endfacet\n"}i+="endsolid "+r+"\n"}const n=new Blob([i],{type:"text/plain"});fn.downloadFile(n,e,"stl")}flipU(){this.uvs=this.uvs.flat().map(((e,t)=>t%2==0?1-e:e))}flipV(){this.uvs=this.uvs.flat().map(((e,t)=>t%2==0?e:1-e))}computeFaces(){this.faces.length=0;const e=this.detailX+1;let t,i,r,s;for(let n=0;n<this.detailY;n++)for(let a=0;a<this.detailX;a++)t=n*e+a,i=n*e+a+1,r=(n+1)*e+a+1,s=(n+1)*e+a,this.faces.push([t,i,s]),this.faces.push([s,i,r]);return this}_getFaceNormal(e){const t=this.faces[e],i=this.vertices[t[0]],r=this.vertices[t[1]],s=this.vertices[t[2]],n=je.sub(r,i),a=je.sub(s,i),o=je.cross(n,a),h=je.mag(o);let u=h/(je.mag(n)*je.mag(a));return 0===u||isNaN(u)?(console.warn("p5.Geometry.prototype._getFaceNormal:","face has colinear sides or a repeated vertex"),o):(u>1&&(u=1),o.mult(Math.asin(u)/h))}computeNormals(e=Ce,{roundToPrecision:t=3}={}){const i=this.vertexNormals;let r=this.vertices;const s=this.faces;let n;if(e===De){const e={},i=[],n=Math.pow(10,t),a=e=>Math.round(e*n)/n,o=e=>`${a(e.x)},${a(e.y)},${a(e.z)}`;for(let t=0;t<r.length;t++){const s=r[t],n=o(s);void 0===e[n]&&(e[n]=i.length,i.push(s))}s.forEach((t=>{for(let i=0;i<3;++i){const s=t[i],n=r[s],a=o(n);t[i]=e[a]}})),this.edges.forEach((t=>{for(let i=0;i<2;++i){const s=t[i],n=r[s],a=o(n);t[i]=e[a]}})),this.vertices=r=i}for(i.length=0,n=0;n<r.length;++n)i.push(new je);for(s.forEach(((e,t)=>{const r=this._getFaceNormal(t);for(let t=0;t<3;++t){const s=e[t];i[s].add(r)}})),n=0;n<r.length;++n)i[n].normalize();return this}averageNormals(){for(let e=0;e<=this.detailY;e++){const t=this.detailX+1;let i=je.add(this.vertexNormals[e*t],this.vertexNormals[e*t+this.detailX]);i=je.div(i,2),this.vertexNormals[e*t]=i,this.vertexNormals[e*t+this.detailX]=i}return this}averagePoleNormals(){let e=new je(0,0,0);for(let t=0;t<this.detailX;t++)e.add(this.vertexNormals[t]);e=je.div(e,this.detailX);for(let t=0;t<this.detailX;t++)this.vertexNormals[t]=e;e=new je(0,0,0);for(let t=this.vertices.length-1;t>this.vertices.length-1-this.detailX;t--)e.add(this.vertexNormals[t]);e=je.div(e,this.detailX);for(let t=this.vertices.length-1;t>this.vertices.length-1-this.detailX;t--)this.vertexNormals[t]=e;return this}_makeTriangleEdges(){this.edges.length=0;for(let e=0;e<this.faces.length;e++)this.edges.push([this.faces[e][0],this.faces[e][1]]),this.edges.push([this.faces[e][1],this.faces[e][2]]),this.edges.push([this.faces[e][2],this.faces[e][0]]);return this}makeEdgesFromFaces(){this._makeTriangleEdges()}_edgesToVertices(){this.lineVertices.clear(),this.lineTangentsIn.clear(),this.lineTangentsOut.clear(),this.lineSides.clear();const e=new Map,t=new Set;let i;for(let r=0;r<this.edges.length;r++){const s=this.edges[r-1],n=this.edges[r],a=this.vertices[n[0]],o=this.vertices[n[1]],h=this.vertexStrokeColors.length>0&&s?this.vertexStrokeColors.slice(4*s[1],4*(s[1]+1)):[0,0,0,0],u=this.vertexStrokeColors.length>0?this.vertexStrokeColors.slice(4*n[0],4*(n[0]+1)):[0,0,0,0],l=this.vertexStrokeColors.length>0?this.vertexStrokeColors.slice(4*n[1],4*(n[1]+1)):[0,0,0,0],c=o.copy().sub(a).normalize(),p=c.magSq()>0;if(p&&this._addSegment(a,o,u,l,c),!this.renderer?._simpleLines){if(r>0&&s[1]===n[0])t.has(n[0])||(t.add(n[0]),e.delete(n[0]),i&&p&&c.dot(i)<1-1e-8&&this._addJoin(a,i,c,u));else{if(p&&!t.has(n[0])){const i=e.get(n[0]);i?(this._addJoin(a,i.dir,c,u),e.delete(n[0]),t.add(n[0])):e.set(n[0],{point:a,dir:c.copy().mult(-1),color:u})}if(i&&!t.has(s[1])){const r=e.get(s[1]);r?(this._addJoin(this.vertices[s[1]],i,r.dir.copy().mult(-1),h),e.delete(s[1]),t.add(s[1])):e.set(s[1],{point:this.vertices[s[1]],dir:i,color:h}),i=void 0}}if(r===this.edges.length-1&&!t.has(n[1])){const i=e.get(n[1]);i?(this._addJoin(o,c,i.dir.copy().mult(-1),l),e.delete(n[1]),t.add(n[1])):e.set(n[1],{point:o,dir:c,color:l})}p&&(i=c)}}for(const{point:t,dir:i,color:r}of e.values())this._addCap(t,i,r);return this}_addSegment(e,t,i,r,s){const n=e.array(),a=t.array(),o=s.array();this.lineSides.push(1,1,-1,1,-1,-1);for(const e of[this.lineTangentsIn,this.lineTangentsOut])for(let t=0;t<6;t++)e.push(...o);return this.lineVertices.push(...n,...a,...n,...a,...a,...n),this.renderer?._simpleLines||this.lineVertexColors.push(...i,...r,...i,...r,...r,...i),this}_addCap(e,t,i){const r=e.array(),s=t.array(),n=[0,0,0];for(let e=0;e<6;e++)this.lineVertices.push(...r),this.lineTangentsIn.push(...s),this.lineTangentsOut.push(...n),this.lineVertexColors.push(...i);return this.lineSides.push(-1,2,-2,1,2,-1),this}_addJoin(e,t,i,r){const s=e.array(),n=t.array(),a=i.array();for(let e=0;e<12;e++)this.lineVertices.push(...s),this.lineTangentsIn.push(...n),this.lineTangentsOut.push(...a),this.lineVertexColors.push(...r);return this.lineSides.push(-1,-3,-2,-1,0,-3),this.lineSides.push(3,1,2,3,0,1),this}normalize(){if(this.vertices.length>0){const e=this.vertices[0].copy(),t=this.vertices[0].copy();for(let i=0;i<this.vertices.length;i++)e.x=Math.max(e.x,this.vertices[i].x),t.x=Math.min(t.x,this.vertices[i].x),e.y=Math.max(e.y,this.vertices[i].y),t.y=Math.min(t.y,this.vertices[i].y),e.z=Math.max(e.z,this.vertices[i].z),t.z=Math.min(t.z,this.vertices[i].z);const i=je.lerp(e,t,.5),r=je.sub(e,t),s=200/Math.max(Math.max(r.x,r.y),r.z);for(let e=0;e<this.vertices.length;e++)this.vertices[e].sub(i),this.vertices[e].mult(s)}return this}vertexProperty(e,t,i){let r;this.userVertexProperties[e]||(r=this.userVertexProperties[e]=this._userVertexPropertyHelper(e,t,i)),r=this.userVertexProperties[e],i?r.pushDirect(t):(r.setCurrentData(t),r.pushCurrentData())}_userVertexPropertyHelper(e,t,i){const r=this.userVertexProperties[e]={name:e,dataSize:i||(t.length?t.length:1),geometry:this,getName(){return this.name},getCurrentData(){return void 0===this.currentData&&(this.currentData=new Array(this.getDataSize()).fill(0)),this.currentData},getDataSize(){return this.dataSize},getSrcName(){return this.name.concat("Src")},getDstName(){return this.name.concat("Buffer")},getSrcArray(){const e=this.getSrcName();return this.geometry[e]},setCurrentData(e){this.currentData=e},pushCurrentData(){const e=this.getCurrentData();this.pushDirect(e)},pushDirect(e){e.length?this.getSrcArray().push(...e):this.getSrcArray().push(e)},resetSrcArray(){this.geometry[this.getSrcName()]=[]},delete(){const e=this.getSrcName();delete this.geometry[e]}};return this[r.getSrcName()]=[],this.userVertexProperties[e]}}function mn(e,t){e.Geometry=gn}gn.nextId=0,void 0!==p5&&mn(p5);class yn{constructor(e){this.renderer=e,e._pInst.push(),this.identityMatrix=new ln(4),e.states.setValue("uModelMatrix",new ln(4)),this.geometry=new gn(void 0,void 0,void 0,this.renderer),this.geometry.gid=`_p5_GeometryBuilder_${yn.nextGeometryId}`,yn.nextGeometryId++,this.hasTransform=!1}transformVertices(e){return this.hasTransform?e.map((e=>this.renderer.states.uModelMatrix.multiplyPoint(e))):e}transformNormals(e){return this.hasTransform?e.map((e=>this.renderer.scratchMat3.multiplyVec(e))):e}addGeometry(e){this.hasTransform=!this.renderer.states.uModelMatrix.mat4.every(((e,t)=>e===this.identityMatrix.mat4[t])),this.hasTransform&&this.renderer.scratchMat3.inverseTranspose4x4(this.renderer.states.uModelMatrix);let t=this.geometry.vertices.length;this.geometry.vertices.push(...this.transformVertices(e.vertices)),this.geometry.vertexNormals.push(...this.transformNormals(e.vertexNormals)),this.geometry.uvs.push(...e.uvs);const i=e.userVertexProperties,r=this.geometry.userVertexProperties,s=this.geometry.vertices.length-e.vertices.length;for(const t in r){if(t in i)continue;const s=r[t],n=s.getDataSize()*e.vertices.length,a=Array(n).fill(0);s.pushDirect(a)}for(const e in i){const t=i[e],n=t.getSrcArray(),a=t.getDataSize();if(s>0&&!(e in r)){const t=Array(a*s).fill(0);this.geometry.vertexProperty(e,t,a)}this.geometry.vertexProperty(e,n,a)}this.renderer.states.fillColor&&this.geometry.faces.push(...e.faces.map((e=>e.map((e=>e+t))))),this.renderer.states.strokeColor&&this.geometry.edges.push(...e.edges.map((e=>e.map((e=>e+t)))));const n=[...e.vertexColors];for(;n.length<4*e.vertices.length;)n.push(...this.renderer.states.curFillColor);this.geometry.vertexColors.push(...n)}addImmediate(e,t){const i=[];if(this.renderer.states.fillColor)if(5===t||t===I)for(let t=2;t<e.vertices.length;t++)t%2==0?i.push([t,t-1,t-2]):i.push([t,t-2,t-1]);else if(6===t)for(let t=2;t<e.vertices.length;t++)i.push([0,t-1,t]);else for(let t=0;t<e.vertices.length;t+=3)i.push([t,t+1,t+2]);this.addGeometry(Object.assign({},e,{faces:i}))}addRetained(e){this.addGeometry(e)}finish(){return this.renderer._pInst.pop(),this.geometry}}yn.nextGeometryId=0;class xn{constructor(e,t,i,r){this.w=e,this.vec=new je(t,i,r)}static fromAxisAngle(e,t,i,r){const s=Math.cos(e/2),n=new je(t,i,r).normalize().mult(Math.sin(e/2));return new xn(s,n.x,n.y,n.z)}conjugate(){return new xn(this.w,-this.vec.x,-this.vec.y,-this.vec.z)}multiply(e){return new xn(this.w*e.w-this.vec.x*e.vec.x-this.vec.y*e.vec.y-this.vec.z-e.vec.z,this.w*e.vec.x+this.vec.x*e.w+this.vec.y*e.vec.z-this.vec.z*e.vec.y,this.w*e.vec.y-this.vec.x*e.vec.z+this.vec.y*e.w+this.vec.z*e.vec.x,this.w*e.vec.z+this.vec.x*e.vec.y-this.vec.y*e.vec.x+this.vec.z*e.w)}rotateVector(e){return je.mult(e,this.w*this.w-this.vec.dot(this.vec)).add(je.mult(this.vec,2*e.dot(this.vec))).add(je.mult(this.vec,2*this.w).cross(e)).clampToZero()}rotateBy(e){return e.multiply(this).multiply(e.conjugate()).vec.clampToZero()}}function vn(e,t){e.Quat=xn}void 0!==p5&&vn(p5);class bn{constructor(e){this._renderer=e,this.cameraType="default",this.useLinePerspective=!0,this.cameraMatrix=new ln(4),this.projMatrix=new ln(4),this.yScale=1}perspective(e,t,i,r){this.cameraType=arguments.length>0?"custom":"default",void 0===e?(e=this.defaultCameraFOV,this.cameraFOV=e):this.cameraFOV=this._renderer._pInst._toRadians(e),void 0===t&&(t=this.defaultAspectRatio),void 0===i&&(i=this.defaultCameraNear),void 0===r&&(r=this.defaultCameraFar),i<=1e-4&&(i=.01,console.log("Avoid perspective near plane values close to or below 0. Setting value to 0.01.")),r<i&&console.log("Perspective far plane value is less than near plane value. Nothing will be shown."),this.aspectRatio=t,this.cameraNear=i,this.cameraFar=r,this.projMatrix=new ln(4);const s=1/Math.tan(this.cameraFOV/2),n=1/(this.cameraNear-this.cameraFar);this.projMatrix.set(s/t,0,0,0,0,-s*this.yScale,0,0,0,0,(r+i)*n,-1,0,0,2*r*i*n,0),this._isActive()&&(this._renderer.states.setValue("uPMatrix",this._renderer.states.uPMatrix.clone()),this._renderer.states.uPMatrix.set(this.projMatrix))}ortho(e,t,i,r,s,n){const a=this.fbo||this._renderer;void 0===e&&(e=-a.width/2),void 0===t&&(t=+a.width/2),void 0===i&&(i=-a.height/2),void 0===r&&(r=+a.height/2),void 0===s&&(s=0),void 0===n&&(n=Math.max(a.width,a.height)+800),this.cameraNear=s,this.cameraFar=n;const o=t-e,h=r-i,u=n-s,l=2/o,c=2/h*this.yScale,p=-2/u,d=-(t+e)/o,f=-(r+i)/h,g=-(n+s)/u;this.projMatrix=new ln(4),this.projMatrix.set(l,0,0,0,0,-c,0,0,0,0,p,0,d,f,g,1),this._isActive()&&(this._renderer.states.setValue("uPMatrix",this._renderer.states.uPMatrix.clone()),this._renderer.states.uPMatrix.set(this.projMatrix)),this.cameraType="custom"}frustum(e,t,i,r,s,n){void 0===e&&(e=.05*-this._renderer.width),void 0===t&&(t=.05*+this._renderer.width),void 0===i&&(i=.05*+this._renderer.height),void 0===r&&(r=.05*-this._renderer.height),void 0===s&&(s=this.defaultCameraNear),void 0===n&&(n=this.defaultCameraFar),this.cameraNear=s,this.cameraFar=n;const a=t-e,o=r-i,h=n-s,u=2*s/a,l=2*s/o*this.yScale,c=-2*n*s/h,p=(t+e)/a,d=(r+i)/o,f=-(n+s)/h;this.projMatrix=new ln(4),this.projMatrix.set(u,0,0,0,0,-l,0,0,p,d,f,-1,0,0,c,0),this._isActive()&&(this._renderer.states.setValue("uPMatrix",this._renderer.states.uPMatrix.clone()),this._renderer.states.uPMatrix.set(this.projMatrix)),this.cameraType="custom"}_rotateView(e,t,i,r){let s=this.centerX,n=this.centerY,a=this.centerZ;s-=this.eyeX,n-=this.eyeY,a-=this.eyeZ;const o=new ln(4);o.rotate4x4(this._renderer._pInst._toRadians(e),t,i,r);const h=[s*o.mat4[0]+n*o.mat4[4]+a*o.mat4[8],s*o.mat4[1]+n*o.mat4[5]+a*o.mat4[9],s*o.mat4[2]+n*o.mat4[6]+a*o.mat4[10]];h[0]+=this.eyeX,h[1]+=this.eyeY,h[2]+=this.eyeZ,this.camera(this.eyeX,this.eyeY,this.eyeZ,h[0],h[1],h[2],this.upX,this.upY,this.upZ)}roll(e){const t=this._getLocalAxes(),i=xn.fromAxisAngle(this._renderer._pInst._toRadians(e),t.z[0],t.z[1],t.z[2]).rotateVector(new je(this.upX,this.upY,this.upZ));this.camera(this.eyeX,this.eyeY,this.eyeZ,this.centerX,this.centerY,this.centerZ,i.x,i.y,i.z)}pan(e){const t=this._getLocalAxes();this._rotateView(e,t.y[0],t.y[1],t.y[2])}tilt(e){const t=this._getLocalAxes();this._rotateView(e,t.x[0],t.x[1],t.x[2])}lookAt(e,t,i){this.camera(this.eyeX,this.eyeY,this.eyeZ,e,t,i,this.upX,this.upY,this.upZ)}camera(e,t,i,r,s,n,a,o,h){void 0===e&&(e=this.defaultEyeX,t=this.defaultEyeY,i=this.defaultEyeZ,r=e,s=t,n=0,a=0,o=1,h=0),this.eyeX=e,this.eyeY=t,this.eyeZ=i,void 0!==r&&(this.centerX=r,this.centerY=s,this.centerZ=n),void 0!==a&&(this.upX=a,this.upY=o,this.upZ=h);const u=this._getLocalAxes();this.cameraMatrix.set(u.x[0],u.y[0],u.z[0],0,u.x[1],u.y[1],u.z[1],0,u.x[2],u.y[2],u.z[2],0,0,0,0,1);const l=-e,c=-t,p=-i;return this.cameraMatrix.translate([l,c,p]),this._isActive()&&(this._renderer.states.setValue("uViewMatrix",this._renderer.states.uViewMatrix.clone()),this._renderer.states.uViewMatrix.set(this.cameraMatrix)),this}move(e,t,i){const r=this._getLocalAxes(),s=[r.x[0]*e,r.x[1]*e,r.x[2]*e],n=[r.y[0]*t,r.y[1]*t,r.y[2]*t],a=[r.z[0]*i,r.z[1]*i,r.z[2]*i];this.camera(this.eyeX+s[0]+n[0]+a[0],this.eyeY+s[1]+n[1]+a[1],this.eyeZ+s[2]+n[2]+a[2],this.centerX+s[0]+n[0]+a[0],this.centerY+s[1]+n[1]+a[1],this.centerZ+s[2]+n[2]+a[2],this.upX,this.upY,this.upZ)}setPosition(e,t,i){const r=e-this.eyeX,s=t-this.eyeY,n=i-this.eyeZ;this.camera(e,t,i,this.centerX+r,this.centerY+s,this.centerZ+n,this.upX,this.upY,this.upZ)}set(e){const t=["eyeX","eyeY","eyeZ","centerX","centerY","centerZ","upX","upY","upZ","cameraFOV","aspectRatio","cameraNear","cameraFar","cameraType","yScale","useLinePerspective"];for(const i of t)this[i]=e[i];this.cameraMatrix=e.cameraMatrix.copy(),this.projMatrix=e.projMatrix.copy(),this._isActive()&&(this._renderer.states.setValue("uModelMatrix",this._renderer.states.uModelMatrix.clone()),this._renderer.states.setValue("uViewMatrix",this._renderer.states.uViewMatrix.clone()),this._renderer.states.setValue("uPMatrix",this._renderer.states.uPMatrix.clone()),this._renderer.states.uModelMatrix.reset(),this._renderer.states.uViewMatrix.set(this.cameraMatrix),this._renderer.states.uPMatrix.set(this.projMatrix))}slerp(e,t,i){if(0===i)return void this.set(e);if(1===i)return void this.set(t);0!==this.projMatrix.mat4[15]&&(this.projMatrix.setElement(0,e.projMatrix.mat4[0]*Math.pow(t.projMatrix.mat4[0]/e.projMatrix.mat4[0],i)),this.projMatrix.setElement(5,e.projMatrix.mat4[5]*Math.pow(t.projMatrix.mat4[5]/e.projMatrix.mat4[5],i)),this._isActive()&&(this._renderer.states.setValue("uPMatrix",this._renderer.states.uPMatrix.clone()),this._renderer.states.uPMatrix.mat4=this.projMatrix.mat4.slice()));const r=new je(e.eyeX,e.eyeY,e.eyeZ),s=new je(t.eyeX,t.eyeY,t.eyeZ),n=new je(e.centerX,e.centerY,e.centerZ),a=new je(t.centerX,t.centerY,t.centerZ),o=je.dist(r,n),h=je.dist(s,a),u=o*Math.pow(h/o,i),l=je.sub(r,s),c=r.copy().sub(s).sub(n).add(a),p=c.magSq();let d=1;p>1e-6&&(d=je.dot(l,c)/p,d=Math.max(0,Math.min(d,1)));const f=je.lerp(je.lerp(r,n,d),je.lerp(s,a,d),i),g=e.cameraMatrix.createSubMatrix3x3(),m=t.cameraMatrix.createSubMatrix3x3(),y=g.row(2),x=m.row(2),v=g.row(1),b=m.row(1),_=new je,w=new je,C=new je,D=new je,E=m.mult(g.copy().transpose()),A=E.diagonal();let S,F,T,M,k=.5*(A[0]+A[1]+A[2]-1);if(1-k<1e-7)return _.set(je.lerp(y,x,i)).normalize(),C.set(_).mult(d*u).add(f),D.set(_).mult((d-1)*u).add(f),w.set(je.lerp(v,b,i)).normalize(),void this.camera(C.x,C.y,C.z,D.x,D.y,D.z,w.x,w.y,w.z);let I=1/(1-k);const B=Math.max(A[0],A[1],A[2]),L=E.mat3[1]+E.mat3[3],P=E.mat3[2]+E.mat3[6],O=E.mat3[5]+E.mat3[7];B===A[0]?(S=Math.sqrt((A[0]-k)*I),I/=S,F=.5*L*I,T=.5*P*I,M=.5*(E.mat3[7]-E.mat3[5])/S):B===A[1]?(F=Math.sqrt((A[1]-k)*I),I/=F,T=.5*O*I,S=.5*L*I,M=.5*(E.mat3[2]-E.mat3[6])/F):(T=Math.sqrt((A[2]-k)*I),I/=T,S=.5*P*I,F=.5*O*I,M=.5*(E.mat3[3]-E.mat3[1])/T);const N=i*Math.atan2(M,k),R=Math.cos(N),V=Math.sin(N),U=1-R,G=S*F,z=F*T,j=T*S,$=new ln([R+U*S*S,U*G+V*T,U*j-V*F,U*G-V*T,R+U*F*F,U*z+V*S,U*j+V*F,U*z-V*S,R+U*T*T]);$.multiplyVec(y,_),C.set(_).mult(d*u).add(f),D.set(_).mult((d-1)*u).add(f),$.multiplyVec(v,w),this.camera(C.x,C.y,C.z,D.x,D.y,D.z,w.x,w.y,w.z)}_computeCameraDefaultSettings(){this.defaultAspectRatio=this._renderer.width/this._renderer.height,this.defaultEyeX=0,this.defaultEyeY=0,this.defaultEyeZ=800,this.defaultCameraFOV=2*Math.atan(this._renderer.height/2/this.defaultEyeZ),this.defaultCenterX=0,this.defaultCenterY=0,this.defaultCenterZ=0,this.defaultCameraNear=.1*this.defaultEyeZ,this.defaultCameraFar=10*this.defaultEyeZ}_setDefaultCamera(){this.cameraFOV=this.defaultCameraFOV,this.aspectRatio=this.defaultAspectRatio,this.eyeX=this.defaultEyeX,this.eyeY=this.defaultEyeY,this.eyeZ=this.defaultEyeZ,this.centerX=this.defaultCenterX,this.centerY=this.defaultCenterY,this.centerZ=this.defaultCenterZ,this.upX=0,this.upY=1,this.upZ=0,this.cameraNear=this.defaultCameraNear,this.cameraFar=this.defaultCameraFar,this.perspective(),this.camera(),this.cameraType="default"}_resize(){"default"===this.cameraType&&(this._computeCameraDefaultSettings(),this.cameraFOV=this.defaultCameraFOV,this.aspectRatio=this.defaultAspectRatio,this.perspective())}copy(){const e=new bn(this._renderer);return e.cameraFOV=this.cameraFOV,e.aspectRatio=this.aspectRatio,e.eyeX=this.eyeX,e.eyeY=this.eyeY,e.eyeZ=this.eyeZ,e.centerX=this.centerX,e.centerY=this.centerY,e.centerZ=this.centerZ,e.upX=this.upX,e.upY=this.upY,e.upZ=this.upZ,e.cameraNear=this.cameraNear,e.cameraFar=this.cameraFar,e.cameraType=this.cameraType,e.useLinePerspective=this.useLinePerspective,e.cameraMatrix=this.cameraMatrix.copy(),e.projMatrix=this.projMatrix.copy(),e.yScale=this.yScale,e}clone(){return this.copy()}_getLocalAxes(){let e=this.eyeX-this.centerX,t=this.eyeY-this.centerY,i=this.eyeZ-this.centerZ;const r=Math.sqrt(e*e+t*t+i*i);0!==r&&(e/=r,t/=r,i/=r);let s=this.upX,n=this.upY,a=this.upZ,o=n*i-a*t,h=-s*i+a*e,u=s*t-n*e;s=t*u-i*h,n=-e*u+i*o,a=e*h-t*o;const l=Math.sqrt(o*o+h*h+u*u);0!==l&&(o/=l,h/=l,u/=l);const c=Math.sqrt(s*s+n*n+a*a);return 0!==c&&(s/=c,n/=c,a/=c),{x:[o,h,u],y:[s,n,a],z:[e,t,i]}}_orbit(e,t,i){const r=this.eyeX-this.centerX,s=this.eyeY-this.centerY,n=this.eyeZ-this.centerZ;let a=Math.hypot(r,s,n);const o=new je(r,s,n).normalize(),h=new je(this.upX,this.upY,this.upZ).normalize(),u=je.cross(h,o).normalize(),l=je.cross(u,h);a*=Math.pow(10,i),a<this.cameraNear&&(a=this.cameraNear),a>this.cameraFar&&(a=this.cameraFar);const c=Math.acos(Math.max(-1,Math.min(1,je.dot(o,h))))+t,p=e;(c<=0||c>=Math.PI)&&(this.upX*=-1,this.upY*=-1,this.upZ*=-1),h.mult(Math.cos(c)),l.mult(Math.cos(p)*Math.sin(c)),u.mult(Math.sin(p)*Math.sin(c)),o.set(h).add(l).add(u),this.eyeX=a*o.x+this.centerX,this.eyeY=a*o.y+this.centerY,this.eyeZ=a*o.z+this.centerZ,this.camera(this.eyeX,this.eyeY,this.eyeZ,this.centerX,this.centerY,this.centerZ,this.upX,this.upY,this.upZ)}_orbitFree(e,t,i){const r=this.eyeX-this.centerX,s=this.eyeY-this.centerY,n=this.eyeZ-this.centerZ;let a=Math.hypot(r,s,n);const o=new je(r,s,n).normalize(),h=new je(this.upX,this.upY,this.upZ),u=je.cross(h,o).normalize(),l=je.cross(o,u),c=Math.atan2(t,e);l.mult(Math.sin(c)),u.mult(Math.cos(c)).add(l);const p=Math.sqrt(e*e+t*t),d=je.cross(o,u);a*=Math.pow(10,i),a<this.cameraNear&&(a=this.cameraNear),a>this.cameraFar&&(a=this.cameraFar);const f=Math.cos(p),g=Math.sin(p),m=h.dot(o),y=h.dot(u),x=m*f+y*g,v=-m*g+y*f,b=h.dot(d);h.x=x*o.x+v*u.x+b*d.x,h.y=x*o.y+v*u.y+b*d.y,h.z=x*o.z+v*u.z+b*d.z,u.mult(-g),o.mult(f).add(u).mult(a),this.camera(o.x+this.centerX,o.y+this.centerY,o.z+this.centerZ,this.centerX,this.centerY,this.centerZ,h.x,h.y,h.z)}_isActive(){return this===this._renderer.states.curCamera}}function _n(e,t){t.camera=function(...e){return this._assert3d("camera"),this._renderer.camera(...e),this},t.perspective=function(...e){return this._assert3d("perspective"),this._renderer.perspective(...e),this},t.linePerspective=function(e){if(!(this._renderer instanceof ea))throw new Error("linePerspective() must be called in WebGL mode.");return this._renderer.linePerspective(e)},t.ortho=function(...e){return this._assert3d("ortho"),this._renderer.ortho(...e),this},t.frustum=function(...e){return this._assert3d("frustum"),this._renderer.frustum(...e),this},t.createCamera=function(){return this._assert3d("createCamera"),this._renderer.createCamera()},t.setCamera=function(e){this._renderer.setCamera(e)},e.Camera=bn,ea.prototype.camera=function(...e){this.states.curCamera.camera(...e)},ea.prototype.perspective=function(...e){this.states.curCamera.perspective(...e)},ea.prototype.linePerspective=function(e){if(void 0===e)return this.states.curCamera.useLinePerspective;this.states.curCamera.useLinePerspective=e},ea.prototype.ortho=function(...e){this.states.curCamera.ortho(...e)},ea.prototype.frustum=function(...e){this.states.curCamera.frustum(...e)},ea.prototype.createCamera=function(){const e=new bn(this);return e._computeCameraDefaultSettings(),e._setDefaultCamera(),e},ea.prototype.setCamera=function(e){this.states.setValue("curCamera",e),this.states.setValue("uPMatrix",this.states.uPMatrix.clone()),this.states.uPMatrix.set(e.projMatrix),this.states.setValue("uViewMatrix",this.states.uViewMatrix.clone()),this.states.uViewMatrix.set(e.cameraMatrix)}}void 0!==p5&&_n(p5,p5.prototype);class wn{constructor(e,t,i,r,s,n){this.size=e,this.src=t,this.dst=i,this.attr=r,this._renderer=s,this.map=n}_prepareBuffer(e,t){const i=t.attributes,r=this._renderer.GL,s=this._renderer._getOrMakeCachedBuffers(e),n=i[this.attr];if(!n)return;let a=s[this.dst];const o=e[this.src];if(o&&o.length>0){const i=!a;if(i&&(s[this.dst]=a=r.createBuffer()),r.bindBuffer(r.ARRAY_BUFFER,a),i||!1!==e.dirtyFlags[this.src]){const t=this.map,i=t?t(o):o;this._renderer._bindBuffer(a,r.ARRAY_BUFFER,i),e.dirtyFlags[this.src]=!1}t.enableAttrib(n,this.size)}else{const e=n.location;if(-1===e||!this._renderer.registerEnabled.has(e))return;r.disableVertexAttribArray(e),this._renderer.registerEnabled.delete(e)}}}function Cn(e,t){e.RenderBuffer=wn}void 0!==p5&&Cn(p5);class Dn{constructor(e,t,i,r={}){this._renderer=e,this._vertSrc=t,this._fragSrc=i,this._vertShader=-1,this._fragShader=-1,this._glProgram=0,this._loadedAttributes=!1,this.attributes={},this._loadedUniforms=!1,this.uniforms={},this._bound=!1,this.samplers=[],this.hooks={uniforms:r.uniforms||{},declarations:r.declarations,helpers:r.helpers||{},vertex:r.vertex||{},fragment:r.fragment||{},modified:{vertex:r.modified&&r.modified.vertex||{},fragment:r.modified&&r.modified.fragment||{}}}}hookTypes(e){let t=this._vertSrc,i=this.hooks.vertex[e];if(i||(i=this.hooks.fragment[e],t=this._fragSrc),!i)throw new Error(`Can't find hook ${e}!`);const r=e.split(/\s+/g),s=r.pop(),n=r.pop(),a=[...r],o=/\(([^\)]*)\)/.exec(i);if(!o)throw new Error(`Couldn't find function parameters in hook body:\n${i}`);const h=e=>{const i=new RegExp(`struct\\s+${e}\\s*{([^}]*)}`).exec(t);if(!i)return;const r=[];for(const e of i[1].split(";")){const t=e.trim().split(/\s+|,/g),i=t.shift(),s=[...t],n=h(i);for(const e of s)r.push({name:e,type:{typeName:i,qualifiers:[],properties:n}})}return r},u=o[1].split(",").map((e=>{const t=e.trim().split(/\s+/g),i=t.pop(),r=t.pop();return{name:i,type:{typeName:r,qualifiers:[...t],properties:h(r)}}}));return{name:s,returnType:{typeName:n,qualifiers:a,properties:h(n)},parameters:u}}shaderSrc(e,t){const i="void main";let[r,s]=e.split(i),n="",a="";for(const e in this.hooks.uniforms)n+=`uniform ${e};\n`;this.hooks.declarations&&(n+=this.hooks.declarations+"\n"),this.hooks[t].declarations&&(n+=this.hooks[t].declarations+"\n");for(const e in this.hooks.helpers)n+=`${e}${this.hooks.helpers[e]}\n`;for(const e in this.hooks[t]){if("declarations"===e)continue;const[i,r]=e.split(" ");this.hooks.modified[t][e]&&(a+="#define AUGMENTED_HOOK_"+r+"\n"),n+=i+" HOOK_"+r+this.hooks[t][e]+"\n"}return-1!==r.indexOf("#define HOOK_DEFINES")&&(r=r.replace("#define HOOK_DEFINES","\n"+a+"\n"),a=""),r+"\n"+a+n+i+s}version(){const e=/#version (.+)$/.exec(this.vertSrc());return e?e[1]:"100 es"}vertSrc(){return this.shaderSrc(this._vertSrc,"vertex")}fragSrc(){return this.shaderSrc(this._fragSrc,"fragment")}inspectHooks(){console.log("==== Vertex shader hooks: ====");for(const e in this.hooks.vertex)console.log((this.hooks.modified.vertex[e]?"[MODIFIED] ":"")+e+this.hooks.vertex[e]);console.log(""),console.log("==== Fragment shader hooks: ====");for(const e in this.hooks.fragment)console.log((this.hooks.modified.fragment[e]?"[MODIFIED] ":"")+e+this.hooks.fragment[e]);console.log(""),console.log("==== Helper functions: ====");for(const e in this.hooks.helpers)console.log(e+this.hooks.helpers[e])}modify(e){const t={vertex:{},fragment:{},helpers:{}};for(const i in e)"declarations"!==i&&"uniforms"!==i&&("vertexDeclarations"===i?t.vertex.declarations=(t.vertex.declarations||"")+"\n"+e[i]:"fragmentDeclarations"===i?t.fragment.declarations=(t.fragment.declarations||"")+"\n"+e[i]:this.hooks.vertex[i]?t.vertex[i]=e[i]:this.hooks.fragment[i]?t.fragment[i]=e[i]:t.helpers[i]=e[i]);const i=Object.assign({},this.hooks.modified.vertex),r=Object.assign({},this.hooks.modified.fragment);for(const e in t.vertex||{})"declarations"!==e&&(i[e]=!0);for(const e in t.fragment||{})"declarations"!==e&&(r[e]=!0);return new Dn(this._renderer,this._vertSrc,this._fragSrc,{declarations:(this.hooks.declarations||"")+"\n"+(e.declarations||""),uniforms:Object.assign({},this.hooks.uniforms,e.uniforms||{}),fragment:Object.assign({},this.hooks.fragment,t.fragment||{}),vertex:Object.assign({},this.hooks.vertex,t.vertex||{}),helpers:Object.assign({},this.hooks.helpers,t.helpers||{}),modified:{vertex:i,fragment:r}})}init(){if(0===this._glProgram){const e=this._renderer.GL;if(this._vertShader=e.createShader(e.VERTEX_SHADER),e.shaderSource(this._vertShader,this.vertSrc()),e.compileShader(this._vertShader),!e.getShaderParameter(this._vertShader,e.COMPILE_STATUS)){const t=e.getShaderInfoLog(this._vertShader);return console.error(t),null}if(this._fragShader=e.createShader(e.FRAGMENT_SHADER),e.shaderSource(this._fragShader,this.fragSrc()),e.compileShader(this._fragShader),!e.getShaderParameter(this._fragShader,e.COMPILE_STATUS)){const t=e.getShaderInfoLog(this._fragShader);return console.error(t),null}this._glProgram=e.createProgram(),e.attachShader(this._glProgram,this._vertShader),e.attachShader(this._glProgram,this._fragShader),e.linkProgram(this._glProgram),e.getProgramParameter(this._glProgram,e.LINK_STATUS)||p5._friendlyError(`Snap! Error linking shader program: ${e.getProgramInfoLog(this._glProgram)}`),this._loadAttributes(),this._loadUniforms()}return this}setDefaultUniforms(){for(const e in this.hooks.uniforms){const[,t]=e.split(" "),i=this.hooks.uniforms[e];let r;r=i instanceof Function?i():i,null!=r&&this.setUniform(t,r)}}copyToContext(e){const t=new Dn(e._renderer,this._vertSrc,this._fragSrc);return t.ensureCompiledOnContext(e._renderer),t}ensureCompiledOnContext(e){if(0!==this._glProgram&&this._renderer!==e)throw new Error("The shader being run is attached to a different context. Do you need to copy it to this context first with .copyToContext()?");0===this._glProgram&&(this._renderer=e?._renderer?.filterRenderer?._renderer||e,this.init())}_loadAttributes(){if(this._loadedAttributes)return;this.attributes={};const e=this._renderer.GL,t=e.getProgramParameter(this._glProgram,e.ACTIVE_ATTRIBUTES);for(let i=0;i<t;++i){const t=e.getActiveAttrib(this._glProgram,i),r=t.name,s=e.getAttribLocation(this._glProgram,r),n={};n.name=r,n.location=s,n.index=i,n.type=t.type,n.size=t.size,this.attributes[r]=n}this._loadedAttributes=!0}_loadUniforms(){if(this._loadedUniforms)return;const e=this._renderer.GL,t=e.getProgramParameter(this._glProgram,e.ACTIVE_UNIFORMS);let i=0;for(let r=0;r<t;++r){const t=e.getActiveUniform(this._glProgram,r),s={};s.location=e.getUniformLocation(this._glProgram,t.name),s.size=t.size;let n=t.name;t.size>1&&(n=n.substring(0,n.indexOf("[0]"))),s.name=n,s.type=t.type,s._cachedData=void 0,s.type===e.SAMPLER_2D&&(s.samplerIndex=i,i++,this.samplers.push(s)),s.isArray=t.size>1||s.type===e.FLOAT_MAT3||s.type===e.FLOAT_MAT4||s.type===e.FLOAT_VEC2||s.type===e.FLOAT_VEC3||s.type===e.FLOAT_VEC4||s.type===e.INT_VEC2||s.type===e.INT_VEC4||s.type===e.INT_VEC3,this.uniforms[n]=s}this._loadedUniforms=!0}compile(){}bindShader(){this.init(),this._bound||(this.useProgram(),this._bound=!0)}unbindShader(){return this._bound&&(this.unbindTextures(),this._bound=!1),this}bindTextures(){const e=this._renderer.GL,t=this._renderer._getEmptyTexture();for(const i of this.samplers){let r=i.texture;void 0===r&&(i.texture=r=t),e.activeTexture(e.TEXTURE0+i.samplerIndex),r.bindTexture(),r.update(),e.uniform1i(i.location,i.samplerIndex)}}updateTextures(){for(const e of this.samplers){const t=e.texture;t&&t.update()}}unbindTextures(){const e=this._renderer.GL,t=this._renderer._getEmptyTexture();for(const i of this.samplers)i.texture?.isFramebufferTexture&&(e.activeTexture(e.TEXTURE0+i.samplerIndex),t.bindTexture(),e.uniform1i(i.location,i.samplerIndex))}useProgram(){const e=this._renderer.GL;return this._renderer._curShader!==this&&(e.useProgram(this._glProgram),this._renderer._curShader=this),this}setUniform(e,t){this.init();const i=this.uniforms[e];if(!i)return;const r=this._renderer.GL;if(i.isArray){if(i._cachedData&&this._renderer._arraysEqual(i._cachedData,t))return;i._cachedData=t.slice(0)}else{if(i._cachedData&&i._cachedData===t)return;Array.isArray(t)?i._cachedData=t.slice(0):i._cachedData=t}const s=i.location;switch(this.useProgram(),i.type){case r.BOOL:!0===t?r.uniform1i(s,1):r.uniform1i(s,0);break;case r.INT:i.size>1?t.length&&r.uniform1iv(s,t):r.uniform1i(s,t);break;case r.FLOAT:i.size>1?t.length&&r.uniform1fv(s,t):r.uniform1f(s,t);break;case r.FLOAT_MAT3:r.uniformMatrix3fv(s,!1,t);break;case r.FLOAT_MAT4:r.uniformMatrix4fv(s,!1,t);break;case r.FLOAT_VEC2:i.size>1?t.length&&r.uniform2fv(s,t):r.uniform2f(s,t[0],t[1]);break;case r.FLOAT_VEC3:i.size>1?t.length&&r.uniform3fv(s,t):r.uniform3f(s,t[0],t[1],t[2]);break;case r.FLOAT_VEC4:i.size>1?t.length&&r.uniform4fv(s,t):r.uniform4f(s,t[0],t[1],t[2],t[3]);break;case r.INT_VEC2:i.size>1?t.length&&r.uniform2iv(s,t):r.uniform2i(s,t[0],t[1]);break;case r.INT_VEC3:i.size>1?t.length&&r.uniform3iv(s,t):r.uniform3i(s,t[0],t[1],t[2]);break;case r.INT_VEC4:i.size>1?t.length&&r.uniform4iv(s,t):r.uniform4i(s,t[0],t[1],t[2],t[3]);break;case r.SAMPLER_2D:if("number"==typeof t){if(t<r.TEXTURE0||t>r.TEXTURE31||t!==Math.ceil(t))return console.log("🌸 p5.js says: You're trying to use a number as the data for a texture.Please use a texture."),this;r.activeTexture(t),r.uniform1i(s,t)}else r.activeTexture(r.TEXTURE0+i.samplerIndex),i.texture=t instanceof ua?t:this._renderer.getTexture(t),r.uniform1i(s,i.samplerIndex),i.texture.src.gifProperties&&i.texture.src._animateGif(this._renderer._pInst);break;case r.SAMPLER_CUBE:case r.SAMPLER_3D:case r.SAMPLER_2D_SHADOW:case r.SAMPLER_2D_ARRAY:case r.SAMPLER_2D_ARRAY_SHADOW:case r.SAMPLER_CUBE_SHADOW:case r.INT_SAMPLER_2D:case r.INT_SAMPLER_3D:case r.INT_SAMPLER_CUBE:case r.INT_SAMPLER_2D_ARRAY:case r.UNSIGNED_INT_SAMPLER_2D:case r.UNSIGNED_INT_SAMPLER_3D:case r.UNSIGNED_INT_SAMPLER_CUBE:case r.UNSIGNED_INT_SAMPLER_2D_ARRAY:if("number"!=typeof t)break;if(t<r.TEXTURE0||t>r.TEXTURE31||t!==Math.ceil(t)){console.log("🌸 p5.js says: You're trying to use a number as the data for a texture.Please use a texture.");break}r.activeTexture(t),r.uniform1i(s,t)}return this}enableAttrib(e,t,i,r,s,n){if(e){0;const a=e.location;if(-1!==a){const e=this._renderer.GL;this._renderer.registerEnabled.has(a)||(e.enableVertexAttribArray(a),this._renderer.registerEnabled.add(a)),this._renderer.GL.vertexAttribPointer(a,t,i||e.FLOAT,r||!1,s||0,n||0)}}return this}disableRemainingAttributes(){for(const e of this._renderer.registerEnabled.values())Object.keys(this.attributes).some((t=>this.attributes[t].location===e))||(this._renderer.GL.disableVertexAttribArray(e),this._renderer.registerEnabled.delete(e))}}function En(e,t){e.Shader=Dn}void 0!==p5&&En(p5);var An={exports:{}};!function(e){var t;function i(e,t){return e.b===t.b&&e.a===t.a}function r(e,t){return e.b<t.b||e.b===t.b&&e.a<=t.a}function s(e,t,i){var r=t.b-e.b,s=i.b-t.b;return 0<r+s?r<s?t.a-e.a+r/(r+s)*(e.a-i.a):t.a-i.a+s/(r+s)*(i.a-e.a):0}function n(e,t,i){var r=t.b-e.b,s=i.b-t.b;return 0<r+s?(t.a-i.a)*r+(t.a-e.a)*s:0}function a(e,t){return e.a<t.a||e.a===t.a&&e.b<=t.b}function o(e,t,i){var r=t.a-e.a,s=i.a-t.a;return 0<r+s?r<s?t.b-e.b+r/(r+s)*(e.b-i.b):t.b-i.b+s/(r+s)*(i.b-e.b):0}function h(e,t,i){var r=t.a-e.a,s=i.a-t.a;return 0<r+s?(t.b-i.b)*r+(t.b-e.b)*s:0}function u(e){return r(e.b.a,e.a)}function l(e){return r(e.a,e.b.a)}function c(e,t,i,r){return(e=0>e?0:e)<=(i=0>i?0:i)?0===i?(t+r)/2:t+e/(e+i)*(r-t):r+i/(e+i)*(t-r)}function p(e){var t=y(e.b);return v(t,e.c),v(t.b,e.c),b(t,e.a),t}function d(e,t){var i=!1,r=!1;e!==t&&(t.a!==e.a&&(r=!0,w(t.a,e.a)),t.d!==e.d&&(i=!0,C(t.d,e.d)),x(t,e),r||(v(t,e.a),e.a.c=e),i||(b(t,e.d),e.d.a=e))}function f(e){var t=e.b,i=!1;e.d!==e.b.d&&(i=!0,C(e.d,e.b.d)),e.c===e?w(e.a,null):(e.b.d.a=Q(e),e.a.c=e.c,x(e,Q(e)),i||b(e,e.d)),t.c===t?(w(t.a,null),C(t.d,null)):(e.d.a=Q(t),t.a.c=t.c,x(t,Q(t))),_(e)}function g(e){var t=y(e),i=t.b;return x(t,e.e),t.a=e.b.a,v(i,t.a),t.d=i.d=e.d,t=t.b,x(e.b,Q(e.b)),x(e.b,t),e.b.a=t.a,t.b.a.c=t.b,t.b.d=e.b.d,t.f=e.f,t.b.f=e.b.f,t}function m(e,t){var i=!1,r=y(e),s=r.b;return t.d!==e.d&&(i=!0,C(t.d,e.d)),x(r,e.e),x(s,t),r.a=e.b.a,s.a=t.a,r.d=s.d=e.d,e.d.a=s,i||b(r,e.d),r}function y(e){var t=new J,i=new J,r=e.b.h;return i.h=r,r.b.h=t,t.h=e,e.b.h=i,t.b=i,t.c=t,t.e=i,i.b=t,i.c=i,i.e=t}function x(e,t){var i=e.c,r=t.c;i.b.e=t,r.b.e=e,e.c=r,t.c=i}function v(e,t){var i=t.f,r=new te(t,i);i.e=r,t.f=r,i=r.c=e;do{i.a=r,i=i.c}while(i!==e)}function b(e,t){var i=t.d,r=new K(t,i);i.b=r,t.d=r,r.a=e,r.c=t.c,i=e;do{i.d=r,i=i.e}while(i!==e)}function _(e){var t=e.h;e=e.b.h,t.b.h=e,e.b.h=t}function w(e,t){var i=e.c,r=i;do{r.a=t,r=r.c}while(r!==i);i=e.f,(r=e.e).f=i,i.e=r}function C(e,t){var i=e.a,r=i;do{r.d=t,r=r.e}while(r!==i);i=e.d,(r=e.b).d=i,i.b=r}function D(e){var t=0;return Math.abs(e[1])>Math.abs(e[0])&&(t=1),Math.abs(e[2])>Math.abs(e[t])&&(t=2),t}var E=4e150;function A(e,t){e.f+=t.f,e.b.f+=t.b.f}function S(e,t,i){return e=e.a,t=t.a,i=i.a,t.b.a===e?i.b.a===e?r(t.a,i.a)?0>=n(i.b.a,t.a,i.a):0<=n(t.b.a,i.a,t.a):0>=n(i.b.a,e,i.a):i.b.a===e?0<=n(t.b.a,e,t.a):(t=s(t.b.a,e,t.a))>=(e=s(i.b.a,e,i.a))}function F(e){e.a.i=null;var t=e.e;t.a.c=t.c,t.c.a=t.a,e.e=null}function T(e,t){f(e.a),e.c=!1,e.a=t,t.i=e}function M(e){var t=e.a.a;do{e=de(e)}while(e.a.a===t);return e.c&&(T(e,t=m(pe(e).a.b,e.a.e)),e=de(e)),e}function k(e,t,i){var r=new ce;return r.a=i,r.e=W(e.f,t.e,r),i.i=r}function I(e,t){switch(e.s){case 100130:return!!(1&t);case 100131:return 0!==t;case 100132:return 0<t;case 100133:return 0>t;case 100134:return 2<=t||-2>=t}return!1}function B(e){var t=e.a,i=t.d;i.c=e.d,i.a=t,F(e)}function L(e,t,i){for(e=t,t=t.a;e!==i;){e.c=!1;var r=pe(e),s=r.a;if(s.a!==t.a){if(!r.c){B(e);break}T(r,s=m(t.c.b,s.b))}t.c!==s&&(d(Q(s),s),d(t,s)),B(e),t=r.a,e=r}return t}function P(e,t,i,r,s,n){var a=!0;do{k(e,t,i.b),i=i.c}while(i!==r);for(null===s&&(s=pe(t).a.b.c);(i=(r=pe(t)).a.b).a===s.a;)i.c!==s&&(d(Q(i),i),d(Q(s),i)),r.f=t.f-i.f,r.d=I(e,r.f),t.b=!0,!a&&V(e,t)&&(A(i,s),F(t),f(s)),a=!1,t=r,s=i;t.b=!0,n&&G(e,t)}function O(e,t,i,r,s){var n=[t.g[0],t.g[1],t.g[2]];t.d=null,t.d=e.o&&e.o(n,i,r,e.c)||null,null===t.d&&(s?e.n||(Z(e,100156),e.n=!0):t.d=i[0])}function N(e,t,i){var r=[null,null,null,null];r[0]=t.a.d,r[1]=i.a.d,O(e,t.a,r,[.5,.5,0,0],!1),d(t,i)}function R(e,t,i,r,s){var n=Math.abs(t.b-e.b)+Math.abs(t.a-e.a),a=Math.abs(i.b-e.b)+Math.abs(i.a-e.a),o=s+1;r[s]=.5*a/(n+a),r[o]=.5*n/(n+a),e.g[0]+=r[s]*t.g[0]+r[o]*i.g[0],e.g[1]+=r[s]*t.g[1]+r[o]*i.g[1],e.g[2]+=r[s]*t.g[2]+r[o]*i.g[2]}function V(e,t){var s=pe(t),a=t.a,o=s.a;if(r(a.a,o.a)){if(0<n(o.b.a,a.a,o.a))return!1;if(i(a.a,o.a)){if(a.a!==o.a){s=e.e;var h=a.a.h;if(0<=h){var u=(s=s.b).d,l=s.e,c=s.c,p=c[h];u[p]=u[s.a],c[u[p]]=p,p<=--s.a&&(1>=p||r(l[u[p>>1]],l[u[p]])?ue(s,p):le(s,p)),l[h]=null,c[h]=s.b,s.b=h}else for(s.c[-(h+1)]=null;0<s.a&&null===s.c[s.d[s.a-1]];)--s.a;N(e,Q(o),a)}}else g(o.b),d(a,Q(o)),t.b=s.b=!0}else{if(0>n(a.b.a,o.a,a.a))return!1;de(t).b=t.b=!0,g(a.b),d(Q(o),a)}return!0}function U(e,t){var u=pe(t),l=t.a,p=u.a,f=l.a,m=p.a,y=l.b.a,x=p.b.a,v=new te;if(f===m||Math.min(f.a,y.a)>Math.max(m.a,x.a))return!1;if(r(f,m)){if(0<n(x,f,m))return!1}else if(0>n(y,m,f))return!1;var b,_,w=y,C=f,D=x,E=m;if(r(w,C)||(b=w,w=C,C=b),r(D,E)||(b=D,D=E,E=b),r(w,D)||(b=w,w=D,D=b,b=C,C=E,E=b),r(D,C)?r(C,E)?(0>(b=s(w,D,C))+(_=s(D,C,E))&&(b=-b,_=-_),v.b=c(b,D.b,_,C.b)):(0>(b=n(w,D,C))+(_=-n(w,E,C))&&(b=-b,_=-_),v.b=c(b,D.b,_,E.b)):v.b=(D.b+C.b)/2,a(w,C)||(b=w,w=C,C=b),a(D,E)||(b=D,D=E,E=b),a(w,D)||(b=w,w=D,D=b,b=C,C=E,E=b),a(D,C)?a(C,E)?(0>(b=o(w,D,C))+(_=o(D,C,E))&&(b=-b,_=-_),v.a=c(b,D.a,_,C.a)):(0>(b=h(w,D,C))+(_=-h(w,E,C))&&(b=-b,_=-_),v.a=c(b,D.a,_,E.a)):v.a=(D.a+C.a)/2,r(v,e.a)&&(v.b=e.a.b,v.a=e.a.a),w=r(f,m)?f:m,r(w,v)&&(v.b=w.b,v.a=w.a),i(v,f)||i(v,m))return V(e,t),!1;if(!i(y,e.a)&&0<=n(y,e.a,v)||!i(x,e.a)&&0>=n(x,e.a,v)){if(x===e.a)return g(l.b),d(p.b,l),l=pe(t=M(t)).a,L(e,pe(t),u),P(e,t,Q(l),l,l,!0),!0;if(y===e.a){g(p.b),d(l.e,Q(p)),m=(f=u=t).a.b.a;do{f=de(f)}while(f.a.b.a===m);return f=pe(t=f).a.b.c,u.a=Q(p),P(e,t,(p=L(e,u,null)).c,l.b.c,f,!0),!0}return 0<=n(y,e.a,v)&&(de(t).b=t.b=!0,g(l.b),l.a.b=e.a.b,l.a.a=e.a.a),0>=n(x,e.a,v)&&(t.b=u.b=!0,g(p.b),p.a.b=e.a.b,p.a.a=e.a.a),!1}return g(l.b),g(p.b),d(Q(p),l),l.a.b=v.b,l.a.a=v.a,l.a.h=re(e.e,l.a),l=l.a,p=[0,0,0,0],v=[f.d,y.d,m.d,x.d],l.g[0]=l.g[1]=l.g[2]=0,R(l,f,y,p,0),R(l,m,x,p,2),O(e,l,v,p,!0),de(t).b=t.b=u.b=!0,!1}function G(e,t){for(var i=pe(t);;){for(;i.b;)t=i,i=pe(i);if(!t.b&&(i=t,null===(t=de(t))||!t.b))break;t.b=!1;var s,a=t.a,o=i.a;if(s=a.b.a!==o.b.a)e:{var h=pe(s=t),u=s.a,l=h.a,c=void 0;if(r(u.b.a,l.b.a)){if(0>n(u.b.a,l.b.a,u.a)){s=!1;break e}de(s).b=s.b=!0,c=g(u),d(l.b,c),c.d.c=s.d}else{if(0<n(l.b.a,u.b.a,l.a)){s=!1;break e}s.b=h.b=!0,c=g(l),d(u.e,l.b),c.b.d.c=s.d}s=!0}if(s&&(i.c?(F(i),f(o),o=(i=pe(t)).a):t.c&&(F(t),f(a),a=(t=de(i)).a)),a.a!==o.a)if(a.b.a===o.b.a||t.c||i.c||a.b.a!==e.a&&o.b.a!==e.a)V(e,t);else if(U(e,t))break;a.a===o.a&&a.b.a===o.b.a&&(A(o,a),F(t),f(a),t=de(i))}}function z(e,t){e.a=t;for(var s=t.c;null===s.i;)if((s=s.c)===t.c){s=e;var a=t;(u=new ce).a=a.c.b;var o=(c=s.f).a;do{o=o.a}while(null!==o.b&&!c.c(c.b,u,o.b));var h=pe(c=o.b),u=c.a;o=h.a;if(0===n(u.b.a,a,u.a))i((u=c.a).a,a)||i(u.b.a,a)||(g(u.b),c.c&&(f(u.c),c.c=!1),d(a.c,u),z(s,a));else{var l=r(o.b.a,u.b.a)?c:h;h=void 0;c.d||l.c?(h=l===c?m(a.c.b,u.e):m(o.b.c.b,a.c).b,l.c?T(l,h):(u=s,(c=k(s,c,h)).f=de(c).f+c.a.f,c.d=I(u,c.f)),z(s,a)):P(s,c,a.c,a.c,null,!0)}return}if(c=(u=pe(s=M(s.i))).a,(u=L(e,u,null)).c===c){u=(c=u).c,o=pe(s),h=s.a,l=o.a;var c,p=!1;h.b.a!==l.b.a&&U(e,s),i(h.a,e.a)&&(d(Q(u),h),u=pe(s=M(s)).a,L(e,pe(s),o),p=!0),i(l.a,e.a)&&(d(c,Q(l)),c=L(e,o,null),p=!0),p?P(e,s,c.c,u,u,!0):(a=r(l.a,h.a)?Q(l):h,P(e,s,a=m(c.c.b,a),a.c,a.c,!1),a.b.i.c=!0,G(e,s))}else P(e,s,u.c,c,c,!0)}function j(e,t){var i=new ce,r=p(e.b);r.a.b=E,r.a.a=t,r.b.a.b=-4e150,r.b.a.a=t,e.a=r.b.a,i.a=r,i.f=0,i.d=!1,i.c=!1,i.h=!0,i.b=!1,r=W(r=e.f,r.a,i),i.e=r}function $(e){this.a=new q,this.b=e,this.c=S}function W(e,t,i){do{t=t.c}while(null!==t.b&&!e.c(e.b,t.b,i));return e=new q(i,t.a,t),t.a.c=e,t.a=e}function q(e,t,i){this.b=e||null,this.a=t||this,this.c=i||this}function H(){this.d=X,this.p=this.b=this.q=null,this.j=[0,0,0],this.s=100130,this.n=!1,this.o=this.a=this.e=this.f=null,this.m=!1,this.c=this.r=this.i=this.k=this.l=this.h=null}var X=0;function Y(e,t){if(e.d!==t)for(;e.d!==t;)if(e.d<t)switch(e.d){case X:Z(e,100151),e.u(null);break;case 1:Z(e,100152),e.t()}else switch(e.d){case 2:Z(e,100154),e.v();break;case 1:Z(e,100153),e.w()}}function Z(e,t){e.p&&e.p(t,e.c)}function K(e,t){this.b=e||this,this.d=t||this,this.a=null,this.c=!1}function J(){this.h=this,this.i=this.d=this.a=this.e=this.c=this.b=null,this.f=0}function Q(e){return e.b.e}function ee(){this.c=new te,this.a=new K,this.b=new J,this.d=new J,this.b.b=this.d,this.d.b=this.b}function te(e,t){this.e=e||this,this.f=t||this,this.d=this.c=null,this.g=[0,0,0],this.h=this.a=this.b=0}function ie(){this.c=[],this.d=null,this.a=0,this.e=!1,this.b=new ne}function re(e,t){if(e.e){var i,r=e.b,s=++r.a;return 2*s>r.f&&(r.f*=2,r.c=ae(r.c,r.f+1)),0===r.b?i=s:(i=r.b,r.b=r.c[r.b]),r.e[i]=t,r.c[i]=s,r.d[s]=i,r.h&&le(r,s),i}return r=e.a++,e.c[r]=t,-(r+1)}function se(e){if(0===e.a)return he(e.b);var t=e.c[e.d[e.a-1]];if(0!==e.b.a&&r(oe(e.b),t))return he(e.b);do{--e.a}while(0<e.a&&null===e.c[e.d[e.a-1]]);return t}function ne(){this.d=ae([0],33),this.e=[null,null],this.c=[0,0],this.a=0,this.f=32,this.b=0,this.h=!1,this.d[1]=1}function ae(e,t){for(var i=Array(t),r=0;r<e.length;r++)i[r]=e[r];for(;r<t;r++)i[r]=0;return i}function oe(e){return e.e[e.d[1]]}function he(e){var t=e.d,i=e.e,r=e.c,s=t[1],n=i[s];return 0<e.a&&(t[1]=t[e.a],r[t[1]]=1,i[s]=null,r[s]=e.b,e.b=s,0<--e.a&&ue(e,1)),n}function ue(e,t){for(var i=e.d,s=e.e,n=e.c,a=t,o=i[a];;){var h=a<<1;h<e.a&&r(s[i[h+1]],s[i[h]])&&(h+=1);var u=i[h];if(h>e.a||r(s[o],s[u])){i[a]=o,n[o]=a;break}i[a]=u,n[u]=a,a=h}}function le(e,t){for(var i=e.d,s=e.e,n=e.c,a=t,o=i[a];;){var h=a>>1,u=i[h];if(0===h||r(s[u],s[o])){i[a]=o,n[o]=a;break}i[a]=u,n[u]=a,a=h}}function ce(){this.e=this.a=null,this.f=0,this.c=this.b=this.h=this.d=!1}function pe(e){return e.e.c.b}function de(e){return e.e.a.b}(t=H.prototype).x=function(){Y(this,X)},t.B=function(e,t){switch(e){case 100142:return;case 100140:switch(t){case 100130:case 100131:case 100132:case 100133:case 100134:return void(this.s=t)}break;case 100141:return void(this.m=!!t);default:return void Z(this,100900)}Z(this,100901)},t.y=function(e){switch(e){case 100142:return 0;case 100140:return this.s;case 100141:return this.m;default:Z(this,100900)}return!1},t.A=function(e,t,i){this.j[0]=e,this.j[1]=t,this.j[2]=i},t.z=function(e,t){var i=t||null;switch(e){case 100100:case 100106:this.h=i;break;case 100104:case 100110:this.l=i;break;case 100101:case 100107:this.k=i;break;case 100102:case 100108:this.i=i;break;case 100103:case 100109:this.p=i;break;case 100105:case 100111:this.o=i;break;case 100112:this.r=i;break;default:Z(this,100900)}},t.C=function(e,t){var i=!1,r=[0,0,0];Y(this,2);for(var s=0;3>s;++s){var n=e[s];-1e150>n&&(n=-1e150,i=!0),1e150<n&&(n=1e150,i=!0),r[s]=n}i&&Z(this,100155),null===(i=this.q)?d(i=p(this.b),i.b):(g(i),i=i.e),i.a.d=t,i.a.g[0]=r[0],i.a.g[1]=r[1],i.a.g[2]=r[2],i.f=1,i.b.f=-1,this.q=i},t.u=function(e){Y(this,X),this.d=1,this.b=new ee,this.c=e},t.t=function(){Y(this,1),this.d=2,this.q=null},t.v=function(){Y(this,2),this.d=1},t.w=function(){Y(this,1),this.d=X;var e=!1,t=[c=this.j[0],s=this.j[1],o=this.j[2]];if(0===c&&0===s&&0===o){for(var s=[-2e150,-2e150,-2e150],a=[2e150,2e150,2e150],o=[],h=[],c=(e=this.b.c).e;c!==e;c=c.e)for(var p=0;3>p;++p){var d=c.g[p];d<a[p]&&(a[p]=d,h[p]=c),d>s[p]&&(s[p]=d,o[p]=c)}if(c=0,s[1]-a[1]>s[0]-a[0]&&(c=1),s[2]-a[2]>s[c]-a[c]&&(c=2),a[c]>=s[c])t[0]=0,t[1]=0,t[2]=1;else{for(s=0,a=h[c],o=o[c],h=[0,0,0],a=[a.g[0]-o.g[0],a.g[1]-o.g[1],a.g[2]-o.g[2]],p=[0,0,0],c=e.e;c!==e;c=c.e)p[0]=c.g[0]-o.g[0],p[1]=c.g[1]-o.g[1],p[2]=c.g[2]-o.g[2],h[0]=a[1]*p[2]-a[2]*p[1],h[1]=a[2]*p[0]-a[0]*p[2],h[2]=a[0]*p[1]-a[1]*p[0],(d=h[0]*h[0]+h[1]*h[1]+h[2]*h[2])>s&&(s=d,t[0]=h[0],t[1]=h[1],t[2]=h[2]);0>=s&&(t[0]=t[1]=t[2]=0,t[D(a)]=1)}e=!0}for(h=D(t),c=this.b.c,s=(h+1)%3,o=(h+2)%3,h=0<t[h]?1:-1,t=c.e;t!==c;t=t.e)t.b=t.g[s],t.a=h*t.g[o];if(e){for(t=0,c=(e=this.b.a).b;c!==e;c=c.b)if(!(0>=(s=c.a).f))do{t+=(s.a.b-s.b.a.b)*(s.a.a+s.b.a.a),s=s.e}while(s!==c.a);if(0>t)for(e=(t=this.b.c).e;e!==t;e=e.e)e.a=-e.a}for(this.n=!1,c=(t=this.b.b).h;c!==t;c=e)e=c.h,s=c.e,i(c.a,c.b.a)&&c.e.e!==c&&(N(this,s,c),f(c),s=(c=s).e),s.e===c&&(s!==c&&(s!==e&&s!==e.b||(e=e.h),f(s)),c!==e&&c!==e.b||(e=e.h),f(c));for(this.e=t=new ie,c=(e=this.b.c).e;c!==e;c=c.e)c.h=re(t,c);for(function(e){e.d=[];for(var t=0;t<e.a;t++)e.d[t]=t;e.d.sort(function(e){return function(t,i){return r(e[t],e[i])?1:-1}}(e.c)),e.e=!0,function(e){for(var t=e.a;1<=t;--t)ue(e,t);e.h=!0}(e.b)}(t),this.f=new $(this),j(this,-4e150),j(this,E);null!==(t=se(this.e));){for(;;){e:if(c=this.e,0===c.a)e=oe(c.b);else if(e=c.c[c.d[c.a-1]],0!==c.b.a&&(c=oe(c.b),r(c,e))){e=c;break e}if(null===e||!i(e,t))break;e=se(this.e),N(this,t.c,e.c)}z(this,t)}for(this.a=this.f.a.a.b.a.a,t=0;null!==(e=this.f.a.a.b);)e.h||++t,F(e);for(this.f=null,(t=this.e).b=null,t.d=null,this.e=t.c=null,c=(t=this.b).a.b;c!==t.a;c=e)e=c.b,(c=c.a).e.e===c&&(A(c.c,c),f(c));if(!this.n){if(t=this.b,this.m)for(c=t.b.h;c!==t.b;c=e)e=c.h,c.b.d.c!==c.d.c?c.f=c.d.c?1:-1:f(c);else for(c=t.a.b;c!==t.a;c=e)if(e=c.b,c.c){for(c=c.a;r(c.b.a,c.a);c=c.c.b);for(;r(c.a,c.b.a);c=c.e);for(s=c.c.b,o=void 0;c.e!==s;)if(r(c.b.a,s.a)){for(;s.e!==c&&(u(s.e)||0>=n(s.a,s.b.a,s.e.b.a));)s=(o=m(s.e,s)).b;s=s.c.b}else{for(;s.e!==c&&(l(c.c.b)||0<=n(c.b.a,c.a,c.c.b.a));)c=(o=m(c,c.c.b)).b;c=c.e}for(;s.e.e!==c;)s=(o=m(s.e,s)).b}if(this.h||this.i||this.k||this.l)if(this.m){for(e=(t=this.b).a.b;e!==t.a;e=e.b)if(e.c){this.h&&this.h(2,this.c),c=e.a;do{this.k&&this.k(c.a.d,this.c),c=c.e}while(c!==e.a);this.i&&this.i(this.c)}}else{for(t=this.b,e=!!this.l,c=!1,s=-1,o=t.a.d;o!==t.a;o=o.d)if(o.c){c||(this.h&&this.h(4,this.c),c=!0),h=o.a;do{e&&(s!==(a=h.b.d.c?0:1)&&(s=a,this.l&&this.l(!!s,this.c))),this.k&&this.k(h.a.d,this.c),h=h.e}while(h!==o.a)}c&&this.i&&this.i(this.c)}if(this.r){for(c=(t=this.b).a.b;c!==t.a;c=e)if(e=c.b,!c.c){o=(s=c.a).e,h=void 0;do{o=(h=o).e,h.d=null,null===h.b.d&&(h.c===h?w(h.a,null):(h.a.c=h.c,x(h,Q(h))),(a=h.b).c===a?w(a.a,null):(a.a.c=a.c,x(a,Q(a))),_(h))}while(h!==s);s=c.d,(c=c.b).d=s,s.b=c}return this.r(this.b),void(this.c=this.b=null)}}this.b=this.c=null},Nr.libtess={GluTesselator:H,windingRule:{GLU_TESS_WINDING_ODD:100130,GLU_TESS_WINDING_NONZERO:100131,GLU_TESS_WINDING_POSITIVE:100132,GLU_TESS_WINDING_NEGATIVE:100133,GLU_TESS_WINDING_ABS_GEQ_TWO:100134},primitiveType:{GL_LINE_LOOP:2,GL_TRIANGLES:4,GL_TRIANGLE_STRIP:5,GL_TRIANGLE_FAN:6},errorType:{GLU_TESS_MISSING_BEGIN_POLYGON:100151,GLU_TESS_MISSING_END_POLYGON:100153,GLU_TESS_MISSING_BEGIN_CONTOUR:100152,GLU_TESS_MISSING_END_CONTOUR:100154,GLU_TESS_COORD_TOO_LARGE:100155,GLU_TESS_NEED_COMBINE_CALLBACK:100156},gluEnum:{GLU_TESS_MESH:100112,GLU_TESS_TOLERANCE:100142,GLU_TESS_WINDING_RULE:100140,GLU_TESS_BOUNDARY_ONLY:100141,GLU_INVALID_ENUM:100900,GLU_INVALID_VALUE:100901,GLU_TESS_BEGIN:100100,GLU_TESS_VERTEX:100101,GLU_TESS_END:100102,GLU_TESS_ERROR:100103,GLU_TESS_EDGE_FLAG:100104,GLU_TESS_COMBINE:100105,GLU_TESS_BEGIN_DATA:100106,GLU_TESS_VERTEX_DATA:100107,GLU_TESS_END_DATA:100108,GLU_TESS_ERROR_DATA:100109,GLU_TESS_EDGE_FLAG_DATA:100110,GLU_TESS_COMBINE_DATA:100111}},H.prototype.gluDeleteTess=H.prototype.x,H.prototype.gluTessProperty=H.prototype.B,H.prototype.gluGetTessProperty=H.prototype.y,H.prototype.gluTessNormal=H.prototype.A,H.prototype.gluTessCallback=H.prototype.z,H.prototype.gluTessVertex=H.prototype.C,H.prototype.gluTessBeginPolygon=H.prototype.u,H.prototype.gluTessBeginContour=H.prototype.t,H.prototype.gluTessEndContour=H.prototype.v,H.prototype.gluTessEndPolygon=H.prototype.w,e.exports=Nr.libtess}(An);var Sn=Rr(An.exports);const Fn={vertices:1,vertexNormals:1,vertexColors:4,vertexStrokeColors:4,uvs:2},Tn=Object.values(Fn).reduce(((e,t)=>e+t));class Mn{constructor(e){this.renderer=e,this.shapeMode=8,this.geometry=new gn(void 0,void 0,void 0,this.renderer),this.geometry.gid="__IMMEDIATE_MODE_GEOMETRY__",this.contourIndices=[],this._useUserVertexProperties=void 0,this._bezierVertex=[],this._quadraticVertex=[],this._curveVertex=[],this.isProcessingVertices=!1,this._tessy=this._initTessy(),this.tessyVertexSize=Tn,this.bufferStrides={...Fn}}constructFromContours(e,t){this._useUserVertexProperties&&this._resetUserVertexProperties(),this.geometry.reset(),this.contourIndices=[],this.shapeMode=e.contours[0].kind;const i=!!this.renderer.states.strokeColor,r={};if(e.userVertexProperties){this._useUserVertexProperties=!0;for(const t in e.userVertexProperties){const i=e.vertexPropertyName(t),s=this.geometry._userVertexPropertyHelper(i,[],e.userVertexProperties[t]);r[t]=s,this.tessyVertexSize+=s.getDataSize(),this.bufferStrides[s.getSrcName()]=s.getDataSize(),this.renderer.buffers.user.push(new wn(s.getDataSize(),s.getSrcName(),s.getDstName(),i,this.renderer))}}else this._useUserVertexProperties=!1;for(const e of t){this.contourIndices.push(this.geometry.vertices.length);for(const t of e){if(this.shapeMode===k&&this.geometry.vertices.length%6==3)for(const e in this.bufferStrides){const t=this.bufferStrides[e],i=this.geometry[e];i.push(...i.slice(i.length-3*t,i.length-2*t),...i.slice(i.length-t,i.length))}this.geometry.vertices.push(t.position),this.geometry.vertexNormals.push(t.normal||new je(0,0,0)),this.geometry.uvs.push(t.textureCoordinates.x,t.textureCoordinates.y),this.renderer.states.fillColor?this.geometry.vertexColors.push(...t.fill.array()):this.geometry.vertexColors.push(0,0,0,0),this.renderer.states.strokeColor?this.geometry.vertexStrokeColors.push(...t.stroke.array()):this.geometry.vertexStrokeColors.push(0,0,0,0);for(const e in r){const i=r[e];e in t&&i.setCurrentData(t[e]),i.pushCurrentData()}}}i&&(this.geometry.edges=this._calculateEdges(this.shapeMode,this.geometry.vertices)),i&&!this.renderer.geometryBuilder&&this.geometry._edgesToVertices(),8===this.shapeMode?(this.isProcessingVertices=!0,this._tesselateShape(),this.isProcessingVertices=!1):this.shapeMode===I?this.shapeMode=5:this.shapeMode===k&&(this.shapeMode=4),this.renderer.states.textureMode===xe&&null!==this.renderer.states._tex&&this.renderer.states._tex.width>0&&this.renderer.states._tex.height>0&&(this.geometry.uvs=this.geometry.uvs.map(((e,t)=>t%2==0?e/this.renderer.states._tex.width:e/this.renderer.states._tex.height)))}_resetUserVertexProperties(){const e=this.geometry.userVertexProperties;for(const t in e){const i=e[t];delete this.bufferStrides[t],i.delete()}this._useUserVertexProperties=!1,this.tessyVertexSize=Tn,this.geometry.userVertexProperties={}}_calculateEdges(e,t){const i=[];let r=0;const s=this.contourIndices.slice();let n=-1;switch(e){case 5:for(r=0;r<t.length-2;r++)i.push([r,r+1]),i.push([r,r+2]);i.push([r,r+1]);break;case 6:for(r=1;r<t.length-1;r++)i.push([0,r]),i.push([r,r+1]);i.push([0,t.length-1]);break;case 4:for(r=0;r<t.length-2;r+=3)i.push([r,r+1]),i.push([r+1,r+2]),i.push([r+2,r]);break;case M:for(r=0;r<t.length-1;r+=2)i.push([r,r+1]);break;case k:for(r=0;r<t.length-5;r+=6)i.push([r,r+1]),i.push([r+1,r+2]),i.push([r+2,r+5]),i.push([r+5,r]);break;case I:for(r=0;r<t.length-2;r+=2)i.push([r,r+1]),i.push([r+1,r+3]),i.push([r,r+2]);i.push([r,r+1]);break;default:for(r=0;r<t.length;r++)r===s[0]?n=s.shift():t[n]&&t[r].equals(t[n])?i.push([r-1,n]):i.push([r-1,r])}return i}_tesselateShape(){this.shapeMode=4;const e=[];for(let t=0;t<this.geometry.vertices.length;t++){this.contourIndices.length>0&&this.contourIndices[0]===t&&(this.contourIndices.shift(),e.push([])),e[e.length-1].push(this.geometry.vertices[t].x,this.geometry.vertices[t].y,this.geometry.vertices[t].z,this.geometry.uvs[2*t],this.geometry.uvs[2*t+1],this.geometry.vertexColors[4*t],this.geometry.vertexColors[4*t+1],this.geometry.vertexColors[4*t+2],this.geometry.vertexColors[4*t+3],this.geometry.vertexNormals[t].x,this.geometry.vertexNormals[t].y,this.geometry.vertexNormals[t].z);for(const i in this.geometry.userVertexProperties){const r=this.geometry.userVertexProperties[i],s=t*r.getDataSize(),n=s+r.getDataSize(),a=r.getSrcArray().slice(s,n);e[e.length-1].push(...a)}}const t=this._triangulate(e),i=this.geometry.vertices;this.geometry.vertices=[],this.geometry.vertexNormals=[],this.geometry.uvs=[];for(const e in this.geometry.userVertexProperties){this.geometry.userVertexProperties[e].resetSrcArray()}const r=[];for(let e=0,i=t.length;e<i;e+=this.tessyVertexSize){r.push(...t.slice(e+5,e+9)),this.geometry.vertexNormals.push(new je(...t.slice(e+9,e+12)));{let i=12;for(const r in this.geometry.userVertexProperties){const s=this.geometry.userVertexProperties[r],n=s.getDataSize(),a=e+i,o=a+n;s.setCurrentData(t.slice(a,o)),s.pushCurrentData(),i+=n}}this.geometry.vertices.push(new je(...t.slice(e,e+3))),this.geometry.uvs.push(...t.slice(e+3,e+5))}if(this.renderer.geometryBuilder){const e=new Map;this.geometry.edges=this.geometry.edges.map((t=>t.map((t=>{if(!e.has(t)){const r=i[t];let s=this.geometry.vertices.findIndex((e=>r.x===e.x&&r.y===e.y&&r.z===e.z));if(-1===s){let e=1/0,t=0;for(let i=0;i<this.geometry.vertices.length;i++){const s=this.geometry.vertices[i],n=r.x-s.x,a=r.y-s.y,o=r.z-s.z,h=n*n+a*a+o*o;h<e&&(e=h,t=i)}s=t}e.set(t,s)}return e.get(t)}))))}this.geometry.vertexColors=r}_initTessy(){const e=new Sn.GluTesselator;return e.gluTessCallback(Sn.gluEnum.GLU_TESS_VERTEX_DATA,(function(e,t){for(const i of e)t.push(i)})),e.gluTessCallback(Sn.gluEnum.GLU_TESS_BEGIN,(function(e){e!==Sn.primitiveType.GL_TRIANGLES&&console.log(`expected TRIANGLES but got type: ${e}`)})),e.gluTessCallback(Sn.gluEnum.GLU_TESS_ERROR,(function(e){console.log("error callback"),console.log(`error number: ${e}`)})),e.gluTessCallback(Sn.gluEnum.GLU_TESS_COMBINE,((e,t,i)=>{const r=new Array(this.tessyVertexSize).fill(0);for(let e=0;e<i.length;e++)for(let s=0;s<r.length;s++)0!==i[e]&&t[e]&&(r[s]+=t[e][s]*i[e]);return r})),e.gluTessCallback(Sn.gluEnum.GLU_TESS_EDGE_FLAG,(function(e){})),e.gluTessProperty(Sn.gluEnum.GLU_TESS_WINDING_RULE,Sn.windingRule.GLU_TESS_WINDING_NONZERO),e}_triangulate(e){const t=e[0]?e[0][2]:void 0;let i=!0;for(const r of e)for(let e=0;e<r.length;e+=this.tessyVertexSize)if(r[e+2]!==t){i=!1;break}i?this._tessy.gluTessNormal(0,0,1):this._tessy.gluTessNormal(0,0,0);const r=[];this._tessy.gluTessBeginPolygon(r);for(const t of e){this._tessy.gluTessBeginContour();for(let e=0;e<t.length;e+=this.tessyVertexSize){const i=t.slice(e,e+this.tessyVertexSize);this._tessy.gluTessVertex(i,i)}this._tessy.gluTessEndContour()}return this._tessy.gluTessEndPolygon(),r}}class kn{constructor(e){this.renderer=e,this.cache={}}numCached(){return Object.keys(this.cache).length}isCached(e){return void 0!==this.cache[e]}getGeometryByID(e){return this.cache[e]?.geometry}getCached(e){return this.getCachedID(e.gid)}getCachedID(e){return this.cache[e]}ensureCached(e){const t=e.gid;if(!t)throw new Error("The p5.Geometry you passed in has no gid property!");if(this.isCached(e.gid))return this.getCached(e);const i=this.renderer.GL;if(this.freeBuffers(t),Object.keys(this.cache).length>1e3){const e=Object.keys(this.cache)[0];this.freeBuffers(e)}const r={};this.cache[t]=r,r.geometry=e;let s=r.indexBuffer;if(e.faces.length){s||(s=r.indexBuffer=i.createBuffer());const t=e.faces.flat(),n=t.some((e=>e>65535));let a=n?Uint32Array:Uint16Array;this.renderer._bindBuffer(s,i.ELEMENT_ARRAY_BUFFER,t,a),r.indexBufferType=n?i.UNSIGNED_INT:i.UNSIGNED_SHORT}else s&&(i.deleteBuffer(s),r.indexBuffer=null);return r}freeBuffers(e){const t=this.cache[e];if(!t)return;delete this.cache[e];const i=this.renderer.GL;function r(e){for(const r of e)t[r.dst]&&(i.deleteBuffer(t[r.dst]),t[r.dst]=null)}t.indexBuffer&&i.deleteBuffer(t.indexBuffer),r(this.renderer.buffers.stroke),r(this.renderer.buffers.fill),r(this.renderer.buffers.user)}}const In={[pe]:3,[ue]:4,[ne]:.5};var Bn="precision highp int;\n\nuniform mat4 uModelViewMatrix;\nuniform mat4 uProjectionMatrix;\n\nIN vec3 aPosition;\nIN vec2 aTexCoord;\nOUT vec2 vTexCoord;\n\nvoid main() {\n // transferring texcoords for the frag shader\n vTexCoord = aTexCoord;\n\n // copy position with a fourth coordinate for projection (1.0 is normal)\n vec4 positionVec4 = vec4(aPosition, 1.0);\n\n // project to 3D space\n gl_Position = uProjectionMatrix * uModelViewMatrix * positionVec4;\n}\n",Ln='#define PI 3.141592\n\nprecision highp float;\nprecision highp int;\n\nuniform mat4 uViewMatrix;\n\nuniform bool uUseLighting;\n\nuniform int uAmbientLightCount;\nuniform vec3 uAmbientColor[5];\nuniform mat3 uCameraRotation;\nuniform int uDirectionalLightCount;\nuniform vec3 uLightingDirection[5];\nuniform vec3 uDirectionalDiffuseColors[5];\nuniform vec3 uDirectionalSpecularColors[5];\n\nuniform int uPointLightCount;\nuniform vec3 uPointLightLocation[5];\nuniform vec3 uPointLightDiffuseColors[5];\t\nuniform vec3 uPointLightSpecularColors[5];\n\nuniform int uSpotLightCount;\nuniform float uSpotLightAngle[5];\nuniform float uSpotLightConc[5];\nuniform vec3 uSpotLightDiffuseColors[5];\nuniform vec3 uSpotLightSpecularColors[5];\nuniform vec3 uSpotLightLocation[5];\nuniform vec3 uSpotLightDirection[5];\n\nuniform bool uSpecular;\nuniform float uShininess;\nuniform float uMetallic;\n\nuniform float uConstantAttenuation;\nuniform float uLinearAttenuation;\nuniform float uQuadraticAttenuation;\n\n// setting from _setImageLightUniforms()\n// boolean to initiate the calculateImageDiffuse and calculateImageSpecular\nuniform bool uUseImageLight;\n// texture for use in calculateImageDiffuse\nuniform sampler2D environmentMapDiffused;\n// texture for use in calculateImageSpecular\nuniform sampler2D environmentMapSpecular;\n\nconst float specularFactor = 2.0;\nconst float diffuseFactor = 0.73;\n\nstruct LightResult {\n float specular;\n float diffuse;\n};\n\nfloat _phongSpecular(\n vec3 lightDirection,\n vec3 viewDirection,\n vec3 surfaceNormal,\n float shininess) {\n\n vec3 R = reflect(lightDirection, surfaceNormal);\n return pow(max(0.0, dot(R, viewDirection)), shininess);\n}\n\nfloat _lambertDiffuse(vec3 lightDirection, vec3 surfaceNormal) {\n return max(0.0, dot(-lightDirection, surfaceNormal));\n}\n\nLightResult _light(vec3 viewDirection, vec3 normal, vec3 lightVector, float shininess, float metallic) {\n\n vec3 lightDir = normalize(lightVector);\n\n //compute our diffuse & specular terms\n LightResult lr;\n float specularIntensity = mix(1.0, 0.4, metallic);\n float diffuseIntensity = mix(1.0, 0.1, metallic);\n if (uSpecular)\n lr.specular = (_phongSpecular(lightDir, viewDirection, normal, shininess)) * specularIntensity;\n lr.diffuse = _lambertDiffuse(lightDir, normal) * diffuseIntensity;\n return lr;\n}\n\n// converts the range of "value" from [min1 to max1] to [min2 to max2]\nfloat map(float value, float min1, float max1, float min2, float max2) {\n return min2 + (value - min1) * (max2 - min2) / (max1 - min1);\n}\n\nvec2 mapTextureToNormal( vec3 v ){\n // x = r sin(phi) cos(theta) \n // y = r cos(phi) \n // z = r sin(phi) sin(theta)\n float phi = acos( v.y );\n // if phi is 0, then there are no x, z components\n float theta = 0.0;\n // else \n theta = acos(v.x / sin(phi));\n float sinTheta = v.z / sin(phi);\n if (sinTheta < 0.0) {\n // Turn it into -theta, but in the 0-2PI range\n theta = 2.0 * PI - theta;\n }\n theta = theta / (2.0 * 3.14159);\n phi = phi / 3.14159 ;\n \n vec2 angles = vec2( fract(theta + 0.25), 1.0 - phi );\n return angles;\n}\n\n\nvec3 calculateImageDiffuse(vec3 vNormal, vec3 vViewPosition, float metallic){\n // make 2 seperate builds \n vec3 worldCameraPosition = vec3(0.0, 0.0, 0.0); // hardcoded world camera position\n vec3 worldNormal = normalize(vNormal * uCameraRotation);\n vec2 newTexCoor = mapTextureToNormal( worldNormal );\n vec4 texture = TEXTURE( environmentMapDiffused, newTexCoor );\n // this is to make the darker sections more dark\n // png and jpg usually flatten the brightness so it is to reverse that\n return mix(smoothstep(vec3(0.0), vec3(1.0), texture.xyz), vec3(0.0), metallic);\n}\n\nvec3 calculateImageSpecular(vec3 vNormal, vec3 vViewPosition, float shininess, float metallic){\n vec3 worldCameraPosition = vec3(0.0, 0.0, 0.0);\n vec3 worldNormal = normalize(vNormal);\n vec3 lightDirection = normalize( vViewPosition - worldCameraPosition );\n vec3 R = reflect(lightDirection, worldNormal) * uCameraRotation;\n vec2 newTexCoor = mapTextureToNormal( R );\n#ifdef WEBGL2\n // In p5js the range of shininess is >= 1,\n // Therefore roughness range will be ([0,1]*8)*20 or [0, 160]\n // The factor of 8 is because currently the getSpecularTexture\n // only calculated 8 different levels of roughness\n // The factor of 20 is just to spread up this range so that,\n // [1, max] of shininess is converted to [0,160] of roughness\n float roughness = 20. / shininess;\n vec4 outColor = textureLod(environmentMapSpecular, newTexCoor, roughness * 8.);\n#else\n vec4 outColor = TEXTURE(environmentMapSpecular, newTexCoor);\n#endif\n // this is to make the darker sections more dark\n // png and jpg usually flatten the brightness so it is to reverse that\n return mix(\n pow(outColor.xyz, vec3(10)),\n pow(outColor.xyz, vec3(1.2)),\n metallic \n );\n}\n\nvoid totalLight(\n vec3 modelPosition,\n vec3 normal,\n float shininess,\n float metallic,\n out vec3 totalDiffuse,\n out vec3 totalSpecular\n) {\n\n totalSpecular = vec3(0.0);\n\n if (!uUseLighting) {\n totalDiffuse = vec3(1.0);\n return;\n }\n\n totalDiffuse = vec3(0.0);\n\n vec3 viewDirection = normalize(-modelPosition);\n\n for (int j = 0; j < 5; j++) {\n if (j < uDirectionalLightCount) {\n vec3 lightVector = (uViewMatrix * vec4(uLightingDirection[j], 0.0)).xyz;\n vec3 lightColor = uDirectionalDiffuseColors[j];\n vec3 specularColor = uDirectionalSpecularColors[j];\n LightResult result = _light(viewDirection, normal, lightVector, shininess, metallic);\n totalDiffuse += result.diffuse * lightColor;\n totalSpecular += result.specular * lightColor * specularColor;\n }\n\n if (j < uPointLightCount) {\n vec3 lightPosition = (uViewMatrix * vec4(uPointLightLocation[j], 1.0)).xyz;\n vec3 lightVector = modelPosition - lightPosition;\n //calculate attenuation\n float lightDistance = length(lightVector);\n float lightFalloff = 1.0 / (uConstantAttenuation + lightDistance * uLinearAttenuation + (lightDistance * lightDistance) * uQuadraticAttenuation);\n vec3 lightColor = lightFalloff * uPointLightDiffuseColors[j];\n vec3 specularColor = lightFalloff * uPointLightSpecularColors[j];\n\n LightResult result = _light(viewDirection, normal, lightVector, shininess, metallic);\n totalDiffuse += result.diffuse * lightColor;\n totalSpecular += result.specular * lightColor * specularColor;\n }\n\n if(j < uSpotLightCount) {\n vec3 lightPosition = (uViewMatrix * vec4(uSpotLightLocation[j], 1.0)).xyz;\n vec3 lightVector = modelPosition - lightPosition;\n \n float lightDistance = length(lightVector);\n float lightFalloff = 1.0 / (uConstantAttenuation + lightDistance * uLinearAttenuation + (lightDistance * lightDistance) * uQuadraticAttenuation);\n\n vec3 lightDirection = (uViewMatrix * vec4(uSpotLightDirection[j], 0.0)).xyz;\n float spotDot = dot(normalize(lightVector), normalize(lightDirection));\n float spotFalloff;\n if(spotDot < uSpotLightAngle[j]) {\n spotFalloff = 0.0;\n }\n else {\n spotFalloff = pow(spotDot, uSpotLightConc[j]);\n }\n lightFalloff *= spotFalloff;\n\n vec3 lightColor = uSpotLightDiffuseColors[j];\n vec3 specularColor = uSpotLightSpecularColors[j];\n \n LightResult result = _light(viewDirection, normal, lightVector, shininess, metallic);\n \n totalDiffuse += result.diffuse * lightColor * lightFalloff;\n totalSpecular += result.specular * lightColor * specularColor * lightFalloff;\n }\n }\n\n if( uUseImageLight ){\n totalDiffuse += calculateImageDiffuse(normal, modelPosition, metallic);\n totalSpecular += calculateImageSpecular(normal, modelPosition, shininess, metallic);\n }\n\n totalDiffuse *= diffuseFactor;\n totalSpecular *= specularFactor;\n}\n',Pn="#ifdef WEBGL2\n\n#define IN in\n#define OUT out\n\n#ifdef FRAGMENT_SHADER\nout vec4 outColor;\n#define OUT_COLOR outColor\n#endif\n#define TEXTURE texture\n\n#else\n\n#ifdef FRAGMENT_SHADER\n#define IN varying\n#else\n#define IN attribute\n#endif\n#define OUT varying\n#define TEXTURE texture2D\n\n#ifdef FRAGMENT_SHADER\n#define OUT_COLOR gl_FragColor\n#endif\n\n#endif\n\n#ifdef FRAGMENT_SHADER\nvec4 getTexture(in sampler2D content, vec2 coord) {\n vec4 color = TEXTURE(content, coord);\n color.rgb /= color.a;\n return color;\n}\n#endif\n",On="precision highp float;\n\nuniform sampler2D tex0;\nuniform vec2 canvasSize;\nuniform vec2 texelSize;\n\nIN vec2 vTexCoord;\n\nstruct FilterInputs {\n vec2 texCoord;\n vec2 canvasSize;\n vec2 texelSize;\n};\n\nvoid main(void) {\n FilterInputs inputs;\n inputs.texCoord = vTexCoord;\n inputs.canvasSize = canvasSize;\n inputs.texelSize = texelSize;\n OUT_COLOR = HOOK_getColor(inputs, tex0);\n OUT_COLOR.rgb *= outColor.a;\n}\n",Nn="precision highp float;\n\nvarying vec2 vTexCoord;\n\nuniform sampler2D tex0;\n\nfloat luma(vec3 color) {\n // weighted grayscale with luminance values\n return dot(color, vec3(0.2126, 0.7152, 0.0722));\n}\n\nvoid main() {\n vec4 tex = texture2D(tex0, vTexCoord);\n float gray = luma(tex.rgb);\n gl_FragColor = vec4(gray, gray, gray, tex.a);\n}\n",Rn="// Reduces the bright areas in an image\n\nprecision highp float;\n\nvarying vec2 vTexCoord;\n\nuniform sampler2D tex0;\nuniform vec2 texelSize;\n\nfloat luma(vec3 color) {\n // weighted grayscale with luminance values\n // weights 77, 151, 28 taken from src/image/filters.js\n return dot(color, vec3(0.300781, 0.589844, 0.109375));\n}\n\nvoid main() {\n vec4 color = texture2D(tex0, vTexCoord);\n float lum = luma(color.rgb);\n\n // set current color as the darkest neighbor color\n\n vec4 neighbors[4];\n neighbors[0] = texture2D(tex0, vTexCoord + vec2( texelSize.x, 0.0));\n neighbors[1] = texture2D(tex0, vTexCoord + vec2(-texelSize.x, 0.0));\n neighbors[2] = texture2D(tex0, vTexCoord + vec2(0.0, texelSize.y));\n neighbors[3] = texture2D(tex0, vTexCoord + vec2(0.0, -texelSize.y));\n\n for (int i = 0; i < 4; i++) {\n vec4 neighborColor = neighbors[i];\n float neighborLum = luma(neighborColor.rgb);\n\n if (neighborLum < lum) {\n color = neighborColor;\n lum = neighborLum;\n }\n }\n\n gl_FragColor = color;\n}\n",Vn="// Increase the bright areas in an image\n\nprecision highp float;\n\nvarying vec2 vTexCoord;\n\nuniform sampler2D tex0;\nuniform vec2 texelSize;\n\nfloat luma(vec3 color) {\n // weighted grayscale with luminance values\n // weights 77, 151, 28 taken from src/image/filters.js\n return dot(color, vec3(0.300781, 0.589844, 0.109375));\n}\n\nvoid main() {\n vec4 color = texture2D(tex0, vTexCoord);\n float lum = luma(color.rgb);\n\n // set current color as the brightest neighbor color\n\n vec4 neighbors[4];\n neighbors[0] = texture2D(tex0, vTexCoord + vec2( texelSize.x, 0.0));\n neighbors[1] = texture2D(tex0, vTexCoord + vec2(-texelSize.x, 0.0));\n neighbors[2] = texture2D(tex0, vTexCoord + vec2(0.0, texelSize.y));\n neighbors[3] = texture2D(tex0, vTexCoord + vec2(0.0, -texelSize.y));\n\n for (int i = 0; i < 4; i++) {\n vec4 neighborColor = neighbors[i];\n float neighborLum = luma(neighborColor.rgb);\n\n if (neighborLum > lum) {\n color = neighborColor;\n lum = neighborLum;\n }\n }\n\n gl_FragColor = color;\n}\n",Un="precision highp float;\n\n// Two-pass blur filter, unweighted kernel.\n// See also a similar blur at Adam Ferriss' repo of shader examples:\n// https://github.com/aferriss/p5jsShaderExamples/blob/gh-pages/4_image-effects/4-9_single-pass-blur/effect.frag\n\n\nuniform sampler2D tex0;\nvarying vec2 vTexCoord;\nuniform vec2 direction;\nuniform vec2 canvasSize;\nuniform float radius;\n\nfloat random(vec2 p) {\n vec3 p3 = fract(vec3(p.xyx) * .1031);\n p3 += dot(p3, p3.yzx + 33.33);\n return fract((p3.x + p3.y) * p3.z);\n}\n\n// This isn't a real Gaussian weight, it's a quadratic weight. It's what the\n// CPU mode's blur uses though, so we also use it here to match.\nfloat quadWeight(float x, float e) {\n return pow(e-abs(x), 2.);\n}\n\nvoid main(){\n vec2 uv = vTexCoord;\n\n // A reasonable maximum number of samples\n const float maxSamples = 64.0;\n\n float numSamples = floor(7. * radius);\n if (fract(numSamples / 2.) == 0.) {\n numSamples++;\n }\n vec4 avg = vec4(0.0);\n float total = 0.0;\n\n // Calculate the spacing to avoid skewing if numSamples > maxSamples\n float spacing = 1.0;\n if (numSamples > maxSamples) {\n spacing = numSamples / maxSamples;\n numSamples = maxSamples;\n }\n\n float randomOffset = (spacing - 1.0) * mix(-0.5, 0.5, random(gl_FragCoord.xy));\n for (float i = 0.0; i < maxSamples; i++) {\n if (i >= numSamples) break;\n\n float sample = i * spacing - (numSamples - 1.0) * 0.5 * spacing + randomOffset;\n vec2 sampleCoord = uv + vec2(sample, sample) / canvasSize * direction;\n float weight = quadWeight(sample, (numSamples - 1.0) * 0.5 * spacing);\n\n avg += weight * texture2D(tex0, sampleCoord);\n total += weight;\n }\n\n avg /= total;\n gl_FragColor = avg;\n}\n",Gn="// Limit color space for a stylized cartoon / poster effect\n\nprecision highp float;\n\nvarying vec2 vTexCoord;\n\nuniform sampler2D tex0;\nuniform float filterParameter;\n\nvec3 quantize(vec3 color, float n) {\n // restrict values to N options/bins\n // and floor each channel to nearest value\n //\n // eg. when N = 5, values = 0.0, 0.25, 0.50, 0.75, 1.0\n // then quantize (0.1, 0.7, 0.9) -> (0.0, 0.5, 1.0)\n\n color = color * n;\n color = floor(color);\n color = color / (n - 1.0);\n return color;\n}\n\nvoid main() {\n vec4 color = texture2D(tex0, vTexCoord);\n\n vec3 restrictedColor = quantize(color.rgb / color.a, filterParameter);\n\n gl_FragColor = vec4(restrictedColor.rgb * color.a, color.a);\n}\n",zn="// Set alpha channel to entirely opaque\n\nprecision highp float;\n\nvarying vec2 vTexCoord;\n\nuniform sampler2D tex0;\n\nvoid main() {\n vec4 color = texture2D(tex0, vTexCoord);\n gl_FragColor = vec4(color.rgb / color.a, 1.0);\n}\n",jn="// Set each pixel to inverse value\n// Note that original INVERT does not change the opacity, so this follows suit\n\nprecision highp float;\n\nvarying vec2 vTexCoord;\n\nuniform sampler2D tex0;\n\nvoid main() {\nvec4 color = texture2D(tex0, vTexCoord);\nvec3 origColor = color.rgb / color.a;\nvec3 invertedColor = vec3(1.0) - origColor;\ngl_FragColor = vec4(invertedColor * color.a, color.a);\n}\n",$n="// Convert pixels to either white or black, \n// depending on if their luma is above or below filterParameter\n\nprecision highp float;\n\nvarying vec2 vTexCoord;\n\nuniform sampler2D tex0;\nuniform float filterParameter;\n\nfloat luma(vec3 color) {\n // weighted grayscale with luminance values\n return dot(color, vec3(0.2126, 0.7152, 0.0722));\n}\n\nvoid main() {\n vec4 color = texture2D(tex0, vTexCoord);\n float gray = luma(color.rgb / color.a);\n // floor() used to match src/image/filters.js\n float threshold = floor(filterParameter * 255.0) / 255.0;\n float blackOrWhite = step(threshold, gray);\n gl_FragColor = vec4(vec3(blackOrWhite) * color.a, color.a);\n}\n",Wn="uniform mat4 uModelViewMatrix;\nuniform mat4 uProjectionMatrix;\n\nattribute vec3 aPosition;\n// texcoords only come from p5 to vertex shader\n// so pass texcoords on to the fragment shader in a varying variable\nattribute vec2 aTexCoord;\nvarying vec2 vTexCoord;\n\nvoid main() {\n // transferring texcoords for the frag shader\n vTexCoord = aTexCoord;\n\n // copy position with a fourth coordinate for projection (1.0 is normal)\n vec4 positionVec4 = vec4(aPosition, 1.0);\n\n gl_Position = uProjectionMatrix * uModelViewMatrix * positionVec4;\n}\n";const qn={},Hn={};let Xn="";const Yn=function(e,t){Xn+=`#define STROKE_CAP_${e} ${t}\n`,qn[Re[e]]=t},Zn=function(e,t){Xn+=`#define STROKE_JOIN_${e} ${t}\n`,Hn[Re[e]]=t};Yn("ROUND",0),Yn("PROJECT",1),Yn("SQUARE",2),Zn("ROUND",0),Zn("MITER",1),Zn("BEVEL",2);const Kn={normalVert:"IN vec3 aPosition;\nIN vec3 aNormal;\nIN vec2 aTexCoord;\nIN vec4 aVertexColor;\n\n#define HOOK_DEFINES\n\n#ifdef AUGMENTED_HOOK_getWorldInputs\nuniform mat4 uModelMatrix;\nuniform mat4 uViewMatrix;\nuniform mat3 uModelNormalMatrix;\nuniform mat3 uCameraNormalMatrix;\n#else\nuniform mat4 uModelViewMatrix;\nuniform mat3 uNormalMatrix;\n#endif\nuniform mat4 uProjectionMatrix;\n\nuniform vec4 uMaterialColor;\nuniform bool uUseVertexColor;\n\nOUT vec3 vVertexNormal;\nOUT highp vec2 vVertTexCoord;\nOUT vec4 vColor;\n\nstruct Vertex {\n vec3 position;\n vec3 normal;\n vec2 texCoord;\n vec4 color;\n};\n\nvoid main(void) {\n HOOK_beforeVertex();\n\n Vertex inputs;\n inputs.position = aPosition;\n inputs.normal = aNormal;\n inputs.texCoord = aTexCoord;\n inputs.color = (uUseVertexColor && aVertexColor.x >= 0.0) ? aVertexColor : uMaterialColor;\n#ifdef AUGMENTED_HOOK_getObjectInputs\n inputs = HOOK_getObjectInputs(inputs);\n#endif\n\n#ifdef AUGMENTED_HOOK_getWorldInputs\n inputs.position = (uModelMatrix * vec4(inputs.position, 1.)).xyz;\n inputs.normal = uModelNormalMatrix * inputs.normal;\n inputs = HOOK_getWorldInputs(inputs);\n#endif\n\n#ifdef AUGMENTED_HOOK_getWorldInputs\n // Already multiplied by the model matrix, just apply view\n inputs.position = (uViewMatrix * vec4(inputs.position, 1.)).xyz;\n inputs.normal = uCameraNormalMatrix * inputs.normal;\n#else\n // Apply both at once\n inputs.position = (uModelViewMatrix * vec4(inputs.position, 1.)).xyz;\n inputs.normal = uNormalMatrix * inputs.normal;\n#endif\n#ifdef AUGMENTED_HOOK_getCameraInputs\n inputs = HOOK_getCameraInputs(inputs);\n#endif\n\n // Pass varyings to fragment shader\n vVertTexCoord = inputs.texCoord;\n vVertexNormal = normalize(inputs.normal);\n vColor = inputs.color;\n\n gl_Position = uProjectionMatrix * vec4(inputs.position, 1.);\n\n HOOK_afterVertex();\n}\n",normalFrag:"IN vec3 vVertexNormal;\nvoid main(void) {\n HOOK_beforeFragment();\n OUT_COLOR = HOOK_getFinalColor(vec4(vVertexNormal, 1.0));\n HOOK_afterFragment();\n}\n",basicFrag:"IN vec4 vColor;\nvoid main(void) {\n HOOK_beforeFragment();\n OUT_COLOR = HOOK_getFinalColor(vec4(vColor.rgb, 1.) * vColor.a);\n HOOK_afterFragment();\n}\n",sphereMappingFrag:"#define PI 3.141592\n\nprecision highp float;\n \nuniform sampler2D uEnvMap;\nuniform mat3 uNewNormalMatrix;\nuniform float uFovY;\nuniform float uAspect;\n\nvarying vec2 vTexCoord;\n \nvoid main() {\n float uFovX = uFovY * uAspect; \n float angleY = mix(uFovY/2.0, -uFovY/2.0, vTexCoord.y);\n float angleX = mix(uFovX/2.0, -uFovX/2.0, vTexCoord.x);\n vec3 rotatedNormal = vec3( angleX, angleY, 1.0 );\n rotatedNormal = uNewNormalMatrix * normalize(rotatedNormal);\n float temp = rotatedNormal.z;\n rotatedNormal.z = rotatedNormal.x;\n rotatedNormal.x = -temp;\n vec2 suv;\n suv.y = 0.5 + 0.5 * (-rotatedNormal.y);\n suv.x = atan(rotatedNormal.z, rotatedNormal.x) / (2.0 * PI) + 0.5;\n vec4 newTexColor = texture2D(uEnvMap, suv.xy);\n gl_FragColor = newTexColor;\n}\n",lightVert:Ln+"// include lighting.glgl\n\nIN vec3 aPosition;\nIN vec3 aNormal;\nIN vec2 aTexCoord;\nIN vec4 aVertexColor;\n\nuniform mat4 uModelViewMatrix;\nuniform mat4 uProjectionMatrix;\nuniform mat3 uNormalMatrix;\n\nuniform bool uUseVertexColor;\nuniform vec4 uMaterialColor;\n\nOUT highp vec2 vVertTexCoord;\nOUT vec3 vDiffuseColor;\nOUT vec3 vSpecularColor;\nOUT vec4 vColor;\n\nvoid main(void) {\n\n vec4 viewModelPosition = uModelViewMatrix * vec4(aPosition, 1.0);\n gl_Position = uProjectionMatrix * viewModelPosition;\n\n vec3 vertexNormal = normalize(uNormalMatrix * aNormal);\n vVertTexCoord = aTexCoord;\n\n totalLight(viewModelPosition.xyz, vertexNormal, vDiffuseColor, vSpecularColor);\n\n for (int i = 0; i < 8; i++) {\n if (i < uAmbientLightCount) {\n vDiffuseColor += uAmbientColor[i];\n }\n }\n \n vColor = ((uUseVertexColor && aVertexColor.x >= 0.0) ? aVertexColor : uMaterialColor);\n}\n",lightTextureFrag:"uniform vec4 uTint;\nuniform sampler2D uSampler;\nuniform bool isTexture;\nuniform bool uEmissive;\n\nIN highp vec2 vVertTexCoord;\nIN vec3 vDiffuseColor;\nIN vec3 vSpecularColor;\nIN vec4 vColor;\n\nvoid main(void) {\n if(uEmissive && !isTexture) {\n OUT_COLOR = vColor;\n }\n else {\n vec4 baseColor = isTexture\n // Textures come in with premultiplied alpha. To apply tint and still have\n // premultiplied alpha output, we need to multiply the RGB channels by the\n // tint RGB, and all channels by the tint alpha.\n ? TEXTURE(uSampler, vVertTexCoord) * vec4(uTint.rgb/255., 1.) * (uTint.a/255.)\n // Colors come in with unmultiplied alpha, so we need to multiply the RGB\n // channels by alpha to convert it to premultiplied alpha.\n : vec4(vColor.rgb * vColor.a, vColor.a);\n OUT_COLOR = vec4(baseColor.rgb * vDiffuseColor + vSpecularColor, baseColor.a);\n }\n}\n",phongVert:"precision highp int;\n\n#define HOOK_DEFINES\n\nIN vec3 aPosition;\nIN vec3 aNormal;\nIN vec2 aTexCoord;\nIN vec4 aVertexColor;\n\nuniform vec3 uAmbientColor[5];\n\n#ifdef AUGMENTED_HOOK_getWorldInputs\nuniform mat4 uModelMatrix;\nuniform mat4 uViewMatrix;\nuniform mat3 uModelNormalMatrix;\nuniform mat3 uCameraNormalMatrix;\n#else\nuniform mat4 uModelViewMatrix;\nuniform mat3 uNormalMatrix;\n#endif\nuniform mat4 uProjectionMatrix;\nuniform int uAmbientLightCount;\n\nuniform bool uUseVertexColor;\nuniform vec4 uMaterialColor;\n\nOUT vec3 vNormal;\nOUT vec2 vTexCoord;\nOUT vec3 vViewPosition;\nOUT vec3 vAmbientColor;\nOUT vec4 vColor;\n\nstruct Vertex {\n vec3 position;\n vec3 normal;\n vec2 texCoord;\n vec4 color;\n};\n\nvoid main(void) {\n HOOK_beforeVertex();\n\n Vertex inputs;\n inputs.position = aPosition;\n inputs.normal = aNormal;\n inputs.texCoord = aTexCoord;\n inputs.color = (uUseVertexColor && aVertexColor.x >= 0.0) ? aVertexColor : uMaterialColor;\n#ifdef AUGMENTED_HOOK_getObjectInputs\n inputs = HOOK_getObjectInputs(inputs);\n#endif\n\n#ifdef AUGMENTED_HOOK_getWorldInputs\n inputs.position = (uModelMatrix * vec4(inputs.position, 1.)).xyz;\n inputs.normal = uModelNormalMatrix * inputs.normal;\n inputs = HOOK_getWorldInputs(inputs);\n#endif\n\n#ifdef AUGMENTED_HOOK_getWorldInputs\n // Already multiplied by the model matrix, just apply view\n inputs.position = (uViewMatrix * vec4(inputs.position, 1.)).xyz;\n inputs.normal = uCameraNormalMatrix * inputs.normal;\n#else\n // Apply both at once\n inputs.position = (uModelViewMatrix * vec4(inputs.position, 1.)).xyz;\n inputs.normal = uNormalMatrix * inputs.normal;\n#endif\n#ifdef AUGMENTED_HOOK_getCameraInputs\n inputs = HOOK_getCameraInputs(inputs);\n#endif\n\n // Pass varyings to fragment shader\n vViewPosition = inputs.position;\n vTexCoord = inputs.texCoord;\n vNormal = inputs.normal;\n vColor = inputs.color;\n\n // TODO: this should be a uniform\n vAmbientColor = vec3(0.0);\n for (int i = 0; i < 5; i++) {\n if (i < uAmbientLightCount) {\n vAmbientColor += uAmbientColor[i];\n }\n }\n\n gl_Position = uProjectionMatrix * vec4(inputs.position, 1.);\n HOOK_afterVertex();\n}\n",phongFrag:Ln+"// include lighting.glsl\nprecision highp int;\n\nuniform bool uHasSetAmbient;\nuniform vec4 uSpecularMatColor;\nuniform vec4 uAmbientMatColor;\nuniform vec4 uEmissiveMatColor;\n\nuniform vec4 uTint;\nuniform sampler2D uSampler;\nuniform bool isTexture;\n\nIN vec3 vNormal;\nIN vec2 vTexCoord;\nIN vec3 vViewPosition;\nIN vec3 vAmbientColor;\nIN vec4 vColor;\n\nstruct ColorComponents {\n vec3 baseColor;\n float opacity;\n vec3 ambientColor;\n vec3 specularColor;\n vec3 diffuse;\n vec3 ambient;\n vec3 specular;\n vec3 emissive;\n};\n\nstruct Inputs {\n vec3 normal;\n vec2 texCoord;\n vec3 ambientLight;\n vec3 ambientMaterial;\n vec3 specularMaterial;\n vec3 emissiveMaterial;\n vec4 color;\n float shininess;\n float metalness;\n};\n\nvoid main(void) {\n HOOK_beforeFragment();\n\n Inputs inputs;\n inputs.normal = normalize(vNormal);\n inputs.texCoord = vTexCoord;\n inputs.ambientLight = vAmbientColor;\n inputs.color = isTexture\n ? TEXTURE(uSampler, vTexCoord) * (vec4(uTint.rgb/255., 1.) * uTint.a/255.)\n : vColor;\n if (isTexture && inputs.color.a > 0.0) {\n // Textures come in with premultiplied alpha. Temporarily unpremultiply it\n // so hooks users don't have to think about premultiplied alpha.\n inputs.color.rgb /= inputs.color.a;\n }\n inputs.shininess = uShininess;\n inputs.metalness = uMetallic;\n inputs.ambientMaterial = uHasSetAmbient ? uAmbientMatColor.rgb : inputs.color.rgb;\n inputs.specularMaterial = uSpecularMatColor.rgb;\n inputs.emissiveMaterial = uEmissiveMatColor.rgb;\n inputs = HOOK_getPixelInputs(inputs);\n\n vec3 diffuse;\n vec3 specular;\n totalLight(vViewPosition, inputs.normal, inputs.shininess, inputs.metalness, diffuse, specular);\n\n // Calculating final color as result of all lights (plus emissive term).\n\n vec2 texCoord = inputs.texCoord;\n vec4 baseColor = inputs.color;\n ColorComponents c;\n c.opacity = baseColor.a;\n c.baseColor = baseColor.rgb;\n c.ambientColor = inputs.ambientMaterial;\n c.specularColor = inputs.specularMaterial;\n c.diffuse = diffuse;\n c.ambient = inputs.ambientLight;\n c.specular = specular;\n c.emissive = inputs.emissiveMaterial;\n OUT_COLOR = HOOK_getFinalColor(HOOK_combineColors(c));\n OUT_COLOR.rgb *= OUT_COLOR.a; // Premultiply alpha before rendering\n HOOK_afterFragment();\n}\n",fontVert:"IN vec3 aPosition;\nIN vec2 aTexCoord;\nuniform mat4 uModelViewMatrix;\nuniform mat4 uProjectionMatrix;\n\nuniform vec4 uGlyphRect;\nuniform float uGlyphOffset;\n\nOUT vec2 vTexCoord;\nOUT float w;\n\nvoid main() {\n vec4 positionVec4 = vec4(aPosition, 1.0);\n\n // scale by the size of the glyph's rectangle\n positionVec4.xy *= uGlyphRect.zw - uGlyphRect.xy;\n\n // Expand glyph bounding boxes by 1px on each side to give a bit of room\n // for antialiasing\n vec3 newOrigin = (uModelViewMatrix * vec4(0., 0., 0., 1.)).xyz;\n vec3 newDX = (uModelViewMatrix * vec4(1., 0., 0., 1.)).xyz;\n vec3 newDY = (uModelViewMatrix * vec4(0., 1., 0., 1.)).xyz;\n vec2 pixelScale = vec2(\n 1. / length(newOrigin - newDX),\n 1. / length(newOrigin - newDY)\n );\n vec2 offset = pixelScale * normalize(aTexCoord - vec2(0.5, 0.5));\n vec2 textureOffset = offset * (1. / vec2(\n uGlyphRect.z - uGlyphRect.x,\n uGlyphRect.w - uGlyphRect.y\n ));\n\n // move to the corner of the glyph\n positionVec4.xy += uGlyphRect.xy;\n\n // move to the letter's line offset\n positionVec4.x += uGlyphOffset;\n\n positionVec4.xy += offset;\n \n gl_Position = uProjectionMatrix * uModelViewMatrix * positionVec4;\n vTexCoord = aTexCoord + textureOffset;\n w = gl_Position.w;\n}\n",fontFrag:"#ifndef WEBGL2\n#extension GL_OES_standard_derivatives : enable\n#endif\n\n#if 0\n // simulate integer math using floats\n\t#define int float\n\t#define ivec2 vec2\n\t#define INT(x) float(x)\n\n\tint ifloor(float v) { return floor(v); }\n\tivec2 ifloor(vec2 v) { return floor(v); }\n\n#else\n // use native integer math\n\tprecision highp int;\n\t#define INT(x) x\n\n\tint ifloor(float v) { return int(v); }\n\tint ifloor(int v) { return v; }\n\tivec2 ifloor(vec2 v) { return ivec2(v); }\n\n#endif\n\nuniform sampler2D uSamplerStrokes;\nuniform sampler2D uSamplerRowStrokes;\nuniform sampler2D uSamplerRows;\nuniform sampler2D uSamplerColStrokes;\nuniform sampler2D uSamplerCols;\n\nuniform ivec2 uStrokeImageSize;\nuniform ivec2 uCellsImageSize;\nuniform ivec2 uGridImageSize;\n\nuniform ivec2 uGridOffset;\nuniform ivec2 uGridSize;\nuniform vec4 uMaterialColor;\n\nIN vec2 vTexCoord;\n\n// some helper functions\nint ROUND(float v) { return ifloor(v + 0.5); }\nivec2 ROUND(vec2 v) { return ifloor(v + 0.5); }\nfloat saturate(float v) { return clamp(v, 0.0, 1.0); }\nvec2 saturate(vec2 v) { return clamp(v, 0.0, 1.0); }\n\nint mul(float v1, int v2) {\n return ifloor(v1 * float(v2));\n}\n\nivec2 mul(vec2 v1, ivec2 v2) {\n return ifloor(v1 * vec2(v2) + 0.5);\n}\n\n// unpack a 16-bit integer from a float vec2\nint getInt16(vec2 v) {\n ivec2 iv = ROUND(v * 255.0);\n return iv.x * INT(128) + iv.y;\n}\n\nvec2 pixelScale;\nvec2 coverage = vec2(0.0);\nvec2 weight = vec2(0.5);\nconst float minDistance = 1.0/8192.0;\nconst float hardness = 1.05; // amount of antialias\n\n// the maximum number of curves in a glyph\nconst int N = INT(250);\n\n// retrieves an indexed pixel from a sampler\nvec4 getTexel(sampler2D sampler, int pos, ivec2 size) {\n int width = size.x;\n int y = ifloor(pos / width);\n int x = pos - y * width; // pos % width\n\n return TEXTURE(sampler, (vec2(x, y) + 0.5) / vec2(size));\n}\n\nvoid calulateCrossings(vec2 p0, vec2 p1, vec2 p2, out vec2 C1, out vec2 C2) {\n\n // get the coefficients of the quadratic in t\n vec2 a = p0 - p1 * 2.0 + p2;\n vec2 b = p0 - p1;\n vec2 c = p0 - vTexCoord;\n\n // found out which values of 't' it crosses the axes\n vec2 surd = sqrt(max(vec2(0.0), b * b - a * c));\n vec2 t1 = ((b - surd) / a).yx;\n vec2 t2 = ((b + surd) / a).yx;\n\n // approximate straight lines to avoid rounding errors\n if (abs(a.y) < 0.001)\n t1.x = t2.x = c.y / (2.0 * b.y);\n\n if (abs(a.x) < 0.001)\n t1.y = t2.y = c.x / (2.0 * b.x);\n\n // plug into quadratic formula to find the corrdinates of the crossings\n C1 = ((a * t1 - b * 2.0) * t1 + c) * pixelScale;\n C2 = ((a * t2 - b * 2.0) * t2 + c) * pixelScale;\n}\n\nvoid coverageX(vec2 p0, vec2 p1, vec2 p2) {\n\n vec2 C1, C2;\n calulateCrossings(p0, p1, p2, C1, C2);\n\n // determine on which side of the x-axis the points lie\n bool y0 = p0.y > vTexCoord.y;\n bool y1 = p1.y > vTexCoord.y;\n bool y2 = p2.y > vTexCoord.y;\n\n // could web be under the curve (after t1)?\n if (y1 ? !y2 : y0) {\n // add the coverage for t1\n coverage.x += saturate(C1.x + 0.5);\n // calculate the anti-aliasing for t1\n weight.x = min(weight.x, abs(C1.x));\n }\n\n // are we outside the curve (after t2)?\n if (y1 ? !y0 : y2) {\n // subtract the coverage for t2\n coverage.x -= saturate(C2.x + 0.5);\n // calculate the anti-aliasing for t2\n weight.x = min(weight.x, abs(C2.x));\n }\n}\n\n// this is essentially the same as coverageX, but with the axes swapped\nvoid coverageY(vec2 p0, vec2 p1, vec2 p2) {\n\n vec2 C1, C2;\n calulateCrossings(p0, p1, p2, C1, C2);\n\n bool x0 = p0.x > vTexCoord.x;\n bool x1 = p1.x > vTexCoord.x;\n bool x2 = p2.x > vTexCoord.x;\n\n if (x1 ? !x2 : x0) {\n coverage.y -= saturate(C1.y + 0.5);\n weight.y = min(weight.y, abs(C1.y));\n }\n\n if (x1 ? !x0 : x2) {\n coverage.y += saturate(C2.y + 0.5);\n weight.y = min(weight.y, abs(C2.y));\n }\n}\n\nvoid main() {\n\n // calculate the pixel scale based on screen-coordinates\n pixelScale = hardness / fwidth(vTexCoord);\n\n // which grid cell is this pixel in?\n ivec2 gridCoord = ifloor(vTexCoord * vec2(uGridSize));\n\n // intersect curves in this row\n {\n // the index into the row info bitmap\n int rowIndex = gridCoord.y + uGridOffset.y;\n // fetch the info texel\n vec4 rowInfo = getTexel(uSamplerRows, rowIndex, uGridImageSize);\n // unpack the rowInfo\n int rowStrokeIndex = getInt16(rowInfo.xy);\n int rowStrokeCount = getInt16(rowInfo.zw);\n\n for (int iRowStroke = INT(0); iRowStroke < N; iRowStroke++) {\n if (iRowStroke >= rowStrokeCount)\n break;\n\n // each stroke is made up of 3 points: the start and control point\n // and the start of the next curve.\n // fetch the indices of this pair of strokes:\n vec4 strokeIndices = getTexel(uSamplerRowStrokes, rowStrokeIndex++, uCellsImageSize);\n\n // unpack the stroke index\n int strokePos = getInt16(strokeIndices.xy);\n\n // fetch the two strokes\n vec4 stroke0 = getTexel(uSamplerStrokes, strokePos + INT(0), uStrokeImageSize);\n vec4 stroke1 = getTexel(uSamplerStrokes, strokePos + INT(1), uStrokeImageSize);\n\n // calculate the coverage\n coverageX(stroke0.xy, stroke0.zw, stroke1.xy);\n }\n }\n\n // intersect curves in this column\n {\n int colIndex = gridCoord.x + uGridOffset.x;\n vec4 colInfo = getTexel(uSamplerCols, colIndex, uGridImageSize);\n int colStrokeIndex = getInt16(colInfo.xy);\n int colStrokeCount = getInt16(colInfo.zw);\n \n for (int iColStroke = INT(0); iColStroke < N; iColStroke++) {\n if (iColStroke >= colStrokeCount)\n break;\n\n vec4 strokeIndices = getTexel(uSamplerColStrokes, colStrokeIndex++, uCellsImageSize);\n\n int strokePos = getInt16(strokeIndices.xy);\n vec4 stroke0 = getTexel(uSamplerStrokes, strokePos + INT(0), uStrokeImageSize);\n vec4 stroke1 = getTexel(uSamplerStrokes, strokePos + INT(1), uStrokeImageSize);\n coverageY(stroke0.xy, stroke0.zw, stroke1.xy);\n }\n }\n\n weight = saturate(1.0 - weight * 2.0);\n float distance = max(weight.x + weight.y, minDistance); // manhattan approx.\n float antialias = abs(dot(coverage, weight) / distance);\n float cover = min(abs(coverage.x), abs(coverage.y));\n OUT_COLOR = vec4(uMaterialColor.rgb, 1.) * uMaterialColor.a;\n OUT_COLOR *= saturate(max(antialias, cover));\n}\n",lineVert:Xn+"/*\n Part of the Processing project - http://processing.org\n Copyright (c) 2012-15 The Processing Foundation\n Copyright (c) 2004-12 Ben Fry and Casey Reas\n Copyright (c) 2001-04 Massachusetts Institute of Technology\n This library is free software; you can redistribute it and/or\n modify it under the terms of the GNU Lesser General Public\n License as published by the Free Software Foundation, version 2.1.\n This library is distributed in the hope that it will be useful,\n but WITHOUT ANY WARRANTY; without even the implied warranty of\n MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n Lesser General Public License for more details.\n You should have received a copy of the GNU Lesser General\n Public License along with this library; if not, write to the\n Free Software Foundation, Inc., 59 Temple Place, Suite 330,\n Boston, MA 02111-1307 USA\n*/\n\n#define PROCESSING_LINE_SHADER\n\n#define HOOK_DEFINES\n\nprecision highp int;\nprecision highp float;\n\n#ifdef AUGMENTED_HOOK_getWorldInputs\nuniform mat4 uModelMatrix;\nuniform mat4 uViewMatrix;\n#else\nuniform mat4 uModelViewMatrix;\n#endif\n\nuniform mat4 uProjectionMatrix;\nuniform float uStrokeWeight;\n\nuniform bool uUseLineColor;\nuniform bool uSimpleLines;\nuniform vec4 uMaterialColor;\n\nuniform vec4 uViewport;\nuniform int uPerspective;\nuniform int uStrokeJoin;\n\nIN vec3 aPosition;\nIN vec3 aTangentIn;\nIN vec3 aTangentOut;\nIN float aSide;\nIN vec4 aVertexColor;\n\nOUT vec4 vColor;\nOUT vec2 vTangent;\nOUT vec2 vCenter;\nOUT vec2 vPosition;\nOUT float vMaxDist;\nOUT float vCap;\nOUT float vJoin;\nOUT float vStrokeWeight;\n\nvec2 lineIntersection(vec2 aPoint, vec2 aDir, vec2 bPoint, vec2 bDir) {\n // Rotate and translate so a starts at the origin and goes out to the right\n bPoint -= aPoint;\n vec2 rotatedBFrom = vec2(\n bPoint.x*aDir.x + bPoint.y*aDir.y,\n bPoint.y*aDir.x - bPoint.x*aDir.y\n );\n vec2 bTo = bPoint + bDir;\n vec2 rotatedBTo = vec2(\n bTo.x*aDir.x + bTo.y*aDir.y,\n bTo.y*aDir.x - bTo.x*aDir.y\n );\n float intersectionDistance =\n rotatedBTo.x + (rotatedBFrom.x - rotatedBTo.x) * rotatedBTo.y /\n (rotatedBTo.y - rotatedBFrom.y);\n return aPoint + aDir * intersectionDistance;\n}\n\nstruct StrokeVertex {\n vec3 position;\n vec3 tangentIn;\n vec3 tangentOut;\n vec4 color;\n float weight;\n};\n\nvoid main() {\n HOOK_beforeVertex();\n\n if (!uSimpleLines) {\n // Caps have one of either the in or out tangent set to 0\n vCap = (aTangentIn == vec3(0.)) != (aTangentOut == vec3(0.)) ? 1. : 0.;\n\n // Joins have two unique, defined tangents\n vJoin = (\n aTangentIn != vec3(0.) &&\n aTangentOut != vec3(0.) &&\n aTangentIn != aTangentOut\n ) ? 1. : 0.;\n }\n\n StrokeVertex inputs;\n inputs.position = aPosition.xyz;\n inputs.color = uUseLineColor ? aVertexColor : uMaterialColor;\n inputs.weight = uStrokeWeight;\n inputs.tangentIn = aTangentIn;\n inputs.tangentOut = aTangentOut;\n\n#ifdef AUGMENTED_HOOK_getObjectInputs\n inputs = HOOK_getObjectInputs(inputs);\n#endif\n\n#ifdef AUGMENTED_HOOK_getWorldInputs\n inputs.position = (uModelMatrix * vec4(inputs.position, 1.)).xyz;\n inputs.tangentIn = (uModelMatrix * vec4(aTangentIn, 0.)).xyz;\n inputs.tangentOut = (uModelMatrix * vec4(aTangentOut, 0.)).xyz;\n inputs = HOOK_getWorldInputs(inputs);\n#endif\n\n#ifdef AUGMENTED_HOOK_getWorldInputs\n // Already multiplied by the model matrix, just apply view\n inputs.position = (uViewMatrix * vec4(inputs.position, 1.)).xyz;\n inputs.tangentIn = (uViewMatrix * vec4(aTangentIn, 0.)).xyz;\n inputs.tangentOut = (uViewMatrix * vec4(aTangentOut, 0.)).xyz;\n#else\n // Apply both at once\n inputs.position = (uModelViewMatrix * vec4(inputs.position, 1.)).xyz;\n inputs.tangentIn = (uModelViewMatrix * vec4(aTangentIn, 0.)).xyz;\n inputs.tangentOut = (uModelViewMatrix * vec4(aTangentOut, 0.)).xyz;\n#endif\n#ifdef AUGMENTED_HOOK_getCameraInputs\n inputs = hook_getCameraInputs(inputs);\n#endif\n\n vec4 posp = vec4(inputs.position, 1.);\n vec4 posqIn = vec4(inputs.position + inputs.tangentIn, 1.);\n vec4 posqOut = vec4(inputs.position + inputs.tangentOut, 1.);\n vStrokeWeight = inputs.weight;\n\n float facingCamera = pow(\n // The word space tangent's z value is 0 if it's facing the camera\n abs(normalize(posqIn-posp).z),\n\n // Using pow() here to ramp `facingCamera` up from 0 to 1 really quickly\n // so most lines get scaled and don't get clipped\n 0.25\n );\n\n // Moving vertices slightly toward the camera\n // to avoid depth-fighting with the fill triangles.\n // A mix of scaling and offsetting is used based on distance\n // Discussion here:\n // https://github.com/processing/p5.js/issues/7200 \n\n // using a scale <1 moves the lines towards nearby camera\n // in order to prevent popping effects due to half of\n // the line disappearing behind the geometry faces.\n float zDistance = -posp.z; \n float distanceFactor = smoothstep(0.0, 800.0, zDistance); \n \n // Discussed here:\n // http://www.opengl.org/discussion_boards/ubbthreads.php?ubb=showflat&Number=252848 \n float scale = mix(1., 0.995, facingCamera);\n float dynamicScale = mix(scale, 1.0, distanceFactor); // Closer = more scale, farther = less\n\n posp.xyz = posp.xyz * dynamicScale;\n posqIn.xyz = posqIn.xyz * dynamicScale;\n posqOut.xyz = posqOut.xyz * dynamicScale;\n\n // Moving vertices slightly toward camera when far away \n // https://github.com/processing/p5.js/issues/6956 \n float zOffset = mix(0., -1., facingCamera);\n float dynamicZAdjustment = mix(0.0, zOffset, distanceFactor); // Closer = less zAdjustment, farther = more\n\n posp.z -= dynamicZAdjustment;\n posqIn.z -= dynamicZAdjustment;\n posqOut.z -= dynamicZAdjustment;\n \n vec4 p = uProjectionMatrix * posp;\n vec4 qIn = uProjectionMatrix * posqIn;\n vec4 qOut = uProjectionMatrix * posqOut;\n\n // formula to convert from clip space (range -1..1) to screen space (range 0..[width or height])\n // screen_p = (p.xy/p.w + <1,1>) * 0.5 * uViewport.zw\n\n // prevent division by W by transforming the tangent formula (div by 0 causes\n // the line to disappear, see https://github.com/processing/processing/issues/5183)\n // t = screen_q - screen_p\n //\n // tangent is normalized and we don't care which aDirection it points to (+-)\n // t = +- normalize( screen_q - screen_p )\n // t = +- normalize( (q.xy/q.w+<1,1>)*0.5*uViewport.zw - (p.xy/p.w+<1,1>)*0.5*uViewport.zw )\n //\n // extract common factor, <1,1> - <1,1> cancels out\n // t = +- normalize( (q.xy/q.w - p.xy/p.w) * 0.5 * uViewport.zw )\n //\n // convert to common divisor\n // t = +- normalize( ((q.xy*p.w - p.xy*q.w) / (p.w*q.w)) * 0.5 * uViewport.zw )\n //\n // remove the common scalar divisor/factor, not needed due to normalize and +-\n // (keep uViewport - can't remove because it has different components for x and y\n // and corrects for aspect ratio, see https://github.com/processing/processing/issues/5181)\n // t = +- normalize( (q.xy*p.w - p.xy*q.w) * uViewport.zw )\n\n vec2 tangentIn = normalize((qIn.xy*p.w - p.xy*qIn.w) * uViewport.zw);\n vec2 tangentOut = normalize((qOut.xy*p.w - p.xy*qOut.w) * uViewport.zw);\n\n vec2 curPerspScale;\n if(uPerspective == 1) {\n // Perspective ---\n // convert from world to clip by multiplying with projection scaling factor\n // to get the right thickness (see https://github.com/processing/processing/issues/5182)\n\n // The y value of the projection matrix may be flipped if rendering to a Framebuffer.\n // Multiplying again by its sign here negates the flip to get just the scale.\n curPerspScale = (uProjectionMatrix * vec4(1, sign(uProjectionMatrix[1][1]), 0, 0)).xy;\n } else {\n // No Perspective ---\n // multiply by W (to cancel out division by W later in the pipeline) and\n // convert from screen to clip (derived from clip to screen above)\n curPerspScale = p.w / (0.5 * uViewport.zw);\n }\n\n vec2 offset;\n if (vJoin == 1. && !uSimpleLines) {\n vTangent = normalize(tangentIn + tangentOut);\n vec2 normalIn = vec2(-tangentIn.y, tangentIn.x);\n vec2 normalOut = vec2(-tangentOut.y, tangentOut.x);\n float side = sign(aSide);\n float sideEnum = abs(aSide);\n\n // We generate vertices for joins on either side of the centerline, but\n // the \"elbow\" side is the only one needing a join. By not setting the\n // offset for the other side, all its vertices will end up in the same\n // spot and not render, effectively discarding it.\n if (sign(dot(tangentOut, vec2(-tangentIn.y, tangentIn.x))) != side) {\n // Side enums:\n // 1: the side going into the join\n // 2: the middle of the join\n // 3: the side going out of the join\n if (sideEnum == 2.) {\n // Calculate the position + tangent on either side of the join, and\n // find where the lines intersect to find the elbow of the join\n vec2 c = (posp.xy/posp.w + vec2(1.,1.)) * 0.5 * uViewport.zw;\n vec2 intersection = lineIntersection(\n c + (side * normalIn * inputs.weight / 2.),\n tangentIn,\n c + (side * normalOut * inputs.weight / 2.),\n tangentOut\n );\n offset = (intersection - c);\n\n // When lines are thick and the angle of the join approaches 180, the\n // elbow might be really far from the center. We'll apply a limit to\n // the magnitude to avoid lines going across the whole screen when this\n // happens.\n float mag = length(offset);\n float maxMag = 3. * inputs.weight;\n if (mag > maxMag) {\n offset *= maxMag / mag;\n }\n } else if (sideEnum == 1.) {\n offset = side * normalIn * inputs.weight / 2.;\n } else if (sideEnum == 3.) {\n offset = side * normalOut * inputs.weight / 2.;\n }\n }\n if (uStrokeJoin == STROKE_JOIN_BEVEL) {\n vec2 avgNormal = vec2(-vTangent.y, vTangent.x);\n vMaxDist = abs(dot(avgNormal, normalIn * inputs.weight / 2.));\n } else {\n vMaxDist = inputs.weight / 2.;\n }\n } else {\n vec2 tangent = aTangentIn == vec3(0.) ? tangentOut : tangentIn;\n vTangent = tangent;\n vec2 normal = vec2(-tangent.y, tangent.x);\n\n float normalOffset = sign(aSide);\n // Caps will have side values of -2 or 2 on the edge of the cap that\n // extends out from the line\n float tangentOffset = abs(aSide) - 1.;\n offset = (normal * normalOffset + tangent * tangentOffset) *\n inputs.weight * 0.5;\n vMaxDist = inputs.weight / 2.;\n }\n\n vCenter = p.xy;\n vPosition = vCenter + offset;\n vColor = inputs.color;\n\n gl_Position.xy = p.xy + offset.xy * curPerspScale;\n gl_Position.zw = p.zw;\n \n HOOK_afterVertex();\n}\n",lineFrag:Xn+"precision highp int;\nprecision highp float;\n\nuniform vec4 uMaterialColor;\nuniform int uStrokeCap;\nuniform int uStrokeJoin;\n\nIN vec4 vColor;\nIN vec2 vTangent;\nIN vec2 vCenter;\nIN vec2 vPosition;\nIN float vStrokeWeight;\nIN float vMaxDist;\nIN float vCap;\nIN float vJoin;\n\nfloat distSquared(vec2 a, vec2 b) {\n vec2 aToB = b - a;\n return dot(aToB, aToB);\n}\n\nstruct Inputs {\n vec4 color;\n vec2 tangent;\n vec2 center;\n vec2 position;\n float strokeWeight;\n};\n\nvoid main() {\n HOOK_beforeFragment();\n\n Inputs inputs;\n inputs.color = vColor;\n inputs.tangent = vTangent;\n inputs.center = vCenter;\n inputs.position = vPosition;\n inputs.strokeWeight = vStrokeWeight;\n inputs = HOOK_getPixelInputs(inputs);\n\n if (vCap > 0.) {\n if (\n uStrokeCap == STROKE_CAP_ROUND &&\n HOOK_shouldDiscard(distSquared(inputs.position, inputs.center) > inputs.strokeWeight * inputs.strokeWeight * 0.25)\n ) {\n discard;\n } else if (\n uStrokeCap == STROKE_CAP_SQUARE &&\n HOOK_shouldDiscard(dot(inputs.position - inputs.center, inputs.tangent) > 0.)\n ) {\n discard;\n // Use full area for PROJECT\n } else if (HOOK_shouldDiscard(false)) {\n discard;\n }\n } else if (vJoin > 0.) {\n if (\n uStrokeJoin == STROKE_JOIN_ROUND &&\n HOOK_shouldDiscard(distSquared(inputs.position, inputs.center) > inputs.strokeWeight * inputs.strokeWeight * 0.25)\n ) {\n discard;\n } else if (uStrokeJoin == STROKE_JOIN_BEVEL) {\n vec2 normal = vec2(-inputs.tangent.y, inputs.tangent.x);\n if (HOOK_shouldDiscard(abs(dot(inputs.position - inputs.center, normal)) > vMaxDist)) {\n discard;\n }\n // Use full area for MITER\n } else if (HOOK_shouldDiscard(false)) {\n discard;\n }\n }\n OUT_COLOR = HOOK_getFinalColor(vec4(inputs.color.rgb, 1.) * inputs.color.a);\n HOOK_afterFragment();\n}\n",pointVert:"IN vec3 aPosition;\nuniform float uPointSize;\nOUT float vStrokeWeight;\nuniform mat4 uModelViewMatrix;\nuniform mat4 uProjectionMatrix;\n\nvoid main() {\n HOOK_beforeVertex();\n vec4 viewModelPosition = vec4(HOOK_getWorldPosition(\n (uModelViewMatrix * vec4(HOOK_getLocalPosition(aPosition), 1.0)).xyz\n ), 1.);\n gl_Position = uProjectionMatrix * viewModelPosition; \n\n float pointSize = HOOK_getPointSize(uPointSize);\n\n\tgl_PointSize = pointSize;\n\tvStrokeWeight = pointSize;\n HOOK_afterVertex();\n}\n",pointFrag:"precision mediump int;\nuniform vec4 uMaterialColor;\nIN float vStrokeWeight;\n\nvoid main(){\n HOOK_beforeFragment();\n float mask = 0.0;\n\n // make a circular mask using the gl_PointCoord (goes from 0 - 1 on a point)\n // might be able to get a nicer edge on big strokeweights with smoothstep but slightly less performant\n\n mask = step(0.98, length(gl_PointCoord * 2.0 - 1.0));\n\n // if strokeWeight is 1 or less lets just draw a square\n // this prevents weird artifacting from carving circles when our points are really small\n // if strokeWeight is larger than 1, we just use it as is\n\n mask = mix(0.0, mask, clamp(floor(vStrokeWeight - 0.5),0.0,1.0));\n\n // throw away the borders of the mask\n // otherwise we get weird alpha blending issues\n\n if(HOOK_shouldDiscard(mask > 0.98)){\n discard;\n }\n\n OUT_COLOR = HOOK_getFinalColor(vec4(uMaterialColor.rgb, 1.) * uMaterialColor.a);\n HOOK_afterFragment();\n}\n",imageLightVert:"precision highp float;\nattribute vec3 aPosition;\nattribute vec3 aNormal;\nattribute vec2 aTexCoord;\n\nvarying vec3 localPos;\nvarying vec3 vWorldNormal;\nvarying vec3 vWorldPosition;\nvarying vec2 vTexCoord;\n\nuniform mat4 uModelViewMatrix;\nuniform mat4 uProjectionMatrix;\nuniform mat3 uNormalMatrix;\n\nvoid main() {\n // Multiply the position by the matrix.\n vec4 viewModelPosition = uModelViewMatrix * vec4(aPosition, 1.0);\n gl_Position = uProjectionMatrix * viewModelPosition; \n \n // orient the normals and pass to the fragment shader\n vWorldNormal = uNormalMatrix * aNormal;\n \n // send the view position to the fragment shader\n vWorldPosition = (uModelViewMatrix * vec4(aPosition, 1.0)).xyz;\n \n localPos = vWorldPosition;\n vTexCoord = aTexCoord;\n}\n\n\n/*\nin the vertex shader we'll compute the world position and world oriented normal of the vertices and pass those to the fragment shader as varyings.\n*/\n",imageLightDiffusedFrag:"precision highp float;\nvarying vec3 localPos;\n\n// the HDR cubemap converted (can be from an equirectangular environment map.)\nuniform sampler2D environmentMap;\nvarying vec2 vTexCoord;\n\nconst float PI = 3.14159265359;\n\nvec2 nTOE( vec3 v ){\n // x = r sin(phi) cos(theta) \n // y = r cos(phi) \n // z = r sin(phi) sin(theta)\n float phi = acos( v.y );\n // if phi is 0, then there are no x, z components\n float theta = 0.0;\n // else \n theta = acos(v.x / sin(phi));\n float sinTheta = v.z / sin(phi);\n if (sinTheta < 0.0) {\n // Turn it into -theta, but in the 0-2PI range\n theta = 2.0 * PI - theta;\n }\n theta = theta / (2.0 * 3.14159);\n phi = phi / 3.14159 ;\n \n vec2 angles = vec2( phi, theta );\n return angles;\n}\n\nfloat random(vec2 p) {\n vec3 p3 = fract(vec3(p.xyx) * .1031);\n p3 += dot(p3, p3.yzx + 33.33);\n return fract((p3.x + p3.y) * p3.z);\n}\n\nvoid main()\n{ \t \n\t// the sample direction equals the hemisphere's orientation\n float phi = vTexCoord.x * 2.0 * PI;\n float theta = vTexCoord.y * PI;\n float x = sin(theta) * cos(phi);\n float y = sin(theta) * sin(phi);\n float z = cos(theta);\n vec3 normal = vec3( x, y, z);\n\n\t// Discretely sampling the hemisphere given the integral's\n // spherical coordinates translates to the following fragment code:\n\tvec3 irradiance = vec3(0.0); \n\tvec3 up\t= vec3(0.0, 1.0, 0.0);\n\tvec3 right = normalize(cross(up, normal));\n\tup = normalize(cross(normal, right));\n\n\t// We specify a fixed sampleDelta delta value to traverse\n // the hemisphere; decreasing or increasing the sample delta\n // will increase or decrease the accuracy respectively.\n\tconst float sampleDelta = 0.100;\n\tfloat nrSamples = 0.0;\n float randomOffset = random(gl_FragCoord.xy) * sampleDelta;\n\tfor(float rawPhi = 0.0; rawPhi < 2.0 * PI; rawPhi += sampleDelta)\n\t{\n float phi = rawPhi + randomOffset;\n for(float rawTheta = 0.0; rawTheta < ( 0.5 ) * PI; rawTheta += sampleDelta)\n {\n float theta = rawTheta + randomOffset;\n // spherical to cartesian (in tangent space) // tangent space to world // add each sample result to irradiance\n float x = sin(theta) * cos(phi);\n float y = sin(theta) * sin(phi);\n float z = cos(theta);\n vec3 tangentSample = vec3( x, y, z);\n \n vec3 sampleVec = tangentSample.x * right + tangentSample.y * up + tangentSample.z * normal;\n irradiance += (texture2D(environmentMap, nTOE(sampleVec)).xyz) * cos(theta) * sin(theta);\n nrSamples++;\n }\n\t}\n\t// divide by the total number of samples taken, giving us the average sampled irradiance.\n\tirradiance = PI * irradiance * (1.0 / float(nrSamples )) ;\n \n \n\tgl_FragColor = vec4(irradiance, 1.0);\n}",imageLightSpecularFrag:"precision highp float;\r\nvarying vec3 localPos;\r\nvarying vec2 vTexCoord;\r\n\r\n// our texture\r\nuniform sampler2D environmentMap;\r\nuniform float roughness;\r\n\r\nconst float PI = 3.14159265359;\r\n\r\nfloat VanDerCorput(int bits);\r\nvec2 HammersleyNoBitOps(int i, int N);\r\nvec3 ImportanceSampleGGX(vec2 Xi, vec3 N, float roughness);\r\n\r\n\r\nvec2 nTOE( vec3 v ){\r\n // x = r sin(phi) cos(theta) \r\n // y = r cos(phi) \r\n // z = r sin(phi) sin(theta)\r\n float phi = acos( v.y );\r\n // if phi is 0, then there are no x, z components\r\n float theta = 0.0;\r\n // else \r\n theta = acos(v.x / sin(phi));\r\n float sinTheta = v.z / sin(phi);\r\n if (sinTheta < 0.0) {\r\n // Turn it into -theta, but in the 0-2PI range\r\n theta = 2.0 * PI - theta;\r\n }\r\n theta = theta / (2.0 * 3.14159);\r\n phi = phi / 3.14159 ;\r\n \r\n vec2 angles = vec2( phi, theta );\r\n return angles;\r\n}\r\n\r\n\r\nvoid main(){\r\n const int SAMPLE_COUNT = 400; // 4096\r\n int lowRoughnessLimit = int(pow(2.0,(roughness+0.1)*20.0));\r\n float totalWeight = 0.0;\r\n vec3 prefilteredColor = vec3(0.0);\r\n float phi = vTexCoord.x * 2.0 * PI;\r\n float theta = vTexCoord.y * PI;\r\n float x = sin(theta) * cos(phi);\r\n float y = sin(theta) * sin(phi);\r\n float z = cos(theta);\r\n vec3 N = vec3(x,y,z);\r\n vec3 V = N;\r\n for (int i = 0; i < SAMPLE_COUNT; ++i)\r\n {\r\n // break at smaller sample numbers for low roughness levels\r\n if(i == lowRoughnessLimit)\r\n {\r\n break;\r\n }\r\n vec2 Xi = HammersleyNoBitOps(i, SAMPLE_COUNT);\r\n vec3 H = ImportanceSampleGGX(Xi, N, roughness);\r\n vec3 L = normalize(2.0 * dot(V, H) * H - V);\r\n\r\n float NdotL = max(dot(N, L), 0.0);\r\n if (NdotL > 0.0)\r\n {\r\n prefilteredColor += texture2D(environmentMap, nTOE(L)).xyz * NdotL;\r\n totalWeight += NdotL;\r\n }\r\n }\r\n prefilteredColor = prefilteredColor / totalWeight;\r\n\r\n gl_FragColor = vec4(prefilteredColor, 1.0);\r\n}\r\n\r\nvec3 ImportanceSampleGGX(vec2 Xi, vec3 N, float roughness){\r\n float a = roughness * roughness;\r\n\r\n float phi = 2.0 * PI * Xi.x;\r\n float cosTheta = sqrt((1.0 - Xi.y) / (1.0 + (a * a - 1.0) * Xi.y));\r\n float sinTheta = sqrt(1.0 - cosTheta * cosTheta);\r\n // from spherical coordinates to cartesian coordinates\r\n vec3 H;\r\n H.x = cos(phi) * sinTheta;\r\n H.y = sin(phi) * sinTheta;\r\n H.z = cosTheta;\r\n\r\n // from tangent-space vector to world-space sample vector\r\n vec3 up = abs(N.z) < 0.999 ? vec3(0.0, 0.0, 1.0) : vec3(1.0, 0.0, 0.0);\r\n vec3 tangent = normalize(cross(up, N));\r\n vec3 bitangent = cross(N, tangent);\r\n\r\n vec3 sampleVec = tangent * H.x + bitangent * H.y + N * H.z;\r\n return normalize(sampleVec);\r\n}\r\n\r\n\r\nfloat VanDerCorput(int n, int base)\r\n{\r\n#ifdef WEBGL2\r\n\r\n uint bits = uint(n);\r\n bits = (bits << 16u) | (bits >> 16u);\r\n bits = ((bits & 0x55555555u) << 1u) | ((bits & 0xAAAAAAAAu) >> 1u);\r\n bits = ((bits & 0x33333333u) << 2u) | ((bits & 0xCCCCCCCCu) >> 2u);\r\n bits = ((bits & 0x0F0F0F0Fu) << 4u) | ((bits & 0xF0F0F0F0u) >> 4u);\r\n bits = ((bits & 0x00FF00FFu) << 8u) | ((bits & 0xFF00FF00u) >> 8u);\r\n return float(bits) * 2.3283064365386963e-10; // / 0x100000000\r\n\r\n#else\r\n\r\n float invBase = 1.0 / float(base);\r\n float denom = 1.0;\r\n float result = 0.0;\r\n\r\n\r\n for (int i = 0; i < 32; ++i)\r\n {\r\n if (n > 0)\r\n {\r\n denom = mod(float(n), 2.0);\r\n result += denom * invBase;\r\n invBase = invBase / 2.0;\r\n n = int(float(n) / 2.0);\r\n }\r\n }\r\n\r\n\r\n return result;\r\n\r\n#endif\r\n}\r\n\r\nvec2 HammersleyNoBitOps(int i, int N)\r\n{\r\n return vec2(float(i) / float(N), VanDerCorput(i, 2));\r\n}\r\n",filterBaseVert:Bn,filterBaseFrag:On};let Jn=Kn.sphereMappingFrag;for(const e in Kn)Kn[e]=Pn+Kn[e];const Qn={[ae]:Nn,[ce]:Rn,[le]:Vn,[pe]:Un,[ue]:Gn,[oe]:zn,[he]:jn,[ne]:$n};class ea extends xs{constructor(e,t,i,r,s,a){super(e,t,i,r),this.canvas=this.elt=s||document.createElement("canvas"),this._setAttributeDefaults(e),this._initContext(),this.GL=this.drawingContext,this._isMainCanvas?(this._pInst._curElement=this,this._pInst.canvas=this.canvas):this.canvas.style.display="none",this.elt.id="defaultCanvas0",this.elt.classList.add("p5Canvas"),this.wrappedElt=new Mr(this.elt,this._pInst);for(const e of Object.getOwnPropertyNames(Mr.prototype))"constructor"!==e&&"_"!==e[0]&&Object.defineProperty(this,e,{get(){return this.wrappedElt[e]}});const o=this._adjustDimensions(t,i);if(t=o.adjustedWidth,i=o.adjustedHeight,this.width=t,this.height=i,this.elt.width=t*this._pixelDensity,this.elt.height=i*this._pixelDensity,this.elt.style.width=`${t}px`,this.elt.style.height=`${i}px`,this._origViewport={width:this.GL.drawingBufferWidth,height:this.GL.drawingBufferHeight},this.viewport(this._origViewport.width,this._origViewport.height),this._pInst._userNode)this._pInst._userNode.appendChild(this.elt);else{if(0===document.getElementsByTagName("main").length){let e=document.createElement("main");document.body.appendChild(e)}document.getElementsByTagName("main")[0].appendChild(this.elt)}this.isP3D=!0,this.geometryBuilder=void 0,this.states.uModelMatrix=new ln(4),this.states.uViewMatrix=new ln(4),this.states.uPMatrix=new ln(4),this.states.curCamera=new bn(this),this.states.uPMatrix.set(this.states.curCamera.projMatrix),this.states.uViewMatrix.set(this.states.curCamera.cameraMatrix),this.states.enableLighting=!1,this.states.ambientLightColors=[],this.states.specularColors=[1,1,1],this.states.directionalLightDirections=[],this.states.directionalLightDiffuseColors=[],this.states.directionalLightSpecularColors=[],this.states.pointLightPositions=[],this.states.pointLightDiffuseColors=[],this.states.pointLightSpecularColors=[],this.states.spotLightPositions=[],this.states.spotLightDirections=[],this.states.spotLightDiffuseColors=[],this.states.spotLightSpecularColors=[],this.states.spotLightAngle=[],this.states.spotLightConc=[],this.states.activeImageLight=null,this.states.curFillColor=[1,1,1,1],this.states.curAmbientColor=[1,1,1,1],this.states.curSpecularColor=[0,0,0,0],this.states.curEmissiveColor=[0,0,0,0],this.states.curStrokeColor=[0,0,0,1],this.states.curBlendMode=j,this.states._hasSetAmbient=!1,this.states._useSpecularMaterial=!1,this.states._useEmissiveMaterial=!1,this.states._useNormalMaterial=!1,this.states._useShininess=1,this.states._useMetalness=0,this.states.tint=[255,255,255,255],this.states.constantAttenuation=1,this.states.linearAttenuation=0,this.states.quadraticAttenuation=0,this.states._currentNormal=new je(0,0,1),this.states.drawMode=me,this.states._tex=null,this.states.textureMode=xe,this.states.textureWrapX=_e,this.states.textureWrapY=_e,this._isErasing=!1,this._simpleLines=!1,this._clipDepths=[],this._isClipApplied=!1,this._stencilTestOn=!1,this.mixedAmbientLight=[],this.mixedSpecularColor=[],this.diffusedTextures=new Map,this.specularTextures=new Map,this.preEraseBlend=void 0,this._cachedBlendMode=void 0,this._cachedFillStyle=[1,1,1,1],this._cachedStrokeStyle=[0,0,0,1],this.webglVersion===n?this.blendExt=this.GL:this.blendExt=this.GL.getExtension("EXT_blend_minmax"),this._isBlending=!1,this._useLineColor=!1,this._useVertexColor=!1,this.registerEnabled=new Set,this.states.curCamera._computeCameraDefaultSettings(),this.states.curCamera._setDefaultCamera(),this.filterCamera=new bn(this),this.filterCamera._computeCameraDefaultSettings(),this.filterCamera._setDefaultCamera(),this.prevTouches=[],this.zoomVelocity=0,this.rotateVelocity=new je(0,0),this.moveVelocity=new je(0,0),this.executeZoom=!1,this.executeRotateAndMove=!1,this._drawingFilter=!1,this._drawingImage=!1,this.specularShader=void 0,this.sphereMapping=void 0,this.diffusedShader=void 0,this._baseFilterShader=void 0,this._defaultLightShader=void 0,this._defaultImmediateModeShader=void 0,this._defaultNormalShader=void 0,this._defaultColorShader=void 0,this._defaultPointShader=void 0,this.states.userFillShader=void 0,this.states.userStrokeShader=void 0,this.states.userPointShader=void 0,this.states.userImageShader=void 0,this.states.curveDetail=1/4,this.shapeBuilder=new Mn(this),this.buffers={fill:[new wn(3,"vertices","vertexBuffer","aPosition",this,this._vToNArray),new wn(3,"vertexNormals","normalBuffer","aNormal",this,this._vToNArray),new wn(4,"vertexColors","colorBuffer","aVertexColor",this),new wn(3,"vertexAmbients","ambientBuffer","aAmbientColor",this),new wn(2,"uvs","uvBuffer","aTexCoord",this,(e=>e.flat()))],stroke:[new wn(4,"lineVertexColors","lineColorBuffer","aVertexColor",this),new wn(3,"lineVertices","lineVerticesBuffer","aPosition",this),new wn(3,"lineTangentsIn","lineTangentsInBuffer","aTangentIn",this),new wn(3,"lineTangentsOut","lineTangentsOutBuffer","aTangentOut",this),new wn(1,"lineSides","lineSidesBuffer","aSide",this)],text:[new wn(3,"vertices","vertexBuffer","aPosition",this,this._vToNArray),new wn(2,"uvs","uvBuffer","aTexCoord",this,(e=>e.flat()))],point:this.GL.createBuffer(),user:[]},this.geometryBufferCache=new kn(this),this.curStrokeCap=V,this.curStrokeJoin=V,this.textures=new Map,this.framebuffers=new Set,this.activeFramebuffers=[],this.states.filterShader=void 0,this.filterLayer=void 0,this.filterLayerTemp=void 0,this.defaultFilterShaders={},this.fontInfos={},this._curShader=void 0,this.drawShapeCount=1,this.scratchMat3=new ln(3),this._userEnabledStencil=!1,this._internalEnable=this.drawingContext.enable,this._internalDisable=this.drawingContext.disable,this.drawingContext.enable=e=>(e===this.drawingContext.STENCIL_TEST&&(this._clipping||(this._userEnabledStencil=!0)),this._internalEnable.call(this.drawingContext,e)),this.drawingContext.disable=e=>(e===this.drawingContext.STENCIL_TEST&&(this._userEnabledStencil=!1),this._internalDisable.call(this.drawingContext,e))}remove(){this.wrappedElt.remove(),this.wrappedElt=null,this.canvas=null,this.elt=null}beginGeometry(){if(this.geometryBuilder)throw new Error("It looks like `beginGeometry()` is being called while another p5.Geometry is already being build.");this.geometryBuilder=new yn(this),this.geometryBuilder.prevFillColor=this.states.fillColor,this.fill(new pr([-1,-1,-1,-1]))}endGeometry(){if(!this.geometryBuilder)throw new Error("Make sure you call beginGeometry() before endGeometry()!");const e=this.geometryBuilder.finish();return this.fill(this.geometryBuilder.prevFillColor),this.geometryBuilder=void 0,e}buildGeometry(e){return this.beginGeometry(),e(),this.endGeometry()}beginShape(...e){super.beginShape(...e)}curveDetail(e){if(void 0===e)return this.states.curveDetail;this.states.setValue("curveDetail",e)}drawShape(e){const t=new ds({curveDetail:this.states.curveDetail});e.accept(t),this.shapeBuilder.constructFromContours(e,t.contours),this.geometryBuilder?this.geometryBuilder.addImmediate(this.shapeBuilder.geometry,this.shapeBuilder.shapeMode):(this.states.fillColor||this.states.strokeColor)&&(this.shapeBuilder.shapeMode===T?this._drawPoints(this.shapeBuilder.geometry.vertices,this.buffers.point):this._drawGeometry(this.shapeBuilder.geometry,{mode:this.shapeBuilder.shapeMode,count:this.drawShapeCount})),this.drawShapeCount=1}endShape(e,t){this.drawShapeCount=t,super.endShape(e,t)}vertexProperty(...e){this.currentShape.vertexProperty(...e)}normal(e,t,i){e instanceof je?this.states.setValue("_currentNormal",e):this.states.setValue("_currentNormal",new je(e,t,i)),this.updateShapeVertexProperties()}model(e,t=1){e.vertices.length>0&&(this.geometryBuilder?this.geometryBuilder.addRetained(e):(this.geometryInHash(e.gid)||(e._edgesToVertices(),this._getOrMakeCachedBuffers(e)),this._drawGeometry(e,{count:t})))}_drawGeometry(e,{mode:t=4,count:i=1}={}){for(const t in e.userVertexProperties){const i=e.userVertexProperties[t];this.buffers.user.push(new wn(i.getDataSize(),i.getSrcName(),i.getDstName(),i.getName(),this))}this.states.fillColor&&e.vertices.length>=3&&![M,T].includes(t)&&this._drawFills(e,{mode:t,count:i}),this.states.strokeColor&&e.lineVertices.length>=1&&this._drawStrokes(e,{count:i}),this.buffers.user=[]}_drawGeometryScaled(e,t,i,r){let s=this.states.uModelMatrix;this.states.setValue("uModelMatrix",this.states.uModelMatrix.clone());try{this.states.uModelMatrix.scale(t,i,r),this.geometryBuilder?this.geometryBuilder.addRetained(e):this._drawGeometry(e)}finally{this.states.setValue("uModelMatrix",s)}}_drawFills(e,{count:t,mode:i}={}){this._useVertexColor=e.vertexColors.length>0;const r=!this._drawingFilter&&this.states.userFillShader?this.states.userFillShader:this._getFillShader();r.bindShader(),this._setGlobalUniforms(r),this._setFillUniforms(r),r.bindTextures();for(const t of this.buffers.fill)t._prepareBuffer(e,r);this._prepareUserAttributes(e,r),r.disableRemainingAttributes(),this._applyColorBlend(this.states.curFillColor,e.hasFillTransparency()),this._drawBuffers(e,{mode:i,count:t}),r.unbindShader()}_drawStrokes(e,{count:t}={}){const i=this.GL;this._useLineColor=e.vertexStrokeColors.length>0;const r=this._getStrokeShader();r.bindShader(),this._setGlobalUniforms(r),this._setStrokeUniforms(r),r.bindTextures();for(const t of this.buffers.stroke)t._prepareBuffer(e,r);if(this._prepareUserAttributes(e,r),r.disableRemainingAttributes(),this._applyColorBlend(this.states.curStrokeColor,e.hasStrokeTransparency()),1===t)i.drawArrays(i.TRIANGLES,0,e.lineVertices.length/3);else try{i.drawArraysInstanced(i.TRIANGLES,0,e.lineVertices.length/3,t)}catch(e){console.log("🌸 p5.js says: Instancing is only supported in WebGL2 mode")}r.unbindShader()}_drawPoints(e,t){const i=this.GL,r=this._getPointShader();r.bindShader(),this._setGlobalUniforms(r),this._setPointUniforms(r),r.bindTextures(),this._bindBuffer(t,i.ARRAY_BUFFER,this._vToNArray(e),Float32Array,i.STATIC_DRAW),r.enableAttrib(r.attributes.aPosition,3),this._applyColorBlend(this.states.curStrokeColor),i.drawArrays(i.Points,0,e.length),r.unbindShader()}_prepareUserAttributes(e,t){for(const i of this.buffers.user){if(!this._pInst.constructor.disableFriendleErrors){const t=e.userVertexProperties[i.attr];if(t){const i=t.getSrcArray().length/t.getDataSize();i>e.vertices.length?this._pInst.constructor._friendlyError(`One of the geometries has a custom vertex property '${t.getName()}' with more values than vertices. This is probably caused by directly using the Geometry.vertexProperty() method.`,"vertexProperty()"):i<e.vertices.length&&this._pInst.constructor._friendlyError(`One of the geometries has a custom vertex property '${t.getName()}' with fewer values than vertices. This is probably caused by directly using the Geometry.vertexProperty() method.`,"vertexProperty()")}}i._prepareBuffer(e,t)}}_drawBuffers(e,{mode:t=this.GL.TRIANGLES,count:i}){const r=this.GL,s=this.geometryBufferCache.getCached(e);if(s)if(s.indexBuffer){if(this._bindBuffer(s.indexBuffer,r.ELEMENT_ARRAY_BUFFER),this._pInst.webglVersion!==n&&s.indexBufferType===r.UNSIGNED_INT&&!r.getExtension("OES_element_index_uint"))throw new Error("Unable to render a 3d model with > 65535 triangles. Your web browser does not support the WebGL Extension OES_element_index_uint.");if(1===i)r.drawElements(r.TRIANGLES,3*e.faces.length,s.indexBufferType,0);else try{r.drawElementsInstanced(r.TRIANGLES,3*e.faces.length,s.indexBufferType,0,i)}catch(e){console.log("🌸 p5.js says: Instancing is only supported in WebGL2 mode")}}else if(1===i)r.drawArrays(t,0,e.vertices.length);else try{r.drawArraysInstanced(t,0,e.vertices.length,i)}catch(e){console.log("🌸 p5.js says: Instancing is only supported in WebGL2 mode")}}_getOrMakeCachedBuffers(e){return this.geometryBufferCache.ensureCached(e)}_setAttributeDefaults(e){const t={alpha:!0,depth:!0,stencil:!0,antialias:navigator.userAgent.toLowerCase().includes("safari"),premultipliedAlpha:!0,preserveDrawingBuffer:!0,perPixelLighting:!0,version:2};null===e._glAttributes?e._glAttributes=t:e._glAttributes=Object.assign(t,e._glAttributes)}_initContext(){if(1!==this._pInst._glAttributes?.version&&(this.drawingContext=this.canvas.getContext("webgl2",this._pInst._glAttributes)),this.webglVersion=this.drawingContext?n:s,this._pInst.webglVersion=this.webglVersion,this.drawingContext||(this.drawingContext=this.canvas.getContext("webgl",this._pInst._glAttributes)||this.canvas.getContext("experimental-webgl",this._pInst._glAttributes)),null===this.drawingContext)throw new Error("Error creating webgl context");{const e=this.drawingContext;e.enable(e.DEPTH_TEST),e.depthFunc(e.LEQUAL),e.viewport(0,0,e.drawingBufferWidth,e.drawingBufferHeight),e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!0),this._viewport=this.drawingContext.getParameter(this.drawingContext.VIEWPORT)}}_getMaxTextureSize(){const e=this.drawingContext;return e.getParameter(e.MAX_TEXTURE_SIZE)}_adjustDimensions(e,t){this._maxTextureSize||(this._maxTextureSize=this._getMaxTextureSize());let i=this._maxTextureSize,r=Math.floor(i/this._pixelDensity),s=Math.min(e,r),n=Math.min(t,r);return s===e&&n===t||console.warn(`Warning: The requested width/height exceeds hardware limits. Adjusting dimensions to width: ${s}, height: ${n}.`),{adjustedWidth:s,adjustedHeight:n}}_resetContext(e,t){const i=this.width,r=this.height,s=this.canvas.id,n=this._pInst instanceof ha,a={position:this.canvas.style.position,top:this.canvas.style.top,left:this.canvas.style.left};if(n){const e=this._pInst;e.canvas.parentNode.removeChild(e.canvas),e.canvas=document.createElement("canvas");(e._pInst._userNode||document.body).appendChild(e.canvas),Mr.call(e,e.canvas,e._pInst),e.width=i,e.height=r}else{let e=this.canvas;e&&e.parentNode.removeChild(e),e=document.createElement("canvas"),e.id=s,this._pInst._userNode?this._pInst._userNode.appendChild(e):document.body.appendChild(e),this._pInst.canvas=e,this.canvas=e,this.canvas.style.position=a.position,this.canvas.style.top=a.top,this.canvas.style.left=a.left}const o=new ea(this._pInst,i,r,!n,this._pInst.canvas);this._pInst._renderer=o,o._applyDefaults(),"function"==typeof t&&setTimeout((()=>{t.apply(window._renderer,e)}),0)}_update(){this.states.setValue("uModelMatrix",this.states.uModelMatrix.clone()),this.states.uModelMatrix.reset(),this.states.setValue("uViewMatrix",this.states.uViewMatrix.clone()),this.states.uViewMatrix.set(this.states.curCamera.cameraMatrix),this.states.setValue("ambientLightColors",[]),this.states.setValue("specularColors",[1,1,1]),this.states.setValue("directionalLightDirections",[]),this.states.setValue("directionalLightDiffuseColors",[]),this.states.setValue("directionalLightSpecularColors",[]),this.states.setValue("pointLightPositions",[]),this.states.setValue("pointLightDiffuseColors",[]),this.states.setValue("pointLightSpecularColors",[]),this.states.setValue("spotLightPositions",[]),this.states.setValue("spotLightDirections",[]),this.states.setValue("spotLightDiffuseColors",[]),this.states.setValue("spotLightSpecularColors",[]),this.states.setValue("spotLightAngle",[]),this.states.setValue("spotLightConc",[]),this.states.setValue("enableLighting",!1),this.states.setValue("tint",[255,255,255,255]),this.GL.clearStencil(0),this.GL.clear(this.GL.DEPTH_BUFFER_BIT|this.GL.STENCIL_BUFFER_BIT),this._userEnabledStencil||this._internalDisable.call(this.GL,this.GL.STENCIL_TEST)}background(...e){const t=this._pInst.color(...e);this.clear(...t._getRGBA())}get uModelMatrix(){return this.states.uModelMatrix}get uViewMatrix(){return this.states.uViewMatrix}get uPMatrix(){return this.states.uPMatrix}get uMVMatrix(){const e=this.uModelMatrix.copy();return e.mult(this.uViewMatrix),e}getWorldToScreenMatrix(){const e=this.states.uModelMatrix,t=this.states.uViewMatrix,i=this.states.uPMatrix,r=new ln(4);r.scale(this.width,this.height,1),r.translate([.5,.5,.5]),r.scale(.5,-.5,.5);return e.copy().mult(t).mult(i).mult(r)}fill(...e){super.fill(...e);const t=this.states.fillColor;this.states.setValue("curFillColor",t._array),this.states.setValue("drawMode",me),this.states.setValue("_useNormalMaterial",!1),this.states.setValue("_tex",null)}stroke(...e){super.stroke(...e),this.states.setValue("curStrokeColor",this.states.strokeColor._array)}getCommonVertexProperties(){return{...super.getCommonVertexProperties(),stroke:this.states.strokeColor,fill:this.states.fillColor,normal:this.states._currentNormal}}getSupportedIndividualVertexProperties(){return{textureCoordinates:!0}}strokeCap(e){this.curStrokeCap=e}strokeJoin(e){this.curStrokeJoin=e}getFilterLayer(){return this.filterLayer||(this.filterLayer=new ma(this)),this.filterLayer}getFilterLayerTemp(){return this.filterLayerTemp||(this.filterLayerTemp=new ma(this)),this.filterLayerTemp}matchSize(e,t){e.width===t.width&&e.height===t.height||e.resize(t.width,t.height),e.pixelDensity()!==t.pixelDensity()&&e.pixelDensity(t.pixelDensity())}filter(...e){let t,i,r=this.getFilterLayer();if("string"==typeof e[0]){i=e[0];let s=i in In&&void 0===e[1];t=s?In[i]:e[1],i in this.defaultFilterShaders||(this.defaultFilterShaders[i]=new Dn(r.renderer,Wn,Qn[i])),this.states.setValue("filterShader",this.defaultFilterShaders[i])}else this.states.setValue("filterShader",e[0]);const s=this.activeFramebuffer()||this;this.matchSize(r,s),r.draw((()=>this.clear()));let n=[1/(s.width*s.pixelDensity()),1/(s.height*s.pixelDensity())];if(i===pe){const e=this.getFilterLayerTemp();this.matchSize(e,s),this.push(),this.states.setValue("strokeColor",null),this.blendMode(j),this.shader(this.states.filterShader),this.states.filterShader.setUniform("texelSize",n),this.states.filterShader.setUniform("canvasSize",[s.width,s.height]),this.states.filterShader.setUniform("radius",Math.max(1,t)),e.draw((()=>{this.states.filterShader.setUniform("direction",[1,0]),this.states.filterShader.setUniform("tex0",s),this.clear(),this.shader(this.states.filterShader),this.noLights(),this.plane(s.width,s.height)})),r.draw((()=>{this.states.filterShader.setUniform("direction",[0,1]),this.states.filterShader.setUniform("tex0",e),this.clear(),this.shader(this.states.filterShader),this.noLights(),this.plane(s.width,s.height)})),this.pop()}else r.draw((()=>{this.states.setValue("strokeColor",null),this.blendMode(j),this.shader(this.states.filterShader),this.states.filterShader.setUniform("tex0",s),this.states.filterShader.setUniform("texelSize",n),this.states.filterShader.setUniform("canvasSize",[s.width,s.height]),this.states.filterShader.setUniform("filterParameter",t),this.noLights(),this.plane(s.width,s.height)}));this.push(),this.states.setValue("strokeColor",null),this.clear(),this.push(),this.states.setValue("imageMode",_),this.blendMode(j),s.filterCamera._resize(),this.setCamera(s.filterCamera),this.resetMatrix(),this._drawingFilter=!0,this.image(r,0,0,this.width,this.height,-s.width/2,-s.height/2,s.width,s.height),this._drawingFilter=!1,this.clearDepth(),this.pop(),this.pop()}pixelDensity(e){return e?this._pInst.pixelDensity(e):this._pInst.pixelDensity()}blendMode(e){e===q||e===H||e===W||e===j||e===Y||e===J||e===Z||e===Q||e===K||e===$?this.states.setValue("curBlendMode",e):e!==se&&e!==ee&&e!==te&&e!==ie&&e!==re||console.warn("BURN, OVERLAY, HARD_LIGHT, SOFT_LIGHT, and DODGE only work for blendMode in 2D mode.")}erase(e,t){this._isErasing||(this.preEraseBlend=this.states.curBlendMode,this._isErasing=!0,this.blendMode($),this._cachedFillStyle=this.states.curFillColor.slice(),this.states.setValue("curFillColor",[1,1,1,e/255]),this._cachedStrokeStyle=this.states.curStrokeColor.slice(),this.states.setValue("curStrokeColor",[1,1,1,t/255]))}noErase(){this._isErasing&&(this.states.setValue("curFillColor",this._cachedFillStyle.slice()),this.states.setValue("curStrokeColor",this._cachedStrokeStyle.slice()),this.states.setValue("curBlendMode",this.preEraseBlend),this.blendMode(this.preEraseBlend),this._isErasing=!1,this._applyBlendMode())}drawTarget(){return this.activeFramebuffers[this.activeFramebuffers.length-1]||this}beginClip(e={}){super.beginClip(e),this.drawTarget()._isClipApplied=!0;const t=this.GL;t.clearStencil(0),t.clear(t.STENCIL_BUFFER_BIT),this._internalEnable.call(t,t.STENCIL_TEST),this._stencilTestOn=!0,t.stencilFunc(t.ALWAYS,1,255),t.stencilOp(t.KEEP,t.KEEP,t.REPLACE),t.disable(t.DEPTH_TEST),this.push(),this.resetShader(),this.states.fillColor&&this.fill(0,0),this.states.strokeColor&&this.stroke(0,0)}endClip(){this.pop();const e=this.GL;e.stencilOp(e.KEEP,e.KEEP,e.KEEP),e.stencilFunc(this._clipInvert?e.EQUAL:e.NOTEQUAL,0,255),e.enable(e.DEPTH_TEST),this._clipDepths.push(this._pushPopDepth),super.endClip()}_clearClip(){this.GL.clearStencil(1),this.GL.clear(this.GL.STENCIL_BUFFER_BIT),this._clipDepths.length>0&&this._clipDepths.pop(),this.drawTarget()._isClipApplied=!1}_getPixel(e,t){const i=this.GL;return ra(i,null,e,t,i.RGBA,i.UNSIGNED_BYTE,this._pInst.height*this._pInst.pixelDensity())}loadPixels(){if(!0!==this._pInst._glAttributes.preserveDrawingBuffer)return void console.log("loadPixels only works in WebGL when preserveDrawingBuffer is true.");const e=this._pixelDensity,t=this.GL;this.pixels=ia(this.pixels,t,null,0,0,this.width*e,this.height*e,t.RGBA,t.UNSIGNED_BYTE,this.height*e)}updatePixels(){const e=this._getTempFramebuffer();e.pixels=this.pixels,e.updatePixels(),this.push(),this.resetMatrix(),this.clear(),this.states.setValue("imageMode",_),this.image(e,0,0,e.width,e.height,-e.width/2,-e.height/2,e.width,e.height),this.pop(),this.GL.clearDepth(1),this.GL.clear(this.GL.DEPTH_BUFFER_BIT)}_getTempFramebuffer(){return this._tempFramebuffer||(this._tempFramebuffer=new ma(this,{format:ke,useDepth:this._pInst._glAttributes.depth,depthFormat:Ie,antialias:this._pInst._glAttributes.antialias})),this._tempFramebuffer}geometryInHash(e){return this.geometryBufferCache.isCached(e)}viewport(e,t){this._viewport=[0,0,e,t],this.GL.viewport(0,0,e,t)}resize(e,t){super.resize(e,t);const i={};for(const e in this.drawingContext){const t=this.drawingContext[e];"object"!=typeof t&&"function"!=typeof t&&(i[e]=t)}const r=this._adjustDimensions(e,t);e=r.adjustedWidth,t=r.adjustedHeight,this.width=e,this.height=t,this.canvas.width=e*this._pixelDensity,this.canvas.height=t*this._pixelDensity,this.canvas.style.width=`${e}px`,this.canvas.style.height=`${t}px`,this._origViewport={width:this.GL.drawingBufferWidth,height:this.GL.drawingBufferHeight},this.viewport(this._origViewport.width,this._origViewport.height),this.states.curCamera._resize(),void 0!==this.pixels&&(this.pixels=new Uint8Array(this.GL.drawingBufferWidth*this.GL.drawingBufferHeight*4));for(const e of this.framebuffers)e._canvasSizeChanged();for(const e in i)try{this.drawingContext[e]=i[e]}catch(e){}}clear(...e){const t=e[0]||0,i=e[1]||0,r=e[2]||0;let s=e[3]||0;const n=this.activeFramebuffer();n&&n.format===ke&&!n.antialias&&0===s&&(s=1e-10),this.GL.clearColor(t*s,i*s,r*s,s),this.GL.clearDepth(1),this.GL.clear(this.GL.COLOR_BUFFER_BIT|this.GL.DEPTH_BUFFER_BIT)}clearDepth(e=1){this.GL.clearDepth(e),this.GL.clear(this.GL.DEPTH_BUFFER_BIT)}applyMatrix(e,t,i,r,s,n){this.states.setValue("uModelMatrix",this.states.uModelMatrix.clone()),16===arguments.length?ln.prototype.apply.apply(this.states.uModelMatrix,arguments):this.states.uModelMatrix.apply([e,t,0,0,i,r,0,0,0,0,1,0,s,n,0,1])}translate(e,t,i){return e instanceof je&&(i=e.z,t=e.y,e=e.x),this.states.setValue("uModelMatrix",this.states.uModelMatrix.clone()),this.states.uModelMatrix.translate([e,t,i]),this}scale(e,t,i){return this.states.setValue("uModelMatrix",this.states.uModelMatrix.clone()),this.states.uModelMatrix.scale(e,t,i),this}rotate(e,t){return void 0===t?this.rotateZ(e):(this.states.setValue("uModelMatrix",this.states.uModelMatrix.clone()),ln.prototype.rotate4x4.apply(this.states.uModelMatrix,arguments),this)}rotateX(e){return this.rotate(e,1,0,0),this}rotateY(e){return this.rotate(e,0,1,0),this}rotateZ(e){return this.rotate(e,0,0,1),this}pop(...e){this._clipDepths.length>0&&this._pushPopDepth===this._clipDepths[this._clipDepths.length-1]&&(this._clearClip(),this._userEnabledStencil||this._internalDisable.call(this.GL,this.GL.STENCIL_TEST)),super.pop(...e),this._applyStencilTestIfClipping()}_applyStencilTestIfClipping(){const e=this.drawTarget();e._isClipApplied!==this._stencilTestOn&&(e._isClipApplied?(this._internalEnable.call(this.GL,this.GL.STENCIL_TEST),this._stencilTestOn=!0):(this._userEnabledStencil||this._internalDisable.call(this.GL,this.GL.STENCIL_TEST),this._stencilTestOn=!1))}resetMatrix(){return this.states.setValue("uModelMatrix",this.states.uModelMatrix.clone()),this.states.uModelMatrix.reset(),this.states.setValue("uViewMatrix",this.states.uViewMatrix.clone()),this.states.uViewMatrix.set(this.states.curCamera.cameraMatrix),this}_getStrokeShader(){const e=this.states.userStrokeShader;return e||this._getLineShader()}_getSphereMapping(e){return this.sphereMapping||(this.sphereMapping=this._pInst.createFilterShader(Jn)),this.scratchMat3.inverseTranspose4x4(this.states.uViewMatrix),this.scratchMat3.invert(this.scratchMat3),this.sphereMapping.setUniform("uFovY",this.states.curCamera.cameraFOV),this.sphereMapping.setUniform("uAspect",this.states.curCamera.aspectRatio),this.sphereMapping.setUniform("uNewNormalMatrix",this.scratchMat3.mat3),this.sphereMapping.setUniform("uEnvMap",e),this.sphereMapping}_getFillShader(){return this._drawingImage?this.states.userImageShader&&!this._drawingFilter?this.states.userImageShader:this._getLightShader():this.states.userFillShader?this.states.userFillShader:this.states._useNormalMaterial?this._getNormalShader():this.states.enableLighting||this.states._tex?this._getLightShader():this._getColorShader()}_getPointShader(){const e=this.states.userPointShader;return e&&e.isPointShader()?e:this._getPointShader()}baseMaterialShader(){if(!this._pInst._glAttributes.perPixelLighting)throw new Error("The material shader does not support hooks without perPixelLighting. Try turning it back on.");return this._getLightShader()}_getLightShader(){return this._defaultLightShader||(this._pInst._glAttributes.perPixelLighting?this._defaultLightShader=new Dn(this,this._webGL2CompatibilityPrefix("vert","highp")+Kn.phongVert,this._webGL2CompatibilityPrefix("frag","highp")+Kn.phongFrag,{vertex:{"void beforeVertex":"() {}","Vertex getObjectInputs":"(Vertex inputs) { return inputs; }","Vertex getWorldInputs":"(Vertex inputs) { return inputs; }","Vertex getCameraInputs":"(Vertex inputs) { return inputs; }","void afterVertex":"() {}"},fragment:{"void beforeFragment":"() {}","Inputs getPixelInputs":"(Inputs inputs) { return inputs; }","vec4 combineColors":"(ColorComponents components) {\n vec4 color = vec4(0.);\n color.rgb += components.diffuse * components.baseColor;\n color.rgb += components.ambient * components.ambientColor;\n color.rgb += components.specular * components.specularColor;\n color.rgb += components.emissive;\n color.a = components.opacity;\n return color;\n }","vec4 getFinalColor":"(vec4 color) { return color; }","void afterFragment":"() {}"}}):this._defaultLightShader=new Dn(this,this._webGL2CompatibilityPrefix("vert","highp")+Kn.lightVert,this._webGL2CompatibilityPrefix("frag","highp")+Kn.lightTextureFrag)),this._defaultLightShader}baseNormalShader(){return this._getNormalShader()}_getNormalShader(){return this._defaultNormalShader||(this._defaultNormalShader=new Dn(this,this._webGL2CompatibilityPrefix("vert","mediump")+Kn.normalVert,this._webGL2CompatibilityPrefix("frag","mediump")+Kn.normalFrag,{vertex:{"void beforeVertex":"() {}","Vertex getObjectInputs":"(Vertex inputs) { return inputs; }","Vertex getWorldInputs":"(Vertex inputs) { return inputs; }","Vertex getCameraInputs":"(Vertex inputs) { return inputs; }","void afterVertex":"() {}"},fragment:{"void beforeFragment":"() {}","vec4 getFinalColor":"(vec4 color) { return color; }","void afterFragment":"() {}"}})),this._defaultNormalShader}baseColorShader(){return this._getColorShader()}_getColorShader(){return this._defaultColorShader||(this._defaultColorShader=new Dn(this,this._webGL2CompatibilityPrefix("vert","mediump")+Kn.normalVert,this._webGL2CompatibilityPrefix("frag","mediump")+Kn.basicFrag,{vertex:{"void beforeVertex":"() {}","Vertex getObjectInputs":"(Vertex inputs) { return inputs; }","Vertex getWorldInputs":"(Vertex inputs) { return inputs; }","Vertex getCameraInputs":"(Vertex inputs) { return inputs; }","void afterVertex":"() {}"},fragment:{"void beforeFragment":"() {}","vec4 getFinalColor":"(vec4 color) { return color; }","void afterFragment":"() {}"}})),this._defaultColorShader}pointShader(){return this._getPointShader()}_getPointShader(){return this._defaultPointShader||(this._defaultPointShader=new Dn(this,this._webGL2CompatibilityPrefix("vert","mediump")+Kn.pointVert,this._webGL2CompatibilityPrefix("frag","mediump")+Kn.pointFrag,{vertex:{"void beforeVertex":"() {}","vec3 getLocalPosition":"(vec3 position) { return position; }","vec3 getWorldPosition":"(vec3 position) { return position; }","float getPointSize":"(float size) { return size; }","void afterVertex":"() {}"},fragment:{"void beforeFragment":"() {}","vec4 getFinalColor":"(vec4 color) { return color; }","bool shouldDiscard":"(bool outside) { return outside; }","void afterFragment":"() {}"}})),this._defaultPointShader}baseStrokeShader(){return this._getLineShader()}_getLineShader(){return this._defaultLineShader||(this._defaultLineShader=new Dn(this,this._webGL2CompatibilityPrefix("vert","mediump")+Kn.lineVert,this._webGL2CompatibilityPrefix("frag","mediump")+Kn.lineFrag,{vertex:{"void beforeVertex":"() {}","StrokeVertex getObjectInputs":"(StrokeVertex inputs) { return inputs; }","StrokeVertex getWorldInputs":"(StrokeVertex inputs) { return inputs; }","StrokeVertex getCameraInputs":"(StrokeVertex inputs) { return inputs; }","void afterVertex":"() {}"},fragment:{"void beforeFragment":"() {}","Inputs getPixelInputs":"(Inputs inputs) { return inputs; }","vec4 getFinalColor":"(vec4 color) { return color; }","bool shouldDiscard":"(bool outside) { return outside; }","void afterFragment":"() {}"}})),this._defaultLineShader}_getFontShader(){return this._defaultFontShader||(this.webglVersion===s&&this.GL.getExtension("OES_standard_derivatives"),this._defaultFontShader=new Dn(this,this._webGL2CompatibilityPrefix("vert","highp")+Kn.fontVert,this._webGL2CompatibilityPrefix("frag","highp")+Kn.fontFrag)),this._defaultFontShader}baseFilterShader(){return this._baseFilterShader||(this._baseFilterShader=new Dn(this,this._webGL2CompatibilityPrefix("vert","highp")+Kn.filterBaseVert,this._webGL2CompatibilityPrefix("frag","highp")+Kn.filterBaseFrag,{vertex:{},fragment:{"vec4 getColor":"(FilterInputs inputs, in sampler2D canvasContent) {\n return getTexture(canvasContent, inputs.texCoord);\n }"}})),this._baseFilterShader}_webGL2CompatibilityPrefix(e,t){let i="";return this.webglVersion===n&&(i+="#version 300 es\n#define WEBGL2\n"),"vert"===e?i+="#define VERTEX_SHADER\n":"frag"===e&&(i+="#define FRAGMENT_SHADER\n"),t&&(i+=`precision ${t} float;\n`),i}_getEmptyTexture(){if(!this._emptyTexture){const e=new Wr(1,1);e.set(0,0,255),this._emptyTexture=new ua(this,e)}return this._emptyTexture}getTexture(e){let t=e;t instanceof ma&&(t=t.color);const i=this.textures.get(t);if(i)return i;const r=new ua(this,t);return this.textures.set(t,r),r}getDiffusedTexture(e){if(null!=this.diffusedTextures.get(e))return this.diffusedTextures.get(e);let t,i=Math.floor(e.height/e.width*200);return t=new ma(this,{width:200,height:i,density:1}),this.diffusedShader||(this.diffusedShader=this._pInst.createShader(Kn.imageLightVert,Kn.imageLightDiffusedFrag)),t.draw((()=>{this.shader(this.diffusedShader),this.diffusedShader.setUniform("environmentMap",e),this.states.setValue("strokeColor",null),this.noLights(),this.plane(200,i)})),this.diffusedTextures.set(e,t),t}getSpecularTexture(e){if(null!=this.specularTextures.get(e))return this.specularTextures.get(e);const t=512;let i;const r=[],s=new ma(this,{width:t,height:t,density:1});let n=Math.log(t)/Math.log(2);this.specularShader||(this.specularShader=this._pInst.createShader(Kn.imageLightVert,Kn.imageLightSpecularFrag));for(let i=t;i>=1;i/=2){s.resize(i,i);let t=1-Math.log(i)/Math.log(2)/n;s.draw((()=>{this.shader(this.specularShader),this.clear(),this.specularShader.setUniform("environmentMap",e),this.specularShader.setUniform("roughness",t),this.states.setValue("strokeColor",null),this.noLights(),this.plane(i,i)})),r.push(s.get().drawingContext.getImageData(0,0,i,i))}return s.remove(),i=new la(this,r,{}),this.specularTextures.set(e,i),i}activeFramebuffer(){return this.activeFramebuffers[this.activeFramebuffers.length-1]||null}createFramebuffer(e){return new ma(this,e)}_setGlobalUniforms(e){const t=this.states.uModelMatrix,i=this.states.uViewMatrix,r=this.states.uPMatrix,s=t.copy().mult(i);if(e.setUniform("uPerspective",this.states.curCamera.useLinePerspective?1:0),e.setUniform("uViewMatrix",i.mat4),e.setUniform("uProjectionMatrix",r.mat4),e.setUniform("uModelMatrix",t.mat4),e.setUniform("uModelViewMatrix",s.mat4),e.uniforms.uModelViewProjectionMatrix){const t=s.copy();t.mult(r),e.setUniform("uModelViewProjectionMatrix",t.mat4)}e.uniforms.uNormalMatrix&&(this.scratchMat3.inverseTranspose4x4(s),e.setUniform("uNormalMatrix",this.scratchMat3.mat3)),e.uniforms.uModelNormalMatrix&&(this.scratchMat3.inverseTranspose4x4(this.states.uModelMatrix),e.setUniform("uModelNormalMatrix",this.scratchMat3.mat3)),e.uniforms.uCameraNormalMatrix&&(this.scratchMat3.inverseTranspose4x4(this.states.uViewMatrix),e.setUniform("uCameraNormalMatrix",this.scratchMat3.mat3)),e.uniforms.uCameraRotation&&(this.scratchMat3.inverseTranspose4x4(this.states.uViewMatrix),e.setUniform("uCameraRotation",this.scratchMat3.mat3)),e.setUniform("uViewport",this._viewport)}_setStrokeUniforms(e){e.setUniform("uSimpleLines",this._simpleLines),e.setUniform("uUseLineColor",this._useLineColor),e.setUniform("uMaterialColor",this.states.curStrokeColor),e.setUniform("uStrokeWeight",this.states.strokeWeight),e.setUniform("uStrokeCap",qn[this.curStrokeCap]),e.setUniform("uStrokeJoin",Hn[this.curStrokeJoin])}_setFillUniforms(e){this.mixedSpecularColor=[...this.states.curSpecularColor];const t=this._getEmptyTexture();this.states._useMetalness>0&&(this.mixedSpecularColor=this.mixedSpecularColor.map(((e,t)=>this.states.curFillColor[t]*this.states._useMetalness+e*(1-this.states._useMetalness)))),e.setUniform("uUseVertexColor",this._useVertexColor),e.setUniform("uMaterialColor",this.states.curFillColor),e.setUniform("isTexture",!!this.states._tex),e.setUniform("uSampler",this.states._tex||t),e.setUniform("uTint",this.states.tint),e.setUniform("uHasSetAmbient",this.states._hasSetAmbient),e.setUniform("uAmbientMatColor",this.states.curAmbientColor),e.setUniform("uSpecularMatColor",this.mixedSpecularColor),e.setUniform("uEmissiveMatColor",this.states.curEmissiveColor),e.setUniform("uSpecular",this.states._useSpecularMaterial),e.setUniform("uEmissive",this.states._useEmissiveMaterial),e.setUniform("uShininess",this.states._useShininess),e.setUniform("uMetallic",this.states._useMetalness),this._setImageLightUniforms(e),e.setUniform("uUseLighting",this.states.enableLighting);const i=this.states.pointLightDiffuseColors.length/3;e.setUniform("uPointLightCount",i),e.setUniform("uPointLightLocation",this.states.pointLightPositions),e.setUniform("uPointLightDiffuseColors",this.states.pointLightDiffuseColors),e.setUniform("uPointLightSpecularColors",this.states.pointLightSpecularColors);const r=this.states.directionalLightDiffuseColors.length/3;e.setUniform("uDirectionalLightCount",r),e.setUniform("uLightingDirection",this.states.directionalLightDirections),e.setUniform("uDirectionalDiffuseColors",this.states.directionalLightDiffuseColors),e.setUniform("uDirectionalSpecularColors",this.states.directionalLightSpecularColors);const s=this.states.ambientLightColors.length/3;this.mixedAmbientLight=[...this.states.ambientLightColors],this.states._useMetalness>0&&(this.mixedAmbientLight=this.mixedAmbientLight.map((e=>{let t=e-this.states._useMetalness;return Math.max(0,t)}))),e.setUniform("uAmbientLightCount",s),e.setUniform("uAmbientColor",this.mixedAmbientLight);const n=this.states.spotLightDiffuseColors.length/3;e.setUniform("uSpotLightCount",n),e.setUniform("uSpotLightAngle",this.states.spotLightAngle),e.setUniform("uSpotLightConc",this.states.spotLightConc),e.setUniform("uSpotLightDiffuseColors",this.states.spotLightDiffuseColors),e.setUniform("uSpotLightSpecularColors",this.states.spotLightSpecularColors),e.setUniform("uSpotLightLocation",this.states.spotLightPositions),e.setUniform("uSpotLightDirection",this.states.spotLightDirections),e.setUniform("uConstantAttenuation",this.states.constantAttenuation),e.setUniform("uLinearAttenuation",this.states.linearAttenuation),e.setUniform("uQuadraticAttenuation",this.states.quadraticAttenuation)}_setImageLightUniforms(e){if(e.setUniform("uUseImageLight",null!=this.states.activeImageLight),this.states.activeImageLight){let t=this.getDiffusedTexture(this.states.activeImageLight);e.setUniform("environmentMapDiffused",t);let i=this.getSpecularTexture(this.states.activeImageLight);e.setUniform("environmentMapSpecular",i)}}_setPointUniforms(e){e.setUniform("uMaterialColor",this.states.curStrokeColor),e.setUniform("uPointSize",this.states.strokeWeight*this._pixelDensity)}_bindBuffer(e,t,i,r,s){if(t||(t=this.GL.ARRAY_BUFFER),this.GL.bindBuffer(t,e),void 0!==i){let e=i;i instanceof pn?e=i.dataArray():e instanceof(r||Float32Array)||(e=new(r||Float32Array)(e)),this.GL.bufferData(t,e,s||this.GL.STATIC_DRAW)}}_arraysEqual(e,t){return e.length===t.length&&e.every(((e,i)=>e===t[i]))}_isTypedArray(e){return[Float32Array,Float64Array,Int16Array,Uint16Array,Uint32Array].some((t=>e instanceof t))}_vToNArray(e){return e.flatMap((e=>[e.x,e.y,e.z]))}}function ta(e,t){e.RendererGL=ea,t.setAttributes=function(t,i){if(void 0===this._glAttributes)return void console.log("You are trying to use setAttributes on a p5.Graphics object that does not use a WEBGL renderer.");let r=!0;void 0!==i?(null===this._glAttributes&&(this._glAttributes={}),this._glAttributes[t]!==i&&(this._glAttributes[t]=i,r=!1)):t instanceof Object&&this._glAttributes!==t&&(this._glAttributes=t,r=!1),this._renderer.isP3D&&!r&&(!this._setupDone&&this._renderer.geometryBufferCache.numCached()>0?e._friendlyError("Sorry, Could not set the attributes, you need to call setAttributes() before calling the other drawing methods in setup()"):(this._renderer._resetContext(),this._renderer.states.curCamera&&(this._renderer.states.curCamera._renderer=this._renderer)))},t._assert3d=function(e){if(!this._renderer.isP3D)throw new Error(`${e}() is only supported in WEBGL mode. If you'd like to use 3D graphics and WebGL, see https://p5js.org/examples/form-3d-primitives.html for more information.`)},e.renderers[s]=e.RendererGL,e.renderers[n]=e.RendererGL}function ia(e,t,i,r,s,n,a,o,h,u){const l=t.getParameter(t.FRAMEBUFFER_BINDING);t.bindFramebuffer(t.FRAMEBUFFER,i);const c=o===t.RGBA?4:3,p=n*a*c,d=h===t.UNSIGNED_BYTE?Uint8Array:Float32Array;if(e instanceof d&&e.length===p||(e=new d(p)),t.readPixels(r,u?u-s-a:s,n,a,o,h,e),t.bindFramebuffer(t.FRAMEBUFFER,l),u){const t=Math.floor(a/2),i=new d(n*c);for(let r=0;r<t;r++){const t=r*n*4,s=(a-r-1)*n*4;i.set(e.subarray(t,t+4*n)),e.copyWithin(t,s,s+4*n),e.set(i,s)}}return e}function ra(e,t,i,r,s,n,a){const o=e.getParameter(e.FRAMEBUFFER_BINDING);e.bindFramebuffer(e.FRAMEBUFFER,t);const h=s===e.RGBA?4:3,u=new(n===e.UNSIGNED_BYTE?Uint8Array:Float32Array)(h);return e.readPixels(i,a?a-r-1:r,1,1,s,n,u),e.bindFramebuffer(e.FRAMEBUFFER,o),Array.from(u)}function sa(e,t){t.strokeMode=function(e){if(void 0===e)return this._renderer._simpleLines?o:h;if(e===o)this._renderer._simpleLines=!0;else{if(e!==h)throw Error("no such parameter");this._renderer._simpleLines=!1}},t.buildGeometry=function(e){return this._renderer.buildGeometry(e)},t.freeGeometry=function(e){this._renderer.geometryBufferCache.freeBuffers(e.gid)},t.plane=function(e=50,t=e,i=1,r=1){return this._assert3d("plane"),this._renderer.plane(e,t,i,r),this},t.box=function(e,t,i,r,s){return this._assert3d("box"),this._renderer.box(e,t,i,r,s),this},t.sphere=function(e=50,t=24,i=16){return this._assert3d("sphere"),this._renderer.sphere(e,t,i),this},t.cylinder=function(e=50,t=e,i=24,r=1,s=!0,n=!0){return this._assert3d("cylinder"),this._renderer.cylinder(e,t,i,r,s,n),this},t.cone=function(e=50,t=e,i=24,r=1,s=!0){return this._assert3d("cone"),this._renderer.cone(e,t,i,r,s),this},t.ellipsoid=function(e=50,t=e,i=e,r=24,s=16){return this._assert3d("ellipsoid"),this._renderer.ellipsoid(e,t,i,r,s),this},t.torus=function(e,t,i,r){return this._assert3d("torus"),this._renderer.torus(e,t,i,r),this},ea.prototype.point=function(e,t,i=0){const r=[];return r.push(new je(e,t,i)),this._drawPoints(r,this.buffers.point),this},ea.prototype.triangle=function(e){const t=e[0],i=e[1],r=e[2],s=e[3],n=e[4],a=e[5],o="tri";if(!this.geometryInHash(o)){const e=new gn(1,1,(function(){const e=[];e.push(new je(0,0,0)),e.push(new je(1,0,0)),e.push(new je(0,1,0)),this.edges=[[0,1],[1,2],[2,0]],this.vertices=e,this.faces=[[0,1,2]],this.uvs=[0,0,1,0,1,1]}),this);e._edgesToVertices(),e.computeNormals(),e.gid=o,this.geometryBufferCache.ensureCached(e)}const h=this.states.uModelMatrix.copy();try{const e=Math.sign(t*s-r*i+r*a-n*s+n*i-t*a),h=new ln([r-t,s-i,0,0,n-t,a-i,0,0,0,0,e,0,t,i,0,1]).mult(this.states.uModelMatrix);this.states.setValue("uModelMatrix",h),this._drawGeometry(this.geometryBufferCache.getGeometryByID(o))}finally{this.states.setValue("uModelMatrix",h)}return this},ea.prototype.ellipse=function(e){this.arc(e[0],e[1],e[2],e[3],0,x,L,e[4])},ea.prototype.arc=function(...e){const t=e[0],i=e[1],r=e[2],s=e[3],n=e[4],a=e[5],o=e[6],h=e[7]||25;let u,l;if(Math.abs(a-n)>=x?(u="ellipse",l=`${u}|${h}|`):(u="arc",l=`${u}|${n}|${a}|${o}|${h}|`),!this.geometryInHash(l)){const e=function(){if(n.toFixed(10)!==a.toFixed(10)){o!==O&&void 0!==o||(this.vertices.push(new je(.5,.5,0)),this.uvs.push([.5,.5]));for(let e=0;e<=h;e++){const t=(a-n)*(e/h)+n,i=.5+Math.cos(t)/2,r=.5+Math.sin(t)/2;this.vertices.push(new je(i,r,0)),this.uvs.push([i,r]),e<h-1&&(this.faces.push([0,e+1,e+2]),this.edges.push([e+1,e+2]))}switch(o){case O:this.faces.push([0,this.vertices.length-2,this.vertices.length-1]),this.edges.push([0,1]),this.edges.push([this.vertices.length-2,this.vertices.length-1]),this.edges.push([0,this.vertices.length-1]);break;case P:this.edges.push([0,1]),this.edges.push([0,this.vertices.length-1]);break;case L:this.edges.push([0,1]);break;default:this.faces.push([0,this.vertices.length-2,this.vertices.length-1]),this.edges.push([this.vertices.length-2,this.vertices.length-1])}}},t=new gn(h,1,e,this);t.computeNormals(),h<=50?t._edgesToVertices(t):this.states.strokeColor&&console.log(`Cannot apply a stroke to an ${u} with more than 50 detail`),t.gid=l,this.geometryBufferCache.ensureCached(t)}const c=this.states.uModelMatrix;this.states.setValue("uModelMatrix",this.states.uModelMatrix.clone());try{this.states.uModelMatrix.translate([t,i,0]),this.states.uModelMatrix.scale(r,s,1),this._drawGeometry(this.geometryBufferCache.getGeometryByID(l))}finally{this.states.setValue("uModelMatrix",c)}return this},ea.prototype.rect=function(e){const t=e[0],i=e[1],r=e[2],s=e[3];if(void 0===e[4]){const n=this._pInst._glAttributes.perPixelLighting,a=e[4]||(n?1:24),o=e[5]||(n?1:16),h=`rect|${a}|${o}`;if(!this.geometryInHash(h)){const e=function(){for(let e=0;e<=this.detailY;e++){const t=e/this.detailY;for(let e=0;e<=this.detailX;e++){const i=e/this.detailX,r=new je(i,t,0);this.vertices.push(r),this.uvs.push(i,t)}}a>0&&o>0&&(this.edges=[[0,a],[a,(a+1)*(o+1)-1],[(a+1)*(o+1)-1,(a+1)*o],[(a+1)*o,0]])},t=new gn(a,o,e,this);t.computeFaces().computeNormals()._edgesToVertices(),t.gid=h,this.geometryBufferCache.ensureCached(t)}const u=this.states.uModelMatrix;this.states.setValue("uModelMatrix",this.states.uModelMatrix.copy());try{this.states.uModelMatrix.translate([t,i,0]),this.states.uModelMatrix.scale(r,s,1),this._drawGeometry(this.geometryBufferCache.getGeometryByID(h))}finally{this.states.setValue("uModelMatrix",u)}}else{let n=e[4],a=void 0===e[5]?n:e[5],o=void 0===e[6]?a:e[6],h=void 0===e[7]?o:e[7],u=t,l=i,c=r,p=s;if(c+=u,p+=l,u>c){const e=u;u=c,c=e}if(l>p){const e=l;l=p,p=e}const d=Math.min((c-u)/2,(p-l)/2);n>d&&(n=d),a>d&&(a=d),o>d&&(o=d),h>d&&(h=d);let f=u,g=l,m=c,y=p;const x=this.states.textureMode;this.states.setValue("textureMode",de);const v=this.bezierOrder();this.bezierOrder(2),this.beginShape();const b=(e,t)=>[e,t,(e-f)/r,(t-g)/s];0!==a?(this.vertex(...b(m-a,g)),this.bezierVertex(...b(m,g)),this.bezierVertex(...b(m,g+a))):this.vertex(...b(m,g)),0!==o?(this.vertex(...b(m,y-o)),this.bezierVertex(...b(m,y)),this.bezierVertex(...b(m-o,y))):this.vertex(...b(m,y)),0!==h?(this.vertex(...b(f+h,y)),this.bezierVertex(...b(f,y)),this.bezierVertex(...b(f,y-h))):this.vertex(...b(f,y)),0!==n?(this.vertex(...b(f,g+n)),this.bezierVertex(...b(f,g)),this.bezierVertex(...b(f+n,g))):this.vertex(...b(f,g)),this.endShape(B),this.states.setValue("textureMode",x),this.bezierOrder(v)}return this},ea.prototype.quad=function(e,t,i,r,s,n,a,o,h,u,l,c,p=2,d=2){const f=`quad|${e}|${t}|${i}|${r}|${s}|${n}|${a}|${o}|${h}|${u}|${l}|${c}|${p}|${d}`;if(!this.geometryInHash(f)){const g=new gn(p,d,(function(){let p=1/(this.detailX-1),d=1/(this.detailY-1);for(let f=0;f<this.detailY;f++)for(let g=0;g<this.detailX;g++){let m=g*p,y=f*d,x=(1-m)*((1-y)*e+y*u)+m*((1-y)*r+y*a),v=(1-m)*((1-y)*t+y*l)+m*((1-y)*s+y*o),b=(1-m)*((1-y)*i+y*c)+m*((1-y)*n+y*h);this.vertices.push(new je(x,v,b)),this.uvs.push([m,y])}}),this);g.faces=[];for(let e=0;e<d-1;e++)for(let t=0;t<p-1;t++){let i=t+e*p,r=t+1+e*p,s=t+1+(e+1)*p,n=t+(e+1)*p;g.faces.push([i,r,s]),g.faces.push([i,s,n])}g.computeNormals(),g.edges.length=0;const m=[0,2,3,1];for(let e=0;e<m.length;e++){const t=m[e],i=m[(e+1)%m.length];g.edges.push([t,i])}g._edgesToVertices(),g.gid=f,this.geometryBufferCache.ensureCached(g)}return this._drawGeometry(this.geometryBufferCache.getGeometryByID(f)),this},ea.prototype.bezier=function(e,t,i,r,s,n,a,o,h,u,l,c){8===arguments.length&&(l=o,u=a,o=n,a=s,s=r,r=i,i=n=h=c=0),this.bezierOrder(),this.bezierOrder(3),this.beginShape(),this.vertex(e,t,i),this.bezierVertex(r,s,n),this.bezierVertex(a,o,h),this.bezierVertex(u,l,c),this.endShape()},ea.prototype.curve=function(e,t,i,r,s,n,a,o,h,u,l,c){8===arguments.length&&(u=a,l=o,a=s,o=r,s=r=i,i=n=h=c=0),this.beginShape(),this.splineVertex(e,t,i),this.splineVertex(r,s,n),this.splineVertex(a,o,h),this.splineVertex(u,l,c),this.endShape()},ea.prototype.line=function(...e){return 6===e.length?(this.beginShape(M),this.vertex(e[0],e[1],e[2]),this.vertex(e[3],e[4],e[5]),this.endShape()):4===e.length&&(this.beginShape(M),this.vertex(e[0],e[1],0),this.vertex(e[2],e[3],0),this.endShape()),this},ea.prototype.image=function(e,t,i,r,s,n,a,o,h){this._isErasing&&this.blendMode(this._cachedBlendMode),this.push(),this.noLights(),this.states.setValue("strokeColor",null),this.texture(e),this.states.setValue("textureMode",de);let u=0;t<=e.width&&(u=t/e.width);let l=1;t+r<=e.width&&(l=(t+r)/e.width);let c=0;i<=e.height&&(c=i/e.height);let p=1;i+s<=e.height&&(p=(i+s)/e.height),this._drawingImage=!0,this.beginShape(),this.vertex(n,a,0,u,c),this.vertex(n+o,a,0,l,c),this.vertex(n+o,a+h,0,l,p),this.vertex(n,a+h,0,u,p),this.endShape(B),this._drawingImage=!1,this.pop(),this._isErasing&&this.blendMode($)};const i=function(e,t,i,r,s,n,a){e=e<=0?1:e,t=t<0?0:t,i=i<=0?e:i,r=r<3?3:r;const o=(n=void 0===n||n)?-2:0,h=(s=s<1?1:s)+((a=void 0===a?0!==t:a)?2:0),u=Math.atan2(e-t,i),l=Math.sin(u),c=Math.cos(u);let p,d,f;for(p=o;p<=h;++p){let n,a=p/s,o=i*a;for(p<0?(o=0,a=0,n=e):p>s?(o=i,a=1,n=t):n=e+(t-e)*a,-2!==p&&p!==s+2||(n=0),o-=i/2,d=0;d<r;++d){const e=d/(r-1),i=2*Math.PI*e,h=Math.sin(i),u=Math.cos(i);let f;this.vertices.push(new je(h*n,o,u*n)),f=p<0?new je(0,-1,0):p>s&&t?new je(0,1,0):new je(h*c,l,u*c),this.vertexNormals.push(f),this.uvs.push(e,a)}}let g=0;if(n){for(f=0;f<r;++f){const e=(f+1)%r;this.faces.push([g+f,g+r+e,g+r+f])}g+=2*r}for(p=0;p<s;++p){for(d=0;d<r;++d){const e=(d+1)%r;this.faces.push([g+d,g+e,g+r+e]),this.faces.push([g+d,g+r+e,g+r+d])}g+=r}if(a)for(g+=r,d=0;d<r;++d)this.faces.push([g+d,g+(d+1)%r,g+r])};ea.prototype.plane=function(e=50,t=e,i=1,r=1){const s=`plane|${i}|${r}`;if(!this.geometryInHash(s)){const e=function(){let e,t,i;for(let r=0;r<=this.detailY;r++){t=r/this.detailY;for(let r=0;r<=this.detailX;r++)e=r/this.detailX,i=new je(e-.5,t-.5,0),this.vertices.push(i),this.uvs.push(e,t)}},t=new gn(i,r,e,this);t.computeFaces().computeNormals(),i<=1&&r<=1?t._makeTriangleEdges()._edgesToVertices():this.states.strokeColor&&console.log("Cannot draw stroke on plane objects with more than 1 detailX or 1 detailY"),t.gid=s,this.geometryBufferCache.ensureCached(t)}this._drawGeometryScaled(this.geometryBufferCache.getGeometryByID(s),e,t,1)},ea.prototype.box=function(e=50,t=e,i=t,r,s){const n=this.attributes&&this.attributes.perPixelLighting;void 0===r&&(r=n?1:4),void 0===s&&(s=n?1:4);const a=`box|${r}|${s}`;if(!this.geometryInHash(a)){const e=function(){this.edges=[[0,1],[1,3],[3,2],[6,7],[8,9],[9,11],[14,15],[16,17],[17,19],[18,19],[20,21],[22,23]],[[0,4,2,6],[1,3,5,7],[0,1,4,5],[2,6,3,7],[0,2,1,3],[4,5,6,7]].forEach(((e,t)=>{const i=4*t;for(let t=0;t<4;t++){const i=e[t],r=new je((2*(1&i)-1)/2,((2&i)-1)/2,((4&i)/2-1)/2);this.vertices.push(r),this.uvs.push(1&t,(2&t)/2)}this.faces.push([i,i+1,i+2]),this.faces.push([i+2,i+1,i+3])}))},t=new gn(r,s,e,this);t.computeNormals(),r<=4&&s<=4?t._edgesToVertices():this.states.strokeColor&&console.log("Cannot draw stroke on box objects with more than 4 detailX or 4 detailY"),t.gid=a,this.geometryBufferCache.ensureCached(t)}this._drawGeometryScaled(this.geometryBufferCache.getGeometryByID(a),e,t,i)},ea.prototype.sphere=function(e=50,t=24,i=16){this.ellipsoid(e,e,e,t,i)},ea.prototype.ellipsoid=function(t=50,i=t,r=t,s=24,n=16){const a=`ellipsoid|${s}|${n}`;if(!this.geometryInHash(a)){const t=function(){for(let t=0;t<=this.detailY;t++){const i=t/this.detailY,r=Math.PI*i-Math.PI/2,s=Math.cos(r),n=Math.sin(r);for(let t=0;t<=this.detailX;t++){const r=t/this.detailX,a=2*Math.PI*r,o=Math.cos(a),h=Math.sin(a),u=new e.Vector(s*h,n,s*o);this.vertices.push(u),this.vertexNormals.push(u),this.uvs.push(r,i)}}},i=new gn(s,n,t,this);i.computeFaces(),s<=24&&n<=24?i._makeTriangleEdges()._edgesToVertices():this.states.strokeColor&&console.log("Cannot draw stroke on ellipsoids with more than 24 detailX or 24 detailY"),i.gid=a,this.geometryBufferCache.ensureCached(i)}this._drawGeometryScaled(this.geometryBufferCache.getGeometryByID(a),t,i,r)},ea.prototype.cylinder=function(t=50,r=t,s=24,n=1,a=!0,o=!0){const h=`cylinder|${s}|${n}|${a}|${o}`;if(!this.geometryInHash(h)){const t=new e.Geometry(s,n,(function(){i.call(this,1,1,1,s,n,a,o)}),this);s<=24&&n<=16?t._makeTriangleEdges()._edgesToVertices():this.states.strokeColor&&console.log("Cannot draw stroke on cylinder objects with more than 24 detailX or 16 detailY"),t.gid=h,this.geometryBufferCache.ensureCached(t)}this._drawGeometryScaled(this.geometryBufferCache.getGeometryByID(h),t,r,t)},ea.prototype.cone=function(e=50,t=e,r=24,s=1,n=!0){const a=`cone|${r}|${s}|${n}`;if(!this.geometryInHash(a)){const e=new gn(r,s,(function(){i.call(this,1,0,1,r,s,n,!1)}),this);r<=24&&s<=16?e._makeTriangleEdges()._edgesToVertices():this.states.strokeColor&&console.log("Cannot draw stroke on cone objects with more than 24 detailX or 16 detailY"),e.gid=a,this.geometryBufferCache.ensureCached(e)}this._drawGeometryScaled(this.geometryBufferCache.getGeometryByID(a),e,t,e)},ea.prototype.torus=function(e=50,t=10,i=24,r=16){if(0===e)return;if(0===t)return;const s=(t/e).toPrecision(4),n=`torus|${s}|${i}|${r}`;if(!this.geometryInHash(n)){const e=function(){for(let e=0;e<=this.detailY;e++){const t=e/this.detailY,i=2*Math.PI*t,r=Math.cos(i),n=Math.sin(i),a=1+s*r;for(let e=0;e<=this.detailX;e++){const i=e/this.detailX,o=2*Math.PI*i,h=Math.cos(o),u=Math.sin(o),l=new je(a*h,a*u,s*n),c=new je(r*h,r*u,n);this.vertices.push(l),this.vertexNormals.push(c),this.uvs.push(i,t)}}},t=new gn(i,r,e,this);t.computeFaces(),i<=24&&r<=16?t._makeTriangleEdges()._edgesToVertices():this.states.strokeColor&&console.log("Cannot draw strokes on torus object with more than 24 detailX or 16 detailY"),t.gid=n,this.geometryBufferCache.ensureCached(t)}this._drawGeometryScaled(this.geometryBufferCache.getGeometryByID(n),e,e,e)},t.curveDetail=function(e){if(!(this._renderer instanceof ea))throw new Error("curveDetail() only works in WebGL mode. Did you mean to call createCanvas(width, height, WEBGL)?");return this._renderer.curveDetail(e)}}function na(e,t){t.ambientLight=function(e,t,i,r){return this._assert3d("ambientLight"),this._renderer.ambientLight(...arguments),this},t.specularColor=function(e,t,i){return this._assert3d("specularColor"),this._renderer.specularColor(...arguments),this},t.directionalLight=function(e,t,i,r,s,n){return this._assert3d("directionalLight"),this._renderer.directionalLight(...arguments),this},t.pointLight=function(e,t,i,r,s,n){return this._assert3d("pointLight"),this._renderer.pointLight(...arguments),this},t.imageLight=function(e){this._renderer.imageLight(e)},t.panorama=function(e){this.filter(this._renderer._getSphereMapping(e))},t.lights=function(){return this._assert3d("lights"),this._renderer.lights(),this},t.lightFalloff=function(e,t,i){return this._assert3d("lightFalloff"),this._renderer.lightFalloff(e,t,i),this},t.spotLight=function(e,t,i,r,s,n,a,o,h,u,l){return this._assert3d("spotLight"),this._renderer.spotLight(...arguments),this},t.noLights=function(...e){return this._assert3d("noLights"),this._renderer.noLights(),this},ea.prototype.ambientLight=function(e,t,i,r){const s=this._pInst.color(...arguments);this.states.setValue("ambientLightColors",[...this.states.ambientLightColors]),this.states.ambientLightColors.push(s._array[0],s._array[1],s._array[2]),this.states.setValue("enableLighting",!0)},ea.prototype.specularColor=function(e,t,i){const r=this._pInst.color(...arguments);this.states.setValue("specularColors",[r._array[0],r._array[1],r._array[2]])},ea.prototype.directionalLight=function(e,t,i,r,s,n){let a,o,h,u;a=e instanceof pr?e:this._pInst.color(e,t,i);const l=arguments[arguments.length-1];"number"==typeof l?(o=arguments[arguments.length-3],h=arguments[arguments.length-2],u=arguments[arguments.length-1]):(o=l.x,h=l.y,u=l.z);const c=Math.sqrt(o*o+h*h+u*u);this.states.setValue("directionalLightDirections",[...this.states.directionalLightDirections]),this.states.directionalLightDirections.push(o/c,h/c,u/c),this.states.setValue("directionalLightDiffuseColors",[...this.states.directionalLightDiffuseColors]),this.states.directionalLightDiffuseColors.push(a._array[0],a._array[1],a._array[2]),this.states.setValue("directionalLightSpecularColors",[...this.states.directionalLightSpecularColors]),Array.prototype.push.apply(this.states.directionalLightSpecularColors,this.states.specularColors),this.states.setValue("enableLighting",!0)},ea.prototype.pointLight=function(e,t,i,r,s,n){let a,o,h,u;a=e instanceof pr?e:this._pInst.color(e,t,i);const l=arguments[arguments.length-1];"number"==typeof l?(o=arguments[arguments.length-3],h=arguments[arguments.length-2],u=arguments[arguments.length-1]):(o=l.x,h=l.y,u=l.z),this.states.setValue("pointLightPositions",[...this.states.pointLightPositions]),this.states.pointLightPositions.push(o,h,u),this.states.setValue("pointLightDiffuseColors",[...this.states.pointLightDiffuseColors]),this.states.pointLightDiffuseColors.push(a._array[0],a._array[1],a._array[2]),this.states.setValue("pointLightSpecularColors",[...this.states.pointLightSpecularColors]),Array.prototype.push.apply(this.states.pointLightSpecularColors,this.states.specularColors),this.states.setValue("enableLighting",!0)},ea.prototype.imageLight=function(e){this.states.setValue("activeImageLight",e),this.states.setValue("enableLighting",!0)},ea.prototype.lights=function(){const e=this._pInst.color("rgb(128,128,128)");this.ambientLight(e),this.directionalLight(e,0,0,-1)},ea.prototype.lightFalloff=function(e,t,i){e<0&&(e=0,console.warn("Value of constant argument in lightFalloff() should be never be negative. Set to 0.")),t<0&&(t=0,console.warn("Value of linear argument in lightFalloff() should be never be negative. Set to 0.")),i<0&&(i=0,console.warn("Value of quadratic argument in lightFalloff() should be never be negative. Set to 0.")),0===e&&0===t&&0===i&&(e=1,console.warn("Either one of the three arguments in lightFalloff() should be greater than zero. Set constant argument to 1.")),this.states.setValue("constantAttenuation",e),this.states.setValue("linearAttenuation",t),this.states.setValue("quadraticAttenuation",i)},ea.prototype.spotLight=function(e,t,i,r,s,n,a,o,h,u,l){let c,p,d;const f=arguments.length;switch(f){case 11:case 10:c=this._pInst.color(e,t,i),p=new je(r,s,n),d=new je(a,o,h);break;case 9:e instanceof pr?(c=e,p=new je(t,i,r),d=new je(s,n,a),u=o,l=h):r instanceof je?(c=this._pInst.color(e,t,i),p=r,d=new je(s,n,a),u=o,l=h):a instanceof je?(c=this._pInst.color(e,t,i),p=new je(r,s,n),d=a,u=o,l=h):(c=this._pInst.color(e,t,i),p=new je(r,s,n),d=new je(a,o,h));break;case 8:e instanceof pr?(c=e,p=new je(t,i,r),d=new je(s,n,a),u=o):r instanceof je?(c=this._pInst.color(e,t,i),p=r,d=new je(s,n,a),u=o):(c=this._pInst.color(e,t,i),p=new je(r,s,n),d=a,u=o);break;case 7:e instanceof pr&&t instanceof je?(c=e,p=t,d=new je(i,r,s),u=n,l=a):e instanceof pr&&s instanceof je?(c=e,p=new je(t,i,r),d=s,u=n,l=a):r instanceof je&&s instanceof je?(c=this._pInst.color(e,t,i),p=r,d=s,u=n,l=a):e instanceof pr?(c=e,p=new je(t,i,r),d=new je(s,n,a)):r instanceof je?(c=this._pInst.color(e,t,i),p=r,d=new je(s,n,a)):(c=this._pInst.color(e,t,i),p=new je(r,s,n),d=a);break;case 6:r instanceof je&&s instanceof je?(c=this._pInst.color(e,t,i),p=r,d=s,u=n):e instanceof pr&&s instanceof je?(c=e,p=new je(t,i,r),d=s,u=n):e instanceof pr&&t instanceof je&&(c=e,p=t,d=new je(i,r,s),u=n);break;case 5:e instanceof pr&&t instanceof je&&i instanceof je?(c=e,p=t,d=i,u=r,l=s):r instanceof je&&s instanceof je?(c=this._pInst.color(e,t,i),p=r,d=s):e instanceof pr&&s instanceof je?(c=e,p=new je(t,i,r),d=s):e instanceof pr&&t instanceof je&&(c=e,p=t,d=new je(i,r,s));break;case 4:c=e,p=t,d=i,u=r;break;case 3:c=e,p=t,d=i;break;default:return void console.warn(`Sorry, input for spotlight() is not in prescribed format. Too ${f<3?"few":"many"} arguments were provided`)}this.states.setValue("spotLightDiffuseColors",[c._array[0],c._array[1],c._array[2]]),this.states.setValue("spotLightSpecularColors",[...this.states.specularColors]),this.states.setValue("spotLightPositions",[p.x,p.y,p.z]),d.normalize(),this.states.setValue("spotLightDirections",[d.x,d.y,d.z]),void 0===u&&(u=Math.PI/3),void 0!==l&&l<1?(l=1,console.warn("Value of concentration needs to be greater than 1. Setting it to 1")):void 0===l&&(l=100),u=this._pInst._toRadians(u),this.states.setValue("spotLightAngle",[Math.cos(u)]),this.states.setValue("spotLightConc",[l]),this.states.setValue("enableLighting",!0)},ea.prototype.noLights=function(){this.states.setValue("activeImageLight",null),this.states.setValue("enableLighting",!1),this.states.setValue("ambientLightColors",[]),this.states.setValue("specularColors",[1,1,1]),this.states.setValue("directionalLightDirections",[]),this.states.setValue("directionalLightDiffuseColors",[]),this.states.setValue("directionalLightSpecularColors",[]),this.states.setValue("pointLightPositions",[]),this.states.setValue("pointLightDiffuseColors",[]),this.states.setValue("pointLightSpecularColors",[]),this.states.setValue("spotLightPositions",[]),this.states.setValue("spotLightDirections",[]),this.states.setValue("spotLightDiffuseColors",[]),this.states.setValue("spotLightSpecularColors",[]),this.states.setValue("spotLightAngle",[]),this.states.setValue("spotLightConc",[]),this.states.setValue("constantAttenuation",1),this.states.setValue("linearAttenuation",0),this.states.setValue("quadraticAttenuation",0),this.states.setValue("_useShininess",1),this.states.setValue("_useMetalness",0)}}function aa(e,t){t.loadShader=async function(e,t,i,r){const s=new Dn;try{return s._vertSrc=(await Os(e,"text")).data,s._fragSrc=(await Os(t,"text")).data,i?i(s):s}catch(e){if(r)return r(e);throw e}},t.createShader=function(e,t,i){return new Dn(this._renderer,e,t,i)},t.loadFilterShader=async function(e,t,i){try{const i=await this.loadStrings(e),r=await i.join("\n"),s=this.createFilterShader(r,!0);return t&&t(s),s}catch(e){i?i(e):console.error(e)}},t.createFilterShader=function(e,t=!1){let i=e.includes("#version 300 es")?"#version 300 es\n uniform mat4 uModelViewMatrix;\n uniform mat4 uProjectionMatrix;\n\n in vec3 aPosition;\n in vec2 aTexCoord;\n out vec2 vTexCoord;\n\n void main() {\n // transferring texcoords for the frag shader\n vTexCoord = aTexCoord;\n\n // copy position with a fourth coordinate for projection (1.0 is normal)\n vec4 positionVec4 = vec4(aPosition, 1.0);\n\n // project to 3D space\n gl_Position = uProjectionMatrix * uModelViewMatrix * positionVec4;\n }\n ":"\n uniform mat4 uModelViewMatrix;\n uniform mat4 uProjectionMatrix;\n\n attribute vec3 aPosition;\n // texcoords only come from p5 to vertex shader\n // so pass texcoords on to the fragment shader in a varying variable\n attribute vec2 aTexCoord;\n varying vec2 vTexCoord;\n\n void main() {\n // transferring texcoords for the frag shader\n vTexCoord = aTexCoord;\n\n // copy position with a fourth coordinate for projection (1.0 is normal)\n vec4 positionVec4 = vec4(aPosition, 1.0);\n\n // project to 3D space\n gl_Position = uProjectionMatrix * uModelViewMatrix * positionVec4;\n }\n ";const r=new Dn(this._renderer,i,e);return t||(this._renderer.GL?r.ensureCompiledOnContext(this._renderer):r.ensureCompiledOnContext(this)),r},t.shader=function(e){return this._assert3d("shader"),this._renderer.shader(e),this},t.strokeShader=function(e){return this._assert3d("strokeShader"),this._renderer.strokeShader(e),this},t.imageShader=function(e){return this._assert3d("imageShader"),this._renderer.imageShader(e),this},t.baseMaterialShader=function(){return this._assert3d("baseMaterialShader"),this._renderer.baseMaterialShader()},t.baseFilterShader=function(){return(this._renderer.filterRenderer||this._renderer).baseFilterShader()},t.baseNormalShader=function(){return this._assert3d("baseNormalShader"),this._renderer.baseNormalShader()},t.baseColorShader=function(){return this._assert3d("baseColorShader"),this._renderer.baseColorShader()},t.baseStrokeShader=function(){return this._assert3d("baseStrokeShader"),this._renderer.baseStrokeShader()},t.resetShader=function(){return this._renderer.resetShader(),this},t.texture=function(e){return this._assert3d("texture"),e.gifProperties&&e._animateGif(this),this._renderer.texture(e),this},t.textureMode=function(e){e!==xe&&e!==de?console.warn(`You tried to set ${e} textureMode only supports IMAGE & NORMAL `):this._renderer.states.setValue("textureMode",e)},t.textureWrap=function(e,t=e){this._renderer.states.setValue("textureWrapX",e),this._renderer.states.setValue("textureWrapY",t);for(const i of this._renderer.textures.values())i.setWrapMode(e,t)},t.normalMaterial=function(...e){return this._assert3d("normalMaterial"),this._renderer.normalMaterial(...e),this},t.ambientMaterial=function(e,i,r){this._assert3d("ambientMaterial");const s=t.color.apply(this,arguments);return this._renderer.states.setValue("_hasSetAmbient",!0),this._renderer.states.setValue("curAmbientColor",s._array),this._renderer.states.setValue("_useNormalMaterial",!1),this._renderer.states.setValue("enableLighting",!0),this._renderer.states.fillColor||this._renderer.states.setValue("fillColor",new pr([1,1,1])),this},t.emissiveMaterial=function(e,i,r,s){this._assert3d("emissiveMaterial");const n=t.color.apply(this,arguments);return this._renderer.states.setValue("curEmissiveColor",n._array),this._renderer.states.setValue("_useEmissiveMaterial",!0),this._renderer.states.setValue("_useNormalMaterial",!1),this._renderer.states.setValue("enableLighting",!0),this},t.specularMaterial=function(e,i,r,s){this._assert3d("specularMaterial");const n=t.color.apply(this,arguments);return this._renderer.states.setValue("curSpecularColor",n._array),this._renderer.states.setValue("_useSpecularMaterial",!0),this._renderer.states.setValue("_useNormalMaterial",!1),this._renderer.states.setValue("enableLighting",!0),this},t.shininess=function(e){return this._assert3d("shininess"),this._renderer.shininess(e),this},t.metalness=function(e){return this._assert3d("metalness"),this._renderer.metalness(e),this},ea.prototype._applyColorBlend=function(e,t){const i=this.GL,r=this.states.drawMode===ye,s=t||this.states.userFillShader||this.states.userStrokeShader||this.states.userPointShader||r||this.states.curBlendMode!==j||e[e.length-1]<1||this._isErasing;return s!==this._isBlending&&(s||this.states.curBlendMode!==j&&this.states.curBlendMode!==W?i.enable(i.BLEND):i.disable(i.BLEND),i.depthMask(!0),this._isBlending=s),this._applyBlendMode(),e},ea.prototype._applyBlendMode=function(){if(this._cachedBlendMode===this.states.curBlendMode)return;const e=this.GL;switch(this.states.curBlendMode){case j:e.blendEquation(e.FUNC_ADD),e.blendFunc(e.ONE,e.ONE_MINUS_SRC_ALPHA);break;case W:e.blendEquation(e.FUNC_ADD),e.blendFunc(e.ONE,e.ONE);break;case $:e.blendEquation(e.FUNC_ADD),e.blendFunc(e.ZERO,e.ONE_MINUS_SRC_ALPHA);break;case K:e.blendEquation(e.FUNC_ADD),e.blendFunc(e.DST_COLOR,e.ONE_MINUS_SRC_ALPHA);break;case J:e.blendEquation(e.FUNC_ADD),e.blendFunc(e.ONE,e.ONE_MINUS_SRC_COLOR);break;case Z:e.blendEquationSeparate(e.FUNC_ADD,e.FUNC_ADD),e.blendFuncSeparate(e.ONE_MINUS_DST_COLOR,e.ONE_MINUS_SRC_COLOR,e.ONE,e.ONE);break;case Q:e.blendEquation(e.FUNC_ADD),e.blendFunc(e.ONE,e.ZERO);break;case Y:e.blendEquationSeparate(e.FUNC_REVERSE_SUBTRACT,e.FUNC_ADD),e.blendFuncSeparate(e.ONE,e.ONE,e.ONE,e.ONE_MINUS_SRC_ALPHA);break;case q:this.blendExt?(e.blendEquationSeparate(this.blendExt.MIN||this.blendExt.MIN_EXT,e.FUNC_ADD),e.blendFuncSeparate(e.ONE,e.ONE,e.ONE,e.ONE)):console.warn("blendMode(DARKEST) does not work in your browser in WEBGL mode.");break;case H:this.blendExt?(e.blendEquationSeparate(this.blendExt.MAX||this.blendExt.MAX_EXT,e.FUNC_ADD),e.blendFuncSeparate(e.ONE,e.ONE,e.ONE,e.ONE)):console.warn("blendMode(LIGHTEST) does not work in your browser in WEBGL mode.");break;default:console.error("Oops! Somehow RendererGL set curBlendMode to an unsupported mode.")}this._cachedBlendMode=this.states.curBlendMode},ea.prototype.shader=function(e){this.states.setValue("userFillShader",e),this.states.setValue("_useNormalMaterial",!1),e.ensureCompiledOnContext(this),e.setDefaultUniforms()},ea.prototype.strokeShader=function(e){this.states.setValue("userStrokeShader",e),e.ensureCompiledOnContext(this),e.setDefaultUniforms()},ea.prototype.imageShader=function(e){this.states.setValue("userImageShader",e),e.ensureCompiledOnContext(this),e.setDefaultUniforms()},ea.prototype.resetShader=function(){this.states.setValue("userFillShader",null),this.states.setValue("userStrokeShader",null),this.states.setValue("userImageShader",null)},ea.prototype.texture=function(e){this.states.setValue("drawMode",ye),this.states.setValue("_useNormalMaterial",!1),this.states.setValue("_tex",e),this.states.setValue("fillColor",new pr([1,1,1]))},ea.prototype.normalMaterial=function(...e){this.states.setValue("drawMode",me),this.states.setValue("_useSpecularMaterial",!1),this.states.setValue("_useEmissiveMaterial",!1),this.states.setValue("_useNormalMaterial",!0),this.states.setValue("curFillColor",[1,1,1,1]),this.states.setValue("fillColor",new pr([1,1,1])),this.states.setValue("strokeColor",null)},ea.prototype.shininess=function(e){e<1&&(e=1),this.states.setValue("_useShininess",e)},ea.prototype.metalness=function(e){const t=1-Math.exp(-e/100);this.states.setValue("_useMetalness",t)}}function oa(e,t){const i=t.DEGREES="degrees",r=t.RADIANS="radians";t._angleMode=r,t.acos=function(e){return this._fromRadians(Math.acos(e))},t.asin=function(e){return this._fromRadians(Math.asin(e))},t.atan=function(e){return this._fromRadians(Math.atan(e))},t.atan2=function(e,t){return this._fromRadians(Math.atan2(e,t))},t.cos=function(e){return Math.cos(this._toRadians(e))},t.sin=function(e){return Math.sin(this._toRadians(e))},t.tan=function(e){return Math.tan(this._toRadians(e))},t.degrees=e=>e*b,t.radians=e=>e*v,t.angleMode=function(e){if(void 0===e)return this._angleMode;if(e===i||e===r){if(e===this._angleMode)return;e===r?(this.pRotationX=this.pRotationX*v,this.pRotationY=this.pRotationY*v,this.pRotationZ=this.pRotationZ*v):(this.pRotationX=this.pRotationX*b,this.pRotationY=this.pRotationY*b,this.pRotationZ=this.pRotationZ*b),this._angleMode=e}},t._toRadians=function(e){return this._angleMode===i?e*v:e},t._toDegrees=function(e){return this._angleMode===r?e*b:e},t._fromRadians=function(e){return this._angleMode===i?e*b:e},t._fromDegrees=function(e){return this._angleMode===r?e*v:e}}void 0!==p5&&ta(p5,p5.prototype),void 0!==p5&&sa(p5,p5.prototype),void 0!==p5&&na(0,p5.prototype),void 0!==p5&&loading(p5,p5.prototype),void 0!==p5&&oa(0,p5.prototype);class ha{constructor(e,t,i,s,n){const a=i||r;return this._pInst=s,this._renderer=new xa[a](this._pInst,e,t,!1,n),this._initializeInstanceVariables(this),this._renderer._applyDefaults(),this}get deltaTime(){return this._pInst.deltaTime}get canvas(){return this._renderer?.canvas}get drawingContext(){return this._renderer.drawingContext}get width(){return this._renderer?.width}get height(){return this._renderer?.height}get pixels(){return this._renderer?.pixels}pixelDensity(e){let t;return"number"==typeof e?(e!==this._renderer._pixelDensity&&(this._renderer._pixelDensity=e),t=this,this.resizeCanvas(this.width,this.height,!0)):t=this._renderer._pixelDensity,t}resizeCanvas(e,t){this._renderer.resize(e,t)}reset(){this._renderer.resetMatrix(),this._renderer.isP3D&&this._renderer._update()}remove(){this._renderer.remove(),this._renderer=void 0}createFramebuffer(e){return new ma(this._renderer,e)}_assert3d(e){if(!this._renderer.isP3D)throw new Error(`${e}() is only supported in WEBGL mode. If you'd like to use 3D graphics and WebGL, see https://p5js.org/examples/form-3d-primitives.html for more information.`)}_initializeInstanceVariables(){this._accessibleOutputs={text:!1,grid:!1,textLabel:!1,gridLabel:!1},this._styles=[],this._downKeys={}}}class ua{constructor(e,t,i){this._renderer=e;const r=this._renderer.GL;i=i||{},this.src=t,this.glTex=void 0,this.glTarget=r.TEXTURE_2D,this.glFormat=i.format||r.RGBA,this.mipmaps=!1,this.glMinFilter=i.minFilter||r.LINEAR,this.glMagFilter=i.magFilter||r.LINEAR,this.glWrapS=i.wrapS||r.CLAMP_TO_EDGE,this.glWrapT=i.wrapT||r.CLAMP_TO_EDGE,this.glDataType=i.dataType||r.UNSIGNED_BYTE;const s=pa(e);this.glFormat!==r.HALF_FLOAT||s.halfFloat||(console.log("This device does not support dataType HALF_FLOAT. Falling back to FLOAT."),this.glDataType=r.FLOAT),this.glFormat!==r.HALF_FLOAT||this.glMinFilter!==r.LINEAR&&this.glMagFilter!==r.LINEAR||s.halfFloatLinear||(console.log("This device does not support linear filtering for dataType FLOAT. Falling back to NEAREST."),this.glMinFilter===r.LINEAR&&(this.glMinFilter=r.NEAREST),this.glMagFilter===r.LINEAR&&(this.glMagFilter=r.NEAREST)),this.glFormat!==r.FLOAT||s.float||(console.log("This device does not support dataType FLOAT. Falling back to UNSIGNED_BYTE."),this.glDataType=r.UNSIGNED_BYTE),this.glFormat!==r.FLOAT||this.glMinFilter!==r.LINEAR&&this.glMagFilter!==r.LINEAR||s.floatLinear||(console.log("This device does not support linear filtering for dataType FLOAT. Falling back to NEAREST."),this.glMinFilter===r.LINEAR&&(this.glMinFilter=r.NEAREST),this.glMagFilter===r.LINEAR&&(this.glMagFilter=r.NEAREST)),this.isSrcMediaElement=!1,this._videoPrevUpdateTime=0,this.isSrcHTMLElement=void 0!==Mr&&t instanceof Mr&&!(t instanceof ha)&&!(t instanceof xs),this.isSrcP5Image=t instanceof Wr,this.isSrcP5Graphics=t instanceof ha,this.isSrcP5Renderer=t instanceof xs,this.isImageData="undefined"!=typeof ImageData&&t instanceof ImageData,this.isFramebufferTexture=t instanceof ga;const n=this._getTextureDataFromSource();return this.width=n.width,this.height=n.height,this.init(n),this}remove(){if(this.glTex){this._renderer.GL.deleteTexture(this.glTex),this.glTex=void 0}}_getTextureDataFromSource(){let e;return this.isFramebufferTexture?e=this.src.rawTexture():this.isSrcP5Image?e=this.src.canvas:this.isSrcMediaElement||this.isSrcHTMLElement?(this.src._ensureCanvas&&this.src._ensureCanvas(),e=this.src.elt):this.isSrcP5Graphics||this.isSrcP5Renderer?e=this.src.canvas:this.isImageData&&(e=this.src),e}init(e){const t=this._renderer.GL;if(this.isFramebufferTexture||(this.glTex=t.createTexture()),this.glWrapS=this._renderer.states.textureWrapX,this.glWrapT=this._renderer.states.textureWrapY,this.setWrapMode(this.glWrapS,this.glWrapT),this.bindTexture(),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,this.glMagFilter),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,this.glMinFilter),this.isFramebufferTexture);else if(0===this.width||0===this.height||this.isSrcMediaElement&&!this.src.loadedmetadata){const e=new Uint8Array([1,1,1,1]);t.texImage2D(this.glTarget,0,t.RGBA,1,1,0,this.glFormat,this.glDataType,e)}else t.texImage2D(this.glTarget,0,this.glFormat,this.glFormat,this.glDataType,e)}update(){const e=this.src;if(0===e.width||0===e.height)return!1;if(this.isFramebufferTexture)return!1;const t=this._getTextureDataFromSource();let i=!1;const r=this._renderer.GL;return t.width!==this.width||t.height!==this.height?(i=!0,this.width=t.width||e.width,this.height=t.height||e.height,this.isSrcP5Image?e.setModified(!1):(this.isSrcMediaElement||this.isSrcHTMLElement)&&e.setModified&&e.setModified(!0)):this.isSrcP5Image?e.isModified()&&(i=!0,e.setModified(!1)):this.isSrcMediaElement?e.isModified()?(i=!0,e.setModified(!1)):e.loadedmetadata&&this._videoPrevUpdateTime!==e.time()&&(this._videoPrevUpdateTime=e.time(),i=!0):this.isImageData?e._dirty&&(e._dirty=!1,i=!0):i=!0,i&&(this.bindTexture(),r.texImage2D(this.glTarget,0,this.glFormat,this.glFormat,this.glDataType,t)),i}bindTexture(){return this._renderer.GL.bindTexture(this.glTarget,this.getTexture()),this}unbindTexture(){this._renderer.GL.bindTexture(this.glTarget,null)}getTexture(){return this.isFramebufferTexture?this.src.rawTexture():this.glTex}setInterpolation(e,t){const i=this._renderer.GL;this.glMinFilter=this.glFilter(e),this.glMagFilter=this.glFilter(t),this.bindTexture(),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MIN_FILTER,this.glMinFilter),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MAG_FILTER,this.glMagFilter),this.unbindTexture()}glFilter(e){const t=this._renderer.GL;return e===ve?t.NEAREST:t.LINEAR}setWrapMode(e,t){const i=this._renderer.GL,r=e=>!(e&e-1),s=this._getTextureDataFromSource();let a,o;s.naturalWidth&&s.naturalHeight?(a=s.naturalWidth,o=s.naturalHeight):(a=this.width,o=this.height);const h=r(a),u=r(o);e===be?this._renderer.webglVersion===n||h&&u?this.glWrapS=i.REPEAT:(console.warn("You tried to set the wrap mode to REPEAT but the texture size is not a power of two. Setting to CLAMP instead"),this.glWrapS=i.CLAMP_TO_EDGE):e===we?this._renderer.webglVersion===n||h&&u?this.glWrapS=i.MIRRORED_REPEAT:(console.warn("You tried to set the wrap mode to MIRROR but the texture size is not a power of two. Setting to CLAMP instead"),this.glWrapS=i.CLAMP_TO_EDGE):this.glWrapS=i.CLAMP_TO_EDGE,t===be?this._renderer.webglVersion===n||h&&u?this.glWrapT=i.REPEAT:(console.warn("You tried to set the wrap mode to REPEAT but the texture size is not a power of two. Setting to CLAMP instead"),this.glWrapT=i.CLAMP_TO_EDGE):t===we?this._renderer.webglVersion===n||h&&u?this.glWrapT=i.MIRRORED_REPEAT:(console.warn("You tried to set the wrap mode to MIRROR but the texture size is not a power of two. Setting to CLAMP instead"),this.glWrapT=i.CLAMP_TO_EDGE):this.glWrapT=i.CLAMP_TO_EDGE,this.bindTexture(),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_S,this.glWrapS),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_T,this.glWrapT),this.unbindTexture()}}class la extends ua{constructor(e,t,i){super(e,t,i);const r=this._renderer.GL;this.glMinFilter===r.LINEAR&&(this.glMinFilter=r.LINEAR_MIPMAP_LINEAR)}glFilter(e){return this._renderer.GL.LINEAR_MIPMAP_LINEAR}_getTextureDataFromSource(){return this.src}init(e){const t=this._renderer.GL;this.glTex=t.createTexture(),this.bindTexture();for(let i=0;i<e.length;i++)t.texImage2D(this.glTarget,i,this.glFormat,this.glFormat,this.glDataType,e[i]);this.glMinFilter=t.LINEAR_MIPMAP_LINEAR,t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,this.glMagFilter),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,this.glMinFilter),this.unbindTexture()}update(){}}function ca(e,t){e.Texture=ua,e.MipmapTexture=la}function pa({GL:e,webglVersion:t}){const i=e,r=t===n?i.getExtension("EXT_color_buffer_float")&&i.getExtension("EXT_float_blend"):i.getExtension("OES_texture_float"),s=r&&i.getExtension("OES_texture_float_linear"),a=t===n?i.getExtension("EXT_color_buffer_float"):i.getExtension("OES_texture_half_float");return{float:r,floatLinear:s,halfFloat:a,halfFloatLinear:a&&i.getExtension("OES_texture_half_float_linear")}}void 0!==p5&&ca(p5);const da=(e,t,i)=>Math.max(Math.min(e,i),t);class fa extends bn{constructor(e){super(e.renderer),this.fbo=e,this.yScale=-1}_computeCameraDefaultSettings(){super._computeCameraDefaultSettings(),this.defaultAspectRatio=this.fbo.width/this.fbo.height,this.defaultCameraFOV=2*Math.atan(this.fbo.height/2/this.defaultEyeZ)}}class ga{constructor(e,t){this.framebuffer=e,this.property=t}get width(){return this.framebuffer.width*this.framebuffer.density}get height(){return this.framebuffer.height*this.framebuffer.density}rawTexture(){return this.framebuffer[this.property]}}class ma{constructor(e,t={}){this.renderer=e,this.renderer.framebuffers.add(this),this._isClipApplied=!1,this.pixels=[],this.format=t.format||ke,this.channels=t.channels||(this.renderer._pInst._glAttributes.alpha?Cr:fr),this.useDepth=void 0===t.depth||t.depth,this.depthFormat=t.depthFormat||Be,this.textureFiltering=t.textureFiltering||ge,void 0===t.antialias?this.antialiasSamples=this.renderer._pInst._glAttributes.antialias?2:0:"number"==typeof t.antialias?this.antialiasSamples=t.antialias:this.antialiasSamples=t.antialias?2:0,this.antialias=this.antialiasSamples>0,this.antialias&&this.renderer.webglVersion!==n&&(console.warn("Antialiasing is unsupported in a WebGL 1 context"),this.antialias=!1),this.density=t.density||this.renderer._pixelDensity;const i=this.renderer.GL;if(this.gl=i,t.width&&t.height){const e=this.renderer._adjustDimensions(t.width,t.height);this.width=e.adjustedWidth,this.height=e.adjustedHeight,this._autoSized=!1}else void 0===t.width!=(void 0===t.height)&&console.warn("Please supply both width and height for a framebuffer to give it a size. Only one was given, so the framebuffer will match the size of its canvas."),this.width=this.renderer.width,this.height=this.renderer.height,this._autoSized=!0;if(this._checkIfFormatsAvailable(),t.stencil&&!this.useDepth&&console.warn("A stencil buffer can only be used if also using depth. Since the framebuffer has no depth buffer, the stencil buffer will be ignored."),this.useStencil=this.useDepth&&(void 0===t.stencil||t.stencil),this.framebuffer=i.createFramebuffer(),!this.framebuffer)throw new Error("Unable to create a framebuffer");if(this.antialias&&(this.aaFramebuffer=i.createFramebuffer(),!this.aaFramebuffer))throw new Error("Unable to create a framebuffer for antialiasing");this._recreateTextures();const r=this.renderer.states.curCamera;this.defaultCamera=this.createCamera(),this.filterCamera=this.createCamera(),this.renderer.states.setValue("curCamera",r),this.draw((()=>this.renderer.clear()))}resize(e,t){this._autoSized=!1;const i=this.renderer._adjustDimensions(e,t);e=i.adjustedWidth,t=i.adjustedHeight,this.width=e,this.height=t,this._handleResize()}pixelDensity(e){if(!e)return this.density;this._autoSized=!1,this.density=e,this._handleResize()}autoSized(e){if(void 0===e)return this._autoSized;this._autoSized=e,this._handleResize()}_checkIfFormatsAvailable(){const e=this.gl;this.useDepth&&this.renderer.webglVersion===s&&!e.getExtension("WEBGL_depth_texture")&&(console.warn("Unable to create depth textures in this environment. Falling back to a framebuffer without depth."),this.useDepth=!1),this.useDepth&&this.renderer.webglVersion===s&&this.depthFormat===Be&&(console.warn("FLOAT depth format is unavailable in WebGL 1. Defaulting to UNSIGNED_INT."),this.depthFormat=Ie),[ke,Be,Le].includes(this.format)||(console.warn("Unknown Framebuffer format. Please use UNSIGNED_BYTE, FLOAT, or HALF_FLOAT. Defaulting to UNSIGNED_BYTE."),this.format=ke),this.useDepth&&![Ie,Be].includes(this.depthFormat)&&(console.warn("Unknown Framebuffer depth format. Please use UNSIGNED_INT or FLOAT. Defaulting to FLOAT."),this.depthFormat=Be);const t=pa(this.renderer);t.float||this.format!==Be||(console.warn("This environment does not support FLOAT textures. Falling back to UNSIGNED_BYTE."),this.format=ke),this.useDepth&&!t.float&&this.depthFormat===Be&&(console.warn("This environment does not support FLOAT depth textures. Falling back to UNSIGNED_INT."),this.depthFormat=Ie),t.halfFloat||this.format!==Le||(console.warn("This environment does not support HALF_FLOAT textures. Falling back to UNSIGNED_BYTE."),this.format=ke),this.channels===fr&&[Be,Le].includes(this.format)&&(console.warn("FLOAT and HALF_FLOAT formats do not work cross-platform with only RGB channels. Falling back to RGBA."),this.channels=Cr)}_recreateTextures(){const e=this.gl;this._updateSize();const t=e.getParameter(e.TEXTURE_BINDING_2D),i=e.getParameter(e.FRAMEBUFFER_BINDING),r=e.createTexture();if(!r)throw new Error("Unable to create color texture");e.bindTexture(e.TEXTURE_2D,r);const s=this._glColorFormat();if(e.texImage2D(e.TEXTURE_2D,0,s.internalFormat,this.width*this.density,this.height*this.density,0,s.format,s.type,null),this.colorTexture=r,e.bindFramebuffer(e.FRAMEBUFFER,this.framebuffer),e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,r,0),this.useDepth){const t=e.createTexture();if(!t)throw new Error("Unable to create depth texture");const i=this._glDepthFormat();e.bindTexture(e.TEXTURE_2D,t),e.texImage2D(e.TEXTURE_2D,0,i.internalFormat,this.width*this.density,this.height*this.density,0,i.format,i.type,null),e.framebufferTexture2D(e.FRAMEBUFFER,this.useStencil?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT,e.TEXTURE_2D,t,0),this.depthTexture=t}if(this.antialias){if(this.colorRenderbuffer=e.createRenderbuffer(),e.bindRenderbuffer(e.RENDERBUFFER,this.colorRenderbuffer),e.renderbufferStorageMultisample(e.RENDERBUFFER,Math.max(0,Math.min(this.antialiasSamples,e.getParameter(e.MAX_SAMPLES))),s.internalFormat,this.width*this.density,this.height*this.density),this.useDepth){const t=this._glDepthFormat();this.depthRenderbuffer=e.createRenderbuffer(),e.bindRenderbuffer(e.RENDERBUFFER,this.depthRenderbuffer),e.renderbufferStorageMultisample(e.RENDERBUFFER,Math.max(0,Math.min(this.antialiasSamples,e.getParameter(e.MAX_SAMPLES))),t.internalFormat,this.width*this.density,this.height*this.density)}e.bindFramebuffer(e.FRAMEBUFFER,this.aaFramebuffer),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.RENDERBUFFER,this.colorRenderbuffer),this.useDepth&&e.framebufferRenderbuffer(e.FRAMEBUFFER,this.useStencil?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT,e.RENDERBUFFER,this.depthRenderbuffer)}if(this.useDepth){this.depth=new ga(this,"depthTexture");const t=e.NEAREST;this.depthP5Texture=new ua(this.renderer,this.depth,{minFilter:t,magFilter:t}),this.renderer.textures.set(this.depth,this.depthP5Texture)}this.color=new ga(this,"colorTexture");const n=this.textureFiltering===ge?e.LINEAR:e.NEAREST;this.colorP5Texture=new ua(this.renderer,this.color,{minFilter:n,magFilter:n}),this.renderer.textures.set(this.color,this.colorP5Texture),e.bindTexture(e.TEXTURE_2D,t),e.bindFramebuffer(e.FRAMEBUFFER,i)}_glColorFormat(){let e,t,i;const r=this.gl;if(e=this.format===Be?r.FLOAT:this.format===Le?this.renderer.webglVersion===n?r.HALF_FLOAT:r.getExtension("OES_texture_half_float").HALF_FLOAT_OES:r.UNSIGNED_BYTE,t=this.channels===Cr?r.RGBA:r.RGB,this.renderer.webglVersion===n){i={[r.FLOAT]:{[r.RGBA]:r.RGBA32F},[r.HALF_FLOAT]:{[r.RGBA]:r.RGBA16F},[r.UNSIGNED_BYTE]:{[r.RGBA]:r.RGBA8,[r.RGB]:r.RGB8}}[e][t]}else i=this.format===Le?r.RGBA:t;return{internalFormat:i,format:t,type:e}}_glDepthFormat(){let e,t,i;const r=this.gl;return e=this.useStencil?this.depthFormat===Be?r.FLOAT_32_UNSIGNED_INT_24_8_REV:this.renderer.webglVersion===n?r.UNSIGNED_INT_24_8:r.getExtension("WEBGL_depth_texture").UNSIGNED_INT_24_8_WEBGL:this.depthFormat===Be?r.FLOAT:r.UNSIGNED_INT,t=this.useStencil?r.DEPTH_STENCIL:r.DEPTH_COMPONENT,i=this.useStencil?this.depthFormat===Be?r.DEPTH32F_STENCIL8:this.renderer.webglVersion===n?r.DEPTH24_STENCIL8:r.DEPTH_STENCIL:this.renderer.webglVersion===n?this.depthFormat===Be?r.DEPTH_COMPONENT32F:r.DEPTH_COMPONENT24:r.DEPTH_COMPONENT,{internalFormat:i,format:t,type:e}}_updateSize(){this._autoSized&&(this.width=this.renderer.width,this.height=this.renderer.height,this.density=this.renderer._pixelDensity)}_canvasSizeChanged(){this._autoSized&&this._handleResize()}_handleResize(){const e=this.color,t=this.depth,i=this.colorRenderbuffer,r=this.depthRenderbuffer;this._deleteTexture(e),t&&this._deleteTexture(t);const s=this.gl;i&&s.deleteRenderbuffer(i),r&&s.deleteRenderbuffer(r),this._recreateTextures(),this.defaultCamera._resize()}createCamera(){const e=new fa(this);return e._computeCameraDefaultSettings(),e._setDefaultCamera(),e}_deleteTexture(e){this.gl.deleteTexture(e.rawTexture()),this.renderer.textures.delete(e)}remove(){const e=this.gl;this._deleteTexture(this.color),this.depth&&this._deleteTexture(this.depth),e.deleteFramebuffer(this.framebuffer),this.aaFramebuffer&&e.deleteFramebuffer(this.aaFramebuffer),this.depthRenderbuffer&&e.deleteRenderbuffer(this.depthRenderbuffer),this.colorRenderbuffer&&e.deleteRenderbuffer(this.colorRenderbuffer),this.renderer.framebuffers.delete(this)}begin(){this.prevFramebuffer=this.renderer.activeFramebuffer(),this.prevFramebuffer&&this.prevFramebuffer._beforeEnd(),this.renderer.activeFramebuffers.push(this),this._beforeBegin(),this.renderer.push(),this.renderer.states.setValue("curCamera",this.defaultCamera),this.renderer.states.setValue("uPMatrix",this.renderer.states.uPMatrix.clone()),this.renderer.states.uPMatrix.set(this.defaultCamera.projMatrix),this.renderer.states.setValue("uViewMatrix",this.renderer.states.uViewMatrix.clone()),this.renderer.states.uViewMatrix.set(this.defaultCamera.cameraMatrix),this.renderer.resetMatrix(),this.renderer.states.uViewMatrix.set(this.renderer.states.curCamera.cameraMatrix),this.renderer.states.uModelMatrix.reset(),this.renderer._applyStencilTestIfClipping()}_framebufferToBind(){return this.antialias?this.aaFramebuffer:this.framebuffer}_beforeBegin(){const e=this.gl;e.bindFramebuffer(e.FRAMEBUFFER,this._framebufferToBind()),this.renderer.viewport(this.width*this.density,this.height*this.density)}_beforeEnd(){if(this.antialias){const e=this.gl;e.bindFramebuffer(e.READ_FRAMEBUFFER,this.aaFramebuffer),e.bindFramebuffer(e.DRAW_FRAMEBUFFER,this.framebuffer);const t=[[e.COLOR_BUFFER_BIT,this.colorP5Texture.glMagFilter]];this.useDepth&&t.push([e.DEPTH_BUFFER_BIT,this.depthP5Texture.glMagFilter]);for(const[i,r]of t)e.blitFramebuffer(0,0,this.width*this.density,this.height*this.density,0,0,this.width*this.density,this.height*this.density,i,r)}}end(){const e=this.gl;this.renderer.pop();if(this.renderer.activeFramebuffers.pop()!==this)throw new Error("It looks like you've called end() while another Framebuffer is active.");this._beforeEnd(),this.prevFramebuffer?this.prevFramebuffer._beforeBegin():(e.bindFramebuffer(e.FRAMEBUFFER,null),this.renderer.viewport(this.renderer._origViewport.width,this.renderer._origViewport.height)),this.renderer._applyStencilTestIfClipping()}draw(e){this.begin(),e(),this.end()}loadPixels(){const e=this.gl,t=this.renderer.activeFramebuffer();e.bindFramebuffer(e.FRAMEBUFFER,this.framebuffer);const i=this._glColorFormat();this.pixels=ia(this.pixels,e,this.framebuffer,0,0,this.width*this.density,this.height*this.density,i.format,i.type),t?e.bindFramebuffer(e.FRAMEBUFFER,t._framebufferToBind()):e.bindFramebuffer(e.FRAMEBUFFER,null)}get(e,t,i,r){const s=this._glColorFormat();if(void 0===e&&void 0===t)e=0,t=0,i=this.width,r=this.height;else if(void 0===i&&void 0===r)return(e<0||t<0||e>=this.width||t>=this.height)&&(console.warn("The x and y values passed to p5.Framebuffer.get are outside of its range and will be clamped."),e=da(e,0,this.width-1),t=da(t,0,this.height-1)),ra(this.gl,this.framebuffer,e*this.density,t*this.density,s.format,s.type);e=da(e,0,this.width-1),t=da(t,0,this.height-1),i=da(i,1,this.width-e),r=da(r,1,this.height-t);const n=ia(void 0,this.gl,this.framebuffer,e*this.density,t*this.density,i*this.density,r*this.density,s.format,s.type),a=new Uint8ClampedArray(i*r*this.density*this.density*4);a.fill(255);const o=s.type===this.gl.RGB?3:4;for(let e=0;e<r*this.density;e++)for(let t=0;t<i*this.density;t++)for(let r=0;r<4;r++){const s=4*(e*i*this.density+t)+r;if(r<o){const h=4===o?s:(e*i*this.density+t)*o+r;a[s]=n[h]}}const h=new Wr(i*this.density,r*this.density);return h.imageData=h.canvas.getContext("2d").createImageData(h.width,h.height),h.imageData.data.set(a),h.pixels=h.imageData.data,h.updatePixels(),1!==this.density&&h.resize(i,r),h}updatePixels(){const e=this.gl;this.colorP5Texture.bindTexture();const t=this._glColorFormat(),i=t.format===e.RGBA?4:3,r=this.width*this.height*this.density*this.density*i,s=t.type===e.UNSIGNED_BYTE?Uint8Array:Float32Array;if(!(this.pixels instanceof s)||this.pixels.length!==r)throw new Error("The pixels array has not been set correctly. Please call loadPixels() before updatePixels().");e.texImage2D(e.TEXTURE_2D,0,t.internalFormat,this.width*this.density,this.height*this.density,0,t.format,t.type,this.pixels),this.colorP5Texture.unbindTexture();const n=this.renderer.activeFramebuffer();this.antialias?(this.begin(),this.renderer.push(),this.renderer.states.setValue("imageMode",_),this.renderer.setCamera(this.filterCamera),this.renderer.resetMatrix(),this.renderer.states.setValue("strokeColor",null),this.renderer.clear(),this.renderer._drawingFilter=!0,this.renderer.image(this,0,0,this.width,this.height,-this.renderer.width/2,-this.renderer.height/2,this.renderer.width,this.renderer.height),this.renderer._drawingFilter=!1,this.renderer.pop(),this.useDepth&&(e.clearDepth(1),e.clear(e.DEPTH_BUFFER_BIT)),this.end()):(e.bindFramebuffer(e.FRAMEBUFFER,this.framebuffer),this.useDepth&&(e.clearDepth(1),e.clear(e.DEPTH_BUFFER_BIT)),n?e.bindFramebuffer(e.FRAMEBUFFER,n._framebufferToBind()):e.bindFramebuffer(e.FRAMEBUFFER,null))}}function ya(e,t){e.FramebufferCamera=fa,e.FramebufferTexture=ga,e.Framebuffer=ma}let xa;function va(e,t){xa=e.renderers={},t.createCanvas=function(e,t,i,...s){let n=r;return Reflect.ownKeys(xa).includes(i)?n=i:s.unshift(i),this._renderer&&this._renderer.remove(),this._renderer=new xa[n](this,e,t,!0,...s),this._defaultGraphicsCreated=!0,this._elements.push(this._renderer),this._renderer._applyDefaults(),Object.hasOwn(this,"pixels")||Object.defineProperty(this,"pixels",{get(){return this._renderer?.pixels}}),this._renderer},t.resizeCanvas=function(e,t,i){this._renderer&&(this._renderer.resize(e,t),i||this.redraw()),this._addAccsOutput()&&this._updateAccsOutput()},t.noCanvas=function(){this.canvas&&this.canvas.parentNode.removeChild(this.canvas)},t.createGraphics=function(t,i,...s){return s[0]instanceof HTMLCanvasElement&&(s[1]=s[0],s[0]=r),new e.Graphics(t,i,s[0],this,s[1])},t.createFramebuffer=function(e){return new ma(this._renderer,e)},t.clearDepth=function(e){this._assert3d("clearDepth"),this._renderer.clearDepth(e)}}void 0!==p5&&ya(p5),void 0!==p5&&va(p5,p5.prototype);class ba{constructor(e){this.pInst=e,this.canvas=document.createElement("canvas"),this.canvas.width=e.width,this.canvas.height=e.height;let t=n;this.gl=this.canvas.getContext("webgl2"),this.gl||(t=s,this.gl=this.canvas.getContext("webgl")),this.gl?(this._renderer={GL:this.gl,registerEnabled:new Set,_curShader:null,_emptyTexture:null,webglVersion:t,states:{textureWrapX:this.gl.CLAMP_TO_EDGE,textureWrapY:this.gl.CLAMP_TO_EDGE},_arraysEqual:(e,t)=>JSON.stringify(e)===JSON.stringify(t),_getEmptyTexture:()=>{if(!this._emptyTexture){const e=new Wr(1,1);e.set(0,0,255),this._emptyTexture=new ua(this._renderer,e)}return this._emptyTexture}},this._baseFilterShader=void 0,this.filterShaderSources={[pe]:Un,[he]:jn,[ne]:$n,[ce]:Rn,[ae]:Nn,[le]:Vn,[ue]:Gn,[oe]:zn},this.filterShaders={},this.operation=null,this.filterParameter=1,this.customShader=null,this._shader=null,this.vertexBuffer=this.gl.createBuffer(),this.texcoordBuffer=this.gl.createBuffer(),this.vertices=new Float32Array([-1,-1,1,-1,-1,1,1,1]),this.texcoords=new Float32Array([0,1,1,1,0,0,1,0]),this._bindBufferData(this.vertexBuffer,this.gl.ARRAY_BUFFER,this.vertices),this._bindBufferData(this.texcoordBuffer,this.gl.ARRAY_BUFFER,this.texcoords)):console.error("WebGL not supported, cannot apply filter.")}_webGL2CompatibilityPrefix(e,t){let i="";return this._renderer.webglVersion===n&&(i+="#version 300 es\n#define WEBGL2\n"),"vert"===e?i+="#define VERTEX_SHADER\n":"frag"===e&&(i+="#define FRAGMENT_SHADER\n"),t&&(i+=`precision ${t} float;\n`),i}baseFilterShader(){return this._baseFilterShader||(this._baseFilterShader=new Dn(this._renderer,this._webGL2CompatibilityPrefix("vert","highp")+Pn+Bn,this._webGL2CompatibilityPrefix("frag","highp")+Pn+On,{vertex:{},fragment:{"vec4 getColor":"(FilterInputs inputs, in sampler2D canvasContent) {\n return getTexture(canvasContent, inputs.texCoord);\n }"}})),this._baseFilterShader}setOperation(e,t,i=null){this.operation=e,this.filterParameter=t,e in In&&void 0===t&&(this.filterParameter=In[e]),this.customShader=i,this._initializeShader()}_initializeShader(){if(this.customShader)return void(this._shader=this.customShader);if(!this.operation)return void console.error("No operation set for FilterRenderer2D, cannot initialize shader.");if(this.filterShaders[this.operation])return void(this._shader=this.filterShaders[this.operation]);const e=this.filterShaderSources[this.operation];if(!e)return void console.error("No shader available for this operation:",this.operation);const t=new Dn(this._renderer,Wn,e);this.filterShaders[this.operation]=t,this._shader=t}_bindBufferData(e,t,i){const r=this.gl;r.bindBuffer(t,e),r.bufferData(t,i,r.STATIC_DRAW)}get canvasTexture(){return this._canvasTexture||(this._canvasTexture=new ua(this._renderer,this.pInst.wrappedElt)),this._canvasTexture}_renderPass(){const e=this.gl;this._shader.bindShader();const t=this.pInst.pixelDensity?this.pInst.pixelDensity():1,i=[1/(this.pInst.width*t),1/(this.pInst.height*t)],r=this.canvasTexture;this._shader.setUniform("tex0",r),this._shader.setUniform("texelSize",i),this._shader.setUniform("canvasSize",[this.pInst.width,this.pInst.height]),this._shader.setUniform("radius",Math.max(1,this.filterParameter)),this._shader.setUniform("filterParameter",this.filterParameter),this._shader.setDefaultUniforms(),this.pInst.states.setValue("rectMode",_),this.pInst.states.setValue("imageMode",_),this.pInst.blendMode(j),this.pInst.resetMatrix();const s=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];this._shader.setUniform("uModelViewMatrix",s),this._shader.setUniform("uProjectionMatrix",s),e.bindBuffer(e.ARRAY_BUFFER,this.vertexBuffer),this._shader.enableAttrib(this._shader.attributes.aPosition,2),e.bindBuffer(e.ARRAY_BUFFER,this.texcoordBuffer),this._shader.enableAttrib(this._shader.attributes.aTexCoord,2),this._shader.bindTextures(),this._shader.disableRemainingAttributes(),e.drawArrays(e.TRIANGLE_STRIP,0,4),this._shader.unbindShader()}applyFilter(){this._shader?(this.pInst.push(),this.pInst.resetMatrix(),this.operation!==pe||this.customShader?(this._renderPass(),this.pInst.clear(),this.pInst.blendMode(j),this.pInst.drawingContext.drawImage(this.canvas,0,0,this.pInst.width,this.pInst.height)):(this._shader.setUniform("direction",[1,0]),this._renderPass(),this.pInst.clear(),this.pInst.drawingContext.drawImage(this.canvas,0,0,this.pInst.width,this.pInst.height),this._shader.setUniform("direction",[0,1]),this._renderPass(),this.pInst.clear(),this.pInst.drawingContext.drawImage(this.canvas,0,0,this.pInst.width,this.pInst.height)),this.pInst.pop()):console.error("Cannot apply filter: shader not initialized.")}}const _a="rgba(0,0,0,0)";class wa extends xs{constructor(e,t,i,r,s,n={}){super(e,t,i,r),this.canvas=this.elt=s||document.createElement("canvas"),r?(this._pInst._curElement=this,this._pInst.canvas=this.canvas):this.canvas.style.display="none",this.elt.id="defaultCanvas0",this.elt.classList.add("p5Canvas");for(const e of Object.getOwnPropertyNames(Mr.prototype))"constructor"!==e&&"_"!==e[0]&&Object.defineProperty(this,e,{get(){return this.wrappedElt[e]}});if(this.elt.width=t*this._pixelDensity,this.elt.height=i*this._pixelDensity,this.elt.style.width=`${t}px`,this.elt.style.height=`${i}px`,this._pInst._userNode)this._pInst._userNode.appendChild(this.elt);else{if(0===document.getElementsByTagName("main").length){let e=document.createElement("main");document.body.appendChild(e)}document.getElementsByTagName("main")[0].appendChild(this.elt)}this.drawingContext=this.canvas.getContext("2d",n),"display-p3"===n.colorSpace&&(this.states.colorMode=gr),this.scale(this._pixelDensity,this._pixelDensity),this.filterRenderer||(this.filterRenderer=new ba(this)),this.wrappedElt=new Mr(this.elt,this._pInst),this.clipPath=null}remove(){this.wrappedElt.remove(),this.wrappedElt=null,this.canvas=null,this.elt=null}getFilterGraphicsLayer(){if(!this.filterGraphicsLayer){const e=this._pInst;this.filterGraphicsLayer=new ha(this.width,this.height,s,e)}return this.filterGraphicsLayer.width===this.width&&this.filterGraphicsLayer.height===this.height||this.filterGraphicsLayer.resizeCanvas(this.width,this.height),this.filterGraphicsLayer.pixelDensity()!==this._pInst.pixelDensity()&&this.filterGraphicsLayer.pixelDensity(this._pInst.pixelDensity()),this.filterGraphicsLayer}_applyDefaults(){this.states.setValue("_cachedFillStyle",void 0),this.states.setValue("_cachedStrokeStyle",void 0),this._cachedBlendMode=j,this._setFill(Ae),this._setStroke(Ee),this.drawingContext.lineCap=V,this.drawingContext.font="normal 12px sans-serif"}resize(e,t){super.resize(e,t);const i={};for(const e in this.drawingContext){const t=this.drawingContext[e];"object"!=typeof t&&"function"!=typeof t&&(i[e]=t)}this.canvas.width=e*this._pixelDensity,this.canvas.height=t*this._pixelDensity,this.canvas.style.width=`${e}px`,this.canvas.style.height=`${t}px`,this.drawingContext.scale(this._pixelDensity,this._pixelDensity);for(const e in i)try{this.drawingContext[e]=i[e]}catch(e){}}background(...e){if(this.push(),this.resetMatrix(),e[0]instanceof Wr)if(e[1]>=0){const t=e[0];this.drawingContext.globalAlpha=e[1]/255,this._pInst.image(t,0,0,this.width,this.height)}else this._pInst.image(e[0],0,0,this.width,this.height);else{const t=this._pInst.color(...e);this._pInst._addAccsOutput()&&this._pInst._accsBackground(t._getRGBA([255,255,255,255]));const i=t.toString();this._setFill(i),this._isErasing&&this.blendMode(this._cachedBlendMode),this.drawingContext.fillRect(0,0,this.width,this.height),this._isErasing&&this._pInst.erase()}this.pop()}clear(){this.drawingContext.save(),this.resetMatrix(),this.drawingContext.clearRect(0,0,this.width,this.height),this.drawingContext.restore()}fill(...e){super.fill(...e);const t=this.states.fillColor;this._setFill(t.toString()),this._pInst._addAccsOutput()&&this._pInst._accsCanvasColors("fill",t._getRGBA([255,255,255,255]))}stroke(...e){super.stroke(...e);const t=this.states.strokeColor;this._setStroke(t.toString()),this._pInst._addAccsOutput()&&this._pInst._accsCanvasColors("stroke",t._getRGBA([255,255,255,255]))}erase(e,t){if(!this._isErasing){this.states.setValue("_cachedFillStyle",this.drawingContext.fillStyle);const i=this._pInst.color(255,e).toString();this.drawingContext.fillStyle=i,this.states.setValue("_cachedStrokeStyle",this.drawingContext.strokeStyle);const r=this._pInst.color(255,t).toString();this.drawingContext.strokeStyle=r;const s=this._cachedBlendMode;this.blendMode($),this._cachedBlendMode=s,this._isErasing=!0}}noErase(){this._isErasing&&(this.drawingContext.fillStyle=this.states._cachedFillStyle,this.drawingContext.strokeStyle=this.states._cachedStrokeStyle,this.blendMode(this._cachedBlendMode),this._isErasing=!1)}drawShape(e){const t=new ps({strokeWeight:this.states.strokeWeight});e.accept(t),this._clipping?(this.clipPath.addPath(t.path),this.clipPath.closePath()):(this.states.fillColor&&this.drawingContext.fill(t.path),this.states.strokeColor&&this.drawingContext.stroke(t.path))}beginClip(e={}){super.beginClip(e),this.states.setValue("_cachedFillStyle",this.drawingContext.fillStyle);const t=this._pInst.color(255,0).toString();this.drawingContext.fillStyle=t,this.states.setValue("_cachedStrokeStyle",this.drawingContext.strokeStyle);const i=this._pInst.color(255,0).toString();this.drawingContext.strokeStyle=i;const r=this._cachedBlendMode;this.blendMode(j),this._cachedBlendMode=r,this.clipPath=new Path2D,this._clipInvert&&(this.clipPath.moveTo(-2*this.width,-2*this.height),this.clipPath.lineTo(-2*this.width,2*this.height),this.clipPath.lineTo(2*this.width,2*this.height),this.clipPath.lineTo(2*this.width,-2*this.height),this.clipPath.closePath())}endClip(){this.drawingContext.clip(this.clipPath),this.clipPath=null,super.endClip(),this.drawingContext.fillStyle=this.states._cachedFillStyle,this.drawingContext.strokeStyle=this.states._cachedStrokeStyle,this.blendMode(this._cachedBlendMode)}image(e,t,i,r,s,n,a,o,h){let u;e.gifProperties&&e._animateGif(this._pInst);try{e instanceof vs&&e._ensureCanvas(),this.states.tint&&e.canvas&&(u=this._getTintedImageCanvas(e)),u||(u=e.canvas||e.elt);let l=1;e.width&&e.width>0&&(l=u.width/e.width),this._isErasing&&this.blendMode(this._cachedBlendMode),this.drawingContext.drawImage(u,l*t,l*i,l*r,l*s,n,a,o,h),this._isErasing&&this._pInst.erase()}catch(e){if("NS_ERROR_NOT_AVAILABLE"!==e.name)throw e}}_getTintedImageCanvas(e){if(!e.canvas)return e;e.tintCanvas||(e.tintCanvas=document.createElement("canvas")),e.tintCanvas.width!==e.canvas.width&&(e.tintCanvas.width=e.canvas.width),e.tintCanvas.height!==e.canvas.height&&(e.tintCanvas.height=e.canvas.height);const t=e.tintCanvas.getContext("2d");return t.save(),t.clearRect(0,0,e.canvas.width,e.canvas.height),this.states.tint[0]<255||this.states.tint[1]<255||this.states.tint[2]<255?(t.drawImage(e.canvas,0,0),t.globalCompositeOperation="luminosity",t.drawImage(e.canvas,0,0),t.globalCompositeOperation="color",t.drawImage(e.canvas,0,0),t.globalCompositeOperation="multiply",t.fillStyle=`rgb(${this.states.tint.slice(0,3).join(", ")})`,t.fillRect(0,0,e.canvas.width,e.canvas.height),t.globalCompositeOperation="destination-in",t.globalAlpha=this.states.tint[3]/255,t.drawImage(e.canvas,0,0)):(t.globalAlpha=this.states.tint[3]/255,t.drawImage(e.canvas,0,0)),t.restore(),e.tintCanvas}blendMode(e){if(e===Y)console.warn("blendMode(SUBTRACT) only works in WEBGL mode.");else{if(e!==j&&e!==$&&e!==q&&e!==H&&e!==X&&e!==K&&e!==Z&&e!==J&&e!==Q&&e!==ee&&e!==te&&e!==ie&&e!==re&&e!==se&&e!==W)throw new Error(`Mode ${e} not recognized.`);this._cachedBlendMode=e,this.drawingContext.globalCompositeOperation=e}}blend(...e){const t=this.drawingContext.globalCompositeOperation,i=e[e.length-1],r=Array.prototype.slice.call(e,0,e.length-1);this.drawingContext.globalCompositeOperation=i,Ca.prototype.copy.apply(this,r),this.drawingContext.globalCompositeOperation=t}_getPixel(e,t){let i,r;return i=this.drawingContext.getImageData(e,t,1,1).data,r=0,[i[0],i[1],i[2],i[3]]}loadPixels(){const e=this._pixelDensity,t=this.width*e,i=this.height*e,r=this.drawingContext.getImageData(0,0,t,i);this.imageData=r,this.pixels=r.data}set(e,t,i){if(e=Math.floor(e),t=Math.floor(t),i instanceof Wr)this.drawingContext.save(),this.drawingContext.setTransform(1,0,0,1,0,0),this.drawingContext.scale(this._pixelDensity,this._pixelDensity),this.drawingContext.clearRect(e,t,i.width,i.height),this.drawingContext.drawImage(i.canvas,e,t),this.drawingContext.restore();else{let r=0,s=0,n=0,a=0,o=4*(t*this._pixelDensity*(this.width*this._pixelDensity)+e*this._pixelDensity);if(this.imageData||this.loadPixels(),"number"==typeof i)o<this.pixels.length&&(r=i,s=i,n=i,a=255);else if(Array.isArray(i)){if(i.length<4)throw new Error("pixel array must be of the form [R, G, B, A]");o<this.pixels.length&&(r=i[0],s=i[1],n=i[2],a=i[3])}else i instanceof Ca.Color&&o<this.pixels.length&&([r,s,n,a]=i._getRGBA([255,255,255,255]));for(let i=0;i<this._pixelDensity;i++)for(let h=0;h<this._pixelDensity;h++)o=4*((t*this._pixelDensity+h)*this.width*this._pixelDensity+(e*this._pixelDensity+i)),this.pixels[o]=r,this.pixels[o+1]=s,this.pixels[o+2]=n,this.pixels[o+3]=a}}updatePixels(e,t,i,r){const s=this._pixelDensity;void 0===e&&void 0===t&&void 0===i&&void 0===r&&(e=0,t=0,i=this.width,r=this.height),e*=s,t*=s,i*=s,r*=s,this.gifProperties&&(this.gifProperties.frames[this.gifProperties.displayIndex].image=this.imageData),this.drawingContext.putImageData(this.imageData,0,0,e,t,i,r)}arc(e,t,i,r,s,n,a){const o=this.clipPa||this.drawingContext,h=e+i/2,u=t+r/2,l=i/2,c=r/2,p=!(a===P||a===L||(n-s)%x==0);return this.states.fillColor&&(this._clipping||o.beginPath(),o.ellipse(h,u,l,c,0,s,n),p&&o.lineTo(h,u),o.closePath(),this._clipping||o.fill()),this.states.strokeColor&&(this._clipping||o.beginPath(),o.ellipse(h,u,l,c,0,s,n),a===O&&p&&o.lineTo(h,u),a!==O&&a!==P||o.closePath(),this._clipping||o.stroke()),this}ellipse(e){const t=this.clipPath||this.drawingContext,i=!!this.states.fillColor,r=this.states.strokeColor,s=parseFloat(e[0]),n=parseFloat(e[1]),a=parseFloat(e[2]),o=parseFloat(e[3]);if(i&&!r){if(this._getFill()===_a)return this}else if(!i&&r&&this._getStroke()===_a)return this;const h=s+a/2,u=n+o/2,l=a/2,c=o/2;this._clipping||t.beginPath(),t.ellipse(h,u,l,c,0,0,2*Math.PI),t.closePath(),!this._clipping&&i&&t.fill(),!this._clipping&&r&&t.stroke()}line(e,t,i,r){const s=this.clipPath||this.drawingContext;return this.states.strokeColor?(this._getStroke()===_a||(this._clipping||s.beginPath(),s.moveTo(e,t),s.lineTo(i,r),s.stroke()),this):this}point(e,t){const i=this.clipPath||this.drawingContext;if(!this.states.strokeColor)return this;if(this._getStroke()===_a)return this;const r=this._getStroke(),s=this._getFill();this._clipping||this._setFill(r),this._clipping||i.beginPath(),i.arc(e,t,i.lineWidth/2,0,x,!1),this._clipping||(i.fill(),this._setFill(s))}quad(e,t,i,r,s,n,a,o){const h=this.clipPath||this.drawingContext,u=!!this.states.fillColor,l=this.states.strokeColor;if(u&&!l){if(this._getFill()===_a)return this}else if(!u&&l&&this._getStroke()===_a)return this;return this._clipping||h.beginPath(),h.moveTo(e,t),h.lineTo(i,r),h.lineTo(s,n),h.lineTo(a,o),h.closePath(),!this._clipping&&u&&h.fill(),!this._clipping&&l&&h.stroke(),this}rect(e){const t=e[0],i=e[1],r=e[2],s=e[3];let n=e[4],a=e[5],o=e[6],h=e[7];const u=this.clipPath||this.drawingContext,l=!!this.states.fillColor,c=this.states.strokeColor;if(l&&!c){if(this._getFill()===_a)return this}else if(!l&&c&&this._getStroke()===_a)return this;if(this._clipping||u.beginPath(),void 0===n)u.rect(t,i,r,s);else{void 0===a&&(a=n),void 0===o&&(o=a),void 0===h&&(h=o);const e=Math.abs(r),l=Math.abs(s),c=e/2,p=l/2;e<2*n&&(n=c),l<2*n&&(n=p),e<2*a&&(a=c),l<2*a&&(a=p),e<2*o&&(o=c),l<2*o&&(o=p),e<2*h&&(h=c),l<2*h&&(h=p),u.roundRect(t,i,r,s,[n,a,o,h])}return!this._clipping&&this.states.fillColor&&u.fill(),!this._clipping&&this.states.strokeColor&&u.stroke(),this}triangle(e){const t=this.clipPath||this.drawingContext,i=!!this.states.fillColor,r=this.states.strokeColor,s=e[0],n=e[1],a=e[2],o=e[3],h=e[4],u=e[5];if(i&&!r){if(this._getFill()===_a)return this}else if(!i&&r&&this._getStroke()===_a)return this;this._clipping||t.beginPath(),t.moveTo(s,n),t.lineTo(a,o),t.lineTo(h,u),t.closePath(),!this._clipping&&i&&t.fill(),!this._clipping&&r&&t.stroke()}strokeCap(e){return e!==V&&e!==R&&e!==N||(this.drawingContext.lineCap=e),this}strokeJoin(e){return e!==V&&e!==U&&e!==G||(this.drawingContext.lineJoin=e),this}strokeWeight(e){return super.strokeWeight(e),this.drawingContext.lineWidth=void 0===e||0===e?1e-4:e,this}_getFill(){return this.states._cachedFillStyle||this.states.setValue("_cachedFillStyle",this.drawingContext.fillStyle),this.states._cachedFillStyle}_setFill(e){e!==this.states._cachedFillStyle&&(this.drawingContext.fillStyle=e,this.states.setValue("_cachedFillStyle",e))}_getStroke(){return this.states._cachedStrokeStyle||this.states.setValue("_cachedStrokeStyle",this.drawingContext.strokeStyle),this.states._cachedStrokeStyle}_setStroke(e){e!==this.states._cachedStrokeStyle&&(this.drawingContext.strokeStyle=e,this.states.setValue("_cachedStrokeStyle",e))}applyMatrix(e,t,i,r,s,n){this.drawingContext.transform(e,t,i,r,s,n)}getWorldToScreenMatrix(){let e=(new DOMMatrix).scale(1/this._pixelDensity).multiply(this.drawingContext.getTransform());return new ln(e.toFloat32Array())}resetMatrix(){return this.drawingContext.setTransform(1,0,0,1,0,0),this.drawingContext.scale(this._pixelDensity,this._pixelDensity),this}rotate(e){this.drawingContext.rotate(e)}scale(e,t){return this.drawingContext.scale(e,t),this}translate(e,t){return e instanceof Ca.Vector&&(t=e.y,e=e.x),this.drawingContext.translate(e,t),this}push(){return this.drawingContext.save(),super.push()}pop(e){this.drawingContext.restore(),super.pop(e)}}let Ca=class e{static VERSION=i;static instance=null;static lifecycleHooks={presetup:[],postsetup:[],predraw:[],postdraw:[],remove:[]};static _checkForUserDefinedFunctions=()=>{};static _friendlyFileLoadError=()=>{};constructor(t,i){this.hitCriticalError=!1,this._setupDone=!1,this._userNode=i,this._curElement=null,this._elements=[],this._glAttributes=null,this._requestAnimId=0,this._isGlobal=!1,this._loop=!0,this._startListener=null,this._initializeInstanceVariables(),this._events={pointerdown:null,pointerup:null,pointermove:null,dragend:null,dragover:null,click:null,dblclick:null,mouseover:null,mouseout:null,keydown:null,keyup:null,keypress:null,wheel:null,resize:null,blur:null},this._millisStart=-1,this._recording=!1,this._lcg_random_state=null,this._gaussian_previous=!1,window.DeviceOrientationEvent&&(this._events.deviceorientation=null),window.DeviceMotionEvent&&!window._isNodeWebkit&&(this._events.devicemotion=null),this._updateWindowSize();const r=t=>{Object.defineProperty(window,t,{configurable:!0,enumerable:!0,get:()=>"function"==typeof this[t]?this[t].bind(this):this[t],set:i=>{Object.defineProperty(window,t,{configurable:!0,enumerable:!0,value:i,writable:!0}),e.disableFriendlyErrors||console.log(`You just changed the value of "${t}", which was a p5 global value. This could cause problems later if you're not careful.`)}})};if(t)t(this),e._checkForUserDefinedFunctions(this);else{if(this._isGlobal=!0,window.hitCriticalError)return;e.instance=this;for(const t of Object.getOwnPropertyNames(e.prototype))"_"!==t[0]&&r(t);const t=["constructor","length"];for(const e in this)if(this.hasOwnProperty(e)){if("_"===e[0]||t.includes(e))continue;r(e)}}for(const e in this._events){const t=this[`_on${e}`];if(t){const i=t.bind(this);window.addEventListener(e,i,{passive:!1}),this._events[e]=i}}const s=()=>{this.focused=!0},n=()=>{this.focused=!1};window.addEventListener("focus",s),window.addEventListener("blur",n),e.lifecycleHooks.remove.push((function(){window.removeEventListener("focus",s),window.removeEventListener("blur",n)})),"complete"===document.readyState?this.#S():(this._startListener=this.#S.bind(this),window.addEventListener("load",this._startListener,!1))}get pixels(){return this._renderer.pixels}get drawingContext(){return this._renderer.drawingContext}static registerAddon(t){const i={};t(e,e.prototype,i);const r=Object.keys(e.lifecycleHooks);for(const t of r)"function"==typeof i[t]&&e.lifecycleHooks[t].push(i[t])}async#S(){this.hitCriticalError||(this._userNode&&"string"==typeof this._userNode&&(this._userNode=document.getElementById(this._userNode)),await this.#F(),this.hitCriticalError||this._recording||this._draw())}async#F(){if(await this._runLifecycleHook("presetup"),this.hitCriticalError)return;this.createCanvas(100,100,r),this._millisStart=window.performance.now();const e=this._isGlobal?window:this;if("function"==typeof e.setup&&await e.setup(),this.hitCriticalError)return;const t=document.getElementsByTagName("canvas");if(Object.keys(this._events).some((e=>e.startsWith("pointer"))))for(const e of t)e.style.touchAction="none";for(const e of t)"true"===e.dataset.hidden&&(e.style.visibility="",delete e.dataset.hidden);this._lastTargetFrameTime=window.performance.now(),this._lastRealFrameTime=window.performance.now(),this._setupDone=!0,(this._accessibleOutputs.grid||this._accessibleOutputs.text)&&this._updateAccsOutput(),await this._runLifecycleHook("postsetup")}async _draw(e){if(this.hitCriticalError)return;const t=e||window.performance.now(),i=t-this._lastTargetFrameTime,r=1e3/this._targetFrameRate;(!this._loop||i>=r-5)&&(this.deltaTime=t-this._lastRealFrameTime,this._frameRate=1e3/this.deltaTime,await this.redraw(),this._lastTargetFrameTime=Math.max(this._lastTargetFrameTime+r,t),this._lastRealFrameTime=t,void 0!==this._updateMouseCoords&&(this._updateMouseCoords(),this.movedX=0,this.movedY=0)),this._loop&&(this._requestAnimId=window.requestAnimationFrame(this._draw.bind(this)))}async remove(){if(this._startListener&&window.removeEventListener("load",this._startListener,!1),this._curElement){this._loop=!1,this._requestAnimId&&window.cancelAnimationFrame(this._requestAnimId);for(const e in this._events)window.removeEventListener(e,this._events[e]);for(const e of this._elements){e.elt&&e.elt.parentNode&&e.elt.parentNode.removeChild(e.elt);for(const t in e._events)e.elt.removeEventListener(t,e._events[t])}await this._runLifecycleHook("remove")}if(this._isGlobal){for(const t in e.prototype)try{delete window[t]}catch(e){window[t]=void 0}for(const e in this)if(this.hasOwnProperty(e))try{delete window[e]}catch(t){window[e]=void 0}e.instance=null}}async _runLifecycleHook(t){for(const i of e.lifecycleHooks[t])await i.call(this)}_initializeInstanceVariables(){this._accessibleOutputs={text:!1,grid:!1,textLabel:!1,gridLabel:!1},this._styles=[],this._downKeys={},this._downKeyCodes={}}};for(const e in Re)Ca.prototype[e]=Re[e];function Da(e,t){const i="_Description",r="_fallbackDesc",s="_fallbackTable",n="_fte_",a="_Label",o="_labelDesc",h="_labelTable",u="_lte_";function l(e){if("label"===e||"fallback"===e)throw new Error("description should not be LABEL or FALLBACK");return e.endsWith(".")||e.endsWith(";")||e.endsWith(",")||e.endsWith("?")||e.endsWith("!")||(e+="."),e}t.describe=function(e,t){if("string"!=typeof e)return;const i=this.canvas.id;e=l(e),this.dummyDOM||(this.dummyDOM=document.getElementById(i).parentNode),this.descriptions||(this.descriptions={}),this.descriptions.fallback?this.descriptions.fallback.innerHTML!==e&&(this.descriptions.fallback.innerHTML=e):this._describeHTML("fallback",e),t===this.LABEL&&(this.descriptions.label?this.descriptions.label.innerHTML!==e&&(this.descriptions.label.innerHTML=e):this._describeHTML("label",e))},t.describeElement=function(e,t,i){if("string"!=typeof t||"string"!=typeof e)return;const r=this.canvas.id;t=l(t);let s=function(e){if("label"===e||"fallback"===e)throw new Error("element name should not be LABEL or FALLBACK");e.endsWith(".")||e.endsWith(";")||e.endsWith(",")?e=e.replace(/.$/,":"):e.endsWith(":")||(e+=":");return e}(e);e=e.replace(/[^a-zA-Z0-9]/g,"");let n=`<th scope="row">${s}</th><td>${t}</td>`;this.dummyDOM||(this.dummyDOM=document.getElementById(r).parentNode),this.descriptions?this.descriptions.fallbackElements||(this.descriptions.fallbackElements={}):this.descriptions={fallbackElements:{}},this.descriptions.fallbackElements[e]?this.descriptions.fallbackElements[e].innerHTML!==n&&(this.descriptions.fallbackElements[e].innerHTML=n):this._describeElementHTML("fallback",e,n),i===this.LABEL&&(this.descriptions.labelElements||(this.descriptions.labelElements={}),this.descriptions.labelElements[e]?this.descriptions.labelElements[e].innerHTML!==n&&(this.descriptions.labelElements[e].innerHTML=n):this._describeElementHTML("label",e,n))},t._describeHTML=function(e,t){const n=this.canvas.id;if("fallback"===e){if(this.dummyDOM.querySelector(`#${n+i}`))this.dummyDOM.querySelector("#"+n+s).insertAdjacentHTML("beforebegin",`<p id="${n+r}"></p>`);else{let e=`<div id="${n}${i}" role="region" aria-label="Canvas Description"><p id="${n}${r}"></p></div>`;this.dummyDOM.querySelector(`#${n}accessibleOutput`)?this.dummyDOM.querySelector(`#${n}accessibleOutput`).insertAdjacentHTML("beforebegin",e):this.dummyDOM.querySelector(`#${n}`).innerHTML=e}return this.descriptions.fallback=this.dummyDOM.querySelector(`#${n}${r}`),void(this.descriptions.fallback.innerHTML=t)}if("label"===e){if(this.dummyDOM.querySelector(`#${n+a}`))this.dummyDOM.querySelector(`#${n+h}`)&&this.dummyDOM.querySelector(`#${n+h}`).insertAdjacentHTML("beforebegin",`<p id="${n}${o}"></p>`);else{let e=`<div id="${n}${a}" class="p5Label"><p id="${n}${o}"></p></div>`;this.dummyDOM.querySelector(`#${n}accessibleOutputLabel`)?this.dummyDOM.querySelector(`#${n}accessibleOutputLabel`).insertAdjacentHTML("beforebegin",e):this.dummyDOM.querySelector("#"+n).insertAdjacentHTML("afterend",e)}return this.descriptions.label=this.dummyDOM.querySelector("#"+n+o),void(this.descriptions.label.innerHTML=t)}},t._describeElementHTML=function(e,t,l){const c=this.canvas.id;if("fallback"===e){if(this.dummyDOM.querySelector(`#${c+i}`))this.dummyDOM.querySelector("#"+c+s)||this.dummyDOM.querySelector("#"+c+r).insertAdjacentHTML("afterend",`<table id="${c}${s}"><caption>Canvas elements and their descriptions</caption></table>`);else{let e=`<div id="${c}${i}" role="region" aria-label="Canvas Description"><table id="${c}${s}"><caption>Canvas elements and their descriptions</caption></table></div>`;this.dummyDOM.querySelector(`#${c}accessibleOutput`)?this.dummyDOM.querySelector(`#${c}accessibleOutput`).insertAdjacentHTML("beforebegin",e):this.dummyDOM.querySelector("#"+c).innerHTML=e}let e=document.createElement("tr");return e.id=c+n+t,this.dummyDOM.querySelector("#"+c+s).appendChild(e),this.descriptions.fallbackElements[t]=this.dummyDOM.querySelector(`#${c}${n}${t}`),void(this.descriptions.fallbackElements[t].innerHTML=l)}if("label"===e){if(this.dummyDOM.querySelector(`#${c+a}`))this.dummyDOM.querySelector(`#${c+h}`)||this.dummyDOM.querySelector("#"+c+o).insertAdjacentHTML("afterend",`<table id="${c+h}"></table>`);else{let e=`<div id="${c}${a}" class="p5Label"><table id="${c}${h}"></table></div>`;this.dummyDOM.querySelector(`#${c}accessibleOutputLabel`)?this.dummyDOM.querySelector(`#${c}accessibleOutputLabel`).insertAdjacentHTML("beforebegin",e):this.dummyDOM.querySelector("#"+c).insertAdjacentHTML("afterend",e)}let e=document.createElement("tr");e.id=c+u+t,this.dummyDOM.querySelector("#"+c+h).appendChild(e),this.descriptions.labelElements[t]=this.dummyDOM.querySelector(`#${c}${u}${t}`),this.descriptions.labelElements[t].innerHTML=l}}}function Ea(e,t){t._updateGridOutput=function(e){if(!this.dummyDOM.querySelector(`#${e}_summary`))return;let t=this._accessibleOutputs[e],i=function(e,t){let i="",r="",s=0;for(let n in t){let a=0;for(let r in t[n]){let o=`<li id="${e}shape${s}">${t[n][r].color} ${n},`;"line"===n?o+=` location = ${t[n][r].pos}, length = ${t[n][r].length} pixels`:(o+=` location = ${t[n][r].pos}`,"point"!==n&&(o+=`, area = ${t[n][r].area} %`),o+="</li>"),i+=o,a++,s++}r=a>1?`${r} ${a} ${n}s`:`${r} ${a} ${n}`}return{numShapes:[s,r],details:i}}(e,this.ingredients.shapes),r=function(e,t,i,r){let s=`${t} canvas, ${i} by ${r} pixels, contains ${e[0]}`;s=1===e[0]?`${s} shape: ${e[1]}`:`${s} shapes: ${e[1]}`;return s}(i.numShapes,this.ingredients.colors.background,this.width,this.height),s=function(e,t){let i=0,r="",s=Array.from(Array(10),(()=>Array(10)));for(let r in t)for(let n in t[r]){let a;a="line"!==r?`<a href="#${e}shape${i}">${t[r][n].color} ${r}</a>`:`<a href="#${e}shape${i}">${t[r][n].color} ${r} midpoint</a>`,t[r][n].loc.locY<s.length&&t[r][n].loc.locX<s[t[r][n].loc.locY].length&&(s[t[r][n].loc.locY][t[r][n].loc.locX]?s[t[r][n].loc.locY][t[r][n].loc.locX]=s[t[r][n].loc.locY][t[r][n].loc.locX]+" "+a:s[t[r][n].loc.locY][t[r][n].loc.locX]=a,i++)}for(let e in s){let t="<tr>";for(let i in s[e])t+="<td>",void 0!==s[e][i]&&(t+=s[e][i]),t+="</td>";r=r+t+"</tr>"}return r}(e,this.ingredients.shapes);r!==t.summary.innerHTML&&(t.summary.innerHTML=r),s!==t.map.innerHTML&&(t.map.innerHTML=s),i.details!==t.shapeDetails.innerHTML&&(t.shapeDetails.innerHTML=i.details),this._accessibleOutputs[e]=t}}function Aa(e,t){t._updateTextOutput=function(e){if(!this.dummyDOM.querySelector(`#${e}_summary`))return;let t=this._accessibleOutputs[e],i=function(e,t){let i="",r=0;for(let s in t)for(let n in t[s]){let a=`<li><a href="#${e}shape${r}">${t[s][n].color} ${s}</a>`;"line"===s?a+=`, ${t[s][n].pos}, ${t[s][n].length} pixels long.</li>`:(a+=`, at ${t[s][n].pos}`,"point"!==s&&(a+=`, covering ${t[s][n].area}% of the canvas`),a+=".</li>"),i+=a,r++}return{numShapes:r,listShapes:i}}(e,this.ingredients.shapes),r=function(e,t,i,r){let s=`Your output is a, ${i} by ${r} pixels, ${t} canvas containing the following`;s=1===e?`${s} shape:`:`${s} ${e} shapes:`;return s}(i.numShapes,this.ingredients.colors.background,this.width,this.height),s=function(e,t){let i="",r=0;for(let s in t)for(let n in t[s]){let a=`<tr id="${e}shape${r}"><th>${t[s][n].color} ${s}</th>`;"line"===s?a+=`<td>location = ${t[s][n].pos}</td><td>length = ${t[s][n].length} pixels</td></tr>`:(a+=`<td>location = ${t[s][n].pos}</td>`,"point"!==s&&(a+=`<td> area = ${t[s][n].area}%</td>`),a+="</tr>"),i+=a,r++}return i}(e,this.ingredients.shapes);r!==t.summary.innerHTML&&(t.summary.innerHTML=r),i.listShapes!==t.list.innerHTML&&(t.list.innerHTML=i.listShapes),s!==t.shapeDetails.innerHTML&&(t.shapeDetails.innerHTML=s),this._accessibleOutputs[e]=t}}function Sa(e,t){function i(e,t,i){let r=Math.floor(e[0]/t*10),s=Math.floor(e[1]/i*10);return 10===r&&(r-=1),10===s&&(s-=1),{locX:r,locY:s}}t.textOutput=function(e){this._accessibleOutputs.text||(this._accessibleOutputs.text=!0,this._createOutput("textOutput","Fallback"),e===this.LABEL&&(this._accessibleOutputs.textLabel=!0,this._createOutput("textOutput","Label")))},t.gridOutput=function(e){this._accessibleOutputs.grid||(this._accessibleOutputs.grid=!0,this._createOutput("gridOutput","Fallback"),e===this.LABEL&&(this._accessibleOutputs.gridLabel=!0,this._createOutput("gridOutput","Label")))},t._addAccsOutput=function(){return this._accessibleOutputs||(this._accessibleOutputs={text:!1,grid:!1,textLabel:!1,gridLabel:!1}),this._accessibleOutputs.grid||this._accessibleOutputs.text},t._createOutput=function(e,t){let i,r,s,n=this.canvas.id;this.ingredients||(this.ingredients={shapes:{},colors:{background:"white",fill:"white",stroke:"black"},pShapes:"",pBackground:""}),this.dummyDOM||(this.dummyDOM=document.getElementById(n).parentNode);let a="";"Fallback"===t?(i=n+e,r=n+"accessibleOutput",this.dummyDOM.querySelector(`#${r}`)||(this.dummyDOM.querySelector(`#${n}_Description`)?this.dummyDOM.querySelector(`#${n}_Description`).insertAdjacentHTML("afterend",`<div id="${r}" role="region" aria-label="Canvas Outputs"></div>`):this.dummyDOM.querySelector(`#${n}`).innerHTML=`<div id="${r}" role="region" aria-label="Canvas Outputs"></div>`)):"Label"===t&&(a=t,i=n+e+t,r=n+"accessibleOutput"+t,this.dummyDOM.querySelector(`#${r}`)||(this.dummyDOM.querySelector(`#${n}_Label`)?this.dummyDOM.querySelector(`#${n}_Label`).insertAdjacentHTML("afterend",`<div id="${r}"></div>`):this.dummyDOM.querySelector(`#${n}`).insertAdjacentHTML("afterend",`<div id="${r}"></div>`))),this._accessibleOutputs[i]={},"textOutput"===e?(a=`#${n}gridOutput${a}`,s=`<div id="${i}">Text Output<div id="${i}Summary" aria-label="text output summary"><p id="${i}_summary"></p><ul id="${i}_list"></ul></div><table id="${i}_shapeDetails" summary="text output shape details"></table></div>`,this.dummyDOM.querySelector(a)?this.dummyDOM.querySelector(a).insertAdjacentHTML("beforebegin",s):this.dummyDOM.querySelector(`#${r}`).innerHTML=s,this._accessibleOutputs[i].list=this.dummyDOM.querySelector(`#${i}_list`)):"gridOutput"===e&&(a=`#${n}textOutput${a}`,s=`<div id="${i}">Grid Output<p id="${i}_summary" aria-label="grid output summary"><table id="${i}_map" summary="grid output content"></table><ul id="${i}_shapeDetails" aria-label="grid output shape details"></ul></div>`,this.dummyDOM.querySelector(a)?this.dummyDOM.querySelector(a).insertAdjacentHTML("afterend",s):this.dummyDOM.querySelector(`#${r}`).innerHTML=s,this._accessibleOutputs[i].map=this.dummyDOM.querySelector(`#${i}_map`)),this._accessibleOutputs[i].shapeDetails=this.dummyDOM.querySelector(`#${i}_shapeDetails`),this._accessibleOutputs[i].summary=this.dummyDOM.querySelector(`#${i}_summary`)},t._updateAccsOutput=function(){let e=this.canvas.id;JSON.stringify(this.ingredients.shapes)===this.ingredients.pShapes&&this.ingredients.colors.background===this.ingredients.pBackground||(this.ingredients.pShapes=JSON.stringify(this.ingredients.shapes),this._accessibleOutputs.text&&this._updateTextOutput(e+"textOutput"),this._accessibleOutputs.grid&&this._updateGridOutput(e+"gridOutput"),this._accessibleOutputs.textLabel&&this._updateTextOutput(e+"textOutputLabel"),this._accessibleOutputs.gridLabel&&this._updateGridOutput(e+"gridOutputLabel"))},t._accsBackground=function(e){this.ingredients.pShapes=JSON.stringify(this.ingredients.shapes),this.ingredients.pBackground=this.ingredients.colors.background,this.ingredients.shapes={},this.ingredients.colors.backgroundRGBA!==e&&(this.ingredients.colors.backgroundRGBA=e,this.ingredients.colors.background=this._rgbColorName(e))},t._accsCanvasColors=function(e,t){"fill"===e?this.ingredients.colors.fillRGBA!==t&&(this.ingredients.colors.fillRGBA=t,this.ingredients.colors.fill=this._rgbColorName(t)):"stroke"===e&&this.ingredients.colors.strokeRGBA!==t&&(this.ingredients.colors.strokeRGBA=t,this.ingredients.colors.stroke=this._rgbColorName(t))},t._accsOutput=function(e,t){"ellipse"===e&&t[2]===t[3]?e="circle":"rectangle"===e&&t[2]===t[3]&&(e="square");let r={},s=!0,n=function(e,t){let i,r;"rectangle"===e||"ellipse"===e||"arc"===e||"circle"===e||"square"===e?(i=Math.round(t[0]+t[2]/2),r=Math.round(t[1]+t[3]/2)):"triangle"===e?(i=(t[0]+t[2]+t[4])/3,r=(t[1]+t[3]+t[5])/3):"quadrilateral"===e?(i=(t[0]+t[2]+t[4]+t[6])/4,r=(t[1]+t[3]+t[5]+t[7])/4):"line"===e?(i=(t[0]+t[2])/2,r=(t[1]+t[3])/2):(i=t[0],r=t[1]);return[i,r]}(e,t);if("line"===e){r.color=this.ingredients.colors.stroke,r.length=Math.round(Math.hypot(t[2]-t[0],t[3]-t[1]));let e=this._getPos(t[0],[1]),s=this._getPos(t[2],[3]);r.loc=i(n,this.width,this.height),r.pos=e===s?`at ${e}`:`from ${e} to ${s}`}else"point"===e?r.color=this.ingredients.colors.stroke:(r.color=this.ingredients.colors.fill,r.area=this._getArea(e,t)),r.pos=this._getPos(...n),r.loc=i(n,this.width,this.height);if(this.ingredients.shapes[e]){if(this.ingredients.shapes[e]!==[r]){for(let t in this.ingredients.shapes[e])JSON.stringify(this.ingredients.shapes[e][t])===JSON.stringify(r)&&(s=!1);!0===s&&this.ingredients.shapes[e].push(r)}}else this.ingredients.shapes[e]=[r]},t._getPos=function(t,i){const{x:r,y:s}=this.worldToScreen(new e.Vector(t,i)),n=this.width,a=this.height;return r<.4*n?s<.4*a?"top left":s>.6*a?"bottom left":"mid left":r>.6*n?s<.4*a?"top right":s>.6*a?"bottom right":"mid right":s<.4*a?"top middle":s>.6*a?"bottom middle":"middle"},t._getArea=function(e,t){let i=0;if("arc"===e){const e=((t[5]-t[4])%(2*Math.PI)+2*Math.PI)%(2*Math.PI);if(i=e*t[2]*t[3]/8,"open"===t[6]||"chord"===t[6]){const r=t[0],s=t[1],n=t[0]+t[2]/2*Math.cos(t[4]).toFixed(2),a=t[1]+t[3]/2*Math.sin(t[4]).toFixed(2),o=t[0]+t[2]/2*Math.cos(t[5]).toFixed(2),h=t[1]+t[3]/2*Math.sin(t[5]).toFixed(2),u=Math.abs(r*(a-h)+n*(h-s)+o*(s-a))/2;e>Math.PI?i+=u:i-=u}}else"ellipse"===e||"circle"===e?i=3.14*t[2]/2*t[3]/2:"line"===e||"point"===e?i=0:"quadrilateral"===e?i=Math.abs((t[6]+t[0])*(t[7]-t[1])+(t[0]+t[2])*(t[1]-t[3])+(t[2]+t[4])*(t[3]-t[5])+(t[4]+t[6])*(t[5]-t[7]))/2:"rectangle"===e||"square"===e?i=t[2]*t[3]:"triangle"===e&&(i=Math.abs(t[0]*(t[3]-t[5])+t[2]*(t[5]-t[1])+t[4]*(t[1]-t[3]))/2);const r=this.width*this._renderer._pixelDensity,s=this.height*this._renderer._pixelDensity,n=[new DOMPoint(0,0),new DOMPoint(r,0),new DOMPoint(r,s),new DOMPoint(0,s)],a=(this._renderer.isP3D?new DOMMatrix(this._renderer.uMVMatrix.mat4):this.drawingContext.getTransform()).inverse(),o=n.map((e=>e.matrixTransform(a))),h=Math.abs((o[3].x+o[0].x)*(o[3].y-o[0].y)+(o[0].x+o[1].x)*(o[0].y-o[1].y)+(o[1].x+o[2].x)*(o[1].y-o[2].y)+(o[2].x+o[3].x)*(o[2].y-o[3].y))/2;return Math.round(100*i/h)}}Ca.disableFriendlyErrors=!1,Ca.registerAddon(Ve),Ca.registerAddon(Ue),Ca.registerAddon(We),Ca.registerAddon(va),Ca.registerAddon((function(e,t){e.Renderer=xs})),Ca.registerAddon((function(e,t){e.Renderer2D=wa,e.renderers[r]=wa,e.renderers["p2d-hdr"]=new Proxy(wa,{construct:(e,[t,i,r,s,n])=>new e(t,i,r,s,n,{colorSpace:"display-p3"})})})),Ca.registerAddon((function(e,t){e.Graphics=ha,Es(e,e.Graphics.prototype),As(0,e.Graphics.prototype),Ss(0,e.Graphics.prototype),Fs(0,e.Graphics.prototype),gs(e,e.Graphics.prototype),Ts(0,e.Graphics.prototype),sn(e,e.Graphics.prototype),ks(e,e.Graphics.prototype),nn(e,e.Graphics.prototype),Ve(e,e.Graphics.prototype),sa(e,e.Graphics.prototype),na(0,e.Graphics.prototype),aa(0,e.Graphics.prototype),Dr(e,e.Graphics.prototype),oa(0,e.Graphics.prototype)})),void 0!==p5&&Da(0,p5.prototype),void 0!==p5&&Ea(0,p5.prototype),void 0!==p5&&Aa(0,p5.prototype),void 0!==p5&&Sa(p5,p5.prototype),Ca.ColorConversion={_hsbaToHSLA(e){const t=e[0];let i=e[1];const r=e[2],s=(2-i)*r/2;return 0!==s&&(1===s?i=0:s<.5?i/=2-i:i=i*r/(2-2*s)),[t,i,s,e[3]]},_hsbaToRGBA(e){const t=6*e[0],i=e[1],r=e[2];let s=[];if(0===i)s=[r,r,r,e[3]];else{const n=Math.floor(t),a=r*(1-i),o=r*(1-i*(t-n)),h=r*(1-i*(1+n-t));let u,l,c;1===n?(u=o,l=r,c=a):2===n?(u=a,l=r,c=h):3===n?(u=a,l=o,c=r):4===n?(u=h,l=a,c=r):5===n?(u=r,l=a,c=o):(u=r,l=h,c=a),s=[u,l,c,e[3]]}return s},_hslaToHSBA(e){const t=e[0];let i=e[1];const r=e[2];let s;return s=r<.5?(1+i)*r:r+i-r*i,i=2*(s-r)/s,[t,i,s,e[3]]},_hslaToRGBA(e){const t=6*e[0],i=e[1],r=e[2];let s=[];if(0===i)s=[r,r,r,e[3]];else{let n;n=r<.5?(1+i)*r:r+i-r*i;const a=2*r-n,o=(e,t,i)=>(e<0?e+=6:e>=6&&(e-=6),e<1?t+(i-t)*e:e<3?i:e<4?t+(i-t)*(4-e):t);s=[o(t+2,a,n),o(t,a,n),o(t-2,a,n),e[3]]}return s},_rgbaToHSBA(e){const t=e[0],i=e[1],r=e[2],s=Math.max(t,i,r),n=s-Math.min(t,i,r);let a,o;return 0===n?(a=0,o=0):(o=n/s,t===s?a=(i-r)/n:i===s?a=2+(r-t)/n:r===s&&(a=4+(t-i)/n),a<0?a+=6:a>=6&&(a-=6)),[a/6,o,s,e[3]]},_rgbaToHSLA(e){const t=e[0],i=e[1],r=e[2],s=Math.max(t,i,r),n=Math.min(t,i,r),a=s+n,o=s-n;let h,u;return 0===o?(h=0,u=0):(u=a<1?o/a:o/(2-a),t===s?h=(i-r)/o:i===s?h=2+(r-t)/o:r===s&&(h=4+(t-i)/o),h<0?h+=6:h>=6&&(h-=6)),[h/6,u,a/2,e[3]]}};var Fa=Ca.ColorConversion;function Ta(e,t){let i;const r=[{h:0,s:0,b:.8275,name:"gray"},{h:0,s:0,b:.8627,name:"gray"},{h:0,s:0,b:.7529,name:"gray"},{h:.0167,s:.1176,b:1,name:"light pink"}],s=[{h:0,s:0,b:0,name:"black"},{h:0,s:0,b:.5,name:"gray"},{h:0,s:0,b:1,name:"white"},{h:0,s:.5,b:.5,name:"dark maroon"},{h:0,s:.5,b:1,name:"salmon pink"},{h:0,s:1,b:0,name:"black"},{h:0,s:1,b:.5,name:"dark red"},{h:0,s:1,b:1,name:"red"},{h:5,s:0,b:1,name:"very light peach"},{h:5,s:.5,b:.5,name:"brown"},{h:5,s:.5,b:1,name:"peach"},{h:5,s:1,b:.5,name:"brick red"},{h:5,s:1,b:1,name:"crimson"},{h:10,s:0,b:1,name:"light peach"},{h:10,s:.5,b:.5,name:"brown"},{h:10,s:.5,b:1,name:"light orange"},{h:10,s:1,b:.5,name:"brown"},{h:10,s:1,b:1,name:"orange"},{h:15,s:0,b:1,name:"very light yellow"},{h:15,s:.5,b:.5,name:"olive green"},{h:15,s:.5,b:1,name:"light yellow"},{h:15,s:1,b:0,name:"dark olive green"},{h:15,s:1,b:.5,name:"olive green"},{h:15,s:1,b:1,name:"yellow"},{h:20,s:0,b:1,name:"very light yellow"},{h:20,s:.5,b:.5,name:"olive green"},{h:20,s:.5,b:1,name:"light yellow green"},{h:20,s:1,b:0,name:"dark olive green"},{h:20,s:1,b:.5,name:"dark yellow green"},{h:20,s:1,b:1,name:"yellow green"},{h:25,s:.5,b:.5,name:"dark yellow green"},{h:25,s:.5,b:1,name:"light green"},{h:25,s:1,b:.5,name:"dark green"},{h:25,s:1,b:1,name:"green"},{h:30,s:.5,b:1,name:"light green"},{h:30,s:1,b:.5,name:"dark green"},{h:30,s:1,b:1,name:"green"},{h:35,s:0,b:.5,name:"light green"},{h:35,s:0,b:1,name:"very light green"},{h:35,s:.5,b:.5,name:"dark green"},{h:35,s:.5,b:1,name:"light green"},{h:35,s:1,b:0,name:"very dark green"},{h:35,s:1,b:.5,name:"dark green"},{h:35,s:1,b:1,name:"green"},{h:40,s:0,b:1,name:"very light green"},{h:40,s:.5,b:.5,name:"dark green"},{h:40,s:.5,b:1,name:"light green"},{h:40,s:1,b:.5,name:"dark green"},{h:40,s:1,b:1,name:"green"},{h:45,s:.5,b:1,name:"light turquoise"},{h:45,s:1,b:.5,name:"dark turquoise"},{h:45,s:1,b:1,name:"turquoise"},{h:50,s:0,b:1,name:"light sky blue"},{h:50,s:.5,b:.5,name:"dark cyan"},{h:50,s:.5,b:1,name:"light cyan"},{h:50,s:1,b:.5,name:"dark cyan"},{h:50,s:1,b:1,name:"cyan"},{h:55,s:0,b:1,name:"light sky blue"},{h:55,s:.5,b:1,name:"light sky blue"},{h:55,s:1,b:.5,name:"dark blue"},{h:55,s:1,b:1,name:"sky blue"},{h:60,s:0,b:.5,name:"gray"},{h:60,s:0,b:1,name:"very light blue"},{h:60,s:.5,b:.5,name:"blue"},{h:60,s:.5,b:1,name:"light blue"},{h:60,s:1,b:.5,name:"navy blue"},{h:60,s:1,b:1,name:"blue"},{h:65,s:0,b:1,name:"lavender"},{h:65,s:.5,b:.5,name:"navy blue"},{h:65,s:.5,b:1,name:"light purple"},{h:65,s:1,b:.5,name:"dark navy blue"},{h:65,s:1,b:1,name:"blue"},{h:70,s:0,b:1,name:"lavender"},{h:70,s:.5,b:.5,name:"navy blue"},{h:70,s:.5,b:1,name:"lavender blue"},{h:70,s:1,b:.5,name:"dark navy blue"},{h:70,s:1,b:1,name:"blue"},{h:75,s:.5,b:1,name:"lavender"},{h:75,s:1,b:.5,name:"dark purple"},{h:75,s:1,b:1,name:"purple"},{h:80,s:.5,b:1,name:"pinkish purple"},{h:80,s:1,b:.5,name:"dark purple"},{h:80,s:1,b:1,name:"purple"},{h:85,s:0,b:1,name:"light pink"},{h:85,s:.5,b:.5,name:"purple"},{h:85,s:.5,b:1,name:"light fuchsia"},{h:85,s:1,b:.5,name:"dark fuchsia"},{h:85,s:1,b:1,name:"fuchsia"},{h:90,s:.5,b:.5,name:"dark fuchsia"},{h:90,s:.5,b:1,name:"hot pink"},{h:90,s:1,b:.5,name:"dark fuchsia"},{h:90,s:1,b:1,name:"fuchsia"},{h:95,s:0,b:1,name:"pink"},{h:95,s:.5,b:1,name:"light pink"},{h:95,s:1,b:.5,name:"dark magenta"},{h:95,s:1,b:1,name:"magenta"}];t._rgbColorName=function(e){let t=Fa._rgbaToHSBA(e);return i=t,function(e){let t;if(0!==e[0]){e[0]=Math.round(100*e[0]);let t=e[0].toString().split("");const i=t.length-1;t[i]=parseInt(t[i]),t[i]<2.5?t[i]=0:t[i]>=2.5&&t[i]<7.5&&(t[i]=5),2===t.length?(t[0]=parseInt(t[0]),t[i]>=7.5&&(t[i]=0,t[0]=t[0]+1),e[0]=10*t[0]+t[1]):t[i]>=7.5?e[0]=10:e[0]=t[i]}e[2]=e[2]/255;for(let t=e.length-1;t>=1;t--)e[t]<=.25?e[t]=0:e[t]>.25&&e[t]<.75?e[t]=.5:e[t]=1;if(0===e[0]&&0===e[1]&&1===e[2]){for(let e=2;e>=0;e--)i[e]=Math.round(1e4*i[e])/1e4;for(let e=0;e<r.length;e++){if(r[e].h===i[0]&&r[e].s===i[1]&&r[e].b===i[2]){t=r[e].name;break}t="white"}}else for(let i=0;i<s.length;i++)if(s[i].h===e[0]&&s[i].s===e[1]&&s[i].b===e[2]){t=s[i].name;break}return t}([t[0],t[1],t[2]])}}function Ma(e,t){t.storeItem=function(t,i){"string"!=typeof t&&console.log(`The argument that you passed to storeItem() - ${t} is not a string.`),t.endsWith("p5TypeID")&&console.log(`The argument that you passed to storeItem() - ${t} must not end with 'p5TypeID'.`),void 0===i&&console.log("You cannot store undefined variables using storeItem().");let r=typeof i;switch(r){case"number":case"boolean":i=i.toString();break;case"object":if(i instanceof e.Color)r="p5.Color",i=i.toString();else if(i instanceof e.Vector){r="p5.Vector";i=[i.x,i.y,i.z]}i=JSON.stringify(i)}localStorage.setItem(t,i);const s=`${t}p5TypeID`;localStorage.setItem(s,r)},t.getItem=function(e){let t=localStorage.getItem(e);const i=localStorage.getItem(`${e}p5TypeID`);if(void 0===i)console.log(`Unable to determine type of item stored under ${e}in local storage. Did you save the item with something other than setItem()?`);else if(null!==t)switch(i){case"number":t=parseFloat(t);break;case"boolean":t="true"===t;break;case"object":t=JSON.parse(t);break;case"p5.Color":t=this.color(JSON.parse(t));break;case"p5.Vector":t=JSON.parse(t),t=this.createVector(...t)}return t},t.clearStorage=function(){Object.keys(localStorage).forEach((e=>{e.endsWith("p5TypeID")&&this.removeItem(e.replace("p5TypeID",""))}))},t.removeItem=function(e){"string"!=typeof e&&console.log(`The argument that you passed to removeItem() - ${e} is not a string.`),localStorage.removeItem(e),localStorage.removeItem(`${e}p5TypeID`)}}function ka(e,t){function i(e,t,i){(t._userNode?t._userNode:document.body).appendChild(e);const r=i?new vs(e,t):new Mr(e,t);return t._elements.push(r),r}t.select=function(e,t){const i=this._getContainer(t).querySelector(e);return i?this._wrapElement(i):null},t.selectAll=function(e,t){const i=[],r=this._getContainer(t).querySelectorAll(e);if(r)for(let e=0;e<r.length;e++){const t=this._wrapElement(r[e]);i.push(t)}return i},t._getContainer=function(e){let t=document;return"string"==typeof e?t=document.querySelector(e)||document:e instanceof Mr?t=e.elt:e instanceof HTMLElement&&(t=e),t},t._wrapElement=function(e){const t=Array.prototype.slice.call(e.children);if("INPUT"===e.tagName&&"checkbox"===e.type){let t=new Mr(e,this);return t.checked=function(...e){return 0===e.length?this.elt.checked:(e[0]?this.elt.checked=!0:this.elt.checked=!1,this)},t}return"VIDEO"===e.tagName||"AUDIO"===e.tagName?new vs(e,this):"SELECT"===e.tagName?this.createSelect(new Mr(e,this)):t.length>0&&t.every((function(e){return"INPUT"===e.tagName||"LABEL"===e.tagName}))&&("DIV"===e.tagName||"SPAN"===e.tagName)?this.createRadio(new Mr(e,this)):new Mr(e,this)},t.createElement=function(e,t){const r=document.createElement(e);return void 0!==t&&(r.innerHTML=t),i(r,this)},t.removeElements=function(e){this._elements.filter((e=>!(e.elt instanceof HTMLCanvasElement))).map((e=>e.remove()))},t.createDiv=function(e=""){let t=document.createElement("div");return t.innerHTML=e,i(t,this)},t.createP=function(e=""){let t=document.createElement("p");return t.innerHTML=e,i(t,this)},t.createSpan=function(e=""){let t=document.createElement("span");return t.innerHTML=e,i(t,this)},t.createImg=function(){const e=document.createElement("img"),t=arguments;let r;return t.length>1&&"string"==typeof t[1]&&(e.alt=t[1]),t.length>2&&"string"==typeof t[2]&&(e.crossOrigin=t[2]),e.src=t[0],r=i(e,this),e.addEventListener("load",(function(){r.width=e.offsetWidth||e.width,r.height=e.offsetHeight||e.height;const i=t[t.length-1];"function"==typeof i&&i(r)})),r},t.createA=function(e,t,r){const s=document.createElement("a");return s.href=e,s.innerHTML=t,r&&(s.target=r),i(s,this)},t.createSlider=function(e,t,r,s){const n=document.createElement("input");return n.type="range",n.min=e,n.max=t,0===s?n.step=1e-18:s&&(n.step=s),"number"==typeof r&&(n.value=r),i(n,this)},t.createButton=function(e,t){const r=document.createElement("button");return r.innerHTML=e,t&&(r.value=t),i(r,this)},t.createCheckbox=function(...e){const t=document.createElement("div"),r=document.createElement("input");r.type="checkbox";const s=document.createElement("label");s.appendChild(r),t.appendChild(s);const n=i(t,this);if(n.checked=function(...e){const t=n.elt.firstElementChild.getElementsByTagName("input")[0];if(t){if(0===e.length)return t.checked;e[0]?t.checked=!0:t.checked=!1}return n},this.value=function(e){return n.value=e,this},e[0]){n.value(e[0]);const t=document.createElement("span");t.innerHTML=e[0],s.appendChild(t)}return e[1]&&(r.checked=!0),n},t.createSelect=function(...e){let t,r=e[0];if(r instanceof Mr&&r.elt instanceof HTMLSelectElement)t=r,this.elt=r.elt;else if(r instanceof HTMLSelectElement)t=i(r,this),this.elt=r;else{const e=document.createElement("select");r&&"boolean"==typeof r&&e.setAttribute("multiple","true"),t=i(e,this),this.elt=e}return t.option=function(e,t){let i;if(void 0!==e){for(let t=0;t<this.elt.length;t+=1)if(this.elt[t].textContent===e){i=t;break}if(void 0!==i)!1===t?this.elt.remove(i):this.elt[i].value=t;else{const i=document.createElement("option");i.textContent=e,i.value=void 0===t?e:t,this.elt.appendChild(i),this._pInst._elements.push(i)}}},t.selected=function(e){if(void 0!==e){for(let t=0;t<this.elt.length;t+=1)this.elt[t].value.toString()===e.toString()&&(this.elt.selectedIndex=t);return this}if(this.elt.getAttribute("multiple")){let e=[];for(const t of this.elt.selectedOptions)e.push(t.value);return e}return this.elt.value},t.disable=function(e){if("string"==typeof e)for(let t=0;t<this.elt.length;t++)this.elt[t].value.toString()===e&&(this.elt[t].disabled=!0,this.elt[t].selected=!1);else this.elt.disabled=!0;return this},t.enable=function(e){if("string"==typeof e)for(let t=0;t<this.elt.length;t++)this.elt[t].value.toString()===e&&(this.elt[t].disabled=!1,this.elt[t].selected=!1);else{this.elt.disabled=!1;for(let e=0;e<this.elt.length;e++)this.elt[e].disabled=!1,this.elt[e].selected=!1}return this},t};let r=0;t.createRadio=function(...e){let t,s,n;const a=e[0];a instanceof Mr&&(a.elt instanceof HTMLDivElement||a.elt instanceof HTMLSpanElement)?(t=a,this.elt=a.elt):a instanceof HTMLDivElement||a instanceof HTMLSpanElement?(t=i(a,this),this.elt=a,s=a,"string"==typeof e[1]&&(n=e[1])):("string"==typeof a&&(n=a),s=document.createElement("div"),t=i(s,this),this.elt=s),t._name=n||"radioOption_"+r++;const o=e=>e instanceof HTMLInputElement&&"radio"===e.type,h=e=>e instanceof HTMLLabelElement;return t._getOptionsArray=function(){return Array.from(this.elt.children).filter((e=>o(e)||h(e)&&o(e.firstElementChild))).map((e=>o(e)?e:e.firstElementChild))},t.option=function(e,i){let r,s,n;for(const i of t._getOptionsArray())if(i.value===e){r=i;break}return void 0===r&&(r=document.createElement("input"),r.setAttribute("type","radio"),r.setAttribute("value",e)),r.setAttribute("name",t._name),h(r.parentElement)?s=r.parentElement:(s=document.createElement("label"),s.insertAdjacentElement("afterbegin",r)),s.lastElementChild instanceof HTMLSpanElement?n=s.lastElementChild:(n=document.createElement("span"),r.insertAdjacentElement("afterend",n)),n.innerHTML=void 0===i?e:i,this.elt.appendChild(s),r},t.remove=function(e){for(const i of t._getOptionsArray())if(i.value===e)return void(h(i.parentElement)?i.parentElement.remove():i.remove())},t.value=function(){let e="";for(const i of t._getOptionsArray())if(i.checked){e=i.value;break}return e},t.selected=function(e){let i=null;if(void 0===e){for(const e of t._getOptionsArray())if(e.checked){i=e;break}}else{t._getOptionsArray().forEach((e=>{e.checked=!1,e.removeAttribute("checked")}));for(const r of t._getOptionsArray())r.value===e&&(r.setAttribute("checked",!0),r.checked=!0,i=r)}return i},t.disable=function(e=!0){for(const i of t._getOptionsArray())i.setAttribute("disabled",e)},t},t.createColorPicker=function(t){const r=document.createElement("input");let s;r.type="color",t?t instanceof e.Color?r.value=t.toString("#rrggbb"):(this.push(),this.colorMode("rgb"),r.value=this.color(t).toString("#rrggbb"),this.pop()):r.value="#000000",s=i(r,this);const n=this;return s.color=function(){n.push(),t&&t.mode&&n.colorMode(t.mode,...t?.maxes&&t.maxes[t.mode]||[]);const e=n.color(this.elt.value);return n.pop(),e},s},t.createInput=function(e="",t="text"){let r=document.createElement("input");return r.setAttribute("value",e),r.setAttribute("type",t),i(r,this)},t.createFileInput=function(e,t=!1){if(!(window.File&&window.FileReader&&window.FileList&&window.Blob))return void console.log("The File APIs are not fully supported in this browser. Cannot create element.");const r=document.createElement("input");return r.setAttribute("type","file"),t&&r.setAttribute("multiple",!0),r.addEventListener("change",(function(t){for(const i of t.target.files)Fr._load(i,e)}),!1),i(r,this)}}function Ia(e,t){t.deviceOrientation=window.innerWidth/window.innerHeight>1?"landscape":"portrait",t.accelerationX=0,t.accelerationY=0,t.accelerationZ=0,t.pAccelerationX=0,t.pAccelerationY=0,t.pAccelerationZ=0,t._updatePAccelerations=function(){this.pAccelerationX=this.accelerationX,this.pAccelerationY=this.accelerationY,this.pAccelerationZ=this.accelerationZ},t.rotationX=0,t.rotationY=0,t.rotationZ=0,t.pRotationX=0,t.pRotationY=0,t.pRotationZ=0;let i=0,r=0,s=0,n="clockwise",a="clockwise",o="clockwise";t.pRotateDirectionX=void 0,t.pRotateDirectionY=void 0,t.pRotateDirectionZ=void 0,t._updatePRotations=function(){this.pRotationX=this.rotationX,this.pRotationY=this.rotationY,this.pRotationZ=this.rotationZ},t.turnAxis=void 0;let h=.5,u=30;t.setMoveThreshold=function(e){h=e},t.setShakeThreshold=function(e){u=e},t._ondeviceorientation=function(e){this._updatePRotations(),this.rotationX=this._fromDegrees(e.beta),this.rotationY=this._fromDegrees(e.gamma),this.rotationZ=this._fromDegrees(e.alpha),this._handleMotion()},t._ondevicemotion=function(e){this._updatePAccelerations(),this.accelerationX=2*e.acceleration.x,this.accelerationY=2*e.acceleration.y,this.accelerationZ=2*e.acceleration.z,this._handleMotion()},t._handleMotion=function(){90===window.orientation||-90===window.orientation?this.deviceOrientation="landscape":0===window.orientation?this.deviceOrientation="portrait":void 0===window.orientation&&(this.deviceOrientation="undefined");const e=this._isGlobal?window:this;if("function"==typeof e.deviceMoved&&(Math.abs(this.accelerationX-this.pAccelerationX)>h||Math.abs(this.accelerationY-this.pAccelerationY)>h||Math.abs(this.accelerationZ-this.pAccelerationZ)>h)&&e.deviceMoved(),"function"==typeof e.deviceTurned){const t=this._toDegrees(this.rotationX)+180,h=this._toDegrees(this.pRotationX)+180;let u=i+180;t-h>0&&t-h<270||t-h<-270?n="clockwise":(t-h<0||t-h>270)&&(n="counter-clockwise"),n!==this.pRotateDirectionX&&(u=t),Math.abs(t-u)>90&&Math.abs(t-u)<270&&(u=t,this.turnAxis="X",e.deviceTurned()),this.pRotateDirectionX=n,i=u-180;const l=this._toDegrees(this.rotationY)+180,c=this._toDegrees(this.pRotationY)+180;let p=r+180;l-c>0&&l-c<270||l-c<-270?a="clockwise":(l-c<0||l-this.pRotationY>270)&&(a="counter-clockwise"),a!==this.pRotateDirectionY&&(p=l),Math.abs(l-p)>90&&Math.abs(l-p)<270&&(p=l,this.turnAxis="Y",e.deviceTurned()),this.pRotateDirectionY=a,r=p-180;const d=this._toDegrees(this.rotationZ),f=this._toDegrees(this.pRotationZ);d-f>0&&d-f<270||d-f<-270?o="clockwise":(d-f<0||d-f>270)&&(o="counter-clockwise"),o!==this.pRotateDirectionZ&&(s=d),Math.abs(d-s)>90&&Math.abs(d-s)<270&&(s=d,this.turnAxis="Z",e.deviceTurned()),this.pRotateDirectionZ=o,this.turnAxis=void 0}if("function"==typeof e.deviceShaken){let t,i;null!==this.pAccelerationX&&(t=Math.abs(this.accelerationX-this.pAccelerationX),i=Math.abs(this.accelerationY-this.pAccelerationY)),t+i>u&&e.deviceShaken()}}}function Ba(e,t){t.keyIsPressed=!1,t.code=null,t.key="",t.keyCode=0,t._onkeydown=function(e){if(this._downKeys[e.code])return;this.keyIsPressed=!0,this.keyCode=e.which,this.key=e.key,this.code=e.code,this._downKeyCodes[e.code]=!0,this._downKeys[e.key]=!0;const t=this._isGlobal?window:this;if("function"==typeof t.keyPressed&&!e.charCode){!1===t.keyPressed(e)&&e.preventDefault()}},t._onkeyup=function(e){const t=this._isGlobal?window:this;if("function"==typeof t.keyReleased){!1===t.keyReleased(e)&&e.preventDefault()}if(delete this._downKeyCodes[e.code],delete this._downKeys[e.key],this._areDownKeys()){const e=Object.keys(this._downKeyCodes).pop();this.code=e;const t=Object.keys(this._downKeys).pop();this.key=t}else this.keyIsPressed=!1,this.key="",this.code=null},t._onkeypress=function(e){if(e.which===this._lastKeyCodeTyped)return;this._lastKeyCodeTyped=e.which,this.key=e.key||String.fromCharCode(e.which)||e.which;const t=this._isGlobal?window:this;if("function"==typeof t.keyTyped){!1===t.keyTyped(e)&&e.preventDefault()}},t._onblur=function(e){this._downKeys={}},t.keyIsDown=function(e){return function(e){return!["Alt","Shift","Control","Meta"].includes(e)&&"string"==typeof e&&e.length>1}(e)?this._downKeyCodes[e]||this._downKeys[e]||!1:this._downKeys[e]||this._downKeyCodes[e]||!1},t._areDownKeys=function(){for(const e in this._downKeys)if(this._downKeys.hasOwnProperty(e)&&!0===this._downKeys[e])return!0;return!1}}function La(e,t){function i(e,t,i,r){const s=e.getBoundingClientRect();return{x:(r.clientX-s.left)/t,y:(r.clientY-s.top)/i,winX:r.clientX,winY:r.clientY,id:r.pointerId}}t.movedX=0,t.movedY=0,t._hasMouseInteracted=!1,t.mouseX=0,t.mouseY=0,t.pmouseX=0,t.pmouseY=0,t.winMouseX=0,t.winMouseY=0,t.pwinMouseX=0,t.pwinMouseY=0,t.mouseButton={left:!1,right:!1,center:!1},t.touches=[],t._activePointers=new Map,t.mouseIsPressed=!1,t._updatePointerCoords=function(e){if(null!==this._curElement){const t=this._curElement.elt,r=t.scrollWidth/this.width||1,s=t.scrollHeight/this.height||1;if("touch"==e.pointerType){const e=[];for(const n of this._activePointers.values())e.push(i(t,r,s,n));this.touches=e}const n=function(e,t,i,r){const s=e.getBoundingClientRect();return{x:(r.clientX-s.left)/t,y:(r.clientY-s.top)/i,winX:r.clientX,winY:r.clientY}}(t,r,s,e);this.movedX=e.movementX||0,this.movedY=e.movementY||0,this.mouseX=n.x,this.mouseY=n.y,this.winMouseX=n.winX,this.winMouseY=n.winY,this._hasMouseInteracted||(this._updateMouseCoords(),this._hasMouseInteracted=!0)}},t._updateMouseCoords=function(){this.pmouseX=this.mouseX,this.pmouseY=this.mouseY,this.pwinMouseX=this.winMouseX,this.pwinMouseY=this.winMouseY,this._pmouseWheelDeltaY=this._mouseWheelDeltaY},t._setMouseButton=function(e){this.mouseButton.left=Array.from(this._activePointers.values()).some((e=>!!(1&e.buttons))),this.mouseButton.center=Array.from(this._activePointers.values()).some((e=>!!(4&e.buttons))),this.mouseButton.right=Array.from(this._activePointers.values()).some((e=>!!(2&e.buttons)))},t._onpointermove=function(e){const t=this._isGlobal?window:this;let i;this._updatePointerCoords(e),this._activePointers.set(e.pointerId,e),this._setMouseButton(e),this.mouseIsPressed||"function"!=typeof t.mouseMoved?this.mouseIsPressed&&"function"==typeof t.mouseDragged&&(i=t.mouseDragged(e),!1===i&&e.preventDefault()):(i=t.mouseMoved(e),!1===i&&e.preventDefault())},t._onpointerdown=function(e){const t=this._isGlobal?window:this;let i;this.mouseIsPressed=!0,this._activePointers.set(e.pointerId,e),this._setMouseButton(e),this._updatePointerCoords(e),"function"==typeof t.mousePressed&&(i=t.mousePressed(e),!1===i&&e.preventDefault())},t._onpointerup=function(e){const t=this._isGlobal?window:this;let i;this.mouseIsPressed=!1,this._activePointers.delete(e.pointerId),this._setMouseButton(e),this._updatePointerCoords(e),"function"==typeof t.mouseReleased&&(i=t.mouseReleased(e),!1===i&&e.preventDefault())},t._ondragend=t._onpointerup,t._ondragover=t._onpointermove,t._onclick=function(e){const t=this._isGlobal?window:this;if("function"==typeof t.mouseClicked){!1===t.mouseClicked(e)&&e.preventDefault()}},t._ondblclick=function(e){const t=this._isGlobal?window:this;if("function"==typeof t.doubleClicked){!1===t.doubleClicked(e)&&e.preventDefault()}},t._mouseWheelDeltaY=0,t._pmouseWheelDeltaY=0,t._onwheel=function(e){const t=this._isGlobal?window:this;if(this._mouseWheelDeltaY=e.deltaY,"function"==typeof t.mouseWheel){e.delta=e.deltaY;!1===t.mouseWheel(e)&&e.preventDefault()}},t.requestPointerLock=function(){const e=this._curElement.elt;return e.requestPointerLock=e.requestPointerLock||e.mozRequestPointerLock,e.requestPointerLock?(e.requestPointerLock(),!0):(console.log("requestPointerLock is not implemented in this browser"),!1)},t.exitPointerLock=function(){document.exitPointerLock()}}void 0!==p5&&Ta(0,p5.prototype),void 0!==p5&&Ma(p5,p5.prototype),void 0!==p5&&ka(p5,p5.prototype),void 0!==p5&&Ia(0,p5.prototype),void 0!==p5&&Ba(0,p5.prototype),void 0!==p5&&La(0,p5.prototype);class Pa{constructor(e){this.columns=[],this.rows=[]}toString(e=","){let t=this.rows.map((e=>e.arr));return this.columns.some((e=>null===e))||(t=[this.columns,...t]),function(e,t={},i=e=>e){const r=Object.create(null);if(r.options=t,r.options.eof=void 0===r.options.eof||r.options.eof,r.row=1,r.col=1,r.output="",r.options.delimiter=void 0===r.options.delimiter?'"':t.delimiter,r.options.delimiter.length>1||0===r.options.delimiter.length)throw Error(`CSVError: delimiter must be one character [${r.options.separator}]`);if(r.options.separator=void 0===r.options.separator?",":t.separator,r.options.separator.length>1||0===r.options.separator.length)throw Error(`CSVError: separator must be one character [${r.options.separator}]`);const s=new RegExp(`${Ls(r.options.delimiter)}|${Ls(r.options.separator)}|\r\n|\n|\r`);return e.forEach(((t,n)=>{let a="";switch(r.col=1,t.forEach(((e,n)=>{"string"==typeof e&&(e=e.replace(new RegExp(r.options.delimiter,"g"),`${r.options.delimiter}${r.options.delimiter}`),e=s.test(e)?`${r.options.delimiter}${e}${r.options.delimiter}`:e),a+=i(e,r.row,r.col),n!==t.length-1&&(a+=r.options.separator),r.col++})),!0){case r.options.eof:case!r.options.eof&&n!==e.length-1:r.output+=`${a}\n`;break;default:r.output+=`${a}`}r.row++})),r.output}(t,{separator:e})}addRow(e){const t=e||new p5.TableRow;if(void 0===t.arr||void 0===t.obj)throw new Error(`invalid TableRow: ${t}`);return t.table=this,this.rows.push(t),t}removeRow(e){this.rows[e].table=null;const t=this.rows.splice(e+1,this.rows.length);this.rows.pop(),this.rows=this.rows.concat(t)}getRow(e){return this.rows[e]}getRows(){return this.rows}findRow(e,t){if("string"==typeof t){for(let i=0;i<this.rows.length;i++)if(this.rows[i].obj[this.columns.indexOf(t)]===e)return this.rows[i]}else for(let i=0;i<this.rows.length;i++)if(this.rows[i].arr[t]===e)return this.rows[i];return null}findRows(e,t){const i=[];if("string"==typeof t)for(let r=0;r<this.rows.length;r++)this.rows[r].obj[this.columns.indexOf(t)]===e&&i.push(this.rows[r]);else for(let r=0;r<this.rows.length;r++)this.rows[r].arr[t]===e&&i.push(this.rows[r]);return i}matchRow(e,t){if("number"==typeof t){for(let i=0;i<this.rows.length;i++)if(this.rows[i].arr[t].match(e))return this.rows[i]}else for(let i=0;i<this.rows.length;i++)if(this.rows[i].obj[this.columns.indexOf(t)].match(e))return this.rows[i];return null}matchRows(e,t){const i=[];if("number"==typeof t)for(let r=0;r<this.rows.length;r++)this.rows[r].arr[t].match(e)&&i.push(this.rows[r]);else for(let r=0;r<this.rows.length;r++)this.rows[r].obj[this.columns.indexOf(t)].match(e)&&i.push(this.rows[r]);return i}getColumn(e){const t=[];if("string"==typeof e)for(let i=0;i<this.rows.length;i++)t.push(this.rows[i].obj[this.columns.indexOf(e)]);else for(let i=0;i<this.rows.length;i++)t.push(this.rows[i].arr[e]);return t}clearRows(){delete this.rows,this.rows=[]}addColumn(e){const t=e||null;this.columns.push(t)}getColumnCount(){return this.columns.length}getRowCount(){return this.rows.length}removeTokens(e,t){const i=[];for(let t=0;t<e.length;t++)i.push(e.charAt(t).replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&"));const r=new RegExp(i.join("|"),"g");if(void 0===t)for(let e=0;e<this.columns.length;e++)for(let t=0;t<this.rows.length;t++){let i=this.rows[t].arr[e];i=i.replace(r,""),this.rows[t].arr[e]=i,this.rows[t].obj[this.columns[e]]=i}else if("string"==typeof t)for(let e=0;e<this.rows.length;e++){let i=this.rows[e].obj[t];i=i.replace(r,""),this.rows[e].obj[t]=i;const s=this.columns.indexOf(t);this.rows[e].arr[s]=i}else for(let e=0;e<this.rows.length;e++){let i=this.rows[e].arr[t];i=i.replace(r,""),this.rows[e].arr[t]=i,this.rows[e].obj[this.columns[t]]=i}}trim(e){const t=new RegExp(" ","g");if(void 0===e)for(let e=0;e<this.columns.length;e++)for(let i=0;i<this.rows.length;i++){let r=this.rows[i].arr[e];r=r.replace(t,""),this.rows[i].arr[e]=r,this.rows[i].obj[this.columns[e]]=r}else if("string"==typeof e)for(let i=0;i<this.rows.length;i++){let r=this.rows[i].obj[e];r=r.replace(t,""),this.rows[i].obj[e]=r;const s=this.columns.indexOf(e);this.rows[i].arr[s]=r}else for(let i=0;i<this.rows.length;i++){let r=this.rows[i].arr[e];r=r.replace(t,""),this.rows[i].arr[e]=r,this.rows[i].obj[this.columns[e]]=r}}removeColumn(e){let t,i;"string"==typeof e?(t=e,i=this.columns.indexOf(e)):(i=e,t=this.columns[e]);const r=this.columns.splice(i+1,this.columns.length);this.columns.pop(),this.columns=this.columns.concat(r);for(let e=0;e<this.rows.length;e++){const r=this.rows[e].arr,s=r.splice(i+1,r.length);r.pop(),this.rows[e].arr=r.concat(s),delete this.rows[e].obj[t]}}set(e,t,i){this.rows[e].set(t,i)}setNum(e,t,i){this.rows[e].setNum(t,i)}setString(e,t,i){this.rows[e].setString(t,i)}get(e,t){return"string"==typeof t?this.rows[e].get(this.columns.indexOf(t)):this.rows[e].get(t)}getNum(e,t){return this.rows[e].getNum(t)}getString(e,t){return this.rows[e].getString(t)}getObject(e){const t={};let i,r,s;for(let n=0;n<this.rows.length;n++)if(i=this.rows[n].obj,"string"==typeof e){if(r=this.columns.indexOf(e),!(r>=0))throw new Error(`This table has no column named "${e}"`);s=i[e],t[s]=i}else t[n]=this.rows[n].obj;return t}getArray(){const e=[];for(let t=0;t<this.rows.length;t++)e.push(this.rows[t].arr);return e}}function Oa(e,t){e.Table=Pa}void 0!==p5&&Oa(p5);class Na{constructor(e=[]){let t=e;this.arr=t,this.obj=Object.fromEntries(t.entries()),this.table=null}set(e,t){if("string"==typeof e){const i=this.table.columns.indexOf(e);if(!(i>=0))throw new Error(`This table has no column named "${e}"`);this.obj[e]=t,this.arr[i]=t}else{if(!(e<this.table.columns.length))throw new Error(`Column #${e} is out of the range of this table`);{this.arr[e]=t;const i=this.table.columns[e];this.obj[i]=t}}}setNum(e,t){const i=parseFloat(t);this.set(e,i)}setString(e,t){const i=t.toString();this.set(e,i)}get(e){return"string"==typeof e?this.obj[this.table.columns.indexOf(e)]:this.arr[e]}getNum(e){let t;if(t="string"==typeof e?parseFloat(this.obj[this.table.columns.indexOf(e)]):parseFloat(this.arr[e]),"NaN"===t.toString())throw`Error: ${this.obj[e]} is NaN (Not a Number)`;return t}getString(e){return"string"==typeof e?this.obj[this.table.columns.indexOf(e)].toString():this.arr[e].toString()}}function Ra(e,t){e.TableRow=Na}function Va(e,t){t.abs=Math.abs,t.ceil=Math.ceil,t.constrain=function(e,t,i){return Math.max(Math.min(e,i),t)},t.dist=function(...e){return 4===e.length?Math.hypot(e[2]-e[0],e[3]-e[1]):6===e.length?Math.hypot(e[3]-e[0],e[4]-e[1],e[5]-e[2]):void 0},t.exp=Math.exp,t.floor=Math.floor,t.lerp=function(e,t,i){return i*(t-e)+e},t.log=Math.log,t.mag=function(e,t){return Math.hypot(e,t)},t.map=function(e,t,i,r,s,n){const a=(e-t)/(i-t)*(s-r)+r;return n?r<s?this.constrain(a,r,s):this.constrain(a,s,r):a},t.max=function(...e){const t=e=>{let t=-1/0;for(let i of e)t=Math.max(t,i);return t};return e[0]instanceof Array?t(e[0]):t(e)},t.min=function(...e){const t=e=>{let t=1/0;for(let i of e)t=Math.min(t,i);return t};return e[0]instanceof Array?t(e[0]):t(e)},t.norm=function(e,t,i){return this.map(e,t,i,0,1)},t.pow=Math.pow,t.round=function(e,t){if(!t)return Math.round(e);const i=Math.pow(10,t);return Math.round(e*i)/i},t.sq=e=>e*e,t.sqrt=Math.sqrt,t.fract=function(e){let t=0,i=Number(e);if(isNaN(i)||Math.abs(i)===1/0)return i;if(i<0&&(i=-i,t=1),String(i).includes(".")&&!String(i).includes("e")){let e=String(i);return e=Number("0"+e.slice(e.indexOf("."))),Math.abs(t-e)}return i<1?Math.abs(t-i):0}}function Ua(e,t){const i=4095;let r=4,s=.5;const n=e=>.5*(1-Math.cos(e*Math.PI));let a;t.noise=function(e,t=0,o=0){if(null==a){a=new Array(4096);for(let e=0;e<4096;e++)a[e]=Math.random()}e<0&&(e=-e),t<0&&(t=-t),o<0&&(o=-o);let h,u,l,c,p,d=Math.floor(e),f=Math.floor(t),g=Math.floor(o),m=e-d,y=t-f,x=o-g,v=0,b=.5;for(let e=0;e<r;e++){let e=d+(f<<4)+(g<<8);h=n(m),u=n(y),l=a[e&i],l+=h*(a[e+1&i]-l),c=a[e+16&i],c+=h*(a[e+16+1&i]-c),l+=u*(c-l),e+=256,c=a[e&i],c+=h*(a[e+1&i]-c),p=a[e+16&i],p+=h*(a[e+16+1&i]-p),c+=u*(p-c),l+=n(x)*(c-l),v+=l*b,b*=s,d<<=1,m*=2,f<<=1,y*=2,g<<=1,x*=2,m>=1&&(d++,m--),y>=1&&(f++,y--),x>=1&&(g++,x--)}return v},t.noiseDetail=function(e,t){e>0&&(r=e),t>0&&(s=t)},t.noiseSeed=function(e){const t=(()=>{const e=4294967296;let t,i;return{setSeed(r){i=t=(null==r?Math.random()*e:r)>>>0},getSeed:()=>t,rand:()=>(i=(1664525*i+1013904223)%e,i/e)}})();t.setSeed(e),a=new Array(4096);for(let e=0;e<4096;e++)a[e]=t.rand()}}function Ga(e,t){const i="_lcg_random_state",r=4294967296;let s=0;t._lcg=function(e){return this[e]=(1664525*this[e]+1013904223)%r,this[e]/r},t._lcgSetSeed=function(e,t){this[e]=(null==t?Math.random()*r:t)>>>0},t.randomSeed=function(e){this._lcgSetSeed(i,e),this._gaussian_previous=!1},t.random=function(e,t){let r;if(r=null!=this[i]?this._lcg(i):Math.random(),void 0===e)return r;if(void 0===t)return e instanceof Array?e[Math.floor(r*e.length)]:r*e;if(e>t){const i=e;e=t,t=i}return r*(t-e)+e},t.randomGaussian=function(e,t=1){let i,r,n,a;if(this._gaussian_previous)i=s,this._gaussian_previous=!1;else{do{r=this.random(2)-1,n=this.random(2)-1,a=r*r+n*n}while(a>=1);a=Math.sqrt(-2*Math.log(a)/a),i=r*a,s=n*a,this._gaussian_previous=!0}return i*t+(e||0)}}function za(e,t){t.createVector=function(t,i,r){return this instanceof e?new e.Vector(this._fromRadians.bind(this),this._toRadians.bind(this),...arguments):new e.Vector(t,i,r)},t.createMatrix=function(...t){return new e.Matrix(...t)}}function ja(e,t){t.float=function(e){return e instanceof Array?e.map(parseFloat):parseFloat(e)},t.int=function(e,i=10){return e===1/0||"Infinity"===e?1/0:e===-1/0||"-Infinity"===e?-1/0:"string"==typeof e?parseInt(e,i):"number"==typeof e?0|e:"boolean"==typeof e?e?1:0:e instanceof Array?e.map((e=>t.int(e,i))):void 0},t.str=function(e){return e instanceof Array?e.map(t.str):String(e)},t.boolean=function(e){return"number"==typeof e?0!==e:"string"==typeof e?"true"===e.toLowerCase():"boolean"==typeof e?e:e instanceof Array?e.map(t.boolean):void 0},t.byte=function(e){const i=t.int(e,10);return"number"==typeof i?(i+128)%256-128:i instanceof Array?i.map(t.byte):void 0},t.char=function(e){return"number"!=typeof e||isNaN(e)?e instanceof Array?e.map(t.char):"string"==typeof e?t.char(parseInt(e,10)):void 0:String.fromCharCode(e)},t.unchar=function(e){return"string"==typeof e&&1===e.length?e.charCodeAt(0):e instanceof Array?e.map(t.unchar):void 0},t.hex=function(e,i){if(i=null==i?i=8:i,e instanceof Array)return e.map((e=>t.hex(e,i)));if(e===1/0||e===-1/0){return(e===1/0?"F":"0").repeat(i)}if("number"==typeof e){e<0&&(e=4294967295+e+1);let t=Number(e).toString(16).toUpperCase();for(;t.length<i;)t=`0${t}`;return t.length>=i&&(t=t.substring(t.length-i,t.length)),t}},t.unhex=function(e){return e instanceof Array?e.map(t.unhex):parseInt(`0x${e}`,16)}}function $a(e,t){function i(e,t,i){let r=e<0;e=Math.abs(e);let[s,n]=e.toString().split(".");if(void 0===i){s=s.padStart(t,"0");let e=n?s+"."+n:s;return r?"-"+e:e}{let a=e.toFixed(i);[s,n]=a.toString().split("."),s=s.padStart(t,"0");let o=void 0===n?s:s+"."+n;return r?"-"+o:o}}function r(e,t){const i=(e=e.toString()).indexOf(".");let r=-1!==i?e.substring(i):"",s=-1!==i?e.substring(0,i):e;if(s=s.toString().replace(/\B(?=(\d{3})+(?!\d))/g,","),0===t)r="";else if(void 0!==t)if(t>r.length){r+=-1===i?".":"";const e=t-r.length+1;for(let t=0;t<e;t++)r+="0"}else r=r.substring(0,t+1);return s+r}function s(e){return parseFloat(e)>0?`+${e.toString()}`:e.toString()}function n(e){return parseFloat(e)>=0?` ${e.toString()}`:e.toString()}t.nf=function(e,t,r){if(e instanceof Array)return e.map((e=>i(e,t,r)));return"[object Arguments]"===Object.prototype.toString.call(e)?3===e.length?this.nf(e[0],e[1],e[2]):2===e.length?this.nf(e[0],e[1]):this.nf(e[0]):i(e,t,r)},t.nfc=function(e,t){return e instanceof Array?e.map((e=>r(e,t))):r(e,t)},t.nfp=function(...e){const i=t.nf.apply(this,e);return i instanceof Array?i.map(s):s(i)},t.nfs=function(...e){const i=t.nf.apply(this,e);return i instanceof Array?i.map(n):n(i)},t.splitTokens=function(e,t){let i;if(void 0!==t){let e=t;const r=/\]/g.exec(e);let s=/\[/g.exec(e);s&&r?(e=e.slice(0,r.index)+e.slice(r.index+1),s=/\[/g.exec(e),e=e.slice(0,s.index)+e.slice(s.index+1),i=new RegExp(`[\\[${e}\\]]`,"g")):r?(e=e.slice(0,r.index)+e.slice(r.index+1),i=new RegExp(`[${e}\\]]`,"g")):s?(e=e.slice(0,s.index)+e.slice(s.index+1),i=new RegExp(`[${e}\\[]`,"g")):i=new RegExp(`[${e}]`,"g")}else i=/\s/g;return e.split(i).filter((e=>e))},t.shuffle=function(e,t){const i=ArrayBuffer&&ArrayBuffer.isView&&ArrayBuffer.isView(e);let r,s,n=(e=t||i?e:e.slice()).length;for(;n>1;)r=this.random(0,1)*n|0,s=e[--n],e[n]=e[r],e[r]=s;return e}}function Wa(e,t){t.day=function(){return(new Date).getDate()},t.hour=function(){return(new Date).getHours()},t.minute=function(){return(new Date).getMinutes()},t.millis=function(){return-1===this._millisStart?0:window.performance.now()-this._millisStart},t.month=function(){return(new Date).getMonth()+1},t.second=function(){return(new Date).getSeconds()},t.year=function(){return(new Date).getFullYear()}}function qa(e,t){t.orbitControl=function(e,t,i,r){this._assert3d("orbitControl");const s=this._renderer.states.curCamera;void 0===e&&(e=1),void 0===t&&(t=e),void 0===i&&(i=1),"object"!=typeof r&&(r={}),!0!==this.contextMenuDisabled&&(this.canvas.oncontextmenu=()=>!1,this.contextMenuDisabled=!0),!0!==this.wheelDefaultDisabled&&(this.canvas.onwheel=()=>!1,this.wheelDefaultDisabled=!0);const{disableTouchActions:n=!0}=r;!0!==this.touchActionsDisabled&&n&&(this.canvas.style["touch-action"]="none",this.touchActionsDisabled=!0);const{freeRotation:a=!1}=r,o=[];this.touches.forEach((e=>{this._renderer.prevTouches.forEach((t=>{if(e.id===t.id){const i={x:e.x,y:e.y,px:t.x,py:t.y};o.push(i)}}))})),this._renderer.prevTouches=this.touches;let h=0,u=0,l=0,c=0,p=0;const d=.85,f=this.height<this.width?this.height:this.width;let g=!1;if(o.length>0){if(g=o[0].x>0&&o[0].x<this.width&&o[0].y>0&&o[0].y<this.height,1===o.length){const i=o[0];u=-e*(i.x-i.px)/f,l=t*(i.y-i.py)/f}else{const e=o[0],t=o[1];h=-(Math.hypot(e.x-t.x,e.y-t.y)-Math.hypot(e.px-t.px,e.py-t.py))*i*4e-4,c=.5*(e.x+t.x)-.5*(e.px+t.px),p=.5*(e.y+t.y)-.5*(e.py+t.py)}this.touches.length>0?g&&(this._renderer.executeRotateAndMove=!0,this._renderer.executeZoom=!0):(this._renderer.executeRotateAndMove=!1,this._renderer.executeZoom=!1)}else g=this.mouseX>0&&this.mouseX<this.width&&this.mouseY>0&&this.mouseY<this.height,0!==this._mouseWheelDeltaY?(h=Math.sign(this._mouseWheelDeltaY)*i,h*=.01,this._mouseWheelDeltaY=0,g&&(this._renderer.executeZoom=!0)):this._renderer.executeZoom=!1,this.mouseIsPressed?(this.mouseButton.left?(u=-e*this.movedX/f,l=t*this.movedY/f):this.mouseButton.right&&(c=this.movedX,p=this.movedY*s.yScale),g&&(this._renderer.executeRotateAndMove=!0)):this._renderer.executeRotateAndMove=!1;if(0!==h&&this._renderer.executeZoom&&(this._renderer.zoomVelocity+=h),Math.abs(this._renderer.zoomVelocity)>.001?(a?s._orbitFree(0,0,this._renderer.zoomVelocity):s._orbit(0,0,this._renderer.zoomVelocity),0!==s.projMatrix.mat4[15]&&(s.projMatrix.mat4[0]*=Math.pow(10,-this._renderer.zoomVelocity),s.projMatrix.mat4[5]*=Math.pow(10,-this._renderer.zoomVelocity),this._renderer.states.setValue("uPMatrix",this._renderer.states.uPMatrix.clone()),this._renderer.states.uPMatrix.mat4[0]=s.projMatrix.mat4[0],this._renderer.states.uPMatrix.mat4[5]=s.projMatrix.mat4[5]),this._renderer.zoomVelocity*=d):this._renderer.zoomVelocity=0,0===u&&0===l||!this._renderer.executeRotateAndMove||this._renderer.rotateVelocity.add(.6*u,.6*l),this._renderer.rotateVelocity.magSq()>1e-6?(a?s._orbitFree(-this._renderer.rotateVelocity.x,this._renderer.rotateVelocity.y,0):s._orbit(this._renderer.rotateVelocity.x,this._renderer.rotateVelocity.y,0),this._renderer.rotateVelocity.mult(d)):this._renderer.rotateVelocity.set(0,0),(0!==c||0!==p)&&this._renderer.executeRotateAndMove){const e=2*c/this.width,t=2*-p/this.height;this._renderer.moveVelocity.add(.15*e,.15*t)}if(this._renderer.moveVelocity.magSq()>1e-6){const e=s._getLocalAxes(),t=s.eyeX-s.centerX,i=s.eyeY-s.centerY,r=s.eyeZ-s.centerZ,n=Math.sqrt(t*t+i*i+r*r);let a,o,h=new je(s.centerX,s.centerY,s.centerZ);h=s.cameraMatrix.multiplyPoint(h),h=this._renderer.states.uPMatrix.multiplyAndNormalizePoint(h),h.x-=this._renderer.moveVelocity.x,h.y-=this._renderer.moveVelocity.y;const u=this._renderer.states.uPMatrix.mat4;0===u[15]?(a=(u[8]+h.x)/u[0]*n,o=(u[9]+h.y)/u[5]*n):(a=(h.x-u[12])/u[0],o=(h.y-u[13])/u[5]),s.setPosition(s.eyeX+a*e.x[0]+o*e.y[0],s.eyeY+a*e.x[1]+o*e.y[1],s.eyeZ+a*e.x[2]+o*e.y[2]),this._renderer.moveVelocity.mult(d)}else this._renderer.moveVelocity.set(0,0);return this},t.debugMode=function(...t){this._assert3d("debugMode");for(let t=e.lifecycleHooks.postdraw.length-1;t>=0;t--)e.lifecycleHooks.postdraw[t].toString()!==this._grid().toString()&&e.lifecycleHooks.postdraw[t].toString()!==this._axesIcon().toString()||e.lifecycleHooks.postdraw.splice(t,1);t[0]===Se?e.lifecycleHooks.postdraw.push(this._grid(t[1],t[2],t[3],t[4],t[5])):t[0]===Fe?e.lifecycleHooks.postdraw.push(this._axesIcon(t[1],t[2],t[3],t[4])):(e.lifecycleHooks.postdraw.push(this._grid(t[0],t[1],t[2],t[3],t[4])),e.lifecycleHooks.postdraw.push(this._axesIcon(t[5],t[6],t[7],t[8])))},t.noDebugMode=function(){this._assert3d("noDebugMode");for(let t=e.lifecycleHooks.postdraw.length-1;t>=0;t--)e.lifecycleHooks.postdraw[t].toString()!==this._grid().toString()&&e.lifecycleHooks.postdraw[t].toString()!==this._axesIcon().toString()||e.lifecycleHooks.postdraw.splice(t,1)},t._grid=function(e,t,i,r,s){void 0===e&&(e=this.width/2),void 0===t&&(t=Math.round(e/30)<4?4:Math.round(e/30)),void 0===i&&(i=0),void 0===r&&(r=0),void 0===s&&(s=0);const n=e/t,a=e/2;return function(){this.push(),this.stroke(255*this._renderer.states.curStrokeColor[0],255*this._renderer.states.curStrokeColor[1],255*this._renderer.states.curStrokeColor[2]),this._renderer.states.setValue("uModelMatrix",this._renderer.states.uModelMatrix.clone()),this._renderer.states.uModelMatrix.reset();for(let e=0;e<=t;e++)this.beginShape(this.LINES),this.vertex(-a+i,r,e*n-a+s),this.vertex(+a+i,r,e*n-a+s),this.endShape();for(let e=0;e<=t;e++)this.beginShape(this.LINES),this.vertex(e*n-a+i,r,-a+s),this.vertex(e*n-a+i,r,+a+s),this.endShape();this.pop()}},t._axesIcon=function(e,t,i,r){return void 0===e&&(e=this.width/20>40?this.width/20:40),void 0===t&&(t=-this.width/4),void 0===i&&(i=t),void 0===r&&(r=t),()=>{this.push(),this._renderer.states.setValue("uModelMatrix",this._renderer.states.uModelMatrix.clone()),this._renderer.states.uModelMatrix.reset(),this.strokeWeight(2),this.stroke(255,0,0),this.beginShape(this.LINES),this.vertex(t,i,r),this.vertex(t+e,i,r),this.endShape(),this.stroke(0,255,0),this.beginShape(this.LINES),this.vertex(t,i,r),this.vertex(t,i+e,r),this.endShape(),this.stroke(0,0,255),this.beginShape(this.LINES),this.vertex(t,i,r),this.vertex(t,i,r+e),this.endShape(),this.pop()}}}async function Ha(e){try{return(await fetch(e,{method:"HEAD"})).ok}catch(e){return!1}}function Xa(e,t){async function i(e){let t=null,i={};const{data:r}=await Os(e,"text"),s=r.split("\n");for(let e=0;e<s.length;++e){const r=s[e].trim().split(/\s+/);if("newmtl"===r[0]){t=r[1],i[t]={}}else"Kd"===r[0]?i[t].diffuseColor=[parseFloat(r[1]),parseFloat(r[2]),parseFloat(r[3])]:"Ka"===r[0]?i[t].ambientColor=[parseFloat(r[1]),parseFloat(r[2]),parseFloat(r[3])]:"Ks"===r[0]?i[t].specularColor=[parseFloat(r[1]),parseFloat(r[2]),parseFloat(r[3])]:"map_Kd"===r[0]&&(i[t].texturePath=r[1])}return i}function r(e,t,i={}){const r={v:[],vt:[],vn:[]},s={};let n=null,a=!1,o=!1;for(let h=0;h<t.length;++h){const u=t[h].trim().split(/\b\s+/);if(u.length>0)if("usemtl"===u[0])n=u[1];else if("v"===u[0]||"vn"===u[0]){const e=new je(parseFloat(u[1]),parseFloat(u[2]),parseFloat(u[3]));r[u[0]].push(e)}else if("vt"===u[0]){const e=[parseFloat(u[1]),1-parseFloat(u[2])];r[u[0]].push(e)}else if("f"===u[0])for(let t=3;t<u.length;++t){const h=[],l=[1,t-1,t];for(let t=0;t<l.length;++t){const c=u[l[t]];let p=c.split("/");for(let e=0;e<p.length;e++)p[e]=parseInt(p[e])-1;if(s[c]||(s[c]={}),void 0===s[c][n]){const t=e.vertices.length;if(e.vertices.push(r.v[p[0]].copy()),e.uvs.push(r.vt[p[1]]?r.vt[p[1]].slice():[0,0]),e.vertexNormals.push(r.vn[p[2]]?r.vn[p[2]].copy():new je),s[c][n]=t,h.push(t),n&&i[n]&&i[n].diffuseColor){a=!0;const t=i[n].diffuseColor;e.vertexColors.push(t[0]),e.vertexColors.push(t[1]),e.vertexColors.push(t[2]),e.vertexColors.push(1)}else o=!0}else h.push(s[c][n])}h[0]!==h[1]&&h[0]!==h[2]&&h[1]!==h[2]&&e.faces.push(h)}}if(0===e.vertexNormals.length&&e.computeNormals(),a===o)throw new Error("Model coloring is inconsistent. Either all vertices should have colors or none should.");return e}function s(e,t){if(function(e){const t=new DataView(e),i=[115,111,108,105,100];for(let e=0;e<5;e++)if(n(i,t,e))return!1;return!0}(t))!function(e,t){const i=new DataView(t),r=i.getUint32(80,!0);let s,n,a,o,h,u,l,c=!1;for(let e=0;e<70;e++)1129270351===i.getUint32(e,!1)&&82===i.getUint8(e+4)&&61===i.getUint8(e+5)&&(c=!0,o=[],h=i.getUint8(e+6)/255,u=i.getUint8(e+7)/255,l=i.getUint8(e+8)/255);const p=84,d=50;for(let t=0;t<r;t++){const r=p+t*d,f=i.getFloat32(r,!0),g=i.getFloat32(r+4,!0),m=i.getFloat32(r+8,!0);if(c){const e=i.getUint16(r+48,!0);32768&e?(s=h,n=u,a=l):(s=(31&e)/31,n=(e>>5&31)/31,a=(e>>10&31)/31)}const y=new je(f,g,m);for(let t=1;t<=3;t++){const h=r+12*t,u=new je(i.getFloat32(h,!0),i.getFloat32(h+4,!0),i.getFloat32(h+8,!0));e.vertices.push(u),e.vertexNormals.push(y),c&&o.push(s,n,a)}e.faces.push([3*t,3*t+1,3*t+2]),e.uvs.push([0,0],[0,0],[0,0])}}(e,t);else{const i=new DataView(t);if(!("TextDecoder"in window))return console.warn("Sorry, ASCII STL loading only works in browsers that support TextDecoder (https://caniuse.com/#feat=textencoder)"),e;!function(e,t){let i,r,s="",n=[];for(let a=0;a<t.length;++a){const o=t[a].trim(),h=o.split(" ");for(let e=0;e<h.length;++e)""===h[e]&&h.splice(e,1);if(0!==h.length)switch(s){case"":if("solid"!==h[0])return console.error(o),void console.error(`Invalid state "${h[0]}", should be "solid"`);s="solid";break;case"solid":if("facet"!==h[0]||"normal"!==h[1])return console.error(o),void console.error(`Invalid state "${h[0]}", should be "facet normal"`);i=new je(parseFloat(h[2]),parseFloat(h[3]),parseFloat(h[4])),e.vertexNormals.push(i,i,i),s="facet normal";break;case"facet normal":if("outer"!==h[0]||"loop"!==h[1])return console.error(o),void console.error(`Invalid state "${h[0]}", should be "outer loop"`);s="vertex";break;case"vertex":if("vertex"===h[0])r=new je(parseFloat(h[1]),parseFloat(h[2]),parseFloat(h[3])),e.vertices.push(r),e.uvs.push([0,0]),n.push(e.vertices.indexOf(r));else{if("endloop"!==h[0])return console.error(o),void console.error(`Invalid state "${h[0]}", should be "vertex" or "endloop"`);e.faces.push(n),n=[],s="endloop"}break;case"endloop":if("endfacet"!==h[0])return console.error(o),void console.error(`Invalid state "${h[0]}", should be "endfacet"`);s="endfacet";break;case"endfacet":if("endsolid"===h[0]);else{if("facet"!==h[0]||"normal"!==h[1])return console.error(o),void console.error(`Invalid state "${h[0]}", should be "endsolid" or "facet normal"`);i=new je(parseFloat(h[2]),parseFloat(h[3]),parseFloat(h[4])),e.vertexNormals.push(i,i,i),s="facet normal"}break;default:console.error(`Invalid state "${s}"`)}}}(e,new TextDecoder("utf-8").decode(i).split("\n"))}return e}function n(e,t,i){for(let r=0,s=e.length;r<s;r++)if(e[r]!==t.getUint8(i+r,!1))return!1;return!0}t.loadModel=async function(t,n,a,o,h){let u=!1,l=!1;"object"==typeof n?(a=n.normalize||!1,o=n.successCallback,h=n.failureCallback,u=(n=n.fileType||n).flipU||!1,l=n.flipV||!1):("function"==typeof arguments[arguments.length-1]&&("function"==typeof arguments[arguments.length-2]?(o=arguments[arguments.length-2],h=arguments[arguments.length-1]):o=arguments[arguments.length-1]),"string"==typeof n?"boolean"!=typeof a&&(a=!1):"boolean"==typeof n?(a=n,n=t.slice(-4)):(n=t.slice(-4),a=!1)),".obj"!==n.toLowerCase()&&".stl"!==n.toLowerCase()&&(n=".obj");const c=new gn(void 0,void 0,void 0,this._renderer);c.gid=`${t}|${a}`;try{if(n.match(/\.stl$/i)){const{data:e}=await Os(t,"arrayBuffer");return s(c,e),a&&c.normalize(),u&&c.flipU(),l&&c.flipV(),c._makeTriangleEdges(),o?o(c):c}if(n.match(/\.obj$/i)){const{data:e}=await Os(t,"text"),s=e.split("\n"),n=await async function(e){const r=[];for(let s of e){const e=s.match(/^mtllib (.+)/);if(e){let s="";const n=e[1],a=t.split("/");if(a.length>1){a.pop();const e=a.join("/");s=e+"/"+n}else s=n;r.push(Ha(s).then((e=>e?i(s):(console.warn(`MTL file not found or error in parsing; proceeding without materials: ${s}`),{}))).catch((e=>(console.warn(`Error loading MTL file: ${s}`,e),{}))))}}try{const e=await Promise.all(r);return Object.assign({},...e)}catch(e){return{}}}(s);return r(c,s,n),a&&c.normalize(),u&&c.flipU(),l&&c.flipV(),c._makeTriangleEdges(),o?o(c):c}}catch(i){if(e._friendlyFileLoadError(3,t),h)return h(i);throw i}},t.model=function(e,t=1){this._assert3d("model"),this._renderer.model(e,t)};let a=0;t.createModel=function(t,i=" ",n){let o,h,u=!1,l=!1,c=!1;n&&"object"==typeof n?(u=n.normalize||!1,o=n.successCallback,h=n.failureCallback,l=n.flipU||!1,c=n.flipV||!1):"boolean"==typeof n?(u=n,o=arguments[3],h=arguments[4]):(o="function"==typeof arguments[2]?arguments[2]:void 0,h=arguments[3]);const p=new e.Geometry;if(p.gid=`${i}|${u}|${a++}`,i.match(/\.stl$/i))try{s(p,(new TextEncoder).encode(t).buffer)}catch(t){return void(h?h(t):e._friendlyError("Error during parsing: "+t.message))}else if(i.match(/\.obj$/i))try{r(p,t.split("\n"))}catch(t){return void(h?h(t):e._friendlyError("Error during parsing: "+t.message))}else e._friendlyFileLoadError(3,t),h?h():e._friendlyError("Sorry, the file type is invalid. Only OBJ and STL files are supported.");return u&&p.normalize(),l&&p.flipU(),c&&p.flipV(),p._makeTriangleEdges(),"function"==typeof o&&o(p),p}}void 0!==p5&&Ra(p5),void 0!==p5&&Va(0,p5.prototype),void 0!==p5&&Ua(0,p5.prototype),void 0!==p5&&Ga(0,p5.prototype),void 0!==p5&&za(p5,p5.prototype),void 0!==p5&&ja(0,p5.prototype),void 0!==p5&&$a(0,p5.prototype),void 0!==p5&&Wa(0,p5.prototype),void 0!==p5&&qa(p5,p5.prototype),void 0!==p5&&Xa(p5,p5.prototype);const Ya="ideographic",Za="middle",Ka="_textBoundsSingle",Ja="_fontBoundsSingle",Qa="hanging",eo="start",to="end";function io(e,t){const i=/\r?\n/g,r=/,\s+/,s=/^".*"$/,n=/\t/g,a=new RegExp(`(?:${["wght","wdth","ital","slnt","opsz"].join("|")})`);["text","textAlign","textAscent","textDescent","textLeading","textMode","textFont","textSize","textStyle","textWidth","textWrap","textBounds","textDirection","textProperty","textProperties","fontBounds","fontWidth","fontAscent","fontDescent","textWeight"].forEach((i=>{t[i]=function(...e){if(!(i in xs.prototype))throw Error(`Renderer2D.prototype.${i} is not defined.`);return this._renderer[i](...e)},e.Graphics.prototype[i]=function(...e){return this._renderer[i](...e)}}));const o={textAlign:{default:t.LEFT,type:"Context2d"},textBaseline:{default:t.BASELINE,type:"Context2d"},textFont:{default:{family:"sans-serif"}},textLeading:{default:15},textSize:{default:12},textWrap:{default:t.WORD},fontStretch:{default:t.NORMAL,isShorthand:!0},fontWeight:{default:t.NORMAL,isShorthand:!0},lineHeight:{default:t.NORMAL,isShorthand:!0},fontVariant:{default:t.NORMAL,isShorthand:!0},fontStyle:{default:t.NORMAL,isShorthand:!0},direction:{default:"inherit"}},h=["font","direction","fontKerning","fontStretch","fontVariantCaps","letterSpacing","textAlign","textBaseline","textRendering","wordSpacing"],u=Object.keys(o).filter((e=>o[e].isShorthand)),l=["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded"];let c,p;if(xs.prototype.text=function(e,t,i,r,s){let n=this.textDrawingContext().textBaseline;({x:t,y:i,width:r,height:s}=this._handleRectMode(t,i,r,s));let a=this._processLines(e,r,s);a=this._positionLines(t,i,r,s,a),a.forEach((e=>this._renderText(e.text,e.x,e.y))),this.textDrawingContext().textBaseline=n},xs.prototype.textBounds=function(e,t,i,r,s){return this._computeBounds(Ka,e,t,i,r,s).bounds},xs.prototype.fontBounds=function(e,t,i,r,s){return this._computeBounds(Ja,e,t,i,r,s).bounds},xs.prototype.textWidth=function(e){let t=this._processLines(e);return Math.max(...t.map((e=>this._textWidthSingle(e))))},xs.prototype.fontWidth=function(e){let t=this._processLines(e);return Math.max(...t.map((e=>this._fontWidthSingle(e))))},xs.prototype.textAscent=function(e=""){return e.length?this.textDrawingContext().measureText(e).actualBoundingBoxAscent:this.fontAscent()},xs.prototype.fontAscent=function(){return this.textDrawingContext().measureText("_").fontBoundingBoxAscent},xs.prototype.textDescent=function(e=""){return e.length?this.textDrawingContext().measureText(e).actualBoundingBoxDescent:this.fontDescent()},xs.prototype.fontDescent=function(){return this.textDrawingContext().measureText("_").fontBoundingBoxDescent},xs.prototype.textAlign=function(e,i){return void 0!==e?(this.states.setValue("textAlign",e),void 0!==i&&(i===t.CENTER&&(i=Za),this.states.setValue("textBaseline",i)),this._applyTextProperties()):{horizontal:this.states.textAlign,vertical:this.states.textBaseline}},xs.prototype._currentTextFont=function(){return this.states.textFont.font||this.states.textFont.family},xs.prototype.textFont=function(t,i,r){if(0===arguments.length)return this._currentTextFont();let s=t;if(t instanceof e.Font?s=t.face.family:t.data instanceof Uint8Array?(s=t.name.fontFamily,t.name?.fontSubfamily&&(s+="-"+t.name.fontSubfamily)):"string"==typeof t&&void 0===i&&/[.0-9]+(%|em|p[xt])/.test(s)&&({family:s,size:i}=this._directSetFontString(s)),"string"!=typeof s)throw Error("null font in textFont()");return 2===arguments.length&&"object"==typeof i&&(r=i,i=void 0),this.states.setValue("textFont",{font:t,family:s,size:i}),void 0!==i&&this._setTextSize(i),"object"==typeof r&&this.textProperties(r),this._applyTextProperties()},xs.prototype._directSetFontString=function(e,t=0){t&&console.log('_directSetFontString"'+e+'"');let i=u.reduce(((e,t)=>(e[t]=o[t].default,e)),{}),r=this._cachedDiv(i);r.style.font=e;let s=getComputedStyle(r);return u.forEach((e=>{this.states[e]=s[e],t&&console.log(" this.states."+e+'="'+s[e]+'"')})),{family:s.fontFamily,size:s.fontSize}},xs.prototype.textLeading=function(e){return"number"==typeof e?(this.states.setValue("leadingSet",!0),this.states.setValue("textLeading",e),this._applyTextProperties()):this.states.textLeading},xs.prototype.textWeight=function(t){return"number"==typeof t?(this.states.setValue("fontWeight",t),this._applyTextProperties(),void(e.prototype._isSafari()||this._setCanvasStyleProperty("font-variation-settings",`"wght" ${t}`))):this.states.fontWeight},xs.prototype.textSize=function(e){return void 0!==e?(this._setTextSize(e),this._applyTextProperties()):this.states.textSize},xs.prototype.textStyle=function(e){return void 0!==e?(this.states.setValue("fontStyle",e),this._applyTextProperties()):this.states.fontStyle},xs.prototype.textWrap=function(e){return e===t.WORD||e===t.CHAR?(this.states.setValue("textWrap",e),this._pInst):this.states.textWrap},xs.prototype.textDirection=function(e){return void 0!==e?(this.states.setValue("direction",e),this._applyTextProperties()):this.states.direction},xs.prototype.textProperty=function(e,t,i){let r=!1,s=i?.debug||!1;if(void 0===t){let t=this.textProperties();if(e in t)return t[e];throw Error('Unknown text option "'+e+'"')}return e in this.states&&this.states[e]!==t?(this.states[e]=t,r=!0,s&&console.log("this.states."+e+'="'+options[e]+'"')):e in this.textDrawingContext()?(this._setContextProperty(e,t,s),r=!0):e in this.textCanvas().style?(this._setCanvasStyleProperty(e,t,s),r=!0):console.warn('Ignoring unknown text option: "'+e+'"\n'),r?this._applyTextProperties():this._pInst},xs.prototype.textProperties=function(e){if(void 0!==e)return Object.keys(e).forEach((t=>{this.textProperty(t,e[t])})),this._pInst;let t=this.textDrawingContext();return e=h.reduce(((e,i)=>(e[i]=t[i],e)),{}),Object.keys(o).forEach((i=>{if("Context2d"===o[i]?.type)e[i]=t[i];else if("textFont"===i){let t=this._currentTextFont();"object"==typeof t&&"_pInst"in t&&(t=Object.assign({},t),delete t._pInst),e[i]=t}else e[i]=this.states[i]})),e},xs.prototype.textMode=function(){},xs.prototype._currentTextFont=function(){return this.states.textFont.font||this.states.textFont.family},xs.prototype._computeBounds=function(t,i,r,s,n,a,o){let h=this.textDrawingContext(),u=h.textBaseline,{textLeading:l,textAlign:c}=this.states;({width:n,height:a}=this._rectModeAdjust(r,s,n,a));let p=this._processLines(i,n,a),d=p.map(((e,i)=>this[t].bind(this)(e,r,s+i*l)));p.length>1&&d.forEach((t=>t.x+=e.Renderer2D.prototype._xAlignOffset.call(this,c,n))),void 0!==a&&e.Renderer2D.prototype._yAlignOffset.call(this,d,a);let f=d[0];return p.length>1&&(f=this._aggregateBounds(d),o?.ignoreRectMode||this._rectModeAlign(f,n||0,a||0)),h.textBaseline=u,{bounds:f,lines:p}},xs.prototype._rectModeAdjust=function(e,i,r,s){if(void 0!==r)switch(this.states.rectMode){case t.CENTER:break;case t.CORNERS:r-=e,s-=i;break;case t.RADIUS:r*=2,s*=2}return{x:e,y:i,width:r,height:s}},xs.prototype._setCanvasStyleProperty=function(e,t,i){let r=t.toString();i&&console.log("canvas.style."+e+'="'+r+'"'),"fontVariationSettings"===e&&this._handleFontVariationSettings(r),this.textCanvas().style[e]=r,this.textCanvas().style[e]},xs.prototype._handleFontVariationSettings=function(e,t=!1){"object"==typeof e&&(e=Object.keys(e).map((t=>t+" "+e[t])).join(", ")),e.split(r).forEach((e=>{e=e.replace(/["']/g,"");let i=a.exec(e);if(i&&i.length){let r=i[0],s=parseFloat(parseFloat(e.replace(r,"").trim()).toFixed(3));switch(r){case"wght":return t&&console.log("setting font-weight="+s),this.states.fontWeight!==s&&this.textWeight(s),s;case"wdth":break;case"ital":t&&console.log("setting font-style="+(s?"italic":"normal"));break;case"slnt":t&&console.log("setting font-style="+(s?"oblique":"normal"));break;case"opsz":t&&console.log("setting font-optical-size="+s)}}}))},xs.prototype._setContextProperty=function(e,t,i=!1){if(this.textDrawingContext()[e]===t)return this._pInst;(c??=[]).push([e,t]),i&&console.log("queued context2d."+e+'="'+t+'"')},xs.prototype._handleRectMode=function(e,i,r,s){let n=this.states.rectMode;if(void 0!==r)switch(n){case t.RADIUS:e-=(r*=2)/2,void 0!==s&&(i-=(s*=2)/2);break;case t.CENTER:e-=r/2,void 0!==s&&(i-=s/2);break;case t.CORNERS:r-=e,void 0!==s&&(s-=i)}return{x:e,y:i,width:r,height:s}},xs.prototype._fontSizePx=function(e,{family:t}=this.states.textFont){if(i=e,!isNaN(i)&&""!==i.trim())return parseFloat(e);var i;let r=this._cachedDiv({fontSize:e});r.style.fontSize=e,r.style.fontFamily=t;let s=getComputedStyle(r).fontSize,n=parseFloat(s);if("number"!=typeof n)throw Error("textSize: invalid font-size");return n},xs.prototype._cachedDiv=function(e){if(void 0===p){let t=document.createElement("div");t.ariaHidden="true",t.style.display="none",Object.entries(e).forEach((([e,i])=>{t.style[e]=i})),this.textCanvas().appendChild(t),p=t}return p},xs.prototype._aggregateBounds=function(e){let t=Math.min(...e.map((e=>e.x))),i=Math.min(...e.map((e=>e.y))),r=Math.max(...e.map((e=>e.y+e.h))),s=Math.max(...e.map((e=>e.x+e.w)));return{x:t,y:i,w:s-t,h:r-i}},xs.prototype._processLines=function(e,i,r){if(void 0!==i){this.textDrawingContext().textBaseline===t.BASELINE&&(this.drawingContext.textBaseline=t.TOP)}let s=this._splitOnBreaks(e.toString()),n=s.length>1,a=void 0!==i,o=a&&s.some((e=>this._textWidthSingle(e)>i)),{textLeading:h,textWrap:u}=this.states;if((n||o)&&a&&(s=this._lineate(u,s,i)),a&&void 0!==r){if(void 0===h)throw Error("leading is required if height is specified");for(let e=0;e<s.length;e++){if(h*(e+1)>r){s=s.slice(0,e);break}}}return s},xs.prototype._xAlignOffset=function(e,i){switch(e){case t.LEFT:return 0;case t.CENTER:return i/2;case t.RIGHT:return i;case eo:return 0;case to:throw new Error("textBounds: END not yet supported for textAlign");default:return 0}},xs.prototype._rectModeAlign=function(e,i,r){if(void 0!==i){switch(this.states.rectMode){case t.CENTER:e.x-=(i-e.w)/2,e.y-=(r-e.h)/2;break;case t.CORNERS:e.w+=e.x,e.h+=e.y;break;case t.RADIUS:e.x-=(i-e.w)/2,e.y-=(r-e.h)/2,e.w/=2,e.h/=2}return e}},xs.prototype._rectModeAlignRevert=function(e,i,r){if(void 0!==i){switch(this.states.rectMode){case t.CENTER:e.x+=(i-e.w)/2,e.y+=(r-e.h)/2;break;case t.CORNERS:e.w-=e.x,e.h-=e.y;break;case t.RADIUS:e.x+=(i-e.w)/2,e.y+=(r-e.h)/2,e.w*=2,e.h*=2}return e}},xs.prototype._textWidthSingle=function(e){let t=this.textDrawingContext().measureText(e),i=t.actualBoundingBoxLeft;return t.actualBoundingBoxRight+i},xs.prototype._fontWidthSingle=function(e){return this.textDrawingContext().measureText(e).width},xs.prototype._textBoundsSingle=function(e,t=0,i=0){let r=this.textDrawingContext().measureText(e),s=r.actualBoundingBoxAscent,n=r.actualBoundingBoxDescent,a=r.actualBoundingBoxLeft;return{x:t-a,y:i-s,w:r.actualBoundingBoxRight+a,h:s+n}},xs.prototype._fontBoundsSingle=function(e,t=0,i=0){let r=this.textDrawingContext().measureText(e),s=r.fontBoundingBoxAscent,n=r.fontBoundingBoxDescent;return{x:t-=this._xAlignOffset(this.states.textAlign,r.width),y:i-s,w:r.width,h:s+n}},xs.prototype._setTextSize=function(e){if("string"==typeof e&&(e=this._fontSizePx(e)),"number"==typeof e){if(this.states.textSize!==e)return this.states.setValue("textSize",e),this.states.leadingSet||this.states.setValue("textLeading",1.275*this.states.textSize),!0}else console.warn("textSize: invalid size: "+e);return!1},xs.prototype._lineate=function(e,i,r=1/0,s={}){let n,a,o,h,u=s.splitChar??(e===t.WORD?" ":""),l=[];for(let e=0;e<i.length;e++){n="",h=i[e].split(u);for(let e=0;e<h.length;e++)a=`${n+h[e]}`+u,o=this._textWidthSingle(a),n.length>0&&o>r?(l.push(n.trim()),n=`${h[e]}`+u):n=a;l.push(n.trim())}return l},xs.prototype._splitOnBreaks=function(e){return e&&0!==e.length?e.replace(n," ").split(i):[""]},xs.prototype._parseFontFamily=function(e){return e.split(r).map((e=>((e=e.trim()).indexOf(" ")>-1&&!s.test(e)&&(e=`"${e}"`),e))).join(", ")},xs.prototype._applyFontString=function(){let{textFont:e,textSize:i,lineHeight:r,fontStyle:s,fontWeight:n,fontVariant:a}=this.states,o=this.textDrawingContext(),h=this._parseFontFamily(e.family),u=s!==t.NORMAL?`${s} `:"",l=n!==t.NORMAL?`${n} `:"",c=`${u}${a!==t.NORMAL?`${a} `:""}${l}${`${i}px`+(r!==t.NORMAL?`/${r} `:" ")}${h}`.trim();if(o.font=c,o.font!==c){if(c!==o.font)return!1}return!0},xs.prototype._applyTextProperties=function(e=!1){this._applyFontString();let t=this.textDrawingContext();t.direction=this.states.direction,t.textAlign=this.states.textAlign,t.textBaseline=this.states.textBaseline;let i=this.states.fontStretch;for(l.includes(i)&&t.fontStretch!==i&&(t.fontStretch=i);c?.length;){let[i,r]=c.shift();e&&console.log('apply context property "'+i+'" = "'+r+'"'),t[i]=r,t[i]!==r&&(console.warn(`Unable to set '${i}' property on context2d. It may not be supported.`),console.log('Expected "'+r+'" but got: "'+t[i]+'"'))}return this._pInst},e.Renderer2D&&(e.Renderer2D.prototype.textCanvas=function(){return this.canvas},e.Renderer2D.prototype.textDrawingContext=function(){return this.drawingContext},e.Renderer2D.prototype._renderText=function(e,t,i,r,s){let n=this.states,a=this.textDrawingContext();i<s||i>=r||(this.push(),n.strokeColor&&n.strokeSet&&a.strokeText(e,t,i),!this._clipping&&n.fillColor&&(n.fillSet||this._setFill("#000000"),a.fillText(e,t,i)),this.pop())},e.Renderer2D.prototype._positionLines=function(e,i,r,s,n){let a,{textLeading:o,textAlign:h}=this.states,u=new Array(n.length),l=void 0===r?0:r,c=void 0===s?0:s;for(let r=0;r<n.length;r++){switch(h){case eo:throw new Error("textBounds: START not yet supported for textAlign");case t.LEFT:a=e;break;case t.CENTER:a=e+l/2;break;case t.RIGHT:a=e+l;break;case to:throw new Error("textBounds: END not yet supported for textAlign")}u[r]={text:n[r],x:a,y:i+r*o}}return this._yAlignOffset(u,c)},e.Renderer2D.prototype._yAlignOffset=function(e,i){if(void 0===i)throw Error("_yAlignOffset: height is required");let{textLeading:r,textBaseline:s}=this.states,n=0,a=i-r*(e.length-1);switch(s){case t.TOP:case t.BASELINE:break;case Za:n=a/2;break;case t.BOTTOM:n=a;break;case Ya:console.warn("textBounds: IDEOGRAPHIC not yet supported for textBaseline");break;case Qa:console.warn("textBounds: HANGING not yet supported for textBaseline")}return e.forEach((e=>e.y+=n)),e}),e.RendererGL){e.RendererGL.prototype.textCanvas=function(){return this._textCanvas||(this._textCanvas=document.createElement("canvas"),this._textCanvas.width=1,this._textCanvas.height=1,this._textCanvas.style.display="none",this.canvas.parentElement.insertBefore(this._textCanvas,this.canvas)),this._textCanvas},e.RendererGL.prototype.textDrawingContext=function(){if(!this._textDrawingContext){const e=this.textCanvas();this._textDrawingContext=e.getContext("2d")}return this._textDrawingContext};const i=e.RendererGL.prototype.remove;e.RendererGL.prototype.remove=function(){this._textCanvas&&this._textCanvas.parentElement.removeChild(this._textCanvas),i.call(this)},e.RendererGL.prototype._positionLines=function(e,i,r,s,n){let{textLeading:a,textAlign:o}=this.states;const h=n.map((e=>this._fontWidthSingle(e)));let u,l=new Array(n.length),c=void 0===r?Math.max(0,...h):r,p=void 0===s?0:s;for(let s=0;s<n.length;s++){switch(o){case eo:throw new Error("textBounds: START not yet supported for textAlign");case t.LEFT:u=e;break;case t.CENTER:u=e+(c-h[s])/2-c/2+(r||0)/2;break;case t.RIGHT:u=e+c-h[s]-c+(r||0);break;case to:throw new Error("textBounds: END not yet supported for textAlign")}l[s]={text:n[s],x:u,y:i+s*a}}return this._yAlignOffset(l,p)},e.RendererGL.prototype._yAlignOffset=function(e,i){if(void 0===i)throw Error("_yAlignOffset: height is required");let{textLeading:r,textBaseline:s,textSize:n}=this.states,a=0,o=e.length,h=n*o+(r-n)*(o-1);switch(s){case t.TOP:a=n;break;case t.BASELINE:break;case Za:a=-h/2+n+(i||0)/2;break;case t.BOTTOM:a=-(h-n)+(i||0);break;default:console.warn(`${s} is not supported in WebGL mode.`)}return a+=this.states.textFont.font?._verticalAlign(n)||0,e.forEach((e=>e.y+=a)),e}}}void 0!==p5&&io(p5,p5.prototype);var ro={};Object.defineProperty(ro,"__esModule",{value:!0});var so=function(){function e(){}return e.parse=function(t){for(var i=new Set,r=0,s=t;r<s.length;r++){var n=s[r];if(!e.REGEXP.test(n))throw new TypeError('"'+n+'" is invalid unicode-range.');var a=n.match(e.REGEXP),o=a[1],h=a[2],u=a[3];if(o){if(/\?[^?]+$/.test(o))throw new TypeError('"'+n+'" is invalid unicode-range.');if(o.includes("?"))for(var l=o.replace(/\?/g,"0"),c=o.replace(/\?/g,"F"),p=0,d=e.parse(["U+"+l+"-"+c]);p<d.length;p++){var f=d[p];i.add(f)}else i.add(parseInt(o,16))}if(h&&u){var g=parseInt(h,16),m=parseInt(u,16);for(f=g;f<=m;f++)i.add(f)}}return Array.from(i).sort((function(e,t){return e-t}))},e.stringify=function(t){for(var i,r=Array.from(new Set(t)).sort((function(e,t){return e-t})),s=[],n=0;n<r.length;n++){var a=r[n],o=r[n-1];i&&a-o!=1&&(s.push(e.rangeString(i,o)),i=a),i||(i=a),n===r.length-1&&(i===a?s.push(e.rangeString(a)):s.push(e.rangeString(i,a)))}return s},e.rangeString=function(e,t){return t&&e!==t?"U+"+e.toString(16)+"-"+t.toString(16):"U+"+e.toString(16)},e.REGEXP=/^u\+(?:([0-9a-f]?[0-9a-f?]{1,5})|([0-9a-f]{1,6})-([0-9a-f]{1,6}))?$/i,e}(),no=ro.UnicodeRange=so;const ao=[{category:"control character",hexrange:["0000","001f"]},{category:"basic latin",hexrange:["0000","007f"]},{category:"latin-1 supplement",hexrange:["0080","00ff"]},{category:"latin extended-a",hexrange:["0100","017f"]},{category:"latin extended-b",hexrange:["0180","024f"]},{category:"ipa extensions",hexrange:["0250","02af"]},{category:"spacing modifier letters",hexrange:["02b0","02ff"]},{category:"combining diacritical marks",hexrange:["0300","036f"]},{category:"greek and coptic",hexrange:["0370","03ff"]},{category:"cyrillic",hexrange:["0400","04ff"]},{category:"cyrillic supplement",hexrange:["0500","052f"]},{category:"armenian",hexrange:["0530","058f"]},{category:"hebrew",hexrange:["0590","05ff"]},{category:"arabic",hexrange:["0600","06ff"]},{category:"syriac",hexrange:["0700","074f"]},{category:"arabic supplement",hexrange:["0750","077f"]},{category:"thaana",hexrange:["0780","07bf"]},{category:"nko",hexrange:["07c0","07ff"]},{category:"samaritan",hexrange:["0800","083f"]},{category:"mandaic",hexrange:["0840","085f"]},{category:"syriac supplement",hexrange:["0860","086f"]},{category:"arabic extended-b",hexrange:["0870","089f"]},{category:"arabic extended-a",hexrange:["08a0","08ff"]},{category:"devanagari",hexrange:["0900","097f"]},{category:"bengali",hexrange:["0980","09ff"]},{category:"gurmukhi",hexrange:["0a00","0a7f"]},{category:"gujarati",hexrange:["0a80","0aff"]},{category:"oriya",hexrange:["0b00","0b7f"]},{category:"tamil",hexrange:["0b80","0bff"]},{category:"telugu",hexrange:["0c00","0c7f"]},{category:"kannada",hexrange:["0c80","0cff"]},{category:"malayalam",hexrange:["0d00","0d7f"]},{category:"sinhala",hexrange:["0d80","0dff"]},{category:"thai",hexrange:["0e00","0e7f"]},{category:"lao",hexrange:["0e80","0eff"]},{category:"tibetan",hexrange:["0f00","0fff"]},{category:"myanmar",hexrange:["1000","109f"]},{category:"georgian",hexrange:["10a0","10ff"]},{category:"hangul jamo",hexrange:["1100","11ff"]},{category:"ethiopic",hexrange:["1200","137f"]},{category:"ethiopic supplement",hexrange:["1380","139f"]},{category:"cherokee",hexrange:["13a0","13ff"]},{category:"unified canadian aboriginal syllabics",hexrange:["1400","167f"]},{category:"ogham",hexrange:["1680","169f"]},{category:"runic",hexrange:["16a0","16ff"]},{category:"tagalog",hexrange:["1700","171f"]},{category:"hanunoo",hexrange:["1720","173f"]},{category:"buhid",hexrange:["1740","175f"]},{category:"tagbanwa",hexrange:["1760","177f"]},{category:"khmer",hexrange:["1780","17ff"]},{category:"mongolian",hexrange:["1800","18af"]},{category:"unified canadian aboriginal syllabics extended",hexrange:["18b0","18ff"]},{category:"limbu",hexrange:["1900","194f"]},{category:"tai le",hexrange:["1950","197f"]},{category:"new tai lue",hexrange:["1980","19df"]},{category:"khmer symbols",hexrange:["19e0","19ff"]},{category:"buginese",hexrange:["1a00","1a1f"]},{category:"tai tham",hexrange:["1a20","1aaf"]},{category:"combining diacritical marks extended",hexrange:["1ab0","1aff"]},{category:"balinese",hexrange:["1b00","1b7f"]},{category:"sundanese",hexrange:["1b80","1bbf"]},{category:"batak",hexrange:["1bc0","1bff"]},{category:"lepcha",hexrange:["1c00","1c4f"]},{category:"ol chiki",hexrange:["1c50","1c7f"]},{category:"cyrillic extended-c",hexrange:["1c80","1c8f"]},{category:"georgian extended",hexrange:["1c90","1cbf"]},{category:"sundanese supplement",hexrange:["1cc0","1ccf"]},{category:"vedic extensions",hexrange:["1cd0","1cff"]},{category:"phonetic extensions",hexrange:["1d00","1d7f"]},{category:"phonetic extensions supplement",hexrange:["1d80","1dbf"]},{category:"combining diacritical marks supplement",hexrange:["1dc0","1dff"]},{category:"latin extended additional",hexrange:["1e00","1eff"]},{category:"greek extended",hexrange:["1f00","1fff"]},{category:"general punctuation",hexrange:["2000","206f"]},{category:"superscripts and subscripts",hexrange:["2070","209f"]},{category:"currency symbols",hexrange:["20a0","20cf"]},{category:"combining diacritical marks for symbols",hexrange:["20d0","20ff"]},{category:"letterlike symbols",hexrange:["2100","214f"]},{category:"number forms",hexrange:["2150","218f"]},{category:"arrows",hexrange:["2190","21ff"]},{category:"mathematical operators",hexrange:["2200","22ff"]},{category:"miscellaneous technical",hexrange:["2300","23ff"]},{category:"control pictures",hexrange:["2400","243f"]},{category:"optical character recognition",hexrange:["2440","245f"]},{category:"enclosed alphanumerics",hexrange:["2460","24ff"]},{category:"box drawing",hexrange:["2500","257f"]},{category:"block elements",hexrange:["2580","259f"]},{category:"geometric shapes",hexrange:["25a0","25ff"]},{category:"miscellaneous symbols",hexrange:["2600","26ff"]},{category:"dingbats",hexrange:["2700","27bf"]},{category:"miscellaneous mathematical symbols-a",hexrange:["27c0","27ef"]},{category:"supplemental arrows-a",hexrange:["27f0","27ff"]},{category:"braille patterns",hexrange:["2800","28ff"]},{category:"supplemental arrows-b",hexrange:["2900","297f"]},{category:"miscellaneous mathematical symbols-b",hexrange:["2980","29ff"]},{category:"supplemental mathematical operators",hexrange:["2a00","2aff"]},{category:"miscellaneous symbols and arrows",hexrange:["2b00","2bff"]},{category:"glagolitic",hexrange:["2c00","2c5f"]},{category:"latin extended-c",hexrange:["2c60","2c7f"]},{category:"coptic",hexrange:["2c80","2cff"]},{category:"georgian supplement",hexrange:["2d00","2d2f"]},{category:"tifinagh",hexrange:["2d30","2d7f"]},{category:"ethiopic extended",hexrange:["2d80","2ddf"]},{category:"cyrillic extended-a",hexrange:["2de0","2dff"]},{category:"supplemental punctuation",hexrange:["2e00","2e7f"]},{category:"cjk radicals supplement",hexrange:["2e80","2eff"]},{category:"kangxi radicals",hexrange:["2f00","2fdf"]},{category:"ideographic description characters",hexrange:["2ff0","2fff"]},{category:"cjk symbols and punctuation",hexrange:["3000","303f"]},{category:"hiragana",hexrange:["3040","309f"]},{category:"katakana",hexrange:["30a0","30ff"]},{category:"bopomofo",hexrange:["3100","312f"]},{category:"hangul compatibility jamo",hexrange:["3130","318f"]},{category:"kanbun",hexrange:["3190","319f"]},{category:"bopomofo extended",hexrange:["31a0","31bf"]},{category:"cjk strokes",hexrange:["31c0","31ef"]},{category:"katakana phonetic extensions",hexrange:["31f0","31ff"]},{category:"enclosed cjk letters and months",hexrange:["3200","32ff"]},{category:"cjk compatibility",hexrange:["3300","33ff"]},{category:"cjk unified ideographs extension a",hexrange:["3400","4dbf"]},{category:"yijing hexagram symbols",hexrange:["4dc0","4dff"]},{category:"cjk unified ideographs",hexrange:["4e00","9fff"]},{category:"yi syllables",hexrange:["a000","a48f"]},{category:"yi radicals",hexrange:["a490","a4cf"]},{category:"lisu",hexrange:["a4d0","a4ff"]},{category:"vai",hexrange:["a500","a63f"]},{category:"cyrillic extended-b",hexrange:["a640","a69f"]},{category:"bamum",hexrange:["a6a0","a6ff"]},{category:"modifier tone letters",hexrange:["a700","a71f"]},{category:"latin extended-d",hexrange:["a720","a7ff"]},{category:"syloti nagri",hexrange:["a800","a82f"]},{category:"common indic number forms",hexrange:["a830","a83f"]},{category:"phags-pa",hexrange:["a840","a87f"]},{category:"saurashtra",hexrange:["a880","a8df"]},{category:"devanagari extended",hexrange:["a8e0","a8ff"]},{category:"kayah li",hexrange:["a900","a92f"]},{category:"rejang",hexrange:["a930","a95f"]},{category:"hangul jamo extended-a",hexrange:["a960","a97f"]},{category:"javanese",hexrange:["a980","a9df"]},{category:"myanmar extended-b",hexrange:["a9e0","a9ff"]},{category:"cham",hexrange:["aa00","aa5f"]},{category:"myanmar extended-a",hexrange:["aa60","aa7f"]},{category:"tai viet",hexrange:["aa80","aadf"]},{category:"meetei mayek extensions",hexrange:["aae0","aaff"]},{category:"ethiopic extended-a",hexrange:["ab00","ab2f"]},{category:"latin extended-e",hexrange:["ab30","ab6f"]},{category:"cherokee supplement",hexrange:["ab70","abbf"]},{category:"meetei mayek",hexrange:["abc0","abff"]},{category:"hangul syllables",hexrange:["ac00","d7af"]},{category:"hangul jamo extended-b",hexrange:["d7b0","d7ff"]},{category:"high surrogates",hexrange:["d800","db7f"]},{category:"high private use surrogates",hexrange:["db80","dbff"]},{category:"low surrogates",hexrange:["dc00","dfff"]},{category:"private use area",hexrange:["e000","f8ff"]},{category:"cjk compatibility ideographs",hexrange:["f900","faff"]},{category:"alphabetic presentation forms",hexrange:["fb00","fb4f"]},{category:"arabic presentation forms-a",hexrange:["fb50","fdff"]},{category:"variation selectors",hexrange:["fe00","fe0f"]},{category:"vertical forms",hexrange:["fe10","fe1f"]},{category:"combining half marks",hexrange:["fe20","fe2f"]},{category:"cjk compatibility forms",hexrange:["fe30","fe4f"]},{category:"small form variants",hexrange:["fe50","fe6f"]},{category:"arabic presentation forms-b",hexrange:["fe70","feff"]},{category:"halfwidth and fullwidth forms",hexrange:["ff00","ffef"]},{category:"specials",hexrange:["fff0","ffff"]},{category:"linear b syllabary",hexrange:["10000","1007f"]},{category:"linear b ideograms",hexrange:["10080","100ff"]},{category:"aegean numbers",hexrange:["10100","1013f"]},{category:"ancient greek numbers",hexrange:["10140","1018f"]},{category:"ancient symbols",hexrange:["10190","101cf"]},{category:"phaistos disc",hexrange:["101d0","101ff"]},{category:"lycian",hexrange:["10280","1029f"]},{category:"carian",hexrange:["102a0","102df"]},{category:"coptic epact numbers",hexrange:["102e0","102ff"]},{category:"old italic",hexrange:["10300","1032f"]},{category:"gothic",hexrange:["10330","1034f"]},{category:"old permic",hexrange:["10350","1037f"]},{category:"ugaritic",hexrange:["10380","1039f"]},{category:"old persian",hexrange:["103a0","103df"]},{category:"deseret",hexrange:["10400","1044f"]},{category:"shavian",hexrange:["10450","1047f"]},{category:"osmanya",hexrange:["10480","104af"]},{category:"osage",hexrange:["104b0","104ff"]},{category:"elbasan",hexrange:["10500","1052f"]},{category:"caucasian albanian",hexrange:["10530","1056f"]},{category:"vithkuqi",hexrange:["10570","105bf"]},{category:"linear a",hexrange:["10600","1077f"]},{category:"latin extended-f",hexrange:["10780","107bf"]},{category:"cypriot syllabary",hexrange:["10800","1083f"]},{category:"imperial aramaic",hexrange:["10840","1085f"]},{category:"palmyrene",hexrange:["10860","1087f"]},{category:"nabataean",hexrange:["10880","108af"]},{category:"hatran",hexrange:["108e0","108ff"]},{category:"phoenician",hexrange:["10900","1091f"]},{category:"lydian",hexrange:["10920","1093f"]},{category:"meroitic hieroglyphs",hexrange:["10980","1099f"]},{category:"meroitic cursive",hexrange:["109a0","109ff"]},{category:"kharoshthi",hexrange:["10a00","10a5f"]},{category:"old south arabian",hexrange:["10a60","10a7f"]},{category:"old north arabian",hexrange:["10a80","10a9f"]},{category:"manichaean",hexrange:["10ac0","10aff"]},{category:"avestan",hexrange:["10b00","10b3f"]},{category:"inscriptional parthian",hexrange:["10b40","10b5f"]},{category:"inscriptional pahlavi",hexrange:["10b60","10b7f"]},{category:"psalter pahlavi",hexrange:["10b80","10baf"]},{category:"old turkic",hexrange:["10c00","10c4f"]},{category:"old hungarian",hexrange:["10c80","10cff"]},{category:"hanifi rohingya",hexrange:["10d00","10d3f"]},{category:"rumi numeral symbols",hexrange:["10e60","10e7f"]},{category:"yezidi",hexrange:["10e80","10ebf"]},{category:"arabic extended-c",hexrange:["10ec0","10eff"]},{category:"old sogdian",hexrange:["10f00","10f2f"]},{category:"sogdian",hexrange:["10f30","10f6f"]},{category:"old uyghur",hexrange:["10f70","10faf"]},{category:"chorasmian",hexrange:["10fb0","10fdf"]},{category:"elymaic",hexrange:["10fe0","10fff"]},{category:"brahmi",hexrange:["11000","1107f"]},{category:"kaithi",hexrange:["11080","110cf"]},{category:"sora sompeng",hexrange:["110d0","110ff"]},{category:"chakma",hexrange:["11100","1114f"]},{category:"mahajani",hexrange:["11150","1117f"]},{category:"sharada",hexrange:["11180","111df"]},{category:"sinhala archaic numbers",hexrange:["111e0","111ff"]},{category:"khojki",hexrange:["11200","1124f"]},{category:"multani",hexrange:["11280","112af"]},{category:"khudawadi",hexrange:["112b0","112ff"]},{category:"grantha",hexrange:["11300","1137f"]},{category:"newa",hexrange:["11400","1147f"]},{category:"tirhuta",hexrange:["11480","114df"]},{category:"siddham",hexrange:["11580","115ff"]},{category:"modi",hexrange:["11600","1165f"]},{category:"mongolian supplement",hexrange:["11660","1167f"]},{category:"takri",hexrange:["11680","116cf"]},{category:"ahom",hexrange:["11700","1174f"]},{category:"dogra",hexrange:["11800","1184f"]},{category:"warang citi",hexrange:["118a0","118ff"]},{category:"dives akuru",hexrange:["11900","1195f"]},{category:"nandinagari",hexrange:["119a0","119ff"]},{category:"zanabazar square",hexrange:["11a00","11a4f"]},{category:"soyombo",hexrange:["11a50","11aaf"]},{category:"unified canadian aboriginal syllabics extended-a",hexrange:["11ab0","11abf"]},{category:"pau cin hau",hexrange:["11ac0","11aff"]},{category:"devanagari extended-a",hexrange:["11b00","11b5f"]},{category:"bhaiksuki",hexrange:["11c00","11c6f"]},{category:"marchen",hexrange:["11c70","11cbf"]},{category:"masaram gondi",hexrange:["11d00","11d5f"]},{category:"gunjala gondi",hexrange:["11d60","11daf"]},{category:"makasar",hexrange:["11ee0","11eff"]},{category:"kawi",hexrange:["11f00","11f5f"]},{category:"lisu supplement",hexrange:["11fb0","11fbf"]},{category:"tamil supplement",hexrange:["11fc0","11fff"]},{category:"cuneiform",hexrange:["12000","123ff"]},{category:"cuneiform numbers and punctuation",hexrange:["12400","1247f"]},{category:"early dynastic cuneiform",hexrange:["12480","1254f"]},{category:"cypro-minoan",hexrange:["12f90","12fff"]},{category:"egyptian hieroglyphs",hexrange:["13000","1342f"]},{category:"egyptian hieroglyph format controls",hexrange:["13430","1345f"]},{category:"anatolian hieroglyphs",hexrange:["14400","1467f"]},{category:"bamum supplement",hexrange:["16800","16a3f"]},{category:"mro",hexrange:["16a40","16a6f"]},{category:"tangsa",hexrange:["16a70","16acf"]},{category:"bassa vah",hexrange:["16ad0","16aff"]},{category:"pahawh hmong",hexrange:["16b00","16b8f"]},{category:"medefaidrin",hexrange:["16e40","16e9f"]},{category:"miao",hexrange:["16f00","16f9f"]},{category:"ideographic symbols and punctuation",hexrange:["16fe0","16fff"]},{category:"tangut",hexrange:["17000","187ff"]},{category:"tangut components",hexrange:["18800","18aff"]},{category:"khitan small script",hexrange:["18b00","18cff"]},{category:"tangut supplement",hexrange:["18d00","18d7f"]},{category:"kana extended-b",hexrange:["1aff0","1afff"]},{category:"kana supplement",hexrange:["1b000","1b0ff"]},{category:"kana extended-a",hexrange:["1b100","1b12f"]},{category:"small kana extension",hexrange:["1b130","1b16f"]},{category:"nushu",hexrange:["1b170","1b2ff"]},{category:"duployan",hexrange:["1bc00","1bc9f"]},{category:"shorthand format controls",hexrange:["1bca0","1bcaf"]},{category:"znamenny musical notation",hexrange:["1cf00","1cfcf"]},{category:"byzantine musical symbols",hexrange:["1d000","1d0ff"]},{category:"musical symbols",hexrange:["1d100","1d1ff"]},{category:"ancient greek musical notation",hexrange:["1d200","1d24f"]},{category:"kaktovik numerals",hexrange:["1d2c0","1d2df"]},{category:"mayan numerals",hexrange:["1d2e0","1d2ff"]},{category:"tai xuan jing symbols",hexrange:["1d300","1d35f"]},{category:"counting rod numerals",hexrange:["1d360","1d37f"]},{category:"mathematical alphanumeric symbols",hexrange:["1d400","1d7ff"]},{category:"sutton signwriting",hexrange:["1d800","1daaf"]},{category:"latin extended-g",hexrange:["1df00","1dfff"]},{category:"glagolitic supplement",hexrange:["1e000","1e02f"]},{category:"cyrillic extended-d",hexrange:["1e030","1e08f"]},{category:"nyiakeng puachue hmong",hexrange:["1e100","1e14f"]},{category:"toto",hexrange:["1e290","1e2bf"]},{category:"wancho",hexrange:["1e2c0","1e2ff"]},{category:"nag mundari",hexrange:["1e4d0","1e4ff"]},{category:"ethiopic extended-b",hexrange:["1e7e0","1e7ff"]},{category:"mende kikakui",hexrange:["1e800","1e8df"]},{category:"adlam",hexrange:["1e900","1e95f"]},{category:"indic siyaq numbers",hexrange:["1ec70","1ecbf"]},{category:"ottoman siyaq numbers",hexrange:["1ed00","1ed4f"]},{category:"arabic mathematical alphabetic symbols",hexrange:["1ee00","1eeff"]},{category:"mahjong tiles",hexrange:["1f000","1f02f"]},{category:"domino tiles",hexrange:["1f030","1f09f"]},{category:"playing cards",hexrange:["1f0a0","1f0ff"]},{category:"enclosed alphanumeric supplement",hexrange:["1f100","1f1ff"]},{category:"enclosed ideographic supplement",hexrange:["1f200","1f2ff"]},{category:"miscellaneous symbols and pictographs",hexrange:["1f300","1f5ff"]},{category:"emoticons (emoji)",hexrange:["1f600","1f64f"]},{category:"ornamental dingbats",hexrange:["1f650","1f67f"]},{category:"transport and map symbols",hexrange:["1f680","1f6ff"]},{category:"alchemical symbols",hexrange:["1f700","1f77f"]},{category:"geometric shapes extended",hexrange:["1f780","1f7ff"]},{category:"supplemental arrows-c",hexrange:["1f800","1f8ff"]},{category:"supplemental symbols and pictographs",hexrange:["1f900","1f9ff"]},{category:"chess symbols",hexrange:["1fa00","1fa6f"]},{category:"symbols and pictographs extended-a",hexrange:["1fa70","1faff"]},{category:"symbols for legacy computing",hexrange:["1fb00","1fbff"]},{category:"cjk unified ideographs extension b",hexrange:["20000","2a6df"]},{category:"cjk unified ideographs extension c",hexrange:["2a700","2b73f"]},{category:"cjk unified ideographs extension d",hexrange:["2b740","2b81f"]},{category:"cjk unified ideographs extension e",hexrange:["2b820","2ceaf"]},{category:"cjk unified ideographs extension f",hexrange:["2ceb0","2ebef"]},{category:"cjk unified ideographs extension i",hexrange:["2ebf0","2ee5f"]},{category:"cjk compatibility ideographs supplement",hexrange:["2f800","2fa1f"]},{category:"cjk unified ideographs extension g",hexrange:["30000","3134f"]},{category:"cjk unified ideographs extension h",hexrange:["31350","323af"]},{category:"tags",hexrange:["e0000","e007f"]},{category:"variation selectors supplement",hexrange:["e0100","e01ef"]},{category:"supplementary private use area-a",hexrange:["f0000","fffff"]},{category:"supplementary private use area-b",hexrange:["100000","10ffff"]}];function oo(e){let t=e.length;for(;--t>=0;)e[t]=0}oo(new Array(576));oo(new Array(60));oo(new Array(512));oo(new Array(256));oo(new Array(29));oo(new Array(30));var ho=(e,t,i,r)=>{let s=65535&e,n=e>>>16&65535,a=0;for(;0!==i;){a=i>2e3?2e3:i,i-=a;do{s=s+t[r++]|0,n=n+s|0}while(--a);s%=65521,n%=65521}return s|n<<16};const uo=new Uint32Array((()=>{let e,t=[];for(var i=0;i<256;i++){e=i;for(var r=0;r<8;r++)e=1&e?3988292384^e>>>1:e>>>1;t[i]=e}return t})());var lo=(e,t,i,r)=>{const s=uo,n=r+i;e^=-1;for(let i=r;i<n;i++)e=e>>>8^s[255&(e^t[i])];return~e},co={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"},po={Z_NO_FLUSH:0,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_MEM_ERROR:-4,Z_BUF_ERROR:-5,Z_DEFLATED:8};const fo=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);var go=function(e){const t=Array.prototype.slice.call(arguments,1);for(;t.length;){const i=t.shift();if(i){if("object"!=typeof i)throw new TypeError(i+"must be non-object");for(const t in i)fo(i,t)&&(e[t]=i[t])}}return e},mo=e=>{let t=0;for(let i=0,r=e.length;i<r;i++)t+=e[i].length;const i=new Uint8Array(t);for(let t=0,r=0,s=e.length;t<s;t++){let s=e[t];i.set(s,r),r+=s.length}return i};let yo=!0;try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(e){yo=!1}const xo=new Uint8Array(256);for(let e=0;e<256;e++)xo[e]=e>=252?6:e>=248?5:e>=240?4:e>=224?3:e>=192?2:1;xo[254]=xo[254]=1;var vo=e=>{if("function"==typeof TextEncoder&&TextEncoder.prototype.encode)return(new TextEncoder).encode(e);let t,i,r,s,n,a=e.length,o=0;for(s=0;s<a;s++)i=e.charCodeAt(s),55296==(64512&i)&&s+1<a&&(r=e.charCodeAt(s+1),56320==(64512&r)&&(i=65536+(i-55296<<10)+(r-56320),s++)),o+=i<128?1:i<2048?2:i<65536?3:4;for(t=new Uint8Array(o),n=0,s=0;n<o;s++)i=e.charCodeAt(s),55296==(64512&i)&&s+1<a&&(r=e.charCodeAt(s+1),56320==(64512&r)&&(i=65536+(i-55296<<10)+(r-56320),s++)),i<128?t[n++]=i:i<2048?(t[n++]=192|i>>>6,t[n++]=128|63&i):i<65536?(t[n++]=224|i>>>12,t[n++]=128|i>>>6&63,t[n++]=128|63&i):(t[n++]=240|i>>>18,t[n++]=128|i>>>12&63,t[n++]=128|i>>>6&63,t[n++]=128|63&i);return t},bo=(e,t)=>{const i=t||e.length;if("function"==typeof TextDecoder&&TextDecoder.prototype.decode)return(new TextDecoder).decode(e.subarray(0,t));let r,s;const n=new Array(2*i);for(s=0,r=0;r<i;){let t=e[r++];if(t<128){n[s++]=t;continue}let a=xo[t];if(a>4)n[s++]=65533,r+=a-1;else{for(t&=2===a?31:3===a?15:7;a>1&&r<i;)t=t<<6|63&e[r++],a--;a>1?n[s++]=65533:t<65536?n[s++]=t:(t-=65536,n[s++]=55296|t>>10&1023,n[s++]=56320|1023&t)}}return((e,t)=>{if(t<65534&&e.subarray&&yo)return String.fromCharCode.apply(null,e.length===t?e:e.subarray(0,t));let i="";for(let r=0;r<t;r++)i+=String.fromCharCode(e[r]);return i})(n,s)},_o=(e,t)=>{(t=t||e.length)>e.length&&(t=e.length);let i=t-1;for(;i>=0&&128==(192&e[i]);)i--;return i<0||0===i?t:i+xo[e[i]]>t?i:t};var wo=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0};const Co=16209;var Do=function(e,t){let i,r,s,n,a,o,h,u,l,c,p,d,f,g,m,y,x,v,b,_,w,C,D,E;const A=e.state;i=e.next_in,D=e.input,r=i+(e.avail_in-5),s=e.next_out,E=e.output,n=s-(t-e.avail_out),a=s+(e.avail_out-257),o=A.dmax,h=A.wsize,u=A.whave,l=A.wnext,c=A.window,p=A.hold,d=A.bits,f=A.lencode,g=A.distcode,m=(1<<A.lenbits)-1,y=(1<<A.distbits)-1;e:do{d<15&&(p+=D[i++]<<d,d+=8,p+=D[i++]<<d,d+=8),x=f[p&m];t:for(;;){if(v=x>>>24,p>>>=v,d-=v,v=x>>>16&255,0===v)E[s++]=65535&x;else{if(!(16&v)){if(64&v){if(32&v){A.mode=16191;break e}e.msg="invalid literal/length code",A.mode=Co;break e}x=f[(65535&x)+(p&(1<<v)-1)];continue t}for(b=65535&x,v&=15,v&&(d<v&&(p+=D[i++]<<d,d+=8),b+=p&(1<<v)-1,p>>>=v,d-=v),d<15&&(p+=D[i++]<<d,d+=8,p+=D[i++]<<d,d+=8),x=g[p&y];;){if(v=x>>>24,p>>>=v,d-=v,v=x>>>16&255,16&v){if(_=65535&x,v&=15,d<v&&(p+=D[i++]<<d,d+=8,d<v&&(p+=D[i++]<<d,d+=8)),_+=p&(1<<v)-1,_>o){e.msg="invalid distance too far back",A.mode=Co;break e}if(p>>>=v,d-=v,v=s-n,_>v){if(v=_-v,v>u&&A.sane){e.msg="invalid distance too far back",A.mode=Co;break e}if(w=0,C=c,0===l){if(w+=h-v,v<b){b-=v;do{E[s++]=c[w++]}while(--v);w=s-_,C=E}}else if(l<v){if(w+=h+l-v,v-=l,v<b){b-=v;do{E[s++]=c[w++]}while(--v);if(w=0,l<b){v=l,b-=v;do{E[s++]=c[w++]}while(--v);w=s-_,C=E}}}else if(w+=l-v,v<b){b-=v;do{E[s++]=c[w++]}while(--v);w=s-_,C=E}for(;b>2;)E[s++]=C[w++],E[s++]=C[w++],E[s++]=C[w++],b-=3;b&&(E[s++]=C[w++],b>1&&(E[s++]=C[w++]))}else{w=s-_;do{E[s++]=E[w++],E[s++]=E[w++],E[s++]=E[w++],b-=3}while(b>2);b&&(E[s++]=E[w++],b>1&&(E[s++]=E[w++]))}break}if(64&v){e.msg="invalid distance code",A.mode=Co;break e}x=g[(65535&x)+(p&(1<<v)-1)]}}break}}while(i<r&&s<a);b=d>>3,i-=b,d-=b<<3,p&=(1<<d)-1,e.next_in=i,e.next_out=s,e.avail_in=i<r?r-i+5:5-(i-r),e.avail_out=s<a?a-s+257:257-(s-a),A.hold=p,A.bits=d};const Eo=15,Ao=new Uint16Array([3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0]),So=new Uint8Array([16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78]),Fo=new Uint16Array([1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0]),To=new Uint8Array([16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64]);var Mo=(e,t,i,r,s,n,a,o)=>{const h=o.bits;let u,l,c,p,d,f,g=0,m=0,y=0,x=0,v=0,b=0,_=0,w=0,C=0,D=0,E=null;const A=new Uint16Array(16),S=new Uint16Array(16);let F,T,M,k=null;for(g=0;g<=Eo;g++)A[g]=0;for(m=0;m<r;m++)A[t[i+m]]++;for(v=h,x=Eo;x>=1&&0===A[x];x--);if(v>x&&(v=x),0===x)return s[n++]=20971520,s[n++]=20971520,o.bits=1,0;for(y=1;y<x&&0===A[y];y++);for(v<y&&(v=y),w=1,g=1;g<=Eo;g++)if(w<<=1,w-=A[g],w<0)return-1;if(w>0&&(0===e||1!==x))return-1;for(S[1]=0,g=1;g<Eo;g++)S[g+1]=S[g]+A[g];for(m=0;m<r;m++)0!==t[i+m]&&(a[S[t[i+m]]++]=m);if(0===e?(E=k=a,f=20):1===e?(E=Ao,k=So,f=257):(E=Fo,k=To,f=0),D=0,m=0,g=y,d=n,b=v,_=0,c=-1,C=1<<v,p=C-1,1===e&&C>852||2===e&&C>592)return 1;for(;;){F=g-_,a[m]+1<f?(T=0,M=a[m]):a[m]>=f?(T=k[a[m]-f],M=E[a[m]-f]):(T=96,M=0),u=1<<g-_,l=1<<b,y=l;do{l-=u,s[d+(D>>_)+l]=F<<24|T<<16|M}while(0!==l);for(u=1<<g-1;D&u;)u>>=1;if(0!==u?(D&=u-1,D+=u):D=0,m++,0==--A[g]){if(g===x)break;g=t[i+a[m]]}if(g>v&&(D&p)!==c){for(0===_&&(_=v),d+=y,b=g-_,w=1<<b;b+_<x&&(w-=A[b+_],!(w<=0));)b++,w<<=1;if(C+=1<<b,1===e&&C>852||2===e&&C>592)return 1;c=D&p,s[c]=v<<24|b<<16|d-n}}return 0!==D&&(s[d+D]=g-_<<24|64<<16),o.bits=v,0};const{Z_FINISH:ko,Z_BLOCK:Io,Z_TREES:Bo,Z_OK:Lo,Z_STREAM_END:Po,Z_NEED_DICT:Oo,Z_STREAM_ERROR:No,Z_DATA_ERROR:Ro,Z_MEM_ERROR:Vo,Z_BUF_ERROR:Uo,Z_DEFLATED:Go}=po,zo=16180,jo=16190,$o=16191,Wo=16192,qo=16194,Ho=16199,Xo=16200,Yo=16206,Zo=16209,Ko=e=>(e>>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24);function Jo(){this.strm=null,this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new Uint16Array(320),this.work=new Uint16Array(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}const Qo=e=>{if(!e)return 1;const t=e.state;return!t||t.strm!==e||t.mode<zo||t.mode>16211?1:0},eh=e=>{if(Qo(e))return No;const t=e.state;return e.total_in=e.total_out=t.total=0,e.msg="",t.wrap&&(e.adler=1&t.wrap),t.mode=zo,t.last=0,t.havedict=0,t.flags=-1,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new Int32Array(852),t.distcode=t.distdyn=new Int32Array(592),t.sane=1,t.back=-1,Lo},th=e=>{if(Qo(e))return No;const t=e.state;return t.wsize=0,t.whave=0,t.wnext=0,eh(e)},ih=(e,t)=>{let i;if(Qo(e))return No;const r=e.state;return t<0?(i=0,t=-t):(i=5+(t>>4),t<48&&(t&=15)),t&&(t<8||t>15)?No:(null!==r.window&&r.wbits!==t&&(r.window=null),r.wrap=i,r.wbits=t,th(e))},rh=(e,t)=>{if(!e)return No;const i=new Jo;e.state=i,i.strm=e,i.window=null,i.mode=zo;const r=ih(e,t);return r!==Lo&&(e.state=null),r};let sh,nh,ah=!0;const oh=e=>{if(ah){sh=new Int32Array(512),nh=new Int32Array(32);let t=0;for(;t<144;)e.lens[t++]=8;for(;t<256;)e.lens[t++]=9;for(;t<280;)e.lens[t++]=7;for(;t<288;)e.lens[t++]=8;for(Mo(1,e.lens,0,288,sh,0,e.work,{bits:9}),t=0;t<32;)e.lens[t++]=5;Mo(2,e.lens,0,32,nh,0,e.work,{bits:5}),ah=!1}e.lencode=sh,e.lenbits=9,e.distcode=nh,e.distbits=5},hh=(e,t,i,r)=>{let s;const n=e.state;return null===n.window&&(n.wsize=1<<n.wbits,n.wnext=0,n.whave=0,n.window=new Uint8Array(n.wsize)),r>=n.wsize?(n.window.set(t.subarray(i-n.wsize,i),0),n.wnext=0,n.whave=n.wsize):(s=n.wsize-n.wnext,s>r&&(s=r),n.window.set(t.subarray(i-r,i-r+s),n.wnext),(r-=s)?(n.window.set(t.subarray(i-r,i),0),n.wnext=r,n.whave=n.wsize):(n.wnext+=s,n.wnext===n.wsize&&(n.wnext=0),n.whave<n.wsize&&(n.whave+=s))),0};var uh=(e,t)=>{let i,r,s,n,a,o,h,u,l,c,p,d,f,g,m,y,x,v,b,_,w,C,D=0;const E=new Uint8Array(4);let A,S;const F=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(Qo(e)||!e.output||!e.input&&0!==e.avail_in)return No;i=e.state,i.mode===$o&&(i.mode=Wo),a=e.next_out,s=e.output,h=e.avail_out,n=e.next_in,r=e.input,o=e.avail_in,u=i.hold,l=i.bits,c=o,p=h,C=Lo;e:for(;;)switch(i.mode){case zo:if(0===i.wrap){i.mode=Wo;break}for(;l<16;){if(0===o)break e;o--,u+=r[n++]<<l,l+=8}if(2&i.wrap&&35615===u){0===i.wbits&&(i.wbits=15),i.check=0,E[0]=255&u,E[1]=u>>>8&255,i.check=lo(i.check,E,2,0),u=0,l=0,i.mode=16181;break}if(i.head&&(i.head.done=!1),!(1&i.wrap)||(((255&u)<<8)+(u>>8))%31){e.msg="incorrect header check",i.mode=Zo;break}if((15&u)!==Go){e.msg="unknown compression method",i.mode=Zo;break}if(u>>>=4,l-=4,w=8+(15&u),0===i.wbits&&(i.wbits=w),w>15||w>i.wbits){e.msg="invalid window size",i.mode=Zo;break}i.dmax=1<<i.wbits,i.flags=0,e.adler=i.check=1,i.mode=512&u?16189:$o,u=0,l=0;break;case 16181:for(;l<16;){if(0===o)break e;o--,u+=r[n++]<<l,l+=8}if(i.flags=u,(255&i.flags)!==Go){e.msg="unknown compression method",i.mode=Zo;break}if(57344&i.flags){e.msg="unknown header flags set",i.mode=Zo;break}i.head&&(i.head.text=u>>8&1),512&i.flags&&4&i.wrap&&(E[0]=255&u,E[1]=u>>>8&255,i.check=lo(i.check,E,2,0)),u=0,l=0,i.mode=16182;case 16182:for(;l<32;){if(0===o)break e;o--,u+=r[n++]<<l,l+=8}i.head&&(i.head.time=u),512&i.flags&&4&i.wrap&&(E[0]=255&u,E[1]=u>>>8&255,E[2]=u>>>16&255,E[3]=u>>>24&255,i.check=lo(i.check,E,4,0)),u=0,l=0,i.mode=16183;case 16183:for(;l<16;){if(0===o)break e;o--,u+=r[n++]<<l,l+=8}i.head&&(i.head.xflags=255&u,i.head.os=u>>8),512&i.flags&&4&i.wrap&&(E[0]=255&u,E[1]=u>>>8&255,i.check=lo(i.check,E,2,0)),u=0,l=0,i.mode=16184;case 16184:if(1024&i.flags){for(;l<16;){if(0===o)break e;o--,u+=r[n++]<<l,l+=8}i.length=u,i.head&&(i.head.extra_len=u),512&i.flags&&4&i.wrap&&(E[0]=255&u,E[1]=u>>>8&255,i.check=lo(i.check,E,2,0)),u=0,l=0}else i.head&&(i.head.extra=null);i.mode=16185;case 16185:if(1024&i.flags&&(d=i.length,d>o&&(d=o),d&&(i.head&&(w=i.head.extra_len-i.length,i.head.extra||(i.head.extra=new Uint8Array(i.head.extra_len)),i.head.extra.set(r.subarray(n,n+d),w)),512&i.flags&&4&i.wrap&&(i.check=lo(i.check,r,d,n)),o-=d,n+=d,i.length-=d),i.length))break e;i.length=0,i.mode=16186;case 16186:if(2048&i.flags){if(0===o)break e;d=0;do{w=r[n+d++],i.head&&w&&i.length<65536&&(i.head.name+=String.fromCharCode(w))}while(w&&d<o);if(512&i.flags&&4&i.wrap&&(i.check=lo(i.check,r,d,n)),o-=d,n+=d,w)break e}else i.head&&(i.head.name=null);i.length=0,i.mode=16187;case 16187:if(4096&i.flags){if(0===o)break e;d=0;do{w=r[n+d++],i.head&&w&&i.length<65536&&(i.head.comment+=String.fromCharCode(w))}while(w&&d<o);if(512&i.flags&&4&i.wrap&&(i.check=lo(i.check,r,d,n)),o-=d,n+=d,w)break e}else i.head&&(i.head.comment=null);i.mode=16188;case 16188:if(512&i.flags){for(;l<16;){if(0===o)break e;o--,u+=r[n++]<<l,l+=8}if(4&i.wrap&&u!==(65535&i.check)){e.msg="header crc mismatch",i.mode=Zo;break}u=0,l=0}i.head&&(i.head.hcrc=i.flags>>9&1,i.head.done=!0),e.adler=i.check=0,i.mode=$o;break;case 16189:for(;l<32;){if(0===o)break e;o--,u+=r[n++]<<l,l+=8}e.adler=i.check=Ko(u),u=0,l=0,i.mode=jo;case jo:if(0===i.havedict)return e.next_out=a,e.avail_out=h,e.next_in=n,e.avail_in=o,i.hold=u,i.bits=l,Oo;e.adler=i.check=1,i.mode=$o;case $o:if(t===Io||t===Bo)break e;case Wo:if(i.last){u>>>=7&l,l-=7&l,i.mode=Yo;break}for(;l<3;){if(0===o)break e;o--,u+=r[n++]<<l,l+=8}switch(i.last=1&u,u>>>=1,l-=1,3&u){case 0:i.mode=16193;break;case 1:if(oh(i),i.mode=Ho,t===Bo){u>>>=2,l-=2;break e}break;case 2:i.mode=16196;break;case 3:e.msg="invalid block type",i.mode=Zo}u>>>=2,l-=2;break;case 16193:for(u>>>=7&l,l-=7&l;l<32;){if(0===o)break e;o--,u+=r[n++]<<l,l+=8}if((65535&u)!=(u>>>16^65535)){e.msg="invalid stored block lengths",i.mode=Zo;break}if(i.length=65535&u,u=0,l=0,i.mode=qo,t===Bo)break e;case qo:i.mode=16195;case 16195:if(d=i.length,d){if(d>o&&(d=o),d>h&&(d=h),0===d)break e;s.set(r.subarray(n,n+d),a),o-=d,n+=d,h-=d,a+=d,i.length-=d;break}i.mode=$o;break;case 16196:for(;l<14;){if(0===o)break e;o--,u+=r[n++]<<l,l+=8}if(i.nlen=257+(31&u),u>>>=5,l-=5,i.ndist=1+(31&u),u>>>=5,l-=5,i.ncode=4+(15&u),u>>>=4,l-=4,i.nlen>286||i.ndist>30){e.msg="too many length or distance symbols",i.mode=Zo;break}i.have=0,i.mode=16197;case 16197:for(;i.have<i.ncode;){for(;l<3;){if(0===o)break e;o--,u+=r[n++]<<l,l+=8}i.lens[F[i.have++]]=7&u,u>>>=3,l-=3}for(;i.have<19;)i.lens[F[i.have++]]=0;if(i.lencode=i.lendyn,i.lenbits=7,A={bits:i.lenbits},C=Mo(0,i.lens,0,19,i.lencode,0,i.work,A),i.lenbits=A.bits,C){e.msg="invalid code lengths set",i.mode=Zo;break}i.have=0,i.mode=16198;case 16198:for(;i.have<i.nlen+i.ndist;){for(;D=i.lencode[u&(1<<i.lenbits)-1],m=D>>>24,y=D>>>16&255,x=65535&D,!(m<=l);){if(0===o)break e;o--,u+=r[n++]<<l,l+=8}if(x<16)u>>>=m,l-=m,i.lens[i.have++]=x;else{if(16===x){for(S=m+2;l<S;){if(0===o)break e;o--,u+=r[n++]<<l,l+=8}if(u>>>=m,l-=m,0===i.have){e.msg="invalid bit length repeat",i.mode=Zo;break}w=i.lens[i.have-1],d=3+(3&u),u>>>=2,l-=2}else if(17===x){for(S=m+3;l<S;){if(0===o)break e;o--,u+=r[n++]<<l,l+=8}u>>>=m,l-=m,w=0,d=3+(7&u),u>>>=3,l-=3}else{for(S=m+7;l<S;){if(0===o)break e;o--,u+=r[n++]<<l,l+=8}u>>>=m,l-=m,w=0,d=11+(127&u),u>>>=7,l-=7}if(i.have+d>i.nlen+i.ndist){e.msg="invalid bit length repeat",i.mode=Zo;break}for(;d--;)i.lens[i.have++]=w}}if(i.mode===Zo)break;if(0===i.lens[256]){e.msg="invalid code -- missing end-of-block",i.mode=Zo;break}if(i.lenbits=9,A={bits:i.lenbits},C=Mo(1,i.lens,0,i.nlen,i.lencode,0,i.work,A),i.lenbits=A.bits,C){e.msg="invalid literal/lengths set",i.mode=Zo;break}if(i.distbits=6,i.distcode=i.distdyn,A={bits:i.distbits},C=Mo(2,i.lens,i.nlen,i.ndist,i.distcode,0,i.work,A),i.distbits=A.bits,C){e.msg="invalid distances set",i.mode=Zo;break}if(i.mode=Ho,t===Bo)break e;case Ho:i.mode=Xo;case Xo:if(o>=6&&h>=258){e.next_out=a,e.avail_out=h,e.next_in=n,e.avail_in=o,i.hold=u,i.bits=l,Do(e,p),a=e.next_out,s=e.output,h=e.avail_out,n=e.next_in,r=e.input,o=e.avail_in,u=i.hold,l=i.bits,i.mode===$o&&(i.back=-1);break}for(i.back=0;D=i.lencode[u&(1<<i.lenbits)-1],m=D>>>24,y=D>>>16&255,x=65535&D,!(m<=l);){if(0===o)break e;o--,u+=r[n++]<<l,l+=8}if(y&&!(240&y)){for(v=m,b=y,_=x;D=i.lencode[_+((u&(1<<v+b)-1)>>v)],m=D>>>24,y=D>>>16&255,x=65535&D,!(v+m<=l);){if(0===o)break e;o--,u+=r[n++]<<l,l+=8}u>>>=v,l-=v,i.back+=v}if(u>>>=m,l-=m,i.back+=m,i.length=x,0===y){i.mode=16205;break}if(32&y){i.back=-1,i.mode=$o;break}if(64&y){e.msg="invalid literal/length code",i.mode=Zo;break}i.extra=15&y,i.mode=16201;case 16201:if(i.extra){for(S=i.extra;l<S;){if(0===o)break e;o--,u+=r[n++]<<l,l+=8}i.length+=u&(1<<i.extra)-1,u>>>=i.extra,l-=i.extra,i.back+=i.extra}i.was=i.length,i.mode=16202;case 16202:for(;D=i.distcode[u&(1<<i.distbits)-1],m=D>>>24,y=D>>>16&255,x=65535&D,!(m<=l);){if(0===o)break e;o--,u+=r[n++]<<l,l+=8}if(!(240&y)){for(v=m,b=y,_=x;D=i.distcode[_+((u&(1<<v+b)-1)>>v)],m=D>>>24,y=D>>>16&255,x=65535&D,!(v+m<=l);){if(0===o)break e;o--,u+=r[n++]<<l,l+=8}u>>>=v,l-=v,i.back+=v}if(u>>>=m,l-=m,i.back+=m,64&y){e.msg="invalid distance code",i.mode=Zo;break}i.offset=x,i.extra=15&y,i.mode=16203;case 16203:if(i.extra){for(S=i.extra;l<S;){if(0===o)break e;o--,u+=r[n++]<<l,l+=8}i.offset+=u&(1<<i.extra)-1,u>>>=i.extra,l-=i.extra,i.back+=i.extra}if(i.offset>i.dmax){e.msg="invalid distance too far back",i.mode=Zo;break}i.mode=16204;case 16204:if(0===h)break e;if(d=p-h,i.offset>d){if(d=i.offset-d,d>i.whave&&i.sane){e.msg="invalid distance too far back",i.mode=Zo;break}d>i.wnext?(d-=i.wnext,f=i.wsize-d):f=i.wnext-d,d>i.length&&(d=i.length),g=i.window}else g=s,f=a-i.offset,d=i.length;d>h&&(d=h),h-=d,i.length-=d;do{s[a++]=g[f++]}while(--d);0===i.length&&(i.mode=Xo);break;case 16205:if(0===h)break e;s[a++]=i.length,h--,i.mode=Xo;break;case Yo:if(i.wrap){for(;l<32;){if(0===o)break e;o--,u|=r[n++]<<l,l+=8}if(p-=h,e.total_out+=p,i.total+=p,4&i.wrap&&p&&(e.adler=i.check=i.flags?lo(i.check,s,p,a-p):ho(i.check,s,p,a-p)),p=h,4&i.wrap&&(i.flags?u:Ko(u))!==i.check){e.msg="incorrect data check",i.mode=Zo;break}u=0,l=0}i.mode=16207;case 16207:if(i.wrap&&i.flags){for(;l<32;){if(0===o)break e;o--,u+=r[n++]<<l,l+=8}if(4&i.wrap&&u!==(4294967295&i.total)){e.msg="incorrect length check",i.mode=Zo;break}u=0,l=0}i.mode=16208;case 16208:C=Po;break e;case Zo:C=Ro;break e;case 16210:return Vo;default:return No}return e.next_out=a,e.avail_out=h,e.next_in=n,e.avail_in=o,i.hold=u,i.bits=l,(i.wsize||p!==e.avail_out&&i.mode<Zo&&(i.mode<Yo||t!==ko))&&hh(e,e.output,e.next_out,p-e.avail_out),c-=e.avail_in,p-=e.avail_out,e.total_in+=c,e.total_out+=p,i.total+=p,4&i.wrap&&p&&(e.adler=i.check=i.flags?lo(i.check,s,p,e.next_out-p):ho(i.check,s,p,e.next_out-p)),e.data_type=i.bits+(i.last?64:0)+(i.mode===$o?128:0)+(i.mode===Ho||i.mode===qo?256:0),(0===c&&0===p||t===ko)&&C===Lo&&(C=Uo),C},lh={inflateReset:th,inflateReset2:ih,inflateResetKeep:eh,inflateInit:e=>rh(e,15),inflateInit2:rh,inflate:uh,inflateEnd:e=>{if(Qo(e))return No;let t=e.state;return t.window&&(t.window=null),e.state=null,Lo},inflateGetHeader:(e,t)=>{if(Qo(e))return No;const i=e.state;return 2&i.wrap?(i.head=t,t.done=!1,Lo):No},inflateSetDictionary:(e,t)=>{const i=t.length;let r,s,n;return Qo(e)?No:(r=e.state,0!==r.wrap&&r.mode!==jo?No:r.mode===jo&&(s=1,s=ho(s,t,i,0),s!==r.check)?Ro:(n=hh(e,t,i,i),n?(r.mode=16210,Vo):(r.havedict=1,Lo)))},inflateInfo:"pako inflate (from Nodeca project)"};var ch=function(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1};const ph=Object.prototype.toString,{Z_NO_FLUSH:dh,Z_FINISH:fh,Z_OK:gh,Z_STREAM_END:mh,Z_NEED_DICT:yh,Z_STREAM_ERROR:xh,Z_DATA_ERROR:vh,Z_MEM_ERROR:bh}=po;function _h(e){this.options=go({chunkSize:65536,windowBits:15,to:""},e||{});const t=this.options;t.raw&&t.windowBits>=0&&t.windowBits<16&&(t.windowBits=-t.windowBits,0===t.windowBits&&(t.windowBits=-15)),!(t.windowBits>=0&&t.windowBits<16)||e&&e.windowBits||(t.windowBits+=32),t.windowBits>15&&t.windowBits<48&&(15&t.windowBits||(t.windowBits|=15)),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new wo,this.strm.avail_out=0;let i=lh.inflateInit2(this.strm,t.windowBits);if(i!==gh)throw new Error(co[i]);if(this.header=new ch,lh.inflateGetHeader(this.strm,this.header),t.dictionary&&("string"==typeof t.dictionary?t.dictionary=vo(t.dictionary):"[object ArrayBuffer]"===ph.call(t.dictionary)&&(t.dictionary=new Uint8Array(t.dictionary)),t.raw&&(i=lh.inflateSetDictionary(this.strm,t.dictionary),i!==gh)))throw new Error(co[i])}_h.prototype.push=function(e,t){const i=this.strm,r=this.options.chunkSize,s=this.options.dictionary;let n,a,o;if(this.ended)return!1;for(a=t===~~t?t:!0===t?fh:dh,"[object ArrayBuffer]"===ph.call(e)?i.input=new Uint8Array(e):i.input=e,i.next_in=0,i.avail_in=i.input.length;;){for(0===i.avail_out&&(i.output=new Uint8Array(r),i.next_out=0,i.avail_out=r),n=lh.inflate(i,a),n===yh&&s&&(n=lh.inflateSetDictionary(i,s),n===gh?n=lh.inflate(i,a):n===vh&&(n=yh));i.avail_in>0&&n===mh&&i.state.wrap>0&&0!==e[i.next_in];)lh.inflateReset(i),n=lh.inflate(i,a);switch(n){case xh:case vh:case yh:case bh:return this.onEnd(n),this.ended=!0,!1}if(o=i.avail_out,i.next_out&&(0===i.avail_out||n===mh))if("string"===this.options.to){let e=_o(i.output,i.next_out),t=i.next_out-e,s=bo(i.output,e);i.next_out=t,i.avail_out=r-t,t&&i.output.set(i.output.subarray(e,e+t),0),this.onData(s)}else this.onData(i.output.length===i.next_out?i.output:i.output.subarray(0,i.next_out));if(n!==gh||0!==o){if(n===mh)return n=lh.inflateEnd(this.strm),this.onEnd(n),this.ended=!0,!0;if(0===i.avail_in)break}}return!0},_h.prototype.onData=function(e){this.chunks.push(e)},_h.prototype.onEnd=function(e){e===gh&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=mo(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};var wh={inflate:function(e,t){const i=new _h(t);if(i.push(e),i.err)throw i.msg||co[i.err];return i.result}};const{inflate:Ch}=wh;const Dh={inflate:Ch};var Eh,Ah={};Ah.parse=function(e){var t=Ah.B,i=function(e,t,i,r){var s=Ah.T,n={cmap:s.cmap,head:s.head,hhea:s.hhea,maxp:s.maxp,hmtx:s.hmtx,name:s.name,"OS/2":s.OS2,post:s.post,loca:s.loca,kern:s.kern,glyf:s.glyf,"CFF ":s.CFF,GSUB:s.GSUB,CBLC:s.CBLC,CBDT:s.CBDT,"SVG ":s.SVG,COLR:s.colr,CPAL:s.cpal,sbix:s.sbix,fvar:s.fvar,gvar:s.gvar,avar:s.avar,HVAR:s.HVAR},a={_data:e,_index:t,_offset:i};for(var o in n){var h=Ah.findTable(e,o,i);if(h){var u=h[0],l=r[u];null==l&&(l=n[o].parseTab(e,u,h[1],a)),a[o]=r[u]=l}}return a};var r=new Uint8Array(e);let s;119==r[0]&&(s=r,r=function(e){var i=t.readUshort(e,12),r=t.readUint(e,16),s=new Uint8Array(r),n=12+16*i;t.writeASCII(s,0,"OTTO"),t.writeUshort(s,4,i);for(var a=44,o=0;o<i;o++){var h=t.readASCII(e,a,4),u=t.readUint(e,a+4),l=t.readUint(e,a+8),c=t.readUint(e,a+12);a+=20;var p=e.slice(u,u+l);l!=c&&(p=Dh.inflate(p));var d=12+16*o;t.writeASCII(s,d,h),t.writeUint(s,d+8,n),t.writeUint(s,d+12,c),s.set(p,n),n+=c}return s}(r));var n={};if("ttcf"==t.readASCII(r,0,4)){var a=4;t.readUshort(r,a),a+=2,t.readUshort(r,a),a+=2;var o=t.readUint(r,a);a+=4;for(var h=[],u=0;u<o;u++){var l=t.readUint(r,a);a+=4,h.push(i(r,u,l,n))}return h}var c=i(r,0,0,n);c._compressedData=s;var p=c.fvar;if(p){var d=[c];for(u=0;u<p[1].length;u++){var f=p[1][u],g={};for(var m in d.push(g),c)g[m]=c[m];g._index=u;var y=g.name=JSON.parse(JSON.stringify(g.name));y.fontSubfamily=f[0],null==f[3]&&(f[3]=(y.fontFamily+"-"+y.fontSubfamily).replaceAll(" ","")),y.postScriptName=f[3]}return d}return[c]},Ah.findTable=function(e,t,i){for(var r=Ah.B,s=r.readUshort(e,i+4),n=i+12,a=0;a<s;a++){var o=r.readASCII(e,n,4);r.readUint(e,n+4);var h=r.readUint(e,n+8),u=r.readUint(e,n+12);if(o==t)return[h,u];n+=16}return null},Ah.T={},Ah.B={readFixed:function(e,t){return(e[t]<<8|e[t+1])+(e[t+2]<<8|e[t+3])/65540},readF2dot14:function(e,t){return Ah.B.readShort(e,t)/16384},readInt:function(e,t){var i=Ah.B.t.uint8;return i[0]=e[t+3],i[1]=e[t+2],i[2]=e[t+1],i[3]=e[t],Ah.B.t.int32[0]},readInt8:function(e,t){return Ah.B.t.uint8[0]=e[t],Ah.B.t.int8[0]},readShort:function(e,t){return Ah.B.t.uint16[0]=e[t]<<8|e[t+1],Ah.B.t.int16[0]},readUshort:function(e,t){return e[t]<<8|e[t+1]},writeUshort:function(e,t,i){e[t]=i>>8&255,e[t+1]=255&i},readUshorts:function(e,t,i){for(var r=[],s=0;s<i;s++){var n=Ah.B.readUshort(e,t+2*s);r.push(n)}return r},readUint:function(e,t){var i=Ah.B.t.uint8;return i[3]=e[t],i[2]=e[t+1],i[1]=e[t+2],i[0]=e[t+3],Ah.B.t.uint32[0]},writeUint:function(e,t,i){e[t]=i>>24&255,e[t+1]=i>>16&255,e[t+2]=i>>8&255,e[t+3]=255&i},readUint64:function(e,t){return 4294967296*Ah.B.readUint(e,t)+Ah.B.readUint(e,t+4)},readASCII:function(e,t,i){for(var r="",s=0;s<i;s++)r+=String.fromCharCode(e[t+s]);return r},writeASCII:function(e,t,i){for(var r=0;r<i.length;r++)e[t+r]=i.charCodeAt(r)},readUnicode:function(e,t,i){for(var r="",s=0;s<i;s++){var n=e[t++]<<8|e[t++];r+=String.fromCharCode(n)}return r},_tdec:window.TextDecoder?new window.TextDecoder:null,readUTF8:function(e,t,i){var r=Ah.B._tdec;return r&&0==t&&i==e.length?r.decode(e):Ah.B.readASCII(e,t,i)},readBytes:function(e,t,i){for(var r=[],s=0;s<i;s++)r.push(e[t+s]);return r},readASCIIArray:function(e,t,i){for(var r=[],s=0;s<i;s++)r.push(String.fromCharCode(e[t+s]));return r},t:(Eh=new ArrayBuffer(8),{buff:Eh,int8:new Int8Array(Eh),uint8:new Uint8Array(Eh),int16:new Int16Array(Eh),uint16:new Uint16Array(Eh),int32:new Int32Array(Eh),uint32:new Uint32Array(Eh)})},Ah.T.CFF={parseTab:function(e,t,i){var r=Ah.B,s=Ah.T.CFF;e=new Uint8Array(e.buffer,t,i),t=0,t++,t++,t++,t++;var n=[];t=s.readIndex(e,t,n);for(var a=[],o=0;o<n.length-1;o++)a.push(r.readASCII(e,t+n[o],n[o+1]-n[o]));t+=n[n.length-1];var h=[];t=s.readIndex(e,t,h);var u=[];for(o=0;o<h.length-1;o++)u.push(s.readDict(e,t+h[o],t+h[o+1]));t+=h[h.length-1];var l=u[0],c=[];t=s.readIndex(e,t,c);var p=[];for(o=0;o<c.length-1;o++)p.push(r.readASCII(e,t+c[o],c[o+1]-c[o]));if(t+=c[c.length-1],s.readSubrs(e,t,l),l.CharStrings&&(l.CharStrings=s.readBytes(e,l.CharStrings)),l.ROS){t=l.FDArray;var d=[];t=s.readIndex(e,t,d),l.FDArray=[];for(o=0;o<d.length-1;o++){var f=s.readDict(e,t+d[o],t+d[o+1]);s._readFDict(e,f,p),l.FDArray.push(f)}t+=d[d.length-1],t=l.FDSelect,l.FDSelect=[];var g=e[t];if(t++,3!=g)throw g;var m=r.readUshort(e,t);t+=2;for(o=0;o<m+1;o++)l.FDSelect.push(r.readUshort(e,t),e[t+2]),t+=3}return l.charset&&(l.charset=s.readCharset(e,l.charset,l.CharStrings.length)),s._readFDict(e,l,p),l},_readFDict:function(e,t,i){var r,s=Ah.T.CFF;for(var n in t.Private&&(r=t.Private[1],t.Private=s.readDict(e,r,r+t.Private[0]),t.Private.Subrs&&s.readSubrs(e,r+t.Private.Subrs,t.Private)),t)-1!=["FamilyName","FontName","FullName","Notice","version","Copyright"].indexOf(n)&&(t[n]=i[t[n]-426+35])},readSubrs:function(e,t,i){i.Subrs=Ah.T.CFF.readBytes(e,t);var r,s=i.Subrs.length+1;r=s<1240?107:s<33900?1131:32768,i.Bias=r},readBytes:function(e,t){var i=[];t=Ah.T.CFF.readIndex(e,t,i);for(var r=[],s=i.length-1,n=e.byteOffset+t,a=0;a<s;a++){var o=i[a];r.push(new Uint8Array(e.buffer,n+o,i[a+1]-o))}return r},tableSE:[0,0,0,0,0,0,0,0,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,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,0,111,112,113,114,0,115,116,117,118,119,120,121,122,0,123,0,124,125,126,127,128,129,130,131,0,132,133,0,134,135,136,137,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,138,0,139,0,0,0,0,140,141,142,143,0,0,0,0,0,144,0,0,0,145,0,0,146,147,148,149,0,0,0,0],glyphByUnicode:function(e,t){for(var i=0;i<e.charset.length;i++)if(e.charset[i]==t)return i;return-1},glyphBySE:function(e,t){return t<0||t>255?-1:Ah.T.CFF.glyphByUnicode(e,Ah.T.CFF.tableSE[t])},readCharset:function(e,t,i){var r=Ah.B,s=[".notdef"],n=e[t];if(t++,0==n)for(var a=0;a<i;a++){var o=r.readUshort(e,t);t+=2,s.push(o)}else{if(1!=n&&2!=n)throw"error: format: "+n;for(;s.length<i;){o=r.readUshort(e,t);t+=2;var h=0;1==n?(h=e[t],t++):(h=r.readUshort(e,t),t+=2);for(a=0;a<=h;a++)s.push(o),o++}}return s},readIndex:function(e,t,i){var r=Ah.B,s=r.readUshort(e,t)+1,n=e[t+=2];if(t++,1==n)for(var a=0;a<s;a++)i.push(e[t+a]);else if(2==n)for(a=0;a<s;a++)i.push(r.readUshort(e,t+2*a));else if(3==n)for(a=0;a<s;a++)i.push(16777215&r.readUint(e,t+3*a-1));else if(4==n)for(a=0;a<s;a++)i.push(r.readUint(e,t+4*a));else if(1!=s)throw"unsupported offset size: "+n+", count: "+s;return(t+=s*n)-1},getCharString:function(e,t,i){var r=Ah.B,s=e[t],n=e[t+1],a=1,o=null,h=null;s<=20&&(o=s,a=1),12==s&&(o=100*s+n,a=2),21<=s&&s<=27&&(o=s,a=1),28==s&&(h=r.readShort(e,t+1),a=3),29<=s&&s<=31&&(o=s,a=1),32<=s&&s<=246&&(h=s-139,a=1),247<=s&&s<=250&&(h=256*(s-247)+n+108,a=2),251<=s&&s<=254&&(h=256*-(s-251)-n-108,a=2),255==s&&(h=r.readInt(e,t+1)/65535,a=5),i.val=null!=h?h:"o"+o,i.size=a},readCharString:function(e,t,i){for(var r=t+i,s=Ah.B,n=[];t<r;){var a=e[t],o=e[t+1],h=1,u=null,l=null;a<=20&&(u=a,h=1),12==a&&(u=100*a+o,h=2),19!=a&&20!=a||(u=a,h=2),21<=a&&a<=27&&(u=a,h=1),28==a&&(l=s.readShort(e,t+1),h=3),29<=a&&a<=31&&(u=a,h=1),32<=a&&a<=246&&(l=a-139,h=1),247<=a&&a<=250&&(l=256*(a-247)+o+108,h=2),251<=a&&a<=254&&(l=256*-(a-251)-o-108,h=2),255==a&&(l=s.readInt(e,t+1)/65535,h=5),n.push(null!=l?l:"o"+u),t+=h}return n},readDict:function(e,t,i){for(var r=Ah.B,s={},n=[];t<i;){var a=e[t],o=e[t+1],h=1,u=null,l=null;if(28==a&&(l=r.readShort(e,t+1),h=3),29==a&&(l=r.readInt(e,t+1),h=5),32<=a&&a<=246&&(l=a-139,h=1),247<=a&&a<=250&&(l=256*(a-247)+o+108,h=2),251<=a&&a<=254&&(l=256*-(a-251)-o-108,h=2),255==a)throw l=r.readInt(e,t+1)/65535,h=5,"unknown number";if(30==a){var c=[];for(h=1;;){var p=e[t+h];h++;var d=p>>4,f=15&p;if(15!=d&&c.push(d),15!=f&&c.push(f),15==f)break}for(var g="",m=[0,1,2,3,4,5,6,7,8,9,".","e","e-","reserved","-","endOfNumber"],y=0;y<c.length;y++)g+=m[c[y]];l=parseFloat(g)}if(a<=21)if(u=["version","Notice","FullName","FamilyName","Weight","FontBBox","BlueValues","OtherBlues","FamilyBlues","FamilyOtherBlues","StdHW","StdVW","escape","UniqueID","XUID","charset","Encoding","CharStrings","Private","Subrs","defaultWidthX","nominalWidthX"][a],h=1,12==a)u=["Copyright","isFixedPitch","ItalicAngle","UnderlinePosition","UnderlineThickness","PaintType","CharstringType","FontMatrix","StrokeWidth","BlueScale","BlueShift","BlueFuzz","StemSnapH","StemSnapV","ForceBold","","","LanguageGroup","ExpansionFactor","initialRandomSeed","SyntheticBase","PostScript","BaseFontName","BaseFontBlend","","","","","","","ROS","CIDFontVersion","CIDFontRevision","CIDFontType","CIDCount","UIDBase","FDArray","FDSelect","FontName"][o],h=2;null!=u?(s[u]=1==n.length?n[0]:n,n=[]):n.push(l),t+=h}return s}},Ah.T.cmap={parseTab:function(e,t,i){var r={tables:[],ids:{},off:t};e=new Uint8Array(e.buffer,t,i),t=0;var s=Ah.B,n=s.readUshort,a=Ah.T.cmap;n(e,t);var o=n(e,t+=2);t+=2;for(var h=[],u=0;u<o;u++){var l=n(e,t),c=n(e,t+=2);t+=2;var p=s.readUint(e,t);t+=4;var d="p"+l+"e"+c,f=h.indexOf(p);if(-1==f){f=r.tables.length;var g={};h.push(p);var m=g.format=n(e,p);0==m?g=a.parse0(e,p,g):4==m?g=a.parse4(e,p,g):6==m?g=a.parse6(e,p,g):12==m&&(g=a.parse12(e,p,g)),r.tables.push(g)}null!=r.ids[d]&&console.log("multiple tables for one platform+encoding: "+d),r.ids[d]=f}return r},parse0:function(e,t,i){var r=Ah.B;t+=2;var s=r.readUshort(e,t);t+=2,r.readUshort(e,t),t+=2,i.map=[];for(var n=0;n<s-6;n++)i.map.push(e[t+n]);return i},parse4:function(e,t,i){var r=Ah.B,s=r.readUshort,n=r.readUshorts,a=t,o=s(e,t+=2);s(e,t+=2);var h=s(e,t+=2);t+=2;var u=h>>>1;i.searchRange=s(e,t),t+=2,i.entrySelector=s(e,t),t+=2,i.rangeShift=s(e,t),t+=2,i.endCount=n(e,t,u),t+=2*u,t+=2,i.startCount=n(e,t,u),t+=2*u,i.idDelta=[];for(var l=0;l<u;l++)i.idDelta.push(r.readShort(e,t)),t+=2;return i.idRangeOffset=n(e,t,u),t+=2*u,i.glyphIdArray=n(e,t,a+o-t>>1),i},parse6:function(e,t,i){var r=Ah.B;t+=2,r.readUshort(e,t),t+=2,r.readUshort(e,t),t+=2,i.firstCode=r.readUshort(e,t),t+=2;var s=r.readUshort(e,t);t+=2,i.glyphIdArray=[];for(var n=0;n<s;n++)i.glyphIdArray.push(r.readUshort(e,t)),t+=2;return i},parse12:function(e,t,i){var r=Ah.B.readUint;r(e,t+=4),r(e,t+=4);var s=3*r(e,t+=4);t+=4;for(var n=i.groups=new Uint32Array(s),a=0;a<s;a+=3)n[a]=r(e,t+(a<<2)),n[a+1]=r(e,t+(a<<2)+4),n[a+2]=r(e,t+(a<<2)+8);return i}},Ah.T.CBLC={parseTab:function(e,t,i){var r=Ah.B,s=t;r.readUshort(e,t),t+=2,r.readUshort(e,t),t+=2;var n=r.readUint(e,t);t+=4;for(var a=[],o=0;o<n;o++){var h=r.readUint(e,t);t+=4,r.readUint(e,t),t+=4,r.readUint(e,t),t+=4,t+=4,t+=24,r.readUshort(e,t),t+=2,r.readUshort(e,t),t+=2,t+=4;for(var u=s+h,l=0;l<3;l++){var c=r.readUshort(e,u);u+=2;var p=r.readUshort(e,u);u+=2;var d=r.readUint(e,u);u+=4;var f=p-c+1,g=s+h+d,m=r.readUshort(e,g);if(g+=2,1!=m)throw m;var y=r.readUshort(e,g);g+=2;var x=r.readUint(e,g);g+=4;for(var v=[],b=0;b<f;b++){var _=r.readUint(e,g+4*b);v.push(x+_)}a.push([c,p,y,v])}}return a}},Ah.T.CBDT={parseTab:function(e,t,i){return new Uint8Array(e.buffer,e.byteOffset+t,i)}},Ah.T.glyf={parseTab:function(e,t,i,r){for(var s=[],n=r.maxp.numGlyphs,a=0;a<n;a++)s.push(null);return s},_parseGlyf:function(e,t){var i=Ah.B,r=e._data,s=e.loca;if(s[t]==s[t+1])return null;var n=Ah.findTable(r,"glyf",e._offset)[0]+s[t],a={};if(a.noc=i.readShort(r,n),n+=2,a.xMin=i.readShort(r,n),n+=2,a.yMin=i.readShort(r,n),n+=2,a.xMax=i.readShort(r,n),n+=2,a.yMax=i.readShort(r,n),n+=2,a.xMin>=a.xMax||a.yMin>=a.yMax)return null;if(a.noc>0){a.endPts=[];for(var o=0;o<a.noc;o++)a.endPts.push(i.readUshort(r,n)),n+=2;var h=i.readUshort(r,n);if(n+=2,r.length-n<h)return null;a.instructions=i.readBytes(r,n,h),n+=h;var u=a.endPts[a.noc-1]+1;a.flags=[];for(o=0;o<u;o++){var l=r[n];if(n++,a.flags.push(l),8&l){var c=r[n];n++;for(var p=0;p<c;p++)a.flags.push(l),o++}}a.xs=[];for(o=0;o<u;o++){var d=!!(2&a.flags[o]),f=!!(16&a.flags[o]);d?(a.xs.push(f?r[n]:-r[n]),n++):f?a.xs.push(0):(a.xs.push(i.readShort(r,n)),n+=2)}a.ys=[];for(o=0;o<u;o++){d=!!(4&a.flags[o]),f=!!(32&a.flags[o]);d?(a.ys.push(f?r[n]:-r[n]),n++):f?a.ys.push(0):(a.ys.push(i.readShort(r,n)),n+=2)}var g=0,m=0;for(o=0;o<u;o++)g+=a.xs[o],m+=a.ys[o],a.xs[o]=g,a.ys[o]=m}else{var y;a.parts=[];do{y=i.readUshort(r,n),n+=2;var x={m:{a:1,b:0,c:0,d:1,tx:0,ty:0},p1:-1,p2:-1};if(a.parts.push(x),x.glyphIndex=i.readUshort(r,n),n+=2,1&y){var v=i.readShort(r,n);n+=2;var b=i.readShort(r,n);n+=2}else{v=i.readInt8(r,n);n++;b=i.readInt8(r,n);n++}2&y?(x.m.tx=v,x.m.ty=b):(x.p1=v,x.p2=b),8&y?(x.m.a=x.m.d=i.readF2dot14(r,n),n+=2):64&y?(x.m.a=i.readF2dot14(r,n),n+=2,x.m.d=i.readF2dot14(r,n),n+=2):128&y&&(x.m.a=i.readF2dot14(r,n),n+=2,x.m.b=i.readF2dot14(r,n),n+=2,x.m.c=i.readF2dot14(r,n),n+=2,x.m.d=i.readF2dot14(r,n),n+=2)}while(32&y);if(256&y){var _=i.readUshort(r,n);n+=2,a.instr=[];for(o=0;o<_;o++)a.instr.push(r[n]),n++}}return a}},Ah.T.head={parseTab:function(e,t,i){var r=Ah.B,s={};return r.readFixed(e,t),t+=4,s.fontRevision=r.readFixed(e,t),t+=4,r.readUint(e,t),t+=4,r.readUint(e,t),t+=4,s.flags=r.readUshort(e,t),t+=2,s.unitsPerEm=r.readUshort(e,t),t+=2,s.created=r.readUint64(e,t),t+=8,s.modified=r.readUint64(e,t),t+=8,s.xMin=r.readShort(e,t),t+=2,s.yMin=r.readShort(e,t),t+=2,s.xMax=r.readShort(e,t),t+=2,s.yMax=r.readShort(e,t),t+=2,s.macStyle=r.readUshort(e,t),t+=2,s.lowestRecPPEM=r.readUshort(e,t),t+=2,s.fontDirectionHint=r.readShort(e,t),t+=2,s.indexToLocFormat=r.readShort(e,t),t+=2,s.glyphDataFormat=r.readShort(e,t),t+=2,s}},Ah.T.hhea={parseTab:function(e,t,i){var r=Ah.B,s={};r.readFixed(e,t),t+=4;for(var n=["ascender","descender","lineGap","advanceWidthMax","minLeftSideBearing","minRightSideBearing","xMaxExtent","caretSlopeRise","caretSlopeRun","caretOffset","res0","res1","res2","res3","metricDataFormat","numberOfHMetrics"],a=0;a<n.length;a++){var o=n[a],h="advanceWidthMax"==o||"numberOfHMetrics"==o?r.readUshort:r.readShort;s[o]=h(e,t+2*a)}return s}},Ah.T.hmtx={parseTab:function(e,t,i,r){for(var s=Ah.B,n=[],a=[],o=r.maxp.numGlyphs,h=r.hhea.numberOfHMetrics,u=0,l=0,c=0;c<h;)u=s.readUshort(e,t+(c<<2)),l=s.readShort(e,t+(c<<2)+2),n.push(u),a.push(l),c++;for(;c<o;)n.push(u),a.push(l),c++;return{aWidth:n,lsBearing:a}}},Ah.T.kern={parseTab:function(e,t,i,r){var s=Ah.B,n=Ah.T.kern;if(1==s.readUshort(e,t))return n.parseV1(e,t,i,r);var a=s.readUshort(e,t+2);t+=4;for(var o={glyph1:[],rval:[]},h=0;h<a;h++){t+=2;i=s.readUshort(e,t);t+=2;var u=s.readUshort(e,t);t+=2;var l=u>>>8;0==(l&=15)&&(t=n.readFormat0(e,t,o))}return o},parseV1:function(e,t,i,r){var s=Ah.B,n=Ah.T.kern;s.readFixed(e,t);var a=s.readUint(e,t+4);t+=8;for(var o={glyph1:[],rval:[]},h=0;h<a;h++){s.readUint(e,t),t+=4;var u=s.readUshort(e,t);t+=2,s.readUshort(e,t),t+=2,0==(255&u)&&(t=n.readFormat0(e,t,o))}return o},readFormat0:function(e,t,i){var r=Ah.B,s=r.readUshort,n=-1,a=s(e,t);s(e,t+2),s(e,t+4),s(e,t+6),t+=8;for(var o=0;o<a;o++){var h=s(e,t),u=s(e,t+=2);t+=2;var l=r.readShort(e,t);t+=2,h!=n&&(i.glyph1.push(h),i.rval.push({glyph2:[],vals:[]}));var c=i.rval[i.rval.length-1];c.glyph2.push(u),c.vals.push(l),n=h}return t}},Ah.T.loca={parseTab:function(e,t,i,r){var s=Ah.B,n=[],a=r.head.indexToLocFormat,o=r.maxp.numGlyphs+1;if(0==a)for(var h=0;h<o;h++)n.push(s.readUshort(e,t+(h<<1))<<1);if(1==a)for(h=0;h<o;h++)n.push(s.readUint(e,t+(h<<2)));return n}},Ah.T.maxp={parseTab:function(e,t,i){var r=Ah.B,s=r.readUshort,n={};return r.readUint(e,t),t+=4,n.numGlyphs=s(e,t),t+=2,n}},Ah.T.name={parseTab:function(e,t,i){var r=Ah.B,s={};r.readUshort(e,t),t+=2;var n=r.readUshort(e,t);t+=2;for(var a=r.readUshort(e,t),o=(t+=2)-6+a,h=["copyright","fontFamily","fontSubfamily","ID","fullName","version","postScriptName","trademark","manufacturer","designer","description","urlVendor","urlDesigner","licence","licenceURL","---","typoFamilyName","typoSubfamilyName","compatibleFull","sampleText","postScriptCID","wwsFamilyName","wwsSubfamilyName","lightPalette","darkPalette"],u=r.readUshort,l=0;l<n;l++){var c=u(e,t),p=u(e,t+=2),d=u(e,t+=2),f=u(e,t+=2),g=u(e,t+=2),m=u(e,t+=2);t+=2;var y,x=o+m;0==c||3==c&&0==p||1==c&&25==p?y=r.readUnicode(e,x,g/2):0==p?y=r.readASCII(e,x,g):1==p||3==p||4==p||5==p||10==p?y=r.readUnicode(e,x,g/2):1==c?(y=r.readASCII(e,x,g),console.log("reading unknown MAC encoding "+p+" as ASCII")):(console.log("unknown encoding "+p+", platformID: "+c),y=r.readASCII(e,x,g));var v="p"+c+","+d.toString(16);null==s[v]&&(s[v]={});var b=h[f];null==b&&(b="_"+f),s[v][b]=y,s[v]._lang=d}var _=Ah.T.name.selectOne(s),w="fontFamily";if(null==_[w])for(var C in s)null!=s[C][w]&&(_[w]=s[C][w]);return _},selectOne:function(e){var t,i="postScriptName";for(var r in e)if(null!=e[r][i]&&1033==e[r]._lang)return e[r];for(var r in e)if(null!=e[r][i]&&0==e[r]._lang)return e[r];for(var r in e)if(null!=e[r][i]&&3084==e[r]._lang)return e[r];for(var r in e)if(null!=e[r][i])return e[r];for(var r in e){t=e[r];break}return console.log("returning name table with languageID "+t._lang),null==t[i]&&null!=t.ID&&(t[i]=t.ID),t}},Ah.T.OS2={parseTab:function(e,t,i){var r=Ah.B.readUshort(e,t);t+=2;var s=Ah.T.OS2,n={};if(0==r)s.version0(e,t,n);else if(1==r)s.version1(e,t,n);else if(2==r||3==r||4==r)s.version2(e,t,n);else{if(5!=r)throw"unknown OS/2 table version: "+r;s.version5(e,t,n)}return n},version0:function(e,t,i){var r=Ah.B;return i.xAvgCharWidth=r.readShort(e,t),t+=2,i.usWeightClass=r.readUshort(e,t),t+=2,i.usWidthClass=r.readUshort(e,t),t+=2,i.fsType=r.readUshort(e,t),t+=2,i.ySubscriptXSize=r.readShort(e,t),t+=2,i.ySubscriptYSize=r.readShort(e,t),t+=2,i.ySubscriptXOffset=r.readShort(e,t),t+=2,i.ySubscriptYOffset=r.readShort(e,t),t+=2,i.ySuperscriptXSize=r.readShort(e,t),t+=2,i.ySuperscriptYSize=r.readShort(e,t),t+=2,i.ySuperscriptXOffset=r.readShort(e,t),t+=2,i.ySuperscriptYOffset=r.readShort(e,t),t+=2,i.yStrikeoutSize=r.readShort(e,t),t+=2,i.yStrikeoutPosition=r.readShort(e,t),t+=2,i.sFamilyClass=r.readShort(e,t),t+=2,i.panose=r.readBytes(e,t,10),t+=10,i.ulUnicodeRange1=r.readUint(e,t),t+=4,i.ulUnicodeRange2=r.readUint(e,t),t+=4,i.ulUnicodeRange3=r.readUint(e,t),t+=4,i.ulUnicodeRange4=r.readUint(e,t),t+=4,i.achVendID=r.readASCII(e,t,4),t+=4,i.fsSelection=r.readUshort(e,t),t+=2,i.usFirstCharIndex=r.readUshort(e,t),t+=2,i.usLastCharIndex=r.readUshort(e,t),t+=2,i.sTypoAscender=r.readShort(e,t),t+=2,i.sTypoDescender=r.readShort(e,t),t+=2,i.sTypoLineGap=r.readShort(e,t),t+=2,i.usWinAscent=r.readUshort(e,t),t+=2,i.usWinDescent=r.readUshort(e,t),t+=2},version1:function(e,t,i){var r=Ah.B;return t=Ah.T.OS2.version0(e,t,i),i.ulCodePageRange1=r.readUint(e,t),t+=4,i.ulCodePageRange2=r.readUint(e,t),t+=4},version2:function(e,t,i){var r=Ah.B,s=r.readUshort;return t=Ah.T.OS2.version1(e,t,i),i.sxHeight=r.readShort(e,t),t+=2,i.sCapHeight=r.readShort(e,t),t+=2,i.usDefault=s(e,t),t+=2,i.usBreak=s(e,t),t+=2,i.usMaxContext=s(e,t),t+=2},version5:function(e,t,i){var r=Ah.B.readUshort;return t=Ah.T.OS2.version2(e,t,i),i.usLowerOpticalPointSize=r(e,t),t+=2,i.usUpperOpticalPointSize=r(e,t),t+=2}},Ah.T.post={parseTab:function(e,t,i){var r=Ah.B,s={};return s.version=r.readFixed(e,t),t+=4,s.italicAngle=r.readFixed(e,t),t+=4,s.underlinePosition=r.readShort(e,t),t+=2,s.underlineThickness=r.readShort(e,t),t+=2,s}},Ah.T.SVG={parseTab:function(e,t,i){var r=Ah.B,s={entries:[],svgs:[]},n=t;r.readUshort(e,t),t+=2;var a=r.readUint(e,t);t+=4,r.readUint(e,t),t+=4,t=a+n;var o=r.readUshort(e,t);t+=2;for(var h=0;h<o;h++){var u=r.readUshort(e,t);t+=2;var l=r.readUshort(e,t);t+=2;var c=r.readUint(e,t);t+=4;var p=r.readUint(e,t);t+=4;var d=new Uint8Array(e.buffer,n+c+a,p);31==d[0]&&139==d[1]&&8==d[2]&&(d=Dh.inflate(d));for(var f=r.readUTF8(d,0,d.length),g=u;g<=l;g++)s.entries[g]=s.svgs.length;s.svgs.push(f)}return s}},Ah.T.sbix={parseTab:function(e,t,i,r){for(var s=r.maxp.numGlyphs,n=t,a=Ah.B,o=a.readUint(e,t+4),h=[],u=o-1;u<o;u++)for(var l=n+a.readUint(e,t+8+4*u),c=0;c<s;c++){var p=a.readUint(e,l+4+4*c),d=a.readUint(e,l+4+4*c+4);if(p!=d){var f=l+p,g=a.readASCII(e,f+4,4);if("png "!=g)throw g;h[c]=new Uint8Array(e.buffer,e.byteOffset+f+8,d-p-8)}else h[c]=null}return h}},Ah.T.colr={parseTab:function(e,t,i){var r=Ah.B,s=t;t+=2;var n=r.readUshort(e,t);t+=2;var a=r.readUint(e,t);t+=4;var o=r.readUint(e,t);t+=4;var h=r.readUshort(e,t);t+=2;for(var u={},l=s+a,c=0;c<n;c++)u["g"+r.readUshort(e,l)]=[r.readUshort(e,l+2),r.readUshort(e,l+4)],l+=6;var p=[];l=s+o;for(c=0;c<h;c++)p.push(r.readUshort(e,l),r.readUshort(e,l+2)),l+=4;return[u,p]}},Ah.T.cpal={parseTab:function(e,t,i){var r=Ah.B,s=t,n=r.readUshort(e,t);if(t+=2,0==n){r.readUshort(e,t),t+=2,r.readUshort(e,t),t+=2;var a=r.readUshort(e,t);t+=2;var o=r.readUint(e,t);return t+=4,new Uint8Array(e.buffer,s+o,4*a)}throw n}},Ah.T.GSUB={parseTab:function(e,t,i,r){var s=Ah.B,n=s.readUshort,a=t;n(e,a),n(e,a+=2),n(e,a+=2);var o=n(e,a+=2);n(e,a+=2),a+=2;var h={},u=n(e,a=t+o);a+=2;for(var l=0;l<u;l++){var c=s.readASCII(e,a,4);n(e,a+=4),a+=2,h[c]=!0}return h}},Ah.T.fvar={parseTab:function(e,t,i,r){var s=r.name,n=t,a=Ah.B,o=[],h=[];n+=8;var u=a.readUshort(e,n);n+=2,n+=2;var l=a.readUshort(e,n);n+=2;var c=a.readUshort(e,n);n+=2;for(var p=0;p<u;p++){var d=a.readASCII(e,n,4),f=a.readFixed(e,n+4),g=a.readFixed(e,n+8),m=a.readFixed(e,n+12),y=a.readUshort(e,n+16),x=a.readUshort(e,n+18);o.push([d,f,g,m,y,s["_"+x]]),n+=20}for(p=0;p<l;p++){for(var v=a.readUshort(e,n),b=null,_=(y=a.readUshort(e,n+2),[]),w=0;w<u;w++)_.push(a.readFixed(e,n+4+4*w));n+=4+4*u,2==(3&c)&&(b=a.readUshort(e,n),n+=2),h.push([s["_"+v],y,_,b])}return[o,h]}},Ah.T.gvar=function(){var e=Ah.B;function t(t,i,r){for(var s=[],n=0;n<r;n++)s.push(e.readF2dot14(t,i+2*n));return s}function i(i,r,s,n,a){for(var o=[],h=0;h<s;h++){var u=e.readUshort(i,r);r+=2;var l=e.readUshort(i,r),c=61440&l;l&=4095,r+=2;var p=null,d=null,f=null;32768&c&&(p=t(i,r,n),r+=2*n),16384&c&&(d=t(i,r,n),r+=2*n),16384&c&&(f=t(i,r,n),r+=2*n),o.push([u,l,c,d,p,f])}return o}function r(t,i,r){var s=t[i];if(i++,0==s)return[[],i];127<s&&(s=(127&s)<<8|t[i++]);for(var n=[],a=0;n.length<s;){var o=t[i];i++;var h=!!(128&o);o=1+(127&o);for(var u=0;u<o;u++){var l=0;h?(l=e.readUshort(t,i),i+=2):(l=t[i],i++),a+=l,n.push(a)}}return[n,i]}return{parseTab:function(s,n,a,o){var h=n+4,u=e.readUshort(s,h);h+=2;var l=e.readUshort(s,h);h+=2;var c=e.readUint(s,h);h+=4;var p=e.readUshort(s,h);h+=2,e.readUshort(s,h),h+=2;var d=e.readUint(s,h);h+=4;for(var f=[],g=0;g<p+1;g++)f.push(e.readUint(s,h+4*g));var m=[],y=[],x=[];for(h=n+c,g=0;g<l;g++){var v=t(s,h+g*u*2,u),b=[],_=[];m.push(v),y.push(b),x.push(_);for(var w=0;w<u;w++)b[w]=Math.min(v[w],0),_[w]=Math.max(v[w],0)}var C=new Int8Array(s.buffer),D=[];for(g=0;g<p;g++){h=n+d+f[g];var E=e.readUshort(s,h);h+=2;var A=32768&E;E&=4095;var S=e.readUshort(s,h),F=i(s,h+=2,E,u),T=[];D.push(T),h=n+d+f[g]+S;var M=null;if(A)M=(I=r(s,h))[0],h=I[1];for(var k=0;k<E;k++){var I,B=F[k],L=h+B[0],P=M;if(8192&B[2])P=(I=r(s,h))[0],h=I[1];for(var O=[];h<L;){var N=s[h++],R=1+(63&N);if(128&N)for(w=0;w<R;w++)O.push(0);else if(64&N){for(w=0;w<R;w++)O.push(e.readShort(s,h+2*w));h+=2*R}else{for(w=0;w<R;w++)O.push(C[h+w]);h+=R}}var V=B[1];if(T.push([[B[3]?B[3]:y[V],B[4]?B[4]:m[V],B[5]?B[5]:x[V]],O,0==P.length?null:P]),0!=P.length&&2*P.length!=O.length)throw"e"}}return D}}}(),Ah.T.avar={parseTab:function(e,t,i,r){var s=t,n=Ah.B,a=[];s+=6;var o=n.readUshort(e,s);s+=2;for(var h=0;h<o;h++){var u=n.readUshort(e,s);s+=2;var l=[];a.push(l);for(var c=0;c<u;c++){var p=n.readF2dot14(e,s),d=n.readF2dot14(e,s+2);s+=4,l.push(p,d)}}return a}},Ah.T.HVAR={parseTab:function(e,t,i,r){var s=t,n=t,a=Ah.B;s+=4;var o=a.readUint(e,s);s+=4;var h=a.readUint(e,s);s+=4;var u=a.readUint(e,s);s+=4;var l=a.readUint(e,s);if(s+=4,0!=u||0!=l)throw u;var c=s=n+o,p=a.readUshort(e,s);if(s+=2,1!=p)throw"e";var d=a.readUint(e,s);s+=4;var f=a.readUshort(e,s);s+=2;for(var g=[],m=0;m<f;m++)g.push(a.readUint(e,s+4*m));s+=4*f,s=c+d;var y=a.readUshort(e,s);s+=2;var x=a.readUshort(e,s);s+=2;var v=[];for(m=0;m<x;m++){var b=[[],[],[]];v.push(b);for(var _=0;_<y;_++)b[0].push(a.readF2dot14(e,s+0)),b[1].push(a.readF2dot14(e,s+2)),b[2].push(a.readF2dot14(e,s+4)),s+=6}var w=new Int8Array(e.buffer),C=[];for(m=0;m<g.length;m++){s=n+o+g[m];var D=[];C.push(D);var E=a.readUshort(e,s);s+=2;var A=a.readUshort(e,s);if(s+=2,32768&A)throw"e";x=a.readUshort(e,s);s+=2;var S=[];for(_=0;_<x;_++)S.push(a.readUshort(e,s+2*_));s+=2*x;for(var F=0;F<E;F++){for(var T=[],M=0;M<x;M++)T.push(M<A?a.readShort(e,s):w[s]),s+=M<A?2:1;var k=new Array(v.length);k.fill(0),D.push(k);for(_=0;_<S.length;_++)k[S[_]]=T[_]}}if(s=n+h,0!=(p=e[s++]))throw"e";var I=e[s++],B=a.readUshort(e,s);s+=2;var L=1+((48&I)>>4),P=[];for(m=0;m<B;m++){var O=0;1==L?O=e[s++]:(O=a.readUshort(e,s),s+=2);var N=O>>1+(15&I),R=O&(1<<1+(15&I))-1;P.push(C[N][R])}return[v,P]}},Ah.U=function(){var e=function(e,t,i){e.cmds.push("M"),e.crds.push(t,i)},t=function(e,t,i){e.cmds.push("L"),e.crds.push(t,i)},i=function(e,t,i,r,s,n,a){e.cmds.push("C"),e.crds.push(t,i,r,s,n,a)},r=function(e,t,i,r,s){e.cmds.push("Q"),e.crds.push(t,i,r,s)},s=function(e){e.cmds.push("Z")};function n(e,t,i,r){var s=t[i],n=t[i+1],a=e.kern;if(a){var o=a.glyph1.indexOf(s);if(-1!=o){var h=a.rval[o].glyph2.indexOf(n);if(-1!=h)return[0,0,a.rval[o].vals[h],0]}}return[0,0,0,0]}function a(e,t,i){for(var r=0,s=~~(e.length/t);r+1!=s;){var n=r+(s-r>>>1);e[n*t]<=i?r=n:s=n}return r*t}for(var o,h,u=[9,10,11,12,13,32,133,160,5760,6158,8232,8233,8239,8288,12288,65279],l={},c=0;c<u.length;c++)l[u[c]]=1;for(c=8192;c<=8205;c++)l[c]=1;function p(e,t){if(null==e._ctab){for(var i=e.cmap,r=-1,s=["p3e10","p0e4","p3e1","p1e0","p0e3","p0e1","p3e0","p3e5"],n=0;n<s.length;n++)if(null!=i.ids[s[n]]){r=i.ids[s[n]];break}if(-1==r)throw"no familiar platform and encoding!";e._ctab=i.tables[r]}var o=e._ctab,h=o.format,u=-1;if(0==h)u=t>=o.map.length?0:o.map[t];else if(4==h){var c=o.endCount;if(u=0,t<=c[c.length-1]){var p=a(c,1,t);if(c[p]<t&&p++,t>=o.startCount[p]){u=65535&(0!=o.idRangeOffset[p]?o.glyphIdArray[t-o.startCount[p]+(o.idRangeOffset[p]>>1)-(o.idRangeOffset.length-p)]:t+o.idDelta[p])}}}else if(6==h){var d=t-o.firstCode,f=o.glyphIdArray;u=d<0||d>=f.length?0:f[d]}else{if(12!=h)throw"unknown cmap table format "+o.format;var g=o.groups;u=0,t<=g[g.length-2]&&g[n=a(g,3,t)]<=t&&t<=g[n+1]&&(u=g[n+2]+(t-g[n]))}var m=e["SVG "],y=e.loca;return 0==u||null!=e["CFF "]||null!=m&&null!=m.entries[u]||!y||y[u]!=y[u+1]||null!=l[t]||(u=0),u}function d(e,t,i,r){var s={cmds:[],crds:[]};e.fvar&&(null==r&&(r=e.fvar[1][e._index][2]),r=m(e,r));var n=e["SVG "],a=e["CFF "],o=e.COLR,h=e.CBLC,u=e.CBDT,l=e.sbix,c=window.UPNG,p=null;if(h&&c)for(var g=0;g<h.length;g++)h[g][0]<=t&&t<=h[g][1]&&(p=h[g]);if(p||l&&l[t]){if(p&&17!=p[2])throw"not a PNG";null==e.__tmp&&(e.__tmp={});var y=e.__tmp["g"+t];if(null==y){var x,b;if(l)b=(x=l[t]).length;else{var _=p[3][t-p[0]]+5;b=u[_+1]<<16|u[_+2]<<8|u[_+3],_+=4,x=new Uint8Array(u.buffer,u.byteOffset+_,b)}var w="";for(g=0;g<b;g++)w+=String.fromCharCode(x[g]);y=e.__tmp["g"+t]="data:image/png;base64,"+btoa(w)}s.cmds.push(y);var C=1.15*e.head.unitsPerEm,D=Math.round(C),E=Math.round(C),A=Math.round(.15*-E);s.crds.push(0,E+A,D,E+A,D,A,0,A)}else if(n&&n.entries[t]){var S=n.entries[t];if(null!=S){if("number"==typeof S){var F=n.svgs[S];if("string"==typeof F){var T=(new DOMParser).parseFromString(F,"image/svg+xml");F=n.svgs[S]=T.getElementsByTagName("svg")[0]}S=Ah.U.SVG.toPath(F,t),n.entries[t]=S}s=S}}else if(1!=i&&o&&o[0]["g"+t]&&o[0]["g"+t][1]>1){function U(e){var t=e.toString(16);return(1==t.length?"0":"")+t}var M=e.CPAL,k=o[0]["g"+t];for(g=0;g<k[1];g++){var I=k[0]+g,B=o[1][2*I],L=4*o[1][2*I+1],P=d(e,B,B==t),O="#"+U(M[L+2])+U(M[L+1])+U(M[L+0]);s.cmds.push(O),s.cmds=s.cmds.concat(P.cmds),s.crds=s.crds.concat(P.crds),s.cmds.push("X")}}else if(a){var N=a.Private,R={x:0,y:0,stack:[],nStems:0,haveWidth:!1,width:N?N.defaultWidthX:0,open:!1};if(a.ROS){for(var V=0;a.FDSelect[V+2]<=t;)V+=2;N=a.FDArray[a.FDSelect[V+1]].Private}v(a.CharStrings[t],R,a,N,s)}else e.glyf&&f(t,e,s,r);return{cmds:s.cmds,crds:s.crds}}function f(i,n,a,o){var h=n.glyf[i];null==h&&(h=n.glyf[i]=Ah.T.glyf._parseGlyf(n,i)),null!=h&&(h.noc>-1?function(i,n,a,o,h){var u=i.xs,l=i.ys;if(n.fvar&&h){u=u.slice(0),l=l.slice(0);for(var c=n.gvar,p=c?c[a]:null,d=0;d<p.length;d++){var f=g(p[d][0],h);if(!(f<1e-9)){var m=p[d][1],x=p[d][2];if(x&&(m=p[d][1]=y(m,x,u,l,i.endPts),p[d][2]=null),m.length==2*u.length+8)for(var v=0;v<u.length;v++)u[v]+=f*m[v],l[v]+=f*m[v+u.length+4]}}}for(var b=0;b<i.noc;b++){var _=0==b?0:i.endPts[b-1]+1,w=i.endPts[b];for(v=_;v<=w;v++){var C=v==_?w:v-1,D=v==w?_:v+1,E=1&i.flags[v],A=1&i.flags[C],S=1&i.flags[D],F=u[v],T=l[v];if(v==_)if(E){if(!A){e(o,F,T);continue}e(o,u[C],l[C])}else A?e(o,u[C],l[C]):e(o,Math.floor(.5*(u[C]+F)),Math.floor(.5*(l[C]+T)));E?A&&t(o,F,T):S?r(o,F,T,u[D],l[D]):r(o,F,T,Math.floor(.5*(F+u[D])),Math.floor(.5*(T+l[D])))}s(o)}}(h,n,i,a,o):function(e,t,i,r,s){var n=[0,0,0,0,0,0],a=[0,0,0,0,0,0],o=e.parts.length;if(t.fvar&&s)for(var h=t.gvar,u=h?h[i]:null,l=0;l<u.length;l++){var c=g(u[l][0],s);if(!(c<1e-6)){var p=u[l][1],d=u[l][2];if(null==d)for(var m=0;m<o;m++)n[m]+=c*p[m],a[m]+=c*p[m+o+4];else for(var y=0;y<d.length;y++){n[m=d[y]]+=c*p[0],a[m]+=c*p[0+o]}}}for(y=0;y<o;y++){var x={cmds:[],crds:[]},v=e.parts[y];f(v.glyphIndex,t,x,s);var b=v.m,_=b.tx+n[y],w=b.ty+a[y];for(m=0;m<x.crds.length;m+=2){var C=x.crds[m],D=x.crds[m+1];r.crds.push(C*b.a+D*b.c+_),r.crds.push(C*b.b+D*b.d+w)}for(m=0;m<x.cmds.length;m++)r.cmds.push(x.cmds[m])}}(h,n,i,a,o))}function g(e,t){for(var i=1,r=e[0],s=e[1],n=e[2],a=0;a<t.length;a++){i*=r[a]>s[a]||s[a]>n[a]||r[a]<0&&n[a]>0&&0!=s[a]||0==s[a]?1:t[a]<r[a]||t[a]>n[a]?0:t[a]==s[a]?1:t[a]<s[a]?(t[a]-r[a])/(s[a]-r[a]):(n[a]-t[a])/(n[a]-s[a])}return i}function m(e,t){for(var i=e.fvar,r=e.avar,s=i?i[0]:null,n=[],a=0;a<s.length;a++){var o=s[a][1],h=s[a][2],u=s[a][3],l=Math.max(o,Math.min(u,t[a]));if(n[a]=l<h?(h-l)/(o-h):l>h?(l-h)/(u-h):0,r&&-1!=n[a]){for(var c=r[a],p=0;p<c.length&&!(c[p]>=n[a]);p+=2);var d=(n[a]-c[p-2])/(c[p]-c[p-2]);n[a]=d*c[p+1]+(1-d)*c[p-1]}}return n}function y(e,t,i,r,s){var n=i.length,a=new Array(2*n+8);a.fill(0);for(var o=0;o<n;o++){var h=0,u=0,l=t.indexOf(o);if(-1!=l)h=e[l],u=e[t.length+l];else{for(var c=0;s[c]<o;)c++;for(var p=0==c?0:s[c-1]+1,d=s[c],f=-1,g=-1,m=0;m<t.length;m++){(y=t[m])<p||y>d||y>=n||(f=m,-1==g&&(g=m))}for(m=0;m<t.length;m++){var y;if(!((y=t[m])<p||y>d||y>=n)&&(y<o&&(f=m),o<y)){g=m;break}}for(var x=0;x<2;x++){var v=0==x?i:r,b=x*t.length,_=0,w=v[t[f]],C=v[t[g]],D=v[o],E=e[b+f],A=e[b+g];if(w==C)_=E==A?E:0;else if(D<=Math.min(w,C))_=w<C?E:A;else if(Math.max(w,C)<=D)_=w<C?A:E;else{var S=(D-w)/(C-w);_=S*A+(1-S)*E}0==x?h=_:u=_}}a[o]=h,a[n+4+o]=u}return a}function x(e,t,i,r){for(var s=t>>1,n=i>>1,a=new Uint8Array(s*n*4),o=new Uint32Array(e.buffer),h=new Uint32Array(a.buffer),u=0;u<n;u++)for(var l=0;l<s;l++){var c=u*s+l,p=(u<<1)*t+(l<<1),d=o[p],f=o[p+1],g=o[p+t],m=o[p+t+1],y=d>>>24,x=f>>>24,v=g>>>24,b=m>>>24,_=y+x+v+b;if(1020==_){var w=(d>>>0&255)+(f>>>0&255)+(g>>>0&255)+(m>>>0&255)+2>>>2,C=(d>>>8&255)+(f>>>8&255)+(g>>>8&255)+(m>>>8&255)+2>>>2,D=(d>>>16&255)+(f>>>16&255)+(g>>>16&255)+(m>>>16&255)+2>>>2;h[c]=255<<24|D<<16|C<<8|w}else if(0==_)h[c]=0;else{var E=1/_;w=~~((w=(d>>>0&255)*y+(f>>>0&255)*x+(g>>>0&255)*v+(m>>>0&255)*b)*E+.5),C=~~((C=(d>>>8&255)*y+(f>>>8&255)*x+(g>>>8&255)*v+(m>>>8&255)*b)*E+.5),D=~~((D=(d>>>16&255)*y+(f>>>16&255)*x+(g>>>16&255)*v+(m>>>16&255)*b)*E+.5),h[c]=_+2>>>2<<24|D<<16|C<<8|w}}return{buff:a,w:s,h:n}}function v(r,n,a,o,h){for(var u=n.stack,l=n.nStems,c=n.haveWidth,p=n.width,d=n.open,f=0,g=n.x,m=n.y,y=0,x=0,b=0,_=0,w=0,C=0,D=0,E=0,A=0,S=0,F=Ah.T.CFF,T=o.nominalWidthX,M={val:0,size:0};f<r.length;){F.getCharString(r,f,M);var k=M.val;if(f+=M.size,"o1"==k||"o18"==k)u.length%2!=0&&!c&&(p=u.shift()+T),l+=u.length>>1,u.length=0,c=!0;else if("o3"==k||"o23"==k){u.length%2!=0&&!c&&(p=u.shift()+T),l+=u.length>>1,u.length=0,c=!0}else if("o4"==k)u.length>1&&!c&&(p=u.shift()+T,c=!0),d&&s(h),m+=u.pop(),e(h,g,m),d=!0;else if("o5"==k)for(;u.length>0;)g+=u.shift(),m+=u.shift(),t(h,g,m);else if("o6"==k||"o7"==k)for(var I=u.length,B="o6"==k,L=0;L<I;L++){var P=u.shift();B?g+=P:m+=P,B=!B,t(h,g,m)}else if("o8"==k||"o24"==k){I=u.length;for(var O=0;O+6<=I;)y=g+u.shift(),x=m+u.shift(),b=y+u.shift(),_=x+u.shift(),g=b+u.shift(),m=_+u.shift(),i(h,y,x,b,_,g,m),O+=6;"o24"==k&&(g+=u.shift(),m+=u.shift(),t(h,g,m))}else{if("o11"==k)break;if("o1234"==k||"o1235"==k||"o1236"==k||"o1237"==k)"o1234"==k&&(x=m,b=(y=g+u.shift())+u.shift(),S=_=x+u.shift(),C=_,E=m,g=(D=(w=(A=b+u.shift())+u.shift())+u.shift())+u.shift(),i(h,y,x,b,_,A,S),i(h,w,C,D,E,g,m)),"o1235"==k&&(y=g+u.shift(),x=m+u.shift(),b=y+u.shift(),_=x+u.shift(),A=b+u.shift(),S=_+u.shift(),w=A+u.shift(),C=S+u.shift(),D=w+u.shift(),E=C+u.shift(),g=D+u.shift(),m=E+u.shift(),u.shift(),i(h,y,x,b,_,A,S),i(h,w,C,D,E,g,m)),"o1236"==k&&(y=g+u.shift(),x=m+u.shift(),b=y+u.shift(),S=_=x+u.shift(),C=_,D=(w=(A=b+u.shift())+u.shift())+u.shift(),E=C+u.shift(),g=D+u.shift(),i(h,y,x,b,_,A,S),i(h,w,C,D,E,g,m)),"o1237"==k&&(y=g+u.shift(),x=m+u.shift(),b=y+u.shift(),_=x+u.shift(),A=b+u.shift(),S=_+u.shift(),w=A+u.shift(),C=S+u.shift(),D=w+u.shift(),E=C+u.shift(),Math.abs(D-g)>Math.abs(E-m)?g=D+u.shift():m=E+u.shift(),i(h,y,x,b,_,A,S),i(h,w,C,D,E,g,m));else if("o14"==k){if(u.length>0&&4!=u.length&&!c&&(p=u.shift()+a.nominalWidthX,c=!0),4==u.length){var N=u.shift(),R=u.shift(),V=u.shift(),U=u.shift(),G=F.glyphBySE(a,V),z=F.glyphBySE(a,U);v(a.CharStrings[G],n,a,o,h),n.x=N,n.y=R,v(a.CharStrings[z],n,a,o,h)}d&&(s(h),d=!1)}else if("o19"==k||"o20"==k){u.length%2!=0&&!c&&(p=u.shift()+T),l+=u.length>>1,u.length=0,c=!0,f+=l+7>>3}else if("o21"==k)u.length>2&&!c&&(p=u.shift()+T,c=!0),m+=u.pop(),g+=u.pop(),d&&s(h),e(h,g,m),d=!0;else if("o22"==k)u.length>1&&!c&&(p=u.shift()+T,c=!0),g+=u.pop(),d&&s(h),e(h,g,m),d=!0;else if("o25"==k){for(;u.length>6;)g+=u.shift(),m+=u.shift(),t(h,g,m);y=g+u.shift(),x=m+u.shift(),b=y+u.shift(),_=x+u.shift(),g=b+u.shift(),m=_+u.shift(),i(h,y,x,b,_,g,m)}else if("o26"==k)for(u.length%2&&(g+=u.shift());u.length>0;)y=g,x=m+u.shift(),g=b=y+u.shift(),m=(_=x+u.shift())+u.shift(),i(h,y,x,b,_,g,m);else if("o27"==k)for(u.length%2&&(m+=u.shift());u.length>0;)x=m,b=(y=g+u.shift())+u.shift(),_=x+u.shift(),g=b+u.shift(),i(h,y,x,b,_,g,m=_);else if("o10"==k||"o29"==k){var j="o10"==k?o:a;if(0==u.length)console.log("error: empty stack");else{var $=u.pop(),W=j.Subrs[$+j.Bias];n.x=g,n.y=m,n.nStems=l,n.haveWidth=c,n.width=p,n.open=d,v(W,n,a,o,h),g=n.x,m=n.y,l=n.nStems,c=n.haveWidth,p=n.width,d=n.open}}else if("o30"==k||"o31"==k){var q=u.length,H=(O=0,"o31"==k);for(O+=q-(I=-3&q);O<I;)H?(x=m,b=(y=g+u.shift())+u.shift(),m=(_=x+u.shift())+u.shift(),I-O==5?(g=b+u.shift(),O++):g=b,H=!1):(y=g,x=m+u.shift(),b=y+u.shift(),_=x+u.shift(),g=b+u.shift(),I-O==5?(m=_+u.shift(),O++):m=_,H=!0),i(h,y,x,b,_,g,m),O+=4}else{if("o"==(k+"").charAt(0))throw console.log("Unknown operation: "+k,r),k;u.push(k)}}}n.x=g,n.y=m,n.nStems=l,n.haveWidth=c,n.width=p,n.open=d}return{shape:function(e,t,i){null==i&&(i={});var r=i.axs;e.fvar&&null==r&&(r=e.fvar[1][e._index][2]);var s=e.HVAR;r&&s&&(r=m(e,r));for(var a=[],o=0;o<t.length;o++){var h=t.codePointAt(o);h>65535&&o++,a.push(p(e,h))}var u=[];for(o=0;o<a.length;o++){var l=n(e,a,o),c=a[o],d=e.hmtx.aWidth[c]+l[2];if(s&&s[1][c])for(var f=s[1][c],y=0;y<s[0].length;y++)d+=g(s[0][y],r)*f[y];u.push({g:c,cl:o,dx:0,dy:0,ax:d,ay:0})}return u},shapeToPath:function(e,t,i){var r,s,n={cmds:[],crds:[]},a=0,o=0;i&&(r=i.clr,s=i.axs);for(var h=0;h<t.length;h++){for(var u=t[h],l=d(e,u.g,!1,s),c=l.crds,p=0;p<c.length;p+=2)n.crds.push(c[p]+a+u.dx),n.crds.push(c[p+1]+o+u.dy);r&&n.cmds.push(r);for(p=0;p<l.cmds.length;p++)n.cmds.push(l.cmds[p]);var f=n.cmds.length;r&&0!=f&&"X"!=n.cmds[f-1]&&n.cmds.push("X"),a+=u.ax,o+=u.ay}return{cmds:n.cmds,crds:n.crds}},codeToGlyph:p,glyphToPath:d,pathToSVG:function(e,t){var i=e.cmds,r=e.crds;function s(e){return parseFloat(e.toFixed(t))}null==t&&(t=5);for(var n=[],a=0,o={M:2,L:2,Q:4,C:6},h=0,u=0,l=0,c=0,p=0,d=0,f=0;f<i.length;f++){var g,m,y,x,v=i[f],b=o[v]?o[v]:0,_=[];if("L"==v)g=r[a]-h,m=r[a+1]-u,y=s(g+l),x=s(m+c),"Z"==i[f+1]&&r[a]==p&&r[a+1]==d?(y=g,x=m):0==y&&0==x||(0==y?_.push("v",x):0==x?_.push("h",y):_.push("l",y,x));else{_.push(v.toLowerCase());for(var w=0;w<b;w+=2)g=r[a+w]-h,m=r[a+w+1]-u,y=s(g+l),x=s(m+c),_.push(y,x)}0!=b&&(l+=g-y,c+=m-x);var C=_;for(w=0;w<C.length;w++)n.push(C[w]);0!=b&&(h=r[(a+=b)-2],u=r[a-1]),"M"==v&&(p=h,d=u),"Z"==v&&(h=p,u=d)}return function(e){for(var t=[],i=!1,r="",s=0;s<e.length;s++){var n=e[s],a="number"==typeof n;if(!a){if(n==r&&1==n.length&&"m"!=n)continue;r=n}i&&a&&n>=0&&t.push(" "),t.push(n),i=a}return t.join("")}(n)},SVGToPath:function(e){var t={cmds:[],crds:[]};return Ah.U.SVG.svgToPath(e,t),{cmds:t.cmds,crds:t.crds}},pathToContext:function(e,t){for(var i=0,r=e.cmds,s=e.crds,n=0;n<r.length;n++){var a=r[n];if("M"==a)t.moveTo(s[i],s[i+1]),i+=2;else if("L"==a)t.lineTo(s[i],s[i+1]),i+=2;else if("C"==a)t.bezierCurveTo(s[i],s[i+1],s[i+2],s[i+3],s[i+4],s[i+5]),i+=6;else if("Q"==a)t.quadraticCurveTo(s[i],s[i+1],s[i+2],s[i+3]),i+=4;else if("d"==a[0]){var u=window.UPNG,l=s[i],c=s[i+1],p=s[i+2],d=s[i+3],f=s[i+4],g=s[i+5],m=s[i+6],y=s[i+7];if(i+=8,null==u){t.moveTo(l,c),t.lineTo(p,d),t.lineTo(f,g),t.lineTo(m,y),t.closePath();continue}for(var v=p-l,b=d-c,_=m-l,w=y-c,C=atob(a.slice(22)),D=new Uint8Array(C.length),E=0;E<C.length;E++)D[E]=C.charCodeAt(E);for(var A=u.decode(D.buffer),S=A.width,F=A.height,T=new Uint8Array(u.toRGBA8(A)[0]),M=t.getTransform(),k=Math.sqrt(Math.abs(M.a*M.d-M.b*M.c))*Math.sqrt(_*_+w*w)/F;k<.5;){var I=x(T,S,F);T=I.buff,S=I.w,F=I.h,k*=2}null==o&&(o=document.createElement("canvas"),h=o.getContext("2d")),o.width==S&&o.height==F||(o.width=S,o.height=F),h.putImageData(new ImageData(new Uint8ClampedArray(T.buffer),S,F),0,0),t.save(),t.transform(v,b,_,w,l,c),t.scale(1/S,1/F),t.drawImage(o,0,0),t.restore()}else if("#"==a.charAt(0)||"r"==a.charAt(0))t.beginPath(),t.fillStyle=a;else if("O"==a.charAt(0)&&"OX"!=a){t.beginPath();var B=a.split("-");t.lineWidth=parseFloat(B[2]),t.lineCap=["butt","round","square"][parseFloat(B[3])],t.lineJoin=["miter","round","bevel"][parseFloat(B[4])],t.miterLimit=parseFloat(B[5]),t.lineDashOffset=parseFloat(B[6]),t.setLineDash(B[7].split(",").map(parseFloat)),t.strokeStyle=B[1]}else"Z"==a?t.closePath():"X"==a?t.fill():"OX"==a&&t.stroke()}},initHB:function(e,t){var i=function(e){var t=0;return 4294967168&e?4294965248&e?4294901760&e?4292870144&e||(t=4):t=3:t=2:t=1,t};fetch(e).then((function(e){return e.arrayBuffer()})).then((function(e){return WebAssembly.instantiate(e)})).then((function(e){console.log("HB ready");var r,s,n,a,o,h,u,l,c,p,d=e.instance.exports,f=d.memory;Ah.U.shapeHB=function(e,t,g){var m=e._data,y=e.name.postScriptName,x=g.ltr,v=g.fts,b=g.axs;if(e.fvar&&null==b&&(b=e.fvar[1][e._index][2]),r=new Uint8Array(f.buffer),s=new Uint32Array(f.buffer),n=new Int32Array(f.buffer),a=new Float32Array(f.buffer),o!=y&&(null!=h&&(d.hb_blob_destroy(h),d.free(u),d.hb_face_destroy(l),d.hb_font_destroy(c)),u=d.malloc(m.byteLength),r.set(m,u),h=d.hb_blob_create(u,m.byteLength,2,0,0),l=d.hb_face_create(h,e._index),c=d.hb_font_create(l),o=y),null!=window.TextEncoder){null==p&&(p=new window.TextEncoder("utf8"));var _=d.hb_buffer_create(),w=p.encode(t),C=w.length,D=d.malloc(C);r.set(w,D),d.hb_buffer_add_utf8(_,D,C,0,C),d.free(D);var E=Ah.B,A=0;if(v){A=d.malloc(16*v.length);for(var S=0;S<v.length;S++){var F=v[S],T=(I=A+16*S)>>>2;E.writeASCII(r,I,F[0].split("").reverse().join("")),s[T+1]=F[1],s[T+2]=F[2],s[T+3]=F[3]}}var M=0;if(b&&e.fvar){var k=e.fvar[0];for(M=d.malloc(8*b.length),S=0;S<b.length;S++){var I;T=(I=M+8*S)>>>2,E.writeASCII(r,I,k[S][0].split("").reverse().join("")),a[T+1]=b[S]}}b&&d.hb_font_set_variations(c,M,b.length),d.hb_buffer_set_direction(_,x?4:5),d.hb_buffer_guess_segment_properties(_),d.hb_shape(c,_,A,v?v.length:0);var B=function(e){for(var t=d.hb_buffer_get_length(e),i=[],r=d.hb_buffer_get_glyph_infos(e,0)>>>2,a=d.hb_buffer_get_glyph_positions(e,0)>>>2,o=0;o<t;++o){var h=r+5*o,u=a+5*o;i.push({g:s[h+0],cl:s[h+2],ax:n[u+0],ay:n[u+1],dx:n[u+2],dy:n[u+3]})}return i}(_);d.hb_buffer_destroy(_),v&&d.free(A),b&&d.free(M);var L=B.slice(0);x||L.reverse();var P=0,O=0;for(S=1;S<L.length;S++){for(var N=L[S],R=N.cl;;){var V=t.codePointAt(P),U=i(V);if(!(O+U<=R))break;O+=U,P+=V<=65535?1:2}N.cl=P}return B}alert("Your browser is too old. Please, update it.")},t()}))}}}();var Sh={exports:{}};!function(e){!function(t,i){e.exports=i()}(self,(()=>(()=>{var e={177:(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.BezierPath=void 0;const r=i(558),s=i(188);t.BezierPath=class{constructor(e){this.samples=[],this.segments=e;const t=e.map((e=>e.getTotalLength())),i=[0];for(let e=1;e<t.length;e++)i.push(i[e-1]+t[e-1]);this._totalLength=i[i.length-1]+t[t.length-1];const n=e.map((e=>Math.max(4,Math.ceil(e.getTotalLength()/r.BezierSegment.sampleSpacing())))),a=n.reduce(((e,t)=>e+t)),o=1/a/10,h=this._totalLength/a;this.samples.push({dist:0,pt:this.segments[0].A,tan:this.segments[0].tangentAtParameter(0),segIdx:0,t:0}),e.forEach(((e,t)=>{const r=n[t],a=(0,s.times)(r+1).map((e=>e/r)),u=a.map((t=>e.pointAtParameter(t)));let l;for(let t=0;t<4;t++){l=(0,s.times)(r).map((e=>Math.hypot(u[e+1].x-u[e].x,u[e+1].y-u[e].y)));const t=l.map((e=>e-h));let i=0;for(let r=1;r<a.length-1;r++)i+=t[r-1],a[r]-=o*i,u[r]=e.pointAtParameter(a[r])}let c=0;u.slice(1).forEach(((e,r)=>{c+=l[r],this.samples.push({dist:i[t]+c,pt:e,tan:this.segments[t].tangentAtParameter(a[r+1]),segIdx:t,t:a[r+1]})}))})),this._jumps=[],this.segmentStartEnds=[{start:0,end:0}];for(let e=1;e<this.samples.length;e++){const t=this.samples[e-1],i=this.samples[e];if(i.segIdx===t.segIdx?this.segmentStartEnds[this.segmentStartEnds.length-1].end=i.dist:this.segmentStartEnds[i.segIdx]={start:i.dist,end:i.dist},t.segIdx!==i.segIdx&&(this.segments[t.segIdx].D.x!==this.segments[i.segIdx].A.x||this.segments[t.segIdx].D.y!==this.segments[i.segIdx].A.y)){const r=(t.dist+i.dist)/2,s={dist:r-1e-8,pt:this.segments[t.segIdx].D,tan:this.segments[t.segIdx].tangentAtParameter(1),segIdx:t.segIdx,t:1},n={dist:r+1e-8,pt:this.segments[i.segIdx].A,tan:this.segments[i.segIdx].tangentAtParameter(0),segIdx:i.segIdx,t:0};this._jumps.push(r),this.samples.splice(e,0,s,n),e+=2}}}jumps(){return[...this._jumps]}getTotalLength(){return this._totalLength}findClosestSampleIdx(e){let t=0,i=this.samples.length-1;for(;t<i;){const r=Math.floor((t+i)/2);if(this.samples[r].dist>e)i=r-1;else{if(!(this.samples[r].dist<e))return r;t=r+1}}return Math.max(0,Math.min(this.samples.length-1,Math.floor((t+i)/2)))}getPointAtLength(e,t=!1){if(e<=0)return this.samples[0].pt;if(e>=this._totalLength)return this.samples[this.samples.length-1].pt;const i=this.findClosestSampleIdx(e),r=this.samples[i].dist<e?Math.min(i+1,this.samples.length-1):Math.max(0,i-1),s=Math.abs(this.samples[r].dist-this.samples[i].dist)<1e-6?0:(e-this.samples[i].dist)/(this.samples[r].dist-this.samples[i].dist);if(t||this.samples[i].segIdx>this.samples[r].segIdx)return{x:(1-s)*this.samples[i].pt.x+s*this.samples[r].pt.x,y:(1-s)*this.samples[i].pt.y+s*this.samples[r].pt.y};if(this.samples[i].segIdx!==this.samples[r].segIdx){if(s<.5){const e=this.segments[this.samples[i].segIdx],t=2*s,r=(1-t)*this.samples[i].t+t;return e.pointAtParameter(r)}{const e=this.segments[this.samples[r].segIdx],t=2*(s-.5)*this.samples[r].t;return e.pointAtParameter(t)}}{const e=this.segments[this.samples[i].segIdx],t=(1-s)*this.samples[i].t+s*this.samples[r].t;return e.pointAtParameter(t)}}getAngleAtLength(e,t=!1){const i=this.getTangentAtLength(e,t);return Math.atan2(i.y,i.x)}getTangentAtLength(e,t=!1){if(e<=0)return this.samples[0].tan;if(e>=this._totalLength)return this.samples[this.samples.length-1].tan;const i=this.findClosestSampleIdx(e),r=this.samples[i].dist<e?Math.min(i+1,this.samples.length-1):Math.max(0,i-1),s=(e-this.samples[i].dist)/(this.samples[r].dist-this.samples[i].dist);if(t||this.samples[i].segIdx>this.samples[r].segIdx){let e=(1-s)*this.samples[i].tan.x+s*this.samples[r].tan.x,t=(1-s)*this.samples[i].tan.y+s*this.samples[r].tan.y;const n=Math.max(Math.hypot(e,t),1e-4);return e/=n,t/=n,{x:e,y:t}}if(this.samples[i].segIdx!==this.samples[r].segIdx){if(s<.5){const e=this.segments[this.samples[i].segIdx],t=2*s,r=(1-t)*this.samples[i].t+t;return e.tangentAtParameter(r)}{const e=this.segments[this.samples[r].segIdx],t=2*(s-.5)*this.samples[r].t;return e.tangentAtParameter(t)}}{const e=this.segments[this.samples[i].segIdx],t=(1-s)*this.samples[i].t+s*this.samples[r].t;return e.tangentAtParameter(t)}}}},558:(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.BezierSegment=void 0;const r=i(188);class s{constructor(e,t,i,r){this._totalLength=void 0,this.A=e,this.B=t,this.C=i,this.D=r}static sampleSpacing(){return 2}tangentAtParameter(e){const t=Math.max(0,Math.min(1,e));if(0===t||1===t){let e,i;0===t?this.A.x===this.B.x&&this.A.y===this.B.y?(e=this.C.x-this.A.x,i=this.C.y-this.A.y):(e=this.B.x-this.A.x,i=this.B.y-this.A.y):this.D.x===this.C.x&&this.D.y===this.C.y?(e=this.D.x-this.B.x,i=this.D.y-this.B.y):(e=this.D.x-this.C.x,i=this.D.y-this.C.y);const r=Math.hypot(e,i);return Math.abs(r)>1e-4&&(e/=r,i/=r),{x:e,y:i}}const i=1-t;let r=3*this.D.x*Math.pow(t,2)-3*this.C.x*Math.pow(t,2)+6*this.C.x*i*t-6*this.B.x*i*t+3*this.B.x*Math.pow(i,2)-3*this.A.x*Math.pow(i,2),s=3*this.D.y*Math.pow(t,2)-3*this.C.y*Math.pow(t,2)+6*this.C.y*i*t-6*this.B.y*i*t+3*this.B.y*Math.pow(i,2)-3*this.A.y*Math.pow(i,2);const n=Math.hypot(r,s);return Math.abs(n)>1e-4&&(r/=n,s/=n),{x:r,y:s}}isLinear(){return this.A.x===this.B.x&&this.A.y===this.B.y&&this.C.x===this.D.x&&this.C.y===this.D.y}pointAtParameter(e){const t=Math.max(0,Math.min(1,e));return{x:Math.pow(1-t,3)*this.A.x+3*Math.pow(1-t,2)*t*this.B.x+3*(1-t)*Math.pow(t,2)*this.C.x+Math.pow(t,3)*this.D.x,y:Math.pow(1-t,3)*this.A.y+3*Math.pow(1-t,2)*t*this.B.y+3*(1-t)*Math.pow(t,2)*this.C.y+Math.pow(t,3)*this.D.y}}getTotalLength(){if(void 0===this._totalLength)if(this.isLinear())this._totalLength=Math.hypot(this.D.x-this.A.x,this.D.y-this.A.y);else{const e=Math.max(10,Math.ceil((Math.hypot(this.B.x-this.A.x,this.B.y-this.A.y)+Math.hypot(this.C.x-this.B.x,this.C.y-this.B.y)+Math.hypot(this.D.x-this.C.x,this.D.y-this.C.y))/s.sampleSpacing())),t=(0,r.times)(e).map((t=>this.pointAtParameter(t/(e-1))));let i=0;for(let e=1;e<t.length;e++)i+=Math.hypot(t[e].x-t[e-1].x,t[e].y-t[e-1].y);this._totalLength=i}return this._totalLength}}t.BezierSegment=s},729:(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.createFromCommands=t.create=t.createFromElement=t.createFromCircle=t.createFromLine=t.createFromPath=void 0;const r=i(821),s=i(558),n={M:["x","y"],m:["dx","dy"],H:["x"],h:["dx"],V:["y"],v:["dy"],L:["x","y"],l:["dx","dy"],Z:[],C:["x1","y1","x2","y2","x","y"],c:["dx1","dy1","dx2","dy2","dx","dy"],S:["x2","y2","x","y"],s:["dx2","dy2","dx","dy"],Q:["x1","y1","x","y"],q:["dx1","dy1","dx","dy"],T:["x","y"],t:["dx","dy"],A:["rx","ry","rotation","large-arc","sweep","x","y"],a:["rx","ry","rotation","large-arc","sweep","dx","dy"]};t.createFromPath=e=>{const t=function(e){const t=e.replace(/[\n\r]/g,"").replace(/-/g," -").replace(/(\d*\.)(\d+)(?=\.)/g,"$1$2 ").replace(/(\d)([A-Za-z])/g,"$1 $2").replace(/([A-Za-z])(\d)/g,"$1 $2").trim().split(/\s*,|\s+/),i=[];let r="",s={};for(;t.length>0;){let e=t.shift();n.hasOwnProperty(e)?r=e:t.unshift(e),s={type:r},n[r].forEach((i=>{e=t.shift(),s[i]=parseFloat(e)})),"M"===r?r="L":"m"===r&&(r="l"),i.push(s)}return i}(e.getAttribute("d"));if(t.length<2)throw new Error(`Path doesn't have enough commands: ${JSON.stringify(t)}`);if("M"!==t[0].type)throw new Error(`Path starts with ${t[0].type} instead of M!`);let i={x:t[0].x,y:t[0].y};t.shift();const a=[];for(;t.length>0;){const e=t.shift();if("C"===e.type)a.push(new s.BezierSegment(i,{x:e.x1,y:e.y1},{x:e.x2,y:e.y2},{x:e.x,y:e.y})),i={x:e.x,y:e.y};else if("L"===e.type)a.push(new s.BezierSegment(i,i,{x:e.x,y:e.y},{x:e.x,y:e.y})),i={x:e.x,y:e.y};else if("H"===e.type)a.push(new s.BezierSegment(i,i,{x:e.x,y:i.y},{x:e.x,y:i.y})),i={x:e.x,y:i.y};else if("V"===e.type)a.push(new s.BezierSegment(i,i,{x:i.x,y:e.y},{x:i.x,y:e.y})),i={x:i.x,y:e.y};else if("Z"!==e.type)throw new Error(`Unsupported path command ${e.type}; use only H, V, M, L, C, Z!`)}return new r.BezierPath(a)},t.createFromLine=e=>{const[t,i,n,a]=["x1","x2","y1","y2"].map((t=>parseFloat(e.getAttribute(t)||"0")));return new r.BezierPath([new s.BezierSegment({x:t,y:n},{x:t,y:n},{x:i,y:a},{x:i,y:a})])},t.createFromCircle=e=>{const[t,i,n]=["cx","cy","r"].map((t=>parseFloat(e.getAttribute(t)||"0"))),a=1.3;return new r.BezierPath([new s.BezierSegment({x:t-n,y:i},{x:t-n,y:i-a*n},{x:t+n,y:i-a*n},{x:t+n,y:i}),new s.BezierSegment({x:t+n,y:i},{x:t+n,y:i+a*n},{x:t-n,y:i+a*n},{x:t-n,y:i})])},t.createFromElement=e=>{const i=e.tagName.toLowerCase();if("path"===i)return(0,t.createFromPath)(e);if("line"===i)return(0,t.createFromLine)(e);if("circle"===i)return(0,t.createFromCircle)(e);throw new Error(`Unsupported SVG tag: ${i}`)},t.create=e=>{const t=[];for(let i=1;i<e.length;i++){const r=e[i-1],n=e[i];t.push(new s.BezierSegment(r.pt,r.right||r.pt,n.left||n.pt,n.pt))}return new r.BezierPath(t)},t.createFromCommands=e=>{const t=e.slice();if(t.length<2)throw new Error(`Path doesn't have enough commands: ${JSON.stringify(t)}`);if("M"!==t[0].type)throw new Error(`Path starts with ${t[0].type} instead of M!`);let i={x:t[0].x,y:t[0].y},n=Object.assign({},i);const a=[];for(;t.length>0;){const e=t.shift();if("M"===e.type)n={x:e.x,y:e.y},i=n;else if("C"===e.type)a.push(new s.BezierSegment(i,{x:e.x1,y:e.y1},{x:e.x2,y:e.y2},{x:e.x,y:e.y})),i={x:e.x,y:e.y};else if("L"===e.type)e.x===i.x&&e.y===i.y||a.push(new s.BezierSegment(i,i,{x:e.x,y:e.y},{x:e.x,y:e.y})),i={x:e.x,y:e.y};else if("H"===e.type)e.x!==i.x&&a.push(new s.BezierSegment(i,i,{x:e.x,y:i.y},{x:e.x,y:i.y})),i={x:e.x,y:i.y};else if("V"===e.type)e.y!==i.y&&a.push(new s.BezierSegment(i,i,{x:i.x,y:e.y},{x:i.x,y:e.y})),i={x:i.x,y:e.y};else if("Q"===e.type)a.push(new s.BezierSegment(i,{x:i.x+2/3*(e.x1-i.x),y:i.y+2/3*(e.y1-i.y)},{x:e.x+2/3*(e.x1-e.x),y:e.y+2/3*(e.y1-e.y)},{x:e.x,y:e.y})),i={x:e.x,y:e.y};else{if("Z"!==e.type)throw new Error(`Unsupported path command ${e.type}; use only H, V, M, L, C, Z!`);Math.hypot(i.x-n.x,i.y-n.y)>0&&a.push(new s.BezierSegment(i,i,n,n))}}return new r.BezierPath(a)}},821:function(e,t,i){var r=this&&this.__createBinding||(Object.create?function(e,t,i,r){void 0===r&&(r=i);var s=Object.getOwnPropertyDescriptor(t,i);s&&!("get"in s?!t.__esModule:s.writable||s.configurable)||(s={enumerable:!0,get:function(){return t[i]}}),Object.defineProperty(e,r,s)}:function(e,t,i,r){void 0===r&&(r=i),e[r]=t[i]}),s=this&&this.__exportStar||function(e,t){for(var i in e)"default"===i||Object.prototype.hasOwnProperty.call(t,i)||r(t,e,i)};Object.defineProperty(t,"__esModule",{value:!0}),s(i(177),t),s(i(558),t),s(i(729),t),s(i(856),t)},856:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0})},188:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.times=void 0,t.times=function(e){const t=[];for(let i=0;i<e;i++)t.push(i);return t}}},t={};return function i(r){var s=t[r];if(void 0!==s)return s.exports;var n=t[r]={exports:{}};return e[r].call(n.exports,n,n.exports,i),n.exports}(821)})()))}(Sh);var Fh=Sh.exports;const Th={M:2,L:2,C:6,Q:4},Mh=["ttf","otf","woff"],kh=new RegExp(`\\.(${Mh.join("|")})`,"i"),Ih=new RegExp(`([^/]+)(\\.(?:${Mh.join("|")}))`,"i"),Bh="Sorry, only TTF, OTF and WOFF files are supported.",Lh=["weight","stretch","style"];let Ph=0;class Oh{constructor(e,t,i,r,s){if(!(t instanceof FontFace))throw Error("FontFace is required");this._pInst=e,this.name=i,this.path=r,this.data=s,this.face=t,this.id=Ph++}static hasGlyphData(e){let{font:t}=e;return"object"==typeof t&&void 0!==t.data}fontBounds(e,t,i,r,s,n){({width:r,height:s,options:n}=this._parseArgs(r,s,n));let a=n?.graphics?._renderer||this._pInst._renderer;if(!a)throw Error("p5 or graphics required for fontBounds()");return a.fontBounds(e,t,i,r,s)}textBounds(e,t,i,r,s,n){({width:r,height:s,options:n}=this._parseArgs(r,s,n));let a=n?.graphics?._renderer||this._pInst._renderer;if(!a)throw Error("p5 or graphics required for fontBounds()");return a.textBounds(e,t,i,r,s)}textToPaths(e,t,i,r,s,n){if(({width:r,height:s,options:n}=this._parseArgs(r,s,n)),!this.data)throw Error('No font data available for "'+this.name+'"\nTry downloading a local copy of the font file');return this._lineateAndPathify(e,t,i,r,s,n).map((e=>e.glyphs)).flat().map((e=>e.path.commands)).flat()}textToPoints(e,t,i,r,s,n){return this.textToContours(e,t,i,r,s,n).reduce(((e,t)=>(e.push(...t),e)),[])}textToContours(e,t=0,i=0,r,s,n){({width:r,height:s,options:n}=this._parseArgs(r,s,n));const a=this.textToPaths(e,t,i,r,s,n),o=[];for(const e of a)"M"===e[0]&&o.push([]),o[o.length-1].push(e);return o.map((e=>function(e,t,i){const r=(e,t)=>{if("object"!=typeof e)e=t;else for(const i in t)void 0===e[i]&&(e[i]=t[i]);return e},s=(e,t)=>{const i=e.length;return e[t<0?t%i+i:t%i]},n=(e,t)=>{t=t||0;let i=0;for(let r=e.length-1;e.length>3&&r>=0;--r)collinear(s(e,r-1),s(e,r),s(e,r+1),t)&&(e.splice(r%e.length,1),i++);return i},a=Fh.createFromCommands(Gh(e));let o=r(t,{sampleFactor:.1,simplifyThreshold:0});const h=Math.max(1,Math.ceil(a.getTotalLength()*o.sampleFactor));let u=[];const l=i._pInst.angleMode(),c=i._pInst.DEGREES;for(let e=0;e<h;e++){const t=a.getTotalLength()*(1===h?0:e/(h-1));u.push({...a.getPointAtLength(t),get angle(){const e=a.getAngleAtLength(t);return l===c?180*e/Math.PI:e},get alpha(){return this.angle}})}o.simplifyThreshold&&n(u,o.simplifyThreshold);return u}(e,n,this)))}textToModel(e,t,i,r,s,n){({width:r,height:s,options:n}=this._parseArgs(r,s,n));const a=n?.extrude||0,o=this.textToContours(e,t,i,r,s,n),h=this._pInst.buildGeometry((()=>{if(0===a){this._pInst.beginShape(),this._pInst.normal(0,0,1);for(const e of o){this._pInst.beginContour();for(const{x:t,y:i}of e)this._pInst.vertex(t,i);this._pInst.endContour(this._pInst.CLOSE)}this._pInst.endShape()}else{for(const e of[1,-1]){this._pInst.beginShape();for(const t of o){this._pInst.beginContour();for(const{x:i,y:r}of t)this._pInst.vertex(i,r,e*a*.5);this._pInst.endContour(this._pInst.CLOSE)}this._pInst.endShape(),this._pInst.beginShape()}for(const e of o){this._pInst.beginShape(this._pInst.QUAD_STRIP);for(const t of e)for(const e of[-1,1])this._pInst.vertex(t.x,t.y,e*a*.5);this._pInst.endShape()}}}));if(0!==a){h.computeNormals();for(const e of h.faces)if(e.every((e=>h.vertices[e].z<=.5*-a+.1))){for(const t of e)h.vertexNormals[t].set(0,0,-1);e.reverse()}}return h}variations(){let e={};if(this.data){let t=this.face?.axes;t&&t.forEach((t=>{e[t.tag]=t.value}))}return Lh.forEach((t=>{let i=this.face[t];"normal"!==i&&(e[t]=e[t]||i)})),e}metadata(){let e=this.data?.name||{};for(let t in this.face)/^load/.test(t)||(e[t]=e[t]||this.face[t]);return e}static async list(e=!1){if(e){console.log("There are",document.fonts.size,"font-faces\n");let e=0;for(let t of document.fonts.values()){console.log("FontFace: {");for(let e in t)console.log(" "+e+": "+t[e]);console.log("}\n"),"loaded"===t.status&&e++}console.log(e+" loaded")}return await Array.from(document.fonts)}_verticalAlign(e){const{sCapHeight:t}=this.data?.["OS/2"]||{},{unitsPerEm:i=1e3}=this.data?.head||{},{ascender:r=0,descender:s=0}=this.data?.hhea||{};return((t||r+s)/2-r/2)*e/i}_lineateAndPathify(e,t,i,r,s,n={}){let a=n?.graphics?._renderer||this._pInst._renderer,o=a.drawingContext.textBaseline,{lines:h,bounds:u}=a._computeBounds(Ja,e,t,i,r,s,{ignoreRectMode:!0,...n});h=this._position(a,h,u,r,s);let l=this.data?.head?.unitsPerEm||1e3,c=a.states.textSize/l;const p=this._currentAxes(a);let d=h.map((e=>this._lineToGlyphs(e,{scale:c,axs:p})));return a.drawingContext.textBaseline=o,d}_currentAxes(e){let t;if((this.data?.fvar?.length??0)>0){t=this.data.fvar[0].map((([t,i,r,s,n,a])=>{if(!e)return r;if("wght"===t)return e.states.fontWeight;if("wdth"===t)return 100;if(e.textCanvas().style.fontVariationSettings){const i=new RegExp(`\\b${t}s+(d+)`).exec(e.textCanvas().style.fontVariationSettings);return i?parseInt(i[1]):r}return r}))}return t}_textToPathPoints(e,t,i,r,s,n){({width:r,height:s,options:n}=this._parseArgs(r,s,n));let a=this.textToPaths(e,t,i,r,s,n);const o=(e,t,i,r)=>{if(fn.dist(t.x,t.y,i.x,i.y)>r){let s={x:(t.x+i.x)/2,y:(t.y+i.y)/2};e.push(s),o(e,t,s,r),o(e,s,i,r)}};let h=[],{textSize:u}=this._pInst._renderer.states,l=u/this.data.head.unitsPerEm*500;for(let e=0;e<a.length;e++){let{type:t,data:i}=a[e];if("Z"!==t){let e={x:i[i.length-2],y:i[i.length-1]};"L"===t&&h.length&&!n?.nodivide>0&&o(h,h[h.length-1],e,l),h.push(e)}}return h}_parseArgs(e,t,i={}){return"object"==typeof e?(i=e,e=t=void 0):"object"==typeof t&&(i=t,t=void 0),{width:e,height:t,options:i}}_position(e,t,i,r,s){let{textAlign:n,textLeading:a}=e.states,o=this._measureTextDefault(e,"X").fontBoundingBoxAscent;return t.map(((t,h)=>{let u=i.x,l=i.y+h*a+o,c=e._fontWidthSingle(t);if(n===A?u+=(i.w-c)/2:n===D&&(u+=i.w-c),void 0!==r)switch(e.states.rectMode){case A:u-=r/2,l-=s/2;break;case C:u-=r,l-=s}return{text:t,x:u,y:l}}))}_lineToGlyphs(e,{scale:t=1,axs:i}={}){if(!this.data)throw Error('No font data available for "'+this.name+'"\nTry downloading a local copy of the font file');let r=Ah.U.shape(this.data,e.text,{axs:i});return e.glyphShapes=r,e.glyphs=this._shapeToPaths(r,e,{scale:t,axs:i}),e}_positionGlyphs(e,t){let i=t?.graphics?._renderer||this._pInst._renderer;const r=this._currentAxes(i),s=Ah.U.shape(this.data,e,{axs:r}),n=[];let a=0;for(const e of s)n.push({x:a,index:e.g,shape:e}),a+=e.ax;return n}_singleShapeToPath(e,{scale:t=1,x:i=0,y:r=0,lineX:s=0,lineY:n=0,axs:a}={}){let o=this.data,h=0,{g:u,ax:l,ay:c,dx:p,dy:d}=e,{crds:f,cmds:g}=Ah.U.glyphToPath(o,u,!0,a),m={path:{commands:[]}};for(let e=0;e<g.length;e++){let a=g[e],o=[a];if(a in Th){let e=Th[a];for(let a=0;a<e;a+=2){let e=s+(f[a+h]+i+p)*t,u=n+(f[a+h+1]+r+d)*-t;o.push(e),o.push(u)}h+=e}m.path.commands.push(o)}return{glyph:m,ax:l,ay:c}}_shapeToPaths(e,t,{scale:i=1,axs:r}={}){let s=0,n=0,a=[];if(e.length!==t.text.length)throw Error("Invalid shape data");for(let o=0;o<e.length;o++){const{glyph:h,ax:u,ay:l}=this._singleShapeToPath(e[o],{scale:i,x:s,y:n,lineX:t.x,lineY:t.y,axs:r});a.push(h),s+=u,n+=l}return a}_measureTextDefault(e,t){let{textAlign:i,textBaseline:r}=e.states,s=e.textDrawingContext();s.textAlign="left",s.textBaseline="alphabetic";let n=s.measureText(t);return s.textAlign=i,s.textBaseline=r,n}drawPaths(e,t,i){e.strokeStyle=i?.stroke||e.strokeStyle,e.fillStyle=i?.fill||e.fillStyle,e.beginPath(),t.forEach((([t,...i])=>{"M"===t?e.moveTo(...i):"L"===t?e.lineTo(...i):"C"===t?e.bezierCurveTo(...i):"Q"===t?e.quadraticCurveTo(...i):"Z"===t&&e.closePath()})),i?.fill&&e.fill(),i?.stroke&&e.stroke()}_pathsToCommands(e,t){let i=[];for(let r=0;r<e.length;r++){let s=e[r],{x:n,y:a,path:o}=s,{crds:h,cmds:u}=o;for(let e=0,r=0;r<u.length;r++){let s=u[r],o={type:s,data:[]};if("M"==s||"L"==s)o.data.push(n+h[e]*t,a+h[e+1]*-t),e+=2;else if("C"==s){for(let i=0;i<6;i+=2)o.data.push(n+h[e+i]*t,a+h[e+i+1]*-t);e+=6}else if("Q"==s){for(let i=0;i<4;i+=2)o.data.push(n+h[e+i]*t,a+h[e+i+1]*-t);e+=4}i.push(o)}}return i}}async function Nh(e,t,i,r,s){let n=function(e,t,i,r){e.includes(" ")&&(e="'"+e+"'");let s=r?._compressedData??r?._data;if(!s){if(!kh.test(t))throw Error(Bh);t.startsWith("url(")||(t="url("+t+")"),s=t}if((r?.fvar?.length??0)>0){i=i||{};for(const[e,t,s,n,a,o]of r.fvar[0])"wght"===e?i.weight=`${t} ${n}`:"wdth"===e&&(i.stretch=`${t}% ${n}%`)}let n=new FontFace(e,s,i);if("error"===n.status)throw Error('Failed to create FontFace for "'+e+'"');return n}(t,i,r,s);return"loaded"!==n.status&&await n.load(),document.fonts.add(n),new Oh(e,n,t,i,s)}function Rh(e){return(e.startsWith('"')||e.startsWith("'"))&&e.at(0)===e.at(-1)?e.slice(1,-1).replace(/\/(['"])/g,"$1"):e}function Vh(...e){let t,i,r,s,n=e.shift();"string"==typeof n&&0!==n.length||p5._friendlyError(Bh,"p5.loadFont"),"string"==typeof e[0]&&(t=e.shift());for(let t=0;t<e.length;t++){const n=e[t];"function"==typeof n?i?r=n:i=n:"object"==typeof n&&(s=n)}return{path:n,name:t,success:i,error:r,options:s}}function Uh(e,t){e.Font=Oh,t.parseFontData=async function(e){let i=e instanceof Uint8Array?e:await t.loadBytes(e);if(!i)throw Error("Failed to load font data");let r=Ah.parse(i);if(0===r.length||void 0===r[0].cmap)throw Error("parsing font data");return r[0]},t.loadFont=async function(...e){let i,{path:r,name:s,success:n,error:a,options:{sets:o,...h}={}}=Vh(...e),u=r.includes("@font-face");if(!u){const e=await fetch(r,{method:"HEAD"}),t=e.headers.get("content-type")?.startsWith("text/css");t&&(u=!0,r=await fetch(r).then((e=>e.text())))}if(u){const e=new CSSStyleSheet;await e.replace(r);const i=[];for(const r of e.cssRules)if(r instanceof CSSFontFaceRule){const e=r.style;let s=Rh(e.getPropertyValue("font-family"));const n=e.getPropertyValue("src"),a={...h||{}};for(const t of e){if("font-family"===t||"src"===t)continue;const i=t.replace(/^font-/,"").split("-").map(((e,t)=>0===t?e:`${e[0].toUpperCase()}${e.slice(1)}`)).join("");a[i]=e.getPropertyValue(t)}i.push({name:s,src:n,fontDescriptors:a,loadWithData:async()=>{let e;try{const i=/url\(([^\)]+)\)/.exec(n);if(i){let r=i[1];/^['"]/.exec(r)&&r.at(0)===r.at(-1)&&(r=r.slice(1,-1)),e=await t.parseFontData(r)}}catch(e){}return Nh(this,s,n,a,e)},loadWithoutData:()=>Nh(this,s,n,a)})}o=o||["latin"];const s=(o instanceof Array?o:[o]).map((e=>e.toLowerCase())),n=ao.filter((e=>s.some((t=>e.category.includes(t)&&e.category.includes("ext")===t.includes("ext"))))),a=new Set(no.parse(n.map((e=>`U+${e.hexrange[0]}-${e.hexrange[1]}`))));let u,l=0,c=0;for(const e of i){if(!e.fontDescriptors.unicodeRange)continue;const t=[...new Set(no.parse(e.fontDescriptors.unicodeRange.split(/,\s*/g))).values()].filter((e=>a.has(e))).length,i={style:"normal",weight:400,...h},r=Object.keys(e.fontDescriptors).filter((t=>e.fontDescriptors[t]===i[t])).length;(r>c||r===c&&t>=l)&&(c=r,l=t,u=e)}const p=u||i.at(-1);for(const e of i)e!==p&&e.loadWithoutData();return p?.loadWithData()}try{const e=await t.parseFontData(r);s=s||function(e,t){let i,r=e?.name;if(r){if(r.fullName)return r.fullName;r.familyName&&(i=r.familyName)}if(!i){let e=Ih.exec(t);i=e&&e.length>=3?e[1]:t}return i.includes(" ")&&(i=i.replace(/ /g,"_")),i}(e,r),i=await Nh(this,s,r,h,e)}catch(e){let t=s||r.substring(r.lastIndexOf("/")+1).replace(/\.[^/.]+$/,"");console.warn(`WARN: No glyph data for '${t}', retrying as FontFace`);try{i=await Nh(this,t,r,h)}catch(e){if(a)return a(e);throw e}}return n?n(i):i}}const Gh=e=>e.map((e=>{const t=e[0];switch(t){case"Z":return{type:t};case"M":case"L":{const[,i,r]=e;return{type:t,x:i,y:r}}case"Q":{const[,i,r,s,n]=e;return{type:t,x1:i,y1:r,x:s,y:n}}case"C":{const[,i,r,s,n,a,o]=e;return{type:t,x1:i,y1:r,x2:s,y2:n,x:a,y:o}}default:throw new Error(`Unexpected path command: ${t}`)}}));void 0!==p5&&Uh(p5,p5.prototype);var zh=[509,0,227,0,150,4,294,9,1368,2,2,1,6,3,41,2,5,0,166,1,574,3,9,9,7,9,32,4,318,1,80,3,71,10,50,3,123,2,54,14,32,10,3,1,11,3,46,10,8,0,46,9,7,2,37,13,2,9,6,1,45,0,13,2,49,13,9,3,2,11,83,11,7,0,3,0,158,11,6,9,7,3,56,1,2,6,3,1,3,2,10,0,11,1,3,6,4,4,68,8,2,0,3,0,2,3,2,4,2,0,15,1,83,17,10,9,5,0,82,19,13,9,214,6,3,8,28,1,83,16,16,9,82,12,9,9,7,19,58,14,5,9,243,14,166,9,71,5,2,1,3,3,2,0,2,1,13,9,120,6,3,6,4,0,29,9,41,6,2,3,9,0,10,10,47,15,343,9,54,7,2,7,17,9,57,21,2,13,123,5,4,0,2,1,2,6,2,0,9,9,49,4,2,1,2,4,9,9,330,3,10,1,2,0,49,6,4,4,14,10,5350,0,7,14,11465,27,2343,9,87,9,39,4,60,6,26,9,535,9,470,0,2,54,8,3,82,0,12,1,19628,1,4178,9,519,45,3,22,543,4,4,5,9,7,3,6,31,3,149,2,1418,49,513,54,5,49,9,0,15,0,23,4,2,14,1361,6,2,16,3,6,2,1,2,4,101,0,161,6,10,9,357,0,62,13,499,13,245,1,2,9,726,6,110,6,6,9,4759,9,787719,239],jh=[0,11,2,25,2,18,2,1,2,14,3,13,35,122,70,52,268,28,4,48,48,31,14,29,6,37,11,29,3,35,5,7,2,4,43,157,19,35,5,35,5,39,9,51,13,10,2,14,2,6,2,1,2,10,2,14,2,6,2,1,4,51,13,310,10,21,11,7,25,5,2,41,2,8,70,5,3,0,2,43,2,1,4,0,3,22,11,22,10,30,66,18,2,1,11,21,11,25,71,55,7,1,65,0,16,3,2,2,2,28,43,28,4,28,36,7,2,27,28,53,11,21,11,18,14,17,111,72,56,50,14,50,14,35,39,27,10,22,251,41,7,1,17,2,60,28,11,0,9,21,43,17,47,20,28,22,13,52,58,1,3,0,14,44,33,24,27,35,30,0,3,0,9,34,4,0,13,47,15,3,22,0,2,0,36,17,2,24,20,1,64,6,2,0,2,3,2,14,2,9,8,46,39,7,3,1,3,21,2,6,2,1,2,4,4,0,19,0,13,4,31,9,2,0,3,0,2,37,2,0,26,0,2,0,45,52,19,3,21,2,31,47,21,1,2,0,185,46,42,3,37,47,21,0,60,42,14,0,72,26,38,6,186,43,117,63,32,7,3,0,3,7,2,1,2,23,16,0,2,0,95,7,3,38,17,0,2,0,29,0,11,39,8,0,22,0,12,45,20,0,19,72,200,32,32,8,2,36,18,0,50,29,113,6,2,1,2,37,22,0,26,5,2,1,2,31,15,0,328,18,16,0,2,12,2,33,125,0,80,921,103,110,18,195,2637,96,16,1071,18,5,26,3994,6,582,6842,29,1763,568,8,30,18,78,18,29,19,47,17,3,32,20,6,18,433,44,212,63,129,74,6,0,67,12,65,1,2,0,29,6135,9,1237,42,9,8936,3,2,6,2,1,2,290,16,0,30,2,3,0,15,3,9,395,2309,106,6,12,4,8,8,9,5991,84,2,70,2,1,3,0,3,1,3,3,2,11,2,0,2,6,2,64,2,3,3,7,2,6,2,27,2,3,2,4,2,0,4,6,2,339,3,24,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,7,1845,30,7,5,262,61,147,44,11,6,17,0,322,29,19,43,485,27,229,29,3,0,496,6,2,3,2,1,2,14,2,196,60,67,8,0,1205,3,2,26,2,1,2,0,3,0,2,9,2,3,2,0,2,0,7,0,5,0,2,0,2,0,2,2,2,1,2,0,3,0,2,0,2,0,2,0,2,0,2,1,2,0,3,3,2,6,2,3,2,3,2,0,2,9,2,16,6,2,2,4,2,16,4421,42719,33,4153,7,221,3,5761,15,7472,16,621,2467,541,1507,4938,6,4191],$h="ªµºÀ-ÖØ-öø-ˁˆ-ˑˠ-ˤˬˮͰ-ʹͶͷͺ-ͽͿΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ҁҊ-ԯԱ-Ֆՙՠ-ֈא-תׯ-ײؠ-يٮٯٱ-ۓەۥۦۮۯۺ-ۼۿܐܒ-ܯݍ-ޥޱߊ-ߪߴߵߺࠀ-ࠕࠚࠤࠨࡀ-ࡘࡠ-ࡪࡰ-ࢇࢉ-ࢎࢠ-ࣉऄ-हऽॐक़-ॡॱ-ঀঅ-ঌএঐও-নপ-রলশ-হঽৎড়ঢ়য়-ৡৰৱৼਅ-ਊਏਐਓ-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹਖ਼-ੜਫ਼ੲ-ੴઅ-ઍએ-ઑઓ-નપ-રલળવ-હઽૐૠૡૹଅ-ଌଏଐଓ-ନପ-ରଲଳଵ-ହଽଡ଼ଢ଼ୟ-ୡୱஃஅ-ஊஎ-ஐஒ-கஙசஜஞடணதந-பம-ஹௐఅ-ఌఎ-ఐఒ-నప-హఽౘ-ౚౝౠౡಀಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹಽೝೞೠೡೱೲഄ-ഌഎ-ഐഒ-ഺഽൎൔ-ൖൟ-ൡൺ-ൿඅ-ඖක-නඳ-රලව-ෆก-ะาำเ-ๆກຂຄຆ-ຊຌ-ຣລວ-ະາຳຽເ-ໄໆໜ-ໟༀཀ-ཇཉ-ཬྈ-ྌက-ဪဿၐ-ၕၚ-ၝၡၥၦၮ-ၰၵ-ႁႎႠ-ჅჇჍა-ჺჼ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚᎀ-ᎏᎠ-Ᏽᏸ-ᏽᐁ-ᙬᙯ-ᙿᚁ-ᚚᚠ-ᛪᛮ-ᛸᜀ-ᜑᜟ-ᜱᝀ-ᝑᝠ-ᝬᝮ-ᝰក-ឳៗៜᠠ-ᡸᢀ-ᢨᢪᢰ-ᣵᤀ-ᤞᥐ-ᥭᥰ-ᥴᦀ-ᦫᦰ-ᧉᨀ-ᨖᨠ-ᩔᪧᬅ-ᬳᭅ-ᭌᮃ-ᮠᮮᮯᮺ-ᯥᰀ-ᰣᱍ-ᱏᱚ-ᱽᲀ-ᲊᲐ-ᲺᲽ-Ჿᳩ-ᳬᳮ-ᳳᳵᳶᳺᴀ-ᶿḀ-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼⁱⁿₐ-ₜℂℇℊ-ℓℕ℘-ℝℤΩℨK-ℹℼ-ℿⅅ-ⅉⅎⅠ-ↈⰀ-ⳤⳫ-ⳮⳲⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯⶀ-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞ々-〇〡-〩〱-〵〸-〼ぁ-ゖ゛-ゟァ-ヺー-ヿㄅ-ㄯㄱ-ㆎㆠ-ㆿㇰ-ㇿ㐀-䶿一-ꒌꓐ-ꓽꔀ-ꘌꘐ-ꘟꘪꘫꙀ-ꙮꙿ-ꚝꚠ-ꛯꜗ-ꜟꜢ-ꞈꞋ-ꟍꟐꟑꟓꟕ-Ƛꟲ-ꠁꠃ-ꠅꠇ-ꠊꠌ-ꠢꡀ-ꡳꢂ-ꢳꣲ-ꣷꣻꣽꣾꤊ-ꤥꤰ-ꥆꥠ-ꥼꦄ-ꦲꧏꧠ-ꧤꧦ-ꧯꧺ-ꧾꨀ-ꨨꩀ-ꩂꩄ-ꩋꩠ-ꩶꩺꩾ-ꪯꪱꪵꪶꪹ-ꪽꫀꫂꫛ-ꫝꫠ-ꫪꫲ-ꫴꬁ-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꬰ-ꭚꭜ-ꭩꭰ-ꯢ가-힣ힰ-ퟆퟋ-ퟻ豈-舘並-龎ff-stﬓ-ﬗיִײַ-ﬨשׁ-זּטּ-לּמּנּסּףּפּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻﹰ-ﹴﹶ-ﻼA-Za-zヲ-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ",Wh={3:"abstract boolean byte char class double enum export extends final float goto implements import int interface long native package private protected public short static super synchronized throws transient volatile",5:"class enum extends super const export import",6:"enum",strict:"implements interface let package private protected public static yield",strictBind:"eval arguments"},qh="break case catch continue debugger default do else finally for function if return switch throw try var while with null true false instanceof typeof void delete new in this",Hh={5:qh,"5module":qh+" export import",6:qh+" const class extends export import super"},Xh=/^in(stanceof)?$/,Yh=new RegExp("["+$h+"]"),Zh=new RegExp("["+$h+"‌‍·̀-ͯ·҃-֑҇-ׇֽֿׁׂׅׄؐ-ًؚ-٩ٰۖ-ۜ۟-۪ۤۧۨ-ۭ۰-۹ܑܰ-݊ަ-ް߀-߉߫-߽߳ࠖ-࠙ࠛ-ࠣࠥ-ࠧࠩ-࡙࠭-࡛ࢗ-࢟࣊-ࣣ࣡-ःऺ-़ा-ॏ॑-ॗॢॣ०-९ঁ-ঃ়া-ৄেৈো-্ৗৢৣ০-৯৾ਁ-ਃ਼ਾ-ੂੇੈੋ-੍ੑ੦-ੱੵઁ-ઃ઼ા-ૅે-ૉો-્ૢૣ૦-૯ૺ-૿ଁ-ଃ଼ା-ୄେୈୋ-୍୕-ୗୢୣ୦-୯ஂா-ூெ-ைொ-்ௗ௦-௯ఀ-ఄ఼ా-ౄె-ైొ-్ౕౖౢౣ౦-౯ಁ-ಃ಼ಾ-ೄೆ-ೈೊ-್ೕೖೢೣ೦-೯ೳഀ-ഃ഻഼ാ-ൄെ-ൈൊ-്ൗൢൣ൦-൯ඁ-ඃ්ා-ුූෘ-ෟ෦-෯ෲෳัิ-ฺ็-๎๐-๙ັິ-ຼ່-໎໐-໙༘༙༠-༩༹༵༷༾༿ཱ-྄྆྇ྍ-ྗྙ-ྼ࿆ါ-ှ၀-၉ၖ-ၙၞ-ၠၢ-ၤၧ-ၭၱ-ၴႂ-ႍႏ-ႝ፝-፟፩-፱ᜒ-᜕ᜲ-᜴ᝒᝓᝲᝳ឴-៓៝០-៩᠋-᠍᠏-᠙ᢩᤠ-ᤫᤰ-᤻᥆-᥏᧐-᧚ᨗ-ᨛᩕ-ᩞ᩠-᩿᩼-᪉᪐-᪙᪰-᪽ᪿ-ᫎᬀ-ᬄ᬴-᭄᭐-᭙᭫-᭳ᮀ-ᮂᮡ-ᮭ᮰-᮹᯦-᯳ᰤ-᰷᱀-᱉᱐-᱙᳐-᳔᳒-᳨᳭᳴᳷-᳹᷀-᷿‌‍‿⁀⁔⃐-⃥⃜⃡-⃰⳯-⵿⳱ⷠ-〪ⷿ-゙゚〯・꘠-꘩꙯ꙴ-꙽ꚞꚟ꛰꛱ꠂ꠆ꠋꠣ-ꠧ꠬ꢀꢁꢴ-ꣅ꣐-꣙꣠-꣱ꣿ-꤉ꤦ-꤭ꥇ-꥓ꦀ-ꦃ꦳-꧀꧐-꧙ꧥ꧰-꧹ꨩ-ꨶꩃꩌꩍ꩐-꩙ꩻ-ꩽꪰꪲ-ꪴꪷꪸꪾ꪿꫁ꫫ-ꫯꫵ꫶ꯣ-ꯪ꯬꯭꯰-꯹ﬞ︀-️︠-︯︳︴﹍-﹏0-9_・]");function Kh(e,t){for(var i=65536,r=0;r<t.length;r+=2){if((i+=t[r])>e)return!1;if((i+=t[r+1])>=e)return!0}return!1}function Jh(e,t){return e<65?36===e:e<91||(e<97?95===e:e<123||(e<=65535?e>=170&&Yh.test(String.fromCharCode(e)):!1!==t&&Kh(e,jh)))}function Qh(e,t){return e<48?36===e:e<58||!(e<65)&&(e<91||(e<97?95===e:e<123||(e<=65535?e>=170&&Zh.test(String.fromCharCode(e)):!1!==t&&(Kh(e,jh)||Kh(e,zh)))))}var eu=function(e,t){void 0===t&&(t={}),this.label=e,this.keyword=t.keyword,this.beforeExpr=!!t.beforeExpr,this.startsExpr=!!t.startsExpr,this.isLoop=!!t.isLoop,this.isAssign=!!t.isAssign,this.prefix=!!t.prefix,this.postfix=!!t.postfix,this.binop=t.binop||null,this.updateContext=null};function tu(e,t){return new eu(e,{beforeExpr:!0,binop:t})}var iu={beforeExpr:!0},ru={startsExpr:!0},su={};function nu(e,t){return void 0===t&&(t={}),t.keyword=e,su[e]=new eu(e,t)}var au={num:new eu("num",ru),regexp:new eu("regexp",ru),string:new eu("string",ru),name:new eu("name",ru),privateId:new eu("privateId",ru),eof:new eu("eof"),bracketL:new eu("[",{beforeExpr:!0,startsExpr:!0}),bracketR:new eu("]"),braceL:new eu("{",{beforeExpr:!0,startsExpr:!0}),braceR:new eu("}"),parenL:new eu("(",{beforeExpr:!0,startsExpr:!0}),parenR:new eu(")"),comma:new eu(",",iu),semi:new eu(";",iu),colon:new eu(":",iu),dot:new eu("."),question:new eu("?",iu),questionDot:new eu("?."),arrow:new eu("=>",iu),template:new eu("template"),invalidTemplate:new eu("invalidTemplate"),ellipsis:new eu("...",iu),backQuote:new eu("`",ru),dollarBraceL:new eu("${",{beforeExpr:!0,startsExpr:!0}),eq:new eu("=",{beforeExpr:!0,isAssign:!0}),assign:new eu("_=",{beforeExpr:!0,isAssign:!0}),incDec:new eu("++/--",{prefix:!0,postfix:!0,startsExpr:!0}),prefix:new eu("!/~",{beforeExpr:!0,prefix:!0,startsExpr:!0}),logicalOR:tu("||",1),logicalAND:tu("&&",2),bitwiseOR:tu("|",3),bitwiseXOR:tu("^",4),bitwiseAND:tu("&",5),equality:tu("==/!=/===/!==",6),relational:tu("</>/<=/>=",7),bitShift:tu("<</>>/>>>",8),plusMin:new eu("+/-",{beforeExpr:!0,binop:9,prefix:!0,startsExpr:!0}),modulo:tu("%",10),star:tu("*",10),slash:tu("/",10),starstar:new eu("**",{beforeExpr:!0}),coalesce:tu("??",1),_break:nu("break"),_case:nu("case",iu),_catch:nu("catch"),_continue:nu("continue"),_debugger:nu("debugger"),_default:nu("default",iu),_do:nu("do",{isLoop:!0,beforeExpr:!0}),_else:nu("else",iu),_finally:nu("finally"),_for:nu("for",{isLoop:!0}),_function:nu("function",ru),_if:nu("if"),_return:nu("return",iu),_switch:nu("switch"),_throw:nu("throw",iu),_try:nu("try"),_var:nu("var"),_const:nu("const"),_while:nu("while",{isLoop:!0}),_with:nu("with"),_new:nu("new",{beforeExpr:!0,startsExpr:!0}),_this:nu("this",ru),_super:nu("super",ru),_class:nu("class",ru),_extends:nu("extends",iu),_export:nu("export"),_import:nu("import",ru),_null:nu("null",ru),_true:nu("true",ru),_false:nu("false",ru),_in:nu("in",{beforeExpr:!0,binop:7}),_instanceof:nu("instanceof",{beforeExpr:!0,binop:7}),_typeof:nu("typeof",{beforeExpr:!0,prefix:!0,startsExpr:!0}),_void:nu("void",{beforeExpr:!0,prefix:!0,startsExpr:!0}),_delete:nu("delete",{beforeExpr:!0,prefix:!0,startsExpr:!0})},ou=/\r\n?|\n|\u2028|\u2029/,hu=new RegExp(ou.source,"g");function uu(e){return 10===e||13===e||8232===e||8233===e}function lu(e,t,i){void 0===i&&(i=e.length);for(var r=t;r<i;r++){var s=e.charCodeAt(r);if(uu(s))return r<i-1&&13===s&&10===e.charCodeAt(r+1)?r+2:r+1}return-1}var cu=/[\u1680\u2000-\u200a\u202f\u205f\u3000\ufeff]/,pu=/(?:\s|\/\/.*|\/\*[^]*?\*\/)*/g,du=Object.prototype,fu=du.hasOwnProperty,gu=du.toString,mu=Object.hasOwn||function(e,t){return fu.call(e,t)},yu=Array.isArray||function(e){return"[object Array]"===gu.call(e)},xu=Object.create(null);function vu(e){return xu[e]||(xu[e]=new RegExp("^(?:"+e.replace(/ /g,"|")+")$"))}function bu(e){return e<=65535?String.fromCharCode(e):(e-=65536,String.fromCharCode(55296+(e>>10),56320+(1023&e)))}var _u=/(?:[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])/,wu=function(e,t){this.line=e,this.column=t};wu.prototype.offset=function(e){return new wu(this.line,this.column+e)};var Cu=function(e,t,i){this.start=t,this.end=i,null!==e.sourceFile&&(this.source=e.sourceFile)};function Du(e,t){for(var i=1,r=0;;){var s=lu(e,r,t);if(s<0)return new wu(i,t-r);++i,r=s}}var Eu={ecmaVersion:null,sourceType:"script",onInsertedSemicolon:null,onTrailingComma:null,allowReserved:null,allowReturnOutsideFunction:!1,allowImportExportEverywhere:!1,allowAwaitOutsideFunction:null,allowSuperOutsideMethod:null,allowHashBang:!1,checkPrivateFields:!0,locations:!1,onToken:null,onComment:null,ranges:!1,program:null,sourceFile:null,directSourceFile:null,preserveParens:!1},Au=!1;function Su(e){var t={};for(var i in Eu)t[i]=e&&mu(e,i)?e[i]:Eu[i];if("latest"===t.ecmaVersion?t.ecmaVersion=1e8:null==t.ecmaVersion?(!Au&&"object"==typeof console&&console.warn&&(Au=!0,console.warn("Since Acorn 8.0.0, options.ecmaVersion is required.\nDefaulting to 2020, but this will stop working in the future.")),t.ecmaVersion=11):t.ecmaVersion>=2015&&(t.ecmaVersion-=2009),null==t.allowReserved&&(t.allowReserved=t.ecmaVersion<5),e&&null!=e.allowHashBang||(t.allowHashBang=t.ecmaVersion>=14),yu(t.onToken)){var r=t.onToken;t.onToken=function(e){return r.push(e)}}return yu(t.onComment)&&(t.onComment=function(e,t){return function(i,r,s,n,a,o){var h={type:i?"Block":"Line",value:r,start:s,end:n};e.locations&&(h.loc=new Cu(this,a,o)),e.ranges&&(h.range=[s,n]),t.push(h)}}(t,t.onComment)),t}var Fu=256;function Tu(e,t){return 2|(e?4:0)|(t?8:0)}var Mu=function(e,t,i){this.options=e=Su(e),this.sourceFile=e.sourceFile,this.keywords=vu(Hh[e.ecmaVersion>=6?6:"module"===e.sourceType?"5module":5]);var r="";!0!==e.allowReserved&&(r=Wh[e.ecmaVersion>=6?6:5===e.ecmaVersion?5:3],"module"===e.sourceType&&(r+=" await")),this.reservedWords=vu(r);var s=(r?r+" ":"")+Wh.strict;this.reservedWordsStrict=vu(s),this.reservedWordsStrictBind=vu(s+" "+Wh.strictBind),this.input=String(t),this.containsEsc=!1,i?(this.pos=i,this.lineStart=this.input.lastIndexOf("\n",i-1)+1,this.curLine=this.input.slice(0,this.lineStart).split(ou).length):(this.pos=this.lineStart=0,this.curLine=1),this.type=au.eof,this.value=null,this.start=this.end=this.pos,this.startLoc=this.endLoc=this.curPosition(),this.lastTokEndLoc=this.lastTokStartLoc=null,this.lastTokStart=this.lastTokEnd=this.pos,this.context=this.initialContext(),this.exprAllowed=!0,this.inModule="module"===e.sourceType,this.strict=this.inModule||this.strictDirective(this.pos),this.potentialArrowAt=-1,this.potentialArrowInForAwait=!1,this.yieldPos=this.awaitPos=this.awaitIdentPos=0,this.labels=[],this.undefinedExports=Object.create(null),0===this.pos&&e.allowHashBang&&"#!"===this.input.slice(0,2)&&this.skipLineComment(2),this.scopeStack=[],this.enterScope(1),this.regexpState=null,this.privateNameStack=[]},ku={inFunction:{configurable:!0},inGenerator:{configurable:!0},inAsync:{configurable:!0},canAwait:{configurable:!0},allowSuper:{configurable:!0},allowDirectSuper:{configurable:!0},treatFunctionsAsVar:{configurable:!0},allowNewDotTarget:{configurable:!0},inClassStaticBlock:{configurable:!0}};Mu.prototype.parse=function(){var e=this.options.program||this.startNode();return this.nextToken(),this.parseTopLevel(e)},ku.inFunction.get=function(){return(2&this.currentVarScope().flags)>0},ku.inGenerator.get=function(){return(8&this.currentVarScope().flags)>0&&!this.currentVarScope().inClassFieldInit},ku.inAsync.get=function(){return(4&this.currentVarScope().flags)>0&&!this.currentVarScope().inClassFieldInit},ku.canAwait.get=function(){for(var e=this.scopeStack.length-1;e>=0;e--){var t=this.scopeStack[e];if(t.inClassFieldInit||t.flags&Fu)return!1;if(2&t.flags)return(4&t.flags)>0}return this.inModule&&this.options.ecmaVersion>=13||this.options.allowAwaitOutsideFunction},ku.allowSuper.get=function(){var e=this.currentThisScope(),t=e.flags,i=e.inClassFieldInit;return(64&t)>0||i||this.options.allowSuperOutsideMethod},ku.allowDirectSuper.get=function(){return(128&this.currentThisScope().flags)>0},ku.treatFunctionsAsVar.get=function(){return this.treatFunctionsAsVarInScope(this.currentScope())},ku.allowNewDotTarget.get=function(){var e=this.currentThisScope(),t=e.flags,i=e.inClassFieldInit;return(258&t)>0||i},ku.inClassStaticBlock.get=function(){return(this.currentVarScope().flags&Fu)>0},Mu.extend=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];for(var i=this,r=0;r<e.length;r++)i=e[r](i);return i},Mu.parse=function(e,t){return new this(t,e).parse()},Mu.parseExpressionAt=function(e,t,i){var r=new this(i,e,t);return r.nextToken(),r.parseExpression()},Mu.tokenizer=function(e,t){return new this(t,e)},Object.defineProperties(Mu.prototype,ku);var Iu=Mu.prototype,Bu=/^(?:'((?:\\[^]|[^'\\])*?)'|"((?:\\[^]|[^"\\])*?)")/;Iu.strictDirective=function(e){if(this.options.ecmaVersion<5)return!1;for(;;){pu.lastIndex=e,e+=pu.exec(this.input)[0].length;var t=Bu.exec(this.input.slice(e));if(!t)return!1;if("use strict"===(t[1]||t[2])){pu.lastIndex=e+t[0].length;var i=pu.exec(this.input),r=i.index+i[0].length,s=this.input.charAt(r);return";"===s||"}"===s||ou.test(i[0])&&!(/[(`.[+\-/*%<>=,?^&]/.test(s)||"!"===s&&"="===this.input.charAt(r+1))}e+=t[0].length,pu.lastIndex=e,e+=pu.exec(this.input)[0].length,";"===this.input[e]&&e++}},Iu.eat=function(e){return this.type===e&&(this.next(),!0)},Iu.isContextual=function(e){return this.type===au.name&&this.value===e&&!this.containsEsc},Iu.eatContextual=function(e){return!!this.isContextual(e)&&(this.next(),!0)},Iu.expectContextual=function(e){this.eatContextual(e)||this.unexpected()},Iu.canInsertSemicolon=function(){return this.type===au.eof||this.type===au.braceR||ou.test(this.input.slice(this.lastTokEnd,this.start))},Iu.insertSemicolon=function(){if(this.canInsertSemicolon())return this.options.onInsertedSemicolon&&this.options.onInsertedSemicolon(this.lastTokEnd,this.lastTokEndLoc),!0},Iu.semicolon=function(){this.eat(au.semi)||this.insertSemicolon()||this.unexpected()},Iu.afterTrailingComma=function(e,t){if(this.type===e)return this.options.onTrailingComma&&this.options.onTrailingComma(this.lastTokStart,this.lastTokStartLoc),t||this.next(),!0},Iu.expect=function(e){this.eat(e)||this.unexpected()},Iu.unexpected=function(e){this.raise(null!=e?e:this.start,"Unexpected token")};var Lu=function(){this.shorthandAssign=this.trailingComma=this.parenthesizedAssign=this.parenthesizedBind=this.doubleProto=-1};Iu.checkPatternErrors=function(e,t){if(e){e.trailingComma>-1&&this.raiseRecoverable(e.trailingComma,"Comma is not permitted after the rest element");var i=t?e.parenthesizedAssign:e.parenthesizedBind;i>-1&&this.raiseRecoverable(i,t?"Assigning to rvalue":"Parenthesized pattern")}},Iu.checkExpressionErrors=function(e,t){if(!e)return!1;var i=e.shorthandAssign,r=e.doubleProto;if(!t)return i>=0||r>=0;i>=0&&this.raise(i,"Shorthand property assignments are valid only in destructuring patterns"),r>=0&&this.raiseRecoverable(r,"Redefinition of __proto__ property")},Iu.checkYieldAwaitInDefaultParams=function(){this.yieldPos&&(!this.awaitPos||this.yieldPos<this.awaitPos)&&this.raise(this.yieldPos,"Yield expression cannot be a default value"),this.awaitPos&&this.raise(this.awaitPos,"Await expression cannot be a default value")},Iu.isSimpleAssignTarget=function(e){return"ParenthesizedExpression"===e.type?this.isSimpleAssignTarget(e.expression):"Identifier"===e.type||"MemberExpression"===e.type};var Pu=Mu.prototype;Pu.parseTopLevel=function(e){var t=Object.create(null);for(e.body||(e.body=[]);this.type!==au.eof;){var i=this.parseStatement(null,!0,t);e.body.push(i)}if(this.inModule)for(var r=0,s=Object.keys(this.undefinedExports);r<s.length;r+=1){var n=s[r];this.raiseRecoverable(this.undefinedExports[n].start,"Export '"+n+"' is not defined")}return this.adaptDirectivePrologue(e.body),this.next(),e.sourceType=this.options.sourceType,this.finishNode(e,"Program")};var Ou={kind:"loop"},Nu={kind:"switch"};Pu.isLet=function(e){if(this.options.ecmaVersion<6||!this.isContextual("let"))return!1;pu.lastIndex=this.pos;var t=pu.exec(this.input),i=this.pos+t[0].length,r=this.input.charCodeAt(i);if(91===r||92===r)return!0;if(e)return!1;if(123===r||r>55295&&r<56320)return!0;if(Jh(r,!0)){for(var s=i+1;Qh(r=this.input.charCodeAt(s),!0);)++s;if(92===r||r>55295&&r<56320)return!0;var n=this.input.slice(i,s);if(!Xh.test(n))return!0}return!1},Pu.isAsyncFunction=function(){if(this.options.ecmaVersion<8||!this.isContextual("async"))return!1;pu.lastIndex=this.pos;var e,t=pu.exec(this.input),i=this.pos+t[0].length;return!(ou.test(this.input.slice(this.pos,i))||"function"!==this.input.slice(i,i+8)||i+8!==this.input.length&&(Qh(e=this.input.charCodeAt(i+8))||e>55295&&e<56320))},Pu.parseStatement=function(e,t,i){var r,s=this.type,n=this.startNode();switch(this.isLet(e)&&(s=au._var,r="let"),s){case au._break:case au._continue:return this.parseBreakContinueStatement(n,s.keyword);case au._debugger:return this.parseDebuggerStatement(n);case au._do:return this.parseDoStatement(n);case au._for:return this.parseForStatement(n);case au._function:return e&&(this.strict||"if"!==e&&"label"!==e)&&this.options.ecmaVersion>=6&&this.unexpected(),this.parseFunctionStatement(n,!1,!e);case au._class:return e&&this.unexpected(),this.parseClass(n,!0);case au._if:return this.parseIfStatement(n);case au._return:return this.parseReturnStatement(n);case au._switch:return this.parseSwitchStatement(n);case au._throw:return this.parseThrowStatement(n);case au._try:return this.parseTryStatement(n);case au._const:case au._var:return r=r||this.value,e&&"var"!==r&&this.unexpected(),this.parseVarStatement(n,r);case au._while:return this.parseWhileStatement(n);case au._with:return this.parseWithStatement(n);case au.braceL:return this.parseBlock(!0,n);case au.semi:return this.parseEmptyStatement(n);case au._export:case au._import:if(this.options.ecmaVersion>10&&s===au._import){pu.lastIndex=this.pos;var a=pu.exec(this.input),o=this.pos+a[0].length,h=this.input.charCodeAt(o);if(40===h||46===h)return this.parseExpressionStatement(n,this.parseExpression())}return this.options.allowImportExportEverywhere||(t||this.raise(this.start,"'import' and 'export' may only appear at the top level"),this.inModule||this.raise(this.start,"'import' and 'export' may appear only with 'sourceType: module'")),s===au._import?this.parseImport(n):this.parseExport(n,i);default:if(this.isAsyncFunction())return e&&this.unexpected(),this.next(),this.parseFunctionStatement(n,!0,!e);var u=this.value,l=this.parseExpression();return s===au.name&&"Identifier"===l.type&&this.eat(au.colon)?this.parseLabeledStatement(n,u,l,e):this.parseExpressionStatement(n,l)}},Pu.parseBreakContinueStatement=function(e,t){var i="break"===t;this.next(),this.eat(au.semi)||this.insertSemicolon()?e.label=null:this.type!==au.name?this.unexpected():(e.label=this.parseIdent(),this.semicolon());for(var r=0;r<this.labels.length;++r){var s=this.labels[r];if(null==e.label||s.name===e.label.name){if(null!=s.kind&&(i||"loop"===s.kind))break;if(e.label&&i)break}}return r===this.labels.length&&this.raise(e.start,"Unsyntactic "+t),this.finishNode(e,i?"BreakStatement":"ContinueStatement")},Pu.parseDebuggerStatement=function(e){return this.next(),this.semicolon(),this.finishNode(e,"DebuggerStatement")},Pu.parseDoStatement=function(e){return this.next(),this.labels.push(Ou),e.body=this.parseStatement("do"),this.labels.pop(),this.expect(au._while),e.test=this.parseParenExpression(),this.options.ecmaVersion>=6?this.eat(au.semi):this.semicolon(),this.finishNode(e,"DoWhileStatement")},Pu.parseForStatement=function(e){this.next();var t=this.options.ecmaVersion>=9&&this.canAwait&&this.eatContextual("await")?this.lastTokStart:-1;if(this.labels.push(Ou),this.enterScope(0),this.expect(au.parenL),this.type===au.semi)return t>-1&&this.unexpected(t),this.parseFor(e,null);var i=this.isLet();if(this.type===au._var||this.type===au._const||i){var r=this.startNode(),s=i?"let":this.value;return this.next(),this.parseVar(r,!0,s),this.finishNode(r,"VariableDeclaration"),(this.type===au._in||this.options.ecmaVersion>=6&&this.isContextual("of"))&&1===r.declarations.length?(this.options.ecmaVersion>=9&&(this.type===au._in?t>-1&&this.unexpected(t):e.await=t>-1),this.parseForIn(e,r)):(t>-1&&this.unexpected(t),this.parseFor(e,r))}var n=this.isContextual("let"),a=!1,o=this.containsEsc,h=new Lu,u=this.start,l=t>-1?this.parseExprSubscripts(h,"await"):this.parseExpression(!0,h);return this.type===au._in||(a=this.options.ecmaVersion>=6&&this.isContextual("of"))?(t>-1?(this.type===au._in&&this.unexpected(t),e.await=!0):a&&this.options.ecmaVersion>=8&&(l.start!==u||o||"Identifier"!==l.type||"async"!==l.name?this.options.ecmaVersion>=9&&(e.await=!1):this.unexpected()),n&&a&&this.raise(l.start,"The left-hand side of a for-of loop may not start with 'let'."),this.toAssignable(l,!1,h),this.checkLValPattern(l),this.parseForIn(e,l)):(this.checkExpressionErrors(h,!0),t>-1&&this.unexpected(t),this.parseFor(e,l))},Pu.parseFunctionStatement=function(e,t,i){return this.next(),this.parseFunction(e,Vu|(i?0:Uu),!1,t)},Pu.parseIfStatement=function(e){return this.next(),e.test=this.parseParenExpression(),e.consequent=this.parseStatement("if"),e.alternate=this.eat(au._else)?this.parseStatement("if"):null,this.finishNode(e,"IfStatement")},Pu.parseReturnStatement=function(e){return this.inFunction||this.options.allowReturnOutsideFunction||this.raise(this.start,"'return' outside of function"),this.next(),this.eat(au.semi)||this.insertSemicolon()?e.argument=null:(e.argument=this.parseExpression(),this.semicolon()),this.finishNode(e,"ReturnStatement")},Pu.parseSwitchStatement=function(e){var t;this.next(),e.discriminant=this.parseParenExpression(),e.cases=[],this.expect(au.braceL),this.labels.push(Nu),this.enterScope(0);for(var i=!1;this.type!==au.braceR;)if(this.type===au._case||this.type===au._default){var r=this.type===au._case;t&&this.finishNode(t,"SwitchCase"),e.cases.push(t=this.startNode()),t.consequent=[],this.next(),r?t.test=this.parseExpression():(i&&this.raiseRecoverable(this.lastTokStart,"Multiple default clauses"),i=!0,t.test=null),this.expect(au.colon)}else t||this.unexpected(),t.consequent.push(this.parseStatement(null));return this.exitScope(),t&&this.finishNode(t,"SwitchCase"),this.next(),this.labels.pop(),this.finishNode(e,"SwitchStatement")},Pu.parseThrowStatement=function(e){return this.next(),ou.test(this.input.slice(this.lastTokEnd,this.start))&&this.raise(this.lastTokEnd,"Illegal newline after throw"),e.argument=this.parseExpression(),this.semicolon(),this.finishNode(e,"ThrowStatement")};var Ru=[];Pu.parseCatchClauseParam=function(){var e=this.parseBindingAtom(),t="Identifier"===e.type;return this.enterScope(t?32:0),this.checkLValPattern(e,t?4:2),this.expect(au.parenR),e},Pu.parseTryStatement=function(e){if(this.next(),e.block=this.parseBlock(),e.handler=null,this.type===au._catch){var t=this.startNode();this.next(),this.eat(au.parenL)?t.param=this.parseCatchClauseParam():(this.options.ecmaVersion<10&&this.unexpected(),t.param=null,this.enterScope(0)),t.body=this.parseBlock(!1),this.exitScope(),e.handler=this.finishNode(t,"CatchClause")}return e.finalizer=this.eat(au._finally)?this.parseBlock():null,e.handler||e.finalizer||this.raise(e.start,"Missing catch or finally clause"),this.finishNode(e,"TryStatement")},Pu.parseVarStatement=function(e,t,i){return this.next(),this.parseVar(e,!1,t,i),this.semicolon(),this.finishNode(e,"VariableDeclaration")},Pu.parseWhileStatement=function(e){return this.next(),e.test=this.parseParenExpression(),this.labels.push(Ou),e.body=this.parseStatement("while"),this.labels.pop(),this.finishNode(e,"WhileStatement")},Pu.parseWithStatement=function(e){return this.strict&&this.raise(this.start,"'with' in strict mode"),this.next(),e.object=this.parseParenExpression(),e.body=this.parseStatement("with"),this.finishNode(e,"WithStatement")},Pu.parseEmptyStatement=function(e){return this.next(),this.finishNode(e,"EmptyStatement")},Pu.parseLabeledStatement=function(e,t,i,r){for(var s=0,n=this.labels;s<n.length;s+=1){n[s].name===t&&this.raise(i.start,"Label '"+t+"' is already declared")}for(var a=this.type.isLoop?"loop":this.type===au._switch?"switch":null,o=this.labels.length-1;o>=0;o--){var h=this.labels[o];if(h.statementStart!==e.start)break;h.statementStart=this.start,h.kind=a}return this.labels.push({name:t,kind:a,statementStart:this.start}),e.body=this.parseStatement(r?-1===r.indexOf("label")?r+"label":r:"label"),this.labels.pop(),e.label=i,this.finishNode(e,"LabeledStatement")},Pu.parseExpressionStatement=function(e,t){return e.expression=t,this.semicolon(),this.finishNode(e,"ExpressionStatement")},Pu.parseBlock=function(e,t,i){for(void 0===e&&(e=!0),void 0===t&&(t=this.startNode()),t.body=[],this.expect(au.braceL),e&&this.enterScope(0);this.type!==au.braceR;){var r=this.parseStatement(null);t.body.push(r)}return i&&(this.strict=!1),this.next(),e&&this.exitScope(),this.finishNode(t,"BlockStatement")},Pu.parseFor=function(e,t){return e.init=t,this.expect(au.semi),e.test=this.type===au.semi?null:this.parseExpression(),this.expect(au.semi),e.update=this.type===au.parenR?null:this.parseExpression(),this.expect(au.parenR),e.body=this.parseStatement("for"),this.exitScope(),this.labels.pop(),this.finishNode(e,"ForStatement")},Pu.parseForIn=function(e,t){var i=this.type===au._in;return this.next(),"VariableDeclaration"===t.type&&null!=t.declarations[0].init&&(!i||this.options.ecmaVersion<8||this.strict||"var"!==t.kind||"Identifier"!==t.declarations[0].id.type)&&this.raise(t.start,(i?"for-in":"for-of")+" loop variable declaration may not have an initializer"),e.left=t,e.right=i?this.parseExpression():this.parseMaybeAssign(),this.expect(au.parenR),e.body=this.parseStatement("for"),this.exitScope(),this.labels.pop(),this.finishNode(e,i?"ForInStatement":"ForOfStatement")},Pu.parseVar=function(e,t,i,r){for(e.declarations=[],e.kind=i;;){var s=this.startNode();if(this.parseVarId(s,i),this.eat(au.eq)?s.init=this.parseMaybeAssign(t):r||"const"!==i||this.type===au._in||this.options.ecmaVersion>=6&&this.isContextual("of")?r||"Identifier"===s.id.type||t&&(this.type===au._in||this.isContextual("of"))?s.init=null:this.raise(this.lastTokEnd,"Complex binding patterns require an initialization value"):this.unexpected(),e.declarations.push(this.finishNode(s,"VariableDeclarator")),!this.eat(au.comma))break}return e},Pu.parseVarId=function(e,t){e.id=this.parseBindingAtom(),this.checkLValPattern(e.id,"var"===t?1:2,!1)};var Vu=1,Uu=2;function Gu(e,t){var i=t.key.name,r=e[i],s="true";return"MethodDefinition"!==t.type||"get"!==t.kind&&"set"!==t.kind||(s=(t.static?"s":"i")+t.kind),"iget"===r&&"iset"===s||"iset"===r&&"iget"===s||"sget"===r&&"sset"===s||"sset"===r&&"sget"===s?(e[i]="true",!1):!!r||(e[i]=s,!1)}function zu(e,t){var i=e.computed,r=e.key;return!i&&("Identifier"===r.type&&r.name===t||"Literal"===r.type&&r.value===t)}Pu.parseFunction=function(e,t,i,r,s){this.initFunction(e),(this.options.ecmaVersion>=9||this.options.ecmaVersion>=6&&!r)&&(this.type===au.star&&t&Uu&&this.unexpected(),e.generator=this.eat(au.star)),this.options.ecmaVersion>=8&&(e.async=!!r),t&Vu&&(e.id=4&t&&this.type!==au.name?null:this.parseIdent(),!e.id||t&Uu||this.checkLValSimple(e.id,this.strict||e.generator||e.async?this.treatFunctionsAsVar?1:2:3));var n=this.yieldPos,a=this.awaitPos,o=this.awaitIdentPos;return this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,this.enterScope(Tu(e.async,e.generator)),t&Vu||(e.id=this.type===au.name?this.parseIdent():null),this.parseFunctionParams(e),this.parseFunctionBody(e,i,!1,s),this.yieldPos=n,this.awaitPos=a,this.awaitIdentPos=o,this.finishNode(e,t&Vu?"FunctionDeclaration":"FunctionExpression")},Pu.parseFunctionParams=function(e){this.expect(au.parenL),e.params=this.parseBindingList(au.parenR,!1,this.options.ecmaVersion>=8),this.checkYieldAwaitInDefaultParams()},Pu.parseClass=function(e,t){this.next();var i=this.strict;this.strict=!0,this.parseClassId(e,t),this.parseClassSuper(e);var r=this.enterClassBody(),s=this.startNode(),n=!1;for(s.body=[],this.expect(au.braceL);this.type!==au.braceR;){var a=this.parseClassElement(null!==e.superClass);a&&(s.body.push(a),"MethodDefinition"===a.type&&"constructor"===a.kind?(n&&this.raiseRecoverable(a.start,"Duplicate constructor in the same class"),n=!0):a.key&&"PrivateIdentifier"===a.key.type&&Gu(r,a)&&this.raiseRecoverable(a.key.start,"Identifier '#"+a.key.name+"' has already been declared"))}return this.strict=i,this.next(),e.body=this.finishNode(s,"ClassBody"),this.exitClassBody(),this.finishNode(e,t?"ClassDeclaration":"ClassExpression")},Pu.parseClassElement=function(e){if(this.eat(au.semi))return null;var t=this.options.ecmaVersion,i=this.startNode(),r="",s=!1,n=!1,a="method",o=!1;if(this.eatContextual("static")){if(t>=13&&this.eat(au.braceL))return this.parseClassStaticBlock(i),i;this.isClassElementNameStart()||this.type===au.star?o=!0:r="static"}if(i.static=o,!r&&t>=8&&this.eatContextual("async")&&(!this.isClassElementNameStart()&&this.type!==au.star||this.canInsertSemicolon()?r="async":n=!0),!r&&(t>=9||!n)&&this.eat(au.star)&&(s=!0),!r&&!n&&!s){var h=this.value;(this.eatContextual("get")||this.eatContextual("set"))&&(this.isClassElementNameStart()?a=h:r=h)}if(r?(i.computed=!1,i.key=this.startNodeAt(this.lastTokStart,this.lastTokStartLoc),i.key.name=r,this.finishNode(i.key,"Identifier")):this.parseClassElementName(i),t<13||this.type===au.parenL||"method"!==a||s||n){var u=!i.static&&zu(i,"constructor"),l=u&&e;u&&"method"!==a&&this.raise(i.key.start,"Constructor can't have get/set modifier"),i.kind=u?"constructor":a,this.parseClassMethod(i,s,n,l)}else this.parseClassField(i);return i},Pu.isClassElementNameStart=function(){return this.type===au.name||this.type===au.privateId||this.type===au.num||this.type===au.string||this.type===au.bracketL||this.type.keyword},Pu.parseClassElementName=function(e){this.type===au.privateId?("constructor"===this.value&&this.raise(this.start,"Classes can't have an element named '#constructor'"),e.computed=!1,e.key=this.parsePrivateIdent()):this.parsePropertyName(e)},Pu.parseClassMethod=function(e,t,i,r){var s=e.key;"constructor"===e.kind?(t&&this.raise(s.start,"Constructor can't be a generator"),i&&this.raise(s.start,"Constructor can't be an async method")):e.static&&zu(e,"prototype")&&this.raise(s.start,"Classes may not have a static property named prototype");var n=e.value=this.parseMethod(t,i,r);return"get"===e.kind&&0!==n.params.length&&this.raiseRecoverable(n.start,"getter should have no params"),"set"===e.kind&&1!==n.params.length&&this.raiseRecoverable(n.start,"setter should have exactly one param"),"set"===e.kind&&"RestElement"===n.params[0].type&&this.raiseRecoverable(n.params[0].start,"Setter cannot use rest params"),this.finishNode(e,"MethodDefinition")},Pu.parseClassField=function(e){if(zu(e,"constructor")?this.raise(e.key.start,"Classes can't have a field named 'constructor'"):e.static&&zu(e,"prototype")&&this.raise(e.key.start,"Classes can't have a static field named 'prototype'"),this.eat(au.eq)){var t=this.currentThisScope(),i=t.inClassFieldInit;t.inClassFieldInit=!0,e.value=this.parseMaybeAssign(),t.inClassFieldInit=i}else e.value=null;return this.semicolon(),this.finishNode(e,"PropertyDefinition")},Pu.parseClassStaticBlock=function(e){e.body=[];var t=this.labels;for(this.labels=[],this.enterScope(320);this.type!==au.braceR;){var i=this.parseStatement(null);e.body.push(i)}return this.next(),this.exitScope(),this.labels=t,this.finishNode(e,"StaticBlock")},Pu.parseClassId=function(e,t){this.type===au.name?(e.id=this.parseIdent(),t&&this.checkLValSimple(e.id,2,!1)):(!0===t&&this.unexpected(),e.id=null)},Pu.parseClassSuper=function(e){e.superClass=this.eat(au._extends)?this.parseExprSubscripts(null,!1):null},Pu.enterClassBody=function(){var e={declared:Object.create(null),used:[]};return this.privateNameStack.push(e),e.declared},Pu.exitClassBody=function(){var e=this.privateNameStack.pop(),t=e.declared,i=e.used;if(this.options.checkPrivateFields)for(var r=this.privateNameStack.length,s=0===r?null:this.privateNameStack[r-1],n=0;n<i.length;++n){var a=i[n];mu(t,a.name)||(s?s.used.push(a):this.raiseRecoverable(a.start,"Private field '#"+a.name+"' must be declared in an enclosing class"))}},Pu.parseExportAllDeclaration=function(e,t){return this.options.ecmaVersion>=11&&(this.eatContextual("as")?(e.exported=this.parseModuleExportName(),this.checkExport(t,e.exported,this.lastTokStart)):e.exported=null),this.expectContextual("from"),this.type!==au.string&&this.unexpected(),e.source=this.parseExprAtom(),this.options.ecmaVersion>=16&&(e.attributes=this.parseWithClause()),this.semicolon(),this.finishNode(e,"ExportAllDeclaration")},Pu.parseExport=function(e,t){if(this.next(),this.eat(au.star))return this.parseExportAllDeclaration(e,t);if(this.eat(au._default))return this.checkExport(t,"default",this.lastTokStart),e.declaration=this.parseExportDefaultDeclaration(),this.finishNode(e,"ExportDefaultDeclaration");if(this.shouldParseExportStatement())e.declaration=this.parseExportDeclaration(e),"VariableDeclaration"===e.declaration.type?this.checkVariableExport(t,e.declaration.declarations):this.checkExport(t,e.declaration.id,e.declaration.id.start),e.specifiers=[],e.source=null;else{if(e.declaration=null,e.specifiers=this.parseExportSpecifiers(t),this.eatContextual("from"))this.type!==au.string&&this.unexpected(),e.source=this.parseExprAtom(),this.options.ecmaVersion>=16&&(e.attributes=this.parseWithClause());else{for(var i=0,r=e.specifiers;i<r.length;i+=1){var s=r[i];this.checkUnreserved(s.local),this.checkLocalExport(s.local),"Literal"===s.local.type&&this.raise(s.local.start,"A string literal cannot be used as an exported binding without `from`.")}e.source=null}this.semicolon()}return this.finishNode(e,"ExportNamedDeclaration")},Pu.parseExportDeclaration=function(e){return this.parseStatement(null)},Pu.parseExportDefaultDeclaration=function(){var e;if(this.type===au._function||(e=this.isAsyncFunction())){var t=this.startNode();return this.next(),e&&this.next(),this.parseFunction(t,4|Vu,!1,e)}if(this.type===au._class){var i=this.startNode();return this.parseClass(i,"nullableID")}var r=this.parseMaybeAssign();return this.semicolon(),r},Pu.checkExport=function(e,t,i){e&&("string"!=typeof t&&(t="Identifier"===t.type?t.name:t.value),mu(e,t)&&this.raiseRecoverable(i,"Duplicate export '"+t+"'"),e[t]=!0)},Pu.checkPatternExport=function(e,t){var i=t.type;if("Identifier"===i)this.checkExport(e,t,t.start);else if("ObjectPattern"===i)for(var r=0,s=t.properties;r<s.length;r+=1){var n=s[r];this.checkPatternExport(e,n)}else if("ArrayPattern"===i)for(var a=0,o=t.elements;a<o.length;a+=1){var h=o[a];h&&this.checkPatternExport(e,h)}else"Property"===i?this.checkPatternExport(e,t.value):"AssignmentPattern"===i?this.checkPatternExport(e,t.left):"RestElement"===i&&this.checkPatternExport(e,t.argument)},Pu.checkVariableExport=function(e,t){if(e)for(var i=0,r=t;i<r.length;i+=1){var s=r[i];this.checkPatternExport(e,s.id)}},Pu.shouldParseExportStatement=function(){return"var"===this.type.keyword||"const"===this.type.keyword||"class"===this.type.keyword||"function"===this.type.keyword||this.isLet()||this.isAsyncFunction()},Pu.parseExportSpecifier=function(e){var t=this.startNode();return t.local=this.parseModuleExportName(),t.exported=this.eatContextual("as")?this.parseModuleExportName():t.local,this.checkExport(e,t.exported,t.exported.start),this.finishNode(t,"ExportSpecifier")},Pu.parseExportSpecifiers=function(e){var t=[],i=!0;for(this.expect(au.braceL);!this.eat(au.braceR);){if(i)i=!1;else if(this.expect(au.comma),this.afterTrailingComma(au.braceR))break;t.push(this.parseExportSpecifier(e))}return t},Pu.parseImport=function(e){return this.next(),this.type===au.string?(e.specifiers=Ru,e.source=this.parseExprAtom()):(e.specifiers=this.parseImportSpecifiers(),this.expectContextual("from"),e.source=this.type===au.string?this.parseExprAtom():this.unexpected()),this.options.ecmaVersion>=16&&(e.attributes=this.parseWithClause()),this.semicolon(),this.finishNode(e,"ImportDeclaration")},Pu.parseImportSpecifier=function(){var e=this.startNode();return e.imported=this.parseModuleExportName(),this.eatContextual("as")?e.local=this.parseIdent():(this.checkUnreserved(e.imported),e.local=e.imported),this.checkLValSimple(e.local,2),this.finishNode(e,"ImportSpecifier")},Pu.parseImportDefaultSpecifier=function(){var e=this.startNode();return e.local=this.parseIdent(),this.checkLValSimple(e.local,2),this.finishNode(e,"ImportDefaultSpecifier")},Pu.parseImportNamespaceSpecifier=function(){var e=this.startNode();return this.next(),this.expectContextual("as"),e.local=this.parseIdent(),this.checkLValSimple(e.local,2),this.finishNode(e,"ImportNamespaceSpecifier")},Pu.parseImportSpecifiers=function(){var e=[],t=!0;if(this.type===au.name&&(e.push(this.parseImportDefaultSpecifier()),!this.eat(au.comma)))return e;if(this.type===au.star)return e.push(this.parseImportNamespaceSpecifier()),e;for(this.expect(au.braceL);!this.eat(au.braceR);){if(t)t=!1;else if(this.expect(au.comma),this.afterTrailingComma(au.braceR))break;e.push(this.parseImportSpecifier())}return e},Pu.parseWithClause=function(){var e=[];if(!this.eat(au._with))return e;this.expect(au.braceL);for(var t={},i=!0;!this.eat(au.braceR);){if(i)i=!1;else if(this.expect(au.comma),this.afterTrailingComma(au.braceR))break;var r=this.parseImportAttribute(),s="Identifier"===r.key.type?r.key.name:r.key.value;mu(t,s)&&this.raiseRecoverable(r.key.start,"Duplicate attribute key '"+s+"'"),t[s]=!0,e.push(r)}return e},Pu.parseImportAttribute=function(){var e=this.startNode();return e.key=this.type===au.string?this.parseExprAtom():this.parseIdent("never"!==this.options.allowReserved),this.expect(au.colon),this.type!==au.string&&this.unexpected(),e.value=this.parseExprAtom(),this.finishNode(e,"ImportAttribute")},Pu.parseModuleExportName=function(){if(this.options.ecmaVersion>=13&&this.type===au.string){var e=this.parseLiteral(this.value);return _u.test(e.value)&&this.raise(e.start,"An export name cannot include a lone surrogate."),e}return this.parseIdent(!0)},Pu.adaptDirectivePrologue=function(e){for(var t=0;t<e.length&&this.isDirectiveCandidate(e[t]);++t)e[t].directive=e[t].expression.raw.slice(1,-1)},Pu.isDirectiveCandidate=function(e){return this.options.ecmaVersion>=5&&"ExpressionStatement"===e.type&&"Literal"===e.expression.type&&"string"==typeof e.expression.value&&('"'===this.input[e.start]||"'"===this.input[e.start])};var ju=Mu.prototype;ju.toAssignable=function(e,t,i){if(this.options.ecmaVersion>=6&&e)switch(e.type){case"Identifier":this.inAsync&&"await"===e.name&&this.raise(e.start,"Cannot use 'await' as identifier inside an async function");break;case"ObjectPattern":case"ArrayPattern":case"AssignmentPattern":case"RestElement":break;case"ObjectExpression":e.type="ObjectPattern",i&&this.checkPatternErrors(i,!0);for(var r=0,s=e.properties;r<s.length;r+=1){var n=s[r];this.toAssignable(n,t),"RestElement"!==n.type||"ArrayPattern"!==n.argument.type&&"ObjectPattern"!==n.argument.type||this.raise(n.argument.start,"Unexpected token")}break;case"Property":"init"!==e.kind&&this.raise(e.key.start,"Object pattern can't contain getter or setter"),this.toAssignable(e.value,t);break;case"ArrayExpression":e.type="ArrayPattern",i&&this.checkPatternErrors(i,!0),this.toAssignableList(e.elements,t);break;case"SpreadElement":e.type="RestElement",this.toAssignable(e.argument,t),"AssignmentPattern"===e.argument.type&&this.raise(e.argument.start,"Rest elements cannot have a default value");break;case"AssignmentExpression":"="!==e.operator&&this.raise(e.left.end,"Only '=' operator can be used for specifying default value."),e.type="AssignmentPattern",delete e.operator,this.toAssignable(e.left,t);break;case"ParenthesizedExpression":this.toAssignable(e.expression,t,i);break;case"ChainExpression":this.raiseRecoverable(e.start,"Optional chaining cannot appear in left-hand side");break;case"MemberExpression":if(!t)break;default:this.raise(e.start,"Assigning to rvalue")}else i&&this.checkPatternErrors(i,!0);return e},ju.toAssignableList=function(e,t){for(var i=e.length,r=0;r<i;r++){var s=e[r];s&&this.toAssignable(s,t)}if(i){var n=e[i-1];6===this.options.ecmaVersion&&t&&n&&"RestElement"===n.type&&"Identifier"!==n.argument.type&&this.unexpected(n.argument.start)}return e},ju.parseSpread=function(e){var t=this.startNode();return this.next(),t.argument=this.parseMaybeAssign(!1,e),this.finishNode(t,"SpreadElement")},ju.parseRestBinding=function(){var e=this.startNode();return this.next(),6===this.options.ecmaVersion&&this.type!==au.name&&this.unexpected(),e.argument=this.parseBindingAtom(),this.finishNode(e,"RestElement")},ju.parseBindingAtom=function(){if(this.options.ecmaVersion>=6)switch(this.type){case au.bracketL:var e=this.startNode();return this.next(),e.elements=this.parseBindingList(au.bracketR,!0,!0),this.finishNode(e,"ArrayPattern");case au.braceL:return this.parseObj(!0)}return this.parseIdent()},ju.parseBindingList=function(e,t,i,r){for(var s=[],n=!0;!this.eat(e);)if(n?n=!1:this.expect(au.comma),t&&this.type===au.comma)s.push(null);else{if(i&&this.afterTrailingComma(e))break;if(this.type===au.ellipsis){var a=this.parseRestBinding();this.parseBindingListItem(a),s.push(a),this.type===au.comma&&this.raiseRecoverable(this.start,"Comma is not permitted after the rest element"),this.expect(e);break}s.push(this.parseAssignableListItem(r))}return s},ju.parseAssignableListItem=function(e){var t=this.parseMaybeDefault(this.start,this.startLoc);return this.parseBindingListItem(t),t},ju.parseBindingListItem=function(e){return e},ju.parseMaybeDefault=function(e,t,i){if(i=i||this.parseBindingAtom(),this.options.ecmaVersion<6||!this.eat(au.eq))return i;var r=this.startNodeAt(e,t);return r.left=i,r.right=this.parseMaybeAssign(),this.finishNode(r,"AssignmentPattern")},ju.checkLValSimple=function(e,t,i){void 0===t&&(t=0);var r=0!==t;switch(e.type){case"Identifier":this.strict&&this.reservedWordsStrictBind.test(e.name)&&this.raiseRecoverable(e.start,(r?"Binding ":"Assigning to ")+e.name+" in strict mode"),r&&(2===t&&"let"===e.name&&this.raiseRecoverable(e.start,"let is disallowed as a lexically bound name"),i&&(mu(i,e.name)&&this.raiseRecoverable(e.start,"Argument name clash"),i[e.name]=!0),5!==t&&this.declareName(e.name,t,e.start));break;case"ChainExpression":this.raiseRecoverable(e.start,"Optional chaining cannot appear in left-hand side");break;case"MemberExpression":r&&this.raiseRecoverable(e.start,"Binding member expression");break;case"ParenthesizedExpression":return r&&this.raiseRecoverable(e.start,"Binding parenthesized expression"),this.checkLValSimple(e.expression,t,i);default:this.raise(e.start,(r?"Binding":"Assigning to")+" rvalue")}},ju.checkLValPattern=function(e,t,i){switch(void 0===t&&(t=0),e.type){case"ObjectPattern":for(var r=0,s=e.properties;r<s.length;r+=1){var n=s[r];this.checkLValInnerPattern(n,t,i)}break;case"ArrayPattern":for(var a=0,o=e.elements;a<o.length;a+=1){var h=o[a];h&&this.checkLValInnerPattern(h,t,i)}break;default:this.checkLValSimple(e,t,i)}},ju.checkLValInnerPattern=function(e,t,i){switch(void 0===t&&(t=0),e.type){case"Property":this.checkLValInnerPattern(e.value,t,i);break;case"AssignmentPattern":this.checkLValPattern(e.left,t,i);break;case"RestElement":this.checkLValPattern(e.argument,t,i);break;default:this.checkLValPattern(e,t,i)}};var $u=function(e,t,i,r,s){this.token=e,this.isExpr=!!t,this.preserveSpace=!!i,this.override=r,this.generator=!!s},Wu={b_stat:new $u("{",!1),b_expr:new $u("{",!0),b_tmpl:new $u("${",!1),p_stat:new $u("(",!1),p_expr:new $u("(",!0),q_tmpl:new $u("`",!0,!0,(function(e){return e.tryReadTemplateToken()})),f_stat:new $u("function",!1),f_expr:new $u("function",!0),f_expr_gen:new $u("function",!0,!1,null,!0),f_gen:new $u("function",!1,!1,null,!0)},qu=Mu.prototype;qu.initialContext=function(){return[Wu.b_stat]},qu.curContext=function(){return this.context[this.context.length-1]},qu.braceIsBlock=function(e){var t=this.curContext();return t===Wu.f_expr||t===Wu.f_stat||(e!==au.colon||t!==Wu.b_stat&&t!==Wu.b_expr?e===au._return||e===au.name&&this.exprAllowed?ou.test(this.input.slice(this.lastTokEnd,this.start)):e===au._else||e===au.semi||e===au.eof||e===au.parenR||e===au.arrow||(e===au.braceL?t===Wu.b_stat:e!==au._var&&e!==au._const&&e!==au.name&&!this.exprAllowed):!t.isExpr)},qu.inGeneratorContext=function(){for(var e=this.context.length-1;e>=1;e--){var t=this.context[e];if("function"===t.token)return t.generator}return!1},qu.updateContext=function(e){var t,i=this.type;i.keyword&&e===au.dot?this.exprAllowed=!1:(t=i.updateContext)?t.call(this,e):this.exprAllowed=i.beforeExpr},qu.overrideContext=function(e){this.curContext()!==e&&(this.context[this.context.length-1]=e)},au.parenR.updateContext=au.braceR.updateContext=function(){if(1!==this.context.length){var e=this.context.pop();e===Wu.b_stat&&"function"===this.curContext().token&&(e=this.context.pop()),this.exprAllowed=!e.isExpr}else this.exprAllowed=!0},au.braceL.updateContext=function(e){this.context.push(this.braceIsBlock(e)?Wu.b_stat:Wu.b_expr),this.exprAllowed=!0},au.dollarBraceL.updateContext=function(){this.context.push(Wu.b_tmpl),this.exprAllowed=!0},au.parenL.updateContext=function(e){var t=e===au._if||e===au._for||e===au._with||e===au._while;this.context.push(t?Wu.p_stat:Wu.p_expr),this.exprAllowed=!0},au.incDec.updateContext=function(){},au._function.updateContext=au._class.updateContext=function(e){!e.beforeExpr||e===au._else||e===au.semi&&this.curContext()!==Wu.p_stat||e===au._return&&ou.test(this.input.slice(this.lastTokEnd,this.start))||(e===au.colon||e===au.braceL)&&this.curContext()===Wu.b_stat?this.context.push(Wu.f_stat):this.context.push(Wu.f_expr),this.exprAllowed=!1},au.colon.updateContext=function(){"function"===this.curContext().token&&this.context.pop(),this.exprAllowed=!0},au.backQuote.updateContext=function(){this.curContext()===Wu.q_tmpl?this.context.pop():this.context.push(Wu.q_tmpl),this.exprAllowed=!1},au.star.updateContext=function(e){if(e===au._function){var t=this.context.length-1;this.context[t]===Wu.f_expr?this.context[t]=Wu.f_expr_gen:this.context[t]=Wu.f_gen}this.exprAllowed=!0},au.name.updateContext=function(e){var t=!1;this.options.ecmaVersion>=6&&e!==au.dot&&("of"===this.value&&!this.exprAllowed||"yield"===this.value&&this.inGeneratorContext())&&(t=!0),this.exprAllowed=t};var Hu=Mu.prototype;function Xu(e){return"Identifier"===e.type||"ParenthesizedExpression"===e.type&&Xu(e.expression)}function Yu(e){return"MemberExpression"===e.type&&"PrivateIdentifier"===e.property.type||"ChainExpression"===e.type&&Yu(e.expression)||"ParenthesizedExpression"===e.type&&Yu(e.expression)}Hu.checkPropClash=function(e,t,i){if(!(this.options.ecmaVersion>=9&&"SpreadElement"===e.type||this.options.ecmaVersion>=6&&(e.computed||e.method||e.shorthand))){var r,s=e.key;switch(s.type){case"Identifier":r=s.name;break;case"Literal":r=String(s.value);break;default:return}var n=e.kind;if(this.options.ecmaVersion>=6)"__proto__"===r&&"init"===n&&(t.proto&&(i?i.doubleProto<0&&(i.doubleProto=s.start):this.raiseRecoverable(s.start,"Redefinition of __proto__ property")),t.proto=!0);else{var a=t[r="$"+r];if(a)("init"===n?this.strict&&a.init||a.get||a.set:a.init||a[n])&&this.raiseRecoverable(s.start,"Redefinition of property");else a=t[r]={init:!1,get:!1,set:!1};a[n]=!0}}},Hu.parseExpression=function(e,t){var i=this.start,r=this.startLoc,s=this.parseMaybeAssign(e,t);if(this.type===au.comma){var n=this.startNodeAt(i,r);for(n.expressions=[s];this.eat(au.comma);)n.expressions.push(this.parseMaybeAssign(e,t));return this.finishNode(n,"SequenceExpression")}return s},Hu.parseMaybeAssign=function(e,t,i){if(this.isContextual("yield")){if(this.inGenerator)return this.parseYield(e);this.exprAllowed=!1}var r=!1,s=-1,n=-1,a=-1;t?(s=t.parenthesizedAssign,n=t.trailingComma,a=t.doubleProto,t.parenthesizedAssign=t.trailingComma=-1):(t=new Lu,r=!0);var o=this.start,h=this.startLoc;this.type!==au.parenL&&this.type!==au.name||(this.potentialArrowAt=this.start,this.potentialArrowInForAwait="await"===e);var u=this.parseMaybeConditional(e,t);if(i&&(u=i.call(this,u,o,h)),this.type.isAssign){var l=this.startNodeAt(o,h);return l.operator=this.value,this.type===au.eq&&(u=this.toAssignable(u,!1,t)),r||(t.parenthesizedAssign=t.trailingComma=t.doubleProto=-1),t.shorthandAssign>=u.start&&(t.shorthandAssign=-1),this.type===au.eq?this.checkLValPattern(u):this.checkLValSimple(u),l.left=u,this.next(),l.right=this.parseMaybeAssign(e),a>-1&&(t.doubleProto=a),this.finishNode(l,"AssignmentExpression")}return r&&this.checkExpressionErrors(t,!0),s>-1&&(t.parenthesizedAssign=s),n>-1&&(t.trailingComma=n),u},Hu.parseMaybeConditional=function(e,t){var i=this.start,r=this.startLoc,s=this.parseExprOps(e,t);if(this.checkExpressionErrors(t))return s;if(this.eat(au.question)){var n=this.startNodeAt(i,r);return n.test=s,n.consequent=this.parseMaybeAssign(),this.expect(au.colon),n.alternate=this.parseMaybeAssign(e),this.finishNode(n,"ConditionalExpression")}return s},Hu.parseExprOps=function(e,t){var i=this.start,r=this.startLoc,s=this.parseMaybeUnary(t,!1,!1,e);return this.checkExpressionErrors(t)||s.start===i&&"ArrowFunctionExpression"===s.type?s:this.parseExprOp(s,i,r,-1,e)},Hu.parseExprOp=function(e,t,i,r,s){var n=this.type.binop;if(null!=n&&(!s||this.type!==au._in)&&n>r){var a=this.type===au.logicalOR||this.type===au.logicalAND,o=this.type===au.coalesce;o&&(n=au.logicalAND.binop);var h=this.value;this.next();var u=this.start,l=this.startLoc,c=this.parseExprOp(this.parseMaybeUnary(null,!1,!1,s),u,l,n,s),p=this.buildBinary(t,i,e,c,h,a||o);return(a&&this.type===au.coalesce||o&&(this.type===au.logicalOR||this.type===au.logicalAND))&&this.raiseRecoverable(this.start,"Logical expressions and coalesce expressions cannot be mixed. Wrap either by parentheses"),this.parseExprOp(p,t,i,r,s)}return e},Hu.buildBinary=function(e,t,i,r,s,n){"PrivateIdentifier"===r.type&&this.raise(r.start,"Private identifier can only be left side of binary expression");var a=this.startNodeAt(e,t);return a.left=i,a.operator=s,a.right=r,this.finishNode(a,n?"LogicalExpression":"BinaryExpression")},Hu.parseMaybeUnary=function(e,t,i,r){var s,n=this.start,a=this.startLoc;if(this.isContextual("await")&&this.canAwait)s=this.parseAwait(r),t=!0;else if(this.type.prefix){var o=this.startNode(),h=this.type===au.incDec;o.operator=this.value,o.prefix=!0,this.next(),o.argument=this.parseMaybeUnary(null,!0,h,r),this.checkExpressionErrors(e,!0),h?this.checkLValSimple(o.argument):this.strict&&"delete"===o.operator&&Xu(o.argument)?this.raiseRecoverable(o.start,"Deleting local variable in strict mode"):"delete"===o.operator&&Yu(o.argument)?this.raiseRecoverable(o.start,"Private fields can not be deleted"):t=!0,s=this.finishNode(o,h?"UpdateExpression":"UnaryExpression")}else if(t||this.type!==au.privateId){if(s=this.parseExprSubscripts(e,r),this.checkExpressionErrors(e))return s;for(;this.type.postfix&&!this.canInsertSemicolon();){var u=this.startNodeAt(n,a);u.operator=this.value,u.prefix=!1,u.argument=s,this.checkLValSimple(s),this.next(),s=this.finishNode(u,"UpdateExpression")}}else(r||0===this.privateNameStack.length)&&this.options.checkPrivateFields&&this.unexpected(),s=this.parsePrivateIdent(),this.type!==au._in&&this.unexpected();return i||!this.eat(au.starstar)?s:t?void this.unexpected(this.lastTokStart):this.buildBinary(n,a,s,this.parseMaybeUnary(null,!1,!1,r),"**",!1)},Hu.parseExprSubscripts=function(e,t){var i=this.start,r=this.startLoc,s=this.parseExprAtom(e,t);if("ArrowFunctionExpression"===s.type&&")"!==this.input.slice(this.lastTokStart,this.lastTokEnd))return s;var n=this.parseSubscripts(s,i,r,!1,t);return e&&"MemberExpression"===n.type&&(e.parenthesizedAssign>=n.start&&(e.parenthesizedAssign=-1),e.parenthesizedBind>=n.start&&(e.parenthesizedBind=-1),e.trailingComma>=n.start&&(e.trailingComma=-1)),n},Hu.parseSubscripts=function(e,t,i,r,s){for(var n=this.options.ecmaVersion>=8&&"Identifier"===e.type&&"async"===e.name&&this.lastTokEnd===e.end&&!this.canInsertSemicolon()&&e.end-e.start==5&&this.potentialArrowAt===e.start,a=!1;;){var o=this.parseSubscript(e,t,i,r,n,a,s);if(o.optional&&(a=!0),o===e||"ArrowFunctionExpression"===o.type){if(a){var h=this.startNodeAt(t,i);h.expression=o,o=this.finishNode(h,"ChainExpression")}return o}e=o}},Hu.shouldParseAsyncArrow=function(){return!this.canInsertSemicolon()&&this.eat(au.arrow)},Hu.parseSubscriptAsyncArrow=function(e,t,i,r){return this.parseArrowExpression(this.startNodeAt(e,t),i,!0,r)},Hu.parseSubscript=function(e,t,i,r,s,n,a){var o=this.options.ecmaVersion>=11,h=o&&this.eat(au.questionDot);r&&h&&this.raise(this.lastTokStart,"Optional chaining cannot appear in the callee of new expressions");var u=this.eat(au.bracketL);if(u||h&&this.type!==au.parenL&&this.type!==au.backQuote||this.eat(au.dot)){var l=this.startNodeAt(t,i);l.object=e,u?(l.property=this.parseExpression(),this.expect(au.bracketR)):this.type===au.privateId&&"Super"!==e.type?l.property=this.parsePrivateIdent():l.property=this.parseIdent("never"!==this.options.allowReserved),l.computed=!!u,o&&(l.optional=h),e=this.finishNode(l,"MemberExpression")}else if(!r&&this.eat(au.parenL)){var c=new Lu,p=this.yieldPos,d=this.awaitPos,f=this.awaitIdentPos;this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0;var g=this.parseExprList(au.parenR,this.options.ecmaVersion>=8,!1,c);if(s&&!h&&this.shouldParseAsyncArrow())return this.checkPatternErrors(c,!1),this.checkYieldAwaitInDefaultParams(),this.awaitIdentPos>0&&this.raise(this.awaitIdentPos,"Cannot use 'await' as identifier inside an async function"),this.yieldPos=p,this.awaitPos=d,this.awaitIdentPos=f,this.parseSubscriptAsyncArrow(t,i,g,a);this.checkExpressionErrors(c,!0),this.yieldPos=p||this.yieldPos,this.awaitPos=d||this.awaitPos,this.awaitIdentPos=f||this.awaitIdentPos;var m=this.startNodeAt(t,i);m.callee=e,m.arguments=g,o&&(m.optional=h),e=this.finishNode(m,"CallExpression")}else if(this.type===au.backQuote){(h||n)&&this.raise(this.start,"Optional chaining cannot appear in the tag of tagged template expressions");var y=this.startNodeAt(t,i);y.tag=e,y.quasi=this.parseTemplate({isTagged:!0}),e=this.finishNode(y,"TaggedTemplateExpression")}return e},Hu.parseExprAtom=function(e,t,i){this.type===au.slash&&this.readRegexp();var r,s=this.potentialArrowAt===this.start;switch(this.type){case au._super:return this.allowSuper||this.raise(this.start,"'super' keyword outside a method"),r=this.startNode(),this.next(),this.type!==au.parenL||this.allowDirectSuper||this.raise(r.start,"super() call outside constructor of a subclass"),this.type!==au.dot&&this.type!==au.bracketL&&this.type!==au.parenL&&this.unexpected(),this.finishNode(r,"Super");case au._this:return r=this.startNode(),this.next(),this.finishNode(r,"ThisExpression");case au.name:var n=this.start,a=this.startLoc,o=this.containsEsc,h=this.parseIdent(!1);if(this.options.ecmaVersion>=8&&!o&&"async"===h.name&&!this.canInsertSemicolon()&&this.eat(au._function))return this.overrideContext(Wu.f_expr),this.parseFunction(this.startNodeAt(n,a),0,!1,!0,t);if(s&&!this.canInsertSemicolon()){if(this.eat(au.arrow))return this.parseArrowExpression(this.startNodeAt(n,a),[h],!1,t);if(this.options.ecmaVersion>=8&&"async"===h.name&&this.type===au.name&&!o&&(!this.potentialArrowInForAwait||"of"!==this.value||this.containsEsc))return h=this.parseIdent(!1),!this.canInsertSemicolon()&&this.eat(au.arrow)||this.unexpected(),this.parseArrowExpression(this.startNodeAt(n,a),[h],!0,t)}return h;case au.regexp:var u=this.value;return(r=this.parseLiteral(u.value)).regex={pattern:u.pattern,flags:u.flags},r;case au.num:case au.string:return this.parseLiteral(this.value);case au._null:case au._true:case au._false:return(r=this.startNode()).value=this.type===au._null?null:this.type===au._true,r.raw=this.type.keyword,this.next(),this.finishNode(r,"Literal");case au.parenL:var l=this.start,c=this.parseParenAndDistinguishExpression(s,t);return e&&(e.parenthesizedAssign<0&&!this.isSimpleAssignTarget(c)&&(e.parenthesizedAssign=l),e.parenthesizedBind<0&&(e.parenthesizedBind=l)),c;case au.bracketL:return r=this.startNode(),this.next(),r.elements=this.parseExprList(au.bracketR,!0,!0,e),this.finishNode(r,"ArrayExpression");case au.braceL:return this.overrideContext(Wu.b_expr),this.parseObj(!1,e);case au._function:return r=this.startNode(),this.next(),this.parseFunction(r,0);case au._class:return this.parseClass(this.startNode(),!1);case au._new:return this.parseNew();case au.backQuote:return this.parseTemplate();case au._import:return this.options.ecmaVersion>=11?this.parseExprImport(i):this.unexpected();default:return this.parseExprAtomDefault()}},Hu.parseExprAtomDefault=function(){this.unexpected()},Hu.parseExprImport=function(e){var t=this.startNode();if(this.containsEsc&&this.raiseRecoverable(this.start,"Escape sequence in keyword import"),this.next(),this.type===au.parenL&&!e)return this.parseDynamicImport(t);if(this.type===au.dot){var i=this.startNodeAt(t.start,t.loc&&t.loc.start);return i.name="import",t.meta=this.finishNode(i,"Identifier"),this.parseImportMeta(t)}this.unexpected()},Hu.parseDynamicImport=function(e){if(this.next(),e.source=this.parseMaybeAssign(),this.options.ecmaVersion>=16)this.eat(au.parenR)?e.options=null:(this.expect(au.comma),this.afterTrailingComma(au.parenR)?e.options=null:(e.options=this.parseMaybeAssign(),this.eat(au.parenR)||(this.expect(au.comma),this.afterTrailingComma(au.parenR)||this.unexpected())));else if(!this.eat(au.parenR)){var t=this.start;this.eat(au.comma)&&this.eat(au.parenR)?this.raiseRecoverable(t,"Trailing comma is not allowed in import()"):this.unexpected(t)}return this.finishNode(e,"ImportExpression")},Hu.parseImportMeta=function(e){this.next();var t=this.containsEsc;return e.property=this.parseIdent(!0),"meta"!==e.property.name&&this.raiseRecoverable(e.property.start,"The only valid meta property for import is 'import.meta'"),t&&this.raiseRecoverable(e.start,"'import.meta' must not contain escaped characters"),"module"===this.options.sourceType||this.options.allowImportExportEverywhere||this.raiseRecoverable(e.start,"Cannot use 'import.meta' outside a module"),this.finishNode(e,"MetaProperty")},Hu.parseLiteral=function(e){var t=this.startNode();return t.value=e,t.raw=this.input.slice(this.start,this.end),110===t.raw.charCodeAt(t.raw.length-1)&&(t.bigint=t.raw.slice(0,-1).replace(/_/g,"")),this.next(),this.finishNode(t,"Literal")},Hu.parseParenExpression=function(){this.expect(au.parenL);var e=this.parseExpression();return this.expect(au.parenR),e},Hu.shouldParseArrow=function(e){return!this.canInsertSemicolon()},Hu.parseParenAndDistinguishExpression=function(e,t){var i,r=this.start,s=this.startLoc,n=this.options.ecmaVersion>=8;if(this.options.ecmaVersion>=6){this.next();var a,o=this.start,h=this.startLoc,u=[],l=!0,c=!1,p=new Lu,d=this.yieldPos,f=this.awaitPos;for(this.yieldPos=0,this.awaitPos=0;this.type!==au.parenR;){if(l?l=!1:this.expect(au.comma),n&&this.afterTrailingComma(au.parenR,!0)){c=!0;break}if(this.type===au.ellipsis){a=this.start,u.push(this.parseParenItem(this.parseRestBinding())),this.type===au.comma&&this.raiseRecoverable(this.start,"Comma is not permitted after the rest element");break}u.push(this.parseMaybeAssign(!1,p,this.parseParenItem))}var g=this.lastTokEnd,m=this.lastTokEndLoc;if(this.expect(au.parenR),e&&this.shouldParseArrow(u)&&this.eat(au.arrow))return this.checkPatternErrors(p,!1),this.checkYieldAwaitInDefaultParams(),this.yieldPos=d,this.awaitPos=f,this.parseParenArrowList(r,s,u,t);u.length&&!c||this.unexpected(this.lastTokStart),a&&this.unexpected(a),this.checkExpressionErrors(p,!0),this.yieldPos=d||this.yieldPos,this.awaitPos=f||this.awaitPos,u.length>1?((i=this.startNodeAt(o,h)).expressions=u,this.finishNodeAt(i,"SequenceExpression",g,m)):i=u[0]}else i=this.parseParenExpression();if(this.options.preserveParens){var y=this.startNodeAt(r,s);return y.expression=i,this.finishNode(y,"ParenthesizedExpression")}return i},Hu.parseParenItem=function(e){return e},Hu.parseParenArrowList=function(e,t,i,r){return this.parseArrowExpression(this.startNodeAt(e,t),i,!1,r)};var Zu=[];Hu.parseNew=function(){this.containsEsc&&this.raiseRecoverable(this.start,"Escape sequence in keyword new");var e=this.startNode();if(this.next(),this.options.ecmaVersion>=6&&this.type===au.dot){var t=this.startNodeAt(e.start,e.loc&&e.loc.start);t.name="new",e.meta=this.finishNode(t,"Identifier"),this.next();var i=this.containsEsc;return e.property=this.parseIdent(!0),"target"!==e.property.name&&this.raiseRecoverable(e.property.start,"The only valid meta property for new is 'new.target'"),i&&this.raiseRecoverable(e.start,"'new.target' must not contain escaped characters"),this.allowNewDotTarget||this.raiseRecoverable(e.start,"'new.target' can only be used in functions and class static block"),this.finishNode(e,"MetaProperty")}var r=this.start,s=this.startLoc;return e.callee=this.parseSubscripts(this.parseExprAtom(null,!1,!0),r,s,!0,!1),this.eat(au.parenL)?e.arguments=this.parseExprList(au.parenR,this.options.ecmaVersion>=8,!1):e.arguments=Zu,this.finishNode(e,"NewExpression")},Hu.parseTemplateElement=function(e){var t=e.isTagged,i=this.startNode();return this.type===au.invalidTemplate?(t||this.raiseRecoverable(this.start,"Bad escape sequence in untagged template literal"),i.value={raw:this.value.replace(/\r\n?/g,"\n"),cooked:null}):i.value={raw:this.input.slice(this.start,this.end).replace(/\r\n?/g,"\n"),cooked:this.value},this.next(),i.tail=this.type===au.backQuote,this.finishNode(i,"TemplateElement")},Hu.parseTemplate=function(e){void 0===e&&(e={});var t=e.isTagged;void 0===t&&(t=!1);var i=this.startNode();this.next(),i.expressions=[];var r=this.parseTemplateElement({isTagged:t});for(i.quasis=[r];!r.tail;)this.type===au.eof&&this.raise(this.pos,"Unterminated template literal"),this.expect(au.dollarBraceL),i.expressions.push(this.parseExpression()),this.expect(au.braceR),i.quasis.push(r=this.parseTemplateElement({isTagged:t}));return this.next(),this.finishNode(i,"TemplateLiteral")},Hu.isAsyncProp=function(e){return!e.computed&&"Identifier"===e.key.type&&"async"===e.key.name&&(this.type===au.name||this.type===au.num||this.type===au.string||this.type===au.bracketL||this.type.keyword||this.options.ecmaVersion>=9&&this.type===au.star)&&!ou.test(this.input.slice(this.lastTokEnd,this.start))},Hu.parseObj=function(e,t){var i=this.startNode(),r=!0,s={};for(i.properties=[],this.next();!this.eat(au.braceR);){if(r)r=!1;else if(this.expect(au.comma),this.options.ecmaVersion>=5&&this.afterTrailingComma(au.braceR))break;var n=this.parseProperty(e,t);e||this.checkPropClash(n,s,t),i.properties.push(n)}return this.finishNode(i,e?"ObjectPattern":"ObjectExpression")},Hu.parseProperty=function(e,t){var i,r,s,n,a=this.startNode();if(this.options.ecmaVersion>=9&&this.eat(au.ellipsis))return e?(a.argument=this.parseIdent(!1),this.type===au.comma&&this.raiseRecoverable(this.start,"Comma is not permitted after the rest element"),this.finishNode(a,"RestElement")):(a.argument=this.parseMaybeAssign(!1,t),this.type===au.comma&&t&&t.trailingComma<0&&(t.trailingComma=this.start),this.finishNode(a,"SpreadElement"));this.options.ecmaVersion>=6&&(a.method=!1,a.shorthand=!1,(e||t)&&(s=this.start,n=this.startLoc),e||(i=this.eat(au.star)));var o=this.containsEsc;return this.parsePropertyName(a),!e&&!o&&this.options.ecmaVersion>=8&&!i&&this.isAsyncProp(a)?(r=!0,i=this.options.ecmaVersion>=9&&this.eat(au.star),this.parsePropertyName(a)):r=!1,this.parsePropertyValue(a,e,i,r,s,n,t,o),this.finishNode(a,"Property")},Hu.parseGetterSetter=function(e){e.kind=e.key.name,this.parsePropertyName(e),e.value=this.parseMethod(!1);var t="get"===e.kind?0:1;if(e.value.params.length!==t){var i=e.value.start;"get"===e.kind?this.raiseRecoverable(i,"getter should have no params"):this.raiseRecoverable(i,"setter should have exactly one param")}else"set"===e.kind&&"RestElement"===e.value.params[0].type&&this.raiseRecoverable(e.value.params[0].start,"Setter cannot use rest params")},Hu.parsePropertyValue=function(e,t,i,r,s,n,a,o){(i||r)&&this.type===au.colon&&this.unexpected(),this.eat(au.colon)?(e.value=t?this.parseMaybeDefault(this.start,this.startLoc):this.parseMaybeAssign(!1,a),e.kind="init"):this.options.ecmaVersion>=6&&this.type===au.parenL?(t&&this.unexpected(),e.kind="init",e.method=!0,e.value=this.parseMethod(i,r)):t||o||!(this.options.ecmaVersion>=5)||e.computed||"Identifier"!==e.key.type||"get"!==e.key.name&&"set"!==e.key.name||this.type===au.comma||this.type===au.braceR||this.type===au.eq?this.options.ecmaVersion>=6&&!e.computed&&"Identifier"===e.key.type?((i||r)&&this.unexpected(),this.checkUnreserved(e.key),"await"!==e.key.name||this.awaitIdentPos||(this.awaitIdentPos=s),e.kind="init",t?e.value=this.parseMaybeDefault(s,n,this.copyNode(e.key)):this.type===au.eq&&a?(a.shorthandAssign<0&&(a.shorthandAssign=this.start),e.value=this.parseMaybeDefault(s,n,this.copyNode(e.key))):e.value=this.copyNode(e.key),e.shorthand=!0):this.unexpected():((i||r)&&this.unexpected(),this.parseGetterSetter(e))},Hu.parsePropertyName=function(e){if(this.options.ecmaVersion>=6){if(this.eat(au.bracketL))return e.computed=!0,e.key=this.parseMaybeAssign(),this.expect(au.bracketR),e.key;e.computed=!1}return e.key=this.type===au.num||this.type===au.string?this.parseExprAtom():this.parseIdent("never"!==this.options.allowReserved)},Hu.initFunction=function(e){e.id=null,this.options.ecmaVersion>=6&&(e.generator=e.expression=!1),this.options.ecmaVersion>=8&&(e.async=!1)},Hu.parseMethod=function(e,t,i){var r=this.startNode(),s=this.yieldPos,n=this.awaitPos,a=this.awaitIdentPos;return this.initFunction(r),this.options.ecmaVersion>=6&&(r.generator=e),this.options.ecmaVersion>=8&&(r.async=!!t),this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,this.enterScope(64|Tu(t,r.generator)|(i?128:0)),this.expect(au.parenL),r.params=this.parseBindingList(au.parenR,!1,this.options.ecmaVersion>=8),this.checkYieldAwaitInDefaultParams(),this.parseFunctionBody(r,!1,!0,!1),this.yieldPos=s,this.awaitPos=n,this.awaitIdentPos=a,this.finishNode(r,"FunctionExpression")},Hu.parseArrowExpression=function(e,t,i,r){var s=this.yieldPos,n=this.awaitPos,a=this.awaitIdentPos;return this.enterScope(16|Tu(i,!1)),this.initFunction(e),this.options.ecmaVersion>=8&&(e.async=!!i),this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,e.params=this.toAssignableList(t,!0),this.parseFunctionBody(e,!0,!1,r),this.yieldPos=s,this.awaitPos=n,this.awaitIdentPos=a,this.finishNode(e,"ArrowFunctionExpression")},Hu.parseFunctionBody=function(e,t,i,r){var s=t&&this.type!==au.braceL,n=this.strict,a=!1;if(s)e.body=this.parseMaybeAssign(r),e.expression=!0,this.checkParams(e,!1);else{var o=this.options.ecmaVersion>=7&&!this.isSimpleParamList(e.params);n&&!o||(a=this.strictDirective(this.end))&&o&&this.raiseRecoverable(e.start,"Illegal 'use strict' directive in function with non-simple parameter list");var h=this.labels;this.labels=[],a&&(this.strict=!0),this.checkParams(e,!n&&!a&&!t&&!i&&this.isSimpleParamList(e.params)),this.strict&&e.id&&this.checkLValSimple(e.id,5),e.body=this.parseBlock(!1,void 0,a&&!n),e.expression=!1,this.adaptDirectivePrologue(e.body.body),this.labels=h}this.exitScope()},Hu.isSimpleParamList=function(e){for(var t=0,i=e;t<i.length;t+=1){if("Identifier"!==i[t].type)return!1}return!0},Hu.checkParams=function(e,t){for(var i=Object.create(null),r=0,s=e.params;r<s.length;r+=1){var n=s[r];this.checkLValInnerPattern(n,1,t?null:i)}},Hu.parseExprList=function(e,t,i,r){for(var s=[],n=!0;!this.eat(e);){if(n)n=!1;else if(this.expect(au.comma),t&&this.afterTrailingComma(e))break;var a=void 0;i&&this.type===au.comma?a=null:this.type===au.ellipsis?(a=this.parseSpread(r),r&&this.type===au.comma&&r.trailingComma<0&&(r.trailingComma=this.start)):a=this.parseMaybeAssign(!1,r),s.push(a)}return s},Hu.checkUnreserved=function(e){var t=e.start,i=e.end,r=e.name;(this.inGenerator&&"yield"===r&&this.raiseRecoverable(t,"Cannot use 'yield' as identifier inside a generator"),this.inAsync&&"await"===r&&this.raiseRecoverable(t,"Cannot use 'await' as identifier inside an async function"),this.currentThisScope().inClassFieldInit&&"arguments"===r&&this.raiseRecoverable(t,"Cannot use 'arguments' in class field initializer"),!this.inClassStaticBlock||"arguments"!==r&&"await"!==r||this.raise(t,"Cannot use "+r+" in class static initialization block"),this.keywords.test(r)&&this.raise(t,"Unexpected keyword '"+r+"'"),this.options.ecmaVersion<6&&-1!==this.input.slice(t,i).indexOf("\\"))||(this.strict?this.reservedWordsStrict:this.reservedWords).test(r)&&(this.inAsync||"await"!==r||this.raiseRecoverable(t,"Cannot use keyword 'await' outside an async function"),this.raiseRecoverable(t,"The keyword '"+r+"' is reserved"))},Hu.parseIdent=function(e){var t=this.parseIdentNode();return this.next(!!e),this.finishNode(t,"Identifier"),e||(this.checkUnreserved(t),"await"!==t.name||this.awaitIdentPos||(this.awaitIdentPos=t.start)),t},Hu.parseIdentNode=function(){var e=this.startNode();return this.type===au.name?e.name=this.value:this.type.keyword?(e.name=this.type.keyword,"class"!==e.name&&"function"!==e.name||this.lastTokEnd===this.lastTokStart+1&&46===this.input.charCodeAt(this.lastTokStart)||this.context.pop(),this.type=au.name):this.unexpected(),e},Hu.parsePrivateIdent=function(){var e=this.startNode();return this.type===au.privateId?e.name=this.value:this.unexpected(),this.next(),this.finishNode(e,"PrivateIdentifier"),this.options.checkPrivateFields&&(0===this.privateNameStack.length?this.raise(e.start,"Private field '#"+e.name+"' must be declared in an enclosing class"):this.privateNameStack[this.privateNameStack.length-1].used.push(e)),e},Hu.parseYield=function(e){this.yieldPos||(this.yieldPos=this.start);var t=this.startNode();return this.next(),this.type===au.semi||this.canInsertSemicolon()||this.type!==au.star&&!this.type.startsExpr?(t.delegate=!1,t.argument=null):(t.delegate=this.eat(au.star),t.argument=this.parseMaybeAssign(e)),this.finishNode(t,"YieldExpression")},Hu.parseAwait=function(e){this.awaitPos||(this.awaitPos=this.start);var t=this.startNode();return this.next(),t.argument=this.parseMaybeUnary(null,!0,!1,e),this.finishNode(t,"AwaitExpression")};var Ku=Mu.prototype;Ku.raise=function(e,t){var i=Du(this.input,e);t+=" ("+i.line+":"+i.column+")";var r=new SyntaxError(t);throw r.pos=e,r.loc=i,r.raisedAt=this.pos,r},Ku.raiseRecoverable=Ku.raise,Ku.curPosition=function(){if(this.options.locations)return new wu(this.curLine,this.pos-this.lineStart)};var Ju=Mu.prototype,Qu=function(e){this.flags=e,this.var=[],this.lexical=[],this.functions=[],this.inClassFieldInit=!1};Ju.enterScope=function(e){this.scopeStack.push(new Qu(e))},Ju.exitScope=function(){this.scopeStack.pop()},Ju.treatFunctionsAsVarInScope=function(e){return 2&e.flags||!this.inModule&&1&e.flags},Ju.declareName=function(e,t,i){var r=!1;if(2===t){var s=this.currentScope();r=s.lexical.indexOf(e)>-1||s.functions.indexOf(e)>-1||s.var.indexOf(e)>-1,s.lexical.push(e),this.inModule&&1&s.flags&&delete this.undefinedExports[e]}else if(4===t){this.currentScope().lexical.push(e)}else if(3===t){var n=this.currentScope();r=this.treatFunctionsAsVar?n.lexical.indexOf(e)>-1:n.lexical.indexOf(e)>-1||n.var.indexOf(e)>-1,n.functions.push(e)}else for(var a=this.scopeStack.length-1;a>=0;--a){var o=this.scopeStack[a];if(o.lexical.indexOf(e)>-1&&!(32&o.flags&&o.lexical[0]===e)||!this.treatFunctionsAsVarInScope(o)&&o.functions.indexOf(e)>-1){r=!0;break}if(o.var.push(e),this.inModule&&1&o.flags&&delete this.undefinedExports[e],259&o.flags)break}r&&this.raiseRecoverable(i,"Identifier '"+e+"' has already been declared")},Ju.checkLocalExport=function(e){-1===this.scopeStack[0].lexical.indexOf(e.name)&&-1===this.scopeStack[0].var.indexOf(e.name)&&(this.undefinedExports[e.name]=e)},Ju.currentScope=function(){return this.scopeStack[this.scopeStack.length-1]},Ju.currentVarScope=function(){for(var e=this.scopeStack.length-1;;e--){var t=this.scopeStack[e];if(259&t.flags)return t}},Ju.currentThisScope=function(){for(var e=this.scopeStack.length-1;;e--){var t=this.scopeStack[e];if(259&t.flags&&!(16&t.flags))return t}};var el=function(e,t,i){this.type="",this.start=t,this.end=0,e.options.locations&&(this.loc=new Cu(e,i)),e.options.directSourceFile&&(this.sourceFile=e.options.directSourceFile),e.options.ranges&&(this.range=[t,0])},tl=Mu.prototype;function il(e,t,i,r){return e.type=t,e.end=i,this.options.locations&&(e.loc.end=r),this.options.ranges&&(e.range[1]=i),e}tl.startNode=function(){return new el(this,this.start,this.startLoc)},tl.startNodeAt=function(e,t){return new el(this,e,t)},tl.finishNode=function(e,t){return il.call(this,e,t,this.lastTokEnd,this.lastTokEndLoc)},tl.finishNodeAt=function(e,t,i,r){return il.call(this,e,t,i,r)},tl.copyNode=function(e){var t=new el(this,e.start,this.startLoc);for(var i in e)t[i]=e[i];return t};var rl="ASCII ASCII_Hex_Digit AHex Alphabetic Alpha Any Assigned Bidi_Control Bidi_C Bidi_Mirrored Bidi_M Case_Ignorable CI Cased Changes_When_Casefolded CWCF Changes_When_Casemapped CWCM Changes_When_Lowercased CWL Changes_When_NFKC_Casefolded CWKCF Changes_When_Titlecased CWT Changes_When_Uppercased CWU Dash Default_Ignorable_Code_Point DI Deprecated Dep Diacritic Dia Emoji Emoji_Component Emoji_Modifier Emoji_Modifier_Base Emoji_Presentation Extender Ext Grapheme_Base Gr_Base Grapheme_Extend Gr_Ext Hex_Digit Hex IDS_Binary_Operator IDSB IDS_Trinary_Operator IDST ID_Continue IDC ID_Start IDS Ideographic Ideo Join_Control Join_C Logical_Order_Exception LOE Lowercase Lower Math Noncharacter_Code_Point NChar Pattern_Syntax Pat_Syn Pattern_White_Space Pat_WS Quotation_Mark QMark Radical Regional_Indicator RI Sentence_Terminal STerm Soft_Dotted SD Terminal_Punctuation Term Unified_Ideograph UIdeo Uppercase Upper Variation_Selector VS White_Space space XID_Continue XIDC XID_Start XIDS",sl=rl+" Extended_Pictographic",nl=sl+" EBase EComp EMod EPres ExtPict",al={9:rl,10:sl,11:sl,12:nl,13:nl,14:nl},ol={9:"",10:"",11:"",12:"",13:"",14:"Basic_Emoji Emoji_Keycap_Sequence RGI_Emoji_Modifier_Sequence RGI_Emoji_Flag_Sequence RGI_Emoji_Tag_Sequence RGI_Emoji_ZWJ_Sequence RGI_Emoji"},hl="Cased_Letter LC Close_Punctuation Pe Connector_Punctuation Pc Control Cc cntrl Currency_Symbol Sc Dash_Punctuation Pd Decimal_Number Nd digit Enclosing_Mark Me Final_Punctuation Pf Format Cf Initial_Punctuation Pi Letter L Letter_Number Nl Line_Separator Zl Lowercase_Letter Ll Mark M Combining_Mark Math_Symbol Sm Modifier_Letter Lm Modifier_Symbol Sk Nonspacing_Mark Mn Number N Open_Punctuation Ps Other C Other_Letter Lo Other_Number No Other_Punctuation Po Other_Symbol So Paragraph_Separator Zp Private_Use Co Punctuation P punct Separator Z Space_Separator Zs Spacing_Mark Mc Surrogate Cs Symbol S Titlecase_Letter Lt Unassigned Cn Uppercase_Letter Lu",ul="Adlam Adlm Ahom Anatolian_Hieroglyphs Hluw Arabic Arab Armenian Armn Avestan Avst Balinese Bali Bamum Bamu Bassa_Vah Bass Batak Batk Bengali Beng Bhaiksuki Bhks Bopomofo Bopo Brahmi Brah Braille Brai Buginese Bugi Buhid Buhd Canadian_Aboriginal Cans Carian Cari Caucasian_Albanian Aghb Chakma Cakm Cham Cham Cherokee Cher Common Zyyy Coptic Copt Qaac Cuneiform Xsux Cypriot Cprt Cyrillic Cyrl Deseret Dsrt Devanagari Deva Duployan Dupl Egyptian_Hieroglyphs Egyp Elbasan Elba Ethiopic Ethi Georgian Geor Glagolitic Glag Gothic Goth Grantha Gran Greek Grek Gujarati Gujr Gurmukhi Guru Han Hani Hangul Hang Hanunoo Hano Hatran Hatr Hebrew Hebr Hiragana Hira Imperial_Aramaic Armi Inherited Zinh Qaai Inscriptional_Pahlavi Phli Inscriptional_Parthian Prti Javanese Java Kaithi Kthi Kannada Knda Katakana Kana Kayah_Li Kali Kharoshthi Khar Khmer Khmr Khojki Khoj Khudawadi Sind Lao Laoo Latin Latn Lepcha Lepc Limbu Limb Linear_A Lina Linear_B Linb Lisu Lisu Lycian Lyci Lydian Lydi Mahajani Mahj Malayalam Mlym Mandaic Mand Manichaean Mani Marchen Marc Masaram_Gondi Gonm Meetei_Mayek Mtei Mende_Kikakui Mend Meroitic_Cursive Merc Meroitic_Hieroglyphs Mero Miao Plrd Modi Mongolian Mong Mro Mroo Multani Mult Myanmar Mymr Nabataean Nbat New_Tai_Lue Talu Newa Newa Nko Nkoo Nushu Nshu Ogham Ogam Ol_Chiki Olck Old_Hungarian Hung Old_Italic Ital Old_North_Arabian Narb Old_Permic Perm Old_Persian Xpeo Old_South_Arabian Sarb Old_Turkic Orkh Oriya Orya Osage Osge Osmanya Osma Pahawh_Hmong Hmng Palmyrene Palm Pau_Cin_Hau Pauc Phags_Pa Phag Phoenician Phnx Psalter_Pahlavi Phlp Rejang Rjng Runic Runr Samaritan Samr Saurashtra Saur Sharada Shrd Shavian Shaw Siddham Sidd SignWriting Sgnw Sinhala Sinh Sora_Sompeng Sora Soyombo Soyo Sundanese Sund Syloti_Nagri Sylo Syriac Syrc Tagalog Tglg Tagbanwa Tagb Tai_Le Tale Tai_Tham Lana Tai_Viet Tavt Takri Takr Tamil Taml Tangut Tang Telugu Telu Thaana Thaa Thai Thai Tibetan Tibt Tifinagh Tfng Tirhuta Tirh Ugaritic Ugar Vai Vaii Warang_Citi Wara Yi Yiii Zanabazar_Square Zanb",ll=ul+" Dogra Dogr Gunjala_Gondi Gong Hanifi_Rohingya Rohg Makasar Maka Medefaidrin Medf Old_Sogdian Sogo Sogdian Sogd",cl=ll+" Elymaic Elym Nandinagari Nand Nyiakeng_Puachue_Hmong Hmnp Wancho Wcho",pl=cl+" Chorasmian Chrs Diak Dives_Akuru Khitan_Small_Script Kits Yezi Yezidi",dl=pl+" Cypro_Minoan Cpmn Old_Uyghur Ougr Tangsa Tnsa Toto Vithkuqi Vith",fl={9:ul,10:ll,11:cl,12:pl,13:dl,14:dl+" Gara Garay Gukh Gurung_Khema Hrkt Katakana_Or_Hiragana Kawi Kirat_Rai Krai Nag_Mundari Nagm Ol_Onal Onao Sunu Sunuwar Todhri Todr Tulu_Tigalari Tutg Unknown Zzzz"},gl={};function ml(e){var t=gl[e]={binary:vu(al[e]+" "+hl),binaryOfStrings:vu(ol[e]),nonBinary:{General_Category:vu(hl),Script:vu(fl[e])}};t.nonBinary.Script_Extensions=t.nonBinary.Script,t.nonBinary.gc=t.nonBinary.General_Category,t.nonBinary.sc=t.nonBinary.Script,t.nonBinary.scx=t.nonBinary.Script_Extensions}for(var yl=0,xl=[9,10,11,12,13,14];yl<xl.length;yl+=1){ml(xl[yl])}var vl=Mu.prototype,bl=function(e,t){this.parent=e,this.base=t||this};bl.prototype.separatedFrom=function(e){for(var t=this;t;t=t.parent)for(var i=e;i;i=i.parent)if(t.base===i.base&&t!==i)return!0;return!1},bl.prototype.sibling=function(){return new bl(this.parent,this.base)};var _l=function(e){this.parser=e,this.validFlags="gim"+(e.options.ecmaVersion>=6?"uy":"")+(e.options.ecmaVersion>=9?"s":"")+(e.options.ecmaVersion>=13?"d":"")+(e.options.ecmaVersion>=15?"v":""),this.unicodeProperties=gl[e.options.ecmaVersion>=14?14:e.options.ecmaVersion],this.source="",this.flags="",this.start=0,this.switchU=!1,this.switchV=!1,this.switchN=!1,this.pos=0,this.lastIntValue=0,this.lastStringValue="",this.lastAssertionIsQuantifiable=!1,this.numCapturingParens=0,this.maxBackReference=0,this.groupNames=Object.create(null),this.backReferenceNames=[],this.branchID=null};function wl(e){return 105===e||109===e||115===e}function Cl(e){return 36===e||e>=40&&e<=43||46===e||63===e||e>=91&&e<=94||e>=123&&e<=125}function Dl(e){return e>=65&&e<=90||e>=97&&e<=122}_l.prototype.reset=function(e,t,i){var r=-1!==i.indexOf("v"),s=-1!==i.indexOf("u");this.start=0|e,this.source=t+"",this.flags=i,r&&this.parser.options.ecmaVersion>=15?(this.switchU=!0,this.switchV=!0,this.switchN=!0):(this.switchU=s&&this.parser.options.ecmaVersion>=6,this.switchV=!1,this.switchN=s&&this.parser.options.ecmaVersion>=9)},_l.prototype.raise=function(e){this.parser.raiseRecoverable(this.start,"Invalid regular expression: /"+this.source+"/: "+e)},_l.prototype.at=function(e,t){void 0===t&&(t=!1);var i=this.source,r=i.length;if(e>=r)return-1;var s=i.charCodeAt(e);if(!t&&!this.switchU||s<=55295||s>=57344||e+1>=r)return s;var n=i.charCodeAt(e+1);return n>=56320&&n<=57343?(s<<10)+n-56613888:s},_l.prototype.nextIndex=function(e,t){void 0===t&&(t=!1);var i=this.source,r=i.length;if(e>=r)return r;var s,n=i.charCodeAt(e);return!t&&!this.switchU||n<=55295||n>=57344||e+1>=r||(s=i.charCodeAt(e+1))<56320||s>57343?e+1:e+2},_l.prototype.current=function(e){return void 0===e&&(e=!1),this.at(this.pos,e)},_l.prototype.lookahead=function(e){return void 0===e&&(e=!1),this.at(this.nextIndex(this.pos,e),e)},_l.prototype.advance=function(e){void 0===e&&(e=!1),this.pos=this.nextIndex(this.pos,e)},_l.prototype.eat=function(e,t){return void 0===t&&(t=!1),this.current(t)===e&&(this.advance(t),!0)},_l.prototype.eatChars=function(e,t){void 0===t&&(t=!1);for(var i=this.pos,r=0,s=e;r<s.length;r+=1){var n=s[r],a=this.at(i,t);if(-1===a||a!==n)return!1;i=this.nextIndex(i,t)}return this.pos=i,!0},vl.validateRegExpFlags=function(e){for(var t=e.validFlags,i=e.flags,r=!1,s=!1,n=0;n<i.length;n++){var a=i.charAt(n);-1===t.indexOf(a)&&this.raise(e.start,"Invalid regular expression flag"),i.indexOf(a,n+1)>-1&&this.raise(e.start,"Duplicate regular expression flag"),"u"===a&&(r=!0),"v"===a&&(s=!0)}this.options.ecmaVersion>=15&&r&&s&&this.raise(e.start,"Invalid regular expression flag")},vl.validateRegExpPattern=function(e){this.regexp_pattern(e),!e.switchN&&this.options.ecmaVersion>=9&&function(e){for(var t in e)return!0;return!1}(e.groupNames)&&(e.switchN=!0,this.regexp_pattern(e))},vl.regexp_pattern=function(e){e.pos=0,e.lastIntValue=0,e.lastStringValue="",e.lastAssertionIsQuantifiable=!1,e.numCapturingParens=0,e.maxBackReference=0,e.groupNames=Object.create(null),e.backReferenceNames.length=0,e.branchID=null,this.regexp_disjunction(e),e.pos!==e.source.length&&(e.eat(41)&&e.raise("Unmatched ')'"),(e.eat(93)||e.eat(125))&&e.raise("Lone quantifier brackets")),e.maxBackReference>e.numCapturingParens&&e.raise("Invalid escape");for(var t=0,i=e.backReferenceNames;t<i.length;t+=1){var r=i[t];e.groupNames[r]||e.raise("Invalid named capture referenced")}},vl.regexp_disjunction=function(e){var t=this.options.ecmaVersion>=16;for(t&&(e.branchID=new bl(e.branchID,null)),this.regexp_alternative(e);e.eat(124);)t&&(e.branchID=e.branchID.sibling()),this.regexp_alternative(e);t&&(e.branchID=e.branchID.parent),this.regexp_eatQuantifier(e,!0)&&e.raise("Nothing to repeat"),e.eat(123)&&e.raise("Lone quantifier brackets")},vl.regexp_alternative=function(e){for(;e.pos<e.source.length&&this.regexp_eatTerm(e););},vl.regexp_eatTerm=function(e){return this.regexp_eatAssertion(e)?(e.lastAssertionIsQuantifiable&&this.regexp_eatQuantifier(e)&&e.switchU&&e.raise("Invalid quantifier"),!0):!!(e.switchU?this.regexp_eatAtom(e):this.regexp_eatExtendedAtom(e))&&(this.regexp_eatQuantifier(e),!0)},vl.regexp_eatAssertion=function(e){var t=e.pos;if(e.lastAssertionIsQuantifiable=!1,e.eat(94)||e.eat(36))return!0;if(e.eat(92)){if(e.eat(66)||e.eat(98))return!0;e.pos=t}if(e.eat(40)&&e.eat(63)){var i=!1;if(this.options.ecmaVersion>=9&&(i=e.eat(60)),e.eat(61)||e.eat(33))return this.regexp_disjunction(e),e.eat(41)||e.raise("Unterminated group"),e.lastAssertionIsQuantifiable=!i,!0}return e.pos=t,!1},vl.regexp_eatQuantifier=function(e,t){return void 0===t&&(t=!1),!!this.regexp_eatQuantifierPrefix(e,t)&&(e.eat(63),!0)},vl.regexp_eatQuantifierPrefix=function(e,t){return e.eat(42)||e.eat(43)||e.eat(63)||this.regexp_eatBracedQuantifier(e,t)},vl.regexp_eatBracedQuantifier=function(e,t){var i=e.pos;if(e.eat(123)){var r=0,s=-1;if(this.regexp_eatDecimalDigits(e)&&(r=e.lastIntValue,e.eat(44)&&this.regexp_eatDecimalDigits(e)&&(s=e.lastIntValue),e.eat(125)))return-1!==s&&s<r&&!t&&e.raise("numbers out of order in {} quantifier"),!0;e.switchU&&!t&&e.raise("Incomplete quantifier"),e.pos=i}return!1},vl.regexp_eatAtom=function(e){return this.regexp_eatPatternCharacters(e)||e.eat(46)||this.regexp_eatReverseSolidusAtomEscape(e)||this.regexp_eatCharacterClass(e)||this.regexp_eatUncapturingGroup(e)||this.regexp_eatCapturingGroup(e)},vl.regexp_eatReverseSolidusAtomEscape=function(e){var t=e.pos;if(e.eat(92)){if(this.regexp_eatAtomEscape(e))return!0;e.pos=t}return!1},vl.regexp_eatUncapturingGroup=function(e){var t=e.pos;if(e.eat(40)){if(e.eat(63)){if(this.options.ecmaVersion>=16){var i=this.regexp_eatModifiers(e),r=e.eat(45);if(i||r){for(var s=0;s<i.length;s++){var n=i.charAt(s);i.indexOf(n,s+1)>-1&&e.raise("Duplicate regular expression modifiers")}if(r){var a=this.regexp_eatModifiers(e);i||a||58!==e.current()||e.raise("Invalid regular expression modifiers");for(var o=0;o<a.length;o++){var h=a.charAt(o);(a.indexOf(h,o+1)>-1||i.indexOf(h)>-1)&&e.raise("Duplicate regular expression modifiers")}}}}if(e.eat(58)){if(this.regexp_disjunction(e),e.eat(41))return!0;e.raise("Unterminated group")}}e.pos=t}return!1},vl.regexp_eatCapturingGroup=function(e){if(e.eat(40)){if(this.options.ecmaVersion>=9?this.regexp_groupSpecifier(e):63===e.current()&&e.raise("Invalid group"),this.regexp_disjunction(e),e.eat(41))return e.numCapturingParens+=1,!0;e.raise("Unterminated group")}return!1},vl.regexp_eatModifiers=function(e){for(var t="",i=0;-1!==(i=e.current())&&wl(i);)t+=bu(i),e.advance();return t},vl.regexp_eatExtendedAtom=function(e){return e.eat(46)||this.regexp_eatReverseSolidusAtomEscape(e)||this.regexp_eatCharacterClass(e)||this.regexp_eatUncapturingGroup(e)||this.regexp_eatCapturingGroup(e)||this.regexp_eatInvalidBracedQuantifier(e)||this.regexp_eatExtendedPatternCharacter(e)},vl.regexp_eatInvalidBracedQuantifier=function(e){return this.regexp_eatBracedQuantifier(e,!0)&&e.raise("Nothing to repeat"),!1},vl.regexp_eatSyntaxCharacter=function(e){var t=e.current();return!!Cl(t)&&(e.lastIntValue=t,e.advance(),!0)},vl.regexp_eatPatternCharacters=function(e){for(var t=e.pos,i=0;-1!==(i=e.current())&&!Cl(i);)e.advance();return e.pos!==t},vl.regexp_eatExtendedPatternCharacter=function(e){var t=e.current();return!(-1===t||36===t||t>=40&&t<=43||46===t||63===t||91===t||94===t||124===t)&&(e.advance(),!0)},vl.regexp_groupSpecifier=function(e){if(e.eat(63)){this.regexp_eatGroupName(e)||e.raise("Invalid group");var t=this.options.ecmaVersion>=16,i=e.groupNames[e.lastStringValue];if(i)if(t)for(var r=0,s=i;r<s.length;r+=1){s[r].separatedFrom(e.branchID)||e.raise("Duplicate capture group name")}else e.raise("Duplicate capture group name");t?(i||(e.groupNames[e.lastStringValue]=[])).push(e.branchID):e.groupNames[e.lastStringValue]=!0}},vl.regexp_eatGroupName=function(e){if(e.lastStringValue="",e.eat(60)){if(this.regexp_eatRegExpIdentifierName(e)&&e.eat(62))return!0;e.raise("Invalid capture group name")}return!1},vl.regexp_eatRegExpIdentifierName=function(e){if(e.lastStringValue="",this.regexp_eatRegExpIdentifierStart(e)){for(e.lastStringValue+=bu(e.lastIntValue);this.regexp_eatRegExpIdentifierPart(e);)e.lastStringValue+=bu(e.lastIntValue);return!0}return!1},vl.regexp_eatRegExpIdentifierStart=function(e){var t=e.pos,i=this.options.ecmaVersion>=11,r=e.current(i);return e.advance(i),92===r&&this.regexp_eatRegExpUnicodeEscapeSequence(e,i)&&(r=e.lastIntValue),function(e){return Jh(e,!0)||36===e||95===e}(r)?(e.lastIntValue=r,!0):(e.pos=t,!1)},vl.regexp_eatRegExpIdentifierPart=function(e){var t=e.pos,i=this.options.ecmaVersion>=11,r=e.current(i);return e.advance(i),92===r&&this.regexp_eatRegExpUnicodeEscapeSequence(e,i)&&(r=e.lastIntValue),function(e){return Qh(e,!0)||36===e||95===e||8204===e||8205===e}(r)?(e.lastIntValue=r,!0):(e.pos=t,!1)},vl.regexp_eatAtomEscape=function(e){return!!(this.regexp_eatBackReference(e)||this.regexp_eatCharacterClassEscape(e)||this.regexp_eatCharacterEscape(e)||e.switchN&&this.regexp_eatKGroupName(e))||(e.switchU&&(99===e.current()&&e.raise("Invalid unicode escape"),e.raise("Invalid escape")),!1)},vl.regexp_eatBackReference=function(e){var t=e.pos;if(this.regexp_eatDecimalEscape(e)){var i=e.lastIntValue;if(e.switchU)return i>e.maxBackReference&&(e.maxBackReference=i),!0;if(i<=e.numCapturingParens)return!0;e.pos=t}return!1},vl.regexp_eatKGroupName=function(e){if(e.eat(107)){if(this.regexp_eatGroupName(e))return e.backReferenceNames.push(e.lastStringValue),!0;e.raise("Invalid named reference")}return!1},vl.regexp_eatCharacterEscape=function(e){return this.regexp_eatControlEscape(e)||this.regexp_eatCControlLetter(e)||this.regexp_eatZero(e)||this.regexp_eatHexEscapeSequence(e)||this.regexp_eatRegExpUnicodeEscapeSequence(e,!1)||!e.switchU&&this.regexp_eatLegacyOctalEscapeSequence(e)||this.regexp_eatIdentityEscape(e)},vl.regexp_eatCControlLetter=function(e){var t=e.pos;if(e.eat(99)){if(this.regexp_eatControlLetter(e))return!0;e.pos=t}return!1},vl.regexp_eatZero=function(e){return 48===e.current()&&!Sl(e.lookahead())&&(e.lastIntValue=0,e.advance(),!0)},vl.regexp_eatControlEscape=function(e){var t=e.current();return 116===t?(e.lastIntValue=9,e.advance(),!0):110===t?(e.lastIntValue=10,e.advance(),!0):118===t?(e.lastIntValue=11,e.advance(),!0):102===t?(e.lastIntValue=12,e.advance(),!0):114===t&&(e.lastIntValue=13,e.advance(),!0)},vl.regexp_eatControlLetter=function(e){var t=e.current();return!!Dl(t)&&(e.lastIntValue=t%32,e.advance(),!0)},vl.regexp_eatRegExpUnicodeEscapeSequence=function(e,t){void 0===t&&(t=!1);var i,r=e.pos,s=t||e.switchU;if(e.eat(117)){if(this.regexp_eatFixedHexDigits(e,4)){var n=e.lastIntValue;if(s&&n>=55296&&n<=56319){var a=e.pos;if(e.eat(92)&&e.eat(117)&&this.regexp_eatFixedHexDigits(e,4)){var o=e.lastIntValue;if(o>=56320&&o<=57343)return e.lastIntValue=1024*(n-55296)+(o-56320)+65536,!0}e.pos=a,e.lastIntValue=n}return!0}if(s&&e.eat(123)&&this.regexp_eatHexDigits(e)&&e.eat(125)&&((i=e.lastIntValue)>=0&&i<=1114111))return!0;s&&e.raise("Invalid unicode escape"),e.pos=r}return!1},vl.regexp_eatIdentityEscape=function(e){if(e.switchU)return!!this.regexp_eatSyntaxCharacter(e)||!!e.eat(47)&&(e.lastIntValue=47,!0);var t=e.current();return!(99===t||e.switchN&&107===t)&&(e.lastIntValue=t,e.advance(),!0)},vl.regexp_eatDecimalEscape=function(e){e.lastIntValue=0;var t=e.current();if(t>=49&&t<=57){do{e.lastIntValue=10*e.lastIntValue+(t-48),e.advance()}while((t=e.current())>=48&&t<=57);return!0}return!1};function El(e){return Dl(e)||95===e}function Al(e){return El(e)||Sl(e)}function Sl(e){return e>=48&&e<=57}function Fl(e){return e>=48&&e<=57||e>=65&&e<=70||e>=97&&e<=102}function Tl(e){return e>=65&&e<=70?e-65+10:e>=97&&e<=102?e-97+10:e-48}function Ml(e){return e>=48&&e<=55}vl.regexp_eatCharacterClassEscape=function(e){var t=e.current();if(function(e){return 100===e||68===e||115===e||83===e||119===e||87===e}(t))return e.lastIntValue=-1,e.advance(),1;var i=!1;if(e.switchU&&this.options.ecmaVersion>=9&&((i=80===t)||112===t)){var r;if(e.lastIntValue=-1,e.advance(),e.eat(123)&&(r=this.regexp_eatUnicodePropertyValueExpression(e))&&e.eat(125))return i&&2===r&&e.raise("Invalid property name"),r;e.raise("Invalid property name")}return 0},vl.regexp_eatUnicodePropertyValueExpression=function(e){var t=e.pos;if(this.regexp_eatUnicodePropertyName(e)&&e.eat(61)){var i=e.lastStringValue;if(this.regexp_eatUnicodePropertyValue(e)){var r=e.lastStringValue;return this.regexp_validateUnicodePropertyNameAndValue(e,i,r),1}}if(e.pos=t,this.regexp_eatLoneUnicodePropertyNameOrValue(e)){var s=e.lastStringValue;return this.regexp_validateUnicodePropertyNameOrValue(e,s)}return 0},vl.regexp_validateUnicodePropertyNameAndValue=function(e,t,i){mu(e.unicodeProperties.nonBinary,t)||e.raise("Invalid property name"),e.unicodeProperties.nonBinary[t].test(i)||e.raise("Invalid property value")},vl.regexp_validateUnicodePropertyNameOrValue=function(e,t){return e.unicodeProperties.binary.test(t)?1:e.switchV&&e.unicodeProperties.binaryOfStrings.test(t)?2:void e.raise("Invalid property name")},vl.regexp_eatUnicodePropertyName=function(e){var t=0;for(e.lastStringValue="";El(t=e.current());)e.lastStringValue+=bu(t),e.advance();return""!==e.lastStringValue},vl.regexp_eatUnicodePropertyValue=function(e){var t=0;for(e.lastStringValue="";Al(t=e.current());)e.lastStringValue+=bu(t),e.advance();return""!==e.lastStringValue},vl.regexp_eatLoneUnicodePropertyNameOrValue=function(e){return this.regexp_eatUnicodePropertyValue(e)},vl.regexp_eatCharacterClass=function(e){if(e.eat(91)){var t=e.eat(94),i=this.regexp_classContents(e);return e.eat(93)||e.raise("Unterminated character class"),t&&2===i&&e.raise("Negated character class may contain strings"),!0}return!1},vl.regexp_classContents=function(e){return 93===e.current()?1:e.switchV?this.regexp_classSetExpression(e):(this.regexp_nonEmptyClassRanges(e),1)},vl.regexp_nonEmptyClassRanges=function(e){for(;this.regexp_eatClassAtom(e);){var t=e.lastIntValue;if(e.eat(45)&&this.regexp_eatClassAtom(e)){var i=e.lastIntValue;!e.switchU||-1!==t&&-1!==i||e.raise("Invalid character class"),-1!==t&&-1!==i&&t>i&&e.raise("Range out of order in character class")}}},vl.regexp_eatClassAtom=function(e){var t=e.pos;if(e.eat(92)){if(this.regexp_eatClassEscape(e))return!0;if(e.switchU){var i=e.current();(99===i||Ml(i))&&e.raise("Invalid class escape"),e.raise("Invalid escape")}e.pos=t}var r=e.current();return 93!==r&&(e.lastIntValue=r,e.advance(),!0)},vl.regexp_eatClassEscape=function(e){var t=e.pos;if(e.eat(98))return e.lastIntValue=8,!0;if(e.switchU&&e.eat(45))return e.lastIntValue=45,!0;if(!e.switchU&&e.eat(99)){if(this.regexp_eatClassControlLetter(e))return!0;e.pos=t}return this.regexp_eatCharacterClassEscape(e)||this.regexp_eatCharacterEscape(e)},vl.regexp_classSetExpression=function(e){var t,i=1;if(this.regexp_eatClassSetRange(e));else if(t=this.regexp_eatClassSetOperand(e)){2===t&&(i=2);for(var r=e.pos;e.eatChars([38,38]);)38!==e.current()&&(t=this.regexp_eatClassSetOperand(e))?2!==t&&(i=1):e.raise("Invalid character in character class");if(r!==e.pos)return i;for(;e.eatChars([45,45]);)this.regexp_eatClassSetOperand(e)||e.raise("Invalid character in character class");if(r!==e.pos)return i}else e.raise("Invalid character in character class");for(;;)if(!this.regexp_eatClassSetRange(e)){if(!(t=this.regexp_eatClassSetOperand(e)))return i;2===t&&(i=2)}},vl.regexp_eatClassSetRange=function(e){var t=e.pos;if(this.regexp_eatClassSetCharacter(e)){var i=e.lastIntValue;if(e.eat(45)&&this.regexp_eatClassSetCharacter(e)){var r=e.lastIntValue;return-1!==i&&-1!==r&&i>r&&e.raise("Range out of order in character class"),!0}e.pos=t}return!1},vl.regexp_eatClassSetOperand=function(e){return this.regexp_eatClassSetCharacter(e)?1:this.regexp_eatClassStringDisjunction(e)||this.regexp_eatNestedClass(e)},vl.regexp_eatNestedClass=function(e){var t=e.pos;if(e.eat(91)){var i=e.eat(94),r=this.regexp_classContents(e);if(e.eat(93))return i&&2===r&&e.raise("Negated character class may contain strings"),r;e.pos=t}if(e.eat(92)){var s=this.regexp_eatCharacterClassEscape(e);if(s)return s;e.pos=t}return null},vl.regexp_eatClassStringDisjunction=function(e){var t=e.pos;if(e.eatChars([92,113])){if(e.eat(123)){var i=this.regexp_classStringDisjunctionContents(e);if(e.eat(125))return i}else e.raise("Invalid escape");e.pos=t}return null},vl.regexp_classStringDisjunctionContents=function(e){for(var t=this.regexp_classString(e);e.eat(124);)2===this.regexp_classString(e)&&(t=2);return t},vl.regexp_classString=function(e){for(var t=0;this.regexp_eatClassSetCharacter(e);)t++;return 1===t?1:2},vl.regexp_eatClassSetCharacter=function(e){var t=e.pos;if(e.eat(92))return!(!this.regexp_eatCharacterEscape(e)&&!this.regexp_eatClassSetReservedPunctuator(e))||(e.eat(98)?(e.lastIntValue=8,!0):(e.pos=t,!1));var i=e.current();return!(i<0||i===e.lookahead()&&function(e){return 33===e||e>=35&&e<=38||e>=42&&e<=44||46===e||e>=58&&e<=64||94===e||96===e||126===e}(i))&&(!function(e){return 40===e||41===e||45===e||47===e||e>=91&&e<=93||e>=123&&e<=125}(i)&&(e.advance(),e.lastIntValue=i,!0))},vl.regexp_eatClassSetReservedPunctuator=function(e){var t=e.current();return!!function(e){return 33===e||35===e||37===e||38===e||44===e||45===e||e>=58&&e<=62||64===e||96===e||126===e}(t)&&(e.lastIntValue=t,e.advance(),!0)},vl.regexp_eatClassControlLetter=function(e){var t=e.current();return!(!Sl(t)&&95!==t)&&(e.lastIntValue=t%32,e.advance(),!0)},vl.regexp_eatHexEscapeSequence=function(e){var t=e.pos;if(e.eat(120)){if(this.regexp_eatFixedHexDigits(e,2))return!0;e.switchU&&e.raise("Invalid escape"),e.pos=t}return!1},vl.regexp_eatDecimalDigits=function(e){var t=e.pos,i=0;for(e.lastIntValue=0;Sl(i=e.current());)e.lastIntValue=10*e.lastIntValue+(i-48),e.advance();return e.pos!==t},vl.regexp_eatHexDigits=function(e){var t=e.pos,i=0;for(e.lastIntValue=0;Fl(i=e.current());)e.lastIntValue=16*e.lastIntValue+Tl(i),e.advance();return e.pos!==t},vl.regexp_eatLegacyOctalEscapeSequence=function(e){if(this.regexp_eatOctalDigit(e)){var t=e.lastIntValue;if(this.regexp_eatOctalDigit(e)){var i=e.lastIntValue;t<=3&&this.regexp_eatOctalDigit(e)?e.lastIntValue=64*t+8*i+e.lastIntValue:e.lastIntValue=8*t+i}else e.lastIntValue=t;return!0}return!1},vl.regexp_eatOctalDigit=function(e){var t=e.current();return Ml(t)?(e.lastIntValue=t-48,e.advance(),!0):(e.lastIntValue=0,!1)},vl.regexp_eatFixedHexDigits=function(e,t){var i=e.pos;e.lastIntValue=0;for(var r=0;r<t;++r){var s=e.current();if(!Fl(s))return e.pos=i,!1;e.lastIntValue=16*e.lastIntValue+Tl(s),e.advance()}return!0};var kl=function(e){this.type=e.type,this.value=e.value,this.start=e.start,this.end=e.end,e.options.locations&&(this.loc=new Cu(e,e.startLoc,e.endLoc)),e.options.ranges&&(this.range=[e.start,e.end])},Il=Mu.prototype;function Bl(e){return"function"!=typeof BigInt?null:BigInt(e.replace(/_/g,""))}Il.next=function(e){!e&&this.type.keyword&&this.containsEsc&&this.raiseRecoverable(this.start,"Escape sequence in keyword "+this.type.keyword),this.options.onToken&&this.options.onToken(new kl(this)),this.lastTokEnd=this.end,this.lastTokStart=this.start,this.lastTokEndLoc=this.endLoc,this.lastTokStartLoc=this.startLoc,this.nextToken()},Il.getToken=function(){return this.next(),new kl(this)},"undefined"!=typeof Symbol&&(Il[Symbol.iterator]=function(){var e=this;return{next:function(){var t=e.getToken();return{done:t.type===au.eof,value:t}}}}),Il.nextToken=function(){var e=this.curContext();return e&&e.preserveSpace||this.skipSpace(),this.start=this.pos,this.options.locations&&(this.startLoc=this.curPosition()),this.pos>=this.input.length?this.finishToken(au.eof):e.override?e.override(this):void this.readToken(this.fullCharCodeAtPos())},Il.readToken=function(e){return Jh(e,this.options.ecmaVersion>=6)||92===e?this.readWord():this.getTokenFromCode(e)},Il.fullCharCodeAtPos=function(){var e=this.input.charCodeAt(this.pos);if(e<=55295||e>=56320)return e;var t=this.input.charCodeAt(this.pos+1);return t<=56319||t>=57344?e:(e<<10)+t-56613888},Il.skipBlockComment=function(){var e=this.options.onComment&&this.curPosition(),t=this.pos,i=this.input.indexOf("*/",this.pos+=2);if(-1===i&&this.raise(this.pos-2,"Unterminated comment"),this.pos=i+2,this.options.locations)for(var r=void 0,s=t;(r=lu(this.input,s,this.pos))>-1;)++this.curLine,s=this.lineStart=r;this.options.onComment&&this.options.onComment(!0,this.input.slice(t+2,i),t,this.pos,e,this.curPosition())},Il.skipLineComment=function(e){for(var t=this.pos,i=this.options.onComment&&this.curPosition(),r=this.input.charCodeAt(this.pos+=e);this.pos<this.input.length&&!uu(r);)r=this.input.charCodeAt(++this.pos);this.options.onComment&&this.options.onComment(!1,this.input.slice(t+e,this.pos),t,this.pos,i,this.curPosition())},Il.skipSpace=function(){e:for(;this.pos<this.input.length;){var e=this.input.charCodeAt(this.pos);switch(e){case 32:case 160:++this.pos;break;case 13:10===this.input.charCodeAt(this.pos+1)&&++this.pos;case 10:case 8232:case 8233:++this.pos,this.options.locations&&(++this.curLine,this.lineStart=this.pos);break;case 47:switch(this.input.charCodeAt(this.pos+1)){case 42:this.skipBlockComment();break;case 47:this.skipLineComment(2);break;default:break e}break;default:if(!(e>8&&e<14||e>=5760&&cu.test(String.fromCharCode(e))))break e;++this.pos}}},Il.finishToken=function(e,t){this.end=this.pos,this.options.locations&&(this.endLoc=this.curPosition());var i=this.type;this.type=e,this.value=t,this.updateContext(i)},Il.readToken_dot=function(){var e=this.input.charCodeAt(this.pos+1);if(e>=48&&e<=57)return this.readNumber(!0);var t=this.input.charCodeAt(this.pos+2);return this.options.ecmaVersion>=6&&46===e&&46===t?(this.pos+=3,this.finishToken(au.ellipsis)):(++this.pos,this.finishToken(au.dot))},Il.readToken_slash=function(){var e=this.input.charCodeAt(this.pos+1);return this.exprAllowed?(++this.pos,this.readRegexp()):61===e?this.finishOp(au.assign,2):this.finishOp(au.slash,1)},Il.readToken_mult_modulo_exp=function(e){var t=this.input.charCodeAt(this.pos+1),i=1,r=42===e?au.star:au.modulo;return this.options.ecmaVersion>=7&&42===e&&42===t&&(++i,r=au.starstar,t=this.input.charCodeAt(this.pos+2)),61===t?this.finishOp(au.assign,i+1):this.finishOp(r,i)},Il.readToken_pipe_amp=function(e){var t=this.input.charCodeAt(this.pos+1);if(t===e){if(this.options.ecmaVersion>=12)if(61===this.input.charCodeAt(this.pos+2))return this.finishOp(au.assign,3);return this.finishOp(124===e?au.logicalOR:au.logicalAND,2)}return 61===t?this.finishOp(au.assign,2):this.finishOp(124===e?au.bitwiseOR:au.bitwiseAND,1)},Il.readToken_caret=function(){return 61===this.input.charCodeAt(this.pos+1)?this.finishOp(au.assign,2):this.finishOp(au.bitwiseXOR,1)},Il.readToken_plus_min=function(e){var t=this.input.charCodeAt(this.pos+1);return t===e?45!==t||this.inModule||62!==this.input.charCodeAt(this.pos+2)||0!==this.lastTokEnd&&!ou.test(this.input.slice(this.lastTokEnd,this.pos))?this.finishOp(au.incDec,2):(this.skipLineComment(3),this.skipSpace(),this.nextToken()):61===t?this.finishOp(au.assign,2):this.finishOp(au.plusMin,1)},Il.readToken_lt_gt=function(e){var t=this.input.charCodeAt(this.pos+1),i=1;return t===e?(i=62===e&&62===this.input.charCodeAt(this.pos+2)?3:2,61===this.input.charCodeAt(this.pos+i)?this.finishOp(au.assign,i+1):this.finishOp(au.bitShift,i)):33!==t||60!==e||this.inModule||45!==this.input.charCodeAt(this.pos+2)||45!==this.input.charCodeAt(this.pos+3)?(61===t&&(i=2),this.finishOp(au.relational,i)):(this.skipLineComment(4),this.skipSpace(),this.nextToken())},Il.readToken_eq_excl=function(e){var t=this.input.charCodeAt(this.pos+1);return 61===t?this.finishOp(au.equality,61===this.input.charCodeAt(this.pos+2)?3:2):61===e&&62===t&&this.options.ecmaVersion>=6?(this.pos+=2,this.finishToken(au.arrow)):this.finishOp(61===e?au.eq:au.prefix,1)},Il.readToken_question=function(){var e=this.options.ecmaVersion;if(e>=11){var t=this.input.charCodeAt(this.pos+1);if(46===t){var i=this.input.charCodeAt(this.pos+2);if(i<48||i>57)return this.finishOp(au.questionDot,2)}if(63===t){if(e>=12)if(61===this.input.charCodeAt(this.pos+2))return this.finishOp(au.assign,3);return this.finishOp(au.coalesce,2)}}return this.finishOp(au.question,1)},Il.readToken_numberSign=function(){var e=35;if(this.options.ecmaVersion>=13&&(++this.pos,Jh(e=this.fullCharCodeAtPos(),!0)||92===e))return this.finishToken(au.privateId,this.readWord1());this.raise(this.pos,"Unexpected character '"+bu(e)+"'")},Il.getTokenFromCode=function(e){switch(e){case 46:return this.readToken_dot();case 40:return++this.pos,this.finishToken(au.parenL);case 41:return++this.pos,this.finishToken(au.parenR);case 59:return++this.pos,this.finishToken(au.semi);case 44:return++this.pos,this.finishToken(au.comma);case 91:return++this.pos,this.finishToken(au.bracketL);case 93:return++this.pos,this.finishToken(au.bracketR);case 123:return++this.pos,this.finishToken(au.braceL);case 125:return++this.pos,this.finishToken(au.braceR);case 58:return++this.pos,this.finishToken(au.colon);case 96:if(this.options.ecmaVersion<6)break;return++this.pos,this.finishToken(au.backQuote);case 48:var t=this.input.charCodeAt(this.pos+1);if(120===t||88===t)return this.readRadixNumber(16);if(this.options.ecmaVersion>=6){if(111===t||79===t)return this.readRadixNumber(8);if(98===t||66===t)return this.readRadixNumber(2)}case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:return this.readNumber(!1);case 34:case 39:return this.readString(e);case 47:return this.readToken_slash();case 37:case 42:return this.readToken_mult_modulo_exp(e);case 124:case 38:return this.readToken_pipe_amp(e);case 94:return this.readToken_caret();case 43:case 45:return this.readToken_plus_min(e);case 60:case 62:return this.readToken_lt_gt(e);case 61:case 33:return this.readToken_eq_excl(e);case 63:return this.readToken_question();case 126:return this.finishOp(au.prefix,1);case 35:return this.readToken_numberSign()}this.raise(this.pos,"Unexpected character '"+bu(e)+"'")},Il.finishOp=function(e,t){var i=this.input.slice(this.pos,this.pos+t);return this.pos+=t,this.finishToken(e,i)},Il.readRegexp=function(){for(var e,t,i=this.pos;;){this.pos>=this.input.length&&this.raise(i,"Unterminated regular expression");var r=this.input.charAt(this.pos);if(ou.test(r)&&this.raise(i,"Unterminated regular expression"),e)e=!1;else{if("["===r)t=!0;else if("]"===r&&t)t=!1;else if("/"===r&&!t)break;e="\\"===r}++this.pos}var s=this.input.slice(i,this.pos);++this.pos;var n=this.pos,a=this.readWord1();this.containsEsc&&this.unexpected(n);var o=this.regexpState||(this.regexpState=new _l(this));o.reset(i,s,a),this.validateRegExpFlags(o),this.validateRegExpPattern(o);var h=null;try{h=new RegExp(s,a)}catch(e){}return this.finishToken(au.regexp,{pattern:s,flags:a,value:h})},Il.readInt=function(e,t,i){for(var r=this.options.ecmaVersion>=12&&void 0===t,s=i&&48===this.input.charCodeAt(this.pos),n=this.pos,a=0,o=0,h=0,u=null==t?1/0:t;h<u;++h,++this.pos){var l=this.input.charCodeAt(this.pos),c=void 0;if(r&&95===l)s&&this.raiseRecoverable(this.pos,"Numeric separator is not allowed in legacy octal numeric literals"),95===o&&this.raiseRecoverable(this.pos,"Numeric separator must be exactly one underscore"),0===h&&this.raiseRecoverable(this.pos,"Numeric separator is not allowed at the first of digits"),o=l;else{if((c=l>=97?l-97+10:l>=65?l-65+10:l>=48&&l<=57?l-48:1/0)>=e)break;o=l,a=a*e+c}}return r&&95===o&&this.raiseRecoverable(this.pos-1,"Numeric separator is not allowed at the last of digits"),this.pos===n||null!=t&&this.pos-n!==t?null:a},Il.readRadixNumber=function(e){var t=this.pos;this.pos+=2;var i=this.readInt(e);return null==i&&this.raise(this.start+2,"Expected number in radix "+e),this.options.ecmaVersion>=11&&110===this.input.charCodeAt(this.pos)?(i=Bl(this.input.slice(t,this.pos)),++this.pos):Jh(this.fullCharCodeAtPos())&&this.raise(this.pos,"Identifier directly after number"),this.finishToken(au.num,i)},Il.readNumber=function(e){var t=this.pos;e||null!==this.readInt(10,void 0,!0)||this.raise(t,"Invalid number");var i=this.pos-t>=2&&48===this.input.charCodeAt(t);i&&this.strict&&this.raise(t,"Invalid number");var r=this.input.charCodeAt(this.pos);if(!i&&!e&&this.options.ecmaVersion>=11&&110===r){var s=Bl(this.input.slice(t,this.pos));return++this.pos,Jh(this.fullCharCodeAtPos())&&this.raise(this.pos,"Identifier directly after number"),this.finishToken(au.num,s)}i&&/[89]/.test(this.input.slice(t,this.pos))&&(i=!1),46!==r||i||(++this.pos,this.readInt(10),r=this.input.charCodeAt(this.pos)),69!==r&&101!==r||i||(43!==(r=this.input.charCodeAt(++this.pos))&&45!==r||++this.pos,null===this.readInt(10)&&this.raise(t,"Invalid number")),Jh(this.fullCharCodeAtPos())&&this.raise(this.pos,"Identifier directly after number");var n,a=(n=this.input.slice(t,this.pos),i?parseInt(n,8):parseFloat(n.replace(/_/g,"")));return this.finishToken(au.num,a)},Il.readCodePoint=function(){var e;if(123===this.input.charCodeAt(this.pos)){this.options.ecmaVersion<6&&this.unexpected();var t=++this.pos;e=this.readHexChar(this.input.indexOf("}",this.pos)-this.pos),++this.pos,e>1114111&&this.invalidStringToken(t,"Code point out of bounds")}else e=this.readHexChar(4);return e},Il.readString=function(e){for(var t="",i=++this.pos;;){this.pos>=this.input.length&&this.raise(this.start,"Unterminated string constant");var r=this.input.charCodeAt(this.pos);if(r===e)break;92===r?(t+=this.input.slice(i,this.pos),t+=this.readEscapedChar(!1),i=this.pos):8232===r||8233===r?(this.options.ecmaVersion<10&&this.raise(this.start,"Unterminated string constant"),++this.pos,this.options.locations&&(this.curLine++,this.lineStart=this.pos)):(uu(r)&&this.raise(this.start,"Unterminated string constant"),++this.pos)}return t+=this.input.slice(i,this.pos++),this.finishToken(au.string,t)};var Ll={};Il.tryReadTemplateToken=function(){this.inTemplateElement=!0;try{this.readTmplToken()}catch(e){if(e!==Ll)throw e;this.readInvalidTemplateToken()}this.inTemplateElement=!1},Il.invalidStringToken=function(e,t){if(this.inTemplateElement&&this.options.ecmaVersion>=9)throw Ll;this.raise(e,t)},Il.readTmplToken=function(){for(var e="",t=this.pos;;){this.pos>=this.input.length&&this.raise(this.start,"Unterminated template");var i=this.input.charCodeAt(this.pos);if(96===i||36===i&&123===this.input.charCodeAt(this.pos+1))return this.pos!==this.start||this.type!==au.template&&this.type!==au.invalidTemplate?(e+=this.input.slice(t,this.pos),this.finishToken(au.template,e)):36===i?(this.pos+=2,this.finishToken(au.dollarBraceL)):(++this.pos,this.finishToken(au.backQuote));if(92===i)e+=this.input.slice(t,this.pos),e+=this.readEscapedChar(!0),t=this.pos;else if(uu(i)){switch(e+=this.input.slice(t,this.pos),++this.pos,i){case 13:10===this.input.charCodeAt(this.pos)&&++this.pos;case 10:e+="\n";break;default:e+=String.fromCharCode(i)}this.options.locations&&(++this.curLine,this.lineStart=this.pos),t=this.pos}else++this.pos}},Il.readInvalidTemplateToken=function(){for(;this.pos<this.input.length;this.pos++)switch(this.input[this.pos]){case"\\":++this.pos;break;case"$":if("{"!==this.input[this.pos+1])break;case"`":return this.finishToken(au.invalidTemplate,this.input.slice(this.start,this.pos));case"\r":"\n"===this.input[this.pos+1]&&++this.pos;case"\n":case"\u2028":case"\u2029":++this.curLine,this.lineStart=this.pos+1}this.raise(this.start,"Unterminated template")},Il.readEscapedChar=function(e){var t=this.input.charCodeAt(++this.pos);switch(++this.pos,t){case 110:return"\n";case 114:return"\r";case 120:return String.fromCharCode(this.readHexChar(2));case 117:return bu(this.readCodePoint());case 116:return"\t";case 98:return"\b";case 118:return"\v";case 102:return"\f";case 13:10===this.input.charCodeAt(this.pos)&&++this.pos;case 10:return this.options.locations&&(this.lineStart=this.pos,++this.curLine),"";case 56:case 57:if(this.strict&&this.invalidStringToken(this.pos-1,"Invalid escape sequence"),e){var i=this.pos-1;this.invalidStringToken(i,"Invalid escape sequence in template string")}default:if(t>=48&&t<=55){var r=this.input.substr(this.pos-1,3).match(/^[0-7]+/)[0],s=parseInt(r,8);return s>255&&(r=r.slice(0,-1),s=parseInt(r,8)),this.pos+=r.length-1,t=this.input.charCodeAt(this.pos),"0"===r&&56!==t&&57!==t||!this.strict&&!e||this.invalidStringToken(this.pos-1-r.length,e?"Octal literal in template string":"Octal literal in strict mode"),String.fromCharCode(s)}return uu(t)?(this.options.locations&&(this.lineStart=this.pos,++this.curLine),""):String.fromCharCode(t)}},Il.readHexChar=function(e){var t=this.pos,i=this.readInt(16,e);return null===i&&this.invalidStringToken(t,"Bad character escape sequence"),i},Il.readWord1=function(){this.containsEsc=!1;for(var e="",t=!0,i=this.pos,r=this.options.ecmaVersion>=6;this.pos<this.input.length;){var s=this.fullCharCodeAtPos();if(Qh(s,r))this.pos+=s<=65535?1:2;else{if(92!==s)break;this.containsEsc=!0,e+=this.input.slice(i,this.pos);var n=this.pos;117!==this.input.charCodeAt(++this.pos)&&this.invalidStringToken(this.pos,"Expecting Unicode escape sequence \\uXXXX"),++this.pos;var a=this.readCodePoint();(t?Jh:Qh)(a,r)||this.invalidStringToken(n,"Invalid Unicode escape"),e+=bu(a),i=this.pos}t=!1}return e+this.input.slice(i,this.pos)},Il.readWord=function(){var e=this.readWord1(),t=au.name;return this.keywords.test(e)&&(t=su[e]),this.finishToken(t,e)};function Pl(e,t,i){i(e,t)}function Ol(e,t,i){}Mu.acorn={Parser:Mu,version:"8.14.0",defaultOptions:Eu,Position:wu,SourceLocation:Cu,getLineInfo:Du,Node:el,TokenType:eu,tokTypes:au,keywordTypes:su,TokContext:$u,tokContexts:Wu,isIdentifierChar:Qh,isIdentifierStart:Jh,Token:kl,isNewLine:uu,lineBreak:ou,lineBreakG:hu,nonASCIIwhitespace:cu};var Nl={};Nl.Program=Nl.BlockStatement=Nl.StaticBlock=function(e,t,i){for(var r=0,s=e.body;r<s.length;r+=1){i(s[r],t,"Statement")}},Nl.Statement=Pl,Nl.EmptyStatement=Ol,Nl.ExpressionStatement=Nl.ParenthesizedExpression=Nl.ChainExpression=function(e,t,i){return i(e.expression,t,"Expression")},Nl.IfStatement=function(e,t,i){i(e.test,t,"Expression"),i(e.consequent,t,"Statement"),e.alternate&&i(e.alternate,t,"Statement")},Nl.LabeledStatement=function(e,t,i){return i(e.body,t,"Statement")},Nl.BreakStatement=Nl.ContinueStatement=Ol,Nl.WithStatement=function(e,t,i){i(e.object,t,"Expression"),i(e.body,t,"Statement")},Nl.SwitchStatement=function(e,t,i){i(e.discriminant,t,"Expression");for(var r=0,s=e.cases;r<s.length;r+=1){i(s[r],t)}},Nl.SwitchCase=function(e,t,i){e.test&&i(e.test,t,"Expression");for(var r=0,s=e.consequent;r<s.length;r+=1){i(s[r],t,"Statement")}},Nl.ReturnStatement=Nl.YieldExpression=Nl.AwaitExpression=function(e,t,i){e.argument&&i(e.argument,t,"Expression")},Nl.ThrowStatement=Nl.SpreadElement=function(e,t,i){return i(e.argument,t,"Expression")},Nl.TryStatement=function(e,t,i){i(e.block,t,"Statement"),e.handler&&i(e.handler,t),e.finalizer&&i(e.finalizer,t,"Statement")},Nl.CatchClause=function(e,t,i){e.param&&i(e.param,t,"Pattern"),i(e.body,t,"Statement")},Nl.WhileStatement=Nl.DoWhileStatement=function(e,t,i){i(e.test,t,"Expression"),i(e.body,t,"Statement")},Nl.ForStatement=function(e,t,i){e.init&&i(e.init,t,"ForInit"),e.test&&i(e.test,t,"Expression"),e.update&&i(e.update,t,"Expression"),i(e.body,t,"Statement")},Nl.ForInStatement=Nl.ForOfStatement=function(e,t,i){i(e.left,t,"ForInit"),i(e.right,t,"Expression"),i(e.body,t,"Statement")},Nl.ForInit=function(e,t,i){"VariableDeclaration"===e.type?i(e,t):i(e,t,"Expression")},Nl.DebuggerStatement=Ol,Nl.FunctionDeclaration=function(e,t,i){return i(e,t,"Function")},Nl.VariableDeclaration=function(e,t,i){for(var r=0,s=e.declarations;r<s.length;r+=1){i(s[r],t)}},Nl.VariableDeclarator=function(e,t,i){i(e.id,t,"Pattern"),e.init&&i(e.init,t,"Expression")},Nl.Function=function(e,t,i){e.id&&i(e.id,t,"Pattern");for(var r=0,s=e.params;r<s.length;r+=1){i(s[r],t,"Pattern")}i(e.body,t,e.expression?"Expression":"Statement")},Nl.Pattern=function(e,t,i){"Identifier"===e.type?i(e,t,"VariablePattern"):"MemberExpression"===e.type?i(e,t,"MemberPattern"):i(e,t)},Nl.VariablePattern=Ol,Nl.MemberPattern=Pl,Nl.RestElement=function(e,t,i){return i(e.argument,t,"Pattern")},Nl.ArrayPattern=function(e,t,i){for(var r=0,s=e.elements;r<s.length;r+=1){var n=s[r];n&&i(n,t,"Pattern")}},Nl.ObjectPattern=function(e,t,i){for(var r=0,s=e.properties;r<s.length;r+=1){var n=s[r];"Property"===n.type?(n.computed&&i(n.key,t,"Expression"),i(n.value,t,"Pattern")):"RestElement"===n.type&&i(n.argument,t,"Pattern")}},Nl.Expression=Pl,Nl.ThisExpression=Nl.Super=Nl.MetaProperty=Ol,Nl.ArrayExpression=function(e,t,i){for(var r=0,s=e.elements;r<s.length;r+=1){var n=s[r];n&&i(n,t,"Expression")}},Nl.ObjectExpression=function(e,t,i){for(var r=0,s=e.properties;r<s.length;r+=1){i(s[r],t)}},Nl.FunctionExpression=Nl.ArrowFunctionExpression=Nl.FunctionDeclaration,Nl.SequenceExpression=function(e,t,i){for(var r=0,s=e.expressions;r<s.length;r+=1){i(s[r],t,"Expression")}},Nl.TemplateLiteral=function(e,t,i){for(var r=0,s=e.quasis;r<s.length;r+=1){i(s[r],t)}for(var n=0,a=e.expressions;n<a.length;n+=1){i(a[n],t,"Expression")}},Nl.TemplateElement=Ol,Nl.UnaryExpression=Nl.UpdateExpression=function(e,t,i){i(e.argument,t,"Expression")},Nl.BinaryExpression=Nl.LogicalExpression=function(e,t,i){i(e.left,t,"Expression"),i(e.right,t,"Expression")},Nl.AssignmentExpression=Nl.AssignmentPattern=function(e,t,i){i(e.left,t,"Pattern"),i(e.right,t,"Expression")},Nl.ConditionalExpression=function(e,t,i){i(e.test,t,"Expression"),i(e.consequent,t,"Expression"),i(e.alternate,t,"Expression")},Nl.NewExpression=Nl.CallExpression=function(e,t,i){if(i(e.callee,t,"Expression"),e.arguments)for(var r=0,s=e.arguments;r<s.length;r+=1){i(s[r],t,"Expression")}},Nl.MemberExpression=function(e,t,i){i(e.object,t,"Expression"),e.computed&&i(e.property,t,"Expression")},Nl.ExportNamedDeclaration=Nl.ExportDefaultDeclaration=function(e,t,i){e.declaration&&i(e.declaration,t,"ExportNamedDeclaration"===e.type||e.declaration.id?"Statement":"Expression"),e.source&&i(e.source,t,"Expression")},Nl.ExportAllDeclaration=function(e,t,i){e.exported&&i(e.exported,t),i(e.source,t,"Expression")},Nl.ImportDeclaration=function(e,t,i){for(var r=0,s=e.specifiers;r<s.length;r+=1){i(s[r],t)}i(e.source,t,"Expression")},Nl.ImportExpression=function(e,t,i){i(e.source,t,"Expression")},Nl.ImportSpecifier=Nl.ImportDefaultSpecifier=Nl.ImportNamespaceSpecifier=Nl.Identifier=Nl.PrivateIdentifier=Nl.Literal=Ol,Nl.TaggedTemplateExpression=function(e,t,i){i(e.tag,t,"Expression"),i(e.quasi,t,"Expression")},Nl.ClassDeclaration=Nl.ClassExpression=function(e,t,i){return i(e,t,"Class")},Nl.Class=function(e,t,i){e.id&&i(e.id,t,"Pattern"),e.superClass&&i(e.superClass,t,"Expression"),i(e.body,t)},Nl.ClassBody=function(e,t,i){for(var r=0,s=e.body;r<s.length;r+=1){i(s[r],t)}},Nl.MethodDefinition=Nl.PropertyDefinition=Nl.Property=function(e,t,i){e.computed&&i(e.key,t,"Expression"),e.value&&i(e.value,t,"Expression")};var Rl={},Vl={};(function e(t){var i,r,s,n,a,o;function h(e){var t,i,r={};for(t in e)e.hasOwnProperty(t)&&(i=e[t],r[t]="object"==typeof i&&null!==i?h(i):i);return r}function u(e,t){this.parent=e,this.key=t}function l(e,t,i,r){this.node=e,this.path=t,this.wrap=i,this.ref=r}function c(){}function p(e){return null!=e&&"object"==typeof e&&"string"==typeof e.type}function d(e,t){return(e===i.ObjectExpression||e===i.ObjectPattern)&&"properties"===t}function f(e,t){for(var i=e.length-1;i>=0;--i)if(e[i].node===t)return!0;return!1}function g(e,t){return(new c).traverse(e,t)}function m(e,t){var i;return i=function(e,t){var i,r,s,n;for(r=e.length,s=0;r;)t(e[n=s+(i=r>>>1)])?r=i:(s=n+1,r-=i+1);return s}(t,(function(t){return t.range[0]>e.range[0]})),e.extendedRange=[e.range[0],e.range[1]],i!==t.length&&(e.extendedRange[1]=t[i].range[0]),(i-=1)>=0&&(e.extendedRange[0]=t[i].range[1]),e}return i={AssignmentExpression:"AssignmentExpression",AssignmentPattern:"AssignmentPattern",ArrayExpression:"ArrayExpression",ArrayPattern:"ArrayPattern",ArrowFunctionExpression:"ArrowFunctionExpression",AwaitExpression:"AwaitExpression",BlockStatement:"BlockStatement",BinaryExpression:"BinaryExpression",BreakStatement:"BreakStatement",CallExpression:"CallExpression",CatchClause:"CatchClause",ChainExpression:"ChainExpression",ClassBody:"ClassBody",ClassDeclaration:"ClassDeclaration",ClassExpression:"ClassExpression",ComprehensionBlock:"ComprehensionBlock",ComprehensionExpression:"ComprehensionExpression",ConditionalExpression:"ConditionalExpression",ContinueStatement:"ContinueStatement",DebuggerStatement:"DebuggerStatement",DirectiveStatement:"DirectiveStatement",DoWhileStatement:"DoWhileStatement",EmptyStatement:"EmptyStatement",ExportAllDeclaration:"ExportAllDeclaration",ExportDefaultDeclaration:"ExportDefaultDeclaration",ExportNamedDeclaration:"ExportNamedDeclaration",ExportSpecifier:"ExportSpecifier",ExpressionStatement:"ExpressionStatement",ForStatement:"ForStatement",ForInStatement:"ForInStatement",ForOfStatement:"ForOfStatement",FunctionDeclaration:"FunctionDeclaration",FunctionExpression:"FunctionExpression",GeneratorExpression:"GeneratorExpression",Identifier:"Identifier",IfStatement:"IfStatement",ImportExpression:"ImportExpression",ImportDeclaration:"ImportDeclaration",ImportDefaultSpecifier:"ImportDefaultSpecifier",ImportNamespaceSpecifier:"ImportNamespaceSpecifier",ImportSpecifier:"ImportSpecifier",Literal:"Literal",LabeledStatement:"LabeledStatement",LogicalExpression:"LogicalExpression",MemberExpression:"MemberExpression",MetaProperty:"MetaProperty",MethodDefinition:"MethodDefinition",ModuleSpecifier:"ModuleSpecifier",NewExpression:"NewExpression",ObjectExpression:"ObjectExpression",ObjectPattern:"ObjectPattern",PrivateIdentifier:"PrivateIdentifier",Program:"Program",Property:"Property",PropertyDefinition:"PropertyDefinition",RestElement:"RestElement",ReturnStatement:"ReturnStatement",SequenceExpression:"SequenceExpression",SpreadElement:"SpreadElement",Super:"Super",SwitchStatement:"SwitchStatement",SwitchCase:"SwitchCase",TaggedTemplateExpression:"TaggedTemplateExpression",TemplateElement:"TemplateElement",TemplateLiteral:"TemplateLiteral",ThisExpression:"ThisExpression",ThrowStatement:"ThrowStatement",TryStatement:"TryStatement",UnaryExpression:"UnaryExpression",UpdateExpression:"UpdateExpression",VariableDeclaration:"VariableDeclaration",VariableDeclarator:"VariableDeclarator",WhileStatement:"WhileStatement",WithStatement:"WithStatement",YieldExpression:"YieldExpression"},s={AssignmentExpression:["left","right"],AssignmentPattern:["left","right"],ArrayExpression:["elements"],ArrayPattern:["elements"],ArrowFunctionExpression:["params","body"],AwaitExpression:["argument"],BlockStatement:["body"],BinaryExpression:["left","right"],BreakStatement:["label"],CallExpression:["callee","arguments"],CatchClause:["param","body"],ChainExpression:["expression"],ClassBody:["body"],ClassDeclaration:["id","superClass","body"],ClassExpression:["id","superClass","body"],ComprehensionBlock:["left","right"],ComprehensionExpression:["blocks","filter","body"],ConditionalExpression:["test","consequent","alternate"],ContinueStatement:["label"],DebuggerStatement:[],DirectiveStatement:[],DoWhileStatement:["body","test"],EmptyStatement:[],ExportAllDeclaration:["source"],ExportDefaultDeclaration:["declaration"],ExportNamedDeclaration:["declaration","specifiers","source"],ExportSpecifier:["exported","local"],ExpressionStatement:["expression"],ForStatement:["init","test","update","body"],ForInStatement:["left","right","body"],ForOfStatement:["left","right","body"],FunctionDeclaration:["id","params","body"],FunctionExpression:["id","params","body"],GeneratorExpression:["blocks","filter","body"],Identifier:[],IfStatement:["test","consequent","alternate"],ImportExpression:["source"],ImportDeclaration:["specifiers","source"],ImportDefaultSpecifier:["local"],ImportNamespaceSpecifier:["local"],ImportSpecifier:["imported","local"],Literal:[],LabeledStatement:["label","body"],LogicalExpression:["left","right"],MemberExpression:["object","property"],MetaProperty:["meta","property"],MethodDefinition:["key","value"],ModuleSpecifier:[],NewExpression:["callee","arguments"],ObjectExpression:["properties"],ObjectPattern:["properties"],PrivateIdentifier:[],Program:["body"],Property:["key","value"],PropertyDefinition:["key","value"],RestElement:["argument"],ReturnStatement:["argument"],SequenceExpression:["expressions"],SpreadElement:["argument"],Super:[],SwitchStatement:["discriminant","cases"],SwitchCase:["test","consequent"],TaggedTemplateExpression:["tag","quasi"],TemplateElement:[],TemplateLiteral:["quasis","expressions"],ThisExpression:[],ThrowStatement:["argument"],TryStatement:["block","handler","finalizer"],UnaryExpression:["argument"],UpdateExpression:["argument"],VariableDeclaration:["declarations"],VariableDeclarator:["id","init"],WhileStatement:["test","body"],WithStatement:["object","body"],YieldExpression:["argument"]},r={Break:n={},Skip:a={},Remove:o={}},u.prototype.replace=function(e){this.parent[this.key]=e},u.prototype.remove=function(){return Array.isArray(this.parent)?(this.parent.splice(this.key,1),!0):(this.replace(null),!1)},c.prototype.path=function(){var e,t,i,r,s;function n(e,t){if(Array.isArray(t))for(i=0,r=t.length;i<r;++i)e.push(t[i]);else e.push(t)}if(!this.__current.path)return null;for(s=[],e=2,t=this.__leavelist.length;e<t;++e)n(s,this.__leavelist[e].path);return n(s,this.__current.path),s},c.prototype.type=function(){return this.current().type||this.__current.wrap},c.prototype.parents=function(){var e,t,i;for(i=[],e=1,t=this.__leavelist.length;e<t;++e)i.push(this.__leavelist[e].node);return i},c.prototype.current=function(){return this.__current.node},c.prototype.__execute=function(e,t){var i,r;return r=void 0,i=this.__current,this.__current=t,this.__state=null,e&&(r=e.call(this,t.node,this.__leavelist[this.__leavelist.length-1].node)),this.__current=i,r},c.prototype.notify=function(e){this.__state=e},c.prototype.skip=function(){this.notify(a)},c.prototype.break=function(){this.notify(n)},c.prototype.remove=function(){this.notify(o)},c.prototype.__initialize=function(e,t){this.visitor=t,this.root=e,this.__worklist=[],this.__leavelist=[],this.__current=null,this.__state=null,this.__fallback=null,"iteration"===t.fallback?this.__fallback=Object.keys:"function"==typeof t.fallback&&(this.__fallback=t.fallback),this.__keys=s,t.keys&&(this.__keys=Object.assign(Object.create(this.__keys),t.keys))},c.prototype.traverse=function(e,t){var i,r,s,o,h,u,c,g,m,y,x,v;for(this.__initialize(e,t),v={},i=this.__worklist,r=this.__leavelist,i.push(new l(e,null,null,null)),r.push(new l(null,null,null,null));i.length;)if((s=i.pop())!==v){if(s.node){if(u=this.__execute(t.enter,s),this.__state===n||u===n)return;if(i.push(v),r.push(s),this.__state===a||u===a)continue;if(h=(o=s.node).type||s.wrap,!(y=this.__keys[h])){if(!this.__fallback)throw new Error("Unknown node type "+h+".");y=this.__fallback(o)}for(g=y.length;(g-=1)>=0;)if(x=o[c=y[g]])if(Array.isArray(x)){for(m=x.length;(m-=1)>=0;)if(x[m]&&!f(r,x[m])){if(d(h,y[g]))s=new l(x[m],[c,m],"Property",null);else{if(!p(x[m]))continue;s=new l(x[m],[c,m],null,null)}i.push(s)}}else if(p(x)){if(f(r,x))continue;i.push(new l(x,c,null,null))}}}else if(s=r.pop(),u=this.__execute(t.leave,s),this.__state===n||u===n)return},c.prototype.replace=function(e,t){var i,r,s,h,c,f,g,m,y,x,v,b,_;function w(e){var t,r,s,n;if(e.ref.remove())for(r=e.ref.key,n=e.ref.parent,t=i.length;t--;)if((s=i[t]).ref&&s.ref.parent===n){if(s.ref.key<r)break;--s.ref.key}}for(this.__initialize(e,t),v={},i=this.__worklist,r=this.__leavelist,f=new l(e,null,null,new u(b={root:e},"root")),i.push(f),r.push(f);i.length;)if((f=i.pop())!==v){if(void 0!==(c=this.__execute(t.enter,f))&&c!==n&&c!==a&&c!==o&&(f.ref.replace(c),f.node=c),this.__state!==o&&c!==o||(w(f),f.node=null),this.__state===n||c===n)return b.root;if((s=f.node)&&(i.push(v),r.push(f),this.__state!==a&&c!==a)){if(h=s.type||f.wrap,!(y=this.__keys[h])){if(!this.__fallback)throw new Error("Unknown node type "+h+".");y=this.__fallback(s)}for(g=y.length;(g-=1)>=0;)if(x=s[_=y[g]])if(Array.isArray(x)){for(m=x.length;(m-=1)>=0;)if(x[m]){if(d(h,y[g]))f=new l(x[m],[_,m],"Property",new u(x,m));else{if(!p(x[m]))continue;f=new l(x[m],[_,m],null,new u(x,m))}i.push(f)}}else p(x)&&i.push(new l(x,_,null,new u(s,_)))}}else if(f=r.pop(),void 0!==(c=this.__execute(t.leave,f))&&c!==n&&c!==a&&c!==o&&f.ref.replace(c),this.__state!==o&&c!==o||w(f),this.__state===n||c===n)return b.root;return b.root},t.Syntax=i,t.traverse=g,t.replace=function(e,t){return(new c).replace(e,t)},t.attachComments=function(e,t,i){var s,n,a,o,u=[];if(!e.range)throw new Error("attachComments needs range information");if(!i.length){if(t.length){for(a=0,n=t.length;a<n;a+=1)(s=h(t[a])).extendedRange=[0,e.range[0]],u.push(s);e.leadingComments=u}return e}for(a=0,n=t.length;a<n;a+=1)u.push(m(h(t[a]),i));return o=0,g(e,{enter:function(e){for(var t;o<u.length&&!((t=u[o]).extendedRange[1]>e.range[0]);)t.extendedRange[1]===e.range[0]?(e.leadingComments||(e.leadingComments=[]),e.leadingComments.push(t),u.splice(o,1)):o+=1;return o===u.length?r.Break:u[o].extendedRange[0]>e.range[1]?r.Skip:void 0}}),o=0,g(e,{leave:function(e){for(var t;o<u.length&&(t=u[o],!(e.range[1]<t.extendedRange[0]));)e.range[1]===t.extendedRange[0]?(e.trailingComments||(e.trailingComments=[]),e.trailingComments.push(t),u.splice(o,1)):o+=1;return o===u.length?r.Break:u[o].extendedRange[0]>e.range[1]?r.Skip:void 0}}),e},t.VisitorKeys=s,t.VisitorOption=r,t.Controller=c,t.cloneEnvironment=function(){return e({})},t})(Vl);var Ul={},Gl={exports:{}};!function(){function e(e){if(null==e)return!1;switch(e.type){case"BlockStatement":case"BreakStatement":case"ContinueStatement":case"DebuggerStatement":case"DoWhileStatement":case"EmptyStatement":case"ExpressionStatement":case"ForInStatement":case"ForStatement":case"IfStatement":case"LabeledStatement":case"ReturnStatement":case"SwitchStatement":case"ThrowStatement":case"TryStatement":case"VariableDeclaration":case"WhileStatement":case"WithStatement":return!0}return!1}function t(e){switch(e.type){case"IfStatement":return null!=e.alternate?e.alternate:e.consequent;case"LabeledStatement":case"ForStatement":case"ForInStatement":case"WhileStatement":case"WithStatement":return e.body}return null}Gl.exports={isExpression:function(e){if(null==e)return!1;switch(e.type){case"ArrayExpression":case"AssignmentExpression":case"BinaryExpression":case"CallExpression":case"ConditionalExpression":case"FunctionExpression":case"Identifier":case"Literal":case"LogicalExpression":case"MemberExpression":case"NewExpression":case"ObjectExpression":case"SequenceExpression":case"ThisExpression":case"UnaryExpression":case"UpdateExpression":return!0}return!1},isStatement:e,isIterationStatement:function(e){if(null==e)return!1;switch(e.type){case"DoWhileStatement":case"ForInStatement":case"ForStatement":case"WhileStatement":return!0}return!1},isSourceElement:function(t){return e(t)||null!=t&&"FunctionDeclaration"===t.type},isProblematicIfStatement:function(e){var i;if("IfStatement"!==e.type)return!1;if(null==e.alternate)return!1;i=e.consequent;do{if("IfStatement"===i.type&&null==i.alternate)return!0;i=t(i)}while(i);return!1},trailingStatement:t}}();var zl=Gl.exports,jl={exports:{}};!function(){var e,t,i,r,s,n;function a(e){return e<=65535?String.fromCharCode(e):String.fromCharCode(Math.floor((e-65536)/1024)+55296)+String.fromCharCode((e-65536)%1024+56320)}for(t={NonAsciiIdentifierStart:/[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u08A0-\u08B4\u08B6-\u08BD\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FD5\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]/,NonAsciiIdentifierPart:/[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0300-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u0483-\u0487\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u05D0-\u05EA\u05F0-\u05F2\u0610-\u061A\u0620-\u0669\u066E-\u06D3\u06D5-\u06DC\u06DF-\u06E8\u06EA-\u06FC\u06FF\u0710-\u074A\u074D-\u07B1\u07C0-\u07F5\u07FA\u0800-\u082D\u0840-\u085B\u08A0-\u08B4\u08B6-\u08BD\u08D4-\u08E1\u08E3-\u0963\u0966-\u096F\u0971-\u0983\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BC-\u09C4\u09C7\u09C8\u09CB-\u09CE\u09D7\u09DC\u09DD\u09DF-\u09E3\u09E6-\u09F1\u0A01-\u0A03\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A59-\u0A5C\u0A5E\u0A66-\u0A75\u0A81-\u0A83\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABC-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AD0\u0AE0-\u0AE3\u0AE6-\u0AEF\u0AF9\u0B01-\u0B03\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3C-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B5C\u0B5D\u0B5F-\u0B63\u0B66-\u0B6F\u0B71\u0B82\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD0\u0BD7\u0BE6-\u0BEF\u0C00-\u0C03\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C58-\u0C5A\u0C60-\u0C63\u0C66-\u0C6F\u0C80-\u0C83\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBC-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CDE\u0CE0-\u0CE3\u0CE6-\u0CEF\u0CF1\u0CF2\u0D01-\u0D03\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D-\u0D44\u0D46-\u0D48\u0D4A-\u0D4E\u0D54-\u0D57\u0D5F-\u0D63\u0D66-\u0D6F\u0D7A-\u0D7F\u0D82\u0D83\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E01-\u0E3A\u0E40-\u0E4E\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB9\u0EBB-\u0EBD\u0EC0-\u0EC4\u0EC6\u0EC8-\u0ECD\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E-\u0F47\u0F49-\u0F6C\u0F71-\u0F84\u0F86-\u0F97\u0F99-\u0FBC\u0FC6\u1000-\u1049\u1050-\u109D\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u135D-\u135F\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1714\u1720-\u1734\u1740-\u1753\u1760-\u176C\u176E-\u1770\u1772\u1773\u1780-\u17D3\u17D7\u17DC\u17DD\u17E0-\u17E9\u180B-\u180D\u1810-\u1819\u1820-\u1877\u1880-\u18AA\u18B0-\u18F5\u1900-\u191E\u1920-\u192B\u1930-\u193B\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19D9\u1A00-\u1A1B\u1A20-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AA7\u1AB0-\u1ABD\u1B00-\u1B4B\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1BF3\u1C00-\u1C37\u1C40-\u1C49\u1C4D-\u1C7D\u1C80-\u1C88\u1CD0-\u1CD2\u1CD4-\u1CF6\u1CF8\u1CF9\u1D00-\u1DF5\u1DFB-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u200C\u200D\u203F\u2040\u2054\u2071\u207F\u2090-\u209C\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D7F-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2DE0-\u2DFF\u2E2F\u3005-\u3007\u3021-\u302F\u3031-\u3035\u3038-\u303C\u3041-\u3096\u3099\u309A\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FD5\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66F\uA674-\uA67D\uA67F-\uA6F1\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA827\uA840-\uA873\uA880-\uA8C5\uA8D0-\uA8D9\uA8E0-\uA8F7\uA8FB\uA8FD\uA900-\uA92D\uA930-\uA953\uA960-\uA97C\uA980-\uA9C0\uA9CF-\uA9D9\uA9E0-\uA9FE\uAA00-\uAA36\uAA40-\uAA4D\uAA50-\uAA59\uAA60-\uAA76\uAA7A-\uAAC2\uAADB-\uAADD\uAAE0-\uAAEF\uAAF2-\uAAF6\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABEA\uABEC\uABED\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE00-\uFE0F\uFE20-\uFE2F\uFE33\uFE34\uFE4D-\uFE4F\uFE70-\uFE74\uFE76-\uFEFC\uFF10-\uFF19\uFF21-\uFF3A\uFF3F\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]/},e={NonAsciiIdentifierStart:/[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u08A0-\u08B4\u08B6-\u08BD\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2118-\u211D\u2124\u2126\u2128\u212A-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309B-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FD5\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF30-\uDF4A\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC03-\uDC37\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDF00-\uDF19]|\uD806[\uDCA0-\uDCDF\uDCFF\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC72-\uDC8F]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50\uDF93-\uDF9F\uDFE0]|\uD821[\uDC00-\uDFEC]|\uD822[\uDC00-\uDEF2]|\uD82C[\uDC00\uDC01]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD83A[\uDC00-\uDCC4\uDD00-\uDD43]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1]|\uD87E[\uDC00-\uDE1D]/,NonAsciiIdentifierPart:/[\xAA\xB5\xB7\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0300-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u0483-\u0487\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u05D0-\u05EA\u05F0-\u05F2\u0610-\u061A\u0620-\u0669\u066E-\u06D3\u06D5-\u06DC\u06DF-\u06E8\u06EA-\u06FC\u06FF\u0710-\u074A\u074D-\u07B1\u07C0-\u07F5\u07FA\u0800-\u082D\u0840-\u085B\u08A0-\u08B4\u08B6-\u08BD\u08D4-\u08E1\u08E3-\u0963\u0966-\u096F\u0971-\u0983\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BC-\u09C4\u09C7\u09C8\u09CB-\u09CE\u09D7\u09DC\u09DD\u09DF-\u09E3\u09E6-\u09F1\u0A01-\u0A03\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A59-\u0A5C\u0A5E\u0A66-\u0A75\u0A81-\u0A83\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABC-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AD0\u0AE0-\u0AE3\u0AE6-\u0AEF\u0AF9\u0B01-\u0B03\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3C-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B5C\u0B5D\u0B5F-\u0B63\u0B66-\u0B6F\u0B71\u0B82\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD0\u0BD7\u0BE6-\u0BEF\u0C00-\u0C03\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C58-\u0C5A\u0C60-\u0C63\u0C66-\u0C6F\u0C80-\u0C83\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBC-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CDE\u0CE0-\u0CE3\u0CE6-\u0CEF\u0CF1\u0CF2\u0D01-\u0D03\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D-\u0D44\u0D46-\u0D48\u0D4A-\u0D4E\u0D54-\u0D57\u0D5F-\u0D63\u0D66-\u0D6F\u0D7A-\u0D7F\u0D82\u0D83\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E01-\u0E3A\u0E40-\u0E4E\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB9\u0EBB-\u0EBD\u0EC0-\u0EC4\u0EC6\u0EC8-\u0ECD\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E-\u0F47\u0F49-\u0F6C\u0F71-\u0F84\u0F86-\u0F97\u0F99-\u0FBC\u0FC6\u1000-\u1049\u1050-\u109D\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u135D-\u135F\u1369-\u1371\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1714\u1720-\u1734\u1740-\u1753\u1760-\u176C\u176E-\u1770\u1772\u1773\u1780-\u17D3\u17D7\u17DC\u17DD\u17E0-\u17E9\u180B-\u180D\u1810-\u1819\u1820-\u1877\u1880-\u18AA\u18B0-\u18F5\u1900-\u191E\u1920-\u192B\u1930-\u193B\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19DA\u1A00-\u1A1B\u1A20-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AA7\u1AB0-\u1ABD\u1B00-\u1B4B\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1BF3\u1C00-\u1C37\u1C40-\u1C49\u1C4D-\u1C7D\u1C80-\u1C88\u1CD0-\u1CD2\u1CD4-\u1CF6\u1CF8\u1CF9\u1D00-\u1DF5\u1DFB-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u200C\u200D\u203F\u2040\u2054\u2071\u207F\u2090-\u209C\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2102\u2107\u210A-\u2113\u2115\u2118-\u211D\u2124\u2126\u2128\u212A-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D7F-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2DE0-\u2DFF\u3005-\u3007\u3021-\u302F\u3031-\u3035\u3038-\u303C\u3041-\u3096\u3099-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FD5\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66F\uA674-\uA67D\uA67F-\uA6F1\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA827\uA840-\uA873\uA880-\uA8C5\uA8D0-\uA8D9\uA8E0-\uA8F7\uA8FB\uA8FD\uA900-\uA92D\uA930-\uA953\uA960-\uA97C\uA980-\uA9C0\uA9CF-\uA9D9\uA9E0-\uA9FE\uAA00-\uAA36\uAA40-\uAA4D\uAA50-\uAA59\uAA60-\uAA76\uAA7A-\uAAC2\uAADB-\uAADD\uAAE0-\uAAEF\uAAF2-\uAAF6\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABEA\uABEC\uABED\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE00-\uFE0F\uFE20-\uFE2F\uFE33\uFE34\uFE4D-\uFE4F\uFE70-\uFE74\uFE76-\uFEFC\uFF10-\uFF19\uFF21-\uFF3A\uFF3F\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDDFD\uDE80-\uDE9C\uDEA0-\uDED0\uDEE0\uDF00-\uDF1F\uDF30-\uDF4A\uDF50-\uDF7A\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCA0-\uDCA9\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00-\uDE03\uDE05\uDE06\uDE0C-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE38-\uDE3A\uDE3F\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE6\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC00-\uDC46\uDC66-\uDC6F\uDC7F-\uDCBA\uDCD0-\uDCE8\uDCF0-\uDCF9\uDD00-\uDD34\uDD36-\uDD3F\uDD50-\uDD73\uDD76\uDD80-\uDDC4\uDDCA-\uDDCC\uDDD0-\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE37\uDE3E\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEEA\uDEF0-\uDEF9\uDF00-\uDF03\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3C-\uDF44\uDF47\uDF48\uDF4B-\uDF4D\uDF50\uDF57\uDF5D-\uDF63\uDF66-\uDF6C\uDF70-\uDF74]|\uD805[\uDC00-\uDC4A\uDC50-\uDC59\uDC80-\uDCC5\uDCC7\uDCD0-\uDCD9\uDD80-\uDDB5\uDDB8-\uDDC0\uDDD8-\uDDDD\uDE00-\uDE40\uDE44\uDE50-\uDE59\uDE80-\uDEB7\uDEC0-\uDEC9\uDF00-\uDF19\uDF1D-\uDF2B\uDF30-\uDF39]|\uD806[\uDCA0-\uDCE9\uDCFF\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC36\uDC38-\uDC40\uDC50-\uDC59\uDC72-\uDC8F\uDC92-\uDCA7\uDCA9-\uDCB6]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE60-\uDE69\uDED0-\uDEED\uDEF0-\uDEF4\uDF00-\uDF36\uDF40-\uDF43\uDF50-\uDF59\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50-\uDF7E\uDF8F-\uDF9F\uDFE0]|\uD821[\uDC00-\uDFEC]|\uD822[\uDC00-\uDEF2]|\uD82C[\uDC00\uDC01]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99\uDC9D\uDC9E]|\uD834[\uDD65-\uDD69\uDD6D-\uDD72\uDD7B-\uDD82\uDD85-\uDD8B\uDDAA-\uDDAD\uDE42-\uDE44]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB\uDFCE-\uDFFF]|\uD836[\uDE00-\uDE36\uDE3B-\uDE6C\uDE75\uDE84\uDE9B-\uDE9F\uDEA1-\uDEAF]|\uD838[\uDC00-\uDC06\uDC08-\uDC18\uDC1B-\uDC21\uDC23\uDC24\uDC26-\uDC2A]|\uD83A[\uDC00-\uDCC4\uDCD0-\uDCD6\uDD00-\uDD4A\uDD50-\uDD59]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1]|\uD87E[\uDC00-\uDE1D]|\uDB40[\uDD00-\uDDEF]/},i=[5760,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8239,8287,12288,65279],r=new Array(128),n=0;n<128;++n)r[n]=n>=97&&n<=122||n>=65&&n<=90||36===n||95===n;for(s=new Array(128),n=0;n<128;++n)s[n]=n>=97&&n<=122||n>=65&&n<=90||n>=48&&n<=57||36===n||95===n;jl.exports={isDecimalDigit:function(e){return 48<=e&&e<=57},isHexDigit:function(e){return 48<=e&&e<=57||97<=e&&e<=102||65<=e&&e<=70},isOctalDigit:function(e){return e>=48&&e<=55},isWhiteSpace:function(e){return 32===e||9===e||11===e||12===e||160===e||e>=5760&&i.indexOf(e)>=0},isLineTerminator:function(e){return 10===e||13===e||8232===e||8233===e},isIdentifierStartES5:function(e){return e<128?r[e]:t.NonAsciiIdentifierStart.test(a(e))},isIdentifierPartES5:function(e){return e<128?s[e]:t.NonAsciiIdentifierPart.test(a(e))},isIdentifierStartES6:function(t){return t<128?r[t]:e.NonAsciiIdentifierStart.test(a(t))},isIdentifierPartES6:function(t){return t<128?s[t]:e.NonAsciiIdentifierPart.test(a(t))}}}();var $l=jl.exports,Wl={exports:{}};!function(){var e=$l;function t(e,t){return!(!t&&"yield"===e)&&i(e,t)}function i(e,t){if(t&&function(e){switch(e){case"implements":case"interface":case"package":case"private":case"protected":case"public":case"static":case"let":return!0;default:return!1}}(e))return!0;switch(e.length){case 2:return"if"===e||"in"===e||"do"===e;case 3:return"var"===e||"for"===e||"new"===e||"try"===e;case 4:return"this"===e||"else"===e||"case"===e||"void"===e||"with"===e||"enum"===e;case 5:return"while"===e||"break"===e||"catch"===e||"throw"===e||"const"===e||"yield"===e||"class"===e||"super"===e;case 6:return"return"===e||"typeof"===e||"delete"===e||"switch"===e||"export"===e||"import"===e;case 7:return"default"===e||"finally"===e||"extends"===e;case 8:return"function"===e||"continue"===e||"debugger"===e;case 10:return"instanceof"===e;default:return!1}}function r(e,i){return"null"===e||"true"===e||"false"===e||t(e,i)}function s(e,t){return"null"===e||"true"===e||"false"===e||i(e,t)}function n(t){var i,r,s;if(0===t.length)return!1;if(s=t.charCodeAt(0),!e.isIdentifierStartES5(s))return!1;for(i=1,r=t.length;i<r;++i)if(s=t.charCodeAt(i),!e.isIdentifierPartES5(s))return!1;return!0}function a(t){var i,r,s,n,a;if(0===t.length)return!1;for(a=e.isIdentifierStartES6,i=0,r=t.length;i<r;++i){if(55296<=(s=t.charCodeAt(i))&&s<=56319){if(++i>=r)return!1;if(!(56320<=(n=t.charCodeAt(i))&&n<=57343))return!1;s=1024*(s-55296)+(n-56320)+65536}if(!a(s))return!1;a=e.isIdentifierPartES6}return!0}Wl.exports={isKeywordES5:t,isKeywordES6:i,isReservedWordES5:r,isReservedWordES6:s,isRestrictedWord:function(e){return"eval"===e||"arguments"===e},isIdentifierNameES5:n,isIdentifierNameES6:a,isIdentifierES5:function(e,t){return n(e)&&!r(e,t)},isIdentifierES6:function(e,t){return a(e)&&!s(e,t)}}}();var ql=Wl.exports;Ul.ast=zl,Ul.code=$l,Ul.keyword=ql;var Hl,Xl,Yl={},Zl={},Kl={},Jl={};function Ql(){if(Hl)return Jl;Hl=1;var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split("");return Jl.encode=function(t){if(0<=t&&t<e.length)return e[t];throw new TypeError("Must be between 0 and 63: "+t)},Jl.decode=function(e){return 65<=e&&e<=90?e-65:97<=e&&e<=122?e-97+26:48<=e&&e<=57?e-48+52:43==e?62:47==e?63:-1},Jl}function ec(){if(Xl)return Kl;Xl=1;var e=Ql();return Kl.encode=function(t){var i,r="",s=function(e){return e<0?1+(-e<<1):0+(e<<1)}(t);do{i=31&s,(s>>>=5)>0&&(i|=32),r+=e.encode(i)}while(s>0);return r},Kl.decode=function(t,i,r){var s,n,a,o,h=t.length,u=0,l=0;do{if(i>=h)throw new Error("Expected more digits in base 64 VLQ value.");if(-1===(n=e.decode(t.charCodeAt(i++))))throw new Error("Invalid base64 digit: "+t.charAt(i-1));s=!!(32&n),u+=(n&=31)<<l,l+=5}while(s);r.value=(o=(a=u)>>1,1&~a?o:-o),r.rest=i},Kl}var tc,ic={};function rc(){return tc||(tc=1,function(e){e.getArg=function(e,t,i){if(t in e)return e[t];if(3===arguments.length)return i;throw new Error('"'+t+'" is a required argument.')};var t=/^(?:([\w+\-.]+):)?\/\/(?:(\w+:\w+)@)?([\w.-]*)(?::(\d+))?(.*)$/,i=/^data:.+\,.+$/;function r(e){var i=e.match(t);return i?{scheme:i[1],auth:i[2],host:i[3],port:i[4],path:i[5]}:null}function s(e){var t="";return e.scheme&&(t+=e.scheme+":"),t+="//",e.auth&&(t+=e.auth+"@"),e.host&&(t+=e.host),e.port&&(t+=":"+e.port),e.path&&(t+=e.path),t}function n(t){var i=t,n=r(t);if(n){if(!n.path)return t;i=n.path}for(var a,o=e.isAbsolute(i),h=i.split(/\/+/),u=0,l=h.length-1;l>=0;l--)"."===(a=h[l])?h.splice(l,1):".."===a?u++:u>0&&(""===a?(h.splice(l+1,u),u=0):(h.splice(l,2),u--));return""===(i=h.join("/"))&&(i=o?"/":"."),n?(n.path=i,s(n)):i}function a(e,t){""===e&&(e="."),""===t&&(t=".");var a=r(t),o=r(e);if(o&&(e=o.path||"/"),a&&!a.scheme)return o&&(a.scheme=o.scheme),s(a);if(a||t.match(i))return t;if(o&&!o.host&&!o.path)return o.host=t,s(o);var h="/"===t.charAt(0)?t:n(e.replace(/\/+$/,"")+"/"+t);return o?(o.path=h,s(o)):h}e.urlParse=r,e.urlGenerate=s,e.normalize=n,e.join=a,e.isAbsolute=function(e){return"/"===e.charAt(0)||t.test(e)},e.relative=function(e,t){""===e&&(e="."),e=e.replace(/\/$/,"");for(var i=0;0!==t.indexOf(e+"/");){var r=e.lastIndexOf("/");if(r<0)return t;if((e=e.slice(0,r)).match(/^([^\/]+:\/)?\/*$/))return t;++i}return Array(i+1).join("../")+t.substr(e.length+1)};var o=!("__proto__"in Object.create(null));function h(e){return e}function u(e){if(!e)return!1;var t=e.length;if(t<9)return!1;if(95!==e.charCodeAt(t-1)||95!==e.charCodeAt(t-2)||111!==e.charCodeAt(t-3)||116!==e.charCodeAt(t-4)||111!==e.charCodeAt(t-5)||114!==e.charCodeAt(t-6)||112!==e.charCodeAt(t-7)||95!==e.charCodeAt(t-8)||95!==e.charCodeAt(t-9))return!1;for(var i=t-10;i>=0;i--)if(36!==e.charCodeAt(i))return!1;return!0}function l(e,t){return e===t?0:null===e?1:null===t?-1:e>t?1:-1}e.toSetString=o?h:function(e){return u(e)?"$"+e:e},e.fromSetString=o?h:function(e){return u(e)?e.slice(1):e},e.compareByOriginalPositions=function(e,t,i){var r=l(e.source,t.source);return 0!==r||0!==(r=e.originalLine-t.originalLine)||0!==(r=e.originalColumn-t.originalColumn)||i||0!==(r=e.generatedColumn-t.generatedColumn)||0!==(r=e.generatedLine-t.generatedLine)?r:l(e.name,t.name)},e.compareByGeneratedPositionsDeflated=function(e,t,i){var r=e.generatedLine-t.generatedLine;return 0!==r||0!==(r=e.generatedColumn-t.generatedColumn)||i||0!==(r=l(e.source,t.source))||0!==(r=e.originalLine-t.originalLine)||0!==(r=e.originalColumn-t.originalColumn)?r:l(e.name,t.name)},e.compareByGeneratedPositionsInflated=function(e,t){var i=e.generatedLine-t.generatedLine;return 0!==i||0!==(i=e.generatedColumn-t.generatedColumn)||0!==(i=l(e.source,t.source))||0!==(i=e.originalLine-t.originalLine)||0!==(i=e.originalColumn-t.originalColumn)?i:l(e.name,t.name)},e.parseSourceMapInput=function(e){return JSON.parse(e.replace(/^\)]}'[^\n]*\n/,""))},e.computeSourceURL=function(e,t,i){if(t=t||"",e&&("/"!==e[e.length-1]&&"/"!==t[0]&&(e+="/"),t=e+t),i){var o=r(i);if(!o)throw new Error("sourceMapURL could not be parsed");if(o.path){var h=o.path.lastIndexOf("/");h>=0&&(o.path=o.path.substring(0,h+1))}t=a(s(o),t)}return n(t)}}(ic)),ic}var sc,nc={};function ac(){if(sc)return nc;sc=1;var e=rc(),t=Object.prototype.hasOwnProperty,i="undefined"!=typeof Map;function r(){this._array=[],this._set=i?new Map:Object.create(null)}return r.fromArray=function(e,t){for(var i=new r,s=0,n=e.length;s<n;s++)i.add(e[s],t);return i},r.prototype.size=function(){return i?this._set.size:Object.getOwnPropertyNames(this._set).length},r.prototype.add=function(r,s){var n=i?r:e.toSetString(r),a=i?this.has(r):t.call(this._set,n),o=this._array.length;a&&!s||this._array.push(r),a||(i?this._set.set(r,o):this._set[n]=o)},r.prototype.has=function(r){if(i)return this._set.has(r);var s=e.toSetString(r);return t.call(this._set,s)},r.prototype.indexOf=function(r){if(i){var s=this._set.get(r);if(s>=0)return s}else{var n=e.toSetString(r);if(t.call(this._set,n))return this._set[n]}throw new Error('"'+r+'" is not in the set.')},r.prototype.at=function(e){if(e>=0&&e<this._array.length)return this._array[e];throw new Error("No element indexed by "+e)},r.prototype.toArray=function(){return this._array.slice()},nc.ArraySet=r,nc}var oc,hc,uc={};function lc(){if(oc)return uc;oc=1;var e=rc();function t(){this._array=[],this._sorted=!0,this._last={generatedLine:-1,generatedColumn:0}}return t.prototype.unsortedForEach=function(e,t){this._array.forEach(e,t)},t.prototype.add=function(t){var i,r,s,n,a,o;i=this._last,r=t,s=i.generatedLine,n=r.generatedLine,a=i.generatedColumn,o=r.generatedColumn,n>s||n==s&&o>=a||e.compareByGeneratedPositionsInflated(i,r)<=0?(this._last=t,this._array.push(t)):(this._sorted=!1,this._array.push(t))},t.prototype.toArray=function(){return this._sorted||(this._array.sort(e.compareByGeneratedPositionsInflated),this._sorted=!0),this._array},uc.MappingList=t,uc}function cc(){if(hc)return Zl;hc=1;var e=ec(),t=rc(),i=ac().ArraySet,r=lc().MappingList;function s(e){e||(e={}),this._file=t.getArg(e,"file",null),this._sourceRoot=t.getArg(e,"sourceRoot",null),this._skipValidation=t.getArg(e,"skipValidation",!1),this._sources=new i,this._names=new i,this._mappings=new r,this._sourcesContents=null}return s.prototype._version=3,s.fromSourceMap=function(e){var i=e.sourceRoot,r=new s({file:e.file,sourceRoot:i});return e.eachMapping((function(e){var s={generated:{line:e.generatedLine,column:e.generatedColumn}};null!=e.source&&(s.source=e.source,null!=i&&(s.source=t.relative(i,s.source)),s.original={line:e.originalLine,column:e.originalColumn},null!=e.name&&(s.name=e.name)),r.addMapping(s)})),e.sources.forEach((function(s){var n=s;null!==i&&(n=t.relative(i,s)),r._sources.has(n)||r._sources.add(n);var a=e.sourceContentFor(s);null!=a&&r.setSourceContent(s,a)})),r},s.prototype.addMapping=function(e){var i=t.getArg(e,"generated"),r=t.getArg(e,"original",null),s=t.getArg(e,"source",null),n=t.getArg(e,"name",null);this._skipValidation||this._validateMapping(i,r,s,n),null!=s&&(s=String(s),this._sources.has(s)||this._sources.add(s)),null!=n&&(n=String(n),this._names.has(n)||this._names.add(n)),this._mappings.add({generatedLine:i.line,generatedColumn:i.column,originalLine:null!=r&&r.line,originalColumn:null!=r&&r.column,source:s,name:n})},s.prototype.setSourceContent=function(e,i){var r=e;null!=this._sourceRoot&&(r=t.relative(this._sourceRoot,r)),null!=i?(this._sourcesContents||(this._sourcesContents=Object.create(null)),this._sourcesContents[t.toSetString(r)]=i):this._sourcesContents&&(delete this._sourcesContents[t.toSetString(r)],0===Object.keys(this._sourcesContents).length&&(this._sourcesContents=null))},s.prototype.applySourceMap=function(e,r,s){var n=r;if(null==r){if(null==e.file)throw new Error('SourceMapGenerator.prototype.applySourceMap requires either an explicit source file, or the source map\'s "file" property. Both were omitted.');n=e.file}var a=this._sourceRoot;null!=a&&(n=t.relative(a,n));var o=new i,h=new i;this._mappings.unsortedForEach((function(i){if(i.source===n&&null!=i.originalLine){var r=e.originalPositionFor({line:i.originalLine,column:i.originalColumn});null!=r.source&&(i.source=r.source,null!=s&&(i.source=t.join(s,i.source)),null!=a&&(i.source=t.relative(a,i.source)),i.originalLine=r.line,i.originalColumn=r.column,null!=r.name&&(i.name=r.name))}var u=i.source;null==u||o.has(u)||o.add(u);var l=i.name;null==l||h.has(l)||h.add(l)}),this),this._sources=o,this._names=h,e.sources.forEach((function(i){var r=e.sourceContentFor(i);null!=r&&(null!=s&&(i=t.join(s,i)),null!=a&&(i=t.relative(a,i)),this.setSourceContent(i,r))}),this)},s.prototype._validateMapping=function(e,t,i,r){if(t&&"number"!=typeof t.line&&"number"!=typeof t.column)throw new Error("original.line and original.column are not numbers -- you probably meant to omit the original mapping entirely and only map the generated position. If so, pass null for the original mapping instead of an object with empty or null values.");if((!(e&&"line"in e&&"column"in e&&e.line>0&&e.column>=0)||t||i||r)&&!(e&&"line"in e&&"column"in e&&t&&"line"in t&&"column"in t&&e.line>0&&e.column>=0&&t.line>0&&t.column>=0&&i))throw new Error("Invalid mapping: "+JSON.stringify({generated:e,source:i,original:t,name:r}))},s.prototype._serializeMappings=function(){for(var i,r,s,n,a=0,o=1,h=0,u=0,l=0,c=0,p="",d=this._mappings.toArray(),f=0,g=d.length;f<g;f++){if(i="",(r=d[f]).generatedLine!==o)for(a=0;r.generatedLine!==o;)i+=";",o++;else if(f>0){if(!t.compareByGeneratedPositionsInflated(r,d[f-1]))continue;i+=","}i+=e.encode(r.generatedColumn-a),a=r.generatedColumn,null!=r.source&&(n=this._sources.indexOf(r.source),i+=e.encode(n-c),c=n,i+=e.encode(r.originalLine-1-u),u=r.originalLine-1,i+=e.encode(r.originalColumn-h),h=r.originalColumn,null!=r.name&&(s=this._names.indexOf(r.name),i+=e.encode(s-l),l=s)),p+=i}return p},s.prototype._generateSourcesContent=function(e,i){return e.map((function(e){if(!this._sourcesContents)return null;null!=i&&(e=t.relative(i,e));var r=t.toSetString(e);return Object.prototype.hasOwnProperty.call(this._sourcesContents,r)?this._sourcesContents[r]:null}),this)},s.prototype.toJSON=function(){var e={version:this._version,sources:this._sources.toArray(),names:this._names.toArray(),mappings:this._serializeMappings()};return null!=this._file&&(e.file=this._file),null!=this._sourceRoot&&(e.sourceRoot=this._sourceRoot),this._sourcesContents&&(e.sourcesContent=this._generateSourcesContent(e.sources,e.sourceRoot)),e},s.prototype.toString=function(){return JSON.stringify(this.toJSON())},Zl.SourceMapGenerator=s,Zl}var pc,dc={},fc={};function gc(){return pc||(pc=1,function(e){function t(i,r,s,n,a,o){var h=Math.floor((r-i)/2)+i,u=a(s,n[h],!0);return 0===u?h:u>0?r-h>1?t(h,r,s,n,a,o):o==e.LEAST_UPPER_BOUND?r<n.length?r:-1:h:h-i>1?t(i,h,s,n,a,o):o==e.LEAST_UPPER_BOUND?h:i<0?-1:i}e.GREATEST_LOWER_BOUND=1,e.LEAST_UPPER_BOUND=2,e.search=function(i,r,s,n){if(0===r.length)return-1;var a=t(-1,r.length,i,r,s,n||e.GREATEST_LOWER_BOUND);if(a<0)return-1;for(;a-1>=0&&0===s(r[a],r[a-1],!0);)--a;return a}}(fc)),fc}var mc,yc,xc={};function vc(){if(mc)return xc;function e(e,t,i){var r=e[t];e[t]=e[i],e[i]=r}function t(i,r,s,n){if(s<n){var a=s-1;e(i,(l=s,c=n,Math.round(l+Math.random()*(c-l))),n);for(var o=i[n],h=s;h<n;h++)r(i[h],o)<=0&&e(i,a+=1,h);e(i,a+1,h);var u=a+1;t(i,r,s,u-1),t(i,r,u+1,n)}var l,c}return mc=1,xc.quickSort=function(e,i){t(e,i,0,e.length-1)},xc}var bc,_c,wc={};function Cc(){return _c||(_c=1,Yl.SourceMapGenerator=cc().SourceMapGenerator,Yl.SourceMapConsumer=function(){if(yc)return dc;yc=1;var e=rc(),t=gc(),i=ac().ArraySet,r=ec(),s=vc().quickSort;function n(t,i){var r=t;return"string"==typeof t&&(r=e.parseSourceMapInput(t)),null!=r.sections?new h(r,i):new a(r,i)}function a(t,r){var s=t;"string"==typeof t&&(s=e.parseSourceMapInput(t));var n=e.getArg(s,"version"),a=e.getArg(s,"sources"),o=e.getArg(s,"names",[]),h=e.getArg(s,"sourceRoot",null),u=e.getArg(s,"sourcesContent",null),l=e.getArg(s,"mappings"),c=e.getArg(s,"file",null);if(n!=this._version)throw new Error("Unsupported version: "+n);h&&(h=e.normalize(h)),a=a.map(String).map(e.normalize).map((function(t){return h&&e.isAbsolute(h)&&e.isAbsolute(t)?e.relative(h,t):t})),this._names=i.fromArray(o.map(String),!0),this._sources=i.fromArray(a,!0),this._absoluteSources=this._sources.toArray().map((function(t){return e.computeSourceURL(h,t,r)})),this.sourceRoot=h,this.sourcesContent=u,this._mappings=l,this._sourceMapURL=r,this.file=c}function o(){this.generatedLine=0,this.generatedColumn=0,this.source=null,this.originalLine=null,this.originalColumn=null,this.name=null}function h(t,r){var s=t;"string"==typeof t&&(s=e.parseSourceMapInput(t));var a=e.getArg(s,"version"),o=e.getArg(s,"sections");if(a!=this._version)throw new Error("Unsupported version: "+a);this._sources=new i,this._names=new i;var h={line:-1,column:0};this._sections=o.map((function(t){if(t.url)throw new Error("Support for url field in sections not implemented.");var i=e.getArg(t,"offset"),s=e.getArg(i,"line"),a=e.getArg(i,"column");if(s<h.line||s===h.line&&a<h.column)throw new Error("Section offsets must be ordered and non-overlapping.");return h=i,{generatedOffset:{generatedLine:s+1,generatedColumn:a+1},consumer:new n(e.getArg(t,"map"),r)}}))}return n.fromSourceMap=function(e,t){return a.fromSourceMap(e,t)},n.prototype._version=3,n.prototype.__generatedMappings=null,Object.defineProperty(n.prototype,"_generatedMappings",{configurable:!0,enumerable:!0,get:function(){return this.__generatedMappings||this._parseMappings(this._mappings,this.sourceRoot),this.__generatedMappings}}),n.prototype.__originalMappings=null,Object.defineProperty(n.prototype,"_originalMappings",{configurable:!0,enumerable:!0,get:function(){return this.__originalMappings||this._parseMappings(this._mappings,this.sourceRoot),this.__originalMappings}}),n.prototype._charIsMappingSeparator=function(e,t){var i=e.charAt(t);return";"===i||","===i},n.prototype._parseMappings=function(e,t){throw new Error("Subclasses must implement _parseMappings")},n.GENERATED_ORDER=1,n.ORIGINAL_ORDER=2,n.GREATEST_LOWER_BOUND=1,n.LEAST_UPPER_BOUND=2,n.prototype.eachMapping=function(t,i,r){var s,a=i||null;switch(r||n.GENERATED_ORDER){case n.GENERATED_ORDER:s=this._generatedMappings;break;case n.ORIGINAL_ORDER:s=this._originalMappings;break;default:throw new Error("Unknown order of iteration.")}var o=this.sourceRoot;s.map((function(t){var i=null===t.source?null:this._sources.at(t.source);return{source:i=e.computeSourceURL(o,i,this._sourceMapURL),generatedLine:t.generatedLine,generatedColumn:t.generatedColumn,originalLine:t.originalLine,originalColumn:t.originalColumn,name:null===t.name?null:this._names.at(t.name)}}),this).forEach(t,a)},n.prototype.allGeneratedPositionsFor=function(i){var r=e.getArg(i,"line"),s={source:e.getArg(i,"source"),originalLine:r,originalColumn:e.getArg(i,"column",0)};if(s.source=this._findSourceIndex(s.source),s.source<0)return[];var n=[],a=this._findMapping(s,this._originalMappings,"originalLine","originalColumn",e.compareByOriginalPositions,t.LEAST_UPPER_BOUND);if(a>=0){var o=this._originalMappings[a];if(void 0===i.column)for(var h=o.originalLine;o&&o.originalLine===h;)n.push({line:e.getArg(o,"generatedLine",null),column:e.getArg(o,"generatedColumn",null),lastColumn:e.getArg(o,"lastGeneratedColumn",null)}),o=this._originalMappings[++a];else for(var u=o.originalColumn;o&&o.originalLine===r&&o.originalColumn==u;)n.push({line:e.getArg(o,"generatedLine",null),column:e.getArg(o,"generatedColumn",null),lastColumn:e.getArg(o,"lastGeneratedColumn",null)}),o=this._originalMappings[++a]}return n},dc.SourceMapConsumer=n,a.prototype=Object.create(n.prototype),a.prototype.consumer=n,a.prototype._findSourceIndex=function(t){var i,r=t;if(null!=this.sourceRoot&&(r=e.relative(this.sourceRoot,r)),this._sources.has(r))return this._sources.indexOf(r);for(i=0;i<this._absoluteSources.length;++i)if(this._absoluteSources[i]==t)return i;return-1},a.fromSourceMap=function(t,r){var n=Object.create(a.prototype),h=n._names=i.fromArray(t._names.toArray(),!0),u=n._sources=i.fromArray(t._sources.toArray(),!0);n.sourceRoot=t._sourceRoot,n.sourcesContent=t._generateSourcesContent(n._sources.toArray(),n.sourceRoot),n.file=t._file,n._sourceMapURL=r,n._absoluteSources=n._sources.toArray().map((function(t){return e.computeSourceURL(n.sourceRoot,t,r)}));for(var l=t._mappings.toArray().slice(),c=n.__generatedMappings=[],p=n.__originalMappings=[],d=0,f=l.length;d<f;d++){var g=l[d],m=new o;m.generatedLine=g.generatedLine,m.generatedColumn=g.generatedColumn,g.source&&(m.source=u.indexOf(g.source),m.originalLine=g.originalLine,m.originalColumn=g.originalColumn,g.name&&(m.name=h.indexOf(g.name)),p.push(m)),c.push(m)}return s(n.__originalMappings,e.compareByOriginalPositions),n},a.prototype._version=3,Object.defineProperty(a.prototype,"sources",{get:function(){return this._absoluteSources.slice()}}),a.prototype._parseMappings=function(t,i){for(var n,a,h,u,l,c=1,p=0,d=0,f=0,g=0,m=0,y=t.length,x=0,v={},b={},_=[],w=[];x<y;)if(";"===t.charAt(x))c++,x++,p=0;else if(","===t.charAt(x))x++;else{for((n=new o).generatedLine=c,u=x;u<y&&!this._charIsMappingSeparator(t,u);u++);if(h=v[a=t.slice(x,u)])x+=a.length;else{for(h=[];x<u;)r.decode(t,x,b),l=b.value,x=b.rest,h.push(l);if(2===h.length)throw new Error("Found a source, but no line and column");if(3===h.length)throw new Error("Found a source and line, but no column");v[a]=h}n.generatedColumn=p+h[0],p=n.generatedColumn,h.length>1&&(n.source=g+h[1],g+=h[1],n.originalLine=d+h[2],d=n.originalLine,n.originalLine+=1,n.originalColumn=f+h[3],f=n.originalColumn,h.length>4&&(n.name=m+h[4],m+=h[4])),w.push(n),"number"==typeof n.originalLine&&_.push(n)}s(w,e.compareByGeneratedPositionsDeflated),this.__generatedMappings=w,s(_,e.compareByOriginalPositions),this.__originalMappings=_},a.prototype._findMapping=function(e,i,r,s,n,a){if(e[r]<=0)throw new TypeError("Line must be greater than or equal to 1, got "+e[r]);if(e[s]<0)throw new TypeError("Column must be greater than or equal to 0, got "+e[s]);return t.search(e,i,n,a)},a.prototype.computeColumnSpans=function(){for(var e=0;e<this._generatedMappings.length;++e){var t=this._generatedMappings[e];if(e+1<this._generatedMappings.length){var i=this._generatedMappings[e+1];if(t.generatedLine===i.generatedLine){t.lastGeneratedColumn=i.generatedColumn-1;continue}}t.lastGeneratedColumn=1/0}},a.prototype.originalPositionFor=function(t){var i={generatedLine:e.getArg(t,"line"),generatedColumn:e.getArg(t,"column")},r=this._findMapping(i,this._generatedMappings,"generatedLine","generatedColumn",e.compareByGeneratedPositionsDeflated,e.getArg(t,"bias",n.GREATEST_LOWER_BOUND));if(r>=0){var s=this._generatedMappings[r];if(s.generatedLine===i.generatedLine){var a=e.getArg(s,"source",null);null!==a&&(a=this._sources.at(a),a=e.computeSourceURL(this.sourceRoot,a,this._sourceMapURL));var o=e.getArg(s,"name",null);return null!==o&&(o=this._names.at(o)),{source:a,line:e.getArg(s,"originalLine",null),column:e.getArg(s,"originalColumn",null),name:o}}}return{source:null,line:null,column:null,name:null}},a.prototype.hasContentsOfAllSources=function(){return!!this.sourcesContent&&this.sourcesContent.length>=this._sources.size()&&!this.sourcesContent.some((function(e){return null==e}))},a.prototype.sourceContentFor=function(t,i){if(!this.sourcesContent)return null;var r=this._findSourceIndex(t);if(r>=0)return this.sourcesContent[r];var s,n=t;if(null!=this.sourceRoot&&(n=e.relative(this.sourceRoot,n)),null!=this.sourceRoot&&(s=e.urlParse(this.sourceRoot))){var a=n.replace(/^file:\/\//,"");if("file"==s.scheme&&this._sources.has(a))return this.sourcesContent[this._sources.indexOf(a)];if((!s.path||"/"==s.path)&&this._sources.has("/"+n))return this.sourcesContent[this._sources.indexOf("/"+n)]}if(i)return null;throw new Error('"'+n+'" is not in the SourceMap.')},a.prototype.generatedPositionFor=function(t){var i=e.getArg(t,"source");if((i=this._findSourceIndex(i))<0)return{line:null,column:null,lastColumn:null};var r={source:i,originalLine:e.getArg(t,"line"),originalColumn:e.getArg(t,"column")},s=this._findMapping(r,this._originalMappings,"originalLine","originalColumn",e.compareByOriginalPositions,e.getArg(t,"bias",n.GREATEST_LOWER_BOUND));if(s>=0){var a=this._originalMappings[s];if(a.source===r.source)return{line:e.getArg(a,"generatedLine",null),column:e.getArg(a,"generatedColumn",null),lastColumn:e.getArg(a,"lastGeneratedColumn",null)}}return{line:null,column:null,lastColumn:null}},dc.BasicSourceMapConsumer=a,h.prototype=Object.create(n.prototype),h.prototype.constructor=n,h.prototype._version=3,Object.defineProperty(h.prototype,"sources",{get:function(){for(var e=[],t=0;t<this._sections.length;t++)for(var i=0;i<this._sections[t].consumer.sources.length;i++)e.push(this._sections[t].consumer.sources[i]);return e}}),h.prototype.originalPositionFor=function(i){var r={generatedLine:e.getArg(i,"line"),generatedColumn:e.getArg(i,"column")},s=t.search(r,this._sections,(function(e,t){return e.generatedLine-t.generatedOffset.generatedLine||e.generatedColumn-t.generatedOffset.generatedColumn})),n=this._sections[s];return n?n.consumer.originalPositionFor({line:r.generatedLine-(n.generatedOffset.generatedLine-1),column:r.generatedColumn-(n.generatedOffset.generatedLine===r.generatedLine?n.generatedOffset.generatedColumn-1:0),bias:i.bias}):{source:null,line:null,column:null,name:null}},h.prototype.hasContentsOfAllSources=function(){return this._sections.every((function(e){return e.consumer.hasContentsOfAllSources()}))},h.prototype.sourceContentFor=function(e,t){for(var i=0;i<this._sections.length;i++){var r=this._sections[i].consumer.sourceContentFor(e,!0);if(r)return r}if(t)return null;throw new Error('"'+e+'" is not in the SourceMap.')},h.prototype.generatedPositionFor=function(t){for(var i=0;i<this._sections.length;i++){var r=this._sections[i];if(-1!==r.consumer._findSourceIndex(e.getArg(t,"source"))){var s=r.consumer.generatedPositionFor(t);if(s)return{line:s.line+(r.generatedOffset.generatedLine-1),column:s.column+(r.generatedOffset.generatedLine===s.line?r.generatedOffset.generatedColumn-1:0)}}}return{line:null,column:null}},h.prototype._parseMappings=function(t,i){this.__generatedMappings=[],this.__originalMappings=[];for(var r=0;r<this._sections.length;r++)for(var n=this._sections[r],a=n.consumer._generatedMappings,o=0;o<a.length;o++){var h=a[o],u=n.consumer._sources.at(h.source);u=e.computeSourceURL(n.consumer.sourceRoot,u,this._sourceMapURL),this._sources.add(u),u=this._sources.indexOf(u);var l=null;h.name&&(l=n.consumer._names.at(h.name),this._names.add(l),l=this._names.indexOf(l));var c={source:u,generatedLine:h.generatedLine+(n.generatedOffset.generatedLine-1),generatedColumn:h.generatedColumn+(n.generatedOffset.generatedLine===h.generatedLine?n.generatedOffset.generatedColumn-1:0),originalLine:h.originalLine,originalColumn:h.originalColumn,name:l};this.__generatedMappings.push(c),"number"==typeof c.originalLine&&this.__originalMappings.push(c)}s(this.__generatedMappings,e.compareByGeneratedPositionsDeflated),s(this.__originalMappings,e.compareByOriginalPositions)},dc.IndexedSourceMapConsumer=h,dc}().SourceMapConsumer,Yl.SourceNode=function(){if(bc)return wc;bc=1;var e=cc().SourceMapGenerator,t=rc(),i=/(\r?\n)/,r="$$$isSourceNode$$$";function s(e,t,i,s,n){this.children=[],this.sourceContents={},this.line=null==e?null:e,this.column=null==t?null:t,this.source=null==i?null:i,this.name=null==n?null:n,this[r]=!0,null!=s&&this.add(s)}return s.fromStringWithSourceMap=function(e,r,n){var a=new s,o=e.split(i),h=0,u=function(){return e()+(e()||"");function e(){return h<o.length?o[h++]:void 0}},l=1,c=0,p=null;return r.eachMapping((function(e){if(null!==p){if(!(l<e.generatedLine)){var t=(i=o[h]||"").substr(0,e.generatedColumn-c);return o[h]=i.substr(e.generatedColumn-c),c=e.generatedColumn,d(p,t),void(p=e)}d(p,u()),l++,c=0}for(;l<e.generatedLine;)a.add(u()),l++;if(c<e.generatedColumn){var i=o[h]||"";a.add(i.substr(0,e.generatedColumn)),o[h]=i.substr(e.generatedColumn),c=e.generatedColumn}p=e}),this),h<o.length&&(p&&d(p,u()),a.add(o.splice(h).join(""))),r.sources.forEach((function(e){var i=r.sourceContentFor(e);null!=i&&(null!=n&&(e=t.join(n,e)),a.setSourceContent(e,i))})),a;function d(e,i){if(null===e||void 0===e.source)a.add(i);else{var r=n?t.join(n,e.source):e.source;a.add(new s(e.originalLine,e.originalColumn,r,i,e.name))}}},s.prototype.add=function(e){if(Array.isArray(e))e.forEach((function(e){this.add(e)}),this);else{if(!e[r]&&"string"!=typeof e)throw new TypeError("Expected a SourceNode, string, or an array of SourceNodes and strings. Got "+e);e&&this.children.push(e)}return this},s.prototype.prepend=function(e){if(Array.isArray(e))for(var t=e.length-1;t>=0;t--)this.prepend(e[t]);else{if(!e[r]&&"string"!=typeof e)throw new TypeError("Expected a SourceNode, string, or an array of SourceNodes and strings. Got "+e);this.children.unshift(e)}return this},s.prototype.walk=function(e){for(var t,i=0,s=this.children.length;i<s;i++)(t=this.children[i])[r]?t.walk(e):""!==t&&e(t,{source:this.source,line:this.line,column:this.column,name:this.name})},s.prototype.join=function(e){var t,i,r=this.children.length;if(r>0){for(t=[],i=0;i<r-1;i++)t.push(this.children[i]),t.push(e);t.push(this.children[i]),this.children=t}return this},s.prototype.replaceRight=function(e,t){var i=this.children[this.children.length-1];return i[r]?i.replaceRight(e,t):"string"==typeof i?this.children[this.children.length-1]=i.replace(e,t):this.children.push("".replace(e,t)),this},s.prototype.setSourceContent=function(e,i){this.sourceContents[t.toSetString(e)]=i},s.prototype.walkSourceContents=function(e){for(var i=0,s=this.children.length;i<s;i++)this.children[i][r]&&this.children[i].walkSourceContents(e);var n=Object.keys(this.sourceContents);for(i=0,s=n.length;i<s;i++)e(t.fromSetString(n[i]),this.sourceContents[n[i]])},s.prototype.toString=function(){var e="";return this.walk((function(t){e+=t})),e},s.prototype.toStringWithSourceMap=function(t){var i={code:"",line:1,column:0},r=new e(t),s=!1,n=null,a=null,o=null,h=null;return this.walk((function(e,t){i.code+=e,null!==t.source&&null!==t.line&&null!==t.column?(n===t.source&&a===t.line&&o===t.column&&h===t.name||r.addMapping({source:t.source,original:{line:t.line,column:t.column},generated:{line:i.line,column:i.column},name:t.name}),n=t.source,a=t.line,o=t.column,h=t.name,s=!0):s&&(r.addMapping({generated:{line:i.line,column:i.column}}),n=null,s=!1);for(var u=0,l=e.length;u<l;u++)10===e.charCodeAt(u)?(i.line++,i.column=0,u+1===l?(n=null,s=!1):s&&r.addMapping({source:t.source,original:{line:t.line,column:t.column},generated:{line:i.line,column:i.column},name:t.name})):i.column++})),this.walkSourceContents((function(e,t){r.setSourceContent(e,t)})),{code:i.code,map:r}},wc.SourceNode=s,wc}().SourceNode),Yl}var Dc="2.1.0";!function(e){!function(){var t,i,r,s,n,a,o,h,u,l,c,p,d,f,g,m,y,x,v,b,_,w,C,D,E,A;function S(e){return X.Statement.hasOwnProperty(e.type)}a=Ul,t=(n=Vl).Syntax,r={"??":(i={Sequence:0,Yield:1,Assignment:1,Conditional:2,ArrowFunction:2,Coalesce:3,LogicalOR:4,LogicalAND:5,BitwiseOR:6,BitwiseXOR:7,BitwiseAND:8,Equality:9,Relational:10,BitwiseSHIFT:11,Additive:12,Multiplicative:13,Exponentiation:14,Await:15,Unary:15,Postfix:16,OptionalChaining:17,Call:18,New:19,TaggedTemplate:20,Member:21,Primary:22}).Coalesce,"||":i.LogicalOR,"&&":i.LogicalAND,"|":i.BitwiseOR,"^":i.BitwiseXOR,"&":i.BitwiseAND,"==":i.Equality,"!=":i.Equality,"===":i.Equality,"!==":i.Equality,is:i.Equality,isnt:i.Equality,"<":i.Relational,">":i.Relational,"<=":i.Relational,">=":i.Relational,in:i.Relational,instanceof:i.Relational,"<<":i.BitwiseSHIFT,">>":i.BitwiseSHIFT,">>>":i.BitwiseSHIFT,"+":i.Additive,"-":i.Additive,"*":i.Multiplicative,"%":i.Multiplicative,"/":i.Multiplicative,"**":i.Exponentiation};var F=32,T=33;function M(e,t){var i="";for(t|=0;t>0;t>>>=1,e+=e)1&t&&(i+=e);return i}function k(e){var t=e.length;return t&&a.code.isLineTerminator(e.charCodeAt(t-1))}function I(e,t){var i;for(i in t)t.hasOwnProperty(i)&&(e[i]=t[i]);return e}function B(e,t){var i,r;function s(e){return"object"==typeof e&&e instanceof Object&&!(e instanceof RegExp)}for(i in t)t.hasOwnProperty(i)&&(s(r=t[i])?s(e[i])?B(e[i],r):e[i]=B({},r):e[i]=r);return e}function L(e,t){return 8232==(-2&e)?(t?"u":"\\u")+(8232===e?"2028":"2029"):10===e||13===e?(t?"":"\\")+(10===e?"n":"r"):String.fromCharCode(e)}function P(e,t){var i;return 8===e?"\\b":12===e?"\\f":9===e?"\\t":(i=e.toString(16).toUpperCase(),u||e>255?"\\u"+"0000".slice(i.length)+i:0!==e||a.code.isDecimalDigit(t)?11===e?"\\x0B":"\\x"+"00".slice(i.length)+i:"\\0")}function O(e){if(92===e)return"\\\\";if(10===e)return"\\n";if(13===e)return"\\r";if(8232===e)return"\\u2028";if(8233===e)return"\\u2029";throw new Error("Incorrectly classified character")}function N(e){var t,i,r,s="";for(t=0,i=e.length;t<i;++t)r=e[t],s+=Array.isArray(r)?N(r):r;return s}function R(e,t){if(!w)return Array.isArray(e)?N(e):e;if(null==t){if(e instanceof s)return e;t={}}return null==t.loc?new s(null,null,w,e,t.name||null):new s(t.loc.start.line,t.loc.start.column,!0===w?t.loc.source||null:w,e,t.name||null)}function V(){return g||" "}function U(e,t){var i,r,s,n;return 0===(i=R(e).toString()).length?[t]:0===(r=R(t).toString()).length?[e]:(s=i.charCodeAt(i.length-1),n=r.charCodeAt(0),(43===s||45===s)&&s===n||a.code.isIdentifierPartES5(s)&&a.code.isIdentifierPartES5(n)||47===s&&105===n?[e,V(),t]:a.code.isWhiteSpace(s)||a.code.isLineTerminator(s)||a.code.isWhiteSpace(n)||a.code.isLineTerminator(n)?[e,t]:[e,g,t])}function G(e){return[o,e]}function z(e){var t;t=o,e(o+=h),o=t}function j(e,t){if("Line"===e.type){if(k(e.value))return"//"+e.value;var i="//"+e.value;return D||(i+="\n"),i}return b.format.indent.adjustMultilineComment&&/[\n\r]/.test(e.value)?function(e,t){var i,r,s,n,h,u,l,c;for(i=e.split(/\r\n|[\r\n]/),u=Number.MAX_VALUE,r=1,s=i.length;r<s;++r){for(n=i[r],h=0;h<n.length&&a.code.isWhiteSpace(n.charCodeAt(h));)++h;u>h&&(u=h)}for(void 0!==t?(l=o,"*"===i[1][u]&&(t+=" "),o=t):(1&u&&--u,l=o),r=1,s=i.length;r<s;++r)c=R(G(i[r].slice(u))),i[r]=w?c.join(""):c;return o=l,i.join("\n")}("/*"+e.value+"*/",t):"/*"+e.value+"*/"}function $(e,i){var r,s,n,u,l,c,p,d,f,g,m,y;if(e.leadingComments&&e.leadingComments.length>0){if(u=i,D){for(i=[],d=(n=e.leadingComments[0]).extendedRange,f=n.range,(y=((m=C.substring(d[0],f[0])).match(/\n/g)||[]).length)>0?(i.push(M("\n",y)),i.push(G(j(n)))):(i.push(m),i.push(j(n))),g=f,r=1,s=e.leadingComments.length;r<s;r++)f=(n=e.leadingComments[r]).range,y=(C.substring(g[1],f[0]).match(/\n/g)||[]).length,i.push(M("\n",y)),i.push(G(j(n))),g=f;y=(C.substring(f[1],d[1]).match(/\n/g)||[]).length,i.push(M("\n",y))}else for(n=e.leadingComments[0],i=[],x&&e.type===t.Program&&0===e.body.length&&i.push("\n"),i.push(j(n)),k(R(i).toString())||i.push("\n"),r=1,s=e.leadingComments.length;r<s;++r)k(R(p=[j(n=e.leadingComments[r])]).toString())||p.push("\n"),i.push(G(p));i.push(G(u))}if(e.trailingComments)if(D)d=(n=e.trailingComments[0]).extendedRange,f=n.range,(y=((m=C.substring(d[0],f[0])).match(/\n/g)||[]).length)>0?(i.push(M("\n",y)),i.push(G(j(n)))):(i.push(m),i.push(j(n)));else for(l=!k(R(i).toString()),c=M(" ",function(e){var t;for(t=e.length-1;t>=0&&!a.code.isLineTerminator(e.charCodeAt(t));--t);return e.length-1-t}(R([o,i,h]).toString())),r=0,s=e.trailingComments.length;r<s;++r)n=e.trailingComments[r],l?(i=0===r?[i,h]:[i,c]).push(j(n,c)):i=[i,G(j(n))],r===s-1||k(R(i).toString())||(i=[i,"\n"]);return i}function W(e,t,i){var r,s=0;for(r=e;r<t;r++)"\n"===C[r]&&s++;for(r=1;r<s;r++)i.push(f)}function q(e,t,i){return t<i?["(",e,")"]:e}function H(e){var t,i,r;for(t=1,i=(r=e.split(/\r\n|\n/)).length;t<i;t++)r[t]=f+o+r[t];return r}function X(){}function Y(e){return R(e.name,e)}function Z(e,t){return e.async?"async"+(t?V():g):""}function K(e){return e.generator&&!b.moz.starlessGenerator?"*"+g:""}function J(e){var t=e.value,i="";return t.async&&(i+=Z(t,!e.computed)),t.generator&&(i+=K(t)?"*":""),i}function Q(e){var t;if(t=new X,S(e))return t.generateStatement(e,1);if(function(e){return X.Expression.hasOwnProperty(e.type)}(e))return t.generateExpression(e,i.Sequence,7);throw new Error("Unknown node type: "+e.type)}X.prototype.maybeBlock=function(e,i){var r,s,n=this;return s=!b.comment||!e.leadingComments,e.type===t.BlockStatement&&s?[g,this.generateStatement(e,i)]:e.type===t.EmptyStatement&&s?";":(z((function(){r=[f,G(n.generateStatement(e,i))]})),r)},X.prototype.maybeBlockSuffix=function(e,i){var r=k(R(i).toString());return e.type!==t.BlockStatement||b.comment&&e.leadingComments||r?r?[i,o]:[i,f,o]:[i,g]},X.prototype.generatePattern=function(e,i,r){return e.type===t.Identifier?Y(e):this.generateExpression(e,i,r)},X.prototype.generateFunctionParams=function(e){var r,s,n,a;if(a=!1,e.type!==t.ArrowFunctionExpression||e.rest||e.defaults&&0!==e.defaults.length||1!==e.params.length||e.params[0].type!==t.Identifier){for((n=e.type===t.ArrowFunctionExpression?[Z(e,!1)]:[]).push("("),e.defaults&&(a=!0),r=0,s=e.params.length;r<s;++r)a&&e.defaults[r]?n.push(this.generateAssignment(e.params[r],e.defaults[r],"=",i.Assignment,7)):n.push(this.generatePattern(e.params[r],i.Assignment,7)),r+1<s&&n.push(","+g);e.rest&&(e.params.length&&n.push(","+g),n.push("..."),n.push(Y(e.rest))),n.push(")")}else n=[Z(e,!0),Y(e.params[0])];return n},X.prototype.generateFunctionBody=function(e){var r,s;return r=this.generateFunctionParams(e),e.type===t.ArrowFunctionExpression&&(r.push(g),r.push("=>")),e.expression?(r.push(g),"{"===(s=this.generateExpression(e.body,i.Assignment,7)).toString().charAt(0)&&(s=["(",s,")"]),r.push(s)):r.push(this.maybeBlock(e.body,9)),r},X.prototype.generateIterationForStatement=function(e,r,s){var n=["for"+(r.await?V()+"await":"")+g+"("],a=this;return z((function(){r.left.type===t.VariableDeclaration?z((function(){n.push(r.left.kind+V()),n.push(a.generateStatement(r.left.declarations[0],0))})):n.push(a.generateExpression(r.left,i.Call,7)),n=U(n,e),n=[U(n,a.generateExpression(r.right,i.Assignment,7)),")"]})),n.push(this.maybeBlock(r.body,s)),n},X.prototype.generatePropertyKey=function(e,t){var r=[];return t&&r.push("["),r.push(this.generateExpression(e,i.Assignment,7)),t&&r.push("]"),r},X.prototype.generateAssignment=function(e,t,r,s,n){return i.Assignment<s&&(n|=1),q([this.generateExpression(e,i.Call,n),g+r+g,this.generateExpression(t,i.Assignment,n)],i.Assignment,s)},X.prototype.semicolon=function(e){return!y&&e&F?"":";"},X.Statement={BlockStatement:function(e,t){var i,r,s=["{",f],n=this;return z((function(){var a,o,h,u;for(0===e.body.length&&D&&(i=e.range)[1]-i[0]>2&&("\n"===(r=C.substring(i[0]+1,i[1]-1))[0]&&(s=["{"]),s.push(r)),u=1,8&t&&(u|=16),a=0,o=e.body.length;a<o;++a)D&&(0===a&&(e.body[0].leadingComments&&(i=e.body[0].leadingComments[0].extendedRange,"\n"===(r=C.substring(i[0],i[1]))[0]&&(s=["{"])),e.body[0].leadingComments||W(e.range[0],e.body[0].range[0],s)),a>0&&(e.body[a-1].trailingComments||e.body[a].leadingComments||W(e.body[a-1].range[1],e.body[a].range[0],s))),a===o-1&&(u|=F),h=e.body[a].leadingComments&&D?n.generateStatement(e.body[a],u):G(n.generateStatement(e.body[a],u)),s.push(h),k(R(h).toString())||D&&a<o-1&&e.body[a+1].leadingComments||s.push(f),D&&a===o-1&&(e.body[a].trailingComments||W(e.body[a].range[1],e.range[1],s))})),s.push(G("}")),s},BreakStatement:function(e,t){return e.label?"break "+e.label.name+this.semicolon(t):"break"+this.semicolon(t)},ContinueStatement:function(e,t){return e.label?"continue "+e.label.name+this.semicolon(t):"continue"+this.semicolon(t)},ClassBody:function(e,t){var r=["{",f],s=this;return z((function(t){var n,a;for(n=0,a=e.body.length;n<a;++n)r.push(t),r.push(s.generateExpression(e.body[n],i.Sequence,7)),n+1<a&&r.push(f)})),k(R(r).toString())||r.push(f),r.push(o),r.push("}"),r},ClassDeclaration:function(e,t){var r,s;return r=["class"],e.id&&(r=U(r,this.generateExpression(e.id,i.Sequence,7))),e.superClass&&(s=U("extends",this.generateExpression(e.superClass,i.Unary,7)),r=U(r,s)),r.push(g),r.push(this.generateStatement(e.body,T)),r},DirectiveStatement:function(e,t){return b.raw&&e.raw?e.raw+this.semicolon(t):function(e){var t,i,r,s;for(s="double"===p?'"':"'",t=0,i=e.length;t<i;++t){if(39===(r=e.charCodeAt(t))){s='"';break}if(34===r){s="'";break}92===r&&++t}return s+e+s}(e.directive)+this.semicolon(t)},DoWhileStatement:function(e,t){var r=U("do",this.maybeBlock(e.body,1));return U(r=this.maybeBlockSuffix(e.body,r),["while"+g+"(",this.generateExpression(e.test,i.Sequence,7),")"+this.semicolon(t)])},CatchClause:function(e,t){var r,s=this;return z((function(){var t;e.param?(r=["catch"+g+"(",s.generateExpression(e.param,i.Sequence,7),")"],e.guard&&(t=s.generateExpression(e.guard,i.Sequence,7),r.splice(2,0," if ",t))):r=["catch"]})),r.push(this.maybeBlock(e.body,1)),r},DebuggerStatement:function(e,t){return"debugger"+this.semicolon(t)},EmptyStatement:function(e,t){return";"},ExportDefaultDeclaration:function(e,t){var r,s=["export"];return r=t&F?T:1,s=U(s,"default"),s=S(e.declaration)?U(s,this.generateStatement(e.declaration,r)):U(s,this.generateExpression(e.declaration,i.Assignment,7)+this.semicolon(t))},ExportNamedDeclaration:function(e,r){var s,n=["export"],a=this;return s=r&F?T:1,e.declaration?U(n,this.generateStatement(e.declaration,s)):(e.specifiers&&(0===e.specifiers.length?n=U(n,"{"+g+"}"):e.specifiers[0].type===t.ExportBatchSpecifier?n=U(n,this.generateExpression(e.specifiers[0],i.Sequence,7)):(n=U(n,"{"),z((function(t){var r,s;for(n.push(f),r=0,s=e.specifiers.length;r<s;++r)n.push(t),n.push(a.generateExpression(e.specifiers[r],i.Sequence,7)),r+1<s&&n.push(","+f)})),k(R(n).toString())||n.push(f),n.push(o+"}")),e.source?n=U(n,["from"+g,this.generateExpression(e.source,i.Sequence,7),this.semicolon(r)]):n.push(this.semicolon(r))),n)},ExportAllDeclaration:function(e,t){return["export"+g,"*"+g,"from"+g,this.generateExpression(e.source,i.Sequence,7),this.semicolon(t)]},ExpressionStatement:function(e,r){var s,n;return 123===(n=R(s=[this.generateExpression(e.expression,i.Sequence,7)]).toString()).charCodeAt(0)||function(e){var t;return"class"===e.slice(0,5)&&(123===(t=e.charCodeAt(5))||a.code.isWhiteSpace(t)||a.code.isLineTerminator(t))}(n)||function(e){var t;return"function"===e.slice(0,8)&&(40===(t=e.charCodeAt(8))||a.code.isWhiteSpace(t)||42===t||a.code.isLineTerminator(t))}(n)||function(e){var t,i,r;if("async"!==e.slice(0,5))return!1;if(!a.code.isWhiteSpace(e.charCodeAt(5)))return!1;for(i=6,r=e.length;i<r&&a.code.isWhiteSpace(e.charCodeAt(i));++i);return i!==r&&("function"===e.slice(i,i+8)&&(40===(t=e.charCodeAt(i+8))||a.code.isWhiteSpace(t)||42===t||a.code.isLineTerminator(t)))}(n)||v&&16&r&&e.expression.type===t.Literal&&"string"==typeof e.expression.value?s=["(",s,")"+this.semicolon(r)]:s.push(this.semicolon(r)),s},ImportDeclaration:function(e,r){var s,n,a=this;return 0===e.specifiers.length?["import",g,this.generateExpression(e.source,i.Sequence,7),this.semicolon(r)]:(s=["import"],n=0,e.specifiers[n].type===t.ImportDefaultSpecifier&&(s=U(s,[this.generateExpression(e.specifiers[n],i.Sequence,7)]),++n),e.specifiers[n]&&(0!==n&&s.push(","),e.specifiers[n].type===t.ImportNamespaceSpecifier?s=U(s,[g,this.generateExpression(e.specifiers[n],i.Sequence,7)]):(s.push(g+"{"),e.specifiers.length-n==1?(s.push(g),s.push(this.generateExpression(e.specifiers[n],i.Sequence,7)),s.push(g+"}"+g)):(z((function(t){var r,o;for(s.push(f),r=n,o=e.specifiers.length;r<o;++r)s.push(t),s.push(a.generateExpression(e.specifiers[r],i.Sequence,7)),r+1<o&&s.push(","+f)})),k(R(s).toString())||s.push(f),s.push(o+"}"+g)))),s=U(s,["from"+g,this.generateExpression(e.source,i.Sequence,7),this.semicolon(r)]))},VariableDeclarator:function(e,t){var r=1&t?7:6;return e.init?[this.generateExpression(e.id,i.Assignment,r),g,"=",g,this.generateExpression(e.init,i.Assignment,r)]:this.generatePattern(e.id,i.Assignment,r)},VariableDeclaration:function(e,t){var i,r,s,n,a,o=this;function h(){for(n=e.declarations[0],b.comment&&n.leadingComments?(i.push("\n"),i.push(G(o.generateStatement(n,a)))):(i.push(V()),i.push(o.generateStatement(n,a))),r=1,s=e.declarations.length;r<s;++r)n=e.declarations[r],b.comment&&n.leadingComments?(i.push(","+f),i.push(G(o.generateStatement(n,a)))):(i.push(","+g),i.push(o.generateStatement(n,a)))}return i=[e.kind],a=1&t?1:0,e.declarations.length>1?z(h):h(),i.push(this.semicolon(t)),i},ThrowStatement:function(e,t){return[U("throw",this.generateExpression(e.argument,i.Sequence,7)),this.semicolon(t)]},TryStatement:function(e,t){var i,r,s,n;if(i=["try",this.maybeBlock(e.block,1)],i=this.maybeBlockSuffix(e.block,i),e.handlers)for(r=0,s=e.handlers.length;r<s;++r)i=U(i,this.generateStatement(e.handlers[r],1)),(e.finalizer||r+1!==s)&&(i=this.maybeBlockSuffix(e.handlers[r].body,i));else{for(r=0,s=(n=e.guardedHandlers||[]).length;r<s;++r)i=U(i,this.generateStatement(n[r],1)),(e.finalizer||r+1!==s)&&(i=this.maybeBlockSuffix(n[r].body,i));if(e.handler)if(Array.isArray(e.handler))for(r=0,s=e.handler.length;r<s;++r)i=U(i,this.generateStatement(e.handler[r],1)),(e.finalizer||r+1!==s)&&(i=this.maybeBlockSuffix(e.handler[r].body,i));else i=U(i,this.generateStatement(e.handler,1)),e.finalizer&&(i=this.maybeBlockSuffix(e.handler.body,i))}return e.finalizer&&(i=U(i,["finally",this.maybeBlock(e.finalizer,1)])),i},SwitchStatement:function(e,t){var r,s,n,a,o,h=this;if(z((function(){r=["switch"+g+"(",h.generateExpression(e.discriminant,i.Sequence,7),")"+g+"{"+f]})),e.cases)for(o=1,n=0,a=e.cases.length;n<a;++n)n===a-1&&(o|=F),s=G(this.generateStatement(e.cases[n],o)),r.push(s),k(R(s).toString())||r.push(f);return r.push(G("}")),r},SwitchCase:function(e,r){var s,n,a,o,h,u=this;return z((function(){for(s=e.test?[U("case",u.generateExpression(e.test,i.Sequence,7)),":"]:["default:"],a=0,(o=e.consequent.length)&&e.consequent[0].type===t.BlockStatement&&(n=u.maybeBlock(e.consequent[0],1),s.push(n),a=1),a===o||k(R(s).toString())||s.push(f),h=1;a<o;++a)a===o-1&&r&F&&(h|=F),n=G(u.generateStatement(e.consequent[a],h)),s.push(n),a+1===o||k(R(n).toString())||s.push(f)})),s},IfStatement:function(e,r){var s,n,a=this;return z((function(){s=["if"+g+"(",a.generateExpression(e.test,i.Sequence,7),")"]})),n=1,r&F&&(n|=F),e.alternate?(s.push(this.maybeBlock(e.consequent,1)),s=this.maybeBlockSuffix(e.consequent,s),s=e.alternate.type===t.IfStatement?U(s,["else ",this.generateStatement(e.alternate,n)]):U(s,U("else",this.maybeBlock(e.alternate,n)))):s.push(this.maybeBlock(e.consequent,n)),s},ForStatement:function(e,r){var s,n=this;return z((function(){s=["for"+g+"("],e.init?e.init.type===t.VariableDeclaration?s.push(n.generateStatement(e.init,0)):(s.push(n.generateExpression(e.init,i.Sequence,6)),s.push(";")):s.push(";"),e.test?(s.push(g),s.push(n.generateExpression(e.test,i.Sequence,7)),s.push(";")):s.push(";"),e.update?(s.push(g),s.push(n.generateExpression(e.update,i.Sequence,7)),s.push(")")):s.push(")")})),s.push(this.maybeBlock(e.body,r&F?T:1)),s},ForInStatement:function(e,t){return this.generateIterationForStatement("in",e,t&F?T:1)},ForOfStatement:function(e,t){return this.generateIterationForStatement("of",e,t&F?T:1)},LabeledStatement:function(e,t){return[e.label.name+":",this.maybeBlock(e.body,t&F?T:1)]},Program:function(e,t){var i,r,s,n,a;for(n=e.body.length,i=[x&&n>0?"\n":""],a=17,s=0;s<n;++s)x||s!==n-1||(a|=F),D&&(0===s&&(e.body[0].leadingComments||W(e.range[0],e.body[s].range[0],i)),s>0&&(e.body[s-1].trailingComments||e.body[s].leadingComments||W(e.body[s-1].range[1],e.body[s].range[0],i))),r=G(this.generateStatement(e.body[s],a)),i.push(r),s+1<n&&!k(R(r).toString())&&(D&&e.body[s+1].leadingComments||i.push(f)),D&&s===n-1&&(e.body[s].trailingComments||W(e.body[s].range[1],e.range[1],i));return i},FunctionDeclaration:function(e,t){return[Z(e,!0),"function",K(e)||V(),e.id?Y(e.id):"",this.generateFunctionBody(e)]},ReturnStatement:function(e,t){return e.argument?[U("return",this.generateExpression(e.argument,i.Sequence,7)),this.semicolon(t)]:["return"+this.semicolon(t)]},WhileStatement:function(e,t){var r,s=this;return z((function(){r=["while"+g+"(",s.generateExpression(e.test,i.Sequence,7),")"]})),r.push(this.maybeBlock(e.body,t&F?T:1)),r},WithStatement:function(e,t){var r,s=this;return z((function(){r=["with"+g+"(",s.generateExpression(e.object,i.Sequence,7),")"]})),r.push(this.maybeBlock(e.body,t&F?T:1)),r}},I(X.prototype,X.Statement),X.Expression={SequenceExpression:function(e,t,r){var s,n,a;for(i.Sequence<t&&(r|=1),s=[],n=0,a=e.expressions.length;n<a;++n)s.push(this.generateExpression(e.expressions[n],i.Assignment,r)),n+1<a&&s.push(","+g);return q(s,i.Sequence,t)},AssignmentExpression:function(e,t,i){return this.generateAssignment(e.left,e.right,e.operator,t,i)},ArrowFunctionExpression:function(e,t,r){return q(this.generateFunctionBody(e),i.ArrowFunction,t)},ConditionalExpression:function(e,t,r){return i.Conditional<t&&(r|=1),q([this.generateExpression(e.test,i.Coalesce,r),g+"?"+g,this.generateExpression(e.consequent,i.Assignment,r),g+":"+g,this.generateExpression(e.alternate,i.Assignment,r)],i.Conditional,t)},LogicalExpression:function(e,t,i){return"??"===e.operator&&(i|=64),this.BinaryExpression(e,t,i)},BinaryExpression:function(e,t,s){var n,o,h,u,l,c;return u=r[e.operator],o="**"===e.operator?i.Postfix:u,h="**"===e.operator?u:u+1,u<t&&(s|=1),n=47===(c=(l=this.generateExpression(e.left,o,s)).toString()).charCodeAt(c.length-1)&&a.code.isIdentifierPartES5(e.operator.charCodeAt(0))?[l,V(),e.operator]:U(l,e.operator),l=this.generateExpression(e.right,h,s),"/"===e.operator&&"/"===l.toString().charAt(0)||"<"===e.operator.slice(-1)&&"!--"===l.toString().slice(0,3)?(n.push(V()),n.push(l)):n=U(n,l),"in"!==e.operator||1&s?("||"===e.operator||"&&"===e.operator)&&64&s?["(",n,")"]:q(n,u,t):["(",n,")"]},CallExpression:function(e,t,r){var s,n,a;for(s=[this.generateExpression(e.callee,i.Call,3)],e.optional&&s.push("?."),s.push("("),n=0,a=e.arguments.length;n<a;++n)s.push(this.generateExpression(e.arguments[n],i.Assignment,7)),n+1<a&&s.push(","+g);return s.push(")"),2&r?q(s,i.Call,t):["(",s,")"]},ChainExpression:function(e,t,r){return i.OptionalChaining<t&&(r|=2),q(this.generateExpression(e.expression,i.OptionalChaining,r),i.OptionalChaining,t)},NewExpression:function(e,t,r){var s,n,a,o,h;if(n=e.arguments.length,h=4&r&&!m&&0===n?5:1,s=U("new",this.generateExpression(e.callee,i.New,h)),!(4&r)||m||n>0){for(s.push("("),a=0,o=n;a<o;++a)s.push(this.generateExpression(e.arguments[a],i.Assignment,7)),a+1<o&&s.push(","+g);s.push(")")}return q(s,i.New,t)},MemberExpression:function(e,r,s){var n,o;return n=[this.generateExpression(e.object,i.Call,2&s?3:1)],e.computed?(e.optional&&n.push("?."),n.push("["),n.push(this.generateExpression(e.property,i.Sequence,2&s?7:5)),n.push("]")):(e.optional||e.object.type!==t.Literal||"number"!=typeof e.object.value||(o=R(n).toString()).indexOf(".")<0&&!/[eExX]/.test(o)&&a.code.isDecimalDigit(o.charCodeAt(o.length-1))&&!(o.length>=2&&48===o.charCodeAt(0))&&n.push(" "),n.push(e.optional?"?.":"."),n.push(Y(e.property))),q(n,i.Member,r)},MetaProperty:function(e,t,r){var s;return(s=[]).push("string"==typeof e.meta?e.meta:Y(e.meta)),s.push("."),s.push("string"==typeof e.property?e.property:Y(e.property)),q(s,i.Member,t)},UnaryExpression:function(e,t,r){var s,n,o,h,u;return n=this.generateExpression(e.argument,i.Unary,7),""===g?s=U(e.operator,n):(s=[e.operator],e.operator.length>2?s=U(s,n):(u=(h=R(s).toString()).charCodeAt(h.length-1),o=n.toString().charCodeAt(0),(43===u||45===u)&&u===o||a.code.isIdentifierPartES5(u)&&a.code.isIdentifierPartES5(o)?(s.push(V()),s.push(n)):s.push(n))),q(s,i.Unary,t)},YieldExpression:function(e,t,r){var s;return s=e.delegate?"yield*":"yield",e.argument&&(s=U(s,this.generateExpression(e.argument,i.Yield,7))),q(s,i.Yield,t)},AwaitExpression:function(e,t,r){return q(U(e.all?"await*":"await",this.generateExpression(e.argument,i.Await,7)),i.Await,t)},UpdateExpression:function(e,t,r){return e.prefix?q([e.operator,this.generateExpression(e.argument,i.Unary,7)],i.Unary,t):q([this.generateExpression(e.argument,i.Postfix,7),e.operator],i.Postfix,t)},FunctionExpression:function(e,t,i){var r=[Z(e,!0),"function"];return e.id?(r.push(K(e)||V()),r.push(Y(e.id))):r.push(K(e)||g),r.push(this.generateFunctionBody(e)),r},ArrayPattern:function(e,t,i){return this.ArrayExpression(e,t,i,!0)},ArrayExpression:function(e,t,r,s){var n,a,h=this;return e.elements.length?(a=!s&&e.elements.length>1,n=["[",a?f:""],z((function(t){var r,s;for(r=0,s=e.elements.length;r<s;++r)e.elements[r]?(n.push(a?t:""),n.push(h.generateExpression(e.elements[r],i.Assignment,7))):(a&&n.push(t),r+1===s&&n.push(",")),r+1<s&&n.push(","+(a?f:g))})),a&&!k(R(n).toString())&&n.push(f),n.push(a?o:""),n.push("]"),n):"[]"},RestElement:function(e,t,i){return"..."+this.generatePattern(e.argument)},ClassExpression:function(e,t,r){var s,n;return s=["class"],e.id&&(s=U(s,this.generateExpression(e.id,i.Sequence,7))),e.superClass&&(n=U("extends",this.generateExpression(e.superClass,i.Unary,7)),s=U(s,n)),s.push(g),s.push(this.generateStatement(e.body,T)),s},MethodDefinition:function(e,t,i){var r,s;return r=e.static?["static"+g]:[],s="get"===e.kind||"set"===e.kind?[U(e.kind,this.generatePropertyKey(e.key,e.computed)),this.generateFunctionBody(e.value)]:[J(e),this.generatePropertyKey(e.key,e.computed),this.generateFunctionBody(e.value)],U(r,s)},Property:function(e,t,r){return"get"===e.kind||"set"===e.kind?[e.kind,V(),this.generatePropertyKey(e.key,e.computed),this.generateFunctionBody(e.value)]:e.shorthand?"AssignmentPattern"===e.value.type?this.AssignmentPattern(e.value,i.Sequence,7):this.generatePropertyKey(e.key,e.computed):e.method?[J(e),this.generatePropertyKey(e.key,e.computed),this.generateFunctionBody(e.value)]:[this.generatePropertyKey(e.key,e.computed),":"+g,this.generateExpression(e.value,i.Assignment,7)]},ObjectExpression:function(e,t,r){var s,n,a,h,u=this;return e.properties.length?(s=e.properties.length>1,z((function(){a=u.generateExpression(e.properties[0],i.Sequence,7)})),s||(h=R(a).toString(),/[\r\n]/g.test(h))?(z((function(t){var r,o;if(n=["{",f,t,a],s)for(n.push(","+f),r=1,o=e.properties.length;r<o;++r)n.push(t),n.push(u.generateExpression(e.properties[r],i.Sequence,7)),r+1<o&&n.push(","+f)})),k(R(n).toString())||n.push(f),n.push(o),n.push("}"),n):["{",g,a,g,"}"]):"{}"},AssignmentPattern:function(e,t,i){return this.generateAssignment(e.left,e.right,"=",t,i)},ObjectPattern:function(e,r,s){var n,a,h,u,l,c=this;if(!e.properties.length)return"{}";if(u=!1,1===e.properties.length)(l=e.properties[0]).type===t.Property&&l.value.type!==t.Identifier&&(u=!0);else for(a=0,h=e.properties.length;a<h;++a)if((l=e.properties[a]).type===t.Property&&!l.shorthand){u=!0;break}return n=["{",u?f:""],z((function(t){var r,s;for(r=0,s=e.properties.length;r<s;++r)n.push(u?t:""),n.push(c.generateExpression(e.properties[r],i.Sequence,7)),r+1<s&&n.push(","+(u?f:g))})),u&&!k(R(n).toString())&&n.push(f),n.push(u?o:""),n.push("}"),n},ThisExpression:function(e,t,i){return"this"},Super:function(e,t,i){return"super"},Identifier:function(e,t,i){return Y(e)},ImportDefaultSpecifier:function(e,t,i){return Y(e.id||e.local)},ImportNamespaceSpecifier:function(e,t,i){var r=["*"],s=e.id||e.local;return s&&r.push(g+"as"+V()+Y(s)),r},ImportSpecifier:function(e,t,i){var r=e.imported,s=[r.name],n=e.local;return n&&n.name!==r.name&&s.push(V()+"as"+V()+Y(n)),s},ExportSpecifier:function(e,t,i){var r=e.local,s=[r.name],n=e.exported;return n&&n.name!==r.name&&s.push(V()+"as"+V()+Y(n)),s},Literal:function(e,i,r){var s;if(e.hasOwnProperty("raw")&&_&&b.raw)try{if((s=_(e.raw).body[0].expression).type===t.Literal&&s.value===e.value)return e.raw}catch(e){}return e.regex?"/"+e.regex.pattern+"/"+e.regex.flags:"bigint"==typeof e.value?e.value.toString()+"n":e.bigint?e.bigint+"n":null===e.value?"null":"string"==typeof e.value?function(e){var t,i,r,s,n,o="",h=0,l=0;for(t=0,i=e.length;t<i;++t){if(39===(r=e.charCodeAt(t)))++h;else if(34===r)++l;else if(47===r&&u)o+="\\";else{if(a.code.isLineTerminator(r)||92===r){o+=O(r);continue}if(!a.code.isIdentifierPartES5(r)&&(u&&r<32||!u&&!d&&(r<32||r>126))){o+=P(r,e.charCodeAt(t+1));continue}}o+=String.fromCharCode(r)}if(n=(s=!("double"===p||"auto"===p&&l<h))?"'":'"',!(s?h:l))return n+o+n;for(e=o,o=n,t=0,i=e.length;t<i;++t)(39===(r=e.charCodeAt(t))&&s||34===r&&!s)&&(o+="\\"),o+=String.fromCharCode(r);return o+n}(e.value):"number"==typeof e.value?function(e){var t,i,r,s,n;if(e!=e)throw new Error("Numeric literal whose value is NaN");if(e<0||0===e&&1/e<0)throw new Error("Numeric literal whose value is negative");if(e===1/0)return u?"null":l?"1e400":"1e+400";if(t=""+e,!l||t.length<3)return t;for(i=t.indexOf("."),u||48!==t.charCodeAt(0)||1!==i||(i=0,t=t.slice(1)),r=t,t=t.replace("e+","e"),s=0,(n=r.indexOf("e"))>0&&(s=+r.slice(n+1),r=r.slice(0,n)),i>=0&&(s-=r.length-i-1,r=+(r.slice(0,i)+r.slice(i+1))+""),n=0;48===r.charCodeAt(r.length+n-1);)--n;return 0!==n&&(s-=n,r=r.slice(0,n)),0!==s&&(r+="e"+s),(r.length<t.length||c&&e>1e12&&Math.floor(e)===e&&(r="0x"+e.toString(16)).length<t.length)&&+r===e&&(t=r),t}(e.value):"boolean"==typeof e.value?e.value?"true":"false":function(e){var t,i,r,s,n,a,o,h;if(i=e.toString(),e.source){if(!(t=i.match(/\/([^/]*)$/)))return i;for(r=t[1],i="",o=!1,h=!1,s=0,n=e.source.length;s<n;++s)a=e.source.charCodeAt(s),h?(i+=L(a,h),h=!1):(o?93===a&&(o=!1):47===a?i+="\\":91===a&&(o=!0),i+=L(a,h),h=92===a);return"/"+i+"/"+r}return i}(e.value)},GeneratorExpression:function(e,t,i){return this.ComprehensionExpression(e,t,i)},ComprehensionExpression:function(e,r,s){var n,a,o,h,u=this;return n=e.type===t.GeneratorExpression?["("]:["["],b.moz.comprehensionExpressionStartsWithAssignment&&(h=this.generateExpression(e.body,i.Assignment,7),n.push(h)),e.blocks&&z((function(){for(a=0,o=e.blocks.length;a<o;++a)h=u.generateExpression(e.blocks[a],i.Sequence,7),a>0||b.moz.comprehensionExpressionStartsWithAssignment?n=U(n,h):n.push(h)})),e.filter&&(n=U(n,"if"+g),h=this.generateExpression(e.filter,i.Sequence,7),n=U(n,["(",h,")"])),b.moz.comprehensionExpressionStartsWithAssignment||(h=this.generateExpression(e.body,i.Assignment,7),n=U(n,h)),n.push(e.type===t.GeneratorExpression?")":"]"),n},ComprehensionBlock:function(e,r,s){var n;return n=U(n=e.left.type===t.VariableDeclaration?[e.left.kind,V(),this.generateStatement(e.left.declarations[0],0)]:this.generateExpression(e.left,i.Call,7),e.of?"of":"in"),n=U(n,this.generateExpression(e.right,i.Sequence,7)),["for"+g+"(",n,")"]},SpreadElement:function(e,t,r){return["...",this.generateExpression(e.argument,i.Assignment,7)]},TaggedTemplateExpression:function(e,t,r){var s=3;return 2&r||(s=1),q([this.generateExpression(e.tag,i.Call,s),this.generateExpression(e.quasi,i.Primary,4)],i.TaggedTemplate,t)},TemplateElement:function(e,t,i){return e.value.raw},TemplateLiteral:function(e,t,r){var s,n,a;for(s=["`"],n=0,a=e.quasis.length;n<a;++n)s.push(this.generateExpression(e.quasis[n],i.Primary,7)),n+1<a&&(s.push("${"+g),s.push(this.generateExpression(e.expressions[n],i.Sequence,7)),s.push(g+"}"));return s.push("`"),s},ModuleSpecifier:function(e,t,i){return this.Literal(e,t,i)},ImportExpression:function(e,t,r){return q(["import(",this.generateExpression(e.source,i.Assignment,7),")"],i.Call,t)}},I(X.prototype,X.Expression),X.prototype.generateExpression=function(e,r,s){var n,a;return a=e.type||t.Property,b.verbatim&&e.hasOwnProperty(b.verbatim)?function(e,t){var r;return R("string"==typeof(r=e[b.verbatim])?q(H(r),i.Sequence,t):q(H(r.content),null!=r.precedence?r.precedence:i.Sequence,t),e)}(e,r):(n=this[a](e,r,s),b.comment&&(n=$(e,n)),R(n,e))},X.prototype.generateStatement=function(e,i){var r,s;return r=this[e.type](e,i),b.comment&&(r=$(e,r)),s=R(r).toString(),e.type!==t.Program||x||""!==f||"\n"!==s.charAt(s.length-1)||(r=w?R(r).replaceRight(/\s+$/,""):s.replace(/\s+$/,"")),R(r,e)},E={indent:{style:"",base:0},renumber:!0,hexadecimal:!0,quotes:"auto",escapeless:!0,compact:!0,parentheses:!1,semicolons:!1},A={indent:{style:" ",base:0,adjustMultilineComment:!1},newline:"\n",space:" ",json:!1,renumber:!1,hexadecimal:!1,quotes:"single",escapeless:!1,compact:!1,parentheses:!0,semicolons:!0,safeConcatenation:!1,preserveBlankLines:!1},e.version=Dc,e.generate=function(t,i){var r,n,a={indent:null,base:null,parse:null,comment:!1,format:{indent:{style:" ",base:0,adjustMultilineComment:!1},newline:"\n",space:" ",json:!1,renumber:!1,hexadecimal:!1,quotes:"single",escapeless:!1,compact:!1,parentheses:!0,semicolons:!0,safeConcatenation:!1,preserveBlankLines:!1},moz:{comprehensionExpressionStartsWithAssignment:!1,starlessGenerator:!1},sourceMap:null,sourceMapRoot:null,sourceMapWithCode:!1,directive:!1,raw:!0,verbatim:null,sourceCode:null};return null!=i?("string"==typeof i.indent&&(a.format.indent.style=i.indent),"number"==typeof i.base&&(a.format.indent.base=i.base),i=B(a,i),h=i.format.indent.style,o="string"==typeof i.base?i.base:M(h,i.format.indent.base)):(h=(i=a).format.indent.style,o=M(h,i.format.indent.base)),u=i.format.json,l=i.format.renumber,c=!u&&i.format.hexadecimal,p=u?"double":i.format.quotes,d=i.format.escapeless,f=i.format.newline,g=i.format.space,i.format.compact&&(f=g=h=o=""),m=i.format.parentheses,y=i.format.semicolons,x=i.format.safeConcatenation,v=i.directive,_=u?null:i.parse,w=i.sourceMap,C=i.sourceCode,D=i.format.preserveBlankLines&&null!==C,b=i,w&&(s=e.browser?Nr.sourceMap.SourceNode:Cc().SourceNode),r=Q(t),w?(n=r.toStringWithSourceMap({file:i.file,sourceRoot:i.sourceMapRoot}),i.sourceContent&&n.map.setSourceContent(i.sourceMap,i.sourceContent),i.sourceMapWithCode?n:n.map.toString()):(n={code:r.toString(),map:null},i.sourceMapWithCode?n:n.code)},e.attachComments=n.attachComments,e.Precedence=B({},i),e.browser=!1,e.FORMAT_MINIFY=E,e.FORMAT_DEFAULTS=A}()}(Rl);var Ec=Rr(Rl);function Ac(e,t){let i,r;const s=e.Shader.prototype.modify;function n(e){switch(e){case"+":return"add";case"-":return"sub";case"*":return"mult";case"/":return"div";case"%":return"mod";case"==":case"===":return"equalTo";case">":return"greaterThan";case">=":return"greaterThanEqualTo";case"<":return"lessThan";case"&&":return"and";case"||":return"or"}}function a(e){return"CallExpression"===e.type&&"Identifier"===e.callee?.type&&e.callee?.name.startsWith("uniform")}e.Shader.prototype.modify=function(e,t={parser:!0,srcLocations:!1}){if(e instanceof Function){let h;if(t.parser){const s=function(e,t){return Mu.parse(e,t)}(e.toString(),{ecmaVersion:2021,locations:t.srcLocations});i=o,a=[],(r=void 0)||(r=Nl),function e(t,s,n){var o=n||t.type,h=t!==a[a.length-1];h&&a.push(t),r[o](t,s,e),i[o]&&i[o](t,s||a,a),h&&a.pop()}(s,{varyings:{}},n);const u=Ec.generate(s);h=new Function(u.slice(u.indexOf("{")+1,u.lastIndexOf("}")).replaceAll(";",""))}else h=e;const u=new O(h,this,t.srcLocations).generate();return s.call(this,u)}return s.call(this,e);var i,r,n,a};const o={UnaryExpression(e,t,i){if(i.some(a))return;const r={type:"Literal",value:e.operator},s=e=>{e.type="CallExpression",e.callee={type:"Identifier",name:"unaryNode"},e.arguments=[e.argument,r]};if("MemberExpression"===e.type){const t=e.argument.property.name;let i=[["x","y","z","w"],["r","g","b","a"],["s","t","p","q"]].some((e=>[...t].every((t=>e.includes(t)))))&&"MemberExpression"===e.argument.type;i?(e.type="MemberExpression",e.object={type:"CallExpression",callee:{type:"Identifier",name:"unaryNode"},arguments:[e.argument.object,r]},e.property={type:"Identifier",name:t}):s(e)}else s(e);delete e.argument,delete e.operator},VariableDeclarator(e,t,i){if(e.init.callee&&e.init.callee.name?.startsWith("uniform")){const t={type:"Literal",value:e.id.name};e.init.arguments.unshift(t)}if(e.init.callee&&e.init.callee.name?.startsWith("varying")){const i={type:"Literal",value:e.id.name};e.init.arguments.unshift(i),t.varyings[e.id.name]=i}},Identifier(e,t,i){t.varyings[e.name]&&!i.some((t=>"AssignmentExpression"===t.type&&t.left===e))&&(e.type="ExpressionStatement",e.expression={type:"CallExpression",callee:{type:"MemberExpression",object:{type:"Identifier",name:e.name},property:{type:"Identifier",name:"getValue"}},arguments:[]})},ArrayExpression(e,t,i){const r=JSON.parse(JSON.stringify(e));e.type="CallExpression",e.callee={type:"Identifier",name:"dynamicNode"},e.arguments=[r]},AssignmentExpression(e,t,i){if("="!==e.operator){const t=n(e.operator.replace("=","")),i={type:"CallExpression",callee:{type:"MemberExpression",object:e.left,property:{type:"Identifier",name:t}},arguments:[e.right]};e.operator="=",e.right=i}t.varyings[e.left.name]&&(e.type="ExpressionStatement",e.expression={type:"CallExpression",callee:{type:"MemberExpression",object:{type:"Identifier",name:e.left.name},property:{type:"Identifier",name:"bridge"}},arguments:[e.right]})},BinaryExpression(e,t,i){if(i.some(a))return;if(["Literal","ArrayExpression","Identifier"].includes(e.left.type)){const t={type:"CallExpression",callee:{type:"Identifier",name:"dynamicNode"},arguments:[e.left]};e.left=t}e.type="CallExpression",e.callee={type:"MemberExpression",object:e.left,property:{type:"Identifier",name:n(e.operator)}},e.arguments=[e.right]}};class h{constructor(e,t){if(new.target===h)throw new TypeError("Cannot construct BaseNode instances directly. This is an abstract class.");if(this.type=t,this.componentNames=[],this.componentsChanged=!1,this.isInternal=e,this.usedIn=[],this.dependsOn=[],this.srcLine=null,this.usedInConditional=!1,!0===i.srcLocations&&!1===e)try{throw new Error("StackCapture")}catch(e){const t=e.stack.split("\n");let i=5;T(this)&&i--,this.srcLine=t[i].trim()}}addVectorComponents(){if(this.type.startsWith("vec")){const e=parseInt(this.type.slice(3));this.componentNames=["x","y","z","w"].slice(0,e);const t=this;for(let e of this.componentNames){let i=new f(t,e,"float",!0);Object.defineProperty(this,e,{get:()=>i,set(e){this.componentsChanged=!0,L(this)?this.node.value=e:i=e}})}}}forceTemporaryVariable(){S(this)&&B(this.parent)&&M(this)||(this.useTemp=!0)}assertUsedInConditional(e){this.usedInConditional=!0,this.usedIn.push(e),this.forceTemporaryVariable()}isUsedInConditional(){return this.usedInConditional}checkConditionalDependencies(e){e.ifs.forEach((t=>{const i=()=>t.usedInSatisfied.length>=1,r=()=>t.dependsOn.length===t.dependsOnSatisfied.length;t.insertionPoint>-1||!t.usedIn.length||(t.dependsOn.some((e=>e.node===this))&&!t.dependsOnSatisfied.includes(this)&&t.dependsOnSatisfied.push(this),t.usedIn.includes(this)&&!t.usedInSatisfied.includes(this)&&t.usedInSatisfied.push(this),r()&&i()&&t.saveState(e,r(),i()))}))}toGLSLBase(e){let t;if(this.shouldUseTemporaryVariable()){let i=e.declarations.length;t=this.getTemporaryVariable(e);let r=e.declarations.length-1-i;r=r>0?r:void 0,this.dependsOn.forEach((t=>{if(t.isVector){const i=t.originalComponents.map(((e,i)=>e===t.currentComponents[i]));e.updateComponents(t.node,r,i)}else e.updateComponents(t.node,r)}))}else t=this.toGLSL(e);return this.checkConditionalDependencies(e),t}shouldUseTemporaryVariable(){if(this.componentsChanged||I(this)||this.useTemp)return!0;if(this.isInternal||M(this)||k(this)||"sampler2D"===this.type)return!1;let e=0;return e+=2*(this instanceof p),e+=2*T(this),e+=3*F(this),e+=this.usedIn.length,e>=4}getTemporaryVariable(e){if(!this.temporaryVariable){this.temporaryVariable=`temp_${e.getNextID()}`;let t="";this.srcLine&&(t+=`\n// From ${this.srcLine}\n`),t+=" "+this.type+" "+this.temporaryVariable+" = "+this.toGLSL(e)+";",e.declarations.push(t)}return this.temporaryVariable}add(e){return G(this,this.enforceType(e),"+")}sub(e){return G(this,this.enforceType(e),"-")}mult(e){return G(this,this.enforceType(e),"*")}div(e){return G(this,this.enforceType(e),"/")}mod(e){return G(this,this.enforceType(e),"%")}enforceType(e){if(D(e)){if(!P(e.type))throw new TypeError(`You've tried to perform an operation on a struct of type: ${e.type}. Try accessing a member on that struct with '.'`);if(!P(e.type))throw new TypeError(`You've tried to perform an operation on a struct of type: ${e.type}. Try accessing a member on that struct with '.'`);return(A(this)||F(this))&&E(e)?new l(e):e}return"number"==typeof e?E(this)?new u(e):new l(e):Array.isArray(e)?$.dynamicVector(e):$[this.type](e)}toFloat(){return A(this)?this:E(this)?new l(this):void 0}toGLSL(e){throw new TypeError("Not supposed to call this function on BaseNode, which is an abstract class.")}}class u extends h{constructor(e=0,t=!1){super(t,"int"),this.x=e}toGLSL(e){if(D(this.x)){let t=this.x.toGLSLBase(e);return E(this.x.type)?t:`int(${t})`}return"number"==typeof this.x?`${Math.floor(this.x)}`:`int(${this.x})`}}class l extends h{constructor(e=0,t=!1,i=!1){if(super(t,"float"),Array.isArray(e)&&(e=e[0]),i){const{parent:e,name:t}=i;this.name=t,this.parent=e}this.x=e}toGLSL(e){if(D(this.x)){let t=this.x.toGLSLBase(e);return A(this.x)?t:`float(${t})`}return"number"==typeof this.x?`${this.x.toFixed(4)}`:`float(${this.x})`}}class c extends h{constructor(e,t,i=!1){super(i,t),this.originalValues=R(e,parseInt(t.slice(3))),this.componentNames=["x","y","z","w"].slice(0,this.originalValues.length)}addVectorComponents(){const e=this.originalValues;this.componentsChanged=!1,this.componentNames.forEach(((t,i)=>{const r={name:t,parent:this};let s=S(e[i])?e[i]:new l(e[i],!0,r);Object.defineProperty(this,t,{get:()=>s,set(e){this.componentsChanged=!0,L(this)?this.node.value=e:s=S(e)?e:new l(e,!0,r)}})})),this.originalValues=this.componentNames.map((e=>this[e]))}toGLSL(e){if(this.componentsChanged&&this.defined||this.oldName)return this.temporaryVariable;{let t=this.componentNames.map(((t,i)=>this.originalValues[i].toGLSLBase(e))).join(", ");return this.defined=!0,`${this.type}(${t})`}}}class p extends h{constructor(e,t,i,r=!1){let s;const n=e=>{let i,r=0;const s=t.every(((t,s)=>{const n=C(t);let a=e.args[s];return"genType"===a&&((void 0===i||"float"===i&&n.startsWith("vec"))&&(i=n),a=i),r+=n===a,n===a||"float"===n&&a.startsWith("vec")}));return{...e,valid:s,similarity:r,genType:i}};if(Array.isArray(i)){let r=i.filter((e=>e.args.length===t.length));if(0===r.length){const r=new Set,s=[];i.forEach((e=>r.add(e.args.length))),r.forEach((e=>s.push(`${e}`)));const n=s.join(" or ");throw new Error(`Function '${e}' has ${i.length} variants which expect ${n} arguments, but ${t.length} arguments were provided.`)}const a=function(e,t){return(t=n(t)).valid?((!e||t.similarity>e.similarity)&&(e=t),e):e};s=r.reduce(a,null)}else s=n(i);if(!s||!s.valid){const r=e=>`(${e.map((e=>e)).join(", ")})`,s=Array.isArray(i)?i.map((e=>r(e.args))).join(" or "):r(i.args),n=r(t.map((e=>C(e))));throw new Error(`Function '${e}' was called with wrong arguments. Most likely, you provided mixed lengths vectors as arguments.\nExpected argument types: ${s}\nProvided argument types: ${n}\nAll of the arguments with expected type 'genType' should have a matching type. If one of those is different, try to find where it was created.\n `)}if(t.length!==s.args.length)throw new Error(`Function '${e}' expects ${s.args.length} arguments, but ${t.length} were provided.`);t=t.map(((e,t)=>{if(D(e))A(e)&&"genType"===s.args[t]&&"float"!==s.genType&&(e=$[s.genType](e));else{const i="genType"===s.args[t]?s.genType:s.args[t];e=$[i](e)}return e})),"genType"===s.returnType&&(s.returnType=s.genType),super(r,s.returnType),this.name=e,this.args=t,this.argumentTypes=s.args}deconstructArgs(e){let t=this.args.map(((t,i)=>(E(t)&&"float"!=this.argumentTypes[i]&&(t=t.toFloat()),t.toGLSLBase(e),t.toGLSLBase(e)))).join(", ");return t}toGLSL(e){return`${this.name}(${this.deconstructArgs(e)})`}}class d extends h{constructor(e,t,i=!1){super(i,t),this.name=e}toGLSL(e){return`${this.name}`}}class f extends h{constructor(e,t,i,r=!1){super(r,i),this.parent=e,this.componentName=t,this.type=i}toGLSL(e){let t=this.parent.toGLSLBase(e);return M(this.parent)||I(this.parent)||(t=`(${t})`),`${t}.${this.componentName}`}}class g extends d{constructor(e,t,i=!1){super(e,t,i),this.timesChanged=0,this.tempVars=0}getValue(){const e=i.context;if(!e.varyings[this.name]||!this.timesChanged)return this;let t,r=e.varyings[this.name].splice(0,this.timesChanged);return r.forEach(((i,s)=>{let{value:n}=i;if(e.declarations.push(` ${this.name} = ${n.toGLSLBase(e)};`),s===r.length-1){const i=`${this.name}_${this.tempVars++}`;t=U(new d(i,this.type,!0)),e.declarations.push(` ${this.type} ${i} = ${this.name};`)}})),this.timesChanged=0,t}bridge(e){(!D(e)||this.type.startsWith("vec")&&"float"===C(e))&&(e=$[this.type](e)),i.registerVarying(this,e),this.timesChanged+=1}}class m extends h{constructor(e,t,i,r=!1){super(r,null),this.operator=i,this.left=e,this.right=t;for(const i of[e,t])i.usedIn.push(this);this.type=this.determineType()}determineType(){if(["==",">",">=","<","<=","||","!","&&"].includes(this.operator))return"bool";if(this.left.type===this.right.type)return this.left.type;if(F(this.left)&&A(this.right))return this.left.type;if(F(this.right)&&A(this.left))return this.right.type;if(A(this.left)&&E(this.right)||E(this.left)&&A(this.right))return"float";throw new Error("Incompatible types for binary operator")}processOperand(e,t){if(e.temporaryVariable)return e.temporaryVariable;let i=e.toGLSLBase(t);return T(e)&&!e.temporaryVariable&&(i=`(${i})`),"float"===this.type&&E(e)&&(i=`float(${i})`),i}toGLSL(e){const t=this.processOperand(this.left,e),i=this.processOperand(this.right,e);return`${t} ${this.operator} ${i}`}}class y extends m{constructor(e,t,i){super(e,t,i)}toGLSL(e){return F(this)||A(this)?`mod(${this.left.toGLSLBase(e)}, ${this.right.toGLSLBase(e)})`:`${this.processOperand(e,this.left)} % ${this.processOperand(e,this.right)}`}}class x extends h{constructor(e,t,i=!1){super(i,e.type),this.node=e,this.operator=t}toGLSL(e){let t=this.node.toGLSLBase(e);var i;return M(this.node)||I(this.node)||((i=this.node)instanceof l||i instanceof u||i instanceof c)||(t=`(${t})`),`${this.operator}${t}`}}function v(e){const t=new _;return e(),r=null,t}h.prototype.equalTo=function(e){return G(this,this.enforceType(e),"==")},h.prototype.greaterThan=function(e){return G(this,this.enforceType(e),">")},h.prototype.greaterThanEqualTo=function(e){return G(this,this.enforceType(e),">=")},h.prototype.lessThan=function(e){return G(this,this.enforceType(e),"<")},h.prototype.lessThanEqualTo=function(e){return G(this,this.enforceType(e),"<=")},h.prototype.not=function(){return new x(this.condition,"!",!0)},h.prototype.or=function(e){return new G(this,this.enforceType(e),"||",!0)},h.prototype.and=function(e){return new G(this,this.enforceType(e),"&&",!0)};class b{constructor(e,t){this.dependsOn=[],this.usedIn=[],this.dependsOnSatisfied=[],this.usedInSatisfied=[],this.states=[],this.if(e,t),this.insertionPoint=-1,this.elseIfs=[],this.elseBranch=null,i.context.ifs.push(this)}if(e,t){this.condition=e,this.conditionString=e.toGLSL(i.context),this.ifBranch=v(t),this.ifBranch.parent=this}elseIf(e,t){let i=v(t);return t.parent=this,this.elseIfs.push({condition:e,elseBranch:i}),this}else(e){return this.elseBranch=v(e),this.elseBranch.parent=this,this}thenDiscard(){return new w(this.condition)}saveState(e,t,i){this.states.push({line:e.declarations.length,usedInSatisfied:t,dependsOnSatisfied:i}),this.insertionPoint=e.declarations.length-1}toGLSL(e){const t=e.declarations.length;this.dependsOn.forEach((t=>e.updateComponents(t.node)));const i=e.declarations.length-t;this.insertionPoint+=i;let r=[`\n if (${this.conditionString}) {`,`\n ${this.ifBranch.toGLSL(e)}`,"\n }"];return this.elseIfs.length&&this.elseIfs.forEach((t=>{let{condition:i,elseBranch:s}=t;r.push(` else if (${i.toGLSL(e)}) {`),r.push(`\n ${s.toGLSL(e)}`),r.push("\n }")})),this.elseBranch&&(r.push(" else {"),r.push(`\n ${this.elseBranch.toGLSL(e)}`),r.push("\n }\n")),r.push("\n"),r.flat().join("")}}t.assign=function(e,t){if(!r)throw new error('assign() is supposed to be used inside of conditional branchs. Use the "=" operator as normal otherwise.');r.assign(e,t)};class _{constructor(){r=this,this.statements=[],this.assignments=[],this.dependsOn=[],this.declarations=[];let e=null;Object.defineProperty(this,"parent",{get:()=>e,set(t){t.dependsOn.push(...this.dependsOn),e=t}})}assign(e,t){D(t)&&t.type===e.type?this.assignments.push({node:e,value:t}):(t=$[e.type](t),this.declarations.push(t),this.assignments.push({node:e})),[e=e.parent?e.parent:e,t=t.parent?t.parent:t].some((e=>this.dependsOn.some((t=>t.node===e))))||(e.assertUsedInConditional(this),this.dependsOn.push(N(e)),t.shouldUseTemporaryVariable()&&(t.assertUsedInConditional(this),this.dependsOn.push(N(t))))}toGLSL(e){let t=0;return this.assignments.forEach((({node:i,value:r})=>{let s,n;if(r)n=r.toGLSLBase(e);else{let i=this.declarations[t];t++,i.temporaryVariable=`temp_${e.getNextID()}`,this.statements.push(`${i.type} ${i.temporaryVariable} = ${i.toGLSL(e)};`),n=i.toGLSLBase(e)}M(i)||I(i)?s=`${i.toGLSLBase(e)} = ${n};`:S(i)&&i.name?s=`${i.parent.toGLSLBase(e)}.${i.name} = ${n};`:(i.temporaryVariable=`temp_${e.getNextID()}`,s=`${i.type} ${i.toGLSLBase(e)} = ${n};`),this.statements.push(s)})),this.statements.join("\n ")}}class w{constructor(e){this.condition=e}toGLSL(e){e.discardConditions.push(`if (${this.condition}{discard;})`)}}function C(e){return D(e)?e.type:Array.isArray(e)&&e.length>1?`vec${e.length}`:"number"==typeof e||Array.isArray(e)&&1===e.length?"float":void 0}function D(e){return e instanceof h}function E(e){return D(e)&&"int"===e.type}function A(e){return D(e)&&"float"===e.type}function S(e){return e instanceof l}function F(e){return D(e)&&("vec2"===e.type||"vec3"===e.type||"vec4"===e.type)}function T(e){return e instanceof m}function M(e){return e instanceof d||e instanceof f}function k(e){return e instanceof b||e instanceof _}function I(e){return e.temporaryVariable}function B(e){return e instanceof c}function L(e){return e instanceof x}function P(e){return["int","float","vec2","vec3","vec4","sampler2D"].includes(e)}t.dynamicNode=function(e){return D(e)?e:"number"==typeof e?new l(e):Array.isArray(e)?$.dynamicVector(e):void 0},t.unaryNode=function(e,t){return e=dynamicNode(e),U(new x(e,t))};class O{constructor(e,t,r){i=this,this.userCallback=e,this.srcLocations=r,this.cleanup=()=>{},this.generateHookOverrides(t),this.output={vertexDeclarations:new Set,fragmentDeclarations:new Set,uniforms:{}},this.uniformNodes=[],this.resetGLSLContext(),this.isGenerating=!1}generate(){const t=e.disableFriendlyErrors;return e.disableFriendlyErrors=!0,this.isGenerating=!0,this.userCallback(),this.output.vertexDeclarations=[...this.output.vertexDeclarations].join("\n"),this.output.fragmentDeclarations=[...this.output.fragmentDeclarations].join("\n"),this.isGenerating=!1,this.cleanup(),e.disableFriendlyErrors=t,this.output}generateHookOverrides(e){const t={...e.hooks.vertex,...e.hooks.fragment},r={};Object.keys(t).forEach((t=>{const s=e.hookTypes(t);this[s.name]=function(e){const i=[],r=[];s.parameters.forEach((e=>{if(P(e.type.typeName))i.push(z(e.name,e.type.typeName,!0));else{const t={};e.type.properties.forEach((i=>{t[i.name]=z(`${e.name}.${i.name}`,i.type.typeName,!0)})),i.push(t)}const t=e.type.qualifiers.length>0?e.type.qualifiers.join(" "):"";r.push(`${t} ${e.type.typeName} ${e.name}`.trim())}));let n=e(...i);const a=s.returnType,o={};P(a.typeName)?(D(n)?A(n)&&a.typeName.startsWith("vec")&&(n=$[a.typeName](n)):n=$[a.typeName](n),o.notAProperty=n.toGLSLBase(this.context),this.context.updateComponents(n)):Object.entries(n).forEach((([e,t])=>{t=dynamicNode(t),o[e]=t.toGLSLBase(this.context),this.context.updateComponents(t)})),this.context.ifs.forEach((e=>{if(0===e.usedIn.length)return;const t=e.toGLSL(this.context);this.context.declarations.splice(e.insertionPoint,0,t)}));let h=[`(${r.join(", ")}) {`,...this.context.declarations,`\n ${s.returnType.typeName} finalReturnValue;`];Object.entries(o).forEach((([e,t])=>{const i=a.properties?`.${e}`:"";h.push(` finalReturnValue${i} = ${t};`)})),this.context.declarations=[];for(let e in this.context.varyings){const t=this.context.varyings[e],i=[];t.forEach((e=>{const{node:t,value:r}=e;i.push(` ${t.name} = ${r.toGLSLBase(this.context)};`),i.unshift(...this.context.declarations),t.timesChanged=0})),h.push(...i)}h.push(" return finalReturnValue;","}"),this.output[t]=h.join("\n"),this.resetGLSLContext()},r[s.name]=window[s.name],window[s.name]=function(e){i[s.name](e)}})),this.cleanup=()=>{for(const e in r)window[e]=r[e]}}registerVarying(e,t){Array.isArray(this.context.varyings[e.name])||(this.context.varyings[e.name]=[]),this.context.varyings[e.name].push({node:e,value:t}),this.output.vertexDeclarations.add(`OUT ${e.type} ${e.name};`),this.output.fragmentDeclarations.add(`IN ${e.type} ${e.name};`)}resetGLSLContext(){this.uniformNodes.forEach((e=>{e.usedIn=[],e.temporaryVariable=void 0})),this.context={id:0,getNextID(){return this.id++},declarations:[],varyings:[],ifs:[],updateComponents:function(e,t,i){if(e.componentsChanged){i||(i=e.componentNames.map((()=>!0)));const r=[];if(B(e))e.componentNames.forEach(((t,s)=>{if(i[s]&&e[t]!==e.originalValues[s]){const i=$.float(e[t]),s=` ${e.temporaryVariable}.${t} = ${i.toGLSLBase(this)};`;r.push(s)}}));else{const t=e.componentNames.map((t=>e[t])),i=$[e.type](t),s=` ${e.temporaryVariable} = ${i.toGLSLBase(this)};`;r.push(s)}t?this.declarations.splice(t,0,...r):this.declarations.push(...r),e.componentsChanged=!1}}},this.uniformNodes=[]}}function N(e){return F(e)?{node:e,isVector:!0,originalComponents:[...e.componentNames.map((t=>e[t]))],get currentComponents(){return e.componentNames.map((t=>e[t]))}}:{node:e,isVector:!1}}function R(e,t){return Array.isArray(e)||(e=[e]),1!==(e=(e=e.flat()).map((e=>{if(F(e)){return e.componentNames.map((t=>e[t]))}return e})).flat()).length||B(e[0])||(e=Array(t).fill(e[0])),e}t.If=function(e,t){return new b(e,t)},t.instanceID=function(){return z("gl_InstanceID","int")},t.getTexture=function(...e){return j("getTexture",e,{args:["sampler2D","vec2"],returnType:"vec4",isp5Function:!0})};const V={int:"Int",float:"Float",vec2:"Vector2",vec3:"Vector3",vec4:"Vector4",sampler2D:"Texture"};function U(e,t){if(e.type.startsWith("vec")||t){const t=parseInt(e.type.slice(3));e=new Proxy(e,function(e){const t=[["x","y","z","w"],["r","g","b","a"],["s","t","p","q"]].map((t=>t.slice(0,e)));return{get(e,i,r){if(i in e)return Reflect.get(...arguments);for(const r of t)if([...i].every((e=>r.includes(e)))){if(1===i.length)return e[t[0][r.indexOf(i[0])]];const s=[...i].map((i=>{const s=r.indexOf(i),n=t[0][s];return e[n]})),n=`vec${i.length}`;return $[n](s)}},set(e,i,r,s){for(const n of t){const a=[...i];if(a.every((e=>n.includes(e)))){const o=Array.isArray(r)?r:Array(i.length).fill(r);return a.forEach(((i,r)=>{const a=n.indexOf(i),h=t[0][a];Reflect.set(e,h,o[r],s)})),!0}}return Reflect.set(...arguments)}}}(t)),e.addVectorComponents()}return e}function G(e,t,i,r){let s;return s="%"===i?new y(e,t):new m(e,t,i,r),U(s)}function z(e,t,i){return U(new d(e,t,i))}function j(e,t,i,r){let s=new p(e,t,i,r);s=U(s),s.dependsOn=s.args.map((e=>N(e)));const n=s.args.map((e=>{const t=e.usedIn.filter((e=>k(e))).map((e=>e instanceof _?e.parent:e));return t})).flat();return n.forEach((e=>e.usedIn.push(s))),s}const $={int:e=>new u(e),float:e=>new l(e),vec2:e=>U(new c(e,"vec2")),vec3:e=>U(new c(e,"vec3")),vec4:e=>U(new c(e,"vec4")),dynamicVector:function(e){return this[`vec${function(e){let t=0;if(Array.isArray(e))for(let i of e)F(i)?t+=parseInt(i.type.slice(3)):t+=1;else F(e)&&(t+=parseInt(val.type.slice(3)));if(![2,3,4].includes(t))throw new Error(`You have attempted to construct a vector with ${t} values. Only vec2, vec3, and vec4 types are supported.`);return t}(e)}`](e)}};for(const r in V){const s=V[r],n=`uniform${s}`;if(O.prototype[n]=function(...e){let[t,...i]=e;!r.startsWith("vec")||i[0]instanceof Function?this.output.uniforms[`${r} ${t}`]=i[0]:(i=R(i,parseInt(r.slice(3))),this.output.uniforms[`${r} ${t}`]=i);const s=z(t,r,!1);return this.uniformNodes.push(s),s},t[n]=function(...e){return i[n](...e)},"sampler2D"===r)continue;const a=`varying${s}`;O.prototype[a]=function(e){return U(new g(e,r,!1))},t[a]=function(e){return i[a](e)};const o=t[r];t[r]=function(...t){return i?.isGenerating?(t=r.startsWith("vec")?R(t,parseInt(r.slice(3))):t[0],$[r](t)):o?o.apply(this,t):void e._friendlyError(`It looks like you've called ${r} outside of a shader's modify() function.`)}}Object.entries({acos:{args:["genType"],returnType:"genType",isp5Function:!0},acosh:{args:["genType"],returnType:"genType",isp5Function:!1},asin:{args:["genType"],returnType:"genType",isp5Function:!0},asinh:{args:["genType"],returnType:"genType",isp5Function:!1},atan:[{args:["genType"],returnType:"genType",isp5Function:!1},{args:["genType","genType"],returnType:"genType",isp5Function:!1}],atanh:{args:["genType"],returnType:"genType",isp5Function:!1},cos:{args:["genType"],returnType:"genType",isp5Function:!0},cosh:{args:["genType"],returnType:"genType",isp5Function:!1},degrees:{args:["genType"],returnType:"genType",isp5Function:!0},radians:{args:["genType"],returnType:"genType",isp5Function:!0},sin:{args:["genType"],returnType:"genType",isp5Function:!0},sinh:{args:["genType"],returnType:"genType",isp5Function:!1},tan:{args:["genType"],returnType:"genType",isp5Function:!0},tanh:{args:["genType"],returnType:"genType",isp5Function:!1},abs:{args:["genType"],returnType:"genType",isp5Function:!0},ceil:{args:["genType"],returnType:"genType",isp5Function:!0},clamp:{args:["genType","genType","genType"],returnType:"genType",isp5Function:!1},dFdx:{args:["genType"],returnType:"genType",isp5Function:!1},dFdy:{args:["genType"],returnType:"genType",isp5Function:!1},exp:{args:["genType"],returnType:"genType",isp5Function:!0},exp2:{args:["genType"],returnType:"genType",isp5Function:!1},floor:{args:["genType"],returnType:"genType",isp5Function:!0},fma:{args:["genType","genType","genType"],returnType:"genType",isp5Function:!1},fract:{args:["genType"],returnType:"genType",isp5Function:!0},fwidth:{args:["genType"],returnType:"genType",isp5Function:!1},inversesqrt:{args:["genType"],returnType:"genType",isp5Function:!0},log:{args:["genType"],returnType:"genType",isp5Function:!0},log2:{args:["genType"],returnType:"genType",isp5Function:!1},max:[{args:["genType","genType"],returnType:"genType",isp5Function:!0},{args:["genType","float"],returnType:"genType",isp5Function:!0}],min:[{args:["genType","genType"],returnType:"genType",isp5Function:!0},{args:["genType","float"],returnType:"genType",isp5Function:!0}],mix:[{args:["genType","genType","genType"],returnType:"genType",isp5Function:!1},{args:["genType","genType","float"],returnType:"genType",isp5Function:!1}],pow:{args:["genType","genType"],returnType:"genType",isp5Function:!0},round:{args:["genType"],returnType:"genType",isp5Function:!0},roundEven:{args:["genType"],returnType:"genType",isp5Function:!1},smoothstep:[{args:["genType","genType","genType"],returnType:"genType",isp5Function:!1},{args:["float","float","genType"],returnType:"genType",isp5Function:!1}],sqrt:{args:["genType"],returnType:"genType",isp5Function:!0},step:{args:["genType","genType"],returnType:"genType",isp5Function:!1},trunc:{args:["genType"],returnType:"genType",isp5Function:!1},cross:{args:["vec3","vec3"],returnType:"vec3",isp5Function:!0},distance:{args:["genType","genType"],returnType:"float",isp5Function:!0},dot:{args:["genType","genType"],returnType:"float",isp5Function:!0},faceforward:{args:["genType","genType","genType"],returnType:"genType",isp5Function:!1},length:{args:["genType"],returnType:"float",isp5Function:!1},normalize:{args:["genType"],returnType:"genType",isp5Function:!0},reflect:{args:["genType","genType"],returnType:"genType",isp5Function:!1},refract:{args:["genType","genType","float"],returnType:"genType",isp5Function:!1},texture:{args:["sampler2D","vec2"],returnType:"vec4",isp5Function:!0}}).forEach((([r,s])=>{if(Array.isArray(s)?s[0].isp5Function:s.isp5Function){const e=t[r];t[r]=function(...t){return i?.isGenerating?j(r,t,s):e.apply(this,t)}}else t[r]=function(...t){if(i?.isGenerating)return new j(r,t,s);e._friendlyError(`It looks like you've called ${r} outside of a shader's modify() function.`)}}))}function Sc(e){return Sc="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Sc(e)}function Fc(e){var t=function(e,t){if("object"!=Sc(e)||!e)return e;var i=e[Symbol.toPrimitive];if(void 0!==i){var r=i.call(e,t);if("object"!=Sc(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e,"string");return"symbol"==Sc(t)?t:t+""}function Tc(e,t,i){return(t=Fc(t))in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function Mc(e){for(var t=1;t<arguments.length;t++){var i=null!=arguments[t]?Object(arguments[t]):{},r=Object.keys(i);"function"==typeof Object.getOwnPropertySymbols&&r.push.apply(r,Object.getOwnPropertySymbols(i).filter((function(e){return Object.getOwnPropertyDescriptor(i,e).enumerable}))),r.forEach((function(t){Tc(e,t,i[t])}))}return e}function kc(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Ic(e,t){for(var i=0;i<t.length;i++){var r=t[i];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,Fc(r.key),r)}}function Bc(e,t,i){return t&&Ic(e.prototype,t),i&&Ic(e,i),Object.defineProperty(e,"prototype",{writable:!1}),e}function Lc(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Pc(e,t){if(t&&("object"==Sc(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return Lc(e)}function Oc(e){return Oc=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},Oc(e)}function Nc(e,t){return Nc=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},Nc(e,t)}function Rc(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&Nc(e,t)}void 0!==p5&&p5.registerAddon(Ac);var Vc={type:"logger",log:function(e){this.output("log",e)},warn:function(e){this.output("warn",e)},error:function(e){this.output("error",e)},output:function(e,t){console&&console[e]&&console[e].apply(console,t)}},Uc=function(){function e(t){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};kc(this,e),this.init(t,i)}return Bc(e,[{key:"init",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.prefix=t.prefix||"i18next:",this.logger=e||Vc,this.options=t,this.debug=t.debug}},{key:"setDebug",value:function(e){this.debug=e}},{key:"log",value:function(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];return this.forward(t,"log","",!0)}},{key:"warn",value:function(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];return this.forward(t,"warn","",!0)}},{key:"error",value:function(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];return this.forward(t,"error","")}},{key:"deprecate",value:function(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];return this.forward(t,"warn","WARNING DEPRECATED: ",!0)}},{key:"forward",value:function(e,t,i,r){return r&&!this.debug?null:("string"==typeof e[0]&&(e[0]="".concat(i).concat(this.prefix," ").concat(e[0])),this.logger[t](e))}},{key:"create",value:function(t){return new e(this.logger,Mc({},{prefix:"".concat(this.prefix,":").concat(t,":")},this.options))}}]),e}(),Gc=new Uc,zc=function(){function e(){kc(this,e),this.observers={}}return Bc(e,[{key:"on",value:function(e,t){var i=this;return e.split(" ").forEach((function(e){i.observers[e]=i.observers[e]||[],i.observers[e].push(t)})),this}},{key:"off",value:function(e,t){this.observers[e]&&(t?this.observers[e]=this.observers[e].filter((function(e){return e!==t})):delete this.observers[e])}},{key:"emit",value:function(e){for(var t=arguments.length,i=new Array(t>1?t-1:0),r=1;r<t;r++)i[r-1]=arguments[r];this.observers[e]&&[].concat(this.observers[e]).forEach((function(e){e.apply(void 0,i)}));this.observers["*"]&&[].concat(this.observers["*"]).forEach((function(t){t.apply(t,[e].concat(i))}))}}]),e}();function jc(){var e,t,i=new Promise((function(i,r){e=i,t=r}));return i.resolve=e,i.reject=t,i}function $c(e){return null==e?"":""+e}function Wc(e,t,i){function r(e){return e&&e.indexOf("###")>-1?e.replace(/###/g,"."):e}function s(){return!e||"string"==typeof e}for(var n="string"!=typeof t?[].concat(t):t.split(".");n.length>1;){if(s())return{};var a=r(n.shift());!e[a]&&i&&(e[a]=new i),e=Object.prototype.hasOwnProperty.call(e,a)?e[a]:{}}return s()?{}:{obj:e,k:r(n.shift())}}function qc(e,t,i){var r=Wc(e,t,Object);r.obj[r.k]=i}function Hc(e,t){var i=Wc(e,t),r=i.obj,s=i.k;if(r)return r[s]}function Xc(e,t,i){var r=Hc(e,i);return void 0!==r?r:Hc(t,i)}function Yc(e,t,i){for(var r in t)"__proto__"!==r&&"constructor"!==r&&(r in e?"string"==typeof e[r]||e[r]instanceof String||"string"==typeof t[r]||t[r]instanceof String?i&&(e[r]=t[r]):Yc(e[r],t[r],i):e[r]=t[r]);return e}function Zc(e){return e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")}var Kc={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;","/":"&#x2F;"};function Jc(e){return"string"==typeof e?e.replace(/[&<>"'\/]/g,(function(e){return Kc[e]})):e}var Qc="undefined"!=typeof window&&window.navigator&&window.navigator.userAgent&&window.navigator.userAgent.indexOf("MSIE")>-1,ep=function(e){function t(e){var i,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{ns:["translation"],defaultNS:"translation"};return kc(this,t),i=Pc(this,Oc(t).call(this)),Qc&&zc.call(Lc(i)),i.data=e||{},i.options=r,void 0===i.options.keySeparator&&(i.options.keySeparator="."),i}return Rc(t,e),Bc(t,[{key:"addNamespaces",value:function(e){this.options.ns.indexOf(e)<0&&this.options.ns.push(e)}},{key:"removeNamespaces",value:function(e){var t=this.options.ns.indexOf(e);t>-1&&this.options.ns.splice(t,1)}},{key:"getResource",value:function(e,t,i){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},s=void 0!==r.keySeparator?r.keySeparator:this.options.keySeparator,n=[e,t];return i&&"string"!=typeof i&&(n=n.concat(i)),i&&"string"==typeof i&&(n=n.concat(s?i.split(s):i)),e.indexOf(".")>-1&&(n=e.split(".")),Hc(this.data,n)}},{key:"addResource",value:function(e,t,i,r){var s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{silent:!1},n=this.options.keySeparator;void 0===n&&(n=".");var a=[e,t];i&&(a=a.concat(n?i.split(n):i)),e.indexOf(".")>-1&&(r=t,t=(a=e.split("."))[1]),this.addNamespaces(t),qc(this.data,a,r),s.silent||this.emit("added",e,t,i,r)}},{key:"addResources",value:function(e,t,i){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{silent:!1};for(var s in i)"string"!=typeof i[s]&&"[object Array]"!==Object.prototype.toString.apply(i[s])||this.addResource(e,t,s,i[s],{silent:!0});r.silent||this.emit("added",e,t,i)}},{key:"addResourceBundle",value:function(e,t,i,r,s){var n=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{silent:!1},a=[e,t];e.indexOf(".")>-1&&(r=i,i=t,t=(a=e.split("."))[1]),this.addNamespaces(t);var o=Hc(this.data,a)||{};r?Yc(o,i,s):o=Mc({},o,i),qc(this.data,a,o),n.silent||this.emit("added",e,t,i)}},{key:"removeResourceBundle",value:function(e,t){this.hasResourceBundle(e,t)&&delete this.data[e][t],this.removeNamespaces(t),this.emit("removed",e,t)}},{key:"hasResourceBundle",value:function(e,t){return void 0!==this.getResource(e,t)}},{key:"getResourceBundle",value:function(e,t){return t||(t=this.options.defaultNS),"v1"===this.options.compatibilityAPI?Mc({},{},this.getResource(e,t)):this.getResource(e,t)}},{key:"getDataByLanguage",value:function(e){return this.data[e]}},{key:"toJSON",value:function(){return this.data}}]),t}(zc),tp={processors:{},addPostProcessor:function(e){this.processors[e.name]=e},handle:function(e,t,i,r,s){var n=this;return e.forEach((function(e){n.processors[e]&&(t=n.processors[e].process(t,i,r,s))})),t}},ip={},rp=function(e){function t(e){var i,r,s,n,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return kc(this,t),i=Pc(this,Oc(t).call(this)),Qc&&zc.call(Lc(i)),r=["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"],s=e,n=Lc(i),r.forEach((function(e){s[e]&&(n[e]=s[e])})),i.options=a,void 0===i.options.keySeparator&&(i.options.keySeparator="."),i.logger=Gc.create("translator"),i}return Rc(t,e),Bc(t,[{key:"changeLanguage",value:function(e){e&&(this.language=e)}},{key:"exists",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{interpolation:{}},i=this.resolve(e,t);return i&&void 0!==i.res}},{key:"extractFromKey",value:function(e,t){var i=void 0!==t.nsSeparator?t.nsSeparator:this.options.nsSeparator;void 0===i&&(i=":");var r=void 0!==t.keySeparator?t.keySeparator:this.options.keySeparator,s=t.ns||this.options.defaultNS;if(i&&e.indexOf(i)>-1){var n=e.match(this.interpolator.nestingRegexp);if(n&&n.length>0)return{key:e,namespaces:s};var a=e.split(i);(i!==r||i===r&&this.options.ns.indexOf(a[0])>-1)&&(s=a.shift()),e=a.join(r)}return"string"==typeof s&&(s=[s]),{key:e,namespaces:s}}},{key:"translate",value:function(e,i,r){var s=this;if("object"!==Sc(i)&&this.options.overloadTranslationOptionHandler&&(i=this.options.overloadTranslationOptionHandler(arguments)),i||(i={}),null==e)return"";Array.isArray(e)||(e=[String(e)]);var n=void 0!==i.keySeparator?i.keySeparator:this.options.keySeparator,a=this.extractFromKey(e[e.length-1],i),o=a.key,h=a.namespaces,u=h[h.length-1],l=i.lng||this.language,c=i.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if(l&&"cimode"===l.toLowerCase()){if(c){var p=i.nsSeparator||this.options.nsSeparator;return u+p+o}return o}var d=this.resolve(e,i),f=d&&d.res,g=d&&d.usedKey||o,m=d&&d.exactUsedKey||o,y=Object.prototype.toString.apply(f),x=void 0!==i.joinArrays?i.joinArrays:this.options.joinArrays,v=!this.i18nFormat||this.i18nFormat.handleAsObject;if(v&&f&&("string"!=typeof f&&"boolean"!=typeof f&&"number"!=typeof f)&&["[object Number]","[object Function]","[object RegExp]"].indexOf(y)<0&&("string"!=typeof x||"[object Array]"!==y)){if(!i.returnObjects&&!this.options.returnObjects)return this.logger.warn("accessing an object - but returnObjects options is not enabled!"),this.options.returnedObjectHandler?this.options.returnedObjectHandler(g,f,i):"key '".concat(o," (").concat(this.language,")' returned an object instead of string.");if(n){var b="[object Array]"===y,_=b?[]:{},w=b?m:g;for(var C in f)if(Object.prototype.hasOwnProperty.call(f,C)){var D="".concat(w).concat(n).concat(C);_[C]=this.translate(D,Mc({},i,{joinArrays:!1,ns:h})),_[C]===D&&(_[C]=f[C])}f=_}}else if(v&&"string"==typeof x&&"[object Array]"===y)(f=f.join(x))&&(f=this.extendTranslation(f,e,i,r));else{var E=!1,A=!1,S=void 0!==i.count&&"string"!=typeof i.count,F=t.hasDefaultValue(i),T=S?this.pluralResolver.getSuffix(l,i.count):"",M=i["defaultValue".concat(T)]||i.defaultValue;!this.isValidLookup(f)&&F&&(E=!0,f=M),this.isValidLookup(f)||(A=!0,f=o);var k=F&&M!==f&&this.options.updateMissing;if(A||E||k){if(this.logger.log(k?"updateKey":"missingKey",l,u,o,k?M:f),n){var I=this.resolve(o,Mc({},i,{keySeparator:!1}));I&&I.res&&this.logger.warn("Seems the loaded translations were in flat JSON format instead of nested. Either set keySeparator: false on init or make sure your translations are published in nested format.")}var B=[],L=this.languageUtils.getFallbackCodes(this.options.fallbackLng,i.lng||this.language);if("fallback"===this.options.saveMissingTo&&L&&L[0])for(var P=0;P<L.length;P++)B.push(L[P]);else"all"===this.options.saveMissingTo?B=this.languageUtils.toResolveHierarchy(i.lng||this.language):B.push(i.lng||this.language);var O=function(e,t,r){s.options.missingKeyHandler?s.options.missingKeyHandler(e,u,t,k?r:f,k,i):s.backendConnector&&s.backendConnector.saveMissing&&s.backendConnector.saveMissing(e,u,t,k?r:f,k,i),s.emit("missingKey",e,u,t,f)};this.options.saveMissing&&(this.options.saveMissingPlurals&&S?B.forEach((function(e){s.pluralResolver.getSuffixes(e).forEach((function(t){O([e],o+t,i["defaultValue".concat(t)]||M)}))})):O(B,o,M))}f=this.extendTranslation(f,e,i,d,r),A&&f===o&&this.options.appendNamespaceToMissingKey&&(f="".concat(u,":").concat(o)),A&&this.options.parseMissingKeyHandler&&(f=this.options.parseMissingKeyHandler(f))}return f}},{key:"extendTranslation",value:function(e,t,i,r,s){var n=this;if(this.i18nFormat&&this.i18nFormat.parse)e=this.i18nFormat.parse(e,i,r.usedLng,r.usedNS,r.usedKey,{resolved:r});else if(!i.skipInterpolation){i.interpolation&&this.interpolator.init(Mc({},i,{interpolation:Mc({},this.options.interpolation,i.interpolation)}));var a,o=i.interpolation&&i.interpolation.skipOnVariables||this.options.interpolation.skipOnVariables;if(o){var h=e.match(this.interpolator.nestingRegexp);a=h&&h.length}var u=i.replace&&"string"!=typeof i.replace?i.replace:i;if(this.options.interpolation.defaultVariables&&(u=Mc({},this.options.interpolation.defaultVariables,u)),e=this.interpolator.interpolate(e,u,i.lng||this.language,i),o){var l=e.match(this.interpolator.nestingRegexp);a<(l&&l.length)&&(i.nest=!1)}!1!==i.nest&&(e=this.interpolator.nest(e,(function(){for(var e=arguments.length,r=new Array(e),a=0;a<e;a++)r[a]=arguments[a];return s&&s[0]===r[0]&&!i.context?(n.logger.warn("It seems you are nesting recursively key: ".concat(r[0]," in key: ").concat(t[0])),null):n.translate.apply(n,r.concat([t]))}),i)),i.interpolation&&this.interpolator.reset()}var c=i.postProcess||this.options.postProcess,p="string"==typeof c?[c]:c;return null!=e&&p&&p.length&&!1!==i.applyPostProcessor&&(e=tp.handle(p,e,t,this.options&&this.options.postProcessPassResolved?Mc({i18nResolved:r},i):i,this)),e}},{key:"resolve",value:function(e){var t,i,r,s,n,a=this,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return"string"==typeof e&&(e=[e]),e.forEach((function(e){if(!a.isValidLookup(t)){var h=a.extractFromKey(e,o),u=h.key;i=u;var l=h.namespaces;a.options.fallbackNS&&(l=l.concat(a.options.fallbackNS));var c=void 0!==o.count&&"string"!=typeof o.count,p=void 0!==o.context&&"string"==typeof o.context&&""!==o.context,d=o.lngs?o.lngs:a.languageUtils.toResolveHierarchy(o.lng||a.language,o.fallbackLng);l.forEach((function(e){a.isValidLookup(t)||(n=e,!ip["".concat(d[0],"-").concat(e)]&&a.utils&&a.utils.hasLoadedNamespace&&!a.utils.hasLoadedNamespace(n)&&(ip["".concat(d[0],"-").concat(e)]=!0,a.logger.warn('key "'.concat(i,'" for languages "').concat(d.join(", "),'" won\'t get resolved as namespace "').concat(n,'" was not yet loaded'),"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!")),d.forEach((function(i){if(!a.isValidLookup(t)){s=i;var n,h,l=u,d=[l];if(a.i18nFormat&&a.i18nFormat.addLookupKeys)a.i18nFormat.addLookupKeys(d,u,i,e,o);else c&&(n=a.pluralResolver.getSuffix(i,o.count)),c&&p&&d.push(l+n),p&&d.push(l+="".concat(a.options.contextSeparator).concat(o.context)),c&&d.push(l+=n);for(;h=d.pop();)a.isValidLookup(t)||(r=h,t=a.getResource(i,e,h,o))}})))}))}})),{res:t,usedKey:i,exactUsedKey:r,usedLng:s,usedNS:n}}},{key:"isValidLookup",value:function(e){return!(void 0===e||!this.options.returnNull&&null===e||!this.options.returnEmptyString&&""===e)}},{key:"getResource",value:function(e,t,i){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return this.i18nFormat&&this.i18nFormat.getResource?this.i18nFormat.getResource(e,t,i,r):this.resourceStore.getResource(e,t,i,r)}}],[{key:"hasDefaultValue",value:function(e){var t="defaultValue";for(var i in e)if(Object.prototype.hasOwnProperty.call(e,i)&&t===i.substring(0,12)&&void 0!==e[i])return!0;return!1}}]),t}(zc);function sp(e){return e.charAt(0).toUpperCase()+e.slice(1)}var np=function(){function e(t){kc(this,e),this.options=t,this.whitelist=this.options.supportedLngs||!1,this.supportedLngs=this.options.supportedLngs||!1,this.logger=Gc.create("languageUtils")}return Bc(e,[{key:"getScriptPartFromCode",value:function(e){if(!e||e.indexOf("-")<0)return null;var t=e.split("-");return 2===t.length?null:(t.pop(),"x"===t[t.length-1].toLowerCase()?null:this.formatLanguageCode(t.join("-")))}},{key:"getLanguagePartFromCode",value:function(e){if(!e||e.indexOf("-")<0)return e;var t=e.split("-");return this.formatLanguageCode(t[0])}},{key:"formatLanguageCode",value:function(e){if("string"==typeof e&&e.indexOf("-")>-1){var t=["hans","hant","latn","cyrl","cans","mong","arab"],i=e.split("-");return this.options.lowerCaseLng?i=i.map((function(e){return e.toLowerCase()})):2===i.length?(i[0]=i[0].toLowerCase(),i[1]=i[1].toUpperCase(),t.indexOf(i[1].toLowerCase())>-1&&(i[1]=sp(i[1].toLowerCase()))):3===i.length&&(i[0]=i[0].toLowerCase(),2===i[1].length&&(i[1]=i[1].toUpperCase()),"sgn"!==i[0]&&2===i[2].length&&(i[2]=i[2].toUpperCase()),t.indexOf(i[1].toLowerCase())>-1&&(i[1]=sp(i[1].toLowerCase())),t.indexOf(i[2].toLowerCase())>-1&&(i[2]=sp(i[2].toLowerCase()))),i.join("-")}return this.options.cleanCode||this.options.lowerCaseLng?e.toLowerCase():e}},{key:"isWhitelisted",value:function(e){return this.logger.deprecate("languageUtils.isWhitelisted",'function "isWhitelisted" will be renamed to "isSupportedCode" in the next major - please make sure to rename it\'s usage asap.'),this.isSupportedCode(e)}},{key:"isSupportedCode",value:function(e){return("languageOnly"===this.options.load||this.options.nonExplicitSupportedLngs)&&(e=this.getLanguagePartFromCode(e)),!this.supportedLngs||!this.supportedLngs.length||this.supportedLngs.indexOf(e)>-1}},{key:"getBestMatchFromCodes",value:function(e){var t,i=this;return e?(e.forEach((function(e){if(!t){var r=i.formatLanguageCode(e);i.options.supportedLngs&&!i.isSupportedCode(r)||(t=r)}})),!t&&this.options.supportedLngs&&e.forEach((function(e){if(!t){var r=i.getLanguagePartFromCode(e);if(i.isSupportedCode(r))return t=r;t=i.options.supportedLngs.find((function(e){if(0===e.indexOf(r))return e}))}})),t||(t=this.getFallbackCodes(this.options.fallbackLng)[0]),t):null}},{key:"getFallbackCodes",value:function(e,t){if(!e)return[];if("function"==typeof e&&(e=e(t)),"string"==typeof e&&(e=[e]),"[object Array]"===Object.prototype.toString.apply(e))return e;if(!t)return e.default||[];var i=e[t];return i||(i=e[this.getScriptPartFromCode(t)]),i||(i=e[this.formatLanguageCode(t)]),i||(i=e[this.getLanguagePartFromCode(t)]),i||(i=e.default),i||[]}},{key:"toResolveHierarchy",value:function(e,t){var i=this,r=this.getFallbackCodes(t||this.options.fallbackLng||[],e),s=[],n=function(e){e&&(i.isSupportedCode(e)?s.push(e):i.logger.warn("rejecting language code not found in supportedLngs: ".concat(e)))};return"string"==typeof e&&e.indexOf("-")>-1?("languageOnly"!==this.options.load&&n(this.formatLanguageCode(e)),"languageOnly"!==this.options.load&&"currentOnly"!==this.options.load&&n(this.getScriptPartFromCode(e)),"currentOnly"!==this.options.load&&n(this.getLanguagePartFromCode(e))):"string"==typeof e&&n(this.formatLanguageCode(e)),r.forEach((function(e){s.indexOf(e)<0&&n(i.formatLanguageCode(e))})),s}}]),e}(),ap=[{lngs:["ach","ak","am","arn","br","fil","gun","ln","mfe","mg","mi","oc","pt","pt-BR","tg","tl","ti","tr","uz","wa"],nr:[1,2],fc:1},{lngs:["af","an","ast","az","bg","bn","ca","da","de","dev","el","en","eo","es","et","eu","fi","fo","fur","fy","gl","gu","ha","hi","hu","hy","ia","it","kn","ku","lb","mai","ml","mn","mr","nah","nap","nb","ne","nl","nn","no","nso","pa","pap","pms","ps","pt-PT","rm","sco","se","si","so","son","sq","sv","sw","ta","te","tk","ur","yo"],nr:[1,2],fc:2},{lngs:["ay","bo","cgg","fa","ht","id","ja","jbo","ka","kk","km","ko","ky","lo","ms","sah","su","th","tt","ug","vi","wo","zh"],nr:[1],fc:3},{lngs:["be","bs","cnr","dz","hr","ru","sr","uk"],nr:[1,2,5],fc:4},{lngs:["ar"],nr:[0,1,2,3,11,100],fc:5},{lngs:["cs","sk"],nr:[1,2,5],fc:6},{lngs:["csb","pl"],nr:[1,2,5],fc:7},{lngs:["cy"],nr:[1,2,3,8],fc:8},{lngs:["fr"],nr:[1,2],fc:9},{lngs:["ga"],nr:[1,2,3,7,11],fc:10},{lngs:["gd"],nr:[1,2,3,20],fc:11},{lngs:["is"],nr:[1,2],fc:12},{lngs:["jv"],nr:[0,1],fc:13},{lngs:["kw"],nr:[1,2,3,4],fc:14},{lngs:["lt"],nr:[1,2,10],fc:15},{lngs:["lv"],nr:[1,2,0],fc:16},{lngs:["mk"],nr:[1,2],fc:17},{lngs:["mnk"],nr:[0,1,2],fc:18},{lngs:["mt"],nr:[1,2,11,20],fc:19},{lngs:["or"],nr:[2,1],fc:2},{lngs:["ro"],nr:[1,2,20],fc:20},{lngs:["sl"],nr:[5,1,2,3],fc:21},{lngs:["he","iw"],nr:[1,2,20,21],fc:22}],op={1:function(e){return Number(e>1)},2:function(e){return Number(1!=e)},3:function(e){return 0},4:function(e){return Number(e%10==1&&e%100!=11?0:e%10>=2&&e%10<=4&&(e%100<10||e%100>=20)?1:2)},5:function(e){return Number(0==e?0:1==e?1:2==e?2:e%100>=3&&e%100<=10?3:e%100>=11?4:5)},6:function(e){return Number(1==e?0:e>=2&&e<=4?1:2)},7:function(e){return Number(1==e?0:e%10>=2&&e%10<=4&&(e%100<10||e%100>=20)?1:2)},8:function(e){return Number(1==e?0:2==e?1:8!=e&&11!=e?2:3)},9:function(e){return Number(e>=2)},10:function(e){return Number(1==e?0:2==e?1:e<7?2:e<11?3:4)},11:function(e){return Number(1==e||11==e?0:2==e||12==e?1:e>2&&e<20?2:3)},12:function(e){return Number(e%10!=1||e%100==11)},13:function(e){return Number(0!==e)},14:function(e){return Number(1==e?0:2==e?1:3==e?2:3)},15:function(e){return Number(e%10==1&&e%100!=11?0:e%10>=2&&(e%100<10||e%100>=20)?1:2)},16:function(e){return Number(e%10==1&&e%100!=11?0:0!==e?1:2)},17:function(e){return Number(1==e||e%10==1&&e%100!=11?0:1)},18:function(e){return Number(0==e?0:1==e?1:2)},19:function(e){return Number(1==e?0:0==e||e%100>1&&e%100<11?1:e%100>10&&e%100<20?2:3)},20:function(e){return Number(1==e?0:0==e||e%100>0&&e%100<20?1:2)},21:function(e){return Number(e%100==1?1:e%100==2?2:e%100==3||e%100==4?3:0)},22:function(e){return Number(1==e?0:2==e?1:(e<0||e>10)&&e%10==0?2:3)}};var hp=function(){function e(t){var i,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};kc(this,e),this.languageUtils=t,this.options=r,this.logger=Gc.create("pluralResolver"),this.rules=(i={},ap.forEach((function(e){e.lngs.forEach((function(t){i[t]={numbers:e.nr,plurals:op[e.fc]}}))})),i)}return Bc(e,[{key:"addRule",value:function(e,t){this.rules[e]=t}},{key:"getRule",value:function(e){return this.rules[e]||this.rules[this.languageUtils.getLanguagePartFromCode(e)]}},{key:"needsPlural",value:function(e){var t=this.getRule(e);return t&&t.numbers.length>1}},{key:"getPluralFormsOfKey",value:function(e,t){return this.getSuffixes(e).map((function(e){return t+e}))}},{key:"getSuffixes",value:function(e){var t=this,i=this.getRule(e);return i?i.numbers.map((function(i){return t.getSuffix(e,i)})):[]}},{key:"getSuffix",value:function(e,t){var i=this,r=this.getRule(e);if(r){var s=r.noAbs?r.plurals(t):r.plurals(Math.abs(t)),n=r.numbers[s];this.options.simplifyPluralSuffix&&2===r.numbers.length&&1===r.numbers[0]&&(2===n?n="plural":1===n&&(n=""));var a=function(){return i.options.prepend&&n.toString()?i.options.prepend+n.toString():n.toString()};return"v1"===this.options.compatibilityJSON?1===n?"":"number"==typeof n?"_plural_".concat(n.toString()):a():"v2"===this.options.compatibilityJSON||this.options.simplifyPluralSuffix&&2===r.numbers.length&&1===r.numbers[0]?a():this.options.prepend&&s.toString()?this.options.prepend+s.toString():s.toString()}return this.logger.warn("no plural rule found for: ".concat(e)),""}}]),e}(),up=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};kc(this,e),this.logger=Gc.create("interpolator"),this.options=t,this.format=t.interpolation&&t.interpolation.format||function(e){return e},this.init(t)}return Bc(e,[{key:"init",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};e.interpolation||(e.interpolation={escapeValue:!0});var t=e.interpolation;this.escape=void 0!==t.escape?t.escape:Jc,this.escapeValue=void 0===t.escapeValue||t.escapeValue,this.useRawValueToEscape=void 0!==t.useRawValueToEscape&&t.useRawValueToEscape,this.prefix=t.prefix?Zc(t.prefix):t.prefixEscaped||"{{",this.suffix=t.suffix?Zc(t.suffix):t.suffixEscaped||"}}",this.formatSeparator=t.formatSeparator?t.formatSeparator:t.formatSeparator||",",this.unescapePrefix=t.unescapeSuffix?"":t.unescapePrefix||"-",this.unescapeSuffix=this.unescapePrefix?"":t.unescapeSuffix||"",this.nestingPrefix=t.nestingPrefix?Zc(t.nestingPrefix):t.nestingPrefixEscaped||Zc("$t("),this.nestingSuffix=t.nestingSuffix?Zc(t.nestingSuffix):t.nestingSuffixEscaped||Zc(")"),this.nestingOptionsSeparator=t.nestingOptionsSeparator?t.nestingOptionsSeparator:t.nestingOptionsSeparator||",",this.maxReplaces=t.maxReplaces?t.maxReplaces:1e3,this.alwaysFormat=void 0!==t.alwaysFormat&&t.alwaysFormat,this.resetRegExp()}},{key:"reset",value:function(){this.options&&this.init(this.options)}},{key:"resetRegExp",value:function(){var e="".concat(this.prefix,"(.+?)").concat(this.suffix);this.regexp=new RegExp(e,"g");var t="".concat(this.prefix).concat(this.unescapePrefix,"(.+?)").concat(this.unescapeSuffix).concat(this.suffix);this.regexpUnescape=new RegExp(t,"g");var i="".concat(this.nestingPrefix,"(.+?)").concat(this.nestingSuffix);this.nestingRegexp=new RegExp(i,"g")}},{key:"interpolate",value:function(e,t,i,r){var s,n,a,o=this,h=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{};function u(e){return e.replace(/\$/g,"$$$$")}var l=function(e){if(e.indexOf(o.formatSeparator)<0){var s=Xc(t,h,e);return o.alwaysFormat?o.format(s,void 0,i):s}var n=e.split(o.formatSeparator),a=n.shift().trim(),u=n.join(o.formatSeparator).trim();return o.format(Xc(t,h,a),u,i,r)};this.resetRegExp();var c=r&&r.missingInterpolationHandler||this.options.missingInterpolationHandler,p=r&&r.interpolation&&r.interpolation.skipOnVariables||this.options.interpolation.skipOnVariables;return[{regex:this.regexpUnescape,safeValue:function(e){return u(e)}},{regex:this.regexp,safeValue:function(e){return o.escapeValue?u(o.escape(e)):u(e)}}].forEach((function(t){for(a=0;s=t.regex.exec(e);){if(void 0===(n=l(s[1].trim())))if("function"==typeof c){var i=c(e,s,r);n="string"==typeof i?i:""}else{if(p){n=s[0];continue}o.logger.warn("missed to pass in variable ".concat(s[1]," for interpolating ").concat(e)),n=""}else"string"==typeof n||o.useRawValueToEscape||(n=$c(n));if(e=e.replace(s[0],t.safeValue(n)),t.regex.lastIndex=0,++a>=o.maxReplaces)break}})),e}},{key:"nest",value:function(e,t){var i,r,s=this,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},a=Mc({},n);function o(e,t){var i=this.nestingOptionsSeparator;if(e.indexOf(i)<0)return e;var r=e.split(new RegExp("".concat(i,"[ ]*{"))),s="{".concat(r[1]);e=r[0],s=(s=this.interpolate(s,a)).replace(/'/g,'"');try{a=JSON.parse(s),t&&(a=Mc({},t,a))}catch(t){return this.logger.warn("failed parsing options string in nesting for key ".concat(e),t),"".concat(e).concat(i).concat(s)}return delete a.defaultValue,e}for(a.applyPostProcessor=!1,delete a.defaultValue;i=this.nestingRegexp.exec(e);){var h=[],u=!1;if(i[0].includes(this.formatSeparator)&&!/{.*}/.test(i[1])){var l=i[1].split(this.formatSeparator).map((function(e){return e.trim()}));i[1]=l.shift(),h=l,u=!0}if((r=t(o.call(this,i[1].trim(),a),a))&&i[0]===e&&"string"!=typeof r)return r;"string"!=typeof r&&(r=$c(r)),r||(this.logger.warn("missed to resolve ".concat(i[1]," for nesting ").concat(e)),r=""),u&&(r=h.reduce((function(e,t){return s.format(e,t,n.lng,n)}),r.trim())),e=e.replace(i[0],r),this.regexp.lastIndex=0}return e}}]),e}();var lp=function(e){function t(e,i,r){var s,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return kc(this,t),s=Pc(this,Oc(t).call(this)),Qc&&zc.call(Lc(s)),s.backend=e,s.store=i,s.services=r,s.languageUtils=r.languageUtils,s.options=n,s.logger=Gc.create("backendConnector"),s.state={},s.queue=[],s.backend&&s.backend.init&&s.backend.init(r,n.backend,n),s}return Rc(t,e),Bc(t,[{key:"queueLoad",value:function(e,t,i,r){var s=this,n=[],a=[],o=[],h=[];return e.forEach((function(e){var r=!0;t.forEach((function(t){var o="".concat(e,"|").concat(t);!i.reload&&s.store.hasResourceBundle(e,t)?s.state[o]=2:s.state[o]<0||(1===s.state[o]?a.indexOf(o)<0&&a.push(o):(s.state[o]=1,r=!1,a.indexOf(o)<0&&a.push(o),n.indexOf(o)<0&&n.push(o),h.indexOf(t)<0&&h.push(t)))})),r||o.push(e)})),(n.length||a.length)&&this.queue.push({pending:a,loaded:{},errors:[],callback:r}),{toLoad:n,pending:a,toLoadLanguages:o,toLoadNamespaces:h}}},{key:"loaded",value:function(e,t,i){var r=e.split("|"),s=r[0],n=r[1];t&&this.emit("failedLoading",s,n,t),i&&this.store.addResourceBundle(s,n,i),this.state[e]=t?-1:2;var a={};this.queue.forEach((function(i){!function(e,t,i){var r=Wc(e,t,Object),s=r.obj,n=r.k;s[n]=s[n]||[],s[n].push(i)}(i.loaded,[s],n),function(e,t){for(var i=e.indexOf(t);-1!==i;)e.splice(i,1),i=e.indexOf(t)}(i.pending,e),t&&i.errors.push(t),0!==i.pending.length||i.done||(Object.keys(i.loaded).forEach((function(e){a[e]||(a[e]=[]),i.loaded[e].length&&i.loaded[e].forEach((function(t){a[e].indexOf(t)<0&&a[e].push(t)}))})),i.done=!0,i.errors.length?i.callback(i.errors):i.callback())})),this.emit("loaded",a),this.queue=this.queue.filter((function(e){return!e.done}))}},{key:"read",value:function(e,t,i){var r=this,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:350,a=arguments.length>5?arguments[5]:void 0;return e.length?this.backend[i](e,t,(function(o,h){o&&h&&s<5?setTimeout((function(){r.read.call(r,e,t,i,s+1,2*n,a)}),n):a(o,h)})):a(null,{})}},{key:"prepareLoading",value:function(e,t){var i=this,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},s=arguments.length>3?arguments[3]:void 0;if(!this.backend)return this.logger.warn("No backend was added via i18next.use. Will not load resources."),s&&s();"string"==typeof e&&(e=this.languageUtils.toResolveHierarchy(e)),"string"==typeof t&&(t=[t]);var n=this.queueLoad(e,t,r,s);if(!n.toLoad.length)return n.pending.length||s(),null;n.toLoad.forEach((function(e){i.loadOne(e)}))}},{key:"load",value:function(e,t,i){this.prepareLoading(e,t,{},i)}},{key:"reload",value:function(e,t,i){this.prepareLoading(e,t,{reload:!0},i)}},{key:"loadOne",value:function(e){var t=this,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",r=e.split("|"),s=r[0],n=r[1];this.read(s,n,"read",void 0,void 0,(function(r,a){r&&t.logger.warn("".concat(i,"loading namespace ").concat(n," for language ").concat(s," failed"),r),!r&&a&&t.logger.log("".concat(i,"loaded namespace ").concat(n," for language ").concat(s),a),t.loaded(e,r,a)}))}},{key:"saveMissing",value:function(e,t,i,r,s){var n=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{};this.services.utils&&this.services.utils.hasLoadedNamespace&&!this.services.utils.hasLoadedNamespace(t)?this.logger.warn('did not save key "'.concat(i,'" as the namespace "').concat(t,'" was not yet loaded'),"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!"):null!=i&&""!==i&&(this.backend&&this.backend.create&&this.backend.create(e,t,i,r,null,Mc({},n,{isUpdate:s})),e&&e[0]&&this.store.addResource(e[0],t,i,r))}}]),t}(zc);function cp(e){return"string"==typeof e.ns&&(e.ns=[e.ns]),"string"==typeof e.fallbackLng&&(e.fallbackLng=[e.fallbackLng]),"string"==typeof e.fallbackNS&&(e.fallbackNS=[e.fallbackNS]),e.whitelist&&(e.whitelist&&e.whitelist.indexOf("cimode")<0&&(e.whitelist=e.whitelist.concat(["cimode"])),e.supportedLngs=e.whitelist),e.nonExplicitWhitelist&&(e.nonExplicitSupportedLngs=e.nonExplicitWhitelist),e.supportedLngs&&e.supportedLngs.indexOf("cimode")<0&&(e.supportedLngs=e.supportedLngs.concat(["cimode"])),e}function pp(){}var dp=function(e){function t(){var e,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=arguments.length>1?arguments[1]:void 0;if(kc(this,t),e=Pc(this,Oc(t).call(this)),Qc&&zc.call(Lc(e)),e.options=cp(i),e.services={},e.logger=Gc,e.modules={external:[]},r&&!e.isInitialized&&!i.isClone){if(!e.options.initImmediate)return e.init(i,r),Pc(e,Lc(e));setTimeout((function(){e.init(i,r)}),0)}return e}return Rc(t,e),Bc(t,[{key:"init",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=arguments.length>1?arguments[1]:void 0;function r(e){return e?"function"==typeof e?new e:e:null}if("function"==typeof t&&(i=t,t={}),t.whitelist&&!t.supportedLngs&&this.logger.deprecate("whitelist",'option "whitelist" will be renamed to "supportedLngs" in the next major - please make sure to rename this option asap.'),t.nonExplicitWhitelist&&!t.nonExplicitSupportedLngs&&this.logger.deprecate("whitelist",'options "nonExplicitWhitelist" will be renamed to "nonExplicitSupportedLngs" in the next major - please make sure to rename this option asap.'),this.options=Mc({},{debug:!1,initImmediate:!0,ns:["translation"],defaultNS:["translation"],fallbackLng:["dev"],fallbackNS:!1,whitelist:!1,nonExplicitWhitelist:!1,supportedLngs:!1,nonExplicitSupportedLngs:!1,load:"all",preload:!1,simplifyPluralSuffix:!0,keySeparator:".",nsSeparator:":",pluralSeparator:"_",contextSeparator:"_",partialBundledLanguages:!1,saveMissing:!1,updateMissing:!1,saveMissingTo:"fallback",saveMissingPlurals:!0,missingKeyHandler:!1,missingInterpolationHandler:!1,postProcess:!1,postProcessPassResolved:!1,returnNull:!0,returnEmptyString:!0,returnObjects:!1,joinArrays:!1,returnedObjectHandler:!1,parseMissingKeyHandler:!1,appendNamespaceToMissingKey:!1,appendNamespaceToCIMode:!1,overloadTranslationOptionHandler:function(e){var t={};if("object"===Sc(e[1])&&(t=e[1]),"string"==typeof e[1]&&(t.defaultValue=e[1]),"string"==typeof e[2]&&(t.tDescription=e[2]),"object"===Sc(e[2])||"object"===Sc(e[3])){var i=e[3]||e[2];Object.keys(i).forEach((function(e){t[e]=i[e]}))}return t},interpolation:{escapeValue:!0,format:function(e,t,i,r){return e},prefix:"{{",suffix:"}}",formatSeparator:",",unescapePrefix:"-",nestingPrefix:"$t(",nestingSuffix:")",nestingOptionsSeparator:",",maxReplaces:1e3,skipOnVariables:!1}},this.options,cp(t)),this.format=this.options.interpolation.format,i||(i=pp),!this.options.isClone){this.modules.logger?Gc.init(r(this.modules.logger),this.options):Gc.init(null,this.options);var s=new np(this.options);this.store=new ep(this.options.resources,this.options);var n=this.services;n.logger=Gc,n.resourceStore=this.store,n.languageUtils=s,n.pluralResolver=new hp(s,{prepend:this.options.pluralSeparator,compatibilityJSON:this.options.compatibilityJSON,simplifyPluralSuffix:this.options.simplifyPluralSuffix}),n.interpolator=new up(this.options),n.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},n.backendConnector=new lp(r(this.modules.backend),n.resourceStore,n,this.options),n.backendConnector.on("*",(function(t){for(var i=arguments.length,r=new Array(i>1?i-1:0),s=1;s<i;s++)r[s-1]=arguments[s];e.emit.apply(e,[t].concat(r))})),this.modules.languageDetector&&(n.languageDetector=r(this.modules.languageDetector),n.languageDetector.init(n,this.options.detection,this.options)),this.modules.i18nFormat&&(n.i18nFormat=r(this.modules.i18nFormat),n.i18nFormat.init&&n.i18nFormat.init(this)),this.translator=new rp(this.services,this.options),this.translator.on("*",(function(t){for(var i=arguments.length,r=new Array(i>1?i-1:0),s=1;s<i;s++)r[s-1]=arguments[s];e.emit.apply(e,[t].concat(r))})),this.modules.external.forEach((function(t){t.init&&t.init(e)}))}if(this.options.fallbackLng&&!this.services.languageDetector&&!this.options.lng){var a=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);a.length>0&&"dev"!==a[0]&&(this.options.lng=a[0])}this.services.languageDetector||this.options.lng||this.logger.warn("init: no languageDetector is used and no lng is defined");["getResource","hasResourceBundle","getResourceBundle","getDataByLanguage"].forEach((function(t){e[t]=function(){var i;return(i=e.store)[t].apply(i,arguments)}}));["addResource","addResources","addResourceBundle","removeResourceBundle"].forEach((function(t){e[t]=function(){var i;return(i=e.store)[t].apply(i,arguments),e}}));var o=jc(),h=function(){var t=function(t,r){e.isInitialized&&e.logger.warn("init: i18next is already initialized. You should call init just once!"),e.isInitialized=!0,e.options.isClone||e.logger.log("initialized",e.options),e.emit("initialized",e.options),o.resolve(r),i(t,r)};if(e.languages&&"v1"!==e.options.compatibilityAPI&&!e.isInitialized)return t(null,e.t.bind(e));e.changeLanguage(e.options.lng,t)};return this.options.resources||!this.options.initImmediate?h():setTimeout(h,0),o}},{key:"loadResources",value:function(e){var t=this,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:pp,r="string"==typeof e?e:this.language;if("function"==typeof e&&(i=e),!this.options.resources||this.options.partialBundledLanguages){if(r&&"cimode"===r.toLowerCase())return i();var s=[],n=function(e){e&&t.services.languageUtils.toResolveHierarchy(e).forEach((function(e){s.indexOf(e)<0&&s.push(e)}))};if(r)n(r);else this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach((function(e){return n(e)}));this.options.preload&&this.options.preload.forEach((function(e){return n(e)})),this.services.backendConnector.load(s,this.options.ns,i)}else i(null)}},{key:"reloadResources",value:function(e,t,i){var r=jc();return e||(e=this.languages),t||(t=this.options.ns),i||(i=pp),this.services.backendConnector.reload(e,t,(function(e){r.resolve(),i(e)})),r}},{key:"use",value:function(e){if(!e)throw new Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");if(!e.type)throw new Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");return"backend"===e.type&&(this.modules.backend=e),("logger"===e.type||e.log&&e.warn&&e.error)&&(this.modules.logger=e),"languageDetector"===e.type&&(this.modules.languageDetector=e),"i18nFormat"===e.type&&(this.modules.i18nFormat=e),"postProcessor"===e.type&&tp.addPostProcessor(e),"3rdParty"===e.type&&this.modules.external.push(e),this}},{key:"changeLanguage",value:function(e,t){var i=this;this.isLanguageChangingTo=e;var r=jc();this.emit("languageChanging",e);var s=function(e){var s="string"==typeof e?e:i.services.languageUtils.getBestMatchFromCodes(e);s&&(i.language||(i.language=s,i.languages=i.services.languageUtils.toResolveHierarchy(s)),i.translator.language||i.translator.changeLanguage(s),i.services.languageDetector&&i.services.languageDetector.cacheUserLanguage(s)),i.loadResources(s,(function(e){!function(e,s){s?(i.language=s,i.languages=i.services.languageUtils.toResolveHierarchy(s),i.translator.changeLanguage(s),i.isLanguageChangingTo=void 0,i.emit("languageChanged",s),i.logger.log("languageChanged",s)):i.isLanguageChangingTo=void 0,r.resolve((function(){return i.t.apply(i,arguments)})),t&&t(e,(function(){return i.t.apply(i,arguments)}))}(e,s)}))};return e||!this.services.languageDetector||this.services.languageDetector.async?!e&&this.services.languageDetector&&this.services.languageDetector.async?this.services.languageDetector.detect(s):s(e):s(this.services.languageDetector.detect()),r}},{key:"getFixedT",value:function(e,t){var i=this,r=function e(t,r){var s;if("object"!==Sc(r)){for(var n=arguments.length,a=new Array(n>2?n-2:0),o=2;o<n;o++)a[o-2]=arguments[o];s=i.options.overloadTranslationOptionHandler([t,r].concat(a))}else s=Mc({},r);return s.lng=s.lng||e.lng,s.lngs=s.lngs||e.lngs,s.ns=s.ns||e.ns,i.t(t,s)};return"string"==typeof e?r.lng=e:r.lngs=e,r.ns=t,r}},{key:"t",value:function(){var e;return this.translator&&(e=this.translator).translate.apply(e,arguments)}},{key:"exists",value:function(){var e;return this.translator&&(e=this.translator).exists.apply(e,arguments)}},{key:"setDefaultNamespace",value:function(e){this.options.defaultNS=e}},{key:"hasLoadedNamespace",value:function(e){var t=this,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!this.isInitialized)return this.logger.warn("hasLoadedNamespace: i18next was not initialized",this.languages),!1;if(!this.languages||!this.languages.length)return this.logger.warn("hasLoadedNamespace: i18n.languages were undefined or empty",this.languages),!1;var r=this.languages[0],s=!!this.options&&this.options.fallbackLng,n=this.languages[this.languages.length-1];if("cimode"===r.toLowerCase())return!0;var a=function(e,i){var r=t.services.backendConnector.state["".concat(e,"|").concat(i)];return-1===r||2===r};if(i.precheck){var o=i.precheck(this,a);if(void 0!==o)return o}return!!this.hasResourceBundle(r,e)||(!this.services.backendConnector.backend||!(!a(r,e)||s&&!a(n,e)))}},{key:"loadNamespaces",value:function(e,t){var i=this,r=jc();return this.options.ns?("string"==typeof e&&(e=[e]),e.forEach((function(e){i.options.ns.indexOf(e)<0&&i.options.ns.push(e)})),this.loadResources((function(e){r.resolve(),t&&t(e)})),r):(t&&t(),Promise.resolve())}},{key:"loadLanguages",value:function(e,t){var i=jc();"string"==typeof e&&(e=[e]);var r=this.options.preload||[],s=e.filter((function(e){return r.indexOf(e)<0}));return s.length?(this.options.preload=r.concat(s),this.loadResources((function(e){i.resolve(),t&&t(e)})),i):(t&&t(),Promise.resolve())}},{key:"dir",value:function(e){if(e||(e=this.languages&&this.languages.length>0?this.languages[0]:this.language),!e)return"rtl";return["ar","shu","sqr","ssh","xaa","yhd","yud","aao","abh","abv","acm","acq","acw","acx","acy","adf","ads","aeb","aec","afb","ajp","apc","apd","arb","arq","ars","ary","arz","auz","avl","ayh","ayl","ayn","ayp","bbz","pga","he","iw","ps","pbt","pbu","pst","prp","prd","ug","ur","ydd","yds","yih","ji","yi","hbo","men","xmn","fa","jpr","peo","pes","prs","dv","sam"].indexOf(this.services.languageUtils.getLanguagePartFromCode(e))>=0?"rtl":"ltr"}},{key:"createInstance",value:function(){return new t(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},arguments.length>1?arguments[1]:void 0)}},{key:"cloneInstance",value:function(){var e=this,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:pp,s=Mc({},this.options,i,{isClone:!0}),n=new t(s);return["store","services","language"].forEach((function(t){n[t]=e[t]})),n.services=Mc({},this.services),n.services.utils={hasLoadedNamespace:n.hasLoadedNamespace.bind(n)},n.translator=new rp(n.services,n.options),n.translator.on("*",(function(e){for(var t=arguments.length,i=new Array(t>1?t-1:0),r=1;r<t;r++)i[r-1]=arguments[r];n.emit.apply(n,[e].concat(i))})),n.init(s,r),n.translator.options=n.options,n.translator.backendConnector.services.utils={hasLoadedNamespace:n.hasLoadedNamespace.bind(n)},n}}]),t}(zc),fp=(new dp,[]),gp=fp.forEach,mp=fp.slice;var yp,xp=function(e,t,i,r){var s,n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{path:"/"};if(i){var a=new Date;a.setTime(a.getTime()+60*i*1e3),s="; expires="+a.toUTCString()}else s="";r=r?"domain="+r+";":"",n=Object.keys(n).reduce((function(e,t){return e+";"+t.replace(/([A-Z])/g,(function(e){return"-"+e.toLowerCase()}))+"="+n[t]}),""),document.cookie=e+"="+encodeURIComponent(t)+s+";"+r+n},vp=function(e){for(var t=e+"=",i=document.cookie.split(";"),r=0;r<i.length;r++){for(var s=i[r];" "===s.charAt(0);)s=s.substring(1,s.length);if(0===s.indexOf(t))return s.substring(t.length,s.length)}return null},bp={name:"cookie",lookup:function(e){var t;if(e.lookupCookie&&"undefined"!=typeof document){var i=vp(e.lookupCookie);i&&(t=i)}return t},cacheUserLanguage:function(e,t){t.lookupCookie&&"undefined"!=typeof document&&xp(t.lookupCookie,e,t.cookieMinutes,t.cookieDomain,t.cookieOptions)}},_p={name:"querystring",lookup:function(e){var t;if("undefined"!=typeof window)for(var i=window.location.search.substring(1).split("&"),r=0;r<i.length;r++){var s=i[r].indexOf("=");if(s>0)i[r].substring(0,s)===e.lookupQuerystring&&(t=i[r].substring(s+1))}return t}};try{yp="undefined"!==window&&null!==window.localStorage;var wp="i18next.translate.boo";window.localStorage.setItem(wp,"foo"),window.localStorage.removeItem(wp)}catch(e){yp=!1}var Cp,Dp={name:"localStorage",lookup:function(e){var t;if(e.lookupLocalStorage&&yp){var i=window.localStorage.getItem(e.lookupLocalStorage);i&&(t=i)}return t},cacheUserLanguage:function(e,t){t.lookupLocalStorage&&yp&&window.localStorage.setItem(t.lookupLocalStorage,e)}};try{Cp="undefined"!==window&&null!==window.sessionStorage;var Ep="i18next.translate.boo";window.sessionStorage.setItem(Ep,"foo"),window.sessionStorage.removeItem(Ep)}catch(e){Cp=!1}var Ap={name:"sessionStorage",lookup:function(e){var t;if(e.lookupsessionStorage&&Cp){var i=window.sessionStorage.getItem(e.lookupsessionStorage);i&&(t=i)}return t},cacheUserLanguage:function(e,t){t.lookupsessionStorage&&Cp&&window.sessionStorage.setItem(t.lookupsessionStorage,e)}},Sp={name:"navigator",lookup:function(e){var t=[];if("undefined"!=typeof navigator){if(navigator.languages)for(var i=0;i<navigator.languages.length;i++)t.push(navigator.languages[i]);navigator.userLanguage&&t.push(navigator.userLanguage),navigator.language&&t.push(navigator.language)}return t.length>0?t:void 0}},Fp={name:"htmlTag",lookup:function(e){var t,i=e.htmlTag||("undefined"!=typeof document?document.documentElement:null);return i&&"function"==typeof i.getAttribute&&(t=i.getAttribute("lang")),t}},Tp={name:"path",lookup:function(e){var t;if("undefined"!=typeof window){var i=window.location.pathname.match(/\/([a-zA-Z-]*)/g);if(i instanceof Array)if("number"==typeof e.lookupFromPathIndex){if("string"!=typeof i[e.lookupFromPathIndex])return;t=i[e.lookupFromPathIndex].replace("/","")}else t=i[0].replace("/","")}return t}},Mp={name:"subdomain",lookup:function(e){var t;if("undefined"!=typeof window){var i=window.location.href.match(/(?:http[s]*\:\/\/)*(.*?)\.(?=[^\/]*\..{2,5})/gi);i instanceof Array&&(t="number"==typeof e.lookupFromSubdomainIndex?i[e.lookupFromSubdomainIndex].replace("http://","").replace("https://","").replace(".",""):i[0].replace("http://","").replace("https://","").replace(".",""))}return t}};var kp=function(){function e(t){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};kc(this,e),this.type="languageDetector",this.detectors={},this.init(t,i)}return Bc(e,[{key:"init",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};this.services=e,this.options=function(e){return gp.call(mp.call(arguments,1),(function(t){if(t)for(var i in t)void 0===e[i]&&(e[i]=t[i])})),e}(t,this.options||{},{order:["querystring","cookie","localStorage","sessionStorage","navigator","htmlTag"],lookupQuerystring:"lng",lookupCookie:"i18next",lookupLocalStorage:"i18nextLng",caches:["localStorage"],excludeCacheFor:["cimode"],checkWhitelist:!0,checkForSimilarInWhitelist:!1}),this.options.checkForSimilarInWhitelist&&(this.options.checkWhitelist=!0),this.options.lookupFromUrlIndex&&(this.options.lookupFromPathIndex=this.options.lookupFromUrlIndex),this.i18nOptions=i,this.addDetector(bp),this.addDetector(_p),this.addDetector(Dp),this.addDetector(Ap),this.addDetector(Sp),this.addDetector(Fp),this.addDetector(Tp),this.addDetector(Mp)}},{key:"addDetector",value:function(e){this.detectors[e.name]=e}},{key:"detect",value:function(e){var t=this;e||(e=this.options.order);var i,r=[];if(e.forEach((function(e){if(t.detectors[e]){var i=t.detectors[e].lookup(t.options);i&&"string"==typeof i&&(i=[i]),i&&(r=r.concat(i))}})),r.forEach((function(e){if(!i){var r=t.services.languageUtils.formatLanguageCode(e);t.options.checkWhitelist&&!t.services.languageUtils.isWhitelisted(r)||(i=r),!i&&t.options.checkForSimilarInWhitelist&&(i=t.getSimilarInWhitelist(r))}})),!i){var s=this.i18nOptions.fallbackLng;"string"==typeof s&&(s=[s]),s||(s=[]),i="[object Array]"===Object.prototype.toString.apply(s)?s[0]:s[0]||s.default&&s.default[0]}return i}},{key:"cacheUserLanguage",value:function(e,t){var i=this;t||(t=this.options.caches),t&&(this.options.excludeCacheFor&&this.options.excludeCacheFor.indexOf(e)>-1||t.forEach((function(t){i.detectors[t]&&i.detectors[t].cacheUserLanguage(e,i.options)})))}},{key:"getSimilarInWhitelist",value:function(e){var t=this;if(this.i18nOptions.whitelist){if(e.includes("-")){var i=e.split("-")[0],r=this.services.languageUtils.formatLanguageCode(i);if(this.services.languageUtils.isWhitelisted(r))return r;e=r}var s=this.i18nOptions.whitelist.find((function(i){var r=t.services.languageUtils.formatLanguageCode(i);if(r.startsWith(e))return r}));return s||void 0}}}]),e}();kp.type="languageDetector";var Ip={en:{translation:{fes:{autoplay:"The media that tried to play (with '{{src}}') wasn't allowed to by this browser, most likely due to the browser's autoplay policy.\n\n+ More info: {{url}}",checkUserDefinedFns:"It seems that you may have accidentally written {{name}} instead of {{actualName}}. Please correct it if it's not intentional.",fileLoadError:{bytes:"It looks like there was a problem loading your file. {{suggestion}}",font:"It looks like there was a problem loading your font. {{suggestion}}",gif:"There was some trouble loading your GIF. Make sure that your GIF is using 87a or 89a encoding.",image:"It looks like there was a problem loading your image. {{suggestion}}",json:"It looks like there was a problem loading your JSON file. {{suggestion}}",large:"If your large file isn't fetched successfully, we recommend splitting the file into smaller segments and fetching those.",strings:"It looks like there was a problem loading your text file. {{suggestion}}",suggestion:"Try checking if the file path ({{filePath}}) is correct, hosting the file online, or running a local server.\n\n+ More info: {{url}}",table:"It looks like there was a problem loading your table file. {{suggestion}}",xml:"It looks like there was a problem loading your XML file. {{suggestion}}"},friendlyParamError:{type_EMPTY_VAR:"{{location}} {{func}}() was expecting {{formatType}} for the {{position}} parameter, received an empty variable instead. If not intentional, this is often a problem with scope.\n\n+ More info: {{url}}",type_TOO_FEW_ARGUMENTS:"{{location}} {{func}}() was expecting at least {{minParams}} arguments, but received only {{argCount}}.",type_TOO_MANY_ARGUMENTS:"{{location}} {{func}}() was expecting no more than {{maxParams}} arguments, but received {{argCount}}.",type_WRONG_TYPE:"{{location}} {{func}}() was expecting {{formatType}} for the {{position}} parameter, received {{argType}} instead."},globalErrors:{reference:{cannotAccess:'\n{{location}} "{{symbol}}" is used before declaration. Make sure you have declared the variable before using it.\n\n+ More info: {{url}}',notDefined:'\n{{location}} "{{symbol}}" is not defined in the current scope. If you have defined it in your code, you should check its scope, spelling, and letter-casing (JavaScript is case-sensitive).\n\n+ More info: {{url}}'},stackSubseq:"└[{{location}}] \n\t Called from line {{line}} in {{func}}()\n",stackTop:"┌[{{location}}] \n\t Error at line {{line}} in {{func}}()\n",syntax:{badReturnOrYield:"\nSyntax Error - return lies outside of a function. Make sure you’re not missing any brackets, so that return lies inside a function.\n\n+ More info: {{url}}",invalidToken:"\nSyntax Error - Found a symbol that JavaScript doesn't recognize or didn't expect at it's place.\n\n+ More info: {{url}}",missingInitializer:"\nSyntax Error - A const variable is declared but not initialized. In JavaScript, an initializer for a const is required. A value must be specified in the same statement in which the variable is declared. Check the line number in the error and assign the const variable a value.\n\n+ More info: {{url}}",redeclaredVariable:'\nSyntax Error - "{{symbol}}" is being redeclared. JavaScript doesn\'t allow declaring a variable more than once. Check the line number in error for redeclaration of the variable.\n\n+ More info: {{url}}',unexpectedToken:"\nSyntax Error - Symbol present at a place that wasn't expected.\nUsually this is due to a typo. Check the line number in the error for anything missing/extra.\n\n+ More info: {{url}}"},type:{constAssign:"\n{{location}} A const variable is being re-assigned. In javascript, re-assigning a value to a constant is not allowed. If you want to re-assign new values to a variable, make sure it is declared as var or let.\n\n+ More info: {{url}}",notfunc:'\n{{location}} "{{symbol}}" could not be called as a function.\nCheck the spelling, letter-casing (JavaScript is case-sensitive) and its type.\n\n+ More info: {{url}}',notfuncObj:'\n{{location}} "{{symbol}}" could not be called as a function.\nVerify whether "{{obj}}" has "{{symbol}}" in it and check the spelling, letter-casing (JavaScript is case-sensitive) and its type.\n\n+ More info: {{url}}',readFromNull:"\n{{location}} The property of null can't be read. In javascript the value null indicates that an object has no value.\n\n+ More info: {{url}}",readFromUndefined:"\n{{location}} Cannot read property of undefined. Check the line number in error and make sure the variable which is being operated is not undefined.\n\n + More info: {{url}}"}},libraryError:'{{location}} An error with message "{{error}}" occurred inside the p5js library when {{func}} was called. If not stated otherwise, it might be an issue with the arguments passed to {{func}}.',location:"[{{file}}, line {{line}}]",misspelling:'{{location}} It seems that you may have accidentally written "{{name}}" instead of "{{actualName}}". Please correct it to {{actualName}} if you wish to use the {{type}} from p5.js.',misspelling_plural:'{{location}} It seems that you may have accidentally written "{{name}}".\nYou may have meant one of the following: \n{{suggestions}}',misusedTopLevel:"Did you just try to use p5.js's {{symbolName}} {{symbolType}}? If so, you may want to move it into your sketch's setup() function.\n\n+ More info: {{url}}",preloadDisabled:"The preload() function has been removed in p5.js 2.0. Please load assets in setup() using async / await keywords or callbacks instead. See https://dev.to/limzykenneth/asynchronous-p5js-20-458f for more information.",positions:{p_1:"first",p_10:"tenth",p_11:"eleventh",p_12:"twelfth",p_2:"second",p_3:"third",p_4:"fourth",p_5:"fifth",p_6:"sixth",p_7:"seventh",p_8:"eighth",p_9:"ninth"},pre:"\n🌸 p5.js says: {{message}}",sketchReaderErrors:{reservedConst:'you have used a p5.js reserved variable "{{symbol}}" make sure you change the variable name to something else.\n\n+ More info: {{url}}',reservedFunc:'you have used a p5.js reserved function "{{symbol}}" make sure you change the function name to something else.\n\n+ More info: {{url}}'},welcome:"Welcome! This is your friendly debugger. To turn me off, switch to using p5.min.js.",wrongPreload:'{{location}} An error with message "{{error}}" occurred inside the p5js library when "{{func}}" was called. If not stated otherwise, it might be due to "{{func}}" being called from preload. Nothing besides load calls (loadImage, loadJSON, loadFont, loadStrings, etc.) should be inside the preload function.'}}}};const Bp=["en","es","ko","zh","hi","ja"];class Lp{constructor(e,t){this.init(e,t)}fetchWithTimeout(e,t,i=2e3){return Promise.race([fetch(e,t),new Promise(((e,t)=>setTimeout((()=>t(new Error("timeout"))),i)))])}init(e,t={}){this.services=e,this.options=t}read(e,t,i){const r=this.options.loadPath;if(e===this.options.fallback)i(null,Ip[e][t]);else if(Bp.includes(e)){const s=this.services.interpolator.interpolate(r,{lng:e,ns:t});this.loadUrl(s,i)}else i("Not found",!1)}loadUrl(e,t){this.fetchWithTimeout(e).then((t=>{if(!t.ok)throw new Error(`failed loading ${e}`);return t.json()}),(()=>{throw new Error(`failed loading ${e}`)})).then((e=>t(null,e))).catch(t)}}Lp.type="backend";const Pp=Promise.resolve();return function(e){e.registerAddon(Es),e.registerAddon(As),e.registerAddon(Ss),e.registerAddon(Fs),e.registerAddon(gs)}(Ca),function(e){e.registerAddon(Da),e.registerAddon(Ea),e.registerAddon(Aa),e.registerAddon(Sa),e.registerAddon(Ta)}(Ca),function(e){e.registerAddon(Dr),e.registerAddon(dr),e.registerAddon(Ts)}(Ca),function(e){e.registerAddon(Ma)}(Ca),function(e){e.registerAddon(ka),e.registerAddon(kr),e.registerAddon(_s),e.registerAddon(Tr)}(Ca),function(e){e.registerAddon(Ia),e.registerAddon(Ba),e.registerAddon(La)}(Ca),function(e){e.registerAddon(ks),e.registerAddon(sn),e.registerAddon(qr),e.registerAddon(nn),e.registerAddon(En),e.registerAddon(ca)}(Ca),function(e){e.registerAddon(Ns),e.registerAddon(Oa),e.registerAddon(Ra),e.registerAddon(Sr)}(Ca),function(e){e.registerAddon(Va),e.registerAddon(Ua),e.registerAddon(Ga),e.registerAddon(oa),e.registerAddon(za),e.registerAddon($e)}(Ca),function(e){e.registerAddon(ja),e.registerAddon($a),e.registerAddon(Wa)}(Ca),function(e){ta(e,e.prototype),sa(e,e.prototype),qa(e,e.prototype),na(0,e.prototype),Xa(e,e.prototype),aa(0,e.prototype),function(e){ea.prototype.maxCachedGlyphs=function(){return 200},ea.prototype.freeGlyphInfo=function(e){const t=[e.strokeImageInfo.imageData,e.rowInfo.cellImageInfo.imageData,e.rowInfo.dimImageInfo.imageData,e.colInfo.cellImageInfo.imageData,e.colInfo.dimImageInfo.imageData];for(const e of t){const t=this.textures.get(e);t&&(t.remove(),this.textures.delete(e))}},Oh.prototype._getFontInfo=function(e){this._fontInfos=this._fontInfos||{};const t=JSON.stringify(e);if(this._fontInfos[t])return this._fontInfos[t];{const i=new s(this,{axs:e});return this._fontInfos[t]=i,i}};class t{constructor(e,t){this.width=e,this.height=t,this.infos=[]}findImage(e){const t=this.width*this.height;if(e>t)throw new Error("font is too complex to render in 3D");let i,r;for(let s=this.infos.length-1;s>=0;--s){const n=this.infos[s];if(n.index+e<t){i=n,r=n.imageData;break}}if(!i){try{r=new ImageData(this.width,this.height)}catch(e){let t=document.getElementsByTagName("canvas")[0];const i=!t;t||(t=document.createElement("canvas"),t.style.display="none",document.body.appendChild(t));const s=t.getContext("2d");s&&(r=s.createImageData(this.width,this.height)),i&&document.body.removeChild(t)}i={index:0,imageData:r},this.infos.push(i)}const s=i.index;return i.index+=e,r._dirty=!0,{imageData:r,index:s}}}function i(e,t,i,r,s){const n=e.imageData.data;let a=4*e.index++;n[a++]=t,n[a++]=i,n[a++]=r,n[a++]=s}const r=Math.sqrt(3);class s{constructor(e,{axs:i}={}){this.font=e,this.axs=i,this.strokeImageInfos=new t(64,64),this.colDimImageInfos=new t(64,64),this.rowDimImageInfos=new t(64,64),this.colCellImageInfos=new t(64,64),this.rowCellImageInfos=new t(64,64),this.glyphInfos={}}getGlyphInfo(e){let t=this.glyphInfos[e.index];if(t)return t;const s=this.axs,{glyph:{path:{commands:n}}}=this.font._singleShapeToPath(e.shape,{axs:s});let a=1/0,o=-1/0,h=1/0,u=-1/0;for(const e of n)for(let t=1;t<e.length;t+=2)a=Math.min(a,e[t]),o=Math.max(o,e[t]),h=Math.min(h,e[t+1]),u=Math.max(u,e[t+1]);if(a>=o||h>=u||!n.length)return this.glyphInfos[e.index]={};const l=o-a,c=u-h,p=Gh(n);let d;const f=[],g=[],m=[];for(d=8;d>=0;--d)m.push([]);for(d=8;d>=0;--d)g.push([]);function y(e,t,i){const r=f.length;function s(e,t,i){for(let r=e.length;r-- >0;){const s=e[r];t>s&&(t=s),i<s&&(i=s)}return{min:t,max:i}}f.push(i);const n=.5,a=s(e,1,0),o=Math.max(Math.floor(9*a.min-n),0),h=Math.min(Math.ceil(9*a.max+n),9);for(let e=o;e<h;++e)m[e].push(r);const u=s(t,1,0),l=Math.max(Math.floor(9*u.min-n),0),c=Math.min(Math.ceil(9*u.max+n),9);for(let e=l;e<c;++e)g[e].push(r)}function x(e){return function(e,t,i){return e<t?t:e>i?i:e}(255*e,0,255)}class v{constructor(e,t,i,r){this.p0=e,this.c0=t,this.c1=i,this.p1=r}toQuadratic(){return{x:this.p0.x,y:this.p0.y,x1:this.p1.x,y1:this.p1.y,cx:(3*(this.c0.x+this.c1.x)-(this.p0.x+this.p1.x))/4,cy:(3*(this.c0.y+this.c1.y)-(this.p0.y+this.p1.y))/4}}quadError(){return je.sub(je.sub(this.p1,this.p0),je.mult(je.sub(this.c1,this.c0),3)).mag()/2}split(e){const t=je.lerp(this.p0,this.c0,e),i=je.lerp(this.c0,this.c1,e),r=je.lerp(t,i,e);this.c1=je.lerp(this.c1,this.p1,e),this.c0=je.lerp(i,this.c1,e);const s=je.lerp(r,this.c0,e),n=new v(this.p0,t,r,s);return this.p0=s,n}splitInflections(){const e=je.sub(this.c0,this.p0),t=je.sub(je.sub(this.c1,this.c0),e),i=je.sub(je.sub(je.sub(this.p1,this.c1),e),je.mult(t,2)),r=[];let s=t.x*i.y-t.y*i.x;if(0!==s){let n=e.x*i.y-e.y*i.x,a=e.x*t.y-e.y*t.x;const o=n*n-4*s*a;if(o>=0){s<0&&(s=-s,n=-n,a=-a);const e=Math.sqrt(o),t=(-n-e)/(2*s);let i=(-n+e)/(2*s);t>0&&t<1&&(r.push(this.split(t)),i=1-(1-i)/(1-t)),i>0&&i<1&&r.push(this.split(i))}}return r.push(this),r}}function b(e,t,i,s,n,a,o,h){const u=new v(new je(e,t),new je(i,s),new je(n,a),new je(o,h)).splitInflections(),l=[],c=30/r;for(let e of u){const t=[];let i;for(;i=c/e.quadError(),!(i>=.125);){const r=Math.pow(i,1/3),s=e.split(r),n=e.split(1-r/(1-r));l.push(s),t.push(e),e=n}i<1&&l.push(e.split(.5)),l.push(e),Array.prototype.push.apply(l,t.reverse())}return l}function _(e,t,i,r){y([e,i],[t,r],{x:e,y:t,cx:(e+i)/2,cy:(t+r)/2})}function w(e,t,i,r){return Math.abs(i-e)<1e-5&&Math.abs(r-t)<1e-5}let C,D,E,A;for(const e of p){const t=(e.x-a)/l,i=(e.y-h)/c;if(!w(C,D,t,i)){switch(e.type){case"M":E=t,A=i;break;case"L":_(C,D,t,i);break;case"Q":{const r=(e.x1-a)/l,s=(e.y1-h)/c;y([C,t,r],[D,i,s],{x:C,y:D,cx:r,cy:s});break}case"Z":w(C,D,E,A)?f.push({x:C,y:D}):(_(C,D,E,A),f.push({x:E,y:A}));break;case"C":{const r=b(C,D,(e.x1-a)/l,(e.y1-h)/c,(e.x2-a)/l,(e.y2-h)/c,t,i);for(let e=0;e<r.length;e++){const t=r[e].toQuadratic();y([t.x,t.x1,t.cx],[t.y,t.y1,t.cy],t)}break}default:throw new Error(`unknown command type: ${e.type}`)}C=t,D=i}}const S=f.length,F=this.strokeImageInfos.findImage(S),T=F.index;for(let e=0;e<S;++e){const t=f[e];i(F,x(t.x),x(t.y),x(t.cx),x(t.cy))}function M(e,t,r){const s=e.length,n=t.findImage(s),a=n.index;let o=0;for(let t=0;t<s;++t)o+=e[t].length;const h=r.findImage(o);for(let t=0;t<s;++t){const r=e[t],s=r.length,a=h.index;i(n,a>>7,127&a,s>>7,127&s);for(let e=0;e<s;++e){const t=r[e]+T;i(h,t>>7,127&t,0,0)}}return{cellImageInfo:h,dimOffset:a,dimImageInfo:n}}return t=this.glyphInfos[e.index]={glyph:e,uGlyphRect:[a,h,o,u],strokeImageInfo:F,strokes:f,colInfo:M(m,this.colDimImageInfos,this.colCellImageInfos),rowInfo:M(g,this.rowDimImageInfos,this.rowCellImageInfos)},t.uGridOffset=[t.colInfo.dimOffset,t.rowInfo.dimOffset],t}}ea.prototype._renderText=function(t,i,r,s,n){if(!this.states.textFont||"string"==typeof this.states.textFont)return void console.log("WEBGL: you must load and set a font before drawing text. See `loadFont` and `textFont` for more details.");if(r>=s||!this.states.fillColor)return;if(!e.Font.hasGlyphData(this.states.textFont))return void console.log("WEBGL: only Opentype (.otf) and Truetype (.ttf) fonts with glyph data are supported");this.push();const a=this.states.strokeColor,o=this.states.drawMode;this.states.setValue("strokeColor",null),this.states.setValue("drawMode",ye);const{font:h}=this.states.textFont;if(!h)throw new Error("In WebGL mode, textFont() needs to be given the result of loadFont() instead of a font family name.");const u=h._currentAxes(this);let l=h._getFontInfo(u);const c={x:i,y:r},p=this.states.textSize/(h.data?.head?.unitsPerEm||1e3);this.translate(c.x,c.y,0),this.scale(p,p,1);const d=this.GL,f=!this._defaultFontShader,g=this._getFontShader();g.init(),g.bindShader(),f&&(g.setUniform("uGridImageSize",[64,64]),g.setUniform("uCellsImageSize",[64,64]),g.setUniform("uStrokeImageSize",[64,64]),g.setUniform("uGridSize",[9,9]));const m=this.states.fillSet?this.states.curFillColor:[0,0,0,255];this._setGlobalUniforms(g),this._applyColorBlend(m);let y=this.geometryBufferCache.getGeometryByID("glyph");y||(y=this._textGeom=new gn(1,1,(function(){for(let e=0;e<=1;e++)for(let t=0;t<=1;t++)this.vertices.push(new je(t,e,0)),this.uvs.push(t,e)}),this),y.gid="glyph",y.computeFaces().computeNormals(),this.geometryBufferCache.ensureCached(y));for(const e of this.buffers.text)e._prepareBuffer(y,g);this._bindBuffer(this.geometryBufferCache.cache.glyph.indexBuffer,d.ELEMENT_ARRAY_BUFFER),g.setUniform("uMaterialColor",m),d.pixelStorei(d.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),this.fontCache=this.fontCache||new Map;try{const e=h._positionGlyphs(t);for(const t of e){const e=l.getGlyphInfo(t);if(e.uGlyphRect){const i=JSON.stringify({font:h.id,axs:u,glyph:t.shape.g});if(this.fontCache.delete(i),this.fontCache.set(i,e),this.fontCache.size>this.maxCachedGlyphs()){const e=this.fontCache.keys().next().value,t=this.fontCache.get(e);this.fontCache.delete(e),this.freeGlyphInfo(t)}const r=e.rowInfo,s=e.colInfo;g.setUniform("uSamplerStrokes",e.strokeImageInfo.imageData),g.setUniform("uSamplerRowStrokes",r.cellImageInfo.imageData),g.setUniform("uSamplerRows",r.dimImageInfo.imageData),g.setUniform("uSamplerColStrokes",s.cellImageInfo.imageData),g.setUniform("uSamplerCols",s.dimImageInfo.imageData),g.setUniform("uGridOffset",e.uGridOffset),g.setUniform("uGlyphRect",e.uGlyphRect),g.setUniform("uGlyphOffset",t.x),g.bindTextures(),d.drawElements(d.TRIANGLES,6,this.GL.UNSIGNED_SHORT,0)}}}finally{g.unbindShader(),this.states.setValue("strokeColor",a),this.states.setValue("drawMode",o),d.pixelStorei(d.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!0),this.pop()}}}(e),Cn(e),vn(e),cn(e),mn(e),_n(e,e.prototype),ya(e),dn(e),En(e),ca(e),Ac(e,e.prototype)}(Ca),function(e){e.registerAddon(io),e.registerAddon(Uh)}(Ca),Promise.all([new Promise(((e,t)=>{"complete"===document.readyState?e():window.addEventListener("load",e,!1)})),Pp]).then((()=>{if(void 0===window._setupDone){if(!window.mocha){const e=new Event("p5Ready");window.dispatchEvent(e),(window.setup&&"function"==typeof window.setup||window.draw&&"function"==typeof window.draw)&&!Ca.instance&&new Ca}}else console.warn("p5.js seems to have been imported multiple times. Please remove the duplicate import")})),Ca}();
1
+ var p5=function(){"use strict";const t=Math.PI,i="2.1.1",r="p2d",n="webgl",s="webgl2",a="default",o="simple",h="full",u="crosshair",l="pointer",c="move",p="text",d="wait",f=t/2,g=t,m=t/4,y=2*t,x=2*t,v=t/180,b=180/t,_="corner",w="corners",C="radius",A="right",E="left",D="center",S="bottom",F="alphabetic",T=0,M=1,k="quads",I="quad_strip",B="close",L="open",O="chord",P="pie",N="square",R="butt",V="round",U="bevel",z="miter",G="auto",j="source-over",$="destination-out",q="lighter",H="darken",W="lighten",X="difference",Y="subtract",Z="exclusion",K="multiply",J="screen",Q="copy",ee="overlay",te="hard-light",ie="soft-light",re="color-dodge",ne="color-burn",se="threshold",ae="gray",oe="opaque",he="invert",ue="posterize",le="dilate",ce="erode",pe="blur",de="normal",fe="WORD",ge="linear",me="fill",ye="texture",xe="image",ve="nearest",be="repeat",_e="clamp",we="mirror",Ce="flat",Ae="smooth",Ee="#000000",De="#FFFFFF",Se="grid",Fe="axes",Te="contain",Me="cover",ke="unsigned-byte",Ie="unsigned-int",Be="float",Le="half-float",Oe=Symbol("include"),Pe=Symbol("exclude"),Ne=Symbol("join");var Re=Object.freeze({__proto__:null,ADD:q,ALT:"Alt",ARROW:a,AUTO:G,AXES:Fe,BACKSPACE:"Backspace",BASELINE:F,BEVEL:U,BEZIER:"bezier",BLEND:j,BLUR:pe,BOLD:"bold",BOLDITALIC:"bold italic",BOTTOM:S,BURN:ne,CENTER:D,CHAR:"CHAR",CHORD:O,CLAMP:_e,CLOSE:B,CONTAIN:Te,CONTROL:"Control",CORNER:_,CORNERS:w,COVER:Me,CROSS:u,CURVE:"curve",DARKEST:H,DEG_TO_RAD:v,DELETE:"Delete",DIFFERENCE:X,DILATE:le,DODGE:re,DOWN_ARROW:"ArrowDown",EMPTY_PATH:7,ENTER:"Enter",ERODE:ce,ESCAPE:"Escape",EXCLUDE:Pe,EXCLUSION:Z,FALLBACK:"fallback",FILL:me,FLAT:Ce,FLOAT:Be,FULL:h,GRAY:ae,GRID:Se,HALF_FLOAT:Le,HALF_PI:f,HAND:l,HARD_LIGHT:te,IMAGE:xe,IMMEDIATE:"immediate",INCLUDE:Oe,INVERT:he,ITALIC:"italic",JOIN:Ne,LABEL:"label",LANDSCAPE:"landscape",LEFT:E,LEFT_ARROW:"ArrowLeft",LIGHTEST:W,LINEAR:ge,LINES:M,LINE_LOOP:2,LINE_STRIP:3,MIRROR:we,MITER:z,MOVE:c,MULTIPLY:K,NEAREST:ve,NORMAL:de,OPAQUE:oe,OPEN:L,OPTION:"Alt",OVERLAY:ee,P2D:r,P2DHDR:"p2d-hdr",PATH:8,PI:g,PIE:P,POINTS:T,PORTRAIT:"portrait",POSTERIZE:ue,PROJECT:N,QUADRATIC:"quadratic",QUADS:k,QUAD_STRIP:I,QUARTER_PI:m,RADIUS:C,RAD_TO_DEG:b,REMOVE:$,REPEAT:be,REPLACE:Q,RETURN:"Enter",RIGHT:A,RIGHT_ARROW:"ArrowRight",ROUND:V,SCREEN:J,SHIFT:"Shift",SIMPLE:o,SMOOTH:Ae,SOFT_LIGHT:ie,SQUARE:R,STROKE:"stroke",SUBTRACT:Y,TAB:"Tab",TAU:y,TESS:"tess",TEXT:p,TEXTURE:ye,THRESHOLD:se,TOP:"top",TRIANGLES:4,TRIANGLE_FAN:6,TRIANGLE_STRIP:5,TWO_PI:x,UNSIGNED_BYTE:ke,UNSIGNED_INT:Ie,UP_ARROW:"ArrowUp",VERSION:i,WAIT:d,WEBGL:n,WEBGL2:s,WORD:fe,_CTX_MIDDLE:"middle",_DEFAULT_FILL:De,_DEFAULT_LEADMULT:1.25,_DEFAULT_STROKE:Ee,_DEFAULT_TEXT_FILL:"#000000"});function Ve(e,t){t.applyMatrix=function(...e){let t=e[0]instanceof Object.getPrototypeOf(Uint8Array);return Array.isArray(e[0])||t?this._renderer.applyMatrix(...e[0]):this._renderer.applyMatrix(...e),this},t.resetMatrix=function(){return this._renderer.resetMatrix(),this},t.rotate=function(e,t){return this._renderer.rotate(this._toRadians(e),t),this},t.rotateX=function(e){return this._assert3d("rotateX"),this._renderer.rotateX(this._toRadians(e)),this},t.rotateY=function(e){return this._assert3d("rotateY"),this._renderer.rotateY(this._toRadians(e)),this},t.rotateZ=function(e){return this._assert3d("rotateZ"),this._renderer.rotateZ(this._toRadians(e)),this},t.scale=function(t,i,r){if(t instanceof e.Vector){const e=t;t=e.x,i=e.y,r=e.z}else if(Array.isArray(t)){const e=t;t=e[0],i=e[1],r=e[2]||1}return isNaN(i)?i=r=t:isNaN(r)&&(r=1),this._renderer.scale(t,i,r),this},t.shearX=function(e){const t=this._toRadians(e);return this._renderer.applyMatrix(1,0,Math.tan(t),1,0,0),this},t.shearY=function(e){const t=this._toRadians(e);return this._renderer.applyMatrix(1,Math.tan(t),0,1,0,0),this},t.translate=function(e,t,i){return this._renderer.isP3D?this._renderer.translate(e,t,i):this._renderer.translate(e,t),this},t.push=function(){this._renderer.push()},t.pop=function(){this._renderer.pop()}}function Ue(e,t){t.noLoop=function(){this._loop=!1},t.loop=function(){this._loop||(this._loop=!0,this._setupDone&&this._draw())},t.isLooping=function(){return this._loop},t.redraw=async function(e){if(this._inUserDraw||!this._setupDone)return;let t=parseInt(e);(isNaN(t)||t<1)&&(t=1);const i=this._isGlobal?window:this;if("function"==typeof i.draw){void 0===i.setup&&i.scale(i._pixelDensity,i._pixelDensity);for(let e=0;e<t;e++){i.resetMatrix(),(this._accessibleOutputs.grid||this._accessibleOutputs.text)&&this._updateAccsOutput(),this._renderer.isP3D&&this._renderer._update(),this.frameCount=i.frameCount+1,await this._runLifecycleHook("predraw"),this._inUserDraw=!0;try{await i.draw()}finally{this._inUserDraw=!1}await this._runLifecycleHook("postdraw")}}}}function ze(e,t,i){const n=[a,u,l,c,p,d];t._frameRate=0,t._lastFrameTime=window.performance.now(),t._targetFrameRate=60;const s=window.print;let o=!1;function h(){return window.innerWidth||document.documentElement&&document.documentElement.clientWidth||document.body&&document.body.clientWidth||0}function f(){return window.innerHeight||document.documentElement&&document.documentElement.clientHeight||document.body&&document.body.clientHeight||0}i.presetup=function(){const e=["resize"];for(const t of e)window.addEventListener(t,this[`_on${t}`].bind(this),{passive:!1,signal:this._removeSignal})},t.print=function(...e){e.length?console.log(...e):o||(s(),window.confirm("You just tried to print the webpage. Do you want to prevent this from running again?")&&(o=!0))},t.frameCount=0,t.deltaTime=0,t.focused=document.hasFocus(),t.cursor=function(e,t,i){let r="auto";const s=this._curElement.elt;if(n.includes(e))r=e;else if("string"==typeof e){let n="";t&&i&&"number"==typeof t&&"number"==typeof i&&(n=`${t} ${i}`),r="http://"===e.substring(0,7)||"https://"===e.substring(0,8)||/\.(cur|jpg|jpeg|gif|png|CUR|JPG|JPEG|GIF|PNG)$/.test(e)?`url(${e}) ${n}, auto`:e}s.style.cursor=r},t.frameRate=function(e){return"number"!=typeof e||e<0?this._frameRate:(this._targetFrameRate=e,0===e&&(this._frameRate=e),this)},t.getFrameRate=function(){return this.frameRate()},t.setFrameRate=function(e){return this.frameRate(e)},t.getTargetFrameRate=function(){return this._targetFrameRate},t.noCursor=function(){this._curElement.elt.style.cursor="none"},t.webglVersion=r,t.displayWidth=screen.width,t.displayHeight=screen.height,t.windowWidth=0,t.windowHeight=0,t._onresize=function(e){let t;this.windowWidth=h(),this.windowHeight=f(),"function"==typeof this._customActions.windowResized&&(t=this._customActions.windowResized(e),void 0===t||t||e.preventDefault())},t._updateWindowSize=function(){this.windowWidth=h(),this.windowHeight=f()},Object.defineProperty(t,"width",{get(){return this._renderer.width}}),Object.defineProperty(t,"height",{get(){return this._renderer.height}}),t.fullscreen=function(e){if(void 0===e)return document.fullscreenElement||document.webkitFullscreenElement||document.mozFullScreenElement||document.msFullscreenElement;e?function(e){if(!(document.fullscreenEnabled||document.webkitFullscreenEnabled||document.mozFullScreenEnabled||document.msFullscreenEnabled))throw new Error("Fullscreen not enabled in this browser.");e.requestFullscreen?e.requestFullscreen():e.mozRequestFullScreen?e.mozRequestFullScreen():e.webkitRequestFullscreen?e.webkitRequestFullscreen():e.msRequestFullscreen&&e.msRequestFullscreen()}(document.documentElement):document.exitFullscreen?document.exitFullscreen():document.mozCancelFullScreen?document.mozCancelFullScreen():document.webkitExitFullscreen?document.webkitExitFullscreen():document.msExitFullscreen&&document.msExitFullscreen()},t.pixelDensity=function(e){let t;return"number"==typeof e?(e!==this._renderer._pixelDensity&&(this._renderer._pixelDensity=e),t=this,this.resizeCanvas(this.width,this.height,!0)):t=this._renderer._pixelDensity,t},t.displayDensity=()=>window.devicePixelRatio,t.getURL=()=>location.href,t.getURLPath=()=>location.pathname.split("/").filter((e=>""!==e)),t.getURLParams=function(){const e=/[?&]([^&=]+)(?:[&=])([^&=]+)/gim;let t;const i={};for(;null!=(t=e.exec(location.search));)t.index===e.lastIndex&&e.lastIndex++,i[t[1]]=t[2];return i},t.worldToScreen=function(e){"number"==typeof e&&(e=this.createVector(...arguments));return this._renderer.getWorldToScreenMatrix().multiplyAndNormalizePoint(e)},t.screenToWorld=function(e){"number"==typeof e&&(e=this.createVector(...arguments));const t=this._renderer.getWorldToScreenMatrix();if(2===e.dimensions){let i=t.mat4[14]/t.mat4[15];e=this.createVector(e.x,e.y,i)}return t.invert(t).multiplyAndNormalizePoint(e)}}function Ge(e,t){let i=e.length;Array.isArray(e[0])||(e=[e]),Array.isArray(t[0])||(t=t.map((e=>[e])));let r=t[0].length,n=t[0].map(((e,i)=>t.map((e=>e[i])))),s=e.map((e=>n.map((t=>{let i=0;if(!Array.isArray(e)){for(let r of t)i+=e*r;return i}for(let r=0;r<e.length;r++)i+=e[r]*(t[r]||0);return i}))));return 1===i&&(s=s[0]),1===r?s.map((e=>e[0])):s}function je(e){return"string"===$e(e)}function $e(e){return(Object.prototype.toString.call(e).match(/^\[object\s+(.*?)\]$/)[1]||"").toLowerCase()}function qe(e,{precision:t,unit:i}){return He(e)?"none":function(e,t){if(0===e)return 0;let i=~~e,r=0;i&&t&&(r=1+~~Math.log10(Math.abs(i)));const n=10**(t-r);return Math.floor(e*n+.5)/n}(e,t)+(i??"")}function He(e){return Number.isNaN(e)||e instanceof Number&&e?.none}void 0!==p5&&Ve(p5,p5.prototype),void 0!==p5&&Ue(0,p5.prototype),void 0!==p5&&ze(0,p5.prototype);const We={deg:1,grad:.9,rad:180/Math.PI,turn:360};function Xe(e){return e[e.length-1]}function Ye(e,t,i){return isNaN(e)?t:isNaN(t)?e:e+(t-e)*i}function Ze(e,t,i){return Ye(t[0],t[1],function(e,t,i){return(i-e)/(t-e)}(e[0],e[1],i))}function Ke(e,t){return Math.sign(e)===Math.sign(t)?e:-e}function Je(e,t){return Ke(Math.abs(e)**t,e)}function Qe(e,t){return 0===t?0:e/t}const et=new class{add(e,t,i){if("string"==typeof arguments[0])(Array.isArray(e)?e:[e]).forEach((function(e){this[e]=this[e]||[],t&&this[e][i?"unshift":"push"](t)}),this);else for(var e in arguments[0])this.add(e,arguments[0][e],arguments[1])}run(e,t){this[e]=this[e]||[],this[e].forEach((function(e){e.call(t&&t.context?t.context:t,t)}))}},tt={D50:[.3457/.3585,1,.2958/.3585],D65:[.3127/.329,1,.3583/.329]};function it(e){return Array.isArray(e)?e:tt[e]}function rt(e,t,i,r={}){if(e=it(e),t=it(t),!e||!t)throw new TypeError(`Missing white point to convert ${e?"":"from"}${e||t?"":"/"}${t?"":"to"}`);if(e===t)return i;let n={W1:e,W2:t,XYZ:i,options:r};if(et.run("chromatic-adaptation-start",n),n.M||(n.W1===tt.D65&&n.W2===tt.D50?n.M=[[1.0479297925449969,.022946870601609652,-.05019226628920524],[.02962780877005599,.9904344267538799,-.017073799063418826],[-.009243040646204504,.015055191490298152,.7518742814281371]]:n.W1===tt.D50&&n.W2===tt.D65&&(n.M=[[.955473421488075,-.02309845494876471,.06325924320057072],[-.0283697093338637,1.0099953980813041,.021041441191917323],[.012314014864481998,-.020507649298898964,1.330365926242124]])),et.run("chromatic-adaptation-end",n),n.M)return Ge(n.M,n.XYZ);throw new TypeError("Only Bradford CAT with white points D50 and D65 supported for now.")}var nt={gamut_mapping:"css",precision:5,deltaE:"76",verbose:"test"!==globalThis?.process?.env?.NODE_ENV?.toLowerCase(),warn:function(e){this.verbose&&globalThis?.console?.warn?.(e)}};const st=new Set(["<number>","<percentage>","<angle>"]);function at(e,t,i,r){let n=Object.entries(e.coords).map((([e,n],s)=>{let a,o=t.coordGrammar[s],h=r[s],u=h?.type;if(a=h.none?o.find((e=>st.has(e))):o.find((e=>e==u)),!a){let t=n.name||e;throw new TypeError(`${u??h.raw} not allowed for ${t} in ${i}()`)}let l=a.range;"<percentage>"===u&&(l||=[0,1]);let c=n.range||n.refRange;return l&&c&&(r[s]=Ze(l,c,r[s])),a}));return n}function ot(e,{meta:t}={}){let i={str:String(e)?.trim()};if(et.run("parse-start",i),i.color)return i.color;if(i.parsed=function(e){if(!e)return;e=e.trim();const t=/^-?[\d.]+$/,i=/%|deg|g?rad|turn$/,r=/\/?\s*(none|[-\w.]+(?:%|deg|g?rad|turn)?)/g;let n=e.match(/^([a-z]+)\((.+?)\)$/i);if(n){let e=[];return n[2].replace(r,((r,n)=>{let s=n.match(i),a=n;if(s){let e=s[0],t=a.slice(0,-e.length);"%"===e?(a=new Number(t/100),a.type="<percentage>"):(a=new Number(t*We[e]),a.type="<angle>",a.unit=e)}else t.test(a)?(a=new Number(a),a.type="<number>"):"none"===a&&(a=new Number(NaN),a.none=!0);r.startsWith("/")&&(a=a instanceof Number?a:new Number(a),a.alpha=!0),"object"==typeof a&&a instanceof Number&&(a.raw=n),e.push(a)})),{name:n[1].toLowerCase(),rawName:n[1],rawArgs:n[2],args:e}}}(i.str),i.parsed){let e=i.parsed.name;if("color"===e){let e=i.parsed.args.shift(),r=e.startsWith("--")?e.substring(2):`--${e}`,n=[e,r],s=i.parsed.rawArgs.indexOf("/")>0?i.parsed.args.pop():1;for(let r of ut.all){let a=r.getFormat("color");if(a&&(n.includes(a.id)||a.ids?.filter((e=>n.includes(e))).length)){const n=Object.keys(r.coords).map(((e,t)=>i.parsed.args[t]||0));let o;return a.coordGrammar&&(o=at(r,a,"color",n)),t&&Object.assign(t,{formatId:"color",types:o}),a.id.startsWith("--")&&!e.startsWith("--")&&nt.warn(`${r.name} is a non-standard space and not currently supported in the CSS spec. Use prefixed color(${a.id}) instead of color(${e}).`),e.startsWith("--")&&!a.id.startsWith("--")&&nt.warn(`${r.name} is a standard space and supported in the CSS spec. Use color(${a.id}) instead of prefixed color(${e}).`),{spaceId:r.id,coords:n,alpha:s}}}let a="",o=e in ut.registry?e:r;if(o in ut.registry){let e=ut.registry[o].formats?.color?.id;e&&(a=`Did you mean color(${e})?`)}throw new TypeError(`Cannot parse color(${e}). `+(a||"Missing a plugin?"))}for(let r of ut.all){let n=r.getFormat(e);if(n&&"function"===n.type){let s=1;(n.lastAlpha||Xe(i.parsed.args).alpha)&&(s=i.parsed.args.pop());let a,o=i.parsed.args;return n.coordGrammar&&(a=at(r,n,e,o)),t&&Object.assign(t,{formatId:n.name,types:a}),{spaceId:r.id,coords:o,alpha:s}}}}else for(let e of ut.all)for(let r in e.formats){let n=e.formats[r];if("custom"!==n.type)continue;if(n.test&&!n.test(i.str))continue;let s=n.parse(i.str);if(s)return s.alpha??=1,t&&(t.formatId=r),s}throw new TypeError(`Could not parse ${e} as a color. Missing a plugin?`)}function ht(e){if(Array.isArray(e))return e.map(ht);if(!e)throw new TypeError("Empty color reference");je(e)&&(e=ot(e));let t=e.space||e.spaceId;return t instanceof ut||(e.space=ut.get(t)),void 0===e.alpha&&(e.alpha=1),e}class ut{constructor(e){this.id=e.id,this.name=e.name,this.base=e.base?ut.get(e.base):null,this.aliases=e.aliases,this.base&&(this.fromBase=e.fromBase,this.toBase=e.toBase);let t=e.coords??this.base.coords;for(let e in t)"name"in t[e]||(t[e].name=e);this.coords=t;let i=e.white??this.base.white??"D65";this.white=it(i),this.formats=e.formats??{};for(let e in this.formats){let t=this.formats[e];t.type||="function",t.name||=e}this.formats.color?.id||(this.formats.color={...this.formats.color??{},id:e.cssId||this.id}),e.gamutSpace?this.gamutSpace="self"===e.gamutSpace?this:ut.get(e.gamutSpace):this.isPolar?this.gamutSpace=this.base:this.gamutSpace=this,this.gamutSpace.isUnbounded&&(this.inGamut=(e,t)=>!0),this.referred=e.referred,Object.defineProperty(this,"path",{value:lt(this).reverse(),writable:!1,enumerable:!0,configurable:!0}),et.run("colorspace-init-end",this)}inGamut(e,{epsilon:t=75e-6}={}){if(!this.equals(this.gamutSpace))return e=this.to(this.gamutSpace,e),this.gamutSpace.inGamut(e,{epsilon:t});let i=Object.values(this.coords);return e.every(((e,r)=>{let n=i[r];if("angle"!==n.type&&n.range){if(Number.isNaN(e))return!0;let[i,r]=n.range;return(void 0===i||e>=i-t)&&(void 0===r||e<=r+t)}return!0}))}get isUnbounded(){return Object.values(this.coords).every((e=>!("range"in e)))}get cssId(){return this.formats?.color?.id||this.id}get isPolar(){for(let e in this.coords)if("angle"===this.coords[e].type)return!0;return!1}getFormat(e){if("object"==typeof e)return e=ct(e,this);let t;return t="default"===e?Object.values(this.formats)[0]:this.formats[e],t?(t=ct(t,this),t):null}equals(e){return!!e&&(this===e||this.id===e||this.id===e.id)}to(e,t){if(1===arguments.length){const i=ht(e);[e,t]=[i.space,i.coords]}if(e=ut.get(e),this.equals(e))return t;t=t.map((e=>Number.isNaN(e)?0:e));let i,r,n=this.path,s=e.path;for(let e=0;e<n.length&&n[e].equals(s[e]);e++)i=n[e],r=e;if(!i)throw new Error(`Cannot convert between color spaces ${this} and ${e}: no connection space was found`);for(let e=n.length-1;e>r;e--)t=n[e].toBase(t);for(let e=r+1;e<s.length;e++)t=s[e].fromBase(t);return t}from(e,t){if(1===arguments.length){const i=ht(e);[e,t]=[i.space,i.coords]}return(e=ut.get(e)).to(this,t)}toString(){return`${this.name} (${this.id})`}getMinCoords(){let e=[];for(let t in this.coords){let i=this.coords[t],r=i.range||i.refRange;e.push(r?.min??0)}return e}static registry={};static get all(){return[...new Set(Object.values(ut.registry))]}static register(e,t){if(1===arguments.length&&(e=(t=arguments[0]).id),t=this.get(t),this.registry[e]&&this.registry[e]!==t)throw new Error(`Duplicate color space registration: '${e}'`);if(this.registry[e]=t,1===arguments.length&&t.aliases)for(let e of t.aliases)this.register(e,t);return t}static get(e,...t){if(!e||e instanceof ut)return e;if("string"===$e(e)){let t=ut.registry[e.toLowerCase()];if(!t)throw new TypeError(`No color space found with id = "${e}"`);return t}if(t.length)return ut.get(...t);throw new TypeError(`${e} is not a valid color space`)}static resolveCoord(e,t){let i,r,n=$e(e);if("string"===n?e.includes(".")?[i,r]=e.split("."):[i,r]=[,e]:Array.isArray(e)?[i,r]=e:(i=e.space,r=e.coordId),i=ut.get(i),i||(i=t),!i)throw new TypeError(`Cannot resolve coordinate reference ${e}: No color space specified and relative references are not allowed here`);if(n=$e(r),"number"===n||"string"===n&&r>=0){let e=Object.entries(i.coords)[r];if(e)return{space:i,id:e[0],index:r,...e[1]}}i=ut.get(i);let s=r.toLowerCase(),a=0;for(let e in i.coords){let t=i.coords[e];if(e.toLowerCase()===s||t.name?.toLowerCase()===s)return{space:i,id:e,index:a,...t};a++}throw new TypeError(`No "${r}" coordinate found in ${i.name}. Its coordinates are: ${Object.keys(i.coords).join(", ")}`)}static DEFAULT_FORMAT={type:"functions",name:"color"}}function lt(e){let t=[e];for(let i=e;i=i.base;)t.push(i);return t}function ct(e,{coords:t}={}){if(e.coords&&!e.coordGrammar){e.type||="function",e.name||="color",e.coordGrammar=e.coords.map((e=>e.split("|").map((e=>{let t=(e=e.trim()).match(/^(<[a-z]+>)\[(-?[.\d]+),\s*(-?[.\d]+)\]?$/);if(t){let e=new String(t[1]);return e.range=[+t[2],+t[3]],e}return e}))));let i=Object.entries(t).map((([t,i],r)=>{let n=e.coordGrammar[r][0],s=i.range||i.refRange,a=n.range,o="";return"<percentage>"==n?(a=[0,100],o="%"):"<angle>"==n&&(o="deg"),{fromRange:s,toRange:a,suffix:o}}));e.serializeCoords=(e,t)=>e.map(((e,r)=>{let{fromRange:n,toRange:s,suffix:a}=i[r];return n&&s&&(e=Ze(n,s,e)),e=qe(e,{precision:t,unit:a})}))}return e}var pt=new ut({id:"xyz-d65",name:"XYZ D65",coords:{x:{name:"X"},y:{name:"Y"},z:{name:"Z"}},white:"D65",formats:{color:{ids:["xyz-d65","xyz"]}},aliases:["xyz"]});class dt extends ut{constructor(e){e.coords||(e.coords={r:{range:[0,1],name:"Red"},g:{range:[0,1],name:"Green"},b:{range:[0,1],name:"Blue"}}),e.base||(e.base=pt),e.toXYZ_M&&e.fromXYZ_M&&(e.toBase??=t=>{let i=Ge(e.toXYZ_M,t);return this.white!==this.base.white&&(i=rt(this.white,this.base.white,i)),i},e.fromBase??=t=>(t=rt(this.base.white,this.white,t),Ge(e.fromXYZ_M,t))),e.referred??="display",super(e)}}function ft(e,t){return e=ht(e),!t||e.space.equals(t)?e.coords.slice():(t=ut.get(t)).from(e)}function gt(e,t){e=ht(e);let{space:i,index:r}=ut.resolveCoord(t,e.space);return ft(e,i)[r]}function mt(e,t,i){return e=ht(e),t=ut.get(t),e.coords=t.to(e.space,i),e}function yt(e,t,i){if(e=ht(e),2===arguments.length&&"object"===$e(arguments[1])){let t=arguments[1];for(let i in t)yt(e,i,t[i])}else{"function"==typeof i&&(i=i(gt(e,t)));let{space:r,index:n}=ut.resolveCoord(t,e.space),s=ft(e,r);s[n]=i,mt(e,r,s)}return e}mt.returns="color",yt.returns="color";var xt=new ut({id:"xyz-d50",name:"XYZ D50",white:"D50",base:pt,fromBase:e=>rt(pt.white,"D50",e),toBase:e=>rt("D50",pt.white,e)});const vt=216/24389,bt=24/116,_t=24389/27;let wt=tt.D50;var Ct=new ut({id:"lab",name:"Lab",coords:{l:{refRange:[0,100],name:"Lightness"},a:{refRange:[-125,125]},b:{refRange:[-125,125]}},white:wt,base:xt,fromBase(e){let t=e.map(((e,t)=>e/wt[t])),i=t.map((e=>e>vt?Math.cbrt(e):(_t*e+16)/116));return[116*i[1]-16,500*(i[0]-i[1]),200*(i[1]-i[2])]},toBase(e){let t=[];return t[1]=(e[0]+16)/116,t[0]=e[1]/500+t[1],t[2]=t[1]-e[2]/200,[t[0]>bt?Math.pow(t[0],3):(116*t[0]-16)/_t,e[0]>8?Math.pow((e[0]+16)/116,3):e[0]/_t,t[2]>bt?Math.pow(t[2],3):(116*t[2]-16)/_t].map(((e,t)=>e*wt[t]))},formats:{lab:{coords:["<number> | <percentage>","<number> | <percentage>[-1,1]","<number> | <percentage>[-1,1]"]}}});function At(e){return(e%360+360)%360}var Et=new ut({id:"lch",name:"LCH",coords:{l:{refRange:[0,100],name:"Lightness"},c:{refRange:[0,150],name:"Chroma"},h:{refRange:[0,360],type:"angle",name:"Hue"}},base:Ct,fromBase(e){let t,[i,r,n]=e;return t=Math.abs(r)<.02&&Math.abs(n)<.02?NaN:180*Math.atan2(n,r)/Math.PI,[i,Math.sqrt(r**2+n**2),At(t)]},toBase(e){let[t,i,r]=e;return i<0&&(i=0),isNaN(r)&&(r=0),[t,i*Math.cos(r*Math.PI/180),i*Math.sin(r*Math.PI/180)]},formats:{lch:{coords:["<number> | <percentage>","<number> | <percentage>","<number> | <angle>"]}}});const Dt=25**7,St=Math.PI,Ft=180/St,Tt=St/180;function Mt(e){const t=e*e;return t*t*t*e}function kt(e,t,{kL:i=1,kC:r=1,kH:n=1}={}){[e,t]=ht([e,t]);let[s,a,o]=Ct.from(e),h=Et.from(Ct,[s,a,o])[1],[u,l,c]=Ct.from(t),p=Et.from(Ct,[u,l,c])[1];h<0&&(h=0),p<0&&(p=0);let d=Mt((h+p)/2),f=.5*(1-Math.sqrt(d/(d+Dt))),g=(1+f)*a,m=(1+f)*l,y=Math.sqrt(g**2+o**2),x=Math.sqrt(m**2+c**2),v=0===g&&0===o?0:Math.atan2(o,g),b=0===m&&0===c?0:Math.atan2(c,m);v<0&&(v+=2*St),b<0&&(b+=2*St),v*=Ft,b*=Ft;let _,w=u-s,C=x-y,A=b-v,E=v+b,D=Math.abs(A);y*x==0?_=0:D<=180?_=A:A>180?_=A-360:A<-180?_=A+360:nt.warn("the unthinkable has happened");let S,F=2*Math.sqrt(x*y)*Math.sin(_*Tt/2),T=(s+u)/2,M=(y+x)/2,k=Mt(M);S=y*x==0?E:D<=180?E/2:E<360?(E+360)/2:(E-360)/2;let I=(T-50)**2,B=1+.015*I/Math.sqrt(20+I),L=1+.045*M,O=1;O-=.17*Math.cos((S-30)*Tt),O+=.24*Math.cos(2*S*Tt),O+=.32*Math.cos((3*S+6)*Tt),O-=.2*Math.cos((4*S-63)*Tt);let P=1+.015*M*O,N=30*Math.exp(-1*((S-275)/25)**2),R=2*Math.sqrt(k/(k+Dt)),V=(w/(i*B))**2;return V+=(C/(r*L))**2,V+=(F/(n*P))**2,V+=-1*Math.sin(2*N*Tt)*R*(C/(r*L))*(F/(n*P)),Math.sqrt(V)}const It=[[.819022437996703,.3619062600528904,-.1288737815209879],[.0329836539323885,.9292868615863434,.0361446663506424],[.0481771893596242,.2642395317527308,.6335478284694309]],Bt=[[1.2268798758459243,-.5578149944602171,.2813910456659647],[-.0405757452148008,1.112286803280317,-.0717110580655164],[-.0763729366746601,-.4214933324022432,1.5869240198367816]],Lt=[[.210454268309314,.7936177747023054,-.0040720430116193],[1.9779985324311684,-2.42859224204858,.450593709617411],[.0259040424655478,.7827717124575296,-.8086757549230774]],Ot=[[1,.3963377773761749,.2158037573099136],[1,-.1055613458156586,-.0638541728258133],[1,-.0894841775298119,-1.2914855480194092]];var Pt=new ut({id:"oklab",name:"Oklab",coords:{l:{refRange:[0,1],name:"Lightness"},a:{refRange:[-.4,.4]},b:{refRange:[-.4,.4]}},white:"D65",base:pt,fromBase(e){let t=Ge(It,e).map((e=>Math.cbrt(e)));return Ge(Lt,t)},toBase(e){let t=Ge(Ot,e).map((e=>e**3));return Ge(Bt,t)},formats:{oklab:{coords:["<percentage> | <number>","<number> | <percentage>[-1,1]","<number> | <percentage>[-1,1]"]}}});function Nt(e,t){[e,t]=ht([e,t]);let[i,r,n]=Pt.from(e),[s,a,o]=Pt.from(t),h=i-s,u=r-a,l=n-o;return Math.sqrt(h**2+u**2+l**2)}function Rt(e,t,{epsilon:i=75e-6}={}){e=ht(e),t||(t=e.space),t=ut.get(t);let r=e.coords;return t!==e.space&&(r=t.from(e)),t.inGamut(r,{epsilon:i})}function Vt(e){return{space:e.space,coords:e.coords.slice(),alpha:e.alpha}}const Ut=Math.PI/180;var zt=new ut({id:"xyz-abs-d65",cssId:"--xyz-abs-d65",name:"Absolute XYZ D65",coords:{x:{refRange:[0,9504.7],name:"Xa"},y:{refRange:[0,1e4],name:"Ya"},z:{refRange:[0,10888.3],name:"Za"}},base:pt,fromBase:e=>e.map((e=>Math.max(203*e,0))),toBase:e=>e.map((e=>Math.max(e/203,0)))});const Gt=1.15,jt=.66,$t=2610/16384,qt=16384/2610,Ht=.8359375,Wt=2413/128,Xt=18.6875,Yt=1.7*2523/32,Zt=32/(1.7*2523),Kt=-.56,Jt=16295499532821565e-27,Qt=[[.41478972,.579999,.014648],[-.20151,1.120649,.0531008],[-.0166008,.2648,.6684799]],ei=[[1.9242264357876067,-1.0047923125953657,.037651404030618],[.35031676209499907,.7264811939316552,-.06538442294808501],[-.09098281098284752,-.3127282905230739,1.5227665613052603]],ti=[[.5,.5,0],[3.524,-4.066708,.542708],[.199076,1.096799,-1.295875]],ii=[[1,.1386050432715393,.05804731615611886],[.9999999999999999,-.1386050432715393,-.05804731615611886],[.9999999999999998,-.09601924202631895,-.8118918960560388]];var ri=new ut({id:"jzazbz",name:"Jzazbz",coords:{jz:{refRange:[0,1],name:"Jz"},az:{refRange:[-.5,.5]},bz:{refRange:[-.5,.5]}},base:zt,fromBase(e){let[t,i,r]=e,n=Ge(Qt,[Gt*t-(Gt-1)*r,jt*i-(jt-1)*t,r]).map((function(e){return((Ht+Wt*(e/1e4)**$t)/(1+Xt*(e/1e4)**$t))**Yt})),[s,a,o]=Ge(ti,n);return[(1+Kt)*s/(1+Kt*s)-Jt,a,o]},toBase(e){let[t,i,r]=e,n=Ge(ii,[(t+Jt)/(1+Kt-Kt*(t+Jt)),i,r]).map((function(e){return 1e4*((Ht-e**Zt)/(Xt*e**Zt-Wt))**qt})),[s,a,o]=Ge(ei,n),h=(s+(Gt-1)*o)/Gt;return[h,(a+(jt-1)*h)/jt,o]},formats:{color:{coords:["<number> | <percentage>","<number> | <percentage>[-1,1]","<number> | <percentage>[-1,1]"]}}}),ni=new ut({id:"jzczhz",name:"JzCzHz",coords:{jz:{refRange:[0,1],name:"Jz"},cz:{refRange:[0,1],name:"Chroma"},hz:{refRange:[0,360],type:"angle",name:"Hue"}},base:ri,fromBase(e){let t,[i,r,n]=e;const s=2e-4;return t=Math.abs(r)<s&&Math.abs(n)<s?NaN:180*Math.atan2(n,r)/Math.PI,[i,Math.sqrt(r**2+n**2),At(t)]},toBase:e=>[e[0],e[1]*Math.cos(e[2]*Math.PI/180),e[1]*Math.sin(e[2]*Math.PI/180)]});const si=.8359375,ai=2413/128,oi=18.6875,hi=2610/16384,ui=2523/32,li=16384/2610,ci=32/2523,pi=[[.3592832590121217,.6976051147779502,-.035891593232029],[-.1920808463704993,1.100476797037432,.0753748658519118],[.0070797844607479,.0748396662186362,.8433265453898765]],di=[[.5,.5,0],[6610/4096,-13613/4096,7003/4096],[17933/4096,-17390/4096,-543/4096]],fi=[[.9999999999999998,.0086090370379328,.111029625003026],[.9999999999999998,-.0086090370379328,-.1110296250030259],[.9999999999999998,.5600313357106791,-.3206271749873188]],gi=[[2.0701522183894223,-1.3263473389671563,.2066510476294053],[.3647385209748072,.6805660249472273,-.0453045459220347],[-.0497472075358123,-.0492609666966131,1.1880659249923042]];var mi=new ut({id:"ictcp",name:"ICTCP",coords:{i:{refRange:[0,1],name:"I"},ct:{refRange:[-.5,.5],name:"CT"},cp:{refRange:[-.5,.5],name:"CP"}},base:zt,fromBase:e=>function(e){let t=e.map((function(e){return((si+ai*(e/1e4)**hi)/(1+oi*(e/1e4)**hi))**ui}));return Ge(di,t)}(Ge(pi,e)),toBase(e){let t=function(e){let t=Ge(fi,e),i=t.map((function(e){return 1e4*(Math.max(e**ci-si,0)/(ai-oi*e**ci))**li}));return i}(e);return Ge(gi,t)}});const yi=tt.D65,xi=1/.42,vi=2*Math.PI,bi=[[.401288,.650173,-.051461],[-.250268,1.204414,.045854],[-.002079,.048952,.953127]],_i=[[1.8620678550872327,-1.0112546305316843,.14918677544445175],[.38752654323613717,.6214474419314753,-.008973985167612518],[-.015841498849333856,-.03412293802851557,1.0499644368778496]],wi=[[460,451,288],[460,-891,-261],[460,-220,-6300]],Ci={dark:[.8,.525,.8],dim:[.9,.59,.9],average:[1,.69,1]},Ai={h:[20.14,90,164.25,237.53,380.14],e:[.8,.7,1,1.2,.8],H:[0,100,200,300,400]},Ei=180/Math.PI,Di=Math.PI/180;function Si(e,t){return e.map((e=>{const i=Je(t*Math.abs(e)*.01,.42);return 400*Ke(i,e)/(i+27.13)}))}function Fi(e,t,i,r,n){const s={};s.discounting=n,s.refWhite=e,s.surround=r;const a=e.map((e=>100*e));s.la=t,s.yb=i;const o=a[1],h=Ge(bi,a),u=(r=Ci[s.surround])[0];s.c=r[1],s.nc=r[2];const l=(1/(5*s.la+1))**4;s.fl=l*s.la+.1*(1-l)*(1-l)*Math.cbrt(5*s.la),s.flRoot=s.fl**.25,s.n=s.yb/o,s.z=1.48+Math.sqrt(s.n),s.nbb=.725*s.n**-.2,s.ncb=s.nbb;const c=Math.max(Math.min(u*(1-1/3.6*Math.exp((-s.la-42)/92)),1),0);s.dRgb=h.map((e=>Ye(1,o/e,c))),s.dRgbInv=s.dRgb.map((e=>1/e));const p=h.map(((e,t)=>e*s.dRgb[t])),d=Si(p,s.fl);return s.aW=s.nbb*(2*d[0]+d[1]+.05*d[2]),s}const Ti=Fi(yi,64/Math.PI*.2,20,"average",!1);function Mi(e,t){if(!(void 0!==e.J^void 0!==e.Q))throw new Error("Conversion requires one and only one: 'J' or 'Q'");if(!(void 0!==e.C^void 0!==e.M^void 0!==e.s))throw new Error("Conversion requires one and only one: 'C', 'M' or 's'");if(!(void 0!==e.h^void 0!==e.H))throw new Error("Conversion requires one and only one: 'h' or 'H'");if(0===e.J||0===e.Q)return[0,0,0];let i=0;i=void 0!==e.h?At(e.h)*Di:function(e){let t=(e%400+400)%400;const i=Math.floor(.01*t);t%=100;const[r,n]=Ai.h.slice(i,i+2),[s,a]=Ai.e.slice(i,i+2);return At((t*(a*r-s*n)-100*r*a)/(t*(a-s)-100*a))}(e.H)*Di;const r=Math.cos(i),n=Math.sin(i);let s=0;void 0!==e.J?s=.1*Je(e.J,.5):void 0!==e.Q&&(s=.25*t.c*e.Q/((t.aW+4)*t.flRoot));let a=0;void 0!==e.C?a=e.C/s:void 0!==e.M?a=e.M/t.flRoot/s:void 0!==e.s&&(a=4e-4*e.s**2*(t.aW+4)/t.c);const o=Je(a*Math.pow(1.64-Math.pow(.29,t.n),-.73),10/9),h=.25*(Math.cos(i+2)+3.8),u=t.aW*Je(s,2/t.c/t.z),l=5e4/13*t.nc*t.ncb*h,c=u/t.nbb,p=23*(c+.305)*Qe(o,23*l+o*(11*r+108*n)),d=function(e,t){const i=100/t*2588.068098016295;return e.map((e=>{const t=Math.abs(e);return Ke(i*Je(t/(400-t),xi),e)}))}(Ge(wi,[c,p*r,p*n]).map((e=>1*e/1403)),t.fl);return Ge(_i,d.map(((e,i)=>e*t.dRgbInv[i]))).map((e=>e/100))}function ki(e,t){const i=e.map((e=>100*e)),r=Si(Ge(bi,i).map(((e,i)=>e*t.dRgb[i])),t.fl),n=r[0]+(-12*r[1]+r[2])/11,s=(r[0]+r[1]-2*r[2])/9,a=(Math.atan2(s,n)%vi+vi)%vi,o=.25*(Math.cos(a+2)+3.8),h=Je(5e4/13*t.nc*t.ncb*Qe(o*Math.sqrt(n**2+s**2),r[0]+r[1]+1.05*r[2]+.305),.9)*Math.pow(1.64-Math.pow(.29,t.n),.73),u=Je(t.nbb*(2*r[0]+r[1]+.05*r[2])/t.aW,.5*t.c*t.z),l=100*Je(u,2),c=4/t.c*u*(t.aW+4)*t.flRoot,p=h*u,d=p*t.flRoot,f=At(a*Ei),g=function(e){let t=At(e);t<=Ai.h[0]&&(t+=360);const i=function(e,t,i=0,r=e.length){for(;i<r;){const n=i+r>>1;e[n]<t?i=n+1:r=n}return i}(Ai.h,t)-1,[r,n]=Ai.h.slice(i,i+2),[s,a]=Ai.e.slice(i,i+2),o=(t-r)/s;return Ai.H[i]+100*o/(o+(n-t)/a)}(f);return{J:l,C:p,h:f,s:50*Je(t.c*h/(t.aW+4),.5),Q:c,M:d,H:g}}new ut({id:"cam16-jmh",cssId:"--cam16-jmh",name:"CAM16-JMh",coords:{j:{refRange:[0,100],name:"J"},m:{refRange:[0,105],name:"Colorfulness"},h:{refRange:[0,360],type:"angle",name:"Hue"}},base:pt,fromBase(e){const t=ki(e,Ti);return[t.J,t.M,t.h]},toBase:e=>Mi({J:e[0],M:e[1],h:e[2]},Ti)});const Ii=216/24389,Bi=24389/27;function Li(e){return e>8?Math.pow((e+16)/116,3):e/Bi}function Oi(e,t){const i=116*((r=e[1])>Ii?Math.cbrt(r):(Bi*r+16)/116)-16;var r;if(0===i)return[0,0,0];const n=ki(e,Pi);return[At(n.h),n.C,i]}const Pi=Fi(tt.D65,200/Math.PI*Li(50),100*Li(50),"average",!1);var Ni=new ut({id:"hct",name:"HCT",coords:{h:{refRange:[0,360],type:"angle",name:"Hue"},c:{refRange:[0,145],name:"Colorfulness"},t:{refRange:[0,100],name:"Tone"}},base:pt,fromBase:e=>Oi(e),toBase:e=>function(e,t){let[i,r,n]=e,s=[],a=0;if(0===n)return[0,0,0];let o=Li(n);a=n>0?.00379058511492914*n**2+.608983189401032*n+.9155088574762233:9514440756550361e-21*n**2+.08693057439788597*n-21.928975842194614;let h=0,u=1/0;for(;h<=15;){s=Mi({J:a,C:r,h:i},t);const e=Math.abs(s[1]-o);if(e<u){if(e<=2e-12)return s;u=e}a-=(s[1]-o)*a/(2*s[1]),h+=1}return Mi({J:a,C:r,h:i},t)}(e,Pi),formats:{color:{id:"--hct",coords:["<number> | <angle>","<percentage> | <number>","<percentage> | <number>"]}}});const Ri=Math.PI/180,Vi=[1,.007,.0228];function Ui(e){e[1]<0&&(e=Ni.fromBase(Ni.toBase(e)));const t=Math.log(Math.max(1+Vi[2]*e[1]*Pi.flRoot,1))/Vi[2],i=e[0]*Ri,r=t*Math.cos(i),n=t*Math.sin(i);return[e[2],r,n]}var zi={deltaE76:function(e,t){return function(e,t,i="lab"){let r=(i=ut.get(i)).from(e),n=i.from(t);return Math.sqrt(r.reduce(((e,t,i)=>{let r=n[i];return isNaN(t)||isNaN(r)?e:e+(r-t)**2}),0))}(e,t,"lab")},deltaECMC:function(e,t,{l:i=2,c:r=1}={}){[e,t]=ht([e,t]);let[n,s,a]=Ct.from(e),[,o,h]=Et.from(Ct,[n,s,a]),[u,l,c]=Ct.from(t),p=Et.from(Ct,[u,l,c])[1];o<0&&(o=0),p<0&&(p=0);let d=n-u,f=o-p,g=(s-l)**2+(a-c)**2-f**2,m=.511;n>=16&&(m=.040975*n/(1+.01765*n));let y,x=.0638*o/(1+.0131*o)+.638;Number.isNaN(h)&&(h=0),y=h>=164&&h<=345?.56+Math.abs(.2*Math.cos((h+168)*Ut)):.36+Math.abs(.4*Math.cos((h+35)*Ut));let v=Math.pow(o,4),b=Math.sqrt(v/(v+1900)),_=(d/(i*m))**2;return _+=(f/(r*x))**2,_+=g/(x*(b*y+1-b))**2,Math.sqrt(_)},deltaE2000:kt,deltaEJz:function(e,t){[e,t]=ht([e,t]);let[i,r,n]=ni.from(e),[s,a,o]=ni.from(t),h=i-s,u=r-a;Number.isNaN(n)&&Number.isNaN(o)?(n=0,o=0):Number.isNaN(n)?n=o:Number.isNaN(o)&&(o=n);let l=n-o,c=2*Math.sqrt(r*a)*Math.sin(l/2*(Math.PI/180));return Math.sqrt(h**2+u**2+c**2)},deltaEITP:function(e,t){[e,t]=ht([e,t]);let[i,r,n]=mi.from(e),[s,a,o]=mi.from(t);return 720*Math.sqrt((i-s)**2+.25*(r-a)**2+(n-o)**2)},deltaEOK:Nt,deltaEHCT:function(e,t){[e,t]=ht([e,t]);let[i,r,n]=Ui(Ni.from(e)),[s,a,o]=Ui(Ni.from(t));return Math.sqrt((i-s)**2+(r-a)**2+(n-o)**2)}};const Gi={hct:{method:"hct.c",jnd:2,deltaEMethod:"hct",blackWhiteClamp:{}},"hct-tonal":{method:"hct.c",jnd:0,deltaEMethod:"hct",blackWhiteClamp:{channel:"hct.t",min:0,max:100}}};function ji(e,{method:t=nt.gamut_mapping,space:i,deltaEMethod:r="",jnd:n=2,blackWhiteClamp:s={}}={}){if(e=ht(e),je(arguments[1])?i=arguments[1]:i||(i=e.space),Rt(e,i=ut.get(i),{epsilon:0}))return e;let a;if("css"===t)a=function(e,{space:t}={}){const i=.02,r=1e-4;e=ht(e),t||(t=e.space);t=ut.get(t);const n=ut.get("oklch");if(t.isUnbounded)return qi(e,t);const s=qi(e,n);let a=s.coords[0];if(a>=1){const i=qi($i.WHITE,t);return i.alpha=e.alpha,qi(i,t)}if(a<=0){const i=qi($i.BLACK,t);return i.alpha=e.alpha,qi(i,t)}if(Rt(s,t,{epsilon:0}))return qi(s,t);function o(e){const i=qi(e,t),r=Object.values(t.coords);return i.coords=i.coords.map(((e,t)=>{if("range"in r[t]){const[i,n]=r[t].range;return function(e,t,i){return Math.max(Math.min(i,t),e)}(i,e,n)}return e})),i}let h=0,u=s.coords[1],l=!0,c=Vt(s),p=o(c),d=Nt(p,c);if(d<i)return p;for(;u-h>r;){const e=(h+u)/2;if(c.coords[1]=e,l&&Rt(c,t,{epsilon:0}))h=e;else if(p=o(c),d=Nt(p,c),d<i){if(i-d<r)break;l=!1,h=e}else u=e}return p}(e,{space:i});else{if("clip"===t||Rt(e,i))a=qi(e,i);else{Object.prototype.hasOwnProperty.call(Gi,t)&&({method:t,jnd:n,deltaEMethod:r,blackWhiteClamp:s}=Gi[t]);let o=kt;if(""!==r)for(let e in zi)if("deltae"+r.toLowerCase()===e.toLowerCase()){o=zi[e];break}let h=ji(qi(e,i),{method:"clip",space:i});if(o(e,h)>n){if(3===Object.keys(s).length){let t=ut.resolveCoord(s.channel),i=gt(qi(e,t.space),t.id);if(He(i)&&(i=0),i>=s.max)return qi({space:"xyz-d65",coords:tt.D65},e.space);if(i<=s.min)return qi({space:"xyz-d65",coords:[0,0,0]},e.space)}let r=ut.resolveCoord(t),h=r.space,u=r.id,l=qi(e,h);l.coords.forEach(((e,t)=>{He(e)&&(l.coords[t]=0)}));let c=(r.range||r.refRange)[0],p=function(e){const t=e?Math.floor(Math.log10(Math.abs(e))):0;return Math.max(parseFloat("1e"+(t-2)),1e-6)}(n),d=c,f=gt(l,u);for(;f-d>p;){let e=Vt(l);e=ji(e,{space:i,method:"clip"}),o(l,e)-n<p?d=gt(l,u):f=gt(l,u),yt(l,u,(d+f)/2)}a=qi(l,i)}else a=h}if("clip"===t||!Rt(a,i,{epsilon:0})){let e=Object.values(i.coords).map((e=>e.range||[]));a.coords=a.coords.map(((t,i)=>{let[r,n]=e[i];return void 0!==r&&(t=Math.max(r,t)),void 0!==n&&(t=Math.min(t,n)),t}))}}return i!==e.space&&(a=qi(a,e.space)),e.coords=a.coords,e}ji.returns="color";const $i={WHITE:{space:Pt,coords:[1,0,0]},BLACK:{space:Pt,coords:[0,0,0]}};function qi(e,t,{inGamut:i}={}){e=ht(e);let r=(t=ut.get(t)).from(e),n={space:t,coords:r,alpha:e.alpha};return i&&(n=ji(n,!0===i?void 0:i)),n}qi.returns="color";var Hi=new dt({id:"p3-linear",cssId:"--display-p3-linear",name:"Linear P3",white:"D65",toXYZ_M:[[.4865709486482162,.26566769316909306,.1982172852343625],[.2289745640697488,.6917385218365064,.079286914093745],[0,.04511338185890264,1.043944368900976]],fromXYZ_M:[[2.493496911941425,-.9313836179191239,-.40271078445071684],[-.8294889695615747,1.7626640603183463,.023624685841943577],[.03584583024378447,-.07617238926804182,.9568845240076872]]});var Wi=new dt({id:"srgb-linear",name:"Linear sRGB",white:"D65",toXYZ_M:[[.41239079926595934,.357584339383878,.1804807884018343],[.21263900587151027,.715168678767756,.07219231536073371],[.01933081871559182,.11919477979462598,.9505321522496607]],fromXYZ_M:[[3.2409699419045226,-1.537383177570094,-.4986107602930034],[-.9692436362808796,1.8759675015077202,.04155505740717559],[.05563007969699366,-.20397695888897652,1.0569715142428786]]}),Xi={aliceblue:[240/255,248/255,1],antiquewhite:[250/255,235/255,215/255],aqua:[0,1,1],aquamarine:[127/255,1,212/255],azure:[240/255,1,1],beige:[245/255,245/255,220/255],bisque:[1,228/255,196/255],black:[0,0,0],blanchedalmond:[1,235/255,205/255],blue:[0,0,1],blueviolet:[138/255,43/255,226/255],brown:[165/255,42/255,42/255],burlywood:[222/255,184/255,135/255],cadetblue:[95/255,158/255,160/255],chartreuse:[127/255,1,0],chocolate:[210/255,105/255,30/255],coral:[1,127/255,80/255],cornflowerblue:[100/255,149/255,237/255],cornsilk:[1,248/255,220/255],crimson:[220/255,20/255,60/255],cyan:[0,1,1],darkblue:[0,0,139/255],darkcyan:[0,139/255,139/255],darkgoldenrod:[184/255,134/255,11/255],darkgray:[169/255,169/255,169/255],darkgreen:[0,100/255,0],darkgrey:[169/255,169/255,169/255],darkkhaki:[189/255,183/255,107/255],darkmagenta:[139/255,0,139/255],darkolivegreen:[85/255,107/255,47/255],darkorange:[1,140/255,0],darkorchid:[.6,50/255,.8],darkred:[139/255,0,0],darksalmon:[233/255,150/255,122/255],darkseagreen:[143/255,188/255,143/255],darkslateblue:[72/255,61/255,139/255],darkslategray:[47/255,79/255,79/255],darkslategrey:[47/255,79/255,79/255],darkturquoise:[0,206/255,209/255],darkviolet:[148/255,0,211/255],deeppink:[1,20/255,147/255],deepskyblue:[0,191/255,1],dimgray:[105/255,105/255,105/255],dimgrey:[105/255,105/255,105/255],dodgerblue:[30/255,144/255,1],firebrick:[178/255,34/255,34/255],floralwhite:[1,250/255,240/255],forestgreen:[34/255,139/255,34/255],fuchsia:[1,0,1],gainsboro:[220/255,220/255,220/255],ghostwhite:[248/255,248/255,1],gold:[1,215/255,0],goldenrod:[218/255,165/255,32/255],gray:[128/255,128/255,128/255],green:[0,128/255,0],greenyellow:[173/255,1,47/255],grey:[128/255,128/255,128/255],honeydew:[240/255,1,240/255],hotpink:[1,105/255,180/255],indianred:[205/255,92/255,92/255],indigo:[75/255,0,130/255],ivory:[1,1,240/255],khaki:[240/255,230/255,140/255],lavender:[230/255,230/255,250/255],lavenderblush:[1,240/255,245/255],lawngreen:[124/255,252/255,0],lemonchiffon:[1,250/255,205/255],lightblue:[173/255,216/255,230/255],lightcoral:[240/255,128/255,128/255],lightcyan:[224/255,1,1],lightgoldenrodyellow:[250/255,250/255,210/255],lightgray:[211/255,211/255,211/255],lightgreen:[144/255,238/255,144/255],lightgrey:[211/255,211/255,211/255],lightpink:[1,182/255,193/255],lightsalmon:[1,160/255,122/255],lightseagreen:[32/255,178/255,170/255],lightskyblue:[135/255,206/255,250/255],lightslategray:[119/255,136/255,.6],lightslategrey:[119/255,136/255,.6],lightsteelblue:[176/255,196/255,222/255],lightyellow:[1,1,224/255],lime:[0,1,0],limegreen:[50/255,205/255,50/255],linen:[250/255,240/255,230/255],magenta:[1,0,1],maroon:[128/255,0,0],mediumaquamarine:[.4,205/255,170/255],mediumblue:[0,0,205/255],mediumorchid:[186/255,85/255,211/255],mediumpurple:[147/255,112/255,219/255],mediumseagreen:[60/255,179/255,113/255],mediumslateblue:[123/255,104/255,238/255],mediumspringgreen:[0,250/255,154/255],mediumturquoise:[72/255,209/255,.8],mediumvioletred:[199/255,21/255,133/255],midnightblue:[25/255,25/255,112/255],mintcream:[245/255,1,250/255],mistyrose:[1,228/255,225/255],moccasin:[1,228/255,181/255],navajowhite:[1,222/255,173/255],navy:[0,0,128/255],oldlace:[253/255,245/255,230/255],olive:[128/255,128/255,0],olivedrab:[107/255,142/255,35/255],orange:[1,165/255,0],orangered:[1,69/255,0],orchid:[218/255,112/255,214/255],palegoldenrod:[238/255,232/255,170/255],palegreen:[152/255,251/255,152/255],paleturquoise:[175/255,238/255,238/255],palevioletred:[219/255,112/255,147/255],papayawhip:[1,239/255,213/255],peachpuff:[1,218/255,185/255],peru:[205/255,133/255,63/255],pink:[1,192/255,203/255],plum:[221/255,160/255,221/255],powderblue:[176/255,224/255,230/255],purple:[128/255,0,128/255],rebeccapurple:[.4,.2,.6],red:[1,0,0],rosybrown:[188/255,143/255,143/255],royalblue:[65/255,105/255,225/255],saddlebrown:[139/255,69/255,19/255],salmon:[250/255,128/255,114/255],sandybrown:[244/255,164/255,96/255],seagreen:[46/255,139/255,87/255],seashell:[1,245/255,238/255],sienna:[160/255,82/255,45/255],silver:[192/255,192/255,192/255],skyblue:[135/255,206/255,235/255],slateblue:[106/255,90/255,205/255],slategray:[112/255,128/255,144/255],slategrey:[112/255,128/255,144/255],snow:[1,250/255,250/255],springgreen:[0,1,127/255],steelblue:[70/255,130/255,180/255],tan:[210/255,180/255,140/255],teal:[0,128/255,128/255],thistle:[216/255,191/255,216/255],tomato:[1,99/255,71/255],turquoise:[64/255,224/255,208/255],violet:[238/255,130/255,238/255],wheat:[245/255,222/255,179/255],white:[1,1,1],whitesmoke:[245/255,245/255,245/255],yellow:[1,1,0],yellowgreen:[154/255,205/255,50/255]};let Yi=Array(3).fill("<percentage> | <number>[0, 255]"),Zi=Array(3).fill("<number>[0, 255]");var Ki=new dt({id:"srgb",name:"sRGB",base:Wi,fromBase:e=>e.map((e=>{let t=e<0?-1:1,i=e*t;return i>.0031308?t*(1.055*i**(1/2.4)-.055):12.92*e})),toBase:e=>e.map((e=>{let t=e<0?-1:1,i=e*t;return i<=.04045?e/12.92:t*((i+.055)/1.055)**2.4})),formats:{rgb:{coords:Yi},rgb_number:{name:"rgb",commas:!0,coords:Zi,noAlpha:!0},color:{},rgba:{coords:Yi,commas:!0,lastAlpha:!0},rgba_number:{name:"rgba",commas:!0,coords:Zi},hex:{type:"custom",toGamut:!0,test:e=>/^#([a-f0-9]{3,4}){1,2}$/i.test(e),parse(e){e.length<=5&&(e=e.replace(/[a-f0-9]/gi,"$&$&"));let t=[];return e.replace(/[a-f0-9]{2}/gi,(e=>{t.push(parseInt(e,16)/255)})),{spaceId:"srgb",coords:t.slice(0,3),alpha:t.slice(3)[0]}},serialize:(e,t,{collapse:i=!0}={})=>{t<1&&e.push(t),e=e.map((e=>Math.round(255*e)));let r=i&&e.every((e=>e%17==0));return"#"+e.map((e=>r?(e/17).toString(16):e.toString(16).padStart(2,"0"))).join("")}},keyword:{type:"custom",test:e=>/^[a-z]+$/i.test(e),parse(e){let t={spaceId:"srgb",coords:null,alpha:1};if("transparent"===(e=e.toLowerCase())?(t.coords=Xi.black,t.alpha=0):t.coords=Xi[e],t.coords)return t}}}}),Ji=new dt({id:"p3",cssId:"display-p3",name:"P3",base:Hi,fromBase:Ki.fromBase,toBase:Ki.toBase});function Qi(e){return gt(e,[pt,"y"])}function er(e,t){e=ht(e),t=ht(t);let i=Math.max(Qi(e),0),r=Math.max(Qi(t),0);return r>i&&([i,r]=[r,i]),(i+.05)/(r+.05)}function tr(e){return e>=.022?e:e+(.022-e)**1.414}function ir(e){let t=e<0?-1:1,i=Math.abs(e);return t*Math.pow(i,2.4)}function rr(e,t){let i,r,n,s,a,o;t=ht(t),e=ht(e),t=qi(t,"srgb"),[s,a,o]=t.coords;let h=.2126729*ir(s)+.7151522*ir(a)+.072175*ir(o);e=qi(e,"srgb"),[s,a,o]=e.coords;let u=.2126729*ir(s)+.7151522*ir(a)+.072175*ir(o),l=tr(h),c=tr(u),p=c>l;return Math.abs(c-l)<5e-4?r=0:p?(i=c**.56-l**.57,r=1.14*i):(i=c**.65-l**.62,r=1.14*i),n=Math.abs(r)<.1?0:r>0?r-.027:r+.027,100*n}function nr(e,t,i={}){if("function"===$e(r=e)&&r.rangeArgs){let[i,r]=[e,t];return nr(...i.rangeArgs.colors,{...i.rangeArgs.options,...r})}var r;let{space:n,outputSpace:s,progression:a,premultiplied:o}=i;e=ht(e),t=ht(t),e=Vt(e),t=Vt(t);let h={colors:[e,t],options:i};if(n=n?ut.get(n):ut.registry[nt.interpolationSpace]||e.space,s=s?ut.get(s):n,e=qi(e,n),t=qi(t,n),e=ji(e),t=ji(t),n.coords.h&&"angle"===n.coords.h.type){let r=i.hue=i.hue||"shorter",s=[n,"h"],[a,o]=[gt(e,s),gt(t,s)];isNaN(a)&&!isNaN(o)?a=o:isNaN(o)&&!isNaN(a)&&(o=a),[a,o]=function(e,t){if("raw"===e)return t;let[i,r]=t.map(At),n=r-i;return"increasing"===e?n<0&&(r+=360):"decreasing"===e?n>0&&(i+=360):"longer"===e?-180<n&&n<180&&(n>0?i+=360:r+=360):"shorter"===e&&(n>180?i+=360:n<-180&&(r+=360)),[i,r]}(r,[a,o]),yt(e,s,a),yt(t,s,o)}return o&&(e.coords=e.coords.map((t=>t*e.alpha)),t.coords=t.coords.map((e=>e*t.alpha))),Object.assign((i=>{i=a?a(i):i;let r=e.coords.map(((e,r)=>Ye(e,t.coords[r],i))),h=Ye(e.alpha,t.alpha,i),u={space:n,coords:r,alpha:h};return o&&(u.coords=u.coords.map((e=>e/h))),s!==n&&(u=qi(u,s)),u}),{rangeArgs:h})}nt.interpolationSpace="lab";var sr=new ut({id:"hsl",name:"HSL",coords:{h:{refRange:[0,360],type:"angle",name:"Hue"},s:{range:[0,100],name:"Saturation"},l:{range:[0,100],name:"Lightness"}},base:Ki,fromBase:e=>{let t=Math.max(...e),i=Math.min(...e),[r,n,s]=e,[a,o,h]=[NaN,0,(i+t)/2],u=t-i;if(0!==u){switch(o=0===h||1===h?0:(t-h)/Math.min(h,1-h),t){case r:a=(n-s)/u+(n<s?6:0);break;case n:a=(s-r)/u+2;break;case s:a=(r-n)/u+4}a*=60}return o<0&&(a+=180,o=Math.abs(o)),a>=360&&(a-=360),[a,100*o,100*h]},toBase:e=>{let[t,i,r]=e;function n(e){let n=(e+t/30)%12,s=i*Math.min(r,1-r);return r-s*Math.max(-1,Math.min(n-3,9-n,1))}return t%=360,t<0&&(t+=360),i/=100,r/=100,[n(0),n(8),n(4)]},formats:{hsl:{coords:["<number> | <angle>","<percentage>","<percentage>"]},hsla:{coords:["<number> | <angle>","<percentage>","<percentage>"],commas:!0,lastAlpha:!0}}}),ar=new ut({id:"hsv",name:"HSV",coords:{h:{refRange:[0,360],type:"angle",name:"Hue"},s:{range:[0,100],name:"Saturation"},v:{range:[0,100],name:"Value"}},base:sr,fromBase(e){let[t,i,r]=e;i/=100,r/=100;let n=r+i*Math.min(r,1-r);return[t,0===n?0:200*(1-r/n),100*n]},toBase(e){let[t,i,r]=e;i/=100,r/=100;let n=r*(1-i/2);return[t,0===n||1===n?0:(r-n)/Math.min(n,1-n)*100,100*n]},formats:{color:{id:"--hsv",coords:["<number> | <angle>","<percentage> | <number>","<percentage> | <number>"]}}}),or=new ut({id:"hwb",name:"HWB",coords:{h:{refRange:[0,360],type:"angle",name:"Hue"},w:{range:[0,100],name:"Whiteness"},b:{range:[0,100],name:"Blackness"}},base:ar,fromBase(e){let[t,i,r]=e;return[t,r*(100-i)/100,100-r]},toBase(e){let[t,i,r]=e;i/=100,r/=100;let n=i+r;if(n>=1){return[t,0,100*(i/n)]}let s=1-r;return[t,100*(0===s?0:1-i/s),100*s]},formats:{hwb:{coords:["<number> | <angle>","<percentage> | <number>","<percentage> | <number>"]}}}),hr=new ut({id:"oklch",name:"Oklch",coords:{l:{refRange:[0,1],name:"Lightness"},c:{refRange:[0,.4],name:"Chroma"},h:{refRange:[0,360],type:"angle",name:"Hue"}},white:"D65",base:Pt,fromBase(e){let t,[i,r,n]=e;const s=2e-4;return t=Math.abs(r)<s&&Math.abs(n)<s?NaN:180*Math.atan2(n,r)/Math.PI,[i,Math.sqrt(r**2+n**2),At(t)]},toBase(e){let t,i,[r,n,s]=e;return isNaN(s)?(t=0,i=0):(t=n*Math.cos(s*Math.PI/180),i=n*Math.sin(s*Math.PI/180)),[r,t,i]},formats:{oklch:{coords:["<percentage> | <number>","<number> | <percentage>[0,1]","<number> | <angle>"]}}}),ur=new ut({id:"hsb",name:"HSB",coords:{h:{refRange:[0,360],type:"angle",name:"Hue"},s:{range:[0,100],name:"Saturation"},b:{range:[0,100],name:"Brightness"}},base:Ki,fromBase:e=>{const t=Math.max(...e),i=t-Math.min(...e);let r,n,[s,a,o]=e;return 0===i?(r=0,n=0):(n=i/t,s===t?r=(a-o)/i:a===t?r=2+(o-s)/i:o===t&&(r=4+(s-a)/i),r<0?r+=6:r>=6&&(r-=6)),[r/6*360,100*n,100*t]},toBase:lr,formats:{default:{type:"custom",serialize:(e,t)=>{const i=lr(e);let r=`rgb(${Math.round(100*i[0]*100)/100}% ${Math.round(100*i[1]*100)/100}% ${Math.round(100*i[2]*100)/100}%`;return t<1&&(r+=` / ${t}`),r+=")",r}},hsb:{coords:["<number> | <angle>","<percentage>","<percentage>"]},hsba:{coords:["<number> | <angle>","<percentage>","<percentage>"],commans:!0,lastAlpha:!0}}});function lr(e){const t=e[0]/360*6,i=e[1]/100,r=e[2]/100;let n=[];if(0===i)n=[r,r,r];else{const e=Math.floor(t),s=r*(1-i),a=r*(1-i*(t-e)),o=r*(1-i*(1+e-t));let h,u,l;1===e?(h=a,u=r,l=s):2===e?(h=s,u=r,l=o):3===e?(h=s,u=a,l=r):4===e?(h=o,u=s,l=r):5===e?(h=r,u=s,l=a):(h=r,u=o,l=s),n=[h,u,l]}return n}const cr=(e,t,i,r,n,s)=>{let a=(e-t)/(i-t)*(n-r)+r;return s&&(a=Math.max(a,Math.min(r,n)),a=Math.min(a,Math.max(r,n))),a},pr={};class dr{_color;mode;static colorMap={};static#e={};static#t={};static addColorMode(e,t){ut.register(t),dr.colorMap[e]=t.id,dr.#e[e]=Object.values(t.coords).reduce(((e,t)=>(e.push(t.refRange||t.range),e)),[]),dr.#e[e].push([0,1]),dr.#t[e]=t.fromGray}constructor(e,t,i,{clamp:r=!1}={}){if(this.mode=t||gr,e instanceof dr){const i=t?dr.colorMap[t]:dr.colorMap[e.mode];this._color=qi(e._color,i),this.mode=i}else if("object"!=typeof e||Array.isArray(e)||null===e)if("string"==typeof e[0])try{this._color=ot(e[0]);const[t]=Object.entries(dr.colorMap).find((([e,t])=>t===this._color.spaceId));this.mode=t,this._color=qi(this._color,this._color.spaceId)}catch(e){throw new Error("Invalid color string")}else{let t;if(i)if(4===e.length)t=dr.mapColorRange(e,this.mode,i,r);else if(3===e.length)t=dr.mapColorRange([e[0],e[1],e[2]],this.mode,i,r),t.push(1);else if(2===e.length){t=dr.#t[this.mode]?dr.#t[this.mode](e[0],i,r):dr.mapColorRange([e[0],e[0],e[0]],this.mode,i,r);const n=Array.isArray(i[i.length-1])?i[i.length-1]:[0,i[i.length-1]];t.push(cr(e[1],n[0],n[1],0,1,r))}else{if(1!==e.length)throw new Error("Invalid color");t=dr.#t[this.mode]?dr.#t[this.mode](e[0],i,r):dr.mapColorRange([e[0],e[0],e[0]],this.mode,i,r),t.push(1)}else t=e;const n=dr.colorMap[this.mode]||console.error("Invalid color mode"),s={space:n,coords:t.slice(0,3),alpha:t[3]};this._color=qi(s,n)}else{const i=t?dr.colorMap[t]:e.spaceId;this._color=qi(e,i),this.mode=t||Object.entries(dr.colorMap).find((([e,t])=>t===this._color.spaceId))}}static mapColorRange(e,t,i,r){const n=i.map((e=>Array.isArray(e)?e:[0,e])),s=dr.#e[t];return e.map(((e,t)=>cr(e,n[t][0],n[t][1],s[t][0],s[t][1],r)))}static unmapColorRange(e,t,i){const r=i.map((e=>Array.isArray(e)?e:[0,e])),n=dr.#e[t];return e.map(((e,t)=>cr(e,n[t][0],n[t][1],r[t][0],r[t][1])))}#i(e){return new dr(this._color,e)}get _array(){return this._getRGBA()}array(){return this._array}lerp(e,t,i){let r=-1;for(;(r+1<this._color.space.path.length||r+1<e._color.space.path.length)&&this._color.space.path[r+1]===e._color.space.path[r+1];)r+=1;if(-1===r)throw new Error("Cannot lerp colors. No common color space found");const n=nr(this._color,e._color,{space:this._color.space.path[r].id})(t);return new dr(n,i||this.mode)}toString(e){const t=`${this._color.space.id}-${this._color.coords.join(",")}-${this._color.alpha}-${e}`;let i=pr[t];return i||(i=function(e,{precision:t=nt.precision,format:i="default",inGamut:r=!0,...n}={}){let s,a=i;i=(e=ht(e)).space.getFormat(i)??e.space.getFormat("default")??ut.DEFAULT_FORMAT;let o=e.coords.slice();if(r||=i.toGamut,r&&!Rt(e)&&(o=ji(Vt(e),!0===r?void 0:r).coords),"custom"===i.type){if(n.precision=t,!i.serialize)throw new TypeError(`format ${a} can only be used to parse colors, not for serialization`);s=i.serialize(o,e.alpha,n)}else{let r=i.name||"color";i.serializeCoords?o=i.serializeCoords(o,t):null!==t&&(o=o.map((e=>qe(e,{precision:t}))));let n=[...o];if("color"===r){let t=i.id||i.ids?.[0]||e.space.id;n.unshift(t)}let a=e.alpha;null!==t&&(a=qe(a,{precision:t}));let h=e.alpha>=1||i.noAlpha?"":`${i.commas?",":" /"} ${a}`;s=`${r}(${n.join(i.commas?", ":" ")}${h})`}return s}(this._color,{format:e}),pr[t]=i),i}contrast(e,t="WCAG21"){if("all"!==t){let i,r;switch(t){case"WCAG21":i=er(this._color,e._color),r=4.5;break;case"APCA":i=Math.abs(rr(this._color,e._color)),r=75;break;default:return null}return i>=r}{const t=er(this._color,e._color),i=rr(this._color,e._color);return{WCAG21:{value:t,passedMinimum:t>=4.5,passedAAA:t>=7},APCA:{value:i,passedMinimum:Math.abs(i)>=75}}}}setRed(e,t=[0,1]){Array.isArray(t)||(t=[0,t]);const i=dr.#e[gr][0],r=cr(e,t[0],t[1],i[0],i[1]);if(this.mode===gr||this.mode===mr)this._color.coords[0]=r;else{const e=this._color.space.id,t=qi(this._color,"srgb");t.coords[0]=r,this._color=qi(t,e)}}setGreen(e,t=[0,1]){Array.isArray(t)||(t=[0,t]);const i=dr.#e[gr][1],r=cr(e,t[0],t[1],i[0],i[1]);if(this.mode===gr||this.mode===mr)this._color.coords[1]=r;else{const e=this._color.space.id,t=qi(this._color,"srgb");t.coords[1]=r,this._color=qi(t,e)}}setBlue(e,t=[0,1]){Array.isArray(t)||(t=[0,t]);const i=dr.#e[gr][2],r=cr(e,t[0],t[1],i[0],i[1]);if(this.mode===gr||this.mode===mr)this._color.coords[2]=r;else{const e=this._color.space.id,t=qi(this._color,"srgb");t.coords[2]=r,this._color=qi(t,e)}}setAlpha(e,t=[0,1]){Array.isArray(t)||(t=[0,t]);const i=dr.#e[this.mode][3],r=cr(e,t[0],t[1],i[0],i[1]);this._color.alpha=r}_getRGBA(e=[1,1,1,1]){const t=dr.#e[gr];let i=structuredClone(qi(this._color,"srgb").coords);i.push(this._color.alpha);const r=e.map((e=>Array.isArray(e)?e:[0,e]));return i=i.map(((e,i)=>cr(e,t[i][0],t[i][1],r[i][0],r[i][1]))),i}_getMode(){return this.mode}_getRed(e=[0,1]){if(Array.isArray(e)||(e=[0,e]),this.mode===gr||this.mode===mr){const t=dr.#e[this.mode][0];return cr(this._color.coords[0],t[0],t[1],e[0],e[1])}{const t=dr.#e[gr][0];return cr(qi(this._color,"srgb").coords[0],t[0],t[1],e[0],e[1])}}_getGreen(e=[0,1]){if(Array.isArray(e)||(e=[0,e]),this.mode===gr||this.mode===mr){const t=dr.#e[this.mode][1];return cr(this._color.coords[1],t[0],t[1],e[0],e[1])}{const t=dr.#e[gr][1];return cr(qi(this._color,"srgb").coords[1],t[0],t[1],e[0],e[1])}}_getBlue(e=[0,1]){if(Array.isArray(e)||(e=[0,e]),this.mode===gr||this.mode===mr){const t=dr.#e[this.mode][2];return cr(this._color.coords[2],t[0],t[1],e[0],e[1])}{const t=dr.#e[gr][2];return cr(qi(this._color,"srgb").coords[2],t[0],t[1],e[0],e[1])}}_getAlpha(e=[0,1]){Array.isArray(e)||(e=[0,e]);const t=dr.#e[this.mode][3];return cr(this._color.alpha,t[0],t[1],e[0],e[1])}_getHue(e=[0,360]){if(Array.isArray(e)||(e=[0,e]),this.mode===yr||this.mode===xr){const t=dr.#e[this.mode][0];return cr(this._color.coords[0],t[0],t[1],e[0],e[1])}{const t=dr.#e[xr][0];return cr(qi(this._color,"hsl").coords[0],t[0],t[1],e[0],e[1])}}_getSaturation(e=[0,100]){if(Array.isArray(e)||(e=[0,e]),this.mode===yr||this.mode===xr){const t=dr.#e[this.mode][1];return cr(this._color.coords[1],t[0],t[1],e[0],e[1])}{const t=dr.#e[xr][1];return cr(qi(this._color,"hsl").coords[1],t[0],t[1],e[0],e[1])}}_getBrightness(e=[0,100]){if(Array.isArray(e)||(e=[0,e]),this.mode===yr){const t=dr.#e[this.mode][2];return cr(this._color.coords[2],t[0],t[1],e[0],e[1])}{const t=dr.#e[yr][2];return cr(qi(this._color,"hsb").coords[2],t[0],t[1],e[0],e[1])}}_getLightness(e=[0,100]){if(Array.isArray(e)||(e=[0,e]),this.mode===xr){const t=dr.#e[this.mode][2];return cr(this._color.coords[2],t[0],t[1],e[0],e[1])}{const t=dr.#e[xr][2];return cr(qi(this._color,"hsl").coords[2],t[0],t[1],e[0],e[1])}}}function fr(e,t,i){e.Color=dr,Ki.fromGray=Ji.fromGray=function(e,t,i){const r=t.map((e=>Array.isArray(e)?e:[0,e])),n=cr(e,r[2][0],r[2][1],0,1,i);return[n,n,n]},ur.fromGray=sr.fromGray=function(e,t,i){const r=t.map((e=>Array.isArray(e)?e:[0,e]));return[0,0,cr(e,r[2][0],r[2][1],0,100,i)]},or.fromGray=function(e,t,i){const r=t.map((e=>Array.isArray(e)?e:[0,e])),n=Math.abs(r[1][0]-r[1][1])/2+Math.abs(r[2][0]-r[2][1])/2,s=cr(e,0,n,0,100);let a,o;return s<50?(o=s,a=100-s):s>=50&&(a=s,o=100-s),[0,a,o]},Ct.fromGray=Et.fromGray=Pt.fromGray=hr.fromGray=function(e,t,i){const r=t.map((e=>Array.isArray(e)?e:[0,e]));return[cr(e,r[0][0],r[0][1],0,100,i),0,0]},e.Color.addColorMode(gr,Ki),e.Color.addColorMode(mr,Ji),e.Color.addColorMode(yr,ur),e.Color.addColorMode(xr,sr),e.Color.addColorMode(vr,or),e.Color.addColorMode(br,Ct),e.Color.addColorMode(_r,Et),e.Color.addColorMode(wr,Pt),e.Color.addColorMode(Cr,hr),i.presetup=function(){const t=this,i=["Red","Green","Blue","Alpha"];for(let r in i){const n=i[r],s=e.Color.prototype["set"+n];e.Color.prototype["set"+n]=function(e,i){return i=i||t?._renderer?.states?.colorMaxes?.[gr][r],s.call(this,e,i)}}function r(i,r){const n=e.Color.prototype["_get"+i];e.Color.prototype["_get"+i]=function(e){if(Object.keys(r).includes(this.mode))e=e||t?._renderer?.states?.colorMaxes?.[this.mode][r[this.mode]];else{const i=Object.keys(r)[0];e=e||t?._renderer?.states?.colorMaxes?.[i][r[i]]}return n.call(this,e)}}r("Red",{[gr]:0,[mr]:0}),r("Green",{[gr]:1,[mr]:1}),r("Blue",{[gr]:2,[mr]:2}),r("Alpha",{[gr]:3,[mr]:3,[yr]:3,[xr]:3,[vr]:3,[br]:3,[_r]:3,[wr]:3,[Cr]:3}),r("Hue",{[xr]:0,[yr]:0,[vr]:0,[_r]:2,[Cr]:2}),r("Saturation",{[xr]:1,[yr]:1}),r("Brightness",{[yr]:2}),r("Lightness",{[xr]:2})}}void 0!==p5&&fr(p5);const gr="rgb",mr="rgbhdr",yr="hsb",xr="hsl",vr="hwb",br="lab",_r="lch",wr="oklab",Cr="oklch",Ar="rgba";function Er(e,t){t.RGB=gr,t.RGBHDR=mr,t.HSB=yr,t.HSL=xr,t.HWB=vr,t.LAB=br,t.LCH=_r,t.OKLAB=wr,t.OKLCH=Cr,t.RGBA=Ar,e.Renderer.states.colorMode=gr,e.Renderer.states.colorMaxes={[gr]:[255,255,255,255],[mr]:[255,255,255,255],[yr]:[360,100,100,1],[xr]:[360,100,100,1],[vr]:[360,100,100,1],[br]:[100,[-125,125],[-125,125],1],[_r]:[100,150,360,1],[wr]:[100,[-125,125],[-125,125],1],[Cr]:[100,150,360,1],clone:function(){const e={...this};for(const t in e)e[t]instanceof Array&&(e[t]=[...e[t]]);return e}},t.color=function(...e){if(e[0]instanceof dr)return e[0];const t=Array.isArray(e[0])?e[0]:e;return new dr(t,this._renderer.states.colorMode,this._renderer.states.colorMaxes[this._renderer.states.colorMode],{clamp:!0})},t.red=function(e){return this.color(e)._getRed()},t.green=function(e){return this.color(e)._getGreen()},t.blue=function(e){return this.color(e)._getBlue()},t.alpha=function(e){return this.color(e)._getAlpha()},t.hue=function(e){let t=xr,i=0;return this._renderer.states.colorMode===yr||this._renderer.states.colorMode===xr?t=this._renderer.states.colorMode:this._renderer.states.colorMode!==_r&&this._renderer.states.colorMode!==Cr||(t=this._renderer.states.colorMode,i=2),this.color(e)._getHue(this._renderer.states.colorMaxes[t][i])},t.saturation=function(e){const t=this._renderer.states.colorMode===yr?yr:xr;return this.color(e)._getSaturation(this._renderer.states.colorMaxes[t][1])},t.brightness=function(e){return this.color(e)._getBrightness(this._renderer.states.colorMaxes.hsb[2])},t.lightness=function(e){return this.color(e)._getLightness(this._renderer.states.colorMaxes.hsl[2])},t.lerpColor=function(e,t,i){return e.lerp(t,i,this._renderer.states.colorMode)},t.paletteLerp=function(e,t){const i=e[0];if(t<i[1])return this.color(i[0]);for(let i=1;i<e.length;i++){const r=e[i];if(t<r[1]){const n=e[i-1];return this.lerpColor(this.color(n[0]),this.color(r[0]),(t-n[1])/(r[1]-n[1]))}}return this.color(e[e.length-1][0])}}void 0!==p5&&Er(p5,p5.prototype);class Dr{constructor(e){if(e)this.DOM=e;else{const e=document.implementation.createDocument(null,"doc");this.DOM=e.createElement("root")}}getParent(){return new Dr(this.DOM.parentElement)}getName(){return this.DOM.tagName}setName(e){const t=this.DOM.innerHTML,i=this.DOM.attributes,r=document.implementation.createDocument(null,"default").createElement(e);r.innerHTML=t;for(let e=0;e<i.length;e++)r.setAttribute(i[e].nodeName,i[e].nodeValue);this.DOM=r}hasChildren(){return this.DOM.children.length>0}listChildren(){const e=[];for(let t=0;t<this.DOM.childNodes.length;t++)e.push(this.DOM.childNodes[t].nodeName);return e}getChildren(e){return Sr(e?this.DOM.getElementsByTagName(e):this.DOM.children)}getChild(e){if("string"!=typeof e)return new Dr(this.DOM.children[e]);for(const t of this.DOM.children)if(t.tagName===e)return new Dr(t)}addChild(e){e instanceof Dr&&this.DOM.appendChild(e.DOM)}removeChild(e){let t=-1;if("string"==typeof e){for(let i=0;i<this.DOM.children.length;i++)if(this.DOM.children[i].tagName===e){t=i;break}}else t=e;-1!==t&&this.DOM.removeChild(this.DOM.children[t])}getAttributeCount(){return this.DOM.attributes.length}listAttributes(){const e=[];for(const t of this.DOM.attributes)e.push(t.nodeName);return e}hasAttribute(e){const t={};for(const e of this.DOM.attributes)t[e.nodeName]=e.nodeValue;return!!t[e]}getNum(e,t){const i={};for(const e of this.DOM.attributes)i[e.nodeName]=e.nodeValue;return Number(i[e])||t||0}getString(e,t){const i={};for(const e of this.DOM.attributes)i[e.nodeName]=e.nodeValue;return i[e]?String(i[e]):t||null}setAttribute(e,t){this.DOM.setAttribute(e,t)}getContent(e){let t;return t=this.DOM.textContent,t=t.replace(/\s\s+/g,","),t||e||null}setContent(e){this.DOM.children.length||(this.DOM.textContent=e)}serialize(){return(new XMLSerializer).serializeToString(this.DOM)}}function Sr(e){const t=[];for(let i=0;i<e.length;i++)t.push(new Dr(e[i]));return t}function Fr(e,t){e.XML=Dr}void 0!==p5&&Fr(p5);class Tr{constructor(e,t){this.file=e,this._pInst=t;const i=e.type.split("/");this.type=i[0],this.subtype=i[1],this.name=e.name,this.size=e.size,this.data=void 0}static _createLoader(e,t){const i=new FileReader;return i.onload=function(i){const r=new Tr(e);if("application/json"===r.file.type)r.data=JSON.parse(i.target.result);else if("text/xml"===r.file.type){const e=(new DOMParser).parseFromString(i.target.result,"text/xml");r.data=new Dr(e.documentElement)}else r.data=i.target.result;t(r)},i}static _load(e,t){if(/^text\//.test(e.type)||"application/json"===e.type)Tr._createLoader(e,t).readAsText(e);else if(/^(video|audio)\//.test(e.type)){const i=new Tr(e);i.data=URL.createObjectURL(e),t(i)}else Tr._createLoader(e,t).readAsDataURL(e)}}function Mr(e,t){e.File=Tr}void 0!==p5&&Mr(p5);class kr{width;height;elt;constructor(e,t){this.elt=e,this._pInst=this._pixelsState=t,this._events={},this.width=this.elt.offsetWidth,this.height=this.elt.offsetHeight}remove(){if(this.stop){this.stop();const e=this.elt.srcObject;if(null!==e){e.getTracks().forEach((e=>{e.stop()}))}}let e=this._pInst;if(e&&!e._elements&&e._pInst&&(e=e._pInst),e&&e._elements){const t=e._elements.indexOf(this);-1!==t&&e._elements.splice(t,1)}for(let e in this._events)this.elt.removeEventListener(e,this._events[e]);this.elt&&this.elt.parentNode&&this.elt.parentNode.removeChild(this.elt)}parent(e){return void 0===e?this.elt.parentNode:("string"==typeof e?("#"===e[0]&&(e=e.substring(1)),e=document.getElementById(e)):e instanceof kr&&(e=e.elt),e.appendChild(this.elt),this)}child(e){return void 0===e?this.elt.childNodes:("string"==typeof e?("#"===e[0]&&(e=e.substring(1)),e=document.getElementById(e)):e instanceof kr&&(e=e.elt),e instanceof HTMLElement&&this.elt.appendChild(e),this)}html(...e){return 0===e.length?this.elt.innerHTML:e[1]?(this.elt.insertAdjacentHTML("beforeend",e[0]),this):(this.elt.innerHTML=e[0],this)}id(e){return void 0===e?this.elt.id:(this.elt.id=e,this.width=this.elt.offsetWidth,this.height=this.elt.offsetHeight,this)}class(e){return void 0===e?this.elt.className:(this.elt.className=e,this)}addClass(e){return this.elt.className?this.hasClass(e)||(this.elt.className=this.elt.className+" "+e):this.elt.className=e,this}removeClass(e){return this.elt.classList.remove(e),this}hasClass(e){return this.elt.classList.contains(e)}toggleClass(e){return this.elt.classList.contains(e)?this.elt.classList.remove(e):this.elt.classList.add(e),this}center(e){const t=this.elt.style.display,i="none"===this.elt.style.display,r="none"===this.parent().style.display,n={x:this.elt.offsetLeft,y:this.elt.offsetTop};i&&this.show(),r&&this.parent().show(),this.elt.style.display="block",this.position(0,0);const s=Math.abs(this.parent().offsetWidth-this.elt.offsetWidth),a=Math.abs(this.parent().offsetHeight-this.elt.offsetHeight);return"both"===e||void 0===e?this.position(s/2+this.parent().offsetLeft,a/2+this.parent().offsetTop):"horizontal"===e?this.position(s/2+this.parent().offsetLeft,n.y):"vertical"===e&&this.position(n.x,a/2+this.parent().offsetTop),this.style("display",t),i&&this.hide(),r&&this.parent().hide(),this}position(...e){if(0===e.length)return{x:this.elt.offsetLeft,y:this.elt.offsetTop};{let t="absolute";return"static"!==e[2]&&"fixed"!==e[2]&&"relative"!==e[2]&&"sticky"!==e[2]&&"initial"!==e[2]&&"inherit"!==e[2]||(t=e[2]),this.elt.style.position=t,this.elt.style.left=e[0]+"px",this.elt.style.top=e[1]+"px",this.x=e[0],this.y=e[1],this}}show(){return this.elt.style.display="block",this}hide(){return this.elt.style.display="none",this}size(e,t){if(0===arguments.length)return{width:this.elt.offsetWidth,height:this.elt.offsetHeight};{let i=e,r=t;const n=G;if(i!==n||r!==n){if(i===n?i=t*this.width/this.height:r===n&&(r=e*this.height/this.width),this.elt instanceof HTMLCanvasElement){const e={},t=this.elt.getContext("2d");let n;for(n in t)e[n]=t[n];for(n in this.elt.setAttribute("width",i*this._pInst._pixelDensity),this.elt.setAttribute("height",r*this._pInst._pixelDensity),this.elt.style.width=i+"px",this.elt.style.height=r+"px",this._pInst.scale(this._pInst._pixelDensity,this._pInst._pixelDensity),e)this.elt.getContext("2d")[n]=e[n]}else this.elt.style.width=i+"px",this.elt.style.height=r+"px",this.elt.width=i,this.elt.height=r;this.width=i,this.height=r,this._pInst&&this._pInst._curElement&&this._pInst._curElement.elt===this.elt&&(this._pInst.width=i,this._pInst.height=r)}return this}}style(e,t){const i=this;if(t instanceof dr&&(t=t.toString()),void 0===t){if(-1===e.indexOf(":")){return window.getComputedStyle(i.elt).getPropertyValue(e)}{const t=e.split(";");for(let e=0;e<t.length;e++){const i=t[e].split(":");i[0]&&i[1]&&(this.elt.style[i[0].trim()]=i[1].trim())}}}else if(this.elt.style[e]=t,"width"===e||"height"===e||"left"===e||"top"===e){let t=window.getComputedStyle(i.elt).getPropertyValue(e).replace(/[^\d.]/g,"");this[e]=Math.round(parseFloat(t,10))}return this}_translate(...e){this.elt.style.position="absolute";let t="";return this.elt.style.transform&&(t=this.elt.style.transform.replace(/translate3d\(.*\)/g,""),t=t.replace(/translate[X-Z]?\(.*\)/g,"")),2===e.length?this.elt.style.transform="translate("+e[0]+"px, "+e[1]+"px)":e.length>2&&(this.elt.style.transform="translate3d("+e[0]+"px,"+e[1]+"px,"+e[2]+"px)",3===e.length?this.elt.parentElement.style.perspective="1000px":this.elt.parentElement.style.perspective=e[3]+"px"),this.elt.style.transform+=t,this}_rotate(...e){let t="";return this.elt.style.transform&&(t=this.elt.style.transform.replace(/rotate3d\(.*\)/g,""),t=t.replace(/rotate[X-Z]?\(.*\)/g,"")),1===e.length?this.elt.style.transform="rotate("+e[0]+"deg)":2===e.length?this.elt.style.transform="rotate("+e[0]+"deg, "+e[1]+"deg)":3===e.length&&(this.elt.style.transform="rotateX("+e[0]+"deg)",this.elt.style.transform+="rotateY("+e[1]+"deg)",this.elt.style.transform+="rotateZ("+e[2]+"deg)"),this.elt.style.transform+=t,this}attribute(e,t){if(null==this.elt.firstChild||"checkbox"!==this.elt.firstChild.type&&"radio"!==this.elt.firstChild.type)return void 0===t?this.elt.getAttribute(e):(this.elt.setAttribute(e,t),this);if(void 0===t)return this.elt.firstChild.getAttribute(e);for(let i=0;i<this.elt.childNodes.length;i++)this.elt.childNodes[i].setAttribute(e,t)}removeAttribute(e){if(null!=this.elt.firstChild&&("checkbox"===this.elt.firstChild.type||"radio"===this.elt.firstChild.type))for(let t=0;t<this.elt.childNodes.length;t++)this.elt.childNodes[t].removeAttribute(e);return this.elt.removeAttribute(e),this}value(...e){return e.length>0?(this.elt.value=e[0],this):"range"===this.elt.type?parseFloat(this.elt.value):this.elt.value}mousePressed(e){return kr._adjustListener("pointerdown",(function(t){return this._pInst.mouseIsPressed=!0,this._pInst._activePointers.set(t.pointerId,t),this._pInst._setMouseButton(t),this._pInst._updatePointerCoords(t),e.call(this,t)}),this),this}doubleClicked(e){return kr._adjustListener("dblclick",e,this),this}mouseWheel(e){return kr._adjustListener("wheel",e,this),this}mouseReleased(e){return kr._adjustListener("pointerup",e,this),this}mouseClicked(e){return kr._adjustListener("click",e,this),this}mouseMoved(e){return kr._adjustListener("pointermove",e,this),this}mouseOver(e){return kr._adjustListener("pointerover",e,this),this}mouseOut(e){return kr._adjustListener("pointerout",e,this),this}dragOver(e){return kr._adjustListener("dragover",e,this),this}dragLeave(e){return kr._adjustListener("dragleave",e,this),this}changed(e){return kr._adjustListener("change",e,this),this}input(e){return kr._adjustListener("input",e,this),this}drop(e,t){if(window.File&&window.FileReader&&window.FileList&&window.Blob){if(!this._dragDisabled){this._dragDisabled=!0;const e=function(e){e.preventDefault()};this.elt.addEventListener("dragover",e),this.elt.addEventListener("dragleave",e)}kr._attachListener("drop",(function(i){i.preventDefault(),"function"==typeof t&&t.call(this,i);const r=i.dataTransfer.files;for(const t of r)Tr._load(t,e)}),this)}else console.log("The File APIs are not fully supported in this browser.");return this}draggable(e){let t,i="ontouchstart"in window,r=0,n=0,s=0,a=0,o=i?"touchstart":"mousedown",h=i?"touchend":"mouseup",u=i?"touchmove":"mousemove";function l(t){if(t=t||window.event,i){const e=t.changedTouches;r=s-parseInt(e[0].clientX),n=a-parseInt(e[0].clientY),s=parseInt(e[0].clientX),a=parseInt(e[0].clientY)}else r=s-parseInt(t.clientX),n=a-parseInt(t.clientY),s=parseInt(t.clientX),a=parseInt(t.clientY);e.style.left=e.offsetLeft-r+"px",e.style.top=e.offsetTop-n+"px"}function c(){document.removeEventListener(h,c,!1),document.removeEventListener(u,l,!1)}return void 0===e?t=e=this.elt:e!==this.elt&&e.elt!==this.elt&&(e=e.elt,t=this.elt),t.addEventListener(o,(function(e){if(e=e||window.event,i){const t=e.changedTouches;s=parseInt(t[0].clientX),a=parseInt(t[0].clientY)}else s=parseInt(e.clientX),a=parseInt(e.clientY);return document.addEventListener(h,c,!1),document.addEventListener(u,l,!1),!1}),!1),t.style.cursor="move",this}static _adjustListener(e,t,i){return!1===t?kr._detachListener(e,i):kr._attachListener(e,t,i),this}static _attachListener(e,t,i){i._events[e]&&kr._detachListener(e,i);const r=t.bind(i);i.elt.addEventListener(e,r,{capture:!1,signal:i._pInst._removeSignal}),i._events[e]=r}static _detachListener(e,t){const i=t._events[e];t.elt.removeEventListener(e,i,!1),t._events[e]=null}}function Ir(e,t){e.Element=kr}void 0!==p5&&Ir(p5);const Br={_toPixels(e){if(e instanceof ImageData)return e.data;if(e.getContext("2d"))return e.getContext("2d").getImageData(0,0,e.width,e.height).data;if(e.getContext("webgl")){const t=e.getContext("webgl"),i=t.drawingBufferWidth*t.drawingBufferHeight*4,r=new Uint8Array(i);return t.readPixels(0,0,e.width,e.height,t.RGBA,t.UNSIGNED_BYTE,r),r}},_getARGB(e,t){const i=4*t;return e[i+3]<<24&4278190080|e[i]<<16&16711680|e[i+1]<<8&65280|255&e[i+2]},_setPixels(e,t){let i=0;for(let r=0,n=e.length;r<n;r++)i=4*r,e[i+0]=(16711680&t[r])>>>16,e[i+1]=(65280&t[r])>>>8,e[i+2]=255&t[r],e[i+3]=(4278190080&t[r])>>>24},_toImageData:e=>e instanceof ImageData?e:e.getContext("2d").getImageData(0,0,e.width,e.height),_createImageData(e,t){return Br._tmpCanvas=document.createElement("canvas"),Br._tmpCtx=Br._tmpCanvas.getContext("2d"),this._tmpCtx.createImageData(e,t)},apply(e,t,i){const r=e.getContext("2d"),n=r.getImageData(0,0,e.width,e.height),s=t(n,i);s instanceof ImageData?r.putImageData(s,0,0,0,0,e.width,e.height):r.putImageData(n,0,0,0,0,e.width,e.height)},threshold(e,t=.5){const i=Br._toPixels(e),r=Math.floor(255*t);for(let e=0;e<i.length;e+=4){let t;t=.2126*i[e]+.7152*i[e+1]+.0722*i[e+2]>=r?255:0,i[e]=i[e+1]=i[e+2]=t}},gray(e){const t=Br._toPixels(e);for(let e=0;e<t.length;e+=4){const i=.2126*t[e]+.7152*t[e+1]+.0722*t[e+2];t[e]=t[e+1]=t[e+2]=i}},opaque(e){const t=Br._toPixels(e);for(let e=0;e<t.length;e+=4)t[e+3]=255;return t},invert(e){const t=Br._toPixels(e);for(let e=0;e<t.length;e+=4)t[e]=255-t[e],t[e+1]=255-t[e+1],t[e+2]=255-t[e+2]},posterize(e,t=4){const i=Br._toPixels(e);if(t<2||t>255)throw new Error("Level must be greater than 2 and less than 255 for posterize");const r=t-1;for(let e=0;e<i.length;e+=4){const n=i[e],s=i[e+1],a=i[e+2];i[e]=255*(n*t>>8)/r,i[e+1]=255*(s*t>>8)/r,i[e+2]=255*(a*t>>8)/r}},dilate(e){const t=Br._toPixels(e);let i=0;const r=t.length?t.length/4:0,n=new Int32Array(r);let s,a,o,h,u,l,c,p,d,f,g,m,y,x,v,b,_;for(;i<r;)for(s=i,a=i+e.width;i<a;)o=h=Br._getARGB(t,i),c=i-1,l=i+1,p=i-e.width,d=i+e.width,c<s&&(c=i),l>=a&&(l=i),p<0&&(p=0),d>=r&&(d=i),m=Br._getARGB(t,p),g=Br._getARGB(t,c),y=Br._getARGB(t,d),f=Br._getARGB(t,l),u=77*(o>>16&255)+151*(o>>8&255)+28*(255&o),v=77*(g>>16&255)+151*(g>>8&255)+28*(255&g),x=77*(f>>16&255)+151*(f>>8&255)+28*(255&f),b=77*(m>>16&255)+151*(m>>8&255)+28*(255&m),_=77*(y>>16&255)+151*(y>>8&255)+28*(255&y),v>u&&(h=g,u=v),x>u&&(h=f,u=x),b>u&&(h=m,u=b),_>u&&(h=y,u=_),n[i++]=h;Br._setPixels(t,n)},erode(e){const t=Br._toPixels(e);let i=0;const r=t.length?t.length/4:0,n=new Int32Array(r);let s,a,o,h,u,l,c,p,d,f,g,m,y,x,v,b,_;for(;i<r;)for(s=i,a=i+e.width;i<a;)o=h=Br._getARGB(t,i),c=i-1,l=i+1,p=i-e.width,d=i+e.width,c<s&&(c=i),l>=a&&(l=i),p<0&&(p=0),d>=r&&(d=i),m=Br._getARGB(t,p),g=Br._getARGB(t,c),y=Br._getARGB(t,d),f=Br._getARGB(t,l),u=77*(o>>16&255)+151*(o>>8&255)+28*(255&o),v=77*(g>>16&255)+151*(g>>8&255)+28*(255&g),x=77*(f>>16&255)+151*(f>>8&255)+28*(255&f),b=77*(m>>16&255)+151*(m>>8&255)+28*(255&m),_=77*(y>>16&255)+151*(y>>8&255)+28*(255&y),v<u&&(h=g,u=v),x<u&&(h=f,u=x),b<u&&(h=m,u=b),_<u&&(h=y,u=_),n[i++]=h;Br._setPixels(t,n)},blur(e,t){!function(e,t){const i=Br._toPixels(e),r=e.width,n=e.height,s=r*n,a=new Int32Array(s);for(let e=0;e<s;e++)a[e]=Br._getARGB(i,e);let o,h,u,l,c,p,d,f,g,m;const y=new Int32Array(s),x=new Int32Array(s),v=new Int32Array(s),b=new Int32Array(s);let _,w,C,A,E=0;for(function(e){let t=3.5*e|0;if(t=t<1?1:t<248?t:248,Lr!==t){Lr=t,Or=1+Lr<<1,Pr=new Int32Array(Or),Nr=new Array(Or);for(let e=0;e<Or;e++)Nr[e]=new Int32Array(256);let e,i,r,n;for(let e=1,s=t-1;e<t;e++){Pr[t+e]=Pr[s]=i=s*s,r=Nr[t+e],n=Nr[s--];for(let e=0;e<256;e++)r[e]=n[e]=i*e}e=Pr[t]=t*t,r=Nr[t];for(let t=0;t<256;t++)r[t]=e*t}}(t),w=0;w<n;w++){for(_=0;_<r;_++){if(l=u=h=c=o=0,p=_-Lr,p<0)m=-p,p=0;else{if(p>=r)break;m=0}for(C=m;C<Or&&!(p>=r);C++){const e=a[p+E];A=Nr[C],c+=A[(-16777216&e)>>>24],h+=A[(16711680&e)>>16],u+=A[(65280&e)>>8],l+=A[255&e],o+=Pr[C],p++}d=E+_,y[d]=c/o,x[d]=h/o,v[d]=u/o,b[d]=l/o}E+=r}for(E=0,f=-Lr,g=f*r,w=0;w<n;w++){for(_=0;_<r;_++){if(l=u=h=c=o=0,f<0)m=d=-f,p=_;else{if(f>=n)break;m=0,d=f,p=_+g}for(C=m;C<Or&&!(d>=n);C++)A=Nr[C],c+=A[y[p]],h+=A[x[p]],u+=A[v[p]],l+=A[b[p]],o+=Pr[C],d++,p+=r;a[_+E]=c/o<<24|h/o<<16|u/o<<8|l/o}E+=r,g+=r,f++}Br._setPixels(i,a)}(e,t)}};let Lr,Or,Pr,Nr;var Rr="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function Vr(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Ur,zr,Gr={exports:{}};Ur=Gr,zr=zr||function(e){if(!(void 0===e||"undefined"!=typeof navigator&&/MSIE [1-9]\./.test(navigator.userAgent))){var t=e.document,i=function(){return e.URL||e.webkitURL||e},r=t.createElementNS("http://www.w3.org/1999/xhtml","a"),n="download"in r,s=/constructor/i.test(e.HTMLElement)||e.safari,a=/CriOS\/[\d]+/.test(navigator.userAgent),o=function(t){(e.setImmediate||e.setTimeout)((function(){throw t}),0)},h=function(e){setTimeout((function(){"string"==typeof e?i().revokeObjectURL(e):e.remove()}),4e4)},u=function(e){return/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(e.type)?new Blob([String.fromCharCode(65279),e],{type:e.type}):e},l=function(t,l,c){c||(t=u(t));var p,d=this,f="application/octet-stream"===t.type,g=function(){!function(e,t){for(var i=(t=[].concat(t)).length;i--;){var r=e["on"+t[i]];if("function"==typeof r)try{r.call(e,e)}catch(e){o(e)}}}(d,"writestart progress write writeend".split(" "))};if(d.readyState=d.INIT,n)return p=i().createObjectURL(t),void setTimeout((function(){var e,t;r.href=p,r.download=l,e=r,t=new MouseEvent("click"),e.dispatchEvent(t),g(),h(p),d.readyState=d.DONE}));!function(){if((a||f&&s)&&e.FileReader){var r=new FileReader;return r.onloadend=function(){var t=a?r.result:r.result.replace(/^data:[^;]*;/,"data:attachment/file;");e.open(t,"_blank")||(e.location.href=t),t=void 0,d.readyState=d.DONE,g()},r.readAsDataURL(t),void(d.readyState=d.INIT)}p||(p=i().createObjectURL(t)),f?e.location.href=p:e.open(p,"_blank")||(e.location.href=p),d.readyState=d.DONE,g(),h(p)}()},c=l.prototype;return"undefined"!=typeof navigator&&navigator.msSaveOrOpenBlob?function(e,t,i){return t=t||e.name||"download",i||(e=u(e)),navigator.msSaveOrOpenBlob(e,t)}:(c.abort=function(){},c.readyState=c.INIT=0,c.WRITING=1,c.DONE=2,c.error=c.onwritestart=c.onprogress=c.onwrite=c.onabort=c.onerror=c.onwriteend=null,function(e,t,i){return new l(e,t||e.name||"download",i)})}}("undefined"!=typeof self&&self||"undefined"!=typeof window&&window||Rr.content),Ur.exports&&(Ur.exports.saveAs=zr);var jr=Gr.exports;function $r(e,t,i){const r=qr(t,i)[0];let n=e;n instanceof Blob||(n=new Blob([e])),jr.saveAs(n,r)}function qr(e,t){t&&!0!==t&&"true"!==t||(t=""),e||(e="untitled");let i="";return e&&e.includes(".")&&(i=e.split(".").pop()),t&&i!==t&&(i=t,e=`${e}.${i}`),[e,i]}class Hr{constructor(e,t){this.width=e,this.height=t,this.canvas=document.createElement("canvas"),this.canvas.width=this.width,this.canvas.height=this.height,this.drawingContext=this.canvas.getContext("2d"),this._pixelsState=this,this._pixelDensity=1,this.gifProperties=null,this._modified=!1,this.pixels=[]}pixelDensity(e){return void 0!==e?(e<=0&&(e=1),this._pixelDensity=e,this.width/=e,this.height/=e,this):this._pixelDensity}_animateGif(e){const t=this.gifProperties,i=e._lastRealFrameTime||window.performance.now();if(0===t.lastChangeTime&&(t.lastChangeTime=i),t.playing){t.timeDisplayed=i-t.lastChangeTime;const e=t.frames[t.displayIndex].delay;if(t.timeDisplayed>=e){const r=Math.floor(t.timeDisplayed/e);if(t.timeDisplayed=0,t.lastChangeTime=i,t.displayIndex+=r,t.loopCount=Math.floor(t.displayIndex/t.numFrames),null!==t.loopLimit&&t.loopCount>=t.loopLimit)t.playing=!1;else{const e=t.displayIndex%t.numFrames;this.drawingContext.putImageData(t.frames[e].image,0,0),t.displayIndex=e,this.setModified(!0)}}}}loadPixels(){const e=this._pixelsState,t=this._pixelDensity,i=this.width*t,r=this.height*t,n=this.drawingContext.getImageData(0,0,i,r);e.imageData=n,this.pixels=e.pixels=n.data,this.setModified(!0)}updatePixels(e,t,i,r){const n=this._pixelsState,s=this._pixelDensity;void 0===e&&void 0===t&&void 0===i&&void 0===r&&(e=0,t=0,i=this.width,r=this.height),e*=s,t*=s,i*=s,r*=s,this.gifProperties&&(this.gifProperties.frames[this.gifProperties.displayIndex].image=n.imageData),this.drawingContext.putImageData(n.imageData,e,t,0,0,i,r),this.setModified(!0)}get(e,t,i,r){const n=this._pixelsState,s=this._pixelDensity,a=this.canvas;if(void 0===e&&void 0===t)e=t=0,i=n.width,r=n.height;else if(e*=s,t*=s,void 0===i&&void 0===r)return e<0||t<0||e>=a.width||t>=a.height?[0,0,0,0]:this._getPixel(e,t);const o=new Hr(i*s,r*s);return o.pixelDensity(s),o.canvas.getContext("2d").drawImage(a,e,t,i*s,r*s,0,0,i*s,r*s),o}_getPixel(e,t){let i,r;return i=this.drawingContext.getImageData(e,t,1,1).data,r=0,[i[0],i[1],i[2],i[3]]}set(e,t,i){e=Math.floor(e),t=Math.floor(t);const r=this._pixelsState;if(i instanceof Hr)this.drawingContext.save(),this.drawingContext.setTransform(1,0,0,1,0,0),this.drawingContext.scale(this._pixelDensity,this._pixelDensity),this.drawingContext.clearRect(e,t,i.width,i.height),this.drawingContext.drawImage(i.canvas,e,t),this.drawingContext.restore();else{let n=0,s=0,a=0,o=0,h=4*(t*this._pixelDensity*(this.width*this._pixelDensity)+e*this._pixelDensity);if(r.imageData||r.loadPixels(),"number"==typeof i)h<r.pixels.length&&(n=i,s=i,a=i,o=255);else if(Array.isArray(i)){if(i.length<4)throw new Error("pixel array must be of the form [R, G, B, A]");h<r.pixels.length&&(n=i[0],s=i[1],a=i[2],o=i[3])}else i instanceof p5.Color&&h<r.pixels.length&&([n,s,a,o]=i._getRGBA([255,255,255,255]));for(let i=0;i<this._pixelDensity;i++)for(let u=0;u<this._pixelDensity;u++)h=4*((t*this._pixelDensity+u)*this.width*this._pixelDensity+(e*this._pixelDensity+i)),r.pixels[h]=n,r.pixels[h+1]=s,r.pixels[h+2]=a,r.pixels[h+3]=o}this.setModified(!0)}resize(e,t){0===e&&0===t?(e=this.canvas.width,t=this.canvas.height):0===e?e=this.canvas.width*t/this.canvas.height:0===t&&(t=this.canvas.height*e/this.canvas.width),e=Math.floor(e),t=Math.floor(t);const i=document.createElement("canvas");if(i.width=e,i.height=t,this.gifProperties){const i=this.gifProperties,r=(e,t)=>{let i=0;for(let r=0;r<t.height;r++)for(let n=0;n<t.width;n++){const s=Math.floor(n*e.width/t.width);let a=4*(Math.floor(r*e.height/t.height)*e.width+s);t.data[i++]=e.data[a++],t.data[i++]=e.data[a++],t.data[i++]=e.data[a++],t.data[i++]=e.data[a++]}};for(let n=0;n<i.numFrames;n++){const s=this.drawingContext.createImageData(e,t);r(i.frames[n].image,s),i.frames[n].image=s}}i.getContext("2d").drawImage(this.canvas,0,0,this.canvas.width,this.canvas.height,0,0,i.width,i.height),this.canvas.width=this.width=e,this.canvas.height=this.height=t,this.drawingContext.drawImage(i,0,0,e,t,0,0,e,t),this.pixels.length>0&&this.loadPixels(),this.setModified(!0)}copy(...e){let t,i,r,n,s,a,o,h,u;if(9===e.length)t=e[0],i=e[1],r=e[2],n=e[3],s=e[4],a=e[5],o=e[6],h=e[7],u=e[8];else{if(8!==e.length)throw new Error("Signature not supported");t=this,i=e[0],r=e[1],n=e[2],s=e[3],a=e[4],o=e[5],h=e[6],u=e[7]}this._copyHelper(this,t,i,r,n,s,a,o,h,u)}_copyHelper(e,t,i,r,n,s,a,o,h,u){const l=t.canvas.width/t.width;let c=0,p=0;t._renderer&&t._renderer.isP3D&&(c=t.width/2,p=t.height/2),e._renderer&&e._renderer.isP3D?(e.push(),e.resetMatrix(),e.noLights(),e.blendMode(e.BLEND),e.imageMode(e.CORNER),e._renderer.image(t,i+c,r+p,n,s,a,o,h,u),e.pop()):e.drawingContext.drawImage(t.canvas,l*(i+c),l*(r+p),l*n,l*s,a,o,h,u)}mask(e){void 0===e&&(e=this);const t=this.drawingContext.globalCompositeOperation;let i=this._pixelDensity,r=1;e instanceof En&&(r=e._pInst._renderer._pixelDensity);const n=[e,0,0,r*e.width,r*e.height,0,0,i*this.width,i*this.height];if(this.drawingContext.globalCompositeOperation="destination-in",this.gifProperties){for(let e=0;e<this.gifProperties.frames.length;e++)this.drawingContext.putImageData(this.gifProperties.frames[e].image,0,0),this.copy(...n),this.gifProperties.frames[e].image=this.drawingContext.getImageData(0,0,i*this.width,i*this.height);this.drawingContext.putImageData(this.gifProperties.frames[this.gifProperties.displayIndex].image,0,0)}else this.copy(...n);this.drawingContext.globalCompositeOperation=t,this.setModified(!0)}filter(e,t){Br.apply(this.canvas,Br[e],t),this.setModified(!0)}blend(...e){const t=this.drawingContext.globalCompositeOperation,i=e[e.length-1],r=Array.prototype.slice.call(e,0,e.length-1);this.drawingContext.globalCompositeOperation=i,this.copy(...r),this.drawingContext.globalCompositeOperation=t,this.setModified(!0)}setModified(e){this._modified=e}isModified(){return this._modified}save(e,t){if(this.gifProperties)!function(e,t){const i=e.gifProperties;let r=i.loopLimit;1===r?r=null:null===r&&(r=0);const n=new Uint8Array(e.width*e.height*i.numFrames),s=[],a={};for(let t=0;t<i.numFrames;t++){const r=new Set,n=i.frames[t].image.data,o=n.length,h=new Uint32Array(e.width*e.height);for(let e=0,t=0;e<o;e+=4,t++){const i=n[e+0]<<16|n[e+1]<<8|n[e+2];r.add(i),h[t]=i}const u=[...r].sort().toString();void 0===a[u]?a[u]={freq:1,frames:[t]}:(a[u].freq+=1,a[u].frames.push(t)),s.push(h)}let o=[];const h=Object.keys(a).sort((function(e,t){return a[t].freq-a[e].freq})),u=h[0].split(",").map((e=>parseInt(e)));o=o.concat(a[u].frames);const l=new Set(u);for(let e=1;e<h.length;e++){const t=h[e].split(",").map((e=>parseInt(e))).filter((e=>!l.has(e)));if(u.length+t.length<=256){for(let e=0;e<t.length;e++)u.push(t[e]),l.add(t[e]);o=o.concat(a[h[e]].frames)}}o=new Set(o);const c={};for(let e=0;e<u.length;e++)c[u[e]]||(c[u[e]]=e);let p=1;for(;p<u.length;)p<<=1;u.length=p;const d={loop:r,palette:new Uint32Array(u)},f=new omggif.GifWriter(n,e.width,e.height,d);let g={};for(let t=0;t<i.numFrames;t++){const r=!o.has(t),n=r?[]:u,a=new Uint8Array(e.width*e.height),h={},l=new Set;s[t].forEach(((e,i)=>{r?(void 0===h[e]&&(h[e]=n.length,n.push(e)),a[i]=h[e]):a[i]=c[e],t>0&&s[t-1][i]!==e&&l.add(e)}));const p={},d=n.filter((e=>!l.has(e)));if(d.length>0){const e=d[0],i=r?h[e]:c[e];if(t>0){for(let e=0;e<s[t].length;e++)s[t-1][e]===s[t][e]&&(a[e]=i);p.transparent=i,g.frameOpts.disposal=1}}if(p.delay=i.frames[t].delay/10,r){let e=1;for(;e<n.length;)e<<=1;n.length=e,p.palette=new Uint32Array(n)}t>0&&f.addFrame(0,0,e.width,e.height,g.pixelPaletteIndex,g.frameOpts),g={pixelPaletteIndex:a,frameOpts:p}}g.frameOpts.disposal=1,f.addFrame(0,0,e.width,e.height,g.pixelPaletteIndex,g.frameOpts);const m="gif";$r(new Blob([n.slice(0,f.end())],{type:"image/gif"}),t,m)}(this,e);else{let i,r=this.canvas;switch(t=t||qr(e,t)[1]||"png"){default:i="image/png";break;case"webp":i="image/webp";break;case"jpeg":case"jpg":i="image/jpeg"}r.toBlob((i=>{$r(i,e,t)}),i)}}async toBlob(){return new Promise((e=>{this.canvas.toBlob(e)}))}reset(){if(this.gifProperties){const e=this.gifProperties;e.playing=!0,e.timeSinceStart=0,e.timeDisplayed=0,e.lastChangeTime=0,e.loopCount=0,e.displayIndex=0,this.drawingContext.putImageData(e.frames[0].image,0,0)}}getCurrentFrame(){if(this.gifProperties){const e=this.gifProperties;return e.displayIndex%e.numFrames}}setFrame(e){if(this.gifProperties){const t=this.gifProperties;e<t.numFrames&&e>=0?(t.timeDisplayed=0,t.lastChangeTime=0,t.displayIndex=e,this.drawingContext.putImageData(t.frames[e].image,0,0)):console.log("Cannot set GIF to a frame number that is higher than total number of frames or below zero.")}}numFrames(){if(this.gifProperties)return this.gifProperties.numFrames}play(){this.gifProperties&&(this.gifProperties.playing=!0)}pause(){this.gifProperties&&(this.gifProperties.playing=!1)}delay(e,t){if(this.gifProperties){const i=this.gifProperties;if(t<i.numFrames&&t>=0)i.frames[t].delay=e;else for(const t of i.frames)t.delay=e}}}function Wr(e,t){e.Image=Hr}void 0!==p5&&Wr(p5);const Xr=function(e,t){return 0!==e&&(this.x=this.x%e),0!==t&&(this.y=this.y%t),this},Yr=function(e,t,i){return 0!==e&&(this.x=this.x%e),0!==t&&(this.y=this.y%t),0!==i&&(this.z=this.z%i),this};class Zr{constructor(...e){let t=e;"function"==typeof e[0]&&(this.isPInst=!0,this._fromRadians=e[0],this._toRadians=e[1],t=e.slice(2));let i=t.length;0===i?(this.dimensions=2,this._values=[0,0,0]):(this.dimensions=i,this._values=t)}get values(){return this._values}set values(e){let t=e.length;0===t?(this.dimensions=2,this._values=[0,0,0]):(this.dimensions=t,this._values=e.slice())}get x(){return this._values[0]||0}getValue(e){if(e<this._values.length)return this._values[e];p5._friendlyError("The index parameter is trying to set a value outside the bounds of the vector","p5.Vector.setValue")}setValue(e,t){e<this._values.length?this._values[e]=t:p5._friendlyError("The index parameter is trying to set a value outside the bounds of the vector","p5.Vector.setValue")}get y(){return this._values[1]||0}get z(){return this._values[2]||0}get w(){return this._values[3]||0}set x(e){this._values.length>1&&(this._values[0]=e)}set y(e){this._values.length>1&&(this._values[1]=e)}set z(e){this._values.length>2&&(this._values[2]=e)}set w(e){this._values.length>3&&(this._values[3]=e)}toString(){return`vector[${this._values.join(", ")}]`}set(...e){return e[0]instanceof Zr?this._values=e[0].values.slice():Array.isArray(e[0])?this._values=e[0].map((e=>e||0)):this._values=e.map((e=>e||0)),this.dimensions=this._values.length,this}copy(){return this.isPInst?new Zr(this._fromRadians,this._toRadians,...this._values):new Zr(...this._values)}add(...e){return e[0]instanceof Zr?e=e[0].values:Array.isArray(e[0])&&(e=e[0]),e.forEach(((e,t)=>{this._values[t]=(this._values[t]||0)+(e||0)})),this}rem(e,t,i){if(e instanceof Zr){if([e.x,e.y,e.z].every(Number.isFinite)){const t=parseFloat(e.x),i=parseFloat(e.y),r=parseFloat(e.z);return Yr.call(this,t,i,r)}}else if(Array.isArray(e)){if(e.every((e=>Number.isFinite(e)))){if(2===e.length)return Xr.call(this,e[0],e[1]);if(3===e.length)return Yr.call(this,e[0],e[1],e[2])}}else if(1===arguments.length){if(Number.isFinite(arguments[0])&&0!==arguments[0])return this.x=this.x%arguments[0],this.y=this.y%arguments[0],this.z=this.z%arguments[0],this}else if(2===arguments.length){const e=[...arguments];if(e.every((e=>Number.isFinite(e)))&&2===e.length)return Xr.call(this,e[0],e[1])}else if(3===arguments.length){const e=[...arguments];if(e.every((e=>Number.isFinite(e)))&&3===e.length)return Yr.call(this,e[0],e[1],e[2])}}sub(...e){return e[0]instanceof Zr?e[0].values.forEach(((e,t)=>{this._values[t]-=e||0})):Array.isArray(e[0])?e[0].forEach(((e,t)=>{this._values[t]-=e||0})):e.forEach(((e,t)=>{this._values[t]-=e||0})),this}mult(...e){if(1===e.length&&e[0]instanceof Zr){const t=e[0],i=Math.min(this._values.length,t.values.length);for(let e=0;e<i;e++){if(!Number.isFinite(t.values[e])||"number"!=typeof t.values[e])return console.warn("p5.Vector.prototype.mult:","v contains components that are either undefined or not finite numbers"),this;this._values[e]*=t.values[e]}}else if(1===e.length&&Array.isArray(e[0])){const t=e[0],i=Math.min(this._values.length,t.length);for(let e=0;e<i;e++){if(!Number.isFinite(t[e])||"number"!=typeof t[e])return console.warn("p5.Vector.prototype.mult:","arr contains elements that are either undefined or not finite numbers"),this;this._values[e]*=t[e]}}else if(1===e.length&&"number"==typeof e[0]&&Number.isFinite(e[0]))for(let t=0;t<this._values.length;t++)this._values[t]*=e[0];return this}div(...e){if(0===e.length)return this;if(1===e.length&&e[0]instanceof Zr){const t=e[0];if(t._values.every((e=>Number.isFinite(e)&&"number"==typeof e))){if(t._values.some((e=>0===e)))return console.warn("p5.Vector.prototype.div:","divide by 0"),this;this._values=this._values.map(((e,i)=>e/t._values[i]))}else console.warn("p5.Vector.prototype.div:","vector contains components that are either undefined or not finite numbers");return this}if(1===e.length&&Array.isArray(e[0])){const t=e[0];if(t.every((e=>Number.isFinite(e)&&"number"==typeof e))){if(t.some((e=>0===e)))return console.warn("p5.Vector.prototype.div:","divide by 0"),this;this._values=this._values.map(((e,i)=>e/t[i]))}else console.warn("p5.Vector.prototype.div:","array contains components that are either undefined or not finite numbers");return this}if(e.every((e=>Number.isFinite(e)&&"number"==typeof e))){if(e.some((e=>0===e)))return console.warn("p5.Vector.prototype.div:","divide by 0"),this;this._values=this._values.map(((t,i)=>t/e[0]))}else console.warn("p5.Vector.prototype.div:","arguments contain components that are either undefined or not finite numbers");return this}mag(){return Math.sqrt(this.magSq())}magSq(){return this._values.reduce(((e,t)=>e+t*t),0)}dot(...e){return e[0]instanceof Zr?this.dot(...e[0]._values):this._values.reduce(((t,i,r)=>t+i*(e[r]||0)),0)}cross(e){const t=this.y*e.z-this.z*e.y,i=this.z*e.x-this.x*e.z,r=this.x*e.y-this.y*e.x;return this.isPInst?new Zr(this._fromRadians,this._toRadians,t,i,r):new Zr(t,i,r)}dist(e){return e.copy().sub(this).mag()}normalize(){const e=this.mag();return 0!==e&&this.mult(1/e),this}limit(e){const t=this.magSq();return t>e*e&&this.div(Math.sqrt(t)).mult(e),this}setMag(e){return this.normalize().mult(e)}heading(){const e=Math.atan2(this.y,this.x);return this.isPInst?this._fromRadians(e):e}setHeading(e){this.isPInst&&(e=this._toRadians(e));let t=this.mag();return this.x=t*Math.cos(e),this.y=t*Math.sin(e),this}rotate(e){let t=this.heading()+e;this.isPInst&&(t=this._toRadians(t));const i=this.mag();return this.x=Math.cos(t)*i,this.y=Math.sin(t)*i,this}angleBetween(e){if(0===this.magSq()*e.magSq())return NaN;const t=this.cross(e);let i=Math.atan2(t.mag(),this.dot(e))*Math.sign(t.z||1);return this.isPInst&&(i=this._fromRadians(i)),i}lerp(e,t,i,r){return e instanceof Zr?this.lerp(e.x,e.y,e.z,t):(this.x+=(e-this.x)*r||0,this.y+=(t-this.y)*r||0,this.z+=(i-this.z)*r||0,this)}slerp(e,t){if(0===t)return this;if(1===t)return this.set(e);const i=this.mag(),r=e.mag();if(0===i*r)return this.mult(1-t).add(e.x*t,e.y*t,e.z*t),this;const n=this.cross(e),s=n.mag(),a=Math.atan2(s,this.dot(e));if(s>0)n.x/=s,n.y/=s,n.z/=s;else{if(a<.5*Math.PI)return this.mult(1-t).add(e.x*t,e.y*t,e.z*t),this;0===this.z&&0===e.z?n.set(0,0,1):0!==this.x?n.set(this.y,-this.x,0).normalize():n.set(1,0,0)}const o=n.cross(this),h=1-t+t*r/i,u=h*Math.cos(t*a),l=h*Math.sin(t*a);return this.x=this.x*u+o.x*l,this.y=this.y*u+o.y*l,this.z=this.z*u+o.z*l,this}reflect(e){const t=Zr.normalize(e);return this.sub(t.mult(2*this.dot(t)))}array(){return[this.x||0,this.y||0,this.z||0]}equals(...e){let t;t=e[0]instanceof Zr?e[0]._values:Array.isArray(e[0])?e[0]:e;for(let e=0;e<this._values.length;e++)if(this._values[e]!==(t[e]||0))return!1;return!0}clampToZero(){for(let e=0;e<this._values.length;e++)this._values[e]=this._clampToZero(this._values[e]);return this}_clampToZero(e){return Math.abs((e||0)-0)<=Number.EPSILON?0:e}static fromAngle(e,t){return void 0===t&&(t=1),new Zr(t*Math.cos(e),t*Math.sin(e))}static fromAngles(e,t,i){void 0===i&&(i=1);const r=Math.cos(t),n=Math.sin(t),s=Math.cos(e),a=Math.sin(e);return new Zr(i*a*n,-i*s,i*a*r)}static random2D(){return this.fromAngle(Math.random()*x)}static random3D(){const e=Math.random()*x,t=2*Math.random()-1,i=Math.sqrt(1-t*t),r=i*Math.cos(e),n=i*Math.sin(e);return new Zr(r,n,t)}static copy(e){return e.copy(e)}static add(e,t,i){return i?i.set(e):(i=e.copy(),3===arguments.length&&p5._friendlyError("The target parameter is undefined, it should be of type p5.Vector","p5.Vector.add")),i.add(t),i}static rem(e,t){if(e instanceof Zr&&t instanceof Zr){let i=e.copy();return i.rem(t),i}}static sub(e,t,i){return i?i.set(e):(i=e.copy(),3===arguments.length&&p5._friendlyError("The target parameter is undefined, it should be of type p5.Vector","p5.Vector.sub")),i.sub(t),i}static mult(e,t,i){return i?i.set(e):(i=e.copy(),3===arguments.length&&p5._friendlyError("The target parameter is undefined, it should be of type p5.Vector","p5.Vector.mult")),i.mult(t),i}static rotate(e,t,i){return 2===arguments.length?i=e.copy():(i instanceof Zr||p5._friendlyError("The target parameter should be of type p5.Vector","p5.Vector.rotate"),i.set(e)),i.rotate(t),i}static div(e,t,i){return i?i.set(e):(i=e.copy(),3===arguments.length&&p5._friendlyError("The target parameter is undefined, it should be of type p5.Vector","p5.Vector.div")),i.div(t),i}static dot(e,t){return e.dot(t)}static cross(e,t){return e.cross(t)}static dist(e,t){return e.dist(t)}static lerp(e,t,i,r){return r?r.set(e):(r=e.copy(),4===arguments.length&&p5._friendlyError("The target parameter is undefined, it should be of type p5.Vector","p5.Vector.lerp")),r.lerp(t,i),r}static slerp(e,t,i,r){return r?r.set(e):(r=e.copy(),4===arguments.length&&p5._friendlyError("The target parameter is undefined, it should be of type p5.Vector","p5.Vector.slerp")),r.slerp(t,i),r}static mag(e){return e.mag()}static magSq(e){return e.magSq()}static normalize(e,t){return arguments.length<2?t=e.copy():(t instanceof Zr||p5._friendlyError("The target parameter should be of type p5.Vector","p5.Vector.normalize"),t.set(e)),t.normalize()}static limit(e,t,i){return arguments.length<3?i=e.copy():(i instanceof Zr||p5._friendlyError("The target parameter should be of type p5.Vector","p5.Vector.limit"),i.set(e)),i.limit(t)}static setMag(e,t,i){return arguments.length<3?i=e.copy():(i instanceof Zr||p5._friendlyError("The target parameter should be of type p5.Vector","p5.Vector.setMag"),i.set(e)),i.setMag(t)}static heading(e){return e.heading()}static angleBetween(e,t){return e.angleBetween(t)}static reflect(e,t,i){return arguments.length<3?i=e.copy():(i instanceof Zr||p5._friendlyError("The target parameter should be of type p5.Vector","p5.Vector.reflect"),i.set(e)),i.reflect(t)}static array(e){return e.array()}static equals(e,t){let i;return e instanceof Zr?i=e:e instanceof Array?i=(new Zr).set(e):p5._friendlyError("The v1 parameter should be of type Array or p5.Vector","p5.Vector.equals"),i.equals(t)}}function Kr(e,t){e.Vector=Zr}function Jr(e){let t=0;for(let i=1;i<e.length;i++)t+=e[i-1].position.dist(e[i].position);return t}void 0!==p5&&Kr(p5);class Qr{constructor(e){for(const[t,i]of Object.entries(e))this[t]=i}}class en{vertices;_shape=null;_primitivesIndex=null;_contoursIndex=null;isClosing=!1;constructor(...e){if(this.constructor===en)throw new Error("ShapePrimitive is an abstract class: it cannot be instantiated.");if(!(e.length>0))throw new Error("At least one vertex must be passed to the constructor.");this.vertices=e}get vertexCount(){return this.vertices.length}get vertexCapacity(){throw new Error("Getter vertexCapacity must be implemented.")}get _firstInterpolatedVertex(){return this.startVertex()}get canOverrideAnchor(){return!1}accept(e){throw new Error("Method accept() must be implemented.")}addToShape(e){let t=e.at(-1);if(0===t.primitives.length)t.primitives.push(this);else{let i,r,n=e.at(-1,-1),s=n instanceof this.constructor,a=n.vertexCapacity-n.vertexCount;s&&a>0?(i=this.vertices.splice(0,a),r=this.vertices,n.vertices.push(...i),r.length>0&&t.primitives.push(this)):t.primitives.push(this)}if(this.vertices.length>0){let t=e.at(-1);this._primitivesIndex=t.primitives.length-1,this._contoursIndex=e.contours.length-1,this._shape=e}return e.at(-1,-1)}get _nextPrimitive(){return this._belongsToShape?this._shape.at(this._contoursIndex,this._primitivesIndex+1):null}get _belongsToShape(){return null!==this._shape}handlesClose(){return!1}close(e){throw new Error("Unimplemented!")}}class tn{#r;primitives;constructor(e=8){this.#r=e,this.primitives=[]}get kind(){const e=0===this.primitives.length,t=8===this.#r;return e&&t?7:this.#r}accept(e){for(const t of this.primitives)t.accept(e)}}class rn extends en{#n=1;get vertexCapacity(){return this.#n}accept(e){e.visitAnchor(this)}getEndVertex(){return this.vertices[0]}}class nn extends en{constructor(...e){if(super(...e),this.constructor===nn)throw new Error("Segment is an abstract class: it cannot be instantiated.")}get _previousPrimitive(){return this._belongsToShape?this._shape.at(this._contoursIndex,this._primitivesIndex-1):null}getStartVertex(){return this._previousPrimitive.getEndVertex()}getEndVertex(){return this.vertices.at(-1)}}class sn extends nn{#n=1;get vertexCapacity(){return this.#n}accept(e){e.visitLineSegment(this)}}class an extends nn{#s;#n;constructor(e,...t){super(...t);let i=Array.isArray(e)?e[0]:e;this.#s=i,this.#n=i}get order(){return this.#s}get vertexCapacity(){return this.#n}#a;hullLength(){return void 0===this.#a&&(this.#a=Jr([this.getStartVertex(),...this.vertices])),this.#a}accept(e){e.visitBezierSegment(this)}}class on extends nn{#n=1/0;_splineProperties={ends:Oe,tightness:0};get vertexCapacity(){return this.#n}accept(e){e.visitSplineSegment(this)}get _comesAfterSegment(){return this._previousPrimitive instanceof nn}get canOverrideAnchor(){return this._splineProperties.ends===Pe}get _firstInterpolatedVertex(){return this._splineProperties.ends===Pe?this._comesAfterSegment?this.vertices[1]:this.vertices[0]:this.getStartVertex()}get _chainedToSegment(){if(this._belongsToShape&&this._comesAfterSegment){let e=this._firstInterpolatedVertex.position;return this.getStartVertex().position.equals(e)}return!1}addToShape(e){const t=super.addToShape(e);if(this._splineProperties.ends=e._splineProperties.ends,this._splineProperties.tightness=e._splineProperties.tightness,this._splineProperties.ends!==Pe)return t;let i=!this._belongsToShape,r=e.at(-1,-1);if(i&&2===r.vertices.length&&r._comesAfterSegment&&!r._chainedToSegment){let e=r._firstInterpolatedVertex.position,t=r.getStartVertex().position;console.warn((n=e.array(),s=t.array(),`Spline does not start where previous path segment ends:\n second spline vertex at (${n})\n expected to be at (${s}).`))}var n,s;return t}getEndVertex(){return this._splineProperties.ends===Oe?super.getEndVertex():this._splineProperties.ends===Pe?this.vertices.at(-2):this.getStartVertex()}getControlPoints(){let e=[];this._comesAfterSegment&&e.push(this.getStartVertex()),e.push(this.getStartVertex());for(const t of this.vertices)e.push(t);const t=this.getStartVertex();return this._splineProperties.ends===Oe?(e.unshift(t),e.push(this.vertices.at(-1))):this._splineProperties.ends===Ne&&(e.unshift(this.vertices.at(-1)),e.push(t,this.vertices.at(0))),e}handlesClose(){if(!this._belongsToShape)return!1;return 2===this._shape.at(this._contoursIndex).primitives.length&&1===this._primitivesIndex}close(){this._splineProperties.ends=Ne}}class hn extends en{#n=1;get vertexCapacity(){return this.#n}accept(e){e.visitPoint(this)}}class un extends en{#n=2;get vertexCapacity(){return this.#n}accept(e){e.visitLine(this)}}class ln extends en{#n=3;get vertexCapacity(){return this.#n}accept(e){e.visitTriangle(this)}}class cn extends en{#n=4;get vertexCapacity(){return this.#n}accept(e){e.visitQuad(this)}}class pn extends en{#n=1/0;get vertexCapacity(){return this.#n}accept(e){e.visitTriangleFan(this)}}class dn extends en{#n=1/0;get vertexCapacity(){return this.#n}accept(e){e.visitTriangleStrip(this)}}class gn extends en{#n=1/0;get vertexCapacity(){return this.#n}accept(e){e.visitQuadStrip(this)}}class mn{creators;constructor(){let e=new Map;e.set("vertex-7",((...e)=>new rn(...e))),e.set("vertex-8",((...e)=>new sn(...e))),e.set(`vertex-${T}`,((...e)=>new hn(...e))),e.set(`vertex-${M}`,((...e)=>new un(...e))),e.set("vertex-4",((...e)=>new ln(...e))),e.set(`vertex-${k}`,((...e)=>new cn(...e))),e.set("vertex-6",((...e)=>new pn(...e))),e.set("vertex-5",((...e)=>new dn(...e))),e.set(`vertex-${I}`,((...e)=>new gn(...e))),e.set("bezierVertex-7",((e,...t)=>new rn(...t))),e.set("bezierVertex-8",((e,...t)=>new an(e,...t))),e.set("splineVertex-7",((...e)=>new rn(...e))),e.set("splineVertex-8",((...e)=>new on(...e))),this.creators=e}get(e,t){const i=`${e}-${t}`;return this.creators.get(i)}set(e,t,i){const r=`${e}-${t}`;this.creators.set(r,i)}clear(){this.creators.clear()}}class yn{#o;#h;#u;#l=3;kind=null;contours=[];_splineProperties={tightness:0,ends:Oe};userVertexProperties=null;constructor(e,t=new mn){this.#h=e,this.#o=e,this.#u=t;for(const e in this.#o)"position"!==e&&"textureCoordinates"!==e&&(this[e]=function(t){this.#o[e]=t})}serializeToArray(e){if(null==e)return[];if(e instanceof Number)return[e];if(e instanceof Array)return e;if(e.array instanceof Function)return e.array();throw new Error(`Can't convert ${e} to array!`)}vertexToArray(e){const t=[];for(const i in this.#o){if(this.userVertexProperties&&i in this.userVertexProperties)continue;const r=e[i];t.push(...this.serializeToArray(r))}for(const i in this.userVertexProperties)i in e?t.push(...this.serializeToArray(e[i])):t.push(...new Array(this.userVertexProperties[i]).fill(0));return t}hydrateValue(e,t){if(null===t)return null;if(t instanceof Number)return e.shift();if(t instanceof Array){const i=[];for(let r=0;r<t.length;r++)i.push(e.shift());return i}if(t instanceof Zr)return new Zr(e.shift(),e.shift(),e.shift());if(t instanceof dr){const t=[e.shift(),e.shift(),e.shift(),e.shift()];return new dr(t)}}arrayToVertex(e){const t={},i=[...e];for(const e in this.#o){if(this.userVertexProperties&&e in this.userVertexProperties)continue;const r=this.#o[e];t[e]=this.hydrateValue(i,r)}for(const e in this.userVertexProperties){const r=this.#o[e];t[e]=this.hydrateValue(i,r)}return t}arrayScale(e,t){return e.map((e=>e*t))}arraySum(e,...t){return e.map(((e,i)=>{let r=e;for(let e=0;e<t.length;e++)r+=t[e][i];return r}))}arrayMinus(e,t){return e.map(((e,i)=>e-t[i]))}evaluateCubicBezier([e,t,i,r],n){return this.arraySum(this.arrayScale(e,Math.pow(1-n,3)),this.arrayScale(t,3*Math.pow(1-n,2)*n),this.arrayScale(i,3*(1-n)*Math.pow(n,2)),this.arrayScale(r,Math.pow(n,3)))}evaluateQuadraticBezier([e,t,i],r){return this.arraySum(this.arrayScale(e,Math.pow(1-r,2)),this.arrayScale(t,2*(1-r)*r),this.arrayScale(i,r*r))}catmullRomToBezier(e,t){let i=1-t,r=[];for(let t=0;t+3<e.length;t++){const[n,s,a,o]=e.slice(t,t+4),h=this.arraySum(s,this.arrayScale(this.arrayMinus(a,n),i/6)),u=this.arraySum(a,this.arrayScale(this.arrayMinus(s,o),i/6)),l=a;r.push([h,u,l])}return r}at(e,t,i){let r,n;switch(r=this.contours.at(e),arguments.length){case 1:return r;case 2:return r.primitives.at(t);case 3:return n=r.primitives.at(t),n.vertices.at(i)}}reset(){this.#o={...this.#h},this.kind=null,this.contours=[],this.userVertexProperties=null}vertexProperty(e,t){this.userVertexProperties=this.userVertexProperties||{};const i=this.vertexPropertyKey(e),r=Array.isArray(t)?t:[t];this.userVertexProperties[i]||(this.userVertexProperties[i]=r.length),this.#o[i]=r}vertexPropertyName(e){return e.replace(/Src$/,"")}vertexPropertyKey(e){return e+"Src"}bezierOrder(...e){this.#l=e}splineProperty(e,t){this._splineProperties[e]=t}splineProperties(e){if(!e)return this._splineProperties;for(const t in e)this.splineProperty(t,e[t])}#c(e,t){return this.#o.position=e,void 0!==t&&(this.#o.textureCoordinates=t),new Qr(this.#o)}#p(e,t,...i){let r=this.#u.get(e,t);return"bezierVertex"===e?r(this.#l,...i):r(...i)}#d(e,t,i){let r=e,n=this.at(-1).kind,s=this.#c(t,i);return this.#p(r,n,s).addToShape(this)}vertex(e,t,{isClosing:i=!1}={}){this.#d("vertex",e,t).isClosing=i}bezierVertex(e,t){this.#d("bezierVertex",e,t)}splineVertex(e,t){this.#d("splineVertex",e,t)}arcVertex(e,t){this.#d("arcVertex",e,t)}beginContour(e=8){7===this.at(-1)?.kind&&this.contours.pop(),this.contours.push(new tn(e))}endContour(e=L,t=this.contours.length-1){const i=this.at(t);if(e===B){const e=8===i.kind,r=this.at(t,0,0),n=Object.hasOwn(r,"position"),s=this.at(t,-1);if(e&&n)if(s.handlesClose())s.close(r);else{const e=this.contours.splice(t+1,this.contours.length-t-1),i=this.#o;this.#o={...i};for(const e in r)["position","textureCoordinates"].includes(e)||(this.#o[e]=r[e]);this.vertex(r.position,r.textureCoordinates,{isClosing:!0}),this.#o=i,this.contours.push(...e)}}}beginShape(e=8){this.kind=e,this.beginContour(e)}endShape(e=L){e===B&&this.endContour(e,0)}accept(e){for(const t of this.contours)t.accept(e)}}class xn{constructor(){if(this.constructor===xn)throw new Error("PrimitiveVisitor is an abstract class: it cannot be instantiated.")}visitAnchor(e){throw new Error("Method visitAnchor() has not been implemented.")}visitLineSegment(e){throw new Error("Method visitLineSegment() has not been implemented.")}visitBezierSegment(e){throw new Error("Method visitBezierSegment() has not been implemented.")}visitSplineSegment(e){throw new Error("Method visitSplineSegment() has not been implemented.")}visitArcSegment(e){throw new Error("Method visitArcSegment() has not been implemented.")}visitPoint(e){throw new Error("Method visitPoint() has not been implemented.")}visitLine(e){throw new Error("Method visitLine() has not been implemented.")}visitTriangle(e){throw new Error("Method visitTriangle() has not been implemented.")}visitQuad(e){throw new Error("Method visitQuad() has not been implemented.")}visitTriangleFan(e){throw new Error("Method visitTriangleFan() has not been implemented.")}visitTriangleStrip(e){throw new Error("Method visitTriangleStrip() has not been implemented.")}visitQuadStrip(e){throw new Error("Method visitQuadStrip() has not been implemented.")}}class vn extends xn{path=new Path2D;strokeWeight;constructor({strokeWeight:e}){super(),this.strokeWeight=e}visitAnchor(e){let t=e.getEndVertex();this.path.moveTo(t.position.x,t.position.y)}visitLineSegment(e){if(e.isClosing)this.path.closePath();else{let t=e.getEndVertex();this.path.lineTo(t.position.x,t.position.y)}}visitBezierSegment(e){let[t,i,r]=e.vertices;switch(e.order){case 2:this.path.quadraticCurveTo(t.position.x,t.position.y,i.position.x,i.position.y);break;case 3:this.path.bezierCurveTo(t.position.x,t.position.y,i.position.x,i.position.y,r.position.x,r.position.y)}}visitSplineSegment(e){const t=e._shape;if(e._splineProperties.ends===Pe&&!e._comesAfterSegment){let t=e._firstInterpolatedVertex;this.path.moveTo(t.position.x,t.position.y)}const i=e.getControlPoints().map((e=>t.vertexToArray(e)));let r=t.catmullRomToBezier(i,e._splineProperties.tightness).map((e=>e.map((e=>t.arrayToVertex(e)))));for(const e of r){const t=e.flatMap((e=>[e.position.x,e.position.y]));this.path.bezierCurveTo(...t)}}visitPoint(e){const{x:t,y:i}=e.vertices[0].position;this.path.moveTo(t,i),this.path.lineTo(t+1e-5,i)}visitLine(e){const{x:t,y:i}=e.vertices[0].position,{x:r,y:n}=e.vertices[1].position;this.path.moveTo(t,i),this.path.lineTo(r,n)}visitTriangle(e){const[t,i,r]=e.vertices;this.path.moveTo(t.position.x,t.position.y),this.path.lineTo(i.position.x,i.position.y),this.path.lineTo(r.position.x,r.position.y),this.path.closePath()}visitQuad(e){const[t,i,r,n]=e.vertices;this.path.moveTo(t.position.x,t.position.y),this.path.lineTo(i.position.x,i.position.y),this.path.lineTo(r.position.x,r.position.y),this.path.lineTo(n.position.x,n.position.y),this.path.closePath()}visitTriangleFan(e){const[t,...i]=e.vertices;for(let e=0;e<i.length-1;e++){const r=i[e],n=i[e+1];this.path.moveTo(t.position.x,t.position.y),this.path.lineTo(r.position.x,r.position.y),this.path.lineTo(n.position.x,n.position.y),this.path.closePath()}}visitTriangleStrip(e){for(let t=0;t<e.vertices.length-2;t++){const i=e.vertices[t],r=e.vertices[t+1],n=e.vertices[t+2];this.path.moveTo(i.position.x,i.position.y),this.path.lineTo(r.position.x,r.position.y),this.path.lineTo(n.position.x,n.position.y),this.path.closePath()}}visitQuadStrip(e){for(let t=0;t<e.vertices.length-3;t+=2){const i=e.vertices[t],r=e.vertices[t+1],n=e.vertices[t+2],s=e.vertices[t+3];this.path.moveTo(i.position.x,i.position.y),this.path.lineTo(r.position.x,r.position.y),this.path.lineTo(s.position.x,s.position.y),this.path.lineTo(n.position.x,n.position.y),this.path.closePath()}}}class bn extends xn{contours=[];curveDetail;constructor({curveDetail:e=1}={}){super(),this.curveDetail=e}lastContour(){return this.contours[this.contours.length-1]}visitAnchor(e){this.contours.push([]);const t=e._nextPrimitive;t?.canOverrideAnchor?this.lastContour().push(t._firstInterpolatedVertex):this.lastContour().push(e.getEndVertex())}visitLineSegment(e){this.lastContour().push(e.getEndVertex())}visitBezierSegment(e){const t=this.lastContour(),i=Math.max(1,Math.ceil(e.hullLength()*this.curveDetail)),r=[e.getStartVertex(),...e.vertices].map((t=>e._shape.vertexToArray(t)));for(let n=0;n<i;n++){const s=(n+1)/i;t.push(e._shape.arrayToVertex(3===e.order?e._shape.evaluateCubicBezier(r,s):e._shape.evaluateQuadraticBezier(r,s)))}}visitSplineSegment(e){const t=e._shape,i=this.lastContour(),r=e.getControlPoints().map((e=>t.vertexToArray(e)));let n=t.catmullRomToBezier(r,e._splineProperties.tightness),s=t.vertexToArray(e._firstInterpolatedVertex);for(const e of n){const r=[s,...e],n=Math.max(1,Math.ceil(Jr(r.map((e=>t.arrayToVertex(e))))*this.curveDetail));for(let e=0;e<n;e++){const s=(e+1)/n;i.push(t.arrayToVertex(t.evaluateCubicBezier(r,s)))}s=e[2]}}visitPoint(e){this.contours.push(e.vertices.slice())}visitLine(e){this.contours.push(e.vertices.slice())}visitTriangle(e){this.contours.push(e.vertices.slice())}visitQuad(e){this.contours.push(e.vertices.slice())}visitTriangleFan(e){this.contours.push(e.vertices.slice())}visitTriangleStrip(e){this.contours.push(e.vertices.slice())}visitQuadStrip(e){this.contours.push(e.vertices.slice())}}class _n extends xn{constructor(){super()}}function wn(e,t){e.Shape=yn,e.Contour=tn,e.ShapePrimitive=en,e.Vertex=Qr,e.Anchor=rn,e.Segment=nn,e.LineSegment=sn,e.BezierSegment=an,e.SplineSegment=on,e.Point=hn,e.Line=un,e.Triangle=ln,e.Quad=cn,e.TriangleFan=pn,e.TriangleStrip=dn,e.QuadStrip=gn,e.PrimitiveVisitor=xn,e.PrimitiveToPath2DConverter=vn,e.PrimitiveToVerticesConverter=bn,e.PointAtLengthGetter=_n,t.bezierOrder=function(e){return this._renderer.bezierOrder(e)},t.splineVertex=function(...e){let t=0,i=0,r=0,n=0,s=0;2===e.length?[t,i]=e:4===e.length?[t,i,n,s]=e:3===e.length?[t,i,r]=e:5===e.length&&([t,i,r,n,s]=e),this._renderer.splineVertex(t,i,r,n,s)},t.splineProperty=function(e,t){return this._renderer.splineProperty(e,t)},t.splineProperties=function(e){return this._renderer.splineProperties(e)},t.vertex=function(e,t){let i,r,n;i=r=n=0,3===arguments.length?i=arguments[2]:4===arguments.length?(r=arguments[2],n=arguments[3]):5===arguments.length&&(i=arguments[2],r=arguments[3],n=arguments[4]),this._renderer.vertex(e,t,i,r,n)},t.beginContour=function(e){this._renderer.beginContour(e)},t.endContour=function(e=L){this._renderer.endContour(e)}}void 0!==p5&&wn(p5,p5.prototype);class Cn{#f={};constructor(e){for(const t in e)this[t]=e[t]}setValue(e,t){e in this.#f||(this.#f[e]=this[e]),this[e]=t}getDiff(){const e=this.#f;return this.#f={},e}getModified(){return this.#f}applyDiff(e){for(const e in this.#f)this[e]=this.#f[e];this.#f=e}}class An{constructor(e={}){for(const t in e)this[t]=e[t]}clone(){return new An(this)}}class En{static states={strokeColor:null,strokeSet:!1,fillColor:null,fillSet:!1,tint:null,imageMode:_,rectMode:_,ellipseMode:D,strokeWeight:1,textFont:{family:"sans-serif"},textLeading:15,leadingSet:!1,textSize:12,textAlign:E,textBaseline:F,bezierOrder:3,splineProperties:new An({ends:Oe,tightness:0}),textWrap:fe,fontStyle:de,fontStretch:de,fontWeight:de,lineHeight:de,fontVariant:de,direction:"inherit"};constructor(e,t,i,r){this._pInst=e,this._isMainCanvas=r,this.pixels=[],this._pixelDensity=Math.ceil(window.devicePixelRatio)||1,this.width=t,this.height=i,this._events={},r&&(this._isMainCanvas=!0),this.states=new Cn(En.states),this.states.strokeColor=new dr([0,0,0]),this.states.fillColor=new dr([1,1,1]),this._pushPopStack=[],this._pushPopDepth=0,this._clipping=!1,this._clipInvert=!1,this._currentShape=void 0}get currentShape(){return this._currentShape||(this._currentShape=new yn(this.getCommonVertexProperties())),this._currentShape}remove(){}pixelDensity(e){let t;return"number"==typeof e?(e!==this._pixelDensity&&(this._pixelDensity=e),t=this,this.resize(this.width,this.height)):t=this._pixelDensity,t}push(){this._pushPopDepth++,this._pushPopStack.push(this.states.getDiff())}pop(){this._pushPopDepth--;const e=this._pushPopStack.pop()||{},t=this.states.getModified();this.states.applyDiff(e),this.updateShapeVertexProperties(t),this.updateShapeProperties(t)}bezierOrder(e){if(void 0===e)return this.states.bezierOrder;this.states.setValue("bezierOrder",e),this.updateShapeProperties()}bezierVertex(e,t,i=0,r=0,n=0){const s=new Zr(e,t,i),a=this.getSupportedIndividualVertexProperties().textureCoordinates?new Zr(r,n):void 0;this.currentShape.bezierVertex(s,a)}splineProperty(e,t){if(void 0===t)return this.states.splineProperties[e];this.states.setValue("splineProperties",this.states.splineProperties.clone()),this.states.splineProperties[e]=t,this.updateShapeProperties()}splineProperties(e){if(!e)return{...this.states.splineProperties};for(const t in e)this.splineProperty(t,e[t])}splineVertex(e,t,i=0,r=0,n=0){const s=new Zr(e,t,i),a=this.getSupportedIndividualVertexProperties().textureCoordinates?new Zr(r,n):void 0;this.currentShape.splineVertex(s,a)}curveDetail(e){if(void 0===e)return this.states.curveDetail;this.states.setValue("curveDetail",e)}beginShape(...e){this.currentShape.reset(),this.updateShapeVertexProperties(),this.currentShape.beginShape(...e)}endShape(...e){this.currentShape.endShape(...e),this.drawShape(this.currentShape)}beginContour(e){this.currentShape.beginContour(e)}endContour(e){this.currentShape.endContour(e)}drawShape(e,t){throw new Error("Unimplemented")}vertex(e,t,i=0,r=0,n=0){const s=new Zr(e,t,i),a=this.getSupportedIndividualVertexProperties().textureCoordinates?new Zr(r,n):void 0;this.currentShape.vertex(s,a)}bezier(e,t,i,r,n,s,a,o){const h=this._pInst.bezierOrder();return this._pInst.bezierOrder(h),this._pInst.beginShape(),this._pInst.bezierVertex(e,t),this._pInst.bezierVertex(i,r),this._pInst.bezierVertex(n,s),this._pInst.bezierVertex(a,o),this._pInst.endShape(),this}spline(...e){if(8===e.length){const[t,i,r,n,s,a,o,h]=e;this._pInst.beginShape(),this._pInst.splineVertex(t,i),this._pInst.splineVertex(r,n),this._pInst.splineVertex(s,a),this._pInst.splineVertex(o,h),this._pInst.endShape()}else if(12===e.length){const[t,i,r,n,s,a,o,h,u,l,c,p]=e;this._pInst.beginShape(),this._pInst.splineVertex(t,i,r),this._pInst.splineVertex(n,s,a),this._pInst.splineVertex(o,h,u),this._pInst.splineVertex(l,c,p),this._pInst.endShape()}return this}beginClip(e={}){if(this._clipping)throw new Error("It looks like you're trying to clip while already in the middle of clipping. Did you forget to endClip()?");this._clipping=!0,this._clipInvert=e.invert}endClip(){if(!this._clipping)throw new Error("It looks like you've called endClip() without beginClip(). Did you forget to call beginClip() first?");this._clipping=!1}resize(e,t){this.width=e,this.height=t}get(e,t,i,r){const n=this._pixelDensity,s=this.canvas;if(void 0===e&&void 0===t)e=t=0,i=this.width,r=this.height;else if(e*=n,t*=n,void 0===i&&void 0===r)return e<0||t<0||e>=s.width||t>=s.height?[0,0,0,0]:this._getPixel(e,t);const a=new Hr(i*n,r*n);return a.pixelDensity(n),a.canvas.getContext("2d").drawImage(s,e,t,i*n,r*n,0,0,i*n,r*n),a}scale(e,t){}fill(...e){this.states.setValue("fillSet",!0),this.states.setValue("fillColor",this._pInst.color(...e)),this.updateShapeVertexProperties()}noFill(){this.states.setValue("fillColor",null)}strokeWeight(e){if(void 0===e)return this.states.strokeWeight;this.states.setValue("strokeWeight",e)}stroke(...e){this.states.setValue("strokeSet",!0),this.states.setValue("strokeColor",this._pInst.color(...e)),this.updateShapeVertexProperties()}noStroke(){this.states.setValue("strokeColor",null)}getCommonVertexProperties(){return{}}getSupportedIndividualVertexProperties(){return{textureCoordinates:!1}}updateShapeProperties(e){if(!e||e.bezierOrder||e.splineProperties){const e=this.currentShape;e.bezierOrder(this.states.bezierOrder),e.splineProperty("ends",this.states.splineProperties.ends),e.splineProperty("tightness",this.states.splineProperties.tightness)}}updateShapeVertexProperties(e){const t=this.getCommonVertexProperties();if(!e||Object.keys(e).some((e=>e in t))){const e=this.currentShape;for(const i in t)e[i](t[i])}}_applyDefaults(){return this}}const Dn="video",Sn="audio";class Fn{constructor(e,t,i,r){this.callback=e,this.time=t,this.id=i,this.val=r}}class Tn extends kr{constructor(e,t){super(e,t);const i=this;this.elt.crossOrigin="anonymous",this._prevTime=0,this._cueIDCounter=0,this._cues=[],this.pixels=[],this._pixelsState=this,this._pixelDensity=1,this._modified=!1,this._frameOnCanvas=-1,Object.defineProperty(i,"src",{get(){const e=i.elt.children[0].src,t=i.elt.src===window.location.href?"":i.elt.src;return e===window.location.href?t:e},set(t){for(let e=0;e<i.elt.children.length;e++)i.elt.removeChild(i.elt.children[e]);const r=document.createElement("source");r.src=t,e.appendChild(r),i.elt.src=t,i.modified=!0}}),i._onended=function(){},i.elt.onended=function(){i._onended(i)}}play(){let e;return this.elt.currentTime===this.elt.duration&&(this.elt.currentTime=0),this.elt.readyState>1||this.elt.load(),e=this.elt.play(),e&&e.catch&&e.catch((e=>{"NotAllowedError"===e.name?console.error(e):console.error("Media play method encountered an unexpected error",e)})),this}stop(){return this.elt.pause(),this.elt.currentTime=0,this}pause(){return this.elt.pause(),this}loop(){return this.elt.setAttribute("loop",!0),this.play(),this}noLoop(){return this.elt.removeAttribute("loop"),this}_setupAutoplayFailDetection(){const t=setTimeout((()=>{console.error(e)}),500);this.elt.addEventListener("play",(()=>clearTimeout(t)),{passive:!0,once:!0})}autoplay(e){const t=this.elt.getAttribute("autoplay");if(this.elt.setAttribute("autoplay",e),e&&!t){const e=()=>this._setupAutoplayFailDetection();4===this.elt.readyState?e():this.elt.addEventListener("canplay",e,{passive:!0,once:!0})}return this}volume(e){if(void 0===e)return this.elt.volume;this.elt.volume=e}speed(e){if(void 0===e)return this.presetPlaybackRate||this.elt.playbackRate;this.loadedmetadata?this.elt.playbackRate=e:this.presetPlaybackRate=e}time(e){return void 0!==e&&(this.elt.currentTime=e),this.elt.currentTime}duration(){return this.elt.duration}_ensureCanvas(){this.canvas||(this.canvas=document.createElement("canvas"),this.drawingContext=this.canvas.getContext("2d"),this.setModified(!0));const e=this._frameOnCanvas!==this._pInst.frameCount;this.loadedmetadata&&e&&(this.canvas.width!==this.elt.width&&(this.canvas.width=this.elt.width,this.canvas.height=this.elt.height,this.width=this.canvas.width,this.height=this.canvas.height),this.drawingContext.clearRect(0,0,this.canvas.width,this.canvas.height),!0===this.flipped&&(this.drawingContext.save(),this.drawingContext.scale(-1,1),this.drawingContext.translate(-this.canvas.width,0)),this.drawingContext.drawImage(this.elt,0,0,this.canvas.width,this.canvas.height),!0===this.flipped&&this.drawingContext.restore(),this.setModified(!0),this._frameOnCanvas=this._pInst.frameCount)}loadPixels(...e){return this._ensureCanvas(),p5.Renderer2D.prototype.loadPixels.apply(this,e)}updatePixels(e,t,i,r){return this.loadedmetadata&&(this._ensureCanvas(),p5.Renderer2D.prototype.updatePixels.call(this,e,t,i,r)),this.setModified(!0),this}get(...e){return this._ensureCanvas(),p5.Renderer2D.prototype.get.apply(this,e)}_getPixel(...e){return this.loadPixels(),p5.Renderer2D.prototype._getPixel.apply(this,e)}set(e,t,i){this.loadedmetadata&&(this._ensureCanvas(),p5.Renderer2D.prototype.set.call(this,e,t,i),this.setModified(!0))}copy(...e){this._ensureCanvas(),p5.prototype.copy.apply(this,e)}mask(...e){this.loadPixels(),this.setModified(!0),p5.Image.prototype.mask.apply(this,e)}isModified(){return this._modified}setModified(e){this._modified=e}onended(e){return this._onended=e,this}_getAudioContext(){}_getSoundOut(){}connect(e){let t,i;if(this._getAudioContext()&&this._getSoundOut())t=this._getAudioContext(),i=this._getSoundOut().input;else try{t=e.context,i=t.destination}catch(e){throw"connect() is meant to be used with Web Audio API or p5.sound.js"}this.audioSourceNode||(this.audioSourceNode=t.createMediaElementSource(this.elt),this.audioSourceNode.connect(i)),e?e.input?this.audioSourceNode.connect(e.input):this.audioSourceNode.connect(e):this.audioSourceNode.connect(i)}disconnect(){if(!this.audioSourceNode)throw"nothing to disconnect";this.audioSourceNode.disconnect()}showControls(){this.elt.style["text-align"]="inherit",this.elt.controls=!0}hideControls(){this.elt.controls=!1}addCue(e,t,i){const r=this._cueIDCounter++,n=new Fn(t,e,r,i);return this._cues.push(n),this.elt.ontimeupdate||(this.elt.ontimeupdate=this._onTimeUpdate.bind(this)),r}removeCue(e){for(let t=0;t<this._cues.length;t++)this._cues[t].id===e&&(console.log(e),this._cues.splice(t,1));0===this._cues.length&&(this.elt.ontimeupdate=null)}clearCues(){this._cues=[],this.elt.ontimeupdate=null}_onTimeUpdate(){const e=this.time();for(let t=0;t<this._cues.length;t++){const i=this._cues[t].time,r=this._cues[t].val;this._prevTime<i&&i<=e&&this._cues[t].callback(r)}this._prevTime=e}}function Mn(e,t){function i(e,t,i){(t._userNode?t._userNode:document.body).appendChild(e);const r=i?new Tn(e,t):new kr(e,t);return t._elements.push(r),r}function r(e,t,r,n){const s=document.createElement(t);"string"==typeof(r=r||"")&&(r=[r]);for(const e of r){const t=document.createElement("source");t.setAttribute("src",e),s.appendChild(t)}const a=i(s,e,!0);if(a.loadedmetadata=!1,s.addEventListener("loadedmetadata",(()=>{a.width=s.videoWidth,a.height=s.videoHeight,0===a.elt.width&&(a.elt.width=s.videoWidth),0===a.elt.height&&(a.elt.height=s.videoHeight),a.presetPlaybackRate&&(a.elt.playbackRate=a.presetPlaybackRate,delete a.presetPlaybackRate),a.loadedmetadata=!0})),"function"==typeof n){const e=()=>{n(a),s.removeEventListener("canplaythrough",e)};s.addEventListener("canplaythrough",e)}return a}t.createVideo=function(e,t){return r(this,Dn,e,t)},t.createAudio=function(e,t){return r(this,Sn,e,t)},t.VIDEO=Dn,t.AUDIO=Sn,void 0===navigator.mediaDevices&&(navigator.mediaDevices={}),void 0===navigator.mediaDevices.getUserMedia&&(navigator.mediaDevices.getUserMedia=function(e){const t=navigator.webkitGetUserMedia||navigator.mozGetUserMedia;return t?new Promise((function(i,r){t.call(navigator,e,i,r)})):Promise.reject(new Error("getUserMedia is not implemented in this browser"))}),t.createCapture=function(...r){if(!navigator.mediaDevices||!navigator.mediaDevices.getUserMedia)throw new DOMException("getUserMedia not supported in this browser");let n,s,a=!0,o=!0,h=!1;for(const e of r)e===t.VIDEO?o=!1:e===t.AUDIO?a=!1:"object"==typeof e?(void 0!==e.flipped&&(h=e.flipped,delete e.flipped),n=Object.assign({},n,e)):"function"==typeof e&&(s=e);const u={video:a,audio:o};n=Object.assign({},u,n);const l=document.createElement(Dn);l.setAttribute("playsinline",""),navigator.mediaDevices.getUserMedia(n).then((function(e){try{"srcObject"in l?l.srcObject=e:l.src=window.URL.createObjectURL(e)}catch(t){l.src=e}})).catch((t=>{"NotFoundError"===t.name&&e._friendlyError("No webcam found on this device","createCapture"),"NotAllowedError"===t.name&&e._friendlyError("Access to the camera was denied","createCapture"),console.error(t)}));const c=i(l,this,!0);return c.loadedmetadata=!1,l.addEventListener("loadedmetadata",(function(){l.play(),l.width?(c.width=l.width,c.height=l.height,h&&(c.elt.style.transform="scaleX(-1)")):(c.width=c.elt.width=l.videoWidth,c.height=c.elt.height=l.videoHeight),c.loadedmetadata=!0,s&&s(l.srcObject)})),c.flipped=h,c},e.MediaElement=Tn,Tn.prototype._getSoundOut=function(){return e.soundOut},Tn.prototype._getAudioContext=function(){return"function"==typeof t.getAudioContext?t.getAudioContext():void 0}}void 0!==p5&&Mn(p5,p5.prototype);var kn,In,Bn={modeAdjust:function(e,t,i,r,n){let s;return n===_?s={x:e,y:t,w:Math.abs(i),h:Math.abs(r)}:n===w?s={x:Math.min(e,i),y:Math.min(t,r),w:Math.abs(i-e),h:Math.abs(r-t)}:n===C?s={x:e-(i=Math.abs(i)),y:t-(r=Math.abs(r)),w:2*i,h:2*r}:n===D&&(s={x:e-.5*(i=Math.abs(i)),y:t-.5*(r=Math.abs(r)),w:i,h:r}),s}};function Ln(e,t){t._normalizeArcAngles=(e,t,i,r,n)=>{let s;return e-=x*Math.floor(e/x),t-=x*Math.floor(t/x),s=Math.min(Math.abs(e-t),x-Math.abs(e-t)),n&&(e=e<=f?Math.atan(i/r*Math.tan(e)):e>f&&e<=3*f?Math.atan(i/r*Math.tan(e))+g:Math.atan(i/r*Math.tan(e))+x,t=t<=f?Math.atan(i/r*Math.tan(t)):t>f&&t<=3*f?Math.atan(i/r*Math.tan(t))+g:Math.atan(i/r*Math.tan(t))+x),e>t&&(t+=x),{start:e,stop:t,correspondToSamePoint:s<1e-5}},t.arc=function(e,t,i,r,n,s,a,o){if(!this._renderer.states.strokeColor&&!this._renderer.states.fillColor)return this;if(n===s)return this;n=this._toRadians(n),s=this._toRadians(s);const h=Bn.modeAdjust(e,t,i,r,this._renderer.states.ellipseMode),u=this._normalizeArcAngles(n,s,h.w,h.h,!0);return u.correspondToSamePoint?this._renderer.ellipse([h.x,h.y,h.w,h.h,o]):(this._renderer.arc(h.x,h.y,h.w,h.h,u.start,u.stop,a,o),(this._accessibleOutputs.grid||this._accessibleOutputs.text)&&this._accsOutput("arc",[h.x,h.y,h.w,h.h,u.start,u.stop,a])),this},t.ellipse=function(e,t,i,r,n){return this._renderEllipse(...arguments)},t.circle=function(...e){const t=e.slice(0,2);return t.push(e[2],e[2]),this._renderEllipse(...t)},t._renderEllipse=function(e,t,i,r,n){if(!this._renderer.states.strokeColor&&!this._renderer.states.fillColor)return this;void 0===r&&(r=i);const s=Bn.modeAdjust(e,t,i,r,this._renderer.states.ellipseMode);return this._renderer.ellipse([s.x,s.y,s.w,s.h,n]),(this._accessibleOutputs.grid||this._accessibleOutputs.text)&&this._accsOutput("ellipse",[s.x,s.y,s.w,s.h]),this},t.line=function(...e){return this._renderer.states.strokeColor&&this._renderer.line(...e),(this._accessibleOutputs.grid||this._accessibleOutputs.text)&&this._accsOutput("line",e),this},t.point=function(...t){return this._renderer.states.strokeColor&&(1===t.length&&t[0]instanceof e.Vector?this._renderer.point.call(this._renderer,t[0].x,t[0].y,t[0].z):(this._renderer.point(...t),(this._accessibleOutputs.grid||this._accessibleOutputs.text)&&this._accsOutput("point",t))),this},t.quad=function(...e){return(this._renderer.states.strokeColor||this._renderer.states.fillColor)&&(this._renderer.isP3D&&e.length<12?this._renderer.quad.call(this._renderer,e[0],e[1],0,e[2],e[3],0,e[4],e[5],0,e[6],e[7],0,e[8],e[9]):(this._renderer.quad(...e),(this._accessibleOutputs.grid||this._accessibleOutputs.text)&&this._accsOutput("quadrilateral",e))),this},t.rect=function(...e){return this._renderRect(...e)},t.square=function(e,t,i,r,n,s,a){return this._renderRect.call(this,e,t,i,i,r,n,s,a)},t._renderRect=function(){if(this._renderer.states.strokeColor||this._renderer.states.fillColor){3===arguments.length&&(arguments[3]=arguments[2]);const e=Bn.modeAdjust(arguments[0],arguments[1],arguments[2],arguments[3],this._renderer.states.rectMode);this._renderer.states.rectMode===_&&(e.w=arguments[2],e.h=arguments[3]);const t=[e.x,e.y,e.w,e.h];for(let e=4;e<arguments.length;e++)t[e]=arguments[e];this._renderer.rect(t),(this._accessibleOutputs.grid||this._accessibleOutputs.text)&&this._accsOutput("rectangle",[e.x,e.y,e.w,e.h])}return this},t.triangle=function(...e){return(this._renderer.states.strokeColor||this._renderer.states.fillColor)&&this._renderer.triangle(e),(this._accessibleOutputs.grid||this._accessibleOutputs.text)&&this._accsOutput("triangle",e),this}}function On(e,t){t.ellipseMode=function(e){return e!==_&&e!==w&&e!==C&&e!==D||this._renderer.states.setValue("ellipseMode",e),this},t.noSmooth=function(){return this._renderer.isP3D?this.setAttributes("antialias",!1):"imageSmoothingEnabled"in this.drawingContext&&(this.drawingContext.imageSmoothingEnabled=!1),this},t.rectMode=function(e){return e!==_&&e!==w&&e!==C&&e!==D||this._renderer.states.setValue("rectMode",e),this},t.smooth=function(){return this._renderer.isP3D?this.setAttributes("antialias",!0):"imageSmoothingEnabled"in this.drawingContext&&(this.drawingContext.imageSmoothingEnabled=!0),this},t.strokeCap=function(e){return e!==V&&e!==R&&e!==N||this._renderer.strokeCap(e),this},t.strokeJoin=function(e){return e!==V&&e!==U&&e!==z||this._renderer.strokeJoin(e),this},t.strokeWeight=function(e){return this._renderer.strokeWeight(e),this}}function Pn(e,t){t.bezier=function(...e){return this._renderer.states.strokeColor||this._renderer.states.fillColor?(this._renderer.bezier(...e),this):this},t.bezierPoint=function(e,t,i,r,n){const s=1-n;return Math.pow(s,3)*e+3*Math.pow(s,2)*n*t+3*s*Math.pow(n,2)*i+Math.pow(n,3)*r},t.bezierTangent=function(e,t,i,r,n){const s=1-n;return 3*r*Math.pow(n,2)-3*i*Math.pow(n,2)+6*i*s*n-6*t*s*n+3*t*Math.pow(s,2)-3*e*Math.pow(s,2)},t.spline=function(...e){return this._renderer.states.strokeColor||this._renderer.states.fillColor?(this._renderer.spline(...e),this):this},t.splinePoint=function(e,t,i,r,n){const s=this._renderer.states.splineProperties.tightness,a=n*n*n,o=n*n;return e*((s-1)/2*a+(1-s)*o+(s-1)/2*n)+t*((s+3)/2*a+(-5-s)/2*o+1)+i*((-3-s)/2*a+(s+2)*o+(1-s)/2*n)+r*((1-s)/2*a+(s-1)/2*o)},t.splineTangent=function(e,t,i,r,n){const s=this._renderer.states.splineProperties.tightness,a=n*n*3,o=2*n;return e*((s-1)/2*a+(1-s)*o+(s-1)/2)+t*((s+3)/2*a+(-5-s)/2*o)+i*((-3-s)/2*a+(s+2)*o+(1-s)/2)+r*((1-s)/2*a+(s-1)/2*o)}}function Nn(e,t){t.beginShape=function(e){this._renderer.beginShape(...arguments)},t.bezierVertex=function(...e){this._renderer.bezierVertex(...e)},t.endShape=function(e,t=1){t<1&&(console.log("🌸 p5.js says: You can not have less than one instance"),t=1),this._renderer.endShape(e,t)},t.normal=function(e,t,i){return this._assert3d("normal"),this._renderer.normal(...arguments),this},t.vertexProperty=function(e,t){this._renderer.vertexProperty(e,t)}}function Rn(e,t){t.beginClip=function(e={}){this._renderer.beginClip(e)},t.endClip=function(){this._renderer.endClip()},t.clip=function(e,t){this._renderer.beginClip(t),e(),this._renderer.endClip(t)},t.background=function(...e){return this._renderer.background(...e),this},t.clear=function(...e){const t=e[0]||0,i=e[1]||0,r=e[2]||0,n=e[3]||0;return this._renderer.clear(t,i,r,n),this},t.colorMode=function(e,t,i,r,n){if([gr,mr,yr,xr,vr,br,_r,wr,Cr].includes(e)){this._renderer.states.setValue("colorMode",e),this._renderer.states.setValue("colorMaxes",this._renderer.states.colorMaxes.clone());const s=this._renderer.states.colorMaxes[e];2===arguments.length?(s[0]=t,s[1]=t,s[2]=t,s[3]=t):4===arguments.length?(s[0]=t,s[1]=i,s[2]=r):5===arguments.length&&(s[0]=t,s[1]=i,s[2]=r,s[3]=n)}return this._renderer.states.colorMode},t.fill=function(...e){return this._renderer.fill(...e),this},t.noFill=function(){return this._renderer.noFill(),this},t.noStroke=function(){return this._renderer.states.setValue("strokeColor",null),this},t.stroke=function(...e){return this._renderer.stroke(...e),this},t.erase=function(e=255,t=255){return this._renderer.erase(e,t),this},t.noErase=function(){return this._renderer.noErase(),this},t.blendMode=function(e){e===de&&(console.warn("NORMAL has been deprecated for use in blendMode. defaulting to BLEND instead."),e=j),this._renderer.blendMode(e)}}function Vn(e,t,i,r){for(var n=e[t++],s=1<<n,a=s+1,o=a+1,h=n+1,u=(1<<h)-1,l=0,c=0,p=0,d=e[t++],f=new Int32Array(4096),g=null;;){for(;l<16&&0!==d;)c|=e[t++]<<l,l+=8,1===d?d=e[t++]:--d;if(l<h)break;var m=c&u;if(c>>=h,l-=h,m!==s){if(m===a)break;for(var y=m<o?m:g,x=0,v=y;v>s;)v=f[v]>>8,++x;var b=v;if(p+x+(y!==m?1:0)>r)return void console.log("Warning, gif stream longer than expected.");i[p++]=b;var _=p+=x;for(y!==m&&(i[p++]=b),v=y;x--;)v=f[v],i[--_]=255&v,v>>=8;null!==g&&o<4096&&(f[o++]=g<<8|b,o>=u+1&&h<12&&(++h,u=u<<1|1)),g=m}else o=a+1,u=(1<<(h=n+1))-1,g=null}return p!==r&&console.log("Warning, gif stream shorter than expected."),i}void 0!==p5&&Ln(p5,p5.prototype),void 0!==p5&&On(0,p5.prototype),void 0!==p5&&Pn(0,p5.prototype),void 0!==p5&&Nn(0,p5.prototype),void 0!==p5&&Rn(0,p5.prototype);try{In=function(e,t,i,r){var n=0,s=void 0===(r=void 0===r?{}:r).loop?null:r.loop,a=void 0===r.palette?null:r.palette;if(t<=0||i<=0||t>65535||i>65535)throw new Error("Width/Height invalid.");function o(e){var t=e.length;if(t<2||t>256||t&t-1)throw new Error("Invalid code/color length, must be power of 2 and 2 .. 256.");return t}e[n++]=71,e[n++]=73,e[n++]=70,e[n++]=56,e[n++]=57,e[n++]=97;var h=0,u=0;if(null!==a){for(var l=o(a);l>>=1;)++h;if(l=1<<h,--h,void 0!==r.background){if((u=r.background)>=l)throw new Error("Background index out of range.");if(0===u)throw new Error("Background index explicitly passed as 0.")}}if(e[n++]=255&t,e[n++]=t>>8&255,e[n++]=255&i,e[n++]=i>>8&255,e[n++]=(null!==a?128:0)|h,e[n++]=u,e[n++]=0,null!==a)for(var c=0,p=a.length;c<p;++c){var d=a[c];e[n++]=d>>16&255,e[n++]=d>>8&255,e[n++]=255&d}if(null!==s){if(s<0||s>65535)throw new Error("Loop count invalid.");e[n++]=33,e[n++]=255,e[n++]=11,e[n++]=78,e[n++]=69,e[n++]=84,e[n++]=83,e[n++]=67,e[n++]=65,e[n++]=80,e[n++]=69,e[n++]=50,e[n++]=46,e[n++]=48,e[n++]=3,e[n++]=1,e[n++]=255&s,e[n++]=s>>8&255,e[n++]=0}var f=!1;this.addFrame=function(t,i,r,s,h,u){if(!0===f&&(--n,f=!1),u=void 0===u?{}:u,t<0||i<0||t>65535||i>65535)throw new Error("x/y invalid.");if(r<=0||s<=0||r>65535||s>65535)throw new Error("Width/Height invalid.");if(h.length<r*s)throw new Error("Not enough pixels for the frame size.");var l=!0,c=u.palette;if(null==c&&(l=!1,c=a),null==c)throw new Error("Must supply either a local or global palette.");for(var p=o(c),d=0;p>>=1;)++d;p=1<<d;var g=void 0===u.delay?0:u.delay,m=void 0===u.disposal?0:u.disposal;if(m<0||m>3)throw new Error("Disposal out of range.");var y=!1,x=0;if(void 0!==u.transparent&&null!==u.transparent&&(y=!0,(x=u.transparent)<0||x>=p))throw new Error("Transparent color index.");if((0!==m||y||0!==g)&&(e[n++]=33,e[n++]=249,e[n++]=4,e[n++]=m<<2|(!0===y?1:0),e[n++]=255&g,e[n++]=g>>8&255,e[n++]=x,e[n++]=0),e[n++]=44,e[n++]=255&t,e[n++]=t>>8&255,e[n++]=255&i,e[n++]=i>>8&255,e[n++]=255&r,e[n++]=r>>8&255,e[n++]=255&s,e[n++]=s>>8&255,e[n++]=!0===l?128|d-1:0,!0===l)for(var v=0,b=c.length;v<b;++v){var _=c[v];e[n++]=_>>16&255,e[n++]=_>>8&255,e[n++]=255&_}return n=function(e,t,i,r){e[t++]=i;var n=t++,s=1<<i,a=s-1,o=s+1,h=o+1,u=i+1,l=0,c=0;function p(i){for(;l>=i;)e[t++]=255&c,c>>=8,l-=8,t===n+256&&(e[n]=255,n=t++)}function d(e){c|=e<<l,l+=u,p(8)}var f=r[0]&a,g={};d(s);for(var m=1,y=r.length;m<y;++m){var x=r[m]&a,v=f<<8|x,b=g[v];if(void 0===b){for(c|=f<<l,l+=u;l>=8;)e[t++]=255&c,c>>=8,l-=8,t===n+256&&(e[n]=255,n=t++);4096===h?(d(s),h=o+1,u=i+1,g={}):(h>=1<<u&&++u,g[v]=h++),f=x}else f=b}return d(f),d(o),p(1),n+1===t?e[n]=0:(e[n]=t-n-1,e[t++]=0),t}(e,n,d<2?2:d,h),n},this.end=function(){return!1===f&&(e[n++]=59,f=!0),n},this.getOutputBuffer=function(){return e},this.setOutputBuffer=function(t){e=t},this.getOutputBufferPosition=function(){return n},this.setOutputBufferPosition=function(e){n=e}},kn=function(e){var t=0;if(71!==e[t++]||73!==e[t++]||70!==e[t++]||56!==e[t++]||56!=(e[t++]+1&253)||97!==e[t++])throw new Error("Invalid GIF 87a/89a header.");var i=e[t++]|e[t++]<<8,r=e[t++]|e[t++]<<8,n=e[t++],s=n>>7,a=1<<1+(7&n);e[t++],e[t++];var o=null,h=null;s&&(o=t,h=a,t+=3*a);var u=!0,l=[],c=0,p=null,d=0,f=null;for(this.width=i,this.height=r;u&&t<e.length;)switch(e[t++]){case 33:switch(e[t++]){case 255:if(11!==e[t]||78==e[t+1]&&69==e[t+2]&&84==e[t+3]&&83==e[t+4]&&67==e[t+5]&&65==e[t+6]&&80==e[t+7]&&69==e[t+8]&&50==e[t+9]&&46==e[t+10]&&48==e[t+11]&&3==e[t+12]&&1==e[t+13]&&0==e[t+16])t+=14,f=e[t++]|e[t++]<<8,t++;else for(t+=12;;){if(!((S=e[t++])>=0))throw Error("Invalid block size");if(0===S)break;t+=S}break;case 249:if(4!==e[t++]||0!==e[t+4])throw new Error("Invalid graphics extension block.");var g=e[t++];c=e[t++]|e[t++]<<8,p=e[t++],1&g||(p=null),d=g>>2&7,t++;break;case 254:for(;;){if(!((S=e[t++])>=0))throw Error("Invalid block size");if(0===S)break;t+=S}break;default:throw new Error("Unknown graphic control label: 0x"+e[t-1].toString(16))}break;case 44:var m=e[t++]|e[t++]<<8,y=e[t++]|e[t++]<<8,x=e[t++]|e[t++]<<8,v=e[t++]|e[t++]<<8,b=e[t++],_=b>>6&1,w=1<<1+(7&b),C=o,A=h,E=!1;b>>7&&(E=!0,C=t,A=w,t+=3*w);var D=t;for(t++;;){var S;if(!((S=e[t++])>=0))throw Error("Invalid block size");if(0===S)break;t+=S}l.push({x:m,y:y,width:x,height:v,has_local_palette:E,palette_offset:C,palette_size:A,data_offset:D,data_length:t-D,transparent_index:p,interlaced:!!_,delay:c,disposal:d});break;case 59:u=!1;break;default:throw new Error("Unknown gif block: 0x"+e[t-1].toString(16))}this.numFrames=function(){return l.length},this.loopCount=function(){return f},this.frameInfo=function(e){if(e<0||e>=l.length)throw new Error("Frame index out of range.");return l[e]},this.decodeAndBlitFrameBGRA=function(t,r){var n=this.frameInfo(t),s=n.width*n.height,a=new Uint8Array(s);Vn(e,n.data_offset,a,s);var o=n.palette_offset,h=n.transparent_index;null===h&&(h=256);var u=n.width,l=i-u,c=u,p=4*(n.y*i+n.x),d=4*((n.y+n.height)*i+n.x),f=p,g=4*l;!0===n.interlaced&&(g+=4*i*7);for(var m=8,y=0,x=a.length;y<x;++y){var v=a[y];if(0===c&&(c=u,(f+=g)>=d&&(g=4*l+4*i*(m-1),f=p+(u+l)*(m<<1),m>>=1)),v===h)f+=4;else{var b=e[o+3*v],_=e[o+3*v+1],w=e[o+3*v+2];r[f++]=w,r[f++]=_,r[f++]=b,r[f++]=255}--c}},this.decodeAndBlitFrameRGBA=function(t,r){var n=this.frameInfo(t),s=n.width*n.height,a=new Uint8Array(s);Vn(e,n.data_offset,a,s);var o=n.palette_offset,h=n.transparent_index;null===h&&(h=256);var u=n.width,l=i-u,c=u,p=4*(n.y*i+n.x),d=4*((n.y+n.height)*i+n.x),f=p,g=4*l;!0===n.interlaced&&(g+=4*i*7);for(var m=8,y=0,x=a.length;y<x;++y){var v=a[y];if(0===c&&(c=u,(f+=g)>=d&&(g=4*l+4*i*(m-1),f=p+(u+l)*(m<<1),m>>=1)),v===h)f+=4;else{var b=e[o+3*v],_=e[o+3*v+1],w=e[o+3*v+2];r[f++]=b,r[f++]=_,r[f++]=w,r[f++]=255}--c}}}}catch(e){}function Un(e,t){t.createImage=function(t,i){return new e.Image(t,i)},t.saveCanvas=function(...e){let i,r,n,s,a;if(e[0]instanceof HTMLCanvasElement)i=e[0],e.shift();else if(e[0]instanceof kr)i=e[0].elt,e.shift();else if(e[0]instanceof Ca){const t=e[0];s=this.createGraphics(t.width,t.height),s.pixelDensity(t.pixelDensity()),t.loadPixels(),s.loadPixels(),s.pixels.set(t.pixels),s.updatePixels(),i=s._renderer.canvas,e.shift()}else i=this._curElement&&this._curElement.elt;switch(e.length>=1&&(r=e[0]),e.length>=2&&(n=e[1]),n=n||t._checkFileExtension(r,n)[1]||"png",n){default:a="image/png";break;case"webp":a="image/webp";break;case"jpeg":case"jpg":a="image/jpeg"}i.toBlob((e=>{t.downloadFile(e,r,n),s&&s.remove()}),a)},t.encodeAndDownloadGif=function(e,i){const r=e.gifProperties;let n=r.loopLimit;1===n?n=null:null===n&&(n=0);const s=new Uint8Array(e.width*e.height*r.numFrames),a=[],o={};for(let t=0;t<r.numFrames;t++){const i=new Set,n=r.frames[t].image.data,s=n.length,h=new Uint32Array(e.width*e.height);for(let e=0,t=0;e<s;e+=4,t++){const r=n[e+0]<<16|n[e+1]<<8|n[e+2];i.add(r),h[t]=r}const u=[...i].sort().toString();void 0===o[u]?o[u]={freq:1,frames:[t]}:(o[u].freq+=1,o[u].frames.push(t)),a.push(h)}let h=[];const u=Object.keys(o).sort((function(e,t){return o[t].freq-o[e].freq})),l=u[0].split(",").map((e=>parseInt(e)));h=h.concat(o[l].frames);const c=new Set(l);for(let e=1;e<u.length;e++){const t=u[e].split(",").map((e=>parseInt(e))).filter((e=>!c.has(e)));if(l.length+t.length<=256){for(let e=0;e<t.length;e++)l.push(t[e]),c.add(t[e]);h=h.concat(o[u[e]].frames)}}h=new Set(h);const p={};for(let e=0;e<l.length;e++)p[l[e]]||(p[l[e]]=e);let d=1;for(;d<l.length;)d<<=1;l.length=d;const f={loop:n,palette:new Uint32Array(l)},g=new In(s,e.width,e.height,f);let m={};for(let t=0;t<r.numFrames;t++){const i=!h.has(t),n=i?[]:l,s=new Uint8Array(e.width*e.height),o={},u=new Set;a[t].forEach(((e,r)=>{i?(void 0===o[e]&&(o[e]=n.length,n.push(e)),s[r]=o[e]):s[r]=p[e],t>0&&a[t-1][r]!==e&&u.add(e)}));const c={},d=n.filter((e=>!u.has(e)));if(d.length>0){const e=d[0],r=i?o[e]:p[e];if(t>0){for(let e=0;e<a[t].length;e++)a[t-1][e]===a[t][e]&&(s[e]=r);c.transparent=r,m.frameOpts.disposal=1}}if(c.delay=r.frames[t].delay/10,i){let e=1;for(;e<n.length;)e<<=1;n.length=e,c.palette=new Uint32Array(n)}t>0&&g.addFrame(0,0,e.width,e.height,m.pixelPaletteIndex,m.frameOpts),m={pixelPaletteIndex:s,frameOpts:c}}m.frameOpts.disposal=1,g.addFrame(0,0,e.width,e.height,m.pixelPaletteIndex,m.frameOpts);const y=new Blob([s.slice(0,g.end())],{type:"image/gif"});t.downloadFile(y,i,"gif")},t.saveFrames=function(e,i,r,n,s){let a=r||3;a=Math.max(Math.min(a,15),0),a*=1e3;let o=n||15;o=Math.max(Math.min(o,22),0);let h=0;const u=t._makeFrame,l=this._curElement.elt;let c=[];const p=setInterval((()=>{c.push(u(e+h,i,l)),h++}),1e3/o);setTimeout((()=>{if(clearInterval(p),s)s(c);else for(const e of c)t.downloadFile(e.imageData,e.filename,e.ext);c=[]}),a+.01)},t._makeFrame=function(e,t,i){let r,n;if(r=this?this._curElement.elt:i,t)switch(t.toLowerCase()){case"png":default:n="image/png";break;case"jpeg":case"jpg":n="image/jpeg"}else t="png",n="image/png";let s=r.toDataURL(n);s=s.replace(n,"image/octet-stream");const a={};return a.imageData=s,a.filename=e,a.ext=t,a}}function zn(e){const t=e.options.typed?function(e){switch(!0){case"true"===e:case"false"===e:return"true"===e;case/.\./.test(e):return parseFloat(e);case isFinite(e):return parseInt(e);default:return e}}(e.value):e.value;e.entry.push(e.reviver(t,e.row,e.col)),e.value="",e.col++}function Gn(e){e.output.push(e.entry),e.entry=[],e.row++,e.col=1}function jn(e){return e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")}void 0!==p5&&Un(p5,p5.prototype);class $n extends Error{status;response;ok}async function qn(e,t){try{const i=await fetch(e);if(i.ok){let e;switch(t){case"json":e=await i.json();break;case"text":e=await i.text();break;case"arrayBuffer":e=await i.arrayBuffer();break;case"blob":e=await i.blob();break;case"bytes":if(i.bytes)e=await i.bytes();else{const t=await i.arrayBuffer();e=new Uint8Array(t)}break;default:throw new Error("Unsupported response type")}return{data:e,headers:i.headers}}{const e=new $n(i.statusText);throw e.status=i.status,e.response=i,e.ok=!1,e}}catch(e){throw e instanceof TypeError?console.log("You may have encountered a CORS error"):e instanceof $n?console.log("You have encountered a HTTP error"):e instanceof SyntaxError&&console.log("There is an error parsing the response to requested data structure"),e}}function Hn(e,t){function i(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}t.loadJSON=async function(t,i,r){try{const{data:e}=await qn(t,"json");return i?i(e):e}catch(i){if(e._friendlyFileLoadError(5,t),r)return r(i);throw i}},t.loadStrings=async function(t,i,r){try{let{data:e}=await qn(t,"text");return e=e.split(/\r?\n/),i?i(e):e}catch(i){if(e._friendlyFileLoadError(3,t),r)return r(i);throw i}},t.loadTable=async function(t,i,r,n,s){"function"==typeof arguments[arguments.length-1]&&("function"==typeof arguments[arguments.length-2]?(n=arguments[arguments.length-2],s=arguments[arguments.length-1]):n=arguments[arguments.length-1]),"string"!=typeof i&&(i=","),"function"==typeof r&&(r=!1);try{let{data:s}=await qn(t,"text"),a=new e.Table;return s=function(e,t,i=e=>e){const r=Object.create(null);if(r.options=t||{},r.reviver=i,r.value="",r.entry=[],r.output=[],r.col=1,r.row=1,r.options.delimiter=void 0===r.options.delimiter?'"':t.delimiter,r.options.delimiter.length>1||0===r.options.delimiter.length)throw Error(`CSVError: delimiter must be one character [${r.options.separator}]`);if(r.options.separator=void 0===r.options.separator?",":t.separator,r.options.separator.length>1||0===r.options.separator.length)throw Error(`CSVError: separator must be one character [${r.options.separator}]`);const n=new RegExp(`${jn(r.options.delimiter)}|${jn(r.options.separator)}|\r\n|\n|\r|[^${jn(r.options.delimiter)}${jn(r.options.separator)}\r\n]+`,"y"),s=/^(\r\n|\n|\r)$/;let a=[],o="",h=0;for(;null!==(a=n.exec(e));)switch(o=a[0],h){case 0:switch(!0){case o===r.options.delimiter:h=3;break;case o===r.options.separator:h=0,zn(r);break;case s.test(o):h=0,zn(r),Gn(r);break;default:r.value+=o,h=2}break;case 2:switch(!0){case o===r.options.separator:h=0,zn(r);break;case s.test(o):h=0,zn(r),Gn(r);break;default:throw h=4,Error(`CSVError: Illegal state [row:${r.row}, col:${r.col}]`)}break;case 3:1==(o===r.options.delimiter)?h=4:(h=3,r.value+=o);break;case 4:switch(!0){case o===r.options.delimiter:h=3,r.value+=o;break;case o===r.options.separator:h=0,zn(r);break;case s.test(o):h=0,zn(r),Gn(r);break;default:throw Error(`CSVError: Illegal state [row:${r.row}, col:${r.col}]`)}}return 0!==r.entry.length&&(zn(r),Gn(r)),r.output}(s,{separator:i}),a.columns=r?s.shift():Array(s[0].length).fill(null),s.forEach((t=>{const i=new e.TableRow(t);a.addRow(i)})),n?n(a):a}catch(i){if(e._friendlyFileLoadError(2,t),s)return s(i);throw i}},t.loadXML=async function(t,i,r){try{const r=new DOMParser;let{data:n}=await qn(t,"text");const s=r.parseFromString(n,"application/xml");return n=new e.XML(s),i?i(n):n}catch(i){if(e._friendlyFileLoadError(1,t),r)return r(i);throw i}},t.loadBytes=async function(t,i,r){try{let{data:e}=await qn(t,"arrayBuffer");return e=new Uint8Array(e),i?i(e):e}catch(i){if(e._friendlyFileLoadError(6,t),r)return r(i);throw i}},t.loadBlob=async function(e,t,i){try{const{data:i}=await qn(e,"blob");return t?t(i):i}catch(e){if(i)return i(e);throw e}},t.httpGet=async function(e,t="text",i,r){return"function"==typeof t&&(r=i,i=t,t="text"),this.httpDo(e,"GET",t,i,r)},t.httpPost=async function(t,i,r="text",n,s){"function"==typeof i?(n=i,s=r,i=void 0,r="text"):"function"==typeof r&&(s=n,n=r,r="text");let a=i,o="text/plain";i instanceof e.XML?(a=i.serialize(),o="application/xml"):i instanceof e.Image?(a=await i.toBlob(),o="image/png"):"object"==typeof i&&(a=JSON.stringify(i),o="application/json");const h={method:"POST",body:a,headers:{"Content-Type":o}};a&&(h.body=a);const u=new Request(t,h);return this.httpDo(u,"POST",r,n,s)},t.httpDo=async function(e,t,i,r,n){if("function"==typeof i&&(n=r,r=i,i=void 0),!i){switch("string"==typeof e?e.split(".").pop():e.url.split(".").pop()){case"json":i="json";break;case"jpg":case"jpeg":case"png":case"webp":case"gif":i="blob";break;default:i="text"}}const s=new Request(e,{method:t});try{const{data:e}=await qn(s,i);return r?r(e):e}catch(e){if(n)return n(e);throw e}},t._pWriters=[],t.createWriter=function(i,r){let n;for(const s in t._pWriters)if(t._pWriters[s].name===i)return n=new e.PrintWriter(i+this.millis(),r),t._pWriters.push(n),n;return n=new e.PrintWriter(i,r),t._pWriters.push(n),n},e.PrintWriter=function(e,i){let r=this;this.name=e,this.content="",this.write=function(e){this.content+=e},this.print=function(e){this.content+=`${e}\n`},this.clear=function(){this.content=""},this.close=function(){const n=[];n.push(this.content),t.writeFile(n,e,i);for(const e in t._pWriters)t._pWriters[e].name===this.name&&t._pWriters.splice(e,1);r.clear(),r={}}},t.save=function(i,r,n){const s=arguments,a=this._curElement?this._curElement.elt:this.elt;if(0!==s.length)if(s[0]instanceof En||s[0]instanceof ga)t.saveCanvas(s[0].canvas,s[1],s[2]);else if(1===s.length&&"string"==typeof s[0])t.saveCanvas(a,s[0]);else{switch(qr(s[1],s[2])[1]){case"json":return void t.saveJSON(s[0],s[1],s[2]);case"txt":return void t.saveStrings(s[0],s[1],s[2]);default:s[0]instanceof Array?t.saveStrings(s[0],s[1],s[2]):s[0]instanceof e.Table?t.saveTable(s[0],s[1],s[2]):s[0]instanceof e.Image?t.saveCanvas(s[0].canvas,s[1]):s[0]instanceof e.SoundFile&&t.saveSound(s[0],s[1],s[2],s[3])}}else t.saveCanvas(a)},t.saveJSON=function(e,t,i){let r;r=i?JSON.stringify(e):JSON.stringify(e,void 0,2),this.saveStrings(r.split("\n"),t,"json")},t.saveStrings=function(t,i,r,n){const s=r||"txt",a=new e.PrintWriter(i,s);for(let e of t)n?a.write(e+"\r\n"):a.write(e+"\n");a.close(),a.clear()},t.saveTable=function(e,t,r){let n;void 0===r?(n=t.substring(t.lastIndexOf(".")+1,t.length),n===t&&(n="csv")):n=r;const s=this.createWriter(t,n),a=e.columns;let o=",";if("tsv"===n&&(o="\t"),"html"!==n){const t=e.toString(o);s.write(t)}else{s.print("<html>"),s.print("<head>");let t=' <meta http-equiv="content-type" content';if(t+='="text/html;charset=utf-8" />',s.print(t),s.print("</head>"),s.print("<body>"),s.print(" <table>"),"0"!==a[0]){s.print(" <tr>");for(let e=0;e<a.length;e++){const t=i(a[e]);s.print(` <td>${t}`),s.print(" </td>")}s.print(" </tr>")}for(let t=0;t<e.rows.length;t++){s.print(" <tr>");for(let r=0;r<e.columns.length;r++){const n=i(e.rows[t].getString(r));s.print(` <td>${n}`),s.print(" </td>")}s.print(" </tr>")}s.print(" </table>"),s.print("</body>"),s.print("</html>")}s.close(),s.clear()},t.writeFile=function(e,i,r){let n="application/octet-stream";t._isSafari()&&(n="text/plain");const s=new Blob(e,{type:n});t.downloadFile(s,i,r)},t.downloadFile=$r,t._checkFileExtension=qr,t._isSafari=function(){return/^((?!chrome|android).)*safari/i.test(navigator.userAgent)}}void 0!==p5&&Hn(p5,p5.prototype);var Wn=59;function Xn(e=256){let t=0,i=new Uint8Array(e);return{get buffer(){return i.buffer},reset(){t=0},bytesView:()=>i.subarray(0,t),bytes:()=>i.slice(0,t),writeByte(e){r(t+1),i[t]=e,t++},writeBytes(e,n=0,s=e.length){r(t+s);for(let r=0;r<s;r++)i[t++]=e[r+n]},writeBytesView(e,n=0,s=e.byteLength){r(t+s),i.set(e.subarray(n,n+s),t),t+=s}};function r(e){var r=i.length;if(r>=e)return;e=Math.max(e,r*(r<1048576?2:1.125)>>>0),0!=r&&(e=Math.max(e,256));let n=i;i=new Uint8Array(e),t>0&&i.set(n.subarray(0,t),0)}}var Yn=[0,1,3,7,15,31,63,127,255,511,1023,2047,4095,8191,16383,32767,65535];var Zn=function(e,t,i,r,n=Xn(512),s=new Uint8Array(256),a=new Int32Array(5003),o=new Int32Array(5003)){let h=a.length,u=Math.max(2,r);s.fill(0),o.fill(0),a.fill(-1);let l=0,c=0,p=u+1,d=p,f=!1,g=d,m=(1<<g)-1,y=1<<p-1,x=y+1,v=y+2,b=0,_=i[0],w=0;for(let e=h;e<65536;e*=2)++w;w=8-w,n.writeByte(u),A(y);let C=i.length;for(let e=1;e<C;e++)e:{let t=i[e],r=(t<<12)+_,n=t<<w^_;if(a[n]===r){_=o[n];break e}let s=0===n?1:h-n;for(;a[n]>=0;)if(n-=s,n<0&&(n+=h),a[n]===r){_=o[n];break e}A(_),_=t,v<4096?(o[n]=v++,a[n]=r):(a.fill(-1),v=y+2,f=!0,A(y))}return A(_),A(x),n.writeByte(0),n.bytesView();function A(e){for(l&=Yn[c],c>0?l|=e<<c:l=e,c+=g;c>=8;)s[b++]=255&l,b>=254&&(n.writeByte(b),n.writeBytesView(s,0,b),b=0),l>>=8,c-=8;if((v>m||f)&&(f?(g=d,m=(1<<g)-1,f=!1):(++g,m=12===g?1<<g:(1<<g)-1)),e==x){for(;c>0;)s[b++]=255&l,b>=254&&(n.writeByte(b),n.writeBytesView(s,0,b),b=0),l>>=8,c-=8;b>0&&(n.writeByte(b),n.writeBytesView(s,0,b),b=0)}}};function Kn(e,t,i){return e<<8&63488|t<<2&992|i>>3}function Jn(e,t,i,r){return e>>4|240&t|(240&i)<<4|(240&r)<<8}function Qn(e,t,i){return e>>4<<8|240&t|i>>4}function es(e,t,i){return e<t?t:e>i?i:e}function ts(e){return e*e}function is(e,t,i){var r=0,n=1e100;let s=e[t],a=s.cnt,o=s.rc,h=s.gc,u=s.bc;for(var l=s.fw;0!=l;l=e[l].fw){let t=e[l],i=t.cnt,s=a*i/(a+i);if(!(s>=n)){var c=0;!((c+=s*ts(t.rc-o))>=n)&&(!((c+=s*ts(t.gc-h))>=n)&&(!((c+=s*ts(t.bc-u))>=n)&&(n=c,r=l)))}}s.err=n,s.nn=r}function rs(e,t,i={}){let{format:r="rgb565",clearAlpha:n=!0,clearAlphaColor:s=0,clearAlphaThreshold:a=0,oneBitAlpha:o=!1}=i;if(!e||!e.buffer)throw new Error("quantize() expected RGBA Uint8Array data");if(!(e instanceof Uint8Array||e instanceof Uint8ClampedArray))throw new Error("quantize() expected RGBA Uint8Array data");let h=new Uint32Array(e.buffer),u=!1!==i.useSqrt,l="rgba4444"===r,c=function(e,t){let i=new Array("rgb444"===t?4096:65536),r=e.length;if("rgba4444"===t)for(let t=0;t<r;++t){let r=e[t],n=r>>24&255,s=r>>16&255,a=r>>8&255,o=255&r,h=Jn(o,a,s,n),u=h in i?i[h]:i[h]={ac:0,rc:0,gc:0,bc:0,cnt:0,nn:0,fw:0,bk:0,tm:0,mtm:0,err:0};u.rc+=o,u.gc+=a,u.bc+=s,u.ac+=n,u.cnt++}else if("rgb444"===t)for(let t=0;t<r;++t){let r=e[t],n=r>>16&255,s=r>>8&255,a=255&r,o=Qn(a,s,n),h=o in i?i[o]:i[o]={ac:0,rc:0,gc:0,bc:0,cnt:0,nn:0,fw:0,bk:0,tm:0,mtm:0,err:0};h.rc+=a,h.gc+=s,h.bc+=n,h.cnt++}else for(let t=0;t<r;++t){let r=e[t],n=r>>16&255,s=r>>8&255,a=255&r,o=Kn(a,s,n),h=o in i?i[o]:i[o]={ac:0,rc:0,gc:0,bc:0,cnt:0,nn:0,fw:0,bk:0,tm:0,mtm:0,err:0};h.rc+=a,h.gc+=s,h.bc+=n,h.cnt++}return i}(h,r),p=c.length,d=p-1,f=new Uint32Array(p+1);for(var g=0,m=0;m<p;++m){let e=c[m];if(null!=e){var y=1/e.cnt;l&&(e.ac*=y),e.rc*=y,e.gc*=y,e.bc*=y,c[g++]=e}}ts(t)/g<.022&&(u=!1);for(m=0;m<g-1;++m)c[m].fw=m+1,c[m+1].bk=m,u&&(c[m].cnt=Math.sqrt(c[m].cnt));var x,v,b;for(u&&(c[m].cnt=Math.sqrt(c[m].cnt)),m=0;m<g;++m){is(c,m);var _=c[m].err;for(v=++f[0];v>1&&!(c[x=f[b=v>>1]].err<=_);v=b)f[v]=x;f[v]=m}var w=g-t;for(m=0;m<w;){for(var C;;){var A=f[1];if((C=c[A]).tm>=C.mtm&&c[C.nn].mtm<=C.tm)break;C.mtm==d?A=f[1]=f[f[0]--]:(is(c,A),C.tm=m);_=c[A].err;for(v=1;(b=v+v)<=f[0]&&(b<f[0]&&c[f[b]].err>c[f[b+1]].err&&b++,!(_<=c[x=f[b]].err));v=b)f[v]=x;f[v]=A}var E=c[C.nn],D=C.cnt,S=E.cnt;y=1/(D+S);l&&(C.ac=y*(D*C.ac+S*E.ac)),C.rc=y*(D*C.rc+S*E.rc),C.gc=y*(D*C.gc+S*E.gc),C.bc=y*(D*C.bc+S*E.bc),C.cnt+=E.cnt,C.mtm=++m,c[E.bk].fw=E.fw,c[E.fw].bk=E.bk,E.mtm=d}let F=[];var T=0;for(m=0;;++T){let e=es(Math.round(c[m].rc),0,255),t=es(Math.round(c[m].gc),0,255),i=es(Math.round(c[m].bc),0,255),r=255;if(l){if(r=es(Math.round(c[m].ac),0,255),o){r=r<=("number"==typeof o?o:127)?0:255}n&&r<=a&&(e=t=i=s,r=0)}let h=l?[e,t,i,r]:[e,t,i];if(ns(F,h)||F.push(h),0==(m=c[m].fw))break}return F}function ns(e,t){for(let i=0;i<e.length;i++){let r=e[i],n=r[0]===t[0]&&r[1]===t[1]&&r[2]===t[2],s=!(r.length>=4&&t.length>=4)||r[3]===t[3];if(n&&s)return!0}return!1}function ss(e,t){var i,r=0;for(i=0;i<e.length;i++){let n=e[i]-t[i];r+=n*n}return r}function as(e,t,i=ss){let r=1/0,n=-1;for(let s=0;s<e.length;s++){let a=i(t,e[s]);a<r&&(r=a,n=s)}return n}function os(e={}){let{initialCapacity:t=4096,auto:i=!0}=e,r=Xn(t),n=new Uint8Array(256),s=new Int32Array(5003),a=new Int32Array(5003),o=!1;return{reset(){r.reset(),o=!1},finish(){r.writeByte(Wn)},bytes:()=>r.bytes(),bytesView:()=>r.bytesView(),get buffer(){return r.buffer},get stream(){return r},writeHeader:h,writeFrame(e,t,u,l={}){let{transparent:c=!1,transparentIndex:p=0,delay:d=0,palette:f=null,repeat:g=0,colorDepth:m=8,dispose:y=-1}=l,x=!1;if(i?o||(x=!0,h(),o=!0):x=Boolean(l.first),t=Math.max(0,Math.floor(t)),u=Math.max(0,Math.floor(u)),x){if(!f)throw new Error("First frame must include a { palette } option");(function(e,t,i,r,n=8){let s=1,a=0,o=cs(r.length)-1,h=s<<7|n-1<<4|a<<3|o,u=0,l=0;us(e,t),us(e,i),e.writeBytes([h,u,l])})(r,t,u,f,m),hs(r,f),g>=0&&function(e,t){e.writeByte(33),e.writeByte(255),e.writeByte(11),ls(e,"NETSCAPE2.0"),e.writeByte(3),e.writeByte(1),us(e,t),e.writeByte(0)}(r,g)}let v=Math.round(d/10);!function(e,t,i,r,n){var s,a;e.writeByte(33),e.writeByte(249),e.writeByte(4),n<0&&(n=0,r=!1),r?(s=1,a=2):(s=0,a=0),t>=0&&(a=7&t),a<<=2;let o=0;e.writeByte(a|o|s),us(e,i),e.writeByte(n||0),e.writeByte(0)}(r,y,v,c,p);let b=Boolean(f)&&!x;(function(e,t,i,r){if(e.writeByte(44),us(e,0),us(e,0),us(e,t),us(e,i),r){let t=0,i=0,n=cs(r.length)-1;e.writeByte(128|t|i|n)}else e.writeByte(0)})(r,t,u,b?f:null),b&&hs(r,f),function(e,t,i,r,n=8,s,a,o){Zn(i,r,t,n,e,s,a,o)}(r,e,t,u,m,n,s,a)}};function h(){ls(r,"GIF89a")}}function hs(e,t){let i=1<<cs(t.length);for(let r=0;r<i;r++){let i=[0,0,0];r<t.length&&(i=t[r]),e.writeByte(i[0]),e.writeByte(i[1]),e.writeByte(i[2])}}function us(e,t){e.writeByte(255&t),e.writeByte(t>>8&255)}function ls(e,t){for(var i=0;i<t.length;i++)e.writeByte(t.charCodeAt(i))}function cs(e){return Math.max(Math.ceil(Math.log2(e)),1)}function ps(e,t){function i(e,t,i){const r=parseInt(i/2),n=4*t,s=new Uint8Array(4*t);for(let t=0;t<r;++t){const r=t*n,a=(i-t-1)*n;s.set(e.subarray(r,r+n)),e.copyWithin(r,a,a+n),e.set(s,a)}return e}function r(e,t,i,r,n,s,a,o,h,u,l){if(e===Me){const{x:e,y:r,w:n,h:c}=function(e,t,i,r,n,s,a,o){const h=Math.max(i/a,r/o),[u,l]=[i/h,r/h];let c=n,p=s;return e===D?c+=(a-u)/2:e===A&&(c+=a-u),t===D?p+=(o-l)/2:t===S&&(p+=o-l),{x:c,y:p,w:u,h:l}}(t,i,s,a,o,h,u,l);o=e,h=r,u=n,l=c}if(e===Te){const{x:e,y:o,w:h,h:c}=function(e,t,i,r,n,s,a,o){const h=Math.max(a/n,o/s),[u,l]=[a/h,o/h];let c=i,p=r;return e===D?c+=(n-u)/2:e===A&&(c+=n-u),t===D?p+=(s-l)/2:t===S&&(p+=s-l),{x:c,y:p,w:u,h:l}}(t,i,r,n,s,a,u,l);r=e,n=o,s=h,a=c}return{sx:o,sy:h,sw:u,sh:l,dx:r,dy:n,dw:s,dh:a}}function n(e,t){return e>0&&e<t?e:t}t.loadImage=async function(t,i,r){try{let r=new e.Image(1,1,this);const n=new Request(t,{method:"GET",mode:"cors"}),{data:s,headers:a}=await qn(n,"bytes"),o=a.get("content-type");if(null===o&&console.warn("The image you loaded does not have a Content-Type header. If you are using the online editor consider reuploading the asset."),o&&o.includes("image/gif"))await async function(t,i){const r=new kn(t);i.width=i.canvas.width=r.width,i.height=i.canvas.height=r.height;const n=[],s=r.numFrames();let a=new Uint8ClampedArray(i.width*i.height*4);const o=(t,r)=>{try{r.decodeAndBlitFrameRGBA(t,a)}catch(t){throw e._friendlyFileLoadError(8,i.src),t}};for(let e=0;e<s;e++){const t=r.frameInfo(e),s=i.drawingContext.getImageData(0,0,i.width,i.height);a=s.data.slice(),o(e,r);const h=new ImageData(a,i.width,i.height);i.drawingContext.putImageData(h,0,0);let u=t.delay;0===u&&(u=10),n.push({image:i.drawingContext.getImageData(0,0,i.width,i.height),delay:10*u}),2===t.disposal?i.drawingContext.clearRect(t.x,t.y,t.width,t.height):3===t.disposal&&i.drawingContext.putImageData(s,0,0,t.x,t.y,t.width,t.height)}let h=r.loopCount();null===h?h=1:0===h&&(h=null);i.drawingContext.putImageData(n[0].image,0,0),n.length>1&&(i.gifProperties={displayIndex:0,loopLimit:h,loopCount:0,frames:n,numFrames:s,playing:!0,timeDisplayed:0,lastChangeTime:0});return i}(s,r);else{const e=new Blob([s]),t=await createImageBitmap(e);r.width=r.canvas.width=t.width,r.height=r.canvas.height=t.height,r.drawingContext.drawImage(t,0,0)}return r.modified=!0,i?i(r):r}catch(i){if(e._friendlyFileLoadError(0,t),"function"==typeof r)return r(i);throw i}},t.saveGif=async function(r,n,s={delay:0,units:"seconds",silent:!1,notificationDuration:0,notificationID:"progressBar",reset:!0}){if("string"!=typeof r)throw TypeError("fileName parameter must be a string");if("number"!=typeof n)throw TypeError("Duration parameter must be a number");const a=s&&s.delay||0,o=s&&s.units||"seconds",h=s&&s.silent||!1,u=s&&s.notificationDuration||0,l=s&&s.notificationID||"progressBar",c=!s||void 0===s.reset||s.reset;if("number"!=typeof a)throw TypeError("Delay parameter must be a number");if("seconds"!==o&&"frames"!==o)throw TypeError('Units parameter must be either "frames" or "seconds"');if("boolean"!=typeof h)throw TypeError("Silent parameter must be a boolean");if("number"!=typeof u)throw TypeError("Notification duration parameter must be a number");if("string"!=typeof l)throw TypeError("Notification ID parameter must be a string");this._recording=!0;let p=this._targetFrameRate;p!==1/0&&void 0!==p&&0!==p||(p=60);let d=1/p*1e3;d=d<20?20:d;const f="seconds"===o?n*p:n,g="seconds"===o?a*p:a;let m,y;c?(m=g,this.frameCount=m,y=f+g):(m=this.frameCount+g,y=m+f);const x=this._renderer._pixelDensity;this.pixelDensity(1);let v,b,_,w=[];for(null!==document.getElementById(l)&&document.getElementById(l).remove(),h||(v=this.createP(""),v.id(l),v.style("font-size","16px"),v.style("font-family","Montserrat"),v.style("background-color","#ffffffa0"),v.style("padding","8px"),v.style("border-radius","10px"),v.position(0,0)),this._renderer instanceof e.RendererGL&&(_=this.drawingContext,b=new Uint8Array(_.drawingBufferWidth*_.drawingBufferHeight*4)),this.noLoop(),await new Promise(requestAnimationFrame);m<y;){let t;this.redraw(),await new Promise(requestAnimationFrame),this._renderer instanceof e.RendererGL?(b=new Uint8Array(_.drawingBufferWidth*_.drawingBufferHeight*4),_.readPixels(0,0,_.drawingBufferWidth,_.drawingBufferHeight,_.RGBA,_.UNSIGNED_BYTE,b),t=i(b,this.width,this.height)):t=this.drawingContext.getImageData(0,0,this.width,this.height).data,w.push(t),m++,h||v.html("Saved frame <b>"+w.length.toString()+"</b> out of "+f.toString()),await new Promise((e=>setTimeout(e,0)))}h||v.html("Frames processed, generating color palette..."),this.loop(),this.pixelDensity(x);const C=os(),A=function(e){let t=new Uint8Array(e.length*e[0].length);for(let i=0;i<e.length;i++)t.set(e[i],i*e[0].length);let i=rs(t,256,{format:"rgba4444",oneBitAlpha:!0});256===i.length?i[i.length-1]=[255*Math.random(),255*Math.random(),255*Math.random(),0]:i.push([255*Math.random(),255*Math.random(),255*Math.random(),0]);return i}(w),E={},D=e=>{const t=e.length/4,i=new Uint8Array(t);for(let r=0;r<t;r++){const t=e[4*r]<<24|e[4*r+1]<<16|e[4*r+2]<<8|e[4*r+3];void 0===E[t]&&(E[t]=as(A,e.slice(4*r,4*(r+1)))),i[r]=E[t]}return i},S=A.length-1;let F=[];for(let e=0;e<w.length;e++){const t=D(w[e]),i=t.slice();if(0===e)C.writeFrame(t,this.width,this.height,{palette:A,delay:d,dispose:1});else{for(let e=0;e<t.length;e++)t[e]===F[e]&&(t[e]=S);C.writeFrame(t,this.width,this.height,{delay:d,transparent:!0,transparentIndex:S,dispose:1})}F=i,h||v.html("Rendered frame <b>"+e.toString()+"</b> out of "+f.toString()),await new Promise((e=>setTimeout(e,0)))}C.finish();const T=C.bytesView(),M=new Blob([T],{type:"image/gif"});w=[],this._recording=!1,this.loop(),h||(v.html("Done. Downloading your gif!🌸"),u>0&&setTimeout((()=>v.remove()),1e3*u)),t.downloadFile(M,r,"gif")},t.image=function(e,t,i,s,a,o,h,u,l,c,p,d){let f=e.width,g=e.height;d=d||D,p=p||D,e.elt&&(f=void 0!==f?f:e.elt.width,g=void 0!==g?g:e.elt.height),e.elt&&e.elt.videoWidth&&!e.canvas&&(f=void 0!==f?f:e.elt.videoWidth,g=void 0!==g?g:e.elt.videoHeight);let m=t,y=i,x=s||f,v=a||g,b=o||0,_=h||0,w=void 0!==u?u:f,C=void 0!==l?l:g;w=n(w,f),C=n(C,g);let A=1;e.elt&&!e.canvas&&e.elt.style.width&&(A=e.elt.videoWidth&&!s?e.elt.videoWidth:e.elt.width,A/=parseInt(e.elt.style.width,10)),b*=A,_*=A,C*=A,w*=A;let E=Bn.modeAdjust(m,y,x,v,this._renderer.states.imageMode);E=r(c,p,d,E.x,E.y,E.w,E.h,b,_,w,C),this._renderer.image(e,E.sx,E.sy,E.sw,E.sh,E.dx,E.dy,E.dw,E.dh)},t.tint=function(...e){const t=this.color(...e);this._renderer.states.setValue("tint",t._getRGBA([255,255,255,255]))},t.noTint=function(){this._renderer.states.setValue("tint",null)},t.imageMode=function(e){e!==_&&e!==w&&e!==D||this._renderer.states.setValue("imageMode",e)}}function ds(e,t){t.blend=function(...t){this._renderer?this._renderer.blend(...t):e.Renderer2D.prototype.blend.apply(this,t)},t.copy=function(...e){let i,r,n,s,a,o,h,u,l;if(9===e.length)i=e[0],r=e[1],n=e[2],s=e[3],a=e[4],o=e[5],h=e[6],u=e[7],l=e[8];else{if(8!==e.length)throw new Error("Signature not supported");i=this,r=e[0],n=e[1],s=e[2],a=e[3],o=e[4],h=e[5],u=e[6],l=e[7]}t._copyHelper(this,i,r,n,s,a,o,h,u,l)},t._copyHelper=(e,t,i,r,n,s,a,o,h,u)=>{const l=t.canvas.width/t.width;let c=0,p=0;t._renderer&&t._renderer.isP3D&&(c=t.width/2,p=t.height/2),e._renderer&&e._renderer.isP3D?(e.push(),e.resetMatrix(),e.noLights(),e.blendMode(e.BLEND),e.imageMode(e.CORNER),e._renderer.image(t,i+c,r+p,n,s,a,o,h,u),e.pop()):e.drawingContext.drawImage(t.canvas,l*(i+c),l*(r+p),l*n,l*s,a,o,h,u)},t.getFilterGraphicsLayer=function(){return this._renderer.getFilterGraphicsLayer()},t.filter=function(...t){let{shader:i,operation:r,value:n,useWebGL:s}=function(...t){let i={shader:void 0,operation:void 0,value:void 0,useWebGL:!0};if(t[0]instanceof e.Shader)return i.shader=t[0],i;i.operation=t[0];t.length>1&&"number"==typeof t[1]&&(i.value=t[1]);!1===t[t.length-1]&&(i.useWebGL=!1);return i}(...t);this._renderer.isP3D&&i?this._renderer.filter(i):s||this._renderer.isP3D?(!s&&this._renderer.isP3D&&console.warn("filter() with useWebGL=false is not supported in WEBGL"),this._renderer.isP3D?this._renderer.filter(r,n):(i?this._renderer.filterRenderer.setOperation(r,n,i):this._renderer.filterRenderer.setOperation(r,n),this._renderer.filterRenderer.applyFilter())):void 0!==this.canvas?Br.apply(this.canvas,Br[r],n):Br.apply(this.elt,Br[r],n)},t.get=function(e,t,i,r){return this._renderer.get(...arguments)},t.loadPixels=function(...e){this._renderer.loadPixels()},t.set=function(e,t,i){this._renderer.set(e,t,i)},t.updatePixels=function(e,t,i,r){0!==this.pixels.length&&this._renderer.updatePixels(e,t,i,r)}}void 0!==p5&&ps(p5,p5.prototype),void 0!==p5&&ds(p5,p5.prototype);class fs{#g=null;constructor(...e){if(this.constructor===fs)throw new Error("Class is of abstract type and can't be instantiated")}}const gs=e=>{if(Math.sqrt(e.length)%1!=0)throw new Error("Array length must be a perfect square.");return!0};let ms=Array,ys=e=>Array.isArray(e);"undefined"!=typeof Float32Array&&(ms=Float32Array,ys=e=>Array.isArray(e)||e instanceof Float32Array);class xs extends fs{matrix;#m;constructor(...e){if(super(...e),ys(e[0])&&gs(e[0])){const t=Math.sqrt(e[0].length);this.#m=t,this.matrix=ms.from(e[0])}else"number"==typeof e[0]&&(this.#m=Number(e[0]),this.matrix=this.#y(e[0]));return this}get mat3(){return 3===this.#m?this.matrix:void 0}get mat4(){return 4===this.#m?this.matrix:void 0}add(e){if(this.matrix.length!==e.matrix.length)throw new Error("Matrices must be of the same dimension to add.");for(let t=0;t<this.matrix.length;t++)this.matrix[t]+=e.matrix[t];return this}setElement(e,t){return e>=0&&e<this.matrix.length&&(this.matrix[e]=t),this}reset(){return this.matrix=this.#y(this.#m),this}set(e){let t=ms.from([...arguments]);return e instanceof xs?t=ms.from(e.matrix):ys(e)&&(t=ms.from(e)),t.length!==this.matrix.length?(p5._friendlyError(`Expected same dimensions values but received different ${t.length}.`,"p5.Matrix.set"),this):(this.matrix=t,this)}get(){return new xs(this.matrix)}copy(){return new xs(this.matrix)}clone(){return this.copy()}diagonal(){const e=[];for(let t=0;t<this.#m;t++)e.push(this.matrix[t*(this.#m+1)]);return e}row(e){const t=[];for(let i=0;i<this.#m;i++)t.push(this.matrix[i*this.#m+e]);return new Zr(...t)}column(e){const t=[];for(let i=0;i<this.#m;i++)t.push(this.matrix[e*this.#m+i]);return new Zr(...t)}transpose(e){return 4===this.#m?this.#x(e):3===this.#m?this.#v(e):this.#b(e)}mult(e){let t;return e===this||e===this.matrix?t=this.copy().matrix:e instanceof xs?t=e.matrix:ys(e)&&gs(e)?t=e:gs(Array.from(arguments))&&(t=Array.from(arguments)),4===this.#m&&16===t.length?this.#_(t):3===this.#m&&9===t.length?this.#w(t):this.#C(t)}multiplyVec(e,t){void 0===t&&(t=e.copy());for(let i=0;i<this.#m;i++)t.values[i]=this.row(i).dot(e);return t}invert(e){if(4===this.#m)return this.#A(e);if(3===this.#m)return this.#E(e);throw new Error("Invert is not implemented for N>4 at the moment, we are working on it")}createSubMatrix3x3(){if(4===this.#m){const e=new xs(3);return e.mat3[0]=this.matrix[0],e.mat3[1]=this.matrix[1],e.mat3[2]=this.matrix[2],e.mat3[3]=this.matrix[4],e.mat3[4]=this.matrix[5],e.mat3[5]=this.matrix[6],e.mat3[6]=this.matrix[8],e.mat3[7]=this.matrix[9],e.mat3[8]=this.matrix[10],e}throw new Error("Matrix dimension must be 4 to create a 3x3 submatrix.")}inverseTranspose4x4({mat4:e}){if(3!==this.#m)throw new Error("This function only works with 3×3 matrices.");this.matrix[0]=e[0],this.matrix[1]=e[1],this.matrix[2]=e[2],this.matrix[3]=e[4],this.matrix[4]=e[5],this.matrix[5]=e[6],this.matrix[6]=e[8],this.matrix[7]=e[9],this.matrix[8]=e[10];const t=this.invert();if(t)t.transpose(this.matrix);else for(let e=0;e<9;e++)this.matrix[e]=0;return this}apply(e){let t;if(e===this||e===this.matrix)t=this.copy().matrix;else if(e instanceof xs)t=e.matrix;else if(ys(e))t=e;else{if(16!==arguments.length)return;t=arguments}const i=this.matrix,r=i[0],n=i[4],s=i[8],a=i[12];i[0]=t[0]*r+t[1]*n+t[2]*s+t[3]*a,i[4]=t[4]*r+t[5]*n+t[6]*s+t[7]*a,i[8]=t[8]*r+t[9]*n+t[10]*s+t[11]*a,i[12]=t[12]*r+t[13]*n+t[14]*s+t[15]*a;const o=i[1],h=i[5],u=i[9],l=i[13];i[1]=t[0]*o+t[1]*h+t[2]*u+t[3]*l,i[5]=t[4]*o+t[5]*h+t[6]*u+t[7]*l,i[9]=t[8]*o+t[9]*h+t[10]*u+t[11]*l,i[13]=t[12]*o+t[13]*h+t[14]*u+t[15]*l;const c=i[2],p=i[6],d=i[10],f=i[14];i[2]=t[0]*c+t[1]*p+t[2]*d+t[3]*f,i[6]=t[4]*c+t[5]*p+t[6]*d+t[7]*f,i[10]=t[8]*c+t[9]*p+t[10]*d+t[11]*f,i[14]=t[12]*c+t[13]*p+t[14]*d+t[15]*f;const g=i[3],m=i[7],y=i[11],x=i[15];return i[3]=t[0]*g+t[1]*m+t[2]*y+t[3]*x,i[7]=t[4]*g+t[5]*m+t[6]*y+t[7]*x,i[11]=t[8]*g+t[9]*m+t[10]*y+t[11]*x,i[15]=t[12]*g+t[13]*m+t[14]*y+t[15]*x,this}scale(e,t,i){return e instanceof Zr?(t=e.y,i=e.z,e=e.x):e instanceof Array&&(t=e[1],i=e[2],e=e[0]),this.matrix[0]*=e,this.matrix[1]*=e,this.matrix[2]*=e,this.matrix[3]*=e,this.matrix[4]*=t,this.matrix[5]*=t,this.matrix[6]*=t,this.matrix[7]*=t,this.matrix[8]*=i,this.matrix[9]*=i,this.matrix[10]*=i,this.matrix[11]*=i,this}rotate4x4(e,t,i,r){t instanceof Zr?(i=t.y,r=t.z,t=t.x):t instanceof Array&&(i=t[1],r=t[2],t=t[0]);const n=Math.sqrt(t*t+i*i+r*r);t*=1/n,i*=1/n,r*=1/n;const s=this.matrix[0],a=this.matrix[1],o=this.matrix[2],h=this.matrix[3],u=this.matrix[4],l=this.matrix[5],c=this.matrix[6],p=this.matrix[7],d=this.matrix[8],f=this.matrix[9],g=this.matrix[10],m=this.matrix[11],y=Math.sin(e),x=Math.cos(e),v=1-x,b=t*t*v+x,_=i*t*v+r*y,w=r*t*v-i*y,C=t*i*v-r*y,A=i*i*v+x,E=r*i*v+t*y,D=t*r*v+i*y,S=i*r*v-t*y,F=r*r*v+x;return this.matrix[0]=s*b+u*_+d*w,this.matrix[1]=a*b+l*_+f*w,this.matrix[2]=o*b+c*_+g*w,this.matrix[3]=h*b+p*_+m*w,this.matrix[4]=s*C+u*A+d*E,this.matrix[5]=a*C+l*A+f*E,this.matrix[6]=o*C+c*A+g*E,this.matrix[7]=h*C+p*A+m*E,this.matrix[8]=s*D+u*S+d*F,this.matrix[9]=a*D+l*S+f*F,this.matrix[10]=o*D+c*S+g*F,this.matrix[11]=h*D+p*S+m*F,this}translate(e){const t=e[0],i=e[1],r=e[2]||0;return this.matrix[12]+=this.matrix[0]*t+this.matrix[4]*i+this.matrix[8]*r,this.matrix[13]+=this.matrix[1]*t+this.matrix[5]*i+this.matrix[9]*r,this.matrix[14]+=this.matrix[2]*t+this.matrix[6]*i+this.matrix[10]*r,this.matrix[15]+=this.matrix[3]*t+this.matrix[7]*i+this.matrix[11]*r,this}rotateX(e){this.rotate4x4(e,1,0,0)}rotateY(e){this.rotate4x4(e,0,1,0)}rotateZ(e){this.rotate4x4(e,0,0,1)}perspective(e,t,i,r){const n=1/Math.tan(e/2),s=1/(i-r);return this.matrix[0]=n/t,this.matrix[1]=0,this.matrix[2]=0,this.matrix[3]=0,this.matrix[4]=0,this.matrix[5]=n,this.matrix[6]=0,this.matrix[7]=0,this.matrix[8]=0,this.matrix[9]=0,this.matrix[10]=(r+i)*s,this.matrix[11]=-1,this.matrix[12]=0,this.matrix[13]=0,this.matrix[14]=2*r*i*s,this.matrix[15]=0,this}ortho(e,t,i,r,n,s){const a=1/(e-t),o=1/(i-r),h=1/(n-s);return this.matrix[0]=-2*a,this.matrix[1]=0,this.matrix[2]=0,this.matrix[3]=0,this.matrix[4]=0,this.matrix[5]=-2*o,this.matrix[6]=0,this.matrix[7]=0,this.matrix[8]=0,this.matrix[9]=0,this.matrix[10]=2*h,this.matrix[11]=0,this.matrix[12]=(e+t)*a,this.matrix[13]=(r+i)*o,this.matrix[14]=(s+n)*h,this.matrix[15]=1,this}multiplyVec4(e,t,i,r){const n=new Array(4),s=this.matrix;return n[0]=s[0]*e+s[4]*t+s[8]*i+s[12]*r,n[1]=s[1]*e+s[5]*t+s[9]*i+s[13]*r,n[2]=s[2]*e+s[6]*t+s[10]*i+s[14]*r,n[3]=s[3]*e+s[7]*t+s[11]*i+s[15]*r,n}multiplyPoint({x:e,y:t,z:i}){const r=this.multiplyVec4(e,t,i,1);return new Zr(r[0],r[1],r[2])}multiplyAndNormalizePoint({x:e,y:t,z:i}){const r=this.multiplyVec4(e,t,i,1);return r[0]/=r[3],r[1]/=r[3],r[2]/=r[3],new Zr(r[0],r[1],r[2])}multiplyDirection({x:e,y:t,z:i}){const r=this.multiplyVec4(e,t,i,0);return new Zr(r[0],r[1],r[2])}multiplyVec3(e,t){return void 0===t&&(t=e.copy()),t.x=this.row(0).dot(e),t.y=this.row(1).dot(e),t.z=this.row(2).dot(e),t}#y(e){if(3===e)return new ms([1,0,0,0,1,0,0,0,1]);if(4===e)return new ms([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]);const t=new ms(e*e).fill(0);for(let i=0;i<e;i++)t[i*e+i]=1;return t}#_(e){let t=this.matrix[0],i=this.matrix[1],r=this.matrix[2],n=this.matrix[3];return this.matrix[0]=t*e[0]+i*e[4]+r*e[8]+n*e[12],this.matrix[1]=t*e[1]+i*e[5]+r*e[9]+n*e[13],this.matrix[2]=t*e[2]+i*e[6]+r*e[10]+n*e[14],this.matrix[3]=t*e[3]+i*e[7]+r*e[11]+n*e[15],t=this.matrix[4],i=this.matrix[5],r=this.matrix[6],n=this.matrix[7],this.matrix[4]=t*e[0]+i*e[4]+r*e[8]+n*e[12],this.matrix[5]=t*e[1]+i*e[5]+r*e[9]+n*e[13],this.matrix[6]=t*e[2]+i*e[6]+r*e[10]+n*e[14],this.matrix[7]=t*e[3]+i*e[7]+r*e[11]+n*e[15],t=this.matrix[8],i=this.matrix[9],r=this.matrix[10],n=this.matrix[11],this.matrix[8]=t*e[0]+i*e[4]+r*e[8]+n*e[12],this.matrix[9]=t*e[1]+i*e[5]+r*e[9]+n*e[13],this.matrix[10]=t*e[2]+i*e[6]+r*e[10]+n*e[14],this.matrix[11]=t*e[3]+i*e[7]+r*e[11]+n*e[15],t=this.matrix[12],i=this.matrix[13],r=this.matrix[14],n=this.matrix[15],this.matrix[12]=t*e[0]+i*e[4]+r*e[8]+n*e[12],this.matrix[13]=t*e[1]+i*e[5]+r*e[9]+n*e[13],this.matrix[14]=t*e[2]+i*e[6]+r*e[10]+n*e[14],this.matrix[15]=t*e[3]+i*e[7]+r*e[11]+n*e[15],this}#C(e){if(e.length!==this.matrix.length)throw new Error("Matrices must be of the same dimension to multiply.");const t=new ms(this.matrix.length).fill(0);for(let i=0;i<this.#m;i++)for(let r=0;r<this.#m;r++)for(let n=0;n<this.#m;n++)t[i*this.#m+r]+=this.matrix[i*this.#m+n]*e[n*this.#m+r];return this.matrix=t,this}#w(e){let t=this.mat3[0],i=this.mat3[1],r=this.mat3[2];return this.mat3[0]=t*e[0]+i*e[3]+r*e[6],this.mat3[1]=t*e[1]+i*e[4]+r*e[7],this.mat3[2]=t*e[2]+i*e[5]+r*e[8],t=this.mat3[3],i=this.mat3[4],r=this.mat3[5],this.mat3[3]=t*e[0]+i*e[3]+r*e[6],this.mat3[4]=t*e[1]+i*e[4]+r*e[7],this.mat3[5]=t*e[2]+i*e[5]+r*e[8],t=this.mat3[6],i=this.mat3[7],r=this.mat3[8],this.mat3[6]=t*e[0]+i*e[3]+r*e[6],this.mat3[7]=t*e[1]+i*e[4]+r*e[7],this.mat3[8]=t*e[2]+i*e[5]+r*e[8],this}#b(){const e=this.#m;for(let t=0;t<e;t++)for(let i=0;i<e;i++)this.matrix[t*e+i]=this.matrix[i*e+t];return this}#x(e){let t,i,r,n,s,a;return console.log("====> 4x4"),e instanceof xs?(t=e.matrix[1],i=e.matrix[2],r=e.matrix[3],n=e.matrix[6],s=e.matrix[7],a=e.matrix[11],this.matrix[0]=e.matrix[0],this.matrix[1]=e.matrix[4],this.matrix[2]=e.matrix[8],this.matrix[3]=e.matrix[12],this.matrix[4]=t,this.matrix[5]=e.matrix[5],this.matrix[6]=e.matrix[9],this.matrix[7]=e.matrix[13],this.matrix[8]=i,this.matrix[9]=n,this.matrix[10]=e.matrix[10],this.matrix[11]=e.matrix[14],this.matrix[12]=r,this.matrix[13]=s,this.matrix[14]=a,this.matrix[15]=e.matrix[15]):ys(e)&&(t=e[1],i=e[2],r=e[3],n=e[6],s=e[7],a=e[11],this.matrix[0]=e[0],this.matrix[1]=e[4],this.matrix[2]=e[8],this.matrix[3]=e[12],this.matrix[4]=t,this.matrix[5]=e[5],this.matrix[6]=e[9],this.matrix[7]=e[13],this.matrix[8]=i,this.matrix[9]=n,this.matrix[10]=e[10],this.matrix[11]=e[14],this.matrix[12]=r,this.matrix[13]=s,this.matrix[14]=a,this.matrix[15]=e[15]),this}#v(e){void 0===e&&(e=this.mat3);const t=e[1],i=e[2],r=e[5];return this.mat3[0]=e[0],this.mat3[1]=e[3],this.mat3[2]=e[6],this.mat3[3]=t,this.mat3[4]=e[4],this.mat3[5]=e[7],this.mat3[6]=i,this.mat3[7]=r,this.mat3[8]=e[8],this}#A(e){let t,i,r,n,s,a,o,h,u,l,c,p,d,f,g,m;e instanceof xs?(t=e.matrix[0],i=e.matrix[1],r=e.matrix[2],n=e.matrix[3],s=e.matrix[4],a=e.matrix[5],o=e.matrix[6],h=e.matrix[7],u=e.matrix[8],l=e.matrix[9],c=e.matrix[10],p=e.matrix[11],d=e.matrix[12],f=e.matrix[13],g=e.matrix[14],m=e.matrix[15]):ys(e)&&(t=e[0],i=e[1],r=e[2],n=e[3],s=e[4],a=e[5],o=e[6],h=e[7],u=e[8],l=e[9],c=e[10],p=e[11],d=e[12],f=e[13],g=e[14],m=e[15]);const y=t*a-i*s,x=t*o-r*s,v=t*h-n*s,b=i*o-r*a,_=i*h-n*a,w=r*h-n*o,C=u*f-l*d,A=u*g-c*d,E=u*m-p*d,D=l*g-c*f,S=l*m-p*f,F=c*m-p*g;let T=y*F-x*S+v*D+b*E-_*A+w*C;return T?(T=1/T,this.matrix[0]=(a*F-o*S+h*D)*T,this.matrix[1]=(r*S-i*F-n*D)*T,this.matrix[2]=(f*w-g*_+m*b)*T,this.matrix[3]=(c*_-l*w-p*b)*T,this.matrix[4]=(o*E-s*F-h*A)*T,this.matrix[5]=(t*F-r*E+n*A)*T,this.matrix[6]=(g*v-d*w-m*x)*T,this.matrix[7]=(u*w-c*v+p*x)*T,this.matrix[8]=(s*S-a*E+h*C)*T,this.matrix[9]=(i*E-t*S-n*C)*T,this.matrix[10]=(d*_-f*v+m*y)*T,this.matrix[11]=(l*v-u*_-p*y)*T,this.matrix[12]=(a*A-s*D-o*C)*T,this.matrix[13]=(t*D-i*A+r*C)*T,this.matrix[14]=(f*x-d*b-g*y)*T,this.matrix[15]=(u*b-l*x+c*y)*T,this):null}#E(){const e=this.mat3[0],t=this.mat3[1],i=this.mat3[2],r=this.mat3[3],n=this.mat3[4],s=this.mat3[5],a=this.mat3[6],o=this.mat3[7],h=this.mat3[8],u=h*n-s*o,l=-h*r+s*a,c=o*r-n*a;let p=e*u+t*l+i*c;return p?(p=1/p,this.mat3[0]=u*p,this.mat3[1]=(-h*t+i*o)*p,this.mat3[2]=(s*t-i*n)*p,this.mat3[3]=l*p,this.mat3[4]=(h*e-i*a)*p,this.mat3[5]=(-s*e+i*r)*p,this.mat3[6]=c*p,this.mat3[7]=(-o*e+t*a)*p,this.mat3[8]=(n*e-t*r)*p,this):null}#D(){if(4!==this.#m)throw new Error("Determinant is only implemented for 4x4 matrices. We are working on it.");const e=this.matrix[0]*this.matrix[5]-this.matrix[1]*this.matrix[4],t=this.matrix[0]*this.matrix[6]-this.matrix[2]*this.matrix[4],i=this.matrix[0]*this.matrix[7]-this.matrix[3]*this.matrix[4],r=this.matrix[1]*this.matrix[6]-this.matrix[2]*this.matrix[5],n=this.matrix[1]*this.matrix[7]-this.matrix[3]*this.matrix[5],s=this.matrix[2]*this.matrix[7]-this.matrix[3]*this.matrix[6],a=this.matrix[8]*this.matrix[13]-this.matrix[9]*this.matrix[12],o=this.matrix[8]*this.matrix[14]-this.matrix[10]*this.matrix[12],h=this.matrix[8]*this.matrix[15]-this.matrix[11]*this.matrix[12],u=this.matrix[9]*this.matrix[14]-this.matrix[10]*this.matrix[13],l=this.matrix[9]*this.matrix[15]-this.matrix[11]*this.matrix[13];return e*(this.matrix[10]*this.matrix[15]-this.matrix[11]*this.matrix[14])-t*l+i*u+r*h-n*o+s*a}}function vs(e,t){e.Matrix=xs}void 0!==p5&&vs(p5);class bs{constructor(e=128){this.length=0,this.data=new Float32Array(e),this.initialLength=e}dataArray(){return this.subArray(0,this.length)}clear(){this.length=0}rescale(){if(this.length<this.data.length/2){const e=1<<Math.ceil(Math.log2(this.length)),t=new Float32Array(e);t.set(this.data.subarray(0,this.length),0),this.data=t}}reset(){this.clear(),this.data=new Float32Array(this.initialLength)}push(...e){this.ensureLength(this.length+e.length),this.data.set(e,this.length),this.length+=e.length}slice(e,t){return this.data.slice(e,Math.min(t,this.length))}subArray(e,t){return this.data.subarray(e,Math.min(t,this.length))}ensureLength(e){for(;this.data.length<e;){const e=new Float32Array(2*this.data.length);e.set(this.data,0),this.data=e}}}function _s(e,t){e.DataArray=bs}void 0!==p5&&_s(p5);class ws{constructor(e,t,i,r){this.renderer=r,this.vertices=[],this.boundingBoxCache=null,this.lineVertices=new bs,this.lineTangentsIn=new bs,this.lineTangentsOut=new bs,this.lineSides=new bs,this.vertexNormals=[],this.faces=[],this.uvs=[],this.edges=[],this.vertexColors=[],this.vertexStrokeColors=[],this.userVertexProperties={},this.lineVertexColors=new bs,this.detailX=void 0!==e?e:1,this.detailY=void 0!==t?t:1,this.dirtyFlags={},this._hasFillTransparency=void 0,this._hasStrokeTransparency=void 0,this.gid=`_p5_Geometry_${ws.nextId}`,ws.nextId++,i instanceof Function&&i.call(this)}calculateBoundingBox(){if(this.boundingBoxCache)return this.boundingBoxCache;let e=new Zr(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE),t=new Zr(Number.MIN_VALUE,Number.MIN_VALUE,Number.MIN_VALUE);for(let i=0;i<this.vertices.length;i++){let r=this.vertices[i];e.x=Math.min(e.x,r.x),e.y=Math.min(e.y,r.y),e.z=Math.min(e.z,r.z),t.x=Math.max(t.x,r.x),t.y=Math.max(t.y,r.y),t.z=Math.max(t.z,r.z)}let i=new Zr(t.x-e.x,t.y-e.y,t.z-e.z),r=new Zr((e.x+t.x)/2,(e.y+t.y)/2,(e.z+t.z)/2);return this.boundingBoxCache={min:e,max:t,size:i,offset:r},this.boundingBoxCache}reset(){this._hasFillTransparency=void 0,this._hasStrokeTransparency=void 0,this.lineVertices.clear(),this.lineTangentsIn.clear(),this.lineTangentsOut.clear(),this.lineSides.clear(),this.vertices.length=0,this.edges.length=0,this.vertexColors.length=0,this.vertexStrokeColors.length=0,this.lineVertexColors.clear(),this.vertexNormals.length=0,this.uvs.length=0;for(const e in this.userVertexProperties)this.userVertexProperties[e].delete();this.userVertexProperties={},this.dirtyFlags={}}hasFillTransparency(){if(void 0===this._hasFillTransparency){this._hasFillTransparency=!1;for(let e=0;e<this.vertexColors.length;e+=4)if(this.vertexColors[e+3]<1){this._hasFillTransparency=!0;break}}return this._hasFillTransparency}hasStrokeTransparency(){if(void 0===this._hasStrokeTransparency){this._hasStrokeTransparency=!1;for(let e=0;e<this.lineVertexColors.length;e+=4)if(this.lineVertexColors[e+3]<1){this._hasStrokeTransparency=!0;break}}return this._hasStrokeTransparency}clearColors(){return this.vertexColors=[],this}saveObj(e="model.obj"){let t="";if(this.vertices.forEach((e=>{t+=`v ${e.x} ${e.y} ${e.z}\n`})),this.uvs&&this.uvs.length>0)for(let e=0;e<this.uvs.length;e+=2)t+=`vt ${this.uvs[e]} ${this.uvs[e+1]}\n`;this.vertexNormals&&this.vertexNormals.length>0&&this.vertexNormals.forEach((e=>{t+=`vn ${e.x} ${e.y} ${e.z}\n`})),this.faces.forEach((e=>{let i="f";e.forEach((e=>{i+=" ",i+=e+1,(this.vertexNormals.length>0||this.uvs.length>0)&&(i+="/",this.uvs.length>0&&(i+=e+1),i+="/",this.vertexNormals.length>0&&(i+=e+1))})),t+=i+"\n"}));$r(new Blob([t],{type:"text/plain"}),e,"obj")}saveStl(e="model.stl",{binary:t=!1}={}){let i,r=e.substring(0,e.lastIndexOf(".")),n=[];for(let e of this.faces){const t=Zr.sub(this.vertices[e[1]],this.vertices[e[0]]),i=Zr.sub(this.vertices[e[2]],this.vertices[e[0]]),r=t.y*i.z-t.z*i.y,s=t.z*i.x-t.x*i.z,a=t.x*i.y-t.y*i.x;n.push(new Zr(r,s,a).normalize())}if(t){let e=80;const t=2*this.faces.length+3*this.faces.length*4*4+80+4,r=new ArrayBuffer(t);i=new DataView(r),i.setUint32(e,this.faces.length,!0),e+=4;for(const[t,r]of Object.entries(this.faces)){const s=n[t];i.setFloat32(e,s.x,!0),e+=4,i.setFloat32(e,s.y,!0),e+=4,i.setFloat32(e,s.z,!0),e+=4;for(let t of r){const r=this.vertices[t];i.setFloat32(e,r.x,!0),e+=4,i.setFloat32(e,r.y,!0),e+=4,i.setFloat32(e,r.z,!0),e+=4}i.setUint16(e,0,!0),e+=2}}else{i="solid "+r+"\n";for(const[e,t]of Object.entries(this.faces)){const r=n[e];i+=" facet norm "+r.x+" "+r.y+" "+r.z+"\n",i+=" outer loop\n";for(let e of t){const t=this.vertices[e];i+=" vertex "+t.x+" "+t.y+" "+t.z+"\n"}i+=" endloop\n",i+=" endfacet\n"}i+="endsolid "+r+"\n"}$r(new Blob([i],{type:"text/plain"}),e,"stl")}flipU(){this.uvs=this.uvs.flat().map(((e,t)=>t%2==0?1-e:e))}flipV(){this.uvs=this.uvs.flat().map(((e,t)=>t%2==0?e:1-e))}computeFaces(){this.faces.length=0;const e=this.detailX+1;let t,i,r,n;for(let s=0;s<this.detailY;s++)for(let a=0;a<this.detailX;a++)t=s*e+a,i=s*e+a+1,r=(s+1)*e+a+1,n=(s+1)*e+a,this.faces.push([t,i,n]),this.faces.push([n,i,r]);return this}_getFaceNormal(e){const t=this.faces[e],i=this.vertices[t[0]],r=this.vertices[t[1]],n=this.vertices[t[2]],s=Zr.sub(r,i),a=Zr.sub(n,i),o=Zr.cross(s,a),h=Zr.mag(o);let u=h/(Zr.mag(s)*Zr.mag(a));return 0===u||isNaN(u)?(console.warn("p5.Geometry.prototype._getFaceNormal:","face has colinear sides or a repeated vertex"),o):(u>1&&(u=1),o.mult(Math.asin(u)/h))}computeNormals(e=Ce,{roundToPrecision:t=3}={}){const i=this.vertexNormals;let r=this.vertices;const n=this.faces;let s;if(e===Ae){const e={},i=[],s=Math.pow(10,t),a=e=>Math.round(e*s)/s,o=e=>`${a(e.x)},${a(e.y)},${a(e.z)}`;for(let t=0;t<r.length;t++){const n=r[t],s=o(n);void 0===e[s]&&(e[s]=i.length,i.push(n))}n.forEach((t=>{for(let i=0;i<3;++i){const n=t[i],s=r[n],a=o(s);t[i]=e[a]}})),this.edges.forEach((t=>{for(let i=0;i<2;++i){const n=t[i],s=r[n],a=o(s);t[i]=e[a]}})),this.vertices=r=i}for(i.length=0,s=0;s<r.length;++s)i.push(new Zr);for(n.forEach(((e,t)=>{const r=this._getFaceNormal(t);for(let t=0;t<3;++t){const n=e[t];i[n].add(r)}})),s=0;s<r.length;++s)i[s].normalize();return this}averageNormals(){for(let e=0;e<=this.detailY;e++){const t=this.detailX+1;let i=Zr.add(this.vertexNormals[e*t],this.vertexNormals[e*t+this.detailX]);i=Zr.div(i,2),this.vertexNormals[e*t]=i,this.vertexNormals[e*t+this.detailX]=i}return this}averagePoleNormals(){let e=new Zr(0,0,0);for(let t=0;t<this.detailX;t++)e.add(this.vertexNormals[t]);e=Zr.div(e,this.detailX);for(let t=0;t<this.detailX;t++)this.vertexNormals[t]=e;e=new Zr(0,0,0);for(let t=this.vertices.length-1;t>this.vertices.length-1-this.detailX;t--)e.add(this.vertexNormals[t]);e=Zr.div(e,this.detailX);for(let t=this.vertices.length-1;t>this.vertices.length-1-this.detailX;t--)this.vertexNormals[t]=e;return this}_makeTriangleEdges(){this.edges.length=0;for(let e=0;e<this.faces.length;e++)this.edges.push([this.faces[e][0],this.faces[e][1]]),this.edges.push([this.faces[e][1],this.faces[e][2]]),this.edges.push([this.faces[e][2],this.faces[e][0]]);return this}makeEdgesFromFaces(){this._makeTriangleEdges()}_edgesToVertices(){this.lineVertices.clear(),this.lineTangentsIn.clear(),this.lineTangentsOut.clear(),this.lineSides.clear();const e=new Map,t=new Set;let i;for(let r=0;r<this.edges.length;r++){const n=this.edges[r-1],s=this.edges[r],a=this.vertices[s[0]],o=this.vertices[s[1]],h=this.vertexStrokeColors.length>0&&n?this.vertexStrokeColors.slice(4*n[1],4*(n[1]+1)):[0,0,0,0],u=this.vertexStrokeColors.length>0?this.vertexStrokeColors.slice(4*s[0],4*(s[0]+1)):[0,0,0,0],l=this.vertexStrokeColors.length>0?this.vertexStrokeColors.slice(4*s[1],4*(s[1]+1)):[0,0,0,0],c=o.copy().sub(a).normalize(),p=c.magSq()>0;if(p&&this._addSegment(a,o,u,l,c),!this.renderer?._simpleLines){if(r>0&&n[1]===s[0])t.has(s[0])||(t.add(s[0]),e.delete(s[0]),i&&p&&c.dot(i)<1-1e-8&&this._addJoin(a,i,c,u));else{if(p&&!t.has(s[0])){const i=e.get(s[0]);i?(this._addJoin(a,i.dir,c,u),e.delete(s[0]),t.add(s[0])):e.set(s[0],{point:a,dir:c.copy().mult(-1),color:u})}if(i&&!t.has(n[1])){const r=e.get(n[1]);r?(this._addJoin(this.vertices[n[1]],i,r.dir.copy().mult(-1),h),e.delete(n[1]),t.add(n[1])):e.set(n[1],{point:this.vertices[n[1]],dir:i,color:h}),i=void 0}}if(r===this.edges.length-1&&!t.has(s[1])){const i=e.get(s[1]);i?(this._addJoin(o,c,i.dir.copy().mult(-1),l),e.delete(s[1]),t.add(s[1])):e.set(s[1],{point:o,dir:c,color:l})}p&&(i=c)}}for(const{point:t,dir:i,color:r}of e.values())this._addCap(t,i,r);return this}_addSegment(e,t,i,r,n){const s=e.array(),a=t.array(),o=n.array();this.lineSides.push(1,1,-1,1,-1,-1);for(const e of[this.lineTangentsIn,this.lineTangentsOut])for(let t=0;t<6;t++)e.push(...o);return this.lineVertices.push(...s,...a,...s,...a,...a,...s),this.renderer?._simpleLines||this.lineVertexColors.push(...i,...r,...i,...r,...r,...i),this}_addCap(e,t,i){const r=e.array(),n=t.array(),s=[0,0,0];for(let e=0;e<6;e++)this.lineVertices.push(...r),this.lineTangentsIn.push(...n),this.lineTangentsOut.push(...s),this.lineVertexColors.push(...i);return this.lineSides.push(-1,2,-2,1,2,-1),this}_addJoin(e,t,i,r){const n=e.array(),s=t.array(),a=i.array();for(let e=0;e<12;e++)this.lineVertices.push(...n),this.lineTangentsIn.push(...s),this.lineTangentsOut.push(...a),this.lineVertexColors.push(...r);return this.lineSides.push(-1,-3,-2,-1,0,-3),this.lineSides.push(3,1,2,3,0,1),this}normalize(){if(this.vertices.length>0){const e=this.vertices[0].copy(),t=this.vertices[0].copy();for(let i=0;i<this.vertices.length;i++)e.x=Math.max(e.x,this.vertices[i].x),t.x=Math.min(t.x,this.vertices[i].x),e.y=Math.max(e.y,this.vertices[i].y),t.y=Math.min(t.y,this.vertices[i].y),e.z=Math.max(e.z,this.vertices[i].z),t.z=Math.min(t.z,this.vertices[i].z);const i=Zr.lerp(e,t,.5),r=Zr.sub(e,t),n=200/Math.max(Math.max(r.x,r.y),r.z);for(let e=0;e<this.vertices.length;e++)this.vertices[e].sub(i),this.vertices[e].mult(n)}return this}vertexProperty(e,t,i){let r;this.userVertexProperties[e]||(r=this.userVertexProperties[e]=this._userVertexPropertyHelper(e,t,i)),r=this.userVertexProperties[e],i?r.pushDirect(t):(r.setCurrentData(t),r.pushCurrentData())}_userVertexPropertyHelper(e,t,i){const r=this.userVertexProperties[e]={name:e,dataSize:i||(t.length?t.length:1),geometry:this,getName(){return this.name},getCurrentData(){return void 0===this.currentData&&(this.currentData=new Array(this.getDataSize()).fill(0)),this.currentData},getDataSize(){return this.dataSize},getSrcName(){return this.name.concat("Src")},getDstName(){return this.name.concat("Buffer")},getSrcArray(){const e=this.getSrcName();return this.geometry[e]},setCurrentData(e){this.currentData=e},pushCurrentData(){const e=this.getCurrentData();this.pushDirect(e)},pushDirect(e){e.length?this.getSrcArray().push(...e):this.getSrcArray().push(e)},resetSrcArray(){this.geometry[this.getSrcName()]=[]},delete(){const e=this.getSrcName();delete this.geometry[e]}};return this[r.getSrcName()]=[],this.userVertexProperties[e]}}function Cs(e,t){e.Geometry=ws}ws.nextId=0,void 0!==p5&&Cs(p5);class As{constructor(e){this.renderer=e,e._pInst.push(),this.identityMatrix=new xs(4),e.states.setValue("uModelMatrix",new xs(4)),this.geometry=new ws(void 0,void 0,void 0,this.renderer),this.geometry.gid=`_p5_GeometryBuilder_${As.nextGeometryId}`,As.nextGeometryId++,this.hasTransform=!1}transformVertices(e){return this.hasTransform?e.map((e=>this.renderer.states.uModelMatrix.multiplyPoint(e))):e}transformNormals(e){return this.hasTransform?e.map((e=>this.renderer.scratchMat3.multiplyVec(e))):e}addGeometry(e){this.hasTransform=!this.renderer.states.uModelMatrix.mat4.every(((e,t)=>e===this.identityMatrix.mat4[t])),this.hasTransform&&this.renderer.scratchMat3.inverseTranspose4x4(this.renderer.states.uModelMatrix);let t=this.geometry.vertices.length;this.geometry.vertices.push(...this.transformVertices(e.vertices)),this.geometry.vertexNormals.push(...this.transformNormals(e.vertexNormals)),this.geometry.uvs.push(...e.uvs);const i=e.userVertexProperties,r=this.geometry.userVertexProperties,n=this.geometry.vertices.length-e.vertices.length;for(const t in r){if(t in i)continue;const n=r[t],s=n.getDataSize()*e.vertices.length,a=Array(s).fill(0);n.pushDirect(a)}for(const e in i){const t=i[e],s=t.getSrcArray(),a=t.getDataSize();if(n>0&&!(e in r)){const t=Array(a*n).fill(0);this.geometry.vertexProperty(e,t,a)}this.geometry.vertexProperty(e,s,a)}this.renderer.states.fillColor&&this.geometry.faces.push(...e.faces.map((e=>e.map((e=>e+t))))),this.renderer.states.strokeColor&&this.geometry.edges.push(...e.edges.map((e=>e.map((e=>e+t)))));const s=[...e.vertexColors];for(;s.length<4*e.vertices.length;)s.push(...this.renderer.states.curFillColor);this.geometry.vertexColors.push(...s)}addImmediate(e,t,{validateFaces:i=!1}={}){const r=[];if(this.renderer.states.fillColor)if(5===t||t===I)for(let t=2;t<e.vertices.length;t++)t%2==0?r.push([t,t-1,t-2]):r.push([t,t-2,t-1]);else if(6===t)for(let t=2;t<e.vertices.length;t++)r.push([0,t-1,t]);else if(4===t)for(let t=0;t<e.vertices.length;t+=3)(!i||e.vertices[t].copy().sub(e.vertices[t+1]).cross(e.vertices[t].copy().sub(e.vertices[t+2])).magSq()>0)&&r.push([t,t+1,t+2]);this.addGeometry(Object.assign({},e,{faces:r}))}addRetained(e){this.addGeometry(e)}finish(){return this.renderer._pInst.pop(),this.geometry}}As.nextGeometryId=0;class Es{constructor(e,t,i,r){this.w=e,this.vec=new Zr(t,i,r)}static fromAxisAngle(e,t,i,r){const n=Math.cos(e/2),s=new Zr(t,i,r).normalize().mult(Math.sin(e/2));return new Es(n,s.x,s.y,s.z)}conjugate(){return new Es(this.w,-this.vec.x,-this.vec.y,-this.vec.z)}multiply(e){return new Es(this.w*e.w-this.vec.x*e.vec.x-this.vec.y*e.vec.y-this.vec.z-e.vec.z,this.w*e.vec.x+this.vec.x*e.w+this.vec.y*e.vec.z-this.vec.z*e.vec.y,this.w*e.vec.y-this.vec.x*e.vec.z+this.vec.y*e.w+this.vec.z*e.vec.x,this.w*e.vec.z+this.vec.x*e.vec.y-this.vec.y*e.vec.x+this.vec.z*e.w)}rotateVector(e){return Zr.mult(e,this.w*this.w-this.vec.dot(this.vec)).add(Zr.mult(this.vec,2*e.dot(this.vec))).add(Zr.mult(this.vec,2*this.w).cross(e)).clampToZero()}rotateBy(e){return e.multiply(this).multiply(e.conjugate()).vec.clampToZero()}}function Ds(e,t){e.Quat=Es}void 0!==p5&&Ds(p5);class Ss{constructor(e){this._renderer=e,this.cameraType="default",this.useLinePerspective=!0,this.cameraMatrix=new xs(4),this.projMatrix=new xs(4),this.yScale=1}perspective(e,t,i,r){this.cameraType=arguments.length>0?"custom":"default",void 0===e?(e=this.defaultCameraFOV,this.cameraFOV=e):this.cameraFOV=this._renderer._pInst._toRadians(e),void 0===t&&(t=this.defaultAspectRatio),void 0===i&&(i=this.defaultCameraNear),void 0===r&&(r=this.defaultCameraFar),i<=1e-4&&(i=.01,console.log("Avoid perspective near plane values close to or below 0. Setting value to 0.01.")),r<i&&console.log("Perspective far plane value is less than near plane value. Nothing will be shown."),this.aspectRatio=t,this.cameraNear=i,this.cameraFar=r,this.projMatrix=new xs(4);const n=1/Math.tan(this.cameraFOV/2),s=1/(this.cameraNear-this.cameraFar);this.projMatrix.set(n/t,0,0,0,0,-n*this.yScale,0,0,0,0,(r+i)*s,-1,0,0,2*r*i*s,0),this._isActive()&&(this._renderer.states.setValue("uPMatrix",this._renderer.states.uPMatrix.clone()),this._renderer.states.uPMatrix.set(this.projMatrix))}ortho(e,t,i,r,n,s){const a=this.fbo||this._renderer;void 0===e&&(e=-a.width/2),void 0===t&&(t=+a.width/2),void 0===i&&(i=-a.height/2),void 0===r&&(r=+a.height/2),void 0===n&&(n=0),void 0===s&&(s=Math.max(a.width,a.height)+800),this.cameraNear=n,this.cameraFar=s;const o=t-e,h=r-i,u=s-n,l=2/o,c=2/h*this.yScale,p=-2/u,d=-(t+e)/o,f=-(r+i)/h,g=-(s+n)/u;this.projMatrix=new xs(4),this.projMatrix.set(l,0,0,0,0,-c,0,0,0,0,p,0,d,f,g,1),this._isActive()&&(this._renderer.states.setValue("uPMatrix",this._renderer.states.uPMatrix.clone()),this._renderer.states.uPMatrix.set(this.projMatrix)),this.cameraType="custom"}frustum(e,t,i,r,n,s){void 0===e&&(e=.05*-this._renderer.width),void 0===t&&(t=.05*+this._renderer.width),void 0===i&&(i=.05*+this._renderer.height),void 0===r&&(r=.05*-this._renderer.height),void 0===n&&(n=this.defaultCameraNear),void 0===s&&(s=this.defaultCameraFar),this.cameraNear=n,this.cameraFar=s;const a=t-e,o=r-i,h=s-n,u=2*n/a,l=2*n/o*this.yScale,c=-2*s*n/h,p=(t+e)/a,d=(r+i)/o,f=-(s+n)/h;this.projMatrix=new xs(4),this.projMatrix.set(u,0,0,0,0,-l,0,0,p,d,f,-1,0,0,c,0),this._isActive()&&(this._renderer.states.setValue("uPMatrix",this._renderer.states.uPMatrix.clone()),this._renderer.states.uPMatrix.set(this.projMatrix)),this.cameraType="custom"}_rotateView(e,t,i,r){let n=this.centerX,s=this.centerY,a=this.centerZ;n-=this.eyeX,s-=this.eyeY,a-=this.eyeZ;const o=new xs(4);o.rotate4x4(this._renderer._pInst._toRadians(e),t,i,r);const h=[n*o.mat4[0]+s*o.mat4[4]+a*o.mat4[8],n*o.mat4[1]+s*o.mat4[5]+a*o.mat4[9],n*o.mat4[2]+s*o.mat4[6]+a*o.mat4[10]];h[0]+=this.eyeX,h[1]+=this.eyeY,h[2]+=this.eyeZ,this.camera(this.eyeX,this.eyeY,this.eyeZ,h[0],h[1],h[2],this.upX,this.upY,this.upZ)}roll(e){const t=this._getLocalAxes(),i=Es.fromAxisAngle(this._renderer._pInst._toRadians(e),t.z[0],t.z[1],t.z[2]).rotateVector(new Zr(this.upX,this.upY,this.upZ));this.camera(this.eyeX,this.eyeY,this.eyeZ,this.centerX,this.centerY,this.centerZ,i.x,i.y,i.z)}pan(e){const t=this._getLocalAxes();this._rotateView(e,t.y[0],t.y[1],t.y[2])}tilt(e){const t=this._getLocalAxes();this._rotateView(e,t.x[0],t.x[1],t.x[2])}lookAt(e,t,i){this.camera(this.eyeX,this.eyeY,this.eyeZ,e,t,i,this.upX,this.upY,this.upZ)}camera(e,t,i,r,n,s,a,o,h){void 0===e&&(e=this.defaultEyeX,t=this.defaultEyeY,i=this.defaultEyeZ,r=e,n=t,s=0,a=0,o=1,h=0),this.eyeX=e,this.eyeY=t,this.eyeZ=i,void 0!==r&&(this.centerX=r,this.centerY=n,this.centerZ=s),void 0!==a&&(this.upX=a,this.upY=o,this.upZ=h);const u=this._getLocalAxes();this.cameraMatrix.set(u.x[0],u.y[0],u.z[0],0,u.x[1],u.y[1],u.z[1],0,u.x[2],u.y[2],u.z[2],0,0,0,0,1);const l=-e,c=-t,p=-i;return this.cameraMatrix.translate([l,c,p]),this._isActive()&&(this._renderer.states.setValue("uViewMatrix",this._renderer.states.uViewMatrix.clone()),this._renderer.states.uViewMatrix.set(this.cameraMatrix)),this}move(e,t,i){const r=this._getLocalAxes(),n=[r.x[0]*e,r.x[1]*e,r.x[2]*e],s=[r.y[0]*t,r.y[1]*t,r.y[2]*t],a=[r.z[0]*i,r.z[1]*i,r.z[2]*i];this.camera(this.eyeX+n[0]+s[0]+a[0],this.eyeY+n[1]+s[1]+a[1],this.eyeZ+n[2]+s[2]+a[2],this.centerX+n[0]+s[0]+a[0],this.centerY+n[1]+s[1]+a[1],this.centerZ+n[2]+s[2]+a[2],this.upX,this.upY,this.upZ)}setPosition(e,t,i){const r=e-this.eyeX,n=t-this.eyeY,s=i-this.eyeZ;this.camera(e,t,i,this.centerX+r,this.centerY+n,this.centerZ+s,this.upX,this.upY,this.upZ)}set(e){const t=["eyeX","eyeY","eyeZ","centerX","centerY","centerZ","upX","upY","upZ","cameraFOV","aspectRatio","cameraNear","cameraFar","cameraType","yScale","useLinePerspective"];for(const i of t)this[i]=e[i];this.cameraMatrix=e.cameraMatrix.copy(),this.projMatrix=e.projMatrix.copy(),this._isActive()&&(this._renderer.states.setValue("uModelMatrix",this._renderer.states.uModelMatrix.clone()),this._renderer.states.setValue("uViewMatrix",this._renderer.states.uViewMatrix.clone()),this._renderer.states.setValue("uPMatrix",this._renderer.states.uPMatrix.clone()),this._renderer.states.uModelMatrix.reset(),this._renderer.states.uViewMatrix.set(this.cameraMatrix),this._renderer.states.uPMatrix.set(this.projMatrix))}slerp(e,t,i){if(0===i)return void this.set(e);if(1===i)return void this.set(t);0!==this.projMatrix.mat4[15]&&(this.projMatrix.setElement(0,e.projMatrix.mat4[0]*Math.pow(t.projMatrix.mat4[0]/e.projMatrix.mat4[0],i)),this.projMatrix.setElement(5,e.projMatrix.mat4[5]*Math.pow(t.projMatrix.mat4[5]/e.projMatrix.mat4[5],i)),this._isActive()&&(this._renderer.states.setValue("uPMatrix",this._renderer.states.uPMatrix.clone()),this._renderer.states.uPMatrix.mat4=this.projMatrix.mat4.slice()));const r=new Zr(e.eyeX,e.eyeY,e.eyeZ),n=new Zr(t.eyeX,t.eyeY,t.eyeZ),s=new Zr(e.centerX,e.centerY,e.centerZ),a=new Zr(t.centerX,t.centerY,t.centerZ),o=Zr.dist(r,s),h=Zr.dist(n,a),u=o*Math.pow(h/o,i),l=Zr.sub(r,n),c=r.copy().sub(n).sub(s).add(a),p=c.magSq();let d=1;p>1e-6&&(d=Zr.dot(l,c)/p,d=Math.max(0,Math.min(d,1)));const f=Zr.lerp(Zr.lerp(r,s,d),Zr.lerp(n,a,d),i),g=e.cameraMatrix.createSubMatrix3x3(),m=t.cameraMatrix.createSubMatrix3x3(),y=g.row(2),x=m.row(2),v=g.row(1),b=m.row(1),_=new Zr,w=new Zr,C=new Zr,A=new Zr,E=m.mult(g.copy().transpose()),D=E.diagonal();let S,F,T,M,k=.5*(D[0]+D[1]+D[2]-1);if(1-k<1e-7)return _.set(Zr.lerp(y,x,i)).normalize(),C.set(_).mult(d*u).add(f),A.set(_).mult((d-1)*u).add(f),w.set(Zr.lerp(v,b,i)).normalize(),void this.camera(C.x,C.y,C.z,A.x,A.y,A.z,w.x,w.y,w.z);let I=1/(1-k);const B=Math.max(D[0],D[1],D[2]),L=E.mat3[1]+E.mat3[3],O=E.mat3[2]+E.mat3[6],P=E.mat3[5]+E.mat3[7];B===D[0]?(S=Math.sqrt((D[0]-k)*I),I/=S,F=.5*L*I,T=.5*O*I,M=.5*(E.mat3[7]-E.mat3[5])/S):B===D[1]?(F=Math.sqrt((D[1]-k)*I),I/=F,T=.5*P*I,S=.5*L*I,M=.5*(E.mat3[2]-E.mat3[6])/F):(T=Math.sqrt((D[2]-k)*I),I/=T,S=.5*O*I,F=.5*P*I,M=.5*(E.mat3[3]-E.mat3[1])/T);const N=i*Math.atan2(M,k),R=Math.cos(N),V=Math.sin(N),U=1-R,z=S*F,G=F*T,j=T*S,$=new xs([R+U*S*S,U*z+V*T,U*j-V*F,U*z-V*T,R+U*F*F,U*G+V*S,U*j+V*F,U*G-V*S,R+U*T*T]);$.multiplyVec(y,_),C.set(_).mult(d*u).add(f),A.set(_).mult((d-1)*u).add(f),$.multiplyVec(v,w),this.camera(C.x,C.y,C.z,A.x,A.y,A.z,w.x,w.y,w.z)}_computeCameraDefaultSettings(){this.defaultAspectRatio=this._renderer.width/this._renderer.height,this.defaultEyeX=0,this.defaultEyeY=0,this.defaultEyeZ=800,this.defaultCameraFOV=2*Math.atan(this._renderer.height/2/this.defaultEyeZ),this.defaultCenterX=0,this.defaultCenterY=0,this.defaultCenterZ=0,this.defaultCameraNear=.1*this.defaultEyeZ,this.defaultCameraFar=10*this.defaultEyeZ}_setDefaultCamera(){this.cameraFOV=this.defaultCameraFOV,this.aspectRatio=this.defaultAspectRatio,this.eyeX=this.defaultEyeX,this.eyeY=this.defaultEyeY,this.eyeZ=this.defaultEyeZ,this.centerX=this.defaultCenterX,this.centerY=this.defaultCenterY,this.centerZ=this.defaultCenterZ,this.upX=0,this.upY=1,this.upZ=0,this.cameraNear=this.defaultCameraNear,this.cameraFar=this.defaultCameraFar,this.perspective(),this.camera(),this.cameraType="default"}_resize(){"default"===this.cameraType&&(this._computeCameraDefaultSettings(),this.cameraFOV=this.defaultCameraFOV,this.aspectRatio=this.defaultAspectRatio,this.perspective())}copy(){const e=new Ss(this._renderer);return e.cameraFOV=this.cameraFOV,e.aspectRatio=this.aspectRatio,e.eyeX=this.eyeX,e.eyeY=this.eyeY,e.eyeZ=this.eyeZ,e.centerX=this.centerX,e.centerY=this.centerY,e.centerZ=this.centerZ,e.upX=this.upX,e.upY=this.upY,e.upZ=this.upZ,e.cameraNear=this.cameraNear,e.cameraFar=this.cameraFar,e.cameraType=this.cameraType,e.useLinePerspective=this.useLinePerspective,e.cameraMatrix=this.cameraMatrix.copy(),e.projMatrix=this.projMatrix.copy(),e.yScale=this.yScale,e}clone(){return this.copy()}_getLocalAxes(){let e=this.eyeX-this.centerX,t=this.eyeY-this.centerY,i=this.eyeZ-this.centerZ;const r=Math.sqrt(e*e+t*t+i*i);0!==r&&(e/=r,t/=r,i/=r);let n=this.upX,s=this.upY,a=this.upZ,o=s*i-a*t,h=-n*i+a*e,u=n*t-s*e;n=t*u-i*h,s=-e*u+i*o,a=e*h-t*o;const l=Math.sqrt(o*o+h*h+u*u);0!==l&&(o/=l,h/=l,u/=l);const c=Math.sqrt(n*n+s*s+a*a);return 0!==c&&(n/=c,s/=c,a/=c),{x:[o,h,u],y:[n,s,a],z:[e,t,i]}}_orbit(e,t,i){const r=this.eyeX-this.centerX,n=this.eyeY-this.centerY,s=this.eyeZ-this.centerZ;let a=Math.hypot(r,n,s);const o=new Zr(r,n,s).normalize(),h=new Zr(this.upX,this.upY,this.upZ).normalize(),u=Zr.cross(h,o).normalize(),l=Zr.cross(u,h);a*=Math.pow(10,i),a<this.cameraNear&&(a=this.cameraNear),a>this.cameraFar&&(a=this.cameraFar);const c=Math.acos(Math.max(-1,Math.min(1,Zr.dot(o,h))))+t,p=e;(c<=0||c>=Math.PI)&&(this.upX*=-1,this.upY*=-1,this.upZ*=-1),h.mult(Math.cos(c)),l.mult(Math.cos(p)*Math.sin(c)),u.mult(Math.sin(p)*Math.sin(c)),o.set(h).add(l).add(u),this.eyeX=a*o.x+this.centerX,this.eyeY=a*o.y+this.centerY,this.eyeZ=a*o.z+this.centerZ,this.camera(this.eyeX,this.eyeY,this.eyeZ,this.centerX,this.centerY,this.centerZ,this.upX,this.upY,this.upZ)}_orbitFree(e,t,i){const r=this.eyeX-this.centerX,n=this.eyeY-this.centerY,s=this.eyeZ-this.centerZ;let a=Math.hypot(r,n,s);const o=new Zr(r,n,s).normalize(),h=new Zr(this.upX,this.upY,this.upZ),u=Zr.cross(h,o).normalize(),l=Zr.cross(o,u),c=Math.atan2(t,e);l.mult(Math.sin(c)),u.mult(Math.cos(c)).add(l);const p=Math.sqrt(e*e+t*t),d=Zr.cross(o,u);a*=Math.pow(10,i),a<this.cameraNear&&(a=this.cameraNear),a>this.cameraFar&&(a=this.cameraFar);const f=Math.cos(p),g=Math.sin(p),m=h.dot(o),y=h.dot(u),x=m*f+y*g,v=-m*g+y*f,b=h.dot(d);h.x=x*o.x+v*u.x+b*d.x,h.y=x*o.y+v*u.y+b*d.y,h.z=x*o.z+v*u.z+b*d.z,u.mult(-g),o.mult(f).add(u).mult(a),this.camera(o.x+this.centerX,o.y+this.centerY,o.z+this.centerZ,this.centerX,this.centerY,this.centerZ,h.x,h.y,h.z)}_isActive(){return this===this._renderer.states.curCamera}}function Fs(e,t){t.camera=function(...e){return this._assert3d("camera"),this._renderer.camera(...e),this},t.perspective=function(...e){return this._assert3d("perspective"),this._renderer.perspective(...e),this},t.linePerspective=function(e){if(!(this._renderer instanceof oa))throw new Error("linePerspective() must be called in WebGL mode.");return this._renderer.linePerspective(e)},t.ortho=function(...e){return this._assert3d("ortho"),this._renderer.ortho(...e),this},t.frustum=function(...e){return this._assert3d("frustum"),this._renderer.frustum(...e),this},t.createCamera=function(){return this._assert3d("createCamera"),this._renderer.createCamera()},t.setCamera=function(e){this._renderer.setCamera(e)},e.Camera=Ss,oa.prototype.camera=function(...e){this.states.curCamera.camera(...e)},oa.prototype.perspective=function(...e){this.states.curCamera.perspective(...e)},oa.prototype.linePerspective=function(e){if(void 0===e)return this.states.curCamera.useLinePerspective;this.states.curCamera.useLinePerspective=e},oa.prototype.ortho=function(...e){this.states.curCamera.ortho(...e)},oa.prototype.frustum=function(...e){this.states.curCamera.frustum(...e)},oa.prototype.createCamera=function(){const e=new Ss(this);return e._computeCameraDefaultSettings(),e._setDefaultCamera(),e},oa.prototype.setCamera=function(e){this.states.setValue("curCamera",e),this.states.setValue("uPMatrix",this.states.uPMatrix.clone()),this.states.uPMatrix.set(e.projMatrix),this.states.setValue("uViewMatrix",this.states.uViewMatrix.clone()),this.states.uViewMatrix.set(e.cameraMatrix)}}void 0!==p5&&Fs(p5,p5.prototype);class Ts{constructor(e,t,i,r,n,s){this.size=e,this.src=t,this.dst=i,this.attr=r,this._renderer=n,this.map=s}_prepareBuffer(e,t){const i=t.attributes,r=this._renderer.GL,n=this._renderer._getOrMakeCachedBuffers(e),s=i[this.attr];if(!s)return;let a=n[this.dst];const o=e[this.src];if(o&&o.length>0){const i=!a;if(i&&(n[this.dst]=a=r.createBuffer()),r.bindBuffer(r.ARRAY_BUFFER,a),i||!1!==e.dirtyFlags[this.src]){const t=this.map,i=t?t(o):o;this._renderer._bindBuffer(a,r.ARRAY_BUFFER,i),e.dirtyFlags[this.src]=!1}t.enableAttrib(s,this.size)}else{const e=s.location;if(-1===e||!this._renderer.registerEnabled.has(e))return;r.disableVertexAttribArray(e),this._renderer.registerEnabled.delete(e)}}}function Ms(e,t){e.RenderBuffer=Ts}void 0!==p5&&Ms(p5);class ks{constructor(e,t,i,r={}){this._renderer=e,this._vertSrc=t,this._fragSrc=i,this._vertShader=-1,this._fragShader=-1,this._glProgram=0,this._loadedAttributes=!1,this.attributes={},this._loadedUniforms=!1,this.uniforms={},this._bound=!1,this.samplers=[],this.hooks={uniforms:r.uniforms||{},declarations:r.declarations,helpers:r.helpers||{},vertex:r.vertex||{},fragment:r.fragment||{},modified:{vertex:r.modified&&r.modified.vertex||{},fragment:r.modified&&r.modified.fragment||{}}}}hookTypes(e){let t=this._vertSrc,i=this.hooks.vertex[e];if(i||(i=this.hooks.fragment[e],t=this._fragSrc),!i)throw new Error(`Can't find hook ${e}!`);const r=e.split(/\s+/g),n=r.pop(),s=r.pop(),a=[...r],o=/\(([^\)]*)\)/.exec(i);if(!o)throw new Error(`Couldn't find function parameters in hook body:\n${i}`);const h=e=>{const i=new RegExp(`struct\\s+${e}\\s*{([^}]*)}`).exec(t);if(!i)return;const r=[];for(const e of i[1].split(";")){const t=e.trim().split(/\s+|,/g),i=t.shift(),n=[...t],s=h(i);for(const e of n)r.push({name:e,type:{typeName:i,qualifiers:[],properties:s}})}return r},u=o[1].split(",").map((e=>{const t=e.trim().split(/\s+/g),i=t.pop(),r=t.pop();return{name:i,type:{typeName:r,qualifiers:[...t],properties:h(r)}}}));return{name:n,returnType:{typeName:s,qualifiers:a,properties:h(s)},parameters:u}}shaderSrc(e,t){const i="void main";let[r,n]=e.split(i),s="",a="";for(const e in this.hooks.uniforms)s+=`uniform ${e};\n`;this.hooks.declarations&&(s+=this.hooks.declarations+"\n"),this.hooks[t].declarations&&(s+=this.hooks[t].declarations+"\n");for(const e in this.hooks.helpers)s+=`${e}${this.hooks.helpers[e]}\n`;for(const e in this.hooks[t]){if("declarations"===e)continue;const[i,r]=e.split(" ");this.hooks.modified[t][e]&&(a+="#define AUGMENTED_HOOK_"+r+"\n"),s+=i+" HOOK_"+r+this.hooks[t][e]+"\n"}return-1!==r.indexOf("#define HOOK_DEFINES")&&(r=r.replace("#define HOOK_DEFINES","\n"+a+"\n"),a=""),r+"\n"+a+s+i+n}version(){const e=/#version (.+)$/.exec(this.vertSrc());return e?e[1]:"100 es"}vertSrc(){return this.shaderSrc(this._vertSrc,"vertex")}fragSrc(){return this.shaderSrc(this._fragSrc,"fragment")}inspectHooks(){console.log("==== Vertex shader hooks: ====");for(const e in this.hooks.vertex)console.log((this.hooks.modified.vertex[e]?"[MODIFIED] ":"")+e+this.hooks.vertex[e]);console.log(""),console.log("==== Fragment shader hooks: ====");for(const e in this.hooks.fragment)console.log((this.hooks.modified.fragment[e]?"[MODIFIED] ":"")+e+this.hooks.fragment[e]);console.log(""),console.log("==== Helper functions: ====");for(const e in this.hooks.helpers)console.log(e+this.hooks.helpers[e])}modify(e){const t={vertex:{},fragment:{},helpers:{}};for(const i in e)"declarations"!==i&&"uniforms"!==i&&("vertexDeclarations"===i?t.vertex.declarations=(t.vertex.declarations||"")+"\n"+e[i]:"fragmentDeclarations"===i?t.fragment.declarations=(t.fragment.declarations||"")+"\n"+e[i]:this.hooks.vertex[i]?t.vertex[i]=e[i]:this.hooks.fragment[i]?t.fragment[i]=e[i]:t.helpers[i]=e[i]);const i=Object.assign({},this.hooks.modified.vertex),r=Object.assign({},this.hooks.modified.fragment);for(const e in t.vertex||{})"declarations"!==e&&(i[e]=!0);for(const e in t.fragment||{})"declarations"!==e&&(r[e]=!0);return new ks(this._renderer,this._vertSrc,this._fragSrc,{declarations:(this.hooks.declarations||"")+"\n"+(e.declarations||""),uniforms:Object.assign({},this.hooks.uniforms,e.uniforms||{}),fragment:Object.assign({},this.hooks.fragment,t.fragment||{}),vertex:Object.assign({},this.hooks.vertex,t.vertex||{}),helpers:Object.assign({},this.hooks.helpers,t.helpers||{}),modified:{vertex:i,fragment:r}})}init(){if(0===this._glProgram){const e=this._renderer.GL;if(this._vertShader=e.createShader(e.VERTEX_SHADER),e.shaderSource(this._vertShader,this.vertSrc()),e.compileShader(this._vertShader),!e.getShaderParameter(this._vertShader,e.COMPILE_STATUS)){const t=e.getShaderInfoLog(this._vertShader);return console.error(t),null}if(this._fragShader=e.createShader(e.FRAGMENT_SHADER),e.shaderSource(this._fragShader,this.fragSrc()),e.compileShader(this._fragShader),!e.getShaderParameter(this._fragShader,e.COMPILE_STATUS)){const t=e.getShaderInfoLog(this._fragShader);return console.error(t),null}this._glProgram=e.createProgram(),e.attachShader(this._glProgram,this._vertShader),e.attachShader(this._glProgram,this._fragShader),e.linkProgram(this._glProgram),e.getProgramParameter(this._glProgram,e.LINK_STATUS)||p5._friendlyError(`Snap! Error linking shader program: ${e.getProgramInfoLog(this._glProgram)}`),this._loadAttributes(),this._loadUniforms()}return this}setDefaultUniforms(){for(const e in this.hooks.uniforms){const[,t]=e.split(" "),i=this.hooks.uniforms[e];let r;r=i instanceof Function?i():i,null!=r&&this.setUniform(t,r)}}copyToContext(e){const t=new ks(e._renderer,this._vertSrc,this._fragSrc);return t.ensureCompiledOnContext(e._renderer),t}ensureCompiledOnContext(e){if(0!==this._glProgram&&this._renderer!==e)throw new Error("The shader being run is attached to a different context. Do you need to copy it to this context first with .copyToContext()?");0===this._glProgram&&(this._renderer=e?._renderer?.filterRenderer?._renderer||e,this.init())}_loadAttributes(){if(this._loadedAttributes)return;this.attributes={};const e=this._renderer.GL,t=e.getProgramParameter(this._glProgram,e.ACTIVE_ATTRIBUTES);for(let i=0;i<t;++i){const t=e.getActiveAttrib(this._glProgram,i),r=t.name,n=e.getAttribLocation(this._glProgram,r),s={};s.name=r,s.location=n,s.index=i,s.type=t.type,s.size=t.size,this.attributes[r]=s}this._loadedAttributes=!0}_loadUniforms(){if(this._loadedUniforms)return;const e=this._renderer.GL,t=e.getProgramParameter(this._glProgram,e.ACTIVE_UNIFORMS);let i=0;for(let r=0;r<t;++r){const t=e.getActiveUniform(this._glProgram,r),n={};n.location=e.getUniformLocation(this._glProgram,t.name),n.size=t.size;let s=t.name;t.size>1&&(s=s.substring(0,s.indexOf("[0]"))),n.name=s,n.type=t.type,n._cachedData=void 0,n.type===e.SAMPLER_2D&&(n.samplerIndex=i,i++,this.samplers.push(n)),n.isArray=t.size>1||n.type===e.FLOAT_MAT3||n.type===e.FLOAT_MAT4||n.type===e.FLOAT_VEC2||n.type===e.FLOAT_VEC3||n.type===e.FLOAT_VEC4||n.type===e.INT_VEC2||n.type===e.INT_VEC4||n.type===e.INT_VEC3,this.uniforms[s]=n}this._loadedUniforms=!0}compile(){}bindShader(){this.init(),this._bound||(this.useProgram(),this._bound=!0)}unbindShader(){return this._bound&&(this.unbindTextures(),this._bound=!1),this}bindTextures(){const e=this._renderer.GL,t=this._renderer._getEmptyTexture();for(const i of this.samplers){let r=i.texture;void 0===r&&(i.texture=r=t),e.activeTexture(e.TEXTURE0+i.samplerIndex),r.bindTexture(),r.update(),e.uniform1i(i.location,i.samplerIndex)}}updateTextures(){for(const e of this.samplers){const t=e.texture;t&&t.update()}}unbindTextures(){const e=this._renderer.GL,t=this._renderer._getEmptyTexture();for(const i of this.samplers)i.texture?.isFramebufferTexture&&(e.activeTexture(e.TEXTURE0+i.samplerIndex),t.bindTexture(),e.uniform1i(i.location,i.samplerIndex))}useProgram(){const e=this._renderer.GL;return this._renderer._curShader!==this&&(e.useProgram(this._glProgram),this._renderer._curShader=this),this}setUniform(e,t){this.init();const i=this.uniforms[e];if(!i)return;const r=this._renderer.GL;if(i.isArray){if(i._cachedData&&this._renderer._arraysEqual(i._cachedData,t))return;i._cachedData=t.slice(0)}else{if(i._cachedData&&i._cachedData===t)return;Array.isArray(t)?i._cachedData=t.slice(0):i._cachedData=t}const n=i.location;switch(this.useProgram(),i.type){case r.BOOL:!0===t?r.uniform1i(n,1):r.uniform1i(n,0);break;case r.INT:i.size>1?t.length&&r.uniform1iv(n,t):r.uniform1i(n,t);break;case r.FLOAT:i.size>1?t.length&&r.uniform1fv(n,t):r.uniform1f(n,t);break;case r.FLOAT_MAT3:r.uniformMatrix3fv(n,!1,t);break;case r.FLOAT_MAT4:r.uniformMatrix4fv(n,!1,t);break;case r.FLOAT_VEC2:i.size>1?t.length&&r.uniform2fv(n,t):r.uniform2f(n,t[0],t[1]);break;case r.FLOAT_VEC3:i.size>1?t.length&&r.uniform3fv(n,t):r.uniform3f(n,t[0],t[1],t[2]);break;case r.FLOAT_VEC4:i.size>1?t.length&&r.uniform4fv(n,t):r.uniform4f(n,t[0],t[1],t[2],t[3]);break;case r.INT_VEC2:i.size>1?t.length&&r.uniform2iv(n,t):r.uniform2i(n,t[0],t[1]);break;case r.INT_VEC3:i.size>1?t.length&&r.uniform3iv(n,t):r.uniform3i(n,t[0],t[1],t[2]);break;case r.INT_VEC4:i.size>1?t.length&&r.uniform4iv(n,t):r.uniform4i(n,t[0],t[1],t[2],t[3]);break;case r.SAMPLER_2D:if("number"==typeof t){if(t<r.TEXTURE0||t>r.TEXTURE31||t!==Math.ceil(t))return console.log("🌸 p5.js says: You're trying to use a number as the data for a texture.Please use a texture."),this;r.activeTexture(t),r.uniform1i(n,t)}else r.activeTexture(r.TEXTURE0+i.samplerIndex),i.texture=t instanceof ma?t:this._renderer.getTexture(t),r.uniform1i(n,i.samplerIndex),i.texture.src.gifProperties&&i.texture.src._animateGif(this._renderer._pInst);break;case r.SAMPLER_CUBE:case r.SAMPLER_3D:case r.SAMPLER_2D_SHADOW:case r.SAMPLER_2D_ARRAY:case r.SAMPLER_2D_ARRAY_SHADOW:case r.SAMPLER_CUBE_SHADOW:case r.INT_SAMPLER_2D:case r.INT_SAMPLER_3D:case r.INT_SAMPLER_CUBE:case r.INT_SAMPLER_2D_ARRAY:case r.UNSIGNED_INT_SAMPLER_2D:case r.UNSIGNED_INT_SAMPLER_3D:case r.UNSIGNED_INT_SAMPLER_CUBE:case r.UNSIGNED_INT_SAMPLER_2D_ARRAY:if("number"!=typeof t)break;if(t<r.TEXTURE0||t>r.TEXTURE31||t!==Math.ceil(t)){console.log("🌸 p5.js says: You're trying to use a number as the data for a texture.Please use a texture.");break}r.activeTexture(t),r.uniform1i(n,t)}return this}enableAttrib(e,t,i,r,n,s){if(e){0;const a=e.location;if(-1!==a){const e=this._renderer.GL;this._renderer.registerEnabled.has(a)||(e.enableVertexAttribArray(a),this._renderer.registerEnabled.add(a)),this._renderer.GL.vertexAttribPointer(a,t,i||e.FLOAT,r||!1,n||0,s||0)}}return this}disableRemainingAttributes(){for(const e of this._renderer.registerEnabled.values())Object.keys(this.attributes).some((t=>this.attributes[t].location===e))||(this._renderer.GL.disableVertexAttribArray(e),this._renderer.registerEnabled.delete(e))}}function Is(e,t){e.Shader=ks}void 0!==p5&&Is(p5);var Bs={exports:{}};!function(e){var t;function i(e,t){return e.b===t.b&&e.a===t.a}function r(e,t){return e.b<t.b||e.b===t.b&&e.a<=t.a}function n(e,t,i){var r=t.b-e.b,n=i.b-t.b;return 0<r+n?r<n?t.a-e.a+r/(r+n)*(e.a-i.a):t.a-i.a+n/(r+n)*(i.a-e.a):0}function s(e,t,i){var r=t.b-e.b,n=i.b-t.b;return 0<r+n?(t.a-i.a)*r+(t.a-e.a)*n:0}function a(e,t){return e.a<t.a||e.a===t.a&&e.b<=t.b}function o(e,t,i){var r=t.a-e.a,n=i.a-t.a;return 0<r+n?r<n?t.b-e.b+r/(r+n)*(e.b-i.b):t.b-i.b+n/(r+n)*(i.b-e.b):0}function h(e,t,i){var r=t.a-e.a,n=i.a-t.a;return 0<r+n?(t.b-i.b)*r+(t.b-e.b)*n:0}function u(e){return r(e.b.a,e.a)}function l(e){return r(e.a,e.b.a)}function c(e,t,i,r){return(e=0>e?0:e)<=(i=0>i?0:i)?0===i?(t+r)/2:t+e/(e+i)*(r-t):r+i/(e+i)*(t-r)}function p(e){var t=y(e.b);return v(t,e.c),v(t.b,e.c),b(t,e.a),t}function d(e,t){var i=!1,r=!1;e!==t&&(t.a!==e.a&&(r=!0,w(t.a,e.a)),t.d!==e.d&&(i=!0,C(t.d,e.d)),x(t,e),r||(v(t,e.a),e.a.c=e),i||(b(t,e.d),e.d.a=e))}function f(e){var t=e.b,i=!1;e.d!==e.b.d&&(i=!0,C(e.d,e.b.d)),e.c===e?w(e.a,null):(e.b.d.a=Q(e),e.a.c=e.c,x(e,Q(e)),i||b(e,e.d)),t.c===t?(w(t.a,null),C(t.d,null)):(e.d.a=Q(t),t.a.c=t.c,x(t,Q(t))),_(e)}function g(e){var t=y(e),i=t.b;return x(t,e.e),t.a=e.b.a,v(i,t.a),t.d=i.d=e.d,t=t.b,x(e.b,Q(e.b)),x(e.b,t),e.b.a=t.a,t.b.a.c=t.b,t.b.d=e.b.d,t.f=e.f,t.b.f=e.b.f,t}function m(e,t){var i=!1,r=y(e),n=r.b;return t.d!==e.d&&(i=!0,C(t.d,e.d)),x(r,e.e),x(n,t),r.a=e.b.a,n.a=t.a,r.d=n.d=e.d,e.d.a=n,i||b(r,e.d),r}function y(e){var t=new J,i=new J,r=e.b.h;return i.h=r,r.b.h=t,t.h=e,e.b.h=i,t.b=i,t.c=t,t.e=i,i.b=t,i.c=i,i.e=t}function x(e,t){var i=e.c,r=t.c;i.b.e=t,r.b.e=e,e.c=r,t.c=i}function v(e,t){var i=t.f,r=new te(t,i);i.e=r,t.f=r,i=r.c=e;do{i.a=r,i=i.c}while(i!==e)}function b(e,t){var i=t.d,r=new K(t,i);i.b=r,t.d=r,r.a=e,r.c=t.c,i=e;do{i.d=r,i=i.e}while(i!==e)}function _(e){var t=e.h;e=e.b.h,t.b.h=e,e.b.h=t}function w(e,t){var i=e.c,r=i;do{r.a=t,r=r.c}while(r!==i);i=e.f,(r=e.e).f=i,i.e=r}function C(e,t){var i=e.a,r=i;do{r.d=t,r=r.e}while(r!==i);i=e.d,(r=e.b).d=i,i.b=r}function A(e){var t=0;return Math.abs(e[1])>Math.abs(e[0])&&(t=1),Math.abs(e[2])>Math.abs(e[t])&&(t=2),t}var E=4e150;function D(e,t){e.f+=t.f,e.b.f+=t.b.f}function S(e,t,i){return e=e.a,t=t.a,i=i.a,t.b.a===e?i.b.a===e?r(t.a,i.a)?0>=s(i.b.a,t.a,i.a):0<=s(t.b.a,i.a,t.a):0>=s(i.b.a,e,i.a):i.b.a===e?0<=s(t.b.a,e,t.a):(t=n(t.b.a,e,t.a))>=(e=n(i.b.a,e,i.a))}function F(e){e.a.i=null;var t=e.e;t.a.c=t.c,t.c.a=t.a,e.e=null}function T(e,t){f(e.a),e.c=!1,e.a=t,t.i=e}function M(e){var t=e.a.a;do{e=de(e)}while(e.a.a===t);return e.c&&(T(e,t=m(pe(e).a.b,e.a.e)),e=de(e)),e}function k(e,t,i){var r=new ce;return r.a=i,r.e=q(e.f,t.e,r),i.i=r}function I(e,t){switch(e.s){case 100130:return!!(1&t);case 100131:return 0!==t;case 100132:return 0<t;case 100133:return 0>t;case 100134:return 2<=t||-2>=t}return!1}function B(e){var t=e.a,i=t.d;i.c=e.d,i.a=t,F(e)}function L(e,t,i){for(e=t,t=t.a;e!==i;){e.c=!1;var r=pe(e),n=r.a;if(n.a!==t.a){if(!r.c){B(e);break}T(r,n=m(t.c.b,n.b))}t.c!==n&&(d(Q(n),n),d(t,n)),B(e),t=r.a,e=r}return t}function O(e,t,i,r,n,s){var a=!0;do{k(e,t,i.b),i=i.c}while(i!==r);for(null===n&&(n=pe(t).a.b.c);(i=(r=pe(t)).a.b).a===n.a;)i.c!==n&&(d(Q(i),i),d(Q(n),i)),r.f=t.f-i.f,r.d=I(e,r.f),t.b=!0,!a&&V(e,t)&&(D(i,n),F(t),f(n)),a=!1,t=r,n=i;t.b=!0,s&&z(e,t)}function P(e,t,i,r,n){var s=[t.g[0],t.g[1],t.g[2]];t.d=null,t.d=e.o&&e.o(s,i,r,e.c)||null,null===t.d&&(n?e.n||(Z(e,100156),e.n=!0):t.d=i[0])}function N(e,t,i){var r=[null,null,null,null];r[0]=t.a.d,r[1]=i.a.d,P(e,t.a,r,[.5,.5,0,0],!1),d(t,i)}function R(e,t,i,r,n){var s=Math.abs(t.b-e.b)+Math.abs(t.a-e.a),a=Math.abs(i.b-e.b)+Math.abs(i.a-e.a),o=n+1;r[n]=.5*a/(s+a),r[o]=.5*s/(s+a),e.g[0]+=r[n]*t.g[0]+r[o]*i.g[0],e.g[1]+=r[n]*t.g[1]+r[o]*i.g[1],e.g[2]+=r[n]*t.g[2]+r[o]*i.g[2]}function V(e,t){var n=pe(t),a=t.a,o=n.a;if(r(a.a,o.a)){if(0<s(o.b.a,a.a,o.a))return!1;if(i(a.a,o.a)){if(a.a!==o.a){n=e.e;var h=a.a.h;if(0<=h){var u=(n=n.b).d,l=n.e,c=n.c,p=c[h];u[p]=u[n.a],c[u[p]]=p,p<=--n.a&&(1>=p||r(l[u[p>>1]],l[u[p]])?ue(n,p):le(n,p)),l[h]=null,c[h]=n.b,n.b=h}else for(n.c[-(h+1)]=null;0<n.a&&null===n.c[n.d[n.a-1]];)--n.a;N(e,Q(o),a)}}else g(o.b),d(a,Q(o)),t.b=n.b=!0}else{if(0>s(a.b.a,o.a,a.a))return!1;de(t).b=t.b=!0,g(a.b),d(Q(o),a)}return!0}function U(e,t){var u=pe(t),l=t.a,p=u.a,f=l.a,m=p.a,y=l.b.a,x=p.b.a,v=new te;if(f===m||Math.min(f.a,y.a)>Math.max(m.a,x.a))return!1;if(r(f,m)){if(0<s(x,f,m))return!1}else if(0>s(y,m,f))return!1;var b,_,w=y,C=f,A=x,E=m;if(r(w,C)||(b=w,w=C,C=b),r(A,E)||(b=A,A=E,E=b),r(w,A)||(b=w,w=A,A=b,b=C,C=E,E=b),r(A,C)?r(C,E)?(0>(b=n(w,A,C))+(_=n(A,C,E))&&(b=-b,_=-_),v.b=c(b,A.b,_,C.b)):(0>(b=s(w,A,C))+(_=-s(w,E,C))&&(b=-b,_=-_),v.b=c(b,A.b,_,E.b)):v.b=(A.b+C.b)/2,a(w,C)||(b=w,w=C,C=b),a(A,E)||(b=A,A=E,E=b),a(w,A)||(b=w,w=A,A=b,b=C,C=E,E=b),a(A,C)?a(C,E)?(0>(b=o(w,A,C))+(_=o(A,C,E))&&(b=-b,_=-_),v.a=c(b,A.a,_,C.a)):(0>(b=h(w,A,C))+(_=-h(w,E,C))&&(b=-b,_=-_),v.a=c(b,A.a,_,E.a)):v.a=(A.a+C.a)/2,r(v,e.a)&&(v.b=e.a.b,v.a=e.a.a),w=r(f,m)?f:m,r(w,v)&&(v.b=w.b,v.a=w.a),i(v,f)||i(v,m))return V(e,t),!1;if(!i(y,e.a)&&0<=s(y,e.a,v)||!i(x,e.a)&&0>=s(x,e.a,v)){if(x===e.a)return g(l.b),d(p.b,l),l=pe(t=M(t)).a,L(e,pe(t),u),O(e,t,Q(l),l,l,!0),!0;if(y===e.a){g(p.b),d(l.e,Q(p)),m=(f=u=t).a.b.a;do{f=de(f)}while(f.a.b.a===m);return f=pe(t=f).a.b.c,u.a=Q(p),O(e,t,(p=L(e,u,null)).c,l.b.c,f,!0),!0}return 0<=s(y,e.a,v)&&(de(t).b=t.b=!0,g(l.b),l.a.b=e.a.b,l.a.a=e.a.a),0>=s(x,e.a,v)&&(t.b=u.b=!0,g(p.b),p.a.b=e.a.b,p.a.a=e.a.a),!1}return g(l.b),g(p.b),d(Q(p),l),l.a.b=v.b,l.a.a=v.a,l.a.h=re(e.e,l.a),l=l.a,p=[0,0,0,0],v=[f.d,y.d,m.d,x.d],l.g[0]=l.g[1]=l.g[2]=0,R(l,f,y,p,0),R(l,m,x,p,2),P(e,l,v,p,!0),de(t).b=t.b=u.b=!0,!1}function z(e,t){for(var i=pe(t);;){for(;i.b;)t=i,i=pe(i);if(!t.b&&(i=t,null===(t=de(t))||!t.b))break;t.b=!1;var n,a=t.a,o=i.a;if(n=a.b.a!==o.b.a)e:{var h=pe(n=t),u=n.a,l=h.a,c=void 0;if(r(u.b.a,l.b.a)){if(0>s(u.b.a,l.b.a,u.a)){n=!1;break e}de(n).b=n.b=!0,c=g(u),d(l.b,c),c.d.c=n.d}else{if(0<s(l.b.a,u.b.a,l.a)){n=!1;break e}n.b=h.b=!0,c=g(l),d(u.e,l.b),c.b.d.c=n.d}n=!0}if(n&&(i.c?(F(i),f(o),o=(i=pe(t)).a):t.c&&(F(t),f(a),a=(t=de(i)).a)),a.a!==o.a)if(a.b.a===o.b.a||t.c||i.c||a.b.a!==e.a&&o.b.a!==e.a)V(e,t);else if(U(e,t))break;a.a===o.a&&a.b.a===o.b.a&&(D(o,a),F(t),f(a),t=de(i))}}function G(e,t){e.a=t;for(var n=t.c;null===n.i;)if((n=n.c)===t.c){n=e;var a=t;(u=new ce).a=a.c.b;var o=(c=n.f).a;do{o=o.a}while(null!==o.b&&!c.c(c.b,u,o.b));var h=pe(c=o.b),u=c.a;o=h.a;if(0===s(u.b.a,a,u.a))i((u=c.a).a,a)||i(u.b.a,a)||(g(u.b),c.c&&(f(u.c),c.c=!1),d(a.c,u),G(n,a));else{var l=r(o.b.a,u.b.a)?c:h;h=void 0;c.d||l.c?(h=l===c?m(a.c.b,u.e):m(o.b.c.b,a.c).b,l.c?T(l,h):(u=n,(c=k(n,c,h)).f=de(c).f+c.a.f,c.d=I(u,c.f)),G(n,a)):O(n,c,a.c,a.c,null,!0)}return}if(c=(u=pe(n=M(n.i))).a,(u=L(e,u,null)).c===c){u=(c=u).c,o=pe(n),h=n.a,l=o.a;var c,p=!1;h.b.a!==l.b.a&&U(e,n),i(h.a,e.a)&&(d(Q(u),h),u=pe(n=M(n)).a,L(e,pe(n),o),p=!0),i(l.a,e.a)&&(d(c,Q(l)),c=L(e,o,null),p=!0),p?O(e,n,c.c,u,u,!0):(a=r(l.a,h.a)?Q(l):h,O(e,n,a=m(c.c.b,a),a.c,a.c,!1),a.b.i.c=!0,z(e,n))}else O(e,n,u.c,c,c,!0)}function j(e,t){var i=new ce,r=p(e.b);r.a.b=E,r.a.a=t,r.b.a.b=-4e150,r.b.a.a=t,e.a=r.b.a,i.a=r,i.f=0,i.d=!1,i.c=!1,i.h=!0,i.b=!1,r=q(r=e.f,r.a,i),i.e=r}function $(e){this.a=new H,this.b=e,this.c=S}function q(e,t,i){do{t=t.c}while(null!==t.b&&!e.c(e.b,t.b,i));return e=new H(i,t.a,t),t.a.c=e,t.a=e}function H(e,t,i){this.b=e||null,this.a=t||this,this.c=i||this}function W(){this.d=X,this.p=this.b=this.q=null,this.j=[0,0,0],this.s=100130,this.n=!1,this.o=this.a=this.e=this.f=null,this.m=!1,this.c=this.r=this.i=this.k=this.l=this.h=null}var X=0;function Y(e,t){if(e.d!==t)for(;e.d!==t;)if(e.d<t)switch(e.d){case X:Z(e,100151),e.u(null);break;case 1:Z(e,100152),e.t()}else switch(e.d){case 2:Z(e,100154),e.v();break;case 1:Z(e,100153),e.w()}}function Z(e,t){e.p&&e.p(t,e.c)}function K(e,t){this.b=e||this,this.d=t||this,this.a=null,this.c=!1}function J(){this.h=this,this.i=this.d=this.a=this.e=this.c=this.b=null,this.f=0}function Q(e){return e.b.e}function ee(){this.c=new te,this.a=new K,this.b=new J,this.d=new J,this.b.b=this.d,this.d.b=this.b}function te(e,t){this.e=e||this,this.f=t||this,this.d=this.c=null,this.g=[0,0,0],this.h=this.a=this.b=0}function ie(){this.c=[],this.d=null,this.a=0,this.e=!1,this.b=new se}function re(e,t){if(e.e){var i,r=e.b,n=++r.a;return 2*n>r.f&&(r.f*=2,r.c=ae(r.c,r.f+1)),0===r.b?i=n:(i=r.b,r.b=r.c[r.b]),r.e[i]=t,r.c[i]=n,r.d[n]=i,r.h&&le(r,n),i}return r=e.a++,e.c[r]=t,-(r+1)}function ne(e){if(0===e.a)return he(e.b);var t=e.c[e.d[e.a-1]];if(0!==e.b.a&&r(oe(e.b),t))return he(e.b);do{--e.a}while(0<e.a&&null===e.c[e.d[e.a-1]]);return t}function se(){this.d=ae([0],33),this.e=[null,null],this.c=[0,0],this.a=0,this.f=32,this.b=0,this.h=!1,this.d[1]=1}function ae(e,t){for(var i=Array(t),r=0;r<e.length;r++)i[r]=e[r];for(;r<t;r++)i[r]=0;return i}function oe(e){return e.e[e.d[1]]}function he(e){var t=e.d,i=e.e,r=e.c,n=t[1],s=i[n];return 0<e.a&&(t[1]=t[e.a],r[t[1]]=1,i[n]=null,r[n]=e.b,e.b=n,0<--e.a&&ue(e,1)),s}function ue(e,t){for(var i=e.d,n=e.e,s=e.c,a=t,o=i[a];;){var h=a<<1;h<e.a&&r(n[i[h+1]],n[i[h]])&&(h+=1);var u=i[h];if(h>e.a||r(n[o],n[u])){i[a]=o,s[o]=a;break}i[a]=u,s[u]=a,a=h}}function le(e,t){for(var i=e.d,n=e.e,s=e.c,a=t,o=i[a];;){var h=a>>1,u=i[h];if(0===h||r(n[u],n[o])){i[a]=o,s[o]=a;break}i[a]=u,s[u]=a,a=h}}function ce(){this.e=this.a=null,this.f=0,this.c=this.b=this.h=this.d=!1}function pe(e){return e.e.c.b}function de(e){return e.e.a.b}(t=W.prototype).x=function(){Y(this,X)},t.B=function(e,t){switch(e){case 100142:return;case 100140:switch(t){case 100130:case 100131:case 100132:case 100133:case 100134:return void(this.s=t)}break;case 100141:return void(this.m=!!t);default:return void Z(this,100900)}Z(this,100901)},t.y=function(e){switch(e){case 100142:return 0;case 100140:return this.s;case 100141:return this.m;default:Z(this,100900)}return!1},t.A=function(e,t,i){this.j[0]=e,this.j[1]=t,this.j[2]=i},t.z=function(e,t){var i=t||null;switch(e){case 100100:case 100106:this.h=i;break;case 100104:case 100110:this.l=i;break;case 100101:case 100107:this.k=i;break;case 100102:case 100108:this.i=i;break;case 100103:case 100109:this.p=i;break;case 100105:case 100111:this.o=i;break;case 100112:this.r=i;break;default:Z(this,100900)}},t.C=function(e,t){var i=!1,r=[0,0,0];Y(this,2);for(var n=0;3>n;++n){var s=e[n];-1e150>s&&(s=-1e150,i=!0),1e150<s&&(s=1e150,i=!0),r[n]=s}i&&Z(this,100155),null===(i=this.q)?d(i=p(this.b),i.b):(g(i),i=i.e),i.a.d=t,i.a.g[0]=r[0],i.a.g[1]=r[1],i.a.g[2]=r[2],i.f=1,i.b.f=-1,this.q=i},t.u=function(e){Y(this,X),this.d=1,this.b=new ee,this.c=e},t.t=function(){Y(this,1),this.d=2,this.q=null},t.v=function(){Y(this,2),this.d=1},t.w=function(){Y(this,1),this.d=X;var e=!1,t=[c=this.j[0],n=this.j[1],o=this.j[2]];if(0===c&&0===n&&0===o){for(var n=[-2e150,-2e150,-2e150],a=[2e150,2e150,2e150],o=[],h=[],c=(e=this.b.c).e;c!==e;c=c.e)for(var p=0;3>p;++p){var d=c.g[p];d<a[p]&&(a[p]=d,h[p]=c),d>n[p]&&(n[p]=d,o[p]=c)}if(c=0,n[1]-a[1]>n[0]-a[0]&&(c=1),n[2]-a[2]>n[c]-a[c]&&(c=2),a[c]>=n[c])t[0]=0,t[1]=0,t[2]=1;else{for(n=0,a=h[c],o=o[c],h=[0,0,0],a=[a.g[0]-o.g[0],a.g[1]-o.g[1],a.g[2]-o.g[2]],p=[0,0,0],c=e.e;c!==e;c=c.e)p[0]=c.g[0]-o.g[0],p[1]=c.g[1]-o.g[1],p[2]=c.g[2]-o.g[2],h[0]=a[1]*p[2]-a[2]*p[1],h[1]=a[2]*p[0]-a[0]*p[2],h[2]=a[0]*p[1]-a[1]*p[0],(d=h[0]*h[0]+h[1]*h[1]+h[2]*h[2])>n&&(n=d,t[0]=h[0],t[1]=h[1],t[2]=h[2]);0>=n&&(t[0]=t[1]=t[2]=0,t[A(a)]=1)}e=!0}for(h=A(t),c=this.b.c,n=(h+1)%3,o=(h+2)%3,h=0<t[h]?1:-1,t=c.e;t!==c;t=t.e)t.b=t.g[n],t.a=h*t.g[o];if(e){for(t=0,c=(e=this.b.a).b;c!==e;c=c.b)if(!(0>=(n=c.a).f))do{t+=(n.a.b-n.b.a.b)*(n.a.a+n.b.a.a),n=n.e}while(n!==c.a);if(0>t)for(e=(t=this.b.c).e;e!==t;e=e.e)e.a=-e.a}for(this.n=!1,c=(t=this.b.b).h;c!==t;c=e)e=c.h,n=c.e,i(c.a,c.b.a)&&c.e.e!==c&&(N(this,n,c),f(c),n=(c=n).e),n.e===c&&(n!==c&&(n!==e&&n!==e.b||(e=e.h),f(n)),c!==e&&c!==e.b||(e=e.h),f(c));for(this.e=t=new ie,c=(e=this.b.c).e;c!==e;c=c.e)c.h=re(t,c);for(function(e){e.d=[];for(var t=0;t<e.a;t++)e.d[t]=t;e.d.sort(function(e){return function(t,i){return r(e[t],e[i])?1:-1}}(e.c)),e.e=!0,function(e){for(var t=e.a;1<=t;--t)ue(e,t);e.h=!0}(e.b)}(t),this.f=new $(this),j(this,-4e150),j(this,E);null!==(t=ne(this.e));){for(;;){e:if(c=this.e,0===c.a)e=oe(c.b);else if(e=c.c[c.d[c.a-1]],0!==c.b.a&&(c=oe(c.b),r(c,e))){e=c;break e}if(null===e||!i(e,t))break;e=ne(this.e),N(this,t.c,e.c)}G(this,t)}for(this.a=this.f.a.a.b.a.a,t=0;null!==(e=this.f.a.a.b);)e.h||++t,F(e);for(this.f=null,(t=this.e).b=null,t.d=null,this.e=t.c=null,c=(t=this.b).a.b;c!==t.a;c=e)e=c.b,(c=c.a).e.e===c&&(D(c.c,c),f(c));if(!this.n){if(t=this.b,this.m)for(c=t.b.h;c!==t.b;c=e)e=c.h,c.b.d.c!==c.d.c?c.f=c.d.c?1:-1:f(c);else for(c=t.a.b;c!==t.a;c=e)if(e=c.b,c.c){for(c=c.a;r(c.b.a,c.a);c=c.c.b);for(;r(c.a,c.b.a);c=c.e);for(n=c.c.b,o=void 0;c.e!==n;)if(r(c.b.a,n.a)){for(;n.e!==c&&(u(n.e)||0>=s(n.a,n.b.a,n.e.b.a));)n=(o=m(n.e,n)).b;n=n.c.b}else{for(;n.e!==c&&(l(c.c.b)||0<=s(c.b.a,c.a,c.c.b.a));)c=(o=m(c,c.c.b)).b;c=c.e}for(;n.e.e!==c;)n=(o=m(n.e,n)).b}if(this.h||this.i||this.k||this.l)if(this.m){for(e=(t=this.b).a.b;e!==t.a;e=e.b)if(e.c){this.h&&this.h(2,this.c),c=e.a;do{this.k&&this.k(c.a.d,this.c),c=c.e}while(c!==e.a);this.i&&this.i(this.c)}}else{for(t=this.b,e=!!this.l,c=!1,n=-1,o=t.a.d;o!==t.a;o=o.d)if(o.c){c||(this.h&&this.h(4,this.c),c=!0),h=o.a;do{e&&(n!==(a=h.b.d.c?0:1)&&(n=a,this.l&&this.l(!!n,this.c))),this.k&&this.k(h.a.d,this.c),h=h.e}while(h!==o.a)}c&&this.i&&this.i(this.c)}if(this.r){for(c=(t=this.b).a.b;c!==t.a;c=e)if(e=c.b,!c.c){o=(n=c.a).e,h=void 0;do{o=(h=o).e,h.d=null,null===h.b.d&&(h.c===h?w(h.a,null):(h.a.c=h.c,x(h,Q(h))),(a=h.b).c===a?w(a.a,null):(a.a.c=a.c,x(a,Q(a))),_(h))}while(h!==n);n=c.d,(c=c.b).d=n,n.b=c}return this.r(this.b),void(this.c=this.b=null)}}this.b=this.c=null},Rr.libtess={GluTesselator:W,windingRule:{GLU_TESS_WINDING_ODD:100130,GLU_TESS_WINDING_NONZERO:100131,GLU_TESS_WINDING_POSITIVE:100132,GLU_TESS_WINDING_NEGATIVE:100133,GLU_TESS_WINDING_ABS_GEQ_TWO:100134},primitiveType:{GL_LINE_LOOP:2,GL_TRIANGLES:4,GL_TRIANGLE_STRIP:5,GL_TRIANGLE_FAN:6},errorType:{GLU_TESS_MISSING_BEGIN_POLYGON:100151,GLU_TESS_MISSING_END_POLYGON:100153,GLU_TESS_MISSING_BEGIN_CONTOUR:100152,GLU_TESS_MISSING_END_CONTOUR:100154,GLU_TESS_COORD_TOO_LARGE:100155,GLU_TESS_NEED_COMBINE_CALLBACK:100156},gluEnum:{GLU_TESS_MESH:100112,GLU_TESS_TOLERANCE:100142,GLU_TESS_WINDING_RULE:100140,GLU_TESS_BOUNDARY_ONLY:100141,GLU_INVALID_ENUM:100900,GLU_INVALID_VALUE:100901,GLU_TESS_BEGIN:100100,GLU_TESS_VERTEX:100101,GLU_TESS_END:100102,GLU_TESS_ERROR:100103,GLU_TESS_EDGE_FLAG:100104,GLU_TESS_COMBINE:100105,GLU_TESS_BEGIN_DATA:100106,GLU_TESS_VERTEX_DATA:100107,GLU_TESS_END_DATA:100108,GLU_TESS_ERROR_DATA:100109,GLU_TESS_EDGE_FLAG_DATA:100110,GLU_TESS_COMBINE_DATA:100111}},W.prototype.gluDeleteTess=W.prototype.x,W.prototype.gluTessProperty=W.prototype.B,W.prototype.gluGetTessProperty=W.prototype.y,W.prototype.gluTessNormal=W.prototype.A,W.prototype.gluTessCallback=W.prototype.z,W.prototype.gluTessVertex=W.prototype.C,W.prototype.gluTessBeginPolygon=W.prototype.u,W.prototype.gluTessBeginContour=W.prototype.t,W.prototype.gluTessEndContour=W.prototype.v,W.prototype.gluTessEndPolygon=W.prototype.w,e.exports=Rr.libtess}(Bs);var Ls=Vr(Bs.exports);const Os={vertices:1,vertexNormals:1,vertexColors:4,vertexStrokeColors:4,uvs:2},Ps=Object.values(Os).reduce(((e,t)=>e+t));class Ns{constructor(e){this.renderer=e,this.shapeMode=8,this.geometry=new ws(void 0,void 0,void 0,this.renderer),this.geometry.gid="__IMMEDIATE_MODE_GEOMETRY__",this.contourIndices=[],this._useUserVertexProperties=void 0,this._bezierVertex=[],this._quadraticVertex=[],this._curveVertex=[],this.isProcessingVertices=!1,this._tessy=this._initTessy(),this.tessyVertexSize=Ps,this.bufferStrides={...Os}}constructFromContours(e,t){this._useUserVertexProperties&&this._resetUserVertexProperties(),this.geometry.reset(),this.contourIndices=[],this.shapeMode=e.contours[0].kind;const i=!!this.renderer.states.strokeColor,r={};if(e.userVertexProperties){this._useUserVertexProperties=!0;for(const t in e.userVertexProperties){const i=e.vertexPropertyName(t),n=this.geometry._userVertexPropertyHelper(i,[],e.userVertexProperties[t]);r[t]=n,this.tessyVertexSize+=n.getDataSize(),this.bufferStrides[n.getSrcName()]=n.getDataSize(),this.renderer.buffers.user.push(new Ts(n.getDataSize(),n.getSrcName(),n.getDstName(),i,this.renderer))}}else this._useUserVertexProperties=!1;for(const e of t){this.contourIndices.push(this.geometry.vertices.length);for(const t of e){if(this.shapeMode===k&&this.geometry.vertices.length%6==3)for(const e in this.bufferStrides){const t=this.bufferStrides[e],i=this.geometry[e];i.push(...i.slice(i.length-3*t,i.length-2*t),...i.slice(i.length-t,i.length))}this.geometry.vertices.push(t.position),this.geometry.vertexNormals.push(t.normal||new Zr(0,0,0)),this.geometry.uvs.push(t.textureCoordinates.x,t.textureCoordinates.y),this.renderer.states.fillColor?this.geometry.vertexColors.push(...t.fill.array()):this.geometry.vertexColors.push(0,0,0,0),this.renderer.states.strokeColor?this.geometry.vertexStrokeColors.push(...t.stroke.array()):this.geometry.vertexStrokeColors.push(0,0,0,0);for(const e in r){const i=r[e];e in t&&i.setCurrentData(t[e]),i.pushCurrentData()}}}i&&(this.geometry.edges=this._calculateEdges(this.shapeMode,this.geometry.vertices)),i&&!this.renderer.geometryBuilder&&this.geometry._edgesToVertices(),8===this.shapeMode?(this.isProcessingVertices=!0,this._tesselateShape(),this.isProcessingVertices=!1):this.shapeMode===I?this.shapeMode=5:this.shapeMode===k&&(this.shapeMode=4),this.renderer.states.textureMode===xe&&null!==this.renderer.states._tex&&this.renderer.states._tex.width>0&&this.renderer.states._tex.height>0&&(this.geometry.uvs=this.geometry.uvs.map(((e,t)=>t%2==0?e/this.renderer.states._tex.width:e/this.renderer.states._tex.height)))}_resetUserVertexProperties(){const e=this.geometry.userVertexProperties;for(const t in e){const i=e[t];delete this.bufferStrides[t],i.delete()}this._useUserVertexProperties=!1,this.tessyVertexSize=Ps,this.geometry.userVertexProperties={}}_calculateEdges(e,t){const i=[];let r=0;const n=this.contourIndices.slice();let s=-1;switch(e){case 5:for(r=0;r<t.length-2;r++)i.push([r,r+1]),i.push([r,r+2]);i.push([r,r+1]);break;case 6:for(r=1;r<t.length-1;r++)i.push([0,r]),i.push([r,r+1]);i.push([0,t.length-1]);break;case 4:for(r=0;r<t.length-2;r+=3)i.push([r,r+1]),i.push([r+1,r+2]),i.push([r+2,r]);break;case M:for(r=0;r<t.length-1;r+=2)i.push([r,r+1]);break;case k:for(r=0;r<t.length-5;r+=6)i.push([r,r+1]),i.push([r+1,r+2]),i.push([r+2,r+5]),i.push([r+5,r]);break;case I:for(r=0;r<t.length-2;r+=2)i.push([r,r+1]),i.push([r+1,r+3]),i.push([r,r+2]);i.push([r,r+1]);break;default:for(r=0;r<t.length;r++)r===n[0]?s=n.shift():t[s]&&t[r].equals(t[s])?i.push([r-1,s]):i.push([r-1,r])}return i}_tesselateShape(){const e=[];for(let t=0;t<this.geometry.vertices.length;t++){this.contourIndices.length>0&&this.contourIndices[0]===t&&(this.contourIndices.shift(),e.push([])),e[e.length-1].push(this.geometry.vertices[t].x,this.geometry.vertices[t].y,this.geometry.vertices[t].z,this.geometry.uvs[2*t],this.geometry.uvs[2*t+1],this.geometry.vertexColors[4*t],this.geometry.vertexColors[4*t+1],this.geometry.vertexColors[4*t+2],this.geometry.vertexColors[4*t+3],this.geometry.vertexNormals[t].x,this.geometry.vertexNormals[t].y,this.geometry.vertexNormals[t].z);for(const i in this.geometry.userVertexProperties){const r=this.geometry.userVertexProperties[i],n=t*r.getDataSize(),s=n+r.getDataSize(),a=r.getSrcArray().slice(n,s);e[e.length-1].push(...a)}}const t=this._triangulate(e);if(0===t.length)return;this.shapeMode=4;const i=this.geometry.vertices;this.geometry.vertices=[],this.geometry.vertexNormals=[],this.geometry.uvs=[];for(const e in this.geometry.userVertexProperties){this.geometry.userVertexProperties[e].resetSrcArray()}const r=[];for(let e=0,i=t.length;e<i;e+=this.tessyVertexSize){r.push(...t.slice(e+5,e+9)),this.geometry.vertexNormals.push(new Zr(...t.slice(e+9,e+12)));{let i=12;for(const r in this.geometry.userVertexProperties){const n=this.geometry.userVertexProperties[r],s=n.getDataSize(),a=e+i,o=a+s;n.setCurrentData(t.slice(a,o)),n.pushCurrentData(),i+=s}}this.geometry.vertices.push(new Zr(...t.slice(e,e+3))),this.geometry.uvs.push(...t.slice(e+3,e+5))}if(this.renderer.geometryBuilder){const e=new Map;this.geometry.edges=this.geometry.edges.map((t=>t.map((t=>{if(!e.has(t)){const r=i[t];let n=this.geometry.vertices.findIndex((e=>r.x===e.x&&r.y===e.y&&r.z===e.z));if(-1===n){let e=1/0,t=0;for(let i=0;i<this.geometry.vertices.length;i++){const n=this.geometry.vertices[i],s=r.x-n.x,a=r.y-n.y,o=r.z-n.z,h=s*s+a*a+o*o;h<e&&(e=h,t=i)}n=t}e.set(t,n)}return e.get(t)}))))}this.geometry.vertexColors=r}_initTessy(){const e=new Ls.GluTesselator;return e.gluTessCallback(Ls.gluEnum.GLU_TESS_VERTEX_DATA,(function(e,t){for(const i of e)t.push(i)})),e.gluTessCallback(Ls.gluEnum.GLU_TESS_BEGIN,(function(e){e!==Ls.primitiveType.GL_TRIANGLES&&console.log(`expected TRIANGLES but got type: ${e}`)})),e.gluTessCallback(Ls.gluEnum.GLU_TESS_ERROR,(function(e){console.log("error callback"),console.log(`error number: ${e}`)})),e.gluTessCallback(Ls.gluEnum.GLU_TESS_COMBINE,((e,t,i)=>{const r=new Array(this.tessyVertexSize).fill(0);for(let e=0;e<i.length;e++)for(let n=0;n<r.length;n++)0!==i[e]&&t[e]&&(r[n]+=t[e][n]*i[e]);return r})),e.gluTessCallback(Ls.gluEnum.GLU_TESS_EDGE_FLAG,(function(e){})),e.gluTessProperty(Ls.gluEnum.GLU_TESS_WINDING_RULE,Ls.windingRule.GLU_TESS_WINDING_NONZERO),e}_triangulate(e){const t=e[0]?e[0][2]:void 0;let i=!0;for(const r of e)for(let e=0;e<r.length;e+=this.tessyVertexSize)if(r[e+2]!==t){i=!1;break}i?this._tessy.gluTessNormal(0,0,1):this._tessy.gluTessNormal(0,0,0);const r=[];this._tessy.gluTessBeginPolygon(r);for(const t of e){this._tessy.gluTessBeginContour();for(let e=0;e<t.length;e+=this.tessyVertexSize){const i=t.slice(e,e+this.tessyVertexSize);this._tessy.gluTessVertex(i,i)}this._tessy.gluTessEndContour()}return this._tessy.gluTessEndPolygon(),r}}class Rs{constructor(e){this.renderer=e,this.cache={}}numCached(){return Object.keys(this.cache).length}isCached(e){return void 0!==this.cache[e]}getGeometryByID(e){return this.cache[e]?.geometry}getCached(e){return this.getCachedID(e.gid)}getCachedID(e){return this.cache[e]}ensureCached(e){const t=e.gid;if(!t)throw new Error("The p5.Geometry you passed in has no gid property!");if(this.isCached(e.gid))return this.getCached(e);const i=this.renderer.GL;if(this.freeBuffers(t),Object.keys(this.cache).length>1e3){const e=Object.keys(this.cache)[0];this.freeBuffers(e)}const r={};this.cache[t]=r,r.geometry=e;let n=r.indexBuffer;if(e.faces.length){n||(n=r.indexBuffer=i.createBuffer());const t=e.faces.flat(),s=t.some((e=>e>65535));let a=s?Uint32Array:Uint16Array;this.renderer._bindBuffer(n,i.ELEMENT_ARRAY_BUFFER,t,a),r.indexBufferType=s?i.UNSIGNED_INT:i.UNSIGNED_SHORT}else n&&(i.deleteBuffer(n),r.indexBuffer=null);return r}freeBuffers(e){const t=this.cache[e];if(!t)return;delete this.cache[e];const i=this.renderer.GL;function r(e){for(const r of e)t[r.dst]&&(i.deleteBuffer(t[r.dst]),t[r.dst]=null)}t.indexBuffer&&i.deleteBuffer(t.indexBuffer),r(this.renderer.buffers.stroke),r(this.renderer.buffers.fill),r(this.renderer.buffers.user)}}const Vs={[pe]:3,[ue]:4,[se]:.5};var Us="precision highp int;\n\nuniform mat4 uModelViewMatrix;\nuniform mat4 uProjectionMatrix;\n\nIN vec3 aPosition;\nIN vec2 aTexCoord;\nOUT vec2 vTexCoord;\n\nvoid main() {\n // transferring texcoords for the frag shader\n vTexCoord = aTexCoord;\n\n // copy position with a fourth coordinate for projection (1.0 is normal)\n vec4 positionVec4 = vec4(aPosition, 1.0);\n\n // project to 3D space\n gl_Position = uProjectionMatrix * uModelViewMatrix * positionVec4;\n}\n",zs='#define PI 3.141592\n\nprecision highp float;\nprecision highp int;\n\nuniform mat4 uViewMatrix;\n\nuniform bool uUseLighting;\n\nuniform int uAmbientLightCount;\nuniform vec3 uAmbientColor[5];\nuniform mat3 uCameraRotation;\nuniform int uDirectionalLightCount;\nuniform vec3 uLightingDirection[5];\nuniform vec3 uDirectionalDiffuseColors[5];\nuniform vec3 uDirectionalSpecularColors[5];\n\nuniform int uPointLightCount;\nuniform vec3 uPointLightLocation[5];\nuniform vec3 uPointLightDiffuseColors[5];\t\nuniform vec3 uPointLightSpecularColors[5];\n\nuniform int uSpotLightCount;\nuniform float uSpotLightAngle[5];\nuniform float uSpotLightConc[5];\nuniform vec3 uSpotLightDiffuseColors[5];\nuniform vec3 uSpotLightSpecularColors[5];\nuniform vec3 uSpotLightLocation[5];\nuniform vec3 uSpotLightDirection[5];\n\nuniform bool uSpecular;\nuniform float uShininess;\nuniform float uMetallic;\n\nuniform float uConstantAttenuation;\nuniform float uLinearAttenuation;\nuniform float uQuadraticAttenuation;\n\n// setting from _setImageLightUniforms()\n// boolean to initiate the calculateImageDiffuse and calculateImageSpecular\nuniform bool uUseImageLight;\n// texture for use in calculateImageDiffuse\nuniform sampler2D environmentMapDiffused;\n// texture for use in calculateImageSpecular\nuniform sampler2D environmentMapSpecular;\n\nconst float specularFactor = 2.0;\nconst float diffuseFactor = 0.73;\n\nstruct LightResult {\n float specular;\n float diffuse;\n};\n\nfloat _phongSpecular(\n vec3 lightDirection,\n vec3 viewDirection,\n vec3 surfaceNormal,\n float shininess) {\n\n vec3 R = reflect(lightDirection, surfaceNormal);\n return pow(max(0.0, dot(R, viewDirection)), shininess);\n}\n\nfloat _lambertDiffuse(vec3 lightDirection, vec3 surfaceNormal) {\n return max(0.0, dot(-lightDirection, surfaceNormal));\n}\n\nLightResult _light(vec3 viewDirection, vec3 normal, vec3 lightVector, float shininess, float metallic) {\n\n vec3 lightDir = normalize(lightVector);\n\n //compute our diffuse & specular terms\n LightResult lr;\n float specularIntensity = mix(1.0, 0.4, metallic);\n float diffuseIntensity = mix(1.0, 0.1, metallic);\n if (uSpecular)\n lr.specular = (_phongSpecular(lightDir, viewDirection, normal, shininess)) * specularIntensity;\n lr.diffuse = _lambertDiffuse(lightDir, normal) * diffuseIntensity;\n return lr;\n}\n\n// converts the range of "value" from [min1 to max1] to [min2 to max2]\nfloat map(float value, float min1, float max1, float min2, float max2) {\n return min2 + (value - min1) * (max2 - min2) / (max1 - min1);\n}\n\nvec2 mapTextureToNormal( vec3 v ){\n // x = r sin(phi) cos(theta) \n // y = r cos(phi) \n // z = r sin(phi) sin(theta)\n float phi = acos( v.y );\n // if phi is 0, then there are no x, z components\n float theta = 0.0;\n // else \n theta = acos(v.x / sin(phi));\n float sinTheta = v.z / sin(phi);\n if (sinTheta < 0.0) {\n // Turn it into -theta, but in the 0-2PI range\n theta = 2.0 * PI - theta;\n }\n theta = theta / (2.0 * 3.14159);\n phi = phi / 3.14159 ;\n \n vec2 angles = vec2( fract(theta + 0.25), 1.0 - phi );\n return angles;\n}\n\n\nvec3 calculateImageDiffuse(vec3 vNormal, vec3 vViewPosition, float metallic){\n // make 2 seperate builds \n vec3 worldCameraPosition = vec3(0.0, 0.0, 0.0); // hardcoded world camera position\n vec3 worldNormal = normalize(vNormal * uCameraRotation);\n vec2 newTexCoor = mapTextureToNormal( worldNormal );\n vec4 texture = TEXTURE( environmentMapDiffused, newTexCoor );\n // this is to make the darker sections more dark\n // png and jpg usually flatten the brightness so it is to reverse that\n return mix(smoothstep(vec3(0.0), vec3(1.0), texture.xyz), vec3(0.0), metallic);\n}\n\nvec3 calculateImageSpecular(vec3 vNormal, vec3 vViewPosition, float shininess, float metallic){\n vec3 worldCameraPosition = vec3(0.0, 0.0, 0.0);\n vec3 worldNormal = normalize(vNormal);\n vec3 lightDirection = normalize( vViewPosition - worldCameraPosition );\n vec3 R = reflect(lightDirection, worldNormal) * uCameraRotation;\n vec2 newTexCoor = mapTextureToNormal( R );\n#ifdef WEBGL2\n // In p5js the range of shininess is >= 1,\n // Therefore roughness range will be ([0,1]*8)*20 or [0, 160]\n // The factor of 8 is because currently the getSpecularTexture\n // only calculated 8 different levels of roughness\n // The factor of 20 is just to spread up this range so that,\n // [1, max] of shininess is converted to [0,160] of roughness\n float roughness = 20. / shininess;\n vec4 outColor = textureLod(environmentMapSpecular, newTexCoor, roughness * 8.);\n#else\n vec4 outColor = TEXTURE(environmentMapSpecular, newTexCoor);\n#endif\n // this is to make the darker sections more dark\n // png and jpg usually flatten the brightness so it is to reverse that\n return mix(\n pow(outColor.xyz, vec3(10)),\n pow(outColor.xyz, vec3(1.2)),\n metallic \n );\n}\n\nvoid totalLight(\n vec3 modelPosition,\n vec3 normal,\n float shininess,\n float metallic,\n out vec3 totalDiffuse,\n out vec3 totalSpecular\n) {\n\n totalSpecular = vec3(0.0);\n\n if (!uUseLighting) {\n totalDiffuse = vec3(1.0);\n return;\n }\n\n totalDiffuse = vec3(0.0);\n\n vec3 viewDirection = normalize(-modelPosition);\n\n for (int j = 0; j < 5; j++) {\n if (j < uDirectionalLightCount) {\n vec3 lightVector = (uViewMatrix * vec4(uLightingDirection[j], 0.0)).xyz;\n vec3 lightColor = uDirectionalDiffuseColors[j];\n vec3 specularColor = uDirectionalSpecularColors[j];\n LightResult result = _light(viewDirection, normal, lightVector, shininess, metallic);\n totalDiffuse += result.diffuse * lightColor;\n totalSpecular += result.specular * lightColor * specularColor;\n }\n\n if (j < uPointLightCount) {\n vec3 lightPosition = (uViewMatrix * vec4(uPointLightLocation[j], 1.0)).xyz;\n vec3 lightVector = modelPosition - lightPosition;\n //calculate attenuation\n float lightDistance = length(lightVector);\n float lightFalloff = 1.0 / (uConstantAttenuation + lightDistance * uLinearAttenuation + (lightDistance * lightDistance) * uQuadraticAttenuation);\n vec3 lightColor = lightFalloff * uPointLightDiffuseColors[j];\n vec3 specularColor = lightFalloff * uPointLightSpecularColors[j];\n\n LightResult result = _light(viewDirection, normal, lightVector, shininess, metallic);\n totalDiffuse += result.diffuse * lightColor;\n totalSpecular += result.specular * lightColor * specularColor;\n }\n\n if(j < uSpotLightCount) {\n vec3 lightPosition = (uViewMatrix * vec4(uSpotLightLocation[j], 1.0)).xyz;\n vec3 lightVector = modelPosition - lightPosition;\n \n float lightDistance = length(lightVector);\n float lightFalloff = 1.0 / (uConstantAttenuation + lightDistance * uLinearAttenuation + (lightDistance * lightDistance) * uQuadraticAttenuation);\n\n vec3 lightDirection = (uViewMatrix * vec4(uSpotLightDirection[j], 0.0)).xyz;\n float spotDot = dot(normalize(lightVector), normalize(lightDirection));\n float spotFalloff;\n if(spotDot < uSpotLightAngle[j]) {\n spotFalloff = 0.0;\n }\n else {\n spotFalloff = pow(spotDot, uSpotLightConc[j]);\n }\n lightFalloff *= spotFalloff;\n\n vec3 lightColor = uSpotLightDiffuseColors[j];\n vec3 specularColor = uSpotLightSpecularColors[j];\n \n LightResult result = _light(viewDirection, normal, lightVector, shininess, metallic);\n \n totalDiffuse += result.diffuse * lightColor * lightFalloff;\n totalSpecular += result.specular * lightColor * specularColor * lightFalloff;\n }\n }\n\n if( uUseImageLight ){\n totalDiffuse += calculateImageDiffuse(normal, modelPosition, metallic);\n totalSpecular += calculateImageSpecular(normal, modelPosition, shininess, metallic);\n }\n\n totalDiffuse *= diffuseFactor;\n totalSpecular *= specularFactor;\n}\n',Gs="#ifdef WEBGL2\n\n#define IN in\n#define OUT out\n\n#ifdef FRAGMENT_SHADER\nout vec4 outColor;\n#define OUT_COLOR outColor\n#endif\n#define TEXTURE texture\n\n#else\n\n#ifdef FRAGMENT_SHADER\n#define IN varying\n#else\n#define IN attribute\n#endif\n#define OUT varying\n#define TEXTURE texture2D\n\n#ifdef FRAGMENT_SHADER\n#define OUT_COLOR gl_FragColor\n#endif\n\n#endif\n\n#ifdef FRAGMENT_SHADER\nvec4 getTexture(in sampler2D content, vec2 coord) {\n vec4 color = TEXTURE(content, coord);\n color.rgb /= color.a;\n return color;\n}\n#endif\n",js="precision highp float;\n\nuniform sampler2D tex0;\nuniform vec2 canvasSize;\nuniform vec2 texelSize;\n\nIN vec2 vTexCoord;\n\nstruct FilterInputs {\n vec2 texCoord;\n vec2 canvasSize;\n vec2 texelSize;\n};\n\nvoid main(void) {\n FilterInputs inputs;\n inputs.texCoord = vTexCoord;\n inputs.canvasSize = canvasSize;\n inputs.texelSize = texelSize;\n OUT_COLOR = HOOK_getColor(inputs, tex0);\n OUT_COLOR.rgb *= outColor.a;\n}\n",$s="precision highp float;\n\nvarying vec2 vTexCoord;\n\nuniform sampler2D tex0;\n\nfloat luma(vec3 color) {\n // weighted grayscale with luminance values\n return dot(color, vec3(0.2126, 0.7152, 0.0722));\n}\n\nvoid main() {\n vec4 tex = texture2D(tex0, vTexCoord);\n float gray = luma(tex.rgb);\n gl_FragColor = vec4(gray, gray, gray, tex.a);\n}\n",qs="// Reduces the bright areas in an image\n\nprecision highp float;\n\nvarying vec2 vTexCoord;\n\nuniform sampler2D tex0;\nuniform vec2 texelSize;\n\nfloat luma(vec3 color) {\n // weighted grayscale with luminance values\n // weights 77, 151, 28 taken from src/image/filters.js\n return dot(color, vec3(0.300781, 0.589844, 0.109375));\n}\n\nvoid main() {\n vec4 color = texture2D(tex0, vTexCoord);\n float lum = luma(color.rgb);\n\n // set current color as the darkest neighbor color\n\n vec4 neighbors[4];\n neighbors[0] = texture2D(tex0, vTexCoord + vec2( texelSize.x, 0.0));\n neighbors[1] = texture2D(tex0, vTexCoord + vec2(-texelSize.x, 0.0));\n neighbors[2] = texture2D(tex0, vTexCoord + vec2(0.0, texelSize.y));\n neighbors[3] = texture2D(tex0, vTexCoord + vec2(0.0, -texelSize.y));\n\n for (int i = 0; i < 4; i++) {\n vec4 neighborColor = neighbors[i];\n float neighborLum = luma(neighborColor.rgb);\n\n if (neighborLum < lum) {\n color = neighborColor;\n lum = neighborLum;\n }\n }\n\n gl_FragColor = color;\n}\n",Hs="// Increase the bright areas in an image\n\nprecision highp float;\n\nvarying vec2 vTexCoord;\n\nuniform sampler2D tex0;\nuniform vec2 texelSize;\n\nfloat luma(vec3 color) {\n // weighted grayscale with luminance values\n // weights 77, 151, 28 taken from src/image/filters.js\n return dot(color, vec3(0.300781, 0.589844, 0.109375));\n}\n\nvoid main() {\n vec4 color = texture2D(tex0, vTexCoord);\n float lum = luma(color.rgb);\n\n // set current color as the brightest neighbor color\n\n vec4 neighbors[4];\n neighbors[0] = texture2D(tex0, vTexCoord + vec2( texelSize.x, 0.0));\n neighbors[1] = texture2D(tex0, vTexCoord + vec2(-texelSize.x, 0.0));\n neighbors[2] = texture2D(tex0, vTexCoord + vec2(0.0, texelSize.y));\n neighbors[3] = texture2D(tex0, vTexCoord + vec2(0.0, -texelSize.y));\n\n for (int i = 0; i < 4; i++) {\n vec4 neighborColor = neighbors[i];\n float neighborLum = luma(neighborColor.rgb);\n\n if (neighborLum > lum) {\n color = neighborColor;\n lum = neighborLum;\n }\n }\n\n gl_FragColor = color;\n}\n",Ws="precision highp float;\n\n// Two-pass blur filter, unweighted kernel.\n// See also a similar blur at Adam Ferriss' repo of shader examples:\n// https://github.com/aferriss/p5jsShaderExamples/blob/gh-pages/4_image-effects/4-9_single-pass-blur/effect.frag\n\n\nuniform sampler2D tex0;\nvarying vec2 vTexCoord;\nuniform vec2 direction;\nuniform vec2 canvasSize;\nuniform float radius;\n\nfloat random(vec2 p) {\n vec3 p3 = fract(vec3(p.xyx) * .1031);\n p3 += dot(p3, p3.yzx + 33.33);\n return fract((p3.x + p3.y) * p3.z);\n}\n\n// This isn't a real Gaussian weight, it's a quadratic weight. It's what the\n// CPU mode's blur uses though, so we also use it here to match.\nfloat quadWeight(float x, float e) {\n return pow(e-abs(x), 2.);\n}\n\nvoid main(){\n vec2 uv = vTexCoord;\n\n // A reasonable maximum number of samples\n const float maxSamples = 64.0;\n\n float numSamples = floor(7. * radius);\n if (fract(numSamples / 2.) == 0.) {\n numSamples++;\n }\n vec4 avg = vec4(0.0);\n float total = 0.0;\n\n // Calculate the spacing to avoid skewing if numSamples > maxSamples\n float spacing = 1.0;\n if (numSamples > maxSamples) {\n spacing = numSamples / maxSamples;\n numSamples = maxSamples;\n }\n\n float randomOffset = (spacing - 1.0) * mix(-0.5, 0.5, random(gl_FragCoord.xy));\n for (float i = 0.0; i < maxSamples; i++) {\n if (i >= numSamples) break;\n\n float sample = i * spacing - (numSamples - 1.0) * 0.5 * spacing + randomOffset;\n vec2 sampleCoord = uv + vec2(sample, sample) / canvasSize * direction;\n float weight = quadWeight(sample, (numSamples - 1.0) * 0.5 * spacing);\n\n avg += weight * texture2D(tex0, sampleCoord);\n total += weight;\n }\n\n avg /= total;\n gl_FragColor = avg;\n}\n",Xs="// Limit color space for a stylized cartoon / poster effect\n\nprecision highp float;\n\nvarying vec2 vTexCoord;\n\nuniform sampler2D tex0;\nuniform float filterParameter;\n\nvec3 quantize(vec3 color, float n) {\n // restrict values to N options/bins\n // and floor each channel to nearest value\n //\n // eg. when N = 5, values = 0.0, 0.25, 0.50, 0.75, 1.0\n // then quantize (0.1, 0.7, 0.9) -> (0.0, 0.5, 1.0)\n\n color = color * n;\n color = floor(color);\n color = color / (n - 1.0);\n return color;\n}\n\nvoid main() {\n vec4 color = texture2D(tex0, vTexCoord);\n\n vec3 restrictedColor = quantize(color.rgb / color.a, filterParameter);\n\n gl_FragColor = vec4(restrictedColor.rgb * color.a, color.a);\n}\n",Ys="// Set alpha channel to entirely opaque\n\nprecision highp float;\n\nvarying vec2 vTexCoord;\n\nuniform sampler2D tex0;\n\nvoid main() {\n vec4 color = texture2D(tex0, vTexCoord);\n gl_FragColor = vec4(color.rgb / color.a, 1.0);\n}\n",Zs="// Set each pixel to inverse value\n// Note that original INVERT does not change the opacity, so this follows suit\n\nprecision highp float;\n\nvarying vec2 vTexCoord;\n\nuniform sampler2D tex0;\n\nvoid main() {\nvec4 color = texture2D(tex0, vTexCoord);\nvec3 origColor = color.rgb / color.a;\nvec3 invertedColor = vec3(1.0) - origColor;\ngl_FragColor = vec4(invertedColor * color.a, color.a);\n}\n",Ks="// Convert pixels to either white or black, \n// depending on if their luma is above or below filterParameter\n\nprecision highp float;\n\nvarying vec2 vTexCoord;\n\nuniform sampler2D tex0;\nuniform float filterParameter;\n\nfloat luma(vec3 color) {\n // weighted grayscale with luminance values\n return dot(color, vec3(0.2126, 0.7152, 0.0722));\n}\n\nvoid main() {\n vec4 color = texture2D(tex0, vTexCoord);\n float gray = luma(color.rgb / color.a);\n // floor() used to match src/image/filters.js\n float threshold = floor(filterParameter * 255.0) / 255.0;\n float blackOrWhite = step(threshold, gray);\n gl_FragColor = vec4(vec3(blackOrWhite) * color.a, color.a);\n}\n",Js="uniform mat4 uModelViewMatrix;\nuniform mat4 uProjectionMatrix;\n\nattribute vec3 aPosition;\n// texcoords only come from p5 to vertex shader\n// so pass texcoords on to the fragment shader in a varying variable\nattribute vec2 aTexCoord;\nvarying vec2 vTexCoord;\n\nvoid main() {\n // transferring texcoords for the frag shader\n vTexCoord = aTexCoord;\n\n // copy position with a fourth coordinate for projection (1.0 is normal)\n vec4 positionVec4 = vec4(aPosition, 1.0);\n\n gl_Position = uProjectionMatrix * uModelViewMatrix * positionVec4;\n}\n";const Qs={},ea={};let ta="";const ia=function(e,t){ta+=`#define STROKE_CAP_${e} ${t}\n`,Qs[Re[e]]=t},ra=function(e,t){ta+=`#define STROKE_JOIN_${e} ${t}\n`,ea[Re[e]]=t};ia("ROUND",0),ia("PROJECT",1),ia("SQUARE",2),ra("ROUND",0),ra("MITER",1),ra("BEVEL",2);const na={normalVert:"IN vec3 aPosition;\nIN vec3 aNormal;\nIN vec2 aTexCoord;\nIN vec4 aVertexColor;\n\n#define HOOK_DEFINES\n\n#ifdef AUGMENTED_HOOK_getWorldInputs\nuniform mat4 uModelMatrix;\nuniform mat4 uViewMatrix;\nuniform mat3 uModelNormalMatrix;\nuniform mat3 uCameraNormalMatrix;\n#else\nuniform mat4 uModelViewMatrix;\nuniform mat3 uNormalMatrix;\n#endif\nuniform mat4 uProjectionMatrix;\n\nuniform vec4 uMaterialColor;\nuniform bool uUseVertexColor;\n\nOUT vec3 vVertexNormal;\nOUT highp vec2 vVertTexCoord;\nOUT vec4 vColor;\n\nstruct Vertex {\n vec3 position;\n vec3 normal;\n vec2 texCoord;\n vec4 color;\n};\n\nvoid main(void) {\n HOOK_beforeVertex();\n\n Vertex inputs;\n inputs.position = aPosition;\n inputs.normal = aNormal;\n inputs.texCoord = aTexCoord;\n inputs.color = (uUseVertexColor && aVertexColor.x >= 0.0) ? aVertexColor : uMaterialColor;\n#ifdef AUGMENTED_HOOK_getObjectInputs\n inputs = HOOK_getObjectInputs(inputs);\n#endif\n\n#ifdef AUGMENTED_HOOK_getWorldInputs\n inputs.position = (uModelMatrix * vec4(inputs.position, 1.)).xyz;\n inputs.normal = uModelNormalMatrix * inputs.normal;\n inputs = HOOK_getWorldInputs(inputs);\n#endif\n\n#ifdef AUGMENTED_HOOK_getWorldInputs\n // Already multiplied by the model matrix, just apply view\n inputs.position = (uViewMatrix * vec4(inputs.position, 1.)).xyz;\n inputs.normal = uCameraNormalMatrix * inputs.normal;\n#else\n // Apply both at once\n inputs.position = (uModelViewMatrix * vec4(inputs.position, 1.)).xyz;\n inputs.normal = uNormalMatrix * inputs.normal;\n#endif\n#ifdef AUGMENTED_HOOK_getCameraInputs\n inputs = HOOK_getCameraInputs(inputs);\n#endif\n\n // Pass varyings to fragment shader\n vVertTexCoord = inputs.texCoord;\n vVertexNormal = normalize(inputs.normal);\n vColor = inputs.color;\n\n gl_Position = uProjectionMatrix * vec4(inputs.position, 1.);\n\n HOOK_afterVertex();\n}\n",normalFrag:"IN vec3 vVertexNormal;\nvoid main(void) {\n HOOK_beforeFragment();\n OUT_COLOR = HOOK_getFinalColor(vec4(vVertexNormal, 1.0));\n HOOK_afterFragment();\n}\n",basicFrag:"IN vec4 vColor;\nvoid main(void) {\n HOOK_beforeFragment();\n OUT_COLOR = HOOK_getFinalColor(vec4(vColor.rgb, 1.) * vColor.a);\n HOOK_afterFragment();\n}\n",sphereMappingFrag:"#define PI 3.141592\n\nprecision highp float;\n \nuniform sampler2D uEnvMap;\nuniform mat3 uNewNormalMatrix;\nuniform float uFovY;\nuniform float uAspect;\n\nvarying vec2 vTexCoord;\n \nvoid main() {\n float uFovX = uFovY * uAspect; \n float angleY = mix(uFovY/2.0, -uFovY/2.0, vTexCoord.y);\n float angleX = mix(uFovX/2.0, -uFovX/2.0, vTexCoord.x);\n vec3 rotatedNormal = vec3( angleX, angleY, 1.0 );\n rotatedNormal = uNewNormalMatrix * normalize(rotatedNormal);\n float temp = rotatedNormal.z;\n rotatedNormal.z = rotatedNormal.x;\n rotatedNormal.x = -temp;\n vec2 suv;\n suv.y = 0.5 + 0.5 * (-rotatedNormal.y);\n suv.x = atan(rotatedNormal.z, rotatedNormal.x) / (2.0 * PI) + 0.5;\n vec4 newTexColor = texture2D(uEnvMap, suv.xy);\n gl_FragColor = newTexColor;\n}\n",lightVert:zs+"// include lighting.glgl\n\nIN vec3 aPosition;\nIN vec3 aNormal;\nIN vec2 aTexCoord;\nIN vec4 aVertexColor;\n\nuniform mat4 uModelViewMatrix;\nuniform mat4 uProjectionMatrix;\nuniform mat3 uNormalMatrix;\n\nuniform bool uUseVertexColor;\nuniform vec4 uMaterialColor;\n\nOUT highp vec2 vVertTexCoord;\nOUT vec3 vDiffuseColor;\nOUT vec3 vSpecularColor;\nOUT vec4 vColor;\n\nvoid main(void) {\n\n vec4 viewModelPosition = uModelViewMatrix * vec4(aPosition, 1.0);\n gl_Position = uProjectionMatrix * viewModelPosition;\n\n vec3 vertexNormal = normalize(uNormalMatrix * aNormal);\n vVertTexCoord = aTexCoord;\n\n totalLight(viewModelPosition.xyz, vertexNormal, vDiffuseColor, vSpecularColor);\n\n for (int i = 0; i < 8; i++) {\n if (i < uAmbientLightCount) {\n vDiffuseColor += uAmbientColor[i];\n }\n }\n \n vColor = ((uUseVertexColor && aVertexColor.x >= 0.0) ? aVertexColor : uMaterialColor);\n}\n",lightTextureFrag:"uniform vec4 uTint;\nuniform sampler2D uSampler;\nuniform bool isTexture;\nuniform bool uEmissive;\n\nIN highp vec2 vVertTexCoord;\nIN vec3 vDiffuseColor;\nIN vec3 vSpecularColor;\nIN vec4 vColor;\n\nvoid main(void) {\n if(uEmissive && !isTexture) {\n OUT_COLOR = vColor;\n }\n else {\n vec4 baseColor = isTexture\n // Textures come in with premultiplied alpha. To apply tint and still have\n // premultiplied alpha output, we need to multiply the RGB channels by the\n // tint RGB, and all channels by the tint alpha.\n ? TEXTURE(uSampler, vVertTexCoord) * vec4(uTint.rgb/255., 1.) * (uTint.a/255.)\n // Colors come in with unmultiplied alpha, so we need to multiply the RGB\n // channels by alpha to convert it to premultiplied alpha.\n : vec4(vColor.rgb * vColor.a, vColor.a);\n OUT_COLOR = vec4(baseColor.rgb * vDiffuseColor + vSpecularColor, baseColor.a);\n }\n}\n",phongVert:"precision highp int;\n\n#define HOOK_DEFINES\n\nIN vec3 aPosition;\nIN vec3 aNormal;\nIN vec2 aTexCoord;\nIN vec4 aVertexColor;\n\nuniform vec3 uAmbientColor[5];\n\n#ifdef AUGMENTED_HOOK_getWorldInputs\nuniform mat4 uModelMatrix;\nuniform mat4 uViewMatrix;\nuniform mat3 uModelNormalMatrix;\nuniform mat3 uCameraNormalMatrix;\n#else\nuniform mat4 uModelViewMatrix;\nuniform mat3 uNormalMatrix;\n#endif\nuniform mat4 uProjectionMatrix;\nuniform int uAmbientLightCount;\n\nuniform bool uUseVertexColor;\nuniform vec4 uMaterialColor;\n\nOUT vec3 vNormal;\nOUT vec2 vTexCoord;\nOUT vec3 vViewPosition;\nOUT vec3 vAmbientColor;\nOUT vec4 vColor;\n\nstruct Vertex {\n vec3 position;\n vec3 normal;\n vec2 texCoord;\n vec4 color;\n};\n\nvoid main(void) {\n HOOK_beforeVertex();\n\n Vertex inputs;\n inputs.position = aPosition;\n inputs.normal = aNormal;\n inputs.texCoord = aTexCoord;\n inputs.color = (uUseVertexColor && aVertexColor.x >= 0.0) ? aVertexColor : uMaterialColor;\n#ifdef AUGMENTED_HOOK_getObjectInputs\n inputs = HOOK_getObjectInputs(inputs);\n#endif\n\n#ifdef AUGMENTED_HOOK_getWorldInputs\n inputs.position = (uModelMatrix * vec4(inputs.position, 1.)).xyz;\n inputs.normal = uModelNormalMatrix * inputs.normal;\n inputs = HOOK_getWorldInputs(inputs);\n#endif\n\n#ifdef AUGMENTED_HOOK_getWorldInputs\n // Already multiplied by the model matrix, just apply view\n inputs.position = (uViewMatrix * vec4(inputs.position, 1.)).xyz;\n inputs.normal = uCameraNormalMatrix * inputs.normal;\n#else\n // Apply both at once\n inputs.position = (uModelViewMatrix * vec4(inputs.position, 1.)).xyz;\n inputs.normal = uNormalMatrix * inputs.normal;\n#endif\n#ifdef AUGMENTED_HOOK_getCameraInputs\n inputs = HOOK_getCameraInputs(inputs);\n#endif\n\n // Pass varyings to fragment shader\n vViewPosition = inputs.position;\n vTexCoord = inputs.texCoord;\n vNormal = inputs.normal;\n vColor = inputs.color;\n\n // TODO: this should be a uniform\n vAmbientColor = vec3(0.0);\n for (int i = 0; i < 5; i++) {\n if (i < uAmbientLightCount) {\n vAmbientColor += uAmbientColor[i];\n }\n }\n\n gl_Position = uProjectionMatrix * vec4(inputs.position, 1.);\n HOOK_afterVertex();\n}\n",phongFrag:zs+"// include lighting.glsl\nprecision highp int;\n\nuniform bool uHasSetAmbient;\nuniform vec4 uSpecularMatColor;\nuniform vec4 uAmbientMatColor;\nuniform vec4 uEmissiveMatColor;\n\nuniform vec4 uTint;\nuniform sampler2D uSampler;\nuniform bool isTexture;\n\nIN vec3 vNormal;\nIN vec2 vTexCoord;\nIN vec3 vViewPosition;\nIN vec3 vAmbientColor;\nIN vec4 vColor;\n\nstruct ColorComponents {\n vec3 baseColor;\n float opacity;\n vec3 ambientColor;\n vec3 specularColor;\n vec3 diffuse;\n vec3 ambient;\n vec3 specular;\n vec3 emissive;\n};\n\nstruct Inputs {\n vec3 normal;\n vec2 texCoord;\n vec3 ambientLight;\n vec3 ambientMaterial;\n vec3 specularMaterial;\n vec3 emissiveMaterial;\n vec4 color;\n float shininess;\n float metalness;\n};\n\nvoid main(void) {\n HOOK_beforeFragment();\n\n Inputs inputs;\n inputs.normal = normalize(vNormal);\n inputs.texCoord = vTexCoord;\n inputs.ambientLight = vAmbientColor;\n inputs.color = isTexture\n ? TEXTURE(uSampler, vTexCoord) * (vec4(uTint.rgb/255., 1.) * uTint.a/255.)\n : vColor;\n if (isTexture && inputs.color.a > 0.0) {\n // Textures come in with premultiplied alpha. Temporarily unpremultiply it\n // so hooks users don't have to think about premultiplied alpha.\n inputs.color.rgb /= inputs.color.a;\n }\n inputs.shininess = uShininess;\n inputs.metalness = uMetallic;\n inputs.ambientMaterial = uHasSetAmbient ? uAmbientMatColor.rgb : inputs.color.rgb;\n inputs.specularMaterial = uSpecularMatColor.rgb;\n inputs.emissiveMaterial = uEmissiveMatColor.rgb;\n inputs = HOOK_getPixelInputs(inputs);\n\n vec3 diffuse;\n vec3 specular;\n totalLight(vViewPosition, inputs.normal, inputs.shininess, inputs.metalness, diffuse, specular);\n\n // Calculating final color as result of all lights (plus emissive term).\n\n vec2 texCoord = inputs.texCoord;\n vec4 baseColor = inputs.color;\n ColorComponents c;\n c.opacity = baseColor.a;\n c.baseColor = baseColor.rgb;\n c.ambientColor = inputs.ambientMaterial;\n c.specularColor = inputs.specularMaterial;\n c.diffuse = diffuse;\n c.ambient = inputs.ambientLight;\n c.specular = specular;\n c.emissive = inputs.emissiveMaterial;\n OUT_COLOR = HOOK_getFinalColor(HOOK_combineColors(c));\n OUT_COLOR.rgb *= OUT_COLOR.a; // Premultiply alpha before rendering\n HOOK_afterFragment();\n}\n",fontVert:"IN vec3 aPosition;\nIN vec2 aTexCoord;\nuniform mat4 uModelViewMatrix;\nuniform mat4 uProjectionMatrix;\n\nuniform vec4 uGlyphRect;\nuniform float uGlyphOffset;\n\nOUT vec2 vTexCoord;\nOUT float w;\n\nvoid main() {\n vec4 positionVec4 = vec4(aPosition, 1.0);\n\n // scale by the size of the glyph's rectangle\n positionVec4.xy *= uGlyphRect.zw - uGlyphRect.xy;\n\n // Expand glyph bounding boxes by 1px on each side to give a bit of room\n // for antialiasing\n vec3 newOrigin = (uModelViewMatrix * vec4(0., 0., 0., 1.)).xyz;\n vec3 newDX = (uModelViewMatrix * vec4(1., 0., 0., 1.)).xyz;\n vec3 newDY = (uModelViewMatrix * vec4(0., 1., 0., 1.)).xyz;\n vec2 pixelScale = vec2(\n 1. / length(newOrigin - newDX),\n 1. / length(newOrigin - newDY)\n );\n vec2 offset = pixelScale * normalize(aTexCoord - vec2(0.5, 0.5));\n vec2 textureOffset = offset * (1. / vec2(\n uGlyphRect.z - uGlyphRect.x,\n uGlyphRect.w - uGlyphRect.y\n ));\n\n // move to the corner of the glyph\n positionVec4.xy += uGlyphRect.xy;\n\n // move to the letter's line offset\n positionVec4.x += uGlyphOffset;\n\n positionVec4.xy += offset;\n \n gl_Position = uProjectionMatrix * uModelViewMatrix * positionVec4;\n vTexCoord = aTexCoord + textureOffset;\n w = gl_Position.w;\n}\n",fontFrag:"#ifndef WEBGL2\n#extension GL_OES_standard_derivatives : enable\n#endif\n\n#if 0\n // simulate integer math using floats\n\t#define int float\n\t#define ivec2 vec2\n\t#define INT(x) float(x)\n\n\tint ifloor(float v) { return floor(v); }\n\tivec2 ifloor(vec2 v) { return floor(v); }\n\n#else\n // use native integer math\n\tprecision highp int;\n\t#define INT(x) x\n\n\tint ifloor(float v) { return int(v); }\n\tint ifloor(int v) { return v; }\n\tivec2 ifloor(vec2 v) { return ivec2(v); }\n\n#endif\n\nuniform sampler2D uSamplerStrokes;\nuniform sampler2D uSamplerRowStrokes;\nuniform sampler2D uSamplerRows;\nuniform sampler2D uSamplerColStrokes;\nuniform sampler2D uSamplerCols;\n\nuniform ivec2 uStrokeImageSize;\nuniform ivec2 uCellsImageSize;\nuniform ivec2 uGridImageSize;\n\nuniform ivec2 uGridOffset;\nuniform ivec2 uGridSize;\nuniform vec4 uMaterialColor;\n\nIN vec2 vTexCoord;\n\n// some helper functions\nint ROUND(float v) { return ifloor(v + 0.5); }\nivec2 ROUND(vec2 v) { return ifloor(v + 0.5); }\nfloat saturate(float v) { return clamp(v, 0.0, 1.0); }\nvec2 saturate(vec2 v) { return clamp(v, 0.0, 1.0); }\n\nint mul(float v1, int v2) {\n return ifloor(v1 * float(v2));\n}\n\nivec2 mul(vec2 v1, ivec2 v2) {\n return ifloor(v1 * vec2(v2) + 0.5);\n}\n\n// unpack a 16-bit integer from a float vec2\nint getInt16(vec2 v) {\n ivec2 iv = ROUND(v * 255.0);\n return iv.x * INT(128) + iv.y;\n}\n\nvec2 pixelScale;\nvec2 coverage = vec2(0.0);\nvec2 weight = vec2(0.5);\nconst float minDistance = 1.0/8192.0;\nconst float hardness = 1.05; // amount of antialias\n\n// the maximum number of curves in a glyph\nconst int N = INT(250);\n\n// retrieves an indexed pixel from a sampler\nvec4 getTexel(sampler2D sampler, int pos, ivec2 size) {\n int width = size.x;\n int y = ifloor(pos / width);\n int x = pos - y * width; // pos % width\n\n return TEXTURE(sampler, (vec2(x, y) + 0.5) / vec2(size));\n}\n\nvoid calulateCrossings(vec2 p0, vec2 p1, vec2 p2, out vec2 C1, out vec2 C2) {\n\n // get the coefficients of the quadratic in t\n vec2 a = p0 - p1 * 2.0 + p2;\n vec2 b = p0 - p1;\n vec2 c = p0 - vTexCoord;\n\n // found out which values of 't' it crosses the axes\n vec2 surd = sqrt(max(vec2(0.0), b * b - a * c));\n vec2 t1 = ((b - surd) / a).yx;\n vec2 t2 = ((b + surd) / a).yx;\n\n // approximate straight lines to avoid rounding errors\n if (abs(a.y) < 0.001)\n t1.x = t2.x = c.y / (2.0 * b.y);\n\n if (abs(a.x) < 0.001)\n t1.y = t2.y = c.x / (2.0 * b.x);\n\n // plug into quadratic formula to find the corrdinates of the crossings\n C1 = ((a * t1 - b * 2.0) * t1 + c) * pixelScale;\n C2 = ((a * t2 - b * 2.0) * t2 + c) * pixelScale;\n}\n\nvoid coverageX(vec2 p0, vec2 p1, vec2 p2) {\n\n vec2 C1, C2;\n calulateCrossings(p0, p1, p2, C1, C2);\n\n // determine on which side of the x-axis the points lie\n bool y0 = p0.y > vTexCoord.y;\n bool y1 = p1.y > vTexCoord.y;\n bool y2 = p2.y > vTexCoord.y;\n\n // could web be under the curve (after t1)?\n if (y1 ? !y2 : y0) {\n // add the coverage for t1\n coverage.x += saturate(C1.x + 0.5);\n // calculate the anti-aliasing for t1\n weight.x = min(weight.x, abs(C1.x));\n }\n\n // are we outside the curve (after t2)?\n if (y1 ? !y0 : y2) {\n // subtract the coverage for t2\n coverage.x -= saturate(C2.x + 0.5);\n // calculate the anti-aliasing for t2\n weight.x = min(weight.x, abs(C2.x));\n }\n}\n\n// this is essentially the same as coverageX, but with the axes swapped\nvoid coverageY(vec2 p0, vec2 p1, vec2 p2) {\n\n vec2 C1, C2;\n calulateCrossings(p0, p1, p2, C1, C2);\n\n bool x0 = p0.x > vTexCoord.x;\n bool x1 = p1.x > vTexCoord.x;\n bool x2 = p2.x > vTexCoord.x;\n\n if (x1 ? !x2 : x0) {\n coverage.y -= saturate(C1.y + 0.5);\n weight.y = min(weight.y, abs(C1.y));\n }\n\n if (x1 ? !x0 : x2) {\n coverage.y += saturate(C2.y + 0.5);\n weight.y = min(weight.y, abs(C2.y));\n }\n}\n\nvoid main() {\n\n // calculate the pixel scale based on screen-coordinates\n pixelScale = hardness / fwidth(vTexCoord);\n\n // which grid cell is this pixel in?\n ivec2 gridCoord = ifloor(vTexCoord * vec2(uGridSize));\n\n // intersect curves in this row\n {\n // the index into the row info bitmap\n int rowIndex = gridCoord.y + uGridOffset.y;\n // fetch the info texel\n vec4 rowInfo = getTexel(uSamplerRows, rowIndex, uGridImageSize);\n // unpack the rowInfo\n int rowStrokeIndex = getInt16(rowInfo.xy);\n int rowStrokeCount = getInt16(rowInfo.zw);\n\n for (int iRowStroke = INT(0); iRowStroke < N; iRowStroke++) {\n if (iRowStroke >= rowStrokeCount)\n break;\n\n // each stroke is made up of 3 points: the start and control point\n // and the start of the next curve.\n // fetch the indices of this pair of strokes:\n vec4 strokeIndices = getTexel(uSamplerRowStrokes, rowStrokeIndex++, uCellsImageSize);\n\n // unpack the stroke index\n int strokePos = getInt16(strokeIndices.xy);\n\n // fetch the two strokes\n vec4 stroke0 = getTexel(uSamplerStrokes, strokePos + INT(0), uStrokeImageSize);\n vec4 stroke1 = getTexel(uSamplerStrokes, strokePos + INT(1), uStrokeImageSize);\n\n // calculate the coverage\n coverageX(stroke0.xy, stroke0.zw, stroke1.xy);\n }\n }\n\n // intersect curves in this column\n {\n int colIndex = gridCoord.x + uGridOffset.x;\n vec4 colInfo = getTexel(uSamplerCols, colIndex, uGridImageSize);\n int colStrokeIndex = getInt16(colInfo.xy);\n int colStrokeCount = getInt16(colInfo.zw);\n \n for (int iColStroke = INT(0); iColStroke < N; iColStroke++) {\n if (iColStroke >= colStrokeCount)\n break;\n\n vec4 strokeIndices = getTexel(uSamplerColStrokes, colStrokeIndex++, uCellsImageSize);\n\n int strokePos = getInt16(strokeIndices.xy);\n vec4 stroke0 = getTexel(uSamplerStrokes, strokePos + INT(0), uStrokeImageSize);\n vec4 stroke1 = getTexel(uSamplerStrokes, strokePos + INT(1), uStrokeImageSize);\n coverageY(stroke0.xy, stroke0.zw, stroke1.xy);\n }\n }\n\n weight = saturate(1.0 - weight * 2.0);\n float distance = max(weight.x + weight.y, minDistance); // manhattan approx.\n float antialias = abs(dot(coverage, weight) / distance);\n float cover = min(abs(coverage.x), abs(coverage.y));\n OUT_COLOR = vec4(uMaterialColor.rgb, 1.) * uMaterialColor.a;\n OUT_COLOR *= saturate(max(antialias, cover));\n}\n",lineVert:ta+"/*\n Part of the Processing project - http://processing.org\n Copyright (c) 2012-15 The Processing Foundation\n Copyright (c) 2004-12 Ben Fry and Casey Reas\n Copyright (c) 2001-04 Massachusetts Institute of Technology\n This library is free software; you can redistribute it and/or\n modify it under the terms of the GNU Lesser General Public\n License as published by the Free Software Foundation, version 2.1.\n This library is distributed in the hope that it will be useful,\n but WITHOUT ANY WARRANTY; without even the implied warranty of\n MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n Lesser General Public License for more details.\n You should have received a copy of the GNU Lesser General\n Public License along with this library; if not, write to the\n Free Software Foundation, Inc., 59 Temple Place, Suite 330,\n Boston, MA 02111-1307 USA\n*/\n\n#define PROCESSING_LINE_SHADER\n\n#define HOOK_DEFINES\n\nprecision highp int;\nprecision highp float;\n\n#ifdef AUGMENTED_HOOK_getWorldInputs\nuniform mat4 uModelMatrix;\nuniform mat4 uViewMatrix;\n#else\nuniform mat4 uModelViewMatrix;\n#endif\n\nuniform mat4 uProjectionMatrix;\nuniform float uStrokeWeight;\n\nuniform bool uUseLineColor;\nuniform bool uSimpleLines;\nuniform vec4 uMaterialColor;\n\nuniform vec4 uViewport;\nuniform int uPerspective;\nuniform int uStrokeJoin;\n\nIN vec3 aPosition;\nIN vec3 aTangentIn;\nIN vec3 aTangentOut;\nIN float aSide;\nIN vec4 aVertexColor;\n\nOUT vec4 vColor;\nOUT vec2 vTangent;\nOUT vec2 vCenter;\nOUT vec2 vPosition;\nOUT float vMaxDist;\nOUT float vCap;\nOUT float vJoin;\nOUT float vStrokeWeight;\n\nvec2 lineIntersection(vec2 aPoint, vec2 aDir, vec2 bPoint, vec2 bDir) {\n // Rotate and translate so a starts at the origin and goes out to the right\n bPoint -= aPoint;\n vec2 rotatedBFrom = vec2(\n bPoint.x*aDir.x + bPoint.y*aDir.y,\n bPoint.y*aDir.x - bPoint.x*aDir.y\n );\n vec2 bTo = bPoint + bDir;\n vec2 rotatedBTo = vec2(\n bTo.x*aDir.x + bTo.y*aDir.y,\n bTo.y*aDir.x - bTo.x*aDir.y\n );\n float intersectionDistance =\n rotatedBTo.x + (rotatedBFrom.x - rotatedBTo.x) * rotatedBTo.y /\n (rotatedBTo.y - rotatedBFrom.y);\n return aPoint + aDir * intersectionDistance;\n}\n\nstruct StrokeVertex {\n vec3 position;\n vec3 tangentIn;\n vec3 tangentOut;\n vec4 color;\n float weight;\n};\n\nvoid main() {\n HOOK_beforeVertex();\n\n if (!uSimpleLines) {\n // Caps have one of either the in or out tangent set to 0\n vCap = (aTangentIn == vec3(0.)) != (aTangentOut == vec3(0.)) ? 1. : 0.;\n\n // Joins have two unique, defined tangents\n vJoin = (\n aTangentIn != vec3(0.) &&\n aTangentOut != vec3(0.) &&\n aTangentIn != aTangentOut\n ) ? 1. : 0.;\n }\n\n StrokeVertex inputs;\n inputs.position = aPosition.xyz;\n inputs.color = uUseLineColor ? aVertexColor : uMaterialColor;\n inputs.weight = uStrokeWeight;\n inputs.tangentIn = aTangentIn;\n inputs.tangentOut = aTangentOut;\n\n#ifdef AUGMENTED_HOOK_getObjectInputs\n inputs = HOOK_getObjectInputs(inputs);\n#endif\n\n#ifdef AUGMENTED_HOOK_getWorldInputs\n inputs.position = (uModelMatrix * vec4(inputs.position, 1.)).xyz;\n inputs.tangentIn = (uModelMatrix * vec4(aTangentIn, 0.)).xyz;\n inputs.tangentOut = (uModelMatrix * vec4(aTangentOut, 0.)).xyz;\n inputs = HOOK_getWorldInputs(inputs);\n#endif\n\n#ifdef AUGMENTED_HOOK_getWorldInputs\n // Already multiplied by the model matrix, just apply view\n inputs.position = (uViewMatrix * vec4(inputs.position, 1.)).xyz;\n inputs.tangentIn = (uViewMatrix * vec4(aTangentIn, 0.)).xyz;\n inputs.tangentOut = (uViewMatrix * vec4(aTangentOut, 0.)).xyz;\n#else\n // Apply both at once\n inputs.position = (uModelViewMatrix * vec4(inputs.position, 1.)).xyz;\n inputs.tangentIn = (uModelViewMatrix * vec4(aTangentIn, 0.)).xyz;\n inputs.tangentOut = (uModelViewMatrix * vec4(aTangentOut, 0.)).xyz;\n#endif\n#ifdef AUGMENTED_HOOK_getCameraInputs\n inputs = hook_getCameraInputs(inputs);\n#endif\n\n vec4 posp = vec4(inputs.position, 1.);\n vec4 posqIn = vec4(inputs.position + inputs.tangentIn, 1.);\n vec4 posqOut = vec4(inputs.position + inputs.tangentOut, 1.);\n vStrokeWeight = inputs.weight;\n\n float facingCamera = pow(\n // The word space tangent's z value is 0 if it's facing the camera\n abs(normalize(posqIn-posp).z),\n\n // Using pow() here to ramp `facingCamera` up from 0 to 1 really quickly\n // so most lines get scaled and don't get clipped\n 0.25\n );\n\n // Moving vertices slightly toward the camera\n // to avoid depth-fighting with the fill triangles.\n // A mix of scaling and offsetting is used based on distance\n // Discussion here:\n // https://github.com/processing/p5.js/issues/7200 \n\n // using a scale <1 moves the lines towards nearby camera\n // in order to prevent popping effects due to half of\n // the line disappearing behind the geometry faces.\n float zDistance = -posp.z; \n float distanceFactor = smoothstep(0.0, 800.0, zDistance); \n \n // Discussed here:\n // http://www.opengl.org/discussion_boards/ubbthreads.php?ubb=showflat&Number=252848 \n float scale = mix(1., 0.995, facingCamera);\n float dynamicScale = mix(scale, 1.0, distanceFactor); // Closer = more scale, farther = less\n\n posp.xyz = posp.xyz * dynamicScale;\n posqIn.xyz = posqIn.xyz * dynamicScale;\n posqOut.xyz = posqOut.xyz * dynamicScale;\n\n // Moving vertices slightly toward camera when far away \n // https://github.com/processing/p5.js/issues/6956 \n float zOffset = mix(0., -1., facingCamera);\n float dynamicZAdjustment = mix(0.0, zOffset, distanceFactor); // Closer = less zAdjustment, farther = more\n\n posp.z -= dynamicZAdjustment;\n posqIn.z -= dynamicZAdjustment;\n posqOut.z -= dynamicZAdjustment;\n \n vec4 p = uProjectionMatrix * posp;\n vec4 qIn = uProjectionMatrix * posqIn;\n vec4 qOut = uProjectionMatrix * posqOut;\n\n // formula to convert from clip space (range -1..1) to screen space (range 0..[width or height])\n // screen_p = (p.xy/p.w + <1,1>) * 0.5 * uViewport.zw\n\n // prevent division by W by transforming the tangent formula (div by 0 causes\n // the line to disappear, see https://github.com/processing/processing/issues/5183)\n // t = screen_q - screen_p\n //\n // tangent is normalized and we don't care which aDirection it points to (+-)\n // t = +- normalize( screen_q - screen_p )\n // t = +- normalize( (q.xy/q.w+<1,1>)*0.5*uViewport.zw - (p.xy/p.w+<1,1>)*0.5*uViewport.zw )\n //\n // extract common factor, <1,1> - <1,1> cancels out\n // t = +- normalize( (q.xy/q.w - p.xy/p.w) * 0.5 * uViewport.zw )\n //\n // convert to common divisor\n // t = +- normalize( ((q.xy*p.w - p.xy*q.w) / (p.w*q.w)) * 0.5 * uViewport.zw )\n //\n // remove the common scalar divisor/factor, not needed due to normalize and +-\n // (keep uViewport - can't remove because it has different components for x and y\n // and corrects for aspect ratio, see https://github.com/processing/processing/issues/5181)\n // t = +- normalize( (q.xy*p.w - p.xy*q.w) * uViewport.zw )\n\n vec2 tangentIn = normalize((qIn.xy*p.w - p.xy*qIn.w) * uViewport.zw);\n vec2 tangentOut = normalize((qOut.xy*p.w - p.xy*qOut.w) * uViewport.zw);\n\n vec2 curPerspScale;\n if(uPerspective == 1) {\n // Perspective ---\n // convert from world to clip by multiplying with projection scaling factor\n // to get the right thickness (see https://github.com/processing/processing/issues/5182)\n\n // The y value of the projection matrix may be flipped if rendering to a Framebuffer.\n // Multiplying again by its sign here negates the flip to get just the scale.\n curPerspScale = (uProjectionMatrix * vec4(1, sign(uProjectionMatrix[1][1]), 0, 0)).xy;\n } else {\n // No Perspective ---\n // multiply by W (to cancel out division by W later in the pipeline) and\n // convert from screen to clip (derived from clip to screen above)\n curPerspScale = p.w / (0.5 * uViewport.zw);\n }\n\n vec2 offset;\n if (vJoin == 1. && !uSimpleLines) {\n vTangent = normalize(tangentIn + tangentOut);\n vec2 normalIn = vec2(-tangentIn.y, tangentIn.x);\n vec2 normalOut = vec2(-tangentOut.y, tangentOut.x);\n float side = sign(aSide);\n float sideEnum = abs(aSide);\n\n // We generate vertices for joins on either side of the centerline, but\n // the \"elbow\" side is the only one needing a join. By not setting the\n // offset for the other side, all its vertices will end up in the same\n // spot and not render, effectively discarding it.\n if (sign(dot(tangentOut, vec2(-tangentIn.y, tangentIn.x))) != side) {\n // Side enums:\n // 1: the side going into the join\n // 2: the middle of the join\n // 3: the side going out of the join\n if (sideEnum == 2.) {\n // Calculate the position + tangent on either side of the join, and\n // find where the lines intersect to find the elbow of the join\n vec2 c = (posp.xy/posp.w + vec2(1.,1.)) * 0.5 * uViewport.zw;\n vec2 intersection = lineIntersection(\n c + (side * normalIn * inputs.weight / 2.),\n tangentIn,\n c + (side * normalOut * inputs.weight / 2.),\n tangentOut\n );\n offset = (intersection - c);\n\n // When lines are thick and the angle of the join approaches 180, the\n // elbow might be really far from the center. We'll apply a limit to\n // the magnitude to avoid lines going across the whole screen when this\n // happens.\n float mag = length(offset);\n float maxMag = 3. * inputs.weight;\n if (mag > maxMag) {\n offset *= maxMag / mag;\n }\n } else if (sideEnum == 1.) {\n offset = side * normalIn * inputs.weight / 2.;\n } else if (sideEnum == 3.) {\n offset = side * normalOut * inputs.weight / 2.;\n }\n }\n if (uStrokeJoin == STROKE_JOIN_BEVEL) {\n vec2 avgNormal = vec2(-vTangent.y, vTangent.x);\n vMaxDist = abs(dot(avgNormal, normalIn * inputs.weight / 2.));\n } else {\n vMaxDist = inputs.weight / 2.;\n }\n } else {\n vec2 tangent = aTangentIn == vec3(0.) ? tangentOut : tangentIn;\n vTangent = tangent;\n vec2 normal = vec2(-tangent.y, tangent.x);\n\n float normalOffset = sign(aSide);\n // Caps will have side values of -2 or 2 on the edge of the cap that\n // extends out from the line\n float tangentOffset = abs(aSide) - 1.;\n offset = (normal * normalOffset + tangent * tangentOffset) *\n inputs.weight * 0.5;\n vMaxDist = inputs.weight / 2.;\n }\n\n vCenter = p.xy;\n vPosition = vCenter + offset;\n vColor = inputs.color;\n\n gl_Position.xy = p.xy + offset.xy * curPerspScale;\n gl_Position.zw = p.zw;\n \n HOOK_afterVertex();\n}\n",lineFrag:ta+"precision highp int;\nprecision highp float;\n\nuniform vec4 uMaterialColor;\nuniform int uStrokeCap;\nuniform int uStrokeJoin;\n\nIN vec4 vColor;\nIN vec2 vTangent;\nIN vec2 vCenter;\nIN vec2 vPosition;\nIN float vStrokeWeight;\nIN float vMaxDist;\nIN float vCap;\nIN float vJoin;\n\nfloat distSquared(vec2 a, vec2 b) {\n vec2 aToB = b - a;\n return dot(aToB, aToB);\n}\n\nstruct Inputs {\n vec4 color;\n vec2 tangent;\n vec2 center;\n vec2 position;\n float strokeWeight;\n};\n\nvoid main() {\n HOOK_beforeFragment();\n\n Inputs inputs;\n inputs.color = vColor;\n inputs.tangent = vTangent;\n inputs.center = vCenter;\n inputs.position = vPosition;\n inputs.strokeWeight = vStrokeWeight;\n inputs = HOOK_getPixelInputs(inputs);\n\n if (vCap > 0.) {\n if (\n uStrokeCap == STROKE_CAP_ROUND &&\n HOOK_shouldDiscard(distSquared(inputs.position, inputs.center) > inputs.strokeWeight * inputs.strokeWeight * 0.25)\n ) {\n discard;\n } else if (\n uStrokeCap == STROKE_CAP_SQUARE &&\n HOOK_shouldDiscard(dot(inputs.position - inputs.center, inputs.tangent) > 0.)\n ) {\n discard;\n // Use full area for PROJECT\n } else if (HOOK_shouldDiscard(false)) {\n discard;\n }\n } else if (vJoin > 0.) {\n if (\n uStrokeJoin == STROKE_JOIN_ROUND &&\n HOOK_shouldDiscard(distSquared(inputs.position, inputs.center) > inputs.strokeWeight * inputs.strokeWeight * 0.25)\n ) {\n discard;\n } else if (uStrokeJoin == STROKE_JOIN_BEVEL) {\n vec2 normal = vec2(-inputs.tangent.y, inputs.tangent.x);\n if (HOOK_shouldDiscard(abs(dot(inputs.position - inputs.center, normal)) > vMaxDist)) {\n discard;\n }\n // Use full area for MITER\n } else if (HOOK_shouldDiscard(false)) {\n discard;\n }\n }\n OUT_COLOR = HOOK_getFinalColor(vec4(inputs.color.rgb, 1.) * inputs.color.a);\n HOOK_afterFragment();\n}\n",pointVert:"IN vec3 aPosition;\nuniform float uPointSize;\nOUT float vStrokeWeight;\nuniform mat4 uModelViewMatrix;\nuniform mat4 uProjectionMatrix;\n\nvoid main() {\n HOOK_beforeVertex();\n vec4 viewModelPosition = vec4(HOOK_getWorldPosition(\n (uModelViewMatrix * vec4(HOOK_getLocalPosition(aPosition), 1.0)).xyz\n ), 1.);\n gl_Position = uProjectionMatrix * viewModelPosition; \n\n float pointSize = HOOK_getPointSize(uPointSize);\n\n\tgl_PointSize = pointSize;\n\tvStrokeWeight = pointSize;\n HOOK_afterVertex();\n}\n",pointFrag:"precision mediump int;\nuniform vec4 uMaterialColor;\nIN float vStrokeWeight;\n\nvoid main(){\n HOOK_beforeFragment();\n float mask = 0.0;\n\n // make a circular mask using the gl_PointCoord (goes from 0 - 1 on a point)\n // might be able to get a nicer edge on big strokeweights with smoothstep but slightly less performant\n\n mask = step(0.98, length(gl_PointCoord * 2.0 - 1.0));\n\n // if strokeWeight is 1 or less lets just draw a square\n // this prevents weird artifacting from carving circles when our points are really small\n // if strokeWeight is larger than 1, we just use it as is\n\n mask = mix(0.0, mask, clamp(floor(vStrokeWeight - 0.5),0.0,1.0));\n\n // throw away the borders of the mask\n // otherwise we get weird alpha blending issues\n\n if(HOOK_shouldDiscard(mask > 0.98)){\n discard;\n }\n\n OUT_COLOR = HOOK_getFinalColor(vec4(uMaterialColor.rgb, 1.) * uMaterialColor.a);\n HOOK_afterFragment();\n}\n",imageLightVert:"precision highp float;\nattribute vec3 aPosition;\nattribute vec3 aNormal;\nattribute vec2 aTexCoord;\n\nvarying vec3 localPos;\nvarying vec3 vWorldNormal;\nvarying vec3 vWorldPosition;\nvarying vec2 vTexCoord;\n\nuniform mat4 uModelViewMatrix;\nuniform mat4 uProjectionMatrix;\nuniform mat3 uNormalMatrix;\n\nvoid main() {\n // Multiply the position by the matrix.\n vec4 viewModelPosition = uModelViewMatrix * vec4(aPosition, 1.0);\n gl_Position = uProjectionMatrix * viewModelPosition; \n \n // orient the normals and pass to the fragment shader\n vWorldNormal = uNormalMatrix * aNormal;\n \n // send the view position to the fragment shader\n vWorldPosition = (uModelViewMatrix * vec4(aPosition, 1.0)).xyz;\n \n localPos = vWorldPosition;\n vTexCoord = aTexCoord;\n}\n\n\n/*\nin the vertex shader we'll compute the world position and world oriented normal of the vertices and pass those to the fragment shader as varyings.\n*/\n",imageLightDiffusedFrag:"precision highp float;\nvarying vec3 localPos;\n\n// the HDR cubemap converted (can be from an equirectangular environment map.)\nuniform sampler2D environmentMap;\nvarying vec2 vTexCoord;\n\nconst float PI = 3.14159265359;\n\nvec2 nTOE( vec3 v ){\n // x = r sin(phi) cos(theta) \n // y = r cos(phi) \n // z = r sin(phi) sin(theta)\n float phi = acos( v.y );\n // if phi is 0, then there are no x, z components\n float theta = 0.0;\n // else \n theta = acos(v.x / sin(phi));\n float sinTheta = v.z / sin(phi);\n if (sinTheta < 0.0) {\n // Turn it into -theta, but in the 0-2PI range\n theta = 2.0 * PI - theta;\n }\n theta = theta / (2.0 * 3.14159);\n phi = phi / 3.14159 ;\n \n vec2 angles = vec2( phi, theta );\n return angles;\n}\n\nfloat random(vec2 p) {\n vec3 p3 = fract(vec3(p.xyx) * .1031);\n p3 += dot(p3, p3.yzx + 33.33);\n return fract((p3.x + p3.y) * p3.z);\n}\n\nvoid main()\n{ \t \n\t// the sample direction equals the hemisphere's orientation\n float phi = vTexCoord.x * 2.0 * PI;\n float theta = vTexCoord.y * PI;\n float x = sin(theta) * cos(phi);\n float y = sin(theta) * sin(phi);\n float z = cos(theta);\n vec3 normal = vec3( x, y, z);\n\n\t// Discretely sampling the hemisphere given the integral's\n // spherical coordinates translates to the following fragment code:\n\tvec3 irradiance = vec3(0.0); \n\tvec3 up\t= vec3(0.0, 1.0, 0.0);\n\tvec3 right = normalize(cross(up, normal));\n\tup = normalize(cross(normal, right));\n\n\t// We specify a fixed sampleDelta delta value to traverse\n // the hemisphere; decreasing or increasing the sample delta\n // will increase or decrease the accuracy respectively.\n\tconst float sampleDelta = 0.100;\n\tfloat nrSamples = 0.0;\n float randomOffset = random(gl_FragCoord.xy) * sampleDelta;\n\tfor(float rawPhi = 0.0; rawPhi < 2.0 * PI; rawPhi += sampleDelta)\n\t{\n float phi = rawPhi + randomOffset;\n for(float rawTheta = 0.0; rawTheta < ( 0.5 ) * PI; rawTheta += sampleDelta)\n {\n float theta = rawTheta + randomOffset;\n // spherical to cartesian (in tangent space) // tangent space to world // add each sample result to irradiance\n float x = sin(theta) * cos(phi);\n float y = sin(theta) * sin(phi);\n float z = cos(theta);\n vec3 tangentSample = vec3( x, y, z);\n \n vec3 sampleVec = tangentSample.x * right + tangentSample.y * up + tangentSample.z * normal;\n irradiance += (texture2D(environmentMap, nTOE(sampleVec)).xyz) * cos(theta) * sin(theta);\n nrSamples++;\n }\n\t}\n\t// divide by the total number of samples taken, giving us the average sampled irradiance.\n\tirradiance = PI * irradiance * (1.0 / float(nrSamples )) ;\n \n \n\tgl_FragColor = vec4(irradiance, 1.0);\n}",imageLightSpecularFrag:"precision highp float;\r\nvarying vec3 localPos;\r\nvarying vec2 vTexCoord;\r\n\r\n// our texture\r\nuniform sampler2D environmentMap;\r\nuniform float roughness;\r\n\r\nconst float PI = 3.14159265359;\r\n\r\nfloat VanDerCorput(int bits);\r\nvec2 HammersleyNoBitOps(int i, int N);\r\nvec3 ImportanceSampleGGX(vec2 Xi, vec3 N, float roughness);\r\n\r\n\r\nvec2 nTOE( vec3 v ){\r\n // x = r sin(phi) cos(theta) \r\n // y = r cos(phi) \r\n // z = r sin(phi) sin(theta)\r\n float phi = acos( v.y );\r\n // if phi is 0, then there are no x, z components\r\n float theta = 0.0;\r\n // else \r\n theta = acos(v.x / sin(phi));\r\n float sinTheta = v.z / sin(phi);\r\n if (sinTheta < 0.0) {\r\n // Turn it into -theta, but in the 0-2PI range\r\n theta = 2.0 * PI - theta;\r\n }\r\n theta = theta / (2.0 * 3.14159);\r\n phi = phi / 3.14159 ;\r\n \r\n vec2 angles = vec2( phi, theta );\r\n return angles;\r\n}\r\n\r\n\r\nvoid main(){\r\n const int SAMPLE_COUNT = 400; // 4096\r\n int lowRoughnessLimit = int(pow(2.0,(roughness+0.1)*20.0));\r\n float totalWeight = 0.0;\r\n vec3 prefilteredColor = vec3(0.0);\r\n float phi = vTexCoord.x * 2.0 * PI;\r\n float theta = vTexCoord.y * PI;\r\n float x = sin(theta) * cos(phi);\r\n float y = sin(theta) * sin(phi);\r\n float z = cos(theta);\r\n vec3 N = vec3(x,y,z);\r\n vec3 V = N;\r\n for (int i = 0; i < SAMPLE_COUNT; ++i)\r\n {\r\n // break at smaller sample numbers for low roughness levels\r\n if(i == lowRoughnessLimit)\r\n {\r\n break;\r\n }\r\n vec2 Xi = HammersleyNoBitOps(i, SAMPLE_COUNT);\r\n vec3 H = ImportanceSampleGGX(Xi, N, roughness);\r\n vec3 L = normalize(2.0 * dot(V, H) * H - V);\r\n\r\n float NdotL = max(dot(N, L), 0.0);\r\n if (NdotL > 0.0)\r\n {\r\n prefilteredColor += texture2D(environmentMap, nTOE(L)).xyz * NdotL;\r\n totalWeight += NdotL;\r\n }\r\n }\r\n prefilteredColor = prefilteredColor / totalWeight;\r\n\r\n gl_FragColor = vec4(prefilteredColor, 1.0);\r\n}\r\n\r\nvec3 ImportanceSampleGGX(vec2 Xi, vec3 N, float roughness){\r\n float a = roughness * roughness;\r\n\r\n float phi = 2.0 * PI * Xi.x;\r\n float cosTheta = sqrt((1.0 - Xi.y) / (1.0 + (a * a - 1.0) * Xi.y));\r\n float sinTheta = sqrt(1.0 - cosTheta * cosTheta);\r\n // from spherical coordinates to cartesian coordinates\r\n vec3 H;\r\n H.x = cos(phi) * sinTheta;\r\n H.y = sin(phi) * sinTheta;\r\n H.z = cosTheta;\r\n\r\n // from tangent-space vector to world-space sample vector\r\n vec3 up = abs(N.z) < 0.999 ? vec3(0.0, 0.0, 1.0) : vec3(1.0, 0.0, 0.0);\r\n vec3 tangent = normalize(cross(up, N));\r\n vec3 bitangent = cross(N, tangent);\r\n\r\n vec3 sampleVec = tangent * H.x + bitangent * H.y + N * H.z;\r\n return normalize(sampleVec);\r\n}\r\n\r\n\r\nfloat VanDerCorput(int n, int base)\r\n{\r\n#ifdef WEBGL2\r\n\r\n uint bits = uint(n);\r\n bits = (bits << 16u) | (bits >> 16u);\r\n bits = ((bits & 0x55555555u) << 1u) | ((bits & 0xAAAAAAAAu) >> 1u);\r\n bits = ((bits & 0x33333333u) << 2u) | ((bits & 0xCCCCCCCCu) >> 2u);\r\n bits = ((bits & 0x0F0F0F0Fu) << 4u) | ((bits & 0xF0F0F0F0u) >> 4u);\r\n bits = ((bits & 0x00FF00FFu) << 8u) | ((bits & 0xFF00FF00u) >> 8u);\r\n return float(bits) * 2.3283064365386963e-10; // / 0x100000000\r\n\r\n#else\r\n\r\n float invBase = 1.0 / float(base);\r\n float denom = 1.0;\r\n float result = 0.0;\r\n\r\n\r\n for (int i = 0; i < 32; ++i)\r\n {\r\n if (n > 0)\r\n {\r\n denom = mod(float(n), 2.0);\r\n result += denom * invBase;\r\n invBase = invBase / 2.0;\r\n n = int(float(n) / 2.0);\r\n }\r\n }\r\n\r\n\r\n return result;\r\n\r\n#endif\r\n}\r\n\r\nvec2 HammersleyNoBitOps(int i, int N)\r\n{\r\n return vec2(float(i) / float(N), VanDerCorput(i, 2));\r\n}\r\n",filterBaseVert:Us,filterBaseFrag:js};let sa=na.sphereMappingFrag;for(const e in na)na[e]=Gs+na[e];const aa={[ae]:$s,[ce]:qs,[le]:Hs,[pe]:Ws,[ue]:Xs,[oe]:Ys,[he]:Zs,[se]:Ks};class oa extends En{constructor(e,t,i,r,n,a){super(e,t,i,r),this.canvas=this.elt=n||document.createElement("canvas"),this._setAttributeDefaults(e),this._initContext(),this.GL=this.drawingContext,this._isMainCanvas?(this._pInst._curElement=this,this._pInst.canvas=this.canvas):this.canvas.style.display="none",this.elt.id="defaultCanvas0",this.elt.classList.add("p5Canvas"),this.wrappedElt=new kr(this.elt,this._pInst);for(const e of Object.getOwnPropertyNames(kr.prototype))"constructor"!==e&&"_"!==e[0]&&Object.defineProperty(this,e,{get(){return this.wrappedElt[e]}});const o=this._adjustDimensions(t,i);if(t=o.adjustedWidth,i=o.adjustedHeight,this.width=t,this.height=i,this.elt.width=t*this._pixelDensity,this.elt.height=i*this._pixelDensity,this.elt.style.width=`${t}px`,this.elt.style.height=`${i}px`,this._origViewport={width:this.GL.drawingBufferWidth,height:this.GL.drawingBufferHeight},this.viewport(this._origViewport.width,this._origViewport.height),this._pInst._userNode)this._pInst._userNode.appendChild(this.elt);else{if(0===document.getElementsByTagName("main").length){let e=document.createElement("main");document.body.appendChild(e)}document.getElementsByTagName("main")[0].appendChild(this.elt)}this.isP3D=!0,this.geometryBuilder=void 0,this.states.uModelMatrix=new xs(4),this.states.uViewMatrix=new xs(4),this.states.uPMatrix=new xs(4),this.states.curCamera=new Ss(this),this.states.uPMatrix.set(this.states.curCamera.projMatrix),this.states.uViewMatrix.set(this.states.curCamera.cameraMatrix),this.states.enableLighting=!1,this.states.ambientLightColors=[],this.states.specularColors=[1,1,1],this.states.directionalLightDirections=[],this.states.directionalLightDiffuseColors=[],this.states.directionalLightSpecularColors=[],this.states.pointLightPositions=[],this.states.pointLightDiffuseColors=[],this.states.pointLightSpecularColors=[],this.states.spotLightPositions=[],this.states.spotLightDirections=[],this.states.spotLightDiffuseColors=[],this.states.spotLightSpecularColors=[],this.states.spotLightAngle=[],this.states.spotLightConc=[],this.states.activeImageLight=null,this.states.curFillColor=[1,1,1,1],this.states.curAmbientColor=[1,1,1,1],this.states.curSpecularColor=[0,0,0,0],this.states.curEmissiveColor=[0,0,0,0],this.states.curStrokeColor=[0,0,0,1],this.states.curBlendMode=j,this.states._hasSetAmbient=!1,this.states._useSpecularMaterial=!1,this.states._useEmissiveMaterial=!1,this.states._useNormalMaterial=!1,this.states._useShininess=1,this.states._useMetalness=0,this.states.tint=[255,255,255,255],this.states.constantAttenuation=1,this.states.linearAttenuation=0,this.states.quadraticAttenuation=0,this.states._currentNormal=new Zr(0,0,1),this.states.drawMode=me,this.states._tex=null,this.states.textureMode=xe,this.states.textureWrapX=_e,this.states.textureWrapY=_e,this._isErasing=!1,this._simpleLines=!1,this._clipDepths=[],this._isClipApplied=!1,this._stencilTestOn=!1,this.mixedAmbientLight=[],this.mixedSpecularColor=[],this.diffusedTextures=new Map,this.specularTextures=new Map,this.preEraseBlend=void 0,this._cachedBlendMode=void 0,this._cachedFillStyle=[1,1,1,1],this._cachedStrokeStyle=[0,0,0,1],this.webglVersion===s?this.blendExt=this.GL:this.blendExt=this.GL.getExtension("EXT_blend_minmax"),this._isBlending=!1,this._useLineColor=!1,this._useVertexColor=!1,this.registerEnabled=new Set,this.states.curCamera._computeCameraDefaultSettings(),this.states.curCamera._setDefaultCamera(),this.filterCamera=new Ss(this),this.filterCamera._computeCameraDefaultSettings(),this.filterCamera._setDefaultCamera(),this.prevTouches=[],this.zoomVelocity=0,this.rotateVelocity=new Zr(0,0),this.moveVelocity=new Zr(0,0),this.executeZoom=!1,this.executeRotateAndMove=!1,this._drawingFilter=!1,this._drawingImage=!1,this.specularShader=void 0,this.sphereMapping=void 0,this.diffusedShader=void 0,this._baseFilterShader=void 0,this._defaultLightShader=void 0,this._defaultImmediateModeShader=void 0,this._defaultNormalShader=void 0,this._defaultColorShader=void 0,this._defaultPointShader=void 0,this.states.userFillShader=void 0,this.states.userStrokeShader=void 0,this.states.userPointShader=void 0,this.states.userImageShader=void 0,this.states.curveDetail=1/4,this.shapeBuilder=new Ns(this),this.buffers={fill:[new Ts(3,"vertices","vertexBuffer","aPosition",this,this._vToNArray),new Ts(3,"vertexNormals","normalBuffer","aNormal",this,this._vToNArray),new Ts(4,"vertexColors","colorBuffer","aVertexColor",this),new Ts(3,"vertexAmbients","ambientBuffer","aAmbientColor",this),new Ts(2,"uvs","uvBuffer","aTexCoord",this,(e=>e.flat()))],stroke:[new Ts(4,"lineVertexColors","lineColorBuffer","aVertexColor",this),new Ts(3,"lineVertices","lineVerticesBuffer","aPosition",this),new Ts(3,"lineTangentsIn","lineTangentsInBuffer","aTangentIn",this),new Ts(3,"lineTangentsOut","lineTangentsOutBuffer","aTangentOut",this),new Ts(1,"lineSides","lineSidesBuffer","aSide",this)],text:[new Ts(3,"vertices","vertexBuffer","aPosition",this,this._vToNArray),new Ts(2,"uvs","uvBuffer","aTexCoord",this,(e=>e.flat()))],point:this.GL.createBuffer(),user:[]},this.geometryBufferCache=new Rs(this),this.curStrokeCap=V,this.curStrokeJoin=V,this.textures=new Map,this.framebuffers=new Set,this.activeFramebuffers=[],this.states.filterShader=void 0,this.filterLayer=void 0,this.filterLayerTemp=void 0,this.defaultFilterShaders={},this.fontInfos={},this._curShader=void 0,this.drawShapeCount=1,this.scratchMat3=new xs(3),this._userEnabledStencil=!1,this._internalEnable=this.drawingContext.enable,this._internalDisable=this.drawingContext.disable,this.drawingContext.enable=e=>(e===this.drawingContext.STENCIL_TEST&&(this._clipping||(this._userEnabledStencil=!0)),this._internalEnable.call(this.drawingContext,e)),this.drawingContext.disable=e=>(e===this.drawingContext.STENCIL_TEST&&(this._userEnabledStencil=!1),this._internalDisable.call(this.drawingContext,e)),this._validateFaces=!1}remove(){this.wrappedElt.remove(),this.wrappedElt=null,this.canvas=null,this.elt=null}beginGeometry(){if(this.geometryBuilder)throw new Error("It looks like `beginGeometry()` is being called while another p5.Geometry is already being build.");this.geometryBuilder=new As(this),this.geometryBuilder.prevFillColor=this.states.fillColor,this.fill(new dr([-1,-1,-1,-1]))}endGeometry(){if(!this.geometryBuilder)throw new Error("Make sure you call beginGeometry() before endGeometry()!");const e=this.geometryBuilder.finish();return this.geometryBuilder.prevFillColor?this.fill(this.geometryBuilder.prevFillColor):this.noFill(),this.geometryBuilder=void 0,e}buildGeometry(e){return this.beginGeometry(),e(),this.endGeometry()}beginShape(...e){super.beginShape(...e)}curveDetail(e){if(void 0===e)return this.states.curveDetail;this.states.setValue("curveDetail",e)}drawShape(e){const t=new bn({curveDetail:this.states.curveDetail});e.accept(t),this.shapeBuilder.constructFromContours(e,t.contours),this.geometryBuilder?this.geometryBuilder.addImmediate(this.shapeBuilder.geometry,this.shapeBuilder.shapeMode,{validateFaces:this._validateFaces}):(this.states.fillColor||this.states.strokeColor)&&(this.shapeBuilder.shapeMode===T?this._drawPoints(this.shapeBuilder.geometry.vertices,this.buffers.point):this._drawGeometry(this.shapeBuilder.geometry,{mode:this.shapeBuilder.shapeMode,count:this.drawShapeCount})),this.drawShapeCount=1}endShape(e,t){this.drawShapeCount=t,super.endShape(e,t)}vertexProperty(...e){this.currentShape.vertexProperty(...e)}normal(e,t,i){e instanceof Zr?this.states.setValue("_currentNormal",e):this.states.setValue("_currentNormal",new Zr(e,t,i)),this.updateShapeVertexProperties()}model(e,t=1){e.vertices.length>0&&(this.geometryBuilder?this.geometryBuilder.addRetained(e):(this.geometryInHash(e.gid)||(e._edgesToVertices(),this._getOrMakeCachedBuffers(e)),this._drawGeometry(e,{count:t})))}_drawGeometry(e,{mode:t=4,count:i=1}={}){for(const t in e.userVertexProperties){const i=e.userVertexProperties[t];this.buffers.user.push(new Ts(i.getDataSize(),i.getSrcName(),i.getDstName(),i.getName(),this))}this.states.fillColor&&e.vertices.length>=3&&![M,T].includes(t)&&this._drawFills(e,{mode:t,count:i}),this.states.strokeColor&&e.lineVertices.length>=1&&this._drawStrokes(e,{count:i}),this.buffers.user=[]}_drawGeometryScaled(e,t,i,r){let n=this.states.uModelMatrix;this.states.setValue("uModelMatrix",this.states.uModelMatrix.clone());try{this.states.uModelMatrix.scale(t,i,r),this.geometryBuilder?this.geometryBuilder.addRetained(e):this._drawGeometry(e)}finally{this.states.setValue("uModelMatrix",n)}}_drawFills(e,{count:t,mode:i}={}){this._useVertexColor=e.vertexColors.length>0;const r=!this._drawingFilter&&this.states.userFillShader?this.states.userFillShader:this._getFillShader();r.bindShader(),this._setGlobalUniforms(r),this._setFillUniforms(r),r.bindTextures();for(const t of this.buffers.fill)t._prepareBuffer(e,r);this._prepareUserAttributes(e,r),r.disableRemainingAttributes(),this._applyColorBlend(this.states.curFillColor,e.hasFillTransparency()),this._drawBuffers(e,{mode:i,count:t}),r.unbindShader()}_drawStrokes(e,{count:t}={}){const i=this.GL;this._useLineColor=e.vertexStrokeColors.length>0;const r=this._getStrokeShader();r.bindShader(),this._setGlobalUniforms(r),this._setStrokeUniforms(r),r.bindTextures();for(const t of this.buffers.stroke)t._prepareBuffer(e,r);if(this._prepareUserAttributes(e,r),r.disableRemainingAttributes(),this._applyColorBlend(this.states.curStrokeColor,e.hasStrokeTransparency()),1===t)i.drawArrays(i.TRIANGLES,0,e.lineVertices.length/3);else try{i.drawArraysInstanced(i.TRIANGLES,0,e.lineVertices.length/3,t)}catch(e){console.log("🌸 p5.js says: Instancing is only supported in WebGL2 mode")}r.unbindShader()}_drawPoints(e,t){const i=this.GL,r=this._getPointShader();r.bindShader(),this._setGlobalUniforms(r),this._setPointUniforms(r),r.bindTextures(),this._bindBuffer(t,i.ARRAY_BUFFER,this._vToNArray(e),Float32Array,i.STATIC_DRAW),r.enableAttrib(r.attributes.aPosition,3),this._applyColorBlend(this.states.curStrokeColor),i.drawArrays(i.Points,0,e.length),r.unbindShader()}_prepareUserAttributes(e,t){for(const i of this.buffers.user){if(!this._pInst.constructor.disableFriendlyErrors){const t=e.userVertexProperties[i.attr];if(t){const i=t.getSrcArray().length/t.getDataSize();i>e.vertices.length?this._pInst.constructor._friendlyError(`One of the geometries has a custom vertex property '${t.getName()}' with more values than vertices. This is probably caused by directly using the Geometry.vertexProperty() method.`,"vertexProperty()"):i<e.vertices.length&&this._pInst.constructor._friendlyError(`One of the geometries has a custom vertex property '${t.getName()}' with fewer values than vertices. This is probably caused by directly using the Geometry.vertexProperty() method.`,"vertexProperty()")}}i._prepareBuffer(e,t)}}_drawBuffers(e,{mode:t=this.GL.TRIANGLES,count:i}){const r=this.GL,n=this.geometryBufferCache.getCached(e);if(n)if(n.indexBuffer){if(this._bindBuffer(n.indexBuffer,r.ELEMENT_ARRAY_BUFFER),this._pInst.webglVersion!==s&&n.indexBufferType===r.UNSIGNED_INT&&!r.getExtension("OES_element_index_uint"))throw new Error("Unable to render a 3d model with > 65535 triangles. Your web browser does not support the WebGL Extension OES_element_index_uint.");if(1===i)r.drawElements(r.TRIANGLES,3*e.faces.length,n.indexBufferType,0);else try{r.drawElementsInstanced(r.TRIANGLES,3*e.faces.length,n.indexBufferType,0,i)}catch(e){console.log("🌸 p5.js says: Instancing is only supported in WebGL2 mode")}}else if(1===i)r.drawArrays(t,0,e.vertices.length);else try{r.drawArraysInstanced(t,0,e.vertices.length,i)}catch(e){console.log("🌸 p5.js says: Instancing is only supported in WebGL2 mode")}}_getOrMakeCachedBuffers(e){return this.geometryBufferCache.ensureCached(e)}_setAttributeDefaults(e){const t={alpha:!0,depth:!0,stencil:!0,antialias:navigator.userAgent.toLowerCase().includes("safari"),premultipliedAlpha:!0,preserveDrawingBuffer:!0,perPixelLighting:!0,version:2};null===e._glAttributes?e._glAttributes=t:e._glAttributes=Object.assign(t,e._glAttributes)}_initContext(){if(1!==this._pInst._glAttributes?.version&&(this.drawingContext=this.canvas.getContext("webgl2",this._pInst._glAttributes)),this.webglVersion=this.drawingContext?s:n,this._pInst.webglVersion=this.webglVersion,this.drawingContext||(this.drawingContext=this.canvas.getContext("webgl",this._pInst._glAttributes)||this.canvas.getContext("experimental-webgl",this._pInst._glAttributes)),null===this.drawingContext)throw new Error("Error creating webgl context");{const e=this.drawingContext;e.enable(e.DEPTH_TEST),e.depthFunc(e.LEQUAL),e.viewport(0,0,e.drawingBufferWidth,e.drawingBufferHeight),e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!0),this._viewport=this.drawingContext.getParameter(this.drawingContext.VIEWPORT)}}_getMaxTextureSize(){const e=this.drawingContext;return e.getParameter(e.MAX_TEXTURE_SIZE)}_adjustDimensions(e,t){this._maxTextureSize||(this._maxTextureSize=this._getMaxTextureSize());let i=this._maxTextureSize,r=Math.floor(i/this._pixelDensity),n=Math.min(e,r),s=Math.min(t,r);return n===e&&s===t||console.warn(`Warning: The requested width/height exceeds hardware limits. Adjusting dimensions to width: ${n}, height: ${s}.`),{adjustedWidth:n,adjustedHeight:s}}_resetContext(e,t){const i=this.width,r=this.height,n=this.canvas.id,s=this._pInst instanceof ga,a={position:this.canvas.style.position,top:this.canvas.style.top,left:this.canvas.style.left};if(s){const e=this._pInst;e.canvas.parentNode.removeChild(e.canvas),e.canvas=document.createElement("canvas");(e._pInst._userNode||document.body).appendChild(e.canvas),kr.call(e,e.canvas,e._pInst),e.width=i,e.height=r}else{let e=this.canvas;e&&e.parentNode.removeChild(e),e=document.createElement("canvas"),e.id=n,this._pInst._userNode?this._pInst._userNode.appendChild(e):document.body.appendChild(e),this._pInst.canvas=e,this.canvas=e,this.canvas.style.position=a.position,this.canvas.style.top=a.top,this.canvas.style.left=a.left}const o=new oa(this._pInst,i,r,!s,this._pInst.canvas);this._pInst._renderer=o,o._applyDefaults(),"function"==typeof t&&setTimeout((()=>{t.apply(window._renderer,e)}),0)}_update(){this.states.setValue("uModelMatrix",this.states.uModelMatrix.clone()),this.states.uModelMatrix.reset(),this.states.setValue("uViewMatrix",this.states.uViewMatrix.clone()),this.states.uViewMatrix.set(this.states.curCamera.cameraMatrix),this.states.setValue("ambientLightColors",[]),this.states.setValue("specularColors",[1,1,1]),this.states.setValue("directionalLightDirections",[]),this.states.setValue("directionalLightDiffuseColors",[]),this.states.setValue("directionalLightSpecularColors",[]),this.states.setValue("pointLightPositions",[]),this.states.setValue("pointLightDiffuseColors",[]),this.states.setValue("pointLightSpecularColors",[]),this.states.setValue("spotLightPositions",[]),this.states.setValue("spotLightDirections",[]),this.states.setValue("spotLightDiffuseColors",[]),this.states.setValue("spotLightSpecularColors",[]),this.states.setValue("spotLightAngle",[]),this.states.setValue("spotLightConc",[]),this.states.setValue("enableLighting",!1),this.states.setValue("tint",[255,255,255,255]),this.GL.clearStencil(0),this.GL.clear(this.GL.DEPTH_BUFFER_BIT|this.GL.STENCIL_BUFFER_BIT),this._userEnabledStencil||this._internalDisable.call(this.GL,this.GL.STENCIL_TEST)}background(...e){const t=this._pInst.color(...e);this.clear(...t._getRGBA())}get uModelMatrix(){return this.states.uModelMatrix}get uViewMatrix(){return this.states.uViewMatrix}get uPMatrix(){return this.states.uPMatrix}get uMVMatrix(){const e=this.uModelMatrix.copy();return e.mult(this.uViewMatrix),e}getWorldToScreenMatrix(){const e=this.states.uModelMatrix,t=this.states.uViewMatrix,i=this.states.uPMatrix,r=new xs(4);r.scale(this.width,this.height,1),r.translate([.5,.5,.5]),r.scale(.5,-.5,.5);return e.copy().mult(t).mult(i).mult(r)}fill(...e){super.fill(...e);const t=this.states.fillColor;this.states.setValue("curFillColor",t._array),this.states.setValue("drawMode",me),this.states.setValue("_useNormalMaterial",!1),this.states.setValue("_tex",null)}stroke(...e){super.stroke(...e),this.states.setValue("curStrokeColor",this.states.strokeColor._array)}getCommonVertexProperties(){return{...super.getCommonVertexProperties(),stroke:this.states.strokeColor,fill:this.states.fillColor,normal:this.states._currentNormal}}getSupportedIndividualVertexProperties(){return{textureCoordinates:!0}}strokeCap(e){this.curStrokeCap=e}strokeJoin(e){this.curStrokeJoin=e}getFilterLayer(){return this.filterLayer||(this.filterLayer=new Ca(this)),this.filterLayer}getFilterLayerTemp(){return this.filterLayerTemp||(this.filterLayerTemp=new Ca(this)),this.filterLayerTemp}matchSize(e,t){e.width===t.width&&e.height===t.height||e.resize(t.width,t.height),e.pixelDensity()!==t.pixelDensity()&&e.pixelDensity(t.pixelDensity())}filter(...e){let t,i,r=this.getFilterLayer();if("string"==typeof e[0]){i=e[0];let n=i in Vs&&void 0===e[1];t=n?Vs[i]:e[1],i in this.defaultFilterShaders||(this.defaultFilterShaders[i]=new ks(r.renderer,Js,aa[i])),this.states.setValue("filterShader",this.defaultFilterShaders[i])}else this.states.setValue("filterShader",e[0]);const n=this.activeFramebuffer()||this;this.matchSize(r,n),r.draw((()=>this.clear()));let s=[1/(n.width*n.pixelDensity()),1/(n.height*n.pixelDensity())];if(i===pe){const e=this.getFilterLayerTemp();this.matchSize(e,n),this.push(),this.states.setValue("strokeColor",null),this.blendMode(j),this.shader(this.states.filterShader),this.states.filterShader.setUniform("texelSize",s),this.states.filterShader.setUniform("canvasSize",[n.width,n.height]),this.states.filterShader.setUniform("radius",Math.max(1,t)),e.draw((()=>{this.states.filterShader.setUniform("direction",[1,0]),this.states.filterShader.setUniform("tex0",n),this.clear(),this.shader(this.states.filterShader),this.noLights(),this.plane(n.width,n.height)})),r.draw((()=>{this.states.filterShader.setUniform("direction",[0,1]),this.states.filterShader.setUniform("tex0",e),this.clear(),this.shader(this.states.filterShader),this.noLights(),this.plane(n.width,n.height)})),this.pop()}else r.draw((()=>{this.states.setValue("strokeColor",null),this.blendMode(j),this.shader(this.states.filterShader),this.states.filterShader.setUniform("tex0",n),this.states.filterShader.setUniform("texelSize",s),this.states.filterShader.setUniform("canvasSize",[n.width,n.height]),this.states.filterShader.setUniform("filterParameter",t),this.noLights(),this.plane(n.width,n.height)}));this.push(),this.states.setValue("strokeColor",null),this.clear(),this.push(),this.states.setValue("imageMode",_),this.blendMode(j),n.filterCamera._resize(),this.setCamera(n.filterCamera),this.resetMatrix(),this._drawingFilter=!0,this.image(r,0,0,r.width,r.height,-n.width/2,-n.height/2,n.width,n.height),this._drawingFilter=!1,this.clearDepth(),this.pop(),this.pop()}pixelDensity(e){return e?this._pInst.pixelDensity(e):this._pInst.pixelDensity()}blendMode(e){e===H||e===W||e===q||e===j||e===Y||e===J||e===Z||e===Q||e===K||e===$?this.states.setValue("curBlendMode",e):e!==ne&&e!==ee&&e!==te&&e!==ie&&e!==re||console.warn("BURN, OVERLAY, HARD_LIGHT, SOFT_LIGHT, and DODGE only work for blendMode in 2D mode.")}erase(e,t){this._isErasing||(this.preEraseBlend=this.states.curBlendMode,this._isErasing=!0,this.blendMode($),this._cachedFillStyle=this.states.curFillColor.slice(),this.states.setValue("curFillColor",[1,1,1,e/255]),this._cachedStrokeStyle=this.states.curStrokeColor.slice(),this.states.setValue("curStrokeColor",[1,1,1,t/255]))}noErase(){this._isErasing&&(this.states.setValue("curFillColor",this._cachedFillStyle.slice()),this.states.setValue("curStrokeColor",this._cachedStrokeStyle.slice()),this.states.setValue("curBlendMode",this.preEraseBlend),this.blendMode(this.preEraseBlend),this._isErasing=!1,this._applyBlendMode())}drawTarget(){return this.activeFramebuffers[this.activeFramebuffers.length-1]||this}beginClip(e={}){super.beginClip(e),this.drawTarget()._isClipApplied=!0;const t=this.GL;t.clearStencil(0),t.clear(t.STENCIL_BUFFER_BIT),this._internalEnable.call(t,t.STENCIL_TEST),this._stencilTestOn=!0,t.stencilFunc(t.ALWAYS,1,255),t.stencilOp(t.KEEP,t.KEEP,t.REPLACE),t.disable(t.DEPTH_TEST),this.push(),this.resetShader(),this.states.fillColor&&this.fill(0,0),this.states.strokeColor&&this.stroke(0,0)}endClip(){this.pop();const e=this.GL;e.stencilOp(e.KEEP,e.KEEP,e.KEEP),e.stencilFunc(this._clipInvert?e.EQUAL:e.NOTEQUAL,0,255),e.enable(e.DEPTH_TEST),this._clipDepths.push(this._pushPopDepth),super.endClip()}_clearClip(){this.GL.clearStencil(1),this.GL.clear(this.GL.STENCIL_BUFFER_BIT),this._clipDepths.length>0&&this._clipDepths.pop(),this.drawTarget()._isClipApplied=!1}_getPixel(e,t){const i=this.GL;return la(i,null,e,t,i.RGBA,i.UNSIGNED_BYTE,this._pInst.height*this._pInst.pixelDensity())}loadPixels(){if(!0!==this._pInst._glAttributes.preserveDrawingBuffer)return void console.log("loadPixels only works in WebGL when preserveDrawingBuffer is true.");const e=this._pixelDensity,t=this.GL;this.pixels=ua(this.pixels,t,null,0,0,this.width*e,this.height*e,t.RGBA,t.UNSIGNED_BYTE,this.height*e)}updatePixels(){const e=this._getTempFramebuffer();e.pixels=this.pixels,e.updatePixels(),this.push(),this.resetMatrix(),this.clear(),this.states.setValue("imageMode",_),this.image(e,0,0,e.width,e.height,-e.width/2,-e.height/2,e.width,e.height),this.pop(),this.GL.clearDepth(1),this.GL.clear(this.GL.DEPTH_BUFFER_BIT)}_getTempFramebuffer(){return this._tempFramebuffer||(this._tempFramebuffer=new Ca(this,{format:ke,useDepth:this._pInst._glAttributes.depth,depthFormat:Ie,antialias:this._pInst._glAttributes.antialias})),this._tempFramebuffer}geometryInHash(e){return this.geometryBufferCache.isCached(e)}viewport(e,t){this._viewport=[0,0,e,t],this.GL.viewport(0,0,e,t)}resize(e,t){super.resize(e,t);const i={};for(const e in this.drawingContext){const t=this.drawingContext[e];"object"!=typeof t&&"function"!=typeof t&&(i[e]=t)}const r=this._adjustDimensions(e,t);e=r.adjustedWidth,t=r.adjustedHeight,this.width=e,this.height=t,this.canvas.width=e*this._pixelDensity,this.canvas.height=t*this._pixelDensity,this.canvas.style.width=`${e}px`,this.canvas.style.height=`${t}px`,this._origViewport={width:this.GL.drawingBufferWidth,height:this.GL.drawingBufferHeight},this.viewport(this._origViewport.width,this._origViewport.height),this.states.curCamera._resize(),void 0!==this.pixels&&(this.pixels=new Uint8Array(this.GL.drawingBufferWidth*this.GL.drawingBufferHeight*4));for(const e of this.framebuffers)e._canvasSizeChanged();for(const e in i)try{this.drawingContext[e]=i[e]}catch(e){}}clear(...e){const t=e[0]||0,i=e[1]||0,r=e[2]||0;let n=e[3]||0;const s=this.activeFramebuffer();s&&s.format===ke&&!s.antialias&&0===n&&(n=1e-10),this.GL.clearColor(t*n,i*n,r*n,n),this.GL.clearDepth(1),this.GL.clear(this.GL.COLOR_BUFFER_BIT|this.GL.DEPTH_BUFFER_BIT)}clearDepth(e=1){this.GL.clearDepth(e),this.GL.clear(this.GL.DEPTH_BUFFER_BIT)}applyMatrix(e,t,i,r,n,s){this.states.setValue("uModelMatrix",this.states.uModelMatrix.clone()),16===arguments.length?xs.prototype.apply.apply(this.states.uModelMatrix,arguments):this.states.uModelMatrix.apply([e,t,0,0,i,r,0,0,0,0,1,0,n,s,0,1])}translate(e,t,i){return e instanceof Zr&&(i=e.z,t=e.y,e=e.x),this.states.setValue("uModelMatrix",this.states.uModelMatrix.clone()),this.states.uModelMatrix.translate([e,t,i]),this}scale(e,t,i){return this.states.setValue("uModelMatrix",this.states.uModelMatrix.clone()),this.states.uModelMatrix.scale(e,t,i),this}rotate(e,t){return void 0===t?this.rotateZ(e):(this.states.setValue("uModelMatrix",this.states.uModelMatrix.clone()),xs.prototype.rotate4x4.apply(this.states.uModelMatrix,arguments),this)}rotateX(e){return this.rotate(e,1,0,0),this}rotateY(e){return this.rotate(e,0,1,0),this}rotateZ(e){return this.rotate(e,0,0,1),this}pop(...e){this._clipDepths.length>0&&this._pushPopDepth===this._clipDepths[this._clipDepths.length-1]&&(this._clearClip(),this._userEnabledStencil||this._internalDisable.call(this.GL,this.GL.STENCIL_TEST)),super.pop(...e),this._applyStencilTestIfClipping()}_applyStencilTestIfClipping(){const e=this.drawTarget();e._isClipApplied!==this._stencilTestOn&&(e._isClipApplied?(this._internalEnable.call(this.GL,this.GL.STENCIL_TEST),this._stencilTestOn=!0):(this._userEnabledStencil||this._internalDisable.call(this.GL,this.GL.STENCIL_TEST),this._stencilTestOn=!1))}resetMatrix(){return this.states.setValue("uModelMatrix",this.states.uModelMatrix.clone()),this.states.uModelMatrix.reset(),this.states.setValue("uViewMatrix",this.states.uViewMatrix.clone()),this.states.uViewMatrix.set(this.states.curCamera.cameraMatrix),this}_getStrokeShader(){const e=this.states.userStrokeShader;return e||this._getLineShader()}_getSphereMapping(e){return this.sphereMapping||(this.sphereMapping=this._pInst.createFilterShader(sa)),this.scratchMat3.inverseTranspose4x4(this.states.uViewMatrix),this.scratchMat3.invert(this.scratchMat3),this.sphereMapping.setUniform("uFovY",this.states.curCamera.cameraFOV),this.sphereMapping.setUniform("uAspect",this.states.curCamera.aspectRatio),this.sphereMapping.setUniform("uNewNormalMatrix",this.scratchMat3.mat3),this.sphereMapping.setUniform("uEnvMap",e),this.sphereMapping}_getFillShader(){return this._drawingImage?this.states.userImageShader&&!this._drawingFilter?this.states.userImageShader:this._getLightShader():this.states.userFillShader?this.states.userFillShader:this.states._useNormalMaterial?this._getNormalShader():this.states.enableLighting||this.states._tex?this._getLightShader():this._getColorShader()}_getPointShader(){const e=this.states.userPointShader;return e&&e.isPointShader()?e:this._getPointShader()}baseMaterialShader(){if(!this._pInst._glAttributes.perPixelLighting)throw new Error("The material shader does not support hooks without perPixelLighting. Try turning it back on.");return this._getLightShader()}_getLightShader(){return this._defaultLightShader||(this._pInst._glAttributes.perPixelLighting?this._defaultLightShader=new ks(this,this._webGL2CompatibilityPrefix("vert","highp")+na.phongVert,this._webGL2CompatibilityPrefix("frag","highp")+na.phongFrag,{vertex:{"void beforeVertex":"() {}","Vertex getObjectInputs":"(Vertex inputs) { return inputs; }","Vertex getWorldInputs":"(Vertex inputs) { return inputs; }","Vertex getCameraInputs":"(Vertex inputs) { return inputs; }","void afterVertex":"() {}"},fragment:{"void beforeFragment":"() {}","Inputs getPixelInputs":"(Inputs inputs) { return inputs; }","vec4 combineColors":"(ColorComponents components) {\n vec4 color = vec4(0.);\n color.rgb += components.diffuse * components.baseColor;\n color.rgb += components.ambient * components.ambientColor;\n color.rgb += components.specular * components.specularColor;\n color.rgb += components.emissive;\n color.a = components.opacity;\n return color;\n }","vec4 getFinalColor":"(vec4 color) { return color; }","void afterFragment":"() {}"}}):this._defaultLightShader=new ks(this,this._webGL2CompatibilityPrefix("vert","highp")+na.lightVert,this._webGL2CompatibilityPrefix("frag","highp")+na.lightTextureFrag)),this._defaultLightShader}baseNormalShader(){return this._getNormalShader()}_getNormalShader(){return this._defaultNormalShader||(this._defaultNormalShader=new ks(this,this._webGL2CompatibilityPrefix("vert","mediump")+na.normalVert,this._webGL2CompatibilityPrefix("frag","mediump")+na.normalFrag,{vertex:{"void beforeVertex":"() {}","Vertex getObjectInputs":"(Vertex inputs) { return inputs; }","Vertex getWorldInputs":"(Vertex inputs) { return inputs; }","Vertex getCameraInputs":"(Vertex inputs) { return inputs; }","void afterVertex":"() {}"},fragment:{"void beforeFragment":"() {}","vec4 getFinalColor":"(vec4 color) { return color; }","void afterFragment":"() {}"}})),this._defaultNormalShader}baseColorShader(){return this._getColorShader()}_getColorShader(){return this._defaultColorShader||(this._defaultColorShader=new ks(this,this._webGL2CompatibilityPrefix("vert","mediump")+na.normalVert,this._webGL2CompatibilityPrefix("frag","mediump")+na.basicFrag,{vertex:{"void beforeVertex":"() {}","Vertex getObjectInputs":"(Vertex inputs) { return inputs; }","Vertex getWorldInputs":"(Vertex inputs) { return inputs; }","Vertex getCameraInputs":"(Vertex inputs) { return inputs; }","void afterVertex":"() {}"},fragment:{"void beforeFragment":"() {}","vec4 getFinalColor":"(vec4 color) { return color; }","void afterFragment":"() {}"}})),this._defaultColorShader}pointShader(){return this._getPointShader()}_getPointShader(){return this._defaultPointShader||(this._defaultPointShader=new ks(this,this._webGL2CompatibilityPrefix("vert","mediump")+na.pointVert,this._webGL2CompatibilityPrefix("frag","mediump")+na.pointFrag,{vertex:{"void beforeVertex":"() {}","vec3 getLocalPosition":"(vec3 position) { return position; }","vec3 getWorldPosition":"(vec3 position) { return position; }","float getPointSize":"(float size) { return size; }","void afterVertex":"() {}"},fragment:{"void beforeFragment":"() {}","vec4 getFinalColor":"(vec4 color) { return color; }","bool shouldDiscard":"(bool outside) { return outside; }","void afterFragment":"() {}"}})),this._defaultPointShader}baseStrokeShader(){return this._getLineShader()}_getLineShader(){return this._defaultLineShader||(this._defaultLineShader=new ks(this,this._webGL2CompatibilityPrefix("vert","mediump")+na.lineVert,this._webGL2CompatibilityPrefix("frag","mediump")+na.lineFrag,{vertex:{"void beforeVertex":"() {}","StrokeVertex getObjectInputs":"(StrokeVertex inputs) { return inputs; }","StrokeVertex getWorldInputs":"(StrokeVertex inputs) { return inputs; }","StrokeVertex getCameraInputs":"(StrokeVertex inputs) { return inputs; }","void afterVertex":"() {}"},fragment:{"void beforeFragment":"() {}","Inputs getPixelInputs":"(Inputs inputs) { return inputs; }","vec4 getFinalColor":"(vec4 color) { return color; }","bool shouldDiscard":"(bool outside) { return outside; }","void afterFragment":"() {}"}})),this._defaultLineShader}_getFontShader(){return this._defaultFontShader||(this.webglVersion===n&&this.GL.getExtension("OES_standard_derivatives"),this._defaultFontShader=new ks(this,this._webGL2CompatibilityPrefix("vert","highp")+na.fontVert,this._webGL2CompatibilityPrefix("frag","highp")+na.fontFrag)),this._defaultFontShader}baseFilterShader(){return this._baseFilterShader||(this._baseFilterShader=new ks(this,this._webGL2CompatibilityPrefix("vert","highp")+na.filterBaseVert,this._webGL2CompatibilityPrefix("frag","highp")+na.filterBaseFrag,{vertex:{},fragment:{"vec4 getColor":"(FilterInputs inputs, in sampler2D canvasContent) {\n return getTexture(canvasContent, inputs.texCoord);\n }"}})),this._baseFilterShader}_webGL2CompatibilityPrefix(e,t){let i="";return this.webglVersion===s&&(i+="#version 300 es\n#define WEBGL2\n"),"vert"===e?i+="#define VERTEX_SHADER\n":"frag"===e&&(i+="#define FRAGMENT_SHADER\n"),t&&(i+=`precision ${t} float;\n`),i}_getEmptyTexture(){if(!this._emptyTexture){const e=new Hr(1,1);e.set(0,0,255),this._emptyTexture=new ma(this,e)}return this._emptyTexture}getTexture(e){let t=e;t instanceof Ca&&(t=t.color);const i=this.textures.get(t);if(i)return i;const r=new ma(this,t);return this.textures.set(t,r),r}getDiffusedTexture(e){if(null!=this.diffusedTextures.get(e))return this.diffusedTextures.get(e);let t,i=Math.floor(e.height/e.width*200);return t=new Ca(this,{width:200,height:i,density:1}),this.diffusedShader||(this.diffusedShader=this._pInst.createShader(na.imageLightVert,na.imageLightDiffusedFrag)),t.draw((()=>{this.shader(this.diffusedShader),this.diffusedShader.setUniform("environmentMap",e),this.states.setValue("strokeColor",null),this.noLights(),this.plane(200,i)})),this.diffusedTextures.set(e,t),t}getSpecularTexture(e){if(null!=this.specularTextures.get(e))return this.specularTextures.get(e);const t=512;let i;const r=[],n=new Ca(this,{width:t,height:t,density:1});let s=Math.log(t)/Math.log(2);this.specularShader||(this.specularShader=this._pInst.createShader(na.imageLightVert,na.imageLightSpecularFrag));for(let i=t;i>=1;i/=2){n.resize(i,i);let t=1-Math.log(i)/Math.log(2)/s;n.draw((()=>{this.shader(this.specularShader),this.clear(),this.specularShader.setUniform("environmentMap",e),this.specularShader.setUniform("roughness",t),this.states.setValue("strokeColor",null),this.noLights(),this.plane(i,i)})),r.push(n.get().drawingContext.getImageData(0,0,i,i))}return n.remove(),i=new ya(this,r,{}),this.specularTextures.set(e,i),i}activeFramebuffer(){return this.activeFramebuffers[this.activeFramebuffers.length-1]||null}createFramebuffer(e){return new Ca(this,e)}_setGlobalUniforms(e){const t=this.states.uModelMatrix,i=this.states.uViewMatrix,r=this.states.uPMatrix,n=t.copy().mult(i);if(e.setUniform("uPerspective",this.states.curCamera.useLinePerspective?1:0),e.setUniform("uViewMatrix",i.mat4),e.setUniform("uProjectionMatrix",r.mat4),e.setUniform("uModelMatrix",t.mat4),e.setUniform("uModelViewMatrix",n.mat4),e.uniforms.uModelViewProjectionMatrix){const t=n.copy();t.mult(r),e.setUniform("uModelViewProjectionMatrix",t.mat4)}e.uniforms.uNormalMatrix&&(this.scratchMat3.inverseTranspose4x4(n),e.setUniform("uNormalMatrix",this.scratchMat3.mat3)),e.uniforms.uModelNormalMatrix&&(this.scratchMat3.inverseTranspose4x4(this.states.uModelMatrix),e.setUniform("uModelNormalMatrix",this.scratchMat3.mat3)),e.uniforms.uCameraNormalMatrix&&(this.scratchMat3.inverseTranspose4x4(this.states.uViewMatrix),e.setUniform("uCameraNormalMatrix",this.scratchMat3.mat3)),e.uniforms.uCameraRotation&&(this.scratchMat3.inverseTranspose4x4(this.states.uViewMatrix),e.setUniform("uCameraRotation",this.scratchMat3.mat3)),e.setUniform("uViewport",this._viewport)}_setStrokeUniforms(e){e.setUniform("uSimpleLines",this._simpleLines),e.setUniform("uUseLineColor",this._useLineColor),e.setUniform("uMaterialColor",this.states.curStrokeColor),e.setUniform("uStrokeWeight",this.states.strokeWeight),e.setUniform("uStrokeCap",Qs[this.curStrokeCap]),e.setUniform("uStrokeJoin",ea[this.curStrokeJoin])}_setFillUniforms(e){this.mixedSpecularColor=[...this.states.curSpecularColor];const t=this._getEmptyTexture();this.states._useMetalness>0&&(this.mixedSpecularColor=this.mixedSpecularColor.map(((e,t)=>this.states.curFillColor[t]*this.states._useMetalness+e*(1-this.states._useMetalness)))),e.setUniform("uUseVertexColor",this._useVertexColor),e.setUniform("uMaterialColor",this.states.curFillColor),e.setUniform("isTexture",!!this.states._tex),e.setUniform("uSampler",this.states._tex||t),e.setUniform("uTint",this.states.tint),e.setUniform("uHasSetAmbient",this.states._hasSetAmbient),e.setUniform("uAmbientMatColor",this.states.curAmbientColor),e.setUniform("uSpecularMatColor",this.mixedSpecularColor),e.setUniform("uEmissiveMatColor",this.states.curEmissiveColor),e.setUniform("uSpecular",this.states._useSpecularMaterial),e.setUniform("uEmissive",this.states._useEmissiveMaterial),e.setUniform("uShininess",this.states._useShininess),e.setUniform("uMetallic",this.states._useMetalness),this._setImageLightUniforms(e),e.setUniform("uUseLighting",this.states.enableLighting);const i=this.states.pointLightDiffuseColors.length/3;e.setUniform("uPointLightCount",i),e.setUniform("uPointLightLocation",this.states.pointLightPositions),e.setUniform("uPointLightDiffuseColors",this.states.pointLightDiffuseColors),e.setUniform("uPointLightSpecularColors",this.states.pointLightSpecularColors);const r=this.states.directionalLightDiffuseColors.length/3;e.setUniform("uDirectionalLightCount",r),e.setUniform("uLightingDirection",this.states.directionalLightDirections),e.setUniform("uDirectionalDiffuseColors",this.states.directionalLightDiffuseColors),e.setUniform("uDirectionalSpecularColors",this.states.directionalLightSpecularColors);const n=this.states.ambientLightColors.length/3;this.mixedAmbientLight=[...this.states.ambientLightColors],this.states._useMetalness>0&&(this.mixedAmbientLight=this.mixedAmbientLight.map((e=>{let t=e-this.states._useMetalness;return Math.max(0,t)}))),e.setUniform("uAmbientLightCount",n),e.setUniform("uAmbientColor",this.mixedAmbientLight);const s=this.states.spotLightDiffuseColors.length/3;e.setUniform("uSpotLightCount",s),e.setUniform("uSpotLightAngle",this.states.spotLightAngle),e.setUniform("uSpotLightConc",this.states.spotLightConc),e.setUniform("uSpotLightDiffuseColors",this.states.spotLightDiffuseColors),e.setUniform("uSpotLightSpecularColors",this.states.spotLightSpecularColors),e.setUniform("uSpotLightLocation",this.states.spotLightPositions),e.setUniform("uSpotLightDirection",this.states.spotLightDirections),e.setUniform("uConstantAttenuation",this.states.constantAttenuation),e.setUniform("uLinearAttenuation",this.states.linearAttenuation),e.setUniform("uQuadraticAttenuation",this.states.quadraticAttenuation)}_setImageLightUniforms(e){if(e.setUniform("uUseImageLight",null!=this.states.activeImageLight),this.states.activeImageLight){let t=this.getDiffusedTexture(this.states.activeImageLight);e.setUniform("environmentMapDiffused",t);let i=this.getSpecularTexture(this.states.activeImageLight);e.setUniform("environmentMapSpecular",i)}}_setPointUniforms(e){e.setUniform("uMaterialColor",this.states.curStrokeColor),e.setUniform("uPointSize",this.states.strokeWeight*this._pixelDensity)}_bindBuffer(e,t,i,r,n){if(t||(t=this.GL.ARRAY_BUFFER),this.GL.bindBuffer(t,e),void 0!==i){let e=i;i instanceof bs?e=i.dataArray():e instanceof(r||Float32Array)||(e=new(r||Float32Array)(e)),this.GL.bufferData(t,e,n||this.GL.STATIC_DRAW)}}_arraysEqual(e,t){return e.length===t.length&&e.every(((e,i)=>e===t[i]))}_isTypedArray(e){return[Float32Array,Float64Array,Int16Array,Uint16Array,Uint32Array].some((t=>e instanceof t))}_vToNArray(e){return e.flatMap((e=>[e.x,e.y,e.z]))}}function ha(e,t){e.RendererGL=oa,t.setAttributes=function(t,i){if(void 0===this._glAttributes)return void console.log("You are trying to use setAttributes on a p5.Graphics object that does not use a WEBGL renderer.");let r=!0;void 0!==i?(null===this._glAttributes&&(this._glAttributes={}),this._glAttributes[t]!==i&&(this._glAttributes[t]=i,r=!1)):t instanceof Object&&this._glAttributes!==t&&(this._glAttributes=t,r=!1),this._renderer.isP3D&&!r&&(!this._setupDone&&this._renderer.geometryBufferCache.numCached()>0?e._friendlyError("Sorry, Could not set the attributes, you need to call setAttributes() before calling the other drawing methods in setup()"):(this._renderer._resetContext(),this._renderer.states.curCamera&&(this._renderer.states.curCamera._renderer=this._renderer)))},t._assert3d=function(e){if(!this._renderer.isP3D)throw new Error(`${e}() is only supported in WEBGL mode. If you'd like to use 3D graphics and WebGL, see https://p5js.org/examples/form-3d-primitives.html for more information.`)},e.renderers[n]=e.RendererGL,e.renderers[s]=e.RendererGL}function ua(e,t,i,r,n,s,a,o,h,u){const l=t.getParameter(t.FRAMEBUFFER_BINDING);t.bindFramebuffer(t.FRAMEBUFFER,i);const c=o===t.RGBA?4:3,p=s*a*c,d=h===t.UNSIGNED_BYTE?Uint8Array:Float32Array;if(e instanceof d&&e.length===p||(e=new d(p)),t.readPixels(r,u?u-n-a:n,s,a,o,h,e),t.bindFramebuffer(t.FRAMEBUFFER,l),u){const t=Math.floor(a/2),i=new d(s*c);for(let r=0;r<t;r++){const t=r*s*4,n=(a-r-1)*s*4;i.set(e.subarray(t,t+4*s)),e.copyWithin(t,n,n+4*s),e.set(i,n)}}return e}function la(e,t,i,r,n,s,a){const o=e.getParameter(e.FRAMEBUFFER_BINDING);e.bindFramebuffer(e.FRAMEBUFFER,t);const h=n===e.RGBA?4:3,u=new(s===e.UNSIGNED_BYTE?Uint8Array:Float32Array)(h);return e.readPixels(i,a?a-r-1:r,1,1,n,s,u),e.bindFramebuffer(e.FRAMEBUFFER,o),Array.from(u)}function ca(e,t){t.strokeMode=function(e){if(void 0===e)return this._renderer._simpleLines?o:h;if(e===o)this._renderer._simpleLines=!0;else{if(e!==h)throw Error("no such parameter");this._renderer._simpleLines=!1}},t.buildGeometry=function(e){return this._renderer.buildGeometry(e)},t.freeGeometry=function(e){this._renderer.geometryBufferCache.freeBuffers(e.gid)},t.plane=function(e=50,t=e,i=1,r=1){return this._assert3d("plane"),this._renderer.plane(e,t,i,r),this},t.box=function(e,t,i,r,n){return this._assert3d("box"),this._renderer.box(e,t,i,r,n),this},t.sphere=function(e=50,t=24,i=16){return this._assert3d("sphere"),this._renderer.sphere(e,t,i),this},t.cylinder=function(e=50,t=e,i=24,r=1,n=!0,s=!0){return this._assert3d("cylinder"),this._renderer.cylinder(e,t,i,r,n,s),this},t.cone=function(e=50,t=e,i=24,r=1,n=!0){return this._assert3d("cone"),this._renderer.cone(e,t,i,r,n),this},t.ellipsoid=function(e=50,t=e,i=e,r=24,n=16){return this._assert3d("ellipsoid"),this._renderer.ellipsoid(e,t,i,r,n),this},t.torus=function(e,t,i,r){return this._assert3d("torus"),this._renderer.torus(e,t,i,r),this},oa.prototype.point=function(e,t,i=0){const r=[];return r.push(new Zr(e,t,i)),this._drawPoints(r,this.buffers.point),this},oa.prototype.triangle=function(e){const t=e[0],i=e[1],r=e[2],n=e[3],s=e[4],a=e[5],o="tri";if(!this.geometryInHash(o)){const e=new ws(1,1,(function(){const e=[];e.push(new Zr(0,0,0)),e.push(new Zr(1,0,0)),e.push(new Zr(0,1,0)),this.edges=[[0,1],[1,2],[2,0]],this.vertices=e,this.faces=[[0,1,2]],this.uvs=[0,0,1,0,1,1]}),this);e._edgesToVertices(),e.computeNormals(),e.gid=o,this.geometryBufferCache.ensureCached(e)}const h=this.states.uModelMatrix.copy();try{const e=Math.sign(t*n-r*i+r*a-s*n+s*i-t*a),h=new xs([r-t,n-i,0,0,s-t,a-i,0,0,0,0,e,0,t,i,0,1]).mult(this.states.uModelMatrix);this.states.setValue("uModelMatrix",h),this.model(this.geometryBufferCache.getGeometryByID(o))}finally{this.states.setValue("uModelMatrix",h)}return this},oa.prototype.ellipse=function(e){this.arc(e[0],e[1],e[2],e[3],0,x,L,e[4])},oa.prototype.arc=function(...e){const t=e[0],i=e[1],r=e[2],n=e[3],s=e[4],a=e[5],o=e[6],h=e[7]||25;let u,l;if(Math.abs(a-s)>=x?(u="ellipse",l=`${u}|${h}|`):(u="arc",l=`${u}|${s}|${a}|${o}|${h}|`),!this.geometryInHash(l)){const e=function(){if(s.toFixed(10)!==a.toFixed(10)){o!==P&&void 0!==o||(this.vertices.push(new Zr(.5,.5,0)),this.uvs.push([.5,.5]));for(let e=0;e<=h;e++){const t=(a-s)*(e/h)+s,i=.5+Math.cos(t)/2,r=.5+Math.sin(t)/2;this.vertices.push(new Zr(i,r,0)),this.uvs.push([i,r]),e<h-1&&(this.faces.push([0,e+1,e+2]),this.edges.push([e+1,e+2]))}switch(o){case P:this.faces.push([0,this.vertices.length-2,this.vertices.length-1]),this.edges.push([0,1]),this.edges.push([this.vertices.length-2,this.vertices.length-1]),this.edges.push([0,this.vertices.length-1]);break;case O:this.edges.push([0,1]),this.edges.push([0,this.vertices.length-1]);break;case L:this.edges.push([0,1]);break;default:this.faces.push([0,this.vertices.length-2,this.vertices.length-1]),this.edges.push([this.vertices.length-2,this.vertices.length-1])}}},t=new ws(h,1,e,this);t.computeNormals(),h<=50?t._edgesToVertices(t):this.states.strokeColor&&console.log(`Cannot apply a stroke to an ${u} with more than 50 detail`),t.gid=l,this.geometryBufferCache.ensureCached(t)}const c=this.states.uModelMatrix;this.states.setValue("uModelMatrix",this.states.uModelMatrix.clone());try{this.states.uModelMatrix.translate([t,i,0]),this.states.uModelMatrix.scale(r,n,1),this.model(this.geometryBufferCache.getGeometryByID(l))}finally{this.states.setValue("uModelMatrix",c)}return this},oa.prototype.rect=function(e){const t=e[0],i=e[1],r=e[2],n=e[3];if(void 0===e[4]){const s=this._pInst._glAttributes.perPixelLighting,a=e[4]||(s?1:24),o=e[5]||(s?1:16),h=`rect|${a}|${o}`;if(!this.geometryInHash(h)){const e=function(){for(let e=0;e<=this.detailY;e++){const t=e/this.detailY;for(let e=0;e<=this.detailX;e++){const i=e/this.detailX,r=new Zr(i,t,0);this.vertices.push(r),this.uvs.push(i,t)}}a>0&&o>0&&(this.edges=[[0,a],[a,(a+1)*(o+1)-1],[(a+1)*(o+1)-1,(a+1)*o],[(a+1)*o,0]])},t=new ws(a,o,e,this);t.computeFaces().computeNormals()._edgesToVertices(),t.gid=h,this.geometryBufferCache.ensureCached(t)}const u=this.states.uModelMatrix;this.states.setValue("uModelMatrix",this.states.uModelMatrix.copy());try{this.states.uModelMatrix.translate([t,i,0]),this.states.uModelMatrix.scale(r,n,1),this.model(this.geometryBufferCache.getGeometryByID(h))}finally{this.states.setValue("uModelMatrix",u)}}else{let s=e[4],a=void 0===e[5]?s:e[5],o=void 0===e[6]?a:e[6],h=void 0===e[7]?o:e[7],u=t,l=i,c=r,p=n;if(c+=u,p+=l,u>c){const e=u;u=c,c=e}if(l>p){const e=l;l=p,p=e}const d=Math.min((c-u)/2,(p-l)/2);s>d&&(s=d),a>d&&(a=d),o>d&&(o=d),h>d&&(h=d);let f=u,g=l,m=c,y=p;const x=this.states.textureMode;this.states.setValue("textureMode",de);const v=this.bezierOrder();this.bezierOrder(2),this.beginShape();const b=(e,t)=>[e,t,0,(e-f)/r,(t-g)/n];0!==a?(this.vertex(...b(m-a,g)),this.bezierVertex(...b(m,g)),this.bezierVertex(...b(m,g+a))):this.vertex(...b(m,g)),0!==o?(this.vertex(...b(m,y-o)),this.bezierVertex(...b(m,y)),this.bezierVertex(...b(m-o,y))):this.vertex(...b(m,y)),0!==h?(this.vertex(...b(f+h,y)),this.bezierVertex(...b(f,y)),this.bezierVertex(...b(f,y-h))):this.vertex(...b(f,y)),0!==s?(this.vertex(...b(f,g+s)),this.bezierVertex(...b(f,g)),this.bezierVertex(...b(f+s,g))):this.vertex(...b(f,g)),this.endShape(B),this.states.setValue("textureMode",x),this.bezierOrder(v)}return this},oa.prototype.quad=function(e,t,i,r,n,s,a,o,h,u,l,c,p=2,d=2){const f=`quad|${e}|${t}|${i}|${r}|${n}|${s}|${a}|${o}|${h}|${u}|${l}|${c}|${p}|${d}`;if(!this.geometryInHash(f)){const g=new ws(p,d,(function(){let p=1/(this.detailX-1),d=1/(this.detailY-1);for(let f=0;f<this.detailY;f++)for(let g=0;g<this.detailX;g++){let m=g*p,y=f*d,x=(1-m)*((1-y)*e+y*u)+m*((1-y)*r+y*a),v=(1-m)*((1-y)*t+y*l)+m*((1-y)*n+y*o),b=(1-m)*((1-y)*i+y*c)+m*((1-y)*s+y*h);this.vertices.push(new Zr(x,v,b)),this.uvs.push([m,y])}}),this);g.faces=[];for(let e=0;e<d-1;e++)for(let t=0;t<p-1;t++){let i=t+e*p,r=t+1+e*p,n=t+1+(e+1)*p,s=t+(e+1)*p;g.faces.push([i,r,n]),g.faces.push([i,n,s])}g.computeNormals(),g.edges.length=0;const m=[0,2,3,1];for(let e=0;e<m.length;e++){const t=m[e],i=m[(e+1)%m.length];g.edges.push([t,i])}g._edgesToVertices(),g.gid=f,this.geometryBufferCache.ensureCached(g)}return this.model(this.geometryBufferCache.getGeometryByID(f)),this},oa.prototype.bezier=function(e,t,i,r,n,s,a,o,h,u,l,c){8===arguments.length&&(l=o,u=a,o=s,a=n,n=r,r=i,i=s=h=c=0),this.bezierOrder(),this.bezierOrder(3),this.beginShape(),this.vertex(e,t,i),this.bezierVertex(r,n,s),this.bezierVertex(a,o,h),this.bezierVertex(u,l,c),this.endShape()},oa.prototype.curve=function(e,t,i,r,n,s,a,o,h,u,l,c){8===arguments.length&&(u=a,l=o,a=n,o=r,n=r=i,i=s=h=c=0),this.beginShape(),this.splineVertex(e,t,i),this.splineVertex(r,n,s),this.splineVertex(a,o,h),this.splineVertex(u,l,c),this.endShape()},oa.prototype.line=function(...e){return 6===e.length?(this.beginShape(M),this.vertex(e[0],e[1],e[2]),this.vertex(e[3],e[4],e[5]),this.endShape()):4===e.length&&(this.beginShape(M),this.vertex(e[0],e[1],0),this.vertex(e[2],e[3],0),this.endShape()),this},oa.prototype.image=function(e,t,i,r,n,s,a,o,h){this._isErasing&&this.blendMode(this._cachedBlendMode),this.push(),this.noLights(),this.states.setValue("strokeColor",null),this.texture(e),this.states.setValue("textureMode",de);let u=0;t<=e.width&&(u=t/e.width);let l=1;t+r<=e.width&&(l=(t+r)/e.width);let c=0;i<=e.height&&(c=i/e.height);let p=1;i+n<=e.height&&(p=(i+n)/e.height),this._drawingImage=!0,this.beginShape(),this.vertex(s,a,0,u,c),this.vertex(s+o,a,0,l,c),this.vertex(s+o,a+h,0,l,p),this.vertex(s,a+h,0,u,p),this.endShape(B),this._drawingImage=!1,this.pop(),this._isErasing&&this.blendMode($)};const i=function(e,t,i,r,n,s,a){e=e<=0?1:e,t=t<0?0:t,i=i<=0?e:i,r=r<3?3:r;const o=(s=void 0===s||s)?-2:0,h=(n=n<1?1:n)+((a=void 0===a?0!==t:a)?2:0),u=Math.atan2(e-t,i),l=Math.sin(u),c=Math.cos(u);let p,d,f;for(p=o;p<=h;++p){let s,a=p/n,o=i*a;for(p<0?(o=0,a=0,s=e):p>n?(o=i,a=1,s=t):s=e+(t-e)*a,-2!==p&&p!==n+2||(s=0),o-=i/2,d=0;d<r;++d){const e=d/(r-1),i=2*Math.PI*e,h=Math.sin(i),u=Math.cos(i);let f;this.vertices.push(new Zr(h*s,o,u*s)),f=p<0?new Zr(0,-1,0):p>n&&t?new Zr(0,1,0):new Zr(h*c,l,u*c),this.vertexNormals.push(f),this.uvs.push(e,a)}}let g=0;if(s){for(f=0;f<r;++f){const e=(f+1)%r;this.faces.push([g+f,g+r+e,g+r+f])}g+=2*r}for(p=0;p<n;++p){for(d=0;d<r;++d){const e=(d+1)%r;this.faces.push([g+d,g+e,g+r+e]),this.faces.push([g+d,g+r+e,g+r+d])}g+=r}if(a)for(g+=r,d=0;d<r;++d)this.faces.push([g+d,g+(d+1)%r,g+r])};oa.prototype.plane=function(e=50,t=e,i=1,r=1){const n=`plane|${i}|${r}`;if(!this.geometryInHash(n)){const e=function(){let e,t,i;for(let r=0;r<=this.detailY;r++){t=r/this.detailY;for(let r=0;r<=this.detailX;r++)e=r/this.detailX,i=new Zr(e-.5,t-.5,0),this.vertices.push(i),this.uvs.push(e,t)}},t=new ws(i,r,e,this);t.computeFaces().computeNormals(),i<=1&&r<=1?t._makeTriangleEdges()._edgesToVertices():this.states.strokeColor&&console.log("Cannot draw stroke on plane objects with more than 1 detailX or 1 detailY"),t.gid=n,this.geometryBufferCache.ensureCached(t)}this._drawGeometryScaled(this.geometryBufferCache.getGeometryByID(n),e,t,1)},oa.prototype.box=function(e=50,t=e,i=t,r,n){const s=this.attributes&&this.attributes.perPixelLighting;void 0===r&&(r=s?1:4),void 0===n&&(n=s?1:4);const a=`box|${r}|${n}`;if(!this.geometryInHash(a)){const e=function(){this.edges=[[0,1],[1,3],[3,2],[6,7],[8,9],[9,11],[14,15],[16,17],[17,19],[18,19],[20,21],[22,23]],[[0,4,2,6],[1,3,5,7],[0,1,4,5],[2,6,3,7],[0,2,1,3],[4,5,6,7]].forEach(((e,t)=>{const i=4*t;for(let t=0;t<4;t++){const i=e[t],r=new Zr((2*(1&i)-1)/2,((2&i)-1)/2,((4&i)/2-1)/2);this.vertices.push(r),this.uvs.push(1&t,(2&t)/2)}this.faces.push([i,i+1,i+2]),this.faces.push([i+2,i+1,i+3])}))},t=new ws(r,n,e,this);t.computeNormals(),r<=4&&n<=4?t._edgesToVertices():this.states.strokeColor&&console.log("Cannot draw stroke on box objects with more than 4 detailX or 4 detailY"),t.gid=a,this.geometryBufferCache.ensureCached(t)}this._drawGeometryScaled(this.geometryBufferCache.getGeometryByID(a),e,t,i)},oa.prototype.sphere=function(e=50,t=24,i=16){this.ellipsoid(e,e,e,t,i)},oa.prototype.ellipsoid=function(t=50,i=t,r=t,n=24,s=16){const a=`ellipsoid|${n}|${s}`;if(!this.geometryInHash(a)){const t=function(){for(let t=0;t<=this.detailY;t++){const i=t/this.detailY,r=Math.PI*i-Math.PI/2,n=Math.cos(r),s=Math.sin(r);for(let t=0;t<=this.detailX;t++){const r=t/this.detailX,a=2*Math.PI*r,o=Math.cos(a),h=Math.sin(a),u=new e.Vector(n*h,s,n*o);this.vertices.push(u),this.vertexNormals.push(u),this.uvs.push(r,i)}}},i=new ws(n,s,t,this);i.computeFaces(),n<=24&&s<=24?i._makeTriangleEdges()._edgesToVertices():this.states.strokeColor&&console.log("Cannot draw stroke on ellipsoids with more than 24 detailX or 24 detailY"),i.gid=a,this.geometryBufferCache.ensureCached(i)}this._drawGeometryScaled(this.geometryBufferCache.getGeometryByID(a),t,i,r)},oa.prototype.cylinder=function(t=50,r=t,n=24,s=1,a=!0,o=!0){const h=`cylinder|${n}|${s}|${a}|${o}`;if(!this.geometryInHash(h)){const t=new e.Geometry(n,s,(function(){i.call(this,1,1,1,n,s,a,o)}),this);n<=24&&s<=16?t._makeTriangleEdges()._edgesToVertices():this.states.strokeColor&&console.log("Cannot draw stroke on cylinder objects with more than 24 detailX or 16 detailY"),t.gid=h,this.geometryBufferCache.ensureCached(t)}this._drawGeometryScaled(this.geometryBufferCache.getGeometryByID(h),t,r,t)},oa.prototype.cone=function(e=50,t=e,r=24,n=1,s=!0){const a=`cone|${r}|${n}|${s}`;if(!this.geometryInHash(a)){const e=new ws(r,n,(function(){i.call(this,1,0,1,r,n,s,!1)}),this);r<=24&&n<=16?e._makeTriangleEdges()._edgesToVertices():this.states.strokeColor&&console.log("Cannot draw stroke on cone objects with more than 24 detailX or 16 detailY"),e.gid=a,this.geometryBufferCache.ensureCached(e)}this._drawGeometryScaled(this.geometryBufferCache.getGeometryByID(a),e,t,e)},oa.prototype.torus=function(e=50,t=10,i=24,r=16){if(0===e)return;if(0===t)return;const n=(t/e).toPrecision(4),s=`torus|${n}|${i}|${r}`;if(!this.geometryInHash(s)){const e=function(){for(let e=0;e<=this.detailY;e++){const t=e/this.detailY,i=2*Math.PI*t,r=Math.cos(i),s=Math.sin(i),a=1+n*r;for(let e=0;e<=this.detailX;e++){const i=e/this.detailX,o=2*Math.PI*i,h=Math.cos(o),u=Math.sin(o),l=new Zr(a*h,a*u,n*s),c=new Zr(r*h,r*u,s);this.vertices.push(l),this.vertexNormals.push(c),this.uvs.push(i,t)}}},t=new ws(i,r,e,this);t.computeFaces(),i<=24&&r<=16?t._makeTriangleEdges()._edgesToVertices():this.states.strokeColor&&console.log("Cannot draw strokes on torus object with more than 24 detailX or 16 detailY"),t.gid=s,this.geometryBufferCache.ensureCached(t)}this._drawGeometryScaled(this.geometryBufferCache.getGeometryByID(s),e,e,e)},t.curveDetail=function(e){if(!(this._renderer instanceof oa))throw new Error("curveDetail() only works in WebGL mode. Did you mean to call createCanvas(width, height, WEBGL)?");return this._renderer.curveDetail(e)}}function pa(e,t){t.ambientLight=function(e,t,i,r){return this._assert3d("ambientLight"),this._renderer.ambientLight(...arguments),this},t.specularColor=function(e,t,i){return this._assert3d("specularColor"),this._renderer.specularColor(...arguments),this},t.directionalLight=function(e,t,i,r,n,s){return this._assert3d("directionalLight"),this._renderer.directionalLight(...arguments),this},t.pointLight=function(e,t,i,r,n,s){return this._assert3d("pointLight"),this._renderer.pointLight(...arguments),this},t.imageLight=function(e){this._renderer.imageLight(e)},t.panorama=function(e){this.filter(this._renderer._getSphereMapping(e))},t.lights=function(){return this._assert3d("lights"),this._renderer.lights(),this},t.lightFalloff=function(e,t,i){return this._assert3d("lightFalloff"),this._renderer.lightFalloff(e,t,i),this},t.spotLight=function(e,t,i,r,n,s,a,o,h,u,l){return this._assert3d("spotLight"),this._renderer.spotLight(...arguments),this},t.noLights=function(...e){return this._assert3d("noLights"),this._renderer.noLights(),this},oa.prototype.ambientLight=function(e,t,i,r){const n=this._pInst.color(...arguments);this.states.setValue("ambientLightColors",[...this.states.ambientLightColors]),this.states.ambientLightColors.push(n._array[0],n._array[1],n._array[2]),this.states.setValue("enableLighting",!0)},oa.prototype.specularColor=function(e,t,i){const r=this._pInst.color(...arguments);this.states.setValue("specularColors",[r._array[0],r._array[1],r._array[2]])},oa.prototype.directionalLight=function(e,t,i,r,n,s){let a,o,h,u;a=e instanceof dr?e:this._pInst.color(e,t,i);const l=arguments[arguments.length-1];"number"==typeof l?(o=arguments[arguments.length-3],h=arguments[arguments.length-2],u=arguments[arguments.length-1]):(o=l.x,h=l.y,u=l.z);const c=Math.sqrt(o*o+h*h+u*u);this.states.setValue("directionalLightDirections",[...this.states.directionalLightDirections]),this.states.directionalLightDirections.push(o/c,h/c,u/c),this.states.setValue("directionalLightDiffuseColors",[...this.states.directionalLightDiffuseColors]),this.states.directionalLightDiffuseColors.push(a._array[0],a._array[1],a._array[2]),this.states.setValue("directionalLightSpecularColors",[...this.states.directionalLightSpecularColors]),Array.prototype.push.apply(this.states.directionalLightSpecularColors,this.states.specularColors),this.states.setValue("enableLighting",!0)},oa.prototype.pointLight=function(e,t,i,r,n,s){let a,o,h,u;a=e instanceof dr?e:this._pInst.color(e,t,i);const l=arguments[arguments.length-1];"number"==typeof l?(o=arguments[arguments.length-3],h=arguments[arguments.length-2],u=arguments[arguments.length-1]):(o=l.x,h=l.y,u=l.z),this.states.setValue("pointLightPositions",[...this.states.pointLightPositions]),this.states.pointLightPositions.push(o,h,u),this.states.setValue("pointLightDiffuseColors",[...this.states.pointLightDiffuseColors]),this.states.pointLightDiffuseColors.push(a._array[0],a._array[1],a._array[2]),this.states.setValue("pointLightSpecularColors",[...this.states.pointLightSpecularColors]),Array.prototype.push.apply(this.states.pointLightSpecularColors,this.states.specularColors),this.states.setValue("enableLighting",!0)},oa.prototype.imageLight=function(e){this.states.setValue("activeImageLight",e),this.states.setValue("enableLighting",!0)},oa.prototype.lights=function(){const e=this._pInst.color("rgb(128,128,128)");this.ambientLight(e),this.directionalLight(e,0,0,-1)},oa.prototype.lightFalloff=function(e,t,i){e<0&&(e=0,console.warn("Value of constant argument in lightFalloff() should be never be negative. Set to 0.")),t<0&&(t=0,console.warn("Value of linear argument in lightFalloff() should be never be negative. Set to 0.")),i<0&&(i=0,console.warn("Value of quadratic argument in lightFalloff() should be never be negative. Set to 0.")),0===e&&0===t&&0===i&&(e=1,console.warn("Either one of the three arguments in lightFalloff() should be greater than zero. Set constant argument to 1.")),this.states.setValue("constantAttenuation",e),this.states.setValue("linearAttenuation",t),this.states.setValue("quadraticAttenuation",i)},oa.prototype.spotLight=function(e,t,i,r,n,s,a,o,h,u,l){let c,p,d;const f=arguments.length;switch(f){case 11:case 10:c=this._pInst.color(e,t,i),p=new Zr(r,n,s),d=new Zr(a,o,h);break;case 9:e instanceof dr?(c=e,p=new Zr(t,i,r),d=new Zr(n,s,a),u=o,l=h):r instanceof Zr?(c=this._pInst.color(e,t,i),p=r,d=new Zr(n,s,a),u=o,l=h):a instanceof Zr?(c=this._pInst.color(e,t,i),p=new Zr(r,n,s),d=a,u=o,l=h):(c=this._pInst.color(e,t,i),p=new Zr(r,n,s),d=new Zr(a,o,h));break;case 8:e instanceof dr?(c=e,p=new Zr(t,i,r),d=new Zr(n,s,a),u=o):r instanceof Zr?(c=this._pInst.color(e,t,i),p=r,d=new Zr(n,s,a),u=o):(c=this._pInst.color(e,t,i),p=new Zr(r,n,s),d=a,u=o);break;case 7:e instanceof dr&&t instanceof Zr?(c=e,p=t,d=new Zr(i,r,n),u=s,l=a):e instanceof dr&&n instanceof Zr?(c=e,p=new Zr(t,i,r),d=n,u=s,l=a):r instanceof Zr&&n instanceof Zr?(c=this._pInst.color(e,t,i),p=r,d=n,u=s,l=a):e instanceof dr?(c=e,p=new Zr(t,i,r),d=new Zr(n,s,a)):r instanceof Zr?(c=this._pInst.color(e,t,i),p=r,d=new Zr(n,s,a)):(c=this._pInst.color(e,t,i),p=new Zr(r,n,s),d=a);break;case 6:r instanceof Zr&&n instanceof Zr?(c=this._pInst.color(e,t,i),p=r,d=n,u=s):e instanceof dr&&n instanceof Zr?(c=e,p=new Zr(t,i,r),d=n,u=s):e instanceof dr&&t instanceof Zr&&(c=e,p=t,d=new Zr(i,r,n),u=s);break;case 5:e instanceof dr&&t instanceof Zr&&i instanceof Zr?(c=e,p=t,d=i,u=r,l=n):r instanceof Zr&&n instanceof Zr?(c=this._pInst.color(e,t,i),p=r,d=n):e instanceof dr&&n instanceof Zr?(c=e,p=new Zr(t,i,r),d=n):e instanceof dr&&t instanceof Zr&&(c=e,p=t,d=new Zr(i,r,n));break;case 4:c=e,p=t,d=i,u=r;break;case 3:c=e,p=t,d=i;break;default:return void console.warn(`Sorry, input for spotlight() is not in prescribed format. Too ${f<3?"few":"many"} arguments were provided`)}this.states.setValue("spotLightDiffuseColors",[c._array[0],c._array[1],c._array[2]]),this.states.setValue("spotLightSpecularColors",[...this.states.specularColors]),this.states.setValue("spotLightPositions",[p.x,p.y,p.z]),d.normalize(),this.states.setValue("spotLightDirections",[d.x,d.y,d.z]),void 0===u&&(u=Math.PI/3),void 0!==l&&l<1?(l=1,console.warn("Value of concentration needs to be greater than 1. Setting it to 1")):void 0===l&&(l=100),u=this._pInst._toRadians(u),this.states.setValue("spotLightAngle",[Math.cos(u)]),this.states.setValue("spotLightConc",[l]),this.states.setValue("enableLighting",!0)},oa.prototype.noLights=function(){this.states.setValue("activeImageLight",null),this.states.setValue("enableLighting",!1),this.states.setValue("ambientLightColors",[]),this.states.setValue("specularColors",[1,1,1]),this.states.setValue("directionalLightDirections",[]),this.states.setValue("directionalLightDiffuseColors",[]),this.states.setValue("directionalLightSpecularColors",[]),this.states.setValue("pointLightPositions",[]),this.states.setValue("pointLightDiffuseColors",[]),this.states.setValue("pointLightSpecularColors",[]),this.states.setValue("spotLightPositions",[]),this.states.setValue("spotLightDirections",[]),this.states.setValue("spotLightDiffuseColors",[]),this.states.setValue("spotLightSpecularColors",[]),this.states.setValue("spotLightAngle",[]),this.states.setValue("spotLightConc",[]),this.states.setValue("constantAttenuation",1),this.states.setValue("linearAttenuation",0),this.states.setValue("quadraticAttenuation",0),this.states.setValue("_useShininess",1),this.states.setValue("_useMetalness",0)}}function da(e,t){t.loadShader=async function(e,t,i,r){const n=new ks;try{return n._vertSrc=(await qn(e,"text")).data,n._fragSrc=(await qn(t,"text")).data,i?i(n):n}catch(e){if(r)return r(e);throw e}},t.createShader=function(e,t,i){return new ks(this._renderer,e,t,i)},t.loadFilterShader=async function(e,t,i){try{const i=await this.loadStrings(e),r=await i.join("\n"),n=this.createFilterShader(r,!0);return t&&t(n),n}catch(e){i?i(e):console.error(e)}},t.createFilterShader=function(e,t=!1){let i=e.includes("#version 300 es")?"#version 300 es\n uniform mat4 uModelViewMatrix;\n uniform mat4 uProjectionMatrix;\n\n in vec3 aPosition;\n in vec2 aTexCoord;\n out vec2 vTexCoord;\n\n void main() {\n // transferring texcoords for the frag shader\n vTexCoord = aTexCoord;\n\n // copy position with a fourth coordinate for projection (1.0 is normal)\n vec4 positionVec4 = vec4(aPosition, 1.0);\n\n // project to 3D space\n gl_Position = uProjectionMatrix * uModelViewMatrix * positionVec4;\n }\n ":"\n uniform mat4 uModelViewMatrix;\n uniform mat4 uProjectionMatrix;\n\n attribute vec3 aPosition;\n // texcoords only come from p5 to vertex shader\n // so pass texcoords on to the fragment shader in a varying variable\n attribute vec2 aTexCoord;\n varying vec2 vTexCoord;\n\n void main() {\n // transferring texcoords for the frag shader\n vTexCoord = aTexCoord;\n\n // copy position with a fourth coordinate for projection (1.0 is normal)\n vec4 positionVec4 = vec4(aPosition, 1.0);\n\n // project to 3D space\n gl_Position = uProjectionMatrix * uModelViewMatrix * positionVec4;\n }\n ";const r=new ks(this._renderer,i,e);return t||(this._renderer.GL?r.ensureCompiledOnContext(this._renderer):r.ensureCompiledOnContext(this)),r},t.shader=function(e){return this._assert3d("shader"),this._renderer.shader(e),this},t.strokeShader=function(e){return this._assert3d("strokeShader"),this._renderer.strokeShader(e),this},t.imageShader=function(e){return this._assert3d("imageShader"),this._renderer.imageShader(e),this},t.baseMaterialShader=function(){return this._assert3d("baseMaterialShader"),this._renderer.baseMaterialShader()},t.baseFilterShader=function(){return(this._renderer.filterRenderer||this._renderer).baseFilterShader()},t.baseNormalShader=function(){return this._assert3d("baseNormalShader"),this._renderer.baseNormalShader()},t.baseColorShader=function(){return this._assert3d("baseColorShader"),this._renderer.baseColorShader()},t.baseStrokeShader=function(){return this._assert3d("baseStrokeShader"),this._renderer.baseStrokeShader()},t.resetShader=function(){return this._renderer.resetShader(),this},t.texture=function(e){return this._assert3d("texture"),e.gifProperties&&e._animateGif(this),this._renderer.texture(e),this},t.textureMode=function(e){e!==xe&&e!==de?console.warn(`You tried to set ${e} textureMode only supports IMAGE & NORMAL `):this._renderer.states.setValue("textureMode",e)},t.textureWrap=function(e,t=e){this._renderer.states.setValue("textureWrapX",e),this._renderer.states.setValue("textureWrapY",t);for(const i of this._renderer.textures.values())i.setWrapMode(e,t)},t.normalMaterial=function(...e){return this._assert3d("normalMaterial"),this._renderer.normalMaterial(...e),this},t.ambientMaterial=function(e,i,r){this._assert3d("ambientMaterial");const n=t.color.apply(this,arguments);return this._renderer.states.setValue("_hasSetAmbient",!0),this._renderer.states.setValue("curAmbientColor",n._array),this._renderer.states.setValue("_useNormalMaterial",!1),this._renderer.states.setValue("enableLighting",!0),this._renderer.states.fillColor||this._renderer.states.setValue("fillColor",new dr([1,1,1])),this},t.emissiveMaterial=function(e,i,r,n){this._assert3d("emissiveMaterial");const s=t.color.apply(this,arguments);return this._renderer.states.setValue("curEmissiveColor",s._array),this._renderer.states.setValue("_useEmissiveMaterial",!0),this._renderer.states.setValue("_useNormalMaterial",!1),this._renderer.states.setValue("enableLighting",!0),this},t.specularMaterial=function(e,i,r,n){this._assert3d("specularMaterial");const s=t.color.apply(this,arguments);return this._renderer.states.setValue("curSpecularColor",s._array),this._renderer.states.setValue("_useSpecularMaterial",!0),this._renderer.states.setValue("_useNormalMaterial",!1),this._renderer.states.setValue("enableLighting",!0),this},t.shininess=function(e){return this._assert3d("shininess"),this._renderer.shininess(e),this},t.metalness=function(e){return this._assert3d("metalness"),this._renderer.metalness(e),this},oa.prototype._applyColorBlend=function(e,t){const i=this.GL,r=this.states.drawMode===ye,n=t||this.states.userFillShader||this.states.userStrokeShader||this.states.userPointShader||r||this.states.curBlendMode!==j||e[e.length-1]<1||this._isErasing;return n!==this._isBlending&&(n||this.states.curBlendMode!==j&&this.states.curBlendMode!==q?i.enable(i.BLEND):i.disable(i.BLEND),i.depthMask(!0),this._isBlending=n),this._applyBlendMode(),e},oa.prototype._applyBlendMode=function(){if(this._cachedBlendMode===this.states.curBlendMode)return;const e=this.GL;switch(this.states.curBlendMode){case j:e.blendEquation(e.FUNC_ADD),e.blendFunc(e.ONE,e.ONE_MINUS_SRC_ALPHA);break;case q:e.blendEquation(e.FUNC_ADD),e.blendFunc(e.ONE,e.ONE);break;case $:e.blendEquation(e.FUNC_ADD),e.blendFunc(e.ZERO,e.ONE_MINUS_SRC_ALPHA);break;case K:e.blendEquation(e.FUNC_ADD),e.blendFunc(e.DST_COLOR,e.ONE_MINUS_SRC_ALPHA);break;case J:e.blendEquation(e.FUNC_ADD),e.blendFunc(e.ONE,e.ONE_MINUS_SRC_COLOR);break;case Z:e.blendEquationSeparate(e.FUNC_ADD,e.FUNC_ADD),e.blendFuncSeparate(e.ONE_MINUS_DST_COLOR,e.ONE_MINUS_SRC_COLOR,e.ONE,e.ONE);break;case Q:e.blendEquation(e.FUNC_ADD),e.blendFunc(e.ONE,e.ZERO);break;case Y:e.blendEquationSeparate(e.FUNC_REVERSE_SUBTRACT,e.FUNC_ADD),e.blendFuncSeparate(e.ONE,e.ONE,e.ONE,e.ONE_MINUS_SRC_ALPHA);break;case H:this.blendExt?(e.blendEquationSeparate(this.blendExt.MIN||this.blendExt.MIN_EXT,e.FUNC_ADD),e.blendFuncSeparate(e.ONE,e.ONE,e.ONE,e.ONE)):console.warn("blendMode(DARKEST) does not work in your browser in WEBGL mode.");break;case W:this.blendExt?(e.blendEquationSeparate(this.blendExt.MAX||this.blendExt.MAX_EXT,e.FUNC_ADD),e.blendFuncSeparate(e.ONE,e.ONE,e.ONE,e.ONE)):console.warn("blendMode(LIGHTEST) does not work in your browser in WEBGL mode.");break;default:console.error("Oops! Somehow RendererGL set curBlendMode to an unsupported mode.")}this._cachedBlendMode=this.states.curBlendMode},oa.prototype.shader=function(e){this.states.setValue("userFillShader",e),this.states.setValue("_useNormalMaterial",!1),e.ensureCompiledOnContext(this),e.setDefaultUniforms()},oa.prototype.strokeShader=function(e){this.states.setValue("userStrokeShader",e),e.ensureCompiledOnContext(this),e.setDefaultUniforms()},oa.prototype.imageShader=function(e){this.states.setValue("userImageShader",e),e.ensureCompiledOnContext(this),e.setDefaultUniforms()},oa.prototype.resetShader=function(){this.states.setValue("userFillShader",null),this.states.setValue("userStrokeShader",null),this.states.setValue("userImageShader",null)},oa.prototype.texture=function(e){this.states.setValue("drawMode",ye),this.states.setValue("_useNormalMaterial",!1),this.states.setValue("_tex",e),this.states.setValue("fillColor",new dr([1,1,1]))},oa.prototype.normalMaterial=function(...e){this.states.setValue("drawMode",me),this.states.setValue("_useSpecularMaterial",!1),this.states.setValue("_useEmissiveMaterial",!1),this.states.setValue("_useNormalMaterial",!0),this.states.setValue("curFillColor",[1,1,1,1]),this.states.setValue("fillColor",new dr([1,1,1])),this.states.setValue("strokeColor",null)},oa.prototype.shininess=function(e){e<1&&(e=1),this.states.setValue("_useShininess",e)},oa.prototype.metalness=function(e){const t=1-Math.exp(-e/100);this.states.setValue("_useMetalness",t)}}function fa(e,t){const i=t.DEGREES="degrees",r=t.RADIANS="radians";t._angleMode=r,t.acos=function(e){return this._fromRadians(Math.acos(e))},t.asin=function(e){return this._fromRadians(Math.asin(e))},t.atan=function(e){return this._fromRadians(Math.atan(e))},t.atan2=function(e,t){return this._fromRadians(Math.atan2(e,t))},t.cos=function(e){return Math.cos(this._toRadians(e))},t.sin=function(e){return Math.sin(this._toRadians(e))},t.tan=function(e){return Math.tan(this._toRadians(e))},t.degrees=e=>e*b,t.radians=e=>e*v,t.angleMode=function(e){if(void 0===e)return this._angleMode;if(e===i||e===r){if(e===this._angleMode)return;e===r?(this.pRotationX=this.pRotationX*v,this.pRotationY=this.pRotationY*v,this.pRotationZ=this.pRotationZ*v):(this.pRotationX=this.pRotationX*b,this.pRotationY=this.pRotationY*b,this.pRotationZ=this.pRotationZ*b),this._angleMode=e}},t._toRadians=function(e){return this._angleMode===i?e*v:e},t._toDegrees=function(e){return this._angleMode===r?e*b:e},t._fromRadians=function(e){return this._angleMode===i?e*b:e},t._fromDegrees=function(e){return this._angleMode===r?e*v:e}}void 0!==p5&&ha(p5,p5.prototype),void 0!==p5&&ca(p5,p5.prototype),void 0!==p5&&pa(0,p5.prototype),void 0!==p5&&loading(p5,p5.prototype),void 0!==p5&&fa(0,p5.prototype);class ga{constructor(e,t,i,n,s){const a=i||r;return this._pInst=n,this._renderer=new Ea[a](this,e,t,!1,s),this._initializeInstanceVariables(this),this._renderer._applyDefaults(),this}get elt(){return this.canvas}get deltaTime(){return this._pInst.deltaTime}get canvas(){return this._renderer?.canvas}get drawingContext(){return this._renderer.drawingContext}get width(){return this._renderer?.width}get height(){return this._renderer?.height}get pixels(){return this._renderer?.pixels}pixelDensity(e){let t;return"number"==typeof e?(e!==this._renderer._pixelDensity&&(this._renderer._pixelDensity=e),t=this,this.resizeCanvas(this.width,this.height,!0)):t=this._renderer._pixelDensity,t}resizeCanvas(e,t){this._renderer.resize(e,t)}reset(){this._renderer.resetMatrix(),this._renderer.isP3D&&this._renderer._update()}remove(){this._renderer.remove(),this._renderer=void 0}createFramebuffer(e){return new Ca(this._renderer,e)}_assert3d(e){if(!this._renderer.isP3D)throw new Error(`${e}() is only supported in WEBGL mode. If you'd like to use 3D graphics and WebGL, see https://p5js.org/examples/form-3d-primitives.html for more information.`)}_initializeInstanceVariables(){this._accessibleOutputs={text:!1,grid:!1,textLabel:!1,gridLabel:!1},this._styles=[],this._downKeys={}}}class ma{constructor(e,t,i){this._renderer=e;const r=this._renderer.GL;i=i||{},this.src=t,this.glTex=void 0,this.glTarget=r.TEXTURE_2D,this.glFormat=i.format||r.RGBA,this.mipmaps=!1,this.glMinFilter=i.minFilter||r.LINEAR,this.glMagFilter=i.magFilter||r.LINEAR,this.glWrapS=i.wrapS||r.CLAMP_TO_EDGE,this.glWrapT=i.wrapT||r.CLAMP_TO_EDGE,this.glDataType=i.dataType||r.UNSIGNED_BYTE;const n=va(e);this.glFormat!==r.HALF_FLOAT||n.halfFloat||(console.log("This device does not support dataType HALF_FLOAT. Falling back to FLOAT."),this.glDataType=r.FLOAT),this.glFormat!==r.HALF_FLOAT||this.glMinFilter!==r.LINEAR&&this.glMagFilter!==r.LINEAR||n.halfFloatLinear||(console.log("This device does not support linear filtering for dataType FLOAT. Falling back to NEAREST."),this.glMinFilter===r.LINEAR&&(this.glMinFilter=r.NEAREST),this.glMagFilter===r.LINEAR&&(this.glMagFilter=r.NEAREST)),this.glFormat!==r.FLOAT||n.float||(console.log("This device does not support dataType FLOAT. Falling back to UNSIGNED_BYTE."),this.glDataType=r.UNSIGNED_BYTE),this.glFormat!==r.FLOAT||this.glMinFilter!==r.LINEAR&&this.glMagFilter!==r.LINEAR||n.floatLinear||(console.log("This device does not support linear filtering for dataType FLOAT. Falling back to NEAREST."),this.glMinFilter===r.LINEAR&&(this.glMinFilter=r.NEAREST),this.glMagFilter===r.LINEAR&&(this.glMagFilter=r.NEAREST)),this.isSrcMediaElement=!1,this._videoPrevUpdateTime=0,this.isSrcHTMLElement=void 0!==kr&&t instanceof kr&&!(t instanceof ga)&&!(t instanceof En),this.isSrcP5Image=t instanceof Hr,this.isSrcP5Graphics=t instanceof ga,this.isSrcP5Renderer=t instanceof En,this.isImageData="undefined"!=typeof ImageData&&t instanceof ImageData,this.isFramebufferTexture=t instanceof wa;const s=this._getTextureDataFromSource();return this.width=s.width,this.height=s.height,this.init(s),this}remove(){if(this.glTex){this._renderer.GL.deleteTexture(this.glTex),this.glTex=void 0}}_getTextureDataFromSource(){let e;return this.isFramebufferTexture?e=this.src.rawTexture():this.isSrcP5Image?e=this.src.canvas:this.isSrcMediaElement||this.isSrcHTMLElement?(this.src._ensureCanvas&&this.src._ensureCanvas(),e=this.src.elt):this.isSrcP5Graphics||this.isSrcP5Renderer?e=this.src.canvas:this.isImageData&&(e=this.src),e}init(e){const t=this._renderer.GL;if(this.isFramebufferTexture||(this.glTex=t.createTexture()),this.glWrapS=this._renderer.states.textureWrapX,this.glWrapT=this._renderer.states.textureWrapY,this.setWrapMode(this.glWrapS,this.glWrapT),this.bindTexture(),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,this.glMagFilter),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,this.glMinFilter),this.isFramebufferTexture);else if(0===this.width||0===this.height||this.isSrcMediaElement&&!this.src.loadedmetadata){const e=new Uint8Array([1,1,1,1]);t.texImage2D(this.glTarget,0,t.RGBA,1,1,0,this.glFormat,this.glDataType,e)}else t.texImage2D(this.glTarget,0,this.glFormat,this.glFormat,this.glDataType,e)}update(){const e=this.src;if(0===e.width||0===e.height)return!1;if(this.isFramebufferTexture)return this.src.update(),!1;const t=this._getTextureDataFromSource();let i=!1;const r=this._renderer.GL;return t.width!==this.width||t.height!==this.height?(i=!0,this.width=t.width||e.width,this.height=t.height||e.height,this.isSrcP5Image?e.setModified(!1):(this.isSrcMediaElement||this.isSrcHTMLElement)&&e.setModified&&e.setModified(!0)):this.isSrcP5Image?e.isModified()&&(i=!0,e.setModified(!1)):this.isSrcMediaElement?e.isModified()?(i=!0,e.setModified(!1)):e.loadedmetadata&&this._videoPrevUpdateTime!==e.time()&&(this._videoPrevUpdateTime=e.time(),i=!0):this.isImageData?e._dirty&&(e._dirty=!1,i=!0):i=!0,i&&(this.bindTexture(),r.texImage2D(this.glTarget,0,this.glFormat,this.glFormat,this.glDataType,t)),i}bindTexture(){return this._renderer.GL.bindTexture(this.glTarget,this.getTexture()),this}unbindTexture(){this._renderer.GL.bindTexture(this.glTarget,null)}getTexture(){return this.isFramebufferTexture?this.src.rawTexture():this.glTex}setInterpolation(e,t){const i=this._renderer.GL;this.glMinFilter=this.glFilter(e),this.glMagFilter=this.glFilter(t),this.bindTexture(),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MIN_FILTER,this.glMinFilter),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MAG_FILTER,this.glMagFilter),this.unbindTexture()}glFilter(e){const t=this._renderer.GL;return e===ve?t.NEAREST:t.LINEAR}setWrapMode(e,t){const i=this._renderer.GL,r=e=>!(e&e-1),n=this._getTextureDataFromSource();let a,o;n.naturalWidth&&n.naturalHeight?(a=n.naturalWidth,o=n.naturalHeight):(a=this.width,o=this.height);const h=r(a),u=r(o);e===be?this._renderer.webglVersion===s||h&&u?this.glWrapS=i.REPEAT:(console.warn("You tried to set the wrap mode to REPEAT but the texture size is not a power of two. Setting to CLAMP instead"),this.glWrapS=i.CLAMP_TO_EDGE):e===we?this._renderer.webglVersion===s||h&&u?this.glWrapS=i.MIRRORED_REPEAT:(console.warn("You tried to set the wrap mode to MIRROR but the texture size is not a power of two. Setting to CLAMP instead"),this.glWrapS=i.CLAMP_TO_EDGE):this.glWrapS=i.CLAMP_TO_EDGE,t===be?this._renderer.webglVersion===s||h&&u?this.glWrapT=i.REPEAT:(console.warn("You tried to set the wrap mode to REPEAT but the texture size is not a power of two. Setting to CLAMP instead"),this.glWrapT=i.CLAMP_TO_EDGE):t===we?this._renderer.webglVersion===s||h&&u?this.glWrapT=i.MIRRORED_REPEAT:(console.warn("You tried to set the wrap mode to MIRROR but the texture size is not a power of two. Setting to CLAMP instead"),this.glWrapT=i.CLAMP_TO_EDGE):this.glWrapT=i.CLAMP_TO_EDGE,this.bindTexture(),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_S,this.glWrapS),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_T,this.glWrapT),this.unbindTexture()}}class ya extends ma{constructor(e,t,i){super(e,t,i);const r=this._renderer.GL;this.glMinFilter===r.LINEAR&&(this.glMinFilter=r.LINEAR_MIPMAP_LINEAR)}glFilter(e){return this._renderer.GL.LINEAR_MIPMAP_LINEAR}_getTextureDataFromSource(){return this.src}init(e){const t=this._renderer.GL;this.glTex=t.createTexture(),this.bindTexture();for(let i=0;i<e.length;i++)t.texImage2D(this.glTarget,i,this.glFormat,this.glFormat,this.glDataType,e[i]);this.glMinFilter=t.LINEAR_MIPMAP_LINEAR,t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,this.glMagFilter),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,this.glMinFilter),this.unbindTexture()}update(){}}function xa(e,t){e.Texture=ma,e.MipmapTexture=ya}function va({GL:e,webglVersion:t}){const i=e,r=t===s?i.getExtension("EXT_color_buffer_float")&&i.getExtension("EXT_float_blend"):i.getExtension("OES_texture_float"),n=r&&i.getExtension("OES_texture_float_linear"),a=t===s?i.getExtension("EXT_color_buffer_float"):i.getExtension("OES_texture_half_float");return{float:r,floatLinear:n,halfFloat:a,halfFloatLinear:a&&i.getExtension("OES_texture_half_float_linear")}}void 0!==p5&&xa(p5);const ba=(e,t,i)=>Math.max(Math.min(e,i),t);class _a extends Ss{constructor(e){super(e.renderer),this.fbo=e,this.yScale=-1}_computeCameraDefaultSettings(){super._computeCameraDefaultSettings(),this.defaultAspectRatio=this.fbo.width/this.fbo.height,this.defaultCameraFOV=2*Math.atan(this.fbo.height/2/this.defaultEyeZ)}}class wa{constructor(e,t){this.framebuffer=e,this.property=t}get width(){return this.framebuffer.width*this.framebuffer.density}get height(){return this.framebuffer.height*this.framebuffer.density}update(){this.framebuffer._update(this.property)}rawTexture(){return this.framebuffer[this.property]}}class Ca{constructor(e,t={}){this.renderer=e,this.renderer.framebuffers.add(this),this._isClipApplied=!1,this.dirty={colorTexture:!1,depthTexture:!1},this.pixels=[],this.format=t.format||ke,this.channels=t.channels||(this.renderer._pInst._glAttributes.alpha?Ar:gr),this.useDepth=void 0===t.depth||t.depth,this.depthFormat=t.depthFormat||Be,this.textureFiltering=t.textureFiltering||ge,void 0===t.antialias?this.antialiasSamples=this.renderer._pInst._glAttributes.antialias?2:0:"number"==typeof t.antialias?this.antialiasSamples=t.antialias:this.antialiasSamples=t.antialias?2:0,this.antialias=this.antialiasSamples>0,this.antialias&&this.renderer.webglVersion!==s&&(console.warn("Antialiasing is unsupported in a WebGL 1 context"),this.antialias=!1),this.density=t.density||this.renderer._pixelDensity;const i=this.renderer.GL;if(this.gl=i,t.width&&t.height){const e=this.renderer._adjustDimensions(t.width,t.height);this.width=e.adjustedWidth,this.height=e.adjustedHeight,this._autoSized=!1}else void 0===t.width!=(void 0===t.height)&&console.warn("Please supply both width and height for a framebuffer to give it a size. Only one was given, so the framebuffer will match the size of its canvas."),this.width=this.renderer.width,this.height=this.renderer.height,this._autoSized=!0;if(this._checkIfFormatsAvailable(),t.stencil&&!this.useDepth&&console.warn("A stencil buffer can only be used if also using depth. Since the framebuffer has no depth buffer, the stencil buffer will be ignored."),this.useStencil=this.useDepth&&(void 0===t.stencil||t.stencil),this.framebuffer=i.createFramebuffer(),!this.framebuffer)throw new Error("Unable to create a framebuffer");if(this.antialias&&(this.aaFramebuffer=i.createFramebuffer(),!this.aaFramebuffer))throw new Error("Unable to create a framebuffer for antialiasing");this._recreateTextures();const r=this.renderer.states.curCamera;this.defaultCamera=this.createCamera(),this.filterCamera=this.createCamera(),this.renderer.states.setValue("curCamera",r),this.draw((()=>this.renderer.clear()))}resize(e,t){this._autoSized=!1;const i=this.renderer._adjustDimensions(e,t);e=i.adjustedWidth,t=i.adjustedHeight,this.width=e,this.height=t,this._handleResize()}pixelDensity(e){if(!e)return this.density;this._autoSized=!1,this.density=e,this._handleResize()}autoSized(e){if(void 0===e)return this._autoSized;this._autoSized=e,this._handleResize()}_checkIfFormatsAvailable(){const e=this.gl;this.useDepth&&this.renderer.webglVersion===n&&!e.getExtension("WEBGL_depth_texture")&&(console.warn("Unable to create depth textures in this environment. Falling back to a framebuffer without depth."),this.useDepth=!1),this.useDepth&&this.renderer.webglVersion===n&&this.depthFormat===Be&&(console.warn("FLOAT depth format is unavailable in WebGL 1. Defaulting to UNSIGNED_INT."),this.depthFormat=Ie),[ke,Be,Le].includes(this.format)||(console.warn("Unknown Framebuffer format. Please use UNSIGNED_BYTE, FLOAT, or HALF_FLOAT. Defaulting to UNSIGNED_BYTE."),this.format=ke),this.useDepth&&![Ie,Be].includes(this.depthFormat)&&(console.warn("Unknown Framebuffer depth format. Please use UNSIGNED_INT or FLOAT. Defaulting to FLOAT."),this.depthFormat=Be);const t=va(this.renderer);t.float||this.format!==Be||(console.warn("This environment does not support FLOAT textures. Falling back to UNSIGNED_BYTE."),this.format=ke),this.useDepth&&!t.float&&this.depthFormat===Be&&(console.warn("This environment does not support FLOAT depth textures. Falling back to UNSIGNED_INT."),this.depthFormat=Ie),t.halfFloat||this.format!==Le||(console.warn("This environment does not support HALF_FLOAT textures. Falling back to UNSIGNED_BYTE."),this.format=ke),this.channels===gr&&[Be,Le].includes(this.format)&&(console.warn("FLOAT and HALF_FLOAT formats do not work cross-platform with only RGB channels. Falling back to RGBA."),this.channels=Ar)}_recreateTextures(){const e=this.gl;this._updateSize();const t=e.getParameter(e.TEXTURE_BINDING_2D),i=e.getParameter(e.FRAMEBUFFER_BINDING),r=e.createTexture();if(!r)throw new Error("Unable to create color texture");e.bindTexture(e.TEXTURE_2D,r);const n=this._glColorFormat();if(e.texImage2D(e.TEXTURE_2D,0,n.internalFormat,this.width*this.density,this.height*this.density,0,n.format,n.type,null),this.colorTexture=r,e.bindFramebuffer(e.FRAMEBUFFER,this.framebuffer),e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,r,0),this.useDepth){const t=e.createTexture();if(!t)throw new Error("Unable to create depth texture");const i=this._glDepthFormat();e.bindTexture(e.TEXTURE_2D,t),e.texImage2D(e.TEXTURE_2D,0,i.internalFormat,this.width*this.density,this.height*this.density,0,i.format,i.type,null),e.framebufferTexture2D(e.FRAMEBUFFER,this.useStencil?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT,e.TEXTURE_2D,t,0),this.depthTexture=t}if(this.antialias){if(this.colorRenderbuffer=e.createRenderbuffer(),e.bindRenderbuffer(e.RENDERBUFFER,this.colorRenderbuffer),e.renderbufferStorageMultisample(e.RENDERBUFFER,Math.max(0,Math.min(this.antialiasSamples,e.getParameter(e.MAX_SAMPLES))),n.internalFormat,this.width*this.density,this.height*this.density),this.useDepth){const t=this._glDepthFormat();this.depthRenderbuffer=e.createRenderbuffer(),e.bindRenderbuffer(e.RENDERBUFFER,this.depthRenderbuffer),e.renderbufferStorageMultisample(e.RENDERBUFFER,Math.max(0,Math.min(this.antialiasSamples,e.getParameter(e.MAX_SAMPLES))),t.internalFormat,this.width*this.density,this.height*this.density)}e.bindFramebuffer(e.FRAMEBUFFER,this.aaFramebuffer),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.RENDERBUFFER,this.colorRenderbuffer),this.useDepth&&e.framebufferRenderbuffer(e.FRAMEBUFFER,this.useStencil?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT,e.RENDERBUFFER,this.depthRenderbuffer)}if(this.useDepth){this.depth=new wa(this,"depthTexture");const t=e.NEAREST;this.depthP5Texture=new ma(this.renderer,this.depth,{minFilter:t,magFilter:t}),this.renderer.textures.set(this.depth,this.depthP5Texture)}this.color=new wa(this,"colorTexture");const s=this.textureFiltering===ge?e.LINEAR:e.NEAREST;this.colorP5Texture=new ma(this.renderer,this.color,{minFilter:s,magFilter:s}),this.renderer.textures.set(this.color,this.colorP5Texture),e.bindTexture(e.TEXTURE_2D,t),e.bindFramebuffer(e.FRAMEBUFFER,i)}_glColorFormat(){let e,t,i;const r=this.gl;if(e=this.format===Be?r.FLOAT:this.format===Le?this.renderer.webglVersion===s?r.HALF_FLOAT:r.getExtension("OES_texture_half_float").HALF_FLOAT_OES:r.UNSIGNED_BYTE,t=this.channels===Ar?r.RGBA:r.RGB,this.renderer.webglVersion===s){i={[r.FLOAT]:{[r.RGBA]:r.RGBA32F},[r.HALF_FLOAT]:{[r.RGBA]:r.RGBA16F},[r.UNSIGNED_BYTE]:{[r.RGBA]:r.RGBA8,[r.RGB]:r.RGB8}}[e][t]}else i=this.format===Le?r.RGBA:t;return{internalFormat:i,format:t,type:e}}_glDepthFormat(){let e,t,i;const r=this.gl;return e=this.useStencil?this.depthFormat===Be?r.FLOAT_32_UNSIGNED_INT_24_8_REV:this.renderer.webglVersion===s?r.UNSIGNED_INT_24_8:r.getExtension("WEBGL_depth_texture").UNSIGNED_INT_24_8_WEBGL:this.depthFormat===Be?r.FLOAT:r.UNSIGNED_INT,t=this.useStencil?r.DEPTH_STENCIL:r.DEPTH_COMPONENT,i=this.useStencil?this.depthFormat===Be?r.DEPTH32F_STENCIL8:this.renderer.webglVersion===s?r.DEPTH24_STENCIL8:r.DEPTH_STENCIL:this.renderer.webglVersion===s?this.depthFormat===Be?r.DEPTH_COMPONENT32F:r.DEPTH_COMPONENT24:r.DEPTH_COMPONENT,{internalFormat:i,format:t,type:e}}_updateSize(){this._autoSized&&(this.width=this.renderer.width,this.height=this.renderer.height,this.density=this.renderer._pixelDensity)}_canvasSizeChanged(){this._autoSized&&this._handleResize()}_handleResize(){const e=this.color,t=this.depth,i=this.colorRenderbuffer,r=this.depthRenderbuffer;this._deleteTexture(e),t&&this._deleteTexture(t);const n=this.gl;i&&n.deleteRenderbuffer(i),r&&n.deleteRenderbuffer(r),this._recreateTextures(),this.defaultCamera._resize()}createCamera(){const e=new _a(this);return e._computeCameraDefaultSettings(),e._setDefaultCamera(),e}_deleteTexture(e){this.gl.deleteTexture(e.rawTexture()),this.renderer.textures.delete(e)}remove(){const e=this.gl;this._deleteTexture(this.color),this.depth&&this._deleteTexture(this.depth),e.deleteFramebuffer(this.framebuffer),this.aaFramebuffer&&e.deleteFramebuffer(this.aaFramebuffer),this.depthRenderbuffer&&e.deleteRenderbuffer(this.depthRenderbuffer),this.colorRenderbuffer&&e.deleteRenderbuffer(this.colorRenderbuffer),this.renderer.framebuffers.delete(this)}begin(){this.prevFramebuffer=this.renderer.activeFramebuffer(),this.prevFramebuffer&&this.prevFramebuffer._beforeEnd(),this.renderer.activeFramebuffers.push(this),this._beforeBegin(),this.renderer.push(),this.renderer.states.setValue("curCamera",this.defaultCamera),this.renderer.states.setValue("uPMatrix",this.renderer.states.uPMatrix.clone()),this.renderer.states.uPMatrix.set(this.defaultCamera.projMatrix),this.renderer.states.setValue("uViewMatrix",this.renderer.states.uViewMatrix.clone()),this.renderer.states.uViewMatrix.set(this.defaultCamera.cameraMatrix),this.renderer.resetMatrix(),this.renderer.states.uViewMatrix.set(this.renderer.states.curCamera.cameraMatrix),this.renderer.states.uModelMatrix.reset(),this.renderer._applyStencilTestIfClipping()}_framebufferToBind(){return this.antialias?this.aaFramebuffer:this.framebuffer}_update(e){if(this.dirty[e]&&this.antialias){const t=this.gl;t.bindFramebuffer(t.READ_FRAMEBUFFER,this.aaFramebuffer),t.bindFramebuffer(t.DRAW_FRAMEBUFFER,this.framebuffer);const i={colorTexture:[t.COLOR_BUFFER_BIT,this.colorP5Texture.glMagFilter]};this.useDepth&&(i.depthTexture=[t.DEPTH_BUFFER_BIT,this.depthP5Texture.glMagFilter]);const[r,n]=i[e];t.blitFramebuffer(0,0,this.width*this.density,this.height*this.density,0,0,this.width*this.density,this.height*this.density,r,n),this.dirty[e]=!1;const s=this.renderer.activeFramebuffer();s?t.bindFramebuffer(t.FRAMEBUFFER,s._framebufferToBind()):t.bindFramebuffer(t.FRAMEBUFFER,null)}}_beforeBegin(){const e=this.gl;e.bindFramebuffer(e.FRAMEBUFFER,this._framebufferToBind()),this.renderer.viewport(this.width*this.density,this.height*this.density)}_beforeEnd(){this.antialias&&(this.dirty={colorTexture:!0,depthTexture:!0})}end(){const e=this.gl;this.renderer.pop();if(this.renderer.activeFramebuffers.pop()!==this)throw new Error("It looks like you've called end() while another Framebuffer is active.");this._beforeEnd(),this.prevFramebuffer?this.prevFramebuffer._beforeBegin():(e.bindFramebuffer(e.FRAMEBUFFER,null),this.renderer.viewport(this.renderer._origViewport.width,this.renderer._origViewport.height)),this.renderer._applyStencilTestIfClipping()}draw(e){this.begin(),e(),this.end()}loadPixels(){this._update("colorTexture");const e=this.gl,t=this.renderer.activeFramebuffer();e.bindFramebuffer(e.FRAMEBUFFER,this.framebuffer);const i=this._glColorFormat();this.pixels=ua(this.pixels,e,this.framebuffer,0,0,this.width*this.density,this.height*this.density,i.format,i.type),t?e.bindFramebuffer(e.FRAMEBUFFER,t._framebufferToBind()):e.bindFramebuffer(e.FRAMEBUFFER,null)}get(e,t,i,r){this._update("colorTexture");const n=this._glColorFormat();if(void 0===e&&void 0===t)e=0,t=0,i=this.width,r=this.height;else if(void 0===i&&void 0===r)return(e<0||t<0||e>=this.width||t>=this.height)&&(console.warn("The x and y values passed to p5.Framebuffer.get are outside of its range and will be clamped."),e=ba(e,0,this.width-1),t=ba(t,0,this.height-1)),la(this.gl,this.framebuffer,e*this.density,t*this.density,n.format,n.type);e=ba(e,0,this.width-1),t=ba(t,0,this.height-1),i=ba(i,1,this.width-e),r=ba(r,1,this.height-t);const s=ua(void 0,this.gl,this.framebuffer,e*this.density,t*this.density,i*this.density,r*this.density,n.format,n.type),a=new Uint8ClampedArray(i*r*this.density*this.density*4);a.fill(255);const o=n.type===this.gl.RGB?3:4;for(let e=0;e<r*this.density;e++)for(let t=0;t<i*this.density;t++)for(let r=0;r<4;r++){const n=4*(e*i*this.density+t)+r;if(r<o){const h=4===o?n:(e*i*this.density+t)*o+r;a[n]=s[h]}}const h=new Hr(i*this.density,r*this.density);return h.imageData=h.canvas.getContext("2d").createImageData(h.width,h.height),h.imageData.data.set(a),h.pixels=h.imageData.data,h.updatePixels(),1!==this.density&&h.resize(i,r),h}updatePixels(){const e=this.gl;this.colorP5Texture.bindTexture();const t=this._glColorFormat(),i=t.format===e.RGBA?4:3,r=this.width*this.height*this.density*this.density*i,n=t.type===e.UNSIGNED_BYTE?Uint8Array:Float32Array;if(!(this.pixels instanceof n)||this.pixels.length!==r)throw new Error("The pixels array has not been set correctly. Please call loadPixels() before updatePixels().");e.texImage2D(e.TEXTURE_2D,0,t.internalFormat,this.width*this.density,this.height*this.density,0,t.format,t.type,this.pixels),this.colorP5Texture.unbindTexture(),this.dirty.colorTexture=!1;const s=this.renderer.activeFramebuffer();this.antialias?(this.begin(),this.renderer.push(),this.renderer.states.setValue("imageMode",_),this.renderer.setCamera(this.filterCamera),this.renderer.resetMatrix(),this.renderer.states.setValue("strokeColor",null),this.renderer.clear(),this.renderer._drawingFilter=!0,this.renderer.image(this,0,0,this.width,this.height,-this.renderer.width/2,-this.renderer.height/2,this.renderer.width,this.renderer.height),this.renderer._drawingFilter=!1,this.renderer.pop(),this.useDepth&&(e.clearDepth(1),e.clear(e.DEPTH_BUFFER_BIT)),this.end()):(e.bindFramebuffer(e.FRAMEBUFFER,this.framebuffer),this.useDepth&&(e.clearDepth(1),e.clear(e.DEPTH_BUFFER_BIT)),s?e.bindFramebuffer(e.FRAMEBUFFER,s._framebufferToBind()):e.bindFramebuffer(e.FRAMEBUFFER,null))}}function Aa(e,t){e.FramebufferCamera=_a,e.FramebufferTexture=wa,e.Framebuffer=Ca}let Ea;function Da(e,t){Ea=e.renderers={},t.createCanvas=function(e,t,i,...n){let s=r;return Reflect.ownKeys(Ea).includes(i)?s=i:n.unshift(i),this._renderer&&this._renderer.remove(),this._renderer=new Ea[s](this,e,t,!0,...n),this._defaultGraphicsCreated=!0,this._elements.push(this._renderer),this._renderer._applyDefaults(),Object.hasOwn(this,"pixels")||Object.defineProperty(this,"pixels",{get(){return this._renderer?.pixels}}),this._renderer},t.resizeCanvas=function(e,t,i){this._renderer&&(this._renderer.resize(e,t),i||this.redraw()),this._addAccsOutput()&&this._updateAccsOutput()},t.noCanvas=function(){this.canvas&&this.canvas.parentNode.removeChild(this.canvas)},t.createGraphics=function(t,i,...n){return n[0]instanceof HTMLCanvasElement&&(n[1]=n[0],n[0]=r),new e.Graphics(t,i,n[0],this,n[1])},t.createFramebuffer=function(e){return new Ca(this._renderer,e)},t.clearDepth=function(e){this._assert3d("clearDepth"),this._renderer.clearDepth(e)}}void 0!==p5&&Aa(p5),void 0!==p5&&Da(p5,p5.prototype);class Sa{constructor(e){this.pInst=e,this.canvas=document.createElement("canvas"),this.canvas.width=e.width,this.canvas.height=e.height;let t=s;this.gl=this.canvas.getContext("webgl2"),this.gl||(t=n,this.gl=this.canvas.getContext("webgl")),this.gl?(this._renderer={GL:this.gl,registerEnabled:new Set,_curShader:null,_emptyTexture:null,webglVersion:t,states:{textureWrapX:this.gl.CLAMP_TO_EDGE,textureWrapY:this.gl.CLAMP_TO_EDGE},_arraysEqual:(e,t)=>JSON.stringify(e)===JSON.stringify(t),_getEmptyTexture:()=>{if(!this._emptyTexture){const e=new Hr(1,1);e.set(0,0,255),this._emptyTexture=new ma(this._renderer,e)}return this._emptyTexture}},this._baseFilterShader=void 0,this.filterShaderSources={[pe]:Ws,[he]:Zs,[se]:Ks,[ce]:qs,[ae]:$s,[le]:Hs,[ue]:Xs,[oe]:Ys},this.filterShaders={},this.operation=null,this.filterParameter=1,this.customShader=null,this._shader=null,this.vertexBuffer=this.gl.createBuffer(),this.texcoordBuffer=this.gl.createBuffer(),this.vertices=new Float32Array([-1,-1,1,-1,-1,1,1,1]),this.texcoords=new Float32Array([0,1,1,1,0,0,1,0]),this._bindBufferData(this.vertexBuffer,this.gl.ARRAY_BUFFER,this.vertices),this._bindBufferData(this.texcoordBuffer,this.gl.ARRAY_BUFFER,this.texcoords)):console.error("WebGL not supported, cannot apply filter.")}_webGL2CompatibilityPrefix(e,t){let i="";return this._renderer.webglVersion===s&&(i+="#version 300 es\n#define WEBGL2\n"),"vert"===e?i+="#define VERTEX_SHADER\n":"frag"===e&&(i+="#define FRAGMENT_SHADER\n"),t&&(i+=`precision ${t} float;\n`),i}baseFilterShader(){return this._baseFilterShader||(this._baseFilterShader=new ks(this._renderer,this._webGL2CompatibilityPrefix("vert","highp")+Gs+Us,this._webGL2CompatibilityPrefix("frag","highp")+Gs+js,{vertex:{},fragment:{"vec4 getColor":"(FilterInputs inputs, in sampler2D canvasContent) {\n return getTexture(canvasContent, inputs.texCoord);\n }"}})),this._baseFilterShader}setOperation(e,t,i=null){this.operation=e,this.filterParameter=t,e in Vs&&void 0===t&&(this.filterParameter=Vs[e]),this.customShader=i,this._initializeShader()}_initializeShader(){if(this.customShader)return void(this._shader=this.customShader);if(!this.operation)return void console.error("No operation set for FilterRenderer2D, cannot initialize shader.");if(this.filterShaders[this.operation])return void(this._shader=this.filterShaders[this.operation]);const e=this.filterShaderSources[this.operation];if(!e)return void console.error("No shader available for this operation:",this.operation);const t=new ks(this._renderer,Js,e);this.filterShaders[this.operation]=t,this._shader=t}_bindBufferData(e,t,i){const r=this.gl;r.bindBuffer(t,e),r.bufferData(t,i,r.STATIC_DRAW)}get canvasTexture(){return this._canvasTexture||(this._canvasTexture=new ma(this._renderer,this.pInst.wrappedElt)),this._canvasTexture}_renderPass(){const e=this.gl;this._shader.bindShader();const t=this.pInst.pixelDensity?this.pInst.pixelDensity():1,i=[1/(this.pInst.width*t),1/(this.pInst.height*t)],r=this.canvasTexture;this._shader.setUniform("tex0",r),this._shader.setUniform("texelSize",i),this._shader.setUniform("canvasSize",[this.pInst.width,this.pInst.height]),this._shader.setUniform("radius",Math.max(1,this.filterParameter)),this._shader.setUniform("filterParameter",this.filterParameter),this._shader.setDefaultUniforms(),this.pInst.states.setValue("rectMode",_),this.pInst.states.setValue("imageMode",_),this.pInst.blendMode(j),this.pInst.resetMatrix();const n=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];this._shader.setUniform("uModelViewMatrix",n),this._shader.setUniform("uProjectionMatrix",n),e.bindBuffer(e.ARRAY_BUFFER,this.vertexBuffer),this._shader.enableAttrib(this._shader.attributes.aPosition,2),e.bindBuffer(e.ARRAY_BUFFER,this.texcoordBuffer),this._shader.enableAttrib(this._shader.attributes.aTexCoord,2),this._shader.bindTextures(),this._shader.disableRemainingAttributes(),e.drawArrays(e.TRIANGLE_STRIP,0,4),this._shader.unbindShader()}applyFilter(){this._shader?(this.pInst.push(),this.pInst.resetMatrix(),this.operation!==pe||this.customShader?(this._renderPass(),this.pInst.clear(),this.pInst.blendMode(j),this.pInst.drawingContext.drawImage(this.canvas,0,0,this.pInst.width,this.pInst.height)):(this._shader.setUniform("direction",[1,0]),this._renderPass(),this.pInst.clear(),this.pInst.drawingContext.drawImage(this.canvas,0,0,this.pInst.width,this.pInst.height),this._shader.setUniform("direction",[0,1]),this._renderPass(),this.pInst.clear(),this.pInst.drawingContext.drawImage(this.canvas,0,0,this.pInst.width,this.pInst.height)),this.pInst.pop()):console.error("Cannot apply filter: shader not initialized.")}}const Fa="rgba(0,0,0,0)";class Ta extends En{constructor(e,t,i,r,n,s={}){super(e,t,i,r),this.canvas=this.elt=n||document.createElement("canvas"),r?(this._pInst._curElement=this,this._pInst.canvas=this.canvas):this.canvas.style.display="none",this.elt.id="defaultCanvas0",this.elt.classList.add("p5Canvas");for(const e of Object.getOwnPropertyNames(kr.prototype))"constructor"!==e&&"_"!==e[0]&&Object.defineProperty(this,e,{get(){return this.wrappedElt[e]}});if(this.elt.width=t*this._pixelDensity,this.elt.height=i*this._pixelDensity,this.elt.style.width=`${t}px`,this.elt.style.height=`${i}px`,this._pInst._userNode)this._pInst._userNode.appendChild(this.elt);else{if(0===document.getElementsByTagName("main").length){let e=document.createElement("main");document.body.appendChild(e)}document.getElementsByTagName("main")[0].appendChild(this.elt)}this.drawingContext=this.canvas.getContext("2d",s),"display-p3"===s.colorSpace&&(this.states.colorMode=mr),this.scale(this._pixelDensity,this._pixelDensity),this.wrappedElt=new kr(this.elt,this._pInst),this.clipPath=null}get filterRenderer(){return this._filterRenderer||(this._filterRenderer=new Sa(this)),this._filterRenderer}remove(){this.wrappedElt.remove(),this.wrappedElt=null,this.canvas=null,this.elt=null}getFilterGraphicsLayer(){if(!this.filterGraphicsLayer){const e=this._pInst;this.filterGraphicsLayer=new ga(this.width,this.height,n,e)}return this.filterGraphicsLayer.width===this.width&&this.filterGraphicsLayer.height===this.height||this.filterGraphicsLayer.resizeCanvas(this.width,this.height),this.filterGraphicsLayer.pixelDensity()!==this._pInst.pixelDensity()&&this.filterGraphicsLayer.pixelDensity(this._pInst.pixelDensity()),this.filterGraphicsLayer}_applyDefaults(){this.states.setValue("_cachedFillStyle",void 0),this.states.setValue("_cachedStrokeStyle",void 0),this._cachedBlendMode=j,this._setFill(De),this._setStroke(Ee),this.drawingContext.lineCap=V,this.drawingContext.font="normal 12px sans-serif"}resize(e,t){super.resize(e,t);const i={};for(const e in this.drawingContext){const t=this.drawingContext[e];"object"!=typeof t&&"function"!=typeof t&&(i[e]=t)}this.canvas.width=e*this._pixelDensity,this.canvas.height=t*this._pixelDensity,this.canvas.style.width=`${e}px`,this.canvas.style.height=`${t}px`,this.drawingContext.scale(this._pixelDensity,this._pixelDensity);for(const e in i)try{this.drawingContext[e]=i[e]}catch(e){}}background(...e){if(this.push(),this.resetMatrix(),e[0]instanceof Hr)if(e[1]>=0){const t=e[0];this.drawingContext.globalAlpha=e[1]/255,this._pInst.image(t,0,0,this.width,this.height)}else this._pInst.image(e[0],0,0,this.width,this.height);else{const t=this._pInst.color(...e);this._pInst._addAccsOutput?.()&&this._pInst._accsBackground?.(t._getRGBA([255,255,255,255]));const i=t.toString();this._setFill(i),this._isErasing&&this.blendMode(this._cachedBlendMode),this.drawingContext.fillRect(0,0,this.width,this.height),this._isErasing&&this._pInst.erase()}this.pop()}clear(){this.drawingContext.save(),this.resetMatrix(),this.drawingContext.clearRect(0,0,this.width,this.height),this.drawingContext.restore()}fill(...e){super.fill(...e);const t=this.states.fillColor;this._setFill(t.toString()),this._pInst._addAccsOutput?.()&&this._pInst._accsCanvasColors?.("fill",t._getRGBA([255,255,255,255]))}stroke(...e){super.stroke(...e);const t=this.states.strokeColor;this._setStroke(t.toString()),this._pInst._addAccsOutput?.()&&this._pInst._accsCanvasColors?.("stroke",t._getRGBA([255,255,255,255]))}erase(e,t){if(!this._isErasing){this.states.setValue("_cachedFillStyle",this.drawingContext.fillStyle);const i=this._pInst.color(255,e).toString();this.drawingContext.fillStyle=i,this.states.setValue("_cachedStrokeStyle",this.drawingContext.strokeStyle);const r=this._pInst.color(255,t).toString();this.drawingContext.strokeStyle=r;const n=this._cachedBlendMode;this.blendMode($),this._cachedBlendMode=n,this._isErasing=!0}}noErase(){this._isErasing&&(this.drawingContext.fillStyle=this.states._cachedFillStyle,this.drawingContext.strokeStyle=this.states._cachedStrokeStyle,this.blendMode(this._cachedBlendMode),this._isErasing=!1)}drawShape(e){const t=new vn({strokeWeight:this.states.strokeWeight});e.accept(t),this._clipping?(this.clipPath.addPath(t.path),this.clipPath.closePath()):(this.states.fillColor&&this.drawingContext.fill(t.path),this.states.strokeColor&&this.drawingContext.stroke(t.path))}beginClip(e={}){super.beginClip(e),this.states.setValue("_cachedFillStyle",this.drawingContext.fillStyle);const t=this._pInst.color(255,0).toString();this.drawingContext.fillStyle=t,this.states.setValue("_cachedStrokeStyle",this.drawingContext.strokeStyle);const i=this._pInst.color(255,0).toString();this.drawingContext.strokeStyle=i;const r=this._cachedBlendMode;this.blendMode(j),this._cachedBlendMode=r,this.clipPath=new Path2D,this._clipInvert&&(this.clipPath.moveTo(-2*this.width,-2*this.height),this.clipPath.lineTo(-2*this.width,2*this.height),this.clipPath.lineTo(2*this.width,2*this.height),this.clipPath.lineTo(2*this.width,-2*this.height),this.clipPath.closePath())}endClip(){this.drawingContext.clip(this.clipPath),this.clipPath=null,super.endClip(),this.drawingContext.fillStyle=this.states._cachedFillStyle,this.drawingContext.strokeStyle=this.states._cachedStrokeStyle,this.blendMode(this._cachedBlendMode)}image(e,t,i,r,n,s,a,o,h){let u;e.gifProperties&&e._animateGif(this._pInst);try{e instanceof Tn&&e._ensureCanvas(),this.states.tint&&e.canvas&&(u=this._getTintedImageCanvas(e)),u||(u=e.canvas||e.elt);let l=1;e.width&&e.width>0&&(l=u.width/e.width),this._isErasing&&this.blendMode(this._cachedBlendMode),this.drawingContext.drawImage(u,l*t,l*i,l*r,l*n,s,a,o,h),this._isErasing&&this._pInst.erase()}catch(e){if("NS_ERROR_NOT_AVAILABLE"!==e.name)throw e}}_getTintedImageCanvas(e){if(!e.canvas)return e;e.tintCanvas||(e.tintCanvas=document.createElement("canvas")),e.tintCanvas.width!==e.canvas.width&&(e.tintCanvas.width=e.canvas.width),e.tintCanvas.height!==e.canvas.height&&(e.tintCanvas.height=e.canvas.height);const t=e.tintCanvas.getContext("2d");return t.save(),t.clearRect(0,0,e.canvas.width,e.canvas.height),this.states.tint[0]<255||this.states.tint[1]<255||this.states.tint[2]<255?(t.drawImage(e.canvas,0,0),t.globalCompositeOperation="luminosity",t.drawImage(e.canvas,0,0),t.globalCompositeOperation="color",t.drawImage(e.canvas,0,0),t.globalCompositeOperation="multiply",t.fillStyle=`rgb(${this.states.tint.slice(0,3).join(", ")})`,t.fillRect(0,0,e.canvas.width,e.canvas.height),t.globalCompositeOperation="destination-in",t.globalAlpha=this.states.tint[3]/255,t.drawImage(e.canvas,0,0)):(t.globalAlpha=this.states.tint[3]/255,t.drawImage(e.canvas,0,0)),t.restore(),e.tintCanvas}blendMode(e){if(e===Y)console.warn("blendMode(SUBTRACT) only works in WEBGL mode.");else{if(e!==j&&e!==$&&e!==H&&e!==W&&e!==X&&e!==K&&e!==Z&&e!==J&&e!==Q&&e!==ee&&e!==te&&e!==ie&&e!==re&&e!==ne&&e!==q)throw new Error(`Mode ${e} not recognized.`);this._cachedBlendMode=e,this.drawingContext.globalCompositeOperation=e}}blend(...e){const t=this.drawingContext.globalCompositeOperation,i=e[e.length-1],r=Array.prototype.slice.call(e,0,e.length-1);this.drawingContext.globalCompositeOperation=i,Ma.prototype.copy.apply(this,r),this.drawingContext.globalCompositeOperation=t}_getPixel(e,t){let i,r;return i=this.drawingContext.getImageData(e,t,1,1).data,r=0,[i[0],i[1],i[2],i[3]]}loadPixels(){const e=this._pixelDensity,t=this.width*e,i=this.height*e,r=this.drawingContext.getImageData(0,0,t,i);this.imageData=r,this.pixels=r.data}set(e,t,i){if(e=Math.floor(e),t=Math.floor(t),i instanceof Hr)this.drawingContext.save(),this.drawingContext.setTransform(1,0,0,1,0,0),this.drawingContext.scale(this._pixelDensity,this._pixelDensity),this.drawingContext.clearRect(e,t,i.width,i.height),this.drawingContext.drawImage(i.canvas,e,t),this.drawingContext.restore();else{let r=0,n=0,s=0,a=0,o=4*(t*this._pixelDensity*(this.width*this._pixelDensity)+e*this._pixelDensity);if(this.imageData||this.loadPixels(),"number"==typeof i)o<this.pixels.length&&(r=i,n=i,s=i,a=255);else if(Array.isArray(i)){if(i.length<4)throw new Error("pixel array must be of the form [R, G, B, A]");o<this.pixels.length&&(r=i[0],n=i[1],s=i[2],a=i[3])}else i instanceof Ma.Color&&o<this.pixels.length&&([r,n,s,a]=i._getRGBA([255,255,255,255]));for(let i=0;i<this._pixelDensity;i++)for(let h=0;h<this._pixelDensity;h++)o=4*((t*this._pixelDensity+h)*this.width*this._pixelDensity+(e*this._pixelDensity+i)),this.pixels[o]=r,this.pixels[o+1]=n,this.pixels[o+2]=s,this.pixels[o+3]=a}}updatePixels(e,t,i,r){const n=this._pixelDensity;void 0===e&&void 0===t&&void 0===i&&void 0===r&&(e=0,t=0,i=this.width,r=this.height),e*=n,t*=n,i*=n,r*=n,this.gifProperties&&(this.gifProperties.frames[this.gifProperties.displayIndex].image=this.imageData),this.drawingContext.putImageData(this.imageData,0,0,e,t,i,r)}arc(e,t,i,r,n,s,a){const o=this.clipPa||this.drawingContext,h=e+i/2,u=t+r/2,l=i/2,c=r/2,p=!(a===O||a===L||(s-n)%x==0);return this.states.fillColor&&(this._clipping||o.beginPath(),o.ellipse(h,u,l,c,0,n,s),p&&o.lineTo(h,u),o.closePath(),this._clipping||o.fill()),this.states.strokeColor&&(this._clipping||o.beginPath(),o.ellipse(h,u,l,c,0,n,s),a===P&&p&&o.lineTo(h,u),a!==P&&a!==O||o.closePath(),this._clipping||o.stroke()),this}ellipse(e){const t=this.clipPath||this.drawingContext,i=!!this.states.fillColor,r=this.states.strokeColor,n=parseFloat(e[0]),s=parseFloat(e[1]),a=parseFloat(e[2]),o=parseFloat(e[3]);if(i&&!r){if(this._getFill()===Fa)return this}else if(!i&&r&&this._getStroke()===Fa)return this;const h=n+a/2,u=s+o/2,l=a/2,c=o/2;this._clipping||t.beginPath(),t.ellipse(h,u,l,c,0,0,2*Math.PI),t.closePath(),!this._clipping&&i&&t.fill(),!this._clipping&&r&&t.stroke()}line(e,t,i,r){const n=this.clipPath||this.drawingContext;return this.states.strokeColor?(this._getStroke()===Fa||(this._clipping||n.beginPath(),n.moveTo(e,t),n.lineTo(i,r),n.stroke()),this):this}point(e,t){const i=this.clipPath||this.drawingContext;if(!this.states.strokeColor)return this;if(this._getStroke()===Fa)return this;const r=this._getStroke(),n=this._getFill();this._clipping||this._setFill(r),this._clipping||i.beginPath(),i.arc(e,t,i.lineWidth/2,0,x,!1),this._clipping||(i.fill(),this._setFill(n))}quad(e,t,i,r,n,s,a,o){const h=this.clipPath||this.drawingContext,u=!!this.states.fillColor,l=this.states.strokeColor;if(u&&!l){if(this._getFill()===Fa)return this}else if(!u&&l&&this._getStroke()===Fa)return this;return this._clipping||h.beginPath(),h.moveTo(e,t),h.lineTo(i,r),h.lineTo(n,s),h.lineTo(a,o),h.closePath(),!this._clipping&&u&&h.fill(),!this._clipping&&l&&h.stroke(),this}rect(e){const t=e[0],i=e[1],r=e[2],n=e[3];let s=e[4],a=e[5],o=e[6],h=e[7];const u=this.clipPath||this.drawingContext,l=!!this.states.fillColor,c=this.states.strokeColor;if(l&&!c){if(this._getFill()===Fa)return this}else if(!l&&c&&this._getStroke()===Fa)return this;if(this._clipping||u.beginPath(),void 0===s)u.rect(t,i,r,n);else{void 0===a&&(a=s),void 0===o&&(o=a),void 0===h&&(h=o);const e=Math.abs(r),l=Math.abs(n),c=e/2,p=l/2;e<2*s&&(s=c),l<2*s&&(s=p),e<2*a&&(a=c),l<2*a&&(a=p),e<2*o&&(o=c),l<2*o&&(o=p),e<2*h&&(h=c),l<2*h&&(h=p),u.roundRect(t,i,r,n,[s,a,o,h])}return!this._clipping&&this.states.fillColor&&u.fill(),!this._clipping&&this.states.strokeColor&&u.stroke(),this}triangle(e){const t=this.clipPath||this.drawingContext,i=!!this.states.fillColor,r=this.states.strokeColor,n=e[0],s=e[1],a=e[2],o=e[3],h=e[4],u=e[5];if(i&&!r){if(this._getFill()===Fa)return this}else if(!i&&r&&this._getStroke()===Fa)return this;this._clipping||t.beginPath(),t.moveTo(n,s),t.lineTo(a,o),t.lineTo(h,u),t.closePath(),!this._clipping&&i&&t.fill(),!this._clipping&&r&&t.stroke()}strokeCap(e){return e!==V&&e!==R&&e!==N||(this.drawingContext.lineCap=e),this}strokeJoin(e){return e!==V&&e!==U&&e!==z||(this.drawingContext.lineJoin=e),this}strokeWeight(e){return super.strokeWeight(e),this.drawingContext.lineWidth=void 0===e||0===e?1e-4:e,this}_getFill(){return this.states._cachedFillStyle||this.states.setValue("_cachedFillStyle",this.drawingContext.fillStyle),this.states._cachedFillStyle}_setFill(e){e!==this.states._cachedFillStyle&&(this.drawingContext.fillStyle=e,this.states.setValue("_cachedFillStyle",e))}_getStroke(){return this.states._cachedStrokeStyle||this.states.setValue("_cachedStrokeStyle",this.drawingContext.strokeStyle),this.states._cachedStrokeStyle}_setStroke(e){e!==this.states._cachedStrokeStyle&&(this.drawingContext.strokeStyle=e,this.states.setValue("_cachedStrokeStyle",e))}applyMatrix(e,t,i,r,n,s){this.drawingContext.transform(e,t,i,r,n,s)}getWorldToScreenMatrix(){let e=(new DOMMatrix).scale(1/this._pixelDensity).multiply(this.drawingContext.getTransform());return new xs(e.toFloat32Array())}resetMatrix(){return this.drawingContext.setTransform(1,0,0,1,0,0),this.drawingContext.scale(this._pixelDensity,this._pixelDensity),this}rotate(e){this.drawingContext.rotate(e)}scale(e,t){return this.drawingContext.scale(e,t),this}translate(e,t){return e instanceof Ma.Vector&&(t=e.y,e=e.x),this.drawingContext.translate(e,t),this}push(){return this.drawingContext.save(),super.push()}pop(e){this.drawingContext.restore(),super.pop(e)}}let Ma=class e{static VERSION=i;static instance=null;static lifecycleHooks={presetup:[],postsetup:[],predraw:[],postdraw:[],remove:[]};static _checkForUserDefinedFunctions=()=>{};static _friendlyFileLoadError=()=>{};constructor(t,i){if(e.decorations.size>0){for(const[t,i]of e.decorations)for(const r in e.prototype)"function"==typeof e.prototype[r]&&t.some((e=>"string"==typeof e?e===r:e instanceof RegExp?e.test(r):void 0))&&(e.prototype[r]=i(e.prototype[r],{kind:"method",name:r,access:{},static:!1,private:!1,addInitializer(e){}}));e.decorations.clear()}this.hitCriticalError=!1,this._setupDone=!1,this._userNode=i,this._curElement=null,this._elements=[],this._glAttributes=null,this._requestAnimId=0,this._isGlobal=!1,this._loop=!0,this._startListener=null,this._initializeInstanceVariables(),this._events={},this._removeAbortController=new AbortController,this._removeSignal=this._removeAbortController.signal,this._millisStart=-1,this._recording=!1,this._lcg_random_state=null,this._gaussian_previous=!1,this._updateWindowSize();const r=(n=this,function(e){if("constructor"===e)return;const t=Object.getOwnPropertyDescriptor(n,e),i=Object.getOwnPropertyDescriptor(Ma.prototype,e),r=t&&t.get||i&&i.get;let s,a=!1,o=!1;if(!r){const t=Ma.prototype[e];a="function"==typeof t,a||void 0===Re[e]||(o=!0,s=t)}if(a){const t=Ma.prototype[e].bind(n);Object.defineProperty(window,e,{configurable:!0,enumerable:!0,value:t})}else if(o)Object.defineProperty(window,e,{configurable:!0,enumerable:!0,value:s});else if(r||!a){let t=null,i=null,r=null;Object.defineProperty(window,e,{configurable:!0,enumerable:!0,get:()=>{const s=n[e];return null===r?(r="function"==typeof s,r?(t=s,i=s.bind(n),i):s):r?(s!==t&&(t=s,i=s.bind(n)),i):s}})}});var n;if(t)t(this),e._checkForUserDefinedFunctions(this);else{if(this._isGlobal=!0,window.hitCriticalError)return;e.instance=this;for(const t of Object.getOwnPropertyNames(e.prototype))"_"!==t[0]&&r(t);const t=["constructor","length"];for(const e in this)if(this.hasOwnProperty(e)){if("_"===e[0]||t.includes(e))continue;r(e)}}const s=()=>{this.focused=!0},a=()=>{this.focused=!1};window.addEventListener("focus",s),window.addEventListener("blur",a),e.lifecycleHooks.remove.push((function(){window.removeEventListener("focus",s),window.removeEventListener("blur",a)})),"complete"===document.readyState?this.#S():(this._startListener=this.#S.bind(this),window.addEventListener("load",this._startListener,!1))}get pixels(){return this._renderer.pixels}get drawingContext(){return this._renderer.drawingContext}static registerAddon(t){const i={};t(e,e.prototype,i);const r=Object.keys(e.lifecycleHooks);for(const t of r)"function"==typeof i[t]&&e.lifecycleHooks[t].push(i[t])}static decorations=new Map;static decorateHelper(t,i){let r=t;Array.isArray(t)||(r=[t]),e.decorations.set(r,i)}#F={};_customActions=new Proxy({},{get:(e,t)=>{if(!this.#F[t]){const e=this._isGlobal?window:this;"function"==typeof e[t]&&(this.#F[t]=e[t].bind(this))}return this.#F[t]}});async#S(){this.hitCriticalError||(this._userNode&&"string"==typeof this._userNode&&(this._userNode=document.getElementById(this._userNode)),await this.#T(),this.hitCriticalError||this._recording||this._draw())}async#T(){if(await this._runLifecycleHook("presetup"),this.hitCriticalError)return;this.createCanvas(100,100,r),this._millisStart=window.performance.now();const e=this._isGlobal?window:this;if("function"==typeof e.setup&&await e.setup(),this.hitCriticalError)return;const t=document.getElementsByTagName("canvas");for(const e of t)e.style.touchAction="none","true"===e.dataset.hidden&&(e.style.visibility="",delete e.dataset.hidden);this._lastTargetFrameTime=window.performance.now(),this._lastRealFrameTime=window.performance.now(),this._setupDone=!0,(this._accessibleOutputs.grid||this._accessibleOutputs.text)&&this._updateAccsOutput(),await this._runLifecycleHook("postsetup"),this._millisStart=window.performance.now()}async _draw(e){if(this.hitCriticalError)return;const t=e||window.performance.now(),i=t-this._lastTargetFrameTime,r=1e3/this._targetFrameRate;(!this._loop||i>=r-5)&&(this.deltaTime=t-this._lastRealFrameTime,this._frameRate=1e3/this.deltaTime,await this.redraw(),this._lastTargetFrameTime=Math.max(this._lastTargetFrameTime+r,t),this._lastRealFrameTime=t,void 0!==this._updateMouseCoords&&(this._updateMouseCoords(),this.movedX=0,this.movedY=0)),this._loop&&(this._requestAnimId=window.requestAnimationFrame(this._draw.bind(this)))}async remove(){if(this._startListener&&window.removeEventListener("load",this._startListener,!1),this._curElement){this._loop=!1,this._requestAnimId&&window.cancelAnimationFrame(this._requestAnimId),this._removeAbortController.abort();for(const e of this._elements)e.elt&&e.elt.parentNode&&e.elt.parentNode.removeChild(e.elt);await this._runLifecycleHook("remove")}if(this._isGlobal){for(const t in e.prototype)try{delete window[t]}catch(e){window[t]=void 0}for(const e in this)if(this.hasOwnProperty(e))try{delete window[e]}catch(t){window[e]=void 0}e.instance=null}}async _runLifecycleHook(t){await Promise.all(e.lifecycleHooks[t].map((e=>e.call(this))))}_initializeInstanceVariables(){this._accessibleOutputs={text:!1,grid:!1,textLabel:!1,gridLabel:!1},this._styles=[],this._downKeys={},this._downKeyCodes={}}};for(const e in Re)Ma.prototype[e]=Re[e];function ka(e,t){const i="_Description",r="_fallbackDesc",n="_fallbackTable",s="_fte_",a="_Label",o="_labelDesc",h="_labelTable",u="_lte_";function l(e){if("label"===e||"fallback"===e)throw new Error("description should not be LABEL or FALLBACK");return e.endsWith(".")||e.endsWith(";")||e.endsWith(",")||e.endsWith("?")||e.endsWith("!")||(e+="."),e}t.describe=function(e,t){if("string"!=typeof e)return;const i=this.canvas.id;e=l(e),this.dummyDOM||(this.dummyDOM=document.getElementById(i).parentNode),this.descriptions||(this.descriptions={}),this.descriptions.fallback?this.descriptions.fallback.innerHTML!==e&&(this.descriptions.fallback.innerHTML=e):this._describeHTML("fallback",e),t===this.LABEL&&(this.descriptions.label?this.descriptions.label.innerHTML!==e&&(this.descriptions.label.innerHTML=e):this._describeHTML("label",e))},t.describeElement=function(e,t,i){if("string"!=typeof t||"string"!=typeof e)return;const r=this.canvas.id;t=l(t);let n=function(e){if("label"===e||"fallback"===e)throw new Error("element name should not be LABEL or FALLBACK");e.endsWith(".")||e.endsWith(";")||e.endsWith(",")?e=e.replace(/.$/,":"):e.endsWith(":")||(e+=":");return e}(e);e=e.replace(/[^a-zA-Z0-9]/g,"");let s=`<th scope="row">${n}</th><td>${t}</td>`;this.dummyDOM||(this.dummyDOM=document.getElementById(r).parentNode),this.descriptions?this.descriptions.fallbackElements||(this.descriptions.fallbackElements={}):this.descriptions={fallbackElements:{}},this.descriptions.fallbackElements[e]?this.descriptions.fallbackElements[e].innerHTML!==s&&(this.descriptions.fallbackElements[e].innerHTML=s):this._describeElementHTML("fallback",e,s),i===this.LABEL&&(this.descriptions.labelElements||(this.descriptions.labelElements={}),this.descriptions.labelElements[e]?this.descriptions.labelElements[e].innerHTML!==s&&(this.descriptions.labelElements[e].innerHTML=s):this._describeElementHTML("label",e,s))},t._describeHTML=function(e,t){const s=this.canvas.id;if("fallback"===e){if(this.dummyDOM.querySelector(`#${s+i}`))this.dummyDOM.querySelector("#"+s+n).insertAdjacentHTML("beforebegin",`<p id="${s+r}"></p>`);else{let e=`<div id="${s}${i}" role="region" aria-label="Canvas Description"><p id="${s}${r}"></p></div>`;this.dummyDOM.querySelector(`#${s}accessibleOutput`)?this.dummyDOM.querySelector(`#${s}accessibleOutput`).insertAdjacentHTML("beforebegin",e):this.dummyDOM.querySelector(`#${s}`).innerHTML=e}return this.descriptions.fallback=this.dummyDOM.querySelector(`#${s}${r}`),void(this.descriptions.fallback.innerHTML=t)}if("label"===e){if(this.dummyDOM.querySelector(`#${s+a}`))this.dummyDOM.querySelector(`#${s+h}`)&&this.dummyDOM.querySelector(`#${s+h}`).insertAdjacentHTML("beforebegin",`<p id="${s}${o}"></p>`);else{let e=`<div id="${s}${a}" class="p5Label"><p id="${s}${o}"></p></div>`;this.dummyDOM.querySelector(`#${s}accessibleOutputLabel`)?this.dummyDOM.querySelector(`#${s}accessibleOutputLabel`).insertAdjacentHTML("beforebegin",e):this.dummyDOM.querySelector("#"+s).insertAdjacentHTML("afterend",e)}return this.descriptions.label=this.dummyDOM.querySelector("#"+s+o),void(this.descriptions.label.innerHTML=t)}},t._describeElementHTML=function(e,t,l){const c=this.canvas.id;if("fallback"===e){if(this.dummyDOM.querySelector(`#${c+i}`))this.dummyDOM.querySelector("#"+c+n)||this.dummyDOM.querySelector("#"+c+r).insertAdjacentHTML("afterend",`<table id="${c}${n}"><caption>Canvas elements and their descriptions</caption></table>`);else{let e=`<div id="${c}${i}" role="region" aria-label="Canvas Description"><table id="${c}${n}"><caption>Canvas elements and their descriptions</caption></table></div>`;this.dummyDOM.querySelector(`#${c}accessibleOutput`)?this.dummyDOM.querySelector(`#${c}accessibleOutput`).insertAdjacentHTML("beforebegin",e):this.dummyDOM.querySelector("#"+c).innerHTML=e}let e=document.createElement("tr");return e.id=c+s+t,this.dummyDOM.querySelector("#"+c+n).appendChild(e),this.descriptions.fallbackElements[t]=this.dummyDOM.querySelector(`#${c}${s}${t}`),void(this.descriptions.fallbackElements[t].innerHTML=l)}if("label"===e){if(this.dummyDOM.querySelector(`#${c+a}`))this.dummyDOM.querySelector(`#${c+h}`)||this.dummyDOM.querySelector("#"+c+o).insertAdjacentHTML("afterend",`<table id="${c+h}"></table>`);else{let e=`<div id="${c}${a}" class="p5Label"><table id="${c}${h}"></table></div>`;this.dummyDOM.querySelector(`#${c}accessibleOutputLabel`)?this.dummyDOM.querySelector(`#${c}accessibleOutputLabel`).insertAdjacentHTML("beforebegin",e):this.dummyDOM.querySelector("#"+c).insertAdjacentHTML("afterend",e)}let e=document.createElement("tr");e.id=c+u+t,this.dummyDOM.querySelector("#"+c+h).appendChild(e),this.descriptions.labelElements[t]=this.dummyDOM.querySelector(`#${c}${u}${t}`),this.descriptions.labelElements[t].innerHTML=l}}}function Ia(e,t){t._updateGridOutput=function(t){if(this._renderer&&this._renderer instanceof e.RendererGL)return void(this._didOutputGridWebGLMessage||(this._didOutputGridWebGLMessage=!0,console.error("gridOutput() does not yet work in WebGL mode.")));if(!this.dummyDOM.querySelector(`#${t}_summary`))return;let i=this._accessibleOutputs[t],r=function(e,t){let i="",r="",n=0;for(let s in t){let a=0;for(let r in t[s]){let o=`<li id="${e}shape${n}">${t[s][r].color} ${s},`;"line"===s?o+=` location = ${t[s][r].pos}, length = ${t[s][r].length} pixels`:(o+=` location = ${t[s][r].pos}`,"point"!==s&&(o+=`, area = ${t[s][r].area} %`),o+="</li>"),i+=o,a++,n++}r=a>1?`${r} ${a} ${s}s`:`${r} ${a} ${s}`}return{numShapes:[n,r],details:i}}(t,this.ingredients.shapes),n=function(e,t,i,r){let n=`${t} canvas, ${i} by ${r} pixels, contains ${e[0]}`;n=1===e[0]?`${n} shape: ${e[1]}`:`${n} shapes: ${e[1]}`;return n}(r.numShapes,this.ingredients.colors.background,this.width,this.height),s=function(e,t){let i=0,r="",n=Array.from(Array(10),(()=>Array(10)));for(let r in t)for(let s in t[r]){let a;a="line"!==r?`<a href="#${e}shape${i}">${t[r][s].color} ${r}</a>`:`<a href="#${e}shape${i}">${t[r][s].color} ${r} midpoint</a>`,t[r][s].loc.locY<n.length&&t[r][s].loc.locX<n[t[r][s].loc.locY].length&&(n[t[r][s].loc.locY][t[r][s].loc.locX]?n[t[r][s].loc.locY][t[r][s].loc.locX]=n[t[r][s].loc.locY][t[r][s].loc.locX]+" "+a:n[t[r][s].loc.locY][t[r][s].loc.locX]=a,i++)}for(let e in n){let t="<tr>";for(let i in n[e])t+="<td>",void 0!==n[e][i]&&(t+=n[e][i]),t+="</td>";r=r+t+"</tr>"}return r}(t,this.ingredients.shapes);n!==i.summary.innerHTML&&(i.summary.innerHTML=n),s!==i.map.innerHTML&&(i.map.innerHTML=s),r.details!==i.shapeDetails.innerHTML&&(i.shapeDetails.innerHTML=r.details),this._accessibleOutputs[t]=i}}function Ba(e,t){t._updateTextOutput=function(t){if(this._renderer&&this._renderer instanceof e.RendererGL)return void(this._didOutputTextWebGLMessage||(this._didOutputTextWebGLMessage=!0,console.error("textOutput() does not yet work in WebGL mode.")));if(!this.dummyDOM.querySelector(`#${t}_summary`))return;let i=this._accessibleOutputs[t],r=function(e,t){let i="",r=0;for(let n in t)for(let s in t[n]){let a=`<li><a href="#${e}shape${r}">${t[n][s].color} ${n}</a>`;"line"===n?a+=`, ${t[n][s].pos}, ${t[n][s].length} pixels long.</li>`:(a+=`, at ${t[n][s].pos}`,"point"!==n&&(a+=`, covering ${t[n][s].area}% of the canvas`),a+=".</li>"),i+=a,r++}return{numShapes:r,listShapes:i}}(t,this.ingredients.shapes),n=function(e,t,i,r){let n=`Your output is a, ${i} by ${r} pixels, ${t} canvas containing the following`;n=1===e?`${n} shape:`:`${n} ${e} shapes:`;return n}(r.numShapes,this.ingredients.colors.background,this.width,this.height),s=function(e,t){let i="",r=0;for(let n in t)for(let s in t[n]){let a=`<tr id="${e}shape${r}"><th>${t[n][s].color} ${n}</th>`;"line"===n?a+=`<td>location = ${t[n][s].pos}</td><td>length = ${t[n][s].length} pixels</td></tr>`:(a+=`<td>location = ${t[n][s].pos}</td>`,"point"!==n&&(a+=`<td> area = ${t[n][s].area}%</td>`),a+="</tr>"),i+=a,r++}return i}(t,this.ingredients.shapes);n!==i.summary.innerHTML&&(i.summary.innerHTML=n),r.listShapes!==i.list.innerHTML&&(i.list.innerHTML=r.listShapes),s!==i.shapeDetails.innerHTML&&(i.shapeDetails.innerHTML=s),this._accessibleOutputs[t]=i}}function La(e,t){function i(e,t,i){let r=Math.floor(e[0]/t*10),n=Math.floor(e[1]/i*10);return 10===r&&(r-=1),10===n&&(n-=1),{locX:r,locY:n}}t.textOutput=function(e){this._accessibleOutputs.text||(this._accessibleOutputs.text=!0,this._createOutput("textOutput","Fallback"),e===this.LABEL&&(this._accessibleOutputs.textLabel=!0,this._createOutput("textOutput","Label")))},t.gridOutput=function(e){this._accessibleOutputs.grid||(this._accessibleOutputs.grid=!0,this._createOutput("gridOutput","Fallback"),e===this.LABEL&&(this._accessibleOutputs.gridLabel=!0,this._createOutput("gridOutput","Label")))},t._addAccsOutput=function(){return this._accessibleOutputs||(this._accessibleOutputs={text:!1,grid:!1,textLabel:!1,gridLabel:!1}),this._accessibleOutputs.grid||this._accessibleOutputs.text},t._createOutput=function(e,t){let i,r,n,s=this.canvas.id;this.ingredients||(this.ingredients={shapes:{},colors:{background:"white",fill:"white",stroke:"black"},pShapes:"",pBackground:""}),this.dummyDOM||(this.dummyDOM=document.getElementById(s).parentNode);let a="";"Fallback"===t?(i=s+e,r=s+"accessibleOutput",this.dummyDOM.querySelector(`#${r}`)||(this.dummyDOM.querySelector(`#${s}_Description`)?this.dummyDOM.querySelector(`#${s}_Description`).insertAdjacentHTML("afterend",`<div id="${r}" role="region" aria-label="Canvas Outputs"></div>`):this.dummyDOM.querySelector(`#${s}`).innerHTML=`<div id="${r}" role="region" aria-label="Canvas Outputs"></div>`)):"Label"===t&&(a=t,i=s+e+t,r=s+"accessibleOutput"+t,this.dummyDOM.querySelector(`#${r}`)||(this.dummyDOM.querySelector(`#${s}_Label`)?this.dummyDOM.querySelector(`#${s}_Label`).insertAdjacentHTML("afterend",`<div id="${r}"></div>`):this.dummyDOM.querySelector(`#${s}`).insertAdjacentHTML("afterend",`<div id="${r}"></div>`))),this._accessibleOutputs[i]={},"textOutput"===e?(a=`#${s}gridOutput${a}`,n=`<div id="${i}">Text Output<div id="${i}Summary" aria-label="text output summary"><p id="${i}_summary"></p><ul id="${i}_list"></ul></div><table id="${i}_shapeDetails" summary="text output shape details"></table></div>`,this.dummyDOM.querySelector(a)?this.dummyDOM.querySelector(a).insertAdjacentHTML("beforebegin",n):this.dummyDOM.querySelector(`#${r}`).innerHTML=n,this._accessibleOutputs[i].list=this.dummyDOM.querySelector(`#${i}_list`)):"gridOutput"===e&&(a=`#${s}textOutput${a}`,n=`<div id="${i}">Grid Output<p id="${i}_summary" aria-label="grid output summary"><table id="${i}_map" summary="grid output content"></table><ul id="${i}_shapeDetails" aria-label="grid output shape details"></ul></div>`,this.dummyDOM.querySelector(a)?this.dummyDOM.querySelector(a).insertAdjacentHTML("afterend",n):this.dummyDOM.querySelector(`#${r}`).innerHTML=n,this._accessibleOutputs[i].map=this.dummyDOM.querySelector(`#${i}_map`)),this._accessibleOutputs[i].shapeDetails=this.dummyDOM.querySelector(`#${i}_shapeDetails`),this._accessibleOutputs[i].summary=this.dummyDOM.querySelector(`#${i}_summary`)},t._updateAccsOutput=function(){let e=this.canvas.id;JSON.stringify(this.ingredients.shapes)===this.ingredients.pShapes&&this.ingredients.colors.background===this.ingredients.pBackground||(this.ingredients.pShapes=JSON.stringify(this.ingredients.shapes),this._accessibleOutputs.text&&this._updateTextOutput(e+"textOutput"),this._accessibleOutputs.grid&&this._updateGridOutput(e+"gridOutput"),this._accessibleOutputs.textLabel&&this._updateTextOutput(e+"textOutputLabel"),this._accessibleOutputs.gridLabel&&this._updateGridOutput(e+"gridOutputLabel"))},t._accsBackground=function(e){this.ingredients.pShapes=JSON.stringify(this.ingredients.shapes),this.ingredients.pBackground=this.ingredients.colors.background,this.ingredients.shapes={},this.ingredients.colors.backgroundRGBA!==e&&(this.ingredients.colors.backgroundRGBA=e,this.ingredients.colors.background=this._rgbColorName(e))},t._accsCanvasColors=function(e,t){"fill"===e?this.ingredients.colors.fillRGBA!==t&&(this.ingredients.colors.fillRGBA=t,this.ingredients.colors.fill=this._rgbColorName(t)):"stroke"===e&&this.ingredients.colors.strokeRGBA!==t&&(this.ingredients.colors.strokeRGBA=t,this.ingredients.colors.stroke=this._rgbColorName(t))},t._accsOutput=function(e,t){"ellipse"===e&&t[2]===t[3]?e="circle":"rectangle"===e&&t[2]===t[3]&&(e="square");let r={},n=!0,s=function(e,t){let i,r;"rectangle"===e||"ellipse"===e||"arc"===e||"circle"===e||"square"===e?(i=Math.round(t[0]+t[2]/2),r=Math.round(t[1]+t[3]/2)):"triangle"===e?(i=(t[0]+t[2]+t[4])/3,r=(t[1]+t[3]+t[5])/3):"quadrilateral"===e?(i=(t[0]+t[2]+t[4]+t[6])/4,r=(t[1]+t[3]+t[5]+t[7])/4):"line"===e?(i=(t[0]+t[2])/2,r=(t[1]+t[3])/2):(i=t[0],r=t[1]);return[i,r]}(e,t);if("line"===e){r.color=this.ingredients.colors.stroke,r.length=Math.round(Math.hypot(t[2]-t[0],t[3]-t[1]));let e=this._getPos(t[0],[1]),n=this._getPos(t[2],[3]);r.loc=i(s,this.width,this.height),r.pos=e===n?`at ${e}`:`from ${e} to ${n}`}else"point"===e?r.color=this.ingredients.colors.stroke:(r.color=this.ingredients.colors.fill,r.area=this._getArea(e,t)),r.pos=this._getPos(...s),r.loc=i(s,this.width,this.height);if(this.ingredients.shapes[e]){for(let t in this.ingredients.shapes[e])JSON.stringify(this.ingredients.shapes[e][t])===JSON.stringify(r)&&(n=!1);!0===n&&this.ingredients.shapes[e].push(r)}else this.ingredients.shapes[e]=[r]},t._getPos=function(t,i){const{x:r,y:n}=this.worldToScreen(new e.Vector(t,i)),s=this.width,a=this.height;return r<.4*s?n<.4*a?"top left":n>.6*a?"bottom left":"mid left":r>.6*s?n<.4*a?"top right":n>.6*a?"bottom right":"mid right":n<.4*a?"top middle":n>.6*a?"bottom middle":"middle"},t._getArea=function(e,t){let i=0;if("arc"===e){const e=((t[5]-t[4])%(2*Math.PI)+2*Math.PI)%(2*Math.PI);if(i=e*t[2]*t[3]/8,"open"===t[6]||"chord"===t[6]){const r=t[0],n=t[1],s=t[0]+t[2]/2*Math.cos(t[4]).toFixed(2),a=t[1]+t[3]/2*Math.sin(t[4]).toFixed(2),o=t[0]+t[2]/2*Math.cos(t[5]).toFixed(2),h=t[1]+t[3]/2*Math.sin(t[5]).toFixed(2),u=Math.abs(r*(a-h)+s*(h-n)+o*(n-a))/2;e>Math.PI?i+=u:i-=u}}else"ellipse"===e||"circle"===e?i=3.14*t[2]/2*t[3]/2:"line"===e||"point"===e?i=0:"quadrilateral"===e?i=Math.abs((t[6]+t[0])*(t[7]-t[1])+(t[0]+t[2])*(t[1]-t[3])+(t[2]+t[4])*(t[3]-t[5])+(t[4]+t[6])*(t[5]-t[7]))/2:"rectangle"===e||"square"===e?i=t[2]*t[3]:"triangle"===e&&(i=Math.abs(t[0]*(t[3]-t[5])+t[2]*(t[5]-t[1])+t[4]*(t[1]-t[3]))/2);const r=this.width*this._renderer._pixelDensity,n=this.height*this._renderer._pixelDensity,s=[new DOMPoint(0,0),new DOMPoint(r,0),new DOMPoint(r,n),new DOMPoint(0,n)],a=(this._renderer.isP3D?new DOMMatrix(this._renderer.uMVMatrix.mat4):this.drawingContext.getTransform()).inverse(),o=s.map((e=>e.matrixTransform(a))),h=Math.abs((o[3].x+o[0].x)*(o[3].y-o[0].y)+(o[0].x+o[1].x)*(o[0].y-o[1].y)+(o[1].x+o[2].x)*(o[1].y-o[2].y)+(o[2].x+o[3].x)*(o[2].y-o[3].y))/2;return Math.round(100*i/h)}}Ma.registerAddon(Ve),Ma.registerAddon(Ue),Ma.registerAddon(ze),Ma.registerAddon(Da),Ma.registerAddon((function(e,t){e.Renderer=En})),Ma.registerAddon((function(e,t){e.Renderer2D=Ta,e.renderers[r]=Ta,e.renderers["p2d-hdr"]=new Proxy(Ta,{construct:(e,[t,i,r,n,s])=>new e(t,i,r,n,s,{colorSpace:"display-p3"})})})),Ma.registerAddon((function(e,t){e.Graphics=ga,Ln(e,e.Graphics.prototype),On(0,e.Graphics.prototype),Pn(0,e.Graphics.prototype),Nn(0,e.Graphics.prototype),wn(e,e.Graphics.prototype),Rn(0,e.Graphics.prototype),ps(e,e.Graphics.prototype),Un(e,e.Graphics.prototype),ds(e,e.Graphics.prototype),Ve(e,e.Graphics.prototype),ca(e,e.Graphics.prototype),pa(0,e.Graphics.prototype),da(0,e.Graphics.prototype),Er(e,e.Graphics.prototype),fa(0,e.Graphics.prototype)})),void 0!==p5&&ka(0,p5.prototype),void 0!==p5&&Ia(p5,p5.prototype),void 0!==p5&&Ba(p5,p5.prototype),void 0!==p5&&La(p5,p5.prototype),Ma.ColorConversion={_hsbaToHSLA(e){const t=e[0];let i=e[1];const r=e[2],n=(2-i)*r/2;return 0!==n&&(1===n?i=0:n<.5?i/=2-i:i=i*r/(2-2*n)),[t,i,n,e[3]]},_hsbaToRGBA(e){const t=6*e[0],i=e[1],r=e[2];let n=[];if(0===i)n=[r,r,r,e[3]];else{const s=Math.floor(t),a=r*(1-i),o=r*(1-i*(t-s)),h=r*(1-i*(1+s-t));let u,l,c;1===s?(u=o,l=r,c=a):2===s?(u=a,l=r,c=h):3===s?(u=a,l=o,c=r):4===s?(u=h,l=a,c=r):5===s?(u=r,l=a,c=o):(u=r,l=h,c=a),n=[u,l,c,e[3]]}return n},_hslaToHSBA(e){const t=e[0];let i=e[1];const r=e[2];let n;return n=r<.5?(1+i)*r:r+i-r*i,i=2*(n-r)/n,[t,i,n,e[3]]},_hslaToRGBA(e){const t=6*e[0],i=e[1],r=e[2];let n=[];if(0===i)n=[r,r,r,e[3]];else{let s;s=r<.5?(1+i)*r:r+i-r*i;const a=2*r-s,o=(e,t,i)=>(e<0?e+=6:e>=6&&(e-=6),e<1?t+(i-t)*e:e<3?i:e<4?t+(i-t)*(4-e):t);n=[o(t+2,a,s),o(t,a,s),o(t-2,a,s),e[3]]}return n},_rgbaToHSBA(e){const t=e[0],i=e[1],r=e[2],n=Math.max(t,i,r),s=n-Math.min(t,i,r);let a,o;return 0===s?(a=0,o=0):(o=s/n,t===n?a=(i-r)/s:i===n?a=2+(r-t)/s:r===n&&(a=4+(t-i)/s),a<0?a+=6:a>=6&&(a-=6)),[a/6,o,n,e[3]]},_rgbaToHSLA(e){const t=e[0],i=e[1],r=e[2],n=Math.max(t,i,r),s=Math.min(t,i,r),a=n+s,o=n-s;let h,u;return 0===o?(h=0,u=0):(u=a<1?o/a:o/(2-a),t===n?h=(i-r)/o:i===n?h=2+(r-t)/o:r===n&&(h=4+(t-i)/o),h<0?h+=6:h>=6&&(h-=6)),[h/6,u,a/2,e[3]]}};var Oa=Ma.ColorConversion;function Pa(e,t){let i;const r=[{h:0,s:0,b:.8275,name:"gray"},{h:0,s:0,b:.8627,name:"gray"},{h:0,s:0,b:.7529,name:"gray"},{h:.0167,s:.1176,b:1,name:"light pink"}],n=[{h:0,s:0,b:0,name:"black"},{h:0,s:0,b:.5,name:"gray"},{h:0,s:0,b:1,name:"white"},{h:0,s:.5,b:.5,name:"dark maroon"},{h:0,s:.5,b:1,name:"salmon pink"},{h:0,s:1,b:0,name:"black"},{h:0,s:1,b:.5,name:"dark red"},{h:0,s:1,b:1,name:"red"},{h:5,s:0,b:1,name:"very light peach"},{h:5,s:.5,b:.5,name:"brown"},{h:5,s:.5,b:1,name:"peach"},{h:5,s:1,b:.5,name:"brick red"},{h:5,s:1,b:1,name:"crimson"},{h:10,s:0,b:1,name:"light peach"},{h:10,s:.5,b:.5,name:"brown"},{h:10,s:.5,b:1,name:"light orange"},{h:10,s:1,b:.5,name:"brown"},{h:10,s:1,b:1,name:"orange"},{h:15,s:0,b:1,name:"very light yellow"},{h:15,s:.5,b:.5,name:"olive green"},{h:15,s:.5,b:1,name:"light yellow"},{h:15,s:1,b:0,name:"dark olive green"},{h:15,s:1,b:.5,name:"olive green"},{h:15,s:1,b:1,name:"yellow"},{h:20,s:0,b:1,name:"very light yellow"},{h:20,s:.5,b:.5,name:"olive green"},{h:20,s:.5,b:1,name:"light yellow green"},{h:20,s:1,b:0,name:"dark olive green"},{h:20,s:1,b:.5,name:"dark yellow green"},{h:20,s:1,b:1,name:"yellow green"},{h:25,s:.5,b:.5,name:"dark yellow green"},{h:25,s:.5,b:1,name:"light green"},{h:25,s:1,b:.5,name:"dark green"},{h:25,s:1,b:1,name:"green"},{h:30,s:.5,b:1,name:"light green"},{h:30,s:1,b:.5,name:"dark green"},{h:30,s:1,b:1,name:"green"},{h:35,s:0,b:.5,name:"light green"},{h:35,s:0,b:1,name:"very light green"},{h:35,s:.5,b:.5,name:"dark green"},{h:35,s:.5,b:1,name:"light green"},{h:35,s:1,b:0,name:"very dark green"},{h:35,s:1,b:.5,name:"dark green"},{h:35,s:1,b:1,name:"green"},{h:40,s:0,b:1,name:"very light green"},{h:40,s:.5,b:.5,name:"dark green"},{h:40,s:.5,b:1,name:"light green"},{h:40,s:1,b:.5,name:"dark green"},{h:40,s:1,b:1,name:"green"},{h:45,s:.5,b:1,name:"light turquoise"},{h:45,s:1,b:.5,name:"dark turquoise"},{h:45,s:1,b:1,name:"turquoise"},{h:50,s:0,b:1,name:"light sky blue"},{h:50,s:.5,b:.5,name:"dark cyan"},{h:50,s:.5,b:1,name:"light cyan"},{h:50,s:1,b:.5,name:"dark cyan"},{h:50,s:1,b:1,name:"cyan"},{h:55,s:0,b:1,name:"light sky blue"},{h:55,s:.5,b:1,name:"light sky blue"},{h:55,s:1,b:.5,name:"dark blue"},{h:55,s:1,b:1,name:"sky blue"},{h:60,s:0,b:.5,name:"gray"},{h:60,s:0,b:1,name:"very light blue"},{h:60,s:.5,b:.5,name:"blue"},{h:60,s:.5,b:1,name:"light blue"},{h:60,s:1,b:.5,name:"navy blue"},{h:60,s:1,b:1,name:"blue"},{h:65,s:0,b:1,name:"lavender"},{h:65,s:.5,b:.5,name:"navy blue"},{h:65,s:.5,b:1,name:"light purple"},{h:65,s:1,b:.5,name:"dark navy blue"},{h:65,s:1,b:1,name:"blue"},{h:70,s:0,b:1,name:"lavender"},{h:70,s:.5,b:.5,name:"navy blue"},{h:70,s:.5,b:1,name:"lavender blue"},{h:70,s:1,b:.5,name:"dark navy blue"},{h:70,s:1,b:1,name:"blue"},{h:75,s:.5,b:1,name:"lavender"},{h:75,s:1,b:.5,name:"dark purple"},{h:75,s:1,b:1,name:"purple"},{h:80,s:.5,b:1,name:"pinkish purple"},{h:80,s:1,b:.5,name:"dark purple"},{h:80,s:1,b:1,name:"purple"},{h:85,s:0,b:1,name:"light pink"},{h:85,s:.5,b:.5,name:"purple"},{h:85,s:.5,b:1,name:"light fuchsia"},{h:85,s:1,b:.5,name:"dark fuchsia"},{h:85,s:1,b:1,name:"fuchsia"},{h:90,s:.5,b:.5,name:"dark fuchsia"},{h:90,s:.5,b:1,name:"hot pink"},{h:90,s:1,b:.5,name:"dark fuchsia"},{h:90,s:1,b:1,name:"fuchsia"},{h:95,s:0,b:1,name:"pink"},{h:95,s:.5,b:1,name:"light pink"},{h:95,s:1,b:.5,name:"dark magenta"},{h:95,s:1,b:1,name:"magenta"}];t._rgbColorName=function(e){let t=Oa._rgbaToHSBA(e);return i=t,function(e){let t;if(0!==e[0]){e[0]=Math.round(100*e[0]);let t=e[0].toString().split("");const i=t.length-1;t[i]=parseInt(t[i]),t[i]<2.5?t[i]=0:t[i]>=2.5&&t[i]<7.5&&(t[i]=5),2===t.length?(t[0]=parseInt(t[0]),t[i]>=7.5&&(t[i]=0,t[0]=t[0]+1),e[0]=10*t[0]+t[1]):t[i]>=7.5?e[0]=10:e[0]=t[i]}e[2]=e[2]/255;for(let t=e.length-1;t>=1;t--)e[t]<=.25?e[t]=0:e[t]>.25&&e[t]<.75?e[t]=.5:e[t]=1;if(0===e[0]&&0===e[1]&&1===e[2]){for(let e=2;e>=0;e--)i[e]=Math.round(1e4*i[e])/1e4;for(let e=0;e<r.length;e++){if(r[e].h===i[0]&&r[e].s===i[1]&&r[e].b===i[2]){t=r[e].name;break}t="white"}}else for(let i=0;i<n.length;i++)if(n[i].h===e[0]&&n[i].s===e[1]&&n[i].b===e[2]){t=n[i].name;break}return t}([t[0],t[1],t[2]])}}function Na(e,t){t.storeItem=function(t,i){"string"!=typeof t&&console.log(`The argument that you passed to storeItem() - ${t} is not a string.`),t.endsWith("p5TypeID")&&console.log(`The argument that you passed to storeItem() - ${t} must not end with 'p5TypeID'.`),void 0===i&&console.log("You cannot store undefined variables using storeItem().");let r=typeof i;switch(r){case"number":case"boolean":i=i.toString();break;case"object":if(i instanceof e.Color)r="p5.Color",i=i.toString();else if(i instanceof e.Vector){r="p5.Vector";i=i.values}i=JSON.stringify(i)}localStorage.setItem(t,i);const n=`${t}p5TypeID`;localStorage.setItem(n,r)},t.getItem=function(e){let t=localStorage.getItem(e);const i=localStorage.getItem(`${e}p5TypeID`);if(void 0===i)console.log(`Unable to determine type of item stored under ${e}in local storage. Did you save the item with something other than setItem()?`);else if(null!==t)switch(i){case"number":t=parseFloat(t);break;case"boolean":t="true"===t;break;case"object":t=JSON.parse(t);break;case"p5.Color":t=this.color(JSON.parse(t));break;case"p5.Vector":t=JSON.parse(t),t=this.createVector(...t)}return t},t.clearStorage=function(){Object.keys(localStorage).forEach((e=>{e.endsWith("p5TypeID")&&this.removeItem(e.replace("p5TypeID",""))}))},t.removeItem=function(e){"string"!=typeof e&&console.log(`The argument that you passed to removeItem() - ${e} is not a string.`),localStorage.removeItem(e),localStorage.removeItem(`${e}p5TypeID`)}}function Ra(e,t){function i(e,t,i){(t._userNode?t._userNode:document.body).appendChild(e);const r=i?new Tn(e,t):new kr(e,t);return t._elements.push(r),r}t.select=function(e,t){const i=this._getContainer(t).querySelector(e);return i?this._wrapElement(i):null},t.selectAll=function(e,t){const i=[],r=this._getContainer(t).querySelectorAll(e);if(r)for(let e=0;e<r.length;e++){const t=this._wrapElement(r[e]);i.push(t)}return i},t._getContainer=function(e){let t=document;return"string"==typeof e?t=document.querySelector(e)||document:e instanceof kr?t=e.elt:e instanceof HTMLElement&&(t=e),t},t._wrapElement=function(e){const t=Array.prototype.slice.call(e.children);if("INPUT"===e.tagName&&"checkbox"===e.type){let t=new kr(e,this);return t.checked=function(...e){return 0===e.length?this.elt.checked:(e[0]?this.elt.checked=!0:this.elt.checked=!1,this)},t}return"VIDEO"===e.tagName||"AUDIO"===e.tagName?new Tn(e,this):"SELECT"===e.tagName?this.createSelect(new kr(e,this)):t.length>0&&t.every((function(e){return"INPUT"===e.tagName||"LABEL"===e.tagName}))&&("DIV"===e.tagName||"SPAN"===e.tagName)?this.createRadio(new kr(e,this)):new kr(e,this)},t.createElement=function(e,t){const r=document.createElement(e);return void 0!==t&&(r.innerHTML=t),i(r,this)},t.removeElements=function(e){this._elements.filter((e=>!(e.elt instanceof HTMLCanvasElement))).map((e=>e.remove()))},t.createDiv=function(e=""){let t=document.createElement("div");return t.innerHTML=e,i(t,this)},t.createP=function(e=""){let t=document.createElement("p");return t.innerHTML=e,i(t,this)},t.createSpan=function(e=""){let t=document.createElement("span");return t.innerHTML=e,i(t,this)},t.createImg=function(){const e=document.createElement("img"),t=arguments;let r;return t.length>1&&"string"==typeof t[1]&&(e.alt=t[1]),t.length>2&&"string"==typeof t[2]&&(e.crossOrigin=t[2]),e.src=t[0],r=i(e,this),e.addEventListener("load",(function(){r.width=e.offsetWidth||e.width,r.height=e.offsetHeight||e.height;const i=t[t.length-1];"function"==typeof i&&i(r)})),r},t.createA=function(e,t,r){const n=document.createElement("a");return n.href=e,n.innerHTML=t,r&&(n.target=r),i(n,this)},t.createSlider=function(e,t,r,n){const s=document.createElement("input");return s.type="range",s.min=e,s.max=t,0===n?s.step=1e-18:n&&(s.step=n),"number"==typeof r&&(s.value=r),i(s,this)},t.createButton=function(e,t){const r=document.createElement("button");return r.innerHTML=e,t&&(r.value=t),i(r,this)},t.createCheckbox=function(...e){const t=document.createElement("div"),r=document.createElement("input");r.type="checkbox";const n=document.createElement("label");n.appendChild(r),t.appendChild(n);const s=i(t,this);if(s.checked=function(...e){const t=s.elt.firstElementChild.getElementsByTagName("input")[0];if(t){if(0===e.length)return t.checked;e[0]?t.checked=!0:t.checked=!1}return s},this.value=function(e){return s.value=e,this},e[0]){s.value(e[0]);const t=document.createElement("span");t.innerHTML=e[0],n.appendChild(t)}return e[1]&&(r.checked=!0),s},t.createSelect=function(...e){let t,r=e[0];if(r instanceof kr&&r.elt instanceof HTMLSelectElement)t=r,this.elt=r.elt;else if(r instanceof HTMLSelectElement)t=i(r,this),this.elt=r;else{const e=document.createElement("select");r&&"boolean"==typeof r&&e.setAttribute("multiple","true"),t=i(e,this),this.elt=e}return t.option=function(e,t){let i;if(void 0!==e){for(let t=0;t<this.elt.length;t+=1)if(this.elt[t].textContent===e){i=t;break}if(void 0!==i)!1===t?this.elt.remove(i):this.elt[i].value=t;else{const i=document.createElement("option");i.textContent=e,i.value=void 0===t?e:t,this.elt.appendChild(i),this._pInst._elements.push(i)}}},t.selected=function(e){if(void 0!==e){for(let t=0;t<this.elt.length;t+=1)this.elt[t].value.toString()===e.toString()&&(this.elt.selectedIndex=t);return this}if(this.elt.getAttribute("multiple")){let e=[];for(const t of this.elt.selectedOptions)e.push(t.value);return e}return this.elt.value},t.disable=function(e){if("string"==typeof e)for(let t=0;t<this.elt.length;t++)this.elt[t].value.toString()===e&&(this.elt[t].disabled=!0,this.elt[t].selected=!1);else this.elt.disabled=!0;return this},t.enable=function(e){if("string"==typeof e)for(let t=0;t<this.elt.length;t++)this.elt[t].value.toString()===e&&(this.elt[t].disabled=!1,this.elt[t].selected=!1);else{this.elt.disabled=!1;for(let e=0;e<this.elt.length;e++)this.elt[e].disabled=!1,this.elt[e].selected=!1}return this},t};let r=0;t.createRadio=function(...e){let t,n,s;const a=e[0];a instanceof kr&&(a.elt instanceof HTMLDivElement||a.elt instanceof HTMLSpanElement)?(t=a,this.elt=a.elt):a instanceof HTMLDivElement||a instanceof HTMLSpanElement?(t=i(a,this),this.elt=a,n=a,"string"==typeof e[1]&&(s=e[1])):("string"==typeof a&&(s=a),n=document.createElement("div"),t=i(n,this),this.elt=n),t._name=s||"radioOption_"+r++;const o=e=>e instanceof HTMLInputElement&&"radio"===e.type,h=e=>e instanceof HTMLLabelElement;return t._getOptionsArray=function(){return Array.from(this.elt.children).filter((e=>o(e)||h(e)&&o(e.firstElementChild))).map((e=>o(e)?e:e.firstElementChild))},t.option=function(e,i){let r,n,s;for(const i of t._getOptionsArray())if(i.value===e){r=i;break}return void 0===r&&(r=document.createElement("input"),r.setAttribute("type","radio"),r.setAttribute("value",e)),r.setAttribute("name",t._name),h(r.parentElement)?n=r.parentElement:(n=document.createElement("label"),n.insertAdjacentElement("afterbegin",r)),n.lastElementChild instanceof HTMLSpanElement?s=n.lastElementChild:(s=document.createElement("span"),r.insertAdjacentElement("afterend",s)),s.innerHTML=void 0===i?e:i,this.elt.appendChild(n),r},t.remove=function(e){for(const i of t._getOptionsArray())if(i.value===e)return void(h(i.parentElement)?i.parentElement.remove():i.remove())},t.value=function(){let e="";for(const i of t._getOptionsArray())if(i.checked){e=i.value;break}return e},t.selected=function(e){let i=null;if(void 0===e){for(const e of t._getOptionsArray())if(e.checked){i=e;break}}else{t._getOptionsArray().forEach((e=>{e.checked=!1,e.removeAttribute("checked")}));for(const r of t._getOptionsArray())r.value===e&&(r.setAttribute("checked",!0),r.checked=!0,i=r)}return i},t.disable=function(e=!0){for(const i of t._getOptionsArray())i.setAttribute("disabled",e)},t},t.createColorPicker=function(t){const r=document.createElement("input");let n;r.type="color",t?t instanceof e.Color?r.value=t.toString("#rrggbb"):(this.push(),this.colorMode("rgb"),r.value=this.color(t).toString("#rrggbb"),this.pop()):r.value="#000000",n=i(r,this);const s=this;return n.color=function(){s.push(),t&&t.mode&&s.colorMode(t.mode,...t?.maxes&&t.maxes[t.mode]||[]);const e=s.color(this.elt.value);return s.pop(),e},n},t.createInput=function(e="",t="text"){let r=document.createElement("input");return r.setAttribute("value",e),r.setAttribute("type",t),i(r,this)},t.createFileInput=function(e,t=!1){if(!(window.File&&window.FileReader&&window.FileList&&window.Blob))return void console.log("The File APIs are not fully supported in this browser. Cannot create element.");const r=document.createElement("input");return r.setAttribute("type","file"),t&&r.setAttribute("multiple",!0),r.addEventListener("change",(function(t){for(const i of t.target.files)Tr._load(i,e)}),!1),i(r,this)}}function Va(e,t,i){i.presetup=function(){const e=["deviceorientation","devicemotion"];for(const t of e)window.addEventListener(t,this[`_on${t}`].bind(this),{passive:!1,signal:this._removeSignal})},t.deviceOrientation=window.innerWidth/window.innerHeight>1?"landscape":"portrait",t.accelerationX=0,t.accelerationY=0,t.accelerationZ=0,t.pAccelerationX=0,t.pAccelerationY=0,t.pAccelerationZ=0,t._updatePAccelerations=function(){this.pAccelerationX=this.accelerationX,this.pAccelerationY=this.accelerationY,this.pAccelerationZ=this.accelerationZ},t.rotationX=0,t.rotationY=0,t.rotationZ=0,t.pRotationX=0,t.pRotationY=0,t.pRotationZ=0;let r=0,n=0,s=0,a="clockwise",o="clockwise",h="clockwise";t.pRotateDirectionX=void 0,t.pRotateDirectionY=void 0,t.pRotateDirectionZ=void 0,t._updatePRotations=function(){this.pRotationX=this.rotationX,this.pRotationY=this.rotationY,this.pRotationZ=this.rotationZ},t.turnAxis=void 0;let u=.5,l=30;t.setMoveThreshold=function(e){u=e},t.setShakeThreshold=function(e){l=e},t._ondeviceorientation=function(e){this._updatePRotations(),this.rotationX=this._fromDegrees(e.beta),this.rotationY=this._fromDegrees(e.gamma),this.rotationZ=this._fromDegrees(e.alpha),this._handleMotion()},t._ondevicemotion=function(e){this._updatePAccelerations(),this.accelerationX=2*e.acceleration.x,this.accelerationY=2*e.acceleration.y,this.accelerationZ=2*e.acceleration.z,this._handleMotion()},t._handleMotion=function(){if("landscape-primary"===screen.orientation.type||"landscape-secondary"===screen.orientation.type?this.deviceOrientation="landscape":"portrait-primary"===screen.orientation.type||"portrait-secondary"===screen.orientation.type?this.deviceOrientation="portrait":this.deviceOrientation="undefined","function"==typeof this._customActions.deviceMoved&&(Math.abs(this.accelerationX-this.pAccelerationX)>u||Math.abs(this.accelerationY-this.pAccelerationY)>u||Math.abs(this.accelerationZ-this.pAccelerationZ)>u)&&this._customActions.deviceMoved(),"function"==typeof this._customActions.deviceTurned){const e=this._toDegrees(this.rotationX)+180,t=this._toDegrees(this.pRotationX)+180;let i=r+180;e-t>0&&e-t<270||e-t<-270?a="clockwise":(e-t<0||e-t>270)&&(a="counter-clockwise"),a!==this.pRotateDirectionX&&(i=e),Math.abs(e-i)>90&&Math.abs(e-i)<270&&(i=e,this.turnAxis="X",this._customActions.deviceTurned()),this.pRotateDirectionX=a,r=i-180;const u=this._toDegrees(this.rotationY)+180,l=this._toDegrees(this.pRotationY)+180;let c=n+180;u-l>0&&u-l<270||u-l<-270?o="clockwise":(u-l<0||u-this.pRotationY>270)&&(o="counter-clockwise"),o!==this.pRotateDirectionY&&(c=u),Math.abs(u-c)>90&&Math.abs(u-c)<270&&(c=u,this.turnAxis="Y",this._customActions.deviceTurned()),this.pRotateDirectionY=o,n=c-180;const p=this._toDegrees(this.rotationZ),d=this._toDegrees(this.pRotationZ);p-d>0&&p-d<270||p-d<-270?h="clockwise":(p-d<0||p-d>270)&&(h="counter-clockwise"),h!==this.pRotateDirectionZ&&(s=p),Math.abs(p-s)>90&&Math.abs(p-s)<270&&(s=p,this.turnAxis="Z",this._customActions.deviceTurned()),this.pRotateDirectionZ=h,this.turnAxis=void 0}if("function"==typeof this._customActions.deviceShaken){let e,t;null!==this.pAccelerationX&&(e=Math.abs(this.accelerationX-this.pAccelerationX),t=Math.abs(this.accelerationY-this.pAccelerationY)),e+t>l&&this._customActions.deviceShaken()}}}function Ua(e,t,i){i.presetup=function(){const e=["keydown","keyup","keypress","blur"];for(const t of e)window.addEventListener(t,this[`_on${t}`].bind(this),{passive:!1,signal:this._removeSignal})},t.keyIsPressed=!1,t.key="",t.code="",t.keyCode=0,t._onkeydown=function(e){if(!this._downKeys[e.code]&&(this.keyIsPressed=!0,this.keyCode=e.which,this.key=e.key,this.code=e.code,this._downKeyCodes[e.code]=!0,this._downKeys[e.key]=!0,"function"==typeof this._customActions.keyPressed&&!e.charCode)){!1===this._customActions.keyPressed(e)&&e.preventDefault()}},t._onkeyup=function(e){if("function"==typeof this._customActions.keyReleased){!1===this._customActions.keyReleased(e)&&e.preventDefault()}if(delete this._downKeyCodes[e.code],delete this._downKeys[e.key],this._areDownKeys()){const e=Object.keys(this._downKeyCodes).pop();this.code=e;const t=Object.keys(this._downKeys).pop();this.key=t}else this.keyIsPressed=!1,this.key="",this.code=""},t._onkeypress=function(e){if((e.which!==this._lastKeyCodeTyped||!e.repeat)&&(this._lastKeyCodeTyped=e.which,this.key=e.key||String.fromCharCode(e.which)||e.which,"function"==typeof this._customActions.keyTyped)){!1===this._customActions.keyTyped(e)&&e.preventDefault()}},t._onblur=function(e){this._downKeys={}},t.keyIsDown=function(e){return function(e){return!["Alt","Shift","Control","Meta"].includes(e)&&"string"==typeof e&&e.length>1}(e)?this._downKeyCodes[e]||this._downKeys[e]||!1:this._downKeys[e]||this._downKeyCodes[e]||!1},t._areDownKeys=function(){for(const e in this._downKeys)if(this._downKeys.hasOwnProperty(e)&&!0===this._downKeys[e])return!0;return!1}}function za(e,t,i){function r(e,t,i,r){const n=e.getBoundingClientRect();return{x:(r.clientX-n.left)/t,y:(r.clientY-n.top)/i,winX:r.clientX,winY:r.clientY,id:r.pointerId}}i.presetup=function(){const e=["pointerdown","pointerup","pointermove","dragend","dragover","click","dblclick","wheel"];for(const t of e)window.addEventListener(t,this[`_on${t}`].bind(this),{passive:!1,signal:this._removeSignal})},t.movedX=0,t.movedY=0,t._hasMouseInteracted=!1,t.mouseX=0,t.mouseY=0,t.pmouseX=0,t.pmouseY=0,t.winMouseX=0,t.winMouseY=0,t.pwinMouseX=0,t.pwinMouseY=0,t.mouseButton={left:!1,right:!1,center:!1},t.touches=[],t._activePointers=new Map,t.mouseIsPressed=!1,t._updatePointerCoords=function(e){if(null!==this._curElement){const t=this._curElement.elt,i=t.scrollWidth/this.width||1,n=t.scrollHeight/this.height||1;if("touch"===e.pointerType){const e=[];for(const s of this._activePointers.values())e.push(r(t,i,n,s));this.touches=e}const s=function(e,t,i,r){const n=e.getBoundingClientRect();return{x:(r.clientX-n.left)/t,y:(r.clientY-n.top)/i,winX:r.clientX,winY:r.clientY}}(t,i,n,e);this.movedX=e.movementX||0,this.movedY=e.movementY||0,this.mouseX=s.x,this.mouseY=s.y,this.winMouseX=s.winX,this.winMouseY=s.winY,this._hasMouseInteracted||(this._updateMouseCoords(),this._hasMouseInteracted=!0)}},t._updateMouseCoords=function(){this.pmouseX=this.mouseX,this.pmouseY=this.mouseY,this.pwinMouseX=this.winMouseX,this.pwinMouseY=this.winMouseY,this._pmouseWheelDeltaY=this._mouseWheelDeltaY},t._setMouseButton=function(e){this.mouseButton.left=Array.from(this._activePointers.values()).some((e=>!!(1&e.buttons))),this.mouseButton.center=Array.from(this._activePointers.values()).some((e=>!!(4&e.buttons))),this.mouseButton.right=Array.from(this._activePointers.values()).some((e=>!!(2&e.buttons)))},t._onpointermove=function(e){let t;this._updatePointerCoords(e),this._activePointers.set(e.pointerId,e),this._setMouseButton(e),this.mouseIsPressed||"function"!=typeof this._customActions.mouseMoved?this.mouseIsPressed&&"function"==typeof this._customActions.mouseDragged&&(t=this._customActions.mouseDragged(e),!1===t&&e.preventDefault()):(t=this._customActions.mouseMoved(e),!1===t&&e.preventDefault())},t._onpointerdown=function(e){let t;this.mouseIsPressed=!0,this._activePointers.set(e.pointerId,e),this._setMouseButton(e),this._updatePointerCoords(e),"function"==typeof this._customActions.mousePressed&&(t=this._customActions.mousePressed(e),!1===t&&e.preventDefault())},t._onpointerup=function(e){let t;this.mouseIsPressed=!1,this._activePointers.delete(e.pointerId),this._setMouseButton(e),this._updatePointerCoords(e),"function"==typeof this._customActions.mouseReleased&&(t=this._customActions.mouseReleased(e),!1===t&&e.preventDefault())},t._ondragend=t._onpointerup,t._ondragover=t._onpointermove,t._onclick=function(e){if("function"==typeof this._customActions.mouseClicked){!1===this._customActions.mouseClicked(e)&&e.preventDefault()}},t._ondblclick=function(e){if("function"==typeof this._customActions.doubleClicked){!1===this._customActions.doubleClicked(e)&&e.preventDefault()}},t._mouseWheelDeltaY=0,t._pmouseWheelDeltaY=0,t._onwheel=function(e){if(this._mouseWheelDeltaY=e.deltaY,"function"==typeof this._customActions.mouseWheel){e.delta=e.deltaY;!1===this._customActions.mouseWheel(e)&&e.preventDefault()}},t.requestPointerLock=function(){const e=this._curElement.elt;return e.requestPointerLock=e.requestPointerLock||e.mozRequestPointerLock,e.requestPointerLock?(e.requestPointerLock(),!0):(console.log("requestPointerLock is not implemented in this browser"),!1)},t.exitPointerLock=function(){document.exitPointerLock()}}void 0!==p5&&Pa(0,p5.prototype),void 0!==p5&&Na(p5,p5.prototype),void 0!==p5&&Ra(p5,p5.prototype),void 0!==p5&&Va(0,p5.prototype),void 0!==p5&&Ua(0,p5.prototype),void 0!==p5&&za(0,p5.prototype);class Ga{constructor(e){this.columns=[],this.rows=[]}toString(e=","){let t=this.rows.map((e=>e.arr));return this.columns.some((e=>null===e))||(t=[this.columns,...t]),function(e,t={},i=e=>e){const r=Object.create(null);if(r.options=t,r.options.eof=void 0===r.options.eof||r.options.eof,r.row=1,r.col=1,r.output="",r.options.delimiter=void 0===r.options.delimiter?'"':t.delimiter,r.options.delimiter.length>1||0===r.options.delimiter.length)throw Error(`CSVError: delimiter must be one character [${r.options.separator}]`);if(r.options.separator=void 0===r.options.separator?",":t.separator,r.options.separator.length>1||0===r.options.separator.length)throw Error(`CSVError: separator must be one character [${r.options.separator}]`);const n=new RegExp(`${jn(r.options.delimiter)}|${jn(r.options.separator)}|\r\n|\n|\r`);return e.forEach(((t,s)=>{let a="";switch(r.col=1,t.forEach(((e,s)=>{"string"==typeof e&&(e=e.replace(new RegExp(r.options.delimiter,"g"),`${r.options.delimiter}${r.options.delimiter}`),e=n.test(e)?`${r.options.delimiter}${e}${r.options.delimiter}`:e),a+=i(e,r.row,r.col),s!==t.length-1&&(a+=r.options.separator),r.col++})),!0){case r.options.eof:case!r.options.eof&&s!==e.length-1:r.output+=`${a}\n`;break;default:r.output+=`${a}`}r.row++})),r.output}(t,{separator:e})}addRow(e){const t=e||new p5.TableRow;if(void 0===t.arr||void 0===t.obj)throw new Error(`invalid TableRow: ${t}`);return t.table=this,this.rows.push(t),t}removeRow(e){this.rows[e].table=null;const t=this.rows.splice(e+1,this.rows.length);this.rows.pop(),this.rows=this.rows.concat(t)}getRow(e){return this.rows[e]}getRows(){return this.rows}findRow(e,t){if("string"==typeof t){for(let i=0;i<this.rows.length;i++)if(this.rows[i].obj[this.columns.indexOf(t)]===e)return this.rows[i]}else for(let i=0;i<this.rows.length;i++)if(this.rows[i].arr[t]===e)return this.rows[i];return null}findRows(e,t){const i=[];if("string"==typeof t)for(let r=0;r<this.rows.length;r++)this.rows[r].obj[this.columns.indexOf(t)]===e&&i.push(this.rows[r]);else for(let r=0;r<this.rows.length;r++)this.rows[r].arr[t]===e&&i.push(this.rows[r]);return i}matchRow(e,t){if("number"==typeof t){for(let i=0;i<this.rows.length;i++)if(this.rows[i].arr[t].match(e))return this.rows[i]}else for(let i=0;i<this.rows.length;i++)if(this.rows[i].obj[this.columns.indexOf(t)].match(e))return this.rows[i];return null}matchRows(e,t){const i=[];if("number"==typeof t)for(let r=0;r<this.rows.length;r++)this.rows[r].arr[t].match(e)&&i.push(this.rows[r]);else for(let r=0;r<this.rows.length;r++)this.rows[r].obj[this.columns.indexOf(t)].match(e)&&i.push(this.rows[r]);return i}getColumn(e){const t=[];if("string"==typeof e)for(let i=0;i<this.rows.length;i++)t.push(this.rows[i].obj[this.columns.indexOf(e)]);else for(let i=0;i<this.rows.length;i++)t.push(this.rows[i].arr[e]);return t}clearRows(){delete this.rows,this.rows=[]}addColumn(e){const t=e||null;this.columns.push(t)}getColumnCount(){return this.columns.length}getRowCount(){return this.rows.length}removeTokens(e,t){const i=[];for(let t=0;t<e.length;t++)i.push(e.charAt(t).replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&"));const r=new RegExp(i.join("|"),"g");if(void 0===t)for(let e=0;e<this.columns.length;e++)for(let t=0;t<this.rows.length;t++){let i=this.rows[t].arr[e];i=i.replace(r,""),this.rows[t].arr[e]=i,this.rows[t].obj[this.columns[e]]=i}else if("string"==typeof t)for(let e=0;e<this.rows.length;e++){let i=this.rows[e].obj[t];i=i.replace(r,""),this.rows[e].obj[t]=i;const n=this.columns.indexOf(t);this.rows[e].arr[n]=i}else for(let e=0;e<this.rows.length;e++){let i=this.rows[e].arr[t];i=i.replace(r,""),this.rows[e].arr[t]=i,this.rows[e].obj[this.columns[t]]=i}}trim(e){const t=new RegExp(" ","g");if(void 0===e)for(let e=0;e<this.columns.length;e++)for(let i=0;i<this.rows.length;i++){let r=this.rows[i].arr[e];r=r.replace(t,""),this.rows[i].arr[e]=r,this.rows[i].obj[this.columns[e]]=r}else if("string"==typeof e)for(let i=0;i<this.rows.length;i++){let r=this.rows[i].obj[e];r=r.replace(t,""),this.rows[i].obj[e]=r;const n=this.columns.indexOf(e);this.rows[i].arr[n]=r}else for(let i=0;i<this.rows.length;i++){let r=this.rows[i].arr[e];r=r.replace(t,""),this.rows[i].arr[e]=r,this.rows[i].obj[this.columns[e]]=r}}removeColumn(e){let t,i;"string"==typeof e?(t=e,i=this.columns.indexOf(e)):(i=e,t=this.columns[e]);const r=this.columns.splice(i+1,this.columns.length);this.columns.pop(),this.columns=this.columns.concat(r);for(let e=0;e<this.rows.length;e++){const r=this.rows[e].arr,n=r.splice(i+1,r.length);r.pop(),this.rows[e].arr=r.concat(n),delete this.rows[e].obj[t]}}set(e,t,i){this.rows[e].set(t,i)}setNum(e,t,i){this.rows[e].setNum(t,i)}setString(e,t,i){this.rows[e].setString(t,i)}get(e,t){return"string"==typeof t?this.rows[e].get(this.columns.indexOf(t)):this.rows[e].get(t)}getNum(e,t){return this.rows[e].getNum(t)}getString(e,t){return this.rows[e].getString(t)}getObject(e){const t={};let i,r,n;for(let s=0;s<this.rows.length;s++)if(i=this.rows[s].obj,"string"==typeof e){if(r=this.columns.indexOf(e),!(r>=0))throw new Error(`This table has no column named "${e}"`);n=i[e],t[n]=i}else t[s]=this.rows[s].obj;return t}getArray(){const e=[];for(let t=0;t<this.rows.length;t++)e.push(this.rows[t].arr);return e}}function ja(e,t){e.Table=Ga}void 0!==p5&&ja(p5);class $a{constructor(e=[]){let t=e;this.arr=t,this.obj=Object.fromEntries(t.entries()),this.table=null}set(e,t){if("string"==typeof e){const i=this.table.columns.indexOf(e);if(!(i>=0))throw new Error(`This table has no column named "${e}"`);this.obj[e]=t,this.arr[i]=t}else{if(!(e<this.table.columns.length))throw new Error(`Column #${e} is out of the range of this table`);{this.arr[e]=t;const i=this.table.columns[e];this.obj[i]=t}}}setNum(e,t){const i=parseFloat(t);this.set(e,i)}setString(e,t){const i=t.toString();this.set(e,i)}get(e){return"string"==typeof e?this.obj[this.table.columns.indexOf(e)]:this.arr[e]}getNum(e){let t;if(t="string"==typeof e?parseFloat(this.obj[this.table.columns.indexOf(e)]):parseFloat(this.arr[e]),"NaN"===t.toString())throw`Error: ${this.obj[e]} is NaN (Not a Number)`;return t}getString(e){return"string"==typeof e?this.obj[this.table.columns.indexOf(e)].toString():this.arr[e].toString()}}function qa(e,t){e.TableRow=$a}function Ha(e,t){t.abs=Math.abs,t.ceil=Math.ceil,t.constrain=function(e,t,i){return Math.max(Math.min(e,i),t)},t.dist=function(...e){return 4===e.length?Math.hypot(e[2]-e[0],e[3]-e[1]):6===e.length?Math.hypot(e[3]-e[0],e[4]-e[1],e[5]-e[2]):void 0},t.exp=Math.exp,t.floor=Math.floor,t.lerp=function(e,t,i){return i*(t-e)+e},t.log=Math.log,t.mag=function(e,t){return Math.hypot(e,t)},t.map=function(e,t,i,r,n,s){const a=(e-t)/(i-t)*(n-r)+r;return s?r<n?this.constrain(a,r,n):this.constrain(a,n,r):a},t.max=function(...e){const t=e=>{let t=-1/0;for(let i of e)t=Math.max(t,i);return t};return e[0]instanceof Array?t(e[0]):t(e)},t.min=function(...e){const t=e=>{let t=1/0;for(let i of e)t=Math.min(t,i);return t};return e[0]instanceof Array?t(e[0]):t(e)},t.norm=function(e,t,i){return this.map(e,t,i,0,1)},t.pow=Math.pow,t.round=function(e,t){if(!t)return Math.round(e);const i=Math.pow(10,t);return Math.round(e*i)/i},t.sq=e=>e*e,t.sqrt=Math.sqrt,t.fract=function(e){let t=0,i=Number(e);if(isNaN(i)||Math.abs(i)===1/0)return i;if(i<0&&(i=-i,t=1),String(i).includes(".")&&!String(i).includes("e")){let e=String(i);return e=Number("0"+e.slice(e.indexOf("."))),Math.abs(t-e)}return i<1?Math.abs(t-i):0}}function Wa(e,t){const i=4095;let r=4,n=.5;const s=e=>.5*(1-Math.cos(e*Math.PI));let a;t.noise=function(e,t=0,o=0){if(null==a){a=new Array(4096);for(let e=0;e<4096;e++)a[e]=Math.random()}e<0&&(e=-e),t<0&&(t=-t),o<0&&(o=-o);let h,u,l,c,p,d=Math.floor(e),f=Math.floor(t),g=Math.floor(o),m=e-d,y=t-f,x=o-g,v=0,b=.5;for(let e=0;e<r;e++){let e=d+(f<<4)+(g<<8);h=s(m),u=s(y),l=a[e&i],l+=h*(a[e+1&i]-l),c=a[e+16&i],c+=h*(a[e+16+1&i]-c),l+=u*(c-l),e+=256,c=a[e&i],c+=h*(a[e+1&i]-c),p=a[e+16&i],p+=h*(a[e+16+1&i]-p),c+=u*(p-c),l+=s(x)*(c-l),v+=l*b,b*=n,d<<=1,m*=2,f<<=1,y*=2,g<<=1,x*=2,m>=1&&(d++,m--),y>=1&&(f++,y--),x>=1&&(g++,x--)}return v},t.noiseDetail=function(e,t){e>0&&(r=e),t>0&&(n=t)},t.noiseSeed=function(e){const t=(()=>{const e=4294967296;let t,i;return{setSeed(r){i=t=(null==r?Math.random()*e:r)>>>0},getSeed:()=>t,rand:()=>(i=(1664525*i+1013904223)%e,i/e)}})();t.setSeed(e),a=new Array(4096);for(let e=0;e<4096;e++)a[e]=t.rand()}}function Xa(e,t){const i="_lcg_random_state",r=4294967296;let n=0;t._lcg=function(e){return this[e]=(1664525*this[e]+1013904223)%r,this[e]/r},t._lcgSetSeed=function(e,t){this[e]=(null==t?Math.random()*r:t)>>>0},t.randomSeed=function(e){this._lcgSetSeed(i,e),this._gaussian_previous=!1},t.random=function(e,t){let r;if(r=null!=this[i]?this._lcg(i):Math.random(),void 0===e)return r;if(void 0===t)return e instanceof Array?e[Math.floor(r*e.length)]:r*e;if(e>t){const i=e;e=t,t=i}return r*(t-e)+e},t.randomGaussian=function(e,t=1){let i,r,s,a;if(this._gaussian_previous)i=n,this._gaussian_previous=!1;else{do{r=this.random(2)-1,s=this.random(2)-1,a=r*r+s*s}while(a>=1);a=Math.sqrt(-2*Math.log(a)/a),i=r*a,n=s*a,this._gaussian_previous=!0}return i*t+(e||0)}}function Ya(e,t){t.createVector=function(t,i,r){return 0===arguments.length&&e._friendlyError("In 1.x, createVector() was a shortcut for createVector(0, 0, 0). In 2.x, p5.js has vectors of any dimension, so you must provide your desired number of zeros. Use createVector(0, 0) for a 2D vector and createVector(0, 0, 0) for a 3D vector."),this instanceof e?new e.Vector(this._fromRadians.bind(this),this._toRadians.bind(this),...arguments):new e.Vector(t,i,r)},t.createMatrix=function(...t){return new e.Matrix(...t)}}function Za(e,t){t.float=function(e){return e instanceof Array?e.map(parseFloat):parseFloat(e)},t.int=function(e,i=10){return e===1/0||"Infinity"===e?1/0:e===-1/0||"-Infinity"===e?-1/0:"string"==typeof e?parseInt(e,i):"number"==typeof e?0|e:"boolean"==typeof e?e?1:0:e instanceof Array?e.map((e=>t.int(e,i))):void 0},t.str=function(e){return e instanceof Array?e.map(t.str):String(e)},t.boolean=function(e){return"number"==typeof e?0!==e:"string"==typeof e?"true"===e.toLowerCase():"boolean"==typeof e?e:e instanceof Array?e.map(t.boolean):void 0},t.byte=function(e){const i=t.int(e,10);return"number"==typeof i?(i+128)%256-128:i instanceof Array?i.map(t.byte):void 0},t.char=function(e){return"number"!=typeof e||isNaN(e)?e instanceof Array?e.map(t.char):"string"==typeof e?t.char(parseInt(e,10)):void 0:String.fromCharCode(e)},t.unchar=function(e){return"string"==typeof e&&1===e.length?e.charCodeAt(0):e instanceof Array?e.map(t.unchar):void 0},t.hex=function(e,i){if(i=null==i?i=8:i,e instanceof Array)return e.map((e=>t.hex(e,i)));if(e===1/0||e===-1/0){return(e===1/0?"F":"0").repeat(i)}if("number"==typeof e){e<0&&(e=4294967295+e+1);let t=Number(e).toString(16).toUpperCase();for(;t.length<i;)t=`0${t}`;return t.length>=i&&(t=t.substring(t.length-i,t.length)),t}},t.unhex=function(e){return e instanceof Array?e.map(t.unhex):parseInt(`0x${e}`,16)}}function Ka(e,t){function i(e,t,i){let r=e<0;e=Math.abs(e);let[n,s]=e.toString().split(".");if(void 0===i){n=n.padStart(t,"0");let e=s?n+"."+s:n;return r?"-"+e:e}{let a=e.toFixed(i);[n,s]=a.toString().split("."),n=n.padStart(t,"0");let o=void 0===s?n:n+"."+s;return r?"-"+o:o}}function r(e,t){const i=(e=e.toString()).indexOf(".");let r=-1!==i?e.substring(i):"",n=-1!==i?e.substring(0,i):e;if(n=n.toString().replace(/\B(?=(\d{3})+(?!\d))/g,","),0===t)r="";else if(void 0!==t)if(t>r.length){r+=-1===i?".":"";const e=t-r.length+1;for(let t=0;t<e;t++)r+="0"}else r=r.substring(0,t+1);return n+r}function n(e){return parseFloat(e)>0?`+${e.toString()}`:e.toString()}function s(e){return parseFloat(e)>=0?` ${e.toString()}`:e.toString()}t.nf=function(e,t,r){if(e instanceof Array)return e.map((e=>i(e,t,r)));return"[object Arguments]"===Object.prototype.toString.call(e)?3===e.length?this.nf(e[0],e[1],e[2]):2===e.length?this.nf(e[0],e[1]):this.nf(e[0]):i(e,t,r)},t.nfc=function(e,t){return e instanceof Array?e.map((e=>r(e,t))):r(e,t)},t.nfp=function(...e){const i=t.nf.apply(this,e);return i instanceof Array?i.map(n):n(i)},t.nfs=function(...e){const i=t.nf.apply(this,e);return i instanceof Array?i.map(s):s(i)},t.splitTokens=function(e,t){let i;if(void 0!==t){let e=t;const r=/\]/g.exec(e);let n=/\[/g.exec(e);n&&r?(e=e.slice(0,r.index)+e.slice(r.index+1),n=/\[/g.exec(e),e=e.slice(0,n.index)+e.slice(n.index+1),i=new RegExp(`[\\[${e}\\]]`,"g")):r?(e=e.slice(0,r.index)+e.slice(r.index+1),i=new RegExp(`[${e}\\]]`,"g")):n?(e=e.slice(0,n.index)+e.slice(n.index+1),i=new RegExp(`[${e}\\[]`,"g")):i=new RegExp(`[${e}]`,"g")}else i=/\s/g;return e.split(i).filter((e=>e))},t.shuffle=function(e,t){const i=ArrayBuffer&&ArrayBuffer.isView&&ArrayBuffer.isView(e);let r,n,s=(e=t||i?e:e.slice()).length;for(;s>1;)r=this.random(0,1)*s|0,n=e[--s],e[s]=e[r],e[r]=n;return e}}function Ja(e,t){t.day=function(){return(new Date).getDate()},t.hour=function(){return(new Date).getHours()},t.minute=function(){return(new Date).getMinutes()},t.millis=function(){return-1===this._millisStart?0:window.performance.now()-this._millisStart},t.month=function(){return(new Date).getMonth()+1},t.second=function(){return(new Date).getSeconds()},t.year=function(){return(new Date).getFullYear()}}function Qa(e,t){t.orbitControl=function(e,t,i,r){this._assert3d("orbitControl");const n=this._renderer.states.curCamera;void 0===e&&(e=1),void 0===t&&(t=e),void 0===i&&(i=1),"object"!=typeof r&&(r={}),!0!==this.contextMenuDisabled&&(this.canvas.oncontextmenu=()=>!1,this.contextMenuDisabled=!0),!0!==this.wheelDefaultDisabled&&(this.canvas.onwheel=()=>!1,this.wheelDefaultDisabled=!0);const{disableTouchActions:s=!0}=r;!0!==this.touchActionsDisabled&&s&&(this.canvas.style["touch-action"]="none",this.touchActionsDisabled=!0);const{freeRotation:a=!1}=r,o=[];this.touches.forEach((e=>{this._renderer.prevTouches.forEach((t=>{if(e.id===t.id){const i={x:e.x,y:e.y,px:t.x,py:t.y};o.push(i)}}))})),this._renderer.prevTouches=this.touches;let h=0,u=0,l=0,c=0,p=0;const d=.85,f=this.height<this.width?this.height:this.width;let g=!1;if(o.length>0){if(g=o[0].x>0&&o[0].x<this.width&&o[0].y>0&&o[0].y<this.height,1===o.length){const i=o[0];u=-e*(i.x-i.px)/f,l=t*(i.y-i.py)/f}else{const e=o[0],t=o[1];h=-(Math.hypot(e.x-t.x,e.y-t.y)-Math.hypot(e.px-t.px,e.py-t.py))*i*4e-4,c=.5*(e.x+t.x)-.5*(e.px+t.px),p=.5*(e.y+t.y)-.5*(e.py+t.py)}this.touches.length>0?g&&(this._renderer.executeRotateAndMove=!0,this._renderer.executeZoom=!0):(this._renderer.executeRotateAndMove=!1,this._renderer.executeZoom=!1)}else g=this.mouseX>0&&this.mouseX<this.width&&this.mouseY>0&&this.mouseY<this.height,0!==this._mouseWheelDeltaY?(h=Math.sign(this._mouseWheelDeltaY)*i,h*=.01,this._mouseWheelDeltaY=0,g&&(this._renderer.executeZoom=!0)):this._renderer.executeZoom=!1,this.mouseIsPressed?(this.mouseButton.left?(u=-e*this.movedX/f,l=t*this.movedY/f):this.mouseButton.right&&(c=this.movedX,p=this.movedY*n.yScale),g&&(this._renderer.executeRotateAndMove=!0)):this._renderer.executeRotateAndMove=!1;if(0!==h&&this._renderer.executeZoom&&(this._renderer.zoomVelocity+=h),Math.abs(this._renderer.zoomVelocity)>.001?(a?n._orbitFree(0,0,this._renderer.zoomVelocity):n._orbit(0,0,this._renderer.zoomVelocity),0!==n.projMatrix.mat4[15]&&(n.projMatrix.mat4[0]*=Math.pow(10,-this._renderer.zoomVelocity),n.projMatrix.mat4[5]*=Math.pow(10,-this._renderer.zoomVelocity),this._renderer.states.setValue("uPMatrix",this._renderer.states.uPMatrix.clone()),this._renderer.states.uPMatrix.mat4[0]=n.projMatrix.mat4[0],this._renderer.states.uPMatrix.mat4[5]=n.projMatrix.mat4[5]),this._renderer.zoomVelocity*=d):this._renderer.zoomVelocity=0,0===u&&0===l||!this._renderer.executeRotateAndMove||this._renderer.rotateVelocity.add(.6*u,.6*l),this._renderer.rotateVelocity.magSq()>1e-6?(a?n._orbitFree(-this._renderer.rotateVelocity.x,this._renderer.rotateVelocity.y,0):n._orbit(this._renderer.rotateVelocity.x,this._renderer.rotateVelocity.y,0),this._renderer.rotateVelocity.mult(d)):this._renderer.rotateVelocity.set(0,0),(0!==c||0!==p)&&this._renderer.executeRotateAndMove){const e=2*c/this.width,t=2*-p/this.height;this._renderer.moveVelocity.add(.15*e,.15*t)}if(this._renderer.moveVelocity.magSq()>1e-6){const e=n._getLocalAxes(),t=n.eyeX-n.centerX,i=n.eyeY-n.centerY,r=n.eyeZ-n.centerZ,s=Math.sqrt(t*t+i*i+r*r);let a,o,h=new Zr(n.centerX,n.centerY,n.centerZ);h=n.cameraMatrix.multiplyPoint(h),h=this._renderer.states.uPMatrix.multiplyAndNormalizePoint(h),h.x-=this._renderer.moveVelocity.x,h.y-=this._renderer.moveVelocity.y;const u=this._renderer.states.uPMatrix.mat4;0===u[15]?(a=(u[8]+h.x)/u[0]*s,o=(u[9]+h.y)/u[5]*s):(a=(h.x-u[12])/u[0],o=(h.y-u[13])/u[5]),n.setPosition(n.eyeX+a*e.x[0]+o*e.y[0],n.eyeY+a*e.x[1]+o*e.y[1],n.eyeZ+a*e.x[2]+o*e.y[2]),this._renderer.moveVelocity.mult(d)}else this._renderer.moveVelocity.set(0,0);return this},t.debugMode=function(...t){this._assert3d("debugMode");for(let t=e.lifecycleHooks.postdraw.length-1;t>=0;t--)e.lifecycleHooks.postdraw[t].toString()!==this._grid().toString()&&e.lifecycleHooks.postdraw[t].toString()!==this._axesIcon().toString()||e.lifecycleHooks.postdraw.splice(t,1);t[0]===Se?e.lifecycleHooks.postdraw.push(this._grid(t[1],t[2],t[3],t[4],t[5])):t[0]===Fe?e.lifecycleHooks.postdraw.push(this._axesIcon(t[1],t[2],t[3],t[4])):(e.lifecycleHooks.postdraw.push(this._grid(t[0],t[1],t[2],t[3],t[4])),e.lifecycleHooks.postdraw.push(this._axesIcon(t[5],t[6],t[7],t[8])))},t.noDebugMode=function(){this._assert3d("noDebugMode");for(let t=e.lifecycleHooks.postdraw.length-1;t>=0;t--)e.lifecycleHooks.postdraw[t].toString()!==this._grid().toString()&&e.lifecycleHooks.postdraw[t].toString()!==this._axesIcon().toString()||e.lifecycleHooks.postdraw.splice(t,1)},t._grid=function(e,t,i,r,n){void 0===e&&(e=this.width/2),void 0===t&&(t=Math.round(e/30)<4?4:Math.round(e/30)),void 0===i&&(i=0),void 0===r&&(r=0),void 0===n&&(n=0);const s=e/t,a=e/2;return function(){this.push(),this.stroke(255*this._renderer.states.curStrokeColor[0],255*this._renderer.states.curStrokeColor[1],255*this._renderer.states.curStrokeColor[2]),this._renderer.states.setValue("uModelMatrix",this._renderer.states.uModelMatrix.clone()),this._renderer.states.uModelMatrix.reset();for(let e=0;e<=t;e++)this.beginShape(this.LINES),this.vertex(-a+i,r,e*s-a+n),this.vertex(+a+i,r,e*s-a+n),this.endShape();for(let e=0;e<=t;e++)this.beginShape(this.LINES),this.vertex(e*s-a+i,r,-a+n),this.vertex(e*s-a+i,r,+a+n),this.endShape();this.pop()}},t._axesIcon=function(e,t,i,r){return void 0===e&&(e=this.width/20>40?this.width/20:40),void 0===t&&(t=-this.width/4),void 0===i&&(i=t),void 0===r&&(r=t),()=>{this.push(),this._renderer.states.setValue("uModelMatrix",this._renderer.states.uModelMatrix.clone()),this._renderer.states.uModelMatrix.reset(),this.strokeWeight(2),this.stroke(255,0,0),this.beginShape(this.LINES),this.vertex(t,i,r),this.vertex(t+e,i,r),this.endShape(),this.stroke(0,255,0),this.beginShape(this.LINES),this.vertex(t,i,r),this.vertex(t,i+e,r),this.endShape(),this.stroke(0,0,255),this.beginShape(this.LINES),this.vertex(t,i,r),this.vertex(t,i,r+e),this.endShape(),this.pop()}}}async function eo(e){try{return(await fetch(e,{method:"HEAD"})).ok}catch(e){return!1}}function to(e,t){async function i(e){let t=null,i={};const{data:r}=await qn(e,"text"),n=r.split("\n");for(let e=0;e<n.length;++e){const r=n[e].trim().split(/\s+/);if("newmtl"===r[0]){t=r[1],i[t]={}}else"Kd"===r[0]?i[t].diffuseColor=[parseFloat(r[1]),parseFloat(r[2]),parseFloat(r[3])]:"Ka"===r[0]?i[t].ambientColor=[parseFloat(r[1]),parseFloat(r[2]),parseFloat(r[3])]:"Ks"===r[0]?i[t].specularColor=[parseFloat(r[1]),parseFloat(r[2]),parseFloat(r[3])]:"map_Kd"===r[0]&&(i[t].texturePath=r[1])}return i}function r(e,t,i={}){const r={v:[],vt:[],vn:[]},n={};let s=null,a=!1,o=!1;for(let h=0;h<t.length;++h){const u=t[h].trim().split(/\b\s+/);if(u.length>0)if("usemtl"===u[0])s=u[1];else if("v"===u[0]||"vn"===u[0]){const e=new Zr(parseFloat(u[1]),parseFloat(u[2]),parseFloat(u[3]));r[u[0]].push(e)}else if("vt"===u[0]){const e=[parseFloat(u[1]),1-parseFloat(u[2])];r[u[0]].push(e)}else if("f"===u[0])for(let t=3;t<u.length;++t){const h=[],l=[1,t-1,t];for(let t=0;t<l.length;++t){const c=u[l[t]];let p=c.split("/");for(let e=0;e<p.length;e++)p[e]=parseInt(p[e])-1;if(n[c]||(n[c]={}),void 0===n[c][s]){const t=e.vertices.length;if(e.vertices.push(r.v[p[0]].copy()),e.uvs.push(r.vt[p[1]]?r.vt[p[1]].slice():[0,0]),e.vertexNormals.push(r.vn[p[2]]?r.vn[p[2]].copy():new Zr),n[c][s]=t,h.push(t),s&&i[s]&&i[s].diffuseColor){a=!0;const t=i[s].diffuseColor;e.vertexColors.push(t[0]),e.vertexColors.push(t[1]),e.vertexColors.push(t[2]),e.vertexColors.push(1)}else o=!0}else h.push(n[c][s])}h[0]!==h[1]&&h[0]!==h[2]&&h[1]!==h[2]&&e.faces.push(h)}}if(0===e.vertexNormals.length&&e.computeNormals(),a===o)throw new Error("Model coloring is inconsistent. Either all vertices should have colors or none should.");return e}function n(e,t){if(function(e){const t=new DataView(e),i=[115,111,108,105,100];for(let e=0;e<5;e++)if(s(i,t,e))return!1;return!0}(t))!function(e,t){const i=new DataView(t),r=i.getUint32(80,!0);let n,s,a,o,h,u,l,c=!1;for(let e=0;e<70;e++)1129270351===i.getUint32(e,!1)&&82===i.getUint8(e+4)&&61===i.getUint8(e+5)&&(c=!0,o=[],h=i.getUint8(e+6)/255,u=i.getUint8(e+7)/255,l=i.getUint8(e+8)/255);const p=84,d=50;for(let t=0;t<r;t++){const r=p+t*d,f=i.getFloat32(r,!0),g=i.getFloat32(r+4,!0),m=i.getFloat32(r+8,!0);if(c){const e=i.getUint16(r+48,!0);32768&e?(n=h,s=u,a=l):(n=(31&e)/31,s=(e>>5&31)/31,a=(e>>10&31)/31)}const y=new Zr(f,g,m);for(let t=1;t<=3;t++){const h=r+12*t,u=new Zr(i.getFloat32(h,!0),i.getFloat32(h+4,!0),i.getFloat32(h+8,!0));e.vertices.push(u),e.vertexNormals.push(y),c&&o.push(n,s,a)}e.faces.push([3*t,3*t+1,3*t+2]),e.uvs.push([0,0],[0,0],[0,0])}}(e,t);else{const i=new DataView(t);if(!("TextDecoder"in window))return console.warn("Sorry, ASCII STL loading only works in browsers that support TextDecoder (https://caniuse.com/#feat=textencoder)"),e;!function(e,t){let i,r,n="",s=[];for(let a=0;a<t.length;++a){const o=t[a].trim(),h=o.split(" ");for(let e=0;e<h.length;++e)""===h[e]&&h.splice(e,1);if(0!==h.length)switch(n){case"":if("solid"!==h[0])return console.error(o),void console.error(`Invalid state "${h[0]}", should be "solid"`);n="solid";break;case"solid":if("facet"!==h[0]||"normal"!==h[1])return console.error(o),void console.error(`Invalid state "${h[0]}", should be "facet normal"`);i=new Zr(parseFloat(h[2]),parseFloat(h[3]),parseFloat(h[4])),e.vertexNormals.push(i,i,i),n="facet normal";break;case"facet normal":if("outer"!==h[0]||"loop"!==h[1])return console.error(o),void console.error(`Invalid state "${h[0]}", should be "outer loop"`);n="vertex";break;case"vertex":if("vertex"===h[0])r=new Zr(parseFloat(h[1]),parseFloat(h[2]),parseFloat(h[3])),e.vertices.push(r),e.uvs.push([0,0]),s.push(e.vertices.indexOf(r));else{if("endloop"!==h[0])return console.error(o),void console.error(`Invalid state "${h[0]}", should be "vertex" or "endloop"`);e.faces.push(s),s=[],n="endloop"}break;case"endloop":if("endfacet"!==h[0])return console.error(o),void console.error(`Invalid state "${h[0]}", should be "endfacet"`);n="endfacet";break;case"endfacet":if("endsolid"===h[0]);else{if("facet"!==h[0]||"normal"!==h[1])return console.error(o),void console.error(`Invalid state "${h[0]}", should be "endsolid" or "facet normal"`);i=new Zr(parseFloat(h[2]),parseFloat(h[3]),parseFloat(h[4])),e.vertexNormals.push(i,i,i),n="facet normal"}break;default:console.error(`Invalid state "${n}"`)}}}(e,new TextDecoder("utf-8").decode(i).split("\n"))}return e}function s(e,t,i){for(let r=0,n=e.length;r<n;r++)if(e[r]!==t.getUint8(i+r,!1))return!1;return!0}t.loadModel=async function(t,s,a,o,h){let u=!1,l=!1;"object"==typeof s?(a=s.normalize||!1,o=s.successCallback,h=s.failureCallback,u=(s=s.fileType||s).flipU||!1,l=s.flipV||!1):("function"==typeof arguments[arguments.length-1]&&("function"==typeof arguments[arguments.length-2]?(o=arguments[arguments.length-2],h=arguments[arguments.length-1]):o=arguments[arguments.length-1]),"string"==typeof s?"boolean"!=typeof a&&(a=!1):"boolean"==typeof s?(a=s,s=t.slice(-4)):(s=t.slice(-4),a=!1)),".obj"!==s.toLowerCase()&&".stl"!==s.toLowerCase()&&(s=".obj");const c=new ws(void 0,void 0,void 0,this._renderer);c.gid=`${t}|${a}`;try{if(s.match(/\.stl$/i)){const{data:e}=await qn(t,"arrayBuffer");return n(c,e),a&&c.normalize(),u&&c.flipU(),l&&c.flipV(),c._makeTriangleEdges(),o?o(c):c}if(s.match(/\.obj$/i)){const{data:e}=await qn(t,"text"),n=e.split("\n"),s=await async function(e){const r=[];for(let n of e){const e=n.match(/^mtllib (.+)/);if(e){let n="";const s=e[1],a=t.split("/");if(a.length>1){a.pop();const e=a.join("/");n=e+"/"+s}else n=s;r.push(eo(n).then((e=>e?i(n):(console.warn(`MTL file not found or error in parsing; proceeding without materials: ${n}`),{}))).catch((e=>(console.warn(`Error loading MTL file: ${n}`,e),{}))))}}try{const e=await Promise.all(r);return Object.assign({},...e)}catch(e){return{}}}(n);return r(c,n,s),a&&c.normalize(),u&&c.flipU(),l&&c.flipV(),c._makeTriangleEdges(),o?o(c):c}}catch(i){if(e._friendlyFileLoadError(3,t),h)return h(i);throw i}},t.model=function(e,t=1){this._assert3d("model"),this._renderer.model(e,t)};let a=0;t.createModel=function(t,i=" ",s){let o,h,u=!1,l=!1,c=!1;s&&"object"==typeof s?(u=s.normalize||!1,o=s.successCallback,h=s.failureCallback,l=s.flipU||!1,c=s.flipV||!1):"boolean"==typeof s?(u=s,o=arguments[3],h=arguments[4]):(o="function"==typeof arguments[2]?arguments[2]:void 0,h=arguments[3]);const p=new e.Geometry;if(p.gid=`${i}|${u}|${a++}`,i.match(/\.stl$/i))try{n(p,(new TextEncoder).encode(t).buffer)}catch(t){return void(h?h(t):e._friendlyError("Error during parsing: "+t.message))}else if(i.match(/\.obj$/i))try{r(p,t.split("\n"))}catch(t){return void(h?h(t):e._friendlyError("Error during parsing: "+t.message))}else e._friendlyFileLoadError(3,t),h?h():e._friendlyError("Sorry, the file type is invalid. Only OBJ and STL files are supported.");return u&&p.normalize(),l&&p.flipU(),c&&p.flipV(),p._makeTriangleEdges(),"function"==typeof o&&o(p),p}}void 0!==p5&&qa(p5),void 0!==p5&&Ha(0,p5.prototype),void 0!==p5&&Wa(0,p5.prototype),void 0!==p5&&Xa(0,p5.prototype),void 0!==p5&&Ya(p5,p5.prototype),void 0!==p5&&Za(0,p5.prototype),void 0!==p5&&Ka(0,p5.prototype),void 0!==p5&&Ja(0,p5.prototype),void 0!==p5&&Qa(p5,p5.prototype),void 0!==p5&&to(p5,p5.prototype);const io="ideographic",ro="middle",no="_textBoundsSingle",so="_fontBoundsSingle",ao="hanging",oo="start",ho="end";function uo(e,t){const i=/\r?\n/g,r=/,\s+/,n=/^".*"$/,s=/\t/g,a=new RegExp(`(?:${["wght","wdth","ital","slnt","opsz"].join("|")})`);["text","textAlign","textAscent","textDescent","textLeading","textMode","textFont","textSize","textStyle","textWidth","textWrap","textBounds","textDirection","textProperty","textProperties","fontBounds","fontWidth","fontAscent","fontDescent","textWeight"].forEach((i=>{t[i]=function(...e){if(!(i in En.prototype))throw Error(`Renderer2D.prototype.${i} is not defined.`);return this._renderer[i](...e)},e.Graphics.prototype[i]=function(...e){return this._renderer[i](...e)}}));const o={textAlign:{default:t.LEFT,type:"Context2d"},textBaseline:{default:t.BASELINE,type:"Context2d"},textFont:{default:{family:"sans-serif"}},textLeading:{default:15},textSize:{default:12},textWrap:{default:t.WORD},fontStretch:{default:t.NORMAL,isShorthand:!0},fontWeight:{default:t.NORMAL,isShorthand:!0},lineHeight:{default:t.NORMAL,isShorthand:!0},fontVariant:{default:t.NORMAL,isShorthand:!0},fontStyle:{default:t.NORMAL,isShorthand:!0},direction:{default:"inherit"}},h=["font","direction","fontKerning","fontStretch","fontVariantCaps","letterSpacing","textAlign","textBaseline","textRendering","wordSpacing"],u=Object.keys(o).filter((e=>o[e].isShorthand)),l=["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded"];let c,p;if(En.prototype.text=function(e,t,i,r,n){let s=this.textDrawingContext().textBaseline;({x:t,y:i,width:r,height:n}=this._handleRectMode(t,i,r,n));let a=this._processLines(e,r,n);a=this._positionLines(t,i,r,n,a),a.forEach((e=>this._renderText(e.text,e.x,e.y))),this.textDrawingContext().textBaseline=s},En.prototype.textBounds=function(e,t,i,r,n){return this._computeBounds(no,e,t,i,r,n).bounds},En.prototype.fontBounds=function(e,t,i,r,n){return this._computeBounds(so,e,t,i,r,n).bounds},En.prototype.textWidth=function(e){let t=this._processLines(e);return Math.max(...t.map((e=>this._textWidthSingle(e))))},En.prototype.fontWidth=function(e){let t=this._processLines(e);return Math.max(...t.map((e=>this._fontWidthSingle(e))))},En.prototype.textAscent=function(e=""){return e.length?this.textDrawingContext().measureText(e).actualBoundingBoxAscent:this.fontAscent()},En.prototype.fontAscent=function(){return this.textDrawingContext().measureText("_").fontBoundingBoxAscent},En.prototype.textDescent=function(e=""){return e.length?this.textDrawingContext().measureText(e).actualBoundingBoxDescent:this.fontDescent()},En.prototype.fontDescent=function(){return this.textDrawingContext().measureText("_").fontBoundingBoxDescent},En.prototype.textAlign=function(e,i){return void 0!==e?(this.states.setValue("textAlign",e),void 0!==i&&(i===t.CENTER&&(i=ro),this.states.setValue("textBaseline",i)),this._applyTextProperties()):{horizontal:this.states.textAlign,vertical:this.states.textBaseline}},En.prototype._currentTextFont=function(){return this.states.textFont.font||this.states.textFont.family},En.prototype.textFont=function(t,i,r){if(0===arguments.length)return this._currentTextFont();let n=t;if(t instanceof e.Font?n=t.face.family:t.data instanceof Uint8Array?(n=t.name.fontFamily,t.name?.fontSubfamily&&(n+="-"+t.name.fontSubfamily)):"string"==typeof t&&void 0===i&&/[.0-9]+(%|em|p[xt])/.test(n)&&({family:n,size:i}=this._directSetFontString(n)),"string"!=typeof n)throw Error("null font in textFont()");return 2===arguments.length&&"object"==typeof i&&(r=i,i=void 0),this.states.setValue("textFont",{font:t,family:n,size:i}),void 0!==i&&this._setTextSize(i),"object"==typeof r&&this.textProperties(r),this._applyTextProperties()},En.prototype._directSetFontString=function(e,t=0){t&&console.log('_directSetFontString"'+e+'"');let i=u.reduce(((e,t)=>(e[t]=o[t].default,e)),{}),r=this._cachedDiv(i);r.style.font=e;let n=getComputedStyle(r);return u.forEach((e=>{this.states[e]=n[e],t&&console.log(" this.states."+e+'="'+n[e]+'"')})),{family:n.fontFamily,size:n.fontSize}},En.prototype.textLeading=function(e){return"number"==typeof e?(this.states.setValue("leadingSet",!0),this.states.setValue("textLeading",e),this._applyTextProperties()):this.states.textLeading},En.prototype.textWeight=function(t){return"number"==typeof t?(this.states.setValue("fontWeight",t),this._applyTextProperties(),void(e.prototype._isSafari()||this._setCanvasStyleProperty("font-variation-settings",`"wght" ${t}`))):this.states.fontWeight},En.prototype.textSize=function(e){return void 0!==e?(this._setTextSize(e),this._applyTextProperties()):this.states.textSize},En.prototype.textStyle=function(e){return void 0!==e?(this.states.setValue("fontStyle",e),this._applyTextProperties()):this.states.fontStyle},En.prototype.textWrap=function(e){return e===t.WORD||e===t.CHAR?(this.states.setValue("textWrap",e),this._pInst):this.states.textWrap},En.prototype.textDirection=function(e){return void 0!==e?(this.states.setValue("direction",e),this._applyTextProperties()):this.states.direction},En.prototype.textProperty=function(e,t,i){let r=!1,n=i?.debug||!1;if(void 0===t){let t=this.textProperties();if(e in t)return t[e];throw Error('Unknown text option "'+e+'"')}return e in this.states&&this.states[e]!==t?(this.states[e]=t,r=!0,n&&console.log("this.states."+e+'="'+options[e]+'"')):e in this.textDrawingContext()?(this._setContextProperty(e,t,n),r=!0):e in this.textCanvas().style?(this._setCanvasStyleProperty(e,t,n),r=!0):console.warn('Ignoring unknown text option: "'+e+'"\n'),r?this._applyTextProperties():this._pInst},En.prototype.textProperties=function(e){if(void 0!==e)return Object.keys(e).forEach((t=>{this.textProperty(t,e[t])})),this._pInst;let t=this.textDrawingContext();return e=h.reduce(((e,i)=>(e[i]=t[i],e)),{}),Object.keys(o).forEach((i=>{if("Context2d"===o[i]?.type)e[i]=t[i];else if("textFont"===i){let t=this._currentTextFont();"object"==typeof t&&"_pInst"in t&&(t=Object.assign({},t),delete t._pInst),e[i]=t}else e[i]=this.states[i]})),e},En.prototype.textMode=function(){},En.prototype._currentTextFont=function(){return this.states.textFont.font||this.states.textFont.family},En.prototype._computeBounds=function(t,i,r,n,s,a,o){let h=this.textDrawingContext(),u=h.textBaseline,{textLeading:l,textAlign:c}=this.states;({width:s,height:a}=this._rectModeAdjust(r,n,s,a));let p=this._processLines(i,s,a),d=p.map(((e,i)=>this[t].bind(this)(e,r,n+i*l)));if(p.length>1){const t=d.reduce(((e,t)=>Math.max(e,t.w||0)),0);d.forEach((i=>{const r=s??t;i.x+=e.Renderer2D.prototype._xAlignOffset.call(this,c,r)}))}void 0!==a&&e.Renderer2D.prototype._yAlignOffset.call(this,d,a);let f=d[0];return p.length>1&&(f=this._aggregateBounds(d),o?.ignoreRectMode||this._rectModeAlign(f,s||0,a||0)),h.textBaseline=u,{bounds:f,lines:p}},En.prototype._rectModeAdjust=function(e,i,r,n){if(void 0!==r)switch(this.states.rectMode){case t.CENTER:break;case t.CORNERS:r-=e,n-=i;break;case t.RADIUS:r*=2,n*=2}return{x:e,y:i,width:r,height:n}},En.prototype._setCanvasStyleProperty=function(e,t,i){let r=t.toString();i&&console.log("canvas.style."+e+'="'+r+'"'),"fontVariationSettings"===e&&this._handleFontVariationSettings(r),this.textCanvas().style[e]=r,this.textCanvas().style[e]},En.prototype._handleFontVariationSettings=function(e,t=!1){"object"==typeof e&&(e=Object.keys(e).map((t=>t+" "+e[t])).join(", ")),e.split(r).forEach((e=>{e=e.replace(/["']/g,"");let i=a.exec(e);if(i&&i.length){let r=i[0],n=parseFloat(parseFloat(e.replace(r,"").trim()).toFixed(3));switch(r){case"wght":return t&&console.log("setting font-weight="+n),this.states.fontWeight!==n&&this.textWeight(n),n;case"wdth":break;case"ital":t&&console.log("setting font-style="+(n?"italic":"normal"));break;case"slnt":t&&console.log("setting font-style="+(n?"oblique":"normal"));break;case"opsz":t&&console.log("setting font-optical-size="+n)}}}))},En.prototype._setContextProperty=function(e,t,i=!1){if(this.textDrawingContext()[e]===t)return this._pInst;(c??=[]).push([e,t]),i&&console.log("queued context2d."+e+'="'+t+'"')},En.prototype._handleRectMode=function(e,i,r,n){let s=this.states.rectMode;if(void 0!==r)switch(s){case t.RADIUS:e-=(r*=2)/2,void 0!==n&&(i-=(n*=2)/2);break;case t.CENTER:e-=r/2,void 0!==n&&(i-=n/2);break;case t.CORNERS:r-=e,void 0!==n&&(n-=i)}return{x:e,y:i,width:r,height:n}},En.prototype._fontSizePx=function(e,{family:t}=this.states.textFont){if(i=e,!isNaN(i)&&""!==i.trim())return parseFloat(e);var i;let r=this._cachedDiv({fontSize:e});r.style.fontSize=e,r.style.fontFamily=t;let n=getComputedStyle(r).fontSize,s=parseFloat(n);if("number"!=typeof s)throw Error("textSize: invalid font-size");return s},En.prototype._cachedDiv=function(e){if(void 0===p){let t=document.createElement("div");t.ariaHidden="true",t.style.display="none",Object.entries(e).forEach((([e,i])=>{t.style[e]=i})),this.textCanvas().appendChild(t),p=t}return p},En.prototype._aggregateBounds=function(e){let t=Math.min(...e.map((e=>e.x))),i=Math.min(...e.map((e=>e.y))),r=Math.max(...e.map((e=>e.y+e.h))),n=Math.max(...e.map((e=>e.x+e.w)));return{x:t,y:i,w:n-t,h:r-i}},En.prototype._processLines=function(e,i,r){if(void 0!==i){this.textDrawingContext().textBaseline===t.BASELINE&&(this.drawingContext.textBaseline=t.TOP)}let n=this._splitOnBreaks(e.toString()),s=n.length>1,a=void 0!==i,o=a&&n.some((e=>this._textWidthSingle(e)>i)),{textLeading:h,textWrap:u}=this.states;if((s||o)&&a&&(n=this._lineate(u,n,i)),a&&void 0!==r){if(void 0===h)throw Error("leading is required if height is specified");for(let e=0;e<n.length;e++){if(h*(e+1)>r){n=n.slice(0,e);break}}}return n},En.prototype._xAlignOffset=function(e,i){switch(e){case t.LEFT:return 0;case t.CENTER:return i/2;case t.RIGHT:return i;case oo:return 0;case ho:throw new Error("textBounds: END not yet supported for textAlign");default:return 0}},En.prototype._rectModeAlign=function(e,i,r){if(void 0!==i){switch(this.states.rectMode){case t.CENTER:e.x-=(i-e.w)/2,e.y-=(r-e.h)/2;break;case t.CORNERS:e.w+=e.x,e.h+=e.y;break;case t.RADIUS:e.x-=(i-e.w)/2,e.y-=(r-e.h)/2,e.w/=2,e.h/=2}return e}},En.prototype._rectModeAlignRevert=function(e,i,r){if(void 0!==i){switch(this.states.rectMode){case t.CENTER:e.x+=(i-e.w)/2,e.y+=(r-e.h)/2;break;case t.CORNERS:e.w-=e.x,e.h-=e.y;break;case t.RADIUS:e.x+=(i-e.w)/2,e.y+=(r-e.h)/2,e.w*=2,e.h*=2}return e}},En.prototype._textWidthSingle=function(e){let t=this.textDrawingContext().measureText(e),i=t.actualBoundingBoxLeft;return t.actualBoundingBoxRight+i},En.prototype._fontWidthSingle=function(e){return this.textDrawingContext().measureText(e).width},En.prototype._textBoundsSingle=function(e,t=0,i=0){let r=this.textDrawingContext().measureText(e),n=r.actualBoundingBoxAscent,s=r.actualBoundingBoxDescent,a=r.actualBoundingBoxLeft;return{x:t-a,y:i-n,w:r.actualBoundingBoxRight+a,h:n+s}},En.prototype._fontBoundsSingle=function(e,t=0,i=0){let r=this.textDrawingContext().measureText(e),n=r.fontBoundingBoxAscent,s=r.fontBoundingBoxDescent;return{x:t-=this._xAlignOffset(this.states.textAlign,r.width),y:i-n,w:r.width,h:n+s}},En.prototype._setTextSize=function(e){if("string"==typeof e&&(e=this._fontSizePx(e)),"number"==typeof e){if(this.states.textSize!==e)return this.states.setValue("textSize",e),this.states.leadingSet||this.states.setValue("textLeading",1.275*this.states.textSize),!0}else console.warn("textSize: invalid size: "+e);return!1},En.prototype._lineate=function(e,i,r=1/0,n={}){let s,a,o,h,u=n.splitChar??(e===t.WORD?" ":""),l=[];for(let e=0;e<i.length;e++){s="",h=i[e].split(u);for(let e=0;e<h.length;e++)a=`${s+h[e]}`+u,o=this._textWidthSingle(a),s.length>0&&o>r?(l.push(s.trim()),s=`${h[e]}`+u):s=a;l.push(s.trim())}return l},En.prototype._splitOnBreaks=function(e){return e&&0!==e.length?e.replace(s," ").split(i):[""]},En.prototype._parseFontFamily=function(e){return e.split(r).map((e=>((e=e.trim()).indexOf(" ")>-1&&!n.test(e)&&(e=`"${e}"`),e))).join(", ")},En.prototype._applyFontString=function(){let{textFont:e,textSize:i,lineHeight:r,fontStyle:n,fontWeight:s,fontVariant:a}=this.states,o=this.textDrawingContext(),h=this._parseFontFamily(e.family),u=n!==t.NORMAL?`${n} `:"",l=s!==t.NORMAL?`${s} `:"",c=`${u}${a!==t.NORMAL?`${a} `:""}${l}${`${i}px`+(r!==t.NORMAL?`/${r} `:" ")}${h}`.trim();if(o.font=c,o.font!==c){if(c!==o.font)return!1}return!0},En.prototype._applyTextProperties=function(e=!1){this._applyFontString();let t=this.textDrawingContext();t.direction=this.states.direction,t.textAlign=this.states.textAlign,t.textBaseline=this.states.textBaseline;let i=this.states.fontStretch;for(l.includes(i)&&t.fontStretch!==i&&(t.fontStretch=i);c?.length;){let[i,r]=c.shift();e&&console.log('apply context property "'+i+'" = "'+r+'"'),t[i]=r,t[i]!==r&&(console.warn(`Unable to set '${i}' property on context2d. It may not be supported.`),console.log('Expected "'+r+'" but got: "'+t[i]+'"'))}return this._pInst},e.Renderer2D&&(e.Renderer2D.prototype.textCanvas=function(){return this.canvas},e.Renderer2D.prototype.textDrawingContext=function(){return this.drawingContext},e.Renderer2D.prototype._renderText=function(e,t,i,r,n){let s=this.states,a=this.textDrawingContext();i<n||i>=r||(this.push(),s.strokeColor&&s.strokeSet&&a.strokeText(e,t,i),!this._clipping&&s.fillColor&&(s.fillSet||this._setFill("#000000"),a.fillText(e,t,i)),this.pop())},e.Renderer2D.prototype._positionLines=function(e,i,r,n,s){let a,{textLeading:o,textAlign:h}=this.states,u=new Array(s.length),l=void 0===r?0:r,c=void 0===n?0:n;for(let r=0;r<s.length;r++){switch(h){case oo:throw new Error("textBounds: START not yet supported for textAlign");case t.LEFT:a=e;break;case t.CENTER:a=e+l/2;break;case t.RIGHT:a=e+l;break;case ho:throw new Error("textBounds: END not yet supported for textAlign")}u[r]={text:s[r],x:a,y:i+r*o}}return this._yAlignOffset(u,c)},e.Renderer2D.prototype._yAlignOffset=function(e,i){if(void 0===i)throw Error("_yAlignOffset: height is required");let{textLeading:r,textBaseline:n}=this.states,s=0,a=i-r*(e.length-1);switch(n){case t.TOP:case t.BASELINE:break;case ro:s=a/2;break;case t.BOTTOM:s=a;break;case io:console.warn("textBounds: IDEOGRAPHIC not yet supported for textBaseline");break;case ao:console.warn("textBounds: HANGING not yet supported for textBaseline")}return e.forEach((e=>e.y+=s)),e}),e.RendererGL){e.RendererGL.prototype.textCanvas=function(){return this._textCanvas||(this._textCanvas=document.createElement("canvas"),this._textCanvas.width=1,this._textCanvas.height=1,this._textCanvas.style.display="none",this.canvas.parentElement.insertBefore(this._textCanvas,this.canvas)),this._textCanvas},e.RendererGL.prototype.textDrawingContext=function(){if(!this._textDrawingContext){const e=this.textCanvas();this._textDrawingContext=e.getContext("2d")}return this._textDrawingContext};const i=e.RendererGL.prototype.remove;e.RendererGL.prototype.remove=function(){this._textCanvas&&this._textCanvas.parentElement.removeChild(this._textCanvas),i.call(this)},e.RendererGL.prototype._positionLines=function(e,i,r,n,s){let{textLeading:a,textAlign:o}=this.states;const h=s.map((e=>this._fontWidthSingle(e)));let u,l=new Array(s.length),c=void 0===r?Math.max(0,...h):r,p=void 0===n?0:n;for(let n=0;n<s.length;n++){switch(o){case oo:throw new Error("textBounds: START not yet supported for textAlign");case t.LEFT:u=e;break;case t.CENTER:u=e+(c-h[n])/2-c/2+(r||0)/2;break;case t.RIGHT:u=e+c-h[n]-c+(r||0);break;case ho:throw new Error("textBounds: END not yet supported for textAlign")}l[n]={text:s[n],x:u,y:i+n*a}}return this._yAlignOffset(l,p)},e.RendererGL.prototype._yAlignOffset=function(e,i){if(void 0===i)throw Error("_yAlignOffset: height is required");let{textLeading:r,textBaseline:n,textSize:s}=this.states,a=0,o=e.length,h=s*o+(r-s)*(o-1);switch(n){case t.TOP:a=s;break;case t.BASELINE:break;case ro:a=-h/2+s+(i||0)/2;break;case t.BOTTOM:a=-(h-s)+(i||0);break;default:console.warn(`${n} is not supported in WebGL mode.`)}return a+=this.states.textFont.font?._verticalAlign(s)||0,e.forEach((e=>e.y+=a)),e}}}void 0!==p5&&uo(p5,p5.prototype);var lo={};Object.defineProperty(lo,"__esModule",{value:!0});var co=function(){function e(){}return e.parse=function(t){for(var i=new Set,r=0,n=t;r<n.length;r++){var s=n[r];if(!e.REGEXP.test(s))throw new TypeError('"'+s+'" is invalid unicode-range.');var a=s.match(e.REGEXP),o=a[1],h=a[2],u=a[3];if(o){if(/\?[^?]+$/.test(o))throw new TypeError('"'+s+'" is invalid unicode-range.');if(o.includes("?"))for(var l=o.replace(/\?/g,"0"),c=o.replace(/\?/g,"F"),p=0,d=e.parse(["U+"+l+"-"+c]);p<d.length;p++){var f=d[p];i.add(f)}else i.add(parseInt(o,16))}if(h&&u){var g=parseInt(h,16),m=parseInt(u,16);for(f=g;f<=m;f++)i.add(f)}}return Array.from(i).sort((function(e,t){return e-t}))},e.stringify=function(t){for(var i,r=Array.from(new Set(t)).sort((function(e,t){return e-t})),n=[],s=0;s<r.length;s++){var a=r[s],o=r[s-1];i&&a-o!=1&&(n.push(e.rangeString(i,o)),i=a),i||(i=a),s===r.length-1&&(i===a?n.push(e.rangeString(a)):n.push(e.rangeString(i,a)))}return n},e.rangeString=function(e,t){return t&&e!==t?"U+"+e.toString(16)+"-"+t.toString(16):"U+"+e.toString(16)},e.REGEXP=/^u\+(?:([0-9a-f]?[0-9a-f?]{1,5})|([0-9a-f]{1,6})-([0-9a-f]{1,6}))?$/i,e}(),po=lo.UnicodeRange=co;const fo=[{category:"control character",hexrange:["0000","001f"]},{category:"basic latin",hexrange:["0000","007f"]},{category:"latin-1 supplement",hexrange:["0080","00ff"]},{category:"latin extended-a",hexrange:["0100","017f"]},{category:"latin extended-b",hexrange:["0180","024f"]},{category:"ipa extensions",hexrange:["0250","02af"]},{category:"spacing modifier letters",hexrange:["02b0","02ff"]},{category:"combining diacritical marks",hexrange:["0300","036f"]},{category:"greek and coptic",hexrange:["0370","03ff"]},{category:"cyrillic",hexrange:["0400","04ff"]},{category:"cyrillic supplement",hexrange:["0500","052f"]},{category:"armenian",hexrange:["0530","058f"]},{category:"hebrew",hexrange:["0590","05ff"]},{category:"arabic",hexrange:["0600","06ff"]},{category:"syriac",hexrange:["0700","074f"]},{category:"arabic supplement",hexrange:["0750","077f"]},{category:"thaana",hexrange:["0780","07bf"]},{category:"nko",hexrange:["07c0","07ff"]},{category:"samaritan",hexrange:["0800","083f"]},{category:"mandaic",hexrange:["0840","085f"]},{category:"syriac supplement",hexrange:["0860","086f"]},{category:"arabic extended-b",hexrange:["0870","089f"]},{category:"arabic extended-a",hexrange:["08a0","08ff"]},{category:"devanagari",hexrange:["0900","097f"]},{category:"bengali",hexrange:["0980","09ff"]},{category:"gurmukhi",hexrange:["0a00","0a7f"]},{category:"gujarati",hexrange:["0a80","0aff"]},{category:"oriya",hexrange:["0b00","0b7f"]},{category:"tamil",hexrange:["0b80","0bff"]},{category:"telugu",hexrange:["0c00","0c7f"]},{category:"kannada",hexrange:["0c80","0cff"]},{category:"malayalam",hexrange:["0d00","0d7f"]},{category:"sinhala",hexrange:["0d80","0dff"]},{category:"thai",hexrange:["0e00","0e7f"]},{category:"lao",hexrange:["0e80","0eff"]},{category:"tibetan",hexrange:["0f00","0fff"]},{category:"myanmar",hexrange:["1000","109f"]},{category:"georgian",hexrange:["10a0","10ff"]},{category:"hangul jamo",hexrange:["1100","11ff"]},{category:"ethiopic",hexrange:["1200","137f"]},{category:"ethiopic supplement",hexrange:["1380","139f"]},{category:"cherokee",hexrange:["13a0","13ff"]},{category:"unified canadian aboriginal syllabics",hexrange:["1400","167f"]},{category:"ogham",hexrange:["1680","169f"]},{category:"runic",hexrange:["16a0","16ff"]},{category:"tagalog",hexrange:["1700","171f"]},{category:"hanunoo",hexrange:["1720","173f"]},{category:"buhid",hexrange:["1740","175f"]},{category:"tagbanwa",hexrange:["1760","177f"]},{category:"khmer",hexrange:["1780","17ff"]},{category:"mongolian",hexrange:["1800","18af"]},{category:"unified canadian aboriginal syllabics extended",hexrange:["18b0","18ff"]},{category:"limbu",hexrange:["1900","194f"]},{category:"tai le",hexrange:["1950","197f"]},{category:"new tai lue",hexrange:["1980","19df"]},{category:"khmer symbols",hexrange:["19e0","19ff"]},{category:"buginese",hexrange:["1a00","1a1f"]},{category:"tai tham",hexrange:["1a20","1aaf"]},{category:"combining diacritical marks extended",hexrange:["1ab0","1aff"]},{category:"balinese",hexrange:["1b00","1b7f"]},{category:"sundanese",hexrange:["1b80","1bbf"]},{category:"batak",hexrange:["1bc0","1bff"]},{category:"lepcha",hexrange:["1c00","1c4f"]},{category:"ol chiki",hexrange:["1c50","1c7f"]},{category:"cyrillic extended-c",hexrange:["1c80","1c8f"]},{category:"georgian extended",hexrange:["1c90","1cbf"]},{category:"sundanese supplement",hexrange:["1cc0","1ccf"]},{category:"vedic extensions",hexrange:["1cd0","1cff"]},{category:"phonetic extensions",hexrange:["1d00","1d7f"]},{category:"phonetic extensions supplement",hexrange:["1d80","1dbf"]},{category:"combining diacritical marks supplement",hexrange:["1dc0","1dff"]},{category:"latin extended additional",hexrange:["1e00","1eff"]},{category:"greek extended",hexrange:["1f00","1fff"]},{category:"general punctuation",hexrange:["2000","206f"]},{category:"superscripts and subscripts",hexrange:["2070","209f"]},{category:"currency symbols",hexrange:["20a0","20cf"]},{category:"combining diacritical marks for symbols",hexrange:["20d0","20ff"]},{category:"letterlike symbols",hexrange:["2100","214f"]},{category:"number forms",hexrange:["2150","218f"]},{category:"arrows",hexrange:["2190","21ff"]},{category:"mathematical operators",hexrange:["2200","22ff"]},{category:"miscellaneous technical",hexrange:["2300","23ff"]},{category:"control pictures",hexrange:["2400","243f"]},{category:"optical character recognition",hexrange:["2440","245f"]},{category:"enclosed alphanumerics",hexrange:["2460","24ff"]},{category:"box drawing",hexrange:["2500","257f"]},{category:"block elements",hexrange:["2580","259f"]},{category:"geometric shapes",hexrange:["25a0","25ff"]},{category:"miscellaneous symbols",hexrange:["2600","26ff"]},{category:"dingbats",hexrange:["2700","27bf"]},{category:"miscellaneous mathematical symbols-a",hexrange:["27c0","27ef"]},{category:"supplemental arrows-a",hexrange:["27f0","27ff"]},{category:"braille patterns",hexrange:["2800","28ff"]},{category:"supplemental arrows-b",hexrange:["2900","297f"]},{category:"miscellaneous mathematical symbols-b",hexrange:["2980","29ff"]},{category:"supplemental mathematical operators",hexrange:["2a00","2aff"]},{category:"miscellaneous symbols and arrows",hexrange:["2b00","2bff"]},{category:"glagolitic",hexrange:["2c00","2c5f"]},{category:"latin extended-c",hexrange:["2c60","2c7f"]},{category:"coptic",hexrange:["2c80","2cff"]},{category:"georgian supplement",hexrange:["2d00","2d2f"]},{category:"tifinagh",hexrange:["2d30","2d7f"]},{category:"ethiopic extended",hexrange:["2d80","2ddf"]},{category:"cyrillic extended-a",hexrange:["2de0","2dff"]},{category:"supplemental punctuation",hexrange:["2e00","2e7f"]},{category:"cjk radicals supplement",hexrange:["2e80","2eff"]},{category:"kangxi radicals",hexrange:["2f00","2fdf"]},{category:"ideographic description characters",hexrange:["2ff0","2fff"]},{category:"cjk symbols and punctuation",hexrange:["3000","303f"]},{category:"hiragana",hexrange:["3040","309f"]},{category:"katakana",hexrange:["30a0","30ff"]},{category:"bopomofo",hexrange:["3100","312f"]},{category:"hangul compatibility jamo",hexrange:["3130","318f"]},{category:"kanbun",hexrange:["3190","319f"]},{category:"bopomofo extended",hexrange:["31a0","31bf"]},{category:"cjk strokes",hexrange:["31c0","31ef"]},{category:"katakana phonetic extensions",hexrange:["31f0","31ff"]},{category:"enclosed cjk letters and months",hexrange:["3200","32ff"]},{category:"cjk compatibility",hexrange:["3300","33ff"]},{category:"cjk unified ideographs extension a",hexrange:["3400","4dbf"]},{category:"yijing hexagram symbols",hexrange:["4dc0","4dff"]},{category:"cjk unified ideographs",hexrange:["4e00","9fff"]},{category:"yi syllables",hexrange:["a000","a48f"]},{category:"yi radicals",hexrange:["a490","a4cf"]},{category:"lisu",hexrange:["a4d0","a4ff"]},{category:"vai",hexrange:["a500","a63f"]},{category:"cyrillic extended-b",hexrange:["a640","a69f"]},{category:"bamum",hexrange:["a6a0","a6ff"]},{category:"modifier tone letters",hexrange:["a700","a71f"]},{category:"latin extended-d",hexrange:["a720","a7ff"]},{category:"syloti nagri",hexrange:["a800","a82f"]},{category:"common indic number forms",hexrange:["a830","a83f"]},{category:"phags-pa",hexrange:["a840","a87f"]},{category:"saurashtra",hexrange:["a880","a8df"]},{category:"devanagari extended",hexrange:["a8e0","a8ff"]},{category:"kayah li",hexrange:["a900","a92f"]},{category:"rejang",hexrange:["a930","a95f"]},{category:"hangul jamo extended-a",hexrange:["a960","a97f"]},{category:"javanese",hexrange:["a980","a9df"]},{category:"myanmar extended-b",hexrange:["a9e0","a9ff"]},{category:"cham",hexrange:["aa00","aa5f"]},{category:"myanmar extended-a",hexrange:["aa60","aa7f"]},{category:"tai viet",hexrange:["aa80","aadf"]},{category:"meetei mayek extensions",hexrange:["aae0","aaff"]},{category:"ethiopic extended-a",hexrange:["ab00","ab2f"]},{category:"latin extended-e",hexrange:["ab30","ab6f"]},{category:"cherokee supplement",hexrange:["ab70","abbf"]},{category:"meetei mayek",hexrange:["abc0","abff"]},{category:"hangul syllables",hexrange:["ac00","d7af"]},{category:"hangul jamo extended-b",hexrange:["d7b0","d7ff"]},{category:"high surrogates",hexrange:["d800","db7f"]},{category:"high private use surrogates",hexrange:["db80","dbff"]},{category:"low surrogates",hexrange:["dc00","dfff"]},{category:"private use area",hexrange:["e000","f8ff"]},{category:"cjk compatibility ideographs",hexrange:["f900","faff"]},{category:"alphabetic presentation forms",hexrange:["fb00","fb4f"]},{category:"arabic presentation forms-a",hexrange:["fb50","fdff"]},{category:"variation selectors",hexrange:["fe00","fe0f"]},{category:"vertical forms",hexrange:["fe10","fe1f"]},{category:"combining half marks",hexrange:["fe20","fe2f"]},{category:"cjk compatibility forms",hexrange:["fe30","fe4f"]},{category:"small form variants",hexrange:["fe50","fe6f"]},{category:"arabic presentation forms-b",hexrange:["fe70","feff"]},{category:"halfwidth and fullwidth forms",hexrange:["ff00","ffef"]},{category:"specials",hexrange:["fff0","ffff"]},{category:"linear b syllabary",hexrange:["10000","1007f"]},{category:"linear b ideograms",hexrange:["10080","100ff"]},{category:"aegean numbers",hexrange:["10100","1013f"]},{category:"ancient greek numbers",hexrange:["10140","1018f"]},{category:"ancient symbols",hexrange:["10190","101cf"]},{category:"phaistos disc",hexrange:["101d0","101ff"]},{category:"lycian",hexrange:["10280","1029f"]},{category:"carian",hexrange:["102a0","102df"]},{category:"coptic epact numbers",hexrange:["102e0","102ff"]},{category:"old italic",hexrange:["10300","1032f"]},{category:"gothic",hexrange:["10330","1034f"]},{category:"old permic",hexrange:["10350","1037f"]},{category:"ugaritic",hexrange:["10380","1039f"]},{category:"old persian",hexrange:["103a0","103df"]},{category:"deseret",hexrange:["10400","1044f"]},{category:"shavian",hexrange:["10450","1047f"]},{category:"osmanya",hexrange:["10480","104af"]},{category:"osage",hexrange:["104b0","104ff"]},{category:"elbasan",hexrange:["10500","1052f"]},{category:"caucasian albanian",hexrange:["10530","1056f"]},{category:"vithkuqi",hexrange:["10570","105bf"]},{category:"linear a",hexrange:["10600","1077f"]},{category:"latin extended-f",hexrange:["10780","107bf"]},{category:"cypriot syllabary",hexrange:["10800","1083f"]},{category:"imperial aramaic",hexrange:["10840","1085f"]},{category:"palmyrene",hexrange:["10860","1087f"]},{category:"nabataean",hexrange:["10880","108af"]},{category:"hatran",hexrange:["108e0","108ff"]},{category:"phoenician",hexrange:["10900","1091f"]},{category:"lydian",hexrange:["10920","1093f"]},{category:"meroitic hieroglyphs",hexrange:["10980","1099f"]},{category:"meroitic cursive",hexrange:["109a0","109ff"]},{category:"kharoshthi",hexrange:["10a00","10a5f"]},{category:"old south arabian",hexrange:["10a60","10a7f"]},{category:"old north arabian",hexrange:["10a80","10a9f"]},{category:"manichaean",hexrange:["10ac0","10aff"]},{category:"avestan",hexrange:["10b00","10b3f"]},{category:"inscriptional parthian",hexrange:["10b40","10b5f"]},{category:"inscriptional pahlavi",hexrange:["10b60","10b7f"]},{category:"psalter pahlavi",hexrange:["10b80","10baf"]},{category:"old turkic",hexrange:["10c00","10c4f"]},{category:"old hungarian",hexrange:["10c80","10cff"]},{category:"hanifi rohingya",hexrange:["10d00","10d3f"]},{category:"rumi numeral symbols",hexrange:["10e60","10e7f"]},{category:"yezidi",hexrange:["10e80","10ebf"]},{category:"arabic extended-c",hexrange:["10ec0","10eff"]},{category:"old sogdian",hexrange:["10f00","10f2f"]},{category:"sogdian",hexrange:["10f30","10f6f"]},{category:"old uyghur",hexrange:["10f70","10faf"]},{category:"chorasmian",hexrange:["10fb0","10fdf"]},{category:"elymaic",hexrange:["10fe0","10fff"]},{category:"brahmi",hexrange:["11000","1107f"]},{category:"kaithi",hexrange:["11080","110cf"]},{category:"sora sompeng",hexrange:["110d0","110ff"]},{category:"chakma",hexrange:["11100","1114f"]},{category:"mahajani",hexrange:["11150","1117f"]},{category:"sharada",hexrange:["11180","111df"]},{category:"sinhala archaic numbers",hexrange:["111e0","111ff"]},{category:"khojki",hexrange:["11200","1124f"]},{category:"multani",hexrange:["11280","112af"]},{category:"khudawadi",hexrange:["112b0","112ff"]},{category:"grantha",hexrange:["11300","1137f"]},{category:"newa",hexrange:["11400","1147f"]},{category:"tirhuta",hexrange:["11480","114df"]},{category:"siddham",hexrange:["11580","115ff"]},{category:"modi",hexrange:["11600","1165f"]},{category:"mongolian supplement",hexrange:["11660","1167f"]},{category:"takri",hexrange:["11680","116cf"]},{category:"ahom",hexrange:["11700","1174f"]},{category:"dogra",hexrange:["11800","1184f"]},{category:"warang citi",hexrange:["118a0","118ff"]},{category:"dives akuru",hexrange:["11900","1195f"]},{category:"nandinagari",hexrange:["119a0","119ff"]},{category:"zanabazar square",hexrange:["11a00","11a4f"]},{category:"soyombo",hexrange:["11a50","11aaf"]},{category:"unified canadian aboriginal syllabics extended-a",hexrange:["11ab0","11abf"]},{category:"pau cin hau",hexrange:["11ac0","11aff"]},{category:"devanagari extended-a",hexrange:["11b00","11b5f"]},{category:"bhaiksuki",hexrange:["11c00","11c6f"]},{category:"marchen",hexrange:["11c70","11cbf"]},{category:"masaram gondi",hexrange:["11d00","11d5f"]},{category:"gunjala gondi",hexrange:["11d60","11daf"]},{category:"makasar",hexrange:["11ee0","11eff"]},{category:"kawi",hexrange:["11f00","11f5f"]},{category:"lisu supplement",hexrange:["11fb0","11fbf"]},{category:"tamil supplement",hexrange:["11fc0","11fff"]},{category:"cuneiform",hexrange:["12000","123ff"]},{category:"cuneiform numbers and punctuation",hexrange:["12400","1247f"]},{category:"early dynastic cuneiform",hexrange:["12480","1254f"]},{category:"cypro-minoan",hexrange:["12f90","12fff"]},{category:"egyptian hieroglyphs",hexrange:["13000","1342f"]},{category:"egyptian hieroglyph format controls",hexrange:["13430","1345f"]},{category:"anatolian hieroglyphs",hexrange:["14400","1467f"]},{category:"bamum supplement",hexrange:["16800","16a3f"]},{category:"mro",hexrange:["16a40","16a6f"]},{category:"tangsa",hexrange:["16a70","16acf"]},{category:"bassa vah",hexrange:["16ad0","16aff"]},{category:"pahawh hmong",hexrange:["16b00","16b8f"]},{category:"medefaidrin",hexrange:["16e40","16e9f"]},{category:"miao",hexrange:["16f00","16f9f"]},{category:"ideographic symbols and punctuation",hexrange:["16fe0","16fff"]},{category:"tangut",hexrange:["17000","187ff"]},{category:"tangut components",hexrange:["18800","18aff"]},{category:"khitan small script",hexrange:["18b00","18cff"]},{category:"tangut supplement",hexrange:["18d00","18d7f"]},{category:"kana extended-b",hexrange:["1aff0","1afff"]},{category:"kana supplement",hexrange:["1b000","1b0ff"]},{category:"kana extended-a",hexrange:["1b100","1b12f"]},{category:"small kana extension",hexrange:["1b130","1b16f"]},{category:"nushu",hexrange:["1b170","1b2ff"]},{category:"duployan",hexrange:["1bc00","1bc9f"]},{category:"shorthand format controls",hexrange:["1bca0","1bcaf"]},{category:"znamenny musical notation",hexrange:["1cf00","1cfcf"]},{category:"byzantine musical symbols",hexrange:["1d000","1d0ff"]},{category:"musical symbols",hexrange:["1d100","1d1ff"]},{category:"ancient greek musical notation",hexrange:["1d200","1d24f"]},{category:"kaktovik numerals",hexrange:["1d2c0","1d2df"]},{category:"mayan numerals",hexrange:["1d2e0","1d2ff"]},{category:"tai xuan jing symbols",hexrange:["1d300","1d35f"]},{category:"counting rod numerals",hexrange:["1d360","1d37f"]},{category:"mathematical alphanumeric symbols",hexrange:["1d400","1d7ff"]},{category:"sutton signwriting",hexrange:["1d800","1daaf"]},{category:"latin extended-g",hexrange:["1df00","1dfff"]},{category:"glagolitic supplement",hexrange:["1e000","1e02f"]},{category:"cyrillic extended-d",hexrange:["1e030","1e08f"]},{category:"nyiakeng puachue hmong",hexrange:["1e100","1e14f"]},{category:"toto",hexrange:["1e290","1e2bf"]},{category:"wancho",hexrange:["1e2c0","1e2ff"]},{category:"nag mundari",hexrange:["1e4d0","1e4ff"]},{category:"ethiopic extended-b",hexrange:["1e7e0","1e7ff"]},{category:"mende kikakui",hexrange:["1e800","1e8df"]},{category:"adlam",hexrange:["1e900","1e95f"]},{category:"indic siyaq numbers",hexrange:["1ec70","1ecbf"]},{category:"ottoman siyaq numbers",hexrange:["1ed00","1ed4f"]},{category:"arabic mathematical alphabetic symbols",hexrange:["1ee00","1eeff"]},{category:"mahjong tiles",hexrange:["1f000","1f02f"]},{category:"domino tiles",hexrange:["1f030","1f09f"]},{category:"playing cards",hexrange:["1f0a0","1f0ff"]},{category:"enclosed alphanumeric supplement",hexrange:["1f100","1f1ff"]},{category:"enclosed ideographic supplement",hexrange:["1f200","1f2ff"]},{category:"miscellaneous symbols and pictographs",hexrange:["1f300","1f5ff"]},{category:"emoticons (emoji)",hexrange:["1f600","1f64f"]},{category:"ornamental dingbats",hexrange:["1f650","1f67f"]},{category:"transport and map symbols",hexrange:["1f680","1f6ff"]},{category:"alchemical symbols",hexrange:["1f700","1f77f"]},{category:"geometric shapes extended",hexrange:["1f780","1f7ff"]},{category:"supplemental arrows-c",hexrange:["1f800","1f8ff"]},{category:"supplemental symbols and pictographs",hexrange:["1f900","1f9ff"]},{category:"chess symbols",hexrange:["1fa00","1fa6f"]},{category:"symbols and pictographs extended-a",hexrange:["1fa70","1faff"]},{category:"symbols for legacy computing",hexrange:["1fb00","1fbff"]},{category:"cjk unified ideographs extension b",hexrange:["20000","2a6df"]},{category:"cjk unified ideographs extension c",hexrange:["2a700","2b73f"]},{category:"cjk unified ideographs extension d",hexrange:["2b740","2b81f"]},{category:"cjk unified ideographs extension e",hexrange:["2b820","2ceaf"]},{category:"cjk unified ideographs extension f",hexrange:["2ceb0","2ebef"]},{category:"cjk unified ideographs extension i",hexrange:["2ebf0","2ee5f"]},{category:"cjk compatibility ideographs supplement",hexrange:["2f800","2fa1f"]},{category:"cjk unified ideographs extension g",hexrange:["30000","3134f"]},{category:"cjk unified ideographs extension h",hexrange:["31350","323af"]},{category:"tags",hexrange:["e0000","e007f"]},{category:"variation selectors supplement",hexrange:["e0100","e01ef"]},{category:"supplementary private use area-a",hexrange:["f0000","fffff"]},{category:"supplementary private use area-b",hexrange:["100000","10ffff"]}];function go(e){let t=e.length;for(;--t>=0;)e[t]=0}go(new Array(576));go(new Array(60));go(new Array(512));go(new Array(256));go(new Array(29));go(new Array(30));var mo=(e,t,i,r)=>{let n=65535&e,s=e>>>16&65535,a=0;for(;0!==i;){a=i>2e3?2e3:i,i-=a;do{n=n+t[r++]|0,s=s+n|0}while(--a);n%=65521,s%=65521}return n|s<<16};const yo=new Uint32Array((()=>{let e,t=[];for(var i=0;i<256;i++){e=i;for(var r=0;r<8;r++)e=1&e?3988292384^e>>>1:e>>>1;t[i]=e}return t})());var xo=(e,t,i,r)=>{const n=yo,s=r+i;e^=-1;for(let i=r;i<s;i++)e=e>>>8^n[255&(e^t[i])];return~e},vo={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"},bo={Z_NO_FLUSH:0,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_MEM_ERROR:-4,Z_BUF_ERROR:-5,Z_DEFLATED:8};const _o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);var wo=function(e){const t=Array.prototype.slice.call(arguments,1);for(;t.length;){const i=t.shift();if(i){if("object"!=typeof i)throw new TypeError(i+"must be non-object");for(const t in i)_o(i,t)&&(e[t]=i[t])}}return e},Co=e=>{let t=0;for(let i=0,r=e.length;i<r;i++)t+=e[i].length;const i=new Uint8Array(t);for(let t=0,r=0,n=e.length;t<n;t++){let n=e[t];i.set(n,r),r+=n.length}return i};let Ao=!0;try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(e){Ao=!1}const Eo=new Uint8Array(256);for(let e=0;e<256;e++)Eo[e]=e>=252?6:e>=248?5:e>=240?4:e>=224?3:e>=192?2:1;Eo[254]=Eo[254]=1;var Do=e=>{if("function"==typeof TextEncoder&&TextEncoder.prototype.encode)return(new TextEncoder).encode(e);let t,i,r,n,s,a=e.length,o=0;for(n=0;n<a;n++)i=e.charCodeAt(n),55296==(64512&i)&&n+1<a&&(r=e.charCodeAt(n+1),56320==(64512&r)&&(i=65536+(i-55296<<10)+(r-56320),n++)),o+=i<128?1:i<2048?2:i<65536?3:4;for(t=new Uint8Array(o),s=0,n=0;s<o;n++)i=e.charCodeAt(n),55296==(64512&i)&&n+1<a&&(r=e.charCodeAt(n+1),56320==(64512&r)&&(i=65536+(i-55296<<10)+(r-56320),n++)),i<128?t[s++]=i:i<2048?(t[s++]=192|i>>>6,t[s++]=128|63&i):i<65536?(t[s++]=224|i>>>12,t[s++]=128|i>>>6&63,t[s++]=128|63&i):(t[s++]=240|i>>>18,t[s++]=128|i>>>12&63,t[s++]=128|i>>>6&63,t[s++]=128|63&i);return t},So=(e,t)=>{const i=t||e.length;if("function"==typeof TextDecoder&&TextDecoder.prototype.decode)return(new TextDecoder).decode(e.subarray(0,t));let r,n;const s=new Array(2*i);for(n=0,r=0;r<i;){let t=e[r++];if(t<128){s[n++]=t;continue}let a=Eo[t];if(a>4)s[n++]=65533,r+=a-1;else{for(t&=2===a?31:3===a?15:7;a>1&&r<i;)t=t<<6|63&e[r++],a--;a>1?s[n++]=65533:t<65536?s[n++]=t:(t-=65536,s[n++]=55296|t>>10&1023,s[n++]=56320|1023&t)}}return((e,t)=>{if(t<65534&&e.subarray&&Ao)return String.fromCharCode.apply(null,e.length===t?e:e.subarray(0,t));let i="";for(let r=0;r<t;r++)i+=String.fromCharCode(e[r]);return i})(s,n)},Fo=(e,t)=>{(t=t||e.length)>e.length&&(t=e.length);let i=t-1;for(;i>=0&&128==(192&e[i]);)i--;return i<0||0===i?t:i+Eo[e[i]]>t?i:t};var To=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0};const Mo=16209;var ko=function(e,t){let i,r,n,s,a,o,h,u,l,c,p,d,f,g,m,y,x,v,b,_,w,C,A,E;const D=e.state;i=e.next_in,A=e.input,r=i+(e.avail_in-5),n=e.next_out,E=e.output,s=n-(t-e.avail_out),a=n+(e.avail_out-257),o=D.dmax,h=D.wsize,u=D.whave,l=D.wnext,c=D.window,p=D.hold,d=D.bits,f=D.lencode,g=D.distcode,m=(1<<D.lenbits)-1,y=(1<<D.distbits)-1;e:do{d<15&&(p+=A[i++]<<d,d+=8,p+=A[i++]<<d,d+=8),x=f[p&m];t:for(;;){if(v=x>>>24,p>>>=v,d-=v,v=x>>>16&255,0===v)E[n++]=65535&x;else{if(!(16&v)){if(64&v){if(32&v){D.mode=16191;break e}e.msg="invalid literal/length code",D.mode=Mo;break e}x=f[(65535&x)+(p&(1<<v)-1)];continue t}for(b=65535&x,v&=15,v&&(d<v&&(p+=A[i++]<<d,d+=8),b+=p&(1<<v)-1,p>>>=v,d-=v),d<15&&(p+=A[i++]<<d,d+=8,p+=A[i++]<<d,d+=8),x=g[p&y];;){if(v=x>>>24,p>>>=v,d-=v,v=x>>>16&255,16&v){if(_=65535&x,v&=15,d<v&&(p+=A[i++]<<d,d+=8,d<v&&(p+=A[i++]<<d,d+=8)),_+=p&(1<<v)-1,_>o){e.msg="invalid distance too far back",D.mode=Mo;break e}if(p>>>=v,d-=v,v=n-s,_>v){if(v=_-v,v>u&&D.sane){e.msg="invalid distance too far back",D.mode=Mo;break e}if(w=0,C=c,0===l){if(w+=h-v,v<b){b-=v;do{E[n++]=c[w++]}while(--v);w=n-_,C=E}}else if(l<v){if(w+=h+l-v,v-=l,v<b){b-=v;do{E[n++]=c[w++]}while(--v);if(w=0,l<b){v=l,b-=v;do{E[n++]=c[w++]}while(--v);w=n-_,C=E}}}else if(w+=l-v,v<b){b-=v;do{E[n++]=c[w++]}while(--v);w=n-_,C=E}for(;b>2;)E[n++]=C[w++],E[n++]=C[w++],E[n++]=C[w++],b-=3;b&&(E[n++]=C[w++],b>1&&(E[n++]=C[w++]))}else{w=n-_;do{E[n++]=E[w++],E[n++]=E[w++],E[n++]=E[w++],b-=3}while(b>2);b&&(E[n++]=E[w++],b>1&&(E[n++]=E[w++]))}break}if(64&v){e.msg="invalid distance code",D.mode=Mo;break e}x=g[(65535&x)+(p&(1<<v)-1)]}}break}}while(i<r&&n<a);b=d>>3,i-=b,d-=b<<3,p&=(1<<d)-1,e.next_in=i,e.next_out=n,e.avail_in=i<r?r-i+5:5-(i-r),e.avail_out=n<a?a-n+257:257-(n-a),D.hold=p,D.bits=d};const Io=15,Bo=new Uint16Array([3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0]),Lo=new Uint8Array([16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78]),Oo=new Uint16Array([1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0]),Po=new Uint8Array([16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64]);var No=(e,t,i,r,n,s,a,o)=>{const h=o.bits;let u,l,c,p,d,f,g=0,m=0,y=0,x=0,v=0,b=0,_=0,w=0,C=0,A=0,E=null;const D=new Uint16Array(16),S=new Uint16Array(16);let F,T,M,k=null;for(g=0;g<=Io;g++)D[g]=0;for(m=0;m<r;m++)D[t[i+m]]++;for(v=h,x=Io;x>=1&&0===D[x];x--);if(v>x&&(v=x),0===x)return n[s++]=20971520,n[s++]=20971520,o.bits=1,0;for(y=1;y<x&&0===D[y];y++);for(v<y&&(v=y),w=1,g=1;g<=Io;g++)if(w<<=1,w-=D[g],w<0)return-1;if(w>0&&(0===e||1!==x))return-1;for(S[1]=0,g=1;g<Io;g++)S[g+1]=S[g]+D[g];for(m=0;m<r;m++)0!==t[i+m]&&(a[S[t[i+m]]++]=m);if(0===e?(E=k=a,f=20):1===e?(E=Bo,k=Lo,f=257):(E=Oo,k=Po,f=0),A=0,m=0,g=y,d=s,b=v,_=0,c=-1,C=1<<v,p=C-1,1===e&&C>852||2===e&&C>592)return 1;for(;;){F=g-_,a[m]+1<f?(T=0,M=a[m]):a[m]>=f?(T=k[a[m]-f],M=E[a[m]-f]):(T=96,M=0),u=1<<g-_,l=1<<b,y=l;do{l-=u,n[d+(A>>_)+l]=F<<24|T<<16|M}while(0!==l);for(u=1<<g-1;A&u;)u>>=1;if(0!==u?(A&=u-1,A+=u):A=0,m++,0==--D[g]){if(g===x)break;g=t[i+a[m]]}if(g>v&&(A&p)!==c){for(0===_&&(_=v),d+=y,b=g-_,w=1<<b;b+_<x&&(w-=D[b+_],!(w<=0));)b++,w<<=1;if(C+=1<<b,1===e&&C>852||2===e&&C>592)return 1;c=A&p,n[c]=v<<24|b<<16|d-s}}return 0!==A&&(n[d+A]=g-_<<24|64<<16),o.bits=v,0};const{Z_FINISH:Ro,Z_BLOCK:Vo,Z_TREES:Uo,Z_OK:zo,Z_STREAM_END:Go,Z_NEED_DICT:jo,Z_STREAM_ERROR:$o,Z_DATA_ERROR:qo,Z_MEM_ERROR:Ho,Z_BUF_ERROR:Wo,Z_DEFLATED:Xo}=bo,Yo=16180,Zo=16190,Ko=16191,Jo=16192,Qo=16194,eh=16199,th=16200,ih=16206,rh=16209,nh=e=>(e>>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24);function sh(){this.strm=null,this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new Uint16Array(320),this.work=new Uint16Array(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}const ah=e=>{if(!e)return 1;const t=e.state;return!t||t.strm!==e||t.mode<Yo||t.mode>16211?1:0},oh=e=>{if(ah(e))return $o;const t=e.state;return e.total_in=e.total_out=t.total=0,e.msg="",t.wrap&&(e.adler=1&t.wrap),t.mode=Yo,t.last=0,t.havedict=0,t.flags=-1,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new Int32Array(852),t.distcode=t.distdyn=new Int32Array(592),t.sane=1,t.back=-1,zo},hh=e=>{if(ah(e))return $o;const t=e.state;return t.wsize=0,t.whave=0,t.wnext=0,oh(e)},uh=(e,t)=>{let i;if(ah(e))return $o;const r=e.state;return t<0?(i=0,t=-t):(i=5+(t>>4),t<48&&(t&=15)),t&&(t<8||t>15)?$o:(null!==r.window&&r.wbits!==t&&(r.window=null),r.wrap=i,r.wbits=t,hh(e))},lh=(e,t)=>{if(!e)return $o;const i=new sh;e.state=i,i.strm=e,i.window=null,i.mode=Yo;const r=uh(e,t);return r!==zo&&(e.state=null),r};let ch,ph,dh=!0;const fh=e=>{if(dh){ch=new Int32Array(512),ph=new Int32Array(32);let t=0;for(;t<144;)e.lens[t++]=8;for(;t<256;)e.lens[t++]=9;for(;t<280;)e.lens[t++]=7;for(;t<288;)e.lens[t++]=8;for(No(1,e.lens,0,288,ch,0,e.work,{bits:9}),t=0;t<32;)e.lens[t++]=5;No(2,e.lens,0,32,ph,0,e.work,{bits:5}),dh=!1}e.lencode=ch,e.lenbits=9,e.distcode=ph,e.distbits=5},gh=(e,t,i,r)=>{let n;const s=e.state;return null===s.window&&(s.wsize=1<<s.wbits,s.wnext=0,s.whave=0,s.window=new Uint8Array(s.wsize)),r>=s.wsize?(s.window.set(t.subarray(i-s.wsize,i),0),s.wnext=0,s.whave=s.wsize):(n=s.wsize-s.wnext,n>r&&(n=r),s.window.set(t.subarray(i-r,i-r+n),s.wnext),(r-=n)?(s.window.set(t.subarray(i-r,i),0),s.wnext=r,s.whave=s.wsize):(s.wnext+=n,s.wnext===s.wsize&&(s.wnext=0),s.whave<s.wsize&&(s.whave+=n))),0};var mh=(e,t)=>{let i,r,n,s,a,o,h,u,l,c,p,d,f,g,m,y,x,v,b,_,w,C,A=0;const E=new Uint8Array(4);let D,S;const F=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(ah(e)||!e.output||!e.input&&0!==e.avail_in)return $o;i=e.state,i.mode===Ko&&(i.mode=Jo),a=e.next_out,n=e.output,h=e.avail_out,s=e.next_in,r=e.input,o=e.avail_in,u=i.hold,l=i.bits,c=o,p=h,C=zo;e:for(;;)switch(i.mode){case Yo:if(0===i.wrap){i.mode=Jo;break}for(;l<16;){if(0===o)break e;o--,u+=r[s++]<<l,l+=8}if(2&i.wrap&&35615===u){0===i.wbits&&(i.wbits=15),i.check=0,E[0]=255&u,E[1]=u>>>8&255,i.check=xo(i.check,E,2,0),u=0,l=0,i.mode=16181;break}if(i.head&&(i.head.done=!1),!(1&i.wrap)||(((255&u)<<8)+(u>>8))%31){e.msg="incorrect header check",i.mode=rh;break}if((15&u)!==Xo){e.msg="unknown compression method",i.mode=rh;break}if(u>>>=4,l-=4,w=8+(15&u),0===i.wbits&&(i.wbits=w),w>15||w>i.wbits){e.msg="invalid window size",i.mode=rh;break}i.dmax=1<<i.wbits,i.flags=0,e.adler=i.check=1,i.mode=512&u?16189:Ko,u=0,l=0;break;case 16181:for(;l<16;){if(0===o)break e;o--,u+=r[s++]<<l,l+=8}if(i.flags=u,(255&i.flags)!==Xo){e.msg="unknown compression method",i.mode=rh;break}if(57344&i.flags){e.msg="unknown header flags set",i.mode=rh;break}i.head&&(i.head.text=u>>8&1),512&i.flags&&4&i.wrap&&(E[0]=255&u,E[1]=u>>>8&255,i.check=xo(i.check,E,2,0)),u=0,l=0,i.mode=16182;case 16182:for(;l<32;){if(0===o)break e;o--,u+=r[s++]<<l,l+=8}i.head&&(i.head.time=u),512&i.flags&&4&i.wrap&&(E[0]=255&u,E[1]=u>>>8&255,E[2]=u>>>16&255,E[3]=u>>>24&255,i.check=xo(i.check,E,4,0)),u=0,l=0,i.mode=16183;case 16183:for(;l<16;){if(0===o)break e;o--,u+=r[s++]<<l,l+=8}i.head&&(i.head.xflags=255&u,i.head.os=u>>8),512&i.flags&&4&i.wrap&&(E[0]=255&u,E[1]=u>>>8&255,i.check=xo(i.check,E,2,0)),u=0,l=0,i.mode=16184;case 16184:if(1024&i.flags){for(;l<16;){if(0===o)break e;o--,u+=r[s++]<<l,l+=8}i.length=u,i.head&&(i.head.extra_len=u),512&i.flags&&4&i.wrap&&(E[0]=255&u,E[1]=u>>>8&255,i.check=xo(i.check,E,2,0)),u=0,l=0}else i.head&&(i.head.extra=null);i.mode=16185;case 16185:if(1024&i.flags&&(d=i.length,d>o&&(d=o),d&&(i.head&&(w=i.head.extra_len-i.length,i.head.extra||(i.head.extra=new Uint8Array(i.head.extra_len)),i.head.extra.set(r.subarray(s,s+d),w)),512&i.flags&&4&i.wrap&&(i.check=xo(i.check,r,d,s)),o-=d,s+=d,i.length-=d),i.length))break e;i.length=0,i.mode=16186;case 16186:if(2048&i.flags){if(0===o)break e;d=0;do{w=r[s+d++],i.head&&w&&i.length<65536&&(i.head.name+=String.fromCharCode(w))}while(w&&d<o);if(512&i.flags&&4&i.wrap&&(i.check=xo(i.check,r,d,s)),o-=d,s+=d,w)break e}else i.head&&(i.head.name=null);i.length=0,i.mode=16187;case 16187:if(4096&i.flags){if(0===o)break e;d=0;do{w=r[s+d++],i.head&&w&&i.length<65536&&(i.head.comment+=String.fromCharCode(w))}while(w&&d<o);if(512&i.flags&&4&i.wrap&&(i.check=xo(i.check,r,d,s)),o-=d,s+=d,w)break e}else i.head&&(i.head.comment=null);i.mode=16188;case 16188:if(512&i.flags){for(;l<16;){if(0===o)break e;o--,u+=r[s++]<<l,l+=8}if(4&i.wrap&&u!==(65535&i.check)){e.msg="header crc mismatch",i.mode=rh;break}u=0,l=0}i.head&&(i.head.hcrc=i.flags>>9&1,i.head.done=!0),e.adler=i.check=0,i.mode=Ko;break;case 16189:for(;l<32;){if(0===o)break e;o--,u+=r[s++]<<l,l+=8}e.adler=i.check=nh(u),u=0,l=0,i.mode=Zo;case Zo:if(0===i.havedict)return e.next_out=a,e.avail_out=h,e.next_in=s,e.avail_in=o,i.hold=u,i.bits=l,jo;e.adler=i.check=1,i.mode=Ko;case Ko:if(t===Vo||t===Uo)break e;case Jo:if(i.last){u>>>=7&l,l-=7&l,i.mode=ih;break}for(;l<3;){if(0===o)break e;o--,u+=r[s++]<<l,l+=8}switch(i.last=1&u,u>>>=1,l-=1,3&u){case 0:i.mode=16193;break;case 1:if(fh(i),i.mode=eh,t===Uo){u>>>=2,l-=2;break e}break;case 2:i.mode=16196;break;case 3:e.msg="invalid block type",i.mode=rh}u>>>=2,l-=2;break;case 16193:for(u>>>=7&l,l-=7&l;l<32;){if(0===o)break e;o--,u+=r[s++]<<l,l+=8}if((65535&u)!=(u>>>16^65535)){e.msg="invalid stored block lengths",i.mode=rh;break}if(i.length=65535&u,u=0,l=0,i.mode=Qo,t===Uo)break e;case Qo:i.mode=16195;case 16195:if(d=i.length,d){if(d>o&&(d=o),d>h&&(d=h),0===d)break e;n.set(r.subarray(s,s+d),a),o-=d,s+=d,h-=d,a+=d,i.length-=d;break}i.mode=Ko;break;case 16196:for(;l<14;){if(0===o)break e;o--,u+=r[s++]<<l,l+=8}if(i.nlen=257+(31&u),u>>>=5,l-=5,i.ndist=1+(31&u),u>>>=5,l-=5,i.ncode=4+(15&u),u>>>=4,l-=4,i.nlen>286||i.ndist>30){e.msg="too many length or distance symbols",i.mode=rh;break}i.have=0,i.mode=16197;case 16197:for(;i.have<i.ncode;){for(;l<3;){if(0===o)break e;o--,u+=r[s++]<<l,l+=8}i.lens[F[i.have++]]=7&u,u>>>=3,l-=3}for(;i.have<19;)i.lens[F[i.have++]]=0;if(i.lencode=i.lendyn,i.lenbits=7,D={bits:i.lenbits},C=No(0,i.lens,0,19,i.lencode,0,i.work,D),i.lenbits=D.bits,C){e.msg="invalid code lengths set",i.mode=rh;break}i.have=0,i.mode=16198;case 16198:for(;i.have<i.nlen+i.ndist;){for(;A=i.lencode[u&(1<<i.lenbits)-1],m=A>>>24,y=A>>>16&255,x=65535&A,!(m<=l);){if(0===o)break e;o--,u+=r[s++]<<l,l+=8}if(x<16)u>>>=m,l-=m,i.lens[i.have++]=x;else{if(16===x){for(S=m+2;l<S;){if(0===o)break e;o--,u+=r[s++]<<l,l+=8}if(u>>>=m,l-=m,0===i.have){e.msg="invalid bit length repeat",i.mode=rh;break}w=i.lens[i.have-1],d=3+(3&u),u>>>=2,l-=2}else if(17===x){for(S=m+3;l<S;){if(0===o)break e;o--,u+=r[s++]<<l,l+=8}u>>>=m,l-=m,w=0,d=3+(7&u),u>>>=3,l-=3}else{for(S=m+7;l<S;){if(0===o)break e;o--,u+=r[s++]<<l,l+=8}u>>>=m,l-=m,w=0,d=11+(127&u),u>>>=7,l-=7}if(i.have+d>i.nlen+i.ndist){e.msg="invalid bit length repeat",i.mode=rh;break}for(;d--;)i.lens[i.have++]=w}}if(i.mode===rh)break;if(0===i.lens[256]){e.msg="invalid code -- missing end-of-block",i.mode=rh;break}if(i.lenbits=9,D={bits:i.lenbits},C=No(1,i.lens,0,i.nlen,i.lencode,0,i.work,D),i.lenbits=D.bits,C){e.msg="invalid literal/lengths set",i.mode=rh;break}if(i.distbits=6,i.distcode=i.distdyn,D={bits:i.distbits},C=No(2,i.lens,i.nlen,i.ndist,i.distcode,0,i.work,D),i.distbits=D.bits,C){e.msg="invalid distances set",i.mode=rh;break}if(i.mode=eh,t===Uo)break e;case eh:i.mode=th;case th:if(o>=6&&h>=258){e.next_out=a,e.avail_out=h,e.next_in=s,e.avail_in=o,i.hold=u,i.bits=l,ko(e,p),a=e.next_out,n=e.output,h=e.avail_out,s=e.next_in,r=e.input,o=e.avail_in,u=i.hold,l=i.bits,i.mode===Ko&&(i.back=-1);break}for(i.back=0;A=i.lencode[u&(1<<i.lenbits)-1],m=A>>>24,y=A>>>16&255,x=65535&A,!(m<=l);){if(0===o)break e;o--,u+=r[s++]<<l,l+=8}if(y&&!(240&y)){for(v=m,b=y,_=x;A=i.lencode[_+((u&(1<<v+b)-1)>>v)],m=A>>>24,y=A>>>16&255,x=65535&A,!(v+m<=l);){if(0===o)break e;o--,u+=r[s++]<<l,l+=8}u>>>=v,l-=v,i.back+=v}if(u>>>=m,l-=m,i.back+=m,i.length=x,0===y){i.mode=16205;break}if(32&y){i.back=-1,i.mode=Ko;break}if(64&y){e.msg="invalid literal/length code",i.mode=rh;break}i.extra=15&y,i.mode=16201;case 16201:if(i.extra){for(S=i.extra;l<S;){if(0===o)break e;o--,u+=r[s++]<<l,l+=8}i.length+=u&(1<<i.extra)-1,u>>>=i.extra,l-=i.extra,i.back+=i.extra}i.was=i.length,i.mode=16202;case 16202:for(;A=i.distcode[u&(1<<i.distbits)-1],m=A>>>24,y=A>>>16&255,x=65535&A,!(m<=l);){if(0===o)break e;o--,u+=r[s++]<<l,l+=8}if(!(240&y)){for(v=m,b=y,_=x;A=i.distcode[_+((u&(1<<v+b)-1)>>v)],m=A>>>24,y=A>>>16&255,x=65535&A,!(v+m<=l);){if(0===o)break e;o--,u+=r[s++]<<l,l+=8}u>>>=v,l-=v,i.back+=v}if(u>>>=m,l-=m,i.back+=m,64&y){e.msg="invalid distance code",i.mode=rh;break}i.offset=x,i.extra=15&y,i.mode=16203;case 16203:if(i.extra){for(S=i.extra;l<S;){if(0===o)break e;o--,u+=r[s++]<<l,l+=8}i.offset+=u&(1<<i.extra)-1,u>>>=i.extra,l-=i.extra,i.back+=i.extra}if(i.offset>i.dmax){e.msg="invalid distance too far back",i.mode=rh;break}i.mode=16204;case 16204:if(0===h)break e;if(d=p-h,i.offset>d){if(d=i.offset-d,d>i.whave&&i.sane){e.msg="invalid distance too far back",i.mode=rh;break}d>i.wnext?(d-=i.wnext,f=i.wsize-d):f=i.wnext-d,d>i.length&&(d=i.length),g=i.window}else g=n,f=a-i.offset,d=i.length;d>h&&(d=h),h-=d,i.length-=d;do{n[a++]=g[f++]}while(--d);0===i.length&&(i.mode=th);break;case 16205:if(0===h)break e;n[a++]=i.length,h--,i.mode=th;break;case ih:if(i.wrap){for(;l<32;){if(0===o)break e;o--,u|=r[s++]<<l,l+=8}if(p-=h,e.total_out+=p,i.total+=p,4&i.wrap&&p&&(e.adler=i.check=i.flags?xo(i.check,n,p,a-p):mo(i.check,n,p,a-p)),p=h,4&i.wrap&&(i.flags?u:nh(u))!==i.check){e.msg="incorrect data check",i.mode=rh;break}u=0,l=0}i.mode=16207;case 16207:if(i.wrap&&i.flags){for(;l<32;){if(0===o)break e;o--,u+=r[s++]<<l,l+=8}if(4&i.wrap&&u!==(4294967295&i.total)){e.msg="incorrect length check",i.mode=rh;break}u=0,l=0}i.mode=16208;case 16208:C=Go;break e;case rh:C=qo;break e;case 16210:return Ho;default:return $o}return e.next_out=a,e.avail_out=h,e.next_in=s,e.avail_in=o,i.hold=u,i.bits=l,(i.wsize||p!==e.avail_out&&i.mode<rh&&(i.mode<ih||t!==Ro))&&gh(e,e.output,e.next_out,p-e.avail_out),c-=e.avail_in,p-=e.avail_out,e.total_in+=c,e.total_out+=p,i.total+=p,4&i.wrap&&p&&(e.adler=i.check=i.flags?xo(i.check,n,p,e.next_out-p):mo(i.check,n,p,e.next_out-p)),e.data_type=i.bits+(i.last?64:0)+(i.mode===Ko?128:0)+(i.mode===eh||i.mode===Qo?256:0),(0===c&&0===p||t===Ro)&&C===zo&&(C=Wo),C},yh={inflateReset:hh,inflateReset2:uh,inflateResetKeep:oh,inflateInit:e=>lh(e,15),inflateInit2:lh,inflate:mh,inflateEnd:e=>{if(ah(e))return $o;let t=e.state;return t.window&&(t.window=null),e.state=null,zo},inflateGetHeader:(e,t)=>{if(ah(e))return $o;const i=e.state;return 2&i.wrap?(i.head=t,t.done=!1,zo):$o},inflateSetDictionary:(e,t)=>{const i=t.length;let r,n,s;return ah(e)?$o:(r=e.state,0!==r.wrap&&r.mode!==Zo?$o:r.mode===Zo&&(n=1,n=mo(n,t,i,0),n!==r.check)?qo:(s=gh(e,t,i,i),s?(r.mode=16210,Ho):(r.havedict=1,zo)))},inflateInfo:"pako inflate (from Nodeca project)"};var xh=function(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1};const vh=Object.prototype.toString,{Z_NO_FLUSH:bh,Z_FINISH:_h,Z_OK:wh,Z_STREAM_END:Ch,Z_NEED_DICT:Ah,Z_STREAM_ERROR:Eh,Z_DATA_ERROR:Dh,Z_MEM_ERROR:Sh}=bo;function Fh(e){this.options=wo({chunkSize:65536,windowBits:15,to:""},e||{});const t=this.options;t.raw&&t.windowBits>=0&&t.windowBits<16&&(t.windowBits=-t.windowBits,0===t.windowBits&&(t.windowBits=-15)),!(t.windowBits>=0&&t.windowBits<16)||e&&e.windowBits||(t.windowBits+=32),t.windowBits>15&&t.windowBits<48&&(15&t.windowBits||(t.windowBits|=15)),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new To,this.strm.avail_out=0;let i=yh.inflateInit2(this.strm,t.windowBits);if(i!==wh)throw new Error(vo[i]);if(this.header=new xh,yh.inflateGetHeader(this.strm,this.header),t.dictionary&&("string"==typeof t.dictionary?t.dictionary=Do(t.dictionary):"[object ArrayBuffer]"===vh.call(t.dictionary)&&(t.dictionary=new Uint8Array(t.dictionary)),t.raw&&(i=yh.inflateSetDictionary(this.strm,t.dictionary),i!==wh)))throw new Error(vo[i])}Fh.prototype.push=function(e,t){const i=this.strm,r=this.options.chunkSize,n=this.options.dictionary;let s,a,o;if(this.ended)return!1;for(a=t===~~t?t:!0===t?_h:bh,"[object ArrayBuffer]"===vh.call(e)?i.input=new Uint8Array(e):i.input=e,i.next_in=0,i.avail_in=i.input.length;;){for(0===i.avail_out&&(i.output=new Uint8Array(r),i.next_out=0,i.avail_out=r),s=yh.inflate(i,a),s===Ah&&n&&(s=yh.inflateSetDictionary(i,n),s===wh?s=yh.inflate(i,a):s===Dh&&(s=Ah));i.avail_in>0&&s===Ch&&i.state.wrap>0&&0!==e[i.next_in];)yh.inflateReset(i),s=yh.inflate(i,a);switch(s){case Eh:case Dh:case Ah:case Sh:return this.onEnd(s),this.ended=!0,!1}if(o=i.avail_out,i.next_out&&(0===i.avail_out||s===Ch))if("string"===this.options.to){let e=Fo(i.output,i.next_out),t=i.next_out-e,n=So(i.output,e);i.next_out=t,i.avail_out=r-t,t&&i.output.set(i.output.subarray(e,e+t),0),this.onData(n)}else this.onData(i.output.length===i.next_out?i.output:i.output.subarray(0,i.next_out));if(s!==wh||0!==o){if(s===Ch)return s=yh.inflateEnd(this.strm),this.onEnd(s),this.ended=!0,!0;if(0===i.avail_in)break}}return!0},Fh.prototype.onData=function(e){this.chunks.push(e)},Fh.prototype.onEnd=function(e){e===wh&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=Co(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};var Th={inflate:function(e,t){const i=new Fh(t);if(i.push(e),i.err)throw i.msg||vo[i.err];return i.result}};const{inflate:Mh}=Th;const kh={inflate:Mh};var Ih,Bh={};Bh.parse=function(e){var t=Bh.B,i=function(e,t,i,r){var n=Bh.T,s={cmap:n.cmap,head:n.head,hhea:n.hhea,maxp:n.maxp,hmtx:n.hmtx,name:n.name,"OS/2":n.OS2,post:n.post,loca:n.loca,kern:n.kern,glyf:n.glyf,"CFF ":n.CFF,GSUB:n.GSUB,CBLC:n.CBLC,CBDT:n.CBDT,"SVG ":n.SVG,COLR:n.colr,CPAL:n.cpal,sbix:n.sbix,fvar:n.fvar,gvar:n.gvar,avar:n.avar,HVAR:n.HVAR},a={_data:e,_index:t,_offset:i};for(var o in s){var h=Bh.findTable(e,o,i);if(h){var u=h[0],l=r[u];null==l&&(l=s[o].parseTab(e,u,h[1],a)),a[o]=r[u]=l}}return a};var r=new Uint8Array(e);let n;119==r[0]&&(n=r,r=function(e){var i=t.readUshort(e,12),r=t.readUint(e,16),n=new Uint8Array(r),s=12+16*i;t.writeASCII(n,0,"OTTO"),t.writeUshort(n,4,i);for(var a=44,o=0;o<i;o++){var h=t.readASCII(e,a,4),u=t.readUint(e,a+4),l=t.readUint(e,a+8),c=t.readUint(e,a+12);a+=20;var p=e.slice(u,u+l);l!=c&&(p=kh.inflate(p));var d=12+16*o;t.writeASCII(n,d,h),t.writeUint(n,d+8,s),t.writeUint(n,d+12,c),n.set(p,s),s+=c}return n}(r));var s={};if("ttcf"==t.readASCII(r,0,4)){var a=4;t.readUshort(r,a),a+=2,t.readUshort(r,a),a+=2;var o=t.readUint(r,a);a+=4;for(var h=[],u=0;u<o;u++){var l=t.readUint(r,a);a+=4,h.push(i(r,u,l,s))}return h}var c=i(r,0,0,s);c._compressedData=n;var p=c.fvar;if(p){var d=[c];for(u=0;u<p[1].length;u++){var f=p[1][u],g={};for(var m in d.push(g),c)g[m]=c[m];g._index=u;var y=g.name=JSON.parse(JSON.stringify(g.name));y.fontSubfamily=f[0],null==f[3]&&(f[3]=(y.fontFamily+"-"+y.fontSubfamily).replaceAll(" ","")),y.postScriptName=f[3]}return d}return[c]},Bh.findTable=function(e,t,i){for(var r=Bh.B,n=r.readUshort(e,i+4),s=i+12,a=0;a<n;a++){var o=r.readASCII(e,s,4);r.readUint(e,s+4);var h=r.readUint(e,s+8),u=r.readUint(e,s+12);if(o==t)return[h,u];s+=16}return null},Bh.T={},Bh.B={readFixed:function(e,t){return(e[t]<<8|e[t+1])+(e[t+2]<<8|e[t+3])/65540},readF2dot14:function(e,t){return Bh.B.readShort(e,t)/16384},readInt:function(e,t){var i=Bh.B.t.uint8;return i[0]=e[t+3],i[1]=e[t+2],i[2]=e[t+1],i[3]=e[t],Bh.B.t.int32[0]},readInt8:function(e,t){return Bh.B.t.uint8[0]=e[t],Bh.B.t.int8[0]},readShort:function(e,t){return Bh.B.t.uint16[0]=e[t]<<8|e[t+1],Bh.B.t.int16[0]},readUshort:function(e,t){return e[t]<<8|e[t+1]},writeUshort:function(e,t,i){e[t]=i>>8&255,e[t+1]=255&i},readUshorts:function(e,t,i){for(var r=[],n=0;n<i;n++){var s=Bh.B.readUshort(e,t+2*n);r.push(s)}return r},readUint:function(e,t){var i=Bh.B.t.uint8;return i[3]=e[t],i[2]=e[t+1],i[1]=e[t+2],i[0]=e[t+3],Bh.B.t.uint32[0]},writeUint:function(e,t,i){e[t]=i>>24&255,e[t+1]=i>>16&255,e[t+2]=i>>8&255,e[t+3]=255&i},readUint64:function(e,t){return 4294967296*Bh.B.readUint(e,t)+Bh.B.readUint(e,t+4)},readASCII:function(e,t,i){for(var r="",n=0;n<i;n++)r+=String.fromCharCode(e[t+n]);return r},writeASCII:function(e,t,i){for(var r=0;r<i.length;r++)e[t+r]=i.charCodeAt(r)},readUnicode:function(e,t,i){for(var r="",n=0;n<i;n++){var s=e[t++]<<8|e[t++];r+=String.fromCharCode(s)}return r},_tdec:window.TextDecoder?new window.TextDecoder:null,readUTF8:function(e,t,i){var r=Bh.B._tdec;return r&&0==t&&i==e.length?r.decode(e):Bh.B.readASCII(e,t,i)},readBytes:function(e,t,i){for(var r=[],n=0;n<i;n++)r.push(e[t+n]);return r},readASCIIArray:function(e,t,i){for(var r=[],n=0;n<i;n++)r.push(String.fromCharCode(e[t+n]));return r},t:(Ih=new ArrayBuffer(8),{buff:Ih,int8:new Int8Array(Ih),uint8:new Uint8Array(Ih),int16:new Int16Array(Ih),uint16:new Uint16Array(Ih),int32:new Int32Array(Ih),uint32:new Uint32Array(Ih)})},Bh.T.CFF={parseTab:function(e,t,i){var r=Bh.B,n=Bh.T.CFF;e=new Uint8Array(e.buffer,t,i),t=0,t++,t++,t++,t++;var s=[];t=n.readIndex(e,t,s);for(var a=[],o=0;o<s.length-1;o++)a.push(r.readASCII(e,t+s[o],s[o+1]-s[o]));t+=s[s.length-1];var h=[];t=n.readIndex(e,t,h);var u=[];for(o=0;o<h.length-1;o++)u.push(n.readDict(e,t+h[o],t+h[o+1]));t+=h[h.length-1];var l=u[0],c=[];t=n.readIndex(e,t,c);var p=[];for(o=0;o<c.length-1;o++)p.push(r.readASCII(e,t+c[o],c[o+1]-c[o]));if(t+=c[c.length-1],n.readSubrs(e,t,l),l.CharStrings&&(l.CharStrings=n.readBytes(e,l.CharStrings)),l.ROS){t=l.FDArray;var d=[];t=n.readIndex(e,t,d),l.FDArray=[];for(o=0;o<d.length-1;o++){var f=n.readDict(e,t+d[o],t+d[o+1]);n._readFDict(e,f,p),l.FDArray.push(f)}t+=d[d.length-1],t=l.FDSelect,l.FDSelect=[];var g=e[t];if(t++,3!=g)throw g;var m=r.readUshort(e,t);t+=2;for(o=0;o<m+1;o++)l.FDSelect.push(r.readUshort(e,t),e[t+2]),t+=3}return l.charset&&(l.charset=n.readCharset(e,l.charset,l.CharStrings.length)),n._readFDict(e,l,p),l},_readFDict:function(e,t,i){var r,n=Bh.T.CFF;for(var s in t.Private&&(r=t.Private[1],t.Private=n.readDict(e,r,r+t.Private[0]),t.Private.Subrs&&n.readSubrs(e,r+t.Private.Subrs,t.Private)),t)-1!=["FamilyName","FontName","FullName","Notice","version","Copyright"].indexOf(s)&&(t[s]=i[t[s]-426+35])},readSubrs:function(e,t,i){i.Subrs=Bh.T.CFF.readBytes(e,t);var r,n=i.Subrs.length+1;r=n<1240?107:n<33900?1131:32768,i.Bias=r},readBytes:function(e,t){var i=[];t=Bh.T.CFF.readIndex(e,t,i);for(var r=[],n=i.length-1,s=e.byteOffset+t,a=0;a<n;a++){var o=i[a];r.push(new Uint8Array(e.buffer,s+o,i[a+1]-o))}return r},tableSE:[0,0,0,0,0,0,0,0,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,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,0,111,112,113,114,0,115,116,117,118,119,120,121,122,0,123,0,124,125,126,127,128,129,130,131,0,132,133,0,134,135,136,137,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,138,0,139,0,0,0,0,140,141,142,143,0,0,0,0,0,144,0,0,0,145,0,0,146,147,148,149,0,0,0,0],glyphByUnicode:function(e,t){for(var i=0;i<e.charset.length;i++)if(e.charset[i]==t)return i;return-1},glyphBySE:function(e,t){return t<0||t>255?-1:Bh.T.CFF.glyphByUnicode(e,Bh.T.CFF.tableSE[t])},readCharset:function(e,t,i){var r=Bh.B,n=[".notdef"],s=e[t];if(t++,0==s)for(var a=0;a<i;a++){var o=r.readUshort(e,t);t+=2,n.push(o)}else{if(1!=s&&2!=s)throw"error: format: "+s;for(;n.length<i;){o=r.readUshort(e,t);t+=2;var h=0;1==s?(h=e[t],t++):(h=r.readUshort(e,t),t+=2);for(a=0;a<=h;a++)n.push(o),o++}}return n},readIndex:function(e,t,i){var r=Bh.B,n=r.readUshort(e,t)+1,s=e[t+=2];if(t++,1==s)for(var a=0;a<n;a++)i.push(e[t+a]);else if(2==s)for(a=0;a<n;a++)i.push(r.readUshort(e,t+2*a));else if(3==s)for(a=0;a<n;a++)i.push(16777215&r.readUint(e,t+3*a-1));else if(4==s)for(a=0;a<n;a++)i.push(r.readUint(e,t+4*a));else if(1!=n)throw"unsupported offset size: "+s+", count: "+n;return(t+=n*s)-1},getCharString:function(e,t,i){var r=Bh.B,n=e[t],s=e[t+1],a=1,o=null,h=null;n<=20&&(o=n,a=1),12==n&&(o=100*n+s,a=2),21<=n&&n<=27&&(o=n,a=1),28==n&&(h=r.readShort(e,t+1),a=3),29<=n&&n<=31&&(o=n,a=1),32<=n&&n<=246&&(h=n-139,a=1),247<=n&&n<=250&&(h=256*(n-247)+s+108,a=2),251<=n&&n<=254&&(h=256*-(n-251)-s-108,a=2),255==n&&(h=r.readInt(e,t+1)/65535,a=5),i.val=null!=h?h:"o"+o,i.size=a},readCharString:function(e,t,i){for(var r=t+i,n=Bh.B,s=[];t<r;){var a=e[t],o=e[t+1],h=1,u=null,l=null;a<=20&&(u=a,h=1),12==a&&(u=100*a+o,h=2),19!=a&&20!=a||(u=a,h=2),21<=a&&a<=27&&(u=a,h=1),28==a&&(l=n.readShort(e,t+1),h=3),29<=a&&a<=31&&(u=a,h=1),32<=a&&a<=246&&(l=a-139,h=1),247<=a&&a<=250&&(l=256*(a-247)+o+108,h=2),251<=a&&a<=254&&(l=256*-(a-251)-o-108,h=2),255==a&&(l=n.readInt(e,t+1)/65535,h=5),s.push(null!=l?l:"o"+u),t+=h}return s},readDict:function(e,t,i){for(var r=Bh.B,n={},s=[];t<i;){var a=e[t],o=e[t+1],h=1,u=null,l=null;if(28==a&&(l=r.readShort(e,t+1),h=3),29==a&&(l=r.readInt(e,t+1),h=5),32<=a&&a<=246&&(l=a-139,h=1),247<=a&&a<=250&&(l=256*(a-247)+o+108,h=2),251<=a&&a<=254&&(l=256*-(a-251)-o-108,h=2),255==a)throw l=r.readInt(e,t+1)/65535,h=5,"unknown number";if(30==a){var c=[];for(h=1;;){var p=e[t+h];h++;var d=p>>4,f=15&p;if(15!=d&&c.push(d),15!=f&&c.push(f),15==f)break}for(var g="",m=[0,1,2,3,4,5,6,7,8,9,".","e","e-","reserved","-","endOfNumber"],y=0;y<c.length;y++)g+=m[c[y]];l=parseFloat(g)}if(a<=21)if(u=["version","Notice","FullName","FamilyName","Weight","FontBBox","BlueValues","OtherBlues","FamilyBlues","FamilyOtherBlues","StdHW","StdVW","escape","UniqueID","XUID","charset","Encoding","CharStrings","Private","Subrs","defaultWidthX","nominalWidthX"][a],h=1,12==a)u=["Copyright","isFixedPitch","ItalicAngle","UnderlinePosition","UnderlineThickness","PaintType","CharstringType","FontMatrix","StrokeWidth","BlueScale","BlueShift","BlueFuzz","StemSnapH","StemSnapV","ForceBold","","","LanguageGroup","ExpansionFactor","initialRandomSeed","SyntheticBase","PostScript","BaseFontName","BaseFontBlend","","","","","","","ROS","CIDFontVersion","CIDFontRevision","CIDFontType","CIDCount","UIDBase","FDArray","FDSelect","FontName"][o],h=2;null!=u?(n[u]=1==s.length?s[0]:s,s=[]):s.push(l),t+=h}return n}},Bh.T.cmap={parseTab:function(e,t,i){var r={tables:[],ids:{},off:t};e=new Uint8Array(e.buffer,t,i),t=0;var n=Bh.B,s=n.readUshort,a=Bh.T.cmap;s(e,t);var o=s(e,t+=2);t+=2;for(var h=[],u=0;u<o;u++){var l=s(e,t),c=s(e,t+=2);t+=2;var p=n.readUint(e,t);t+=4;var d="p"+l+"e"+c,f=h.indexOf(p);if(-1==f){f=r.tables.length;var g={};h.push(p);var m=g.format=s(e,p);0==m?g=a.parse0(e,p,g):4==m?g=a.parse4(e,p,g):6==m?g=a.parse6(e,p,g):12==m&&(g=a.parse12(e,p,g)),r.tables.push(g)}null!=r.ids[d]&&console.log("multiple tables for one platform+encoding: "+d),r.ids[d]=f}return r},parse0:function(e,t,i){var r=Bh.B;t+=2;var n=r.readUshort(e,t);t+=2,r.readUshort(e,t),t+=2,i.map=[];for(var s=0;s<n-6;s++)i.map.push(e[t+s]);return i},parse4:function(e,t,i){var r=Bh.B,n=r.readUshort,s=r.readUshorts,a=t,o=n(e,t+=2);n(e,t+=2);var h=n(e,t+=2);t+=2;var u=h>>>1;i.searchRange=n(e,t),t+=2,i.entrySelector=n(e,t),t+=2,i.rangeShift=n(e,t),t+=2,i.endCount=s(e,t,u),t+=2*u,t+=2,i.startCount=s(e,t,u),t+=2*u,i.idDelta=[];for(var l=0;l<u;l++)i.idDelta.push(r.readShort(e,t)),t+=2;return i.idRangeOffset=s(e,t,u),t+=2*u,i.glyphIdArray=s(e,t,a+o-t>>1),i},parse6:function(e,t,i){var r=Bh.B;t+=2,r.readUshort(e,t),t+=2,r.readUshort(e,t),t+=2,i.firstCode=r.readUshort(e,t),t+=2;var n=r.readUshort(e,t);t+=2,i.glyphIdArray=[];for(var s=0;s<n;s++)i.glyphIdArray.push(r.readUshort(e,t)),t+=2;return i},parse12:function(e,t,i){var r=Bh.B.readUint;r(e,t+=4),r(e,t+=4);var n=3*r(e,t+=4);t+=4;for(var s=i.groups=new Uint32Array(n),a=0;a<n;a+=3)s[a]=r(e,t+(a<<2)),s[a+1]=r(e,t+(a<<2)+4),s[a+2]=r(e,t+(a<<2)+8);return i}},Bh.T.CBLC={parseTab:function(e,t,i){var r=Bh.B,n=t;r.readUshort(e,t),t+=2,r.readUshort(e,t),t+=2;var s=r.readUint(e,t);t+=4;for(var a=[],o=0;o<s;o++){var h=r.readUint(e,t);t+=4,r.readUint(e,t),t+=4,r.readUint(e,t),t+=4,t+=4,t+=24,r.readUshort(e,t),t+=2,r.readUshort(e,t),t+=2,t+=4;for(var u=n+h,l=0;l<3;l++){var c=r.readUshort(e,u);u+=2;var p=r.readUshort(e,u);u+=2;var d=r.readUint(e,u);u+=4;var f=p-c+1,g=n+h+d,m=r.readUshort(e,g);if(g+=2,1!=m)throw m;var y=r.readUshort(e,g);g+=2;var x=r.readUint(e,g);g+=4;for(var v=[],b=0;b<f;b++){var _=r.readUint(e,g+4*b);v.push(x+_)}a.push([c,p,y,v])}}return a}},Bh.T.CBDT={parseTab:function(e,t,i){return new Uint8Array(e.buffer,e.byteOffset+t,i)}},Bh.T.glyf={parseTab:function(e,t,i,r){for(var n=[],s=r.maxp.numGlyphs,a=0;a<s;a++)n.push(null);return n},_parseGlyf:function(e,t){var i=Bh.B,r=e._data,n=e.loca;if(n[t]==n[t+1])return null;var s=Bh.findTable(r,"glyf",e._offset)[0]+n[t],a={};if(a.noc=i.readShort(r,s),s+=2,a.xMin=i.readShort(r,s),s+=2,a.yMin=i.readShort(r,s),s+=2,a.xMax=i.readShort(r,s),s+=2,a.yMax=i.readShort(r,s),s+=2,a.xMin>=a.xMax||a.yMin>=a.yMax)return null;if(a.noc>0){a.endPts=[];for(var o=0;o<a.noc;o++)a.endPts.push(i.readUshort(r,s)),s+=2;var h=i.readUshort(r,s);if(s+=2,r.length-s<h)return null;a.instructions=i.readBytes(r,s,h),s+=h;var u=a.endPts[a.noc-1]+1;a.flags=[];for(o=0;o<u;o++){var l=r[s];if(s++,a.flags.push(l),8&l){var c=r[s];s++;for(var p=0;p<c;p++)a.flags.push(l),o++}}a.xs=[];for(o=0;o<u;o++){var d=!!(2&a.flags[o]),f=!!(16&a.flags[o]);d?(a.xs.push(f?r[s]:-r[s]),s++):f?a.xs.push(0):(a.xs.push(i.readShort(r,s)),s+=2)}a.ys=[];for(o=0;o<u;o++){d=!!(4&a.flags[o]),f=!!(32&a.flags[o]);d?(a.ys.push(f?r[s]:-r[s]),s++):f?a.ys.push(0):(a.ys.push(i.readShort(r,s)),s+=2)}var g=0,m=0;for(o=0;o<u;o++)g+=a.xs[o],m+=a.ys[o],a.xs[o]=g,a.ys[o]=m}else{var y;a.parts=[];do{y=i.readUshort(r,s),s+=2;var x={m:{a:1,b:0,c:0,d:1,tx:0,ty:0},p1:-1,p2:-1};if(a.parts.push(x),x.glyphIndex=i.readUshort(r,s),s+=2,1&y){var v=i.readShort(r,s);s+=2;var b=i.readShort(r,s);s+=2}else{v=i.readInt8(r,s);s++;b=i.readInt8(r,s);s++}2&y?(x.m.tx=v,x.m.ty=b):(x.p1=v,x.p2=b),8&y?(x.m.a=x.m.d=i.readF2dot14(r,s),s+=2):64&y?(x.m.a=i.readF2dot14(r,s),s+=2,x.m.d=i.readF2dot14(r,s),s+=2):128&y&&(x.m.a=i.readF2dot14(r,s),s+=2,x.m.b=i.readF2dot14(r,s),s+=2,x.m.c=i.readF2dot14(r,s),s+=2,x.m.d=i.readF2dot14(r,s),s+=2)}while(32&y);if(256&y){var _=i.readUshort(r,s);s+=2,a.instr=[];for(o=0;o<_;o++)a.instr.push(r[s]),s++}}return a}},Bh.T.head={parseTab:function(e,t,i){var r=Bh.B,n={};return r.readFixed(e,t),t+=4,n.fontRevision=r.readFixed(e,t),t+=4,r.readUint(e,t),t+=4,r.readUint(e,t),t+=4,n.flags=r.readUshort(e,t),t+=2,n.unitsPerEm=r.readUshort(e,t),t+=2,n.created=r.readUint64(e,t),t+=8,n.modified=r.readUint64(e,t),t+=8,n.xMin=r.readShort(e,t),t+=2,n.yMin=r.readShort(e,t),t+=2,n.xMax=r.readShort(e,t),t+=2,n.yMax=r.readShort(e,t),t+=2,n.macStyle=r.readUshort(e,t),t+=2,n.lowestRecPPEM=r.readUshort(e,t),t+=2,n.fontDirectionHint=r.readShort(e,t),t+=2,n.indexToLocFormat=r.readShort(e,t),t+=2,n.glyphDataFormat=r.readShort(e,t),t+=2,n}},Bh.T.hhea={parseTab:function(e,t,i){var r=Bh.B,n={};r.readFixed(e,t),t+=4;for(var s=["ascender","descender","lineGap","advanceWidthMax","minLeftSideBearing","minRightSideBearing","xMaxExtent","caretSlopeRise","caretSlopeRun","caretOffset","res0","res1","res2","res3","metricDataFormat","numberOfHMetrics"],a=0;a<s.length;a++){var o=s[a],h="advanceWidthMax"==o||"numberOfHMetrics"==o?r.readUshort:r.readShort;n[o]=h(e,t+2*a)}return n}},Bh.T.hmtx={parseTab:function(e,t,i,r){for(var n=Bh.B,s=[],a=[],o=r.maxp.numGlyphs,h=r.hhea.numberOfHMetrics,u=0,l=0,c=0;c<h;)u=n.readUshort(e,t+(c<<2)),l=n.readShort(e,t+(c<<2)+2),s.push(u),a.push(l),c++;for(;c<o;)s.push(u),a.push(l),c++;return{aWidth:s,lsBearing:a}}},Bh.T.kern={parseTab:function(e,t,i,r){var n=Bh.B,s=Bh.T.kern;if(1==n.readUshort(e,t))return s.parseV1(e,t,i,r);var a=n.readUshort(e,t+2);t+=4;for(var o={glyph1:[],rval:[]},h=0;h<a;h++){t+=2;i=n.readUshort(e,t);t+=2;var u=n.readUshort(e,t);t+=2;var l=u>>>8;0==(l&=15)&&(t=s.readFormat0(e,t,o))}return o},parseV1:function(e,t,i,r){var n=Bh.B,s=Bh.T.kern;n.readFixed(e,t);var a=n.readUint(e,t+4);t+=8;for(var o={glyph1:[],rval:[]},h=0;h<a;h++){n.readUint(e,t),t+=4;var u=n.readUshort(e,t);t+=2,n.readUshort(e,t),t+=2,0==(255&u)&&(t=s.readFormat0(e,t,o))}return o},readFormat0:function(e,t,i){var r=Bh.B,n=r.readUshort,s=-1,a=n(e,t);n(e,t+2),n(e,t+4),n(e,t+6),t+=8;for(var o=0;o<a;o++){var h=n(e,t),u=n(e,t+=2);t+=2;var l=r.readShort(e,t);t+=2,h!=s&&(i.glyph1.push(h),i.rval.push({glyph2:[],vals:[]}));var c=i.rval[i.rval.length-1];c.glyph2.push(u),c.vals.push(l),s=h}return t}},Bh.T.loca={parseTab:function(e,t,i,r){var n=Bh.B,s=[],a=r.head.indexToLocFormat,o=r.maxp.numGlyphs+1;if(0==a)for(var h=0;h<o;h++)s.push(n.readUshort(e,t+(h<<1))<<1);if(1==a)for(h=0;h<o;h++)s.push(n.readUint(e,t+(h<<2)));return s}},Bh.T.maxp={parseTab:function(e,t,i){var r=Bh.B,n=r.readUshort,s={};return r.readUint(e,t),t+=4,s.numGlyphs=n(e,t),t+=2,s}},Bh.T.name={parseTab:function(e,t,i){var r=Bh.B,n={};r.readUshort(e,t),t+=2;var s=r.readUshort(e,t);t+=2;for(var a=r.readUshort(e,t),o=(t+=2)-6+a,h=["copyright","fontFamily","fontSubfamily","ID","fullName","version","postScriptName","trademark","manufacturer","designer","description","urlVendor","urlDesigner","licence","licenceURL","---","typoFamilyName","typoSubfamilyName","compatibleFull","sampleText","postScriptCID","wwsFamilyName","wwsSubfamilyName","lightPalette","darkPalette"],u=r.readUshort,l=0;l<s;l++){var c=u(e,t),p=u(e,t+=2),d=u(e,t+=2),f=u(e,t+=2),g=u(e,t+=2),m=u(e,t+=2);t+=2;var y,x=o+m;0==c||3==c&&0==p||1==c&&25==p?y=r.readUnicode(e,x,g/2):0==p?y=r.readASCII(e,x,g):1==p||3==p||4==p||5==p||10==p?y=r.readUnicode(e,x,g/2):1==c?(y=r.readASCII(e,x,g),console.log("reading unknown MAC encoding "+p+" as ASCII")):(console.log("unknown encoding "+p+", platformID: "+c),y=r.readASCII(e,x,g));var v="p"+c+","+d.toString(16);null==n[v]&&(n[v]={});var b=h[f];null==b&&(b="_"+f),n[v][b]=y,n[v]._lang=d}var _=Bh.T.name.selectOne(n),w="fontFamily";if(null==_[w])for(var C in n)null!=n[C][w]&&(_[w]=n[C][w]);return _},selectOne:function(e){var t,i="postScriptName";for(var r in e)if(null!=e[r][i]&&1033==e[r]._lang)return e[r];for(var r in e)if(null!=e[r][i]&&0==e[r]._lang)return e[r];for(var r in e)if(null!=e[r][i]&&3084==e[r]._lang)return e[r];for(var r in e)if(null!=e[r][i])return e[r];for(var r in e){t=e[r];break}return console.log("returning name table with languageID "+t._lang),null==t[i]&&null!=t.ID&&(t[i]=t.ID),t}},Bh.T.OS2={parseTab:function(e,t,i){var r=Bh.B.readUshort(e,t);t+=2;var n=Bh.T.OS2,s={};if(0==r)n.version0(e,t,s);else if(1==r)n.version1(e,t,s);else if(2==r||3==r||4==r)n.version2(e,t,s);else{if(5!=r)throw"unknown OS/2 table version: "+r;n.version5(e,t,s)}return s},version0:function(e,t,i){var r=Bh.B;return i.xAvgCharWidth=r.readShort(e,t),t+=2,i.usWeightClass=r.readUshort(e,t),t+=2,i.usWidthClass=r.readUshort(e,t),t+=2,i.fsType=r.readUshort(e,t),t+=2,i.ySubscriptXSize=r.readShort(e,t),t+=2,i.ySubscriptYSize=r.readShort(e,t),t+=2,i.ySubscriptXOffset=r.readShort(e,t),t+=2,i.ySubscriptYOffset=r.readShort(e,t),t+=2,i.ySuperscriptXSize=r.readShort(e,t),t+=2,i.ySuperscriptYSize=r.readShort(e,t),t+=2,i.ySuperscriptXOffset=r.readShort(e,t),t+=2,i.ySuperscriptYOffset=r.readShort(e,t),t+=2,i.yStrikeoutSize=r.readShort(e,t),t+=2,i.yStrikeoutPosition=r.readShort(e,t),t+=2,i.sFamilyClass=r.readShort(e,t),t+=2,i.panose=r.readBytes(e,t,10),t+=10,i.ulUnicodeRange1=r.readUint(e,t),t+=4,i.ulUnicodeRange2=r.readUint(e,t),t+=4,i.ulUnicodeRange3=r.readUint(e,t),t+=4,i.ulUnicodeRange4=r.readUint(e,t),t+=4,i.achVendID=r.readASCII(e,t,4),t+=4,i.fsSelection=r.readUshort(e,t),t+=2,i.usFirstCharIndex=r.readUshort(e,t),t+=2,i.usLastCharIndex=r.readUshort(e,t),t+=2,i.sTypoAscender=r.readShort(e,t),t+=2,i.sTypoDescender=r.readShort(e,t),t+=2,i.sTypoLineGap=r.readShort(e,t),t+=2,i.usWinAscent=r.readUshort(e,t),t+=2,i.usWinDescent=r.readUshort(e,t),t+=2},version1:function(e,t,i){var r=Bh.B;return t=Bh.T.OS2.version0(e,t,i),i.ulCodePageRange1=r.readUint(e,t),t+=4,i.ulCodePageRange2=r.readUint(e,t),t+=4},version2:function(e,t,i){var r=Bh.B,n=r.readUshort;return t=Bh.T.OS2.version1(e,t,i),i.sxHeight=r.readShort(e,t),t+=2,i.sCapHeight=r.readShort(e,t),t+=2,i.usDefault=n(e,t),t+=2,i.usBreak=n(e,t),t+=2,i.usMaxContext=n(e,t),t+=2},version5:function(e,t,i){var r=Bh.B.readUshort;return t=Bh.T.OS2.version2(e,t,i),i.usLowerOpticalPointSize=r(e,t),t+=2,i.usUpperOpticalPointSize=r(e,t),t+=2}},Bh.T.post={parseTab:function(e,t,i){var r=Bh.B,n={};return n.version=r.readFixed(e,t),t+=4,n.italicAngle=r.readFixed(e,t),t+=4,n.underlinePosition=r.readShort(e,t),t+=2,n.underlineThickness=r.readShort(e,t),t+=2,n}},Bh.T.SVG={parseTab:function(e,t,i){var r=Bh.B,n={entries:[],svgs:[]},s=t;r.readUshort(e,t),t+=2;var a=r.readUint(e,t);t+=4,r.readUint(e,t),t+=4,t=a+s;var o=r.readUshort(e,t);t+=2;for(var h=0;h<o;h++){var u=r.readUshort(e,t);t+=2;var l=r.readUshort(e,t);t+=2;var c=r.readUint(e,t);t+=4;var p=r.readUint(e,t);t+=4;var d=new Uint8Array(e.buffer,s+c+a,p);31==d[0]&&139==d[1]&&8==d[2]&&(d=kh.inflate(d));for(var f=r.readUTF8(d,0,d.length),g=u;g<=l;g++)n.entries[g]=n.svgs.length;n.svgs.push(f)}return n}},Bh.T.sbix={parseTab:function(e,t,i,r){for(var n=r.maxp.numGlyphs,s=t,a=Bh.B,o=a.readUint(e,t+4),h=[],u=o-1;u<o;u++)for(var l=s+a.readUint(e,t+8+4*u),c=0;c<n;c++){var p=a.readUint(e,l+4+4*c),d=a.readUint(e,l+4+4*c+4);if(p!=d){var f=l+p,g=a.readASCII(e,f+4,4);if("png "!=g)throw g;h[c]=new Uint8Array(e.buffer,e.byteOffset+f+8,d-p-8)}else h[c]=null}return h}},Bh.T.colr={parseTab:function(e,t,i){var r=Bh.B,n=t;t+=2;var s=r.readUshort(e,t);t+=2;var a=r.readUint(e,t);t+=4;var o=r.readUint(e,t);t+=4;var h=r.readUshort(e,t);t+=2;for(var u={},l=n+a,c=0;c<s;c++)u["g"+r.readUshort(e,l)]=[r.readUshort(e,l+2),r.readUshort(e,l+4)],l+=6;var p=[];l=n+o;for(c=0;c<h;c++)p.push(r.readUshort(e,l),r.readUshort(e,l+2)),l+=4;return[u,p]}},Bh.T.cpal={parseTab:function(e,t,i){var r=Bh.B,n=t,s=r.readUshort(e,t);if(t+=2,0==s){r.readUshort(e,t),t+=2,r.readUshort(e,t),t+=2;var a=r.readUshort(e,t);t+=2;var o=r.readUint(e,t);return t+=4,new Uint8Array(e.buffer,n+o,4*a)}throw s}},Bh.T.GSUB={parseTab:function(e,t,i,r){var n=Bh.B,s=n.readUshort,a=t;s(e,a),s(e,a+=2),s(e,a+=2);var o=s(e,a+=2);s(e,a+=2),a+=2;var h={},u=s(e,a=t+o);a+=2;for(var l=0;l<u;l++){var c=n.readASCII(e,a,4);s(e,a+=4),a+=2,h[c]=!0}return h}},Bh.T.fvar={parseTab:function(e,t,i,r){var n=r.name,s=t,a=Bh.B,o=[],h=[];s+=8;var u=a.readUshort(e,s);s+=2,s+=2;var l=a.readUshort(e,s);s+=2;var c=a.readUshort(e,s);s+=2;for(var p=0;p<u;p++){var d=a.readASCII(e,s,4),f=a.readFixed(e,s+4),g=a.readFixed(e,s+8),m=a.readFixed(e,s+12),y=a.readUshort(e,s+16),x=a.readUshort(e,s+18);o.push([d,f,g,m,y,n["_"+x]]),s+=20}for(p=0;p<l;p++){for(var v=a.readUshort(e,s),b=null,_=(y=a.readUshort(e,s+2),[]),w=0;w<u;w++)_.push(a.readFixed(e,s+4+4*w));s+=4+4*u,2==(3&c)&&(b=a.readUshort(e,s),s+=2),h.push([n["_"+v],y,_,b])}return[o,h]}},Bh.T.gvar=function(){var e=Bh.B;function t(t,i,r){for(var n=[],s=0;s<r;s++)n.push(e.readF2dot14(t,i+2*s));return n}function i(i,r,n,s,a){for(var o=[],h=0;h<n;h++){var u=e.readUshort(i,r);r+=2;var l=e.readUshort(i,r),c=61440&l;l&=4095,r+=2;var p=null,d=null,f=null;32768&c&&(p=t(i,r,s),r+=2*s),16384&c&&(d=t(i,r,s),r+=2*s),16384&c&&(f=t(i,r,s),r+=2*s),o.push([u,l,c,d,p,f])}return o}function r(t,i,r){var n=t[i];if(i++,0==n)return[[],i];127<n&&(n=(127&n)<<8|t[i++]);for(var s=[],a=0;s.length<n;){var o=t[i];i++;var h=!!(128&o);o=1+(127&o);for(var u=0;u<o;u++){var l=0;h?(l=e.readUshort(t,i),i+=2):(l=t[i],i++),a+=l,s.push(a)}}return[s,i]}return{parseTab:function(n,s,a,o){var h=s+4,u=e.readUshort(n,h);h+=2;var l=e.readUshort(n,h);h+=2;var c=e.readUint(n,h);h+=4;var p=e.readUshort(n,h);h+=2,e.readUshort(n,h),h+=2;var d=e.readUint(n,h);h+=4;for(var f=[],g=0;g<p+1;g++)f.push(e.readUint(n,h+4*g));var m=[],y=[],x=[];for(h=s+c,g=0;g<l;g++){var v=t(n,h+g*u*2,u),b=[],_=[];m.push(v),y.push(b),x.push(_);for(var w=0;w<u;w++)b[w]=Math.min(v[w],0),_[w]=Math.max(v[w],0)}var C=new Int8Array(n.buffer),A=[];for(g=0;g<p;g++){h=s+d+f[g];var E=e.readUshort(n,h);h+=2;var D=32768&E;E&=4095;var S=e.readUshort(n,h),F=i(n,h+=2,E,u),T=[];A.push(T),h=s+d+f[g]+S;var M=null;if(D)M=(I=r(n,h))[0],h=I[1];for(var k=0;k<E;k++){var I,B=F[k],L=h+B[0],O=M;if(8192&B[2])O=(I=r(n,h))[0],h=I[1];for(var P=[];h<L;){var N=n[h++],R=1+(63&N);if(128&N)for(w=0;w<R;w++)P.push(0);else if(64&N){for(w=0;w<R;w++)P.push(e.readShort(n,h+2*w));h+=2*R}else{for(w=0;w<R;w++)P.push(C[h+w]);h+=R}}var V=B[1];if(T.push([[B[3]?B[3]:y[V],B[4]?B[4]:m[V],B[5]?B[5]:x[V]],P,0==O.length?null:O]),0!=O.length&&2*O.length!=P.length)throw"e"}}return A}}}(),Bh.T.avar={parseTab:function(e,t,i,r){var n=t,s=Bh.B,a=[];n+=6;var o=s.readUshort(e,n);n+=2;for(var h=0;h<o;h++){var u=s.readUshort(e,n);n+=2;var l=[];a.push(l);for(var c=0;c<u;c++){var p=s.readF2dot14(e,n),d=s.readF2dot14(e,n+2);n+=4,l.push(p,d)}}return a}},Bh.T.HVAR={parseTab:function(e,t,i,r){var n=t,s=t,a=Bh.B;n+=4;var o=a.readUint(e,n);n+=4;var h=a.readUint(e,n);n+=4;var u=a.readUint(e,n);n+=4;var l=a.readUint(e,n);if(n+=4,0!=u||0!=l)throw u;var c=n=s+o,p=a.readUshort(e,n);if(n+=2,1!=p)throw"e";var d=a.readUint(e,n);n+=4;var f=a.readUshort(e,n);n+=2;for(var g=[],m=0;m<f;m++)g.push(a.readUint(e,n+4*m));n+=4*f,n=c+d;var y=a.readUshort(e,n);n+=2;var x=a.readUshort(e,n);n+=2;var v=[];for(m=0;m<x;m++){var b=[[],[],[]];v.push(b);for(var _=0;_<y;_++)b[0].push(a.readF2dot14(e,n+0)),b[1].push(a.readF2dot14(e,n+2)),b[2].push(a.readF2dot14(e,n+4)),n+=6}var w=new Int8Array(e.buffer),C=[];for(m=0;m<g.length;m++){n=s+o+g[m];var A=[];C.push(A);var E=a.readUshort(e,n);n+=2;var D=a.readUshort(e,n);if(n+=2,32768&D)throw"e";x=a.readUshort(e,n);n+=2;var S=[];for(_=0;_<x;_++)S.push(a.readUshort(e,n+2*_));n+=2*x;for(var F=0;F<E;F++){for(var T=[],M=0;M<x;M++)T.push(M<D?a.readShort(e,n):w[n]),n+=M<D?2:1;var k=new Array(v.length);k.fill(0),A.push(k);for(_=0;_<S.length;_++)k[S[_]]=T[_]}}if(n=s+h,0!=(p=e[n++]))throw"e";var I=e[n++],B=a.readUshort(e,n);n+=2;var L=1+((48&I)>>4),O=[];for(m=0;m<B;m++){var P=0;1==L?P=e[n++]:(P=a.readUshort(e,n),n+=2);var N=P>>1+(15&I),R=P&(1<<1+(15&I))-1;O.push(C[N][R])}return[v,O]}},Bh.U=function(){var e=function(e,t,i){e.cmds.push("M"),e.crds.push(t,i)},t=function(e,t,i){e.cmds.push("L"),e.crds.push(t,i)},i=function(e,t,i,r,n,s,a){e.cmds.push("C"),e.crds.push(t,i,r,n,s,a)},r=function(e,t,i,r,n){e.cmds.push("Q"),e.crds.push(t,i,r,n)},n=function(e){e.cmds.push("Z")};function s(e,t,i,r){var n=t[i],s=t[i+1],a=e.kern;if(a){var o=a.glyph1.indexOf(n);if(-1!=o){var h=a.rval[o].glyph2.indexOf(s);if(-1!=h)return[0,0,a.rval[o].vals[h],0]}}return[0,0,0,0]}function a(e,t,i){for(var r=0,n=~~(e.length/t);r+1!=n;){var s=r+(n-r>>>1);e[s*t]<=i?r=s:n=s}return r*t}for(var o,h,u=[9,10,11,12,13,32,133,160,5760,6158,8232,8233,8239,8288,12288,65279],l={},c=0;c<u.length;c++)l[u[c]]=1;for(c=8192;c<=8205;c++)l[c]=1;function p(e,t){if(null==e._ctab){for(var i=e.cmap,r=-1,n=["p3e10","p0e4","p3e1","p1e0","p0e3","p0e1","p3e0","p3e5"],s=0;s<n.length;s++)if(null!=i.ids[n[s]]){r=i.ids[n[s]];break}if(-1==r)throw"no familiar platform and encoding!";e._ctab=i.tables[r]}var o=e._ctab,h=o.format,u=-1;if(0==h)u=t>=o.map.length?0:o.map[t];else if(4==h){var c=o.endCount;if(u=0,t<=c[c.length-1]){var p=a(c,1,t);if(c[p]<t&&p++,t>=o.startCount[p]){u=65535&(0!=o.idRangeOffset[p]?o.glyphIdArray[t-o.startCount[p]+(o.idRangeOffset[p]>>1)-(o.idRangeOffset.length-p)]:t+o.idDelta[p])}}}else if(6==h){var d=t-o.firstCode,f=o.glyphIdArray;u=d<0||d>=f.length?0:f[d]}else{if(12!=h)throw"unknown cmap table format "+o.format;var g=o.groups;u=0,t<=g[g.length-2]&&g[s=a(g,3,t)]<=t&&t<=g[s+1]&&(u=g[s+2]+(t-g[s]))}var m=e["SVG "],y=e.loca;return 0==u||null!=e["CFF "]||null!=m&&null!=m.entries[u]||!y||y[u]!=y[u+1]||null!=l[t]||(u=0),u}function d(e,t,i,r){var n={cmds:[],crds:[]};e.fvar&&(null==r&&(r=e.fvar[1][e._index][2]),r=m(e,r));var s=e["SVG "],a=e["CFF "],o=e.COLR,h=e.CBLC,u=e.CBDT,l=e.sbix,c=window.UPNG,p=null;if(h&&c)for(var g=0;g<h.length;g++)h[g][0]<=t&&t<=h[g][1]&&(p=h[g]);if(p||l&&l[t]){if(p&&17!=p[2])throw"not a PNG";null==e.__tmp&&(e.__tmp={});var y=e.__tmp["g"+t];if(null==y){var x,b;if(l)b=(x=l[t]).length;else{var _=p[3][t-p[0]]+5;b=u[_+1]<<16|u[_+2]<<8|u[_+3],_+=4,x=new Uint8Array(u.buffer,u.byteOffset+_,b)}var w="";for(g=0;g<b;g++)w+=String.fromCharCode(x[g]);y=e.__tmp["g"+t]="data:image/png;base64,"+btoa(w)}n.cmds.push(y);var C=1.15*e.head.unitsPerEm,A=Math.round(C),E=Math.round(C),D=Math.round(.15*-E);n.crds.push(0,E+D,A,E+D,A,D,0,D)}else if(s&&s.entries[t]){var S=s.entries[t];if(null!=S){if("number"==typeof S){var F=s.svgs[S];if("string"==typeof F){var T=(new DOMParser).parseFromString(F,"image/svg+xml");F=s.svgs[S]=T.getElementsByTagName("svg")[0]}S=Bh.U.SVG.toPath(F,t),s.entries[t]=S}n=S}}else if(1!=i&&o&&o[0]["g"+t]&&o[0]["g"+t][1]>1){function U(e){var t=e.toString(16);return(1==t.length?"0":"")+t}var M=e.CPAL,k=o[0]["g"+t];for(g=0;g<k[1];g++){var I=k[0]+g,B=o[1][2*I],L=4*o[1][2*I+1],O=d(e,B,B==t),P="#"+U(M[L+2])+U(M[L+1])+U(M[L+0]);n.cmds.push(P),n.cmds=n.cmds.concat(O.cmds),n.crds=n.crds.concat(O.crds),n.cmds.push("X")}}else if(a){var N=a.Private,R={x:0,y:0,stack:[],nStems:0,haveWidth:!1,width:N?N.defaultWidthX:0,open:!1};if(a.ROS){for(var V=0;a.FDSelect[V+2]<=t;)V+=2;N=a.FDArray[a.FDSelect[V+1]].Private}v(a.CharStrings[t],R,a,N,n)}else e.glyf&&f(t,e,n,r);return{cmds:n.cmds,crds:n.crds}}function f(i,s,a,o){var h=s.glyf[i];null==h&&(h=s.glyf[i]=Bh.T.glyf._parseGlyf(s,i)),null!=h&&(h.noc>-1?function(i,s,a,o,h){var u=i.xs,l=i.ys;if(s.fvar&&h){u=u.slice(0),l=l.slice(0);for(var c=s.gvar,p=c?c[a]:null,d=0;d<p.length;d++){var f=g(p[d][0],h);if(!(f<1e-9)){var m=p[d][1],x=p[d][2];if(x&&(m=p[d][1]=y(m,x,u,l,i.endPts),p[d][2]=null),m.length==2*u.length+8)for(var v=0;v<u.length;v++)u[v]+=f*m[v],l[v]+=f*m[v+u.length+4]}}}for(var b=0;b<i.noc;b++){var _=0==b?0:i.endPts[b-1]+1,w=i.endPts[b];for(v=_;v<=w;v++){var C=v==_?w:v-1,A=v==w?_:v+1,E=1&i.flags[v],D=1&i.flags[C],S=1&i.flags[A],F=u[v],T=l[v];if(v==_)if(E){if(!D){e(o,F,T);continue}e(o,u[C],l[C])}else D?e(o,u[C],l[C]):e(o,Math.floor(.5*(u[C]+F)),Math.floor(.5*(l[C]+T)));E?D&&t(o,F,T):S?r(o,F,T,u[A],l[A]):r(o,F,T,Math.floor(.5*(F+u[A])),Math.floor(.5*(T+l[A])))}n(o)}}(h,s,i,a,o):function(e,t,i,r,n){var s=[0,0,0,0,0,0],a=[0,0,0,0,0,0],o=e.parts.length;if(t.fvar&&n)for(var h=t.gvar,u=h?h[i]:null,l=0;l<u.length;l++){var c=g(u[l][0],n);if(!(c<1e-6)){var p=u[l][1],d=u[l][2];if(null==d)for(var m=0;m<o;m++)s[m]+=c*p[m],a[m]+=c*p[m+o+4];else for(var y=0;y<d.length;y++){s[m=d[y]]+=c*p[0],a[m]+=c*p[0+o]}}}for(y=0;y<o;y++){var x={cmds:[],crds:[]},v=e.parts[y];f(v.glyphIndex,t,x,n);var b=v.m,_=b.tx+s[y],w=b.ty+a[y];for(m=0;m<x.crds.length;m+=2){var C=x.crds[m],A=x.crds[m+1];r.crds.push(C*b.a+A*b.c+_),r.crds.push(C*b.b+A*b.d+w)}for(m=0;m<x.cmds.length;m++)r.cmds.push(x.cmds[m])}}(h,s,i,a,o))}function g(e,t){for(var i=1,r=e[0],n=e[1],s=e[2],a=0;a<t.length;a++){i*=r[a]>n[a]||n[a]>s[a]||r[a]<0&&s[a]>0&&0!=n[a]||0==n[a]?1:t[a]<r[a]||t[a]>s[a]?0:t[a]==n[a]?1:t[a]<n[a]?(t[a]-r[a])/(n[a]-r[a]):(s[a]-t[a])/(s[a]-n[a])}return i}function m(e,t){for(var i=e.fvar,r=e.avar,n=i?i[0]:null,s=[],a=0;a<n.length;a++){var o=n[a][1],h=n[a][2],u=n[a][3],l=Math.max(o,Math.min(u,t[a]));if(s[a]=l<h?(h-l)/(o-h):l>h?(l-h)/(u-h):0,r&&-1!=s[a]){for(var c=r[a],p=0;p<c.length&&!(c[p]>=s[a]);p+=2);var d=(s[a]-c[p-2])/(c[p]-c[p-2]);s[a]=d*c[p+1]+(1-d)*c[p-1]}}return s}function y(e,t,i,r,n){var s=i.length,a=new Array(2*s+8);a.fill(0);for(var o=0;o<s;o++){var h=0,u=0,l=t.indexOf(o);if(-1!=l)h=e[l],u=e[t.length+l];else{for(var c=0;n[c]<o;)c++;for(var p=0==c?0:n[c-1]+1,d=n[c],f=-1,g=-1,m=0;m<t.length;m++){(y=t[m])<p||y>d||y>=s||(f=m,-1==g&&(g=m))}for(m=0;m<t.length;m++){var y;if(!((y=t[m])<p||y>d||y>=s)&&(y<o&&(f=m),o<y)){g=m;break}}for(var x=0;x<2;x++){var v=0==x?i:r,b=x*t.length,_=0,w=v[t[f]],C=v[t[g]],A=v[o],E=e[b+f],D=e[b+g];if(w==C)_=E==D?E:0;else if(A<=Math.min(w,C))_=w<C?E:D;else if(Math.max(w,C)<=A)_=w<C?D:E;else{var S=(A-w)/(C-w);_=S*D+(1-S)*E}0==x?h=_:u=_}}a[o]=h,a[s+4+o]=u}return a}function x(e,t,i,r){for(var n=t>>1,s=i>>1,a=new Uint8Array(n*s*4),o=new Uint32Array(e.buffer),h=new Uint32Array(a.buffer),u=0;u<s;u++)for(var l=0;l<n;l++){var c=u*n+l,p=(u<<1)*t+(l<<1),d=o[p],f=o[p+1],g=o[p+t],m=o[p+t+1],y=d>>>24,x=f>>>24,v=g>>>24,b=m>>>24,_=y+x+v+b;if(1020==_){var w=(d>>>0&255)+(f>>>0&255)+(g>>>0&255)+(m>>>0&255)+2>>>2,C=(d>>>8&255)+(f>>>8&255)+(g>>>8&255)+(m>>>8&255)+2>>>2,A=(d>>>16&255)+(f>>>16&255)+(g>>>16&255)+(m>>>16&255)+2>>>2;h[c]=255<<24|A<<16|C<<8|w}else if(0==_)h[c]=0;else{var E=1/_;w=~~((w=(d>>>0&255)*y+(f>>>0&255)*x+(g>>>0&255)*v+(m>>>0&255)*b)*E+.5),C=~~((C=(d>>>8&255)*y+(f>>>8&255)*x+(g>>>8&255)*v+(m>>>8&255)*b)*E+.5),A=~~((A=(d>>>16&255)*y+(f>>>16&255)*x+(g>>>16&255)*v+(m>>>16&255)*b)*E+.5),h[c]=_+2>>>2<<24|A<<16|C<<8|w}}return{buff:a,w:n,h:s}}function v(r,s,a,o,h){for(var u=s.stack,l=s.nStems,c=s.haveWidth,p=s.width,d=s.open,f=0,g=s.x,m=s.y,y=0,x=0,b=0,_=0,w=0,C=0,A=0,E=0,D=0,S=0,F=Bh.T.CFF,T=o.nominalWidthX,M={val:0,size:0};f<r.length;){F.getCharString(r,f,M);var k=M.val;if(f+=M.size,"o1"==k||"o18"==k)u.length%2!=0&&!c&&(p=u.shift()+T),l+=u.length>>1,u.length=0,c=!0;else if("o3"==k||"o23"==k){u.length%2!=0&&!c&&(p=u.shift()+T),l+=u.length>>1,u.length=0,c=!0}else if("o4"==k)u.length>1&&!c&&(p=u.shift()+T,c=!0),d&&n(h),m+=u.pop(),e(h,g,m),d=!0;else if("o5"==k)for(;u.length>0;)g+=u.shift(),m+=u.shift(),t(h,g,m);else if("o6"==k||"o7"==k)for(var I=u.length,B="o6"==k,L=0;L<I;L++){var O=u.shift();B?g+=O:m+=O,B=!B,t(h,g,m)}else if("o8"==k||"o24"==k){I=u.length;for(var P=0;P+6<=I;)y=g+u.shift(),x=m+u.shift(),b=y+u.shift(),_=x+u.shift(),g=b+u.shift(),m=_+u.shift(),i(h,y,x,b,_,g,m),P+=6;"o24"==k&&(g+=u.shift(),m+=u.shift(),t(h,g,m))}else{if("o11"==k)break;if("o1234"==k||"o1235"==k||"o1236"==k||"o1237"==k)"o1234"==k&&(x=m,b=(y=g+u.shift())+u.shift(),S=_=x+u.shift(),C=_,E=m,g=(A=(w=(D=b+u.shift())+u.shift())+u.shift())+u.shift(),i(h,y,x,b,_,D,S),i(h,w,C,A,E,g,m)),"o1235"==k&&(y=g+u.shift(),x=m+u.shift(),b=y+u.shift(),_=x+u.shift(),D=b+u.shift(),S=_+u.shift(),w=D+u.shift(),C=S+u.shift(),A=w+u.shift(),E=C+u.shift(),g=A+u.shift(),m=E+u.shift(),u.shift(),i(h,y,x,b,_,D,S),i(h,w,C,A,E,g,m)),"o1236"==k&&(y=g+u.shift(),x=m+u.shift(),b=y+u.shift(),S=_=x+u.shift(),C=_,A=(w=(D=b+u.shift())+u.shift())+u.shift(),E=C+u.shift(),g=A+u.shift(),i(h,y,x,b,_,D,S),i(h,w,C,A,E,g,m)),"o1237"==k&&(y=g+u.shift(),x=m+u.shift(),b=y+u.shift(),_=x+u.shift(),D=b+u.shift(),S=_+u.shift(),w=D+u.shift(),C=S+u.shift(),A=w+u.shift(),E=C+u.shift(),Math.abs(A-g)>Math.abs(E-m)?g=A+u.shift():m=E+u.shift(),i(h,y,x,b,_,D,S),i(h,w,C,A,E,g,m));else if("o14"==k){if(u.length>0&&4!=u.length&&!c&&(p=u.shift()+a.nominalWidthX,c=!0),4==u.length){var N=u.shift(),R=u.shift(),V=u.shift(),U=u.shift(),z=F.glyphBySE(a,V),G=F.glyphBySE(a,U);v(a.CharStrings[z],s,a,o,h),s.x=N,s.y=R,v(a.CharStrings[G],s,a,o,h)}d&&(n(h),d=!1)}else if("o19"==k||"o20"==k){u.length%2!=0&&!c&&(p=u.shift()+T),l+=u.length>>1,u.length=0,c=!0,f+=l+7>>3}else if("o21"==k)u.length>2&&!c&&(p=u.shift()+T,c=!0),m+=u.pop(),g+=u.pop(),d&&n(h),e(h,g,m),d=!0;else if("o22"==k)u.length>1&&!c&&(p=u.shift()+T,c=!0),g+=u.pop(),d&&n(h),e(h,g,m),d=!0;else if("o25"==k){for(;u.length>6;)g+=u.shift(),m+=u.shift(),t(h,g,m);y=g+u.shift(),x=m+u.shift(),b=y+u.shift(),_=x+u.shift(),g=b+u.shift(),m=_+u.shift(),i(h,y,x,b,_,g,m)}else if("o26"==k)for(u.length%2&&(g+=u.shift());u.length>0;)y=g,x=m+u.shift(),g=b=y+u.shift(),m=(_=x+u.shift())+u.shift(),i(h,y,x,b,_,g,m);else if("o27"==k)for(u.length%2&&(m+=u.shift());u.length>0;)x=m,b=(y=g+u.shift())+u.shift(),_=x+u.shift(),g=b+u.shift(),i(h,y,x,b,_,g,m=_);else if("o10"==k||"o29"==k){var j="o10"==k?o:a;if(0==u.length)console.log("error: empty stack");else{var $=u.pop(),q=j.Subrs[$+j.Bias];s.x=g,s.y=m,s.nStems=l,s.haveWidth=c,s.width=p,s.open=d,v(q,s,a,o,h),g=s.x,m=s.y,l=s.nStems,c=s.haveWidth,p=s.width,d=s.open}}else if("o30"==k||"o31"==k){var H=u.length,W=(P=0,"o31"==k);for(P+=H-(I=-3&H);P<I;)W?(x=m,b=(y=g+u.shift())+u.shift(),m=(_=x+u.shift())+u.shift(),I-P==5?(g=b+u.shift(),P++):g=b,W=!1):(y=g,x=m+u.shift(),b=y+u.shift(),_=x+u.shift(),g=b+u.shift(),I-P==5?(m=_+u.shift(),P++):m=_,W=!0),i(h,y,x,b,_,g,m),P+=4}else{if("o"==(k+"").charAt(0))throw console.log("Unknown operation: "+k,r),k;u.push(k)}}}s.x=g,s.y=m,s.nStems=l,s.haveWidth=c,s.width=p,s.open=d}return{shape:function(e,t,i){null==i&&(i={});var r=i.axs;e.fvar&&null==r&&(r=e.fvar[1][e._index][2]);var n=e.HVAR;r&&n&&(r=m(e,r));for(var a=[],o=0;o<t.length;o++){var h=t.codePointAt(o);h>65535&&o++,a.push(p(e,h))}var u=[];for(o=0;o<a.length;o++){var l=s(e,a,o),c=a[o],d=e.hmtx.aWidth[c]+l[2];if(n&&n[1][c])for(var f=n[1][c],y=0;y<n[0].length;y++)d+=g(n[0][y],r)*f[y];u.push({g:c,cl:o,dx:0,dy:0,ax:d,ay:0})}return u},shapeToPath:function(e,t,i){var r,n,s={cmds:[],crds:[]},a=0,o=0;i&&(r=i.clr,n=i.axs);for(var h=0;h<t.length;h++){for(var u=t[h],l=d(e,u.g,!1,n),c=l.crds,p=0;p<c.length;p+=2)s.crds.push(c[p]+a+u.dx),s.crds.push(c[p+1]+o+u.dy);r&&s.cmds.push(r);for(p=0;p<l.cmds.length;p++)s.cmds.push(l.cmds[p]);var f=s.cmds.length;r&&0!=f&&"X"!=s.cmds[f-1]&&s.cmds.push("X"),a+=u.ax,o+=u.ay}return{cmds:s.cmds,crds:s.crds}},codeToGlyph:p,glyphToPath:d,pathToSVG:function(e,t){var i=e.cmds,r=e.crds;function n(e){return parseFloat(e.toFixed(t))}null==t&&(t=5);for(var s=[],a=0,o={M:2,L:2,Q:4,C:6},h=0,u=0,l=0,c=0,p=0,d=0,f=0;f<i.length;f++){var g,m,y,x,v=i[f],b=o[v]?o[v]:0,_=[];if("L"==v)g=r[a]-h,m=r[a+1]-u,y=n(g+l),x=n(m+c),"Z"==i[f+1]&&r[a]==p&&r[a+1]==d?(y=g,x=m):0==y&&0==x||(0==y?_.push("v",x):0==x?_.push("h",y):_.push("l",y,x));else{_.push(v.toLowerCase());for(var w=0;w<b;w+=2)g=r[a+w]-h,m=r[a+w+1]-u,y=n(g+l),x=n(m+c),_.push(y,x)}0!=b&&(l+=g-y,c+=m-x);var C=_;for(w=0;w<C.length;w++)s.push(C[w]);0!=b&&(h=r[(a+=b)-2],u=r[a-1]),"M"==v&&(p=h,d=u),"Z"==v&&(h=p,u=d)}return function(e){for(var t=[],i=!1,r="",n=0;n<e.length;n++){var s=e[n],a="number"==typeof s;if(!a){if(s==r&&1==s.length&&"m"!=s)continue;r=s}i&&a&&s>=0&&t.push(" "),t.push(s),i=a}return t.join("")}(s)},SVGToPath:function(e){var t={cmds:[],crds:[]};return Bh.U.SVG.svgToPath(e,t),{cmds:t.cmds,crds:t.crds}},pathToContext:function(e,t){for(var i=0,r=e.cmds,n=e.crds,s=0;s<r.length;s++){var a=r[s];if("M"==a)t.moveTo(n[i],n[i+1]),i+=2;else if("L"==a)t.lineTo(n[i],n[i+1]),i+=2;else if("C"==a)t.bezierCurveTo(n[i],n[i+1],n[i+2],n[i+3],n[i+4],n[i+5]),i+=6;else if("Q"==a)t.quadraticCurveTo(n[i],n[i+1],n[i+2],n[i+3]),i+=4;else if("d"==a[0]){var u=window.UPNG,l=n[i],c=n[i+1],p=n[i+2],d=n[i+3],f=n[i+4],g=n[i+5],m=n[i+6],y=n[i+7];if(i+=8,null==u){t.moveTo(l,c),t.lineTo(p,d),t.lineTo(f,g),t.lineTo(m,y),t.closePath();continue}for(var v=p-l,b=d-c,_=m-l,w=y-c,C=atob(a.slice(22)),A=new Uint8Array(C.length),E=0;E<C.length;E++)A[E]=C.charCodeAt(E);for(var D=u.decode(A.buffer),S=D.width,F=D.height,T=new Uint8Array(u.toRGBA8(D)[0]),M=t.getTransform(),k=Math.sqrt(Math.abs(M.a*M.d-M.b*M.c))*Math.sqrt(_*_+w*w)/F;k<.5;){var I=x(T,S,F);T=I.buff,S=I.w,F=I.h,k*=2}null==o&&(o=document.createElement("canvas"),h=o.getContext("2d")),o.width==S&&o.height==F||(o.width=S,o.height=F),h.putImageData(new ImageData(new Uint8ClampedArray(T.buffer),S,F),0,0),t.save(),t.transform(v,b,_,w,l,c),t.scale(1/S,1/F),t.drawImage(o,0,0),t.restore()}else if("#"==a.charAt(0)||"r"==a.charAt(0))t.beginPath(),t.fillStyle=a;else if("O"==a.charAt(0)&&"OX"!=a){t.beginPath();var B=a.split("-");t.lineWidth=parseFloat(B[2]),t.lineCap=["butt","round","square"][parseFloat(B[3])],t.lineJoin=["miter","round","bevel"][parseFloat(B[4])],t.miterLimit=parseFloat(B[5]),t.lineDashOffset=parseFloat(B[6]),t.setLineDash(B[7].split(",").map(parseFloat)),t.strokeStyle=B[1]}else"Z"==a?t.closePath():"X"==a?t.fill():"OX"==a&&t.stroke()}},initHB:function(e,t){var i=function(e){var t=0;return 4294967168&e?4294965248&e?4294901760&e?4292870144&e||(t=4):t=3:t=2:t=1,t};fetch(e).then((function(e){return e.arrayBuffer()})).then((function(e){return WebAssembly.instantiate(e)})).then((function(e){console.log("HB ready");var r,n,s,a,o,h,u,l,c,p,d=e.instance.exports,f=d.memory;Bh.U.shapeHB=function(e,t,g){var m=e._data,y=e.name.postScriptName,x=g.ltr,v=g.fts,b=g.axs;if(e.fvar&&null==b&&(b=e.fvar[1][e._index][2]),r=new Uint8Array(f.buffer),n=new Uint32Array(f.buffer),s=new Int32Array(f.buffer),a=new Float32Array(f.buffer),o!=y&&(null!=h&&(d.hb_blob_destroy(h),d.free(u),d.hb_face_destroy(l),d.hb_font_destroy(c)),u=d.malloc(m.byteLength),r.set(m,u),h=d.hb_blob_create(u,m.byteLength,2,0,0),l=d.hb_face_create(h,e._index),c=d.hb_font_create(l),o=y),null!=window.TextEncoder){null==p&&(p=new window.TextEncoder("utf8"));var _=d.hb_buffer_create(),w=p.encode(t),C=w.length,A=d.malloc(C);r.set(w,A),d.hb_buffer_add_utf8(_,A,C,0,C),d.free(A);var E=Bh.B,D=0;if(v){D=d.malloc(16*v.length);for(var S=0;S<v.length;S++){var F=v[S],T=(I=D+16*S)>>>2;E.writeASCII(r,I,F[0].split("").reverse().join("")),n[T+1]=F[1],n[T+2]=F[2],n[T+3]=F[3]}}var M=0;if(b&&e.fvar){var k=e.fvar[0];for(M=d.malloc(8*b.length),S=0;S<b.length;S++){var I;T=(I=M+8*S)>>>2,E.writeASCII(r,I,k[S][0].split("").reverse().join("")),a[T+1]=b[S]}}b&&d.hb_font_set_variations(c,M,b.length),d.hb_buffer_set_direction(_,x?4:5),d.hb_buffer_guess_segment_properties(_),d.hb_shape(c,_,D,v?v.length:0);var B=function(e){for(var t=d.hb_buffer_get_length(e),i=[],r=d.hb_buffer_get_glyph_infos(e,0)>>>2,a=d.hb_buffer_get_glyph_positions(e,0)>>>2,o=0;o<t;++o){var h=r+5*o,u=a+5*o;i.push({g:n[h+0],cl:n[h+2],ax:s[u+0],ay:s[u+1],dx:s[u+2],dy:s[u+3]})}return i}(_);d.hb_buffer_destroy(_),v&&d.free(D),b&&d.free(M);var L=B.slice(0);x||L.reverse();var O=0,P=0;for(S=1;S<L.length;S++){for(var N=L[S],R=N.cl;;){var V=t.codePointAt(O),U=i(V);if(!(P+U<=R))break;P+=U,O+=V<=65535?1:2}N.cl=O}return B}alert("Your browser is too old. Please, update it.")},t()}))}}}();var Lh={exports:{}};!function(e){!function(t,i){e.exports=i()}(self,(()=>(()=>{var e={177:(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.BezierPath=void 0;const r=i(558),n=i(188);t.BezierPath=class{constructor(e){this.samples=[],this.segments=e;const t=e.map((e=>e.getTotalLength())),i=[0];for(let e=1;e<t.length;e++)i.push(i[e-1]+t[e-1]);this._totalLength=i[i.length-1]+t[t.length-1];const s=e.map((e=>Math.max(4,Math.ceil(e.getTotalLength()/r.BezierSegment.sampleSpacing())))),a=s.reduce(((e,t)=>e+t)),o=1/a/10,h=this._totalLength/a;this.samples.push({dist:0,pt:this.segments[0].A,tan:this.segments[0].tangentAtParameter(0),segIdx:0,t:0}),e.forEach(((e,t)=>{const r=s[t],a=(0,n.times)(r+1).map((e=>e/r)),u=a.map((t=>e.pointAtParameter(t)));let l;for(let t=0;t<4;t++){l=(0,n.times)(r).map((e=>Math.hypot(u[e+1].x-u[e].x,u[e+1].y-u[e].y)));const t=l.map((e=>e-h));let i=0;for(let r=1;r<a.length-1;r++)i+=t[r-1],a[r]-=o*i,u[r]=e.pointAtParameter(a[r])}let c=0;u.slice(1).forEach(((e,r)=>{c+=l[r],this.samples.push({dist:i[t]+c,pt:e,tan:this.segments[t].tangentAtParameter(a[r+1]),segIdx:t,t:a[r+1]})}))})),this._jumps=[],this.segmentStartEnds=[{start:0,end:0}];for(let e=1;e<this.samples.length;e++){const t=this.samples[e-1],i=this.samples[e];if(i.segIdx===t.segIdx?this.segmentStartEnds[this.segmentStartEnds.length-1].end=i.dist:this.segmentStartEnds[i.segIdx]={start:i.dist,end:i.dist},t.segIdx!==i.segIdx&&(this.segments[t.segIdx].D.x!==this.segments[i.segIdx].A.x||this.segments[t.segIdx].D.y!==this.segments[i.segIdx].A.y)){const r=(t.dist+i.dist)/2,n={dist:r-1e-8,pt:this.segments[t.segIdx].D,tan:this.segments[t.segIdx].tangentAtParameter(1),segIdx:t.segIdx,t:1},s={dist:r+1e-8,pt:this.segments[i.segIdx].A,tan:this.segments[i.segIdx].tangentAtParameter(0),segIdx:i.segIdx,t:0};this._jumps.push(r),this.samples.splice(e,0,n,s),e+=2}}}jumps(){return[...this._jumps]}getTotalLength(){return this._totalLength}findClosestSampleIdx(e){let t=0,i=this.samples.length-1;for(;t<i;){const r=Math.floor((t+i)/2);if(this.samples[r].dist>e)i=r-1;else{if(!(this.samples[r].dist<e))return r;t=r+1}}return Math.max(0,Math.min(this.samples.length-1,Math.floor((t+i)/2)))}getPointAtLength(e,t=!1){if(e<=0)return this.samples[0].pt;if(e>=this._totalLength)return this.samples[this.samples.length-1].pt;const i=this.findClosestSampleIdx(e),r=this.samples[i].dist<e?Math.min(i+1,this.samples.length-1):Math.max(0,i-1),n=Math.abs(this.samples[r].dist-this.samples[i].dist)<1e-6?0:(e-this.samples[i].dist)/(this.samples[r].dist-this.samples[i].dist);if(t||this.samples[i].segIdx>this.samples[r].segIdx)return{x:(1-n)*this.samples[i].pt.x+n*this.samples[r].pt.x,y:(1-n)*this.samples[i].pt.y+n*this.samples[r].pt.y};if(this.samples[i].segIdx!==this.samples[r].segIdx){if(n<.5){const e=this.segments[this.samples[i].segIdx],t=2*n,r=(1-t)*this.samples[i].t+t;return e.pointAtParameter(r)}{const e=this.segments[this.samples[r].segIdx],t=2*(n-.5)*this.samples[r].t;return e.pointAtParameter(t)}}{const e=this.segments[this.samples[i].segIdx],t=(1-n)*this.samples[i].t+n*this.samples[r].t;return e.pointAtParameter(t)}}getAngleAtLength(e,t=!1){const i=this.getTangentAtLength(e,t);return Math.atan2(i.y,i.x)}getTangentAtLength(e,t=!1){if(e<=0)return this.samples[0].tan;if(e>=this._totalLength)return this.samples[this.samples.length-1].tan;const i=this.findClosestSampleIdx(e),r=this.samples[i].dist<e?Math.min(i+1,this.samples.length-1):Math.max(0,i-1),n=(e-this.samples[i].dist)/(this.samples[r].dist-this.samples[i].dist);if(t||this.samples[i].segIdx>this.samples[r].segIdx){let e=(1-n)*this.samples[i].tan.x+n*this.samples[r].tan.x,t=(1-n)*this.samples[i].tan.y+n*this.samples[r].tan.y;const s=Math.max(Math.hypot(e,t),1e-4);return e/=s,t/=s,{x:e,y:t}}if(this.samples[i].segIdx!==this.samples[r].segIdx){if(n<.5){const e=this.segments[this.samples[i].segIdx],t=2*n,r=(1-t)*this.samples[i].t+t;return e.tangentAtParameter(r)}{const e=this.segments[this.samples[r].segIdx],t=2*(n-.5)*this.samples[r].t;return e.tangentAtParameter(t)}}{const e=this.segments[this.samples[i].segIdx],t=(1-n)*this.samples[i].t+n*this.samples[r].t;return e.tangentAtParameter(t)}}}},558:(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.BezierSegment=void 0;const r=i(188);class n{constructor(e,t,i,r){this._totalLength=void 0,this.A=e,this.B=t,this.C=i,this.D=r}static sampleSpacing(){return 2}tangentAtParameter(e){const t=Math.max(0,Math.min(1,e));if(0===t||1===t){let e,i;0===t?this.A.x===this.B.x&&this.A.y===this.B.y?(e=this.C.x-this.A.x,i=this.C.y-this.A.y):(e=this.B.x-this.A.x,i=this.B.y-this.A.y):this.D.x===this.C.x&&this.D.y===this.C.y?(e=this.D.x-this.B.x,i=this.D.y-this.B.y):(e=this.D.x-this.C.x,i=this.D.y-this.C.y);const r=Math.hypot(e,i);return Math.abs(r)>1e-4&&(e/=r,i/=r),{x:e,y:i}}const i=1-t;let r=3*this.D.x*Math.pow(t,2)-3*this.C.x*Math.pow(t,2)+6*this.C.x*i*t-6*this.B.x*i*t+3*this.B.x*Math.pow(i,2)-3*this.A.x*Math.pow(i,2),n=3*this.D.y*Math.pow(t,2)-3*this.C.y*Math.pow(t,2)+6*this.C.y*i*t-6*this.B.y*i*t+3*this.B.y*Math.pow(i,2)-3*this.A.y*Math.pow(i,2);const s=Math.hypot(r,n);return Math.abs(s)>1e-4&&(r/=s,n/=s),{x:r,y:n}}isLinear(){return this.A.x===this.B.x&&this.A.y===this.B.y&&this.C.x===this.D.x&&this.C.y===this.D.y}pointAtParameter(e){const t=Math.max(0,Math.min(1,e));return{x:Math.pow(1-t,3)*this.A.x+3*Math.pow(1-t,2)*t*this.B.x+3*(1-t)*Math.pow(t,2)*this.C.x+Math.pow(t,3)*this.D.x,y:Math.pow(1-t,3)*this.A.y+3*Math.pow(1-t,2)*t*this.B.y+3*(1-t)*Math.pow(t,2)*this.C.y+Math.pow(t,3)*this.D.y}}getTotalLength(){if(void 0===this._totalLength)if(this.isLinear())this._totalLength=Math.hypot(this.D.x-this.A.x,this.D.y-this.A.y);else{const e=Math.max(10,Math.ceil((Math.hypot(this.B.x-this.A.x,this.B.y-this.A.y)+Math.hypot(this.C.x-this.B.x,this.C.y-this.B.y)+Math.hypot(this.D.x-this.C.x,this.D.y-this.C.y))/n.sampleSpacing())),t=(0,r.times)(e).map((t=>this.pointAtParameter(t/(e-1))));let i=0;for(let e=1;e<t.length;e++)i+=Math.hypot(t[e].x-t[e-1].x,t[e].y-t[e-1].y);this._totalLength=i}return this._totalLength}}t.BezierSegment=n},729:(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.createFromCommands=t.create=t.createFromElement=t.createFromCircle=t.createFromLine=t.createFromPath=void 0;const r=i(821),n=i(558),s={M:["x","y"],m:["dx","dy"],H:["x"],h:["dx"],V:["y"],v:["dy"],L:["x","y"],l:["dx","dy"],Z:[],C:["x1","y1","x2","y2","x","y"],c:["dx1","dy1","dx2","dy2","dx","dy"],S:["x2","y2","x","y"],s:["dx2","dy2","dx","dy"],Q:["x1","y1","x","y"],q:["dx1","dy1","dx","dy"],T:["x","y"],t:["dx","dy"],A:["rx","ry","rotation","large-arc","sweep","x","y"],a:["rx","ry","rotation","large-arc","sweep","dx","dy"]};t.createFromPath=e=>{const t=function(e){const t=e.replace(/[\n\r]/g,"").replace(/-/g," -").replace(/(\d*\.)(\d+)(?=\.)/g,"$1$2 ").replace(/(\d)([A-Za-z])/g,"$1 $2").replace(/([A-Za-z])(\d)/g,"$1 $2").trim().split(/\s*,|\s+/),i=[];let r="",n={};for(;t.length>0;){let e=t.shift();s.hasOwnProperty(e)?r=e:t.unshift(e),n={type:r},s[r].forEach((i=>{e=t.shift(),n[i]=parseFloat(e)})),"M"===r?r="L":"m"===r&&(r="l"),i.push(n)}return i}(e.getAttribute("d"));if(t.length<2)throw new Error(`Path doesn't have enough commands: ${JSON.stringify(t)}`);if("M"!==t[0].type)throw new Error(`Path starts with ${t[0].type} instead of M!`);let i={x:t[0].x,y:t[0].y};t.shift();const a=[];for(;t.length>0;){const e=t.shift();if("C"===e.type)a.push(new n.BezierSegment(i,{x:e.x1,y:e.y1},{x:e.x2,y:e.y2},{x:e.x,y:e.y})),i={x:e.x,y:e.y};else if("L"===e.type)a.push(new n.BezierSegment(i,i,{x:e.x,y:e.y},{x:e.x,y:e.y})),i={x:e.x,y:e.y};else if("H"===e.type)a.push(new n.BezierSegment(i,i,{x:e.x,y:i.y},{x:e.x,y:i.y})),i={x:e.x,y:i.y};else if("V"===e.type)a.push(new n.BezierSegment(i,i,{x:i.x,y:e.y},{x:i.x,y:e.y})),i={x:i.x,y:e.y};else if("Z"!==e.type)throw new Error(`Unsupported path command ${e.type}; use only H, V, M, L, C, Z!`)}return new r.BezierPath(a)},t.createFromLine=e=>{const[t,i,s,a]=["x1","x2","y1","y2"].map((t=>parseFloat(e.getAttribute(t)||"0")));return new r.BezierPath([new n.BezierSegment({x:t,y:s},{x:t,y:s},{x:i,y:a},{x:i,y:a})])},t.createFromCircle=e=>{const[t,i,s]=["cx","cy","r"].map((t=>parseFloat(e.getAttribute(t)||"0"))),a=1.3;return new r.BezierPath([new n.BezierSegment({x:t-s,y:i},{x:t-s,y:i-a*s},{x:t+s,y:i-a*s},{x:t+s,y:i}),new n.BezierSegment({x:t+s,y:i},{x:t+s,y:i+a*s},{x:t-s,y:i+a*s},{x:t-s,y:i})])},t.createFromElement=e=>{const i=e.tagName.toLowerCase();if("path"===i)return(0,t.createFromPath)(e);if("line"===i)return(0,t.createFromLine)(e);if("circle"===i)return(0,t.createFromCircle)(e);throw new Error(`Unsupported SVG tag: ${i}`)},t.create=e=>{const t=[];for(let i=1;i<e.length;i++){const r=e[i-1],s=e[i];t.push(new n.BezierSegment(r.pt,r.right||r.pt,s.left||s.pt,s.pt))}return new r.BezierPath(t)},t.createFromCommands=e=>{const t=e.slice();if(t.length<2)throw new Error(`Path doesn't have enough commands: ${JSON.stringify(t)}`);if("M"!==t[0].type)throw new Error(`Path starts with ${t[0].type} instead of M!`);let i={x:t[0].x,y:t[0].y},s=Object.assign({},i);const a=[];for(;t.length>0;){const e=t.shift();if("M"===e.type)s={x:e.x,y:e.y},i=s;else if("C"===e.type)a.push(new n.BezierSegment(i,{x:e.x1,y:e.y1},{x:e.x2,y:e.y2},{x:e.x,y:e.y})),i={x:e.x,y:e.y};else if("L"===e.type)e.x===i.x&&e.y===i.y||a.push(new n.BezierSegment(i,i,{x:e.x,y:e.y},{x:e.x,y:e.y})),i={x:e.x,y:e.y};else if("H"===e.type)e.x!==i.x&&a.push(new n.BezierSegment(i,i,{x:e.x,y:i.y},{x:e.x,y:i.y})),i={x:e.x,y:i.y};else if("V"===e.type)e.y!==i.y&&a.push(new n.BezierSegment(i,i,{x:i.x,y:e.y},{x:i.x,y:e.y})),i={x:i.x,y:e.y};else if("Q"===e.type)a.push(new n.BezierSegment(i,{x:i.x+2/3*(e.x1-i.x),y:i.y+2/3*(e.y1-i.y)},{x:e.x+2/3*(e.x1-e.x),y:e.y+2/3*(e.y1-e.y)},{x:e.x,y:e.y})),i={x:e.x,y:e.y};else{if("Z"!==e.type)throw new Error(`Unsupported path command ${e.type}; use only H, V, M, L, C, Z!`);Math.hypot(i.x-s.x,i.y-s.y)>0&&a.push(new n.BezierSegment(i,i,s,s))}}return new r.BezierPath(a)}},821:function(e,t,i){var r=this&&this.__createBinding||(Object.create?function(e,t,i,r){void 0===r&&(r=i);var n=Object.getOwnPropertyDescriptor(t,i);n&&!("get"in n?!t.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return t[i]}}),Object.defineProperty(e,r,n)}:function(e,t,i,r){void 0===r&&(r=i),e[r]=t[i]}),n=this&&this.__exportStar||function(e,t){for(var i in e)"default"===i||Object.prototype.hasOwnProperty.call(t,i)||r(t,e,i)};Object.defineProperty(t,"__esModule",{value:!0}),n(i(177),t),n(i(558),t),n(i(729),t),n(i(856),t)},856:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0})},188:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.times=void 0,t.times=function(e){const t=[];for(let i=0;i<e;i++)t.push(i);return t}}},t={};return function i(r){var n=t[r];if(void 0!==n)return n.exports;var s=t[r]={exports:{}};return e[r].call(s.exports,s,s.exports,i),s.exports}(821)})()))}(Lh);var Oh=Lh.exports;const Ph={M:2,L:2,C:6,Q:4},Nh=["ttf","otf","woff"],Rh=new RegExp(`\\.(${Nh.join("|")})`,"i"),Vh=new RegExp(`([^/]+)(\\.(?:${Nh.join("|")}))`,"i"),Uh="Sorry, only TTF, OTF and WOFF files are supported.",zh=["weight","stretch","style"];class Gh{constructor(e,t,i,r,n){if(!(t instanceof FontFace))throw Error("FontFace is required");this._pInst=e,this.name=i,this.path=r,this.data=n,this.face=t}static hasGlyphData(e){let{font:t}=e;return"object"==typeof t&&void 0!==t.data}fontBounds(e,t,i,r,n,s){({width:r,height:n,options:s}=this._parseArgs(r,n,s));let a=s?.graphics?._renderer||this._pInst._renderer;if(!a)throw Error("p5 or graphics required for fontBounds()");return a.fontBounds(e,t,i,r,n)}textBounds(e,t,i,r,n,s){({width:r,height:n,options:s}=this._parseArgs(r,n,s));let a=s?.graphics?._renderer||this._pInst._renderer;if(!a)throw Error("p5 or graphics required for fontBounds()");return a.textBounds(e,t,i,r,n)}textToPaths(e,t,i,r,n,s){if(({width:r,height:n,options:s}=this._parseArgs(r,n,s)),!this.data)throw Error('No font data available for "'+this.name+'"\nTry downloading a local copy of the font file');return this._lineateAndPathify(e,t,i,r,n,s).map((e=>e.glyphs)).flat().map((e=>e.path.commands)).flat()}textToPoints(e,t,i,r,n,s){return this.textToContours(e,t,i,r,n,s).reduce(((e,t)=>(e.push(...t),e)),[])}textToContours(e,t=0,i=0,r,n,s){({width:r,height:n,options:s}=this._parseArgs(r,n,s));const a=this.textToPaths(e,t,i,r,n,s),o=[];for(const e of a)"M"===e[0]&&o.push([]),o[o.length-1].push(e);return o.map((e=>function(e,t,i){const r=(e,t)=>{if("object"!=typeof e)e=t;else for(const i in t)void 0===e[i]&&(e[i]=t[i]);return e},n=(e,t)=>{const i=e.length;return e[t<0?t%i+i:t%i]},s=(e,t)=>{t=t||0;let i=0;for(let r=e.length-1;e.length>3&&r>=0;--r)a(n(e,r-1),n(e,r),n(e,r+1),t)&&(e.splice(r%e.length,1),i++);return i},a=(e,t,i,r)=>{if(!r)return 0===o(e,t,i);void 0===a.tmpPoint1&&(a.tmpPoint1=[],a.tmpPoint2=[]);const n=a.tmpPoint1,s=a.tmpPoint2;n.x=t.x-e.x,n.y=t.y-e.y,s.x=i.x-t.x,s.y=i.y-t.y;const h=n.x*s.x+n.y*s.y,u=Math.sqrt(n.x*n.x+n.y*n.y),l=Math.sqrt(s.x*s.x+s.y*s.y);return Math.acos(h/(u*l))<r},o=(e,t,i)=>(t[0]-e[0])*(i[1]-e[1])-(i[0]-e[0])*(t[1]-e[1]),h=Oh.createFromCommands(Wh(e));let u=r(t,{sampleFactor:.1,simplifyThreshold:0});const l=Math.max(1,Math.ceil(h.getTotalLength()*u.sampleFactor));let c=[];const p=i._pInst.angleMode(),d=i._pInst.DEGREES;for(let e=0;e<l;e++){const t=h.getTotalLength()*(1===l?0:e/(l-1));c.push({...h.getPointAtLength(t),get angle(){const e=h.getAngleAtLength(t);return p===d?180*e/Math.PI:e},get alpha(){return this.angle}})}u.simplifyThreshold&&s(c,u.simplifyThreshold);return c}(e,s,this)))}textToModel(e,t,i,r,n,s){({width:r,height:n,options:s}=this._parseArgs(r,n,s));const a=s?.extrude||0,o=this.textToContours(e,t,i,r,n,s),h=this._pInst.buildGeometry((()=>{if(0===a){const e=this._pInst._renderer._validateFaces;this._pInst._renderer._validateFaces=!0,this._pInst.beginShape(),this._pInst.normal(0,0,1);for(const e of o){this._pInst.beginContour();for(const{x:t,y:i}of e)this._pInst.vertex(t,i);this._pInst.endContour(this._pInst.CLOSE)}this._pInst.endShape(),this._pInst._renderer._validateFaces=e}else{const e=this._pInst._renderer._validateFaces;this._pInst._renderer._validateFaces=!0;for(const e of[1,-1]){this._pInst.beginShape();for(const t of o){this._pInst.beginContour();for(const{x:i,y:r}of t)this._pInst.vertex(i,r,e*a*.5);this._pInst.endContour(this._pInst.CLOSE)}this._pInst.endShape()}this._pInst._renderer._validateFaces=e;for(const e of o){this._pInst.beginShape(this._pInst.QUAD_STRIP);for(const t of e)for(const e of[-1,1])this._pInst.vertex(t.x,t.y,e*a*.5);this._pInst.endShape()}}}));if(0!==a){h.computeNormals();for(const e of h.faces)if(e.every((e=>h.vertices[e].z<=.5*-a+.1))){for(const t of e)h.vertexNormals[t].set(0,0,-1);e.reverse()}}return h}variations(){let e={};if(this.data){let t=this.face?.axes;t&&t.forEach((t=>{e[t.tag]=t.value}))}return zh.forEach((t=>{let i=this.face[t];"normal"!==i&&(e[t]=e[t]||i)})),e}metadata(){let e=this.data?.name||{};for(let t in this.face)/^load/.test(t)||(e[t]=e[t]||this.face[t]);return e}static async list(e=!1){if(e){console.log("There are",document.fonts.size,"font-faces\n");let e=0;for(let t of document.fonts.values()){console.log("FontFace: {");for(let e in t)console.log(" "+e+": "+t[e]);console.log("}\n"),"loaded"===t.status&&e++}console.log(e+" loaded")}return await Array.from(document.fonts)}_verticalAlign(e){const{sCapHeight:t}=this.data?.["OS/2"]||{},{unitsPerEm:i=1e3}=this.data?.head||{},{ascender:r=0,descender:n=0}=this.data?.hhea||{};return((t||r+n)/2-r/2)*e/i}_lineateAndPathify(e,t,i,r,n,s={}){let a=s?.graphics?._renderer||this._pInst._renderer,o=a.drawingContext.textBaseline,{lines:h,bounds:u}=a._computeBounds(so,e,t,i,r,n,{ignoreRectMode:!0,...s});h=this._position(a,h,u,r,n);let l=this.data?.head?.unitsPerEm||1e3,c=a.states.textSize/l;const p=this._currentAxes(a);let d=h.map((e=>this._lineToGlyphs(e,{scale:c,axs:p})));return a.drawingContext.textBaseline=o,d}_currentAxes(e){let t;if((this.data?.fvar?.length??0)>0){t=this.data.fvar[0].map((([t,i,r,n,s,a])=>{if(!e)return r;if("wght"===t)return e.states.fontWeight;if("wdth"===t)return 100;if(e.textCanvas().style.fontVariationSettings){const i=new RegExp(`\\b${t}s+(d+)`).exec(e.textCanvas().style.fontVariationSettings);return i?parseInt(i[1]):r}return r}))}return t}_textToPathPoints(e,t,i,r,n,s){({width:r,height:n,options:s}=this._parseArgs(r,n,s));let a=this.textToPaths(e,t,i,r,n,s);const o=(e,t,i,r)=>{if(fn.dist(t.x,t.y,i.x,i.y)>r){let n={x:(t.x+i.x)/2,y:(t.y+i.y)/2};e.push(n),o(e,t,n,r),o(e,n,i,r)}};let h=[],{textSize:u}=this._pInst._renderer.states,l=u/this.data.head.unitsPerEm*500;for(let e=0;e<a.length;e++){let{type:t,data:i}=a[e];if("Z"!==t){let e={x:i[i.length-2],y:i[i.length-1]};"L"===t&&h.length&&!s?.nodivide>0&&o(h,h[h.length-1],e,l),h.push(e)}}return h}_parseArgs(e,t,i={}){return"object"==typeof e?(i=e,e=t=void 0):"object"==typeof t&&(i=t,t=void 0),{width:e,height:t,options:i}}_position(e,t,i,r,n){let{textAlign:s,textLeading:a}=e.states,o=this._measureTextDefault(e,"X").fontBoundingBoxAscent;return t.map(((t,h)=>{let u=i.x,l=i.y+h*a+o,c=e._fontWidthSingle(t);if(s===D?u+=(i.w-c)/2:s===A&&(u+=i.w-c),void 0!==r)switch(e.states.rectMode){case D:u-=r/2,l-=n/2;break;case C:u-=r,l-=n}return{text:t,x:u,y:l}}))}_lineToGlyphs(e,{scale:t=1,axs:i}={}){if(!this.data)throw Error('No font data available for "'+this.name+'"\nTry downloading a local copy of the font file');let r=Bh.U.shape(this.data,e.text,{axs:i});return e.glyphShapes=r,e.glyphs=this._shapeToPaths(r,e,{scale:t,axs:i}),e}_positionGlyphs(e,t){let i=t?.graphics?._renderer||this._pInst._renderer;const r=this._currentAxes(i),n=Bh.U.shape(this.data,e,{axs:r}),s=[];let a=0;for(const e of n)s.push({x:a,index:e.g,shape:e}),a+=e.ax;return s}_singleShapeToPath(e,{scale:t=1,x:i=0,y:r=0,lineX:n=0,lineY:s=0,axs:a}={}){let o=this.data,h=0,{g:u,ax:l,ay:c,dx:p,dy:d}=e,{crds:f,cmds:g}=Bh.U.glyphToPath(o,u,!0,a),m={path:{commands:[]}};for(let e=0;e<g.length;e++){let a=g[e],o=[a];if(a in Ph){let e=Ph[a];for(let a=0;a<e;a+=2){let e=n+(f[a+h]+i+p)*t,u=s+(f[a+h+1]+r+d)*-t;o.push(e),o.push(u)}h+=e}m.path.commands.push(o)}return{glyph:m,ax:l,ay:c}}_shapeToPaths(e,t,{scale:i=1,axs:r}={}){let n=0,s=0,a=[];if(e.length!==t.text.length)throw Error("Invalid shape data");for(let o=0;o<e.length;o++){const{glyph:h,ax:u,ay:l}=this._singleShapeToPath(e[o],{scale:i,x:n,y:s,lineX:t.x,lineY:t.y,axs:r});a.push(h),n+=u,s+=l}return a}_measureTextDefault(e,t){let{textAlign:i,textBaseline:r}=e.states,n=e.textDrawingContext();n.textAlign="left",n.textBaseline="alphabetic";let s=n.measureText(t);return n.textAlign=i,n.textBaseline=r,s}drawPaths(e,t,i){e.strokeStyle=i?.stroke||e.strokeStyle,e.fillStyle=i?.fill||e.fillStyle,e.beginPath(),t.forEach((([t,...i])=>{"M"===t?e.moveTo(...i):"L"===t?e.lineTo(...i):"C"===t?e.bezierCurveTo(...i):"Q"===t?e.quadraticCurveTo(...i):"Z"===t&&e.closePath()})),i?.fill&&e.fill(),i?.stroke&&e.stroke()}_pathsToCommands(e,t){let i=[];for(let r=0;r<e.length;r++){let n=e[r],{x:s,y:a,path:o}=n,{crds:h,cmds:u}=o;for(let e=0,r=0;r<u.length;r++){let n=u[r],o={type:n,data:[]};if("M"===n||"L"===n)o.data.push(s+h[e]*t,a+h[e+1]*-t),e+=2;else if("C"===n){for(let i=0;i<6;i+=2)o.data.push(s+h[e+i]*t,a+h[e+i+1]*-t);e+=6}else if("Q"===n){for(let i=0;i<4;i+=2)o.data.push(s+h[e+i]*t,a+h[e+i+1]*-t);e+=4}i.push(o)}}return i}}async function jh(e,t,i,r,n){let s=function(e,t,i,r){e=function(e){/^[A-Za-z][A-Za-z0-9_-]*$/.test(e)||(e="'"+String(e).replace(/'/g,"\\'")+"'");return e}(e);let n=r?._compressedData??r?._data;if(!n){if(!Rh.test(t))throw Error(Uh);t.startsWith("url(")||(t="url("+t+")"),n=t}if((r?.fvar?.length??0)>0){i=i||{};for(const[e,t,n,s,a,o]of r.fvar[0])"wght"===e?i.weight=`${t} ${s}`:"wdth"===e&&(i.stretch=`${t}% ${s}%`)}let s=new FontFace(e,n,i);if("error"===s.status)throw Error('Failed to create FontFace for "'+e+'"');return s}(t,i,r,n);return"loaded"!==s.status&&await s.load(),document.fonts.add(s),await document.fonts.ready,new Gh(e,s,t,i,n)}function $h(e){return(e.startsWith('"')||e.startsWith("'"))&&e.at(0)===e.at(-1)?e.slice(1,-1).replace(/\/(['"])/g,"$1"):e}function qh(...e){let t,i,r,n,s=e.shift();"string"==typeof s&&0!==s.length||p5._friendlyError(Uh,"p5.loadFont"),"string"==typeof e[0]&&(t=e.shift());for(let t=0;t<e.length;t++){const s=e[t];"function"==typeof s?i?r=s:i=s:"object"==typeof s&&(n=s)}return{path:s,name:t,success:i,error:r,options:n}}function Hh(e,t){e.Font=Gh,t.parseFontData=async function(e){let i=e instanceof Uint8Array?e:await t.loadBytes(e);if(!i)throw Error("Failed to load font data");let r=Bh.parse(i);if(0===r.length||void 0===r[0].cmap)throw Error("parsing font data");return r[0]},t.loadFont=async function(...e){let i,{path:r,name:n,success:s,error:a,options:{sets:o,...h}={}}=qh(...e),u=r.includes("@font-face");if(!u){const e=await fetch(r,{method:"HEAD"}),t=e.headers.get("content-type")?.startsWith("text/css");t&&(u=!0,r=await fetch(r).then((e=>e.text())))}if(u){const e=new CSSStyleSheet;await e.replace(r);const i=[];for(const r of e.cssRules)if(r instanceof CSSFontFaceRule){const e=r.style;let n=$h(e.getPropertyValue("font-family"));const s=e.getPropertyValue("src"),a={...h||{}};for(const t of e){if("font-family"===t||"src"===t)continue;const i=t.replace(/^font-/,"").split("-").map(((e,t)=>0===t?e:`${e[0].toUpperCase()}${e.slice(1)}`)).join("");a[i]=e.getPropertyValue(t)}i.push({name:n,src:s,fontDescriptors:a,loadWithData:async()=>{let e;try{const i=/url\(([^\)]+)\)/.exec(s);if(i){let r=i[1];/^['"]/.exec(r)&&r.at(0)===r.at(-1)&&(r=r.slice(1,-1)),e=await t.parseFontData(r)}}catch(e){}return jh(this,n,s,a,e)},loadWithoutData:()=>jh(this,n,s,a)})}o=o||["latin"];const n=(o instanceof Array?o:[o]).map((e=>e.toLowerCase())),s=fo.filter((e=>n.some((t=>e.category.includes(t)&&e.category.includes("ext")===t.includes("ext"))))),a=new Set(po.parse(s.map((e=>`U+${e.hexrange[0]}-${e.hexrange[1]}`))));let u,l=0,c=0;for(const e of i){if(!e.fontDescriptors.unicodeRange)continue;const t=[...new Set(po.parse(e.fontDescriptors.unicodeRange.split(/,\s*/g))).values()].filter((e=>a.has(e))).length,i={style:"normal",weight:400,...h},r=Object.keys(e.fontDescriptors).filter((t=>e.fontDescriptors[t]===i[t])).length;(r>c||r===c&&t>=l)&&(c=r,l=t,u=e)}const p=u||i.at(-1);for(const e of i)e!==p&&e.loadWithoutData();return p?.loadWithData()}try{const e=await t.parseFontData(r);n=n||function(e,t){let i,r=e?.name;if(r){if(r.fullName)return r.fullName;r.familyName&&(i=r.familyName)}if(!i){let e=Vh.exec(t);i=e&&e.length>=3?e[1]:t}return i.includes(" ")&&(i=i.replace(/ /g,"_")),i}(e,r),i=await jh(this,n,r,h,e)}catch(e){let t=n||r.substring(r.lastIndexOf("/")+1).replace(/\.[^/.]+$/,"");console.warn(`WARN: No glyph data for '${t}', retrying as FontFace`);try{i=await jh(this,t,r,h)}catch(e){if(a)return a(e);throw e}}return s?s(i):i}}const Wh=e=>e.map((e=>{const t=e[0];switch(t){case"Z":return{type:t};case"M":case"L":{const[,i,r]=e;return{type:t,x:i,y:r}}case"Q":{const[,i,r,n,s]=e;return{type:t,x1:i,y1:r,x:n,y:s}}case"C":{const[,i,r,n,s,a,o]=e;return{type:t,x1:i,y1:r,x2:n,y2:s,x:a,y:o}}default:throw new Error(`Unexpected path command: ${t}`)}}));void 0!==p5&&Hh(p5,p5.prototype);const Xh={OPERATION:"operation",LITERAL:"literal",VARIABLE:"variable",CONSTANT:"constant",STRUCT:"struct",PHI:"phi",STATEMENT:"statement",ASSIGNMENT:"assignment"},Yh=Object.fromEntries(Object.entries(Xh).map((([e,t])=>[t,e]))),Zh={[Xh.OPERATION]:["opCode","dependsOn","dimension","baseType"],[Xh.LITERAL]:["value","dimension","baseType"],[Xh.VARIABLE]:["identifier","dimension","baseType"],[Xh.CONSTANT]:["value","dimension","baseType"],[Xh.STRUCT]:[""],[Xh.PHI]:["dependsOn","phiBlocks","dimension","baseType"],[Xh.STATEMENT]:["statementType"],[Xh.ASSIGNMENT]:["dependsOn"]},Kh="discard",Jh="break",Qh="expression",eu="empty",tu="float",iu="int",ru="bool",nu="mat",su="defer",au="sampler2D",ou={[tu]:3,[iu]:2,[ru]:1,[nu]:0,[su]:-1,[au]:-10},hu={float1:{fnName:"float",baseType:tu,dimension:1,priority:3},float2:{fnName:"vec2",baseType:tu,dimension:2,priority:3},float3:{fnName:"vec3",baseType:tu,dimension:3,priority:3},float4:{fnName:"vec4",baseType:tu,dimension:4,priority:3},int1:{fnName:"int",baseType:iu,dimension:1,priority:2},int2:{fnName:"ivec2",baseType:iu,dimension:2,priority:2},int3:{fnName:"ivec3",baseType:iu,dimension:3,priority:2},int4:{fnName:"ivec4",baseType:iu,dimension:4,priority:2},bool1:{fnName:"bool",baseType:ru,dimension:1,priority:1},bool2:{fnName:"bvec2",baseType:ru,dimension:2,priority:1},bool3:{fnName:"bvec3",baseType:ru,dimension:3,priority:1},bool4:{fnName:"bvec4",baseType:ru,dimension:4,priority:1},mat2:{fnName:"mat2x2",baseType:nu,dimension:2,priority:0},mat3:{fnName:"mat3x3",baseType:nu,dimension:3,priority:0},mat4:{fnName:"mat4x4",baseType:nu,dimension:4,priority:0},defer:{fnName:null,baseType:su,dimension:null,priority:-1},sampler2D:{fnName:"sampler2D",baseType:au,dimension:1,priority:-10}},uu=function(e){let t=void 0===e.type?e:e.type;const i={name:e.name,properties:[],typeName:t.typeName};for(const e of t.properties){const t=pu[e.type.typeName];i.properties.push({name:e.name,dataType:t})}return i};function lu(e){return!function(e){if(Object.keys(hu).includes(e))return!0;return!!{float:!0,vec2:!0,vec3:!0,vec4:!0,int:!0,ivec2:!0,ivec3:!0,ivec4:!0,bool:!0,bvec2:!0,bvec3:!0,bvec4:!0,mat2:!0,mat3:!0,mat4:!0,sampler2D:!0}[e]}(e)}const cu={FLOAT:{baseType:tu,dimension:null,priority:3},INT:{baseType:iu,dimension:null,priority:2},BOOL:{baseType:ru,dimension:null,priority:1}};const pu=Object.fromEntries(Object.values(hu).filter((e=>null!==e.fnName)).map((e=>[e.fnName,e]))),du={ADD:0,SUBTRACT:1,MULTIPLY:2,DIVIDE:3,MODULO:4,EQUAL:5,NOT_EQUAL:6,GREATER_THAN:7,GREATER_EQUAL:8,LESS_THAN:9,LESS_EQUAL:10,LOGICAL_AND:11,LOGICAL_OR:12,MEMBER_ACCESS:13},fu={LOGICAL_NOT:100,NEGATE:101,PLUS:102,SWIZZLE:103},gu={FUNCTION_CALL:200,CONSTRUCTOR:201},mu=[{arity:"unary",name:"not",symbol:"!",opCode:fu.LOGICAL_NOT},{arity:"unary",name:"neg",symbol:"-",opCode:fu.NEGATE},{arity:"unary",name:"plus",symbol:"+",opCode:fu.PLUS},{arity:"binary",name:"add",symbol:"+",opCode:du.ADD},{arity:"binary",name:"sub",symbol:"-",opCode:du.SUBTRACT},{arity:"binary",name:"mult",symbol:"*",opCode:du.MULTIPLY},{arity:"binary",name:"div",symbol:"/",opCode:du.DIVIDE},{arity:"binary",name:"mod",symbol:"%",opCode:du.MODULO},{arity:"binary",name:"equalTo",symbol:"==",opCode:du.EQUAL},{arity:"binary",name:"notEqual",symbol:"!=",opCode:du.NOT_EQUAL},{arity:"binary",name:"greaterThan",symbol:">",opCode:du.GREATER_THAN},{arity:"binary",name:"greaterEqual",symbol:">=",opCode:du.GREATER_EQUAL},{arity:"binary",name:"lessThan",symbol:"<",opCode:du.LESS_THAN},{arity:"binary",name:"lessEqual",symbol:"<=",opCode:du.LESS_EQUAL},{arity:"binary",name:"and",symbol:"&&",opCode:du.LOGICAL_AND},{arity:"binary",name:"or",symbol:"||",opCode:du.LOGICAL_OR}],yu={},xu={};for(const{symbol:e,opCode:t,name:i,arity:r}of mu)yu[t]=e,"unary"===r&&(xu[e]=i);const vu={GLOBAL:"global",FUNCTION:"function",BRANCH:"branch",IF_COND:"if_cond",IF_BODY:"if_body",ELSE_COND:"else_cond",SCOPE_START:"scope_start",SCOPE_END:"scope_end",FOR:"for",MERGE:"merge",DEFAULT:"default"};function bu(e){throw new Error(`[p5.strands internal error]: ${e}`)}function _u(e,t){throw new Error(`[p5.strands ${e}]: ${t}`)}function wu(){return{nextID:0,cache:new Map,nodeTypes:[],baseTypes:[],dimensions:[],opCodes:[],values:[],identifiers:[],phiBlocks:[],dependsOn:[],usedBy:[],statementTypes:[],swizzles:[]}}function Cu(e,t){const i=function(e,t){const i=e.nextID++;e.nodeTypes[i]=t.nodeType,e.opCodes[i]=t.opCode,e.values[i]=t.value,e.identifiers[i]=t.identifier,e.dependsOn[i]=t.dependsOn.slice(),e.usedBy[i]=t.usedBy,e.phiBlocks[i]=t.phiBlocks.slice(),e.baseTypes[i]=t.baseType,e.dimensions[i]=t.dimension,e.statementTypes[i]=t.statementType,e.swizzles[i]=t.swizzle;for(const r of t.dependsOn)Array.isArray(e.usedBy[r])||(e.usedBy[r]=[]),e.usedBy[r].push(i);return i}(e,t);return i}function Au(e={}){const t={nodeType:e.nodeType??null,baseType:e.baseType??null,dimension:e.dimension??null,opCode:e.opCode??null,value:e.value??null,identifier:e.identifier??null,statementType:e.statementType??null,swizzle:e.swizzle??null,dependsOn:Array.isArray(e.dependsOn)?e.dependsOn:[],usedBy:Array.isArray(e.usedBy)?e.usedBy:[],phiBlocks:Array.isArray(e.phiBlocks)?e.phiBlocks:[]};return function(e){const t=e.nodeType,i=Zh[t];2===i.length&&bu(`Required fields for node type '${Yh[t]}' not defined. Please add them to the utils.js file in p5.strands!`);const r=[];for(const t of i)null===e[t]&&r.push(t);if(e.dependsOn?.some((e=>void 0===e)))throw new Error("Undefined dependency!");r.length>0&&bu(`Missing fields ${r.join(", ")} for a node type '${Yh[t]}'.`)}(t),t}function Eu(e,t){return{id:t,nodeType:e.nodeTypes[t],opCode:e.opCodes[t],value:e.values[t],identifier:e.identifiers[t],dependsOn:e.dependsOn[t],usedBy:e.usedBy[t],phiBlocks:e.phiBlocks[t],dimension:e.dimensions[t],baseType:e.baseTypes[t],statementType:e.statementTypes[t],swizzle:e.swizzles[t]}}function Du(e,t){return{baseType:e.baseTypes[t],dimension:e.dimensions[t],priority:ou[e.baseTypes[t]]}}function Su(e,t){if(e.nodeTypes[t]!==Xh.OPERATION)return!1;if(e.baseTypes[t]===au)return!1;return(e.usedBy[t]||[]).length>1}Object.fromEntries(Object.entries(vu).map((([e,t])=>[t,e])));const Fu={float1:"float",float2:"vec2",float3:"vec3",float4:"vec4",int1:"int",int2:"ivec2",int3:"ivec3",int4:"ivec4",bool1:"bool",bool2:"bvec2",bool3:"bvec3",bool4:"bvec4",mat2:"mat2x2",mat3:"mat3x3",mat4:"mat4x4"},Tu={[vu.DEFAULT]:(e,t,i)=>{const{dag:r,cfg:n}=t,s=n.blockInstructions[e]||[];for(const e of s){const t=r.nodeTypes[e];if(Su(r,e)){const t=Mu.generateDeclaration(i,r,e);i.write(t)}t===Xh.STATEMENT&&Mu.generateStatement(i,r,e),t===Xh.ASSIGNMENT&&(Mu.generateAssignment(i,r,e),i.visitedNodes.add(e))}},[vu.BRANCH](e,t,i){const{dag:r,cfg:n}=t,s=n.blockInstructions[e]||[];for(const e of s){const t=Eu(r,e);if(t.nodeType===Xh.PHI){const n=t.dependsOn||[];if(n.length>0){const t=n[0],r=i.tempNames[t];if(r){i.tempNames[e]=r;continue}}const s="T"+i.nextTempID++;i.tempNames[e]=s;const a=Du(r,e),o=Mu.getTypeName(a.baseType,a.dimension);i.write(`${o} ${s};`)}}this[vu.DEFAULT](e,t,i)},[vu.IF_COND](e,t,i){const{dag:r,cfg:n}=t,s=n.blockConditions[e],a=Mu.generateExpression(i,r,s);i.write(`if (${a})`),this[vu.DEFAULT](e,t,i)},[vu.ELSE_COND](e,t,i){i.write("else"),this[vu.DEFAULT](e,t,i)},[vu.IF_BODY](e,t,i){this[vu.DEFAULT](e,t,i),this.assignPhiNodeValues(e,t,i)},[vu.SCOPE_START](e,t,i){i.write("{"),i.indent++},[vu.SCOPE_END](e,t,i){i.indent--,i.write("}")},[vu.MERGE](e,t,i){this[vu.DEFAULT](e,t,i)},[vu.FUNCTION](e,t,i){this[vu.DEFAULT](e,t,i)},[vu.FOR](e,t,i){const{dag:r,cfg:n}=t,s=n.blockInstructions[e]||[];i.write("for (");const a=i.suppressSemicolon;for(let e=0;e<s.length;e++){const t=s[e],n=Eu(r,t),a=e===s.length-1;if(i.suppressSemicolon=a,Su(r,t)){const e=Mu.generateDeclaration(i,r,t);i.write(e)}n.nodeType===Xh.STATEMENT&&Mu.generateStatement(i,r,t),n.nodeType===Xh.ASSIGNMENT&&(Mu.generateAssignment(i,r,t),i.visitedNodes.add(t))}i.suppressSemicolon=a,i.write(")")},assignPhiNodeValues(e,t,i){const{dag:r,cfg:n}=t,s=n.outgoingEdges[e]||[];for(const t of s){const s=n.blockInstructions[t]||[];for(const t of s){const n=Eu(r,t);if(n.nodeType===Xh.PHI){const s=n.phiBlocks?.indexOf(e);if(-1!==s&&s<n.dependsOn.length){const e=n.dependsOn[s],a=i.tempNames[t];if(a&&null!==e){const t=Mu.generateExpression(i,r,e);i.write(`${a} = ${t};`)}}}}}}},Mu={hookEntry:e=>`(${e.parameters.flatMap((e=>`${e.qualifiers?.length?e.qualifiers.join(" "):""}${e.type.typeName} ${e.name}`)).join(", ")}) {`,getTypeName(e,t){const i=Fu[e+t];return i||e},generateUniformDeclaration(e,t){return`${this.getTypeName(t.baseType,t.dimension)} ${e}`},generateStatement(e,t,i){const r=Eu(t,i),n=e.suppressSemicolon?"":";";if(r.statementType===Kh)e.write(`discard${n}`);else if(r.statementType===Jh)e.write(`break${n}`);else if(r.statementType===Qh){const i=r.dependsOn[0],s=this.generateExpression(e,t,i);e.write(`${s}${n}`)}else r.statementType===eu&&e.write(n)},generateAssignment(e,t,i){const r=Eu(t,i),n=r.dependsOn[0],s=r.dependsOn[1],a=this.generateExpression(e,t,n),o=this.generateExpression(e,t,s),h=e.suppressSemicolon?"":";";a&&o&&a!==o&&e.write(`${a} = ${o}${h}`)},generateDeclaration(e,t,i){const r=this.generateExpression(e,t,i),n="T"+e.nextTempID++;e.tempNames[i]=n;const s=Du(t,i);return`${this.getTypeName(s.baseType,s.dimension)} ${n} = ${r};`},generateReturnStatement(e,t,i,r){const n=e.dag,s=Eu(n,i);if(lu(s.baseType)){const e=r;for(let i=0;i<e.properties.length;i++){const r=e.properties[i],a=this.generateExpression(t,n,s.dependsOn[i]);r.name!==a&&t.write(`${s.identifier}.${r.name} = ${a};`)}}t.write(`return ${this.generateExpression(t,n,i)};`)},generateExpression(e,t,i){const r=Eu(t,i);if(e.tempNames?.[i])return e.tempNames[i];switch(r.nodeType){case Xh.LITERAL:return r.baseType===tu?r.value.toFixed(4):r.value;case Xh.VARIABLE:if(e.shaderContext&&e.strandsContext?.sharedVariables?.has(r.identifier)){const t=e.strandsContext.sharedVariables.get(r.identifier);"vertex"===e.shaderContext?t.usedInVertex=!0:"fragment"===e.shaderContext&&(t.usedInFragment=!0)}return r.identifier;case Xh.OPERATION:const n=r.usedBy.length>0;if(r.opCode===gu.CONSTRUCTOR){if(r.baseType===au)return this.generateExpression(e,t,r.dependsOn[0]);return`${this.getTypeName(r.baseType,r.dimension)}(${r.dependsOn.map((i=>this.generateExpression(e,t,i))).join(", ")})`}if(r.opCode===gu.FUNCTION_CALL){const i=r.dependsOn.map((i=>this.generateExpression(e,t,i)));return`${r.identifier}(${i.join(", ")})`}if(r.opCode===du.MEMBER_ACCESS){const[i,n]=r.dependsOn;return`${this.generateExpression(e,t,i)}.${this.generateExpression(e,t,n)}`}if(r.opCode===fu.SWIZZLE){const i=r.dependsOn[0];return`${this.generateExpression(e,t,i)}.${r.swizzle}`}if(2===r.dependsOn.length){const[i,s]=r.dependsOn,a=this.generateExpression(e,t,i),o=this.generateExpression(e,t,s);if(r.opCode===du.MODULO){const e=Eu(t,i),r=Eu(t,s);return e.baseType===tu||r.baseType===tu?`mod(${a}, ${o})`:`(${a} % ${o})`}const h=yu[r.opCode];return n?`(${a} ${h} ${o})`:`${a} ${h} ${o}`}if(r.opCode===fu.LOGICAL_NOT||r.opCode===fu.NEGATE||r.opCode===fu.PLUS){const[i]=r.dependsOn,n=this.generateExpression(e,t,i);return`${yu[r.opCode]}${n}`}case Xh.PHI:if(r.identifier)return r.identifier;if(e.tempNames?.[i])return e.tempNames[i];{const i=r.dependsOn.filter((e=>null!==e));if(i.length>0)return this.generateExpression(e,t,i[0]);throw new Error("No valid inputs for node")}case Xh.ASSIGNMENT:bu("ASSIGNMENT nodes should not be used as expressions");default:bu(`${Yh[r.nodeType]} code generation not implemented yet`)}},generateBlock(e,t,i){const r=t.cfg.blockTypes[e];(Tu[r]||Tu[vu.DEFAULT]).call(Tu,e,t,i)}};var ku=[509,0,227,0,150,4,294,9,1368,2,2,1,6,3,41,2,5,0,166,1,574,3,9,9,7,9,32,4,318,1,80,3,71,10,50,3,123,2,54,14,32,10,3,1,11,3,46,10,8,0,46,9,7,2,37,13,2,9,6,1,45,0,13,2,49,13,9,3,2,11,83,11,7,0,3,0,158,11,6,9,7,3,56,1,2,6,3,1,3,2,10,0,11,1,3,6,4,4,68,8,2,0,3,0,2,3,2,4,2,0,15,1,83,17,10,9,5,0,82,19,13,9,214,6,3,8,28,1,83,16,16,9,82,12,9,9,7,19,58,14,5,9,243,14,166,9,71,5,2,1,3,3,2,0,2,1,13,9,120,6,3,6,4,0,29,9,41,6,2,3,9,0,10,10,47,15,343,9,54,7,2,7,17,9,57,21,2,13,123,5,4,0,2,1,2,6,2,0,9,9,49,4,2,1,2,4,9,9,330,3,10,1,2,0,49,6,4,4,14,10,5350,0,7,14,11465,27,2343,9,87,9,39,4,60,6,26,9,535,9,470,0,2,54,8,3,82,0,12,1,19628,1,4178,9,519,45,3,22,543,4,4,5,9,7,3,6,31,3,149,2,1418,49,513,54,5,49,9,0,15,0,23,4,2,14,1361,6,2,16,3,6,2,1,2,4,101,0,161,6,10,9,357,0,62,13,499,13,245,1,2,9,726,6,110,6,6,9,4759,9,787719,239],Iu=[0,11,2,25,2,18,2,1,2,14,3,13,35,122,70,52,268,28,4,48,48,31,14,29,6,37,11,29,3,35,5,7,2,4,43,157,19,35,5,35,5,39,9,51,13,10,2,14,2,6,2,1,2,10,2,14,2,6,2,1,4,51,13,310,10,21,11,7,25,5,2,41,2,8,70,5,3,0,2,43,2,1,4,0,3,22,11,22,10,30,66,18,2,1,11,21,11,25,71,55,7,1,65,0,16,3,2,2,2,28,43,28,4,28,36,7,2,27,28,53,11,21,11,18,14,17,111,72,56,50,14,50,14,35,39,27,10,22,251,41,7,1,17,2,60,28,11,0,9,21,43,17,47,20,28,22,13,52,58,1,3,0,14,44,33,24,27,35,30,0,3,0,9,34,4,0,13,47,15,3,22,0,2,0,36,17,2,24,20,1,64,6,2,0,2,3,2,14,2,9,8,46,39,7,3,1,3,21,2,6,2,1,2,4,4,0,19,0,13,4,31,9,2,0,3,0,2,37,2,0,26,0,2,0,45,52,19,3,21,2,31,47,21,1,2,0,185,46,42,3,37,47,21,0,60,42,14,0,72,26,38,6,186,43,117,63,32,7,3,0,3,7,2,1,2,23,16,0,2,0,95,7,3,38,17,0,2,0,29,0,11,39,8,0,22,0,12,45,20,0,19,72,200,32,32,8,2,36,18,0,50,29,113,6,2,1,2,37,22,0,26,5,2,1,2,31,15,0,328,18,16,0,2,12,2,33,125,0,80,921,103,110,18,195,2637,96,16,1071,18,5,26,3994,6,582,6842,29,1763,568,8,30,18,78,18,29,19,47,17,3,32,20,6,18,433,44,212,63,129,74,6,0,67,12,65,1,2,0,29,6135,9,1237,42,9,8936,3,2,6,2,1,2,290,16,0,30,2,3,0,15,3,9,395,2309,106,6,12,4,8,8,9,5991,84,2,70,2,1,3,0,3,1,3,3,2,11,2,0,2,6,2,64,2,3,3,7,2,6,2,27,2,3,2,4,2,0,4,6,2,339,3,24,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,7,1845,30,7,5,262,61,147,44,11,6,17,0,322,29,19,43,485,27,229,29,3,0,496,6,2,3,2,1,2,14,2,196,60,67,8,0,1205,3,2,26,2,1,2,0,3,0,2,9,2,3,2,0,2,0,7,0,5,0,2,0,2,0,2,2,2,1,2,0,3,0,2,0,2,0,2,0,2,0,2,1,2,0,3,3,2,6,2,3,2,3,2,0,2,9,2,16,6,2,2,4,2,16,4421,42719,33,4153,7,221,3,5761,15,7472,16,621,2467,541,1507,4938,6,4191],Bu="ªµºÀ-ÖØ-öø-ˁˆ-ˑˠ-ˤˬˮͰ-ʹͶͷͺ-ͽͿΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ҁҊ-ԯԱ-Ֆՙՠ-ֈא-תׯ-ײؠ-يٮٯٱ-ۓەۥۦۮۯۺ-ۼۿܐܒ-ܯݍ-ޥޱߊ-ߪߴߵߺࠀ-ࠕࠚࠤࠨࡀ-ࡘࡠ-ࡪࡰ-ࢇࢉ-ࢎࢠ-ࣉऄ-हऽॐक़-ॡॱ-ঀঅ-ঌএঐও-নপ-রলশ-হঽৎড়ঢ়য়-ৡৰৱৼਅ-ਊਏਐਓ-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹਖ਼-ੜਫ਼ੲ-ੴઅ-ઍએ-ઑઓ-નપ-રલળવ-હઽૐૠૡૹଅ-ଌଏଐଓ-ନପ-ରଲଳଵ-ହଽଡ଼ଢ଼ୟ-ୡୱஃஅ-ஊஎ-ஐஒ-கஙசஜஞடணதந-பம-ஹௐఅ-ఌఎ-ఐఒ-నప-హఽౘ-ౚౝౠౡಀಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹಽೝೞೠೡೱೲഄ-ഌഎ-ഐഒ-ഺഽൎൔ-ൖൟ-ൡൺ-ൿඅ-ඖක-නඳ-රලව-ෆก-ะาำเ-ๆກຂຄຆ-ຊຌ-ຣລວ-ະາຳຽເ-ໄໆໜ-ໟༀཀ-ཇཉ-ཬྈ-ྌက-ဪဿၐ-ၕၚ-ၝၡၥၦၮ-ၰၵ-ႁႎႠ-ჅჇჍა-ჺჼ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚᎀ-ᎏᎠ-Ᏽᏸ-ᏽᐁ-ᙬᙯ-ᙿᚁ-ᚚᚠ-ᛪᛮ-ᛸᜀ-ᜑᜟ-ᜱᝀ-ᝑᝠ-ᝬᝮ-ᝰក-ឳៗៜᠠ-ᡸᢀ-ᢨᢪᢰ-ᣵᤀ-ᤞᥐ-ᥭᥰ-ᥴᦀ-ᦫᦰ-ᧉᨀ-ᨖᨠ-ᩔᪧᬅ-ᬳᭅ-ᭌᮃ-ᮠᮮᮯᮺ-ᯥᰀ-ᰣᱍ-ᱏᱚ-ᱽᲀ-ᲊᲐ-ᲺᲽ-Ჿᳩ-ᳬᳮ-ᳳᳵᳶᳺᴀ-ᶿḀ-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼⁱⁿₐ-ₜℂℇℊ-ℓℕ℘-ℝℤΩℨK-ℹℼ-ℿⅅ-ⅉⅎⅠ-ↈⰀ-ⳤⳫ-ⳮⳲⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯⶀ-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞ々-〇〡-〩〱-〵〸-〼ぁ-ゖ゛-ゟァ-ヺー-ヿㄅ-ㄯㄱ-ㆎㆠ-ㆿㇰ-ㇿ㐀-䶿一-ꒌꓐ-ꓽꔀ-ꘌꘐ-ꘟꘪꘫꙀ-ꙮꙿ-ꚝꚠ-ꛯꜗ-ꜟꜢ-ꞈꞋ-ꟍꟐꟑꟓꟕ-Ƛꟲ-ꠁꠃ-ꠅꠇ-ꠊꠌ-ꠢꡀ-ꡳꢂ-ꢳꣲ-ꣷꣻꣽꣾꤊ-ꤥꤰ-ꥆꥠ-ꥼꦄ-ꦲꧏꧠ-ꧤꧦ-ꧯꧺ-ꧾꨀ-ꨨꩀ-ꩂꩄ-ꩋꩠ-ꩶꩺꩾ-ꪯꪱꪵꪶꪹ-ꪽꫀꫂꫛ-ꫝꫠ-ꫪꫲ-ꫴꬁ-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꬰ-ꭚꭜ-ꭩꭰ-ꯢ가-힣ힰ-ퟆퟋ-ퟻ豈-舘並-龎ff-stﬓ-ﬗיִײַ-ﬨשׁ-זּטּ-לּמּנּסּףּפּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻﹰ-ﹴﹶ-ﻼA-Za-zヲ-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ",Lu={3:"abstract boolean byte char class double enum export extends final float goto implements import int interface long native package private protected public short static super synchronized throws transient volatile",5:"class enum extends super const export import",6:"enum",strict:"implements interface let package private protected public static yield",strictBind:"eval arguments"},Ou="break case catch continue debugger default do else finally for function if return switch throw try var while with null true false instanceof typeof void delete new in this",Pu={5:Ou,"5module":Ou+" export import",6:Ou+" const class extends export import super"},Nu=/^in(stanceof)?$/,Ru=new RegExp("["+Bu+"]"),Vu=new RegExp("["+Bu+"‌‍·̀-ͯ·҃-֑҇-ׇֽֿׁׂׅׄؐ-ًؚ-٩ٰۖ-ۜ۟-۪ۤۧۨ-ۭ۰-۹ܑܰ-݊ަ-ް߀-߉߫-߽߳ࠖ-࠙ࠛ-ࠣࠥ-ࠧࠩ-࡙࠭-࡛ࢗ-࢟࣊-ࣣ࣡-ःऺ-़ा-ॏ॑-ॗॢॣ०-९ঁ-ঃ়া-ৄেৈো-্ৗৢৣ০-৯৾ਁ-ਃ਼ਾ-ੂੇੈੋ-੍ੑ੦-ੱੵઁ-ઃ઼ા-ૅે-ૉો-્ૢૣ૦-૯ૺ-૿ଁ-ଃ଼ା-ୄେୈୋ-୍୕-ୗୢୣ୦-୯ஂா-ூெ-ைொ-்ௗ௦-௯ఀ-ఄ఼ా-ౄె-ైొ-్ౕౖౢౣ౦-౯ಁ-ಃ಼ಾ-ೄೆ-ೈೊ-್ೕೖೢೣ೦-೯ೳഀ-ഃ഻഼ാ-ൄെ-ൈൊ-്ൗൢൣ൦-൯ඁ-ඃ්ා-ුූෘ-ෟ෦-෯ෲෳัิ-ฺ็-๎๐-๙ັິ-ຼ່-໎໐-໙༘༙༠-༩༹༵༷༾༿ཱ-྄྆྇ྍ-ྗྙ-ྼ࿆ါ-ှ၀-၉ၖ-ၙၞ-ၠၢ-ၤၧ-ၭၱ-ၴႂ-ႍႏ-ႝ፝-፟፩-፱ᜒ-᜕ᜲ-᜴ᝒᝓᝲᝳ឴-៓៝០-៩᠋-᠍᠏-᠙ᢩᤠ-ᤫᤰ-᤻᥆-᥏᧐-᧚ᨗ-ᨛᩕ-ᩞ᩠-᩿᩼-᪉᪐-᪙᪰-᪽ᪿ-ᫎᬀ-ᬄ᬴-᭄᭐-᭙᭫-᭳ᮀ-ᮂᮡ-ᮭ᮰-᮹᯦-᯳ᰤ-᰷᱀-᱉᱐-᱙᳐-᳔᳒-᳨᳭᳴᳷-᳹᷀-᷿‌‍‿⁀⁔⃐-⃥⃜⃡-⃰⳯-⵿⳱ⷠ-〪ⷿ-゙゚〯・꘠-꘩꙯ꙴ-꙽ꚞꚟ꛰꛱ꠂ꠆ꠋꠣ-ꠧ꠬ꢀꢁꢴ-ꣅ꣐-꣙꣠-꣱ꣿ-꤉ꤦ-꤭ꥇ-꥓ꦀ-ꦃ꦳-꧀꧐-꧙ꧥ꧰-꧹ꨩ-ꨶꩃꩌꩍ꩐-꩙ꩻ-ꩽꪰꪲ-ꪴꪷꪸꪾ꪿꫁ꫫ-ꫯꫵ꫶ꯣ-ꯪ꯬꯭꯰-꯹ﬞ︀-️︠-︯︳︴﹍-﹏0-9_・]");function Uu(e,t){for(var i=65536,r=0;r<t.length;r+=2){if((i+=t[r])>e)return!1;if((i+=t[r+1])>=e)return!0}return!1}function zu(e,t){return e<65?36===e:e<91||(e<97?95===e:e<123||(e<=65535?e>=170&&Ru.test(String.fromCharCode(e)):!1!==t&&Uu(e,Iu)))}function Gu(e,t){return e<48?36===e:e<58||!(e<65)&&(e<91||(e<97?95===e:e<123||(e<=65535?e>=170&&Vu.test(String.fromCharCode(e)):!1!==t&&(Uu(e,Iu)||Uu(e,ku)))))}var ju=function(e,t){void 0===t&&(t={}),this.label=e,this.keyword=t.keyword,this.beforeExpr=!!t.beforeExpr,this.startsExpr=!!t.startsExpr,this.isLoop=!!t.isLoop,this.isAssign=!!t.isAssign,this.prefix=!!t.prefix,this.postfix=!!t.postfix,this.binop=t.binop||null,this.updateContext=null};function $u(e,t){return new ju(e,{beforeExpr:!0,binop:t})}var qu={beforeExpr:!0},Hu={startsExpr:!0},Wu={};function Xu(e,t){return void 0===t&&(t={}),t.keyword=e,Wu[e]=new ju(e,t)}var Yu={num:new ju("num",Hu),regexp:new ju("regexp",Hu),string:new ju("string",Hu),name:new ju("name",Hu),privateId:new ju("privateId",Hu),eof:new ju("eof"),bracketL:new ju("[",{beforeExpr:!0,startsExpr:!0}),bracketR:new ju("]"),braceL:new ju("{",{beforeExpr:!0,startsExpr:!0}),braceR:new ju("}"),parenL:new ju("(",{beforeExpr:!0,startsExpr:!0}),parenR:new ju(")"),comma:new ju(",",qu),semi:new ju(";",qu),colon:new ju(":",qu),dot:new ju("."),question:new ju("?",qu),questionDot:new ju("?."),arrow:new ju("=>",qu),template:new ju("template"),invalidTemplate:new ju("invalidTemplate"),ellipsis:new ju("...",qu),backQuote:new ju("`",Hu),dollarBraceL:new ju("${",{beforeExpr:!0,startsExpr:!0}),eq:new ju("=",{beforeExpr:!0,isAssign:!0}),assign:new ju("_=",{beforeExpr:!0,isAssign:!0}),incDec:new ju("++/--",{prefix:!0,postfix:!0,startsExpr:!0}),prefix:new ju("!/~",{beforeExpr:!0,prefix:!0,startsExpr:!0}),logicalOR:$u("||",1),logicalAND:$u("&&",2),bitwiseOR:$u("|",3),bitwiseXOR:$u("^",4),bitwiseAND:$u("&",5),equality:$u("==/!=/===/!==",6),relational:$u("</>/<=/>=",7),bitShift:$u("<</>>/>>>",8),plusMin:new ju("+/-",{beforeExpr:!0,binop:9,prefix:!0,startsExpr:!0}),modulo:$u("%",10),star:$u("*",10),slash:$u("/",10),starstar:new ju("**",{beforeExpr:!0}),coalesce:$u("??",1),_break:Xu("break"),_case:Xu("case",qu),_catch:Xu("catch"),_continue:Xu("continue"),_debugger:Xu("debugger"),_default:Xu("default",qu),_do:Xu("do",{isLoop:!0,beforeExpr:!0}),_else:Xu("else",qu),_finally:Xu("finally"),_for:Xu("for",{isLoop:!0}),_function:Xu("function",Hu),_if:Xu("if"),_return:Xu("return",qu),_switch:Xu("switch"),_throw:Xu("throw",qu),_try:Xu("try"),_var:Xu("var"),_const:Xu("const"),_while:Xu("while",{isLoop:!0}),_with:Xu("with"),_new:Xu("new",{beforeExpr:!0,startsExpr:!0}),_this:Xu("this",Hu),_super:Xu("super",Hu),_class:Xu("class",Hu),_extends:Xu("extends",qu),_export:Xu("export"),_import:Xu("import",Hu),_null:Xu("null",Hu),_true:Xu("true",Hu),_false:Xu("false",Hu),_in:Xu("in",{beforeExpr:!0,binop:7}),_instanceof:Xu("instanceof",{beforeExpr:!0,binop:7}),_typeof:Xu("typeof",{beforeExpr:!0,prefix:!0,startsExpr:!0}),_void:Xu("void",{beforeExpr:!0,prefix:!0,startsExpr:!0}),_delete:Xu("delete",{beforeExpr:!0,prefix:!0,startsExpr:!0})},Zu=/\r\n?|\n|\u2028|\u2029/,Ku=new RegExp(Zu.source,"g");function Ju(e){return 10===e||13===e||8232===e||8233===e}function Qu(e,t,i){void 0===i&&(i=e.length);for(var r=t;r<i;r++){var n=e.charCodeAt(r);if(Ju(n))return r<i-1&&13===n&&10===e.charCodeAt(r+1)?r+2:r+1}return-1}var el=/[\u1680\u2000-\u200a\u202f\u205f\u3000\ufeff]/,tl=/(?:\s|\/\/.*|\/\*[^]*?\*\/)*/g,il=Object.prototype,rl=il.hasOwnProperty,nl=il.toString,sl=Object.hasOwn||function(e,t){return rl.call(e,t)},al=Array.isArray||function(e){return"[object Array]"===nl.call(e)},ol=Object.create(null);function hl(e){return ol[e]||(ol[e]=new RegExp("^(?:"+e.replace(/ /g,"|")+")$"))}function ul(e){return e<=65535?String.fromCharCode(e):(e-=65536,String.fromCharCode(55296+(e>>10),56320+(1023&e)))}var ll=/(?:[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])/,cl=function(e,t){this.line=e,this.column=t};cl.prototype.offset=function(e){return new cl(this.line,this.column+e)};var pl=function(e,t,i){this.start=t,this.end=i,null!==e.sourceFile&&(this.source=e.sourceFile)};function dl(e,t){for(var i=1,r=0;;){var n=Qu(e,r,t);if(n<0)return new cl(i,t-r);++i,r=n}}var fl={ecmaVersion:null,sourceType:"script",onInsertedSemicolon:null,onTrailingComma:null,allowReserved:null,allowReturnOutsideFunction:!1,allowImportExportEverywhere:!1,allowAwaitOutsideFunction:null,allowSuperOutsideMethod:null,allowHashBang:!1,checkPrivateFields:!0,locations:!1,onToken:null,onComment:null,ranges:!1,program:null,sourceFile:null,directSourceFile:null,preserveParens:!1},gl=!1;function ml(e){var t={};for(var i in fl)t[i]=e&&sl(e,i)?e[i]:fl[i];if("latest"===t.ecmaVersion?t.ecmaVersion=1e8:null==t.ecmaVersion?(!gl&&"object"==typeof console&&console.warn&&(gl=!0,console.warn("Since Acorn 8.0.0, options.ecmaVersion is required.\nDefaulting to 2020, but this will stop working in the future.")),t.ecmaVersion=11):t.ecmaVersion>=2015&&(t.ecmaVersion-=2009),null==t.allowReserved&&(t.allowReserved=t.ecmaVersion<5),e&&null!=e.allowHashBang||(t.allowHashBang=t.ecmaVersion>=14),al(t.onToken)){var r=t.onToken;t.onToken=function(e){return r.push(e)}}return al(t.onComment)&&(t.onComment=function(e,t){return function(i,r,n,s,a,o){var h={type:i?"Block":"Line",value:r,start:n,end:s};e.locations&&(h.loc=new pl(this,a,o)),e.ranges&&(h.range=[n,s]),t.push(h)}}(t,t.onComment)),t}var yl=256,xl=259;function vl(e,t){return 2|(e?4:0)|(t?8:0)}var bl=function(e,t,i){this.options=e=ml(e),this.sourceFile=e.sourceFile,this.keywords=hl(Pu[e.ecmaVersion>=6?6:"module"===e.sourceType?"5module":5]);var r="";!0!==e.allowReserved&&(r=Lu[e.ecmaVersion>=6?6:5===e.ecmaVersion?5:3],"module"===e.sourceType&&(r+=" await")),this.reservedWords=hl(r);var n=(r?r+" ":"")+Lu.strict;this.reservedWordsStrict=hl(n),this.reservedWordsStrictBind=hl(n+" "+Lu.strictBind),this.input=String(t),this.containsEsc=!1,i?(this.pos=i,this.lineStart=this.input.lastIndexOf("\n",i-1)+1,this.curLine=this.input.slice(0,this.lineStart).split(Zu).length):(this.pos=this.lineStart=0,this.curLine=1),this.type=Yu.eof,this.value=null,this.start=this.end=this.pos,this.startLoc=this.endLoc=this.curPosition(),this.lastTokEndLoc=this.lastTokStartLoc=null,this.lastTokStart=this.lastTokEnd=this.pos,this.context=this.initialContext(),this.exprAllowed=!0,this.inModule="module"===e.sourceType,this.strict=this.inModule||this.strictDirective(this.pos),this.potentialArrowAt=-1,this.potentialArrowInForAwait=!1,this.yieldPos=this.awaitPos=this.awaitIdentPos=0,this.labels=[],this.undefinedExports=Object.create(null),0===this.pos&&e.allowHashBang&&"#!"===this.input.slice(0,2)&&this.skipLineComment(2),this.scopeStack=[],this.enterScope(1),this.regexpState=null,this.privateNameStack=[]},_l={inFunction:{configurable:!0},inGenerator:{configurable:!0},inAsync:{configurable:!0},canAwait:{configurable:!0},allowSuper:{configurable:!0},allowDirectSuper:{configurable:!0},treatFunctionsAsVar:{configurable:!0},allowNewDotTarget:{configurable:!0},inClassStaticBlock:{configurable:!0}};bl.prototype.parse=function(){var e=this.options.program||this.startNode();return this.nextToken(),this.parseTopLevel(e)},_l.inFunction.get=function(){return(2&this.currentVarScope().flags)>0},_l.inGenerator.get=function(){return(8&this.currentVarScope().flags)>0},_l.inAsync.get=function(){return(4&this.currentVarScope().flags)>0},_l.canAwait.get=function(){for(var e=this.scopeStack.length-1;e>=0;e--){var t=this.scopeStack[e].flags;if(768&t)return!1;if(2&t)return(4&t)>0}return this.inModule&&this.options.ecmaVersion>=13||this.options.allowAwaitOutsideFunction},_l.allowSuper.get=function(){return(64&this.currentThisScope().flags)>0||this.options.allowSuperOutsideMethod},_l.allowDirectSuper.get=function(){return(128&this.currentThisScope().flags)>0},_l.treatFunctionsAsVar.get=function(){return this.treatFunctionsAsVarInScope(this.currentScope())},_l.allowNewDotTarget.get=function(){for(var e=this.scopeStack.length-1;e>=0;e--){var t=this.scopeStack[e].flags;if(768&t||2&t&&!(16&t))return!0}return!1},_l.inClassStaticBlock.get=function(){return(this.currentVarScope().flags&yl)>0},bl.extend=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];for(var i=this,r=0;r<e.length;r++)i=e[r](i);return i},bl.parse=function(e,t){return new this(t,e).parse()},bl.parseExpressionAt=function(e,t,i){var r=new this(i,e,t);return r.nextToken(),r.parseExpression()},bl.tokenizer=function(e,t){return new this(t,e)},Object.defineProperties(bl.prototype,_l);var wl=bl.prototype,Cl=/^(?:'((?:\\[^]|[^'\\])*?)'|"((?:\\[^]|[^"\\])*?)")/;wl.strictDirective=function(e){if(this.options.ecmaVersion<5)return!1;for(;;){tl.lastIndex=e,e+=tl.exec(this.input)[0].length;var t=Cl.exec(this.input.slice(e));if(!t)return!1;if("use strict"===(t[1]||t[2])){tl.lastIndex=e+t[0].length;var i=tl.exec(this.input),r=i.index+i[0].length,n=this.input.charAt(r);return";"===n||"}"===n||Zu.test(i[0])&&!(/[(`.[+\-/*%<>=,?^&]/.test(n)||"!"===n&&"="===this.input.charAt(r+1))}e+=t[0].length,tl.lastIndex=e,e+=tl.exec(this.input)[0].length,";"===this.input[e]&&e++}},wl.eat=function(e){return this.type===e&&(this.next(),!0)},wl.isContextual=function(e){return this.type===Yu.name&&this.value===e&&!this.containsEsc},wl.eatContextual=function(e){return!!this.isContextual(e)&&(this.next(),!0)},wl.expectContextual=function(e){this.eatContextual(e)||this.unexpected()},wl.canInsertSemicolon=function(){return this.type===Yu.eof||this.type===Yu.braceR||Zu.test(this.input.slice(this.lastTokEnd,this.start))},wl.insertSemicolon=function(){if(this.canInsertSemicolon())return this.options.onInsertedSemicolon&&this.options.onInsertedSemicolon(this.lastTokEnd,this.lastTokEndLoc),!0},wl.semicolon=function(){this.eat(Yu.semi)||this.insertSemicolon()||this.unexpected()},wl.afterTrailingComma=function(e,t){if(this.type===e)return this.options.onTrailingComma&&this.options.onTrailingComma(this.lastTokStart,this.lastTokStartLoc),t||this.next(),!0},wl.expect=function(e){this.eat(e)||this.unexpected()},wl.unexpected=function(e){this.raise(null!=e?e:this.start,"Unexpected token")};var Al=function(){this.shorthandAssign=this.trailingComma=this.parenthesizedAssign=this.parenthesizedBind=this.doubleProto=-1};wl.checkPatternErrors=function(e,t){if(e){e.trailingComma>-1&&this.raiseRecoverable(e.trailingComma,"Comma is not permitted after the rest element");var i=t?e.parenthesizedAssign:e.parenthesizedBind;i>-1&&this.raiseRecoverable(i,t?"Assigning to rvalue":"Parenthesized pattern")}},wl.checkExpressionErrors=function(e,t){if(!e)return!1;var i=e.shorthandAssign,r=e.doubleProto;if(!t)return i>=0||r>=0;i>=0&&this.raise(i,"Shorthand property assignments are valid only in destructuring patterns"),r>=0&&this.raiseRecoverable(r,"Redefinition of __proto__ property")},wl.checkYieldAwaitInDefaultParams=function(){this.yieldPos&&(!this.awaitPos||this.yieldPos<this.awaitPos)&&this.raise(this.yieldPos,"Yield expression cannot be a default value"),this.awaitPos&&this.raise(this.awaitPos,"Await expression cannot be a default value")},wl.isSimpleAssignTarget=function(e){return"ParenthesizedExpression"===e.type?this.isSimpleAssignTarget(e.expression):"Identifier"===e.type||"MemberExpression"===e.type};var El=bl.prototype;El.parseTopLevel=function(e){var t=Object.create(null);for(e.body||(e.body=[]);this.type!==Yu.eof;){var i=this.parseStatement(null,!0,t);e.body.push(i)}if(this.inModule)for(var r=0,n=Object.keys(this.undefinedExports);r<n.length;r+=1){var s=n[r];this.raiseRecoverable(this.undefinedExports[s].start,"Export '"+s+"' is not defined")}return this.adaptDirectivePrologue(e.body),this.next(),e.sourceType=this.options.sourceType,this.finishNode(e,"Program")};var Dl={kind:"loop"},Sl={kind:"switch"};El.isLet=function(e){if(this.options.ecmaVersion<6||!this.isContextual("let"))return!1;tl.lastIndex=this.pos;var t=tl.exec(this.input),i=this.pos+t[0].length,r=this.input.charCodeAt(i);if(91===r||92===r)return!0;if(e)return!1;if(123===r||r>55295&&r<56320)return!0;if(zu(r,!0)){for(var n=i+1;Gu(r=this.input.charCodeAt(n),!0);)++n;if(92===r||r>55295&&r<56320)return!0;var s=this.input.slice(i,n);if(!Nu.test(s))return!0}return!1},El.isAsyncFunction=function(){if(this.options.ecmaVersion<8||!this.isContextual("async"))return!1;tl.lastIndex=this.pos;var e,t=tl.exec(this.input),i=this.pos+t[0].length;return!(Zu.test(this.input.slice(this.pos,i))||"function"!==this.input.slice(i,i+8)||i+8!==this.input.length&&(Gu(e=this.input.charCodeAt(i+8))||e>55295&&e<56320))},El.isUsingKeyword=function(e,t){if(this.options.ecmaVersion<17||!this.isContextual(e?"await":"using"))return!1;tl.lastIndex=this.pos;var i=tl.exec(this.input),r=this.pos+i[0].length;if(Zu.test(this.input.slice(this.pos,r)))return!1;if(e){var n,s=r+5;if("using"!==this.input.slice(r,s)||s===this.input.length||Gu(n=this.input.charCodeAt(s))||n>55295&&n<56320)return!1;tl.lastIndex=s;var a=tl.exec(this.input);if(a&&Zu.test(this.input.slice(s,s+a[0].length)))return!1}if(t){var o,h=r+2;if(!("of"!==this.input.slice(r,h)||h!==this.input.length&&(Gu(o=this.input.charCodeAt(h))||o>55295&&o<56320)))return!1}var u=this.input.charCodeAt(r);return zu(u,!0)||92===u},El.isAwaitUsing=function(e){return this.isUsingKeyword(!0,e)},El.isUsing=function(e){return this.isUsingKeyword(!1,e)},El.parseStatement=function(e,t,i){var r,n=this.type,s=this.startNode();switch(this.isLet(e)&&(n=Yu._var,r="let"),n){case Yu._break:case Yu._continue:return this.parseBreakContinueStatement(s,n.keyword);case Yu._debugger:return this.parseDebuggerStatement(s);case Yu._do:return this.parseDoStatement(s);case Yu._for:return this.parseForStatement(s);case Yu._function:return e&&(this.strict||"if"!==e&&"label"!==e)&&this.options.ecmaVersion>=6&&this.unexpected(),this.parseFunctionStatement(s,!1,!e);case Yu._class:return e&&this.unexpected(),this.parseClass(s,!0);case Yu._if:return this.parseIfStatement(s);case Yu._return:return this.parseReturnStatement(s);case Yu._switch:return this.parseSwitchStatement(s);case Yu._throw:return this.parseThrowStatement(s);case Yu._try:return this.parseTryStatement(s);case Yu._const:case Yu._var:return r=r||this.value,e&&"var"!==r&&this.unexpected(),this.parseVarStatement(s,r);case Yu._while:return this.parseWhileStatement(s);case Yu._with:return this.parseWithStatement(s);case Yu.braceL:return this.parseBlock(!0,s);case Yu.semi:return this.parseEmptyStatement(s);case Yu._export:case Yu._import:if(this.options.ecmaVersion>10&&n===Yu._import){tl.lastIndex=this.pos;var a=tl.exec(this.input),o=this.pos+a[0].length,h=this.input.charCodeAt(o);if(40===h||46===h)return this.parseExpressionStatement(s,this.parseExpression())}return this.options.allowImportExportEverywhere||(t||this.raise(this.start,"'import' and 'export' may only appear at the top level"),this.inModule||this.raise(this.start,"'import' and 'export' may appear only with 'sourceType: module'")),n===Yu._import?this.parseImport(s):this.parseExport(s,i);default:if(this.isAsyncFunction())return e&&this.unexpected(),this.next(),this.parseFunctionStatement(s,!0,!e);var u=this.isAwaitUsing(!1)?"await using":this.isUsing(!1)?"using":null;if(u)return t&&"script"===this.options.sourceType&&this.raise(this.start,"Using declaration cannot appear in the top level when source type is `script`"),"await using"===u&&(this.canAwait||this.raise(this.start,"Await using cannot appear outside of async function"),this.next()),this.next(),this.parseVar(s,!1,u),this.semicolon(),this.finishNode(s,"VariableDeclaration");var l=this.value,c=this.parseExpression();return n===Yu.name&&"Identifier"===c.type&&this.eat(Yu.colon)?this.parseLabeledStatement(s,l,c,e):this.parseExpressionStatement(s,c)}},El.parseBreakContinueStatement=function(e,t){var i="break"===t;this.next(),this.eat(Yu.semi)||this.insertSemicolon()?e.label=null:this.type!==Yu.name?this.unexpected():(e.label=this.parseIdent(),this.semicolon());for(var r=0;r<this.labels.length;++r){var n=this.labels[r];if(null==e.label||n.name===e.label.name){if(null!=n.kind&&(i||"loop"===n.kind))break;if(e.label&&i)break}}return r===this.labels.length&&this.raise(e.start,"Unsyntactic "+t),this.finishNode(e,i?"BreakStatement":"ContinueStatement")},El.parseDebuggerStatement=function(e){return this.next(),this.semicolon(),this.finishNode(e,"DebuggerStatement")},El.parseDoStatement=function(e){return this.next(),this.labels.push(Dl),e.body=this.parseStatement("do"),this.labels.pop(),this.expect(Yu._while),e.test=this.parseParenExpression(),this.options.ecmaVersion>=6?this.eat(Yu.semi):this.semicolon(),this.finishNode(e,"DoWhileStatement")},El.parseForStatement=function(e){this.next();var t=this.options.ecmaVersion>=9&&this.canAwait&&this.eatContextual("await")?this.lastTokStart:-1;if(this.labels.push(Dl),this.enterScope(0),this.expect(Yu.parenL),this.type===Yu.semi)return t>-1&&this.unexpected(t),this.parseFor(e,null);var i=this.isLet();if(this.type===Yu._var||this.type===Yu._const||i){var r=this.startNode(),n=i?"let":this.value;return this.next(),this.parseVar(r,!0,n),this.finishNode(r,"VariableDeclaration"),this.parseForAfterInit(e,r,t)}var s=this.isContextual("let"),a=!1,o=this.isUsing(!0)?"using":this.isAwaitUsing(!0)?"await using":null;if(o){var h=this.startNode();return this.next(),"await using"===o&&this.next(),this.parseVar(h,!0,o),this.finishNode(h,"VariableDeclaration"),this.parseForAfterInit(e,h,t)}var u=this.containsEsc,l=new Al,c=this.start,p=t>-1?this.parseExprSubscripts(l,"await"):this.parseExpression(!0,l);return this.type===Yu._in||(a=this.options.ecmaVersion>=6&&this.isContextual("of"))?(t>-1?(this.type===Yu._in&&this.unexpected(t),e.await=!0):a&&this.options.ecmaVersion>=8&&(p.start!==c||u||"Identifier"!==p.type||"async"!==p.name?this.options.ecmaVersion>=9&&(e.await=!1):this.unexpected()),s&&a&&this.raise(p.start,"The left-hand side of a for-of loop may not start with 'let'."),this.toAssignable(p,!1,l),this.checkLValPattern(p),this.parseForIn(e,p)):(this.checkExpressionErrors(l,!0),t>-1&&this.unexpected(t),this.parseFor(e,p))},El.parseForAfterInit=function(e,t,i){return(this.type===Yu._in||this.options.ecmaVersion>=6&&this.isContextual("of"))&&1===t.declarations.length?(this.options.ecmaVersion>=9&&(this.type===Yu._in?i>-1&&this.unexpected(i):e.await=i>-1),this.parseForIn(e,t)):(i>-1&&this.unexpected(i),this.parseFor(e,t))},El.parseFunctionStatement=function(e,t,i){return this.next(),this.parseFunction(e,Tl|(i?0:Ml),!1,t)},El.parseIfStatement=function(e){return this.next(),e.test=this.parseParenExpression(),e.consequent=this.parseStatement("if"),e.alternate=this.eat(Yu._else)?this.parseStatement("if"):null,this.finishNode(e,"IfStatement")},El.parseReturnStatement=function(e){return this.inFunction||this.options.allowReturnOutsideFunction||this.raise(this.start,"'return' outside of function"),this.next(),this.eat(Yu.semi)||this.insertSemicolon()?e.argument=null:(e.argument=this.parseExpression(),this.semicolon()),this.finishNode(e,"ReturnStatement")},El.parseSwitchStatement=function(e){var t;this.next(),e.discriminant=this.parseParenExpression(),e.cases=[],this.expect(Yu.braceL),this.labels.push(Sl),this.enterScope(0);for(var i=!1;this.type!==Yu.braceR;)if(this.type===Yu._case||this.type===Yu._default){var r=this.type===Yu._case;t&&this.finishNode(t,"SwitchCase"),e.cases.push(t=this.startNode()),t.consequent=[],this.next(),r?t.test=this.parseExpression():(i&&this.raiseRecoverable(this.lastTokStart,"Multiple default clauses"),i=!0,t.test=null),this.expect(Yu.colon)}else t||this.unexpected(),t.consequent.push(this.parseStatement(null));return this.exitScope(),t&&this.finishNode(t,"SwitchCase"),this.next(),this.labels.pop(),this.finishNode(e,"SwitchStatement")},El.parseThrowStatement=function(e){return this.next(),Zu.test(this.input.slice(this.lastTokEnd,this.start))&&this.raise(this.lastTokEnd,"Illegal newline after throw"),e.argument=this.parseExpression(),this.semicolon(),this.finishNode(e,"ThrowStatement")};var Fl=[];El.parseCatchClauseParam=function(){var e=this.parseBindingAtom(),t="Identifier"===e.type;return this.enterScope(t?32:0),this.checkLValPattern(e,t?4:2),this.expect(Yu.parenR),e},El.parseTryStatement=function(e){if(this.next(),e.block=this.parseBlock(),e.handler=null,this.type===Yu._catch){var t=this.startNode();this.next(),this.eat(Yu.parenL)?t.param=this.parseCatchClauseParam():(this.options.ecmaVersion<10&&this.unexpected(),t.param=null,this.enterScope(0)),t.body=this.parseBlock(!1),this.exitScope(),e.handler=this.finishNode(t,"CatchClause")}return e.finalizer=this.eat(Yu._finally)?this.parseBlock():null,e.handler||e.finalizer||this.raise(e.start,"Missing catch or finally clause"),this.finishNode(e,"TryStatement")},El.parseVarStatement=function(e,t,i){return this.next(),this.parseVar(e,!1,t,i),this.semicolon(),this.finishNode(e,"VariableDeclaration")},El.parseWhileStatement=function(e){return this.next(),e.test=this.parseParenExpression(),this.labels.push(Dl),e.body=this.parseStatement("while"),this.labels.pop(),this.finishNode(e,"WhileStatement")},El.parseWithStatement=function(e){return this.strict&&this.raise(this.start,"'with' in strict mode"),this.next(),e.object=this.parseParenExpression(),e.body=this.parseStatement("with"),this.finishNode(e,"WithStatement")},El.parseEmptyStatement=function(e){return this.next(),this.finishNode(e,"EmptyStatement")},El.parseLabeledStatement=function(e,t,i,r){for(var n=0,s=this.labels;n<s.length;n+=1){s[n].name===t&&this.raise(i.start,"Label '"+t+"' is already declared")}for(var a=this.type.isLoop?"loop":this.type===Yu._switch?"switch":null,o=this.labels.length-1;o>=0;o--){var h=this.labels[o];if(h.statementStart!==e.start)break;h.statementStart=this.start,h.kind=a}return this.labels.push({name:t,kind:a,statementStart:this.start}),e.body=this.parseStatement(r?-1===r.indexOf("label")?r+"label":r:"label"),this.labels.pop(),e.label=i,this.finishNode(e,"LabeledStatement")},El.parseExpressionStatement=function(e,t){return e.expression=t,this.semicolon(),this.finishNode(e,"ExpressionStatement")},El.parseBlock=function(e,t,i){for(void 0===e&&(e=!0),void 0===t&&(t=this.startNode()),t.body=[],this.expect(Yu.braceL),e&&this.enterScope(0);this.type!==Yu.braceR;){var r=this.parseStatement(null);t.body.push(r)}return i&&(this.strict=!1),this.next(),e&&this.exitScope(),this.finishNode(t,"BlockStatement")},El.parseFor=function(e,t){return e.init=t,this.expect(Yu.semi),e.test=this.type===Yu.semi?null:this.parseExpression(),this.expect(Yu.semi),e.update=this.type===Yu.parenR?null:this.parseExpression(),this.expect(Yu.parenR),e.body=this.parseStatement("for"),this.exitScope(),this.labels.pop(),this.finishNode(e,"ForStatement")},El.parseForIn=function(e,t){var i=this.type===Yu._in;return this.next(),"VariableDeclaration"===t.type&&null!=t.declarations[0].init&&(!i||this.options.ecmaVersion<8||this.strict||"var"!==t.kind||"Identifier"!==t.declarations[0].id.type)&&this.raise(t.start,(i?"for-in":"for-of")+" loop variable declaration may not have an initializer"),e.left=t,e.right=i?this.parseExpression():this.parseMaybeAssign(),this.expect(Yu.parenR),e.body=this.parseStatement("for"),this.exitScope(),this.labels.pop(),this.finishNode(e,i?"ForInStatement":"ForOfStatement")},El.parseVar=function(e,t,i,r){for(e.declarations=[],e.kind=i;;){var n=this.startNode();if(this.parseVarId(n,i),this.eat(Yu.eq)?n.init=this.parseMaybeAssign(t):r||"const"!==i||this.type===Yu._in||this.options.ecmaVersion>=6&&this.isContextual("of")?r||"using"!==i&&"await using"!==i||!(this.options.ecmaVersion>=17)||this.type===Yu._in||this.isContextual("of")?r||"Identifier"===n.id.type||t&&(this.type===Yu._in||this.isContextual("of"))?n.init=null:this.raise(this.lastTokEnd,"Complex binding patterns require an initialization value"):this.raise(this.lastTokEnd,"Missing initializer in "+i+" declaration"):this.unexpected(),e.declarations.push(this.finishNode(n,"VariableDeclarator")),!this.eat(Yu.comma))break}return e},El.parseVarId=function(e,t){e.id="using"===t||"await using"===t?this.parseIdent():this.parseBindingAtom(),this.checkLValPattern(e.id,"var"===t?1:2,!1)};var Tl=1,Ml=2;function kl(e,t){var i=t.key.name,r=e[i],n="true";return"MethodDefinition"!==t.type||"get"!==t.kind&&"set"!==t.kind||(n=(t.static?"s":"i")+t.kind),"iget"===r&&"iset"===n||"iset"===r&&"iget"===n||"sget"===r&&"sset"===n||"sset"===r&&"sget"===n?(e[i]="true",!1):!!r||(e[i]=n,!1)}function Il(e,t){var i=e.computed,r=e.key;return!i&&("Identifier"===r.type&&r.name===t||"Literal"===r.type&&r.value===t)}El.parseFunction=function(e,t,i,r,n){this.initFunction(e),(this.options.ecmaVersion>=9||this.options.ecmaVersion>=6&&!r)&&(this.type===Yu.star&&t&Ml&&this.unexpected(),e.generator=this.eat(Yu.star)),this.options.ecmaVersion>=8&&(e.async=!!r),t&Tl&&(e.id=4&t&&this.type!==Yu.name?null:this.parseIdent(),!e.id||t&Ml||this.checkLValSimple(e.id,this.strict||e.generator||e.async?this.treatFunctionsAsVar?1:2:3));var s=this.yieldPos,a=this.awaitPos,o=this.awaitIdentPos;return this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,this.enterScope(vl(e.async,e.generator)),t&Tl||(e.id=this.type===Yu.name?this.parseIdent():null),this.parseFunctionParams(e),this.parseFunctionBody(e,i,!1,n),this.yieldPos=s,this.awaitPos=a,this.awaitIdentPos=o,this.finishNode(e,t&Tl?"FunctionDeclaration":"FunctionExpression")},El.parseFunctionParams=function(e){this.expect(Yu.parenL),e.params=this.parseBindingList(Yu.parenR,!1,this.options.ecmaVersion>=8),this.checkYieldAwaitInDefaultParams()},El.parseClass=function(e,t){this.next();var i=this.strict;this.strict=!0,this.parseClassId(e,t),this.parseClassSuper(e);var r=this.enterClassBody(),n=this.startNode(),s=!1;for(n.body=[],this.expect(Yu.braceL);this.type!==Yu.braceR;){var a=this.parseClassElement(null!==e.superClass);a&&(n.body.push(a),"MethodDefinition"===a.type&&"constructor"===a.kind?(s&&this.raiseRecoverable(a.start,"Duplicate constructor in the same class"),s=!0):a.key&&"PrivateIdentifier"===a.key.type&&kl(r,a)&&this.raiseRecoverable(a.key.start,"Identifier '#"+a.key.name+"' has already been declared"))}return this.strict=i,this.next(),e.body=this.finishNode(n,"ClassBody"),this.exitClassBody(),this.finishNode(e,t?"ClassDeclaration":"ClassExpression")},El.parseClassElement=function(e){if(this.eat(Yu.semi))return null;var t=this.options.ecmaVersion,i=this.startNode(),r="",n=!1,s=!1,a="method",o=!1;if(this.eatContextual("static")){if(t>=13&&this.eat(Yu.braceL))return this.parseClassStaticBlock(i),i;this.isClassElementNameStart()||this.type===Yu.star?o=!0:r="static"}if(i.static=o,!r&&t>=8&&this.eatContextual("async")&&(!this.isClassElementNameStart()&&this.type!==Yu.star||this.canInsertSemicolon()?r="async":s=!0),!r&&(t>=9||!s)&&this.eat(Yu.star)&&(n=!0),!r&&!s&&!n){var h=this.value;(this.eatContextual("get")||this.eatContextual("set"))&&(this.isClassElementNameStart()?a=h:r=h)}if(r?(i.computed=!1,i.key=this.startNodeAt(this.lastTokStart,this.lastTokStartLoc),i.key.name=r,this.finishNode(i.key,"Identifier")):this.parseClassElementName(i),t<13||this.type===Yu.parenL||"method"!==a||n||s){var u=!i.static&&Il(i,"constructor"),l=u&&e;u&&"method"!==a&&this.raise(i.key.start,"Constructor can't have get/set modifier"),i.kind=u?"constructor":a,this.parseClassMethod(i,n,s,l)}else this.parseClassField(i);return i},El.isClassElementNameStart=function(){return this.type===Yu.name||this.type===Yu.privateId||this.type===Yu.num||this.type===Yu.string||this.type===Yu.bracketL||this.type.keyword},El.parseClassElementName=function(e){this.type===Yu.privateId?("constructor"===this.value&&this.raise(this.start,"Classes can't have an element named '#constructor'"),e.computed=!1,e.key=this.parsePrivateIdent()):this.parsePropertyName(e)},El.parseClassMethod=function(e,t,i,r){var n=e.key;"constructor"===e.kind?(t&&this.raise(n.start,"Constructor can't be a generator"),i&&this.raise(n.start,"Constructor can't be an async method")):e.static&&Il(e,"prototype")&&this.raise(n.start,"Classes may not have a static property named prototype");var s=e.value=this.parseMethod(t,i,r);return"get"===e.kind&&0!==s.params.length&&this.raiseRecoverable(s.start,"getter should have no params"),"set"===e.kind&&1!==s.params.length&&this.raiseRecoverable(s.start,"setter should have exactly one param"),"set"===e.kind&&"RestElement"===s.params[0].type&&this.raiseRecoverable(s.params[0].start,"Setter cannot use rest params"),this.finishNode(e,"MethodDefinition")},El.parseClassField=function(e){return Il(e,"constructor")?this.raise(e.key.start,"Classes can't have a field named 'constructor'"):e.static&&Il(e,"prototype")&&this.raise(e.key.start,"Classes can't have a static field named 'prototype'"),this.eat(Yu.eq)?(this.enterScope(576),e.value=this.parseMaybeAssign(),this.exitScope()):e.value=null,this.semicolon(),this.finishNode(e,"PropertyDefinition")},El.parseClassStaticBlock=function(e){e.body=[];var t=this.labels;for(this.labels=[],this.enterScope(320);this.type!==Yu.braceR;){var i=this.parseStatement(null);e.body.push(i)}return this.next(),this.exitScope(),this.labels=t,this.finishNode(e,"StaticBlock")},El.parseClassId=function(e,t){this.type===Yu.name?(e.id=this.parseIdent(),t&&this.checkLValSimple(e.id,2,!1)):(!0===t&&this.unexpected(),e.id=null)},El.parseClassSuper=function(e){e.superClass=this.eat(Yu._extends)?this.parseExprSubscripts(null,!1):null},El.enterClassBody=function(){var e={declared:Object.create(null),used:[]};return this.privateNameStack.push(e),e.declared},El.exitClassBody=function(){var e=this.privateNameStack.pop(),t=e.declared,i=e.used;if(this.options.checkPrivateFields)for(var r=this.privateNameStack.length,n=0===r?null:this.privateNameStack[r-1],s=0;s<i.length;++s){var a=i[s];sl(t,a.name)||(n?n.used.push(a):this.raiseRecoverable(a.start,"Private field '#"+a.name+"' must be declared in an enclosing class"))}},El.parseExportAllDeclaration=function(e,t){return this.options.ecmaVersion>=11&&(this.eatContextual("as")?(e.exported=this.parseModuleExportName(),this.checkExport(t,e.exported,this.lastTokStart)):e.exported=null),this.expectContextual("from"),this.type!==Yu.string&&this.unexpected(),e.source=this.parseExprAtom(),this.options.ecmaVersion>=16&&(e.attributes=this.parseWithClause()),this.semicolon(),this.finishNode(e,"ExportAllDeclaration")},El.parseExport=function(e,t){if(this.next(),this.eat(Yu.star))return this.parseExportAllDeclaration(e,t);if(this.eat(Yu._default))return this.checkExport(t,"default",this.lastTokStart),e.declaration=this.parseExportDefaultDeclaration(),this.finishNode(e,"ExportDefaultDeclaration");if(this.shouldParseExportStatement())e.declaration=this.parseExportDeclaration(e),"VariableDeclaration"===e.declaration.type?this.checkVariableExport(t,e.declaration.declarations):this.checkExport(t,e.declaration.id,e.declaration.id.start),e.specifiers=[],e.source=null,this.options.ecmaVersion>=16&&(e.attributes=[]);else{if(e.declaration=null,e.specifiers=this.parseExportSpecifiers(t),this.eatContextual("from"))this.type!==Yu.string&&this.unexpected(),e.source=this.parseExprAtom(),this.options.ecmaVersion>=16&&(e.attributes=this.parseWithClause());else{for(var i=0,r=e.specifiers;i<r.length;i+=1){var n=r[i];this.checkUnreserved(n.local),this.checkLocalExport(n.local),"Literal"===n.local.type&&this.raise(n.local.start,"A string literal cannot be used as an exported binding without `from`.")}e.source=null,this.options.ecmaVersion>=16&&(e.attributes=[])}this.semicolon()}return this.finishNode(e,"ExportNamedDeclaration")},El.parseExportDeclaration=function(e){return this.parseStatement(null)},El.parseExportDefaultDeclaration=function(){var e;if(this.type===Yu._function||(e=this.isAsyncFunction())){var t=this.startNode();return this.next(),e&&this.next(),this.parseFunction(t,4|Tl,!1,e)}if(this.type===Yu._class){var i=this.startNode();return this.parseClass(i,"nullableID")}var r=this.parseMaybeAssign();return this.semicolon(),r},El.checkExport=function(e,t,i){e&&("string"!=typeof t&&(t="Identifier"===t.type?t.name:t.value),sl(e,t)&&this.raiseRecoverable(i,"Duplicate export '"+t+"'"),e[t]=!0)},El.checkPatternExport=function(e,t){var i=t.type;if("Identifier"===i)this.checkExport(e,t,t.start);else if("ObjectPattern"===i)for(var r=0,n=t.properties;r<n.length;r+=1){var s=n[r];this.checkPatternExport(e,s)}else if("ArrayPattern"===i)for(var a=0,o=t.elements;a<o.length;a+=1){var h=o[a];h&&this.checkPatternExport(e,h)}else"Property"===i?this.checkPatternExport(e,t.value):"AssignmentPattern"===i?this.checkPatternExport(e,t.left):"RestElement"===i&&this.checkPatternExport(e,t.argument)},El.checkVariableExport=function(e,t){if(e)for(var i=0,r=t;i<r.length;i+=1){var n=r[i];this.checkPatternExport(e,n.id)}},El.shouldParseExportStatement=function(){return"var"===this.type.keyword||"const"===this.type.keyword||"class"===this.type.keyword||"function"===this.type.keyword||this.isLet()||this.isAsyncFunction()},El.parseExportSpecifier=function(e){var t=this.startNode();return t.local=this.parseModuleExportName(),t.exported=this.eatContextual("as")?this.parseModuleExportName():t.local,this.checkExport(e,t.exported,t.exported.start),this.finishNode(t,"ExportSpecifier")},El.parseExportSpecifiers=function(e){var t=[],i=!0;for(this.expect(Yu.braceL);!this.eat(Yu.braceR);){if(i)i=!1;else if(this.expect(Yu.comma),this.afterTrailingComma(Yu.braceR))break;t.push(this.parseExportSpecifier(e))}return t},El.parseImport=function(e){return this.next(),this.type===Yu.string?(e.specifiers=Fl,e.source=this.parseExprAtom()):(e.specifiers=this.parseImportSpecifiers(),this.expectContextual("from"),e.source=this.type===Yu.string?this.parseExprAtom():this.unexpected()),this.options.ecmaVersion>=16&&(e.attributes=this.parseWithClause()),this.semicolon(),this.finishNode(e,"ImportDeclaration")},El.parseImportSpecifier=function(){var e=this.startNode();return e.imported=this.parseModuleExportName(),this.eatContextual("as")?e.local=this.parseIdent():(this.checkUnreserved(e.imported),e.local=e.imported),this.checkLValSimple(e.local,2),this.finishNode(e,"ImportSpecifier")},El.parseImportDefaultSpecifier=function(){var e=this.startNode();return e.local=this.parseIdent(),this.checkLValSimple(e.local,2),this.finishNode(e,"ImportDefaultSpecifier")},El.parseImportNamespaceSpecifier=function(){var e=this.startNode();return this.next(),this.expectContextual("as"),e.local=this.parseIdent(),this.checkLValSimple(e.local,2),this.finishNode(e,"ImportNamespaceSpecifier")},El.parseImportSpecifiers=function(){var e=[],t=!0;if(this.type===Yu.name&&(e.push(this.parseImportDefaultSpecifier()),!this.eat(Yu.comma)))return e;if(this.type===Yu.star)return e.push(this.parseImportNamespaceSpecifier()),e;for(this.expect(Yu.braceL);!this.eat(Yu.braceR);){if(t)t=!1;else if(this.expect(Yu.comma),this.afterTrailingComma(Yu.braceR))break;e.push(this.parseImportSpecifier())}return e},El.parseWithClause=function(){var e=[];if(!this.eat(Yu._with))return e;this.expect(Yu.braceL);for(var t={},i=!0;!this.eat(Yu.braceR);){if(i)i=!1;else if(this.expect(Yu.comma),this.afterTrailingComma(Yu.braceR))break;var r=this.parseImportAttribute(),n="Identifier"===r.key.type?r.key.name:r.key.value;sl(t,n)&&this.raiseRecoverable(r.key.start,"Duplicate attribute key '"+n+"'"),t[n]=!0,e.push(r)}return e},El.parseImportAttribute=function(){var e=this.startNode();return e.key=this.type===Yu.string?this.parseExprAtom():this.parseIdent("never"!==this.options.allowReserved),this.expect(Yu.colon),this.type!==Yu.string&&this.unexpected(),e.value=this.parseExprAtom(),this.finishNode(e,"ImportAttribute")},El.parseModuleExportName=function(){if(this.options.ecmaVersion>=13&&this.type===Yu.string){var e=this.parseLiteral(this.value);return ll.test(e.value)&&this.raise(e.start,"An export name cannot include a lone surrogate."),e}return this.parseIdent(!0)},El.adaptDirectivePrologue=function(e){for(var t=0;t<e.length&&this.isDirectiveCandidate(e[t]);++t)e[t].directive=e[t].expression.raw.slice(1,-1)},El.isDirectiveCandidate=function(e){return this.options.ecmaVersion>=5&&"ExpressionStatement"===e.type&&"Literal"===e.expression.type&&"string"==typeof e.expression.value&&('"'===this.input[e.start]||"'"===this.input[e.start])};var Bl=bl.prototype;Bl.toAssignable=function(e,t,i){if(this.options.ecmaVersion>=6&&e)switch(e.type){case"Identifier":this.inAsync&&"await"===e.name&&this.raise(e.start,"Cannot use 'await' as identifier inside an async function");break;case"ObjectPattern":case"ArrayPattern":case"AssignmentPattern":case"RestElement":break;case"ObjectExpression":e.type="ObjectPattern",i&&this.checkPatternErrors(i,!0);for(var r=0,n=e.properties;r<n.length;r+=1){var s=n[r];this.toAssignable(s,t),"RestElement"!==s.type||"ArrayPattern"!==s.argument.type&&"ObjectPattern"!==s.argument.type||this.raise(s.argument.start,"Unexpected token")}break;case"Property":"init"!==e.kind&&this.raise(e.key.start,"Object pattern can't contain getter or setter"),this.toAssignable(e.value,t);break;case"ArrayExpression":e.type="ArrayPattern",i&&this.checkPatternErrors(i,!0),this.toAssignableList(e.elements,t);break;case"SpreadElement":e.type="RestElement",this.toAssignable(e.argument,t),"AssignmentPattern"===e.argument.type&&this.raise(e.argument.start,"Rest elements cannot have a default value");break;case"AssignmentExpression":"="!==e.operator&&this.raise(e.left.end,"Only '=' operator can be used for specifying default value."),e.type="AssignmentPattern",delete e.operator,this.toAssignable(e.left,t);break;case"ParenthesizedExpression":this.toAssignable(e.expression,t,i);break;case"ChainExpression":this.raiseRecoverable(e.start,"Optional chaining cannot appear in left-hand side");break;case"MemberExpression":if(!t)break;default:this.raise(e.start,"Assigning to rvalue")}else i&&this.checkPatternErrors(i,!0);return e},Bl.toAssignableList=function(e,t){for(var i=e.length,r=0;r<i;r++){var n=e[r];n&&this.toAssignable(n,t)}if(i){var s=e[i-1];6===this.options.ecmaVersion&&t&&s&&"RestElement"===s.type&&"Identifier"!==s.argument.type&&this.unexpected(s.argument.start)}return e},Bl.parseSpread=function(e){var t=this.startNode();return this.next(),t.argument=this.parseMaybeAssign(!1,e),this.finishNode(t,"SpreadElement")},Bl.parseRestBinding=function(){var e=this.startNode();return this.next(),6===this.options.ecmaVersion&&this.type!==Yu.name&&this.unexpected(),e.argument=this.parseBindingAtom(),this.finishNode(e,"RestElement")},Bl.parseBindingAtom=function(){if(this.options.ecmaVersion>=6)switch(this.type){case Yu.bracketL:var e=this.startNode();return this.next(),e.elements=this.parseBindingList(Yu.bracketR,!0,!0),this.finishNode(e,"ArrayPattern");case Yu.braceL:return this.parseObj(!0)}return this.parseIdent()},Bl.parseBindingList=function(e,t,i,r){for(var n=[],s=!0;!this.eat(e);)if(s?s=!1:this.expect(Yu.comma),t&&this.type===Yu.comma)n.push(null);else{if(i&&this.afterTrailingComma(e))break;if(this.type===Yu.ellipsis){var a=this.parseRestBinding();this.parseBindingListItem(a),n.push(a),this.type===Yu.comma&&this.raiseRecoverable(this.start,"Comma is not permitted after the rest element"),this.expect(e);break}n.push(this.parseAssignableListItem(r))}return n},Bl.parseAssignableListItem=function(e){var t=this.parseMaybeDefault(this.start,this.startLoc);return this.parseBindingListItem(t),t},Bl.parseBindingListItem=function(e){return e},Bl.parseMaybeDefault=function(e,t,i){if(i=i||this.parseBindingAtom(),this.options.ecmaVersion<6||!this.eat(Yu.eq))return i;var r=this.startNodeAt(e,t);return r.left=i,r.right=this.parseMaybeAssign(),this.finishNode(r,"AssignmentPattern")},Bl.checkLValSimple=function(e,t,i){void 0===t&&(t=0);var r=0!==t;switch(e.type){case"Identifier":this.strict&&this.reservedWordsStrictBind.test(e.name)&&this.raiseRecoverable(e.start,(r?"Binding ":"Assigning to ")+e.name+" in strict mode"),r&&(2===t&&"let"===e.name&&this.raiseRecoverable(e.start,"let is disallowed as a lexically bound name"),i&&(sl(i,e.name)&&this.raiseRecoverable(e.start,"Argument name clash"),i[e.name]=!0),5!==t&&this.declareName(e.name,t,e.start));break;case"ChainExpression":this.raiseRecoverable(e.start,"Optional chaining cannot appear in left-hand side");break;case"MemberExpression":r&&this.raiseRecoverable(e.start,"Binding member expression");break;case"ParenthesizedExpression":return r&&this.raiseRecoverable(e.start,"Binding parenthesized expression"),this.checkLValSimple(e.expression,t,i);default:this.raise(e.start,(r?"Binding":"Assigning to")+" rvalue")}},Bl.checkLValPattern=function(e,t,i){switch(void 0===t&&(t=0),e.type){case"ObjectPattern":for(var r=0,n=e.properties;r<n.length;r+=1){var s=n[r];this.checkLValInnerPattern(s,t,i)}break;case"ArrayPattern":for(var a=0,o=e.elements;a<o.length;a+=1){var h=o[a];h&&this.checkLValInnerPattern(h,t,i)}break;default:this.checkLValSimple(e,t,i)}},Bl.checkLValInnerPattern=function(e,t,i){switch(void 0===t&&(t=0),e.type){case"Property":this.checkLValInnerPattern(e.value,t,i);break;case"AssignmentPattern":this.checkLValPattern(e.left,t,i);break;case"RestElement":this.checkLValPattern(e.argument,t,i);break;default:this.checkLValPattern(e,t,i)}};var Ll=function(e,t,i,r,n){this.token=e,this.isExpr=!!t,this.preserveSpace=!!i,this.override=r,this.generator=!!n},Ol={b_stat:new Ll("{",!1),b_expr:new Ll("{",!0),b_tmpl:new Ll("${",!1),p_stat:new Ll("(",!1),p_expr:new Ll("(",!0),q_tmpl:new Ll("`",!0,!0,(function(e){return e.tryReadTemplateToken()})),f_stat:new Ll("function",!1),f_expr:new Ll("function",!0),f_expr_gen:new Ll("function",!0,!1,null,!0),f_gen:new Ll("function",!1,!1,null,!0)},Pl=bl.prototype;Pl.initialContext=function(){return[Ol.b_stat]},Pl.curContext=function(){return this.context[this.context.length-1]},Pl.braceIsBlock=function(e){var t=this.curContext();return t===Ol.f_expr||t===Ol.f_stat||(e!==Yu.colon||t!==Ol.b_stat&&t!==Ol.b_expr?e===Yu._return||e===Yu.name&&this.exprAllowed?Zu.test(this.input.slice(this.lastTokEnd,this.start)):e===Yu._else||e===Yu.semi||e===Yu.eof||e===Yu.parenR||e===Yu.arrow||(e===Yu.braceL?t===Ol.b_stat:e!==Yu._var&&e!==Yu._const&&e!==Yu.name&&!this.exprAllowed):!t.isExpr)},Pl.inGeneratorContext=function(){for(var e=this.context.length-1;e>=1;e--){var t=this.context[e];if("function"===t.token)return t.generator}return!1},Pl.updateContext=function(e){var t,i=this.type;i.keyword&&e===Yu.dot?this.exprAllowed=!1:(t=i.updateContext)?t.call(this,e):this.exprAllowed=i.beforeExpr},Pl.overrideContext=function(e){this.curContext()!==e&&(this.context[this.context.length-1]=e)},Yu.parenR.updateContext=Yu.braceR.updateContext=function(){if(1!==this.context.length){var e=this.context.pop();e===Ol.b_stat&&"function"===this.curContext().token&&(e=this.context.pop()),this.exprAllowed=!e.isExpr}else this.exprAllowed=!0},Yu.braceL.updateContext=function(e){this.context.push(this.braceIsBlock(e)?Ol.b_stat:Ol.b_expr),this.exprAllowed=!0},Yu.dollarBraceL.updateContext=function(){this.context.push(Ol.b_tmpl),this.exprAllowed=!0},Yu.parenL.updateContext=function(e){var t=e===Yu._if||e===Yu._for||e===Yu._with||e===Yu._while;this.context.push(t?Ol.p_stat:Ol.p_expr),this.exprAllowed=!0},Yu.incDec.updateContext=function(){},Yu._function.updateContext=Yu._class.updateContext=function(e){!e.beforeExpr||e===Yu._else||e===Yu.semi&&this.curContext()!==Ol.p_stat||e===Yu._return&&Zu.test(this.input.slice(this.lastTokEnd,this.start))||(e===Yu.colon||e===Yu.braceL)&&this.curContext()===Ol.b_stat?this.context.push(Ol.f_stat):this.context.push(Ol.f_expr),this.exprAllowed=!1},Yu.colon.updateContext=function(){"function"===this.curContext().token&&this.context.pop(),this.exprAllowed=!0},Yu.backQuote.updateContext=function(){this.curContext()===Ol.q_tmpl?this.context.pop():this.context.push(Ol.q_tmpl),this.exprAllowed=!1},Yu.star.updateContext=function(e){if(e===Yu._function){var t=this.context.length-1;this.context[t]===Ol.f_expr?this.context[t]=Ol.f_expr_gen:this.context[t]=Ol.f_gen}this.exprAllowed=!0},Yu.name.updateContext=function(e){var t=!1;this.options.ecmaVersion>=6&&e!==Yu.dot&&("of"===this.value&&!this.exprAllowed||"yield"===this.value&&this.inGeneratorContext())&&(t=!0),this.exprAllowed=t};var Nl=bl.prototype;function Rl(e){return"Identifier"===e.type||"ParenthesizedExpression"===e.type&&Rl(e.expression)}function Vl(e){return"MemberExpression"===e.type&&"PrivateIdentifier"===e.property.type||"ChainExpression"===e.type&&Vl(e.expression)||"ParenthesizedExpression"===e.type&&Vl(e.expression)}Nl.checkPropClash=function(e,t,i){if(!(this.options.ecmaVersion>=9&&"SpreadElement"===e.type||this.options.ecmaVersion>=6&&(e.computed||e.method||e.shorthand))){var r,n=e.key;switch(n.type){case"Identifier":r=n.name;break;case"Literal":r=String(n.value);break;default:return}var s=e.kind;if(this.options.ecmaVersion>=6)"__proto__"===r&&"init"===s&&(t.proto&&(i?i.doubleProto<0&&(i.doubleProto=n.start):this.raiseRecoverable(n.start,"Redefinition of __proto__ property")),t.proto=!0);else{var a=t[r="$"+r];if(a)("init"===s?this.strict&&a.init||a.get||a.set:a.init||a[s])&&this.raiseRecoverable(n.start,"Redefinition of property");else a=t[r]={init:!1,get:!1,set:!1};a[s]=!0}}},Nl.parseExpression=function(e,t){var i=this.start,r=this.startLoc,n=this.parseMaybeAssign(e,t);if(this.type===Yu.comma){var s=this.startNodeAt(i,r);for(s.expressions=[n];this.eat(Yu.comma);)s.expressions.push(this.parseMaybeAssign(e,t));return this.finishNode(s,"SequenceExpression")}return n},Nl.parseMaybeAssign=function(e,t,i){if(this.isContextual("yield")){if(this.inGenerator)return this.parseYield(e);this.exprAllowed=!1}var r=!1,n=-1,s=-1,a=-1;t?(n=t.parenthesizedAssign,s=t.trailingComma,a=t.doubleProto,t.parenthesizedAssign=t.trailingComma=-1):(t=new Al,r=!0);var o=this.start,h=this.startLoc;this.type!==Yu.parenL&&this.type!==Yu.name||(this.potentialArrowAt=this.start,this.potentialArrowInForAwait="await"===e);var u=this.parseMaybeConditional(e,t);if(i&&(u=i.call(this,u,o,h)),this.type.isAssign){var l=this.startNodeAt(o,h);return l.operator=this.value,this.type===Yu.eq&&(u=this.toAssignable(u,!1,t)),r||(t.parenthesizedAssign=t.trailingComma=t.doubleProto=-1),t.shorthandAssign>=u.start&&(t.shorthandAssign=-1),this.type===Yu.eq?this.checkLValPattern(u):this.checkLValSimple(u),l.left=u,this.next(),l.right=this.parseMaybeAssign(e),a>-1&&(t.doubleProto=a),this.finishNode(l,"AssignmentExpression")}return r&&this.checkExpressionErrors(t,!0),n>-1&&(t.parenthesizedAssign=n),s>-1&&(t.trailingComma=s),u},Nl.parseMaybeConditional=function(e,t){var i=this.start,r=this.startLoc,n=this.parseExprOps(e,t);if(this.checkExpressionErrors(t))return n;if(this.eat(Yu.question)){var s=this.startNodeAt(i,r);return s.test=n,s.consequent=this.parseMaybeAssign(),this.expect(Yu.colon),s.alternate=this.parseMaybeAssign(e),this.finishNode(s,"ConditionalExpression")}return n},Nl.parseExprOps=function(e,t){var i=this.start,r=this.startLoc,n=this.parseMaybeUnary(t,!1,!1,e);return this.checkExpressionErrors(t)||n.start===i&&"ArrowFunctionExpression"===n.type?n:this.parseExprOp(n,i,r,-1,e)},Nl.parseExprOp=function(e,t,i,r,n){var s=this.type.binop;if(null!=s&&(!n||this.type!==Yu._in)&&s>r){var a=this.type===Yu.logicalOR||this.type===Yu.logicalAND,o=this.type===Yu.coalesce;o&&(s=Yu.logicalAND.binop);var h=this.value;this.next();var u=this.start,l=this.startLoc,c=this.parseExprOp(this.parseMaybeUnary(null,!1,!1,n),u,l,s,n),p=this.buildBinary(t,i,e,c,h,a||o);return(a&&this.type===Yu.coalesce||o&&(this.type===Yu.logicalOR||this.type===Yu.logicalAND))&&this.raiseRecoverable(this.start,"Logical expressions and coalesce expressions cannot be mixed. Wrap either by parentheses"),this.parseExprOp(p,t,i,r,n)}return e},Nl.buildBinary=function(e,t,i,r,n,s){"PrivateIdentifier"===r.type&&this.raise(r.start,"Private identifier can only be left side of binary expression");var a=this.startNodeAt(e,t);return a.left=i,a.operator=n,a.right=r,this.finishNode(a,s?"LogicalExpression":"BinaryExpression")},Nl.parseMaybeUnary=function(e,t,i,r){var n,s=this.start,a=this.startLoc;if(this.isContextual("await")&&this.canAwait)n=this.parseAwait(r),t=!0;else if(this.type.prefix){var o=this.startNode(),h=this.type===Yu.incDec;o.operator=this.value,o.prefix=!0,this.next(),o.argument=this.parseMaybeUnary(null,!0,h,r),this.checkExpressionErrors(e,!0),h?this.checkLValSimple(o.argument):this.strict&&"delete"===o.operator&&Rl(o.argument)?this.raiseRecoverable(o.start,"Deleting local variable in strict mode"):"delete"===o.operator&&Vl(o.argument)?this.raiseRecoverable(o.start,"Private fields can not be deleted"):t=!0,n=this.finishNode(o,h?"UpdateExpression":"UnaryExpression")}else if(t||this.type!==Yu.privateId){if(n=this.parseExprSubscripts(e,r),this.checkExpressionErrors(e))return n;for(;this.type.postfix&&!this.canInsertSemicolon();){var u=this.startNodeAt(s,a);u.operator=this.value,u.prefix=!1,u.argument=n,this.checkLValSimple(n),this.next(),n=this.finishNode(u,"UpdateExpression")}}else(r||0===this.privateNameStack.length)&&this.options.checkPrivateFields&&this.unexpected(),n=this.parsePrivateIdent(),this.type!==Yu._in&&this.unexpected();return i||!this.eat(Yu.starstar)?n:t?void this.unexpected(this.lastTokStart):this.buildBinary(s,a,n,this.parseMaybeUnary(null,!1,!1,r),"**",!1)},Nl.parseExprSubscripts=function(e,t){var i=this.start,r=this.startLoc,n=this.parseExprAtom(e,t);if("ArrowFunctionExpression"===n.type&&")"!==this.input.slice(this.lastTokStart,this.lastTokEnd))return n;var s=this.parseSubscripts(n,i,r,!1,t);return e&&"MemberExpression"===s.type&&(e.parenthesizedAssign>=s.start&&(e.parenthesizedAssign=-1),e.parenthesizedBind>=s.start&&(e.parenthesizedBind=-1),e.trailingComma>=s.start&&(e.trailingComma=-1)),s},Nl.parseSubscripts=function(e,t,i,r,n){for(var s=this.options.ecmaVersion>=8&&"Identifier"===e.type&&"async"===e.name&&this.lastTokEnd===e.end&&!this.canInsertSemicolon()&&e.end-e.start==5&&this.potentialArrowAt===e.start,a=!1;;){var o=this.parseSubscript(e,t,i,r,s,a,n);if(o.optional&&(a=!0),o===e||"ArrowFunctionExpression"===o.type){if(a){var h=this.startNodeAt(t,i);h.expression=o,o=this.finishNode(h,"ChainExpression")}return o}e=o}},Nl.shouldParseAsyncArrow=function(){return!this.canInsertSemicolon()&&this.eat(Yu.arrow)},Nl.parseSubscriptAsyncArrow=function(e,t,i,r){return this.parseArrowExpression(this.startNodeAt(e,t),i,!0,r)},Nl.parseSubscript=function(e,t,i,r,n,s,a){var o=this.options.ecmaVersion>=11,h=o&&this.eat(Yu.questionDot);r&&h&&this.raise(this.lastTokStart,"Optional chaining cannot appear in the callee of new expressions");var u=this.eat(Yu.bracketL);if(u||h&&this.type!==Yu.parenL&&this.type!==Yu.backQuote||this.eat(Yu.dot)){var l=this.startNodeAt(t,i);l.object=e,u?(l.property=this.parseExpression(),this.expect(Yu.bracketR)):this.type===Yu.privateId&&"Super"!==e.type?l.property=this.parsePrivateIdent():l.property=this.parseIdent("never"!==this.options.allowReserved),l.computed=!!u,o&&(l.optional=h),e=this.finishNode(l,"MemberExpression")}else if(!r&&this.eat(Yu.parenL)){var c=new Al,p=this.yieldPos,d=this.awaitPos,f=this.awaitIdentPos;this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0;var g=this.parseExprList(Yu.parenR,this.options.ecmaVersion>=8,!1,c);if(n&&!h&&this.shouldParseAsyncArrow())return this.checkPatternErrors(c,!1),this.checkYieldAwaitInDefaultParams(),this.awaitIdentPos>0&&this.raise(this.awaitIdentPos,"Cannot use 'await' as identifier inside an async function"),this.yieldPos=p,this.awaitPos=d,this.awaitIdentPos=f,this.parseSubscriptAsyncArrow(t,i,g,a);this.checkExpressionErrors(c,!0),this.yieldPos=p||this.yieldPos,this.awaitPos=d||this.awaitPos,this.awaitIdentPos=f||this.awaitIdentPos;var m=this.startNodeAt(t,i);m.callee=e,m.arguments=g,o&&(m.optional=h),e=this.finishNode(m,"CallExpression")}else if(this.type===Yu.backQuote){(h||s)&&this.raise(this.start,"Optional chaining cannot appear in the tag of tagged template expressions");var y=this.startNodeAt(t,i);y.tag=e,y.quasi=this.parseTemplate({isTagged:!0}),e=this.finishNode(y,"TaggedTemplateExpression")}return e},Nl.parseExprAtom=function(e,t,i){this.type===Yu.slash&&this.readRegexp();var r,n=this.potentialArrowAt===this.start;switch(this.type){case Yu._super:return this.allowSuper||this.raise(this.start,"'super' keyword outside a method"),r=this.startNode(),this.next(),this.type!==Yu.parenL||this.allowDirectSuper||this.raise(r.start,"super() call outside constructor of a subclass"),this.type!==Yu.dot&&this.type!==Yu.bracketL&&this.type!==Yu.parenL&&this.unexpected(),this.finishNode(r,"Super");case Yu._this:return r=this.startNode(),this.next(),this.finishNode(r,"ThisExpression");case Yu.name:var s=this.start,a=this.startLoc,o=this.containsEsc,h=this.parseIdent(!1);if(this.options.ecmaVersion>=8&&!o&&"async"===h.name&&!this.canInsertSemicolon()&&this.eat(Yu._function))return this.overrideContext(Ol.f_expr),this.parseFunction(this.startNodeAt(s,a),0,!1,!0,t);if(n&&!this.canInsertSemicolon()){if(this.eat(Yu.arrow))return this.parseArrowExpression(this.startNodeAt(s,a),[h],!1,t);if(this.options.ecmaVersion>=8&&"async"===h.name&&this.type===Yu.name&&!o&&(!this.potentialArrowInForAwait||"of"!==this.value||this.containsEsc))return h=this.parseIdent(!1),!this.canInsertSemicolon()&&this.eat(Yu.arrow)||this.unexpected(),this.parseArrowExpression(this.startNodeAt(s,a),[h],!0,t)}return h;case Yu.regexp:var u=this.value;return(r=this.parseLiteral(u.value)).regex={pattern:u.pattern,flags:u.flags},r;case Yu.num:case Yu.string:return this.parseLiteral(this.value);case Yu._null:case Yu._true:case Yu._false:return(r=this.startNode()).value=this.type===Yu._null?null:this.type===Yu._true,r.raw=this.type.keyword,this.next(),this.finishNode(r,"Literal");case Yu.parenL:var l=this.start,c=this.parseParenAndDistinguishExpression(n,t);return e&&(e.parenthesizedAssign<0&&!this.isSimpleAssignTarget(c)&&(e.parenthesizedAssign=l),e.parenthesizedBind<0&&(e.parenthesizedBind=l)),c;case Yu.bracketL:return r=this.startNode(),this.next(),r.elements=this.parseExprList(Yu.bracketR,!0,!0,e),this.finishNode(r,"ArrayExpression");case Yu.braceL:return this.overrideContext(Ol.b_expr),this.parseObj(!1,e);case Yu._function:return r=this.startNode(),this.next(),this.parseFunction(r,0);case Yu._class:return this.parseClass(this.startNode(),!1);case Yu._new:return this.parseNew();case Yu.backQuote:return this.parseTemplate();case Yu._import:return this.options.ecmaVersion>=11?this.parseExprImport(i):this.unexpected();default:return this.parseExprAtomDefault()}},Nl.parseExprAtomDefault=function(){this.unexpected()},Nl.parseExprImport=function(e){var t=this.startNode();if(this.containsEsc&&this.raiseRecoverable(this.start,"Escape sequence in keyword import"),this.next(),this.type===Yu.parenL&&!e)return this.parseDynamicImport(t);if(this.type===Yu.dot){var i=this.startNodeAt(t.start,t.loc&&t.loc.start);return i.name="import",t.meta=this.finishNode(i,"Identifier"),this.parseImportMeta(t)}this.unexpected()},Nl.parseDynamicImport=function(e){if(this.next(),e.source=this.parseMaybeAssign(),this.options.ecmaVersion>=16)this.eat(Yu.parenR)?e.options=null:(this.expect(Yu.comma),this.afterTrailingComma(Yu.parenR)?e.options=null:(e.options=this.parseMaybeAssign(),this.eat(Yu.parenR)||(this.expect(Yu.comma),this.afterTrailingComma(Yu.parenR)||this.unexpected())));else if(!this.eat(Yu.parenR)){var t=this.start;this.eat(Yu.comma)&&this.eat(Yu.parenR)?this.raiseRecoverable(t,"Trailing comma is not allowed in import()"):this.unexpected(t)}return this.finishNode(e,"ImportExpression")},Nl.parseImportMeta=function(e){this.next();var t=this.containsEsc;return e.property=this.parseIdent(!0),"meta"!==e.property.name&&this.raiseRecoverable(e.property.start,"The only valid meta property for import is 'import.meta'"),t&&this.raiseRecoverable(e.start,"'import.meta' must not contain escaped characters"),"module"===this.options.sourceType||this.options.allowImportExportEverywhere||this.raiseRecoverable(e.start,"Cannot use 'import.meta' outside a module"),this.finishNode(e,"MetaProperty")},Nl.parseLiteral=function(e){var t=this.startNode();return t.value=e,t.raw=this.input.slice(this.start,this.end),110===t.raw.charCodeAt(t.raw.length-1)&&(t.bigint=null!=t.value?t.value.toString():t.raw.slice(0,-1).replace(/_/g,"")),this.next(),this.finishNode(t,"Literal")},Nl.parseParenExpression=function(){this.expect(Yu.parenL);var e=this.parseExpression();return this.expect(Yu.parenR),e},Nl.shouldParseArrow=function(e){return!this.canInsertSemicolon()},Nl.parseParenAndDistinguishExpression=function(e,t){var i,r=this.start,n=this.startLoc,s=this.options.ecmaVersion>=8;if(this.options.ecmaVersion>=6){this.next();var a,o=this.start,h=this.startLoc,u=[],l=!0,c=!1,p=new Al,d=this.yieldPos,f=this.awaitPos;for(this.yieldPos=0,this.awaitPos=0;this.type!==Yu.parenR;){if(l?l=!1:this.expect(Yu.comma),s&&this.afterTrailingComma(Yu.parenR,!0)){c=!0;break}if(this.type===Yu.ellipsis){a=this.start,u.push(this.parseParenItem(this.parseRestBinding())),this.type===Yu.comma&&this.raiseRecoverable(this.start,"Comma is not permitted after the rest element");break}u.push(this.parseMaybeAssign(!1,p,this.parseParenItem))}var g=this.lastTokEnd,m=this.lastTokEndLoc;if(this.expect(Yu.parenR),e&&this.shouldParseArrow(u)&&this.eat(Yu.arrow))return this.checkPatternErrors(p,!1),this.checkYieldAwaitInDefaultParams(),this.yieldPos=d,this.awaitPos=f,this.parseParenArrowList(r,n,u,t);u.length&&!c||this.unexpected(this.lastTokStart),a&&this.unexpected(a),this.checkExpressionErrors(p,!0),this.yieldPos=d||this.yieldPos,this.awaitPos=f||this.awaitPos,u.length>1?((i=this.startNodeAt(o,h)).expressions=u,this.finishNodeAt(i,"SequenceExpression",g,m)):i=u[0]}else i=this.parseParenExpression();if(this.options.preserveParens){var y=this.startNodeAt(r,n);return y.expression=i,this.finishNode(y,"ParenthesizedExpression")}return i},Nl.parseParenItem=function(e){return e},Nl.parseParenArrowList=function(e,t,i,r){return this.parseArrowExpression(this.startNodeAt(e,t),i,!1,r)};var Ul=[];Nl.parseNew=function(){this.containsEsc&&this.raiseRecoverable(this.start,"Escape sequence in keyword new");var e=this.startNode();if(this.next(),this.options.ecmaVersion>=6&&this.type===Yu.dot){var t=this.startNodeAt(e.start,e.loc&&e.loc.start);t.name="new",e.meta=this.finishNode(t,"Identifier"),this.next();var i=this.containsEsc;return e.property=this.parseIdent(!0),"target"!==e.property.name&&this.raiseRecoverable(e.property.start,"The only valid meta property for new is 'new.target'"),i&&this.raiseRecoverable(e.start,"'new.target' must not contain escaped characters"),this.allowNewDotTarget||this.raiseRecoverable(e.start,"'new.target' can only be used in functions and class static block"),this.finishNode(e,"MetaProperty")}var r=this.start,n=this.startLoc;return e.callee=this.parseSubscripts(this.parseExprAtom(null,!1,!0),r,n,!0,!1),this.eat(Yu.parenL)?e.arguments=this.parseExprList(Yu.parenR,this.options.ecmaVersion>=8,!1):e.arguments=Ul,this.finishNode(e,"NewExpression")},Nl.parseTemplateElement=function(e){var t=e.isTagged,i=this.startNode();return this.type===Yu.invalidTemplate?(t||this.raiseRecoverable(this.start,"Bad escape sequence in untagged template literal"),i.value={raw:this.value.replace(/\r\n?/g,"\n"),cooked:null}):i.value={raw:this.input.slice(this.start,this.end).replace(/\r\n?/g,"\n"),cooked:this.value},this.next(),i.tail=this.type===Yu.backQuote,this.finishNode(i,"TemplateElement")},Nl.parseTemplate=function(e){void 0===e&&(e={});var t=e.isTagged;void 0===t&&(t=!1);var i=this.startNode();this.next(),i.expressions=[];var r=this.parseTemplateElement({isTagged:t});for(i.quasis=[r];!r.tail;)this.type===Yu.eof&&this.raise(this.pos,"Unterminated template literal"),this.expect(Yu.dollarBraceL),i.expressions.push(this.parseExpression()),this.expect(Yu.braceR),i.quasis.push(r=this.parseTemplateElement({isTagged:t}));return this.next(),this.finishNode(i,"TemplateLiteral")},Nl.isAsyncProp=function(e){return!e.computed&&"Identifier"===e.key.type&&"async"===e.key.name&&(this.type===Yu.name||this.type===Yu.num||this.type===Yu.string||this.type===Yu.bracketL||this.type.keyword||this.options.ecmaVersion>=9&&this.type===Yu.star)&&!Zu.test(this.input.slice(this.lastTokEnd,this.start))},Nl.parseObj=function(e,t){var i=this.startNode(),r=!0,n={};for(i.properties=[],this.next();!this.eat(Yu.braceR);){if(r)r=!1;else if(this.expect(Yu.comma),this.options.ecmaVersion>=5&&this.afterTrailingComma(Yu.braceR))break;var s=this.parseProperty(e,t);e||this.checkPropClash(s,n,t),i.properties.push(s)}return this.finishNode(i,e?"ObjectPattern":"ObjectExpression")},Nl.parseProperty=function(e,t){var i,r,n,s,a=this.startNode();if(this.options.ecmaVersion>=9&&this.eat(Yu.ellipsis))return e?(a.argument=this.parseIdent(!1),this.type===Yu.comma&&this.raiseRecoverable(this.start,"Comma is not permitted after the rest element"),this.finishNode(a,"RestElement")):(a.argument=this.parseMaybeAssign(!1,t),this.type===Yu.comma&&t&&t.trailingComma<0&&(t.trailingComma=this.start),this.finishNode(a,"SpreadElement"));this.options.ecmaVersion>=6&&(a.method=!1,a.shorthand=!1,(e||t)&&(n=this.start,s=this.startLoc),e||(i=this.eat(Yu.star)));var o=this.containsEsc;return this.parsePropertyName(a),!e&&!o&&this.options.ecmaVersion>=8&&!i&&this.isAsyncProp(a)?(r=!0,i=this.options.ecmaVersion>=9&&this.eat(Yu.star),this.parsePropertyName(a)):r=!1,this.parsePropertyValue(a,e,i,r,n,s,t,o),this.finishNode(a,"Property")},Nl.parseGetterSetter=function(e){var t=e.key.name;this.parsePropertyName(e),e.value=this.parseMethod(!1),e.kind=t;var i="get"===e.kind?0:1;if(e.value.params.length!==i){var r=e.value.start;"get"===e.kind?this.raiseRecoverable(r,"getter should have no params"):this.raiseRecoverable(r,"setter should have exactly one param")}else"set"===e.kind&&"RestElement"===e.value.params[0].type&&this.raiseRecoverable(e.value.params[0].start,"Setter cannot use rest params")},Nl.parsePropertyValue=function(e,t,i,r,n,s,a,o){(i||r)&&this.type===Yu.colon&&this.unexpected(),this.eat(Yu.colon)?(e.value=t?this.parseMaybeDefault(this.start,this.startLoc):this.parseMaybeAssign(!1,a),e.kind="init"):this.options.ecmaVersion>=6&&this.type===Yu.parenL?(t&&this.unexpected(),e.method=!0,e.value=this.parseMethod(i,r),e.kind="init"):t||o||!(this.options.ecmaVersion>=5)||e.computed||"Identifier"!==e.key.type||"get"!==e.key.name&&"set"!==e.key.name||this.type===Yu.comma||this.type===Yu.braceR||this.type===Yu.eq?this.options.ecmaVersion>=6&&!e.computed&&"Identifier"===e.key.type?((i||r)&&this.unexpected(),this.checkUnreserved(e.key),"await"!==e.key.name||this.awaitIdentPos||(this.awaitIdentPos=n),t?e.value=this.parseMaybeDefault(n,s,this.copyNode(e.key)):this.type===Yu.eq&&a?(a.shorthandAssign<0&&(a.shorthandAssign=this.start),e.value=this.parseMaybeDefault(n,s,this.copyNode(e.key))):e.value=this.copyNode(e.key),e.kind="init",e.shorthand=!0):this.unexpected():((i||r)&&this.unexpected(),this.parseGetterSetter(e))},Nl.parsePropertyName=function(e){if(this.options.ecmaVersion>=6){if(this.eat(Yu.bracketL))return e.computed=!0,e.key=this.parseMaybeAssign(),this.expect(Yu.bracketR),e.key;e.computed=!1}return e.key=this.type===Yu.num||this.type===Yu.string?this.parseExprAtom():this.parseIdent("never"!==this.options.allowReserved)},Nl.initFunction=function(e){e.id=null,this.options.ecmaVersion>=6&&(e.generator=e.expression=!1),this.options.ecmaVersion>=8&&(e.async=!1)},Nl.parseMethod=function(e,t,i){var r=this.startNode(),n=this.yieldPos,s=this.awaitPos,a=this.awaitIdentPos;return this.initFunction(r),this.options.ecmaVersion>=6&&(r.generator=e),this.options.ecmaVersion>=8&&(r.async=!!t),this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,this.enterScope(64|vl(t,r.generator)|(i?128:0)),this.expect(Yu.parenL),r.params=this.parseBindingList(Yu.parenR,!1,this.options.ecmaVersion>=8),this.checkYieldAwaitInDefaultParams(),this.parseFunctionBody(r,!1,!0,!1),this.yieldPos=n,this.awaitPos=s,this.awaitIdentPos=a,this.finishNode(r,"FunctionExpression")},Nl.parseArrowExpression=function(e,t,i,r){var n=this.yieldPos,s=this.awaitPos,a=this.awaitIdentPos;return this.enterScope(16|vl(i,!1)),this.initFunction(e),this.options.ecmaVersion>=8&&(e.async=!!i),this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,e.params=this.toAssignableList(t,!0),this.parseFunctionBody(e,!0,!1,r),this.yieldPos=n,this.awaitPos=s,this.awaitIdentPos=a,this.finishNode(e,"ArrowFunctionExpression")},Nl.parseFunctionBody=function(e,t,i,r){var n=t&&this.type!==Yu.braceL,s=this.strict,a=!1;if(n)e.body=this.parseMaybeAssign(r),e.expression=!0,this.checkParams(e,!1);else{var o=this.options.ecmaVersion>=7&&!this.isSimpleParamList(e.params);s&&!o||(a=this.strictDirective(this.end))&&o&&this.raiseRecoverable(e.start,"Illegal 'use strict' directive in function with non-simple parameter list");var h=this.labels;this.labels=[],a&&(this.strict=!0),this.checkParams(e,!s&&!a&&!t&&!i&&this.isSimpleParamList(e.params)),this.strict&&e.id&&this.checkLValSimple(e.id,5),e.body=this.parseBlock(!1,void 0,a&&!s),e.expression=!1,this.adaptDirectivePrologue(e.body.body),this.labels=h}this.exitScope()},Nl.isSimpleParamList=function(e){for(var t=0,i=e;t<i.length;t+=1){if("Identifier"!==i[t].type)return!1}return!0},Nl.checkParams=function(e,t){for(var i=Object.create(null),r=0,n=e.params;r<n.length;r+=1){var s=n[r];this.checkLValInnerPattern(s,1,t?null:i)}},Nl.parseExprList=function(e,t,i,r){for(var n=[],s=!0;!this.eat(e);){if(s)s=!1;else if(this.expect(Yu.comma),t&&this.afterTrailingComma(e))break;var a=void 0;i&&this.type===Yu.comma?a=null:this.type===Yu.ellipsis?(a=this.parseSpread(r),r&&this.type===Yu.comma&&r.trailingComma<0&&(r.trailingComma=this.start)):a=this.parseMaybeAssign(!1,r),n.push(a)}return n},Nl.checkUnreserved=function(e){var t=e.start,i=e.end,r=e.name;(this.inGenerator&&"yield"===r&&this.raiseRecoverable(t,"Cannot use 'yield' as identifier inside a generator"),this.inAsync&&"await"===r&&this.raiseRecoverable(t,"Cannot use 'await' as identifier inside an async function"),this.currentThisScope().flags&xl||"arguments"!==r||this.raiseRecoverable(t,"Cannot use 'arguments' in class field initializer"),!this.inClassStaticBlock||"arguments"!==r&&"await"!==r||this.raise(t,"Cannot use "+r+" in class static initialization block"),this.keywords.test(r)&&this.raise(t,"Unexpected keyword '"+r+"'"),this.options.ecmaVersion<6&&-1!==this.input.slice(t,i).indexOf("\\"))||(this.strict?this.reservedWordsStrict:this.reservedWords).test(r)&&(this.inAsync||"await"!==r||this.raiseRecoverable(t,"Cannot use keyword 'await' outside an async function"),this.raiseRecoverable(t,"The keyword '"+r+"' is reserved"))},Nl.parseIdent=function(e){var t=this.parseIdentNode();return this.next(!!e),this.finishNode(t,"Identifier"),e||(this.checkUnreserved(t),"await"!==t.name||this.awaitIdentPos||(this.awaitIdentPos=t.start)),t},Nl.parseIdentNode=function(){var e=this.startNode();return this.type===Yu.name?e.name=this.value:this.type.keyword?(e.name=this.type.keyword,"class"!==e.name&&"function"!==e.name||this.lastTokEnd===this.lastTokStart+1&&46===this.input.charCodeAt(this.lastTokStart)||this.context.pop(),this.type=Yu.name):this.unexpected(),e},Nl.parsePrivateIdent=function(){var e=this.startNode();return this.type===Yu.privateId?e.name=this.value:this.unexpected(),this.next(),this.finishNode(e,"PrivateIdentifier"),this.options.checkPrivateFields&&(0===this.privateNameStack.length?this.raise(e.start,"Private field '#"+e.name+"' must be declared in an enclosing class"):this.privateNameStack[this.privateNameStack.length-1].used.push(e)),e},Nl.parseYield=function(e){this.yieldPos||(this.yieldPos=this.start);var t=this.startNode();return this.next(),this.type===Yu.semi||this.canInsertSemicolon()||this.type!==Yu.star&&!this.type.startsExpr?(t.delegate=!1,t.argument=null):(t.delegate=this.eat(Yu.star),t.argument=this.parseMaybeAssign(e)),this.finishNode(t,"YieldExpression")},Nl.parseAwait=function(e){this.awaitPos||(this.awaitPos=this.start);var t=this.startNode();return this.next(),t.argument=this.parseMaybeUnary(null,!0,!1,e),this.finishNode(t,"AwaitExpression")};var zl=bl.prototype;zl.raise=function(e,t){var i=dl(this.input,e);t+=" ("+i.line+":"+i.column+")",this.sourceFile&&(t+=" in "+this.sourceFile);var r=new SyntaxError(t);throw r.pos=e,r.loc=i,r.raisedAt=this.pos,r},zl.raiseRecoverable=zl.raise,zl.curPosition=function(){if(this.options.locations)return new cl(this.curLine,this.pos-this.lineStart)};var Gl=bl.prototype,jl=function(e){this.flags=e,this.var=[],this.lexical=[],this.functions=[]};Gl.enterScope=function(e){this.scopeStack.push(new jl(e))},Gl.exitScope=function(){this.scopeStack.pop()},Gl.treatFunctionsAsVarInScope=function(e){return 2&e.flags||!this.inModule&&1&e.flags},Gl.declareName=function(e,t,i){var r=!1;if(2===t){var n=this.currentScope();r=n.lexical.indexOf(e)>-1||n.functions.indexOf(e)>-1||n.var.indexOf(e)>-1,n.lexical.push(e),this.inModule&&1&n.flags&&delete this.undefinedExports[e]}else if(4===t){this.currentScope().lexical.push(e)}else if(3===t){var s=this.currentScope();r=this.treatFunctionsAsVar?s.lexical.indexOf(e)>-1:s.lexical.indexOf(e)>-1||s.var.indexOf(e)>-1,s.functions.push(e)}else for(var a=this.scopeStack.length-1;a>=0;--a){var o=this.scopeStack[a];if(o.lexical.indexOf(e)>-1&&!(32&o.flags&&o.lexical[0]===e)||!this.treatFunctionsAsVarInScope(o)&&o.functions.indexOf(e)>-1){r=!0;break}if(o.var.push(e),this.inModule&&1&o.flags&&delete this.undefinedExports[e],o.flags&xl)break}r&&this.raiseRecoverable(i,"Identifier '"+e+"' has already been declared")},Gl.checkLocalExport=function(e){-1===this.scopeStack[0].lexical.indexOf(e.name)&&-1===this.scopeStack[0].var.indexOf(e.name)&&(this.undefinedExports[e.name]=e)},Gl.currentScope=function(){return this.scopeStack[this.scopeStack.length-1]},Gl.currentVarScope=function(){for(var e=this.scopeStack.length-1;;e--){var t=this.scopeStack[e];if(771&t.flags)return t}},Gl.currentThisScope=function(){for(var e=this.scopeStack.length-1;;e--){var t=this.scopeStack[e];if(771&t.flags&&!(16&t.flags))return t}};var $l=function(e,t,i){this.type="",this.start=t,this.end=0,e.options.locations&&(this.loc=new pl(e,i)),e.options.directSourceFile&&(this.sourceFile=e.options.directSourceFile),e.options.ranges&&(this.range=[t,0])},ql=bl.prototype;function Hl(e,t,i,r){return e.type=t,e.end=i,this.options.locations&&(e.loc.end=r),this.options.ranges&&(e.range[1]=i),e}ql.startNode=function(){return new $l(this,this.start,this.startLoc)},ql.startNodeAt=function(e,t){return new $l(this,e,t)},ql.finishNode=function(e,t){return Hl.call(this,e,t,this.lastTokEnd,this.lastTokEndLoc)},ql.finishNodeAt=function(e,t,i,r){return Hl.call(this,e,t,i,r)},ql.copyNode=function(e){var t=new $l(this,e.start,this.startLoc);for(var i in e)t[i]=e[i];return t};var Wl="ASCII ASCII_Hex_Digit AHex Alphabetic Alpha Any Assigned Bidi_Control Bidi_C Bidi_Mirrored Bidi_M Case_Ignorable CI Cased Changes_When_Casefolded CWCF Changes_When_Casemapped CWCM Changes_When_Lowercased CWL Changes_When_NFKC_Casefolded CWKCF Changes_When_Titlecased CWT Changes_When_Uppercased CWU Dash Default_Ignorable_Code_Point DI Deprecated Dep Diacritic Dia Emoji Emoji_Component Emoji_Modifier Emoji_Modifier_Base Emoji_Presentation Extender Ext Grapheme_Base Gr_Base Grapheme_Extend Gr_Ext Hex_Digit Hex IDS_Binary_Operator IDSB IDS_Trinary_Operator IDST ID_Continue IDC ID_Start IDS Ideographic Ideo Join_Control Join_C Logical_Order_Exception LOE Lowercase Lower Math Noncharacter_Code_Point NChar Pattern_Syntax Pat_Syn Pattern_White_Space Pat_WS Quotation_Mark QMark Radical Regional_Indicator RI Sentence_Terminal STerm Soft_Dotted SD Terminal_Punctuation Term Unified_Ideograph UIdeo Uppercase Upper Variation_Selector VS White_Space space XID_Continue XIDC XID_Start XIDS",Xl=Wl+" Extended_Pictographic",Yl=Xl+" EBase EComp EMod EPres ExtPict",Zl={9:Wl,10:Xl,11:Xl,12:Yl,13:Yl,14:Yl},Kl={9:"",10:"",11:"",12:"",13:"",14:"Basic_Emoji Emoji_Keycap_Sequence RGI_Emoji_Modifier_Sequence RGI_Emoji_Flag_Sequence RGI_Emoji_Tag_Sequence RGI_Emoji_ZWJ_Sequence RGI_Emoji"},Jl="Cased_Letter LC Close_Punctuation Pe Connector_Punctuation Pc Control Cc cntrl Currency_Symbol Sc Dash_Punctuation Pd Decimal_Number Nd digit Enclosing_Mark Me Final_Punctuation Pf Format Cf Initial_Punctuation Pi Letter L Letter_Number Nl Line_Separator Zl Lowercase_Letter Ll Mark M Combining_Mark Math_Symbol Sm Modifier_Letter Lm Modifier_Symbol Sk Nonspacing_Mark Mn Number N Open_Punctuation Ps Other C Other_Letter Lo Other_Number No Other_Punctuation Po Other_Symbol So Paragraph_Separator Zp Private_Use Co Punctuation P punct Separator Z Space_Separator Zs Spacing_Mark Mc Surrogate Cs Symbol S Titlecase_Letter Lt Unassigned Cn Uppercase_Letter Lu",Ql="Adlam Adlm Ahom Anatolian_Hieroglyphs Hluw Arabic Arab Armenian Armn Avestan Avst Balinese Bali Bamum Bamu Bassa_Vah Bass Batak Batk Bengali Beng Bhaiksuki Bhks Bopomofo Bopo Brahmi Brah Braille Brai Buginese Bugi Buhid Buhd Canadian_Aboriginal Cans Carian Cari Caucasian_Albanian Aghb Chakma Cakm Cham Cham Cherokee Cher Common Zyyy Coptic Copt Qaac Cuneiform Xsux Cypriot Cprt Cyrillic Cyrl Deseret Dsrt Devanagari Deva Duployan Dupl Egyptian_Hieroglyphs Egyp Elbasan Elba Ethiopic Ethi Georgian Geor Glagolitic Glag Gothic Goth Grantha Gran Greek Grek Gujarati Gujr Gurmukhi Guru Han Hani Hangul Hang Hanunoo Hano Hatran Hatr Hebrew Hebr Hiragana Hira Imperial_Aramaic Armi Inherited Zinh Qaai Inscriptional_Pahlavi Phli Inscriptional_Parthian Prti Javanese Java Kaithi Kthi Kannada Knda Katakana Kana Kayah_Li Kali Kharoshthi Khar Khmer Khmr Khojki Khoj Khudawadi Sind Lao Laoo Latin Latn Lepcha Lepc Limbu Limb Linear_A Lina Linear_B Linb Lisu Lisu Lycian Lyci Lydian Lydi Mahajani Mahj Malayalam Mlym Mandaic Mand Manichaean Mani Marchen Marc Masaram_Gondi Gonm Meetei_Mayek Mtei Mende_Kikakui Mend Meroitic_Cursive Merc Meroitic_Hieroglyphs Mero Miao Plrd Modi Mongolian Mong Mro Mroo Multani Mult Myanmar Mymr Nabataean Nbat New_Tai_Lue Talu Newa Newa Nko Nkoo Nushu Nshu Ogham Ogam Ol_Chiki Olck Old_Hungarian Hung Old_Italic Ital Old_North_Arabian Narb Old_Permic Perm Old_Persian Xpeo Old_South_Arabian Sarb Old_Turkic Orkh Oriya Orya Osage Osge Osmanya Osma Pahawh_Hmong Hmng Palmyrene Palm Pau_Cin_Hau Pauc Phags_Pa Phag Phoenician Phnx Psalter_Pahlavi Phlp Rejang Rjng Runic Runr Samaritan Samr Saurashtra Saur Sharada Shrd Shavian Shaw Siddham Sidd SignWriting Sgnw Sinhala Sinh Sora_Sompeng Sora Soyombo Soyo Sundanese Sund Syloti_Nagri Sylo Syriac Syrc Tagalog Tglg Tagbanwa Tagb Tai_Le Tale Tai_Tham Lana Tai_Viet Tavt Takri Takr Tamil Taml Tangut Tang Telugu Telu Thaana Thaa Thai Thai Tibetan Tibt Tifinagh Tfng Tirhuta Tirh Ugaritic Ugar Vai Vaii Warang_Citi Wara Yi Yiii Zanabazar_Square Zanb",ec=Ql+" Dogra Dogr Gunjala_Gondi Gong Hanifi_Rohingya Rohg Makasar Maka Medefaidrin Medf Old_Sogdian Sogo Sogdian Sogd",tc=ec+" Elymaic Elym Nandinagari Nand Nyiakeng_Puachue_Hmong Hmnp Wancho Wcho",ic=tc+" Chorasmian Chrs Diak Dives_Akuru Khitan_Small_Script Kits Yezi Yezidi",rc=ic+" Cypro_Minoan Cpmn Old_Uyghur Ougr Tangsa Tnsa Toto Vithkuqi Vith",nc={9:Ql,10:ec,11:tc,12:ic,13:rc,14:rc+" Gara Garay Gukh Gurung_Khema Hrkt Katakana_Or_Hiragana Kawi Kirat_Rai Krai Nag_Mundari Nagm Ol_Onal Onao Sunu Sunuwar Todhri Todr Tulu_Tigalari Tutg Unknown Zzzz"},sc={};function ac(e){var t=sc[e]={binary:hl(Zl[e]+" "+Jl),binaryOfStrings:hl(Kl[e]),nonBinary:{General_Category:hl(Jl),Script:hl(nc[e])}};t.nonBinary.Script_Extensions=t.nonBinary.Script,t.nonBinary.gc=t.nonBinary.General_Category,t.nonBinary.sc=t.nonBinary.Script,t.nonBinary.scx=t.nonBinary.Script_Extensions}for(var oc=0,hc=[9,10,11,12,13,14];oc<hc.length;oc+=1){ac(hc[oc])}var uc=bl.prototype,lc=function(e,t){this.parent=e,this.base=t||this};lc.prototype.separatedFrom=function(e){for(var t=this;t;t=t.parent)for(var i=e;i;i=i.parent)if(t.base===i.base&&t!==i)return!0;return!1},lc.prototype.sibling=function(){return new lc(this.parent,this.base)};var cc=function(e){this.parser=e,this.validFlags="gim"+(e.options.ecmaVersion>=6?"uy":"")+(e.options.ecmaVersion>=9?"s":"")+(e.options.ecmaVersion>=13?"d":"")+(e.options.ecmaVersion>=15?"v":""),this.unicodeProperties=sc[e.options.ecmaVersion>=14?14:e.options.ecmaVersion],this.source="",this.flags="",this.start=0,this.switchU=!1,this.switchV=!1,this.switchN=!1,this.pos=0,this.lastIntValue=0,this.lastStringValue="",this.lastAssertionIsQuantifiable=!1,this.numCapturingParens=0,this.maxBackReference=0,this.groupNames=Object.create(null),this.backReferenceNames=[],this.branchID=null};function pc(e){return 105===e||109===e||115===e}function dc(e){return 36===e||e>=40&&e<=43||46===e||63===e||e>=91&&e<=94||e>=123&&e<=125}function fc(e){return e>=65&&e<=90||e>=97&&e<=122}cc.prototype.reset=function(e,t,i){var r=-1!==i.indexOf("v"),n=-1!==i.indexOf("u");this.start=0|e,this.source=t+"",this.flags=i,r&&this.parser.options.ecmaVersion>=15?(this.switchU=!0,this.switchV=!0,this.switchN=!0):(this.switchU=n&&this.parser.options.ecmaVersion>=6,this.switchV=!1,this.switchN=n&&this.parser.options.ecmaVersion>=9)},cc.prototype.raise=function(e){this.parser.raiseRecoverable(this.start,"Invalid regular expression: /"+this.source+"/: "+e)},cc.prototype.at=function(e,t){void 0===t&&(t=!1);var i=this.source,r=i.length;if(e>=r)return-1;var n=i.charCodeAt(e);if(!t&&!this.switchU||n<=55295||n>=57344||e+1>=r)return n;var s=i.charCodeAt(e+1);return s>=56320&&s<=57343?(n<<10)+s-56613888:n},cc.prototype.nextIndex=function(e,t){void 0===t&&(t=!1);var i=this.source,r=i.length;if(e>=r)return r;var n,s=i.charCodeAt(e);return!t&&!this.switchU||s<=55295||s>=57344||e+1>=r||(n=i.charCodeAt(e+1))<56320||n>57343?e+1:e+2},cc.prototype.current=function(e){return void 0===e&&(e=!1),this.at(this.pos,e)},cc.prototype.lookahead=function(e){return void 0===e&&(e=!1),this.at(this.nextIndex(this.pos,e),e)},cc.prototype.advance=function(e){void 0===e&&(e=!1),this.pos=this.nextIndex(this.pos,e)},cc.prototype.eat=function(e,t){return void 0===t&&(t=!1),this.current(t)===e&&(this.advance(t),!0)},cc.prototype.eatChars=function(e,t){void 0===t&&(t=!1);for(var i=this.pos,r=0,n=e;r<n.length;r+=1){var s=n[r],a=this.at(i,t);if(-1===a||a!==s)return!1;i=this.nextIndex(i,t)}return this.pos=i,!0},uc.validateRegExpFlags=function(e){for(var t=e.validFlags,i=e.flags,r=!1,n=!1,s=0;s<i.length;s++){var a=i.charAt(s);-1===t.indexOf(a)&&this.raise(e.start,"Invalid regular expression flag"),i.indexOf(a,s+1)>-1&&this.raise(e.start,"Duplicate regular expression flag"),"u"===a&&(r=!0),"v"===a&&(n=!0)}this.options.ecmaVersion>=15&&r&&n&&this.raise(e.start,"Invalid regular expression flag")},uc.validateRegExpPattern=function(e){this.regexp_pattern(e),!e.switchN&&this.options.ecmaVersion>=9&&function(e){for(var t in e)return!0;return!1}(e.groupNames)&&(e.switchN=!0,this.regexp_pattern(e))},uc.regexp_pattern=function(e){e.pos=0,e.lastIntValue=0,e.lastStringValue="",e.lastAssertionIsQuantifiable=!1,e.numCapturingParens=0,e.maxBackReference=0,e.groupNames=Object.create(null),e.backReferenceNames.length=0,e.branchID=null,this.regexp_disjunction(e),e.pos!==e.source.length&&(e.eat(41)&&e.raise("Unmatched ')'"),(e.eat(93)||e.eat(125))&&e.raise("Lone quantifier brackets")),e.maxBackReference>e.numCapturingParens&&e.raise("Invalid escape");for(var t=0,i=e.backReferenceNames;t<i.length;t+=1){var r=i[t];e.groupNames[r]||e.raise("Invalid named capture referenced")}},uc.regexp_disjunction=function(e){var t=this.options.ecmaVersion>=16;for(t&&(e.branchID=new lc(e.branchID,null)),this.regexp_alternative(e);e.eat(124);)t&&(e.branchID=e.branchID.sibling()),this.regexp_alternative(e);t&&(e.branchID=e.branchID.parent),this.regexp_eatQuantifier(e,!0)&&e.raise("Nothing to repeat"),e.eat(123)&&e.raise("Lone quantifier brackets")},uc.regexp_alternative=function(e){for(;e.pos<e.source.length&&this.regexp_eatTerm(e););},uc.regexp_eatTerm=function(e){return this.regexp_eatAssertion(e)?(e.lastAssertionIsQuantifiable&&this.regexp_eatQuantifier(e)&&e.switchU&&e.raise("Invalid quantifier"),!0):!!(e.switchU?this.regexp_eatAtom(e):this.regexp_eatExtendedAtom(e))&&(this.regexp_eatQuantifier(e),!0)},uc.regexp_eatAssertion=function(e){var t=e.pos;if(e.lastAssertionIsQuantifiable=!1,e.eat(94)||e.eat(36))return!0;if(e.eat(92)){if(e.eat(66)||e.eat(98))return!0;e.pos=t}if(e.eat(40)&&e.eat(63)){var i=!1;if(this.options.ecmaVersion>=9&&(i=e.eat(60)),e.eat(61)||e.eat(33))return this.regexp_disjunction(e),e.eat(41)||e.raise("Unterminated group"),e.lastAssertionIsQuantifiable=!i,!0}return e.pos=t,!1},uc.regexp_eatQuantifier=function(e,t){return void 0===t&&(t=!1),!!this.regexp_eatQuantifierPrefix(e,t)&&(e.eat(63),!0)},uc.regexp_eatQuantifierPrefix=function(e,t){return e.eat(42)||e.eat(43)||e.eat(63)||this.regexp_eatBracedQuantifier(e,t)},uc.regexp_eatBracedQuantifier=function(e,t){var i=e.pos;if(e.eat(123)){var r=0,n=-1;if(this.regexp_eatDecimalDigits(e)&&(r=e.lastIntValue,e.eat(44)&&this.regexp_eatDecimalDigits(e)&&(n=e.lastIntValue),e.eat(125)))return-1!==n&&n<r&&!t&&e.raise("numbers out of order in {} quantifier"),!0;e.switchU&&!t&&e.raise("Incomplete quantifier"),e.pos=i}return!1},uc.regexp_eatAtom=function(e){return this.regexp_eatPatternCharacters(e)||e.eat(46)||this.regexp_eatReverseSolidusAtomEscape(e)||this.regexp_eatCharacterClass(e)||this.regexp_eatUncapturingGroup(e)||this.regexp_eatCapturingGroup(e)},uc.regexp_eatReverseSolidusAtomEscape=function(e){var t=e.pos;if(e.eat(92)){if(this.regexp_eatAtomEscape(e))return!0;e.pos=t}return!1},uc.regexp_eatUncapturingGroup=function(e){var t=e.pos;if(e.eat(40)){if(e.eat(63)){if(this.options.ecmaVersion>=16){var i=this.regexp_eatModifiers(e),r=e.eat(45);if(i||r){for(var n=0;n<i.length;n++){var s=i.charAt(n);i.indexOf(s,n+1)>-1&&e.raise("Duplicate regular expression modifiers")}if(r){var a=this.regexp_eatModifiers(e);i||a||58!==e.current()||e.raise("Invalid regular expression modifiers");for(var o=0;o<a.length;o++){var h=a.charAt(o);(a.indexOf(h,o+1)>-1||i.indexOf(h)>-1)&&e.raise("Duplicate regular expression modifiers")}}}}if(e.eat(58)){if(this.regexp_disjunction(e),e.eat(41))return!0;e.raise("Unterminated group")}}e.pos=t}return!1},uc.regexp_eatCapturingGroup=function(e){if(e.eat(40)){if(this.options.ecmaVersion>=9?this.regexp_groupSpecifier(e):63===e.current()&&e.raise("Invalid group"),this.regexp_disjunction(e),e.eat(41))return e.numCapturingParens+=1,!0;e.raise("Unterminated group")}return!1},uc.regexp_eatModifiers=function(e){for(var t="",i=0;-1!==(i=e.current())&&pc(i);)t+=ul(i),e.advance();return t},uc.regexp_eatExtendedAtom=function(e){return e.eat(46)||this.regexp_eatReverseSolidusAtomEscape(e)||this.regexp_eatCharacterClass(e)||this.regexp_eatUncapturingGroup(e)||this.regexp_eatCapturingGroup(e)||this.regexp_eatInvalidBracedQuantifier(e)||this.regexp_eatExtendedPatternCharacter(e)},uc.regexp_eatInvalidBracedQuantifier=function(e){return this.regexp_eatBracedQuantifier(e,!0)&&e.raise("Nothing to repeat"),!1},uc.regexp_eatSyntaxCharacter=function(e){var t=e.current();return!!dc(t)&&(e.lastIntValue=t,e.advance(),!0)},uc.regexp_eatPatternCharacters=function(e){for(var t=e.pos,i=0;-1!==(i=e.current())&&!dc(i);)e.advance();return e.pos!==t},uc.regexp_eatExtendedPatternCharacter=function(e){var t=e.current();return!(-1===t||36===t||t>=40&&t<=43||46===t||63===t||91===t||94===t||124===t)&&(e.advance(),!0)},uc.regexp_groupSpecifier=function(e){if(e.eat(63)){this.regexp_eatGroupName(e)||e.raise("Invalid group");var t=this.options.ecmaVersion>=16,i=e.groupNames[e.lastStringValue];if(i)if(t)for(var r=0,n=i;r<n.length;r+=1){n[r].separatedFrom(e.branchID)||e.raise("Duplicate capture group name")}else e.raise("Duplicate capture group name");t?(i||(e.groupNames[e.lastStringValue]=[])).push(e.branchID):e.groupNames[e.lastStringValue]=!0}},uc.regexp_eatGroupName=function(e){if(e.lastStringValue="",e.eat(60)){if(this.regexp_eatRegExpIdentifierName(e)&&e.eat(62))return!0;e.raise("Invalid capture group name")}return!1},uc.regexp_eatRegExpIdentifierName=function(e){if(e.lastStringValue="",this.regexp_eatRegExpIdentifierStart(e)){for(e.lastStringValue+=ul(e.lastIntValue);this.regexp_eatRegExpIdentifierPart(e);)e.lastStringValue+=ul(e.lastIntValue);return!0}return!1},uc.regexp_eatRegExpIdentifierStart=function(e){var t=e.pos,i=this.options.ecmaVersion>=11,r=e.current(i);return e.advance(i),92===r&&this.regexp_eatRegExpUnicodeEscapeSequence(e,i)&&(r=e.lastIntValue),function(e){return zu(e,!0)||36===e||95===e}(r)?(e.lastIntValue=r,!0):(e.pos=t,!1)},uc.regexp_eatRegExpIdentifierPart=function(e){var t=e.pos,i=this.options.ecmaVersion>=11,r=e.current(i);return e.advance(i),92===r&&this.regexp_eatRegExpUnicodeEscapeSequence(e,i)&&(r=e.lastIntValue),function(e){return Gu(e,!0)||36===e||95===e||8204===e||8205===e}(r)?(e.lastIntValue=r,!0):(e.pos=t,!1)},uc.regexp_eatAtomEscape=function(e){return!!(this.regexp_eatBackReference(e)||this.regexp_eatCharacterClassEscape(e)||this.regexp_eatCharacterEscape(e)||e.switchN&&this.regexp_eatKGroupName(e))||(e.switchU&&(99===e.current()&&e.raise("Invalid unicode escape"),e.raise("Invalid escape")),!1)},uc.regexp_eatBackReference=function(e){var t=e.pos;if(this.regexp_eatDecimalEscape(e)){var i=e.lastIntValue;if(e.switchU)return i>e.maxBackReference&&(e.maxBackReference=i),!0;if(i<=e.numCapturingParens)return!0;e.pos=t}return!1},uc.regexp_eatKGroupName=function(e){if(e.eat(107)){if(this.regexp_eatGroupName(e))return e.backReferenceNames.push(e.lastStringValue),!0;e.raise("Invalid named reference")}return!1},uc.regexp_eatCharacterEscape=function(e){return this.regexp_eatControlEscape(e)||this.regexp_eatCControlLetter(e)||this.regexp_eatZero(e)||this.regexp_eatHexEscapeSequence(e)||this.regexp_eatRegExpUnicodeEscapeSequence(e,!1)||!e.switchU&&this.regexp_eatLegacyOctalEscapeSequence(e)||this.regexp_eatIdentityEscape(e)},uc.regexp_eatCControlLetter=function(e){var t=e.pos;if(e.eat(99)){if(this.regexp_eatControlLetter(e))return!0;e.pos=t}return!1},uc.regexp_eatZero=function(e){return 48===e.current()&&!yc(e.lookahead())&&(e.lastIntValue=0,e.advance(),!0)},uc.regexp_eatControlEscape=function(e){var t=e.current();return 116===t?(e.lastIntValue=9,e.advance(),!0):110===t?(e.lastIntValue=10,e.advance(),!0):118===t?(e.lastIntValue=11,e.advance(),!0):102===t?(e.lastIntValue=12,e.advance(),!0):114===t&&(e.lastIntValue=13,e.advance(),!0)},uc.regexp_eatControlLetter=function(e){var t=e.current();return!!fc(t)&&(e.lastIntValue=t%32,e.advance(),!0)},uc.regexp_eatRegExpUnicodeEscapeSequence=function(e,t){void 0===t&&(t=!1);var i,r=e.pos,n=t||e.switchU;if(e.eat(117)){if(this.regexp_eatFixedHexDigits(e,4)){var s=e.lastIntValue;if(n&&s>=55296&&s<=56319){var a=e.pos;if(e.eat(92)&&e.eat(117)&&this.regexp_eatFixedHexDigits(e,4)){var o=e.lastIntValue;if(o>=56320&&o<=57343)return e.lastIntValue=1024*(s-55296)+(o-56320)+65536,!0}e.pos=a,e.lastIntValue=s}return!0}if(n&&e.eat(123)&&this.regexp_eatHexDigits(e)&&e.eat(125)&&((i=e.lastIntValue)>=0&&i<=1114111))return!0;n&&e.raise("Invalid unicode escape"),e.pos=r}return!1},uc.regexp_eatIdentityEscape=function(e){if(e.switchU)return!!this.regexp_eatSyntaxCharacter(e)||!!e.eat(47)&&(e.lastIntValue=47,!0);var t=e.current();return!(99===t||e.switchN&&107===t)&&(e.lastIntValue=t,e.advance(),!0)},uc.regexp_eatDecimalEscape=function(e){e.lastIntValue=0;var t=e.current();if(t>=49&&t<=57){do{e.lastIntValue=10*e.lastIntValue+(t-48),e.advance()}while((t=e.current())>=48&&t<=57);return!0}return!1};function gc(e){return fc(e)||95===e}function mc(e){return gc(e)||yc(e)}function yc(e){return e>=48&&e<=57}function xc(e){return e>=48&&e<=57||e>=65&&e<=70||e>=97&&e<=102}function vc(e){return e>=65&&e<=70?e-65+10:e>=97&&e<=102?e-97+10:e-48}function bc(e){return e>=48&&e<=55}uc.regexp_eatCharacterClassEscape=function(e){var t=e.current();if(function(e){return 100===e||68===e||115===e||83===e||119===e||87===e}(t))return e.lastIntValue=-1,e.advance(),1;var i=!1;if(e.switchU&&this.options.ecmaVersion>=9&&((i=80===t)||112===t)){var r;if(e.lastIntValue=-1,e.advance(),e.eat(123)&&(r=this.regexp_eatUnicodePropertyValueExpression(e))&&e.eat(125))return i&&2===r&&e.raise("Invalid property name"),r;e.raise("Invalid property name")}return 0},uc.regexp_eatUnicodePropertyValueExpression=function(e){var t=e.pos;if(this.regexp_eatUnicodePropertyName(e)&&e.eat(61)){var i=e.lastStringValue;if(this.regexp_eatUnicodePropertyValue(e)){var r=e.lastStringValue;return this.regexp_validateUnicodePropertyNameAndValue(e,i,r),1}}if(e.pos=t,this.regexp_eatLoneUnicodePropertyNameOrValue(e)){var n=e.lastStringValue;return this.regexp_validateUnicodePropertyNameOrValue(e,n)}return 0},uc.regexp_validateUnicodePropertyNameAndValue=function(e,t,i){sl(e.unicodeProperties.nonBinary,t)||e.raise("Invalid property name"),e.unicodeProperties.nonBinary[t].test(i)||e.raise("Invalid property value")},uc.regexp_validateUnicodePropertyNameOrValue=function(e,t){return e.unicodeProperties.binary.test(t)?1:e.switchV&&e.unicodeProperties.binaryOfStrings.test(t)?2:void e.raise("Invalid property name")},uc.regexp_eatUnicodePropertyName=function(e){var t=0;for(e.lastStringValue="";gc(t=e.current());)e.lastStringValue+=ul(t),e.advance();return""!==e.lastStringValue},uc.regexp_eatUnicodePropertyValue=function(e){var t=0;for(e.lastStringValue="";mc(t=e.current());)e.lastStringValue+=ul(t),e.advance();return""!==e.lastStringValue},uc.regexp_eatLoneUnicodePropertyNameOrValue=function(e){return this.regexp_eatUnicodePropertyValue(e)},uc.regexp_eatCharacterClass=function(e){if(e.eat(91)){var t=e.eat(94),i=this.regexp_classContents(e);return e.eat(93)||e.raise("Unterminated character class"),t&&2===i&&e.raise("Negated character class may contain strings"),!0}return!1},uc.regexp_classContents=function(e){return 93===e.current()?1:e.switchV?this.regexp_classSetExpression(e):(this.regexp_nonEmptyClassRanges(e),1)},uc.regexp_nonEmptyClassRanges=function(e){for(;this.regexp_eatClassAtom(e);){var t=e.lastIntValue;if(e.eat(45)&&this.regexp_eatClassAtom(e)){var i=e.lastIntValue;!e.switchU||-1!==t&&-1!==i||e.raise("Invalid character class"),-1!==t&&-1!==i&&t>i&&e.raise("Range out of order in character class")}}},uc.regexp_eatClassAtom=function(e){var t=e.pos;if(e.eat(92)){if(this.regexp_eatClassEscape(e))return!0;if(e.switchU){var i=e.current();(99===i||bc(i))&&e.raise("Invalid class escape"),e.raise("Invalid escape")}e.pos=t}var r=e.current();return 93!==r&&(e.lastIntValue=r,e.advance(),!0)},uc.regexp_eatClassEscape=function(e){var t=e.pos;if(e.eat(98))return e.lastIntValue=8,!0;if(e.switchU&&e.eat(45))return e.lastIntValue=45,!0;if(!e.switchU&&e.eat(99)){if(this.regexp_eatClassControlLetter(e))return!0;e.pos=t}return this.regexp_eatCharacterClassEscape(e)||this.regexp_eatCharacterEscape(e)},uc.regexp_classSetExpression=function(e){var t,i=1;if(this.regexp_eatClassSetRange(e));else if(t=this.regexp_eatClassSetOperand(e)){2===t&&(i=2);for(var r=e.pos;e.eatChars([38,38]);)38!==e.current()&&(t=this.regexp_eatClassSetOperand(e))?2!==t&&(i=1):e.raise("Invalid character in character class");if(r!==e.pos)return i;for(;e.eatChars([45,45]);)this.regexp_eatClassSetOperand(e)||e.raise("Invalid character in character class");if(r!==e.pos)return i}else e.raise("Invalid character in character class");for(;;)if(!this.regexp_eatClassSetRange(e)){if(!(t=this.regexp_eatClassSetOperand(e)))return i;2===t&&(i=2)}},uc.regexp_eatClassSetRange=function(e){var t=e.pos;if(this.regexp_eatClassSetCharacter(e)){var i=e.lastIntValue;if(e.eat(45)&&this.regexp_eatClassSetCharacter(e)){var r=e.lastIntValue;return-1!==i&&-1!==r&&i>r&&e.raise("Range out of order in character class"),!0}e.pos=t}return!1},uc.regexp_eatClassSetOperand=function(e){return this.regexp_eatClassSetCharacter(e)?1:this.regexp_eatClassStringDisjunction(e)||this.regexp_eatNestedClass(e)},uc.regexp_eatNestedClass=function(e){var t=e.pos;if(e.eat(91)){var i=e.eat(94),r=this.regexp_classContents(e);if(e.eat(93))return i&&2===r&&e.raise("Negated character class may contain strings"),r;e.pos=t}if(e.eat(92)){var n=this.regexp_eatCharacterClassEscape(e);if(n)return n;e.pos=t}return null},uc.regexp_eatClassStringDisjunction=function(e){var t=e.pos;if(e.eatChars([92,113])){if(e.eat(123)){var i=this.regexp_classStringDisjunctionContents(e);if(e.eat(125))return i}else e.raise("Invalid escape");e.pos=t}return null},uc.regexp_classStringDisjunctionContents=function(e){for(var t=this.regexp_classString(e);e.eat(124);)2===this.regexp_classString(e)&&(t=2);return t},uc.regexp_classString=function(e){for(var t=0;this.regexp_eatClassSetCharacter(e);)t++;return 1===t?1:2},uc.regexp_eatClassSetCharacter=function(e){var t=e.pos;if(e.eat(92))return!(!this.regexp_eatCharacterEscape(e)&&!this.regexp_eatClassSetReservedPunctuator(e))||(e.eat(98)?(e.lastIntValue=8,!0):(e.pos=t,!1));var i=e.current();return!(i<0||i===e.lookahead()&&function(e){return 33===e||e>=35&&e<=38||e>=42&&e<=44||46===e||e>=58&&e<=64||94===e||96===e||126===e}(i))&&(!function(e){return 40===e||41===e||45===e||47===e||e>=91&&e<=93||e>=123&&e<=125}(i)&&(e.advance(),e.lastIntValue=i,!0))},uc.regexp_eatClassSetReservedPunctuator=function(e){var t=e.current();return!!function(e){return 33===e||35===e||37===e||38===e||44===e||45===e||e>=58&&e<=62||64===e||96===e||126===e}(t)&&(e.lastIntValue=t,e.advance(),!0)},uc.regexp_eatClassControlLetter=function(e){var t=e.current();return!(!yc(t)&&95!==t)&&(e.lastIntValue=t%32,e.advance(),!0)},uc.regexp_eatHexEscapeSequence=function(e){var t=e.pos;if(e.eat(120)){if(this.regexp_eatFixedHexDigits(e,2))return!0;e.switchU&&e.raise("Invalid escape"),e.pos=t}return!1},uc.regexp_eatDecimalDigits=function(e){var t=e.pos,i=0;for(e.lastIntValue=0;yc(i=e.current());)e.lastIntValue=10*e.lastIntValue+(i-48),e.advance();return e.pos!==t},uc.regexp_eatHexDigits=function(e){var t=e.pos,i=0;for(e.lastIntValue=0;xc(i=e.current());)e.lastIntValue=16*e.lastIntValue+vc(i),e.advance();return e.pos!==t},uc.regexp_eatLegacyOctalEscapeSequence=function(e){if(this.regexp_eatOctalDigit(e)){var t=e.lastIntValue;if(this.regexp_eatOctalDigit(e)){var i=e.lastIntValue;t<=3&&this.regexp_eatOctalDigit(e)?e.lastIntValue=64*t+8*i+e.lastIntValue:e.lastIntValue=8*t+i}else e.lastIntValue=t;return!0}return!1},uc.regexp_eatOctalDigit=function(e){var t=e.current();return bc(t)?(e.lastIntValue=t-48,e.advance(),!0):(e.lastIntValue=0,!1)},uc.regexp_eatFixedHexDigits=function(e,t){var i=e.pos;e.lastIntValue=0;for(var r=0;r<t;++r){var n=e.current();if(!xc(n))return e.pos=i,!1;e.lastIntValue=16*e.lastIntValue+vc(n),e.advance()}return!0};var _c=function(e){this.type=e.type,this.value=e.value,this.start=e.start,this.end=e.end,e.options.locations&&(this.loc=new pl(e,e.startLoc,e.endLoc)),e.options.ranges&&(this.range=[e.start,e.end])},wc=bl.prototype;function Cc(e){return"function"!=typeof BigInt?null:BigInt(e.replace(/_/g,""))}wc.next=function(e){!e&&this.type.keyword&&this.containsEsc&&this.raiseRecoverable(this.start,"Escape sequence in keyword "+this.type.keyword),this.options.onToken&&this.options.onToken(new _c(this)),this.lastTokEnd=this.end,this.lastTokStart=this.start,this.lastTokEndLoc=this.endLoc,this.lastTokStartLoc=this.startLoc,this.nextToken()},wc.getToken=function(){return this.next(),new _c(this)},"undefined"!=typeof Symbol&&(wc[Symbol.iterator]=function(){var e=this;return{next:function(){var t=e.getToken();return{done:t.type===Yu.eof,value:t}}}}),wc.nextToken=function(){var e=this.curContext();return e&&e.preserveSpace||this.skipSpace(),this.start=this.pos,this.options.locations&&(this.startLoc=this.curPosition()),this.pos>=this.input.length?this.finishToken(Yu.eof):e.override?e.override(this):void this.readToken(this.fullCharCodeAtPos())},wc.readToken=function(e){return zu(e,this.options.ecmaVersion>=6)||92===e?this.readWord():this.getTokenFromCode(e)},wc.fullCharCodeAtPos=function(){var e=this.input.charCodeAt(this.pos);if(e<=55295||e>=56320)return e;var t=this.input.charCodeAt(this.pos+1);return t<=56319||t>=57344?e:(e<<10)+t-56613888},wc.skipBlockComment=function(){var e=this.options.onComment&&this.curPosition(),t=this.pos,i=this.input.indexOf("*/",this.pos+=2);if(-1===i&&this.raise(this.pos-2,"Unterminated comment"),this.pos=i+2,this.options.locations)for(var r=void 0,n=t;(r=Qu(this.input,n,this.pos))>-1;)++this.curLine,n=this.lineStart=r;this.options.onComment&&this.options.onComment(!0,this.input.slice(t+2,i),t,this.pos,e,this.curPosition())},wc.skipLineComment=function(e){for(var t=this.pos,i=this.options.onComment&&this.curPosition(),r=this.input.charCodeAt(this.pos+=e);this.pos<this.input.length&&!Ju(r);)r=this.input.charCodeAt(++this.pos);this.options.onComment&&this.options.onComment(!1,this.input.slice(t+e,this.pos),t,this.pos,i,this.curPosition())},wc.skipSpace=function(){e:for(;this.pos<this.input.length;){var e=this.input.charCodeAt(this.pos);switch(e){case 32:case 160:++this.pos;break;case 13:10===this.input.charCodeAt(this.pos+1)&&++this.pos;case 10:case 8232:case 8233:++this.pos,this.options.locations&&(++this.curLine,this.lineStart=this.pos);break;case 47:switch(this.input.charCodeAt(this.pos+1)){case 42:this.skipBlockComment();break;case 47:this.skipLineComment(2);break;default:break e}break;default:if(!(e>8&&e<14||e>=5760&&el.test(String.fromCharCode(e))))break e;++this.pos}}},wc.finishToken=function(e,t){this.end=this.pos,this.options.locations&&(this.endLoc=this.curPosition());var i=this.type;this.type=e,this.value=t,this.updateContext(i)},wc.readToken_dot=function(){var e=this.input.charCodeAt(this.pos+1);if(e>=48&&e<=57)return this.readNumber(!0);var t=this.input.charCodeAt(this.pos+2);return this.options.ecmaVersion>=6&&46===e&&46===t?(this.pos+=3,this.finishToken(Yu.ellipsis)):(++this.pos,this.finishToken(Yu.dot))},wc.readToken_slash=function(){var e=this.input.charCodeAt(this.pos+1);return this.exprAllowed?(++this.pos,this.readRegexp()):61===e?this.finishOp(Yu.assign,2):this.finishOp(Yu.slash,1)},wc.readToken_mult_modulo_exp=function(e){var t=this.input.charCodeAt(this.pos+1),i=1,r=42===e?Yu.star:Yu.modulo;return this.options.ecmaVersion>=7&&42===e&&42===t&&(++i,r=Yu.starstar,t=this.input.charCodeAt(this.pos+2)),61===t?this.finishOp(Yu.assign,i+1):this.finishOp(r,i)},wc.readToken_pipe_amp=function(e){var t=this.input.charCodeAt(this.pos+1);if(t===e){if(this.options.ecmaVersion>=12)if(61===this.input.charCodeAt(this.pos+2))return this.finishOp(Yu.assign,3);return this.finishOp(124===e?Yu.logicalOR:Yu.logicalAND,2)}return 61===t?this.finishOp(Yu.assign,2):this.finishOp(124===e?Yu.bitwiseOR:Yu.bitwiseAND,1)},wc.readToken_caret=function(){return 61===this.input.charCodeAt(this.pos+1)?this.finishOp(Yu.assign,2):this.finishOp(Yu.bitwiseXOR,1)},wc.readToken_plus_min=function(e){var t=this.input.charCodeAt(this.pos+1);return t===e?45!==t||this.inModule||62!==this.input.charCodeAt(this.pos+2)||0!==this.lastTokEnd&&!Zu.test(this.input.slice(this.lastTokEnd,this.pos))?this.finishOp(Yu.incDec,2):(this.skipLineComment(3),this.skipSpace(),this.nextToken()):61===t?this.finishOp(Yu.assign,2):this.finishOp(Yu.plusMin,1)},wc.readToken_lt_gt=function(e){var t=this.input.charCodeAt(this.pos+1),i=1;return t===e?(i=62===e&&62===this.input.charCodeAt(this.pos+2)?3:2,61===this.input.charCodeAt(this.pos+i)?this.finishOp(Yu.assign,i+1):this.finishOp(Yu.bitShift,i)):33!==t||60!==e||this.inModule||45!==this.input.charCodeAt(this.pos+2)||45!==this.input.charCodeAt(this.pos+3)?(61===t&&(i=2),this.finishOp(Yu.relational,i)):(this.skipLineComment(4),this.skipSpace(),this.nextToken())},wc.readToken_eq_excl=function(e){var t=this.input.charCodeAt(this.pos+1);return 61===t?this.finishOp(Yu.equality,61===this.input.charCodeAt(this.pos+2)?3:2):61===e&&62===t&&this.options.ecmaVersion>=6?(this.pos+=2,this.finishToken(Yu.arrow)):this.finishOp(61===e?Yu.eq:Yu.prefix,1)},wc.readToken_question=function(){var e=this.options.ecmaVersion;if(e>=11){var t=this.input.charCodeAt(this.pos+1);if(46===t){var i=this.input.charCodeAt(this.pos+2);if(i<48||i>57)return this.finishOp(Yu.questionDot,2)}if(63===t){if(e>=12)if(61===this.input.charCodeAt(this.pos+2))return this.finishOp(Yu.assign,3);return this.finishOp(Yu.coalesce,2)}}return this.finishOp(Yu.question,1)},wc.readToken_numberSign=function(){var e=35;if(this.options.ecmaVersion>=13&&(++this.pos,zu(e=this.fullCharCodeAtPos(),!0)||92===e))return this.finishToken(Yu.privateId,this.readWord1());this.raise(this.pos,"Unexpected character '"+ul(e)+"'")},wc.getTokenFromCode=function(e){switch(e){case 46:return this.readToken_dot();case 40:return++this.pos,this.finishToken(Yu.parenL);case 41:return++this.pos,this.finishToken(Yu.parenR);case 59:return++this.pos,this.finishToken(Yu.semi);case 44:return++this.pos,this.finishToken(Yu.comma);case 91:return++this.pos,this.finishToken(Yu.bracketL);case 93:return++this.pos,this.finishToken(Yu.bracketR);case 123:return++this.pos,this.finishToken(Yu.braceL);case 125:return++this.pos,this.finishToken(Yu.braceR);case 58:return++this.pos,this.finishToken(Yu.colon);case 96:if(this.options.ecmaVersion<6)break;return++this.pos,this.finishToken(Yu.backQuote);case 48:var t=this.input.charCodeAt(this.pos+1);if(120===t||88===t)return this.readRadixNumber(16);if(this.options.ecmaVersion>=6){if(111===t||79===t)return this.readRadixNumber(8);if(98===t||66===t)return this.readRadixNumber(2)}case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:return this.readNumber(!1);case 34:case 39:return this.readString(e);case 47:return this.readToken_slash();case 37:case 42:return this.readToken_mult_modulo_exp(e);case 124:case 38:return this.readToken_pipe_amp(e);case 94:return this.readToken_caret();case 43:case 45:return this.readToken_plus_min(e);case 60:case 62:return this.readToken_lt_gt(e);case 61:case 33:return this.readToken_eq_excl(e);case 63:return this.readToken_question();case 126:return this.finishOp(Yu.prefix,1);case 35:return this.readToken_numberSign()}this.raise(this.pos,"Unexpected character '"+ul(e)+"'")},wc.finishOp=function(e,t){var i=this.input.slice(this.pos,this.pos+t);return this.pos+=t,this.finishToken(e,i)},wc.readRegexp=function(){for(var e,t,i=this.pos;;){this.pos>=this.input.length&&this.raise(i,"Unterminated regular expression");var r=this.input.charAt(this.pos);if(Zu.test(r)&&this.raise(i,"Unterminated regular expression"),e)e=!1;else{if("["===r)t=!0;else if("]"===r&&t)t=!1;else if("/"===r&&!t)break;e="\\"===r}++this.pos}var n=this.input.slice(i,this.pos);++this.pos;var s=this.pos,a=this.readWord1();this.containsEsc&&this.unexpected(s);var o=this.regexpState||(this.regexpState=new cc(this));o.reset(i,n,a),this.validateRegExpFlags(o),this.validateRegExpPattern(o);var h=null;try{h=new RegExp(n,a)}catch(e){}return this.finishToken(Yu.regexp,{pattern:n,flags:a,value:h})},wc.readInt=function(e,t,i){for(var r=this.options.ecmaVersion>=12&&void 0===t,n=i&&48===this.input.charCodeAt(this.pos),s=this.pos,a=0,o=0,h=0,u=null==t?1/0:t;h<u;++h,++this.pos){var l=this.input.charCodeAt(this.pos),c=void 0;if(r&&95===l)n&&this.raiseRecoverable(this.pos,"Numeric separator is not allowed in legacy octal numeric literals"),95===o&&this.raiseRecoverable(this.pos,"Numeric separator must be exactly one underscore"),0===h&&this.raiseRecoverable(this.pos,"Numeric separator is not allowed at the first of digits"),o=l;else{if((c=l>=97?l-97+10:l>=65?l-65+10:l>=48&&l<=57?l-48:1/0)>=e)break;o=l,a=a*e+c}}return r&&95===o&&this.raiseRecoverable(this.pos-1,"Numeric separator is not allowed at the last of digits"),this.pos===s||null!=t&&this.pos-s!==t?null:a},wc.readRadixNumber=function(e){var t=this.pos;this.pos+=2;var i=this.readInt(e);return null==i&&this.raise(this.start+2,"Expected number in radix "+e),this.options.ecmaVersion>=11&&110===this.input.charCodeAt(this.pos)?(i=Cc(this.input.slice(t,this.pos)),++this.pos):zu(this.fullCharCodeAtPos())&&this.raise(this.pos,"Identifier directly after number"),this.finishToken(Yu.num,i)},wc.readNumber=function(e){var t=this.pos;e||null!==this.readInt(10,void 0,!0)||this.raise(t,"Invalid number");var i=this.pos-t>=2&&48===this.input.charCodeAt(t);i&&this.strict&&this.raise(t,"Invalid number");var r=this.input.charCodeAt(this.pos);if(!i&&!e&&this.options.ecmaVersion>=11&&110===r){var n=Cc(this.input.slice(t,this.pos));return++this.pos,zu(this.fullCharCodeAtPos())&&this.raise(this.pos,"Identifier directly after number"),this.finishToken(Yu.num,n)}i&&/[89]/.test(this.input.slice(t,this.pos))&&(i=!1),46!==r||i||(++this.pos,this.readInt(10),r=this.input.charCodeAt(this.pos)),69!==r&&101!==r||i||(43!==(r=this.input.charCodeAt(++this.pos))&&45!==r||++this.pos,null===this.readInt(10)&&this.raise(t,"Invalid number")),zu(this.fullCharCodeAtPos())&&this.raise(this.pos,"Identifier directly after number");var s,a=(s=this.input.slice(t,this.pos),i?parseInt(s,8):parseFloat(s.replace(/_/g,"")));return this.finishToken(Yu.num,a)},wc.readCodePoint=function(){var e;if(123===this.input.charCodeAt(this.pos)){this.options.ecmaVersion<6&&this.unexpected();var t=++this.pos;e=this.readHexChar(this.input.indexOf("}",this.pos)-this.pos),++this.pos,e>1114111&&this.invalidStringToken(t,"Code point out of bounds")}else e=this.readHexChar(4);return e},wc.readString=function(e){for(var t="",i=++this.pos;;){this.pos>=this.input.length&&this.raise(this.start,"Unterminated string constant");var r=this.input.charCodeAt(this.pos);if(r===e)break;92===r?(t+=this.input.slice(i,this.pos),t+=this.readEscapedChar(!1),i=this.pos):8232===r||8233===r?(this.options.ecmaVersion<10&&this.raise(this.start,"Unterminated string constant"),++this.pos,this.options.locations&&(this.curLine++,this.lineStart=this.pos)):(Ju(r)&&this.raise(this.start,"Unterminated string constant"),++this.pos)}return t+=this.input.slice(i,this.pos++),this.finishToken(Yu.string,t)};var Ac={};wc.tryReadTemplateToken=function(){this.inTemplateElement=!0;try{this.readTmplToken()}catch(e){if(e!==Ac)throw e;this.readInvalidTemplateToken()}this.inTemplateElement=!1},wc.invalidStringToken=function(e,t){if(this.inTemplateElement&&this.options.ecmaVersion>=9)throw Ac;this.raise(e,t)},wc.readTmplToken=function(){for(var e="",t=this.pos;;){this.pos>=this.input.length&&this.raise(this.start,"Unterminated template");var i=this.input.charCodeAt(this.pos);if(96===i||36===i&&123===this.input.charCodeAt(this.pos+1))return this.pos!==this.start||this.type!==Yu.template&&this.type!==Yu.invalidTemplate?(e+=this.input.slice(t,this.pos),this.finishToken(Yu.template,e)):36===i?(this.pos+=2,this.finishToken(Yu.dollarBraceL)):(++this.pos,this.finishToken(Yu.backQuote));if(92===i)e+=this.input.slice(t,this.pos),e+=this.readEscapedChar(!0),t=this.pos;else if(Ju(i)){switch(e+=this.input.slice(t,this.pos),++this.pos,i){case 13:10===this.input.charCodeAt(this.pos)&&++this.pos;case 10:e+="\n";break;default:e+=String.fromCharCode(i)}this.options.locations&&(++this.curLine,this.lineStart=this.pos),t=this.pos}else++this.pos}},wc.readInvalidTemplateToken=function(){for(;this.pos<this.input.length;this.pos++)switch(this.input[this.pos]){case"\\":++this.pos;break;case"$":if("{"!==this.input[this.pos+1])break;case"`":return this.finishToken(Yu.invalidTemplate,this.input.slice(this.start,this.pos));case"\r":"\n"===this.input[this.pos+1]&&++this.pos;case"\n":case"\u2028":case"\u2029":++this.curLine,this.lineStart=this.pos+1}this.raise(this.start,"Unterminated template")},wc.readEscapedChar=function(e){var t=this.input.charCodeAt(++this.pos);switch(++this.pos,t){case 110:return"\n";case 114:return"\r";case 120:return String.fromCharCode(this.readHexChar(2));case 117:return ul(this.readCodePoint());case 116:return"\t";case 98:return"\b";case 118:return"\v";case 102:return"\f";case 13:10===this.input.charCodeAt(this.pos)&&++this.pos;case 10:return this.options.locations&&(this.lineStart=this.pos,++this.curLine),"";case 56:case 57:if(this.strict&&this.invalidStringToken(this.pos-1,"Invalid escape sequence"),e){var i=this.pos-1;this.invalidStringToken(i,"Invalid escape sequence in template string")}default:if(t>=48&&t<=55){var r=this.input.substr(this.pos-1,3).match(/^[0-7]+/)[0],n=parseInt(r,8);return n>255&&(r=r.slice(0,-1),n=parseInt(r,8)),this.pos+=r.length-1,t=this.input.charCodeAt(this.pos),"0"===r&&56!==t&&57!==t||!this.strict&&!e||this.invalidStringToken(this.pos-1-r.length,e?"Octal literal in template string":"Octal literal in strict mode"),String.fromCharCode(n)}return Ju(t)?(this.options.locations&&(this.lineStart=this.pos,++this.curLine),""):String.fromCharCode(t)}},wc.readHexChar=function(e){var t=this.pos,i=this.readInt(16,e);return null===i&&this.invalidStringToken(t,"Bad character escape sequence"),i},wc.readWord1=function(){this.containsEsc=!1;for(var e="",t=!0,i=this.pos,r=this.options.ecmaVersion>=6;this.pos<this.input.length;){var n=this.fullCharCodeAtPos();if(Gu(n,r))this.pos+=n<=65535?1:2;else{if(92!==n)break;this.containsEsc=!0,e+=this.input.slice(i,this.pos);var s=this.pos;117!==this.input.charCodeAt(++this.pos)&&this.invalidStringToken(this.pos,"Expecting Unicode escape sequence \\uXXXX"),++this.pos;var a=this.readCodePoint();(t?zu:Gu)(a,r)||this.invalidStringToken(s,"Invalid Unicode escape"),e+=ul(a),i=this.pos}t=!1}return e+this.input.slice(i,this.pos)},wc.readWord=function(){var e=this.readWord1(),t=Yu.name;return this.keywords.test(e)&&(t=Wu[e]),this.finishToken(t,e)};function Ec(e,t,i,r,n){var s=i?function(e){var t=Object.create(Fc);for(var i in e)t[i]=e[i];return t}(i):r;!function e(t,i,r){s[r||t.type](t,i,e)}(e,t,n)}function Dc(e,t,i){i(e,t)}function Sc(e,t,i){}bl.acorn={Parser:bl,version:"8.15.0",defaultOptions:fl,Position:cl,SourceLocation:pl,getLineInfo:dl,Node:$l,TokenType:ju,tokTypes:Yu,keywordTypes:Wu,TokContext:Ll,tokContexts:Ol,isIdentifierChar:Gu,isIdentifierStart:zu,Token:_c,isNewLine:Ju,lineBreak:Zu,lineBreakG:Ku,nonASCIIwhitespace:el};var Fc={};Fc.Program=Fc.BlockStatement=Fc.StaticBlock=function(e,t,i){for(var r=0,n=e.body;r<n.length;r+=1){i(n[r],t,"Statement")}},Fc.Statement=Dc,Fc.EmptyStatement=Sc,Fc.ExpressionStatement=Fc.ParenthesizedExpression=Fc.ChainExpression=function(e,t,i){return i(e.expression,t,"Expression")},Fc.IfStatement=function(e,t,i){i(e.test,t,"Expression"),i(e.consequent,t,"Statement"),e.alternate&&i(e.alternate,t,"Statement")},Fc.LabeledStatement=function(e,t,i){return i(e.body,t,"Statement")},Fc.BreakStatement=Fc.ContinueStatement=Sc,Fc.WithStatement=function(e,t,i){i(e.object,t,"Expression"),i(e.body,t,"Statement")},Fc.SwitchStatement=function(e,t,i){i(e.discriminant,t,"Expression");for(var r=0,n=e.cases;r<n.length;r+=1){i(n[r],t)}},Fc.SwitchCase=function(e,t,i){e.test&&i(e.test,t,"Expression");for(var r=0,n=e.consequent;r<n.length;r+=1){i(n[r],t,"Statement")}},Fc.ReturnStatement=Fc.YieldExpression=Fc.AwaitExpression=function(e,t,i){e.argument&&i(e.argument,t,"Expression")},Fc.ThrowStatement=Fc.SpreadElement=function(e,t,i){return i(e.argument,t,"Expression")},Fc.TryStatement=function(e,t,i){i(e.block,t,"Statement"),e.handler&&i(e.handler,t),e.finalizer&&i(e.finalizer,t,"Statement")},Fc.CatchClause=function(e,t,i){e.param&&i(e.param,t,"Pattern"),i(e.body,t,"Statement")},Fc.WhileStatement=Fc.DoWhileStatement=function(e,t,i){i(e.test,t,"Expression"),i(e.body,t,"Statement")},Fc.ForStatement=function(e,t,i){e.init&&i(e.init,t,"ForInit"),e.test&&i(e.test,t,"Expression"),e.update&&i(e.update,t,"Expression"),i(e.body,t,"Statement")},Fc.ForInStatement=Fc.ForOfStatement=function(e,t,i){i(e.left,t,"ForInit"),i(e.right,t,"Expression"),i(e.body,t,"Statement")},Fc.ForInit=function(e,t,i){"VariableDeclaration"===e.type?i(e,t):i(e,t,"Expression")},Fc.DebuggerStatement=Sc,Fc.FunctionDeclaration=function(e,t,i){return i(e,t,"Function")},Fc.VariableDeclaration=function(e,t,i){for(var r=0,n=e.declarations;r<n.length;r+=1){i(n[r],t)}},Fc.VariableDeclarator=function(e,t,i){i(e.id,t,"Pattern"),e.init&&i(e.init,t,"Expression")},Fc.Function=function(e,t,i){e.id&&i(e.id,t,"Pattern");for(var r=0,n=e.params;r<n.length;r+=1){i(n[r],t,"Pattern")}i(e.body,t,e.expression?"Expression":"Statement")},Fc.Pattern=function(e,t,i){"Identifier"===e.type?i(e,t,"VariablePattern"):"MemberExpression"===e.type?i(e,t,"MemberPattern"):i(e,t)},Fc.VariablePattern=Sc,Fc.MemberPattern=Dc,Fc.RestElement=function(e,t,i){return i(e.argument,t,"Pattern")},Fc.ArrayPattern=function(e,t,i){for(var r=0,n=e.elements;r<n.length;r+=1){var s=n[r];s&&i(s,t,"Pattern")}},Fc.ObjectPattern=function(e,t,i){for(var r=0,n=e.properties;r<n.length;r+=1){var s=n[r];"Property"===s.type?(s.computed&&i(s.key,t,"Expression"),i(s.value,t,"Pattern")):"RestElement"===s.type&&i(s.argument,t,"Pattern")}},Fc.Expression=Dc,Fc.ThisExpression=Fc.Super=Fc.MetaProperty=Sc,Fc.ArrayExpression=function(e,t,i){for(var r=0,n=e.elements;r<n.length;r+=1){var s=n[r];s&&i(s,t,"Expression")}},Fc.ObjectExpression=function(e,t,i){for(var r=0,n=e.properties;r<n.length;r+=1){i(n[r],t)}},Fc.FunctionExpression=Fc.ArrowFunctionExpression=Fc.FunctionDeclaration,Fc.SequenceExpression=function(e,t,i){for(var r=0,n=e.expressions;r<n.length;r+=1){i(n[r],t,"Expression")}},Fc.TemplateLiteral=function(e,t,i){for(var r=0,n=e.quasis;r<n.length;r+=1){i(n[r],t)}for(var s=0,a=e.expressions;s<a.length;s+=1){i(a[s],t,"Expression")}},Fc.TemplateElement=Sc,Fc.UnaryExpression=Fc.UpdateExpression=function(e,t,i){i(e.argument,t,"Expression")},Fc.BinaryExpression=Fc.LogicalExpression=function(e,t,i){i(e.left,t,"Expression"),i(e.right,t,"Expression")},Fc.AssignmentExpression=Fc.AssignmentPattern=function(e,t,i){i(e.left,t,"Pattern"),i(e.right,t,"Expression")},Fc.ConditionalExpression=function(e,t,i){i(e.test,t,"Expression"),i(e.consequent,t,"Expression"),i(e.alternate,t,"Expression")},Fc.NewExpression=Fc.CallExpression=function(e,t,i){if(i(e.callee,t,"Expression"),e.arguments)for(var r=0,n=e.arguments;r<n.length;r+=1){i(n[r],t,"Expression")}},Fc.MemberExpression=function(e,t,i){i(e.object,t,"Expression"),e.computed&&i(e.property,t,"Expression")},Fc.ExportNamedDeclaration=Fc.ExportDefaultDeclaration=function(e,t,i){e.declaration&&i(e.declaration,t,"ExportNamedDeclaration"===e.type||e.declaration.id?"Statement":"Expression"),e.source&&i(e.source,t,"Expression")},Fc.ExportAllDeclaration=function(e,t,i){e.exported&&i(e.exported,t),i(e.source,t,"Expression")},Fc.ImportDeclaration=function(e,t,i){for(var r=0,n=e.specifiers;r<n.length;r+=1){i(n[r],t)}i(e.source,t,"Expression")},Fc.ImportExpression=function(e,t,i){i(e.source,t,"Expression")},Fc.ImportSpecifier=Fc.ImportDefaultSpecifier=Fc.ImportNamespaceSpecifier=Fc.Identifier=Fc.PrivateIdentifier=Fc.Literal=Sc,Fc.TaggedTemplateExpression=function(e,t,i){i(e.tag,t,"Expression"),i(e.quasi,t,"Expression")},Fc.ClassDeclaration=Fc.ClassExpression=function(e,t,i){return i(e,t,"Class")},Fc.Class=function(e,t,i){e.id&&i(e.id,t,"Pattern"),e.superClass&&i(e.superClass,t,"Expression"),i(e.body,t)},Fc.ClassBody=function(e,t,i){for(var r=0,n=e.body;r<n.length;r+=1){i(n[r],t)}},Fc.MethodDefinition=Fc.PropertyDefinition=Fc.Property=function(e,t,i){e.computed&&i(e.key,t,"Expression"),e.value&&i(e.value,t,"Expression")};var Tc={},Mc={};(function e(t){var i,r,n,s,a,o;function h(e){var t,i,r={};for(t in e)e.hasOwnProperty(t)&&(i=e[t],r[t]="object"==typeof i&&null!==i?h(i):i);return r}function u(e,t){this.parent=e,this.key=t}function l(e,t,i,r){this.node=e,this.path=t,this.wrap=i,this.ref=r}function c(){}function p(e){return null!=e&&"object"==typeof e&&"string"==typeof e.type}function d(e,t){return(e===i.ObjectExpression||e===i.ObjectPattern)&&"properties"===t}function f(e,t){for(var i=e.length-1;i>=0;--i)if(e[i].node===t)return!0;return!1}function g(e,t){return(new c).traverse(e,t)}function m(e,t){var i;return i=function(e,t){var i,r,n,s;for(r=e.length,n=0;r;)t(e[s=n+(i=r>>>1)])?r=i:(n=s+1,r-=i+1);return n}(t,(function(t){return t.range[0]>e.range[0]})),e.extendedRange=[e.range[0],e.range[1]],i!==t.length&&(e.extendedRange[1]=t[i].range[0]),(i-=1)>=0&&(e.extendedRange[0]=t[i].range[1]),e}return i={AssignmentExpression:"AssignmentExpression",AssignmentPattern:"AssignmentPattern",ArrayExpression:"ArrayExpression",ArrayPattern:"ArrayPattern",ArrowFunctionExpression:"ArrowFunctionExpression",AwaitExpression:"AwaitExpression",BlockStatement:"BlockStatement",BinaryExpression:"BinaryExpression",BreakStatement:"BreakStatement",CallExpression:"CallExpression",CatchClause:"CatchClause",ChainExpression:"ChainExpression",ClassBody:"ClassBody",ClassDeclaration:"ClassDeclaration",ClassExpression:"ClassExpression",ComprehensionBlock:"ComprehensionBlock",ComprehensionExpression:"ComprehensionExpression",ConditionalExpression:"ConditionalExpression",ContinueStatement:"ContinueStatement",DebuggerStatement:"DebuggerStatement",DirectiveStatement:"DirectiveStatement",DoWhileStatement:"DoWhileStatement",EmptyStatement:"EmptyStatement",ExportAllDeclaration:"ExportAllDeclaration",ExportDefaultDeclaration:"ExportDefaultDeclaration",ExportNamedDeclaration:"ExportNamedDeclaration",ExportSpecifier:"ExportSpecifier",ExpressionStatement:"ExpressionStatement",ForStatement:"ForStatement",ForInStatement:"ForInStatement",ForOfStatement:"ForOfStatement",FunctionDeclaration:"FunctionDeclaration",FunctionExpression:"FunctionExpression",GeneratorExpression:"GeneratorExpression",Identifier:"Identifier",IfStatement:"IfStatement",ImportExpression:"ImportExpression",ImportDeclaration:"ImportDeclaration",ImportDefaultSpecifier:"ImportDefaultSpecifier",ImportNamespaceSpecifier:"ImportNamespaceSpecifier",ImportSpecifier:"ImportSpecifier",Literal:"Literal",LabeledStatement:"LabeledStatement",LogicalExpression:"LogicalExpression",MemberExpression:"MemberExpression",MetaProperty:"MetaProperty",MethodDefinition:"MethodDefinition",ModuleSpecifier:"ModuleSpecifier",NewExpression:"NewExpression",ObjectExpression:"ObjectExpression",ObjectPattern:"ObjectPattern",PrivateIdentifier:"PrivateIdentifier",Program:"Program",Property:"Property",PropertyDefinition:"PropertyDefinition",RestElement:"RestElement",ReturnStatement:"ReturnStatement",SequenceExpression:"SequenceExpression",SpreadElement:"SpreadElement",Super:"Super",SwitchStatement:"SwitchStatement",SwitchCase:"SwitchCase",TaggedTemplateExpression:"TaggedTemplateExpression",TemplateElement:"TemplateElement",TemplateLiteral:"TemplateLiteral",ThisExpression:"ThisExpression",ThrowStatement:"ThrowStatement",TryStatement:"TryStatement",UnaryExpression:"UnaryExpression",UpdateExpression:"UpdateExpression",VariableDeclaration:"VariableDeclaration",VariableDeclarator:"VariableDeclarator",WhileStatement:"WhileStatement",WithStatement:"WithStatement",YieldExpression:"YieldExpression"},n={AssignmentExpression:["left","right"],AssignmentPattern:["left","right"],ArrayExpression:["elements"],ArrayPattern:["elements"],ArrowFunctionExpression:["params","body"],AwaitExpression:["argument"],BlockStatement:["body"],BinaryExpression:["left","right"],BreakStatement:["label"],CallExpression:["callee","arguments"],CatchClause:["param","body"],ChainExpression:["expression"],ClassBody:["body"],ClassDeclaration:["id","superClass","body"],ClassExpression:["id","superClass","body"],ComprehensionBlock:["left","right"],ComprehensionExpression:["blocks","filter","body"],ConditionalExpression:["test","consequent","alternate"],ContinueStatement:["label"],DebuggerStatement:[],DirectiveStatement:[],DoWhileStatement:["body","test"],EmptyStatement:[],ExportAllDeclaration:["source"],ExportDefaultDeclaration:["declaration"],ExportNamedDeclaration:["declaration","specifiers","source"],ExportSpecifier:["exported","local"],ExpressionStatement:["expression"],ForStatement:["init","test","update","body"],ForInStatement:["left","right","body"],ForOfStatement:["left","right","body"],FunctionDeclaration:["id","params","body"],FunctionExpression:["id","params","body"],GeneratorExpression:["blocks","filter","body"],Identifier:[],IfStatement:["test","consequent","alternate"],ImportExpression:["source"],ImportDeclaration:["specifiers","source"],ImportDefaultSpecifier:["local"],ImportNamespaceSpecifier:["local"],ImportSpecifier:["imported","local"],Literal:[],LabeledStatement:["label","body"],LogicalExpression:["left","right"],MemberExpression:["object","property"],MetaProperty:["meta","property"],MethodDefinition:["key","value"],ModuleSpecifier:[],NewExpression:["callee","arguments"],ObjectExpression:["properties"],ObjectPattern:["properties"],PrivateIdentifier:[],Program:["body"],Property:["key","value"],PropertyDefinition:["key","value"],RestElement:["argument"],ReturnStatement:["argument"],SequenceExpression:["expressions"],SpreadElement:["argument"],Super:[],SwitchStatement:["discriminant","cases"],SwitchCase:["test","consequent"],TaggedTemplateExpression:["tag","quasi"],TemplateElement:[],TemplateLiteral:["quasis","expressions"],ThisExpression:[],ThrowStatement:["argument"],TryStatement:["block","handler","finalizer"],UnaryExpression:["argument"],UpdateExpression:["argument"],VariableDeclaration:["declarations"],VariableDeclarator:["id","init"],WhileStatement:["test","body"],WithStatement:["object","body"],YieldExpression:["argument"]},r={Break:s={},Skip:a={},Remove:o={}},u.prototype.replace=function(e){this.parent[this.key]=e},u.prototype.remove=function(){return Array.isArray(this.parent)?(this.parent.splice(this.key,1),!0):(this.replace(null),!1)},c.prototype.path=function(){var e,t,i,r,n;function s(e,t){if(Array.isArray(t))for(i=0,r=t.length;i<r;++i)e.push(t[i]);else e.push(t)}if(!this.__current.path)return null;for(n=[],e=2,t=this.__leavelist.length;e<t;++e)s(n,this.__leavelist[e].path);return s(n,this.__current.path),n},c.prototype.type=function(){return this.current().type||this.__current.wrap},c.prototype.parents=function(){var e,t,i;for(i=[],e=1,t=this.__leavelist.length;e<t;++e)i.push(this.__leavelist[e].node);return i},c.prototype.current=function(){return this.__current.node},c.prototype.__execute=function(e,t){var i,r;return r=void 0,i=this.__current,this.__current=t,this.__state=null,e&&(r=e.call(this,t.node,this.__leavelist[this.__leavelist.length-1].node)),this.__current=i,r},c.prototype.notify=function(e){this.__state=e},c.prototype.skip=function(){this.notify(a)},c.prototype.break=function(){this.notify(s)},c.prototype.remove=function(){this.notify(o)},c.prototype.__initialize=function(e,t){this.visitor=t,this.root=e,this.__worklist=[],this.__leavelist=[],this.__current=null,this.__state=null,this.__fallback=null,"iteration"===t.fallback?this.__fallback=Object.keys:"function"==typeof t.fallback&&(this.__fallback=t.fallback),this.__keys=n,t.keys&&(this.__keys=Object.assign(Object.create(this.__keys),t.keys))},c.prototype.traverse=function(e,t){var i,r,n,o,h,u,c,g,m,y,x,v;for(this.__initialize(e,t),v={},i=this.__worklist,r=this.__leavelist,i.push(new l(e,null,null,null)),r.push(new l(null,null,null,null));i.length;)if((n=i.pop())!==v){if(n.node){if(u=this.__execute(t.enter,n),this.__state===s||u===s)return;if(i.push(v),r.push(n),this.__state===a||u===a)continue;if(h=(o=n.node).type||n.wrap,!(y=this.__keys[h])){if(!this.__fallback)throw new Error("Unknown node type "+h+".");y=this.__fallback(o)}for(g=y.length;(g-=1)>=0;)if(x=o[c=y[g]])if(Array.isArray(x)){for(m=x.length;(m-=1)>=0;)if(x[m]&&!f(r,x[m])){if(d(h,y[g]))n=new l(x[m],[c,m],"Property",null);else{if(!p(x[m]))continue;n=new l(x[m],[c,m],null,null)}i.push(n)}}else if(p(x)){if(f(r,x))continue;i.push(new l(x,c,null,null))}}}else if(n=r.pop(),u=this.__execute(t.leave,n),this.__state===s||u===s)return},c.prototype.replace=function(e,t){var i,r,n,h,c,f,g,m,y,x,v,b,_;function w(e){var t,r,n,s;if(e.ref.remove())for(r=e.ref.key,s=e.ref.parent,t=i.length;t--;)if((n=i[t]).ref&&n.ref.parent===s){if(n.ref.key<r)break;--n.ref.key}}for(this.__initialize(e,t),v={},i=this.__worklist,r=this.__leavelist,f=new l(e,null,null,new u(b={root:e},"root")),i.push(f),r.push(f);i.length;)if((f=i.pop())!==v){if(void 0!==(c=this.__execute(t.enter,f))&&c!==s&&c!==a&&c!==o&&(f.ref.replace(c),f.node=c),this.__state!==o&&c!==o||(w(f),f.node=null),this.__state===s||c===s)return b.root;if((n=f.node)&&(i.push(v),r.push(f),this.__state!==a&&c!==a)){if(h=n.type||f.wrap,!(y=this.__keys[h])){if(!this.__fallback)throw new Error("Unknown node type "+h+".");y=this.__fallback(n)}for(g=y.length;(g-=1)>=0;)if(x=n[_=y[g]])if(Array.isArray(x)){for(m=x.length;(m-=1)>=0;)if(x[m]){if(d(h,y[g]))f=new l(x[m],[_,m],"Property",new u(x,m));else{if(!p(x[m]))continue;f=new l(x[m],[_,m],null,new u(x,m))}i.push(f)}}else p(x)&&i.push(new l(x,_,null,new u(n,_)))}}else if(f=r.pop(),void 0!==(c=this.__execute(t.leave,f))&&c!==s&&c!==a&&c!==o&&f.ref.replace(c),this.__state!==o&&c!==o||w(f),this.__state===s||c===s)return b.root;return b.root},t.Syntax=i,t.traverse=g,t.replace=function(e,t){return(new c).replace(e,t)},t.attachComments=function(e,t,i){var n,s,a,o,u=[];if(!e.range)throw new Error("attachComments needs range information");if(!i.length){if(t.length){for(a=0,s=t.length;a<s;a+=1)(n=h(t[a])).extendedRange=[0,e.range[0]],u.push(n);e.leadingComments=u}return e}for(a=0,s=t.length;a<s;a+=1)u.push(m(h(t[a]),i));return o=0,g(e,{enter:function(e){for(var t;o<u.length&&!((t=u[o]).extendedRange[1]>e.range[0]);)t.extendedRange[1]===e.range[0]?(e.leadingComments||(e.leadingComments=[]),e.leadingComments.push(t),u.splice(o,1)):o+=1;return o===u.length?r.Break:u[o].extendedRange[0]>e.range[1]?r.Skip:void 0}}),o=0,g(e,{leave:function(e){for(var t;o<u.length&&(t=u[o],!(e.range[1]<t.extendedRange[0]));)e.range[1]===t.extendedRange[0]?(e.trailingComments||(e.trailingComments=[]),e.trailingComments.push(t),u.splice(o,1)):o+=1;return o===u.length?r.Break:u[o].extendedRange[0]>e.range[1]?r.Skip:void 0}}),e},t.VisitorKeys=n,t.VisitorOption=r,t.Controller=c,t.cloneEnvironment=function(){return e({})},t})(Mc);var kc={},Ic={exports:{}};!function(){function e(e){if(null==e)return!1;switch(e.type){case"BlockStatement":case"BreakStatement":case"ContinueStatement":case"DebuggerStatement":case"DoWhileStatement":case"EmptyStatement":case"ExpressionStatement":case"ForInStatement":case"ForStatement":case"IfStatement":case"LabeledStatement":case"ReturnStatement":case"SwitchStatement":case"ThrowStatement":case"TryStatement":case"VariableDeclaration":case"WhileStatement":case"WithStatement":return!0}return!1}function t(e){switch(e.type){case"IfStatement":return null!=e.alternate?e.alternate:e.consequent;case"LabeledStatement":case"ForStatement":case"ForInStatement":case"WhileStatement":case"WithStatement":return e.body}return null}Ic.exports={isExpression:function(e){if(null==e)return!1;switch(e.type){case"ArrayExpression":case"AssignmentExpression":case"BinaryExpression":case"CallExpression":case"ConditionalExpression":case"FunctionExpression":case"Identifier":case"Literal":case"LogicalExpression":case"MemberExpression":case"NewExpression":case"ObjectExpression":case"SequenceExpression":case"ThisExpression":case"UnaryExpression":case"UpdateExpression":return!0}return!1},isStatement:e,isIterationStatement:function(e){if(null==e)return!1;switch(e.type){case"DoWhileStatement":case"ForInStatement":case"ForStatement":case"WhileStatement":return!0}return!1},isSourceElement:function(t){return e(t)||null!=t&&"FunctionDeclaration"===t.type},isProblematicIfStatement:function(e){var i;if("IfStatement"!==e.type)return!1;if(null==e.alternate)return!1;i=e.consequent;do{if("IfStatement"===i.type&&null==i.alternate)return!0;i=t(i)}while(i);return!1},trailingStatement:t}}();var Bc=Ic.exports,Lc={exports:{}};!function(){var e,t,i,r,n,s;function a(e){return e<=65535?String.fromCharCode(e):String.fromCharCode(Math.floor((e-65536)/1024)+55296)+String.fromCharCode((e-65536)%1024+56320)}for(t={NonAsciiIdentifierStart:/[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u08A0-\u08B4\u08B6-\u08BD\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FD5\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]/,NonAsciiIdentifierPart:/[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0300-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u0483-\u0487\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u05D0-\u05EA\u05F0-\u05F2\u0610-\u061A\u0620-\u0669\u066E-\u06D3\u06D5-\u06DC\u06DF-\u06E8\u06EA-\u06FC\u06FF\u0710-\u074A\u074D-\u07B1\u07C0-\u07F5\u07FA\u0800-\u082D\u0840-\u085B\u08A0-\u08B4\u08B6-\u08BD\u08D4-\u08E1\u08E3-\u0963\u0966-\u096F\u0971-\u0983\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BC-\u09C4\u09C7\u09C8\u09CB-\u09CE\u09D7\u09DC\u09DD\u09DF-\u09E3\u09E6-\u09F1\u0A01-\u0A03\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A59-\u0A5C\u0A5E\u0A66-\u0A75\u0A81-\u0A83\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABC-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AD0\u0AE0-\u0AE3\u0AE6-\u0AEF\u0AF9\u0B01-\u0B03\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3C-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B5C\u0B5D\u0B5F-\u0B63\u0B66-\u0B6F\u0B71\u0B82\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD0\u0BD7\u0BE6-\u0BEF\u0C00-\u0C03\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C58-\u0C5A\u0C60-\u0C63\u0C66-\u0C6F\u0C80-\u0C83\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBC-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CDE\u0CE0-\u0CE3\u0CE6-\u0CEF\u0CF1\u0CF2\u0D01-\u0D03\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D-\u0D44\u0D46-\u0D48\u0D4A-\u0D4E\u0D54-\u0D57\u0D5F-\u0D63\u0D66-\u0D6F\u0D7A-\u0D7F\u0D82\u0D83\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E01-\u0E3A\u0E40-\u0E4E\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB9\u0EBB-\u0EBD\u0EC0-\u0EC4\u0EC6\u0EC8-\u0ECD\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E-\u0F47\u0F49-\u0F6C\u0F71-\u0F84\u0F86-\u0F97\u0F99-\u0FBC\u0FC6\u1000-\u1049\u1050-\u109D\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u135D-\u135F\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1714\u1720-\u1734\u1740-\u1753\u1760-\u176C\u176E-\u1770\u1772\u1773\u1780-\u17D3\u17D7\u17DC\u17DD\u17E0-\u17E9\u180B-\u180D\u1810-\u1819\u1820-\u1877\u1880-\u18AA\u18B0-\u18F5\u1900-\u191E\u1920-\u192B\u1930-\u193B\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19D9\u1A00-\u1A1B\u1A20-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AA7\u1AB0-\u1ABD\u1B00-\u1B4B\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1BF3\u1C00-\u1C37\u1C40-\u1C49\u1C4D-\u1C7D\u1C80-\u1C88\u1CD0-\u1CD2\u1CD4-\u1CF6\u1CF8\u1CF9\u1D00-\u1DF5\u1DFB-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u200C\u200D\u203F\u2040\u2054\u2071\u207F\u2090-\u209C\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D7F-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2DE0-\u2DFF\u2E2F\u3005-\u3007\u3021-\u302F\u3031-\u3035\u3038-\u303C\u3041-\u3096\u3099\u309A\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FD5\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66F\uA674-\uA67D\uA67F-\uA6F1\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA827\uA840-\uA873\uA880-\uA8C5\uA8D0-\uA8D9\uA8E0-\uA8F7\uA8FB\uA8FD\uA900-\uA92D\uA930-\uA953\uA960-\uA97C\uA980-\uA9C0\uA9CF-\uA9D9\uA9E0-\uA9FE\uAA00-\uAA36\uAA40-\uAA4D\uAA50-\uAA59\uAA60-\uAA76\uAA7A-\uAAC2\uAADB-\uAADD\uAAE0-\uAAEF\uAAF2-\uAAF6\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABEA\uABEC\uABED\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE00-\uFE0F\uFE20-\uFE2F\uFE33\uFE34\uFE4D-\uFE4F\uFE70-\uFE74\uFE76-\uFEFC\uFF10-\uFF19\uFF21-\uFF3A\uFF3F\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]/},e={NonAsciiIdentifierStart:/[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u08A0-\u08B4\u08B6-\u08BD\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2118-\u211D\u2124\u2126\u2128\u212A-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309B-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FD5\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF30-\uDF4A\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC03-\uDC37\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDF00-\uDF19]|\uD806[\uDCA0-\uDCDF\uDCFF\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC72-\uDC8F]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50\uDF93-\uDF9F\uDFE0]|\uD821[\uDC00-\uDFEC]|\uD822[\uDC00-\uDEF2]|\uD82C[\uDC00\uDC01]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD83A[\uDC00-\uDCC4\uDD00-\uDD43]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1]|\uD87E[\uDC00-\uDE1D]/,NonAsciiIdentifierPart:/[\xAA\xB5\xB7\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0300-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u0483-\u0487\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u05D0-\u05EA\u05F0-\u05F2\u0610-\u061A\u0620-\u0669\u066E-\u06D3\u06D5-\u06DC\u06DF-\u06E8\u06EA-\u06FC\u06FF\u0710-\u074A\u074D-\u07B1\u07C0-\u07F5\u07FA\u0800-\u082D\u0840-\u085B\u08A0-\u08B4\u08B6-\u08BD\u08D4-\u08E1\u08E3-\u0963\u0966-\u096F\u0971-\u0983\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BC-\u09C4\u09C7\u09C8\u09CB-\u09CE\u09D7\u09DC\u09DD\u09DF-\u09E3\u09E6-\u09F1\u0A01-\u0A03\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A59-\u0A5C\u0A5E\u0A66-\u0A75\u0A81-\u0A83\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABC-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AD0\u0AE0-\u0AE3\u0AE6-\u0AEF\u0AF9\u0B01-\u0B03\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3C-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B5C\u0B5D\u0B5F-\u0B63\u0B66-\u0B6F\u0B71\u0B82\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD0\u0BD7\u0BE6-\u0BEF\u0C00-\u0C03\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C58-\u0C5A\u0C60-\u0C63\u0C66-\u0C6F\u0C80-\u0C83\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBC-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CDE\u0CE0-\u0CE3\u0CE6-\u0CEF\u0CF1\u0CF2\u0D01-\u0D03\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D-\u0D44\u0D46-\u0D48\u0D4A-\u0D4E\u0D54-\u0D57\u0D5F-\u0D63\u0D66-\u0D6F\u0D7A-\u0D7F\u0D82\u0D83\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E01-\u0E3A\u0E40-\u0E4E\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB9\u0EBB-\u0EBD\u0EC0-\u0EC4\u0EC6\u0EC8-\u0ECD\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E-\u0F47\u0F49-\u0F6C\u0F71-\u0F84\u0F86-\u0F97\u0F99-\u0FBC\u0FC6\u1000-\u1049\u1050-\u109D\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u135D-\u135F\u1369-\u1371\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1714\u1720-\u1734\u1740-\u1753\u1760-\u176C\u176E-\u1770\u1772\u1773\u1780-\u17D3\u17D7\u17DC\u17DD\u17E0-\u17E9\u180B-\u180D\u1810-\u1819\u1820-\u1877\u1880-\u18AA\u18B0-\u18F5\u1900-\u191E\u1920-\u192B\u1930-\u193B\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19DA\u1A00-\u1A1B\u1A20-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AA7\u1AB0-\u1ABD\u1B00-\u1B4B\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1BF3\u1C00-\u1C37\u1C40-\u1C49\u1C4D-\u1C7D\u1C80-\u1C88\u1CD0-\u1CD2\u1CD4-\u1CF6\u1CF8\u1CF9\u1D00-\u1DF5\u1DFB-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u200C\u200D\u203F\u2040\u2054\u2071\u207F\u2090-\u209C\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2102\u2107\u210A-\u2113\u2115\u2118-\u211D\u2124\u2126\u2128\u212A-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D7F-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2DE0-\u2DFF\u3005-\u3007\u3021-\u302F\u3031-\u3035\u3038-\u303C\u3041-\u3096\u3099-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FD5\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66F\uA674-\uA67D\uA67F-\uA6F1\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA827\uA840-\uA873\uA880-\uA8C5\uA8D0-\uA8D9\uA8E0-\uA8F7\uA8FB\uA8FD\uA900-\uA92D\uA930-\uA953\uA960-\uA97C\uA980-\uA9C0\uA9CF-\uA9D9\uA9E0-\uA9FE\uAA00-\uAA36\uAA40-\uAA4D\uAA50-\uAA59\uAA60-\uAA76\uAA7A-\uAAC2\uAADB-\uAADD\uAAE0-\uAAEF\uAAF2-\uAAF6\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABEA\uABEC\uABED\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE00-\uFE0F\uFE20-\uFE2F\uFE33\uFE34\uFE4D-\uFE4F\uFE70-\uFE74\uFE76-\uFEFC\uFF10-\uFF19\uFF21-\uFF3A\uFF3F\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDDFD\uDE80-\uDE9C\uDEA0-\uDED0\uDEE0\uDF00-\uDF1F\uDF30-\uDF4A\uDF50-\uDF7A\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCA0-\uDCA9\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00-\uDE03\uDE05\uDE06\uDE0C-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE38-\uDE3A\uDE3F\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE6\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC00-\uDC46\uDC66-\uDC6F\uDC7F-\uDCBA\uDCD0-\uDCE8\uDCF0-\uDCF9\uDD00-\uDD34\uDD36-\uDD3F\uDD50-\uDD73\uDD76\uDD80-\uDDC4\uDDCA-\uDDCC\uDDD0-\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE37\uDE3E\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEEA\uDEF0-\uDEF9\uDF00-\uDF03\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3C-\uDF44\uDF47\uDF48\uDF4B-\uDF4D\uDF50\uDF57\uDF5D-\uDF63\uDF66-\uDF6C\uDF70-\uDF74]|\uD805[\uDC00-\uDC4A\uDC50-\uDC59\uDC80-\uDCC5\uDCC7\uDCD0-\uDCD9\uDD80-\uDDB5\uDDB8-\uDDC0\uDDD8-\uDDDD\uDE00-\uDE40\uDE44\uDE50-\uDE59\uDE80-\uDEB7\uDEC0-\uDEC9\uDF00-\uDF19\uDF1D-\uDF2B\uDF30-\uDF39]|\uD806[\uDCA0-\uDCE9\uDCFF\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC36\uDC38-\uDC40\uDC50-\uDC59\uDC72-\uDC8F\uDC92-\uDCA7\uDCA9-\uDCB6]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE60-\uDE69\uDED0-\uDEED\uDEF0-\uDEF4\uDF00-\uDF36\uDF40-\uDF43\uDF50-\uDF59\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50-\uDF7E\uDF8F-\uDF9F\uDFE0]|\uD821[\uDC00-\uDFEC]|\uD822[\uDC00-\uDEF2]|\uD82C[\uDC00\uDC01]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99\uDC9D\uDC9E]|\uD834[\uDD65-\uDD69\uDD6D-\uDD72\uDD7B-\uDD82\uDD85-\uDD8B\uDDAA-\uDDAD\uDE42-\uDE44]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB\uDFCE-\uDFFF]|\uD836[\uDE00-\uDE36\uDE3B-\uDE6C\uDE75\uDE84\uDE9B-\uDE9F\uDEA1-\uDEAF]|\uD838[\uDC00-\uDC06\uDC08-\uDC18\uDC1B-\uDC21\uDC23\uDC24\uDC26-\uDC2A]|\uD83A[\uDC00-\uDCC4\uDCD0-\uDCD6\uDD00-\uDD4A\uDD50-\uDD59]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1]|\uD87E[\uDC00-\uDE1D]|\uDB40[\uDD00-\uDDEF]/},i=[5760,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8239,8287,12288,65279],r=new Array(128),s=0;s<128;++s)r[s]=s>=97&&s<=122||s>=65&&s<=90||36===s||95===s;for(n=new Array(128),s=0;s<128;++s)n[s]=s>=97&&s<=122||s>=65&&s<=90||s>=48&&s<=57||36===s||95===s;Lc.exports={isDecimalDigit:function(e){return 48<=e&&e<=57},isHexDigit:function(e){return 48<=e&&e<=57||97<=e&&e<=102||65<=e&&e<=70},isOctalDigit:function(e){return e>=48&&e<=55},isWhiteSpace:function(e){return 32===e||9===e||11===e||12===e||160===e||e>=5760&&i.indexOf(e)>=0},isLineTerminator:function(e){return 10===e||13===e||8232===e||8233===e},isIdentifierStartES5:function(e){return e<128?r[e]:t.NonAsciiIdentifierStart.test(a(e))},isIdentifierPartES5:function(e){return e<128?n[e]:t.NonAsciiIdentifierPart.test(a(e))},isIdentifierStartES6:function(t){return t<128?r[t]:e.NonAsciiIdentifierStart.test(a(t))},isIdentifierPartES6:function(t){return t<128?n[t]:e.NonAsciiIdentifierPart.test(a(t))}}}();var Oc=Lc.exports,Pc={exports:{}};!function(){var e=Oc;function t(e,t){return!(!t&&"yield"===e)&&i(e,t)}function i(e,t){if(t&&function(e){switch(e){case"implements":case"interface":case"package":case"private":case"protected":case"public":case"static":case"let":return!0;default:return!1}}(e))return!0;switch(e.length){case 2:return"if"===e||"in"===e||"do"===e;case 3:return"var"===e||"for"===e||"new"===e||"try"===e;case 4:return"this"===e||"else"===e||"case"===e||"void"===e||"with"===e||"enum"===e;case 5:return"while"===e||"break"===e||"catch"===e||"throw"===e||"const"===e||"yield"===e||"class"===e||"super"===e;case 6:return"return"===e||"typeof"===e||"delete"===e||"switch"===e||"export"===e||"import"===e;case 7:return"default"===e||"finally"===e||"extends"===e;case 8:return"function"===e||"continue"===e||"debugger"===e;case 10:return"instanceof"===e;default:return!1}}function r(e,i){return"null"===e||"true"===e||"false"===e||t(e,i)}function n(e,t){return"null"===e||"true"===e||"false"===e||i(e,t)}function s(t){var i,r,n;if(0===t.length)return!1;if(n=t.charCodeAt(0),!e.isIdentifierStartES5(n))return!1;for(i=1,r=t.length;i<r;++i)if(n=t.charCodeAt(i),!e.isIdentifierPartES5(n))return!1;return!0}function a(t){var i,r,n,s,a;if(0===t.length)return!1;for(a=e.isIdentifierStartES6,i=0,r=t.length;i<r;++i){if(55296<=(n=t.charCodeAt(i))&&n<=56319){if(++i>=r)return!1;if(!(56320<=(s=t.charCodeAt(i))&&s<=57343))return!1;n=1024*(n-55296)+(s-56320)+65536}if(!a(n))return!1;a=e.isIdentifierPartES6}return!0}Pc.exports={isKeywordES5:t,isKeywordES6:i,isReservedWordES5:r,isReservedWordES6:n,isRestrictedWord:function(e){return"eval"===e||"arguments"===e},isIdentifierNameES5:s,isIdentifierNameES6:a,isIdentifierES5:function(e,t){return s(e)&&!r(e,t)},isIdentifierES6:function(e,t){return a(e)&&!n(e,t)}}}();var Nc=Pc.exports;kc.ast=Bc,kc.code=Oc,kc.keyword=Nc;var Rc,Vc,Uc={},zc={},Gc={},jc={};function $c(){if(Rc)return jc;Rc=1;var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split("");return jc.encode=function(t){if(0<=t&&t<e.length)return e[t];throw new TypeError("Must be between 0 and 63: "+t)},jc.decode=function(e){return 65<=e&&e<=90?e-65:97<=e&&e<=122?e-97+26:48<=e&&e<=57?e-48+52:43==e?62:47==e?63:-1},jc}function qc(){if(Vc)return Gc;Vc=1;var e=$c();return Gc.encode=function(t){var i,r="",n=function(e){return e<0?1+(-e<<1):0+(e<<1)}(t);do{i=31&n,(n>>>=5)>0&&(i|=32),r+=e.encode(i)}while(n>0);return r},Gc.decode=function(t,i,r){var n,s,a,o,h=t.length,u=0,l=0;do{if(i>=h)throw new Error("Expected more digits in base 64 VLQ value.");if(-1===(s=e.decode(t.charCodeAt(i++))))throw new Error("Invalid base64 digit: "+t.charAt(i-1));n=!!(32&s),u+=(s&=31)<<l,l+=5}while(n);r.value=(o=(a=u)>>1,1&~a?o:-o),r.rest=i},Gc}var Hc,Wc={};function Xc(){return Hc||(Hc=1,function(e){e.getArg=function(e,t,i){if(t in e)return e[t];if(3===arguments.length)return i;throw new Error('"'+t+'" is a required argument.')};var t=/^(?:([\w+\-.]+):)?\/\/(?:(\w+:\w+)@)?([\w.-]*)(?::(\d+))?(.*)$/,i=/^data:.+\,.+$/;function r(e){var i=e.match(t);return i?{scheme:i[1],auth:i[2],host:i[3],port:i[4],path:i[5]}:null}function n(e){var t="";return e.scheme&&(t+=e.scheme+":"),t+="//",e.auth&&(t+=e.auth+"@"),e.host&&(t+=e.host),e.port&&(t+=":"+e.port),e.path&&(t+=e.path),t}function s(t){var i=t,s=r(t);if(s){if(!s.path)return t;i=s.path}for(var a,o=e.isAbsolute(i),h=i.split(/\/+/),u=0,l=h.length-1;l>=0;l--)"."===(a=h[l])?h.splice(l,1):".."===a?u++:u>0&&(""===a?(h.splice(l+1,u),u=0):(h.splice(l,2),u--));return""===(i=h.join("/"))&&(i=o?"/":"."),s?(s.path=i,n(s)):i}function a(e,t){""===e&&(e="."),""===t&&(t=".");var a=r(t),o=r(e);if(o&&(e=o.path||"/"),a&&!a.scheme)return o&&(a.scheme=o.scheme),n(a);if(a||t.match(i))return t;if(o&&!o.host&&!o.path)return o.host=t,n(o);var h="/"===t.charAt(0)?t:s(e.replace(/\/+$/,"")+"/"+t);return o?(o.path=h,n(o)):h}e.urlParse=r,e.urlGenerate=n,e.normalize=s,e.join=a,e.isAbsolute=function(e){return"/"===e.charAt(0)||t.test(e)},e.relative=function(e,t){""===e&&(e="."),e=e.replace(/\/$/,"");for(var i=0;0!==t.indexOf(e+"/");){var r=e.lastIndexOf("/");if(r<0)return t;if((e=e.slice(0,r)).match(/^([^\/]+:\/)?\/*$/))return t;++i}return Array(i+1).join("../")+t.substr(e.length+1)};var o=!("__proto__"in Object.create(null));function h(e){return e}function u(e){if(!e)return!1;var t=e.length;if(t<9)return!1;if(95!==e.charCodeAt(t-1)||95!==e.charCodeAt(t-2)||111!==e.charCodeAt(t-3)||116!==e.charCodeAt(t-4)||111!==e.charCodeAt(t-5)||114!==e.charCodeAt(t-6)||112!==e.charCodeAt(t-7)||95!==e.charCodeAt(t-8)||95!==e.charCodeAt(t-9))return!1;for(var i=t-10;i>=0;i--)if(36!==e.charCodeAt(i))return!1;return!0}function l(e,t){return e===t?0:null===e?1:null===t?-1:e>t?1:-1}e.toSetString=o?h:function(e){return u(e)?"$"+e:e},e.fromSetString=o?h:function(e){return u(e)?e.slice(1):e},e.compareByOriginalPositions=function(e,t,i){var r=l(e.source,t.source);return 0!==r||0!==(r=e.originalLine-t.originalLine)||0!==(r=e.originalColumn-t.originalColumn)||i||0!==(r=e.generatedColumn-t.generatedColumn)||0!==(r=e.generatedLine-t.generatedLine)?r:l(e.name,t.name)},e.compareByGeneratedPositionsDeflated=function(e,t,i){var r=e.generatedLine-t.generatedLine;return 0!==r||0!==(r=e.generatedColumn-t.generatedColumn)||i||0!==(r=l(e.source,t.source))||0!==(r=e.originalLine-t.originalLine)||0!==(r=e.originalColumn-t.originalColumn)?r:l(e.name,t.name)},e.compareByGeneratedPositionsInflated=function(e,t){var i=e.generatedLine-t.generatedLine;return 0!==i||0!==(i=e.generatedColumn-t.generatedColumn)||0!==(i=l(e.source,t.source))||0!==(i=e.originalLine-t.originalLine)||0!==(i=e.originalColumn-t.originalColumn)?i:l(e.name,t.name)},e.parseSourceMapInput=function(e){return JSON.parse(e.replace(/^\)]}'[^\n]*\n/,""))},e.computeSourceURL=function(e,t,i){if(t=t||"",e&&("/"!==e[e.length-1]&&"/"!==t[0]&&(e+="/"),t=e+t),i){var o=r(i);if(!o)throw new Error("sourceMapURL could not be parsed");if(o.path){var h=o.path.lastIndexOf("/");h>=0&&(o.path=o.path.substring(0,h+1))}t=a(n(o),t)}return s(t)}}(Wc)),Wc}var Yc,Zc={};function Kc(){if(Yc)return Zc;Yc=1;var e=Xc(),t=Object.prototype.hasOwnProperty,i="undefined"!=typeof Map;function r(){this._array=[],this._set=i?new Map:Object.create(null)}return r.fromArray=function(e,t){for(var i=new r,n=0,s=e.length;n<s;n++)i.add(e[n],t);return i},r.prototype.size=function(){return i?this._set.size:Object.getOwnPropertyNames(this._set).length},r.prototype.add=function(r,n){var s=i?r:e.toSetString(r),a=i?this.has(r):t.call(this._set,s),o=this._array.length;a&&!n||this._array.push(r),a||(i?this._set.set(r,o):this._set[s]=o)},r.prototype.has=function(r){if(i)return this._set.has(r);var n=e.toSetString(r);return t.call(this._set,n)},r.prototype.indexOf=function(r){if(i){var n=this._set.get(r);if(n>=0)return n}else{var s=e.toSetString(r);if(t.call(this._set,s))return this._set[s]}throw new Error('"'+r+'" is not in the set.')},r.prototype.at=function(e){if(e>=0&&e<this._array.length)return this._array[e];throw new Error("No element indexed by "+e)},r.prototype.toArray=function(){return this._array.slice()},Zc.ArraySet=r,Zc}var Jc,Qc,ep={};function tp(){if(Jc)return ep;Jc=1;var e=Xc();function t(){this._array=[],this._sorted=!0,this._last={generatedLine:-1,generatedColumn:0}}return t.prototype.unsortedForEach=function(e,t){this._array.forEach(e,t)},t.prototype.add=function(t){var i,r,n,s,a,o;i=this._last,r=t,n=i.generatedLine,s=r.generatedLine,a=i.generatedColumn,o=r.generatedColumn,s>n||s==n&&o>=a||e.compareByGeneratedPositionsInflated(i,r)<=0?(this._last=t,this._array.push(t)):(this._sorted=!1,this._array.push(t))},t.prototype.toArray=function(){return this._sorted||(this._array.sort(e.compareByGeneratedPositionsInflated),this._sorted=!0),this._array},ep.MappingList=t,ep}function ip(){if(Qc)return zc;Qc=1;var e=qc(),t=Xc(),i=Kc().ArraySet,r=tp().MappingList;function n(e){e||(e={}),this._file=t.getArg(e,"file",null),this._sourceRoot=t.getArg(e,"sourceRoot",null),this._skipValidation=t.getArg(e,"skipValidation",!1),this._sources=new i,this._names=new i,this._mappings=new r,this._sourcesContents=null}return n.prototype._version=3,n.fromSourceMap=function(e){var i=e.sourceRoot,r=new n({file:e.file,sourceRoot:i});return e.eachMapping((function(e){var n={generated:{line:e.generatedLine,column:e.generatedColumn}};null!=e.source&&(n.source=e.source,null!=i&&(n.source=t.relative(i,n.source)),n.original={line:e.originalLine,column:e.originalColumn},null!=e.name&&(n.name=e.name)),r.addMapping(n)})),e.sources.forEach((function(n){var s=n;null!==i&&(s=t.relative(i,n)),r._sources.has(s)||r._sources.add(s);var a=e.sourceContentFor(n);null!=a&&r.setSourceContent(n,a)})),r},n.prototype.addMapping=function(e){var i=t.getArg(e,"generated"),r=t.getArg(e,"original",null),n=t.getArg(e,"source",null),s=t.getArg(e,"name",null);this._skipValidation||this._validateMapping(i,r,n,s),null!=n&&(n=String(n),this._sources.has(n)||this._sources.add(n)),null!=s&&(s=String(s),this._names.has(s)||this._names.add(s)),this._mappings.add({generatedLine:i.line,generatedColumn:i.column,originalLine:null!=r&&r.line,originalColumn:null!=r&&r.column,source:n,name:s})},n.prototype.setSourceContent=function(e,i){var r=e;null!=this._sourceRoot&&(r=t.relative(this._sourceRoot,r)),null!=i?(this._sourcesContents||(this._sourcesContents=Object.create(null)),this._sourcesContents[t.toSetString(r)]=i):this._sourcesContents&&(delete this._sourcesContents[t.toSetString(r)],0===Object.keys(this._sourcesContents).length&&(this._sourcesContents=null))},n.prototype.applySourceMap=function(e,r,n){var s=r;if(null==r){if(null==e.file)throw new Error('SourceMapGenerator.prototype.applySourceMap requires either an explicit source file, or the source map\'s "file" property. Both were omitted.');s=e.file}var a=this._sourceRoot;null!=a&&(s=t.relative(a,s));var o=new i,h=new i;this._mappings.unsortedForEach((function(i){if(i.source===s&&null!=i.originalLine){var r=e.originalPositionFor({line:i.originalLine,column:i.originalColumn});null!=r.source&&(i.source=r.source,null!=n&&(i.source=t.join(n,i.source)),null!=a&&(i.source=t.relative(a,i.source)),i.originalLine=r.line,i.originalColumn=r.column,null!=r.name&&(i.name=r.name))}var u=i.source;null==u||o.has(u)||o.add(u);var l=i.name;null==l||h.has(l)||h.add(l)}),this),this._sources=o,this._names=h,e.sources.forEach((function(i){var r=e.sourceContentFor(i);null!=r&&(null!=n&&(i=t.join(n,i)),null!=a&&(i=t.relative(a,i)),this.setSourceContent(i,r))}),this)},n.prototype._validateMapping=function(e,t,i,r){if(t&&"number"!=typeof t.line&&"number"!=typeof t.column)throw new Error("original.line and original.column are not numbers -- you probably meant to omit the original mapping entirely and only map the generated position. If so, pass null for the original mapping instead of an object with empty or null values.");if((!(e&&"line"in e&&"column"in e&&e.line>0&&e.column>=0)||t||i||r)&&!(e&&"line"in e&&"column"in e&&t&&"line"in t&&"column"in t&&e.line>0&&e.column>=0&&t.line>0&&t.column>=0&&i))throw new Error("Invalid mapping: "+JSON.stringify({generated:e,source:i,original:t,name:r}))},n.prototype._serializeMappings=function(){for(var i,r,n,s,a=0,o=1,h=0,u=0,l=0,c=0,p="",d=this._mappings.toArray(),f=0,g=d.length;f<g;f++){if(i="",(r=d[f]).generatedLine!==o)for(a=0;r.generatedLine!==o;)i+=";",o++;else if(f>0){if(!t.compareByGeneratedPositionsInflated(r,d[f-1]))continue;i+=","}i+=e.encode(r.generatedColumn-a),a=r.generatedColumn,null!=r.source&&(s=this._sources.indexOf(r.source),i+=e.encode(s-c),c=s,i+=e.encode(r.originalLine-1-u),u=r.originalLine-1,i+=e.encode(r.originalColumn-h),h=r.originalColumn,null!=r.name&&(n=this._names.indexOf(r.name),i+=e.encode(n-l),l=n)),p+=i}return p},n.prototype._generateSourcesContent=function(e,i){return e.map((function(e){if(!this._sourcesContents)return null;null!=i&&(e=t.relative(i,e));var r=t.toSetString(e);return Object.prototype.hasOwnProperty.call(this._sourcesContents,r)?this._sourcesContents[r]:null}),this)},n.prototype.toJSON=function(){var e={version:this._version,sources:this._sources.toArray(),names:this._names.toArray(),mappings:this._serializeMappings()};return null!=this._file&&(e.file=this._file),null!=this._sourceRoot&&(e.sourceRoot=this._sourceRoot),this._sourcesContents&&(e.sourcesContent=this._generateSourcesContent(e.sources,e.sourceRoot)),e},n.prototype.toString=function(){return JSON.stringify(this.toJSON())},zc.SourceMapGenerator=n,zc}var rp,np={},sp={};function ap(){return rp||(rp=1,function(e){function t(i,r,n,s,a,o){var h=Math.floor((r-i)/2)+i,u=a(n,s[h],!0);return 0===u?h:u>0?r-h>1?t(h,r,n,s,a,o):o==e.LEAST_UPPER_BOUND?r<s.length?r:-1:h:h-i>1?t(i,h,n,s,a,o):o==e.LEAST_UPPER_BOUND?h:i<0?-1:i}e.GREATEST_LOWER_BOUND=1,e.LEAST_UPPER_BOUND=2,e.search=function(i,r,n,s){if(0===r.length)return-1;var a=t(-1,r.length,i,r,n,s||e.GREATEST_LOWER_BOUND);if(a<0)return-1;for(;a-1>=0&&0===n(r[a],r[a-1],!0);)--a;return a}}(sp)),sp}var op,hp,up={};function lp(){if(op)return up;function e(e,t,i){var r=e[t];e[t]=e[i],e[i]=r}function t(i,r,n,s){if(n<s){var a=n-1;e(i,(l=n,c=s,Math.round(l+Math.random()*(c-l))),s);for(var o=i[s],h=n;h<s;h++)r(i[h],o)<=0&&e(i,a+=1,h);e(i,a+1,h);var u=a+1;t(i,r,n,u-1),t(i,r,u+1,s)}var l,c}return op=1,up.quickSort=function(e,i){t(e,i,0,e.length-1)},up}var cp,pp,dp={};function fp(){return pp||(pp=1,Uc.SourceMapGenerator=ip().SourceMapGenerator,Uc.SourceMapConsumer=function(){if(hp)return np;hp=1;var e=Xc(),t=ap(),i=Kc().ArraySet,r=qc(),n=lp().quickSort;function s(t,i){var r=t;return"string"==typeof t&&(r=e.parseSourceMapInput(t)),null!=r.sections?new h(r,i):new a(r,i)}function a(t,r){var n=t;"string"==typeof t&&(n=e.parseSourceMapInput(t));var s=e.getArg(n,"version"),a=e.getArg(n,"sources"),o=e.getArg(n,"names",[]),h=e.getArg(n,"sourceRoot",null),u=e.getArg(n,"sourcesContent",null),l=e.getArg(n,"mappings"),c=e.getArg(n,"file",null);if(s!=this._version)throw new Error("Unsupported version: "+s);h&&(h=e.normalize(h)),a=a.map(String).map(e.normalize).map((function(t){return h&&e.isAbsolute(h)&&e.isAbsolute(t)?e.relative(h,t):t})),this._names=i.fromArray(o.map(String),!0),this._sources=i.fromArray(a,!0),this._absoluteSources=this._sources.toArray().map((function(t){return e.computeSourceURL(h,t,r)})),this.sourceRoot=h,this.sourcesContent=u,this._mappings=l,this._sourceMapURL=r,this.file=c}function o(){this.generatedLine=0,this.generatedColumn=0,this.source=null,this.originalLine=null,this.originalColumn=null,this.name=null}function h(t,r){var n=t;"string"==typeof t&&(n=e.parseSourceMapInput(t));var a=e.getArg(n,"version"),o=e.getArg(n,"sections");if(a!=this._version)throw new Error("Unsupported version: "+a);this._sources=new i,this._names=new i;var h={line:-1,column:0};this._sections=o.map((function(t){if(t.url)throw new Error("Support for url field in sections not implemented.");var i=e.getArg(t,"offset"),n=e.getArg(i,"line"),a=e.getArg(i,"column");if(n<h.line||n===h.line&&a<h.column)throw new Error("Section offsets must be ordered and non-overlapping.");return h=i,{generatedOffset:{generatedLine:n+1,generatedColumn:a+1},consumer:new s(e.getArg(t,"map"),r)}}))}return s.fromSourceMap=function(e,t){return a.fromSourceMap(e,t)},s.prototype._version=3,s.prototype.__generatedMappings=null,Object.defineProperty(s.prototype,"_generatedMappings",{configurable:!0,enumerable:!0,get:function(){return this.__generatedMappings||this._parseMappings(this._mappings,this.sourceRoot),this.__generatedMappings}}),s.prototype.__originalMappings=null,Object.defineProperty(s.prototype,"_originalMappings",{configurable:!0,enumerable:!0,get:function(){return this.__originalMappings||this._parseMappings(this._mappings,this.sourceRoot),this.__originalMappings}}),s.prototype._charIsMappingSeparator=function(e,t){var i=e.charAt(t);return";"===i||","===i},s.prototype._parseMappings=function(e,t){throw new Error("Subclasses must implement _parseMappings")},s.GENERATED_ORDER=1,s.ORIGINAL_ORDER=2,s.GREATEST_LOWER_BOUND=1,s.LEAST_UPPER_BOUND=2,s.prototype.eachMapping=function(t,i,r){var n,a=i||null;switch(r||s.GENERATED_ORDER){case s.GENERATED_ORDER:n=this._generatedMappings;break;case s.ORIGINAL_ORDER:n=this._originalMappings;break;default:throw new Error("Unknown order of iteration.")}var o=this.sourceRoot;n.map((function(t){var i=null===t.source?null:this._sources.at(t.source);return{source:i=e.computeSourceURL(o,i,this._sourceMapURL),generatedLine:t.generatedLine,generatedColumn:t.generatedColumn,originalLine:t.originalLine,originalColumn:t.originalColumn,name:null===t.name?null:this._names.at(t.name)}}),this).forEach(t,a)},s.prototype.allGeneratedPositionsFor=function(i){var r=e.getArg(i,"line"),n={source:e.getArg(i,"source"),originalLine:r,originalColumn:e.getArg(i,"column",0)};if(n.source=this._findSourceIndex(n.source),n.source<0)return[];var s=[],a=this._findMapping(n,this._originalMappings,"originalLine","originalColumn",e.compareByOriginalPositions,t.LEAST_UPPER_BOUND);if(a>=0){var o=this._originalMappings[a];if(void 0===i.column)for(var h=o.originalLine;o&&o.originalLine===h;)s.push({line:e.getArg(o,"generatedLine",null),column:e.getArg(o,"generatedColumn",null),lastColumn:e.getArg(o,"lastGeneratedColumn",null)}),o=this._originalMappings[++a];else for(var u=o.originalColumn;o&&o.originalLine===r&&o.originalColumn==u;)s.push({line:e.getArg(o,"generatedLine",null),column:e.getArg(o,"generatedColumn",null),lastColumn:e.getArg(o,"lastGeneratedColumn",null)}),o=this._originalMappings[++a]}return s},np.SourceMapConsumer=s,a.prototype=Object.create(s.prototype),a.prototype.consumer=s,a.prototype._findSourceIndex=function(t){var i,r=t;if(null!=this.sourceRoot&&(r=e.relative(this.sourceRoot,r)),this._sources.has(r))return this._sources.indexOf(r);for(i=0;i<this._absoluteSources.length;++i)if(this._absoluteSources[i]==t)return i;return-1},a.fromSourceMap=function(t,r){var s=Object.create(a.prototype),h=s._names=i.fromArray(t._names.toArray(),!0),u=s._sources=i.fromArray(t._sources.toArray(),!0);s.sourceRoot=t._sourceRoot,s.sourcesContent=t._generateSourcesContent(s._sources.toArray(),s.sourceRoot),s.file=t._file,s._sourceMapURL=r,s._absoluteSources=s._sources.toArray().map((function(t){return e.computeSourceURL(s.sourceRoot,t,r)}));for(var l=t._mappings.toArray().slice(),c=s.__generatedMappings=[],p=s.__originalMappings=[],d=0,f=l.length;d<f;d++){var g=l[d],m=new o;m.generatedLine=g.generatedLine,m.generatedColumn=g.generatedColumn,g.source&&(m.source=u.indexOf(g.source),m.originalLine=g.originalLine,m.originalColumn=g.originalColumn,g.name&&(m.name=h.indexOf(g.name)),p.push(m)),c.push(m)}return n(s.__originalMappings,e.compareByOriginalPositions),s},a.prototype._version=3,Object.defineProperty(a.prototype,"sources",{get:function(){return this._absoluteSources.slice()}}),a.prototype._parseMappings=function(t,i){for(var s,a,h,u,l,c=1,p=0,d=0,f=0,g=0,m=0,y=t.length,x=0,v={},b={},_=[],w=[];x<y;)if(";"===t.charAt(x))c++,x++,p=0;else if(","===t.charAt(x))x++;else{for((s=new o).generatedLine=c,u=x;u<y&&!this._charIsMappingSeparator(t,u);u++);if(h=v[a=t.slice(x,u)])x+=a.length;else{for(h=[];x<u;)r.decode(t,x,b),l=b.value,x=b.rest,h.push(l);if(2===h.length)throw new Error("Found a source, but no line and column");if(3===h.length)throw new Error("Found a source and line, but no column");v[a]=h}s.generatedColumn=p+h[0],p=s.generatedColumn,h.length>1&&(s.source=g+h[1],g+=h[1],s.originalLine=d+h[2],d=s.originalLine,s.originalLine+=1,s.originalColumn=f+h[3],f=s.originalColumn,h.length>4&&(s.name=m+h[4],m+=h[4])),w.push(s),"number"==typeof s.originalLine&&_.push(s)}n(w,e.compareByGeneratedPositionsDeflated),this.__generatedMappings=w,n(_,e.compareByOriginalPositions),this.__originalMappings=_},a.prototype._findMapping=function(e,i,r,n,s,a){if(e[r]<=0)throw new TypeError("Line must be greater than or equal to 1, got "+e[r]);if(e[n]<0)throw new TypeError("Column must be greater than or equal to 0, got "+e[n]);return t.search(e,i,s,a)},a.prototype.computeColumnSpans=function(){for(var e=0;e<this._generatedMappings.length;++e){var t=this._generatedMappings[e];if(e+1<this._generatedMappings.length){var i=this._generatedMappings[e+1];if(t.generatedLine===i.generatedLine){t.lastGeneratedColumn=i.generatedColumn-1;continue}}t.lastGeneratedColumn=1/0}},a.prototype.originalPositionFor=function(t){var i={generatedLine:e.getArg(t,"line"),generatedColumn:e.getArg(t,"column")},r=this._findMapping(i,this._generatedMappings,"generatedLine","generatedColumn",e.compareByGeneratedPositionsDeflated,e.getArg(t,"bias",s.GREATEST_LOWER_BOUND));if(r>=0){var n=this._generatedMappings[r];if(n.generatedLine===i.generatedLine){var a=e.getArg(n,"source",null);null!==a&&(a=this._sources.at(a),a=e.computeSourceURL(this.sourceRoot,a,this._sourceMapURL));var o=e.getArg(n,"name",null);return null!==o&&(o=this._names.at(o)),{source:a,line:e.getArg(n,"originalLine",null),column:e.getArg(n,"originalColumn",null),name:o}}}return{source:null,line:null,column:null,name:null}},a.prototype.hasContentsOfAllSources=function(){return!!this.sourcesContent&&this.sourcesContent.length>=this._sources.size()&&!this.sourcesContent.some((function(e){return null==e}))},a.prototype.sourceContentFor=function(t,i){if(!this.sourcesContent)return null;var r=this._findSourceIndex(t);if(r>=0)return this.sourcesContent[r];var n,s=t;if(null!=this.sourceRoot&&(s=e.relative(this.sourceRoot,s)),null!=this.sourceRoot&&(n=e.urlParse(this.sourceRoot))){var a=s.replace(/^file:\/\//,"");if("file"==n.scheme&&this._sources.has(a))return this.sourcesContent[this._sources.indexOf(a)];if((!n.path||"/"==n.path)&&this._sources.has("/"+s))return this.sourcesContent[this._sources.indexOf("/"+s)]}if(i)return null;throw new Error('"'+s+'" is not in the SourceMap.')},a.prototype.generatedPositionFor=function(t){var i=e.getArg(t,"source");if((i=this._findSourceIndex(i))<0)return{line:null,column:null,lastColumn:null};var r={source:i,originalLine:e.getArg(t,"line"),originalColumn:e.getArg(t,"column")},n=this._findMapping(r,this._originalMappings,"originalLine","originalColumn",e.compareByOriginalPositions,e.getArg(t,"bias",s.GREATEST_LOWER_BOUND));if(n>=0){var a=this._originalMappings[n];if(a.source===r.source)return{line:e.getArg(a,"generatedLine",null),column:e.getArg(a,"generatedColumn",null),lastColumn:e.getArg(a,"lastGeneratedColumn",null)}}return{line:null,column:null,lastColumn:null}},np.BasicSourceMapConsumer=a,h.prototype=Object.create(s.prototype),h.prototype.constructor=s,h.prototype._version=3,Object.defineProperty(h.prototype,"sources",{get:function(){for(var e=[],t=0;t<this._sections.length;t++)for(var i=0;i<this._sections[t].consumer.sources.length;i++)e.push(this._sections[t].consumer.sources[i]);return e}}),h.prototype.originalPositionFor=function(i){var r={generatedLine:e.getArg(i,"line"),generatedColumn:e.getArg(i,"column")},n=t.search(r,this._sections,(function(e,t){return e.generatedLine-t.generatedOffset.generatedLine||e.generatedColumn-t.generatedOffset.generatedColumn})),s=this._sections[n];return s?s.consumer.originalPositionFor({line:r.generatedLine-(s.generatedOffset.generatedLine-1),column:r.generatedColumn-(s.generatedOffset.generatedLine===r.generatedLine?s.generatedOffset.generatedColumn-1:0),bias:i.bias}):{source:null,line:null,column:null,name:null}},h.prototype.hasContentsOfAllSources=function(){return this._sections.every((function(e){return e.consumer.hasContentsOfAllSources()}))},h.prototype.sourceContentFor=function(e,t){for(var i=0;i<this._sections.length;i++){var r=this._sections[i].consumer.sourceContentFor(e,!0);if(r)return r}if(t)return null;throw new Error('"'+e+'" is not in the SourceMap.')},h.prototype.generatedPositionFor=function(t){for(var i=0;i<this._sections.length;i++){var r=this._sections[i];if(-1!==r.consumer._findSourceIndex(e.getArg(t,"source"))){var n=r.consumer.generatedPositionFor(t);if(n)return{line:n.line+(r.generatedOffset.generatedLine-1),column:n.column+(r.generatedOffset.generatedLine===n.line?r.generatedOffset.generatedColumn-1:0)}}}return{line:null,column:null}},h.prototype._parseMappings=function(t,i){this.__generatedMappings=[],this.__originalMappings=[];for(var r=0;r<this._sections.length;r++)for(var s=this._sections[r],a=s.consumer._generatedMappings,o=0;o<a.length;o++){var h=a[o],u=s.consumer._sources.at(h.source);u=e.computeSourceURL(s.consumer.sourceRoot,u,this._sourceMapURL),this._sources.add(u),u=this._sources.indexOf(u);var l=null;h.name&&(l=s.consumer._names.at(h.name),this._names.add(l),l=this._names.indexOf(l));var c={source:u,generatedLine:h.generatedLine+(s.generatedOffset.generatedLine-1),generatedColumn:h.generatedColumn+(s.generatedOffset.generatedLine===h.generatedLine?s.generatedOffset.generatedColumn-1:0),originalLine:h.originalLine,originalColumn:h.originalColumn,name:l};this.__generatedMappings.push(c),"number"==typeof c.originalLine&&this.__originalMappings.push(c)}n(this.__generatedMappings,e.compareByGeneratedPositionsDeflated),n(this.__originalMappings,e.compareByOriginalPositions)},np.IndexedSourceMapConsumer=h,np}().SourceMapConsumer,Uc.SourceNode=function(){if(cp)return dp;cp=1;var e=ip().SourceMapGenerator,t=Xc(),i=/(\r?\n)/,r="$$$isSourceNode$$$";function n(e,t,i,n,s){this.children=[],this.sourceContents={},this.line=null==e?null:e,this.column=null==t?null:t,this.source=null==i?null:i,this.name=null==s?null:s,this[r]=!0,null!=n&&this.add(n)}return n.fromStringWithSourceMap=function(e,r,s){var a=new n,o=e.split(i),h=0,u=function(){return e()+(e()||"");function e(){return h<o.length?o[h++]:void 0}},l=1,c=0,p=null;return r.eachMapping((function(e){if(null!==p){if(!(l<e.generatedLine)){var t=(i=o[h]||"").substr(0,e.generatedColumn-c);return o[h]=i.substr(e.generatedColumn-c),c=e.generatedColumn,d(p,t),void(p=e)}d(p,u()),l++,c=0}for(;l<e.generatedLine;)a.add(u()),l++;if(c<e.generatedColumn){var i=o[h]||"";a.add(i.substr(0,e.generatedColumn)),o[h]=i.substr(e.generatedColumn),c=e.generatedColumn}p=e}),this),h<o.length&&(p&&d(p,u()),a.add(o.splice(h).join(""))),r.sources.forEach((function(e){var i=r.sourceContentFor(e);null!=i&&(null!=s&&(e=t.join(s,e)),a.setSourceContent(e,i))})),a;function d(e,i){if(null===e||void 0===e.source)a.add(i);else{var r=s?t.join(s,e.source):e.source;a.add(new n(e.originalLine,e.originalColumn,r,i,e.name))}}},n.prototype.add=function(e){if(Array.isArray(e))e.forEach((function(e){this.add(e)}),this);else{if(!e[r]&&"string"!=typeof e)throw new TypeError("Expected a SourceNode, string, or an array of SourceNodes and strings. Got "+e);e&&this.children.push(e)}return this},n.prototype.prepend=function(e){if(Array.isArray(e))for(var t=e.length-1;t>=0;t--)this.prepend(e[t]);else{if(!e[r]&&"string"!=typeof e)throw new TypeError("Expected a SourceNode, string, or an array of SourceNodes and strings. Got "+e);this.children.unshift(e)}return this},n.prototype.walk=function(e){for(var t,i=0,n=this.children.length;i<n;i++)(t=this.children[i])[r]?t.walk(e):""!==t&&e(t,{source:this.source,line:this.line,column:this.column,name:this.name})},n.prototype.join=function(e){var t,i,r=this.children.length;if(r>0){for(t=[],i=0;i<r-1;i++)t.push(this.children[i]),t.push(e);t.push(this.children[i]),this.children=t}return this},n.prototype.replaceRight=function(e,t){var i=this.children[this.children.length-1];return i[r]?i.replaceRight(e,t):"string"==typeof i?this.children[this.children.length-1]=i.replace(e,t):this.children.push("".replace(e,t)),this},n.prototype.setSourceContent=function(e,i){this.sourceContents[t.toSetString(e)]=i},n.prototype.walkSourceContents=function(e){for(var i=0,n=this.children.length;i<n;i++)this.children[i][r]&&this.children[i].walkSourceContents(e);var s=Object.keys(this.sourceContents);for(i=0,n=s.length;i<n;i++)e(t.fromSetString(s[i]),this.sourceContents[s[i]])},n.prototype.toString=function(){var e="";return this.walk((function(t){e+=t})),e},n.prototype.toStringWithSourceMap=function(t){var i={code:"",line:1,column:0},r=new e(t),n=!1,s=null,a=null,o=null,h=null;return this.walk((function(e,t){i.code+=e,null!==t.source&&null!==t.line&&null!==t.column?(s===t.source&&a===t.line&&o===t.column&&h===t.name||r.addMapping({source:t.source,original:{line:t.line,column:t.column},generated:{line:i.line,column:i.column},name:t.name}),s=t.source,a=t.line,o=t.column,h=t.name,n=!0):n&&(r.addMapping({generated:{line:i.line,column:i.column}}),s=null,n=!1);for(var u=0,l=e.length;u<l;u++)10===e.charCodeAt(u)?(i.line++,i.column=0,u+1===l?(s=null,n=!1):n&&r.addMapping({source:t.source,original:{line:t.line,column:t.column},generated:{line:i.line,column:i.column},name:t.name})):i.column++})),this.walkSourceContents((function(e,t){r.setSourceContent(e,t)})),{code:i.code,map:r}},dp.SourceNode=n,dp}().SourceNode),Uc}var gp="2.1.0";!function(e){!function(){var t,i,r,n,s,a,o,h,u,l,c,p,d,f,g,m,y,x,v,b,_,w,C,A,E,D;function S(e){return X.Statement.hasOwnProperty(e.type)}a=kc,t=(s=Mc).Syntax,r={"??":(i={Sequence:0,Yield:1,Assignment:1,Conditional:2,ArrowFunction:2,Coalesce:3,LogicalOR:4,LogicalAND:5,BitwiseOR:6,BitwiseXOR:7,BitwiseAND:8,Equality:9,Relational:10,BitwiseSHIFT:11,Additive:12,Multiplicative:13,Exponentiation:14,Await:15,Unary:15,Postfix:16,OptionalChaining:17,Call:18,New:19,TaggedTemplate:20,Member:21,Primary:22}).Coalesce,"||":i.LogicalOR,"&&":i.LogicalAND,"|":i.BitwiseOR,"^":i.BitwiseXOR,"&":i.BitwiseAND,"==":i.Equality,"!=":i.Equality,"===":i.Equality,"!==":i.Equality,is:i.Equality,isnt:i.Equality,"<":i.Relational,">":i.Relational,"<=":i.Relational,">=":i.Relational,in:i.Relational,instanceof:i.Relational,"<<":i.BitwiseSHIFT,">>":i.BitwiseSHIFT,">>>":i.BitwiseSHIFT,"+":i.Additive,"-":i.Additive,"*":i.Multiplicative,"%":i.Multiplicative,"/":i.Multiplicative,"**":i.Exponentiation};var F=32,T=33;function M(e,t){var i="";for(t|=0;t>0;t>>>=1,e+=e)1&t&&(i+=e);return i}function k(e){var t=e.length;return t&&a.code.isLineTerminator(e.charCodeAt(t-1))}function I(e,t){var i;for(i in t)t.hasOwnProperty(i)&&(e[i]=t[i]);return e}function B(e,t){var i,r;function n(e){return"object"==typeof e&&e instanceof Object&&!(e instanceof RegExp)}for(i in t)t.hasOwnProperty(i)&&(n(r=t[i])?n(e[i])?B(e[i],r):e[i]=B({},r):e[i]=r);return e}function L(e,t){return 8232==(-2&e)?(t?"u":"\\u")+(8232===e?"2028":"2029"):10===e||13===e?(t?"":"\\")+(10===e?"n":"r"):String.fromCharCode(e)}function O(e,t){var i;return 8===e?"\\b":12===e?"\\f":9===e?"\\t":(i=e.toString(16).toUpperCase(),u||e>255?"\\u"+"0000".slice(i.length)+i:0!==e||a.code.isDecimalDigit(t)?11===e?"\\x0B":"\\x"+"00".slice(i.length)+i:"\\0")}function P(e){if(92===e)return"\\\\";if(10===e)return"\\n";if(13===e)return"\\r";if(8232===e)return"\\u2028";if(8233===e)return"\\u2029";throw new Error("Incorrectly classified character")}function N(e){var t,i,r,n="";for(t=0,i=e.length;t<i;++t)r=e[t],n+=Array.isArray(r)?N(r):r;return n}function R(e,t){if(!w)return Array.isArray(e)?N(e):e;if(null==t){if(e instanceof n)return e;t={}}return null==t.loc?new n(null,null,w,e,t.name||null):new n(t.loc.start.line,t.loc.start.column,!0===w?t.loc.source||null:w,e,t.name||null)}function V(){return g||" "}function U(e,t){var i,r,n,s;return 0===(i=R(e).toString()).length?[t]:0===(r=R(t).toString()).length?[e]:(n=i.charCodeAt(i.length-1),s=r.charCodeAt(0),(43===n||45===n)&&n===s||a.code.isIdentifierPartES5(n)&&a.code.isIdentifierPartES5(s)||47===n&&105===s?[e,V(),t]:a.code.isWhiteSpace(n)||a.code.isLineTerminator(n)||a.code.isWhiteSpace(s)||a.code.isLineTerminator(s)?[e,t]:[e,g,t])}function z(e){return[o,e]}function G(e){var t;t=o,e(o+=h),o=t}function j(e,t){if("Line"===e.type){if(k(e.value))return"//"+e.value;var i="//"+e.value;return A||(i+="\n"),i}return b.format.indent.adjustMultilineComment&&/[\n\r]/.test(e.value)?function(e,t){var i,r,n,s,h,u,l,c;for(i=e.split(/\r\n|[\r\n]/),u=Number.MAX_VALUE,r=1,n=i.length;r<n;++r){for(s=i[r],h=0;h<s.length&&a.code.isWhiteSpace(s.charCodeAt(h));)++h;u>h&&(u=h)}for(void 0!==t?(l=o,"*"===i[1][u]&&(t+=" "),o=t):(1&u&&--u,l=o),r=1,n=i.length;r<n;++r)c=R(z(i[r].slice(u))),i[r]=w?c.join(""):c;return o=l,i.join("\n")}("/*"+e.value+"*/",t):"/*"+e.value+"*/"}function $(e,i){var r,n,s,u,l,c,p,d,f,g,m,y;if(e.leadingComments&&e.leadingComments.length>0){if(u=i,A){for(i=[],d=(s=e.leadingComments[0]).extendedRange,f=s.range,(y=((m=C.substring(d[0],f[0])).match(/\n/g)||[]).length)>0?(i.push(M("\n",y)),i.push(z(j(s)))):(i.push(m),i.push(j(s))),g=f,r=1,n=e.leadingComments.length;r<n;r++)f=(s=e.leadingComments[r]).range,y=(C.substring(g[1],f[0]).match(/\n/g)||[]).length,i.push(M("\n",y)),i.push(z(j(s))),g=f;y=(C.substring(f[1],d[1]).match(/\n/g)||[]).length,i.push(M("\n",y))}else for(s=e.leadingComments[0],i=[],x&&e.type===t.Program&&0===e.body.length&&i.push("\n"),i.push(j(s)),k(R(i).toString())||i.push("\n"),r=1,n=e.leadingComments.length;r<n;++r)k(R(p=[j(s=e.leadingComments[r])]).toString())||p.push("\n"),i.push(z(p));i.push(z(u))}if(e.trailingComments)if(A)d=(s=e.trailingComments[0]).extendedRange,f=s.range,(y=((m=C.substring(d[0],f[0])).match(/\n/g)||[]).length)>0?(i.push(M("\n",y)),i.push(z(j(s)))):(i.push(m),i.push(j(s)));else for(l=!k(R(i).toString()),c=M(" ",function(e){var t;for(t=e.length-1;t>=0&&!a.code.isLineTerminator(e.charCodeAt(t));--t);return e.length-1-t}(R([o,i,h]).toString())),r=0,n=e.trailingComments.length;r<n;++r)s=e.trailingComments[r],l?(i=0===r?[i,h]:[i,c]).push(j(s,c)):i=[i,z(j(s))],r===n-1||k(R(i).toString())||(i=[i,"\n"]);return i}function q(e,t,i){var r,n=0;for(r=e;r<t;r++)"\n"===C[r]&&n++;for(r=1;r<n;r++)i.push(f)}function H(e,t,i){return t<i?["(",e,")"]:e}function W(e){var t,i,r;for(t=1,i=(r=e.split(/\r\n|\n/)).length;t<i;t++)r[t]=f+o+r[t];return r}function X(){}function Y(e){return R(e.name,e)}function Z(e,t){return e.async?"async"+(t?V():g):""}function K(e){return e.generator&&!b.moz.starlessGenerator?"*"+g:""}function J(e){var t=e.value,i="";return t.async&&(i+=Z(t,!e.computed)),t.generator&&(i+=K(t)?"*":""),i}function Q(e){var t;if(t=new X,S(e))return t.generateStatement(e,1);if(function(e){return X.Expression.hasOwnProperty(e.type)}(e))return t.generateExpression(e,i.Sequence,7);throw new Error("Unknown node type: "+e.type)}X.prototype.maybeBlock=function(e,i){var r,n,s=this;return n=!b.comment||!e.leadingComments,e.type===t.BlockStatement&&n?[g,this.generateStatement(e,i)]:e.type===t.EmptyStatement&&n?";":(G((function(){r=[f,z(s.generateStatement(e,i))]})),r)},X.prototype.maybeBlockSuffix=function(e,i){var r=k(R(i).toString());return e.type!==t.BlockStatement||b.comment&&e.leadingComments||r?r?[i,o]:[i,f,o]:[i,g]},X.prototype.generatePattern=function(e,i,r){return e.type===t.Identifier?Y(e):this.generateExpression(e,i,r)},X.prototype.generateFunctionParams=function(e){var r,n,s,a;if(a=!1,e.type!==t.ArrowFunctionExpression||e.rest||e.defaults&&0!==e.defaults.length||1!==e.params.length||e.params[0].type!==t.Identifier){for((s=e.type===t.ArrowFunctionExpression?[Z(e,!1)]:[]).push("("),e.defaults&&(a=!0),r=0,n=e.params.length;r<n;++r)a&&e.defaults[r]?s.push(this.generateAssignment(e.params[r],e.defaults[r],"=",i.Assignment,7)):s.push(this.generatePattern(e.params[r],i.Assignment,7)),r+1<n&&s.push(","+g);e.rest&&(e.params.length&&s.push(","+g),s.push("..."),s.push(Y(e.rest))),s.push(")")}else s=[Z(e,!0),Y(e.params[0])];return s},X.prototype.generateFunctionBody=function(e){var r,n;return r=this.generateFunctionParams(e),e.type===t.ArrowFunctionExpression&&(r.push(g),r.push("=>")),e.expression?(r.push(g),"{"===(n=this.generateExpression(e.body,i.Assignment,7)).toString().charAt(0)&&(n=["(",n,")"]),r.push(n)):r.push(this.maybeBlock(e.body,9)),r},X.prototype.generateIterationForStatement=function(e,r,n){var s=["for"+(r.await?V()+"await":"")+g+"("],a=this;return G((function(){r.left.type===t.VariableDeclaration?G((function(){s.push(r.left.kind+V()),s.push(a.generateStatement(r.left.declarations[0],0))})):s.push(a.generateExpression(r.left,i.Call,7)),s=U(s,e),s=[U(s,a.generateExpression(r.right,i.Assignment,7)),")"]})),s.push(this.maybeBlock(r.body,n)),s},X.prototype.generatePropertyKey=function(e,t){var r=[];return t&&r.push("["),r.push(this.generateExpression(e,i.Assignment,7)),t&&r.push("]"),r},X.prototype.generateAssignment=function(e,t,r,n,s){return i.Assignment<n&&(s|=1),H([this.generateExpression(e,i.Call,s),g+r+g,this.generateExpression(t,i.Assignment,s)],i.Assignment,n)},X.prototype.semicolon=function(e){return!y&&e&F?"":";"},X.Statement={BlockStatement:function(e,t){var i,r,n=["{",f],s=this;return G((function(){var a,o,h,u;for(0===e.body.length&&A&&(i=e.range)[1]-i[0]>2&&("\n"===(r=C.substring(i[0]+1,i[1]-1))[0]&&(n=["{"]),n.push(r)),u=1,8&t&&(u|=16),a=0,o=e.body.length;a<o;++a)A&&(0===a&&(e.body[0].leadingComments&&(i=e.body[0].leadingComments[0].extendedRange,"\n"===(r=C.substring(i[0],i[1]))[0]&&(n=["{"])),e.body[0].leadingComments||q(e.range[0],e.body[0].range[0],n)),a>0&&(e.body[a-1].trailingComments||e.body[a].leadingComments||q(e.body[a-1].range[1],e.body[a].range[0],n))),a===o-1&&(u|=F),h=e.body[a].leadingComments&&A?s.generateStatement(e.body[a],u):z(s.generateStatement(e.body[a],u)),n.push(h),k(R(h).toString())||A&&a<o-1&&e.body[a+1].leadingComments||n.push(f),A&&a===o-1&&(e.body[a].trailingComments||q(e.body[a].range[1],e.range[1],n))})),n.push(z("}")),n},BreakStatement:function(e,t){return e.label?"break "+e.label.name+this.semicolon(t):"break"+this.semicolon(t)},ContinueStatement:function(e,t){return e.label?"continue "+e.label.name+this.semicolon(t):"continue"+this.semicolon(t)},ClassBody:function(e,t){var r=["{",f],n=this;return G((function(t){var s,a;for(s=0,a=e.body.length;s<a;++s)r.push(t),r.push(n.generateExpression(e.body[s],i.Sequence,7)),s+1<a&&r.push(f)})),k(R(r).toString())||r.push(f),r.push(o),r.push("}"),r},ClassDeclaration:function(e,t){var r,n;return r=["class"],e.id&&(r=U(r,this.generateExpression(e.id,i.Sequence,7))),e.superClass&&(n=U("extends",this.generateExpression(e.superClass,i.Unary,7)),r=U(r,n)),r.push(g),r.push(this.generateStatement(e.body,T)),r},DirectiveStatement:function(e,t){return b.raw&&e.raw?e.raw+this.semicolon(t):function(e){var t,i,r,n;for(n="double"===p?'"':"'",t=0,i=e.length;t<i;++t){if(39===(r=e.charCodeAt(t))){n='"';break}if(34===r){n="'";break}92===r&&++t}return n+e+n}(e.directive)+this.semicolon(t)},DoWhileStatement:function(e,t){var r=U("do",this.maybeBlock(e.body,1));return U(r=this.maybeBlockSuffix(e.body,r),["while"+g+"(",this.generateExpression(e.test,i.Sequence,7),")"+this.semicolon(t)])},CatchClause:function(e,t){var r,n=this;return G((function(){var t;e.param?(r=["catch"+g+"(",n.generateExpression(e.param,i.Sequence,7),")"],e.guard&&(t=n.generateExpression(e.guard,i.Sequence,7),r.splice(2,0," if ",t))):r=["catch"]})),r.push(this.maybeBlock(e.body,1)),r},DebuggerStatement:function(e,t){return"debugger"+this.semicolon(t)},EmptyStatement:function(e,t){return";"},ExportDefaultDeclaration:function(e,t){var r,n=["export"];return r=t&F?T:1,n=U(n,"default"),n=S(e.declaration)?U(n,this.generateStatement(e.declaration,r)):U(n,this.generateExpression(e.declaration,i.Assignment,7)+this.semicolon(t))},ExportNamedDeclaration:function(e,r){var n,s=["export"],a=this;return n=r&F?T:1,e.declaration?U(s,this.generateStatement(e.declaration,n)):(e.specifiers&&(0===e.specifiers.length?s=U(s,"{"+g+"}"):e.specifiers[0].type===t.ExportBatchSpecifier?s=U(s,this.generateExpression(e.specifiers[0],i.Sequence,7)):(s=U(s,"{"),G((function(t){var r,n;for(s.push(f),r=0,n=e.specifiers.length;r<n;++r)s.push(t),s.push(a.generateExpression(e.specifiers[r],i.Sequence,7)),r+1<n&&s.push(","+f)})),k(R(s).toString())||s.push(f),s.push(o+"}")),e.source?s=U(s,["from"+g,this.generateExpression(e.source,i.Sequence,7),this.semicolon(r)]):s.push(this.semicolon(r))),s)},ExportAllDeclaration:function(e,t){return["export"+g,"*"+g,"from"+g,this.generateExpression(e.source,i.Sequence,7),this.semicolon(t)]},ExpressionStatement:function(e,r){var n,s;return 123===(s=R(n=[this.generateExpression(e.expression,i.Sequence,7)]).toString()).charCodeAt(0)||function(e){var t;return"class"===e.slice(0,5)&&(123===(t=e.charCodeAt(5))||a.code.isWhiteSpace(t)||a.code.isLineTerminator(t))}(s)||function(e){var t;return"function"===e.slice(0,8)&&(40===(t=e.charCodeAt(8))||a.code.isWhiteSpace(t)||42===t||a.code.isLineTerminator(t))}(s)||function(e){var t,i,r;if("async"!==e.slice(0,5))return!1;if(!a.code.isWhiteSpace(e.charCodeAt(5)))return!1;for(i=6,r=e.length;i<r&&a.code.isWhiteSpace(e.charCodeAt(i));++i);return i!==r&&("function"===e.slice(i,i+8)&&(40===(t=e.charCodeAt(i+8))||a.code.isWhiteSpace(t)||42===t||a.code.isLineTerminator(t)))}(s)||v&&16&r&&e.expression.type===t.Literal&&"string"==typeof e.expression.value?n=["(",n,")"+this.semicolon(r)]:n.push(this.semicolon(r)),n},ImportDeclaration:function(e,r){var n,s,a=this;return 0===e.specifiers.length?["import",g,this.generateExpression(e.source,i.Sequence,7),this.semicolon(r)]:(n=["import"],s=0,e.specifiers[s].type===t.ImportDefaultSpecifier&&(n=U(n,[this.generateExpression(e.specifiers[s],i.Sequence,7)]),++s),e.specifiers[s]&&(0!==s&&n.push(","),e.specifiers[s].type===t.ImportNamespaceSpecifier?n=U(n,[g,this.generateExpression(e.specifiers[s],i.Sequence,7)]):(n.push(g+"{"),e.specifiers.length-s==1?(n.push(g),n.push(this.generateExpression(e.specifiers[s],i.Sequence,7)),n.push(g+"}"+g)):(G((function(t){var r,o;for(n.push(f),r=s,o=e.specifiers.length;r<o;++r)n.push(t),n.push(a.generateExpression(e.specifiers[r],i.Sequence,7)),r+1<o&&n.push(","+f)})),k(R(n).toString())||n.push(f),n.push(o+"}"+g)))),n=U(n,["from"+g,this.generateExpression(e.source,i.Sequence,7),this.semicolon(r)]))},VariableDeclarator:function(e,t){var r=1&t?7:6;return e.init?[this.generateExpression(e.id,i.Assignment,r),g,"=",g,this.generateExpression(e.init,i.Assignment,r)]:this.generatePattern(e.id,i.Assignment,r)},VariableDeclaration:function(e,t){var i,r,n,s,a,o=this;function h(){for(s=e.declarations[0],b.comment&&s.leadingComments?(i.push("\n"),i.push(z(o.generateStatement(s,a)))):(i.push(V()),i.push(o.generateStatement(s,a))),r=1,n=e.declarations.length;r<n;++r)s=e.declarations[r],b.comment&&s.leadingComments?(i.push(","+f),i.push(z(o.generateStatement(s,a)))):(i.push(","+g),i.push(o.generateStatement(s,a)))}return i=[e.kind],a=1&t?1:0,e.declarations.length>1?G(h):h(),i.push(this.semicolon(t)),i},ThrowStatement:function(e,t){return[U("throw",this.generateExpression(e.argument,i.Sequence,7)),this.semicolon(t)]},TryStatement:function(e,t){var i,r,n,s;if(i=["try",this.maybeBlock(e.block,1)],i=this.maybeBlockSuffix(e.block,i),e.handlers)for(r=0,n=e.handlers.length;r<n;++r)i=U(i,this.generateStatement(e.handlers[r],1)),(e.finalizer||r+1!==n)&&(i=this.maybeBlockSuffix(e.handlers[r].body,i));else{for(r=0,n=(s=e.guardedHandlers||[]).length;r<n;++r)i=U(i,this.generateStatement(s[r],1)),(e.finalizer||r+1!==n)&&(i=this.maybeBlockSuffix(s[r].body,i));if(e.handler)if(Array.isArray(e.handler))for(r=0,n=e.handler.length;r<n;++r)i=U(i,this.generateStatement(e.handler[r],1)),(e.finalizer||r+1!==n)&&(i=this.maybeBlockSuffix(e.handler[r].body,i));else i=U(i,this.generateStatement(e.handler,1)),e.finalizer&&(i=this.maybeBlockSuffix(e.handler.body,i))}return e.finalizer&&(i=U(i,["finally",this.maybeBlock(e.finalizer,1)])),i},SwitchStatement:function(e,t){var r,n,s,a,o,h=this;if(G((function(){r=["switch"+g+"(",h.generateExpression(e.discriminant,i.Sequence,7),")"+g+"{"+f]})),e.cases)for(o=1,s=0,a=e.cases.length;s<a;++s)s===a-1&&(o|=F),n=z(this.generateStatement(e.cases[s],o)),r.push(n),k(R(n).toString())||r.push(f);return r.push(z("}")),r},SwitchCase:function(e,r){var n,s,a,o,h,u=this;return G((function(){for(n=e.test?[U("case",u.generateExpression(e.test,i.Sequence,7)),":"]:["default:"],a=0,(o=e.consequent.length)&&e.consequent[0].type===t.BlockStatement&&(s=u.maybeBlock(e.consequent[0],1),n.push(s),a=1),a===o||k(R(n).toString())||n.push(f),h=1;a<o;++a)a===o-1&&r&F&&(h|=F),s=z(u.generateStatement(e.consequent[a],h)),n.push(s),a+1===o||k(R(s).toString())||n.push(f)})),n},IfStatement:function(e,r){var n,s,a=this;return G((function(){n=["if"+g+"(",a.generateExpression(e.test,i.Sequence,7),")"]})),s=1,r&F&&(s|=F),e.alternate?(n.push(this.maybeBlock(e.consequent,1)),n=this.maybeBlockSuffix(e.consequent,n),n=e.alternate.type===t.IfStatement?U(n,["else ",this.generateStatement(e.alternate,s)]):U(n,U("else",this.maybeBlock(e.alternate,s)))):n.push(this.maybeBlock(e.consequent,s)),n},ForStatement:function(e,r){var n,s=this;return G((function(){n=["for"+g+"("],e.init?e.init.type===t.VariableDeclaration?n.push(s.generateStatement(e.init,0)):(n.push(s.generateExpression(e.init,i.Sequence,6)),n.push(";")):n.push(";"),e.test?(n.push(g),n.push(s.generateExpression(e.test,i.Sequence,7)),n.push(";")):n.push(";"),e.update?(n.push(g),n.push(s.generateExpression(e.update,i.Sequence,7)),n.push(")")):n.push(")")})),n.push(this.maybeBlock(e.body,r&F?T:1)),n},ForInStatement:function(e,t){return this.generateIterationForStatement("in",e,t&F?T:1)},ForOfStatement:function(e,t){return this.generateIterationForStatement("of",e,t&F?T:1)},LabeledStatement:function(e,t){return[e.label.name+":",this.maybeBlock(e.body,t&F?T:1)]},Program:function(e,t){var i,r,n,s,a;for(s=e.body.length,i=[x&&s>0?"\n":""],a=17,n=0;n<s;++n)x||n!==s-1||(a|=F),A&&(0===n&&(e.body[0].leadingComments||q(e.range[0],e.body[n].range[0],i)),n>0&&(e.body[n-1].trailingComments||e.body[n].leadingComments||q(e.body[n-1].range[1],e.body[n].range[0],i))),r=z(this.generateStatement(e.body[n],a)),i.push(r),n+1<s&&!k(R(r).toString())&&(A&&e.body[n+1].leadingComments||i.push(f)),A&&n===s-1&&(e.body[n].trailingComments||q(e.body[n].range[1],e.range[1],i));return i},FunctionDeclaration:function(e,t){return[Z(e,!0),"function",K(e)||V(),e.id?Y(e.id):"",this.generateFunctionBody(e)]},ReturnStatement:function(e,t){return e.argument?[U("return",this.generateExpression(e.argument,i.Sequence,7)),this.semicolon(t)]:["return"+this.semicolon(t)]},WhileStatement:function(e,t){var r,n=this;return G((function(){r=["while"+g+"(",n.generateExpression(e.test,i.Sequence,7),")"]})),r.push(this.maybeBlock(e.body,t&F?T:1)),r},WithStatement:function(e,t){var r,n=this;return G((function(){r=["with"+g+"(",n.generateExpression(e.object,i.Sequence,7),")"]})),r.push(this.maybeBlock(e.body,t&F?T:1)),r}},I(X.prototype,X.Statement),X.Expression={SequenceExpression:function(e,t,r){var n,s,a;for(i.Sequence<t&&(r|=1),n=[],s=0,a=e.expressions.length;s<a;++s)n.push(this.generateExpression(e.expressions[s],i.Assignment,r)),s+1<a&&n.push(","+g);return H(n,i.Sequence,t)},AssignmentExpression:function(e,t,i){return this.generateAssignment(e.left,e.right,e.operator,t,i)},ArrowFunctionExpression:function(e,t,r){return H(this.generateFunctionBody(e),i.ArrowFunction,t)},ConditionalExpression:function(e,t,r){return i.Conditional<t&&(r|=1),H([this.generateExpression(e.test,i.Coalesce,r),g+"?"+g,this.generateExpression(e.consequent,i.Assignment,r),g+":"+g,this.generateExpression(e.alternate,i.Assignment,r)],i.Conditional,t)},LogicalExpression:function(e,t,i){return"??"===e.operator&&(i|=64),this.BinaryExpression(e,t,i)},BinaryExpression:function(e,t,n){var s,o,h,u,l,c;return u=r[e.operator],o="**"===e.operator?i.Postfix:u,h="**"===e.operator?u:u+1,u<t&&(n|=1),s=47===(c=(l=this.generateExpression(e.left,o,n)).toString()).charCodeAt(c.length-1)&&a.code.isIdentifierPartES5(e.operator.charCodeAt(0))?[l,V(),e.operator]:U(l,e.operator),l=this.generateExpression(e.right,h,n),"/"===e.operator&&"/"===l.toString().charAt(0)||"<"===e.operator.slice(-1)&&"!--"===l.toString().slice(0,3)?(s.push(V()),s.push(l)):s=U(s,l),"in"!==e.operator||1&n?("||"===e.operator||"&&"===e.operator)&&64&n?["(",s,")"]:H(s,u,t):["(",s,")"]},CallExpression:function(e,t,r){var n,s,a;for(n=[this.generateExpression(e.callee,i.Call,3)],e.optional&&n.push("?."),n.push("("),s=0,a=e.arguments.length;s<a;++s)n.push(this.generateExpression(e.arguments[s],i.Assignment,7)),s+1<a&&n.push(","+g);return n.push(")"),2&r?H(n,i.Call,t):["(",n,")"]},ChainExpression:function(e,t,r){return i.OptionalChaining<t&&(r|=2),H(this.generateExpression(e.expression,i.OptionalChaining,r),i.OptionalChaining,t)},NewExpression:function(e,t,r){var n,s,a,o,h;if(s=e.arguments.length,h=4&r&&!m&&0===s?5:1,n=U("new",this.generateExpression(e.callee,i.New,h)),!(4&r)||m||s>0){for(n.push("("),a=0,o=s;a<o;++a)n.push(this.generateExpression(e.arguments[a],i.Assignment,7)),a+1<o&&n.push(","+g);n.push(")")}return H(n,i.New,t)},MemberExpression:function(e,r,n){var s,o;return s=[this.generateExpression(e.object,i.Call,2&n?3:1)],e.computed?(e.optional&&s.push("?."),s.push("["),s.push(this.generateExpression(e.property,i.Sequence,2&n?7:5)),s.push("]")):(e.optional||e.object.type!==t.Literal||"number"!=typeof e.object.value||(o=R(s).toString()).indexOf(".")<0&&!/[eExX]/.test(o)&&a.code.isDecimalDigit(o.charCodeAt(o.length-1))&&!(o.length>=2&&48===o.charCodeAt(0))&&s.push(" "),s.push(e.optional?"?.":"."),s.push(Y(e.property))),H(s,i.Member,r)},MetaProperty:function(e,t,r){var n;return(n=[]).push("string"==typeof e.meta?e.meta:Y(e.meta)),n.push("."),n.push("string"==typeof e.property?e.property:Y(e.property)),H(n,i.Member,t)},UnaryExpression:function(e,t,r){var n,s,o,h,u;return s=this.generateExpression(e.argument,i.Unary,7),""===g?n=U(e.operator,s):(n=[e.operator],e.operator.length>2?n=U(n,s):(u=(h=R(n).toString()).charCodeAt(h.length-1),o=s.toString().charCodeAt(0),(43===u||45===u)&&u===o||a.code.isIdentifierPartES5(u)&&a.code.isIdentifierPartES5(o)?(n.push(V()),n.push(s)):n.push(s))),H(n,i.Unary,t)},YieldExpression:function(e,t,r){var n;return n=e.delegate?"yield*":"yield",e.argument&&(n=U(n,this.generateExpression(e.argument,i.Yield,7))),H(n,i.Yield,t)},AwaitExpression:function(e,t,r){return H(U(e.all?"await*":"await",this.generateExpression(e.argument,i.Await,7)),i.Await,t)},UpdateExpression:function(e,t,r){return e.prefix?H([e.operator,this.generateExpression(e.argument,i.Unary,7)],i.Unary,t):H([this.generateExpression(e.argument,i.Postfix,7),e.operator],i.Postfix,t)},FunctionExpression:function(e,t,i){var r=[Z(e,!0),"function"];return e.id?(r.push(K(e)||V()),r.push(Y(e.id))):r.push(K(e)||g),r.push(this.generateFunctionBody(e)),r},ArrayPattern:function(e,t,i){return this.ArrayExpression(e,t,i,!0)},ArrayExpression:function(e,t,r,n){var s,a,h=this;return e.elements.length?(a=!n&&e.elements.length>1,s=["[",a?f:""],G((function(t){var r,n;for(r=0,n=e.elements.length;r<n;++r)e.elements[r]?(s.push(a?t:""),s.push(h.generateExpression(e.elements[r],i.Assignment,7))):(a&&s.push(t),r+1===n&&s.push(",")),r+1<n&&s.push(","+(a?f:g))})),a&&!k(R(s).toString())&&s.push(f),s.push(a?o:""),s.push("]"),s):"[]"},RestElement:function(e,t,i){return"..."+this.generatePattern(e.argument)},ClassExpression:function(e,t,r){var n,s;return n=["class"],e.id&&(n=U(n,this.generateExpression(e.id,i.Sequence,7))),e.superClass&&(s=U("extends",this.generateExpression(e.superClass,i.Unary,7)),n=U(n,s)),n.push(g),n.push(this.generateStatement(e.body,T)),n},MethodDefinition:function(e,t,i){var r,n;return r=e.static?["static"+g]:[],n="get"===e.kind||"set"===e.kind?[U(e.kind,this.generatePropertyKey(e.key,e.computed)),this.generateFunctionBody(e.value)]:[J(e),this.generatePropertyKey(e.key,e.computed),this.generateFunctionBody(e.value)],U(r,n)},Property:function(e,t,r){return"get"===e.kind||"set"===e.kind?[e.kind,V(),this.generatePropertyKey(e.key,e.computed),this.generateFunctionBody(e.value)]:e.shorthand?"AssignmentPattern"===e.value.type?this.AssignmentPattern(e.value,i.Sequence,7):this.generatePropertyKey(e.key,e.computed):e.method?[J(e),this.generatePropertyKey(e.key,e.computed),this.generateFunctionBody(e.value)]:[this.generatePropertyKey(e.key,e.computed),":"+g,this.generateExpression(e.value,i.Assignment,7)]},ObjectExpression:function(e,t,r){var n,s,a,h,u=this;return e.properties.length?(n=e.properties.length>1,G((function(){a=u.generateExpression(e.properties[0],i.Sequence,7)})),n||(h=R(a).toString(),/[\r\n]/g.test(h))?(G((function(t){var r,o;if(s=["{",f,t,a],n)for(s.push(","+f),r=1,o=e.properties.length;r<o;++r)s.push(t),s.push(u.generateExpression(e.properties[r],i.Sequence,7)),r+1<o&&s.push(","+f)})),k(R(s).toString())||s.push(f),s.push(o),s.push("}"),s):["{",g,a,g,"}"]):"{}"},AssignmentPattern:function(e,t,i){return this.generateAssignment(e.left,e.right,"=",t,i)},ObjectPattern:function(e,r,n){var s,a,h,u,l,c=this;if(!e.properties.length)return"{}";if(u=!1,1===e.properties.length)(l=e.properties[0]).type===t.Property&&l.value.type!==t.Identifier&&(u=!0);else for(a=0,h=e.properties.length;a<h;++a)if((l=e.properties[a]).type===t.Property&&!l.shorthand){u=!0;break}return s=["{",u?f:""],G((function(t){var r,n;for(r=0,n=e.properties.length;r<n;++r)s.push(u?t:""),s.push(c.generateExpression(e.properties[r],i.Sequence,7)),r+1<n&&s.push(","+(u?f:g))})),u&&!k(R(s).toString())&&s.push(f),s.push(u?o:""),s.push("}"),s},ThisExpression:function(e,t,i){return"this"},Super:function(e,t,i){return"super"},Identifier:function(e,t,i){return Y(e)},ImportDefaultSpecifier:function(e,t,i){return Y(e.id||e.local)},ImportNamespaceSpecifier:function(e,t,i){var r=["*"],n=e.id||e.local;return n&&r.push(g+"as"+V()+Y(n)),r},ImportSpecifier:function(e,t,i){var r=e.imported,n=[r.name],s=e.local;return s&&s.name!==r.name&&n.push(V()+"as"+V()+Y(s)),n},ExportSpecifier:function(e,t,i){var r=e.local,n=[r.name],s=e.exported;return s&&s.name!==r.name&&n.push(V()+"as"+V()+Y(s)),n},Literal:function(e,i,r){var n;if(e.hasOwnProperty("raw")&&_&&b.raw)try{if((n=_(e.raw).body[0].expression).type===t.Literal&&n.value===e.value)return e.raw}catch(e){}return e.regex?"/"+e.regex.pattern+"/"+e.regex.flags:"bigint"==typeof e.value?e.value.toString()+"n":e.bigint?e.bigint+"n":null===e.value?"null":"string"==typeof e.value?function(e){var t,i,r,n,s,o="",h=0,l=0;for(t=0,i=e.length;t<i;++t){if(39===(r=e.charCodeAt(t)))++h;else if(34===r)++l;else if(47===r&&u)o+="\\";else{if(a.code.isLineTerminator(r)||92===r){o+=P(r);continue}if(!a.code.isIdentifierPartES5(r)&&(u&&r<32||!u&&!d&&(r<32||r>126))){o+=O(r,e.charCodeAt(t+1));continue}}o+=String.fromCharCode(r)}if(s=(n=!("double"===p||"auto"===p&&l<h))?"'":'"',!(n?h:l))return s+o+s;for(e=o,o=s,t=0,i=e.length;t<i;++t)(39===(r=e.charCodeAt(t))&&n||34===r&&!n)&&(o+="\\"),o+=String.fromCharCode(r);return o+s}(e.value):"number"==typeof e.value?function(e){var t,i,r,n,s;if(e!=e)throw new Error("Numeric literal whose value is NaN");if(e<0||0===e&&1/e<0)throw new Error("Numeric literal whose value is negative");if(e===1/0)return u?"null":l?"1e400":"1e+400";if(t=""+e,!l||t.length<3)return t;for(i=t.indexOf("."),u||48!==t.charCodeAt(0)||1!==i||(i=0,t=t.slice(1)),r=t,t=t.replace("e+","e"),n=0,(s=r.indexOf("e"))>0&&(n=+r.slice(s+1),r=r.slice(0,s)),i>=0&&(n-=r.length-i-1,r=+(r.slice(0,i)+r.slice(i+1))+""),s=0;48===r.charCodeAt(r.length+s-1);)--s;return 0!==s&&(n-=s,r=r.slice(0,s)),0!==n&&(r+="e"+n),(r.length<t.length||c&&e>1e12&&Math.floor(e)===e&&(r="0x"+e.toString(16)).length<t.length)&&+r===e&&(t=r),t}(e.value):"boolean"==typeof e.value?e.value?"true":"false":function(e){var t,i,r,n,s,a,o,h;if(i=e.toString(),e.source){if(!(t=i.match(/\/([^/]*)$/)))return i;for(r=t[1],i="",o=!1,h=!1,n=0,s=e.source.length;n<s;++n)a=e.source.charCodeAt(n),h?(i+=L(a,h),h=!1):(o?93===a&&(o=!1):47===a?i+="\\":91===a&&(o=!0),i+=L(a,h),h=92===a);return"/"+i+"/"+r}return i}(e.value)},GeneratorExpression:function(e,t,i){return this.ComprehensionExpression(e,t,i)},ComprehensionExpression:function(e,r,n){var s,a,o,h,u=this;return s=e.type===t.GeneratorExpression?["("]:["["],b.moz.comprehensionExpressionStartsWithAssignment&&(h=this.generateExpression(e.body,i.Assignment,7),s.push(h)),e.blocks&&G((function(){for(a=0,o=e.blocks.length;a<o;++a)h=u.generateExpression(e.blocks[a],i.Sequence,7),a>0||b.moz.comprehensionExpressionStartsWithAssignment?s=U(s,h):s.push(h)})),e.filter&&(s=U(s,"if"+g),h=this.generateExpression(e.filter,i.Sequence,7),s=U(s,["(",h,")"])),b.moz.comprehensionExpressionStartsWithAssignment||(h=this.generateExpression(e.body,i.Assignment,7),s=U(s,h)),s.push(e.type===t.GeneratorExpression?")":"]"),s},ComprehensionBlock:function(e,r,n){var s;return s=U(s=e.left.type===t.VariableDeclaration?[e.left.kind,V(),this.generateStatement(e.left.declarations[0],0)]:this.generateExpression(e.left,i.Call,7),e.of?"of":"in"),s=U(s,this.generateExpression(e.right,i.Sequence,7)),["for"+g+"(",s,")"]},SpreadElement:function(e,t,r){return["...",this.generateExpression(e.argument,i.Assignment,7)]},TaggedTemplateExpression:function(e,t,r){var n=3;return 2&r||(n=1),H([this.generateExpression(e.tag,i.Call,n),this.generateExpression(e.quasi,i.Primary,4)],i.TaggedTemplate,t)},TemplateElement:function(e,t,i){return e.value.raw},TemplateLiteral:function(e,t,r){var n,s,a;for(n=["`"],s=0,a=e.quasis.length;s<a;++s)n.push(this.generateExpression(e.quasis[s],i.Primary,7)),s+1<a&&(n.push("${"+g),n.push(this.generateExpression(e.expressions[s],i.Sequence,7)),n.push(g+"}"));return n.push("`"),n},ModuleSpecifier:function(e,t,i){return this.Literal(e,t,i)},ImportExpression:function(e,t,r){return H(["import(",this.generateExpression(e.source,i.Assignment,7),")"],i.Call,t)}},I(X.prototype,X.Expression),X.prototype.generateExpression=function(e,r,n){var s,a;return a=e.type||t.Property,b.verbatim&&e.hasOwnProperty(b.verbatim)?function(e,t){var r;return R("string"==typeof(r=e[b.verbatim])?H(W(r),i.Sequence,t):H(W(r.content),null!=r.precedence?r.precedence:i.Sequence,t),e)}(e,r):(s=this[a](e,r,n),b.comment&&(s=$(e,s)),R(s,e))},X.prototype.generateStatement=function(e,i){var r,n;return r=this[e.type](e,i),b.comment&&(r=$(e,r)),n=R(r).toString(),e.type!==t.Program||x||""!==f||"\n"!==n.charAt(n.length-1)||(r=w?R(r).replaceRight(/\s+$/,""):n.replace(/\s+$/,"")),R(r,e)},E={indent:{style:"",base:0},renumber:!0,hexadecimal:!0,quotes:"auto",escapeless:!0,compact:!0,parentheses:!1,semicolons:!1},D={indent:{style:" ",base:0,adjustMultilineComment:!1},newline:"\n",space:" ",json:!1,renumber:!1,hexadecimal:!1,quotes:"single",escapeless:!1,compact:!1,parentheses:!0,semicolons:!0,safeConcatenation:!1,preserveBlankLines:!1},e.version=gp,e.generate=function(t,i){var r,s,a={indent:null,base:null,parse:null,comment:!1,format:{indent:{style:" ",base:0,adjustMultilineComment:!1},newline:"\n",space:" ",json:!1,renumber:!1,hexadecimal:!1,quotes:"single",escapeless:!1,compact:!1,parentheses:!0,semicolons:!0,safeConcatenation:!1,preserveBlankLines:!1},moz:{comprehensionExpressionStartsWithAssignment:!1,starlessGenerator:!1},sourceMap:null,sourceMapRoot:null,sourceMapWithCode:!1,directive:!1,raw:!0,verbatim:null,sourceCode:null};return null!=i?("string"==typeof i.indent&&(a.format.indent.style=i.indent),"number"==typeof i.base&&(a.format.indent.base=i.base),i=B(a,i),h=i.format.indent.style,o="string"==typeof i.base?i.base:M(h,i.format.indent.base)):(h=(i=a).format.indent.style,o=M(h,i.format.indent.base)),u=i.format.json,l=i.format.renumber,c=!u&&i.format.hexadecimal,p=u?"double":i.format.quotes,d=i.format.escapeless,f=i.format.newline,g=i.format.space,i.format.compact&&(f=g=h=o=""),m=i.format.parentheses,y=i.format.semicolons,x=i.format.safeConcatenation,v=i.directive,_=u?null:i.parse,w=i.sourceMap,C=i.sourceCode,A=i.format.preserveBlankLines&&null!==C,b=i,w&&(n=e.browser?Rr.sourceMap.SourceNode:fp().SourceNode),r=Q(t),w?(s=r.toStringWithSourceMap({file:i.file,sourceRoot:i.sourceMapRoot}),i.sourceContent&&s.map.setSourceContent(i.sourceMap,i.sourceContent),i.sourceMapWithCode?s:s.map.toString()):(s={code:r.toString(),map:null},i.sourceMapWithCode?s:s.code)},e.attachComments=s.attachComments,e.Precedence=B({},i),e.browser=!1,e.FORMAT_MINIFY=E,e.FORMAT_DEFAULTS=D}()}(Tc);var mp=Vr(Tc);let yp=0;function xp(e){switch(e){case"+":return"add";case"-":return"sub";case"*":return"mult";case"/":return"div";case"%":return"mod";case"==":case"===":return"equalTo";case"!=":case"!==":return"notEqual";case">":return"greaterThan";case">=":return"greaterEqual";case"<":return"lessThan";case"<=":return"lessEqual";case"&&":return"and";case"||":return"or"}}function vp(e){return"CallExpression"===e.type&&("Identifier"===e.callee?.type&&e.callee?.name.startsWith("uniform")||"MemberExpression"===e.callee?.type&&e.callee?.property.name.startsWith("uniform"))}const bp={UnaryExpression(e,t,i){if(i.some(vp))return;const r=xu[e.operator],n=e=>{e.type="CallExpression",e.callee={type:"Identifier",name:`__p5.${r}`},e.arguments=[e.argument]};if("MemberExpression"===e.type){const t=e.argument.property.name;let i=[["x","y","z","w"],["r","g","b","a"],["s","t","p","q"]].some((e=>[...t].every((t=>e.includes(t)))))&&"MemberExpression"===e.argument.type;i?(e.type="MemberExpression",e.object={type:"CallExpression",callee:{type:"Identifier",name:`__p5.${r}`},arguments:[e.argument.object]},e.property={type:"Identifier",name:t}):n(e)}else n(e);delete e.argument,delete e.operator},BreakStatement(e,t,i){i.some(vp)||(e.callee={type:"Identifier",name:"__p5.break"},e.arguments=[],e.type="CallExpression")},VariableDeclarator(e,t,i){if(!i.some(vp)){if(vp(e.init)){const t={type:"Literal",value:e.id.name};e.init.arguments.unshift(t)}if(function(e){return"CallExpression"===e?.type&&("Identifier"===e.callee?.type&&(e.callee?.name.startsWith("varying")||e.callee?.name.startsWith("shared"))||"MemberExpression"===e.callee?.type&&(e.callee?.property.name.startsWith("varying")||e.callee?.property.name.startsWith("shared")))}(e.init)){const i={type:"Literal",value:e.id.name};e.init.arguments.unshift(i),t.varyings[e.id.name]=i}}},Identifier(e,t,i){i.some(vp)||t.varyings[e.name]&&!i.some((t=>"AssignmentExpression"===t.type&&t.left===e))&&(e.type="ExpressionStatement",e.expression={type:"CallExpression",callee:{type:"MemberExpression",object:{type:"Identifier",name:e.name},property:{type:"Identifier",name:"getValue"}},arguments:[]})},ArrayExpression(e,t,i){if(i.some(vp))return;const r=JSON.parse(JSON.stringify(e));e.type="CallExpression",e.callee={type:"Identifier",name:"__p5.strandsNode"},e.arguments=[r]},AssignmentExpression(e,t,i){if(!i.some(vp)){if("="!==e.operator){const t=xp(e.operator.replace("=","")),i={type:"CallExpression",callee:{type:"MemberExpression",object:e.left,property:{type:"Identifier",name:t}},arguments:[e.right]};e.operator="=",e.right=i}if(t.varyings[e.left.name])e.type="ExpressionStatement",e.expression={type:"CallExpression",callee:{type:"MemberExpression",object:{type:"Identifier",name:e.left.name},property:{type:"Identifier",name:"bridge"}},arguments:[e.right]};else if("MemberExpression"===e.left.type){let i=null;if("Identifier"===e.left.object.type&&t.varyings[e.left.object.name]?i=e.left.object.name:"ExpressionStatement"===e.left.object.type&&"CallExpression"===e.left.object.expression?.type&&"MemberExpression"===e.left.object.expression.callee?.type&&"getValue"===e.left.object.expression.callee.property?.name&&"Identifier"===e.left.object.expression.callee.object?.type&&t.varyings[e.left.object.expression.callee.object.name]&&(i=e.left.object.expression.callee.object.name),i){const t=e.left.property.name;e.type="ExpressionStatement",e.expression={type:"CallExpression",callee:{type:"MemberExpression",object:{type:"Identifier",name:i},property:{type:"Identifier",name:"bridgeSwizzle"}},arguments:[{type:"Literal",value:t},e.right]}}}}},BinaryExpression(e,t,i){if(i.some(vp))return;if(["Literal","ArrayExpression","Identifier"].includes(e.left.type)){const t={type:"CallExpression",callee:{type:"Identifier",name:"__p5.strandsNode"},arguments:[e.left]};e.left=t}e.type="CallExpression",e.callee={type:"MemberExpression",object:e.left,property:{type:"Identifier",name:xp(e.operator)}},e.arguments=[e.right]},IfStatement(e,t,i){if(i.some(vp))return;const r=e.test,n={type:"ArrowFunctionExpression",params:[],body:"BlockStatement"===e.consequent.type?e.consequent:{type:"BlockStatement",body:[e.consequent]}};let s,a={type:"CallExpression",callee:{type:"Identifier",name:"__p5.strandsIf"},arguments:[r,n]};s=e.alternate?{type:"ArrowFunctionExpression",params:[],body:"BlockStatement"===e.alternate.type?e.alternate:{type:"BlockStatement",body:[e.alternate]}}:{type:"ArrowFunctionExpression",params:[],body:{type:"BlockStatement",body:[]}},a={type:"CallExpression",callee:{type:"MemberExpression",object:a,property:{type:"Identifier",name:"Else"}},arguments:[s]};const o=new Set,h=e=>{if("BlockStatement"!==e.type)return;const t=new Set;for(const i of e.body)if("VariableDeclaration"===i.type)for(const e of i.declarations)"Identifier"===e.id.type&&t.add(e.id.name);for(const i of e.body)if("ExpressionStatement"===i.type&&"AssignmentExpression"===i.expression.type){const e=i.expression.left;"Identifier"===e.type?t.has(e.name)||o.add(e.name):"MemberExpression"===e.type&&"Identifier"===e.object.type&&(t.has(e.object.name)||o.add(e.object.name))}else"BlockStatement"===i.type&&h(i)};if(h(n.body),h(s.body),o.size>0){const t=(e,t)=>{if("BlockStatement"===e.type){const i=new Map,r=[];for(const e of t){const t=`__copy_${e}_${yp++}`;i.set(e,t),r.push({type:"VariableDeclaration",declarations:[{type:"VariableDeclarator",id:{type:"Identifier",name:t},init:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"Identifier",name:e},property:{type:"Identifier",name:"copy"},computed:!1},arguments:[]}}],kind:"let"})}const n=e=>{if(e&&"object"==typeof e){"Identifier"===e.type&&i.has(e.name)?e.name=i.get(e.name):"MemberExpression"===e.type&&"Identifier"===e.object.type&&i.has(e.object.name)&&(e.object.name=i.get(e.object.name)),"AssignmentExpression"!==e.type||"Identifier"!==e.left.type||!i.has(e.left.name)||"Literal"!==e.right.type&&"ArrayExpression"!==e.right.type||(e.right={type:"CallExpression",callee:{type:"Identifier",name:"__p5.strandsNode"},arguments:[e.right]});for(const t in e)e.hasOwnProperty(t)&&"parent"!==t&&(Array.isArray(e[t])?e[t].forEach(n):"object"==typeof e[t]&&n(e[t]))}};e.body.forEach(n),e.body.unshift(...r);const s={type:"ObjectExpression",properties:Array.from(t).map((e=>({type:"Property",key:{type:"Identifier",name:e},value:{type:"Identifier",name:i.get(e)},kind:"init",computed:!1,shorthand:!1})))};e.body.push({type:"ReturnStatement",argument:s})}};t(n.body,o),t(s.body,o);const i="__block_"+yp++,r=[];for(const e of o)r.push({type:"ExpressionStatement",expression:{type:"AssignmentExpression",operator:"=",left:{type:"Identifier",name:e},right:{type:"CallExpression",callee:{type:"Identifier",name:"__p5.strandsNode"},arguments:[{type:"Identifier",name:e}]}}});r.push({type:"VariableDeclaration",declarations:[{type:"VariableDeclarator",id:{type:"Identifier",name:i},init:a}],kind:"const"});for(const e of o)r.push({type:"ExpressionStatement",expression:{type:"AssignmentExpression",operator:"=",left:{type:"Identifier",name:e},right:{type:"MemberExpression",object:{type:"Identifier",name:i},property:{type:"Identifier",name:e},computed:!1}}});e.type="BlockStatement",e.body=r}else e.type="ExpressionStatement",e.expression=a;delete e.test,delete e.consequent,delete e.alternate},UpdateExpression(e,t,i){if(i.some(vp))return;let r;if("++"===e.operator)r="+";else{if("--"!==e.operator)return;r="-"}const n={type:"AssignmentExpression",operator:"=",left:e.argument,right:{type:"BinaryExpression",operator:r,left:e.argument,right:{type:"Literal",value:1}}};Object.assign(e,n),delete e.prefix,this.BinaryExpression(e.right,t,[...i,e]),this.AssignmentExpression(e,t,i)},ForStatement(e,t,i){if(i.some(vp))return;let r;if(e.init&&"VariableDeclaration"===e.init.type){let t=e.init.declarations[0].init;t={body:[{type:"ExpressionStatement",expression:t}]}.body[0].expression,r={type:"ArrowFunctionExpression",params:[],body:{type:"BlockStatement",body:[{type:"ReturnStatement",argument:t}]}}}else r={type:"ArrowFunctionExpression",params:[],body:{type:"BlockStatement",body:[{type:"ReturnStatement",argument:{type:"Literal",value:0}}]}};let n=e.test||{type:"Literal",value:!0};if("VariableDeclaration"===e.init?.type){const t=e.init.declarations[0].id.name;n=this.replaceIdentifierReferences(n,t,"loopVar")}n={body:[{type:"ExpressionStatement",expression:n}]}.body[0].expression;const s={type:"ArrowFunctionExpression",params:[{type:"Identifier",name:"loopVar"}],body:n};let a;if(e.update){let t=e.update;if("VariableDeclaration"===e.init?.type){const i=e.init.declarations[0].id.name;t=this.replaceIdentifierReferences(t,i,"loopVar")}t={body:[{type:"ExpressionStatement",expression:t}]}.body[0].expression,a={type:"ArrowFunctionExpression",params:[{type:"Identifier",name:"loopVar"}],body:{type:"BlockStatement",body:[{type:"ReturnStatement",argument:t}]}}}else a={type:"ArrowFunctionExpression",params:[{type:"Identifier",name:"loopVar"}],body:{type:"BlockStatement",body:[{type:"ReturnStatement",argument:{type:"Identifier",name:"loopVar"}}]}};let o="BlockStatement"===e.body.type?e.body:{type:"BlockStatement",body:[e.body]};if("VariableDeclaration"===e.init?.type){const t=e.init.declarations[0].id.name;o=this.replaceIdentifierReferences(o,t,"loopVar")}const h={type:"ArrowFunctionExpression",params:[{type:"Identifier",name:"loopVar"},{type:"Identifier",name:"vars"}],body:o},u=new Set,l=(e,t=new Set)=>{if("BlockStatement"!==e.type)return;const i=new Set([...t]);for(const t of e.body)if("VariableDeclaration"===t.type)for(const e of t.declarations)"Identifier"===e.id.type&&i.add(e.id.name);for(const t of e.body)if("ExpressionStatement"===t.type&&"AssignmentExpression"===t.expression.type){const e=t.expression.left;"Identifier"===e.type?i.has(e.name)||u.add(e.name):"MemberExpression"===e.type&&"Identifier"===e.object.type&&(i.has(e.object.name)||u.add(e.object.name))}else"BlockStatement"===t.type&&l(t,i)};if(l(h.body),u.size>0){const t=(e,t)=>{if("BlockStatement"===e.type){const i=new Map,r=[];for(const e of t){const t=`__copy_${e}_${yp++}`;i.set(e,t),r.push({type:"VariableDeclaration",declarations:[{type:"VariableDeclarator",id:{type:"Identifier",name:t},init:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"MemberExpression",object:{type:"Identifier",name:"vars"},property:{type:"Identifier",name:e},computed:!1},property:{type:"Identifier",name:"copy"},computed:!1},arguments:[]}}],kind:"let"})}const n=e=>{if(e&&"object"==typeof e){"Identifier"===e.type&&i.has(e.name)&&(e.name=i.get(e.name));for(const t in e)e.hasOwnProperty(t)&&"parent"!==t&&(Array.isArray(e[t])?e[t].forEach(n):"object"==typeof e[t]&&n(e[t]))}};e.body.forEach(n),e.body.unshift(...r);const s={type:"ObjectExpression",properties:Array.from(t).map((e=>({type:"Property",key:{type:"Identifier",name:e},value:{type:"Identifier",name:i.get(e)},kind:"init",computed:!1,shorthand:!1})))};e.body.push({type:"ReturnStatement",argument:s})}};t(h.body,u);const i="__block_"+yp++,n=[],o=[];for(const e of u)o.push({type:"Property",key:{type:"Identifier",name:e},value:{type:"CallExpression",callee:{type:"Identifier",name:"__p5.strandsNode"},arguments:[{type:"Identifier",name:e}]},kind:"init",method:!1,shorthand:!1,computed:!1});const l={type:"CallExpression",callee:{type:"Identifier",name:"__p5.strandsFor"},arguments:[r,s,a,h,{type:"ObjectExpression",properties:o}]};n.push({type:"VariableDeclaration",declarations:[{type:"VariableDeclarator",id:{type:"Identifier",name:i},init:l}],kind:"const"});for(const e of u)n.push({type:"ExpressionStatement",expression:{type:"AssignmentExpression",operator:"=",left:{type:"Identifier",name:e},right:{type:"MemberExpression",object:{type:"Identifier",name:i},property:{type:"Identifier",name:e},computed:!1}}});e.type="BlockStatement",e.body=n}else e.type="ExpressionStatement",e.expression={type:"CallExpression",callee:{type:"Identifier",name:"__p5.strandsFor"},arguments:[r,s,a,h,{type:"ObjectExpression",properties:[]}]};delete e.init,delete e.test,delete e.update},replaceIdentifierReferences(e,t,i){if(!e||"object"!=typeof e)return e;const r=e=>{if(!e||"object"!=typeof e)return e;if("Identifier"===e.type&&e.name===t)return{...e,name:i};const n={...e};for(const t in e)e.hasOwnProperty(t)&&"parent"!==t&&(Array.isArray(e[t])?n[t]=e[t].map(r):"object"==typeof e[t]&&(n[t]=r(e[t])));return n};return r(e)}};function _p(e,t,i,r){const n=function(e,t){return bl.parse(e,t)}(t,{ecmaVersion:2021,locations:i}),s={...bp};var a,o,h,u;delete s.IfStatement,delete s.ForStatement,a=s,u=[],(o=void 0)||(o=Fc),function e(t,i,r){var n=r||t.type,s=t!==u[u.length-1];s&&u.push(t),o[n](t,i,e),a[n]&&a[n](t,i||u,u),s&&u.pop()}(n,{varyings:{}},h);const l={IfStatement(e,t,i){e.test&&i(e.test,t),e.consequent&&i(e.consequent,t),e.alternate&&i(e.alternate,t),bp.IfStatement(e,t,[])},ForStatement(e,t,i){e.init&&i(e.init,t),e.test&&i(e.test,t),e.update&&i(e.update,t),e.body&&i(e.body,t),bp.ForStatement(e,t,[])}};Ec(n,{varyings:{}},l);const c=mp.generate(n),p=Object.keys(r),d=new Function("__p5",...p,c.slice(c.indexOf("{")+1,c.lastIndexOf("}")).replaceAll(";",""));return()=>d(e,...p.map((e=>r[e])))}function wp(e,t){e.blockStack.push(t),e.blockOrder.push(t),e.currentBlock=t}function Cp(e){e.blockStack.pop();const t=e.blockStack.length;e.currentBlock=e.blockStack[t-1]}function Ap(e,t){e.blockStack.push(t),e.currentBlock=t}function Ep(e,t){const i=e.nextID++;return e.blockTypes[i]=t,e.incomingEdges[i]=[],e.outgoingEdges[i]=[],e.blockInstructions[i]=[],i}function Dp(e,t,i){e.outgoingEdges[t].push(i),e.incomingEdges[i].push(t)}function Sp(e,t,i){void 0===i&&bu("undefined nodeID in `recordInBasicBlock()`"),void 0===t&&bu("undefined blockID in `recordInBasicBlock()"),e.blockInstructions[t]=e.blockInstructions[t]||[],e.blockInstructions[t].push(i)}function Fp(e,t){const i=new Set,r=[];return function t(n){if(!i.has(n)){i.add(n);for(let i of e[n].sort(((e,t)=>t-e))||[])t(i);r.push(n)}}(t),r.reverse()}class Tp{constructor(e,t,i){this.id=e,this.strandsContext=i,this.dimension=t;const r=Eu(this.strandsContext.dag,this.id);r&&r.identifier&&(this._originalIdentifier=r.identifier,this._originalBaseType=r.baseType,this._originalDimension=r.dimension)}copy(){return Mp(this.id,this.dimension,this.strandsContext)}bridge(e){const{dag:t,cfg:i}=this.strandsContext,r=Eu(t,this.id),n=r?.baseType??tu;let s;if(e instanceof Tp)s=e.id;else{s=Vp(this.strandsContext,{baseType:n,dimension:this.dimension},e).id}if(this._originalIdentifier){const{id:e}=Bp(this.strandsContext,{baseType:this._originalBaseType,dimension:this._originalDimension},this._originalIdentifier),r=Cu(t,Au({nodeType:Xh.ASSIGNMENT,dependsOn:[e,s],phiBlocks:[]}));Sp(i,i.currentBlock,r),this.strandsContext.globalAssignments.push(r);const n=Cu(t,Au({nodeType:Xh.VARIABLE,baseType:this._originalBaseType,dimension:this._originalDimension,identifier:this._originalIdentifier}));this.id=n}else this.id=s;return this}bridgeSwizzle(e,t){const{dag:i,cfg:r}=this.strandsContext,n=Eu(i,this.id),s=n?.baseType??tu;let a;if(t instanceof Tp)a=t.id;else{a=Vp(this.strandsContext,{baseType:s,dimension:this.dimension},t).id}if(this._originalIdentifier){const{id:t}=Bp(this.strandsContext,{baseType:this._originalBaseType,dimension:this._originalDimension},this._originalIdentifier),n=Cu(i,Au({nodeType:Xh.OPERATION,opCode:fu.SWIZZLE,baseType:this._originalBaseType,dimension:e.length,swizzle:e,dependsOn:[t]})),s=Cu(i,Au({nodeType:Xh.ASSIGNMENT,dependsOn:[n,a],phiBlocks:[]}));Sp(r,r.currentBlock,s),this.strandsContext.globalAssignments.push(s);const o=Cu(i,Au({nodeType:Xh.VARIABLE,baseType:this._originalBaseType,dimension:this._originalDimension,identifier:this._originalIdentifier}));this.id=o}else this.id=a;return this}getValue(){if(this._originalIdentifier){const{id:e,dimension:t}=Bp(this.strandsContext,{baseType:this._originalBaseType,dimension:this._originalDimension},this._originalIdentifier);return Mp(e,t,this.strandsContext)}return this}}function Mp(e,t,i,r){return new Proxy(new Tp(e,t,i),function(e,t,i,r){const n=[["x","y","z","w"],["r","g","b","a"],["s","t","p","q"]].map((e=>e.slice(0,t))),s={get(e,t,r){if(t in e)return Reflect.get(...arguments);for(const r of n)if([...t.toString()].every((e=>r.includes(e)))){const s=[...t].map((e=>{const t=r.indexOf(e);return n[0][t]})).join(""),a=jp(i,e,s);return Mp(a.id,a.dimension,i)}},set(e,t,s,a){for(const a of n){const n=[...t];if(!(n.every((e=>a.includes(e)))&&new Set(n).size===n.length&&e.dimension>=n.length))continue;const o=e.dimension,h=new Array(o);for(let t=0;t<o;t++){const{id:r,dimension:n}=jp(i,e,"xyzw"[t]);h[t]=Mp(r,n,i)}let u=[];if(s instanceof Tp)if(1===s.dimension)u=Array(n.length).fill(s);else if(s.dimension===n.length)for(let e=0;e<n.length;e++){const{id:t,dimension:r}=jp(i,s,"xyzw"[e]);u.push(Mp(t,r,i))}else _u("type error",`Swizzle assignment: RHS vector does not match LHS vector (need ${n.length}, got ${s.dimension}).`);else if(Array.isArray(s)){const e=s.flat(1/0);1===e.length?u=Array(n.length).fill(e[0]):e.length===n.length?u=e:_u("type error",`Swizzle assignment: RHS length ${e.length} does not match ${n.length}.`)}else"number"==typeof s?u=Array(n.length).fill(s):_u("type error",`Unsupported RHS for swizzle assignment: ${s}`);for(let e=0;e<n.length;e++){h[a.indexOf(n[e])]=u[e]}const l=Eu(i.dag,e.id),c=l?.baseType??tu,{id:p}=Vp(i,{baseType:c,dimension:o},h);return e.id=p,"function"==typeof r&&r(p),!0}return Reflect.set(...arguments)}};return s}(0,t,i,r))}const kp={...{acos:[{params:[cu.FLOAT],returnType:cu.FLOAT,isp5Function:!0}],acosh:[{params:[cu.FLOAT],returnType:cu.FLOAT,isp5Function:!1}],asin:[{params:[cu.FLOAT],returnType:cu.FLOAT,isp5Function:!0}],asinh:[{params:[cu.FLOAT],returnType:cu.FLOAT,isp5Function:!1}],atan:[{params:[cu.FLOAT],returnType:cu.FLOAT,isp5Function:!0},{params:[cu.FLOAT,cu.FLOAT],returnType:cu.FLOAT,isp5Function:!0}],atanh:[{params:[cu.FLOAT],returnType:cu.FLOAT,isp5Function:!1}],cos:[{params:[cu.FLOAT],returnType:cu.FLOAT,isp5Function:!0}],cosh:[{params:[cu.FLOAT],returnType:cu.FLOAT,isp5Function:!1}],degrees:[{params:[cu.FLOAT],returnType:cu.FLOAT,isp5Function:!0}],radians:[{params:[cu.FLOAT],returnType:cu.FLOAT,isp5Function:!0}],sin:[{params:[cu.FLOAT],returnType:cu.FLOAT,isp5Function:!0}],sinh:[{params:[cu.FLOAT],returnType:cu.FLOAT,isp5Function:!1}],tan:[{params:[cu.FLOAT],returnType:cu.FLOAT,isp5Function:!0}],tanh:[{params:[cu.FLOAT],returnType:cu.FLOAT,isp5Function:!1}],abs:[{params:[cu.FLOAT],returnType:cu.FLOAT,isp5Function:!0},{params:[cu.FLOAT],returnType:cu.INT,isp5Function:!0}],ceil:[{params:[cu.FLOAT],returnType:cu.FLOAT,isp5Function:!0}],clamp:[{params:[cu.FLOAT,cu.FLOAT,cu.FLOAT],returnType:cu.FLOAT,isp5Function:!1},{params:[cu.FLOAT,hu.float1,hu.float1],returnType:cu.FLOAT,isp5Function:!1},{params:[cu.INT,cu.INT,cu.INT],returnType:cu.INT,isp5Function:!1},{params:[cu.INT,hu.int1,hu.int1],returnType:cu.INT,isp5Function:!1}],dFdx:[{params:[cu.FLOAT],returnType:cu.FLOAT,isp5Function:!1}],dFdy:[{params:[cu.FLOAT],returnType:cu.FLOAT,isp5Function:!1}],exp:[{params:[cu.FLOAT],returnType:cu.FLOAT,isp5Function:!0}],exp2:[{params:[cu.FLOAT],returnType:cu.FLOAT,isp5Function:!1}],floor:[{params:[cu.FLOAT],returnType:cu.FLOAT,isp5Function:!0}],fma:[{params:[cu.FLOAT,cu.FLOAT,cu.FLOAT],returnType:cu.FLOAT,isp5Function:!1}],fract:[{params:[cu.FLOAT],returnType:cu.FLOAT,isp5Function:!0}],fwidth:[{params:[cu.FLOAT],returnType:cu.FLOAT,isp5Function:!1}],inversesqrt:[{params:[cu.FLOAT],returnType:cu.FLOAT,isp5Function:!0}],log:[{params:[cu.FLOAT],returnType:cu.FLOAT,isp5Function:!0}],log2:[{params:[cu.FLOAT],returnType:cu.FLOAT,isp5Function:!1}],max:[{params:[cu.FLOAT,cu.FLOAT],returnType:cu.FLOAT,isp5Function:!0},{params:[cu.FLOAT,hu.float1],returnType:cu.FLOAT,isp5Function:!0},{params:[cu.INT,cu.INT],returnType:cu.INT,isp5Function:!0},{params:[cu.INT,hu.int1],returnType:cu.INT,isp5Function:!0}],min:[{params:[cu.FLOAT,cu.FLOAT],returnType:cu.FLOAT,isp5Function:!0},{params:[cu.FLOAT,hu.float1],returnType:cu.FLOAT,isp5Function:!0},{params:[cu.INT,cu.INT],returnType:cu.INT,isp5Function:!0},{params:[cu.INT,hu.int1],returnType:cu.INT,isp5Function:!0}],mix:[{params:[cu.FLOAT,cu.FLOAT,cu.FLOAT],returnType:cu.FLOAT,isp5Function:!1},{params:[cu.FLOAT,cu.FLOAT,hu.float1],returnType:cu.FLOAT,isp5Function:!1},{params:[cu.FLOAT,cu.FLOAT,cu.BOOL],returnType:cu.FLOAT,isp5Function:!1}],mod:[{params:[cu.FLOAT,cu.FLOAT],returnType:cu.FLOAT,isp5Function:!0},{params:[cu.FLOAT,hu.float1],returnType:cu.FLOAT,isp5Function:!0}],pow:[{params:[cu.FLOAT,cu.FLOAT],returnType:cu.FLOAT,isp5Function:!0}],round:[{params:[cu.FLOAT],returnType:cu.FLOAT,isp5Function:!0}],roundEven:[{params:[cu.FLOAT],returnType:cu.FLOAT,isp5Function:!1}],sign:[{params:[cu.FLOAT],returnType:cu.FLOAT,isp5Function:!1},{params:[cu.INT],returnType:cu.INT,isp5Function:!1}],smoothstep:[{params:[cu.FLOAT,cu.FLOAT,cu.FLOAT],returnType:cu.FLOAT,isp5Function:!1},{params:[hu.float1,hu.float1,cu.FLOAT],returnType:cu.FLOAT,isp5Function:!1}],sqrt:[{params:[cu.FLOAT],returnType:cu.FLOAT,isp5Function:!0}],step:[{params:[cu.FLOAT,cu.FLOAT],returnType:cu.FLOAT,isp5Function:!1}],trunc:[{params:[cu.FLOAT],returnType:cu.FLOAT,isp5Function:!1}],cross:[{params:[hu.float3,hu.float3],returnType:hu.float3,isp5Function:!0}],distance:[{params:[cu.FLOAT,cu.FLOAT],returnType:hu.float1,isp5Function:!0}],dot:[{params:[cu.FLOAT,cu.FLOAT],returnType:hu.float1,isp5Function:!0}],equal:[{params:[cu.FLOAT,cu.FLOAT],returnType:cu.BOOL,isp5Function:!1},{params:[cu.INT,cu.INT],returnType:cu.BOOL,isp5Function:!1},{params:[cu.BOOL,cu.BOOL],returnType:cu.BOOL,isp5Function:!1}],faceforward:[{params:[cu.FLOAT,cu.FLOAT,cu.FLOAT],returnType:cu.FLOAT,isp5Function:!1}],length:[{params:[cu.FLOAT],returnType:hu.float1,isp5Function:!1}],normalize:[{params:[cu.FLOAT],returnType:cu.FLOAT,isp5Function:!0}],notEqual:[{params:[cu.FLOAT,cu.FLOAT],returnType:cu.BOOL,isp5Function:!1},{params:[cu.INT,cu.INT],returnType:cu.BOOL,isp5Function:!1},{params:[cu.BOOL,cu.BOOL],returnType:cu.BOOL,isp5Function:!1}],reflect:[{params:[cu.FLOAT,cu.FLOAT],returnType:cu.FLOAT,isp5Function:!1}],refract:[{params:[cu.FLOAT,cu.FLOAT,hu.float1],returnType:cu.FLOAT,isp5Function:!1}],texture:[{params:[hu.sampler2D,hu.float2],returnType:hu.float4,isp5Function:!0}],getTexture:[{params:[hu.sampler2D,hu.float2],returnType:hu.float4,isp5Function:!0}]}};function Ip(e,t,i){const{cfg:r,dag:n}=e;let{dimension:s,baseType:a}=t;1!==s&&bu("Created a scalar literal node with dimension > 1.");const o=Cu(n,Au({nodeType:Xh.LITERAL,dimension:s,baseType:a,value:i}));return Sp(r,r.currentBlock,o),{id:o,dimension:s}}function Bp(e,t,i){const{cfg:r,dag:n}=e,{dimension:s,baseType:a}=t,o=Cu(n,Au({nodeType:Xh.VARIABLE,dimension:s,baseType:a,identifier:i}));return Sp(r,r.currentBlock,o),{id:o,dimension:s}}function Lp(e,t,i){const{dag:r,cfg:n}=e;let s,a;if(t instanceof Tp)a=t;else{const{id:i,dimension:r}=Vp(e,{baseType:tu,dimension:null},t);a=Mp(i,r,e)}s=[a.id];const o=Cu(r,Au({nodeType:Xh.OPERATION,opCode:i,dependsOn:s,baseType:r.baseTypes[a.id],dimension:a.dimension}));return Sp(n,n.currentBlock,o),{id:o,dimension:a.dimension}}function Op(e,t,i,r){const{dag:n,cfg:s}=e;let a;if(i[0]instanceof Tp&&1===i.length)a=i[0];else{const{id:t,dimension:r}=Vp(e,{baseType:tu,dimension:null},i);a=Mp(t,r,e)}let o=t.id,h=a.id;const u=Du(n,t.id),l=Du(n,a.id),c={node:null,toType:u};if(u.baseType===l.baseType&&u.baseType===su){c.toType.baseType=tu,u.dimension===l.dimension?c.toType.dimension=u.dimension:1===u.dimension&&l.dimension>1?c.toType.dimension=l.dimension:1===l.dimension&&u.dimension>1?c.toType.dimension=u.dimension:_u("type error",`You have tried to perform a binary operation:\n${u.baseType+u.dimension} ${yu[r]} ${l.baseType+l.dimension}\nIt's only possible to operate on two nodes with the same dimension, or a scalar value and a vector.`);const i=Vp(e,c.toType,t),n=Vp(e,c.toType,a);o=i.id,h=n.id}else if(u.baseType!==l.baseType||u.dimension!==l.dimension){1===u.dimension&&l.dimension>1?(c.node=t,c.toType=l):1===l.dimension&&u.dimension>1||u.priority>l.priority?(c.node=a,c.toType=u):l.priority>u.priority?(c.node=t,c.toType=l):_u("type error",`A vector of length ${u.dimension} operated with a vector of length ${l.dimension} is not allowed.`);const i=Vp(e,c.toType,c.node);c.node===t?o=(t=Mp(i.id,i.dimension,e)).id:(a=Mp(i.id,i.dimension,e),h=a.id)}const p=Au({nodeType:Xh.OPERATION,opCode:r,dependsOn:[o,h],baseType:c.toType.baseType,dimension:c.toType.dimension}),d=Cu(n,p);return Sp(s,s.currentBlock,d),{id:d,dimension:p.dimension}}function Pp(e,t,i,r){const{cfg:n,dag:s}=e;if(0===r.length)for(const e of t.properties){const t=e.dataType,a=Cu(s,Au({nodeType:Xh.VARIABLE,baseType:t.baseType,dimension:t.dimension,identifier:`${i}.${e.name}`}));Sp(n,n.currentBlock,a),r.push(a)}const a=Cu(s,Au({nodeType:Xh.VARIABLE,dimension:t.properties.length,baseType:t.typeName,identifier:i,dependsOn:r}));return Sp(n,n.currentBlock,a),{id:a,dimension:0,components:r}}function Np(e,t,i){const r=Array.isArray(i)?i:[i],n=[];let{dimension:s,baseType:a}=t;const o=e.dag;let h=0,u=null;for(const t of r.flat(1/0))if(t instanceof Tp){const e=Eu(o,t.id);if(u=t.id,a=e.baseType,e.opCode===gu.CONSTRUCTOR)for(const t of e.dependsOn)n.push(t);else n.push(t.id);h+=e.dimension}else if("number"!=typeof t)_u("type error",`You've tried to construct a scalar or vector type with a non-numeric value: ${t}`);else{const{id:i,dimension:r}=Ip(e,{dimension:1,baseType:a},t);n.push(i),h+=r}null===s?s=h:s>h&&1===h?h=s:1!==h&&h!==s&&_u("type error",`You've tried to construct a ${a+s} with ${h} components`);return{originalNodeID:u,mappedDependencies:n,inferredTypeInfo:{dimension:s,baseType:a,priority:ou[a]}}}function Rp(e,t,i){const r=Au({nodeType:Xh.OPERATION,opCode:gu.CONSTRUCTOR,dimension:t.dimension,baseType:t.baseType,dependsOn:i});return Cu(e.dag,r)}function Vp(e,t,i){const r=e.cfg,{mappedDependencies:n,inferredTypeInfo:s}=Np(e,t,i),a={baseType:t.baseType,dimension:s.dimension},o=Rp(e,a,n);return t.baseType!==su&&Sp(r,r.currentBlock,o),{id:o,dimension:a.dimension,components:n}}function Up(e,t,i){const{cfg:r,dag:n}=e,{properties:s}=t;i.length!==s.length&&_u("type error",`You've tried to construct a ${t.typeName} struct with ${i.length} properties, but it expects ${s.length} properties.\nThe properties it expects are:\n${s.map((e=>e.name+" "+e.DataType.baseType+e.DataType.dimension))}`);const a=[];for(let t=0;t<s.length;t++){const r=s[t],{originalNodeID:n,mappedDependencies:o}=Np(e,r.dataType,i[t]);n?a.push(n):a.push(Rp(e,r.dataType,o))}const o=Cu(n,Au({nodeType:Xh.OPERATION,opCode:gu.CONSTRUCTOR,dimension:s.length,baseType:t.typeName,dependsOn:a}));return Sp(r,r.currentBlock,o),{id:o,dimension:s.length,components:t.components}}function zp(e,t,i,{overloads:r}={}){const{cfg:n,dag:s}=e,a=r||kp[t],o=i.map((t=>Np(e,hu.defer,t))),h=a.filter((e=>e.params.length===o.length));if(0===h.length){const e=new Set,i=[];a.forEach((t=>e.add(t.params.length))),e.forEach((e=>i.push(`${e}`)));const r=i.join(", or ");_u("parameter validation error",`Function '${t}' has ${a.length} variants which expect ${r} arguments, but ${o.length} arguments were provided.`)}const u=e=>null===e.dimension;let l=null,c=0,p=null,d=null;for(const e of h){let t=!0,i=0;for(let r=0;r<o.length;r++){const n=o[r].inferredTypeInfo,s=e.params[r];let a=s.dimension;u(s)?(null!==d&&1!==d||(d=n.dimension),d===n.dimension||1===n.dimension&&d>=1||(t=!1),a=d):n.dimension>a&&(t=!1),n.baseType===s.baseType?i+=2:s.priority>n.priority&&(i+=1)}t&&(!l||i>c)&&(l=e,c=i,p={...e.returnType},u(p)&&(p.dimension=d))}null===l&&_u("parameter validation",`No matching overload for ${t} was found!`);let f=[];for(let t=0;t<l.params.length;t++){const i=o[t],r={...l.params[t]};if(u(r)&&(r.dimension=d),i.originalNodeID&&(g=i.inferredTypeInfo,m=r,g.dimension===m.dimension&&g.baseType===m.baseType))f.push(i.originalNodeID);else{const t=Rp(e,r,i.mappedDependencies);Sp(n,n.currentBlock,t),f.push(t)}}var g,m;const y=Cu(s,Au({nodeType:Xh.OPERATION,opCode:gu.FUNCTION_CALL,identifier:t,dependsOn:f,baseType:p.baseType,dimension:p.dimension}));return Sp(n,n.currentBlock,y),{id:y,dimension:p.dimension}}function Gp(e,t){const{dag:i,cfg:r}=e,n=Cu(i,Au({nodeType:Xh.STATEMENT,statementType:t}));return Sp(r,r.currentBlock,n),n}function jp(e,t,i){const{dag:r,cfg:n}=e,s=r.baseTypes[t.id],a=Cu(r,Au({nodeType:Xh.OPERATION,baseType:s,dimension:i.length,opCode:fu.SWIZZLE,dependsOn:[t.id],swizzle:i}));return Sp(n,n.currentBlock,a),{id:a,dimension:i.length}}function $p(e,t,i){const r=t.filter((e=>null!==e.value.id));if(0===r.length)throw new Error(`No valid inputs for phi node for variable ${i}`);const n=Eu(e.dag,r[0].value.id),s=n.dimension,a=n.baseType,o={nodeType:Xh.PHI,dimension:s,baseType:a,dependsOn:t.map((e=>e.value.id)).filter((e=>null!==e)),phiBlocks:t.map((e=>e.blockId))},h=Cu(e.dag,o);return Sp(e.cfg,e.cfg.currentBlock,h),{id:h,dimension:s,baseType:a}}class qp{constructor(e,t,i){this.branches=[{condition:t,branchCallback:i,blockType:vu.IF_BODY}],this.ctx=e}ElseIf(e,t){return this.branches.push({condition:e,branchCallback:t,blockType:vu.IF_BODY}),this}Else(e=()=>({})){this.branches.push({condition:null,branchCallback:e,blockType:vu.IF_BODY});const t=function(e,t){const i=e.cfg,r=t.branches,n=Ep(i,vu.MERGE),s=[],a=[],o={},h={},u=Ep(i,vu.BRANCH);Dp(i,i.currentBlock,u),Dp(i,u,n);let l=u;for(let e=0;e<r.length;e++){const{condition:t,branchCallback:o,blockType:u}=r[e];if(null!==t){const e=Ep(i,vu.IF_COND);Dp(i,l,e),wp(i,e),i.blockConditions[e]=t.id,l=e,Cp(i)}else{const e=Ep(i,vu.ELSE_COND);Dp(i,l,e),l=e}const c=Ep(i,vu.SCOPE_START);Dp(i,l,c);const p=Ep(i,u);Dp(i,c,p),wp(i,p);const d=o();for(const e in d)h[e]?h[e].push({value:d[e],blockId:p}):h[e]=[{value:d[e],blockId:p}];s.push(d);const f=Ep(i,vu.DEFAULT);Dp(i,i.currentBlock,f),a.push(f),Cp(i);const g=Ep(i,vu.SCOPE_END);Dp(i,f,g),Dp(i,g,n),l=c}Ap(i,u);for(const t in h)o[t]=$p(e,h[t],t);Cp(i);for(let t=0;t<s.length;t++){const r=s[t],n=a[t];Ap(i,n);for(const t in r)if(o[t]){const s=o[t].id,a=r[t].id,h={nodeType:Xh.ASSIGNMENT,dependsOn:[s,a],phiBlocks:[]};Sp(i,n,Cu(e.dag,h))}Cp(i)}return wp(i,n),o}(this.ctx,this),i={};for(const[e,r]of Object.entries(t))i[e]=Mp(r.id,r.dimension,this.ctx);return i}}class Hp{constructor(e,t,i,r,n,s){this.strandsContext=e,this.initialCb=t,this.conditionCb=i,this.updateCb=r,this.bodyCb=n,this.initialVars=s}build(){const e=this.strandsContext.cfg,t=Ep(e,vu.MERGE),i=Ep(e,vu.BRANCH);Dp(e,e.currentBlock,i),Dp(e,i,t);const{initialVar:r,phiNode:n}=this.initializeLoopVariable(e,i);wp(e,e.currentBlock);const s=Mp(n.id,n.dimension,this.strandsContext),a=this.conditionCb(s),o=this.updateCb(s);Cp(e);this.loopIsBounded(r,a,o)?this.buildBoundedLoop(e,i,t,r,n,a,o):this.buildUnboundedLoop(e,i,t,r,n,a,o);const h=this.phiNodesForBody;Ap(e,i);for(const[e,t]of Object.entries(this.bodyResults))if("loopVar"!==e&&h[e]){const i=h[e].id,r=Eu(this.strandsContext.dag,i);r.dependsOn.length>1&&(r.dependsOn[1]=t.id),r.phiInputs&&r.phiInputs.length>1&&(r.phiInputs[1].value=t)}Cp(e),Ap(e,i);for(const[t,r]of Object.entries(this.initialVars))if("loopVar"!==t&&h[t]){const n=h[t].id,s=r.id,a=Au({nodeType:Xh.ASSIGNMENT,dependsOn:[n,s],phiBlocks:[]});Sp(e,i,Cu(this.strandsContext.dag,a))}Cp(e),Ap(e,this.finalBodyBlock);for(const[t,i]of Object.entries(this.bodyResults))if("loopVar"!==t&&h[t]){const r=h[t].id,n=i.id,s=Au({nodeType:Xh.ASSIGNMENT,dependsOn:[r,n],phiBlocks:[]}),a=Cu(this.strandsContext.dag,s);Sp(e,this.finalBodyBlock,a)}Cp(e);const u={};for(const[e,t]of Object.entries(h))u[e]=Mp(t.id,t.dimension,this.strandsContext);return wp(e,t),u}buildBoundedLoop(e,t,i,r,n,s,a){const o=Ep(e,vu.FOR);if(Dp(e,t,o),wp(e,o),r){const t=Au({nodeType:Xh.ASSIGNMENT,dependsOn:[n.id,r.id],phiBlocks:[]});Sp(e,o,Cu(this.strandsContext.dag,t))}const h=Au({nodeType:Xh.STATEMENT,statementType:Qh,dependsOn:[s.id],phiBlocks:[]});Sp(e,o,Cu(this.strandsContext.dag,h));const u=Au({nodeType:Xh.ASSIGNMENT,dependsOn:[n.id,a.id],phiBlocks:[]});Sp(e,o,Cu(this.strandsContext.dag,u)),Cp(e);const l=e.blockInstructions[o]||[],c=r?3:2;if(l.length!==c)throw new Error(`FOR block must have exactly ${c} statements, got ${l.length}`);const p=Ep(e,vu.SCOPE_START);Dp(e,o,p);const d=Ep(e,vu.DEFAULT);this.bodyBlock=d,Dp(e,p,d),this.executeBodyCallback(e,t,d,n);const f=Ep(e,vu.SCOPE_END);Dp(e,d,f),Dp(e,f,i)}buildUnboundedLoop(e,t,i,r,n,s,a){const o=Ep(e,vu.FOR);if(Dp(e,t,o),wp(e,o),r){const t=Au({nodeType:Xh.ASSIGNMENT,dependsOn:[n.id,r.id],phiBlocks:[]});Sp(e,o,Cu(this.strandsContext.dag,t))}else{const t=Au({nodeType:Xh.STATEMENT,statementType:eu,dependsOn:[],phiBlocks:[]});Sp(e,o,Cu(this.strandsContext.dag,t))}const h=Au({nodeType:Xh.STATEMENT,statementType:eu,dependsOn:[],phiBlocks:[]});Sp(e,o,Cu(this.strandsContext.dag,h));const u=Au({nodeType:Xh.STATEMENT,statementType:eu,dependsOn:[],phiBlocks:[]});Sp(e,o,Cu(this.strandsContext.dag,u)),Cp(e);const l=Ep(e,vu.SCOPE_START);Dp(e,o,l);const c=Ep(e,vu.DEFAULT);Dp(e,l,c),wp(e,c);const p=s,d=this.createLogicalNotNode(p),f=Ep(e,vu.IF_COND);Dp(e,c,f),e.blockConditions[f]=d.id;const g=Ep(e,vu.DEFAULT);Dp(e,f,g),wp(e,g);const m=Au({nodeType:Xh.STATEMENT,statementType:Jh,dependsOn:[],phiBlocks:[]});Sp(e,g,Cu(this.strandsContext.dag,m)),Cp(e),Dp(e,g,i),Cp(e);const y=Ep(e,vu.DEFAULT);this.bodyBlock=y,Dp(e,c,y),this.executeBodyCallback(e,t,y,n);const x=Ep(e,vu.DEFAULT);Dp(e,y,x),wp(e,x);const v=Au({nodeType:Xh.ASSIGNMENT,dependsOn:[n.id,a.id],phiBlocks:[]});Sp(e,x,Cu(this.strandsContext.dag,v)),Cp(e);const b=Ep(e,vu.SCOPE_END);Dp(e,x,b),Dp(e,b,c),Dp(e,c,i)}initializeLoopVariable(e,t){wp(e,t);let i=this.initialCb();if(!(i instanceof Tp)){const{id:e,dimension:t}=Vp(this.strandsContext,{baseType:tu,dimension:1},i);i=Mp(e,t,this.strandsContext)}const r=$p(this.strandsContext,[{value:i,blockId:t},{value:i,blockId:t}],"loopVar");return Cp(e),{initialVar:i,phiNode:r}}createLogicalNotNode(e){const t=Au({nodeType:Xh.OPERATION,opCode:fu.LOGICAL_NOT,baseType:ru,dimension:1,dependsOn:[e.id],phiBlocks:[],usedBy:[]});return Mp(Cu(this.strandsContext.dag,t),1,this.strandsContext)}executeBodyCallback(e,t,i,r){wp(e,i);const n={},s={};Ap(e,t);for(const[e,r]of Object.entries(this.initialVars))if("loopVar"!==e){const a=$p(this.strandsContext,[{value:r,blockId:t},{value:r,blockId:i}],e);s[e]=a,n[e]=Mp(a.id,a.dimension,this.strandsContext)}Cp(e);const a=Mp(r.id,r.dimension,this.strandsContext);this.bodyResults=this.bodyCb(a,n),this.phiNodesForBody=s,this.finalBodyBlock=e.currentBlock,Cp(e)}loopIsBounded(e,t,i){if(!t)return!1;const r=Eu(this.strandsContext.dag,t.id);if(r.nodeType!==Xh.OPERATION)return!1;if(!r.dependsOn||2!==r.dependsOn.length)return!1;const n=Mp(r.dependsOn[0],1,this.strandsContext),s=Mp(r.dependsOn[1],1,this.strandsContext),a=this.nodeUsesOnlyLiterals(n),o=this.nodeUsesOnlyLiterals(s);return a||o}nodeUsesOnlyLiterals(e){const t=Eu(this.strandsContext.dag,e.id);switch(t.nodeType){case Xh.LITERAL:return!0;case Xh.VARIABLE:case Xh.PHI:return!1;case Xh.OPERATION:if(t.dependsOn)for(const e of t.dependsOn){const t=Mp(e,1,this.strandsContext);if(!this.nodeUsesOnlyLiterals(t))return!1}return!0;default:return!1}}}var Wp="// Based on https://github.com/stegu/webgl-noise/blob/22434e04d7753f7e949e8d724ab3da2864c17a0f/src/noise3D.glsl\n// MIT licensed, adapted for p5.strands\n\nvec3 mod289(vec3 x) {\n return x - floor(x * (1.0 / 289.0)) * 289.0;\n}\n\nvec4 mod289(vec4 x) {\n return x - floor(x * (1.0 / 289.0)) * 289.0;\n}\n\nvec4 permute(vec4 x) {\n return mod289(((x*34.0)+10.0)*x);\n}\n\nvec4 taylorInvSqrt(vec4 r)\n{\n return 1.79284291400159 - 0.85373472095314 * r;\n}\n\nfloat baseNoise(vec3 v)\n{\n const vec2 C = vec2(1.0/6.0, 1.0/3.0) ;\n const vec4 D = vec4(0.0, 0.5, 1.0, 2.0);\n\n // First corner\n vec3 i = floor(v + dot(v, C.yyy) );\n vec3 x0 = v - i + dot(i, C.xxx) ;\n\n // Other corners\n vec3 g = step(x0.yzx, x0.xyz);\n vec3 l = 1.0 - g;\n vec3 i1 = min( g.xyz, l.zxy );\n vec3 i2 = max( g.xyz, l.zxy );\n\n // x0 = x0 - 0.0 + 0.0 * C.xxx;\n // x1 = x0 - i1 + 1.0 * C.xxx;\n // x2 = x0 - i2 + 2.0 * C.xxx;\n // x3 = x0 - 1.0 + 3.0 * C.xxx;\n vec3 x1 = x0 - i1 + C.xxx;\n vec3 x2 = x0 - i2 + C.yyy; // 2.0*C.x = 1/3 = C.y\n vec3 x3 = x0 - D.yyy; // -1.0+3.0*C.x = -0.5 = -D.y\n\n // Permutations\n i = mod289(i);\n vec4 p = permute( permute( permute(\n i.z + vec4(0.0, i1.z, i2.z, 1.0 ))\n + i.y + vec4(0.0, i1.y, i2.y, 1.0 ))\n + i.x + vec4(0.0, i1.x, i2.x, 1.0 ));\n\n // Gradients: 7x7 points over a square, mapped onto an octahedron.\n // The ring size 17*17 = 289 is close to a multiple of 49 (49*6 = 294)\n float n_ = 0.142857142857; // 1.0/7.0\n vec3 ns = n_ * D.wyz - D.xzx;\n\n vec4 j = p - 49.0 * floor(p * ns.z * ns.z); // mod(p,7*7)\n\n vec4 x_ = floor(j * ns.z);\n vec4 y_ = floor(j - 7.0 * x_ ); // mod(j,N)\n\n vec4 x = x_ *ns.x + ns.yyyy;\n vec4 y = y_ *ns.x + ns.yyyy;\n vec4 h = 1.0 - abs(x) - abs(y);\n\n vec4 b0 = vec4( x.xy, y.xy );\n vec4 b1 = vec4( x.zw, y.zw );\n\n //vec4 s0 = vec4(lessThan(b0,0.0))*2.0 - 1.0;\n //vec4 s1 = vec4(lessThan(b1,0.0))*2.0 - 1.0;\n vec4 s0 = floor(b0)*2.0 + 1.0;\n vec4 s1 = floor(b1)*2.0 + 1.0;\n vec4 sh = -step(h, vec4(0.0));\n\n vec4 a0 = b0.xzyw + s0.xzyw*sh.xxyy ;\n vec4 a1 = b1.xzyw + s1.xzyw*sh.zzww ;\n\n vec3 p0 = vec3(a0.xy,h.x);\n vec3 p1 = vec3(a0.zw,h.y);\n vec3 p2 = vec3(a1.xy,h.z);\n vec3 p3 = vec3(a1.zw,h.w);\n\n //Normalise gradients\n vec4 norm = taylorInvSqrt(vec4(dot(p0,p0), dot(p1,p1), dot(p2, p2), dot(p3,p3)));\n p0 *= norm.x;\n p1 *= norm.y;\n p2 *= norm.z;\n p3 *= norm.w;\n\n // Mix final noise value\n vec4 m = max(0.5 - vec4(dot(x0,x0), dot(x1,x1), dot(x2,x2), dot(x3,x3)), 0.0);\n m = m * m;\n return 105.0 * dot( m*m, vec4( dot(p0,x0), dot(p1,x1),\n dot(p2,x2), dot(p3,x3) ) );\n}\n\nfloat noise(vec3 st) {\n float result = 0.0;\n float amplitude = 1.0;\n float frequency = 1.0;\n\n for (int i = 0; i < 4; i++) {\n result += amplitude * baseNoise(st * frequency);\n frequency *= 2.0;\n amplitude *= 0.5;\n }\n\n return result;\n}\n";function Xp(e,t){const i=[],r=e.dag;for(const n of t)if(lu(n.type.typeName)){const t=uu(n),{id:s,dimension:a}=Pp(e,t,n.name,[]),o=Mp(s,a,e);for(let i=0;i<t.properties.length;i++){const s=t.properties[i];Object.defineProperty(o,s.name,{get(){const s=Eu(r,r.dependsOn[o.id][i]);return Mp(s.id,s.dimension,e,(s=>{const a=r.dependsOn[o.id].slice();a[i]=s;const h=Pp(e,t,n.name,a);o.id=h.id}))},set(a){const h=[...r.dependsOn[o.id]];let u;if(a instanceof Tp)u=a.id;else{u=Vp(e,s.dataType,a).id}h[i]=u;const l=Pp(e,t,n.name,h);o.id=l.id}})}i.push(o)}else{const t=pu[n.type.typeName],{id:r,dimension:s}=Bp(e,t,n.name),a=Mp(r,s,e);i.push(a)}return i}function Yp(e,t,i,r){if(!(i instanceof Tp)){return Vp(e,t,i).id}const n=e.dag;let s=i.id;const a=n.baseTypes[s],o=n.dimensions[s];if(o!==t.dimension)if(1!==o)_u("type error",`You have returned a vector with ${o} components in ${r} when a ${t.baseType+t.dimension} was expected!`);else{s=Vp(e,t,i).id}else if(a!==t.baseType){s=Vp(e,t,i).id}return s}function Zp(e,t){function i(t,i,{active:r=!1}={}){t.dag=wu(),t.cfg={blockTypes:[],incomingEdges:[],outgoingEdges:[],blockInstructions:[],nextID:0,blockStack:[],blockOrder:[],blockConditions:{},currentBlock:-1},t.uniforms=[],t.vertexDeclarations=new Set,t.fragmentDeclarations=new Set,t.hooks=[],t.globalAssignments=[],t.backend=i,t.active=r,t.previousFES=e.disableFriendlyErrors,t.windowOverrides={},t.fnOverrides={},r&&(e.disableFriendlyErrors=!0)}const r={};i(r),function(e,t,i){for(const{name:t,arity:r,opCode:n}of mu)"binary"===r&&(Tp.prototype[t]=function(...e){const{id:t,dimension:r}=Op(i,this,e,n);return Mp(t,r,i)}),"unary"===r&&(e[t]=function(e){const{id:t,dimension:r}=Lp(i,e,n);return Mp(t,r,i)});t.discard=function(){Gp(i,Kh)},t.break=function(){Gp(i,Jh)},e.break=t.break,t.instanceID=function(){const e=Bp(i,{baseType:iu,dimension:1},"gl_InstanceID");return Mp(e.id,e.dimension,i)},e.strandsIf=function(e,t){return new qp(i,e,t)},t.strandsIf=e.strandsIf,e.strandsFor=function(e,t,r,n,s){return new Hp(i,e,t,r,n,s).build()},t.strandsFor=e.strandsFor,e.strandsNode=function(...e){if(1===e.length&&e[0]instanceof Tp)return e[0];e.length>4&&_u("type error","It looks like you've tried to construct a p5.strands node implicitly, with more than 4 components. This is currently not supported.");const{id:t,dimension:r}=Vp(i,{baseType:tu,dimension:null},e.flat());return Mp(t,r,i)};for(const[r,n]of Object.entries(kp))if(n[0].isp5Function){const e=t[r];t[r]=function(...t){if(i.active){const{id:e,dimension:n}=zp(i,r,t);return Mp(e,n,i)}return e.apply(this,t)}}else t[r]=function(...t){if(i.active){const{id:e,dimension:n}=zp(i,r,t);return Mp(e,n,i)}e._friendlyError(`It looks like you've called ${r} outside of a shader's modify() function.`)};const r=t.noise;t.noise=function(...n){if(!i.active)return r.apply(this,n);i.vertexDeclarations.add(Wp),i.fragmentDeclarations.add(Wp);const s=n.map((t=>e.strandsNode(t)));let a;3===s.length?a=[t.vec3(s[0],s[1],s[2])]:2===s.length?a=[t.vec3(s[0],s[1],0)]:1===s.length&&s[0].dimension<=3?a=3===s[0].dimension?s:2===s[0].dimension?[t.vec3(s[0],0)]:[t.vec3(s[0],0,0)]:e._friendlyError(`It looks like you've called noise() with ${n.length} arguments. It only supports 1D to 3D input.`);const{id:o,dimension:h}=zp(i,"noise",a,{overloads:[{params:[hu.float3],returnType:hu.float1}]});return Mp(o,h,i)};for(const r in hu){if(r===su)continue;const n=hu[r],s=[];let a;/^[ib]vec/.test(n.fnName)?(a=n.fnName.slice(0,2).toUpperCase()+n.fnName.slice(2).toLowerCase(),s.push(a.replace("Vec","Vector"))):(a=n.fnName.charAt(0).toUpperCase()+n.fnName.slice(1),"Sampler2D"===a?s.push("Texture"):/^vec/.test(n.fnName)&&s.push(a.replace("Vec","Vector"))),t[`uniform${a}`]=function(e,t){const{id:r,dimension:s}=Bp(i,n,e);return i.uniforms.push({name:e,typeInfo:n,defaultValue:t}),Mp(r,s,i)},t[`shared${a}`]=function(e){const{id:t,dimension:r}=Bp(i,n,e);return i.sharedVariables||(i.sharedVariables=new Map),i.sharedVariables.set(e,{typeInfo:n,usedInVertex:!1,usedInFragment:!1,declared:!1}),Mp(t,r,i)},t[`varying${a}`]=t[`shared${a}`];for(const e of s)t[`uniform${e}`]=t[`uniform${a}`],t[`varying${e}`]=t[`varying${a}`],t[`shared${e}`]=t[`shared${a}`];const o=t[n.fnName];t[n.fnName]=function(...t){if(i.active){const{id:e,dimension:r}=Vp(i,n,t);return Mp(e,r,i)}if(o)return o.apply(this,t);e._friendlyError(`It looks like you've called ${n.fnName} outside of a shader's modify() function.`)}}}(e,t,r);const n=e.Shader.prototype.modify;e.Shader.prototype.modify=function(s,a={}){if(s instanceof Function){i(r,Mu,{active:!0}),function(e,t,i){const r={...Object.fromEntries(Object.entries(i.hooks.vertex).map((([e,t])=>[e,{...t,shaderContext:"vertex"}]))),...Object.fromEntries(Object.entries(i.hooks.fragment).map((([e,t])=>[e,{...t,shaderContext:"fragment"}])))},n=Object.keys(r).map((e=>i.hookTypes(e))),{cfg:s,dag:a}=e;for(const i of n){const n=function(t){const n=Ep(s,vu.FUNCTION);Dp(s,s.currentBlock,n),wp(s,n);const o=t(...Xp(e,i.parameters)),h=i.returnType;let u=null;if(lu(h.typeName)){const t=uu(h);if(o instanceof Tp){const r=Eu(e.dag,o.id);r.baseType!==t.typeName&&_u("type error",`You have returned a ${o.baseType} from ${i.name} when a ${t.typeName} was expected.`);const n=r.dependsOn.slice();for(let s=0;s<t.properties.length;s++){const h=t.properties[s].dataType,u=Mp(r.dependsOn[s],a.dependsOn[o.id],e);n[s]=Yp(e,h,u,i.name)}a.dependsOn[o.id]=n,u=o.id}else{const r=t.properties,n=[];for(let t=0;t<r.length;t++){const s=r[t],a=o[s.name];void 0===a&&_u("type error",`You've returned an incomplete struct from ${i.name}.\nExpected: { ${h.properties.map((e=>e.name)).join(", ")} }\nReceived: { ${Object.keys(o).join(", ")} }\nAll of the properties are required!`);const u=s.dataType,l=Yp(e,u,a,i.name);n.push(l)}u=Up(e,t,n).id}}else{const t=pu[h.typeName];u=Yp(e,t,o,i.name)}const l=`${i.returnType.typeName} ${i.name}`,c=r[l];e.hooks.push({hookType:i,entryBlockID:n,rootNodeID:u,shaderContext:c?.shaderContext}),Cp(s)};e.windowOverrides[i.name]=window[i.name],e.fnOverrides[i.name]=t[i.name],window[i.name]=n,t[i.name]=n}}(r,t,this);const o={srcLocations:!1};let h;{const t=`(${s.toString()})`;h=_p(e,t,o.srcLocations,a)}const u=Ep(r.cfg,vu.GLOBAL);wp(r.cfg,u),h(),Cp(r.cfg);const l=function(e){const{cfg:t,backend:i,vertexDeclarations:r,fragmentDeclarations:n}=e,s={uniforms:{}};for(const{name:t,typeInfo:r,defaultValue:n}of e.uniforms){const e=i.generateUniformDeclaration(t,r);s.uniforms[e]=n}for(const{hookType:r,rootNodeID:n,entryBlockID:a,shaderContext:o}of e.hooks){const h={indent:1,codeLines:[],write(e){this.codeLines.push(" ".repeat(this.indent)+e)},tempNames:{},declarations:[],nextTempID:0,visitedNodes:new Set,shaderContext:o,strandsContext:e},u=Fp(t.outgoingEdges,a);for(const t of u)i.generateBlock(t,e,h);for(const t of e.globalAssignments)h.visitedNodes.has(t)||(i.generateAssignment(h,e.dag,t),h.visitedNodes.add(t));e.globalAssignments=[];const l=i.hookEntry(r);let c=r.returnType.properties?uu(r.returnType):pu[r.returnType.typeName];i.generateReturnStatement(e,h,n,c),s[`${r.returnType.typeName} ${r.name}`]=[l,...h.codeLines,"}"].join("\n")}if(e.sharedVariables)for(const[t,i]of e.sharedVariables)i.usedInVertex&&i.usedInFragment?(r.add(`OUT ${i.typeInfo.fnName} ${t};`),n.add(`IN ${i.typeInfo.fnName} ${t};`)):i.usedInVertex?r.add(`${i.typeInfo.fnName} ${t};`):i.usedInFragment&&n.add(`${i.typeInfo.fnName} ${t};`);return s.vertexDeclarations=[...r].join("\n"),s.fragmentDeclarations=[...n].join("\n"),s}(r);return function(i){i.dag=wu(),i.cfg={blockTypes:[],incomingEdges:[],outgoingEdges:[],blockInstructions:[],nextID:0,blockStack:[],blockOrder:[],blockConditions:{},currentBlock:-1},i.uniforms=[],i.vertexDeclarations=new Set,i.fragmentDeclarations=new Set,i.hooks=[],i.globalAssignments=[],i.active=!1,e.disableFriendlyErrors=i.previousFES;for(const e in i.windowOverrides)window[e]=i.windowOverrides[e];for(const e in i.fnOverrides)t[e]=i.fnOverrides[e]}(r),n.call(this,l)}return n.call(this,s)}}function Kp(e){return Kp="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Kp(e)}function Jp(e){var t=function(e,t){if("object"!=Kp(e)||!e)return e;var i=e[Symbol.toPrimitive];if(void 0!==i){var r=i.call(e,t);if("object"!=Kp(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e,"string");return"symbol"==Kp(t)?t:t+""}function Qp(e,t,i){return(t=Jp(t))in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function ed(e){for(var t=1;t<arguments.length;t++){var i=null!=arguments[t]?Object(arguments[t]):{},r=Object.keys(i);"function"==typeof Object.getOwnPropertySymbols&&r.push.apply(r,Object.getOwnPropertySymbols(i).filter((function(e){return Object.getOwnPropertyDescriptor(i,e).enumerable}))),r.forEach((function(t){Qp(e,t,i[t])}))}return e}function td(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function id(e,t){for(var i=0;i<t.length;i++){var r=t[i];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,Jp(r.key),r)}}function rd(e,t,i){return t&&id(e.prototype,t),i&&id(e,i),Object.defineProperty(e,"prototype",{writable:!1}),e}function nd(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function sd(e,t){if(t&&("object"==Kp(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return nd(e)}function ad(e){return ad=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},ad(e)}function od(e,t){return od=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},od(e,t)}function hd(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&od(e,t)}void 0!==p5&&p5.registerAddon(Zp);var ud={type:"logger",log:function(e){this.output("log",e)},warn:function(e){this.output("warn",e)},error:function(e){this.output("error",e)},output:function(e,t){console&&console[e]&&console[e].apply(console,t)}},ld=function(){function e(t){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};td(this,e),this.init(t,i)}return rd(e,[{key:"init",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.prefix=t.prefix||"i18next:",this.logger=e||ud,this.options=t,this.debug=t.debug}},{key:"setDebug",value:function(e){this.debug=e}},{key:"log",value:function(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];return this.forward(t,"log","",!0)}},{key:"warn",value:function(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];return this.forward(t,"warn","",!0)}},{key:"error",value:function(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];return this.forward(t,"error","")}},{key:"deprecate",value:function(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];return this.forward(t,"warn","WARNING DEPRECATED: ",!0)}},{key:"forward",value:function(e,t,i,r){return r&&!this.debug?null:("string"==typeof e[0]&&(e[0]="".concat(i).concat(this.prefix," ").concat(e[0])),this.logger[t](e))}},{key:"create",value:function(t){return new e(this.logger,ed({},{prefix:"".concat(this.prefix,":").concat(t,":")},this.options))}}]),e}(),cd=new ld,pd=function(){function e(){td(this,e),this.observers={}}return rd(e,[{key:"on",value:function(e,t){var i=this;return e.split(" ").forEach((function(e){i.observers[e]=i.observers[e]||[],i.observers[e].push(t)})),this}},{key:"off",value:function(e,t){this.observers[e]&&(t?this.observers[e]=this.observers[e].filter((function(e){return e!==t})):delete this.observers[e])}},{key:"emit",value:function(e){for(var t=arguments.length,i=new Array(t>1?t-1:0),r=1;r<t;r++)i[r-1]=arguments[r];this.observers[e]&&[].concat(this.observers[e]).forEach((function(e){e.apply(void 0,i)}));this.observers["*"]&&[].concat(this.observers["*"]).forEach((function(t){t.apply(t,[e].concat(i))}))}}]),e}();function dd(){var e,t,i=new Promise((function(i,r){e=i,t=r}));return i.resolve=e,i.reject=t,i}function fd(e){return null==e?"":""+e}function gd(e,t,i){function r(e){return e&&e.indexOf("###")>-1?e.replace(/###/g,"."):e}function n(){return!e||"string"==typeof e}for(var s="string"!=typeof t?[].concat(t):t.split(".");s.length>1;){if(n())return{};var a=r(s.shift());!e[a]&&i&&(e[a]=new i),e=Object.prototype.hasOwnProperty.call(e,a)?e[a]:{}}return n()?{}:{obj:e,k:r(s.shift())}}function md(e,t,i){var r=gd(e,t,Object);r.obj[r.k]=i}function yd(e,t){var i=gd(e,t),r=i.obj,n=i.k;if(r)return r[n]}function xd(e,t,i){var r=yd(e,i);return void 0!==r?r:yd(t,i)}function vd(e,t,i){for(var r in t)"__proto__"!==r&&"constructor"!==r&&(r in e?"string"==typeof e[r]||e[r]instanceof String||"string"==typeof t[r]||t[r]instanceof String?i&&(e[r]=t[r]):vd(e[r],t[r],i):e[r]=t[r]);return e}function bd(e){return e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")}var _d={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;","/":"&#x2F;"};function wd(e){return"string"==typeof e?e.replace(/[&<>"'\/]/g,(function(e){return _d[e]})):e}var Cd="undefined"!=typeof window&&window.navigator&&window.navigator.userAgent&&window.navigator.userAgent.indexOf("MSIE")>-1,Ad=function(e){function t(e){var i,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{ns:["translation"],defaultNS:"translation"};return td(this,t),i=sd(this,ad(t).call(this)),Cd&&pd.call(nd(i)),i.data=e||{},i.options=r,void 0===i.options.keySeparator&&(i.options.keySeparator="."),i}return hd(t,e),rd(t,[{key:"addNamespaces",value:function(e){this.options.ns.indexOf(e)<0&&this.options.ns.push(e)}},{key:"removeNamespaces",value:function(e){var t=this.options.ns.indexOf(e);t>-1&&this.options.ns.splice(t,1)}},{key:"getResource",value:function(e,t,i){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},n=void 0!==r.keySeparator?r.keySeparator:this.options.keySeparator,s=[e,t];return i&&"string"!=typeof i&&(s=s.concat(i)),i&&"string"==typeof i&&(s=s.concat(n?i.split(n):i)),e.indexOf(".")>-1&&(s=e.split(".")),yd(this.data,s)}},{key:"addResource",value:function(e,t,i,r){var n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{silent:!1},s=this.options.keySeparator;void 0===s&&(s=".");var a=[e,t];i&&(a=a.concat(s?i.split(s):i)),e.indexOf(".")>-1&&(r=t,t=(a=e.split("."))[1]),this.addNamespaces(t),md(this.data,a,r),n.silent||this.emit("added",e,t,i,r)}},{key:"addResources",value:function(e,t,i){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{silent:!1};for(var n in i)"string"!=typeof i[n]&&"[object Array]"!==Object.prototype.toString.apply(i[n])||this.addResource(e,t,n,i[n],{silent:!0});r.silent||this.emit("added",e,t,i)}},{key:"addResourceBundle",value:function(e,t,i,r,n){var s=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{silent:!1},a=[e,t];e.indexOf(".")>-1&&(r=i,i=t,t=(a=e.split("."))[1]),this.addNamespaces(t);var o=yd(this.data,a)||{};r?vd(o,i,n):o=ed({},o,i),md(this.data,a,o),s.silent||this.emit("added",e,t,i)}},{key:"removeResourceBundle",value:function(e,t){this.hasResourceBundle(e,t)&&delete this.data[e][t],this.removeNamespaces(t),this.emit("removed",e,t)}},{key:"hasResourceBundle",value:function(e,t){return void 0!==this.getResource(e,t)}},{key:"getResourceBundle",value:function(e,t){return t||(t=this.options.defaultNS),"v1"===this.options.compatibilityAPI?ed({},{},this.getResource(e,t)):this.getResource(e,t)}},{key:"getDataByLanguage",value:function(e){return this.data[e]}},{key:"toJSON",value:function(){return this.data}}]),t}(pd),Ed={processors:{},addPostProcessor:function(e){this.processors[e.name]=e},handle:function(e,t,i,r,n){var s=this;return e.forEach((function(e){s.processors[e]&&(t=s.processors[e].process(t,i,r,n))})),t}},Dd={},Sd=function(e){function t(e){var i,r,n,s,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return td(this,t),i=sd(this,ad(t).call(this)),Cd&&pd.call(nd(i)),r=["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"],n=e,s=nd(i),r.forEach((function(e){n[e]&&(s[e]=n[e])})),i.options=a,void 0===i.options.keySeparator&&(i.options.keySeparator="."),i.logger=cd.create("translator"),i}return hd(t,e),rd(t,[{key:"changeLanguage",value:function(e){e&&(this.language=e)}},{key:"exists",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{interpolation:{}},i=this.resolve(e,t);return i&&void 0!==i.res}},{key:"extractFromKey",value:function(e,t){var i=void 0!==t.nsSeparator?t.nsSeparator:this.options.nsSeparator;void 0===i&&(i=":");var r=void 0!==t.keySeparator?t.keySeparator:this.options.keySeparator,n=t.ns||this.options.defaultNS;if(i&&e.indexOf(i)>-1){var s=e.match(this.interpolator.nestingRegexp);if(s&&s.length>0)return{key:e,namespaces:n};var a=e.split(i);(i!==r||i===r&&this.options.ns.indexOf(a[0])>-1)&&(n=a.shift()),e=a.join(r)}return"string"==typeof n&&(n=[n]),{key:e,namespaces:n}}},{key:"translate",value:function(e,i,r){var n=this;if("object"!==Kp(i)&&this.options.overloadTranslationOptionHandler&&(i=this.options.overloadTranslationOptionHandler(arguments)),i||(i={}),null==e)return"";Array.isArray(e)||(e=[String(e)]);var s=void 0!==i.keySeparator?i.keySeparator:this.options.keySeparator,a=this.extractFromKey(e[e.length-1],i),o=a.key,h=a.namespaces,u=h[h.length-1],l=i.lng||this.language,c=i.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if(l&&"cimode"===l.toLowerCase()){if(c){var p=i.nsSeparator||this.options.nsSeparator;return u+p+o}return o}var d=this.resolve(e,i),f=d&&d.res,g=d&&d.usedKey||o,m=d&&d.exactUsedKey||o,y=Object.prototype.toString.apply(f),x=void 0!==i.joinArrays?i.joinArrays:this.options.joinArrays,v=!this.i18nFormat||this.i18nFormat.handleAsObject;if(v&&f&&("string"!=typeof f&&"boolean"!=typeof f&&"number"!=typeof f)&&["[object Number]","[object Function]","[object RegExp]"].indexOf(y)<0&&("string"!=typeof x||"[object Array]"!==y)){if(!i.returnObjects&&!this.options.returnObjects)return this.logger.warn("accessing an object - but returnObjects options is not enabled!"),this.options.returnedObjectHandler?this.options.returnedObjectHandler(g,f,i):"key '".concat(o," (").concat(this.language,")' returned an object instead of string.");if(s){var b="[object Array]"===y,_=b?[]:{},w=b?m:g;for(var C in f)if(Object.prototype.hasOwnProperty.call(f,C)){var A="".concat(w).concat(s).concat(C);_[C]=this.translate(A,ed({},i,{joinArrays:!1,ns:h})),_[C]===A&&(_[C]=f[C])}f=_}}else if(v&&"string"==typeof x&&"[object Array]"===y)(f=f.join(x))&&(f=this.extendTranslation(f,e,i,r));else{var E=!1,D=!1,S=void 0!==i.count&&"string"!=typeof i.count,F=t.hasDefaultValue(i),T=S?this.pluralResolver.getSuffix(l,i.count):"",M=i["defaultValue".concat(T)]||i.defaultValue;!this.isValidLookup(f)&&F&&(E=!0,f=M),this.isValidLookup(f)||(D=!0,f=o);var k=F&&M!==f&&this.options.updateMissing;if(D||E||k){if(this.logger.log(k?"updateKey":"missingKey",l,u,o,k?M:f),s){var I=this.resolve(o,ed({},i,{keySeparator:!1}));I&&I.res&&this.logger.warn("Seems the loaded translations were in flat JSON format instead of nested. Either set keySeparator: false on init or make sure your translations are published in nested format.")}var B=[],L=this.languageUtils.getFallbackCodes(this.options.fallbackLng,i.lng||this.language);if("fallback"===this.options.saveMissingTo&&L&&L[0])for(var O=0;O<L.length;O++)B.push(L[O]);else"all"===this.options.saveMissingTo?B=this.languageUtils.toResolveHierarchy(i.lng||this.language):B.push(i.lng||this.language);var P=function(e,t,r){n.options.missingKeyHandler?n.options.missingKeyHandler(e,u,t,k?r:f,k,i):n.backendConnector&&n.backendConnector.saveMissing&&n.backendConnector.saveMissing(e,u,t,k?r:f,k,i),n.emit("missingKey",e,u,t,f)};this.options.saveMissing&&(this.options.saveMissingPlurals&&S?B.forEach((function(e){n.pluralResolver.getSuffixes(e).forEach((function(t){P([e],o+t,i["defaultValue".concat(t)]||M)}))})):P(B,o,M))}f=this.extendTranslation(f,e,i,d,r),D&&f===o&&this.options.appendNamespaceToMissingKey&&(f="".concat(u,":").concat(o)),D&&this.options.parseMissingKeyHandler&&(f=this.options.parseMissingKeyHandler(f))}return f}},{key:"extendTranslation",value:function(e,t,i,r,n){var s=this;if(this.i18nFormat&&this.i18nFormat.parse)e=this.i18nFormat.parse(e,i,r.usedLng,r.usedNS,r.usedKey,{resolved:r});else if(!i.skipInterpolation){i.interpolation&&this.interpolator.init(ed({},i,{interpolation:ed({},this.options.interpolation,i.interpolation)}));var a,o=i.interpolation&&i.interpolation.skipOnVariables||this.options.interpolation.skipOnVariables;if(o){var h=e.match(this.interpolator.nestingRegexp);a=h&&h.length}var u=i.replace&&"string"!=typeof i.replace?i.replace:i;if(this.options.interpolation.defaultVariables&&(u=ed({},this.options.interpolation.defaultVariables,u)),e=this.interpolator.interpolate(e,u,i.lng||this.language,i),o){var l=e.match(this.interpolator.nestingRegexp);a<(l&&l.length)&&(i.nest=!1)}!1!==i.nest&&(e=this.interpolator.nest(e,(function(){for(var e=arguments.length,r=new Array(e),a=0;a<e;a++)r[a]=arguments[a];return n&&n[0]===r[0]&&!i.context?(s.logger.warn("It seems you are nesting recursively key: ".concat(r[0]," in key: ").concat(t[0])),null):s.translate.apply(s,r.concat([t]))}),i)),i.interpolation&&this.interpolator.reset()}var c=i.postProcess||this.options.postProcess,p="string"==typeof c?[c]:c;return null!=e&&p&&p.length&&!1!==i.applyPostProcessor&&(e=Ed.handle(p,e,t,this.options&&this.options.postProcessPassResolved?ed({i18nResolved:r},i):i,this)),e}},{key:"resolve",value:function(e){var t,i,r,n,s,a=this,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return"string"==typeof e&&(e=[e]),e.forEach((function(e){if(!a.isValidLookup(t)){var h=a.extractFromKey(e,o),u=h.key;i=u;var l=h.namespaces;a.options.fallbackNS&&(l=l.concat(a.options.fallbackNS));var c=void 0!==o.count&&"string"!=typeof o.count,p=void 0!==o.context&&"string"==typeof o.context&&""!==o.context,d=o.lngs?o.lngs:a.languageUtils.toResolveHierarchy(o.lng||a.language,o.fallbackLng);l.forEach((function(e){a.isValidLookup(t)||(s=e,!Dd["".concat(d[0],"-").concat(e)]&&a.utils&&a.utils.hasLoadedNamespace&&!a.utils.hasLoadedNamespace(s)&&(Dd["".concat(d[0],"-").concat(e)]=!0,a.logger.warn('key "'.concat(i,'" for languages "').concat(d.join(", "),'" won\'t get resolved as namespace "').concat(s,'" was not yet loaded'),"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!")),d.forEach((function(i){if(!a.isValidLookup(t)){n=i;var s,h,l=u,d=[l];if(a.i18nFormat&&a.i18nFormat.addLookupKeys)a.i18nFormat.addLookupKeys(d,u,i,e,o);else c&&(s=a.pluralResolver.getSuffix(i,o.count)),c&&p&&d.push(l+s),p&&d.push(l+="".concat(a.options.contextSeparator).concat(o.context)),c&&d.push(l+=s);for(;h=d.pop();)a.isValidLookup(t)||(r=h,t=a.getResource(i,e,h,o))}})))}))}})),{res:t,usedKey:i,exactUsedKey:r,usedLng:n,usedNS:s}}},{key:"isValidLookup",value:function(e){return!(void 0===e||!this.options.returnNull&&null===e||!this.options.returnEmptyString&&""===e)}},{key:"getResource",value:function(e,t,i){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return this.i18nFormat&&this.i18nFormat.getResource?this.i18nFormat.getResource(e,t,i,r):this.resourceStore.getResource(e,t,i,r)}}],[{key:"hasDefaultValue",value:function(e){var t="defaultValue";for(var i in e)if(Object.prototype.hasOwnProperty.call(e,i)&&t===i.substring(0,12)&&void 0!==e[i])return!0;return!1}}]),t}(pd);function Fd(e){return e.charAt(0).toUpperCase()+e.slice(1)}var Td=function(){function e(t){td(this,e),this.options=t,this.whitelist=this.options.supportedLngs||!1,this.supportedLngs=this.options.supportedLngs||!1,this.logger=cd.create("languageUtils")}return rd(e,[{key:"getScriptPartFromCode",value:function(e){if(!e||e.indexOf("-")<0)return null;var t=e.split("-");return 2===t.length?null:(t.pop(),"x"===t[t.length-1].toLowerCase()?null:this.formatLanguageCode(t.join("-")))}},{key:"getLanguagePartFromCode",value:function(e){if(!e||e.indexOf("-")<0)return e;var t=e.split("-");return this.formatLanguageCode(t[0])}},{key:"formatLanguageCode",value:function(e){if("string"==typeof e&&e.indexOf("-")>-1){var t=["hans","hant","latn","cyrl","cans","mong","arab"],i=e.split("-");return this.options.lowerCaseLng?i=i.map((function(e){return e.toLowerCase()})):2===i.length?(i[0]=i[0].toLowerCase(),i[1]=i[1].toUpperCase(),t.indexOf(i[1].toLowerCase())>-1&&(i[1]=Fd(i[1].toLowerCase()))):3===i.length&&(i[0]=i[0].toLowerCase(),2===i[1].length&&(i[1]=i[1].toUpperCase()),"sgn"!==i[0]&&2===i[2].length&&(i[2]=i[2].toUpperCase()),t.indexOf(i[1].toLowerCase())>-1&&(i[1]=Fd(i[1].toLowerCase())),t.indexOf(i[2].toLowerCase())>-1&&(i[2]=Fd(i[2].toLowerCase()))),i.join("-")}return this.options.cleanCode||this.options.lowerCaseLng?e.toLowerCase():e}},{key:"isWhitelisted",value:function(e){return this.logger.deprecate("languageUtils.isWhitelisted",'function "isWhitelisted" will be renamed to "isSupportedCode" in the next major - please make sure to rename it\'s usage asap.'),this.isSupportedCode(e)}},{key:"isSupportedCode",value:function(e){return("languageOnly"===this.options.load||this.options.nonExplicitSupportedLngs)&&(e=this.getLanguagePartFromCode(e)),!this.supportedLngs||!this.supportedLngs.length||this.supportedLngs.indexOf(e)>-1}},{key:"getBestMatchFromCodes",value:function(e){var t,i=this;return e?(e.forEach((function(e){if(!t){var r=i.formatLanguageCode(e);i.options.supportedLngs&&!i.isSupportedCode(r)||(t=r)}})),!t&&this.options.supportedLngs&&e.forEach((function(e){if(!t){var r=i.getLanguagePartFromCode(e);if(i.isSupportedCode(r))return t=r;t=i.options.supportedLngs.find((function(e){if(0===e.indexOf(r))return e}))}})),t||(t=this.getFallbackCodes(this.options.fallbackLng)[0]),t):null}},{key:"getFallbackCodes",value:function(e,t){if(!e)return[];if("function"==typeof e&&(e=e(t)),"string"==typeof e&&(e=[e]),"[object Array]"===Object.prototype.toString.apply(e))return e;if(!t)return e.default||[];var i=e[t];return i||(i=e[this.getScriptPartFromCode(t)]),i||(i=e[this.formatLanguageCode(t)]),i||(i=e[this.getLanguagePartFromCode(t)]),i||(i=e.default),i||[]}},{key:"toResolveHierarchy",value:function(e,t){var i=this,r=this.getFallbackCodes(t||this.options.fallbackLng||[],e),n=[],s=function(e){e&&(i.isSupportedCode(e)?n.push(e):i.logger.warn("rejecting language code not found in supportedLngs: ".concat(e)))};return"string"==typeof e&&e.indexOf("-")>-1?("languageOnly"!==this.options.load&&s(this.formatLanguageCode(e)),"languageOnly"!==this.options.load&&"currentOnly"!==this.options.load&&s(this.getScriptPartFromCode(e)),"currentOnly"!==this.options.load&&s(this.getLanguagePartFromCode(e))):"string"==typeof e&&s(this.formatLanguageCode(e)),r.forEach((function(e){n.indexOf(e)<0&&s(i.formatLanguageCode(e))})),n}}]),e}(),Md=[{lngs:["ach","ak","am","arn","br","fil","gun","ln","mfe","mg","mi","oc","pt","pt-BR","tg","tl","ti","tr","uz","wa"],nr:[1,2],fc:1},{lngs:["af","an","ast","az","bg","bn","ca","da","de","dev","el","en","eo","es","et","eu","fi","fo","fur","fy","gl","gu","ha","hi","hu","hy","ia","it","kn","ku","lb","mai","ml","mn","mr","nah","nap","nb","ne","nl","nn","no","nso","pa","pap","pms","ps","pt-PT","rm","sco","se","si","so","son","sq","sv","sw","ta","te","tk","ur","yo"],nr:[1,2],fc:2},{lngs:["ay","bo","cgg","fa","ht","id","ja","jbo","ka","kk","km","ko","ky","lo","ms","sah","su","th","tt","ug","vi","wo","zh"],nr:[1],fc:3},{lngs:["be","bs","cnr","dz","hr","ru","sr","uk"],nr:[1,2,5],fc:4},{lngs:["ar"],nr:[0,1,2,3,11,100],fc:5},{lngs:["cs","sk"],nr:[1,2,5],fc:6},{lngs:["csb","pl"],nr:[1,2,5],fc:7},{lngs:["cy"],nr:[1,2,3,8],fc:8},{lngs:["fr"],nr:[1,2],fc:9},{lngs:["ga"],nr:[1,2,3,7,11],fc:10},{lngs:["gd"],nr:[1,2,3,20],fc:11},{lngs:["is"],nr:[1,2],fc:12},{lngs:["jv"],nr:[0,1],fc:13},{lngs:["kw"],nr:[1,2,3,4],fc:14},{lngs:["lt"],nr:[1,2,10],fc:15},{lngs:["lv"],nr:[1,2,0],fc:16},{lngs:["mk"],nr:[1,2],fc:17},{lngs:["mnk"],nr:[0,1,2],fc:18},{lngs:["mt"],nr:[1,2,11,20],fc:19},{lngs:["or"],nr:[2,1],fc:2},{lngs:["ro"],nr:[1,2,20],fc:20},{lngs:["sl"],nr:[5,1,2,3],fc:21},{lngs:["he","iw"],nr:[1,2,20,21],fc:22}],kd={1:function(e){return Number(e>1)},2:function(e){return Number(1!=e)},3:function(e){return 0},4:function(e){return Number(e%10==1&&e%100!=11?0:e%10>=2&&e%10<=4&&(e%100<10||e%100>=20)?1:2)},5:function(e){return Number(0==e?0:1==e?1:2==e?2:e%100>=3&&e%100<=10?3:e%100>=11?4:5)},6:function(e){return Number(1==e?0:e>=2&&e<=4?1:2)},7:function(e){return Number(1==e?0:e%10>=2&&e%10<=4&&(e%100<10||e%100>=20)?1:2)},8:function(e){return Number(1==e?0:2==e?1:8!=e&&11!=e?2:3)},9:function(e){return Number(e>=2)},10:function(e){return Number(1==e?0:2==e?1:e<7?2:e<11?3:4)},11:function(e){return Number(1==e||11==e?0:2==e||12==e?1:e>2&&e<20?2:3)},12:function(e){return Number(e%10!=1||e%100==11)},13:function(e){return Number(0!==e)},14:function(e){return Number(1==e?0:2==e?1:3==e?2:3)},15:function(e){return Number(e%10==1&&e%100!=11?0:e%10>=2&&(e%100<10||e%100>=20)?1:2)},16:function(e){return Number(e%10==1&&e%100!=11?0:0!==e?1:2)},17:function(e){return Number(1==e||e%10==1&&e%100!=11?0:1)},18:function(e){return Number(0==e?0:1==e?1:2)},19:function(e){return Number(1==e?0:0==e||e%100>1&&e%100<11?1:e%100>10&&e%100<20?2:3)},20:function(e){return Number(1==e?0:0==e||e%100>0&&e%100<20?1:2)},21:function(e){return Number(e%100==1?1:e%100==2?2:e%100==3||e%100==4?3:0)},22:function(e){return Number(1==e?0:2==e?1:(e<0||e>10)&&e%10==0?2:3)}};var Id=function(){function e(t){var i,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};td(this,e),this.languageUtils=t,this.options=r,this.logger=cd.create("pluralResolver"),this.rules=(i={},Md.forEach((function(e){e.lngs.forEach((function(t){i[t]={numbers:e.nr,plurals:kd[e.fc]}}))})),i)}return rd(e,[{key:"addRule",value:function(e,t){this.rules[e]=t}},{key:"getRule",value:function(e){return this.rules[e]||this.rules[this.languageUtils.getLanguagePartFromCode(e)]}},{key:"needsPlural",value:function(e){var t=this.getRule(e);return t&&t.numbers.length>1}},{key:"getPluralFormsOfKey",value:function(e,t){return this.getSuffixes(e).map((function(e){return t+e}))}},{key:"getSuffixes",value:function(e){var t=this,i=this.getRule(e);return i?i.numbers.map((function(i){return t.getSuffix(e,i)})):[]}},{key:"getSuffix",value:function(e,t){var i=this,r=this.getRule(e);if(r){var n=r.noAbs?r.plurals(t):r.plurals(Math.abs(t)),s=r.numbers[n];this.options.simplifyPluralSuffix&&2===r.numbers.length&&1===r.numbers[0]&&(2===s?s="plural":1===s&&(s=""));var a=function(){return i.options.prepend&&s.toString()?i.options.prepend+s.toString():s.toString()};return"v1"===this.options.compatibilityJSON?1===s?"":"number"==typeof s?"_plural_".concat(s.toString()):a():"v2"===this.options.compatibilityJSON||this.options.simplifyPluralSuffix&&2===r.numbers.length&&1===r.numbers[0]?a():this.options.prepend&&n.toString()?this.options.prepend+n.toString():n.toString()}return this.logger.warn("no plural rule found for: ".concat(e)),""}}]),e}(),Bd=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};td(this,e),this.logger=cd.create("interpolator"),this.options=t,this.format=t.interpolation&&t.interpolation.format||function(e){return e},this.init(t)}return rd(e,[{key:"init",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};e.interpolation||(e.interpolation={escapeValue:!0});var t=e.interpolation;this.escape=void 0!==t.escape?t.escape:wd,this.escapeValue=void 0===t.escapeValue||t.escapeValue,this.useRawValueToEscape=void 0!==t.useRawValueToEscape&&t.useRawValueToEscape,this.prefix=t.prefix?bd(t.prefix):t.prefixEscaped||"{{",this.suffix=t.suffix?bd(t.suffix):t.suffixEscaped||"}}",this.formatSeparator=t.formatSeparator?t.formatSeparator:t.formatSeparator||",",this.unescapePrefix=t.unescapeSuffix?"":t.unescapePrefix||"-",this.unescapeSuffix=this.unescapePrefix?"":t.unescapeSuffix||"",this.nestingPrefix=t.nestingPrefix?bd(t.nestingPrefix):t.nestingPrefixEscaped||bd("$t("),this.nestingSuffix=t.nestingSuffix?bd(t.nestingSuffix):t.nestingSuffixEscaped||bd(")"),this.nestingOptionsSeparator=t.nestingOptionsSeparator?t.nestingOptionsSeparator:t.nestingOptionsSeparator||",",this.maxReplaces=t.maxReplaces?t.maxReplaces:1e3,this.alwaysFormat=void 0!==t.alwaysFormat&&t.alwaysFormat,this.resetRegExp()}},{key:"reset",value:function(){this.options&&this.init(this.options)}},{key:"resetRegExp",value:function(){var e="".concat(this.prefix,"(.+?)").concat(this.suffix);this.regexp=new RegExp(e,"g");var t="".concat(this.prefix).concat(this.unescapePrefix,"(.+?)").concat(this.unescapeSuffix).concat(this.suffix);this.regexpUnescape=new RegExp(t,"g");var i="".concat(this.nestingPrefix,"(.+?)").concat(this.nestingSuffix);this.nestingRegexp=new RegExp(i,"g")}},{key:"interpolate",value:function(e,t,i,r){var n,s,a,o=this,h=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{};function u(e){return e.replace(/\$/g,"$$$$")}var l=function(e){if(e.indexOf(o.formatSeparator)<0){var n=xd(t,h,e);return o.alwaysFormat?o.format(n,void 0,i):n}var s=e.split(o.formatSeparator),a=s.shift().trim(),u=s.join(o.formatSeparator).trim();return o.format(xd(t,h,a),u,i,r)};this.resetRegExp();var c=r&&r.missingInterpolationHandler||this.options.missingInterpolationHandler,p=r&&r.interpolation&&r.interpolation.skipOnVariables||this.options.interpolation.skipOnVariables;return[{regex:this.regexpUnescape,safeValue:function(e){return u(e)}},{regex:this.regexp,safeValue:function(e){return o.escapeValue?u(o.escape(e)):u(e)}}].forEach((function(t){for(a=0;n=t.regex.exec(e);){if(void 0===(s=l(n[1].trim())))if("function"==typeof c){var i=c(e,n,r);s="string"==typeof i?i:""}else{if(p){s=n[0];continue}o.logger.warn("missed to pass in variable ".concat(n[1]," for interpolating ").concat(e)),s=""}else"string"==typeof s||o.useRawValueToEscape||(s=fd(s));if(e=e.replace(n[0],t.safeValue(s)),t.regex.lastIndex=0,++a>=o.maxReplaces)break}})),e}},{key:"nest",value:function(e,t){var i,r,n=this,s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},a=ed({},s);function o(e,t){var i=this.nestingOptionsSeparator;if(e.indexOf(i)<0)return e;var r=e.split(new RegExp("".concat(i,"[ ]*{"))),n="{".concat(r[1]);e=r[0],n=(n=this.interpolate(n,a)).replace(/'/g,'"');try{a=JSON.parse(n),t&&(a=ed({},t,a))}catch(t){return this.logger.warn("failed parsing options string in nesting for key ".concat(e),t),"".concat(e).concat(i).concat(n)}return delete a.defaultValue,e}for(a.applyPostProcessor=!1,delete a.defaultValue;i=this.nestingRegexp.exec(e);){var h=[],u=!1;if(i[0].includes(this.formatSeparator)&&!/{.*}/.test(i[1])){var l=i[1].split(this.formatSeparator).map((function(e){return e.trim()}));i[1]=l.shift(),h=l,u=!0}if((r=t(o.call(this,i[1].trim(),a),a))&&i[0]===e&&"string"!=typeof r)return r;"string"!=typeof r&&(r=fd(r)),r||(this.logger.warn("missed to resolve ".concat(i[1]," for nesting ").concat(e)),r=""),u&&(r=h.reduce((function(e,t){return n.format(e,t,s.lng,s)}),r.trim())),e=e.replace(i[0],r),this.regexp.lastIndex=0}return e}}]),e}();var Ld=function(e){function t(e,i,r){var n,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return td(this,t),n=sd(this,ad(t).call(this)),Cd&&pd.call(nd(n)),n.backend=e,n.store=i,n.services=r,n.languageUtils=r.languageUtils,n.options=s,n.logger=cd.create("backendConnector"),n.state={},n.queue=[],n.backend&&n.backend.init&&n.backend.init(r,s.backend,s),n}return hd(t,e),rd(t,[{key:"queueLoad",value:function(e,t,i,r){var n=this,s=[],a=[],o=[],h=[];return e.forEach((function(e){var r=!0;t.forEach((function(t){var o="".concat(e,"|").concat(t);!i.reload&&n.store.hasResourceBundle(e,t)?n.state[o]=2:n.state[o]<0||(1===n.state[o]?a.indexOf(o)<0&&a.push(o):(n.state[o]=1,r=!1,a.indexOf(o)<0&&a.push(o),s.indexOf(o)<0&&s.push(o),h.indexOf(t)<0&&h.push(t)))})),r||o.push(e)})),(s.length||a.length)&&this.queue.push({pending:a,loaded:{},errors:[],callback:r}),{toLoad:s,pending:a,toLoadLanguages:o,toLoadNamespaces:h}}},{key:"loaded",value:function(e,t,i){var r=e.split("|"),n=r[0],s=r[1];t&&this.emit("failedLoading",n,s,t),i&&this.store.addResourceBundle(n,s,i),this.state[e]=t?-1:2;var a={};this.queue.forEach((function(i){!function(e,t,i){var r=gd(e,t,Object),n=r.obj,s=r.k;n[s]=n[s]||[],n[s].push(i)}(i.loaded,[n],s),function(e,t){for(var i=e.indexOf(t);-1!==i;)e.splice(i,1),i=e.indexOf(t)}(i.pending,e),t&&i.errors.push(t),0!==i.pending.length||i.done||(Object.keys(i.loaded).forEach((function(e){a[e]||(a[e]=[]),i.loaded[e].length&&i.loaded[e].forEach((function(t){a[e].indexOf(t)<0&&a[e].push(t)}))})),i.done=!0,i.errors.length?i.callback(i.errors):i.callback())})),this.emit("loaded",a),this.queue=this.queue.filter((function(e){return!e.done}))}},{key:"read",value:function(e,t,i){var r=this,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:350,a=arguments.length>5?arguments[5]:void 0;return e.length?this.backend[i](e,t,(function(o,h){o&&h&&n<5?setTimeout((function(){r.read.call(r,e,t,i,n+1,2*s,a)}),s):a(o,h)})):a(null,{})}},{key:"prepareLoading",value:function(e,t){var i=this,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=arguments.length>3?arguments[3]:void 0;if(!this.backend)return this.logger.warn("No backend was added via i18next.use. Will not load resources."),n&&n();"string"==typeof e&&(e=this.languageUtils.toResolveHierarchy(e)),"string"==typeof t&&(t=[t]);var s=this.queueLoad(e,t,r,n);if(!s.toLoad.length)return s.pending.length||n(),null;s.toLoad.forEach((function(e){i.loadOne(e)}))}},{key:"load",value:function(e,t,i){this.prepareLoading(e,t,{},i)}},{key:"reload",value:function(e,t,i){this.prepareLoading(e,t,{reload:!0},i)}},{key:"loadOne",value:function(e){var t=this,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",r=e.split("|"),n=r[0],s=r[1];this.read(n,s,"read",void 0,void 0,(function(r,a){r&&t.logger.warn("".concat(i,"loading namespace ").concat(s," for language ").concat(n," failed"),r),!r&&a&&t.logger.log("".concat(i,"loaded namespace ").concat(s," for language ").concat(n),a),t.loaded(e,r,a)}))}},{key:"saveMissing",value:function(e,t,i,r,n){var s=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{};this.services.utils&&this.services.utils.hasLoadedNamespace&&!this.services.utils.hasLoadedNamespace(t)?this.logger.warn('did not save key "'.concat(i,'" as the namespace "').concat(t,'" was not yet loaded'),"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!"):null!=i&&""!==i&&(this.backend&&this.backend.create&&this.backend.create(e,t,i,r,null,ed({},s,{isUpdate:n})),e&&e[0]&&this.store.addResource(e[0],t,i,r))}}]),t}(pd);function Od(e){return"string"==typeof e.ns&&(e.ns=[e.ns]),"string"==typeof e.fallbackLng&&(e.fallbackLng=[e.fallbackLng]),"string"==typeof e.fallbackNS&&(e.fallbackNS=[e.fallbackNS]),e.whitelist&&(e.whitelist&&e.whitelist.indexOf("cimode")<0&&(e.whitelist=e.whitelist.concat(["cimode"])),e.supportedLngs=e.whitelist),e.nonExplicitWhitelist&&(e.nonExplicitSupportedLngs=e.nonExplicitWhitelist),e.supportedLngs&&e.supportedLngs.indexOf("cimode")<0&&(e.supportedLngs=e.supportedLngs.concat(["cimode"])),e}function Pd(){}var Nd=function(e){function t(){var e,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=arguments.length>1?arguments[1]:void 0;if(td(this,t),e=sd(this,ad(t).call(this)),Cd&&pd.call(nd(e)),e.options=Od(i),e.services={},e.logger=cd,e.modules={external:[]},r&&!e.isInitialized&&!i.isClone){if(!e.options.initImmediate)return e.init(i,r),sd(e,nd(e));setTimeout((function(){e.init(i,r)}),0)}return e}return hd(t,e),rd(t,[{key:"init",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=arguments.length>1?arguments[1]:void 0;function r(e){return e?"function"==typeof e?new e:e:null}if("function"==typeof t&&(i=t,t={}),t.whitelist&&!t.supportedLngs&&this.logger.deprecate("whitelist",'option "whitelist" will be renamed to "supportedLngs" in the next major - please make sure to rename this option asap.'),t.nonExplicitWhitelist&&!t.nonExplicitSupportedLngs&&this.logger.deprecate("whitelist",'options "nonExplicitWhitelist" will be renamed to "nonExplicitSupportedLngs" in the next major - please make sure to rename this option asap.'),this.options=ed({},{debug:!1,initImmediate:!0,ns:["translation"],defaultNS:["translation"],fallbackLng:["dev"],fallbackNS:!1,whitelist:!1,nonExplicitWhitelist:!1,supportedLngs:!1,nonExplicitSupportedLngs:!1,load:"all",preload:!1,simplifyPluralSuffix:!0,keySeparator:".",nsSeparator:":",pluralSeparator:"_",contextSeparator:"_",partialBundledLanguages:!1,saveMissing:!1,updateMissing:!1,saveMissingTo:"fallback",saveMissingPlurals:!0,missingKeyHandler:!1,missingInterpolationHandler:!1,postProcess:!1,postProcessPassResolved:!1,returnNull:!0,returnEmptyString:!0,returnObjects:!1,joinArrays:!1,returnedObjectHandler:!1,parseMissingKeyHandler:!1,appendNamespaceToMissingKey:!1,appendNamespaceToCIMode:!1,overloadTranslationOptionHandler:function(e){var t={};if("object"===Kp(e[1])&&(t=e[1]),"string"==typeof e[1]&&(t.defaultValue=e[1]),"string"==typeof e[2]&&(t.tDescription=e[2]),"object"===Kp(e[2])||"object"===Kp(e[3])){var i=e[3]||e[2];Object.keys(i).forEach((function(e){t[e]=i[e]}))}return t},interpolation:{escapeValue:!0,format:function(e,t,i,r){return e},prefix:"{{",suffix:"}}",formatSeparator:",",unescapePrefix:"-",nestingPrefix:"$t(",nestingSuffix:")",nestingOptionsSeparator:",",maxReplaces:1e3,skipOnVariables:!1}},this.options,Od(t)),this.format=this.options.interpolation.format,i||(i=Pd),!this.options.isClone){this.modules.logger?cd.init(r(this.modules.logger),this.options):cd.init(null,this.options);var n=new Td(this.options);this.store=new Ad(this.options.resources,this.options);var s=this.services;s.logger=cd,s.resourceStore=this.store,s.languageUtils=n,s.pluralResolver=new Id(n,{prepend:this.options.pluralSeparator,compatibilityJSON:this.options.compatibilityJSON,simplifyPluralSuffix:this.options.simplifyPluralSuffix}),s.interpolator=new Bd(this.options),s.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},s.backendConnector=new Ld(r(this.modules.backend),s.resourceStore,s,this.options),s.backendConnector.on("*",(function(t){for(var i=arguments.length,r=new Array(i>1?i-1:0),n=1;n<i;n++)r[n-1]=arguments[n];e.emit.apply(e,[t].concat(r))})),this.modules.languageDetector&&(s.languageDetector=r(this.modules.languageDetector),s.languageDetector.init(s,this.options.detection,this.options)),this.modules.i18nFormat&&(s.i18nFormat=r(this.modules.i18nFormat),s.i18nFormat.init&&s.i18nFormat.init(this)),this.translator=new Sd(this.services,this.options),this.translator.on("*",(function(t){for(var i=arguments.length,r=new Array(i>1?i-1:0),n=1;n<i;n++)r[n-1]=arguments[n];e.emit.apply(e,[t].concat(r))})),this.modules.external.forEach((function(t){t.init&&t.init(e)}))}if(this.options.fallbackLng&&!this.services.languageDetector&&!this.options.lng){var a=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);a.length>0&&"dev"!==a[0]&&(this.options.lng=a[0])}this.services.languageDetector||this.options.lng||this.logger.warn("init: no languageDetector is used and no lng is defined");["getResource","hasResourceBundle","getResourceBundle","getDataByLanguage"].forEach((function(t){e[t]=function(){var i;return(i=e.store)[t].apply(i,arguments)}}));["addResource","addResources","addResourceBundle","removeResourceBundle"].forEach((function(t){e[t]=function(){var i;return(i=e.store)[t].apply(i,arguments),e}}));var o=dd(),h=function(){var t=function(t,r){e.isInitialized&&e.logger.warn("init: i18next is already initialized. You should call init just once!"),e.isInitialized=!0,e.options.isClone||e.logger.log("initialized",e.options),e.emit("initialized",e.options),o.resolve(r),i(t,r)};if(e.languages&&"v1"!==e.options.compatibilityAPI&&!e.isInitialized)return t(null,e.t.bind(e));e.changeLanguage(e.options.lng,t)};return this.options.resources||!this.options.initImmediate?h():setTimeout(h,0),o}},{key:"loadResources",value:function(e){var t=this,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Pd,r="string"==typeof e?e:this.language;if("function"==typeof e&&(i=e),!this.options.resources||this.options.partialBundledLanguages){if(r&&"cimode"===r.toLowerCase())return i();var n=[],s=function(e){e&&t.services.languageUtils.toResolveHierarchy(e).forEach((function(e){n.indexOf(e)<0&&n.push(e)}))};if(r)s(r);else this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach((function(e){return s(e)}));this.options.preload&&this.options.preload.forEach((function(e){return s(e)})),this.services.backendConnector.load(n,this.options.ns,i)}else i(null)}},{key:"reloadResources",value:function(e,t,i){var r=dd();return e||(e=this.languages),t||(t=this.options.ns),i||(i=Pd),this.services.backendConnector.reload(e,t,(function(e){r.resolve(),i(e)})),r}},{key:"use",value:function(e){if(!e)throw new Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");if(!e.type)throw new Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");return"backend"===e.type&&(this.modules.backend=e),("logger"===e.type||e.log&&e.warn&&e.error)&&(this.modules.logger=e),"languageDetector"===e.type&&(this.modules.languageDetector=e),"i18nFormat"===e.type&&(this.modules.i18nFormat=e),"postProcessor"===e.type&&Ed.addPostProcessor(e),"3rdParty"===e.type&&this.modules.external.push(e),this}},{key:"changeLanguage",value:function(e,t){var i=this;this.isLanguageChangingTo=e;var r=dd();this.emit("languageChanging",e);var n=function(e){var n="string"==typeof e?e:i.services.languageUtils.getBestMatchFromCodes(e);n&&(i.language||(i.language=n,i.languages=i.services.languageUtils.toResolveHierarchy(n)),i.translator.language||i.translator.changeLanguage(n),i.services.languageDetector&&i.services.languageDetector.cacheUserLanguage(n)),i.loadResources(n,(function(e){!function(e,n){n?(i.language=n,i.languages=i.services.languageUtils.toResolveHierarchy(n),i.translator.changeLanguage(n),i.isLanguageChangingTo=void 0,i.emit("languageChanged",n),i.logger.log("languageChanged",n)):i.isLanguageChangingTo=void 0,r.resolve((function(){return i.t.apply(i,arguments)})),t&&t(e,(function(){return i.t.apply(i,arguments)}))}(e,n)}))};return e||!this.services.languageDetector||this.services.languageDetector.async?!e&&this.services.languageDetector&&this.services.languageDetector.async?this.services.languageDetector.detect(n):n(e):n(this.services.languageDetector.detect()),r}},{key:"getFixedT",value:function(e,t){var i=this,r=function e(t,r){var n;if("object"!==Kp(r)){for(var s=arguments.length,a=new Array(s>2?s-2:0),o=2;o<s;o++)a[o-2]=arguments[o];n=i.options.overloadTranslationOptionHandler([t,r].concat(a))}else n=ed({},r);return n.lng=n.lng||e.lng,n.lngs=n.lngs||e.lngs,n.ns=n.ns||e.ns,i.t(t,n)};return"string"==typeof e?r.lng=e:r.lngs=e,r.ns=t,r}},{key:"t",value:function(){var e;return this.translator&&(e=this.translator).translate.apply(e,arguments)}},{key:"exists",value:function(){var e;return this.translator&&(e=this.translator).exists.apply(e,arguments)}},{key:"setDefaultNamespace",value:function(e){this.options.defaultNS=e}},{key:"hasLoadedNamespace",value:function(e){var t=this,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!this.isInitialized)return this.logger.warn("hasLoadedNamespace: i18next was not initialized",this.languages),!1;if(!this.languages||!this.languages.length)return this.logger.warn("hasLoadedNamespace: i18n.languages were undefined or empty",this.languages),!1;var r=this.languages[0],n=!!this.options&&this.options.fallbackLng,s=this.languages[this.languages.length-1];if("cimode"===r.toLowerCase())return!0;var a=function(e,i){var r=t.services.backendConnector.state["".concat(e,"|").concat(i)];return-1===r||2===r};if(i.precheck){var o=i.precheck(this,a);if(void 0!==o)return o}return!!this.hasResourceBundle(r,e)||(!this.services.backendConnector.backend||!(!a(r,e)||n&&!a(s,e)))}},{key:"loadNamespaces",value:function(e,t){var i=this,r=dd();return this.options.ns?("string"==typeof e&&(e=[e]),e.forEach((function(e){i.options.ns.indexOf(e)<0&&i.options.ns.push(e)})),this.loadResources((function(e){r.resolve(),t&&t(e)})),r):(t&&t(),Promise.resolve())}},{key:"loadLanguages",value:function(e,t){var i=dd();"string"==typeof e&&(e=[e]);var r=this.options.preload||[],n=e.filter((function(e){return r.indexOf(e)<0}));return n.length?(this.options.preload=r.concat(n),this.loadResources((function(e){i.resolve(),t&&t(e)})),i):(t&&t(),Promise.resolve())}},{key:"dir",value:function(e){if(e||(e=this.languages&&this.languages.length>0?this.languages[0]:this.language),!e)return"rtl";return["ar","shu","sqr","ssh","xaa","yhd","yud","aao","abh","abv","acm","acq","acw","acx","acy","adf","ads","aeb","aec","afb","ajp","apc","apd","arb","arq","ars","ary","arz","auz","avl","ayh","ayl","ayn","ayp","bbz","pga","he","iw","ps","pbt","pbu","pst","prp","prd","ug","ur","ydd","yds","yih","ji","yi","hbo","men","xmn","fa","jpr","peo","pes","prs","dv","sam"].indexOf(this.services.languageUtils.getLanguagePartFromCode(e))>=0?"rtl":"ltr"}},{key:"createInstance",value:function(){return new t(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},arguments.length>1?arguments[1]:void 0)}},{key:"cloneInstance",value:function(){var e=this,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Pd,n=ed({},this.options,i,{isClone:!0}),s=new t(n);return["store","services","language"].forEach((function(t){s[t]=e[t]})),s.services=ed({},this.services),s.services.utils={hasLoadedNamespace:s.hasLoadedNamespace.bind(s)},s.translator=new Sd(s.services,s.options),s.translator.on("*",(function(e){for(var t=arguments.length,i=new Array(t>1?t-1:0),r=1;r<t;r++)i[r-1]=arguments[r];s.emit.apply(s,[e].concat(i))})),s.init(n,r),s.translator.options=s.options,s.translator.backendConnector.services.utils={hasLoadedNamespace:s.hasLoadedNamespace.bind(s)},s}}]),t}(pd),Rd=(new Nd,[]),Vd=Rd.forEach,Ud=Rd.slice;var zd,Gd=function(e,t,i,r){var n,s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{path:"/"};if(i){var a=new Date;a.setTime(a.getTime()+60*i*1e3),n="; expires="+a.toUTCString()}else n="";r=r?"domain="+r+";":"",s=Object.keys(s).reduce((function(e,t){return e+";"+t.replace(/([A-Z])/g,(function(e){return"-"+e.toLowerCase()}))+"="+s[t]}),""),document.cookie=e+"="+encodeURIComponent(t)+n+";"+r+s},jd=function(e){for(var t=e+"=",i=document.cookie.split(";"),r=0;r<i.length;r++){for(var n=i[r];" "===n.charAt(0);)n=n.substring(1,n.length);if(0===n.indexOf(t))return n.substring(t.length,n.length)}return null},$d={name:"cookie",lookup:function(e){var t;if(e.lookupCookie&&"undefined"!=typeof document){var i=jd(e.lookupCookie);i&&(t=i)}return t},cacheUserLanguage:function(e,t){t.lookupCookie&&"undefined"!=typeof document&&Gd(t.lookupCookie,e,t.cookieMinutes,t.cookieDomain,t.cookieOptions)}},qd={name:"querystring",lookup:function(e){var t;if("undefined"!=typeof window)for(var i=window.location.search.substring(1).split("&"),r=0;r<i.length;r++){var n=i[r].indexOf("=");if(n>0)i[r].substring(0,n)===e.lookupQuerystring&&(t=i[r].substring(n+1))}return t}};try{zd="undefined"!==window&&null!==window.localStorage;var Hd="i18next.translate.boo";window.localStorage.setItem(Hd,"foo"),window.localStorage.removeItem(Hd)}catch(e){zd=!1}var Wd,Xd={name:"localStorage",lookup:function(e){var t;if(e.lookupLocalStorage&&zd){var i=window.localStorage.getItem(e.lookupLocalStorage);i&&(t=i)}return t},cacheUserLanguage:function(e,t){t.lookupLocalStorage&&zd&&window.localStorage.setItem(t.lookupLocalStorage,e)}};try{Wd="undefined"!==window&&null!==window.sessionStorage;var Yd="i18next.translate.boo";window.sessionStorage.setItem(Yd,"foo"),window.sessionStorage.removeItem(Yd)}catch(e){Wd=!1}var Zd={name:"sessionStorage",lookup:function(e){var t;if(e.lookupsessionStorage&&Wd){var i=window.sessionStorage.getItem(e.lookupsessionStorage);i&&(t=i)}return t},cacheUserLanguage:function(e,t){t.lookupsessionStorage&&Wd&&window.sessionStorage.setItem(t.lookupsessionStorage,e)}},Kd={name:"navigator",lookup:function(e){var t=[];if("undefined"!=typeof navigator){if(navigator.languages)for(var i=0;i<navigator.languages.length;i++)t.push(navigator.languages[i]);navigator.userLanguage&&t.push(navigator.userLanguage),navigator.language&&t.push(navigator.language)}return t.length>0?t:void 0}},Jd={name:"htmlTag",lookup:function(e){var t,i=e.htmlTag||("undefined"!=typeof document?document.documentElement:null);return i&&"function"==typeof i.getAttribute&&(t=i.getAttribute("lang")),t}},Qd={name:"path",lookup:function(e){var t;if("undefined"!=typeof window){var i=window.location.pathname.match(/\/([a-zA-Z-]*)/g);if(i instanceof Array)if("number"==typeof e.lookupFromPathIndex){if("string"!=typeof i[e.lookupFromPathIndex])return;t=i[e.lookupFromPathIndex].replace("/","")}else t=i[0].replace("/","")}return t}},ef={name:"subdomain",lookup:function(e){var t;if("undefined"!=typeof window){var i=window.location.href.match(/(?:http[s]*\:\/\/)*(.*?)\.(?=[^\/]*\..{2,5})/gi);i instanceof Array&&(t="number"==typeof e.lookupFromSubdomainIndex?i[e.lookupFromSubdomainIndex].replace("http://","").replace("https://","").replace(".",""):i[0].replace("http://","").replace("https://","").replace(".",""))}return t}};var tf=function(){function e(t){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};td(this,e),this.type="languageDetector",this.detectors={},this.init(t,i)}return rd(e,[{key:"init",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};this.services=e,this.options=function(e){return Vd.call(Ud.call(arguments,1),(function(t){if(t)for(var i in t)void 0===e[i]&&(e[i]=t[i])})),e}(t,this.options||{},{order:["querystring","cookie","localStorage","sessionStorage","navigator","htmlTag"],lookupQuerystring:"lng",lookupCookie:"i18next",lookupLocalStorage:"i18nextLng",caches:["localStorage"],excludeCacheFor:["cimode"],checkWhitelist:!0,checkForSimilarInWhitelist:!1}),this.options.checkForSimilarInWhitelist&&(this.options.checkWhitelist=!0),this.options.lookupFromUrlIndex&&(this.options.lookupFromPathIndex=this.options.lookupFromUrlIndex),this.i18nOptions=i,this.addDetector($d),this.addDetector(qd),this.addDetector(Xd),this.addDetector(Zd),this.addDetector(Kd),this.addDetector(Jd),this.addDetector(Qd),this.addDetector(ef)}},{key:"addDetector",value:function(e){this.detectors[e.name]=e}},{key:"detect",value:function(e){var t=this;e||(e=this.options.order);var i,r=[];if(e.forEach((function(e){if(t.detectors[e]){var i=t.detectors[e].lookup(t.options);i&&"string"==typeof i&&(i=[i]),i&&(r=r.concat(i))}})),r.forEach((function(e){if(!i){var r=t.services.languageUtils.formatLanguageCode(e);t.options.checkWhitelist&&!t.services.languageUtils.isWhitelisted(r)||(i=r),!i&&t.options.checkForSimilarInWhitelist&&(i=t.getSimilarInWhitelist(r))}})),!i){var n=this.i18nOptions.fallbackLng;"string"==typeof n&&(n=[n]),n||(n=[]),i="[object Array]"===Object.prototype.toString.apply(n)?n[0]:n[0]||n.default&&n.default[0]}return i}},{key:"cacheUserLanguage",value:function(e,t){var i=this;t||(t=this.options.caches),t&&(this.options.excludeCacheFor&&this.options.excludeCacheFor.indexOf(e)>-1||t.forEach((function(t){i.detectors[t]&&i.detectors[t].cacheUserLanguage(e,i.options)})))}},{key:"getSimilarInWhitelist",value:function(e){var t=this;if(this.i18nOptions.whitelist){if(e.includes("-")){var i=e.split("-")[0],r=this.services.languageUtils.formatLanguageCode(i);if(this.services.languageUtils.isWhitelisted(r))return r;e=r}var n=this.i18nOptions.whitelist.find((function(i){var r=t.services.languageUtils.formatLanguageCode(i);if(r.startsWith(e))return r}));return n||void 0}}}]),e}();tf.type="languageDetector";var rf={en:{translation:{fes:{autoplay:"The media that tried to play (with '{{src}}') wasn't allowed to by this browser, most likely due to the browser's autoplay policy.\n\n+ More info: {{url}}",checkUserDefinedFns:"It seems that you may have accidentally written {{name}} instead of {{actualName}}. Please correct it if it's not intentional.",fileLoadError:{bytes:"It looks like there was a problem loading your file. {{suggestion}}",font:"It looks like there was a problem loading your font. {{suggestion}}",gif:"There was some trouble loading your GIF. Make sure that your GIF is using 87a or 89a encoding.",image:"It looks like there was a problem loading your image. {{suggestion}}",json:"It looks like there was a problem loading your JSON file. {{suggestion}}",large:"If your large file isn't fetched successfully, we recommend splitting the file into smaller segments and fetching those.",strings:"It looks like there was a problem loading your text file. {{suggestion}}",suggestion:"Try checking if the file path ({{filePath}}) is correct, hosting the file online, or running a local server.\n\n+ More info: {{url}}",table:"It looks like there was a problem loading your table file. {{suggestion}}",xml:"It looks like there was a problem loading your XML file. {{suggestion}}"},friendlyParamError:{type_EMPTY_VAR:"{{location}} {{func}}() was expecting {{formatType}} for the {{position}} parameter, received an empty variable instead. If not intentional, this is often a problem with scope.\n\n+ More info: {{url}}",type_TOO_FEW_ARGUMENTS:"{{location}} {{func}}() was expecting at least {{minParams}} arguments, but received only {{argCount}}.",type_TOO_MANY_ARGUMENTS:"{{location}} {{func}}() was expecting no more than {{maxParams}} arguments, but received {{argCount}}.",type_WRONG_TYPE:"{{location}} {{func}}() was expecting {{formatType}} for the {{position}} parameter, received {{argType}} instead."},globalErrors:{reference:{cannotAccess:'\n{{location}} "{{symbol}}" is used before declaration. Make sure you have declared the variable before using it.\n\n+ More info: {{url}}',notDefined:'\n{{location}} "{{symbol}}" is not defined in the current scope. If you have defined it in your code, you should check its scope, spelling, and letter-casing (JavaScript is case-sensitive).\n\n+ More info: {{url}}'},stackSubseq:"└[{{location}}] \n\t Called from line {{line}} in {{func}}()\n",stackTop:"┌[{{location}}] \n\t Error at line {{line}} in {{func}}()\n",syntax:{badReturnOrYield:"\nSyntax Error - return lies outside of a function. Make sure you’re not missing any brackets, so that return lies inside a function.\n\n+ More info: {{url}}",invalidToken:"\nSyntax Error - Found a symbol that JavaScript doesn't recognize or didn't expect at it's place.\n\n+ More info: {{url}}",missingInitializer:"\nSyntax Error - A const variable is declared but not initialized. In JavaScript, an initializer for a const is required. A value must be specified in the same statement in which the variable is declared. Check the line number in the error and assign the const variable a value.\n\n+ More info: {{url}}",redeclaredVariable:'\nSyntax Error - "{{symbol}}" is being redeclared. JavaScript doesn\'t allow declaring a variable more than once. Check the line number in error for redeclaration of the variable.\n\n+ More info: {{url}}',unexpectedToken:"\nSyntax Error - Symbol present at a place that wasn't expected.\nUsually this is due to a typo. Check the line number in the error for anything missing/extra.\n\n+ More info: {{url}}"},type:{constAssign:"\n{{location}} A const variable is being re-assigned. In javascript, re-assigning a value to a constant is not allowed. If you want to re-assign new values to a variable, make sure it is declared as var or let.\n\n+ More info: {{url}}",notfunc:'\n{{location}} "{{symbol}}" could not be called as a function.\nCheck the spelling, letter-casing (JavaScript is case-sensitive) and its type.\n\n+ More info: {{url}}',notfuncObj:'\n{{location}} "{{symbol}}" could not be called as a function.\nVerify whether "{{obj}}" has "{{symbol}}" in it and check the spelling, letter-casing (JavaScript is case-sensitive) and its type.\n\n+ More info: {{url}}',readFromNull:"\n{{location}} The property of null can't be read. In javascript the value null indicates that an object has no value.\n\n+ More info: {{url}}",readFromUndefined:"\n{{location}} Cannot read property of undefined. Check the line number in error and make sure the variable which is being operated is not undefined.\n\n + More info: {{url}}"}},libraryError:'{{location}} An error with message "{{error}}" occurred inside the p5js library when {{func}} was called. If not stated otherwise, it might be an issue with the arguments passed to {{func}}.',location:"[{{file}}, line {{line}}]",misspelling:'{{location}} It seems that you may have accidentally written "{{name}}" instead of "{{actualName}}". Please correct it to {{actualName}} if you wish to use the {{type}} from p5.js.',misspelling_plural:'{{location}} It seems that you may have accidentally written "{{name}}".\nYou may have meant one of the following: \n{{suggestions}}',misusedTopLevel:"Did you just try to use p5.js's {{symbolName}} {{symbolType}}? If so, you may want to move it into your sketch's setup() function.\n\n+ More info: {{url}}",preloadDisabled:"The preload() function has been removed in p5.js 2.0. Please load assets in setup() using async / await keywords or callbacks instead. See https://github.com/processing/p5.js-compatibility for more information about 2.0 and compatibility, or https://dev.to/limzykenneth/asynchronous-p5js-20-458f for more information about promises and async/await.",positions:{p_1:"first",p_10:"tenth",p_11:"eleventh",p_12:"twelfth",p_2:"second",p_3:"third",p_4:"fourth",p_5:"fifth",p_6:"sixth",p_7:"seventh",p_8:"eighth",p_9:"ninth"},pre:"\n🌸 p5.js says: {{message}}",sketchReaderErrors:{reservedConst:'you have used a p5.js reserved variable "{{symbol}}" make sure you change the variable name to something else.\n\n+ More info: {{url}}',reservedFunc:'you have used a p5.js reserved function "{{symbol}}" make sure you change the function name to something else.\n\n+ More info: {{url}}'},welcome:"Welcome! This is your friendly debugger. To turn me off, switch to using p5.min.js.",wrongPreload:'{{location}} An error with message "{{error}}" occurred inside the p5js library when "{{func}}" was called. If not stated otherwise, it might be due to "{{func}}" being called from preload. Nothing besides load calls (loadImage, loadJSON, loadFont, loadStrings, etc.) should be inside the preload function.'}}}};const nf=["en","es","ko","zh","hi","ja"];class sf{constructor(e,t){this.init(e,t)}fetchWithTimeout(e,t,i=2e3){return Promise.race([fetch(e,t),new Promise(((e,t)=>setTimeout((()=>t(new Error("timeout"))),i)))])}init(e,t={}){this.services=e,this.options=t}read(e,t,i){const r=this.options.loadPath;if(e===this.options.fallback)i(null,rf[e][t]);else if(nf.includes(e)){const n=this.services.interpolator.interpolate(r,{lng:e,ns:t});this.loadUrl(n,i)}else i("Not found",!1)}loadUrl(e,t){this.fetchWithTimeout(e).then((t=>{if(!t.ok)throw new Error(`failed loading ${e}`);return t.json()}),(()=>{throw new Error(`failed loading ${e}`)})).then((e=>t(null,e))).catch(t)}}sf.type="backend";const af=Promise.resolve();return function(e){e.registerAddon(Ln),e.registerAddon(On),e.registerAddon(Pn),e.registerAddon(Nn),e.registerAddon(wn)}(Ma),function(e){e.registerAddon(ka),e.registerAddon(Ia),e.registerAddon(Ba),e.registerAddon(La),e.registerAddon(Pa)}(Ma),function(e){e.registerAddon(Er),e.registerAddon(fr),e.registerAddon(Rn)}(Ma),function(e){e._friendlyError=()=>{},e._checkForUserDefinedFunctions=()=>{},e._fesErrorMonitor=()=>{}}(Ma),function(e){e.registerAddon(Na)}(Ma),function(e){e.registerAddon(Ra),e.registerAddon(Ir),e.registerAddon(Mn),e.registerAddon(Mr)}(Ma),function(e){e.registerAddon(Va),e.registerAddon(Ua),e.registerAddon(za)}(Ma),function(e){e.registerAddon(Un),e.registerAddon(ps),e.registerAddon(Wr),e.registerAddon(ds),e.registerAddon(Is),e.registerAddon(xa)}(Ma),function(e){e.registerAddon(Hn),e.registerAddon(ja),e.registerAddon(qa),e.registerAddon(Fr)}(Ma),function(e){e.registerAddon(Ha),e.registerAddon(Wa),e.registerAddon(Xa),e.registerAddon(fa),e.registerAddon(Ya),e.registerAddon(Kr)}(Ma),function(e){e.registerAddon(Za),e.registerAddon(Ka),e.registerAddon(Ja)}(Ma),function(e){ha(e,e.prototype),ca(e,e.prototype),Qa(e,e.prototype),pa(0,e.prototype),to(e,e.prototype),da(0,e.prototype),function(e){oa.prototype.maxCachedGlyphs=function(){return 200},Gh.prototype._getFontInfo=function(e){this._fontInfos=this._fontInfos||{};const t=JSON.stringify(e);if(this._fontInfos[t])return this._fontInfos[t];{const i=new n(this,{axs:e});return this._fontInfos[t]=i,i}};class t{constructor(e,t){this.width=e,this.height=t,this.infos=[]}findImage(e){const t=this.width*this.height;if(e>t)throw new Error("font is too complex to render in 3D");let i,r;for(let n=this.infos.length-1;n>=0;--n){const s=this.infos[n];if(s.index+e<t){i=s,r=s.imageData;break}}if(!i){try{r=new ImageData(this.width,this.height)}catch(e){let t=document.getElementsByTagName("canvas")[0];const i=!t;t||(t=document.createElement("canvas"),t.style.display="none",document.body.appendChild(t));const n=t.getContext("2d");n&&(r=n.createImageData(this.width,this.height)),i&&document.body.removeChild(t)}i={index:0,imageData:r},this.infos.push(i)}const n=i.index;return i.index+=e,r._dirty=!0,{imageData:r,index:n}}}function i(e,t,i,r,n){const s=e.imageData.data;let a=4*e.index++;s[a++]=t,s[a++]=i,s[a++]=r,s[a++]=n}const r=Math.sqrt(3);class n{constructor(e,{axs:i}={}){this.font=e,this.axs=i,this.strokeImageInfos=new t(64,64),this.colDimImageInfos=new t(64,64),this.rowDimImageInfos=new t(64,64),this.colCellImageInfos=new t(64,64),this.rowCellImageInfos=new t(64,64),this.glyphInfos={}}getGlyphInfo(e){let t=this.glyphInfos[e.index];if(t)return t;const n=this.axs,{glyph:{path:{commands:s}}}=this.font._singleShapeToPath(e.shape,{axs:n});let a=1/0,o=-1/0,h=1/0,u=-1/0;for(const e of s)for(let t=1;t<e.length;t+=2)a=Math.min(a,e[t]),o=Math.max(o,e[t]),h=Math.min(h,e[t+1]),u=Math.max(u,e[t+1]);if(a>=o||h>=u||!s.length)return this.glyphInfos[e.index]={};const l=o-a,c=u-h,p=Wh(s);let d;const f=[],g=[],m=[];for(d=8;d>=0;--d)m.push([]);for(d=8;d>=0;--d)g.push([]);function y(e,t,i){const r=f.length;function n(e,t,i){for(let r=e.length;r-- >0;){const n=e[r];t>n&&(t=n),i<n&&(i=n)}return{min:t,max:i}}f.push(i);const s=.5,a=n(e,1,0),o=Math.max(Math.floor(9*a.min-s),0),h=Math.min(Math.ceil(9*a.max+s),9);for(let e=o;e<h;++e)m[e].push(r);const u=n(t,1,0),l=Math.max(Math.floor(9*u.min-s),0),c=Math.min(Math.ceil(9*u.max+s),9);for(let e=l;e<c;++e)g[e].push(r)}function x(e){return function(e,t,i){return e<t?t:e>i?i:e}(255*e,0,255)}class v{constructor(e,t,i,r){this.p0=e,this.c0=t,this.c1=i,this.p1=r}toQuadratic(){return{x:this.p0.x,y:this.p0.y,x1:this.p1.x,y1:this.p1.y,cx:(3*(this.c0.x+this.c1.x)-(this.p0.x+this.p1.x))/4,cy:(3*(this.c0.y+this.c1.y)-(this.p0.y+this.p1.y))/4}}quadError(){return Zr.sub(Zr.sub(this.p1,this.p0),Zr.mult(Zr.sub(this.c1,this.c0),3)).mag()/2}split(e){const t=Zr.lerp(this.p0,this.c0,e),i=Zr.lerp(this.c0,this.c1,e),r=Zr.lerp(t,i,e);this.c1=Zr.lerp(this.c1,this.p1,e),this.c0=Zr.lerp(i,this.c1,e);const n=Zr.lerp(r,this.c0,e),s=new v(this.p0,t,r,n);return this.p0=n,s}splitInflections(){const e=Zr.sub(this.c0,this.p0),t=Zr.sub(Zr.sub(this.c1,this.c0),e),i=Zr.sub(Zr.sub(Zr.sub(this.p1,this.c1),e),Zr.mult(t,2)),r=[];let n=t.x*i.y-t.y*i.x;if(0!==n){let s=e.x*i.y-e.y*i.x,a=e.x*t.y-e.y*t.x;const o=s*s-4*n*a;if(o>=0){n<0&&(n=-n,s=-s,a=-a);const e=Math.sqrt(o),t=(-s-e)/(2*n);let i=(-s+e)/(2*n);t>0&&t<1&&(r.push(this.split(t)),i=1-(1-i)/(1-t)),i>0&&i<1&&r.push(this.split(i))}}return r.push(this),r}}function b(e,t,i,n,s,a,o,h){const u=new v(new Zr(e,t),new Zr(i,n),new Zr(s,a),new Zr(o,h)).splitInflections(),l=[],c=30/r;for(let e of u){const t=[];let i;for(;i=c/e.quadError(),!(i>=.125);){const r=Math.pow(i,1/3),n=e.split(r),s=e.split(1-r/(1-r));l.push(n),t.push(e),e=s}i<1&&l.push(e.split(.5)),l.push(e),Array.prototype.push.apply(l,t.reverse())}return l}function _(e,t,i,r){y([e,i],[t,r],{x:e,y:t,cx:(e+i)/2,cy:(t+r)/2})}function w(e,t,i,r){return Math.abs(i-e)<1e-5&&Math.abs(r-t)<1e-5}let C,A,E,D;for(const e of p){const t=(e.x-a)/l,i=(e.y-h)/c;if(!w(C,A,t,i)){switch(e.type){case"M":E=t,D=i;break;case"L":_(C,A,t,i);break;case"Q":{const r=(e.x1-a)/l,n=(e.y1-h)/c;y([C,t,r],[A,i,n],{x:C,y:A,cx:r,cy:n});break}case"Z":w(C,A,E,D)?f.push({x:C,y:A}):(_(C,A,E,D),f.push({x:E,y:D}));break;case"C":{const r=b(C,A,(e.x1-a)/l,(e.y1-h)/c,(e.x2-a)/l,(e.y2-h)/c,t,i);for(let e=0;e<r.length;e++){const t=r[e].toQuadratic();y([t.x,t.x1,t.cx],[t.y,t.y1,t.cy],t)}break}default:throw new Error(`unknown command type: ${e.type}`)}C=t,A=i}}const S=f.length,F=this.strokeImageInfos.findImage(S),T=F.index;for(let e=0;e<S;++e){const t=f[e];i(F,x(t.x),x(t.y),x(t.cx),x(t.cy))}function M(e,t,r){const n=e.length,s=t.findImage(n),a=s.index;let o=0;for(let t=0;t<n;++t)o+=e[t].length;const h=r.findImage(o);for(let t=0;t<n;++t){const r=e[t],n=r.length,a=h.index;i(s,a>>7,127&a,n>>7,127&n);for(let e=0;e<n;++e){const t=r[e]+T;i(h,t>>7,127&t,0,0)}}return{cellImageInfo:h,dimOffset:a,dimImageInfo:s}}return t=this.glyphInfos[e.index]={glyph:e,uGlyphRect:[a,h,o,u],strokeImageInfo:F,strokes:f,colInfo:M(m,this.colDimImageInfos,this.colCellImageInfos),rowInfo:M(g,this.rowDimImageInfos,this.rowCellImageInfos)},t.uGridOffset=[t.colInfo.dimOffset,t.rowInfo.dimOffset],t}}oa.prototype._renderText=function(t,i,r,n,s){if(!this.states.textFont||"string"==typeof this.states.textFont)return void console.log("WEBGL: you must load and set a font before drawing text. See `loadFont` and `textFont` for more details.");if(r>=n||!this.states.fillColor)return;if(!e.Font.hasGlyphData(this.states.textFont))return void console.log("WEBGL: only Opentype (.otf) and Truetype (.ttf) fonts with glyph data are supported");this.push();const a=this.states.strokeColor,o=this.states.drawMode;this.states.setValue("strokeColor",null),this.states.setValue("drawMode",ye);const{font:h}=this.states.textFont;if(!h)throw new Error("In WebGL mode, textFont() needs to be given the result of loadFont() instead of a font family name.");const u=h._currentAxes(this);let l=h._getFontInfo(u);const c={x:i,y:r},p=this.states.textSize/(h.data?.head?.unitsPerEm||1e3);this.translate(c.x,c.y,0),this.scale(p,p,1);const d=this.GL,f=!this._defaultFontShader,g=this._getFontShader();g.init(),g.bindShader(),f&&(g.setUniform("uGridImageSize",[64,64]),g.setUniform("uCellsImageSize",[64,64]),g.setUniform("uStrokeImageSize",[64,64]),g.setUniform("uGridSize",[9,9]));const m=this.states.fillSet?this.states.curFillColor:[0,0,0,255];this._setGlobalUniforms(g),this._applyColorBlend(m);let y=this.geometryBufferCache.getGeometryByID("glyph");y||(y=this._textGeom=new ws(1,1,(function(){for(let e=0;e<=1;e++)for(let t=0;t<=1;t++)this.vertices.push(new Zr(t,e,0)),this.uvs.push(t,e)}),this),y.gid="glyph",y.computeFaces().computeNormals(),this.geometryBufferCache.ensureCached(y));for(const e of this.buffers.text)e._prepareBuffer(y,g);this._bindBuffer(this.geometryBufferCache.cache.glyph.indexBuffer,d.ELEMENT_ARRAY_BUFFER),g.setUniform("uMaterialColor",m),d.pixelStorei(d.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),this.glyphDataCache=this.glyphDataCache||new Set;try{const e=h._positionGlyphs(t);for(const t of e){const e=l.getGlyphInfo(t);if(e.uGlyphRect){const i=e.rowInfo,r=e.colInfo,n=[e.strokeImageInfo.imageData,i.cellImageInfo.imageData,i.dimImageInfo.imageData,r.cellImageInfo.imageData,r.dimImageInfo.imageData];for(const e of n)this.glyphDataCache.delete(e),this.glyphDataCache.add(e);for(;this.glyphDataCache.size>this.maxCachedGlyphs();){const e=this.glyphDataCache.values().next().value;this.glyphDataCache.delete(e);const t=this.textures.get(e);t&&(t.remove(),this.textures.delete(e))}g.setUniform("uSamplerStrokes",e.strokeImageInfo.imageData),g.setUniform("uSamplerRowStrokes",i.cellImageInfo.imageData),g.setUniform("uSamplerRows",i.dimImageInfo.imageData),g.setUniform("uSamplerColStrokes",r.cellImageInfo.imageData),g.setUniform("uSamplerCols",r.dimImageInfo.imageData),g.setUniform("uGridOffset",e.uGridOffset),g.setUniform("uGlyphRect",e.uGlyphRect),g.setUniform("uGlyphOffset",t.x),g.bindTextures(),d.drawElements(d.TRIANGLES,6,this.GL.UNSIGNED_SHORT,0)}}}finally{g.unbindShader(),this.states.setValue("strokeColor",a),this.states.setValue("drawMode",o),d.pixelStorei(d.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!0),this.pop()}}}(e),Ms(e),Ds(e),vs(e),Cs(e),Fs(e,e.prototype),Aa(e),_s(e),Is(e),xa(e),Zp(e,e.prototype)}(Ma),function(e){e.registerAddon(uo),e.registerAddon(Hh)}(Ma),Promise.all([new Promise(((e,t)=>{"complete"===document.readyState?e():window.addEventListener("load",e,!1)})),af]).then((()=>{if(void 0===window._setupDone){if(!window.mocha){const e=new Event("p5Ready");window.dispatchEvent(e),(window.setup&&"function"==typeof window.setup||window.draw&&"function"==typeof window.draw)&&!Ma.instance&&new Ma}}else console.warn("p5.js seems to have been imported multiple times. Please remove the duplicate import")})),Ma}();