p5 2.0.2 → 2.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/accessibility/color_namer.js +4 -4
- package/dist/accessibility/index.js +4 -4
- package/dist/app.js +4 -4
- package/dist/color/color_conversion.js +4 -4
- package/dist/color/index.js +1 -1
- package/dist/color/setting.js +1 -1
- package/dist/{constants-tYr0tCl8.js → constants-BRcElHU3.js} +1 -1
- package/dist/core/constants.js +1 -1
- package/dist/core/environment.js +1 -1
- package/dist/core/friendly_errors/fes_core.js +1 -1
- package/dist/core/friendly_errors/index.js +1 -1
- package/dist/core/friendly_errors/param_validator.js +6 -19
- package/dist/core/friendly_errors/sketch_reader.js +4 -4
- package/dist/core/friendly_errors/sketch_verifier.js +1 -1
- package/dist/core/friendly_errors/validate_params.js +4 -4
- package/dist/core/helpers.js +1 -1
- package/dist/core/init.js +4 -4
- package/dist/core/legacy.js +4 -4
- package/dist/core/main.js +4 -4
- package/dist/core/p5.Graphics.js +3 -3
- package/dist/core/p5.Renderer.js +2 -2
- package/dist/core/p5.Renderer2D.js +4 -4
- package/dist/core/rendering.js +3 -3
- package/dist/dom/dom.js +1 -1
- package/dist/dom/index.js +1 -1
- package/dist/dom/p5.Element.js +1 -1
- package/dist/dom/p5.MediaElement.js +1 -1
- package/dist/events/keyboard.js +10 -4
- package/dist/image/const.js +1 -1
- package/dist/image/filterRenderer2D.js +3 -3
- package/dist/image/image.js +3 -3
- package/dist/image/index.js +3 -3
- package/dist/image/loading_displaying.js +3 -3
- package/dist/image/p5.Image.js +2 -2
- package/dist/io/files.js +3 -3
- package/dist/io/index.js +3 -3
- package/dist/{main-CAxvgiOV.js → main-BKN5yFoS.js} +3 -3
- package/dist/math/Matrices/Matrix.js +1 -1
- package/dist/math/Matrices/MatrixNumjs.js +1 -1
- package/dist/math/index.js +1 -1
- package/dist/math/p5.Matrix.js +1 -1
- package/dist/math/p5.Vector.js +1 -1
- package/dist/math/trigonometry.js +1 -1
- package/dist/{p5.Renderer-Swjl9HQO.js → p5.Renderer-R23xoC7s.js} +1 -1
- package/dist/{rendering-B5TRR7aY.js → rendering-CvUVN-Vb.js} +2 -2
- package/dist/shape/2d_primitives.js +1 -1
- package/dist/shape/attributes.js +1 -1
- package/dist/shape/custom_shapes.js +1 -1
- package/dist/shape/index.js +1 -1
- package/dist/type/index.js +2 -2
- package/dist/type/p5.Font.js +2 -2
- package/dist/type/textCore.js +2 -2
- package/dist/webgl/3d_primitives.js +3 -3
- package/dist/webgl/GeometryBuilder.js +1 -1
- package/dist/webgl/ShapeBuilder.js +1 -1
- package/dist/webgl/index.js +3 -3
- package/dist/webgl/interaction.js +1 -1
- package/dist/webgl/light.js +3 -3
- package/dist/webgl/loading.js +4 -3
- package/dist/webgl/material.js +3 -3
- package/dist/webgl/p5.Camera.js +3 -3
- package/dist/webgl/p5.Framebuffer.js +3 -3
- package/dist/webgl/p5.Geometry.js +1 -1
- package/dist/webgl/p5.Quat.js +1 -1
- package/dist/webgl/p5.RendererGL.js +3 -3
- package/dist/webgl/p5.Shader.js +3 -3
- package/dist/webgl/p5.Texture.js +3 -3
- package/dist/webgl/text.js +3 -3
- package/lib/p5.esm.js +18 -24
- package/lib/p5.js +18 -24
- package/lib/p5.min.js +1 -1
- package/package.json +1 -1
- package/types/core/main.d.ts +8 -5
- package/types/events/keyboard.d.ts +6 -4
- package/types/global.d.ts +7 -5
- package/types/p5.d.ts +8 -5
- package/types/webgl/loading.d.ts +2 -1
package/lib/p5.min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var p5=function(){"use strict";const t=Math.PI,r="2.0.2",i="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",re="soft-light",ie="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:ie,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:i,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:re,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:r,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,r,i){if(t instanceof e.Vector){const e=t;t=e.x,r=e.y,i=e.z}else if(Array.isArray(t)){const e=t;t=e[0],r=e[1],i=e[2]||1}return isNaN(r)?r=i=t:isNaN(i)&&(i=1),this._renderer.scale(t,r,i),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,r){return this._renderer.isP3D?this._renderer.translate(e,t,r):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 r=this._isGlobal?window:this;if("function"==typeof r.draw){void 0===r.setup&&r.scale(r._pixelDensity,r._pixelDensity);for(let e=0;e<t;e++){r.resetMatrix(),(this._accessibleOutputs.grid||this._accessibleOutputs.text)&&this._updateAccsOutput(),this._renderer.isP3D&&this._renderer._update(),this.frameCount=r.frameCount+1,await this._runLifecycleHook("predraw"),this._inUserDraw=!0;try{await r.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,r){return 0!==e&&(this.x=this.x%e),0!==t&&(this.y=this.y%t),0!==r&&(this.z=this.z%r),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 r=t.length;0===r?(this.dimensions=2,this._values=[0,0,0]):(this.dimensions=r,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,r){if(e instanceof je){if([e.x,e.y,e.z].every(Number.isFinite)){const t=parseFloat(e.x),r=parseFloat(e.y),i=parseFloat(e.z);return ze.call(this,t,r,i)}}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],r=Math.min(this.values.length,t.values.length);for(let e=0;e<r;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],r=Math.min(this.values.length,t.length);for(let e=0;e<r;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,r)=>e/t._values[r]))}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,r)=>e/t[r]))}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,r)=>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,r,i)=>t+r*(e[i]||0)),0)}cross(e){const t=this.y*e.z-this.z*e.y,r=this.z*e.x-this.x*e.z,i=this.x*e.y-this.y*e.x;return this.isPInst?new je(this._fromRadians,this._toRadians,t,r,i):new je(t,r,i)}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 r=this.mag();return this.x=Math.cos(t)*r,this.y=Math.sin(t)*r,this}angleBetween(e){if(0===this.magSq()*e.magSq())return NaN;const t=this.cross(e);let r=Math.atan2(t.mag(),this.dot(e))*Math.sign(t.z||1);return this.isPInst&&(r=this._fromRadians(r)),r}lerp(e,t,r,i){return e instanceof je?this.lerp(e.x,e.y,e.z,t):(this.x+=(e-this.x)*i||0,this.y+=(t-this.y)*i||0,this.z+=(r-this.z)*i||0,this)}slerp(e,t){if(0===t)return this;if(1===t)return this.set(e);const r=this.mag(),i=e.mag();if(0===r*i)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*i/r,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,r){void 0===r&&(r=1);const i=Math.cos(t),s=Math.sin(t),n=Math.cos(e),a=Math.sin(e);return new je(r*a*s,-r*n,r*a*i)}static random2D(){return this.fromAngle(Math.random()*x)}static random3D(){const e=Math.random()*x,t=2*Math.random()-1,r=Math.sqrt(1-t*t),i=r*Math.cos(e),s=r*Math.sin(e);return new je(i,s,t)}static copy(e){return e.copy(e)}static add(e,t,r){return r?r.set(e):(r=e.copy(),3===arguments.length&&p5._friendlyError("The target parameter is undefined, it should be of type p5.Vector","p5.Vector.add")),r.add(t),r}static rem(e,t){if(e instanceof je&&t instanceof je){let r=e.copy();return r.rem(t),r}}static sub(e,t,r){return r?r.set(e):(r=e.copy(),3===arguments.length&&p5._friendlyError("The target parameter is undefined, it should be of type p5.Vector","p5.Vector.sub")),r.sub(t),r}static mult(e,t,r){return r?r.set(e):(r=e.copy(),3===arguments.length&&p5._friendlyError("The target parameter is undefined, it should be of type p5.Vector","p5.Vector.mult")),r.mult(t),r}static rotate(e,t,r){return 2===arguments.length?r=e.copy():(r instanceof je||p5._friendlyError("The target parameter should be of type p5.Vector","p5.Vector.rotate"),r.set(e)),r.rotate(t),r}static div(e,t,r){return r?r.set(e):(r=e.copy(),3===arguments.length&&p5._friendlyError("The target parameter is undefined, it should be of type p5.Vector","p5.Vector.div")),r.div(t),r}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,r,i){return i?i.set(e):(i=e.copy(),4===arguments.length&&p5._friendlyError("The target parameter is undefined, it should be of type p5.Vector","p5.Vector.lerp")),i.lerp(t,r),i}static slerp(e,t,r,i){return i?i.set(e):(i=e.copy(),4===arguments.length&&p5._friendlyError("The target parameter is undefined, it should be of type p5.Vector","p5.Vector.slerp")),i.slerp(t,r),i}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,r){return arguments.length<3?r=e.copy():(r instanceof je||p5._friendlyError("The target parameter should be of type p5.Vector","p5.Vector.limit"),r.set(e)),r.limit(t)}static setMag(e,t,r){return arguments.length<3?r=e.copy():(r instanceof je||p5._friendlyError("The target parameter should be of type p5.Vector","p5.Vector.setMag"),r.set(e)),r.setMag(t)}static heading(e){return e.heading()}static angleBetween(e,t){return e.angleBetween(t)}static reflect(e,t,r){return arguments.length<3?r=e.copy():(r instanceof je||p5._friendlyError("The target parameter should be of type p5.Vector","p5.Vector.reflect"),r.set(e)),r.reflect(t)}static array(e){return e.array()}static equals(e,t){let r;return e instanceof je?r=e:e instanceof Array?r=(new je).set(e):p5._friendlyError("The v1 parameter should be of type Array or p5.Vector","p5.Vector.equals"),r.equals(t)}}function $e(e,t){e.Vector=je}function We(e,t){const r=[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,i){let s="auto";const n=this._curElement.elt;if(r.includes(e))s=e;else if("string"==typeof e){let r="";t&&i&&"number"==typeof t&&"number"==typeof i&&(r=`${t} ${i}`),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}) ${r}, 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=i,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 r;"function"==typeof t.windowResized&&(r=t.windowResized(e),void 0===r||r||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 r={};for(;null!=(t=e.exec(location.search));)t.index===e.lastIndex&&e.lastIndex++,r[t[1]]=t[2];return r},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 r=t.mat4[14]/t.mat4[15];e=this.createVector(e.x,e.y,r)}return t.invert(t).multiplyAndNormalizePoint(e)}}function qe(e,t){let r=e.length;Array.isArray(e[0])||(e=[e]),Array.isArray(t[0])||(t=t.map((e=>[e])));let i=t[0].length,s=t[0].map(((e,r)=>t.map((e=>e[r])))),n=e.map((e=>s.map((t=>{let r=0;if(!Array.isArray(e)){for(let i of t)r+=e*i;return r}for(let i=0;i<e.length;i++)r+=e[i]*(t[i]||0);return r}))));return 1===r&&(n=n[0]),1===i?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:r}){return Ze(e)?"none":function(e,t){if(0===e)return 0;let r=~~e,i=0;r&&t&&(i=1+~~Math.log10(Math.abs(r)));const s=10**(t-i);return Math.floor(e*s+.5)/s}(e,t)+(r??"")}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,r){return isNaN(e)?t:isNaN(t)?e:e+(t-e)*r}function et(e,t,r){return Qe(t[0],t[1],function(e,t,r){return(r-e)/(t-e)}(e[0],e[1],r))}function tt(e,t){return Math.sign(e)===Math.sign(t)?e:-e}function rt(e,t){return tt(Math.abs(e)**t,e)}function it(e,t){return 0===t?0:e/t}const st=new class{add(e,t,r){if("string"==typeof arguments[0])(Array.isArray(e)?e:[e]).forEach((function(e){this[e]=this[e]||[],t&&this[e][r?"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,r,i={}){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 r;let s={W1:e,W2:t,XYZ:r,options:i};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,r,i){let s=Object.entries(e.coords).map((([e,s],n)=>{let a,o=t.coordGrammar[n],h=i[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 ${r}()`)}let l=a.range;"<percentage>"===u&&(l||=[0,1]);let c=s.range||s.refRange;return l&&c&&(i[n]=et(l,c,i[n])),a}));return s}function ct(e,{meta:t}={}){let r={str:String(e)?.trim()};if(st.run("parse-start",r),r.color)return r.color;if(r.parsed=function(e){if(!e)return;e=e.trim();const t=/^-?[\d.]+$/,r=/%|deg|g?rad|turn$/,i=/\/?\s*(none|[-\w.]+(?:%|deg|g?rad|turn)?)/g;let s=e.match(/^([a-z]+)\((.+?)\)$/i);if(s){let e=[];return s[2].replace(i,((i,s)=>{let n=s.match(r),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);i.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}}}(r.str),r.parsed){let e=r.parsed.name;if("color"===e){let e=r.parsed.args.shift(),i=e.startsWith("--")?e.substring(2):`--${e}`,s=[e,i],n=r.parsed.rawArgs.indexOf("/")>0?r.parsed.args.pop():1;for(let i of dt.all){let a=i.getFormat("color");if(a&&(s.includes(a.id)||a.ids?.filter((e=>s.includes(e))).length)){const s=Object.keys(i.coords).map(((e,t)=>r.parsed.args[t]||0));let o;return a.coordGrammar&&(o=lt(i,a,"color",s)),t&&Object.assign(t,{formatId:"color",types:o}),a.id.startsWith("--")&&!e.startsWith("--")&&ht.warn(`${i.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(`${i.name} is a standard space and supported in the CSS spec. Use color(${a.id}) instead of prefixed color(${e}).`),{spaceId:i.id,coords:s,alpha:n}}}let a="",o=e in dt.registry?e:i;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 i of dt.all){let s=i.getFormat(e);if(s&&"function"===s.type){let n=1;(s.lastAlpha||Je(r.parsed.args).alpha)&&(n=r.parsed.args.pop());let a,o=r.parsed.args;return s.coordGrammar&&(a=lt(i,s,e,o)),t&&Object.assign(t,{formatId:s.name,types:a}),{spaceId:i.id,coords:o,alpha:n}}}}else for(let e of dt.all)for(let i in e.formats){let s=e.formats[i];if("custom"!==s.type)continue;if(s.test&&!s.test(r.str))continue;let n=s.parse(r.str);if(n)return n.alpha??=1,t&&(t.formatId=i),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 r=e.white??this.base.white??"D65";this.white=at(r),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 r=Object.values(this.coords);return e.every(((e,i)=>{let s=r[i];if("angle"!==s.type&&s.range){if(Number.isNaN(e))return!0;let[r,i]=s.range;return(void 0===r||e>=r-t)&&(void 0===i||e<=i+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 r=pt(e);[e,t]=[r.space,r.coords]}if(e=dt.get(e),this.equals(e))return t;t=t.map((e=>Number.isNaN(e)?0:e));let r,i,s=this.path,n=e.path;for(let e=0;e<s.length&&s[e].equals(n[e]);e++)r=s[e],i=e;if(!r)throw new Error(`Cannot convert between color spaces ${this} and ${e}: no connection space was found`);for(let e=s.length-1;e>i;e--)t=s[e].toBase(t);for(let e=i+1;e<n.length;e++)t=n[e].fromBase(t);return t}from(e,t){if(1===arguments.length){const r=pt(e);[e,t]=[r.space,r.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 r=this.coords[t],i=r.range||r.refRange;e.push(i?.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 r,i,s=Xe(e);if("string"===s?e.includes(".")?[r,i]=e.split("."):[r,i]=[,e]:Array.isArray(e)?[r,i]=e:(r=e.space,i=e.coordId),r=dt.get(r),r||(r=t),!r)throw new TypeError(`Cannot resolve coordinate reference ${e}: No color space specified and relative references are not allowed here`);if(s=Xe(i),"number"===s||"string"===s&&i>=0){let e=Object.entries(r.coords)[i];if(e)return{space:r,id:e[0],index:i,...e[1]}}r=dt.get(r);let n=i.toLowerCase(),a=0;for(let e in r.coords){let t=r.coords[e];if(e.toLowerCase()===n||t.name?.toLowerCase()===n)return{space:r,id:e,index:a,...t};a++}throw new TypeError(`No "${i}" coordinate found in ${r.name}. Its coordinates are: ${Object.keys(r.coords).join(", ")}`)}static DEFAULT_FORMAT={type:"functions",name:"color"}}function ft(e){let t=[e];for(let r=e;r=r.base;)t.push(r);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 r=Object.entries(t).map((([t,r],i)=>{let s=e.coordGrammar[i][0],n=r.range||r.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,i)=>{let{fromRange:s,toRange:n,suffix:a}=r[i];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 r=qe(e.toXYZ_M,t);return this.white!==this.base.white&&(r=ot(this.white,this.base.white,r)),r},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:r,index:i}=dt.resolveCoord(t,e.space);return xt(e,r)[i]}function bt(e,t,r){return e=pt(e),t=dt.get(t),e.coords=t.to(e.space,r),e}function _t(e,t,r){if(e=pt(e),2===arguments.length&&"object"===Xe(arguments[1])){let t=arguments[1];for(let r in t)_t(e,r,t[r])}else{"function"==typeof r&&(r=r(vt(e,t)));let{space:i,index:s}=dt.resolveCoord(t,e.space),n=xt(e,i);n[s]=r,bt(e,i,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])),r=t.map((e=>e>Ct?Math.cbrt(e):(Et*e+16)/116));return[116*r[1]-16,500*(r[0]-r[1]),200*(r[1]-r[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,[r,i,s]=e;return t=Math.abs(i)<.02&&Math.abs(s)<.02?NaN:180*Math.atan2(s,i)/Math.PI,[r,Math.sqrt(i**2+s**2),Ft(t)]},toBase(e){let[t,r,i]=e;return r<0&&(r=0),isNaN(i)&&(i=0),[t,r*Math.cos(i*Math.PI/180),r*Math.sin(i*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:r=1,kC:i=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/(r*B))**2;return V+=(C/(i*L))**2,V+=(F/(s*O))**2,V+=-1*Math.sin(2*N*Bt)*R*(C/(i*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[r,i,s]=Ut.from(e),[n,a,o]=Ut.from(t),h=r-n,u=i-a,l=s-o;return Math.sqrt(h**2+u**2+l**2)}function zt(e,t,{epsilon:r=75e-6}={}){e=pt(e),t||(t=e.space),t=dt.get(t);let i=e.coords;return t!==e.space&&(i=t.from(e)),t.inGamut(i,{epsilon:r})}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,er=32/(1.7*2523),tr=-.56,rr=16295499532821565e-27,ir=[[.41478972,.579999,.014648],[-.20151,1.120649,.0531008],[-.0166008,.2648,.6684799]],sr=[[1.9242264357876067,-1.0047923125953657,.037651404030618],[.35031676209499907,.7264811939316552,-.06538442294808501],[-.09098281098284752,-.3127282905230739,1.5227665613052603]],nr=[[.5,.5,0],[3.524,-4.066708,.542708],[.199076,1.096799,-1.295875]],ar=[[1,.1386050432715393,.05804731615611886],[.9999999999999999,-.1386050432715393,-.05804731615611886],[.9999999999999998,-.09601924202631895,-.8118918960560388]];var or=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,r,i]=e,s=qe(ir,[qt*t-(qt-1)*i,Ht*r-(Ht-1)*t,i]).map((function(e){return((Zt+Kt*(e/1e4)**Xt)/(1+Jt*(e/1e4)**Xt))**Qt})),[n,a,o]=qe(nr,s);return[(1+tr)*n/(1+tr*n)-rr,a,o]},toBase(e){let[t,r,i]=e,s=qe(ar,[(t+rr)/(1+tr-tr*(t+rr)),r,i]).map((function(e){return 1e4*((Zt-e**er)/(Jt*e**er-Kt))**Yt})),[n,a,o]=qe(sr,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]"]}}}),hr=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:or,fromBase(e){let t,[r,i,s]=e;const n=2e-4;return t=Math.abs(i)<n&&Math.abs(s)<n?NaN:180*Math.atan2(s,i)/Math.PI,[r,Math.sqrt(i**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 ur=.8359375,lr=2413/128,cr=18.6875,pr=2610/16384,dr=2523/32,fr=16384/2610,gr=32/2523,mr=[[.3592832590121217,.6976051147779502,-.035891593232029],[-.1920808463704993,1.100476797037432,.0753748658519118],[.0070797844607479,.0748396662186362,.8433265453898765]],yr=[[.5,.5,0],[6610/4096,-13613/4096,7003/4096],[17933/4096,-17390/4096,-543/4096]],xr=[[.9999999999999998,.0086090370379328,.111029625003026],[.9999999999999998,-.0086090370379328,-.1110296250030259],[.9999999999999998,.5600313357106791,-.3206271749873188]],vr=[[2.0701522183894223,-1.3263473389671563,.2066510476294053],[.3647385209748072,.6805660249472273,-.0453045459220347],[-.0497472075358123,-.0492609666966131,1.1880659249923042]];var br=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((ur+lr*(e/1e4)**pr)/(1+cr*(e/1e4)**pr))**dr}));return qe(yr,t)}(qe(mr,e)),toBase(e){let t=function(e){let t=qe(xr,e),r=t.map((function(e){return 1e4*(Math.max(e**gr-ur,0)/(lr-cr*e**gr))**fr}));return r}(e);return qe(vr,t)}});const _r=nt.D65,wr=1/.42,Cr=2*Math.PI,Dr=[[.401288,.650173,-.051461],[-.250268,1.204414,.045854],[-.002079,.048952,.953127]],Er=[[1.8620678550872327,-1.0112546305316843,.14918677544445175],[.38752654323613717,.6214474419314753,-.008973985167612518],[-.015841498849333856,-.03412293802851557,1.0499644368778496]],Ar=[[460,451,288],[460,-891,-261],[460,-220,-6300]],Sr={dark:[.8,.525,.8],dim:[.9,.59,.9],average:[1,.69,1]},Fr={h:[20.14,90,164.25,237.53,380.14],e:[.8,.7,1,1.2,.8],H:[0,100,200,300,400]},Tr=180/Math.PI,Mr=Math.PI/180;function kr(e,t){return e.map((e=>{const r=rt(t*Math.abs(e)*.01,.42);return 400*tt(r,e)/(r+27.13)}))}function Ir(e,t,r,i,s){const n={};n.discounting=s,n.refWhite=e,n.surround=i;const a=e.map((e=>100*e));n.la=t,n.yb=r;const o=a[1],h=qe(Dr,a),u=(i=Sr[n.surround])[0];n.c=i[1],n.nc=i[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=kr(p,n.fl);return n.aW=n.nbb*(2*d[0]+d[1]+.05*d[2]),n}const Br=Ir(_r,64/Math.PI*.2,20,"average",!1);function Lr(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 r=0;r=void 0!==e.h?Ft(e.h)*Mr:function(e){let t=(e%400+400)%400;const r=Math.floor(.01*t);t%=100;const[i,s]=Fr.h.slice(r,r+2),[n,a]=Fr.e.slice(r,r+2);return Ft((t*(a*i-n*s)-100*i*a)/(t*(a-n)-100*a))}(e.H)*Mr;const i=Math.cos(r),s=Math.sin(r);let n=0;void 0!==e.J?n=.1*rt(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=rt(a*Math.pow(1.64-Math.pow(.29,t.n),-.73),10/9),h=.25*(Math.cos(r+2)+3.8),u=t.aW*rt(n,2/t.c/t.z),l=5e4/13*t.nc*t.ncb*h,c=u/t.nbb,p=23*(c+.305)*it(o,23*l+o*(11*i+108*s)),d=function(e,t){const r=100/t*2588.068098016295;return e.map((e=>{const t=Math.abs(e);return tt(r*rt(t/(400-t),wr),e)}))}(qe(Ar,[c,p*i,p*s]).map((e=>1*e/1403)),t.fl);return qe(Er,d.map(((e,r)=>e*t.dRgbInv[r]))).map((e=>e/100))}function Pr(e,t){const r=e.map((e=>100*e)),i=kr(qe(Dr,r).map(((e,r)=>e*t.dRgb[r])),t.fl),s=i[0]+(-12*i[1]+i[2])/11,n=(i[0]+i[1]-2*i[2])/9,a=(Math.atan2(n,s)%Cr+Cr)%Cr,o=.25*(Math.cos(a+2)+3.8),h=rt(5e4/13*t.nc*t.ncb*it(o*Math.sqrt(s**2+n**2),i[0]+i[1]+1.05*i[2]+.305),.9)*Math.pow(1.64-Math.pow(.29,t.n),.73),u=rt(t.nbb*(2*i[0]+i[1]+.05*i[2])/t.aW,.5*t.c*t.z),l=100*rt(u,2),c=4/t.c*u*(t.aW+4)*t.flRoot,p=h*u,d=p*t.flRoot,f=Ft(a*Tr),g=function(e){let t=Ft(e);t<=Fr.h[0]&&(t+=360);const r=function(e,t,r=0,i=e.length){for(;r<i;){const s=r+i>>1;e[s]<t?r=s+1:i=s}return r}(Fr.h,t)-1,[i,s]=Fr.h.slice(r,r+2),[n,a]=Fr.e.slice(r,r+2),o=(t-i)/n;return Fr.H[r]+100*o/(o+(s-t)/a)}(f);return{J:l,C:p,h:f,s:50*rt(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=Pr(e,Br);return[t.J,t.M,t.h]},toBase:e=>Lr({J:e[0],M:e[1],h:e[2]},Br)});const Or=216/24389,Nr=24389/27;function Rr(e){return e>8?Math.pow((e+16)/116,3):e/Nr}function Vr(e,t){const r=116*((i=e[1])>Or?Math.cbrt(i):(Nr*i+16)/116)-16;var i;if(0===r)return[0,0,0];const s=Pr(e,Ur);return[Ft(s.h),s.C,r]}const Ur=Ir(nt.D65,200/Math.PI*Rr(50),100*Rr(50),"average",!1);var Gr=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=>Vr(e),toBase:e=>function(e,t){let[r,i,s]=e,n=[],a=0;if(0===s)return[0,0,0];let o=Rr(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=Lr({J:a,C:i,h:r},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 Lr({J:a,C:i,h:r},t)}(e,Ur),formats:{color:{id:"--hct",coords:["<number> | <angle>","<percentage> | <number>","<percentage> | <number>"]}}});const zr=Math.PI/180,jr=[1,.007,.0228];function $r(e){e[1]<0&&(e=Gr.fromBase(Gr.toBase(e)));const t=Math.log(Math.max(1+jr[2]*e[1]*Ur.flRoot,1))/jr[2],r=e[0]*zr,i=t*Math.cos(r),s=t*Math.sin(r);return[e[2],i,s]}var Wr={deltaE76:function(e,t){return function(e,t,r="lab"){let i=(r=dt.get(r)).from(e),s=r.from(t);return Math.sqrt(i.reduce(((e,t,r)=>{let i=s[r];return isNaN(t)||isNaN(i)?e:e+(i-t)**2}),0))}(e,t,"lab")},deltaECMC:function(e,t,{l:r=2,c:i=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/(r*m))**2;return _+=(f/(i*x))**2,_+=g/(x*(b*y+1-b))**2,Math.sqrt(_)},deltaE2000:Pt,deltaEJz:function(e,t){[e,t]=pt([e,t]);let[r,i,s]=hr.from(e),[n,a,o]=hr.from(t),h=r-n,u=i-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(i*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[r,i,s]=br.from(e),[n,a,o]=br.from(t);return 720*Math.sqrt((r-n)**2+.25*(i-a)**2+(s-o)**2)},deltaEOK:Gt,deltaEHCT:function(e,t){[e,t]=pt([e,t]);let[r,i,s]=$r(Gr.from(e)),[n,a,o]=$r(Gr.from(t));return Math.sqrt((r-n)**2+(i-a)**2+(s-o)**2)}};const qr={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 Hr(e,{method:t=ht.gamut_mapping,space:r,deltaEMethod:i="",jnd:s=2,blackWhiteClamp:n={}}={}){if(e=pt(e),He(arguments[1])?r=arguments[1]:r||(r=e.space),zt(e,r=dt.get(r),{epsilon:0}))return e;let a;if("css"===t)a=function(e,{space:t}={}){const r=.02,i=1e-4;e=pt(e),t||(t=e.space);t=dt.get(t);const s=dt.get("oklch");if(t.isUnbounded)return Yr(e,t);const n=Yr(e,s);let a=n.coords[0];if(a>=1){const r=Yr(Xr.WHITE,t);return r.alpha=e.alpha,Yr(r,t)}if(a<=0){const r=Yr(Xr.BLACK,t);return r.alpha=e.alpha,Yr(r,t)}if(zt(n,t,{epsilon:0}))return Yr(n,t);function o(e){const r=Yr(e,t),i=Object.values(t.coords);return r.coords=r.coords.map(((e,t)=>{if("range"in i[t]){const[r,s]=i[t].range;return function(e,t,r){return Math.max(Math.min(r,t),e)}(r,e,s)}return e})),r}let h=0,u=n.coords[1],l=!0,c=jt(n),p=o(c),d=Gt(p,c);if(d<r)return p;for(;u-h>i;){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<r){if(r-d<i)break;l=!1,h=e}else u=e}return p}(e,{space:r});else{if("clip"===t||zt(e,r))a=Yr(e,r);else{Object.prototype.hasOwnProperty.call(qr,t)&&({method:t,jnd:s,deltaEMethod:i,blackWhiteClamp:n}=qr[t]);let o=Pt;if(""!==i)for(let e in Wr)if("deltae"+i.toLowerCase()===e.toLowerCase()){o=Wr[e];break}let h=Hr(Yr(e,r),{method:"clip",space:r});if(o(e,h)>s){if(3===Object.keys(n).length){let t=dt.resolveCoord(n.channel),r=vt(Yr(e,t.space),t.id);if(Ze(r)&&(r=0),r>=n.max)return Yr({space:"xyz-d65",coords:nt.D65},e.space);if(r<=n.min)return Yr({space:"xyz-d65",coords:[0,0,0]},e.space)}let i=dt.resolveCoord(t),h=i.space,u=i.id,l=Yr(e,h);l.coords.forEach(((e,t)=>{Ze(e)&&(l.coords[t]=0)}));let c=(i.range||i.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=Hr(e,{space:r,method:"clip"}),o(l,e)-s<p?d=vt(l,u):f=vt(l,u),_t(l,u,(d+f)/2)}a=Yr(l,r)}else a=h}if("clip"===t||!zt(a,r,{epsilon:0})){let e=Object.values(r.coords).map((e=>e.range||[]));a.coords=a.coords.map(((t,r)=>{let[i,s]=e[r];return void 0!==i&&(t=Math.max(i,t)),void 0!==s&&(t=Math.min(t,s)),t}))}}return r!==e.space&&(a=Yr(a,e.space)),e.coords=a.coords,e}Hr.returns="color";const Xr={WHITE:{space:Ut,coords:[1,0,0]},BLACK:{space:Ut,coords:[0,0,0]}};function Yr(e,t,{inGamut:r}={}){e=pt(e);let i=(t=dt.get(t)).from(e),s={space:t,coords:i,alpha:e.alpha};return r&&(s=Hr(s,!0===r?void 0:r)),s}Yr.returns="color";var Zr=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 Kr=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]]}),Jr={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 Qr=Array(3).fill("<percentage> | <number>[0, 255]"),ei=Array(3).fill("<number>[0, 255]");var ti=new yt({id:"srgb",name:"sRGB",base:Kr,fromBase:e=>e.map((e=>{let t=e<0?-1:1,r=e*t;return r>.0031308?t*(1.055*r**(1/2.4)-.055):12.92*e})),toBase:e=>e.map((e=>{let t=e<0?-1:1,r=e*t;return r<=.04045?e/12.92:t*((r+.055)/1.055)**2.4})),formats:{rgb:{coords:Qr},rgb_number:{name:"rgb",commas:!0,coords:ei,noAlpha:!0},color:{},rgba:{coords:Qr,commas:!0,lastAlpha:!0},rgba_number:{name:"rgba",commas:!0,coords:ei},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:r=!0}={})=>{t<1&&e.push(t),e=e.map((e=>Math.round(255*e)));let i=r&&e.every((e=>e%17==0));return"#"+e.map((e=>i?(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=Jr.black,t.alpha=0):t.coords=Jr[e],t.coords)return t}}}}),ri=new yt({id:"p3",cssId:"display-p3",name:"P3",base:Zr,fromBase:ti.fromBase,toBase:ti.toBase});function ii(e,t,r={}){if(function(e){return"function"===Xe(e)&&!!e.rangeArgs}(e)){let[r,i]=[e,t];return ii(...r.rangeArgs.colors,{...r.rangeArgs.options,...i})}let{space:i,outputSpace:s,progression:n,premultiplied:a}=r;e=pt(e),t=pt(t),e=jt(e),t=jt(t);let o={colors:[e,t],options:r};if(i=i?dt.get(i):dt.registry[ht.interpolationSpace]||e.space,s=s?dt.get(s):i,e=Yr(e,i),t=Yr(t,i),e=Hr(e),t=Hr(t),i.coords.h&&"angle"===i.coords.h.type){let s=r.hue=r.hue||"shorter",n=[i,"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[r,i]=t.map(Ft),s=i-r;return"increasing"===e?s<0&&(i+=360):"decreasing"===e?s>0&&(r+=360):"longer"===e?-180<s&&s<180&&(s>0?r+=360:i+=360):"shorter"===e&&(s>180?r+=360:s<-180&&(i+=360)),[r,i]}(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((r=>{r=n?n(r):r;let o=e.coords.map(((e,i)=>Qe(e,t.coords[i],r))),h=Qe(e.alpha,t.alpha,r),u={space:i,coords:o,alpha:h};return a&&(u.coords=u.coords.map((e=>e/h))),s!==i&&(u=Yr(u,s)),u}),{rangeArgs:o})}ht.interpolationSpace="lab";var si=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:ti,fromBase:e=>{let t=Math.max(...e),r=Math.min(...e),[i,s,n]=e,[a,o,h]=[NaN,0,(r+t)/2],u=t-r;if(0!==u){switch(o=0===h||1===h?0:(t-h)/Math.min(h,1-h),t){case i:a=(s-n)/u+(s<n?6:0);break;case s:a=(n-i)/u+2;break;case n:a=(i-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,r,i]=e;function s(e){let s=(e+t/30)%12,n=r*Math.min(i,1-i);return i-n*Math.max(-1,Math.min(s-3,9-s,1))}return t%=360,t<0&&(t+=360),r/=100,i/=100,[s(0),s(8),s(4)]},formats:{hsl:{coords:["<number> | <angle>","<percentage>","<percentage>"]},hsla:{coords:["<number> | <angle>","<percentage>","<percentage>"],commas:!0,lastAlpha:!0}}}),ni=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:si,fromBase(e){let[t,r,i]=e;r/=100,i/=100;let s=i+r*Math.min(i,1-i);return[t,0===s?0:200*(1-i/s),100*s]},toBase(e){let[t,r,i]=e;r/=100,i/=100;let s=i*(1-r/2);return[t,0===s||1===s?0:(i-s)/Math.min(s,1-s)*100,100*s]},formats:{color:{id:"--hsv",coords:["<number> | <angle>","<percentage> | <number>","<percentage> | <number>"]}}}),ai=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:ni,fromBase(e){let[t,r,i]=e;return[t,i*(100-r)/100,100-i]},toBase(e){let[t,r,i]=e;r/=100,i/=100;let s=r+i;if(s>=1){return[t,0,100*(r/s)]}let n=1-i;return[t,100*(0===n?0:1-r/n),100*n]},formats:{hwb:{coords:["<number> | <angle>","<percentage> | <number>","<percentage> | <number>"]}}}),oi=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,[r,i,s]=e;const n=2e-4;return t=Math.abs(i)<n&&Math.abs(s)<n?NaN:180*Math.atan2(s,i)/Math.PI,[r,Math.sqrt(i**2+s**2),Ft(t)]},toBase(e){let t,r,[i,s,n]=e;return isNaN(n)?(t=0,r=0):(t=s*Math.cos(n*Math.PI/180),r=s*Math.sin(n*Math.PI/180)),[i,t,r]},formats:{oklch:{coords:["<percentage> | <number>","<number> | <percentage>[0,1]","<number> | <angle>"]}}}),hi=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:ti,fromBase:e=>{const t=Math.max(...e),r=t-Math.min(...e);let i,s,[n,a,o]=e;return 0===r?(i=0,s=0):(s=r/t,n===t?i=(a-o)/r:a===t?i=2+(o-n)/r:o===t&&(i=4+(n-a)/r),i<0?i+=6:i>=6&&(i-=6)),[i/6*360,100*s,100*t]},toBase:ui,formats:{default:{type:"custom",serialize:(e,t)=>{const r=ui(e);let i=`rgb(${Math.round(100*r[0]*100)/100}% ${Math.round(100*r[1]*100)/100}% ${Math.round(100*r[2]*100)/100}%`;return t<1&&(i+=` / ${t}`),i+=")",i}},hsb:{coords:["<number> | <angle>","<percentage>","<percentage>"]},hsba:{coords:["<number> | <angle>","<percentage>","<percentage>"],commans:!0,lastAlpha:!0}}});function ui(e){const t=e[0]/360*6,r=e[1]/100,i=e[2]/100;let s=[];if(0===r)s=[i,i,i];else{const e=Math.floor(t),n=i*(1-r),a=i*(1-r*(t-e)),o=i*(1-r*(1+e-t));let h,u,l;1===e?(h=a,u=i,l=n):2===e?(h=n,u=i,l=o):3===e?(h=n,u=a,l=i):4===e?(h=o,u=n,l=i):5===e?(h=i,u=n,l=a):(h=i,u=o,l=n),s=[h,u,l]}return s}const li=(e,t,r,i,s,n)=>{let a=(e-t)/(r-t)*(s-i)+i;return n&&(a=Math.max(a,Math.min(i,s)),a=Math.min(a,Math.max(i,s))),a},ci={};class pi{_color;mode;static colorMap={};static#e={};static#t={};static addColorMode(e,t){dt.register(t),pi.colorMap[e]=t.id,pi.#e[e]=Object.values(t.coords).reduce(((e,t)=>(e.push(t.refRange||t.range),e)),[]),pi.#e[e].push([0,1]),pi.#t[e]=t.fromGray}constructor(e,t,r,{clamp:i=!1}={}){if(this.mode=t||fi,e instanceof pi){const r=t?pi.colorMap[t]:pi.colorMap[e.mode];this._color=Yr(e._color,r),this.mode=r}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(pi.colorMap).find((([e,t])=>t===this._color.spaceId));this.mode=t,this._color=Yr(this._color,this._color.spaceId)}catch(e){throw new Error("Invalid color string")}else{let t;if(r)if(4===e.length)t=pi.mapColorRange(e,this.mode,r,i);else if(3===e.length)t=pi.mapColorRange([e[0],e[1],e[2]],this.mode,r,i),t.push(1);else if(2===e.length){t=pi.#t[this.mode]?pi.#t[this.mode](e[0],r,i):pi.mapColorRange([e[0],e[0],e[0]],this.mode,r,i);const s=Array.isArray(r[r.length-1])?r[r.length-1]:[0,r[r.length-1]];t.push(li(e[1],s[0],s[1],0,1,i))}else{if(1!==e.length)throw new Error("Invalid color");t=pi.#t[this.mode]?pi.#t[this.mode](e[0],r,i):pi.mapColorRange([e[0],e[0],e[0]],this.mode,r,i),t.push(1)}else t=e;const s=pi.colorMap[this.mode]||console.error("Invalid color mode"),n={space:s,coords:t.slice(0,3),alpha:t[3]};this._color=Yr(n,s)}else{const r=t?pi.colorMap[t]:e.spaceId;this._color=Yr(e,r),this.mode=t||Object.entries(pi.colorMap).find((([e,t])=>t===this._color.spaceId))}}static mapColorRange(e,t,r,i){const s=r.map((e=>Array.isArray(e)?e:[0,e])),n=pi.#e[t];return e.map(((e,t)=>li(e,s[t][0],s[t][1],n[t][0],n[t][1],i)))}static unmapColorRange(e,t,r){const i=r.map((e=>Array.isArray(e)?e:[0,e])),s=pi.#e[t];return e.map(((e,t)=>li(e,s[t][0],s[t][1],i[t][0],i[t][1])))}#r(e){return new pi(this._color,e)}get _array(){return this._getRGBA()}array(){return this._array}lerp(e,t,r){let i=-1;for(;(i+1<this._color.space.path.length||i+1<e._color.space.path.length)&&this._color.space.path[i+1]===e._color.space.path[i+1];)i+=1;if(-1===i)throw new Error("Cannot lerp colors. No common color space found");const s=ii(this._color,e._color,{space:this._color.space.path[i].id})(t);return new pi(s,r||this.mode)}toString(e){const t=`${this._color.space.id}-${this._color.coords.join(",")}-${this._color.alpha}-${e}`;let r=ci[t];return r||(r=function(e,{precision:t=ht.precision,format:r="default",inGamut:i=!0,...s}={}){let n,a=r;r=(e=pt(e)).space.getFormat(r)??e.space.getFormat("default")??dt.DEFAULT_FORMAT;let o=e.coords.slice();if(i||=r.toGamut,i&&!zt(e)&&(o=Hr(jt(e),!0===i?void 0:i).coords),"custom"===r.type){if(s.precision=t,!r.serialize)throw new TypeError(`format ${a} can only be used to parse colors, not for serialization`);n=r.serialize(o,e.alpha,s)}else{let i=r.name||"color";r.serializeCoords?o=r.serializeCoords(o,t):null!==t&&(o=o.map((e=>Ye(e,{precision:t}))));let s=[...o];if("color"===i){let t=r.id||r.ids?.[0]||e.space.id;s.unshift(t)}let a=e.alpha;null!==t&&(a=Ye(a,{precision:t}));let h=e.alpha>=1||r.noAlpha?"":`${r.commas?",":" /"} ${a}`;n=`${i}(${s.join(r.commas?", ":" ")}${h})`}return n}(this._color,{format:e}),ci[t]=r),r}setRed(e,t=[0,1]){Array.isArray(t)||(t=[0,t]);const r=pi.#e[fi][0],i=li(e,t[0],t[1],r[0],r[1]);if(this.mode===fi||this.mode===gi)this._color.coords[0]=i;else{const e=this._color.space.id,t=Yr(this._color,"srgb");t.coords[0]=i,this._color=Yr(t,e)}}setGreen(e,t=[0,1]){Array.isArray(t)||(t=[0,t]);const r=pi.#e[fi][1],i=li(e,t[0],t[1],r[0],r[1]);if(this.mode===fi||this.mode===gi)this._color.coords[1]=i;else{const e=this._color.space.id,t=Yr(this._color,"srgb");t.coords[1]=i,this._color=Yr(t,e)}}setBlue(e,t=[0,1]){Array.isArray(t)||(t=[0,t]);const r=pi.#e[fi][2],i=li(e,t[0],t[1],r[0],r[1]);if(this.mode===fi||this.mode===gi)this._color.coords[2]=i;else{const e=this._color.space.id,t=Yr(this._color,"srgb");t.coords[2]=i,this._color=Yr(t,e)}}setAlpha(e,t=[0,1]){Array.isArray(t)||(t=[0,t]);const r=pi.#e[this.mode][3],i=li(e,t[0],t[1],r[0],r[1]);this._color.alpha=i}_getRGBA(e=[1,1,1,1]){const t=pi.#e[fi];let r=structuredClone(Yr(this._color,"srgb").coords);r.push(this._color.alpha);const i=e.map((e=>Array.isArray(e)?e:[0,e]));return r=r.map(((e,r)=>li(e,t[r][0],t[r][1],i[r][0],i[r][1]))),r}_getMode(){return this.mode}_getRed(e=[0,1]){if(Array.isArray(e)||(e=[0,e]),this.mode===fi||this.mode===gi){const t=pi.#e[this.mode][0];return li(this._color.coords[0],t[0],t[1],e[0],e[1])}{const t=pi.#e[fi][0];return li(Yr(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===fi||this.mode===gi){const t=pi.#e[this.mode][1];return li(this._color.coords[1],t[0],t[1],e[0],e[1])}{const t=pi.#e[fi][1];return li(Yr(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===fi||this.mode===gi){const t=pi.#e[this.mode][2];return li(this._color.coords[2],t[0],t[1],e[0],e[1])}{const t=pi.#e[fi][2];return li(Yr(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=pi.#e[this.mode][3];return li(this._color.alpha,t[0],t[1],e[0],e[1])}_getHue(e=[0,360]){if(Array.isArray(e)||(e=[0,e]),this.mode===mi||this.mode===yi){const t=pi.#e[this.mode][0];return li(this._color.coords[0],t[0],t[1],e[0],e[1])}{const t=pi.#e[yi][0];return li(Yr(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===mi||this.mode===yi){const t=pi.#e[this.mode][1];return li(this._color.coords[1],t[0],t[1],e[0],e[1])}{const t=pi.#e[yi][1];return li(Yr(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===mi){const t=pi.#e[this.mode][2];return li(this._color.coords[2],t[0],t[1],e[0],e[1])}{const t=pi.#e[mi][2];return li(Yr(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===yi){const t=pi.#e[this.mode][2];return li(this._color.coords[2],t[0],t[1],e[0],e[1])}{const t=pi.#e[yi][2];return li(Yr(this._color,"hsl").coords[2],t[0],t[1],e[0],e[1])}}}function di(e,t,r){e.Color=pi,ti.fromGray=ri.fromGray=function(e,t,r){const i=t.map((e=>Array.isArray(e)?e:[0,e])),s=li(e,i[2][0],i[2][1],0,1,r);return[s,s,s]},hi.fromGray=si.fromGray=function(e,t,r){const i=t.map((e=>Array.isArray(e)?e:[0,e]));return[0,0,li(e,i[2][0],i[2][1],0,100,r)]},ai.fromGray=function(e,t,r){const i=t.map((e=>Array.isArray(e)?e:[0,e])),s=Math.abs(i[1][0]-i[1][1])/2+Math.abs(i[2][0]-i[2][1])/2,n=li(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=oi.fromGray=function(e,t,r){const i=t.map((e=>Array.isArray(e)?e:[0,e]));return[li(e,i[0][0],i[0][1],0,100,r),0,0]},e.Color.addColorMode(fi,ti),e.Color.addColorMode(gi,ri),e.Color.addColorMode(mi,hi),e.Color.addColorMode(yi,si),e.Color.addColorMode(xi,ai),e.Color.addColorMode(vi,St),e.Color.addColorMode(bi,Tt),e.Color.addColorMode(_i,Ut),e.Color.addColorMode(wi,oi),r.presetup=function(){const t=this,r=["Red","Green","Blue","Alpha"];for(let i in r){const s=r[i],n=e.Color.prototype["set"+s];e.Color.prototype["set"+s]=function(e,r){return r=r||t?._renderer?.states?.colorMaxes?.[fi][i],n.call(this,e,r)}}function i(r,i){const s=e.Color.prototype["_get"+r];e.Color.prototype["_get"+r]=function(e){if(Object.keys(i).includes(this.mode))e=e||t?._renderer?.states?.colorMaxes?.[this.mode][i[this.mode]];else{const r=Object.keys(i)[0];e=e||t?._renderer?.states?.colorMaxes?.[r][i[r]]}return s.call(this,e)}}i("Red",{[fi]:0,[gi]:0}),i("Green",{[fi]:1,[gi]:1}),i("Blue",{[fi]:2,[gi]:2}),i("Alpha",{[fi]:3,[gi]:3,[mi]:3,[yi]:3,[xi]:3,[vi]:3,[bi]:3,[_i]:3,[wi]:3}),i("Hue",{[yi]:0,[mi]:0,[xi]:0,[bi]:2,[wi]:2}),i("Saturation",{[yi]:1,[mi]:1}),i("Brightness",{[mi]:2}),i("Lightness",{[yi]:2})}}void 0!==p5&&di(p5);const fi="rgb",gi="rgbhdr",mi="hsb",yi="hsl",xi="hwb",vi="lab",bi="lch",_i="oklab",wi="oklch",Ci="rgba";function Di(e,t){t.RGB=fi,t.RGBHDR=gi,t.HSB=mi,t.HSL=yi,t.HWB=xi,t.LAB=vi,t.LCH=bi,t.OKLAB=_i,t.OKLCH=wi,t.RGBA=Ci,e.Renderer.states.colorMode=fi,e.Renderer.states.colorMaxes={[fi]:[255,255,255,255],[gi]:[255,255,255,255],[mi]:[360,100,100,1],[yi]:[360,100,100,1],[xi]:[360,100,100,1],[vi]:[100,[-125,125],[-125,125],1],[bi]:[100,150,360,1],[_i]:[100,[-125,125],[-125,125],1],[wi]:[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 pi)return e[0];const t=Array.isArray(e[0])?e[0]:e;return new pi(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,r){return e.lerp(t,r,this._renderer.states.colorMode)},t.paletteLerp=function(e,t){const r=e[0];if(t<r[1])return this.color(r[0]);for(let r=1;r<e.length;r++){const i=e[r];if(t<i[1]){const s=e[r-1];return this.lerpColor(this.color(s[0]),this.color(i[0]),(t-s[1])/(i[1]-s[1]))}}return this.color(e[e.length-1][0])}}void 0!==p5&&Di(p5,p5.prototype);class Ei{constructor(e){if(e)this.DOM=e;else{const e=document.implementation.createDocument(null,"doc");this.DOM=e.createElement("root")}}getParent(){return new Ei(this.DOM.parentElement)}getName(){return this.DOM.tagName}setName(e){const t=this.DOM.innerHTML,r=this.DOM.attributes,i=document.implementation.createDocument(null,"default").createElement(e);i.innerHTML=t;for(let e=0;e<r.length;e++)i.setAttribute(r[e].nodeName,r[e].nodeValue);this.DOM=i}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 Ai(e?this.DOM.getElementsByTagName(e):this.DOM.children)}getChild(e){if("string"!=typeof e)return new Ei(this.DOM.children[e]);for(const t of this.DOM.children)if(t.tagName===e)return new Ei(t)}addChild(e){e instanceof Ei&&this.DOM.appendChild(e.DOM)}removeChild(e){let t=-1;if("string"==typeof e){for(let r=0;r<this.DOM.children.length;r++)if(this.DOM.children[r].tagName===e){t=r;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 r={};for(const e of this.DOM.attributes)r[e.nodeName]=e.nodeValue;return Number(r[e])||t||0}getString(e,t){const r={};for(const e of this.DOM.attributes)r[e.nodeName]=e.nodeValue;return r[e]?String(r[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 Ai(e){const t=[];for(let r=0;r<e.length;r++)t.push(new Ei(e[r]));return t}function Si(e,t){e.XML=Ei}void 0!==p5&&Si(p5);class Fi{constructor(e,t){this.file=e,this._pInst=t;const r=e.type.split("/");this.type=r[0],this.subtype=r[1],this.name=e.name,this.size=e.size,this.data=void 0}static _createLoader(e,t){const r=new FileReader;return r.onload=function(r){const i=new Fi(e);if("application/json"===i.file.type)i.data=JSON.parse(r.target.result);else if("text/xml"===i.file.type){const e=(new DOMParser).parseFromString(r.target.result,"text/xml");i.data=new Ei(e.documentElement)}else i.data=r.target.result;t(i)},r}static _load(e,t){if(/^text\//.test(e.type)||"application/json"===e.type)Fi._createLoader(e,t).readAsText(e);else if(/^(video|audio)\//.test(e.type)){const r=new Fi(e);r.data=URL.createObjectURL(e),t(r)}else Fi._createLoader(e,t).readAsDataURL(e)}}function Ti(e,t){e.File=Fi}void 0!==p5&&Ti(p5);class Mi{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 Mi&&(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 Mi&&(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,r="none"===this.elt.style.display,i="none"===this.parent().style.display,s={x:this.elt.offsetLeft,y:this.elt.offsetTop};r&&this.show(),i&&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),r&&this.hide(),i&&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 r=e,i=t;const s=z;if(r!==s||i!==s){if(r===s?r=t*this.width/this.height:i===s&&(i=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",r*this._pInst._pixelDensity),this.elt.setAttribute("height",i*this._pInst._pixelDensity),this.elt.style.width=r+"px",this.elt.style.height=i+"px",this._pInst.scale(this._pInst._pixelDensity,this._pInst._pixelDensity),e)this.elt.getContext("2d")[s]=e[s]}else this.elt.style.width=r+"px",this.elt.style.height=i+"px",this.elt.width=r,this.elt.height=i;this.width=r,this.height=i,this._pInst&&this._pInst._curElement&&this._pInst._curElement.elt===this.elt&&(this._pInst.width=r,this._pInst.height=i)}return this}}style(e,t){const r=this;if(t instanceof pi&&(t=t.toString()),void 0===t){if(-1===e.indexOf(":")){return window.getComputedStyle(r.elt).getPropertyValue(e)}{const t=e.split(";");for(let e=0;e<t.length;e++){const r=t[e].split(":");r[0]&&r[1]&&(this.elt.style[r[0].trim()]=r[1].trim())}}}else if(this.elt.style[e]=t,"width"===e||"height"===e||"left"===e||"top"===e){let t=window.getComputedStyle(r.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 r=0;r<this.elt.childNodes.length;r++)this.elt.childNodes[r].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 Mi._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 Mi._adjustListener("dblclick",e,this),this}mouseWheel(e){return Mi._adjustListener("wheel",e,this),this}mouseReleased(e){return Mi._adjustListener("pointerup",e,this),this}mouseClicked(e){return Mi._adjustListener("click",e,this),this}mouseMoved(e){return Mi._adjustListener("pointermove",e,this),this}mouseOver(e){return Mi._adjustListener("pointerover",e,this),this}mouseOut(e){return Mi._adjustListener("pointerout",e,this),this}dragOver(e){return Mi._adjustListener("dragover",e,this),this}dragLeave(e){return Mi._adjustListener("dragleave",e,this),this}changed(e){return Mi._adjustListener("change",e,this),this}input(e){return Mi._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)}Mi._attachListener("drop",(function(r){r.preventDefault(),"function"==typeof t&&t.call(this,r);const i=r.dataTransfer.files;for(const t of i)Fi._load(t,e)}),this)}else console.log("The File APIs are not fully supported in this browser.");return this}draggable(e){let t,r="ontouchstart"in window,i=0,s=0,n=0,a=0,o=r?"touchstart":"mousedown",h=r?"touchend":"mouseup",u=r?"touchmove":"mousemove";function l(t){if(t=t||window.event,r){const e=t.changedTouches;i=n-parseInt(e[0].clientX),s=a-parseInt(e[0].clientY),n=parseInt(e[0].clientX),a=parseInt(e[0].clientY)}else i=n-parseInt(t.clientX),s=a-parseInt(t.clientY),n=parseInt(t.clientX),a=parseInt(t.clientY);e.style.left=e.offsetLeft-i+"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,r){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,r){return!1===t?Mi._detachListener(e,r):Mi._attachListener(e,t,r),this}static _attachListener(e,t,r){r._events[e]&&Mi._detachListener(e,r);const i=t.bind(r);r.elt.addEventListener(e,i,!1),r._events[e]=i}static _detachListener(e,t){const r=t._events[e];t.elt.removeEventListener(e,r,!1),t._events[e]=null}}function ki(e,t){e.Element=Mi}void 0!==p5&&ki(p5);const Ii={_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"),r=t.drawingBufferWidth*t.drawingBufferHeight*4,i=new Uint8Array(r);return t.readPixels(0,0,e.width,e.height,t.RGBA,t.UNSIGNED_BYTE,i),i}},_getARGB(e,t){const r=4*t;return e[r+3]<<24&4278190080|e[r]<<16&16711680|e[r+1]<<8&65280|255&e[r+2]},_setPixels(e,t){let r=0;for(let i=0,s=e.length;i<s;i++)r=4*i,e[r+0]=(16711680&t[i])>>>16,e[r+1]=(65280&t[i])>>>8,e[r+2]=255&t[i],e[r+3]=(4278190080&t[i])>>>24},_toImageData:e=>e instanceof ImageData?e:e.getContext("2d").getImageData(0,0,e.width,e.height),_createImageData(e,t){return Ii._tmpCanvas=document.createElement("canvas"),Ii._tmpCtx=Ii._tmpCanvas.getContext("2d"),this._tmpCtx.createImageData(e,t)},apply(e,t,r){const i=e.getContext("2d"),s=i.getImageData(0,0,e.width,e.height),n=t(s,r);n instanceof ImageData?i.putImageData(n,0,0,0,0,e.width,e.height):i.putImageData(s,0,0,0,0,e.width,e.height)},threshold(e,t=.5){const r=Ii._toPixels(e),i=Math.floor(255*t);for(let e=0;e<r.length;e+=4){let t;t=.2126*r[e]+.7152*r[e+1]+.0722*r[e+2]>=i?255:0,r[e]=r[e+1]=r[e+2]=t}},gray(e){const t=Ii._toPixels(e);for(let e=0;e<t.length;e+=4){const r=.2126*t[e]+.7152*t[e+1]+.0722*t[e+2];t[e]=t[e+1]=t[e+2]=r}},opaque(e){const t=Ii._toPixels(e);for(let e=0;e<t.length;e+=4)t[e+3]=255;return t},invert(e){const t=Ii._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 r=Ii._toPixels(e);if(t<2||t>255)throw new Error("Level must be greater than 2 and less than 255 for posterize");const i=t-1;for(let e=0;e<r.length;e+=4){const s=r[e],n=r[e+1],a=r[e+2];r[e]=255*(s*t>>8)/i,r[e+1]=255*(n*t>>8)/i,r[e+2]=255*(a*t>>8)/i}},dilate(e){const t=Ii._toPixels(e);let r=0;const i=t.length?t.length/4:0,s=new Int32Array(i);let n,a,o,h,u,l,c,p,d,f,g,m,y,x,v,b,_;for(;r<i;)for(n=r,a=r+e.width;r<a;)o=h=Ii._getARGB(t,r),c=r-1,l=r+1,p=r-e.width,d=r+e.width,c<n&&(c=r),l>=a&&(l=r),p<0&&(p=0),d>=i&&(d=r),m=Ii._getARGB(t,p),g=Ii._getARGB(t,c),y=Ii._getARGB(t,d),f=Ii._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[r++]=h;Ii._setPixels(t,s)},erode(e){const t=Ii._toPixels(e);let r=0;const i=t.length?t.length/4:0,s=new Int32Array(i);let n,a,o,h,u,l,c,p,d,f,g,m,y,x,v,b,_;for(;r<i;)for(n=r,a=r+e.width;r<a;)o=h=Ii._getARGB(t,r),c=r-1,l=r+1,p=r-e.width,d=r+e.width,c<n&&(c=r),l>=a&&(l=r),p<0&&(p=0),d>=i&&(d=r),m=Ii._getARGB(t,p),g=Ii._getARGB(t,c),y=Ii._getARGB(t,d),f=Ii._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[r++]=h;Ii._setPixels(t,s)},blur(e,t){!function(e,t){const r=Ii._toPixels(e),i=e.width,s=e.height,n=i*s,a=new Int32Array(n);for(let e=0;e<n;e++)a[e]=Ii._getARGB(r,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,Bi!==t){Bi=t,Li=1+Bi<<1,Pi=new Int32Array(Li),Oi=new Array(Li);for(let e=0;e<Li;e++)Oi[e]=new Int32Array(256);let e,r,i,s;for(let e=1,n=t-1;e<t;e++){Pi[t+e]=Pi[n]=r=n*n,i=Oi[t+e],s=Oi[n--];for(let e=0;e<256;e++)i[e]=s[e]=r*e}e=Pi[t]=t*t,i=Oi[t];for(let t=0;t<256;t++)i[t]=e*t}}(t),w=0;w<s;w++){for(_=0;_<i;_++){if(l=u=h=c=o=0,p=_-Bi,p<0)m=-p,p=0;else{if(p>=i)break;m=0}for(C=m;C<Li&&!(p>=i);C++){const e=a[p+E];D=Oi[C],c+=D[(-16777216&e)>>>24],h+=D[(16711680&e)>>16],u+=D[(65280&e)>>8],l+=D[255&e],o+=Pi[C],p++}d=E+_,y[d]=c/o,x[d]=h/o,v[d]=u/o,b[d]=l/o}E+=i}for(E=0,f=-Bi,g=f*i,w=0;w<s;w++){for(_=0;_<i;_++){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<Li&&!(d>=s);C++)D=Oi[C],c+=D[y[p]],h+=D[x[p]],u+=D[v[p]],l+=D[b[p]],o+=Pi[C],d++,p+=i;a[_+E]=c/o<<24|h/o<<16|u/o<<8|l/o}E+=i,g+=i,f++}Ii._setPixels(r,a)}(e,t)}};let Bi,Li,Pi,Oi;var Ni="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function Ri(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Vi,Ui,Gi={exports:{}};Vi=Gi,Ui=Ui||function(e){if(!(void 0===e||"undefined"!=typeof navigator&&/MSIE [1-9]\./.test(navigator.userAgent))){var t=e.document,r=function(){return e.URL||e.webkitURL||e},i=t.createElementNS("http://www.w3.org/1999/xhtml","a"),s="download"in i,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?r().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 r=(t=[].concat(t)).length;r--;){var i=e["on"+t[r]];if("function"==typeof i)try{i.call(e,e)}catch(e){o(e)}}}(d,"writestart progress write writeend".split(" "))};if(d.readyState=d.INIT,s)return p=r().createObjectURL(t),void setTimeout((function(){var e,t;i.href=p,i.download=l,e=i,t=new MouseEvent("click"),e.dispatchEvent(t),g(),h(p),d.readyState=d.DONE}));!function(){if((a||f&&n)&&e.FileReader){var i=new FileReader;return i.onloadend=function(){var t=a?i.result:i.result.replace(/^data:[^;]*;/,"data:attachment/file;");e.open(t,"_blank")||(e.location.href=t),t=void 0,d.readyState=d.DONE,g()},i.readAsDataURL(t),void(d.readyState=d.INIT)}p||(p=r().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,r){return t=t||e.name||"download",r||(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,r){return new l(e,t||e.name||"download",r)})}}("undefined"!=typeof self&&self||"undefined"!=typeof window&&window||Ni.content),Vi.exports&&(Vi.exports.saveAs=Ui);var zi=Gi.exports;function ji(e,t,r){const i=$i(t,r)[0];let s=e;s instanceof Blob||(s=new Blob([e])),zi.saveAs(s,i)}function $i(e,t){t&&!0!==t&&"true"!==t||(t=""),e||(e="untitled");let r="";return e&&e.includes(".")&&(r=e.split(".").pop()),t&&r!==t&&(r=t,e=`${e}.${r}`),[e,r]}class Wi{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,r=e._lastRealFrameTime||window.performance.now();if(0===t.lastChangeTime&&(t.lastChangeTime=r),t.playing){t.timeDisplayed=r-t.lastChangeTime;const e=t.frames[t.displayIndex].delay;if(t.timeDisplayed>=e){const i=Math.floor(t.timeDisplayed/e);if(t.timeDisplayed=0,t.lastChangeTime=r,t.displayIndex+=i,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,r=this.width*t,i=this.height*t,s=this.drawingContext.getImageData(0,0,r,i);e.imageData=s,this.pixels=e.pixels=s.data,this.setModified(!0)}updatePixels(e,t,r,i){const s=this._pixelsState,n=this._pixelDensity;void 0===e&&void 0===t&&void 0===r&&void 0===i&&(e=0,t=0,r=this.width,i=this.height),e*=n,t*=n,r*=n,i*=n,this.gifProperties&&(this.gifProperties.frames[this.gifProperties.displayIndex].image=s.imageData),this.drawingContext.putImageData(s.imageData,e,t,0,0,r,i),this.setModified(!0)}get(e,t,r,i){const s=this._pixelsState,n=this._pixelDensity,a=this.canvas;if(void 0===e&&void 0===t)e=t=0,r=s.width,i=s.height;else if(e*=n,t*=n,void 0===r&&void 0===i)return e<0||t<0||e>=a.width||t>=a.height?[0,0,0,0]:this._getPixel(e,t);const o=new Wi(r*n,i*n);return o.pixelDensity(n),o.canvas.getContext("2d").drawImage(a,e,t,r*n,i*n,0,0,r*n,i*n),o}_getPixel(e,t){let r,i;return r=this.drawingContext.getImageData(e,t,1,1).data,i=0,[r[0],r[1],r[2],r[3]]}set(e,t,r){e=Math.floor(e),t=Math.floor(t);const i=this._pixelsState;if(r instanceof Wi)this.drawingContext.save(),this.drawingContext.setTransform(1,0,0,1,0,0),this.drawingContext.scale(this._pixelDensity,this._pixelDensity),this.drawingContext.clearRect(e,t,r.width,r.height),this.drawingContext.drawImage(r.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(i.imageData||i.loadPixels(),"number"==typeof r)h<i.pixels.length&&(s=r,n=r,a=r,o=255);else if(Array.isArray(r)){if(r.length<4)throw new Error("pixel array must be of the form [R, G, B, A]");h<i.pixels.length&&(s=r[0],n=r[1],a=r[2],o=r[3])}else r instanceof p5.Color&&h<i.pixels.length&&([s,n,a,o]=r._getRGBA([255,255,255,255]));for(let r=0;r<this._pixelDensity;r++)for(let u=0;u<this._pixelDensity;u++)h=4*((t*this._pixelDensity+u)*this.width*this._pixelDensity+(e*this._pixelDensity+r)),i.pixels[h]=s,i.pixels[h+1]=n,i.pixels[h+2]=a,i.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 r=document.createElement("canvas");if(r.width=e,r.height=t,this.gifProperties){const r=this.gifProperties,i=(e,t)=>{let r=0;for(let i=0;i<t.height;i++)for(let s=0;s<t.width;s++){const n=Math.floor(s*e.width/t.width);let a=4*(Math.floor(i*e.height/t.height)*e.width+n);t.data[r++]=e.data[a++],t.data[r++]=e.data[a++],t.data[r++]=e.data[a++],t.data[r++]=e.data[a++]}};for(let s=0;s<r.numFrames;s++){const n=this.drawingContext.createImageData(e,t);i(r.frames[s].image,n),r.frames[s].image=n}}r.getContext("2d").drawImage(this.canvas,0,0,this.canvas.width,this.canvas.height,0,0,r.width,r.height),this.canvas.width=this.width=e,this.canvas.height=this.height=t,this.drawingContext.drawImage(r,0,0,e,t,0,0,e,t),this.pixels.length>0&&this.loadPixels(),this.setModified(!0)}copy(...e){let t,r,i,s,n,a,o,h,u;if(9===e.length)t=e[0],r=e[1],i=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,r=e[0],i=e[1],s=e[2],n=e[3],a=e[4],o=e[5],h=e[6],u=e[7]}this._copyHelper(this,t,r,i,s,n,a,o,h,u)}_copyHelper(e,t,r,i,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,r+c,i+p,s,n,a,o,h,u),e.pop()):e.drawingContext.drawImage(t.canvas,l*(r+c),l*(i+p),l*s,l*n,a,o,h,u)}mask(e){void 0===e&&(e=this);const t=this.drawingContext.globalCompositeOperation;let r=this._pixelDensity,i=1;e instanceof xs&&(i=e._pInst._renderer._pixelDensity);const s=[e,0,0,i*e.width,i*e.height,0,0,r*this.width,r*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,r*this.width,r*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){Ii.apply(this.canvas,Ii[e],t),this.setModified(!0)}blend(...e){const t=this.drawingContext.globalCompositeOperation,r=e[e.length-1],i=Array.prototype.slice.call(e,0,e.length-1);this.drawingContext.globalCompositeOperation=r,this.copy(...i),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 r=e.gifProperties;let i=r.loopLimit;1===i?i=null:null===i&&(i=0);const s=new Uint8Array(e.width*e.height*r.numFrames),n=[],a={};for(let t=0;t<r.numFrames;t++){const i=new Set,s=r.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 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===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:i,palette:new Uint32Array(u)},f=new omggif.GifWriter(s,e.width,e.height,d);let g={};for(let t=0;t<r.numFrames;t++){const i=!o.has(t),s=i?[]:u,a=new Uint8Array(e.width*e.height),h={},l=new Set;n[t].forEach(((e,r)=>{i?(void 0===h[e]&&(h[e]=s.length,s.push(e)),a[r]=h[e]):a[r]=c[e],t>0&&n[t-1][r]!==e&&l.add(e)}));const p={},d=s.filter((e=>!l.has(e)));if(d.length>0){const e=d[0],r=i?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]=r);p.transparent=r,g.frameOpts.disposal=1}}if(p.delay=r.frames[t].delay/10,i){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";ji(new Blob([s.slice(0,f.end())],{type:"image/gif"}),t,m)}(this,e);else{let r,i=this.canvas;switch(t=t||$i(e,t)[1]||"png"){default:r="image/png";break;case"webp":r="image/webp";break;case"jpeg":case"jpg":r="image/jpeg"}i.toBlob((r=>{ji(r,e,t)}),r)}}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 r=this.gifProperties;if(t<r.numFrames&&t>=0)r.frames[t].delay=e;else for(const t of r.frames)t.delay=e}}}function qi(e,t){e.Image=Wi}function Hi(e){let t=0;for(let r=1;r<e.length;r++)t+=e[r-1].position.dist(e[r].position);return t}void 0!==p5&&qi(p5);class Xi{constructor(e){for(const[t,r]of Object.entries(e))this[t]=r}}class Yi{vertices;_shape=null;_primitivesIndex=null;_contoursIndex=null;isClosing=!1;constructor(...e){if(this.constructor===Yi)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 r,i,s=e.at(-1,-1),n=s instanceof this.constructor,a=s.vertexCapacity-s.vertexCount;n&&a>0?(r=this.vertices.splice(0,a),i=this.vertices,s.vertices.push(...r),i.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 Zi{#i;primitives;constructor(e=8){this.#i=e,this.primitives=[]}get kind(){const e=0===this.primitives.length,t=8===this.#i;return e&&t?7:this.#i}accept(e){for(const t of this.primitives)t.accept(e)}}class Ki extends Yi{#s=1;get vertexCapacity(){return this.#s}accept(e){e.visitAnchor(this)}getEndVertex(){return this.vertices[0]}}class Ji extends Yi{constructor(...e){if(super(...e),this.constructor===Ji)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 Qi extends Ji{#s=1;get vertexCapacity(){return this.#s}accept(e){e.visitLineSegment(this)}}class es extends Ji{#n;#s;constructor(e,...t){super(...t);let r=Array.isArray(e)?e[0]:e;this.#n=r,this.#s=r}get order(){return this.#n}get vertexCapacity(){return this.#s}#a;hullLength(){return void 0===this.#a&&(this.#a=Hi([this.getStartVertex(),...this.vertices])),this.#a}accept(e){e.visitBezierSegment(this)}}class ts extends Ji{#s=1/0;_splineProperties={ends:Pe,tightness:0};get vertexCapacity(){return this.#s}accept(e){e.visitSplineSegment(this)}get _comesAfterSegment(){return this._previousPrimitive instanceof Ji}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 r=!this._belongsToShape,i=e.at(-1,-1);if(r&&2===i.vertices.length&&i._comesAfterSegment&&!i._chainedToSegment){let e=i._firstInterpolatedVertex.position,t=i.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 rs extends Yi{#s=1;get vertexCapacity(){return this.#s}accept(e){e.visitPoint(this)}}class is extends Yi{#s=2;get vertexCapacity(){return this.#s}accept(e){e.visitLine(this)}}class ss extends Yi{#s=3;get vertexCapacity(){return this.#s}accept(e){e.visitTriangle(this)}}class ns extends Yi{#s=4;get vertexCapacity(){return this.#s}accept(e){e.visitQuad(this)}}class as extends Yi{#s=1/0;get vertexCapacity(){return this.#s}accept(e){e.visitTriangleFan(this)}}class os extends Yi{#s=1/0;get vertexCapacity(){return this.#s}accept(e){e.visitTriangleStrip(this)}}class hs extends Yi{#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 Ki(...e))),e.set("vertex-8",((...e)=>new Qi(...e))),e.set(`vertex-${T}`,((...e)=>new rs(...e))),e.set(`vertex-${M}`,((...e)=>new is(...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 Ki(...t))),e.set("bezierVertex-8",((e,...t)=>new es(e,...t))),e.set("splineVertex-7",((...e)=>new Ki(...e))),e.set("splineVertex-8",((...e)=>new ts(...e))),this.creators=e}get(e,t){const r=`${e}-${t}`;return this.creators.get(r)}set(e,t,r){const i=`${e}-${t}`;this.creators.set(i,r)}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 r in this.#o){if(this.userVertexProperties&&r in this.userVertexProperties)continue;const i=e[r];t.push(...this.serializeToArray(i))}for(const r in this.userVertexProperties)r in e?t.push(...this.serializeToArray(e[r])):t.push(...new Array(this.userVertexProperties[r]).fill(0));return t}hydrateValue(e,t){if(null===t)return null;if(t instanceof Number)return e.shift();if(t instanceof Array){const r=[];for(let i=0;i<t.length;i++)r.push(e.shift());return r}if(t instanceof je)return new je(e.shift(),e.shift(),e.shift());if(t instanceof pi){const t=[e.shift(),e.shift(),e.shift(),e.shift()];return new pi(t)}}arrayToVertex(e){const t={},r=[...e];for(const e in this.#o){if(this.userVertexProperties&&e in this.userVertexProperties)continue;const i=this.#o[e];t[e]=this.hydrateValue(r,i)}for(const e in this.userVertexProperties){const i=this.#o[e];t[e]=this.hydrateValue(r,i)}return t}arrayScale(e,t){return e.map((e=>e*t))}arraySum(e,...t){return e.map(((e,r)=>{let i=e;for(let e=0;e<t.length;e++)i+=t[e][r];return i}))}arrayMinus(e,t){return e.map(((e,r)=>e-t[r]))}evaluateCubicBezier([e,t,r,i],s){return this.arraySum(this.arrayScale(e,Math.pow(1-s,3)),this.arrayScale(t,3*Math.pow(1-s,2)*s),this.arrayScale(r,3*(1-s)*Math.pow(s,2)),this.arrayScale(i,Math.pow(s,3)))}evaluateQuadraticBezier([e,t,r],i){return this.arraySum(this.arrayScale(e,Math.pow(1-i,2)),this.arrayScale(t,2*(1-i)*i),this.arrayScale(r,i*i))}catmullRomToBezier(e,t){let r=1-t,i=[];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),r/6)),u=this.arraySum(a,this.arrayScale(this.arrayMinus(n,o),r/6)),l=a;i.push([h,u,l])}return i}at(e,t,r){let i,s;switch(i=this.contours.at(e),arguments.length){case 1:return i;case 2:return i.primitives.at(t);case 3:return s=i.primitives.at(t),s.vertices.at(r)}}reset(){this.#o={...this.#h},this.kind=null,this.contours=[],this.userVertexProperties=null}vertexProperty(e,t){this.userVertexProperties=this.userVertexProperties||{};const r=this.vertexPropertyKey(e),i=Array.isArray(t)?t:[t];this.userVertexProperties[r]||(this.userVertexProperties[r]=i.length),this.#o[r]=i}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 Xi(this.#o)}#p(e,t,...r){let i=this.#u.get(e,t);return"bezierVertex"===e?i(this.#l,...r):i(...r)}#d(e,t,r){let i=e,s=this.at(-1).kind,n=this.#c(t,r);return this.#p(i,s,n).addToShape(this)}vertex(e,t,{isClosing:r=!1}={}){this.#d("vertex",e,t).isClosing=r}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 Zi(e))}endContour(e=L,t=this.contours.length-1){const r=this.at(t);if(e===B){const e=8===r.kind,i=this.at(t,0,0),s=Object.hasOwn(i,"position"),n=this.at(t,-1);if(e&&s)if(n.handlesClose())n.close(i);else{const e=this.contours.splice(t+1,this.contours.length-t-1),r=this.#o;this.#o={...r};for(const e in i)["position","textureCoordinates"].includes(e)||(this.#o[e]=i[e]);this.vertex(i.position,i.textureCoordinates,{isClosing:!0}),this.#o=r,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,r,i]=e.vertices;switch(e.order){case 2:this.path.quadraticCurveTo(t.position.x,t.position.y,r.position.x,r.position.y);break;case 3:this.path.bezierCurveTo(t.position.x,t.position.y,r.position.x,r.position.y,i.position.x,i.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 r=e.getControlPoints().map((e=>t.vertexToArray(e)));let i=t.catmullRomToBezier(r,e._splineProperties.tightness).map((e=>e.map((e=>t.arrayToVertex(e)))));for(const e of i){const t=e.flatMap((e=>[e.position.x,e.position.y]));this.path.bezierCurveTo(...t)}}visitPoint(e){const{x:t,y:r}=e.vertices[0].position;this.path.moveTo(t,r),this.path.lineTo(t+1e-5,r)}visitLine(e){const{x:t,y:r}=e.vertices[0].position,{x:i,y:s}=e.vertices[1].position;this.path.moveTo(t,r),this.path.lineTo(i,s)}visitTriangle(e){const[t,r,i]=e.vertices;this.path.moveTo(t.position.x,t.position.y),this.path.lineTo(r.position.x,r.position.y),this.path.lineTo(i.position.x,i.position.y),this.path.closePath()}visitQuad(e){const[t,r,i,s]=e.vertices;this.path.moveTo(t.position.x,t.position.y),this.path.lineTo(r.position.x,r.position.y),this.path.lineTo(i.position.x,i.position.y),this.path.lineTo(s.position.x,s.position.y),this.path.closePath()}visitTriangleFan(e){const[t,...r]=e.vertices;for(let e=0;e<r.length-1;e++){const i=r[e],s=r[e+1];this.path.moveTo(t.position.x,t.position.y),this.path.lineTo(i.position.x,i.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 r=e.vertices[t],i=e.vertices[t+1],s=e.vertices[t+2];this.path.moveTo(r.position.x,r.position.y),this.path.lineTo(i.position.x,i.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 r=e.vertices[t],i=e.vertices[t+1],s=e.vertices[t+2],n=e.vertices[t+3];this.path.moveTo(r.position.x,r.position.y),this.path.lineTo(i.position.x,i.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(),r=Math.max(1,Math.ceil(e.hullLength()*this.curveDetail)),i=[e.getStartVertex(),...e.vertices].map((t=>e._shape.vertexToArray(t)));for(let s=0;s<r;s++){const n=(s+1)/r;t.push(e._shape.arrayToVertex(3===e.order?e._shape.evaluateCubicBezier(i,n):e._shape.evaluateQuadraticBezier(i,n)))}}visitSplineSegment(e){const t=e._shape,r=this.lastContour(),i=e.getControlPoints().map((e=>t.vertexToArray(e)));let s=t.catmullRomToBezier(i,e._splineProperties.tightness),n=t.vertexToArray(e._firstInterpolatedVertex);for(const e of s){const i=[n,...e],s=Math.max(1,Math.ceil(Hi(i.map((e=>t.arrayToVertex(e))))*this.curveDetail));for(let e=0;e<s;e++){const n=(e+1)/s;r.push(t.arrayToVertex(t.evaluateCubicBezier(i,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=Zi,e.ShapePrimitive=Yi,e.Vertex=Xi,e.Anchor=Ki,e.Segment=Ji,e.LineSegment=Qi,e.BezierSegment=es,e.SplineSegment=ts,e.Point=rs,e.Line=is,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,r=0,i=0,s=0,n=0;2===e.length?[t,r]=e:4===e.length?[t,r,s,n]=e:3===e.length?[t,r,i]=e:5===e.length&&([t,r,i,s,n]=e),this._renderer.splineVertex(t,r,i,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 r,i,s;r=i=s=0,3===arguments.length?r=arguments[2]:4===arguments.length?(i=arguments[2],s=arguments[3]):5===arguments.length&&(r=arguments[2],i=arguments[3],s=arguments[4]),this._renderer.vertex(e,t,r,i,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,r,i){this._pInst=e,this._isMainCanvas=i,this.pixels=[],this._pixelDensity=Math.ceil(window.devicePixelRatio)||1,this.width=t,this.height=r,this._events={},i&&(this._isMainCanvas=!0),this.states=new ms(xs.states),this.states.strokeColor=new pi([0,0,0]),this.states.fillColor=new pi([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,r=0,i=0,s=0){const n=new je(e,t,r),a=this.getSupportedIndividualVertexProperties().textureCoordinates?new je(i,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,r=0,i=0,s=0){const n=new je(e,t,r),a=this.getSupportedIndividualVertexProperties().textureCoordinates?new je(i,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,r=0,i=0,s=0){const n=new je(e,t,r),a=this.getSupportedIndividualVertexProperties().textureCoordinates?new je(i,s):void 0;this.currentShape.vertex(n,a)}bezier(e,t,r,i,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(r,i),this._pInst.bezierVertex(s,n),this._pInst.bezierVertex(a,o),this._pInst.endShape(),this}spline(...e){if(8===e.length){const[t,r,i,s,n,a,o,h]=e;this._pInst.beginShape(),this._pInst.splineVertex(t,r),this._pInst.splineVertex(i,s),this._pInst.splineVertex(n,a),this._pInst.splineVertex(o,h),this._pInst.endShape()}else if(12===e.length){const[t,r,i,s,n,a,o,h,u,l,c,p]=e;this._pInst.beginShape(),this._pInst.splineVertex(t,r,i),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,r,i){const s=this._pixelDensity,n=this.canvas;if(void 0===e&&void 0===t)e=t=0,r=this.width,i=this.height;else if(e*=s,t*=s,void 0===r&&void 0===i)return e<0||t<0||e>=n.width||t>=n.height?[0,0,0,0]:this._getPixel(e,t);const a=new Wi(r*s,i*s);return a.pixelDensity(s),a.canvas.getContext("2d").drawImage(n,e,t,r*s,i*s,0,0,r*s,i*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 r in t)e[r](t[r])}}_applyDefaults(){return this}}class vs extends Mi{constructor(e,t){super(e,t);const r=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(r,"src",{get(){const e=r.elt.children[0].src,t=r.elt.src===window.location.href?"":r.elt.src;return e===window.location.href?t:e},set(t){for(let e=0;e<r.elt.children.length;e++)r.elt.removeChild(r.elt.children[e]);const i=document.createElement("source");i.src=t,e.appendChild(i),r.elt.src=t,r.modified=!0}}),r._onended=function(){},r.elt.onended=function(){r._onended(r)}}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,r,i){return this.loadedmetadata&&(this._ensureCanvas(),p5.Renderer2D.prototype.updatePixels.call(this,e,t,r,i)),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,r){this.loadedmetadata&&(this._ensureCanvas(),p5.Renderer2D.prototype.set.call(this,e,t,r),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,r;if("function"==typeof fn.getAudioContext)t=fn.getAudioContext(),r=p5.soundOut.input;else try{t=e.context,r=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(r)),e?e.input?this.audioSourceNode.connect(e.input):this.audioSourceNode.connect(e):this.audioSourceNode.connect(r)}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,r){const i=this._cueIDCounter++,s=new bs(t,e,i,r);return this._cues.push(s),this.elt.ontimeupdate||(this.elt.ontimeupdate=this._onTimeUpdate.bind(this)),i}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 r=this._cues[t].time,i=this._cues[t].val;this._prevTime<r&&r<=e&&this._cues[t].callback(i)}this._prevTime=e}}class bs{constructor(e,t,r,i){this.callback=e,this.time=t,this.id=r,this.val=i}}function _s(e,t){function r(e,t,r){(t._userNode?t._userNode:document.body).appendChild(e);const i=r?new vs(e,t):new Mi(e,t);return t._elements.push(i),i}function i(e,t,i,s){const n=document.createElement(t);"string"==typeof(i=i||"")&&(i=[i]);for(const e of i){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=r(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 i(this,"video",e,t)},t.createAudio=function(e,t){return i(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(r,i){t.call(navigator,e,r,i)})):Promise.reject(new Error("getUserMedia is not implemented in this browser"))}),t.createCapture=function(...i){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 i)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=r(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,r,i,s){let n;return s===_?n={x:e,y:t,w:Math.abs(r),h:Math.abs(i)}:s===w?n={x:Math.min(e,r),y:Math.min(t,i),w:Math.abs(r-e),h:Math.abs(i-t)}:s===C?n={x:e-(r=Math.abs(r)),y:t-(i=Math.abs(i)),w:2*r,h:2*i}:s===A&&(n={x:e-.5*(r=Math.abs(r)),y:t-.5*(i=Math.abs(i)),w:r,h:i}),n}};function Es(e,t){t._normalizeArcAngles=(e,t,r,i,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(r/i*Math.tan(e)):e>f&&e<=3*f?Math.atan(r/i*Math.tan(e))+g:Math.atan(r/i*Math.tan(e))+x,t=t<=f?Math.atan(r/i*Math.tan(t)):t>f&&t<=3*f?Math.atan(r/i*Math.tan(t))+g:Math.atan(r/i*Math.tan(t))+x),e>t&&(t+=x),{start:e,stop:t,correspondToSamePoint:n<1e-5}},t.arc=function(e,t,r,i,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,r,i,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,r,i,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,r,i,s){if(!this._renderer.states.strokeColor&&!this._renderer.states.fillColor)return this;void 0===i&&(i=r);const n=Ds.modeAdjust(e,t,r,i,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,r,i,s,n,a){return this._renderRect.call(this,e,t,r,r,i,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,r,i,s){const n=1-s;return Math.pow(n,3)*e+3*Math.pow(n,2)*s*t+3*n*Math.pow(s,2)*r+Math.pow(s,3)*i},t.bezierTangent=function(e,t,r,i,s){const n=1-s;return 3*i*Math.pow(s,2)-3*r*Math.pow(s,2)+6*r*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,r,i,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)+r*((-3-n)/2*a+(n+2)*o+(1-n)/2*s)+i*((1-n)/2*a+(n-1)/2*o)},t.splineTangent=function(e,t,r,i,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)+r*((-3-n)/2*a+(n+2)*o+(1-n)/2)+i*((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,r){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,r=e[1]||0,i=e[2]||0,s=e[3]||0;return this._renderer.clear(t,r,i,s),this},t.colorMode=function(e,t,r,i,s){if([fi,gi,mi,yi,xi,vi,bi,_i,wi].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]=r,n[2]=i):5===arguments.length&&(n[0]=t,n[1]=r,n[2]=i,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,r,i){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)>i)return void console.log("Warning, gif stream longer than expected.");r[p++]=b;var _=p+=x;for(y!==m&&(r[p++]=b),v=y;x--;)v=f[v],r[--_]=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!==i&&console.log("Warning, gif stream shorter than expected."),r}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,r,i){var s=0,n=void 0===(i=void 0===i?{}:i).loop?null:i.loop,a=void 0===i.palette?null:i.palette;if(t<=0||r<=0||t>65535||r>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!==i.background){if((u=i.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&r,e[s++]=r>>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,r,i,n,h,u){if(!0===f&&(--s,f=!1),u=void 0===u?{}:u,t<0||r<0||t>65535||r>65535)throw new Error("x/y invalid.");if(i<=0||n<=0||i>65535||n>65535)throw new Error("Width/Height invalid.");if(h.length<i*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&r,e[s++]=r>>8&255,e[s++]=255&i,e[s++]=i>>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,r,i){e[t++]=r;var s=t++,n=1<<r,a=n-1,o=n+1,h=o+1,u=r+1,l=0,c=0;function p(r){for(;l>=r;)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=i[0]&a,g={};d(n);for(var m=1,y=i.length;m<y;++m){var x=i[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=r+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 r=e[t++]|e[t++]<<8,i=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=r,this.height=i;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,i){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=r-u,c=u,p=4*(s.y*r+s.x),d=4*((s.y+s.height)*r+s.x),f=p,g=4*l;!0===s.interlaced&&(g+=4*r*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*r*(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];i[f++]=w,i[f++]=_,i[f++]=b,i[f++]=255}--c}},this.decodeAndBlitFrameRGBA=function(t,i){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=r-u,c=u,p=4*(s.y*r+s.x),d=4*((s.y+s.height)*r+s.x),f=p,g=4*l;!0===s.interlaced&&(g+=4*r*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*r*(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];i[f++]=b,i[f++]=_,i[f++]=w,i[f++]=255}--c}}}}catch(e){}function ks(e,t){t.createImage=function(t,r){return new e.Image(t,r)},t.saveCanvas=function(...e){let r,i,s,n,a;if(e[0]instanceof HTMLCanvasElement)r=e[0],e.shift();else if(e[0]instanceof Mi)r=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(),r=n._renderer.canvas,e.shift()}else r=this._curElement&&this._curElement.elt;switch(e.length>=1&&(i=e[0]),e.length>=2&&(s=e[1]),s=s||t._checkFileExtension(i,s)[1]||"png",s){default:a="image/png";break;case"webp":a="image/webp";break;case"jpeg":case"jpg":a="image/jpeg"}r.toBlob((e=>{t.downloadFile(e,i,s),n&&n.remove()}),a)},t.encodeAndDownloadGif=function(e,r){const i=e.gifProperties;let s=i.loopLimit;1===s?s=null:null===s&&(s=0);const n=new Uint8Array(e.width*e.height*i.numFrames),a=[],o={};for(let t=0;t<i.numFrames;t++){const r=new Set,s=i.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 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===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<i.numFrames;t++){const r=!h.has(t),s=r?[]:l,n=new Uint8Array(e.width*e.height),o={},u=new Set;a[t].forEach(((e,i)=>{r?(void 0===o[e]&&(o[e]=s.length,s.push(e)),n[i]=o[e]):n[i]=p[e],t>0&&a[t-1][i]!==e&&u.add(e)}));const c={},d=s.filter((e=>!u.has(e)));if(d.length>0){const e=d[0],i=r?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]=i);c.transparent=i,m.frameOpts.disposal=1}}if(c.delay=i.frames[t].delay/10,r){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,r,"gif")},t.saveFrames=function(e,r,i,s,n){let a=i||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,r,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,r){let i,s;if(i=this?this._curElement.elt:r,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=i.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 r=await fetch(e);if(r.ok){let e;switch(t){case"json":e=await r.json();break;case"text":e=await r.text();break;case"arrayBuffer":e=await r.arrayBuffer();break;case"blob":e=await r.blob();break;case"bytes":if(r.bytes)e=await r.bytes();else{const t=await r.arrayBuffer();e=new Uint8Array(t)}break;default:throw new Error("Unsupported response type")}return{data:e,headers:r.headers}}{const e=new Ps(r.statusText);throw e.status=r.status,e.response=r,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 r(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}t.loadJSON=async function(t,r,i){try{const{data:e}=await Os(t,"json");return r?r(e):e}catch(r){if(e._friendlyFileLoadError(5,t),i)return i(r);throw r}},t.loadStrings=async function(t,r,i){try{let{data:e}=await Os(t,"text");return e=e.split(/\r?\n/),r?r(e):e}catch(r){if(e._friendlyFileLoadError(3,t),i)return i(r);throw r}},t.loadTable=async function(t,r,i,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 r&&(r=","),"function"==typeof i&&(i=!1);try{let{data:n}=await Os(t,"text"),a=new e.Table;return n=function(e,t,r=e=>e){const i=Object.create(null);if(i.options=t||{},i.reviver=r,i.value="",i.entry=[],i.output=[],i.col=1,i.row=1,i.options.delimiter=void 0===i.options.delimiter?'"':t.delimiter,i.options.delimiter.length>1||0===i.options.delimiter.length)throw Error(`CSVError: delimiter must be one character [${i.options.separator}]`);if(i.options.separator=void 0===i.options.separator?",":t.separator,i.options.separator.length>1||0===i.options.separator.length)throw Error(`CSVError: separator must be one character [${i.options.separator}]`);const s=new RegExp(`${Ls(i.options.delimiter)}|${Ls(i.options.separator)}|\r\n|\n|\r|[^${Ls(i.options.delimiter)}${Ls(i.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===i.options.delimiter:h=3;break;case o===i.options.separator:h=0,Is(i);break;case n.test(o):h=0,Is(i),Bs(i);break;default:i.value+=o,h=2}break;case 2:switch(!0){case o===i.options.separator:h=0,Is(i);break;case n.test(o):h=0,Is(i),Bs(i);break;default:throw h=4,Error(`CSVError: Illegal state [row:${i.row}, col:${i.col}]`)}break;case 3:1==(o===i.options.delimiter)?h=4:(h=3,i.value+=o);break;case 4:switch(!0){case o===i.options.delimiter:h=3,i.value+=o;break;case o===i.options.separator:h=0,Is(i);break;case n.test(o):h=0,Is(i),Bs(i);break;default:throw Error(`CSVError: Illegal state [row:${i.row}, col:${i.col}]`)}}return 0!==i.entry.length&&(Is(i),Bs(i)),i.output}(n,{separator:r}),a.columns=i?n.shift():Array(n[0].length).fill(null),n.forEach((t=>{const r=new e.TableRow(t);a.addRow(r)})),s?s(a):a}catch(r){if(e._friendlyFileLoadError(2,t),n)return n(r);throw r}},t.loadXML=async function(t,r,i){try{const i=new DOMParser;let{data:s}=await Os(t,"text");const n=i.parseFromString(s,"application/xml");return s=new e.XML(n),r?r(s):s}catch(r){if(e._friendlyFileLoadError(1,t),i)return i(r);throw r}},t.loadBytes=async function(t,r,i){try{let{data:e}=await Os(t,"arrayBuffer");return e=new Uint8Array(e),r?r(e):e}catch(r){if(e._friendlyFileLoadError(6,t),i)return i(r);throw r}},t.loadBlob=async function(e,t,r){try{const{data:r}=await Os(e,"blob");return t?t(r):r}catch(e){if(r)return r(e);throw e}},t.httpGet=async function(e,t="text",r,i){return"function"==typeof t&&(i=r,r=t,t="text"),this.httpDo(e,"GET",t,r,i)},t.httpPost=async function(t,r,i="text",s,n){"function"==typeof r?(s=r,n=i,r=void 0,i="text"):"function"==typeof i&&(n=s,s=i,i="text");let a=r,o="text/plain";r instanceof e.XML?(a=r.serialize(),o="application/xml"):r instanceof e.Image?(a=await r.toBlob(),o="image/png"):"object"==typeof r&&(a=JSON.stringify(r),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",i,s,n)},t.httpDo=async function(e,t,r,i,s){if("function"==typeof r&&(s=i,i=r,r=void 0),!r){switch("string"==typeof e?e.split(".").pop():e.url.split(".").pop()){case"json":r="json";break;case"jpg":case"jpeg":case"png":case"webp":case"gif":r="blob";break;default:r="text"}}const n=new Request(e,{method:t});try{const{data:e}=await Os(n,r);return i?i(e):e}catch(e){if(s)return s(e);throw e}},t._pWriters=[],t.createWriter=function(r,i){let s;for(const n in t._pWriters)if(t._pWriters[n].name===r)return s=new e.PrintWriter(r+this.millis(),i),t._pWriters.push(s),s;return s=new e.PrintWriter(r,i),t._pWriters.push(s),s},e.PrintWriter=function(e,r){let i=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,r);for(const e in t._pWriters)t._pWriters[e].name===this.name&&t._pWriters.splice(e,1);i.clear(),i={}}},t.save=function(r,i,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($i(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,r){let i;i=r?JSON.stringify(e):JSON.stringify(e,void 0,2),this.saveStrings(i.split("\n"),t,"json")},t.saveStrings=function(t,r,i,s){const n=i||"txt",a=new e.PrintWriter(r,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,i){let s;void 0===i?(s=t.substring(t.lastIndexOf(".")+1,t.length),s===t&&(s="csv")):s=i;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=r(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 i=0;i<e.columns.length;i++){const s=r(e.rows[t].getString(i));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,r,i){let s="application/octet-stream";t._isSafari()&&(s="text/plain");const n=new Blob(e,{type:s});t.downloadFile(n,r,i)},t.downloadFile=ji,t._checkFileExtension=$i,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,r=new Uint8Array(e);return{get buffer(){return r.buffer},reset(){t=0},bytesView:()=>r.subarray(0,t),bytes:()=>r.slice(0,t),writeByte(e){i(t+1),r[t]=e,t++},writeBytes(e,s=0,n=e.length){i(t+n);for(let i=0;i<n;i++)r[t++]=e[i+s]},writeBytesView(e,s=0,n=e.byteLength){i(t+n),r.set(e.subarray(s,s+n),t),t+=n}};function i(e){var i=r.length;if(i>=e)return;e=Math.max(e,i*(i<1048576?2:1.125)>>>0),0!=i&&(e=Math.max(e,256));let s=r;r=new Uint8Array(e),t>0&&r.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,r,i,s=Vs(512),n=new Uint8Array(256),a=new Int32Array(5003),o=new Int32Array(5003)){let h=a.length,u=Math.max(2,i);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,_=r[0],w=0;for(let e=h;e<65536;e*=2)++w;w=8-w,s.writeByte(u),D(y);let C=r.length;for(let e=1;e<C;e++)e:{let t=r[e],i=(t<<12)+_,s=t<<w^_;if(a[s]===i){_=o[s];break e}let n=0===s?1:h-s;for(;a[s]>=0;)if(s-=n,s<0&&(s+=h),a[s]===i){_=o[s];break e}D(_),_=t,v<4096?(o[s]=v++,a[s]=i):(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,r){return e<<8&63488|t<<2&992|r>>3}function js(e,t,r,i){return e>>4|240&t|(240&r)<<4|(240&i)<<8}function $s(e,t,r){return e>>4<<8|240&t|r>>4}function Ws(e,t,r){return e<t?t:e>r?r:e}function qs(e){return e*e}function Hs(e,t,r){var i=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],r=t.cnt,n=a*r/(a+r);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,i=l)))}}n.err=s,n.nn=i}function Xs(e,t,r={}){let{format:i="rgb565",clearAlpha:s=!0,clearAlphaColor:n=0,clearAlphaThreshold:a=0,oneBitAlpha:o=!1}=r;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!==r.useSqrt,l="rgba4444"===i,c=function(e,t){let r=new Array("rgb444"===t?4096:65536),i=e.length;if("rgba4444"===t)for(let t=0;t<i;++t){let i=e[t],s=i>>24&255,n=i>>16&255,a=i>>8&255,o=255&i,h=js(o,a,n,s),u=h in r?r[h]:r[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<i;++t){let i=e[t],s=i>>16&255,n=i>>8&255,a=255&i,o=$s(a,n,s),h=o in r?r[o]:r[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<i;++t){let i=e[t],s=i>>16&255,n=i>>8&255,a=255&i,o=zs(a,n,s),h=o in r?r[o]:r[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 r}(h,i),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),r=Ws(Math.round(c[m].bc),0,255),i=255;if(l){if(i=Ws(Math.round(c[m].ac),0,255),o){i=i<=("number"==typeof o?o:127)?0:255}s&&i<=a&&(e=t=r=n,i=0)}let h=l?[e,t,r,i]:[e,t,r];if(Ys(F,h)||F.push(h),0==(m=c[m].fw))break}return F}function Ys(e,t){for(let r=0;r<e.length;r++){let i=e[r],s=i[0]===t[0]&&i[1]===t[1]&&i[2]===t[2],n=!(i.length>=4&&t.length>=4)||i[3]===t[3];if(s&&n)return!0}return!1}function Zs(e,t){var r,i=0;for(r=0;r<e.length;r++){let s=e[r]-t[r];i+=s*s}return i}function Ks(e,t,r=Zs){let i=1/0,s=-1;for(let n=0;n<e.length;n++){let a=r(t,e[n]);a<i&&(i=a,s=n)}return s}function Js(e={}){let{initialCapacity:t=4096,auto:r=!0}=e,i=Vs(t),s=new Uint8Array(256),n=new Int32Array(5003),a=new Int32Array(5003),o=!1;return{reset(){i.reset(),o=!1},finish(){i.writeByte(Rs)},bytes:()=>i.bytes(),bytesView:()=>i.bytesView(),get buffer(){return i.buffer},get stream(){return i},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(r?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,r,i,s=8){let n=1,a=0,o=rn(i.length)-1,h=n<<7|s-1<<4|a<<3|o,u=0,l=0;en(e,t),en(e,r),e.writeBytes([h,u,l])})(i,t,u,f,m),Qs(i,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)}(i,g)}let v=Math.round(d/10);!function(e,t,r,i,s){var n,a;e.writeByte(33),e.writeByte(249),e.writeByte(4),s<0&&(s=0,i=!1),i?(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,r),e.writeByte(s||0),e.writeByte(0)}(i,y,v,c,p);let b=Boolean(f)&&!x;(function(e,t,r,i){if(e.writeByte(44),en(e,0),en(e,0),en(e,t),en(e,r),i){let t=0,r=0,s=rn(i.length)-1;e.writeByte(128|t|r|s)}else e.writeByte(0)})(i,t,u,b?f:null),b&&Qs(i,f),function(e,t,r,i,s=8,n,a,o){Gs(r,i,t,s,e,n,a,o)}(i,e,t,u,m,s,n,a)}};function h(){tn(i,"GIF89a")}}function Qs(e,t){let r=1<<rn(t.length);for(let i=0;i<r;i++){let r=[0,0,0];i<t.length&&(r=t[i]),e.writeByte(r[0]),e.writeByte(r[1]),e.writeByte(r[2])}}function en(e,t){e.writeByte(255&t),e.writeByte(t>>8&255)}function tn(e,t){for(var r=0;r<t.length;r++)e.writeByte(t.charCodeAt(r))}function rn(e){return Math.max(Math.ceil(Math.log2(e)),1)}function sn(e,t){function r(e,t,r){const i=parseInt(r/2),s=4*t,n=new Uint8Array(4*t);for(let t=0;t<i;++t){const i=t*s,a=(r-t-1)*s;n.set(e.subarray(i,i+s)),e.copyWithin(i,a,a+s),e.set(n,a)}return e}function i(e,t,r,i,s,n,a,o,h,u,l){if(e===Me){const{x:e,y:i,w:s,h:c}=function(e,t,r,i,s,n,a,o){const h=Math.max(r/a,i/o),[u,l]=[r/h,i/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,r,n,a,o,h,u,l);o=e,h=i,u=s,l=c}if(e===Te){const{x:e,y:o,w:h,h:c}=function(e,t,r,i,s,n,a,o){const h=Math.max(a/s,o/n),[u,l]=[a/h,o/h];let c=r,p=i;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,r,i,s,n,a,u,l);i=e,s=o,n=h,a=c}return{sx:o,sy:h,sw:u,sh:l,dx:i,dy:s,dw:n,dh:a}}function s(e,t){return e>0&&e<t?e:t}t.loadImage=async function(t,r,i){try{let i=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,r){const i=new ws(t);r.width=r.canvas.width=i.width,r.height=r.canvas.height=i.height;const s=[],n=i.numFrames();let a=new Uint8ClampedArray(r.width*r.height*4);const o=(t,i)=>{try{i.decodeAndBlitFrameRGBA(t,a)}catch(t){throw e._friendlyFileLoadError(8,r.src),t}};for(let e=0;e<n;e++){const t=i.frameInfo(e),n=r.drawingContext.getImageData(0,0,r.width,r.height);a=n.data.slice(),o(e,i);const h=new ImageData(a,r.width,r.height);r.drawingContext.putImageData(h,0,0);let u=t.delay;0===u&&(u=10),s.push({image:r.drawingContext.getImageData(0,0,r.width,r.height),delay:10*u}),2===t.disposal?r.drawingContext.clearRect(t.x,t.y,t.width,t.height):3===t.disposal&&r.drawingContext.putImageData(n,0,0,t.x,t.y,t.width,t.height)}let h=i.loopCount();null===h?h=1:0===h&&(h=null);r.drawingContext.putImageData(s[0].image,0,0),s.length>1&&(r.gifProperties={displayIndex:0,loopLimit:h,loopCount:0,frames:s,numFrames:n,playing:!0,timeDisplayed:0,lastChangeTime:0});return r}(n,i);else{const e=new Blob([n]),t=await createImageBitmap(e);i.width=i.canvas.width=t.width,i.height=i.canvas.height=t.height,i.drawingContext.drawImage(t,0,0)}return i.modified=!0,r?r(i):i}catch(r){if(e._friendlyFileLoadError(0,t),"function"==typeof i)return i(r);throw r}},t.saveGif=async function(i,s,n={delay:0,units:"seconds",silent:!1,notificationDuration:0,notificationID:"progressBar"}){if("string"!=typeof i)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=r(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 r=0;r<e.length;r++)t.set(e[r],r*e[0].length);let r=Xs(t,256,{format:"rgba4444",oneBitAlpha:!0});256===r.length?r[r.length-1]=[255*Math.random(),255*Math.random(),255*Math.random(),0]:r.push([255*Math.random(),255*Math.random(),255*Math.random(),0]);return r}(_),D={},E=e=>{const t=e.length/4,r=new Uint8Array(t);for(let i=0;i<t;i++){const t=e[4*i]<<24|e[4*i+1]<<16|e[4*i+2]<<8|e[4*i+3];void 0===D[t]&&(D[t]=Ks(C,e.slice(4*i,4*(i+1)))),r[i]=D[t]}return r},A=C.length-1;let S=[];for(let e=0;e<_.length;e++){const t=E(_[e]),r=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=r,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,i,"gif")},t.image=function(e,t,r,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=r,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=i(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 r,i,s,n,a,o,h,u,l;if(9===e.length)r=e[0],i=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");r=this,i=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,r,i,s,n,a,o,h,u,l)},t._copyHelper=(e,t,r,i,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,r+c,i+p,s,n,a,o,h,u),e.pop()):e.drawingContext.drawImage(t.canvas,l*(r+c),l*(i+p),l*s,l*n,a,o,h,u)},t.getFilterGraphicsLayer=function(){return this._renderer.getFilterGraphicsLayer()},t.filter=function(...t){let{shader:r,operation:i,value:s,useWebGL:n}=function(...t){let r={shader:void 0,operation:void 0,value:void 0,useWebGL:!0};if(t[0]instanceof e.Shader)return r.shader=t[0],r;r.operation=t[0];t.length>1&&"number"==typeof t[1]&&(r.value=t[1]);!1===t[t.length-1]&&(r.useWebGL=!1);return r}(...t);this._renderer.isP3D&&r?this._renderer.filter(r):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(i,s):(r?this._renderer.filterRenderer.setOperation(i,s,r):this._renderer.filterRenderer.setOperation(i,s),this._renderer.filterRenderer.applyFilter())):void 0!==this.canvas?Ii.apply(this.canvas,Ii[i],s):Ii.apply(this.elt,Ii[i],s)},t.get=function(e,t,r,i){return this._renderer.get(...arguments)},t.loadPixels=function(...e){this._renderer.loadPixels()},t.set=function(e,t,r){this._renderer.set(e,t,r)},t.updatePixels=function(e,t,r,i){0!==this.pixels.length&&this._renderer.updatePixels(e,t,r,i)}}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 r=0;r<this.#m;r++)t.push(this.matrix[r*this.#m+e]);return new je(...t)}column(e){const t=[];for(let r=0;r<this.#m;r++)t.push(this.matrix[e*this.#m+r]);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 r=0;r<this.#m;r++)t.values[r]=this.row(r).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 r=this.matrix,i=r[0],s=r[4],n=r[8],a=r[12];r[0]=t[0]*i+t[1]*s+t[2]*n+t[3]*a,r[4]=t[4]*i+t[5]*s+t[6]*n+t[7]*a,r[8]=t[8]*i+t[9]*s+t[10]*n+t[11]*a,r[12]=t[12]*i+t[13]*s+t[14]*n+t[15]*a;const o=r[1],h=r[5],u=r[9],l=r[13];r[1]=t[0]*o+t[1]*h+t[2]*u+t[3]*l,r[5]=t[4]*o+t[5]*h+t[6]*u+t[7]*l,r[9]=t[8]*o+t[9]*h+t[10]*u+t[11]*l,r[13]=t[12]*o+t[13]*h+t[14]*u+t[15]*l;const c=r[2],p=r[6],d=r[10],f=r[14];r[2]=t[0]*c+t[1]*p+t[2]*d+t[3]*f,r[6]=t[4]*c+t[5]*p+t[6]*d+t[7]*f,r[10]=t[8]*c+t[9]*p+t[10]*d+t[11]*f,r[14]=t[12]*c+t[13]*p+t[14]*d+t[15]*f;const g=r[3],m=r[7],y=r[11],x=r[15];return r[3]=t[0]*g+t[1]*m+t[2]*y+t[3]*x,r[7]=t[4]*g+t[5]*m+t[6]*y+t[7]*x,r[11]=t[8]*g+t[9]*m+t[10]*y+t[11]*x,r[15]=t[12]*g+t[13]*m+t[14]*y+t[15]*x,this}scale(e,t,r){return e instanceof je?(t=e.y,r=e.z,e=e.x):e instanceof Array&&(t=e[1],r=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]*=r,this.matrix[9]*=r,this.matrix[10]*=r,this.matrix[11]*=r,this}rotate4x4(e,t,r,i){t instanceof je?(r=t.y,i=t.z,t=t.x):t instanceof Array&&(r=t[1],i=t[2],t=t[0]);const s=Math.sqrt(t*t+r*r+i*i);t*=1/s,r*=1/s,i*=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,_=r*t*v+i*y,w=i*t*v-r*y,C=t*r*v-i*y,D=r*r*v+x,E=i*r*v+t*y,A=t*i*v+r*y,S=r*i*v-t*y,F=i*i*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],r=e[1],i=e[2]||0;return this.matrix[12]+=this.matrix[0]*t+this.matrix[4]*r+this.matrix[8]*i,this.matrix[13]+=this.matrix[1]*t+this.matrix[5]*r+this.matrix[9]*i,this.matrix[14]+=this.matrix[2]*t+this.matrix[6]*r+this.matrix[10]*i,this.matrix[15]+=this.matrix[3]*t+this.matrix[7]*r+this.matrix[11]*i,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,r,i){const s=1/Math.tan(e/2),n=1/(r-i);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]=(i+r)*n,this.matrix[11]=-1,this.matrix[12]=0,this.matrix[13]=0,this.matrix[14]=2*i*r*n,this.matrix[15]=0,this}ortho(e,t,r,i,s,n){const a=1/(e-t),o=1/(r-i),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]=(i+r)*o,this.matrix[14]=(n+s)*h,this.matrix[15]=1,this}multiplyVec4(e,t,r,i){const s=new Array(4),n=this.matrix;return s[0]=n[0]*e+n[4]*t+n[8]*r+n[12]*i,s[1]=n[1]*e+n[5]*t+n[9]*r+n[13]*i,s[2]=n[2]*e+n[6]*t+n[10]*r+n[14]*i,s[3]=n[3]*e+n[7]*t+n[11]*r+n[15]*i,s}multiplyPoint({x:e,y:t,z:r}){const i=this.multiplyVec4(e,t,r,1);return new je(i[0],i[1],i[2])}multiplyAndNormalizePoint({x:e,y:t,z:r}){const i=this.multiplyVec4(e,t,r,1);return i[0]/=i[3],i[1]/=i[3],i[2]/=i[3],new je(i[0],i[1],i[2])}multiplyDirection({x:e,y:t,z:r}){const i=this.multiplyVec4(e,t,r,0);return new je(i[0],i[1],i[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 r=0;r<e;r++)t[r*e+r]=1;return t}#_(e){let t=this.matrix[0],r=this.matrix[1],i=this.matrix[2],s=this.matrix[3];return this.matrix[0]=t*e[0]+r*e[4]+i*e[8]+s*e[12],this.matrix[1]=t*e[1]+r*e[5]+i*e[9]+s*e[13],this.matrix[2]=t*e[2]+r*e[6]+i*e[10]+s*e[14],this.matrix[3]=t*e[3]+r*e[7]+i*e[11]+s*e[15],t=this.matrix[4],r=this.matrix[5],i=this.matrix[6],s=this.matrix[7],this.matrix[4]=t*e[0]+r*e[4]+i*e[8]+s*e[12],this.matrix[5]=t*e[1]+r*e[5]+i*e[9]+s*e[13],this.matrix[6]=t*e[2]+r*e[6]+i*e[10]+s*e[14],this.matrix[7]=t*e[3]+r*e[7]+i*e[11]+s*e[15],t=this.matrix[8],r=this.matrix[9],i=this.matrix[10],s=this.matrix[11],this.matrix[8]=t*e[0]+r*e[4]+i*e[8]+s*e[12],this.matrix[9]=t*e[1]+r*e[5]+i*e[9]+s*e[13],this.matrix[10]=t*e[2]+r*e[6]+i*e[10]+s*e[14],this.matrix[11]=t*e[3]+r*e[7]+i*e[11]+s*e[15],t=this.matrix[12],r=this.matrix[13],i=this.matrix[14],s=this.matrix[15],this.matrix[12]=t*e[0]+r*e[4]+i*e[8]+s*e[12],this.matrix[13]=t*e[1]+r*e[5]+i*e[9]+s*e[13],this.matrix[14]=t*e[2]+r*e[6]+i*e[10]+s*e[14],this.matrix[15]=t*e[3]+r*e[7]+i*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 r=0;r<this.#m;r++)for(let i=0;i<this.#m;i++)for(let s=0;s<this.#m;s++)t[r*this.#m+i]+=this.matrix[r*this.#m+s]*e[s*this.#m+i];return this.matrix=t,this}#w(e){let t=this.mat3[0],r=this.mat3[1],i=this.mat3[2];return this.mat3[0]=t*e[0]+r*e[3]+i*e[6],this.mat3[1]=t*e[1]+r*e[4]+i*e[7],this.mat3[2]=t*e[2]+r*e[5]+i*e[8],t=this.mat3[3],r=this.mat3[4],i=this.mat3[5],this.mat3[3]=t*e[0]+r*e[3]+i*e[6],this.mat3[4]=t*e[1]+r*e[4]+i*e[7],this.mat3[5]=t*e[2]+r*e[5]+i*e[8],t=this.mat3[6],r=this.mat3[7],i=this.mat3[8],this.mat3[6]=t*e[0]+r*e[3]+i*e[6],this.mat3[7]=t*e[1]+r*e[4]+i*e[7],this.mat3[8]=t*e[2]+r*e[5]+i*e[8],this}#b(){const e=this.#m;for(let t=0;t<e;t++)for(let r=0;r<e;r++)this.matrix[t*e+r]=this.matrix[r*e+t];return this}#x(e){let t,r,i,s,n,a;return console.log("====> 4x4"),e instanceof ln?(t=e.matrix[1],r=e.matrix[2],i=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]=r,this.matrix[9]=s,this.matrix[10]=e.matrix[10],this.matrix[11]=e.matrix[14],this.matrix[12]=i,this.matrix[13]=n,this.matrix[14]=a,this.matrix[15]=e.matrix[15]):un(e)&&(t=e[1],r=e[2],i=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]=r,this.matrix[9]=s,this.matrix[10]=e[10],this.matrix[11]=e[14],this.matrix[12]=i,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],r=e[2],i=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]=r,this.mat3[7]=i,this.mat3[8]=e[8],this}#D(e){let t,r,i,s,n,a,o,h,u,l,c,p,d,f,g,m;e instanceof ln?(t=e.matrix[0],r=e.matrix[1],i=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],r=e[1],i=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-r*n,x=t*o-i*n,v=t*h-s*n,b=r*o-i*a,_=r*h-s*a,w=i*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]=(i*S-r*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-i*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]=(r*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-r*D+i*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],r=this.mat3[2],i=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*i+n*a,c=o*i-s*a;let p=e*u+t*l+r*c;return p?(p=1/p,this.mat3[0]=u*p,this.mat3[1]=(-h*t+r*o)*p,this.mat3[2]=(n*t-r*s)*p,this.mat3[3]=l*p,this.mat3[4]=(h*e-r*a)*p,this.mat3[5]=(-n*e+r*i)*p,this.mat3[6]=c*p,this.mat3[7]=(-o*e+t*a)*p,this.mat3[8]=(s*e-t*i)*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],r=this.matrix[0]*this.matrix[7]-this.matrix[3]*this.matrix[4],i=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+r*u+i*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,r,i){this.renderer=i,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++,r instanceof Function&&r.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 r=0;r<this.vertices.length;r++){let i=this.vertices[r];e.x=Math.min(e.x,i.x),e.y=Math.min(e.y,i.y),e.z=Math.min(e.z,i.z),t.x=Math.max(t.x,i.x),t.y=Math.max(t.y,i.y),t.z=Math.max(t.z,i.z)}let r=new je(t.x-e.x,t.y-e.y,t.z-e.z),i=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:r,offset:i},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 r="f";e.forEach((e=>{r+=" ",r+=e+1,(this.vertexNormals.length>0||this.uvs.length>0)&&(r+="/",this.uvs.length>0&&(r+=e+1),r+="/",this.vertexNormals.length>0&&(r+=e+1))})),t+=r+"\n"}));const r=new Blob([t],{type:"text/plain"});fn.downloadFile(r,e,"obj")}saveStl(e="model.stl",{binary:t=!1}={}){let r,i=e.substring(0,e.lastIndexOf(".")),s=[];for(let e of this.faces){const t=je.sub(this.vertices[e[1]],this.vertices[e[0]]),r=je.sub(this.vertices[e[2]],this.vertices[e[0]]),i=t.y*r.z-t.z*r.y,n=t.z*r.x-t.x*r.z,a=t.x*r.y-t.y*r.x;s.push(new je(i,n,a).normalize())}if(t){let e=80;const t=2*this.faces.length+3*this.faces.length*4*4+80+4,i=new ArrayBuffer(t);r=new DataView(i),r.setUint32(e,this.faces.length,!0),e+=4;for(const[t,i]of Object.entries(this.faces)){const n=s[t];r.setFloat32(e,n.x,!0),e+=4,r.setFloat32(e,n.y,!0),e+=4,r.setFloat32(e,n.z,!0),e+=4;for(let t of i){const i=this.vertices[t];r.setFloat32(e,i.x,!0),e+=4,r.setFloat32(e,i.y,!0),e+=4,r.setFloat32(e,i.z,!0),e+=4}r.setUint16(e,0,!0),e+=2}}else{r="solid "+i+"\n";for(const[e,t]of Object.entries(this.faces)){const i=s[e];r+=" facet norm "+i.x+" "+i.y+" "+i.z+"\n",r+=" outer loop\n";for(let e of t){const t=this.vertices[e];r+=" vertex "+t.x+" "+t.y+" "+t.z+"\n"}r+=" endloop\n",r+=" endfacet\n"}r+="endsolid "+i+"\n"}const n=new Blob([r],{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,r,i,s;for(let n=0;n<this.detailY;n++)for(let a=0;a<this.detailX;a++)t=n*e+a,r=n*e+a+1,i=(n+1)*e+a+1,s=(n+1)*e+a,this.faces.push([t,r,s]),this.faces.push([s,r,i]);return this}_getFaceNormal(e){const t=this.faces[e],r=this.vertices[t[0]],i=this.vertices[t[1]],s=this.vertices[t[2]],n=je.sub(i,r),a=je.sub(s,r),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 r=this.vertexNormals;let i=this.vertices;const s=this.faces;let n;if(e===De){const e={},r=[],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<i.length;t++){const s=i[t],n=o(s);void 0===e[n]&&(e[n]=r.length,r.push(s))}s.forEach((t=>{for(let r=0;r<3;++r){const s=t[r],n=i[s],a=o(n);t[r]=e[a]}})),this.edges.forEach((t=>{for(let r=0;r<2;++r){const s=t[r],n=i[s],a=o(n);t[r]=e[a]}})),this.vertices=i=r}for(r.length=0,n=0;n<i.length;++n)r.push(new je);for(s.forEach(((e,t)=>{const i=this._getFaceNormal(t);for(let t=0;t<3;++t){const s=e[t];r[s].add(i)}})),n=0;n<i.length;++n)r[n].normalize();return this}averageNormals(){for(let e=0;e<=this.detailY;e++){const t=this.detailX+1;let r=je.add(this.vertexNormals[e*t],this.vertexNormals[e*t+this.detailX]);r=je.div(r,2),this.vertexNormals[e*t]=r,this.vertexNormals[e*t+this.detailX]=r}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 r;for(let i=0;i<this.edges.length;i++){const s=this.edges[i-1],n=this.edges[i],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(i>0&&s[1]===n[0])t.has(n[0])||(t.add(n[0]),e.delete(n[0]),r&&p&&c.dot(r)<1-1e-8&&this._addJoin(a,r,c,u));else{if(p&&!t.has(n[0])){const r=e.get(n[0]);r?(this._addJoin(a,r.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(r&&!t.has(s[1])){const i=e.get(s[1]);i?(this._addJoin(this.vertices[s[1]],r,i.dir.copy().mult(-1),h),e.delete(s[1]),t.add(s[1])):e.set(s[1],{point:this.vertices[s[1]],dir:r,color:h}),r=void 0}}if(i===this.edges.length-1&&!t.has(n[1])){const r=e.get(n[1]);r?(this._addJoin(o,c,r.dir.copy().mult(-1),l),e.delete(n[1]),t.add(n[1])):e.set(n[1],{point:o,dir:c,color:l})}p&&(r=c)}}for(const{point:t,dir:r,color:i}of e.values())this._addCap(t,r,i);return this}_addSegment(e,t,r,i,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(...r,...i,...r,...i,...i,...r),this}_addCap(e,t,r){const i=e.array(),s=t.array(),n=[0,0,0];for(let e=0;e<6;e++)this.lineVertices.push(...i),this.lineTangentsIn.push(...s),this.lineTangentsOut.push(...n),this.lineVertexColors.push(...r);return this.lineSides.push(-1,2,-2,1,2,-1),this}_addJoin(e,t,r,i){const s=e.array(),n=t.array(),a=r.array();for(let e=0;e<12;e++)this.lineVertices.push(...s),this.lineTangentsIn.push(...n),this.lineTangentsOut.push(...a),this.lineVertexColors.push(...i);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 r=0;r<this.vertices.length;r++)e.x=Math.max(e.x,this.vertices[r].x),t.x=Math.min(t.x,this.vertices[r].x),e.y=Math.max(e.y,this.vertices[r].y),t.y=Math.min(t.y,this.vertices[r].y),e.z=Math.max(e.z,this.vertices[r].z),t.z=Math.min(t.z,this.vertices[r].z);const r=je.lerp(e,t,.5),i=je.sub(e,t),s=200/Math.max(Math.max(i.x,i.y),i.z);for(let e=0;e<this.vertices.length;e++)this.vertices[e].sub(r),this.vertices[e].mult(s)}return this}vertexProperty(e,t,r){let i;this.userVertexProperties[e]||(i=this.userVertexProperties[e]=this._userVertexPropertyHelper(e,t,r)),i=this.userVertexProperties[e],r?i.pushDirect(t):(i.setCurrentData(t),i.pushCurrentData())}_userVertexPropertyHelper(e,t,r){const i=this.userVertexProperties[e]={name:e,dataSize:r||(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[i.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 r=e.userVertexProperties,i=this.geometry.userVertexProperties,s=this.geometry.vertices.length-e.vertices.length;for(const t in i){if(t in r)continue;const s=i[t],n=s.getDataSize()*e.vertices.length,a=Array(n).fill(0);s.pushDirect(a)}for(const e in r){const t=r[e],n=t.getSrcArray(),a=t.getDataSize();if(s>0&&!(e in i)){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 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 for(let t=0;t<e.vertices.length;t+=3)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}}yn.nextGeometryId=0;class xn{constructor(e,t,r,i){this.w=e,this.vec=new je(t,r,i)}static fromAxisAngle(e,t,r,i){const s=Math.cos(e/2),n=new je(t,r,i).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,r,i){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===r&&(r=this.defaultCameraNear),void 0===i&&(i=this.defaultCameraFar),r<=1e-4&&(r=.01,console.log("Avoid perspective near plane values close to or below 0. Setting value to 0.01.")),i<r&&console.log("Perspective far plane value is less than near plane value. Nothing will be shown."),this.aspectRatio=t,this.cameraNear=r,this.cameraFar=i,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,(i+r)*n,-1,0,0,2*i*r*n,0),this._isActive()&&(this._renderer.states.setValue("uPMatrix",this._renderer.states.uPMatrix.clone()),this._renderer.states.uPMatrix.set(this.projMatrix))}ortho(e,t,r,i,s,n){const a=this.fbo||this._renderer;void 0===e&&(e=-a.width/2),void 0===t&&(t=+a.width/2),void 0===r&&(r=-a.height/2),void 0===i&&(i=+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=i-r,u=n-s,l=2/o,c=2/h*this.yScale,p=-2/u,d=-(t+e)/o,f=-(i+r)/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,r,i,s,n){void 0===e&&(e=.05*-this._renderer.width),void 0===t&&(t=.05*+this._renderer.width),void 0===r&&(r=.05*+this._renderer.height),void 0===i&&(i=.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=i-r,h=n-s,u=2*s/a,l=2*s/o*this.yScale,c=-2*n*s/h,p=(t+e)/a,d=(i+r)/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,r,i){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,r,i);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(),r=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,r.x,r.y,r.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,r){this.camera(this.eyeX,this.eyeY,this.eyeZ,e,t,r,this.upX,this.upY,this.upZ)}camera(e,t,r,i,s,n,a,o,h){void 0===e&&(e=this.defaultEyeX,t=this.defaultEyeY,r=this.defaultEyeZ,i=e,s=t,n=0,a=0,o=1,h=0),this.eyeX=e,this.eyeY=t,this.eyeZ=r,void 0!==i&&(this.centerX=i,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=-r;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,r){const i=this._getLocalAxes(),s=[i.x[0]*e,i.x[1]*e,i.x[2]*e],n=[i.y[0]*t,i.y[1]*t,i.y[2]*t],a=[i.z[0]*r,i.z[1]*r,i.z[2]*r];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,r){const i=e-this.eyeX,s=t-this.eyeY,n=r-this.eyeZ;this.camera(e,t,r,this.centerX+i,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 r of t)this[r]=e[r];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,r){if(0===r)return void this.set(e);if(1===r)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],r)),this.projMatrix.setElement(5,e.projMatrix.mat4[5]*Math.pow(t.projMatrix.mat4[5]/e.projMatrix.mat4[5],r)),this._isActive()&&(this._renderer.states.setValue("uPMatrix",this._renderer.states.uPMatrix.clone()),this._renderer.states.uPMatrix.mat4=this.projMatrix.mat4.slice()));const i=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(i,n),h=je.dist(s,a),u=o*Math.pow(h/o,r),l=je.sub(i,s),c=i.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(i,n,d),je.lerp(s,a,d),r),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,r)).normalize(),C.set(_).mult(d*u).add(f),D.set(_).mult((d-1)*u).add(f),w.set(je.lerp(v,b,r)).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=r*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,r=this.eyeZ-this.centerZ;const i=Math.sqrt(e*e+t*t+r*r);0!==i&&(e/=i,t/=i,r/=i);let s=this.upX,n=this.upY,a=this.upZ,o=n*r-a*t,h=-s*r+a*e,u=s*t-n*e;s=t*u-r*h,n=-e*u+r*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,r]}}_orbit(e,t,r){const i=this.eyeX-this.centerX,s=this.eyeY-this.centerY,n=this.eyeZ-this.centerZ;let a=Math.hypot(i,s,n);const o=new je(i,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,r),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,r){const i=this.eyeX-this.centerX,s=this.eyeY-this.centerY,n=this.eyeZ-this.centerZ;let a=Math.hypot(i,s,n);const o=new je(i,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,r),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,r,i,s,n){this.size=e,this.src=t,this.dst=r,this.attr=i,this._renderer=s,this.map=n}_prepareBuffer(e,t){const r=t.attributes,i=this._renderer.GL,s=this._renderer._getOrMakeCachedBuffers(e),n=r[this.attr];if(!n)return;let a=s[this.dst];const o=e[this.src];if(o&&o.length>0){const r=!a;if(r&&(s[this.dst]=a=i.createBuffer()),i.bindBuffer(i.ARRAY_BUFFER,a),r||!1!==e.dirtyFlags[this.src]){const t=this.map,r=t?t(o):o;this._renderer._bindBuffer(a,i.ARRAY_BUFFER,r),e.dirtyFlags[this.src]=!1}t.enableAttrib(n,this.size)}else{const e=n.location;if(-1===e||!this._renderer.registerEnabled.has(e))return;i.disableVertexAttribArray(e),this._renderer.registerEnabled.delete(e)}}}function Cn(e,t){e.RenderBuffer=wn}void 0!==p5&&Cn(p5);class Dn{constructor(e,t,r,i={}){this._renderer=e,this._vertSrc=t,this._fragSrc=r,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:i.uniforms||{},declarations:i.declarations,helpers:i.helpers||{},vertex:i.vertex||{},fragment:i.fragment||{},modified:{vertex:i.modified&&i.modified.vertex||{},fragment:i.modified&&i.modified.fragment||{}}}}hookTypes(e){let t=this._vertSrc,r=this.hooks.vertex[e];if(r||(r=this.hooks.fragment[e],t=this._fragSrc),!r)throw new Error(`Can't find hook ${e}!`);const i=e.split(/\s+/g),s=i.pop(),n=i.pop(),a=[...i],o=/\(([^\)]*)\)/.exec(r);if(!o)throw new Error(`Couldn't find function parameters in hook body:\n${r}`);const h=e=>{const r=new RegExp(`struct\\s+${e}\\s*{([^}]*)}`).exec(t);if(!r)return;const i=[];for(const e of r[1].split(";")){const t=e.trim().split(/\s+|,/g),r=t.shift(),s=[...t],n=h(r);for(const e of s)i.push({name:e,type:{typeName:r,qualifiers:[],properties:n}})}return i},u=o[1].split(",").map((e=>{const t=e.trim().split(/\s+/g),r=t.pop(),i=t.pop();return{name:r,type:{typeName:i,qualifiers:[...t],properties:h(i)}}}));return{name:s,returnType:{typeName:n,qualifiers:a,properties:h(n)},parameters:u}}shaderSrc(e,t){const r="void main";let[i,s]=e.split(r),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[r,i]=e.split(" ");this.hooks.modified[t][e]&&(a+="#define AUGMENTED_HOOK_"+i+"\n"),n+=r+" HOOK_"+i+this.hooks[t][e]+"\n"}return-1!==i.indexOf("#define HOOK_DEFINES")&&(i=i.replace("#define HOOK_DEFINES","\n"+a+"\n"),a=""),i+"\n"+a+n+r+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 r in e)"declarations"!==r&&"uniforms"!==r&&("vertexDeclarations"===r?t.vertex.declarations=(t.vertex.declarations||"")+"\n"+e[r]:"fragmentDeclarations"===r?t.fragment.declarations=(t.fragment.declarations||"")+"\n"+e[r]:this.hooks.vertex[r]?t.vertex[r]=e[r]:this.hooks.fragment[r]?t.fragment[r]=e[r]:t.helpers[r]=e[r]);const r=Object.assign({},this.hooks.modified.vertex),i=Object.assign({},this.hooks.modified.fragment);for(const e in t.vertex||{})"declarations"!==e&&(r[e]=!0);for(const e in t.fragment||{})"declarations"!==e&&(i[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:r,fragment:i}})}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(" "),r=this.hooks.uniforms[e];let i;i=r instanceof Function?r():r,null!=i&&this.setUniform(t,i)}}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 r=0;r<t;++r){const t=e.getActiveAttrib(this._glProgram,r),i=t.name,s=e.getAttribLocation(this._glProgram,i),n={};n.name=i,n.location=s,n.index=r,n.type=t.type,n.size=t.size,this.attributes[i]=n}this._loadedAttributes=!0}_loadUniforms(){if(this._loadedUniforms)return;const e=this._renderer.GL,t=e.getProgramParameter(this._glProgram,e.ACTIVE_UNIFORMS);let r=0;for(let i=0;i<t;++i){const t=e.getActiveUniform(this._glProgram,i),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=r,r++,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 r of this.samplers){let i=r.texture;void 0===i&&(r.texture=i=t),e.activeTexture(e.TEXTURE0+r.samplerIndex),i.bindTexture(),i.update(),e.uniform1i(r.location,r.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 r of this.samplers)r.texture?.isFramebufferTexture&&(e.activeTexture(e.TEXTURE0+r.samplerIndex),t.bindTexture(),e.uniform1i(r.location,r.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 r=this.uniforms[e];if(!r)return;const i=this._renderer.GL;if(r.isArray){if(r._cachedData&&this._renderer._arraysEqual(r._cachedData,t))return;r._cachedData=t.slice(0)}else{if(r._cachedData&&r._cachedData===t)return;Array.isArray(t)?r._cachedData=t.slice(0):r._cachedData=t}const s=r.location;switch(this.useProgram(),r.type){case i.BOOL:!0===t?i.uniform1i(s,1):i.uniform1i(s,0);break;case i.INT:r.size>1?t.length&&i.uniform1iv(s,t):i.uniform1i(s,t);break;case i.FLOAT:r.size>1?t.length&&i.uniform1fv(s,t):i.uniform1f(s,t);break;case i.FLOAT_MAT3:i.uniformMatrix3fv(s,!1,t);break;case i.FLOAT_MAT4:i.uniformMatrix4fv(s,!1,t);break;case i.FLOAT_VEC2:r.size>1?t.length&&i.uniform2fv(s,t):i.uniform2f(s,t[0],t[1]);break;case i.FLOAT_VEC3:r.size>1?t.length&&i.uniform3fv(s,t):i.uniform3f(s,t[0],t[1],t[2]);break;case i.FLOAT_VEC4:r.size>1?t.length&&i.uniform4fv(s,t):i.uniform4f(s,t[0],t[1],t[2],t[3]);break;case i.INT_VEC2:r.size>1?t.length&&i.uniform2iv(s,t):i.uniform2i(s,t[0],t[1]);break;case i.INT_VEC3:r.size>1?t.length&&i.uniform3iv(s,t):i.uniform3i(s,t[0],t[1],t[2]);break;case i.INT_VEC4:r.size>1?t.length&&i.uniform4iv(s,t):i.uniform4i(s,t[0],t[1],t[2],t[3]);break;case i.SAMPLER_2D:if("number"==typeof t){if(t<i.TEXTURE0||t>i.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;i.activeTexture(t),i.uniform1i(s,t)}else i.activeTexture(i.TEXTURE0+r.samplerIndex),r.texture=t instanceof ua?t:this._renderer.getTexture(t),i.uniform1i(s,r.samplerIndex),r.texture.src.gifProperties&&r.texture.src._animateGif(this._renderer._pInst);break;case i.SAMPLER_CUBE:case i.SAMPLER_3D:case i.SAMPLER_2D_SHADOW:case i.SAMPLER_2D_ARRAY:case i.SAMPLER_2D_ARRAY_SHADOW:case i.SAMPLER_CUBE_SHADOW:case i.INT_SAMPLER_2D:case i.INT_SAMPLER_3D:case i.INT_SAMPLER_CUBE:case i.INT_SAMPLER_2D_ARRAY:case i.UNSIGNED_INT_SAMPLER_2D:case i.UNSIGNED_INT_SAMPLER_3D:case i.UNSIGNED_INT_SAMPLER_CUBE:case i.UNSIGNED_INT_SAMPLER_2D_ARRAY:if("number"!=typeof t)break;if(t<i.TEXTURE0||t>i.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}i.activeTexture(t),i.uniform1i(s,t)}return this}enableAttrib(e,t,r,i,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,r||e.FLOAT,i||!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 r(e,t){return e.b===t.b&&e.a===t.a}function i(e,t){return e.b<t.b||e.b===t.b&&e.a<=t.a}function s(e,t,r){var i=t.b-e.b,s=r.b-t.b;return 0<i+s?i<s?t.a-e.a+i/(i+s)*(e.a-r.a):t.a-r.a+s/(i+s)*(r.a-e.a):0}function n(e,t,r){var i=t.b-e.b,s=r.b-t.b;return 0<i+s?(t.a-r.a)*i+(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,r){var i=t.a-e.a,s=r.a-t.a;return 0<i+s?i<s?t.b-e.b+i/(i+s)*(e.b-r.b):t.b-r.b+s/(i+s)*(r.b-e.b):0}function h(e,t,r){var i=t.a-e.a,s=r.a-t.a;return 0<i+s?(t.b-r.b)*i+(t.b-e.b)*s:0}function u(e){return i(e.b.a,e.a)}function l(e){return i(e.a,e.b.a)}function c(e,t,r,i){return(e=0>e?0:e)<=(r=0>r?0:r)?0===r?(t+i)/2:t+e/(e+r)*(i-t):i+r/(e+r)*(t-i)}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 r=!1,i=!1;e!==t&&(t.a!==e.a&&(i=!0,w(t.a,e.a)),t.d!==e.d&&(r=!0,C(t.d,e.d)),x(t,e),i||(v(t,e.a),e.a.c=e),r||(b(t,e.d),e.d.a=e))}function f(e){var t=e.b,r=!1;e.d!==e.b.d&&(r=!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)),r||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),r=t.b;return x(t,e.e),t.a=e.b.a,v(r,t.a),t.d=r.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 r=!1,i=y(e),s=i.b;return t.d!==e.d&&(r=!0,C(t.d,e.d)),x(i,e.e),x(s,t),i.a=e.b.a,s.a=t.a,i.d=s.d=e.d,e.d.a=s,r||b(i,e.d),i}function y(e){var t=new J,r=new J,i=e.b.h;return r.h=i,i.b.h=t,t.h=e,e.b.h=r,t.b=r,t.c=t,t.e=r,r.b=t,r.c=r,r.e=t}function x(e,t){var r=e.c,i=t.c;r.b.e=t,i.b.e=e,e.c=i,t.c=r}function v(e,t){var r=t.f,i=new te(t,r);r.e=i,t.f=i,r=i.c=e;do{r.a=i,r=r.c}while(r!==e)}function b(e,t){var r=t.d,i=new K(t,r);r.b=i,t.d=i,i.a=e,i.c=t.c,r=e;do{r.d=i,r=r.e}while(r!==e)}function _(e){var t=e.h;e=e.b.h,t.b.h=e,e.b.h=t}function w(e,t){var r=e.c,i=r;do{i.a=t,i=i.c}while(i!==r);r=e.f,(i=e.e).f=r,r.e=i}function C(e,t){var r=e.a,i=r;do{i.d=t,i=i.e}while(i!==r);r=e.d,(i=e.b).d=r,r.b=i}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,r){return e=e.a,t=t.a,r=r.a,t.b.a===e?r.b.a===e?i(t.a,r.a)?0>=n(r.b.a,t.a,r.a):0<=n(t.b.a,r.a,t.a):0>=n(r.b.a,e,r.a):r.b.a===e?0<=n(t.b.a,e,t.a):(t=s(t.b.a,e,t.a))>=(e=s(r.b.a,e,r.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,r){var i=new ce;return i.a=r,i.e=W(e.f,t.e,i),r.i=i}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,r=t.d;r.c=e.d,r.a=t,F(e)}function L(e,t,r){for(e=t,t=t.a;e!==r;){e.c=!1;var i=pe(e),s=i.a;if(s.a!==t.a){if(!i.c){B(e);break}T(i,s=m(t.c.b,s.b))}t.c!==s&&(d(Q(s),s),d(t,s)),B(e),t=i.a,e=i}return t}function P(e,t,r,i,s,n){var a=!0;do{k(e,t,r.b),r=r.c}while(r!==i);for(null===s&&(s=pe(t).a.b.c);(r=(i=pe(t)).a.b).a===s.a;)r.c!==s&&(d(Q(r),r),d(Q(s),r)),i.f=t.f-r.f,i.d=I(e,i.f),t.b=!0,!a&&V(e,t)&&(A(r,s),F(t),f(s)),a=!1,t=i,s=r;t.b=!0,n&&G(e,t)}function O(e,t,r,i,s){var n=[t.g[0],t.g[1],t.g[2]];t.d=null,t.d=e.o&&e.o(n,r,i,e.c)||null,null===t.d&&(s?e.n||(Z(e,100156),e.n=!0):t.d=r[0])}function N(e,t,r){var i=[null,null,null,null];i[0]=t.a.d,i[1]=r.a.d,O(e,t.a,i,[.5,.5,0,0],!1),d(t,r)}function R(e,t,r,i,s){var n=Math.abs(t.b-e.b)+Math.abs(t.a-e.a),a=Math.abs(r.b-e.b)+Math.abs(r.a-e.a),o=s+1;i[s]=.5*a/(n+a),i[o]=.5*n/(n+a),e.g[0]+=i[s]*t.g[0]+i[o]*r.g[0],e.g[1]+=i[s]*t.g[1]+i[o]*r.g[1],e.g[2]+=i[s]*t.g[2]+i[o]*r.g[2]}function V(e,t){var s=pe(t),a=t.a,o=s.a;if(i(a.a,o.a)){if(0<n(o.b.a,a.a,o.a))return!1;if(r(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||i(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(i(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(i(w,C)||(b=w,w=C,C=b),i(D,E)||(b=D,D=E,E=b),i(w,D)||(b=w,w=D,D=b,b=C,C=E,E=b),i(D,C)?i(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,i(v,e.a)&&(v.b=e.a.b,v.a=e.a.a),w=i(f,m)?f:m,i(w,v)&&(v.b=w.b,v.a=w.a),r(v,f)||r(v,m))return V(e,t),!1;if(!r(y,e.a)&&0<=n(y,e.a,v)||!r(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=ie(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 r=pe(t);;){for(;r.b;)t=r,r=pe(r);if(!t.b&&(r=t,null===(t=de(t))||!t.b))break;t.b=!1;var s,a=t.a,o=r.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(i(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&&(r.c?(F(r),f(o),o=(r=pe(t)).a):t.c&&(F(t),f(a),a=(t=de(r)).a)),a.a!==o.a)if(a.b.a===o.b.a||t.c||r.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(r))}}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))r((u=c.a).a,a)||r(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=i(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),r(h.a,e.a)&&(d(Q(u),h),u=pe(s=M(s)).a,L(e,pe(s),o),p=!0),r(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=i(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 r=new ce,i=p(e.b);i.a.b=E,i.a.a=t,i.b.a.b=-4e150,i.b.a.a=t,e.a=i.b.a,r.a=i,r.f=0,r.d=!1,r.c=!1,r.h=!0,r.b=!1,i=W(i=e.f,i.a,r),r.e=i}function $(e){this.a=new q,this.b=e,this.c=S}function W(e,t,r){do{t=t.c}while(null!==t.b&&!e.c(e.b,t.b,r));return e=new q(r,t.a,t),t.a.c=e,t.a=e}function q(e,t,r){this.b=e||null,this.a=t||this,this.c=r||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 re(){this.c=[],this.d=null,this.a=0,this.e=!1,this.b=new ne}function ie(e,t){if(e.e){var r,i=e.b,s=++i.a;return 2*s>i.f&&(i.f*=2,i.c=ae(i.c,i.f+1)),0===i.b?r=s:(r=i.b,i.b=i.c[i.b]),i.e[r]=t,i.c[r]=s,i.d[s]=r,i.h&&le(i,s),r}return i=e.a++,e.c[i]=t,-(i+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&&i(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 r=Array(t),i=0;i<e.length;i++)r[i]=e[i];for(;i<t;i++)r[i]=0;return r}function oe(e){return e.e[e.d[1]]}function he(e){var t=e.d,r=e.e,i=e.c,s=t[1],n=r[s];return 0<e.a&&(t[1]=t[e.a],i[t[1]]=1,r[s]=null,i[s]=e.b,e.b=s,0<--e.a&&ue(e,1)),n}function ue(e,t){for(var r=e.d,s=e.e,n=e.c,a=t,o=r[a];;){var h=a<<1;h<e.a&&i(s[r[h+1]],s[r[h]])&&(h+=1);var u=r[h];if(h>e.a||i(s[o],s[u])){r[a]=o,n[o]=a;break}r[a]=u,n[u]=a,a=h}}function le(e,t){for(var r=e.d,s=e.e,n=e.c,a=t,o=r[a];;){var h=a>>1,u=r[h];if(0===h||i(s[u],s[o])){r[a]=o,n[o]=a;break}r[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,r){this.j[0]=e,this.j[1]=t,this.j[2]=r},t.z=function(e,t){var r=t||null;switch(e){case 100100:case 100106:this.h=r;break;case 100104:case 100110:this.l=r;break;case 100101:case 100107:this.k=r;break;case 100102:case 100108:this.i=r;break;case 100103:case 100109:this.p=r;break;case 100105:case 100111:this.o=r;break;case 100112:this.r=r;break;default:Z(this,100900)}},t.C=function(e,t){var r=!1,i=[0,0,0];Y(this,2);for(var s=0;3>s;++s){var n=e[s];-1e150>n&&(n=-1e150,r=!0),1e150<n&&(n=1e150,r=!0),i[s]=n}r&&Z(this,100155),null===(r=this.q)?d(r=p(this.b),r.b):(g(r),r=r.e),r.a.d=t,r.a.g[0]=i[0],r.a.g[1]=i[1],r.a.g[2]=i[2],r.f=1,r.b.f=-1,this.q=r},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,r(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 re,c=(e=this.b.c).e;c!==e;c=c.e)c.h=ie(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,r){return i(e[t],e[r])?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),i(c,e))){e=c;break e}if(null===e||!r(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;i(c.b.a,c.a);c=c.c.b);for(;i(c.a,c.b.a);c=c.e);for(s=c.c.b,o=void 0;c.e!==s;)if(i(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},Ni.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=Ni.libtess}(An);var Sn=Ri(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 r=!!this.renderer.states.strokeColor,i={};if(e.userVertexProperties){this._useUserVertexProperties=!0;for(const t in e.userVertexProperties){const r=e.vertexPropertyName(t),s=this.geometry._userVertexPropertyHelper(r,[],e.userVertexProperties[t]);i[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(),r,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],r=this.geometry[e];r.push(...r.slice(r.length-3*t,r.length-2*t),...r.slice(r.length-t,r.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 i){const r=i[e];e in t&&r.setCurrentData(t[e]),r.pushCurrentData()}}}r&&(this.geometry.edges=this._calculateEdges(this.shapeMode,this.geometry.vertices)),r&&!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 r=e[t];delete this.bufferStrides[t],r.delete()}this._useUserVertexProperties=!1,this.tessyVertexSize=Tn,this.geometry.userVertexProperties={}}_calculateEdges(e,t){const r=[];let i=0;const s=this.contourIndices.slice();let n=-1;switch(e){case 5:for(i=0;i<t.length-2;i++)r.push([i,i+1]),r.push([i,i+2]);r.push([i,i+1]);break;case 6:for(i=1;i<t.length-1;i++)r.push([0,i]),r.push([i,i+1]);r.push([0,t.length-1]);break;case 4:for(i=0;i<t.length-2;i+=3)r.push([i,i+1]),r.push([i+1,i+2]),r.push([i+2,i]);break;case M:for(i=0;i<t.length-1;i+=2)r.push([i,i+1]);break;case k:for(i=0;i<t.length-5;i+=6)r.push([i,i+1]),r.push([i+1,i+2]),r.push([i+2,i+5]),r.push([i+5,i]);break;case I:for(i=0;i<t.length-2;i+=2)r.push([i,i+1]),r.push([i+1,i+3]),r.push([i,i+2]);r.push([i,i+1]);break;default:for(i=0;i<t.length;i++)i===s[0]?n=s.shift():t[n]&&t[i].equals(t[n])?r.push([i-1,n]):r.push([i-1,i])}return r}_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 r in this.geometry.userVertexProperties){const i=this.geometry.userVertexProperties[r],s=t*i.getDataSize(),n=s+i.getDataSize(),a=i.getSrcArray().slice(s,n);e[e.length-1].push(...a)}}const t=this._triangulate(e),r=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 i=[];for(let e=0,r=t.length;e<r;e+=this.tessyVertexSize){i.push(...t.slice(e+5,e+9)),this.geometry.vertexNormals.push(new je(...t.slice(e+9,e+12)));{let r=12;for(const i in this.geometry.userVertexProperties){const s=this.geometry.userVertexProperties[i],n=s.getDataSize(),a=e+r,o=a+n;s.setCurrentData(t.slice(a,o)),s.pushCurrentData(),r+=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 i=r[t];let s=this.geometry.vertices.findIndex((e=>i.x===e.x&&i.y===e.y&&i.z===e.z));if(-1===s){let e=1/0,t=0;for(let r=0;r<this.geometry.vertices.length;r++){const s=this.geometry.vertices[r],n=i.x-s.x,a=i.y-s.y,o=i.z-s.z,h=n*n+a*a+o*o;h<e&&(e=h,t=r)}s=t}e.set(t,s)}return e.get(t)}))))}this.geometry.vertexColors=i}_initTessy(){const e=new Sn.GluTesselator;return e.gluTessCallback(Sn.gluEnum.GLU_TESS_VERTEX_DATA,(function(e,t){for(const r of e)t.push(r)})),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,r)=>{const i=new Array(this.tessyVertexSize).fill(0);for(let e=0;e<r.length;e++)for(let s=0;s<i.length;s++)0!==r[e]&&t[e]&&(i[s]+=t[e][s]*r[e]);return i})),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 r=!0;for(const i of e)for(let e=0;e<i.length;e+=this.tessyVertexSize)if(i[e+2]!==t){r=!1;break}r?this._tessy.gluTessNormal(0,0,1):this._tessy.gluTessNormal(0,0,0);const i=[];this._tessy.gluTessBeginPolygon(i);for(const t of e){this._tessy.gluTessBeginContour();for(let e=0;e<t.length;e+=this.tessyVertexSize){const r=t.slice(e,e+this.tessyVertexSize);this._tessy.gluTessVertex(r,r)}this._tessy.gluTessEndContour()}return this._tessy.gluTessEndPolygon(),i}}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 r=this.renderer.GL;if(this.freeBuffers(t),Object.keys(this.cache).length>1e3){const e=Object.keys(this.cache)[0];this.freeBuffers(e)}const i={};this.cache[t]=i,i.geometry=e;let s=i.indexBuffer;if(e.faces.length){s||(s=i.indexBuffer=r.createBuffer());const t=e.faces.flat(),n=t.some((e=>e>65535));let a=n?Uint32Array:Uint16Array;this.renderer._bindBuffer(s,r.ELEMENT_ARRAY_BUFFER,t,a),i.indexBufferType=n?r.UNSIGNED_INT:r.UNSIGNED_SHORT}else s&&(r.deleteBuffer(s),i.indexBuffer=null);return i}freeBuffers(e){const t=this.cache[e];if(!t)return;delete this.cache[e];const r=this.renderer.GL;function i(e){for(const i of e)t[i.dst]&&(r.deleteBuffer(t[i.dst]),t[i.dst]=null)}t.indexBuffer&&r.deleteBuffer(t.indexBuffer),i(this.renderer.buffers.stroke),i(this.renderer.buffers.fill),i(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,r,i,s,a){super(e,t,r,i),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 Mi(this.elt,this._pInst);for(const e of Object.getOwnPropertyNames(Mi.prototype))"constructor"!==e&&"_"!==e[0]&&Object.defineProperty(this,e,{get(){return this.wrappedElt[e]}});const o=this._adjustDimensions(t,r);if(t=o.adjustedWidth,r=o.adjustedHeight,this.width=t,this.height=r,this.elt.width=t*this._pixelDensity,this.elt.height=r*this._pixelDensity,this.elt.style.width=`${t}px`,this.elt.style.height=`${r}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 pi([-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,r){e instanceof je?this.states.setValue("_currentNormal",e):this.states.setValue("_currentNormal",new je(e,t,r)),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:r=1}={}){for(const t in e.userVertexProperties){const r=e.userVertexProperties[t];this.buffers.user.push(new wn(r.getDataSize(),r.getSrcName(),r.getDstName(),r.getName(),this))}this.states.fillColor&&e.vertices.length>=3&&![M,T].includes(t)&&this._drawFills(e,{mode:t,count:r}),this.states.strokeColor&&e.lineVertices.length>=1&&this._drawStrokes(e,{count:r}),this.buffers.user=[]}_drawGeometryScaled(e,t,r,i){let s=this.states.uModelMatrix;this.states.setValue("uModelMatrix",this.states.uModelMatrix.clone());try{this.states.uModelMatrix.scale(t,r,i),this.geometryBuilder?this.geometryBuilder.addRetained(e):this._drawGeometry(e)}finally{this.states.setValue("uModelMatrix",s)}}_drawFills(e,{count:t,mode:r}={}){this._useVertexColor=e.vertexColors.length>0;const i=!this._drawingFilter&&this.states.userFillShader?this.states.userFillShader:this._getFillShader();i.bindShader(),this._setGlobalUniforms(i),this._setFillUniforms(i),i.bindTextures();for(const t of this.buffers.fill)t._prepareBuffer(e,i);this._prepareUserAttributes(e,i),i.disableRemainingAttributes(),this._applyColorBlend(this.states.curFillColor,e.hasFillTransparency()),this._drawBuffers(e,{mode:r,count:t}),i.unbindShader()}_drawStrokes(e,{count:t}={}){const r=this.GL;this._useLineColor=e.vertexStrokeColors.length>0;const i=this._getStrokeShader();i.bindShader(),this._setGlobalUniforms(i),this._setStrokeUniforms(i),i.bindTextures();for(const t of this.buffers.stroke)t._prepareBuffer(e,i);if(this._prepareUserAttributes(e,i),i.disableRemainingAttributes(),this._applyColorBlend(this.states.curStrokeColor,e.hasStrokeTransparency()),1===t)r.drawArrays(r.TRIANGLES,0,e.lineVertices.length/3);else try{r.drawArraysInstanced(r.TRIANGLES,0,e.lineVertices.length/3,t)}catch(e){console.log("🌸 p5.js says: Instancing is only supported in WebGL2 mode")}i.unbindShader()}_drawPoints(e,t){const r=this.GL,i=this._getPointShader();i.bindShader(),this._setGlobalUniforms(i),this._setPointUniforms(i),i.bindTextures(),this._bindBuffer(t,r.ARRAY_BUFFER,this._vToNArray(e),Float32Array,r.STATIC_DRAW),i.enableAttrib(i.attributes.aPosition,3),this._applyColorBlend(this.states.curStrokeColor),r.drawArrays(r.Points,0,e.length),i.unbindShader()}_prepareUserAttributes(e,t){for(const r of this.buffers.user){if(!this._pInst.constructor.disableFriendleErrors){const t=e.userVertexProperties[r.attr];if(t){const r=t.getSrcArray().length/t.getDataSize();r>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()"):r<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()")}}r._prepareBuffer(e,t)}}_drawBuffers(e,{mode:t=this.GL.TRIANGLES,count:r}){const i=this.GL,s=this.geometryBufferCache.getCached(e);if(s)if(s.indexBuffer){if(this._bindBuffer(s.indexBuffer,i.ELEMENT_ARRAY_BUFFER),this._pInst.webglVersion!==n&&s.indexBufferType===i.UNSIGNED_INT&&!i.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===r)i.drawElements(i.TRIANGLES,3*e.faces.length,s.indexBufferType,0);else try{i.drawElementsInstanced(i.TRIANGLES,3*e.faces.length,s.indexBufferType,0,r)}catch(e){console.log("🌸 p5.js says: Instancing is only supported in WebGL2 mode")}}else if(1===r)i.drawArrays(t,0,e.vertices.length);else try{i.drawArraysInstanced(t,0,e.vertices.length,r)}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 r=this._maxTextureSize,i=Math.floor(r/this._pixelDensity),s=Math.min(e,i),n=Math.min(t,i);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 r=this.width,i=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),Mi.call(e,e.canvas,e._pInst),e.width=r,e.height=i}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,r,i,!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,r=this.states.uPMatrix,i=new ln(4);i.scale(this.width,this.height,1),i.translate([.5,.5,.5]),i.scale(.5,-.5,.5);return e.copy().mult(t).mult(r).mult(i)}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,r,i=this.getFilterLayer();if("string"==typeof e[0]){r=e[0];let s=r in In&&void 0===e[1];t=s?In[r]:e[1],r in this.defaultFilterShaders||(this.defaultFilterShaders[r]=new Dn(i.renderer,Wn,Qn[r])),this.states.setValue("filterShader",this.defaultFilterShaders[r])}else this.states.setValue("filterShader",e[0]);const s=this.activeFramebuffer()||this;this.matchSize(i,s),i.draw((()=>this.clear()));let n=[1/(s.width*s.pixelDensity()),1/(s.height*s.pixelDensity())];if(r===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)})),i.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 i.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(i,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!==re&&e!==ie||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 r=this.GL;return ia(r,null,e,t,r.RGBA,r.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=ra(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 r={};for(const e in this.drawingContext){const t=this.drawingContext[e];"object"!=typeof t&&"function"!=typeof t&&(r[e]=t)}const i=this._adjustDimensions(e,t);e=i.adjustedWidth,t=i.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 r)try{this.drawingContext[e]=r[e]}catch(e){}}clear(...e){const t=e[0]||0,r=e[1]||0,i=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,r*s,i*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,r,i,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,r,i,0,0,0,0,1,0,s,n,0,1])}translate(e,t,r){return e instanceof je&&(r=e.z,t=e.y,e=e.x),this.states.setValue("uModelMatrix",this.states.uModelMatrix.clone()),this.states.uModelMatrix.translate([e,t,r]),this}scale(e,t,r){return this.states.setValue("uModelMatrix",this.states.uModelMatrix.clone()),this.states.uModelMatrix.scale(e,t,r),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 r="";return this.webglVersion===n&&(r+="#version 300 es\n#define WEBGL2\n"),"vert"===e?r+="#define VERTEX_SHADER\n":"frag"===e&&(r+="#define FRAGMENT_SHADER\n"),t&&(r+=`precision ${t} float;\n`),r}_getEmptyTexture(){if(!this._emptyTexture){const e=new Wi(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 r=this.textures.get(t);if(r)return r;const i=new ua(this,t);return this.textures.set(t,i),i}getDiffusedTexture(e){if(null!=this.diffusedTextures.get(e))return this.diffusedTextures.get(e);let t,r=Math.floor(e.height/e.width*200);return t=new ma(this,{width:200,height:r,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,r)})),this.diffusedTextures.set(e,t),t}getSpecularTexture(e){if(null!=this.specularTextures.get(e))return this.specularTextures.get(e);const t=512;let r;const i=[],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 r=t;r>=1;r/=2){s.resize(r,r);let t=1-Math.log(r)/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(r,r)})),i.push(s.get().drawingContext.getImageData(0,0,r,r))}return s.remove(),r=new la(this,i,{}),this.specularTextures.set(e,r),r}activeFramebuffer(){return this.activeFramebuffers[this.activeFramebuffers.length-1]||null}createFramebuffer(e){return new ma(this,e)}_setGlobalUniforms(e){const t=this.states.uModelMatrix,r=this.states.uViewMatrix,i=this.states.uPMatrix,s=t.copy().mult(r);if(e.setUniform("uPerspective",this.states.curCamera.useLinePerspective?1:0),e.setUniform("uViewMatrix",r.mat4),e.setUniform("uProjectionMatrix",i.mat4),e.setUniform("uModelMatrix",t.mat4),e.setUniform("uModelViewMatrix",s.mat4),e.uniforms.uModelViewProjectionMatrix){const t=s.copy();t.mult(i),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 r=this.states.pointLightDiffuseColors.length/3;e.setUniform("uPointLightCount",r),e.setUniform("uPointLightLocation",this.states.pointLightPositions),e.setUniform("uPointLightDiffuseColors",this.states.pointLightDiffuseColors),e.setUniform("uPointLightSpecularColors",this.states.pointLightSpecularColors);const i=this.states.directionalLightDiffuseColors.length/3;e.setUniform("uDirectionalLightCount",i),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 r=this.getSpecularTexture(this.states.activeImageLight);e.setUniform("environmentMapSpecular",r)}}_setPointUniforms(e){e.setUniform("uMaterialColor",this.states.curStrokeColor),e.setUniform("uPointSize",this.states.strokeWeight*this._pixelDensity)}_bindBuffer(e,t,r,i,s){if(t||(t=this.GL.ARRAY_BUFFER),this.GL.bindBuffer(t,e),void 0!==r){let e=r;r instanceof pn?e=r.dataArray():e instanceof(i||Float32Array)||(e=new(i||Float32Array)(e)),this.GL.bufferData(t,e,s||this.GL.STATIC_DRAW)}}_arraysEqual(e,t){return e.length===t.length&&e.every(((e,r)=>e===t[r]))}_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,r){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 i=!0;void 0!==r?(null===this._glAttributes&&(this._glAttributes={}),this._glAttributes[t]!==r&&(this._glAttributes[t]=r,i=!1)):t instanceof Object&&this._glAttributes!==t&&(this._glAttributes=t,i=!1),this._renderer.isP3D&&!i&&(!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 ra(e,t,r,i,s,n,a,o,h,u){const l=t.getParameter(t.FRAMEBUFFER_BINDING);t.bindFramebuffer(t.FRAMEBUFFER,r);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(i,u?u-s-a:s,n,a,o,h,e),t.bindFramebuffer(t.FRAMEBUFFER,l),u){const t=Math.floor(a/2),r=new d(n*c);for(let i=0;i<t;i++){const t=i*n*4,s=(a-i-1)*n*4;r.set(e.subarray(t,t+4*n)),e.copyWithin(t,s,s+4*n),e.set(r,s)}}return e}function ia(e,t,r,i,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(r,a?a-i-1:i,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,r=1,i=1){return this._assert3d("plane"),this._renderer.plane(e,t,r,i),this},t.box=function(e,t,r,i,s){return this._assert3d("box"),this._renderer.box(e,t,r,i,s),this},t.sphere=function(e=50,t=24,r=16){return this._assert3d("sphere"),this._renderer.sphere(e,t,r),this},t.cylinder=function(e=50,t=e,r=24,i=1,s=!0,n=!0){return this._assert3d("cylinder"),this._renderer.cylinder(e,t,r,i,s,n),this},t.cone=function(e=50,t=e,r=24,i=1,s=!0){return this._assert3d("cone"),this._renderer.cone(e,t,r,i,s),this},t.ellipsoid=function(e=50,t=e,r=e,i=24,s=16){return this._assert3d("ellipsoid"),this._renderer.ellipsoid(e,t,r,i,s),this},t.torus=function(e,t,r,i){return this._assert3d("torus"),this._renderer.torus(e,t,r,i),this},ea.prototype.point=function(e,t,r=0){const i=[];return i.push(new je(e,t,r)),this._drawPoints(i,this.buffers.point),this},ea.prototype.triangle=function(e){const t=e[0],r=e[1],i=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-i*r+i*a-n*s+n*r-t*a),h=new ln([i-t,s-r,0,0,n-t,a-r,0,0,0,0,e,0,t,r,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],r=e[1],i=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,r=.5+Math.cos(t)/2,i=.5+Math.sin(t)/2;this.vertices.push(new je(r,i,0)),this.uvs.push([r,i]),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,r,0]),this.states.uModelMatrix.scale(i,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],r=e[1],i=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 r=e/this.detailX,i=new je(r,t,0);this.vertices.push(i),this.uvs.push(r,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,r,0]),this.states.uModelMatrix.scale(i,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=r,c=i,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)/i,(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,r,i,s,n,a,o,h,u,l,c,p=2,d=2){const f=`quad|${e}|${t}|${r}|${i}|${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)*i+y*a),v=(1-m)*((1-y)*t+y*l)+m*((1-y)*s+y*o),b=(1-m)*((1-y)*r+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 r=t+e*p,i=t+1+e*p,s=t+1+(e+1)*p,n=t+(e+1)*p;g.faces.push([r,i,s]),g.faces.push([r,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],r=m[(e+1)%m.length];g.edges.push([t,r])}g._edgesToVertices(),g.gid=f,this.geometryBufferCache.ensureCached(g)}return this._drawGeometry(this.geometryBufferCache.getGeometryByID(f)),this},ea.prototype.bezier=function(e,t,r,i,s,n,a,o,h,u,l,c){8===arguments.length&&(l=o,u=a,o=n,a=s,s=i,i=r,r=n=h=c=0),this.bezierOrder(),this.bezierOrder(3),this.beginShape(),this.vertex(e,t,r),this.bezierVertex(i,s,n),this.bezierVertex(a,o,h),this.bezierVertex(u,l,c),this.endShape()},ea.prototype.curve=function(e,t,r,i,s,n,a,o,h,u,l,c){8===arguments.length&&(u=a,l=o,a=s,o=i,s=i=r,r=n=h=c=0),this.beginShape(),this.splineVertex(e,t,r),this.splineVertex(i,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,r,i,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+i<=e.width&&(l=(t+i)/e.width);let c=0;r<=e.height&&(c=r/e.height);let p=1;r+s<=e.height&&(p=(r+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 r=function(e,t,r,i,s,n,a){e=e<=0?1:e,t=t<0?0:t,r=r<=0?e:r,i=i<3?3:i;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,r),l=Math.sin(u),c=Math.cos(u);let p,d,f;for(p=o;p<=h;++p){let n,a=p/s,o=r*a;for(p<0?(o=0,a=0,n=e):p>s?(o=r,a=1,n=t):n=e+(t-e)*a,-2!==p&&p!==s+2||(n=0),o-=r/2,d=0;d<i;++d){const e=d/(i-1),r=2*Math.PI*e,h=Math.sin(r),u=Math.cos(r);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<i;++f){const e=(f+1)%i;this.faces.push([g+f,g+i+e,g+i+f])}g+=2*i}for(p=0;p<s;++p){for(d=0;d<i;++d){const e=(d+1)%i;this.faces.push([g+d,g+e,g+i+e]),this.faces.push([g+d,g+i+e,g+i+d])}g+=i}if(a)for(g+=i,d=0;d<i;++d)this.faces.push([g+d,g+(d+1)%i,g+i])};ea.prototype.plane=function(e=50,t=e,r=1,i=1){const s=`plane|${r}|${i}`;if(!this.geometryInHash(s)){const e=function(){let e,t,r;for(let i=0;i<=this.detailY;i++){t=i/this.detailY;for(let i=0;i<=this.detailX;i++)e=i/this.detailX,r=new je(e-.5,t-.5,0),this.vertices.push(r),this.uvs.push(e,t)}},t=new gn(r,i,e,this);t.computeFaces().computeNormals(),r<=1&&i<=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,r=t,i,s){const n=this.attributes&&this.attributes.perPixelLighting;void 0===i&&(i=n?1:4),void 0===s&&(s=n?1:4);const a=`box|${i}|${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 r=4*t;for(let t=0;t<4;t++){const r=e[t],i=new je((2*(1&r)-1)/2,((2&r)-1)/2,((4&r)/2-1)/2);this.vertices.push(i),this.uvs.push(1&t,(2&t)/2)}this.faces.push([r,r+1,r+2]),this.faces.push([r+2,r+1,r+3])}))},t=new gn(i,s,e,this);t.computeNormals(),i<=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,r)},ea.prototype.sphere=function(e=50,t=24,r=16){this.ellipsoid(e,e,e,t,r)},ea.prototype.ellipsoid=function(t=50,r=t,i=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 r=t/this.detailY,i=Math.PI*r-Math.PI/2,s=Math.cos(i),n=Math.sin(i);for(let t=0;t<=this.detailX;t++){const i=t/this.detailX,a=2*Math.PI*i,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(i,r)}}},r=new gn(s,n,t,this);r.computeFaces(),s<=24&&n<=24?r._makeTriangleEdges()._edgesToVertices():this.states.strokeColor&&console.log("Cannot draw stroke on ellipsoids with more than 24 detailX or 24 detailY"),r.gid=a,this.geometryBufferCache.ensureCached(r)}this._drawGeometryScaled(this.geometryBufferCache.getGeometryByID(a),t,r,i)},ea.prototype.cylinder=function(t=50,i=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(){r.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,i,t)},ea.prototype.cone=function(e=50,t=e,i=24,s=1,n=!0){const a=`cone|${i}|${s}|${n}`;if(!this.geometryInHash(a)){const e=new gn(i,s,(function(){r.call(this,1,0,1,i,s,n,!1)}),this);i<=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,r=24,i=16){if(0===e)return;if(0===t)return;const s=(t/e).toPrecision(4),n=`torus|${s}|${r}|${i}`;if(!this.geometryInHash(n)){const e=function(){for(let e=0;e<=this.detailY;e++){const t=e/this.detailY,r=2*Math.PI*t,i=Math.cos(r),n=Math.sin(r),a=1+s*i;for(let e=0;e<=this.detailX;e++){const r=e/this.detailX,o=2*Math.PI*r,h=Math.cos(o),u=Math.sin(o),l=new je(a*h,a*u,s*n),c=new je(i*h,i*u,n);this.vertices.push(l),this.vertexNormals.push(c),this.uvs.push(r,t)}}},t=new gn(r,i,e,this);t.computeFaces(),r<=24&&i<=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,r,i){return this._assert3d("ambientLight"),this._renderer.ambientLight(...arguments),this},t.specularColor=function(e,t,r){return this._assert3d("specularColor"),this._renderer.specularColor(...arguments),this},t.directionalLight=function(e,t,r,i,s,n){return this._assert3d("directionalLight"),this._renderer.directionalLight(...arguments),this},t.pointLight=function(e,t,r,i,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,r){return this._assert3d("lightFalloff"),this._renderer.lightFalloff(e,t,r),this},t.spotLight=function(e,t,r,i,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,r,i){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,r){const i=this._pInst.color(...arguments);this.states.setValue("specularColors",[i._array[0],i._array[1],i._array[2]])},ea.prototype.directionalLight=function(e,t,r,i,s,n){let a,o,h,u;a=e instanceof pi?e:this._pInst.color(e,t,r);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,r,i,s,n){let a,o,h,u;a=e instanceof pi?e:this._pInst.color(e,t,r);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,r){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.")),r<0&&(r=0,console.warn("Value of quadratic argument in lightFalloff() should be never be negative. Set to 0.")),0===e&&0===t&&0===r&&(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",r)},ea.prototype.spotLight=function(e,t,r,i,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,r),p=new je(i,s,n),d=new je(a,o,h);break;case 9:e instanceof pi?(c=e,p=new je(t,r,i),d=new je(s,n,a),u=o,l=h):i instanceof je?(c=this._pInst.color(e,t,r),p=i,d=new je(s,n,a),u=o,l=h):a instanceof je?(c=this._pInst.color(e,t,r),p=new je(i,s,n),d=a,u=o,l=h):(c=this._pInst.color(e,t,r),p=new je(i,s,n),d=new je(a,o,h));break;case 8:e instanceof pi?(c=e,p=new je(t,r,i),d=new je(s,n,a),u=o):i instanceof je?(c=this._pInst.color(e,t,r),p=i,d=new je(s,n,a),u=o):(c=this._pInst.color(e,t,r),p=new je(i,s,n),d=a,u=o);break;case 7:e instanceof pi&&t instanceof je?(c=e,p=t,d=new je(r,i,s),u=n,l=a):e instanceof pi&&s instanceof je?(c=e,p=new je(t,r,i),d=s,u=n,l=a):i instanceof je&&s instanceof je?(c=this._pInst.color(e,t,r),p=i,d=s,u=n,l=a):e instanceof pi?(c=e,p=new je(t,r,i),d=new je(s,n,a)):i instanceof je?(c=this._pInst.color(e,t,r),p=i,d=new je(s,n,a)):(c=this._pInst.color(e,t,r),p=new je(i,s,n),d=a);break;case 6:i instanceof je&&s instanceof je?(c=this._pInst.color(e,t,r),p=i,d=s,u=n):e instanceof pi&&s instanceof je?(c=e,p=new je(t,r,i),d=s,u=n):e instanceof pi&&t instanceof je&&(c=e,p=t,d=new je(r,i,s),u=n);break;case 5:e instanceof pi&&t instanceof je&&r instanceof je?(c=e,p=t,d=r,u=i,l=s):i instanceof je&&s instanceof je?(c=this._pInst.color(e,t,r),p=i,d=s):e instanceof pi&&s instanceof je?(c=e,p=new je(t,r,i),d=s):e instanceof pi&&t instanceof je&&(c=e,p=t,d=new je(r,i,s));break;case 4:c=e,p=t,d=r,u=i;break;case 3:c=e,p=t,d=r;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,r,i){const s=new Dn;try{return s._vertSrc=(await Os(e,"text")).data,s._fragSrc=(await Os(t,"text")).data,r?r(s):s}catch(e){if(i)return i(e);throw e}},t.createShader=function(e,t,r){return new Dn(this._renderer,e,t,r)},t.loadFilterShader=async function(e,t,r){try{const r=await this.loadStrings(e),i=await r.join("\n"),s=this.createFilterShader(i,!0);return t&&t(s),s}catch(e){r?r(e):console.error(e)}},t.createFilterShader=function(e,t=!1){let r=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 i=new Dn(this._renderer,r,e);return t||(this._renderer.GL?i.ensureCompiledOnContext(this._renderer):i.ensureCompiledOnContext(this)),i},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 r of this._renderer.textures.values())r.setWrapMode(e,t)},t.normalMaterial=function(...e){return this._assert3d("normalMaterial"),this._renderer.normalMaterial(...e),this},t.ambientMaterial=function(e,r,i){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 pi([1,1,1])),this},t.emissiveMaterial=function(e,r,i,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,r,i,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 r=this.GL,i=this.states.drawMode===ye,s=t||this.states.userFillShader||this.states.userStrokeShader||this.states.userPointShader||i||this.states.curBlendMode!==j||e[e.length-1]<1||this._isErasing;return s!==this._isBlending&&(s||this.states.curBlendMode!==j&&this.states.curBlendMode!==W?r.enable(r.BLEND):r.disable(r.BLEND),r.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 pi([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 pi([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 r=t.DEGREES="degrees",i=t.RADIANS="radians";t._angleMode=i,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===r||e===i){if(e===this._angleMode)return;e===i?(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===r?e*v:e},t._toDegrees=function(e){return this._angleMode===i?e*b:e},t._fromRadians=function(e){return this._angleMode===r?e*b:e},t._fromDegrees=function(e){return this._angleMode===i?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,r,s,n){const a=r||i;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,r){this._renderer=e;const i=this._renderer.GL;r=r||{},this.src=t,this.glTex=void 0,this.glTarget=i.TEXTURE_2D,this.glFormat=r.format||i.RGBA,this.mipmaps=!1,this.glMinFilter=r.minFilter||i.LINEAR,this.glMagFilter=r.magFilter||i.LINEAR,this.glWrapS=r.wrapS||i.CLAMP_TO_EDGE,this.glWrapT=r.wrapT||i.CLAMP_TO_EDGE,this.glDataType=r.dataType||i.UNSIGNED_BYTE;const s=pa(e);this.glFormat!==i.HALF_FLOAT||s.halfFloat||(console.log("This device does not support dataType HALF_FLOAT. Falling back to FLOAT."),this.glDataType=i.FLOAT),this.glFormat!==i.HALF_FLOAT||this.glMinFilter!==i.LINEAR&&this.glMagFilter!==i.LINEAR||s.halfFloatLinear||(console.log("This device does not support linear filtering for dataType FLOAT. Falling back to NEAREST."),this.glMinFilter===i.LINEAR&&(this.glMinFilter=i.NEAREST),this.glMagFilter===i.LINEAR&&(this.glMagFilter=i.NEAREST)),this.glFormat!==i.FLOAT||s.float||(console.log("This device does not support dataType FLOAT. Falling back to UNSIGNED_BYTE."),this.glDataType=i.UNSIGNED_BYTE),this.glFormat!==i.FLOAT||this.glMinFilter!==i.LINEAR&&this.glMagFilter!==i.LINEAR||s.floatLinear||(console.log("This device does not support linear filtering for dataType FLOAT. Falling back to NEAREST."),this.glMinFilter===i.LINEAR&&(this.glMinFilter=i.NEAREST),this.glMagFilter===i.LINEAR&&(this.glMagFilter=i.NEAREST)),this.isSrcMediaElement=!1,this._videoPrevUpdateTime=0,this.isSrcHTMLElement=void 0!==Mi&&t instanceof Mi&&!(t instanceof ha)&&!(t instanceof xs),this.isSrcP5Image=t instanceof Wi,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 this.src.update(),!1;const t=this._getTextureDataFromSource();let r=!1;const i=this._renderer.GL;return t.width!==this.width||t.height!==this.height?(r=!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()&&(r=!0,e.setModified(!1)):this.isSrcMediaElement?e.isModified()?(r=!0,e.setModified(!1)):e.loadedmetadata&&this._videoPrevUpdateTime!==e.time()&&(this._videoPrevUpdateTime=e.time(),r=!0):this.isImageData?e._dirty&&(e._dirty=!1,r=!0):r=!0,r&&(this.bindTexture(),i.texImage2D(this.glTarget,0,this.glFormat,this.glFormat,this.glDataType,t)),r}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 r=this._renderer.GL;this.glMinFilter=this.glFilter(e),this.glMagFilter=this.glFilter(t),this.bindTexture(),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MIN_FILTER,this.glMinFilter),r.texParameteri(r.TEXTURE_2D,r.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 r=this._renderer.GL,i=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=i(a),u=i(o);e===be?this._renderer.webglVersion===n||h&&u?this.glWrapS=r.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=r.CLAMP_TO_EDGE):e===we?this._renderer.webglVersion===n||h&&u?this.glWrapS=r.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=r.CLAMP_TO_EDGE):this.glWrapS=r.CLAMP_TO_EDGE,t===be?this._renderer.webglVersion===n||h&&u?this.glWrapT=r.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=r.CLAMP_TO_EDGE):t===we?this._renderer.webglVersion===n||h&&u?this.glWrapT=r.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=r.CLAMP_TO_EDGE):this.glWrapT=r.CLAMP_TO_EDGE,this.bindTexture(),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_S,this.glWrapS),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_T,this.glWrapT),this.unbindTexture()}}class la extends ua{constructor(e,t,r){super(e,t,r);const i=this._renderer.GL;this.glMinFilter===i.LINEAR&&(this.glMinFilter=i.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 r=0;r<e.length;r++)t.texImage2D(this.glTarget,r,this.glFormat,this.glFormat,this.glDataType,e[r]);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 r=e,i=t===n?r.getExtension("EXT_color_buffer_float")&&r.getExtension("EXT_float_blend"):r.getExtension("OES_texture_float"),s=i&&r.getExtension("OES_texture_float_linear"),a=t===n?r.getExtension("EXT_color_buffer_float"):r.getExtension("OES_texture_half_float");return{float:i,floatLinear:s,halfFloat:a,halfFloatLinear:a&&r.getExtension("OES_texture_half_float_linear")}}void 0!==p5&&ca(p5);const da=(e,t,r)=>Math.max(Math.min(e,r),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}update(){this.framebuffer._update(this.property)}rawTexture(){return this.framebuffer[this.property]}}class ma{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?Ci:fi),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 r=this.renderer.GL;if(this.gl=r,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=r.createFramebuffer(),!this.framebuffer)throw new Error("Unable to create a framebuffer");if(this.antialias&&(this.aaFramebuffer=r.createFramebuffer(),!this.aaFramebuffer))throw new Error("Unable to create a framebuffer for antialiasing");this._recreateTextures();const i=this.renderer.states.curCamera;this.defaultCamera=this.createCamera(),this.filterCamera=this.createCamera(),this.renderer.states.setValue("curCamera",i),this.draw((()=>this.renderer.clear()))}resize(e,t){this._autoSized=!1;const r=this.renderer._adjustDimensions(e,t);e=r.adjustedWidth,t=r.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===fi&&[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=Ci)}_recreateTextures(){const e=this.gl;this._updateSize();const t=e.getParameter(e.TEXTURE_BINDING_2D),r=e.getParameter(e.FRAMEBUFFER_BINDING),i=e.createTexture();if(!i)throw new Error("Unable to create color texture");e.bindTexture(e.TEXTURE_2D,i);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=i,e.bindFramebuffer(e.FRAMEBUFFER,this.framebuffer),e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,i,0),this.useDepth){const t=e.createTexture();if(!t)throw new Error("Unable to create depth texture");const r=this._glDepthFormat();e.bindTexture(e.TEXTURE_2D,t),e.texImage2D(e.TEXTURE_2D,0,r.internalFormat,this.width*this.density,this.height*this.density,0,r.format,r.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,r)}_glColorFormat(){let e,t,r;const i=this.gl;if(e=this.format===Be?i.FLOAT:this.format===Le?this.renderer.webglVersion===n?i.HALF_FLOAT:i.getExtension("OES_texture_half_float").HALF_FLOAT_OES:i.UNSIGNED_BYTE,t=this.channels===Ci?i.RGBA:i.RGB,this.renderer.webglVersion===n){r={[i.FLOAT]:{[i.RGBA]:i.RGBA32F},[i.HALF_FLOAT]:{[i.RGBA]:i.RGBA16F},[i.UNSIGNED_BYTE]:{[i.RGBA]:i.RGBA8,[i.RGB]:i.RGB8}}[e][t]}else r=this.format===Le?i.RGBA:t;return{internalFormat:r,format:t,type:e}}_glDepthFormat(){let e,t,r;const i=this.gl;return e=this.useStencil?this.depthFormat===Be?i.FLOAT_32_UNSIGNED_INT_24_8_REV:this.renderer.webglVersion===n?i.UNSIGNED_INT_24_8:i.getExtension("WEBGL_depth_texture").UNSIGNED_INT_24_8_WEBGL:this.depthFormat===Be?i.FLOAT:i.UNSIGNED_INT,t=this.useStencil?i.DEPTH_STENCIL:i.DEPTH_COMPONENT,r=this.useStencil?this.depthFormat===Be?i.DEPTH32F_STENCIL8:this.renderer.webglVersion===n?i.DEPTH24_STENCIL8:i.DEPTH_STENCIL:this.renderer.webglVersion===n?this.depthFormat===Be?i.DEPTH_COMPONENT32F:i.DEPTH_COMPONENT24:i.DEPTH_COMPONENT,{internalFormat:r,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,r=this.colorRenderbuffer,i=this.depthRenderbuffer;this._deleteTexture(e),t&&this._deleteTexture(t);const s=this.gl;r&&s.deleteRenderbuffer(r),i&&s.deleteRenderbuffer(i),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}_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 r={colorTexture:[t.COLOR_BUFFER_BIT,this.colorP5Texture.glMagFilter]};this.useDepth&&(r.depthTexture=[t.DEPTH_BUFFER_BIT,this.depthP5Texture.glMagFilter]);const[i,s]=r[e];t.blitFramebuffer(0,0,this.width*this.density,this.height*this.density,0,0,this.width*this.density,this.height*this.density,i,s),this.dirty[e]=!1;const n=this.renderer.activeFramebuffer();n?t.bindFramebuffer(t.FRAMEBUFFER,n._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 r=this._glColorFormat();this.pixels=ra(this.pixels,e,this.framebuffer,0,0,this.width*this.density,this.height*this.density,r.format,r.type),t?e.bindFramebuffer(e.FRAMEBUFFER,t._framebufferToBind()):e.bindFramebuffer(e.FRAMEBUFFER,null)}get(e,t,r,i){this._update("colorTexture");const s=this._glColorFormat();if(void 0===e&&void 0===t)e=0,t=0,r=this.width,i=this.height;else if(void 0===r&&void 0===i)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)),ia(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),r=da(r,1,this.width-e),i=da(i,1,this.height-t);const n=ra(void 0,this.gl,this.framebuffer,e*this.density,t*this.density,r*this.density,i*this.density,s.format,s.type),a=new Uint8ClampedArray(r*i*this.density*this.density*4);a.fill(255);const o=s.type===this.gl.RGB?3:4;for(let e=0;e<i*this.density;e++)for(let t=0;t<r*this.density;t++)for(let i=0;i<4;i++){const s=4*(e*r*this.density+t)+i;if(i<o){const h=4===o?s:(e*r*this.density+t)*o+i;a[s]=n[h]}}const h=new Wi(r*this.density,i*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(r,i),h}updatePixels(){const e=this.gl;this.colorP5Texture.bindTexture();const t=this._glColorFormat(),r=t.format===e.RGBA?4:3,i=this.width*this.height*this.density*this.density*r,s=t.type===e.UNSIGNED_BYTE?Uint8Array:Float32Array;if(!(this.pixels instanceof s)||this.pixels.length!==i)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 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,r,...s){let n=i;return Reflect.ownKeys(xa).includes(r)?n=r:s.unshift(r),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,r){this._renderer&&(this._renderer.resize(e,t),r||this.redraw()),this._addAccsOutput()&&this._updateAccsOutput()},t.noCanvas=function(){this.canvas&&this.canvas.parentNode.removeChild(this.canvas)},t.createGraphics=function(t,r,...s){return s[0]instanceof HTMLCanvasElement&&(s[1]=s[0],s[0]=i),new e.Graphics(t,r,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 Wi(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 r="";return this._renderer.webglVersion===n&&(r+="#version 300 es\n#define WEBGL2\n"),"vert"===e?r+="#define VERTEX_SHADER\n":"frag"===e&&(r+="#define FRAGMENT_SHADER\n"),t&&(r+=`precision ${t} float;\n`),r}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,r=null){this.operation=e,this.filterParameter=t,e in In&&void 0===t&&(this.filterParameter=In[e]),this.customShader=r,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,r){const i=this.gl;i.bindBuffer(t,e),i.bufferData(t,r,i.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,r=[1/(this.pInst.width*t),1/(this.pInst.height*t)],i=this.canvasTexture;this._shader.setUniform("tex0",i),this._shader.setUniform("texelSize",r),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,r,i,s,n={}){super(e,t,r,i),this.canvas=this.elt=s||document.createElement("canvas"),i?(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(Mi.prototype))"constructor"!==e&&"_"!==e[0]&&Object.defineProperty(this,e,{get(){return this.wrappedElt[e]}});if(this.elt.width=t*this._pixelDensity,this.elt.height=r*this._pixelDensity,this.elt.style.width=`${t}px`,this.elt.style.height=`${r}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=gi),this.scale(this._pixelDensity,this._pixelDensity),this.filterRenderer||(this.filterRenderer=new ba(this)),this.wrappedElt=new Mi(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 r={};for(const e in this.drawingContext){const t=this.drawingContext[e];"object"!=typeof t&&"function"!=typeof t&&(r[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 r)try{this.drawingContext[e]=r[e]}catch(e){}}background(...e){if(this.push(),this.resetMatrix(),e[0]instanceof Wi)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 r=t.toString();this._setFill(r),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 r=this._pInst.color(255,e).toString();this.drawingContext.fillStyle=r,this.states.setValue("_cachedStrokeStyle",this.drawingContext.strokeStyle);const i=this._pInst.color(255,t).toString();this.drawingContext.strokeStyle=i;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 r=this._pInst.color(255,0).toString();this.drawingContext.strokeStyle=r;const i=this._cachedBlendMode;this.blendMode(j),this._cachedBlendMode=i,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,r,i,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*r,l*i,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!==re&&e!==ie&&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,r=e[e.length-1],i=Array.prototype.slice.call(e,0,e.length-1);this.drawingContext.globalCompositeOperation=r,Ca.prototype.copy.apply(this,i),this.drawingContext.globalCompositeOperation=t}_getPixel(e,t){let r,i;return r=this.drawingContext.getImageData(e,t,1,1).data,i=0,[r[0],r[1],r[2],r[3]]}loadPixels(){const e=this._pixelDensity,t=this.width*e,r=this.height*e,i=this.drawingContext.getImageData(0,0,t,r);this.imageData=i,this.pixels=i.data}set(e,t,r){if(e=Math.floor(e),t=Math.floor(t),r instanceof Wi)this.drawingContext.save(),this.drawingContext.setTransform(1,0,0,1,0,0),this.drawingContext.scale(this._pixelDensity,this._pixelDensity),this.drawingContext.clearRect(e,t,r.width,r.height),this.drawingContext.drawImage(r.canvas,e,t),this.drawingContext.restore();else{let i=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 r)o<this.pixels.length&&(i=r,s=r,n=r,a=255);else if(Array.isArray(r)){if(r.length<4)throw new Error("pixel array must be of the form [R, G, B, A]");o<this.pixels.length&&(i=r[0],s=r[1],n=r[2],a=r[3])}else r instanceof Ca.Color&&o<this.pixels.length&&([i,s,n,a]=r._getRGBA([255,255,255,255]));for(let r=0;r<this._pixelDensity;r++)for(let h=0;h<this._pixelDensity;h++)o=4*((t*this._pixelDensity+h)*this.width*this._pixelDensity+(e*this._pixelDensity+r)),this.pixels[o]=i,this.pixels[o+1]=s,this.pixels[o+2]=n,this.pixels[o+3]=a}}updatePixels(e,t,r,i){const s=this._pixelDensity;void 0===e&&void 0===t&&void 0===r&&void 0===i&&(e=0,t=0,r=this.width,i=this.height),e*=s,t*=s,r*=s,i*=s,this.gifProperties&&(this.gifProperties.frames[this.gifProperties.displayIndex].image=this.imageData),this.drawingContext.putImageData(this.imageData,0,0,e,t,r,i)}arc(e,t,r,i,s,n,a){const o=this.clipPa||this.drawingContext,h=e+r/2,u=t+i/2,l=r/2,c=i/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,r=!!this.states.fillColor,i=this.states.strokeColor,s=parseFloat(e[0]),n=parseFloat(e[1]),a=parseFloat(e[2]),o=parseFloat(e[3]);if(r&&!i){if(this._getFill()===_a)return this}else if(!r&&i&&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&&r&&t.fill(),!this._clipping&&i&&t.stroke()}line(e,t,r,i){const s=this.clipPath||this.drawingContext;return this.states.strokeColor?(this._getStroke()===_a||(this._clipping||s.beginPath(),s.moveTo(e,t),s.lineTo(r,i),s.stroke()),this):this}point(e,t){const r=this.clipPath||this.drawingContext;if(!this.states.strokeColor)return this;if(this._getStroke()===_a)return this;const i=this._getStroke(),s=this._getFill();this._clipping||this._setFill(i),this._clipping||r.beginPath(),r.arc(e,t,r.lineWidth/2,0,x,!1),this._clipping||(r.fill(),this._setFill(s))}quad(e,t,r,i,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(r,i),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],r=e[1],i=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,r,i,s);else{void 0===a&&(a=n),void 0===o&&(o=a),void 0===h&&(h=o);const e=Math.abs(i),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,r,i,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,r=!!this.states.fillColor,i=this.states.strokeColor,s=e[0],n=e[1],a=e[2],o=e[3],h=e[4],u=e[5];if(r&&!i){if(this._getFill()===_a)return this}else if(!r&&i&&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&&r&&t.fill(),!this._clipping&&i&&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,r,i,s,n){this.drawingContext.transform(e,t,r,i,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=r;static instance=null;static lifecycleHooks={presetup:[],postsetup:[],predraw:[],postdraw:[],remove:[]};static _checkForUserDefinedFunctions=()=>{};static _friendlyFileLoadError=()=>{};constructor(t,r){this.hitCriticalError=!1,this._setupDone=!1,this._userNode=r,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 i=t=>{Object.defineProperty(window,t,{configurable:!0,enumerable:!0,get:()=>"function"==typeof this[t]?this[t].bind(this):this[t],set:r=>{Object.defineProperty(window,t,{configurable:!0,enumerable:!0,value:r,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]&&i(t);const t=["constructor","length"];for(const e in this)if(this.hasOwnProperty(e)){if("_"===e[0]||t.includes(e))continue;i(e)}}for(const e in this._events){const t=this[`_on${e}`];if(t){const r=t.bind(this);window.addEventListener(e,r,{passive:!1}),this._events[e]=r}}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 r={};t(e,e.prototype,r);const i=Object.keys(e.lifecycleHooks);for(const t of i)"function"==typeof r[t]&&e.lifecycleHooks[t].push(r[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,i),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(),r=t-this._lastTargetFrameTime,i=1e3/this._targetFrameRate;(!this._loop||r>=i-5)&&(this.deltaTime=t-this._lastRealFrameTime,this._frameRate=1e3/this.deltaTime,await this.redraw(),this._lastTargetFrameTime=Math.max(this._lastTargetFrameTime+i,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 r of e.lifecycleHooks[t])await r.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 r="_Description",i="_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 r=this.canvas.id;e=l(e),this.dummyDOM||(this.dummyDOM=document.getElementById(r).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,r){if("string"!=typeof t||"string"!=typeof e)return;const i=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(i).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),r===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+r}`))this.dummyDOM.querySelector("#"+n+s).insertAdjacentHTML("beforebegin",`<p id="${n+i}"></p>`);else{let e=`<div id="${n}${r}" role="region" aria-label="Canvas Description"><p id="${n}${i}"></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}${i}`),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+r}`))this.dummyDOM.querySelector("#"+c+s)||this.dummyDOM.querySelector("#"+c+i).insertAdjacentHTML("afterend",`<table id="${c}${s}"><caption>Canvas elements and their descriptions</caption></table>`);else{let e=`<div id="${c}${r}" 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],r=function(e,t){let r="",i="",s=0;for(let n in t){let a=0;for(let i in t[n]){let o=`<li id="${e}shape${s}">${t[n][i].color} ${n},`;"line"===n?o+=` location = ${t[n][i].pos}, length = ${t[n][i].length} pixels`:(o+=` location = ${t[n][i].pos}`,"point"!==n&&(o+=`, area = ${t[n][i].area} %`),o+="</li>"),r+=o,a++,s++}i=a>1?`${i} ${a} ${n}s`:`${i} ${a} ${n}`}return{numShapes:[s,i],details:r}}(e,this.ingredients.shapes),i=function(e,t,r,i){let s=`${t} canvas, ${r} by ${i} pixels, contains ${e[0]}`;s=1===e[0]?`${s} shape: ${e[1]}`:`${s} shapes: ${e[1]}`;return s}(r.numShapes,this.ingredients.colors.background,this.width,this.height),s=function(e,t){let r=0,i="",s=Array.from(Array(10),(()=>Array(10)));for(let i in t)for(let n in t[i]){let a;a="line"!==i?`<a href="#${e}shape${r}">${t[i][n].color} ${i}</a>`:`<a href="#${e}shape${r}">${t[i][n].color} ${i} midpoint</a>`,t[i][n].loc.locY<s.length&&t[i][n].loc.locX<s[t[i][n].loc.locY].length&&(s[t[i][n].loc.locY][t[i][n].loc.locX]?s[t[i][n].loc.locY][t[i][n].loc.locX]=s[t[i][n].loc.locY][t[i][n].loc.locX]+" "+a:s[t[i][n].loc.locY][t[i][n].loc.locX]=a,r++)}for(let e in s){let t="<tr>";for(let r in s[e])t+="<td>",void 0!==s[e][r]&&(t+=s[e][r]),t+="</td>";i=i+t+"</tr>"}return i}(e,this.ingredients.shapes);i!==t.summary.innerHTML&&(t.summary.innerHTML=i),s!==t.map.innerHTML&&(t.map.innerHTML=s),r.details!==t.shapeDetails.innerHTML&&(t.shapeDetails.innerHTML=r.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],r=function(e,t){let r="",i=0;for(let s in t)for(let n in t[s]){let a=`<li><a href="#${e}shape${i}">${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>"),r+=a,i++}return{numShapes:i,listShapes:r}}(e,this.ingredients.shapes),i=function(e,t,r,i){let s=`Your output is a, ${r} by ${i} pixels, ${t} canvas containing the following`;s=1===e?`${s} shape:`:`${s} ${e} shapes:`;return s}(r.numShapes,this.ingredients.colors.background,this.width,this.height),s=function(e,t){let r="",i=0;for(let s in t)for(let n in t[s]){let a=`<tr id="${e}shape${i}"><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>"),r+=a,i++}return r}(e,this.ingredients.shapes);i!==t.summary.innerHTML&&(t.summary.innerHTML=i),r.listShapes!==t.list.innerHTML&&(t.list.innerHTML=r.listShapes),s!==t.shapeDetails.innerHTML&&(t.shapeDetails.innerHTML=s),this._accessibleOutputs[e]=t}}function Sa(e,t){function r(e,t,r){let i=Math.floor(e[0]/t*10),s=Math.floor(e[1]/r*10);return 10===i&&(i-=1),10===s&&(s-=1),{locX:i,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 r,i,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?(r=n+e,i=n+"accessibleOutput",this.dummyDOM.querySelector(`#${i}`)||(this.dummyDOM.querySelector(`#${n}_Description`)?this.dummyDOM.querySelector(`#${n}_Description`).insertAdjacentHTML("afterend",`<div id="${i}" role="region" aria-label="Canvas Outputs"></div>`):this.dummyDOM.querySelector(`#${n}`).innerHTML=`<div id="${i}" role="region" aria-label="Canvas Outputs"></div>`)):"Label"===t&&(a=t,r=n+e+t,i=n+"accessibleOutput"+t,this.dummyDOM.querySelector(`#${i}`)||(this.dummyDOM.querySelector(`#${n}_Label`)?this.dummyDOM.querySelector(`#${n}_Label`).insertAdjacentHTML("afterend",`<div id="${i}"></div>`):this.dummyDOM.querySelector(`#${n}`).insertAdjacentHTML("afterend",`<div id="${i}"></div>`))),this._accessibleOutputs[r]={},"textOutput"===e?(a=`#${n}gridOutput${a}`,s=`<div id="${r}">Text Output<div id="${r}Summary" aria-label="text output summary"><p id="${r}_summary"></p><ul id="${r}_list"></ul></div><table id="${r}_shapeDetails" summary="text output shape details"></table></div>`,this.dummyDOM.querySelector(a)?this.dummyDOM.querySelector(a).insertAdjacentHTML("beforebegin",s):this.dummyDOM.querySelector(`#${i}`).innerHTML=s,this._accessibleOutputs[r].list=this.dummyDOM.querySelector(`#${r}_list`)):"gridOutput"===e&&(a=`#${n}textOutput${a}`,s=`<div id="${r}">Grid Output<p id="${r}_summary" aria-label="grid output summary"><table id="${r}_map" summary="grid output content"></table><ul id="${r}_shapeDetails" aria-label="grid output shape details"></ul></div>`,this.dummyDOM.querySelector(a)?this.dummyDOM.querySelector(a).insertAdjacentHTML("afterend",s):this.dummyDOM.querySelector(`#${i}`).innerHTML=s,this._accessibleOutputs[r].map=this.dummyDOM.querySelector(`#${r}_map`)),this._accessibleOutputs[r].shapeDetails=this.dummyDOM.querySelector(`#${r}_shapeDetails`),this._accessibleOutputs[r].summary=this.dummyDOM.querySelector(`#${r}_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 i={},s=!0,n=function(e,t){let r,i;"rectangle"===e||"ellipse"===e||"arc"===e||"circle"===e||"square"===e?(r=Math.round(t[0]+t[2]/2),i=Math.round(t[1]+t[3]/2)):"triangle"===e?(r=(t[0]+t[2]+t[4])/3,i=(t[1]+t[3]+t[5])/3):"quadrilateral"===e?(r=(t[0]+t[2]+t[4]+t[6])/4,i=(t[1]+t[3]+t[5]+t[7])/4):"line"===e?(r=(t[0]+t[2])/2,i=(t[1]+t[3])/2):(r=t[0],i=t[1]);return[r,i]}(e,t);if("line"===e){i.color=this.ingredients.colors.stroke,i.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]);i.loc=r(n,this.width,this.height),i.pos=e===s?`at ${e}`:`from ${e} to ${s}`}else"point"===e?i.color=this.ingredients.colors.stroke:(i.color=this.ingredients.colors.fill,i.area=this._getArea(e,t)),i.pos=this._getPos(...n),i.loc=r(n,this.width,this.height);if(this.ingredients.shapes[e]){if(this.ingredients.shapes[e]!==[i]){for(let t in this.ingredients.shapes[e])JSON.stringify(this.ingredients.shapes[e][t])===JSON.stringify(i)&&(s=!1);!0===s&&this.ingredients.shapes[e].push(i)}}else this.ingredients.shapes[e]=[i]},t._getPos=function(t,r){const{x:i,y:s}=this.worldToScreen(new e.Vector(t,r)),n=this.width,a=this.height;return i<.4*n?s<.4*a?"top left":s>.6*a?"bottom left":"mid left":i>.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 r=0;if("arc"===e){const e=((t[5]-t[4])%(2*Math.PI)+2*Math.PI)%(2*Math.PI);if(r=e*t[2]*t[3]/8,"open"===t[6]||"chord"===t[6]){const i=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(i*(a-h)+n*(h-s)+o*(s-a))/2;e>Math.PI?r+=u:r-=u}}else"ellipse"===e||"circle"===e?r=3.14*t[2]/2*t[3]/2:"line"===e||"point"===e?r=0:"quadrilateral"===e?r=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?r=t[2]*t[3]:"triangle"===e&&(r=Math.abs(t[0]*(t[3]-t[5])+t[2]*(t[5]-t[1])+t[4]*(t[1]-t[3]))/2);const i=this.width*this._renderer._pixelDensity,s=this.height*this._renderer._pixelDensity,n=[new DOMPoint(0,0),new DOMPoint(i,0),new DOMPoint(i,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*r/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[i]=wa,e.renderers["p2d-hdr"]=new Proxy(wa,{construct:(e,[t,r,i,s,n])=>new e(t,r,i,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),Di(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 r=e[1];const i=e[2],s=(2-r)*i/2;return 0!==s&&(1===s?r=0:s<.5?r/=2-r:r=r*i/(2-2*s)),[t,r,s,e[3]]},_hsbaToRGBA(e){const t=6*e[0],r=e[1],i=e[2];let s=[];if(0===r)s=[i,i,i,e[3]];else{const n=Math.floor(t),a=i*(1-r),o=i*(1-r*(t-n)),h=i*(1-r*(1+n-t));let u,l,c;1===n?(u=o,l=i,c=a):2===n?(u=a,l=i,c=h):3===n?(u=a,l=o,c=i):4===n?(u=h,l=a,c=i):5===n?(u=i,l=a,c=o):(u=i,l=h,c=a),s=[u,l,c,e[3]]}return s},_hslaToHSBA(e){const t=e[0];let r=e[1];const i=e[2];let s;return s=i<.5?(1+r)*i:i+r-i*r,r=2*(s-i)/s,[t,r,s,e[3]]},_hslaToRGBA(e){const t=6*e[0],r=e[1],i=e[2];let s=[];if(0===r)s=[i,i,i,e[3]];else{let n;n=i<.5?(1+r)*i:i+r-i*r;const a=2*i-n,o=(e,t,r)=>(e<0?e+=6:e>=6&&(e-=6),e<1?t+(r-t)*e:e<3?r:e<4?t+(r-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],r=e[1],i=e[2],s=Math.max(t,r,i),n=s-Math.min(t,r,i);let a,o;return 0===n?(a=0,o=0):(o=n/s,t===s?a=(r-i)/n:r===s?a=2+(i-t)/n:i===s&&(a=4+(t-r)/n),a<0?a+=6:a>=6&&(a-=6)),[a/6,o,s,e[3]]},_rgbaToHSLA(e){const t=e[0],r=e[1],i=e[2],s=Math.max(t,r,i),n=Math.min(t,r,i),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=(r-i)/o:r===s?h=2+(i-t)/o:i===s&&(h=4+(t-r)/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 r;const i=[{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 r=t,function(e){let t;if(0!==e[0]){e[0]=Math.round(100*e[0]);let t=e[0].toString().split("");const r=t.length-1;t[r]=parseInt(t[r]),t[r]<2.5?t[r]=0:t[r]>=2.5&&t[r]<7.5&&(t[r]=5),2===t.length?(t[0]=parseInt(t[0]),t[r]>=7.5&&(t[r]=0,t[0]=t[0]+1),e[0]=10*t[0]+t[1]):t[r]>=7.5?e[0]=10:e[0]=t[r]}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--)r[e]=Math.round(1e4*r[e])/1e4;for(let e=0;e<i.length;e++){if(i[e].h===r[0]&&i[e].s===r[1]&&i[e].b===r[2]){t=i[e].name;break}t="white"}}else for(let r=0;r<s.length;r++)if(s[r].h===e[0]&&s[r].s===e[1]&&s[r].b===e[2]){t=s[r].name;break}return t}([t[0],t[1],t[2]])}}function Ma(e,t){t.storeItem=function(t,r){"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===r&&console.log("You cannot store undefined variables using storeItem().");let i=typeof r;switch(i){case"number":case"boolean":r=r.toString();break;case"object":if(r instanceof e.Color)i="p5.Color",r=r.toString();else if(r instanceof e.Vector){i="p5.Vector";r=[r.x,r.y,r.z]}r=JSON.stringify(r)}localStorage.setItem(t,r);const s=`${t}p5TypeID`;localStorage.setItem(s,i)},t.getItem=function(e){let t=localStorage.getItem(e);const r=localStorage.getItem(`${e}p5TypeID`);if(void 0===r)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(r){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 r(e,t,r){(t._userNode?t._userNode:document.body).appendChild(e);const i=r?new vs(e,t):new Mi(e,t);return t._elements.push(i),i}t.select=function(e,t){const r=this._getContainer(t).querySelector(e);return r?this._wrapElement(r):null},t.selectAll=function(e,t){const r=[],i=this._getContainer(t).querySelectorAll(e);if(i)for(let e=0;e<i.length;e++){const t=this._wrapElement(i[e]);r.push(t)}return r},t._getContainer=function(e){let t=document;return"string"==typeof e?t=document.querySelector(e)||document:e instanceof Mi?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 Mi(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 Mi(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 Mi(e,this)):new Mi(e,this)},t.createElement=function(e,t){const i=document.createElement(e);return void 0!==t&&(i.innerHTML=t),r(i,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,r(t,this)},t.createP=function(e=""){let t=document.createElement("p");return t.innerHTML=e,r(t,this)},t.createSpan=function(e=""){let t=document.createElement("span");return t.innerHTML=e,r(t,this)},t.createImg=function(){const e=document.createElement("img"),t=arguments;let i;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],i=r(e,this),e.addEventListener("load",(function(){i.width=e.offsetWidth||e.width,i.height=e.offsetHeight||e.height;const r=t[t.length-1];"function"==typeof r&&r(i)})),i},t.createA=function(e,t,i){const s=document.createElement("a");return s.href=e,s.innerHTML=t,i&&(s.target=i),r(s,this)},t.createSlider=function(e,t,i,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 i&&(n.value=i),r(n,this)},t.createButton=function(e,t){const i=document.createElement("button");return i.innerHTML=e,t&&(i.value=t),r(i,this)},t.createCheckbox=function(...e){const t=document.createElement("div"),i=document.createElement("input");i.type="checkbox";const s=document.createElement("label");s.appendChild(i),t.appendChild(s);const n=r(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]&&(i.checked=!0),n},t.createSelect=function(...e){let t,i=e[0];if(i instanceof Mi&&i.elt instanceof HTMLSelectElement)t=i,this.elt=i.elt;else if(i instanceof HTMLSelectElement)t=r(i,this),this.elt=i;else{const e=document.createElement("select");i&&"boolean"==typeof i&&e.setAttribute("multiple","true"),t=r(e,this),this.elt=e}return t.option=function(e,t){let r;if(void 0!==e){for(let t=0;t<this.elt.length;t+=1)if(this.elt[t].textContent===e){r=t;break}if(void 0!==r)!1===t?this.elt.remove(r):this.elt[r].value=t;else{const r=document.createElement("option");r.textContent=e,r.value=void 0===t?e:t,this.elt.appendChild(r),this._pInst._elements.push(r)}}},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 i=0;t.createRadio=function(...e){let t,s,n;const a=e[0];a instanceof Mi&&(a.elt instanceof HTMLDivElement||a.elt instanceof HTMLSpanElement)?(t=a,this.elt=a.elt):a instanceof HTMLDivElement||a instanceof HTMLSpanElement?(t=r(a,this),this.elt=a,s=a,"string"==typeof e[1]&&(n=e[1])):("string"==typeof a&&(n=a),s=document.createElement("div"),t=r(s,this),this.elt=s),t._name=n||"radioOption_"+i++;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,r){let i,s,n;for(const r of t._getOptionsArray())if(r.value===e){i=r;break}return void 0===i&&(i=document.createElement("input"),i.setAttribute("type","radio"),i.setAttribute("value",e)),i.setAttribute("name",t._name),h(i.parentElement)?s=i.parentElement:(s=document.createElement("label"),s.insertAdjacentElement("afterbegin",i)),s.lastElementChild instanceof HTMLSpanElement?n=s.lastElementChild:(n=document.createElement("span"),i.insertAdjacentElement("afterend",n)),n.innerHTML=void 0===r?e:r,this.elt.appendChild(s),i},t.remove=function(e){for(const r of t._getOptionsArray())if(r.value===e)return void(h(r.parentElement)?r.parentElement.remove():r.remove())},t.value=function(){let e="";for(const r of t._getOptionsArray())if(r.checked){e=r.value;break}return e},t.selected=function(e){let r=null;if(void 0===e){for(const e of t._getOptionsArray())if(e.checked){r=e;break}}else{t._getOptionsArray().forEach((e=>{e.checked=!1,e.removeAttribute("checked")}));for(const i of t._getOptionsArray())i.value===e&&(i.setAttribute("checked",!0),i.checked=!0,r=i)}return r},t.disable=function(e=!0){for(const r of t._getOptionsArray())r.setAttribute("disabled",e)},t},t.createColorPicker=function(t){const i=document.createElement("input");let s;i.type="color",t?t instanceof e.Color?i.value=t.toString("#rrggbb"):(this.push(),this.colorMode("rgb"),i.value=this.color(t).toString("#rrggbb"),this.pop()):i.value="#000000",s=r(i,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 i=document.createElement("input");return i.setAttribute("value",e),i.setAttribute("type",t),r(i,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 i=document.createElement("input");return i.setAttribute("type","file"),t&&i.setAttribute("multiple",!0),i.addEventListener("change",(function(t){for(const r of t.target.files)Fi._load(r,e)}),!1),r(i,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 r=0,i=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=r+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,r=u-180;const l=this._toDegrees(this.rotationY)+180,c=this._toDegrees(this.pRotationY)+180;let p=i+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,i=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,r;null!==this.pAccelerationX&&(t=Math.abs(this.accelerationX-this.pAccelerationX),r=Math.abs(this.accelerationY-this.pAccelerationY)),t+r>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&&e.repeat)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 r(e,t,r,i){const s=e.getBoundingClientRect();return{x:(i.clientX-s.left)/t,y:(i.clientY-s.top)/r,winX:i.clientX,winY:i.clientY,id:i.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,i=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(r(t,i,s,n));this.touches=e}const n=function(e,t,r,i){const s=e.getBoundingClientRect();return{x:(i.clientX-s.left)/t,y:(i.clientY-s.top)/r,winX:i.clientX,winY:i.clientY}}(t,i,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 r;this._updatePointerCoords(e),this._activePointers.set(e.pointerId,e),this._setMouseButton(e),this.mouseIsPressed||"function"!=typeof t.mouseMoved?this.mouseIsPressed&&"function"==typeof t.mouseDragged&&(r=t.mouseDragged(e),!1===r&&e.preventDefault()):(r=t.mouseMoved(e),!1===r&&e.preventDefault())},t._onpointerdown=function(e){const t=this._isGlobal?window:this;let r;this.mouseIsPressed=!0,this._activePointers.set(e.pointerId,e),this._setMouseButton(e),this._updatePointerCoords(e),"function"==typeof t.mousePressed&&(r=t.mousePressed(e),!1===r&&e.preventDefault())},t._onpointerup=function(e){const t=this._isGlobal?window:this;let r;this.mouseIsPressed=!1,this._activePointers.delete(e.pointerId),this._setMouseButton(e),this._updatePointerCoords(e),"function"==typeof t.mouseReleased&&(r=t.mouseReleased(e),!1===r&&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={},r=e=>e){const i=Object.create(null);if(i.options=t,i.options.eof=void 0===i.options.eof||i.options.eof,i.row=1,i.col=1,i.output="",i.options.delimiter=void 0===i.options.delimiter?'"':t.delimiter,i.options.delimiter.length>1||0===i.options.delimiter.length)throw Error(`CSVError: delimiter must be one character [${i.options.separator}]`);if(i.options.separator=void 0===i.options.separator?",":t.separator,i.options.separator.length>1||0===i.options.separator.length)throw Error(`CSVError: separator must be one character [${i.options.separator}]`);const s=new RegExp(`${Ls(i.options.delimiter)}|${Ls(i.options.separator)}|\r\n|\n|\r`);return e.forEach(((t,n)=>{let a="";switch(i.col=1,t.forEach(((e,n)=>{"string"==typeof e&&(e=e.replace(new RegExp(i.options.delimiter,"g"),`${i.options.delimiter}${i.options.delimiter}`),e=s.test(e)?`${i.options.delimiter}${e}${i.options.delimiter}`:e),a+=r(e,i.row,i.col),n!==t.length-1&&(a+=i.options.separator),i.col++})),!0){case i.options.eof:case!i.options.eof&&n!==e.length-1:i.output+=`${a}\n`;break;default:i.output+=`${a}`}i.row++})),i.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 r=0;r<this.rows.length;r++)if(this.rows[r].obj[this.columns.indexOf(t)]===e)return this.rows[r]}else for(let r=0;r<this.rows.length;r++)if(this.rows[r].arr[t]===e)return this.rows[r];return null}findRows(e,t){const r=[];if("string"==typeof t)for(let i=0;i<this.rows.length;i++)this.rows[i].obj[this.columns.indexOf(t)]===e&&r.push(this.rows[i]);else for(let i=0;i<this.rows.length;i++)this.rows[i].arr[t]===e&&r.push(this.rows[i]);return r}matchRow(e,t){if("number"==typeof t){for(let r=0;r<this.rows.length;r++)if(this.rows[r].arr[t].match(e))return this.rows[r]}else for(let r=0;r<this.rows.length;r++)if(this.rows[r].obj[this.columns.indexOf(t)].match(e))return this.rows[r];return null}matchRows(e,t){const r=[];if("number"==typeof t)for(let i=0;i<this.rows.length;i++)this.rows[i].arr[t].match(e)&&r.push(this.rows[i]);else for(let i=0;i<this.rows.length;i++)this.rows[i].obj[this.columns.indexOf(t)].match(e)&&r.push(this.rows[i]);return r}getColumn(e){const t=[];if("string"==typeof e)for(let r=0;r<this.rows.length;r++)t.push(this.rows[r].obj[this.columns.indexOf(e)]);else for(let r=0;r<this.rows.length;r++)t.push(this.rows[r].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 r=[];for(let t=0;t<e.length;t++)r.push(e.charAt(t).replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&"));const i=new RegExp(r.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 r=this.rows[t].arr[e];r=r.replace(i,""),this.rows[t].arr[e]=r,this.rows[t].obj[this.columns[e]]=r}else if("string"==typeof t)for(let e=0;e<this.rows.length;e++){let r=this.rows[e].obj[t];r=r.replace(i,""),this.rows[e].obj[t]=r;const s=this.columns.indexOf(t);this.rows[e].arr[s]=r}else for(let e=0;e<this.rows.length;e++){let r=this.rows[e].arr[t];r=r.replace(i,""),this.rows[e].arr[t]=r,this.rows[e].obj[this.columns[t]]=r}}trim(e){const t=new RegExp(" ","g");if(void 0===e)for(let e=0;e<this.columns.length;e++)for(let r=0;r<this.rows.length;r++){let i=this.rows[r].arr[e];i=i.replace(t,""),this.rows[r].arr[e]=i,this.rows[r].obj[this.columns[e]]=i}else if("string"==typeof e)for(let r=0;r<this.rows.length;r++){let i=this.rows[r].obj[e];i=i.replace(t,""),this.rows[r].obj[e]=i;const s=this.columns.indexOf(e);this.rows[r].arr[s]=i}else for(let r=0;r<this.rows.length;r++){let i=this.rows[r].arr[e];i=i.replace(t,""),this.rows[r].arr[e]=i,this.rows[r].obj[this.columns[e]]=i}}removeColumn(e){let t,r;"string"==typeof e?(t=e,r=this.columns.indexOf(e)):(r=e,t=this.columns[e]);const i=this.columns.splice(r+1,this.columns.length);this.columns.pop(),this.columns=this.columns.concat(i);for(let e=0;e<this.rows.length;e++){const i=this.rows[e].arr,s=i.splice(r+1,i.length);i.pop(),this.rows[e].arr=i.concat(s),delete this.rows[e].obj[t]}}set(e,t,r){this.rows[e].set(t,r)}setNum(e,t,r){this.rows[e].setNum(t,r)}setString(e,t,r){this.rows[e].setString(t,r)}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 r,i,s;for(let n=0;n<this.rows.length;n++)if(r=this.rows[n].obj,"string"==typeof e){if(i=this.columns.indexOf(e),!(i>=0))throw new Error(`This table has no column named "${e}"`);s=r[e],t[s]=r}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 r=this.table.columns.indexOf(e);if(!(r>=0))throw new Error(`This table has no column named "${e}"`);this.obj[e]=t,this.arr[r]=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 r=this.table.columns[e];this.obj[r]=t}}}setNum(e,t){const r=parseFloat(t);this.set(e,r)}setString(e,t){const r=t.toString();this.set(e,r)}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,r){return Math.max(Math.min(e,r),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,r){return r*(t-e)+e},t.log=Math.log,t.mag=function(e,t){return Math.hypot(e,t)},t.map=function(e,t,r,i,s,n){const a=(e-t)/(r-t)*(s-i)+i;return n?i<s?this.constrain(a,i,s):this.constrain(a,s,i):a},t.max=function(...e){const t=e=>{let t=-1/0;for(let r of e)t=Math.max(t,r);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 r of e)t=Math.min(t,r);return t};return e[0]instanceof Array?t(e[0]):t(e)},t.norm=function(e,t,r){return this.map(e,t,r,0,1)},t.pow=Math.pow,t.round=function(e,t){if(!t)return Math.round(e);const r=Math.pow(10,t);return Math.round(e*r)/r},t.sq=e=>e*e,t.sqrt=Math.sqrt,t.fract=function(e){let t=0,r=Number(e);if(isNaN(r)||Math.abs(r)===1/0)return r;if(r<0&&(r=-r,t=1),String(r).includes(".")&&!String(r).includes("e")){let e=String(r);return e=Number("0"+e.slice(e.indexOf("."))),Math.abs(t-e)}return r<1?Math.abs(t-r):0}}function Ua(e,t){const r=4095;let i=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<i;e++){let e=d+(f<<4)+(g<<8);h=n(m),u=n(y),l=a[e&r],l+=h*(a[e+1&r]-l),c=a[e+16&r],c+=h*(a[e+16+1&r]-c),l+=u*(c-l),e+=256,c=a[e&r],c+=h*(a[e+1&r]-c),p=a[e+16&r],p+=h*(a[e+16+1&r]-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&&(i=e),t>0&&(s=t)},t.noiseSeed=function(e){const t=(()=>{const e=4294967296;let t,r;return{setSeed(i){r=t=(null==i?Math.random()*e:i)>>>0},getSeed:()=>t,rand:()=>(r=(1664525*r+1013904223)%e,r/e)}})();t.setSeed(e),a=new Array(4096);for(let e=0;e<4096;e++)a[e]=t.rand()}}function Ga(e,t){const r="_lcg_random_state",i=4294967296;let s=0;t._lcg=function(e){return this[e]=(1664525*this[e]+1013904223)%i,this[e]/i},t._lcgSetSeed=function(e,t){this[e]=(null==t?Math.random()*i:t)>>>0},t.randomSeed=function(e){this._lcgSetSeed(r,e),this._gaussian_previous=!1},t.random=function(e,t){let i;if(i=null!=this[r]?this._lcg(r):Math.random(),void 0===e)return i;if(void 0===t)return e instanceof Array?e[Math.floor(i*e.length)]:i*e;if(e>t){const r=e;e=t,t=r}return i*(t-e)+e},t.randomGaussian=function(e,t=1){let r,i,n,a;if(this._gaussian_previous)r=s,this._gaussian_previous=!1;else{do{i=this.random(2)-1,n=this.random(2)-1,a=i*i+n*n}while(a>=1);a=Math.sqrt(-2*Math.log(a)/a),r=i*a,s=n*a,this._gaussian_previous=!0}return r*t+(e||0)}}function za(e,t){t.createVector=function(t,r,i){return this instanceof e?new e.Vector(this._fromRadians.bind(this),this._toRadians.bind(this),...arguments):new e.Vector(t,r,i)},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,r=10){return e===1/0||"Infinity"===e?1/0:e===-1/0||"-Infinity"===e?-1/0:"string"==typeof e?parseInt(e,r):"number"==typeof e?0|e:"boolean"==typeof e?e?1:0:e instanceof Array?e.map((e=>t.int(e,r))):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 r=t.int(e,10);return"number"==typeof r?(r+128)%256-128:r instanceof Array?r.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,r){if(r=null==r?r=8:r,e instanceof Array)return e.map((e=>t.hex(e,r)));if(e===1/0||e===-1/0){return(e===1/0?"F":"0").repeat(r)}if("number"==typeof e){e<0&&(e=4294967295+e+1);let t=Number(e).toString(16).toUpperCase();for(;t.length<r;)t=`0${t}`;return t.length>=r&&(t=t.substring(t.length-r,t.length)),t}},t.unhex=function(e){return e instanceof Array?e.map(t.unhex):parseInt(`0x${e}`,16)}}function $a(e,t){function r(e,t,r){let i=e<0;e=Math.abs(e);let[s,n]=e.toString().split(".");if(void 0===r){s=s.padStart(t,"0");let e=n?s+"."+n:s;return i?"-"+e:e}{let a=e.toFixed(r);[s,n]=a.toString().split("."),s=s.padStart(t,"0");let o=void 0===n?s:s+"."+n;return i?"-"+o:o}}function i(e,t){const r=(e=e.toString()).indexOf(".");let i=-1!==r?e.substring(r):"",s=-1!==r?e.substring(0,r):e;if(s=s.toString().replace(/\B(?=(\d{3})+(?!\d))/g,","),0===t)i="";else if(void 0!==t)if(t>i.length){i+=-1===r?".":"";const e=t-i.length+1;for(let t=0;t<e;t++)i+="0"}else i=i.substring(0,t+1);return s+i}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,i){if(e instanceof Array)return e.map((e=>r(e,t,i)));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]):r(e,t,i)},t.nfc=function(e,t){return e instanceof Array?e.map((e=>i(e,t))):i(e,t)},t.nfp=function(...e){const r=t.nf.apply(this,e);return r instanceof Array?r.map(s):s(r)},t.nfs=function(...e){const r=t.nf.apply(this,e);return r instanceof Array?r.map(n):n(r)},t.splitTokens=function(e,t){let r;if(void 0!==t){let e=t;const i=/\]/g.exec(e);let s=/\[/g.exec(e);s&&i?(e=e.slice(0,i.index)+e.slice(i.index+1),s=/\[/g.exec(e),e=e.slice(0,s.index)+e.slice(s.index+1),r=new RegExp(`[\\[${e}\\]]`,"g")):i?(e=e.slice(0,i.index)+e.slice(i.index+1),r=new RegExp(`[${e}\\]]`,"g")):s?(e=e.slice(0,s.index)+e.slice(s.index+1),r=new RegExp(`[${e}\\[]`,"g")):r=new RegExp(`[${e}]`,"g")}else r=/\s/g;return e.split(r).filter((e=>e))},t.shuffle=function(e,t){const r=ArrayBuffer&&ArrayBuffer.isView&&ArrayBuffer.isView(e);let i,s,n=(e=t||r?e:e.slice()).length;for(;n>1;)i=this.random(0,1)*n|0,s=e[--n],e[n]=e[i],e[i]=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,r,i){this._assert3d("orbitControl");const s=this._renderer.states.curCamera;void 0===e&&(e=1),void 0===t&&(t=e),void 0===r&&(r=1),"object"!=typeof i&&(i={}),!0!==this.contextMenuDisabled&&(this.canvas.oncontextmenu=()=>!1,this.contextMenuDisabled=!0),!0!==this.wheelDefaultDisabled&&(this.canvas.onwheel=()=>!1,this.wheelDefaultDisabled=!0);const{disableTouchActions:n=!0}=i;!0!==this.touchActionsDisabled&&n&&(this.canvas.style["touch-action"]="none",this.touchActionsDisabled=!0);const{freeRotation:a=!1}=i,o=[];this.touches.forEach((e=>{this._renderer.prevTouches.forEach((t=>{if(e.id===t.id){const r={x:e.x,y:e.y,px:t.x,py:t.y};o.push(r)}}))})),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 r=o[0];u=-e*(r.x-r.px)/f,l=t*(r.y-r.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))*r*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)*r,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,r=s.eyeY-s.centerY,i=s.eyeZ-s.centerZ,n=Math.sqrt(t*t+r*r+i*i);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,r,i,s){void 0===e&&(e=this.width/2),void 0===t&&(t=Math.round(e/30)<4?4:Math.round(e/30)),void 0===r&&(r=0),void 0===i&&(i=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+r,i,e*n-a+s),this.vertex(+a+r,i,e*n-a+s),this.endShape();for(let e=0;e<=t;e++)this.beginShape(this.LINES),this.vertex(e*n-a+r,i,-a+s),this.vertex(e*n-a+r,i,+a+s),this.endShape();this.pop()}},t._axesIcon=function(e,t,r,i){return void 0===e&&(e=this.width/20>40?this.width/20:40),void 0===t&&(t=-this.width/4),void 0===r&&(r=t),void 0===i&&(i=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,r,i),this.vertex(t+e,r,i),this.endShape(),this.stroke(0,255,0),this.beginShape(this.LINES),this.vertex(t,r,i),this.vertex(t,r+e,i),this.endShape(),this.stroke(0,0,255),this.beginShape(this.LINES),this.vertex(t,r,i),this.vertex(t,r,i+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 r(e){let t=null,r={};const{data:i}=await Os(e,"text"),s=i.split("\n");for(let e=0;e<s.length;++e){const i=s[e].trim().split(/\s+/);if("newmtl"===i[0]){t=i[1],r[t]={}}else"Kd"===i[0]?r[t].diffuseColor=[parseFloat(i[1]),parseFloat(i[2]),parseFloat(i[3])]:"Ka"===i[0]?r[t].ambientColor=[parseFloat(i[1]),parseFloat(i[2]),parseFloat(i[3])]:"Ks"===i[0]?r[t].specularColor=[parseFloat(i[1]),parseFloat(i[2]),parseFloat(i[3])]:"map_Kd"===i[0]&&(r[t].texturePath=i[1])}return r}function i(e,t,r={}){const i={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]));i[u[0]].push(e)}else if("vt"===u[0]){const e=[parseFloat(u[1]),1-parseFloat(u[2])];i[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(i.v[p[0]].copy()),e.uvs.push(i.vt[p[1]]?i.vt[p[1]].slice():[0,0]),e.vertexNormals.push(i.vn[p[2]]?i.vn[p[2]].copy():new je),s[c][n]=t,h.push(t),n&&r[n]&&r[n].diffuseColor){a=!0;const t=r[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),r=[115,111,108,105,100];for(let e=0;e<5;e++)if(n(r,t,e))return!1;return!0}(t))!function(e,t){const r=new DataView(t),i=r.getUint32(80,!0);let s,n,a,o,h,u,l,c=!1;for(let e=0;e<70;e++)1129270351===r.getUint32(e,!1)&&82===r.getUint8(e+4)&&61===r.getUint8(e+5)&&(c=!0,o=[],h=r.getUint8(e+6)/255,u=r.getUint8(e+7)/255,l=r.getUint8(e+8)/255);const p=84,d=50;for(let t=0;t<i;t++){const i=p+t*d,f=r.getFloat32(i,!0),g=r.getFloat32(i+4,!0),m=r.getFloat32(i+8,!0);if(c){const e=r.getUint16(i+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=i+12*t,u=new je(r.getFloat32(h,!0),r.getFloat32(h+4,!0),r.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 r=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 r,i,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"`);r=new je(parseFloat(h[2]),parseFloat(h[3]),parseFloat(h[4])),e.vertexNormals.push(r,r,r),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])i=new je(parseFloat(h[1]),parseFloat(h[2]),parseFloat(h[3])),e.vertices.push(i),e.uvs.push([0,0]),n.push(e.vertices.indexOf(i));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"`);r=new je(parseFloat(h[2]),parseFloat(h[3]),parseFloat(h[4])),e.vertexNormals.push(r,r,r),s="facet normal"}break;default:console.error(`Invalid state "${s}"`)}}}(e,new TextDecoder("utf-8").decode(r).split("\n"))}return e}function n(e,t,r){for(let i=0,s=e.length;i<s;i++)if(e[i]!==t.getUint8(r+i,!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 i=[];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;i.push(Ha(s).then((e=>e?r(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(i);return Object.assign({},...e)}catch(e){return{}}}(s);return i(c,s,n),a&&c.normalize(),u&&c.flipU(),l&&c.flipV(),c._makeTriangleEdges(),o?o(c):c}}catch(r){if(e._friendlyFileLoadError(3,t),h)return h(r);throw r}},t.model=function(e,t=1){this._assert3d("model"),this._renderer.model(e,t)};let a=0;t.createModel=function(t,r=" ",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=`${r}|${u}|${a++}`,r.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(r.match(/\.obj$/i))try{i(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 ro(e,t){const r=/\r?\n/g,i=/,\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((r=>{t[r]=function(...e){if(!(r in xs.prototype))throw Error(`Renderer2D.prototype.${r} is not defined.`);return this._renderer[r](...e)},e.Graphics.prototype[r]=function(...e){return this._renderer[r](...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,r,i,s){let n=this.textDrawingContext().textBaseline;({x:t,y:r,width:i,height:s}=this._handleRectMode(t,r,i,s));let a=this._processLines(e,i,s);a=this._positionLines(t,r,i,s,a),a.forEach((e=>this._renderText(e.text,e.x,e.y))),this.textDrawingContext().textBaseline=n},xs.prototype.textBounds=function(e,t,r,i,s){return this._computeBounds(Ka,e,t,r,i,s).bounds},xs.prototype.fontBounds=function(e,t,r,i,s){return this._computeBounds(Ja,e,t,r,i,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,r){return void 0!==e?(this.states.setValue("textAlign",e),void 0!==r&&(r===t.CENTER&&(r=Za),this.states.setValue("textBaseline",r)),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,r,i){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===r&&/[.0-9]+(%|em|p[xt])/.test(s)&&({family:s,size:r}=this._directSetFontString(s)),"string"!=typeof s)throw Error("null font in textFont()");return 2===arguments.length&&"object"==typeof r&&(i=r,r=void 0),this.states.setValue("textFont",{font:t,family:s,size:r}),void 0!==r&&this._setTextSize(r),"object"==typeof i&&this.textProperties(i),this._applyTextProperties()},xs.prototype._directSetFontString=function(e,t=0){t&&console.log('_directSetFontString"'+e+'"');let r=u.reduce(((e,t)=>(e[t]=o[t].default,e)),{}),i=this._cachedDiv(r);i.style.font=e;let s=getComputedStyle(i);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,r){let i=!1,s=r?.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,i=!0,s&&console.log("this.states."+e+'="'+options[e]+'"')):e in this.textDrawingContext()?(this._setContextProperty(e,t,s),i=!0):e in this.textCanvas().style?(this._setCanvasStyleProperty(e,t,s),i=!0):console.warn('Ignoring unknown text option: "'+e+'"\n'),i?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,r)=>(e[r]=t[r],e)),{}),Object.keys(o).forEach((r=>{if("Context2d"===o[r]?.type)e[r]=t[r];else if("textFont"===r){let t=this._currentTextFont();"object"==typeof t&&"_pInst"in t&&(t=Object.assign({},t),delete t._pInst),e[r]=t}else e[r]=this.states[r]})),e},xs.prototype.textMode=function(){},xs.prototype._currentTextFont=function(){return this.states.textFont.font||this.states.textFont.family},xs.prototype._computeBounds=function(t,r,i,s,n,a,o){let h=this.textDrawingContext(),u=h.textBaseline,{textLeading:l,textAlign:c}=this.states;({width:n,height:a}=this._rectModeAdjust(i,s,n,a));let p=this._processLines(r,n,a),d=p.map(((e,r)=>this[t].bind(this)(e,i,s+r*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,r,i,s){if(void 0!==i)switch(this.states.rectMode){case t.CENTER:break;case t.CORNERS:i-=e,s-=r;break;case t.RADIUS:i*=2,s*=2}return{x:e,y:r,width:i,height:s}},xs.prototype._setCanvasStyleProperty=function(e,t,r){let i=t.toString();r&&console.log("canvas.style."+e+'="'+i+'"'),"fontVariationSettings"===e&&this._handleFontVariationSettings(i),this.textCanvas().style[e]=i,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(i).forEach((e=>{e=e.replace(/["']/g,"");let r=a.exec(e);if(r&&r.length){let i=r[0],s=parseFloat(parseFloat(e.replace(i,"").trim()).toFixed(3));switch(i){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,r=!1){if(this.textDrawingContext()[e]===t)return this._pInst;(c??=[]).push([e,t]),r&&console.log("queued context2d."+e+'="'+t+'"')},xs.prototype._handleRectMode=function(e,r,i,s){let n=this.states.rectMode;if(void 0!==i)switch(n){case t.RADIUS:e-=(i*=2)/2,void 0!==s&&(r-=(s*=2)/2);break;case t.CENTER:e-=i/2,void 0!==s&&(r-=s/2);break;case t.CORNERS:i-=e,void 0!==s&&(s-=r)}return{x:e,y:r,width:i,height:s}},xs.prototype._fontSizePx=function(e,{family:t}=this.states.textFont){if(r=e,!isNaN(r)&&""!==r.trim())return parseFloat(e);var r;let i=this._cachedDiv({fontSize:e});i.style.fontSize=e,i.style.fontFamily=t;let s=getComputedStyle(i).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,r])=>{t.style[e]=r})),this.textCanvas().appendChild(t),p=t}return p},xs.prototype._aggregateBounds=function(e){let t=Math.min(...e.map((e=>e.x))),r=Math.min(...e.map((e=>e.y))),i=Math.max(...e.map((e=>e.y+e.h))),s=Math.max(...e.map((e=>e.x+e.w)));return{x:t,y:r,w:s-t,h:i-r}},xs.prototype._processLines=function(e,r,i){if(void 0!==r){this.textDrawingContext().textBaseline===t.BASELINE&&(this.drawingContext.textBaseline=t.TOP)}let s=this._splitOnBreaks(e.toString()),n=s.length>1,a=void 0!==r,o=a&&s.some((e=>this._textWidthSingle(e)>r)),{textLeading:h,textWrap:u}=this.states;if((n||o)&&a&&(s=this._lineate(u,s,r)),a&&void 0!==i){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)>i){s=s.slice(0,e);break}}}return s},xs.prototype._xAlignOffset=function(e,r){switch(e){case t.LEFT:return 0;case t.CENTER:return r/2;case t.RIGHT:return r;case eo:return 0;case to:throw new Error("textBounds: END not yet supported for textAlign");default:return 0}},xs.prototype._rectModeAlign=function(e,r,i){if(void 0!==r){switch(this.states.rectMode){case t.CENTER:e.x-=(r-e.w)/2,e.y-=(i-e.h)/2;break;case t.CORNERS:e.w+=e.x,e.h+=e.y;break;case t.RADIUS:e.x-=(r-e.w)/2,e.y-=(i-e.h)/2,e.w/=2,e.h/=2}return e}},xs.prototype._rectModeAlignRevert=function(e,r,i){if(void 0!==r){switch(this.states.rectMode){case t.CENTER:e.x+=(r-e.w)/2,e.y+=(i-e.h)/2;break;case t.CORNERS:e.w-=e.x,e.h-=e.y;break;case t.RADIUS:e.x+=(r-e.w)/2,e.y+=(i-e.h)/2,e.w*=2,e.h*=2}return e}},xs.prototype._textWidthSingle=function(e){let t=this.textDrawingContext().measureText(e),r=t.actualBoundingBoxLeft;return t.actualBoundingBoxRight+r},xs.prototype._fontWidthSingle=function(e){return this.textDrawingContext().measureText(e).width},xs.prototype._textBoundsSingle=function(e,t=0,r=0){let i=this.textDrawingContext().measureText(e),s=i.actualBoundingBoxAscent,n=i.actualBoundingBoxDescent,a=i.actualBoundingBoxLeft;return{x:t-a,y:r-s,w:i.actualBoundingBoxRight+a,h:s+n}},xs.prototype._fontBoundsSingle=function(e,t=0,r=0){let i=this.textDrawingContext().measureText(e),s=i.fontBoundingBoxAscent,n=i.fontBoundingBoxDescent;return{x:t-=this._xAlignOffset(this.states.textAlign,i.width),y:r-s,w:i.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,r,i=1/0,s={}){let n,a,o,h,u=s.splitChar??(e===t.WORD?" ":""),l=[];for(let e=0;e<r.length;e++){n="",h=r[e].split(u);for(let e=0;e<h.length;e++)a=`${n+h[e]}`+u,o=this._textWidthSingle(a),n.length>0&&o>i?(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(r):[""]},xs.prototype._parseFontFamily=function(e){return e.split(i).map((e=>((e=e.trim()).indexOf(" ")>-1&&!s.test(e)&&(e=`"${e}"`),e))).join(", ")},xs.prototype._applyFontString=function(){let{textFont:e,textSize:r,lineHeight:i,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}${`${r}px`+(i!==t.NORMAL?`/${i} `:" ")}${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 r=this.states.fontStretch;for(l.includes(r)&&t.fontStretch!==r&&(t.fontStretch=r);c?.length;){let[r,i]=c.shift();e&&console.log('apply context property "'+r+'" = "'+i+'"'),t[r]=i,t[r]!==i&&(console.warn(`Unable to set '${r}' property on context2d. It may not be supported.`),console.log('Expected "'+i+'" but got: "'+t[r]+'"'))}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,r,i,s){let n=this.states,a=this.textDrawingContext();r<s||r>=i||(this.push(),n.strokeColor&&n.strokeSet&&a.strokeText(e,t,r),!this._clipping&&n.fillColor&&(n.fillSet||this._setFill("#000000"),a.fillText(e,t,r)),this.pop())},e.Renderer2D.prototype._positionLines=function(e,r,i,s,n){let a,{textLeading:o,textAlign:h}=this.states,u=new Array(n.length),l=void 0===i?0:i,c=void 0===s?0:s;for(let i=0;i<n.length;i++){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[i]={text:n[i],x:a,y:r+i*o}}return this._yAlignOffset(u,c)},e.Renderer2D.prototype._yAlignOffset=function(e,r){if(void 0===r)throw Error("_yAlignOffset: height is required");let{textLeading:i,textBaseline:s}=this.states,n=0,a=r-i*(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 r=e.RendererGL.prototype.remove;e.RendererGL.prototype.remove=function(){this._textCanvas&&this._textCanvas.parentElement.removeChild(this._textCanvas),r.call(this)},e.RendererGL.prototype._positionLines=function(e,r,i,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===i?Math.max(0,...h):i,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+(i||0)/2;break;case t.RIGHT:u=e+c-h[s]-c+(i||0);break;case to:throw new Error("textBounds: END not yet supported for textAlign")}l[s]={text:n[s],x:u,y:r+s*a}}return this._yAlignOffset(l,p)},e.RendererGL.prototype._yAlignOffset=function(e,r){if(void 0===r)throw Error("_yAlignOffset: height is required");let{textLeading:i,textBaseline:s,textSize:n}=this.states,a=0,o=e.length,h=n*o+(i-n)*(o-1);switch(s){case t.TOP:a=n;break;case t.BASELINE:break;case Za:a=-h/2+n+(r||0)/2;break;case t.BOTTOM:a=-(h-n)+(r||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&&ro(p5,p5.prototype);var io={};Object.defineProperty(io,"__esModule",{value:!0});var so=function(){function e(){}return e.parse=function(t){for(var r=new Set,i=0,s=t;i<s.length;i++){var n=s[i];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];r.add(f)}else r.add(parseInt(o,16))}if(h&&u){var g=parseInt(h,16),m=parseInt(u,16);for(f=g;f<=m;f++)r.add(f)}}return Array.from(r).sort((function(e,t){return e-t}))},e.stringify=function(t){for(var r,i=Array.from(new Set(t)).sort((function(e,t){return e-t})),s=[],n=0;n<i.length;n++){var a=i[n],o=i[n-1];r&&a-o!=1&&(s.push(e.rangeString(r,o)),r=a),r||(r=a),n===i.length-1&&(r===a?s.push(e.rangeString(a)):s.push(e.rangeString(r,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=io.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,r,i)=>{let s=65535&e,n=e>>>16&65535,a=0;for(;0!==r;){a=r>2e3?2e3:r,r-=a;do{s=s+t[i++]|0,n=n+s|0}while(--a);s%=65521,n%=65521}return s|n<<16};const uo=new Uint32Array((()=>{let e,t=[];for(var r=0;r<256;r++){e=r;for(var i=0;i<8;i++)e=1&e?3988292384^e>>>1:e>>>1;t[r]=e}return t})());var lo=(e,t,r,i)=>{const s=uo,n=i+r;e^=-1;for(let r=i;r<n;r++)e=e>>>8^s[255&(e^t[r])];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 r=t.shift();if(r){if("object"!=typeof r)throw new TypeError(r+"must be non-object");for(const t in r)fo(r,t)&&(e[t]=r[t])}}return e},mo=e=>{let t=0;for(let r=0,i=e.length;r<i;r++)t+=e[r].length;const r=new Uint8Array(t);for(let t=0,i=0,s=e.length;t<s;t++){let s=e[t];r.set(s,i),i+=s.length}return r};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,r,i,s,n,a=e.length,o=0;for(s=0;s<a;s++)r=e.charCodeAt(s),55296==(64512&r)&&s+1<a&&(i=e.charCodeAt(s+1),56320==(64512&i)&&(r=65536+(r-55296<<10)+(i-56320),s++)),o+=r<128?1:r<2048?2:r<65536?3:4;for(t=new Uint8Array(o),n=0,s=0;n<o;s++)r=e.charCodeAt(s),55296==(64512&r)&&s+1<a&&(i=e.charCodeAt(s+1),56320==(64512&i)&&(r=65536+(r-55296<<10)+(i-56320),s++)),r<128?t[n++]=r:r<2048?(t[n++]=192|r>>>6,t[n++]=128|63&r):r<65536?(t[n++]=224|r>>>12,t[n++]=128|r>>>6&63,t[n++]=128|63&r):(t[n++]=240|r>>>18,t[n++]=128|r>>>12&63,t[n++]=128|r>>>6&63,t[n++]=128|63&r);return t},bo=(e,t)=>{const r=t||e.length;if("function"==typeof TextDecoder&&TextDecoder.prototype.decode)return(new TextDecoder).decode(e.subarray(0,t));let i,s;const n=new Array(2*r);for(s=0,i=0;i<r;){let t=e[i++];if(t<128){n[s++]=t;continue}let a=xo[t];if(a>4)n[s++]=65533,i+=a-1;else{for(t&=2===a?31:3===a?15:7;a>1&&i<r;)t=t<<6|63&e[i++],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 r="";for(let i=0;i<t;i++)r+=String.fromCharCode(e[i]);return r})(n,s)},_o=(e,t)=>{(t=t||e.length)>e.length&&(t=e.length);let r=t-1;for(;r>=0&&128==(192&e[r]);)r--;return r<0||0===r?t:r+xo[e[r]]>t?r: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 r,i,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;r=e.next_in,D=e.input,i=r+(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[r++]<<d,d+=8,p+=D[r++]<<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[r++]<<d,d+=8),b+=p&(1<<v)-1,p>>>=v,d-=v),d<15&&(p+=D[r++]<<d,d+=8,p+=D[r++]<<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[r++]<<d,d+=8,d<v&&(p+=D[r++]<<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(r<i&&s<a);b=d>>3,r-=b,d-=b<<3,p&=(1<<d)-1,e.next_in=r,e.next_out=s,e.avail_in=r<i?i-r+5:5-(r-i),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,r,i,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<i;m++)A[t[r+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<i;m++)0!==t[r+m]&&(a[S[t[r+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[r+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)},rh=(e,t)=>{let r;if(Qo(e))return No;const i=e.state;return t<0?(r=0,t=-t):(r=5+(t>>4),t<48&&(t&=15)),t&&(t<8||t>15)?No:(null!==i.window&&i.wbits!==t&&(i.window=null),i.wrap=r,i.wbits=t,th(e))},ih=(e,t)=>{if(!e)return No;const r=new Jo;e.state=r,r.strm=e,r.window=null,r.mode=zo;const i=rh(e,t);return i!==Lo&&(e.state=null),i};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,r,i)=>{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)),i>=n.wsize?(n.window.set(t.subarray(r-n.wsize,r),0),n.wnext=0,n.whave=n.wsize):(s=n.wsize-n.wnext,s>i&&(s=i),n.window.set(t.subarray(r-i,r-i+s),n.wnext),(i-=s)?(n.window.set(t.subarray(r-i,r),0),n.wnext=i,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 r,i,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;r=e.state,r.mode===$o&&(r.mode=Wo),a=e.next_out,s=e.output,h=e.avail_out,n=e.next_in,i=e.input,o=e.avail_in,u=r.hold,l=r.bits,c=o,p=h,C=Lo;e:for(;;)switch(r.mode){case zo:if(0===r.wrap){r.mode=Wo;break}for(;l<16;){if(0===o)break e;o--,u+=i[n++]<<l,l+=8}if(2&r.wrap&&35615===u){0===r.wbits&&(r.wbits=15),r.check=0,E[0]=255&u,E[1]=u>>>8&255,r.check=lo(r.check,E,2,0),u=0,l=0,r.mode=16181;break}if(r.head&&(r.head.done=!1),!(1&r.wrap)||(((255&u)<<8)+(u>>8))%31){e.msg="incorrect header check",r.mode=Zo;break}if((15&u)!==Go){e.msg="unknown compression method",r.mode=Zo;break}if(u>>>=4,l-=4,w=8+(15&u),0===r.wbits&&(r.wbits=w),w>15||w>r.wbits){e.msg="invalid window size",r.mode=Zo;break}r.dmax=1<<r.wbits,r.flags=0,e.adler=r.check=1,r.mode=512&u?16189:$o,u=0,l=0;break;case 16181:for(;l<16;){if(0===o)break e;o--,u+=i[n++]<<l,l+=8}if(r.flags=u,(255&r.flags)!==Go){e.msg="unknown compression method",r.mode=Zo;break}if(57344&r.flags){e.msg="unknown header flags set",r.mode=Zo;break}r.head&&(r.head.text=u>>8&1),512&r.flags&&4&r.wrap&&(E[0]=255&u,E[1]=u>>>8&255,r.check=lo(r.check,E,2,0)),u=0,l=0,r.mode=16182;case 16182:for(;l<32;){if(0===o)break e;o--,u+=i[n++]<<l,l+=8}r.head&&(r.head.time=u),512&r.flags&&4&r.wrap&&(E[0]=255&u,E[1]=u>>>8&255,E[2]=u>>>16&255,E[3]=u>>>24&255,r.check=lo(r.check,E,4,0)),u=0,l=0,r.mode=16183;case 16183:for(;l<16;){if(0===o)break e;o--,u+=i[n++]<<l,l+=8}r.head&&(r.head.xflags=255&u,r.head.os=u>>8),512&r.flags&&4&r.wrap&&(E[0]=255&u,E[1]=u>>>8&255,r.check=lo(r.check,E,2,0)),u=0,l=0,r.mode=16184;case 16184:if(1024&r.flags){for(;l<16;){if(0===o)break e;o--,u+=i[n++]<<l,l+=8}r.length=u,r.head&&(r.head.extra_len=u),512&r.flags&&4&r.wrap&&(E[0]=255&u,E[1]=u>>>8&255,r.check=lo(r.check,E,2,0)),u=0,l=0}else r.head&&(r.head.extra=null);r.mode=16185;case 16185:if(1024&r.flags&&(d=r.length,d>o&&(d=o),d&&(r.head&&(w=r.head.extra_len-r.length,r.head.extra||(r.head.extra=new Uint8Array(r.head.extra_len)),r.head.extra.set(i.subarray(n,n+d),w)),512&r.flags&&4&r.wrap&&(r.check=lo(r.check,i,d,n)),o-=d,n+=d,r.length-=d),r.length))break e;r.length=0,r.mode=16186;case 16186:if(2048&r.flags){if(0===o)break e;d=0;do{w=i[n+d++],r.head&&w&&r.length<65536&&(r.head.name+=String.fromCharCode(w))}while(w&&d<o);if(512&r.flags&&4&r.wrap&&(r.check=lo(r.check,i,d,n)),o-=d,n+=d,w)break e}else r.head&&(r.head.name=null);r.length=0,r.mode=16187;case 16187:if(4096&r.flags){if(0===o)break e;d=0;do{w=i[n+d++],r.head&&w&&r.length<65536&&(r.head.comment+=String.fromCharCode(w))}while(w&&d<o);if(512&r.flags&&4&r.wrap&&(r.check=lo(r.check,i,d,n)),o-=d,n+=d,w)break e}else r.head&&(r.head.comment=null);r.mode=16188;case 16188:if(512&r.flags){for(;l<16;){if(0===o)break e;o--,u+=i[n++]<<l,l+=8}if(4&r.wrap&&u!==(65535&r.check)){e.msg="header crc mismatch",r.mode=Zo;break}u=0,l=0}r.head&&(r.head.hcrc=r.flags>>9&1,r.head.done=!0),e.adler=r.check=0,r.mode=$o;break;case 16189:for(;l<32;){if(0===o)break e;o--,u+=i[n++]<<l,l+=8}e.adler=r.check=Ko(u),u=0,l=0,r.mode=jo;case jo:if(0===r.havedict)return e.next_out=a,e.avail_out=h,e.next_in=n,e.avail_in=o,r.hold=u,r.bits=l,Oo;e.adler=r.check=1,r.mode=$o;case $o:if(t===Io||t===Bo)break e;case Wo:if(r.last){u>>>=7&l,l-=7&l,r.mode=Yo;break}for(;l<3;){if(0===o)break e;o--,u+=i[n++]<<l,l+=8}switch(r.last=1&u,u>>>=1,l-=1,3&u){case 0:r.mode=16193;break;case 1:if(oh(r),r.mode=Ho,t===Bo){u>>>=2,l-=2;break e}break;case 2:r.mode=16196;break;case 3:e.msg="invalid block type",r.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+=i[n++]<<l,l+=8}if((65535&u)!=(u>>>16^65535)){e.msg="invalid stored block lengths",r.mode=Zo;break}if(r.length=65535&u,u=0,l=0,r.mode=qo,t===Bo)break e;case qo:r.mode=16195;case 16195:if(d=r.length,d){if(d>o&&(d=o),d>h&&(d=h),0===d)break e;s.set(i.subarray(n,n+d),a),o-=d,n+=d,h-=d,a+=d,r.length-=d;break}r.mode=$o;break;case 16196:for(;l<14;){if(0===o)break e;o--,u+=i[n++]<<l,l+=8}if(r.nlen=257+(31&u),u>>>=5,l-=5,r.ndist=1+(31&u),u>>>=5,l-=5,r.ncode=4+(15&u),u>>>=4,l-=4,r.nlen>286||r.ndist>30){e.msg="too many length or distance symbols",r.mode=Zo;break}r.have=0,r.mode=16197;case 16197:for(;r.have<r.ncode;){for(;l<3;){if(0===o)break e;o--,u+=i[n++]<<l,l+=8}r.lens[F[r.have++]]=7&u,u>>>=3,l-=3}for(;r.have<19;)r.lens[F[r.have++]]=0;if(r.lencode=r.lendyn,r.lenbits=7,A={bits:r.lenbits},C=Mo(0,r.lens,0,19,r.lencode,0,r.work,A),r.lenbits=A.bits,C){e.msg="invalid code lengths set",r.mode=Zo;break}r.have=0,r.mode=16198;case 16198:for(;r.have<r.nlen+r.ndist;){for(;D=r.lencode[u&(1<<r.lenbits)-1],m=D>>>24,y=D>>>16&255,x=65535&D,!(m<=l);){if(0===o)break e;o--,u+=i[n++]<<l,l+=8}if(x<16)u>>>=m,l-=m,r.lens[r.have++]=x;else{if(16===x){for(S=m+2;l<S;){if(0===o)break e;o--,u+=i[n++]<<l,l+=8}if(u>>>=m,l-=m,0===r.have){e.msg="invalid bit length repeat",r.mode=Zo;break}w=r.lens[r.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+=i[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+=i[n++]<<l,l+=8}u>>>=m,l-=m,w=0,d=11+(127&u),u>>>=7,l-=7}if(r.have+d>r.nlen+r.ndist){e.msg="invalid bit length repeat",r.mode=Zo;break}for(;d--;)r.lens[r.have++]=w}}if(r.mode===Zo)break;if(0===r.lens[256]){e.msg="invalid code -- missing end-of-block",r.mode=Zo;break}if(r.lenbits=9,A={bits:r.lenbits},C=Mo(1,r.lens,0,r.nlen,r.lencode,0,r.work,A),r.lenbits=A.bits,C){e.msg="invalid literal/lengths set",r.mode=Zo;break}if(r.distbits=6,r.distcode=r.distdyn,A={bits:r.distbits},C=Mo(2,r.lens,r.nlen,r.ndist,r.distcode,0,r.work,A),r.distbits=A.bits,C){e.msg="invalid distances set",r.mode=Zo;break}if(r.mode=Ho,t===Bo)break e;case Ho:r.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,r.hold=u,r.bits=l,Do(e,p),a=e.next_out,s=e.output,h=e.avail_out,n=e.next_in,i=e.input,o=e.avail_in,u=r.hold,l=r.bits,r.mode===$o&&(r.back=-1);break}for(r.back=0;D=r.lencode[u&(1<<r.lenbits)-1],m=D>>>24,y=D>>>16&255,x=65535&D,!(m<=l);){if(0===o)break e;o--,u+=i[n++]<<l,l+=8}if(y&&!(240&y)){for(v=m,b=y,_=x;D=r.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+=i[n++]<<l,l+=8}u>>>=v,l-=v,r.back+=v}if(u>>>=m,l-=m,r.back+=m,r.length=x,0===y){r.mode=16205;break}if(32&y){r.back=-1,r.mode=$o;break}if(64&y){e.msg="invalid literal/length code",r.mode=Zo;break}r.extra=15&y,r.mode=16201;case 16201:if(r.extra){for(S=r.extra;l<S;){if(0===o)break e;o--,u+=i[n++]<<l,l+=8}r.length+=u&(1<<r.extra)-1,u>>>=r.extra,l-=r.extra,r.back+=r.extra}r.was=r.length,r.mode=16202;case 16202:for(;D=r.distcode[u&(1<<r.distbits)-1],m=D>>>24,y=D>>>16&255,x=65535&D,!(m<=l);){if(0===o)break e;o--,u+=i[n++]<<l,l+=8}if(!(240&y)){for(v=m,b=y,_=x;D=r.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+=i[n++]<<l,l+=8}u>>>=v,l-=v,r.back+=v}if(u>>>=m,l-=m,r.back+=m,64&y){e.msg="invalid distance code",r.mode=Zo;break}r.offset=x,r.extra=15&y,r.mode=16203;case 16203:if(r.extra){for(S=r.extra;l<S;){if(0===o)break e;o--,u+=i[n++]<<l,l+=8}r.offset+=u&(1<<r.extra)-1,u>>>=r.extra,l-=r.extra,r.back+=r.extra}if(r.offset>r.dmax){e.msg="invalid distance too far back",r.mode=Zo;break}r.mode=16204;case 16204:if(0===h)break e;if(d=p-h,r.offset>d){if(d=r.offset-d,d>r.whave&&r.sane){e.msg="invalid distance too far back",r.mode=Zo;break}d>r.wnext?(d-=r.wnext,f=r.wsize-d):f=r.wnext-d,d>r.length&&(d=r.length),g=r.window}else g=s,f=a-r.offset,d=r.length;d>h&&(d=h),h-=d,r.length-=d;do{s[a++]=g[f++]}while(--d);0===r.length&&(r.mode=Xo);break;case 16205:if(0===h)break e;s[a++]=r.length,h--,r.mode=Xo;break;case Yo:if(r.wrap){for(;l<32;){if(0===o)break e;o--,u|=i[n++]<<l,l+=8}if(p-=h,e.total_out+=p,r.total+=p,4&r.wrap&&p&&(e.adler=r.check=r.flags?lo(r.check,s,p,a-p):ho(r.check,s,p,a-p)),p=h,4&r.wrap&&(r.flags?u:Ko(u))!==r.check){e.msg="incorrect data check",r.mode=Zo;break}u=0,l=0}r.mode=16207;case 16207:if(r.wrap&&r.flags){for(;l<32;){if(0===o)break e;o--,u+=i[n++]<<l,l+=8}if(4&r.wrap&&u!==(4294967295&r.total)){e.msg="incorrect length check",r.mode=Zo;break}u=0,l=0}r.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,r.hold=u,r.bits=l,(r.wsize||p!==e.avail_out&&r.mode<Zo&&(r.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,r.total+=p,4&r.wrap&&p&&(e.adler=r.check=r.flags?lo(r.check,s,p,e.next_out-p):ho(r.check,s,p,e.next_out-p)),e.data_type=r.bits+(r.last?64:0)+(r.mode===$o?128:0)+(r.mode===Ho||r.mode===qo?256:0),(0===c&&0===p||t===ko)&&C===Lo&&(C=Uo),C},lh={inflateReset:th,inflateReset2:rh,inflateResetKeep:eh,inflateInit:e=>ih(e,15),inflateInit2:ih,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 r=e.state;return 2&r.wrap?(r.head=t,t.done=!1,Lo):No},inflateSetDictionary:(e,t)=>{const r=t.length;let i,s,n;return Qo(e)?No:(i=e.state,0!==i.wrap&&i.mode!==jo?No:i.mode===jo&&(s=1,s=ho(s,t,r,0),s!==i.check)?Ro:(n=hh(e,t,r,r),n?(i.mode=16210,Vo):(i.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 r=lh.inflateInit2(this.strm,t.windowBits);if(r!==gh)throw new Error(co[r]);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&&(r=lh.inflateSetDictionary(this.strm,t.dictionary),r!==gh)))throw new Error(co[r])}_h.prototype.push=function(e,t){const r=this.strm,i=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)?r.input=new Uint8Array(e):r.input=e,r.next_in=0,r.avail_in=r.input.length;;){for(0===r.avail_out&&(r.output=new Uint8Array(i),r.next_out=0,r.avail_out=i),n=lh.inflate(r,a),n===yh&&s&&(n=lh.inflateSetDictionary(r,s),n===gh?n=lh.inflate(r,a):n===vh&&(n=yh));r.avail_in>0&&n===mh&&r.state.wrap>0&&0!==e[r.next_in];)lh.inflateReset(r),n=lh.inflate(r,a);switch(n){case xh:case vh:case yh:case bh:return this.onEnd(n),this.ended=!0,!1}if(o=r.avail_out,r.next_out&&(0===r.avail_out||n===mh))if("string"===this.options.to){let e=_o(r.output,r.next_out),t=r.next_out-e,s=bo(r.output,e);r.next_out=t,r.avail_out=i-t,t&&r.output.set(r.output.subarray(e,e+t),0),this.onData(s)}else this.onData(r.output.length===r.next_out?r.output:r.output.subarray(0,r.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===r.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 r=new _h(t);if(r.push(e),r.err)throw r.msg||co[r.err];return r.result}};const{inflate:Ch}=wh;const Dh={inflate:Ch};var Eh,Ah={};Ah.parse=function(e){var t=Ah.B,r=function(e,t,r,i){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:r};for(var o in n){var h=Ah.findTable(e,o,r);if(h){var u=h[0],l=i[u];null==l&&(l=n[o].parseTab(e,u,h[1],a)),a[o]=i[u]=l}}return a};var i=new Uint8Array(e);let s;119==i[0]&&(s=i,i=function(e){var r=t.readUshort(e,12),i=t.readUint(e,16),s=new Uint8Array(i),n=12+16*r;t.writeASCII(s,0,"OTTO"),t.writeUshort(s,4,r);for(var a=44,o=0;o<r;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}(i));var n={};if("ttcf"==t.readASCII(i,0,4)){var a=4;t.readUshort(i,a),a+=2,t.readUshort(i,a),a+=2;var o=t.readUint(i,a);a+=4;for(var h=[],u=0;u<o;u++){var l=t.readUint(i,a);a+=4,h.push(r(i,u,l,n))}return h}var c=r(i,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,r){for(var i=Ah.B,s=i.readUshort(e,r+4),n=r+12,a=0;a<s;a++){var o=i.readASCII(e,n,4);i.readUint(e,n+4);var h=i.readUint(e,n+8),u=i.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 r=Ah.B.t.uint8;return r[0]=e[t+3],r[1]=e[t+2],r[2]=e[t+1],r[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,r){e[t]=r>>8&255,e[t+1]=255&r},readUshorts:function(e,t,r){for(var i=[],s=0;s<r;s++){var n=Ah.B.readUshort(e,t+2*s);i.push(n)}return i},readUint:function(e,t){var r=Ah.B.t.uint8;return r[3]=e[t],r[2]=e[t+1],r[1]=e[t+2],r[0]=e[t+3],Ah.B.t.uint32[0]},writeUint:function(e,t,r){e[t]=r>>24&255,e[t+1]=r>>16&255,e[t+2]=r>>8&255,e[t+3]=255&r},readUint64:function(e,t){return 4294967296*Ah.B.readUint(e,t)+Ah.B.readUint(e,t+4)},readASCII:function(e,t,r){for(var i="",s=0;s<r;s++)i+=String.fromCharCode(e[t+s]);return i},writeASCII:function(e,t,r){for(var i=0;i<r.length;i++)e[t+i]=r.charCodeAt(i)},readUnicode:function(e,t,r){for(var i="",s=0;s<r;s++){var n=e[t++]<<8|e[t++];i+=String.fromCharCode(n)}return i},_tdec:window.TextDecoder?new window.TextDecoder:null,readUTF8:function(e,t,r){var i=Ah.B._tdec;return i&&0==t&&r==e.length?i.decode(e):Ah.B.readASCII(e,t,r)},readBytes:function(e,t,r){for(var i=[],s=0;s<r;s++)i.push(e[t+s]);return i},readASCIIArray:function(e,t,r){for(var i=[],s=0;s<r;s++)i.push(String.fromCharCode(e[t+s]));return i},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,r){var i=Ah.B,s=Ah.T.CFF;e=new Uint8Array(e.buffer,t,r),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(i.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(i.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=i.readUshort(e,t);t+=2;for(o=0;o<m+1;o++)l.FDSelect.push(i.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,r){var i,s=Ah.T.CFF;for(var n in t.Private&&(i=t.Private[1],t.Private=s.readDict(e,i,i+t.Private[0]),t.Private.Subrs&&s.readSubrs(e,i+t.Private.Subrs,t.Private)),t)-1!=["FamilyName","FontName","FullName","Notice","version","Copyright"].indexOf(n)&&(t[n]=r[t[n]-426+35])},readSubrs:function(e,t,r){r.Subrs=Ah.T.CFF.readBytes(e,t);var i,s=r.Subrs.length+1;i=s<1240?107:s<33900?1131:32768,r.Bias=i},readBytes:function(e,t){var r=[];t=Ah.T.CFF.readIndex(e,t,r);for(var i=[],s=r.length-1,n=e.byteOffset+t,a=0;a<s;a++){var o=r[a];i.push(new Uint8Array(e.buffer,n+o,r[a+1]-o))}return i},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 r=0;r<e.charset.length;r++)if(e.charset[r]==t)return r;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,r){var i=Ah.B,s=[".notdef"],n=e[t];if(t++,0==n)for(var a=0;a<r;a++){var o=i.readUshort(e,t);t+=2,s.push(o)}else{if(1!=n&&2!=n)throw"error: format: "+n;for(;s.length<r;){o=i.readUshort(e,t);t+=2;var h=0;1==n?(h=e[t],t++):(h=i.readUshort(e,t),t+=2);for(a=0;a<=h;a++)s.push(o),o++}}return s},readIndex:function(e,t,r){var i=Ah.B,s=i.readUshort(e,t)+1,n=e[t+=2];if(t++,1==n)for(var a=0;a<s;a++)r.push(e[t+a]);else if(2==n)for(a=0;a<s;a++)r.push(i.readUshort(e,t+2*a));else if(3==n)for(a=0;a<s;a++)r.push(16777215&i.readUint(e,t+3*a-1));else if(4==n)for(a=0;a<s;a++)r.push(i.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,r){var i=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=i.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=i.readInt(e,t+1)/65535,a=5),r.val=null!=h?h:"o"+o,r.size=a},readCharString:function(e,t,r){for(var i=t+r,s=Ah.B,n=[];t<i;){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,r){for(var i=Ah.B,s={},n=[];t<r;){var a=e[t],o=e[t+1],h=1,u=null,l=null;if(28==a&&(l=i.readShort(e,t+1),h=3),29==a&&(l=i.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=i.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,r){var i={tables:[],ids:{},off:t};e=new Uint8Array(e.buffer,t,r),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=i.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)),i.tables.push(g)}null!=i.ids[d]&&console.log("multiple tables for one platform+encoding: "+d),i.ids[d]=f}return i},parse0:function(e,t,r){var i=Ah.B;t+=2;var s=i.readUshort(e,t);t+=2,i.readUshort(e,t),t+=2,r.map=[];for(var n=0;n<s-6;n++)r.map.push(e[t+n]);return r},parse4:function(e,t,r){var i=Ah.B,s=i.readUshort,n=i.readUshorts,a=t,o=s(e,t+=2);s(e,t+=2);var h=s(e,t+=2);t+=2;var u=h>>>1;r.searchRange=s(e,t),t+=2,r.entrySelector=s(e,t),t+=2,r.rangeShift=s(e,t),t+=2,r.endCount=n(e,t,u),t+=2*u,t+=2,r.startCount=n(e,t,u),t+=2*u,r.idDelta=[];for(var l=0;l<u;l++)r.idDelta.push(i.readShort(e,t)),t+=2;return r.idRangeOffset=n(e,t,u),t+=2*u,r.glyphIdArray=n(e,t,a+o-t>>1),r},parse6:function(e,t,r){var i=Ah.B;t+=2,i.readUshort(e,t),t+=2,i.readUshort(e,t),t+=2,r.firstCode=i.readUshort(e,t),t+=2;var s=i.readUshort(e,t);t+=2,r.glyphIdArray=[];for(var n=0;n<s;n++)r.glyphIdArray.push(i.readUshort(e,t)),t+=2;return r},parse12:function(e,t,r){var i=Ah.B.readUint;i(e,t+=4),i(e,t+=4);var s=3*i(e,t+=4);t+=4;for(var n=r.groups=new Uint32Array(s),a=0;a<s;a+=3)n[a]=i(e,t+(a<<2)),n[a+1]=i(e,t+(a<<2)+4),n[a+2]=i(e,t+(a<<2)+8);return r}},Ah.T.CBLC={parseTab:function(e,t,r){var i=Ah.B,s=t;i.readUshort(e,t),t+=2,i.readUshort(e,t),t+=2;var n=i.readUint(e,t);t+=4;for(var a=[],o=0;o<n;o++){var h=i.readUint(e,t);t+=4,i.readUint(e,t),t+=4,i.readUint(e,t),t+=4,t+=4,t+=24,i.readUshort(e,t),t+=2,i.readUshort(e,t),t+=2,t+=4;for(var u=s+h,l=0;l<3;l++){var c=i.readUshort(e,u);u+=2;var p=i.readUshort(e,u);u+=2;var d=i.readUint(e,u);u+=4;var f=p-c+1,g=s+h+d,m=i.readUshort(e,g);if(g+=2,1!=m)throw m;var y=i.readUshort(e,g);g+=2;var x=i.readUint(e,g);g+=4;for(var v=[],b=0;b<f;b++){var _=i.readUint(e,g+4*b);v.push(x+_)}a.push([c,p,y,v])}}return a}},Ah.T.CBDT={parseTab:function(e,t,r){return new Uint8Array(e.buffer,e.byteOffset+t,r)}},Ah.T.glyf={parseTab:function(e,t,r,i){for(var s=[],n=i.maxp.numGlyphs,a=0;a<n;a++)s.push(null);return s},_parseGlyf:function(e,t){var r=Ah.B,i=e._data,s=e.loca;if(s[t]==s[t+1])return null;var n=Ah.findTable(i,"glyf",e._offset)[0]+s[t],a={};if(a.noc=r.readShort(i,n),n+=2,a.xMin=r.readShort(i,n),n+=2,a.yMin=r.readShort(i,n),n+=2,a.xMax=r.readShort(i,n),n+=2,a.yMax=r.readShort(i,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(r.readUshort(i,n)),n+=2;var h=r.readUshort(i,n);if(n+=2,i.length-n<h)return null;a.instructions=r.readBytes(i,n,h),n+=h;var u=a.endPts[a.noc-1]+1;a.flags=[];for(o=0;o<u;o++){var l=i[n];if(n++,a.flags.push(l),8&l){var c=i[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?i[n]:-i[n]),n++):f?a.xs.push(0):(a.xs.push(r.readShort(i,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?i[n]:-i[n]),n++):f?a.ys.push(0):(a.ys.push(r.readShort(i,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=r.readUshort(i,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=r.readUshort(i,n),n+=2,1&y){var v=r.readShort(i,n);n+=2;var b=r.readShort(i,n);n+=2}else{v=r.readInt8(i,n);n++;b=r.readInt8(i,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=r.readF2dot14(i,n),n+=2):64&y?(x.m.a=r.readF2dot14(i,n),n+=2,x.m.d=r.readF2dot14(i,n),n+=2):128&y&&(x.m.a=r.readF2dot14(i,n),n+=2,x.m.b=r.readF2dot14(i,n),n+=2,x.m.c=r.readF2dot14(i,n),n+=2,x.m.d=r.readF2dot14(i,n),n+=2)}while(32&y);if(256&y){var _=r.readUshort(i,n);n+=2,a.instr=[];for(o=0;o<_;o++)a.instr.push(i[n]),n++}}return a}},Ah.T.head={parseTab:function(e,t,r){var i=Ah.B,s={};return i.readFixed(e,t),t+=4,s.fontRevision=i.readFixed(e,t),t+=4,i.readUint(e,t),t+=4,i.readUint(e,t),t+=4,s.flags=i.readUshort(e,t),t+=2,s.unitsPerEm=i.readUshort(e,t),t+=2,s.created=i.readUint64(e,t),t+=8,s.modified=i.readUint64(e,t),t+=8,s.xMin=i.readShort(e,t),t+=2,s.yMin=i.readShort(e,t),t+=2,s.xMax=i.readShort(e,t),t+=2,s.yMax=i.readShort(e,t),t+=2,s.macStyle=i.readUshort(e,t),t+=2,s.lowestRecPPEM=i.readUshort(e,t),t+=2,s.fontDirectionHint=i.readShort(e,t),t+=2,s.indexToLocFormat=i.readShort(e,t),t+=2,s.glyphDataFormat=i.readShort(e,t),t+=2,s}},Ah.T.hhea={parseTab:function(e,t,r){var i=Ah.B,s={};i.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?i.readUshort:i.readShort;s[o]=h(e,t+2*a)}return s}},Ah.T.hmtx={parseTab:function(e,t,r,i){for(var s=Ah.B,n=[],a=[],o=i.maxp.numGlyphs,h=i.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,r,i){var s=Ah.B,n=Ah.T.kern;if(1==s.readUshort(e,t))return n.parseV1(e,t,r,i);var a=s.readUshort(e,t+2);t+=4;for(var o={glyph1:[],rval:[]},h=0;h<a;h++){t+=2;r=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,r,i){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,r){var i=Ah.B,s=i.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=i.readShort(e,t);t+=2,h!=n&&(r.glyph1.push(h),r.rval.push({glyph2:[],vals:[]}));var c=r.rval[r.rval.length-1];c.glyph2.push(u),c.vals.push(l),n=h}return t}},Ah.T.loca={parseTab:function(e,t,r,i){var s=Ah.B,n=[],a=i.head.indexToLocFormat,o=i.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,r){var i=Ah.B,s=i.readUshort,n={};return i.readUint(e,t),t+=4,n.numGlyphs=s(e,t),t+=2,n}},Ah.T.name={parseTab:function(e,t,r){var i=Ah.B,s={};i.readUshort(e,t),t+=2;var n=i.readUshort(e,t);t+=2;for(var a=i.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=i.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=i.readUnicode(e,x,g/2):0==p?y=i.readASCII(e,x,g):1==p||3==p||4==p||5==p||10==p?y=i.readUnicode(e,x,g/2):1==c?(y=i.readASCII(e,x,g),console.log("reading unknown MAC encoding "+p+" as ASCII")):(console.log("unknown encoding "+p+", platformID: "+c),y=i.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,r="postScriptName";for(var i in e)if(null!=e[i][r]&&1033==e[i]._lang)return e[i];for(var i in e)if(null!=e[i][r]&&0==e[i]._lang)return e[i];for(var i in e)if(null!=e[i][r]&&3084==e[i]._lang)return e[i];for(var i in e)if(null!=e[i][r])return e[i];for(var i in e){t=e[i];break}return console.log("returning name table with languageID "+t._lang),null==t[r]&&null!=t.ID&&(t[r]=t.ID),t}},Ah.T.OS2={parseTab:function(e,t,r){var i=Ah.B.readUshort(e,t);t+=2;var s=Ah.T.OS2,n={};if(0==i)s.version0(e,t,n);else if(1==i)s.version1(e,t,n);else if(2==i||3==i||4==i)s.version2(e,t,n);else{if(5!=i)throw"unknown OS/2 table version: "+i;s.version5(e,t,n)}return n},version0:function(e,t,r){var i=Ah.B;return r.xAvgCharWidth=i.readShort(e,t),t+=2,r.usWeightClass=i.readUshort(e,t),t+=2,r.usWidthClass=i.readUshort(e,t),t+=2,r.fsType=i.readUshort(e,t),t+=2,r.ySubscriptXSize=i.readShort(e,t),t+=2,r.ySubscriptYSize=i.readShort(e,t),t+=2,r.ySubscriptXOffset=i.readShort(e,t),t+=2,r.ySubscriptYOffset=i.readShort(e,t),t+=2,r.ySuperscriptXSize=i.readShort(e,t),t+=2,r.ySuperscriptYSize=i.readShort(e,t),t+=2,r.ySuperscriptXOffset=i.readShort(e,t),t+=2,r.ySuperscriptYOffset=i.readShort(e,t),t+=2,r.yStrikeoutSize=i.readShort(e,t),t+=2,r.yStrikeoutPosition=i.readShort(e,t),t+=2,r.sFamilyClass=i.readShort(e,t),t+=2,r.panose=i.readBytes(e,t,10),t+=10,r.ulUnicodeRange1=i.readUint(e,t),t+=4,r.ulUnicodeRange2=i.readUint(e,t),t+=4,r.ulUnicodeRange3=i.readUint(e,t),t+=4,r.ulUnicodeRange4=i.readUint(e,t),t+=4,r.achVendID=i.readASCII(e,t,4),t+=4,r.fsSelection=i.readUshort(e,t),t+=2,r.usFirstCharIndex=i.readUshort(e,t),t+=2,r.usLastCharIndex=i.readUshort(e,t),t+=2,r.sTypoAscender=i.readShort(e,t),t+=2,r.sTypoDescender=i.readShort(e,t),t+=2,r.sTypoLineGap=i.readShort(e,t),t+=2,r.usWinAscent=i.readUshort(e,t),t+=2,r.usWinDescent=i.readUshort(e,t),t+=2},version1:function(e,t,r){var i=Ah.B;return t=Ah.T.OS2.version0(e,t,r),r.ulCodePageRange1=i.readUint(e,t),t+=4,r.ulCodePageRange2=i.readUint(e,t),t+=4},version2:function(e,t,r){var i=Ah.B,s=i.readUshort;return t=Ah.T.OS2.version1(e,t,r),r.sxHeight=i.readShort(e,t),t+=2,r.sCapHeight=i.readShort(e,t),t+=2,r.usDefault=s(e,t),t+=2,r.usBreak=s(e,t),t+=2,r.usMaxContext=s(e,t),t+=2},version5:function(e,t,r){var i=Ah.B.readUshort;return t=Ah.T.OS2.version2(e,t,r),r.usLowerOpticalPointSize=i(e,t),t+=2,r.usUpperOpticalPointSize=i(e,t),t+=2}},Ah.T.post={parseTab:function(e,t,r){var i=Ah.B,s={};return s.version=i.readFixed(e,t),t+=4,s.italicAngle=i.readFixed(e,t),t+=4,s.underlinePosition=i.readShort(e,t),t+=2,s.underlineThickness=i.readShort(e,t),t+=2,s}},Ah.T.SVG={parseTab:function(e,t,r){var i=Ah.B,s={entries:[],svgs:[]},n=t;i.readUshort(e,t),t+=2;var a=i.readUint(e,t);t+=4,i.readUint(e,t),t+=4,t=a+n;var o=i.readUshort(e,t);t+=2;for(var h=0;h<o;h++){var u=i.readUshort(e,t);t+=2;var l=i.readUshort(e,t);t+=2;var c=i.readUint(e,t);t+=4;var p=i.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=i.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,r,i){for(var s=i.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,r){var i=Ah.B,s=t;t+=2;var n=i.readUshort(e,t);t+=2;var a=i.readUint(e,t);t+=4;var o=i.readUint(e,t);t+=4;var h=i.readUshort(e,t);t+=2;for(var u={},l=s+a,c=0;c<n;c++)u["g"+i.readUshort(e,l)]=[i.readUshort(e,l+2),i.readUshort(e,l+4)],l+=6;var p=[];l=s+o;for(c=0;c<h;c++)p.push(i.readUshort(e,l),i.readUshort(e,l+2)),l+=4;return[u,p]}},Ah.T.cpal={parseTab:function(e,t,r){var i=Ah.B,s=t,n=i.readUshort(e,t);if(t+=2,0==n){i.readUshort(e,t),t+=2,i.readUshort(e,t),t+=2;var a=i.readUshort(e,t);t+=2;var o=i.readUint(e,t);return t+=4,new Uint8Array(e.buffer,s+o,4*a)}throw n}},Ah.T.GSUB={parseTab:function(e,t,r,i){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,r,i){var s=i.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,r,i){for(var s=[],n=0;n<i;n++)s.push(e.readF2dot14(t,r+2*n));return s}function r(r,i,s,n,a){for(var o=[],h=0;h<s;h++){var u=e.readUshort(r,i);i+=2;var l=e.readUshort(r,i),c=61440&l;l&=4095,i+=2;var p=null,d=null,f=null;32768&c&&(p=t(r,i,n),i+=2*n),16384&c&&(d=t(r,i,n),i+=2*n),16384&c&&(f=t(r,i,n),i+=2*n),o.push([u,l,c,d,p,f])}return o}function i(t,r,i){var s=t[r];if(r++,0==s)return[[],r];127<s&&(s=(127&s)<<8|t[r++]);for(var n=[],a=0;n.length<s;){var o=t[r];r++;var h=!!(128&o);o=1+(127&o);for(var u=0;u<o;u++){var l=0;h?(l=e.readUshort(t,r),r+=2):(l=t[r],r++),a+=l,n.push(a)}}return[n,r]}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=r(s,h+=2,E,u),T=[];D.push(T),h=n+d+f[g]+S;var M=null;if(A)M=(I=i(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=i(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,r,i){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,r,i){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,r){e.cmds.push("M"),e.crds.push(t,r)},t=function(e,t,r){e.cmds.push("L"),e.crds.push(t,r)},r=function(e,t,r,i,s,n,a){e.cmds.push("C"),e.crds.push(t,r,i,s,n,a)},i=function(e,t,r,i,s){e.cmds.push("Q"),e.crds.push(t,r,i,s)},s=function(e){e.cmds.push("Z")};function n(e,t,r,i){var s=t[r],n=t[r+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,r){for(var i=0,s=~~(e.length/t);i+1!=s;){var n=i+(s-i>>>1);e[n*t]<=r?i=n:s=n}return i*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 r=e.cmap,i=-1,s=["p3e10","p0e4","p3e1","p1e0","p0e3","p0e1","p3e0","p3e5"],n=0;n<s.length;n++)if(null!=r.ids[s[n]]){i=r.ids[s[n]];break}if(-1==i)throw"no familiar platform and encoding!";e._ctab=r.tables[i]}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,r,i){var s={cmds:[],crds:[]};e.fvar&&(null==i&&(i=e.fvar[1][e._index][2]),i=m(e,i));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!=r&&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,i);return{cmds:s.cmds,crds:s.crds}}function f(r,n,a,o){var h=n.glyf[r];null==h&&(h=n.glyf[r]=Ah.T.glyf._parseGlyf(n,r)),null!=h&&(h.noc>-1?function(r,n,a,o,h){var u=r.xs,l=r.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,r.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<r.noc;b++){var _=0==b?0:r.endPts[b-1]+1,w=r.endPts[b];for(v=_;v<=w;v++){var C=v==_?w:v-1,D=v==w?_:v+1,E=1&r.flags[v],A=1&r.flags[C],S=1&r.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?i(o,F,T,u[D],l[D]):i(o,F,T,Math.floor(.5*(F+u[D])),Math.floor(.5*(T+l[D])))}s(o)}}(h,n,r,a,o):function(e,t,r,i,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[r]: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];i.crds.push(C*b.a+D*b.c+_),i.crds.push(C*b.b+D*b.d+w)}for(m=0;m<x.cmds.length;m++)i.cmds.push(x.cmds[m])}}(h,n,r,a,o))}function g(e,t){for(var r=1,i=e[0],s=e[1],n=e[2],a=0;a<t.length;a++){r*=i[a]>s[a]||s[a]>n[a]||i[a]<0&&n[a]>0&&0!=s[a]||0==s[a]?1:t[a]<i[a]||t[a]>n[a]?0:t[a]==s[a]?1:t[a]<s[a]?(t[a]-i[a])/(s[a]-i[a]):(n[a]-t[a])/(n[a]-s[a])}return r}function m(e,t){for(var r=e.fvar,i=e.avar,s=r?r[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,i&&-1!=n[a]){for(var c=i[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,r,i,s){var n=r.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?r:i,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,r,i){for(var s=t>>1,n=r>>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(i,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<i.length;){F.getCharString(i,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(),r(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(),r(h,y,x,b,_,A,S),r(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(),r(h,y,x,b,_,A,S),r(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(),r(h,y,x,b,_,A,S),r(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(),r(h,y,x,b,_,A,S),r(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(),r(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(),r(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(),r(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),r(h,y,x,b,_,g,m),O+=4}else{if("o"==(k+"").charAt(0))throw console.log("Unknown operation: "+k,i),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,r){null==r&&(r={});var i=r.axs;e.fvar&&null==i&&(i=e.fvar[1][e._index][2]);var s=e.HVAR;i&&s&&(i=m(e,i));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],i)*f[y];u.push({g:c,cl:o,dx:0,dy:0,ax:d,ay:0})}return u},shapeToPath:function(e,t,r){var i,s,n={cmds:[],crds:[]},a=0,o=0;r&&(i=r.clr,s=r.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);i&&n.cmds.push(i);for(p=0;p<l.cmds.length;p++)n.cmds.push(l.cmds[p]);var f=n.cmds.length;i&&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 r=e.cmds,i=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<r.length;f++){var g,m,y,x,v=r[f],b=o[v]?o[v]:0,_=[];if("L"==v)g=i[a]-h,m=i[a+1]-u,y=s(g+l),x=s(m+c),"Z"==r[f+1]&&i[a]==p&&i[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=i[a+w]-h,m=i[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=i[(a+=b)-2],u=i[a-1]),"M"==v&&(p=h,d=u),"Z"==v&&(h=p,u=d)}return function(e){for(var t=[],r=!1,i="",s=0;s<e.length;s++){var n=e[s],a="number"==typeof n;if(!a){if(n==i&&1==n.length&&"m"!=n)continue;i=n}r&&a&&n>=0&&t.push(" "),t.push(n),r=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 r=0,i=e.cmds,s=e.crds,n=0;n<i.length;n++){var a=i[n];if("M"==a)t.moveTo(s[r],s[r+1]),r+=2;else if("L"==a)t.lineTo(s[r],s[r+1]),r+=2;else if("C"==a)t.bezierCurveTo(s[r],s[r+1],s[r+2],s[r+3],s[r+4],s[r+5]),r+=6;else if("Q"==a)t.quadraticCurveTo(s[r],s[r+1],s[r+2],s[r+3]),r+=4;else if("d"==a[0]){var u=window.UPNG,l=s[r],c=s[r+1],p=s[r+2],d=s[r+3],f=s[r+4],g=s[r+5],m=s[r+6],y=s[r+7];if(r+=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 r=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 i,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]),i=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),i.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);i.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(i,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(i,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),r=[],i=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=i+5*o,u=a+5*o;r.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 r}(_);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=r(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,r){e.exports=r()}(self,(()=>(()=>{var e={177:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.BezierPath=void 0;const i=r(558),s=r(188);t.BezierPath=class{constructor(e){this.samples=[],this.segments=e;const t=e.map((e=>e.getTotalLength())),r=[0];for(let e=1;e<t.length;e++)r.push(r[e-1]+t[e-1]);this._totalLength=r[r.length-1]+t[t.length-1];const n=e.map((e=>Math.max(4,Math.ceil(e.getTotalLength()/i.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 i=n[t],a=(0,s.times)(i+1).map((e=>e/i)),u=a.map((t=>e.pointAtParameter(t)));let l;for(let t=0;t<4;t++){l=(0,s.times)(i).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 r=0;for(let i=1;i<a.length-1;i++)r+=t[i-1],a[i]-=o*r,u[i]=e.pointAtParameter(a[i])}let c=0;u.slice(1).forEach(((e,i)=>{c+=l[i],this.samples.push({dist:r[t]+c,pt:e,tan:this.segments[t].tangentAtParameter(a[i+1]),segIdx:t,t:a[i+1]})}))})),this._jumps=[],this.segmentStartEnds=[{start:0,end:0}];for(let e=1;e<this.samples.length;e++){const t=this.samples[e-1],r=this.samples[e];if(r.segIdx===t.segIdx?this.segmentStartEnds[this.segmentStartEnds.length-1].end=r.dist:this.segmentStartEnds[r.segIdx]={start:r.dist,end:r.dist},t.segIdx!==r.segIdx&&(this.segments[t.segIdx].D.x!==this.segments[r.segIdx].A.x||this.segments[t.segIdx].D.y!==this.segments[r.segIdx].A.y)){const i=(t.dist+r.dist)/2,s={dist:i-1e-8,pt:this.segments[t.segIdx].D,tan:this.segments[t.segIdx].tangentAtParameter(1),segIdx:t.segIdx,t:1},n={dist:i+1e-8,pt:this.segments[r.segIdx].A,tan:this.segments[r.segIdx].tangentAtParameter(0),segIdx:r.segIdx,t:0};this._jumps.push(i),this.samples.splice(e,0,s,n),e+=2}}}jumps(){return[...this._jumps]}getTotalLength(){return this._totalLength}findClosestSampleIdx(e){let t=0,r=this.samples.length-1;for(;t<r;){const i=Math.floor((t+r)/2);if(this.samples[i].dist>e)r=i-1;else{if(!(this.samples[i].dist<e))return i;t=i+1}}return Math.max(0,Math.min(this.samples.length-1,Math.floor((t+r)/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 r=this.findClosestSampleIdx(e),i=this.samples[r].dist<e?Math.min(r+1,this.samples.length-1):Math.max(0,r-1),s=Math.abs(this.samples[i].dist-this.samples[r].dist)<1e-6?0:(e-this.samples[r].dist)/(this.samples[i].dist-this.samples[r].dist);if(t||this.samples[r].segIdx>this.samples[i].segIdx)return{x:(1-s)*this.samples[r].pt.x+s*this.samples[i].pt.x,y:(1-s)*this.samples[r].pt.y+s*this.samples[i].pt.y};if(this.samples[r].segIdx!==this.samples[i].segIdx){if(s<.5){const e=this.segments[this.samples[r].segIdx],t=2*s,i=(1-t)*this.samples[r].t+t;return e.pointAtParameter(i)}{const e=this.segments[this.samples[i].segIdx],t=2*(s-.5)*this.samples[i].t;return e.pointAtParameter(t)}}{const e=this.segments[this.samples[r].segIdx],t=(1-s)*this.samples[r].t+s*this.samples[i].t;return e.pointAtParameter(t)}}getAngleAtLength(e,t=!1){const r=this.getTangentAtLength(e,t);return Math.atan2(r.y,r.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 r=this.findClosestSampleIdx(e),i=this.samples[r].dist<e?Math.min(r+1,this.samples.length-1):Math.max(0,r-1),s=(e-this.samples[r].dist)/(this.samples[i].dist-this.samples[r].dist);if(t||this.samples[r].segIdx>this.samples[i].segIdx){let e=(1-s)*this.samples[r].tan.x+s*this.samples[i].tan.x,t=(1-s)*this.samples[r].tan.y+s*this.samples[i].tan.y;const n=Math.max(Math.hypot(e,t),1e-4);return e/=n,t/=n,{x:e,y:t}}if(this.samples[r].segIdx!==this.samples[i].segIdx){if(s<.5){const e=this.segments[this.samples[r].segIdx],t=2*s,i=(1-t)*this.samples[r].t+t;return e.tangentAtParameter(i)}{const e=this.segments[this.samples[i].segIdx],t=2*(s-.5)*this.samples[i].t;return e.tangentAtParameter(t)}}{const e=this.segments[this.samples[r].segIdx],t=(1-s)*this.samples[r].t+s*this.samples[i].t;return e.tangentAtParameter(t)}}}},558:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.BezierSegment=void 0;const i=r(188);class s{constructor(e,t,r,i){this._totalLength=void 0,this.A=e,this.B=t,this.C=r,this.D=i}static sampleSpacing(){return 2}tangentAtParameter(e){const t=Math.max(0,Math.min(1,e));if(0===t||1===t){let e,r;0===t?this.A.x===this.B.x&&this.A.y===this.B.y?(e=this.C.x-this.A.x,r=this.C.y-this.A.y):(e=this.B.x-this.A.x,r=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,r=this.D.y-this.B.y):(e=this.D.x-this.C.x,r=this.D.y-this.C.y);const i=Math.hypot(e,r);return Math.abs(i)>1e-4&&(e/=i,r/=i),{x:e,y:r}}const r=1-t;let i=3*this.D.x*Math.pow(t,2)-3*this.C.x*Math.pow(t,2)+6*this.C.x*r*t-6*this.B.x*r*t+3*this.B.x*Math.pow(r,2)-3*this.A.x*Math.pow(r,2),s=3*this.D.y*Math.pow(t,2)-3*this.C.y*Math.pow(t,2)+6*this.C.y*r*t-6*this.B.y*r*t+3*this.B.y*Math.pow(r,2)-3*this.A.y*Math.pow(r,2);const n=Math.hypot(i,s);return Math.abs(n)>1e-4&&(i/=n,s/=n),{x:i,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,i.times)(e).map((t=>this.pointAtParameter(t/(e-1))));let r=0;for(let e=1;e<t.length;e++)r+=Math.hypot(t[e].x-t[e-1].x,t[e].y-t[e-1].y);this._totalLength=r}return this._totalLength}}t.BezierSegment=s},729:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.createFromCommands=t.create=t.createFromElement=t.createFromCircle=t.createFromLine=t.createFromPath=void 0;const i=r(821),s=r(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+/),r=[];let i="",s={};for(;t.length>0;){let e=t.shift();n.hasOwnProperty(e)?i=e:t.unshift(e),s={type:i},n[i].forEach((r=>{e=t.shift(),s[r]=parseFloat(e)})),"M"===i?i="L":"m"===i&&(i="l"),r.push(s)}return r}(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 r={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(r,{x:e.x1,y:e.y1},{x:e.x2,y:e.y2},{x:e.x,y:e.y})),r={x:e.x,y:e.y};else if("L"===e.type)a.push(new s.BezierSegment(r,r,{x:e.x,y:e.y},{x:e.x,y:e.y})),r={x:e.x,y:e.y};else if("H"===e.type)a.push(new s.BezierSegment(r,r,{x:e.x,y:r.y},{x:e.x,y:r.y})),r={x:e.x,y:r.y};else if("V"===e.type)a.push(new s.BezierSegment(r,r,{x:r.x,y:e.y},{x:r.x,y:e.y})),r={x:r.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 i.BezierPath(a)},t.createFromLine=e=>{const[t,r,n,a]=["x1","x2","y1","y2"].map((t=>parseFloat(e.getAttribute(t)||"0")));return new i.BezierPath([new s.BezierSegment({x:t,y:n},{x:t,y:n},{x:r,y:a},{x:r,y:a})])},t.createFromCircle=e=>{const[t,r,n]=["cx","cy","r"].map((t=>parseFloat(e.getAttribute(t)||"0"))),a=1.3;return new i.BezierPath([new s.BezierSegment({x:t-n,y:r},{x:t-n,y:r-a*n},{x:t+n,y:r-a*n},{x:t+n,y:r}),new s.BezierSegment({x:t+n,y:r},{x:t+n,y:r+a*n},{x:t-n,y:r+a*n},{x:t-n,y:r})])},t.createFromElement=e=>{const r=e.tagName.toLowerCase();if("path"===r)return(0,t.createFromPath)(e);if("line"===r)return(0,t.createFromLine)(e);if("circle"===r)return(0,t.createFromCircle)(e);throw new Error(`Unsupported SVG tag: ${r}`)},t.create=e=>{const t=[];for(let r=1;r<e.length;r++){const i=e[r-1],n=e[r];t.push(new s.BezierSegment(i.pt,i.right||i.pt,n.left||n.pt,n.pt))}return new i.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 r={x:t[0].x,y:t[0].y},n=Object.assign({},r);const a=[];for(;t.length>0;){const e=t.shift();if("M"===e.type)n={x:e.x,y:e.y},r=n;else if("C"===e.type)a.push(new s.BezierSegment(r,{x:e.x1,y:e.y1},{x:e.x2,y:e.y2},{x:e.x,y:e.y})),r={x:e.x,y:e.y};else if("L"===e.type)e.x===r.x&&e.y===r.y||a.push(new s.BezierSegment(r,r,{x:e.x,y:e.y},{x:e.x,y:e.y})),r={x:e.x,y:e.y};else if("H"===e.type)e.x!==r.x&&a.push(new s.BezierSegment(r,r,{x:e.x,y:r.y},{x:e.x,y:r.y})),r={x:e.x,y:r.y};else if("V"===e.type)e.y!==r.y&&a.push(new s.BezierSegment(r,r,{x:r.x,y:e.y},{x:r.x,y:e.y})),r={x:r.x,y:e.y};else if("Q"===e.type)a.push(new s.BezierSegment(r,{x:r.x+2/3*(e.x1-r.x),y:r.y+2/3*(e.y1-r.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})),r={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(r.x-n.x,r.y-n.y)>0&&a.push(new s.BezierSegment(r,r,n,n))}}return new i.BezierPath(a)}},821:function(e,t,r){var i=this&&this.__createBinding||(Object.create?function(e,t,r,i){void 0===i&&(i=r);var s=Object.getOwnPropertyDescriptor(t,r);s&&!("get"in s?!t.__esModule:s.writable||s.configurable)||(s={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,i,s)}:function(e,t,r,i){void 0===i&&(i=r),e[i]=t[r]}),s=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||i(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),s(r(177),t),s(r(558),t),s(r(729),t),s(r(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 r=0;r<e;r++)t.push(r);return t}}},t={};return function r(i){var s=t[i];if(void 0!==s)return s.exports;var n=t[i]={exports:{}};return e[i].call(n.exports,n,n.exports,r),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"];class Ph{constructor(e,t,r,i,s){if(!(t instanceof FontFace))throw Error("FontFace is required");this._pInst=e,this.name=r,this.path=i,this.data=s,this.face=t}static hasGlyphData(e){let{font:t}=e;return"object"==typeof t&&void 0!==t.data}fontBounds(e,t,r,i,s,n){({width:i,height:s,options:n}=this._parseArgs(i,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,r,i,s)}textBounds(e,t,r,i,s,n){({width:i,height:s,options:n}=this._parseArgs(i,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,r,i,s)}textToPaths(e,t,r,i,s,n){if(({width:i,height:s,options:n}=this._parseArgs(i,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,r,i,s,n).map((e=>e.glyphs)).flat().map((e=>e.path.commands)).flat()}textToPoints(e,t,r,i,s,n){return this.textToContours(e,t,r,i,s,n).reduce(((e,t)=>(e.push(...t),e)),[])}textToContours(e,t=0,r=0,i,s,n){({width:i,height:s,options:n}=this._parseArgs(i,s,n));const a=this.textToPaths(e,t,r,i,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,r){const i=(e,t)=>{if("object"!=typeof e)e=t;else for(const r in t)void 0===e[r]&&(e[r]=t[r]);return e},s=(e,t)=>{const r=e.length;return e[t<0?t%r+r:t%r]},n=(e,t)=>{t=t||0;let r=0;for(let i=e.length-1;e.length>3&&i>=0;--i)collinear(s(e,i-1),s(e,i),s(e,i+1),t)&&(e.splice(i%e.length,1),r++);return r},a=Fh.createFromCommands(Uh(e));let o=i(t,{sampleFactor:.1,simplifyThreshold:0});const h=Math.max(1,Math.ceil(a.getTotalLength()*o.sampleFactor));let u=[];const l=r._pInst.angleMode(),c=r._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,r,i,s,n){({width:i,height:s,options:n}=this._parseArgs(i,s,n));const a=n?.extrude||0,o=this.textToContours(e,t,r,i,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:r}of e)this._pInst.vertex(t,r);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:r,y:i}of t)this._pInst.vertex(r,i,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 r=this.face[t];"normal"!==r&&(e[t]=e[t]||r)})),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:r=1e3}=this.data?.head||{},{ascender:i=0,descender:s=0}=this.data?.hhea||{};return((t||i+s)/2-i/2)*e/r}_lineateAndPathify(e,t,r,i,s,n={}){let a=n?.graphics?._renderer||this._pInst._renderer,o=a.drawingContext.textBaseline,{lines:h,bounds:u}=a._computeBounds(Ja,e,t,r,i,s,{ignoreRectMode:!0,...n});h=this._position(a,h,u,i,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,r,i,s,n,a])=>{if(!e)return i;if("wght"===t)return e.states.fontWeight;if("wdth"===t)return 100;if(e.textCanvas().style.fontVariationSettings){const r=new RegExp(`\\b${t}s+(d+)`).exec(e.textCanvas().style.fontVariationSettings);return r?parseInt(r[1]):i}return i}))}return t}_textToPathPoints(e,t,r,i,s,n){({width:i,height:s,options:n}=this._parseArgs(i,s,n));let a=this.textToPaths(e,t,r,i,s,n);const o=(e,t,r,i)=>{if(fn.dist(t.x,t.y,r.x,r.y)>i){let s={x:(t.x+r.x)/2,y:(t.y+r.y)/2};e.push(s),o(e,t,s,i),o(e,s,r,i)}};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:r}=a[e];if("Z"!==t){let e={x:r[r.length-2],y:r[r.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,r={}){return"object"==typeof e?(r=e,e=t=void 0):"object"==typeof t&&(r=t,t=void 0),{width:e,height:t,options:r}}_position(e,t,r,i,s){let{textAlign:n,textLeading:a}=e.states,o=this._measureTextDefault(e,"X").fontBoundingBoxAscent;return t.map(((t,h)=>{let u=r.x,l=r.y+h*a+o,c=e._fontWidthSingle(t);if(n===A?u+=(r.w-c)/2:n===D&&(u+=r.w-c),void 0!==i)switch(e.states.rectMode){case A:u-=i/2,l-=s/2;break;case C:u-=i,l-=s}return{text:t,x:u,y:l}}))}_lineToGlyphs(e,{scale:t=1,axs:r}={}){if(!this.data)throw Error('No font data available for "'+this.name+'"\nTry downloading a local copy of the font file');let i=Ah.U.shape(this.data,e.text,{axs:r});return e.glyphShapes=i,e.glyphs=this._shapeToPaths(i,e,{scale:t,axs:r}),e}_positionGlyphs(e,t){let r=t?.graphics?._renderer||this._pInst._renderer;const i=this._currentAxes(r),s=Ah.U.shape(this.data,e,{axs:i}),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:r=0,y:i=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]+r+p)*t,u=n+(f[a+h+1]+i+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:r=1,axs:i}={}){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:r,x:s,y:n,lineX:t.x,lineY:t.y,axs:i});a.push(h),s+=u,n+=l}return a}_measureTextDefault(e,t){let{textAlign:r,textBaseline:i}=e.states,s=e.textDrawingContext();s.textAlign="left",s.textBaseline="alphabetic";let n=s.measureText(t);return s.textAlign=r,s.textBaseline=i,n}drawPaths(e,t,r){e.strokeStyle=r?.stroke||e.strokeStyle,e.fillStyle=r?.fill||e.fillStyle,e.beginPath(),t.forEach((([t,...r])=>{"M"===t?e.moveTo(...r):"L"===t?e.lineTo(...r):"C"===t?e.bezierCurveTo(...r):"Q"===t?e.quadraticCurveTo(...r):"Z"===t&&e.closePath()})),r?.fill&&e.fill(),r?.stroke&&e.stroke()}_pathsToCommands(e,t){let r=[];for(let i=0;i<e.length;i++){let s=e[i],{x:n,y:a,path:o}=s,{crds:h,cmds:u}=o;for(let e=0,i=0;i<u.length;i++){let s=u[i],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 r=0;r<6;r+=2)o.data.push(n+h[e+r]*t,a+h[e+r+1]*-t);e+=6}else if("Q"==s){for(let r=0;r<4;r+=2)o.data.push(n+h[e+r]*t,a+h[e+r+1]*-t);e+=4}r.push(o)}}return r}}async function Oh(e,t,r,i,s){let n=function(e,t,r,i){e.includes(" ")&&(e="'"+e+"'");let s=i?._compressedData??i?._data;if(!s){if(!kh.test(t))throw Error(Bh);t.startsWith("url(")||(t="url("+t+")"),s=t}if((i?.fvar?.length??0)>0){r=r||{};for(const[e,t,s,n,a,o]of i.fvar[0])"wght"===e?r.weight=`${t} ${n}`:"wdth"===e&&(r.stretch=`${t}% ${n}%`)}let n=new FontFace(e,s,r);if("error"===n.status)throw Error('Failed to create FontFace for "'+e+'"');return n}(t,r,i,s);return"loaded"!==n.status&&await n.load(),document.fonts.add(n),new Ph(e,n,t,r,s)}function Nh(e){return(e.startsWith('"')||e.startsWith("'"))&&e.at(0)===e.at(-1)?e.slice(1,-1).replace(/\/(['"])/g,"$1"):e}function Rh(...e){let t,r,i,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?r?i=n:r=n:"object"==typeof n&&(s=n)}return{path:n,name:t,success:r,error:i,options:s}}function Vh(e,t){e.Font=Ph,t.parseFontData=async function(e){let r=e instanceof Uint8Array?e:await t.loadBytes(e);if(!r)throw Error("Failed to load font data");let i=Ah.parse(r);if(0===i.length||void 0===i[0].cmap)throw Error("parsing font data");return i[0]},t.loadFont=async function(...e){let r,{path:i,name:s,success:n,error:a,options:{sets:o,...h}={}}=Rh(...e),u=i.includes("@font-face");if(!u){const e=await fetch(i,{method:"HEAD"}),t=e.headers.get("content-type")?.startsWith("text/css");t&&(u=!0,i=await fetch(i).then((e=>e.text())))}if(u){const e=new CSSStyleSheet;await e.replace(i);const r=[];for(const i of e.cssRules)if(i instanceof CSSFontFaceRule){const e=i.style;let s=Nh(e.getPropertyValue("font-family"));const n=e.getPropertyValue("src"),a={...h||{}};for(const t of e){if("font-family"===t||"src"===t)continue;const r=t.replace(/^font-/,"").split("-").map(((e,t)=>0===t?e:`${e[0].toUpperCase()}${e.slice(1)}`)).join("");a[r]=e.getPropertyValue(t)}r.push({name:s,src:n,fontDescriptors:a,loadWithData:async()=>{let e;try{const r=/url\(([^\)]+)\)/.exec(n);if(r){let i=r[1];/^['"]/.exec(i)&&i.at(0)===i.at(-1)&&(i=i.slice(1,-1)),e=await t.parseFontData(i)}}catch(e){}return Oh(this,s,n,a,e)},loadWithoutData:()=>Oh(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 r){if(!e.fontDescriptors.unicodeRange)continue;const t=[...new Set(no.parse(e.fontDescriptors.unicodeRange.split(/,\s*/g))).values()].filter((e=>a.has(e))).length,r={style:"normal",weight:400,...h},i=Object.keys(e.fontDescriptors).filter((t=>e.fontDescriptors[t]===r[t])).length;(i>c||i===c&&t>=l)&&(c=i,l=t,u=e)}const p=u||r.at(-1);for(const e of r)e!==p&&e.loadWithoutData();return p?.loadWithData()}try{const e=await t.parseFontData(i);s=s||function(e,t){let r,i=e?.name;if(i){if(i.fullName)return i.fullName;i.familyName&&(r=i.familyName)}if(!r){let e=Ih.exec(t);r=e&&e.length>=3?e[1]:t}return r.includes(" ")&&(r=r.replace(/ /g,"_")),r}(e,i),r=await Oh(this,s,i,h,e)}catch(e){let t=s||i.substring(i.lastIndexOf("/")+1).replace(/\.[^/.]+$/,"");console.warn(`WARN: No glyph data for '${t}', retrying as FontFace`);try{r=await Oh(this,t,i,h)}catch(e){if(a)return a(e);throw e}}return n?n(r):r}}const Uh=e=>e.map((e=>{const t=e[0];switch(t){case"Z":return{type:t};case"M":case"L":{const[,r,i]=e;return{type:t,x:r,y:i}}case"Q":{const[,r,i,s,n]=e;return{type:t,x1:r,y1:i,x:s,y:n}}case"C":{const[,r,i,s,n,a,o]=e;return{type:t,x1:r,y1:i,x2:s,y2:n,x:a,y:o}}default:throw new Error(`Unexpected path command: ${t}`)}}));void 0!==p5&&Vh(p5,p5.prototype);var Gh=[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],zh=[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],jh="ªµºÀ-ÖØ-öø-ˁˆ-ˑˠ-ˤˬˮͰ-ʹͶͷͺ-ͽͿΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ҁҊ-ԯԱ-Ֆՙՠ-ֈא-תׯ-ײؠ-يٮٯٱ-ۓەۥۦۮۯۺ-ۼۿܐܒ-ܯݍ-ޥޱߊ-ߪߴߵߺࠀ-ࠕࠚࠤࠨࡀ-ࡘࡠ-ࡪࡰ-ࢇࢉ-ࢎࢠ-ࣉऄ-हऽॐक़-ॡॱ-ঀঅ-ঌএঐও-নপ-রলশ-হঽৎড়ঢ়য়-ৡৰৱৼਅ-ਊਏਐਓ-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹਖ਼-ੜਫ਼ੲ-ੴઅ-ઍએ-ઑઓ-નપ-રલળવ-હઽૐૠૡૹଅ-ଌଏଐଓ-ନପ-ରଲଳଵ-ହଽଡ଼ଢ଼ୟ-ୡୱஃஅ-ஊஎ-ஐஒ-கஙசஜஞடணதந-பம-ஹௐఅ-ఌఎ-ఐఒ-నప-హఽౘ-ౚౝౠౡಀಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹಽೝೞೠೡೱೲഄ-ഌഎ-ഐഒ-ഺഽൎൔ-ൖൟ-ൡൺ-ൿඅ-ඖක-නඳ-රලව-ෆก-ะาำเ-ๆກຂຄຆ-ຊຌ-ຣລວ-ະາຳຽເ-ໄໆໜ-ໟༀཀ-ཇཉ-ཬྈ-ྌက-ဪဿၐ-ၕၚ-ၝၡၥၦၮ-ၰၵ-ႁႎႠ-ჅჇჍა-ჺჼ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚᎀ-ᎏᎠ-Ᏽᏸ-ᏽᐁ-ᙬᙯ-ᙿᚁ-ᚚᚠ-ᛪᛮ-ᛸᜀ-ᜑᜟ-ᜱᝀ-ᝑᝠ-ᝬᝮ-ᝰក-ឳៗៜᠠ-ᡸᢀ-ᢨᢪᢰ-ᣵᤀ-ᤞᥐ-ᥭᥰ-ᥴᦀ-ᦫᦰ-ᧉᨀ-ᨖᨠ-ᩔᪧᬅ-ᬳᭅ-ᭌᮃ-ᮠᮮᮯᮺ-ᯥᰀ-ᰣᱍ-ᱏᱚ-ᱽᲀ-Ა-ᲺᲽ-Ჿᳩ-ᳬᳮ-ᳳᳵᳶᳺᴀ-ᶿḀ-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼⁱⁿₐ-ₜℂℇℊ-ℓℕ℘-ℝℤΩℨK-ℹℼ-ℿⅅ-ⅉⅎⅠ-ↈⰀ-ⳤⳫ-ⳮⳲⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯⶀ-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞ々-〇〡-〩〱-〵〸-〼ぁ-ゖ゛-ゟァ-ヺー-ヿㄅ-ㄯㄱ-ㆎㆠ-ㆿㇰ-ㇿ㐀-䶿一-ꒌꓐ-ꓽꔀ-ꘌꘐ-ꘟꘪꘫꙀ-ꙮꙿ-ꚝꚠ-ꛯꜗ-ꜟꜢ-ꞈꞋ-Ꟑꟑꟓꟕ-ꟲ-ꠁꠃ-ꠅꠇ-ꠊꠌ-ꠢꡀ-ꡳꢂ-ꢳꣲ-ꣷꣻꣽꣾꤊ-ꤥꤰ-ꥆꥠ-ꥼꦄ-ꦲꧏꧠ-ꧤꧦ-ꧯꧺ-ꧾꨀ-ꨨꩀ-ꩂꩄ-ꩋꩠ-ꩶꩺꩾ-ꪯꪱꪵꪶꪹ-ꪽꫀꫂꫛ-ꫝꫠ-ꫪꫲ-ꫴꬁ-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꬰ-ꭚꭜ-ꭩꭰ-ꯢ가-힣ힰ-ퟆퟋ-ퟻ豈-舘並-龎ff-stﬓ-ﬗיִײַ-ﬨשׁ-זּטּ-לּמּנּסּףּפּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻﹰ-ﹴﹶ-ﻼA-Za-zヲ-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ",$h={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"},Wh="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",qh={5:Wh,"5module":Wh+" export import",6:Wh+" const class extends export import super"},Hh=/^in(stanceof)?$/,Xh=new RegExp("["+jh+"]"),Yh=new RegExp("["+jh+"·̀-ͯ·҃-֑҇-ׇֽֿׁׂׅׄؐ-ًؚ-٩ٰۖ-ۜ۟-۪ۤۧۨ-ۭ۰-۹ܑܰ-݊ަ-ް߀-߉߫-߽߳ࠖ-࠙ࠛ-ࠣࠥ-ࠧࠩ-࡙࠭-࡛-࢟࣊-ࣣ࣡-ःऺ-़ा-ॏ॑-ॗॢॣ०-९ঁ-ঃ়া-ৄেৈো-্ৗৢৣ০-৯৾ਁ-ਃ਼ਾ-ੂੇੈੋ-੍ੑ੦-ੱੵઁ-ઃ઼ા-ૅે-ૉો-્ૢૣ૦-૯ૺ-૿ଁ-ଃ଼ା-ୄେୈୋ-୍୕-ୗୢୣ୦-୯ஂா-ூெ-ைொ-்ௗ௦-௯ఀ-ఄ఼ా-ౄె-ైొ-్ౕౖౢౣ౦-౯ಁ-ಃ಼ಾ-ೄೆ-ೈೊ-್ೕೖೢೣ೦-೯ೳഀ-ഃ഻഼ാ-ൄെ-ൈൊ-്ൗൢൣ൦-൯ඁ-ඃ්ා-ුූෘ-ෟ෦-෯ෲෳัิ-ฺ็-๎๐-๙ັິ-ຼ່-໎໐-໙༘༙༠-༩༹༵༷༾༿ཱ-྄྆྇ྍ-ྗྙ-ྼ࿆ါ-ှ၀-၉ၖ-ၙၞ-ၠၢ-ၤၧ-ၭၱ-ၴႂ-ႍႏ-ႝ፝-፟፩-፱ᜒ-᜕ᜲ-᜴ᝒᝓᝲᝳ឴-៓៝០-៩᠋-᠍᠏-᠙ᢩᤠ-ᤫᤰ-᤻᥆-᥏᧐-᧚ᨗ-ᨛᩕ-ᩞ᩠-᩿᩼-᪉᪐-᪙᪰-᪽ᪿ-ᫎᬀ-ᬄ᬴-᭄᭐-᭙᭫-᭳ᮀ-ᮂᮡ-ᮭ᮰-᮹᯦-᯳ᰤ-᰷᱀-᱉᱐-᱙᳐-᳔᳒-᳨᳭᳴᳷-᳹᷀-᷿‿⁀⁔⃐-⃥⃜⃡-⃰⳯-⵿⳱ⷠ-〪ⷿ-゙゚〯・꘠-꘩꙯ꙴ-꙽ꚞꚟ꛰꛱ꠂ꠆ꠋꠣ-ꠧ꠬ꢀꢁꢴ-ꣅ꣐-꣙꣠-꣱ꣿ-꤉ꤦ-꤭ꥇ-꥓ꦀ-ꦃ꦳-꧀꧐-꧙ꧥ꧰-꧹ꨩ-ꨶꩃꩌꩍ꩐-꩙ꩻ-ꩽꪰꪲ-ꪴꪷꪸꪾ꪿꫁ꫫ-ꫯꫵ꫶ꯣ-ꯪ꯬꯭꯰-꯹ﬞ︀-️︠-︯︳︴﹍-﹏0-9_・]");function Zh(e,t){for(var r=65536,i=0;i<t.length;i+=2){if((r+=t[i])>e)return!1;if((r+=t[i+1])>=e)return!0}return!1}function Kh(e,t){return e<65?36===e:e<91||(e<97?95===e:e<123||(e<=65535?e>=170&&Xh.test(String.fromCharCode(e)):!1!==t&&Zh(e,zh)))}function Jh(e,t){return e<48?36===e:e<58||!(e<65)&&(e<91||(e<97?95===e:e<123||(e<=65535?e>=170&&Yh.test(String.fromCharCode(e)):!1!==t&&(Zh(e,zh)||Zh(e,Gh)))))}var Qh=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 eu(e,t){return new Qh(e,{beforeExpr:!0,binop:t})}var tu={beforeExpr:!0},ru={startsExpr:!0},iu={};function su(e,t){return void 0===t&&(t={}),t.keyword=e,iu[e]=new Qh(e,t)}var nu={num:new Qh("num",ru),regexp:new Qh("regexp",ru),string:new Qh("string",ru),name:new Qh("name",ru),privateId:new Qh("privateId",ru),eof:new Qh("eof"),bracketL:new Qh("[",{beforeExpr:!0,startsExpr:!0}),bracketR:new Qh("]"),braceL:new Qh("{",{beforeExpr:!0,startsExpr:!0}),braceR:new Qh("}"),parenL:new Qh("(",{beforeExpr:!0,startsExpr:!0}),parenR:new Qh(")"),comma:new Qh(",",tu),semi:new Qh(";",tu),colon:new Qh(":",tu),dot:new Qh("."),question:new Qh("?",tu),questionDot:new Qh("?."),arrow:new Qh("=>",tu),template:new Qh("template"),invalidTemplate:new Qh("invalidTemplate"),ellipsis:new Qh("...",tu),backQuote:new Qh("`",ru),dollarBraceL:new Qh("${",{beforeExpr:!0,startsExpr:!0}),eq:new Qh("=",{beforeExpr:!0,isAssign:!0}),assign:new Qh("_=",{beforeExpr:!0,isAssign:!0}),incDec:new Qh("++/--",{prefix:!0,postfix:!0,startsExpr:!0}),prefix:new Qh("!/~",{beforeExpr:!0,prefix:!0,startsExpr:!0}),logicalOR:eu("||",1),logicalAND:eu("&&",2),bitwiseOR:eu("|",3),bitwiseXOR:eu("^",4),bitwiseAND:eu("&",5),equality:eu("==/!=/===/!==",6),relational:eu("</>/<=/>=",7),bitShift:eu("<</>>/>>>",8),plusMin:new Qh("+/-",{beforeExpr:!0,binop:9,prefix:!0,startsExpr:!0}),modulo:eu("%",10),star:eu("*",10),slash:eu("/",10),starstar:new Qh("**",{beforeExpr:!0}),coalesce:eu("??",1),_break:su("break"),_case:su("case",tu),_catch:su("catch"),_continue:su("continue"),_debugger:su("debugger"),_default:su("default",tu),_do:su("do",{isLoop:!0,beforeExpr:!0}),_else:su("else",tu),_finally:su("finally"),_for:su("for",{isLoop:!0}),_function:su("function",ru),_if:su("if"),_return:su("return",tu),_switch:su("switch"),_throw:su("throw",tu),_try:su("try"),_var:su("var"),_const:su("const"),_while:su("while",{isLoop:!0}),_with:su("with"),_new:su("new",{beforeExpr:!0,startsExpr:!0}),_this:su("this",ru),_super:su("super",ru),_class:su("class",ru),_extends:su("extends",tu),_export:su("export"),_import:su("import",ru),_null:su("null",ru),_true:su("true",ru),_false:su("false",ru),_in:su("in",{beforeExpr:!0,binop:7}),_instanceof:su("instanceof",{beforeExpr:!0,binop:7}),_typeof:su("typeof",{beforeExpr:!0,prefix:!0,startsExpr:!0}),_void:su("void",{beforeExpr:!0,prefix:!0,startsExpr:!0}),_delete:su("delete",{beforeExpr:!0,prefix:!0,startsExpr:!0})},au=/\r\n?|\n|\u2028|\u2029/,ou=new RegExp(au.source,"g");function hu(e){return 10===e||13===e||8232===e||8233===e}function uu(e,t,r){void 0===r&&(r=e.length);for(var i=t;i<r;i++){var s=e.charCodeAt(i);if(hu(s))return i<r-1&&13===s&&10===e.charCodeAt(i+1)?i+2:i+1}return-1}var lu=/[\u1680\u2000-\u200a\u202f\u205f\u3000\ufeff]/,cu=/(?:\s|\/\/.*|\/\*[^]*?\*\/)*/g,pu=Object.prototype,du=pu.hasOwnProperty,fu=pu.toString,gu=Object.hasOwn||function(e,t){return du.call(e,t)},mu=Array.isArray||function(e){return"[object Array]"===fu.call(e)},yu=Object.create(null);function xu(e){return yu[e]||(yu[e]=new RegExp("^(?:"+e.replace(/ /g,"|")+")$"))}function vu(e){return e<=65535?String.fromCharCode(e):(e-=65536,String.fromCharCode(55296+(e>>10),56320+(1023&e)))}var bu=/(?:[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])/,_u=function(e,t){this.line=e,this.column=t};_u.prototype.offset=function(e){return new _u(this.line,this.column+e)};var wu=function(e,t,r){this.start=t,this.end=r,null!==e.sourceFile&&(this.source=e.sourceFile)};function Cu(e,t){for(var r=1,i=0;;){var s=uu(e,i,t);if(s<0)return new _u(r,t-i);++r,i=s}}var Du={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},Eu=!1;function Au(e){var t={};for(var r in Du)t[r]=e&&gu(e,r)?e[r]:Du[r];if("latest"===t.ecmaVersion?t.ecmaVersion=1e8:null==t.ecmaVersion?(!Eu&&"object"==typeof console&&console.warn&&(Eu=!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),mu(t.onToken)){var i=t.onToken;t.onToken=function(e){return i.push(e)}}return mu(t.onComment)&&(t.onComment=function(e,t){return function(r,i,s,n,a,o){var h={type:r?"Block":"Line",value:i,start:s,end:n};e.locations&&(h.loc=new wu(this,a,o)),e.ranges&&(h.range=[s,n]),t.push(h)}}(t,t.onComment)),t}var Su=256;function Fu(e,t){return 2|(e?4:0)|(t?8:0)}var Tu=function(e,t,r){this.options=e=Au(e),this.sourceFile=e.sourceFile,this.keywords=xu(qh[e.ecmaVersion>=6?6:"module"===e.sourceType?"5module":5]);var i="";!0!==e.allowReserved&&(i=$h[e.ecmaVersion>=6?6:5===e.ecmaVersion?5:3],"module"===e.sourceType&&(i+=" await")),this.reservedWords=xu(i);var s=(i?i+" ":"")+$h.strict;this.reservedWordsStrict=xu(s),this.reservedWordsStrictBind=xu(s+" "+$h.strictBind),this.input=String(t),this.containsEsc=!1,r?(this.pos=r,this.lineStart=this.input.lastIndexOf("\n",r-1)+1,this.curLine=this.input.slice(0,this.lineStart).split(au).length):(this.pos=this.lineStart=0,this.curLine=1),this.type=nu.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=[]},Mu={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}};Tu.prototype.parse=function(){var e=this.options.program||this.startNode();return this.nextToken(),this.parseTopLevel(e)},Mu.inFunction.get=function(){return(2&this.currentVarScope().flags)>0},Mu.inGenerator.get=function(){return(8&this.currentVarScope().flags)>0&&!this.currentVarScope().inClassFieldInit},Mu.inAsync.get=function(){return(4&this.currentVarScope().flags)>0&&!this.currentVarScope().inClassFieldInit},Mu.canAwait.get=function(){for(var e=this.scopeStack.length-1;e>=0;e--){var t=this.scopeStack[e];if(t.inClassFieldInit||t.flags&Su)return!1;if(2&t.flags)return(4&t.flags)>0}return this.inModule&&this.options.ecmaVersion>=13||this.options.allowAwaitOutsideFunction},Mu.allowSuper.get=function(){var e=this.currentThisScope(),t=e.flags,r=e.inClassFieldInit;return(64&t)>0||r||this.options.allowSuperOutsideMethod},Mu.allowDirectSuper.get=function(){return(128&this.currentThisScope().flags)>0},Mu.treatFunctionsAsVar.get=function(){return this.treatFunctionsAsVarInScope(this.currentScope())},Mu.allowNewDotTarget.get=function(){var e=this.currentThisScope(),t=e.flags,r=e.inClassFieldInit;return(258&t)>0||r},Mu.inClassStaticBlock.get=function(){return(this.currentVarScope().flags&Su)>0},Tu.extend=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];for(var r=this,i=0;i<e.length;i++)r=e[i](r);return r},Tu.parse=function(e,t){return new this(t,e).parse()},Tu.parseExpressionAt=function(e,t,r){var i=new this(r,e,t);return i.nextToken(),i.parseExpression()},Tu.tokenizer=function(e,t){return new this(t,e)},Object.defineProperties(Tu.prototype,Mu);var ku=Tu.prototype,Iu=/^(?:'((?:\\[^]|[^'\\])*?)'|"((?:\\[^]|[^"\\])*?)")/;ku.strictDirective=function(e){if(this.options.ecmaVersion<5)return!1;for(;;){cu.lastIndex=e,e+=cu.exec(this.input)[0].length;var t=Iu.exec(this.input.slice(e));if(!t)return!1;if("use strict"===(t[1]||t[2])){cu.lastIndex=e+t[0].length;var r=cu.exec(this.input),i=r.index+r[0].length,s=this.input.charAt(i);return";"===s||"}"===s||au.test(r[0])&&!(/[(`.[+\-/*%<>=,?^&]/.test(s)||"!"===s&&"="===this.input.charAt(i+1))}e+=t[0].length,cu.lastIndex=e,e+=cu.exec(this.input)[0].length,";"===this.input[e]&&e++}},ku.eat=function(e){return this.type===e&&(this.next(),!0)},ku.isContextual=function(e){return this.type===nu.name&&this.value===e&&!this.containsEsc},ku.eatContextual=function(e){return!!this.isContextual(e)&&(this.next(),!0)},ku.expectContextual=function(e){this.eatContextual(e)||this.unexpected()},ku.canInsertSemicolon=function(){return this.type===nu.eof||this.type===nu.braceR||au.test(this.input.slice(this.lastTokEnd,this.start))},ku.insertSemicolon=function(){if(this.canInsertSemicolon())return this.options.onInsertedSemicolon&&this.options.onInsertedSemicolon(this.lastTokEnd,this.lastTokEndLoc),!0},ku.semicolon=function(){this.eat(nu.semi)||this.insertSemicolon()||this.unexpected()},ku.afterTrailingComma=function(e,t){if(this.type===e)return this.options.onTrailingComma&&this.options.onTrailingComma(this.lastTokStart,this.lastTokStartLoc),t||this.next(),!0},ku.expect=function(e){this.eat(e)||this.unexpected()},ku.unexpected=function(e){this.raise(null!=e?e:this.start,"Unexpected token")};var Bu=function(){this.shorthandAssign=this.trailingComma=this.parenthesizedAssign=this.parenthesizedBind=this.doubleProto=-1};ku.checkPatternErrors=function(e,t){if(e){e.trailingComma>-1&&this.raiseRecoverable(e.trailingComma,"Comma is not permitted after the rest element");var r=t?e.parenthesizedAssign:e.parenthesizedBind;r>-1&&this.raiseRecoverable(r,t?"Assigning to rvalue":"Parenthesized pattern")}},ku.checkExpressionErrors=function(e,t){if(!e)return!1;var r=e.shorthandAssign,i=e.doubleProto;if(!t)return r>=0||i>=0;r>=0&&this.raise(r,"Shorthand property assignments are valid only in destructuring patterns"),i>=0&&this.raiseRecoverable(i,"Redefinition of __proto__ property")},ku.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")},ku.isSimpleAssignTarget=function(e){return"ParenthesizedExpression"===e.type?this.isSimpleAssignTarget(e.expression):"Identifier"===e.type||"MemberExpression"===e.type};var Lu=Tu.prototype;Lu.parseTopLevel=function(e){var t=Object.create(null);for(e.body||(e.body=[]);this.type!==nu.eof;){var r=this.parseStatement(null,!0,t);e.body.push(r)}if(this.inModule)for(var i=0,s=Object.keys(this.undefinedExports);i<s.length;i+=1){var n=s[i];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 Pu={kind:"loop"},Ou={kind:"switch"};Lu.isLet=function(e){if(this.options.ecmaVersion<6||!this.isContextual("let"))return!1;cu.lastIndex=this.pos;var t=cu.exec(this.input),r=this.pos+t[0].length,i=this.input.charCodeAt(r);if(91===i||92===i)return!0;if(e)return!1;if(123===i||i>55295&&i<56320)return!0;if(Kh(i,!0)){for(var s=r+1;Jh(i=this.input.charCodeAt(s),!0);)++s;if(92===i||i>55295&&i<56320)return!0;var n=this.input.slice(r,s);if(!Hh.test(n))return!0}return!1},Lu.isAsyncFunction=function(){if(this.options.ecmaVersion<8||!this.isContextual("async"))return!1;cu.lastIndex=this.pos;var e,t=cu.exec(this.input),r=this.pos+t[0].length;return!(au.test(this.input.slice(this.pos,r))||"function"!==this.input.slice(r,r+8)||r+8!==this.input.length&&(Jh(e=this.input.charCodeAt(r+8))||e>55295&&e<56320))},Lu.parseStatement=function(e,t,r){var i,s=this.type,n=this.startNode();switch(this.isLet(e)&&(s=nu._var,i="let"),s){case nu._break:case nu._continue:return this.parseBreakContinueStatement(n,s.keyword);case nu._debugger:return this.parseDebuggerStatement(n);case nu._do:return this.parseDoStatement(n);case nu._for:return this.parseForStatement(n);case nu._function:return e&&(this.strict||"if"!==e&&"label"!==e)&&this.options.ecmaVersion>=6&&this.unexpected(),this.parseFunctionStatement(n,!1,!e);case nu._class:return e&&this.unexpected(),this.parseClass(n,!0);case nu._if:return this.parseIfStatement(n);case nu._return:return this.parseReturnStatement(n);case nu._switch:return this.parseSwitchStatement(n);case nu._throw:return this.parseThrowStatement(n);case nu._try:return this.parseTryStatement(n);case nu._const:case nu._var:return i=i||this.value,e&&"var"!==i&&this.unexpected(),this.parseVarStatement(n,i);case nu._while:return this.parseWhileStatement(n);case nu._with:return this.parseWithStatement(n);case nu.braceL:return this.parseBlock(!0,n);case nu.semi:return this.parseEmptyStatement(n);case nu._export:case nu._import:if(this.options.ecmaVersion>10&&s===nu._import){cu.lastIndex=this.pos;var a=cu.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===nu._import?this.parseImport(n):this.parseExport(n,r);default:if(this.isAsyncFunction())return e&&this.unexpected(),this.next(),this.parseFunctionStatement(n,!0,!e);var u=this.value,l=this.parseExpression();return s===nu.name&&"Identifier"===l.type&&this.eat(nu.colon)?this.parseLabeledStatement(n,u,l,e):this.parseExpressionStatement(n,l)}},Lu.parseBreakContinueStatement=function(e,t){var r="break"===t;this.next(),this.eat(nu.semi)||this.insertSemicolon()?e.label=null:this.type!==nu.name?this.unexpected():(e.label=this.parseIdent(),this.semicolon());for(var i=0;i<this.labels.length;++i){var s=this.labels[i];if(null==e.label||s.name===e.label.name){if(null!=s.kind&&(r||"loop"===s.kind))break;if(e.label&&r)break}}return i===this.labels.length&&this.raise(e.start,"Unsyntactic "+t),this.finishNode(e,r?"BreakStatement":"ContinueStatement")},Lu.parseDebuggerStatement=function(e){return this.next(),this.semicolon(),this.finishNode(e,"DebuggerStatement")},Lu.parseDoStatement=function(e){return this.next(),this.labels.push(Pu),e.body=this.parseStatement("do"),this.labels.pop(),this.expect(nu._while),e.test=this.parseParenExpression(),this.options.ecmaVersion>=6?this.eat(nu.semi):this.semicolon(),this.finishNode(e,"DoWhileStatement")},Lu.parseForStatement=function(e){this.next();var t=this.options.ecmaVersion>=9&&this.canAwait&&this.eatContextual("await")?this.lastTokStart:-1;if(this.labels.push(Pu),this.enterScope(0),this.expect(nu.parenL),this.type===nu.semi)return t>-1&&this.unexpected(t),this.parseFor(e,null);var r=this.isLet();if(this.type===nu._var||this.type===nu._const||r){var i=this.startNode(),s=r?"let":this.value;return this.next(),this.parseVar(i,!0,s),this.finishNode(i,"VariableDeclaration"),(this.type===nu._in||this.options.ecmaVersion>=6&&this.isContextual("of"))&&1===i.declarations.length?(this.options.ecmaVersion>=9&&(this.type===nu._in?t>-1&&this.unexpected(t):e.await=t>-1),this.parseForIn(e,i)):(t>-1&&this.unexpected(t),this.parseFor(e,i))}var n=this.isContextual("let"),a=!1,o=this.containsEsc,h=new Bu,u=this.start,l=t>-1?this.parseExprSubscripts(h,"await"):this.parseExpression(!0,h);return this.type===nu._in||(a=this.options.ecmaVersion>=6&&this.isContextual("of"))?(t>-1?(this.type===nu._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))},Lu.parseFunctionStatement=function(e,t,r){return this.next(),this.parseFunction(e,Ru|(r?0:Vu),!1,t)},Lu.parseIfStatement=function(e){return this.next(),e.test=this.parseParenExpression(),e.consequent=this.parseStatement("if"),e.alternate=this.eat(nu._else)?this.parseStatement("if"):null,this.finishNode(e,"IfStatement")},Lu.parseReturnStatement=function(e){return this.inFunction||this.options.allowReturnOutsideFunction||this.raise(this.start,"'return' outside of function"),this.next(),this.eat(nu.semi)||this.insertSemicolon()?e.argument=null:(e.argument=this.parseExpression(),this.semicolon()),this.finishNode(e,"ReturnStatement")},Lu.parseSwitchStatement=function(e){var t;this.next(),e.discriminant=this.parseParenExpression(),e.cases=[],this.expect(nu.braceL),this.labels.push(Ou),this.enterScope(0);for(var r=!1;this.type!==nu.braceR;)if(this.type===nu._case||this.type===nu._default){var i=this.type===nu._case;t&&this.finishNode(t,"SwitchCase"),e.cases.push(t=this.startNode()),t.consequent=[],this.next(),i?t.test=this.parseExpression():(r&&this.raiseRecoverable(this.lastTokStart,"Multiple default clauses"),r=!0,t.test=null),this.expect(nu.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")},Lu.parseThrowStatement=function(e){return this.next(),au.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 Nu=[];Lu.parseCatchClauseParam=function(){var e=this.parseBindingAtom(),t="Identifier"===e.type;return this.enterScope(t?32:0),this.checkLValPattern(e,t?4:2),this.expect(nu.parenR),e},Lu.parseTryStatement=function(e){if(this.next(),e.block=this.parseBlock(),e.handler=null,this.type===nu._catch){var t=this.startNode();this.next(),this.eat(nu.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(nu._finally)?this.parseBlock():null,e.handler||e.finalizer||this.raise(e.start,"Missing catch or finally clause"),this.finishNode(e,"TryStatement")},Lu.parseVarStatement=function(e,t,r){return this.next(),this.parseVar(e,!1,t,r),this.semicolon(),this.finishNode(e,"VariableDeclaration")},Lu.parseWhileStatement=function(e){return this.next(),e.test=this.parseParenExpression(),this.labels.push(Pu),e.body=this.parseStatement("while"),this.labels.pop(),this.finishNode(e,"WhileStatement")},Lu.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")},Lu.parseEmptyStatement=function(e){return this.next(),this.finishNode(e,"EmptyStatement")},Lu.parseLabeledStatement=function(e,t,r,i){for(var s=0,n=this.labels;s<n.length;s+=1){n[s].name===t&&this.raise(r.start,"Label '"+t+"' is already declared")}for(var a=this.type.isLoop?"loop":this.type===nu._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(i?-1===i.indexOf("label")?i+"label":i:"label"),this.labels.pop(),e.label=r,this.finishNode(e,"LabeledStatement")},Lu.parseExpressionStatement=function(e,t){return e.expression=t,this.semicolon(),this.finishNode(e,"ExpressionStatement")},Lu.parseBlock=function(e,t,r){for(void 0===e&&(e=!0),void 0===t&&(t=this.startNode()),t.body=[],this.expect(nu.braceL),e&&this.enterScope(0);this.type!==nu.braceR;){var i=this.parseStatement(null);t.body.push(i)}return r&&(this.strict=!1),this.next(),e&&this.exitScope(),this.finishNode(t,"BlockStatement")},Lu.parseFor=function(e,t){return e.init=t,this.expect(nu.semi),e.test=this.type===nu.semi?null:this.parseExpression(),this.expect(nu.semi),e.update=this.type===nu.parenR?null:this.parseExpression(),this.expect(nu.parenR),e.body=this.parseStatement("for"),this.exitScope(),this.labels.pop(),this.finishNode(e,"ForStatement")},Lu.parseForIn=function(e,t){var r=this.type===nu._in;return this.next(),"VariableDeclaration"===t.type&&null!=t.declarations[0].init&&(!r||this.options.ecmaVersion<8||this.strict||"var"!==t.kind||"Identifier"!==t.declarations[0].id.type)&&this.raise(t.start,(r?"for-in":"for-of")+" loop variable declaration may not have an initializer"),e.left=t,e.right=r?this.parseExpression():this.parseMaybeAssign(),this.expect(nu.parenR),e.body=this.parseStatement("for"),this.exitScope(),this.labels.pop(),this.finishNode(e,r?"ForInStatement":"ForOfStatement")},Lu.parseVar=function(e,t,r,i){for(e.declarations=[],e.kind=r;;){var s=this.startNode();if(this.parseVarId(s,r),this.eat(nu.eq)?s.init=this.parseMaybeAssign(t):i||"const"!==r||this.type===nu._in||this.options.ecmaVersion>=6&&this.isContextual("of")?i||"Identifier"===s.id.type||t&&(this.type===nu._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(nu.comma))break}return e},Lu.parseVarId=function(e,t){e.id=this.parseBindingAtom(),this.checkLValPattern(e.id,"var"===t?1:2,!1)};var Ru=1,Vu=2;function Uu(e,t){var r=t.key.name,i=e[r],s="true";return"MethodDefinition"!==t.type||"get"!==t.kind&&"set"!==t.kind||(s=(t.static?"s":"i")+t.kind),"iget"===i&&"iset"===s||"iset"===i&&"iget"===s||"sget"===i&&"sset"===s||"sset"===i&&"sget"===s?(e[r]="true",!1):!!i||(e[r]=s,!1)}function Gu(e,t){var r=e.computed,i=e.key;return!r&&("Identifier"===i.type&&i.name===t||"Literal"===i.type&&i.value===t)}Lu.parseFunction=function(e,t,r,i,s){this.initFunction(e),(this.options.ecmaVersion>=9||this.options.ecmaVersion>=6&&!i)&&(this.type===nu.star&&t&Vu&&this.unexpected(),e.generator=this.eat(nu.star)),this.options.ecmaVersion>=8&&(e.async=!!i),t&Ru&&(e.id=4&t&&this.type!==nu.name?null:this.parseIdent(),!e.id||t&Vu||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(Fu(e.async,e.generator)),t&Ru||(e.id=this.type===nu.name?this.parseIdent():null),this.parseFunctionParams(e),this.parseFunctionBody(e,r,!1,s),this.yieldPos=n,this.awaitPos=a,this.awaitIdentPos=o,this.finishNode(e,t&Ru?"FunctionDeclaration":"FunctionExpression")},Lu.parseFunctionParams=function(e){this.expect(nu.parenL),e.params=this.parseBindingList(nu.parenR,!1,this.options.ecmaVersion>=8),this.checkYieldAwaitInDefaultParams()},Lu.parseClass=function(e,t){this.next();var r=this.strict;this.strict=!0,this.parseClassId(e,t),this.parseClassSuper(e);var i=this.enterClassBody(),s=this.startNode(),n=!1;for(s.body=[],this.expect(nu.braceL);this.type!==nu.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&&Uu(i,a)&&this.raiseRecoverable(a.key.start,"Identifier '#"+a.key.name+"' has already been declared"))}return this.strict=r,this.next(),e.body=this.finishNode(s,"ClassBody"),this.exitClassBody(),this.finishNode(e,t?"ClassDeclaration":"ClassExpression")},Lu.parseClassElement=function(e){if(this.eat(nu.semi))return null;var t=this.options.ecmaVersion,r=this.startNode(),i="",s=!1,n=!1,a="method",o=!1;if(this.eatContextual("static")){if(t>=13&&this.eat(nu.braceL))return this.parseClassStaticBlock(r),r;this.isClassElementNameStart()||this.type===nu.star?o=!0:i="static"}if(r.static=o,!i&&t>=8&&this.eatContextual("async")&&(!this.isClassElementNameStart()&&this.type!==nu.star||this.canInsertSemicolon()?i="async":n=!0),!i&&(t>=9||!n)&&this.eat(nu.star)&&(s=!0),!i&&!n&&!s){var h=this.value;(this.eatContextual("get")||this.eatContextual("set"))&&(this.isClassElementNameStart()?a=h:i=h)}if(i?(r.computed=!1,r.key=this.startNodeAt(this.lastTokStart,this.lastTokStartLoc),r.key.name=i,this.finishNode(r.key,"Identifier")):this.parseClassElementName(r),t<13||this.type===nu.parenL||"method"!==a||s||n){var u=!r.static&&Gu(r,"constructor"),l=u&&e;u&&"method"!==a&&this.raise(r.key.start,"Constructor can't have get/set modifier"),r.kind=u?"constructor":a,this.parseClassMethod(r,s,n,l)}else this.parseClassField(r);return r},Lu.isClassElementNameStart=function(){return this.type===nu.name||this.type===nu.privateId||this.type===nu.num||this.type===nu.string||this.type===nu.bracketL||this.type.keyword},Lu.parseClassElementName=function(e){this.type===nu.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)},Lu.parseClassMethod=function(e,t,r,i){var s=e.key;"constructor"===e.kind?(t&&this.raise(s.start,"Constructor can't be a generator"),r&&this.raise(s.start,"Constructor can't be an async method")):e.static&&Gu(e,"prototype")&&this.raise(s.start,"Classes may not have a static property named prototype");var n=e.value=this.parseMethod(t,r,i);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")},Lu.parseClassField=function(e){if(Gu(e,"constructor")?this.raise(e.key.start,"Classes can't have a field named 'constructor'"):e.static&&Gu(e,"prototype")&&this.raise(e.key.start,"Classes can't have a static field named 'prototype'"),this.eat(nu.eq)){var t=this.currentThisScope(),r=t.inClassFieldInit;t.inClassFieldInit=!0,e.value=this.parseMaybeAssign(),t.inClassFieldInit=r}else e.value=null;return this.semicolon(),this.finishNode(e,"PropertyDefinition")},Lu.parseClassStaticBlock=function(e){e.body=[];var t=this.labels;for(this.labels=[],this.enterScope(320);this.type!==nu.braceR;){var r=this.parseStatement(null);e.body.push(r)}return this.next(),this.exitScope(),this.labels=t,this.finishNode(e,"StaticBlock")},Lu.parseClassId=function(e,t){this.type===nu.name?(e.id=this.parseIdent(),t&&this.checkLValSimple(e.id,2,!1)):(!0===t&&this.unexpected(),e.id=null)},Lu.parseClassSuper=function(e){e.superClass=this.eat(nu._extends)?this.parseExprSubscripts(null,!1):null},Lu.enterClassBody=function(){var e={declared:Object.create(null),used:[]};return this.privateNameStack.push(e),e.declared},Lu.exitClassBody=function(){var e=this.privateNameStack.pop(),t=e.declared,r=e.used;if(this.options.checkPrivateFields)for(var i=this.privateNameStack.length,s=0===i?null:this.privateNameStack[i-1],n=0;n<r.length;++n){var a=r[n];gu(t,a.name)||(s?s.used.push(a):this.raiseRecoverable(a.start,"Private field '#"+a.name+"' must be declared in an enclosing class"))}},Lu.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!==nu.string&&this.unexpected(),e.source=this.parseExprAtom(),this.options.ecmaVersion>=16&&(e.attributes=this.parseWithClause()),this.semicolon(),this.finishNode(e,"ExportAllDeclaration")},Lu.parseExport=function(e,t){if(this.next(),this.eat(nu.star))return this.parseExportAllDeclaration(e,t);if(this.eat(nu._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!==nu.string&&this.unexpected(),e.source=this.parseExprAtom(),this.options.ecmaVersion>=16&&(e.attributes=this.parseWithClause());else{for(var r=0,i=e.specifiers;r<i.length;r+=1){var s=i[r];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")},Lu.parseExportDeclaration=function(e){return this.parseStatement(null)},Lu.parseExportDefaultDeclaration=function(){var e;if(this.type===nu._function||(e=this.isAsyncFunction())){var t=this.startNode();return this.next(),e&&this.next(),this.parseFunction(t,4|Ru,!1,e)}if(this.type===nu._class){var r=this.startNode();return this.parseClass(r,"nullableID")}var i=this.parseMaybeAssign();return this.semicolon(),i},Lu.checkExport=function(e,t,r){e&&("string"!=typeof t&&(t="Identifier"===t.type?t.name:t.value),gu(e,t)&&this.raiseRecoverable(r,"Duplicate export '"+t+"'"),e[t]=!0)},Lu.checkPatternExport=function(e,t){var r=t.type;if("Identifier"===r)this.checkExport(e,t,t.start);else if("ObjectPattern"===r)for(var i=0,s=t.properties;i<s.length;i+=1){var n=s[i];this.checkPatternExport(e,n)}else if("ArrayPattern"===r)for(var a=0,o=t.elements;a<o.length;a+=1){var h=o[a];h&&this.checkPatternExport(e,h)}else"Property"===r?this.checkPatternExport(e,t.value):"AssignmentPattern"===r?this.checkPatternExport(e,t.left):"RestElement"===r&&this.checkPatternExport(e,t.argument)},Lu.checkVariableExport=function(e,t){if(e)for(var r=0,i=t;r<i.length;r+=1){var s=i[r];this.checkPatternExport(e,s.id)}},Lu.shouldParseExportStatement=function(){return"var"===this.type.keyword||"const"===this.type.keyword||"class"===this.type.keyword||"function"===this.type.keyword||this.isLet()||this.isAsyncFunction()},Lu.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")},Lu.parseExportSpecifiers=function(e){var t=[],r=!0;for(this.expect(nu.braceL);!this.eat(nu.braceR);){if(r)r=!1;else if(this.expect(nu.comma),this.afterTrailingComma(nu.braceR))break;t.push(this.parseExportSpecifier(e))}return t},Lu.parseImport=function(e){return this.next(),this.type===nu.string?(e.specifiers=Nu,e.source=this.parseExprAtom()):(e.specifiers=this.parseImportSpecifiers(),this.expectContextual("from"),e.source=this.type===nu.string?this.parseExprAtom():this.unexpected()),this.options.ecmaVersion>=16&&(e.attributes=this.parseWithClause()),this.semicolon(),this.finishNode(e,"ImportDeclaration")},Lu.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")},Lu.parseImportDefaultSpecifier=function(){var e=this.startNode();return e.local=this.parseIdent(),this.checkLValSimple(e.local,2),this.finishNode(e,"ImportDefaultSpecifier")},Lu.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")},Lu.parseImportSpecifiers=function(){var e=[],t=!0;if(this.type===nu.name&&(e.push(this.parseImportDefaultSpecifier()),!this.eat(nu.comma)))return e;if(this.type===nu.star)return e.push(this.parseImportNamespaceSpecifier()),e;for(this.expect(nu.braceL);!this.eat(nu.braceR);){if(t)t=!1;else if(this.expect(nu.comma),this.afterTrailingComma(nu.braceR))break;e.push(this.parseImportSpecifier())}return e},Lu.parseWithClause=function(){var e=[];if(!this.eat(nu._with))return e;this.expect(nu.braceL);for(var t={},r=!0;!this.eat(nu.braceR);){if(r)r=!1;else if(this.expect(nu.comma),this.afterTrailingComma(nu.braceR))break;var i=this.parseImportAttribute(),s="Identifier"===i.key.type?i.key.name:i.key.value;gu(t,s)&&this.raiseRecoverable(i.key.start,"Duplicate attribute key '"+s+"'"),t[s]=!0,e.push(i)}return e},Lu.parseImportAttribute=function(){var e=this.startNode();return e.key=this.type===nu.string?this.parseExprAtom():this.parseIdent("never"!==this.options.allowReserved),this.expect(nu.colon),this.type!==nu.string&&this.unexpected(),e.value=this.parseExprAtom(),this.finishNode(e,"ImportAttribute")},Lu.parseModuleExportName=function(){if(this.options.ecmaVersion>=13&&this.type===nu.string){var e=this.parseLiteral(this.value);return bu.test(e.value)&&this.raise(e.start,"An export name cannot include a lone surrogate."),e}return this.parseIdent(!0)},Lu.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)},Lu.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 zu=Tu.prototype;zu.toAssignable=function(e,t,r){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",r&&this.checkPatternErrors(r,!0);for(var i=0,s=e.properties;i<s.length;i+=1){var n=s[i];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",r&&this.checkPatternErrors(r,!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,r);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 r&&this.checkPatternErrors(r,!0);return e},zu.toAssignableList=function(e,t){for(var r=e.length,i=0;i<r;i++){var s=e[i];s&&this.toAssignable(s,t)}if(r){var n=e[r-1];6===this.options.ecmaVersion&&t&&n&&"RestElement"===n.type&&"Identifier"!==n.argument.type&&this.unexpected(n.argument.start)}return e},zu.parseSpread=function(e){var t=this.startNode();return this.next(),t.argument=this.parseMaybeAssign(!1,e),this.finishNode(t,"SpreadElement")},zu.parseRestBinding=function(){var e=this.startNode();return this.next(),6===this.options.ecmaVersion&&this.type!==nu.name&&this.unexpected(),e.argument=this.parseBindingAtom(),this.finishNode(e,"RestElement")},zu.parseBindingAtom=function(){if(this.options.ecmaVersion>=6)switch(this.type){case nu.bracketL:var e=this.startNode();return this.next(),e.elements=this.parseBindingList(nu.bracketR,!0,!0),this.finishNode(e,"ArrayPattern");case nu.braceL:return this.parseObj(!0)}return this.parseIdent()},zu.parseBindingList=function(e,t,r,i){for(var s=[],n=!0;!this.eat(e);)if(n?n=!1:this.expect(nu.comma),t&&this.type===nu.comma)s.push(null);else{if(r&&this.afterTrailingComma(e))break;if(this.type===nu.ellipsis){var a=this.parseRestBinding();this.parseBindingListItem(a),s.push(a),this.type===nu.comma&&this.raiseRecoverable(this.start,"Comma is not permitted after the rest element"),this.expect(e);break}s.push(this.parseAssignableListItem(i))}return s},zu.parseAssignableListItem=function(e){var t=this.parseMaybeDefault(this.start,this.startLoc);return this.parseBindingListItem(t),t},zu.parseBindingListItem=function(e){return e},zu.parseMaybeDefault=function(e,t,r){if(r=r||this.parseBindingAtom(),this.options.ecmaVersion<6||!this.eat(nu.eq))return r;var i=this.startNodeAt(e,t);return i.left=r,i.right=this.parseMaybeAssign(),this.finishNode(i,"AssignmentPattern")},zu.checkLValSimple=function(e,t,r){void 0===t&&(t=0);var i=0!==t;switch(e.type){case"Identifier":this.strict&&this.reservedWordsStrictBind.test(e.name)&&this.raiseRecoverable(e.start,(i?"Binding ":"Assigning to ")+e.name+" in strict mode"),i&&(2===t&&"let"===e.name&&this.raiseRecoverable(e.start,"let is disallowed as a lexically bound name"),r&&(gu(r,e.name)&&this.raiseRecoverable(e.start,"Argument name clash"),r[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":i&&this.raiseRecoverable(e.start,"Binding member expression");break;case"ParenthesizedExpression":return i&&this.raiseRecoverable(e.start,"Binding parenthesized expression"),this.checkLValSimple(e.expression,t,r);default:this.raise(e.start,(i?"Binding":"Assigning to")+" rvalue")}},zu.checkLValPattern=function(e,t,r){switch(void 0===t&&(t=0),e.type){case"ObjectPattern":for(var i=0,s=e.properties;i<s.length;i+=1){var n=s[i];this.checkLValInnerPattern(n,t,r)}break;case"ArrayPattern":for(var a=0,o=e.elements;a<o.length;a+=1){var h=o[a];h&&this.checkLValInnerPattern(h,t,r)}break;default:this.checkLValSimple(e,t,r)}},zu.checkLValInnerPattern=function(e,t,r){switch(void 0===t&&(t=0),e.type){case"Property":this.checkLValInnerPattern(e.value,t,r);break;case"AssignmentPattern":this.checkLValPattern(e.left,t,r);break;case"RestElement":this.checkLValPattern(e.argument,t,r);break;default:this.checkLValPattern(e,t,r)}};var ju=function(e,t,r,i,s){this.token=e,this.isExpr=!!t,this.preserveSpace=!!r,this.override=i,this.generator=!!s},$u={b_stat:new ju("{",!1),b_expr:new ju("{",!0),b_tmpl:new ju("${",!1),p_stat:new ju("(",!1),p_expr:new ju("(",!0),q_tmpl:new ju("`",!0,!0,(function(e){return e.tryReadTemplateToken()})),f_stat:new ju("function",!1),f_expr:new ju("function",!0),f_expr_gen:new ju("function",!0,!1,null,!0),f_gen:new ju("function",!1,!1,null,!0)},Wu=Tu.prototype;Wu.initialContext=function(){return[$u.b_stat]},Wu.curContext=function(){return this.context[this.context.length-1]},Wu.braceIsBlock=function(e){var t=this.curContext();return t===$u.f_expr||t===$u.f_stat||(e!==nu.colon||t!==$u.b_stat&&t!==$u.b_expr?e===nu._return||e===nu.name&&this.exprAllowed?au.test(this.input.slice(this.lastTokEnd,this.start)):e===nu._else||e===nu.semi||e===nu.eof||e===nu.parenR||e===nu.arrow||(e===nu.braceL?t===$u.b_stat:e!==nu._var&&e!==nu._const&&e!==nu.name&&!this.exprAllowed):!t.isExpr)},Wu.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},Wu.updateContext=function(e){var t,r=this.type;r.keyword&&e===nu.dot?this.exprAllowed=!1:(t=r.updateContext)?t.call(this,e):this.exprAllowed=r.beforeExpr},Wu.overrideContext=function(e){this.curContext()!==e&&(this.context[this.context.length-1]=e)},nu.parenR.updateContext=nu.braceR.updateContext=function(){if(1!==this.context.length){var e=this.context.pop();e===$u.b_stat&&"function"===this.curContext().token&&(e=this.context.pop()),this.exprAllowed=!e.isExpr}else this.exprAllowed=!0},nu.braceL.updateContext=function(e){this.context.push(this.braceIsBlock(e)?$u.b_stat:$u.b_expr),this.exprAllowed=!0},nu.dollarBraceL.updateContext=function(){this.context.push($u.b_tmpl),this.exprAllowed=!0},nu.parenL.updateContext=function(e){var t=e===nu._if||e===nu._for||e===nu._with||e===nu._while;this.context.push(t?$u.p_stat:$u.p_expr),this.exprAllowed=!0},nu.incDec.updateContext=function(){},nu._function.updateContext=nu._class.updateContext=function(e){!e.beforeExpr||e===nu._else||e===nu.semi&&this.curContext()!==$u.p_stat||e===nu._return&&au.test(this.input.slice(this.lastTokEnd,this.start))||(e===nu.colon||e===nu.braceL)&&this.curContext()===$u.b_stat?this.context.push($u.f_stat):this.context.push($u.f_expr),this.exprAllowed=!1},nu.colon.updateContext=function(){"function"===this.curContext().token&&this.context.pop(),this.exprAllowed=!0},nu.backQuote.updateContext=function(){this.curContext()===$u.q_tmpl?this.context.pop():this.context.push($u.q_tmpl),this.exprAllowed=!1},nu.star.updateContext=function(e){if(e===nu._function){var t=this.context.length-1;this.context[t]===$u.f_expr?this.context[t]=$u.f_expr_gen:this.context[t]=$u.f_gen}this.exprAllowed=!0},nu.name.updateContext=function(e){var t=!1;this.options.ecmaVersion>=6&&e!==nu.dot&&("of"===this.value&&!this.exprAllowed||"yield"===this.value&&this.inGeneratorContext())&&(t=!0),this.exprAllowed=t};var qu=Tu.prototype;function Hu(e){return"Identifier"===e.type||"ParenthesizedExpression"===e.type&&Hu(e.expression)}function Xu(e){return"MemberExpression"===e.type&&"PrivateIdentifier"===e.property.type||"ChainExpression"===e.type&&Xu(e.expression)||"ParenthesizedExpression"===e.type&&Xu(e.expression)}qu.checkPropClash=function(e,t,r){if(!(this.options.ecmaVersion>=9&&"SpreadElement"===e.type||this.options.ecmaVersion>=6&&(e.computed||e.method||e.shorthand))){var i,s=e.key;switch(s.type){case"Identifier":i=s.name;break;case"Literal":i=String(s.value);break;default:return}var n=e.kind;if(this.options.ecmaVersion>=6)"__proto__"===i&&"init"===n&&(t.proto&&(r?r.doubleProto<0&&(r.doubleProto=s.start):this.raiseRecoverable(s.start,"Redefinition of __proto__ property")),t.proto=!0);else{var a=t[i="$"+i];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[i]={init:!1,get:!1,set:!1};a[n]=!0}}},qu.parseExpression=function(e,t){var r=this.start,i=this.startLoc,s=this.parseMaybeAssign(e,t);if(this.type===nu.comma){var n=this.startNodeAt(r,i);for(n.expressions=[s];this.eat(nu.comma);)n.expressions.push(this.parseMaybeAssign(e,t));return this.finishNode(n,"SequenceExpression")}return s},qu.parseMaybeAssign=function(e,t,r){if(this.isContextual("yield")){if(this.inGenerator)return this.parseYield(e);this.exprAllowed=!1}var i=!1,s=-1,n=-1,a=-1;t?(s=t.parenthesizedAssign,n=t.trailingComma,a=t.doubleProto,t.parenthesizedAssign=t.trailingComma=-1):(t=new Bu,i=!0);var o=this.start,h=this.startLoc;this.type!==nu.parenL&&this.type!==nu.name||(this.potentialArrowAt=this.start,this.potentialArrowInForAwait="await"===e);var u=this.parseMaybeConditional(e,t);if(r&&(u=r.call(this,u,o,h)),this.type.isAssign){var l=this.startNodeAt(o,h);return l.operator=this.value,this.type===nu.eq&&(u=this.toAssignable(u,!1,t)),i||(t.parenthesizedAssign=t.trailingComma=t.doubleProto=-1),t.shorthandAssign>=u.start&&(t.shorthandAssign=-1),this.type===nu.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 i&&this.checkExpressionErrors(t,!0),s>-1&&(t.parenthesizedAssign=s),n>-1&&(t.trailingComma=n),u},qu.parseMaybeConditional=function(e,t){var r=this.start,i=this.startLoc,s=this.parseExprOps(e,t);if(this.checkExpressionErrors(t))return s;if(this.eat(nu.question)){var n=this.startNodeAt(r,i);return n.test=s,n.consequent=this.parseMaybeAssign(),this.expect(nu.colon),n.alternate=this.parseMaybeAssign(e),this.finishNode(n,"ConditionalExpression")}return s},qu.parseExprOps=function(e,t){var r=this.start,i=this.startLoc,s=this.parseMaybeUnary(t,!1,!1,e);return this.checkExpressionErrors(t)||s.start===r&&"ArrowFunctionExpression"===s.type?s:this.parseExprOp(s,r,i,-1,e)},qu.parseExprOp=function(e,t,r,i,s){var n=this.type.binop;if(null!=n&&(!s||this.type!==nu._in)&&n>i){var a=this.type===nu.logicalOR||this.type===nu.logicalAND,o=this.type===nu.coalesce;o&&(n=nu.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,r,e,c,h,a||o);return(a&&this.type===nu.coalesce||o&&(this.type===nu.logicalOR||this.type===nu.logicalAND))&&this.raiseRecoverable(this.start,"Logical expressions and coalesce expressions cannot be mixed. Wrap either by parentheses"),this.parseExprOp(p,t,r,i,s)}return e},qu.buildBinary=function(e,t,r,i,s,n){"PrivateIdentifier"===i.type&&this.raise(i.start,"Private identifier can only be left side of binary expression");var a=this.startNodeAt(e,t);return a.left=r,a.operator=s,a.right=i,this.finishNode(a,n?"LogicalExpression":"BinaryExpression")},qu.parseMaybeUnary=function(e,t,r,i){var s,n=this.start,a=this.startLoc;if(this.isContextual("await")&&this.canAwait)s=this.parseAwait(i),t=!0;else if(this.type.prefix){var o=this.startNode(),h=this.type===nu.incDec;o.operator=this.value,o.prefix=!0,this.next(),o.argument=this.parseMaybeUnary(null,!0,h,i),this.checkExpressionErrors(e,!0),h?this.checkLValSimple(o.argument):this.strict&&"delete"===o.operator&&Hu(o.argument)?this.raiseRecoverable(o.start,"Deleting local variable in strict mode"):"delete"===o.operator&&Xu(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!==nu.privateId){if(s=this.parseExprSubscripts(e,i),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(i||0===this.privateNameStack.length)&&this.options.checkPrivateFields&&this.unexpected(),s=this.parsePrivateIdent(),this.type!==nu._in&&this.unexpected();return r||!this.eat(nu.starstar)?s:t?void this.unexpected(this.lastTokStart):this.buildBinary(n,a,s,this.parseMaybeUnary(null,!1,!1,i),"**",!1)},qu.parseExprSubscripts=function(e,t){var r=this.start,i=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,r,i,!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},qu.parseSubscripts=function(e,t,r,i,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,r,i,n,a,s);if(o.optional&&(a=!0),o===e||"ArrowFunctionExpression"===o.type){if(a){var h=this.startNodeAt(t,r);h.expression=o,o=this.finishNode(h,"ChainExpression")}return o}e=o}},qu.shouldParseAsyncArrow=function(){return!this.canInsertSemicolon()&&this.eat(nu.arrow)},qu.parseSubscriptAsyncArrow=function(e,t,r,i){return this.parseArrowExpression(this.startNodeAt(e,t),r,!0,i)},qu.parseSubscript=function(e,t,r,i,s,n,a){var o=this.options.ecmaVersion>=11,h=o&&this.eat(nu.questionDot);i&&h&&this.raise(this.lastTokStart,"Optional chaining cannot appear in the callee of new expressions");var u=this.eat(nu.bracketL);if(u||h&&this.type!==nu.parenL&&this.type!==nu.backQuote||this.eat(nu.dot)){var l=this.startNodeAt(t,r);l.object=e,u?(l.property=this.parseExpression(),this.expect(nu.bracketR)):this.type===nu.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(!i&&this.eat(nu.parenL)){var c=new Bu,p=this.yieldPos,d=this.awaitPos,f=this.awaitIdentPos;this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0;var g=this.parseExprList(nu.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,r,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,r);m.callee=e,m.arguments=g,o&&(m.optional=h),e=this.finishNode(m,"CallExpression")}else if(this.type===nu.backQuote){(h||n)&&this.raise(this.start,"Optional chaining cannot appear in the tag of tagged template expressions");var y=this.startNodeAt(t,r);y.tag=e,y.quasi=this.parseTemplate({isTagged:!0}),e=this.finishNode(y,"TaggedTemplateExpression")}return e},qu.parseExprAtom=function(e,t,r){this.type===nu.slash&&this.readRegexp();var i,s=this.potentialArrowAt===this.start;switch(this.type){case nu._super:return this.allowSuper||this.raise(this.start,"'super' keyword outside a method"),i=this.startNode(),this.next(),this.type!==nu.parenL||this.allowDirectSuper||this.raise(i.start,"super() call outside constructor of a subclass"),this.type!==nu.dot&&this.type!==nu.bracketL&&this.type!==nu.parenL&&this.unexpected(),this.finishNode(i,"Super");case nu._this:return i=this.startNode(),this.next(),this.finishNode(i,"ThisExpression");case nu.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(nu._function))return this.overrideContext($u.f_expr),this.parseFunction(this.startNodeAt(n,a),0,!1,!0,t);if(s&&!this.canInsertSemicolon()){if(this.eat(nu.arrow))return this.parseArrowExpression(this.startNodeAt(n,a),[h],!1,t);if(this.options.ecmaVersion>=8&&"async"===h.name&&this.type===nu.name&&!o&&(!this.potentialArrowInForAwait||"of"!==this.value||this.containsEsc))return h=this.parseIdent(!1),!this.canInsertSemicolon()&&this.eat(nu.arrow)||this.unexpected(),this.parseArrowExpression(this.startNodeAt(n,a),[h],!0,t)}return h;case nu.regexp:var u=this.value;return(i=this.parseLiteral(u.value)).regex={pattern:u.pattern,flags:u.flags},i;case nu.num:case nu.string:return this.parseLiteral(this.value);case nu._null:case nu._true:case nu._false:return(i=this.startNode()).value=this.type===nu._null?null:this.type===nu._true,i.raw=this.type.keyword,this.next(),this.finishNode(i,"Literal");case nu.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 nu.bracketL:return i=this.startNode(),this.next(),i.elements=this.parseExprList(nu.bracketR,!0,!0,e),this.finishNode(i,"ArrayExpression");case nu.braceL:return this.overrideContext($u.b_expr),this.parseObj(!1,e);case nu._function:return i=this.startNode(),this.next(),this.parseFunction(i,0);case nu._class:return this.parseClass(this.startNode(),!1);case nu._new:return this.parseNew();case nu.backQuote:return this.parseTemplate();case nu._import:return this.options.ecmaVersion>=11?this.parseExprImport(r):this.unexpected();default:return this.parseExprAtomDefault()}},qu.parseExprAtomDefault=function(){this.unexpected()},qu.parseExprImport=function(e){var t=this.startNode();if(this.containsEsc&&this.raiseRecoverable(this.start,"Escape sequence in keyword import"),this.next(),this.type===nu.parenL&&!e)return this.parseDynamicImport(t);if(this.type===nu.dot){var r=this.startNodeAt(t.start,t.loc&&t.loc.start);return r.name="import",t.meta=this.finishNode(r,"Identifier"),this.parseImportMeta(t)}this.unexpected()},qu.parseDynamicImport=function(e){if(this.next(),e.source=this.parseMaybeAssign(),this.options.ecmaVersion>=16)this.eat(nu.parenR)?e.options=null:(this.expect(nu.comma),this.afterTrailingComma(nu.parenR)?e.options=null:(e.options=this.parseMaybeAssign(),this.eat(nu.parenR)||(this.expect(nu.comma),this.afterTrailingComma(nu.parenR)||this.unexpected())));else if(!this.eat(nu.parenR)){var t=this.start;this.eat(nu.comma)&&this.eat(nu.parenR)?this.raiseRecoverable(t,"Trailing comma is not allowed in import()"):this.unexpected(t)}return this.finishNode(e,"ImportExpression")},qu.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")},qu.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")},qu.parseParenExpression=function(){this.expect(nu.parenL);var e=this.parseExpression();return this.expect(nu.parenR),e},qu.shouldParseArrow=function(e){return!this.canInsertSemicolon()},qu.parseParenAndDistinguishExpression=function(e,t){var r,i=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 Bu,d=this.yieldPos,f=this.awaitPos;for(this.yieldPos=0,this.awaitPos=0;this.type!==nu.parenR;){if(l?l=!1:this.expect(nu.comma),n&&this.afterTrailingComma(nu.parenR,!0)){c=!0;break}if(this.type===nu.ellipsis){a=this.start,u.push(this.parseParenItem(this.parseRestBinding())),this.type===nu.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(nu.parenR),e&&this.shouldParseArrow(u)&&this.eat(nu.arrow))return this.checkPatternErrors(p,!1),this.checkYieldAwaitInDefaultParams(),this.yieldPos=d,this.awaitPos=f,this.parseParenArrowList(i,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?((r=this.startNodeAt(o,h)).expressions=u,this.finishNodeAt(r,"SequenceExpression",g,m)):r=u[0]}else r=this.parseParenExpression();if(this.options.preserveParens){var y=this.startNodeAt(i,s);return y.expression=r,this.finishNode(y,"ParenthesizedExpression")}return r},qu.parseParenItem=function(e){return e},qu.parseParenArrowList=function(e,t,r,i){return this.parseArrowExpression(this.startNodeAt(e,t),r,!1,i)};var Yu=[];qu.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===nu.dot){var t=this.startNodeAt(e.start,e.loc&&e.loc.start);t.name="new",e.meta=this.finishNode(t,"Identifier"),this.next();var r=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'"),r&&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 i=this.start,s=this.startLoc;return e.callee=this.parseSubscripts(this.parseExprAtom(null,!1,!0),i,s,!0,!1),this.eat(nu.parenL)?e.arguments=this.parseExprList(nu.parenR,this.options.ecmaVersion>=8,!1):e.arguments=Yu,this.finishNode(e,"NewExpression")},qu.parseTemplateElement=function(e){var t=e.isTagged,r=this.startNode();return this.type===nu.invalidTemplate?(t||this.raiseRecoverable(this.start,"Bad escape sequence in untagged template literal"),r.value={raw:this.value.replace(/\r\n?/g,"\n"),cooked:null}):r.value={raw:this.input.slice(this.start,this.end).replace(/\r\n?/g,"\n"),cooked:this.value},this.next(),r.tail=this.type===nu.backQuote,this.finishNode(r,"TemplateElement")},qu.parseTemplate=function(e){void 0===e&&(e={});var t=e.isTagged;void 0===t&&(t=!1);var r=this.startNode();this.next(),r.expressions=[];var i=this.parseTemplateElement({isTagged:t});for(r.quasis=[i];!i.tail;)this.type===nu.eof&&this.raise(this.pos,"Unterminated template literal"),this.expect(nu.dollarBraceL),r.expressions.push(this.parseExpression()),this.expect(nu.braceR),r.quasis.push(i=this.parseTemplateElement({isTagged:t}));return this.next(),this.finishNode(r,"TemplateLiteral")},qu.isAsyncProp=function(e){return!e.computed&&"Identifier"===e.key.type&&"async"===e.key.name&&(this.type===nu.name||this.type===nu.num||this.type===nu.string||this.type===nu.bracketL||this.type.keyword||this.options.ecmaVersion>=9&&this.type===nu.star)&&!au.test(this.input.slice(this.lastTokEnd,this.start))},qu.parseObj=function(e,t){var r=this.startNode(),i=!0,s={};for(r.properties=[],this.next();!this.eat(nu.braceR);){if(i)i=!1;else if(this.expect(nu.comma),this.options.ecmaVersion>=5&&this.afterTrailingComma(nu.braceR))break;var n=this.parseProperty(e,t);e||this.checkPropClash(n,s,t),r.properties.push(n)}return this.finishNode(r,e?"ObjectPattern":"ObjectExpression")},qu.parseProperty=function(e,t){var r,i,s,n,a=this.startNode();if(this.options.ecmaVersion>=9&&this.eat(nu.ellipsis))return e?(a.argument=this.parseIdent(!1),this.type===nu.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===nu.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||(r=this.eat(nu.star)));var o=this.containsEsc;return this.parsePropertyName(a),!e&&!o&&this.options.ecmaVersion>=8&&!r&&this.isAsyncProp(a)?(i=!0,r=this.options.ecmaVersion>=9&&this.eat(nu.star),this.parsePropertyName(a)):i=!1,this.parsePropertyValue(a,e,r,i,s,n,t,o),this.finishNode(a,"Property")},qu.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 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")},qu.parsePropertyValue=function(e,t,r,i,s,n,a,o){(r||i)&&this.type===nu.colon&&this.unexpected(),this.eat(nu.colon)?(e.value=t?this.parseMaybeDefault(this.start,this.startLoc):this.parseMaybeAssign(!1,a),e.kind="init"):this.options.ecmaVersion>=6&&this.type===nu.parenL?(t&&this.unexpected(),e.kind="init",e.method=!0,e.value=this.parseMethod(r,i)):t||o||!(this.options.ecmaVersion>=5)||e.computed||"Identifier"!==e.key.type||"get"!==e.key.name&&"set"!==e.key.name||this.type===nu.comma||this.type===nu.braceR||this.type===nu.eq?this.options.ecmaVersion>=6&&!e.computed&&"Identifier"===e.key.type?((r||i)&&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===nu.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():((r||i)&&this.unexpected(),this.parseGetterSetter(e))},qu.parsePropertyName=function(e){if(this.options.ecmaVersion>=6){if(this.eat(nu.bracketL))return e.computed=!0,e.key=this.parseMaybeAssign(),this.expect(nu.bracketR),e.key;e.computed=!1}return e.key=this.type===nu.num||this.type===nu.string?this.parseExprAtom():this.parseIdent("never"!==this.options.allowReserved)},qu.initFunction=function(e){e.id=null,this.options.ecmaVersion>=6&&(e.generator=e.expression=!1),this.options.ecmaVersion>=8&&(e.async=!1)},qu.parseMethod=function(e,t,r){var i=this.startNode(),s=this.yieldPos,n=this.awaitPos,a=this.awaitIdentPos;return this.initFunction(i),this.options.ecmaVersion>=6&&(i.generator=e),this.options.ecmaVersion>=8&&(i.async=!!t),this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,this.enterScope(64|Fu(t,i.generator)|(r?128:0)),this.expect(nu.parenL),i.params=this.parseBindingList(nu.parenR,!1,this.options.ecmaVersion>=8),this.checkYieldAwaitInDefaultParams(),this.parseFunctionBody(i,!1,!0,!1),this.yieldPos=s,this.awaitPos=n,this.awaitIdentPos=a,this.finishNode(i,"FunctionExpression")},qu.parseArrowExpression=function(e,t,r,i){var s=this.yieldPos,n=this.awaitPos,a=this.awaitIdentPos;return this.enterScope(16|Fu(r,!1)),this.initFunction(e),this.options.ecmaVersion>=8&&(e.async=!!r),this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,e.params=this.toAssignableList(t,!0),this.parseFunctionBody(e,!0,!1,i),this.yieldPos=s,this.awaitPos=n,this.awaitIdentPos=a,this.finishNode(e,"ArrowFunctionExpression")},qu.parseFunctionBody=function(e,t,r,i){var s=t&&this.type!==nu.braceL,n=this.strict,a=!1;if(s)e.body=this.parseMaybeAssign(i),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&&!r&&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()},qu.isSimpleParamList=function(e){for(var t=0,r=e;t<r.length;t+=1){if("Identifier"!==r[t].type)return!1}return!0},qu.checkParams=function(e,t){for(var r=Object.create(null),i=0,s=e.params;i<s.length;i+=1){var n=s[i];this.checkLValInnerPattern(n,1,t?null:r)}},qu.parseExprList=function(e,t,r,i){for(var s=[],n=!0;!this.eat(e);){if(n)n=!1;else if(this.expect(nu.comma),t&&this.afterTrailingComma(e))break;var a=void 0;r&&this.type===nu.comma?a=null:this.type===nu.ellipsis?(a=this.parseSpread(i),i&&this.type===nu.comma&&i.trailingComma<0&&(i.trailingComma=this.start)):a=this.parseMaybeAssign(!1,i),s.push(a)}return s},qu.checkUnreserved=function(e){var t=e.start,r=e.end,i=e.name;(this.inGenerator&&"yield"===i&&this.raiseRecoverable(t,"Cannot use 'yield' as identifier inside a generator"),this.inAsync&&"await"===i&&this.raiseRecoverable(t,"Cannot use 'await' as identifier inside an async function"),this.currentThisScope().inClassFieldInit&&"arguments"===i&&this.raiseRecoverable(t,"Cannot use 'arguments' in class field initializer"),!this.inClassStaticBlock||"arguments"!==i&&"await"!==i||this.raise(t,"Cannot use "+i+" in class static initialization block"),this.keywords.test(i)&&this.raise(t,"Unexpected keyword '"+i+"'"),this.options.ecmaVersion<6&&-1!==this.input.slice(t,r).indexOf("\\"))||(this.strict?this.reservedWordsStrict:this.reservedWords).test(i)&&(this.inAsync||"await"!==i||this.raiseRecoverable(t,"Cannot use keyword 'await' outside an async function"),this.raiseRecoverable(t,"The keyword '"+i+"' is reserved"))},qu.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},qu.parseIdentNode=function(){var e=this.startNode();return this.type===nu.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=nu.name):this.unexpected(),e},qu.parsePrivateIdent=function(){var e=this.startNode();return this.type===nu.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},qu.parseYield=function(e){this.yieldPos||(this.yieldPos=this.start);var t=this.startNode();return this.next(),this.type===nu.semi||this.canInsertSemicolon()||this.type!==nu.star&&!this.type.startsExpr?(t.delegate=!1,t.argument=null):(t.delegate=this.eat(nu.star),t.argument=this.parseMaybeAssign(e)),this.finishNode(t,"YieldExpression")},qu.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 Zu=Tu.prototype;Zu.raise=function(e,t){var r=Cu(this.input,e);t+=" ("+r.line+":"+r.column+")";var i=new SyntaxError(t);throw i.pos=e,i.loc=r,i.raisedAt=this.pos,i},Zu.raiseRecoverable=Zu.raise,Zu.curPosition=function(){if(this.options.locations)return new _u(this.curLine,this.pos-this.lineStart)};var Ku=Tu.prototype,Ju=function(e){this.flags=e,this.var=[],this.lexical=[],this.functions=[],this.inClassFieldInit=!1};Ku.enterScope=function(e){this.scopeStack.push(new Ju(e))},Ku.exitScope=function(){this.scopeStack.pop()},Ku.treatFunctionsAsVarInScope=function(e){return 2&e.flags||!this.inModule&&1&e.flags},Ku.declareName=function(e,t,r){var i=!1;if(2===t){var s=this.currentScope();i=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();i=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){i=!0;break}if(o.var.push(e),this.inModule&&1&o.flags&&delete this.undefinedExports[e],259&o.flags)break}i&&this.raiseRecoverable(r,"Identifier '"+e+"' has already been declared")},Ku.checkLocalExport=function(e){-1===this.scopeStack[0].lexical.indexOf(e.name)&&-1===this.scopeStack[0].var.indexOf(e.name)&&(this.undefinedExports[e.name]=e)},Ku.currentScope=function(){return this.scopeStack[this.scopeStack.length-1]},Ku.currentVarScope=function(){for(var e=this.scopeStack.length-1;;e--){var t=this.scopeStack[e];if(259&t.flags)return t}},Ku.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 Qu=function(e,t,r){this.type="",this.start=t,this.end=0,e.options.locations&&(this.loc=new wu(e,r)),e.options.directSourceFile&&(this.sourceFile=e.options.directSourceFile),e.options.ranges&&(this.range=[t,0])},el=Tu.prototype;function tl(e,t,r,i){return e.type=t,e.end=r,this.options.locations&&(e.loc.end=i),this.options.ranges&&(e.range[1]=r),e}el.startNode=function(){return new Qu(this,this.start,this.startLoc)},el.startNodeAt=function(e,t){return new Qu(this,e,t)},el.finishNode=function(e,t){return tl.call(this,e,t,this.lastTokEnd,this.lastTokEndLoc)},el.finishNodeAt=function(e,t,r,i){return tl.call(this,e,t,r,i)},el.copyNode=function(e){var t=new Qu(this,e.start,this.startLoc);for(var r in e)t[r]=e[r];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",il=rl+" Extended_Pictographic",sl=il+" EBase EComp EMod EPres ExtPict",nl={9:rl,10:il,11:il,12:sl,13:sl,14:sl},al={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"},ol="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",hl="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",ul=hl+" Dogra Dogr Gunjala_Gondi Gong Hanifi_Rohingya Rohg Makasar Maka Medefaidrin Medf Old_Sogdian Sogo Sogdian Sogd",ll=ul+" Elymaic Elym Nandinagari Nand Nyiakeng_Puachue_Hmong Hmnp Wancho Wcho",cl=ll+" Chorasmian Chrs Diak Dives_Akuru Khitan_Small_Script Kits Yezi Yezidi",pl=cl+" Cypro_Minoan Cpmn Old_Uyghur Ougr Tangsa Tnsa Toto Vithkuqi Vith",dl={9:hl,10:ul,11:ll,12:cl,13:pl,14:pl+" 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"},fl={};function gl(e){var t=fl[e]={binary:xu(nl[e]+" "+ol),binaryOfStrings:xu(al[e]),nonBinary:{General_Category:xu(ol),Script:xu(dl[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 ml=0,yl=[9,10,11,12,13,14];ml<yl.length;ml+=1){gl(yl[ml])}var xl=Tu.prototype,vl=function(e,t){this.parent=e,this.base=t||this};vl.prototype.separatedFrom=function(e){for(var t=this;t;t=t.parent)for(var r=e;r;r=r.parent)if(t.base===r.base&&t!==r)return!0;return!1},vl.prototype.sibling=function(){return new vl(this.parent,this.base)};var bl=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=fl[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 _l(e){return 105===e||109===e||115===e}function wl(e){return 36===e||e>=40&&e<=43||46===e||63===e||e>=91&&e<=94||e>=123&&e<=125}function Cl(e){return e>=65&&e<=90||e>=97&&e<=122}bl.prototype.reset=function(e,t,r){var i=-1!==r.indexOf("v"),s=-1!==r.indexOf("u");this.start=0|e,this.source=t+"",this.flags=r,i&&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)},bl.prototype.raise=function(e){this.parser.raiseRecoverable(this.start,"Invalid regular expression: /"+this.source+"/: "+e)},bl.prototype.at=function(e,t){void 0===t&&(t=!1);var r=this.source,i=r.length;if(e>=i)return-1;var s=r.charCodeAt(e);if(!t&&!this.switchU||s<=55295||s>=57344||e+1>=i)return s;var n=r.charCodeAt(e+1);return n>=56320&&n<=57343?(s<<10)+n-56613888:s},bl.prototype.nextIndex=function(e,t){void 0===t&&(t=!1);var r=this.source,i=r.length;if(e>=i)return i;var s,n=r.charCodeAt(e);return!t&&!this.switchU||n<=55295||n>=57344||e+1>=i||(s=r.charCodeAt(e+1))<56320||s>57343?e+1:e+2},bl.prototype.current=function(e){return void 0===e&&(e=!1),this.at(this.pos,e)},bl.prototype.lookahead=function(e){return void 0===e&&(e=!1),this.at(this.nextIndex(this.pos,e),e)},bl.prototype.advance=function(e){void 0===e&&(e=!1),this.pos=this.nextIndex(this.pos,e)},bl.prototype.eat=function(e,t){return void 0===t&&(t=!1),this.current(t)===e&&(this.advance(t),!0)},bl.prototype.eatChars=function(e,t){void 0===t&&(t=!1);for(var r=this.pos,i=0,s=e;i<s.length;i+=1){var n=s[i],a=this.at(r,t);if(-1===a||a!==n)return!1;r=this.nextIndex(r,t)}return this.pos=r,!0},xl.validateRegExpFlags=function(e){for(var t=e.validFlags,r=e.flags,i=!1,s=!1,n=0;n<r.length;n++){var a=r.charAt(n);-1===t.indexOf(a)&&this.raise(e.start,"Invalid regular expression flag"),r.indexOf(a,n+1)>-1&&this.raise(e.start,"Duplicate regular expression flag"),"u"===a&&(i=!0),"v"===a&&(s=!0)}this.options.ecmaVersion>=15&&i&&s&&this.raise(e.start,"Invalid regular expression flag")},xl.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))},xl.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,r=e.backReferenceNames;t<r.length;t+=1){var i=r[t];e.groupNames[i]||e.raise("Invalid named capture referenced")}},xl.regexp_disjunction=function(e){var t=this.options.ecmaVersion>=16;for(t&&(e.branchID=new vl(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")},xl.regexp_alternative=function(e){for(;e.pos<e.source.length&&this.regexp_eatTerm(e););},xl.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)},xl.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 r=!1;if(this.options.ecmaVersion>=9&&(r=e.eat(60)),e.eat(61)||e.eat(33))return this.regexp_disjunction(e),e.eat(41)||e.raise("Unterminated group"),e.lastAssertionIsQuantifiable=!r,!0}return e.pos=t,!1},xl.regexp_eatQuantifier=function(e,t){return void 0===t&&(t=!1),!!this.regexp_eatQuantifierPrefix(e,t)&&(e.eat(63),!0)},xl.regexp_eatQuantifierPrefix=function(e,t){return e.eat(42)||e.eat(43)||e.eat(63)||this.regexp_eatBracedQuantifier(e,t)},xl.regexp_eatBracedQuantifier=function(e,t){var r=e.pos;if(e.eat(123)){var i=0,s=-1;if(this.regexp_eatDecimalDigits(e)&&(i=e.lastIntValue,e.eat(44)&&this.regexp_eatDecimalDigits(e)&&(s=e.lastIntValue),e.eat(125)))return-1!==s&&s<i&&!t&&e.raise("numbers out of order in {} quantifier"),!0;e.switchU&&!t&&e.raise("Incomplete quantifier"),e.pos=r}return!1},xl.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)},xl.regexp_eatReverseSolidusAtomEscape=function(e){var t=e.pos;if(e.eat(92)){if(this.regexp_eatAtomEscape(e))return!0;e.pos=t}return!1},xl.regexp_eatUncapturingGroup=function(e){var t=e.pos;if(e.eat(40)){if(e.eat(63)){if(this.options.ecmaVersion>=16){var r=this.regexp_eatModifiers(e),i=e.eat(45);if(r||i){for(var s=0;s<r.length;s++){var n=r.charAt(s);r.indexOf(n,s+1)>-1&&e.raise("Duplicate regular expression modifiers")}if(i){var a=this.regexp_eatModifiers(e);r||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||r.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},xl.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},xl.regexp_eatModifiers=function(e){for(var t="",r=0;-1!==(r=e.current())&&_l(r);)t+=vu(r),e.advance();return t},xl.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)},xl.regexp_eatInvalidBracedQuantifier=function(e){return this.regexp_eatBracedQuantifier(e,!0)&&e.raise("Nothing to repeat"),!1},xl.regexp_eatSyntaxCharacter=function(e){var t=e.current();return!!wl(t)&&(e.lastIntValue=t,e.advance(),!0)},xl.regexp_eatPatternCharacters=function(e){for(var t=e.pos,r=0;-1!==(r=e.current())&&!wl(r);)e.advance();return e.pos!==t},xl.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)},xl.regexp_groupSpecifier=function(e){if(e.eat(63)){this.regexp_eatGroupName(e)||e.raise("Invalid group");var t=this.options.ecmaVersion>=16,r=e.groupNames[e.lastStringValue];if(r)if(t)for(var i=0,s=r;i<s.length;i+=1){s[i].separatedFrom(e.branchID)||e.raise("Duplicate capture group name")}else e.raise("Duplicate capture group name");t?(r||(e.groupNames[e.lastStringValue]=[])).push(e.branchID):e.groupNames[e.lastStringValue]=!0}},xl.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},xl.regexp_eatRegExpIdentifierName=function(e){if(e.lastStringValue="",this.regexp_eatRegExpIdentifierStart(e)){for(e.lastStringValue+=vu(e.lastIntValue);this.regexp_eatRegExpIdentifierPart(e);)e.lastStringValue+=vu(e.lastIntValue);return!0}return!1},xl.regexp_eatRegExpIdentifierStart=function(e){var t=e.pos,r=this.options.ecmaVersion>=11,i=e.current(r);return e.advance(r),92===i&&this.regexp_eatRegExpUnicodeEscapeSequence(e,r)&&(i=e.lastIntValue),function(e){return Kh(e,!0)||36===e||95===e}(i)?(e.lastIntValue=i,!0):(e.pos=t,!1)},xl.regexp_eatRegExpIdentifierPart=function(e){var t=e.pos,r=this.options.ecmaVersion>=11,i=e.current(r);return e.advance(r),92===i&&this.regexp_eatRegExpUnicodeEscapeSequence(e,r)&&(i=e.lastIntValue),function(e){return Jh(e,!0)||36===e||95===e||8204===e||8205===e}(i)?(e.lastIntValue=i,!0):(e.pos=t,!1)},xl.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)},xl.regexp_eatBackReference=function(e){var t=e.pos;if(this.regexp_eatDecimalEscape(e)){var r=e.lastIntValue;if(e.switchU)return r>e.maxBackReference&&(e.maxBackReference=r),!0;if(r<=e.numCapturingParens)return!0;e.pos=t}return!1},xl.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},xl.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)},xl.regexp_eatCControlLetter=function(e){var t=e.pos;if(e.eat(99)){if(this.regexp_eatControlLetter(e))return!0;e.pos=t}return!1},xl.regexp_eatZero=function(e){return 48===e.current()&&!Al(e.lookahead())&&(e.lastIntValue=0,e.advance(),!0)},xl.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)},xl.regexp_eatControlLetter=function(e){var t=e.current();return!!Cl(t)&&(e.lastIntValue=t%32,e.advance(),!0)},xl.regexp_eatRegExpUnicodeEscapeSequence=function(e,t){void 0===t&&(t=!1);var r,i=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)&&((r=e.lastIntValue)>=0&&r<=1114111))return!0;s&&e.raise("Invalid unicode escape"),e.pos=i}return!1},xl.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)},xl.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 Dl(e){return Cl(e)||95===e}function El(e){return Dl(e)||Al(e)}function Al(e){return e>=48&&e<=57}function Sl(e){return e>=48&&e<=57||e>=65&&e<=70||e>=97&&e<=102}function Fl(e){return e>=65&&e<=70?e-65+10:e>=97&&e<=102?e-97+10:e-48}function Tl(e){return e>=48&&e<=55}xl.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 r=!1;if(e.switchU&&this.options.ecmaVersion>=9&&((r=80===t)||112===t)){var i;if(e.lastIntValue=-1,e.advance(),e.eat(123)&&(i=this.regexp_eatUnicodePropertyValueExpression(e))&&e.eat(125))return r&&2===i&&e.raise("Invalid property name"),i;e.raise("Invalid property name")}return 0},xl.regexp_eatUnicodePropertyValueExpression=function(e){var t=e.pos;if(this.regexp_eatUnicodePropertyName(e)&&e.eat(61)){var r=e.lastStringValue;if(this.regexp_eatUnicodePropertyValue(e)){var i=e.lastStringValue;return this.regexp_validateUnicodePropertyNameAndValue(e,r,i),1}}if(e.pos=t,this.regexp_eatLoneUnicodePropertyNameOrValue(e)){var s=e.lastStringValue;return this.regexp_validateUnicodePropertyNameOrValue(e,s)}return 0},xl.regexp_validateUnicodePropertyNameAndValue=function(e,t,r){gu(e.unicodeProperties.nonBinary,t)||e.raise("Invalid property name"),e.unicodeProperties.nonBinary[t].test(r)||e.raise("Invalid property value")},xl.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")},xl.regexp_eatUnicodePropertyName=function(e){var t=0;for(e.lastStringValue="";Dl(t=e.current());)e.lastStringValue+=vu(t),e.advance();return""!==e.lastStringValue},xl.regexp_eatUnicodePropertyValue=function(e){var t=0;for(e.lastStringValue="";El(t=e.current());)e.lastStringValue+=vu(t),e.advance();return""!==e.lastStringValue},xl.regexp_eatLoneUnicodePropertyNameOrValue=function(e){return this.regexp_eatUnicodePropertyValue(e)},xl.regexp_eatCharacterClass=function(e){if(e.eat(91)){var t=e.eat(94),r=this.regexp_classContents(e);return e.eat(93)||e.raise("Unterminated character class"),t&&2===r&&e.raise("Negated character class may contain strings"),!0}return!1},xl.regexp_classContents=function(e){return 93===e.current()?1:e.switchV?this.regexp_classSetExpression(e):(this.regexp_nonEmptyClassRanges(e),1)},xl.regexp_nonEmptyClassRanges=function(e){for(;this.regexp_eatClassAtom(e);){var t=e.lastIntValue;if(e.eat(45)&&this.regexp_eatClassAtom(e)){var r=e.lastIntValue;!e.switchU||-1!==t&&-1!==r||e.raise("Invalid character class"),-1!==t&&-1!==r&&t>r&&e.raise("Range out of order in character class")}}},xl.regexp_eatClassAtom=function(e){var t=e.pos;if(e.eat(92)){if(this.regexp_eatClassEscape(e))return!0;if(e.switchU){var r=e.current();(99===r||Tl(r))&&e.raise("Invalid class escape"),e.raise("Invalid escape")}e.pos=t}var i=e.current();return 93!==i&&(e.lastIntValue=i,e.advance(),!0)},xl.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)},xl.regexp_classSetExpression=function(e){var t,r=1;if(this.regexp_eatClassSetRange(e));else if(t=this.regexp_eatClassSetOperand(e)){2===t&&(r=2);for(var i=e.pos;e.eatChars([38,38]);)38!==e.current()&&(t=this.regexp_eatClassSetOperand(e))?2!==t&&(r=1):e.raise("Invalid character in character class");if(i!==e.pos)return r;for(;e.eatChars([45,45]);)this.regexp_eatClassSetOperand(e)||e.raise("Invalid character in character class");if(i!==e.pos)return r}else e.raise("Invalid character in character class");for(;;)if(!this.regexp_eatClassSetRange(e)){if(!(t=this.regexp_eatClassSetOperand(e)))return r;2===t&&(r=2)}},xl.regexp_eatClassSetRange=function(e){var t=e.pos;if(this.regexp_eatClassSetCharacter(e)){var r=e.lastIntValue;if(e.eat(45)&&this.regexp_eatClassSetCharacter(e)){var i=e.lastIntValue;return-1!==r&&-1!==i&&r>i&&e.raise("Range out of order in character class"),!0}e.pos=t}return!1},xl.regexp_eatClassSetOperand=function(e){return this.regexp_eatClassSetCharacter(e)?1:this.regexp_eatClassStringDisjunction(e)||this.regexp_eatNestedClass(e)},xl.regexp_eatNestedClass=function(e){var t=e.pos;if(e.eat(91)){var r=e.eat(94),i=this.regexp_classContents(e);if(e.eat(93))return r&&2===i&&e.raise("Negated character class may contain strings"),i;e.pos=t}if(e.eat(92)){var s=this.regexp_eatCharacterClassEscape(e);if(s)return s;e.pos=t}return null},xl.regexp_eatClassStringDisjunction=function(e){var t=e.pos;if(e.eatChars([92,113])){if(e.eat(123)){var r=this.regexp_classStringDisjunctionContents(e);if(e.eat(125))return r}else e.raise("Invalid escape");e.pos=t}return null},xl.regexp_classStringDisjunctionContents=function(e){for(var t=this.regexp_classString(e);e.eat(124);)2===this.regexp_classString(e)&&(t=2);return t},xl.regexp_classString=function(e){for(var t=0;this.regexp_eatClassSetCharacter(e);)t++;return 1===t?1:2},xl.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 r=e.current();return!(r<0||r===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}(r))&&(!function(e){return 40===e||41===e||45===e||47===e||e>=91&&e<=93||e>=123&&e<=125}(r)&&(e.advance(),e.lastIntValue=r,!0))},xl.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)},xl.regexp_eatClassControlLetter=function(e){var t=e.current();return!(!Al(t)&&95!==t)&&(e.lastIntValue=t%32,e.advance(),!0)},xl.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},xl.regexp_eatDecimalDigits=function(e){var t=e.pos,r=0;for(e.lastIntValue=0;Al(r=e.current());)e.lastIntValue=10*e.lastIntValue+(r-48),e.advance();return e.pos!==t},xl.regexp_eatHexDigits=function(e){var t=e.pos,r=0;for(e.lastIntValue=0;Sl(r=e.current());)e.lastIntValue=16*e.lastIntValue+Fl(r),e.advance();return e.pos!==t},xl.regexp_eatLegacyOctalEscapeSequence=function(e){if(this.regexp_eatOctalDigit(e)){var t=e.lastIntValue;if(this.regexp_eatOctalDigit(e)){var r=e.lastIntValue;t<=3&&this.regexp_eatOctalDigit(e)?e.lastIntValue=64*t+8*r+e.lastIntValue:e.lastIntValue=8*t+r}else e.lastIntValue=t;return!0}return!1},xl.regexp_eatOctalDigit=function(e){var t=e.current();return Tl(t)?(e.lastIntValue=t-48,e.advance(),!0):(e.lastIntValue=0,!1)},xl.regexp_eatFixedHexDigits=function(e,t){var r=e.pos;e.lastIntValue=0;for(var i=0;i<t;++i){var s=e.current();if(!Sl(s))return e.pos=r,!1;e.lastIntValue=16*e.lastIntValue+Fl(s),e.advance()}return!0};var Ml=function(e){this.type=e.type,this.value=e.value,this.start=e.start,this.end=e.end,e.options.locations&&(this.loc=new wu(e,e.startLoc,e.endLoc)),e.options.ranges&&(this.range=[e.start,e.end])},kl=Tu.prototype;function Il(e){return"function"!=typeof BigInt?null:BigInt(e.replace(/_/g,""))}kl.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 Ml(this)),this.lastTokEnd=this.end,this.lastTokStart=this.start,this.lastTokEndLoc=this.endLoc,this.lastTokStartLoc=this.startLoc,this.nextToken()},kl.getToken=function(){return this.next(),new Ml(this)},"undefined"!=typeof Symbol&&(kl[Symbol.iterator]=function(){var e=this;return{next:function(){var t=e.getToken();return{done:t.type===nu.eof,value:t}}}}),kl.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(nu.eof):e.override?e.override(this):void this.readToken(this.fullCharCodeAtPos())},kl.readToken=function(e){return Kh(e,this.options.ecmaVersion>=6)||92===e?this.readWord():this.getTokenFromCode(e)},kl.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},kl.skipBlockComment=function(){var e=this.options.onComment&&this.curPosition(),t=this.pos,r=this.input.indexOf("*/",this.pos+=2);if(-1===r&&this.raise(this.pos-2,"Unterminated comment"),this.pos=r+2,this.options.locations)for(var i=void 0,s=t;(i=uu(this.input,s,this.pos))>-1;)++this.curLine,s=this.lineStart=i;this.options.onComment&&this.options.onComment(!0,this.input.slice(t+2,r),t,this.pos,e,this.curPosition())},kl.skipLineComment=function(e){for(var t=this.pos,r=this.options.onComment&&this.curPosition(),i=this.input.charCodeAt(this.pos+=e);this.pos<this.input.length&&!hu(i);)i=this.input.charCodeAt(++this.pos);this.options.onComment&&this.options.onComment(!1,this.input.slice(t+e,this.pos),t,this.pos,r,this.curPosition())},kl.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&&lu.test(String.fromCharCode(e))))break e;++this.pos}}},kl.finishToken=function(e,t){this.end=this.pos,this.options.locations&&(this.endLoc=this.curPosition());var r=this.type;this.type=e,this.value=t,this.updateContext(r)},kl.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(nu.ellipsis)):(++this.pos,this.finishToken(nu.dot))},kl.readToken_slash=function(){var e=this.input.charCodeAt(this.pos+1);return this.exprAllowed?(++this.pos,this.readRegexp()):61===e?this.finishOp(nu.assign,2):this.finishOp(nu.slash,1)},kl.readToken_mult_modulo_exp=function(e){var t=this.input.charCodeAt(this.pos+1),r=1,i=42===e?nu.star:nu.modulo;return this.options.ecmaVersion>=7&&42===e&&42===t&&(++r,i=nu.starstar,t=this.input.charCodeAt(this.pos+2)),61===t?this.finishOp(nu.assign,r+1):this.finishOp(i,r)},kl.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(nu.assign,3);return this.finishOp(124===e?nu.logicalOR:nu.logicalAND,2)}return 61===t?this.finishOp(nu.assign,2):this.finishOp(124===e?nu.bitwiseOR:nu.bitwiseAND,1)},kl.readToken_caret=function(){return 61===this.input.charCodeAt(this.pos+1)?this.finishOp(nu.assign,2):this.finishOp(nu.bitwiseXOR,1)},kl.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&&!au.test(this.input.slice(this.lastTokEnd,this.pos))?this.finishOp(nu.incDec,2):(this.skipLineComment(3),this.skipSpace(),this.nextToken()):61===t?this.finishOp(nu.assign,2):this.finishOp(nu.plusMin,1)},kl.readToken_lt_gt=function(e){var t=this.input.charCodeAt(this.pos+1),r=1;return t===e?(r=62===e&&62===this.input.charCodeAt(this.pos+2)?3:2,61===this.input.charCodeAt(this.pos+r)?this.finishOp(nu.assign,r+1):this.finishOp(nu.bitShift,r)):33!==t||60!==e||this.inModule||45!==this.input.charCodeAt(this.pos+2)||45!==this.input.charCodeAt(this.pos+3)?(61===t&&(r=2),this.finishOp(nu.relational,r)):(this.skipLineComment(4),this.skipSpace(),this.nextToken())},kl.readToken_eq_excl=function(e){var t=this.input.charCodeAt(this.pos+1);return 61===t?this.finishOp(nu.equality,61===this.input.charCodeAt(this.pos+2)?3:2):61===e&&62===t&&this.options.ecmaVersion>=6?(this.pos+=2,this.finishToken(nu.arrow)):this.finishOp(61===e?nu.eq:nu.prefix,1)},kl.readToken_question=function(){var e=this.options.ecmaVersion;if(e>=11){var t=this.input.charCodeAt(this.pos+1);if(46===t){var r=this.input.charCodeAt(this.pos+2);if(r<48||r>57)return this.finishOp(nu.questionDot,2)}if(63===t){if(e>=12)if(61===this.input.charCodeAt(this.pos+2))return this.finishOp(nu.assign,3);return this.finishOp(nu.coalesce,2)}}return this.finishOp(nu.question,1)},kl.readToken_numberSign=function(){var e=35;if(this.options.ecmaVersion>=13&&(++this.pos,Kh(e=this.fullCharCodeAtPos(),!0)||92===e))return this.finishToken(nu.privateId,this.readWord1());this.raise(this.pos,"Unexpected character '"+vu(e)+"'")},kl.getTokenFromCode=function(e){switch(e){case 46:return this.readToken_dot();case 40:return++this.pos,this.finishToken(nu.parenL);case 41:return++this.pos,this.finishToken(nu.parenR);case 59:return++this.pos,this.finishToken(nu.semi);case 44:return++this.pos,this.finishToken(nu.comma);case 91:return++this.pos,this.finishToken(nu.bracketL);case 93:return++this.pos,this.finishToken(nu.bracketR);case 123:return++this.pos,this.finishToken(nu.braceL);case 125:return++this.pos,this.finishToken(nu.braceR);case 58:return++this.pos,this.finishToken(nu.colon);case 96:if(this.options.ecmaVersion<6)break;return++this.pos,this.finishToken(nu.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(nu.prefix,1);case 35:return this.readToken_numberSign()}this.raise(this.pos,"Unexpected character '"+vu(e)+"'")},kl.finishOp=function(e,t){var r=this.input.slice(this.pos,this.pos+t);return this.pos+=t,this.finishToken(e,r)},kl.readRegexp=function(){for(var e,t,r=this.pos;;){this.pos>=this.input.length&&this.raise(r,"Unterminated regular expression");var i=this.input.charAt(this.pos);if(au.test(i)&&this.raise(r,"Unterminated regular expression"),e)e=!1;else{if("["===i)t=!0;else if("]"===i&&t)t=!1;else if("/"===i&&!t)break;e="\\"===i}++this.pos}var s=this.input.slice(r,this.pos);++this.pos;var n=this.pos,a=this.readWord1();this.containsEsc&&this.unexpected(n);var o=this.regexpState||(this.regexpState=new bl(this));o.reset(r,s,a),this.validateRegExpFlags(o),this.validateRegExpPattern(o);var h=null;try{h=new RegExp(s,a)}catch(e){}return this.finishToken(nu.regexp,{pattern:s,flags:a,value:h})},kl.readInt=function(e,t,r){for(var i=this.options.ecmaVersion>=12&&void 0===t,s=r&&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(i&&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 i&&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},kl.readRadixNumber=function(e){var t=this.pos;this.pos+=2;var r=this.readInt(e);return null==r&&this.raise(this.start+2,"Expected number in radix "+e),this.options.ecmaVersion>=11&&110===this.input.charCodeAt(this.pos)?(r=Il(this.input.slice(t,this.pos)),++this.pos):Kh(this.fullCharCodeAtPos())&&this.raise(this.pos,"Identifier directly after number"),this.finishToken(nu.num,r)},kl.readNumber=function(e){var t=this.pos;e||null!==this.readInt(10,void 0,!0)||this.raise(t,"Invalid number");var r=this.pos-t>=2&&48===this.input.charCodeAt(t);r&&this.strict&&this.raise(t,"Invalid number");var i=this.input.charCodeAt(this.pos);if(!r&&!e&&this.options.ecmaVersion>=11&&110===i){var s=Il(this.input.slice(t,this.pos));return++this.pos,Kh(this.fullCharCodeAtPos())&&this.raise(this.pos,"Identifier directly after number"),this.finishToken(nu.num,s)}r&&/[89]/.test(this.input.slice(t,this.pos))&&(r=!1),46!==i||r||(++this.pos,this.readInt(10),i=this.input.charCodeAt(this.pos)),69!==i&&101!==i||r||(43!==(i=this.input.charCodeAt(++this.pos))&&45!==i||++this.pos,null===this.readInt(10)&&this.raise(t,"Invalid number")),Kh(this.fullCharCodeAtPos())&&this.raise(this.pos,"Identifier directly after number");var n,a=(n=this.input.slice(t,this.pos),r?parseInt(n,8):parseFloat(n.replace(/_/g,"")));return this.finishToken(nu.num,a)},kl.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},kl.readString=function(e){for(var t="",r=++this.pos;;){this.pos>=this.input.length&&this.raise(this.start,"Unterminated string constant");var i=this.input.charCodeAt(this.pos);if(i===e)break;92===i?(t+=this.input.slice(r,this.pos),t+=this.readEscapedChar(!1),r=this.pos):8232===i||8233===i?(this.options.ecmaVersion<10&&this.raise(this.start,"Unterminated string constant"),++this.pos,this.options.locations&&(this.curLine++,this.lineStart=this.pos)):(hu(i)&&this.raise(this.start,"Unterminated string constant"),++this.pos)}return t+=this.input.slice(r,this.pos++),this.finishToken(nu.string,t)};var Bl={};kl.tryReadTemplateToken=function(){this.inTemplateElement=!0;try{this.readTmplToken()}catch(e){if(e!==Bl)throw e;this.readInvalidTemplateToken()}this.inTemplateElement=!1},kl.invalidStringToken=function(e,t){if(this.inTemplateElement&&this.options.ecmaVersion>=9)throw Bl;this.raise(e,t)},kl.readTmplToken=function(){for(var e="",t=this.pos;;){this.pos>=this.input.length&&this.raise(this.start,"Unterminated template");var r=this.input.charCodeAt(this.pos);if(96===r||36===r&&123===this.input.charCodeAt(this.pos+1))return this.pos!==this.start||this.type!==nu.template&&this.type!==nu.invalidTemplate?(e+=this.input.slice(t,this.pos),this.finishToken(nu.template,e)):36===r?(this.pos+=2,this.finishToken(nu.dollarBraceL)):(++this.pos,this.finishToken(nu.backQuote));if(92===r)e+=this.input.slice(t,this.pos),e+=this.readEscapedChar(!0),t=this.pos;else if(hu(r)){switch(e+=this.input.slice(t,this.pos),++this.pos,r){case 13:10===this.input.charCodeAt(this.pos)&&++this.pos;case 10:e+="\n";break;default:e+=String.fromCharCode(r)}this.options.locations&&(++this.curLine,this.lineStart=this.pos),t=this.pos}else++this.pos}},kl.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(nu.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")},kl.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 vu(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 r=this.pos-1;this.invalidStringToken(r,"Invalid escape sequence in template string")}default:if(t>=48&&t<=55){var i=this.input.substr(this.pos-1,3).match(/^[0-7]+/)[0],s=parseInt(i,8);return s>255&&(i=i.slice(0,-1),s=parseInt(i,8)),this.pos+=i.length-1,t=this.input.charCodeAt(this.pos),"0"===i&&56!==t&&57!==t||!this.strict&&!e||this.invalidStringToken(this.pos-1-i.length,e?"Octal literal in template string":"Octal literal in strict mode"),String.fromCharCode(s)}return hu(t)?(this.options.locations&&(this.lineStart=this.pos,++this.curLine),""):String.fromCharCode(t)}},kl.readHexChar=function(e){var t=this.pos,r=this.readInt(16,e);return null===r&&this.invalidStringToken(t,"Bad character escape sequence"),r},kl.readWord1=function(){this.containsEsc=!1;for(var e="",t=!0,r=this.pos,i=this.options.ecmaVersion>=6;this.pos<this.input.length;){var s=this.fullCharCodeAtPos();if(Jh(s,i))this.pos+=s<=65535?1:2;else{if(92!==s)break;this.containsEsc=!0,e+=this.input.slice(r,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?Kh:Jh)(a,i)||this.invalidStringToken(n,"Invalid Unicode escape"),e+=vu(a),r=this.pos}t=!1}return e+this.input.slice(r,this.pos)},kl.readWord=function(){var e=this.readWord1(),t=nu.name;return this.keywords.test(e)&&(t=iu[e]),this.finishToken(t,e)};function Ll(e,t,r){r(e,t)}function Pl(e,t,r){}Tu.acorn={Parser:Tu,version:"8.14.0",defaultOptions:Du,Position:_u,SourceLocation:wu,getLineInfo:Cu,Node:Qu,TokenType:Qh,tokTypes:nu,keywordTypes:iu,TokContext:ju,tokContexts:$u,isIdentifierChar:Jh,isIdentifierStart:Kh,Token:Ml,isNewLine:hu,lineBreak:au,lineBreakG:ou,nonASCIIwhitespace:lu};var Ol={};Ol.Program=Ol.BlockStatement=Ol.StaticBlock=function(e,t,r){for(var i=0,s=e.body;i<s.length;i+=1){r(s[i],t,"Statement")}},Ol.Statement=Ll,Ol.EmptyStatement=Pl,Ol.ExpressionStatement=Ol.ParenthesizedExpression=Ol.ChainExpression=function(e,t,r){return r(e.expression,t,"Expression")},Ol.IfStatement=function(e,t,r){r(e.test,t,"Expression"),r(e.consequent,t,"Statement"),e.alternate&&r(e.alternate,t,"Statement")},Ol.LabeledStatement=function(e,t,r){return r(e.body,t,"Statement")},Ol.BreakStatement=Ol.ContinueStatement=Pl,Ol.WithStatement=function(e,t,r){r(e.object,t,"Expression"),r(e.body,t,"Statement")},Ol.SwitchStatement=function(e,t,r){r(e.discriminant,t,"Expression");for(var i=0,s=e.cases;i<s.length;i+=1){r(s[i],t)}},Ol.SwitchCase=function(e,t,r){e.test&&r(e.test,t,"Expression");for(var i=0,s=e.consequent;i<s.length;i+=1){r(s[i],t,"Statement")}},Ol.ReturnStatement=Ol.YieldExpression=Ol.AwaitExpression=function(e,t,r){e.argument&&r(e.argument,t,"Expression")},Ol.ThrowStatement=Ol.SpreadElement=function(e,t,r){return r(e.argument,t,"Expression")},Ol.TryStatement=function(e,t,r){r(e.block,t,"Statement"),e.handler&&r(e.handler,t),e.finalizer&&r(e.finalizer,t,"Statement")},Ol.CatchClause=function(e,t,r){e.param&&r(e.param,t,"Pattern"),r(e.body,t,"Statement")},Ol.WhileStatement=Ol.DoWhileStatement=function(e,t,r){r(e.test,t,"Expression"),r(e.body,t,"Statement")},Ol.ForStatement=function(e,t,r){e.init&&r(e.init,t,"ForInit"),e.test&&r(e.test,t,"Expression"),e.update&&r(e.update,t,"Expression"),r(e.body,t,"Statement")},Ol.ForInStatement=Ol.ForOfStatement=function(e,t,r){r(e.left,t,"ForInit"),r(e.right,t,"Expression"),r(e.body,t,"Statement")},Ol.ForInit=function(e,t,r){"VariableDeclaration"===e.type?r(e,t):r(e,t,"Expression")},Ol.DebuggerStatement=Pl,Ol.FunctionDeclaration=function(e,t,r){return r(e,t,"Function")},Ol.VariableDeclaration=function(e,t,r){for(var i=0,s=e.declarations;i<s.length;i+=1){r(s[i],t)}},Ol.VariableDeclarator=function(e,t,r){r(e.id,t,"Pattern"),e.init&&r(e.init,t,"Expression")},Ol.Function=function(e,t,r){e.id&&r(e.id,t,"Pattern");for(var i=0,s=e.params;i<s.length;i+=1){r(s[i],t,"Pattern")}r(e.body,t,e.expression?"Expression":"Statement")},Ol.Pattern=function(e,t,r){"Identifier"===e.type?r(e,t,"VariablePattern"):"MemberExpression"===e.type?r(e,t,"MemberPattern"):r(e,t)},Ol.VariablePattern=Pl,Ol.MemberPattern=Ll,Ol.RestElement=function(e,t,r){return r(e.argument,t,"Pattern")},Ol.ArrayPattern=function(e,t,r){for(var i=0,s=e.elements;i<s.length;i+=1){var n=s[i];n&&r(n,t,"Pattern")}},Ol.ObjectPattern=function(e,t,r){for(var i=0,s=e.properties;i<s.length;i+=1){var n=s[i];"Property"===n.type?(n.computed&&r(n.key,t,"Expression"),r(n.value,t,"Pattern")):"RestElement"===n.type&&r(n.argument,t,"Pattern")}},Ol.Expression=Ll,Ol.ThisExpression=Ol.Super=Ol.MetaProperty=Pl,Ol.ArrayExpression=function(e,t,r){for(var i=0,s=e.elements;i<s.length;i+=1){var n=s[i];n&&r(n,t,"Expression")}},Ol.ObjectExpression=function(e,t,r){for(var i=0,s=e.properties;i<s.length;i+=1){r(s[i],t)}},Ol.FunctionExpression=Ol.ArrowFunctionExpression=Ol.FunctionDeclaration,Ol.SequenceExpression=function(e,t,r){for(var i=0,s=e.expressions;i<s.length;i+=1){r(s[i],t,"Expression")}},Ol.TemplateLiteral=function(e,t,r){for(var i=0,s=e.quasis;i<s.length;i+=1){r(s[i],t)}for(var n=0,a=e.expressions;n<a.length;n+=1){r(a[n],t,"Expression")}},Ol.TemplateElement=Pl,Ol.UnaryExpression=Ol.UpdateExpression=function(e,t,r){r(e.argument,t,"Expression")},Ol.BinaryExpression=Ol.LogicalExpression=function(e,t,r){r(e.left,t,"Expression"),r(e.right,t,"Expression")},Ol.AssignmentExpression=Ol.AssignmentPattern=function(e,t,r){r(e.left,t,"Pattern"),r(e.right,t,"Expression")},Ol.ConditionalExpression=function(e,t,r){r(e.test,t,"Expression"),r(e.consequent,t,"Expression"),r(e.alternate,t,"Expression")},Ol.NewExpression=Ol.CallExpression=function(e,t,r){if(r(e.callee,t,"Expression"),e.arguments)for(var i=0,s=e.arguments;i<s.length;i+=1){r(s[i],t,"Expression")}},Ol.MemberExpression=function(e,t,r){r(e.object,t,"Expression"),e.computed&&r(e.property,t,"Expression")},Ol.ExportNamedDeclaration=Ol.ExportDefaultDeclaration=function(e,t,r){e.declaration&&r(e.declaration,t,"ExportNamedDeclaration"===e.type||e.declaration.id?"Statement":"Expression"),e.source&&r(e.source,t,"Expression")},Ol.ExportAllDeclaration=function(e,t,r){e.exported&&r(e.exported,t),r(e.source,t,"Expression")},Ol.ImportDeclaration=function(e,t,r){for(var i=0,s=e.specifiers;i<s.length;i+=1){r(s[i],t)}r(e.source,t,"Expression")},Ol.ImportExpression=function(e,t,r){r(e.source,t,"Expression")},Ol.ImportSpecifier=Ol.ImportDefaultSpecifier=Ol.ImportNamespaceSpecifier=Ol.Identifier=Ol.PrivateIdentifier=Ol.Literal=Pl,Ol.TaggedTemplateExpression=function(e,t,r){r(e.tag,t,"Expression"),r(e.quasi,t,"Expression")},Ol.ClassDeclaration=Ol.ClassExpression=function(e,t,r){return r(e,t,"Class")},Ol.Class=function(e,t,r){e.id&&r(e.id,t,"Pattern"),e.superClass&&r(e.superClass,t,"Expression"),r(e.body,t)},Ol.ClassBody=function(e,t,r){for(var i=0,s=e.body;i<s.length;i+=1){r(s[i],t)}},Ol.MethodDefinition=Ol.PropertyDefinition=Ol.Property=function(e,t,r){e.computed&&r(e.key,t,"Expression"),e.value&&r(e.value,t,"Expression")};var Nl={},Rl={};(function e(t){var r,i,s,n,a,o;function h(e){var t,r,i={};for(t in e)e.hasOwnProperty(t)&&(r=e[t],i[t]="object"==typeof r&&null!==r?h(r):r);return i}function u(e,t){this.parent=e,this.key=t}function l(e,t,r,i){this.node=e,this.path=t,this.wrap=r,this.ref=i}function c(){}function p(e){return null!=e&&"object"==typeof e&&"string"==typeof e.type}function d(e,t){return(e===r.ObjectExpression||e===r.ObjectPattern)&&"properties"===t}function f(e,t){for(var r=e.length-1;r>=0;--r)if(e[r].node===t)return!0;return!1}function g(e,t){return(new c).traverse(e,t)}function m(e,t){var r;return r=function(e,t){var r,i,s,n;for(i=e.length,s=0;i;)t(e[n=s+(r=i>>>1)])?i=r:(s=n+1,i-=r+1);return s}(t,(function(t){return t.range[0]>e.range[0]})),e.extendedRange=[e.range[0],e.range[1]],r!==t.length&&(e.extendedRange[1]=t[r].range[0]),(r-=1)>=0&&(e.extendedRange[0]=t[r].range[1]),e}return r={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"]},i={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,r,i,s;function n(e,t){if(Array.isArray(t))for(r=0,i=t.length;r<i;++r)e.push(t[r]);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,r;for(r=[],e=1,t=this.__leavelist.length;e<t;++e)r.push(this.__leavelist[e].node);return r},c.prototype.current=function(){return this.__current.node},c.prototype.__execute=function(e,t){var r,i;return i=void 0,r=this.__current,this.__current=t,this.__state=null,e&&(i=e.call(this,t.node,this.__leavelist[this.__leavelist.length-1].node)),this.__current=r,i},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 r,i,s,o,h,u,c,g,m,y,x,v;for(this.__initialize(e,t),v={},r=this.__worklist,i=this.__leavelist,r.push(new l(e,null,null,null)),i.push(new l(null,null,null,null));r.length;)if((s=r.pop())!==v){if(s.node){if(u=this.__execute(t.enter,s),this.__state===n||u===n)return;if(r.push(v),i.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(i,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)}r.push(s)}}else if(p(x)){if(f(i,x))continue;r.push(new l(x,c,null,null))}}}else if(s=i.pop(),u=this.__execute(t.leave,s),this.__state===n||u===n)return},c.prototype.replace=function(e,t){var r,i,s,h,c,f,g,m,y,x,v,b,_;function w(e){var t,i,s,n;if(e.ref.remove())for(i=e.ref.key,n=e.ref.parent,t=r.length;t--;)if((s=r[t]).ref&&s.ref.parent===n){if(s.ref.key<i)break;--s.ref.key}}for(this.__initialize(e,t),v={},r=this.__worklist,i=this.__leavelist,f=new l(e,null,null,new u(b={root:e},"root")),r.push(f),i.push(f);r.length;)if((f=r.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)&&(r.push(v),i.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))}r.push(f)}}else p(x)&&r.push(new l(x,_,null,new u(s,_)))}}else if(f=i.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=r,t.traverse=g,t.replace=function(e,t){return(new c).replace(e,t)},t.attachComments=function(e,t,r){var s,n,a,o,u=[];if(!e.range)throw new Error("attachComments needs range information");if(!r.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]),r));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?i.Break:u[o].extendedRange[0]>e.range[1]?i.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?i.Break:u[o].extendedRange[0]>e.range[1]?i.Skip:void 0}}),e},t.VisitorKeys=s,t.VisitorOption=i,t.Controller=c,t.cloneEnvironment=function(){return e({})},t})(Rl);var Vl={},Ul={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}Ul.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 r;if("IfStatement"!==e.type)return!1;if(null==e.alternate)return!1;r=e.consequent;do{if("IfStatement"===r.type&&null==r.alternate)return!0;r=t(r)}while(r);return!1},trailingStatement:t}}();var Gl=Ul.exports,zl={exports:{}};!function(){var e,t,r,i,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]/},r=[5760,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8239,8287,12288,65279],i=new Array(128),n=0;n<128;++n)i[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;zl.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&&r.indexOf(e)>=0},isLineTerminator:function(e){return 10===e||13===e||8232===e||8233===e},isIdentifierStartES5:function(e){return e<128?i[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?i[t]:e.NonAsciiIdentifierStart.test(a(t))},isIdentifierPartES6:function(t){return t<128?s[t]:e.NonAsciiIdentifierPart.test(a(t))}}}();var jl=zl.exports,$l={exports:{}};!function(){var e=jl;function t(e,t){return!(!t&&"yield"===e)&&r(e,t)}function r(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 i(e,r){return"null"===e||"true"===e||"false"===e||t(e,r)}function s(e,t){return"null"===e||"true"===e||"false"===e||r(e,t)}function n(t){var r,i,s;if(0===t.length)return!1;if(s=t.charCodeAt(0),!e.isIdentifierStartES5(s))return!1;for(r=1,i=t.length;r<i;++r)if(s=t.charCodeAt(r),!e.isIdentifierPartES5(s))return!1;return!0}function a(t){var r,i,s,n,a;if(0===t.length)return!1;for(a=e.isIdentifierStartES6,r=0,i=t.length;r<i;++r){if(55296<=(s=t.charCodeAt(r))&&s<=56319){if(++r>=i)return!1;if(!(56320<=(n=t.charCodeAt(r))&&n<=57343))return!1;s=1024*(s-55296)+(n-56320)+65536}if(!a(s))return!1;a=e.isIdentifierPartES6}return!0}$l.exports={isKeywordES5:t,isKeywordES6:r,isReservedWordES5:i,isReservedWordES6:s,isRestrictedWord:function(e){return"eval"===e||"arguments"===e},isIdentifierNameES5:n,isIdentifierNameES6:a,isIdentifierES5:function(e,t){return n(e)&&!i(e,t)},isIdentifierES6:function(e,t){return a(e)&&!s(e,t)}}}();var Wl=$l.exports;Vl.ast=Gl,Vl.code=jl,Vl.keyword=Wl;var ql,Hl,Xl={},Yl={},Zl={},Kl={};function Jl(){if(ql)return Kl;ql=1;var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split("");return Kl.encode=function(t){if(0<=t&&t<e.length)return e[t];throw new TypeError("Must be between 0 and 63: "+t)},Kl.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},Kl}function Ql(){if(Hl)return Zl;Hl=1;var e=Jl();return Zl.encode=function(t){var r,i="",s=function(e){return e<0?1+(-e<<1):0+(e<<1)}(t);do{r=31&s,(s>>>=5)>0&&(r|=32),i+=e.encode(r)}while(s>0);return i},Zl.decode=function(t,r,i){var s,n,a,o,h=t.length,u=0,l=0;do{if(r>=h)throw new Error("Expected more digits in base 64 VLQ value.");if(-1===(n=e.decode(t.charCodeAt(r++))))throw new Error("Invalid base64 digit: "+t.charAt(r-1));s=!!(32&n),u+=(n&=31)<<l,l+=5}while(s);i.value=(o=(a=u)>>1,1&~a?o:-o),i.rest=r},Zl}var ec,tc={};function rc(){return ec||(ec=1,function(e){e.getArg=function(e,t,r){if(t in e)return e[t];if(3===arguments.length)return r;throw new Error('"'+t+'" is a required argument.')};var t=/^(?:([\w+\-.]+):)?\/\/(?:(\w+:\w+)@)?([\w.-]*)(?::(\d+))?(.*)$/,r=/^data:.+\,.+$/;function i(e){var r=e.match(t);return r?{scheme:r[1],auth:r[2],host:r[3],port:r[4],path:r[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 r=t,n=i(t);if(n){if(!n.path)return t;r=n.path}for(var a,o=e.isAbsolute(r),h=r.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""===(r=h.join("/"))&&(r=o?"/":"."),n?(n.path=r,s(n)):r}function a(e,t){""===e&&(e="."),""===t&&(t=".");var a=i(t),o=i(e);if(o&&(e=o.path||"/"),a&&!a.scheme)return o&&(a.scheme=o.scheme),s(a);if(a||t.match(r))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=i,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 r=0;0!==t.indexOf(e+"/");){var i=e.lastIndexOf("/");if(i<0)return t;if((e=e.slice(0,i)).match(/^([^\/]+:\/)?\/*$/))return t;++r}return Array(r+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 r=t-10;r>=0;r--)if(36!==e.charCodeAt(r))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,r){var i=l(e.source,t.source);return 0!==i||0!==(i=e.originalLine-t.originalLine)||0!==(i=e.originalColumn-t.originalColumn)||r||0!==(i=e.generatedColumn-t.generatedColumn)||0!==(i=e.generatedLine-t.generatedLine)?i:l(e.name,t.name)},e.compareByGeneratedPositionsDeflated=function(e,t,r){var i=e.generatedLine-t.generatedLine;return 0!==i||0!==(i=e.generatedColumn-t.generatedColumn)||r||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.compareByGeneratedPositionsInflated=function(e,t){var r=e.generatedLine-t.generatedLine;return 0!==r||0!==(r=e.generatedColumn-t.generatedColumn)||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.parseSourceMapInput=function(e){return JSON.parse(e.replace(/^\)]}'[^\n]*\n/,""))},e.computeSourceURL=function(e,t,r){if(t=t||"",e&&("/"!==e[e.length-1]&&"/"!==t[0]&&(e+="/"),t=e+t),r){var o=i(r);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)}}(tc)),tc}var ic,sc={};function nc(){if(ic)return sc;ic=1;var e=rc(),t=Object.prototype.hasOwnProperty,r="undefined"!=typeof Map;function i(){this._array=[],this._set=r?new Map:Object.create(null)}return i.fromArray=function(e,t){for(var r=new i,s=0,n=e.length;s<n;s++)r.add(e[s],t);return r},i.prototype.size=function(){return r?this._set.size:Object.getOwnPropertyNames(this._set).length},i.prototype.add=function(i,s){var n=r?i:e.toSetString(i),a=r?this.has(i):t.call(this._set,n),o=this._array.length;a&&!s||this._array.push(i),a||(r?this._set.set(i,o):this._set[n]=o)},i.prototype.has=function(i){if(r)return this._set.has(i);var s=e.toSetString(i);return t.call(this._set,s)},i.prototype.indexOf=function(i){if(r){var s=this._set.get(i);if(s>=0)return s}else{var n=e.toSetString(i);if(t.call(this._set,n))return this._set[n]}throw new Error('"'+i+'" is not in the set.')},i.prototype.at=function(e){if(e>=0&&e<this._array.length)return this._array[e];throw new Error("No element indexed by "+e)},i.prototype.toArray=function(){return this._array.slice()},sc.ArraySet=i,sc}var ac,oc,hc={};function uc(){if(ac)return hc;ac=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 r,i,s,n,a,o;r=this._last,i=t,s=r.generatedLine,n=i.generatedLine,a=r.generatedColumn,o=i.generatedColumn,n>s||n==s&&o>=a||e.compareByGeneratedPositionsInflated(r,i)<=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},hc.MappingList=t,hc}function lc(){if(oc)return Yl;oc=1;var e=Ql(),t=rc(),r=nc().ArraySet,i=uc().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 r,this._names=new r,this._mappings=new i,this._sourcesContents=null}return s.prototype._version=3,s.fromSourceMap=function(e){var r=e.sourceRoot,i=new s({file:e.file,sourceRoot:r});return e.eachMapping((function(e){var s={generated:{line:e.generatedLine,column:e.generatedColumn}};null!=e.source&&(s.source=e.source,null!=r&&(s.source=t.relative(r,s.source)),s.original={line:e.originalLine,column:e.originalColumn},null!=e.name&&(s.name=e.name)),i.addMapping(s)})),e.sources.forEach((function(s){var n=s;null!==r&&(n=t.relative(r,s)),i._sources.has(n)||i._sources.add(n);var a=e.sourceContentFor(s);null!=a&&i.setSourceContent(s,a)})),i},s.prototype.addMapping=function(e){var r=t.getArg(e,"generated"),i=t.getArg(e,"original",null),s=t.getArg(e,"source",null),n=t.getArg(e,"name",null);this._skipValidation||this._validateMapping(r,i,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:r.line,generatedColumn:r.column,originalLine:null!=i&&i.line,originalColumn:null!=i&&i.column,source:s,name:n})},s.prototype.setSourceContent=function(e,r){var i=e;null!=this._sourceRoot&&(i=t.relative(this._sourceRoot,i)),null!=r?(this._sourcesContents||(this._sourcesContents=Object.create(null)),this._sourcesContents[t.toSetString(i)]=r):this._sourcesContents&&(delete this._sourcesContents[t.toSetString(i)],0===Object.keys(this._sourcesContents).length&&(this._sourcesContents=null))},s.prototype.applySourceMap=function(e,i,s){var n=i;if(null==i){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 r,h=new r;this._mappings.unsortedForEach((function(r){if(r.source===n&&null!=r.originalLine){var i=e.originalPositionFor({line:r.originalLine,column:r.originalColumn});null!=i.source&&(r.source=i.source,null!=s&&(r.source=t.join(s,r.source)),null!=a&&(r.source=t.relative(a,r.source)),r.originalLine=i.line,r.originalColumn=i.column,null!=i.name&&(r.name=i.name))}var u=r.source;null==u||o.has(u)||o.add(u);var l=r.name;null==l||h.has(l)||h.add(l)}),this),this._sources=o,this._names=h,e.sources.forEach((function(r){var i=e.sourceContentFor(r);null!=i&&(null!=s&&(r=t.join(s,r)),null!=a&&(r=t.relative(a,r)),this.setSourceContent(r,i))}),this)},s.prototype._validateMapping=function(e,t,r,i){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||r||i)&&!(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&&r))throw new Error("Invalid mapping: "+JSON.stringify({generated:e,source:r,original:t,name:i}))},s.prototype._serializeMappings=function(){for(var r,i,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(r="",(i=d[f]).generatedLine!==o)for(a=0;i.generatedLine!==o;)r+=";",o++;else if(f>0){if(!t.compareByGeneratedPositionsInflated(i,d[f-1]))continue;r+=","}r+=e.encode(i.generatedColumn-a),a=i.generatedColumn,null!=i.source&&(n=this._sources.indexOf(i.source),r+=e.encode(n-c),c=n,r+=e.encode(i.originalLine-1-u),u=i.originalLine-1,r+=e.encode(i.originalColumn-h),h=i.originalColumn,null!=i.name&&(s=this._names.indexOf(i.name),r+=e.encode(s-l),l=s)),p+=r}return p},s.prototype._generateSourcesContent=function(e,r){return e.map((function(e){if(!this._sourcesContents)return null;null!=r&&(e=t.relative(r,e));var i=t.toSetString(e);return Object.prototype.hasOwnProperty.call(this._sourcesContents,i)?this._sourcesContents[i]: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())},Yl.SourceMapGenerator=s,Yl}var cc,pc={},dc={};function fc(){return cc||(cc=1,function(e){function t(r,i,s,n,a,o){var h=Math.floor((i-r)/2)+r,u=a(s,n[h],!0);return 0===u?h:u>0?i-h>1?t(h,i,s,n,a,o):o==e.LEAST_UPPER_BOUND?i<n.length?i:-1:h:h-r>1?t(r,h,s,n,a,o):o==e.LEAST_UPPER_BOUND?h:r<0?-1:r}e.GREATEST_LOWER_BOUND=1,e.LEAST_UPPER_BOUND=2,e.search=function(r,i,s,n){if(0===i.length)return-1;var a=t(-1,i.length,r,i,s,n||e.GREATEST_LOWER_BOUND);if(a<0)return-1;for(;a-1>=0&&0===s(i[a],i[a-1],!0);)--a;return a}}(dc)),dc}var gc,mc,yc={};function xc(){if(gc)return yc;function e(e,t,r){var i=e[t];e[t]=e[r],e[r]=i}function t(r,i,s,n){if(s<n){var a=s-1;e(r,(l=s,c=n,Math.round(l+Math.random()*(c-l))),n);for(var o=r[n],h=s;h<n;h++)i(r[h],o)<=0&&e(r,a+=1,h);e(r,a+1,h);var u=a+1;t(r,i,s,u-1),t(r,i,u+1,n)}var l,c}return gc=1,yc.quickSort=function(e,r){t(e,r,0,e.length-1)},yc}var vc,bc,_c={};function wc(){return bc||(bc=1,Xl.SourceMapGenerator=lc().SourceMapGenerator,Xl.SourceMapConsumer=function(){if(mc)return pc;mc=1;var e=rc(),t=fc(),r=nc().ArraySet,i=Ql(),s=xc().quickSort;function n(t,r){var i=t;return"string"==typeof t&&(i=e.parseSourceMapInput(t)),null!=i.sections?new h(i,r):new a(i,r)}function a(t,i){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=r.fromArray(o.map(String),!0),this._sources=r.fromArray(a,!0),this._absoluteSources=this._sources.toArray().map((function(t){return e.computeSourceURL(h,t,i)})),this.sourceRoot=h,this.sourcesContent=u,this._mappings=l,this._sourceMapURL=i,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,i){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 r,this._names=new r;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 r=e.getArg(t,"offset"),s=e.getArg(r,"line"),a=e.getArg(r,"column");if(s<h.line||s===h.line&&a<h.column)throw new Error("Section offsets must be ordered and non-overlapping.");return h=r,{generatedOffset:{generatedLine:s+1,generatedColumn:a+1},consumer:new n(e.getArg(t,"map"),i)}}))}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 r=e.charAt(t);return";"===r||","===r},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,r,i){var s,a=r||null;switch(i||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 r=null===t.source?null:this._sources.at(t.source);return{source:r=e.computeSourceURL(o,r,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(r){var i=e.getArg(r,"line"),s={source:e.getArg(r,"source"),originalLine:i,originalColumn:e.getArg(r,"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===r.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===i&&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},pc.SourceMapConsumer=n,a.prototype=Object.create(n.prototype),a.prototype.consumer=n,a.prototype._findSourceIndex=function(t){var r,i=t;if(null!=this.sourceRoot&&(i=e.relative(this.sourceRoot,i)),this._sources.has(i))return this._sources.indexOf(i);for(r=0;r<this._absoluteSources.length;++r)if(this._absoluteSources[r]==t)return r;return-1},a.fromSourceMap=function(t,i){var n=Object.create(a.prototype),h=n._names=r.fromArray(t._names.toArray(),!0),u=n._sources=r.fromArray(t._sources.toArray(),!0);n.sourceRoot=t._sourceRoot,n.sourcesContent=t._generateSourcesContent(n._sources.toArray(),n.sourceRoot),n.file=t._file,n._sourceMapURL=i,n._absoluteSources=n._sources.toArray().map((function(t){return e.computeSourceURL(n.sourceRoot,t,i)}));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,r){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;)i.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,r,i,s,n,a){if(e[i]<=0)throw new TypeError("Line must be greater than or equal to 1, got "+e[i]);if(e[s]<0)throw new TypeError("Column must be greater than or equal to 0, got "+e[s]);return t.search(e,r,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 r=this._generatedMappings[e+1];if(t.generatedLine===r.generatedLine){t.lastGeneratedColumn=r.generatedColumn-1;continue}}t.lastGeneratedColumn=1/0}},a.prototype.originalPositionFor=function(t){var r={generatedLine:e.getArg(t,"line"),generatedColumn:e.getArg(t,"column")},i=this._findMapping(r,this._generatedMappings,"generatedLine","generatedColumn",e.compareByGeneratedPositionsDeflated,e.getArg(t,"bias",n.GREATEST_LOWER_BOUND));if(i>=0){var s=this._generatedMappings[i];if(s.generatedLine===r.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,r){if(!this.sourcesContent)return null;var i=this._findSourceIndex(t);if(i>=0)return this.sourcesContent[i];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(r)return null;throw new Error('"'+n+'" is not in the SourceMap.')},a.prototype.generatedPositionFor=function(t){var r=e.getArg(t,"source");if((r=this._findSourceIndex(r))<0)return{line:null,column:null,lastColumn:null};var i={source:r,originalLine:e.getArg(t,"line"),originalColumn:e.getArg(t,"column")},s=this._findMapping(i,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===i.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}},pc.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 r=0;r<this._sections[t].consumer.sources.length;r++)e.push(this._sections[t].consumer.sources[r]);return e}}),h.prototype.originalPositionFor=function(r){var i={generatedLine:e.getArg(r,"line"),generatedColumn:e.getArg(r,"column")},s=t.search(i,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:i.generatedLine-(n.generatedOffset.generatedLine-1),column:i.generatedColumn-(n.generatedOffset.generatedLine===i.generatedLine?n.generatedOffset.generatedColumn-1:0),bias:r.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 r=0;r<this._sections.length;r++){var i=this._sections[r].consumer.sourceContentFor(e,!0);if(i)return i}if(t)return null;throw new Error('"'+e+'" is not in the SourceMap.')},h.prototype.generatedPositionFor=function(t){for(var r=0;r<this._sections.length;r++){var i=this._sections[r];if(-1!==i.consumer._findSourceIndex(e.getArg(t,"source"))){var s=i.consumer.generatedPositionFor(t);if(s)return{line:s.line+(i.generatedOffset.generatedLine-1),column:s.column+(i.generatedOffset.generatedLine===s.line?i.generatedOffset.generatedColumn-1:0)}}}return{line:null,column:null}},h.prototype._parseMappings=function(t,r){this.__generatedMappings=[],this.__originalMappings=[];for(var i=0;i<this._sections.length;i++)for(var n=this._sections[i],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)},pc.IndexedSourceMapConsumer=h,pc}().SourceMapConsumer,Xl.SourceNode=function(){if(vc)return _c;vc=1;var e=lc().SourceMapGenerator,t=rc(),r=/(\r?\n)/,i="$$$isSourceNode$$$";function s(e,t,r,s,n){this.children=[],this.sourceContents={},this.line=null==e?null:e,this.column=null==t?null:t,this.source=null==r?null:r,this.name=null==n?null:n,this[i]=!0,null!=s&&this.add(s)}return s.fromStringWithSourceMap=function(e,i,n){var a=new s,o=e.split(r),h=0,u=function(){return e()+(e()||"");function e(){return h<o.length?o[h++]:void 0}},l=1,c=0,p=null;return i.eachMapping((function(e){if(null!==p){if(!(l<e.generatedLine)){var t=(r=o[h]||"").substr(0,e.generatedColumn-c);return o[h]=r.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 r=o[h]||"";a.add(r.substr(0,e.generatedColumn)),o[h]=r.substr(e.generatedColumn),c=e.generatedColumn}p=e}),this),h<o.length&&(p&&d(p,u()),a.add(o.splice(h).join(""))),i.sources.forEach((function(e){var r=i.sourceContentFor(e);null!=r&&(null!=n&&(e=t.join(n,e)),a.setSourceContent(e,r))})),a;function d(e,r){if(null===e||void 0===e.source)a.add(r);else{var i=n?t.join(n,e.source):e.source;a.add(new s(e.originalLine,e.originalColumn,i,r,e.name))}}},s.prototype.add=function(e){if(Array.isArray(e))e.forEach((function(e){this.add(e)}),this);else{if(!e[i]&&"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[i]&&"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,r=0,s=this.children.length;r<s;r++)(t=this.children[r])[i]?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,r,i=this.children.length;if(i>0){for(t=[],r=0;r<i-1;r++)t.push(this.children[r]),t.push(e);t.push(this.children[r]),this.children=t}return this},s.prototype.replaceRight=function(e,t){var r=this.children[this.children.length-1];return r[i]?r.replaceRight(e,t):"string"==typeof r?this.children[this.children.length-1]=r.replace(e,t):this.children.push("".replace(e,t)),this},s.prototype.setSourceContent=function(e,r){this.sourceContents[t.toSetString(e)]=r},s.prototype.walkSourceContents=function(e){for(var r=0,s=this.children.length;r<s;r++)this.children[r][i]&&this.children[r].walkSourceContents(e);var n=Object.keys(this.sourceContents);for(r=0,s=n.length;r<s;r++)e(t.fromSetString(n[r]),this.sourceContents[n[r]])},s.prototype.toString=function(){var e="";return this.walk((function(t){e+=t})),e},s.prototype.toStringWithSourceMap=function(t){var r={code:"",line:1,column:0},i=new e(t),s=!1,n=null,a=null,o=null,h=null;return this.walk((function(e,t){r.code+=e,null!==t.source&&null!==t.line&&null!==t.column?(n===t.source&&a===t.line&&o===t.column&&h===t.name||i.addMapping({source:t.source,original:{line:t.line,column:t.column},generated:{line:r.line,column:r.column},name:t.name}),n=t.source,a=t.line,o=t.column,h=t.name,s=!0):s&&(i.addMapping({generated:{line:r.line,column:r.column}}),n=null,s=!1);for(var u=0,l=e.length;u<l;u++)10===e.charCodeAt(u)?(r.line++,r.column=0,u+1===l?(n=null,s=!1):s&&i.addMapping({source:t.source,original:{line:t.line,column:t.column},generated:{line:r.line,column:r.column},name:t.name})):r.column++})),this.walkSourceContents((function(e,t){i.setSourceContent(e,t)})),{code:r.code,map:i}},_c.SourceNode=s,_c}().SourceNode),Xl}var Cc="2.1.0";!function(e){!function(){var t,r,i,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=Vl,t=(n=Rl).Syntax,i={"??":(r={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,"||":r.LogicalOR,"&&":r.LogicalAND,"|":r.BitwiseOR,"^":r.BitwiseXOR,"&":r.BitwiseAND,"==":r.Equality,"!=":r.Equality,"===":r.Equality,"!==":r.Equality,is:r.Equality,isnt:r.Equality,"<":r.Relational,">":r.Relational,"<=":r.Relational,">=":r.Relational,in:r.Relational,instanceof:r.Relational,"<<":r.BitwiseSHIFT,">>":r.BitwiseSHIFT,">>>":r.BitwiseSHIFT,"+":r.Additive,"-":r.Additive,"*":r.Multiplicative,"%":r.Multiplicative,"/":r.Multiplicative,"**":r.Exponentiation};var F=32,T=33;function M(e,t){var r="";for(t|=0;t>0;t>>>=1,e+=e)1&t&&(r+=e);return r}function k(e){var t=e.length;return t&&a.code.isLineTerminator(e.charCodeAt(t-1))}function I(e,t){var r;for(r in t)t.hasOwnProperty(r)&&(e[r]=t[r]);return e}function B(e,t){var r,i;function s(e){return"object"==typeof e&&e instanceof Object&&!(e instanceof RegExp)}for(r in t)t.hasOwnProperty(r)&&(s(i=t[r])?s(e[r])?B(e[r],i):e[r]=B({},i):e[r]=i);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 r;return 8===e?"\\b":12===e?"\\f":9===e?"\\t":(r=e.toString(16).toUpperCase(),u||e>255?"\\u"+"0000".slice(r.length)+r:0!==e||a.code.isDecimalDigit(t)?11===e?"\\x0B":"\\x"+"00".slice(r.length)+r:"\\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,r,i,s="";for(t=0,r=e.length;t<r;++t)i=e[t],s+=Array.isArray(i)?N(i):i;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 r,i,s,n;return 0===(r=R(e).toString()).length?[t]:0===(i=R(t).toString()).length?[e]:(s=r.charCodeAt(r.length-1),n=i.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 r="//"+e.value;return D||(r+="\n"),r}return b.format.indent.adjustMultilineComment&&/[\n\r]/.test(e.value)?function(e,t){var r,i,s,n,h,u,l,c;for(r=e.split(/\r\n|[\r\n]/),u=Number.MAX_VALUE,i=1,s=r.length;i<s;++i){for(n=r[i],h=0;h<n.length&&a.code.isWhiteSpace(n.charCodeAt(h));)++h;u>h&&(u=h)}for(void 0!==t?(l=o,"*"===r[1][u]&&(t+=" "),o=t):(1&u&&--u,l=o),i=1,s=r.length;i<s;++i)c=R(G(r[i].slice(u))),r[i]=w?c.join(""):c;return o=l,r.join("\n")}("/*"+e.value+"*/",t):"/*"+e.value+"*/"}function $(e,r){var i,s,n,u,l,c,p,d,f,g,m,y;if(e.leadingComments&&e.leadingComments.length>0){if(u=r,D){for(r=[],d=(n=e.leadingComments[0]).extendedRange,f=n.range,(y=((m=C.substring(d[0],f[0])).match(/\n/g)||[]).length)>0?(r.push(M("\n",y)),r.push(G(j(n)))):(r.push(m),r.push(j(n))),g=f,i=1,s=e.leadingComments.length;i<s;i++)f=(n=e.leadingComments[i]).range,y=(C.substring(g[1],f[0]).match(/\n/g)||[]).length,r.push(M("\n",y)),r.push(G(j(n))),g=f;y=(C.substring(f[1],d[1]).match(/\n/g)||[]).length,r.push(M("\n",y))}else for(n=e.leadingComments[0],r=[],x&&e.type===t.Program&&0===e.body.length&&r.push("\n"),r.push(j(n)),k(R(r).toString())||r.push("\n"),i=1,s=e.leadingComments.length;i<s;++i)k(R(p=[j(n=e.leadingComments[i])]).toString())||p.push("\n"),r.push(G(p));r.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?(r.push(M("\n",y)),r.push(G(j(n)))):(r.push(m),r.push(j(n)));else for(l=!k(R(r).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,r,h]).toString())),i=0,s=e.trailingComments.length;i<s;++i)n=e.trailingComments[i],l?(r=0===i?[r,h]:[r,c]).push(j(n,c)):r=[r,G(j(n))],i===s-1||k(R(r).toString())||(r=[r,"\n"]);return r}function W(e,t,r){var i,s=0;for(i=e;i<t;i++)"\n"===C[i]&&s++;for(i=1;i<s;i++)r.push(f)}function q(e,t,r){return t<r?["(",e,")"]:e}function H(e){var t,r,i;for(t=1,r=(i=e.split(/\r\n|\n/)).length;t<r;t++)i[t]=f+o+i[t];return i}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,r="";return t.async&&(r+=Z(t,!e.computed)),t.generator&&(r+=K(t)?"*":""),r}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,r.Sequence,7);throw new Error("Unknown node type: "+e.type)}X.prototype.maybeBlock=function(e,r){var i,s,n=this;return s=!b.comment||!e.leadingComments,e.type===t.BlockStatement&&s?[g,this.generateStatement(e,r)]:e.type===t.EmptyStatement&&s?";":(z((function(){i=[f,G(n.generateStatement(e,r))]})),i)},X.prototype.maybeBlockSuffix=function(e,r){var i=k(R(r).toString());return e.type!==t.BlockStatement||b.comment&&e.leadingComments||i?i?[r,o]:[r,f,o]:[r,g]},X.prototype.generatePattern=function(e,r,i){return e.type===t.Identifier?Y(e):this.generateExpression(e,r,i)},X.prototype.generateFunctionParams=function(e){var i,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),i=0,s=e.params.length;i<s;++i)a&&e.defaults[i]?n.push(this.generateAssignment(e.params[i],e.defaults[i],"=",r.Assignment,7)):n.push(this.generatePattern(e.params[i],r.Assignment,7)),i+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 i,s;return i=this.generateFunctionParams(e),e.type===t.ArrowFunctionExpression&&(i.push(g),i.push("=>")),e.expression?(i.push(g),"{"===(s=this.generateExpression(e.body,r.Assignment,7)).toString().charAt(0)&&(s=["(",s,")"]),i.push(s)):i.push(this.maybeBlock(e.body,9)),i},X.prototype.generateIterationForStatement=function(e,i,s){var n=["for"+(i.await?V()+"await":"")+g+"("],a=this;return z((function(){i.left.type===t.VariableDeclaration?z((function(){n.push(i.left.kind+V()),n.push(a.generateStatement(i.left.declarations[0],0))})):n.push(a.generateExpression(i.left,r.Call,7)),n=U(n,e),n=[U(n,a.generateExpression(i.right,r.Assignment,7)),")"]})),n.push(this.maybeBlock(i.body,s)),n},X.prototype.generatePropertyKey=function(e,t){var i=[];return t&&i.push("["),i.push(this.generateExpression(e,r.Assignment,7)),t&&i.push("]"),i},X.prototype.generateAssignment=function(e,t,i,s,n){return r.Assignment<s&&(n|=1),q([this.generateExpression(e,r.Call,n),g+i+g,this.generateExpression(t,r.Assignment,n)],r.Assignment,s)},X.prototype.semicolon=function(e){return!y&&e&F?"":";"},X.Statement={BlockStatement:function(e,t){var r,i,s=["{",f],n=this;return z((function(){var a,o,h,u;for(0===e.body.length&&D&&(r=e.range)[1]-r[0]>2&&("\n"===(i=C.substring(r[0]+1,r[1]-1))[0]&&(s=["{"]),s.push(i)),u=1,8&t&&(u|=16),a=0,o=e.body.length;a<o;++a)D&&(0===a&&(e.body[0].leadingComments&&(r=e.body[0].leadingComments[0].extendedRange,"\n"===(i=C.substring(r[0],r[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 i=["{",f],s=this;return z((function(t){var n,a;for(n=0,a=e.body.length;n<a;++n)i.push(t),i.push(s.generateExpression(e.body[n],r.Sequence,7)),n+1<a&&i.push(f)})),k(R(i).toString())||i.push(f),i.push(o),i.push("}"),i},ClassDeclaration:function(e,t){var i,s;return i=["class"],e.id&&(i=U(i,this.generateExpression(e.id,r.Sequence,7))),e.superClass&&(s=U("extends",this.generateExpression(e.superClass,r.Unary,7)),i=U(i,s)),i.push(g),i.push(this.generateStatement(e.body,T)),i},DirectiveStatement:function(e,t){return b.raw&&e.raw?e.raw+this.semicolon(t):function(e){var t,r,i,s;for(s="double"===p?'"':"'",t=0,r=e.length;t<r;++t){if(39===(i=e.charCodeAt(t))){s='"';break}if(34===i){s="'";break}92===i&&++t}return s+e+s}(e.directive)+this.semicolon(t)},DoWhileStatement:function(e,t){var i=U("do",this.maybeBlock(e.body,1));return U(i=this.maybeBlockSuffix(e.body,i),["while"+g+"(",this.generateExpression(e.test,r.Sequence,7),")"+this.semicolon(t)])},CatchClause:function(e,t){var i,s=this;return z((function(){var t;e.param?(i=["catch"+g+"(",s.generateExpression(e.param,r.Sequence,7),")"],e.guard&&(t=s.generateExpression(e.guard,r.Sequence,7),i.splice(2,0," if ",t))):i=["catch"]})),i.push(this.maybeBlock(e.body,1)),i},DebuggerStatement:function(e,t){return"debugger"+this.semicolon(t)},EmptyStatement:function(e,t){return";"},ExportDefaultDeclaration:function(e,t){var i,s=["export"];return i=t&F?T:1,s=U(s,"default"),s=S(e.declaration)?U(s,this.generateStatement(e.declaration,i)):U(s,this.generateExpression(e.declaration,r.Assignment,7)+this.semicolon(t))},ExportNamedDeclaration:function(e,i){var s,n=["export"],a=this;return s=i&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],r.Sequence,7)):(n=U(n,"{"),z((function(t){var i,s;for(n.push(f),i=0,s=e.specifiers.length;i<s;++i)n.push(t),n.push(a.generateExpression(e.specifiers[i],r.Sequence,7)),i+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,r.Sequence,7),this.semicolon(i)]):n.push(this.semicolon(i))),n)},ExportAllDeclaration:function(e,t){return["export"+g,"*"+g,"from"+g,this.generateExpression(e.source,r.Sequence,7),this.semicolon(t)]},ExpressionStatement:function(e,i){var s,n;return 123===(n=R(s=[this.generateExpression(e.expression,r.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,r,i;if("async"!==e.slice(0,5))return!1;if(!a.code.isWhiteSpace(e.charCodeAt(5)))return!1;for(r=6,i=e.length;r<i&&a.code.isWhiteSpace(e.charCodeAt(r));++r);return r!==i&&("function"===e.slice(r,r+8)&&(40===(t=e.charCodeAt(r+8))||a.code.isWhiteSpace(t)||42===t||a.code.isLineTerminator(t)))}(n)||v&&16&i&&e.expression.type===t.Literal&&"string"==typeof e.expression.value?s=["(",s,")"+this.semicolon(i)]:s.push(this.semicolon(i)),s},ImportDeclaration:function(e,i){var s,n,a=this;return 0===e.specifiers.length?["import",g,this.generateExpression(e.source,r.Sequence,7),this.semicolon(i)]:(s=["import"],n=0,e.specifiers[n].type===t.ImportDefaultSpecifier&&(s=U(s,[this.generateExpression(e.specifiers[n],r.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],r.Sequence,7)]):(s.push(g+"{"),e.specifiers.length-n==1?(s.push(g),s.push(this.generateExpression(e.specifiers[n],r.Sequence,7)),s.push(g+"}"+g)):(z((function(t){var i,o;for(s.push(f),i=n,o=e.specifiers.length;i<o;++i)s.push(t),s.push(a.generateExpression(e.specifiers[i],r.Sequence,7)),i+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,r.Sequence,7),this.semicolon(i)]))},VariableDeclarator:function(e,t){var i=1&t?7:6;return e.init?[this.generateExpression(e.id,r.Assignment,i),g,"=",g,this.generateExpression(e.init,r.Assignment,i)]:this.generatePattern(e.id,r.Assignment,i)},VariableDeclaration:function(e,t){var r,i,s,n,a,o=this;function h(){for(n=e.declarations[0],b.comment&&n.leadingComments?(r.push("\n"),r.push(G(o.generateStatement(n,a)))):(r.push(V()),r.push(o.generateStatement(n,a))),i=1,s=e.declarations.length;i<s;++i)n=e.declarations[i],b.comment&&n.leadingComments?(r.push(","+f),r.push(G(o.generateStatement(n,a)))):(r.push(","+g),r.push(o.generateStatement(n,a)))}return r=[e.kind],a=1&t?1:0,e.declarations.length>1?z(h):h(),r.push(this.semicolon(t)),r},ThrowStatement:function(e,t){return[U("throw",this.generateExpression(e.argument,r.Sequence,7)),this.semicolon(t)]},TryStatement:function(e,t){var r,i,s,n;if(r=["try",this.maybeBlock(e.block,1)],r=this.maybeBlockSuffix(e.block,r),e.handlers)for(i=0,s=e.handlers.length;i<s;++i)r=U(r,this.generateStatement(e.handlers[i],1)),(e.finalizer||i+1!==s)&&(r=this.maybeBlockSuffix(e.handlers[i].body,r));else{for(i=0,s=(n=e.guardedHandlers||[]).length;i<s;++i)r=U(r,this.generateStatement(n[i],1)),(e.finalizer||i+1!==s)&&(r=this.maybeBlockSuffix(n[i].body,r));if(e.handler)if(Array.isArray(e.handler))for(i=0,s=e.handler.length;i<s;++i)r=U(r,this.generateStatement(e.handler[i],1)),(e.finalizer||i+1!==s)&&(r=this.maybeBlockSuffix(e.handler[i].body,r));else r=U(r,this.generateStatement(e.handler,1)),e.finalizer&&(r=this.maybeBlockSuffix(e.handler.body,r))}return e.finalizer&&(r=U(r,["finally",this.maybeBlock(e.finalizer,1)])),r},SwitchStatement:function(e,t){var i,s,n,a,o,h=this;if(z((function(){i=["switch"+g+"(",h.generateExpression(e.discriminant,r.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)),i.push(s),k(R(s).toString())||i.push(f);return i.push(G("}")),i},SwitchCase:function(e,i){var s,n,a,o,h,u=this;return z((function(){for(s=e.test?[U("case",u.generateExpression(e.test,r.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&&i&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,i){var s,n,a=this;return z((function(){s=["if"+g+"(",a.generateExpression(e.test,r.Sequence,7),")"]})),n=1,i&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,i){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,r.Sequence,6)),s.push(";")):s.push(";"),e.test?(s.push(g),s.push(n.generateExpression(e.test,r.Sequence,7)),s.push(";")):s.push(";"),e.update?(s.push(g),s.push(n.generateExpression(e.update,r.Sequence,7)),s.push(")")):s.push(")")})),s.push(this.maybeBlock(e.body,i&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 r,i,s,n,a;for(n=e.body.length,r=[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],r)),s>0&&(e.body[s-1].trailingComments||e.body[s].leadingComments||W(e.body[s-1].range[1],e.body[s].range[0],r))),i=G(this.generateStatement(e.body[s],a)),r.push(i),s+1<n&&!k(R(i).toString())&&(D&&e.body[s+1].leadingComments||r.push(f)),D&&s===n-1&&(e.body[s].trailingComments||W(e.body[s].range[1],e.range[1],r));return r},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,r.Sequence,7)),this.semicolon(t)]:["return"+this.semicolon(t)]},WhileStatement:function(e,t){var i,s=this;return z((function(){i=["while"+g+"(",s.generateExpression(e.test,r.Sequence,7),")"]})),i.push(this.maybeBlock(e.body,t&F?T:1)),i},WithStatement:function(e,t){var i,s=this;return z((function(){i=["with"+g+"(",s.generateExpression(e.object,r.Sequence,7),")"]})),i.push(this.maybeBlock(e.body,t&F?T:1)),i}},I(X.prototype,X.Statement),X.Expression={SequenceExpression:function(e,t,i){var s,n,a;for(r.Sequence<t&&(i|=1),s=[],n=0,a=e.expressions.length;n<a;++n)s.push(this.generateExpression(e.expressions[n],r.Assignment,i)),n+1<a&&s.push(","+g);return q(s,r.Sequence,t)},AssignmentExpression:function(e,t,r){return this.generateAssignment(e.left,e.right,e.operator,t,r)},ArrowFunctionExpression:function(e,t,i){return q(this.generateFunctionBody(e),r.ArrowFunction,t)},ConditionalExpression:function(e,t,i){return r.Conditional<t&&(i|=1),q([this.generateExpression(e.test,r.Coalesce,i),g+"?"+g,this.generateExpression(e.consequent,r.Assignment,i),g+":"+g,this.generateExpression(e.alternate,r.Assignment,i)],r.Conditional,t)},LogicalExpression:function(e,t,r){return"??"===e.operator&&(r|=64),this.BinaryExpression(e,t,r)},BinaryExpression:function(e,t,s){var n,o,h,u,l,c;return u=i[e.operator],o="**"===e.operator?r.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,i){var s,n,a;for(s=[this.generateExpression(e.callee,r.Call,3)],e.optional&&s.push("?."),s.push("("),n=0,a=e.arguments.length;n<a;++n)s.push(this.generateExpression(e.arguments[n],r.Assignment,7)),n+1<a&&s.push(","+g);return s.push(")"),2&i?q(s,r.Call,t):["(",s,")"]},ChainExpression:function(e,t,i){return r.OptionalChaining<t&&(i|=2),q(this.generateExpression(e.expression,r.OptionalChaining,i),r.OptionalChaining,t)},NewExpression:function(e,t,i){var s,n,a,o,h;if(n=e.arguments.length,h=4&i&&!m&&0===n?5:1,s=U("new",this.generateExpression(e.callee,r.New,h)),!(4&i)||m||n>0){for(s.push("("),a=0,o=n;a<o;++a)s.push(this.generateExpression(e.arguments[a],r.Assignment,7)),a+1<o&&s.push(","+g);s.push(")")}return q(s,r.New,t)},MemberExpression:function(e,i,s){var n,o;return n=[this.generateExpression(e.object,r.Call,2&s?3:1)],e.computed?(e.optional&&n.push("?."),n.push("["),n.push(this.generateExpression(e.property,r.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,r.Member,i)},MetaProperty:function(e,t,i){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,r.Member,t)},UnaryExpression:function(e,t,i){var s,n,o,h,u;return n=this.generateExpression(e.argument,r.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,r.Unary,t)},YieldExpression:function(e,t,i){var s;return s=e.delegate?"yield*":"yield",e.argument&&(s=U(s,this.generateExpression(e.argument,r.Yield,7))),q(s,r.Yield,t)},AwaitExpression:function(e,t,i){return q(U(e.all?"await*":"await",this.generateExpression(e.argument,r.Await,7)),r.Await,t)},UpdateExpression:function(e,t,i){return e.prefix?q([e.operator,this.generateExpression(e.argument,r.Unary,7)],r.Unary,t):q([this.generateExpression(e.argument,r.Postfix,7),e.operator],r.Postfix,t)},FunctionExpression:function(e,t,r){var i=[Z(e,!0),"function"];return e.id?(i.push(K(e)||V()),i.push(Y(e.id))):i.push(K(e)||g),i.push(this.generateFunctionBody(e)),i},ArrayPattern:function(e,t,r){return this.ArrayExpression(e,t,r,!0)},ArrayExpression:function(e,t,i,s){var n,a,h=this;return e.elements.length?(a=!s&&e.elements.length>1,n=["[",a?f:""],z((function(t){var i,s;for(i=0,s=e.elements.length;i<s;++i)e.elements[i]?(n.push(a?t:""),n.push(h.generateExpression(e.elements[i],r.Assignment,7))):(a&&n.push(t),i+1===s&&n.push(",")),i+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,r){return"..."+this.generatePattern(e.argument)},ClassExpression:function(e,t,i){var s,n;return s=["class"],e.id&&(s=U(s,this.generateExpression(e.id,r.Sequence,7))),e.superClass&&(n=U("extends",this.generateExpression(e.superClass,r.Unary,7)),s=U(s,n)),s.push(g),s.push(this.generateStatement(e.body,T)),s},MethodDefinition:function(e,t,r){var i,s;return i=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(i,s)},Property:function(e,t,i){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,r.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,r.Assignment,7)]},ObjectExpression:function(e,t,i){var s,n,a,h,u=this;return e.properties.length?(s=e.properties.length>1,z((function(){a=u.generateExpression(e.properties[0],r.Sequence,7)})),s||(h=R(a).toString(),/[\r\n]/g.test(h))?(z((function(t){var i,o;if(n=["{",f,t,a],s)for(n.push(","+f),i=1,o=e.properties.length;i<o;++i)n.push(t),n.push(u.generateExpression(e.properties[i],r.Sequence,7)),i+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,r){return this.generateAssignment(e.left,e.right,"=",t,r)},ObjectPattern:function(e,i,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 i,s;for(i=0,s=e.properties.length;i<s;++i)n.push(u?t:""),n.push(c.generateExpression(e.properties[i],r.Sequence,7)),i+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,r){return"this"},Super:function(e,t,r){return"super"},Identifier:function(e,t,r){return Y(e)},ImportDefaultSpecifier:function(e,t,r){return Y(e.id||e.local)},ImportNamespaceSpecifier:function(e,t,r){var i=["*"],s=e.id||e.local;return s&&i.push(g+"as"+V()+Y(s)),i},ImportSpecifier:function(e,t,r){var i=e.imported,s=[i.name],n=e.local;return n&&n.name!==i.name&&s.push(V()+"as"+V()+Y(n)),s},ExportSpecifier:function(e,t,r){var i=e.local,s=[i.name],n=e.exported;return n&&n.name!==i.name&&s.push(V()+"as"+V()+Y(n)),s},Literal:function(e,r,i){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,r,i,s,n,o="",h=0,l=0;for(t=0,r=e.length;t<r;++t){if(39===(i=e.charCodeAt(t)))++h;else if(34===i)++l;else if(47===i&&u)o+="\\";else{if(a.code.isLineTerminator(i)||92===i){o+=O(i);continue}if(!a.code.isIdentifierPartES5(i)&&(u&&i<32||!u&&!d&&(i<32||i>126))){o+=P(i,e.charCodeAt(t+1));continue}}o+=String.fromCharCode(i)}if(n=(s=!("double"===p||"auto"===p&&l<h))?"'":'"',!(s?h:l))return n+o+n;for(e=o,o=n,t=0,r=e.length;t<r;++t)(39===(i=e.charCodeAt(t))&&s||34===i&&!s)&&(o+="\\"),o+=String.fromCharCode(i);return o+n}(e.value):"number"==typeof e.value?function(e){var t,r,i,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(r=t.indexOf("."),u||48!==t.charCodeAt(0)||1!==r||(r=0,t=t.slice(1)),i=t,t=t.replace("e+","e"),s=0,(n=i.indexOf("e"))>0&&(s=+i.slice(n+1),i=i.slice(0,n)),r>=0&&(s-=i.length-r-1,i=+(i.slice(0,r)+i.slice(r+1))+""),n=0;48===i.charCodeAt(i.length+n-1);)--n;return 0!==n&&(s-=n,i=i.slice(0,n)),0!==s&&(i+="e"+s),(i.length<t.length||c&&e>1e12&&Math.floor(e)===e&&(i="0x"+e.toString(16)).length<t.length)&&+i===e&&(t=i),t}(e.value):"boolean"==typeof e.value?e.value?"true":"false":function(e){var t,r,i,s,n,a,o,h;if(r=e.toString(),e.source){if(!(t=r.match(/\/([^/]*)$/)))return r;for(i=t[1],r="",o=!1,h=!1,s=0,n=e.source.length;s<n;++s)a=e.source.charCodeAt(s),h?(r+=L(a,h),h=!1):(o?93===a&&(o=!1):47===a?r+="\\":91===a&&(o=!0),r+=L(a,h),h=92===a);return"/"+r+"/"+i}return r}(e.value)},GeneratorExpression:function(e,t,r){return this.ComprehensionExpression(e,t,r)},ComprehensionExpression:function(e,i,s){var n,a,o,h,u=this;return n=e.type===t.GeneratorExpression?["("]:["["],b.moz.comprehensionExpressionStartsWithAssignment&&(h=this.generateExpression(e.body,r.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],r.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,r.Sequence,7),n=U(n,["(",h,")"])),b.moz.comprehensionExpressionStartsWithAssignment||(h=this.generateExpression(e.body,r.Assignment,7),n=U(n,h)),n.push(e.type===t.GeneratorExpression?")":"]"),n},ComprehensionBlock:function(e,i,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,r.Call,7),e.of?"of":"in"),n=U(n,this.generateExpression(e.right,r.Sequence,7)),["for"+g+"(",n,")"]},SpreadElement:function(e,t,i){return["...",this.generateExpression(e.argument,r.Assignment,7)]},TaggedTemplateExpression:function(e,t,i){var s=3;return 2&i||(s=1),q([this.generateExpression(e.tag,r.Call,s),this.generateExpression(e.quasi,r.Primary,4)],r.TaggedTemplate,t)},TemplateElement:function(e,t,r){return e.value.raw},TemplateLiteral:function(e,t,i){var s,n,a;for(s=["`"],n=0,a=e.quasis.length;n<a;++n)s.push(this.generateExpression(e.quasis[n],r.Primary,7)),n+1<a&&(s.push("${"+g),s.push(this.generateExpression(e.expressions[n],r.Sequence,7)),s.push(g+"}"));return s.push("`"),s},ModuleSpecifier:function(e,t,r){return this.Literal(e,t,r)},ImportExpression:function(e,t,i){return q(["import(",this.generateExpression(e.source,r.Assignment,7),")"],r.Call,t)}},I(X.prototype,X.Expression),X.prototype.generateExpression=function(e,i,s){var n,a;return a=e.type||t.Property,b.verbatim&&e.hasOwnProperty(b.verbatim)?function(e,t){var i;return R("string"==typeof(i=e[b.verbatim])?q(H(i),r.Sequence,t):q(H(i.content),null!=i.precedence?i.precedence:r.Sequence,t),e)}(e,i):(n=this[a](e,i,s),b.comment&&(n=$(e,n)),R(n,e))},X.prototype.generateStatement=function(e,r){var i,s;return i=this[e.type](e,r),b.comment&&(i=$(e,i)),s=R(i).toString(),e.type!==t.Program||x||""!==f||"\n"!==s.charAt(s.length-1)||(i=w?R(i).replaceRight(/\s+$/,""):s.replace(/\s+$/,"")),R(i,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=Cc,e.generate=function(t,r){var i,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!=r?("string"==typeof r.indent&&(a.format.indent.style=r.indent),"number"==typeof r.base&&(a.format.indent.base=r.base),r=B(a,r),h=r.format.indent.style,o="string"==typeof r.base?r.base:M(h,r.format.indent.base)):(h=(r=a).format.indent.style,o=M(h,r.format.indent.base)),u=r.format.json,l=r.format.renumber,c=!u&&r.format.hexadecimal,p=u?"double":r.format.quotes,d=r.format.escapeless,f=r.format.newline,g=r.format.space,r.format.compact&&(f=g=h=o=""),m=r.format.parentheses,y=r.format.semicolons,x=r.format.safeConcatenation,v=r.directive,_=u?null:r.parse,w=r.sourceMap,C=r.sourceCode,D=r.format.preserveBlankLines&&null!==C,b=r,w&&(s=e.browser?Ni.sourceMap.SourceNode:wc().SourceNode),i=Q(t),w?(n=i.toStringWithSourceMap({file:r.file,sourceRoot:r.sourceMapRoot}),r.sourceContent&&n.map.setSourceContent(r.sourceMap,r.sourceContent),r.sourceMapWithCode?n:n.map.toString()):(n={code:i.toString(),map:null},r.sourceMapWithCode?n:n.code)},e.attachComments=n.attachComments,e.Precedence=B({},r),e.browser=!1,e.FORMAT_MINIFY=E,e.FORMAT_DEFAULTS=A}()}(Nl);var Dc=Ri(Nl);function Ec(e,t){let r,i;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 Tu.parse(e,t)}(e.toString(),{ecmaVersion:2021,locations:t.srcLocations});r=o,a=[],(i=void 0)||(i=Ol),function e(t,s,n){var o=n||t.type,h=t!==a[a.length-1];h&&a.push(t),i[o](t,s,e),r[o]&&r[o](t,s||a,a),h&&a.pop()}(s,{varyings:{}},n);const u=Dc.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 r,i,n,a};const o={UnaryExpression(e,t,r){if(r.some(a))return;const i={type:"Literal",value:e.operator},s=e=>{e.type="CallExpression",e.callee={type:"Identifier",name:"unaryNode"},e.arguments=[e.argument,i]};if("MemberExpression"===e.type){const t=e.argument.property.name;let r=[["x","y","z","w"],["r","g","b","a"],["s","t","p","q"]].some((e=>[...t].every((t=>e.includes(t)))))&&"MemberExpression"===e.argument.type;r?(e.type="MemberExpression",e.object={type:"CallExpression",callee:{type:"Identifier",name:"unaryNode"},arguments:[e.argument.object,i]},e.property={type:"Identifier",name:t}):s(e)}else s(e);delete e.argument,delete e.operator},VariableDeclarator(e,t,r){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 r={type:"Literal",value:e.id.name};e.init.arguments.unshift(r),t.varyings[e.id.name]=r}},Identifier(e,t,r){t.varyings[e.name]&&!r.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,r){const i=JSON.parse(JSON.stringify(e));e.type="CallExpression",e.callee={type:"Identifier",name:"dynamicNode"},e.arguments=[i]},AssignmentExpression(e,t,r){if("="!==e.operator){const t=n(e.operator.replace("=","")),r={type:"CallExpression",callee:{type:"MemberExpression",object:e.left,property:{type:"Identifier",name:t}},arguments:[e.right]};e.operator="=",e.right=r}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,r){if(r.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===r.srcLocations&&!1===e)try{throw new Error("StackCapture")}catch(e){const t=e.stack.split("\n");let r=5;T(this)&&r--,this.srcLine=t[r].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 r=new f(t,e,"float",!0);Object.defineProperty(this,e,{get:()=>r,set(e){this.componentsChanged=!0,L(this)?this.node.value=e:r=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 r=()=>t.usedInSatisfied.length>=1,i=()=>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),i()&&r()&&t.saveState(e,i(),r()))}))}toGLSLBase(e){let t;if(this.shouldUseTemporaryVariable()){let r=e.declarations.length;t=this.getTemporaryVariable(e);let i=e.declarations.length-1-r;i=i>0?i:void 0,this.dependsOn.forEach((t=>{if(t.isVector){const r=t.originalComponents.map(((e,r)=>e===t.currentComponents[r]));e.updateComponents(t.node,i,r)}else e.updateComponents(t.node,i)}))}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,r=!1){if(super(t,"float"),Array.isArray(e)&&(e=e[0]),r){const{parent:e,name:t}=r;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,r=!1){super(r,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,r)=>{const i={name:t,parent:this};let s=S(e[r])?e[r]:new l(e[r],!0,i);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,i)}})})),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,r)=>this.originalValues[r].toGLSLBase(e))).join(", ");return this.defined=!0,`${this.type}(${t})`}}}class p extends h{constructor(e,t,r,i=!1){let s;const n=e=>{let r,i=0;const s=t.every(((t,s)=>{const n=C(t);let a=e.args[s];return"genType"===a&&((void 0===r||"float"===r&&n.startsWith("vec"))&&(r=n),a=r),i+=n===a,n===a||"float"===n&&a.startsWith("vec")}));return{...e,valid:s,similarity:i,genType:r}};if(Array.isArray(r)){let i=r.filter((e=>e.args.length===t.length));if(0===i.length){const i=new Set,s=[];r.forEach((e=>i.add(e.args.length))),i.forEach((e=>s.push(`${e}`)));const n=s.join(" or ");throw new Error(`Function '${e}' has ${r.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=i.reduce(a,null)}else s=n(r);if(!s||!s.valid){const i=e=>`(${e.map((e=>e)).join(", ")})`,s=Array.isArray(r)?r.map((e=>i(e.args))).join(" or "):i(r.args),n=i(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 r="genType"===s.args[t]?s.genType:s.args[t];e=$[r](e)}return e})),"genType"===s.returnType&&(s.returnType=s.genType),super(i,s.returnType),this.name=e,this.args=t,this.argumentTypes=s.args}deconstructArgs(e){let t=this.args.map(((t,r)=>(E(t)&&"float"!=this.argumentTypes[r]&&(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,r=!1){super(r,t),this.name=e}toGLSL(e){return`${this.name}`}}class f extends h{constructor(e,t,r,i=!1){super(i,r),this.parent=e,this.componentName=t,this.type=r}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,r=!1){super(e,t,r),this.timesChanged=0,this.tempVars=0}getValue(){const e=r.context;if(!e.varyings[this.name]||!this.timesChanged)return this;let t,i=e.varyings[this.name].splice(0,this.timesChanged);return i.forEach(((r,s)=>{let{value:n}=r;if(e.declarations.push(` ${this.name} = ${n.toGLSLBase(e)};`),s===i.length-1){const r=`${this.name}_${this.tempVars++}`;t=U(new d(r,this.type,!0)),e.declarations.push(` ${this.type} ${r} = ${this.name};`)}})),this.timesChanged=0,t}bridge(e){(!D(e)||this.type.startsWith("vec")&&"float"===C(e))&&(e=$[this.type](e)),r.registerVarying(this,e),this.timesChanged+=1}}class m extends h{constructor(e,t,r,i=!1){super(i,null),this.operator=r,this.left=e,this.right=t;for(const r of[e,t])r.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 r=e.toGLSLBase(t);return T(e)&&!e.temporaryVariable&&(r=`(${r})`),"float"===this.type&&E(e)&&(r=`float(${r})`),r}toGLSL(e){const t=this.processOperand(this.left,e),r=this.processOperand(this.right,e);return`${t} ${this.operator} ${r}`}}class y extends m{constructor(e,t,r){super(e,t,r)}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,r=!1){super(r,e.type),this.node=e,this.operator=t}toGLSL(e){let t=this.node.toGLSLBase(e);var r;return M(this.node)||I(this.node)||((r=this.node)instanceof l||r instanceof u||r instanceof c)||(t=`(${t})`),`${this.operator}${t}`}}function v(e){const t=new _;return e(),i=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,r.context.ifs.push(this)}if(e,t){this.condition=e,this.conditionString=e.toGLSL(r.context),this.ifBranch=v(t),this.ifBranch.parent=this}elseIf(e,t){let r=v(t);return t.parent=this,this.elseIfs.push({condition:e,elseBranch:r}),this}else(e){return this.elseBranch=v(e),this.elseBranch.parent=this,this}thenDiscard(){return new w(this.condition)}saveState(e,t,r){this.states.push({line:e.declarations.length,usedInSatisfied:t,dependsOnSatisfied:r}),this.insertionPoint=e.declarations.length-1}toGLSL(e){const t=e.declarations.length;this.dependsOn.forEach((t=>e.updateComponents(t.node)));const r=e.declarations.length-t;this.insertionPoint+=r;let i=[`\n if (${this.conditionString}) {`,`\n ${this.ifBranch.toGLSL(e)}`,"\n }"];return this.elseIfs.length&&this.elseIfs.forEach((t=>{let{condition:r,elseBranch:s}=t;i.push(` else if (${r.toGLSL(e)}) {`),i.push(`\n ${s.toGLSL(e)}`),i.push("\n }")})),this.elseBranch&&(i.push(" else {"),i.push(`\n ${this.elseBranch.toGLSL(e)}`),i.push("\n }\n")),i.push("\n"),i.flat().join("")}}t.assign=function(e,t){if(!i)throw new error('assign() is supposed to be used inside of conditional branchs. Use the "=" operator as normal otherwise.');i.assign(e,t)};class _{constructor(){i=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:r,value:i})=>{let s,n;if(i)n=i.toGLSLBase(e);else{let r=this.declarations[t];t++,r.temporaryVariable=`temp_${e.getNextID()}`,this.statements.push(`${r.type} ${r.temporaryVariable} = ${r.toGLSL(e)};`),n=r.toGLSLBase(e)}M(r)||I(r)?s=`${r.toGLSLBase(e)} = ${n};`:S(r)&&r.name?s=`${r.parent.toGLSLBase(e)}.${r.name} = ${n};`:(r.temporaryVariable=`temp_${e.getNextID()}`,s=`${r.type} ${r.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,i){r=this,this.userCallback=e,this.srcLocations=i,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},i={};Object.keys(t).forEach((t=>{const s=e.hookTypes(t);this[s.name]=function(e){const r=[],i=[];s.parameters.forEach((e=>{if(P(e.type.typeName))r.push(z(e.name,e.type.typeName,!0));else{const t={};e.type.properties.forEach((r=>{t[r.name]=z(`${e.name}.${r.name}`,r.type.typeName,!0)})),r.push(t)}const t=e.type.qualifiers.length>0?e.type.qualifiers.join(" "):"";i.push(`${t} ${e.type.typeName} ${e.name}`.trim())}));let n=e(...r);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=[`(${i.join(", ")}) {`,...this.context.declarations,`\n ${s.returnType.typeName} finalReturnValue;`];Object.entries(o).forEach((([e,t])=>{const r=a.properties?`.${e}`:"";h.push(` finalReturnValue${r} = ${t};`)})),this.context.declarations=[];for(let e in this.context.varyings){const t=this.context.varyings[e],r=[];t.forEach((e=>{const{node:t,value:i}=e;r.push(` ${t.name} = ${i.toGLSLBase(this.context)};`),r.unshift(...this.context.declarations),t.timesChanged=0})),h.push(...r)}h.push(" return finalReturnValue;","}"),this.output[t]=h.join("\n"),this.resetGLSLContext()},i[s.name]=window[s.name],window[s.name]=function(e){r[s.name](e)}})),this.cleanup=()=>{for(const e in i)window[e]=i[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,r){if(e.componentsChanged){r||(r=e.componentNames.map((()=>!0)));const i=[];if(B(e))e.componentNames.forEach(((t,s)=>{if(r[s]&&e[t]!==e.originalValues[s]){const r=$.float(e[t]),s=` ${e.temporaryVariable}.${t} = ${r.toGLSLBase(this)};`;i.push(s)}}));else{const t=e.componentNames.map((t=>e[t])),r=$[e.type](t),s=` ${e.temporaryVariable} = ${r.toGLSLBase(this)};`;i.push(s)}t?this.declarations.splice(t,0,...i):this.declarations.push(...i),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,r,i){if(r in e)return Reflect.get(...arguments);for(const i of t)if([...r].every((e=>i.includes(e)))){if(1===r.length)return e[t[0][i.indexOf(r[0])]];const s=[...r].map((r=>{const s=i.indexOf(r),n=t[0][s];return e[n]})),n=`vec${r.length}`;return $[n](s)}},set(e,r,i,s){for(const n of t){const a=[...r];if(a.every((e=>n.includes(e)))){const o=Array.isArray(i)?i:Array(r.length).fill(i);return a.forEach(((r,i)=>{const a=n.indexOf(r),h=t[0][a];Reflect.set(e,h,o[i],s)})),!0}}return Reflect.set(...arguments)}}}(t)),e.addVectorComponents()}return e}function G(e,t,r,i){let s;return s="%"===r?new y(e,t):new m(e,t,r,i),U(s)}function z(e,t,r){return U(new d(e,t,r))}function j(e,t,r,i){let s=new p(e,t,r,i);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 r of e)F(r)?t+=parseInt(r.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 i in V){const s=V[i],n=`uniform${s}`;if(O.prototype[n]=function(...e){let[t,...r]=e;!i.startsWith("vec")||r[0]instanceof Function?this.output.uniforms[`${i} ${t}`]=r[0]:(r=R(r,parseInt(i.slice(3))),this.output.uniforms[`${i} ${t}`]=r);const s=z(t,i,!1);return this.uniformNodes.push(s),s},t[n]=function(...e){return r[n](...e)},"sampler2D"===i)continue;const a=`varying${s}`;O.prototype[a]=function(e){return U(new g(e,i,!1))},t[a]=function(e){return r[a](e)};const o=t[i];t[i]=function(...t){return r?.isGenerating?(t=i.startsWith("vec")?R(t,parseInt(i.slice(3))):t[0],$[i](t)):o?o.apply(this,t):void e._friendlyError(`It looks like you've called ${i} 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((([i,s])=>{if(Array.isArray(s)?s[0].isp5Function:s.isp5Function){const e=t[i];t[i]=function(...t){return r?.isGenerating?j(i,t,s):e.apply(this,t)}}else t[i]=function(...t){if(r?.isGenerating)return new j(i,t,s);e._friendlyError(`It looks like you've called ${i} outside of a shader's modify() function.`)}}))}function Ac(e){return Ac="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},Ac(e)}function Sc(e){var t=function(e,t){if("object"!=Ac(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var i=r.call(e,t);if("object"!=Ac(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e,"string");return"symbol"==Ac(t)?t:t+""}function Fc(e,t,r){return(t=Sc(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Tc(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?Object(arguments[t]):{},i=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&i.push.apply(i,Object.getOwnPropertySymbols(r).filter((function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))),i.forEach((function(t){Fc(e,t,r[t])}))}return e}function Mc(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function kc(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,Sc(i.key),i)}}function Ic(e,t,r){return t&&kc(e.prototype,t),r&&kc(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function Bc(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Lc(e,t){if(t&&("object"==Ac(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return Bc(e)}function Pc(e){return Pc=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},Pc(e)}function Oc(e,t){return Oc=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},Oc(e,t)}function Nc(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&&Oc(e,t)}void 0!==p5&&p5.registerAddon(Ec);var Rc={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)}},Vc=function(){function e(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Mc(this,e),this.init(t,r)}return Ic(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||Rc,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),r=0;r<e;r++)t[r]=arguments[r];return this.forward(t,"log","",!0)}},{key:"warn",value:function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return this.forward(t,"warn","",!0)}},{key:"error",value:function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return this.forward(t,"error","")}},{key:"deprecate",value:function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return this.forward(t,"warn","WARNING DEPRECATED: ",!0)}},{key:"forward",value:function(e,t,r,i){return i&&!this.debug?null:("string"==typeof e[0]&&(e[0]="".concat(r).concat(this.prefix," ").concat(e[0])),this.logger[t](e))}},{key:"create",value:function(t){return new e(this.logger,Tc({},{prefix:"".concat(this.prefix,":").concat(t,":")},this.options))}}]),e}(),Uc=new Vc,Gc=function(){function e(){Mc(this,e),this.observers={}}return Ic(e,[{key:"on",value:function(e,t){var r=this;return e.split(" ").forEach((function(e){r.observers[e]=r.observers[e]||[],r.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,r=new Array(t>1?t-1:0),i=1;i<t;i++)r[i-1]=arguments[i];this.observers[e]&&[].concat(this.observers[e]).forEach((function(e){e.apply(void 0,r)}));this.observers["*"]&&[].concat(this.observers["*"]).forEach((function(t){t.apply(t,[e].concat(r))}))}}]),e}();function zc(){var e,t,r=new Promise((function(r,i){e=r,t=i}));return r.resolve=e,r.reject=t,r}function jc(e){return null==e?"":""+e}function $c(e,t,r){function i(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=i(n.shift());!e[a]&&r&&(e[a]=new r),e=Object.prototype.hasOwnProperty.call(e,a)?e[a]:{}}return s()?{}:{obj:e,k:i(n.shift())}}function Wc(e,t,r){var i=$c(e,t,Object);i.obj[i.k]=r}function qc(e,t){var r=$c(e,t),i=r.obj,s=r.k;if(i)return i[s]}function Hc(e,t,r){var i=qc(e,r);return void 0!==i?i:qc(t,r)}function Xc(e,t,r){for(var i in t)"__proto__"!==i&&"constructor"!==i&&(i in e?"string"==typeof e[i]||e[i]instanceof String||"string"==typeof t[i]||t[i]instanceof String?r&&(e[i]=t[i]):Xc(e[i],t[i],r):e[i]=t[i]);return e}function Yc(e){return e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")}var Zc={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"};function Kc(e){return"string"==typeof e?e.replace(/[&<>"'\/]/g,(function(e){return Zc[e]})):e}var Jc="undefined"!=typeof window&&window.navigator&&window.navigator.userAgent&&window.navigator.userAgent.indexOf("MSIE")>-1,Qc=function(e){function t(e){var r,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{ns:["translation"],defaultNS:"translation"};return Mc(this,t),r=Lc(this,Pc(t).call(this)),Jc&&Gc.call(Bc(r)),r.data=e||{},r.options=i,void 0===r.options.keySeparator&&(r.options.keySeparator="."),r}return Nc(t,e),Ic(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,r){var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},s=void 0!==i.keySeparator?i.keySeparator:this.options.keySeparator,n=[e,t];return r&&"string"!=typeof r&&(n=n.concat(r)),r&&"string"==typeof r&&(n=n.concat(s?r.split(s):r)),e.indexOf(".")>-1&&(n=e.split(".")),qc(this.data,n)}},{key:"addResource",value:function(e,t,r,i){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];r&&(a=a.concat(n?r.split(n):r)),e.indexOf(".")>-1&&(i=t,t=(a=e.split("."))[1]),this.addNamespaces(t),Wc(this.data,a,i),s.silent||this.emit("added",e,t,r,i)}},{key:"addResources",value:function(e,t,r){var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{silent:!1};for(var s in r)"string"!=typeof r[s]&&"[object Array]"!==Object.prototype.toString.apply(r[s])||this.addResource(e,t,s,r[s],{silent:!0});i.silent||this.emit("added",e,t,r)}},{key:"addResourceBundle",value:function(e,t,r,i,s){var n=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{silent:!1},a=[e,t];e.indexOf(".")>-1&&(i=r,r=t,t=(a=e.split("."))[1]),this.addNamespaces(t);var o=qc(this.data,a)||{};i?Xc(o,r,s):o=Tc({},o,r),Wc(this.data,a,o),n.silent||this.emit("added",e,t,r)}},{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?Tc({},{},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}(Gc),ep={processors:{},addPostProcessor:function(e){this.processors[e.name]=e},handle:function(e,t,r,i,s){var n=this;return e.forEach((function(e){n.processors[e]&&(t=n.processors[e].process(t,r,i,s))})),t}},tp={},rp=function(e){function t(e){var r,i,s,n,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return Mc(this,t),r=Lc(this,Pc(t).call(this)),Jc&&Gc.call(Bc(r)),i=["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"],s=e,n=Bc(r),i.forEach((function(e){s[e]&&(n[e]=s[e])})),r.options=a,void 0===r.options.keySeparator&&(r.options.keySeparator="."),r.logger=Uc.create("translator"),r}return Nc(t,e),Ic(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:{}},r=this.resolve(e,t);return r&&void 0!==r.res}},{key:"extractFromKey",value:function(e,t){var r=void 0!==t.nsSeparator?t.nsSeparator:this.options.nsSeparator;void 0===r&&(r=":");var i=void 0!==t.keySeparator?t.keySeparator:this.options.keySeparator,s=t.ns||this.options.defaultNS;if(r&&e.indexOf(r)>-1){var n=e.match(this.interpolator.nestingRegexp);if(n&&n.length>0)return{key:e,namespaces:s};var a=e.split(r);(r!==i||r===i&&this.options.ns.indexOf(a[0])>-1)&&(s=a.shift()),e=a.join(i)}return"string"==typeof s&&(s=[s]),{key:e,namespaces:s}}},{key:"translate",value:function(e,r,i){var s=this;if("object"!==Ac(r)&&this.options.overloadTranslationOptionHandler&&(r=this.options.overloadTranslationOptionHandler(arguments)),r||(r={}),null==e)return"";Array.isArray(e)||(e=[String(e)]);var n=void 0!==r.keySeparator?r.keySeparator:this.options.keySeparator,a=this.extractFromKey(e[e.length-1],r),o=a.key,h=a.namespaces,u=h[h.length-1],l=r.lng||this.language,c=r.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if(l&&"cimode"===l.toLowerCase()){if(c){var p=r.nsSeparator||this.options.nsSeparator;return u+p+o}return o}var d=this.resolve(e,r),f=d&&d.res,g=d&&d.usedKey||o,m=d&&d.exactUsedKey||o,y=Object.prototype.toString.apply(f),x=void 0!==r.joinArrays?r.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(!r.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,r):"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,Tc({},r,{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,r,i));else{var E=!1,A=!1,S=void 0!==r.count&&"string"!=typeof r.count,F=t.hasDefaultValue(r),T=S?this.pluralResolver.getSuffix(l,r.count):"",M=r["defaultValue".concat(T)]||r.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,Tc({},r,{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,r.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(r.lng||this.language):B.push(r.lng||this.language);var O=function(e,t,i){s.options.missingKeyHandler?s.options.missingKeyHandler(e,u,t,k?i:f,k,r):s.backendConnector&&s.backendConnector.saveMissing&&s.backendConnector.saveMissing(e,u,t,k?i:f,k,r),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,r["defaultValue".concat(t)]||M)}))})):O(B,o,M))}f=this.extendTranslation(f,e,r,d,i),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,r,i,s){var n=this;if(this.i18nFormat&&this.i18nFormat.parse)e=this.i18nFormat.parse(e,r,i.usedLng,i.usedNS,i.usedKey,{resolved:i});else if(!r.skipInterpolation){r.interpolation&&this.interpolator.init(Tc({},r,{interpolation:Tc({},this.options.interpolation,r.interpolation)}));var a,o=r.interpolation&&r.interpolation.skipOnVariables||this.options.interpolation.skipOnVariables;if(o){var h=e.match(this.interpolator.nestingRegexp);a=h&&h.length}var u=r.replace&&"string"!=typeof r.replace?r.replace:r;if(this.options.interpolation.defaultVariables&&(u=Tc({},this.options.interpolation.defaultVariables,u)),e=this.interpolator.interpolate(e,u,r.lng||this.language,r),o){var l=e.match(this.interpolator.nestingRegexp);a<(l&&l.length)&&(r.nest=!1)}!1!==r.nest&&(e=this.interpolator.nest(e,(function(){for(var e=arguments.length,i=new Array(e),a=0;a<e;a++)i[a]=arguments[a];return s&&s[0]===i[0]&&!r.context?(n.logger.warn("It seems you are nesting recursively key: ".concat(i[0]," in key: ").concat(t[0])),null):n.translate.apply(n,i.concat([t]))}),r)),r.interpolation&&this.interpolator.reset()}var c=r.postProcess||this.options.postProcess,p="string"==typeof c?[c]:c;return null!=e&&p&&p.length&&!1!==r.applyPostProcessor&&(e=ep.handle(p,e,t,this.options&&this.options.postProcessPassResolved?Tc({i18nResolved:i},r):r,this)),e}},{key:"resolve",value:function(e){var t,r,i,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;r=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,!tp["".concat(d[0],"-").concat(e)]&&a.utils&&a.utils.hasLoadedNamespace&&!a.utils.hasLoadedNamespace(n)&&(tp["".concat(d[0],"-").concat(e)]=!0,a.logger.warn('key "'.concat(r,'" 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(r){if(!a.isValidLookup(t)){s=r;var n,h,l=u,d=[l];if(a.i18nFormat&&a.i18nFormat.addLookupKeys)a.i18nFormat.addLookupKeys(d,u,r,e,o);else c&&(n=a.pluralResolver.getSuffix(r,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)||(i=h,t=a.getResource(r,e,h,o))}})))}))}})),{res:t,usedKey:r,exactUsedKey:i,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,r){var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return this.i18nFormat&&this.i18nFormat.getResource?this.i18nFormat.getResource(e,t,r,i):this.resourceStore.getResource(e,t,r,i)}}],[{key:"hasDefaultValue",value:function(e){var t="defaultValue";for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)&&t===r.substring(0,12)&&void 0!==e[r])return!0;return!1}}]),t}(Gc);function ip(e){return e.charAt(0).toUpperCase()+e.slice(1)}var sp=function(){function e(t){Mc(this,e),this.options=t,this.whitelist=this.options.supportedLngs||!1,this.supportedLngs=this.options.supportedLngs||!1,this.logger=Uc.create("languageUtils")}return Ic(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"],r=e.split("-");return this.options.lowerCaseLng?r=r.map((function(e){return e.toLowerCase()})):2===r.length?(r[0]=r[0].toLowerCase(),r[1]=r[1].toUpperCase(),t.indexOf(r[1].toLowerCase())>-1&&(r[1]=ip(r[1].toLowerCase()))):3===r.length&&(r[0]=r[0].toLowerCase(),2===r[1].length&&(r[1]=r[1].toUpperCase()),"sgn"!==r[0]&&2===r[2].length&&(r[2]=r[2].toUpperCase()),t.indexOf(r[1].toLowerCase())>-1&&(r[1]=ip(r[1].toLowerCase())),t.indexOf(r[2].toLowerCase())>-1&&(r[2]=ip(r[2].toLowerCase()))),r.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,r=this;return e?(e.forEach((function(e){if(!t){var i=r.formatLanguageCode(e);r.options.supportedLngs&&!r.isSupportedCode(i)||(t=i)}})),!t&&this.options.supportedLngs&&e.forEach((function(e){if(!t){var i=r.getLanguagePartFromCode(e);if(r.isSupportedCode(i))return t=i;t=r.options.supportedLngs.find((function(e){if(0===e.indexOf(i))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 r=e[t];return r||(r=e[this.getScriptPartFromCode(t)]),r||(r=e[this.formatLanguageCode(t)]),r||(r=e[this.getLanguagePartFromCode(t)]),r||(r=e.default),r||[]}},{key:"toResolveHierarchy",value:function(e,t){var r=this,i=this.getFallbackCodes(t||this.options.fallbackLng||[],e),s=[],n=function(e){e&&(r.isSupportedCode(e)?s.push(e):r.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)),i.forEach((function(e){s.indexOf(e)<0&&n(r.formatLanguageCode(e))})),s}}]),e}(),np=[{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}],ap={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 op=function(){function e(t){var r,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Mc(this,e),this.languageUtils=t,this.options=i,this.logger=Uc.create("pluralResolver"),this.rules=(r={},np.forEach((function(e){e.lngs.forEach((function(t){r[t]={numbers:e.nr,plurals:ap[e.fc]}}))})),r)}return Ic(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,r=this.getRule(e);return r?r.numbers.map((function(r){return t.getSuffix(e,r)})):[]}},{key:"getSuffix",value:function(e,t){var r=this,i=this.getRule(e);if(i){var s=i.noAbs?i.plurals(t):i.plurals(Math.abs(t)),n=i.numbers[s];this.options.simplifyPluralSuffix&&2===i.numbers.length&&1===i.numbers[0]&&(2===n?n="plural":1===n&&(n=""));var a=function(){return r.options.prepend&&n.toString()?r.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===i.numbers.length&&1===i.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}(),hp=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};Mc(this,e),this.logger=Uc.create("interpolator"),this.options=t,this.format=t.interpolation&&t.interpolation.format||function(e){return e},this.init(t)}return Ic(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:Kc,this.escapeValue=void 0===t.escapeValue||t.escapeValue,this.useRawValueToEscape=void 0!==t.useRawValueToEscape&&t.useRawValueToEscape,this.prefix=t.prefix?Yc(t.prefix):t.prefixEscaped||"{{",this.suffix=t.suffix?Yc(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?Yc(t.nestingPrefix):t.nestingPrefixEscaped||Yc("$t("),this.nestingSuffix=t.nestingSuffix?Yc(t.nestingSuffix):t.nestingSuffixEscaped||Yc(")"),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 r="".concat(this.nestingPrefix,"(.+?)").concat(this.nestingSuffix);this.nestingRegexp=new RegExp(r,"g")}},{key:"interpolate",value:function(e,t,r,i){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=Hc(t,h,e);return o.alwaysFormat?o.format(s,void 0,r):s}var n=e.split(o.formatSeparator),a=n.shift().trim(),u=n.join(o.formatSeparator).trim();return o.format(Hc(t,h,a),u,r,i)};this.resetRegExp();var c=i&&i.missingInterpolationHandler||this.options.missingInterpolationHandler,p=i&&i.interpolation&&i.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 r=c(e,s,i);n="string"==typeof r?r:""}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=jc(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 r,i,s=this,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},a=Tc({},n);function o(e,t){var r=this.nestingOptionsSeparator;if(e.indexOf(r)<0)return e;var i=e.split(new RegExp("".concat(r,"[ ]*{"))),s="{".concat(i[1]);e=i[0],s=(s=this.interpolate(s,a)).replace(/'/g,'"');try{a=JSON.parse(s),t&&(a=Tc({},t,a))}catch(t){return this.logger.warn("failed parsing options string in nesting for key ".concat(e),t),"".concat(e).concat(r).concat(s)}return delete a.defaultValue,e}for(a.applyPostProcessor=!1,delete a.defaultValue;r=this.nestingRegexp.exec(e);){var h=[],u=!1;if(r[0].includes(this.formatSeparator)&&!/{.*}/.test(r[1])){var l=r[1].split(this.formatSeparator).map((function(e){return e.trim()}));r[1]=l.shift(),h=l,u=!0}if((i=t(o.call(this,r[1].trim(),a),a))&&r[0]===e&&"string"!=typeof i)return i;"string"!=typeof i&&(i=jc(i)),i||(this.logger.warn("missed to resolve ".concat(r[1]," for nesting ").concat(e)),i=""),u&&(i=h.reduce((function(e,t){return s.format(e,t,n.lng,n)}),i.trim())),e=e.replace(r[0],i),this.regexp.lastIndex=0}return e}}]),e}();var up=function(e){function t(e,r,i){var s,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return Mc(this,t),s=Lc(this,Pc(t).call(this)),Jc&&Gc.call(Bc(s)),s.backend=e,s.store=r,s.services=i,s.languageUtils=i.languageUtils,s.options=n,s.logger=Uc.create("backendConnector"),s.state={},s.queue=[],s.backend&&s.backend.init&&s.backend.init(i,n.backend,n),s}return Nc(t,e),Ic(t,[{key:"queueLoad",value:function(e,t,r,i){var s=this,n=[],a=[],o=[],h=[];return e.forEach((function(e){var i=!0;t.forEach((function(t){var o="".concat(e,"|").concat(t);!r.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,i=!1,a.indexOf(o)<0&&a.push(o),n.indexOf(o)<0&&n.push(o),h.indexOf(t)<0&&h.push(t)))})),i||o.push(e)})),(n.length||a.length)&&this.queue.push({pending:a,loaded:{},errors:[],callback:i}),{toLoad:n,pending:a,toLoadLanguages:o,toLoadNamespaces:h}}},{key:"loaded",value:function(e,t,r){var i=e.split("|"),s=i[0],n=i[1];t&&this.emit("failedLoading",s,n,t),r&&this.store.addResourceBundle(s,n,r),this.state[e]=t?-1:2;var a={};this.queue.forEach((function(r){!function(e,t,r){var i=$c(e,t,Object),s=i.obj,n=i.k;s[n]=s[n]||[],s[n].push(r)}(r.loaded,[s],n),function(e,t){for(var r=e.indexOf(t);-1!==r;)e.splice(r,1),r=e.indexOf(t)}(r.pending,e),t&&r.errors.push(t),0!==r.pending.length||r.done||(Object.keys(r.loaded).forEach((function(e){a[e]||(a[e]=[]),r.loaded[e].length&&r.loaded[e].forEach((function(t){a[e].indexOf(t)<0&&a[e].push(t)}))})),r.done=!0,r.errors.length?r.callback(r.errors):r.callback())})),this.emit("loaded",a),this.queue=this.queue.filter((function(e){return!e.done}))}},{key:"read",value:function(e,t,r){var i=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[r](e,t,(function(o,h){o&&h&&s<5?setTimeout((function(){i.read.call(i,e,t,r,s+1,2*n,a)}),n):a(o,h)})):a(null,{})}},{key:"prepareLoading",value:function(e,t){var r=this,i=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,i,s);if(!n.toLoad.length)return n.pending.length||s(),null;n.toLoad.forEach((function(e){r.loadOne(e)}))}},{key:"load",value:function(e,t,r){this.prepareLoading(e,t,{},r)}},{key:"reload",value:function(e,t,r){this.prepareLoading(e,t,{reload:!0},r)}},{key:"loadOne",value:function(e){var t=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",i=e.split("|"),s=i[0],n=i[1];this.read(s,n,"read",void 0,void 0,(function(i,a){i&&t.logger.warn("".concat(r,"loading namespace ").concat(n," for language ").concat(s," failed"),i),!i&&a&&t.logger.log("".concat(r,"loaded namespace ").concat(n," for language ").concat(s),a),t.loaded(e,i,a)}))}},{key:"saveMissing",value:function(e,t,r,i,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(r,'" 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!=r&&""!==r&&(this.backend&&this.backend.create&&this.backend.create(e,t,r,i,null,Tc({},n,{isUpdate:s})),e&&e[0]&&this.store.addResource(e[0],t,r,i))}}]),t}(Gc);function lp(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 cp(){}var pp=function(e){function t(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=arguments.length>1?arguments[1]:void 0;if(Mc(this,t),e=Lc(this,Pc(t).call(this)),Jc&&Gc.call(Bc(e)),e.options=lp(r),e.services={},e.logger=Uc,e.modules={external:[]},i&&!e.isInitialized&&!r.isClone){if(!e.options.initImmediate)return e.init(r,i),Lc(e,Bc(e));setTimeout((function(){e.init(r,i)}),0)}return e}return Nc(t,e),Ic(t,[{key:"init",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=arguments.length>1?arguments[1]:void 0;function i(e){return e?"function"==typeof e?new e:e:null}if("function"==typeof t&&(r=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=Tc({},{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"===Ac(e[1])&&(t=e[1]),"string"==typeof e[1]&&(t.defaultValue=e[1]),"string"==typeof e[2]&&(t.tDescription=e[2]),"object"===Ac(e[2])||"object"===Ac(e[3])){var r=e[3]||e[2];Object.keys(r).forEach((function(e){t[e]=r[e]}))}return t},interpolation:{escapeValue:!0,format:function(e,t,r,i){return e},prefix:"{{",suffix:"}}",formatSeparator:",",unescapePrefix:"-",nestingPrefix:"$t(",nestingSuffix:")",nestingOptionsSeparator:",",maxReplaces:1e3,skipOnVariables:!1}},this.options,lp(t)),this.format=this.options.interpolation.format,r||(r=cp),!this.options.isClone){this.modules.logger?Uc.init(i(this.modules.logger),this.options):Uc.init(null,this.options);var s=new sp(this.options);this.store=new Qc(this.options.resources,this.options);var n=this.services;n.logger=Uc,n.resourceStore=this.store,n.languageUtils=s,n.pluralResolver=new op(s,{prepend:this.options.pluralSeparator,compatibilityJSON:this.options.compatibilityJSON,simplifyPluralSuffix:this.options.simplifyPluralSuffix}),n.interpolator=new hp(this.options),n.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},n.backendConnector=new up(i(this.modules.backend),n.resourceStore,n,this.options),n.backendConnector.on("*",(function(t){for(var r=arguments.length,i=new Array(r>1?r-1:0),s=1;s<r;s++)i[s-1]=arguments[s];e.emit.apply(e,[t].concat(i))})),this.modules.languageDetector&&(n.languageDetector=i(this.modules.languageDetector),n.languageDetector.init(n,this.options.detection,this.options)),this.modules.i18nFormat&&(n.i18nFormat=i(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 r=arguments.length,i=new Array(r>1?r-1:0),s=1;s<r;s++)i[s-1]=arguments[s];e.emit.apply(e,[t].concat(i))})),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 r;return(r=e.store)[t].apply(r,arguments)}}));["addResource","addResources","addResourceBundle","removeResourceBundle"].forEach((function(t){e[t]=function(){var r;return(r=e.store)[t].apply(r,arguments),e}}));var o=zc(),h=function(){var t=function(t,i){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(i),r(t,i)};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,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:cp,i="string"==typeof e?e:this.language;if("function"==typeof e&&(r=e),!this.options.resources||this.options.partialBundledLanguages){if(i&&"cimode"===i.toLowerCase())return r();var s=[],n=function(e){e&&t.services.languageUtils.toResolveHierarchy(e).forEach((function(e){s.indexOf(e)<0&&s.push(e)}))};if(i)n(i);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,r)}else r(null)}},{key:"reloadResources",value:function(e,t,r){var i=zc();return e||(e=this.languages),t||(t=this.options.ns),r||(r=cp),this.services.backendConnector.reload(e,t,(function(e){i.resolve(),r(e)})),i}},{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&&ep.addPostProcessor(e),"3rdParty"===e.type&&this.modules.external.push(e),this}},{key:"changeLanguage",value:function(e,t){var r=this;this.isLanguageChangingTo=e;var i=zc();this.emit("languageChanging",e);var s=function(e){var s="string"==typeof e?e:r.services.languageUtils.getBestMatchFromCodes(e);s&&(r.language||(r.language=s,r.languages=r.services.languageUtils.toResolveHierarchy(s)),r.translator.language||r.translator.changeLanguage(s),r.services.languageDetector&&r.services.languageDetector.cacheUserLanguage(s)),r.loadResources(s,(function(e){!function(e,s){s?(r.language=s,r.languages=r.services.languageUtils.toResolveHierarchy(s),r.translator.changeLanguage(s),r.isLanguageChangingTo=void 0,r.emit("languageChanged",s),r.logger.log("languageChanged",s)):r.isLanguageChangingTo=void 0,i.resolve((function(){return r.t.apply(r,arguments)})),t&&t(e,(function(){return r.t.apply(r,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()),i}},{key:"getFixedT",value:function(e,t){var r=this,i=function e(t,i){var s;if("object"!==Ac(i)){for(var n=arguments.length,a=new Array(n>2?n-2:0),o=2;o<n;o++)a[o-2]=arguments[o];s=r.options.overloadTranslationOptionHandler([t,i].concat(a))}else s=Tc({},i);return s.lng=s.lng||e.lng,s.lngs=s.lngs||e.lngs,s.ns=s.ns||e.ns,r.t(t,s)};return"string"==typeof e?i.lng=e:i.lngs=e,i.ns=t,i}},{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,r=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 i=this.languages[0],s=!!this.options&&this.options.fallbackLng,n=this.languages[this.languages.length-1];if("cimode"===i.toLowerCase())return!0;var a=function(e,r){var i=t.services.backendConnector.state["".concat(e,"|").concat(r)];return-1===i||2===i};if(r.precheck){var o=r.precheck(this,a);if(void 0!==o)return o}return!!this.hasResourceBundle(i,e)||(!this.services.backendConnector.backend||!(!a(i,e)||s&&!a(n,e)))}},{key:"loadNamespaces",value:function(e,t){var r=this,i=zc();return this.options.ns?("string"==typeof e&&(e=[e]),e.forEach((function(e){r.options.ns.indexOf(e)<0&&r.options.ns.push(e)})),this.loadResources((function(e){i.resolve(),t&&t(e)})),i):(t&&t(),Promise.resolve())}},{key:"loadLanguages",value:function(e,t){var r=zc();"string"==typeof e&&(e=[e]);var i=this.options.preload||[],s=e.filter((function(e){return i.indexOf(e)<0}));return s.length?(this.options.preload=i.concat(s),this.loadResources((function(e){r.resolve(),t&&t(e)})),r):(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,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:cp,s=Tc({},this.options,r,{isClone:!0}),n=new t(s);return["store","services","language"].forEach((function(t){n[t]=e[t]})),n.services=Tc({},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,r=new Array(t>1?t-1:0),i=1;i<t;i++)r[i-1]=arguments[i];n.emit.apply(n,[e].concat(r))})),n.init(s,i),n.translator.options=n.options,n.translator.backendConnector.services.utils={hasLoadedNamespace:n.hasLoadedNamespace.bind(n)},n}}]),t}(Gc),dp=(new pp,[]),fp=dp.forEach,gp=dp.slice;var mp,yp=function(e,t,r,i){var s,n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{path:"/"};if(r){var a=new Date;a.setTime(a.getTime()+60*r*1e3),s="; expires="+a.toUTCString()}else s="";i=i?"domain="+i+";":"",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+";"+i+n},xp=function(e){for(var t=e+"=",r=document.cookie.split(";"),i=0;i<r.length;i++){for(var s=r[i];" "===s.charAt(0);)s=s.substring(1,s.length);if(0===s.indexOf(t))return s.substring(t.length,s.length)}return null},vp={name:"cookie",lookup:function(e){var t;if(e.lookupCookie&&"undefined"!=typeof document){var r=xp(e.lookupCookie);r&&(t=r)}return t},cacheUserLanguage:function(e,t){t.lookupCookie&&"undefined"!=typeof document&&yp(t.lookupCookie,e,t.cookieMinutes,t.cookieDomain,t.cookieOptions)}},bp={name:"querystring",lookup:function(e){var t;if("undefined"!=typeof window)for(var r=window.location.search.substring(1).split("&"),i=0;i<r.length;i++){var s=r[i].indexOf("=");if(s>0)r[i].substring(0,s)===e.lookupQuerystring&&(t=r[i].substring(s+1))}return t}};try{mp="undefined"!==window&&null!==window.localStorage;var _p="i18next.translate.boo";window.localStorage.setItem(_p,"foo"),window.localStorage.removeItem(_p)}catch(e){mp=!1}var wp,Cp={name:"localStorage",lookup:function(e){var t;if(e.lookupLocalStorage&&mp){var r=window.localStorage.getItem(e.lookupLocalStorage);r&&(t=r)}return t},cacheUserLanguage:function(e,t){t.lookupLocalStorage&&mp&&window.localStorage.setItem(t.lookupLocalStorage,e)}};try{wp="undefined"!==window&&null!==window.sessionStorage;var Dp="i18next.translate.boo";window.sessionStorage.setItem(Dp,"foo"),window.sessionStorage.removeItem(Dp)}catch(e){wp=!1}var Ep={name:"sessionStorage",lookup:function(e){var t;if(e.lookupsessionStorage&&wp){var r=window.sessionStorage.getItem(e.lookupsessionStorage);r&&(t=r)}return t},cacheUserLanguage:function(e,t){t.lookupsessionStorage&&wp&&window.sessionStorage.setItem(t.lookupsessionStorage,e)}},Ap={name:"navigator",lookup:function(e){var t=[];if("undefined"!=typeof navigator){if(navigator.languages)for(var r=0;r<navigator.languages.length;r++)t.push(navigator.languages[r]);navigator.userLanguage&&t.push(navigator.userLanguage),navigator.language&&t.push(navigator.language)}return t.length>0?t:void 0}},Sp={name:"htmlTag",lookup:function(e){var t,r=e.htmlTag||("undefined"!=typeof document?document.documentElement:null);return r&&"function"==typeof r.getAttribute&&(t=r.getAttribute("lang")),t}},Fp={name:"path",lookup:function(e){var t;if("undefined"!=typeof window){var r=window.location.pathname.match(/\/([a-zA-Z-]*)/g);if(r instanceof Array)if("number"==typeof e.lookupFromPathIndex){if("string"!=typeof r[e.lookupFromPathIndex])return;t=r[e.lookupFromPathIndex].replace("/","")}else t=r[0].replace("/","")}return t}},Tp={name:"subdomain",lookup:function(e){var t;if("undefined"!=typeof window){var r=window.location.href.match(/(?:http[s]*\:\/\/)*(.*?)\.(?=[^\/]*\..{2,5})/gi);r instanceof Array&&(t="number"==typeof e.lookupFromSubdomainIndex?r[e.lookupFromSubdomainIndex].replace("http://","").replace("https://","").replace(".",""):r[0].replace("http://","").replace("https://","").replace(".",""))}return t}};var Mp=function(){function e(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Mc(this,e),this.type="languageDetector",this.detectors={},this.init(t,r)}return Ic(e,[{key:"init",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};this.services=e,this.options=function(e){return fp.call(gp.call(arguments,1),(function(t){if(t)for(var r in t)void 0===e[r]&&(e[r]=t[r])})),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=r,this.addDetector(vp),this.addDetector(bp),this.addDetector(Cp),this.addDetector(Ep),this.addDetector(Ap),this.addDetector(Sp),this.addDetector(Fp),this.addDetector(Tp)}},{key:"addDetector",value:function(e){this.detectors[e.name]=e}},{key:"detect",value:function(e){var t=this;e||(e=this.options.order);var r,i=[];if(e.forEach((function(e){if(t.detectors[e]){var r=t.detectors[e].lookup(t.options);r&&"string"==typeof r&&(r=[r]),r&&(i=i.concat(r))}})),i.forEach((function(e){if(!r){var i=t.services.languageUtils.formatLanguageCode(e);t.options.checkWhitelist&&!t.services.languageUtils.isWhitelisted(i)||(r=i),!r&&t.options.checkForSimilarInWhitelist&&(r=t.getSimilarInWhitelist(i))}})),!r){var s=this.i18nOptions.fallbackLng;"string"==typeof s&&(s=[s]),s||(s=[]),r="[object Array]"===Object.prototype.toString.apply(s)?s[0]:s[0]||s.default&&s.default[0]}return r}},{key:"cacheUserLanguage",value:function(e,t){var r=this;t||(t=this.options.caches),t&&(this.options.excludeCacheFor&&this.options.excludeCacheFor.indexOf(e)>-1||t.forEach((function(t){r.detectors[t]&&r.detectors[t].cacheUserLanguage(e,r.options)})))}},{key:"getSimilarInWhitelist",value:function(e){var t=this;if(this.i18nOptions.whitelist){if(e.includes("-")){var r=e.split("-")[0],i=this.services.languageUtils.formatLanguageCode(r);if(this.services.languageUtils.isWhitelisted(i))return i;e=i}var s=this.i18nOptions.whitelist.find((function(r){var i=t.services.languageUtils.formatLanguageCode(r);if(i.startsWith(e))return i}));return s||void 0}}}]),e}();Mp.type="languageDetector";var kp={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 Ip=["en","es","ko","zh","hi","ja"];class Bp{constructor(e,t){this.init(e,t)}fetchWithTimeout(e,t,r=2e3){return Promise.race([fetch(e,t),new Promise(((e,t)=>setTimeout((()=>t(new Error("timeout"))),r)))])}init(e,t={}){this.services=e,this.options=t}read(e,t,r){const i=this.options.loadPath;if(e===this.options.fallback)r(null,kp[e][t]);else if(Ip.includes(e)){const s=this.services.interpolator.interpolate(i,{lng:e,ns:t});this.loadUrl(s,r)}else r("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)}}Bp.type="backend";const Lp=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(Di),e.registerAddon(di),e.registerAddon(Ts)}(Ca),function(e){e.registerAddon(Ma)}(Ca),function(e){e.registerAddon(ka),e.registerAddon(ki),e.registerAddon(_s),e.registerAddon(Ti)}(Ca),function(e){e.registerAddon(Ia),e.registerAddon(Ba),e.registerAddon(La)}(Ca),function(e){e.registerAddon(ks),e.registerAddon(sn),e.registerAddon(qi),e.registerAddon(nn),e.registerAddon(En),e.registerAddon(ca)}(Ca),function(e){e.registerAddon(Ns),e.registerAddon(Oa),e.registerAddon(Ra),e.registerAddon(Si)}(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},Ph.prototype._getFontInfo=function(e){this._fontInfos=this._fontInfos||{};const t=JSON.stringify(e);if(this._fontInfos[t])return this._fontInfos[t];{const r=new s(this,{axs:e});return this._fontInfos[t]=r,r}};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 r,i;for(let s=this.infos.length-1;s>=0;--s){const n=this.infos[s];if(n.index+e<t){r=n,i=n.imageData;break}}if(!r){try{i=new ImageData(this.width,this.height)}catch(e){let t=document.getElementsByTagName("canvas")[0];const r=!t;t||(t=document.createElement("canvas"),t.style.display="none",document.body.appendChild(t));const s=t.getContext("2d");s&&(i=s.createImageData(this.width,this.height)),r&&document.body.removeChild(t)}r={index:0,imageData:i},this.infos.push(r)}const s=r.index;return r.index+=e,i._dirty=!0,{imageData:i,index:s}}}function r(e,t,r,i,s){const n=e.imageData.data;let a=4*e.index++;n[a++]=t,n[a++]=r,n[a++]=i,n[a++]=s}const i=Math.sqrt(3);class s{constructor(e,{axs:r}={}){this.font=e,this.axs=r,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=Uh(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,r){const i=f.length;function s(e,t,r){for(let i=e.length;i-- >0;){const s=e[i];t>s&&(t=s),r<s&&(r=s)}return{min:t,max:r}}f.push(r);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(i);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(i)}function x(e){return function(e,t,r){return e<t?t:e>r?r:e}(255*e,0,255)}class v{constructor(e,t,r,i){this.p0=e,this.c0=t,this.c1=r,this.p1=i}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),r=je.lerp(this.c0,this.c1,e),i=je.lerp(t,r,e);this.c1=je.lerp(this.c1,this.p1,e),this.c0=je.lerp(r,this.c1,e);const s=je.lerp(i,this.c0,e),n=new v(this.p0,t,i,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),r=je.sub(je.sub(je.sub(this.p1,this.c1),e),je.mult(t,2)),i=[];let s=t.x*r.y-t.y*r.x;if(0!==s){let n=e.x*r.y-e.y*r.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 r=(-n+e)/(2*s);t>0&&t<1&&(i.push(this.split(t)),r=1-(1-r)/(1-t)),r>0&&r<1&&i.push(this.split(r))}}return i.push(this),i}}function b(e,t,r,s,n,a,o,h){const u=new v(new je(e,t),new je(r,s),new je(n,a),new je(o,h)).splitInflections(),l=[],c=30/i;for(let e of u){const t=[];let r;for(;r=c/e.quadError(),!(r>=.125);){const i=Math.pow(r,1/3),s=e.split(i),n=e.split(1-i/(1-i));l.push(s),t.push(e),e=n}r<1&&l.push(e.split(.5)),l.push(e),Array.prototype.push.apply(l,t.reverse())}return l}function _(e,t,r,i){y([e,r],[t,i],{x:e,y:t,cx:(e+r)/2,cy:(t+i)/2})}function w(e,t,r,i){return Math.abs(r-e)<1e-5&&Math.abs(i-t)<1e-5}let C,D,E,A;for(const e of p){const t=(e.x-a)/l,r=(e.y-h)/c;if(!w(C,D,t,r)){switch(e.type){case"M":E=t,A=r;break;case"L":_(C,D,t,r);break;case"Q":{const i=(e.x1-a)/l,s=(e.y1-h)/c;y([C,t,i],[D,r,s],{x:C,y:D,cx:i,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 i=b(C,D,(e.x1-a)/l,(e.y1-h)/c,(e.x2-a)/l,(e.y2-h)/c,t,r);for(let e=0;e<i.length;e++){const t=i[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=r}}const S=f.length,F=this.strokeImageInfos.findImage(S),T=F.index;for(let e=0;e<S;++e){const t=f[e];r(F,x(t.x),x(t.y),x(t.cx),x(t.cy))}function M(e,t,i){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=i.findImage(o);for(let t=0;t<s;++t){const i=e[t],s=i.length,a=h.index;r(n,a>>7,127&a,s>>7,127&s);for(let e=0;e<s;++e){const t=i[e]+T;r(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,r,i,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(i>=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:r,y:i},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.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 r=e.rowInfo,i=e.colInfo,s=[e.strokeImageInfo.imageData,r.cellImageInfo.imageData,r.dimImageInfo.imageData,i.cellImageInfo.imageData,i.dimImageInfo.imageData];for(const e of s)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",r.cellImageInfo.imageData),g.setUniform("uSamplerRows",r.dimImageInfo.imageData),g.setUniform("uSamplerColStrokes",i.cellImageInfo.imageData),g.setUniform("uSamplerCols",i.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),Ec(e,e.prototype)}(Ca),function(e){e.registerAddon(ro),e.registerAddon(Vh)}(Ca),Promise.all([new Promise(((e,t)=>{"complete"===document.readyState?e():window.addEventListener("load",e,!1)})),Lp]).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,r="2.0.3",i="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",re="soft-light",ie="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:ie,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:i,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:re,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:r,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,r,i){if(t instanceof e.Vector){const e=t;t=e.x,r=e.y,i=e.z}else if(Array.isArray(t)){const e=t;t=e[0],r=e[1],i=e[2]||1}return isNaN(r)?r=i=t:isNaN(i)&&(i=1),this._renderer.scale(t,r,i),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,r){return this._renderer.isP3D?this._renderer.translate(e,t,r):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 r=this._isGlobal?window:this;if("function"==typeof r.draw){void 0===r.setup&&r.scale(r._pixelDensity,r._pixelDensity);for(let e=0;e<t;e++){r.resetMatrix(),(this._accessibleOutputs.grid||this._accessibleOutputs.text)&&this._updateAccsOutput(),this._renderer.isP3D&&this._renderer._update(),this.frameCount=r.frameCount+1,await this._runLifecycleHook("predraw"),this._inUserDraw=!0;try{await r.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,r){return 0!==e&&(this.x=this.x%e),0!==t&&(this.y=this.y%t),0!==r&&(this.z=this.z%r),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 r=t.length;0===r?(this.dimensions=2,this._values=[0,0,0]):(this.dimensions=r,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,r){if(e instanceof je){if([e.x,e.y,e.z].every(Number.isFinite)){const t=parseFloat(e.x),r=parseFloat(e.y),i=parseFloat(e.z);return ze.call(this,t,r,i)}}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],r=Math.min(this.values.length,t.values.length);for(let e=0;e<r;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],r=Math.min(this.values.length,t.length);for(let e=0;e<r;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,r)=>e/t._values[r]))}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,r)=>e/t[r]))}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,r)=>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,r,i)=>t+r*(e[i]||0)),0)}cross(e){const t=this.y*e.z-this.z*e.y,r=this.z*e.x-this.x*e.z,i=this.x*e.y-this.y*e.x;return this.isPInst?new je(this._fromRadians,this._toRadians,t,r,i):new je(t,r,i)}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 r=this.mag();return this.x=Math.cos(t)*r,this.y=Math.sin(t)*r,this}angleBetween(e){if(0===this.magSq()*e.magSq())return NaN;const t=this.cross(e);let r=Math.atan2(t.mag(),this.dot(e))*Math.sign(t.z||1);return this.isPInst&&(r=this._fromRadians(r)),r}lerp(e,t,r,i){return e instanceof je?this.lerp(e.x,e.y,e.z,t):(this.x+=(e-this.x)*i||0,this.y+=(t-this.y)*i||0,this.z+=(r-this.z)*i||0,this)}slerp(e,t){if(0===t)return this;if(1===t)return this.set(e);const r=this.mag(),i=e.mag();if(0===r*i)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*i/r,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,r){void 0===r&&(r=1);const i=Math.cos(t),s=Math.sin(t),n=Math.cos(e),a=Math.sin(e);return new je(r*a*s,-r*n,r*a*i)}static random2D(){return this.fromAngle(Math.random()*x)}static random3D(){const e=Math.random()*x,t=2*Math.random()-1,r=Math.sqrt(1-t*t),i=r*Math.cos(e),s=r*Math.sin(e);return new je(i,s,t)}static copy(e){return e.copy(e)}static add(e,t,r){return r?r.set(e):(r=e.copy(),3===arguments.length&&p5._friendlyError("The target parameter is undefined, it should be of type p5.Vector","p5.Vector.add")),r.add(t),r}static rem(e,t){if(e instanceof je&&t instanceof je){let r=e.copy();return r.rem(t),r}}static sub(e,t,r){return r?r.set(e):(r=e.copy(),3===arguments.length&&p5._friendlyError("The target parameter is undefined, it should be of type p5.Vector","p5.Vector.sub")),r.sub(t),r}static mult(e,t,r){return r?r.set(e):(r=e.copy(),3===arguments.length&&p5._friendlyError("The target parameter is undefined, it should be of type p5.Vector","p5.Vector.mult")),r.mult(t),r}static rotate(e,t,r){return 2===arguments.length?r=e.copy():(r instanceof je||p5._friendlyError("The target parameter should be of type p5.Vector","p5.Vector.rotate"),r.set(e)),r.rotate(t),r}static div(e,t,r){return r?r.set(e):(r=e.copy(),3===arguments.length&&p5._friendlyError("The target parameter is undefined, it should be of type p5.Vector","p5.Vector.div")),r.div(t),r}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,r,i){return i?i.set(e):(i=e.copy(),4===arguments.length&&p5._friendlyError("The target parameter is undefined, it should be of type p5.Vector","p5.Vector.lerp")),i.lerp(t,r),i}static slerp(e,t,r,i){return i?i.set(e):(i=e.copy(),4===arguments.length&&p5._friendlyError("The target parameter is undefined, it should be of type p5.Vector","p5.Vector.slerp")),i.slerp(t,r),i}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,r){return arguments.length<3?r=e.copy():(r instanceof je||p5._friendlyError("The target parameter should be of type p5.Vector","p5.Vector.limit"),r.set(e)),r.limit(t)}static setMag(e,t,r){return arguments.length<3?r=e.copy():(r instanceof je||p5._friendlyError("The target parameter should be of type p5.Vector","p5.Vector.setMag"),r.set(e)),r.setMag(t)}static heading(e){return e.heading()}static angleBetween(e,t){return e.angleBetween(t)}static reflect(e,t,r){return arguments.length<3?r=e.copy():(r instanceof je||p5._friendlyError("The target parameter should be of type p5.Vector","p5.Vector.reflect"),r.set(e)),r.reflect(t)}static array(e){return e.array()}static equals(e,t){let r;return e instanceof je?r=e:e instanceof Array?r=(new je).set(e):p5._friendlyError("The v1 parameter should be of type Array or p5.Vector","p5.Vector.equals"),r.equals(t)}}function $e(e,t){e.Vector=je}function We(e,t){const r=[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,i){let s="auto";const n=this._curElement.elt;if(r.includes(e))s=e;else if("string"==typeof e){let r="";t&&i&&"number"==typeof t&&"number"==typeof i&&(r=`${t} ${i}`),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}) ${r}, 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=i,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 r;"function"==typeof t.windowResized&&(r=t.windowResized(e),void 0===r||r||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 r={};for(;null!=(t=e.exec(location.search));)t.index===e.lastIndex&&e.lastIndex++,r[t[1]]=t[2];return r},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 r=t.mat4[14]/t.mat4[15];e=this.createVector(e.x,e.y,r)}return t.invert(t).multiplyAndNormalizePoint(e)}}function qe(e,t){let r=e.length;Array.isArray(e[0])||(e=[e]),Array.isArray(t[0])||(t=t.map((e=>[e])));let i=t[0].length,s=t[0].map(((e,r)=>t.map((e=>e[r])))),n=e.map((e=>s.map((t=>{let r=0;if(!Array.isArray(e)){for(let i of t)r+=e*i;return r}for(let i=0;i<e.length;i++)r+=e[i]*(t[i]||0);return r}))));return 1===r&&(n=n[0]),1===i?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:r}){return Ze(e)?"none":function(e,t){if(0===e)return 0;let r=~~e,i=0;r&&t&&(i=1+~~Math.log10(Math.abs(r)));const s=10**(t-i);return Math.floor(e*s+.5)/s}(e,t)+(r??"")}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,r){return isNaN(e)?t:isNaN(t)?e:e+(t-e)*r}function et(e,t,r){return Qe(t[0],t[1],function(e,t,r){return(r-e)/(t-e)}(e[0],e[1],r))}function tt(e,t){return Math.sign(e)===Math.sign(t)?e:-e}function rt(e,t){return tt(Math.abs(e)**t,e)}function it(e,t){return 0===t?0:e/t}const st=new class{add(e,t,r){if("string"==typeof arguments[0])(Array.isArray(e)?e:[e]).forEach((function(e){this[e]=this[e]||[],t&&this[e][r?"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,r,i={}){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 r;let s={W1:e,W2:t,XYZ:r,options:i};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,r,i){let s=Object.entries(e.coords).map((([e,s],n)=>{let a,o=t.coordGrammar[n],h=i[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 ${r}()`)}let l=a.range;"<percentage>"===u&&(l||=[0,1]);let c=s.range||s.refRange;return l&&c&&(i[n]=et(l,c,i[n])),a}));return s}function ct(e,{meta:t}={}){let r={str:String(e)?.trim()};if(st.run("parse-start",r),r.color)return r.color;if(r.parsed=function(e){if(!e)return;e=e.trim();const t=/^-?[\d.]+$/,r=/%|deg|g?rad|turn$/,i=/\/?\s*(none|[-\w.]+(?:%|deg|g?rad|turn)?)/g;let s=e.match(/^([a-z]+)\((.+?)\)$/i);if(s){let e=[];return s[2].replace(i,((i,s)=>{let n=s.match(r),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);i.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}}}(r.str),r.parsed){let e=r.parsed.name;if("color"===e){let e=r.parsed.args.shift(),i=e.startsWith("--")?e.substring(2):`--${e}`,s=[e,i],n=r.parsed.rawArgs.indexOf("/")>0?r.parsed.args.pop():1;for(let i of dt.all){let a=i.getFormat("color");if(a&&(s.includes(a.id)||a.ids?.filter((e=>s.includes(e))).length)){const s=Object.keys(i.coords).map(((e,t)=>r.parsed.args[t]||0));let o;return a.coordGrammar&&(o=lt(i,a,"color",s)),t&&Object.assign(t,{formatId:"color",types:o}),a.id.startsWith("--")&&!e.startsWith("--")&&ht.warn(`${i.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(`${i.name} is a standard space and supported in the CSS spec. Use color(${a.id}) instead of prefixed color(${e}).`),{spaceId:i.id,coords:s,alpha:n}}}let a="",o=e in dt.registry?e:i;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 i of dt.all){let s=i.getFormat(e);if(s&&"function"===s.type){let n=1;(s.lastAlpha||Je(r.parsed.args).alpha)&&(n=r.parsed.args.pop());let a,o=r.parsed.args;return s.coordGrammar&&(a=lt(i,s,e,o)),t&&Object.assign(t,{formatId:s.name,types:a}),{spaceId:i.id,coords:o,alpha:n}}}}else for(let e of dt.all)for(let i in e.formats){let s=e.formats[i];if("custom"!==s.type)continue;if(s.test&&!s.test(r.str))continue;let n=s.parse(r.str);if(n)return n.alpha??=1,t&&(t.formatId=i),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 r=e.white??this.base.white??"D65";this.white=at(r),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 r=Object.values(this.coords);return e.every(((e,i)=>{let s=r[i];if("angle"!==s.type&&s.range){if(Number.isNaN(e))return!0;let[r,i]=s.range;return(void 0===r||e>=r-t)&&(void 0===i||e<=i+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 r=pt(e);[e,t]=[r.space,r.coords]}if(e=dt.get(e),this.equals(e))return t;t=t.map((e=>Number.isNaN(e)?0:e));let r,i,s=this.path,n=e.path;for(let e=0;e<s.length&&s[e].equals(n[e]);e++)r=s[e],i=e;if(!r)throw new Error(`Cannot convert between color spaces ${this} and ${e}: no connection space was found`);for(let e=s.length-1;e>i;e--)t=s[e].toBase(t);for(let e=i+1;e<n.length;e++)t=n[e].fromBase(t);return t}from(e,t){if(1===arguments.length){const r=pt(e);[e,t]=[r.space,r.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 r=this.coords[t],i=r.range||r.refRange;e.push(i?.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 r,i,s=Xe(e);if("string"===s?e.includes(".")?[r,i]=e.split("."):[r,i]=[,e]:Array.isArray(e)?[r,i]=e:(r=e.space,i=e.coordId),r=dt.get(r),r||(r=t),!r)throw new TypeError(`Cannot resolve coordinate reference ${e}: No color space specified and relative references are not allowed here`);if(s=Xe(i),"number"===s||"string"===s&&i>=0){let e=Object.entries(r.coords)[i];if(e)return{space:r,id:e[0],index:i,...e[1]}}r=dt.get(r);let n=i.toLowerCase(),a=0;for(let e in r.coords){let t=r.coords[e];if(e.toLowerCase()===n||t.name?.toLowerCase()===n)return{space:r,id:e,index:a,...t};a++}throw new TypeError(`No "${i}" coordinate found in ${r.name}. Its coordinates are: ${Object.keys(r.coords).join(", ")}`)}static DEFAULT_FORMAT={type:"functions",name:"color"}}function ft(e){let t=[e];for(let r=e;r=r.base;)t.push(r);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 r=Object.entries(t).map((([t,r],i)=>{let s=e.coordGrammar[i][0],n=r.range||r.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,i)=>{let{fromRange:s,toRange:n,suffix:a}=r[i];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 r=qe(e.toXYZ_M,t);return this.white!==this.base.white&&(r=ot(this.white,this.base.white,r)),r},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:r,index:i}=dt.resolveCoord(t,e.space);return xt(e,r)[i]}function bt(e,t,r){return e=pt(e),t=dt.get(t),e.coords=t.to(e.space,r),e}function _t(e,t,r){if(e=pt(e),2===arguments.length&&"object"===Xe(arguments[1])){let t=arguments[1];for(let r in t)_t(e,r,t[r])}else{"function"==typeof r&&(r=r(vt(e,t)));let{space:i,index:s}=dt.resolveCoord(t,e.space),n=xt(e,i);n[s]=r,bt(e,i,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])),r=t.map((e=>e>Ct?Math.cbrt(e):(Et*e+16)/116));return[116*r[1]-16,500*(r[0]-r[1]),200*(r[1]-r[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,[r,i,s]=e;return t=Math.abs(i)<.02&&Math.abs(s)<.02?NaN:180*Math.atan2(s,i)/Math.PI,[r,Math.sqrt(i**2+s**2),Ft(t)]},toBase(e){let[t,r,i]=e;return r<0&&(r=0),isNaN(i)&&(i=0),[t,r*Math.cos(i*Math.PI/180),r*Math.sin(i*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:r=1,kC:i=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/(r*B))**2;return V+=(C/(i*L))**2,V+=(F/(s*O))**2,V+=-1*Math.sin(2*N*Bt)*R*(C/(i*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[r,i,s]=Ut.from(e),[n,a,o]=Ut.from(t),h=r-n,u=i-a,l=s-o;return Math.sqrt(h**2+u**2+l**2)}function zt(e,t,{epsilon:r=75e-6}={}){e=pt(e),t||(t=e.space),t=dt.get(t);let i=e.coords;return t!==e.space&&(i=t.from(e)),t.inGamut(i,{epsilon:r})}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,er=32/(1.7*2523),tr=-.56,rr=16295499532821565e-27,ir=[[.41478972,.579999,.014648],[-.20151,1.120649,.0531008],[-.0166008,.2648,.6684799]],sr=[[1.9242264357876067,-1.0047923125953657,.037651404030618],[.35031676209499907,.7264811939316552,-.06538442294808501],[-.09098281098284752,-.3127282905230739,1.5227665613052603]],nr=[[.5,.5,0],[3.524,-4.066708,.542708],[.199076,1.096799,-1.295875]],ar=[[1,.1386050432715393,.05804731615611886],[.9999999999999999,-.1386050432715393,-.05804731615611886],[.9999999999999998,-.09601924202631895,-.8118918960560388]];var or=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,r,i]=e,s=qe(ir,[qt*t-(qt-1)*i,Ht*r-(Ht-1)*t,i]).map((function(e){return((Zt+Kt*(e/1e4)**Xt)/(1+Jt*(e/1e4)**Xt))**Qt})),[n,a,o]=qe(nr,s);return[(1+tr)*n/(1+tr*n)-rr,a,o]},toBase(e){let[t,r,i]=e,s=qe(ar,[(t+rr)/(1+tr-tr*(t+rr)),r,i]).map((function(e){return 1e4*((Zt-e**er)/(Jt*e**er-Kt))**Yt})),[n,a,o]=qe(sr,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]"]}}}),hr=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:or,fromBase(e){let t,[r,i,s]=e;const n=2e-4;return t=Math.abs(i)<n&&Math.abs(s)<n?NaN:180*Math.atan2(s,i)/Math.PI,[r,Math.sqrt(i**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 ur=.8359375,lr=2413/128,cr=18.6875,pr=2610/16384,dr=2523/32,fr=16384/2610,gr=32/2523,mr=[[.3592832590121217,.6976051147779502,-.035891593232029],[-.1920808463704993,1.100476797037432,.0753748658519118],[.0070797844607479,.0748396662186362,.8433265453898765]],yr=[[.5,.5,0],[6610/4096,-13613/4096,7003/4096],[17933/4096,-17390/4096,-543/4096]],xr=[[.9999999999999998,.0086090370379328,.111029625003026],[.9999999999999998,-.0086090370379328,-.1110296250030259],[.9999999999999998,.5600313357106791,-.3206271749873188]],vr=[[2.0701522183894223,-1.3263473389671563,.2066510476294053],[.3647385209748072,.6805660249472273,-.0453045459220347],[-.0497472075358123,-.0492609666966131,1.1880659249923042]];var br=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((ur+lr*(e/1e4)**pr)/(1+cr*(e/1e4)**pr))**dr}));return qe(yr,t)}(qe(mr,e)),toBase(e){let t=function(e){let t=qe(xr,e),r=t.map((function(e){return 1e4*(Math.max(e**gr-ur,0)/(lr-cr*e**gr))**fr}));return r}(e);return qe(vr,t)}});const _r=nt.D65,wr=1/.42,Cr=2*Math.PI,Dr=[[.401288,.650173,-.051461],[-.250268,1.204414,.045854],[-.002079,.048952,.953127]],Er=[[1.8620678550872327,-1.0112546305316843,.14918677544445175],[.38752654323613717,.6214474419314753,-.008973985167612518],[-.015841498849333856,-.03412293802851557,1.0499644368778496]],Ar=[[460,451,288],[460,-891,-261],[460,-220,-6300]],Sr={dark:[.8,.525,.8],dim:[.9,.59,.9],average:[1,.69,1]},Fr={h:[20.14,90,164.25,237.53,380.14],e:[.8,.7,1,1.2,.8],H:[0,100,200,300,400]},Tr=180/Math.PI,Mr=Math.PI/180;function kr(e,t){return e.map((e=>{const r=rt(t*Math.abs(e)*.01,.42);return 400*tt(r,e)/(r+27.13)}))}function Ir(e,t,r,i,s){const n={};n.discounting=s,n.refWhite=e,n.surround=i;const a=e.map((e=>100*e));n.la=t,n.yb=r;const o=a[1],h=qe(Dr,a),u=(i=Sr[n.surround])[0];n.c=i[1],n.nc=i[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=kr(p,n.fl);return n.aW=n.nbb*(2*d[0]+d[1]+.05*d[2]),n}const Br=Ir(_r,64/Math.PI*.2,20,"average",!1);function Lr(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 r=0;r=void 0!==e.h?Ft(e.h)*Mr:function(e){let t=(e%400+400)%400;const r=Math.floor(.01*t);t%=100;const[i,s]=Fr.h.slice(r,r+2),[n,a]=Fr.e.slice(r,r+2);return Ft((t*(a*i-n*s)-100*i*a)/(t*(a-n)-100*a))}(e.H)*Mr;const i=Math.cos(r),s=Math.sin(r);let n=0;void 0!==e.J?n=.1*rt(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=rt(a*Math.pow(1.64-Math.pow(.29,t.n),-.73),10/9),h=.25*(Math.cos(r+2)+3.8),u=t.aW*rt(n,2/t.c/t.z),l=5e4/13*t.nc*t.ncb*h,c=u/t.nbb,p=23*(c+.305)*it(o,23*l+o*(11*i+108*s)),d=function(e,t){const r=100/t*2588.068098016295;return e.map((e=>{const t=Math.abs(e);return tt(r*rt(t/(400-t),wr),e)}))}(qe(Ar,[c,p*i,p*s]).map((e=>1*e/1403)),t.fl);return qe(Er,d.map(((e,r)=>e*t.dRgbInv[r]))).map((e=>e/100))}function Pr(e,t){const r=e.map((e=>100*e)),i=kr(qe(Dr,r).map(((e,r)=>e*t.dRgb[r])),t.fl),s=i[0]+(-12*i[1]+i[2])/11,n=(i[0]+i[1]-2*i[2])/9,a=(Math.atan2(n,s)%Cr+Cr)%Cr,o=.25*(Math.cos(a+2)+3.8),h=rt(5e4/13*t.nc*t.ncb*it(o*Math.sqrt(s**2+n**2),i[0]+i[1]+1.05*i[2]+.305),.9)*Math.pow(1.64-Math.pow(.29,t.n),.73),u=rt(t.nbb*(2*i[0]+i[1]+.05*i[2])/t.aW,.5*t.c*t.z),l=100*rt(u,2),c=4/t.c*u*(t.aW+4)*t.flRoot,p=h*u,d=p*t.flRoot,f=Ft(a*Tr),g=function(e){let t=Ft(e);t<=Fr.h[0]&&(t+=360);const r=function(e,t,r=0,i=e.length){for(;r<i;){const s=r+i>>1;e[s]<t?r=s+1:i=s}return r}(Fr.h,t)-1,[i,s]=Fr.h.slice(r,r+2),[n,a]=Fr.e.slice(r,r+2),o=(t-i)/n;return Fr.H[r]+100*o/(o+(s-t)/a)}(f);return{J:l,C:p,h:f,s:50*rt(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=Pr(e,Br);return[t.J,t.M,t.h]},toBase:e=>Lr({J:e[0],M:e[1],h:e[2]},Br)});const Or=216/24389,Nr=24389/27;function Rr(e){return e>8?Math.pow((e+16)/116,3):e/Nr}function Vr(e,t){const r=116*((i=e[1])>Or?Math.cbrt(i):(Nr*i+16)/116)-16;var i;if(0===r)return[0,0,0];const s=Pr(e,Ur);return[Ft(s.h),s.C,r]}const Ur=Ir(nt.D65,200/Math.PI*Rr(50),100*Rr(50),"average",!1);var Gr=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=>Vr(e),toBase:e=>function(e,t){let[r,i,s]=e,n=[],a=0;if(0===s)return[0,0,0];let o=Rr(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=Lr({J:a,C:i,h:r},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 Lr({J:a,C:i,h:r},t)}(e,Ur),formats:{color:{id:"--hct",coords:["<number> | <angle>","<percentage> | <number>","<percentage> | <number>"]}}});const zr=Math.PI/180,jr=[1,.007,.0228];function $r(e){e[1]<0&&(e=Gr.fromBase(Gr.toBase(e)));const t=Math.log(Math.max(1+jr[2]*e[1]*Ur.flRoot,1))/jr[2],r=e[0]*zr,i=t*Math.cos(r),s=t*Math.sin(r);return[e[2],i,s]}var Wr={deltaE76:function(e,t){return function(e,t,r="lab"){let i=(r=dt.get(r)).from(e),s=r.from(t);return Math.sqrt(i.reduce(((e,t,r)=>{let i=s[r];return isNaN(t)||isNaN(i)?e:e+(i-t)**2}),0))}(e,t,"lab")},deltaECMC:function(e,t,{l:r=2,c:i=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/(r*m))**2;return _+=(f/(i*x))**2,_+=g/(x*(b*y+1-b))**2,Math.sqrt(_)},deltaE2000:Pt,deltaEJz:function(e,t){[e,t]=pt([e,t]);let[r,i,s]=hr.from(e),[n,a,o]=hr.from(t),h=r-n,u=i-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(i*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[r,i,s]=br.from(e),[n,a,o]=br.from(t);return 720*Math.sqrt((r-n)**2+.25*(i-a)**2+(s-o)**2)},deltaEOK:Gt,deltaEHCT:function(e,t){[e,t]=pt([e,t]);let[r,i,s]=$r(Gr.from(e)),[n,a,o]=$r(Gr.from(t));return Math.sqrt((r-n)**2+(i-a)**2+(s-o)**2)}};const qr={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 Hr(e,{method:t=ht.gamut_mapping,space:r,deltaEMethod:i="",jnd:s=2,blackWhiteClamp:n={}}={}){if(e=pt(e),He(arguments[1])?r=arguments[1]:r||(r=e.space),zt(e,r=dt.get(r),{epsilon:0}))return e;let a;if("css"===t)a=function(e,{space:t}={}){const r=.02,i=1e-4;e=pt(e),t||(t=e.space);t=dt.get(t);const s=dt.get("oklch");if(t.isUnbounded)return Yr(e,t);const n=Yr(e,s);let a=n.coords[0];if(a>=1){const r=Yr(Xr.WHITE,t);return r.alpha=e.alpha,Yr(r,t)}if(a<=0){const r=Yr(Xr.BLACK,t);return r.alpha=e.alpha,Yr(r,t)}if(zt(n,t,{epsilon:0}))return Yr(n,t);function o(e){const r=Yr(e,t),i=Object.values(t.coords);return r.coords=r.coords.map(((e,t)=>{if("range"in i[t]){const[r,s]=i[t].range;return function(e,t,r){return Math.max(Math.min(r,t),e)}(r,e,s)}return e})),r}let h=0,u=n.coords[1],l=!0,c=jt(n),p=o(c),d=Gt(p,c);if(d<r)return p;for(;u-h>i;){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<r){if(r-d<i)break;l=!1,h=e}else u=e}return p}(e,{space:r});else{if("clip"===t||zt(e,r))a=Yr(e,r);else{Object.prototype.hasOwnProperty.call(qr,t)&&({method:t,jnd:s,deltaEMethod:i,blackWhiteClamp:n}=qr[t]);let o=Pt;if(""!==i)for(let e in Wr)if("deltae"+i.toLowerCase()===e.toLowerCase()){o=Wr[e];break}let h=Hr(Yr(e,r),{method:"clip",space:r});if(o(e,h)>s){if(3===Object.keys(n).length){let t=dt.resolveCoord(n.channel),r=vt(Yr(e,t.space),t.id);if(Ze(r)&&(r=0),r>=n.max)return Yr({space:"xyz-d65",coords:nt.D65},e.space);if(r<=n.min)return Yr({space:"xyz-d65",coords:[0,0,0]},e.space)}let i=dt.resolveCoord(t),h=i.space,u=i.id,l=Yr(e,h);l.coords.forEach(((e,t)=>{Ze(e)&&(l.coords[t]=0)}));let c=(i.range||i.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=Hr(e,{space:r,method:"clip"}),o(l,e)-s<p?d=vt(l,u):f=vt(l,u),_t(l,u,(d+f)/2)}a=Yr(l,r)}else a=h}if("clip"===t||!zt(a,r,{epsilon:0})){let e=Object.values(r.coords).map((e=>e.range||[]));a.coords=a.coords.map(((t,r)=>{let[i,s]=e[r];return void 0!==i&&(t=Math.max(i,t)),void 0!==s&&(t=Math.min(t,s)),t}))}}return r!==e.space&&(a=Yr(a,e.space)),e.coords=a.coords,e}Hr.returns="color";const Xr={WHITE:{space:Ut,coords:[1,0,0]},BLACK:{space:Ut,coords:[0,0,0]}};function Yr(e,t,{inGamut:r}={}){e=pt(e);let i=(t=dt.get(t)).from(e),s={space:t,coords:i,alpha:e.alpha};return r&&(s=Hr(s,!0===r?void 0:r)),s}Yr.returns="color";var Zr=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 Kr=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]]}),Jr={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 Qr=Array(3).fill("<percentage> | <number>[0, 255]"),ei=Array(3).fill("<number>[0, 255]");var ti=new yt({id:"srgb",name:"sRGB",base:Kr,fromBase:e=>e.map((e=>{let t=e<0?-1:1,r=e*t;return r>.0031308?t*(1.055*r**(1/2.4)-.055):12.92*e})),toBase:e=>e.map((e=>{let t=e<0?-1:1,r=e*t;return r<=.04045?e/12.92:t*((r+.055)/1.055)**2.4})),formats:{rgb:{coords:Qr},rgb_number:{name:"rgb",commas:!0,coords:ei,noAlpha:!0},color:{},rgba:{coords:Qr,commas:!0,lastAlpha:!0},rgba_number:{name:"rgba",commas:!0,coords:ei},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:r=!0}={})=>{t<1&&e.push(t),e=e.map((e=>Math.round(255*e)));let i=r&&e.every((e=>e%17==0));return"#"+e.map((e=>i?(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=Jr.black,t.alpha=0):t.coords=Jr[e],t.coords)return t}}}}),ri=new yt({id:"p3",cssId:"display-p3",name:"P3",base:Zr,fromBase:ti.fromBase,toBase:ti.toBase});function ii(e,t,r={}){if(function(e){return"function"===Xe(e)&&!!e.rangeArgs}(e)){let[r,i]=[e,t];return ii(...r.rangeArgs.colors,{...r.rangeArgs.options,...i})}let{space:i,outputSpace:s,progression:n,premultiplied:a}=r;e=pt(e),t=pt(t),e=jt(e),t=jt(t);let o={colors:[e,t],options:r};if(i=i?dt.get(i):dt.registry[ht.interpolationSpace]||e.space,s=s?dt.get(s):i,e=Yr(e,i),t=Yr(t,i),e=Hr(e),t=Hr(t),i.coords.h&&"angle"===i.coords.h.type){let s=r.hue=r.hue||"shorter",n=[i,"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[r,i]=t.map(Ft),s=i-r;return"increasing"===e?s<0&&(i+=360):"decreasing"===e?s>0&&(r+=360):"longer"===e?-180<s&&s<180&&(s>0?r+=360:i+=360):"shorter"===e&&(s>180?r+=360:s<-180&&(i+=360)),[r,i]}(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((r=>{r=n?n(r):r;let o=e.coords.map(((e,i)=>Qe(e,t.coords[i],r))),h=Qe(e.alpha,t.alpha,r),u={space:i,coords:o,alpha:h};return a&&(u.coords=u.coords.map((e=>e/h))),s!==i&&(u=Yr(u,s)),u}),{rangeArgs:o})}ht.interpolationSpace="lab";var si=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:ti,fromBase:e=>{let t=Math.max(...e),r=Math.min(...e),[i,s,n]=e,[a,o,h]=[NaN,0,(r+t)/2],u=t-r;if(0!==u){switch(o=0===h||1===h?0:(t-h)/Math.min(h,1-h),t){case i:a=(s-n)/u+(s<n?6:0);break;case s:a=(n-i)/u+2;break;case n:a=(i-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,r,i]=e;function s(e){let s=(e+t/30)%12,n=r*Math.min(i,1-i);return i-n*Math.max(-1,Math.min(s-3,9-s,1))}return t%=360,t<0&&(t+=360),r/=100,i/=100,[s(0),s(8),s(4)]},formats:{hsl:{coords:["<number> | <angle>","<percentage>","<percentage>"]},hsla:{coords:["<number> | <angle>","<percentage>","<percentage>"],commas:!0,lastAlpha:!0}}}),ni=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:si,fromBase(e){let[t,r,i]=e;r/=100,i/=100;let s=i+r*Math.min(i,1-i);return[t,0===s?0:200*(1-i/s),100*s]},toBase(e){let[t,r,i]=e;r/=100,i/=100;let s=i*(1-r/2);return[t,0===s||1===s?0:(i-s)/Math.min(s,1-s)*100,100*s]},formats:{color:{id:"--hsv",coords:["<number> | <angle>","<percentage> | <number>","<percentage> | <number>"]}}}),ai=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:ni,fromBase(e){let[t,r,i]=e;return[t,i*(100-r)/100,100-i]},toBase(e){let[t,r,i]=e;r/=100,i/=100;let s=r+i;if(s>=1){return[t,0,100*(r/s)]}let n=1-i;return[t,100*(0===n?0:1-r/n),100*n]},formats:{hwb:{coords:["<number> | <angle>","<percentage> | <number>","<percentage> | <number>"]}}}),oi=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,[r,i,s]=e;const n=2e-4;return t=Math.abs(i)<n&&Math.abs(s)<n?NaN:180*Math.atan2(s,i)/Math.PI,[r,Math.sqrt(i**2+s**2),Ft(t)]},toBase(e){let t,r,[i,s,n]=e;return isNaN(n)?(t=0,r=0):(t=s*Math.cos(n*Math.PI/180),r=s*Math.sin(n*Math.PI/180)),[i,t,r]},formats:{oklch:{coords:["<percentage> | <number>","<number> | <percentage>[0,1]","<number> | <angle>"]}}}),hi=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:ti,fromBase:e=>{const t=Math.max(...e),r=t-Math.min(...e);let i,s,[n,a,o]=e;return 0===r?(i=0,s=0):(s=r/t,n===t?i=(a-o)/r:a===t?i=2+(o-n)/r:o===t&&(i=4+(n-a)/r),i<0?i+=6:i>=6&&(i-=6)),[i/6*360,100*s,100*t]},toBase:ui,formats:{default:{type:"custom",serialize:(e,t)=>{const r=ui(e);let i=`rgb(${Math.round(100*r[0]*100)/100}% ${Math.round(100*r[1]*100)/100}% ${Math.round(100*r[2]*100)/100}%`;return t<1&&(i+=` / ${t}`),i+=")",i}},hsb:{coords:["<number> | <angle>","<percentage>","<percentage>"]},hsba:{coords:["<number> | <angle>","<percentage>","<percentage>"],commans:!0,lastAlpha:!0}}});function ui(e){const t=e[0]/360*6,r=e[1]/100,i=e[2]/100;let s=[];if(0===r)s=[i,i,i];else{const e=Math.floor(t),n=i*(1-r),a=i*(1-r*(t-e)),o=i*(1-r*(1+e-t));let h,u,l;1===e?(h=a,u=i,l=n):2===e?(h=n,u=i,l=o):3===e?(h=n,u=a,l=i):4===e?(h=o,u=n,l=i):5===e?(h=i,u=n,l=a):(h=i,u=o,l=n),s=[h,u,l]}return s}const li=(e,t,r,i,s,n)=>{let a=(e-t)/(r-t)*(s-i)+i;return n&&(a=Math.max(a,Math.min(i,s)),a=Math.min(a,Math.max(i,s))),a},ci={};class pi{_color;mode;static colorMap={};static#e={};static#t={};static addColorMode(e,t){dt.register(t),pi.colorMap[e]=t.id,pi.#e[e]=Object.values(t.coords).reduce(((e,t)=>(e.push(t.refRange||t.range),e)),[]),pi.#e[e].push([0,1]),pi.#t[e]=t.fromGray}constructor(e,t,r,{clamp:i=!1}={}){if(this.mode=t||fi,e instanceof pi){const r=t?pi.colorMap[t]:pi.colorMap[e.mode];this._color=Yr(e._color,r),this.mode=r}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(pi.colorMap).find((([e,t])=>t===this._color.spaceId));this.mode=t,this._color=Yr(this._color,this._color.spaceId)}catch(e){throw new Error("Invalid color string")}else{let t;if(r)if(4===e.length)t=pi.mapColorRange(e,this.mode,r,i);else if(3===e.length)t=pi.mapColorRange([e[0],e[1],e[2]],this.mode,r,i),t.push(1);else if(2===e.length){t=pi.#t[this.mode]?pi.#t[this.mode](e[0],r,i):pi.mapColorRange([e[0],e[0],e[0]],this.mode,r,i);const s=Array.isArray(r[r.length-1])?r[r.length-1]:[0,r[r.length-1]];t.push(li(e[1],s[0],s[1],0,1,i))}else{if(1!==e.length)throw new Error("Invalid color");t=pi.#t[this.mode]?pi.#t[this.mode](e[0],r,i):pi.mapColorRange([e[0],e[0],e[0]],this.mode,r,i),t.push(1)}else t=e;const s=pi.colorMap[this.mode]||console.error("Invalid color mode"),n={space:s,coords:t.slice(0,3),alpha:t[3]};this._color=Yr(n,s)}else{const r=t?pi.colorMap[t]:e.spaceId;this._color=Yr(e,r),this.mode=t||Object.entries(pi.colorMap).find((([e,t])=>t===this._color.spaceId))}}static mapColorRange(e,t,r,i){const s=r.map((e=>Array.isArray(e)?e:[0,e])),n=pi.#e[t];return e.map(((e,t)=>li(e,s[t][0],s[t][1],n[t][0],n[t][1],i)))}static unmapColorRange(e,t,r){const i=r.map((e=>Array.isArray(e)?e:[0,e])),s=pi.#e[t];return e.map(((e,t)=>li(e,s[t][0],s[t][1],i[t][0],i[t][1])))}#r(e){return new pi(this._color,e)}get _array(){return this._getRGBA()}array(){return this._array}lerp(e,t,r){let i=-1;for(;(i+1<this._color.space.path.length||i+1<e._color.space.path.length)&&this._color.space.path[i+1]===e._color.space.path[i+1];)i+=1;if(-1===i)throw new Error("Cannot lerp colors. No common color space found");const s=ii(this._color,e._color,{space:this._color.space.path[i].id})(t);return new pi(s,r||this.mode)}toString(e){const t=`${this._color.space.id}-${this._color.coords.join(",")}-${this._color.alpha}-${e}`;let r=ci[t];return r||(r=function(e,{precision:t=ht.precision,format:r="default",inGamut:i=!0,...s}={}){let n,a=r;r=(e=pt(e)).space.getFormat(r)??e.space.getFormat("default")??dt.DEFAULT_FORMAT;let o=e.coords.slice();if(i||=r.toGamut,i&&!zt(e)&&(o=Hr(jt(e),!0===i?void 0:i).coords),"custom"===r.type){if(s.precision=t,!r.serialize)throw new TypeError(`format ${a} can only be used to parse colors, not for serialization`);n=r.serialize(o,e.alpha,s)}else{let i=r.name||"color";r.serializeCoords?o=r.serializeCoords(o,t):null!==t&&(o=o.map((e=>Ye(e,{precision:t}))));let s=[...o];if("color"===i){let t=r.id||r.ids?.[0]||e.space.id;s.unshift(t)}let a=e.alpha;null!==t&&(a=Ye(a,{precision:t}));let h=e.alpha>=1||r.noAlpha?"":`${r.commas?",":" /"} ${a}`;n=`${i}(${s.join(r.commas?", ":" ")}${h})`}return n}(this._color,{format:e}),ci[t]=r),r}setRed(e,t=[0,1]){Array.isArray(t)||(t=[0,t]);const r=pi.#e[fi][0],i=li(e,t[0],t[1],r[0],r[1]);if(this.mode===fi||this.mode===gi)this._color.coords[0]=i;else{const e=this._color.space.id,t=Yr(this._color,"srgb");t.coords[0]=i,this._color=Yr(t,e)}}setGreen(e,t=[0,1]){Array.isArray(t)||(t=[0,t]);const r=pi.#e[fi][1],i=li(e,t[0],t[1],r[0],r[1]);if(this.mode===fi||this.mode===gi)this._color.coords[1]=i;else{const e=this._color.space.id,t=Yr(this._color,"srgb");t.coords[1]=i,this._color=Yr(t,e)}}setBlue(e,t=[0,1]){Array.isArray(t)||(t=[0,t]);const r=pi.#e[fi][2],i=li(e,t[0],t[1],r[0],r[1]);if(this.mode===fi||this.mode===gi)this._color.coords[2]=i;else{const e=this._color.space.id,t=Yr(this._color,"srgb");t.coords[2]=i,this._color=Yr(t,e)}}setAlpha(e,t=[0,1]){Array.isArray(t)||(t=[0,t]);const r=pi.#e[this.mode][3],i=li(e,t[0],t[1],r[0],r[1]);this._color.alpha=i}_getRGBA(e=[1,1,1,1]){const t=pi.#e[fi];let r=structuredClone(Yr(this._color,"srgb").coords);r.push(this._color.alpha);const i=e.map((e=>Array.isArray(e)?e:[0,e]));return r=r.map(((e,r)=>li(e,t[r][0],t[r][1],i[r][0],i[r][1]))),r}_getMode(){return this.mode}_getRed(e=[0,1]){if(Array.isArray(e)||(e=[0,e]),this.mode===fi||this.mode===gi){const t=pi.#e[this.mode][0];return li(this._color.coords[0],t[0],t[1],e[0],e[1])}{const t=pi.#e[fi][0];return li(Yr(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===fi||this.mode===gi){const t=pi.#e[this.mode][1];return li(this._color.coords[1],t[0],t[1],e[0],e[1])}{const t=pi.#e[fi][1];return li(Yr(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===fi||this.mode===gi){const t=pi.#e[this.mode][2];return li(this._color.coords[2],t[0],t[1],e[0],e[1])}{const t=pi.#e[fi][2];return li(Yr(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=pi.#e[this.mode][3];return li(this._color.alpha,t[0],t[1],e[0],e[1])}_getHue(e=[0,360]){if(Array.isArray(e)||(e=[0,e]),this.mode===mi||this.mode===yi){const t=pi.#e[this.mode][0];return li(this._color.coords[0],t[0],t[1],e[0],e[1])}{const t=pi.#e[yi][0];return li(Yr(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===mi||this.mode===yi){const t=pi.#e[this.mode][1];return li(this._color.coords[1],t[0],t[1],e[0],e[1])}{const t=pi.#e[yi][1];return li(Yr(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===mi){const t=pi.#e[this.mode][2];return li(this._color.coords[2],t[0],t[1],e[0],e[1])}{const t=pi.#e[mi][2];return li(Yr(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===yi){const t=pi.#e[this.mode][2];return li(this._color.coords[2],t[0],t[1],e[0],e[1])}{const t=pi.#e[yi][2];return li(Yr(this._color,"hsl").coords[2],t[0],t[1],e[0],e[1])}}}function di(e,t,r){e.Color=pi,ti.fromGray=ri.fromGray=function(e,t,r){const i=t.map((e=>Array.isArray(e)?e:[0,e])),s=li(e,i[2][0],i[2][1],0,1,r);return[s,s,s]},hi.fromGray=si.fromGray=function(e,t,r){const i=t.map((e=>Array.isArray(e)?e:[0,e]));return[0,0,li(e,i[2][0],i[2][1],0,100,r)]},ai.fromGray=function(e,t,r){const i=t.map((e=>Array.isArray(e)?e:[0,e])),s=Math.abs(i[1][0]-i[1][1])/2+Math.abs(i[2][0]-i[2][1])/2,n=li(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=oi.fromGray=function(e,t,r){const i=t.map((e=>Array.isArray(e)?e:[0,e]));return[li(e,i[0][0],i[0][1],0,100,r),0,0]},e.Color.addColorMode(fi,ti),e.Color.addColorMode(gi,ri),e.Color.addColorMode(mi,hi),e.Color.addColorMode(yi,si),e.Color.addColorMode(xi,ai),e.Color.addColorMode(vi,St),e.Color.addColorMode(bi,Tt),e.Color.addColorMode(_i,Ut),e.Color.addColorMode(wi,oi),r.presetup=function(){const t=this,r=["Red","Green","Blue","Alpha"];for(let i in r){const s=r[i],n=e.Color.prototype["set"+s];e.Color.prototype["set"+s]=function(e,r){return r=r||t?._renderer?.states?.colorMaxes?.[fi][i],n.call(this,e,r)}}function i(r,i){const s=e.Color.prototype["_get"+r];e.Color.prototype["_get"+r]=function(e){if(Object.keys(i).includes(this.mode))e=e||t?._renderer?.states?.colorMaxes?.[this.mode][i[this.mode]];else{const r=Object.keys(i)[0];e=e||t?._renderer?.states?.colorMaxes?.[r][i[r]]}return s.call(this,e)}}i("Red",{[fi]:0,[gi]:0}),i("Green",{[fi]:1,[gi]:1}),i("Blue",{[fi]:2,[gi]:2}),i("Alpha",{[fi]:3,[gi]:3,[mi]:3,[yi]:3,[xi]:3,[vi]:3,[bi]:3,[_i]:3,[wi]:3}),i("Hue",{[yi]:0,[mi]:0,[xi]:0,[bi]:2,[wi]:2}),i("Saturation",{[yi]:1,[mi]:1}),i("Brightness",{[mi]:2}),i("Lightness",{[yi]:2})}}void 0!==p5&&di(p5);const fi="rgb",gi="rgbhdr",mi="hsb",yi="hsl",xi="hwb",vi="lab",bi="lch",_i="oklab",wi="oklch",Ci="rgba";function Di(e,t){t.RGB=fi,t.RGBHDR=gi,t.HSB=mi,t.HSL=yi,t.HWB=xi,t.LAB=vi,t.LCH=bi,t.OKLAB=_i,t.OKLCH=wi,t.RGBA=Ci,e.Renderer.states.colorMode=fi,e.Renderer.states.colorMaxes={[fi]:[255,255,255,255],[gi]:[255,255,255,255],[mi]:[360,100,100,1],[yi]:[360,100,100,1],[xi]:[360,100,100,1],[vi]:[100,[-125,125],[-125,125],1],[bi]:[100,150,360,1],[_i]:[100,[-125,125],[-125,125],1],[wi]:[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 pi)return e[0];const t=Array.isArray(e[0])?e[0]:e;return new pi(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,r){return e.lerp(t,r,this._renderer.states.colorMode)},t.paletteLerp=function(e,t){const r=e[0];if(t<r[1])return this.color(r[0]);for(let r=1;r<e.length;r++){const i=e[r];if(t<i[1]){const s=e[r-1];return this.lerpColor(this.color(s[0]),this.color(i[0]),(t-s[1])/(i[1]-s[1]))}}return this.color(e[e.length-1][0])}}void 0!==p5&&Di(p5,p5.prototype);class Ei{constructor(e){if(e)this.DOM=e;else{const e=document.implementation.createDocument(null,"doc");this.DOM=e.createElement("root")}}getParent(){return new Ei(this.DOM.parentElement)}getName(){return this.DOM.tagName}setName(e){const t=this.DOM.innerHTML,r=this.DOM.attributes,i=document.implementation.createDocument(null,"default").createElement(e);i.innerHTML=t;for(let e=0;e<r.length;e++)i.setAttribute(r[e].nodeName,r[e].nodeValue);this.DOM=i}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 Ai(e?this.DOM.getElementsByTagName(e):this.DOM.children)}getChild(e){if("string"!=typeof e)return new Ei(this.DOM.children[e]);for(const t of this.DOM.children)if(t.tagName===e)return new Ei(t)}addChild(e){e instanceof Ei&&this.DOM.appendChild(e.DOM)}removeChild(e){let t=-1;if("string"==typeof e){for(let r=0;r<this.DOM.children.length;r++)if(this.DOM.children[r].tagName===e){t=r;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 r={};for(const e of this.DOM.attributes)r[e.nodeName]=e.nodeValue;return Number(r[e])||t||0}getString(e,t){const r={};for(const e of this.DOM.attributes)r[e.nodeName]=e.nodeValue;return r[e]?String(r[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 Ai(e){const t=[];for(let r=0;r<e.length;r++)t.push(new Ei(e[r]));return t}function Si(e,t){e.XML=Ei}void 0!==p5&&Si(p5);class Fi{constructor(e,t){this.file=e,this._pInst=t;const r=e.type.split("/");this.type=r[0],this.subtype=r[1],this.name=e.name,this.size=e.size,this.data=void 0}static _createLoader(e,t){const r=new FileReader;return r.onload=function(r){const i=new Fi(e);if("application/json"===i.file.type)i.data=JSON.parse(r.target.result);else if("text/xml"===i.file.type){const e=(new DOMParser).parseFromString(r.target.result,"text/xml");i.data=new Ei(e.documentElement)}else i.data=r.target.result;t(i)},r}static _load(e,t){if(/^text\//.test(e.type)||"application/json"===e.type)Fi._createLoader(e,t).readAsText(e);else if(/^(video|audio)\//.test(e.type)){const r=new Fi(e);r.data=URL.createObjectURL(e),t(r)}else Fi._createLoader(e,t).readAsDataURL(e)}}function Ti(e,t){e.File=Fi}void 0!==p5&&Ti(p5);class Mi{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 Mi&&(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 Mi&&(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,r="none"===this.elt.style.display,i="none"===this.parent().style.display,s={x:this.elt.offsetLeft,y:this.elt.offsetTop};r&&this.show(),i&&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),r&&this.hide(),i&&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 r=e,i=t;const s=z;if(r!==s||i!==s){if(r===s?r=t*this.width/this.height:i===s&&(i=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",r*this._pInst._pixelDensity),this.elt.setAttribute("height",i*this._pInst._pixelDensity),this.elt.style.width=r+"px",this.elt.style.height=i+"px",this._pInst.scale(this._pInst._pixelDensity,this._pInst._pixelDensity),e)this.elt.getContext("2d")[s]=e[s]}else this.elt.style.width=r+"px",this.elt.style.height=i+"px",this.elt.width=r,this.elt.height=i;this.width=r,this.height=i,this._pInst&&this._pInst._curElement&&this._pInst._curElement.elt===this.elt&&(this._pInst.width=r,this._pInst.height=i)}return this}}style(e,t){const r=this;if(t instanceof pi&&(t=t.toString()),void 0===t){if(-1===e.indexOf(":")){return window.getComputedStyle(r.elt).getPropertyValue(e)}{const t=e.split(";");for(let e=0;e<t.length;e++){const r=t[e].split(":");r[0]&&r[1]&&(this.elt.style[r[0].trim()]=r[1].trim())}}}else if(this.elt.style[e]=t,"width"===e||"height"===e||"left"===e||"top"===e){let t=window.getComputedStyle(r.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 r=0;r<this.elt.childNodes.length;r++)this.elt.childNodes[r].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 Mi._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 Mi._adjustListener("dblclick",e,this),this}mouseWheel(e){return Mi._adjustListener("wheel",e,this),this}mouseReleased(e){return Mi._adjustListener("pointerup",e,this),this}mouseClicked(e){return Mi._adjustListener("click",e,this),this}mouseMoved(e){return Mi._adjustListener("pointermove",e,this),this}mouseOver(e){return Mi._adjustListener("pointerover",e,this),this}mouseOut(e){return Mi._adjustListener("pointerout",e,this),this}dragOver(e){return Mi._adjustListener("dragover",e,this),this}dragLeave(e){return Mi._adjustListener("dragleave",e,this),this}changed(e){return Mi._adjustListener("change",e,this),this}input(e){return Mi._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)}Mi._attachListener("drop",(function(r){r.preventDefault(),"function"==typeof t&&t.call(this,r);const i=r.dataTransfer.files;for(const t of i)Fi._load(t,e)}),this)}else console.log("The File APIs are not fully supported in this browser.");return this}draggable(e){let t,r="ontouchstart"in window,i=0,s=0,n=0,a=0,o=r?"touchstart":"mousedown",h=r?"touchend":"mouseup",u=r?"touchmove":"mousemove";function l(t){if(t=t||window.event,r){const e=t.changedTouches;i=n-parseInt(e[0].clientX),s=a-parseInt(e[0].clientY),n=parseInt(e[0].clientX),a=parseInt(e[0].clientY)}else i=n-parseInt(t.clientX),s=a-parseInt(t.clientY),n=parseInt(t.clientX),a=parseInt(t.clientY);e.style.left=e.offsetLeft-i+"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,r){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,r){return!1===t?Mi._detachListener(e,r):Mi._attachListener(e,t,r),this}static _attachListener(e,t,r){r._events[e]&&Mi._detachListener(e,r);const i=t.bind(r);r.elt.addEventListener(e,i,!1),r._events[e]=i}static _detachListener(e,t){const r=t._events[e];t.elt.removeEventListener(e,r,!1),t._events[e]=null}}function ki(e,t){e.Element=Mi}void 0!==p5&&ki(p5);const Ii={_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"),r=t.drawingBufferWidth*t.drawingBufferHeight*4,i=new Uint8Array(r);return t.readPixels(0,0,e.width,e.height,t.RGBA,t.UNSIGNED_BYTE,i),i}},_getARGB(e,t){const r=4*t;return e[r+3]<<24&4278190080|e[r]<<16&16711680|e[r+1]<<8&65280|255&e[r+2]},_setPixels(e,t){let r=0;for(let i=0,s=e.length;i<s;i++)r=4*i,e[r+0]=(16711680&t[i])>>>16,e[r+1]=(65280&t[i])>>>8,e[r+2]=255&t[i],e[r+3]=(4278190080&t[i])>>>24},_toImageData:e=>e instanceof ImageData?e:e.getContext("2d").getImageData(0,0,e.width,e.height),_createImageData(e,t){return Ii._tmpCanvas=document.createElement("canvas"),Ii._tmpCtx=Ii._tmpCanvas.getContext("2d"),this._tmpCtx.createImageData(e,t)},apply(e,t,r){const i=e.getContext("2d"),s=i.getImageData(0,0,e.width,e.height),n=t(s,r);n instanceof ImageData?i.putImageData(n,0,0,0,0,e.width,e.height):i.putImageData(s,0,0,0,0,e.width,e.height)},threshold(e,t=.5){const r=Ii._toPixels(e),i=Math.floor(255*t);for(let e=0;e<r.length;e+=4){let t;t=.2126*r[e]+.7152*r[e+1]+.0722*r[e+2]>=i?255:0,r[e]=r[e+1]=r[e+2]=t}},gray(e){const t=Ii._toPixels(e);for(let e=0;e<t.length;e+=4){const r=.2126*t[e]+.7152*t[e+1]+.0722*t[e+2];t[e]=t[e+1]=t[e+2]=r}},opaque(e){const t=Ii._toPixels(e);for(let e=0;e<t.length;e+=4)t[e+3]=255;return t},invert(e){const t=Ii._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 r=Ii._toPixels(e);if(t<2||t>255)throw new Error("Level must be greater than 2 and less than 255 for posterize");const i=t-1;for(let e=0;e<r.length;e+=4){const s=r[e],n=r[e+1],a=r[e+2];r[e]=255*(s*t>>8)/i,r[e+1]=255*(n*t>>8)/i,r[e+2]=255*(a*t>>8)/i}},dilate(e){const t=Ii._toPixels(e);let r=0;const i=t.length?t.length/4:0,s=new Int32Array(i);let n,a,o,h,u,l,c,p,d,f,g,m,y,x,v,b,_;for(;r<i;)for(n=r,a=r+e.width;r<a;)o=h=Ii._getARGB(t,r),c=r-1,l=r+1,p=r-e.width,d=r+e.width,c<n&&(c=r),l>=a&&(l=r),p<0&&(p=0),d>=i&&(d=r),m=Ii._getARGB(t,p),g=Ii._getARGB(t,c),y=Ii._getARGB(t,d),f=Ii._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[r++]=h;Ii._setPixels(t,s)},erode(e){const t=Ii._toPixels(e);let r=0;const i=t.length?t.length/4:0,s=new Int32Array(i);let n,a,o,h,u,l,c,p,d,f,g,m,y,x,v,b,_;for(;r<i;)for(n=r,a=r+e.width;r<a;)o=h=Ii._getARGB(t,r),c=r-1,l=r+1,p=r-e.width,d=r+e.width,c<n&&(c=r),l>=a&&(l=r),p<0&&(p=0),d>=i&&(d=r),m=Ii._getARGB(t,p),g=Ii._getARGB(t,c),y=Ii._getARGB(t,d),f=Ii._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[r++]=h;Ii._setPixels(t,s)},blur(e,t){!function(e,t){const r=Ii._toPixels(e),i=e.width,s=e.height,n=i*s,a=new Int32Array(n);for(let e=0;e<n;e++)a[e]=Ii._getARGB(r,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,Bi!==t){Bi=t,Li=1+Bi<<1,Pi=new Int32Array(Li),Oi=new Array(Li);for(let e=0;e<Li;e++)Oi[e]=new Int32Array(256);let e,r,i,s;for(let e=1,n=t-1;e<t;e++){Pi[t+e]=Pi[n]=r=n*n,i=Oi[t+e],s=Oi[n--];for(let e=0;e<256;e++)i[e]=s[e]=r*e}e=Pi[t]=t*t,i=Oi[t];for(let t=0;t<256;t++)i[t]=e*t}}(t),w=0;w<s;w++){for(_=0;_<i;_++){if(l=u=h=c=o=0,p=_-Bi,p<0)m=-p,p=0;else{if(p>=i)break;m=0}for(C=m;C<Li&&!(p>=i);C++){const e=a[p+E];D=Oi[C],c+=D[(-16777216&e)>>>24],h+=D[(16711680&e)>>16],u+=D[(65280&e)>>8],l+=D[255&e],o+=Pi[C],p++}d=E+_,y[d]=c/o,x[d]=h/o,v[d]=u/o,b[d]=l/o}E+=i}for(E=0,f=-Bi,g=f*i,w=0;w<s;w++){for(_=0;_<i;_++){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<Li&&!(d>=s);C++)D=Oi[C],c+=D[y[p]],h+=D[x[p]],u+=D[v[p]],l+=D[b[p]],o+=Pi[C],d++,p+=i;a[_+E]=c/o<<24|h/o<<16|u/o<<8|l/o}E+=i,g+=i,f++}Ii._setPixels(r,a)}(e,t)}};let Bi,Li,Pi,Oi;var Ni="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function Ri(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Vi,Ui,Gi={exports:{}};Vi=Gi,Ui=Ui||function(e){if(!(void 0===e||"undefined"!=typeof navigator&&/MSIE [1-9]\./.test(navigator.userAgent))){var t=e.document,r=function(){return e.URL||e.webkitURL||e},i=t.createElementNS("http://www.w3.org/1999/xhtml","a"),s="download"in i,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?r().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 r=(t=[].concat(t)).length;r--;){var i=e["on"+t[r]];if("function"==typeof i)try{i.call(e,e)}catch(e){o(e)}}}(d,"writestart progress write writeend".split(" "))};if(d.readyState=d.INIT,s)return p=r().createObjectURL(t),void setTimeout((function(){var e,t;i.href=p,i.download=l,e=i,t=new MouseEvent("click"),e.dispatchEvent(t),g(),h(p),d.readyState=d.DONE}));!function(){if((a||f&&n)&&e.FileReader){var i=new FileReader;return i.onloadend=function(){var t=a?i.result:i.result.replace(/^data:[^;]*;/,"data:attachment/file;");e.open(t,"_blank")||(e.location.href=t),t=void 0,d.readyState=d.DONE,g()},i.readAsDataURL(t),void(d.readyState=d.INIT)}p||(p=r().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,r){return t=t||e.name||"download",r||(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,r){return new l(e,t||e.name||"download",r)})}}("undefined"!=typeof self&&self||"undefined"!=typeof window&&window||Ni.content),Vi.exports&&(Vi.exports.saveAs=Ui);var zi=Gi.exports;function ji(e,t,r){const i=$i(t,r)[0];let s=e;s instanceof Blob||(s=new Blob([e])),zi.saveAs(s,i)}function $i(e,t){t&&!0!==t&&"true"!==t||(t=""),e||(e="untitled");let r="";return e&&e.includes(".")&&(r=e.split(".").pop()),t&&r!==t&&(r=t,e=`${e}.${r}`),[e,r]}class Wi{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,r=e._lastRealFrameTime||window.performance.now();if(0===t.lastChangeTime&&(t.lastChangeTime=r),t.playing){t.timeDisplayed=r-t.lastChangeTime;const e=t.frames[t.displayIndex].delay;if(t.timeDisplayed>=e){const i=Math.floor(t.timeDisplayed/e);if(t.timeDisplayed=0,t.lastChangeTime=r,t.displayIndex+=i,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,r=this.width*t,i=this.height*t,s=this.drawingContext.getImageData(0,0,r,i);e.imageData=s,this.pixels=e.pixels=s.data,this.setModified(!0)}updatePixels(e,t,r,i){const s=this._pixelsState,n=this._pixelDensity;void 0===e&&void 0===t&&void 0===r&&void 0===i&&(e=0,t=0,r=this.width,i=this.height),e*=n,t*=n,r*=n,i*=n,this.gifProperties&&(this.gifProperties.frames[this.gifProperties.displayIndex].image=s.imageData),this.drawingContext.putImageData(s.imageData,e,t,0,0,r,i),this.setModified(!0)}get(e,t,r,i){const s=this._pixelsState,n=this._pixelDensity,a=this.canvas;if(void 0===e&&void 0===t)e=t=0,r=s.width,i=s.height;else if(e*=n,t*=n,void 0===r&&void 0===i)return e<0||t<0||e>=a.width||t>=a.height?[0,0,0,0]:this._getPixel(e,t);const o=new Wi(r*n,i*n);return o.pixelDensity(n),o.canvas.getContext("2d").drawImage(a,e,t,r*n,i*n,0,0,r*n,i*n),o}_getPixel(e,t){let r,i;return r=this.drawingContext.getImageData(e,t,1,1).data,i=0,[r[0],r[1],r[2],r[3]]}set(e,t,r){e=Math.floor(e),t=Math.floor(t);const i=this._pixelsState;if(r instanceof Wi)this.drawingContext.save(),this.drawingContext.setTransform(1,0,0,1,0,0),this.drawingContext.scale(this._pixelDensity,this._pixelDensity),this.drawingContext.clearRect(e,t,r.width,r.height),this.drawingContext.drawImage(r.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(i.imageData||i.loadPixels(),"number"==typeof r)h<i.pixels.length&&(s=r,n=r,a=r,o=255);else if(Array.isArray(r)){if(r.length<4)throw new Error("pixel array must be of the form [R, G, B, A]");h<i.pixels.length&&(s=r[0],n=r[1],a=r[2],o=r[3])}else r instanceof p5.Color&&h<i.pixels.length&&([s,n,a,o]=r._getRGBA([255,255,255,255]));for(let r=0;r<this._pixelDensity;r++)for(let u=0;u<this._pixelDensity;u++)h=4*((t*this._pixelDensity+u)*this.width*this._pixelDensity+(e*this._pixelDensity+r)),i.pixels[h]=s,i.pixels[h+1]=n,i.pixels[h+2]=a,i.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 r=document.createElement("canvas");if(r.width=e,r.height=t,this.gifProperties){const r=this.gifProperties,i=(e,t)=>{let r=0;for(let i=0;i<t.height;i++)for(let s=0;s<t.width;s++){const n=Math.floor(s*e.width/t.width);let a=4*(Math.floor(i*e.height/t.height)*e.width+n);t.data[r++]=e.data[a++],t.data[r++]=e.data[a++],t.data[r++]=e.data[a++],t.data[r++]=e.data[a++]}};for(let s=0;s<r.numFrames;s++){const n=this.drawingContext.createImageData(e,t);i(r.frames[s].image,n),r.frames[s].image=n}}r.getContext("2d").drawImage(this.canvas,0,0,this.canvas.width,this.canvas.height,0,0,r.width,r.height),this.canvas.width=this.width=e,this.canvas.height=this.height=t,this.drawingContext.drawImage(r,0,0,e,t,0,0,e,t),this.pixels.length>0&&this.loadPixels(),this.setModified(!0)}copy(...e){let t,r,i,s,n,a,o,h,u;if(9===e.length)t=e[0],r=e[1],i=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,r=e[0],i=e[1],s=e[2],n=e[3],a=e[4],o=e[5],h=e[6],u=e[7]}this._copyHelper(this,t,r,i,s,n,a,o,h,u)}_copyHelper(e,t,r,i,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,r+c,i+p,s,n,a,o,h,u),e.pop()):e.drawingContext.drawImage(t.canvas,l*(r+c),l*(i+p),l*s,l*n,a,o,h,u)}mask(e){void 0===e&&(e=this);const t=this.drawingContext.globalCompositeOperation;let r=this._pixelDensity,i=1;e instanceof xs&&(i=e._pInst._renderer._pixelDensity);const s=[e,0,0,i*e.width,i*e.height,0,0,r*this.width,r*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,r*this.width,r*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){Ii.apply(this.canvas,Ii[e],t),this.setModified(!0)}blend(...e){const t=this.drawingContext.globalCompositeOperation,r=e[e.length-1],i=Array.prototype.slice.call(e,0,e.length-1);this.drawingContext.globalCompositeOperation=r,this.copy(...i),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 r=e.gifProperties;let i=r.loopLimit;1===i?i=null:null===i&&(i=0);const s=new Uint8Array(e.width*e.height*r.numFrames),n=[],a={};for(let t=0;t<r.numFrames;t++){const i=new Set,s=r.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 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===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:i,palette:new Uint32Array(u)},f=new omggif.GifWriter(s,e.width,e.height,d);let g={};for(let t=0;t<r.numFrames;t++){const i=!o.has(t),s=i?[]:u,a=new Uint8Array(e.width*e.height),h={},l=new Set;n[t].forEach(((e,r)=>{i?(void 0===h[e]&&(h[e]=s.length,s.push(e)),a[r]=h[e]):a[r]=c[e],t>0&&n[t-1][r]!==e&&l.add(e)}));const p={},d=s.filter((e=>!l.has(e)));if(d.length>0){const e=d[0],r=i?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]=r);p.transparent=r,g.frameOpts.disposal=1}}if(p.delay=r.frames[t].delay/10,i){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";ji(new Blob([s.slice(0,f.end())],{type:"image/gif"}),t,m)}(this,e);else{let r,i=this.canvas;switch(t=t||$i(e,t)[1]||"png"){default:r="image/png";break;case"webp":r="image/webp";break;case"jpeg":case"jpg":r="image/jpeg"}i.toBlob((r=>{ji(r,e,t)}),r)}}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 r=this.gifProperties;if(t<r.numFrames&&t>=0)r.frames[t].delay=e;else for(const t of r.frames)t.delay=e}}}function qi(e,t){e.Image=Wi}function Hi(e){let t=0;for(let r=1;r<e.length;r++)t+=e[r-1].position.dist(e[r].position);return t}void 0!==p5&&qi(p5);class Xi{constructor(e){for(const[t,r]of Object.entries(e))this[t]=r}}class Yi{vertices;_shape=null;_primitivesIndex=null;_contoursIndex=null;isClosing=!1;constructor(...e){if(this.constructor===Yi)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 r,i,s=e.at(-1,-1),n=s instanceof this.constructor,a=s.vertexCapacity-s.vertexCount;n&&a>0?(r=this.vertices.splice(0,a),i=this.vertices,s.vertices.push(...r),i.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 Zi{#i;primitives;constructor(e=8){this.#i=e,this.primitives=[]}get kind(){const e=0===this.primitives.length,t=8===this.#i;return e&&t?7:this.#i}accept(e){for(const t of this.primitives)t.accept(e)}}class Ki extends Yi{#s=1;get vertexCapacity(){return this.#s}accept(e){e.visitAnchor(this)}getEndVertex(){return this.vertices[0]}}class Ji extends Yi{constructor(...e){if(super(...e),this.constructor===Ji)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 Qi extends Ji{#s=1;get vertexCapacity(){return this.#s}accept(e){e.visitLineSegment(this)}}class es extends Ji{#n;#s;constructor(e,...t){super(...t);let r=Array.isArray(e)?e[0]:e;this.#n=r,this.#s=r}get order(){return this.#n}get vertexCapacity(){return this.#s}#a;hullLength(){return void 0===this.#a&&(this.#a=Hi([this.getStartVertex(),...this.vertices])),this.#a}accept(e){e.visitBezierSegment(this)}}class ts extends Ji{#s=1/0;_splineProperties={ends:Pe,tightness:0};get vertexCapacity(){return this.#s}accept(e){e.visitSplineSegment(this)}get _comesAfterSegment(){return this._previousPrimitive instanceof Ji}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 r=!this._belongsToShape,i=e.at(-1,-1);if(r&&2===i.vertices.length&&i._comesAfterSegment&&!i._chainedToSegment){let e=i._firstInterpolatedVertex.position,t=i.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 rs extends Yi{#s=1;get vertexCapacity(){return this.#s}accept(e){e.visitPoint(this)}}class is extends Yi{#s=2;get vertexCapacity(){return this.#s}accept(e){e.visitLine(this)}}class ss extends Yi{#s=3;get vertexCapacity(){return this.#s}accept(e){e.visitTriangle(this)}}class ns extends Yi{#s=4;get vertexCapacity(){return this.#s}accept(e){e.visitQuad(this)}}class as extends Yi{#s=1/0;get vertexCapacity(){return this.#s}accept(e){e.visitTriangleFan(this)}}class os extends Yi{#s=1/0;get vertexCapacity(){return this.#s}accept(e){e.visitTriangleStrip(this)}}class hs extends Yi{#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 Ki(...e))),e.set("vertex-8",((...e)=>new Qi(...e))),e.set(`vertex-${T}`,((...e)=>new rs(...e))),e.set(`vertex-${M}`,((...e)=>new is(...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 Ki(...t))),e.set("bezierVertex-8",((e,...t)=>new es(e,...t))),e.set("splineVertex-7",((...e)=>new Ki(...e))),e.set("splineVertex-8",((...e)=>new ts(...e))),this.creators=e}get(e,t){const r=`${e}-${t}`;return this.creators.get(r)}set(e,t,r){const i=`${e}-${t}`;this.creators.set(i,r)}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 r in this.#o){if(this.userVertexProperties&&r in this.userVertexProperties)continue;const i=e[r];t.push(...this.serializeToArray(i))}for(const r in this.userVertexProperties)r in e?t.push(...this.serializeToArray(e[r])):t.push(...new Array(this.userVertexProperties[r]).fill(0));return t}hydrateValue(e,t){if(null===t)return null;if(t instanceof Number)return e.shift();if(t instanceof Array){const r=[];for(let i=0;i<t.length;i++)r.push(e.shift());return r}if(t instanceof je)return new je(e.shift(),e.shift(),e.shift());if(t instanceof pi){const t=[e.shift(),e.shift(),e.shift(),e.shift()];return new pi(t)}}arrayToVertex(e){const t={},r=[...e];for(const e in this.#o){if(this.userVertexProperties&&e in this.userVertexProperties)continue;const i=this.#o[e];t[e]=this.hydrateValue(r,i)}for(const e in this.userVertexProperties){const i=this.#o[e];t[e]=this.hydrateValue(r,i)}return t}arrayScale(e,t){return e.map((e=>e*t))}arraySum(e,...t){return e.map(((e,r)=>{let i=e;for(let e=0;e<t.length;e++)i+=t[e][r];return i}))}arrayMinus(e,t){return e.map(((e,r)=>e-t[r]))}evaluateCubicBezier([e,t,r,i],s){return this.arraySum(this.arrayScale(e,Math.pow(1-s,3)),this.arrayScale(t,3*Math.pow(1-s,2)*s),this.arrayScale(r,3*(1-s)*Math.pow(s,2)),this.arrayScale(i,Math.pow(s,3)))}evaluateQuadraticBezier([e,t,r],i){return this.arraySum(this.arrayScale(e,Math.pow(1-i,2)),this.arrayScale(t,2*(1-i)*i),this.arrayScale(r,i*i))}catmullRomToBezier(e,t){let r=1-t,i=[];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),r/6)),u=this.arraySum(a,this.arrayScale(this.arrayMinus(n,o),r/6)),l=a;i.push([h,u,l])}return i}at(e,t,r){let i,s;switch(i=this.contours.at(e),arguments.length){case 1:return i;case 2:return i.primitives.at(t);case 3:return s=i.primitives.at(t),s.vertices.at(r)}}reset(){this.#o={...this.#h},this.kind=null,this.contours=[],this.userVertexProperties=null}vertexProperty(e,t){this.userVertexProperties=this.userVertexProperties||{};const r=this.vertexPropertyKey(e),i=Array.isArray(t)?t:[t];this.userVertexProperties[r]||(this.userVertexProperties[r]=i.length),this.#o[r]=i}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 Xi(this.#o)}#p(e,t,...r){let i=this.#u.get(e,t);return"bezierVertex"===e?i(this.#l,...r):i(...r)}#d(e,t,r){let i=e,s=this.at(-1).kind,n=this.#c(t,r);return this.#p(i,s,n).addToShape(this)}vertex(e,t,{isClosing:r=!1}={}){this.#d("vertex",e,t).isClosing=r}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 Zi(e))}endContour(e=L,t=this.contours.length-1){const r=this.at(t);if(e===B){const e=8===r.kind,i=this.at(t,0,0),s=Object.hasOwn(i,"position"),n=this.at(t,-1);if(e&&s)if(n.handlesClose())n.close(i);else{const e=this.contours.splice(t+1,this.contours.length-t-1),r=this.#o;this.#o={...r};for(const e in i)["position","textureCoordinates"].includes(e)||(this.#o[e]=i[e]);this.vertex(i.position,i.textureCoordinates,{isClosing:!0}),this.#o=r,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,r,i]=e.vertices;switch(e.order){case 2:this.path.quadraticCurveTo(t.position.x,t.position.y,r.position.x,r.position.y);break;case 3:this.path.bezierCurveTo(t.position.x,t.position.y,r.position.x,r.position.y,i.position.x,i.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 r=e.getControlPoints().map((e=>t.vertexToArray(e)));let i=t.catmullRomToBezier(r,e._splineProperties.tightness).map((e=>e.map((e=>t.arrayToVertex(e)))));for(const e of i){const t=e.flatMap((e=>[e.position.x,e.position.y]));this.path.bezierCurveTo(...t)}}visitPoint(e){const{x:t,y:r}=e.vertices[0].position;this.path.moveTo(t,r),this.path.lineTo(t+1e-5,r)}visitLine(e){const{x:t,y:r}=e.vertices[0].position,{x:i,y:s}=e.vertices[1].position;this.path.moveTo(t,r),this.path.lineTo(i,s)}visitTriangle(e){const[t,r,i]=e.vertices;this.path.moveTo(t.position.x,t.position.y),this.path.lineTo(r.position.x,r.position.y),this.path.lineTo(i.position.x,i.position.y),this.path.closePath()}visitQuad(e){const[t,r,i,s]=e.vertices;this.path.moveTo(t.position.x,t.position.y),this.path.lineTo(r.position.x,r.position.y),this.path.lineTo(i.position.x,i.position.y),this.path.lineTo(s.position.x,s.position.y),this.path.closePath()}visitTriangleFan(e){const[t,...r]=e.vertices;for(let e=0;e<r.length-1;e++){const i=r[e],s=r[e+1];this.path.moveTo(t.position.x,t.position.y),this.path.lineTo(i.position.x,i.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 r=e.vertices[t],i=e.vertices[t+1],s=e.vertices[t+2];this.path.moveTo(r.position.x,r.position.y),this.path.lineTo(i.position.x,i.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 r=e.vertices[t],i=e.vertices[t+1],s=e.vertices[t+2],n=e.vertices[t+3];this.path.moveTo(r.position.x,r.position.y),this.path.lineTo(i.position.x,i.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(),r=Math.max(1,Math.ceil(e.hullLength()*this.curveDetail)),i=[e.getStartVertex(),...e.vertices].map((t=>e._shape.vertexToArray(t)));for(let s=0;s<r;s++){const n=(s+1)/r;t.push(e._shape.arrayToVertex(3===e.order?e._shape.evaluateCubicBezier(i,n):e._shape.evaluateQuadraticBezier(i,n)))}}visitSplineSegment(e){const t=e._shape,r=this.lastContour(),i=e.getControlPoints().map((e=>t.vertexToArray(e)));let s=t.catmullRomToBezier(i,e._splineProperties.tightness),n=t.vertexToArray(e._firstInterpolatedVertex);for(const e of s){const i=[n,...e],s=Math.max(1,Math.ceil(Hi(i.map((e=>t.arrayToVertex(e))))*this.curveDetail));for(let e=0;e<s;e++){const n=(e+1)/s;r.push(t.arrayToVertex(t.evaluateCubicBezier(i,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=Zi,e.ShapePrimitive=Yi,e.Vertex=Xi,e.Anchor=Ki,e.Segment=Ji,e.LineSegment=Qi,e.BezierSegment=es,e.SplineSegment=ts,e.Point=rs,e.Line=is,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,r=0,i=0,s=0,n=0;2===e.length?[t,r]=e:4===e.length?[t,r,s,n]=e:3===e.length?[t,r,i]=e:5===e.length&&([t,r,i,s,n]=e),this._renderer.splineVertex(t,r,i,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 r,i,s;r=i=s=0,3===arguments.length?r=arguments[2]:4===arguments.length?(i=arguments[2],s=arguments[3]):5===arguments.length&&(r=arguments[2],i=arguments[3],s=arguments[4]),this._renderer.vertex(e,t,r,i,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,r,i){this._pInst=e,this._isMainCanvas=i,this.pixels=[],this._pixelDensity=Math.ceil(window.devicePixelRatio)||1,this.width=t,this.height=r,this._events={},i&&(this._isMainCanvas=!0),this.states=new ms(xs.states),this.states.strokeColor=new pi([0,0,0]),this.states.fillColor=new pi([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,r=0,i=0,s=0){const n=new je(e,t,r),a=this.getSupportedIndividualVertexProperties().textureCoordinates?new je(i,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,r=0,i=0,s=0){const n=new je(e,t,r),a=this.getSupportedIndividualVertexProperties().textureCoordinates?new je(i,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,r=0,i=0,s=0){const n=new je(e,t,r),a=this.getSupportedIndividualVertexProperties().textureCoordinates?new je(i,s):void 0;this.currentShape.vertex(n,a)}bezier(e,t,r,i,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(r,i),this._pInst.bezierVertex(s,n),this._pInst.bezierVertex(a,o),this._pInst.endShape(),this}spline(...e){if(8===e.length){const[t,r,i,s,n,a,o,h]=e;this._pInst.beginShape(),this._pInst.splineVertex(t,r),this._pInst.splineVertex(i,s),this._pInst.splineVertex(n,a),this._pInst.splineVertex(o,h),this._pInst.endShape()}else if(12===e.length){const[t,r,i,s,n,a,o,h,u,l,c,p]=e;this._pInst.beginShape(),this._pInst.splineVertex(t,r,i),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,r,i){const s=this._pixelDensity,n=this.canvas;if(void 0===e&&void 0===t)e=t=0,r=this.width,i=this.height;else if(e*=s,t*=s,void 0===r&&void 0===i)return e<0||t<0||e>=n.width||t>=n.height?[0,0,0,0]:this._getPixel(e,t);const a=new Wi(r*s,i*s);return a.pixelDensity(s),a.canvas.getContext("2d").drawImage(n,e,t,r*s,i*s,0,0,r*s,i*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 r in t)e[r](t[r])}}_applyDefaults(){return this}}class vs extends Mi{constructor(e,t){super(e,t);const r=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(r,"src",{get(){const e=r.elt.children[0].src,t=r.elt.src===window.location.href?"":r.elt.src;return e===window.location.href?t:e},set(t){for(let e=0;e<r.elt.children.length;e++)r.elt.removeChild(r.elt.children[e]);const i=document.createElement("source");i.src=t,e.appendChild(i),r.elt.src=t,r.modified=!0}}),r._onended=function(){},r.elt.onended=function(){r._onended(r)}}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,r,i){return this.loadedmetadata&&(this._ensureCanvas(),p5.Renderer2D.prototype.updatePixels.call(this,e,t,r,i)),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,r){this.loadedmetadata&&(this._ensureCanvas(),p5.Renderer2D.prototype.set.call(this,e,t,r),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,r;if("function"==typeof fn.getAudioContext)t=fn.getAudioContext(),r=p5.soundOut.input;else try{t=e.context,r=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(r)),e?e.input?this.audioSourceNode.connect(e.input):this.audioSourceNode.connect(e):this.audioSourceNode.connect(r)}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,r){const i=this._cueIDCounter++,s=new bs(t,e,i,r);return this._cues.push(s),this.elt.ontimeupdate||(this.elt.ontimeupdate=this._onTimeUpdate.bind(this)),i}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 r=this._cues[t].time,i=this._cues[t].val;this._prevTime<r&&r<=e&&this._cues[t].callback(i)}this._prevTime=e}}class bs{constructor(e,t,r,i){this.callback=e,this.time=t,this.id=r,this.val=i}}function _s(e,t){function r(e,t,r){(t._userNode?t._userNode:document.body).appendChild(e);const i=r?new vs(e,t):new Mi(e,t);return t._elements.push(i),i}function i(e,t,i,s){const n=document.createElement(t);"string"==typeof(i=i||"")&&(i=[i]);for(const e of i){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=r(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 i(this,"video",e,t)},t.createAudio=function(e,t){return i(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(r,i){t.call(navigator,e,r,i)})):Promise.reject(new Error("getUserMedia is not implemented in this browser"))}),t.createCapture=function(...i){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 i)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=r(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,r,i,s){let n;return s===_?n={x:e,y:t,w:Math.abs(r),h:Math.abs(i)}:s===w?n={x:Math.min(e,r),y:Math.min(t,i),w:Math.abs(r-e),h:Math.abs(i-t)}:s===C?n={x:e-(r=Math.abs(r)),y:t-(i=Math.abs(i)),w:2*r,h:2*i}:s===A&&(n={x:e-.5*(r=Math.abs(r)),y:t-.5*(i=Math.abs(i)),w:r,h:i}),n}};function Es(e,t){t._normalizeArcAngles=(e,t,r,i,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(r/i*Math.tan(e)):e>f&&e<=3*f?Math.atan(r/i*Math.tan(e))+g:Math.atan(r/i*Math.tan(e))+x,t=t<=f?Math.atan(r/i*Math.tan(t)):t>f&&t<=3*f?Math.atan(r/i*Math.tan(t))+g:Math.atan(r/i*Math.tan(t))+x),e>t&&(t+=x),{start:e,stop:t,correspondToSamePoint:n<1e-5}},t.arc=function(e,t,r,i,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,r,i,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,r,i,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,r,i,s){if(!this._renderer.states.strokeColor&&!this._renderer.states.fillColor)return this;void 0===i&&(i=r);const n=Ds.modeAdjust(e,t,r,i,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,r,i,s,n,a){return this._renderRect.call(this,e,t,r,r,i,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,r,i,s){const n=1-s;return Math.pow(n,3)*e+3*Math.pow(n,2)*s*t+3*n*Math.pow(s,2)*r+Math.pow(s,3)*i},t.bezierTangent=function(e,t,r,i,s){const n=1-s;return 3*i*Math.pow(s,2)-3*r*Math.pow(s,2)+6*r*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,r,i,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)+r*((-3-n)/2*a+(n+2)*o+(1-n)/2*s)+i*((1-n)/2*a+(n-1)/2*o)},t.splineTangent=function(e,t,r,i,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)+r*((-3-n)/2*a+(n+2)*o+(1-n)/2)+i*((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,r){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,r=e[1]||0,i=e[2]||0,s=e[3]||0;return this._renderer.clear(t,r,i,s),this},t.colorMode=function(e,t,r,i,s){if([fi,gi,mi,yi,xi,vi,bi,_i,wi].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]=r,n[2]=i):5===arguments.length&&(n[0]=t,n[1]=r,n[2]=i,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,r,i){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)>i)return void console.log("Warning, gif stream longer than expected.");r[p++]=b;var _=p+=x;for(y!==m&&(r[p++]=b),v=y;x--;)v=f[v],r[--_]=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!==i&&console.log("Warning, gif stream shorter than expected."),r}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,r,i){var s=0,n=void 0===(i=void 0===i?{}:i).loop?null:i.loop,a=void 0===i.palette?null:i.palette;if(t<=0||r<=0||t>65535||r>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!==i.background){if((u=i.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&r,e[s++]=r>>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,r,i,n,h,u){if(!0===f&&(--s,f=!1),u=void 0===u?{}:u,t<0||r<0||t>65535||r>65535)throw new Error("x/y invalid.");if(i<=0||n<=0||i>65535||n>65535)throw new Error("Width/Height invalid.");if(h.length<i*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&r,e[s++]=r>>8&255,e[s++]=255&i,e[s++]=i>>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,r,i){e[t++]=r;var s=t++,n=1<<r,a=n-1,o=n+1,h=o+1,u=r+1,l=0,c=0;function p(r){for(;l>=r;)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=i[0]&a,g={};d(n);for(var m=1,y=i.length;m<y;++m){var x=i[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=r+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 r=e[t++]|e[t++]<<8,i=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=r,this.height=i;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,i){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=r-u,c=u,p=4*(s.y*r+s.x),d=4*((s.y+s.height)*r+s.x),f=p,g=4*l;!0===s.interlaced&&(g+=4*r*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*r*(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];i[f++]=w,i[f++]=_,i[f++]=b,i[f++]=255}--c}},this.decodeAndBlitFrameRGBA=function(t,i){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=r-u,c=u,p=4*(s.y*r+s.x),d=4*((s.y+s.height)*r+s.x),f=p,g=4*l;!0===s.interlaced&&(g+=4*r*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*r*(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];i[f++]=b,i[f++]=_,i[f++]=w,i[f++]=255}--c}}}}catch(e){}function ks(e,t){t.createImage=function(t,r){return new e.Image(t,r)},t.saveCanvas=function(...e){let r,i,s,n,a;if(e[0]instanceof HTMLCanvasElement)r=e[0],e.shift();else if(e[0]instanceof Mi)r=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(),r=n._renderer.canvas,e.shift()}else r=this._curElement&&this._curElement.elt;switch(e.length>=1&&(i=e[0]),e.length>=2&&(s=e[1]),s=s||t._checkFileExtension(i,s)[1]||"png",s){default:a="image/png";break;case"webp":a="image/webp";break;case"jpeg":case"jpg":a="image/jpeg"}r.toBlob((e=>{t.downloadFile(e,i,s),n&&n.remove()}),a)},t.encodeAndDownloadGif=function(e,r){const i=e.gifProperties;let s=i.loopLimit;1===s?s=null:null===s&&(s=0);const n=new Uint8Array(e.width*e.height*i.numFrames),a=[],o={};for(let t=0;t<i.numFrames;t++){const r=new Set,s=i.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 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===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<i.numFrames;t++){const r=!h.has(t),s=r?[]:l,n=new Uint8Array(e.width*e.height),o={},u=new Set;a[t].forEach(((e,i)=>{r?(void 0===o[e]&&(o[e]=s.length,s.push(e)),n[i]=o[e]):n[i]=p[e],t>0&&a[t-1][i]!==e&&u.add(e)}));const c={},d=s.filter((e=>!u.has(e)));if(d.length>0){const e=d[0],i=r?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]=i);c.transparent=i,m.frameOpts.disposal=1}}if(c.delay=i.frames[t].delay/10,r){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,r,"gif")},t.saveFrames=function(e,r,i,s,n){let a=i||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,r,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,r){let i,s;if(i=this?this._curElement.elt:r,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=i.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 r=await fetch(e);if(r.ok){let e;switch(t){case"json":e=await r.json();break;case"text":e=await r.text();break;case"arrayBuffer":e=await r.arrayBuffer();break;case"blob":e=await r.blob();break;case"bytes":if(r.bytes)e=await r.bytes();else{const t=await r.arrayBuffer();e=new Uint8Array(t)}break;default:throw new Error("Unsupported response type")}return{data:e,headers:r.headers}}{const e=new Ps(r.statusText);throw e.status=r.status,e.response=r,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 r(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}t.loadJSON=async function(t,r,i){try{const{data:e}=await Os(t,"json");return r?r(e):e}catch(r){if(e._friendlyFileLoadError(5,t),i)return i(r);throw r}},t.loadStrings=async function(t,r,i){try{let{data:e}=await Os(t,"text");return e=e.split(/\r?\n/),r?r(e):e}catch(r){if(e._friendlyFileLoadError(3,t),i)return i(r);throw r}},t.loadTable=async function(t,r,i,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 r&&(r=","),"function"==typeof i&&(i=!1);try{let{data:n}=await Os(t,"text"),a=new e.Table;return n=function(e,t,r=e=>e){const i=Object.create(null);if(i.options=t||{},i.reviver=r,i.value="",i.entry=[],i.output=[],i.col=1,i.row=1,i.options.delimiter=void 0===i.options.delimiter?'"':t.delimiter,i.options.delimiter.length>1||0===i.options.delimiter.length)throw Error(`CSVError: delimiter must be one character [${i.options.separator}]`);if(i.options.separator=void 0===i.options.separator?",":t.separator,i.options.separator.length>1||0===i.options.separator.length)throw Error(`CSVError: separator must be one character [${i.options.separator}]`);const s=new RegExp(`${Ls(i.options.delimiter)}|${Ls(i.options.separator)}|\r\n|\n|\r|[^${Ls(i.options.delimiter)}${Ls(i.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===i.options.delimiter:h=3;break;case o===i.options.separator:h=0,Is(i);break;case n.test(o):h=0,Is(i),Bs(i);break;default:i.value+=o,h=2}break;case 2:switch(!0){case o===i.options.separator:h=0,Is(i);break;case n.test(o):h=0,Is(i),Bs(i);break;default:throw h=4,Error(`CSVError: Illegal state [row:${i.row}, col:${i.col}]`)}break;case 3:1==(o===i.options.delimiter)?h=4:(h=3,i.value+=o);break;case 4:switch(!0){case o===i.options.delimiter:h=3,i.value+=o;break;case o===i.options.separator:h=0,Is(i);break;case n.test(o):h=0,Is(i),Bs(i);break;default:throw Error(`CSVError: Illegal state [row:${i.row}, col:${i.col}]`)}}return 0!==i.entry.length&&(Is(i),Bs(i)),i.output}(n,{separator:r}),a.columns=i?n.shift():Array(n[0].length).fill(null),n.forEach((t=>{const r=new e.TableRow(t);a.addRow(r)})),s?s(a):a}catch(r){if(e._friendlyFileLoadError(2,t),n)return n(r);throw r}},t.loadXML=async function(t,r,i){try{const i=new DOMParser;let{data:s}=await Os(t,"text");const n=i.parseFromString(s,"application/xml");return s=new e.XML(n),r?r(s):s}catch(r){if(e._friendlyFileLoadError(1,t),i)return i(r);throw r}},t.loadBytes=async function(t,r,i){try{let{data:e}=await Os(t,"arrayBuffer");return e=new Uint8Array(e),r?r(e):e}catch(r){if(e._friendlyFileLoadError(6,t),i)return i(r);throw r}},t.loadBlob=async function(e,t,r){try{const{data:r}=await Os(e,"blob");return t?t(r):r}catch(e){if(r)return r(e);throw e}},t.httpGet=async function(e,t="text",r,i){return"function"==typeof t&&(i=r,r=t,t="text"),this.httpDo(e,"GET",t,r,i)},t.httpPost=async function(t,r,i="text",s,n){"function"==typeof r?(s=r,n=i,r=void 0,i="text"):"function"==typeof i&&(n=s,s=i,i="text");let a=r,o="text/plain";r instanceof e.XML?(a=r.serialize(),o="application/xml"):r instanceof e.Image?(a=await r.toBlob(),o="image/png"):"object"==typeof r&&(a=JSON.stringify(r),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",i,s,n)},t.httpDo=async function(e,t,r,i,s){if("function"==typeof r&&(s=i,i=r,r=void 0),!r){switch("string"==typeof e?e.split(".").pop():e.url.split(".").pop()){case"json":r="json";break;case"jpg":case"jpeg":case"png":case"webp":case"gif":r="blob";break;default:r="text"}}const n=new Request(e,{method:t});try{const{data:e}=await Os(n,r);return i?i(e):e}catch(e){if(s)return s(e);throw e}},t._pWriters=[],t.createWriter=function(r,i){let s;for(const n in t._pWriters)if(t._pWriters[n].name===r)return s=new e.PrintWriter(r+this.millis(),i),t._pWriters.push(s),s;return s=new e.PrintWriter(r,i),t._pWriters.push(s),s},e.PrintWriter=function(e,r){let i=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,r);for(const e in t._pWriters)t._pWriters[e].name===this.name&&t._pWriters.splice(e,1);i.clear(),i={}}},t.save=function(r,i,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($i(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,r){let i;i=r?JSON.stringify(e):JSON.stringify(e,void 0,2),this.saveStrings(i.split("\n"),t,"json")},t.saveStrings=function(t,r,i,s){const n=i||"txt",a=new e.PrintWriter(r,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,i){let s;void 0===i?(s=t.substring(t.lastIndexOf(".")+1,t.length),s===t&&(s="csv")):s=i;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=r(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 i=0;i<e.columns.length;i++){const s=r(e.rows[t].getString(i));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,r,i){let s="application/octet-stream";t._isSafari()&&(s="text/plain");const n=new Blob(e,{type:s});t.downloadFile(n,r,i)},t.downloadFile=ji,t._checkFileExtension=$i,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,r=new Uint8Array(e);return{get buffer(){return r.buffer},reset(){t=0},bytesView:()=>r.subarray(0,t),bytes:()=>r.slice(0,t),writeByte(e){i(t+1),r[t]=e,t++},writeBytes(e,s=0,n=e.length){i(t+n);for(let i=0;i<n;i++)r[t++]=e[i+s]},writeBytesView(e,s=0,n=e.byteLength){i(t+n),r.set(e.subarray(s,s+n),t),t+=n}};function i(e){var i=r.length;if(i>=e)return;e=Math.max(e,i*(i<1048576?2:1.125)>>>0),0!=i&&(e=Math.max(e,256));let s=r;r=new Uint8Array(e),t>0&&r.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,r,i,s=Vs(512),n=new Uint8Array(256),a=new Int32Array(5003),o=new Int32Array(5003)){let h=a.length,u=Math.max(2,i);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,_=r[0],w=0;for(let e=h;e<65536;e*=2)++w;w=8-w,s.writeByte(u),D(y);let C=r.length;for(let e=1;e<C;e++)e:{let t=r[e],i=(t<<12)+_,s=t<<w^_;if(a[s]===i){_=o[s];break e}let n=0===s?1:h-s;for(;a[s]>=0;)if(s-=n,s<0&&(s+=h),a[s]===i){_=o[s];break e}D(_),_=t,v<4096?(o[s]=v++,a[s]=i):(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,r){return e<<8&63488|t<<2&992|r>>3}function js(e,t,r,i){return e>>4|240&t|(240&r)<<4|(240&i)<<8}function $s(e,t,r){return e>>4<<8|240&t|r>>4}function Ws(e,t,r){return e<t?t:e>r?r:e}function qs(e){return e*e}function Hs(e,t,r){var i=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],r=t.cnt,n=a*r/(a+r);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,i=l)))}}n.err=s,n.nn=i}function Xs(e,t,r={}){let{format:i="rgb565",clearAlpha:s=!0,clearAlphaColor:n=0,clearAlphaThreshold:a=0,oneBitAlpha:o=!1}=r;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!==r.useSqrt,l="rgba4444"===i,c=function(e,t){let r=new Array("rgb444"===t?4096:65536),i=e.length;if("rgba4444"===t)for(let t=0;t<i;++t){let i=e[t],s=i>>24&255,n=i>>16&255,a=i>>8&255,o=255&i,h=js(o,a,n,s),u=h in r?r[h]:r[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<i;++t){let i=e[t],s=i>>16&255,n=i>>8&255,a=255&i,o=$s(a,n,s),h=o in r?r[o]:r[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<i;++t){let i=e[t],s=i>>16&255,n=i>>8&255,a=255&i,o=zs(a,n,s),h=o in r?r[o]:r[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 r}(h,i),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),r=Ws(Math.round(c[m].bc),0,255),i=255;if(l){if(i=Ws(Math.round(c[m].ac),0,255),o){i=i<=("number"==typeof o?o:127)?0:255}s&&i<=a&&(e=t=r=n,i=0)}let h=l?[e,t,r,i]:[e,t,r];if(Ys(F,h)||F.push(h),0==(m=c[m].fw))break}return F}function Ys(e,t){for(let r=0;r<e.length;r++){let i=e[r],s=i[0]===t[0]&&i[1]===t[1]&&i[2]===t[2],n=!(i.length>=4&&t.length>=4)||i[3]===t[3];if(s&&n)return!0}return!1}function Zs(e,t){var r,i=0;for(r=0;r<e.length;r++){let s=e[r]-t[r];i+=s*s}return i}function Ks(e,t,r=Zs){let i=1/0,s=-1;for(let n=0;n<e.length;n++){let a=r(t,e[n]);a<i&&(i=a,s=n)}return s}function Js(e={}){let{initialCapacity:t=4096,auto:r=!0}=e,i=Vs(t),s=new Uint8Array(256),n=new Int32Array(5003),a=new Int32Array(5003),o=!1;return{reset(){i.reset(),o=!1},finish(){i.writeByte(Rs)},bytes:()=>i.bytes(),bytesView:()=>i.bytesView(),get buffer(){return i.buffer},get stream(){return i},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(r?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,r,i,s=8){let n=1,a=0,o=rn(i.length)-1,h=n<<7|s-1<<4|a<<3|o,u=0,l=0;en(e,t),en(e,r),e.writeBytes([h,u,l])})(i,t,u,f,m),Qs(i,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)}(i,g)}let v=Math.round(d/10);!function(e,t,r,i,s){var n,a;e.writeByte(33),e.writeByte(249),e.writeByte(4),s<0&&(s=0,i=!1),i?(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,r),e.writeByte(s||0),e.writeByte(0)}(i,y,v,c,p);let b=Boolean(f)&&!x;(function(e,t,r,i){if(e.writeByte(44),en(e,0),en(e,0),en(e,t),en(e,r),i){let t=0,r=0,s=rn(i.length)-1;e.writeByte(128|t|r|s)}else e.writeByte(0)})(i,t,u,b?f:null),b&&Qs(i,f),function(e,t,r,i,s=8,n,a,o){Gs(r,i,t,s,e,n,a,o)}(i,e,t,u,m,s,n,a)}};function h(){tn(i,"GIF89a")}}function Qs(e,t){let r=1<<rn(t.length);for(let i=0;i<r;i++){let r=[0,0,0];i<t.length&&(r=t[i]),e.writeByte(r[0]),e.writeByte(r[1]),e.writeByte(r[2])}}function en(e,t){e.writeByte(255&t),e.writeByte(t>>8&255)}function tn(e,t){for(var r=0;r<t.length;r++)e.writeByte(t.charCodeAt(r))}function rn(e){return Math.max(Math.ceil(Math.log2(e)),1)}function sn(e,t){function r(e,t,r){const i=parseInt(r/2),s=4*t,n=new Uint8Array(4*t);for(let t=0;t<i;++t){const i=t*s,a=(r-t-1)*s;n.set(e.subarray(i,i+s)),e.copyWithin(i,a,a+s),e.set(n,a)}return e}function i(e,t,r,i,s,n,a,o,h,u,l){if(e===Me){const{x:e,y:i,w:s,h:c}=function(e,t,r,i,s,n,a,o){const h=Math.max(r/a,i/o),[u,l]=[r/h,i/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,r,n,a,o,h,u,l);o=e,h=i,u=s,l=c}if(e===Te){const{x:e,y:o,w:h,h:c}=function(e,t,r,i,s,n,a,o){const h=Math.max(a/s,o/n),[u,l]=[a/h,o/h];let c=r,p=i;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,r,i,s,n,a,u,l);i=e,s=o,n=h,a=c}return{sx:o,sy:h,sw:u,sh:l,dx:i,dy:s,dw:n,dh:a}}function s(e,t){return e>0&&e<t?e:t}t.loadImage=async function(t,r,i){try{let i=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,r){const i=new ws(t);r.width=r.canvas.width=i.width,r.height=r.canvas.height=i.height;const s=[],n=i.numFrames();let a=new Uint8ClampedArray(r.width*r.height*4);const o=(t,i)=>{try{i.decodeAndBlitFrameRGBA(t,a)}catch(t){throw e._friendlyFileLoadError(8,r.src),t}};for(let e=0;e<n;e++){const t=i.frameInfo(e),n=r.drawingContext.getImageData(0,0,r.width,r.height);a=n.data.slice(),o(e,i);const h=new ImageData(a,r.width,r.height);r.drawingContext.putImageData(h,0,0);let u=t.delay;0===u&&(u=10),s.push({image:r.drawingContext.getImageData(0,0,r.width,r.height),delay:10*u}),2===t.disposal?r.drawingContext.clearRect(t.x,t.y,t.width,t.height):3===t.disposal&&r.drawingContext.putImageData(n,0,0,t.x,t.y,t.width,t.height)}let h=i.loopCount();null===h?h=1:0===h&&(h=null);r.drawingContext.putImageData(s[0].image,0,0),s.length>1&&(r.gifProperties={displayIndex:0,loopLimit:h,loopCount:0,frames:s,numFrames:n,playing:!0,timeDisplayed:0,lastChangeTime:0});return r}(n,i);else{const e=new Blob([n]),t=await createImageBitmap(e);i.width=i.canvas.width=t.width,i.height=i.canvas.height=t.height,i.drawingContext.drawImage(t,0,0)}return i.modified=!0,r?r(i):i}catch(r){if(e._friendlyFileLoadError(0,t),"function"==typeof i)return i(r);throw r}},t.saveGif=async function(i,s,n={delay:0,units:"seconds",silent:!1,notificationDuration:0,notificationID:"progressBar"}){if("string"!=typeof i)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=r(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 r=0;r<e.length;r++)t.set(e[r],r*e[0].length);let r=Xs(t,256,{format:"rgba4444",oneBitAlpha:!0});256===r.length?r[r.length-1]=[255*Math.random(),255*Math.random(),255*Math.random(),0]:r.push([255*Math.random(),255*Math.random(),255*Math.random(),0]);return r}(_),D={},E=e=>{const t=e.length/4,r=new Uint8Array(t);for(let i=0;i<t;i++){const t=e[4*i]<<24|e[4*i+1]<<16|e[4*i+2]<<8|e[4*i+3];void 0===D[t]&&(D[t]=Ks(C,e.slice(4*i,4*(i+1)))),r[i]=D[t]}return r},A=C.length-1;let S=[];for(let e=0;e<_.length;e++){const t=E(_[e]),r=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=r,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,i,"gif")},t.image=function(e,t,r,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=r,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=i(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 r,i,s,n,a,o,h,u,l;if(9===e.length)r=e[0],i=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");r=this,i=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,r,i,s,n,a,o,h,u,l)},t._copyHelper=(e,t,r,i,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,r+c,i+p,s,n,a,o,h,u),e.pop()):e.drawingContext.drawImage(t.canvas,l*(r+c),l*(i+p),l*s,l*n,a,o,h,u)},t.getFilterGraphicsLayer=function(){return this._renderer.getFilterGraphicsLayer()},t.filter=function(...t){let{shader:r,operation:i,value:s,useWebGL:n}=function(...t){let r={shader:void 0,operation:void 0,value:void 0,useWebGL:!0};if(t[0]instanceof e.Shader)return r.shader=t[0],r;r.operation=t[0];t.length>1&&"number"==typeof t[1]&&(r.value=t[1]);!1===t[t.length-1]&&(r.useWebGL=!1);return r}(...t);this._renderer.isP3D&&r?this._renderer.filter(r):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(i,s):(r?this._renderer.filterRenderer.setOperation(i,s,r):this._renderer.filterRenderer.setOperation(i,s),this._renderer.filterRenderer.applyFilter())):void 0!==this.canvas?Ii.apply(this.canvas,Ii[i],s):Ii.apply(this.elt,Ii[i],s)},t.get=function(e,t,r,i){return this._renderer.get(...arguments)},t.loadPixels=function(...e){this._renderer.loadPixels()},t.set=function(e,t,r){this._renderer.set(e,t,r)},t.updatePixels=function(e,t,r,i){0!==this.pixels.length&&this._renderer.updatePixels(e,t,r,i)}}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 r=0;r<this.#m;r++)t.push(this.matrix[r*this.#m+e]);return new je(...t)}column(e){const t=[];for(let r=0;r<this.#m;r++)t.push(this.matrix[e*this.#m+r]);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 r=0;r<this.#m;r++)t.values[r]=this.row(r).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 r=this.matrix,i=r[0],s=r[4],n=r[8],a=r[12];r[0]=t[0]*i+t[1]*s+t[2]*n+t[3]*a,r[4]=t[4]*i+t[5]*s+t[6]*n+t[7]*a,r[8]=t[8]*i+t[9]*s+t[10]*n+t[11]*a,r[12]=t[12]*i+t[13]*s+t[14]*n+t[15]*a;const o=r[1],h=r[5],u=r[9],l=r[13];r[1]=t[0]*o+t[1]*h+t[2]*u+t[3]*l,r[5]=t[4]*o+t[5]*h+t[6]*u+t[7]*l,r[9]=t[8]*o+t[9]*h+t[10]*u+t[11]*l,r[13]=t[12]*o+t[13]*h+t[14]*u+t[15]*l;const c=r[2],p=r[6],d=r[10],f=r[14];r[2]=t[0]*c+t[1]*p+t[2]*d+t[3]*f,r[6]=t[4]*c+t[5]*p+t[6]*d+t[7]*f,r[10]=t[8]*c+t[9]*p+t[10]*d+t[11]*f,r[14]=t[12]*c+t[13]*p+t[14]*d+t[15]*f;const g=r[3],m=r[7],y=r[11],x=r[15];return r[3]=t[0]*g+t[1]*m+t[2]*y+t[3]*x,r[7]=t[4]*g+t[5]*m+t[6]*y+t[7]*x,r[11]=t[8]*g+t[9]*m+t[10]*y+t[11]*x,r[15]=t[12]*g+t[13]*m+t[14]*y+t[15]*x,this}scale(e,t,r){return e instanceof je?(t=e.y,r=e.z,e=e.x):e instanceof Array&&(t=e[1],r=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]*=r,this.matrix[9]*=r,this.matrix[10]*=r,this.matrix[11]*=r,this}rotate4x4(e,t,r,i){t instanceof je?(r=t.y,i=t.z,t=t.x):t instanceof Array&&(r=t[1],i=t[2],t=t[0]);const s=Math.sqrt(t*t+r*r+i*i);t*=1/s,r*=1/s,i*=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,_=r*t*v+i*y,w=i*t*v-r*y,C=t*r*v-i*y,D=r*r*v+x,E=i*r*v+t*y,A=t*i*v+r*y,S=r*i*v-t*y,F=i*i*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],r=e[1],i=e[2]||0;return this.matrix[12]+=this.matrix[0]*t+this.matrix[4]*r+this.matrix[8]*i,this.matrix[13]+=this.matrix[1]*t+this.matrix[5]*r+this.matrix[9]*i,this.matrix[14]+=this.matrix[2]*t+this.matrix[6]*r+this.matrix[10]*i,this.matrix[15]+=this.matrix[3]*t+this.matrix[7]*r+this.matrix[11]*i,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,r,i){const s=1/Math.tan(e/2),n=1/(r-i);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]=(i+r)*n,this.matrix[11]=-1,this.matrix[12]=0,this.matrix[13]=0,this.matrix[14]=2*i*r*n,this.matrix[15]=0,this}ortho(e,t,r,i,s,n){const a=1/(e-t),o=1/(r-i),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]=(i+r)*o,this.matrix[14]=(n+s)*h,this.matrix[15]=1,this}multiplyVec4(e,t,r,i){const s=new Array(4),n=this.matrix;return s[0]=n[0]*e+n[4]*t+n[8]*r+n[12]*i,s[1]=n[1]*e+n[5]*t+n[9]*r+n[13]*i,s[2]=n[2]*e+n[6]*t+n[10]*r+n[14]*i,s[3]=n[3]*e+n[7]*t+n[11]*r+n[15]*i,s}multiplyPoint({x:e,y:t,z:r}){const i=this.multiplyVec4(e,t,r,1);return new je(i[0],i[1],i[2])}multiplyAndNormalizePoint({x:e,y:t,z:r}){const i=this.multiplyVec4(e,t,r,1);return i[0]/=i[3],i[1]/=i[3],i[2]/=i[3],new je(i[0],i[1],i[2])}multiplyDirection({x:e,y:t,z:r}){const i=this.multiplyVec4(e,t,r,0);return new je(i[0],i[1],i[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 r=0;r<e;r++)t[r*e+r]=1;return t}#_(e){let t=this.matrix[0],r=this.matrix[1],i=this.matrix[2],s=this.matrix[3];return this.matrix[0]=t*e[0]+r*e[4]+i*e[8]+s*e[12],this.matrix[1]=t*e[1]+r*e[5]+i*e[9]+s*e[13],this.matrix[2]=t*e[2]+r*e[6]+i*e[10]+s*e[14],this.matrix[3]=t*e[3]+r*e[7]+i*e[11]+s*e[15],t=this.matrix[4],r=this.matrix[5],i=this.matrix[6],s=this.matrix[7],this.matrix[4]=t*e[0]+r*e[4]+i*e[8]+s*e[12],this.matrix[5]=t*e[1]+r*e[5]+i*e[9]+s*e[13],this.matrix[6]=t*e[2]+r*e[6]+i*e[10]+s*e[14],this.matrix[7]=t*e[3]+r*e[7]+i*e[11]+s*e[15],t=this.matrix[8],r=this.matrix[9],i=this.matrix[10],s=this.matrix[11],this.matrix[8]=t*e[0]+r*e[4]+i*e[8]+s*e[12],this.matrix[9]=t*e[1]+r*e[5]+i*e[9]+s*e[13],this.matrix[10]=t*e[2]+r*e[6]+i*e[10]+s*e[14],this.matrix[11]=t*e[3]+r*e[7]+i*e[11]+s*e[15],t=this.matrix[12],r=this.matrix[13],i=this.matrix[14],s=this.matrix[15],this.matrix[12]=t*e[0]+r*e[4]+i*e[8]+s*e[12],this.matrix[13]=t*e[1]+r*e[5]+i*e[9]+s*e[13],this.matrix[14]=t*e[2]+r*e[6]+i*e[10]+s*e[14],this.matrix[15]=t*e[3]+r*e[7]+i*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 r=0;r<this.#m;r++)for(let i=0;i<this.#m;i++)for(let s=0;s<this.#m;s++)t[r*this.#m+i]+=this.matrix[r*this.#m+s]*e[s*this.#m+i];return this.matrix=t,this}#w(e){let t=this.mat3[0],r=this.mat3[1],i=this.mat3[2];return this.mat3[0]=t*e[0]+r*e[3]+i*e[6],this.mat3[1]=t*e[1]+r*e[4]+i*e[7],this.mat3[2]=t*e[2]+r*e[5]+i*e[8],t=this.mat3[3],r=this.mat3[4],i=this.mat3[5],this.mat3[3]=t*e[0]+r*e[3]+i*e[6],this.mat3[4]=t*e[1]+r*e[4]+i*e[7],this.mat3[5]=t*e[2]+r*e[5]+i*e[8],t=this.mat3[6],r=this.mat3[7],i=this.mat3[8],this.mat3[6]=t*e[0]+r*e[3]+i*e[6],this.mat3[7]=t*e[1]+r*e[4]+i*e[7],this.mat3[8]=t*e[2]+r*e[5]+i*e[8],this}#b(){const e=this.#m;for(let t=0;t<e;t++)for(let r=0;r<e;r++)this.matrix[t*e+r]=this.matrix[r*e+t];return this}#x(e){let t,r,i,s,n,a;return console.log("====> 4x4"),e instanceof ln?(t=e.matrix[1],r=e.matrix[2],i=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]=r,this.matrix[9]=s,this.matrix[10]=e.matrix[10],this.matrix[11]=e.matrix[14],this.matrix[12]=i,this.matrix[13]=n,this.matrix[14]=a,this.matrix[15]=e.matrix[15]):un(e)&&(t=e[1],r=e[2],i=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]=r,this.matrix[9]=s,this.matrix[10]=e[10],this.matrix[11]=e[14],this.matrix[12]=i,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],r=e[2],i=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]=r,this.mat3[7]=i,this.mat3[8]=e[8],this}#D(e){let t,r,i,s,n,a,o,h,u,l,c,p,d,f,g,m;e instanceof ln?(t=e.matrix[0],r=e.matrix[1],i=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],r=e[1],i=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-r*n,x=t*o-i*n,v=t*h-s*n,b=r*o-i*a,_=r*h-s*a,w=i*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]=(i*S-r*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-i*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]=(r*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-r*D+i*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],r=this.mat3[2],i=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*i+n*a,c=o*i-s*a;let p=e*u+t*l+r*c;return p?(p=1/p,this.mat3[0]=u*p,this.mat3[1]=(-h*t+r*o)*p,this.mat3[2]=(n*t-r*s)*p,this.mat3[3]=l*p,this.mat3[4]=(h*e-r*a)*p,this.mat3[5]=(-n*e+r*i)*p,this.mat3[6]=c*p,this.mat3[7]=(-o*e+t*a)*p,this.mat3[8]=(s*e-t*i)*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],r=this.matrix[0]*this.matrix[7]-this.matrix[3]*this.matrix[4],i=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+r*u+i*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,r,i){this.renderer=i,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++,r instanceof Function&&r.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 r=0;r<this.vertices.length;r++){let i=this.vertices[r];e.x=Math.min(e.x,i.x),e.y=Math.min(e.y,i.y),e.z=Math.min(e.z,i.z),t.x=Math.max(t.x,i.x),t.y=Math.max(t.y,i.y),t.z=Math.max(t.z,i.z)}let r=new je(t.x-e.x,t.y-e.y,t.z-e.z),i=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:r,offset:i},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 r="f";e.forEach((e=>{r+=" ",r+=e+1,(this.vertexNormals.length>0||this.uvs.length>0)&&(r+="/",this.uvs.length>0&&(r+=e+1),r+="/",this.vertexNormals.length>0&&(r+=e+1))})),t+=r+"\n"}));const r=new Blob([t],{type:"text/plain"});fn.downloadFile(r,e,"obj")}saveStl(e="model.stl",{binary:t=!1}={}){let r,i=e.substring(0,e.lastIndexOf(".")),s=[];for(let e of this.faces){const t=je.sub(this.vertices[e[1]],this.vertices[e[0]]),r=je.sub(this.vertices[e[2]],this.vertices[e[0]]),i=t.y*r.z-t.z*r.y,n=t.z*r.x-t.x*r.z,a=t.x*r.y-t.y*r.x;s.push(new je(i,n,a).normalize())}if(t){let e=80;const t=2*this.faces.length+3*this.faces.length*4*4+80+4,i=new ArrayBuffer(t);r=new DataView(i),r.setUint32(e,this.faces.length,!0),e+=4;for(const[t,i]of Object.entries(this.faces)){const n=s[t];r.setFloat32(e,n.x,!0),e+=4,r.setFloat32(e,n.y,!0),e+=4,r.setFloat32(e,n.z,!0),e+=4;for(let t of i){const i=this.vertices[t];r.setFloat32(e,i.x,!0),e+=4,r.setFloat32(e,i.y,!0),e+=4,r.setFloat32(e,i.z,!0),e+=4}r.setUint16(e,0,!0),e+=2}}else{r="solid "+i+"\n";for(const[e,t]of Object.entries(this.faces)){const i=s[e];r+=" facet norm "+i.x+" "+i.y+" "+i.z+"\n",r+=" outer loop\n";for(let e of t){const t=this.vertices[e];r+=" vertex "+t.x+" "+t.y+" "+t.z+"\n"}r+=" endloop\n",r+=" endfacet\n"}r+="endsolid "+i+"\n"}const n=new Blob([r],{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,r,i,s;for(let n=0;n<this.detailY;n++)for(let a=0;a<this.detailX;a++)t=n*e+a,r=n*e+a+1,i=(n+1)*e+a+1,s=(n+1)*e+a,this.faces.push([t,r,s]),this.faces.push([s,r,i]);return this}_getFaceNormal(e){const t=this.faces[e],r=this.vertices[t[0]],i=this.vertices[t[1]],s=this.vertices[t[2]],n=je.sub(i,r),a=je.sub(s,r),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 r=this.vertexNormals;let i=this.vertices;const s=this.faces;let n;if(e===De){const e={},r=[],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<i.length;t++){const s=i[t],n=o(s);void 0===e[n]&&(e[n]=r.length,r.push(s))}s.forEach((t=>{for(let r=0;r<3;++r){const s=t[r],n=i[s],a=o(n);t[r]=e[a]}})),this.edges.forEach((t=>{for(let r=0;r<2;++r){const s=t[r],n=i[s],a=o(n);t[r]=e[a]}})),this.vertices=i=r}for(r.length=0,n=0;n<i.length;++n)r.push(new je);for(s.forEach(((e,t)=>{const i=this._getFaceNormal(t);for(let t=0;t<3;++t){const s=e[t];r[s].add(i)}})),n=0;n<i.length;++n)r[n].normalize();return this}averageNormals(){for(let e=0;e<=this.detailY;e++){const t=this.detailX+1;let r=je.add(this.vertexNormals[e*t],this.vertexNormals[e*t+this.detailX]);r=je.div(r,2),this.vertexNormals[e*t]=r,this.vertexNormals[e*t+this.detailX]=r}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 r;for(let i=0;i<this.edges.length;i++){const s=this.edges[i-1],n=this.edges[i],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(i>0&&s[1]===n[0])t.has(n[0])||(t.add(n[0]),e.delete(n[0]),r&&p&&c.dot(r)<1-1e-8&&this._addJoin(a,r,c,u));else{if(p&&!t.has(n[0])){const r=e.get(n[0]);r?(this._addJoin(a,r.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(r&&!t.has(s[1])){const i=e.get(s[1]);i?(this._addJoin(this.vertices[s[1]],r,i.dir.copy().mult(-1),h),e.delete(s[1]),t.add(s[1])):e.set(s[1],{point:this.vertices[s[1]],dir:r,color:h}),r=void 0}}if(i===this.edges.length-1&&!t.has(n[1])){const r=e.get(n[1]);r?(this._addJoin(o,c,r.dir.copy().mult(-1),l),e.delete(n[1]),t.add(n[1])):e.set(n[1],{point:o,dir:c,color:l})}p&&(r=c)}}for(const{point:t,dir:r,color:i}of e.values())this._addCap(t,r,i);return this}_addSegment(e,t,r,i,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(...r,...i,...r,...i,...i,...r),this}_addCap(e,t,r){const i=e.array(),s=t.array(),n=[0,0,0];for(let e=0;e<6;e++)this.lineVertices.push(...i),this.lineTangentsIn.push(...s),this.lineTangentsOut.push(...n),this.lineVertexColors.push(...r);return this.lineSides.push(-1,2,-2,1,2,-1),this}_addJoin(e,t,r,i){const s=e.array(),n=t.array(),a=r.array();for(let e=0;e<12;e++)this.lineVertices.push(...s),this.lineTangentsIn.push(...n),this.lineTangentsOut.push(...a),this.lineVertexColors.push(...i);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 r=0;r<this.vertices.length;r++)e.x=Math.max(e.x,this.vertices[r].x),t.x=Math.min(t.x,this.vertices[r].x),e.y=Math.max(e.y,this.vertices[r].y),t.y=Math.min(t.y,this.vertices[r].y),e.z=Math.max(e.z,this.vertices[r].z),t.z=Math.min(t.z,this.vertices[r].z);const r=je.lerp(e,t,.5),i=je.sub(e,t),s=200/Math.max(Math.max(i.x,i.y),i.z);for(let e=0;e<this.vertices.length;e++)this.vertices[e].sub(r),this.vertices[e].mult(s)}return this}vertexProperty(e,t,r){let i;this.userVertexProperties[e]||(i=this.userVertexProperties[e]=this._userVertexPropertyHelper(e,t,r)),i=this.userVertexProperties[e],r?i.pushDirect(t):(i.setCurrentData(t),i.pushCurrentData())}_userVertexPropertyHelper(e,t,r){const i=this.userVertexProperties[e]={name:e,dataSize:r||(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[i.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 r=e.userVertexProperties,i=this.geometry.userVertexProperties,s=this.geometry.vertices.length-e.vertices.length;for(const t in i){if(t in r)continue;const s=i[t],n=s.getDataSize()*e.vertices.length,a=Array(n).fill(0);s.pushDirect(a)}for(const e in r){const t=r[e],n=t.getSrcArray(),a=t.getDataSize();if(s>0&&!(e in i)){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 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 for(let t=0;t<e.vertices.length;t+=3)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}}yn.nextGeometryId=0;class xn{constructor(e,t,r,i){this.w=e,this.vec=new je(t,r,i)}static fromAxisAngle(e,t,r,i){const s=Math.cos(e/2),n=new je(t,r,i).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,r,i){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===r&&(r=this.defaultCameraNear),void 0===i&&(i=this.defaultCameraFar),r<=1e-4&&(r=.01,console.log("Avoid perspective near plane values close to or below 0. Setting value to 0.01.")),i<r&&console.log("Perspective far plane value is less than near plane value. Nothing will be shown."),this.aspectRatio=t,this.cameraNear=r,this.cameraFar=i,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,(i+r)*n,-1,0,0,2*i*r*n,0),this._isActive()&&(this._renderer.states.setValue("uPMatrix",this._renderer.states.uPMatrix.clone()),this._renderer.states.uPMatrix.set(this.projMatrix))}ortho(e,t,r,i,s,n){const a=this.fbo||this._renderer;void 0===e&&(e=-a.width/2),void 0===t&&(t=+a.width/2),void 0===r&&(r=-a.height/2),void 0===i&&(i=+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=i-r,u=n-s,l=2/o,c=2/h*this.yScale,p=-2/u,d=-(t+e)/o,f=-(i+r)/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,r,i,s,n){void 0===e&&(e=.05*-this._renderer.width),void 0===t&&(t=.05*+this._renderer.width),void 0===r&&(r=.05*+this._renderer.height),void 0===i&&(i=.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=i-r,h=n-s,u=2*s/a,l=2*s/o*this.yScale,c=-2*n*s/h,p=(t+e)/a,d=(i+r)/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,r,i){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,r,i);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(),r=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,r.x,r.y,r.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,r){this.camera(this.eyeX,this.eyeY,this.eyeZ,e,t,r,this.upX,this.upY,this.upZ)}camera(e,t,r,i,s,n,a,o,h){void 0===e&&(e=this.defaultEyeX,t=this.defaultEyeY,r=this.defaultEyeZ,i=e,s=t,n=0,a=0,o=1,h=0),this.eyeX=e,this.eyeY=t,this.eyeZ=r,void 0!==i&&(this.centerX=i,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=-r;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,r){const i=this._getLocalAxes(),s=[i.x[0]*e,i.x[1]*e,i.x[2]*e],n=[i.y[0]*t,i.y[1]*t,i.y[2]*t],a=[i.z[0]*r,i.z[1]*r,i.z[2]*r];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,r){const i=e-this.eyeX,s=t-this.eyeY,n=r-this.eyeZ;this.camera(e,t,r,this.centerX+i,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 r of t)this[r]=e[r];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,r){if(0===r)return void this.set(e);if(1===r)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],r)),this.projMatrix.setElement(5,e.projMatrix.mat4[5]*Math.pow(t.projMatrix.mat4[5]/e.projMatrix.mat4[5],r)),this._isActive()&&(this._renderer.states.setValue("uPMatrix",this._renderer.states.uPMatrix.clone()),this._renderer.states.uPMatrix.mat4=this.projMatrix.mat4.slice()));const i=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(i,n),h=je.dist(s,a),u=o*Math.pow(h/o,r),l=je.sub(i,s),c=i.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(i,n,d),je.lerp(s,a,d),r),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,r)).normalize(),C.set(_).mult(d*u).add(f),D.set(_).mult((d-1)*u).add(f),w.set(je.lerp(v,b,r)).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=r*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,r=this.eyeZ-this.centerZ;const i=Math.sqrt(e*e+t*t+r*r);0!==i&&(e/=i,t/=i,r/=i);let s=this.upX,n=this.upY,a=this.upZ,o=n*r-a*t,h=-s*r+a*e,u=s*t-n*e;s=t*u-r*h,n=-e*u+r*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,r]}}_orbit(e,t,r){const i=this.eyeX-this.centerX,s=this.eyeY-this.centerY,n=this.eyeZ-this.centerZ;let a=Math.hypot(i,s,n);const o=new je(i,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,r),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,r){const i=this.eyeX-this.centerX,s=this.eyeY-this.centerY,n=this.eyeZ-this.centerZ;let a=Math.hypot(i,s,n);const o=new je(i,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,r),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,r,i,s,n){this.size=e,this.src=t,this.dst=r,this.attr=i,this._renderer=s,this.map=n}_prepareBuffer(e,t){const r=t.attributes,i=this._renderer.GL,s=this._renderer._getOrMakeCachedBuffers(e),n=r[this.attr];if(!n)return;let a=s[this.dst];const o=e[this.src];if(o&&o.length>0){const r=!a;if(r&&(s[this.dst]=a=i.createBuffer()),i.bindBuffer(i.ARRAY_BUFFER,a),r||!1!==e.dirtyFlags[this.src]){const t=this.map,r=t?t(o):o;this._renderer._bindBuffer(a,i.ARRAY_BUFFER,r),e.dirtyFlags[this.src]=!1}t.enableAttrib(n,this.size)}else{const e=n.location;if(-1===e||!this._renderer.registerEnabled.has(e))return;i.disableVertexAttribArray(e),this._renderer.registerEnabled.delete(e)}}}function Cn(e,t){e.RenderBuffer=wn}void 0!==p5&&Cn(p5);class Dn{constructor(e,t,r,i={}){this._renderer=e,this._vertSrc=t,this._fragSrc=r,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:i.uniforms||{},declarations:i.declarations,helpers:i.helpers||{},vertex:i.vertex||{},fragment:i.fragment||{},modified:{vertex:i.modified&&i.modified.vertex||{},fragment:i.modified&&i.modified.fragment||{}}}}hookTypes(e){let t=this._vertSrc,r=this.hooks.vertex[e];if(r||(r=this.hooks.fragment[e],t=this._fragSrc),!r)throw new Error(`Can't find hook ${e}!`);const i=e.split(/\s+/g),s=i.pop(),n=i.pop(),a=[...i],o=/\(([^\)]*)\)/.exec(r);if(!o)throw new Error(`Couldn't find function parameters in hook body:\n${r}`);const h=e=>{const r=new RegExp(`struct\\s+${e}\\s*{([^}]*)}`).exec(t);if(!r)return;const i=[];for(const e of r[1].split(";")){const t=e.trim().split(/\s+|,/g),r=t.shift(),s=[...t],n=h(r);for(const e of s)i.push({name:e,type:{typeName:r,qualifiers:[],properties:n}})}return i},u=o[1].split(",").map((e=>{const t=e.trim().split(/\s+/g),r=t.pop(),i=t.pop();return{name:r,type:{typeName:i,qualifiers:[...t],properties:h(i)}}}));return{name:s,returnType:{typeName:n,qualifiers:a,properties:h(n)},parameters:u}}shaderSrc(e,t){const r="void main";let[i,s]=e.split(r),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[r,i]=e.split(" ");this.hooks.modified[t][e]&&(a+="#define AUGMENTED_HOOK_"+i+"\n"),n+=r+" HOOK_"+i+this.hooks[t][e]+"\n"}return-1!==i.indexOf("#define HOOK_DEFINES")&&(i=i.replace("#define HOOK_DEFINES","\n"+a+"\n"),a=""),i+"\n"+a+n+r+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 r in e)"declarations"!==r&&"uniforms"!==r&&("vertexDeclarations"===r?t.vertex.declarations=(t.vertex.declarations||"")+"\n"+e[r]:"fragmentDeclarations"===r?t.fragment.declarations=(t.fragment.declarations||"")+"\n"+e[r]:this.hooks.vertex[r]?t.vertex[r]=e[r]:this.hooks.fragment[r]?t.fragment[r]=e[r]:t.helpers[r]=e[r]);const r=Object.assign({},this.hooks.modified.vertex),i=Object.assign({},this.hooks.modified.fragment);for(const e in t.vertex||{})"declarations"!==e&&(r[e]=!0);for(const e in t.fragment||{})"declarations"!==e&&(i[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:r,fragment:i}})}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(" "),r=this.hooks.uniforms[e];let i;i=r instanceof Function?r():r,null!=i&&this.setUniform(t,i)}}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 r=0;r<t;++r){const t=e.getActiveAttrib(this._glProgram,r),i=t.name,s=e.getAttribLocation(this._glProgram,i),n={};n.name=i,n.location=s,n.index=r,n.type=t.type,n.size=t.size,this.attributes[i]=n}this._loadedAttributes=!0}_loadUniforms(){if(this._loadedUniforms)return;const e=this._renderer.GL,t=e.getProgramParameter(this._glProgram,e.ACTIVE_UNIFORMS);let r=0;for(let i=0;i<t;++i){const t=e.getActiveUniform(this._glProgram,i),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=r,r++,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 r of this.samplers){let i=r.texture;void 0===i&&(r.texture=i=t),e.activeTexture(e.TEXTURE0+r.samplerIndex),i.bindTexture(),i.update(),e.uniform1i(r.location,r.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 r of this.samplers)r.texture?.isFramebufferTexture&&(e.activeTexture(e.TEXTURE0+r.samplerIndex),t.bindTexture(),e.uniform1i(r.location,r.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 r=this.uniforms[e];if(!r)return;const i=this._renderer.GL;if(r.isArray){if(r._cachedData&&this._renderer._arraysEqual(r._cachedData,t))return;r._cachedData=t.slice(0)}else{if(r._cachedData&&r._cachedData===t)return;Array.isArray(t)?r._cachedData=t.slice(0):r._cachedData=t}const s=r.location;switch(this.useProgram(),r.type){case i.BOOL:!0===t?i.uniform1i(s,1):i.uniform1i(s,0);break;case i.INT:r.size>1?t.length&&i.uniform1iv(s,t):i.uniform1i(s,t);break;case i.FLOAT:r.size>1?t.length&&i.uniform1fv(s,t):i.uniform1f(s,t);break;case i.FLOAT_MAT3:i.uniformMatrix3fv(s,!1,t);break;case i.FLOAT_MAT4:i.uniformMatrix4fv(s,!1,t);break;case i.FLOAT_VEC2:r.size>1?t.length&&i.uniform2fv(s,t):i.uniform2f(s,t[0],t[1]);break;case i.FLOAT_VEC3:r.size>1?t.length&&i.uniform3fv(s,t):i.uniform3f(s,t[0],t[1],t[2]);break;case i.FLOAT_VEC4:r.size>1?t.length&&i.uniform4fv(s,t):i.uniform4f(s,t[0],t[1],t[2],t[3]);break;case i.INT_VEC2:r.size>1?t.length&&i.uniform2iv(s,t):i.uniform2i(s,t[0],t[1]);break;case i.INT_VEC3:r.size>1?t.length&&i.uniform3iv(s,t):i.uniform3i(s,t[0],t[1],t[2]);break;case i.INT_VEC4:r.size>1?t.length&&i.uniform4iv(s,t):i.uniform4i(s,t[0],t[1],t[2],t[3]);break;case i.SAMPLER_2D:if("number"==typeof t){if(t<i.TEXTURE0||t>i.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;i.activeTexture(t),i.uniform1i(s,t)}else i.activeTexture(i.TEXTURE0+r.samplerIndex),r.texture=t instanceof ua?t:this._renderer.getTexture(t),i.uniform1i(s,r.samplerIndex),r.texture.src.gifProperties&&r.texture.src._animateGif(this._renderer._pInst);break;case i.SAMPLER_CUBE:case i.SAMPLER_3D:case i.SAMPLER_2D_SHADOW:case i.SAMPLER_2D_ARRAY:case i.SAMPLER_2D_ARRAY_SHADOW:case i.SAMPLER_CUBE_SHADOW:case i.INT_SAMPLER_2D:case i.INT_SAMPLER_3D:case i.INT_SAMPLER_CUBE:case i.INT_SAMPLER_2D_ARRAY:case i.UNSIGNED_INT_SAMPLER_2D:case i.UNSIGNED_INT_SAMPLER_3D:case i.UNSIGNED_INT_SAMPLER_CUBE:case i.UNSIGNED_INT_SAMPLER_2D_ARRAY:if("number"!=typeof t)break;if(t<i.TEXTURE0||t>i.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}i.activeTexture(t),i.uniform1i(s,t)}return this}enableAttrib(e,t,r,i,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,r||e.FLOAT,i||!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 r(e,t){return e.b===t.b&&e.a===t.a}function i(e,t){return e.b<t.b||e.b===t.b&&e.a<=t.a}function s(e,t,r){var i=t.b-e.b,s=r.b-t.b;return 0<i+s?i<s?t.a-e.a+i/(i+s)*(e.a-r.a):t.a-r.a+s/(i+s)*(r.a-e.a):0}function n(e,t,r){var i=t.b-e.b,s=r.b-t.b;return 0<i+s?(t.a-r.a)*i+(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,r){var i=t.a-e.a,s=r.a-t.a;return 0<i+s?i<s?t.b-e.b+i/(i+s)*(e.b-r.b):t.b-r.b+s/(i+s)*(r.b-e.b):0}function h(e,t,r){var i=t.a-e.a,s=r.a-t.a;return 0<i+s?(t.b-r.b)*i+(t.b-e.b)*s:0}function u(e){return i(e.b.a,e.a)}function l(e){return i(e.a,e.b.a)}function c(e,t,r,i){return(e=0>e?0:e)<=(r=0>r?0:r)?0===r?(t+i)/2:t+e/(e+r)*(i-t):i+r/(e+r)*(t-i)}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 r=!1,i=!1;e!==t&&(t.a!==e.a&&(i=!0,w(t.a,e.a)),t.d!==e.d&&(r=!0,C(t.d,e.d)),x(t,e),i||(v(t,e.a),e.a.c=e),r||(b(t,e.d),e.d.a=e))}function f(e){var t=e.b,r=!1;e.d!==e.b.d&&(r=!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)),r||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),r=t.b;return x(t,e.e),t.a=e.b.a,v(r,t.a),t.d=r.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 r=!1,i=y(e),s=i.b;return t.d!==e.d&&(r=!0,C(t.d,e.d)),x(i,e.e),x(s,t),i.a=e.b.a,s.a=t.a,i.d=s.d=e.d,e.d.a=s,r||b(i,e.d),i}function y(e){var t=new J,r=new J,i=e.b.h;return r.h=i,i.b.h=t,t.h=e,e.b.h=r,t.b=r,t.c=t,t.e=r,r.b=t,r.c=r,r.e=t}function x(e,t){var r=e.c,i=t.c;r.b.e=t,i.b.e=e,e.c=i,t.c=r}function v(e,t){var r=t.f,i=new te(t,r);r.e=i,t.f=i,r=i.c=e;do{r.a=i,r=r.c}while(r!==e)}function b(e,t){var r=t.d,i=new K(t,r);r.b=i,t.d=i,i.a=e,i.c=t.c,r=e;do{r.d=i,r=r.e}while(r!==e)}function _(e){var t=e.h;e=e.b.h,t.b.h=e,e.b.h=t}function w(e,t){var r=e.c,i=r;do{i.a=t,i=i.c}while(i!==r);r=e.f,(i=e.e).f=r,r.e=i}function C(e,t){var r=e.a,i=r;do{i.d=t,i=i.e}while(i!==r);r=e.d,(i=e.b).d=r,r.b=i}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,r){return e=e.a,t=t.a,r=r.a,t.b.a===e?r.b.a===e?i(t.a,r.a)?0>=n(r.b.a,t.a,r.a):0<=n(t.b.a,r.a,t.a):0>=n(r.b.a,e,r.a):r.b.a===e?0<=n(t.b.a,e,t.a):(t=s(t.b.a,e,t.a))>=(e=s(r.b.a,e,r.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,r){var i=new ce;return i.a=r,i.e=W(e.f,t.e,i),r.i=i}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,r=t.d;r.c=e.d,r.a=t,F(e)}function L(e,t,r){for(e=t,t=t.a;e!==r;){e.c=!1;var i=pe(e),s=i.a;if(s.a!==t.a){if(!i.c){B(e);break}T(i,s=m(t.c.b,s.b))}t.c!==s&&(d(Q(s),s),d(t,s)),B(e),t=i.a,e=i}return t}function P(e,t,r,i,s,n){var a=!0;do{k(e,t,r.b),r=r.c}while(r!==i);for(null===s&&(s=pe(t).a.b.c);(r=(i=pe(t)).a.b).a===s.a;)r.c!==s&&(d(Q(r),r),d(Q(s),r)),i.f=t.f-r.f,i.d=I(e,i.f),t.b=!0,!a&&V(e,t)&&(A(r,s),F(t),f(s)),a=!1,t=i,s=r;t.b=!0,n&&G(e,t)}function O(e,t,r,i,s){var n=[t.g[0],t.g[1],t.g[2]];t.d=null,t.d=e.o&&e.o(n,r,i,e.c)||null,null===t.d&&(s?e.n||(Z(e,100156),e.n=!0):t.d=r[0])}function N(e,t,r){var i=[null,null,null,null];i[0]=t.a.d,i[1]=r.a.d,O(e,t.a,i,[.5,.5,0,0],!1),d(t,r)}function R(e,t,r,i,s){var n=Math.abs(t.b-e.b)+Math.abs(t.a-e.a),a=Math.abs(r.b-e.b)+Math.abs(r.a-e.a),o=s+1;i[s]=.5*a/(n+a),i[o]=.5*n/(n+a),e.g[0]+=i[s]*t.g[0]+i[o]*r.g[0],e.g[1]+=i[s]*t.g[1]+i[o]*r.g[1],e.g[2]+=i[s]*t.g[2]+i[o]*r.g[2]}function V(e,t){var s=pe(t),a=t.a,o=s.a;if(i(a.a,o.a)){if(0<n(o.b.a,a.a,o.a))return!1;if(r(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||i(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(i(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(i(w,C)||(b=w,w=C,C=b),i(D,E)||(b=D,D=E,E=b),i(w,D)||(b=w,w=D,D=b,b=C,C=E,E=b),i(D,C)?i(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,i(v,e.a)&&(v.b=e.a.b,v.a=e.a.a),w=i(f,m)?f:m,i(w,v)&&(v.b=w.b,v.a=w.a),r(v,f)||r(v,m))return V(e,t),!1;if(!r(y,e.a)&&0<=n(y,e.a,v)||!r(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=ie(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 r=pe(t);;){for(;r.b;)t=r,r=pe(r);if(!t.b&&(r=t,null===(t=de(t))||!t.b))break;t.b=!1;var s,a=t.a,o=r.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(i(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&&(r.c?(F(r),f(o),o=(r=pe(t)).a):t.c&&(F(t),f(a),a=(t=de(r)).a)),a.a!==o.a)if(a.b.a===o.b.a||t.c||r.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(r))}}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))r((u=c.a).a,a)||r(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=i(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),r(h.a,e.a)&&(d(Q(u),h),u=pe(s=M(s)).a,L(e,pe(s),o),p=!0),r(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=i(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 r=new ce,i=p(e.b);i.a.b=E,i.a.a=t,i.b.a.b=-4e150,i.b.a.a=t,e.a=i.b.a,r.a=i,r.f=0,r.d=!1,r.c=!1,r.h=!0,r.b=!1,i=W(i=e.f,i.a,r),r.e=i}function $(e){this.a=new q,this.b=e,this.c=S}function W(e,t,r){do{t=t.c}while(null!==t.b&&!e.c(e.b,t.b,r));return e=new q(r,t.a,t),t.a.c=e,t.a=e}function q(e,t,r){this.b=e||null,this.a=t||this,this.c=r||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 re(){this.c=[],this.d=null,this.a=0,this.e=!1,this.b=new ne}function ie(e,t){if(e.e){var r,i=e.b,s=++i.a;return 2*s>i.f&&(i.f*=2,i.c=ae(i.c,i.f+1)),0===i.b?r=s:(r=i.b,i.b=i.c[i.b]),i.e[r]=t,i.c[r]=s,i.d[s]=r,i.h&&le(i,s),r}return i=e.a++,e.c[i]=t,-(i+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&&i(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 r=Array(t),i=0;i<e.length;i++)r[i]=e[i];for(;i<t;i++)r[i]=0;return r}function oe(e){return e.e[e.d[1]]}function he(e){var t=e.d,r=e.e,i=e.c,s=t[1],n=r[s];return 0<e.a&&(t[1]=t[e.a],i[t[1]]=1,r[s]=null,i[s]=e.b,e.b=s,0<--e.a&&ue(e,1)),n}function ue(e,t){for(var r=e.d,s=e.e,n=e.c,a=t,o=r[a];;){var h=a<<1;h<e.a&&i(s[r[h+1]],s[r[h]])&&(h+=1);var u=r[h];if(h>e.a||i(s[o],s[u])){r[a]=o,n[o]=a;break}r[a]=u,n[u]=a,a=h}}function le(e,t){for(var r=e.d,s=e.e,n=e.c,a=t,o=r[a];;){var h=a>>1,u=r[h];if(0===h||i(s[u],s[o])){r[a]=o,n[o]=a;break}r[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,r){this.j[0]=e,this.j[1]=t,this.j[2]=r},t.z=function(e,t){var r=t||null;switch(e){case 100100:case 100106:this.h=r;break;case 100104:case 100110:this.l=r;break;case 100101:case 100107:this.k=r;break;case 100102:case 100108:this.i=r;break;case 100103:case 100109:this.p=r;break;case 100105:case 100111:this.o=r;break;case 100112:this.r=r;break;default:Z(this,100900)}},t.C=function(e,t){var r=!1,i=[0,0,0];Y(this,2);for(var s=0;3>s;++s){var n=e[s];-1e150>n&&(n=-1e150,r=!0),1e150<n&&(n=1e150,r=!0),i[s]=n}r&&Z(this,100155),null===(r=this.q)?d(r=p(this.b),r.b):(g(r),r=r.e),r.a.d=t,r.a.g[0]=i[0],r.a.g[1]=i[1],r.a.g[2]=i[2],r.f=1,r.b.f=-1,this.q=r},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,r(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 re,c=(e=this.b.c).e;c!==e;c=c.e)c.h=ie(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,r){return i(e[t],e[r])?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),i(c,e))){e=c;break e}if(null===e||!r(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;i(c.b.a,c.a);c=c.c.b);for(;i(c.a,c.b.a);c=c.e);for(s=c.c.b,o=void 0;c.e!==s;)if(i(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},Ni.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=Ni.libtess}(An);var Sn=Ri(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 r=!!this.renderer.states.strokeColor,i={};if(e.userVertexProperties){this._useUserVertexProperties=!0;for(const t in e.userVertexProperties){const r=e.vertexPropertyName(t),s=this.geometry._userVertexPropertyHelper(r,[],e.userVertexProperties[t]);i[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(),r,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],r=this.geometry[e];r.push(...r.slice(r.length-3*t,r.length-2*t),...r.slice(r.length-t,r.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 i){const r=i[e];e in t&&r.setCurrentData(t[e]),r.pushCurrentData()}}}r&&(this.geometry.edges=this._calculateEdges(this.shapeMode,this.geometry.vertices)),r&&!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 r=e[t];delete this.bufferStrides[t],r.delete()}this._useUserVertexProperties=!1,this.tessyVertexSize=Tn,this.geometry.userVertexProperties={}}_calculateEdges(e,t){const r=[];let i=0;const s=this.contourIndices.slice();let n=-1;switch(e){case 5:for(i=0;i<t.length-2;i++)r.push([i,i+1]),r.push([i,i+2]);r.push([i,i+1]);break;case 6:for(i=1;i<t.length-1;i++)r.push([0,i]),r.push([i,i+1]);r.push([0,t.length-1]);break;case 4:for(i=0;i<t.length-2;i+=3)r.push([i,i+1]),r.push([i+1,i+2]),r.push([i+2,i]);break;case M:for(i=0;i<t.length-1;i+=2)r.push([i,i+1]);break;case k:for(i=0;i<t.length-5;i+=6)r.push([i,i+1]),r.push([i+1,i+2]),r.push([i+2,i+5]),r.push([i+5,i]);break;case I:for(i=0;i<t.length-2;i+=2)r.push([i,i+1]),r.push([i+1,i+3]),r.push([i,i+2]);r.push([i,i+1]);break;default:for(i=0;i<t.length;i++)i===s[0]?n=s.shift():t[n]&&t[i].equals(t[n])?r.push([i-1,n]):r.push([i-1,i])}return r}_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 r in this.geometry.userVertexProperties){const i=this.geometry.userVertexProperties[r],s=t*i.getDataSize(),n=s+i.getDataSize(),a=i.getSrcArray().slice(s,n);e[e.length-1].push(...a)}}const t=this._triangulate(e),r=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 i=[];for(let e=0,r=t.length;e<r;e+=this.tessyVertexSize){i.push(...t.slice(e+5,e+9)),this.geometry.vertexNormals.push(new je(...t.slice(e+9,e+12)));{let r=12;for(const i in this.geometry.userVertexProperties){const s=this.geometry.userVertexProperties[i],n=s.getDataSize(),a=e+r,o=a+n;s.setCurrentData(t.slice(a,o)),s.pushCurrentData(),r+=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 i=r[t];let s=this.geometry.vertices.findIndex((e=>i.x===e.x&&i.y===e.y&&i.z===e.z));if(-1===s){let e=1/0,t=0;for(let r=0;r<this.geometry.vertices.length;r++){const s=this.geometry.vertices[r],n=i.x-s.x,a=i.y-s.y,o=i.z-s.z,h=n*n+a*a+o*o;h<e&&(e=h,t=r)}s=t}e.set(t,s)}return e.get(t)}))))}this.geometry.vertexColors=i}_initTessy(){const e=new Sn.GluTesselator;return e.gluTessCallback(Sn.gluEnum.GLU_TESS_VERTEX_DATA,(function(e,t){for(const r of e)t.push(r)})),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,r)=>{const i=new Array(this.tessyVertexSize).fill(0);for(let e=0;e<r.length;e++)for(let s=0;s<i.length;s++)0!==r[e]&&t[e]&&(i[s]+=t[e][s]*r[e]);return i})),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 r=!0;for(const i of e)for(let e=0;e<i.length;e+=this.tessyVertexSize)if(i[e+2]!==t){r=!1;break}r?this._tessy.gluTessNormal(0,0,1):this._tessy.gluTessNormal(0,0,0);const i=[];this._tessy.gluTessBeginPolygon(i);for(const t of e){this._tessy.gluTessBeginContour();for(let e=0;e<t.length;e+=this.tessyVertexSize){const r=t.slice(e,e+this.tessyVertexSize);this._tessy.gluTessVertex(r,r)}this._tessy.gluTessEndContour()}return this._tessy.gluTessEndPolygon(),i}}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 r=this.renderer.GL;if(this.freeBuffers(t),Object.keys(this.cache).length>1e3){const e=Object.keys(this.cache)[0];this.freeBuffers(e)}const i={};this.cache[t]=i,i.geometry=e;let s=i.indexBuffer;if(e.faces.length){s||(s=i.indexBuffer=r.createBuffer());const t=e.faces.flat(),n=t.some((e=>e>65535));let a=n?Uint32Array:Uint16Array;this.renderer._bindBuffer(s,r.ELEMENT_ARRAY_BUFFER,t,a),i.indexBufferType=n?r.UNSIGNED_INT:r.UNSIGNED_SHORT}else s&&(r.deleteBuffer(s),i.indexBuffer=null);return i}freeBuffers(e){const t=this.cache[e];if(!t)return;delete this.cache[e];const r=this.renderer.GL;function i(e){for(const i of e)t[i.dst]&&(r.deleteBuffer(t[i.dst]),t[i.dst]=null)}t.indexBuffer&&r.deleteBuffer(t.indexBuffer),i(this.renderer.buffers.stroke),i(this.renderer.buffers.fill),i(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,r,i,s,a){super(e,t,r,i),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 Mi(this.elt,this._pInst);for(const e of Object.getOwnPropertyNames(Mi.prototype))"constructor"!==e&&"_"!==e[0]&&Object.defineProperty(this,e,{get(){return this.wrappedElt[e]}});const o=this._adjustDimensions(t,r);if(t=o.adjustedWidth,r=o.adjustedHeight,this.width=t,this.height=r,this.elt.width=t*this._pixelDensity,this.elt.height=r*this._pixelDensity,this.elt.style.width=`${t}px`,this.elt.style.height=`${r}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 pi([-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,r){e instanceof je?this.states.setValue("_currentNormal",e):this.states.setValue("_currentNormal",new je(e,t,r)),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:r=1}={}){for(const t in e.userVertexProperties){const r=e.userVertexProperties[t];this.buffers.user.push(new wn(r.getDataSize(),r.getSrcName(),r.getDstName(),r.getName(),this))}this.states.fillColor&&e.vertices.length>=3&&![M,T].includes(t)&&this._drawFills(e,{mode:t,count:r}),this.states.strokeColor&&e.lineVertices.length>=1&&this._drawStrokes(e,{count:r}),this.buffers.user=[]}_drawGeometryScaled(e,t,r,i){let s=this.states.uModelMatrix;this.states.setValue("uModelMatrix",this.states.uModelMatrix.clone());try{this.states.uModelMatrix.scale(t,r,i),this.geometryBuilder?this.geometryBuilder.addRetained(e):this._drawGeometry(e)}finally{this.states.setValue("uModelMatrix",s)}}_drawFills(e,{count:t,mode:r}={}){this._useVertexColor=e.vertexColors.length>0;const i=!this._drawingFilter&&this.states.userFillShader?this.states.userFillShader:this._getFillShader();i.bindShader(),this._setGlobalUniforms(i),this._setFillUniforms(i),i.bindTextures();for(const t of this.buffers.fill)t._prepareBuffer(e,i);this._prepareUserAttributes(e,i),i.disableRemainingAttributes(),this._applyColorBlend(this.states.curFillColor,e.hasFillTransparency()),this._drawBuffers(e,{mode:r,count:t}),i.unbindShader()}_drawStrokes(e,{count:t}={}){const r=this.GL;this._useLineColor=e.vertexStrokeColors.length>0;const i=this._getStrokeShader();i.bindShader(),this._setGlobalUniforms(i),this._setStrokeUniforms(i),i.bindTextures();for(const t of this.buffers.stroke)t._prepareBuffer(e,i);if(this._prepareUserAttributes(e,i),i.disableRemainingAttributes(),this._applyColorBlend(this.states.curStrokeColor,e.hasStrokeTransparency()),1===t)r.drawArrays(r.TRIANGLES,0,e.lineVertices.length/3);else try{r.drawArraysInstanced(r.TRIANGLES,0,e.lineVertices.length/3,t)}catch(e){console.log("🌸 p5.js says: Instancing is only supported in WebGL2 mode")}i.unbindShader()}_drawPoints(e,t){const r=this.GL,i=this._getPointShader();i.bindShader(),this._setGlobalUniforms(i),this._setPointUniforms(i),i.bindTextures(),this._bindBuffer(t,r.ARRAY_BUFFER,this._vToNArray(e),Float32Array,r.STATIC_DRAW),i.enableAttrib(i.attributes.aPosition,3),this._applyColorBlend(this.states.curStrokeColor),r.drawArrays(r.Points,0,e.length),i.unbindShader()}_prepareUserAttributes(e,t){for(const r of this.buffers.user){if(!this._pInst.constructor.disableFriendleErrors){const t=e.userVertexProperties[r.attr];if(t){const r=t.getSrcArray().length/t.getDataSize();r>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()"):r<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()")}}r._prepareBuffer(e,t)}}_drawBuffers(e,{mode:t=this.GL.TRIANGLES,count:r}){const i=this.GL,s=this.geometryBufferCache.getCached(e);if(s)if(s.indexBuffer){if(this._bindBuffer(s.indexBuffer,i.ELEMENT_ARRAY_BUFFER),this._pInst.webglVersion!==n&&s.indexBufferType===i.UNSIGNED_INT&&!i.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===r)i.drawElements(i.TRIANGLES,3*e.faces.length,s.indexBufferType,0);else try{i.drawElementsInstanced(i.TRIANGLES,3*e.faces.length,s.indexBufferType,0,r)}catch(e){console.log("🌸 p5.js says: Instancing is only supported in WebGL2 mode")}}else if(1===r)i.drawArrays(t,0,e.vertices.length);else try{i.drawArraysInstanced(t,0,e.vertices.length,r)}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 r=this._maxTextureSize,i=Math.floor(r/this._pixelDensity),s=Math.min(e,i),n=Math.min(t,i);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 r=this.width,i=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),Mi.call(e,e.canvas,e._pInst),e.width=r,e.height=i}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,r,i,!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,r=this.states.uPMatrix,i=new ln(4);i.scale(this.width,this.height,1),i.translate([.5,.5,.5]),i.scale(.5,-.5,.5);return e.copy().mult(t).mult(r).mult(i)}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,r,i=this.getFilterLayer();if("string"==typeof e[0]){r=e[0];let s=r in In&&void 0===e[1];t=s?In[r]:e[1],r in this.defaultFilterShaders||(this.defaultFilterShaders[r]=new Dn(i.renderer,Wn,Qn[r])),this.states.setValue("filterShader",this.defaultFilterShaders[r])}else this.states.setValue("filterShader",e[0]);const s=this.activeFramebuffer()||this;this.matchSize(i,s),i.draw((()=>this.clear()));let n=[1/(s.width*s.pixelDensity()),1/(s.height*s.pixelDensity())];if(r===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)})),i.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 i.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(i,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!==re&&e!==ie||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 r=this.GL;return ia(r,null,e,t,r.RGBA,r.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=ra(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 r={};for(const e in this.drawingContext){const t=this.drawingContext[e];"object"!=typeof t&&"function"!=typeof t&&(r[e]=t)}const i=this._adjustDimensions(e,t);e=i.adjustedWidth,t=i.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 r)try{this.drawingContext[e]=r[e]}catch(e){}}clear(...e){const t=e[0]||0,r=e[1]||0,i=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,r*s,i*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,r,i,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,r,i,0,0,0,0,1,0,s,n,0,1])}translate(e,t,r){return e instanceof je&&(r=e.z,t=e.y,e=e.x),this.states.setValue("uModelMatrix",this.states.uModelMatrix.clone()),this.states.uModelMatrix.translate([e,t,r]),this}scale(e,t,r){return this.states.setValue("uModelMatrix",this.states.uModelMatrix.clone()),this.states.uModelMatrix.scale(e,t,r),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 r="";return this.webglVersion===n&&(r+="#version 300 es\n#define WEBGL2\n"),"vert"===e?r+="#define VERTEX_SHADER\n":"frag"===e&&(r+="#define FRAGMENT_SHADER\n"),t&&(r+=`precision ${t} float;\n`),r}_getEmptyTexture(){if(!this._emptyTexture){const e=new Wi(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 r=this.textures.get(t);if(r)return r;const i=new ua(this,t);return this.textures.set(t,i),i}getDiffusedTexture(e){if(null!=this.diffusedTextures.get(e))return this.diffusedTextures.get(e);let t,r=Math.floor(e.height/e.width*200);return t=new ma(this,{width:200,height:r,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,r)})),this.diffusedTextures.set(e,t),t}getSpecularTexture(e){if(null!=this.specularTextures.get(e))return this.specularTextures.get(e);const t=512;let r;const i=[],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 r=t;r>=1;r/=2){s.resize(r,r);let t=1-Math.log(r)/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(r,r)})),i.push(s.get().drawingContext.getImageData(0,0,r,r))}return s.remove(),r=new la(this,i,{}),this.specularTextures.set(e,r),r}activeFramebuffer(){return this.activeFramebuffers[this.activeFramebuffers.length-1]||null}createFramebuffer(e){return new ma(this,e)}_setGlobalUniforms(e){const t=this.states.uModelMatrix,r=this.states.uViewMatrix,i=this.states.uPMatrix,s=t.copy().mult(r);if(e.setUniform("uPerspective",this.states.curCamera.useLinePerspective?1:0),e.setUniform("uViewMatrix",r.mat4),e.setUniform("uProjectionMatrix",i.mat4),e.setUniform("uModelMatrix",t.mat4),e.setUniform("uModelViewMatrix",s.mat4),e.uniforms.uModelViewProjectionMatrix){const t=s.copy();t.mult(i),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 r=this.states.pointLightDiffuseColors.length/3;e.setUniform("uPointLightCount",r),e.setUniform("uPointLightLocation",this.states.pointLightPositions),e.setUniform("uPointLightDiffuseColors",this.states.pointLightDiffuseColors),e.setUniform("uPointLightSpecularColors",this.states.pointLightSpecularColors);const i=this.states.directionalLightDiffuseColors.length/3;e.setUniform("uDirectionalLightCount",i),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 r=this.getSpecularTexture(this.states.activeImageLight);e.setUniform("environmentMapSpecular",r)}}_setPointUniforms(e){e.setUniform("uMaterialColor",this.states.curStrokeColor),e.setUniform("uPointSize",this.states.strokeWeight*this._pixelDensity)}_bindBuffer(e,t,r,i,s){if(t||(t=this.GL.ARRAY_BUFFER),this.GL.bindBuffer(t,e),void 0!==r){let e=r;r instanceof pn?e=r.dataArray():e instanceof(i||Float32Array)||(e=new(i||Float32Array)(e)),this.GL.bufferData(t,e,s||this.GL.STATIC_DRAW)}}_arraysEqual(e,t){return e.length===t.length&&e.every(((e,r)=>e===t[r]))}_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,r){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 i=!0;void 0!==r?(null===this._glAttributes&&(this._glAttributes={}),this._glAttributes[t]!==r&&(this._glAttributes[t]=r,i=!1)):t instanceof Object&&this._glAttributes!==t&&(this._glAttributes=t,i=!1),this._renderer.isP3D&&!i&&(!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 ra(e,t,r,i,s,n,a,o,h,u){const l=t.getParameter(t.FRAMEBUFFER_BINDING);t.bindFramebuffer(t.FRAMEBUFFER,r);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(i,u?u-s-a:s,n,a,o,h,e),t.bindFramebuffer(t.FRAMEBUFFER,l),u){const t=Math.floor(a/2),r=new d(n*c);for(let i=0;i<t;i++){const t=i*n*4,s=(a-i-1)*n*4;r.set(e.subarray(t,t+4*n)),e.copyWithin(t,s,s+4*n),e.set(r,s)}}return e}function ia(e,t,r,i,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(r,a?a-i-1:i,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,r=1,i=1){return this._assert3d("plane"),this._renderer.plane(e,t,r,i),this},t.box=function(e,t,r,i,s){return this._assert3d("box"),this._renderer.box(e,t,r,i,s),this},t.sphere=function(e=50,t=24,r=16){return this._assert3d("sphere"),this._renderer.sphere(e,t,r),this},t.cylinder=function(e=50,t=e,r=24,i=1,s=!0,n=!0){return this._assert3d("cylinder"),this._renderer.cylinder(e,t,r,i,s,n),this},t.cone=function(e=50,t=e,r=24,i=1,s=!0){return this._assert3d("cone"),this._renderer.cone(e,t,r,i,s),this},t.ellipsoid=function(e=50,t=e,r=e,i=24,s=16){return this._assert3d("ellipsoid"),this._renderer.ellipsoid(e,t,r,i,s),this},t.torus=function(e,t,r,i){return this._assert3d("torus"),this._renderer.torus(e,t,r,i),this},ea.prototype.point=function(e,t,r=0){const i=[];return i.push(new je(e,t,r)),this._drawPoints(i,this.buffers.point),this},ea.prototype.triangle=function(e){const t=e[0],r=e[1],i=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-i*r+i*a-n*s+n*r-t*a),h=new ln([i-t,s-r,0,0,n-t,a-r,0,0,0,0,e,0,t,r,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],r=e[1],i=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,r=.5+Math.cos(t)/2,i=.5+Math.sin(t)/2;this.vertices.push(new je(r,i,0)),this.uvs.push([r,i]),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,r,0]),this.states.uModelMatrix.scale(i,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],r=e[1],i=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 r=e/this.detailX,i=new je(r,t,0);this.vertices.push(i),this.uvs.push(r,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,r,0]),this.states.uModelMatrix.scale(i,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=r,c=i,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)/i,(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,r,i,s,n,a,o,h,u,l,c,p=2,d=2){const f=`quad|${e}|${t}|${r}|${i}|${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)*i+y*a),v=(1-m)*((1-y)*t+y*l)+m*((1-y)*s+y*o),b=(1-m)*((1-y)*r+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 r=t+e*p,i=t+1+e*p,s=t+1+(e+1)*p,n=t+(e+1)*p;g.faces.push([r,i,s]),g.faces.push([r,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],r=m[(e+1)%m.length];g.edges.push([t,r])}g._edgesToVertices(),g.gid=f,this.geometryBufferCache.ensureCached(g)}return this._drawGeometry(this.geometryBufferCache.getGeometryByID(f)),this},ea.prototype.bezier=function(e,t,r,i,s,n,a,o,h,u,l,c){8===arguments.length&&(l=o,u=a,o=n,a=s,s=i,i=r,r=n=h=c=0),this.bezierOrder(),this.bezierOrder(3),this.beginShape(),this.vertex(e,t,r),this.bezierVertex(i,s,n),this.bezierVertex(a,o,h),this.bezierVertex(u,l,c),this.endShape()},ea.prototype.curve=function(e,t,r,i,s,n,a,o,h,u,l,c){8===arguments.length&&(u=a,l=o,a=s,o=i,s=i=r,r=n=h=c=0),this.beginShape(),this.splineVertex(e,t,r),this.splineVertex(i,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,r,i,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+i<=e.width&&(l=(t+i)/e.width);let c=0;r<=e.height&&(c=r/e.height);let p=1;r+s<=e.height&&(p=(r+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 r=function(e,t,r,i,s,n,a){e=e<=0?1:e,t=t<0?0:t,r=r<=0?e:r,i=i<3?3:i;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,r),l=Math.sin(u),c=Math.cos(u);let p,d,f;for(p=o;p<=h;++p){let n,a=p/s,o=r*a;for(p<0?(o=0,a=0,n=e):p>s?(o=r,a=1,n=t):n=e+(t-e)*a,-2!==p&&p!==s+2||(n=0),o-=r/2,d=0;d<i;++d){const e=d/(i-1),r=2*Math.PI*e,h=Math.sin(r),u=Math.cos(r);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<i;++f){const e=(f+1)%i;this.faces.push([g+f,g+i+e,g+i+f])}g+=2*i}for(p=0;p<s;++p){for(d=0;d<i;++d){const e=(d+1)%i;this.faces.push([g+d,g+e,g+i+e]),this.faces.push([g+d,g+i+e,g+i+d])}g+=i}if(a)for(g+=i,d=0;d<i;++d)this.faces.push([g+d,g+(d+1)%i,g+i])};ea.prototype.plane=function(e=50,t=e,r=1,i=1){const s=`plane|${r}|${i}`;if(!this.geometryInHash(s)){const e=function(){let e,t,r;for(let i=0;i<=this.detailY;i++){t=i/this.detailY;for(let i=0;i<=this.detailX;i++)e=i/this.detailX,r=new je(e-.5,t-.5,0),this.vertices.push(r),this.uvs.push(e,t)}},t=new gn(r,i,e,this);t.computeFaces().computeNormals(),r<=1&&i<=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,r=t,i,s){const n=this.attributes&&this.attributes.perPixelLighting;void 0===i&&(i=n?1:4),void 0===s&&(s=n?1:4);const a=`box|${i}|${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 r=4*t;for(let t=0;t<4;t++){const r=e[t],i=new je((2*(1&r)-1)/2,((2&r)-1)/2,((4&r)/2-1)/2);this.vertices.push(i),this.uvs.push(1&t,(2&t)/2)}this.faces.push([r,r+1,r+2]),this.faces.push([r+2,r+1,r+3])}))},t=new gn(i,s,e,this);t.computeNormals(),i<=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,r)},ea.prototype.sphere=function(e=50,t=24,r=16){this.ellipsoid(e,e,e,t,r)},ea.prototype.ellipsoid=function(t=50,r=t,i=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 r=t/this.detailY,i=Math.PI*r-Math.PI/2,s=Math.cos(i),n=Math.sin(i);for(let t=0;t<=this.detailX;t++){const i=t/this.detailX,a=2*Math.PI*i,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(i,r)}}},r=new gn(s,n,t,this);r.computeFaces(),s<=24&&n<=24?r._makeTriangleEdges()._edgesToVertices():this.states.strokeColor&&console.log("Cannot draw stroke on ellipsoids with more than 24 detailX or 24 detailY"),r.gid=a,this.geometryBufferCache.ensureCached(r)}this._drawGeometryScaled(this.geometryBufferCache.getGeometryByID(a),t,r,i)},ea.prototype.cylinder=function(t=50,i=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(){r.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,i,t)},ea.prototype.cone=function(e=50,t=e,i=24,s=1,n=!0){const a=`cone|${i}|${s}|${n}`;if(!this.geometryInHash(a)){const e=new gn(i,s,(function(){r.call(this,1,0,1,i,s,n,!1)}),this);i<=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,r=24,i=16){if(0===e)return;if(0===t)return;const s=(t/e).toPrecision(4),n=`torus|${s}|${r}|${i}`;if(!this.geometryInHash(n)){const e=function(){for(let e=0;e<=this.detailY;e++){const t=e/this.detailY,r=2*Math.PI*t,i=Math.cos(r),n=Math.sin(r),a=1+s*i;for(let e=0;e<=this.detailX;e++){const r=e/this.detailX,o=2*Math.PI*r,h=Math.cos(o),u=Math.sin(o),l=new je(a*h,a*u,s*n),c=new je(i*h,i*u,n);this.vertices.push(l),this.vertexNormals.push(c),this.uvs.push(r,t)}}},t=new gn(r,i,e,this);t.computeFaces(),r<=24&&i<=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,r,i){return this._assert3d("ambientLight"),this._renderer.ambientLight(...arguments),this},t.specularColor=function(e,t,r){return this._assert3d("specularColor"),this._renderer.specularColor(...arguments),this},t.directionalLight=function(e,t,r,i,s,n){return this._assert3d("directionalLight"),this._renderer.directionalLight(...arguments),this},t.pointLight=function(e,t,r,i,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,r){return this._assert3d("lightFalloff"),this._renderer.lightFalloff(e,t,r),this},t.spotLight=function(e,t,r,i,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,r,i){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,r){const i=this._pInst.color(...arguments);this.states.setValue("specularColors",[i._array[0],i._array[1],i._array[2]])},ea.prototype.directionalLight=function(e,t,r,i,s,n){let a,o,h,u;a=e instanceof pi?e:this._pInst.color(e,t,r);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,r,i,s,n){let a,o,h,u;a=e instanceof pi?e:this._pInst.color(e,t,r);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,r){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.")),r<0&&(r=0,console.warn("Value of quadratic argument in lightFalloff() should be never be negative. Set to 0.")),0===e&&0===t&&0===r&&(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",r)},ea.prototype.spotLight=function(e,t,r,i,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,r),p=new je(i,s,n),d=new je(a,o,h);break;case 9:e instanceof pi?(c=e,p=new je(t,r,i),d=new je(s,n,a),u=o,l=h):i instanceof je?(c=this._pInst.color(e,t,r),p=i,d=new je(s,n,a),u=o,l=h):a instanceof je?(c=this._pInst.color(e,t,r),p=new je(i,s,n),d=a,u=o,l=h):(c=this._pInst.color(e,t,r),p=new je(i,s,n),d=new je(a,o,h));break;case 8:e instanceof pi?(c=e,p=new je(t,r,i),d=new je(s,n,a),u=o):i instanceof je?(c=this._pInst.color(e,t,r),p=i,d=new je(s,n,a),u=o):(c=this._pInst.color(e,t,r),p=new je(i,s,n),d=a,u=o);break;case 7:e instanceof pi&&t instanceof je?(c=e,p=t,d=new je(r,i,s),u=n,l=a):e instanceof pi&&s instanceof je?(c=e,p=new je(t,r,i),d=s,u=n,l=a):i instanceof je&&s instanceof je?(c=this._pInst.color(e,t,r),p=i,d=s,u=n,l=a):e instanceof pi?(c=e,p=new je(t,r,i),d=new je(s,n,a)):i instanceof je?(c=this._pInst.color(e,t,r),p=i,d=new je(s,n,a)):(c=this._pInst.color(e,t,r),p=new je(i,s,n),d=a);break;case 6:i instanceof je&&s instanceof je?(c=this._pInst.color(e,t,r),p=i,d=s,u=n):e instanceof pi&&s instanceof je?(c=e,p=new je(t,r,i),d=s,u=n):e instanceof pi&&t instanceof je&&(c=e,p=t,d=new je(r,i,s),u=n);break;case 5:e instanceof pi&&t instanceof je&&r instanceof je?(c=e,p=t,d=r,u=i,l=s):i instanceof je&&s instanceof je?(c=this._pInst.color(e,t,r),p=i,d=s):e instanceof pi&&s instanceof je?(c=e,p=new je(t,r,i),d=s):e instanceof pi&&t instanceof je&&(c=e,p=t,d=new je(r,i,s));break;case 4:c=e,p=t,d=r,u=i;break;case 3:c=e,p=t,d=r;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,r,i){const s=new Dn;try{return s._vertSrc=(await Os(e,"text")).data,s._fragSrc=(await Os(t,"text")).data,r?r(s):s}catch(e){if(i)return i(e);throw e}},t.createShader=function(e,t,r){return new Dn(this._renderer,e,t,r)},t.loadFilterShader=async function(e,t,r){try{const r=await this.loadStrings(e),i=await r.join("\n"),s=this.createFilterShader(i,!0);return t&&t(s),s}catch(e){r?r(e):console.error(e)}},t.createFilterShader=function(e,t=!1){let r=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 i=new Dn(this._renderer,r,e);return t||(this._renderer.GL?i.ensureCompiledOnContext(this._renderer):i.ensureCompiledOnContext(this)),i},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 r of this._renderer.textures.values())r.setWrapMode(e,t)},t.normalMaterial=function(...e){return this._assert3d("normalMaterial"),this._renderer.normalMaterial(...e),this},t.ambientMaterial=function(e,r,i){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 pi([1,1,1])),this},t.emissiveMaterial=function(e,r,i,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,r,i,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 r=this.GL,i=this.states.drawMode===ye,s=t||this.states.userFillShader||this.states.userStrokeShader||this.states.userPointShader||i||this.states.curBlendMode!==j||e[e.length-1]<1||this._isErasing;return s!==this._isBlending&&(s||this.states.curBlendMode!==j&&this.states.curBlendMode!==W?r.enable(r.BLEND):r.disable(r.BLEND),r.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 pi([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 pi([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 r=t.DEGREES="degrees",i=t.RADIANS="radians";t._angleMode=i,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===r||e===i){if(e===this._angleMode)return;e===i?(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===r?e*v:e},t._toDegrees=function(e){return this._angleMode===i?e*b:e},t._fromRadians=function(e){return this._angleMode===r?e*b:e},t._fromDegrees=function(e){return this._angleMode===i?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,r,s,n){const a=r||i;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,r){this._renderer=e;const i=this._renderer.GL;r=r||{},this.src=t,this.glTex=void 0,this.glTarget=i.TEXTURE_2D,this.glFormat=r.format||i.RGBA,this.mipmaps=!1,this.glMinFilter=r.minFilter||i.LINEAR,this.glMagFilter=r.magFilter||i.LINEAR,this.glWrapS=r.wrapS||i.CLAMP_TO_EDGE,this.glWrapT=r.wrapT||i.CLAMP_TO_EDGE,this.glDataType=r.dataType||i.UNSIGNED_BYTE;const s=pa(e);this.glFormat!==i.HALF_FLOAT||s.halfFloat||(console.log("This device does not support dataType HALF_FLOAT. Falling back to FLOAT."),this.glDataType=i.FLOAT),this.glFormat!==i.HALF_FLOAT||this.glMinFilter!==i.LINEAR&&this.glMagFilter!==i.LINEAR||s.halfFloatLinear||(console.log("This device does not support linear filtering for dataType FLOAT. Falling back to NEAREST."),this.glMinFilter===i.LINEAR&&(this.glMinFilter=i.NEAREST),this.glMagFilter===i.LINEAR&&(this.glMagFilter=i.NEAREST)),this.glFormat!==i.FLOAT||s.float||(console.log("This device does not support dataType FLOAT. Falling back to UNSIGNED_BYTE."),this.glDataType=i.UNSIGNED_BYTE),this.glFormat!==i.FLOAT||this.glMinFilter!==i.LINEAR&&this.glMagFilter!==i.LINEAR||s.floatLinear||(console.log("This device does not support linear filtering for dataType FLOAT. Falling back to NEAREST."),this.glMinFilter===i.LINEAR&&(this.glMinFilter=i.NEAREST),this.glMagFilter===i.LINEAR&&(this.glMagFilter=i.NEAREST)),this.isSrcMediaElement=!1,this._videoPrevUpdateTime=0,this.isSrcHTMLElement=void 0!==Mi&&t instanceof Mi&&!(t instanceof ha)&&!(t instanceof xs),this.isSrcP5Image=t instanceof Wi,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 this.src.update(),!1;const t=this._getTextureDataFromSource();let r=!1;const i=this._renderer.GL;return t.width!==this.width||t.height!==this.height?(r=!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()&&(r=!0,e.setModified(!1)):this.isSrcMediaElement?e.isModified()?(r=!0,e.setModified(!1)):e.loadedmetadata&&this._videoPrevUpdateTime!==e.time()&&(this._videoPrevUpdateTime=e.time(),r=!0):this.isImageData?e._dirty&&(e._dirty=!1,r=!0):r=!0,r&&(this.bindTexture(),i.texImage2D(this.glTarget,0,this.glFormat,this.glFormat,this.glDataType,t)),r}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 r=this._renderer.GL;this.glMinFilter=this.glFilter(e),this.glMagFilter=this.glFilter(t),this.bindTexture(),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MIN_FILTER,this.glMinFilter),r.texParameteri(r.TEXTURE_2D,r.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 r=this._renderer.GL,i=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=i(a),u=i(o);e===be?this._renderer.webglVersion===n||h&&u?this.glWrapS=r.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=r.CLAMP_TO_EDGE):e===we?this._renderer.webglVersion===n||h&&u?this.glWrapS=r.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=r.CLAMP_TO_EDGE):this.glWrapS=r.CLAMP_TO_EDGE,t===be?this._renderer.webglVersion===n||h&&u?this.glWrapT=r.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=r.CLAMP_TO_EDGE):t===we?this._renderer.webglVersion===n||h&&u?this.glWrapT=r.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=r.CLAMP_TO_EDGE):this.glWrapT=r.CLAMP_TO_EDGE,this.bindTexture(),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_S,this.glWrapS),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_T,this.glWrapT),this.unbindTexture()}}class la extends ua{constructor(e,t,r){super(e,t,r);const i=this._renderer.GL;this.glMinFilter===i.LINEAR&&(this.glMinFilter=i.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 r=0;r<e.length;r++)t.texImage2D(this.glTarget,r,this.glFormat,this.glFormat,this.glDataType,e[r]);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 r=e,i=t===n?r.getExtension("EXT_color_buffer_float")&&r.getExtension("EXT_float_blend"):r.getExtension("OES_texture_float"),s=i&&r.getExtension("OES_texture_float_linear"),a=t===n?r.getExtension("EXT_color_buffer_float"):r.getExtension("OES_texture_half_float");return{float:i,floatLinear:s,halfFloat:a,halfFloatLinear:a&&r.getExtension("OES_texture_half_float_linear")}}void 0!==p5&&ca(p5);const da=(e,t,r)=>Math.max(Math.min(e,r),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}update(){this.framebuffer._update(this.property)}rawTexture(){return this.framebuffer[this.property]}}class ma{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?Ci:fi),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 r=this.renderer.GL;if(this.gl=r,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=r.createFramebuffer(),!this.framebuffer)throw new Error("Unable to create a framebuffer");if(this.antialias&&(this.aaFramebuffer=r.createFramebuffer(),!this.aaFramebuffer))throw new Error("Unable to create a framebuffer for antialiasing");this._recreateTextures();const i=this.renderer.states.curCamera;this.defaultCamera=this.createCamera(),this.filterCamera=this.createCamera(),this.renderer.states.setValue("curCamera",i),this.draw((()=>this.renderer.clear()))}resize(e,t){this._autoSized=!1;const r=this.renderer._adjustDimensions(e,t);e=r.adjustedWidth,t=r.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===fi&&[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=Ci)}_recreateTextures(){const e=this.gl;this._updateSize();const t=e.getParameter(e.TEXTURE_BINDING_2D),r=e.getParameter(e.FRAMEBUFFER_BINDING),i=e.createTexture();if(!i)throw new Error("Unable to create color texture");e.bindTexture(e.TEXTURE_2D,i);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=i,e.bindFramebuffer(e.FRAMEBUFFER,this.framebuffer),e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,i,0),this.useDepth){const t=e.createTexture();if(!t)throw new Error("Unable to create depth texture");const r=this._glDepthFormat();e.bindTexture(e.TEXTURE_2D,t),e.texImage2D(e.TEXTURE_2D,0,r.internalFormat,this.width*this.density,this.height*this.density,0,r.format,r.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,r)}_glColorFormat(){let e,t,r;const i=this.gl;if(e=this.format===Be?i.FLOAT:this.format===Le?this.renderer.webglVersion===n?i.HALF_FLOAT:i.getExtension("OES_texture_half_float").HALF_FLOAT_OES:i.UNSIGNED_BYTE,t=this.channels===Ci?i.RGBA:i.RGB,this.renderer.webglVersion===n){r={[i.FLOAT]:{[i.RGBA]:i.RGBA32F},[i.HALF_FLOAT]:{[i.RGBA]:i.RGBA16F},[i.UNSIGNED_BYTE]:{[i.RGBA]:i.RGBA8,[i.RGB]:i.RGB8}}[e][t]}else r=this.format===Le?i.RGBA:t;return{internalFormat:r,format:t,type:e}}_glDepthFormat(){let e,t,r;const i=this.gl;return e=this.useStencil?this.depthFormat===Be?i.FLOAT_32_UNSIGNED_INT_24_8_REV:this.renderer.webglVersion===n?i.UNSIGNED_INT_24_8:i.getExtension("WEBGL_depth_texture").UNSIGNED_INT_24_8_WEBGL:this.depthFormat===Be?i.FLOAT:i.UNSIGNED_INT,t=this.useStencil?i.DEPTH_STENCIL:i.DEPTH_COMPONENT,r=this.useStencil?this.depthFormat===Be?i.DEPTH32F_STENCIL8:this.renderer.webglVersion===n?i.DEPTH24_STENCIL8:i.DEPTH_STENCIL:this.renderer.webglVersion===n?this.depthFormat===Be?i.DEPTH_COMPONENT32F:i.DEPTH_COMPONENT24:i.DEPTH_COMPONENT,{internalFormat:r,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,r=this.colorRenderbuffer,i=this.depthRenderbuffer;this._deleteTexture(e),t&&this._deleteTexture(t);const s=this.gl;r&&s.deleteRenderbuffer(r),i&&s.deleteRenderbuffer(i),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}_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 r={colorTexture:[t.COLOR_BUFFER_BIT,this.colorP5Texture.glMagFilter]};this.useDepth&&(r.depthTexture=[t.DEPTH_BUFFER_BIT,this.depthP5Texture.glMagFilter]);const[i,s]=r[e];t.blitFramebuffer(0,0,this.width*this.density,this.height*this.density,0,0,this.width*this.density,this.height*this.density,i,s),this.dirty[e]=!1;const n=this.renderer.activeFramebuffer();n?t.bindFramebuffer(t.FRAMEBUFFER,n._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 r=this._glColorFormat();this.pixels=ra(this.pixels,e,this.framebuffer,0,0,this.width*this.density,this.height*this.density,r.format,r.type),t?e.bindFramebuffer(e.FRAMEBUFFER,t._framebufferToBind()):e.bindFramebuffer(e.FRAMEBUFFER,null)}get(e,t,r,i){this._update("colorTexture");const s=this._glColorFormat();if(void 0===e&&void 0===t)e=0,t=0,r=this.width,i=this.height;else if(void 0===r&&void 0===i)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)),ia(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),r=da(r,1,this.width-e),i=da(i,1,this.height-t);const n=ra(void 0,this.gl,this.framebuffer,e*this.density,t*this.density,r*this.density,i*this.density,s.format,s.type),a=new Uint8ClampedArray(r*i*this.density*this.density*4);a.fill(255);const o=s.type===this.gl.RGB?3:4;for(let e=0;e<i*this.density;e++)for(let t=0;t<r*this.density;t++)for(let i=0;i<4;i++){const s=4*(e*r*this.density+t)+i;if(i<o){const h=4===o?s:(e*r*this.density+t)*o+i;a[s]=n[h]}}const h=new Wi(r*this.density,i*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(r,i),h}updatePixels(){const e=this.gl;this.colorP5Texture.bindTexture();const t=this._glColorFormat(),r=t.format===e.RGBA?4:3,i=this.width*this.height*this.density*this.density*r,s=t.type===e.UNSIGNED_BYTE?Uint8Array:Float32Array;if(!(this.pixels instanceof s)||this.pixels.length!==i)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 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,r,...s){let n=i;return Reflect.ownKeys(xa).includes(r)?n=r:s.unshift(r),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,r){this._renderer&&(this._renderer.resize(e,t),r||this.redraw()),this._addAccsOutput()&&this._updateAccsOutput()},t.noCanvas=function(){this.canvas&&this.canvas.parentNode.removeChild(this.canvas)},t.createGraphics=function(t,r,...s){return s[0]instanceof HTMLCanvasElement&&(s[1]=s[0],s[0]=i),new e.Graphics(t,r,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 Wi(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 r="";return this._renderer.webglVersion===n&&(r+="#version 300 es\n#define WEBGL2\n"),"vert"===e?r+="#define VERTEX_SHADER\n":"frag"===e&&(r+="#define FRAGMENT_SHADER\n"),t&&(r+=`precision ${t} float;\n`),r}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,r=null){this.operation=e,this.filterParameter=t,e in In&&void 0===t&&(this.filterParameter=In[e]),this.customShader=r,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,r){const i=this.gl;i.bindBuffer(t,e),i.bufferData(t,r,i.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,r=[1/(this.pInst.width*t),1/(this.pInst.height*t)],i=this.canvasTexture;this._shader.setUniform("tex0",i),this._shader.setUniform("texelSize",r),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,r,i,s,n={}){super(e,t,r,i),this.canvas=this.elt=s||document.createElement("canvas"),i?(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(Mi.prototype))"constructor"!==e&&"_"!==e[0]&&Object.defineProperty(this,e,{get(){return this.wrappedElt[e]}});if(this.elt.width=t*this._pixelDensity,this.elt.height=r*this._pixelDensity,this.elt.style.width=`${t}px`,this.elt.style.height=`${r}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=gi),this.scale(this._pixelDensity,this._pixelDensity),this.filterRenderer||(this.filterRenderer=new ba(this)),this.wrappedElt=new Mi(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 r={};for(const e in this.drawingContext){const t=this.drawingContext[e];"object"!=typeof t&&"function"!=typeof t&&(r[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 r)try{this.drawingContext[e]=r[e]}catch(e){}}background(...e){if(this.push(),this.resetMatrix(),e[0]instanceof Wi)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 r=t.toString();this._setFill(r),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 r=this._pInst.color(255,e).toString();this.drawingContext.fillStyle=r,this.states.setValue("_cachedStrokeStyle",this.drawingContext.strokeStyle);const i=this._pInst.color(255,t).toString();this.drawingContext.strokeStyle=i;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 r=this._pInst.color(255,0).toString();this.drawingContext.strokeStyle=r;const i=this._cachedBlendMode;this.blendMode(j),this._cachedBlendMode=i,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,r,i,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*r,l*i,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!==re&&e!==ie&&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,r=e[e.length-1],i=Array.prototype.slice.call(e,0,e.length-1);this.drawingContext.globalCompositeOperation=r,Ca.prototype.copy.apply(this,i),this.drawingContext.globalCompositeOperation=t}_getPixel(e,t){let r,i;return r=this.drawingContext.getImageData(e,t,1,1).data,i=0,[r[0],r[1],r[2],r[3]]}loadPixels(){const e=this._pixelDensity,t=this.width*e,r=this.height*e,i=this.drawingContext.getImageData(0,0,t,r);this.imageData=i,this.pixels=i.data}set(e,t,r){if(e=Math.floor(e),t=Math.floor(t),r instanceof Wi)this.drawingContext.save(),this.drawingContext.setTransform(1,0,0,1,0,0),this.drawingContext.scale(this._pixelDensity,this._pixelDensity),this.drawingContext.clearRect(e,t,r.width,r.height),this.drawingContext.drawImage(r.canvas,e,t),this.drawingContext.restore();else{let i=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 r)o<this.pixels.length&&(i=r,s=r,n=r,a=255);else if(Array.isArray(r)){if(r.length<4)throw new Error("pixel array must be of the form [R, G, B, A]");o<this.pixels.length&&(i=r[0],s=r[1],n=r[2],a=r[3])}else r instanceof Ca.Color&&o<this.pixels.length&&([i,s,n,a]=r._getRGBA([255,255,255,255]));for(let r=0;r<this._pixelDensity;r++)for(let h=0;h<this._pixelDensity;h++)o=4*((t*this._pixelDensity+h)*this.width*this._pixelDensity+(e*this._pixelDensity+r)),this.pixels[o]=i,this.pixels[o+1]=s,this.pixels[o+2]=n,this.pixels[o+3]=a}}updatePixels(e,t,r,i){const s=this._pixelDensity;void 0===e&&void 0===t&&void 0===r&&void 0===i&&(e=0,t=0,r=this.width,i=this.height),e*=s,t*=s,r*=s,i*=s,this.gifProperties&&(this.gifProperties.frames[this.gifProperties.displayIndex].image=this.imageData),this.drawingContext.putImageData(this.imageData,0,0,e,t,r,i)}arc(e,t,r,i,s,n,a){const o=this.clipPa||this.drawingContext,h=e+r/2,u=t+i/2,l=r/2,c=i/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,r=!!this.states.fillColor,i=this.states.strokeColor,s=parseFloat(e[0]),n=parseFloat(e[1]),a=parseFloat(e[2]),o=parseFloat(e[3]);if(r&&!i){if(this._getFill()===_a)return this}else if(!r&&i&&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&&r&&t.fill(),!this._clipping&&i&&t.stroke()}line(e,t,r,i){const s=this.clipPath||this.drawingContext;return this.states.strokeColor?(this._getStroke()===_a||(this._clipping||s.beginPath(),s.moveTo(e,t),s.lineTo(r,i),s.stroke()),this):this}point(e,t){const r=this.clipPath||this.drawingContext;if(!this.states.strokeColor)return this;if(this._getStroke()===_a)return this;const i=this._getStroke(),s=this._getFill();this._clipping||this._setFill(i),this._clipping||r.beginPath(),r.arc(e,t,r.lineWidth/2,0,x,!1),this._clipping||(r.fill(),this._setFill(s))}quad(e,t,r,i,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(r,i),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],r=e[1],i=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,r,i,s);else{void 0===a&&(a=n),void 0===o&&(o=a),void 0===h&&(h=o);const e=Math.abs(i),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,r,i,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,r=!!this.states.fillColor,i=this.states.strokeColor,s=e[0],n=e[1],a=e[2],o=e[3],h=e[4],u=e[5];if(r&&!i){if(this._getFill()===_a)return this}else if(!r&&i&&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&&r&&t.fill(),!this._clipping&&i&&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,r,i,s,n){this.drawingContext.transform(e,t,r,i,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=r;static instance=null;static lifecycleHooks={presetup:[],postsetup:[],predraw:[],postdraw:[],remove:[]};static _checkForUserDefinedFunctions=()=>{};static _friendlyFileLoadError=()=>{};constructor(t,r){this.hitCriticalError=!1,this._setupDone=!1,this._userNode=r,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 i=t=>{Object.defineProperty(window,t,{configurable:!0,enumerable:!0,get:()=>"function"==typeof this[t]?this[t].bind(this):this[t],set:r=>{Object.defineProperty(window,t,{configurable:!0,enumerable:!0,value:r,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]&&i(t);const t=["constructor","length"];for(const e in this)if(this.hasOwnProperty(e)){if("_"===e[0]||t.includes(e))continue;i(e)}}for(const e in this._events){const t=this[`_on${e}`];if(t){const r=t.bind(this);window.addEventListener(e,r,{passive:!1}),this._events[e]=r}}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 r={};t(e,e.prototype,r);const i=Object.keys(e.lifecycleHooks);for(const t of i)"function"==typeof r[t]&&e.lifecycleHooks[t].push(r[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,i),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(),r=t-this._lastTargetFrameTime,i=1e3/this._targetFrameRate;(!this._loop||r>=i-5)&&(this.deltaTime=t-this._lastRealFrameTime,this._frameRate=1e3/this.deltaTime,await this.redraw(),this._lastTargetFrameTime=Math.max(this._lastTargetFrameTime+i,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 r of e.lifecycleHooks[t])await r.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 r="_Description",i="_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 r=this.canvas.id;e=l(e),this.dummyDOM||(this.dummyDOM=document.getElementById(r).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,r){if("string"!=typeof t||"string"!=typeof e)return;const i=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(i).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),r===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+r}`))this.dummyDOM.querySelector("#"+n+s).insertAdjacentHTML("beforebegin",`<p id="${n+i}"></p>`);else{let e=`<div id="${n}${r}" role="region" aria-label="Canvas Description"><p id="${n}${i}"></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}${i}`),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+r}`))this.dummyDOM.querySelector("#"+c+s)||this.dummyDOM.querySelector("#"+c+i).insertAdjacentHTML("afterend",`<table id="${c}${s}"><caption>Canvas elements and their descriptions</caption></table>`);else{let e=`<div id="${c}${r}" 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],r=function(e,t){let r="",i="",s=0;for(let n in t){let a=0;for(let i in t[n]){let o=`<li id="${e}shape${s}">${t[n][i].color} ${n},`;"line"===n?o+=` location = ${t[n][i].pos}, length = ${t[n][i].length} pixels`:(o+=` location = ${t[n][i].pos}`,"point"!==n&&(o+=`, area = ${t[n][i].area} %`),o+="</li>"),r+=o,a++,s++}i=a>1?`${i} ${a} ${n}s`:`${i} ${a} ${n}`}return{numShapes:[s,i],details:r}}(e,this.ingredients.shapes),i=function(e,t,r,i){let s=`${t} canvas, ${r} by ${i} pixels, contains ${e[0]}`;s=1===e[0]?`${s} shape: ${e[1]}`:`${s} shapes: ${e[1]}`;return s}(r.numShapes,this.ingredients.colors.background,this.width,this.height),s=function(e,t){let r=0,i="",s=Array.from(Array(10),(()=>Array(10)));for(let i in t)for(let n in t[i]){let a;a="line"!==i?`<a href="#${e}shape${r}">${t[i][n].color} ${i}</a>`:`<a href="#${e}shape${r}">${t[i][n].color} ${i} midpoint</a>`,t[i][n].loc.locY<s.length&&t[i][n].loc.locX<s[t[i][n].loc.locY].length&&(s[t[i][n].loc.locY][t[i][n].loc.locX]?s[t[i][n].loc.locY][t[i][n].loc.locX]=s[t[i][n].loc.locY][t[i][n].loc.locX]+" "+a:s[t[i][n].loc.locY][t[i][n].loc.locX]=a,r++)}for(let e in s){let t="<tr>";for(let r in s[e])t+="<td>",void 0!==s[e][r]&&(t+=s[e][r]),t+="</td>";i=i+t+"</tr>"}return i}(e,this.ingredients.shapes);i!==t.summary.innerHTML&&(t.summary.innerHTML=i),s!==t.map.innerHTML&&(t.map.innerHTML=s),r.details!==t.shapeDetails.innerHTML&&(t.shapeDetails.innerHTML=r.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],r=function(e,t){let r="",i=0;for(let s in t)for(let n in t[s]){let a=`<li><a href="#${e}shape${i}">${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>"),r+=a,i++}return{numShapes:i,listShapes:r}}(e,this.ingredients.shapes),i=function(e,t,r,i){let s=`Your output is a, ${r} by ${i} pixels, ${t} canvas containing the following`;s=1===e?`${s} shape:`:`${s} ${e} shapes:`;return s}(r.numShapes,this.ingredients.colors.background,this.width,this.height),s=function(e,t){let r="",i=0;for(let s in t)for(let n in t[s]){let a=`<tr id="${e}shape${i}"><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>"),r+=a,i++}return r}(e,this.ingredients.shapes);i!==t.summary.innerHTML&&(t.summary.innerHTML=i),r.listShapes!==t.list.innerHTML&&(t.list.innerHTML=r.listShapes),s!==t.shapeDetails.innerHTML&&(t.shapeDetails.innerHTML=s),this._accessibleOutputs[e]=t}}function Sa(e,t){function r(e,t,r){let i=Math.floor(e[0]/t*10),s=Math.floor(e[1]/r*10);return 10===i&&(i-=1),10===s&&(s-=1),{locX:i,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 r,i,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?(r=n+e,i=n+"accessibleOutput",this.dummyDOM.querySelector(`#${i}`)||(this.dummyDOM.querySelector(`#${n}_Description`)?this.dummyDOM.querySelector(`#${n}_Description`).insertAdjacentHTML("afterend",`<div id="${i}" role="region" aria-label="Canvas Outputs"></div>`):this.dummyDOM.querySelector(`#${n}`).innerHTML=`<div id="${i}" role="region" aria-label="Canvas Outputs"></div>`)):"Label"===t&&(a=t,r=n+e+t,i=n+"accessibleOutput"+t,this.dummyDOM.querySelector(`#${i}`)||(this.dummyDOM.querySelector(`#${n}_Label`)?this.dummyDOM.querySelector(`#${n}_Label`).insertAdjacentHTML("afterend",`<div id="${i}"></div>`):this.dummyDOM.querySelector(`#${n}`).insertAdjacentHTML("afterend",`<div id="${i}"></div>`))),this._accessibleOutputs[r]={},"textOutput"===e?(a=`#${n}gridOutput${a}`,s=`<div id="${r}">Text Output<div id="${r}Summary" aria-label="text output summary"><p id="${r}_summary"></p><ul id="${r}_list"></ul></div><table id="${r}_shapeDetails" summary="text output shape details"></table></div>`,this.dummyDOM.querySelector(a)?this.dummyDOM.querySelector(a).insertAdjacentHTML("beforebegin",s):this.dummyDOM.querySelector(`#${i}`).innerHTML=s,this._accessibleOutputs[r].list=this.dummyDOM.querySelector(`#${r}_list`)):"gridOutput"===e&&(a=`#${n}textOutput${a}`,s=`<div id="${r}">Grid Output<p id="${r}_summary" aria-label="grid output summary"><table id="${r}_map" summary="grid output content"></table><ul id="${r}_shapeDetails" aria-label="grid output shape details"></ul></div>`,this.dummyDOM.querySelector(a)?this.dummyDOM.querySelector(a).insertAdjacentHTML("afterend",s):this.dummyDOM.querySelector(`#${i}`).innerHTML=s,this._accessibleOutputs[r].map=this.dummyDOM.querySelector(`#${r}_map`)),this._accessibleOutputs[r].shapeDetails=this.dummyDOM.querySelector(`#${r}_shapeDetails`),this._accessibleOutputs[r].summary=this.dummyDOM.querySelector(`#${r}_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 i={},s=!0,n=function(e,t){let r,i;"rectangle"===e||"ellipse"===e||"arc"===e||"circle"===e||"square"===e?(r=Math.round(t[0]+t[2]/2),i=Math.round(t[1]+t[3]/2)):"triangle"===e?(r=(t[0]+t[2]+t[4])/3,i=(t[1]+t[3]+t[5])/3):"quadrilateral"===e?(r=(t[0]+t[2]+t[4]+t[6])/4,i=(t[1]+t[3]+t[5]+t[7])/4):"line"===e?(r=(t[0]+t[2])/2,i=(t[1]+t[3])/2):(r=t[0],i=t[1]);return[r,i]}(e,t);if("line"===e){i.color=this.ingredients.colors.stroke,i.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]);i.loc=r(n,this.width,this.height),i.pos=e===s?`at ${e}`:`from ${e} to ${s}`}else"point"===e?i.color=this.ingredients.colors.stroke:(i.color=this.ingredients.colors.fill,i.area=this._getArea(e,t)),i.pos=this._getPos(...n),i.loc=r(n,this.width,this.height);if(this.ingredients.shapes[e]){if(this.ingredients.shapes[e]!==[i]){for(let t in this.ingredients.shapes[e])JSON.stringify(this.ingredients.shapes[e][t])===JSON.stringify(i)&&(s=!1);!0===s&&this.ingredients.shapes[e].push(i)}}else this.ingredients.shapes[e]=[i]},t._getPos=function(t,r){const{x:i,y:s}=this.worldToScreen(new e.Vector(t,r)),n=this.width,a=this.height;return i<.4*n?s<.4*a?"top left":s>.6*a?"bottom left":"mid left":i>.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 r=0;if("arc"===e){const e=((t[5]-t[4])%(2*Math.PI)+2*Math.PI)%(2*Math.PI);if(r=e*t[2]*t[3]/8,"open"===t[6]||"chord"===t[6]){const i=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(i*(a-h)+n*(h-s)+o*(s-a))/2;e>Math.PI?r+=u:r-=u}}else"ellipse"===e||"circle"===e?r=3.14*t[2]/2*t[3]/2:"line"===e||"point"===e?r=0:"quadrilateral"===e?r=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?r=t[2]*t[3]:"triangle"===e&&(r=Math.abs(t[0]*(t[3]-t[5])+t[2]*(t[5]-t[1])+t[4]*(t[1]-t[3]))/2);const i=this.width*this._renderer._pixelDensity,s=this.height*this._renderer._pixelDensity,n=[new DOMPoint(0,0),new DOMPoint(i,0),new DOMPoint(i,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*r/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[i]=wa,e.renderers["p2d-hdr"]=new Proxy(wa,{construct:(e,[t,r,i,s,n])=>new e(t,r,i,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),Di(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 r=e[1];const i=e[2],s=(2-r)*i/2;return 0!==s&&(1===s?r=0:s<.5?r/=2-r:r=r*i/(2-2*s)),[t,r,s,e[3]]},_hsbaToRGBA(e){const t=6*e[0],r=e[1],i=e[2];let s=[];if(0===r)s=[i,i,i,e[3]];else{const n=Math.floor(t),a=i*(1-r),o=i*(1-r*(t-n)),h=i*(1-r*(1+n-t));let u,l,c;1===n?(u=o,l=i,c=a):2===n?(u=a,l=i,c=h):3===n?(u=a,l=o,c=i):4===n?(u=h,l=a,c=i):5===n?(u=i,l=a,c=o):(u=i,l=h,c=a),s=[u,l,c,e[3]]}return s},_hslaToHSBA(e){const t=e[0];let r=e[1];const i=e[2];let s;return s=i<.5?(1+r)*i:i+r-i*r,r=2*(s-i)/s,[t,r,s,e[3]]},_hslaToRGBA(e){const t=6*e[0],r=e[1],i=e[2];let s=[];if(0===r)s=[i,i,i,e[3]];else{let n;n=i<.5?(1+r)*i:i+r-i*r;const a=2*i-n,o=(e,t,r)=>(e<0?e+=6:e>=6&&(e-=6),e<1?t+(r-t)*e:e<3?r:e<4?t+(r-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],r=e[1],i=e[2],s=Math.max(t,r,i),n=s-Math.min(t,r,i);let a,o;return 0===n?(a=0,o=0):(o=n/s,t===s?a=(r-i)/n:r===s?a=2+(i-t)/n:i===s&&(a=4+(t-r)/n),a<0?a+=6:a>=6&&(a-=6)),[a/6,o,s,e[3]]},_rgbaToHSLA(e){const t=e[0],r=e[1],i=e[2],s=Math.max(t,r,i),n=Math.min(t,r,i),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=(r-i)/o:r===s?h=2+(i-t)/o:i===s&&(h=4+(t-r)/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 r;const i=[{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 r=t,function(e){let t;if(0!==e[0]){e[0]=Math.round(100*e[0]);let t=e[0].toString().split("");const r=t.length-1;t[r]=parseInt(t[r]),t[r]<2.5?t[r]=0:t[r]>=2.5&&t[r]<7.5&&(t[r]=5),2===t.length?(t[0]=parseInt(t[0]),t[r]>=7.5&&(t[r]=0,t[0]=t[0]+1),e[0]=10*t[0]+t[1]):t[r]>=7.5?e[0]=10:e[0]=t[r]}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--)r[e]=Math.round(1e4*r[e])/1e4;for(let e=0;e<i.length;e++){if(i[e].h===r[0]&&i[e].s===r[1]&&i[e].b===r[2]){t=i[e].name;break}t="white"}}else for(let r=0;r<s.length;r++)if(s[r].h===e[0]&&s[r].s===e[1]&&s[r].b===e[2]){t=s[r].name;break}return t}([t[0],t[1],t[2]])}}function Ma(e,t){t.storeItem=function(t,r){"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===r&&console.log("You cannot store undefined variables using storeItem().");let i=typeof r;switch(i){case"number":case"boolean":r=r.toString();break;case"object":if(r instanceof e.Color)i="p5.Color",r=r.toString();else if(r instanceof e.Vector){i="p5.Vector";r=[r.x,r.y,r.z]}r=JSON.stringify(r)}localStorage.setItem(t,r);const s=`${t}p5TypeID`;localStorage.setItem(s,i)},t.getItem=function(e){let t=localStorage.getItem(e);const r=localStorage.getItem(`${e}p5TypeID`);if(void 0===r)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(r){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 r(e,t,r){(t._userNode?t._userNode:document.body).appendChild(e);const i=r?new vs(e,t):new Mi(e,t);return t._elements.push(i),i}t.select=function(e,t){const r=this._getContainer(t).querySelector(e);return r?this._wrapElement(r):null},t.selectAll=function(e,t){const r=[],i=this._getContainer(t).querySelectorAll(e);if(i)for(let e=0;e<i.length;e++){const t=this._wrapElement(i[e]);r.push(t)}return r},t._getContainer=function(e){let t=document;return"string"==typeof e?t=document.querySelector(e)||document:e instanceof Mi?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 Mi(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 Mi(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 Mi(e,this)):new Mi(e,this)},t.createElement=function(e,t){const i=document.createElement(e);return void 0!==t&&(i.innerHTML=t),r(i,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,r(t,this)},t.createP=function(e=""){let t=document.createElement("p");return t.innerHTML=e,r(t,this)},t.createSpan=function(e=""){let t=document.createElement("span");return t.innerHTML=e,r(t,this)},t.createImg=function(){const e=document.createElement("img"),t=arguments;let i;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],i=r(e,this),e.addEventListener("load",(function(){i.width=e.offsetWidth||e.width,i.height=e.offsetHeight||e.height;const r=t[t.length-1];"function"==typeof r&&r(i)})),i},t.createA=function(e,t,i){const s=document.createElement("a");return s.href=e,s.innerHTML=t,i&&(s.target=i),r(s,this)},t.createSlider=function(e,t,i,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 i&&(n.value=i),r(n,this)},t.createButton=function(e,t){const i=document.createElement("button");return i.innerHTML=e,t&&(i.value=t),r(i,this)},t.createCheckbox=function(...e){const t=document.createElement("div"),i=document.createElement("input");i.type="checkbox";const s=document.createElement("label");s.appendChild(i),t.appendChild(s);const n=r(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]&&(i.checked=!0),n},t.createSelect=function(...e){let t,i=e[0];if(i instanceof Mi&&i.elt instanceof HTMLSelectElement)t=i,this.elt=i.elt;else if(i instanceof HTMLSelectElement)t=r(i,this),this.elt=i;else{const e=document.createElement("select");i&&"boolean"==typeof i&&e.setAttribute("multiple","true"),t=r(e,this),this.elt=e}return t.option=function(e,t){let r;if(void 0!==e){for(let t=0;t<this.elt.length;t+=1)if(this.elt[t].textContent===e){r=t;break}if(void 0!==r)!1===t?this.elt.remove(r):this.elt[r].value=t;else{const r=document.createElement("option");r.textContent=e,r.value=void 0===t?e:t,this.elt.appendChild(r),this._pInst._elements.push(r)}}},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 i=0;t.createRadio=function(...e){let t,s,n;const a=e[0];a instanceof Mi&&(a.elt instanceof HTMLDivElement||a.elt instanceof HTMLSpanElement)?(t=a,this.elt=a.elt):a instanceof HTMLDivElement||a instanceof HTMLSpanElement?(t=r(a,this),this.elt=a,s=a,"string"==typeof e[1]&&(n=e[1])):("string"==typeof a&&(n=a),s=document.createElement("div"),t=r(s,this),this.elt=s),t._name=n||"radioOption_"+i++;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,r){let i,s,n;for(const r of t._getOptionsArray())if(r.value===e){i=r;break}return void 0===i&&(i=document.createElement("input"),i.setAttribute("type","radio"),i.setAttribute("value",e)),i.setAttribute("name",t._name),h(i.parentElement)?s=i.parentElement:(s=document.createElement("label"),s.insertAdjacentElement("afterbegin",i)),s.lastElementChild instanceof HTMLSpanElement?n=s.lastElementChild:(n=document.createElement("span"),i.insertAdjacentElement("afterend",n)),n.innerHTML=void 0===r?e:r,this.elt.appendChild(s),i},t.remove=function(e){for(const r of t._getOptionsArray())if(r.value===e)return void(h(r.parentElement)?r.parentElement.remove():r.remove())},t.value=function(){let e="";for(const r of t._getOptionsArray())if(r.checked){e=r.value;break}return e},t.selected=function(e){let r=null;if(void 0===e){for(const e of t._getOptionsArray())if(e.checked){r=e;break}}else{t._getOptionsArray().forEach((e=>{e.checked=!1,e.removeAttribute("checked")}));for(const i of t._getOptionsArray())i.value===e&&(i.setAttribute("checked",!0),i.checked=!0,r=i)}return r},t.disable=function(e=!0){for(const r of t._getOptionsArray())r.setAttribute("disabled",e)},t},t.createColorPicker=function(t){const i=document.createElement("input");let s;i.type="color",t?t instanceof e.Color?i.value=t.toString("#rrggbb"):(this.push(),this.colorMode("rgb"),i.value=this.color(t).toString("#rrggbb"),this.pop()):i.value="#000000",s=r(i,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 i=document.createElement("input");return i.setAttribute("value",e),i.setAttribute("type",t),r(i,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 i=document.createElement("input");return i.setAttribute("type","file"),t&&i.setAttribute("multiple",!0),i.addEventListener("change",(function(t){for(const r of t.target.files)Fi._load(r,e)}),!1),r(i,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 r=0,i=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=r+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,r=u-180;const l=this._toDegrees(this.rotationY)+180,c=this._toDegrees(this.pRotationY)+180;let p=i+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,i=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,r;null!==this.pAccelerationX&&(t=Math.abs(this.accelerationX-this.pAccelerationX),r=Math.abs(this.accelerationY-this.pAccelerationY)),t+r>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&&e.repeat)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 r(e,t,r,i){const s=e.getBoundingClientRect();return{x:(i.clientX-s.left)/t,y:(i.clientY-s.top)/r,winX:i.clientX,winY:i.clientY,id:i.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,i=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(r(t,i,s,n));this.touches=e}const n=function(e,t,r,i){const s=e.getBoundingClientRect();return{x:(i.clientX-s.left)/t,y:(i.clientY-s.top)/r,winX:i.clientX,winY:i.clientY}}(t,i,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 r;this._updatePointerCoords(e),this._activePointers.set(e.pointerId,e),this._setMouseButton(e),this.mouseIsPressed||"function"!=typeof t.mouseMoved?this.mouseIsPressed&&"function"==typeof t.mouseDragged&&(r=t.mouseDragged(e),!1===r&&e.preventDefault()):(r=t.mouseMoved(e),!1===r&&e.preventDefault())},t._onpointerdown=function(e){const t=this._isGlobal?window:this;let r;this.mouseIsPressed=!0,this._activePointers.set(e.pointerId,e),this._setMouseButton(e),this._updatePointerCoords(e),"function"==typeof t.mousePressed&&(r=t.mousePressed(e),!1===r&&e.preventDefault())},t._onpointerup=function(e){const t=this._isGlobal?window:this;let r;this.mouseIsPressed=!1,this._activePointers.delete(e.pointerId),this._setMouseButton(e),this._updatePointerCoords(e),"function"==typeof t.mouseReleased&&(r=t.mouseReleased(e),!1===r&&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={},r=e=>e){const i=Object.create(null);if(i.options=t,i.options.eof=void 0===i.options.eof||i.options.eof,i.row=1,i.col=1,i.output="",i.options.delimiter=void 0===i.options.delimiter?'"':t.delimiter,i.options.delimiter.length>1||0===i.options.delimiter.length)throw Error(`CSVError: delimiter must be one character [${i.options.separator}]`);if(i.options.separator=void 0===i.options.separator?",":t.separator,i.options.separator.length>1||0===i.options.separator.length)throw Error(`CSVError: separator must be one character [${i.options.separator}]`);const s=new RegExp(`${Ls(i.options.delimiter)}|${Ls(i.options.separator)}|\r\n|\n|\r`);return e.forEach(((t,n)=>{let a="";switch(i.col=1,t.forEach(((e,n)=>{"string"==typeof e&&(e=e.replace(new RegExp(i.options.delimiter,"g"),`${i.options.delimiter}${i.options.delimiter}`),e=s.test(e)?`${i.options.delimiter}${e}${i.options.delimiter}`:e),a+=r(e,i.row,i.col),n!==t.length-1&&(a+=i.options.separator),i.col++})),!0){case i.options.eof:case!i.options.eof&&n!==e.length-1:i.output+=`${a}\n`;break;default:i.output+=`${a}`}i.row++})),i.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 r=0;r<this.rows.length;r++)if(this.rows[r].obj[this.columns.indexOf(t)]===e)return this.rows[r]}else for(let r=0;r<this.rows.length;r++)if(this.rows[r].arr[t]===e)return this.rows[r];return null}findRows(e,t){const r=[];if("string"==typeof t)for(let i=0;i<this.rows.length;i++)this.rows[i].obj[this.columns.indexOf(t)]===e&&r.push(this.rows[i]);else for(let i=0;i<this.rows.length;i++)this.rows[i].arr[t]===e&&r.push(this.rows[i]);return r}matchRow(e,t){if("number"==typeof t){for(let r=0;r<this.rows.length;r++)if(this.rows[r].arr[t].match(e))return this.rows[r]}else for(let r=0;r<this.rows.length;r++)if(this.rows[r].obj[this.columns.indexOf(t)].match(e))return this.rows[r];return null}matchRows(e,t){const r=[];if("number"==typeof t)for(let i=0;i<this.rows.length;i++)this.rows[i].arr[t].match(e)&&r.push(this.rows[i]);else for(let i=0;i<this.rows.length;i++)this.rows[i].obj[this.columns.indexOf(t)].match(e)&&r.push(this.rows[i]);return r}getColumn(e){const t=[];if("string"==typeof e)for(let r=0;r<this.rows.length;r++)t.push(this.rows[r].obj[this.columns.indexOf(e)]);else for(let r=0;r<this.rows.length;r++)t.push(this.rows[r].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 r=[];for(let t=0;t<e.length;t++)r.push(e.charAt(t).replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&"));const i=new RegExp(r.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 r=this.rows[t].arr[e];r=r.replace(i,""),this.rows[t].arr[e]=r,this.rows[t].obj[this.columns[e]]=r}else if("string"==typeof t)for(let e=0;e<this.rows.length;e++){let r=this.rows[e].obj[t];r=r.replace(i,""),this.rows[e].obj[t]=r;const s=this.columns.indexOf(t);this.rows[e].arr[s]=r}else for(let e=0;e<this.rows.length;e++){let r=this.rows[e].arr[t];r=r.replace(i,""),this.rows[e].arr[t]=r,this.rows[e].obj[this.columns[t]]=r}}trim(e){const t=new RegExp(" ","g");if(void 0===e)for(let e=0;e<this.columns.length;e++)for(let r=0;r<this.rows.length;r++){let i=this.rows[r].arr[e];i=i.replace(t,""),this.rows[r].arr[e]=i,this.rows[r].obj[this.columns[e]]=i}else if("string"==typeof e)for(let r=0;r<this.rows.length;r++){let i=this.rows[r].obj[e];i=i.replace(t,""),this.rows[r].obj[e]=i;const s=this.columns.indexOf(e);this.rows[r].arr[s]=i}else for(let r=0;r<this.rows.length;r++){let i=this.rows[r].arr[e];i=i.replace(t,""),this.rows[r].arr[e]=i,this.rows[r].obj[this.columns[e]]=i}}removeColumn(e){let t,r;"string"==typeof e?(t=e,r=this.columns.indexOf(e)):(r=e,t=this.columns[e]);const i=this.columns.splice(r+1,this.columns.length);this.columns.pop(),this.columns=this.columns.concat(i);for(let e=0;e<this.rows.length;e++){const i=this.rows[e].arr,s=i.splice(r+1,i.length);i.pop(),this.rows[e].arr=i.concat(s),delete this.rows[e].obj[t]}}set(e,t,r){this.rows[e].set(t,r)}setNum(e,t,r){this.rows[e].setNum(t,r)}setString(e,t,r){this.rows[e].setString(t,r)}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 r,i,s;for(let n=0;n<this.rows.length;n++)if(r=this.rows[n].obj,"string"==typeof e){if(i=this.columns.indexOf(e),!(i>=0))throw new Error(`This table has no column named "${e}"`);s=r[e],t[s]=r}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 r=this.table.columns.indexOf(e);if(!(r>=0))throw new Error(`This table has no column named "${e}"`);this.obj[e]=t,this.arr[r]=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 r=this.table.columns[e];this.obj[r]=t}}}setNum(e,t){const r=parseFloat(t);this.set(e,r)}setString(e,t){const r=t.toString();this.set(e,r)}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,r){return Math.max(Math.min(e,r),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,r){return r*(t-e)+e},t.log=Math.log,t.mag=function(e,t){return Math.hypot(e,t)},t.map=function(e,t,r,i,s,n){const a=(e-t)/(r-t)*(s-i)+i;return n?i<s?this.constrain(a,i,s):this.constrain(a,s,i):a},t.max=function(...e){const t=e=>{let t=-1/0;for(let r of e)t=Math.max(t,r);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 r of e)t=Math.min(t,r);return t};return e[0]instanceof Array?t(e[0]):t(e)},t.norm=function(e,t,r){return this.map(e,t,r,0,1)},t.pow=Math.pow,t.round=function(e,t){if(!t)return Math.round(e);const r=Math.pow(10,t);return Math.round(e*r)/r},t.sq=e=>e*e,t.sqrt=Math.sqrt,t.fract=function(e){let t=0,r=Number(e);if(isNaN(r)||Math.abs(r)===1/0)return r;if(r<0&&(r=-r,t=1),String(r).includes(".")&&!String(r).includes("e")){let e=String(r);return e=Number("0"+e.slice(e.indexOf("."))),Math.abs(t-e)}return r<1?Math.abs(t-r):0}}function Ua(e,t){const r=4095;let i=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<i;e++){let e=d+(f<<4)+(g<<8);h=n(m),u=n(y),l=a[e&r],l+=h*(a[e+1&r]-l),c=a[e+16&r],c+=h*(a[e+16+1&r]-c),l+=u*(c-l),e+=256,c=a[e&r],c+=h*(a[e+1&r]-c),p=a[e+16&r],p+=h*(a[e+16+1&r]-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&&(i=e),t>0&&(s=t)},t.noiseSeed=function(e){const t=(()=>{const e=4294967296;let t,r;return{setSeed(i){r=t=(null==i?Math.random()*e:i)>>>0},getSeed:()=>t,rand:()=>(r=(1664525*r+1013904223)%e,r/e)}})();t.setSeed(e),a=new Array(4096);for(let e=0;e<4096;e++)a[e]=t.rand()}}function Ga(e,t){const r="_lcg_random_state",i=4294967296;let s=0;t._lcg=function(e){return this[e]=(1664525*this[e]+1013904223)%i,this[e]/i},t._lcgSetSeed=function(e,t){this[e]=(null==t?Math.random()*i:t)>>>0},t.randomSeed=function(e){this._lcgSetSeed(r,e),this._gaussian_previous=!1},t.random=function(e,t){let i;if(i=null!=this[r]?this._lcg(r):Math.random(),void 0===e)return i;if(void 0===t)return e instanceof Array?e[Math.floor(i*e.length)]:i*e;if(e>t){const r=e;e=t,t=r}return i*(t-e)+e},t.randomGaussian=function(e,t=1){let r,i,n,a;if(this._gaussian_previous)r=s,this._gaussian_previous=!1;else{do{i=this.random(2)-1,n=this.random(2)-1,a=i*i+n*n}while(a>=1);a=Math.sqrt(-2*Math.log(a)/a),r=i*a,s=n*a,this._gaussian_previous=!0}return r*t+(e||0)}}function za(e,t){t.createVector=function(t,r,i){return this instanceof e?new e.Vector(this._fromRadians.bind(this),this._toRadians.bind(this),...arguments):new e.Vector(t,r,i)},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,r=10){return e===1/0||"Infinity"===e?1/0:e===-1/0||"-Infinity"===e?-1/0:"string"==typeof e?parseInt(e,r):"number"==typeof e?0|e:"boolean"==typeof e?e?1:0:e instanceof Array?e.map((e=>t.int(e,r))):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 r=t.int(e,10);return"number"==typeof r?(r+128)%256-128:r instanceof Array?r.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,r){if(r=null==r?r=8:r,e instanceof Array)return e.map((e=>t.hex(e,r)));if(e===1/0||e===-1/0){return(e===1/0?"F":"0").repeat(r)}if("number"==typeof e){e<0&&(e=4294967295+e+1);let t=Number(e).toString(16).toUpperCase();for(;t.length<r;)t=`0${t}`;return t.length>=r&&(t=t.substring(t.length-r,t.length)),t}},t.unhex=function(e){return e instanceof Array?e.map(t.unhex):parseInt(`0x${e}`,16)}}function $a(e,t){function r(e,t,r){let i=e<0;e=Math.abs(e);let[s,n]=e.toString().split(".");if(void 0===r){s=s.padStart(t,"0");let e=n?s+"."+n:s;return i?"-"+e:e}{let a=e.toFixed(r);[s,n]=a.toString().split("."),s=s.padStart(t,"0");let o=void 0===n?s:s+"."+n;return i?"-"+o:o}}function i(e,t){const r=(e=e.toString()).indexOf(".");let i=-1!==r?e.substring(r):"",s=-1!==r?e.substring(0,r):e;if(s=s.toString().replace(/\B(?=(\d{3})+(?!\d))/g,","),0===t)i="";else if(void 0!==t)if(t>i.length){i+=-1===r?".":"";const e=t-i.length+1;for(let t=0;t<e;t++)i+="0"}else i=i.substring(0,t+1);return s+i}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,i){if(e instanceof Array)return e.map((e=>r(e,t,i)));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]):r(e,t,i)},t.nfc=function(e,t){return e instanceof Array?e.map((e=>i(e,t))):i(e,t)},t.nfp=function(...e){const r=t.nf.apply(this,e);return r instanceof Array?r.map(s):s(r)},t.nfs=function(...e){const r=t.nf.apply(this,e);return r instanceof Array?r.map(n):n(r)},t.splitTokens=function(e,t){let r;if(void 0!==t){let e=t;const i=/\]/g.exec(e);let s=/\[/g.exec(e);s&&i?(e=e.slice(0,i.index)+e.slice(i.index+1),s=/\[/g.exec(e),e=e.slice(0,s.index)+e.slice(s.index+1),r=new RegExp(`[\\[${e}\\]]`,"g")):i?(e=e.slice(0,i.index)+e.slice(i.index+1),r=new RegExp(`[${e}\\]]`,"g")):s?(e=e.slice(0,s.index)+e.slice(s.index+1),r=new RegExp(`[${e}\\[]`,"g")):r=new RegExp(`[${e}]`,"g")}else r=/\s/g;return e.split(r).filter((e=>e))},t.shuffle=function(e,t){const r=ArrayBuffer&&ArrayBuffer.isView&&ArrayBuffer.isView(e);let i,s,n=(e=t||r?e:e.slice()).length;for(;n>1;)i=this.random(0,1)*n|0,s=e[--n],e[n]=e[i],e[i]=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,r,i){this._assert3d("orbitControl");const s=this._renderer.states.curCamera;void 0===e&&(e=1),void 0===t&&(t=e),void 0===r&&(r=1),"object"!=typeof i&&(i={}),!0!==this.contextMenuDisabled&&(this.canvas.oncontextmenu=()=>!1,this.contextMenuDisabled=!0),!0!==this.wheelDefaultDisabled&&(this.canvas.onwheel=()=>!1,this.wheelDefaultDisabled=!0);const{disableTouchActions:n=!0}=i;!0!==this.touchActionsDisabled&&n&&(this.canvas.style["touch-action"]="none",this.touchActionsDisabled=!0);const{freeRotation:a=!1}=i,o=[];this.touches.forEach((e=>{this._renderer.prevTouches.forEach((t=>{if(e.id===t.id){const r={x:e.x,y:e.y,px:t.x,py:t.y};o.push(r)}}))})),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 r=o[0];u=-e*(r.x-r.px)/f,l=t*(r.y-r.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))*r*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)*r,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,r=s.eyeY-s.centerY,i=s.eyeZ-s.centerZ,n=Math.sqrt(t*t+r*r+i*i);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,r,i,s){void 0===e&&(e=this.width/2),void 0===t&&(t=Math.round(e/30)<4?4:Math.round(e/30)),void 0===r&&(r=0),void 0===i&&(i=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+r,i,e*n-a+s),this.vertex(+a+r,i,e*n-a+s),this.endShape();for(let e=0;e<=t;e++)this.beginShape(this.LINES),this.vertex(e*n-a+r,i,-a+s),this.vertex(e*n-a+r,i,+a+s),this.endShape();this.pop()}},t._axesIcon=function(e,t,r,i){return void 0===e&&(e=this.width/20>40?this.width/20:40),void 0===t&&(t=-this.width/4),void 0===r&&(r=t),void 0===i&&(i=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,r,i),this.vertex(t+e,r,i),this.endShape(),this.stroke(0,255,0),this.beginShape(this.LINES),this.vertex(t,r,i),this.vertex(t,r+e,i),this.endShape(),this.stroke(0,0,255),this.beginShape(this.LINES),this.vertex(t,r,i),this.vertex(t,r,i+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 r(e){let t=null,r={};const{data:i}=await Os(e,"text"),s=i.split("\n");for(let e=0;e<s.length;++e){const i=s[e].trim().split(/\s+/);if("newmtl"===i[0]){t=i[1],r[t]={}}else"Kd"===i[0]?r[t].diffuseColor=[parseFloat(i[1]),parseFloat(i[2]),parseFloat(i[3])]:"Ka"===i[0]?r[t].ambientColor=[parseFloat(i[1]),parseFloat(i[2]),parseFloat(i[3])]:"Ks"===i[0]?r[t].specularColor=[parseFloat(i[1]),parseFloat(i[2]),parseFloat(i[3])]:"map_Kd"===i[0]&&(r[t].texturePath=i[1])}return r}function i(e,t,r={}){const i={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]));i[u[0]].push(e)}else if("vt"===u[0]){const e=[parseFloat(u[1]),1-parseFloat(u[2])];i[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(i.v[p[0]].copy()),e.uvs.push(i.vt[p[1]]?i.vt[p[1]].slice():[0,0]),e.vertexNormals.push(i.vn[p[2]]?i.vn[p[2]].copy():new je),s[c][n]=t,h.push(t),n&&r[n]&&r[n].diffuseColor){a=!0;const t=r[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),r=[115,111,108,105,100];for(let e=0;e<5;e++)if(n(r,t,e))return!1;return!0}(t))!function(e,t){const r=new DataView(t),i=r.getUint32(80,!0);let s,n,a,o,h,u,l,c=!1;for(let e=0;e<70;e++)1129270351===r.getUint32(e,!1)&&82===r.getUint8(e+4)&&61===r.getUint8(e+5)&&(c=!0,o=[],h=r.getUint8(e+6)/255,u=r.getUint8(e+7)/255,l=r.getUint8(e+8)/255);const p=84,d=50;for(let t=0;t<i;t++){const i=p+t*d,f=r.getFloat32(i,!0),g=r.getFloat32(i+4,!0),m=r.getFloat32(i+8,!0);if(c){const e=r.getUint16(i+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=i+12*t,u=new je(r.getFloat32(h,!0),r.getFloat32(h+4,!0),r.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 r=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 r,i,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"`);r=new je(parseFloat(h[2]),parseFloat(h[3]),parseFloat(h[4])),e.vertexNormals.push(r,r,r),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])i=new je(parseFloat(h[1]),parseFloat(h[2]),parseFloat(h[3])),e.vertices.push(i),e.uvs.push([0,0]),n.push(e.vertices.indexOf(i));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"`);r=new je(parseFloat(h[2]),parseFloat(h[3]),parseFloat(h[4])),e.vertexNormals.push(r,r,r),s="facet normal"}break;default:console.error(`Invalid state "${s}"`)}}}(e,new TextDecoder("utf-8").decode(r).split("\n"))}return e}function n(e,t,r){for(let i=0,s=e.length;i<s;i++)if(e[i]!==t.getUint8(r+i,!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 i=[];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;i.push(Ha(s).then((e=>e?r(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(i);return Object.assign({},...e)}catch(e){return{}}}(s);return i(c,s,n),a&&c.normalize(),u&&c.flipU(),l&&c.flipV(),c._makeTriangleEdges(),o?o(c):c}}catch(r){if(e._friendlyFileLoadError(3,t),h)return h(r);throw r}},t.model=function(e,t=1){this._assert3d("model"),this._renderer.model(e,t)};let a=0;t.createModel=function(t,r=" ",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=`${r}|${u}|${a++}`,r.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(r.match(/\.obj$/i))try{i(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 ro(e,t){const r=/\r?\n/g,i=/,\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((r=>{t[r]=function(...e){if(!(r in xs.prototype))throw Error(`Renderer2D.prototype.${r} is not defined.`);return this._renderer[r](...e)},e.Graphics.prototype[r]=function(...e){return this._renderer[r](...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,r,i,s){let n=this.textDrawingContext().textBaseline;({x:t,y:r,width:i,height:s}=this._handleRectMode(t,r,i,s));let a=this._processLines(e,i,s);a=this._positionLines(t,r,i,s,a),a.forEach((e=>this._renderText(e.text,e.x,e.y))),this.textDrawingContext().textBaseline=n},xs.prototype.textBounds=function(e,t,r,i,s){return this._computeBounds(Ka,e,t,r,i,s).bounds},xs.prototype.fontBounds=function(e,t,r,i,s){return this._computeBounds(Ja,e,t,r,i,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,r){return void 0!==e?(this.states.setValue("textAlign",e),void 0!==r&&(r===t.CENTER&&(r=Za),this.states.setValue("textBaseline",r)),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,r,i){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===r&&/[.0-9]+(%|em|p[xt])/.test(s)&&({family:s,size:r}=this._directSetFontString(s)),"string"!=typeof s)throw Error("null font in textFont()");return 2===arguments.length&&"object"==typeof r&&(i=r,r=void 0),this.states.setValue("textFont",{font:t,family:s,size:r}),void 0!==r&&this._setTextSize(r),"object"==typeof i&&this.textProperties(i),this._applyTextProperties()},xs.prototype._directSetFontString=function(e,t=0){t&&console.log('_directSetFontString"'+e+'"');let r=u.reduce(((e,t)=>(e[t]=o[t].default,e)),{}),i=this._cachedDiv(r);i.style.font=e;let s=getComputedStyle(i);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,r){let i=!1,s=r?.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,i=!0,s&&console.log("this.states."+e+'="'+options[e]+'"')):e in this.textDrawingContext()?(this._setContextProperty(e,t,s),i=!0):e in this.textCanvas().style?(this._setCanvasStyleProperty(e,t,s),i=!0):console.warn('Ignoring unknown text option: "'+e+'"\n'),i?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,r)=>(e[r]=t[r],e)),{}),Object.keys(o).forEach((r=>{if("Context2d"===o[r]?.type)e[r]=t[r];else if("textFont"===r){let t=this._currentTextFont();"object"==typeof t&&"_pInst"in t&&(t=Object.assign({},t),delete t._pInst),e[r]=t}else e[r]=this.states[r]})),e},xs.prototype.textMode=function(){},xs.prototype._currentTextFont=function(){return this.states.textFont.font||this.states.textFont.family},xs.prototype._computeBounds=function(t,r,i,s,n,a,o){let h=this.textDrawingContext(),u=h.textBaseline,{textLeading:l,textAlign:c}=this.states;({width:n,height:a}=this._rectModeAdjust(i,s,n,a));let p=this._processLines(r,n,a),d=p.map(((e,r)=>this[t].bind(this)(e,i,s+r*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,r,i,s){if(void 0!==i)switch(this.states.rectMode){case t.CENTER:break;case t.CORNERS:i-=e,s-=r;break;case t.RADIUS:i*=2,s*=2}return{x:e,y:r,width:i,height:s}},xs.prototype._setCanvasStyleProperty=function(e,t,r){let i=t.toString();r&&console.log("canvas.style."+e+'="'+i+'"'),"fontVariationSettings"===e&&this._handleFontVariationSettings(i),this.textCanvas().style[e]=i,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(i).forEach((e=>{e=e.replace(/["']/g,"");let r=a.exec(e);if(r&&r.length){let i=r[0],s=parseFloat(parseFloat(e.replace(i,"").trim()).toFixed(3));switch(i){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,r=!1){if(this.textDrawingContext()[e]===t)return this._pInst;(c??=[]).push([e,t]),r&&console.log("queued context2d."+e+'="'+t+'"')},xs.prototype._handleRectMode=function(e,r,i,s){let n=this.states.rectMode;if(void 0!==i)switch(n){case t.RADIUS:e-=(i*=2)/2,void 0!==s&&(r-=(s*=2)/2);break;case t.CENTER:e-=i/2,void 0!==s&&(r-=s/2);break;case t.CORNERS:i-=e,void 0!==s&&(s-=r)}return{x:e,y:r,width:i,height:s}},xs.prototype._fontSizePx=function(e,{family:t}=this.states.textFont){if(r=e,!isNaN(r)&&""!==r.trim())return parseFloat(e);var r;let i=this._cachedDiv({fontSize:e});i.style.fontSize=e,i.style.fontFamily=t;let s=getComputedStyle(i).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,r])=>{t.style[e]=r})),this.textCanvas().appendChild(t),p=t}return p},xs.prototype._aggregateBounds=function(e){let t=Math.min(...e.map((e=>e.x))),r=Math.min(...e.map((e=>e.y))),i=Math.max(...e.map((e=>e.y+e.h))),s=Math.max(...e.map((e=>e.x+e.w)));return{x:t,y:r,w:s-t,h:i-r}},xs.prototype._processLines=function(e,r,i){if(void 0!==r){this.textDrawingContext().textBaseline===t.BASELINE&&(this.drawingContext.textBaseline=t.TOP)}let s=this._splitOnBreaks(e.toString()),n=s.length>1,a=void 0!==r,o=a&&s.some((e=>this._textWidthSingle(e)>r)),{textLeading:h,textWrap:u}=this.states;if((n||o)&&a&&(s=this._lineate(u,s,r)),a&&void 0!==i){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)>i){s=s.slice(0,e);break}}}return s},xs.prototype._xAlignOffset=function(e,r){switch(e){case t.LEFT:return 0;case t.CENTER:return r/2;case t.RIGHT:return r;case eo:return 0;case to:throw new Error("textBounds: END not yet supported for textAlign");default:return 0}},xs.prototype._rectModeAlign=function(e,r,i){if(void 0!==r){switch(this.states.rectMode){case t.CENTER:e.x-=(r-e.w)/2,e.y-=(i-e.h)/2;break;case t.CORNERS:e.w+=e.x,e.h+=e.y;break;case t.RADIUS:e.x-=(r-e.w)/2,e.y-=(i-e.h)/2,e.w/=2,e.h/=2}return e}},xs.prototype._rectModeAlignRevert=function(e,r,i){if(void 0!==r){switch(this.states.rectMode){case t.CENTER:e.x+=(r-e.w)/2,e.y+=(i-e.h)/2;break;case t.CORNERS:e.w-=e.x,e.h-=e.y;break;case t.RADIUS:e.x+=(r-e.w)/2,e.y+=(i-e.h)/2,e.w*=2,e.h*=2}return e}},xs.prototype._textWidthSingle=function(e){let t=this.textDrawingContext().measureText(e),r=t.actualBoundingBoxLeft;return t.actualBoundingBoxRight+r},xs.prototype._fontWidthSingle=function(e){return this.textDrawingContext().measureText(e).width},xs.prototype._textBoundsSingle=function(e,t=0,r=0){let i=this.textDrawingContext().measureText(e),s=i.actualBoundingBoxAscent,n=i.actualBoundingBoxDescent,a=i.actualBoundingBoxLeft;return{x:t-a,y:r-s,w:i.actualBoundingBoxRight+a,h:s+n}},xs.prototype._fontBoundsSingle=function(e,t=0,r=0){let i=this.textDrawingContext().measureText(e),s=i.fontBoundingBoxAscent,n=i.fontBoundingBoxDescent;return{x:t-=this._xAlignOffset(this.states.textAlign,i.width),y:r-s,w:i.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,r,i=1/0,s={}){let n,a,o,h,u=s.splitChar??(e===t.WORD?" ":""),l=[];for(let e=0;e<r.length;e++){n="",h=r[e].split(u);for(let e=0;e<h.length;e++)a=`${n+h[e]}`+u,o=this._textWidthSingle(a),n.length>0&&o>i?(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(r):[""]},xs.prototype._parseFontFamily=function(e){return e.split(i).map((e=>((e=e.trim()).indexOf(" ")>-1&&!s.test(e)&&(e=`"${e}"`),e))).join(", ")},xs.prototype._applyFontString=function(){let{textFont:e,textSize:r,lineHeight:i,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}${`${r}px`+(i!==t.NORMAL?`/${i} `:" ")}${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 r=this.states.fontStretch;for(l.includes(r)&&t.fontStretch!==r&&(t.fontStretch=r);c?.length;){let[r,i]=c.shift();e&&console.log('apply context property "'+r+'" = "'+i+'"'),t[r]=i,t[r]!==i&&(console.warn(`Unable to set '${r}' property on context2d. It may not be supported.`),console.log('Expected "'+i+'" but got: "'+t[r]+'"'))}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,r,i,s){let n=this.states,a=this.textDrawingContext();r<s||r>=i||(this.push(),n.strokeColor&&n.strokeSet&&a.strokeText(e,t,r),!this._clipping&&n.fillColor&&(n.fillSet||this._setFill("#000000"),a.fillText(e,t,r)),this.pop())},e.Renderer2D.prototype._positionLines=function(e,r,i,s,n){let a,{textLeading:o,textAlign:h}=this.states,u=new Array(n.length),l=void 0===i?0:i,c=void 0===s?0:s;for(let i=0;i<n.length;i++){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[i]={text:n[i],x:a,y:r+i*o}}return this._yAlignOffset(u,c)},e.Renderer2D.prototype._yAlignOffset=function(e,r){if(void 0===r)throw Error("_yAlignOffset: height is required");let{textLeading:i,textBaseline:s}=this.states,n=0,a=r-i*(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 r=e.RendererGL.prototype.remove;e.RendererGL.prototype.remove=function(){this._textCanvas&&this._textCanvas.parentElement.removeChild(this._textCanvas),r.call(this)},e.RendererGL.prototype._positionLines=function(e,r,i,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===i?Math.max(0,...h):i,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+(i||0)/2;break;case t.RIGHT:u=e+c-h[s]-c+(i||0);break;case to:throw new Error("textBounds: END not yet supported for textAlign")}l[s]={text:n[s],x:u,y:r+s*a}}return this._yAlignOffset(l,p)},e.RendererGL.prototype._yAlignOffset=function(e,r){if(void 0===r)throw Error("_yAlignOffset: height is required");let{textLeading:i,textBaseline:s,textSize:n}=this.states,a=0,o=e.length,h=n*o+(i-n)*(o-1);switch(s){case t.TOP:a=n;break;case t.BASELINE:break;case Za:a=-h/2+n+(r||0)/2;break;case t.BOTTOM:a=-(h-n)+(r||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&&ro(p5,p5.prototype);var io={};Object.defineProperty(io,"__esModule",{value:!0});var so=function(){function e(){}return e.parse=function(t){for(var r=new Set,i=0,s=t;i<s.length;i++){var n=s[i];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];r.add(f)}else r.add(parseInt(o,16))}if(h&&u){var g=parseInt(h,16),m=parseInt(u,16);for(f=g;f<=m;f++)r.add(f)}}return Array.from(r).sort((function(e,t){return e-t}))},e.stringify=function(t){for(var r,i=Array.from(new Set(t)).sort((function(e,t){return e-t})),s=[],n=0;n<i.length;n++){var a=i[n],o=i[n-1];r&&a-o!=1&&(s.push(e.rangeString(r,o)),r=a),r||(r=a),n===i.length-1&&(r===a?s.push(e.rangeString(a)):s.push(e.rangeString(r,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=io.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,r,i)=>{let s=65535&e,n=e>>>16&65535,a=0;for(;0!==r;){a=r>2e3?2e3:r,r-=a;do{s=s+t[i++]|0,n=n+s|0}while(--a);s%=65521,n%=65521}return s|n<<16};const uo=new Uint32Array((()=>{let e,t=[];for(var r=0;r<256;r++){e=r;for(var i=0;i<8;i++)e=1&e?3988292384^e>>>1:e>>>1;t[r]=e}return t})());var lo=(e,t,r,i)=>{const s=uo,n=i+r;e^=-1;for(let r=i;r<n;r++)e=e>>>8^s[255&(e^t[r])];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 r=t.shift();if(r){if("object"!=typeof r)throw new TypeError(r+"must be non-object");for(const t in r)fo(r,t)&&(e[t]=r[t])}}return e},mo=e=>{let t=0;for(let r=0,i=e.length;r<i;r++)t+=e[r].length;const r=new Uint8Array(t);for(let t=0,i=0,s=e.length;t<s;t++){let s=e[t];r.set(s,i),i+=s.length}return r};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,r,i,s,n,a=e.length,o=0;for(s=0;s<a;s++)r=e.charCodeAt(s),55296==(64512&r)&&s+1<a&&(i=e.charCodeAt(s+1),56320==(64512&i)&&(r=65536+(r-55296<<10)+(i-56320),s++)),o+=r<128?1:r<2048?2:r<65536?3:4;for(t=new Uint8Array(o),n=0,s=0;n<o;s++)r=e.charCodeAt(s),55296==(64512&r)&&s+1<a&&(i=e.charCodeAt(s+1),56320==(64512&i)&&(r=65536+(r-55296<<10)+(i-56320),s++)),r<128?t[n++]=r:r<2048?(t[n++]=192|r>>>6,t[n++]=128|63&r):r<65536?(t[n++]=224|r>>>12,t[n++]=128|r>>>6&63,t[n++]=128|63&r):(t[n++]=240|r>>>18,t[n++]=128|r>>>12&63,t[n++]=128|r>>>6&63,t[n++]=128|63&r);return t},bo=(e,t)=>{const r=t||e.length;if("function"==typeof TextDecoder&&TextDecoder.prototype.decode)return(new TextDecoder).decode(e.subarray(0,t));let i,s;const n=new Array(2*r);for(s=0,i=0;i<r;){let t=e[i++];if(t<128){n[s++]=t;continue}let a=xo[t];if(a>4)n[s++]=65533,i+=a-1;else{for(t&=2===a?31:3===a?15:7;a>1&&i<r;)t=t<<6|63&e[i++],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 r="";for(let i=0;i<t;i++)r+=String.fromCharCode(e[i]);return r})(n,s)},_o=(e,t)=>{(t=t||e.length)>e.length&&(t=e.length);let r=t-1;for(;r>=0&&128==(192&e[r]);)r--;return r<0||0===r?t:r+xo[e[r]]>t?r: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 r,i,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;r=e.next_in,D=e.input,i=r+(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[r++]<<d,d+=8,p+=D[r++]<<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[r++]<<d,d+=8),b+=p&(1<<v)-1,p>>>=v,d-=v),d<15&&(p+=D[r++]<<d,d+=8,p+=D[r++]<<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[r++]<<d,d+=8,d<v&&(p+=D[r++]<<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(r<i&&s<a);b=d>>3,r-=b,d-=b<<3,p&=(1<<d)-1,e.next_in=r,e.next_out=s,e.avail_in=r<i?i-r+5:5-(r-i),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,r,i,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<i;m++)A[t[r+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<i;m++)0!==t[r+m]&&(a[S[t[r+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[r+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)},rh=(e,t)=>{let r;if(Qo(e))return No;const i=e.state;return t<0?(r=0,t=-t):(r=5+(t>>4),t<48&&(t&=15)),t&&(t<8||t>15)?No:(null!==i.window&&i.wbits!==t&&(i.window=null),i.wrap=r,i.wbits=t,th(e))},ih=(e,t)=>{if(!e)return No;const r=new Jo;e.state=r,r.strm=e,r.window=null,r.mode=zo;const i=rh(e,t);return i!==Lo&&(e.state=null),i};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,r,i)=>{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)),i>=n.wsize?(n.window.set(t.subarray(r-n.wsize,r),0),n.wnext=0,n.whave=n.wsize):(s=n.wsize-n.wnext,s>i&&(s=i),n.window.set(t.subarray(r-i,r-i+s),n.wnext),(i-=s)?(n.window.set(t.subarray(r-i,r),0),n.wnext=i,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 r,i,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;r=e.state,r.mode===$o&&(r.mode=Wo),a=e.next_out,s=e.output,h=e.avail_out,n=e.next_in,i=e.input,o=e.avail_in,u=r.hold,l=r.bits,c=o,p=h,C=Lo;e:for(;;)switch(r.mode){case zo:if(0===r.wrap){r.mode=Wo;break}for(;l<16;){if(0===o)break e;o--,u+=i[n++]<<l,l+=8}if(2&r.wrap&&35615===u){0===r.wbits&&(r.wbits=15),r.check=0,E[0]=255&u,E[1]=u>>>8&255,r.check=lo(r.check,E,2,0),u=0,l=0,r.mode=16181;break}if(r.head&&(r.head.done=!1),!(1&r.wrap)||(((255&u)<<8)+(u>>8))%31){e.msg="incorrect header check",r.mode=Zo;break}if((15&u)!==Go){e.msg="unknown compression method",r.mode=Zo;break}if(u>>>=4,l-=4,w=8+(15&u),0===r.wbits&&(r.wbits=w),w>15||w>r.wbits){e.msg="invalid window size",r.mode=Zo;break}r.dmax=1<<r.wbits,r.flags=0,e.adler=r.check=1,r.mode=512&u?16189:$o,u=0,l=0;break;case 16181:for(;l<16;){if(0===o)break e;o--,u+=i[n++]<<l,l+=8}if(r.flags=u,(255&r.flags)!==Go){e.msg="unknown compression method",r.mode=Zo;break}if(57344&r.flags){e.msg="unknown header flags set",r.mode=Zo;break}r.head&&(r.head.text=u>>8&1),512&r.flags&&4&r.wrap&&(E[0]=255&u,E[1]=u>>>8&255,r.check=lo(r.check,E,2,0)),u=0,l=0,r.mode=16182;case 16182:for(;l<32;){if(0===o)break e;o--,u+=i[n++]<<l,l+=8}r.head&&(r.head.time=u),512&r.flags&&4&r.wrap&&(E[0]=255&u,E[1]=u>>>8&255,E[2]=u>>>16&255,E[3]=u>>>24&255,r.check=lo(r.check,E,4,0)),u=0,l=0,r.mode=16183;case 16183:for(;l<16;){if(0===o)break e;o--,u+=i[n++]<<l,l+=8}r.head&&(r.head.xflags=255&u,r.head.os=u>>8),512&r.flags&&4&r.wrap&&(E[0]=255&u,E[1]=u>>>8&255,r.check=lo(r.check,E,2,0)),u=0,l=0,r.mode=16184;case 16184:if(1024&r.flags){for(;l<16;){if(0===o)break e;o--,u+=i[n++]<<l,l+=8}r.length=u,r.head&&(r.head.extra_len=u),512&r.flags&&4&r.wrap&&(E[0]=255&u,E[1]=u>>>8&255,r.check=lo(r.check,E,2,0)),u=0,l=0}else r.head&&(r.head.extra=null);r.mode=16185;case 16185:if(1024&r.flags&&(d=r.length,d>o&&(d=o),d&&(r.head&&(w=r.head.extra_len-r.length,r.head.extra||(r.head.extra=new Uint8Array(r.head.extra_len)),r.head.extra.set(i.subarray(n,n+d),w)),512&r.flags&&4&r.wrap&&(r.check=lo(r.check,i,d,n)),o-=d,n+=d,r.length-=d),r.length))break e;r.length=0,r.mode=16186;case 16186:if(2048&r.flags){if(0===o)break e;d=0;do{w=i[n+d++],r.head&&w&&r.length<65536&&(r.head.name+=String.fromCharCode(w))}while(w&&d<o);if(512&r.flags&&4&r.wrap&&(r.check=lo(r.check,i,d,n)),o-=d,n+=d,w)break e}else r.head&&(r.head.name=null);r.length=0,r.mode=16187;case 16187:if(4096&r.flags){if(0===o)break e;d=0;do{w=i[n+d++],r.head&&w&&r.length<65536&&(r.head.comment+=String.fromCharCode(w))}while(w&&d<o);if(512&r.flags&&4&r.wrap&&(r.check=lo(r.check,i,d,n)),o-=d,n+=d,w)break e}else r.head&&(r.head.comment=null);r.mode=16188;case 16188:if(512&r.flags){for(;l<16;){if(0===o)break e;o--,u+=i[n++]<<l,l+=8}if(4&r.wrap&&u!==(65535&r.check)){e.msg="header crc mismatch",r.mode=Zo;break}u=0,l=0}r.head&&(r.head.hcrc=r.flags>>9&1,r.head.done=!0),e.adler=r.check=0,r.mode=$o;break;case 16189:for(;l<32;){if(0===o)break e;o--,u+=i[n++]<<l,l+=8}e.adler=r.check=Ko(u),u=0,l=0,r.mode=jo;case jo:if(0===r.havedict)return e.next_out=a,e.avail_out=h,e.next_in=n,e.avail_in=o,r.hold=u,r.bits=l,Oo;e.adler=r.check=1,r.mode=$o;case $o:if(t===Io||t===Bo)break e;case Wo:if(r.last){u>>>=7&l,l-=7&l,r.mode=Yo;break}for(;l<3;){if(0===o)break e;o--,u+=i[n++]<<l,l+=8}switch(r.last=1&u,u>>>=1,l-=1,3&u){case 0:r.mode=16193;break;case 1:if(oh(r),r.mode=Ho,t===Bo){u>>>=2,l-=2;break e}break;case 2:r.mode=16196;break;case 3:e.msg="invalid block type",r.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+=i[n++]<<l,l+=8}if((65535&u)!=(u>>>16^65535)){e.msg="invalid stored block lengths",r.mode=Zo;break}if(r.length=65535&u,u=0,l=0,r.mode=qo,t===Bo)break e;case qo:r.mode=16195;case 16195:if(d=r.length,d){if(d>o&&(d=o),d>h&&(d=h),0===d)break e;s.set(i.subarray(n,n+d),a),o-=d,n+=d,h-=d,a+=d,r.length-=d;break}r.mode=$o;break;case 16196:for(;l<14;){if(0===o)break e;o--,u+=i[n++]<<l,l+=8}if(r.nlen=257+(31&u),u>>>=5,l-=5,r.ndist=1+(31&u),u>>>=5,l-=5,r.ncode=4+(15&u),u>>>=4,l-=4,r.nlen>286||r.ndist>30){e.msg="too many length or distance symbols",r.mode=Zo;break}r.have=0,r.mode=16197;case 16197:for(;r.have<r.ncode;){for(;l<3;){if(0===o)break e;o--,u+=i[n++]<<l,l+=8}r.lens[F[r.have++]]=7&u,u>>>=3,l-=3}for(;r.have<19;)r.lens[F[r.have++]]=0;if(r.lencode=r.lendyn,r.lenbits=7,A={bits:r.lenbits},C=Mo(0,r.lens,0,19,r.lencode,0,r.work,A),r.lenbits=A.bits,C){e.msg="invalid code lengths set",r.mode=Zo;break}r.have=0,r.mode=16198;case 16198:for(;r.have<r.nlen+r.ndist;){for(;D=r.lencode[u&(1<<r.lenbits)-1],m=D>>>24,y=D>>>16&255,x=65535&D,!(m<=l);){if(0===o)break e;o--,u+=i[n++]<<l,l+=8}if(x<16)u>>>=m,l-=m,r.lens[r.have++]=x;else{if(16===x){for(S=m+2;l<S;){if(0===o)break e;o--,u+=i[n++]<<l,l+=8}if(u>>>=m,l-=m,0===r.have){e.msg="invalid bit length repeat",r.mode=Zo;break}w=r.lens[r.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+=i[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+=i[n++]<<l,l+=8}u>>>=m,l-=m,w=0,d=11+(127&u),u>>>=7,l-=7}if(r.have+d>r.nlen+r.ndist){e.msg="invalid bit length repeat",r.mode=Zo;break}for(;d--;)r.lens[r.have++]=w}}if(r.mode===Zo)break;if(0===r.lens[256]){e.msg="invalid code -- missing end-of-block",r.mode=Zo;break}if(r.lenbits=9,A={bits:r.lenbits},C=Mo(1,r.lens,0,r.nlen,r.lencode,0,r.work,A),r.lenbits=A.bits,C){e.msg="invalid literal/lengths set",r.mode=Zo;break}if(r.distbits=6,r.distcode=r.distdyn,A={bits:r.distbits},C=Mo(2,r.lens,r.nlen,r.ndist,r.distcode,0,r.work,A),r.distbits=A.bits,C){e.msg="invalid distances set",r.mode=Zo;break}if(r.mode=Ho,t===Bo)break e;case Ho:r.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,r.hold=u,r.bits=l,Do(e,p),a=e.next_out,s=e.output,h=e.avail_out,n=e.next_in,i=e.input,o=e.avail_in,u=r.hold,l=r.bits,r.mode===$o&&(r.back=-1);break}for(r.back=0;D=r.lencode[u&(1<<r.lenbits)-1],m=D>>>24,y=D>>>16&255,x=65535&D,!(m<=l);){if(0===o)break e;o--,u+=i[n++]<<l,l+=8}if(y&&!(240&y)){for(v=m,b=y,_=x;D=r.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+=i[n++]<<l,l+=8}u>>>=v,l-=v,r.back+=v}if(u>>>=m,l-=m,r.back+=m,r.length=x,0===y){r.mode=16205;break}if(32&y){r.back=-1,r.mode=$o;break}if(64&y){e.msg="invalid literal/length code",r.mode=Zo;break}r.extra=15&y,r.mode=16201;case 16201:if(r.extra){for(S=r.extra;l<S;){if(0===o)break e;o--,u+=i[n++]<<l,l+=8}r.length+=u&(1<<r.extra)-1,u>>>=r.extra,l-=r.extra,r.back+=r.extra}r.was=r.length,r.mode=16202;case 16202:for(;D=r.distcode[u&(1<<r.distbits)-1],m=D>>>24,y=D>>>16&255,x=65535&D,!(m<=l);){if(0===o)break e;o--,u+=i[n++]<<l,l+=8}if(!(240&y)){for(v=m,b=y,_=x;D=r.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+=i[n++]<<l,l+=8}u>>>=v,l-=v,r.back+=v}if(u>>>=m,l-=m,r.back+=m,64&y){e.msg="invalid distance code",r.mode=Zo;break}r.offset=x,r.extra=15&y,r.mode=16203;case 16203:if(r.extra){for(S=r.extra;l<S;){if(0===o)break e;o--,u+=i[n++]<<l,l+=8}r.offset+=u&(1<<r.extra)-1,u>>>=r.extra,l-=r.extra,r.back+=r.extra}if(r.offset>r.dmax){e.msg="invalid distance too far back",r.mode=Zo;break}r.mode=16204;case 16204:if(0===h)break e;if(d=p-h,r.offset>d){if(d=r.offset-d,d>r.whave&&r.sane){e.msg="invalid distance too far back",r.mode=Zo;break}d>r.wnext?(d-=r.wnext,f=r.wsize-d):f=r.wnext-d,d>r.length&&(d=r.length),g=r.window}else g=s,f=a-r.offset,d=r.length;d>h&&(d=h),h-=d,r.length-=d;do{s[a++]=g[f++]}while(--d);0===r.length&&(r.mode=Xo);break;case 16205:if(0===h)break e;s[a++]=r.length,h--,r.mode=Xo;break;case Yo:if(r.wrap){for(;l<32;){if(0===o)break e;o--,u|=i[n++]<<l,l+=8}if(p-=h,e.total_out+=p,r.total+=p,4&r.wrap&&p&&(e.adler=r.check=r.flags?lo(r.check,s,p,a-p):ho(r.check,s,p,a-p)),p=h,4&r.wrap&&(r.flags?u:Ko(u))!==r.check){e.msg="incorrect data check",r.mode=Zo;break}u=0,l=0}r.mode=16207;case 16207:if(r.wrap&&r.flags){for(;l<32;){if(0===o)break e;o--,u+=i[n++]<<l,l+=8}if(4&r.wrap&&u!==(4294967295&r.total)){e.msg="incorrect length check",r.mode=Zo;break}u=0,l=0}r.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,r.hold=u,r.bits=l,(r.wsize||p!==e.avail_out&&r.mode<Zo&&(r.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,r.total+=p,4&r.wrap&&p&&(e.adler=r.check=r.flags?lo(r.check,s,p,e.next_out-p):ho(r.check,s,p,e.next_out-p)),e.data_type=r.bits+(r.last?64:0)+(r.mode===$o?128:0)+(r.mode===Ho||r.mode===qo?256:0),(0===c&&0===p||t===ko)&&C===Lo&&(C=Uo),C},lh={inflateReset:th,inflateReset2:rh,inflateResetKeep:eh,inflateInit:e=>ih(e,15),inflateInit2:ih,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 r=e.state;return 2&r.wrap?(r.head=t,t.done=!1,Lo):No},inflateSetDictionary:(e,t)=>{const r=t.length;let i,s,n;return Qo(e)?No:(i=e.state,0!==i.wrap&&i.mode!==jo?No:i.mode===jo&&(s=1,s=ho(s,t,r,0),s!==i.check)?Ro:(n=hh(e,t,r,r),n?(i.mode=16210,Vo):(i.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 r=lh.inflateInit2(this.strm,t.windowBits);if(r!==gh)throw new Error(co[r]);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&&(r=lh.inflateSetDictionary(this.strm,t.dictionary),r!==gh)))throw new Error(co[r])}_h.prototype.push=function(e,t){const r=this.strm,i=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)?r.input=new Uint8Array(e):r.input=e,r.next_in=0,r.avail_in=r.input.length;;){for(0===r.avail_out&&(r.output=new Uint8Array(i),r.next_out=0,r.avail_out=i),n=lh.inflate(r,a),n===yh&&s&&(n=lh.inflateSetDictionary(r,s),n===gh?n=lh.inflate(r,a):n===vh&&(n=yh));r.avail_in>0&&n===mh&&r.state.wrap>0&&0!==e[r.next_in];)lh.inflateReset(r),n=lh.inflate(r,a);switch(n){case xh:case vh:case yh:case bh:return this.onEnd(n),this.ended=!0,!1}if(o=r.avail_out,r.next_out&&(0===r.avail_out||n===mh))if("string"===this.options.to){let e=_o(r.output,r.next_out),t=r.next_out-e,s=bo(r.output,e);r.next_out=t,r.avail_out=i-t,t&&r.output.set(r.output.subarray(e,e+t),0),this.onData(s)}else this.onData(r.output.length===r.next_out?r.output:r.output.subarray(0,r.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===r.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 r=new _h(t);if(r.push(e),r.err)throw r.msg||co[r.err];return r.result}};const{inflate:Ch}=wh;const Dh={inflate:Ch};var Eh,Ah={};Ah.parse=function(e){var t=Ah.B,r=function(e,t,r,i){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:r};for(var o in n){var h=Ah.findTable(e,o,r);if(h){var u=h[0],l=i[u];null==l&&(l=n[o].parseTab(e,u,h[1],a)),a[o]=i[u]=l}}return a};var i=new Uint8Array(e);let s;119==i[0]&&(s=i,i=function(e){var r=t.readUshort(e,12),i=t.readUint(e,16),s=new Uint8Array(i),n=12+16*r;t.writeASCII(s,0,"OTTO"),t.writeUshort(s,4,r);for(var a=44,o=0;o<r;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}(i));var n={};if("ttcf"==t.readASCII(i,0,4)){var a=4;t.readUshort(i,a),a+=2,t.readUshort(i,a),a+=2;var o=t.readUint(i,a);a+=4;for(var h=[],u=0;u<o;u++){var l=t.readUint(i,a);a+=4,h.push(r(i,u,l,n))}return h}var c=r(i,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,r){for(var i=Ah.B,s=i.readUshort(e,r+4),n=r+12,a=0;a<s;a++){var o=i.readASCII(e,n,4);i.readUint(e,n+4);var h=i.readUint(e,n+8),u=i.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 r=Ah.B.t.uint8;return r[0]=e[t+3],r[1]=e[t+2],r[2]=e[t+1],r[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,r){e[t]=r>>8&255,e[t+1]=255&r},readUshorts:function(e,t,r){for(var i=[],s=0;s<r;s++){var n=Ah.B.readUshort(e,t+2*s);i.push(n)}return i},readUint:function(e,t){var r=Ah.B.t.uint8;return r[3]=e[t],r[2]=e[t+1],r[1]=e[t+2],r[0]=e[t+3],Ah.B.t.uint32[0]},writeUint:function(e,t,r){e[t]=r>>24&255,e[t+1]=r>>16&255,e[t+2]=r>>8&255,e[t+3]=255&r},readUint64:function(e,t){return 4294967296*Ah.B.readUint(e,t)+Ah.B.readUint(e,t+4)},readASCII:function(e,t,r){for(var i="",s=0;s<r;s++)i+=String.fromCharCode(e[t+s]);return i},writeASCII:function(e,t,r){for(var i=0;i<r.length;i++)e[t+i]=r.charCodeAt(i)},readUnicode:function(e,t,r){for(var i="",s=0;s<r;s++){var n=e[t++]<<8|e[t++];i+=String.fromCharCode(n)}return i},_tdec:window.TextDecoder?new window.TextDecoder:null,readUTF8:function(e,t,r){var i=Ah.B._tdec;return i&&0==t&&r==e.length?i.decode(e):Ah.B.readASCII(e,t,r)},readBytes:function(e,t,r){for(var i=[],s=0;s<r;s++)i.push(e[t+s]);return i},readASCIIArray:function(e,t,r){for(var i=[],s=0;s<r;s++)i.push(String.fromCharCode(e[t+s]));return i},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,r){var i=Ah.B,s=Ah.T.CFF;e=new Uint8Array(e.buffer,t,r),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(i.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(i.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=i.readUshort(e,t);t+=2;for(o=0;o<m+1;o++)l.FDSelect.push(i.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,r){var i,s=Ah.T.CFF;for(var n in t.Private&&(i=t.Private[1],t.Private=s.readDict(e,i,i+t.Private[0]),t.Private.Subrs&&s.readSubrs(e,i+t.Private.Subrs,t.Private)),t)-1!=["FamilyName","FontName","FullName","Notice","version","Copyright"].indexOf(n)&&(t[n]=r[t[n]-426+35])},readSubrs:function(e,t,r){r.Subrs=Ah.T.CFF.readBytes(e,t);var i,s=r.Subrs.length+1;i=s<1240?107:s<33900?1131:32768,r.Bias=i},readBytes:function(e,t){var r=[];t=Ah.T.CFF.readIndex(e,t,r);for(var i=[],s=r.length-1,n=e.byteOffset+t,a=0;a<s;a++){var o=r[a];i.push(new Uint8Array(e.buffer,n+o,r[a+1]-o))}return i},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 r=0;r<e.charset.length;r++)if(e.charset[r]==t)return r;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,r){var i=Ah.B,s=[".notdef"],n=e[t];if(t++,0==n)for(var a=0;a<r;a++){var o=i.readUshort(e,t);t+=2,s.push(o)}else{if(1!=n&&2!=n)throw"error: format: "+n;for(;s.length<r;){o=i.readUshort(e,t);t+=2;var h=0;1==n?(h=e[t],t++):(h=i.readUshort(e,t),t+=2);for(a=0;a<=h;a++)s.push(o),o++}}return s},readIndex:function(e,t,r){var i=Ah.B,s=i.readUshort(e,t)+1,n=e[t+=2];if(t++,1==n)for(var a=0;a<s;a++)r.push(e[t+a]);else if(2==n)for(a=0;a<s;a++)r.push(i.readUshort(e,t+2*a));else if(3==n)for(a=0;a<s;a++)r.push(16777215&i.readUint(e,t+3*a-1));else if(4==n)for(a=0;a<s;a++)r.push(i.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,r){var i=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=i.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=i.readInt(e,t+1)/65535,a=5),r.val=null!=h?h:"o"+o,r.size=a},readCharString:function(e,t,r){for(var i=t+r,s=Ah.B,n=[];t<i;){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,r){for(var i=Ah.B,s={},n=[];t<r;){var a=e[t],o=e[t+1],h=1,u=null,l=null;if(28==a&&(l=i.readShort(e,t+1),h=3),29==a&&(l=i.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=i.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,r){var i={tables:[],ids:{},off:t};e=new Uint8Array(e.buffer,t,r),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=i.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)),i.tables.push(g)}null!=i.ids[d]&&console.log("multiple tables for one platform+encoding: "+d),i.ids[d]=f}return i},parse0:function(e,t,r){var i=Ah.B;t+=2;var s=i.readUshort(e,t);t+=2,i.readUshort(e,t),t+=2,r.map=[];for(var n=0;n<s-6;n++)r.map.push(e[t+n]);return r},parse4:function(e,t,r){var i=Ah.B,s=i.readUshort,n=i.readUshorts,a=t,o=s(e,t+=2);s(e,t+=2);var h=s(e,t+=2);t+=2;var u=h>>>1;r.searchRange=s(e,t),t+=2,r.entrySelector=s(e,t),t+=2,r.rangeShift=s(e,t),t+=2,r.endCount=n(e,t,u),t+=2*u,t+=2,r.startCount=n(e,t,u),t+=2*u,r.idDelta=[];for(var l=0;l<u;l++)r.idDelta.push(i.readShort(e,t)),t+=2;return r.idRangeOffset=n(e,t,u),t+=2*u,r.glyphIdArray=n(e,t,a+o-t>>1),r},parse6:function(e,t,r){var i=Ah.B;t+=2,i.readUshort(e,t),t+=2,i.readUshort(e,t),t+=2,r.firstCode=i.readUshort(e,t),t+=2;var s=i.readUshort(e,t);t+=2,r.glyphIdArray=[];for(var n=0;n<s;n++)r.glyphIdArray.push(i.readUshort(e,t)),t+=2;return r},parse12:function(e,t,r){var i=Ah.B.readUint;i(e,t+=4),i(e,t+=4);var s=3*i(e,t+=4);t+=4;for(var n=r.groups=new Uint32Array(s),a=0;a<s;a+=3)n[a]=i(e,t+(a<<2)),n[a+1]=i(e,t+(a<<2)+4),n[a+2]=i(e,t+(a<<2)+8);return r}},Ah.T.CBLC={parseTab:function(e,t,r){var i=Ah.B,s=t;i.readUshort(e,t),t+=2,i.readUshort(e,t),t+=2;var n=i.readUint(e,t);t+=4;for(var a=[],o=0;o<n;o++){var h=i.readUint(e,t);t+=4,i.readUint(e,t),t+=4,i.readUint(e,t),t+=4,t+=4,t+=24,i.readUshort(e,t),t+=2,i.readUshort(e,t),t+=2,t+=4;for(var u=s+h,l=0;l<3;l++){var c=i.readUshort(e,u);u+=2;var p=i.readUshort(e,u);u+=2;var d=i.readUint(e,u);u+=4;var f=p-c+1,g=s+h+d,m=i.readUshort(e,g);if(g+=2,1!=m)throw m;var y=i.readUshort(e,g);g+=2;var x=i.readUint(e,g);g+=4;for(var v=[],b=0;b<f;b++){var _=i.readUint(e,g+4*b);v.push(x+_)}a.push([c,p,y,v])}}return a}},Ah.T.CBDT={parseTab:function(e,t,r){return new Uint8Array(e.buffer,e.byteOffset+t,r)}},Ah.T.glyf={parseTab:function(e,t,r,i){for(var s=[],n=i.maxp.numGlyphs,a=0;a<n;a++)s.push(null);return s},_parseGlyf:function(e,t){var r=Ah.B,i=e._data,s=e.loca;if(s[t]==s[t+1])return null;var n=Ah.findTable(i,"glyf",e._offset)[0]+s[t],a={};if(a.noc=r.readShort(i,n),n+=2,a.xMin=r.readShort(i,n),n+=2,a.yMin=r.readShort(i,n),n+=2,a.xMax=r.readShort(i,n),n+=2,a.yMax=r.readShort(i,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(r.readUshort(i,n)),n+=2;var h=r.readUshort(i,n);if(n+=2,i.length-n<h)return null;a.instructions=r.readBytes(i,n,h),n+=h;var u=a.endPts[a.noc-1]+1;a.flags=[];for(o=0;o<u;o++){var l=i[n];if(n++,a.flags.push(l),8&l){var c=i[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?i[n]:-i[n]),n++):f?a.xs.push(0):(a.xs.push(r.readShort(i,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?i[n]:-i[n]),n++):f?a.ys.push(0):(a.ys.push(r.readShort(i,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=r.readUshort(i,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=r.readUshort(i,n),n+=2,1&y){var v=r.readShort(i,n);n+=2;var b=r.readShort(i,n);n+=2}else{v=r.readInt8(i,n);n++;b=r.readInt8(i,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=r.readF2dot14(i,n),n+=2):64&y?(x.m.a=r.readF2dot14(i,n),n+=2,x.m.d=r.readF2dot14(i,n),n+=2):128&y&&(x.m.a=r.readF2dot14(i,n),n+=2,x.m.b=r.readF2dot14(i,n),n+=2,x.m.c=r.readF2dot14(i,n),n+=2,x.m.d=r.readF2dot14(i,n),n+=2)}while(32&y);if(256&y){var _=r.readUshort(i,n);n+=2,a.instr=[];for(o=0;o<_;o++)a.instr.push(i[n]),n++}}return a}},Ah.T.head={parseTab:function(e,t,r){var i=Ah.B,s={};return i.readFixed(e,t),t+=4,s.fontRevision=i.readFixed(e,t),t+=4,i.readUint(e,t),t+=4,i.readUint(e,t),t+=4,s.flags=i.readUshort(e,t),t+=2,s.unitsPerEm=i.readUshort(e,t),t+=2,s.created=i.readUint64(e,t),t+=8,s.modified=i.readUint64(e,t),t+=8,s.xMin=i.readShort(e,t),t+=2,s.yMin=i.readShort(e,t),t+=2,s.xMax=i.readShort(e,t),t+=2,s.yMax=i.readShort(e,t),t+=2,s.macStyle=i.readUshort(e,t),t+=2,s.lowestRecPPEM=i.readUshort(e,t),t+=2,s.fontDirectionHint=i.readShort(e,t),t+=2,s.indexToLocFormat=i.readShort(e,t),t+=2,s.glyphDataFormat=i.readShort(e,t),t+=2,s}},Ah.T.hhea={parseTab:function(e,t,r){var i=Ah.B,s={};i.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?i.readUshort:i.readShort;s[o]=h(e,t+2*a)}return s}},Ah.T.hmtx={parseTab:function(e,t,r,i){for(var s=Ah.B,n=[],a=[],o=i.maxp.numGlyphs,h=i.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,r,i){var s=Ah.B,n=Ah.T.kern;if(1==s.readUshort(e,t))return n.parseV1(e,t,r,i);var a=s.readUshort(e,t+2);t+=4;for(var o={glyph1:[],rval:[]},h=0;h<a;h++){t+=2;r=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,r,i){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,r){var i=Ah.B,s=i.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=i.readShort(e,t);t+=2,h!=n&&(r.glyph1.push(h),r.rval.push({glyph2:[],vals:[]}));var c=r.rval[r.rval.length-1];c.glyph2.push(u),c.vals.push(l),n=h}return t}},Ah.T.loca={parseTab:function(e,t,r,i){var s=Ah.B,n=[],a=i.head.indexToLocFormat,o=i.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,r){var i=Ah.B,s=i.readUshort,n={};return i.readUint(e,t),t+=4,n.numGlyphs=s(e,t),t+=2,n}},Ah.T.name={parseTab:function(e,t,r){var i=Ah.B,s={};i.readUshort(e,t),t+=2;var n=i.readUshort(e,t);t+=2;for(var a=i.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=i.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=i.readUnicode(e,x,g/2):0==p?y=i.readASCII(e,x,g):1==p||3==p||4==p||5==p||10==p?y=i.readUnicode(e,x,g/2):1==c?(y=i.readASCII(e,x,g),console.log("reading unknown MAC encoding "+p+" as ASCII")):(console.log("unknown encoding "+p+", platformID: "+c),y=i.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,r="postScriptName";for(var i in e)if(null!=e[i][r]&&1033==e[i]._lang)return e[i];for(var i in e)if(null!=e[i][r]&&0==e[i]._lang)return e[i];for(var i in e)if(null!=e[i][r]&&3084==e[i]._lang)return e[i];for(var i in e)if(null!=e[i][r])return e[i];for(var i in e){t=e[i];break}return console.log("returning name table with languageID "+t._lang),null==t[r]&&null!=t.ID&&(t[r]=t.ID),t}},Ah.T.OS2={parseTab:function(e,t,r){var i=Ah.B.readUshort(e,t);t+=2;var s=Ah.T.OS2,n={};if(0==i)s.version0(e,t,n);else if(1==i)s.version1(e,t,n);else if(2==i||3==i||4==i)s.version2(e,t,n);else{if(5!=i)throw"unknown OS/2 table version: "+i;s.version5(e,t,n)}return n},version0:function(e,t,r){var i=Ah.B;return r.xAvgCharWidth=i.readShort(e,t),t+=2,r.usWeightClass=i.readUshort(e,t),t+=2,r.usWidthClass=i.readUshort(e,t),t+=2,r.fsType=i.readUshort(e,t),t+=2,r.ySubscriptXSize=i.readShort(e,t),t+=2,r.ySubscriptYSize=i.readShort(e,t),t+=2,r.ySubscriptXOffset=i.readShort(e,t),t+=2,r.ySubscriptYOffset=i.readShort(e,t),t+=2,r.ySuperscriptXSize=i.readShort(e,t),t+=2,r.ySuperscriptYSize=i.readShort(e,t),t+=2,r.ySuperscriptXOffset=i.readShort(e,t),t+=2,r.ySuperscriptYOffset=i.readShort(e,t),t+=2,r.yStrikeoutSize=i.readShort(e,t),t+=2,r.yStrikeoutPosition=i.readShort(e,t),t+=2,r.sFamilyClass=i.readShort(e,t),t+=2,r.panose=i.readBytes(e,t,10),t+=10,r.ulUnicodeRange1=i.readUint(e,t),t+=4,r.ulUnicodeRange2=i.readUint(e,t),t+=4,r.ulUnicodeRange3=i.readUint(e,t),t+=4,r.ulUnicodeRange4=i.readUint(e,t),t+=4,r.achVendID=i.readASCII(e,t,4),t+=4,r.fsSelection=i.readUshort(e,t),t+=2,r.usFirstCharIndex=i.readUshort(e,t),t+=2,r.usLastCharIndex=i.readUshort(e,t),t+=2,r.sTypoAscender=i.readShort(e,t),t+=2,r.sTypoDescender=i.readShort(e,t),t+=2,r.sTypoLineGap=i.readShort(e,t),t+=2,r.usWinAscent=i.readUshort(e,t),t+=2,r.usWinDescent=i.readUshort(e,t),t+=2},version1:function(e,t,r){var i=Ah.B;return t=Ah.T.OS2.version0(e,t,r),r.ulCodePageRange1=i.readUint(e,t),t+=4,r.ulCodePageRange2=i.readUint(e,t),t+=4},version2:function(e,t,r){var i=Ah.B,s=i.readUshort;return t=Ah.T.OS2.version1(e,t,r),r.sxHeight=i.readShort(e,t),t+=2,r.sCapHeight=i.readShort(e,t),t+=2,r.usDefault=s(e,t),t+=2,r.usBreak=s(e,t),t+=2,r.usMaxContext=s(e,t),t+=2},version5:function(e,t,r){var i=Ah.B.readUshort;return t=Ah.T.OS2.version2(e,t,r),r.usLowerOpticalPointSize=i(e,t),t+=2,r.usUpperOpticalPointSize=i(e,t),t+=2}},Ah.T.post={parseTab:function(e,t,r){var i=Ah.B,s={};return s.version=i.readFixed(e,t),t+=4,s.italicAngle=i.readFixed(e,t),t+=4,s.underlinePosition=i.readShort(e,t),t+=2,s.underlineThickness=i.readShort(e,t),t+=2,s}},Ah.T.SVG={parseTab:function(e,t,r){var i=Ah.B,s={entries:[],svgs:[]},n=t;i.readUshort(e,t),t+=2;var a=i.readUint(e,t);t+=4,i.readUint(e,t),t+=4,t=a+n;var o=i.readUshort(e,t);t+=2;for(var h=0;h<o;h++){var u=i.readUshort(e,t);t+=2;var l=i.readUshort(e,t);t+=2;var c=i.readUint(e,t);t+=4;var p=i.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=i.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,r,i){for(var s=i.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,r){var i=Ah.B,s=t;t+=2;var n=i.readUshort(e,t);t+=2;var a=i.readUint(e,t);t+=4;var o=i.readUint(e,t);t+=4;var h=i.readUshort(e,t);t+=2;for(var u={},l=s+a,c=0;c<n;c++)u["g"+i.readUshort(e,l)]=[i.readUshort(e,l+2),i.readUshort(e,l+4)],l+=6;var p=[];l=s+o;for(c=0;c<h;c++)p.push(i.readUshort(e,l),i.readUshort(e,l+2)),l+=4;return[u,p]}},Ah.T.cpal={parseTab:function(e,t,r){var i=Ah.B,s=t,n=i.readUshort(e,t);if(t+=2,0==n){i.readUshort(e,t),t+=2,i.readUshort(e,t),t+=2;var a=i.readUshort(e,t);t+=2;var o=i.readUint(e,t);return t+=4,new Uint8Array(e.buffer,s+o,4*a)}throw n}},Ah.T.GSUB={parseTab:function(e,t,r,i){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,r,i){var s=i.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,r,i){for(var s=[],n=0;n<i;n++)s.push(e.readF2dot14(t,r+2*n));return s}function r(r,i,s,n,a){for(var o=[],h=0;h<s;h++){var u=e.readUshort(r,i);i+=2;var l=e.readUshort(r,i),c=61440&l;l&=4095,i+=2;var p=null,d=null,f=null;32768&c&&(p=t(r,i,n),i+=2*n),16384&c&&(d=t(r,i,n),i+=2*n),16384&c&&(f=t(r,i,n),i+=2*n),o.push([u,l,c,d,p,f])}return o}function i(t,r,i){var s=t[r];if(r++,0==s)return[[],r];127<s&&(s=(127&s)<<8|t[r++]);for(var n=[],a=0;n.length<s;){var o=t[r];r++;var h=!!(128&o);o=1+(127&o);for(var u=0;u<o;u++){var l=0;h?(l=e.readUshort(t,r),r+=2):(l=t[r],r++),a+=l,n.push(a)}}return[n,r]}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=r(s,h+=2,E,u),T=[];D.push(T),h=n+d+f[g]+S;var M=null;if(A)M=(I=i(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=i(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,r,i){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,r,i){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,r){e.cmds.push("M"),e.crds.push(t,r)},t=function(e,t,r){e.cmds.push("L"),e.crds.push(t,r)},r=function(e,t,r,i,s,n,a){e.cmds.push("C"),e.crds.push(t,r,i,s,n,a)},i=function(e,t,r,i,s){e.cmds.push("Q"),e.crds.push(t,r,i,s)},s=function(e){e.cmds.push("Z")};function n(e,t,r,i){var s=t[r],n=t[r+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,r){for(var i=0,s=~~(e.length/t);i+1!=s;){var n=i+(s-i>>>1);e[n*t]<=r?i=n:s=n}return i*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 r=e.cmap,i=-1,s=["p3e10","p0e4","p3e1","p1e0","p0e3","p0e1","p3e0","p3e5"],n=0;n<s.length;n++)if(null!=r.ids[s[n]]){i=r.ids[s[n]];break}if(-1==i)throw"no familiar platform and encoding!";e._ctab=r.tables[i]}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,r,i){var s={cmds:[],crds:[]};e.fvar&&(null==i&&(i=e.fvar[1][e._index][2]),i=m(e,i));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!=r&&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,i);return{cmds:s.cmds,crds:s.crds}}function f(r,n,a,o){var h=n.glyf[r];null==h&&(h=n.glyf[r]=Ah.T.glyf._parseGlyf(n,r)),null!=h&&(h.noc>-1?function(r,n,a,o,h){var u=r.xs,l=r.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,r.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<r.noc;b++){var _=0==b?0:r.endPts[b-1]+1,w=r.endPts[b];for(v=_;v<=w;v++){var C=v==_?w:v-1,D=v==w?_:v+1,E=1&r.flags[v],A=1&r.flags[C],S=1&r.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?i(o,F,T,u[D],l[D]):i(o,F,T,Math.floor(.5*(F+u[D])),Math.floor(.5*(T+l[D])))}s(o)}}(h,n,r,a,o):function(e,t,r,i,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[r]: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];i.crds.push(C*b.a+D*b.c+_),i.crds.push(C*b.b+D*b.d+w)}for(m=0;m<x.cmds.length;m++)i.cmds.push(x.cmds[m])}}(h,n,r,a,o))}function g(e,t){for(var r=1,i=e[0],s=e[1],n=e[2],a=0;a<t.length;a++){r*=i[a]>s[a]||s[a]>n[a]||i[a]<0&&n[a]>0&&0!=s[a]||0==s[a]?1:t[a]<i[a]||t[a]>n[a]?0:t[a]==s[a]?1:t[a]<s[a]?(t[a]-i[a])/(s[a]-i[a]):(n[a]-t[a])/(n[a]-s[a])}return r}function m(e,t){for(var r=e.fvar,i=e.avar,s=r?r[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,i&&-1!=n[a]){for(var c=i[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,r,i,s){var n=r.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?r:i,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,r,i){for(var s=t>>1,n=r>>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(i,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<i.length;){F.getCharString(i,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(),r(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(),r(h,y,x,b,_,A,S),r(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(),r(h,y,x,b,_,A,S),r(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(),r(h,y,x,b,_,A,S),r(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(),r(h,y,x,b,_,A,S),r(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(),r(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(),r(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(),r(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),r(h,y,x,b,_,g,m),O+=4}else{if("o"==(k+"").charAt(0))throw console.log("Unknown operation: "+k,i),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,r){null==r&&(r={});var i=r.axs;e.fvar&&null==i&&(i=e.fvar[1][e._index][2]);var s=e.HVAR;i&&s&&(i=m(e,i));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],i)*f[y];u.push({g:c,cl:o,dx:0,dy:0,ax:d,ay:0})}return u},shapeToPath:function(e,t,r){var i,s,n={cmds:[],crds:[]},a=0,o=0;r&&(i=r.clr,s=r.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);i&&n.cmds.push(i);for(p=0;p<l.cmds.length;p++)n.cmds.push(l.cmds[p]);var f=n.cmds.length;i&&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 r=e.cmds,i=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<r.length;f++){var g,m,y,x,v=r[f],b=o[v]?o[v]:0,_=[];if("L"==v)g=i[a]-h,m=i[a+1]-u,y=s(g+l),x=s(m+c),"Z"==r[f+1]&&i[a]==p&&i[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=i[a+w]-h,m=i[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=i[(a+=b)-2],u=i[a-1]),"M"==v&&(p=h,d=u),"Z"==v&&(h=p,u=d)}return function(e){for(var t=[],r=!1,i="",s=0;s<e.length;s++){var n=e[s],a="number"==typeof n;if(!a){if(n==i&&1==n.length&&"m"!=n)continue;i=n}r&&a&&n>=0&&t.push(" "),t.push(n),r=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 r=0,i=e.cmds,s=e.crds,n=0;n<i.length;n++){var a=i[n];if("M"==a)t.moveTo(s[r],s[r+1]),r+=2;else if("L"==a)t.lineTo(s[r],s[r+1]),r+=2;else if("C"==a)t.bezierCurveTo(s[r],s[r+1],s[r+2],s[r+3],s[r+4],s[r+5]),r+=6;else if("Q"==a)t.quadraticCurveTo(s[r],s[r+1],s[r+2],s[r+3]),r+=4;else if("d"==a[0]){var u=window.UPNG,l=s[r],c=s[r+1],p=s[r+2],d=s[r+3],f=s[r+4],g=s[r+5],m=s[r+6],y=s[r+7];if(r+=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 r=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 i,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]),i=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),i.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);i.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(i,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(i,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),r=[],i=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=i+5*o,u=a+5*o;r.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 r}(_);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=r(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,r){e.exports=r()}(self,(()=>(()=>{var e={177:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.BezierPath=void 0;const i=r(558),s=r(188);t.BezierPath=class{constructor(e){this.samples=[],this.segments=e;const t=e.map((e=>e.getTotalLength())),r=[0];for(let e=1;e<t.length;e++)r.push(r[e-1]+t[e-1]);this._totalLength=r[r.length-1]+t[t.length-1];const n=e.map((e=>Math.max(4,Math.ceil(e.getTotalLength()/i.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 i=n[t],a=(0,s.times)(i+1).map((e=>e/i)),u=a.map((t=>e.pointAtParameter(t)));let l;for(let t=0;t<4;t++){l=(0,s.times)(i).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 r=0;for(let i=1;i<a.length-1;i++)r+=t[i-1],a[i]-=o*r,u[i]=e.pointAtParameter(a[i])}let c=0;u.slice(1).forEach(((e,i)=>{c+=l[i],this.samples.push({dist:r[t]+c,pt:e,tan:this.segments[t].tangentAtParameter(a[i+1]),segIdx:t,t:a[i+1]})}))})),this._jumps=[],this.segmentStartEnds=[{start:0,end:0}];for(let e=1;e<this.samples.length;e++){const t=this.samples[e-1],r=this.samples[e];if(r.segIdx===t.segIdx?this.segmentStartEnds[this.segmentStartEnds.length-1].end=r.dist:this.segmentStartEnds[r.segIdx]={start:r.dist,end:r.dist},t.segIdx!==r.segIdx&&(this.segments[t.segIdx].D.x!==this.segments[r.segIdx].A.x||this.segments[t.segIdx].D.y!==this.segments[r.segIdx].A.y)){const i=(t.dist+r.dist)/2,s={dist:i-1e-8,pt:this.segments[t.segIdx].D,tan:this.segments[t.segIdx].tangentAtParameter(1),segIdx:t.segIdx,t:1},n={dist:i+1e-8,pt:this.segments[r.segIdx].A,tan:this.segments[r.segIdx].tangentAtParameter(0),segIdx:r.segIdx,t:0};this._jumps.push(i),this.samples.splice(e,0,s,n),e+=2}}}jumps(){return[...this._jumps]}getTotalLength(){return this._totalLength}findClosestSampleIdx(e){let t=0,r=this.samples.length-1;for(;t<r;){const i=Math.floor((t+r)/2);if(this.samples[i].dist>e)r=i-1;else{if(!(this.samples[i].dist<e))return i;t=i+1}}return Math.max(0,Math.min(this.samples.length-1,Math.floor((t+r)/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 r=this.findClosestSampleIdx(e),i=this.samples[r].dist<e?Math.min(r+1,this.samples.length-1):Math.max(0,r-1),s=Math.abs(this.samples[i].dist-this.samples[r].dist)<1e-6?0:(e-this.samples[r].dist)/(this.samples[i].dist-this.samples[r].dist);if(t||this.samples[r].segIdx>this.samples[i].segIdx)return{x:(1-s)*this.samples[r].pt.x+s*this.samples[i].pt.x,y:(1-s)*this.samples[r].pt.y+s*this.samples[i].pt.y};if(this.samples[r].segIdx!==this.samples[i].segIdx){if(s<.5){const e=this.segments[this.samples[r].segIdx],t=2*s,i=(1-t)*this.samples[r].t+t;return e.pointAtParameter(i)}{const e=this.segments[this.samples[i].segIdx],t=2*(s-.5)*this.samples[i].t;return e.pointAtParameter(t)}}{const e=this.segments[this.samples[r].segIdx],t=(1-s)*this.samples[r].t+s*this.samples[i].t;return e.pointAtParameter(t)}}getAngleAtLength(e,t=!1){const r=this.getTangentAtLength(e,t);return Math.atan2(r.y,r.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 r=this.findClosestSampleIdx(e),i=this.samples[r].dist<e?Math.min(r+1,this.samples.length-1):Math.max(0,r-1),s=(e-this.samples[r].dist)/(this.samples[i].dist-this.samples[r].dist);if(t||this.samples[r].segIdx>this.samples[i].segIdx){let e=(1-s)*this.samples[r].tan.x+s*this.samples[i].tan.x,t=(1-s)*this.samples[r].tan.y+s*this.samples[i].tan.y;const n=Math.max(Math.hypot(e,t),1e-4);return e/=n,t/=n,{x:e,y:t}}if(this.samples[r].segIdx!==this.samples[i].segIdx){if(s<.5){const e=this.segments[this.samples[r].segIdx],t=2*s,i=(1-t)*this.samples[r].t+t;return e.tangentAtParameter(i)}{const e=this.segments[this.samples[i].segIdx],t=2*(s-.5)*this.samples[i].t;return e.tangentAtParameter(t)}}{const e=this.segments[this.samples[r].segIdx],t=(1-s)*this.samples[r].t+s*this.samples[i].t;return e.tangentAtParameter(t)}}}},558:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.BezierSegment=void 0;const i=r(188);class s{constructor(e,t,r,i){this._totalLength=void 0,this.A=e,this.B=t,this.C=r,this.D=i}static sampleSpacing(){return 2}tangentAtParameter(e){const t=Math.max(0,Math.min(1,e));if(0===t||1===t){let e,r;0===t?this.A.x===this.B.x&&this.A.y===this.B.y?(e=this.C.x-this.A.x,r=this.C.y-this.A.y):(e=this.B.x-this.A.x,r=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,r=this.D.y-this.B.y):(e=this.D.x-this.C.x,r=this.D.y-this.C.y);const i=Math.hypot(e,r);return Math.abs(i)>1e-4&&(e/=i,r/=i),{x:e,y:r}}const r=1-t;let i=3*this.D.x*Math.pow(t,2)-3*this.C.x*Math.pow(t,2)+6*this.C.x*r*t-6*this.B.x*r*t+3*this.B.x*Math.pow(r,2)-3*this.A.x*Math.pow(r,2),s=3*this.D.y*Math.pow(t,2)-3*this.C.y*Math.pow(t,2)+6*this.C.y*r*t-6*this.B.y*r*t+3*this.B.y*Math.pow(r,2)-3*this.A.y*Math.pow(r,2);const n=Math.hypot(i,s);return Math.abs(n)>1e-4&&(i/=n,s/=n),{x:i,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,i.times)(e).map((t=>this.pointAtParameter(t/(e-1))));let r=0;for(let e=1;e<t.length;e++)r+=Math.hypot(t[e].x-t[e-1].x,t[e].y-t[e-1].y);this._totalLength=r}return this._totalLength}}t.BezierSegment=s},729:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.createFromCommands=t.create=t.createFromElement=t.createFromCircle=t.createFromLine=t.createFromPath=void 0;const i=r(821),s=r(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+/),r=[];let i="",s={};for(;t.length>0;){let e=t.shift();n.hasOwnProperty(e)?i=e:t.unshift(e),s={type:i},n[i].forEach((r=>{e=t.shift(),s[r]=parseFloat(e)})),"M"===i?i="L":"m"===i&&(i="l"),r.push(s)}return r}(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 r={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(r,{x:e.x1,y:e.y1},{x:e.x2,y:e.y2},{x:e.x,y:e.y})),r={x:e.x,y:e.y};else if("L"===e.type)a.push(new s.BezierSegment(r,r,{x:e.x,y:e.y},{x:e.x,y:e.y})),r={x:e.x,y:e.y};else if("H"===e.type)a.push(new s.BezierSegment(r,r,{x:e.x,y:r.y},{x:e.x,y:r.y})),r={x:e.x,y:r.y};else if("V"===e.type)a.push(new s.BezierSegment(r,r,{x:r.x,y:e.y},{x:r.x,y:e.y})),r={x:r.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 i.BezierPath(a)},t.createFromLine=e=>{const[t,r,n,a]=["x1","x2","y1","y2"].map((t=>parseFloat(e.getAttribute(t)||"0")));return new i.BezierPath([new s.BezierSegment({x:t,y:n},{x:t,y:n},{x:r,y:a},{x:r,y:a})])},t.createFromCircle=e=>{const[t,r,n]=["cx","cy","r"].map((t=>parseFloat(e.getAttribute(t)||"0"))),a=1.3;return new i.BezierPath([new s.BezierSegment({x:t-n,y:r},{x:t-n,y:r-a*n},{x:t+n,y:r-a*n},{x:t+n,y:r}),new s.BezierSegment({x:t+n,y:r},{x:t+n,y:r+a*n},{x:t-n,y:r+a*n},{x:t-n,y:r})])},t.createFromElement=e=>{const r=e.tagName.toLowerCase();if("path"===r)return(0,t.createFromPath)(e);if("line"===r)return(0,t.createFromLine)(e);if("circle"===r)return(0,t.createFromCircle)(e);throw new Error(`Unsupported SVG tag: ${r}`)},t.create=e=>{const t=[];for(let r=1;r<e.length;r++){const i=e[r-1],n=e[r];t.push(new s.BezierSegment(i.pt,i.right||i.pt,n.left||n.pt,n.pt))}return new i.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 r={x:t[0].x,y:t[0].y},n=Object.assign({},r);const a=[];for(;t.length>0;){const e=t.shift();if("M"===e.type)n={x:e.x,y:e.y},r=n;else if("C"===e.type)a.push(new s.BezierSegment(r,{x:e.x1,y:e.y1},{x:e.x2,y:e.y2},{x:e.x,y:e.y})),r={x:e.x,y:e.y};else if("L"===e.type)e.x===r.x&&e.y===r.y||a.push(new s.BezierSegment(r,r,{x:e.x,y:e.y},{x:e.x,y:e.y})),r={x:e.x,y:e.y};else if("H"===e.type)e.x!==r.x&&a.push(new s.BezierSegment(r,r,{x:e.x,y:r.y},{x:e.x,y:r.y})),r={x:e.x,y:r.y};else if("V"===e.type)e.y!==r.y&&a.push(new s.BezierSegment(r,r,{x:r.x,y:e.y},{x:r.x,y:e.y})),r={x:r.x,y:e.y};else if("Q"===e.type)a.push(new s.BezierSegment(r,{x:r.x+2/3*(e.x1-r.x),y:r.y+2/3*(e.y1-r.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})),r={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(r.x-n.x,r.y-n.y)>0&&a.push(new s.BezierSegment(r,r,n,n))}}return new i.BezierPath(a)}},821:function(e,t,r){var i=this&&this.__createBinding||(Object.create?function(e,t,r,i){void 0===i&&(i=r);var s=Object.getOwnPropertyDescriptor(t,r);s&&!("get"in s?!t.__esModule:s.writable||s.configurable)||(s={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,i,s)}:function(e,t,r,i){void 0===i&&(i=r),e[i]=t[r]}),s=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||i(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),s(r(177),t),s(r(558),t),s(r(729),t),s(r(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 r=0;r<e;r++)t.push(r);return t}}},t={};return function r(i){var s=t[i];if(void 0!==s)return s.exports;var n=t[i]={exports:{}};return e[i].call(n.exports,n,n.exports,r),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"];class Ph{constructor(e,t,r,i,s){if(!(t instanceof FontFace))throw Error("FontFace is required");this._pInst=e,this.name=r,this.path=i,this.data=s,this.face=t}static hasGlyphData(e){let{font:t}=e;return"object"==typeof t&&void 0!==t.data}fontBounds(e,t,r,i,s,n){({width:i,height:s,options:n}=this._parseArgs(i,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,r,i,s)}textBounds(e,t,r,i,s,n){({width:i,height:s,options:n}=this._parseArgs(i,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,r,i,s)}textToPaths(e,t,r,i,s,n){if(({width:i,height:s,options:n}=this._parseArgs(i,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,r,i,s,n).map((e=>e.glyphs)).flat().map((e=>e.path.commands)).flat()}textToPoints(e,t,r,i,s,n){return this.textToContours(e,t,r,i,s,n).reduce(((e,t)=>(e.push(...t),e)),[])}textToContours(e,t=0,r=0,i,s,n){({width:i,height:s,options:n}=this._parseArgs(i,s,n));const a=this.textToPaths(e,t,r,i,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,r){const i=(e,t)=>{if("object"!=typeof e)e=t;else for(const r in t)void 0===e[r]&&(e[r]=t[r]);return e},s=(e,t)=>{const r=e.length;return e[t<0?t%r+r:t%r]},n=(e,t)=>{t=t||0;let r=0;for(let i=e.length-1;e.length>3&&i>=0;--i)collinear(s(e,i-1),s(e,i),s(e,i+1),t)&&(e.splice(i%e.length,1),r++);return r},a=Fh.createFromCommands(Uh(e));let o=i(t,{sampleFactor:.1,simplifyThreshold:0});const h=Math.max(1,Math.ceil(a.getTotalLength()*o.sampleFactor));let u=[];const l=r._pInst.angleMode(),c=r._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,r,i,s,n){({width:i,height:s,options:n}=this._parseArgs(i,s,n));const a=n?.extrude||0,o=this.textToContours(e,t,r,i,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:r}of e)this._pInst.vertex(t,r);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:r,y:i}of t)this._pInst.vertex(r,i,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 r=this.face[t];"normal"!==r&&(e[t]=e[t]||r)})),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:r=1e3}=this.data?.head||{},{ascender:i=0,descender:s=0}=this.data?.hhea||{};return((t||i+s)/2-i/2)*e/r}_lineateAndPathify(e,t,r,i,s,n={}){let a=n?.graphics?._renderer||this._pInst._renderer,o=a.drawingContext.textBaseline,{lines:h,bounds:u}=a._computeBounds(Ja,e,t,r,i,s,{ignoreRectMode:!0,...n});h=this._position(a,h,u,i,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,r,i,s,n,a])=>{if(!e)return i;if("wght"===t)return e.states.fontWeight;if("wdth"===t)return 100;if(e.textCanvas().style.fontVariationSettings){const r=new RegExp(`\\b${t}s+(d+)`).exec(e.textCanvas().style.fontVariationSettings);return r?parseInt(r[1]):i}return i}))}return t}_textToPathPoints(e,t,r,i,s,n){({width:i,height:s,options:n}=this._parseArgs(i,s,n));let a=this.textToPaths(e,t,r,i,s,n);const o=(e,t,r,i)=>{if(fn.dist(t.x,t.y,r.x,r.y)>i){let s={x:(t.x+r.x)/2,y:(t.y+r.y)/2};e.push(s),o(e,t,s,i),o(e,s,r,i)}};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:r}=a[e];if("Z"!==t){let e={x:r[r.length-2],y:r[r.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,r={}){return"object"==typeof e?(r=e,e=t=void 0):"object"==typeof t&&(r=t,t=void 0),{width:e,height:t,options:r}}_position(e,t,r,i,s){let{textAlign:n,textLeading:a}=e.states,o=this._measureTextDefault(e,"X").fontBoundingBoxAscent;return t.map(((t,h)=>{let u=r.x,l=r.y+h*a+o,c=e._fontWidthSingle(t);if(n===A?u+=(r.w-c)/2:n===D&&(u+=r.w-c),void 0!==i)switch(e.states.rectMode){case A:u-=i/2,l-=s/2;break;case C:u-=i,l-=s}return{text:t,x:u,y:l}}))}_lineToGlyphs(e,{scale:t=1,axs:r}={}){if(!this.data)throw Error('No font data available for "'+this.name+'"\nTry downloading a local copy of the font file');let i=Ah.U.shape(this.data,e.text,{axs:r});return e.glyphShapes=i,e.glyphs=this._shapeToPaths(i,e,{scale:t,axs:r}),e}_positionGlyphs(e,t){let r=t?.graphics?._renderer||this._pInst._renderer;const i=this._currentAxes(r),s=Ah.U.shape(this.data,e,{axs:i}),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:r=0,y:i=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]+r+p)*t,u=n+(f[a+h+1]+i+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:r=1,axs:i}={}){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:r,x:s,y:n,lineX:t.x,lineY:t.y,axs:i});a.push(h),s+=u,n+=l}return a}_measureTextDefault(e,t){let{textAlign:r,textBaseline:i}=e.states,s=e.textDrawingContext();s.textAlign="left",s.textBaseline="alphabetic";let n=s.measureText(t);return s.textAlign=r,s.textBaseline=i,n}drawPaths(e,t,r){e.strokeStyle=r?.stroke||e.strokeStyle,e.fillStyle=r?.fill||e.fillStyle,e.beginPath(),t.forEach((([t,...r])=>{"M"===t?e.moveTo(...r):"L"===t?e.lineTo(...r):"C"===t?e.bezierCurveTo(...r):"Q"===t?e.quadraticCurveTo(...r):"Z"===t&&e.closePath()})),r?.fill&&e.fill(),r?.stroke&&e.stroke()}_pathsToCommands(e,t){let r=[];for(let i=0;i<e.length;i++){let s=e[i],{x:n,y:a,path:o}=s,{crds:h,cmds:u}=o;for(let e=0,i=0;i<u.length;i++){let s=u[i],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 r=0;r<6;r+=2)o.data.push(n+h[e+r]*t,a+h[e+r+1]*-t);e+=6}else if("Q"==s){for(let r=0;r<4;r+=2)o.data.push(n+h[e+r]*t,a+h[e+r+1]*-t);e+=4}r.push(o)}}return r}}async function Oh(e,t,r,i,s){let n=function(e,t,r,i){e.includes(" ")&&(e="'"+e+"'");let s=i?._compressedData??i?._data;if(!s){if(!kh.test(t))throw Error(Bh);t.startsWith("url(")||(t="url("+t+")"),s=t}if((i?.fvar?.length??0)>0){r=r||{};for(const[e,t,s,n,a,o]of i.fvar[0])"wght"===e?r.weight=`${t} ${n}`:"wdth"===e&&(r.stretch=`${t}% ${n}%`)}let n=new FontFace(e,s,r);if("error"===n.status)throw Error('Failed to create FontFace for "'+e+'"');return n}(t,r,i,s);return"loaded"!==n.status&&await n.load(),document.fonts.add(n),new Ph(e,n,t,r,s)}function Nh(e){return(e.startsWith('"')||e.startsWith("'"))&&e.at(0)===e.at(-1)?e.slice(1,-1).replace(/\/(['"])/g,"$1"):e}function Rh(...e){let t,r,i,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?r?i=n:r=n:"object"==typeof n&&(s=n)}return{path:n,name:t,success:r,error:i,options:s}}function Vh(e,t){e.Font=Ph,t.parseFontData=async function(e){let r=e instanceof Uint8Array?e:await t.loadBytes(e);if(!r)throw Error("Failed to load font data");let i=Ah.parse(r);if(0===i.length||void 0===i[0].cmap)throw Error("parsing font data");return i[0]},t.loadFont=async function(...e){let r,{path:i,name:s,success:n,error:a,options:{sets:o,...h}={}}=Rh(...e),u=i.includes("@font-face");if(!u){const e=await fetch(i,{method:"HEAD"}),t=e.headers.get("content-type")?.startsWith("text/css");t&&(u=!0,i=await fetch(i).then((e=>e.text())))}if(u){const e=new CSSStyleSheet;await e.replace(i);const r=[];for(const i of e.cssRules)if(i instanceof CSSFontFaceRule){const e=i.style;let s=Nh(e.getPropertyValue("font-family"));const n=e.getPropertyValue("src"),a={...h||{}};for(const t of e){if("font-family"===t||"src"===t)continue;const r=t.replace(/^font-/,"").split("-").map(((e,t)=>0===t?e:`${e[0].toUpperCase()}${e.slice(1)}`)).join("");a[r]=e.getPropertyValue(t)}r.push({name:s,src:n,fontDescriptors:a,loadWithData:async()=>{let e;try{const r=/url\(([^\)]+)\)/.exec(n);if(r){let i=r[1];/^['"]/.exec(i)&&i.at(0)===i.at(-1)&&(i=i.slice(1,-1)),e=await t.parseFontData(i)}}catch(e){}return Oh(this,s,n,a,e)},loadWithoutData:()=>Oh(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 r){if(!e.fontDescriptors.unicodeRange)continue;const t=[...new Set(no.parse(e.fontDescriptors.unicodeRange.split(/,\s*/g))).values()].filter((e=>a.has(e))).length,r={style:"normal",weight:400,...h},i=Object.keys(e.fontDescriptors).filter((t=>e.fontDescriptors[t]===r[t])).length;(i>c||i===c&&t>=l)&&(c=i,l=t,u=e)}const p=u||r.at(-1);for(const e of r)e!==p&&e.loadWithoutData();return p?.loadWithData()}try{const e=await t.parseFontData(i);s=s||function(e,t){let r,i=e?.name;if(i){if(i.fullName)return i.fullName;i.familyName&&(r=i.familyName)}if(!r){let e=Ih.exec(t);r=e&&e.length>=3?e[1]:t}return r.includes(" ")&&(r=r.replace(/ /g,"_")),r}(e,i),r=await Oh(this,s,i,h,e)}catch(e){let t=s||i.substring(i.lastIndexOf("/")+1).replace(/\.[^/.]+$/,"");console.warn(`WARN: No glyph data for '${t}', retrying as FontFace`);try{r=await Oh(this,t,i,h)}catch(e){if(a)return a(e);throw e}}return n?n(r):r}}const Uh=e=>e.map((e=>{const t=e[0];switch(t){case"Z":return{type:t};case"M":case"L":{const[,r,i]=e;return{type:t,x:r,y:i}}case"Q":{const[,r,i,s,n]=e;return{type:t,x1:r,y1:i,x:s,y:n}}case"C":{const[,r,i,s,n,a,o]=e;return{type:t,x1:r,y1:i,x2:s,y2:n,x:a,y:o}}default:throw new Error(`Unexpected path command: ${t}`)}}));void 0!==p5&&Vh(p5,p5.prototype);var Gh=[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],zh=[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],jh="ªµºÀ-ÖØ-öø-ˁˆ-ˑˠ-ˤˬˮͰ-ʹͶͷͺ-ͽͿΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ҁҊ-ԯԱ-Ֆՙՠ-ֈא-תׯ-ײؠ-يٮٯٱ-ۓەۥۦۮۯۺ-ۼۿܐܒ-ܯݍ-ޥޱߊ-ߪߴߵߺࠀ-ࠕࠚࠤࠨࡀ-ࡘࡠ-ࡪࡰ-ࢇࢉ-ࢎࢠ-ࣉऄ-हऽॐक़-ॡॱ-ঀঅ-ঌএঐও-নপ-রলশ-হঽৎড়ঢ়য়-ৡৰৱৼਅ-ਊਏਐਓ-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹਖ਼-ੜਫ਼ੲ-ੴઅ-ઍએ-ઑઓ-નપ-રલળવ-હઽૐૠૡૹଅ-ଌଏଐଓ-ନପ-ରଲଳଵ-ହଽଡ଼ଢ଼ୟ-ୡୱஃஅ-ஊஎ-ஐஒ-கஙசஜஞடணதந-பம-ஹௐఅ-ఌఎ-ఐఒ-నప-హఽౘ-ౚౝౠౡಀಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹಽೝೞೠೡೱೲഄ-ഌഎ-ഐഒ-ഺഽൎൔ-ൖൟ-ൡൺ-ൿඅ-ඖක-නඳ-රලව-ෆก-ะาำเ-ๆກຂຄຆ-ຊຌ-ຣລວ-ະາຳຽເ-ໄໆໜ-ໟༀཀ-ཇཉ-ཬྈ-ྌက-ဪဿၐ-ၕၚ-ၝၡၥၦၮ-ၰၵ-ႁႎႠ-ჅჇჍა-ჺჼ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚᎀ-ᎏᎠ-Ᏽᏸ-ᏽᐁ-ᙬᙯ-ᙿᚁ-ᚚᚠ-ᛪᛮ-ᛸᜀ-ᜑᜟ-ᜱᝀ-ᝑᝠ-ᝬᝮ-ᝰក-ឳៗៜᠠ-ᡸᢀ-ᢨᢪᢰ-ᣵᤀ-ᤞᥐ-ᥭᥰ-ᥴᦀ-ᦫᦰ-ᧉᨀ-ᨖᨠ-ᩔᪧᬅ-ᬳᭅ-ᭌᮃ-ᮠᮮᮯᮺ-ᯥᰀ-ᰣᱍ-ᱏᱚ-ᱽᲀ-Ა-ᲺᲽ-Ჿᳩ-ᳬᳮ-ᳳᳵᳶᳺᴀ-ᶿḀ-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼⁱⁿₐ-ₜℂℇℊ-ℓℕ℘-ℝℤΩℨK-ℹℼ-ℿⅅ-ⅉⅎⅠ-ↈⰀ-ⳤⳫ-ⳮⳲⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯⶀ-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞ々-〇〡-〩〱-〵〸-〼ぁ-ゖ゛-ゟァ-ヺー-ヿㄅ-ㄯㄱ-ㆎㆠ-ㆿㇰ-ㇿ㐀-䶿一-ꒌꓐ-ꓽꔀ-ꘌꘐ-ꘟꘪꘫꙀ-ꙮꙿ-ꚝꚠ-ꛯꜗ-ꜟꜢ-ꞈꞋ-Ꟑꟑꟓꟕ-ꟲ-ꠁꠃ-ꠅꠇ-ꠊꠌ-ꠢꡀ-ꡳꢂ-ꢳꣲ-ꣷꣻꣽꣾꤊ-ꤥꤰ-ꥆꥠ-ꥼꦄ-ꦲꧏꧠ-ꧤꧦ-ꧯꧺ-ꧾꨀ-ꨨꩀ-ꩂꩄ-ꩋꩠ-ꩶꩺꩾ-ꪯꪱꪵꪶꪹ-ꪽꫀꫂꫛ-ꫝꫠ-ꫪꫲ-ꫴꬁ-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꬰ-ꭚꭜ-ꭩꭰ-ꯢ가-힣ힰ-ퟆퟋ-ퟻ豈-舘並-龎ff-stﬓ-ﬗיִײַ-ﬨשׁ-זּטּ-לּמּנּסּףּפּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻﹰ-ﹴﹶ-ﻼA-Za-zヲ-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ",$h={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"},Wh="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",qh={5:Wh,"5module":Wh+" export import",6:Wh+" const class extends export import super"},Hh=/^in(stanceof)?$/,Xh=new RegExp("["+jh+"]"),Yh=new RegExp("["+jh+"·̀-ͯ·҃-֑҇-ׇֽֿׁׂׅׄؐ-ًؚ-٩ٰۖ-ۜ۟-۪ۤۧۨ-ۭ۰-۹ܑܰ-݊ަ-ް߀-߉߫-߽߳ࠖ-࠙ࠛ-ࠣࠥ-ࠧࠩ-࡙࠭-࡛-࢟࣊-ࣣ࣡-ःऺ-़ा-ॏ॑-ॗॢॣ०-९ঁ-ঃ়া-ৄেৈো-্ৗৢৣ০-৯৾ਁ-ਃ਼ਾ-ੂੇੈੋ-੍ੑ੦-ੱੵઁ-ઃ઼ા-ૅે-ૉો-્ૢૣ૦-૯ૺ-૿ଁ-ଃ଼ା-ୄେୈୋ-୍୕-ୗୢୣ୦-୯ஂா-ூெ-ைொ-்ௗ௦-௯ఀ-ఄ఼ా-ౄె-ైొ-్ౕౖౢౣ౦-౯ಁ-ಃ಼ಾ-ೄೆ-ೈೊ-್ೕೖೢೣ೦-೯ೳഀ-ഃ഻഼ാ-ൄെ-ൈൊ-്ൗൢൣ൦-൯ඁ-ඃ්ා-ුූෘ-ෟ෦-෯ෲෳัิ-ฺ็-๎๐-๙ັິ-ຼ່-໎໐-໙༘༙༠-༩༹༵༷༾༿ཱ-྄྆྇ྍ-ྗྙ-ྼ࿆ါ-ှ၀-၉ၖ-ၙၞ-ၠၢ-ၤၧ-ၭၱ-ၴႂ-ႍႏ-ႝ፝-፟፩-፱ᜒ-᜕ᜲ-᜴ᝒᝓᝲᝳ឴-៓៝០-៩᠋-᠍᠏-᠙ᢩᤠ-ᤫᤰ-᤻᥆-᥏᧐-᧚ᨗ-ᨛᩕ-ᩞ᩠-᩿᩼-᪉᪐-᪙᪰-᪽ᪿ-ᫎᬀ-ᬄ᬴-᭄᭐-᭙᭫-᭳ᮀ-ᮂᮡ-ᮭ᮰-᮹᯦-᯳ᰤ-᰷᱀-᱉᱐-᱙᳐-᳔᳒-᳨᳭᳴᳷-᳹᷀-᷿‿⁀⁔⃐-⃥⃜⃡-⃰⳯-⵿⳱ⷠ-〪ⷿ-゙゚〯・꘠-꘩꙯ꙴ-꙽ꚞꚟ꛰꛱ꠂ꠆ꠋꠣ-ꠧ꠬ꢀꢁꢴ-ꣅ꣐-꣙꣠-꣱ꣿ-꤉ꤦ-꤭ꥇ-꥓ꦀ-ꦃ꦳-꧀꧐-꧙ꧥ꧰-꧹ꨩ-ꨶꩃꩌꩍ꩐-꩙ꩻ-ꩽꪰꪲ-ꪴꪷꪸꪾ꪿꫁ꫫ-ꫯꫵ꫶ꯣ-ꯪ꯬꯭꯰-꯹ﬞ︀-️︠-︯︳︴﹍-﹏0-9_・]");function Zh(e,t){for(var r=65536,i=0;i<t.length;i+=2){if((r+=t[i])>e)return!1;if((r+=t[i+1])>=e)return!0}return!1}function Kh(e,t){return e<65?36===e:e<91||(e<97?95===e:e<123||(e<=65535?e>=170&&Xh.test(String.fromCharCode(e)):!1!==t&&Zh(e,zh)))}function Jh(e,t){return e<48?36===e:e<58||!(e<65)&&(e<91||(e<97?95===e:e<123||(e<=65535?e>=170&&Yh.test(String.fromCharCode(e)):!1!==t&&(Zh(e,zh)||Zh(e,Gh)))))}var Qh=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 eu(e,t){return new Qh(e,{beforeExpr:!0,binop:t})}var tu={beforeExpr:!0},ru={startsExpr:!0},iu={};function su(e,t){return void 0===t&&(t={}),t.keyword=e,iu[e]=new Qh(e,t)}var nu={num:new Qh("num",ru),regexp:new Qh("regexp",ru),string:new Qh("string",ru),name:new Qh("name",ru),privateId:new Qh("privateId",ru),eof:new Qh("eof"),bracketL:new Qh("[",{beforeExpr:!0,startsExpr:!0}),bracketR:new Qh("]"),braceL:new Qh("{",{beforeExpr:!0,startsExpr:!0}),braceR:new Qh("}"),parenL:new Qh("(",{beforeExpr:!0,startsExpr:!0}),parenR:new Qh(")"),comma:new Qh(",",tu),semi:new Qh(";",tu),colon:new Qh(":",tu),dot:new Qh("."),question:new Qh("?",tu),questionDot:new Qh("?."),arrow:new Qh("=>",tu),template:new Qh("template"),invalidTemplate:new Qh("invalidTemplate"),ellipsis:new Qh("...",tu),backQuote:new Qh("`",ru),dollarBraceL:new Qh("${",{beforeExpr:!0,startsExpr:!0}),eq:new Qh("=",{beforeExpr:!0,isAssign:!0}),assign:new Qh("_=",{beforeExpr:!0,isAssign:!0}),incDec:new Qh("++/--",{prefix:!0,postfix:!0,startsExpr:!0}),prefix:new Qh("!/~",{beforeExpr:!0,prefix:!0,startsExpr:!0}),logicalOR:eu("||",1),logicalAND:eu("&&",2),bitwiseOR:eu("|",3),bitwiseXOR:eu("^",4),bitwiseAND:eu("&",5),equality:eu("==/!=/===/!==",6),relational:eu("</>/<=/>=",7),bitShift:eu("<</>>/>>>",8),plusMin:new Qh("+/-",{beforeExpr:!0,binop:9,prefix:!0,startsExpr:!0}),modulo:eu("%",10),star:eu("*",10),slash:eu("/",10),starstar:new Qh("**",{beforeExpr:!0}),coalesce:eu("??",1),_break:su("break"),_case:su("case",tu),_catch:su("catch"),_continue:su("continue"),_debugger:su("debugger"),_default:su("default",tu),_do:su("do",{isLoop:!0,beforeExpr:!0}),_else:su("else",tu),_finally:su("finally"),_for:su("for",{isLoop:!0}),_function:su("function",ru),_if:su("if"),_return:su("return",tu),_switch:su("switch"),_throw:su("throw",tu),_try:su("try"),_var:su("var"),_const:su("const"),_while:su("while",{isLoop:!0}),_with:su("with"),_new:su("new",{beforeExpr:!0,startsExpr:!0}),_this:su("this",ru),_super:su("super",ru),_class:su("class",ru),_extends:su("extends",tu),_export:su("export"),_import:su("import",ru),_null:su("null",ru),_true:su("true",ru),_false:su("false",ru),_in:su("in",{beforeExpr:!0,binop:7}),_instanceof:su("instanceof",{beforeExpr:!0,binop:7}),_typeof:su("typeof",{beforeExpr:!0,prefix:!0,startsExpr:!0}),_void:su("void",{beforeExpr:!0,prefix:!0,startsExpr:!0}),_delete:su("delete",{beforeExpr:!0,prefix:!0,startsExpr:!0})},au=/\r\n?|\n|\u2028|\u2029/,ou=new RegExp(au.source,"g");function hu(e){return 10===e||13===e||8232===e||8233===e}function uu(e,t,r){void 0===r&&(r=e.length);for(var i=t;i<r;i++){var s=e.charCodeAt(i);if(hu(s))return i<r-1&&13===s&&10===e.charCodeAt(i+1)?i+2:i+1}return-1}var lu=/[\u1680\u2000-\u200a\u202f\u205f\u3000\ufeff]/,cu=/(?:\s|\/\/.*|\/\*[^]*?\*\/)*/g,pu=Object.prototype,du=pu.hasOwnProperty,fu=pu.toString,gu=Object.hasOwn||function(e,t){return du.call(e,t)},mu=Array.isArray||function(e){return"[object Array]"===fu.call(e)},yu=Object.create(null);function xu(e){return yu[e]||(yu[e]=new RegExp("^(?:"+e.replace(/ /g,"|")+")$"))}function vu(e){return e<=65535?String.fromCharCode(e):(e-=65536,String.fromCharCode(55296+(e>>10),56320+(1023&e)))}var bu=/(?:[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])/,_u=function(e,t){this.line=e,this.column=t};_u.prototype.offset=function(e){return new _u(this.line,this.column+e)};var wu=function(e,t,r){this.start=t,this.end=r,null!==e.sourceFile&&(this.source=e.sourceFile)};function Cu(e,t){for(var r=1,i=0;;){var s=uu(e,i,t);if(s<0)return new _u(r,t-i);++r,i=s}}var Du={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},Eu=!1;function Au(e){var t={};for(var r in Du)t[r]=e&&gu(e,r)?e[r]:Du[r];if("latest"===t.ecmaVersion?t.ecmaVersion=1e8:null==t.ecmaVersion?(!Eu&&"object"==typeof console&&console.warn&&(Eu=!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),mu(t.onToken)){var i=t.onToken;t.onToken=function(e){return i.push(e)}}return mu(t.onComment)&&(t.onComment=function(e,t){return function(r,i,s,n,a,o){var h={type:r?"Block":"Line",value:i,start:s,end:n};e.locations&&(h.loc=new wu(this,a,o)),e.ranges&&(h.range=[s,n]),t.push(h)}}(t,t.onComment)),t}var Su=256;function Fu(e,t){return 2|(e?4:0)|(t?8:0)}var Tu=function(e,t,r){this.options=e=Au(e),this.sourceFile=e.sourceFile,this.keywords=xu(qh[e.ecmaVersion>=6?6:"module"===e.sourceType?"5module":5]);var i="";!0!==e.allowReserved&&(i=$h[e.ecmaVersion>=6?6:5===e.ecmaVersion?5:3],"module"===e.sourceType&&(i+=" await")),this.reservedWords=xu(i);var s=(i?i+" ":"")+$h.strict;this.reservedWordsStrict=xu(s),this.reservedWordsStrictBind=xu(s+" "+$h.strictBind),this.input=String(t),this.containsEsc=!1,r?(this.pos=r,this.lineStart=this.input.lastIndexOf("\n",r-1)+1,this.curLine=this.input.slice(0,this.lineStart).split(au).length):(this.pos=this.lineStart=0,this.curLine=1),this.type=nu.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=[]},Mu={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}};Tu.prototype.parse=function(){var e=this.options.program||this.startNode();return this.nextToken(),this.parseTopLevel(e)},Mu.inFunction.get=function(){return(2&this.currentVarScope().flags)>0},Mu.inGenerator.get=function(){return(8&this.currentVarScope().flags)>0&&!this.currentVarScope().inClassFieldInit},Mu.inAsync.get=function(){return(4&this.currentVarScope().flags)>0&&!this.currentVarScope().inClassFieldInit},Mu.canAwait.get=function(){for(var e=this.scopeStack.length-1;e>=0;e--){var t=this.scopeStack[e];if(t.inClassFieldInit||t.flags&Su)return!1;if(2&t.flags)return(4&t.flags)>0}return this.inModule&&this.options.ecmaVersion>=13||this.options.allowAwaitOutsideFunction},Mu.allowSuper.get=function(){var e=this.currentThisScope(),t=e.flags,r=e.inClassFieldInit;return(64&t)>0||r||this.options.allowSuperOutsideMethod},Mu.allowDirectSuper.get=function(){return(128&this.currentThisScope().flags)>0},Mu.treatFunctionsAsVar.get=function(){return this.treatFunctionsAsVarInScope(this.currentScope())},Mu.allowNewDotTarget.get=function(){var e=this.currentThisScope(),t=e.flags,r=e.inClassFieldInit;return(258&t)>0||r},Mu.inClassStaticBlock.get=function(){return(this.currentVarScope().flags&Su)>0},Tu.extend=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];for(var r=this,i=0;i<e.length;i++)r=e[i](r);return r},Tu.parse=function(e,t){return new this(t,e).parse()},Tu.parseExpressionAt=function(e,t,r){var i=new this(r,e,t);return i.nextToken(),i.parseExpression()},Tu.tokenizer=function(e,t){return new this(t,e)},Object.defineProperties(Tu.prototype,Mu);var ku=Tu.prototype,Iu=/^(?:'((?:\\[^]|[^'\\])*?)'|"((?:\\[^]|[^"\\])*?)")/;ku.strictDirective=function(e){if(this.options.ecmaVersion<5)return!1;for(;;){cu.lastIndex=e,e+=cu.exec(this.input)[0].length;var t=Iu.exec(this.input.slice(e));if(!t)return!1;if("use strict"===(t[1]||t[2])){cu.lastIndex=e+t[0].length;var r=cu.exec(this.input),i=r.index+r[0].length,s=this.input.charAt(i);return";"===s||"}"===s||au.test(r[0])&&!(/[(`.[+\-/*%<>=,?^&]/.test(s)||"!"===s&&"="===this.input.charAt(i+1))}e+=t[0].length,cu.lastIndex=e,e+=cu.exec(this.input)[0].length,";"===this.input[e]&&e++}},ku.eat=function(e){return this.type===e&&(this.next(),!0)},ku.isContextual=function(e){return this.type===nu.name&&this.value===e&&!this.containsEsc},ku.eatContextual=function(e){return!!this.isContextual(e)&&(this.next(),!0)},ku.expectContextual=function(e){this.eatContextual(e)||this.unexpected()},ku.canInsertSemicolon=function(){return this.type===nu.eof||this.type===nu.braceR||au.test(this.input.slice(this.lastTokEnd,this.start))},ku.insertSemicolon=function(){if(this.canInsertSemicolon())return this.options.onInsertedSemicolon&&this.options.onInsertedSemicolon(this.lastTokEnd,this.lastTokEndLoc),!0},ku.semicolon=function(){this.eat(nu.semi)||this.insertSemicolon()||this.unexpected()},ku.afterTrailingComma=function(e,t){if(this.type===e)return this.options.onTrailingComma&&this.options.onTrailingComma(this.lastTokStart,this.lastTokStartLoc),t||this.next(),!0},ku.expect=function(e){this.eat(e)||this.unexpected()},ku.unexpected=function(e){this.raise(null!=e?e:this.start,"Unexpected token")};var Bu=function(){this.shorthandAssign=this.trailingComma=this.parenthesizedAssign=this.parenthesizedBind=this.doubleProto=-1};ku.checkPatternErrors=function(e,t){if(e){e.trailingComma>-1&&this.raiseRecoverable(e.trailingComma,"Comma is not permitted after the rest element");var r=t?e.parenthesizedAssign:e.parenthesizedBind;r>-1&&this.raiseRecoverable(r,t?"Assigning to rvalue":"Parenthesized pattern")}},ku.checkExpressionErrors=function(e,t){if(!e)return!1;var r=e.shorthandAssign,i=e.doubleProto;if(!t)return r>=0||i>=0;r>=0&&this.raise(r,"Shorthand property assignments are valid only in destructuring patterns"),i>=0&&this.raiseRecoverable(i,"Redefinition of __proto__ property")},ku.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")},ku.isSimpleAssignTarget=function(e){return"ParenthesizedExpression"===e.type?this.isSimpleAssignTarget(e.expression):"Identifier"===e.type||"MemberExpression"===e.type};var Lu=Tu.prototype;Lu.parseTopLevel=function(e){var t=Object.create(null);for(e.body||(e.body=[]);this.type!==nu.eof;){var r=this.parseStatement(null,!0,t);e.body.push(r)}if(this.inModule)for(var i=0,s=Object.keys(this.undefinedExports);i<s.length;i+=1){var n=s[i];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 Pu={kind:"loop"},Ou={kind:"switch"};Lu.isLet=function(e){if(this.options.ecmaVersion<6||!this.isContextual("let"))return!1;cu.lastIndex=this.pos;var t=cu.exec(this.input),r=this.pos+t[0].length,i=this.input.charCodeAt(r);if(91===i||92===i)return!0;if(e)return!1;if(123===i||i>55295&&i<56320)return!0;if(Kh(i,!0)){for(var s=r+1;Jh(i=this.input.charCodeAt(s),!0);)++s;if(92===i||i>55295&&i<56320)return!0;var n=this.input.slice(r,s);if(!Hh.test(n))return!0}return!1},Lu.isAsyncFunction=function(){if(this.options.ecmaVersion<8||!this.isContextual("async"))return!1;cu.lastIndex=this.pos;var e,t=cu.exec(this.input),r=this.pos+t[0].length;return!(au.test(this.input.slice(this.pos,r))||"function"!==this.input.slice(r,r+8)||r+8!==this.input.length&&(Jh(e=this.input.charCodeAt(r+8))||e>55295&&e<56320))},Lu.parseStatement=function(e,t,r){var i,s=this.type,n=this.startNode();switch(this.isLet(e)&&(s=nu._var,i="let"),s){case nu._break:case nu._continue:return this.parseBreakContinueStatement(n,s.keyword);case nu._debugger:return this.parseDebuggerStatement(n);case nu._do:return this.parseDoStatement(n);case nu._for:return this.parseForStatement(n);case nu._function:return e&&(this.strict||"if"!==e&&"label"!==e)&&this.options.ecmaVersion>=6&&this.unexpected(),this.parseFunctionStatement(n,!1,!e);case nu._class:return e&&this.unexpected(),this.parseClass(n,!0);case nu._if:return this.parseIfStatement(n);case nu._return:return this.parseReturnStatement(n);case nu._switch:return this.parseSwitchStatement(n);case nu._throw:return this.parseThrowStatement(n);case nu._try:return this.parseTryStatement(n);case nu._const:case nu._var:return i=i||this.value,e&&"var"!==i&&this.unexpected(),this.parseVarStatement(n,i);case nu._while:return this.parseWhileStatement(n);case nu._with:return this.parseWithStatement(n);case nu.braceL:return this.parseBlock(!0,n);case nu.semi:return this.parseEmptyStatement(n);case nu._export:case nu._import:if(this.options.ecmaVersion>10&&s===nu._import){cu.lastIndex=this.pos;var a=cu.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===nu._import?this.parseImport(n):this.parseExport(n,r);default:if(this.isAsyncFunction())return e&&this.unexpected(),this.next(),this.parseFunctionStatement(n,!0,!e);var u=this.value,l=this.parseExpression();return s===nu.name&&"Identifier"===l.type&&this.eat(nu.colon)?this.parseLabeledStatement(n,u,l,e):this.parseExpressionStatement(n,l)}},Lu.parseBreakContinueStatement=function(e,t){var r="break"===t;this.next(),this.eat(nu.semi)||this.insertSemicolon()?e.label=null:this.type!==nu.name?this.unexpected():(e.label=this.parseIdent(),this.semicolon());for(var i=0;i<this.labels.length;++i){var s=this.labels[i];if(null==e.label||s.name===e.label.name){if(null!=s.kind&&(r||"loop"===s.kind))break;if(e.label&&r)break}}return i===this.labels.length&&this.raise(e.start,"Unsyntactic "+t),this.finishNode(e,r?"BreakStatement":"ContinueStatement")},Lu.parseDebuggerStatement=function(e){return this.next(),this.semicolon(),this.finishNode(e,"DebuggerStatement")},Lu.parseDoStatement=function(e){return this.next(),this.labels.push(Pu),e.body=this.parseStatement("do"),this.labels.pop(),this.expect(nu._while),e.test=this.parseParenExpression(),this.options.ecmaVersion>=6?this.eat(nu.semi):this.semicolon(),this.finishNode(e,"DoWhileStatement")},Lu.parseForStatement=function(e){this.next();var t=this.options.ecmaVersion>=9&&this.canAwait&&this.eatContextual("await")?this.lastTokStart:-1;if(this.labels.push(Pu),this.enterScope(0),this.expect(nu.parenL),this.type===nu.semi)return t>-1&&this.unexpected(t),this.parseFor(e,null);var r=this.isLet();if(this.type===nu._var||this.type===nu._const||r){var i=this.startNode(),s=r?"let":this.value;return this.next(),this.parseVar(i,!0,s),this.finishNode(i,"VariableDeclaration"),(this.type===nu._in||this.options.ecmaVersion>=6&&this.isContextual("of"))&&1===i.declarations.length?(this.options.ecmaVersion>=9&&(this.type===nu._in?t>-1&&this.unexpected(t):e.await=t>-1),this.parseForIn(e,i)):(t>-1&&this.unexpected(t),this.parseFor(e,i))}var n=this.isContextual("let"),a=!1,o=this.containsEsc,h=new Bu,u=this.start,l=t>-1?this.parseExprSubscripts(h,"await"):this.parseExpression(!0,h);return this.type===nu._in||(a=this.options.ecmaVersion>=6&&this.isContextual("of"))?(t>-1?(this.type===nu._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))},Lu.parseFunctionStatement=function(e,t,r){return this.next(),this.parseFunction(e,Ru|(r?0:Vu),!1,t)},Lu.parseIfStatement=function(e){return this.next(),e.test=this.parseParenExpression(),e.consequent=this.parseStatement("if"),e.alternate=this.eat(nu._else)?this.parseStatement("if"):null,this.finishNode(e,"IfStatement")},Lu.parseReturnStatement=function(e){return this.inFunction||this.options.allowReturnOutsideFunction||this.raise(this.start,"'return' outside of function"),this.next(),this.eat(nu.semi)||this.insertSemicolon()?e.argument=null:(e.argument=this.parseExpression(),this.semicolon()),this.finishNode(e,"ReturnStatement")},Lu.parseSwitchStatement=function(e){var t;this.next(),e.discriminant=this.parseParenExpression(),e.cases=[],this.expect(nu.braceL),this.labels.push(Ou),this.enterScope(0);for(var r=!1;this.type!==nu.braceR;)if(this.type===nu._case||this.type===nu._default){var i=this.type===nu._case;t&&this.finishNode(t,"SwitchCase"),e.cases.push(t=this.startNode()),t.consequent=[],this.next(),i?t.test=this.parseExpression():(r&&this.raiseRecoverable(this.lastTokStart,"Multiple default clauses"),r=!0,t.test=null),this.expect(nu.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")},Lu.parseThrowStatement=function(e){return this.next(),au.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 Nu=[];Lu.parseCatchClauseParam=function(){var e=this.parseBindingAtom(),t="Identifier"===e.type;return this.enterScope(t?32:0),this.checkLValPattern(e,t?4:2),this.expect(nu.parenR),e},Lu.parseTryStatement=function(e){if(this.next(),e.block=this.parseBlock(),e.handler=null,this.type===nu._catch){var t=this.startNode();this.next(),this.eat(nu.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(nu._finally)?this.parseBlock():null,e.handler||e.finalizer||this.raise(e.start,"Missing catch or finally clause"),this.finishNode(e,"TryStatement")},Lu.parseVarStatement=function(e,t,r){return this.next(),this.parseVar(e,!1,t,r),this.semicolon(),this.finishNode(e,"VariableDeclaration")},Lu.parseWhileStatement=function(e){return this.next(),e.test=this.parseParenExpression(),this.labels.push(Pu),e.body=this.parseStatement("while"),this.labels.pop(),this.finishNode(e,"WhileStatement")},Lu.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")},Lu.parseEmptyStatement=function(e){return this.next(),this.finishNode(e,"EmptyStatement")},Lu.parseLabeledStatement=function(e,t,r,i){for(var s=0,n=this.labels;s<n.length;s+=1){n[s].name===t&&this.raise(r.start,"Label '"+t+"' is already declared")}for(var a=this.type.isLoop?"loop":this.type===nu._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(i?-1===i.indexOf("label")?i+"label":i:"label"),this.labels.pop(),e.label=r,this.finishNode(e,"LabeledStatement")},Lu.parseExpressionStatement=function(e,t){return e.expression=t,this.semicolon(),this.finishNode(e,"ExpressionStatement")},Lu.parseBlock=function(e,t,r){for(void 0===e&&(e=!0),void 0===t&&(t=this.startNode()),t.body=[],this.expect(nu.braceL),e&&this.enterScope(0);this.type!==nu.braceR;){var i=this.parseStatement(null);t.body.push(i)}return r&&(this.strict=!1),this.next(),e&&this.exitScope(),this.finishNode(t,"BlockStatement")},Lu.parseFor=function(e,t){return e.init=t,this.expect(nu.semi),e.test=this.type===nu.semi?null:this.parseExpression(),this.expect(nu.semi),e.update=this.type===nu.parenR?null:this.parseExpression(),this.expect(nu.parenR),e.body=this.parseStatement("for"),this.exitScope(),this.labels.pop(),this.finishNode(e,"ForStatement")},Lu.parseForIn=function(e,t){var r=this.type===nu._in;return this.next(),"VariableDeclaration"===t.type&&null!=t.declarations[0].init&&(!r||this.options.ecmaVersion<8||this.strict||"var"!==t.kind||"Identifier"!==t.declarations[0].id.type)&&this.raise(t.start,(r?"for-in":"for-of")+" loop variable declaration may not have an initializer"),e.left=t,e.right=r?this.parseExpression():this.parseMaybeAssign(),this.expect(nu.parenR),e.body=this.parseStatement("for"),this.exitScope(),this.labels.pop(),this.finishNode(e,r?"ForInStatement":"ForOfStatement")},Lu.parseVar=function(e,t,r,i){for(e.declarations=[],e.kind=r;;){var s=this.startNode();if(this.parseVarId(s,r),this.eat(nu.eq)?s.init=this.parseMaybeAssign(t):i||"const"!==r||this.type===nu._in||this.options.ecmaVersion>=6&&this.isContextual("of")?i||"Identifier"===s.id.type||t&&(this.type===nu._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(nu.comma))break}return e},Lu.parseVarId=function(e,t){e.id=this.parseBindingAtom(),this.checkLValPattern(e.id,"var"===t?1:2,!1)};var Ru=1,Vu=2;function Uu(e,t){var r=t.key.name,i=e[r],s="true";return"MethodDefinition"!==t.type||"get"!==t.kind&&"set"!==t.kind||(s=(t.static?"s":"i")+t.kind),"iget"===i&&"iset"===s||"iset"===i&&"iget"===s||"sget"===i&&"sset"===s||"sset"===i&&"sget"===s?(e[r]="true",!1):!!i||(e[r]=s,!1)}function Gu(e,t){var r=e.computed,i=e.key;return!r&&("Identifier"===i.type&&i.name===t||"Literal"===i.type&&i.value===t)}Lu.parseFunction=function(e,t,r,i,s){this.initFunction(e),(this.options.ecmaVersion>=9||this.options.ecmaVersion>=6&&!i)&&(this.type===nu.star&&t&Vu&&this.unexpected(),e.generator=this.eat(nu.star)),this.options.ecmaVersion>=8&&(e.async=!!i),t&Ru&&(e.id=4&t&&this.type!==nu.name?null:this.parseIdent(),!e.id||t&Vu||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(Fu(e.async,e.generator)),t&Ru||(e.id=this.type===nu.name?this.parseIdent():null),this.parseFunctionParams(e),this.parseFunctionBody(e,r,!1,s),this.yieldPos=n,this.awaitPos=a,this.awaitIdentPos=o,this.finishNode(e,t&Ru?"FunctionDeclaration":"FunctionExpression")},Lu.parseFunctionParams=function(e){this.expect(nu.parenL),e.params=this.parseBindingList(nu.parenR,!1,this.options.ecmaVersion>=8),this.checkYieldAwaitInDefaultParams()},Lu.parseClass=function(e,t){this.next();var r=this.strict;this.strict=!0,this.parseClassId(e,t),this.parseClassSuper(e);var i=this.enterClassBody(),s=this.startNode(),n=!1;for(s.body=[],this.expect(nu.braceL);this.type!==nu.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&&Uu(i,a)&&this.raiseRecoverable(a.key.start,"Identifier '#"+a.key.name+"' has already been declared"))}return this.strict=r,this.next(),e.body=this.finishNode(s,"ClassBody"),this.exitClassBody(),this.finishNode(e,t?"ClassDeclaration":"ClassExpression")},Lu.parseClassElement=function(e){if(this.eat(nu.semi))return null;var t=this.options.ecmaVersion,r=this.startNode(),i="",s=!1,n=!1,a="method",o=!1;if(this.eatContextual("static")){if(t>=13&&this.eat(nu.braceL))return this.parseClassStaticBlock(r),r;this.isClassElementNameStart()||this.type===nu.star?o=!0:i="static"}if(r.static=o,!i&&t>=8&&this.eatContextual("async")&&(!this.isClassElementNameStart()&&this.type!==nu.star||this.canInsertSemicolon()?i="async":n=!0),!i&&(t>=9||!n)&&this.eat(nu.star)&&(s=!0),!i&&!n&&!s){var h=this.value;(this.eatContextual("get")||this.eatContextual("set"))&&(this.isClassElementNameStart()?a=h:i=h)}if(i?(r.computed=!1,r.key=this.startNodeAt(this.lastTokStart,this.lastTokStartLoc),r.key.name=i,this.finishNode(r.key,"Identifier")):this.parseClassElementName(r),t<13||this.type===nu.parenL||"method"!==a||s||n){var u=!r.static&&Gu(r,"constructor"),l=u&&e;u&&"method"!==a&&this.raise(r.key.start,"Constructor can't have get/set modifier"),r.kind=u?"constructor":a,this.parseClassMethod(r,s,n,l)}else this.parseClassField(r);return r},Lu.isClassElementNameStart=function(){return this.type===nu.name||this.type===nu.privateId||this.type===nu.num||this.type===nu.string||this.type===nu.bracketL||this.type.keyword},Lu.parseClassElementName=function(e){this.type===nu.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)},Lu.parseClassMethod=function(e,t,r,i){var s=e.key;"constructor"===e.kind?(t&&this.raise(s.start,"Constructor can't be a generator"),r&&this.raise(s.start,"Constructor can't be an async method")):e.static&&Gu(e,"prototype")&&this.raise(s.start,"Classes may not have a static property named prototype");var n=e.value=this.parseMethod(t,r,i);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")},Lu.parseClassField=function(e){if(Gu(e,"constructor")?this.raise(e.key.start,"Classes can't have a field named 'constructor'"):e.static&&Gu(e,"prototype")&&this.raise(e.key.start,"Classes can't have a static field named 'prototype'"),this.eat(nu.eq)){var t=this.currentThisScope(),r=t.inClassFieldInit;t.inClassFieldInit=!0,e.value=this.parseMaybeAssign(),t.inClassFieldInit=r}else e.value=null;return this.semicolon(),this.finishNode(e,"PropertyDefinition")},Lu.parseClassStaticBlock=function(e){e.body=[];var t=this.labels;for(this.labels=[],this.enterScope(320);this.type!==nu.braceR;){var r=this.parseStatement(null);e.body.push(r)}return this.next(),this.exitScope(),this.labels=t,this.finishNode(e,"StaticBlock")},Lu.parseClassId=function(e,t){this.type===nu.name?(e.id=this.parseIdent(),t&&this.checkLValSimple(e.id,2,!1)):(!0===t&&this.unexpected(),e.id=null)},Lu.parseClassSuper=function(e){e.superClass=this.eat(nu._extends)?this.parseExprSubscripts(null,!1):null},Lu.enterClassBody=function(){var e={declared:Object.create(null),used:[]};return this.privateNameStack.push(e),e.declared},Lu.exitClassBody=function(){var e=this.privateNameStack.pop(),t=e.declared,r=e.used;if(this.options.checkPrivateFields)for(var i=this.privateNameStack.length,s=0===i?null:this.privateNameStack[i-1],n=0;n<r.length;++n){var a=r[n];gu(t,a.name)||(s?s.used.push(a):this.raiseRecoverable(a.start,"Private field '#"+a.name+"' must be declared in an enclosing class"))}},Lu.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!==nu.string&&this.unexpected(),e.source=this.parseExprAtom(),this.options.ecmaVersion>=16&&(e.attributes=this.parseWithClause()),this.semicolon(),this.finishNode(e,"ExportAllDeclaration")},Lu.parseExport=function(e,t){if(this.next(),this.eat(nu.star))return this.parseExportAllDeclaration(e,t);if(this.eat(nu._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!==nu.string&&this.unexpected(),e.source=this.parseExprAtom(),this.options.ecmaVersion>=16&&(e.attributes=this.parseWithClause());else{for(var r=0,i=e.specifiers;r<i.length;r+=1){var s=i[r];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")},Lu.parseExportDeclaration=function(e){return this.parseStatement(null)},Lu.parseExportDefaultDeclaration=function(){var e;if(this.type===nu._function||(e=this.isAsyncFunction())){var t=this.startNode();return this.next(),e&&this.next(),this.parseFunction(t,4|Ru,!1,e)}if(this.type===nu._class){var r=this.startNode();return this.parseClass(r,"nullableID")}var i=this.parseMaybeAssign();return this.semicolon(),i},Lu.checkExport=function(e,t,r){e&&("string"!=typeof t&&(t="Identifier"===t.type?t.name:t.value),gu(e,t)&&this.raiseRecoverable(r,"Duplicate export '"+t+"'"),e[t]=!0)},Lu.checkPatternExport=function(e,t){var r=t.type;if("Identifier"===r)this.checkExport(e,t,t.start);else if("ObjectPattern"===r)for(var i=0,s=t.properties;i<s.length;i+=1){var n=s[i];this.checkPatternExport(e,n)}else if("ArrayPattern"===r)for(var a=0,o=t.elements;a<o.length;a+=1){var h=o[a];h&&this.checkPatternExport(e,h)}else"Property"===r?this.checkPatternExport(e,t.value):"AssignmentPattern"===r?this.checkPatternExport(e,t.left):"RestElement"===r&&this.checkPatternExport(e,t.argument)},Lu.checkVariableExport=function(e,t){if(e)for(var r=0,i=t;r<i.length;r+=1){var s=i[r];this.checkPatternExport(e,s.id)}},Lu.shouldParseExportStatement=function(){return"var"===this.type.keyword||"const"===this.type.keyword||"class"===this.type.keyword||"function"===this.type.keyword||this.isLet()||this.isAsyncFunction()},Lu.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")},Lu.parseExportSpecifiers=function(e){var t=[],r=!0;for(this.expect(nu.braceL);!this.eat(nu.braceR);){if(r)r=!1;else if(this.expect(nu.comma),this.afterTrailingComma(nu.braceR))break;t.push(this.parseExportSpecifier(e))}return t},Lu.parseImport=function(e){return this.next(),this.type===nu.string?(e.specifiers=Nu,e.source=this.parseExprAtom()):(e.specifiers=this.parseImportSpecifiers(),this.expectContextual("from"),e.source=this.type===nu.string?this.parseExprAtom():this.unexpected()),this.options.ecmaVersion>=16&&(e.attributes=this.parseWithClause()),this.semicolon(),this.finishNode(e,"ImportDeclaration")},Lu.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")},Lu.parseImportDefaultSpecifier=function(){var e=this.startNode();return e.local=this.parseIdent(),this.checkLValSimple(e.local,2),this.finishNode(e,"ImportDefaultSpecifier")},Lu.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")},Lu.parseImportSpecifiers=function(){var e=[],t=!0;if(this.type===nu.name&&(e.push(this.parseImportDefaultSpecifier()),!this.eat(nu.comma)))return e;if(this.type===nu.star)return e.push(this.parseImportNamespaceSpecifier()),e;for(this.expect(nu.braceL);!this.eat(nu.braceR);){if(t)t=!1;else if(this.expect(nu.comma),this.afterTrailingComma(nu.braceR))break;e.push(this.parseImportSpecifier())}return e},Lu.parseWithClause=function(){var e=[];if(!this.eat(nu._with))return e;this.expect(nu.braceL);for(var t={},r=!0;!this.eat(nu.braceR);){if(r)r=!1;else if(this.expect(nu.comma),this.afterTrailingComma(nu.braceR))break;var i=this.parseImportAttribute(),s="Identifier"===i.key.type?i.key.name:i.key.value;gu(t,s)&&this.raiseRecoverable(i.key.start,"Duplicate attribute key '"+s+"'"),t[s]=!0,e.push(i)}return e},Lu.parseImportAttribute=function(){var e=this.startNode();return e.key=this.type===nu.string?this.parseExprAtom():this.parseIdent("never"!==this.options.allowReserved),this.expect(nu.colon),this.type!==nu.string&&this.unexpected(),e.value=this.parseExprAtom(),this.finishNode(e,"ImportAttribute")},Lu.parseModuleExportName=function(){if(this.options.ecmaVersion>=13&&this.type===nu.string){var e=this.parseLiteral(this.value);return bu.test(e.value)&&this.raise(e.start,"An export name cannot include a lone surrogate."),e}return this.parseIdent(!0)},Lu.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)},Lu.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 zu=Tu.prototype;zu.toAssignable=function(e,t,r){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",r&&this.checkPatternErrors(r,!0);for(var i=0,s=e.properties;i<s.length;i+=1){var n=s[i];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",r&&this.checkPatternErrors(r,!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,r);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 r&&this.checkPatternErrors(r,!0);return e},zu.toAssignableList=function(e,t){for(var r=e.length,i=0;i<r;i++){var s=e[i];s&&this.toAssignable(s,t)}if(r){var n=e[r-1];6===this.options.ecmaVersion&&t&&n&&"RestElement"===n.type&&"Identifier"!==n.argument.type&&this.unexpected(n.argument.start)}return e},zu.parseSpread=function(e){var t=this.startNode();return this.next(),t.argument=this.parseMaybeAssign(!1,e),this.finishNode(t,"SpreadElement")},zu.parseRestBinding=function(){var e=this.startNode();return this.next(),6===this.options.ecmaVersion&&this.type!==nu.name&&this.unexpected(),e.argument=this.parseBindingAtom(),this.finishNode(e,"RestElement")},zu.parseBindingAtom=function(){if(this.options.ecmaVersion>=6)switch(this.type){case nu.bracketL:var e=this.startNode();return this.next(),e.elements=this.parseBindingList(nu.bracketR,!0,!0),this.finishNode(e,"ArrayPattern");case nu.braceL:return this.parseObj(!0)}return this.parseIdent()},zu.parseBindingList=function(e,t,r,i){for(var s=[],n=!0;!this.eat(e);)if(n?n=!1:this.expect(nu.comma),t&&this.type===nu.comma)s.push(null);else{if(r&&this.afterTrailingComma(e))break;if(this.type===nu.ellipsis){var a=this.parseRestBinding();this.parseBindingListItem(a),s.push(a),this.type===nu.comma&&this.raiseRecoverable(this.start,"Comma is not permitted after the rest element"),this.expect(e);break}s.push(this.parseAssignableListItem(i))}return s},zu.parseAssignableListItem=function(e){var t=this.parseMaybeDefault(this.start,this.startLoc);return this.parseBindingListItem(t),t},zu.parseBindingListItem=function(e){return e},zu.parseMaybeDefault=function(e,t,r){if(r=r||this.parseBindingAtom(),this.options.ecmaVersion<6||!this.eat(nu.eq))return r;var i=this.startNodeAt(e,t);return i.left=r,i.right=this.parseMaybeAssign(),this.finishNode(i,"AssignmentPattern")},zu.checkLValSimple=function(e,t,r){void 0===t&&(t=0);var i=0!==t;switch(e.type){case"Identifier":this.strict&&this.reservedWordsStrictBind.test(e.name)&&this.raiseRecoverable(e.start,(i?"Binding ":"Assigning to ")+e.name+" in strict mode"),i&&(2===t&&"let"===e.name&&this.raiseRecoverable(e.start,"let is disallowed as a lexically bound name"),r&&(gu(r,e.name)&&this.raiseRecoverable(e.start,"Argument name clash"),r[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":i&&this.raiseRecoverable(e.start,"Binding member expression");break;case"ParenthesizedExpression":return i&&this.raiseRecoverable(e.start,"Binding parenthesized expression"),this.checkLValSimple(e.expression,t,r);default:this.raise(e.start,(i?"Binding":"Assigning to")+" rvalue")}},zu.checkLValPattern=function(e,t,r){switch(void 0===t&&(t=0),e.type){case"ObjectPattern":for(var i=0,s=e.properties;i<s.length;i+=1){var n=s[i];this.checkLValInnerPattern(n,t,r)}break;case"ArrayPattern":for(var a=0,o=e.elements;a<o.length;a+=1){var h=o[a];h&&this.checkLValInnerPattern(h,t,r)}break;default:this.checkLValSimple(e,t,r)}},zu.checkLValInnerPattern=function(e,t,r){switch(void 0===t&&(t=0),e.type){case"Property":this.checkLValInnerPattern(e.value,t,r);break;case"AssignmentPattern":this.checkLValPattern(e.left,t,r);break;case"RestElement":this.checkLValPattern(e.argument,t,r);break;default:this.checkLValPattern(e,t,r)}};var ju=function(e,t,r,i,s){this.token=e,this.isExpr=!!t,this.preserveSpace=!!r,this.override=i,this.generator=!!s},$u={b_stat:new ju("{",!1),b_expr:new ju("{",!0),b_tmpl:new ju("${",!1),p_stat:new ju("(",!1),p_expr:new ju("(",!0),q_tmpl:new ju("`",!0,!0,(function(e){return e.tryReadTemplateToken()})),f_stat:new ju("function",!1),f_expr:new ju("function",!0),f_expr_gen:new ju("function",!0,!1,null,!0),f_gen:new ju("function",!1,!1,null,!0)},Wu=Tu.prototype;Wu.initialContext=function(){return[$u.b_stat]},Wu.curContext=function(){return this.context[this.context.length-1]},Wu.braceIsBlock=function(e){var t=this.curContext();return t===$u.f_expr||t===$u.f_stat||(e!==nu.colon||t!==$u.b_stat&&t!==$u.b_expr?e===nu._return||e===nu.name&&this.exprAllowed?au.test(this.input.slice(this.lastTokEnd,this.start)):e===nu._else||e===nu.semi||e===nu.eof||e===nu.parenR||e===nu.arrow||(e===nu.braceL?t===$u.b_stat:e!==nu._var&&e!==nu._const&&e!==nu.name&&!this.exprAllowed):!t.isExpr)},Wu.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},Wu.updateContext=function(e){var t,r=this.type;r.keyword&&e===nu.dot?this.exprAllowed=!1:(t=r.updateContext)?t.call(this,e):this.exprAllowed=r.beforeExpr},Wu.overrideContext=function(e){this.curContext()!==e&&(this.context[this.context.length-1]=e)},nu.parenR.updateContext=nu.braceR.updateContext=function(){if(1!==this.context.length){var e=this.context.pop();e===$u.b_stat&&"function"===this.curContext().token&&(e=this.context.pop()),this.exprAllowed=!e.isExpr}else this.exprAllowed=!0},nu.braceL.updateContext=function(e){this.context.push(this.braceIsBlock(e)?$u.b_stat:$u.b_expr),this.exprAllowed=!0},nu.dollarBraceL.updateContext=function(){this.context.push($u.b_tmpl),this.exprAllowed=!0},nu.parenL.updateContext=function(e){var t=e===nu._if||e===nu._for||e===nu._with||e===nu._while;this.context.push(t?$u.p_stat:$u.p_expr),this.exprAllowed=!0},nu.incDec.updateContext=function(){},nu._function.updateContext=nu._class.updateContext=function(e){!e.beforeExpr||e===nu._else||e===nu.semi&&this.curContext()!==$u.p_stat||e===nu._return&&au.test(this.input.slice(this.lastTokEnd,this.start))||(e===nu.colon||e===nu.braceL)&&this.curContext()===$u.b_stat?this.context.push($u.f_stat):this.context.push($u.f_expr),this.exprAllowed=!1},nu.colon.updateContext=function(){"function"===this.curContext().token&&this.context.pop(),this.exprAllowed=!0},nu.backQuote.updateContext=function(){this.curContext()===$u.q_tmpl?this.context.pop():this.context.push($u.q_tmpl),this.exprAllowed=!1},nu.star.updateContext=function(e){if(e===nu._function){var t=this.context.length-1;this.context[t]===$u.f_expr?this.context[t]=$u.f_expr_gen:this.context[t]=$u.f_gen}this.exprAllowed=!0},nu.name.updateContext=function(e){var t=!1;this.options.ecmaVersion>=6&&e!==nu.dot&&("of"===this.value&&!this.exprAllowed||"yield"===this.value&&this.inGeneratorContext())&&(t=!0),this.exprAllowed=t};var qu=Tu.prototype;function Hu(e){return"Identifier"===e.type||"ParenthesizedExpression"===e.type&&Hu(e.expression)}function Xu(e){return"MemberExpression"===e.type&&"PrivateIdentifier"===e.property.type||"ChainExpression"===e.type&&Xu(e.expression)||"ParenthesizedExpression"===e.type&&Xu(e.expression)}qu.checkPropClash=function(e,t,r){if(!(this.options.ecmaVersion>=9&&"SpreadElement"===e.type||this.options.ecmaVersion>=6&&(e.computed||e.method||e.shorthand))){var i,s=e.key;switch(s.type){case"Identifier":i=s.name;break;case"Literal":i=String(s.value);break;default:return}var n=e.kind;if(this.options.ecmaVersion>=6)"__proto__"===i&&"init"===n&&(t.proto&&(r?r.doubleProto<0&&(r.doubleProto=s.start):this.raiseRecoverable(s.start,"Redefinition of __proto__ property")),t.proto=!0);else{var a=t[i="$"+i];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[i]={init:!1,get:!1,set:!1};a[n]=!0}}},qu.parseExpression=function(e,t){var r=this.start,i=this.startLoc,s=this.parseMaybeAssign(e,t);if(this.type===nu.comma){var n=this.startNodeAt(r,i);for(n.expressions=[s];this.eat(nu.comma);)n.expressions.push(this.parseMaybeAssign(e,t));return this.finishNode(n,"SequenceExpression")}return s},qu.parseMaybeAssign=function(e,t,r){if(this.isContextual("yield")){if(this.inGenerator)return this.parseYield(e);this.exprAllowed=!1}var i=!1,s=-1,n=-1,a=-1;t?(s=t.parenthesizedAssign,n=t.trailingComma,a=t.doubleProto,t.parenthesizedAssign=t.trailingComma=-1):(t=new Bu,i=!0);var o=this.start,h=this.startLoc;this.type!==nu.parenL&&this.type!==nu.name||(this.potentialArrowAt=this.start,this.potentialArrowInForAwait="await"===e);var u=this.parseMaybeConditional(e,t);if(r&&(u=r.call(this,u,o,h)),this.type.isAssign){var l=this.startNodeAt(o,h);return l.operator=this.value,this.type===nu.eq&&(u=this.toAssignable(u,!1,t)),i||(t.parenthesizedAssign=t.trailingComma=t.doubleProto=-1),t.shorthandAssign>=u.start&&(t.shorthandAssign=-1),this.type===nu.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 i&&this.checkExpressionErrors(t,!0),s>-1&&(t.parenthesizedAssign=s),n>-1&&(t.trailingComma=n),u},qu.parseMaybeConditional=function(e,t){var r=this.start,i=this.startLoc,s=this.parseExprOps(e,t);if(this.checkExpressionErrors(t))return s;if(this.eat(nu.question)){var n=this.startNodeAt(r,i);return n.test=s,n.consequent=this.parseMaybeAssign(),this.expect(nu.colon),n.alternate=this.parseMaybeAssign(e),this.finishNode(n,"ConditionalExpression")}return s},qu.parseExprOps=function(e,t){var r=this.start,i=this.startLoc,s=this.parseMaybeUnary(t,!1,!1,e);return this.checkExpressionErrors(t)||s.start===r&&"ArrowFunctionExpression"===s.type?s:this.parseExprOp(s,r,i,-1,e)},qu.parseExprOp=function(e,t,r,i,s){var n=this.type.binop;if(null!=n&&(!s||this.type!==nu._in)&&n>i){var a=this.type===nu.logicalOR||this.type===nu.logicalAND,o=this.type===nu.coalesce;o&&(n=nu.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,r,e,c,h,a||o);return(a&&this.type===nu.coalesce||o&&(this.type===nu.logicalOR||this.type===nu.logicalAND))&&this.raiseRecoverable(this.start,"Logical expressions and coalesce expressions cannot be mixed. Wrap either by parentheses"),this.parseExprOp(p,t,r,i,s)}return e},qu.buildBinary=function(e,t,r,i,s,n){"PrivateIdentifier"===i.type&&this.raise(i.start,"Private identifier can only be left side of binary expression");var a=this.startNodeAt(e,t);return a.left=r,a.operator=s,a.right=i,this.finishNode(a,n?"LogicalExpression":"BinaryExpression")},qu.parseMaybeUnary=function(e,t,r,i){var s,n=this.start,a=this.startLoc;if(this.isContextual("await")&&this.canAwait)s=this.parseAwait(i),t=!0;else if(this.type.prefix){var o=this.startNode(),h=this.type===nu.incDec;o.operator=this.value,o.prefix=!0,this.next(),o.argument=this.parseMaybeUnary(null,!0,h,i),this.checkExpressionErrors(e,!0),h?this.checkLValSimple(o.argument):this.strict&&"delete"===o.operator&&Hu(o.argument)?this.raiseRecoverable(o.start,"Deleting local variable in strict mode"):"delete"===o.operator&&Xu(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!==nu.privateId){if(s=this.parseExprSubscripts(e,i),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(i||0===this.privateNameStack.length)&&this.options.checkPrivateFields&&this.unexpected(),s=this.parsePrivateIdent(),this.type!==nu._in&&this.unexpected();return r||!this.eat(nu.starstar)?s:t?void this.unexpected(this.lastTokStart):this.buildBinary(n,a,s,this.parseMaybeUnary(null,!1,!1,i),"**",!1)},qu.parseExprSubscripts=function(e,t){var r=this.start,i=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,r,i,!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},qu.parseSubscripts=function(e,t,r,i,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,r,i,n,a,s);if(o.optional&&(a=!0),o===e||"ArrowFunctionExpression"===o.type){if(a){var h=this.startNodeAt(t,r);h.expression=o,o=this.finishNode(h,"ChainExpression")}return o}e=o}},qu.shouldParseAsyncArrow=function(){return!this.canInsertSemicolon()&&this.eat(nu.arrow)},qu.parseSubscriptAsyncArrow=function(e,t,r,i){return this.parseArrowExpression(this.startNodeAt(e,t),r,!0,i)},qu.parseSubscript=function(e,t,r,i,s,n,a){var o=this.options.ecmaVersion>=11,h=o&&this.eat(nu.questionDot);i&&h&&this.raise(this.lastTokStart,"Optional chaining cannot appear in the callee of new expressions");var u=this.eat(nu.bracketL);if(u||h&&this.type!==nu.parenL&&this.type!==nu.backQuote||this.eat(nu.dot)){var l=this.startNodeAt(t,r);l.object=e,u?(l.property=this.parseExpression(),this.expect(nu.bracketR)):this.type===nu.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(!i&&this.eat(nu.parenL)){var c=new Bu,p=this.yieldPos,d=this.awaitPos,f=this.awaitIdentPos;this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0;var g=this.parseExprList(nu.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,r,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,r);m.callee=e,m.arguments=g,o&&(m.optional=h),e=this.finishNode(m,"CallExpression")}else if(this.type===nu.backQuote){(h||n)&&this.raise(this.start,"Optional chaining cannot appear in the tag of tagged template expressions");var y=this.startNodeAt(t,r);y.tag=e,y.quasi=this.parseTemplate({isTagged:!0}),e=this.finishNode(y,"TaggedTemplateExpression")}return e},qu.parseExprAtom=function(e,t,r){this.type===nu.slash&&this.readRegexp();var i,s=this.potentialArrowAt===this.start;switch(this.type){case nu._super:return this.allowSuper||this.raise(this.start,"'super' keyword outside a method"),i=this.startNode(),this.next(),this.type!==nu.parenL||this.allowDirectSuper||this.raise(i.start,"super() call outside constructor of a subclass"),this.type!==nu.dot&&this.type!==nu.bracketL&&this.type!==nu.parenL&&this.unexpected(),this.finishNode(i,"Super");case nu._this:return i=this.startNode(),this.next(),this.finishNode(i,"ThisExpression");case nu.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(nu._function))return this.overrideContext($u.f_expr),this.parseFunction(this.startNodeAt(n,a),0,!1,!0,t);if(s&&!this.canInsertSemicolon()){if(this.eat(nu.arrow))return this.parseArrowExpression(this.startNodeAt(n,a),[h],!1,t);if(this.options.ecmaVersion>=8&&"async"===h.name&&this.type===nu.name&&!o&&(!this.potentialArrowInForAwait||"of"!==this.value||this.containsEsc))return h=this.parseIdent(!1),!this.canInsertSemicolon()&&this.eat(nu.arrow)||this.unexpected(),this.parseArrowExpression(this.startNodeAt(n,a),[h],!0,t)}return h;case nu.regexp:var u=this.value;return(i=this.parseLiteral(u.value)).regex={pattern:u.pattern,flags:u.flags},i;case nu.num:case nu.string:return this.parseLiteral(this.value);case nu._null:case nu._true:case nu._false:return(i=this.startNode()).value=this.type===nu._null?null:this.type===nu._true,i.raw=this.type.keyword,this.next(),this.finishNode(i,"Literal");case nu.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 nu.bracketL:return i=this.startNode(),this.next(),i.elements=this.parseExprList(nu.bracketR,!0,!0,e),this.finishNode(i,"ArrayExpression");case nu.braceL:return this.overrideContext($u.b_expr),this.parseObj(!1,e);case nu._function:return i=this.startNode(),this.next(),this.parseFunction(i,0);case nu._class:return this.parseClass(this.startNode(),!1);case nu._new:return this.parseNew();case nu.backQuote:return this.parseTemplate();case nu._import:return this.options.ecmaVersion>=11?this.parseExprImport(r):this.unexpected();default:return this.parseExprAtomDefault()}},qu.parseExprAtomDefault=function(){this.unexpected()},qu.parseExprImport=function(e){var t=this.startNode();if(this.containsEsc&&this.raiseRecoverable(this.start,"Escape sequence in keyword import"),this.next(),this.type===nu.parenL&&!e)return this.parseDynamicImport(t);if(this.type===nu.dot){var r=this.startNodeAt(t.start,t.loc&&t.loc.start);return r.name="import",t.meta=this.finishNode(r,"Identifier"),this.parseImportMeta(t)}this.unexpected()},qu.parseDynamicImport=function(e){if(this.next(),e.source=this.parseMaybeAssign(),this.options.ecmaVersion>=16)this.eat(nu.parenR)?e.options=null:(this.expect(nu.comma),this.afterTrailingComma(nu.parenR)?e.options=null:(e.options=this.parseMaybeAssign(),this.eat(nu.parenR)||(this.expect(nu.comma),this.afterTrailingComma(nu.parenR)||this.unexpected())));else if(!this.eat(nu.parenR)){var t=this.start;this.eat(nu.comma)&&this.eat(nu.parenR)?this.raiseRecoverable(t,"Trailing comma is not allowed in import()"):this.unexpected(t)}return this.finishNode(e,"ImportExpression")},qu.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")},qu.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")},qu.parseParenExpression=function(){this.expect(nu.parenL);var e=this.parseExpression();return this.expect(nu.parenR),e},qu.shouldParseArrow=function(e){return!this.canInsertSemicolon()},qu.parseParenAndDistinguishExpression=function(e,t){var r,i=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 Bu,d=this.yieldPos,f=this.awaitPos;for(this.yieldPos=0,this.awaitPos=0;this.type!==nu.parenR;){if(l?l=!1:this.expect(nu.comma),n&&this.afterTrailingComma(nu.parenR,!0)){c=!0;break}if(this.type===nu.ellipsis){a=this.start,u.push(this.parseParenItem(this.parseRestBinding())),this.type===nu.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(nu.parenR),e&&this.shouldParseArrow(u)&&this.eat(nu.arrow))return this.checkPatternErrors(p,!1),this.checkYieldAwaitInDefaultParams(),this.yieldPos=d,this.awaitPos=f,this.parseParenArrowList(i,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?((r=this.startNodeAt(o,h)).expressions=u,this.finishNodeAt(r,"SequenceExpression",g,m)):r=u[0]}else r=this.parseParenExpression();if(this.options.preserveParens){var y=this.startNodeAt(i,s);return y.expression=r,this.finishNode(y,"ParenthesizedExpression")}return r},qu.parseParenItem=function(e){return e},qu.parseParenArrowList=function(e,t,r,i){return this.parseArrowExpression(this.startNodeAt(e,t),r,!1,i)};var Yu=[];qu.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===nu.dot){var t=this.startNodeAt(e.start,e.loc&&e.loc.start);t.name="new",e.meta=this.finishNode(t,"Identifier"),this.next();var r=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'"),r&&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 i=this.start,s=this.startLoc;return e.callee=this.parseSubscripts(this.parseExprAtom(null,!1,!0),i,s,!0,!1),this.eat(nu.parenL)?e.arguments=this.parseExprList(nu.parenR,this.options.ecmaVersion>=8,!1):e.arguments=Yu,this.finishNode(e,"NewExpression")},qu.parseTemplateElement=function(e){var t=e.isTagged,r=this.startNode();return this.type===nu.invalidTemplate?(t||this.raiseRecoverable(this.start,"Bad escape sequence in untagged template literal"),r.value={raw:this.value.replace(/\r\n?/g,"\n"),cooked:null}):r.value={raw:this.input.slice(this.start,this.end).replace(/\r\n?/g,"\n"),cooked:this.value},this.next(),r.tail=this.type===nu.backQuote,this.finishNode(r,"TemplateElement")},qu.parseTemplate=function(e){void 0===e&&(e={});var t=e.isTagged;void 0===t&&(t=!1);var r=this.startNode();this.next(),r.expressions=[];var i=this.parseTemplateElement({isTagged:t});for(r.quasis=[i];!i.tail;)this.type===nu.eof&&this.raise(this.pos,"Unterminated template literal"),this.expect(nu.dollarBraceL),r.expressions.push(this.parseExpression()),this.expect(nu.braceR),r.quasis.push(i=this.parseTemplateElement({isTagged:t}));return this.next(),this.finishNode(r,"TemplateLiteral")},qu.isAsyncProp=function(e){return!e.computed&&"Identifier"===e.key.type&&"async"===e.key.name&&(this.type===nu.name||this.type===nu.num||this.type===nu.string||this.type===nu.bracketL||this.type.keyword||this.options.ecmaVersion>=9&&this.type===nu.star)&&!au.test(this.input.slice(this.lastTokEnd,this.start))},qu.parseObj=function(e,t){var r=this.startNode(),i=!0,s={};for(r.properties=[],this.next();!this.eat(nu.braceR);){if(i)i=!1;else if(this.expect(nu.comma),this.options.ecmaVersion>=5&&this.afterTrailingComma(nu.braceR))break;var n=this.parseProperty(e,t);e||this.checkPropClash(n,s,t),r.properties.push(n)}return this.finishNode(r,e?"ObjectPattern":"ObjectExpression")},qu.parseProperty=function(e,t){var r,i,s,n,a=this.startNode();if(this.options.ecmaVersion>=9&&this.eat(nu.ellipsis))return e?(a.argument=this.parseIdent(!1),this.type===nu.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===nu.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||(r=this.eat(nu.star)));var o=this.containsEsc;return this.parsePropertyName(a),!e&&!o&&this.options.ecmaVersion>=8&&!r&&this.isAsyncProp(a)?(i=!0,r=this.options.ecmaVersion>=9&&this.eat(nu.star),this.parsePropertyName(a)):i=!1,this.parsePropertyValue(a,e,r,i,s,n,t,o),this.finishNode(a,"Property")},qu.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 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")},qu.parsePropertyValue=function(e,t,r,i,s,n,a,o){(r||i)&&this.type===nu.colon&&this.unexpected(),this.eat(nu.colon)?(e.value=t?this.parseMaybeDefault(this.start,this.startLoc):this.parseMaybeAssign(!1,a),e.kind="init"):this.options.ecmaVersion>=6&&this.type===nu.parenL?(t&&this.unexpected(),e.kind="init",e.method=!0,e.value=this.parseMethod(r,i)):t||o||!(this.options.ecmaVersion>=5)||e.computed||"Identifier"!==e.key.type||"get"!==e.key.name&&"set"!==e.key.name||this.type===nu.comma||this.type===nu.braceR||this.type===nu.eq?this.options.ecmaVersion>=6&&!e.computed&&"Identifier"===e.key.type?((r||i)&&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===nu.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():((r||i)&&this.unexpected(),this.parseGetterSetter(e))},qu.parsePropertyName=function(e){if(this.options.ecmaVersion>=6){if(this.eat(nu.bracketL))return e.computed=!0,e.key=this.parseMaybeAssign(),this.expect(nu.bracketR),e.key;e.computed=!1}return e.key=this.type===nu.num||this.type===nu.string?this.parseExprAtom():this.parseIdent("never"!==this.options.allowReserved)},qu.initFunction=function(e){e.id=null,this.options.ecmaVersion>=6&&(e.generator=e.expression=!1),this.options.ecmaVersion>=8&&(e.async=!1)},qu.parseMethod=function(e,t,r){var i=this.startNode(),s=this.yieldPos,n=this.awaitPos,a=this.awaitIdentPos;return this.initFunction(i),this.options.ecmaVersion>=6&&(i.generator=e),this.options.ecmaVersion>=8&&(i.async=!!t),this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,this.enterScope(64|Fu(t,i.generator)|(r?128:0)),this.expect(nu.parenL),i.params=this.parseBindingList(nu.parenR,!1,this.options.ecmaVersion>=8),this.checkYieldAwaitInDefaultParams(),this.parseFunctionBody(i,!1,!0,!1),this.yieldPos=s,this.awaitPos=n,this.awaitIdentPos=a,this.finishNode(i,"FunctionExpression")},qu.parseArrowExpression=function(e,t,r,i){var s=this.yieldPos,n=this.awaitPos,a=this.awaitIdentPos;return this.enterScope(16|Fu(r,!1)),this.initFunction(e),this.options.ecmaVersion>=8&&(e.async=!!r),this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,e.params=this.toAssignableList(t,!0),this.parseFunctionBody(e,!0,!1,i),this.yieldPos=s,this.awaitPos=n,this.awaitIdentPos=a,this.finishNode(e,"ArrowFunctionExpression")},qu.parseFunctionBody=function(e,t,r,i){var s=t&&this.type!==nu.braceL,n=this.strict,a=!1;if(s)e.body=this.parseMaybeAssign(i),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&&!r&&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()},qu.isSimpleParamList=function(e){for(var t=0,r=e;t<r.length;t+=1){if("Identifier"!==r[t].type)return!1}return!0},qu.checkParams=function(e,t){for(var r=Object.create(null),i=0,s=e.params;i<s.length;i+=1){var n=s[i];this.checkLValInnerPattern(n,1,t?null:r)}},qu.parseExprList=function(e,t,r,i){for(var s=[],n=!0;!this.eat(e);){if(n)n=!1;else if(this.expect(nu.comma),t&&this.afterTrailingComma(e))break;var a=void 0;r&&this.type===nu.comma?a=null:this.type===nu.ellipsis?(a=this.parseSpread(i),i&&this.type===nu.comma&&i.trailingComma<0&&(i.trailingComma=this.start)):a=this.parseMaybeAssign(!1,i),s.push(a)}return s},qu.checkUnreserved=function(e){var t=e.start,r=e.end,i=e.name;(this.inGenerator&&"yield"===i&&this.raiseRecoverable(t,"Cannot use 'yield' as identifier inside a generator"),this.inAsync&&"await"===i&&this.raiseRecoverable(t,"Cannot use 'await' as identifier inside an async function"),this.currentThisScope().inClassFieldInit&&"arguments"===i&&this.raiseRecoverable(t,"Cannot use 'arguments' in class field initializer"),!this.inClassStaticBlock||"arguments"!==i&&"await"!==i||this.raise(t,"Cannot use "+i+" in class static initialization block"),this.keywords.test(i)&&this.raise(t,"Unexpected keyword '"+i+"'"),this.options.ecmaVersion<6&&-1!==this.input.slice(t,r).indexOf("\\"))||(this.strict?this.reservedWordsStrict:this.reservedWords).test(i)&&(this.inAsync||"await"!==i||this.raiseRecoverable(t,"Cannot use keyword 'await' outside an async function"),this.raiseRecoverable(t,"The keyword '"+i+"' is reserved"))},qu.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},qu.parseIdentNode=function(){var e=this.startNode();return this.type===nu.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=nu.name):this.unexpected(),e},qu.parsePrivateIdent=function(){var e=this.startNode();return this.type===nu.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},qu.parseYield=function(e){this.yieldPos||(this.yieldPos=this.start);var t=this.startNode();return this.next(),this.type===nu.semi||this.canInsertSemicolon()||this.type!==nu.star&&!this.type.startsExpr?(t.delegate=!1,t.argument=null):(t.delegate=this.eat(nu.star),t.argument=this.parseMaybeAssign(e)),this.finishNode(t,"YieldExpression")},qu.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 Zu=Tu.prototype;Zu.raise=function(e,t){var r=Cu(this.input,e);t+=" ("+r.line+":"+r.column+")";var i=new SyntaxError(t);throw i.pos=e,i.loc=r,i.raisedAt=this.pos,i},Zu.raiseRecoverable=Zu.raise,Zu.curPosition=function(){if(this.options.locations)return new _u(this.curLine,this.pos-this.lineStart)};var Ku=Tu.prototype,Ju=function(e){this.flags=e,this.var=[],this.lexical=[],this.functions=[],this.inClassFieldInit=!1};Ku.enterScope=function(e){this.scopeStack.push(new Ju(e))},Ku.exitScope=function(){this.scopeStack.pop()},Ku.treatFunctionsAsVarInScope=function(e){return 2&e.flags||!this.inModule&&1&e.flags},Ku.declareName=function(e,t,r){var i=!1;if(2===t){var s=this.currentScope();i=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();i=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){i=!0;break}if(o.var.push(e),this.inModule&&1&o.flags&&delete this.undefinedExports[e],259&o.flags)break}i&&this.raiseRecoverable(r,"Identifier '"+e+"' has already been declared")},Ku.checkLocalExport=function(e){-1===this.scopeStack[0].lexical.indexOf(e.name)&&-1===this.scopeStack[0].var.indexOf(e.name)&&(this.undefinedExports[e.name]=e)},Ku.currentScope=function(){return this.scopeStack[this.scopeStack.length-1]},Ku.currentVarScope=function(){for(var e=this.scopeStack.length-1;;e--){var t=this.scopeStack[e];if(259&t.flags)return t}},Ku.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 Qu=function(e,t,r){this.type="",this.start=t,this.end=0,e.options.locations&&(this.loc=new wu(e,r)),e.options.directSourceFile&&(this.sourceFile=e.options.directSourceFile),e.options.ranges&&(this.range=[t,0])},el=Tu.prototype;function tl(e,t,r,i){return e.type=t,e.end=r,this.options.locations&&(e.loc.end=i),this.options.ranges&&(e.range[1]=r),e}el.startNode=function(){return new Qu(this,this.start,this.startLoc)},el.startNodeAt=function(e,t){return new Qu(this,e,t)},el.finishNode=function(e,t){return tl.call(this,e,t,this.lastTokEnd,this.lastTokEndLoc)},el.finishNodeAt=function(e,t,r,i){return tl.call(this,e,t,r,i)},el.copyNode=function(e){var t=new Qu(this,e.start,this.startLoc);for(var r in e)t[r]=e[r];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",il=rl+" Extended_Pictographic",sl=il+" EBase EComp EMod EPres ExtPict",nl={9:rl,10:il,11:il,12:sl,13:sl,14:sl},al={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"},ol="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",hl="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",ul=hl+" Dogra Dogr Gunjala_Gondi Gong Hanifi_Rohingya Rohg Makasar Maka Medefaidrin Medf Old_Sogdian Sogo Sogdian Sogd",ll=ul+" Elymaic Elym Nandinagari Nand Nyiakeng_Puachue_Hmong Hmnp Wancho Wcho",cl=ll+" Chorasmian Chrs Diak Dives_Akuru Khitan_Small_Script Kits Yezi Yezidi",pl=cl+" Cypro_Minoan Cpmn Old_Uyghur Ougr Tangsa Tnsa Toto Vithkuqi Vith",dl={9:hl,10:ul,11:ll,12:cl,13:pl,14:pl+" 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"},fl={};function gl(e){var t=fl[e]={binary:xu(nl[e]+" "+ol),binaryOfStrings:xu(al[e]),nonBinary:{General_Category:xu(ol),Script:xu(dl[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 ml=0,yl=[9,10,11,12,13,14];ml<yl.length;ml+=1){gl(yl[ml])}var xl=Tu.prototype,vl=function(e,t){this.parent=e,this.base=t||this};vl.prototype.separatedFrom=function(e){for(var t=this;t;t=t.parent)for(var r=e;r;r=r.parent)if(t.base===r.base&&t!==r)return!0;return!1},vl.prototype.sibling=function(){return new vl(this.parent,this.base)};var bl=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=fl[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 _l(e){return 105===e||109===e||115===e}function wl(e){return 36===e||e>=40&&e<=43||46===e||63===e||e>=91&&e<=94||e>=123&&e<=125}function Cl(e){return e>=65&&e<=90||e>=97&&e<=122}bl.prototype.reset=function(e,t,r){var i=-1!==r.indexOf("v"),s=-1!==r.indexOf("u");this.start=0|e,this.source=t+"",this.flags=r,i&&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)},bl.prototype.raise=function(e){this.parser.raiseRecoverable(this.start,"Invalid regular expression: /"+this.source+"/: "+e)},bl.prototype.at=function(e,t){void 0===t&&(t=!1);var r=this.source,i=r.length;if(e>=i)return-1;var s=r.charCodeAt(e);if(!t&&!this.switchU||s<=55295||s>=57344||e+1>=i)return s;var n=r.charCodeAt(e+1);return n>=56320&&n<=57343?(s<<10)+n-56613888:s},bl.prototype.nextIndex=function(e,t){void 0===t&&(t=!1);var r=this.source,i=r.length;if(e>=i)return i;var s,n=r.charCodeAt(e);return!t&&!this.switchU||n<=55295||n>=57344||e+1>=i||(s=r.charCodeAt(e+1))<56320||s>57343?e+1:e+2},bl.prototype.current=function(e){return void 0===e&&(e=!1),this.at(this.pos,e)},bl.prototype.lookahead=function(e){return void 0===e&&(e=!1),this.at(this.nextIndex(this.pos,e),e)},bl.prototype.advance=function(e){void 0===e&&(e=!1),this.pos=this.nextIndex(this.pos,e)},bl.prototype.eat=function(e,t){return void 0===t&&(t=!1),this.current(t)===e&&(this.advance(t),!0)},bl.prototype.eatChars=function(e,t){void 0===t&&(t=!1);for(var r=this.pos,i=0,s=e;i<s.length;i+=1){var n=s[i],a=this.at(r,t);if(-1===a||a!==n)return!1;r=this.nextIndex(r,t)}return this.pos=r,!0},xl.validateRegExpFlags=function(e){for(var t=e.validFlags,r=e.flags,i=!1,s=!1,n=0;n<r.length;n++){var a=r.charAt(n);-1===t.indexOf(a)&&this.raise(e.start,"Invalid regular expression flag"),r.indexOf(a,n+1)>-1&&this.raise(e.start,"Duplicate regular expression flag"),"u"===a&&(i=!0),"v"===a&&(s=!0)}this.options.ecmaVersion>=15&&i&&s&&this.raise(e.start,"Invalid regular expression flag")},xl.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))},xl.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,r=e.backReferenceNames;t<r.length;t+=1){var i=r[t];e.groupNames[i]||e.raise("Invalid named capture referenced")}},xl.regexp_disjunction=function(e){var t=this.options.ecmaVersion>=16;for(t&&(e.branchID=new vl(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")},xl.regexp_alternative=function(e){for(;e.pos<e.source.length&&this.regexp_eatTerm(e););},xl.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)},xl.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 r=!1;if(this.options.ecmaVersion>=9&&(r=e.eat(60)),e.eat(61)||e.eat(33))return this.regexp_disjunction(e),e.eat(41)||e.raise("Unterminated group"),e.lastAssertionIsQuantifiable=!r,!0}return e.pos=t,!1},xl.regexp_eatQuantifier=function(e,t){return void 0===t&&(t=!1),!!this.regexp_eatQuantifierPrefix(e,t)&&(e.eat(63),!0)},xl.regexp_eatQuantifierPrefix=function(e,t){return e.eat(42)||e.eat(43)||e.eat(63)||this.regexp_eatBracedQuantifier(e,t)},xl.regexp_eatBracedQuantifier=function(e,t){var r=e.pos;if(e.eat(123)){var i=0,s=-1;if(this.regexp_eatDecimalDigits(e)&&(i=e.lastIntValue,e.eat(44)&&this.regexp_eatDecimalDigits(e)&&(s=e.lastIntValue),e.eat(125)))return-1!==s&&s<i&&!t&&e.raise("numbers out of order in {} quantifier"),!0;e.switchU&&!t&&e.raise("Incomplete quantifier"),e.pos=r}return!1},xl.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)},xl.regexp_eatReverseSolidusAtomEscape=function(e){var t=e.pos;if(e.eat(92)){if(this.regexp_eatAtomEscape(e))return!0;e.pos=t}return!1},xl.regexp_eatUncapturingGroup=function(e){var t=e.pos;if(e.eat(40)){if(e.eat(63)){if(this.options.ecmaVersion>=16){var r=this.regexp_eatModifiers(e),i=e.eat(45);if(r||i){for(var s=0;s<r.length;s++){var n=r.charAt(s);r.indexOf(n,s+1)>-1&&e.raise("Duplicate regular expression modifiers")}if(i){var a=this.regexp_eatModifiers(e);r||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||r.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},xl.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},xl.regexp_eatModifiers=function(e){for(var t="",r=0;-1!==(r=e.current())&&_l(r);)t+=vu(r),e.advance();return t},xl.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)},xl.regexp_eatInvalidBracedQuantifier=function(e){return this.regexp_eatBracedQuantifier(e,!0)&&e.raise("Nothing to repeat"),!1},xl.regexp_eatSyntaxCharacter=function(e){var t=e.current();return!!wl(t)&&(e.lastIntValue=t,e.advance(),!0)},xl.regexp_eatPatternCharacters=function(e){for(var t=e.pos,r=0;-1!==(r=e.current())&&!wl(r);)e.advance();return e.pos!==t},xl.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)},xl.regexp_groupSpecifier=function(e){if(e.eat(63)){this.regexp_eatGroupName(e)||e.raise("Invalid group");var t=this.options.ecmaVersion>=16,r=e.groupNames[e.lastStringValue];if(r)if(t)for(var i=0,s=r;i<s.length;i+=1){s[i].separatedFrom(e.branchID)||e.raise("Duplicate capture group name")}else e.raise("Duplicate capture group name");t?(r||(e.groupNames[e.lastStringValue]=[])).push(e.branchID):e.groupNames[e.lastStringValue]=!0}},xl.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},xl.regexp_eatRegExpIdentifierName=function(e){if(e.lastStringValue="",this.regexp_eatRegExpIdentifierStart(e)){for(e.lastStringValue+=vu(e.lastIntValue);this.regexp_eatRegExpIdentifierPart(e);)e.lastStringValue+=vu(e.lastIntValue);return!0}return!1},xl.regexp_eatRegExpIdentifierStart=function(e){var t=e.pos,r=this.options.ecmaVersion>=11,i=e.current(r);return e.advance(r),92===i&&this.regexp_eatRegExpUnicodeEscapeSequence(e,r)&&(i=e.lastIntValue),function(e){return Kh(e,!0)||36===e||95===e}(i)?(e.lastIntValue=i,!0):(e.pos=t,!1)},xl.regexp_eatRegExpIdentifierPart=function(e){var t=e.pos,r=this.options.ecmaVersion>=11,i=e.current(r);return e.advance(r),92===i&&this.regexp_eatRegExpUnicodeEscapeSequence(e,r)&&(i=e.lastIntValue),function(e){return Jh(e,!0)||36===e||95===e||8204===e||8205===e}(i)?(e.lastIntValue=i,!0):(e.pos=t,!1)},xl.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)},xl.regexp_eatBackReference=function(e){var t=e.pos;if(this.regexp_eatDecimalEscape(e)){var r=e.lastIntValue;if(e.switchU)return r>e.maxBackReference&&(e.maxBackReference=r),!0;if(r<=e.numCapturingParens)return!0;e.pos=t}return!1},xl.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},xl.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)},xl.regexp_eatCControlLetter=function(e){var t=e.pos;if(e.eat(99)){if(this.regexp_eatControlLetter(e))return!0;e.pos=t}return!1},xl.regexp_eatZero=function(e){return 48===e.current()&&!Al(e.lookahead())&&(e.lastIntValue=0,e.advance(),!0)},xl.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)},xl.regexp_eatControlLetter=function(e){var t=e.current();return!!Cl(t)&&(e.lastIntValue=t%32,e.advance(),!0)},xl.regexp_eatRegExpUnicodeEscapeSequence=function(e,t){void 0===t&&(t=!1);var r,i=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)&&((r=e.lastIntValue)>=0&&r<=1114111))return!0;s&&e.raise("Invalid unicode escape"),e.pos=i}return!1},xl.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)},xl.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 Dl(e){return Cl(e)||95===e}function El(e){return Dl(e)||Al(e)}function Al(e){return e>=48&&e<=57}function Sl(e){return e>=48&&e<=57||e>=65&&e<=70||e>=97&&e<=102}function Fl(e){return e>=65&&e<=70?e-65+10:e>=97&&e<=102?e-97+10:e-48}function Tl(e){return e>=48&&e<=55}xl.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 r=!1;if(e.switchU&&this.options.ecmaVersion>=9&&((r=80===t)||112===t)){var i;if(e.lastIntValue=-1,e.advance(),e.eat(123)&&(i=this.regexp_eatUnicodePropertyValueExpression(e))&&e.eat(125))return r&&2===i&&e.raise("Invalid property name"),i;e.raise("Invalid property name")}return 0},xl.regexp_eatUnicodePropertyValueExpression=function(e){var t=e.pos;if(this.regexp_eatUnicodePropertyName(e)&&e.eat(61)){var r=e.lastStringValue;if(this.regexp_eatUnicodePropertyValue(e)){var i=e.lastStringValue;return this.regexp_validateUnicodePropertyNameAndValue(e,r,i),1}}if(e.pos=t,this.regexp_eatLoneUnicodePropertyNameOrValue(e)){var s=e.lastStringValue;return this.regexp_validateUnicodePropertyNameOrValue(e,s)}return 0},xl.regexp_validateUnicodePropertyNameAndValue=function(e,t,r){gu(e.unicodeProperties.nonBinary,t)||e.raise("Invalid property name"),e.unicodeProperties.nonBinary[t].test(r)||e.raise("Invalid property value")},xl.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")},xl.regexp_eatUnicodePropertyName=function(e){var t=0;for(e.lastStringValue="";Dl(t=e.current());)e.lastStringValue+=vu(t),e.advance();return""!==e.lastStringValue},xl.regexp_eatUnicodePropertyValue=function(e){var t=0;for(e.lastStringValue="";El(t=e.current());)e.lastStringValue+=vu(t),e.advance();return""!==e.lastStringValue},xl.regexp_eatLoneUnicodePropertyNameOrValue=function(e){return this.regexp_eatUnicodePropertyValue(e)},xl.regexp_eatCharacterClass=function(e){if(e.eat(91)){var t=e.eat(94),r=this.regexp_classContents(e);return e.eat(93)||e.raise("Unterminated character class"),t&&2===r&&e.raise("Negated character class may contain strings"),!0}return!1},xl.regexp_classContents=function(e){return 93===e.current()?1:e.switchV?this.regexp_classSetExpression(e):(this.regexp_nonEmptyClassRanges(e),1)},xl.regexp_nonEmptyClassRanges=function(e){for(;this.regexp_eatClassAtom(e);){var t=e.lastIntValue;if(e.eat(45)&&this.regexp_eatClassAtom(e)){var r=e.lastIntValue;!e.switchU||-1!==t&&-1!==r||e.raise("Invalid character class"),-1!==t&&-1!==r&&t>r&&e.raise("Range out of order in character class")}}},xl.regexp_eatClassAtom=function(e){var t=e.pos;if(e.eat(92)){if(this.regexp_eatClassEscape(e))return!0;if(e.switchU){var r=e.current();(99===r||Tl(r))&&e.raise("Invalid class escape"),e.raise("Invalid escape")}e.pos=t}var i=e.current();return 93!==i&&(e.lastIntValue=i,e.advance(),!0)},xl.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)},xl.regexp_classSetExpression=function(e){var t,r=1;if(this.regexp_eatClassSetRange(e));else if(t=this.regexp_eatClassSetOperand(e)){2===t&&(r=2);for(var i=e.pos;e.eatChars([38,38]);)38!==e.current()&&(t=this.regexp_eatClassSetOperand(e))?2!==t&&(r=1):e.raise("Invalid character in character class");if(i!==e.pos)return r;for(;e.eatChars([45,45]);)this.regexp_eatClassSetOperand(e)||e.raise("Invalid character in character class");if(i!==e.pos)return r}else e.raise("Invalid character in character class");for(;;)if(!this.regexp_eatClassSetRange(e)){if(!(t=this.regexp_eatClassSetOperand(e)))return r;2===t&&(r=2)}},xl.regexp_eatClassSetRange=function(e){var t=e.pos;if(this.regexp_eatClassSetCharacter(e)){var r=e.lastIntValue;if(e.eat(45)&&this.regexp_eatClassSetCharacter(e)){var i=e.lastIntValue;return-1!==r&&-1!==i&&r>i&&e.raise("Range out of order in character class"),!0}e.pos=t}return!1},xl.regexp_eatClassSetOperand=function(e){return this.regexp_eatClassSetCharacter(e)?1:this.regexp_eatClassStringDisjunction(e)||this.regexp_eatNestedClass(e)},xl.regexp_eatNestedClass=function(e){var t=e.pos;if(e.eat(91)){var r=e.eat(94),i=this.regexp_classContents(e);if(e.eat(93))return r&&2===i&&e.raise("Negated character class may contain strings"),i;e.pos=t}if(e.eat(92)){var s=this.regexp_eatCharacterClassEscape(e);if(s)return s;e.pos=t}return null},xl.regexp_eatClassStringDisjunction=function(e){var t=e.pos;if(e.eatChars([92,113])){if(e.eat(123)){var r=this.regexp_classStringDisjunctionContents(e);if(e.eat(125))return r}else e.raise("Invalid escape");e.pos=t}return null},xl.regexp_classStringDisjunctionContents=function(e){for(var t=this.regexp_classString(e);e.eat(124);)2===this.regexp_classString(e)&&(t=2);return t},xl.regexp_classString=function(e){for(var t=0;this.regexp_eatClassSetCharacter(e);)t++;return 1===t?1:2},xl.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 r=e.current();return!(r<0||r===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}(r))&&(!function(e){return 40===e||41===e||45===e||47===e||e>=91&&e<=93||e>=123&&e<=125}(r)&&(e.advance(),e.lastIntValue=r,!0))},xl.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)},xl.regexp_eatClassControlLetter=function(e){var t=e.current();return!(!Al(t)&&95!==t)&&(e.lastIntValue=t%32,e.advance(),!0)},xl.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},xl.regexp_eatDecimalDigits=function(e){var t=e.pos,r=0;for(e.lastIntValue=0;Al(r=e.current());)e.lastIntValue=10*e.lastIntValue+(r-48),e.advance();return e.pos!==t},xl.regexp_eatHexDigits=function(e){var t=e.pos,r=0;for(e.lastIntValue=0;Sl(r=e.current());)e.lastIntValue=16*e.lastIntValue+Fl(r),e.advance();return e.pos!==t},xl.regexp_eatLegacyOctalEscapeSequence=function(e){if(this.regexp_eatOctalDigit(e)){var t=e.lastIntValue;if(this.regexp_eatOctalDigit(e)){var r=e.lastIntValue;t<=3&&this.regexp_eatOctalDigit(e)?e.lastIntValue=64*t+8*r+e.lastIntValue:e.lastIntValue=8*t+r}else e.lastIntValue=t;return!0}return!1},xl.regexp_eatOctalDigit=function(e){var t=e.current();return Tl(t)?(e.lastIntValue=t-48,e.advance(),!0):(e.lastIntValue=0,!1)},xl.regexp_eatFixedHexDigits=function(e,t){var r=e.pos;e.lastIntValue=0;for(var i=0;i<t;++i){var s=e.current();if(!Sl(s))return e.pos=r,!1;e.lastIntValue=16*e.lastIntValue+Fl(s),e.advance()}return!0};var Ml=function(e){this.type=e.type,this.value=e.value,this.start=e.start,this.end=e.end,e.options.locations&&(this.loc=new wu(e,e.startLoc,e.endLoc)),e.options.ranges&&(this.range=[e.start,e.end])},kl=Tu.prototype;function Il(e){return"function"!=typeof BigInt?null:BigInt(e.replace(/_/g,""))}kl.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 Ml(this)),this.lastTokEnd=this.end,this.lastTokStart=this.start,this.lastTokEndLoc=this.endLoc,this.lastTokStartLoc=this.startLoc,this.nextToken()},kl.getToken=function(){return this.next(),new Ml(this)},"undefined"!=typeof Symbol&&(kl[Symbol.iterator]=function(){var e=this;return{next:function(){var t=e.getToken();return{done:t.type===nu.eof,value:t}}}}),kl.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(nu.eof):e.override?e.override(this):void this.readToken(this.fullCharCodeAtPos())},kl.readToken=function(e){return Kh(e,this.options.ecmaVersion>=6)||92===e?this.readWord():this.getTokenFromCode(e)},kl.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},kl.skipBlockComment=function(){var e=this.options.onComment&&this.curPosition(),t=this.pos,r=this.input.indexOf("*/",this.pos+=2);if(-1===r&&this.raise(this.pos-2,"Unterminated comment"),this.pos=r+2,this.options.locations)for(var i=void 0,s=t;(i=uu(this.input,s,this.pos))>-1;)++this.curLine,s=this.lineStart=i;this.options.onComment&&this.options.onComment(!0,this.input.slice(t+2,r),t,this.pos,e,this.curPosition())},kl.skipLineComment=function(e){for(var t=this.pos,r=this.options.onComment&&this.curPosition(),i=this.input.charCodeAt(this.pos+=e);this.pos<this.input.length&&!hu(i);)i=this.input.charCodeAt(++this.pos);this.options.onComment&&this.options.onComment(!1,this.input.slice(t+e,this.pos),t,this.pos,r,this.curPosition())},kl.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&&lu.test(String.fromCharCode(e))))break e;++this.pos}}},kl.finishToken=function(e,t){this.end=this.pos,this.options.locations&&(this.endLoc=this.curPosition());var r=this.type;this.type=e,this.value=t,this.updateContext(r)},kl.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(nu.ellipsis)):(++this.pos,this.finishToken(nu.dot))},kl.readToken_slash=function(){var e=this.input.charCodeAt(this.pos+1);return this.exprAllowed?(++this.pos,this.readRegexp()):61===e?this.finishOp(nu.assign,2):this.finishOp(nu.slash,1)},kl.readToken_mult_modulo_exp=function(e){var t=this.input.charCodeAt(this.pos+1),r=1,i=42===e?nu.star:nu.modulo;return this.options.ecmaVersion>=7&&42===e&&42===t&&(++r,i=nu.starstar,t=this.input.charCodeAt(this.pos+2)),61===t?this.finishOp(nu.assign,r+1):this.finishOp(i,r)},kl.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(nu.assign,3);return this.finishOp(124===e?nu.logicalOR:nu.logicalAND,2)}return 61===t?this.finishOp(nu.assign,2):this.finishOp(124===e?nu.bitwiseOR:nu.bitwiseAND,1)},kl.readToken_caret=function(){return 61===this.input.charCodeAt(this.pos+1)?this.finishOp(nu.assign,2):this.finishOp(nu.bitwiseXOR,1)},kl.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&&!au.test(this.input.slice(this.lastTokEnd,this.pos))?this.finishOp(nu.incDec,2):(this.skipLineComment(3),this.skipSpace(),this.nextToken()):61===t?this.finishOp(nu.assign,2):this.finishOp(nu.plusMin,1)},kl.readToken_lt_gt=function(e){var t=this.input.charCodeAt(this.pos+1),r=1;return t===e?(r=62===e&&62===this.input.charCodeAt(this.pos+2)?3:2,61===this.input.charCodeAt(this.pos+r)?this.finishOp(nu.assign,r+1):this.finishOp(nu.bitShift,r)):33!==t||60!==e||this.inModule||45!==this.input.charCodeAt(this.pos+2)||45!==this.input.charCodeAt(this.pos+3)?(61===t&&(r=2),this.finishOp(nu.relational,r)):(this.skipLineComment(4),this.skipSpace(),this.nextToken())},kl.readToken_eq_excl=function(e){var t=this.input.charCodeAt(this.pos+1);return 61===t?this.finishOp(nu.equality,61===this.input.charCodeAt(this.pos+2)?3:2):61===e&&62===t&&this.options.ecmaVersion>=6?(this.pos+=2,this.finishToken(nu.arrow)):this.finishOp(61===e?nu.eq:nu.prefix,1)},kl.readToken_question=function(){var e=this.options.ecmaVersion;if(e>=11){var t=this.input.charCodeAt(this.pos+1);if(46===t){var r=this.input.charCodeAt(this.pos+2);if(r<48||r>57)return this.finishOp(nu.questionDot,2)}if(63===t){if(e>=12)if(61===this.input.charCodeAt(this.pos+2))return this.finishOp(nu.assign,3);return this.finishOp(nu.coalesce,2)}}return this.finishOp(nu.question,1)},kl.readToken_numberSign=function(){var e=35;if(this.options.ecmaVersion>=13&&(++this.pos,Kh(e=this.fullCharCodeAtPos(),!0)||92===e))return this.finishToken(nu.privateId,this.readWord1());this.raise(this.pos,"Unexpected character '"+vu(e)+"'")},kl.getTokenFromCode=function(e){switch(e){case 46:return this.readToken_dot();case 40:return++this.pos,this.finishToken(nu.parenL);case 41:return++this.pos,this.finishToken(nu.parenR);case 59:return++this.pos,this.finishToken(nu.semi);case 44:return++this.pos,this.finishToken(nu.comma);case 91:return++this.pos,this.finishToken(nu.bracketL);case 93:return++this.pos,this.finishToken(nu.bracketR);case 123:return++this.pos,this.finishToken(nu.braceL);case 125:return++this.pos,this.finishToken(nu.braceR);case 58:return++this.pos,this.finishToken(nu.colon);case 96:if(this.options.ecmaVersion<6)break;return++this.pos,this.finishToken(nu.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(nu.prefix,1);case 35:return this.readToken_numberSign()}this.raise(this.pos,"Unexpected character '"+vu(e)+"'")},kl.finishOp=function(e,t){var r=this.input.slice(this.pos,this.pos+t);return this.pos+=t,this.finishToken(e,r)},kl.readRegexp=function(){for(var e,t,r=this.pos;;){this.pos>=this.input.length&&this.raise(r,"Unterminated regular expression");var i=this.input.charAt(this.pos);if(au.test(i)&&this.raise(r,"Unterminated regular expression"),e)e=!1;else{if("["===i)t=!0;else if("]"===i&&t)t=!1;else if("/"===i&&!t)break;e="\\"===i}++this.pos}var s=this.input.slice(r,this.pos);++this.pos;var n=this.pos,a=this.readWord1();this.containsEsc&&this.unexpected(n);var o=this.regexpState||(this.regexpState=new bl(this));o.reset(r,s,a),this.validateRegExpFlags(o),this.validateRegExpPattern(o);var h=null;try{h=new RegExp(s,a)}catch(e){}return this.finishToken(nu.regexp,{pattern:s,flags:a,value:h})},kl.readInt=function(e,t,r){for(var i=this.options.ecmaVersion>=12&&void 0===t,s=r&&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(i&&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 i&&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},kl.readRadixNumber=function(e){var t=this.pos;this.pos+=2;var r=this.readInt(e);return null==r&&this.raise(this.start+2,"Expected number in radix "+e),this.options.ecmaVersion>=11&&110===this.input.charCodeAt(this.pos)?(r=Il(this.input.slice(t,this.pos)),++this.pos):Kh(this.fullCharCodeAtPos())&&this.raise(this.pos,"Identifier directly after number"),this.finishToken(nu.num,r)},kl.readNumber=function(e){var t=this.pos;e||null!==this.readInt(10,void 0,!0)||this.raise(t,"Invalid number");var r=this.pos-t>=2&&48===this.input.charCodeAt(t);r&&this.strict&&this.raise(t,"Invalid number");var i=this.input.charCodeAt(this.pos);if(!r&&!e&&this.options.ecmaVersion>=11&&110===i){var s=Il(this.input.slice(t,this.pos));return++this.pos,Kh(this.fullCharCodeAtPos())&&this.raise(this.pos,"Identifier directly after number"),this.finishToken(nu.num,s)}r&&/[89]/.test(this.input.slice(t,this.pos))&&(r=!1),46!==i||r||(++this.pos,this.readInt(10),i=this.input.charCodeAt(this.pos)),69!==i&&101!==i||r||(43!==(i=this.input.charCodeAt(++this.pos))&&45!==i||++this.pos,null===this.readInt(10)&&this.raise(t,"Invalid number")),Kh(this.fullCharCodeAtPos())&&this.raise(this.pos,"Identifier directly after number");var n,a=(n=this.input.slice(t,this.pos),r?parseInt(n,8):parseFloat(n.replace(/_/g,"")));return this.finishToken(nu.num,a)},kl.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},kl.readString=function(e){for(var t="",r=++this.pos;;){this.pos>=this.input.length&&this.raise(this.start,"Unterminated string constant");var i=this.input.charCodeAt(this.pos);if(i===e)break;92===i?(t+=this.input.slice(r,this.pos),t+=this.readEscapedChar(!1),r=this.pos):8232===i||8233===i?(this.options.ecmaVersion<10&&this.raise(this.start,"Unterminated string constant"),++this.pos,this.options.locations&&(this.curLine++,this.lineStart=this.pos)):(hu(i)&&this.raise(this.start,"Unterminated string constant"),++this.pos)}return t+=this.input.slice(r,this.pos++),this.finishToken(nu.string,t)};var Bl={};kl.tryReadTemplateToken=function(){this.inTemplateElement=!0;try{this.readTmplToken()}catch(e){if(e!==Bl)throw e;this.readInvalidTemplateToken()}this.inTemplateElement=!1},kl.invalidStringToken=function(e,t){if(this.inTemplateElement&&this.options.ecmaVersion>=9)throw Bl;this.raise(e,t)},kl.readTmplToken=function(){for(var e="",t=this.pos;;){this.pos>=this.input.length&&this.raise(this.start,"Unterminated template");var r=this.input.charCodeAt(this.pos);if(96===r||36===r&&123===this.input.charCodeAt(this.pos+1))return this.pos!==this.start||this.type!==nu.template&&this.type!==nu.invalidTemplate?(e+=this.input.slice(t,this.pos),this.finishToken(nu.template,e)):36===r?(this.pos+=2,this.finishToken(nu.dollarBraceL)):(++this.pos,this.finishToken(nu.backQuote));if(92===r)e+=this.input.slice(t,this.pos),e+=this.readEscapedChar(!0),t=this.pos;else if(hu(r)){switch(e+=this.input.slice(t,this.pos),++this.pos,r){case 13:10===this.input.charCodeAt(this.pos)&&++this.pos;case 10:e+="\n";break;default:e+=String.fromCharCode(r)}this.options.locations&&(++this.curLine,this.lineStart=this.pos),t=this.pos}else++this.pos}},kl.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(nu.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")},kl.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 vu(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 r=this.pos-1;this.invalidStringToken(r,"Invalid escape sequence in template string")}default:if(t>=48&&t<=55){var i=this.input.substr(this.pos-1,3).match(/^[0-7]+/)[0],s=parseInt(i,8);return s>255&&(i=i.slice(0,-1),s=parseInt(i,8)),this.pos+=i.length-1,t=this.input.charCodeAt(this.pos),"0"===i&&56!==t&&57!==t||!this.strict&&!e||this.invalidStringToken(this.pos-1-i.length,e?"Octal literal in template string":"Octal literal in strict mode"),String.fromCharCode(s)}return hu(t)?(this.options.locations&&(this.lineStart=this.pos,++this.curLine),""):String.fromCharCode(t)}},kl.readHexChar=function(e){var t=this.pos,r=this.readInt(16,e);return null===r&&this.invalidStringToken(t,"Bad character escape sequence"),r},kl.readWord1=function(){this.containsEsc=!1;for(var e="",t=!0,r=this.pos,i=this.options.ecmaVersion>=6;this.pos<this.input.length;){var s=this.fullCharCodeAtPos();if(Jh(s,i))this.pos+=s<=65535?1:2;else{if(92!==s)break;this.containsEsc=!0,e+=this.input.slice(r,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?Kh:Jh)(a,i)||this.invalidStringToken(n,"Invalid Unicode escape"),e+=vu(a),r=this.pos}t=!1}return e+this.input.slice(r,this.pos)},kl.readWord=function(){var e=this.readWord1(),t=nu.name;return this.keywords.test(e)&&(t=iu[e]),this.finishToken(t,e)};function Ll(e,t,r){r(e,t)}function Pl(e,t,r){}Tu.acorn={Parser:Tu,version:"8.14.0",defaultOptions:Du,Position:_u,SourceLocation:wu,getLineInfo:Cu,Node:Qu,TokenType:Qh,tokTypes:nu,keywordTypes:iu,TokContext:ju,tokContexts:$u,isIdentifierChar:Jh,isIdentifierStart:Kh,Token:Ml,isNewLine:hu,lineBreak:au,lineBreakG:ou,nonASCIIwhitespace:lu};var Ol={};Ol.Program=Ol.BlockStatement=Ol.StaticBlock=function(e,t,r){for(var i=0,s=e.body;i<s.length;i+=1){r(s[i],t,"Statement")}},Ol.Statement=Ll,Ol.EmptyStatement=Pl,Ol.ExpressionStatement=Ol.ParenthesizedExpression=Ol.ChainExpression=function(e,t,r){return r(e.expression,t,"Expression")},Ol.IfStatement=function(e,t,r){r(e.test,t,"Expression"),r(e.consequent,t,"Statement"),e.alternate&&r(e.alternate,t,"Statement")},Ol.LabeledStatement=function(e,t,r){return r(e.body,t,"Statement")},Ol.BreakStatement=Ol.ContinueStatement=Pl,Ol.WithStatement=function(e,t,r){r(e.object,t,"Expression"),r(e.body,t,"Statement")},Ol.SwitchStatement=function(e,t,r){r(e.discriminant,t,"Expression");for(var i=0,s=e.cases;i<s.length;i+=1){r(s[i],t)}},Ol.SwitchCase=function(e,t,r){e.test&&r(e.test,t,"Expression");for(var i=0,s=e.consequent;i<s.length;i+=1){r(s[i],t,"Statement")}},Ol.ReturnStatement=Ol.YieldExpression=Ol.AwaitExpression=function(e,t,r){e.argument&&r(e.argument,t,"Expression")},Ol.ThrowStatement=Ol.SpreadElement=function(e,t,r){return r(e.argument,t,"Expression")},Ol.TryStatement=function(e,t,r){r(e.block,t,"Statement"),e.handler&&r(e.handler,t),e.finalizer&&r(e.finalizer,t,"Statement")},Ol.CatchClause=function(e,t,r){e.param&&r(e.param,t,"Pattern"),r(e.body,t,"Statement")},Ol.WhileStatement=Ol.DoWhileStatement=function(e,t,r){r(e.test,t,"Expression"),r(e.body,t,"Statement")},Ol.ForStatement=function(e,t,r){e.init&&r(e.init,t,"ForInit"),e.test&&r(e.test,t,"Expression"),e.update&&r(e.update,t,"Expression"),r(e.body,t,"Statement")},Ol.ForInStatement=Ol.ForOfStatement=function(e,t,r){r(e.left,t,"ForInit"),r(e.right,t,"Expression"),r(e.body,t,"Statement")},Ol.ForInit=function(e,t,r){"VariableDeclaration"===e.type?r(e,t):r(e,t,"Expression")},Ol.DebuggerStatement=Pl,Ol.FunctionDeclaration=function(e,t,r){return r(e,t,"Function")},Ol.VariableDeclaration=function(e,t,r){for(var i=0,s=e.declarations;i<s.length;i+=1){r(s[i],t)}},Ol.VariableDeclarator=function(e,t,r){r(e.id,t,"Pattern"),e.init&&r(e.init,t,"Expression")},Ol.Function=function(e,t,r){e.id&&r(e.id,t,"Pattern");for(var i=0,s=e.params;i<s.length;i+=1){r(s[i],t,"Pattern")}r(e.body,t,e.expression?"Expression":"Statement")},Ol.Pattern=function(e,t,r){"Identifier"===e.type?r(e,t,"VariablePattern"):"MemberExpression"===e.type?r(e,t,"MemberPattern"):r(e,t)},Ol.VariablePattern=Pl,Ol.MemberPattern=Ll,Ol.RestElement=function(e,t,r){return r(e.argument,t,"Pattern")},Ol.ArrayPattern=function(e,t,r){for(var i=0,s=e.elements;i<s.length;i+=1){var n=s[i];n&&r(n,t,"Pattern")}},Ol.ObjectPattern=function(e,t,r){for(var i=0,s=e.properties;i<s.length;i+=1){var n=s[i];"Property"===n.type?(n.computed&&r(n.key,t,"Expression"),r(n.value,t,"Pattern")):"RestElement"===n.type&&r(n.argument,t,"Pattern")}},Ol.Expression=Ll,Ol.ThisExpression=Ol.Super=Ol.MetaProperty=Pl,Ol.ArrayExpression=function(e,t,r){for(var i=0,s=e.elements;i<s.length;i+=1){var n=s[i];n&&r(n,t,"Expression")}},Ol.ObjectExpression=function(e,t,r){for(var i=0,s=e.properties;i<s.length;i+=1){r(s[i],t)}},Ol.FunctionExpression=Ol.ArrowFunctionExpression=Ol.FunctionDeclaration,Ol.SequenceExpression=function(e,t,r){for(var i=0,s=e.expressions;i<s.length;i+=1){r(s[i],t,"Expression")}},Ol.TemplateLiteral=function(e,t,r){for(var i=0,s=e.quasis;i<s.length;i+=1){r(s[i],t)}for(var n=0,a=e.expressions;n<a.length;n+=1){r(a[n],t,"Expression")}},Ol.TemplateElement=Pl,Ol.UnaryExpression=Ol.UpdateExpression=function(e,t,r){r(e.argument,t,"Expression")},Ol.BinaryExpression=Ol.LogicalExpression=function(e,t,r){r(e.left,t,"Expression"),r(e.right,t,"Expression")},Ol.AssignmentExpression=Ol.AssignmentPattern=function(e,t,r){r(e.left,t,"Pattern"),r(e.right,t,"Expression")},Ol.ConditionalExpression=function(e,t,r){r(e.test,t,"Expression"),r(e.consequent,t,"Expression"),r(e.alternate,t,"Expression")},Ol.NewExpression=Ol.CallExpression=function(e,t,r){if(r(e.callee,t,"Expression"),e.arguments)for(var i=0,s=e.arguments;i<s.length;i+=1){r(s[i],t,"Expression")}},Ol.MemberExpression=function(e,t,r){r(e.object,t,"Expression"),e.computed&&r(e.property,t,"Expression")},Ol.ExportNamedDeclaration=Ol.ExportDefaultDeclaration=function(e,t,r){e.declaration&&r(e.declaration,t,"ExportNamedDeclaration"===e.type||e.declaration.id?"Statement":"Expression"),e.source&&r(e.source,t,"Expression")},Ol.ExportAllDeclaration=function(e,t,r){e.exported&&r(e.exported,t),r(e.source,t,"Expression")},Ol.ImportDeclaration=function(e,t,r){for(var i=0,s=e.specifiers;i<s.length;i+=1){r(s[i],t)}r(e.source,t,"Expression")},Ol.ImportExpression=function(e,t,r){r(e.source,t,"Expression")},Ol.ImportSpecifier=Ol.ImportDefaultSpecifier=Ol.ImportNamespaceSpecifier=Ol.Identifier=Ol.PrivateIdentifier=Ol.Literal=Pl,Ol.TaggedTemplateExpression=function(e,t,r){r(e.tag,t,"Expression"),r(e.quasi,t,"Expression")},Ol.ClassDeclaration=Ol.ClassExpression=function(e,t,r){return r(e,t,"Class")},Ol.Class=function(e,t,r){e.id&&r(e.id,t,"Pattern"),e.superClass&&r(e.superClass,t,"Expression"),r(e.body,t)},Ol.ClassBody=function(e,t,r){for(var i=0,s=e.body;i<s.length;i+=1){r(s[i],t)}},Ol.MethodDefinition=Ol.PropertyDefinition=Ol.Property=function(e,t,r){e.computed&&r(e.key,t,"Expression"),e.value&&r(e.value,t,"Expression")};var Nl={},Rl={};(function e(t){var r,i,s,n,a,o;function h(e){var t,r,i={};for(t in e)e.hasOwnProperty(t)&&(r=e[t],i[t]="object"==typeof r&&null!==r?h(r):r);return i}function u(e,t){this.parent=e,this.key=t}function l(e,t,r,i){this.node=e,this.path=t,this.wrap=r,this.ref=i}function c(){}function p(e){return null!=e&&"object"==typeof e&&"string"==typeof e.type}function d(e,t){return(e===r.ObjectExpression||e===r.ObjectPattern)&&"properties"===t}function f(e,t){for(var r=e.length-1;r>=0;--r)if(e[r].node===t)return!0;return!1}function g(e,t){return(new c).traverse(e,t)}function m(e,t){var r;return r=function(e,t){var r,i,s,n;for(i=e.length,s=0;i;)t(e[n=s+(r=i>>>1)])?i=r:(s=n+1,i-=r+1);return s}(t,(function(t){return t.range[0]>e.range[0]})),e.extendedRange=[e.range[0],e.range[1]],r!==t.length&&(e.extendedRange[1]=t[r].range[0]),(r-=1)>=0&&(e.extendedRange[0]=t[r].range[1]),e}return r={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"]},i={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,r,i,s;function n(e,t){if(Array.isArray(t))for(r=0,i=t.length;r<i;++r)e.push(t[r]);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,r;for(r=[],e=1,t=this.__leavelist.length;e<t;++e)r.push(this.__leavelist[e].node);return r},c.prototype.current=function(){return this.__current.node},c.prototype.__execute=function(e,t){var r,i;return i=void 0,r=this.__current,this.__current=t,this.__state=null,e&&(i=e.call(this,t.node,this.__leavelist[this.__leavelist.length-1].node)),this.__current=r,i},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 r,i,s,o,h,u,c,g,m,y,x,v;for(this.__initialize(e,t),v={},r=this.__worklist,i=this.__leavelist,r.push(new l(e,null,null,null)),i.push(new l(null,null,null,null));r.length;)if((s=r.pop())!==v){if(s.node){if(u=this.__execute(t.enter,s),this.__state===n||u===n)return;if(r.push(v),i.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(i,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)}r.push(s)}}else if(p(x)){if(f(i,x))continue;r.push(new l(x,c,null,null))}}}else if(s=i.pop(),u=this.__execute(t.leave,s),this.__state===n||u===n)return},c.prototype.replace=function(e,t){var r,i,s,h,c,f,g,m,y,x,v,b,_;function w(e){var t,i,s,n;if(e.ref.remove())for(i=e.ref.key,n=e.ref.parent,t=r.length;t--;)if((s=r[t]).ref&&s.ref.parent===n){if(s.ref.key<i)break;--s.ref.key}}for(this.__initialize(e,t),v={},r=this.__worklist,i=this.__leavelist,f=new l(e,null,null,new u(b={root:e},"root")),r.push(f),i.push(f);r.length;)if((f=r.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)&&(r.push(v),i.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))}r.push(f)}}else p(x)&&r.push(new l(x,_,null,new u(s,_)))}}else if(f=i.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=r,t.traverse=g,t.replace=function(e,t){return(new c).replace(e,t)},t.attachComments=function(e,t,r){var s,n,a,o,u=[];if(!e.range)throw new Error("attachComments needs range information");if(!r.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]),r));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?i.Break:u[o].extendedRange[0]>e.range[1]?i.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?i.Break:u[o].extendedRange[0]>e.range[1]?i.Skip:void 0}}),e},t.VisitorKeys=s,t.VisitorOption=i,t.Controller=c,t.cloneEnvironment=function(){return e({})},t})(Rl);var Vl={},Ul={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}Ul.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 r;if("IfStatement"!==e.type)return!1;if(null==e.alternate)return!1;r=e.consequent;do{if("IfStatement"===r.type&&null==r.alternate)return!0;r=t(r)}while(r);return!1},trailingStatement:t}}();var Gl=Ul.exports,zl={exports:{}};!function(){var e,t,r,i,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]/},r=[5760,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8239,8287,12288,65279],i=new Array(128),n=0;n<128;++n)i[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;zl.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&&r.indexOf(e)>=0},isLineTerminator:function(e){return 10===e||13===e||8232===e||8233===e},isIdentifierStartES5:function(e){return e<128?i[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?i[t]:e.NonAsciiIdentifierStart.test(a(t))},isIdentifierPartES6:function(t){return t<128?s[t]:e.NonAsciiIdentifierPart.test(a(t))}}}();var jl=zl.exports,$l={exports:{}};!function(){var e=jl;function t(e,t){return!(!t&&"yield"===e)&&r(e,t)}function r(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 i(e,r){return"null"===e||"true"===e||"false"===e||t(e,r)}function s(e,t){return"null"===e||"true"===e||"false"===e||r(e,t)}function n(t){var r,i,s;if(0===t.length)return!1;if(s=t.charCodeAt(0),!e.isIdentifierStartES5(s))return!1;for(r=1,i=t.length;r<i;++r)if(s=t.charCodeAt(r),!e.isIdentifierPartES5(s))return!1;return!0}function a(t){var r,i,s,n,a;if(0===t.length)return!1;for(a=e.isIdentifierStartES6,r=0,i=t.length;r<i;++r){if(55296<=(s=t.charCodeAt(r))&&s<=56319){if(++r>=i)return!1;if(!(56320<=(n=t.charCodeAt(r))&&n<=57343))return!1;s=1024*(s-55296)+(n-56320)+65536}if(!a(s))return!1;a=e.isIdentifierPartES6}return!0}$l.exports={isKeywordES5:t,isKeywordES6:r,isReservedWordES5:i,isReservedWordES6:s,isRestrictedWord:function(e){return"eval"===e||"arguments"===e},isIdentifierNameES5:n,isIdentifierNameES6:a,isIdentifierES5:function(e,t){return n(e)&&!i(e,t)},isIdentifierES6:function(e,t){return a(e)&&!s(e,t)}}}();var Wl=$l.exports;Vl.ast=Gl,Vl.code=jl,Vl.keyword=Wl;var ql,Hl,Xl={},Yl={},Zl={},Kl={};function Jl(){if(ql)return Kl;ql=1;var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split("");return Kl.encode=function(t){if(0<=t&&t<e.length)return e[t];throw new TypeError("Must be between 0 and 63: "+t)},Kl.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},Kl}function Ql(){if(Hl)return Zl;Hl=1;var e=Jl();return Zl.encode=function(t){var r,i="",s=function(e){return e<0?1+(-e<<1):0+(e<<1)}(t);do{r=31&s,(s>>>=5)>0&&(r|=32),i+=e.encode(r)}while(s>0);return i},Zl.decode=function(t,r,i){var s,n,a,o,h=t.length,u=0,l=0;do{if(r>=h)throw new Error("Expected more digits in base 64 VLQ value.");if(-1===(n=e.decode(t.charCodeAt(r++))))throw new Error("Invalid base64 digit: "+t.charAt(r-1));s=!!(32&n),u+=(n&=31)<<l,l+=5}while(s);i.value=(o=(a=u)>>1,1&~a?o:-o),i.rest=r},Zl}var ec,tc={};function rc(){return ec||(ec=1,function(e){e.getArg=function(e,t,r){if(t in e)return e[t];if(3===arguments.length)return r;throw new Error('"'+t+'" is a required argument.')};var t=/^(?:([\w+\-.]+):)?\/\/(?:(\w+:\w+)@)?([\w.-]*)(?::(\d+))?(.*)$/,r=/^data:.+\,.+$/;function i(e){var r=e.match(t);return r?{scheme:r[1],auth:r[2],host:r[3],port:r[4],path:r[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 r=t,n=i(t);if(n){if(!n.path)return t;r=n.path}for(var a,o=e.isAbsolute(r),h=r.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""===(r=h.join("/"))&&(r=o?"/":"."),n?(n.path=r,s(n)):r}function a(e,t){""===e&&(e="."),""===t&&(t=".");var a=i(t),o=i(e);if(o&&(e=o.path||"/"),a&&!a.scheme)return o&&(a.scheme=o.scheme),s(a);if(a||t.match(r))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=i,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 r=0;0!==t.indexOf(e+"/");){var i=e.lastIndexOf("/");if(i<0)return t;if((e=e.slice(0,i)).match(/^([^\/]+:\/)?\/*$/))return t;++r}return Array(r+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 r=t-10;r>=0;r--)if(36!==e.charCodeAt(r))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,r){var i=l(e.source,t.source);return 0!==i||0!==(i=e.originalLine-t.originalLine)||0!==(i=e.originalColumn-t.originalColumn)||r||0!==(i=e.generatedColumn-t.generatedColumn)||0!==(i=e.generatedLine-t.generatedLine)?i:l(e.name,t.name)},e.compareByGeneratedPositionsDeflated=function(e,t,r){var i=e.generatedLine-t.generatedLine;return 0!==i||0!==(i=e.generatedColumn-t.generatedColumn)||r||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.compareByGeneratedPositionsInflated=function(e,t){var r=e.generatedLine-t.generatedLine;return 0!==r||0!==(r=e.generatedColumn-t.generatedColumn)||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.parseSourceMapInput=function(e){return JSON.parse(e.replace(/^\)]}'[^\n]*\n/,""))},e.computeSourceURL=function(e,t,r){if(t=t||"",e&&("/"!==e[e.length-1]&&"/"!==t[0]&&(e+="/"),t=e+t),r){var o=i(r);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)}}(tc)),tc}var ic,sc={};function nc(){if(ic)return sc;ic=1;var e=rc(),t=Object.prototype.hasOwnProperty,r="undefined"!=typeof Map;function i(){this._array=[],this._set=r?new Map:Object.create(null)}return i.fromArray=function(e,t){for(var r=new i,s=0,n=e.length;s<n;s++)r.add(e[s],t);return r},i.prototype.size=function(){return r?this._set.size:Object.getOwnPropertyNames(this._set).length},i.prototype.add=function(i,s){var n=r?i:e.toSetString(i),a=r?this.has(i):t.call(this._set,n),o=this._array.length;a&&!s||this._array.push(i),a||(r?this._set.set(i,o):this._set[n]=o)},i.prototype.has=function(i){if(r)return this._set.has(i);var s=e.toSetString(i);return t.call(this._set,s)},i.prototype.indexOf=function(i){if(r){var s=this._set.get(i);if(s>=0)return s}else{var n=e.toSetString(i);if(t.call(this._set,n))return this._set[n]}throw new Error('"'+i+'" is not in the set.')},i.prototype.at=function(e){if(e>=0&&e<this._array.length)return this._array[e];throw new Error("No element indexed by "+e)},i.prototype.toArray=function(){return this._array.slice()},sc.ArraySet=i,sc}var ac,oc,hc={};function uc(){if(ac)return hc;ac=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 r,i,s,n,a,o;r=this._last,i=t,s=r.generatedLine,n=i.generatedLine,a=r.generatedColumn,o=i.generatedColumn,n>s||n==s&&o>=a||e.compareByGeneratedPositionsInflated(r,i)<=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},hc.MappingList=t,hc}function lc(){if(oc)return Yl;oc=1;var e=Ql(),t=rc(),r=nc().ArraySet,i=uc().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 r,this._names=new r,this._mappings=new i,this._sourcesContents=null}return s.prototype._version=3,s.fromSourceMap=function(e){var r=e.sourceRoot,i=new s({file:e.file,sourceRoot:r});return e.eachMapping((function(e){var s={generated:{line:e.generatedLine,column:e.generatedColumn}};null!=e.source&&(s.source=e.source,null!=r&&(s.source=t.relative(r,s.source)),s.original={line:e.originalLine,column:e.originalColumn},null!=e.name&&(s.name=e.name)),i.addMapping(s)})),e.sources.forEach((function(s){var n=s;null!==r&&(n=t.relative(r,s)),i._sources.has(n)||i._sources.add(n);var a=e.sourceContentFor(s);null!=a&&i.setSourceContent(s,a)})),i},s.prototype.addMapping=function(e){var r=t.getArg(e,"generated"),i=t.getArg(e,"original",null),s=t.getArg(e,"source",null),n=t.getArg(e,"name",null);this._skipValidation||this._validateMapping(r,i,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:r.line,generatedColumn:r.column,originalLine:null!=i&&i.line,originalColumn:null!=i&&i.column,source:s,name:n})},s.prototype.setSourceContent=function(e,r){var i=e;null!=this._sourceRoot&&(i=t.relative(this._sourceRoot,i)),null!=r?(this._sourcesContents||(this._sourcesContents=Object.create(null)),this._sourcesContents[t.toSetString(i)]=r):this._sourcesContents&&(delete this._sourcesContents[t.toSetString(i)],0===Object.keys(this._sourcesContents).length&&(this._sourcesContents=null))},s.prototype.applySourceMap=function(e,i,s){var n=i;if(null==i){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 r,h=new r;this._mappings.unsortedForEach((function(r){if(r.source===n&&null!=r.originalLine){var i=e.originalPositionFor({line:r.originalLine,column:r.originalColumn});null!=i.source&&(r.source=i.source,null!=s&&(r.source=t.join(s,r.source)),null!=a&&(r.source=t.relative(a,r.source)),r.originalLine=i.line,r.originalColumn=i.column,null!=i.name&&(r.name=i.name))}var u=r.source;null==u||o.has(u)||o.add(u);var l=r.name;null==l||h.has(l)||h.add(l)}),this),this._sources=o,this._names=h,e.sources.forEach((function(r){var i=e.sourceContentFor(r);null!=i&&(null!=s&&(r=t.join(s,r)),null!=a&&(r=t.relative(a,r)),this.setSourceContent(r,i))}),this)},s.prototype._validateMapping=function(e,t,r,i){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||r||i)&&!(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&&r))throw new Error("Invalid mapping: "+JSON.stringify({generated:e,source:r,original:t,name:i}))},s.prototype._serializeMappings=function(){for(var r,i,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(r="",(i=d[f]).generatedLine!==o)for(a=0;i.generatedLine!==o;)r+=";",o++;else if(f>0){if(!t.compareByGeneratedPositionsInflated(i,d[f-1]))continue;r+=","}r+=e.encode(i.generatedColumn-a),a=i.generatedColumn,null!=i.source&&(n=this._sources.indexOf(i.source),r+=e.encode(n-c),c=n,r+=e.encode(i.originalLine-1-u),u=i.originalLine-1,r+=e.encode(i.originalColumn-h),h=i.originalColumn,null!=i.name&&(s=this._names.indexOf(i.name),r+=e.encode(s-l),l=s)),p+=r}return p},s.prototype._generateSourcesContent=function(e,r){return e.map((function(e){if(!this._sourcesContents)return null;null!=r&&(e=t.relative(r,e));var i=t.toSetString(e);return Object.prototype.hasOwnProperty.call(this._sourcesContents,i)?this._sourcesContents[i]: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())},Yl.SourceMapGenerator=s,Yl}var cc,pc={},dc={};function fc(){return cc||(cc=1,function(e){function t(r,i,s,n,a,o){var h=Math.floor((i-r)/2)+r,u=a(s,n[h],!0);return 0===u?h:u>0?i-h>1?t(h,i,s,n,a,o):o==e.LEAST_UPPER_BOUND?i<n.length?i:-1:h:h-r>1?t(r,h,s,n,a,o):o==e.LEAST_UPPER_BOUND?h:r<0?-1:r}e.GREATEST_LOWER_BOUND=1,e.LEAST_UPPER_BOUND=2,e.search=function(r,i,s,n){if(0===i.length)return-1;var a=t(-1,i.length,r,i,s,n||e.GREATEST_LOWER_BOUND);if(a<0)return-1;for(;a-1>=0&&0===s(i[a],i[a-1],!0);)--a;return a}}(dc)),dc}var gc,mc,yc={};function xc(){if(gc)return yc;function e(e,t,r){var i=e[t];e[t]=e[r],e[r]=i}function t(r,i,s,n){if(s<n){var a=s-1;e(r,(l=s,c=n,Math.round(l+Math.random()*(c-l))),n);for(var o=r[n],h=s;h<n;h++)i(r[h],o)<=0&&e(r,a+=1,h);e(r,a+1,h);var u=a+1;t(r,i,s,u-1),t(r,i,u+1,n)}var l,c}return gc=1,yc.quickSort=function(e,r){t(e,r,0,e.length-1)},yc}var vc,bc,_c={};function wc(){return bc||(bc=1,Xl.SourceMapGenerator=lc().SourceMapGenerator,Xl.SourceMapConsumer=function(){if(mc)return pc;mc=1;var e=rc(),t=fc(),r=nc().ArraySet,i=Ql(),s=xc().quickSort;function n(t,r){var i=t;return"string"==typeof t&&(i=e.parseSourceMapInput(t)),null!=i.sections?new h(i,r):new a(i,r)}function a(t,i){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=r.fromArray(o.map(String),!0),this._sources=r.fromArray(a,!0),this._absoluteSources=this._sources.toArray().map((function(t){return e.computeSourceURL(h,t,i)})),this.sourceRoot=h,this.sourcesContent=u,this._mappings=l,this._sourceMapURL=i,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,i){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 r,this._names=new r;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 r=e.getArg(t,"offset"),s=e.getArg(r,"line"),a=e.getArg(r,"column");if(s<h.line||s===h.line&&a<h.column)throw new Error("Section offsets must be ordered and non-overlapping.");return h=r,{generatedOffset:{generatedLine:s+1,generatedColumn:a+1},consumer:new n(e.getArg(t,"map"),i)}}))}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 r=e.charAt(t);return";"===r||","===r},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,r,i){var s,a=r||null;switch(i||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 r=null===t.source?null:this._sources.at(t.source);return{source:r=e.computeSourceURL(o,r,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(r){var i=e.getArg(r,"line"),s={source:e.getArg(r,"source"),originalLine:i,originalColumn:e.getArg(r,"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===r.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===i&&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},pc.SourceMapConsumer=n,a.prototype=Object.create(n.prototype),a.prototype.consumer=n,a.prototype._findSourceIndex=function(t){var r,i=t;if(null!=this.sourceRoot&&(i=e.relative(this.sourceRoot,i)),this._sources.has(i))return this._sources.indexOf(i);for(r=0;r<this._absoluteSources.length;++r)if(this._absoluteSources[r]==t)return r;return-1},a.fromSourceMap=function(t,i){var n=Object.create(a.prototype),h=n._names=r.fromArray(t._names.toArray(),!0),u=n._sources=r.fromArray(t._sources.toArray(),!0);n.sourceRoot=t._sourceRoot,n.sourcesContent=t._generateSourcesContent(n._sources.toArray(),n.sourceRoot),n.file=t._file,n._sourceMapURL=i,n._absoluteSources=n._sources.toArray().map((function(t){return e.computeSourceURL(n.sourceRoot,t,i)}));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,r){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;)i.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,r,i,s,n,a){if(e[i]<=0)throw new TypeError("Line must be greater than or equal to 1, got "+e[i]);if(e[s]<0)throw new TypeError("Column must be greater than or equal to 0, got "+e[s]);return t.search(e,r,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 r=this._generatedMappings[e+1];if(t.generatedLine===r.generatedLine){t.lastGeneratedColumn=r.generatedColumn-1;continue}}t.lastGeneratedColumn=1/0}},a.prototype.originalPositionFor=function(t){var r={generatedLine:e.getArg(t,"line"),generatedColumn:e.getArg(t,"column")},i=this._findMapping(r,this._generatedMappings,"generatedLine","generatedColumn",e.compareByGeneratedPositionsDeflated,e.getArg(t,"bias",n.GREATEST_LOWER_BOUND));if(i>=0){var s=this._generatedMappings[i];if(s.generatedLine===r.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,r){if(!this.sourcesContent)return null;var i=this._findSourceIndex(t);if(i>=0)return this.sourcesContent[i];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(r)return null;throw new Error('"'+n+'" is not in the SourceMap.')},a.prototype.generatedPositionFor=function(t){var r=e.getArg(t,"source");if((r=this._findSourceIndex(r))<0)return{line:null,column:null,lastColumn:null};var i={source:r,originalLine:e.getArg(t,"line"),originalColumn:e.getArg(t,"column")},s=this._findMapping(i,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===i.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}},pc.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 r=0;r<this._sections[t].consumer.sources.length;r++)e.push(this._sections[t].consumer.sources[r]);return e}}),h.prototype.originalPositionFor=function(r){var i={generatedLine:e.getArg(r,"line"),generatedColumn:e.getArg(r,"column")},s=t.search(i,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:i.generatedLine-(n.generatedOffset.generatedLine-1),column:i.generatedColumn-(n.generatedOffset.generatedLine===i.generatedLine?n.generatedOffset.generatedColumn-1:0),bias:r.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 r=0;r<this._sections.length;r++){var i=this._sections[r].consumer.sourceContentFor(e,!0);if(i)return i}if(t)return null;throw new Error('"'+e+'" is not in the SourceMap.')},h.prototype.generatedPositionFor=function(t){for(var r=0;r<this._sections.length;r++){var i=this._sections[r];if(-1!==i.consumer._findSourceIndex(e.getArg(t,"source"))){var s=i.consumer.generatedPositionFor(t);if(s)return{line:s.line+(i.generatedOffset.generatedLine-1),column:s.column+(i.generatedOffset.generatedLine===s.line?i.generatedOffset.generatedColumn-1:0)}}}return{line:null,column:null}},h.prototype._parseMappings=function(t,r){this.__generatedMappings=[],this.__originalMappings=[];for(var i=0;i<this._sections.length;i++)for(var n=this._sections[i],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)},pc.IndexedSourceMapConsumer=h,pc}().SourceMapConsumer,Xl.SourceNode=function(){if(vc)return _c;vc=1;var e=lc().SourceMapGenerator,t=rc(),r=/(\r?\n)/,i="$$$isSourceNode$$$";function s(e,t,r,s,n){this.children=[],this.sourceContents={},this.line=null==e?null:e,this.column=null==t?null:t,this.source=null==r?null:r,this.name=null==n?null:n,this[i]=!0,null!=s&&this.add(s)}return s.fromStringWithSourceMap=function(e,i,n){var a=new s,o=e.split(r),h=0,u=function(){return e()+(e()||"");function e(){return h<o.length?o[h++]:void 0}},l=1,c=0,p=null;return i.eachMapping((function(e){if(null!==p){if(!(l<e.generatedLine)){var t=(r=o[h]||"").substr(0,e.generatedColumn-c);return o[h]=r.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 r=o[h]||"";a.add(r.substr(0,e.generatedColumn)),o[h]=r.substr(e.generatedColumn),c=e.generatedColumn}p=e}),this),h<o.length&&(p&&d(p,u()),a.add(o.splice(h).join(""))),i.sources.forEach((function(e){var r=i.sourceContentFor(e);null!=r&&(null!=n&&(e=t.join(n,e)),a.setSourceContent(e,r))})),a;function d(e,r){if(null===e||void 0===e.source)a.add(r);else{var i=n?t.join(n,e.source):e.source;a.add(new s(e.originalLine,e.originalColumn,i,r,e.name))}}},s.prototype.add=function(e){if(Array.isArray(e))e.forEach((function(e){this.add(e)}),this);else{if(!e[i]&&"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[i]&&"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,r=0,s=this.children.length;r<s;r++)(t=this.children[r])[i]?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,r,i=this.children.length;if(i>0){for(t=[],r=0;r<i-1;r++)t.push(this.children[r]),t.push(e);t.push(this.children[r]),this.children=t}return this},s.prototype.replaceRight=function(e,t){var r=this.children[this.children.length-1];return r[i]?r.replaceRight(e,t):"string"==typeof r?this.children[this.children.length-1]=r.replace(e,t):this.children.push("".replace(e,t)),this},s.prototype.setSourceContent=function(e,r){this.sourceContents[t.toSetString(e)]=r},s.prototype.walkSourceContents=function(e){for(var r=0,s=this.children.length;r<s;r++)this.children[r][i]&&this.children[r].walkSourceContents(e);var n=Object.keys(this.sourceContents);for(r=0,s=n.length;r<s;r++)e(t.fromSetString(n[r]),this.sourceContents[n[r]])},s.prototype.toString=function(){var e="";return this.walk((function(t){e+=t})),e},s.prototype.toStringWithSourceMap=function(t){var r={code:"",line:1,column:0},i=new e(t),s=!1,n=null,a=null,o=null,h=null;return this.walk((function(e,t){r.code+=e,null!==t.source&&null!==t.line&&null!==t.column?(n===t.source&&a===t.line&&o===t.column&&h===t.name||i.addMapping({source:t.source,original:{line:t.line,column:t.column},generated:{line:r.line,column:r.column},name:t.name}),n=t.source,a=t.line,o=t.column,h=t.name,s=!0):s&&(i.addMapping({generated:{line:r.line,column:r.column}}),n=null,s=!1);for(var u=0,l=e.length;u<l;u++)10===e.charCodeAt(u)?(r.line++,r.column=0,u+1===l?(n=null,s=!1):s&&i.addMapping({source:t.source,original:{line:t.line,column:t.column},generated:{line:r.line,column:r.column},name:t.name})):r.column++})),this.walkSourceContents((function(e,t){i.setSourceContent(e,t)})),{code:r.code,map:i}},_c.SourceNode=s,_c}().SourceNode),Xl}var Cc="2.1.0";!function(e){!function(){var t,r,i,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=Vl,t=(n=Rl).Syntax,i={"??":(r={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,"||":r.LogicalOR,"&&":r.LogicalAND,"|":r.BitwiseOR,"^":r.BitwiseXOR,"&":r.BitwiseAND,"==":r.Equality,"!=":r.Equality,"===":r.Equality,"!==":r.Equality,is:r.Equality,isnt:r.Equality,"<":r.Relational,">":r.Relational,"<=":r.Relational,">=":r.Relational,in:r.Relational,instanceof:r.Relational,"<<":r.BitwiseSHIFT,">>":r.BitwiseSHIFT,">>>":r.BitwiseSHIFT,"+":r.Additive,"-":r.Additive,"*":r.Multiplicative,"%":r.Multiplicative,"/":r.Multiplicative,"**":r.Exponentiation};var F=32,T=33;function M(e,t){var r="";for(t|=0;t>0;t>>>=1,e+=e)1&t&&(r+=e);return r}function k(e){var t=e.length;return t&&a.code.isLineTerminator(e.charCodeAt(t-1))}function I(e,t){var r;for(r in t)t.hasOwnProperty(r)&&(e[r]=t[r]);return e}function B(e,t){var r,i;function s(e){return"object"==typeof e&&e instanceof Object&&!(e instanceof RegExp)}for(r in t)t.hasOwnProperty(r)&&(s(i=t[r])?s(e[r])?B(e[r],i):e[r]=B({},i):e[r]=i);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 r;return 8===e?"\\b":12===e?"\\f":9===e?"\\t":(r=e.toString(16).toUpperCase(),u||e>255?"\\u"+"0000".slice(r.length)+r:0!==e||a.code.isDecimalDigit(t)?11===e?"\\x0B":"\\x"+"00".slice(r.length)+r:"\\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,r,i,s="";for(t=0,r=e.length;t<r;++t)i=e[t],s+=Array.isArray(i)?N(i):i;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 r,i,s,n;return 0===(r=R(e).toString()).length?[t]:0===(i=R(t).toString()).length?[e]:(s=r.charCodeAt(r.length-1),n=i.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 r="//"+e.value;return D||(r+="\n"),r}return b.format.indent.adjustMultilineComment&&/[\n\r]/.test(e.value)?function(e,t){var r,i,s,n,h,u,l,c;for(r=e.split(/\r\n|[\r\n]/),u=Number.MAX_VALUE,i=1,s=r.length;i<s;++i){for(n=r[i],h=0;h<n.length&&a.code.isWhiteSpace(n.charCodeAt(h));)++h;u>h&&(u=h)}for(void 0!==t?(l=o,"*"===r[1][u]&&(t+=" "),o=t):(1&u&&--u,l=o),i=1,s=r.length;i<s;++i)c=R(G(r[i].slice(u))),r[i]=w?c.join(""):c;return o=l,r.join("\n")}("/*"+e.value+"*/",t):"/*"+e.value+"*/"}function $(e,r){var i,s,n,u,l,c,p,d,f,g,m,y;if(e.leadingComments&&e.leadingComments.length>0){if(u=r,D){for(r=[],d=(n=e.leadingComments[0]).extendedRange,f=n.range,(y=((m=C.substring(d[0],f[0])).match(/\n/g)||[]).length)>0?(r.push(M("\n",y)),r.push(G(j(n)))):(r.push(m),r.push(j(n))),g=f,i=1,s=e.leadingComments.length;i<s;i++)f=(n=e.leadingComments[i]).range,y=(C.substring(g[1],f[0]).match(/\n/g)||[]).length,r.push(M("\n",y)),r.push(G(j(n))),g=f;y=(C.substring(f[1],d[1]).match(/\n/g)||[]).length,r.push(M("\n",y))}else for(n=e.leadingComments[0],r=[],x&&e.type===t.Program&&0===e.body.length&&r.push("\n"),r.push(j(n)),k(R(r).toString())||r.push("\n"),i=1,s=e.leadingComments.length;i<s;++i)k(R(p=[j(n=e.leadingComments[i])]).toString())||p.push("\n"),r.push(G(p));r.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?(r.push(M("\n",y)),r.push(G(j(n)))):(r.push(m),r.push(j(n)));else for(l=!k(R(r).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,r,h]).toString())),i=0,s=e.trailingComments.length;i<s;++i)n=e.trailingComments[i],l?(r=0===i?[r,h]:[r,c]).push(j(n,c)):r=[r,G(j(n))],i===s-1||k(R(r).toString())||(r=[r,"\n"]);return r}function W(e,t,r){var i,s=0;for(i=e;i<t;i++)"\n"===C[i]&&s++;for(i=1;i<s;i++)r.push(f)}function q(e,t,r){return t<r?["(",e,")"]:e}function H(e){var t,r,i;for(t=1,r=(i=e.split(/\r\n|\n/)).length;t<r;t++)i[t]=f+o+i[t];return i}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,r="";return t.async&&(r+=Z(t,!e.computed)),t.generator&&(r+=K(t)?"*":""),r}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,r.Sequence,7);throw new Error("Unknown node type: "+e.type)}X.prototype.maybeBlock=function(e,r){var i,s,n=this;return s=!b.comment||!e.leadingComments,e.type===t.BlockStatement&&s?[g,this.generateStatement(e,r)]:e.type===t.EmptyStatement&&s?";":(z((function(){i=[f,G(n.generateStatement(e,r))]})),i)},X.prototype.maybeBlockSuffix=function(e,r){var i=k(R(r).toString());return e.type!==t.BlockStatement||b.comment&&e.leadingComments||i?i?[r,o]:[r,f,o]:[r,g]},X.prototype.generatePattern=function(e,r,i){return e.type===t.Identifier?Y(e):this.generateExpression(e,r,i)},X.prototype.generateFunctionParams=function(e){var i,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),i=0,s=e.params.length;i<s;++i)a&&e.defaults[i]?n.push(this.generateAssignment(e.params[i],e.defaults[i],"=",r.Assignment,7)):n.push(this.generatePattern(e.params[i],r.Assignment,7)),i+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 i,s;return i=this.generateFunctionParams(e),e.type===t.ArrowFunctionExpression&&(i.push(g),i.push("=>")),e.expression?(i.push(g),"{"===(s=this.generateExpression(e.body,r.Assignment,7)).toString().charAt(0)&&(s=["(",s,")"]),i.push(s)):i.push(this.maybeBlock(e.body,9)),i},X.prototype.generateIterationForStatement=function(e,i,s){var n=["for"+(i.await?V()+"await":"")+g+"("],a=this;return z((function(){i.left.type===t.VariableDeclaration?z((function(){n.push(i.left.kind+V()),n.push(a.generateStatement(i.left.declarations[0],0))})):n.push(a.generateExpression(i.left,r.Call,7)),n=U(n,e),n=[U(n,a.generateExpression(i.right,r.Assignment,7)),")"]})),n.push(this.maybeBlock(i.body,s)),n},X.prototype.generatePropertyKey=function(e,t){var i=[];return t&&i.push("["),i.push(this.generateExpression(e,r.Assignment,7)),t&&i.push("]"),i},X.prototype.generateAssignment=function(e,t,i,s,n){return r.Assignment<s&&(n|=1),q([this.generateExpression(e,r.Call,n),g+i+g,this.generateExpression(t,r.Assignment,n)],r.Assignment,s)},X.prototype.semicolon=function(e){return!y&&e&F?"":";"},X.Statement={BlockStatement:function(e,t){var r,i,s=["{",f],n=this;return z((function(){var a,o,h,u;for(0===e.body.length&&D&&(r=e.range)[1]-r[0]>2&&("\n"===(i=C.substring(r[0]+1,r[1]-1))[0]&&(s=["{"]),s.push(i)),u=1,8&t&&(u|=16),a=0,o=e.body.length;a<o;++a)D&&(0===a&&(e.body[0].leadingComments&&(r=e.body[0].leadingComments[0].extendedRange,"\n"===(i=C.substring(r[0],r[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 i=["{",f],s=this;return z((function(t){var n,a;for(n=0,a=e.body.length;n<a;++n)i.push(t),i.push(s.generateExpression(e.body[n],r.Sequence,7)),n+1<a&&i.push(f)})),k(R(i).toString())||i.push(f),i.push(o),i.push("}"),i},ClassDeclaration:function(e,t){var i,s;return i=["class"],e.id&&(i=U(i,this.generateExpression(e.id,r.Sequence,7))),e.superClass&&(s=U("extends",this.generateExpression(e.superClass,r.Unary,7)),i=U(i,s)),i.push(g),i.push(this.generateStatement(e.body,T)),i},DirectiveStatement:function(e,t){return b.raw&&e.raw?e.raw+this.semicolon(t):function(e){var t,r,i,s;for(s="double"===p?'"':"'",t=0,r=e.length;t<r;++t){if(39===(i=e.charCodeAt(t))){s='"';break}if(34===i){s="'";break}92===i&&++t}return s+e+s}(e.directive)+this.semicolon(t)},DoWhileStatement:function(e,t){var i=U("do",this.maybeBlock(e.body,1));return U(i=this.maybeBlockSuffix(e.body,i),["while"+g+"(",this.generateExpression(e.test,r.Sequence,7),")"+this.semicolon(t)])},CatchClause:function(e,t){var i,s=this;return z((function(){var t;e.param?(i=["catch"+g+"(",s.generateExpression(e.param,r.Sequence,7),")"],e.guard&&(t=s.generateExpression(e.guard,r.Sequence,7),i.splice(2,0," if ",t))):i=["catch"]})),i.push(this.maybeBlock(e.body,1)),i},DebuggerStatement:function(e,t){return"debugger"+this.semicolon(t)},EmptyStatement:function(e,t){return";"},ExportDefaultDeclaration:function(e,t){var i,s=["export"];return i=t&F?T:1,s=U(s,"default"),s=S(e.declaration)?U(s,this.generateStatement(e.declaration,i)):U(s,this.generateExpression(e.declaration,r.Assignment,7)+this.semicolon(t))},ExportNamedDeclaration:function(e,i){var s,n=["export"],a=this;return s=i&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],r.Sequence,7)):(n=U(n,"{"),z((function(t){var i,s;for(n.push(f),i=0,s=e.specifiers.length;i<s;++i)n.push(t),n.push(a.generateExpression(e.specifiers[i],r.Sequence,7)),i+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,r.Sequence,7),this.semicolon(i)]):n.push(this.semicolon(i))),n)},ExportAllDeclaration:function(e,t){return["export"+g,"*"+g,"from"+g,this.generateExpression(e.source,r.Sequence,7),this.semicolon(t)]},ExpressionStatement:function(e,i){var s,n;return 123===(n=R(s=[this.generateExpression(e.expression,r.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,r,i;if("async"!==e.slice(0,5))return!1;if(!a.code.isWhiteSpace(e.charCodeAt(5)))return!1;for(r=6,i=e.length;r<i&&a.code.isWhiteSpace(e.charCodeAt(r));++r);return r!==i&&("function"===e.slice(r,r+8)&&(40===(t=e.charCodeAt(r+8))||a.code.isWhiteSpace(t)||42===t||a.code.isLineTerminator(t)))}(n)||v&&16&i&&e.expression.type===t.Literal&&"string"==typeof e.expression.value?s=["(",s,")"+this.semicolon(i)]:s.push(this.semicolon(i)),s},ImportDeclaration:function(e,i){var s,n,a=this;return 0===e.specifiers.length?["import",g,this.generateExpression(e.source,r.Sequence,7),this.semicolon(i)]:(s=["import"],n=0,e.specifiers[n].type===t.ImportDefaultSpecifier&&(s=U(s,[this.generateExpression(e.specifiers[n],r.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],r.Sequence,7)]):(s.push(g+"{"),e.specifiers.length-n==1?(s.push(g),s.push(this.generateExpression(e.specifiers[n],r.Sequence,7)),s.push(g+"}"+g)):(z((function(t){var i,o;for(s.push(f),i=n,o=e.specifiers.length;i<o;++i)s.push(t),s.push(a.generateExpression(e.specifiers[i],r.Sequence,7)),i+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,r.Sequence,7),this.semicolon(i)]))},VariableDeclarator:function(e,t){var i=1&t?7:6;return e.init?[this.generateExpression(e.id,r.Assignment,i),g,"=",g,this.generateExpression(e.init,r.Assignment,i)]:this.generatePattern(e.id,r.Assignment,i)},VariableDeclaration:function(e,t){var r,i,s,n,a,o=this;function h(){for(n=e.declarations[0],b.comment&&n.leadingComments?(r.push("\n"),r.push(G(o.generateStatement(n,a)))):(r.push(V()),r.push(o.generateStatement(n,a))),i=1,s=e.declarations.length;i<s;++i)n=e.declarations[i],b.comment&&n.leadingComments?(r.push(","+f),r.push(G(o.generateStatement(n,a)))):(r.push(","+g),r.push(o.generateStatement(n,a)))}return r=[e.kind],a=1&t?1:0,e.declarations.length>1?z(h):h(),r.push(this.semicolon(t)),r},ThrowStatement:function(e,t){return[U("throw",this.generateExpression(e.argument,r.Sequence,7)),this.semicolon(t)]},TryStatement:function(e,t){var r,i,s,n;if(r=["try",this.maybeBlock(e.block,1)],r=this.maybeBlockSuffix(e.block,r),e.handlers)for(i=0,s=e.handlers.length;i<s;++i)r=U(r,this.generateStatement(e.handlers[i],1)),(e.finalizer||i+1!==s)&&(r=this.maybeBlockSuffix(e.handlers[i].body,r));else{for(i=0,s=(n=e.guardedHandlers||[]).length;i<s;++i)r=U(r,this.generateStatement(n[i],1)),(e.finalizer||i+1!==s)&&(r=this.maybeBlockSuffix(n[i].body,r));if(e.handler)if(Array.isArray(e.handler))for(i=0,s=e.handler.length;i<s;++i)r=U(r,this.generateStatement(e.handler[i],1)),(e.finalizer||i+1!==s)&&(r=this.maybeBlockSuffix(e.handler[i].body,r));else r=U(r,this.generateStatement(e.handler,1)),e.finalizer&&(r=this.maybeBlockSuffix(e.handler.body,r))}return e.finalizer&&(r=U(r,["finally",this.maybeBlock(e.finalizer,1)])),r},SwitchStatement:function(e,t){var i,s,n,a,o,h=this;if(z((function(){i=["switch"+g+"(",h.generateExpression(e.discriminant,r.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)),i.push(s),k(R(s).toString())||i.push(f);return i.push(G("}")),i},SwitchCase:function(e,i){var s,n,a,o,h,u=this;return z((function(){for(s=e.test?[U("case",u.generateExpression(e.test,r.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&&i&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,i){var s,n,a=this;return z((function(){s=["if"+g+"(",a.generateExpression(e.test,r.Sequence,7),")"]})),n=1,i&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,i){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,r.Sequence,6)),s.push(";")):s.push(";"),e.test?(s.push(g),s.push(n.generateExpression(e.test,r.Sequence,7)),s.push(";")):s.push(";"),e.update?(s.push(g),s.push(n.generateExpression(e.update,r.Sequence,7)),s.push(")")):s.push(")")})),s.push(this.maybeBlock(e.body,i&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 r,i,s,n,a;for(n=e.body.length,r=[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],r)),s>0&&(e.body[s-1].trailingComments||e.body[s].leadingComments||W(e.body[s-1].range[1],e.body[s].range[0],r))),i=G(this.generateStatement(e.body[s],a)),r.push(i),s+1<n&&!k(R(i).toString())&&(D&&e.body[s+1].leadingComments||r.push(f)),D&&s===n-1&&(e.body[s].trailingComments||W(e.body[s].range[1],e.range[1],r));return r},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,r.Sequence,7)),this.semicolon(t)]:["return"+this.semicolon(t)]},WhileStatement:function(e,t){var i,s=this;return z((function(){i=["while"+g+"(",s.generateExpression(e.test,r.Sequence,7),")"]})),i.push(this.maybeBlock(e.body,t&F?T:1)),i},WithStatement:function(e,t){var i,s=this;return z((function(){i=["with"+g+"(",s.generateExpression(e.object,r.Sequence,7),")"]})),i.push(this.maybeBlock(e.body,t&F?T:1)),i}},I(X.prototype,X.Statement),X.Expression={SequenceExpression:function(e,t,i){var s,n,a;for(r.Sequence<t&&(i|=1),s=[],n=0,a=e.expressions.length;n<a;++n)s.push(this.generateExpression(e.expressions[n],r.Assignment,i)),n+1<a&&s.push(","+g);return q(s,r.Sequence,t)},AssignmentExpression:function(e,t,r){return this.generateAssignment(e.left,e.right,e.operator,t,r)},ArrowFunctionExpression:function(e,t,i){return q(this.generateFunctionBody(e),r.ArrowFunction,t)},ConditionalExpression:function(e,t,i){return r.Conditional<t&&(i|=1),q([this.generateExpression(e.test,r.Coalesce,i),g+"?"+g,this.generateExpression(e.consequent,r.Assignment,i),g+":"+g,this.generateExpression(e.alternate,r.Assignment,i)],r.Conditional,t)},LogicalExpression:function(e,t,r){return"??"===e.operator&&(r|=64),this.BinaryExpression(e,t,r)},BinaryExpression:function(e,t,s){var n,o,h,u,l,c;return u=i[e.operator],o="**"===e.operator?r.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,i){var s,n,a;for(s=[this.generateExpression(e.callee,r.Call,3)],e.optional&&s.push("?."),s.push("("),n=0,a=e.arguments.length;n<a;++n)s.push(this.generateExpression(e.arguments[n],r.Assignment,7)),n+1<a&&s.push(","+g);return s.push(")"),2&i?q(s,r.Call,t):["(",s,")"]},ChainExpression:function(e,t,i){return r.OptionalChaining<t&&(i|=2),q(this.generateExpression(e.expression,r.OptionalChaining,i),r.OptionalChaining,t)},NewExpression:function(e,t,i){var s,n,a,o,h;if(n=e.arguments.length,h=4&i&&!m&&0===n?5:1,s=U("new",this.generateExpression(e.callee,r.New,h)),!(4&i)||m||n>0){for(s.push("("),a=0,o=n;a<o;++a)s.push(this.generateExpression(e.arguments[a],r.Assignment,7)),a+1<o&&s.push(","+g);s.push(")")}return q(s,r.New,t)},MemberExpression:function(e,i,s){var n,o;return n=[this.generateExpression(e.object,r.Call,2&s?3:1)],e.computed?(e.optional&&n.push("?."),n.push("["),n.push(this.generateExpression(e.property,r.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,r.Member,i)},MetaProperty:function(e,t,i){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,r.Member,t)},UnaryExpression:function(e,t,i){var s,n,o,h,u;return n=this.generateExpression(e.argument,r.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,r.Unary,t)},YieldExpression:function(e,t,i){var s;return s=e.delegate?"yield*":"yield",e.argument&&(s=U(s,this.generateExpression(e.argument,r.Yield,7))),q(s,r.Yield,t)},AwaitExpression:function(e,t,i){return q(U(e.all?"await*":"await",this.generateExpression(e.argument,r.Await,7)),r.Await,t)},UpdateExpression:function(e,t,i){return e.prefix?q([e.operator,this.generateExpression(e.argument,r.Unary,7)],r.Unary,t):q([this.generateExpression(e.argument,r.Postfix,7),e.operator],r.Postfix,t)},FunctionExpression:function(e,t,r){var i=[Z(e,!0),"function"];return e.id?(i.push(K(e)||V()),i.push(Y(e.id))):i.push(K(e)||g),i.push(this.generateFunctionBody(e)),i},ArrayPattern:function(e,t,r){return this.ArrayExpression(e,t,r,!0)},ArrayExpression:function(e,t,i,s){var n,a,h=this;return e.elements.length?(a=!s&&e.elements.length>1,n=["[",a?f:""],z((function(t){var i,s;for(i=0,s=e.elements.length;i<s;++i)e.elements[i]?(n.push(a?t:""),n.push(h.generateExpression(e.elements[i],r.Assignment,7))):(a&&n.push(t),i+1===s&&n.push(",")),i+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,r){return"..."+this.generatePattern(e.argument)},ClassExpression:function(e,t,i){var s,n;return s=["class"],e.id&&(s=U(s,this.generateExpression(e.id,r.Sequence,7))),e.superClass&&(n=U("extends",this.generateExpression(e.superClass,r.Unary,7)),s=U(s,n)),s.push(g),s.push(this.generateStatement(e.body,T)),s},MethodDefinition:function(e,t,r){var i,s;return i=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(i,s)},Property:function(e,t,i){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,r.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,r.Assignment,7)]},ObjectExpression:function(e,t,i){var s,n,a,h,u=this;return e.properties.length?(s=e.properties.length>1,z((function(){a=u.generateExpression(e.properties[0],r.Sequence,7)})),s||(h=R(a).toString(),/[\r\n]/g.test(h))?(z((function(t){var i,o;if(n=["{",f,t,a],s)for(n.push(","+f),i=1,o=e.properties.length;i<o;++i)n.push(t),n.push(u.generateExpression(e.properties[i],r.Sequence,7)),i+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,r){return this.generateAssignment(e.left,e.right,"=",t,r)},ObjectPattern:function(e,i,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 i,s;for(i=0,s=e.properties.length;i<s;++i)n.push(u?t:""),n.push(c.generateExpression(e.properties[i],r.Sequence,7)),i+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,r){return"this"},Super:function(e,t,r){return"super"},Identifier:function(e,t,r){return Y(e)},ImportDefaultSpecifier:function(e,t,r){return Y(e.id||e.local)},ImportNamespaceSpecifier:function(e,t,r){var i=["*"],s=e.id||e.local;return s&&i.push(g+"as"+V()+Y(s)),i},ImportSpecifier:function(e,t,r){var i=e.imported,s=[i.name],n=e.local;return n&&n.name!==i.name&&s.push(V()+"as"+V()+Y(n)),s},ExportSpecifier:function(e,t,r){var i=e.local,s=[i.name],n=e.exported;return n&&n.name!==i.name&&s.push(V()+"as"+V()+Y(n)),s},Literal:function(e,r,i){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,r,i,s,n,o="",h=0,l=0;for(t=0,r=e.length;t<r;++t){if(39===(i=e.charCodeAt(t)))++h;else if(34===i)++l;else if(47===i&&u)o+="\\";else{if(a.code.isLineTerminator(i)||92===i){o+=O(i);continue}if(!a.code.isIdentifierPartES5(i)&&(u&&i<32||!u&&!d&&(i<32||i>126))){o+=P(i,e.charCodeAt(t+1));continue}}o+=String.fromCharCode(i)}if(n=(s=!("double"===p||"auto"===p&&l<h))?"'":'"',!(s?h:l))return n+o+n;for(e=o,o=n,t=0,r=e.length;t<r;++t)(39===(i=e.charCodeAt(t))&&s||34===i&&!s)&&(o+="\\"),o+=String.fromCharCode(i);return o+n}(e.value):"number"==typeof e.value?function(e){var t,r,i,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(r=t.indexOf("."),u||48!==t.charCodeAt(0)||1!==r||(r=0,t=t.slice(1)),i=t,t=t.replace("e+","e"),s=0,(n=i.indexOf("e"))>0&&(s=+i.slice(n+1),i=i.slice(0,n)),r>=0&&(s-=i.length-r-1,i=+(i.slice(0,r)+i.slice(r+1))+""),n=0;48===i.charCodeAt(i.length+n-1);)--n;return 0!==n&&(s-=n,i=i.slice(0,n)),0!==s&&(i+="e"+s),(i.length<t.length||c&&e>1e12&&Math.floor(e)===e&&(i="0x"+e.toString(16)).length<t.length)&&+i===e&&(t=i),t}(e.value):"boolean"==typeof e.value?e.value?"true":"false":function(e){var t,r,i,s,n,a,o,h;if(r=e.toString(),e.source){if(!(t=r.match(/\/([^/]*)$/)))return r;for(i=t[1],r="",o=!1,h=!1,s=0,n=e.source.length;s<n;++s)a=e.source.charCodeAt(s),h?(r+=L(a,h),h=!1):(o?93===a&&(o=!1):47===a?r+="\\":91===a&&(o=!0),r+=L(a,h),h=92===a);return"/"+r+"/"+i}return r}(e.value)},GeneratorExpression:function(e,t,r){return this.ComprehensionExpression(e,t,r)},ComprehensionExpression:function(e,i,s){var n,a,o,h,u=this;return n=e.type===t.GeneratorExpression?["("]:["["],b.moz.comprehensionExpressionStartsWithAssignment&&(h=this.generateExpression(e.body,r.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],r.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,r.Sequence,7),n=U(n,["(",h,")"])),b.moz.comprehensionExpressionStartsWithAssignment||(h=this.generateExpression(e.body,r.Assignment,7),n=U(n,h)),n.push(e.type===t.GeneratorExpression?")":"]"),n},ComprehensionBlock:function(e,i,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,r.Call,7),e.of?"of":"in"),n=U(n,this.generateExpression(e.right,r.Sequence,7)),["for"+g+"(",n,")"]},SpreadElement:function(e,t,i){return["...",this.generateExpression(e.argument,r.Assignment,7)]},TaggedTemplateExpression:function(e,t,i){var s=3;return 2&i||(s=1),q([this.generateExpression(e.tag,r.Call,s),this.generateExpression(e.quasi,r.Primary,4)],r.TaggedTemplate,t)},TemplateElement:function(e,t,r){return e.value.raw},TemplateLiteral:function(e,t,i){var s,n,a;for(s=["`"],n=0,a=e.quasis.length;n<a;++n)s.push(this.generateExpression(e.quasis[n],r.Primary,7)),n+1<a&&(s.push("${"+g),s.push(this.generateExpression(e.expressions[n],r.Sequence,7)),s.push(g+"}"));return s.push("`"),s},ModuleSpecifier:function(e,t,r){return this.Literal(e,t,r)},ImportExpression:function(e,t,i){return q(["import(",this.generateExpression(e.source,r.Assignment,7),")"],r.Call,t)}},I(X.prototype,X.Expression),X.prototype.generateExpression=function(e,i,s){var n,a;return a=e.type||t.Property,b.verbatim&&e.hasOwnProperty(b.verbatim)?function(e,t){var i;return R("string"==typeof(i=e[b.verbatim])?q(H(i),r.Sequence,t):q(H(i.content),null!=i.precedence?i.precedence:r.Sequence,t),e)}(e,i):(n=this[a](e,i,s),b.comment&&(n=$(e,n)),R(n,e))},X.prototype.generateStatement=function(e,r){var i,s;return i=this[e.type](e,r),b.comment&&(i=$(e,i)),s=R(i).toString(),e.type!==t.Program||x||""!==f||"\n"!==s.charAt(s.length-1)||(i=w?R(i).replaceRight(/\s+$/,""):s.replace(/\s+$/,"")),R(i,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=Cc,e.generate=function(t,r){var i,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!=r?("string"==typeof r.indent&&(a.format.indent.style=r.indent),"number"==typeof r.base&&(a.format.indent.base=r.base),r=B(a,r),h=r.format.indent.style,o="string"==typeof r.base?r.base:M(h,r.format.indent.base)):(h=(r=a).format.indent.style,o=M(h,r.format.indent.base)),u=r.format.json,l=r.format.renumber,c=!u&&r.format.hexadecimal,p=u?"double":r.format.quotes,d=r.format.escapeless,f=r.format.newline,g=r.format.space,r.format.compact&&(f=g=h=o=""),m=r.format.parentheses,y=r.format.semicolons,x=r.format.safeConcatenation,v=r.directive,_=u?null:r.parse,w=r.sourceMap,C=r.sourceCode,D=r.format.preserveBlankLines&&null!==C,b=r,w&&(s=e.browser?Ni.sourceMap.SourceNode:wc().SourceNode),i=Q(t),w?(n=i.toStringWithSourceMap({file:r.file,sourceRoot:r.sourceMapRoot}),r.sourceContent&&n.map.setSourceContent(r.sourceMap,r.sourceContent),r.sourceMapWithCode?n:n.map.toString()):(n={code:i.toString(),map:null},r.sourceMapWithCode?n:n.code)},e.attachComments=n.attachComments,e.Precedence=B({},r),e.browser=!1,e.FORMAT_MINIFY=E,e.FORMAT_DEFAULTS=A}()}(Nl);var Dc=Ri(Nl);function Ec(e,t){let r,i;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 Tu.parse(e,t)}(e.toString(),{ecmaVersion:2021,locations:t.srcLocations});r=o,a=[],(i=void 0)||(i=Ol),function e(t,s,n){var o=n||t.type,h=t!==a[a.length-1];h&&a.push(t),i[o](t,s,e),r[o]&&r[o](t,s||a,a),h&&a.pop()}(s,{varyings:{}},n);const u=Dc.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 r,i,n,a};const o={UnaryExpression(e,t,r){if(r.some(a))return;const i={type:"Literal",value:e.operator},s=e=>{e.type="CallExpression",e.callee={type:"Identifier",name:"unaryNode"},e.arguments=[e.argument,i]};if("MemberExpression"===e.type){const t=e.argument.property.name;let r=[["x","y","z","w"],["r","g","b","a"],["s","t","p","q"]].some((e=>[...t].every((t=>e.includes(t)))))&&"MemberExpression"===e.argument.type;r?(e.type="MemberExpression",e.object={type:"CallExpression",callee:{type:"Identifier",name:"unaryNode"},arguments:[e.argument.object,i]},e.property={type:"Identifier",name:t}):s(e)}else s(e);delete e.argument,delete e.operator},VariableDeclarator(e,t,r){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 r={type:"Literal",value:e.id.name};e.init.arguments.unshift(r),t.varyings[e.id.name]=r}},Identifier(e,t,r){t.varyings[e.name]&&!r.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,r){const i=JSON.parse(JSON.stringify(e));e.type="CallExpression",e.callee={type:"Identifier",name:"dynamicNode"},e.arguments=[i]},AssignmentExpression(e,t,r){if("="!==e.operator){const t=n(e.operator.replace("=","")),r={type:"CallExpression",callee:{type:"MemberExpression",object:e.left,property:{type:"Identifier",name:t}},arguments:[e.right]};e.operator="=",e.right=r}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,r){if(r.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===r.srcLocations&&!1===e)try{throw new Error("StackCapture")}catch(e){const t=e.stack.split("\n");let r=5;T(this)&&r--,this.srcLine=t[r].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 r=new f(t,e,"float",!0);Object.defineProperty(this,e,{get:()=>r,set(e){this.componentsChanged=!0,L(this)?this.node.value=e:r=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 r=()=>t.usedInSatisfied.length>=1,i=()=>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),i()&&r()&&t.saveState(e,i(),r()))}))}toGLSLBase(e){let t;if(this.shouldUseTemporaryVariable()){let r=e.declarations.length;t=this.getTemporaryVariable(e);let i=e.declarations.length-1-r;i=i>0?i:void 0,this.dependsOn.forEach((t=>{if(t.isVector){const r=t.originalComponents.map(((e,r)=>e===t.currentComponents[r]));e.updateComponents(t.node,i,r)}else e.updateComponents(t.node,i)}))}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,r=!1){if(super(t,"float"),Array.isArray(e)&&(e=e[0]),r){const{parent:e,name:t}=r;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,r=!1){super(r,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,r)=>{const i={name:t,parent:this};let s=S(e[r])?e[r]:new l(e[r],!0,i);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,i)}})})),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,r)=>this.originalValues[r].toGLSLBase(e))).join(", ");return this.defined=!0,`${this.type}(${t})`}}}class p extends h{constructor(e,t,r,i=!1){let s;const n=e=>{let r,i=0;const s=t.every(((t,s)=>{const n=C(t);let a=e.args[s];return"genType"===a&&((void 0===r||"float"===r&&n.startsWith("vec"))&&(r=n),a=r),i+=n===a,n===a||"float"===n&&a.startsWith("vec")}));return{...e,valid:s,similarity:i,genType:r}};if(Array.isArray(r)){let i=r.filter((e=>e.args.length===t.length));if(0===i.length){const i=new Set,s=[];r.forEach((e=>i.add(e.args.length))),i.forEach((e=>s.push(`${e}`)));const n=s.join(" or ");throw new Error(`Function '${e}' has ${r.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=i.reduce(a,null)}else s=n(r);if(!s||!s.valid){const i=e=>`(${e.map((e=>e)).join(", ")})`,s=Array.isArray(r)?r.map((e=>i(e.args))).join(" or "):i(r.args),n=i(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 r="genType"===s.args[t]?s.genType:s.args[t];e=$[r](e)}return e})),"genType"===s.returnType&&(s.returnType=s.genType),super(i,s.returnType),this.name=e,this.args=t,this.argumentTypes=s.args}deconstructArgs(e){let t=this.args.map(((t,r)=>(E(t)&&"float"!=this.argumentTypes[r]&&(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,r=!1){super(r,t),this.name=e}toGLSL(e){return`${this.name}`}}class f extends h{constructor(e,t,r,i=!1){super(i,r),this.parent=e,this.componentName=t,this.type=r}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,r=!1){super(e,t,r),this.timesChanged=0,this.tempVars=0}getValue(){const e=r.context;if(!e.varyings[this.name]||!this.timesChanged)return this;let t,i=e.varyings[this.name].splice(0,this.timesChanged);return i.forEach(((r,s)=>{let{value:n}=r;if(e.declarations.push(` ${this.name} = ${n.toGLSLBase(e)};`),s===i.length-1){const r=`${this.name}_${this.tempVars++}`;t=U(new d(r,this.type,!0)),e.declarations.push(` ${this.type} ${r} = ${this.name};`)}})),this.timesChanged=0,t}bridge(e){(!D(e)||this.type.startsWith("vec")&&"float"===C(e))&&(e=$[this.type](e)),r.registerVarying(this,e),this.timesChanged+=1}}class m extends h{constructor(e,t,r,i=!1){super(i,null),this.operator=r,this.left=e,this.right=t;for(const r of[e,t])r.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 r=e.toGLSLBase(t);return T(e)&&!e.temporaryVariable&&(r=`(${r})`),"float"===this.type&&E(e)&&(r=`float(${r})`),r}toGLSL(e){const t=this.processOperand(this.left,e),r=this.processOperand(this.right,e);return`${t} ${this.operator} ${r}`}}class y extends m{constructor(e,t,r){super(e,t,r)}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,r=!1){super(r,e.type),this.node=e,this.operator=t}toGLSL(e){let t=this.node.toGLSLBase(e);var r;return M(this.node)||I(this.node)||((r=this.node)instanceof l||r instanceof u||r instanceof c)||(t=`(${t})`),`${this.operator}${t}`}}function v(e){const t=new _;return e(),i=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,r.context.ifs.push(this)}if(e,t){this.condition=e,this.conditionString=e.toGLSL(r.context),this.ifBranch=v(t),this.ifBranch.parent=this}elseIf(e,t){let r=v(t);return t.parent=this,this.elseIfs.push({condition:e,elseBranch:r}),this}else(e){return this.elseBranch=v(e),this.elseBranch.parent=this,this}thenDiscard(){return new w(this.condition)}saveState(e,t,r){this.states.push({line:e.declarations.length,usedInSatisfied:t,dependsOnSatisfied:r}),this.insertionPoint=e.declarations.length-1}toGLSL(e){const t=e.declarations.length;this.dependsOn.forEach((t=>e.updateComponents(t.node)));const r=e.declarations.length-t;this.insertionPoint+=r;let i=[`\n if (${this.conditionString}) {`,`\n ${this.ifBranch.toGLSL(e)}`,"\n }"];return this.elseIfs.length&&this.elseIfs.forEach((t=>{let{condition:r,elseBranch:s}=t;i.push(` else if (${r.toGLSL(e)}) {`),i.push(`\n ${s.toGLSL(e)}`),i.push("\n }")})),this.elseBranch&&(i.push(" else {"),i.push(`\n ${this.elseBranch.toGLSL(e)}`),i.push("\n }\n")),i.push("\n"),i.flat().join("")}}t.assign=function(e,t){if(!i)throw new error('assign() is supposed to be used inside of conditional branchs. Use the "=" operator as normal otherwise.');i.assign(e,t)};class _{constructor(){i=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:r,value:i})=>{let s,n;if(i)n=i.toGLSLBase(e);else{let r=this.declarations[t];t++,r.temporaryVariable=`temp_${e.getNextID()}`,this.statements.push(`${r.type} ${r.temporaryVariable} = ${r.toGLSL(e)};`),n=r.toGLSLBase(e)}M(r)||I(r)?s=`${r.toGLSLBase(e)} = ${n};`:S(r)&&r.name?s=`${r.parent.toGLSLBase(e)}.${r.name} = ${n};`:(r.temporaryVariable=`temp_${e.getNextID()}`,s=`${r.type} ${r.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,i){r=this,this.userCallback=e,this.srcLocations=i,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},i={};Object.keys(t).forEach((t=>{const s=e.hookTypes(t);this[s.name]=function(e){const r=[],i=[];s.parameters.forEach((e=>{if(P(e.type.typeName))r.push(z(e.name,e.type.typeName,!0));else{const t={};e.type.properties.forEach((r=>{t[r.name]=z(`${e.name}.${r.name}`,r.type.typeName,!0)})),r.push(t)}const t=e.type.qualifiers.length>0?e.type.qualifiers.join(" "):"";i.push(`${t} ${e.type.typeName} ${e.name}`.trim())}));let n=e(...r);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=[`(${i.join(", ")}) {`,...this.context.declarations,`\n ${s.returnType.typeName} finalReturnValue;`];Object.entries(o).forEach((([e,t])=>{const r=a.properties?`.${e}`:"";h.push(` finalReturnValue${r} = ${t};`)})),this.context.declarations=[];for(let e in this.context.varyings){const t=this.context.varyings[e],r=[];t.forEach((e=>{const{node:t,value:i}=e;r.push(` ${t.name} = ${i.toGLSLBase(this.context)};`),r.unshift(...this.context.declarations),t.timesChanged=0})),h.push(...r)}h.push(" return finalReturnValue;","}"),this.output[t]=h.join("\n"),this.resetGLSLContext()},i[s.name]=window[s.name],window[s.name]=function(e){r[s.name](e)}})),this.cleanup=()=>{for(const e in i)window[e]=i[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,r){if(e.componentsChanged){r||(r=e.componentNames.map((()=>!0)));const i=[];if(B(e))e.componentNames.forEach(((t,s)=>{if(r[s]&&e[t]!==e.originalValues[s]){const r=$.float(e[t]),s=` ${e.temporaryVariable}.${t} = ${r.toGLSLBase(this)};`;i.push(s)}}));else{const t=e.componentNames.map((t=>e[t])),r=$[e.type](t),s=` ${e.temporaryVariable} = ${r.toGLSLBase(this)};`;i.push(s)}t?this.declarations.splice(t,0,...i):this.declarations.push(...i),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,r,i){if(r in e)return Reflect.get(...arguments);for(const i of t)if([...r].every((e=>i.includes(e)))){if(1===r.length)return e[t[0][i.indexOf(r[0])]];const s=[...r].map((r=>{const s=i.indexOf(r),n=t[0][s];return e[n]})),n=`vec${r.length}`;return $[n](s)}},set(e,r,i,s){for(const n of t){const a=[...r];if(a.every((e=>n.includes(e)))){const o=Array.isArray(i)?i:Array(r.length).fill(i);return a.forEach(((r,i)=>{const a=n.indexOf(r),h=t[0][a];Reflect.set(e,h,o[i],s)})),!0}}return Reflect.set(...arguments)}}}(t)),e.addVectorComponents()}return e}function G(e,t,r,i){let s;return s="%"===r?new y(e,t):new m(e,t,r,i),U(s)}function z(e,t,r){return U(new d(e,t,r))}function j(e,t,r,i){let s=new p(e,t,r,i);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 r of e)F(r)?t+=parseInt(r.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 i in V){const s=V[i],n=`uniform${s}`;if(O.prototype[n]=function(...e){let[t,...r]=e;!i.startsWith("vec")||r[0]instanceof Function?this.output.uniforms[`${i} ${t}`]=r[0]:(r=R(r,parseInt(i.slice(3))),this.output.uniforms[`${i} ${t}`]=r);const s=z(t,i,!1);return this.uniformNodes.push(s),s},t[n]=function(...e){return r[n](...e)},"sampler2D"===i)continue;const a=`varying${s}`;O.prototype[a]=function(e){return U(new g(e,i,!1))},t[a]=function(e){return r[a](e)};const o=t[i];t[i]=function(...t){return r?.isGenerating?(t=i.startsWith("vec")?R(t,parseInt(i.slice(3))):t[0],$[i](t)):o?o.apply(this,t):void e._friendlyError(`It looks like you've called ${i} 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((([i,s])=>{if(Array.isArray(s)?s[0].isp5Function:s.isp5Function){const e=t[i];t[i]=function(...t){return r?.isGenerating?j(i,t,s):e.apply(this,t)}}else t[i]=function(...t){if(r?.isGenerating)return new j(i,t,s);e._friendlyError(`It looks like you've called ${i} outside of a shader's modify() function.`)}}))}function Ac(e){return Ac="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},Ac(e)}function Sc(e){var t=function(e,t){if("object"!=Ac(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var i=r.call(e,t);if("object"!=Ac(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e,"string");return"symbol"==Ac(t)?t:t+""}function Fc(e,t,r){return(t=Sc(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Tc(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?Object(arguments[t]):{},i=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&i.push.apply(i,Object.getOwnPropertySymbols(r).filter((function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))),i.forEach((function(t){Fc(e,t,r[t])}))}return e}function Mc(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function kc(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,Sc(i.key),i)}}function Ic(e,t,r){return t&&kc(e.prototype,t),r&&kc(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function Bc(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Lc(e,t){if(t&&("object"==Ac(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return Bc(e)}function Pc(e){return Pc=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},Pc(e)}function Oc(e,t){return Oc=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},Oc(e,t)}function Nc(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&&Oc(e,t)}void 0!==p5&&p5.registerAddon(Ec);var Rc={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)}},Vc=function(){function e(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Mc(this,e),this.init(t,r)}return Ic(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||Rc,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),r=0;r<e;r++)t[r]=arguments[r];return this.forward(t,"log","",!0)}},{key:"warn",value:function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return this.forward(t,"warn","",!0)}},{key:"error",value:function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return this.forward(t,"error","")}},{key:"deprecate",value:function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return this.forward(t,"warn","WARNING DEPRECATED: ",!0)}},{key:"forward",value:function(e,t,r,i){return i&&!this.debug?null:("string"==typeof e[0]&&(e[0]="".concat(r).concat(this.prefix," ").concat(e[0])),this.logger[t](e))}},{key:"create",value:function(t){return new e(this.logger,Tc({},{prefix:"".concat(this.prefix,":").concat(t,":")},this.options))}}]),e}(),Uc=new Vc,Gc=function(){function e(){Mc(this,e),this.observers={}}return Ic(e,[{key:"on",value:function(e,t){var r=this;return e.split(" ").forEach((function(e){r.observers[e]=r.observers[e]||[],r.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,r=new Array(t>1?t-1:0),i=1;i<t;i++)r[i-1]=arguments[i];this.observers[e]&&[].concat(this.observers[e]).forEach((function(e){e.apply(void 0,r)}));this.observers["*"]&&[].concat(this.observers["*"]).forEach((function(t){t.apply(t,[e].concat(r))}))}}]),e}();function zc(){var e,t,r=new Promise((function(r,i){e=r,t=i}));return r.resolve=e,r.reject=t,r}function jc(e){return null==e?"":""+e}function $c(e,t,r){function i(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=i(n.shift());!e[a]&&r&&(e[a]=new r),e=Object.prototype.hasOwnProperty.call(e,a)?e[a]:{}}return s()?{}:{obj:e,k:i(n.shift())}}function Wc(e,t,r){var i=$c(e,t,Object);i.obj[i.k]=r}function qc(e,t){var r=$c(e,t),i=r.obj,s=r.k;if(i)return i[s]}function Hc(e,t,r){var i=qc(e,r);return void 0!==i?i:qc(t,r)}function Xc(e,t,r){for(var i in t)"__proto__"!==i&&"constructor"!==i&&(i in e?"string"==typeof e[i]||e[i]instanceof String||"string"==typeof t[i]||t[i]instanceof String?r&&(e[i]=t[i]):Xc(e[i],t[i],r):e[i]=t[i]);return e}function Yc(e){return e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")}var Zc={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"};function Kc(e){return"string"==typeof e?e.replace(/[&<>"'\/]/g,(function(e){return Zc[e]})):e}var Jc="undefined"!=typeof window&&window.navigator&&window.navigator.userAgent&&window.navigator.userAgent.indexOf("MSIE")>-1,Qc=function(e){function t(e){var r,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{ns:["translation"],defaultNS:"translation"};return Mc(this,t),r=Lc(this,Pc(t).call(this)),Jc&&Gc.call(Bc(r)),r.data=e||{},r.options=i,void 0===r.options.keySeparator&&(r.options.keySeparator="."),r}return Nc(t,e),Ic(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,r){var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},s=void 0!==i.keySeparator?i.keySeparator:this.options.keySeparator,n=[e,t];return r&&"string"!=typeof r&&(n=n.concat(r)),r&&"string"==typeof r&&(n=n.concat(s?r.split(s):r)),e.indexOf(".")>-1&&(n=e.split(".")),qc(this.data,n)}},{key:"addResource",value:function(e,t,r,i){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];r&&(a=a.concat(n?r.split(n):r)),e.indexOf(".")>-1&&(i=t,t=(a=e.split("."))[1]),this.addNamespaces(t),Wc(this.data,a,i),s.silent||this.emit("added",e,t,r,i)}},{key:"addResources",value:function(e,t,r){var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{silent:!1};for(var s in r)"string"!=typeof r[s]&&"[object Array]"!==Object.prototype.toString.apply(r[s])||this.addResource(e,t,s,r[s],{silent:!0});i.silent||this.emit("added",e,t,r)}},{key:"addResourceBundle",value:function(e,t,r,i,s){var n=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{silent:!1},a=[e,t];e.indexOf(".")>-1&&(i=r,r=t,t=(a=e.split("."))[1]),this.addNamespaces(t);var o=qc(this.data,a)||{};i?Xc(o,r,s):o=Tc({},o,r),Wc(this.data,a,o),n.silent||this.emit("added",e,t,r)}},{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?Tc({},{},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}(Gc),ep={processors:{},addPostProcessor:function(e){this.processors[e.name]=e},handle:function(e,t,r,i,s){var n=this;return e.forEach((function(e){n.processors[e]&&(t=n.processors[e].process(t,r,i,s))})),t}},tp={},rp=function(e){function t(e){var r,i,s,n,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return Mc(this,t),r=Lc(this,Pc(t).call(this)),Jc&&Gc.call(Bc(r)),i=["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"],s=e,n=Bc(r),i.forEach((function(e){s[e]&&(n[e]=s[e])})),r.options=a,void 0===r.options.keySeparator&&(r.options.keySeparator="."),r.logger=Uc.create("translator"),r}return Nc(t,e),Ic(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:{}},r=this.resolve(e,t);return r&&void 0!==r.res}},{key:"extractFromKey",value:function(e,t){var r=void 0!==t.nsSeparator?t.nsSeparator:this.options.nsSeparator;void 0===r&&(r=":");var i=void 0!==t.keySeparator?t.keySeparator:this.options.keySeparator,s=t.ns||this.options.defaultNS;if(r&&e.indexOf(r)>-1){var n=e.match(this.interpolator.nestingRegexp);if(n&&n.length>0)return{key:e,namespaces:s};var a=e.split(r);(r!==i||r===i&&this.options.ns.indexOf(a[0])>-1)&&(s=a.shift()),e=a.join(i)}return"string"==typeof s&&(s=[s]),{key:e,namespaces:s}}},{key:"translate",value:function(e,r,i){var s=this;if("object"!==Ac(r)&&this.options.overloadTranslationOptionHandler&&(r=this.options.overloadTranslationOptionHandler(arguments)),r||(r={}),null==e)return"";Array.isArray(e)||(e=[String(e)]);var n=void 0!==r.keySeparator?r.keySeparator:this.options.keySeparator,a=this.extractFromKey(e[e.length-1],r),o=a.key,h=a.namespaces,u=h[h.length-1],l=r.lng||this.language,c=r.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if(l&&"cimode"===l.toLowerCase()){if(c){var p=r.nsSeparator||this.options.nsSeparator;return u+p+o}return o}var d=this.resolve(e,r),f=d&&d.res,g=d&&d.usedKey||o,m=d&&d.exactUsedKey||o,y=Object.prototype.toString.apply(f),x=void 0!==r.joinArrays?r.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(!r.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,r):"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,Tc({},r,{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,r,i));else{var E=!1,A=!1,S=void 0!==r.count&&"string"!=typeof r.count,F=t.hasDefaultValue(r),T=S?this.pluralResolver.getSuffix(l,r.count):"",M=r["defaultValue".concat(T)]||r.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,Tc({},r,{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,r.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(r.lng||this.language):B.push(r.lng||this.language);var O=function(e,t,i){s.options.missingKeyHandler?s.options.missingKeyHandler(e,u,t,k?i:f,k,r):s.backendConnector&&s.backendConnector.saveMissing&&s.backendConnector.saveMissing(e,u,t,k?i:f,k,r),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,r["defaultValue".concat(t)]||M)}))})):O(B,o,M))}f=this.extendTranslation(f,e,r,d,i),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,r,i,s){var n=this;if(this.i18nFormat&&this.i18nFormat.parse)e=this.i18nFormat.parse(e,r,i.usedLng,i.usedNS,i.usedKey,{resolved:i});else if(!r.skipInterpolation){r.interpolation&&this.interpolator.init(Tc({},r,{interpolation:Tc({},this.options.interpolation,r.interpolation)}));var a,o=r.interpolation&&r.interpolation.skipOnVariables||this.options.interpolation.skipOnVariables;if(o){var h=e.match(this.interpolator.nestingRegexp);a=h&&h.length}var u=r.replace&&"string"!=typeof r.replace?r.replace:r;if(this.options.interpolation.defaultVariables&&(u=Tc({},this.options.interpolation.defaultVariables,u)),e=this.interpolator.interpolate(e,u,r.lng||this.language,r),o){var l=e.match(this.interpolator.nestingRegexp);a<(l&&l.length)&&(r.nest=!1)}!1!==r.nest&&(e=this.interpolator.nest(e,(function(){for(var e=arguments.length,i=new Array(e),a=0;a<e;a++)i[a]=arguments[a];return s&&s[0]===i[0]&&!r.context?(n.logger.warn("It seems you are nesting recursively key: ".concat(i[0]," in key: ").concat(t[0])),null):n.translate.apply(n,i.concat([t]))}),r)),r.interpolation&&this.interpolator.reset()}var c=r.postProcess||this.options.postProcess,p="string"==typeof c?[c]:c;return null!=e&&p&&p.length&&!1!==r.applyPostProcessor&&(e=ep.handle(p,e,t,this.options&&this.options.postProcessPassResolved?Tc({i18nResolved:i},r):r,this)),e}},{key:"resolve",value:function(e){var t,r,i,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;r=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,!tp["".concat(d[0],"-").concat(e)]&&a.utils&&a.utils.hasLoadedNamespace&&!a.utils.hasLoadedNamespace(n)&&(tp["".concat(d[0],"-").concat(e)]=!0,a.logger.warn('key "'.concat(r,'" 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(r){if(!a.isValidLookup(t)){s=r;var n,h,l=u,d=[l];if(a.i18nFormat&&a.i18nFormat.addLookupKeys)a.i18nFormat.addLookupKeys(d,u,r,e,o);else c&&(n=a.pluralResolver.getSuffix(r,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)||(i=h,t=a.getResource(r,e,h,o))}})))}))}})),{res:t,usedKey:r,exactUsedKey:i,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,r){var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return this.i18nFormat&&this.i18nFormat.getResource?this.i18nFormat.getResource(e,t,r,i):this.resourceStore.getResource(e,t,r,i)}}],[{key:"hasDefaultValue",value:function(e){var t="defaultValue";for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)&&t===r.substring(0,12)&&void 0!==e[r])return!0;return!1}}]),t}(Gc);function ip(e){return e.charAt(0).toUpperCase()+e.slice(1)}var sp=function(){function e(t){Mc(this,e),this.options=t,this.whitelist=this.options.supportedLngs||!1,this.supportedLngs=this.options.supportedLngs||!1,this.logger=Uc.create("languageUtils")}return Ic(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"],r=e.split("-");return this.options.lowerCaseLng?r=r.map((function(e){return e.toLowerCase()})):2===r.length?(r[0]=r[0].toLowerCase(),r[1]=r[1].toUpperCase(),t.indexOf(r[1].toLowerCase())>-1&&(r[1]=ip(r[1].toLowerCase()))):3===r.length&&(r[0]=r[0].toLowerCase(),2===r[1].length&&(r[1]=r[1].toUpperCase()),"sgn"!==r[0]&&2===r[2].length&&(r[2]=r[2].toUpperCase()),t.indexOf(r[1].toLowerCase())>-1&&(r[1]=ip(r[1].toLowerCase())),t.indexOf(r[2].toLowerCase())>-1&&(r[2]=ip(r[2].toLowerCase()))),r.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,r=this;return e?(e.forEach((function(e){if(!t){var i=r.formatLanguageCode(e);r.options.supportedLngs&&!r.isSupportedCode(i)||(t=i)}})),!t&&this.options.supportedLngs&&e.forEach((function(e){if(!t){var i=r.getLanguagePartFromCode(e);if(r.isSupportedCode(i))return t=i;t=r.options.supportedLngs.find((function(e){if(0===e.indexOf(i))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 r=e[t];return r||(r=e[this.getScriptPartFromCode(t)]),r||(r=e[this.formatLanguageCode(t)]),r||(r=e[this.getLanguagePartFromCode(t)]),r||(r=e.default),r||[]}},{key:"toResolveHierarchy",value:function(e,t){var r=this,i=this.getFallbackCodes(t||this.options.fallbackLng||[],e),s=[],n=function(e){e&&(r.isSupportedCode(e)?s.push(e):r.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)),i.forEach((function(e){s.indexOf(e)<0&&n(r.formatLanguageCode(e))})),s}}]),e}(),np=[{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}],ap={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 op=function(){function e(t){var r,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Mc(this,e),this.languageUtils=t,this.options=i,this.logger=Uc.create("pluralResolver"),this.rules=(r={},np.forEach((function(e){e.lngs.forEach((function(t){r[t]={numbers:e.nr,plurals:ap[e.fc]}}))})),r)}return Ic(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,r=this.getRule(e);return r?r.numbers.map((function(r){return t.getSuffix(e,r)})):[]}},{key:"getSuffix",value:function(e,t){var r=this,i=this.getRule(e);if(i){var s=i.noAbs?i.plurals(t):i.plurals(Math.abs(t)),n=i.numbers[s];this.options.simplifyPluralSuffix&&2===i.numbers.length&&1===i.numbers[0]&&(2===n?n="plural":1===n&&(n=""));var a=function(){return r.options.prepend&&n.toString()?r.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===i.numbers.length&&1===i.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}(),hp=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};Mc(this,e),this.logger=Uc.create("interpolator"),this.options=t,this.format=t.interpolation&&t.interpolation.format||function(e){return e},this.init(t)}return Ic(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:Kc,this.escapeValue=void 0===t.escapeValue||t.escapeValue,this.useRawValueToEscape=void 0!==t.useRawValueToEscape&&t.useRawValueToEscape,this.prefix=t.prefix?Yc(t.prefix):t.prefixEscaped||"{{",this.suffix=t.suffix?Yc(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?Yc(t.nestingPrefix):t.nestingPrefixEscaped||Yc("$t("),this.nestingSuffix=t.nestingSuffix?Yc(t.nestingSuffix):t.nestingSuffixEscaped||Yc(")"),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 r="".concat(this.nestingPrefix,"(.+?)").concat(this.nestingSuffix);this.nestingRegexp=new RegExp(r,"g")}},{key:"interpolate",value:function(e,t,r,i){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=Hc(t,h,e);return o.alwaysFormat?o.format(s,void 0,r):s}var n=e.split(o.formatSeparator),a=n.shift().trim(),u=n.join(o.formatSeparator).trim();return o.format(Hc(t,h,a),u,r,i)};this.resetRegExp();var c=i&&i.missingInterpolationHandler||this.options.missingInterpolationHandler,p=i&&i.interpolation&&i.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 r=c(e,s,i);n="string"==typeof r?r:""}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=jc(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 r,i,s=this,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},a=Tc({},n);function o(e,t){var r=this.nestingOptionsSeparator;if(e.indexOf(r)<0)return e;var i=e.split(new RegExp("".concat(r,"[ ]*{"))),s="{".concat(i[1]);e=i[0],s=(s=this.interpolate(s,a)).replace(/'/g,'"');try{a=JSON.parse(s),t&&(a=Tc({},t,a))}catch(t){return this.logger.warn("failed parsing options string in nesting for key ".concat(e),t),"".concat(e).concat(r).concat(s)}return delete a.defaultValue,e}for(a.applyPostProcessor=!1,delete a.defaultValue;r=this.nestingRegexp.exec(e);){var h=[],u=!1;if(r[0].includes(this.formatSeparator)&&!/{.*}/.test(r[1])){var l=r[1].split(this.formatSeparator).map((function(e){return e.trim()}));r[1]=l.shift(),h=l,u=!0}if((i=t(o.call(this,r[1].trim(),a),a))&&r[0]===e&&"string"!=typeof i)return i;"string"!=typeof i&&(i=jc(i)),i||(this.logger.warn("missed to resolve ".concat(r[1]," for nesting ").concat(e)),i=""),u&&(i=h.reduce((function(e,t){return s.format(e,t,n.lng,n)}),i.trim())),e=e.replace(r[0],i),this.regexp.lastIndex=0}return e}}]),e}();var up=function(e){function t(e,r,i){var s,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return Mc(this,t),s=Lc(this,Pc(t).call(this)),Jc&&Gc.call(Bc(s)),s.backend=e,s.store=r,s.services=i,s.languageUtils=i.languageUtils,s.options=n,s.logger=Uc.create("backendConnector"),s.state={},s.queue=[],s.backend&&s.backend.init&&s.backend.init(i,n.backend,n),s}return Nc(t,e),Ic(t,[{key:"queueLoad",value:function(e,t,r,i){var s=this,n=[],a=[],o=[],h=[];return e.forEach((function(e){var i=!0;t.forEach((function(t){var o="".concat(e,"|").concat(t);!r.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,i=!1,a.indexOf(o)<0&&a.push(o),n.indexOf(o)<0&&n.push(o),h.indexOf(t)<0&&h.push(t)))})),i||o.push(e)})),(n.length||a.length)&&this.queue.push({pending:a,loaded:{},errors:[],callback:i}),{toLoad:n,pending:a,toLoadLanguages:o,toLoadNamespaces:h}}},{key:"loaded",value:function(e,t,r){var i=e.split("|"),s=i[0],n=i[1];t&&this.emit("failedLoading",s,n,t),r&&this.store.addResourceBundle(s,n,r),this.state[e]=t?-1:2;var a={};this.queue.forEach((function(r){!function(e,t,r){var i=$c(e,t,Object),s=i.obj,n=i.k;s[n]=s[n]||[],s[n].push(r)}(r.loaded,[s],n),function(e,t){for(var r=e.indexOf(t);-1!==r;)e.splice(r,1),r=e.indexOf(t)}(r.pending,e),t&&r.errors.push(t),0!==r.pending.length||r.done||(Object.keys(r.loaded).forEach((function(e){a[e]||(a[e]=[]),r.loaded[e].length&&r.loaded[e].forEach((function(t){a[e].indexOf(t)<0&&a[e].push(t)}))})),r.done=!0,r.errors.length?r.callback(r.errors):r.callback())})),this.emit("loaded",a),this.queue=this.queue.filter((function(e){return!e.done}))}},{key:"read",value:function(e,t,r){var i=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[r](e,t,(function(o,h){o&&h&&s<5?setTimeout((function(){i.read.call(i,e,t,r,s+1,2*n,a)}),n):a(o,h)})):a(null,{})}},{key:"prepareLoading",value:function(e,t){var r=this,i=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,i,s);if(!n.toLoad.length)return n.pending.length||s(),null;n.toLoad.forEach((function(e){r.loadOne(e)}))}},{key:"load",value:function(e,t,r){this.prepareLoading(e,t,{},r)}},{key:"reload",value:function(e,t,r){this.prepareLoading(e,t,{reload:!0},r)}},{key:"loadOne",value:function(e){var t=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",i=e.split("|"),s=i[0],n=i[1];this.read(s,n,"read",void 0,void 0,(function(i,a){i&&t.logger.warn("".concat(r,"loading namespace ").concat(n," for language ").concat(s," failed"),i),!i&&a&&t.logger.log("".concat(r,"loaded namespace ").concat(n," for language ").concat(s),a),t.loaded(e,i,a)}))}},{key:"saveMissing",value:function(e,t,r,i,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(r,'" 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!=r&&""!==r&&(this.backend&&this.backend.create&&this.backend.create(e,t,r,i,null,Tc({},n,{isUpdate:s})),e&&e[0]&&this.store.addResource(e[0],t,r,i))}}]),t}(Gc);function lp(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 cp(){}var pp=function(e){function t(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=arguments.length>1?arguments[1]:void 0;if(Mc(this,t),e=Lc(this,Pc(t).call(this)),Jc&&Gc.call(Bc(e)),e.options=lp(r),e.services={},e.logger=Uc,e.modules={external:[]},i&&!e.isInitialized&&!r.isClone){if(!e.options.initImmediate)return e.init(r,i),Lc(e,Bc(e));setTimeout((function(){e.init(r,i)}),0)}return e}return Nc(t,e),Ic(t,[{key:"init",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=arguments.length>1?arguments[1]:void 0;function i(e){return e?"function"==typeof e?new e:e:null}if("function"==typeof t&&(r=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=Tc({},{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"===Ac(e[1])&&(t=e[1]),"string"==typeof e[1]&&(t.defaultValue=e[1]),"string"==typeof e[2]&&(t.tDescription=e[2]),"object"===Ac(e[2])||"object"===Ac(e[3])){var r=e[3]||e[2];Object.keys(r).forEach((function(e){t[e]=r[e]}))}return t},interpolation:{escapeValue:!0,format:function(e,t,r,i){return e},prefix:"{{",suffix:"}}",formatSeparator:",",unescapePrefix:"-",nestingPrefix:"$t(",nestingSuffix:")",nestingOptionsSeparator:",",maxReplaces:1e3,skipOnVariables:!1}},this.options,lp(t)),this.format=this.options.interpolation.format,r||(r=cp),!this.options.isClone){this.modules.logger?Uc.init(i(this.modules.logger),this.options):Uc.init(null,this.options);var s=new sp(this.options);this.store=new Qc(this.options.resources,this.options);var n=this.services;n.logger=Uc,n.resourceStore=this.store,n.languageUtils=s,n.pluralResolver=new op(s,{prepend:this.options.pluralSeparator,compatibilityJSON:this.options.compatibilityJSON,simplifyPluralSuffix:this.options.simplifyPluralSuffix}),n.interpolator=new hp(this.options),n.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},n.backendConnector=new up(i(this.modules.backend),n.resourceStore,n,this.options),n.backendConnector.on("*",(function(t){for(var r=arguments.length,i=new Array(r>1?r-1:0),s=1;s<r;s++)i[s-1]=arguments[s];e.emit.apply(e,[t].concat(i))})),this.modules.languageDetector&&(n.languageDetector=i(this.modules.languageDetector),n.languageDetector.init(n,this.options.detection,this.options)),this.modules.i18nFormat&&(n.i18nFormat=i(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 r=arguments.length,i=new Array(r>1?r-1:0),s=1;s<r;s++)i[s-1]=arguments[s];e.emit.apply(e,[t].concat(i))})),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 r;return(r=e.store)[t].apply(r,arguments)}}));["addResource","addResources","addResourceBundle","removeResourceBundle"].forEach((function(t){e[t]=function(){var r;return(r=e.store)[t].apply(r,arguments),e}}));var o=zc(),h=function(){var t=function(t,i){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(i),r(t,i)};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,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:cp,i="string"==typeof e?e:this.language;if("function"==typeof e&&(r=e),!this.options.resources||this.options.partialBundledLanguages){if(i&&"cimode"===i.toLowerCase())return r();var s=[],n=function(e){e&&t.services.languageUtils.toResolveHierarchy(e).forEach((function(e){s.indexOf(e)<0&&s.push(e)}))};if(i)n(i);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,r)}else r(null)}},{key:"reloadResources",value:function(e,t,r){var i=zc();return e||(e=this.languages),t||(t=this.options.ns),r||(r=cp),this.services.backendConnector.reload(e,t,(function(e){i.resolve(),r(e)})),i}},{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&&ep.addPostProcessor(e),"3rdParty"===e.type&&this.modules.external.push(e),this}},{key:"changeLanguage",value:function(e,t){var r=this;this.isLanguageChangingTo=e;var i=zc();this.emit("languageChanging",e);var s=function(e){var s="string"==typeof e?e:r.services.languageUtils.getBestMatchFromCodes(e);s&&(r.language||(r.language=s,r.languages=r.services.languageUtils.toResolveHierarchy(s)),r.translator.language||r.translator.changeLanguage(s),r.services.languageDetector&&r.services.languageDetector.cacheUserLanguage(s)),r.loadResources(s,(function(e){!function(e,s){s?(r.language=s,r.languages=r.services.languageUtils.toResolveHierarchy(s),r.translator.changeLanguage(s),r.isLanguageChangingTo=void 0,r.emit("languageChanged",s),r.logger.log("languageChanged",s)):r.isLanguageChangingTo=void 0,i.resolve((function(){return r.t.apply(r,arguments)})),t&&t(e,(function(){return r.t.apply(r,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()),i}},{key:"getFixedT",value:function(e,t){var r=this,i=function e(t,i){var s;if("object"!==Ac(i)){for(var n=arguments.length,a=new Array(n>2?n-2:0),o=2;o<n;o++)a[o-2]=arguments[o];s=r.options.overloadTranslationOptionHandler([t,i].concat(a))}else s=Tc({},i);return s.lng=s.lng||e.lng,s.lngs=s.lngs||e.lngs,s.ns=s.ns||e.ns,r.t(t,s)};return"string"==typeof e?i.lng=e:i.lngs=e,i.ns=t,i}},{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,r=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 i=this.languages[0],s=!!this.options&&this.options.fallbackLng,n=this.languages[this.languages.length-1];if("cimode"===i.toLowerCase())return!0;var a=function(e,r){var i=t.services.backendConnector.state["".concat(e,"|").concat(r)];return-1===i||2===i};if(r.precheck){var o=r.precheck(this,a);if(void 0!==o)return o}return!!this.hasResourceBundle(i,e)||(!this.services.backendConnector.backend||!(!a(i,e)||s&&!a(n,e)))}},{key:"loadNamespaces",value:function(e,t){var r=this,i=zc();return this.options.ns?("string"==typeof e&&(e=[e]),e.forEach((function(e){r.options.ns.indexOf(e)<0&&r.options.ns.push(e)})),this.loadResources((function(e){i.resolve(),t&&t(e)})),i):(t&&t(),Promise.resolve())}},{key:"loadLanguages",value:function(e,t){var r=zc();"string"==typeof e&&(e=[e]);var i=this.options.preload||[],s=e.filter((function(e){return i.indexOf(e)<0}));return s.length?(this.options.preload=i.concat(s),this.loadResources((function(e){r.resolve(),t&&t(e)})),r):(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,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:cp,s=Tc({},this.options,r,{isClone:!0}),n=new t(s);return["store","services","language"].forEach((function(t){n[t]=e[t]})),n.services=Tc({},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,r=new Array(t>1?t-1:0),i=1;i<t;i++)r[i-1]=arguments[i];n.emit.apply(n,[e].concat(r))})),n.init(s,i),n.translator.options=n.options,n.translator.backendConnector.services.utils={hasLoadedNamespace:n.hasLoadedNamespace.bind(n)},n}}]),t}(Gc),dp=(new pp,[]),fp=dp.forEach,gp=dp.slice;var mp,yp=function(e,t,r,i){var s,n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{path:"/"};if(r){var a=new Date;a.setTime(a.getTime()+60*r*1e3),s="; expires="+a.toUTCString()}else s="";i=i?"domain="+i+";":"",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+";"+i+n},xp=function(e){for(var t=e+"=",r=document.cookie.split(";"),i=0;i<r.length;i++){for(var s=r[i];" "===s.charAt(0);)s=s.substring(1,s.length);if(0===s.indexOf(t))return s.substring(t.length,s.length)}return null},vp={name:"cookie",lookup:function(e){var t;if(e.lookupCookie&&"undefined"!=typeof document){var r=xp(e.lookupCookie);r&&(t=r)}return t},cacheUserLanguage:function(e,t){t.lookupCookie&&"undefined"!=typeof document&&yp(t.lookupCookie,e,t.cookieMinutes,t.cookieDomain,t.cookieOptions)}},bp={name:"querystring",lookup:function(e){var t;if("undefined"!=typeof window)for(var r=window.location.search.substring(1).split("&"),i=0;i<r.length;i++){var s=r[i].indexOf("=");if(s>0)r[i].substring(0,s)===e.lookupQuerystring&&(t=r[i].substring(s+1))}return t}};try{mp="undefined"!==window&&null!==window.localStorage;var _p="i18next.translate.boo";window.localStorage.setItem(_p,"foo"),window.localStorage.removeItem(_p)}catch(e){mp=!1}var wp,Cp={name:"localStorage",lookup:function(e){var t;if(e.lookupLocalStorage&&mp){var r=window.localStorage.getItem(e.lookupLocalStorage);r&&(t=r)}return t},cacheUserLanguage:function(e,t){t.lookupLocalStorage&&mp&&window.localStorage.setItem(t.lookupLocalStorage,e)}};try{wp="undefined"!==window&&null!==window.sessionStorage;var Dp="i18next.translate.boo";window.sessionStorage.setItem(Dp,"foo"),window.sessionStorage.removeItem(Dp)}catch(e){wp=!1}var Ep={name:"sessionStorage",lookup:function(e){var t;if(e.lookupsessionStorage&&wp){var r=window.sessionStorage.getItem(e.lookupsessionStorage);r&&(t=r)}return t},cacheUserLanguage:function(e,t){t.lookupsessionStorage&&wp&&window.sessionStorage.setItem(t.lookupsessionStorage,e)}},Ap={name:"navigator",lookup:function(e){var t=[];if("undefined"!=typeof navigator){if(navigator.languages)for(var r=0;r<navigator.languages.length;r++)t.push(navigator.languages[r]);navigator.userLanguage&&t.push(navigator.userLanguage),navigator.language&&t.push(navigator.language)}return t.length>0?t:void 0}},Sp={name:"htmlTag",lookup:function(e){var t,r=e.htmlTag||("undefined"!=typeof document?document.documentElement:null);return r&&"function"==typeof r.getAttribute&&(t=r.getAttribute("lang")),t}},Fp={name:"path",lookup:function(e){var t;if("undefined"!=typeof window){var r=window.location.pathname.match(/\/([a-zA-Z-]*)/g);if(r instanceof Array)if("number"==typeof e.lookupFromPathIndex){if("string"!=typeof r[e.lookupFromPathIndex])return;t=r[e.lookupFromPathIndex].replace("/","")}else t=r[0].replace("/","")}return t}},Tp={name:"subdomain",lookup:function(e){var t;if("undefined"!=typeof window){var r=window.location.href.match(/(?:http[s]*\:\/\/)*(.*?)\.(?=[^\/]*\..{2,5})/gi);r instanceof Array&&(t="number"==typeof e.lookupFromSubdomainIndex?r[e.lookupFromSubdomainIndex].replace("http://","").replace("https://","").replace(".",""):r[0].replace("http://","").replace("https://","").replace(".",""))}return t}};var Mp=function(){function e(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Mc(this,e),this.type="languageDetector",this.detectors={},this.init(t,r)}return Ic(e,[{key:"init",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};this.services=e,this.options=function(e){return fp.call(gp.call(arguments,1),(function(t){if(t)for(var r in t)void 0===e[r]&&(e[r]=t[r])})),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=r,this.addDetector(vp),this.addDetector(bp),this.addDetector(Cp),this.addDetector(Ep),this.addDetector(Ap),this.addDetector(Sp),this.addDetector(Fp),this.addDetector(Tp)}},{key:"addDetector",value:function(e){this.detectors[e.name]=e}},{key:"detect",value:function(e){var t=this;e||(e=this.options.order);var r,i=[];if(e.forEach((function(e){if(t.detectors[e]){var r=t.detectors[e].lookup(t.options);r&&"string"==typeof r&&(r=[r]),r&&(i=i.concat(r))}})),i.forEach((function(e){if(!r){var i=t.services.languageUtils.formatLanguageCode(e);t.options.checkWhitelist&&!t.services.languageUtils.isWhitelisted(i)||(r=i),!r&&t.options.checkForSimilarInWhitelist&&(r=t.getSimilarInWhitelist(i))}})),!r){var s=this.i18nOptions.fallbackLng;"string"==typeof s&&(s=[s]),s||(s=[]),r="[object Array]"===Object.prototype.toString.apply(s)?s[0]:s[0]||s.default&&s.default[0]}return r}},{key:"cacheUserLanguage",value:function(e,t){var r=this;t||(t=this.options.caches),t&&(this.options.excludeCacheFor&&this.options.excludeCacheFor.indexOf(e)>-1||t.forEach((function(t){r.detectors[t]&&r.detectors[t].cacheUserLanguage(e,r.options)})))}},{key:"getSimilarInWhitelist",value:function(e){var t=this;if(this.i18nOptions.whitelist){if(e.includes("-")){var r=e.split("-")[0],i=this.services.languageUtils.formatLanguageCode(r);if(this.services.languageUtils.isWhitelisted(i))return i;e=i}var s=this.i18nOptions.whitelist.find((function(r){var i=t.services.languageUtils.formatLanguageCode(r);if(i.startsWith(e))return i}));return s||void 0}}}]),e}();Mp.type="languageDetector";var kp={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 Ip=["en","es","ko","zh","hi","ja"];class Bp{constructor(e,t){this.init(e,t)}fetchWithTimeout(e,t,r=2e3){return Promise.race([fetch(e,t),new Promise(((e,t)=>setTimeout((()=>t(new Error("timeout"))),r)))])}init(e,t={}){this.services=e,this.options=t}read(e,t,r){const i=this.options.loadPath;if(e===this.options.fallback)r(null,kp[e][t]);else if(Ip.includes(e)){const s=this.services.interpolator.interpolate(i,{lng:e,ns:t});this.loadUrl(s,r)}else r("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)}}Bp.type="backend";const Lp=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(Di),e.registerAddon(di),e.registerAddon(Ts)}(Ca),function(e){e.registerAddon(Ma)}(Ca),function(e){e.registerAddon(ka),e.registerAddon(ki),e.registerAddon(_s),e.registerAddon(Ti)}(Ca),function(e){e.registerAddon(Ia),e.registerAddon(Ba),e.registerAddon(La)}(Ca),function(e){e.registerAddon(ks),e.registerAddon(sn),e.registerAddon(qi),e.registerAddon(nn),e.registerAddon(En),e.registerAddon(ca)}(Ca),function(e){e.registerAddon(Ns),e.registerAddon(Oa),e.registerAddon(Ra),e.registerAddon(Si)}(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},Ph.prototype._getFontInfo=function(e){this._fontInfos=this._fontInfos||{};const t=JSON.stringify(e);if(this._fontInfos[t])return this._fontInfos[t];{const r=new s(this,{axs:e});return this._fontInfos[t]=r,r}};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 r,i;for(let s=this.infos.length-1;s>=0;--s){const n=this.infos[s];if(n.index+e<t){r=n,i=n.imageData;break}}if(!r){try{i=new ImageData(this.width,this.height)}catch(e){let t=document.getElementsByTagName("canvas")[0];const r=!t;t||(t=document.createElement("canvas"),t.style.display="none",document.body.appendChild(t));const s=t.getContext("2d");s&&(i=s.createImageData(this.width,this.height)),r&&document.body.removeChild(t)}r={index:0,imageData:i},this.infos.push(r)}const s=r.index;return r.index+=e,i._dirty=!0,{imageData:i,index:s}}}function r(e,t,r,i,s){const n=e.imageData.data;let a=4*e.index++;n[a++]=t,n[a++]=r,n[a++]=i,n[a++]=s}const i=Math.sqrt(3);class s{constructor(e,{axs:r}={}){this.font=e,this.axs=r,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=Uh(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,r){const i=f.length;function s(e,t,r){for(let i=e.length;i-- >0;){const s=e[i];t>s&&(t=s),r<s&&(r=s)}return{min:t,max:r}}f.push(r);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(i);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(i)}function x(e){return function(e,t,r){return e<t?t:e>r?r:e}(255*e,0,255)}class v{constructor(e,t,r,i){this.p0=e,this.c0=t,this.c1=r,this.p1=i}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),r=je.lerp(this.c0,this.c1,e),i=je.lerp(t,r,e);this.c1=je.lerp(this.c1,this.p1,e),this.c0=je.lerp(r,this.c1,e);const s=je.lerp(i,this.c0,e),n=new v(this.p0,t,i,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),r=je.sub(je.sub(je.sub(this.p1,this.c1),e),je.mult(t,2)),i=[];let s=t.x*r.y-t.y*r.x;if(0!==s){let n=e.x*r.y-e.y*r.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 r=(-n+e)/(2*s);t>0&&t<1&&(i.push(this.split(t)),r=1-(1-r)/(1-t)),r>0&&r<1&&i.push(this.split(r))}}return i.push(this),i}}function b(e,t,r,s,n,a,o,h){const u=new v(new je(e,t),new je(r,s),new je(n,a),new je(o,h)).splitInflections(),l=[],c=30/i;for(let e of u){const t=[];let r;for(;r=c/e.quadError(),!(r>=.125);){const i=Math.pow(r,1/3),s=e.split(i),n=e.split(1-i/(1-i));l.push(s),t.push(e),e=n}r<1&&l.push(e.split(.5)),l.push(e),Array.prototype.push.apply(l,t.reverse())}return l}function _(e,t,r,i){y([e,r],[t,i],{x:e,y:t,cx:(e+r)/2,cy:(t+i)/2})}function w(e,t,r,i){return Math.abs(r-e)<1e-5&&Math.abs(i-t)<1e-5}let C,D,E,A;for(const e of p){const t=(e.x-a)/l,r=(e.y-h)/c;if(!w(C,D,t,r)){switch(e.type){case"M":E=t,A=r;break;case"L":_(C,D,t,r);break;case"Q":{const i=(e.x1-a)/l,s=(e.y1-h)/c;y([C,t,i],[D,r,s],{x:C,y:D,cx:i,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 i=b(C,D,(e.x1-a)/l,(e.y1-h)/c,(e.x2-a)/l,(e.y2-h)/c,t,r);for(let e=0;e<i.length;e++){const t=i[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=r}}const S=f.length,F=this.strokeImageInfos.findImage(S),T=F.index;for(let e=0;e<S;++e){const t=f[e];r(F,x(t.x),x(t.y),x(t.cx),x(t.cy))}function M(e,t,i){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=i.findImage(o);for(let t=0;t<s;++t){const i=e[t],s=i.length,a=h.index;r(n,a>>7,127&a,s>>7,127&s);for(let e=0;e<s;++e){const t=i[e]+T;r(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,r,i,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(i>=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:r,y:i},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.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 r=e.rowInfo,i=e.colInfo,s=[e.strokeImageInfo.imageData,r.cellImageInfo.imageData,r.dimImageInfo.imageData,i.cellImageInfo.imageData,i.dimImageInfo.imageData];for(const e of s)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",r.cellImageInfo.imageData),g.setUniform("uSamplerRows",r.dimImageInfo.imageData),g.setUniform("uSamplerColStrokes",i.cellImageInfo.imageData),g.setUniform("uSamplerCols",i.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),Ec(e,e.prototype)}(Ca),function(e){e.registerAddon(ro),e.registerAddon(Vh)}(Ca),Promise.all([new Promise(((e,t)=>{"complete"===document.readyState?e():window.addEventListener("load",e,!1)})),Lp]).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}();
|