@viji-dev/core 0.12.0 → 0.14.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/artist-dts-p5.js +1 -1
- package/dist/artist-dts.js +1 -1
- package/dist/artist-global-p5.d.ts +1 -1
- package/dist/artist-global.d.ts +1 -1
- package/dist/assets/{viji.worker-Clz2HjaH.js → viji.worker-ByIbGiBL.js} +14 -14
- package/dist/docs-api.js +8 -8
- package/dist/{essentia-wasm.web-7iahj_bF.js → essentia-wasm.web-0tQ5KtU1.js} +1 -1
- package/dist/{index-BcsAA44l.js → index-BYp7SdOD.js} +250 -428
- package/dist/index.d.ts +24 -701
- package/dist/index.js +5 -7
- package/dist/param-inference.d.ts +14 -0
- package/dist/param-inference.js +3235 -0
- package/dist/scene-analysis-CEQRlNUL.js +186 -0
- package/dist/scene-analysis.d.ts +127 -0
- package/dist/scene-analysis.js +4 -0
- package/package.json +11 -1
|
@@ -428,7 +428,7 @@ ${this.backbufferEnabled?"uniform sampler2D backbuffer; // Previous frame textur
|
|
|
428
428
|
void main() {
|
|
429
429
|
gl_Position = vec4(a_position, 0.0, 1.0);
|
|
430
430
|
}`,a=this.compileShader(i.VERTEX_SHADER,n,0),o=this.compileShader(i.FRAGMENT_SHADER,t,s),u=i.createProgram();if(!u)throw new Error("Failed to create WebGL program");if(i.attachShader(u,a),i.attachShader(u,o),i.linkProgram(u),!i.getProgramParameter(u,i.LINK_STATUS)){const l=this.redactDriverInfoLogs?"(diagnostics unavailable)":i.getProgramInfoLog(u);throw new Error(`Shader program link failed: ${l}`)}this.program=u,i.useProgram(u),i.deleteShader(a),i.deleteShader(o)}compileShader(t,s,i=0){const n=this.gl,a=n.createShader(t);if(!a)throw new Error("Failed to create shader");if(n.shaderSource(a,s),n.compileShader(a),!n.getShaderParameter(a,n.COMPILE_STATUS)){const o=n.getShaderInfoLog(a),u=t===n.VERTEX_SHADER?"vertex":"fragment",l=this.redactDriverInfoLogs?"(diagnostics unavailable)":o,h=new Error(`${u} shader compilation failed:
|
|
431
|
-
${l}`);if(t===n.FRAGMENT_SHADER){h.__isShaderCompileError=true;const d=fh(o||"");if(d!==null){const m=d-i;m>=1&&(h.__sourceLocation={line:m})}}throw h}return a}cacheUniformLocations(){if(!this.program)return;const t=this.gl,s=t.getProgramParameter(this.program,t.ACTIVE_UNIFORMS),i=[];for(let n=0;n<s;n++){const a=t.getActiveUniform(this.program,n);if(a){const o=t.getUniformLocation(this.program,a.name);this.uniformLocations.set(a.name,o),(a.name.includes("Stream")||a.name.includes("stream"))&&i.push(a.name)}}i.length>0?console.log("[ShaderAdapter] Stream-related uniforms found:",i):console.log("[ShaderAdapter] NO stream-related uniforms found in shader!")}reserveTextureUnits(){this.textureUnits.set("u_audioFFT",this.nextTextureUnit++),this.textureUnits.set("u_audioWaveform",this.nextTextureUnit++),this.textureUnits.set("u_video",this.nextTextureUnit++),this.textureUnits.set("u_videoAnalysed",this.nextTextureUnit++),this.textureUnits.set("u_segmentationMask",this.nextTextureUnit++),this.textureUnits.set("u_keyboard",this.nextTextureUnit++);for(let t=0;t<ze.MAX_VIDEO_STREAMS;t++)this.textureUnits.set(`u_videoStream${t}`,this.nextTextureUnit++);for(let t=0;t<ze.MAX_DEVICE_VIDEOS;t++)this.textureUnits.set(`u_device${t}`,this.nextTextureUnit++);this.backbufferEnabled&&this.textureUnits.set("backbuffer",this.nextTextureUnit++)}createBackbufferFramebuffers(){const t=this.gl,s=t.canvas.width,i=t.canvas.height,n=()=>{const u=t.createTexture();t.bindTexture(t.TEXTURE_2D,u),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,s,i,0,t.RGBA,t.UNSIGNED_BYTE,null),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE);const l=t.createFramebuffer();return t.bindFramebuffer(t.FRAMEBUFFER,l),t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,u,0),{framebuffer:l,texture:u}},a=n(),o=n();this.backbufferFramebuffer=a.framebuffer,this.backbufferTexture=a.texture,this.currentFramebuffer=o.framebuffer,this.currentTexture=o.texture,t.bindFramebuffer(t.FRAMEBUFFER,null),t.bindTexture(t.TEXTURE_2D,null)}render(t,s){const i=this.gl;if(!this.program||!this.quadBuffer)return console.warn("Shader not initialized"),false;if(i.useProgram(this.program),this.syncCvVisibility(t,s),this.updateBuiltInUniforms(t),this.updateAccumulators(t,s),this.updateParameterUniforms(s),this.backbufferEnabled&&this.backbufferTexture){const a=this.textureUnits.get("backbuffer");a!==void 0&&(i.activeTexture(i.TEXTURE0+a),i.bindTexture(i.TEXTURE_2D,this.backbufferTexture),this.setUniform("backbuffer","sampler2D",a)),i.bindFramebuffer(i.FRAMEBUFFER,this.currentFramebuffer)}const n=i.getAttribLocation(this.program,"a_position");if(i.bindBuffer(i.ARRAY_BUFFER,this.quadBuffer),i.enableVertexAttribArray(n),i.vertexAttribPointer(n,2,i.FLOAT,false,0,0),i.drawArrays(i.TRIANGLE_STRIP,0,4),this.backbufferEnabled){i.bindFramebuffer(i.FRAMEBUFFER,null),i.activeTexture(i.TEXTURE0),i.bindTexture(i.TEXTURE_2D,this.currentTexture),i.drawArrays(i.TRIANGLE_STRIP,0,4);const a=this.backbufferFramebuffer,o=this.backbufferTexture;this.backbufferFramebuffer=this.currentFramebuffer,this.backbufferTexture=this.currentTexture,this.currentFramebuffer=a,this.currentTexture=o}return true}syncCvVisibility(t,s){if(!t.video?.isConnected)return;const i=t.video.cv,n=typeof i.getActiveFeatures=="function"?i.getActiveFeatures():[];for(const[a,o]of this.cvDirectives){let u;if(o.toggleable&&o.paramName){const h=s.get(o.paramName);if(!h)continue;u=h.value===true}else u=true;u?this.visibleFeatures.add(a):this.visibleFeatures.delete(a);const l=n.includes(a);if(u===l){o.lastValue=u;continue}if(o.inFlight){o.pendingValue=u;continue}this.dispatchCvEnable(i,a,u,o)}for(const a of An)this.cvDirectives.has(a)||(n.includes(a)?this.visibleFeatures.add(a):this.visibleFeatures.delete(a))}dispatchCvEnable(t,s,i,n){const a=`enable${s.charAt(0).toUpperCase()}${s.slice(1)}`,o=t[a];typeof o=="function"&&(n.inFlight=true,n.lastValue=i,Promise.resolve(o.call(t,i)).catch(u=>{console.warn(`[ShaderAdapter] ${a}(${i}) failed:`,u)}).finally(()=>{this.destroyed||(n.inFlight=false,delete n.pendingValue)}))}updateBuiltInUniforms(t){this.setUniform("u_resolution","vec2",[t.width,t.height]),this.setUniform("u_time","float",t.time),this.setUniform("u_deltaTime","float",t.deltaTime),this.setUniform("u_frame","int",t.frameCount),this.setUniform("u_fps","float",t.fps),this.setUniform("u_mouse","vec2",[t.mouse.x,t.height-t.mouse.y]),this.setUniform("u_mouseInCanvas","bool",t.mouse.isInCanvas),this.setUniform("u_mousePressed","bool",t.mouse.isPressed),this.setUniform("u_mouseLeft","bool",t.mouse.leftButton),this.setUniform("u_mouseRight","bool",t.mouse.rightButton),this.setUniform("u_mouseMiddle","bool",t.mouse.middleButton),this.setUniform("u_mouseDelta","vec2",[t.mouse.deltaX,-t.mouse.deltaY]),this.setUniform("u_mouseWheel","float",t.mouse.wheelDelta),this.setUniform("u_mouseWasPressed","bool",t.mouse.wasPressed),this.setUniform("u_mouseWasReleased","bool",t.mouse.wasReleased),this.setUniform("u_keySpace","bool",t.keyboard.isPressed(" ")||t.keyboard.isPressed("space")),this.setUniform("u_keyShift","bool",t.keyboard.shift),this.setUniform("u_keyCtrl","bool",t.keyboard.ctrl),this.setUniform("u_keyAlt","bool",t.keyboard.alt),this.setUniform("u_keyW","bool",t.keyboard.isPressed("w")||t.keyboard.isPressed("W")),this.setUniform("u_keyA","bool",t.keyboard.isPressed("a")||t.keyboard.isPressed("A")),this.setUniform("u_keyS","bool",t.keyboard.isPressed("s")||t.keyboard.isPressed("S")),this.setUniform("u_keyD","bool",t.keyboard.isPressed("d")||t.keyboard.isPressed("D")),this.setUniform("u_keyUp","bool",t.keyboard.isPressed("ArrowUp")),this.setUniform("u_keyDown","bool",t.keyboard.isPressed("ArrowDown")),this.setUniform("u_keyLeft","bool",t.keyboard.isPressed("ArrowLeft")),this.setUniform("u_keyRight","bool",t.keyboard.isPressed("ArrowRight")),t.keyboard.textureData&&this.updateKeyboardTexture(t.keyboard.textureData),this.setUniform("u_touchCount","int",t.touches.count);for(let x=0;x<5;x++){const b=t.touches.points[x];b?this.setUniform(`u_touch${x}`,"vec2",[b.x,t.height-b.y]):this.setUniform(`u_touch${x}`,"vec2",[0,0])}this.setUniform("u_pointer","vec2",[t.pointer.x,t.height-t.pointer.y]),this.setUniform("u_pointerDelta","vec2",[t.pointer.deltaX,-t.pointer.deltaY]),this.setUniform("u_pointerDown","bool",t.pointer.isDown),this.setUniform("u_pointerWasPressed","bool",t.pointer.wasPressed),this.setUniform("u_pointerWasReleased","bool",t.pointer.wasReleased),this.setUniform("u_pointerInCanvas","bool",t.pointer.isInCanvas);const s=t.audio;if(this.setUniform("u_audioVolume","float",s.volume?.current||0),this.setUniform("u_audioPeak","float",s.volume?.peak||0),this.setUniform("u_audioVolumeSmoothed","float",s.volume?.smoothed||0),this.setUniform("u_audioLow","float",s.bands?.low||0),this.setUniform("u_audioLowMid","float",s.bands?.lowMid||0),this.setUniform("u_audioMid","float",s.bands?.mid||0),this.setUniform("u_audioHighMid","float",s.bands?.highMid||0),this.setUniform("u_audioHigh","float",s.bands?.high||0),this.setUniform("u_audioLowSmoothed","float",s.bands?.lowSmoothed||0),this.setUniform("u_audioLowMidSmoothed","float",s.bands?.lowMidSmoothed||0),this.setUniform("u_audioMidSmoothed","float",s.bands?.midSmoothed||0),this.setUniform("u_audioHighMidSmoothed","float",s.bands?.highMidSmoothed||0),this.setUniform("u_audioHighSmoothed","float",s.bands?.highSmoothed||0),this.setUniform("u_audioKick","float",s.beat?.kick||0),this.setUniform("u_audioSnare","float",s.beat?.snare||0),this.setUniform("u_audioHat","float",s.beat?.hat||0),this.setUniform("u_audioAny","float",s.beat?.any||0),this.setUniform("u_audioKickSmoothed","float",s.beat?.kickSmoothed||0),this.setUniform("u_audioSnareSmoothed","float",s.beat?.snareSmoothed||0),this.setUniform("u_audioHatSmoothed","float",s.beat?.hatSmoothed||0),this.setUniform("u_audioAnySmoothed","float",s.beat?.anySmoothed||0),this.setUniform("u_audioKickTrigger","bool",s.beat?.triggers?.kick||false),this.setUniform("u_audioSnareTrigger","bool",s.beat?.triggers?.snare||false),this.setUniform("u_audioHatTrigger","bool",s.beat?.triggers?.hat||false),this.setUniform("u_audioAnyTrigger","bool",s.beat?.triggers?.any||false),this.setUniform("u_audioBPM","float",s.beat?.bpm||120),this.setUniform("u_audioConfidence","float",s.beat?.confidence||0),this.setUniform("u_audioIsLocked","bool",s.beat?.isLocked||false),this.setUniform("u_audioBrightness","float",s.spectral?.brightness||0),this.setUniform("u_audioFlatness","float",s.spectral?.flatness||0),s.isConnected){this.updateAudioFFTTexture(s.getFrequencyData());const x=s.getWaveform();x.length>0&&this.updateAudioWaveformTexture(x)}const i=t.video;i.isConnected&&i.currentFrame?(this.updateVideoTexture(i.currentFrame),this.setUniform("u_videoResolution","vec2",[i.frameWidth,i.frameHeight]),this.setUniform("u_videoFrameRate","float",i.frameRate)):(this.setUniform("u_videoResolution","vec2",[0,0]),this.setUniform("u_videoFrameRate","float",0)),i.cv?.analysedFrame instanceof OffscreenCanvas?(this.updateAnalysedFrameTexture(i.cv.analysedFrame),this.setUniform("u_videoAnalysedAvailable","bool",true)):(this.bindAnalysedFrameFallback(),this.setUniform("u_videoAnalysedAvailable","bool",false));const n=t.videoStreams||[],a=Math.min(n.length,ze.MAX_VIDEO_STREAMS);this.setUniform("u_videoStreamCount","int",a);for(let x=0;x<ze.MAX_VIDEO_STREAMS;x++){const b=`u_videoStream${x}Connected`,v=`u_videoStream${x}Resolution`;x<a&&n[x]?.isConnected&&n[x]?.currentFrame?(this.updateVideoStreamTexture(x,n[x].currentFrame),this.setUniform(v,"vec2",[n[x].frameWidth,n[x].frameHeight]),this.setUniform(b,"bool",true)):(this.setUniform(v,"vec2",[0,0]),this.setUniform(b,"bool",false))}const o=t.devices||[],u=Math.min(o.length,ze.MAX_DEVICE_VIDEOS);this.setUniform("u_deviceCount","int",u);for(let x=0;x<ze.MAX_DEVICE_VIDEOS;x++){const b=`u_device${x}Connected`,v=`u_device${x}Resolution`;x<u&&o[x]?.video?.isConnected&&o[x].video.currentFrame?(this.updateDeviceTexture(x,o[x].video.currentFrame),this.setUniform(v,"vec2",[o[x].video.frameWidth,o[x].video.frameHeight]),this.setUniform(b,"bool",true)):(this.setUniform(v,"vec2",[0,0]),this.setUniform(b,"bool",false))}const l=t.audioStreams||[],h=Math.min(l.length,ze.MAX_AUDIO_STREAMS);this.setUniform("u_audioStreamCount","int",h);for(let x=0;x<ze.MAX_AUDIO_STREAMS;x++){const b=`u_audioStream${x}`;if(x<h&&l[x]?.isConnected){const v=l[x];this.setUniform(`${b}Connected`,"bool",true),this.setUniform(`${b}Volume`,"float",v.volume?.current||0),this.setUniform(`${b}Low`,"float",v.bands?.low||0),this.setUniform(`${b}LowMid`,"float",v.bands?.lowMid||0),this.setUniform(`${b}Mid`,"float",v.bands?.mid||0),this.setUniform(`${b}HighMid`,"float",v.bands?.highMid||0),this.setUniform(`${b}High`,"float",v.bands?.high||0),this.setUniform(`${b}Brightness`,"float",v.spectral?.brightness||0),this.setUniform(`${b}Flatness`,"float",v.spectral?.flatness||0)}else this.setUniform(`${b}Connected`,"bool",false),this.setUniform(`${b}Volume`,"float",0),this.setUniform(`${b}Low`,"float",0),this.setUniform(`${b}LowMid`,"float",0),this.setUniform(`${b}Mid`,"float",0),this.setUniform(`${b}HighMid`,"float",0),this.setUniform(`${b}High`,"float",0),this.setUniform(`${b}Brightness`,"float",0),this.setUniform(`${b}Flatness`,"float",0)}const d=i.cv?.faces||[],m=d[0],_=this.visibleFeatures.has("faceDetection")&&!!m,k=this.visibleFeatures.has("faceMesh")&&!!m,T=this.visibleFeatures.has("emotionDetection")&&!!m;if(this.setUniform("u_faceCount","int",this.visibleFeatures.has("faceDetection")?d.length:0),_){const x=m.bounds,b=m.center?.x||0,v=m.center?.y||0;this.setUniform("u_face0Bounds","vec4",[x?.x||0,1-(x?.y||0)-(x?.height||0),x?.width||0,x?.height||0]),this.setUniform("u_face0Center","vec2",[b,1-v]),this.setUniform("u_face0Confidence","float",m.confidence||0)}else this.setUniform("u_face0Bounds","vec4",[0,0,0,0]),this.setUniform("u_face0Center","vec2",[0,0]),this.setUniform("u_face0Confidence","float",0);if(k){const x=m.headPose||{};this.setUniform("u_face0HeadPose","vec3",[x.pitch||0,x.yaw||0,-(x.roll||0)])}else this.setUniform("u_face0HeadPose","vec3",[0,0,0]);if(T){const x=m.expressions||{},b=m.blendshapes||{};this.setUniform("u_face0Neutral","float",x.neutral||0),this.setUniform("u_face0Happy","float",x.happy||0),this.setUniform("u_face0Sad","float",x.sad||0),this.setUniform("u_face0Angry","float",x.angry||0),this.setUniform("u_face0Surprised","float",x.surprised||0),this.setUniform("u_face0Disgusted","float",x.disgusted||0),this.setUniform("u_face0Fearful","float",x.fearful||0),this.setUniform("u_face0BrowDownLeft","float",b.browDownLeft||0),this.setUniform("u_face0BrowDownRight","float",b.browDownRight||0),this.setUniform("u_face0BrowInnerUp","float",b.browInnerUp||0),this.setUniform("u_face0BrowOuterUpLeft","float",b.browOuterUpLeft||0),this.setUniform("u_face0BrowOuterUpRight","float",b.browOuterUpRight||0),this.setUniform("u_face0CheekPuff","float",b.cheekPuff||0),this.setUniform("u_face0CheekSquintLeft","float",b.cheekSquintLeft||0),this.setUniform("u_face0CheekSquintRight","float",b.cheekSquintRight||0),this.setUniform("u_face0EyeBlinkLeft","float",b.eyeBlinkLeft||0),this.setUniform("u_face0EyeBlinkRight","float",b.eyeBlinkRight||0),this.setUniform("u_face0EyeLookDownLeft","float",b.eyeLookDownLeft||0),this.setUniform("u_face0EyeLookDownRight","float",b.eyeLookDownRight||0),this.setUniform("u_face0EyeLookInLeft","float",b.eyeLookInLeft||0),this.setUniform("u_face0EyeLookInRight","float",b.eyeLookInRight||0),this.setUniform("u_face0EyeLookOutLeft","float",b.eyeLookOutLeft||0),this.setUniform("u_face0EyeLookOutRight","float",b.eyeLookOutRight||0),this.setUniform("u_face0EyeLookUpLeft","float",b.eyeLookUpLeft||0),this.setUniform("u_face0EyeLookUpRight","float",b.eyeLookUpRight||0),this.setUniform("u_face0EyeSquintLeft","float",b.eyeSquintLeft||0),this.setUniform("u_face0EyeSquintRight","float",b.eyeSquintRight||0),this.setUniform("u_face0EyeWideLeft","float",b.eyeWideLeft||0),this.setUniform("u_face0EyeWideRight","float",b.eyeWideRight||0),this.setUniform("u_face0JawForward","float",b.jawForward||0),this.setUniform("u_face0JawLeft","float",b.jawLeft||0),this.setUniform("u_face0JawOpen","float",b.jawOpen||0),this.setUniform("u_face0JawRight","float",b.jawRight||0),this.setUniform("u_face0MouthClose","float",b.mouthClose||0),this.setUniform("u_face0MouthDimpleLeft","float",b.mouthDimpleLeft||0),this.setUniform("u_face0MouthDimpleRight","float",b.mouthDimpleRight||0),this.setUniform("u_face0MouthFrownLeft","float",b.mouthFrownLeft||0),this.setUniform("u_face0MouthFrownRight","float",b.mouthFrownRight||0),this.setUniform("u_face0MouthFunnel","float",b.mouthFunnel||0),this.setUniform("u_face0MouthLeft","float",b.mouthLeft||0),this.setUniform("u_face0MouthLowerDownLeft","float",b.mouthLowerDownLeft||0),this.setUniform("u_face0MouthLowerDownRight","float",b.mouthLowerDownRight||0),this.setUniform("u_face0MouthPressLeft","float",b.mouthPressLeft||0),this.setUniform("u_face0MouthPressRight","float",b.mouthPressRight||0),this.setUniform("u_face0MouthPucker","float",b.mouthPucker||0),this.setUniform("u_face0MouthRight","float",b.mouthRight||0),this.setUniform("u_face0MouthRollLower","float",b.mouthRollLower||0),this.setUniform("u_face0MouthRollUpper","float",b.mouthRollUpper||0),this.setUniform("u_face0MouthShrugLower","float",b.mouthShrugLower||0),this.setUniform("u_face0MouthShrugUpper","float",b.mouthShrugUpper||0),this.setUniform("u_face0MouthSmileLeft","float",b.mouthSmileLeft||0),this.setUniform("u_face0MouthSmileRight","float",b.mouthSmileRight||0),this.setUniform("u_face0MouthStretchLeft","float",b.mouthStretchLeft||0),this.setUniform("u_face0MouthStretchRight","float",b.mouthStretchRight||0),this.setUniform("u_face0MouthUpperUpLeft","float",b.mouthUpperUpLeft||0),this.setUniform("u_face0MouthUpperUpRight","float",b.mouthUpperUpRight||0),this.setUniform("u_face0NoseSneerLeft","float",b.noseSneerLeft||0),this.setUniform("u_face0NoseSneerRight","float",b.noseSneerRight||0),this.setUniform("u_face0TongueOut","float",b.tongueOut||0)}else this.setUniform("u_face0Neutral","float",0),this.setUniform("u_face0Happy","float",0),this.setUniform("u_face0Sad","float",0),this.setUniform("u_face0Angry","float",0),this.setUniform("u_face0Surprised","float",0),this.setUniform("u_face0Disgusted","float",0),this.setUniform("u_face0Fearful","float",0),this.setUniform("u_face0BrowDownLeft","float",0),this.setUniform("u_face0BrowDownRight","float",0),this.setUniform("u_face0BrowInnerUp","float",0),this.setUniform("u_face0BrowOuterUpLeft","float",0),this.setUniform("u_face0BrowOuterUpRight","float",0),this.setUniform("u_face0CheekPuff","float",0),this.setUniform("u_face0CheekSquintLeft","float",0),this.setUniform("u_face0CheekSquintRight","float",0),this.setUniform("u_face0EyeBlinkLeft","float",0),this.setUniform("u_face0EyeBlinkRight","float",0),this.setUniform("u_face0EyeLookDownLeft","float",0),this.setUniform("u_face0EyeLookDownRight","float",0),this.setUniform("u_face0EyeLookInLeft","float",0),this.setUniform("u_face0EyeLookInRight","float",0),this.setUniform("u_face0EyeLookOutLeft","float",0),this.setUniform("u_face0EyeLookOutRight","float",0),this.setUniform("u_face0EyeLookUpLeft","float",0),this.setUniform("u_face0EyeLookUpRight","float",0),this.setUniform("u_face0EyeSquintLeft","float",0),this.setUniform("u_face0EyeSquintRight","float",0),this.setUniform("u_face0EyeWideLeft","float",0),this.setUniform("u_face0EyeWideRight","float",0),this.setUniform("u_face0JawForward","float",0),this.setUniform("u_face0JawLeft","float",0),this.setUniform("u_face0JawOpen","float",0),this.setUniform("u_face0JawRight","float",0),this.setUniform("u_face0MouthClose","float",0),this.setUniform("u_face0MouthDimpleLeft","float",0),this.setUniform("u_face0MouthDimpleRight","float",0),this.setUniform("u_face0MouthFrownLeft","float",0),this.setUniform("u_face0MouthFrownRight","float",0),this.setUniform("u_face0MouthFunnel","float",0),this.setUniform("u_face0MouthLeft","float",0),this.setUniform("u_face0MouthLowerDownLeft","float",0),this.setUniform("u_face0MouthLowerDownRight","float",0),this.setUniform("u_face0MouthPressLeft","float",0),this.setUniform("u_face0MouthPressRight","float",0),this.setUniform("u_face0MouthPucker","float",0),this.setUniform("u_face0MouthRight","float",0),this.setUniform("u_face0MouthRollLower","float",0),this.setUniform("u_face0MouthRollUpper","float",0),this.setUniform("u_face0MouthShrugLower","float",0),this.setUniform("u_face0MouthShrugUpper","float",0),this.setUniform("u_face0MouthSmileLeft","float",0),this.setUniform("u_face0MouthSmileRight","float",0),this.setUniform("u_face0MouthStretchLeft","float",0),this.setUniform("u_face0MouthStretchRight","float",0),this.setUniform("u_face0MouthUpperUpLeft","float",0),this.setUniform("u_face0MouthUpperUpRight","float",0),this.setUniform("u_face0NoseSneerLeft","float",0),this.setUniform("u_face0NoseSneerRight","float",0),this.setUniform("u_face0TongueOut","float",0);const P=i.cv?.hands||[],F=this.visibleFeatures.has("handTracking");this.setUniform("u_handCount","int",F?P.length:0);const B=F?P.find(x=>x.handedness==="left"):void 0,N=F?P.find(x=>x.handedness==="right"):void 0;if(B){const x=B.palm||B.landmarks?.[9],b=B.gestures||{},v=B.bounds;this.setUniform("u_leftHandPalm","vec3",[x?.x||0,1-(x?.y||0),x?.z||0]),this.setUniform("u_leftHandConfidence","float",B.confidence||0),this.setUniform("u_leftHandBounds","vec4",[v?.x||0,1-(v?.y||0)-(v?.height||0),v?.width||0,v?.height||0]),this.setUniform("u_leftHandFist","float",b.fist||0),this.setUniform("u_leftHandOpen","float",b.openPalm||0),this.setUniform("u_leftHandPeace","float",b.peace||0),this.setUniform("u_leftHandThumbsUp","float",b.thumbsUp||0),this.setUniform("u_leftHandThumbsDown","float",b.thumbsDown||0),this.setUniform("u_leftHandPointing","float",b.pointing||0),this.setUniform("u_leftHandILoveYou","float",b.iLoveYou||0)}else this.setUniform("u_leftHandPalm","vec3",[0,0,0]),this.setUniform("u_leftHandConfidence","float",0),this.setUniform("u_leftHandBounds","vec4",[0,0,0,0]),this.setUniform("u_leftHandFist","float",0),this.setUniform("u_leftHandOpen","float",0),this.setUniform("u_leftHandPeace","float",0),this.setUniform("u_leftHandThumbsUp","float",0),this.setUniform("u_leftHandThumbsDown","float",0),this.setUniform("u_leftHandPointing","float",0),this.setUniform("u_leftHandILoveYou","float",0);if(N){const x=N.palm||N.landmarks?.[9],b=N.gestures||{},v=N.bounds;this.setUniform("u_rightHandPalm","vec3",[x?.x||0,1-(x?.y||0),x?.z||0]),this.setUniform("u_rightHandConfidence","float",N.confidence||0),this.setUniform("u_rightHandBounds","vec4",[v?.x||0,1-(v?.y||0)-(v?.height||0),v?.width||0,v?.height||0]),this.setUniform("u_rightHandFist","float",b.fist||0),this.setUniform("u_rightHandOpen","float",b.openPalm||0),this.setUniform("u_rightHandPeace","float",b.peace||0),this.setUniform("u_rightHandThumbsUp","float",b.thumbsUp||0),this.setUniform("u_rightHandThumbsDown","float",b.thumbsDown||0),this.setUniform("u_rightHandPointing","float",b.pointing||0),this.setUniform("u_rightHandILoveYou","float",b.iLoveYou||0)}else this.setUniform("u_rightHandPalm","vec3",[0,0,0]),this.setUniform("u_rightHandConfidence","float",0),this.setUniform("u_rightHandBounds","vec4",[0,0,0,0]),this.setUniform("u_rightHandFist","float",0),this.setUniform("u_rightHandOpen","float",0),this.setUniform("u_rightHandPeace","float",0),this.setUniform("u_rightHandThumbsUp","float",0),this.setUniform("u_rightHandThumbsDown","float",0),this.setUniform("u_rightHandPointing","float",0),this.setUniform("u_rightHandILoveYou","float",0);const q=this.visibleFeatures.has("poseDetection")?i.cv?.pose??null:null;if(this.setUniform("u_poseDetected","bool",q!==null),q&&q.landmarks){const x=q.landmarks,b=v=>1-(x[v]?.y||0);this.setUniform("u_poseConfidence","float",q.confidence||0),this.setUniform("u_nosePosition","vec2",[x[0]?.x||0,b(0)]),this.setUniform("u_leftShoulderPosition","vec2",[x[11]?.x||0,b(11)]),this.setUniform("u_rightShoulderPosition","vec2",[x[12]?.x||0,b(12)]),this.setUniform("u_leftElbowPosition","vec2",[x[13]?.x||0,b(13)]),this.setUniform("u_rightElbowPosition","vec2",[x[14]?.x||0,b(14)]),this.setUniform("u_leftWristPosition","vec2",[x[15]?.x||0,b(15)]),this.setUniform("u_rightWristPosition","vec2",[x[16]?.x||0,b(16)]),this.setUniform("u_leftHipPosition","vec2",[x[23]?.x||0,b(23)]),this.setUniform("u_rightHipPosition","vec2",[x[24]?.x||0,b(24)]),this.setUniform("u_leftKneePosition","vec2",[x[25]?.x||0,b(25)]),this.setUniform("u_rightKneePosition","vec2",[x[26]?.x||0,b(26)]),this.setUniform("u_leftAnklePosition","vec2",[x[27]?.x||0,b(27)]),this.setUniform("u_rightAnklePosition","vec2",[x[28]?.x||0,b(28)])}else this.setUniform("u_poseConfidence","float",0),this.setUniform("u_nosePosition","vec2",[0,0]),this.setUniform("u_leftShoulderPosition","vec2",[0,0]),this.setUniform("u_rightShoulderPosition","vec2",[0,0]),this.setUniform("u_leftElbowPosition","vec2",[0,0]),this.setUniform("u_rightElbowPosition","vec2",[0,0]),this.setUniform("u_leftWristPosition","vec2",[0,0]),this.setUniform("u_rightWristPosition","vec2",[0,0]),this.setUniform("u_leftHipPosition","vec2",[0,0]),this.setUniform("u_rightHipPosition","vec2",[0,0]),this.setUniform("u_leftKneePosition","vec2",[0,0]),this.setUniform("u_rightKneePosition","vec2",[0,0]),this.setUniform("u_leftAnklePosition","vec2",[0,0]),this.setUniform("u_rightAnklePosition","vec2",[0,0]);const J=this.visibleFeatures.has("bodySegmentation")?i.cv?.segmentation??null:null;J?(this.updateSegmentationTexture(J.mask,J.width,J.height),this.setUniform("u_segmentationRes","vec2",[J.width,J.height])):this.setUniform("u_segmentationRes","vec2",[0,0]);const K=t.device;if(K){const x=K.motion;x?.acceleration?this.setUniform("u_deviceAcceleration","vec3",[x.acceleration.x??0,x.acceleration.y??0,x.acceleration.z??0]):this.setUniform("u_deviceAcceleration","vec3",[0,0,0]),x?.accelerationIncludingGravity?this.setUniform("u_deviceAccelerationGravity","vec3",[x.accelerationIncludingGravity.x??0,x.accelerationIncludingGravity.y??0,x.accelerationIncludingGravity.z??0]):this.setUniform("u_deviceAccelerationGravity","vec3",[0,0,0]),x?.rotationRate?this.setUniform("u_deviceRotationRate","vec3",[x.rotationRate.alpha??0,x.rotationRate.beta??0,x.rotationRate.gamma??0]):this.setUniform("u_deviceRotationRate","vec3",[0,0,0]);const b=K.orientation;b?(this.setUniform("u_deviceOrientation","vec3",[b.alpha??0,b.beta??0,b.gamma??0]),this.setUniform("u_deviceOrientationAbsolute","bool",b.absolute)):(this.setUniform("u_deviceOrientation","vec3",[0,0,0]),this.setUniform("u_deviceOrientationAbsolute","bool",false))}else this.setUniform("u_deviceAcceleration","vec3",[0,0,0]),this.setUniform("u_deviceAccelerationGravity","vec3",[0,0,0]),this.setUniform("u_deviceRotationRate","vec3",[0,0,0]),this.setUniform("u_deviceOrientation","vec3",[0,0,0]),this.setUniform("u_deviceOrientationAbsolute","bool",false);const X=t.devices||[],re=Math.min(X.length,ze.MAX_EXTERNAL_DEVICES);this.setUniform("u_externalDeviceCount","int",re);for(let x=0;x<ze.MAX_EXTERNAL_DEVICES;x++)if(x<re){const b=X[x],v=b.motion;v?.acceleration?this.setUniform(`u_device${x}Acceleration`,"vec3",[v.acceleration.x??0,v.acceleration.y??0,v.acceleration.z??0]):this.setUniform(`u_device${x}Acceleration`,"vec3",[0,0,0]),v?.accelerationIncludingGravity?this.setUniform(`u_device${x}AccelerationGravity`,"vec3",[v.accelerationIncludingGravity.x??0,v.accelerationIncludingGravity.y??0,v.accelerationIncludingGravity.z??0]):this.setUniform(`u_device${x}AccelerationGravity`,"vec3",[0,0,0]),v?.rotationRate?this.setUniform(`u_device${x}RotationRate`,"vec3",[v.rotationRate.alpha??0,v.rotationRate.beta??0,v.rotationRate.gamma??0]):this.setUniform(`u_device${x}RotationRate`,"vec3",[0,0,0]);const V=b.orientation;V?this.setUniform(`u_device${x}Orientation`,"vec3",[V.alpha??0,V.beta??0,V.gamma??0]):this.setUniform(`u_device${x}Orientation`,"vec3",[0,0,0])}else this.setUniform(`u_device${x}Acceleration`,"vec3",[0,0,0]),this.setUniform(`u_device${x}AccelerationGravity`,"vec3",[0,0,0]),this.setUniform(`u_device${x}RotationRate`,"vec3",[0,0,0]),this.setUniform(`u_device${x}Orientation`,"vec3",[0,0,0])}updateAccumulators(t,s){const i=t.deltaTime||0;for(const n of this.parameters){if(n.type!=="accumulator")continue;const a=n.config.rate;let o;if(typeof a=="number")o=a;else{const h=s.get(a);h!==void 0?o=h.value??0:this.scalarUniformCache.has(a)?o=this.scalarUniformCache.get(a):(this.accumulatorWarned.has(n.uniformName)||(console.warn(`Accumulator '${n.uniformName}': rate source '${a}' not found, using 0`),this.accumulatorWarned.add(n.uniformName)),o=0)}const l=(this.accumulatorValues.get(n.uniformName)??0)+o*i;this.accumulatorValues.set(n.uniformName,l),this.setUniform(n.uniformName,"float",l)}}updateParameterUniforms(t){for(const s of this.parameters){if(s.type==="accumulator")continue;const i=t.get(s.uniformName);if(!i){s.type!=="cv"&&Math.random()<.01&&console.log(`[ShaderAdapter] Parameter '${s.uniformName}' not found in parameterObjects`);continue}const n=i.value;switch(s.type){case"slider":case"number":this.setUniform(s.uniformName,"float",n);break;case"color":{const a=n;this.colorVec3CacheKey.get(s.uniformName)!==a&&(this.colorVec3Cache.set(s.uniformName,Ql(a)),this.colorVec3CacheKey.set(s.uniformName,a)),this.setUniform(s.uniformName,"vec3",this.colorVec3Cache.get(s.uniformName));break}case"toggle":case"cv":this.setUniform(s.uniformName,"bool",n);break;case"select":{const a=s.config.options?.indexOf(n)||0;this.setUniform(s.uniformName,"int",a);break}case"image":n&&this.updateImageTexture(s.uniformName,n);break;case"button":this.setUniform(s.uniformName,"bool",n);break;case"coordinate":n&&typeof n=="object"&&"x"in n&&"y"in n&&this.setUniform(s.uniformName,"vec2",[n.x,n.y]);break}}}setUniform(t,s,i){switch(s){case"float":this.scalarUniformCache.set(t,i);break;case"int":this.scalarUniformCache.set(t,i);break;case"bool":this.scalarUniformCache.set(t,i?1:0);break;case"vec2":this.scalarUniformCache.set(t+".x",i[0]),this.scalarUniformCache.set(t+".y",i[1]);break;case"vec3":this.scalarUniformCache.set(t+".x",i[0]),this.scalarUniformCache.set(t+".y",i[1]),this.scalarUniformCache.set(t+".z",i[2]);break;case"vec4":this.scalarUniformCache.set(t+".x",i[0]),this.scalarUniformCache.set(t+".y",i[1]),this.scalarUniformCache.set(t+".z",i[2]),this.scalarUniformCache.set(t+".w",i[3]);break}const n=this.uniformLocations.get(t);if(n==null)return;const a=this.gl;switch(s){case"float":a.uniform1f(n,i);break;case"int":a.uniform1i(n,i);break;case"bool":a.uniform1i(n,i?1:0);break;case"vec2":a.uniform2f(n,i[0],i[1]);break;case"vec3":a.uniform3f(n,i[0],i[1],i[2]);break;case"vec4":a.uniform4f(n,i[0],i[1],i[2],i[3]);break}}updateAudioFFTTexture(t){const s=this.gl,i=this.textureUnits.get("u_audioFFT");this.audioFFTTexture||(this.audioFFTTexture=s.createTexture()),s.activeTexture(s.TEXTURE0+i),s.bindTexture(s.TEXTURE_2D,this.audioFFTTexture),s.texImage2D(s.TEXTURE_2D,0,s.LUMINANCE,t.length,1,0,s.LUMINANCE,s.UNSIGNED_BYTE,t),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_MIN_FILTER,s.NEAREST),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_MAG_FILTER,s.NEAREST),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_WRAP_S,s.CLAMP_TO_EDGE),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_WRAP_T,s.CLAMP_TO_EDGE);const n=this.uniformLocations.get("u_audioFFT");n&&s.uniform1i(n,i)}updateAudioWaveformTexture(t){const s=this.gl,i=this.textureUnits.get("u_audioWaveform");this.audioWaveformTexture||(this.audioWaveformTexture=s.createTexture());const n=new Uint8Array(t.length);for(let o=0;o<t.length;o++)n[o]=Math.round((t[o]*.5+.5)*255);s.activeTexture(s.TEXTURE0+i),s.bindTexture(s.TEXTURE_2D,this.audioWaveformTexture),s.texImage2D(s.TEXTURE_2D,0,s.LUMINANCE,n.length,1,0,s.LUMINANCE,s.UNSIGNED_BYTE,n),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_MIN_FILTER,s.NEAREST),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_MAG_FILTER,s.NEAREST),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_WRAP_S,s.CLAMP_TO_EDGE),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_WRAP_T,s.CLAMP_TO_EDGE);const a=this.uniformLocations.get("u_audioWaveform");a&&s.uniform1i(a,i)}updateVideoTexture(t){const s=this.gl,i=this.textureUnits.get("u_video");this.videoTexture||(this.videoTexture=s.createTexture()),s.activeTexture(s.TEXTURE0+i),s.bindTexture(s.TEXTURE_2D,this.videoTexture);const n=t instanceof OffscreenCanvas;n&&s.pixelStorei(s.UNPACK_FLIP_Y_WEBGL,true),s.texImage2D(s.TEXTURE_2D,0,s.RGBA,s.RGBA,s.UNSIGNED_BYTE,t),n&&s.pixelStorei(s.UNPACK_FLIP_Y_WEBGL,false),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_MIN_FILTER,s.LINEAR),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_MAG_FILTER,s.LINEAR),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_WRAP_S,s.CLAMP_TO_EDGE),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_WRAP_T,s.CLAMP_TO_EDGE);const a=this.uniformLocations.get("u_video");a&&s.uniform1i(a,i),t instanceof ImageBitmap&&t.close()}updateAnalysedFrameTexture(t){const s=this.gl,i=this.textureUnits.get("u_videoAnalysed");this.analysedFrameTexture||(this.analysedFrameTexture=s.createTexture()),s.activeTexture(s.TEXTURE0+i),s.bindTexture(s.TEXTURE_2D,this.analysedFrameTexture),s.pixelStorei(s.UNPACK_FLIP_Y_WEBGL,true),s.texImage2D(s.TEXTURE_2D,0,s.RGBA,s.RGBA,s.UNSIGNED_BYTE,t),s.pixelStorei(s.UNPACK_FLIP_Y_WEBGL,false),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_MIN_FILTER,s.LINEAR),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_MAG_FILTER,s.LINEAR),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_WRAP_S,s.CLAMP_TO_EDGE),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_WRAP_T,s.CLAMP_TO_EDGE);const n=this.uniformLocations.get("u_videoAnalysed");n&&s.uniform1i(n,i)}bindAnalysedFrameFallback(){const t=this.gl,s=this.textureUnits.get("u_videoAnalysed");if(this.analysedFrameFallbackTexture)t.activeTexture(t.TEXTURE0+s),t.bindTexture(t.TEXTURE_2D,this.analysedFrameFallbackTexture);else{this.analysedFrameFallbackTexture=t.createTexture(),t.activeTexture(t.TEXTURE0+s),t.bindTexture(t.TEXTURE_2D,this.analysedFrameFallbackTexture);const n=new Uint8Array([0,0,0,255]);t.texImage2D(t.TEXTURE_2D,0,t.RGBA,1,1,0,t.RGBA,t.UNSIGNED_BYTE,n),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.NEAREST),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.NEAREST),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE)}const i=this.uniformLocations.get("u_videoAnalysed");i&&t.uniform1i(i,s)}updateVideoStreamTexture(t,s){const i=this.gl,n=`u_videoStream${t}`,a=this.textureUnits.get(n);this.videoStreamTextures[t]||(this.videoStreamTextures[t]=i.createTexture()),i.activeTexture(i.TEXTURE0+a),i.bindTexture(i.TEXTURE_2D,this.videoStreamTextures[t]);const o=s instanceof OffscreenCanvas;o&&i.pixelStorei(i.UNPACK_FLIP_Y_WEBGL,true),i.texImage2D(i.TEXTURE_2D,0,i.RGBA,i.RGBA,i.UNSIGNED_BYTE,s),o&&i.pixelStorei(i.UNPACK_FLIP_Y_WEBGL,false),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MIN_FILTER,i.LINEAR),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MAG_FILTER,i.LINEAR),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_S,i.CLAMP_TO_EDGE),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_T,i.CLAMP_TO_EDGE);const u=this.uniformLocations.get(n);u&&i.uniform1i(u,a),s instanceof ImageBitmap&&s.close()}updateDeviceTexture(t,s){if(!this.gl||t>=ze.MAX_DEVICE_VIDEOS)return;this.deviceTextures[t]||(this.deviceTextures[t]=this.gl.createTexture());const i=this.deviceTextures[t];if(!i)return;const n=this.textureUnits.get(`u_device${t}`);if(n===void 0)return;this.gl.activeTexture(this.gl.TEXTURE0+n),this.gl.bindTexture(this.gl.TEXTURE_2D,i);const a=s instanceof OffscreenCanvas;a&&this.gl.pixelStorei(this.gl.UNPACK_FLIP_Y_WEBGL,true),this.gl.texImage2D(this.gl.TEXTURE_2D,0,this.gl.RGBA,this.gl.RGBA,this.gl.UNSIGNED_BYTE,s),a&&this.gl.pixelStorei(this.gl.UNPACK_FLIP_Y_WEBGL,false),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_MIN_FILTER,this.gl.LINEAR),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_MAG_FILTER,this.gl.LINEAR),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_S,this.gl.CLAMP_TO_EDGE),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_T,this.gl.CLAMP_TO_EDGE);const o=`u_device${t}`,u=this.uniformLocations.get(o);u&&this.gl.uniform1i(u,n),s instanceof ImageBitmap&&s.close()}updateSegmentationTexture(t,s,i){const n=this.gl,a=this.textureUnits.get("u_segmentationMask");this.segmentationTexture||(this.segmentationTexture=n.createTexture()),n.activeTexture(n.TEXTURE0+a),n.bindTexture(n.TEXTURE_2D,this.segmentationTexture),n.pixelStorei(n.UNPACK_FLIP_Y_WEBGL,true),n.texImage2D(n.TEXTURE_2D,0,n.LUMINANCE,s,i,0,n.LUMINANCE,n.UNSIGNED_BYTE,t),n.pixelStorei(n.UNPACK_FLIP_Y_WEBGL,false),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MIN_FILTER,n.NEAREST),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MAG_FILTER,n.NEAREST),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_S,n.CLAMP_TO_EDGE),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_T,n.CLAMP_TO_EDGE);const o=this.uniformLocations.get("u_segmentationMask");o&&n.uniform1i(o,a)}updateKeyboardTexture(t){const s=this.gl,i=this.textureUnits.get("u_keyboard");this.keyboardTexture||(this.keyboardTexture=s.createTexture()),s.activeTexture(s.TEXTURE0+i),s.bindTexture(s.TEXTURE_2D,this.keyboardTexture),s.texImage2D(s.TEXTURE_2D,0,s.LUMINANCE,256,3,0,s.LUMINANCE,s.UNSIGNED_BYTE,t),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_MIN_FILTER,s.NEAREST),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_MAG_FILTER,s.NEAREST),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_WRAP_S,s.CLAMP_TO_EDGE),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_WRAP_T,s.CLAMP_TO_EDGE);const n=this.uniformLocations.get("u_keyboard");n&&s.uniform1i(n,i)}updateImageTexture(t,s){const i=this.gl;this.textureUnits.has(t)||this.textureUnits.set(t,this.nextTextureUnit++);const n=this.textureUnits.get(t);if(!this.textures.has(t)){const u=i.createTexture();u&&this.textures.set(t,u)}const a=this.textures.get(t);if(!a)return;i.activeTexture(i.TEXTURE0+n),i.bindTexture(i.TEXTURE_2D,a),i.texImage2D(i.TEXTURE_2D,0,i.RGBA,i.RGBA,i.UNSIGNED_BYTE,s),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MIN_FILTER,i.LINEAR),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MAG_FILTER,i.LINEAR),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_S,i.CLAMP_TO_EDGE),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_T,i.CLAMP_TO_EDGE);const o=this.uniformLocations.get(t);o&&i.uniform1i(o,n)}resize(t,s){this.gl.viewport(0,0,t,s),this.backbufferEnabled&&this.createBackbufferFramebuffers()}getParameterDefinitions(){return this.parameters}destroy(){this.destroyed=true;const t=this.gl;this.program&&(t.deleteProgram(this.program),this.program=null),this.audioFFTTexture&&t.deleteTexture(this.audioFFTTexture),this.audioWaveformTexture&&t.deleteTexture(this.audioWaveformTexture),this.videoTexture&&t.deleteTexture(this.videoTexture),this.analysedFrameTexture&&t.deleteTexture(this.analysedFrameTexture),this.analysedFrameFallbackTexture&&t.deleteTexture(this.analysedFrameFallbackTexture),this.segmentationTexture&&t.deleteTexture(this.segmentationTexture);for(const s of this.videoStreamTextures)s&&t.deleteTexture(s);this.videoStreamTextures=[];for(const s of this.deviceTextures)s&&t.deleteTexture(s);this.deviceTextures=[];for(const s of this.textures.values())s&&t.deleteTexture(s);this.textures.clear(),this.backbufferFramebuffer&&t.deleteFramebuffer(this.backbufferFramebuffer),this.backbufferTexture&&t.deleteTexture(this.backbufferTexture),this.currentFramebuffer&&t.deleteFramebuffer(this.currentFramebuffer),this.currentTexture&&t.deleteTexture(this.currentTexture),this.quadBuffer&&t.deleteBuffer(this.quadBuffer)}}function Vc(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"&&"BYTES_PER_ELEMENT"in e&&e.BYTES_PER_ELEMENT===1}function Qt(e,t=""){if(typeof e!="number"){const s=t&&`"${t}" `;throw new TypeError(`${s}expected number, got ${typeof e}`)}if(!Number.isSafeInteger(e)||e<0){const s=t&&`"${t}" `;throw new RangeError(`${s}expected integer >= 0, got ${e}`)}}function Ot(e,t,s=""){const i=Vc(e),n=e?.length,a=t!==void 0;if(!i||a&&n!==t){const o=s&&`"${s}" `,u=a?` of length ${t}`:"",l=i?`length=${n}`:`type=${typeof e}`,h=o+"expected Uint8Array"+u+", got "+l;throw i?new RangeError(h):new TypeError(h)}return e}function zi(e){if(typeof e!="function"||typeof e.create!="function")throw new TypeError("Hash must wrapped by utils.createHasher");if(Qt(e.outputLen),Qt(e.blockLen),e.outputLen<1)throw new Error('"outputLen" must be >= 1');if(e.blockLen<1)throw new Error('"blockLen" must be >= 1')}function Si(e,t=true){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(t&&e.finished)throw new Error("Hash#digest() has already been called")}function jc(e,t){Ot(e,void 0,"digestInto() output");const s=t.outputLen;if(e.length<s)throw new RangeError('"digestInto() output" expected to be of length >='+s)}function Ws(...e){for(let t=0;t<e.length;t++)e[t].fill(0)}function an(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}function _t(e,t){return e<<32-t|e>>>t}const $c=typeof Uint8Array.from([]).toHex=="function"&&typeof Uint8Array.fromHex=="function",ph=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function sa(e){if(Ot(e),$c)return e.toHex();let t="";for(let s=0;s<e.length;s++)t+=ph[e[s]];return t}const Lt={_0:48,_9:57,A:65,F:70,a:97,f:102};function io(e){if(e>=Lt._0&&e<=Lt._9)return e-Lt._0;if(e>=Lt.A&&e<=Lt.F)return e-(Lt.A-10);if(e>=Lt.a&&e<=Lt.f)return e-(Lt.a-10)}function qc(e){if(typeof e!="string")throw new TypeError("hex string expected, got "+typeof e);if($c)try{return Uint8Array.fromHex(e)}catch(n){throw n instanceof SyntaxError?new RangeError(n.message):n}const t=e.length,s=t/2;if(t%2)throw new RangeError("hex string expected, got unpadded hex of length "+t);const i=new Uint8Array(s);for(let n=0,a=0;n<s;n++,a+=2){const o=io(e.charCodeAt(a)),u=io(e.charCodeAt(a+1));if(o===void 0||u===void 0){const l=e[a]+e[a+1];throw new RangeError('hex string expected, got non-hex character "'+l+'" at index '+a)}i[n]=o*16+u}return i}function dh(...e){let t=0;for(let i=0;i<e.length;i++){const n=e[i];Ot(n),t+=n.length}const s=new Uint8Array(t);for(let i=0,n=0;i<e.length;i++){const a=e[i];s.set(a,n),n+=a.length}return s}function mh(e,t={}){const s=(n,a)=>e(a).update(n).digest(),i=e(void 0);return s.outputLen=i.outputLen,s.blockLen=i.blockLen,s.canXOF=i.canXOF,s.create=n=>e(n),Object.assign(s,t),Object.freeze(s)}function gh(e=32){Qt(e,"bytesLength");const t=typeof globalThis=="object"?globalThis.crypto:null;if(typeof t?.getRandomValues!="function")throw new Error("crypto.getRandomValues must be defined");if(e>65536)throw new RangeError(`"bytesLength" expected <= 65536, got ${e}`);return t.getRandomValues(new Uint8Array(e))}const bh=e=>({oid:Uint8Array.from([6,9,96,134,72,1,101,3,4,2,e])});function yh(e,t,s){return e&t^~e&s}function _h(e,t,s){return e&t^e&s^t&s}class xh{blockLen;outputLen;canXOF=false;padOffset;isLE;buffer;view;finished=false;length=0;pos=0;destroyed=false;constructor(t,s,i,n){this.blockLen=t,this.outputLen=s,this.padOffset=i,this.isLE=n,this.buffer=new Uint8Array(t),this.view=an(this.buffer)}update(t){Si(this),Ot(t);const{view:s,buffer:i,blockLen:n}=this,a=t.length;for(let o=0;o<a;){const u=Math.min(n-this.pos,a-o);if(u===n){const l=an(t);for(;n<=a-o;o+=n)this.process(l,o);continue}i.set(t.subarray(o,o+u),this.pos),this.pos+=u,o+=u,this.pos===n&&(this.process(s,0),this.pos=0)}return this.length+=t.length,this.roundClean(),this}digestInto(t){Si(this),jc(t,this),this.finished=true;const{buffer:s,view:i,blockLen:n,isLE:a}=this;let{pos:o}=this;s[o++]=128,Ws(this.buffer.subarray(o)),this.padOffset>n-o&&(this.process(i,0),o=0);for(let m=o;m<n;m++)s[m]=0;i.setBigUint64(n-8,BigInt(this.length*8),a),this.process(i,0);const u=an(t),l=this.outputLen;if(l%4)throw new Error("_sha2: outputLen must be aligned to 32bit");const h=l/4,d=this.get();if(h>d.length)throw new Error("_sha2: outputLen bigger than state");for(let m=0;m<h;m++)u.setUint32(4*m,d[m],a)}digest(){const{buffer:t,outputLen:s}=this;this.digestInto(t);const i=t.slice(0,s);return this.destroy(),i}_cloneInto(t){t||=new this.constructor,t.set(...this.get());const{blockLen:s,buffer:i,length:n,finished:a,destroyed:o,pos:u}=this;return t.destroyed=o,t.finished=a,t.length=n,t.pos=u,n%s&&t.buffer.set(i),t}clone(){return this._cloneInto()}}const jt=Uint32Array.from([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),vh=Uint32Array.from([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),$t=new Uint32Array(64);class kh extends xh{constructor(t){super(64,t,8,false)}get(){const{A:t,B:s,C:i,D:n,E:a,F:o,G:u,H:l}=this;return[t,s,i,n,a,o,u,l]}set(t,s,i,n,a,o,u,l){this.A=t|0,this.B=s|0,this.C=i|0,this.D=n|0,this.E=a|0,this.F=o|0,this.G=u|0,this.H=l|0}process(t,s){for(let m=0;m<16;m++,s+=4)$t[m]=t.getUint32(s,false);for(let m=16;m<64;m++){const _=$t[m-15],k=$t[m-2],T=_t(_,7)^_t(_,18)^_>>>3,P=_t(k,17)^_t(k,19)^k>>>10;$t[m]=P+$t[m-7]+T+$t[m-16]|0}let{A:i,B:n,C:a,D:o,E:u,F:l,G:h,H:d}=this;for(let m=0;m<64;m++){const _=_t(u,6)^_t(u,11)^_t(u,25),k=d+_+yh(u,l,h)+vh[m]+$t[m]|0,P=(_t(i,2)^_t(i,13)^_t(i,22))+_h(i,n,a)|0;d=h,h=l,l=u,u=o+k|0,o=a,a=n,n=i,i=k+P|0}i=i+this.A|0,n=n+this.B|0,a=a+this.C|0,o=o+this.D|0,u=u+this.E|0,l=l+this.F|0,h=h+this.G|0,d=d+this.H|0,this.set(i,n,a,o,u,l,h,d)}roundClean(){Ws($t)}destroy(){this.destroyed=true,this.set(0,0,0,0,0,0,0,0),Ws(this.buffer)}}class wh extends kh{A=jt[0]|0;B=jt[1]|0;C=jt[2]|0;D=jt[3]|0;E=jt[4]|0;F=jt[5]|0;G=jt[6]|0;H=jt[7]|0;constructor(){super(32)}}const Hc=mh(()=>new wh,bh(1));const $e=(e,t,s)=>Ot(e,t,s),Wc=Qt,Gc=sa,Wt=(...e)=>dh(...e),In=e=>qc(e),Xc=Vc,Yc=e=>gh(e),Ei=BigInt(0),Cn=BigInt(1);function Gs(e,t=""){if(typeof e!="boolean"){const s=t&&`"${t}" `;throw new TypeError(s+"expected boolean, got type="+typeof e)}return e}function ia(e){if(typeof e=="bigint"){if(!di(e))throw new RangeError("positive bigint expected, got "+e)}else Wc(e);return e}function Rn(e,t=""){if(typeof e!="number"){const s=t&&`"${t}" `;throw new TypeError(s+"expected number, got type="+typeof e)}if(!Number.isSafeInteger(e)){const s=t&&`"${t}" `;throw new RangeError(s+"expected safe integer, got "+e)}}function li(e){const t=ia(e).toString(16);return t.length&1?"0"+t:t}function zc(e){if(typeof e!="string")throw new TypeError("hex string expected, got "+typeof e);return e===""?Ei:BigInt("0x"+e)}function Ki(e){return zc(sa(e))}function Kc(e){return zc(sa(Sh(Ot(e)).reverse()))}function ra(e,t){if(Qt(t),t===0)throw new RangeError("zero length");e=ia(e);const s=e.toString(16);if(s.length>t*2)throw new RangeError("number too large");return qc(s.padStart(t*2,"0"))}function Zc(e,t){return ra(e,t).reverse()}function Sh(e){return Uint8Array.from($e(e))}const di=e=>typeof e=="bigint"&&Ei<=e;function Eh(e,t,s){return di(e)&&di(t)&&di(s)&&t<=e&&e<s}function Qc(e,t,s,i){if(!Eh(t,s,i))throw new RangeError("expected valid "+e+": "+s+" <= n < "+i+", got "+t)}function na(e){if(e<Ei)throw new Error("expected non-negative bigint, got "+e);let t;for(t=0;e>Ei;e>>=Cn,t+=1);return t}const aa=e=>(Cn<<BigInt(e))-Cn;function Th(e,t,s){if(Qt(e,"hashLen"),Qt(t,"qByteLen"),typeof s!="function")throw new TypeError("hmacFn must be a function");const i=F=>new Uint8Array(F),n=Uint8Array.of(),a=Uint8Array.of(0),o=Uint8Array.of(1),u=1e3;let l=i(e),h=i(e),d=0;const m=()=>{l.fill(1),h.fill(0),d=0},_=(...F)=>s(h,Wt(l,...F)),k=(F=n)=>{h=_(a,F),l=_(),F.length!==0&&(h=_(o,F),l=_())},T=()=>{if(d++>=u)throw new Error("drbg: tried max amount of iterations");let F=0;const B=[];for(;F<t;){l=_();const N=l.slice();B.push(N),F+=l.length}return Wt(...B)};return(F,B)=>{m(),k(F);let N;for(;(N=B(T()))===void 0;)k();return m(),N}}function Zi(e,t={},s={}){if(Object.prototype.toString.call(e)!=="[object Object]")throw new TypeError("expected valid options object");function i(a,o,u){if(!u&&o!=="function"&&!Object.hasOwn(e,a))throw new TypeError(`param "${a}" is invalid: expected own property`);const l=e[a];if(u&&l===void 0)return;const h=typeof l;if(h!==o||l===null)throw new TypeError(`param "${a}" is invalid: expected ${o}, got ${h}`)}const n=(a,o)=>Object.entries(a).forEach(([u,l])=>i(u,l,o));n(t,false),n(s,true)}const Ze=BigInt(0),De=BigInt(1),rs=BigInt(2),Jc=BigInt(3),eu=BigInt(4),tu=BigInt(5),Ah=BigInt(7),su=BigInt(8),Ih=BigInt(9),iu=BigInt(16);function lt(e,t){if(t<=Ze)throw new Error("mod: expected positive modulus, got "+t);const s=e%t;return s>=Ze?s:t+s}function ro(e,t){if(e===Ze)throw new Error("invert: expected non-zero number");if(t<=Ze)throw new Error("invert: expected positive modulus, got "+t);let s=lt(e,t),i=t,n=Ze,a=De;for(;s!==Ze;){const u=i/s,l=i-s*u,h=n-a*u;i=s,s=l,n=a,a=h}if(i!==De)throw new Error("invert: does not exist");return lt(n,t)}function oa(e,t,s){const i=e;if(!i.eql(i.sqr(t),s))throw new Error("Cannot find square root")}function ru(e,t){const s=e,i=(s.ORDER+De)/eu,n=s.pow(t,i);return oa(s,n,t),n}function Ch(e,t){const s=e,i=(s.ORDER-tu)/su,n=s.mul(t,rs),a=s.pow(n,i),o=s.mul(t,a),u=s.mul(s.mul(o,rs),a),l=s.mul(o,s.sub(u,s.ONE));return oa(s,l,t),l}function Rh(e){const t=ca(e),s=nu(e),i=s(t,t.neg(t.ONE)),n=s(t,i),a=s(t,t.neg(i)),o=(e+Ah)/iu;return(u,l)=>{const h=u;let d=h.pow(l,o),m=h.mul(d,i);const _=h.mul(d,n),k=h.mul(d,a),T=h.eql(h.sqr(m),l),P=h.eql(h.sqr(_),l);d=h.cmov(d,m,T),m=h.cmov(k,_,P);const F=h.eql(h.sqr(m),l),B=h.cmov(d,m,F);return oa(h,B,l),B}}function nu(e){if(e<Jc)throw new Error("sqrt is not defined for small field");let t=e-De,s=0;for(;t%rs===Ze;)t/=rs,s++;let i=rs;const n=ca(e);for(;no(n,i)===1;)if(i++>1e3)throw new Error("Cannot find square root: probably non-prime P");if(s===1)return ru;let a=n.pow(i,t);const o=(t+De)/rs;return function(l,h){const d=l;if(d.is0(h))return h;if(no(d,h)!==1)throw new Error("Cannot find square root");let m=s,_=d.mul(d.ONE,a),k=d.pow(h,t),T=d.pow(h,o);for(;!d.eql(k,d.ONE);){if(d.is0(k))return d.ZERO;let P=1,F=d.sqr(k);for(;!d.eql(F,d.ONE);)if(P++,F=d.sqr(F),P===m)throw new Error("Cannot find square root");const B=De<<BigInt(m-P-1),N=d.pow(_,B);m=P,_=d.sqr(N),k=d.mul(k,_),T=d.mul(T,N)}return T}}function Ph(e){return e%eu===Jc?ru:e%su===tu?Ch:e%iu===Ih?Rh(e):nu(e)}const Lh=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function Dh(e){const t={ORDER:"bigint",BYTES:"number",BITS:"number"},s=Lh.reduce((i,n)=>(i[n]="function",i),t);if(Zi(e,s),Rn(e.BYTES,"BYTES"),Rn(e.BITS,"BITS"),e.BYTES<1||e.BITS<1)throw new Error("invalid field: expected BYTES/BITS > 0");if(e.ORDER<=De)throw new Error("invalid field: expected ORDER > 1, got "+e.ORDER);return e}function Nh(e,t,s){const i=e;if(s<Ze)throw new Error("invalid exponent, negatives unsupported");if(s===Ze)return i.ONE;if(s===De)return t;let n=i.ONE,a=t;for(;s>Ze;)s&De&&(n=i.mul(n,a)),a=i.sqr(a),s>>=De;return n}function au(e,t,s=false){const i=e,n=new Array(t.length).fill(s?i.ZERO:void 0),a=t.reduce((u,l,h)=>i.is0(l)?u:(n[h]=u,i.mul(u,l)),i.ONE),o=i.inv(a);return t.reduceRight((u,l,h)=>i.is0(l)?u:(n[h]=i.mul(u,n[h]),i.mul(u,l)),o),n}function no(e,t){const s=e,i=(s.ORDER-De)/rs,n=s.pow(t,i),a=s.eql(n,s.ONE),o=s.eql(n,s.ZERO),u=s.eql(n,s.neg(s.ONE));if(!a&&!o&&!u)throw new Error("invalid Legendre symbol result");return a?1:o?0:-1}function Fh(e,t){if(t!==void 0&&Wc(t),e<=Ze)throw new Error("invalid n length: expected positive n, got "+e);if(t!==void 0&&t<1)throw new Error("invalid n length: expected positive bit length, got "+t);const s=na(e);if(t!==void 0&&t<s)throw new Error(`invalid n length: expected bit length (${s}) >= n.length (${t})`);const i=t!==void 0?t:s,n=Math.ceil(i/8);return{nBitLength:i,nByteLength:n}}const ao=new WeakMap;class ou{ORDER;BITS;BYTES;isLE;ZERO=Ze;ONE=De;_lengths;_mod;constructor(t,s={}){if(t<=De)throw new Error("invalid field: expected ORDER > 1, got "+t);let i;this.isLE=false,s!=null&&typeof s=="object"&&(typeof s.BITS=="number"&&(i=s.BITS),typeof s.sqrt=="function"&&Object.defineProperty(this,"sqrt",{value:s.sqrt,enumerable:true}),typeof s.isLE=="boolean"&&(this.isLE=s.isLE),s.allowedLengths&&(this._lengths=Object.freeze(s.allowedLengths.slice())),typeof s.modFromBytes=="boolean"&&(this._mod=s.modFromBytes));const{nBitLength:n,nByteLength:a}=Fh(t,i);if(a>2048)throw new Error("invalid field: expected ORDER of <= 2048 bytes");this.ORDER=t,this.BITS=n,this.BYTES=a,Object.freeze(this)}create(t){return lt(t,this.ORDER)}isValid(t){if(typeof t!="bigint")throw new TypeError("invalid field element: expected bigint, got "+typeof t);return Ze<=t&&t<this.ORDER}is0(t){return t===Ze}isValidNot0(t){return!this.is0(t)&&this.isValid(t)}isOdd(t){return(t&De)===De}neg(t){return lt(-t,this.ORDER)}eql(t,s){return t===s}sqr(t){return lt(t*t,this.ORDER)}add(t,s){return lt(t+s,this.ORDER)}sub(t,s){return lt(t-s,this.ORDER)}mul(t,s){return lt(t*s,this.ORDER)}pow(t,s){return Nh(this,t,s)}div(t,s){return lt(t*ro(s,this.ORDER),this.ORDER)}sqrN(t){return t*t}addN(t,s){return t+s}subN(t,s){return t-s}mulN(t,s){return t*s}inv(t){return ro(t,this.ORDER)}sqrt(t){let s=ao.get(this);return s||ao.set(this,s=Ph(this.ORDER)),s(this,t)}toBytes(t){return this.isLE?Zc(t,this.BYTES):ra(t,this.BYTES)}fromBytes(t,s=false){$e(t);const{_lengths:i,BYTES:n,isLE:a,ORDER:o,_mod:u}=this;if(i){if(t.length<1||!i.includes(t.length)||t.length>n)throw new Error("Field.fromBytes: expected "+i+" bytes, got "+t.length);const h=new Uint8Array(n);h.set(t,a?0:h.length-t.length),t=h}if(t.length!==n)throw new Error("Field.fromBytes: expected "+n+" bytes, got "+t.length);let l=a?Kc(t):Ki(t);if(u&&(l=lt(l,o)),!s&&!this.isValid(l))throw new Error("invalid field element: outside of range 0..ORDER");return l}invertBatch(t){return au(this,t)}cmov(t,s,i){return Gs(i,"condition"),i?s:t}}Object.freeze(ou.prototype);function ca(e,t={}){return new ou(e,t)}function cu(e){if(typeof e!="bigint")throw new Error("field order must be bigint");if(e<=De)throw new Error("field order must be greater than 1");const t=na(e-De);return Math.ceil(t/8)}function uu(e){const t=cu(e);return t+Math.ceil(t/2)}function Uh(e,t,s=false){$e(e);const i=e.length,n=cu(t),a=Math.max(uu(t),16);if(i<a||i>1024)throw new Error("expected "+a+"-1024 bytes of input, got "+i);const o=s?Kc(e):Ki(e),u=lt(o,t-De)+De;return s?Zc(u,n):ra(u,n)}const vs=BigInt(0),ns=BigInt(1);function Ti(e,t){const s=t.negate();return e?s:t}function oo(e,t){const s=au(e.Fp,t.map(i=>i.Z));return t.map((i,n)=>e.fromAffine(i.toAffine(s[n])))}function lu(e,t){if(!Number.isSafeInteger(e)||e<=0||e>t)throw new Error("invalid window size, expected [1.."+t+"], got W="+e)}function on(e,t){lu(e,t);const s=Math.ceil(t/e)+1,i=2**(e-1),n=2**e,a=aa(e),o=BigInt(e);return{windows:s,windowSize:i,mask:a,maxNumber:n,shiftBy:o}}function co(e,t,s){const{windowSize:i,mask:n,maxNumber:a,shiftBy:o}=s;let u=Number(e&n),l=e>>o;u>i&&(u-=a,l+=ns);const h=t*i,d=h+Math.abs(u)-1,m=u===0,_=u<0,k=t%2!==0;return{nextN:l,offset:d,isZero:m,isNeg:_,isNegF:k,offsetF:h}}const cn=new WeakMap,hu=new WeakMap;function un(e){return hu.get(e)||1}function uo(e){if(e!==vs)throw new Error("invalid wNAF")}class Mh{BASE;ZERO;Fn;bits;constructor(t,s){this.BASE=t.BASE,this.ZERO=t.ZERO,this.Fn=t.Fn,this.bits=s}_unsafeLadder(t,s,i=this.ZERO){let n=t;for(;s>vs;)s&ns&&(i=i.add(n)),n=n.double(),s>>=ns;return i}precomputeWindow(t,s){const{windows:i,windowSize:n}=on(s,this.bits),a=[];let o=t,u=o;for(let l=0;l<i;l++){u=o,a.push(u);for(let h=1;h<n;h++)u=u.add(o),a.push(u);o=u.double()}return a}wNAF(t,s,i){if(!this.Fn.isValid(i))throw new Error("invalid scalar");let n=this.ZERO,a=this.BASE;const o=on(t,this.bits);for(let u=0;u<o.windows;u++){const{nextN:l,offset:h,isZero:d,isNeg:m,isNegF:_,offsetF:k}=co(i,u,o);i=l,d?a=a.add(Ti(_,s[k])):n=n.add(Ti(m,s[h]))}return uo(i),{p:n,f:a}}wNAFUnsafe(t,s,i,n=this.ZERO){const a=on(t,this.bits);for(let o=0;o<a.windows&&i!==vs;o++){const{nextN:u,offset:l,isZero:h,isNeg:d}=co(i,o,a);if(i=u,!h){const m=s[l];n=n.add(d?m.negate():m)}}return uo(i),n}getPrecomputes(t,s,i){let n=cn.get(s);return n||(n=this.precomputeWindow(s,t),t!==1&&(typeof i=="function"&&(n=i(n)),cn.set(s,n))),n}cached(t,s,i){const n=un(t);return this.wNAF(n,this.getPrecomputes(n,t,i),s)}unsafe(t,s,i,n){const a=un(t);return a===1?this._unsafeLadder(t,s,n):this.wNAFUnsafe(a,this.getPrecomputes(a,t,i),s,n)}createCache(t,s){lu(s,this.bits),hu.set(t,s),cn.delete(t)}hasCache(t){return un(t)!==1}}function Oh(e,t,s,i){let n=t,a=e.ZERO,o=e.ZERO;for(;s>vs||i>vs;)s&ns&&(a=a.add(n)),i&ns&&(o=o.add(n)),n=n.double(),s>>=ns,i>>=ns;return{p1:a,p2:o}}function lo(e,t,s){if(t){if(t.ORDER!==e)throw new Error("Field.ORDER must match order: Fp == p, Fn == n");return Dh(t),t}else return ca(e,{isLE:s})}function Bh(e,t,s={},i){if(i===void 0&&(i=e==="edwards"),!t||typeof t!="object")throw new Error(`expected valid ${e} CURVE object`);for(const l of["p","n","h"]){const h=t[l];if(!(typeof h=="bigint"&&h>vs))throw new Error(`CURVE.${l} must be positive bigint`)}const n=lo(t.p,s.Fp,i),a=lo(t.n,s.Fn,i),u=["Gx","Gy","a","b"];for(const l of u)if(!n.isValid(t[l]))throw new Error(`CURVE.${l} must be valid field element of CURVE.Fp`);return t=Object.freeze(Object.assign({},t)),{CURVE:t,Fp:n,Fn:a}}function Vh(e,t){return function(i){const n=e(i);return{secretKey:n,publicKey:t(n)}}}class ho{oHash;iHash;blockLen;outputLen;canXOF=false;finished=false;destroyed=false;constructor(t,s){if(zi(t),Ot(s,void 0,"key"),this.iHash=t.create(),typeof this.iHash.update!="function")throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;const i=this.blockLen,n=new Uint8Array(i);n.set(s.length>i?t.create().update(s).digest():s);for(let a=0;a<n.length;a++)n[a]^=54;this.iHash.update(n),this.oHash=t.create();for(let a=0;a<n.length;a++)n[a]^=106;this.oHash.update(n),Ws(n)}update(t){return Si(this),this.iHash.update(t),this}digestInto(t){Si(this),jc(t,this),this.finished=true;const s=t.subarray(0,this.outputLen);this.iHash.digestInto(s),this.oHash.update(s),this.oHash.digestInto(s),this.destroy()}digest(){const t=new Uint8Array(this.oHash.outputLen);return this.digestInto(t),t}_cloneInto(t){t||=Object.create(Object.getPrototypeOf(this),{});const{oHash:s,iHash:i,finished:n,destroyed:a,blockLen:o,outputLen:u}=this;return t=t,t.finished=n,t.destroyed=a,t.blockLen=o,t.outputLen=u,t.oHash=s._cloneInto(t.oHash),t.iHash=i._cloneInto(t.iHash),t}clone(){return this._cloneInto()}destroy(){this.destroyed=true,this.oHash.destroy(),this.iHash.destroy()}}const ua=(()=>{const e=(t,s,i)=>new ho(t,s).update(i).digest();return e.create=(t,s)=>new ho(t,s),e})();const fo=(e,t)=>(e+(e>=0?t:-t)/fu)/t;function jh(e,t,s){Qc("scalar",e,xt,s);const[[i,n],[a,o]]=t,u=fo(o*e,s),l=fo(-n*e,s);let h=e-u*i-l*a,d=-u*n-l*o;const m=h<xt,_=d<xt;m&&(h=-h),_&&(d=-d);const k=aa(Math.ceil(na(s)/2))+Gt;if(h<xt||h>=k||d<xt||d>=k)throw new Error("splitScalar (endomorphism): failed for k");return{k1neg:m,k1:h,k2neg:_,k2:d}}function Pn(e){if(!["compact","recovered","der"].includes(e))throw new Error('Signature format must be "compact", "recovered", or "der"');return e}function ln(e,t){Zi(e);const s={};for(let i of Object.keys(t))s[i]=e[i]===void 0?t[i]:e[i];return Gs(s.lowS,"lowS"),Gs(s.prehash,"prehash"),s.format!==void 0&&Pn(s.format),s}class $h extends Error{constructor(t=""){super(t)}}const ht={Err:$h,_tlv:{encode:(e,t)=>{const{Err:s}=ht;if(Rn(e,"tag"),e<0||e>255)throw new s("tlv.encode: wrong tag");if(typeof t!="string")throw new TypeError('"data" expected string, got type='+typeof t);if(t.length&1)throw new s("tlv.encode: unpadded data");const i=t.length/2,n=li(i);if(n.length/2&128)throw new s("tlv.encode: long form length too big");const a=i>127?li(n.length/2|128):"";return li(e)+a+n+t},decode(e,t){const{Err:s}=ht;t=$e(t,void 0,"DER data");let i=0;if(e<0||e>255)throw new s("tlv.encode: wrong tag");if(t.length<2||t[i++]!==e)throw new s("tlv.decode: wrong tlv");const n=t[i++],a=!!(n&128);let o=0;if(!a)o=n;else{const l=n&127;if(!l)throw new s("tlv.decode(long): indefinite length not supported");if(l>4)throw new s("tlv.decode(long): byte length is too big");const h=t.subarray(i,i+l);if(h.length!==l)throw new s("tlv.decode: length bytes not complete");if(h[0]===0)throw new s("tlv.decode(long): zero leftmost byte");for(const d of h)o=o<<8|d;if(i+=l,o<128)throw new s("tlv.decode(long): not minimal encoding")}const u=t.subarray(i,i+o);if(u.length!==o)throw new s("tlv.decode: wrong value length");return{v:u,l:t.subarray(i+o)}}},_int:{encode(e){const{Err:t}=ht;if(ia(e),e<xt)throw new t("integer: negative integers are not allowed");let s=li(e);if(Number.parseInt(s[0],16)&8&&(s="00"+s),s.length&1)throw new t("unexpected DER parsing assertion: unpadded hex");return s},decode(e){const{Err:t}=ht;if(e.length<1)throw new t("invalid signature integer: empty");if(e[0]&128)throw new t("invalid signature integer: negative");if(e.length>1&&e[0]===0&&!(e[1]&128))throw new t("invalid signature integer: unnecessary leading zero");return Ki(e)}},toSig(e){const{Err:t,_int:s,_tlv:i}=ht,n=$e(e,void 0,"signature"),{v:a,l:o}=i.decode(48,n);if(o.length)throw new t("invalid signature: left bytes after parsing");const{v:u,l}=i.decode(2,a),{v:h,l:d}=i.decode(2,l);if(d.length)throw new t("invalid signature: left bytes after parsing");return{r:s.decode(u),s:s.decode(h)}},hexFromSig(e){const{_tlv:t,_int:s}=ht,i=t.encode(2,s.encode(e.r)),n=t.encode(2,s.encode(e.s)),a=i+n;return t.encode(48,a)}};Object.freeze(ht._tlv);Object.freeze(ht._int);Object.freeze(ht);const xt=BigInt(0),Gt=BigInt(1),fu=BigInt(2),hi=BigInt(3),qh=BigInt(4);function Hh(e,t={}){const s=Bh("weierstrass",e,t),i=s.Fp,n=s.Fn;let a=s.CURVE;const{h:o,n:u}=a;Zi(t,{},{allowInfinityPoint:"boolean",clearCofactor:"function",isTorsionFree:"function",fromBytes:"function",toBytes:"function",endo:"object"});const{endo:l,allowInfinityPoint:h}=t;if(l&&(!i.is0(a.a)||typeof l.beta!="bigint"||!Array.isArray(l.basises)))throw new Error('invalid endo: expected "beta": bigint and "basises": array');const d=du(i,n);function m(){if(!i.isOdd)throw new Error("compression is not supported: Field does not have .isOdd()")}function _(b,v,V){if(h&&v.is0())return Uint8Array.of(0);const{x:W,y:M}=v.toAffine(),R=i.toBytes(W);if(Gs(V,"isCompressed"),V){m();const O=!i.isOdd(M);return Wt(pu(O),R)}else return Wt(Uint8Array.of(4),R,i.toBytes(M))}function k(b){$e(b,void 0,"Point");const{publicKey:v,publicKeyUncompressed:V}=d,W=b.length,M=b[0],R=b.subarray(1);if(h&&W===1&&M===0)return{x:i.ZERO,y:i.ZERO};if(W===v&&(M===2||M===3)){const O=i.fromBytes(R);if(!i.isValid(O))throw new Error("bad point: is not on curve, wrong x");const U=F(O);let I;try{I=i.sqrt(U)}catch(te){const ce=te instanceof Error?": "+te.message:"";throw new Error("bad point: is not on curve, sqrt error"+ce)}m();const H=i.isOdd(I);return(M&1)===1!==H&&(I=i.neg(I)),{x:O,y:I}}else if(W===V&&M===4){const O=i.BYTES,U=i.fromBytes(R.subarray(0,O)),I=i.fromBytes(R.subarray(O,O*2));if(!B(U,I))throw new Error("bad point: is not on curve");return{x:U,y:I}}else throw new Error(`bad point: got length ${W}, expected compressed=${v} or uncompressed=${V}`)}const T=t.toBytes===void 0?_:t.toBytes,P=t.fromBytes===void 0?k:t.fromBytes;function F(b){const v=i.sqr(b),V=i.mul(v,b);return i.add(i.add(V,i.mul(b,a.a)),a.b)}function B(b,v){const V=i.sqr(v),W=F(b);return i.eql(V,W)}if(!B(a.Gx,a.Gy))throw new Error("bad curve params: generator point");const N=i.mul(i.pow(a.a,hi),qh),Y=i.mul(i.sqr(a.b),BigInt(27));if(i.is0(i.add(N,Y)))throw new Error("bad curve params: a or b");function q(b,v,V=false){if(!i.isValid(v)||V&&i.is0(v))throw new Error(`bad point coordinate ${b}`);return v}function z(b){if(!(b instanceof X))throw new Error("Weierstrass Point expected")}function J(b){if(!l||!l.basises)throw new Error("no endo");return jh(b,l.basises,n.ORDER)}function K(b,v,V,W,M){return V=new X(i.mul(V.X,b),V.Y,V.Z),v=Ti(W,v),V=Ti(M,V),v.add(V)}class X{static BASE=new X(a.Gx,a.Gy,i.ONE);static ZERO=new X(i.ZERO,i.ONE,i.ZERO);static Fp=i;static Fn=n;X;Y;Z;constructor(v,V,W){this.X=q("x",v),this.Y=q("y",V,true),this.Z=q("z",W),Object.freeze(this)}static CURVE(){return a}static fromAffine(v){const{x:V,y:W}=v||{};if(!v||!i.isValid(V)||!i.isValid(W))throw new Error("invalid affine point");if(v instanceof X)throw new Error("projective point not allowed");return i.is0(V)&&i.is0(W)?X.ZERO:new X(V,W,i.ONE)}static fromBytes(v){const V=X.fromAffine(P($e(v,void 0,"point")));return V.assertValidity(),V}static fromHex(v){return X.fromBytes(In(v))}get x(){return this.toAffine().x}get y(){return this.toAffine().y}precompute(v=8,V=true){return x.createCache(this,v),V||this.multiply(hi),this}assertValidity(){const v=this;if(v.is0()){if(t.allowInfinityPoint&&i.is0(v.X)&&i.eql(v.Y,i.ONE)&&i.is0(v.Z))return;throw new Error("bad point: ZERO")}const{x:V,y:W}=v.toAffine();if(!i.isValid(V)||!i.isValid(W))throw new Error("bad point: x or y not field elements");if(!B(V,W))throw new Error("bad point: equation left != right");if(!v.isTorsionFree())throw new Error("bad point: not in prime-order subgroup")}hasEvenY(){const{y:v}=this.toAffine();if(!i.isOdd)throw new Error("Field doesn't support isOdd");return!i.isOdd(v)}equals(v){z(v);const{X:V,Y:W,Z:M}=this,{X:R,Y:O,Z:U}=v,I=i.eql(i.mul(V,U),i.mul(R,M)),H=i.eql(i.mul(W,U),i.mul(O,M));return I&&H}negate(){return new X(this.X,i.neg(this.Y),this.Z)}double(){const{a:v,b:V}=a,W=i.mul(V,hi),{X:M,Y:R,Z:O}=this;let U=i.ZERO,I=i.ZERO,H=i.ZERO,G=i.mul(M,M),te=i.mul(R,R),ce=i.mul(O,O),oe=i.mul(M,R);return oe=i.add(oe,oe),H=i.mul(M,O),H=i.add(H,H),U=i.mul(v,H),I=i.mul(W,ce),I=i.add(U,I),U=i.sub(te,I),I=i.add(te,I),I=i.mul(U,I),U=i.mul(oe,U),H=i.mul(W,H),ce=i.mul(v,ce),oe=i.sub(G,ce),oe=i.mul(v,oe),oe=i.add(oe,H),H=i.add(G,G),G=i.add(H,G),G=i.add(G,ce),G=i.mul(G,oe),I=i.add(I,G),ce=i.mul(R,O),ce=i.add(ce,ce),G=i.mul(ce,oe),U=i.sub(U,G),H=i.mul(ce,te),H=i.add(H,H),H=i.add(H,H),new X(U,I,H)}add(v){z(v);const{X:V,Y:W,Z:M}=this,{X:R,Y:O,Z:U}=v;let I=i.ZERO,H=i.ZERO,G=i.ZERO;const te=a.a,ce=i.mul(a.b,hi);let oe=i.mul(V,R),w=i.mul(W,O),E=i.mul(M,U),D=i.add(V,W),L=i.add(R,O);D=i.mul(D,L),L=i.add(oe,w),D=i.sub(D,L),L=i.add(V,M);let j=i.add(R,U);return L=i.mul(L,j),j=i.add(oe,E),L=i.sub(L,j),j=i.add(W,M),I=i.add(O,U),j=i.mul(j,I),I=i.add(w,E),j=i.sub(j,I),G=i.mul(te,L),I=i.mul(ce,E),G=i.add(I,G),I=i.sub(w,G),G=i.add(w,G),H=i.mul(I,G),w=i.add(oe,oe),w=i.add(w,oe),E=i.mul(te,E),L=i.mul(ce,L),w=i.add(w,E),E=i.sub(oe,E),E=i.mul(te,E),L=i.add(L,E),oe=i.mul(w,L),H=i.add(H,oe),oe=i.mul(j,L),I=i.mul(D,I),I=i.sub(I,oe),oe=i.mul(D,w),G=i.mul(j,G),G=i.add(G,oe),new X(I,H,G)}subtract(v){return z(v),this.add(v.negate())}is0(){return this.equals(X.ZERO)}multiply(v){const{endo:V}=t;if(!n.isValidNot0(v))throw new RangeError("invalid scalar: out of range");let W,M;const R=O=>x.cached(this,O,U=>oo(X,U));if(V){const{k1neg:O,k1:U,k2neg:I,k2:H}=J(v),{p:G,f:te}=R(U),{p:ce,f:oe}=R(H);M=te.add(oe),W=K(V.beta,G,ce,O,I)}else{const{p:O,f:U}=R(v);W=O,M=U}return oo(X,[W,M])[0]}multiplyUnsafe(v){const{endo:V}=t,W=this,M=v;if(!n.isValid(M))throw new RangeError("invalid scalar: out of range");if(M===xt||W.is0())return X.ZERO;if(M===Gt)return W;if(x.hasCache(this))return this.multiply(M);if(V){const{k1neg:R,k1:O,k2neg:U,k2:I}=J(M),{p1:H,p2:G}=Oh(X,W,O,I);return K(V.beta,H,G,R,U)}else return x.unsafe(W,M)}toAffine(v){const V=this;let W=v;const{X:M,Y:R,Z:O}=V;if(i.eql(O,i.ONE))return{x:M,y:R};const U=V.is0();W==null&&(W=U?i.ONE:i.inv(O));const I=i.mul(M,W),H=i.mul(R,W),G=i.mul(O,W);if(U)return{x:i.ZERO,y:i.ZERO};if(!i.eql(G,i.ONE))throw new Error("invZ was invalid");return{x:I,y:H}}isTorsionFree(){const{isTorsionFree:v}=t;return o===Gt?true:v?v(X,this):x.unsafe(this,u).is0()}clearCofactor(){const{clearCofactor:v}=t;return o===Gt?this:v?v(X,this):this.multiplyUnsafe(o)}isSmallOrder(){return o===Gt?this.is0():this.clearCofactor().is0()}toBytes(v=true){return Gs(v,"isCompressed"),this.assertValidity(),T(X,this,v)}toHex(v=true){return Gc(this.toBytes(v))}toString(){return`<Point ${this.is0()?"ZERO":this.toHex()}>`}}const re=n.BITS,x=new Mh(X,t.endo?Math.ceil(re/2):re);return re>=8&&X.BASE.precompute(8),Object.freeze(X.prototype),Object.freeze(X),X}function pu(e){return Uint8Array.of(e?2:3)}function du(e,t){return{secretKey:t.BYTES,publicKey:1+e.BYTES,publicKeyUncompressed:1+2*e.BYTES,publicKeyHasPrefix:true,signature:2*t.BYTES}}function Wh(e,t={}){const{Fn:s}=e,i=t.randomBytes===void 0?Yc:t.randomBytes,n=Object.assign(du(e.Fp,s),{seed:Math.max(uu(s.ORDER),16)});function a(k){try{const T=s.fromBytes(k);return s.isValidNot0(T)}catch{return false}}function o(k,T){const{publicKey:P,publicKeyUncompressed:F}=n;try{const B=k.length;return T===true&&B!==P||T===false&&B!==F?false:!!e.fromBytes(k)}catch{return false}}function u(k){return k=k===void 0?i(n.seed):k,Uh($e(k,n.seed,"seed"),s.ORDER)}function l(k,T=true){return e.BASE.multiply(s.fromBytes(k)).toBytes(T)}function h(k){const{secretKey:T,publicKey:P,publicKeyUncompressed:F}=n,B=s._lengths;if(!Xc(k))return;const N=$e(k,void 0,"key").length,Y=N===P||N===F,q=N===T||!!B?.includes(N);if(!(Y&&q))return Y}function d(k,T,P=true){if(h(k)===true)throw new Error("first arg must be private key");if(h(T)===false)throw new Error("second arg must be public key");const F=s.fromBytes(k);return e.fromBytes(T).multiply(F).toBytes(P)}const m={isValidSecretKey:a,isValidPublicKey:o,randomSecretKey:u},_=Vh(u,l);return Object.freeze(m),Object.freeze(n),Object.freeze({getPublicKey:l,getSharedSecret:d,keygen:_,Point:e,utils:m,lengths:n})}function Gh(e,t,s={}){const i=t;zi(i),Zi(s,{},{hmac:"function",lowS:"boolean",randomBytes:"function",bits2int:"function",bits2int_modN:"function"}),s=Object.assign({},s);const n=s.randomBytes===void 0?Yc:s.randomBytes,a=s.hmac===void 0?(M,R)=>ua(i,M,R):s.hmac,{Fp:o,Fn:u}=e,{ORDER:l,BITS:h}=u,{keygen:d,getPublicKey:m,getSharedSecret:_,utils:k,lengths:T}=Wh(e,s),P={prehash:true,lowS:typeof s.lowS=="boolean"?s.lowS:true,format:"compact",extraEntropy:false},F=l*fu+Gt<o.ORDER;function B(M){const R=l>>Gt;return M>R}function N(M,R){if(!u.isValidNot0(R))throw new Error(`invalid signature ${M}: out of range 1..Point.Fn.ORDER`);return R}function Y(){if(F)throw new Error('"recovered" sig type is not supported for cofactor >2 curves')}function q(M,R){Pn(R);const O=T.signature,U=R==="compact"?O:R==="recovered"?O+1:void 0;return $e(M,U)}class z{r;s;recovery;constructor(R,O,U){if(this.r=N("r",R),this.s=N("s",O),U!=null){if(Y(),![0,1,2,3].includes(U))throw new Error("invalid recovery id");this.recovery=U}Object.freeze(this)}static fromBytes(R,O=P.format){q(R,O);let U;if(O==="der"){const{r:te,s:ce}=ht.toSig($e(R));return new z(te,ce)}O==="recovered"&&(U=R[0],O="compact",R=R.subarray(1));const I=T.signature/2,H=R.subarray(0,I),G=R.subarray(I,I*2);return new z(u.fromBytes(H),u.fromBytes(G),U)}static fromHex(R,O){return this.fromBytes(In(R),O)}assertRecovery(){const{recovery:R}=this;if(R==null)throw new Error("invalid recovery id: must be present");return R}addRecoveryBit(R){return new z(this.r,this.s,R)}recoverPublicKey(R){const{r:O,s:U}=this,I=this.assertRecovery(),H=I===2||I===3?O+l:O;if(!o.isValid(H))throw new Error("invalid recovery id: sig.r+curve.n != R.x");const G=o.toBytes(H),te=e.fromBytes(Wt(pu((I&1)===0),G)),ce=u.inv(H),oe=K($e(R,void 0,"msgHash")),w=u.create(-oe*ce),E=u.create(U*ce),D=e.BASE.multiplyUnsafe(w).add(te.multiplyUnsafe(E));if(D.is0())throw new Error("invalid recovery: point at infinify");return D.assertValidity(),D}hasHighS(){return B(this.s)}toBytes(R=P.format){if(Pn(R),R==="der")return In(ht.hexFromSig(this));const{r:O,s:U}=this,I=u.toBytes(O),H=u.toBytes(U);return R==="recovered"?(Y(),Wt(Uint8Array.of(this.assertRecovery()),I,H)):Wt(I,H)}toHex(R){return Gc(this.toBytes(R))}}Object.freeze(z.prototype),Object.freeze(z);const J=s.bits2int===void 0?function(R){if(R.length>8192)throw new Error("input is too large");const O=Ki(R),U=R.length*8-h;return U>0?O>>BigInt(U):O}:s.bits2int,K=s.bits2int_modN===void 0?function(R){return u.create(J(R))}:s.bits2int_modN,X=aa(h);function re(M){return Qc("num < 2^"+h,M,xt,X),u.toBytes(M)}function x(M,R){return $e(M,void 0,"message"),R?$e(i(M),void 0,"prehashed message"):M}function b(M,R,O){const{lowS:U,prehash:I,extraEntropy:H}=ln(O,P);M=x(M,I);const G=K(M),te=u.fromBytes(R);if(!u.isValidNot0(te))throw new Error("invalid private key");const ce=[re(te),re(G)];if(H!=null&&H!==false){const D=H===true?n(T.secretKey):H;ce.push($e(D,void 0,"extraEntropy"))}const oe=Wt(...ce),w=G;function E(D){const L=J(D);if(!u.isValidNot0(L))return;const j=u.inv(L),se=e.BASE.multiply(L).toAffine(),ne=u.create(se.x);if(ne===xt)return;const de=u.create(j*u.create(w+ne*te));if(de===xt)return;let Se=(se.x===ne?0:2)|Number(se.y&Gt),ke=de;return U&&B(de)&&(ke=u.neg(de),Se^=1),new z(ne,ke,F?void 0:Se)}return{seed:oe,k2sig:E}}function v(M,R,O={}){const{seed:U,k2sig:I}=b(M,R,O);return Th(i.outputLen,u.BYTES,a)(U,I).toBytes(O.format)}function V(M,R,O,U={}){const{lowS:I,prehash:H,format:G}=ln(U,P);if(O=$e(O,void 0,"publicKey"),R=x(R,H),!Xc(M)){const te=M instanceof z?", use sig.toBytes()":"";throw new Error("verify expects Uint8Array signature"+te)}q(M,G);try{const te=z.fromBytes(M,G),ce=e.fromBytes(O);if(I&&te.hasHighS())return false;const{r:oe,s:w}=te,E=K(R),D=u.inv(w),L=u.create(E*D),j=u.create(oe*D),se=e.BASE.multiplyUnsafe(L).add(ce.multiplyUnsafe(j));return se.is0()?false:u.create(se.x)===oe}catch{return false}}function W(M,R,O={}){const{prehash:U}=ln(O,P);return R=x(R,U),z.fromBytes(M,"recovered").recoverPublicKey(R).toBytes()}return Object.freeze({keygen:d,getPublicKey:m,getSharedSecret:_,utils:k,lengths:T,Point:e,sign:v,verify:V,recoverPublicKey:W,Signature:z,hash:i})}const Xh={p:BigInt("0xffffffff00000001000000000000000000000000ffffffffffffffffffffffff"),n:BigInt("0xffffffff00000000ffffffffffffffffbce6faada7179e84f3b9cac2fc632551"),h:BigInt(1),a:BigInt("0xffffffff00000001000000000000000000000000fffffffffffffffffffffffc"),b:BigInt("0x5ac635d8aa3a93e7b3ebbd55769886bc651d06b0cc53b0f63bce3c3e27d2604b"),Gx:BigInt("0x6b17d1f2e12c4247f8bce6e563a440f277037d812deb33a0f4a13945d898c296"),Gy:BigInt("0x4fe342e2fe1a7f9b8ee7eb4a7c0f9e162bce33576b315ececbb6406837bf51f5")},Yh=Hh(Xh),zh=Gh(Yh,Hc),po={x:"6bkPbVZXx-c08blVs6qIwm0gfSRLS2nnf2Tsz19ggtM",y:"lhi486ASKQkS8TGbVee-FpdAu7qKaO3gad_4ScX8qJI"},Kh=60;let Ai=null,la=false,Ms=null,Ln=0;function Ii(e){const t=e.replace(/-/g,"+").replace(/_/g,"/"),s=atob(t),i=new Uint8Array(s.length);for(let n=0;n<s.length;n++)i[n]=s.charCodeAt(n);return i}function Zh(e,t){try{const s=Ii(e),i=Ii(t);if(s.length!==32||i.length!==32)return null;const n=new Uint8Array(65);return n[0]=4,n.set(s,1),n.set(i,33),n}catch{return null}}function Qh(e,t){try{const s=e.split(".");if(s.length!==3)return null;const i=new TextEncoder().encode(s[0]+"."+s[1]),n=Ii(s[2]);if(n.length!==64||!zh.verify(n,i,t,{lowS:false}))return null;const a=JSON.parse(new TextDecoder().decode(Ii(s[1])));return{c:a.c??{},e:a.e??0}}catch{return null}}function Jh(e,t){return!(e>0&&e+Kh<t)}async function ef(){Ai=Zh(po.x,po.y),Ai||(la=true,console.warn("[Viji] _SC: key import failed — restricted mode active"))}async function mo(e){const t=la||!Ai?null:Qh(e,Ai);Ms=t?.c??null,Ln=t?.e??0}function tf(e,t){return la||!Ms?t:Jh(Ln,Math.floor(Date.now()/1e3))?typeof Ms[e]=="number"?Ms[e]:t:(Ms=null,Ln=0,t)}const sf="#F1F1F1",ys=28,hn=40,go=24,rf={paths:["M37.5801 32.0859L32.248 40.084C31.9699 40.5012 31.5015 40.7519 31 40.752C30.4985 40.7519 30.0302 40.5012 29.752 40.084L24.4199 32.0859L26.916 30.4219L31 36.5479L35.084 30.4219L37.5801 32.0859Z","M43.0059 39.25C43.0059 40.0784 43.6774 40.75 44.5059 40.75C45.3343 40.75 46.0059 40.0784 46.0059 39.25V31H43.0059V39.25Z","M61.0059 39.25C61.0059 40.0784 61.6774 40.75 62.5059 40.75C63.3343 40.75 64.0059 40.0784 64.0059 39.25V31H61.0059V39.25Z","M55.001 39.5C55.001 42.1883 53.9879 44.6433 52.3262 46.5C52.0009 46.8635 51.6509 47.2044 51.2783 47.5195L49.3408 45.2295C49.6074 45.004 49.858 44.7601 50.0908 44.5C51.2793 43.1721 52.001 41.4218 52.001 39.5H52.0059V31H55.0059V39.5H55.001Z"],dots:[[44.5,26.5],[53.5,26.5],[62.5,26.5]],minX:24.4199,minY:24.625,maxX:64.375,maxY:47.5195,shadowStd:11},nf={paths:["M77.6895 41.1893C78.2752 40.6036 79.2248 40.6036 79.8106 41.1893C80.3963 41.7751 80.3963 42.7246 79.8106 43.3104L43.8106 79.3104C43.2248 79.8962 42.2752 79.8962 41.6895 79.3104C41.1037 78.7246 41.1037 77.7751 41.6895 77.1893L77.6895 41.1893Z","M76.875 78.25C76.875 77.2145 77.7145 76.375 78.75 76.375C79.7855 76.375 80.625 77.2145 80.625 78.25C80.625 79.2855 79.7855 80.125 78.75 80.125C77.7145 80.125 76.875 79.2855 76.875 78.25Z","M77.6895 59.1893C78.2752 58.6036 79.2248 58.6036 79.8106 59.1893C80.3963 59.7751 80.3963 60.7246 79.8106 61.3104L61.8106 79.3104C61.2248 79.8962 60.2752 79.8962 59.6895 79.3104C59.1037 78.7246 59.1037 77.7751 59.6895 77.1893L77.6895 59.1893Z","M44.625 42.25C44.625 43.2855 43.7855 44.125 42.75 44.125C41.7145 44.125 40.875 43.2855 40.875 42.25C40.875 41.2145 41.7145 40.375 42.75 40.375C43.7855 40.375 44.625 41.2145 44.625 42.25Z","M43.8105 61.3107C43.2248 61.8964 42.2752 61.8964 41.6894 61.3107C41.1037 60.7249 41.1037 59.7754 41.6894 59.1896L59.6894 41.1896C60.2752 40.6038 61.2248 40.6038 61.8105 41.1896C62.3963 41.7754 62.3963 42.7249 61.8105 43.3107L43.8105 61.3107Z","M70.9911 99.5C70.9911 102.188 69.978 104.643 68.3163 106.5C67.991 106.863 67.6409 107.204 67.2684 107.52L65.3309 105.229C65.5974 105.004 65.8482 104.76 66.0809 104.5C67.2694 103.172 67.9911 101.422 67.9911 99.5H67.9969V91H70.9969V99.5H70.9911Z","M53.5702 92.2109L48.2382 100.209C47.96 100.626 47.4916 100.877 46.9901 100.877C46.4886 100.877 46.0203 100.626 45.7421 100.209L40.41 92.2109L42.9061 90.5469L46.9901 96.6729L51.0741 90.5469L53.5702 92.2109Z","M76.996 99.375C76.996 100.203 77.6675 100.875 78.496 100.875C79.3244 100.875 79.996 100.203 79.996 99.375V91.125H76.996V99.375Z","M58.9969 99.375C58.9969 100.203 59.6685 100.875 60.4969 100.875C61.3254 100.875 61.9969 100.203 61.9969 99.375V91.125H58.9969V99.375Z"],dots:[],minX:40.41,minY:40.375,maxX:80.625,maxY:107.52,shadowStd:12};let ha=null,fa=null,mu=null,gu=null,Ke=null,Vs=null,Ci=null,qt=null,Dt=-1,Nt=-1,bo=null,bu=0;const af=`
|
|
431
|
+
${l}`);if(t===n.FRAGMENT_SHADER){h.__isShaderCompileError=true;const d=fh(o||"");if(d!==null){const m=d-i;m>=1&&(h.__sourceLocation={line:m})}}throw h}return a}cacheUniformLocations(){if(!this.program)return;const t=this.gl,s=t.getProgramParameter(this.program,t.ACTIVE_UNIFORMS),i=[];for(let n=0;n<s;n++){const a=t.getActiveUniform(this.program,n);if(a){const o=t.getUniformLocation(this.program,a.name);this.uniformLocations.set(a.name,o),(a.name.includes("Stream")||a.name.includes("stream"))&&i.push(a.name)}}i.length>0?console.log("[ShaderAdapter] Stream-related uniforms found:",i):console.log("[ShaderAdapter] NO stream-related uniforms found in shader!")}reserveTextureUnits(){this.textureUnits.set("u_audioFFT",this.nextTextureUnit++),this.textureUnits.set("u_audioWaveform",this.nextTextureUnit++),this.textureUnits.set("u_video",this.nextTextureUnit++),this.textureUnits.set("u_videoAnalysed",this.nextTextureUnit++),this.textureUnits.set("u_segmentationMask",this.nextTextureUnit++),this.textureUnits.set("u_keyboard",this.nextTextureUnit++);for(let t=0;t<ze.MAX_VIDEO_STREAMS;t++)this.textureUnits.set(`u_videoStream${t}`,this.nextTextureUnit++);for(let t=0;t<ze.MAX_DEVICE_VIDEOS;t++)this.textureUnits.set(`u_device${t}`,this.nextTextureUnit++);this.backbufferEnabled&&this.textureUnits.set("backbuffer",this.nextTextureUnit++)}createBackbufferFramebuffers(){const t=this.gl,s=t.canvas.width,i=t.canvas.height,n=()=>{const u=t.createTexture();t.bindTexture(t.TEXTURE_2D,u),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,s,i,0,t.RGBA,t.UNSIGNED_BYTE,null),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE);const l=t.createFramebuffer();return t.bindFramebuffer(t.FRAMEBUFFER,l),t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,u,0),{framebuffer:l,texture:u}},a=n(),o=n();this.backbufferFramebuffer=a.framebuffer,this.backbufferTexture=a.texture,this.currentFramebuffer=o.framebuffer,this.currentTexture=o.texture,t.bindFramebuffer(t.FRAMEBUFFER,null),t.bindTexture(t.TEXTURE_2D,null)}render(t,s){const i=this.gl;if(!this.program||!this.quadBuffer)return console.warn("Shader not initialized"),false;if(i.useProgram(this.program),this.syncCvVisibility(t,s),this.updateBuiltInUniforms(t),this.updateAccumulators(t,s),this.updateParameterUniforms(s),this.backbufferEnabled&&this.backbufferTexture){const a=this.textureUnits.get("backbuffer");a!==void 0&&(i.activeTexture(i.TEXTURE0+a),i.bindTexture(i.TEXTURE_2D,this.backbufferTexture),this.setUniform("backbuffer","sampler2D",a)),i.bindFramebuffer(i.FRAMEBUFFER,this.currentFramebuffer)}const n=i.getAttribLocation(this.program,"a_position");if(i.bindBuffer(i.ARRAY_BUFFER,this.quadBuffer),i.enableVertexAttribArray(n),i.vertexAttribPointer(n,2,i.FLOAT,false,0,0),i.drawArrays(i.TRIANGLE_STRIP,0,4),this.backbufferEnabled){i.bindFramebuffer(i.FRAMEBUFFER,null),i.activeTexture(i.TEXTURE0),i.bindTexture(i.TEXTURE_2D,this.currentTexture),i.drawArrays(i.TRIANGLE_STRIP,0,4);const a=this.backbufferFramebuffer,o=this.backbufferTexture;this.backbufferFramebuffer=this.currentFramebuffer,this.backbufferTexture=this.currentTexture,this.currentFramebuffer=a,this.currentTexture=o}return true}syncCvVisibility(t,s){if(!t.video?.isConnected)return;const i=t.video.cv,n=typeof i.getActiveFeatures=="function"?i.getActiveFeatures():[];for(const[a,o]of this.cvDirectives){let u;if(o.toggleable&&o.paramName){const h=s.get(o.paramName);if(!h)continue;u=h.value===true}else u=true;u?this.visibleFeatures.add(a):this.visibleFeatures.delete(a);const l=n.includes(a);if(u===l){o.lastValue=u;continue}if(o.inFlight){o.pendingValue=u;continue}this.dispatchCvEnable(i,a,u,o)}for(const a of An)this.cvDirectives.has(a)||(n.includes(a)?this.visibleFeatures.add(a):this.visibleFeatures.delete(a))}dispatchCvEnable(t,s,i,n){const a=`enable${s.charAt(0).toUpperCase()}${s.slice(1)}`,o=t[a];typeof o=="function"&&(n.inFlight=true,n.lastValue=i,Promise.resolve(o.call(t,i)).catch(u=>{console.warn(`[ShaderAdapter] ${a}(${i}) failed:`,u)}).finally(()=>{this.destroyed||(n.inFlight=false,delete n.pendingValue)}))}updateBuiltInUniforms(t){this.setUniform("u_resolution","vec2",[t.width,t.height]),this.setUniform("u_time","float",t.time),this.setUniform("u_deltaTime","float",t.deltaTime),this.setUniform("u_frame","int",t.frameCount),this.setUniform("u_fps","float",t.fps),this.setUniform("u_mouse","vec2",[t.mouse.x,t.height-t.mouse.y]),this.setUniform("u_mouseInCanvas","bool",t.mouse.isInCanvas),this.setUniform("u_mousePressed","bool",t.mouse.isPressed),this.setUniform("u_mouseLeft","bool",t.mouse.leftButton),this.setUniform("u_mouseRight","bool",t.mouse.rightButton),this.setUniform("u_mouseMiddle","bool",t.mouse.middleButton),this.setUniform("u_mouseDelta","vec2",[t.mouse.deltaX,-t.mouse.deltaY]),this.setUniform("u_mouseWheel","float",t.mouse.wheelDelta),this.setUniform("u_mouseWasPressed","bool",t.mouse.wasPressed),this.setUniform("u_mouseWasReleased","bool",t.mouse.wasReleased),this.setUniform("u_keySpace","bool",t.keyboard.isPressed(" ")||t.keyboard.isPressed("space")),this.setUniform("u_keyShift","bool",t.keyboard.shift),this.setUniform("u_keyCtrl","bool",t.keyboard.ctrl),this.setUniform("u_keyAlt","bool",t.keyboard.alt),this.setUniform("u_keyW","bool",t.keyboard.isPressed("w")||t.keyboard.isPressed("W")),this.setUniform("u_keyA","bool",t.keyboard.isPressed("a")||t.keyboard.isPressed("A")),this.setUniform("u_keyS","bool",t.keyboard.isPressed("s")||t.keyboard.isPressed("S")),this.setUniform("u_keyD","bool",t.keyboard.isPressed("d")||t.keyboard.isPressed("D")),this.setUniform("u_keyUp","bool",t.keyboard.isPressed("ArrowUp")),this.setUniform("u_keyDown","bool",t.keyboard.isPressed("ArrowDown")),this.setUniform("u_keyLeft","bool",t.keyboard.isPressed("ArrowLeft")),this.setUniform("u_keyRight","bool",t.keyboard.isPressed("ArrowRight")),t.keyboard.textureData&&this.updateKeyboardTexture(t.keyboard.textureData),this.setUniform("u_touchCount","int",t.touches.count);for(let x=0;x<5;x++){const b=t.touches.points[x];b?this.setUniform(`u_touch${x}`,"vec2",[b.x,t.height-b.y]):this.setUniform(`u_touch${x}`,"vec2",[0,0])}this.setUniform("u_pointer","vec2",[t.pointer.x,t.height-t.pointer.y]),this.setUniform("u_pointerDelta","vec2",[t.pointer.deltaX,-t.pointer.deltaY]),this.setUniform("u_pointerDown","bool",t.pointer.isDown),this.setUniform("u_pointerWasPressed","bool",t.pointer.wasPressed),this.setUniform("u_pointerWasReleased","bool",t.pointer.wasReleased),this.setUniform("u_pointerInCanvas","bool",t.pointer.isInCanvas);const s=t.audio;if(this.setUniform("u_audioVolume","float",s.volume?.current||0),this.setUniform("u_audioPeak","float",s.volume?.peak||0),this.setUniform("u_audioVolumeSmoothed","float",s.volume?.smoothed||0),this.setUniform("u_audioLow","float",s.bands?.low||0),this.setUniform("u_audioLowMid","float",s.bands?.lowMid||0),this.setUniform("u_audioMid","float",s.bands?.mid||0),this.setUniform("u_audioHighMid","float",s.bands?.highMid||0),this.setUniform("u_audioHigh","float",s.bands?.high||0),this.setUniform("u_audioLowSmoothed","float",s.bands?.lowSmoothed||0),this.setUniform("u_audioLowMidSmoothed","float",s.bands?.lowMidSmoothed||0),this.setUniform("u_audioMidSmoothed","float",s.bands?.midSmoothed||0),this.setUniform("u_audioHighMidSmoothed","float",s.bands?.highMidSmoothed||0),this.setUniform("u_audioHighSmoothed","float",s.bands?.highSmoothed||0),this.setUniform("u_audioKick","float",s.beat?.kick||0),this.setUniform("u_audioSnare","float",s.beat?.snare||0),this.setUniform("u_audioHat","float",s.beat?.hat||0),this.setUniform("u_audioAny","float",s.beat?.any||0),this.setUniform("u_audioKickSmoothed","float",s.beat?.kickSmoothed||0),this.setUniform("u_audioSnareSmoothed","float",s.beat?.snareSmoothed||0),this.setUniform("u_audioHatSmoothed","float",s.beat?.hatSmoothed||0),this.setUniform("u_audioAnySmoothed","float",s.beat?.anySmoothed||0),this.setUniform("u_audioKickTrigger","bool",s.beat?.triggers?.kick||false),this.setUniform("u_audioSnareTrigger","bool",s.beat?.triggers?.snare||false),this.setUniform("u_audioHatTrigger","bool",s.beat?.triggers?.hat||false),this.setUniform("u_audioAnyTrigger","bool",s.beat?.triggers?.any||false),this.setUniform("u_audioBPM","float",s.beat?.bpm||120),this.setUniform("u_audioConfidence","float",s.beat?.confidence||0),this.setUniform("u_audioIsLocked","bool",s.beat?.isLocked||false),this.setUniform("u_audioBrightness","float",s.spectral?.brightness||0),this.setUniform("u_audioFlatness","float",s.spectral?.flatness||0),s.isConnected){this.updateAudioFFTTexture(s.getFrequencyData());const x=s.getWaveform();x.length>0&&this.updateAudioWaveformTexture(x)}const i=t.video;i.isConnected&&i.currentFrame?(this.updateVideoTexture(i.currentFrame),this.setUniform("u_videoResolution","vec2",[i.frameWidth,i.frameHeight]),this.setUniform("u_videoFrameRate","float",i.frameRate)):(this.setUniform("u_videoResolution","vec2",[0,0]),this.setUniform("u_videoFrameRate","float",0)),i.cv?.analysedFrame instanceof OffscreenCanvas?(this.updateAnalysedFrameTexture(i.cv.analysedFrame),this.setUniform("u_videoAnalysedAvailable","bool",true)):(this.bindAnalysedFrameFallback(),this.setUniform("u_videoAnalysedAvailable","bool",false));const n=t.videoStreams||[],a=Math.min(n.length,ze.MAX_VIDEO_STREAMS);this.setUniform("u_videoStreamCount","int",a);for(let x=0;x<ze.MAX_VIDEO_STREAMS;x++){const b=`u_videoStream${x}Connected`,v=`u_videoStream${x}Resolution`;x<a&&n[x]?.isConnected&&n[x]?.currentFrame?(this.updateVideoStreamTexture(x,n[x].currentFrame),this.setUniform(v,"vec2",[n[x].frameWidth,n[x].frameHeight]),this.setUniform(b,"bool",true)):(this.setUniform(v,"vec2",[0,0]),this.setUniform(b,"bool",false))}const o=t.devices||[],u=Math.min(o.length,ze.MAX_DEVICE_VIDEOS);this.setUniform("u_deviceCount","int",u);for(let x=0;x<ze.MAX_DEVICE_VIDEOS;x++){const b=`u_device${x}Connected`,v=`u_device${x}Resolution`;x<u&&o[x]?.video?.isConnected&&o[x].video.currentFrame?(this.updateDeviceTexture(x,o[x].video.currentFrame),this.setUniform(v,"vec2",[o[x].video.frameWidth,o[x].video.frameHeight]),this.setUniform(b,"bool",true)):(this.setUniform(v,"vec2",[0,0]),this.setUniform(b,"bool",false))}const l=t.audioStreams||[],h=Math.min(l.length,ze.MAX_AUDIO_STREAMS);this.setUniform("u_audioStreamCount","int",h);for(let x=0;x<ze.MAX_AUDIO_STREAMS;x++){const b=`u_audioStream${x}`;if(x<h&&l[x]?.isConnected){const v=l[x];this.setUniform(`${b}Connected`,"bool",true),this.setUniform(`${b}Volume`,"float",v.volume?.current||0),this.setUniform(`${b}Low`,"float",v.bands?.low||0),this.setUniform(`${b}LowMid`,"float",v.bands?.lowMid||0),this.setUniform(`${b}Mid`,"float",v.bands?.mid||0),this.setUniform(`${b}HighMid`,"float",v.bands?.highMid||0),this.setUniform(`${b}High`,"float",v.bands?.high||0),this.setUniform(`${b}Brightness`,"float",v.spectral?.brightness||0),this.setUniform(`${b}Flatness`,"float",v.spectral?.flatness||0)}else this.setUniform(`${b}Connected`,"bool",false),this.setUniform(`${b}Volume`,"float",0),this.setUniform(`${b}Low`,"float",0),this.setUniform(`${b}LowMid`,"float",0),this.setUniform(`${b}Mid`,"float",0),this.setUniform(`${b}HighMid`,"float",0),this.setUniform(`${b}High`,"float",0),this.setUniform(`${b}Brightness`,"float",0),this.setUniform(`${b}Flatness`,"float",0)}const d=i.cv?.faces||[],m=d[0],_=this.visibleFeatures.has("faceDetection")&&!!m,k=this.visibleFeatures.has("faceMesh")&&!!m,T=this.visibleFeatures.has("emotionDetection")&&!!m;if(this.setUniform("u_faceCount","int",this.visibleFeatures.has("faceDetection")?d.length:0),_){const x=m.bounds,b=m.center?.x||0,v=m.center?.y||0;this.setUniform("u_face0Bounds","vec4",[x?.x||0,1-(x?.y||0)-(x?.height||0),x?.width||0,x?.height||0]),this.setUniform("u_face0Center","vec2",[b,1-v]),this.setUniform("u_face0Confidence","float",m.confidence||0)}else this.setUniform("u_face0Bounds","vec4",[0,0,0,0]),this.setUniform("u_face0Center","vec2",[0,0]),this.setUniform("u_face0Confidence","float",0);if(k){const x=m.headPose||{};this.setUniform("u_face0HeadPose","vec3",[x.pitch||0,x.yaw||0,-(x.roll||0)])}else this.setUniform("u_face0HeadPose","vec3",[0,0,0]);if(T){const x=m.expressions||{},b=m.blendshapes||{};this.setUniform("u_face0Neutral","float",x.neutral||0),this.setUniform("u_face0Happy","float",x.happy||0),this.setUniform("u_face0Sad","float",x.sad||0),this.setUniform("u_face0Angry","float",x.angry||0),this.setUniform("u_face0Surprised","float",x.surprised||0),this.setUniform("u_face0Disgusted","float",x.disgusted||0),this.setUniform("u_face0Fearful","float",x.fearful||0),this.setUniform("u_face0BrowDownLeft","float",b.browDownLeft||0),this.setUniform("u_face0BrowDownRight","float",b.browDownRight||0),this.setUniform("u_face0BrowInnerUp","float",b.browInnerUp||0),this.setUniform("u_face0BrowOuterUpLeft","float",b.browOuterUpLeft||0),this.setUniform("u_face0BrowOuterUpRight","float",b.browOuterUpRight||0),this.setUniform("u_face0CheekPuff","float",b.cheekPuff||0),this.setUniform("u_face0CheekSquintLeft","float",b.cheekSquintLeft||0),this.setUniform("u_face0CheekSquintRight","float",b.cheekSquintRight||0),this.setUniform("u_face0EyeBlinkLeft","float",b.eyeBlinkLeft||0),this.setUniform("u_face0EyeBlinkRight","float",b.eyeBlinkRight||0),this.setUniform("u_face0EyeLookDownLeft","float",b.eyeLookDownLeft||0),this.setUniform("u_face0EyeLookDownRight","float",b.eyeLookDownRight||0),this.setUniform("u_face0EyeLookInLeft","float",b.eyeLookInLeft||0),this.setUniform("u_face0EyeLookInRight","float",b.eyeLookInRight||0),this.setUniform("u_face0EyeLookOutLeft","float",b.eyeLookOutLeft||0),this.setUniform("u_face0EyeLookOutRight","float",b.eyeLookOutRight||0),this.setUniform("u_face0EyeLookUpLeft","float",b.eyeLookUpLeft||0),this.setUniform("u_face0EyeLookUpRight","float",b.eyeLookUpRight||0),this.setUniform("u_face0EyeSquintLeft","float",b.eyeSquintLeft||0),this.setUniform("u_face0EyeSquintRight","float",b.eyeSquintRight||0),this.setUniform("u_face0EyeWideLeft","float",b.eyeWideLeft||0),this.setUniform("u_face0EyeWideRight","float",b.eyeWideRight||0),this.setUniform("u_face0JawForward","float",b.jawForward||0),this.setUniform("u_face0JawLeft","float",b.jawLeft||0),this.setUniform("u_face0JawOpen","float",b.jawOpen||0),this.setUniform("u_face0JawRight","float",b.jawRight||0),this.setUniform("u_face0MouthClose","float",b.mouthClose||0),this.setUniform("u_face0MouthDimpleLeft","float",b.mouthDimpleLeft||0),this.setUniform("u_face0MouthDimpleRight","float",b.mouthDimpleRight||0),this.setUniform("u_face0MouthFrownLeft","float",b.mouthFrownLeft||0),this.setUniform("u_face0MouthFrownRight","float",b.mouthFrownRight||0),this.setUniform("u_face0MouthFunnel","float",b.mouthFunnel||0),this.setUniform("u_face0MouthLeft","float",b.mouthLeft||0),this.setUniform("u_face0MouthLowerDownLeft","float",b.mouthLowerDownLeft||0),this.setUniform("u_face0MouthLowerDownRight","float",b.mouthLowerDownRight||0),this.setUniform("u_face0MouthPressLeft","float",b.mouthPressLeft||0),this.setUniform("u_face0MouthPressRight","float",b.mouthPressRight||0),this.setUniform("u_face0MouthPucker","float",b.mouthPucker||0),this.setUniform("u_face0MouthRight","float",b.mouthRight||0),this.setUniform("u_face0MouthRollLower","float",b.mouthRollLower||0),this.setUniform("u_face0MouthRollUpper","float",b.mouthRollUpper||0),this.setUniform("u_face0MouthShrugLower","float",b.mouthShrugLower||0),this.setUniform("u_face0MouthShrugUpper","float",b.mouthShrugUpper||0),this.setUniform("u_face0MouthSmileLeft","float",b.mouthSmileLeft||0),this.setUniform("u_face0MouthSmileRight","float",b.mouthSmileRight||0),this.setUniform("u_face0MouthStretchLeft","float",b.mouthStretchLeft||0),this.setUniform("u_face0MouthStretchRight","float",b.mouthStretchRight||0),this.setUniform("u_face0MouthUpperUpLeft","float",b.mouthUpperUpLeft||0),this.setUniform("u_face0MouthUpperUpRight","float",b.mouthUpperUpRight||0),this.setUniform("u_face0NoseSneerLeft","float",b.noseSneerLeft||0),this.setUniform("u_face0NoseSneerRight","float",b.noseSneerRight||0),this.setUniform("u_face0TongueOut","float",b.tongueOut||0)}else this.setUniform("u_face0Neutral","float",0),this.setUniform("u_face0Happy","float",0),this.setUniform("u_face0Sad","float",0),this.setUniform("u_face0Angry","float",0),this.setUniform("u_face0Surprised","float",0),this.setUniform("u_face0Disgusted","float",0),this.setUniform("u_face0Fearful","float",0),this.setUniform("u_face0BrowDownLeft","float",0),this.setUniform("u_face0BrowDownRight","float",0),this.setUniform("u_face0BrowInnerUp","float",0),this.setUniform("u_face0BrowOuterUpLeft","float",0),this.setUniform("u_face0BrowOuterUpRight","float",0),this.setUniform("u_face0CheekPuff","float",0),this.setUniform("u_face0CheekSquintLeft","float",0),this.setUniform("u_face0CheekSquintRight","float",0),this.setUniform("u_face0EyeBlinkLeft","float",0),this.setUniform("u_face0EyeBlinkRight","float",0),this.setUniform("u_face0EyeLookDownLeft","float",0),this.setUniform("u_face0EyeLookDownRight","float",0),this.setUniform("u_face0EyeLookInLeft","float",0),this.setUniform("u_face0EyeLookInRight","float",0),this.setUniform("u_face0EyeLookOutLeft","float",0),this.setUniform("u_face0EyeLookOutRight","float",0),this.setUniform("u_face0EyeLookUpLeft","float",0),this.setUniform("u_face0EyeLookUpRight","float",0),this.setUniform("u_face0EyeSquintLeft","float",0),this.setUniform("u_face0EyeSquintRight","float",0),this.setUniform("u_face0EyeWideLeft","float",0),this.setUniform("u_face0EyeWideRight","float",0),this.setUniform("u_face0JawForward","float",0),this.setUniform("u_face0JawLeft","float",0),this.setUniform("u_face0JawOpen","float",0),this.setUniform("u_face0JawRight","float",0),this.setUniform("u_face0MouthClose","float",0),this.setUniform("u_face0MouthDimpleLeft","float",0),this.setUniform("u_face0MouthDimpleRight","float",0),this.setUniform("u_face0MouthFrownLeft","float",0),this.setUniform("u_face0MouthFrownRight","float",0),this.setUniform("u_face0MouthFunnel","float",0),this.setUniform("u_face0MouthLeft","float",0),this.setUniform("u_face0MouthLowerDownLeft","float",0),this.setUniform("u_face0MouthLowerDownRight","float",0),this.setUniform("u_face0MouthPressLeft","float",0),this.setUniform("u_face0MouthPressRight","float",0),this.setUniform("u_face0MouthPucker","float",0),this.setUniform("u_face0MouthRight","float",0),this.setUniform("u_face0MouthRollLower","float",0),this.setUniform("u_face0MouthRollUpper","float",0),this.setUniform("u_face0MouthShrugLower","float",0),this.setUniform("u_face0MouthShrugUpper","float",0),this.setUniform("u_face0MouthSmileLeft","float",0),this.setUniform("u_face0MouthSmileRight","float",0),this.setUniform("u_face0MouthStretchLeft","float",0),this.setUniform("u_face0MouthStretchRight","float",0),this.setUniform("u_face0MouthUpperUpLeft","float",0),this.setUniform("u_face0MouthUpperUpRight","float",0),this.setUniform("u_face0NoseSneerLeft","float",0),this.setUniform("u_face0NoseSneerRight","float",0),this.setUniform("u_face0TongueOut","float",0);const P=i.cv?.hands||[],F=this.visibleFeatures.has("handTracking");this.setUniform("u_handCount","int",F?P.length:0);const B=F?P.find(x=>x.handedness==="left"):void 0,N=F?P.find(x=>x.handedness==="right"):void 0;if(B){const x=B.palm||B.landmarks?.[9],b=B.gestures||{},v=B.bounds;this.setUniform("u_leftHandPalm","vec3",[x?.x||0,1-(x?.y||0),x?.z||0]),this.setUniform("u_leftHandConfidence","float",B.confidence||0),this.setUniform("u_leftHandBounds","vec4",[v?.x||0,1-(v?.y||0)-(v?.height||0),v?.width||0,v?.height||0]),this.setUniform("u_leftHandFist","float",b.fist||0),this.setUniform("u_leftHandOpen","float",b.openPalm||0),this.setUniform("u_leftHandPeace","float",b.peace||0),this.setUniform("u_leftHandThumbsUp","float",b.thumbsUp||0),this.setUniform("u_leftHandThumbsDown","float",b.thumbsDown||0),this.setUniform("u_leftHandPointing","float",b.pointing||0),this.setUniform("u_leftHandILoveYou","float",b.iLoveYou||0)}else this.setUniform("u_leftHandPalm","vec3",[0,0,0]),this.setUniform("u_leftHandConfidence","float",0),this.setUniform("u_leftHandBounds","vec4",[0,0,0,0]),this.setUniform("u_leftHandFist","float",0),this.setUniform("u_leftHandOpen","float",0),this.setUniform("u_leftHandPeace","float",0),this.setUniform("u_leftHandThumbsUp","float",0),this.setUniform("u_leftHandThumbsDown","float",0),this.setUniform("u_leftHandPointing","float",0),this.setUniform("u_leftHandILoveYou","float",0);if(N){const x=N.palm||N.landmarks?.[9],b=N.gestures||{},v=N.bounds;this.setUniform("u_rightHandPalm","vec3",[x?.x||0,1-(x?.y||0),x?.z||0]),this.setUniform("u_rightHandConfidence","float",N.confidence||0),this.setUniform("u_rightHandBounds","vec4",[v?.x||0,1-(v?.y||0)-(v?.height||0),v?.width||0,v?.height||0]),this.setUniform("u_rightHandFist","float",b.fist||0),this.setUniform("u_rightHandOpen","float",b.openPalm||0),this.setUniform("u_rightHandPeace","float",b.peace||0),this.setUniform("u_rightHandThumbsUp","float",b.thumbsUp||0),this.setUniform("u_rightHandThumbsDown","float",b.thumbsDown||0),this.setUniform("u_rightHandPointing","float",b.pointing||0),this.setUniform("u_rightHandILoveYou","float",b.iLoveYou||0)}else this.setUniform("u_rightHandPalm","vec3",[0,0,0]),this.setUniform("u_rightHandConfidence","float",0),this.setUniform("u_rightHandBounds","vec4",[0,0,0,0]),this.setUniform("u_rightHandFist","float",0),this.setUniform("u_rightHandOpen","float",0),this.setUniform("u_rightHandPeace","float",0),this.setUniform("u_rightHandThumbsUp","float",0),this.setUniform("u_rightHandThumbsDown","float",0),this.setUniform("u_rightHandPointing","float",0),this.setUniform("u_rightHandILoveYou","float",0);const q=this.visibleFeatures.has("poseDetection")?i.cv?.pose??null:null;if(this.setUniform("u_poseDetected","bool",q!==null),q&&q.landmarks){const x=q.landmarks,b=v=>1-(x[v]?.y||0);this.setUniform("u_poseConfidence","float",q.confidence||0),this.setUniform("u_nosePosition","vec2",[x[0]?.x||0,b(0)]),this.setUniform("u_leftShoulderPosition","vec2",[x[11]?.x||0,b(11)]),this.setUniform("u_rightShoulderPosition","vec2",[x[12]?.x||0,b(12)]),this.setUniform("u_leftElbowPosition","vec2",[x[13]?.x||0,b(13)]),this.setUniform("u_rightElbowPosition","vec2",[x[14]?.x||0,b(14)]),this.setUniform("u_leftWristPosition","vec2",[x[15]?.x||0,b(15)]),this.setUniform("u_rightWristPosition","vec2",[x[16]?.x||0,b(16)]),this.setUniform("u_leftHipPosition","vec2",[x[23]?.x||0,b(23)]),this.setUniform("u_rightHipPosition","vec2",[x[24]?.x||0,b(24)]),this.setUniform("u_leftKneePosition","vec2",[x[25]?.x||0,b(25)]),this.setUniform("u_rightKneePosition","vec2",[x[26]?.x||0,b(26)]),this.setUniform("u_leftAnklePosition","vec2",[x[27]?.x||0,b(27)]),this.setUniform("u_rightAnklePosition","vec2",[x[28]?.x||0,b(28)])}else this.setUniform("u_poseConfidence","float",0),this.setUniform("u_nosePosition","vec2",[0,0]),this.setUniform("u_leftShoulderPosition","vec2",[0,0]),this.setUniform("u_rightShoulderPosition","vec2",[0,0]),this.setUniform("u_leftElbowPosition","vec2",[0,0]),this.setUniform("u_rightElbowPosition","vec2",[0,0]),this.setUniform("u_leftWristPosition","vec2",[0,0]),this.setUniform("u_rightWristPosition","vec2",[0,0]),this.setUniform("u_leftHipPosition","vec2",[0,0]),this.setUniform("u_rightHipPosition","vec2",[0,0]),this.setUniform("u_leftKneePosition","vec2",[0,0]),this.setUniform("u_rightKneePosition","vec2",[0,0]),this.setUniform("u_leftAnklePosition","vec2",[0,0]),this.setUniform("u_rightAnklePosition","vec2",[0,0]);const J=this.visibleFeatures.has("bodySegmentation")?i.cv?.segmentation??null:null;J?(this.updateSegmentationTexture(J.mask,J.width,J.height),this.setUniform("u_segmentationRes","vec2",[J.width,J.height])):this.setUniform("u_segmentationRes","vec2",[0,0]);const K=t.device;if(K){const x=K.motion;x?.acceleration?this.setUniform("u_deviceAcceleration","vec3",[x.acceleration.x??0,x.acceleration.y??0,x.acceleration.z??0]):this.setUniform("u_deviceAcceleration","vec3",[0,0,0]),x?.accelerationIncludingGravity?this.setUniform("u_deviceAccelerationGravity","vec3",[x.accelerationIncludingGravity.x??0,x.accelerationIncludingGravity.y??0,x.accelerationIncludingGravity.z??0]):this.setUniform("u_deviceAccelerationGravity","vec3",[0,0,0]),x?.rotationRate?this.setUniform("u_deviceRotationRate","vec3",[x.rotationRate.alpha??0,x.rotationRate.beta??0,x.rotationRate.gamma??0]):this.setUniform("u_deviceRotationRate","vec3",[0,0,0]);const b=K.orientation;b?(this.setUniform("u_deviceOrientation","vec3",[b.alpha??0,b.beta??0,b.gamma??0]),this.setUniform("u_deviceOrientationAbsolute","bool",b.absolute)):(this.setUniform("u_deviceOrientation","vec3",[0,0,0]),this.setUniform("u_deviceOrientationAbsolute","bool",false))}else this.setUniform("u_deviceAcceleration","vec3",[0,0,0]),this.setUniform("u_deviceAccelerationGravity","vec3",[0,0,0]),this.setUniform("u_deviceRotationRate","vec3",[0,0,0]),this.setUniform("u_deviceOrientation","vec3",[0,0,0]),this.setUniform("u_deviceOrientationAbsolute","bool",false);const X=t.devices||[],re=Math.min(X.length,ze.MAX_EXTERNAL_DEVICES);this.setUniform("u_externalDeviceCount","int",re);for(let x=0;x<ze.MAX_EXTERNAL_DEVICES;x++)if(x<re){const b=X[x],v=b.motion;v?.acceleration?this.setUniform(`u_device${x}Acceleration`,"vec3",[v.acceleration.x??0,v.acceleration.y??0,v.acceleration.z??0]):this.setUniform(`u_device${x}Acceleration`,"vec3",[0,0,0]),v?.accelerationIncludingGravity?this.setUniform(`u_device${x}AccelerationGravity`,"vec3",[v.accelerationIncludingGravity.x??0,v.accelerationIncludingGravity.y??0,v.accelerationIncludingGravity.z??0]):this.setUniform(`u_device${x}AccelerationGravity`,"vec3",[0,0,0]),v?.rotationRate?this.setUniform(`u_device${x}RotationRate`,"vec3",[v.rotationRate.alpha??0,v.rotationRate.beta??0,v.rotationRate.gamma??0]):this.setUniform(`u_device${x}RotationRate`,"vec3",[0,0,0]);const V=b.orientation;V?this.setUniform(`u_device${x}Orientation`,"vec3",[V.alpha??0,V.beta??0,V.gamma??0]):this.setUniform(`u_device${x}Orientation`,"vec3",[0,0,0])}else this.setUniform(`u_device${x}Acceleration`,"vec3",[0,0,0]),this.setUniform(`u_device${x}AccelerationGravity`,"vec3",[0,0,0]),this.setUniform(`u_device${x}RotationRate`,"vec3",[0,0,0]),this.setUniform(`u_device${x}Orientation`,"vec3",[0,0,0])}updateAccumulators(t,s){const i=t.deltaTime||0;for(const n of this.parameters){if(n.type!=="accumulator")continue;const a=n.config.rate;let o;if(typeof a=="number")o=a;else{const h=s.get(a);h!==void 0?o=h.value??0:this.scalarUniformCache.has(a)?o=this.scalarUniformCache.get(a):(this.accumulatorWarned.has(n.uniformName)||(console.warn(`Accumulator '${n.uniformName}': rate source '${a}' not found, using 0`),this.accumulatorWarned.add(n.uniformName)),o=0)}const l=(this.accumulatorValues.get(n.uniformName)??0)+o*i;this.accumulatorValues.set(n.uniformName,l),this.setUniform(n.uniformName,"float",l)}}updateParameterUniforms(t){for(const s of this.parameters){if(s.type==="accumulator")continue;const i=t.get(s.uniformName);if(!i){s.type!=="cv"&&Math.random()<.01&&console.log(`[ShaderAdapter] Parameter '${s.uniformName}' not found in parameterObjects`);continue}const n=i.value;switch(s.type){case"slider":case"number":this.setUniform(s.uniformName,"float",n);break;case"color":{const a=n;this.colorVec3CacheKey.get(s.uniformName)!==a&&(this.colorVec3Cache.set(s.uniformName,Ql(a)),this.colorVec3CacheKey.set(s.uniformName,a)),this.setUniform(s.uniformName,"vec3",this.colorVec3Cache.get(s.uniformName));break}case"toggle":case"cv":this.setUniform(s.uniformName,"bool",n);break;case"select":{const a=s.config.options?.indexOf(n)||0;this.setUniform(s.uniformName,"int",a);break}case"image":n&&this.updateImageTexture(s.uniformName,n);break;case"button":this.setUniform(s.uniformName,"bool",n);break;case"coordinate":n&&typeof n=="object"&&"x"in n&&"y"in n&&this.setUniform(s.uniformName,"vec2",[n.x,n.y]);break}}}setUniform(t,s,i){switch(s){case"float":this.scalarUniformCache.set(t,i);break;case"int":this.scalarUniformCache.set(t,i);break;case"bool":this.scalarUniformCache.set(t,i?1:0);break;case"vec2":this.scalarUniformCache.set(t+".x",i[0]),this.scalarUniformCache.set(t+".y",i[1]);break;case"vec3":this.scalarUniformCache.set(t+".x",i[0]),this.scalarUniformCache.set(t+".y",i[1]),this.scalarUniformCache.set(t+".z",i[2]);break;case"vec4":this.scalarUniformCache.set(t+".x",i[0]),this.scalarUniformCache.set(t+".y",i[1]),this.scalarUniformCache.set(t+".z",i[2]),this.scalarUniformCache.set(t+".w",i[3]);break}const n=this.uniformLocations.get(t);if(n==null)return;const a=this.gl;switch(s){case"float":a.uniform1f(n,i);break;case"int":a.uniform1i(n,i);break;case"bool":a.uniform1i(n,i?1:0);break;case"vec2":a.uniform2f(n,i[0],i[1]);break;case"vec3":a.uniform3f(n,i[0],i[1],i[2]);break;case"vec4":a.uniform4f(n,i[0],i[1],i[2],i[3]);break}}updateAudioFFTTexture(t){const s=this.gl,i=this.textureUnits.get("u_audioFFT");this.audioFFTTexture||(this.audioFFTTexture=s.createTexture()),s.activeTexture(s.TEXTURE0+i),s.bindTexture(s.TEXTURE_2D,this.audioFFTTexture),s.texImage2D(s.TEXTURE_2D,0,s.LUMINANCE,t.length,1,0,s.LUMINANCE,s.UNSIGNED_BYTE,t),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_MIN_FILTER,s.NEAREST),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_MAG_FILTER,s.NEAREST),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_WRAP_S,s.CLAMP_TO_EDGE),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_WRAP_T,s.CLAMP_TO_EDGE);const n=this.uniformLocations.get("u_audioFFT");n&&s.uniform1i(n,i)}updateAudioWaveformTexture(t){const s=this.gl,i=this.textureUnits.get("u_audioWaveform");this.audioWaveformTexture||(this.audioWaveformTexture=s.createTexture());const n=new Uint8Array(t.length);for(let o=0;o<t.length;o++)n[o]=Math.round((t[o]*.5+.5)*255);s.activeTexture(s.TEXTURE0+i),s.bindTexture(s.TEXTURE_2D,this.audioWaveformTexture),s.texImage2D(s.TEXTURE_2D,0,s.LUMINANCE,n.length,1,0,s.LUMINANCE,s.UNSIGNED_BYTE,n),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_MIN_FILTER,s.NEAREST),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_MAG_FILTER,s.NEAREST),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_WRAP_S,s.CLAMP_TO_EDGE),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_WRAP_T,s.CLAMP_TO_EDGE);const a=this.uniformLocations.get("u_audioWaveform");a&&s.uniform1i(a,i)}updateVideoTexture(t){const s=this.gl,i=this.textureUnits.get("u_video");this.videoTexture||(this.videoTexture=s.createTexture()),s.activeTexture(s.TEXTURE0+i),s.bindTexture(s.TEXTURE_2D,this.videoTexture);const n=t instanceof OffscreenCanvas;n&&s.pixelStorei(s.UNPACK_FLIP_Y_WEBGL,true),s.texImage2D(s.TEXTURE_2D,0,s.RGBA,s.RGBA,s.UNSIGNED_BYTE,t),n&&s.pixelStorei(s.UNPACK_FLIP_Y_WEBGL,false),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_MIN_FILTER,s.LINEAR),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_MAG_FILTER,s.LINEAR),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_WRAP_S,s.CLAMP_TO_EDGE),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_WRAP_T,s.CLAMP_TO_EDGE);const a=this.uniformLocations.get("u_video");a&&s.uniform1i(a,i),t instanceof ImageBitmap&&t.close()}updateAnalysedFrameTexture(t){const s=this.gl,i=this.textureUnits.get("u_videoAnalysed");this.analysedFrameTexture||(this.analysedFrameTexture=s.createTexture()),s.activeTexture(s.TEXTURE0+i),s.bindTexture(s.TEXTURE_2D,this.analysedFrameTexture),s.pixelStorei(s.UNPACK_FLIP_Y_WEBGL,true),s.texImage2D(s.TEXTURE_2D,0,s.RGBA,s.RGBA,s.UNSIGNED_BYTE,t),s.pixelStorei(s.UNPACK_FLIP_Y_WEBGL,false),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_MIN_FILTER,s.LINEAR),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_MAG_FILTER,s.LINEAR),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_WRAP_S,s.CLAMP_TO_EDGE),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_WRAP_T,s.CLAMP_TO_EDGE);const n=this.uniformLocations.get("u_videoAnalysed");n&&s.uniform1i(n,i)}bindAnalysedFrameFallback(){const t=this.gl,s=this.textureUnits.get("u_videoAnalysed");if(this.analysedFrameFallbackTexture)t.activeTexture(t.TEXTURE0+s),t.bindTexture(t.TEXTURE_2D,this.analysedFrameFallbackTexture);else{this.analysedFrameFallbackTexture=t.createTexture(),t.activeTexture(t.TEXTURE0+s),t.bindTexture(t.TEXTURE_2D,this.analysedFrameFallbackTexture);const n=new Uint8Array([0,0,0,255]);t.texImage2D(t.TEXTURE_2D,0,t.RGBA,1,1,0,t.RGBA,t.UNSIGNED_BYTE,n),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.NEAREST),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.NEAREST),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE)}const i=this.uniformLocations.get("u_videoAnalysed");i&&t.uniform1i(i,s)}updateVideoStreamTexture(t,s){const i=this.gl,n=`u_videoStream${t}`,a=this.textureUnits.get(n);this.videoStreamTextures[t]||(this.videoStreamTextures[t]=i.createTexture()),i.activeTexture(i.TEXTURE0+a),i.bindTexture(i.TEXTURE_2D,this.videoStreamTextures[t]);const o=s instanceof OffscreenCanvas;o&&i.pixelStorei(i.UNPACK_FLIP_Y_WEBGL,true),i.texImage2D(i.TEXTURE_2D,0,i.RGBA,i.RGBA,i.UNSIGNED_BYTE,s),o&&i.pixelStorei(i.UNPACK_FLIP_Y_WEBGL,false),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MIN_FILTER,i.LINEAR),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MAG_FILTER,i.LINEAR),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_S,i.CLAMP_TO_EDGE),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_T,i.CLAMP_TO_EDGE);const u=this.uniformLocations.get(n);u&&i.uniform1i(u,a),s instanceof ImageBitmap&&s.close()}updateDeviceTexture(t,s){if(!this.gl||t>=ze.MAX_DEVICE_VIDEOS)return;this.deviceTextures[t]||(this.deviceTextures[t]=this.gl.createTexture());const i=this.deviceTextures[t];if(!i)return;const n=this.textureUnits.get(`u_device${t}`);if(n===void 0)return;this.gl.activeTexture(this.gl.TEXTURE0+n),this.gl.bindTexture(this.gl.TEXTURE_2D,i);const a=s instanceof OffscreenCanvas;a&&this.gl.pixelStorei(this.gl.UNPACK_FLIP_Y_WEBGL,true),this.gl.texImage2D(this.gl.TEXTURE_2D,0,this.gl.RGBA,this.gl.RGBA,this.gl.UNSIGNED_BYTE,s),a&&this.gl.pixelStorei(this.gl.UNPACK_FLIP_Y_WEBGL,false),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_MIN_FILTER,this.gl.LINEAR),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_MAG_FILTER,this.gl.LINEAR),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_S,this.gl.CLAMP_TO_EDGE),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_T,this.gl.CLAMP_TO_EDGE);const o=`u_device${t}`,u=this.uniformLocations.get(o);u&&this.gl.uniform1i(u,n),s instanceof ImageBitmap&&s.close()}updateSegmentationTexture(t,s,i){const n=this.gl,a=this.textureUnits.get("u_segmentationMask");this.segmentationTexture||(this.segmentationTexture=n.createTexture()),n.activeTexture(n.TEXTURE0+a),n.bindTexture(n.TEXTURE_2D,this.segmentationTexture),n.pixelStorei(n.UNPACK_FLIP_Y_WEBGL,true),n.texImage2D(n.TEXTURE_2D,0,n.LUMINANCE,s,i,0,n.LUMINANCE,n.UNSIGNED_BYTE,t),n.pixelStorei(n.UNPACK_FLIP_Y_WEBGL,false),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MIN_FILTER,n.NEAREST),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MAG_FILTER,n.NEAREST),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_S,n.CLAMP_TO_EDGE),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_T,n.CLAMP_TO_EDGE);const o=this.uniformLocations.get("u_segmentationMask");o&&n.uniform1i(o,a)}updateKeyboardTexture(t){const s=this.gl,i=this.textureUnits.get("u_keyboard");this.keyboardTexture||(this.keyboardTexture=s.createTexture()),s.activeTexture(s.TEXTURE0+i),s.bindTexture(s.TEXTURE_2D,this.keyboardTexture),s.texImage2D(s.TEXTURE_2D,0,s.LUMINANCE,256,3,0,s.LUMINANCE,s.UNSIGNED_BYTE,t),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_MIN_FILTER,s.NEAREST),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_MAG_FILTER,s.NEAREST),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_WRAP_S,s.CLAMP_TO_EDGE),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_WRAP_T,s.CLAMP_TO_EDGE);const n=this.uniformLocations.get("u_keyboard");n&&s.uniform1i(n,i)}updateImageTexture(t,s){const i=this.gl;this.textureUnits.has(t)||this.textureUnits.set(t,this.nextTextureUnit++);const n=this.textureUnits.get(t);if(!this.textures.has(t)){const u=i.createTexture();u&&this.textures.set(t,u)}const a=this.textures.get(t);if(!a)return;i.activeTexture(i.TEXTURE0+n),i.bindTexture(i.TEXTURE_2D,a),i.texImage2D(i.TEXTURE_2D,0,i.RGBA,i.RGBA,i.UNSIGNED_BYTE,s),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MIN_FILTER,i.LINEAR),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MAG_FILTER,i.LINEAR),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_S,i.CLAMP_TO_EDGE),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_T,i.CLAMP_TO_EDGE);const o=this.uniformLocations.get(t);o&&i.uniform1i(o,n)}resize(t,s){this.gl.viewport(0,0,t,s),this.backbufferEnabled&&this.createBackbufferFramebuffers()}getParameterDefinitions(){return this.parameters}destroy(){this.destroyed=true;const t=this.gl;this.program&&(t.deleteProgram(this.program),this.program=null),this.audioFFTTexture&&t.deleteTexture(this.audioFFTTexture),this.audioWaveformTexture&&t.deleteTexture(this.audioWaveformTexture),this.videoTexture&&t.deleteTexture(this.videoTexture),this.analysedFrameTexture&&t.deleteTexture(this.analysedFrameTexture),this.analysedFrameFallbackTexture&&t.deleteTexture(this.analysedFrameFallbackTexture),this.segmentationTexture&&t.deleteTexture(this.segmentationTexture);for(const s of this.videoStreamTextures)s&&t.deleteTexture(s);this.videoStreamTextures=[];for(const s of this.deviceTextures)s&&t.deleteTexture(s);this.deviceTextures=[];for(const s of this.textures.values())s&&t.deleteTexture(s);this.textures.clear(),this.backbufferFramebuffer&&t.deleteFramebuffer(this.backbufferFramebuffer),this.backbufferTexture&&t.deleteTexture(this.backbufferTexture),this.currentFramebuffer&&t.deleteFramebuffer(this.currentFramebuffer),this.currentTexture&&t.deleteTexture(this.currentTexture),this.quadBuffer&&t.deleteBuffer(this.quadBuffer)}}function Vc(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"&&"BYTES_PER_ELEMENT"in e&&e.BYTES_PER_ELEMENT===1}function Qt(e,t=""){if(typeof e!="number"){const s=t&&`"${t}" `;throw new TypeError(`${s}expected number, got ${typeof e}`)}if(!Number.isSafeInteger(e)||e<0){const s=t&&`"${t}" `;throw new RangeError(`${s}expected integer >= 0, got ${e}`)}}function Ot(e,t,s=""){const i=Vc(e),n=e?.length,a=t!==void 0;if(!i||a&&n!==t){const o=s&&`"${s}" `,u=a?` of length ${t}`:"",l=i?`length=${n}`:`type=${typeof e}`,h=o+"expected Uint8Array"+u+", got "+l;throw i?new RangeError(h):new TypeError(h)}return e}function zi(e){if(typeof e!="function"||typeof e.create!="function")throw new TypeError("Hash must wrapped by utils.createHasher");if(Qt(e.outputLen),Qt(e.blockLen),e.outputLen<1)throw new Error('"outputLen" must be >= 1');if(e.blockLen<1)throw new Error('"blockLen" must be >= 1')}function Si(e,t=true){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(t&&e.finished)throw new Error("Hash#digest() has already been called")}function jc(e,t){Ot(e,void 0,"digestInto() output");const s=t.outputLen;if(e.length<s)throw new RangeError('"digestInto() output" expected to be of length >='+s)}function Ws(...e){for(let t=0;t<e.length;t++)e[t].fill(0)}function an(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}function _t(e,t){return e<<32-t|e>>>t}const $c=typeof Uint8Array.from([]).toHex=="function"&&typeof Uint8Array.fromHex=="function",ph=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function sa(e){if(Ot(e),$c)return e.toHex();let t="";for(let s=0;s<e.length;s++)t+=ph[e[s]];return t}const Lt={_0:48,_9:57,A:65,F:70,a:97,f:102};function io(e){if(e>=Lt._0&&e<=Lt._9)return e-Lt._0;if(e>=Lt.A&&e<=Lt.F)return e-(Lt.A-10);if(e>=Lt.a&&e<=Lt.f)return e-(Lt.a-10)}function qc(e){if(typeof e!="string")throw new TypeError("hex string expected, got "+typeof e);if($c)try{return Uint8Array.fromHex(e)}catch(n){throw n instanceof SyntaxError?new RangeError(n.message):n}const t=e.length,s=t/2;if(t%2)throw new RangeError("hex string expected, got unpadded hex of length "+t);const i=new Uint8Array(s);for(let n=0,a=0;n<s;n++,a+=2){const o=io(e.charCodeAt(a)),u=io(e.charCodeAt(a+1));if(o===void 0||u===void 0){const l=e[a]+e[a+1];throw new RangeError('hex string expected, got non-hex character "'+l+'" at index '+a)}i[n]=o*16+u}return i}function dh(...e){let t=0;for(let i=0;i<e.length;i++){const n=e[i];Ot(n),t+=n.length}const s=new Uint8Array(t);for(let i=0,n=0;i<e.length;i++){const a=e[i];s.set(a,n),n+=a.length}return s}function mh(e,t={}){const s=(n,a)=>e(a).update(n).digest(),i=e(void 0);return s.outputLen=i.outputLen,s.blockLen=i.blockLen,s.canXOF=i.canXOF,s.create=n=>e(n),Object.assign(s,t),Object.freeze(s)}function gh(e=32){Qt(e,"bytesLength");const t=typeof globalThis=="object"?globalThis.crypto:null;if(typeof t?.getRandomValues!="function")throw new Error("crypto.getRandomValues must be defined");if(e>65536)throw new RangeError(`"bytesLength" expected <= 65536, got ${e}`);return t.getRandomValues(new Uint8Array(e))}const bh=e=>({oid:Uint8Array.from([6,9,96,134,72,1,101,3,4,2,e])});function yh(e,t,s){return e&t^~e&s}function _h(e,t,s){return e&t^e&s^t&s}class xh{blockLen;outputLen;canXOF=false;padOffset;isLE;buffer;view;finished=false;length=0;pos=0;destroyed=false;constructor(t,s,i,n){this.blockLen=t,this.outputLen=s,this.padOffset=i,this.isLE=n,this.buffer=new Uint8Array(t),this.view=an(this.buffer)}update(t){Si(this),Ot(t);const{view:s,buffer:i,blockLen:n}=this,a=t.length;for(let o=0;o<a;){const u=Math.min(n-this.pos,a-o);if(u===n){const l=an(t);for(;n<=a-o;o+=n)this.process(l,o);continue}i.set(t.subarray(o,o+u),this.pos),this.pos+=u,o+=u,this.pos===n&&(this.process(s,0),this.pos=0)}return this.length+=t.length,this.roundClean(),this}digestInto(t){Si(this),jc(t,this),this.finished=true;const{buffer:s,view:i,blockLen:n,isLE:a}=this;let{pos:o}=this;s[o++]=128,Ws(this.buffer.subarray(o)),this.padOffset>n-o&&(this.process(i,0),o=0);for(let m=o;m<n;m++)s[m]=0;i.setBigUint64(n-8,BigInt(this.length*8),a),this.process(i,0);const u=an(t),l=this.outputLen;if(l%4)throw new Error("_sha2: outputLen must be aligned to 32bit");const h=l/4,d=this.get();if(h>d.length)throw new Error("_sha2: outputLen bigger than state");for(let m=0;m<h;m++)u.setUint32(4*m,d[m],a)}digest(){const{buffer:t,outputLen:s}=this;this.digestInto(t);const i=t.slice(0,s);return this.destroy(),i}_cloneInto(t){t||=new this.constructor,t.set(...this.get());const{blockLen:s,buffer:i,length:n,finished:a,destroyed:o,pos:u}=this;return t.destroyed=o,t.finished=a,t.length=n,t.pos=u,n%s&&t.buffer.set(i),t}clone(){return this._cloneInto()}}const jt=Uint32Array.from([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),vh=Uint32Array.from([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),$t=new Uint32Array(64);class kh extends xh{constructor(t){super(64,t,8,false)}get(){const{A:t,B:s,C:i,D:n,E:a,F:o,G:u,H:l}=this;return[t,s,i,n,a,o,u,l]}set(t,s,i,n,a,o,u,l){this.A=t|0,this.B=s|0,this.C=i|0,this.D=n|0,this.E=a|0,this.F=o|0,this.G=u|0,this.H=l|0}process(t,s){for(let m=0;m<16;m++,s+=4)$t[m]=t.getUint32(s,false);for(let m=16;m<64;m++){const _=$t[m-15],k=$t[m-2],T=_t(_,7)^_t(_,18)^_>>>3,P=_t(k,17)^_t(k,19)^k>>>10;$t[m]=P+$t[m-7]+T+$t[m-16]|0}let{A:i,B:n,C:a,D:o,E:u,F:l,G:h,H:d}=this;for(let m=0;m<64;m++){const _=_t(u,6)^_t(u,11)^_t(u,25),k=d+_+yh(u,l,h)+vh[m]+$t[m]|0,P=(_t(i,2)^_t(i,13)^_t(i,22))+_h(i,n,a)|0;d=h,h=l,l=u,u=o+k|0,o=a,a=n,n=i,i=k+P|0}i=i+this.A|0,n=n+this.B|0,a=a+this.C|0,o=o+this.D|0,u=u+this.E|0,l=l+this.F|0,h=h+this.G|0,d=d+this.H|0,this.set(i,n,a,o,u,l,h,d)}roundClean(){Ws($t)}destroy(){this.destroyed=true,this.set(0,0,0,0,0,0,0,0),Ws(this.buffer)}}class wh extends kh{A=jt[0]|0;B=jt[1]|0;C=jt[2]|0;D=jt[3]|0;E=jt[4]|0;F=jt[5]|0;G=jt[6]|0;H=jt[7]|0;constructor(){super(32)}}const Hc=mh(()=>new wh,bh(1));const $e=(e,t,s)=>Ot(e,t,s),Wc=Qt,Gc=sa,Wt=(...e)=>dh(...e),In=e=>qc(e),Xc=Vc,Yc=e=>gh(e),Ei=BigInt(0),Cn=BigInt(1);function Gs(e,t=""){if(typeof e!="boolean"){const s=t&&`"${t}" `;throw new TypeError(s+"expected boolean, got type="+typeof e)}return e}function ia(e){if(typeof e=="bigint"){if(!di(e))throw new RangeError("positive bigint expected, got "+e)}else Wc(e);return e}function Rn(e,t=""){if(typeof e!="number"){const s=t&&`"${t}" `;throw new TypeError(s+"expected number, got type="+typeof e)}if(!Number.isSafeInteger(e)){const s=t&&`"${t}" `;throw new RangeError(s+"expected safe integer, got "+e)}}function li(e){const t=ia(e).toString(16);return t.length&1?"0"+t:t}function zc(e){if(typeof e!="string")throw new TypeError("hex string expected, got "+typeof e);return e===""?Ei:BigInt("0x"+e)}function Ki(e){return zc(sa(e))}function Kc(e){return zc(sa(Sh(Ot(e)).reverse()))}function ra(e,t){if(Qt(t),t===0)throw new RangeError("zero length");e=ia(e);const s=e.toString(16);if(s.length>t*2)throw new RangeError("number too large");return qc(s.padStart(t*2,"0"))}function Zc(e,t){return ra(e,t).reverse()}function Sh(e){return Uint8Array.from($e(e))}const di=e=>typeof e=="bigint"&&Ei<=e;function Eh(e,t,s){return di(e)&&di(t)&&di(s)&&t<=e&&e<s}function Qc(e,t,s,i){if(!Eh(t,s,i))throw new RangeError("expected valid "+e+": "+s+" <= n < "+i+", got "+t)}function na(e){if(e<Ei)throw new Error("expected non-negative bigint, got "+e);let t;for(t=0;e>Ei;e>>=Cn,t+=1);return t}const aa=e=>(Cn<<BigInt(e))-Cn;function Th(e,t,s){if(Qt(e,"hashLen"),Qt(t,"qByteLen"),typeof s!="function")throw new TypeError("hmacFn must be a function");const i=F=>new Uint8Array(F),n=Uint8Array.of(),a=Uint8Array.of(0),o=Uint8Array.of(1),u=1e3;let l=i(e),h=i(e),d=0;const m=()=>{l.fill(1),h.fill(0),d=0},_=(...F)=>s(h,Wt(l,...F)),k=(F=n)=>{h=_(a,F),l=_(),F.length!==0&&(h=_(o,F),l=_())},T=()=>{if(d++>=u)throw new Error("drbg: tried max amount of iterations");let F=0;const B=[];for(;F<t;){l=_();const N=l.slice();B.push(N),F+=l.length}return Wt(...B)};return(F,B)=>{m(),k(F);let N;for(;(N=B(T()))===void 0;)k();return m(),N}}function Zi(e,t={},s={}){if(Object.prototype.toString.call(e)!=="[object Object]")throw new TypeError("expected valid options object");function i(a,o,u){if(!u&&o!=="function"&&!Object.hasOwn(e,a))throw new TypeError(`param "${a}" is invalid: expected own property`);const l=e[a];if(u&&l===void 0)return;const h=typeof l;if(h!==o||l===null)throw new TypeError(`param "${a}" is invalid: expected ${o}, got ${h}`)}const n=(a,o)=>Object.entries(a).forEach(([u,l])=>i(u,l,o));n(t,false),n(s,true)}const Ze=BigInt(0),De=BigInt(1),rs=BigInt(2),Jc=BigInt(3),eu=BigInt(4),tu=BigInt(5),Ah=BigInt(7),su=BigInt(8),Ih=BigInt(9),iu=BigInt(16);function lt(e,t){if(t<=Ze)throw new Error("mod: expected positive modulus, got "+t);const s=e%t;return s>=Ze?s:t+s}function ro(e,t){if(e===Ze)throw new Error("invert: expected non-zero number");if(t<=Ze)throw new Error("invert: expected positive modulus, got "+t);let s=lt(e,t),i=t,n=Ze,a=De;for(;s!==Ze;){const u=i/s,l=i-s*u,h=n-a*u;i=s,s=l,n=a,a=h}if(i!==De)throw new Error("invert: does not exist");return lt(n,t)}function oa(e,t,s){const i=e;if(!i.eql(i.sqr(t),s))throw new Error("Cannot find square root")}function ru(e,t){const s=e,i=(s.ORDER+De)/eu,n=s.pow(t,i);return oa(s,n,t),n}function Ch(e,t){const s=e,i=(s.ORDER-tu)/su,n=s.mul(t,rs),a=s.pow(n,i),o=s.mul(t,a),u=s.mul(s.mul(o,rs),a),l=s.mul(o,s.sub(u,s.ONE));return oa(s,l,t),l}function Rh(e){const t=ca(e),s=nu(e),i=s(t,t.neg(t.ONE)),n=s(t,i),a=s(t,t.neg(i)),o=(e+Ah)/iu;return(u,l)=>{const h=u;let d=h.pow(l,o),m=h.mul(d,i);const _=h.mul(d,n),k=h.mul(d,a),T=h.eql(h.sqr(m),l),P=h.eql(h.sqr(_),l);d=h.cmov(d,m,T),m=h.cmov(k,_,P);const F=h.eql(h.sqr(m),l),B=h.cmov(d,m,F);return oa(h,B,l),B}}function nu(e){if(e<Jc)throw new Error("sqrt is not defined for small field");let t=e-De,s=0;for(;t%rs===Ze;)t/=rs,s++;let i=rs;const n=ca(e);for(;no(n,i)===1;)if(i++>1e3)throw new Error("Cannot find square root: probably non-prime P");if(s===1)return ru;let a=n.pow(i,t);const o=(t+De)/rs;return function(l,h){const d=l;if(d.is0(h))return h;if(no(d,h)!==1)throw new Error("Cannot find square root");let m=s,_=d.mul(d.ONE,a),k=d.pow(h,t),T=d.pow(h,o);for(;!d.eql(k,d.ONE);){if(d.is0(k))return d.ZERO;let P=1,F=d.sqr(k);for(;!d.eql(F,d.ONE);)if(P++,F=d.sqr(F),P===m)throw new Error("Cannot find square root");const B=De<<BigInt(m-P-1),N=d.pow(_,B);m=P,_=d.sqr(N),k=d.mul(k,_),T=d.mul(T,N)}return T}}function Ph(e){return e%eu===Jc?ru:e%su===tu?Ch:e%iu===Ih?Rh(e):nu(e)}const Lh=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function Dh(e){const t={ORDER:"bigint",BYTES:"number",BITS:"number"},s=Lh.reduce((i,n)=>(i[n]="function",i),t);if(Zi(e,s),Rn(e.BYTES,"BYTES"),Rn(e.BITS,"BITS"),e.BYTES<1||e.BITS<1)throw new Error("invalid field: expected BYTES/BITS > 0");if(e.ORDER<=De)throw new Error("invalid field: expected ORDER > 1, got "+e.ORDER);return e}function Nh(e,t,s){const i=e;if(s<Ze)throw new Error("invalid exponent, negatives unsupported");if(s===Ze)return i.ONE;if(s===De)return t;let n=i.ONE,a=t;for(;s>Ze;)s&De&&(n=i.mul(n,a)),a=i.sqr(a),s>>=De;return n}function au(e,t,s=false){const i=e,n=new Array(t.length).fill(s?i.ZERO:void 0),a=t.reduce((u,l,h)=>i.is0(l)?u:(n[h]=u,i.mul(u,l)),i.ONE),o=i.inv(a);return t.reduceRight((u,l,h)=>i.is0(l)?u:(n[h]=i.mul(u,n[h]),i.mul(u,l)),o),n}function no(e,t){const s=e,i=(s.ORDER-De)/rs,n=s.pow(t,i),a=s.eql(n,s.ONE),o=s.eql(n,s.ZERO),u=s.eql(n,s.neg(s.ONE));if(!a&&!o&&!u)throw new Error("invalid Legendre symbol result");return a?1:o?0:-1}function Fh(e,t){if(t!==void 0&&Wc(t),e<=Ze)throw new Error("invalid n length: expected positive n, got "+e);if(t!==void 0&&t<1)throw new Error("invalid n length: expected positive bit length, got "+t);const s=na(e);if(t!==void 0&&t<s)throw new Error(`invalid n length: expected bit length (${s}) >= n.length (${t})`);const i=t!==void 0?t:s,n=Math.ceil(i/8);return{nBitLength:i,nByteLength:n}}const ao=new WeakMap;class ou{ORDER;BITS;BYTES;isLE;ZERO=Ze;ONE=De;_lengths;_mod;constructor(t,s={}){if(t<=De)throw new Error("invalid field: expected ORDER > 1, got "+t);let i;this.isLE=false,s!=null&&typeof s=="object"&&(typeof s.BITS=="number"&&(i=s.BITS),typeof s.sqrt=="function"&&Object.defineProperty(this,"sqrt",{value:s.sqrt,enumerable:true}),typeof s.isLE=="boolean"&&(this.isLE=s.isLE),s.allowedLengths&&(this._lengths=Object.freeze(s.allowedLengths.slice())),typeof s.modFromBytes=="boolean"&&(this._mod=s.modFromBytes));const{nBitLength:n,nByteLength:a}=Fh(t,i);if(a>2048)throw new Error("invalid field: expected ORDER of <= 2048 bytes");this.ORDER=t,this.BITS=n,this.BYTES=a,Object.freeze(this)}create(t){return lt(t,this.ORDER)}isValid(t){if(typeof t!="bigint")throw new TypeError("invalid field element: expected bigint, got "+typeof t);return Ze<=t&&t<this.ORDER}is0(t){return t===Ze}isValidNot0(t){return!this.is0(t)&&this.isValid(t)}isOdd(t){return(t&De)===De}neg(t){return lt(-t,this.ORDER)}eql(t,s){return t===s}sqr(t){return lt(t*t,this.ORDER)}add(t,s){return lt(t+s,this.ORDER)}sub(t,s){return lt(t-s,this.ORDER)}mul(t,s){return lt(t*s,this.ORDER)}pow(t,s){return Nh(this,t,s)}div(t,s){return lt(t*ro(s,this.ORDER),this.ORDER)}sqrN(t){return t*t}addN(t,s){return t+s}subN(t,s){return t-s}mulN(t,s){return t*s}inv(t){return ro(t,this.ORDER)}sqrt(t){let s=ao.get(this);return s||ao.set(this,s=Ph(this.ORDER)),s(this,t)}toBytes(t){return this.isLE?Zc(t,this.BYTES):ra(t,this.BYTES)}fromBytes(t,s=false){$e(t);const{_lengths:i,BYTES:n,isLE:a,ORDER:o,_mod:u}=this;if(i){if(t.length<1||!i.includes(t.length)||t.length>n)throw new Error("Field.fromBytes: expected "+i+" bytes, got "+t.length);const h=new Uint8Array(n);h.set(t,a?0:h.length-t.length),t=h}if(t.length!==n)throw new Error("Field.fromBytes: expected "+n+" bytes, got "+t.length);let l=a?Kc(t):Ki(t);if(u&&(l=lt(l,o)),!s&&!this.isValid(l))throw new Error("invalid field element: outside of range 0..ORDER");return l}invertBatch(t){return au(this,t)}cmov(t,s,i){return Gs(i,"condition"),i?s:t}}Object.freeze(ou.prototype);function ca(e,t={}){return new ou(e,t)}function cu(e){if(typeof e!="bigint")throw new Error("field order must be bigint");if(e<=De)throw new Error("field order must be greater than 1");const t=na(e-De);return Math.ceil(t/8)}function uu(e){const t=cu(e);return t+Math.ceil(t/2)}function Uh(e,t,s=false){$e(e);const i=e.length,n=cu(t),a=Math.max(uu(t),16);if(i<a||i>1024)throw new Error("expected "+a+"-1024 bytes of input, got "+i);const o=s?Kc(e):Ki(e),u=lt(o,t-De)+De;return s?Zc(u,n):ra(u,n)}const vs=BigInt(0),ns=BigInt(1);function Ti(e,t){const s=t.negate();return e?s:t}function oo(e,t){const s=au(e.Fp,t.map(i=>i.Z));return t.map((i,n)=>e.fromAffine(i.toAffine(s[n])))}function lu(e,t){if(!Number.isSafeInteger(e)||e<=0||e>t)throw new Error("invalid window size, expected [1.."+t+"], got W="+e)}function on(e,t){lu(e,t);const s=Math.ceil(t/e)+1,i=2**(e-1),n=2**e,a=aa(e),o=BigInt(e);return{windows:s,windowSize:i,mask:a,maxNumber:n,shiftBy:o}}function co(e,t,s){const{windowSize:i,mask:n,maxNumber:a,shiftBy:o}=s;let u=Number(e&n),l=e>>o;u>i&&(u-=a,l+=ns);const h=t*i,d=h+Math.abs(u)-1,m=u===0,_=u<0,k=t%2!==0;return{nextN:l,offset:d,isZero:m,isNeg:_,isNegF:k,offsetF:h}}const cn=new WeakMap,hu=new WeakMap;function un(e){return hu.get(e)||1}function uo(e){if(e!==vs)throw new Error("invalid wNAF")}class Mh{BASE;ZERO;Fn;bits;constructor(t,s){this.BASE=t.BASE,this.ZERO=t.ZERO,this.Fn=t.Fn,this.bits=s}_unsafeLadder(t,s,i=this.ZERO){let n=t;for(;s>vs;)s&ns&&(i=i.add(n)),n=n.double(),s>>=ns;return i}precomputeWindow(t,s){const{windows:i,windowSize:n}=on(s,this.bits),a=[];let o=t,u=o;for(let l=0;l<i;l++){u=o,a.push(u);for(let h=1;h<n;h++)u=u.add(o),a.push(u);o=u.double()}return a}wNAF(t,s,i){if(!this.Fn.isValid(i))throw new Error("invalid scalar");let n=this.ZERO,a=this.BASE;const o=on(t,this.bits);for(let u=0;u<o.windows;u++){const{nextN:l,offset:h,isZero:d,isNeg:m,isNegF:_,offsetF:k}=co(i,u,o);i=l,d?a=a.add(Ti(_,s[k])):n=n.add(Ti(m,s[h]))}return uo(i),{p:n,f:a}}wNAFUnsafe(t,s,i,n=this.ZERO){const a=on(t,this.bits);for(let o=0;o<a.windows&&i!==vs;o++){const{nextN:u,offset:l,isZero:h,isNeg:d}=co(i,o,a);if(i=u,!h){const m=s[l];n=n.add(d?m.negate():m)}}return uo(i),n}getPrecomputes(t,s,i){let n=cn.get(s);return n||(n=this.precomputeWindow(s,t),t!==1&&(typeof i=="function"&&(n=i(n)),cn.set(s,n))),n}cached(t,s,i){const n=un(t);return this.wNAF(n,this.getPrecomputes(n,t,i),s)}unsafe(t,s,i,n){const a=un(t);return a===1?this._unsafeLadder(t,s,n):this.wNAFUnsafe(a,this.getPrecomputes(a,t,i),s,n)}createCache(t,s){lu(s,this.bits),hu.set(t,s),cn.delete(t)}hasCache(t){return un(t)!==1}}function Oh(e,t,s,i){let n=t,a=e.ZERO,o=e.ZERO;for(;s>vs||i>vs;)s&ns&&(a=a.add(n)),i&ns&&(o=o.add(n)),n=n.double(),s>>=ns,i>>=ns;return{p1:a,p2:o}}function lo(e,t,s){if(t){if(t.ORDER!==e)throw new Error("Field.ORDER must match order: Fp == p, Fn == n");return Dh(t),t}else return ca(e,{isLE:s})}function Bh(e,t,s={},i){if(i===void 0&&(i=e==="edwards"),!t||typeof t!="object")throw new Error(`expected valid ${e} CURVE object`);for(const l of["p","n","h"]){const h=t[l];if(!(typeof h=="bigint"&&h>vs))throw new Error(`CURVE.${l} must be positive bigint`)}const n=lo(t.p,s.Fp,i),a=lo(t.n,s.Fn,i),u=["Gx","Gy","a","b"];for(const l of u)if(!n.isValid(t[l]))throw new Error(`CURVE.${l} must be valid field element of CURVE.Fp`);return t=Object.freeze(Object.assign({},t)),{CURVE:t,Fp:n,Fn:a}}function Vh(e,t){return function(i){const n=e(i);return{secretKey:n,publicKey:t(n)}}}class ho{oHash;iHash;blockLen;outputLen;canXOF=false;finished=false;destroyed=false;constructor(t,s){if(zi(t),Ot(s,void 0,"key"),this.iHash=t.create(),typeof this.iHash.update!="function")throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;const i=this.blockLen,n=new Uint8Array(i);n.set(s.length>i?t.create().update(s).digest():s);for(let a=0;a<n.length;a++)n[a]^=54;this.iHash.update(n),this.oHash=t.create();for(let a=0;a<n.length;a++)n[a]^=106;this.oHash.update(n),Ws(n)}update(t){return Si(this),this.iHash.update(t),this}digestInto(t){Si(this),jc(t,this),this.finished=true;const s=t.subarray(0,this.outputLen);this.iHash.digestInto(s),this.oHash.update(s),this.oHash.digestInto(s),this.destroy()}digest(){const t=new Uint8Array(this.oHash.outputLen);return this.digestInto(t),t}_cloneInto(t){t||=Object.create(Object.getPrototypeOf(this),{});const{oHash:s,iHash:i,finished:n,destroyed:a,blockLen:o,outputLen:u}=this;return t=t,t.finished=n,t.destroyed=a,t.blockLen=o,t.outputLen=u,t.oHash=s._cloneInto(t.oHash),t.iHash=i._cloneInto(t.iHash),t}clone(){return this._cloneInto()}destroy(){this.destroyed=true,this.oHash.destroy(),this.iHash.destroy()}}const ua=(()=>{const e=(t,s,i)=>new ho(t,s).update(i).digest();return e.create=(t,s)=>new ho(t,s),e})();const fo=(e,t)=>(e+(e>=0?t:-t)/fu)/t;function jh(e,t,s){Qc("scalar",e,xt,s);const[[i,n],[a,o]]=t,u=fo(o*e,s),l=fo(-n*e,s);let h=e-u*i-l*a,d=-u*n-l*o;const m=h<xt,_=d<xt;m&&(h=-h),_&&(d=-d);const k=aa(Math.ceil(na(s)/2))+Gt;if(h<xt||h>=k||d<xt||d>=k)throw new Error("splitScalar (endomorphism): failed for k");return{k1neg:m,k1:h,k2neg:_,k2:d}}function Pn(e){if(!["compact","recovered","der"].includes(e))throw new Error('Signature format must be "compact", "recovered", or "der"');return e}function ln(e,t){Zi(e);const s={};for(let i of Object.keys(t))s[i]=e[i]===void 0?t[i]:e[i];return Gs(s.lowS,"lowS"),Gs(s.prehash,"prehash"),s.format!==void 0&&Pn(s.format),s}class $h extends Error{constructor(t=""){super(t)}}const ht={Err:$h,_tlv:{encode:(e,t)=>{const{Err:s}=ht;if(Rn(e,"tag"),e<0||e>255)throw new s("tlv.encode: wrong tag");if(typeof t!="string")throw new TypeError('"data" expected string, got type='+typeof t);if(t.length&1)throw new s("tlv.encode: unpadded data");const i=t.length/2,n=li(i);if(n.length/2&128)throw new s("tlv.encode: long form length too big");const a=i>127?li(n.length/2|128):"";return li(e)+a+n+t},decode(e,t){const{Err:s}=ht;t=$e(t,void 0,"DER data");let i=0;if(e<0||e>255)throw new s("tlv.encode: wrong tag");if(t.length<2||t[i++]!==e)throw new s("tlv.decode: wrong tlv");const n=t[i++],a=!!(n&128);let o=0;if(!a)o=n;else{const l=n&127;if(!l)throw new s("tlv.decode(long): indefinite length not supported");if(l>4)throw new s("tlv.decode(long): byte length is too big");const h=t.subarray(i,i+l);if(h.length!==l)throw new s("tlv.decode: length bytes not complete");if(h[0]===0)throw new s("tlv.decode(long): zero leftmost byte");for(const d of h)o=o<<8|d;if(i+=l,o<128)throw new s("tlv.decode(long): not minimal encoding")}const u=t.subarray(i,i+o);if(u.length!==o)throw new s("tlv.decode: wrong value length");return{v:u,l:t.subarray(i+o)}}},_int:{encode(e){const{Err:t}=ht;if(ia(e),e<xt)throw new t("integer: negative integers are not allowed");let s=li(e);if(Number.parseInt(s[0],16)&8&&(s="00"+s),s.length&1)throw new t("unexpected DER parsing assertion: unpadded hex");return s},decode(e){const{Err:t}=ht;if(e.length<1)throw new t("invalid signature integer: empty");if(e[0]&128)throw new t("invalid signature integer: negative");if(e.length>1&&e[0]===0&&!(e[1]&128))throw new t("invalid signature integer: unnecessary leading zero");return Ki(e)}},toSig(e){const{Err:t,_int:s,_tlv:i}=ht,n=$e(e,void 0,"signature"),{v:a,l:o}=i.decode(48,n);if(o.length)throw new t("invalid signature: left bytes after parsing");const{v:u,l}=i.decode(2,a),{v:h,l:d}=i.decode(2,l);if(d.length)throw new t("invalid signature: left bytes after parsing");return{r:s.decode(u),s:s.decode(h)}},hexFromSig(e){const{_tlv:t,_int:s}=ht,i=t.encode(2,s.encode(e.r)),n=t.encode(2,s.encode(e.s)),a=i+n;return t.encode(48,a)}};Object.freeze(ht._tlv);Object.freeze(ht._int);Object.freeze(ht);const xt=BigInt(0),Gt=BigInt(1),fu=BigInt(2),hi=BigInt(3),qh=BigInt(4);function Hh(e,t={}){const s=Bh("weierstrass",e,t),i=s.Fp,n=s.Fn;let a=s.CURVE;const{h:o,n:u}=a;Zi(t,{},{allowInfinityPoint:"boolean",clearCofactor:"function",isTorsionFree:"function",fromBytes:"function",toBytes:"function",endo:"object"});const{endo:l,allowInfinityPoint:h}=t;if(l&&(!i.is0(a.a)||typeof l.beta!="bigint"||!Array.isArray(l.basises)))throw new Error('invalid endo: expected "beta": bigint and "basises": array');const d=du(i,n);function m(){if(!i.isOdd)throw new Error("compression is not supported: Field does not have .isOdd()")}function _(b,v,V){if(h&&v.is0())return Uint8Array.of(0);const{x:W,y:M}=v.toAffine(),R=i.toBytes(W);if(Gs(V,"isCompressed"),V){m();const O=!i.isOdd(M);return Wt(pu(O),R)}else return Wt(Uint8Array.of(4),R,i.toBytes(M))}function k(b){$e(b,void 0,"Point");const{publicKey:v,publicKeyUncompressed:V}=d,W=b.length,M=b[0],R=b.subarray(1);if(h&&W===1&&M===0)return{x:i.ZERO,y:i.ZERO};if(W===v&&(M===2||M===3)){const O=i.fromBytes(R);if(!i.isValid(O))throw new Error("bad point: is not on curve, wrong x");const U=F(O);let I;try{I=i.sqrt(U)}catch(te){const ce=te instanceof Error?": "+te.message:"";throw new Error("bad point: is not on curve, sqrt error"+ce)}m();const H=i.isOdd(I);return(M&1)===1!==H&&(I=i.neg(I)),{x:O,y:I}}else if(W===V&&M===4){const O=i.BYTES,U=i.fromBytes(R.subarray(0,O)),I=i.fromBytes(R.subarray(O,O*2));if(!B(U,I))throw new Error("bad point: is not on curve");return{x:U,y:I}}else throw new Error(`bad point: got length ${W}, expected compressed=${v} or uncompressed=${V}`)}const T=t.toBytes===void 0?_:t.toBytes,P=t.fromBytes===void 0?k:t.fromBytes;function F(b){const v=i.sqr(b),V=i.mul(v,b);return i.add(i.add(V,i.mul(b,a.a)),a.b)}function B(b,v){const V=i.sqr(v),W=F(b);return i.eql(V,W)}if(!B(a.Gx,a.Gy))throw new Error("bad curve params: generator point");const N=i.mul(i.pow(a.a,hi),qh),Y=i.mul(i.sqr(a.b),BigInt(27));if(i.is0(i.add(N,Y)))throw new Error("bad curve params: a or b");function q(b,v,V=false){if(!i.isValid(v)||V&&i.is0(v))throw new Error(`bad point coordinate ${b}`);return v}function z(b){if(!(b instanceof X))throw new Error("Weierstrass Point expected")}function J(b){if(!l||!l.basises)throw new Error("no endo");return jh(b,l.basises,n.ORDER)}function K(b,v,V,W,M){return V=new X(i.mul(V.X,b),V.Y,V.Z),v=Ti(W,v),V=Ti(M,V),v.add(V)}class X{static BASE=new X(a.Gx,a.Gy,i.ONE);static ZERO=new X(i.ZERO,i.ONE,i.ZERO);static Fp=i;static Fn=n;X;Y;Z;constructor(v,V,W){this.X=q("x",v),this.Y=q("y",V,true),this.Z=q("z",W),Object.freeze(this)}static CURVE(){return a}static fromAffine(v){const{x:V,y:W}=v||{};if(!v||!i.isValid(V)||!i.isValid(W))throw new Error("invalid affine point");if(v instanceof X)throw new Error("projective point not allowed");return i.is0(V)&&i.is0(W)?X.ZERO:new X(V,W,i.ONE)}static fromBytes(v){const V=X.fromAffine(P($e(v,void 0,"point")));return V.assertValidity(),V}static fromHex(v){return X.fromBytes(In(v))}get x(){return this.toAffine().x}get y(){return this.toAffine().y}precompute(v=8,V=true){return x.createCache(this,v),V||this.multiply(hi),this}assertValidity(){const v=this;if(v.is0()){if(t.allowInfinityPoint&&i.is0(v.X)&&i.eql(v.Y,i.ONE)&&i.is0(v.Z))return;throw new Error("bad point: ZERO")}const{x:V,y:W}=v.toAffine();if(!i.isValid(V)||!i.isValid(W))throw new Error("bad point: x or y not field elements");if(!B(V,W))throw new Error("bad point: equation left != right");if(!v.isTorsionFree())throw new Error("bad point: not in prime-order subgroup")}hasEvenY(){const{y:v}=this.toAffine();if(!i.isOdd)throw new Error("Field doesn't support isOdd");return!i.isOdd(v)}equals(v){z(v);const{X:V,Y:W,Z:M}=this,{X:R,Y:O,Z:U}=v,I=i.eql(i.mul(V,U),i.mul(R,M)),H=i.eql(i.mul(W,U),i.mul(O,M));return I&&H}negate(){return new X(this.X,i.neg(this.Y),this.Z)}double(){const{a:v,b:V}=a,W=i.mul(V,hi),{X:M,Y:R,Z:O}=this;let U=i.ZERO,I=i.ZERO,H=i.ZERO,G=i.mul(M,M),te=i.mul(R,R),ce=i.mul(O,O),oe=i.mul(M,R);return oe=i.add(oe,oe),H=i.mul(M,O),H=i.add(H,H),U=i.mul(v,H),I=i.mul(W,ce),I=i.add(U,I),U=i.sub(te,I),I=i.add(te,I),I=i.mul(U,I),U=i.mul(oe,U),H=i.mul(W,H),ce=i.mul(v,ce),oe=i.sub(G,ce),oe=i.mul(v,oe),oe=i.add(oe,H),H=i.add(G,G),G=i.add(H,G),G=i.add(G,ce),G=i.mul(G,oe),I=i.add(I,G),ce=i.mul(R,O),ce=i.add(ce,ce),G=i.mul(ce,oe),U=i.sub(U,G),H=i.mul(ce,te),H=i.add(H,H),H=i.add(H,H),new X(U,I,H)}add(v){z(v);const{X:V,Y:W,Z:M}=this,{X:R,Y:O,Z:U}=v;let I=i.ZERO,H=i.ZERO,G=i.ZERO;const te=a.a,ce=i.mul(a.b,hi);let oe=i.mul(V,R),w=i.mul(W,O),E=i.mul(M,U),D=i.add(V,W),L=i.add(R,O);D=i.mul(D,L),L=i.add(oe,w),D=i.sub(D,L),L=i.add(V,M);let j=i.add(R,U);return L=i.mul(L,j),j=i.add(oe,E),L=i.sub(L,j),j=i.add(W,M),I=i.add(O,U),j=i.mul(j,I),I=i.add(w,E),j=i.sub(j,I),G=i.mul(te,L),I=i.mul(ce,E),G=i.add(I,G),I=i.sub(w,G),G=i.add(w,G),H=i.mul(I,G),w=i.add(oe,oe),w=i.add(w,oe),E=i.mul(te,E),L=i.mul(ce,L),w=i.add(w,E),E=i.sub(oe,E),E=i.mul(te,E),L=i.add(L,E),oe=i.mul(w,L),H=i.add(H,oe),oe=i.mul(j,L),I=i.mul(D,I),I=i.sub(I,oe),oe=i.mul(D,w),G=i.mul(j,G),G=i.add(G,oe),new X(I,H,G)}subtract(v){return z(v),this.add(v.negate())}is0(){return this.equals(X.ZERO)}multiply(v){const{endo:V}=t;if(!n.isValidNot0(v))throw new RangeError("invalid scalar: out of range");let W,M;const R=O=>x.cached(this,O,U=>oo(X,U));if(V){const{k1neg:O,k1:U,k2neg:I,k2:H}=J(v),{p:G,f:te}=R(U),{p:ce,f:oe}=R(H);M=te.add(oe),W=K(V.beta,G,ce,O,I)}else{const{p:O,f:U}=R(v);W=O,M=U}return oo(X,[W,M])[0]}multiplyUnsafe(v){const{endo:V}=t,W=this,M=v;if(!n.isValid(M))throw new RangeError("invalid scalar: out of range");if(M===xt||W.is0())return X.ZERO;if(M===Gt)return W;if(x.hasCache(this))return this.multiply(M);if(V){const{k1neg:R,k1:O,k2neg:U,k2:I}=J(M),{p1:H,p2:G}=Oh(X,W,O,I);return K(V.beta,H,G,R,U)}else return x.unsafe(W,M)}toAffine(v){const V=this;let W=v;const{X:M,Y:R,Z:O}=V;if(i.eql(O,i.ONE))return{x:M,y:R};const U=V.is0();W==null&&(W=U?i.ONE:i.inv(O));const I=i.mul(M,W),H=i.mul(R,W),G=i.mul(O,W);if(U)return{x:i.ZERO,y:i.ZERO};if(!i.eql(G,i.ONE))throw new Error("invZ was invalid");return{x:I,y:H}}isTorsionFree(){const{isTorsionFree:v}=t;return o===Gt?true:v?v(X,this):x.unsafe(this,u).is0()}clearCofactor(){const{clearCofactor:v}=t;return o===Gt?this:v?v(X,this):this.multiplyUnsafe(o)}isSmallOrder(){return o===Gt?this.is0():this.clearCofactor().is0()}toBytes(v=true){return Gs(v,"isCompressed"),this.assertValidity(),T(X,this,v)}toHex(v=true){return Gc(this.toBytes(v))}toString(){return`<Point ${this.is0()?"ZERO":this.toHex()}>`}}const re=n.BITS,x=new Mh(X,t.endo?Math.ceil(re/2):re);return re>=8&&X.BASE.precompute(8),Object.freeze(X.prototype),Object.freeze(X),X}function pu(e){return Uint8Array.of(e?2:3)}function du(e,t){return{secretKey:t.BYTES,publicKey:1+e.BYTES,publicKeyUncompressed:1+2*e.BYTES,publicKeyHasPrefix:true,signature:2*t.BYTES}}function Wh(e,t={}){const{Fn:s}=e,i=t.randomBytes===void 0?Yc:t.randomBytes,n=Object.assign(du(e.Fp,s),{seed:Math.max(uu(s.ORDER),16)});function a(k){try{const T=s.fromBytes(k);return s.isValidNot0(T)}catch{return false}}function o(k,T){const{publicKey:P,publicKeyUncompressed:F}=n;try{const B=k.length;return T===true&&B!==P||T===false&&B!==F?false:!!e.fromBytes(k)}catch{return false}}function u(k){return k=k===void 0?i(n.seed):k,Uh($e(k,n.seed,"seed"),s.ORDER)}function l(k,T=true){return e.BASE.multiply(s.fromBytes(k)).toBytes(T)}function h(k){const{secretKey:T,publicKey:P,publicKeyUncompressed:F}=n,B=s._lengths;if(!Xc(k))return;const N=$e(k,void 0,"key").length,Y=N===P||N===F,q=N===T||!!B?.includes(N);if(!(Y&&q))return Y}function d(k,T,P=true){if(h(k)===true)throw new Error("first arg must be private key");if(h(T)===false)throw new Error("second arg must be public key");const F=s.fromBytes(k);return e.fromBytes(T).multiply(F).toBytes(P)}const m={isValidSecretKey:a,isValidPublicKey:o,randomSecretKey:u},_=Vh(u,l);return Object.freeze(m),Object.freeze(n),Object.freeze({getPublicKey:l,getSharedSecret:d,keygen:_,Point:e,utils:m,lengths:n})}function Gh(e,t,s={}){const i=t;zi(i),Zi(s,{},{hmac:"function",lowS:"boolean",randomBytes:"function",bits2int:"function",bits2int_modN:"function"}),s=Object.assign({},s);const n=s.randomBytes===void 0?Yc:s.randomBytes,a=s.hmac===void 0?(M,R)=>ua(i,M,R):s.hmac,{Fp:o,Fn:u}=e,{ORDER:l,BITS:h}=u,{keygen:d,getPublicKey:m,getSharedSecret:_,utils:k,lengths:T}=Wh(e,s),P={prehash:true,lowS:typeof s.lowS=="boolean"?s.lowS:true,format:"compact",extraEntropy:false},F=l*fu+Gt<o.ORDER;function B(M){const R=l>>Gt;return M>R}function N(M,R){if(!u.isValidNot0(R))throw new Error(`invalid signature ${M}: out of range 1..Point.Fn.ORDER`);return R}function Y(){if(F)throw new Error('"recovered" sig type is not supported for cofactor >2 curves')}function q(M,R){Pn(R);const O=T.signature,U=R==="compact"?O:R==="recovered"?O+1:void 0;return $e(M,U)}class z{r;s;recovery;constructor(R,O,U){if(this.r=N("r",R),this.s=N("s",O),U!=null){if(Y(),![0,1,2,3].includes(U))throw new Error("invalid recovery id");this.recovery=U}Object.freeze(this)}static fromBytes(R,O=P.format){q(R,O);let U;if(O==="der"){const{r:te,s:ce}=ht.toSig($e(R));return new z(te,ce)}O==="recovered"&&(U=R[0],O="compact",R=R.subarray(1));const I=T.signature/2,H=R.subarray(0,I),G=R.subarray(I,I*2);return new z(u.fromBytes(H),u.fromBytes(G),U)}static fromHex(R,O){return this.fromBytes(In(R),O)}assertRecovery(){const{recovery:R}=this;if(R==null)throw new Error("invalid recovery id: must be present");return R}addRecoveryBit(R){return new z(this.r,this.s,R)}recoverPublicKey(R){const{r:O,s:U}=this,I=this.assertRecovery(),H=I===2||I===3?O+l:O;if(!o.isValid(H))throw new Error("invalid recovery id: sig.r+curve.n != R.x");const G=o.toBytes(H),te=e.fromBytes(Wt(pu((I&1)===0),G)),ce=u.inv(H),oe=K($e(R,void 0,"msgHash")),w=u.create(-oe*ce),E=u.create(U*ce),D=e.BASE.multiplyUnsafe(w).add(te.multiplyUnsafe(E));if(D.is0())throw new Error("invalid recovery: point at infinify");return D.assertValidity(),D}hasHighS(){return B(this.s)}toBytes(R=P.format){if(Pn(R),R==="der")return In(ht.hexFromSig(this));const{r:O,s:U}=this,I=u.toBytes(O),H=u.toBytes(U);return R==="recovered"?(Y(),Wt(Uint8Array.of(this.assertRecovery()),I,H)):Wt(I,H)}toHex(R){return Gc(this.toBytes(R))}}Object.freeze(z.prototype),Object.freeze(z);const J=s.bits2int===void 0?function(R){if(R.length>8192)throw new Error("input is too large");const O=Ki(R),U=R.length*8-h;return U>0?O>>BigInt(U):O}:s.bits2int,K=s.bits2int_modN===void 0?function(R){return u.create(J(R))}:s.bits2int_modN,X=aa(h);function re(M){return Qc("num < 2^"+h,M,xt,X),u.toBytes(M)}function x(M,R){return $e(M,void 0,"message"),R?$e(i(M),void 0,"prehashed message"):M}function b(M,R,O){const{lowS:U,prehash:I,extraEntropy:H}=ln(O,P);M=x(M,I);const G=K(M),te=u.fromBytes(R);if(!u.isValidNot0(te))throw new Error("invalid private key");const ce=[re(te),re(G)];if(H!=null&&H!==false){const D=H===true?n(T.secretKey):H;ce.push($e(D,void 0,"extraEntropy"))}const oe=Wt(...ce),w=G;function E(D){const L=J(D);if(!u.isValidNot0(L))return;const j=u.inv(L),se=e.BASE.multiply(L).toAffine(),ne=u.create(se.x);if(ne===xt)return;const de=u.create(j*u.create(w+ne*te));if(de===xt)return;let Se=(se.x===ne?0:2)|Number(se.y&Gt),ke=de;return U&&B(de)&&(ke=u.neg(de),Se^=1),new z(ne,ke,F?void 0:Se)}return{seed:oe,k2sig:E}}function v(M,R,O={}){const{seed:U,k2sig:I}=b(M,R,O);return Th(i.outputLen,u.BYTES,a)(U,I).toBytes(O.format)}function V(M,R,O,U={}){const{lowS:I,prehash:H,format:G}=ln(U,P);if(O=$e(O,void 0,"publicKey"),R=x(R,H),!Xc(M)){const te=M instanceof z?", use sig.toBytes()":"";throw new Error("verify expects Uint8Array signature"+te)}q(M,G);try{const te=z.fromBytes(M,G),ce=e.fromBytes(O);if(I&&te.hasHighS())return false;const{r:oe,s:w}=te,E=K(R),D=u.inv(w),L=u.create(E*D),j=u.create(oe*D),se=e.BASE.multiplyUnsafe(L).add(ce.multiplyUnsafe(j));return se.is0()?false:u.create(se.x)===oe}catch{return false}}function W(M,R,O={}){const{prehash:U}=ln(O,P);return R=x(R,U),z.fromBytes(M,"recovered").recoverPublicKey(R).toBytes()}return Object.freeze({keygen:d,getPublicKey:m,getSharedSecret:_,utils:k,lengths:T,Point:e,sign:v,verify:V,recoverPublicKey:W,Signature:z,hash:i})}const Xh={p:BigInt("0xffffffff00000001000000000000000000000000ffffffffffffffffffffffff"),n:BigInt("0xffffffff00000000ffffffffffffffffbce6faada7179e84f3b9cac2fc632551"),h:BigInt(1),a:BigInt("0xffffffff00000001000000000000000000000000fffffffffffffffffffffffc"),b:BigInt("0x5ac635d8aa3a93e7b3ebbd55769886bc651d06b0cc53b0f63bce3c3e27d2604b"),Gx:BigInt("0x6b17d1f2e12c4247f8bce6e563a440f277037d812deb33a0f4a13945d898c296"),Gy:BigInt("0x4fe342e2fe1a7f9b8ee7eb4a7c0f9e162bce33576b315ececbb6406837bf51f5")},Yh=Hh(Xh),zh=Gh(Yh,Hc),po={x:"6bkPbVZXx-c08blVs6qIwm0gfSRLS2nnf2Tsz19ggtM",y:"lhi486ASKQkS8TGbVee-FpdAu7qKaO3gad_4ScX8qJI"},Kh=60;let Ai=null,la=false,Us=null,Ln=0;function Ii(e){const t=e.replace(/-/g,"+").replace(/_/g,"/"),s=atob(t),i=new Uint8Array(s.length);for(let n=0;n<s.length;n++)i[n]=s.charCodeAt(n);return i}function Zh(e,t){try{const s=Ii(e),i=Ii(t);if(s.length!==32||i.length!==32)return null;const n=new Uint8Array(65);return n[0]=4,n.set(s,1),n.set(i,33),n}catch{return null}}function Qh(e,t){try{const s=e.split(".");if(s.length!==3)return null;const i=new TextEncoder().encode(s[0]+"."+s[1]),n=Ii(s[2]);if(n.length!==64||!zh.verify(n,i,t,{lowS:false}))return null;const a=JSON.parse(new TextDecoder().decode(Ii(s[1])));return{c:a.c??{},e:a.e??0}}catch{return null}}function Jh(e,t){return!(e>0&&e+Kh<t)}async function ef(){Ai=Zh(po.x,po.y),Ai||(la=true,console.warn("[Viji] _SC: key import failed — restricted mode active"))}async function mo(e){const t=la||!Ai?null:Qh(e,Ai);Us=t?.c??null,Ln=t?.e??0}function tf(e,t){return la||!Us?t:Jh(Ln,Math.floor(Date.now()/1e3))?typeof Us[e]=="number"?Us[e]:t:(Us=null,Ln=0,t)}const sf="#F1F1F1",ys=28,hn=40,go=24,rf={paths:["M37.5801 32.0859L32.248 40.084C31.9699 40.5012 31.5015 40.7519 31 40.752C30.4985 40.7519 30.0302 40.5012 29.752 40.084L24.4199 32.0859L26.916 30.4219L31 36.5479L35.084 30.4219L37.5801 32.0859Z","M43.0059 39.25C43.0059 40.0784 43.6774 40.75 44.5059 40.75C45.3343 40.75 46.0059 40.0784 46.0059 39.25V31H43.0059V39.25Z","M61.0059 39.25C61.0059 40.0784 61.6774 40.75 62.5059 40.75C63.3343 40.75 64.0059 40.0784 64.0059 39.25V31H61.0059V39.25Z","M55.001 39.5C55.001 42.1883 53.9879 44.6433 52.3262 46.5C52.0009 46.8635 51.6509 47.2044 51.2783 47.5195L49.3408 45.2295C49.6074 45.004 49.858 44.7601 50.0908 44.5C51.2793 43.1721 52.001 41.4218 52.001 39.5H52.0059V31H55.0059V39.5H55.001Z"],dots:[[44.5,26.5],[53.5,26.5],[62.5,26.5]],minX:24.4199,minY:24.625,maxX:64.375,maxY:47.5195,shadowStd:11},nf={paths:["M77.6895 41.1893C78.2752 40.6036 79.2248 40.6036 79.8106 41.1893C80.3963 41.7751 80.3963 42.7246 79.8106 43.3104L43.8106 79.3104C43.2248 79.8962 42.2752 79.8962 41.6895 79.3104C41.1037 78.7246 41.1037 77.7751 41.6895 77.1893L77.6895 41.1893Z","M76.875 78.25C76.875 77.2145 77.7145 76.375 78.75 76.375C79.7855 76.375 80.625 77.2145 80.625 78.25C80.625 79.2855 79.7855 80.125 78.75 80.125C77.7145 80.125 76.875 79.2855 76.875 78.25Z","M77.6895 59.1893C78.2752 58.6036 79.2248 58.6036 79.8106 59.1893C80.3963 59.7751 80.3963 60.7246 79.8106 61.3104L61.8106 79.3104C61.2248 79.8962 60.2752 79.8962 59.6895 79.3104C59.1037 78.7246 59.1037 77.7751 59.6895 77.1893L77.6895 59.1893Z","M44.625 42.25C44.625 43.2855 43.7855 44.125 42.75 44.125C41.7145 44.125 40.875 43.2855 40.875 42.25C40.875 41.2145 41.7145 40.375 42.75 40.375C43.7855 40.375 44.625 41.2145 44.625 42.25Z","M43.8105 61.3107C43.2248 61.8964 42.2752 61.8964 41.6894 61.3107C41.1037 60.7249 41.1037 59.7754 41.6894 59.1896L59.6894 41.1896C60.2752 40.6038 61.2248 40.6038 61.8105 41.1896C62.3963 41.7754 62.3963 42.7249 61.8105 43.3107L43.8105 61.3107Z","M70.9911 99.5C70.9911 102.188 69.978 104.643 68.3163 106.5C67.991 106.863 67.6409 107.204 67.2684 107.52L65.3309 105.229C65.5974 105.004 65.8482 104.76 66.0809 104.5C67.2694 103.172 67.9911 101.422 67.9911 99.5H67.9969V91H70.9969V99.5H70.9911Z","M53.5702 92.2109L48.2382 100.209C47.96 100.626 47.4916 100.877 46.9901 100.877C46.4886 100.877 46.0203 100.626 45.7421 100.209L40.41 92.2109L42.9061 90.5469L46.9901 96.6729L51.0741 90.5469L53.5702 92.2109Z","M76.996 99.375C76.996 100.203 77.6675 100.875 78.496 100.875C79.3244 100.875 79.996 100.203 79.996 99.375V91.125H76.996V99.375Z","M58.9969 99.375C58.9969 100.203 59.6685 100.875 60.4969 100.875C61.3254 100.875 61.9969 100.203 61.9969 99.375V91.125H58.9969V99.375Z"],dots:[],minX:40.41,minY:40.375,maxX:80.625,maxY:107.52,shadowStd:12};let ha=null,fa=null,mu=null,gu=null,Ke=null,Vs=null,Ci=null,qt=null,Dt=-1,Nt=-1,bo=null,bu=0;const af=`
|
|
432
432
|
attribute vec2 a_pos;
|
|
433
433
|
attribute vec2 a_uv;
|
|
434
434
|
varying vec2 v_uv;
|
|
@@ -442,16 +442,16 @@ uniform float u_alpha;
|
|
|
442
442
|
varying vec2 v_uv;
|
|
443
443
|
void main() {
|
|
444
444
|
gl_FragColor = texture2D(u_tex, v_uv) * u_alpha;
|
|
445
|
-
}`;function cf(e){const t=new Path2D;for(const[s,i]of e.dots){const n=new Path2D;n.arc(s,i,1.875,0,Math.PI*2),t.addPath(n)}for(const s of e.paths)t.addPath(new Path2D(s));return t}function yo(e){const t=e.maxX-e.minX,s=e.maxY-e.minY,i=Math.ceil(t+ys*2),n=Math.ceil(s+ys*2),a=new OffscreenCanvas(i,n),o=a.getContext("2d");if(!o)return null;const u=cf(e);o.translate(ys-e.minX,ys-e.minY),o.fillStyle=sf;const l=[[e.shadowStd*2,.5],[8,.2],[2,.1]];for(const[h,d]of l)o.save(),o.shadowColor=`rgba(0,0,0,${d})`,o.shadowBlur=h,o.fill(u),o.restore();return o.fill(u),{canvas:a,bufW:i,bufH:n,contentW:t,contentH:s}}function uf(e){try{ha=yo(rf),fa=yo(nf)}catch(t){console.warn("[Viji] overlay: init failed",t)}}function _o(e){bu=e}function lf(e,t,s,i){const n=e===0,a=n?fa:ha;if(!a)return null;const o=a.contentW*i,u=a.contentH*i;let l,h;return e===0?(l=hn*i,h=hn*i):e===2?(l=go*i,h=s-u-go*i):(l=(t-o)/2,h=hn*i),{buffer:a,vertical:n,px:Math.round(l-ys*i),py:Math.round(h-ys*i),w:a.bufW*i,h:a.bufH*i}}function hf(e,t,s,i,n=1){if(i>=1)return;const a=lf(bu,e.width,e.height,n||1);a&&(t?df(t,a):s&&mf(s,e,a))}const yu=34229;function ff(e){const t=e;if(typeof t.createVertexArray=="function")return{create:()=>t.createVertexArray(),bind:i=>t.bindVertexArray(i)};const s=e.getExtension("OES_vertex_array_object");return s?{create:()=>s.createVertexArrayOES(),bind:i=>s.bindVertexArrayOES(i)}:null}function xo(e,t){if(!t)return null;const s=e.getParameter(e.TEXTURE_BINDING_2D),i=e.getParameter(e.UNPACK_FLIP_Y_WEBGL),n=e.getParameter(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL);e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,1),e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,0);const a=e.createTexture();return e.bindTexture(e.TEXTURE_2D,a),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,t),e.bindTexture(e.TEXTURE_2D,s),e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,i?1:0),e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,n?1:0),a}function pf(e){if(bo===e)return;bo=e,mu=xo(e,ha?.canvas??null),gu=xo(e,fa?.canvas??null);const t=e.createShader(e.VERTEX_SHADER);e.shaderSource(t,af),e.compileShader(t);const s=e.createShader(e.FRAGMENT_SHADER);if(e.shaderSource(s,of),e.compileShader(s),Ke=e.createProgram(),e.attachShader(Ke,t),e.attachShader(Ke,s),e.bindAttribLocation(Ke,0,"a_pos"),e.bindAttribLocation(Ke,1,"a_uv"),e.linkProgram(Ke),e.deleteShader(t),e.deleteShader(s),!e.getProgramParameter(Ke,e.LINK_STATUS)){console.warn("[Viji] overlay: shader link failed"),Ke=null;return}if(Vs=e.createBuffer(),Dt=e.getAttribLocation(Ke,"a_pos"),Nt=e.getAttribLocation(Ke,"a_uv"),qt=ff(e),qt){const i=e.getParameter(yu),n=e.getParameter(e.ARRAY_BUFFER_BINDING);Ci=qt.create(),qt.bind(Ci),e.bindBuffer(e.ARRAY_BUFFER,Vs),Dt>=0&&(e.enableVertexAttribArray(Dt),e.vertexAttribPointer(Dt,2,e.FLOAT,false,16,0)),Nt>=0&&(e.enableVertexAttribArray(Nt),e.vertexAttribPointer(Nt,2,e.FLOAT,false,16,8)),qt.bind(i),e.bindBuffer(e.ARRAY_BUFFER,n)}}function vo(e,t){return{index:t,buffer:e.getVertexAttrib(t,e.VERTEX_ATTRIB_ARRAY_BUFFER_BINDING),enabled:e.getVertexAttrib(t,e.VERTEX_ATTRIB_ARRAY_ENABLED),size:e.getVertexAttrib(t,e.VERTEX_ATTRIB_ARRAY_SIZE),type:e.getVertexAttrib(t,e.VERTEX_ATTRIB_ARRAY_TYPE),normalized:e.getVertexAttrib(t,e.VERTEX_ATTRIB_ARRAY_NORMALIZED),stride:e.getVertexAttrib(t,e.VERTEX_ATTRIB_ARRAY_STRIDE),offset:e.getVertexAttribOffset(t,e.VERTEX_ATTRIB_ARRAY_POINTER),currentValue:e.getVertexAttrib(t,e.CURRENT_VERTEX_ATTRIB)}}function ko(e,t){t.buffer&&(e.bindBuffer(e.ARRAY_BUFFER,t.buffer),e.vertexAttribPointer(t.index,t.size,t.type,t.normalized,t.stride,t.offset)),t.enabled?e.enableVertexAttribArray(t.index):e.disableVertexAttribArray(t.index),e.vertexAttrib4f(t.index,t.currentValue[0],t.currentValue[1],t.currentValue[2],t.currentValue[3])}function df(e,t){e.save(),e.globalAlpha=1,e.drawImage(t.buffer.canvas,t.px,t.py,t.w,t.h),e.restore()}function mf(e,t,s){if(pf(e),!Ke||!Vs)return;const i=s.vertical?gu:mu;if(!i)return;const n=t.width,a=t.height,o=s.px,u=s.py,l=s.w,h=s.h,d=o/n*2-1,m=1-(u+h)/a*2,_=(o+l)/n*2-1,k=1-u/a*2,T=!!(qt&&Ci),P=e.getParameter(e.CURRENT_PROGRAM),F=e.getParameter(e.ACTIVE_TEXTURE);e.activeTexture(e.TEXTURE0);const B=e.getParameter(e.TEXTURE_BINDING_2D),N=e.getParameter(e.ARRAY_BUFFER_BINDING),Y=e.getParameter(e.FRAMEBUFFER_BINDING),q=e.getParameter(e.VIEWPORT),z=e.isEnabled(e.BLEND),J=e.getParameter(e.BLEND_SRC_RGB),K=e.getParameter(e.BLEND_DST_RGB),X=e.getParameter(e.BLEND_SRC_ALPHA),re=e.getParameter(e.BLEND_DST_ALPHA),x=e.getParameter(e.BLEND_EQUATION_RGB),b=e.getParameter(e.BLEND_EQUATION_ALPHA),v=e.isEnabled(e.DEPTH_TEST),V=e.isEnabled(e.SCISSOR_TEST),W=e.isEnabled(e.STENCIL_TEST),M=e.isEnabled(e.CULL_FACE),R=e.getParameter(e.COLOR_WRITEMASK),O=e.getParameter(e.UNPACK_FLIP_Y_WEBGL),U=T?e.getParameter(yu):null,I=!T&&Dt>=0?vo(e,Dt):null,H=!T&&Nt>=0?vo(e,Nt):null;e.bindFramebuffer(e.FRAMEBUFFER,null),e.viewport(0,0,n,a),e.useProgram(Ke),e.enable(e.BLEND),e.blendEquation(e.FUNC_ADD),e.blendFunc(e.SRC_ALPHA,e.ONE_MINUS_SRC_ALPHA),e.disable(e.DEPTH_TEST),e.disable(e.SCISSOR_TEST),e.disable(e.STENCIL_TEST),e.disable(e.CULL_FACE),e.colorMask(true,true,true,true),e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,0),e.bindTexture(e.TEXTURE_2D,i),e.uniform1i(e.getUniformLocation(Ke,"u_tex"),0),e.uniform1f(e.getUniformLocation(Ke,"u_alpha"),1);const G=new Float32Array([d,m,0,0,_,m,1,0,d,k,0,1,d,k,0,1,_,m,1,0,_,k,1,1]);T?(qt.bind(Ci),e.bindBuffer(e.ARRAY_BUFFER,Vs),e.bufferData(e.ARRAY_BUFFER,G,e.DYNAMIC_DRAW)):(e.bindBuffer(e.ARRAY_BUFFER,Vs),e.bufferData(e.ARRAY_BUFFER,G,e.DYNAMIC_DRAW),Dt>=0&&(e.enableVertexAttribArray(Dt),e.vertexAttribPointer(Dt,2,e.FLOAT,false,16,0)),Nt>=0&&(e.enableVertexAttribArray(Nt),e.vertexAttribPointer(Nt,2,e.FLOAT,false,16,8))),e.drawArrays(e.TRIANGLES,0,6),T?qt.bind(U):(H&&ko(e,H),I&&ko(e,I)),e.bindFramebuffer(e.FRAMEBUFFER,Y),e.viewport(q[0],q[1],q[2],q[3]),e.bindBuffer(e.ARRAY_BUFFER,N),e.colorMask(R[0],R[1],R[2],R[3]),e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,O?1:0),V?e.enable(e.SCISSOR_TEST):e.disable(e.SCISSOR_TEST),W?e.enable(e.STENCIL_TEST):e.disable(e.STENCIL_TEST),M?e.enable(e.CULL_FACE):e.disable(e.CULL_FACE),v?e.enable(e.DEPTH_TEST):e.disable(e.DEPTH_TEST),z?e.enable(e.BLEND):e.disable(e.BLEND),e.blendFuncSeparate(J,K,X,re),e.blendEquationSeparate(x,b),e.activeTexture(e.TEXTURE0),e.bindTexture(e.TEXTURE_2D,B),e.activeTexture(F),e.useProgram(P)}class pa{canvas=null;ctx=null;gl=null;contextAcquired=false;isRunning=false;renderLoopPaused=false;rafScheduled=false;frameCount=0;lastTime=0;startTime=0;frameRateMode="full";frameSkipCounter=0;screenRefreshRate=60;debugMode=false;p5Adapter=null;shaderAdapter=null;rendererType="native";_isHeadless=false;_displayScale=1;sceneErrorReporter=null;controlPort=null;pendingCaptures=[];static CAPTURE_QUEUE_TTL_MS=1e4;setSceneErrorReporter(t){this.sceneErrorReporter=t}getSceneErrorReporter(){return this.sceneErrorReporter}setDebugMode(t){this.debugMode=t,this.videoSystems.forEach(s=>s?.setDebugMode(t)),this.parameterSystem&&"setDebugMode"in this.parameterSystem&&this.parameterSystem.setDebugMode(t),this.interactionSystem&&"setDebugMode"in this.interactionSystem&&this.interactionSystem.setDebugMode(t)}debugLog(t,...s){this.debugMode&&console.log(t,...s)}effectiveFrameTimes=[];lastEffectiveRateReport=0;effectiveRateReportInterval=1e3;parameterSystem;interactionSystem;capabilityMonitor=new lh;benchmark=null;videoSystems=[];autoCaptureEnabled=false;autoCaptureFormat={flipY:true,frame:"plate"};audioFrequencyData=new Uint8Array(0);audioWaveformData=new Float32Array(0);deviceState={device:{motion:null,orientation:null},devices:[]};deviceVideoMap=new Map;audioStreamStates=new Map;deviceAudioMap=new Map;viji={canvas:null,ctx:null,gl:null,width:0,height:0,time:0,deltaTime:0,frameCount:0,fps:60,audio:{isConnected:false,volume:{current:0,peak:0,smoothed:0},bands:{low:0,lowMid:0,mid:0,highMid:0,high:0,lowSmoothed:0,lowMidSmoothed:0,midSmoothed:0,highMidSmoothed:0,highSmoothed:0},beat:{kick:0,snare:0,hat:0,any:0,kickSmoothed:0,snareSmoothed:0,hatSmoothed:0,anySmoothed:0,triggers:{any:false,kick:false,snare:false,hat:false},events:[],bpm:0,confidence:0,isLocked:false},spectral:{brightness:0,flatness:0},getFrequencyData:()=>new Uint8Array(0),getWaveform:()=>new Float32Array(0)},video:{isConnected:false,currentFrame:null,frameWidth:0,frameHeight:0,frameRate:0,getFrameData:()=>null,cv:null},videoStreams:[],audioStreams:[],mouse:{},keyboard:{},touches:{},device:{motion:null,orientation:null},devices:[],slider:(t,s)=>this.parameterSystem.createSliderParameter(t,s),color:(t,s)=>this.parameterSystem.createColorParameter(t,s),toggle:(t,s)=>this.parameterSystem.createToggleParameter(t,s),select:(t,s)=>this.parameterSystem.createSelectParameter(t,s),text:(t,s)=>this.parameterSystem.createTextParameter(t,s),number:(t,s)=>this.parameterSystem.createNumberParameter(t,s),image:(t,s)=>this.parameterSystem.createImageParameter(t,s),button:t=>this.parameterSystem.createButtonParameter(t),coordinate:(t,s)=>this.parameterSystem.createCoordinateParameter(t,s),useContext:t=>t==="2d"?(!this.ctx&&this.canvas&&(this.ctx=this.canvas.getContext("2d"),this.viji.ctx=this.ctx),this.ctx):t==="webgl"||t==="webgl2"?(!this.gl&&this.canvas&&(this.gl=t==="webgl2"?this.canvas.getContext("webgl2"):this.canvas.getContext("webgl"),this.viji.gl=this.gl,this.gl&&this.gl.viewport(0,0,this.viji.width,this.viji.height)),this.gl):null};constructor(){this.parameterSystem=new sh((t,s)=>{this.postMessage(t,s)}),this.interactionSystem=new ih,this.videoSystems[0]=new ui,this.videoSystems[0].setCVMessaging(0,(t,s)=>{this.postMessage("cv-feature-request",{streamIndex:t,desired:s})}),this.viji.video.cv=this.videoSystems[0].getCvSurface(),Object.assign(this.viji,this.interactionSystem.getInteractionAPIs()),this.viji.audio.getFrequencyData=()=>this.audioFrequencyData,this.viji.audio.getWaveform=()=>this.audioWaveformData,this.capabilityMonitor.setTransitionCallback(t=>{this.postMessage("capability-transition",t)}),this.setupMessageHandling()}setCapabilityUsageMask(t){this.capabilityMonitor.setUsageMask(t)}gatherCapabilityInput(t,s,i){const n=this.interactionSystem.getMouseState(),a=this.interactionSystem.getPointerState(),o=this.videoSystems[0]?this.videoSystems[0].getCVActivity():{faceDetection:{active:false,meaningful:false},faceMesh:{active:false,meaningful:false},emotion:{active:false,meaningful:false},handTracking:{active:false,meaningful:false},poseDetection:{active:false,meaningful:false},segmentation:{active:false,meaningful:false}};return{frameIndex:this.frameCount,timestamp:t,cpuMs:s,frameIntervalMs:i,audioConnected:this.viji.audio.isConnected,videoConnected:this.viji.video.isConnected,sensorsConnected:this.deviceState.device.motion!==null||this.deviceState.device.orientation!==null,devicesConnected:this.deviceState.devices.length>0,mouse:{isInCanvas:n.isInCanvas,leftButton:n.leftButton,rightButton:n.rightButton,middleButton:n.middleButton},pointer:{isDown:a.isDown,isInCanvas:a.isInCanvas,active:a.type!=="none"},touchCount:this.interactionSystem.getTouchCount(),keyboardConsumed:this.interactionSystem.getKeyboardConsumed(),cv:o}}recordCapabilityFrame(t,s,i){this.capabilityMonitor.recordFrame(this.gatherCapabilityInput(t,s,i))}getContextAndFinish(){const t=this.gl;return t&&t.finish(),t}detectContextType(){if(this.gl)return typeof WebGL2RenderingContext<"u"&&this.gl instanceof WebGL2RenderingContext?"webgl2":"webgl";if(this.ctx)return"2d"}fence2dCanvas(){const t=this.ctx;if(!t)return null;try{const s=performance.now();return t.getImageData(0,0,1,1),performance.now()-s}catch{return null}}fenceWebGLReadback(t){try{t.readPixels(0,0,1,1,t.RGBA,t.UNSIGNED_BYTE,new Uint8Array(4))}catch{}}handleRunFencedBenchmark(t){const s=Math.max(1,Math.floor(t.data.frameCount));if(this.benchmark){this.postMessage("error",{id:t.id,message:"A fenced benchmark is already running",code:"BENCHMARK_BUSY"});return}this.benchmark={id:t.id,remaining:s,samples:[],lastTimestamp:null}}recordBenchmarkFrame(t,s){const i=this.benchmark;if(!i)return;const n=performance.now(),a=this.getContextAndFinish();a&&this.fenceWebGLReadback(a);const o=a?performance.now()-n:this.fence2dCanvas(),u=i.lastTimestamp===null?0:t-i.lastTimestamp;i.lastTimestamp=t;const l=this.capabilityMonitor.evaluate(this.gatherCapabilityInput(t,s,u));i.samples.push({frameIndex:this.frameCount,timestamp:t,cpuMs:s,gpuMs:o,frameIntervalMs:u,capabilities:l}),i.remaining--,i.remaining<=0&&(this.postMessage("run-fenced-benchmark-result",{id:i.id,frames:i.samples}),this.benchmark=null)}async initP5Mode(t,s,i){try{this.rendererType="p5",this.debugLog("🎨 Initializing P5.js mode..."),this.p5Adapter=new hh(this.canvas,this.viji,{setup:t,render:s,canvasMode:i?.canvasMode==="webgl"?"webgl":"2d"}),await this.p5Adapter.init(),this.debugLog("✅ P5.js mode initialized successfully")}catch(n){console.error("❌ Failed to initialize P5.js mode:",n),this.postMessage("error",{message:`P5.js initialization failed: ${n.message}`,code:"P5_INIT_ERROR"}),this.rendererType="native",this.p5Adapter=null}}async initShaderMode(t,s){try{this.rendererType="shader",this.debugLog("🎨 Initializing Shader mode..."),this.shaderAdapter=new ze(this.canvas,this.viji,t,s?.redactDriverInfoLogs??false),await this.shaderAdapter.init();const i=this.shaderAdapter.getParameterDefinitions();for(const n of i)this.registerShaderParameter(n);this.debugLog("✅ Shader mode initialized successfully")}catch(i){console.error("❌ Failed to initialize Shader mode:",i),this.postMessage("error",{message:`Shader initialization failed: ${i.message}`,code:"SHADER_INIT_ERROR"}),this.rendererType="native",this.shaderAdapter=null}}registerShaderParameter(t){if(t.type==="accumulator")return;const s=t.config,i={...s,name:t.uniformName,label:t.label,description:s.description??""};switch(i.name!==t.uniformName&&(console.error(`[viji] Shader parameter identity mismatch for uniform "${t.uniformName}" — forcing name = uniformName.`),i.name=t.uniformName),t.type){case"slider":this.viji.slider(s.default,i);break;case"number":this.viji.number(s.default,i);break;case"color":this.viji.color(s.default,i);break;case"toggle":this.viji.toggle(s.default,i);break;case"select":this.viji.select(s.default,{...i,options:s.options});break;case"image":this.viji.image(null,i);break;case"button":this.viji.button(i);break;case"coordinate":{const n=Array.isArray(s.default)?s.default:[0,0];this.viji.coordinate({x:n[0],y:n[1]},i);break}case"cv":{if(Object.keys(s).length===0)break;this.viji.toggle(s.default,i);break}}}resetParameterState(){this.parameterSystem.resetParameterState(),this.interactionSystem.resetInteractionState(),this.resetAudioState(),this.videoSystems.forEach(t=>t?.resetVideoState()),this.videoSystems[0]&&Object.assign(this.viji.video,this.videoSystems[0].getVideoAPI()),this.updateVijiVideoStreams()}updateVijiVideoStreams(){const t=[],s=[];this.videoSystems.forEach((n,a)=>{if(!n)return;const o=Ps(a);o==="additional"?t.push(n):o==="directFrame"&&s.push(n)});const i=[...t,...s].map(n=>n.getVideoAPI());this.viji.videoStreams.length=i.length;for(let n=0;n<i.length;n++)this.viji.videoStreams[n]=i[n];this.debugLogStreamTable()}lastStreamTableSignature="";debugLogStreamTable(){if(!this.debugMode)return;const t=[];this.videoSystems.forEach((i,n)=>{if(!i)return;const a=i.peekDebugState();t.push(`${n}:${Ps(n)}${a.isConnected?" connected":""}${a.hasFrame?" frame":""}`)});const s=`[${t.join(", ")}] → videoStreams(${this.viji.videoStreams.length})`;s!==this.lastStreamTableSignature&&(this.lastStreamTableSignature=s,this.debugLog(`[Streams] ${s}`))}updateVijiAudioStreams(){const t=[];for(const[s,i]of this.audioStreamStates)s>=uh&&s<Ja&&t.push({index:s,...i});t.sort((s,i)=>s.index-i.index),this.viji.audioStreams.length=t.length;for(let s=0;s<t.length;s++){const i=t[s],n=i.frequencyData,a=i.waveformData;this.viji.audioStreams[s]={isConnected:i.isConnected,volume:i.volume,bands:i.bands,spectral:i.spectral,getFrequencyData:()=>n,getWaveform:()=>a}}}sendAllParametersToHost(){this.parameterSystem.sendAllParametersToHost()}seedInitialValues(t){this.parameterSystem.seedInitialValues(t)}setupMessageHandling(){self.onmessage=t=>{this.dispatchMessage(t.data)}}dispatchMessage(t){switch(t.type){case"init":this.handleInit(t).catch(s=>console.error("[Viji] handleInit failed:",s));break;case"frame-rate-update":this.handleFrameRateUpdate(t);break;case"refresh-rate-update":this.handleRefreshRateUpdate(t);break;case"cv-results-update":this.handleCVResultsUpdate(t);break;case"resolution-update":this.handleResolutionUpdate(t);break;case"set-scene-code":this.handleSetSceneCode(t);break;case"debug-mode":this.setDebugMode(t.data.enabled);break;case"parameter-update":this.handleParameterUpdate(t);break;case"parameter-batch-update":this.handleParameterBatchUpdate(t);break;case"audio-analysis-update":this.handleAudioAnalysisUpdate(t);break;case"audio-stream-setup":this.handleAudioStreamSetup(t);break;case"video-canvas-setup":this.handleVideoCanvasSetup(t);break;case"video-frame-update":this.handleVideoFrameUpdate(t);break;case"video-config-update":this.handleVideoConfigUpdate(t);break;case"video-streams-prepare":this.handleVideoStreamsPrepare(t);break;case"video-frame-direct":this.handleVideoFrameDirect(t);break;case"enable-auto-capture":this.autoCaptureEnabled=t.data.enabled,t.data.flipY!==void 0&&(this.autoCaptureFormat.flipY=t.data.flipY),t.data.frame!==void 0&&(this.autoCaptureFormat.frame=t.data.frame==="display"?"display":"plate"),this.debugLog(`[AutoCapture] ${t.data.enabled?"ENABLED":"DISABLED"} (flipY=${this.autoCaptureFormat.flipY}, frame=${this.autoCaptureFormat.frame})`);break;case"enable-capability-reporting":this.capabilityMonitor.setEnabled(t.data.enabled);break;case"set-render-loop-paused":this.setRenderLoopPaused(t.data.paused);break;case"run-fenced-benchmark":this.handleRunFencedBenchmark(t);break;case"mouse-update":this.handleMouseUpdate(t);break;case"keyboard-update":this.handleKeyboardUpdate(t);break;case"touch-update":this.handleTouchUpdate(t);break;case"interaction-enabled":this.handleInteractionEnabled(t);break;case"device-state-update":this.handleDeviceStateUpdate(t);break;case"performance-update":this.handlePerformanceUpdate(t);break;case"capture-frame":this.handleCaptureFrame(t);break;case"sc-update":mo(t.data.t);break;case"rh-update":_o(t.data.h);break}}async handleInit(t){try{this.canvas=t.data.canvas,this.viji.canvas=this.canvas,this._isHeadless=!!t.data.isHeadless,t.data.reporterConfig&&this.sceneErrorReporter&&this.sceneErrorReporter.applyConfig(t.data.reporterConfig);const s=this.canvas.getContext.bind(this.canvas);this.canvas.getContext=(i,n)=>{const a=s(i,n);return a&&(this.contextAcquired=true,i==="2d"?(this.ctx=a,this.viji.ctx=this.ctx):(i==="webgl"||i==="webgl2")&&(this.gl=a,this.viji.gl=this.gl)),a},this.viji.width=this.canvas.width,this.viji.height=this.canvas.height,await ef(),t.data.sc&&await mo(t.data.sc),uf(this.canvas),t.data.rh!==void 0&&_o(t.data.rh),t.data.controlPort&&(this.controlPort=t.data.controlPort,this.controlPort.onmessage=i=>{this.dispatchMessage(i.data)}),this.startRenderLoop(),self.postMessage({type:"init-response",id:t.id,timestamp:Date.now(),data:{id:t.id}})}catch(s){this.postMessage("error",{id:t.id,message:s.message,code:"INIT_ERROR"})}}handleFrameRateUpdate(t){t.data&&t.data.mode&&(this.frameRateMode=t.data.mode,this.frameSkipCounter=0,this.debugLog("Frame rate mode updated to:",t.data.mode))}getFrameRateDivisor(){switch(this.frameRateMode){case"full":return 1;case"half":return 2;case"quarter":return 4;case"eighth":return 8;default:return 1}}handleRefreshRateUpdate(t){t.data&&t.data.screenRefreshRate&&(this.screenRefreshRate=t.data.screenRefreshRate,this.debugLog("Screen refresh rate updated to:",t.data.screenRefreshRate+"Hz"))}trackEffectiveFrameTime(t){this.effectiveFrameTimes.push(t),this.effectiveFrameTimes.length>60&&this.effectiveFrameTimes.shift()}reportPerformanceStats(t){if(t-this.lastEffectiveRateReport>=this.effectiveRateReportInterval){if(this.effectiveFrameTimes.length>=2){const s=this.effectiveFrameTimes[this.effectiveFrameTimes.length-1]-this.effectiveFrameTimes[0],i=this.effectiveFrameTimes.length-1,n=Math.round(i/s*1e3),a=this.capabilityMonitor.flush();this.postMessage("performance-update",{effectiveRefreshRate:n,frameRateMode:this.frameRateMode,screenRefreshRate:this.screenRefreshRate,contextType:this.detectContextType(),...a&&{frames:a.frames,timing:a.timing,capabilities:a.capabilities}})}this.lastEffectiveRateReport=t}}handleResolutionUpdate(t){t.data&&(this.canvas&&(this.canvas.width=Math.round(t.data.effectiveWidth),this.canvas.height=Math.round(t.data.effectiveHeight)),this.viji.width=Math.round(t.data.effectiveWidth),this.viji.height=Math.round(t.data.effectiveHeight),this._displayScale=t.data.displayScale??1,this.gl&&this.gl.viewport(0,0,this.viji.width,this.viji.height),this.p5Adapter&&this.rendererType==="p5"&&this.p5Adapter.resize(this.viji.width,this.viji.height),this.shaderAdapter&&this.rendererType==="shader"&&this.shaderAdapter.resize(this.viji.width,this.viji.height),this.debugLog("Canvas resolution updated to:",this.viji.width+"x"+this.viji.height))}handleParameterUpdate(t){t.data&&t.data.name!==void 0&&t.data.value!==void 0&&this.parameterSystem.updateParameterValue(t.data.name,t.data.value)}handleParameterBatchUpdate(t){if(t.data&&t.data.updates){for(const s of t.data.updates)this.parameterSystem.updateParameterValue(s.name,s.value);this.parameterSystem.markInitialValuesSynced(),this.debugLog("Parameter system initialized successfully")}}handleCVResultsUpdate(t){const s=this.videoSystems[t.data.streamIndex];if(s)s.handleCVResultsUpdate(t.data);else if(t.data.analysedFrame)try{t.data.analysedFrame.close()}catch{}}handleAudioAnalysisUpdate(t){const s=t.data,i=s.streamIndex??0;i===0?this.handleMainAudioUpdate(s):this.handleAdditionalAudioUpdate(i,s)}handleMainAudioUpdate(t){const s=this.viji.audio;if(s.isConnected=t.isConnected,s.volume.current=t.volume.current,s.volume.peak=t.volume.peak,s.volume.smoothed=t.volume.smoothed,s.bands.low=t.bands.low,s.bands.lowMid=t.bands.lowMid,s.bands.mid=t.bands.mid,s.bands.highMid=t.bands.highMid,s.bands.high=t.bands.high,s.bands.lowSmoothed=t.bands.lowSmoothed,s.bands.lowMidSmoothed=t.bands.lowMidSmoothed,s.bands.midSmoothed=t.bands.midSmoothed,s.bands.highMidSmoothed=t.bands.highMidSmoothed,s.bands.highSmoothed=t.bands.highSmoothed,t.beat){s.beat.kick=t.beat.kick,s.beat.snare=t.beat.snare,s.beat.hat=t.beat.hat,s.beat.any=t.beat.any,s.beat.kickSmoothed=t.beat.kickSmoothed,s.beat.snareSmoothed=t.beat.snareSmoothed,s.beat.hatSmoothed=t.beat.hatSmoothed,s.beat.anySmoothed=t.beat.anySmoothed;const i=t.beat.events||[];i.length>0&&(s.beat.triggers.kick=s.beat.triggers.kick||i.some(n=>n.type==="kick"),s.beat.triggers.snare=s.beat.triggers.snare||i.some(n=>n.type==="snare"),s.beat.triggers.hat=s.beat.triggers.hat||i.some(n=>n.type==="hat"),s.beat.triggers.any=true,s.beat.events.push(...i)),s.beat.bpm=t.beat.bpm,s.beat.confidence=t.beat.confidence,s.beat.isLocked=t.beat.isLocked}s.spectral.brightness=t.spectral.brightness,s.spectral.flatness=t.spectral.flatness,this.audioFrequencyData=new Uint8Array(t.frequencyData),this.audioWaveformData=t.waveformData?new Float32Array(t.waveformData):new Float32Array(0)}handleAdditionalAudioUpdate(t,s){const i=new Uint8Array(s.frequencyData),n=s.waveformData?new Float32Array(s.waveformData):new Float32Array(0),a=this.audioStreamStates.get(t);a?(a.isConnected=s.isConnected,Object.assign(a.volume,s.volume),Object.assign(a.bands,s.bands),Object.assign(a.spectral,s.spectral),a.frequencyData=i,a.waveformData=n):this.audioStreamStates.set(t,{isConnected:s.isConnected,volume:{...s.volume},bands:{...s.bands},spectral:{...s.spectral},frequencyData:i,waveformData:n}),this.updateVijiAudioStreams(),t>=Ja&&this.wireDeviceAudio(t)}wireDeviceAudio(t){const s=this.audioStreamStates.get(t);if(!s)return;let i;for(const[a,o]of this.deviceAudioMap)if(o===t){i=a;break}if(!i)return;const n=this.viji.devices.find(a=>a.id===i);n&&(n.audio?n.audio.isConnected=s.isConnected:n.audio={isConnected:s.isConnected,volume:s.volume,bands:s.bands,spectral:s.spectral,getFrequencyData:()=>s.frequencyData,getWaveform:()=>s.waveformData})}handleAudioStreamSetup(t){const{streamIndex:s,streamType:i,deviceId:n}=t.data;switch(i){case"additional":this.updateVijiAudioStreams();break;case"device":n&&(this.deviceAudioMap.set(n,s),this.wireDeviceAudio(s));break}this.debugLog(`Audio stream setup at index ${s}, type: ${i}${n?`, deviceId: ${n}`:""}`)}resetAudioFrameEvents(){const t=this.viji.audio.beat.triggers;t.kick=false,t.snare=false,t.hat=false,t.any=false,this.viji.audio.beat.events.length=0}resetAudioState(){const t=this.viji.audio;t.isConnected=false,t.volume.current=0,t.volume.peak=0,t.volume.smoothed=0,t.bands.low=0,t.bands.lowMid=0,t.bands.mid=0,t.bands.highMid=0,t.bands.high=0,t.bands.lowSmoothed=0,t.bands.lowMidSmoothed=0,t.bands.midSmoothed=0,t.bands.highMidSmoothed=0,t.bands.highSmoothed=0,t.beat.kick=0,t.beat.snare=0,t.beat.hat=0,t.beat.any=0,t.beat.kickSmoothed=0,t.beat.snareSmoothed=0,t.beat.hatSmoothed=0,t.beat.anySmoothed=0,t.beat.triggers.kick=false,t.beat.triggers.snare=false,t.beat.triggers.hat=false,t.beat.triggers.any=false,t.beat.events.length=0,t.beat.bpm=0,t.beat.confidence=0,t.beat.isLocked=false,t.spectral.brightness=0,t.spectral.flatness=0,this.audioFrequencyData=new Uint8Array(0),this.audioWaveformData=new Float32Array(0),this.audioStreamStates.clear(),this.deviceAudioMap.clear(),this.viji.audioStreams.length=0}handleVideoCanvasSetup(t){const{streamIndex:s,deviceId:i}=t.data,n=s||0,a=Ps(n);let o=this.videoSystems[n];const u=!!o;switch(o||(o=new ui,o.setDebugMode(this.debugMode),o.setCVMessaging(n,(l,h)=>{this.postMessage("cv-feature-request",{streamIndex:l,desired:h})}),this.videoSystems[n]=o),o.setDeviceId(i),o.handleCanvasSetup({offscreenCanvas:t.data.offscreenCanvas,width:t.data.width,height:t.data.height,timestamp:t.data.timestamp}),this.debugLog(`Video system ${u?"reused":"created"} at index ${n}, role: ${a}${i?`, deviceId: ${i}`:""}`),a){case"main":Object.assign(this.viji.video,o.getVideoAPI());break;case"additional":this.updateVijiVideoStreams();break;case"device":if(i){this.deviceVideoMap.set(i,n);const l=this.viji.devices.find(h=>h.id===i);l&&(l.video?Object.assign(l.video,o.getVideoAPI()):l.video=o.getVideoAPI())}break}}handleVideoFrameUpdate(t){const s=t.data.streamIndex||0,i=this.videoSystems[s];if(i){i.handleFrameUpdate({imageBitmap:t.data.imageBitmap,timestamp:t.data.timestamp});const n=Ps(s);if(n==="main")Object.assign(this.viji.video,i.getVideoAPI());else if(n==="device"){const a=i.getDeviceId();if(a){const o=this.viji.devices.find(u=>u.id===a);o&&(o.video?Object.assign(o.video,i.getVideoAPI()):o.video=i.getVideoAPI())}}}}handleVideoConfigUpdate(t){const s=t.data.streamIndex||0,i=this.videoSystems[s];if(i){const n=Ps(s),a=i.getDeviceId();if(t.data.disconnect&&n==="device"&&a){this.deviceVideoMap.delete(a);const o=this.viji.devices.find(u=>u.id===a);o&&(o.video=null)}if(i.handleVideoConfigUpdate({...t.data.targetFrameRate&&{targetFrameRate:t.data.targetFrameRate},...t.data.cvConfig&&{cvConfig:t.data.cvConfig},...t.data.width&&{width:t.data.width},...t.data.height&&{height:t.data.height},...t.data.disconnect&&{disconnect:t.data.disconnect},timestamp:t.data.timestamp}),n==="main")Object.assign(this.viji.video,i.getVideoAPI());else if(n==="device"&&a&&!t.data.disconnect){const o=this.viji.devices.find(u=>u.id===a);o&&(o.video?Object.assign(o.video,i.getVideoAPI()):o.video=i.getVideoAPI())}}}handleVideoStreamsPrepare(t){const{directFrameBaseIndex:s,directFrameCount:i}=t.data;this.debugLog(`[Compositor] Preparing ${i} direct frame slot(s) at base index ${s}`);for(let n=0;n<i;n++){const a=s+n;this.videoSystems[a]||(this.videoSystems[a]=new ui),this.videoSystems[a].setDebugMode(this.debugMode),this.videoSystems[a].initializeForDirectFrames(this.rendererType)}this.updateVijiVideoStreams(),this.debugLog(`[Compositor] Prepared ${i} direct frame slot(s)`)}handleVideoFrameDirect(t){const s=t.data.streamIndex||0;this.videoSystems[s]||(this.debugLog(`[Compositor] Creating new VideoSystem at index ${s} for direct frames`),this.videoSystems[s]=new ui,this.videoSystems[s].setDebugMode(this.debugMode),this.videoSystems[s].initializeForDirectFrames(this.rendererType)),this.videoSystems[s].handleDirectFrame(t.data)}handlePerformanceUpdate(t){this.debugLog("Performance update:",t.data)}async handleCaptureFrame(t){this.pendingCaptures.push({queuedAt:performance.now(),message:t}),this.debugLog(`Capture queued: ${t.data.format||"blob"} (${this.pendingCaptures.length} pending)`)}async executeCaptureFrame(t){try{if(!this.canvas)throw new Error("Canvas not initialized");if((t.data.format||"blob")==="bitmap"){const z=this.canvas.transferToImageBitmap();this.postMessage("capture-frame-result",{id:t.id,bitmap:z},[z]);return}const i=t.data.type||"image/jpeg",n=this.canvas.width,a=this.canvas.height;let o=n,u=a;if(typeof t.data.resolution=="number"){const z=t.data.resolution>0?t.data.resolution:1;o=Math.max(1,Math.floor(n*z)),u=Math.max(1,Math.floor(a*z))}else t.data.resolution&&typeof t.data.resolution=="object"&&(o=Math.max(1,Math.floor(t.data.resolution.width)),u=Math.max(1,Math.floor(t.data.resolution.height)));const l=n/a,h=o/u;let d=0,m=0,_=n,k=a;Math.abs(l-h)>1e-6&&(h>l?(k=Math.floor(n/h),m=Math.floor((a-k)/2)):(_=Math.floor(a*h),d=Math.floor((n-_)/2)));let T;const P=this.getContextAndFinish();if(P){const z=t.data.frame==="display",J=z?P.getParameter(P.FRAMEBUFFER_BINDING):null;z&&P.bindFramebuffer(P.FRAMEBUFFER,null);const K=new Uint8Array(n*a*4);P.readPixels(0,0,n,a,P.RGBA,P.UNSIGNED_BYTE,K),z&&P.bindFramebuffer(P.FRAMEBUFFER,J);const X=new Uint8ClampedArray(n*a*4);for(let b=0;b<a;b++){const v=(a-1-b)*n*4,V=b*n*4;X.set(K.subarray(v,v+n*4),V)}T=new OffscreenCanvas(n,a);const re=T.getContext("2d");if(!re)throw new Error("Failed to create source context");const x=new ImageData(X,n,a);re.putImageData(x,0,0),this.debugLog("Captured frame from WebGL using readPixels (post-render)")}else T=this.canvas,this.debugLog("Captured frame from 2D canvas (post-render)");const F=new OffscreenCanvas(o,u),B=F.getContext("2d");if(!B)throw new Error("Failed to get 2D context");B.drawImage(T,d,m,_,k,0,0,o,u);const N=t.data.quality,Y=typeof N=="number"&&Number.isFinite(N)?Math.min(1,Math.max(0,N)):void 0,q=await F.convertToBlob(Y!==void 0?{type:i,quality:Y}:{type:i});this.postMessage("capture-frame-result",{id:t.id,blob:q})}catch(s){this.postMessage("error",{id:t.id,message:s.message,code:"CAPTURE_FRAME_ERROR"})}}handleSetSceneCode(t){let s=false;const i={resolve:u=>{s||(s=true,this.postMessage("scene-analysis",{id:t.id,...u}))},reject:u=>{s||(s=true,this.postMessage("error",{id:t.id,...u}))}},n=t.data?.sceneCode;if(typeof n!="string"){i.reject({message:"set-scene-code carried no scene code",code:"SCENE_ANALYSIS_ERROR"});return}const a={...t.data?.initialParameters&&{initialParameters:t.data.initialParameters},...t.data?.sk&&{keyComponent:t.data.sk}},o=self.setSceneCode;o(n,a,i).catch(u=>{const l=u;i.reject({message:`Scene load failed before analysis ack: ${l?.message??String(u)}`,code:"SCENE_ANALYSIS_ERROR"})})}startRenderLoop(){this.isRunning=true,this.startTime=performance.now(),this.lastTime=this.startTime,this.renderFrame()}runCaptures(t){for(const{message:s}of t)this.executeCaptureFrame(s).catch(i=>{console.error("Capture execution error:",i)})}runAutoCapture(){if(!(!this.autoCaptureEnabled||!this.canvas))try{const t=this.autoCaptureFormat.flipY?{imageOrientation:"flipY"}:{};createImageBitmap(this.canvas,t).then(s=>{this.postMessage("auto-capture-result",{bitmap:s,timestamp:performance.now()},[s])}).catch(s=>{console.warn("[AutoCapture] ImageBitmap creation failed:",s)})}catch(t){console.warn("[AutoCapture] Failed:",t)}}renderFrame(){if(!this.isRunning)return;const t=performance.now();this.updateVijiVideoStreams(),this.updateVijiAudioStreams();const s=this.getFrameRateDivisor();this.viji.fps=this.screenRefreshRate/s;const i=this.frameSkipCounter%s===0;if(this.frameSkipCounter++,i){const n=t-this.lastTime;this.viji.deltaTime=(t-this.lastTime)/1e3,this.viji.time=(t-this.startTime)/1e3,this.viji.frameCount=++this.frameCount,this.trackEffectiveFrameTime(t),this.lastTime=t,this.interactionSystem.updatePointerState();const a=performance.now();let o=false;try{if(this.shaderAdapter&&this.rendererType==="shader"){const d=this.parameterSystem.getAllParameterObjects();o=this.shaderAdapter.render(this.viji,d)}else if(this.p5Adapter&&this.rendererType==="p5"){const d=this.parameterSystem.getAllParameterObjects();o=this.p5Adapter.tick(this.viji,d)}else{const d=self.renderFunction;d&&typeof d=="function"&&(d(this.viji),o=true)}}catch(d){const m=d;console.error("Render error:",m),this.sceneErrorReporter?this.sceneErrorReporter.reportSceneError({message:m.message,...m.stack!==void 0&&{stack:m.stack},code:"RENDER_ERROR"}):this.postMessage("error",{message:m.message,code:"RENDER_ERROR",stack:m.stack})}const u=o&&this.contextAcquired;if(u&&this.sceneErrorReporter&&this.sceneErrorReporter.markFirstFrameProduced(),this.benchmark){const d=performance.now()-a;this.recordBenchmarkFrame(t,d)}else if(this.capabilityMonitor.isEnabled()){const d=performance.now()-a;this.recordCapabilityFrame(t,d,n)}if(this.parameterSystem.resetButtonParameters(),this.pendingCaptures.length>0){const d=performance.now()-pa.CAPTURE_QUEUE_TTL_MS;this.pendingCaptures=this.pendingCaptures.filter(m=>m.queuedAt>=d)}let l=[],h=[];if(u){const d=this.pendingCaptures;this.pendingCaptures=[],h=d.filter(m=>m.message.data.frame==="display"),l=d.filter(m=>m.message.data.frame!=="display")}if(this.runCaptures(l),u&&this.autoCaptureFormat.frame!=="display"&&this.runAutoCapture(),!this._isHeadless&&this.canvas){const d=tf("b",0);hf(this.canvas,this.ctx,this.gl,d,this._displayScale)}this.runCaptures(h),u&&this.autoCaptureFormat.frame==="display"&&this.runAutoCapture()}this.benchmark||this.reportPerformanceStats(t),this.interactionSystem.frameStart(),this.resetAudioFrameEvents(),this.scheduleNextFrame()}scheduleNextFrame(){this.rafScheduled||!this.isRunning||(this.rafScheduled=true,requestAnimationFrame(()=>{this.rafScheduled=false,this.renderFrame()}))}setRenderLoopPaused(t){t!==this.renderLoopPaused&&(this.renderLoopPaused=t,t?this.isRunning=false:(this.isRunning=true,this.scheduleNextFrame()))}postMessage(t,s,i){const n={type:t,id:s?.id||`${t}_${Date.now()}`,timestamp:Date.now(),data:s};this.controlPort?this.controlPort.postMessage(n,i??[]):self.postMessage(n,i??[])}handleMouseUpdate(t){this.interactionSystem.handleMouseUpdate(t.data)}handleKeyboardUpdate(t){this.interactionSystem.handleKeyboardUpdate(t.data)}handleTouchUpdate(t){this.interactionSystem.handleTouchUpdate(t.data)}handleInteractionEnabled(t){this.interactionSystem.setInteractionEnabled(t.data.enabled)}handleDeviceStateUpdate(t){this.deviceState=t.data,this.viji.device=this.deviceState.device;const s=this.deviceState.devices.map(i=>{const n=this.viji.devices.find(d=>d.id===i.id),a=this.deviceVideoMap.get(i.id),o=a!==void 0?this.videoSystems[a]:void 0,u=this.deviceAudioMap.get(i.id),l=u!==void 0?this.audioStreamStates.get(u):void 0,h=l?{isConnected:l.isConnected,volume:l.volume,bands:l.bands,spectral:l.spectral,getFrequencyData:()=>l.frequencyData,getWaveform:()=>l.waveformData}:null;return n?(n.name=i.name,n.motion=i.motion,n.orientation=i.orientation,h&&(n.audio=h),n):{...i,video:o?o.getVideoAPI():null,audio:h}});this.viji.devices=s}}class Ls{static detectRendererType(t){return/\/\/\s*@renderer\s+shader|\/\*\s*@renderer\s+shader\s*\*\//.test(t)?"shader":/\/\/\s*@renderer\s+p5|\/\*\s*@renderer\s+p5\s*\*\//.test(t)?"p5":"native"}static detectP5CanvasMode(t){return/\/\/\s*@renderer\s+p5\s+webgl\b|\/\*\s*@renderer\s+p5\s+webgl\s*\*\//i.test(t)?"webgl":"2d"}static detectCapabilities(t,s){const i=this.stripCommentsAndStrings(t),n={audio:false,video:false,mouse:false,keyboard:false,pointer:false,touch:false,parameters:false,sensors:false,devices:false,cv:{faceDetection:false,faceMesh:false,emotion:false,handTracking:false,poseDetection:false,segmentation:false}};return s==="shader"?this.detectShaderCapabilities(i,n):this.detectScriptCapabilities(i,n),n}static stripCommentsAndStrings(t){let s="";const i=t.length;let n=0;for(;n<i;){const a=t[n],o=n+1<i?t[n+1]:"";if(a==="/"&&o==="/"){for(n+=2;n<i&&t[n]!==`
|
|
446
|
-
`;)n++;continue}if(a==="/"&&o==="*"){for(n+=2;n<i&&!(t[n]==="*"&&t[n+1]==="/");)n++;n+=2,s+=" ";continue}if(a==='"'||a==="'"||a==="`"){const u=a;for(n++;n<i;){if(t[n]==="\\"){n+=2;continue}if(t[n]===u){n++;break}n++}s+=" ";continue}s+=a,n++}return s}static detectShaderCapabilities(t,s){/\bu_audio\w*/.test(t)&&(s.audio=true),/\bu_video\w*/.test(t)&&(s.video=true),/\bu_mouse\w*/.test(t)&&(s.mouse=true),/\bu_key\w*/.test(t)&&(s.keyboard=true),/\bu_touch\w*/.test(t)&&(s.touch=true),/\bu_pointer\w*/.test(t)&&(s.pointer=true),/\bu_device(Acceleration|AccelerationGravity|RotationRate|OrientationAbsolute|Orientation)\b/.test(t)&&(s.sensors=true),/\bu_device[0-7](AccelerationGravity|Acceleration|RotationRate|Orientation)\b/.test(t)&&(s.sensors=true,s.devices=true),/\bu_externalDeviceCount\b/.test(t)&&(s.devices=true,s.sensors=true),(/\bu_deviceCount\b/.test(t)||/\bu_device[0-7](Resolution|Connected)?\b/.test(t))&&(s.video=true,s.devices=true),/\bu_face\w*/.test(t)&&(s.cv.faceDetection=true),/\bu_face0(Neutral|Happy|Sad|Angry|Surprised|Disgusted|Fearful)\b/.test(t)&&(s.cv.emotion=true),(/\bu_face0HeadPose\b/.test(t)||/\bu_videoAnalysed\w*/.test(t)||/\bu_face0(Brow|Cheek|Eye|Jaw|Mouth|Nose|Tongue)\w*/.test(t))&&(s.cv.faceMesh=true),(/\bu_handCount\b/.test(t)||/\bu_(left|right)Hand\w*/.test(t))&&(s.cv.handTracking=true),(/\bu_pose\w*/.test(t)||/\bu_(nose|leftShoulder|rightShoulder|leftElbow|rightElbow|leftWrist|rightWrist|leftHip|rightHip|leftKnee|rightKnee|leftAnkle|rightAnkle)Position\b/.test(t))&&(s.cv.poseDetection=true),/\bu_segmentation\w*/.test(t)&&(s.cv.segmentation=true)}static detectScriptCapabilities(t,s){/\bviji\.audio/.test(t)&&(s.audio=true),/\bviji\.video/.test(t)&&(s.video=true),/\bviji\.mouse/.test(t)&&(s.mouse=true),/\bviji\.keyboard/.test(t)&&(s.keyboard=true),/\bviji\.touches/.test(t)&&(s.touch=true),/\bviji\.pointer/.test(t)&&(s.pointer=true),/\bviji\.device\b/.test(t)&&(s.sensors=true),/\bviji\.devices/.test(t)&&(s.devices=true),/\bviji\.(slider|color|toggle|select|text|number|image|button|coordinate)\s*\(/.test(t)&&(s.parameters=true),/\benableFaceDetection\b/.test(t)&&(s.cv.faceDetection=true),/\benableFaceMesh\b/.test(t)&&(s.cv.faceMesh=true),/\benableEmotionDetection\b/.test(t)&&(s.cv.emotion=true),/\benableHandTracking\b/.test(t)&&(s.cv.handTracking=true),/\benablePoseDetection\b/.test(t)&&(s.cv.poseDetection=true),/\benableBodySegmentation\b/.test(t)&&(s.cv.segmentation=true)}static detectAnalysedFrameUse(t){const s=this.stripCommentsAndStrings(t);return/\b(analysedFrame|getAnalysedFrameData)\b/.test(s)||/\bu_videoAnalysed\w*/.test(s)}static detectUsage(t,s){const i=this.stripCommentsAndStrings(t),n={mouse:{position:false,left:false,right:false,middle:false},pointer:{position:false,down:false},touch:false};return s==="shader"?(n.mouse.position=/\bu_mouse(\b|InCanvas|Delta|Wheel)/.test(i),n.mouse.left=/\bu_mouse(Left|Pressed|WasPressed|WasReleased)\b/.test(i),n.mouse.right=/\bu_mouseRight\b/.test(i),n.mouse.middle=/\bu_mouseMiddle\b/.test(i),n.pointer.position=/\bu_pointer(\b|Delta|InCanvas)/.test(i),n.pointer.down=/\bu_pointer(Down|WasPressed|WasReleased)\b/.test(i),n.touch=/\bu_touch/.test(i)):(n.mouse.position=/\bmouse\.(x|y|deltaX|deltaY|wheelDelta|wheelX|wheelY|wasMoved)\b/.test(i),n.mouse.left=/\bmouse\.(leftButton|isPressed|wasPressed|wasReleased)\b/.test(i),n.mouse.right=/\bmouse\.rightButton\b/.test(i),n.mouse.middle=/\bmouse\.middleButton\b/.test(i),n.pointer.position=/\bpointer\.(x|y|deltaX|deltaY)\b/.test(i),n.pointer.down=/\bpointer\.(isDown|wasPressed|wasReleased)\b/.test(i),n.touch=/\btouches\./.test(i)),n}}const da=5,
|
|
447
|
-
`);for(const i of s){const n=i.match(/\(?(<anonymous>):(\d+):(\d+)\)?$/);if(!n||n[1]!==this.functionBodySourceId)continue;const a=parseInt(n[2],10),o=parseInt(n[3],10),u=this.resolveLocation(a,o);return u?{source:"scene",sourceLocation:u}:{source:"scene"}}return{source:"engine"}}resolveLocation(t,s){const i=t-this.functionBodyLineOffset;if(!(i<1)){if(this.currentSourceMap){const n=
|
|
448
|
-
`);for(const o of a){const u=o.match(/\(?(<anonymous>):(\d+):(\d+)\)?$/);if(!u)continue;const l=parseInt(u[2],10);this.functionBodyLineOffset=l-1,this.functionBodySourceId=u[1];return}}}postEnvelope(t,s){this.post({type:t,id:`${t}_${s.signatureHash}_${++this.envelopeSeq}`,timestamp:Date.now(),data:s})}}class wo{windowMs;emitFn;pending=new Map;constructor(t,s){this.windowMs=t,this.emitFn=s}setWindowMs(t){this.windowMs=t}hasPending(t){return this.pending.has(t)}emit(t,s){const i=Date.now(),n=this.pending.get(t);if(n){if(n.payload.count++,n.payload.lastSeenAt=i,n.timer!==null)return;this.emitFn(n.payload),n.lastEmittedCount=n.payload.count,n.timer=setTimeout(()=>this.flush(t),this.windowMs);return}s.count=1,s.firstSeenAt=i,s.lastSeenAt=i,this.emitFn(s);const a=setTimeout(()=>this.flush(t),this.windowMs);this.pending.set(t,{payload:s,timer:a,lastEmittedCount:1})}flush(t){const s=this.pending.get(t);!s||s.timer===null||(clearTimeout(s.timer),s.timer=null,s.payload.count>s.lastEmittedCount&&(this.emitFn(s.payload),s.lastEmittedCount=s.payload.count))}flushAndClear(){for(const t of this.pending.values())t.timer!==null&&(clearTimeout(t.timer),t.timer=null,t.payload.count>t.lastEmittedCount&&this.emitFn(t.payload));this.pending.clear()}destroy(){for(const t of this.pending.values())t.timer!==null&&clearTimeout(t.timer);this.pending.clear()}}function Sf(e,t){const s="…[truncated]";let i;try{e===void 0?i="undefined":e===null?i="null":typeof e=="string"?i=e:typeof e=="number"||typeof e=="boolean"||typeof e=="bigint"?i=String(e):typeof e=="function"?i=`[Function: ${e.name||"anonymous"}]`:typeof e=="symbol"?i=e.toString():e instanceof Error?i=`${e.name}: ${e.message}`:i=Ef(e)}catch{i="[unstringifiable]"}return i.length>t?i.slice(0,Math.max(0,t-s.length))+s:i}function Ef(e){const t=new WeakSet;try{return JSON.stringify(e,function(s,i){if(typeof i=="object"&&i!==null){if(t.has(i))return"[Circular]";if(t.add(i),i instanceof Map||i instanceof Set)return Array.from(i.entries?i.entries():i)}return typeof i=="function"?`[Function: ${i.name||"anonymous"}]`:typeof i=="bigint"?`${i.toString()}n`:i})??"undefined"}catch{return"[unstringifiable]"}}function So(e){let i=2166136261;const a=e.join("");for(let o=0;o<a.length;o++)i^=a.charCodeAt(o),i=Math.imul(i,16777619);return(i>>>0).toString(16).padStart(8,"0")}var g;(function(e){e[e.NONE=0]="NONE";const s=1;e[e._abstract=s]="_abstract";const i=s+1;e[e._accessor=i]="_accessor";const n=i+1;e[e._as=n]="_as";const a=n+1;e[e._assert=a]="_assert";const o=a+1;e[e._asserts=o]="_asserts";const u=o+1;e[e._async=u]="_async";const l=u+1;e[e._await=l]="_await";const h=l+1;e[e._checks=h]="_checks";const d=h+1;e[e._constructor=d]="_constructor";const m=d+1;e[e._declare=m]="_declare";const _=m+1;e[e._enum=_]="_enum";const k=_+1;e[e._exports=k]="_exports";const T=k+1;e[e._from=T]="_from";const P=T+1;e[e._get=P]="_get";const F=P+1;e[e._global=F]="_global";const B=F+1;e[e._implements=B]="_implements";const N=B+1;e[e._infer=N]="_infer";const Y=N+1;e[e._interface=Y]="_interface";const q=Y+1;e[e._is=q]="_is";const z=q+1;e[e._keyof=z]="_keyof";const J=z+1;e[e._mixins=J]="_mixins";const K=J+1;e[e._module=K]="_module";const X=K+1;e[e._namespace=X]="_namespace";const re=X+1;e[e._of=re]="_of";const x=re+1;e[e._opaque=x]="_opaque";const b=x+1;e[e._out=b]="_out";const v=b+1;e[e._override=v]="_override";const V=v+1;e[e._private=V]="_private";const W=V+1;e[e._protected=W]="_protected";const M=W+1;e[e._proto=M]="_proto";const R=M+1;e[e._public=R]="_public";const O=R+1;e[e._readonly=O]="_readonly";const U=O+1;e[e._require=U]="_require";const I=U+1;e[e._satisfies=I]="_satisfies";const H=I+1;e[e._set=H]="_set";const G=H+1;e[e._static=G]="_static";const te=G+1;e[e._symbol=te]="_symbol";const ce=te+1;e[e._type=ce]="_type";const oe=ce+1;e[e._unique=oe]="_unique";const w=oe+1;e[e._using=w]="_using"})(g||(g={}));var r;(function(e){e[e.PRECEDENCE_MASK=15]="PRECEDENCE_MASK";const s=16;e[e.IS_KEYWORD=s]="IS_KEYWORD";const i=32;e[e.IS_ASSIGN=i]="IS_ASSIGN";const n=64;e[e.IS_RIGHT_ASSOCIATIVE=n]="IS_RIGHT_ASSOCIATIVE";const a=128;e[e.IS_PREFIX=a]="IS_PREFIX";const o=256;e[e.IS_POSTFIX=o]="IS_POSTFIX";const u=512;e[e.IS_EXPRESSION_START=u]="IS_EXPRESSION_START";const l=512;e[e.num=l]="num";const h=1536;e[e.bigint=h]="bigint";const d=2560;e[e.decimal=d]="decimal";const m=3584;e[e.regexp=m]="regexp";const _=4608;e[e.string=_]="string";const k=5632;e[e.name=k]="name";const T=6144;e[e.eof=T]="eof";const P=7680;e[e.bracketL=P]="bracketL";const F=8192;e[e.bracketR=F]="bracketR";const B=9728;e[e.braceL=B]="braceL";const N=10752;e[e.braceBarL=N]="braceBarL";const Y=11264;e[e.braceR=Y]="braceR";const q=12288;e[e.braceBarR=q]="braceBarR";const z=13824;e[e.parenL=z]="parenL";const J=14336;e[e.parenR=J]="parenR";const K=15360;e[e.comma=K]="comma";const X=16384;e[e.semi=X]="semi";const re=17408;e[e.colon=re]="colon";const x=18432;e[e.doubleColon=x]="doubleColon";const b=19456;e[e.dot=b]="dot";const v=20480;e[e.question=v]="question";const V=21504;e[e.questionDot=V]="questionDot";const W=22528;e[e.arrow=W]="arrow";const M=23552;e[e.template=M]="template";const R=24576;e[e.ellipsis=R]="ellipsis";const O=25600;e[e.backQuote=O]="backQuote";const U=27136;e[e.dollarBraceL=U]="dollarBraceL";const I=27648;e[e.at=I]="at";const H=29184;e[e.hash=H]="hash";const G=29728;e[e.eq=G]="eq";const te=30752;e[e.assign=te]="assign";const ce=32640;e[e.preIncDec=ce]="preIncDec";const oe=33664;e[e.postIncDec=oe]="postIncDec";const w=34432;e[e.bang=w]="bang";const E=35456;e[e.tilde=E]="tilde";const D=35841;e[e.pipeline=D]="pipeline";const L=36866;e[e.nullishCoalescing=L]="nullishCoalescing";const j=37890;e[e.logicalOR=j]="logicalOR";const se=38915;e[e.logicalAND=se]="logicalAND";const ne=39940;e[e.bitwiseOR=ne]="bitwiseOR";const de=40965;e[e.bitwiseXOR=de]="bitwiseXOR";const Se=41990;e[e.bitwiseAND=Se]="bitwiseAND";const ke=43015;e[e.equality=ke]="equality";const Fe=44040;e[e.lessThan=Fe]="lessThan";const Xe=45064;e[e.greaterThan=Xe]="greaterThan";const Ce=46088;e[e.relationalOrEqual=Ce]="relationalOrEqual";const Ve=47113;e[e.bitShiftL=Ve]="bitShiftL";const je=48137;e[e.bitShiftR=je]="bitShiftR";const ts=49802;e[e.plus=ts]="plus";const ds=50826;e[e.minus=ds]="minus";const Rs=51723;e[e.modulo=Rs]="modulo";const ar=52235;e[e.star=ar]="star";const or=53259;e[e.slash=or]="slash";const cr=54348;e[e.exponent=cr]="exponent";const ur=55296;e[e.jsxName=ur]="jsxName";const lr=56320;e[e.jsxText=lr]="jsxText";const hr=57344;e[e.jsxEmptyText=hr]="jsxEmptyText";const fr=58880;e[e.jsxTagStart=fr]="jsxTagStart";const pr=59392;e[e.jsxTagEnd=pr]="jsxTagEnd";const dr=60928;e[e.typeParameterStart=dr]="typeParameterStart";const mr=61440;e[e.nonNullAssertion=mr]="nonNullAssertion";const gr=62480;e[e._break=gr]="_break";const br=63504;e[e._case=br]="_case";const yr=64528;e[e._catch=yr]="_catch";const _r=65552;e[e._continue=_r]="_continue";const xr=66576;e[e._debugger=xr]="_debugger";const vr=67600;e[e._default=vr]="_default";const kr=68624;e[e._do=kr]="_do";const wr=69648;e[e._else=wr]="_else";const Sr=70672;e[e._finally=Sr]="_finally";const Er=71696;e[e._for=Er]="_for";const Tr=73232;e[e._function=Tr]="_function";const Ar=73744;e[e._if=Ar]="_if";const Ir=74768;e[e._return=Ir]="_return";const Cr=75792;e[e._switch=Cr]="_switch";const Rr=77456;e[e._throw=Rr]="_throw";const Pr=77840;e[e._try=Pr]="_try";const Lr=78864;e[e._var=Lr]="_var";const Dr=79888;e[e._let=Dr]="_let";const Nr=80912;e[e._const=Nr]="_const";const Fr=81936;e[e._while=Fr]="_while";const Ur=82960;e[e._with=Ur]="_with";const Mr=84496;e[e._new=Mr]="_new";const Or=85520;e[e._this=Or]="_this";const Br=86544;e[e._super=Br]="_super";const Vr=87568;e[e._class=Vr]="_class";const jr=88080;e[e._extends=jr]="_extends";const $r=89104;e[e._export=$r]="_export";const qr=90640;e[e._import=qr]="_import";const Hr=91664;e[e._yield=Hr]="_yield";const Wr=92688;e[e._null=Wr]="_null";const Gr=93712;e[e._true=Gr]="_true";const Xr=94736;e[e._false=Xr]="_false";const Yr=95256;e[e._in=Yr]="_in";const zr=96280;e[e._instanceof=zr]="_instanceof";const Kr=97936;e[e._typeof=Kr]="_typeof";const Zr=98960;e[e._void=Zr]="_void";const Ul=99984;e[e._delete=Ul]="_delete";const Ml=100880;e[e._async=Ml]="_async";const Ol=101904;e[e._get=Ol]="_get";const Bl=102928;e[e._set=Bl]="_set";const Vl=103952;e[e._declare=Vl]="_declare";const jl=104976;e[e._readonly=jl]="_readonly";const $l=106e3;e[e._abstract=$l]="_abstract";const ql=107024;e[e._static=ql]="_static";const Hl=107536;e[e._public=Hl]="_public";const Wl=108560;e[e._private=Wl]="_private";const Gl=109584;e[e._protected=Gl]="_protected";const Xl=110608;e[e._override=Xl]="_override";const Yl=112144;e[e._as=Yl]="_as";const zl=113168;e[e._enum=zl]="_enum";const Kl=114192;e[e._type=Kl]="_type";const Zl=115216;e[e._implements=Zl]="_implements"})(r||(r={}));function Tf(e){switch(e){case r.num:return"num";case r.bigint:return"bigint";case r.decimal:return"decimal";case r.regexp:return"regexp";case r.string:return"string";case r.name:return"name";case r.eof:return"eof";case r.bracketL:return"[";case r.bracketR:return"]";case r.braceL:return"{";case r.braceBarL:return"{|";case r.braceR:return"}";case r.braceBarR:return"|}";case r.parenL:return"(";case r.parenR:return")";case r.comma:return",";case r.semi:return";";case r.colon:return":";case r.doubleColon:return"::";case r.dot:return".";case r.question:return"?";case r.questionDot:return"?.";case r.arrow:return"=>";case r.template:return"template";case r.ellipsis:return"...";case r.backQuote:return"`";case r.dollarBraceL:return"${";case r.at:return"@";case r.hash:return"#";case r.eq:return"=";case r.assign:return"_=";case r.preIncDec:return"++/--";case r.postIncDec:return"++/--";case r.bang:return"!";case r.tilde:return"~";case r.pipeline:return"|>";case r.nullishCoalescing:return"??";case r.logicalOR:return"||";case r.logicalAND:return"&&";case r.bitwiseOR:return"|";case r.bitwiseXOR:return"^";case r.bitwiseAND:return"&";case r.equality:return"==/!=";case r.lessThan:return"<";case r.greaterThan:return">";case r.relationalOrEqual:return"<=/>=";case r.bitShiftL:return"<<";case r.bitShiftR:return">>/>>>";case r.plus:return"+";case r.minus:return"-";case r.modulo:return"%";case r.star:return"*";case r.slash:return"/";case r.exponent:return"**";case r.jsxName:return"jsxName";case r.jsxText:return"jsxText";case r.jsxEmptyText:return"jsxEmptyText";case r.jsxTagStart:return"jsxTagStart";case r.jsxTagEnd:return"jsxTagEnd";case r.typeParameterStart:return"typeParameterStart";case r.nonNullAssertion:return"nonNullAssertion";case r._break:return"break";case r._case:return"case";case r._catch:return"catch";case r._continue:return"continue";case r._debugger:return"debugger";case r._default:return"default";case r._do:return"do";case r._else:return"else";case r._finally:return"finally";case r._for:return"for";case r._function:return"function";case r._if:return"if";case r._return:return"return";case r._switch:return"switch";case r._throw:return"throw";case r._try:return"try";case r._var:return"var";case r._let:return"let";case r._const:return"const";case r._while:return"while";case r._with:return"with";case r._new:return"new";case r._this:return"this";case r._super:return"super";case r._class:return"class";case r._extends:return"extends";case r._export:return"export";case r._import:return"import";case r._yield:return"yield";case r._null:return"null";case r._true:return"true";case r._false:return"false";case r._in:return"in";case r._instanceof:return"instanceof";case r._typeof:return"typeof";case r._void:return"void";case r._delete:return"delete";case r._async:return"async";case r._get:return"get";case r._set:return"set";case r._declare:return"declare";case r._readonly:return"readonly";case r._abstract:return"abstract";case r._static:return"static";case r._public:return"public";case r._private:return"private";case r._protected:return"protected";case r._override:return"override";case r._as:return"as";case r._enum:return"enum";case r._type:return"type";case r._implements:return"implements";default:return""}}class At{constructor(t,s,i){this.startTokenIndex=t,this.endTokenIndex=s,this.isFunctionScope=i}}class Af{constructor(t,s,i,n,a,o,u,l,h,d,m,_,k){this.potentialArrowAt=t,this.noAnonFunctionType=s,this.inDisallowConditionalTypesContext=i,this.tokensLength=n,this.scopesLength=a,this.pos=o,this.type=u,this.contextualKeyword=l,this.start=h,this.end=d,this.isType=m,this.scopeDepth=_,this.error=k}}class He{constructor(){He.prototype.__init.call(this),He.prototype.__init2.call(this),He.prototype.__init3.call(this),He.prototype.__init4.call(this),He.prototype.__init5.call(this),He.prototype.__init6.call(this),He.prototype.__init7.call(this),He.prototype.__init8.call(this),He.prototype.__init9.call(this),He.prototype.__init10.call(this),He.prototype.__init11.call(this),He.prototype.__init12.call(this),He.prototype.__init13.call(this)}__init(){this.potentialArrowAt=-1}__init2(){this.noAnonFunctionType=false}__init3(){this.inDisallowConditionalTypesContext=false}__init4(){this.tokens=[]}__init5(){this.scopes=[]}__init6(){this.pos=0}__init7(){this.type=r.eof}__init8(){this.contextualKeyword=g.NONE}__init9(){this.start=0}__init10(){this.end=0}__init11(){this.isType=false}__init12(){this.scopeDepth=0}__init13(){this.error=null}snapshot(){return new Af(this.potentialArrowAt,this.noAnonFunctionType,this.inDisallowConditionalTypesContext,this.tokens.length,this.scopes.length,this.pos,this.type,this.contextualKeyword,this.start,this.end,this.isType,this.scopeDepth,this.error)}restoreFromSnapshot(t){this.potentialArrowAt=t.potentialArrowAt,this.noAnonFunctionType=t.noAnonFunctionType,this.inDisallowConditionalTypesContext=t.inDisallowConditionalTypesContext,this.tokens.length=t.tokensLength,this.scopes.length=t.scopesLength,this.pos=t.pos,this.type=t.type,this.contextualKeyword=t.contextualKeyword,this.start=t.start,this.end=t.end,this.isType=t.isType,this.scopeDepth=t.scopeDepth,this.error=t.error}}var y;(function(e){e[e.backSpace=8]="backSpace";const s=10;e[e.lineFeed=s]="lineFeed";const i=9;e[e.tab=i]="tab";const n=13;e[e.carriageReturn=n]="carriageReturn";const a=14;e[e.shiftOut=a]="shiftOut";const o=32;e[e.space=o]="space";const u=33;e[e.exclamationMark=u]="exclamationMark";const l=34;e[e.quotationMark=l]="quotationMark";const h=35;e[e.numberSign=h]="numberSign";const d=36;e[e.dollarSign=d]="dollarSign";const m=37;e[e.percentSign=m]="percentSign";const _=38;e[e.ampersand=_]="ampersand";const k=39;e[e.apostrophe=k]="apostrophe";const T=40;e[e.leftParenthesis=T]="leftParenthesis";const P=41;e[e.rightParenthesis=P]="rightParenthesis";const F=42;e[e.asterisk=F]="asterisk";const B=43;e[e.plusSign=B]="plusSign";const N=44;e[e.comma=N]="comma";const Y=45;e[e.dash=Y]="dash";const q=46;e[e.dot=q]="dot";const z=47;e[e.slash=z]="slash";const J=48;e[e.digit0=J]="digit0";const K=49;e[e.digit1=K]="digit1";const X=50;e[e.digit2=X]="digit2";const re=51;e[e.digit3=re]="digit3";const x=52;e[e.digit4=x]="digit4";const b=53;e[e.digit5=b]="digit5";const v=54;e[e.digit6=v]="digit6";const V=55;e[e.digit7=V]="digit7";const W=56;e[e.digit8=W]="digit8";const M=57;e[e.digit9=M]="digit9";const R=58;e[e.colon=R]="colon";const O=59;e[e.semicolon=O]="semicolon";const U=60;e[e.lessThan=U]="lessThan";const I=61;e[e.equalsTo=I]="equalsTo";const H=62;e[e.greaterThan=H]="greaterThan";const G=63;e[e.questionMark=G]="questionMark";const te=64;e[e.atSign=te]="atSign";const ce=65;e[e.uppercaseA=ce]="uppercaseA";const oe=66;e[e.uppercaseB=oe]="uppercaseB";const w=67;e[e.uppercaseC=w]="uppercaseC";const E=68;e[e.uppercaseD=E]="uppercaseD";const D=69;e[e.uppercaseE=D]="uppercaseE";const L=70;e[e.uppercaseF=L]="uppercaseF";const j=71;e[e.uppercaseG=j]="uppercaseG";const se=72;e[e.uppercaseH=se]="uppercaseH";const ne=73;e[e.uppercaseI=ne]="uppercaseI";const de=74;e[e.uppercaseJ=de]="uppercaseJ";const Se=75;e[e.uppercaseK=Se]="uppercaseK";const ke=76;e[e.uppercaseL=ke]="uppercaseL";const Fe=77;e[e.uppercaseM=Fe]="uppercaseM";const Xe=78;e[e.uppercaseN=Xe]="uppercaseN";const Ce=79;e[e.uppercaseO=Ce]="uppercaseO";const Ve=80;e[e.uppercaseP=Ve]="uppercaseP";const je=81;e[e.uppercaseQ=je]="uppercaseQ";const ts=82;e[e.uppercaseR=ts]="uppercaseR";const ds=83;e[e.uppercaseS=ds]="uppercaseS";const Rs=84;e[e.uppercaseT=Rs]="uppercaseT";const ar=85;e[e.uppercaseU=ar]="uppercaseU";const or=86;e[e.uppercaseV=or]="uppercaseV";const cr=87;e[e.uppercaseW=cr]="uppercaseW";const ur=88;e[e.uppercaseX=ur]="uppercaseX";const lr=89;e[e.uppercaseY=lr]="uppercaseY";const hr=90;e[e.uppercaseZ=hr]="uppercaseZ";const fr=91;e[e.leftSquareBracket=fr]="leftSquareBracket";const pr=92;e[e.backslash=pr]="backslash";const dr=93;e[e.rightSquareBracket=dr]="rightSquareBracket";const mr=94;e[e.caret=mr]="caret";const gr=95;e[e.underscore=gr]="underscore";const br=96;e[e.graveAccent=br]="graveAccent";const yr=97;e[e.lowercaseA=yr]="lowercaseA";const _r=98;e[e.lowercaseB=_r]="lowercaseB";const xr=99;e[e.lowercaseC=xr]="lowercaseC";const vr=100;e[e.lowercaseD=vr]="lowercaseD";const kr=101;e[e.lowercaseE=kr]="lowercaseE";const wr=102;e[e.lowercaseF=wr]="lowercaseF";const Sr=103;e[e.lowercaseG=Sr]="lowercaseG";const Er=104;e[e.lowercaseH=Er]="lowercaseH";const Tr=105;e[e.lowercaseI=Tr]="lowercaseI";const Ar=106;e[e.lowercaseJ=Ar]="lowercaseJ";const Ir=107;e[e.lowercaseK=Ir]="lowercaseK";const Cr=108;e[e.lowercaseL=Cr]="lowercaseL";const Rr=109;e[e.lowercaseM=Rr]="lowercaseM";const Pr=110;e[e.lowercaseN=Pr]="lowercaseN";const Lr=111;e[e.lowercaseO=Lr]="lowercaseO";const Dr=112;e[e.lowercaseP=Dr]="lowercaseP";const Nr=113;e[e.lowercaseQ=Nr]="lowercaseQ";const Fr=114;e[e.lowercaseR=Fr]="lowercaseR";const Ur=115;e[e.lowercaseS=Ur]="lowercaseS";const Mr=116;e[e.lowercaseT=Mr]="lowercaseT";const Or=117;e[e.lowercaseU=Or]="lowercaseU";const Br=118;e[e.lowercaseV=Br]="lowercaseV";const Vr=119;e[e.lowercaseW=Vr]="lowercaseW";const jr=120;e[e.lowercaseX=jr]="lowercaseX";const $r=121;e[e.lowercaseY=$r]="lowercaseY";const qr=122;e[e.lowercaseZ=qr]="lowercaseZ";const Hr=123;e[e.leftCurlyBrace=Hr]="leftCurlyBrace";const Wr=124;e[e.verticalBar=Wr]="verticalBar";const Gr=125;e[e.rightCurlyBrace=Gr]="rightCurlyBrace";const Xr=126;e[e.tilde=Xr]="tilde";const Yr=160;e[e.nonBreakingSpace=Yr]="nonBreakingSpace";const zr=5760;e[e.oghamSpaceMark=zr]="oghamSpaceMark";const Kr=8232;e[e.lineSeparator=Kr]="lineSeparator";const Zr=8233;e[e.paragraphSeparator=Zr]="paragraphSeparator"})(y||(y={}));let Qi,me,_e,c,$,_u;function Xs(){return _u++}function If(e){if("pos"in e){const t=Rf(e.pos);e.message+=` (${t.line}:${t.column})`,e.loc=t}return e}class Cf{constructor(t,s){this.line=t,this.column=s}}function Rf(e){let t=1,s=1;for(let i=0;i<e;i++)$.charCodeAt(i)===y.lineFeed?(t++,s=1):s++;return new Cf(t,s)}function Pf(e,t,s,i){$=e,c=new He,_u=1,Qi=t,me=s,_e=i}function ee(e){return c.contextualKeyword===e}function ma(e){const t=ri();return t.type===r.name&&t.contextualKeyword===e}function Le(e){return c.contextualKeyword===e&&S(r.name)}function Re(e){Le(e)||le()}function tt(){return p(r.eof)||p(r.braceR)||We()}function We(){const e=c.tokens[c.tokens.length-1],t=e?e.end:0;for(let s=t;s<c.start;s++){const i=$.charCodeAt(s);if(i===y.lineFeed||i===y.carriageReturn||i===8232||i===8233)return true}return false}function xu(){const e=ga();for(let t=c.end;t<e;t++){const s=$.charCodeAt(t);if(s===y.lineFeed||s===y.carriageReturn||s===8232||s===8233)return true}return false}function vt(){return S(r.semi)||tt()}function Ee(){vt()||le('Unexpected token, expected ";"')}function A(e){S(e)||le(`Unexpected token, expected "${Tf(e)}"`)}function le(e="Unexpected token",t=c.start){if(c.error)return;const s=new SyntaxError(e);s.pos=t,c.error=s,c.pos=$.length,ue(r.eof)}const vu=[9,11,12,y.space,y.nonBreakingSpace,y.oghamSpaceMark,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8239,8287,12288,65279],Eo=/(?:\s|\/\/.*|\/\*[^]*?\*\/)*/g,ku=new Uint8Array(65536);for(const e of vu)ku[e]=1;function Lf(e){if(e<48)return e===36;if(e<58)return true;if(e<65)return false;if(e<91)return true;if(e<97)return e===95;if(e<123)return true;if(e<128)return false;throw new Error("Should not be called with non-ASCII char code.")}const mt=new Uint8Array(65536);for(let e=0;e<128;e++)mt[e]=Lf(e)?1:0;for(let e=128;e<65536;e++)mt[e]=1;for(const e of vu)mt[e]=0;mt[8232]=0;mt[8233]=0;const ii=mt.slice();for(let e=y.digit0;e<=y.digit9;e++)ii[e]=0;const To=new Int32Array([-1,27,783,918,1755,2376,2862,3483,-1,3699,-1,4617,4752,4833,5130,5508,5940,-1,6480,6939,7749,8181,8451,8613,-1,8829,-1,-1,-1,54,243,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,432,-1,-1,-1,675,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,81,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,108,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,135,-1,-1,-1,-1,-1,-1,-1,-1,-1,162,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-1,-1,-1,-1,-1,-1,8883,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,8910,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,8937,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,(r._yield<<1)+1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1]);function Df(){let e=0,t=0,s=c.pos;for(;s<$.length&&(t=$.charCodeAt(s),!(t<y.lowercaseA||t>y.lowercaseZ));){const n=To[e+(t-y.lowercaseA)+1];if(n===-1)break;e=n,s++}const i=To[e];if(i>-1&&!mt[t]){c.pos=s,i&1?ue(i>>>1):ue(r.name,i>>>1);return}for(;s<$.length;){const n=$.charCodeAt(s);if(mt[n])s++;else if(n===y.backslash){if(s+=2,$.charCodeAt(s)===y.leftCurlyBrace){for(;s<$.length&&$.charCodeAt(s)!==y.rightCurlyBrace;)s++;s++}}else if(n===y.atSign&&$.charCodeAt(s+1)===y.atSign)s+=2;else break}c.pos=s,ue(r.name)}var ie;(function(e){e[e.Access=0]="Access";const s=1;e[e.ExportAccess=s]="ExportAccess";const i=s+1;e[e.TopLevelDeclaration=i]="TopLevelDeclaration";const n=i+1;e[e.FunctionScopedDeclaration=n]="FunctionScopedDeclaration";const a=n+1;e[e.BlockScopedDeclaration=a]="BlockScopedDeclaration";const o=a+1;e[e.ObjectShorthandTopLevelDeclaration=o]="ObjectShorthandTopLevelDeclaration";const u=o+1;e[e.ObjectShorthandFunctionScopedDeclaration=u]="ObjectShorthandFunctionScopedDeclaration";const l=u+1;e[e.ObjectShorthandBlockScopedDeclaration=l]="ObjectShorthandBlockScopedDeclaration";const h=l+1;e[e.ObjectShorthand=h]="ObjectShorthand";const d=h+1;e[e.ImportDeclaration=d]="ImportDeclaration";const m=d+1;e[e.ObjectKey=m]="ObjectKey";const _=m+1;e[e.ImportAccess=_]="ImportAccess"})(ie||(ie={}));var ft;(function(e){e[e.NoChildren=0]="NoChildren";const s=1;e[e.OneChild=s]="OneChild";const i=s+1;e[e.StaticChildren=i]="StaticChildren";const n=i+1;e[e.KeyAfterPropSpread=n]="KeyAfterPropSpread"})(ft||(ft={}));function wu(e){const t=e.identifierRole;return t===ie.TopLevelDeclaration||t===ie.FunctionScopedDeclaration||t===ie.BlockScopedDeclaration||t===ie.ObjectShorthandTopLevelDeclaration||t===ie.ObjectShorthandFunctionScopedDeclaration||t===ie.ObjectShorthandBlockScopedDeclaration}function Nf(e){const t=e.identifierRole;return t===ie.FunctionScopedDeclaration||t===ie.BlockScopedDeclaration||t===ie.ObjectShorthandFunctionScopedDeclaration||t===ie.ObjectShorthandBlockScopedDeclaration}function Su(e){const t=e.identifierRole;return t===ie.TopLevelDeclaration||t===ie.ObjectShorthandTopLevelDeclaration||t===ie.ImportDeclaration}function Ff(e){const t=e.identifierRole;return t===ie.TopLevelDeclaration||t===ie.BlockScopedDeclaration||t===ie.ObjectShorthandTopLevelDeclaration||t===ie.ObjectShorthandBlockScopedDeclaration}function Uf(e){const t=e.identifierRole;return t===ie.FunctionScopedDeclaration||t===ie.ObjectShorthandFunctionScopedDeclaration}function Mf(e){return e.identifierRole===ie.ObjectShorthandTopLevelDeclaration||e.identifierRole===ie.ObjectShorthandBlockScopedDeclaration||e.identifierRole===ie.ObjectShorthandFunctionScopedDeclaration}class Ji{constructor(){this.type=c.type,this.contextualKeyword=c.contextualKeyword,this.start=c.start,this.end=c.end,this.scopeDepth=c.scopeDepth,this.isType=c.isType,this.identifierRole=null,this.jsxRole=null,this.shadowsGlobal=false,this.isAsyncOperation=false,this.contextId=null,this.rhsEndIndex=null,this.isExpression=false,this.numNullishCoalesceStarts=0,this.numNullishCoalesceEnds=0,this.isOptionalChainStart=false,this.isOptionalChainEnd=false,this.subscriptStartIndex=null,this.nullishStartIndex=null}}function C(){c.tokens.push(new Ji),Iu()}function Xt(){c.tokens.push(new Ji),c.start=c.pos,ep()}function Of(){c.type===r.assign&&--c.pos,Zf()}function pe(e){for(let s=c.tokens.length-e;s<c.tokens.length;s++)c.tokens[s].isType=true;const t=c.isType;return c.isType=true,t}function fe(e){c.isType=e}function S(e){return p(e)?(C(),true):false}function Eu(e){const t=c.isType;c.isType=true,S(e),c.isType=t}function p(e){return c.type===e}function Ae(){const e=c.snapshot();C();const t=c.type;return c.restoreFromSnapshot(e),t}class Bf{constructor(t,s){this.type=t,this.contextualKeyword=s}}function ri(){const e=c.snapshot();C();const t=c.type,s=c.contextualKeyword;return c.restoreFromSnapshot(e),new Bf(t,s)}function ga(){return Tu(c.pos)}function Tu(e){Eo.lastIndex=e;const t=Eo.exec($);return e+t[0].length}function Au(){return $.charCodeAt(ga())}function Iu(){if(Ru(),c.start=c.pos,c.pos>=$.length){const e=c.tokens;e.length>=2&&e[e.length-1].start>=$.length&&e[e.length-2].start>=$.length&&le("Unexpectedly reached the end of input."),ue(r.eof);return}Vf($.charCodeAt(c.pos))}function Vf(e){ii[e]||e===y.backslash||e===y.atSign&&$.charCodeAt(c.pos+1)===y.atSign?Df():Du(e)}function jf(){for(;$.charCodeAt(c.pos)!==y.asterisk||$.charCodeAt(c.pos+1)!==y.slash;)if(c.pos++,c.pos>$.length){le("Unterminated comment",c.pos-2);return}c.pos+=2}function Cu(e){let t=$.charCodeAt(c.pos+=e);if(c.pos<$.length)for(;t!==y.lineFeed&&t!==y.carriageReturn&&t!==y.lineSeparator&&t!==y.paragraphSeparator&&++c.pos<$.length;)t=$.charCodeAt(c.pos)}function Ru(){for(;c.pos<$.length;){const e=$.charCodeAt(c.pos);switch(e){case y.carriageReturn:$.charCodeAt(c.pos+1)===y.lineFeed&&++c.pos;case y.lineFeed:case y.lineSeparator:case y.paragraphSeparator:++c.pos;break;case y.slash:switch($.charCodeAt(c.pos+1)){case y.asterisk:c.pos+=2,jf();break;case y.slash:Cu(2);break;default:return}break;default:if(ku[e])++c.pos;else return}}}function ue(e,t=g.NONE){c.end=c.pos,c.type=e,c.contextualKeyword=t}function $f(){const e=$.charCodeAt(c.pos+1);if(e>=y.digit0&&e<=y.digit9){Nu(true);return}e===y.dot&&$.charCodeAt(c.pos+2)===y.dot?(c.pos+=3,ue(r.ellipsis)):(++c.pos,ue(r.dot))}function qf(){$.charCodeAt(c.pos+1)===y.equalsTo?ve(r.assign,2):ve(r.slash,1)}function Hf(e){let t=e===y.asterisk?r.star:r.modulo,s=1,i=$.charCodeAt(c.pos+1);e===y.asterisk&&i===y.asterisk&&(s++,i=$.charCodeAt(c.pos+2),t=r.exponent),i===y.equalsTo&&$.charCodeAt(c.pos+2)!==y.greaterThan&&(s++,t=r.assign),ve(t,s)}function Wf(e){const t=$.charCodeAt(c.pos+1);if(t===e){$.charCodeAt(c.pos+2)===y.equalsTo?ve(r.assign,3):ve(e===y.verticalBar?r.logicalOR:r.logicalAND,2);return}if(e===y.verticalBar){if(t===y.greaterThan){ve(r.pipeline,2);return}else if(t===y.rightCurlyBrace&&_e){ve(r.braceBarR,2);return}}if(t===y.equalsTo){ve(r.assign,2);return}ve(e===y.verticalBar?r.bitwiseOR:r.bitwiseAND,1)}function Gf(){$.charCodeAt(c.pos+1)===y.equalsTo?ve(r.assign,2):ve(r.bitwiseXOR,1)}function Xf(e){const t=$.charCodeAt(c.pos+1);if(t===e){ve(r.preIncDec,2);return}t===y.equalsTo?ve(r.assign,2):e===y.plusSign?ve(r.plus,1):ve(r.minus,1)}function Yf(){const e=$.charCodeAt(c.pos+1);if(e===y.lessThan){if($.charCodeAt(c.pos+2)===y.equalsTo){ve(r.assign,3);return}c.isType?ve(r.lessThan,1):ve(r.bitShiftL,2);return}e===y.equalsTo?ve(r.relationalOrEqual,2):ve(r.lessThan,1)}function Pu(){if(c.isType){ve(r.greaterThan,1);return}const e=$.charCodeAt(c.pos+1);if(e===y.greaterThan){const t=$.charCodeAt(c.pos+2)===y.greaterThan?3:2;if($.charCodeAt(c.pos+t)===y.equalsTo){ve(r.assign,t+1);return}ve(r.bitShiftR,t);return}e===y.equalsTo?ve(r.relationalOrEqual,2):ve(r.greaterThan,1)}function Lu(){c.type===r.greaterThan&&(c.pos-=1,Pu())}function zf(e){const t=$.charCodeAt(c.pos+1);if(t===y.equalsTo){ve(r.equality,$.charCodeAt(c.pos+2)===y.equalsTo?3:2);return}if(e===y.equalsTo&&t===y.greaterThan){c.pos+=2,ue(r.arrow);return}ve(e===y.equalsTo?r.eq:r.bang,1)}function Kf(){const e=$.charCodeAt(c.pos+1),t=$.charCodeAt(c.pos+2);e===y.questionMark&&!(_e&&c.isType)?t===y.equalsTo?ve(r.assign,3):ve(r.nullishCoalescing,2):e===y.dot&&!(t>=y.digit0&&t<=y.digit9)?(c.pos+=2,ue(r.questionDot)):(++c.pos,ue(r.question))}function Du(e){switch(e){case y.numberSign:++c.pos,ue(r.hash);return;case y.dot:$f();return;case y.leftParenthesis:++c.pos,ue(r.parenL);return;case y.rightParenthesis:++c.pos,ue(r.parenR);return;case y.semicolon:++c.pos,ue(r.semi);return;case y.comma:++c.pos,ue(r.comma);return;case y.leftSquareBracket:++c.pos,ue(r.bracketL);return;case y.rightSquareBracket:++c.pos,ue(r.bracketR);return;case y.leftCurlyBrace:_e&&$.charCodeAt(c.pos+1)===y.verticalBar?ve(r.braceBarL,2):(++c.pos,ue(r.braceL));return;case y.rightCurlyBrace:++c.pos,ue(r.braceR);return;case y.colon:$.charCodeAt(c.pos+1)===y.colon?ve(r.doubleColon,2):(++c.pos,ue(r.colon));return;case y.questionMark:Kf();return;case y.atSign:++c.pos,ue(r.at);return;case y.graveAccent:++c.pos,ue(r.backQuote);return;case y.digit0:{const t=$.charCodeAt(c.pos+1);if(t===y.lowercaseX||t===y.uppercaseX||t===y.lowercaseO||t===y.uppercaseO||t===y.lowercaseB||t===y.uppercaseB){Qf();return}}case y.digit1:case y.digit2:case y.digit3:case y.digit4:case y.digit5:case y.digit6:case y.digit7:case y.digit8:case y.digit9:Nu(false);return;case y.quotationMark:case y.apostrophe:Jf(e);return;case y.slash:qf();return;case y.percentSign:case y.asterisk:Hf(e);return;case y.verticalBar:case y.ampersand:Wf(e);return;case y.caret:Gf();return;case y.plusSign:case y.dash:Xf(e);return;case y.lessThan:Yf();return;case y.greaterThan:Pu();return;case y.equalsTo:case y.exclamationMark:zf(e);return;case y.tilde:ve(r.tilde,1);return}le(`Unexpected character '${String.fromCharCode(e)}'`,c.pos)}function ve(e,t){c.pos+=t,ue(e)}function Zf(){const e=c.pos;let t=false,s=false;for(;;){if(c.pos>=$.length){le("Unterminated regular expression",e);return}const i=$.charCodeAt(c.pos);if(t)t=false;else{if(i===y.leftSquareBracket)s=true;else if(i===y.rightSquareBracket&&s)s=false;else if(i===y.slash&&!s)break;t=i===y.backslash}++c.pos}++c.pos,tp(),ue(r.regexp)}function fn(){for(;;){const e=$.charCodeAt(c.pos);if(e>=y.digit0&&e<=y.digit9||e===y.underscore)c.pos++;else break}}function Qf(){for(c.pos+=2;;){const t=$.charCodeAt(c.pos);if(t>=y.digit0&&t<=y.digit9||t>=y.lowercaseA&&t<=y.lowercaseF||t>=y.uppercaseA&&t<=y.uppercaseF||t===y.underscore)c.pos++;else break}$.charCodeAt(c.pos)===y.lowercaseN?(++c.pos,ue(r.bigint)):ue(r.num)}function Nu(e){let t=false,s=false;e||fn();let i=$.charCodeAt(c.pos);if(i===y.dot&&(++c.pos,fn(),i=$.charCodeAt(c.pos)),(i===y.uppercaseE||i===y.lowercaseE)&&(i=$.charCodeAt(++c.pos),(i===y.plusSign||i===y.dash)&&++c.pos,fn(),i=$.charCodeAt(c.pos)),i===y.lowercaseN?(++c.pos,t=true):i===y.lowercaseM&&(++c.pos,s=true),t){ue(r.bigint);return}if(s){ue(r.decimal);return}ue(r.num)}function Jf(e){for(c.pos++;;){if(c.pos>=$.length){le("Unterminated string constant");return}const t=$.charCodeAt(c.pos);if(t===y.backslash)c.pos++;else if(t===e)break;c.pos++}c.pos++,ue(r.string)}function ep(){for(;;){if(c.pos>=$.length){le("Unterminated template");return}const e=$.charCodeAt(c.pos);if(e===y.graveAccent||e===y.dollarSign&&$.charCodeAt(c.pos+1)===y.leftCurlyBrace){if(c.pos===c.start&&p(r.template))if(e===y.dollarSign){c.pos+=2,ue(r.dollarBraceL);return}else{++c.pos,ue(r.backQuote);return}ue(r.template);return}e===y.backslash&&c.pos++,c.pos++}}function tp(){for(;c.pos<$.length;){const e=$.charCodeAt(c.pos);if(mt[e])c.pos++;else if(e===y.backslash){if(c.pos+=2,$.charCodeAt(c.pos)===y.leftCurlyBrace){for(;c.pos<$.length&&$.charCodeAt(c.pos)!==y.rightCurlyBrace;)c.pos++;c.pos++}}else break}}function Ys(e,t=e.currentIndex()){let s=t+1;if(fi(e,s)){const i=e.identifierNameAtIndex(t);return{isType:false,leftName:i,rightName:i,endIndex:s}}if(s++,fi(e,s))return{isType:true,leftName:null,rightName:null,endIndex:s};if(s++,fi(e,s))return{isType:false,leftName:e.identifierNameAtIndex(t),rightName:e.identifierNameAtIndex(t+2),endIndex:s};if(s++,fi(e,s))return{isType:true,leftName:null,rightName:null,endIndex:s};throw new Error(`Unexpected import/export specifier at ${t}`)}function fi(e,t){const s=e.tokens[t];return s.type===r.braceR||s.type===r.comma}var sp=new Map([["quot",'"'],["amp","&"],["apos","'"],["lt","<"],["gt",">"],["nbsp"," "],["iexcl","¡"],["cent","¢"],["pound","£"],["curren","¤"],["yen","¥"],["brvbar","¦"],["sect","§"],["uml","¨"],["copy","©"],["ordf","ª"],["laquo","«"],["not","¬"],["shy",""],["reg","®"],["macr","¯"],["deg","°"],["plusmn","±"],["sup2","²"],["sup3","³"],["acute","´"],["micro","µ"],["para","¶"],["middot","·"],["cedil","¸"],["sup1","¹"],["ordm","º"],["raquo","»"],["frac14","¼"],["frac12","½"],["frac34","¾"],["iquest","¿"],["Agrave","À"],["Aacute","Á"],["Acirc","Â"],["Atilde","Ã"],["Auml","Ä"],["Aring","Å"],["AElig","Æ"],["Ccedil","Ç"],["Egrave","È"],["Eacute","É"],["Ecirc","Ê"],["Euml","Ë"],["Igrave","Ì"],["Iacute","Í"],["Icirc","Î"],["Iuml","Ï"],["ETH","Ð"],["Ntilde","Ñ"],["Ograve","Ò"],["Oacute","Ó"],["Ocirc","Ô"],["Otilde","Õ"],["Ouml","Ö"],["times","×"],["Oslash","Ø"],["Ugrave","Ù"],["Uacute","Ú"],["Ucirc","Û"],["Uuml","Ü"],["Yacute","Ý"],["THORN","Þ"],["szlig","ß"],["agrave","à"],["aacute","á"],["acirc","â"],["atilde","ã"],["auml","ä"],["aring","å"],["aelig","æ"],["ccedil","ç"],["egrave","è"],["eacute","é"],["ecirc","ê"],["euml","ë"],["igrave","ì"],["iacute","í"],["icirc","î"],["iuml","ï"],["eth","ð"],["ntilde","ñ"],["ograve","ò"],["oacute","ó"],["ocirc","ô"],["otilde","õ"],["ouml","ö"],["divide","÷"],["oslash","ø"],["ugrave","ù"],["uacute","ú"],["ucirc","û"],["uuml","ü"],["yacute","ý"],["thorn","þ"],["yuml","ÿ"],["OElig","Œ"],["oelig","œ"],["Scaron","Š"],["scaron","š"],["Yuml","Ÿ"],["fnof","ƒ"],["circ","ˆ"],["tilde","˜"],["Alpha","Α"],["Beta","Β"],["Gamma","Γ"],["Delta","Δ"],["Epsilon","Ε"],["Zeta","Ζ"],["Eta","Η"],["Theta","Θ"],["Iota","Ι"],["Kappa","Κ"],["Lambda","Λ"],["Mu","Μ"],["Nu","Ν"],["Xi","Ξ"],["Omicron","Ο"],["Pi","Π"],["Rho","Ρ"],["Sigma","Σ"],["Tau","Τ"],["Upsilon","Υ"],["Phi","Φ"],["Chi","Χ"],["Psi","Ψ"],["Omega","Ω"],["alpha","α"],["beta","β"],["gamma","γ"],["delta","δ"],["epsilon","ε"],["zeta","ζ"],["eta","η"],["theta","θ"],["iota","ι"],["kappa","κ"],["lambda","λ"],["mu","μ"],["nu","ν"],["xi","ξ"],["omicron","ο"],["pi","π"],["rho","ρ"],["sigmaf","ς"],["sigma","σ"],["tau","τ"],["upsilon","υ"],["phi","φ"],["chi","χ"],["psi","ψ"],["omega","ω"],["thetasym","ϑ"],["upsih","ϒ"],["piv","ϖ"],["ensp"," "],["emsp"," "],["thinsp"," "],["zwnj",""],["zwj",""],["lrm",""],["rlm",""],["ndash","–"],["mdash","—"],["lsquo","‘"],["rsquo","’"],["sbquo","‚"],["ldquo","“"],["rdquo","”"],["bdquo","„"],["dagger","†"],["Dagger","‡"],["bull","•"],["hellip","…"],["permil","‰"],["prime","′"],["Prime","″"],["lsaquo","‹"],["rsaquo","›"],["oline","‾"],["frasl","⁄"],["euro","€"],["image","ℑ"],["weierp","℘"],["real","ℜ"],["trade","™"],["alefsym","ℵ"],["larr","←"],["uarr","↑"],["rarr","→"],["darr","↓"],["harr","↔"],["crarr","↵"],["lArr","⇐"],["uArr","⇑"],["rArr","⇒"],["dArr","⇓"],["hArr","⇔"],["forall","∀"],["part","∂"],["exist","∃"],["empty","∅"],["nabla","∇"],["isin","∈"],["notin","∉"],["ni","∋"],["prod","∏"],["sum","∑"],["minus","−"],["lowast","∗"],["radic","√"],["prop","∝"],["infin","∞"],["ang","∠"],["and","∧"],["or","∨"],["cap","∩"],["cup","∪"],["int","∫"],["there4","∴"],["sim","∼"],["cong","≅"],["asymp","≈"],["ne","≠"],["equiv","≡"],["le","≤"],["ge","≥"],["sub","⊂"],["sup","⊃"],["nsub","⊄"],["sube","⊆"],["supe","⊇"],["oplus","⊕"],["otimes","⊗"],["perp","⊥"],["sdot","⋅"],["lceil","⌈"],["rceil","⌉"],["lfloor","⌊"],["rfloor","⌋"],["lang","〈"],["rang","〉"],["loz","◊"],["spades","♠"],["clubs","♣"],["hearts","♥"],["diams","♦"]]);function Fu(e){const[t,s]=Ao(e.jsxPragma||"React.createElement"),[i,n]=Ao(e.jsxFragmentPragma||"React.Fragment");return{base:t,suffix:s,fragmentBase:i,fragmentSuffix:n}}function Ao(e){let t=e.indexOf(".");return t===-1&&(t=e.length),[e.slice(0,t),e.slice(t)]}class gt{getPrefixCode(){return""}getHoistedCode(){return""}getSuffixCode(){return""}}class ss extends gt{__init(){this.lastLineNumber=1}__init2(){this.lastIndex=0}__init3(){this.filenameVarName=null}__init4(){this.esmAutomaticImportNameResolutions={}}__init5(){this.cjsAutomaticModuleNameResolutions={}}constructor(t,s,i,n,a){super(),this.rootTransformer=t,this.tokens=s,this.importProcessor=i,this.nameManager=n,this.options=a,ss.prototype.__init.call(this),ss.prototype.__init2.call(this),ss.prototype.__init3.call(this),ss.prototype.__init4.call(this),ss.prototype.__init5.call(this),this.jsxPragmaInfo=Fu(a),this.isAutomaticRuntime=a.jsxRuntime==="automatic",this.jsxImportSource=a.jsxImportSource||"react"}process(){return this.tokens.matches1(r.jsxTagStart)?(this.processJSXTag(),true):false}getPrefixCode(){let t="";if(this.filenameVarName&&(t+=`const ${this.filenameVarName} = ${JSON.stringify(this.options.filePath||"")};`),this.isAutomaticRuntime)if(this.importProcessor)for(const[s,i]of Object.entries(this.cjsAutomaticModuleNameResolutions))t+=`var ${i} = require("${s}");`;else{const{createElement:s,...i}=this.esmAutomaticImportNameResolutions;s&&(t+=`import {createElement as ${s}} from "${this.jsxImportSource}";`);const n=Object.entries(i).map(([a,o])=>`${a} as ${o}`).join(", ");if(n){const a=this.jsxImportSource+(this.options.production?"/jsx-runtime":"/jsx-dev-runtime");t+=`import {${n}} from "${a}";`}}return t}processJSXTag(){const{jsxRole:t,start:s}=this.tokens.currentToken(),i=this.options.production?null:this.getElementLocationCode(s);this.isAutomaticRuntime&&t!==ft.KeyAfterPropSpread?this.transformTagToJSXFunc(i,t):this.transformTagToCreateElement(i)}getElementLocationCode(t){return`lineNumber: ${this.getLineNumberForIndex(t)}`}getLineNumberForIndex(t){const s=this.tokens.code;for(;this.lastIndex<t&&this.lastIndex<s.length;)s[this.lastIndex]===`
|
|
449
|
-
`&&this.lastLineNumber++,this.lastIndex++;return this.lastLineNumber}transformTagToJSXFunc(t,s){const i=s===ft.StaticChildren;this.tokens.replaceToken(this.getJSXFuncInvocationCode(i));let n=null;if(this.tokens.matches1(r.jsxTagEnd))this.tokens.replaceToken(`${this.getFragmentCode()}, {`),this.processAutomaticChildrenAndEndProps(s);else{if(this.processTagIntro(),this.tokens.appendCode(", {"),n=this.processProps(true),this.tokens.matches2(r.slash,r.jsxTagEnd))this.tokens.appendCode("}");else if(this.tokens.matches1(r.jsxTagEnd))this.tokens.removeToken(),this.processAutomaticChildrenAndEndProps(s);else throw new Error("Expected either /> or > at the end of the tag.");n&&this.tokens.appendCode(`, ${n}`)}for(this.options.production||(n===null&&this.tokens.appendCode(", void 0"),this.tokens.appendCode(`, ${i}, ${this.getDevSource(t)}, this`)),this.tokens.removeInitialToken();!this.tokens.matches1(r.jsxTagEnd);)this.tokens.removeToken();this.tokens.replaceToken(")")}transformTagToCreateElement(t){if(this.tokens.replaceToken(this.getCreateElementInvocationCode()),this.tokens.matches1(r.jsxTagEnd))this.tokens.replaceToken(`${this.getFragmentCode()}, null`),this.processChildren(true);else if(this.processTagIntro(),this.processPropsObjectWithDevInfo(t),!this.tokens.matches2(r.slash,r.jsxTagEnd))if(this.tokens.matches1(r.jsxTagEnd))this.tokens.removeToken(),this.processChildren(true);else throw new Error("Expected either /> or > at the end of the tag.");for(this.tokens.removeInitialToken();!this.tokens.matches1(r.jsxTagEnd);)this.tokens.removeToken();this.tokens.replaceToken(")")}getJSXFuncInvocationCode(t){return this.options.production?t?this.claimAutoImportedFuncInvocation("jsxs","/jsx-runtime"):this.claimAutoImportedFuncInvocation("jsx","/jsx-runtime"):this.claimAutoImportedFuncInvocation("jsxDEV","/jsx-dev-runtime")}getCreateElementInvocationCode(){if(this.isAutomaticRuntime)return this.claimAutoImportedFuncInvocation("createElement","");{const{jsxPragmaInfo:t}=this;return`${this.importProcessor&&this.importProcessor.getIdentifierReplacement(t.base)||t.base}${t.suffix}(`}}getFragmentCode(){if(this.isAutomaticRuntime)return this.claimAutoImportedName("Fragment",this.options.production?"/jsx-runtime":"/jsx-dev-runtime");{const{jsxPragmaInfo:t}=this;return(this.importProcessor&&this.importProcessor.getIdentifierReplacement(t.fragmentBase)||t.fragmentBase)+t.fragmentSuffix}}claimAutoImportedFuncInvocation(t,s){const i=this.claimAutoImportedName(t,s);return this.importProcessor?`${i}.call(void 0, `:`${i}(`}claimAutoImportedName(t,s){if(this.importProcessor){const i=this.jsxImportSource+s;return this.cjsAutomaticModuleNameResolutions[i]||(this.cjsAutomaticModuleNameResolutions[i]=this.importProcessor.getFreeIdentifierForPath(i)),`${this.cjsAutomaticModuleNameResolutions[i]}.${t}`}else return this.esmAutomaticImportNameResolutions[t]||(this.esmAutomaticImportNameResolutions[t]=this.nameManager.claimFreeName(`_${t}`)),this.esmAutomaticImportNameResolutions[t]}processTagIntro(){let t=this.tokens.currentIndex()+1;for(;this.tokens.tokens[t].isType||!this.tokens.matches2AtIndex(t-1,r.jsxName,r.jsxName)&&!this.tokens.matches2AtIndex(t-1,r.greaterThan,r.jsxName)&&!this.tokens.matches1AtIndex(t,r.braceL)&&!this.tokens.matches1AtIndex(t,r.jsxTagEnd)&&!this.tokens.matches2AtIndex(t,r.slash,r.jsxTagEnd);)t++;if(t===this.tokens.currentIndex()+1){const s=this.tokens.identifierName();Uu(s)&&this.tokens.replaceToken(`'${s}'`)}for(;this.tokens.currentIndex()<t;)this.rootTransformer.processToken()}processPropsObjectWithDevInfo(t){const s=this.options.production?"":`__self: this, __source: ${this.getDevSource(t)}`;if(!this.tokens.matches1(r.jsxName)&&!this.tokens.matches1(r.braceL)){s?this.tokens.appendCode(`, {${s}}`):this.tokens.appendCode(", null");return}this.tokens.appendCode(", {"),this.processProps(false),s?this.tokens.appendCode(` ${s}}`):this.tokens.appendCode("}")}processProps(t){let s=null;for(;;){if(this.tokens.matches2(r.jsxName,r.eq)){const i=this.tokens.identifierName();if(t&&i==="key"){s!==null&&this.tokens.appendCode(s.replace(/[^\n]/g,"")),this.tokens.removeToken(),this.tokens.removeToken();const n=this.tokens.snapshot();this.processPropValue(),s=this.tokens.dangerouslyGetAndRemoveCodeSinceSnapshot(n);continue}else this.processPropName(i),this.tokens.replaceToken(": "),this.processPropValue()}else if(this.tokens.matches1(r.jsxName)){const i=this.tokens.identifierName();this.processPropName(i),this.tokens.appendCode(": true")}else if(this.tokens.matches1(r.braceL))this.tokens.replaceToken(""),this.rootTransformer.processBalancedCode(),this.tokens.replaceToken("");else break;this.tokens.appendCode(",")}return s}processPropName(t){t.includes("-")?this.tokens.replaceToken(`'${t}'`):this.tokens.copyToken()}processPropValue(){this.tokens.matches1(r.braceL)?(this.tokens.replaceToken(""),this.rootTransformer.processBalancedCode(),this.tokens.replaceToken("")):this.tokens.matches1(r.jsxTagStart)?this.processJSXTag():this.processStringPropValue()}processStringPropValue(){const t=this.tokens.currentToken(),s=this.tokens.code.slice(t.start+1,t.end-1),i=Io(s),n=
|
|
445
|
+
}`;function cf(e){const t=new Path2D;for(const[s,i]of e.dots){const n=new Path2D;n.arc(s,i,1.875,0,Math.PI*2),t.addPath(n)}for(const s of e.paths)t.addPath(new Path2D(s));return t}function yo(e){const t=e.maxX-e.minX,s=e.maxY-e.minY,i=Math.ceil(t+ys*2),n=Math.ceil(s+ys*2),a=new OffscreenCanvas(i,n),o=a.getContext("2d");if(!o)return null;const u=cf(e);o.translate(ys-e.minX,ys-e.minY),o.fillStyle=sf;const l=[[e.shadowStd*2,.5],[8,.2],[2,.1]];for(const[h,d]of l)o.save(),o.shadowColor=`rgba(0,0,0,${d})`,o.shadowBlur=h,o.fill(u),o.restore();return o.fill(u),{canvas:a,bufW:i,bufH:n,contentW:t,contentH:s}}function uf(e){try{ha=yo(rf),fa=yo(nf)}catch(t){console.warn("[Viji] overlay: init failed",t)}}function _o(e){bu=e}function lf(e,t,s,i){const n=e===0,a=n?fa:ha;if(!a)return null;const o=a.contentW*i,u=a.contentH*i;let l,h;return e===0?(l=hn*i,h=hn*i):e===2?(l=go*i,h=s-u-go*i):(l=(t-o)/2,h=hn*i),{buffer:a,vertical:n,px:Math.round(l-ys*i),py:Math.round(h-ys*i),w:a.bufW*i,h:a.bufH*i}}function hf(e,t,s,i,n=1){if(i>=1)return;const a=lf(bu,e.width,e.height,n||1);a&&(t?df(t,a):s&&mf(s,e,a))}const yu=34229;function ff(e){const t=e;if(typeof t.createVertexArray=="function")return{create:()=>t.createVertexArray(),bind:i=>t.bindVertexArray(i)};const s=e.getExtension("OES_vertex_array_object");return s?{create:()=>s.createVertexArrayOES(),bind:i=>s.bindVertexArrayOES(i)}:null}function xo(e,t){if(!t)return null;const s=e.getParameter(e.TEXTURE_BINDING_2D),i=e.getParameter(e.UNPACK_FLIP_Y_WEBGL),n=e.getParameter(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL);e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,1),e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,0);const a=e.createTexture();return e.bindTexture(e.TEXTURE_2D,a),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,t),e.bindTexture(e.TEXTURE_2D,s),e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,i?1:0),e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,n?1:0),a}function pf(e){if(bo===e)return;bo=e,mu=xo(e,ha?.canvas??null),gu=xo(e,fa?.canvas??null);const t=e.createShader(e.VERTEX_SHADER);e.shaderSource(t,af),e.compileShader(t);const s=e.createShader(e.FRAGMENT_SHADER);if(e.shaderSource(s,of),e.compileShader(s),Ke=e.createProgram(),e.attachShader(Ke,t),e.attachShader(Ke,s),e.bindAttribLocation(Ke,0,"a_pos"),e.bindAttribLocation(Ke,1,"a_uv"),e.linkProgram(Ke),e.deleteShader(t),e.deleteShader(s),!e.getProgramParameter(Ke,e.LINK_STATUS)){console.warn("[Viji] overlay: shader link failed"),Ke=null;return}if(Vs=e.createBuffer(),Dt=e.getAttribLocation(Ke,"a_pos"),Nt=e.getAttribLocation(Ke,"a_uv"),qt=ff(e),qt){const i=e.getParameter(yu),n=e.getParameter(e.ARRAY_BUFFER_BINDING);Ci=qt.create(),qt.bind(Ci),e.bindBuffer(e.ARRAY_BUFFER,Vs),Dt>=0&&(e.enableVertexAttribArray(Dt),e.vertexAttribPointer(Dt,2,e.FLOAT,false,16,0)),Nt>=0&&(e.enableVertexAttribArray(Nt),e.vertexAttribPointer(Nt,2,e.FLOAT,false,16,8)),qt.bind(i),e.bindBuffer(e.ARRAY_BUFFER,n)}}function vo(e,t){return{index:t,buffer:e.getVertexAttrib(t,e.VERTEX_ATTRIB_ARRAY_BUFFER_BINDING),enabled:e.getVertexAttrib(t,e.VERTEX_ATTRIB_ARRAY_ENABLED),size:e.getVertexAttrib(t,e.VERTEX_ATTRIB_ARRAY_SIZE),type:e.getVertexAttrib(t,e.VERTEX_ATTRIB_ARRAY_TYPE),normalized:e.getVertexAttrib(t,e.VERTEX_ATTRIB_ARRAY_NORMALIZED),stride:e.getVertexAttrib(t,e.VERTEX_ATTRIB_ARRAY_STRIDE),offset:e.getVertexAttribOffset(t,e.VERTEX_ATTRIB_ARRAY_POINTER),currentValue:e.getVertexAttrib(t,e.CURRENT_VERTEX_ATTRIB)}}function ko(e,t){t.buffer&&(e.bindBuffer(e.ARRAY_BUFFER,t.buffer),e.vertexAttribPointer(t.index,t.size,t.type,t.normalized,t.stride,t.offset)),t.enabled?e.enableVertexAttribArray(t.index):e.disableVertexAttribArray(t.index),e.vertexAttrib4f(t.index,t.currentValue[0],t.currentValue[1],t.currentValue[2],t.currentValue[3])}function df(e,t){e.save(),e.globalAlpha=1,e.drawImage(t.buffer.canvas,t.px,t.py,t.w,t.h),e.restore()}function mf(e,t,s){if(pf(e),!Ke||!Vs)return;const i=s.vertical?gu:mu;if(!i)return;const n=t.width,a=t.height,o=s.px,u=s.py,l=s.w,h=s.h,d=o/n*2-1,m=1-(u+h)/a*2,_=(o+l)/n*2-1,k=1-u/a*2,T=!!(qt&&Ci),P=e.getParameter(e.CURRENT_PROGRAM),F=e.getParameter(e.ACTIVE_TEXTURE);e.activeTexture(e.TEXTURE0);const B=e.getParameter(e.TEXTURE_BINDING_2D),N=e.getParameter(e.ARRAY_BUFFER_BINDING),Y=e.getParameter(e.FRAMEBUFFER_BINDING),q=e.getParameter(e.VIEWPORT),z=e.isEnabled(e.BLEND),J=e.getParameter(e.BLEND_SRC_RGB),K=e.getParameter(e.BLEND_DST_RGB),X=e.getParameter(e.BLEND_SRC_ALPHA),re=e.getParameter(e.BLEND_DST_ALPHA),x=e.getParameter(e.BLEND_EQUATION_RGB),b=e.getParameter(e.BLEND_EQUATION_ALPHA),v=e.isEnabled(e.DEPTH_TEST),V=e.isEnabled(e.SCISSOR_TEST),W=e.isEnabled(e.STENCIL_TEST),M=e.isEnabled(e.CULL_FACE),R=e.getParameter(e.COLOR_WRITEMASK),O=e.getParameter(e.UNPACK_FLIP_Y_WEBGL),U=T?e.getParameter(yu):null,I=!T&&Dt>=0?vo(e,Dt):null,H=!T&&Nt>=0?vo(e,Nt):null;e.bindFramebuffer(e.FRAMEBUFFER,null),e.viewport(0,0,n,a),e.useProgram(Ke),e.enable(e.BLEND),e.blendEquation(e.FUNC_ADD),e.blendFunc(e.SRC_ALPHA,e.ONE_MINUS_SRC_ALPHA),e.disable(e.DEPTH_TEST),e.disable(e.SCISSOR_TEST),e.disable(e.STENCIL_TEST),e.disable(e.CULL_FACE),e.colorMask(true,true,true,true),e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,0),e.bindTexture(e.TEXTURE_2D,i),e.uniform1i(e.getUniformLocation(Ke,"u_tex"),0),e.uniform1f(e.getUniformLocation(Ke,"u_alpha"),1);const G=new Float32Array([d,m,0,0,_,m,1,0,d,k,0,1,d,k,0,1,_,m,1,0,_,k,1,1]);T?(qt.bind(Ci),e.bindBuffer(e.ARRAY_BUFFER,Vs),e.bufferData(e.ARRAY_BUFFER,G,e.DYNAMIC_DRAW)):(e.bindBuffer(e.ARRAY_BUFFER,Vs),e.bufferData(e.ARRAY_BUFFER,G,e.DYNAMIC_DRAW),Dt>=0&&(e.enableVertexAttribArray(Dt),e.vertexAttribPointer(Dt,2,e.FLOAT,false,16,0)),Nt>=0&&(e.enableVertexAttribArray(Nt),e.vertexAttribPointer(Nt,2,e.FLOAT,false,16,8))),e.drawArrays(e.TRIANGLES,0,6),T?qt.bind(U):(H&&ko(e,H),I&&ko(e,I)),e.bindFramebuffer(e.FRAMEBUFFER,Y),e.viewport(q[0],q[1],q[2],q[3]),e.bindBuffer(e.ARRAY_BUFFER,N),e.colorMask(R[0],R[1],R[2],R[3]),e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,O?1:0),V?e.enable(e.SCISSOR_TEST):e.disable(e.SCISSOR_TEST),W?e.enable(e.STENCIL_TEST):e.disable(e.STENCIL_TEST),M?e.enable(e.CULL_FACE):e.disable(e.CULL_FACE),v?e.enable(e.DEPTH_TEST):e.disable(e.DEPTH_TEST),z?e.enable(e.BLEND):e.disable(e.BLEND),e.blendFuncSeparate(J,K,X,re),e.blendEquationSeparate(x,b),e.activeTexture(e.TEXTURE0),e.bindTexture(e.TEXTURE_2D,B),e.activeTexture(F),e.useProgram(P)}class pa{canvas=null;ctx=null;gl=null;contextAcquired=false;isRunning=false;renderLoopPaused=false;rafScheduled=false;frameCount=0;lastTime=0;startTime=0;frameRateMode="full";frameSkipCounter=0;screenRefreshRate=60;debugMode=false;p5Adapter=null;shaderAdapter=null;rendererType="native";_isHeadless=false;_displayScale=1;sceneErrorReporter=null;controlPort=null;pendingCaptures=[];static CAPTURE_QUEUE_TTL_MS=1e4;setSceneErrorReporter(t){this.sceneErrorReporter=t}getSceneErrorReporter(){return this.sceneErrorReporter}setDebugMode(t){this.debugMode=t,this.videoSystems.forEach(s=>s?.setDebugMode(t)),this.parameterSystem&&"setDebugMode"in this.parameterSystem&&this.parameterSystem.setDebugMode(t),this.interactionSystem&&"setDebugMode"in this.interactionSystem&&this.interactionSystem.setDebugMode(t)}debugLog(t,...s){this.debugMode&&console.log(t,...s)}effectiveFrameTimes=[];lastEffectiveRateReport=0;effectiveRateReportInterval=1e3;parameterSystem;interactionSystem;capabilityMonitor=new lh;benchmark=null;videoSystems=[];autoCaptureEnabled=false;autoCaptureFormat={flipY:true,frame:"plate"};audioFrequencyData=new Uint8Array(0);audioWaveformData=new Float32Array(0);deviceState={device:{motion:null,orientation:null},devices:[]};deviceVideoMap=new Map;audioStreamStates=new Map;deviceAudioMap=new Map;viji={canvas:null,ctx:null,gl:null,width:0,height:0,time:0,deltaTime:0,frameCount:0,fps:60,audio:{isConnected:false,volume:{current:0,peak:0,smoothed:0},bands:{low:0,lowMid:0,mid:0,highMid:0,high:0,lowSmoothed:0,lowMidSmoothed:0,midSmoothed:0,highMidSmoothed:0,highSmoothed:0},beat:{kick:0,snare:0,hat:0,any:0,kickSmoothed:0,snareSmoothed:0,hatSmoothed:0,anySmoothed:0,triggers:{any:false,kick:false,snare:false,hat:false},events:[],bpm:0,confidence:0,isLocked:false},spectral:{brightness:0,flatness:0},getFrequencyData:()=>new Uint8Array(0),getWaveform:()=>new Float32Array(0)},video:{isConnected:false,currentFrame:null,frameWidth:0,frameHeight:0,frameRate:0,getFrameData:()=>null,cv:null},videoStreams:[],audioStreams:[],mouse:{},keyboard:{},touches:{},device:{motion:null,orientation:null},devices:[],slider:(t,s)=>this.parameterSystem.createSliderParameter(t,s),color:(t,s)=>this.parameterSystem.createColorParameter(t,s),toggle:(t,s)=>this.parameterSystem.createToggleParameter(t,s),select:(t,s)=>this.parameterSystem.createSelectParameter(t,s),text:(t,s)=>this.parameterSystem.createTextParameter(t,s),number:(t,s)=>this.parameterSystem.createNumberParameter(t,s),image:(t,s)=>this.parameterSystem.createImageParameter(t,s),button:t=>this.parameterSystem.createButtonParameter(t),coordinate:(t,s)=>this.parameterSystem.createCoordinateParameter(t,s),useContext:t=>t==="2d"?(!this.ctx&&this.canvas&&(this.ctx=this.canvas.getContext("2d"),this.viji.ctx=this.ctx),this.ctx):t==="webgl"||t==="webgl2"?(!this.gl&&this.canvas&&(this.gl=t==="webgl2"?this.canvas.getContext("webgl2"):this.canvas.getContext("webgl"),this.viji.gl=this.gl,this.gl&&this.gl.viewport(0,0,this.viji.width,this.viji.height)),this.gl):null};constructor(){this.parameterSystem=new sh((t,s)=>{this.postMessage(t,s)}),this.interactionSystem=new ih,this.videoSystems[0]=new ui,this.videoSystems[0].setCVMessaging(0,(t,s)=>{this.postMessage("cv-feature-request",{streamIndex:t,desired:s})}),this.viji.video.cv=this.videoSystems[0].getCvSurface(),Object.assign(this.viji,this.interactionSystem.getInteractionAPIs()),this.viji.audio.getFrequencyData=()=>this.audioFrequencyData,this.viji.audio.getWaveform=()=>this.audioWaveformData,this.capabilityMonitor.setTransitionCallback(t=>{this.postMessage("capability-transition",t)}),this.setupMessageHandling()}setCapabilityUsageMask(t){this.capabilityMonitor.setUsageMask(t)}gatherCapabilityInput(t,s,i){const n=this.interactionSystem.getMouseState(),a=this.interactionSystem.getPointerState(),o=this.videoSystems[0]?this.videoSystems[0].getCVActivity():{faceDetection:{active:false,meaningful:false},faceMesh:{active:false,meaningful:false},emotion:{active:false,meaningful:false},handTracking:{active:false,meaningful:false},poseDetection:{active:false,meaningful:false},segmentation:{active:false,meaningful:false}};return{frameIndex:this.frameCount,timestamp:t,cpuMs:s,frameIntervalMs:i,audioConnected:this.viji.audio.isConnected,videoConnected:this.viji.video.isConnected,sensorsConnected:this.deviceState.device.motion!==null||this.deviceState.device.orientation!==null,devicesConnected:this.deviceState.devices.length>0,mouse:{isInCanvas:n.isInCanvas,leftButton:n.leftButton,rightButton:n.rightButton,middleButton:n.middleButton},pointer:{isDown:a.isDown,isInCanvas:a.isInCanvas,active:a.type!=="none"},touchCount:this.interactionSystem.getTouchCount(),keyboardConsumed:this.interactionSystem.getKeyboardConsumed(),cv:o}}recordCapabilityFrame(t,s,i){this.capabilityMonitor.recordFrame(this.gatherCapabilityInput(t,s,i))}getContextAndFinish(){const t=this.gl;return t&&t.finish(),t}detectContextType(){if(this.gl)return typeof WebGL2RenderingContext<"u"&&this.gl instanceof WebGL2RenderingContext?"webgl2":"webgl";if(this.ctx)return"2d"}fence2dCanvas(){const t=this.ctx;if(!t)return null;try{const s=performance.now();return t.getImageData(0,0,1,1),performance.now()-s}catch{return null}}fenceWebGLReadback(t){try{t.readPixels(0,0,1,1,t.RGBA,t.UNSIGNED_BYTE,new Uint8Array(4))}catch{}}handleRunFencedBenchmark(t){const s=Math.max(1,Math.floor(t.data.frameCount));if(this.benchmark){this.postMessage("error",{id:t.id,message:"A fenced benchmark is already running",code:"BENCHMARK_BUSY"});return}this.benchmark={id:t.id,remaining:s,samples:[],lastTimestamp:null}}recordBenchmarkFrame(t,s){const i=this.benchmark;if(!i)return;const n=performance.now(),a=this.getContextAndFinish();a&&this.fenceWebGLReadback(a);const o=a?performance.now()-n:this.fence2dCanvas(),u=i.lastTimestamp===null?0:t-i.lastTimestamp;i.lastTimestamp=t;const l=this.capabilityMonitor.evaluate(this.gatherCapabilityInput(t,s,u));i.samples.push({frameIndex:this.frameCount,timestamp:t,cpuMs:s,gpuMs:o,frameIntervalMs:u,capabilities:l}),i.remaining--,i.remaining<=0&&(this.postMessage("run-fenced-benchmark-result",{id:i.id,frames:i.samples}),this.benchmark=null)}async initP5Mode(t,s,i){try{this.rendererType="p5",this.debugLog("🎨 Initializing P5.js mode..."),this.p5Adapter=new hh(this.canvas,this.viji,{setup:t,render:s,canvasMode:i?.canvasMode==="webgl"?"webgl":"2d"}),await this.p5Adapter.init(),this.debugLog("✅ P5.js mode initialized successfully")}catch(n){console.error("❌ Failed to initialize P5.js mode:",n),this.postMessage("error",{message:`P5.js initialization failed: ${n.message}`,code:"P5_INIT_ERROR"}),this.rendererType="native",this.p5Adapter=null}}async initShaderMode(t,s){try{this.rendererType="shader",this.debugLog("🎨 Initializing Shader mode..."),this.shaderAdapter=new ze(this.canvas,this.viji,t,s?.redactDriverInfoLogs??false),await this.shaderAdapter.init();const i=this.shaderAdapter.getParameterDefinitions();for(const n of i)this.registerShaderParameter(n);this.debugLog("✅ Shader mode initialized successfully")}catch(i){console.error("❌ Failed to initialize Shader mode:",i),this.postMessage("error",{message:`Shader initialization failed: ${i.message}`,code:"SHADER_INIT_ERROR"}),this.rendererType="native",this.shaderAdapter=null}}registerShaderParameter(t){if(t.type==="accumulator")return;const s=t.config,i={...s,name:t.uniformName,label:t.label,description:s.description??""};switch(i.name!==t.uniformName&&(console.error(`[viji] Shader parameter identity mismatch for uniform "${t.uniformName}" — forcing name = uniformName.`),i.name=t.uniformName),t.type){case"slider":this.viji.slider(s.default,i);break;case"number":this.viji.number(s.default,i);break;case"color":this.viji.color(s.default,i);break;case"toggle":this.viji.toggle(s.default,i);break;case"select":this.viji.select(s.default,{...i,options:s.options});break;case"image":this.viji.image(null,i);break;case"button":this.viji.button(i);break;case"coordinate":{const n=Array.isArray(s.default)?s.default:[0,0];this.viji.coordinate({x:n[0],y:n[1]},i);break}case"cv":{if(Object.keys(s).length===0)break;this.viji.toggle(s.default,i);break}}}resetParameterState(){this.parameterSystem.resetParameterState(),this.interactionSystem.resetInteractionState(),this.resetAudioState(),this.videoSystems.forEach(t=>t?.resetVideoState()),this.videoSystems[0]&&Object.assign(this.viji.video,this.videoSystems[0].getVideoAPI()),this.updateVijiVideoStreams()}updateVijiVideoStreams(){const t=[],s=[];this.videoSystems.forEach((n,a)=>{if(!n)return;const o=Ps(a);o==="additional"?t.push(n):o==="directFrame"&&s.push(n)});const i=[...t,...s].map(n=>n.getVideoAPI());this.viji.videoStreams.length=i.length;for(let n=0;n<i.length;n++)this.viji.videoStreams[n]=i[n];this.debugLogStreamTable()}lastStreamTableSignature="";debugLogStreamTable(){if(!this.debugMode)return;const t=[];this.videoSystems.forEach((i,n)=>{if(!i)return;const a=i.peekDebugState();t.push(`${n}:${Ps(n)}${a.isConnected?" connected":""}${a.hasFrame?" frame":""}`)});const s=`[${t.join(", ")}] → videoStreams(${this.viji.videoStreams.length})`;s!==this.lastStreamTableSignature&&(this.lastStreamTableSignature=s,this.debugLog(`[Streams] ${s}`))}updateVijiAudioStreams(){const t=[];for(const[s,i]of this.audioStreamStates)s>=uh&&s<Ja&&t.push({index:s,...i});t.sort((s,i)=>s.index-i.index),this.viji.audioStreams.length=t.length;for(let s=0;s<t.length;s++){const i=t[s],n=i.frequencyData,a=i.waveformData;this.viji.audioStreams[s]={isConnected:i.isConnected,volume:i.volume,bands:i.bands,spectral:i.spectral,getFrequencyData:()=>n,getWaveform:()=>a}}}sendAllParametersToHost(){this.parameterSystem.sendAllParametersToHost()}seedInitialValues(t){this.parameterSystem.seedInitialValues(t)}setupMessageHandling(){self.onmessage=t=>{this.dispatchMessage(t.data)}}dispatchMessage(t){switch(t.type){case"init":this.handleInit(t).catch(s=>console.error("[Viji] handleInit failed:",s));break;case"frame-rate-update":this.handleFrameRateUpdate(t);break;case"refresh-rate-update":this.handleRefreshRateUpdate(t);break;case"cv-results-update":this.handleCVResultsUpdate(t);break;case"resolution-update":this.handleResolutionUpdate(t);break;case"set-scene-code":this.handleSetSceneCode(t);break;case"debug-mode":this.setDebugMode(t.data.enabled);break;case"parameter-update":this.handleParameterUpdate(t);break;case"parameter-batch-update":this.handleParameterBatchUpdate(t);break;case"audio-analysis-update":this.handleAudioAnalysisUpdate(t);break;case"audio-stream-setup":this.handleAudioStreamSetup(t);break;case"video-canvas-setup":this.handleVideoCanvasSetup(t);break;case"video-frame-update":this.handleVideoFrameUpdate(t);break;case"video-config-update":this.handleVideoConfigUpdate(t);break;case"video-streams-prepare":this.handleVideoStreamsPrepare(t);break;case"video-frame-direct":this.handleVideoFrameDirect(t);break;case"enable-auto-capture":this.autoCaptureEnabled=t.data.enabled,t.data.flipY!==void 0&&(this.autoCaptureFormat.flipY=t.data.flipY),t.data.frame!==void 0&&(this.autoCaptureFormat.frame=t.data.frame==="display"?"display":"plate"),this.debugLog(`[AutoCapture] ${t.data.enabled?"ENABLED":"DISABLED"} (flipY=${this.autoCaptureFormat.flipY}, frame=${this.autoCaptureFormat.frame})`);break;case"enable-capability-reporting":this.capabilityMonitor.setEnabled(t.data.enabled);break;case"set-render-loop-paused":this.setRenderLoopPaused(t.data.paused);break;case"run-fenced-benchmark":this.handleRunFencedBenchmark(t);break;case"mouse-update":this.handleMouseUpdate(t);break;case"keyboard-update":this.handleKeyboardUpdate(t);break;case"touch-update":this.handleTouchUpdate(t);break;case"interaction-enabled":this.handleInteractionEnabled(t);break;case"device-state-update":this.handleDeviceStateUpdate(t);break;case"performance-update":this.handlePerformanceUpdate(t);break;case"capture-frame":this.handleCaptureFrame(t);break;case"sc-update":mo(t.data.t);break;case"rh-update":_o(t.data.h);break}}async handleInit(t){try{this.canvas=t.data.canvas,this.viji.canvas=this.canvas,this._isHeadless=!!t.data.isHeadless,t.data.reporterConfig&&this.sceneErrorReporter&&this.sceneErrorReporter.applyConfig(t.data.reporterConfig);const s=this.canvas.getContext.bind(this.canvas);this.canvas.getContext=(i,n)=>{const a=s(i,n);return a&&(this.contextAcquired=true,i==="2d"?(this.ctx=a,this.viji.ctx=this.ctx):(i==="webgl"||i==="webgl2")&&(this.gl=a,this.viji.gl=this.gl)),a},this.viji.width=this.canvas.width,this.viji.height=this.canvas.height,await ef(),t.data.sc&&await mo(t.data.sc),uf(this.canvas),t.data.rh!==void 0&&_o(t.data.rh),t.data.controlPort&&(this.controlPort=t.data.controlPort,this.controlPort.onmessage=i=>{this.dispatchMessage(i.data)}),this.startRenderLoop(),self.postMessage({type:"init-response",id:t.id,timestamp:Date.now(),data:{id:t.id}})}catch(s){this.postMessage("error",{id:t.id,message:s.message,code:"INIT_ERROR"})}}handleFrameRateUpdate(t){t.data&&t.data.mode&&(this.frameRateMode=t.data.mode,this.frameSkipCounter=0,this.debugLog("Frame rate mode updated to:",t.data.mode))}getFrameRateDivisor(){switch(this.frameRateMode){case"full":return 1;case"half":return 2;case"quarter":return 4;case"eighth":return 8;default:return 1}}handleRefreshRateUpdate(t){t.data&&t.data.screenRefreshRate&&(this.screenRefreshRate=t.data.screenRefreshRate,this.debugLog("Screen refresh rate updated to:",t.data.screenRefreshRate+"Hz"))}trackEffectiveFrameTime(t){this.effectiveFrameTimes.push(t),this.effectiveFrameTimes.length>60&&this.effectiveFrameTimes.shift()}reportPerformanceStats(t){if(t-this.lastEffectiveRateReport>=this.effectiveRateReportInterval){if(this.effectiveFrameTimes.length>=2){const s=this.effectiveFrameTimes[this.effectiveFrameTimes.length-1]-this.effectiveFrameTimes[0],i=this.effectiveFrameTimes.length-1,n=Math.round(i/s*1e3),a=this.capabilityMonitor.flush();this.postMessage("performance-update",{effectiveRefreshRate:n,frameRateMode:this.frameRateMode,screenRefreshRate:this.screenRefreshRate,contextType:this.detectContextType(),...a&&{frames:a.frames,timing:a.timing,capabilities:a.capabilities}})}this.lastEffectiveRateReport=t}}handleResolutionUpdate(t){t.data&&(this.canvas&&(this.canvas.width=Math.round(t.data.effectiveWidth),this.canvas.height=Math.round(t.data.effectiveHeight)),this.viji.width=Math.round(t.data.effectiveWidth),this.viji.height=Math.round(t.data.effectiveHeight),this._displayScale=t.data.displayScale??1,this.gl&&this.gl.viewport(0,0,this.viji.width,this.viji.height),this.p5Adapter&&this.rendererType==="p5"&&this.p5Adapter.resize(this.viji.width,this.viji.height),this.shaderAdapter&&this.rendererType==="shader"&&this.shaderAdapter.resize(this.viji.width,this.viji.height),this.debugLog("Canvas resolution updated to:",this.viji.width+"x"+this.viji.height))}handleParameterUpdate(t){t.data&&t.data.name!==void 0&&t.data.value!==void 0&&this.parameterSystem.updateParameterValue(t.data.name,t.data.value)}handleParameterBatchUpdate(t){if(t.data&&t.data.updates){for(const s of t.data.updates)this.parameterSystem.updateParameterValue(s.name,s.value);this.parameterSystem.markInitialValuesSynced(),this.debugLog("Parameter system initialized successfully")}}handleCVResultsUpdate(t){const s=this.videoSystems[t.data.streamIndex];if(s)s.handleCVResultsUpdate(t.data);else if(t.data.analysedFrame)try{t.data.analysedFrame.close()}catch{}}handleAudioAnalysisUpdate(t){const s=t.data,i=s.streamIndex??0;i===0?this.handleMainAudioUpdate(s):this.handleAdditionalAudioUpdate(i,s)}handleMainAudioUpdate(t){const s=this.viji.audio;if(s.isConnected=t.isConnected,s.volume.current=t.volume.current,s.volume.peak=t.volume.peak,s.volume.smoothed=t.volume.smoothed,s.bands.low=t.bands.low,s.bands.lowMid=t.bands.lowMid,s.bands.mid=t.bands.mid,s.bands.highMid=t.bands.highMid,s.bands.high=t.bands.high,s.bands.lowSmoothed=t.bands.lowSmoothed,s.bands.lowMidSmoothed=t.bands.lowMidSmoothed,s.bands.midSmoothed=t.bands.midSmoothed,s.bands.highMidSmoothed=t.bands.highMidSmoothed,s.bands.highSmoothed=t.bands.highSmoothed,t.beat){s.beat.kick=t.beat.kick,s.beat.snare=t.beat.snare,s.beat.hat=t.beat.hat,s.beat.any=t.beat.any,s.beat.kickSmoothed=t.beat.kickSmoothed,s.beat.snareSmoothed=t.beat.snareSmoothed,s.beat.hatSmoothed=t.beat.hatSmoothed,s.beat.anySmoothed=t.beat.anySmoothed;const i=t.beat.events||[];i.length>0&&(s.beat.triggers.kick=s.beat.triggers.kick||i.some(n=>n.type==="kick"),s.beat.triggers.snare=s.beat.triggers.snare||i.some(n=>n.type==="snare"),s.beat.triggers.hat=s.beat.triggers.hat||i.some(n=>n.type==="hat"),s.beat.triggers.any=true,s.beat.events.push(...i)),s.beat.bpm=t.beat.bpm,s.beat.confidence=t.beat.confidence,s.beat.isLocked=t.beat.isLocked}s.spectral.brightness=t.spectral.brightness,s.spectral.flatness=t.spectral.flatness,this.audioFrequencyData=new Uint8Array(t.frequencyData),this.audioWaveformData=t.waveformData?new Float32Array(t.waveformData):new Float32Array(0)}handleAdditionalAudioUpdate(t,s){const i=new Uint8Array(s.frequencyData),n=s.waveformData?new Float32Array(s.waveformData):new Float32Array(0),a=this.audioStreamStates.get(t);a?(a.isConnected=s.isConnected,Object.assign(a.volume,s.volume),Object.assign(a.bands,s.bands),Object.assign(a.spectral,s.spectral),a.frequencyData=i,a.waveformData=n):this.audioStreamStates.set(t,{isConnected:s.isConnected,volume:{...s.volume},bands:{...s.bands},spectral:{...s.spectral},frequencyData:i,waveformData:n}),this.updateVijiAudioStreams(),t>=Ja&&this.wireDeviceAudio(t)}wireDeviceAudio(t){const s=this.audioStreamStates.get(t);if(!s)return;let i;for(const[a,o]of this.deviceAudioMap)if(o===t){i=a;break}if(!i)return;const n=this.viji.devices.find(a=>a.id===i);n&&(n.audio?n.audio.isConnected=s.isConnected:n.audio={isConnected:s.isConnected,volume:s.volume,bands:s.bands,spectral:s.spectral,getFrequencyData:()=>s.frequencyData,getWaveform:()=>s.waveformData})}handleAudioStreamSetup(t){const{streamIndex:s,streamType:i,deviceId:n}=t.data;switch(i){case"additional":this.updateVijiAudioStreams();break;case"device":n&&(this.deviceAudioMap.set(n,s),this.wireDeviceAudio(s));break}this.debugLog(`Audio stream setup at index ${s}, type: ${i}${n?`, deviceId: ${n}`:""}`)}resetAudioFrameEvents(){const t=this.viji.audio.beat.triggers;t.kick=false,t.snare=false,t.hat=false,t.any=false,this.viji.audio.beat.events.length=0}resetAudioState(){const t=this.viji.audio;t.isConnected=false,t.volume.current=0,t.volume.peak=0,t.volume.smoothed=0,t.bands.low=0,t.bands.lowMid=0,t.bands.mid=0,t.bands.highMid=0,t.bands.high=0,t.bands.lowSmoothed=0,t.bands.lowMidSmoothed=0,t.bands.midSmoothed=0,t.bands.highMidSmoothed=0,t.bands.highSmoothed=0,t.beat.kick=0,t.beat.snare=0,t.beat.hat=0,t.beat.any=0,t.beat.kickSmoothed=0,t.beat.snareSmoothed=0,t.beat.hatSmoothed=0,t.beat.anySmoothed=0,t.beat.triggers.kick=false,t.beat.triggers.snare=false,t.beat.triggers.hat=false,t.beat.triggers.any=false,t.beat.events.length=0,t.beat.bpm=0,t.beat.confidence=0,t.beat.isLocked=false,t.spectral.brightness=0,t.spectral.flatness=0,this.audioFrequencyData=new Uint8Array(0),this.audioWaveformData=new Float32Array(0),this.audioStreamStates.clear(),this.deviceAudioMap.clear(),this.viji.audioStreams.length=0}handleVideoCanvasSetup(t){const{streamIndex:s,deviceId:i}=t.data,n=s||0,a=Ps(n);let o=this.videoSystems[n];const u=!!o;switch(o||(o=new ui,o.setDebugMode(this.debugMode),o.setCVMessaging(n,(l,h)=>{this.postMessage("cv-feature-request",{streamIndex:l,desired:h})}),this.videoSystems[n]=o),o.setDeviceId(i),o.handleCanvasSetup({offscreenCanvas:t.data.offscreenCanvas,width:t.data.width,height:t.data.height,timestamp:t.data.timestamp}),this.debugLog(`Video system ${u?"reused":"created"} at index ${n}, role: ${a}${i?`, deviceId: ${i}`:""}`),a){case"main":Object.assign(this.viji.video,o.getVideoAPI());break;case"additional":this.updateVijiVideoStreams();break;case"device":if(i){this.deviceVideoMap.set(i,n);const l=this.viji.devices.find(h=>h.id===i);l&&(l.video?Object.assign(l.video,o.getVideoAPI()):l.video=o.getVideoAPI())}break}}handleVideoFrameUpdate(t){const s=t.data.streamIndex||0,i=this.videoSystems[s];if(i){i.handleFrameUpdate({imageBitmap:t.data.imageBitmap,timestamp:t.data.timestamp});const n=Ps(s);if(n==="main")Object.assign(this.viji.video,i.getVideoAPI());else if(n==="device"){const a=i.getDeviceId();if(a){const o=this.viji.devices.find(u=>u.id===a);o&&(o.video?Object.assign(o.video,i.getVideoAPI()):o.video=i.getVideoAPI())}}}}handleVideoConfigUpdate(t){const s=t.data.streamIndex||0,i=this.videoSystems[s];if(i){const n=Ps(s),a=i.getDeviceId();if(t.data.disconnect&&n==="device"&&a){this.deviceVideoMap.delete(a);const o=this.viji.devices.find(u=>u.id===a);o&&(o.video=null)}if(i.handleVideoConfigUpdate({...t.data.targetFrameRate&&{targetFrameRate:t.data.targetFrameRate},...t.data.cvConfig&&{cvConfig:t.data.cvConfig},...t.data.width&&{width:t.data.width},...t.data.height&&{height:t.data.height},...t.data.disconnect&&{disconnect:t.data.disconnect},timestamp:t.data.timestamp}),n==="main")Object.assign(this.viji.video,i.getVideoAPI());else if(n==="device"&&a&&!t.data.disconnect){const o=this.viji.devices.find(u=>u.id===a);o&&(o.video?Object.assign(o.video,i.getVideoAPI()):o.video=i.getVideoAPI())}}}handleVideoStreamsPrepare(t){const{directFrameBaseIndex:s,directFrameCount:i}=t.data;this.debugLog(`[Compositor] Preparing ${i} direct frame slot(s) at base index ${s}`);for(let n=0;n<i;n++){const a=s+n;this.videoSystems[a]||(this.videoSystems[a]=new ui),this.videoSystems[a].setDebugMode(this.debugMode),this.videoSystems[a].initializeForDirectFrames(this.rendererType)}this.updateVijiVideoStreams(),this.debugLog(`[Compositor] Prepared ${i} direct frame slot(s)`)}handleVideoFrameDirect(t){const s=t.data.streamIndex||0;this.videoSystems[s]||(this.debugLog(`[Compositor] Creating new VideoSystem at index ${s} for direct frames`),this.videoSystems[s]=new ui,this.videoSystems[s].setDebugMode(this.debugMode),this.videoSystems[s].initializeForDirectFrames(this.rendererType)),this.videoSystems[s].handleDirectFrame(t.data)}handlePerformanceUpdate(t){this.debugLog("Performance update:",t.data)}async handleCaptureFrame(t){this.pendingCaptures.push({queuedAt:performance.now(),message:t}),this.debugLog(`Capture queued: ${t.data.format||"blob"} (${this.pendingCaptures.length} pending)`)}async executeCaptureFrame(t){try{if(!this.canvas)throw new Error("Canvas not initialized");if((t.data.format||"blob")==="bitmap"){const z=this.canvas.transferToImageBitmap();this.postMessage("capture-frame-result",{id:t.id,bitmap:z},[z]);return}const i=t.data.type||"image/jpeg",n=this.canvas.width,a=this.canvas.height;let o=n,u=a;if(typeof t.data.resolution=="number"){const z=t.data.resolution>0?t.data.resolution:1;o=Math.max(1,Math.floor(n*z)),u=Math.max(1,Math.floor(a*z))}else t.data.resolution&&typeof t.data.resolution=="object"&&(o=Math.max(1,Math.floor(t.data.resolution.width)),u=Math.max(1,Math.floor(t.data.resolution.height)));const l=n/a,h=o/u;let d=0,m=0,_=n,k=a;Math.abs(l-h)>1e-6&&(h>l?(k=Math.floor(n/h),m=Math.floor((a-k)/2)):(_=Math.floor(a*h),d=Math.floor((n-_)/2)));let T;const P=this.getContextAndFinish();if(P){const z=t.data.frame==="display",J=z?P.getParameter(P.FRAMEBUFFER_BINDING):null;z&&P.bindFramebuffer(P.FRAMEBUFFER,null);const K=new Uint8Array(n*a*4);P.readPixels(0,0,n,a,P.RGBA,P.UNSIGNED_BYTE,K),z&&P.bindFramebuffer(P.FRAMEBUFFER,J);const X=new Uint8ClampedArray(n*a*4);for(let b=0;b<a;b++){const v=(a-1-b)*n*4,V=b*n*4;X.set(K.subarray(v,v+n*4),V)}T=new OffscreenCanvas(n,a);const re=T.getContext("2d");if(!re)throw new Error("Failed to create source context");const x=new ImageData(X,n,a);re.putImageData(x,0,0),this.debugLog("Captured frame from WebGL using readPixels (post-render)")}else T=this.canvas,this.debugLog("Captured frame from 2D canvas (post-render)");const F=new OffscreenCanvas(o,u),B=F.getContext("2d");if(!B)throw new Error("Failed to get 2D context");B.drawImage(T,d,m,_,k,0,0,o,u);const N=t.data.quality,Y=typeof N=="number"&&Number.isFinite(N)?Math.min(1,Math.max(0,N)):void 0,q=await F.convertToBlob(Y!==void 0?{type:i,quality:Y}:{type:i});this.postMessage("capture-frame-result",{id:t.id,blob:q})}catch(s){this.postMessage("error",{id:t.id,message:s.message,code:"CAPTURE_FRAME_ERROR"})}}handleSetSceneCode(t){let s=false;const i={resolve:u=>{s||(s=true,this.postMessage("scene-analysis",{id:t.id,...u}))},reject:u=>{s||(s=true,this.postMessage("error",{id:t.id,...u}))}},n=t.data?.sceneCode;if(typeof n!="string"){i.reject({message:"set-scene-code carried no scene code",code:"SCENE_ANALYSIS_ERROR"});return}const a={...t.data?.initialParameters&&{initialParameters:t.data.initialParameters},...t.data?.sk&&{keyComponent:t.data.sk}},o=self.setSceneCode;o(n,a,i).catch(u=>{const l=u;i.reject({message:`Scene load failed before analysis ack: ${l?.message??String(u)}`,code:"SCENE_ANALYSIS_ERROR"})})}startRenderLoop(){this.isRunning=true,this.startTime=performance.now(),this.lastTime=this.startTime,this.renderFrame()}runCaptures(t){for(const{message:s}of t)this.executeCaptureFrame(s).catch(i=>{console.error("Capture execution error:",i)})}runAutoCapture(){if(!(!this.autoCaptureEnabled||!this.canvas))try{const t=this.autoCaptureFormat.flipY?{imageOrientation:"flipY"}:{};createImageBitmap(this.canvas,t).then(s=>{this.postMessage("auto-capture-result",{bitmap:s,timestamp:performance.now()},[s])}).catch(s=>{console.warn("[AutoCapture] ImageBitmap creation failed:",s)})}catch(t){console.warn("[AutoCapture] Failed:",t)}}renderFrame(){if(!this.isRunning)return;const t=performance.now();this.updateVijiVideoStreams(),this.updateVijiAudioStreams();const s=this.getFrameRateDivisor();this.viji.fps=this.screenRefreshRate/s;const i=this.frameSkipCounter%s===0;if(this.frameSkipCounter++,i){const n=t-this.lastTime;this.viji.deltaTime=(t-this.lastTime)/1e3,this.viji.time=(t-this.startTime)/1e3,this.viji.frameCount=++this.frameCount,this.trackEffectiveFrameTime(t),this.lastTime=t,this.interactionSystem.updatePointerState();const a=performance.now();let o=false;try{if(this.shaderAdapter&&this.rendererType==="shader"){const d=this.parameterSystem.getAllParameterObjects();o=this.shaderAdapter.render(this.viji,d)}else if(this.p5Adapter&&this.rendererType==="p5"){const d=this.parameterSystem.getAllParameterObjects();o=this.p5Adapter.tick(this.viji,d)}else{const d=self.renderFunction;d&&typeof d=="function"&&(d(this.viji),o=true)}}catch(d){const m=d;console.error("Render error:",m),this.sceneErrorReporter?this.sceneErrorReporter.reportSceneError({message:m.message,...m.stack!==void 0&&{stack:m.stack},code:"RENDER_ERROR"}):this.postMessage("error",{message:m.message,code:"RENDER_ERROR",stack:m.stack})}const u=o&&this.contextAcquired;if(u&&this.sceneErrorReporter&&this.sceneErrorReporter.markFirstFrameProduced(),this.benchmark){const d=performance.now()-a;this.recordBenchmarkFrame(t,d)}else if(this.capabilityMonitor.isEnabled()){const d=performance.now()-a;this.recordCapabilityFrame(t,d,n)}if(this.parameterSystem.resetButtonParameters(),this.pendingCaptures.length>0){const d=performance.now()-pa.CAPTURE_QUEUE_TTL_MS;this.pendingCaptures=this.pendingCaptures.filter(m=>m.queuedAt>=d)}let l=[],h=[];if(u){const d=this.pendingCaptures;this.pendingCaptures=[],h=d.filter(m=>m.message.data.frame==="display"),l=d.filter(m=>m.message.data.frame!=="display")}if(this.runCaptures(l),u&&this.autoCaptureFormat.frame!=="display"&&this.runAutoCapture(),!this._isHeadless&&this.canvas){const d=tf("b",0);hf(this.canvas,this.ctx,this.gl,d,this._displayScale)}this.runCaptures(h),u&&this.autoCaptureFormat.frame==="display"&&this.runAutoCapture()}this.benchmark||this.reportPerformanceStats(t),this.interactionSystem.frameStart(),this.resetAudioFrameEvents(),this.scheduleNextFrame()}scheduleNextFrame(){this.rafScheduled||!this.isRunning||(this.rafScheduled=true,requestAnimationFrame(()=>{this.rafScheduled=false,this.renderFrame()}))}setRenderLoopPaused(t){t!==this.renderLoopPaused&&(this.renderLoopPaused=t,t?this.isRunning=false:(this.isRunning=true,this.scheduleNextFrame()))}postMessage(t,s,i){const n={type:t,id:s?.id||`${t}_${Date.now()}`,timestamp:Date.now(),data:s};this.controlPort?this.controlPort.postMessage(n,i??[]):self.postMessage(n,i??[])}handleMouseUpdate(t){this.interactionSystem.handleMouseUpdate(t.data)}handleKeyboardUpdate(t){this.interactionSystem.handleKeyboardUpdate(t.data)}handleTouchUpdate(t){this.interactionSystem.handleTouchUpdate(t.data)}handleInteractionEnabled(t){this.interactionSystem.setInteractionEnabled(t.data.enabled)}handleDeviceStateUpdate(t){this.deviceState=t.data,this.viji.device=this.deviceState.device;const s=this.deviceState.devices.map(i=>{const n=this.viji.devices.find(d=>d.id===i.id),a=this.deviceVideoMap.get(i.id),o=a!==void 0?this.videoSystems[a]:void 0,u=this.deviceAudioMap.get(i.id),l=u!==void 0?this.audioStreamStates.get(u):void 0,h=l?{isConnected:l.isConnected,volume:l.volume,bands:l.bands,spectral:l.spectral,getFrequencyData:()=>l.frequencyData,getWaveform:()=>l.waveformData}:null;return n?(n.name=i.name,n.motion=i.motion,n.orientation=i.orientation,h&&(n.audio=h),n):{...i,video:o?o.getVideoAPI():null,audio:h}});this.viji.devices=s}}class Ms{static detectRendererType(t){return/\/\/\s*@renderer\s+shader|\/\*\s*@renderer\s+shader\s*\*\//.test(t)?"shader":/\/\/\s*@renderer\s+p5|\/\*\s*@renderer\s+p5\s*\*\//.test(t)?"p5":"native"}static detectP5CanvasMode(t){return/\/\/\s*@renderer\s+p5\s+webgl\b|\/\*\s*@renderer\s+p5\s+webgl\s*\*\//i.test(t)?"webgl":"2d"}static detectCapabilities(t,s){const i=this.stripCommentsAndStrings(t),n={audio:false,video:false,mouse:false,keyboard:false,pointer:false,touch:false,parameters:false,sensors:false,devices:false,cv:{faceDetection:false,faceMesh:false,emotion:false,handTracking:false,poseDetection:false,segmentation:false}};return s==="shader"?this.detectShaderCapabilities(i,n):this.detectScriptCapabilities(i,n),n}static stripCommentsAndStrings(t){let s="";const i=t.length;let n=0;for(;n<i;){const a=t[n],o=n+1<i?t[n+1]:"";if(a==="/"&&o==="/"){for(n+=2;n<i&&t[n]!==`
|
|
446
|
+
`;)n++;continue}if(a==="/"&&o==="*"){for(n+=2;n<i&&!(t[n]==="*"&&t[n+1]==="/");)n++;n+=2,s+=" ";continue}if(a==='"'||a==="'"||a==="`"){const u=a;for(n++;n<i;){if(t[n]==="\\"){n+=2;continue}if(t[n]===u){n++;break}n++}s+=" ";continue}s+=a,n++}return s}static detectShaderCapabilities(t,s){/\bu_audio\w*/.test(t)&&(s.audio=true),/\bu_video\w*/.test(t)&&(s.video=true),/\bu_mouse\w*/.test(t)&&(s.mouse=true),/\bu_key\w*/.test(t)&&(s.keyboard=true),/\bu_touch\w*/.test(t)&&(s.touch=true),/\bu_pointer\w*/.test(t)&&(s.pointer=true),/\bu_device(Acceleration|AccelerationGravity|RotationRate|OrientationAbsolute|Orientation)\b/.test(t)&&(s.sensors=true),/\bu_device[0-7](AccelerationGravity|Acceleration|RotationRate|Orientation)\b/.test(t)&&(s.sensors=true,s.devices=true),/\bu_externalDeviceCount\b/.test(t)&&(s.devices=true,s.sensors=true),(/\bu_deviceCount\b/.test(t)||/\bu_device[0-7](Resolution|Connected)?\b/.test(t))&&(s.video=true,s.devices=true),/\bu_face\w*/.test(t)&&(s.cv.faceDetection=true),/\bu_face0(Neutral|Happy|Sad|Angry|Surprised|Disgusted|Fearful)\b/.test(t)&&(s.cv.emotion=true),(/\bu_face0HeadPose\b/.test(t)||/\bu_videoAnalysed\w*/.test(t)||/\bu_face0(Brow|Cheek|Eye|Jaw|Mouth|Nose|Tongue)\w*/.test(t))&&(s.cv.faceMesh=true),(/\bu_handCount\b/.test(t)||/\bu_(left|right)Hand\w*/.test(t))&&(s.cv.handTracking=true),(/\bu_pose\w*/.test(t)||/\bu_(nose|leftShoulder|rightShoulder|leftElbow|rightElbow|leftWrist|rightWrist|leftHip|rightHip|leftKnee|rightKnee|leftAnkle|rightAnkle)Position\b/.test(t))&&(s.cv.poseDetection=true),/\bu_segmentation\w*/.test(t)&&(s.cv.segmentation=true)}static detectScriptCapabilities(t,s){/\bviji\.audio/.test(t)&&(s.audio=true),/\bviji\.video/.test(t)&&(s.video=true),/\bviji\.mouse/.test(t)&&(s.mouse=true),/\bviji\.keyboard/.test(t)&&(s.keyboard=true),/\bviji\.touches/.test(t)&&(s.touch=true),/\bviji\.pointer/.test(t)&&(s.pointer=true),/\bviji\.device\b/.test(t)&&(s.sensors=true),/\bviji\.devices/.test(t)&&(s.devices=true),/\bviji\.(slider|color|toggle|select|text|number|image|button|coordinate)\s*\(/.test(t)&&(s.parameters=true),/\benableFaceDetection\b/.test(t)&&(s.cv.faceDetection=true),/\benableFaceMesh\b/.test(t)&&(s.cv.faceMesh=true),/\benableEmotionDetection\b/.test(t)&&(s.cv.emotion=true),/\benableHandTracking\b/.test(t)&&(s.cv.handTracking=true),/\benablePoseDetection\b/.test(t)&&(s.cv.poseDetection=true),/\benableBodySegmentation\b/.test(t)&&(s.cv.segmentation=true)}static detectAnalysedFrameUse(t){const s=this.stripCommentsAndStrings(t);return/\b(analysedFrame|getAnalysedFrameData)\b/.test(s)||/\bu_videoAnalysed\w*/.test(s)}static detectUsage(t,s){const i=this.stripCommentsAndStrings(t),n={mouse:{position:false,left:false,right:false,middle:false},pointer:{position:false,down:false},touch:false};return s==="shader"?(n.mouse.position=/\bu_mouse(\b|InCanvas|Delta|Wheel)/.test(i),n.mouse.left=/\bu_mouse(Left|Pressed|WasPressed|WasReleased)\b/.test(i),n.mouse.right=/\bu_mouseRight\b/.test(i),n.mouse.middle=/\bu_mouseMiddle\b/.test(i),n.pointer.position=/\bu_pointer(\b|Delta|InCanvas)/.test(i),n.pointer.down=/\bu_pointer(Down|WasPressed|WasReleased)\b/.test(i),n.touch=/\bu_touch/.test(i)):(n.mouse.position=/\bmouse\.(x|y|deltaX|deltaY|wheelDelta|wheelX|wheelY|wasMoved)\b/.test(i),n.mouse.left=/\bmouse\.(leftButton|isPressed|wasPressed|wasReleased)\b/.test(i),n.mouse.right=/\bmouse\.rightButton\b/.test(i),n.mouse.middle=/\bmouse\.middleButton\b/.test(i),n.pointer.position=/\bpointer\.(x|y|deltaX|deltaY)\b/.test(i),n.pointer.down=/\bpointer\.(isDown|wasPressed|wasReleased)\b/.test(i),n.touch=/\btouches\./.test(i)),n}}function gf(e){const t=Ms.detectRendererType(e),s=t==="p5"?Ms.detectP5CanvasMode(e):void 0;return{renderer:t,...s!==void 0&&{p5CanvasMode:s},capabilities:Ms.detectCapabilities(e,t),consumesAnalysedFrame:Ms.detectAnalysedFrameUse(e)}}const da=5,bf=(1<<da)-1,yf=1<<da,_f=(()=>{const e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",t=new Int8Array(128).fill(-1);for(let s=0;s<e.length;s++)t[e.charCodeAt(s)]=s;return t})();function Ls(e,t){let s=0,i=0,n;do{if(t.index>=e.length)throw new Error("VLQ decode: unexpected end of input");const o=e.charCodeAt(t.index++),u=o<128?_f[o]:-1;if(u<0)throw new Error(`VLQ decode: invalid base64 character '${e[t.index-1]}'`);n=u&yf,s+=(u&bf)<<i,i+=da}while(n);const a=s&1;return s>>>=1,a?-s:s}function xf(e,t){const s=[];if(e.length===0)return s;let i=0;const n=e.split(",");for(const a of n){if(a.length===0)continue;const o={index:0};i+=Ls(a,o);const u={generatedColumn:i};o.index<a.length&&(t.sourceIndex+=Ls(a,o),t.sourceLine+=Ls(a,o),t.sourceColumn+=Ls(a,o),u.sourceLine=t.sourceLine,u.sourceColumn=t.sourceColumn,o.index<a.length&&(t.nameIndex+=Ls(a,o))),s.push(u)}return s}function vf(e){const t=e.split(";"),s=[],i={sourceIndex:0,sourceLine:0,sourceColumn:0,nameIndex:0};for(const n of t){const a=xf(n,i);s.push(a)}return{lines:s}}function kf(e,t,s){if(t<1||t>e.lines.length)return null;const i=e.lines[t-1];if(i.length===0)return null;const n=s-1;let a=0,o=i.length-1,u=-1;for(;a<=o;){const h=a+o>>>1;i[h].generatedColumn<=n?(u=h,a=h+1):o=h-1}if(u<0)return null;const l=i[u];return l.sourceLine===void 0||l.sourceColumn===void 0?null:{line:l.sourceLine+1,column:l.sourceColumn+1}}const wf={errorCoalescingWindowMs:1e3,consoleCoalescingWindowMs:1e3,consoleArgMaxBytes:512,consoleMaxArgsPerCall:8,consoleMaxUniqueSignaturesPerSecond:32};class Sf{config;post;errorChannel;consoleChannel;rateCapWindowMs=1e3;rateCapWindowStart=0;rateCapSignaturesInWindow=0;rateCapSuppressionFiredInWindow=false;functionBodyLineOffset=0;functionBodySourceId="<anonymous>";currentSourceMap=null;hasProducedFirstFrame=false;envelopeSeq=0;constructor(t,s={}){this.config={...wf,...s},this.post=t,this.errorChannel=new wo(this.config.errorCoalescingWindowMs,i=>this.postEnvelope("scene-error",i)),this.consoleChannel=new wo(this.config.consoleCoalescingWindowMs,i=>this.postEnvelope("scene-console",i)),this.detectFunctionBodyOffset()}applyConfig(t){t.errorCoalescingWindowMs!==void 0&&(this.config.errorCoalescingWindowMs=t.errorCoalescingWindowMs,this.errorChannel.setWindowMs(t.errorCoalescingWindowMs)),t.consoleCoalescingWindowMs!==void 0&&(this.config.consoleCoalescingWindowMs=t.consoleCoalescingWindowMs,this.consoleChannel.setWindowMs(t.consoleCoalescingWindowMs)),t.consoleArgMaxBytes!==void 0&&(this.config.consoleArgMaxBytes=t.consoleArgMaxBytes),t.consoleMaxArgsPerCall!==void 0&&(this.config.consoleMaxArgsPerCall=t.consoleMaxArgsPerCall),t.consoleMaxUniqueSignaturesPerSecond!==void 0&&(this.config.consoleMaxUniqueSignaturesPerSecond=t.consoleMaxUniqueSignaturesPerSecond)}markFirstFrameProduced(){this.hasProducedFirstFrame=true}resetForSceneReload(){this.hasProducedFirstFrame=false,this.currentSourceMap=null,this.errorChannel.flushAndClear(),this.consoleChannel.flushAndClear()}destroy(){this.errorChannel.destroy(),this.consoleChannel.destroy(),this.currentSourceMap=null}setCurrentSourceMap(t){if(t===null){this.currentSourceMap=null;return}try{this.currentSourceMap=vf(t)}catch{this.currentSourceMap=null}}reportSceneError(t){const s=t.stack,i=t.sourceOverride?{source:t.sourceOverride,sourceLocation:t.sourceLocationOverride}:this.attributeFromStack(s),n=t.sourceLocationOverride??i.sourceLocation,a=this.hasProducedFirstFrame?"render":"init",o=So([t.message,t.code,n?`${n.line}:${n.column??"?"}`:"no-loc"]),u={message:t.message,...s!==void 0&&{stack:s},source:i.source,phase:a,code:t.code,signatureHash:o,count:1,firstSeenAt:0,lastSeenAt:0,...n!==void 0&&{sourceLocation:n}};this.errorChannel.emit(o,u)}makeArtistConsole(t){const s=Object.create(t),i=["log","info","warn","error"];for(const n of i)s[n]=(...a)=>{try{t[n](...a)}catch{}this.forwardConsoleCall(n,a)};return s}forwardConsoleCall(t,s){const n=(s.length>this.config.consoleMaxArgsPerCall?[...s.slice(0,this.config.consoleMaxArgsPerCall),"…[truncated args]"]:s).map(d=>Ef(d,this.config.consoleArgMaxBytes)),a=So([t,...n]),o=Date.now();if(o-this.rateCapWindowStart>=this.rateCapWindowMs&&(this.rateCapWindowStart=o,this.rateCapSignaturesInWindow=0,this.rateCapSuppressionFiredInWindow=false),!this.consoleChannel.hasPending(a)){if(this.rateCapSignaturesInWindow>=this.config.consoleMaxUniqueSignaturesPerSecond){this.rateCapSuppressionFiredInWindow||(this.rateCapSuppressionFiredInWindow=true,this.emitSuppressionNotice());return}this.rateCapSignaturesInWindow++}const l=this.resolveCallSiteLocation(),h={level:t,args:n,signatureHash:a,count:1,firstSeenAt:0,lastSeenAt:0,...l!==void 0&&{sourceLocation:l}};this.consoleChannel.emit(a,h)}emitSuppressionNotice(){const s={level:"warn",args:["[viji] console output suppressed: too many distinct signatures this second"],signatureHash:"__console_suppressed__",count:1,firstSeenAt:0,lastSeenAt:0};this.postEnvelope("scene-console",s)}resolveCallSiteLocation(){const t=new Error().stack;if(t)return this.attributeFromStack(t).sourceLocation}attributeFromStack(t){if(!t)return{source:"engine"};const s=t.split(`
|
|
447
|
+
`);for(const i of s){const n=i.match(/\(?(<anonymous>):(\d+):(\d+)\)?$/);if(!n||n[1]!==this.functionBodySourceId)continue;const a=parseInt(n[2],10),o=parseInt(n[3],10),u=this.resolveLocation(a,o);return u?{source:"scene",sourceLocation:u}:{source:"scene"}}return{source:"engine"}}resolveLocation(t,s){const i=t-this.functionBodyLineOffset;if(!(i<1)){if(this.currentSourceMap){const n=kf(this.currentSourceMap,i,s);if(n)return{line:n.line,column:n.column}}return{line:i}}}detectFunctionBodyOffset(){const t="__viji_offset_probe__";try{new Function("viji","console",`throw new Error(${JSON.stringify(t)});`)(null,null)}catch(s){const n=s?.stack;if(!n)return;const a=n.split(`
|
|
448
|
+
`);for(const o of a){const u=o.match(/\(?(<anonymous>):(\d+):(\d+)\)?$/);if(!u)continue;const l=parseInt(u[2],10);this.functionBodyLineOffset=l-1,this.functionBodySourceId=u[1];return}}}postEnvelope(t,s){this.post({type:t,id:`${t}_${s.signatureHash}_${++this.envelopeSeq}`,timestamp:Date.now(),data:s})}}class wo{windowMs;emitFn;pending=new Map;constructor(t,s){this.windowMs=t,this.emitFn=s}setWindowMs(t){this.windowMs=t}hasPending(t){return this.pending.has(t)}emit(t,s){const i=Date.now(),n=this.pending.get(t);if(n){if(n.payload.count++,n.payload.lastSeenAt=i,n.timer!==null)return;this.emitFn(n.payload),n.lastEmittedCount=n.payload.count,n.timer=setTimeout(()=>this.flush(t),this.windowMs);return}s.count=1,s.firstSeenAt=i,s.lastSeenAt=i,this.emitFn(s);const a=setTimeout(()=>this.flush(t),this.windowMs);this.pending.set(t,{payload:s,timer:a,lastEmittedCount:1})}flush(t){const s=this.pending.get(t);!s||s.timer===null||(clearTimeout(s.timer),s.timer=null,s.payload.count>s.lastEmittedCount&&(this.emitFn(s.payload),s.lastEmittedCount=s.payload.count))}flushAndClear(){for(const t of this.pending.values())t.timer!==null&&(clearTimeout(t.timer),t.timer=null,t.payload.count>t.lastEmittedCount&&this.emitFn(t.payload));this.pending.clear()}destroy(){for(const t of this.pending.values())t.timer!==null&&clearTimeout(t.timer);this.pending.clear()}}function Ef(e,t){const s="…[truncated]";let i;try{e===void 0?i="undefined":e===null?i="null":typeof e=="string"?i=e:typeof e=="number"||typeof e=="boolean"||typeof e=="bigint"?i=String(e):typeof e=="function"?i=`[Function: ${e.name||"anonymous"}]`:typeof e=="symbol"?i=e.toString():e instanceof Error?i=`${e.name}: ${e.message}`:i=Tf(e)}catch{i="[unstringifiable]"}return i.length>t?i.slice(0,Math.max(0,t-s.length))+s:i}function Tf(e){const t=new WeakSet;try{return JSON.stringify(e,function(s,i){if(typeof i=="object"&&i!==null){if(t.has(i))return"[Circular]";if(t.add(i),i instanceof Map||i instanceof Set)return Array.from(i.entries?i.entries():i)}return typeof i=="function"?`[Function: ${i.name||"anonymous"}]`:typeof i=="bigint"?`${i.toString()}n`:i})??"undefined"}catch{return"[unstringifiable]"}}function So(e){let i=2166136261;const a=e.join("");for(let o=0;o<a.length;o++)i^=a.charCodeAt(o),i=Math.imul(i,16777619);return(i>>>0).toString(16).padStart(8,"0")}var g;(function(e){e[e.NONE=0]="NONE";const s=1;e[e._abstract=s]="_abstract";const i=s+1;e[e._accessor=i]="_accessor";const n=i+1;e[e._as=n]="_as";const a=n+1;e[e._assert=a]="_assert";const o=a+1;e[e._asserts=o]="_asserts";const u=o+1;e[e._async=u]="_async";const l=u+1;e[e._await=l]="_await";const h=l+1;e[e._checks=h]="_checks";const d=h+1;e[e._constructor=d]="_constructor";const m=d+1;e[e._declare=m]="_declare";const _=m+1;e[e._enum=_]="_enum";const k=_+1;e[e._exports=k]="_exports";const T=k+1;e[e._from=T]="_from";const P=T+1;e[e._get=P]="_get";const F=P+1;e[e._global=F]="_global";const B=F+1;e[e._implements=B]="_implements";const N=B+1;e[e._infer=N]="_infer";const Y=N+1;e[e._interface=Y]="_interface";const q=Y+1;e[e._is=q]="_is";const z=q+1;e[e._keyof=z]="_keyof";const J=z+1;e[e._mixins=J]="_mixins";const K=J+1;e[e._module=K]="_module";const X=K+1;e[e._namespace=X]="_namespace";const re=X+1;e[e._of=re]="_of";const x=re+1;e[e._opaque=x]="_opaque";const b=x+1;e[e._out=b]="_out";const v=b+1;e[e._override=v]="_override";const V=v+1;e[e._private=V]="_private";const W=V+1;e[e._protected=W]="_protected";const M=W+1;e[e._proto=M]="_proto";const R=M+1;e[e._public=R]="_public";const O=R+1;e[e._readonly=O]="_readonly";const U=O+1;e[e._require=U]="_require";const I=U+1;e[e._satisfies=I]="_satisfies";const H=I+1;e[e._set=H]="_set";const G=H+1;e[e._static=G]="_static";const te=G+1;e[e._symbol=te]="_symbol";const ce=te+1;e[e._type=ce]="_type";const oe=ce+1;e[e._unique=oe]="_unique";const w=oe+1;e[e._using=w]="_using"})(g||(g={}));var r;(function(e){e[e.PRECEDENCE_MASK=15]="PRECEDENCE_MASK";const s=16;e[e.IS_KEYWORD=s]="IS_KEYWORD";const i=32;e[e.IS_ASSIGN=i]="IS_ASSIGN";const n=64;e[e.IS_RIGHT_ASSOCIATIVE=n]="IS_RIGHT_ASSOCIATIVE";const a=128;e[e.IS_PREFIX=a]="IS_PREFIX";const o=256;e[e.IS_POSTFIX=o]="IS_POSTFIX";const u=512;e[e.IS_EXPRESSION_START=u]="IS_EXPRESSION_START";const l=512;e[e.num=l]="num";const h=1536;e[e.bigint=h]="bigint";const d=2560;e[e.decimal=d]="decimal";const m=3584;e[e.regexp=m]="regexp";const _=4608;e[e.string=_]="string";const k=5632;e[e.name=k]="name";const T=6144;e[e.eof=T]="eof";const P=7680;e[e.bracketL=P]="bracketL";const F=8192;e[e.bracketR=F]="bracketR";const B=9728;e[e.braceL=B]="braceL";const N=10752;e[e.braceBarL=N]="braceBarL";const Y=11264;e[e.braceR=Y]="braceR";const q=12288;e[e.braceBarR=q]="braceBarR";const z=13824;e[e.parenL=z]="parenL";const J=14336;e[e.parenR=J]="parenR";const K=15360;e[e.comma=K]="comma";const X=16384;e[e.semi=X]="semi";const re=17408;e[e.colon=re]="colon";const x=18432;e[e.doubleColon=x]="doubleColon";const b=19456;e[e.dot=b]="dot";const v=20480;e[e.question=v]="question";const V=21504;e[e.questionDot=V]="questionDot";const W=22528;e[e.arrow=W]="arrow";const M=23552;e[e.template=M]="template";const R=24576;e[e.ellipsis=R]="ellipsis";const O=25600;e[e.backQuote=O]="backQuote";const U=27136;e[e.dollarBraceL=U]="dollarBraceL";const I=27648;e[e.at=I]="at";const H=29184;e[e.hash=H]="hash";const G=29728;e[e.eq=G]="eq";const te=30752;e[e.assign=te]="assign";const ce=32640;e[e.preIncDec=ce]="preIncDec";const oe=33664;e[e.postIncDec=oe]="postIncDec";const w=34432;e[e.bang=w]="bang";const E=35456;e[e.tilde=E]="tilde";const D=35841;e[e.pipeline=D]="pipeline";const L=36866;e[e.nullishCoalescing=L]="nullishCoalescing";const j=37890;e[e.logicalOR=j]="logicalOR";const se=38915;e[e.logicalAND=se]="logicalAND";const ne=39940;e[e.bitwiseOR=ne]="bitwiseOR";const de=40965;e[e.bitwiseXOR=de]="bitwiseXOR";const Se=41990;e[e.bitwiseAND=Se]="bitwiseAND";const ke=43015;e[e.equality=ke]="equality";const Fe=44040;e[e.lessThan=Fe]="lessThan";const Xe=45064;e[e.greaterThan=Xe]="greaterThan";const Ce=46088;e[e.relationalOrEqual=Ce]="relationalOrEqual";const Ve=47113;e[e.bitShiftL=Ve]="bitShiftL";const je=48137;e[e.bitShiftR=je]="bitShiftR";const ts=49802;e[e.plus=ts]="plus";const ds=50826;e[e.minus=ds]="minus";const Rs=51723;e[e.modulo=Rs]="modulo";const ar=52235;e[e.star=ar]="star";const or=53259;e[e.slash=or]="slash";const cr=54348;e[e.exponent=cr]="exponent";const ur=55296;e[e.jsxName=ur]="jsxName";const lr=56320;e[e.jsxText=lr]="jsxText";const hr=57344;e[e.jsxEmptyText=hr]="jsxEmptyText";const fr=58880;e[e.jsxTagStart=fr]="jsxTagStart";const pr=59392;e[e.jsxTagEnd=pr]="jsxTagEnd";const dr=60928;e[e.typeParameterStart=dr]="typeParameterStart";const mr=61440;e[e.nonNullAssertion=mr]="nonNullAssertion";const gr=62480;e[e._break=gr]="_break";const br=63504;e[e._case=br]="_case";const yr=64528;e[e._catch=yr]="_catch";const _r=65552;e[e._continue=_r]="_continue";const xr=66576;e[e._debugger=xr]="_debugger";const vr=67600;e[e._default=vr]="_default";const kr=68624;e[e._do=kr]="_do";const wr=69648;e[e._else=wr]="_else";const Sr=70672;e[e._finally=Sr]="_finally";const Er=71696;e[e._for=Er]="_for";const Tr=73232;e[e._function=Tr]="_function";const Ar=73744;e[e._if=Ar]="_if";const Ir=74768;e[e._return=Ir]="_return";const Cr=75792;e[e._switch=Cr]="_switch";const Rr=77456;e[e._throw=Rr]="_throw";const Pr=77840;e[e._try=Pr]="_try";const Lr=78864;e[e._var=Lr]="_var";const Dr=79888;e[e._let=Dr]="_let";const Nr=80912;e[e._const=Nr]="_const";const Fr=81936;e[e._while=Fr]="_while";const Ur=82960;e[e._with=Ur]="_with";const Mr=84496;e[e._new=Mr]="_new";const Or=85520;e[e._this=Or]="_this";const Br=86544;e[e._super=Br]="_super";const Vr=87568;e[e._class=Vr]="_class";const jr=88080;e[e._extends=jr]="_extends";const $r=89104;e[e._export=$r]="_export";const qr=90640;e[e._import=qr]="_import";const Hr=91664;e[e._yield=Hr]="_yield";const Wr=92688;e[e._null=Wr]="_null";const Gr=93712;e[e._true=Gr]="_true";const Xr=94736;e[e._false=Xr]="_false";const Yr=95256;e[e._in=Yr]="_in";const zr=96280;e[e._instanceof=zr]="_instanceof";const Kr=97936;e[e._typeof=Kr]="_typeof";const Zr=98960;e[e._void=Zr]="_void";const Ul=99984;e[e._delete=Ul]="_delete";const Ml=100880;e[e._async=Ml]="_async";const Ol=101904;e[e._get=Ol]="_get";const Bl=102928;e[e._set=Bl]="_set";const Vl=103952;e[e._declare=Vl]="_declare";const jl=104976;e[e._readonly=jl]="_readonly";const $l=106e3;e[e._abstract=$l]="_abstract";const ql=107024;e[e._static=ql]="_static";const Hl=107536;e[e._public=Hl]="_public";const Wl=108560;e[e._private=Wl]="_private";const Gl=109584;e[e._protected=Gl]="_protected";const Xl=110608;e[e._override=Xl]="_override";const Yl=112144;e[e._as=Yl]="_as";const zl=113168;e[e._enum=zl]="_enum";const Kl=114192;e[e._type=Kl]="_type";const Zl=115216;e[e._implements=Zl]="_implements"})(r||(r={}));function Af(e){switch(e){case r.num:return"num";case r.bigint:return"bigint";case r.decimal:return"decimal";case r.regexp:return"regexp";case r.string:return"string";case r.name:return"name";case r.eof:return"eof";case r.bracketL:return"[";case r.bracketR:return"]";case r.braceL:return"{";case r.braceBarL:return"{|";case r.braceR:return"}";case r.braceBarR:return"|}";case r.parenL:return"(";case r.parenR:return")";case r.comma:return",";case r.semi:return";";case r.colon:return":";case r.doubleColon:return"::";case r.dot:return".";case r.question:return"?";case r.questionDot:return"?.";case r.arrow:return"=>";case r.template:return"template";case r.ellipsis:return"...";case r.backQuote:return"`";case r.dollarBraceL:return"${";case r.at:return"@";case r.hash:return"#";case r.eq:return"=";case r.assign:return"_=";case r.preIncDec:return"++/--";case r.postIncDec:return"++/--";case r.bang:return"!";case r.tilde:return"~";case r.pipeline:return"|>";case r.nullishCoalescing:return"??";case r.logicalOR:return"||";case r.logicalAND:return"&&";case r.bitwiseOR:return"|";case r.bitwiseXOR:return"^";case r.bitwiseAND:return"&";case r.equality:return"==/!=";case r.lessThan:return"<";case r.greaterThan:return">";case r.relationalOrEqual:return"<=/>=";case r.bitShiftL:return"<<";case r.bitShiftR:return">>/>>>";case r.plus:return"+";case r.minus:return"-";case r.modulo:return"%";case r.star:return"*";case r.slash:return"/";case r.exponent:return"**";case r.jsxName:return"jsxName";case r.jsxText:return"jsxText";case r.jsxEmptyText:return"jsxEmptyText";case r.jsxTagStart:return"jsxTagStart";case r.jsxTagEnd:return"jsxTagEnd";case r.typeParameterStart:return"typeParameterStart";case r.nonNullAssertion:return"nonNullAssertion";case r._break:return"break";case r._case:return"case";case r._catch:return"catch";case r._continue:return"continue";case r._debugger:return"debugger";case r._default:return"default";case r._do:return"do";case r._else:return"else";case r._finally:return"finally";case r._for:return"for";case r._function:return"function";case r._if:return"if";case r._return:return"return";case r._switch:return"switch";case r._throw:return"throw";case r._try:return"try";case r._var:return"var";case r._let:return"let";case r._const:return"const";case r._while:return"while";case r._with:return"with";case r._new:return"new";case r._this:return"this";case r._super:return"super";case r._class:return"class";case r._extends:return"extends";case r._export:return"export";case r._import:return"import";case r._yield:return"yield";case r._null:return"null";case r._true:return"true";case r._false:return"false";case r._in:return"in";case r._instanceof:return"instanceof";case r._typeof:return"typeof";case r._void:return"void";case r._delete:return"delete";case r._async:return"async";case r._get:return"get";case r._set:return"set";case r._declare:return"declare";case r._readonly:return"readonly";case r._abstract:return"abstract";case r._static:return"static";case r._public:return"public";case r._private:return"private";case r._protected:return"protected";case r._override:return"override";case r._as:return"as";case r._enum:return"enum";case r._type:return"type";case r._implements:return"implements";default:return""}}class At{constructor(t,s,i){this.startTokenIndex=t,this.endTokenIndex=s,this.isFunctionScope=i}}class If{constructor(t,s,i,n,a,o,u,l,h,d,m,_,k){this.potentialArrowAt=t,this.noAnonFunctionType=s,this.inDisallowConditionalTypesContext=i,this.tokensLength=n,this.scopesLength=a,this.pos=o,this.type=u,this.contextualKeyword=l,this.start=h,this.end=d,this.isType=m,this.scopeDepth=_,this.error=k}}class He{constructor(){He.prototype.__init.call(this),He.prototype.__init2.call(this),He.prototype.__init3.call(this),He.prototype.__init4.call(this),He.prototype.__init5.call(this),He.prototype.__init6.call(this),He.prototype.__init7.call(this),He.prototype.__init8.call(this),He.prototype.__init9.call(this),He.prototype.__init10.call(this),He.prototype.__init11.call(this),He.prototype.__init12.call(this),He.prototype.__init13.call(this)}__init(){this.potentialArrowAt=-1}__init2(){this.noAnonFunctionType=false}__init3(){this.inDisallowConditionalTypesContext=false}__init4(){this.tokens=[]}__init5(){this.scopes=[]}__init6(){this.pos=0}__init7(){this.type=r.eof}__init8(){this.contextualKeyword=g.NONE}__init9(){this.start=0}__init10(){this.end=0}__init11(){this.isType=false}__init12(){this.scopeDepth=0}__init13(){this.error=null}snapshot(){return new If(this.potentialArrowAt,this.noAnonFunctionType,this.inDisallowConditionalTypesContext,this.tokens.length,this.scopes.length,this.pos,this.type,this.contextualKeyword,this.start,this.end,this.isType,this.scopeDepth,this.error)}restoreFromSnapshot(t){this.potentialArrowAt=t.potentialArrowAt,this.noAnonFunctionType=t.noAnonFunctionType,this.inDisallowConditionalTypesContext=t.inDisallowConditionalTypesContext,this.tokens.length=t.tokensLength,this.scopes.length=t.scopesLength,this.pos=t.pos,this.type=t.type,this.contextualKeyword=t.contextualKeyword,this.start=t.start,this.end=t.end,this.isType=t.isType,this.scopeDepth=t.scopeDepth,this.error=t.error}}var y;(function(e){e[e.backSpace=8]="backSpace";const s=10;e[e.lineFeed=s]="lineFeed";const i=9;e[e.tab=i]="tab";const n=13;e[e.carriageReturn=n]="carriageReturn";const a=14;e[e.shiftOut=a]="shiftOut";const o=32;e[e.space=o]="space";const u=33;e[e.exclamationMark=u]="exclamationMark";const l=34;e[e.quotationMark=l]="quotationMark";const h=35;e[e.numberSign=h]="numberSign";const d=36;e[e.dollarSign=d]="dollarSign";const m=37;e[e.percentSign=m]="percentSign";const _=38;e[e.ampersand=_]="ampersand";const k=39;e[e.apostrophe=k]="apostrophe";const T=40;e[e.leftParenthesis=T]="leftParenthesis";const P=41;e[e.rightParenthesis=P]="rightParenthesis";const F=42;e[e.asterisk=F]="asterisk";const B=43;e[e.plusSign=B]="plusSign";const N=44;e[e.comma=N]="comma";const Y=45;e[e.dash=Y]="dash";const q=46;e[e.dot=q]="dot";const z=47;e[e.slash=z]="slash";const J=48;e[e.digit0=J]="digit0";const K=49;e[e.digit1=K]="digit1";const X=50;e[e.digit2=X]="digit2";const re=51;e[e.digit3=re]="digit3";const x=52;e[e.digit4=x]="digit4";const b=53;e[e.digit5=b]="digit5";const v=54;e[e.digit6=v]="digit6";const V=55;e[e.digit7=V]="digit7";const W=56;e[e.digit8=W]="digit8";const M=57;e[e.digit9=M]="digit9";const R=58;e[e.colon=R]="colon";const O=59;e[e.semicolon=O]="semicolon";const U=60;e[e.lessThan=U]="lessThan";const I=61;e[e.equalsTo=I]="equalsTo";const H=62;e[e.greaterThan=H]="greaterThan";const G=63;e[e.questionMark=G]="questionMark";const te=64;e[e.atSign=te]="atSign";const ce=65;e[e.uppercaseA=ce]="uppercaseA";const oe=66;e[e.uppercaseB=oe]="uppercaseB";const w=67;e[e.uppercaseC=w]="uppercaseC";const E=68;e[e.uppercaseD=E]="uppercaseD";const D=69;e[e.uppercaseE=D]="uppercaseE";const L=70;e[e.uppercaseF=L]="uppercaseF";const j=71;e[e.uppercaseG=j]="uppercaseG";const se=72;e[e.uppercaseH=se]="uppercaseH";const ne=73;e[e.uppercaseI=ne]="uppercaseI";const de=74;e[e.uppercaseJ=de]="uppercaseJ";const Se=75;e[e.uppercaseK=Se]="uppercaseK";const ke=76;e[e.uppercaseL=ke]="uppercaseL";const Fe=77;e[e.uppercaseM=Fe]="uppercaseM";const Xe=78;e[e.uppercaseN=Xe]="uppercaseN";const Ce=79;e[e.uppercaseO=Ce]="uppercaseO";const Ve=80;e[e.uppercaseP=Ve]="uppercaseP";const je=81;e[e.uppercaseQ=je]="uppercaseQ";const ts=82;e[e.uppercaseR=ts]="uppercaseR";const ds=83;e[e.uppercaseS=ds]="uppercaseS";const Rs=84;e[e.uppercaseT=Rs]="uppercaseT";const ar=85;e[e.uppercaseU=ar]="uppercaseU";const or=86;e[e.uppercaseV=or]="uppercaseV";const cr=87;e[e.uppercaseW=cr]="uppercaseW";const ur=88;e[e.uppercaseX=ur]="uppercaseX";const lr=89;e[e.uppercaseY=lr]="uppercaseY";const hr=90;e[e.uppercaseZ=hr]="uppercaseZ";const fr=91;e[e.leftSquareBracket=fr]="leftSquareBracket";const pr=92;e[e.backslash=pr]="backslash";const dr=93;e[e.rightSquareBracket=dr]="rightSquareBracket";const mr=94;e[e.caret=mr]="caret";const gr=95;e[e.underscore=gr]="underscore";const br=96;e[e.graveAccent=br]="graveAccent";const yr=97;e[e.lowercaseA=yr]="lowercaseA";const _r=98;e[e.lowercaseB=_r]="lowercaseB";const xr=99;e[e.lowercaseC=xr]="lowercaseC";const vr=100;e[e.lowercaseD=vr]="lowercaseD";const kr=101;e[e.lowercaseE=kr]="lowercaseE";const wr=102;e[e.lowercaseF=wr]="lowercaseF";const Sr=103;e[e.lowercaseG=Sr]="lowercaseG";const Er=104;e[e.lowercaseH=Er]="lowercaseH";const Tr=105;e[e.lowercaseI=Tr]="lowercaseI";const Ar=106;e[e.lowercaseJ=Ar]="lowercaseJ";const Ir=107;e[e.lowercaseK=Ir]="lowercaseK";const Cr=108;e[e.lowercaseL=Cr]="lowercaseL";const Rr=109;e[e.lowercaseM=Rr]="lowercaseM";const Pr=110;e[e.lowercaseN=Pr]="lowercaseN";const Lr=111;e[e.lowercaseO=Lr]="lowercaseO";const Dr=112;e[e.lowercaseP=Dr]="lowercaseP";const Nr=113;e[e.lowercaseQ=Nr]="lowercaseQ";const Fr=114;e[e.lowercaseR=Fr]="lowercaseR";const Ur=115;e[e.lowercaseS=Ur]="lowercaseS";const Mr=116;e[e.lowercaseT=Mr]="lowercaseT";const Or=117;e[e.lowercaseU=Or]="lowercaseU";const Br=118;e[e.lowercaseV=Br]="lowercaseV";const Vr=119;e[e.lowercaseW=Vr]="lowercaseW";const jr=120;e[e.lowercaseX=jr]="lowercaseX";const $r=121;e[e.lowercaseY=$r]="lowercaseY";const qr=122;e[e.lowercaseZ=qr]="lowercaseZ";const Hr=123;e[e.leftCurlyBrace=Hr]="leftCurlyBrace";const Wr=124;e[e.verticalBar=Wr]="verticalBar";const Gr=125;e[e.rightCurlyBrace=Gr]="rightCurlyBrace";const Xr=126;e[e.tilde=Xr]="tilde";const Yr=160;e[e.nonBreakingSpace=Yr]="nonBreakingSpace";const zr=5760;e[e.oghamSpaceMark=zr]="oghamSpaceMark";const Kr=8232;e[e.lineSeparator=Kr]="lineSeparator";const Zr=8233;e[e.paragraphSeparator=Zr]="paragraphSeparator"})(y||(y={}));let Qi,me,_e,c,$,_u;function Xs(){return _u++}function Cf(e){if("pos"in e){const t=Pf(e.pos);e.message+=` (${t.line}:${t.column})`,e.loc=t}return e}class Rf{constructor(t,s){this.line=t,this.column=s}}function Pf(e){let t=1,s=1;for(let i=0;i<e;i++)$.charCodeAt(i)===y.lineFeed?(t++,s=1):s++;return new Rf(t,s)}function Lf(e,t,s,i){$=e,c=new He,_u=1,Qi=t,me=s,_e=i}function ee(e){return c.contextualKeyword===e}function ma(e){const t=ri();return t.type===r.name&&t.contextualKeyword===e}function Le(e){return c.contextualKeyword===e&&S(r.name)}function Re(e){Le(e)||le()}function tt(){return p(r.eof)||p(r.braceR)||We()}function We(){const e=c.tokens[c.tokens.length-1],t=e?e.end:0;for(let s=t;s<c.start;s++){const i=$.charCodeAt(s);if(i===y.lineFeed||i===y.carriageReturn||i===8232||i===8233)return true}return false}function xu(){const e=ga();for(let t=c.end;t<e;t++){const s=$.charCodeAt(t);if(s===y.lineFeed||s===y.carriageReturn||s===8232||s===8233)return true}return false}function vt(){return S(r.semi)||tt()}function Ee(){vt()||le('Unexpected token, expected ";"')}function A(e){S(e)||le(`Unexpected token, expected "${Af(e)}"`)}function le(e="Unexpected token",t=c.start){if(c.error)return;const s=new SyntaxError(e);s.pos=t,c.error=s,c.pos=$.length,ue(r.eof)}const vu=[9,11,12,y.space,y.nonBreakingSpace,y.oghamSpaceMark,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8239,8287,12288,65279],Eo=/(?:\s|\/\/.*|\/\*[^]*?\*\/)*/g,ku=new Uint8Array(65536);for(const e of vu)ku[e]=1;function Df(e){if(e<48)return e===36;if(e<58)return true;if(e<65)return false;if(e<91)return true;if(e<97)return e===95;if(e<123)return true;if(e<128)return false;throw new Error("Should not be called with non-ASCII char code.")}const mt=new Uint8Array(65536);for(let e=0;e<128;e++)mt[e]=Df(e)?1:0;for(let e=128;e<65536;e++)mt[e]=1;for(const e of vu)mt[e]=0;mt[8232]=0;mt[8233]=0;const ii=mt.slice();for(let e=y.digit0;e<=y.digit9;e++)ii[e]=0;const To=new Int32Array([-1,27,783,918,1755,2376,2862,3483,-1,3699,-1,4617,4752,4833,5130,5508,5940,-1,6480,6939,7749,8181,8451,8613,-1,8829,-1,-1,-1,54,243,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,432,-1,-1,-1,675,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,81,-1,-1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1,-1,-1,-1,-1,(r._with<<1)+1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,8856,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,8883,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,8910,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,8937,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,(r._yield<<1)+1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1]);function Nf(){let e=0,t=0,s=c.pos;for(;s<$.length&&(t=$.charCodeAt(s),!(t<y.lowercaseA||t>y.lowercaseZ));){const n=To[e+(t-y.lowercaseA)+1];if(n===-1)break;e=n,s++}const i=To[e];if(i>-1&&!mt[t]){c.pos=s,i&1?ue(i>>>1):ue(r.name,i>>>1);return}for(;s<$.length;){const n=$.charCodeAt(s);if(mt[n])s++;else if(n===y.backslash){if(s+=2,$.charCodeAt(s)===y.leftCurlyBrace){for(;s<$.length&&$.charCodeAt(s)!==y.rightCurlyBrace;)s++;s++}}else if(n===y.atSign&&$.charCodeAt(s+1)===y.atSign)s+=2;else break}c.pos=s,ue(r.name)}var ie;(function(e){e[e.Access=0]="Access";const s=1;e[e.ExportAccess=s]="ExportAccess";const i=s+1;e[e.TopLevelDeclaration=i]="TopLevelDeclaration";const n=i+1;e[e.FunctionScopedDeclaration=n]="FunctionScopedDeclaration";const a=n+1;e[e.BlockScopedDeclaration=a]="BlockScopedDeclaration";const o=a+1;e[e.ObjectShorthandTopLevelDeclaration=o]="ObjectShorthandTopLevelDeclaration";const u=o+1;e[e.ObjectShorthandFunctionScopedDeclaration=u]="ObjectShorthandFunctionScopedDeclaration";const l=u+1;e[e.ObjectShorthandBlockScopedDeclaration=l]="ObjectShorthandBlockScopedDeclaration";const h=l+1;e[e.ObjectShorthand=h]="ObjectShorthand";const d=h+1;e[e.ImportDeclaration=d]="ImportDeclaration";const m=d+1;e[e.ObjectKey=m]="ObjectKey";const _=m+1;e[e.ImportAccess=_]="ImportAccess"})(ie||(ie={}));var ft;(function(e){e[e.NoChildren=0]="NoChildren";const s=1;e[e.OneChild=s]="OneChild";const i=s+1;e[e.StaticChildren=i]="StaticChildren";const n=i+1;e[e.KeyAfterPropSpread=n]="KeyAfterPropSpread"})(ft||(ft={}));function wu(e){const t=e.identifierRole;return t===ie.TopLevelDeclaration||t===ie.FunctionScopedDeclaration||t===ie.BlockScopedDeclaration||t===ie.ObjectShorthandTopLevelDeclaration||t===ie.ObjectShorthandFunctionScopedDeclaration||t===ie.ObjectShorthandBlockScopedDeclaration}function Ff(e){const t=e.identifierRole;return t===ie.FunctionScopedDeclaration||t===ie.BlockScopedDeclaration||t===ie.ObjectShorthandFunctionScopedDeclaration||t===ie.ObjectShorthandBlockScopedDeclaration}function Su(e){const t=e.identifierRole;return t===ie.TopLevelDeclaration||t===ie.ObjectShorthandTopLevelDeclaration||t===ie.ImportDeclaration}function Uf(e){const t=e.identifierRole;return t===ie.TopLevelDeclaration||t===ie.BlockScopedDeclaration||t===ie.ObjectShorthandTopLevelDeclaration||t===ie.ObjectShorthandBlockScopedDeclaration}function Mf(e){const t=e.identifierRole;return t===ie.FunctionScopedDeclaration||t===ie.ObjectShorthandFunctionScopedDeclaration}function Of(e){return e.identifierRole===ie.ObjectShorthandTopLevelDeclaration||e.identifierRole===ie.ObjectShorthandBlockScopedDeclaration||e.identifierRole===ie.ObjectShorthandFunctionScopedDeclaration}class Ji{constructor(){this.type=c.type,this.contextualKeyword=c.contextualKeyword,this.start=c.start,this.end=c.end,this.scopeDepth=c.scopeDepth,this.isType=c.isType,this.identifierRole=null,this.jsxRole=null,this.shadowsGlobal=false,this.isAsyncOperation=false,this.contextId=null,this.rhsEndIndex=null,this.isExpression=false,this.numNullishCoalesceStarts=0,this.numNullishCoalesceEnds=0,this.isOptionalChainStart=false,this.isOptionalChainEnd=false,this.subscriptStartIndex=null,this.nullishStartIndex=null}}function C(){c.tokens.push(new Ji),Iu()}function Xt(){c.tokens.push(new Ji),c.start=c.pos,tp()}function Bf(){c.type===r.assign&&--c.pos,Qf()}function pe(e){for(let s=c.tokens.length-e;s<c.tokens.length;s++)c.tokens[s].isType=true;const t=c.isType;return c.isType=true,t}function fe(e){c.isType=e}function S(e){return p(e)?(C(),true):false}function Eu(e){const t=c.isType;c.isType=true,S(e),c.isType=t}function p(e){return c.type===e}function Ae(){const e=c.snapshot();C();const t=c.type;return c.restoreFromSnapshot(e),t}class Vf{constructor(t,s){this.type=t,this.contextualKeyword=s}}function ri(){const e=c.snapshot();C();const t=c.type,s=c.contextualKeyword;return c.restoreFromSnapshot(e),new Vf(t,s)}function ga(){return Tu(c.pos)}function Tu(e){Eo.lastIndex=e;const t=Eo.exec($);return e+t[0].length}function Au(){return $.charCodeAt(ga())}function Iu(){if(Ru(),c.start=c.pos,c.pos>=$.length){const e=c.tokens;e.length>=2&&e[e.length-1].start>=$.length&&e[e.length-2].start>=$.length&&le("Unexpectedly reached the end of input."),ue(r.eof);return}jf($.charCodeAt(c.pos))}function jf(e){ii[e]||e===y.backslash||e===y.atSign&&$.charCodeAt(c.pos+1)===y.atSign?Nf():Du(e)}function $f(){for(;$.charCodeAt(c.pos)!==y.asterisk||$.charCodeAt(c.pos+1)!==y.slash;)if(c.pos++,c.pos>$.length){le("Unterminated comment",c.pos-2);return}c.pos+=2}function Cu(e){let t=$.charCodeAt(c.pos+=e);if(c.pos<$.length)for(;t!==y.lineFeed&&t!==y.carriageReturn&&t!==y.lineSeparator&&t!==y.paragraphSeparator&&++c.pos<$.length;)t=$.charCodeAt(c.pos)}function Ru(){for(;c.pos<$.length;){const e=$.charCodeAt(c.pos);switch(e){case y.carriageReturn:$.charCodeAt(c.pos+1)===y.lineFeed&&++c.pos;case y.lineFeed:case y.lineSeparator:case y.paragraphSeparator:++c.pos;break;case y.slash:switch($.charCodeAt(c.pos+1)){case y.asterisk:c.pos+=2,$f();break;case y.slash:Cu(2);break;default:return}break;default:if(ku[e])++c.pos;else return}}}function ue(e,t=g.NONE){c.end=c.pos,c.type=e,c.contextualKeyword=t}function qf(){const e=$.charCodeAt(c.pos+1);if(e>=y.digit0&&e<=y.digit9){Nu(true);return}e===y.dot&&$.charCodeAt(c.pos+2)===y.dot?(c.pos+=3,ue(r.ellipsis)):(++c.pos,ue(r.dot))}function Hf(){$.charCodeAt(c.pos+1)===y.equalsTo?ve(r.assign,2):ve(r.slash,1)}function Wf(e){let t=e===y.asterisk?r.star:r.modulo,s=1,i=$.charCodeAt(c.pos+1);e===y.asterisk&&i===y.asterisk&&(s++,i=$.charCodeAt(c.pos+2),t=r.exponent),i===y.equalsTo&&$.charCodeAt(c.pos+2)!==y.greaterThan&&(s++,t=r.assign),ve(t,s)}function Gf(e){const t=$.charCodeAt(c.pos+1);if(t===e){$.charCodeAt(c.pos+2)===y.equalsTo?ve(r.assign,3):ve(e===y.verticalBar?r.logicalOR:r.logicalAND,2);return}if(e===y.verticalBar){if(t===y.greaterThan){ve(r.pipeline,2);return}else if(t===y.rightCurlyBrace&&_e){ve(r.braceBarR,2);return}}if(t===y.equalsTo){ve(r.assign,2);return}ve(e===y.verticalBar?r.bitwiseOR:r.bitwiseAND,1)}function Xf(){$.charCodeAt(c.pos+1)===y.equalsTo?ve(r.assign,2):ve(r.bitwiseXOR,1)}function Yf(e){const t=$.charCodeAt(c.pos+1);if(t===e){ve(r.preIncDec,2);return}t===y.equalsTo?ve(r.assign,2):e===y.plusSign?ve(r.plus,1):ve(r.minus,1)}function zf(){const e=$.charCodeAt(c.pos+1);if(e===y.lessThan){if($.charCodeAt(c.pos+2)===y.equalsTo){ve(r.assign,3);return}c.isType?ve(r.lessThan,1):ve(r.bitShiftL,2);return}e===y.equalsTo?ve(r.relationalOrEqual,2):ve(r.lessThan,1)}function Pu(){if(c.isType){ve(r.greaterThan,1);return}const e=$.charCodeAt(c.pos+1);if(e===y.greaterThan){const t=$.charCodeAt(c.pos+2)===y.greaterThan?3:2;if($.charCodeAt(c.pos+t)===y.equalsTo){ve(r.assign,t+1);return}ve(r.bitShiftR,t);return}e===y.equalsTo?ve(r.relationalOrEqual,2):ve(r.greaterThan,1)}function Lu(){c.type===r.greaterThan&&(c.pos-=1,Pu())}function Kf(e){const t=$.charCodeAt(c.pos+1);if(t===y.equalsTo){ve(r.equality,$.charCodeAt(c.pos+2)===y.equalsTo?3:2);return}if(e===y.equalsTo&&t===y.greaterThan){c.pos+=2,ue(r.arrow);return}ve(e===y.equalsTo?r.eq:r.bang,1)}function Zf(){const e=$.charCodeAt(c.pos+1),t=$.charCodeAt(c.pos+2);e===y.questionMark&&!(_e&&c.isType)?t===y.equalsTo?ve(r.assign,3):ve(r.nullishCoalescing,2):e===y.dot&&!(t>=y.digit0&&t<=y.digit9)?(c.pos+=2,ue(r.questionDot)):(++c.pos,ue(r.question))}function Du(e){switch(e){case y.numberSign:++c.pos,ue(r.hash);return;case y.dot:qf();return;case y.leftParenthesis:++c.pos,ue(r.parenL);return;case y.rightParenthesis:++c.pos,ue(r.parenR);return;case y.semicolon:++c.pos,ue(r.semi);return;case y.comma:++c.pos,ue(r.comma);return;case y.leftSquareBracket:++c.pos,ue(r.bracketL);return;case y.rightSquareBracket:++c.pos,ue(r.bracketR);return;case y.leftCurlyBrace:_e&&$.charCodeAt(c.pos+1)===y.verticalBar?ve(r.braceBarL,2):(++c.pos,ue(r.braceL));return;case y.rightCurlyBrace:++c.pos,ue(r.braceR);return;case y.colon:$.charCodeAt(c.pos+1)===y.colon?ve(r.doubleColon,2):(++c.pos,ue(r.colon));return;case y.questionMark:Zf();return;case y.atSign:++c.pos,ue(r.at);return;case y.graveAccent:++c.pos,ue(r.backQuote);return;case y.digit0:{const t=$.charCodeAt(c.pos+1);if(t===y.lowercaseX||t===y.uppercaseX||t===y.lowercaseO||t===y.uppercaseO||t===y.lowercaseB||t===y.uppercaseB){Jf();return}}case y.digit1:case y.digit2:case y.digit3:case y.digit4:case y.digit5:case y.digit6:case y.digit7:case y.digit8:case y.digit9:Nu(false);return;case y.quotationMark:case y.apostrophe:ep(e);return;case y.slash:Hf();return;case y.percentSign:case y.asterisk:Wf(e);return;case y.verticalBar:case y.ampersand:Gf(e);return;case y.caret:Xf();return;case y.plusSign:case y.dash:Yf(e);return;case y.lessThan:zf();return;case y.greaterThan:Pu();return;case y.equalsTo:case y.exclamationMark:Kf(e);return;case y.tilde:ve(r.tilde,1);return}le(`Unexpected character '${String.fromCharCode(e)}'`,c.pos)}function ve(e,t){c.pos+=t,ue(e)}function Qf(){const e=c.pos;let t=false,s=false;for(;;){if(c.pos>=$.length){le("Unterminated regular expression",e);return}const i=$.charCodeAt(c.pos);if(t)t=false;else{if(i===y.leftSquareBracket)s=true;else if(i===y.rightSquareBracket&&s)s=false;else if(i===y.slash&&!s)break;t=i===y.backslash}++c.pos}++c.pos,sp(),ue(r.regexp)}function fn(){for(;;){const e=$.charCodeAt(c.pos);if(e>=y.digit0&&e<=y.digit9||e===y.underscore)c.pos++;else break}}function Jf(){for(c.pos+=2;;){const t=$.charCodeAt(c.pos);if(t>=y.digit0&&t<=y.digit9||t>=y.lowercaseA&&t<=y.lowercaseF||t>=y.uppercaseA&&t<=y.uppercaseF||t===y.underscore)c.pos++;else break}$.charCodeAt(c.pos)===y.lowercaseN?(++c.pos,ue(r.bigint)):ue(r.num)}function Nu(e){let t=false,s=false;e||fn();let i=$.charCodeAt(c.pos);if(i===y.dot&&(++c.pos,fn(),i=$.charCodeAt(c.pos)),(i===y.uppercaseE||i===y.lowercaseE)&&(i=$.charCodeAt(++c.pos),(i===y.plusSign||i===y.dash)&&++c.pos,fn(),i=$.charCodeAt(c.pos)),i===y.lowercaseN?(++c.pos,t=true):i===y.lowercaseM&&(++c.pos,s=true),t){ue(r.bigint);return}if(s){ue(r.decimal);return}ue(r.num)}function ep(e){for(c.pos++;;){if(c.pos>=$.length){le("Unterminated string constant");return}const t=$.charCodeAt(c.pos);if(t===y.backslash)c.pos++;else if(t===e)break;c.pos++}c.pos++,ue(r.string)}function tp(){for(;;){if(c.pos>=$.length){le("Unterminated template");return}const e=$.charCodeAt(c.pos);if(e===y.graveAccent||e===y.dollarSign&&$.charCodeAt(c.pos+1)===y.leftCurlyBrace){if(c.pos===c.start&&p(r.template))if(e===y.dollarSign){c.pos+=2,ue(r.dollarBraceL);return}else{++c.pos,ue(r.backQuote);return}ue(r.template);return}e===y.backslash&&c.pos++,c.pos++}}function sp(){for(;c.pos<$.length;){const e=$.charCodeAt(c.pos);if(mt[e])c.pos++;else if(e===y.backslash){if(c.pos+=2,$.charCodeAt(c.pos)===y.leftCurlyBrace){for(;c.pos<$.length&&$.charCodeAt(c.pos)!==y.rightCurlyBrace;)c.pos++;c.pos++}}else break}}function Ys(e,t=e.currentIndex()){let s=t+1;if(fi(e,s)){const i=e.identifierNameAtIndex(t);return{isType:false,leftName:i,rightName:i,endIndex:s}}if(s++,fi(e,s))return{isType:true,leftName:null,rightName:null,endIndex:s};if(s++,fi(e,s))return{isType:false,leftName:e.identifierNameAtIndex(t),rightName:e.identifierNameAtIndex(t+2),endIndex:s};if(s++,fi(e,s))return{isType:true,leftName:null,rightName:null,endIndex:s};throw new Error(`Unexpected import/export specifier at ${t}`)}function fi(e,t){const s=e.tokens[t];return s.type===r.braceR||s.type===r.comma}var ip=new Map([["quot",'"'],["amp","&"],["apos","'"],["lt","<"],["gt",">"],["nbsp"," "],["iexcl","¡"],["cent","¢"],["pound","£"],["curren","¤"],["yen","¥"],["brvbar","¦"],["sect","§"],["uml","¨"],["copy","©"],["ordf","ª"],["laquo","«"],["not","¬"],["shy",""],["reg","®"],["macr","¯"],["deg","°"],["plusmn","±"],["sup2","²"],["sup3","³"],["acute","´"],["micro","µ"],["para","¶"],["middot","·"],["cedil","¸"],["sup1","¹"],["ordm","º"],["raquo","»"],["frac14","¼"],["frac12","½"],["frac34","¾"],["iquest","¿"],["Agrave","À"],["Aacute","Á"],["Acirc","Â"],["Atilde","Ã"],["Auml","Ä"],["Aring","Å"],["AElig","Æ"],["Ccedil","Ç"],["Egrave","È"],["Eacute","É"],["Ecirc","Ê"],["Euml","Ë"],["Igrave","Ì"],["Iacute","Í"],["Icirc","Î"],["Iuml","Ï"],["ETH","Ð"],["Ntilde","Ñ"],["Ograve","Ò"],["Oacute","Ó"],["Ocirc","Ô"],["Otilde","Õ"],["Ouml","Ö"],["times","×"],["Oslash","Ø"],["Ugrave","Ù"],["Uacute","Ú"],["Ucirc","Û"],["Uuml","Ü"],["Yacute","Ý"],["THORN","Þ"],["szlig","ß"],["agrave","à"],["aacute","á"],["acirc","â"],["atilde","ã"],["auml","ä"],["aring","å"],["aelig","æ"],["ccedil","ç"],["egrave","è"],["eacute","é"],["ecirc","ê"],["euml","ë"],["igrave","ì"],["iacute","í"],["icirc","î"],["iuml","ï"],["eth","ð"],["ntilde","ñ"],["ograve","ò"],["oacute","ó"],["ocirc","ô"],["otilde","õ"],["ouml","ö"],["divide","÷"],["oslash","ø"],["ugrave","ù"],["uacute","ú"],["ucirc","û"],["uuml","ü"],["yacute","ý"],["thorn","þ"],["yuml","ÿ"],["OElig","Œ"],["oelig","œ"],["Scaron","Š"],["scaron","š"],["Yuml","Ÿ"],["fnof","ƒ"],["circ","ˆ"],["tilde","˜"],["Alpha","Α"],["Beta","Β"],["Gamma","Γ"],["Delta","Δ"],["Epsilon","Ε"],["Zeta","Ζ"],["Eta","Η"],["Theta","Θ"],["Iota","Ι"],["Kappa","Κ"],["Lambda","Λ"],["Mu","Μ"],["Nu","Ν"],["Xi","Ξ"],["Omicron","Ο"],["Pi","Π"],["Rho","Ρ"],["Sigma","Σ"],["Tau","Τ"],["Upsilon","Υ"],["Phi","Φ"],["Chi","Χ"],["Psi","Ψ"],["Omega","Ω"],["alpha","α"],["beta","β"],["gamma","γ"],["delta","δ"],["epsilon","ε"],["zeta","ζ"],["eta","η"],["theta","θ"],["iota","ι"],["kappa","κ"],["lambda","λ"],["mu","μ"],["nu","ν"],["xi","ξ"],["omicron","ο"],["pi","π"],["rho","ρ"],["sigmaf","ς"],["sigma","σ"],["tau","τ"],["upsilon","υ"],["phi","φ"],["chi","χ"],["psi","ψ"],["omega","ω"],["thetasym","ϑ"],["upsih","ϒ"],["piv","ϖ"],["ensp"," "],["emsp"," "],["thinsp"," "],["zwnj",""],["zwj",""],["lrm",""],["rlm",""],["ndash","–"],["mdash","—"],["lsquo","‘"],["rsquo","’"],["sbquo","‚"],["ldquo","“"],["rdquo","”"],["bdquo","„"],["dagger","†"],["Dagger","‡"],["bull","•"],["hellip","…"],["permil","‰"],["prime","′"],["Prime","″"],["lsaquo","‹"],["rsaquo","›"],["oline","‾"],["frasl","⁄"],["euro","€"],["image","ℑ"],["weierp","℘"],["real","ℜ"],["trade","™"],["alefsym","ℵ"],["larr","←"],["uarr","↑"],["rarr","→"],["darr","↓"],["harr","↔"],["crarr","↵"],["lArr","⇐"],["uArr","⇑"],["rArr","⇒"],["dArr","⇓"],["hArr","⇔"],["forall","∀"],["part","∂"],["exist","∃"],["empty","∅"],["nabla","∇"],["isin","∈"],["notin","∉"],["ni","∋"],["prod","∏"],["sum","∑"],["minus","−"],["lowast","∗"],["radic","√"],["prop","∝"],["infin","∞"],["ang","∠"],["and","∧"],["or","∨"],["cap","∩"],["cup","∪"],["int","∫"],["there4","∴"],["sim","∼"],["cong","≅"],["asymp","≈"],["ne","≠"],["equiv","≡"],["le","≤"],["ge","≥"],["sub","⊂"],["sup","⊃"],["nsub","⊄"],["sube","⊆"],["supe","⊇"],["oplus","⊕"],["otimes","⊗"],["perp","⊥"],["sdot","⋅"],["lceil","⌈"],["rceil","⌉"],["lfloor","⌊"],["rfloor","⌋"],["lang","〈"],["rang","〉"],["loz","◊"],["spades","♠"],["clubs","♣"],["hearts","♥"],["diams","♦"]]);function Fu(e){const[t,s]=Ao(e.jsxPragma||"React.createElement"),[i,n]=Ao(e.jsxFragmentPragma||"React.Fragment");return{base:t,suffix:s,fragmentBase:i,fragmentSuffix:n}}function Ao(e){let t=e.indexOf(".");return t===-1&&(t=e.length),[e.slice(0,t),e.slice(t)]}class gt{getPrefixCode(){return""}getHoistedCode(){return""}getSuffixCode(){return""}}class ss extends gt{__init(){this.lastLineNumber=1}__init2(){this.lastIndex=0}__init3(){this.filenameVarName=null}__init4(){this.esmAutomaticImportNameResolutions={}}__init5(){this.cjsAutomaticModuleNameResolutions={}}constructor(t,s,i,n,a){super(),this.rootTransformer=t,this.tokens=s,this.importProcessor=i,this.nameManager=n,this.options=a,ss.prototype.__init.call(this),ss.prototype.__init2.call(this),ss.prototype.__init3.call(this),ss.prototype.__init4.call(this),ss.prototype.__init5.call(this),this.jsxPragmaInfo=Fu(a),this.isAutomaticRuntime=a.jsxRuntime==="automatic",this.jsxImportSource=a.jsxImportSource||"react"}process(){return this.tokens.matches1(r.jsxTagStart)?(this.processJSXTag(),true):false}getPrefixCode(){let t="";if(this.filenameVarName&&(t+=`const ${this.filenameVarName} = ${JSON.stringify(this.options.filePath||"")};`),this.isAutomaticRuntime)if(this.importProcessor)for(const[s,i]of Object.entries(this.cjsAutomaticModuleNameResolutions))t+=`var ${i} = require("${s}");`;else{const{createElement:s,...i}=this.esmAutomaticImportNameResolutions;s&&(t+=`import {createElement as ${s}} from "${this.jsxImportSource}";`);const n=Object.entries(i).map(([a,o])=>`${a} as ${o}`).join(", ");if(n){const a=this.jsxImportSource+(this.options.production?"/jsx-runtime":"/jsx-dev-runtime");t+=`import {${n}} from "${a}";`}}return t}processJSXTag(){const{jsxRole:t,start:s}=this.tokens.currentToken(),i=this.options.production?null:this.getElementLocationCode(s);this.isAutomaticRuntime&&t!==ft.KeyAfterPropSpread?this.transformTagToJSXFunc(i,t):this.transformTagToCreateElement(i)}getElementLocationCode(t){return`lineNumber: ${this.getLineNumberForIndex(t)}`}getLineNumberForIndex(t){const s=this.tokens.code;for(;this.lastIndex<t&&this.lastIndex<s.length;)s[this.lastIndex]===`
|
|
449
|
+
`&&this.lastLineNumber++,this.lastIndex++;return this.lastLineNumber}transformTagToJSXFunc(t,s){const i=s===ft.StaticChildren;this.tokens.replaceToken(this.getJSXFuncInvocationCode(i));let n=null;if(this.tokens.matches1(r.jsxTagEnd))this.tokens.replaceToken(`${this.getFragmentCode()}, {`),this.processAutomaticChildrenAndEndProps(s);else{if(this.processTagIntro(),this.tokens.appendCode(", {"),n=this.processProps(true),this.tokens.matches2(r.slash,r.jsxTagEnd))this.tokens.appendCode("}");else if(this.tokens.matches1(r.jsxTagEnd))this.tokens.removeToken(),this.processAutomaticChildrenAndEndProps(s);else throw new Error("Expected either /> or > at the end of the tag.");n&&this.tokens.appendCode(`, ${n}`)}for(this.options.production||(n===null&&this.tokens.appendCode(", void 0"),this.tokens.appendCode(`, ${i}, ${this.getDevSource(t)}, this`)),this.tokens.removeInitialToken();!this.tokens.matches1(r.jsxTagEnd);)this.tokens.removeToken();this.tokens.replaceToken(")")}transformTagToCreateElement(t){if(this.tokens.replaceToken(this.getCreateElementInvocationCode()),this.tokens.matches1(r.jsxTagEnd))this.tokens.replaceToken(`${this.getFragmentCode()}, null`),this.processChildren(true);else if(this.processTagIntro(),this.processPropsObjectWithDevInfo(t),!this.tokens.matches2(r.slash,r.jsxTagEnd))if(this.tokens.matches1(r.jsxTagEnd))this.tokens.removeToken(),this.processChildren(true);else throw new Error("Expected either /> or > at the end of the tag.");for(this.tokens.removeInitialToken();!this.tokens.matches1(r.jsxTagEnd);)this.tokens.removeToken();this.tokens.replaceToken(")")}getJSXFuncInvocationCode(t){return this.options.production?t?this.claimAutoImportedFuncInvocation("jsxs","/jsx-runtime"):this.claimAutoImportedFuncInvocation("jsx","/jsx-runtime"):this.claimAutoImportedFuncInvocation("jsxDEV","/jsx-dev-runtime")}getCreateElementInvocationCode(){if(this.isAutomaticRuntime)return this.claimAutoImportedFuncInvocation("createElement","");{const{jsxPragmaInfo:t}=this;return`${this.importProcessor&&this.importProcessor.getIdentifierReplacement(t.base)||t.base}${t.suffix}(`}}getFragmentCode(){if(this.isAutomaticRuntime)return this.claimAutoImportedName("Fragment",this.options.production?"/jsx-runtime":"/jsx-dev-runtime");{const{jsxPragmaInfo:t}=this;return(this.importProcessor&&this.importProcessor.getIdentifierReplacement(t.fragmentBase)||t.fragmentBase)+t.fragmentSuffix}}claimAutoImportedFuncInvocation(t,s){const i=this.claimAutoImportedName(t,s);return this.importProcessor?`${i}.call(void 0, `:`${i}(`}claimAutoImportedName(t,s){if(this.importProcessor){const i=this.jsxImportSource+s;return this.cjsAutomaticModuleNameResolutions[i]||(this.cjsAutomaticModuleNameResolutions[i]=this.importProcessor.getFreeIdentifierForPath(i)),`${this.cjsAutomaticModuleNameResolutions[i]}.${t}`}else return this.esmAutomaticImportNameResolutions[t]||(this.esmAutomaticImportNameResolutions[t]=this.nameManager.claimFreeName(`_${t}`)),this.esmAutomaticImportNameResolutions[t]}processTagIntro(){let t=this.tokens.currentIndex()+1;for(;this.tokens.tokens[t].isType||!this.tokens.matches2AtIndex(t-1,r.jsxName,r.jsxName)&&!this.tokens.matches2AtIndex(t-1,r.greaterThan,r.jsxName)&&!this.tokens.matches1AtIndex(t,r.braceL)&&!this.tokens.matches1AtIndex(t,r.jsxTagEnd)&&!this.tokens.matches2AtIndex(t,r.slash,r.jsxTagEnd);)t++;if(t===this.tokens.currentIndex()+1){const s=this.tokens.identifierName();Uu(s)&&this.tokens.replaceToken(`'${s}'`)}for(;this.tokens.currentIndex()<t;)this.rootTransformer.processToken()}processPropsObjectWithDevInfo(t){const s=this.options.production?"":`__self: this, __source: ${this.getDevSource(t)}`;if(!this.tokens.matches1(r.jsxName)&&!this.tokens.matches1(r.braceL)){s?this.tokens.appendCode(`, {${s}}`):this.tokens.appendCode(", null");return}this.tokens.appendCode(", {"),this.processProps(false),s?this.tokens.appendCode(` ${s}}`):this.tokens.appendCode("}")}processProps(t){let s=null;for(;;){if(this.tokens.matches2(r.jsxName,r.eq)){const i=this.tokens.identifierName();if(t&&i==="key"){s!==null&&this.tokens.appendCode(s.replace(/[^\n]/g,"")),this.tokens.removeToken(),this.tokens.removeToken();const n=this.tokens.snapshot();this.processPropValue(),s=this.tokens.dangerouslyGetAndRemoveCodeSinceSnapshot(n);continue}else this.processPropName(i),this.tokens.replaceToken(": "),this.processPropValue()}else if(this.tokens.matches1(r.jsxName)){const i=this.tokens.identifierName();this.processPropName(i),this.tokens.appendCode(": true")}else if(this.tokens.matches1(r.braceL))this.tokens.replaceToken(""),this.rootTransformer.processBalancedCode(),this.tokens.replaceToken("");else break;this.tokens.appendCode(",")}return s}processPropName(t){t.includes("-")?this.tokens.replaceToken(`'${t}'`):this.tokens.copyToken()}processPropValue(){this.tokens.matches1(r.braceL)?(this.tokens.replaceToken(""),this.rootTransformer.processBalancedCode(),this.tokens.replaceToken("")):this.tokens.matches1(r.jsxTagStart)?this.processJSXTag():this.processStringPropValue()}processStringPropValue(){const t=this.tokens.currentToken(),s=this.tokens.code.slice(t.start+1,t.end-1),i=Io(s),n=np(s);this.tokens.replaceToken(n+i)}processAutomaticChildrenAndEndProps(t){t===ft.StaticChildren?(this.tokens.appendCode(" children: ["),this.processChildren(false),this.tokens.appendCode("]}")):(t===ft.OneChild&&this.tokens.appendCode(" children: "),this.processChildren(false),this.tokens.appendCode("}"))}processChildren(t){let s=t;for(;;){if(this.tokens.matches2(r.jsxTagStart,r.slash))return;let i=false;if(this.tokens.matches1(r.braceL))this.tokens.matches2(r.braceL,r.braceR)?(this.tokens.replaceToken(""),this.tokens.replaceToken("")):(this.tokens.replaceToken(s?", ":""),this.rootTransformer.processBalancedCode(),this.tokens.replaceToken(""),i=true);else if(this.tokens.matches1(r.jsxTagStart))this.tokens.appendCode(s?", ":""),this.processJSXTag(),i=true;else if(this.tokens.matches1(r.jsxText)||this.tokens.matches1(r.jsxEmptyText))i=this.processChildTextElement(s);else throw new Error("Unexpected token when processing JSX children.");i&&(s=true)}}processChildTextElement(t){const s=this.tokens.currentToken(),i=this.tokens.code.slice(s.start,s.end),n=Io(i),a=rp(i);return a==='""'?(this.tokens.replaceToken(n),false):(this.tokens.replaceToken(`${t?", ":""}${a}${n}`),true)}getDevSource(t){return`{fileName: ${this.getFilenameVarName()}, ${t}}`}getFilenameVarName(){return this.filenameVarName||(this.filenameVarName=this.nameManager.claimFreeName("_jsxFileName")),this.filenameVarName}}function Uu(e){const t=e.charCodeAt(0);return t>=y.lowercaseA&&t<=y.lowercaseZ}function rp(e){let t="",s="",i=false,n=false;for(let a=0;a<e.length;a++){const o=e[a];if(o===" "||o===" "||o==="\r")i||(s+=o);else if(o===`
|
|
450
450
|
`)s="",i=true;else{if(n&&i&&(t+=" "),t+=s,s="",o==="&"){const{entity:u,newI:l}=Mu(e,a+1);a=l-1,t+=u}else t+=o;n=true,i=false}}return i||(t+=s),JSON.stringify(t)}function Io(e){let t=0,s=0;for(const i of e)i===`
|
|
451
451
|
`?(t++,s=0):i===" "&&s++;return`
|
|
452
|
-
`.repeat(t)+" ".repeat(s)}function
|
|
452
|
+
`.repeat(t)+" ".repeat(s)}function np(e){let t="";for(let s=0;s<e.length;s++){const i=e[s];if(i===`
|
|
453
453
|
`)if(/\s/.test(e[s+1]))for(t+=" ";s<e.length&&/\s/.test(e[s+1]);)s++;else t+=`
|
|
454
|
-
`;else if(i==="&"){const{entity:n,newI:a}=Mu(e,s+1);t+=n,s=a-1}else t+=i}return JSON.stringify(t)}function Mu(e,t){let s="",i=0,n,a=t;if(e[a]==="#"){let o=10;a++;let u;if(e[a]==="x")for(o=16,a++,u=a;a<e.length&&ap(e.charCodeAt(a));)a++;else for(u=a;a<e.length&&np(e.charCodeAt(a));)a++;if(e[a]===";"){const l=e.slice(u,a);l&&(a++,n=String.fromCodePoint(parseInt(l,o)))}}else for(;a<e.length&&i++<10;){const o=e[a];if(a++,o===";"){n=sp.get(s);break}s+=o}return n?{entity:n,newI:a}:{entity:"&",newI:t}}function np(e){return e>=y.digit0&&e<=y.digit9}function ap(e){return e>=y.digit0&&e<=y.digit9||e>=y.lowercaseA&&e<=y.lowercaseF||e>=y.uppercaseA&&e<=y.uppercaseF}function Ou(e,t){const s=Fu(t),i=new Set;for(let n=0;n<e.tokens.length;n++){const a=e.tokens[n];if(a.type===r.name&&!a.isType&&(a.identifierRole===ie.Access||a.identifierRole===ie.ObjectShorthand||a.identifierRole===ie.ExportAccess)&&!a.shadowsGlobal&&i.add(e.identifierNameForToken(a)),a.type===r.jsxTagStart&&i.add(s.base),a.type===r.jsxTagStart&&n+1<e.tokens.length&&e.tokens[n+1].type===r.jsxTagEnd&&(i.add(s.base),i.add(s.fragmentBase)),a.type===r.jsxName&&a.identifierRole===ie.Access){const o=e.identifierNameForToken(a);(!Uu(o)||e.tokens[n+1].type===r.dot)&&i.add(e.identifierNameForToken(a))}}return i}class is{__init(){this.nonTypeIdentifiers=new Set}__init2(){this.importInfoByPath=new Map}__init3(){this.importsToReplace=new Map}__init4(){this.identifierReplacements=new Map}__init5(){this.exportBindingsByLocalName=new Map}constructor(t,s,i,n,a,o,u){this.nameManager=t,this.tokens=s,this.enableLegacyTypeScriptModuleInterop=i,this.options=n,this.isTypeScriptTransformEnabled=a,this.keepUnusedImports=o,this.helperManager=u,is.prototype.__init.call(this),is.prototype.__init2.call(this),is.prototype.__init3.call(this),is.prototype.__init4.call(this),is.prototype.__init5.call(this)}preprocessTokens(){for(let t=0;t<this.tokens.tokens.length;t++)this.tokens.matches1AtIndex(t,r._import)&&!this.tokens.matches3AtIndex(t,r._import,r.name,r.eq)&&this.preprocessImportAtIndex(t),this.tokens.matches1AtIndex(t,r._export)&&!this.tokens.matches2AtIndex(t,r._export,r.eq)&&this.preprocessExportAtIndex(t);this.generateImportReplacements()}pruneTypeOnlyImports(){this.nonTypeIdentifiers=Ou(this.tokens,this.options);for(const[t,s]of this.importInfoByPath.entries()){if(s.hasBareImport||s.hasStarExport||s.exportStarNames.length>0||s.namedExports.length>0)continue;[...s.defaultNames,...s.wildcardNames,...s.namedImports.map(({localName:n})=>n)].every(n=>this.shouldAutomaticallyElideImportedName(n))&&this.importsToReplace.set(t,"")}}shouldAutomaticallyElideImportedName(t){return this.isTypeScriptTransformEnabled&&!this.keepUnusedImports&&!this.nonTypeIdentifiers.has(t)}generateImportReplacements(){for(const[t,s]of this.importInfoByPath.entries()){const{defaultNames:i,wildcardNames:n,namedImports:a,namedExports:o,exportStarNames:u,hasStarExport:l}=s;if(i.length===0&&n.length===0&&a.length===0&&o.length===0&&u.length===0&&!l){this.importsToReplace.set(t,`require('${t}');`);continue}const h=this.getFreeIdentifierForPath(t);let d;this.enableLegacyTypeScriptModuleInterop?d=h:d=n.length>0?n[0]:this.getFreeIdentifierForPath(t);let m=`var ${h} = require('${t}');`;if(n.length>0)for(const _ of n){const k=this.enableLegacyTypeScriptModuleInterop?h:`${this.helperManager.getHelperName("interopRequireWildcard")}(${h})`;m+=` var ${_} = ${k};`}else u.length>0&&d!==h?m+=` var ${d} = ${this.helperManager.getHelperName("interopRequireWildcard")}(${h});`:i.length>0&&d!==h&&(m+=` var ${d} = ${this.helperManager.getHelperName("interopRequireDefault")}(${h});`);for(const{importedName:_,localName:k}of o)m+=` ${this.helperManager.getHelperName("createNamedExportFrom")}(${h}, '${k}', '${_}');`;for(const _ of u)m+=` exports.${_} = ${d};`;l&&(m+=` ${this.helperManager.getHelperName("createStarExport")}(${h});`),this.importsToReplace.set(t,m);for(const _ of i)this.identifierReplacements.set(_,`${d}.default`);for(const{importedName:_,localName:k}of a)this.identifierReplacements.set(k,`${h}.${_}`)}}getFreeIdentifierForPath(t){const s=t.split("/"),n=s[s.length-1].replace(/\W/g,"");return this.nameManager.claimFreeName(`_${n}`)}preprocessImportAtIndex(t){const s=[],i=[],n=[];if(t++,(this.tokens.matchesContextualAtIndex(t,g._type)||this.tokens.matches1AtIndex(t,r._typeof))&&!this.tokens.matches1AtIndex(t+1,r.comma)&&!this.tokens.matchesContextualAtIndex(t+1,g._from)||this.tokens.matches1AtIndex(t,r.parenL))return;if(this.tokens.matches1AtIndex(t,r.name)&&(s.push(this.tokens.identifierNameAtIndex(t)),t++,this.tokens.matches1AtIndex(t,r.comma)&&t++),this.tokens.matches1AtIndex(t,r.star)&&(t+=2,i.push(this.tokens.identifierNameAtIndex(t)),t++),this.tokens.matches1AtIndex(t,r.braceL)){const u=this.getNamedImports(t+1);t=u.newIndex;for(const l of u.namedImports)l.importedName==="default"?s.push(l.localName):n.push(l)}if(this.tokens.matchesContextualAtIndex(t,g._from)&&t++,!this.tokens.matches1AtIndex(t,r.string))throw new Error("Expected string token at the end of import statement.");const a=this.tokens.stringValueAtIndex(t),o=this.getImportInfo(a);o.defaultNames.push(...s),o.wildcardNames.push(...i),o.namedImports.push(...n),s.length===0&&i.length===0&&n.length===0&&(o.hasBareImport=true)}preprocessExportAtIndex(t){if(this.tokens.matches2AtIndex(t,r._export,r._var)||this.tokens.matches2AtIndex(t,r._export,r._let)||this.tokens.matches2AtIndex(t,r._export,r._const))this.preprocessVarExportAtIndex(t);else if(this.tokens.matches2AtIndex(t,r._export,r._function)||this.tokens.matches2AtIndex(t,r._export,r._class)){const s=this.tokens.identifierNameAtIndex(t+2);this.addExportBinding(s,s)}else if(this.tokens.matches3AtIndex(t,r._export,r.name,r._function)){const s=this.tokens.identifierNameAtIndex(t+3);this.addExportBinding(s,s)}else this.tokens.matches2AtIndex(t,r._export,r.braceL)?this.preprocessNamedExportAtIndex(t):this.tokens.matches2AtIndex(t,r._export,r.star)&&this.preprocessExportStarAtIndex(t)}preprocessVarExportAtIndex(t){let s=0;for(let i=t+2;;i++)if(this.tokens.matches1AtIndex(i,r.braceL)||this.tokens.matches1AtIndex(i,r.dollarBraceL)||this.tokens.matches1AtIndex(i,r.bracketL))s++;else if(this.tokens.matches1AtIndex(i,r.braceR)||this.tokens.matches1AtIndex(i,r.bracketR))s--;else{if(s===0&&!this.tokens.matches1AtIndex(i,r.name))break;if(this.tokens.matches1AtIndex(1,r.eq)){const n=this.tokens.currentToken().rhsEndIndex;if(n==null)throw new Error("Expected = token with an end index.");i=n-1}else{const n=this.tokens.tokens[i];if(wu(n)){const a=this.tokens.identifierNameAtIndex(i);this.identifierReplacements.set(a,`exports.${a}`)}}}}preprocessNamedExportAtIndex(t){t+=2;const{newIndex:s,namedImports:i}=this.getNamedImports(t);if(t=s,this.tokens.matchesContextualAtIndex(t,g._from))t++;else{for(const{importedName:o,localName:u}of i)this.addExportBinding(o,u);return}if(!this.tokens.matches1AtIndex(t,r.string))throw new Error("Expected string token at the end of import statement.");const n=this.tokens.stringValueAtIndex(t);this.getImportInfo(n).namedExports.push(...i)}preprocessExportStarAtIndex(t){let s=null;if(this.tokens.matches3AtIndex(t,r._export,r.star,r._as)?(t+=3,s=this.tokens.identifierNameAtIndex(t),t+=2):t+=3,!this.tokens.matches1AtIndex(t,r.string))throw new Error("Expected string token at the end of star export statement.");const i=this.tokens.stringValueAtIndex(t),n=this.getImportInfo(i);s!==null?n.exportStarNames.push(s):n.hasStarExport=true}getNamedImports(t){const s=[];for(;;){if(this.tokens.matches1AtIndex(t,r.braceR)){t++;break}const i=Ys(this.tokens,t);if(t=i.endIndex,i.isType||s.push({importedName:i.leftName,localName:i.rightName}),this.tokens.matches2AtIndex(t,r.comma,r.braceR)){t+=2;break}else if(this.tokens.matches1AtIndex(t,r.braceR)){t++;break}else if(this.tokens.matches1AtIndex(t,r.comma))t++;else throw new Error(`Unexpected token: ${JSON.stringify(this.tokens.tokens[t])}`)}return{newIndex:t,namedImports:s}}getImportInfo(t){const s=this.importInfoByPath.get(t);if(s)return s;const i={defaultNames:[],wildcardNames:[],namedImports:[],namedExports:[],hasBareImport:false,exportStarNames:[],hasStarExport:false};return this.importInfoByPath.set(t,i),i}addExportBinding(t,s){this.exportBindingsByLocalName.has(t)||this.exportBindingsByLocalName.set(t,[]),this.exportBindingsByLocalName.get(t).push(s)}claimImportCode(t){const s=this.importsToReplace.get(t);return this.importsToReplace.set(t,""),s||""}getIdentifierReplacement(t){return this.identifierReplacements.get(t)||null}resolveExportBinding(t){const s=this.exportBindingsByLocalName.get(t);return!s||s.length===0?null:s.map(i=>`exports.${i}`).join(" = ")}getGlobalNames(){return new Set([...this.identifierReplacements.keys(),...this.exportBindingsByLocalName.keys()])}}var op=44,cp=59,Co="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Bu=new Uint8Array(64),up=new Uint8Array(128);for(let e=0;e<Co.length;e++){const t=Co.charCodeAt(e);Bu[e]=t,up[t]=e}function Ns(e,t,s){let i=t-s;i=i<0?-i<<1|1:i<<1;do{let n=i&31;i>>>=5,i>0&&(n|=32),e.write(Bu[n])}while(i>0);return t}var Ro=1024*16,Po=typeof TextDecoder<"u"?new TextDecoder:typeof Buffer<"u"?{decode(e){return Buffer.from(e.buffer,e.byteOffset,e.byteLength).toString()}}:{decode(e){let t="";for(let s=0;s<e.length;s++)t+=String.fromCharCode(e[s]);return t}},lp=class{constructor(){this.pos=0,this.out="",this.buffer=new Uint8Array(Ro)}write(e){const{buffer:t}=this;t[this.pos++]=e,this.pos===Ro&&(this.out+=Po.decode(t),this.pos=0)}flush(){const{buffer:e,out:t,pos:s}=this;return s>0?t+Po.decode(e.subarray(0,s)):t}};function hp(e){const t=new lp;let s=0,i=0,n=0,a=0;for(let o=0;o<e.length;o++){const u=e[o];if(o>0&&t.write(cp),u.length===0)continue;let l=0;for(let h=0;h<u.length;h++){const d=u[h];h>0&&t.write(op),l=Ns(t,d[0],l),d.length!==1&&(s=Ns(t,d[1],s),i=Ns(t,d[2],i),n=Ns(t,d[3],n),d.length!==4&&(a=Ns(t,d[4],a)))}}return t.flush()}var os=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},fp={exports:{}};(function(e,t){(function(s,i){e.exports=i()})(os,function(){const s=/^[\w+.-]+:\/\//,i=/^([\w+.-]+:)\/\/([^@/#?]*@)?([^:/#?]*)(:\d+)?(\/[^#?]*)?(\?[^#]*)?(#.*)?/,n=/^file:(?:\/\/((?![a-z]:)[^/#?]*)?)?(\/?[^#?]*)(\?[^#]*)?(#.*)?/i;function a(N){return s.test(N)}function o(N){return N.startsWith("//")}function u(N){return N.startsWith("/")}function l(N){return N.startsWith("file:")}function h(N){return/^[.?#]/.test(N)}function d(N){const Y=i.exec(N);return _(Y[1],Y[2]||"",Y[3],Y[4]||"",Y[5]||"/",Y[6]||"",Y[7]||"")}function m(N){const Y=n.exec(N),q=Y[2];return _("file:","",Y[1]||"","",u(q)?q:"/"+q,Y[3]||"",Y[4]||"")}function _(N,Y,q,z,J,K,X){return{scheme:N,user:Y,host:q,port:z,path:J,query:K,hash:X,type:7}}function k(N){if(o(N)){const q=d("http:"+N);return q.scheme="",q.type=6,q}if(u(N)){const q=d("http://foo.com"+N);return q.scheme="",q.host="",q.type=5,q}if(l(N))return m(N);if(a(N))return d(N);const Y=d("http://foo.com/"+N);return Y.scheme="",Y.host="",Y.type=N?N.startsWith("?")?3:N.startsWith("#")?2:4:1,Y}function T(N){if(N.endsWith("/.."))return N;const Y=N.lastIndexOf("/");return N.slice(0,Y+1)}function P(N,Y){F(Y,Y.type),N.path==="/"?N.path=Y.path:N.path=T(Y.path)+N.path}function F(N,Y){const q=Y<=4,z=N.path.split("/");let J=1,K=0,X=false;for(let x=1;x<z.length;x++){const b=z[x];if(!b){X=true;continue}if(X=false,b!=="."){if(b===".."){K?(X=true,K--,J--):q&&(z[J++]=b);continue}z[J++]=b,K++}}let re="";for(let x=1;x<J;x++)re+="/"+z[x];(!re||X&&!re.endsWith("/.."))&&(re+="/"),N.path=re}function B(N,Y){if(!N&&!Y)return"";const q=k(N);let z=q.type;if(Y&&z!==7){const K=k(Y),X=K.type;switch(z){case 1:q.hash=K.hash;case 2:q.query=K.query;case 3:case 4:P(q,K);case 5:q.user=K.user,q.host=K.host,q.port=K.port;case 6:q.scheme=K.scheme}X>z&&(z=X)}F(q,z);const J=q.query+q.hash;switch(z){case 2:case 3:return J;case 4:{const K=q.path.slice(1);return K?h(Y||N)&&!h(K)?"./"+K+J:K+J:J||"."}case 5:return q.path+J;default:return q.scheme+"//"+q.user+q.host+q.port+q.path+J}}return B})})(fp);var pn=class{constructor(){this._indexes={__proto__:null},this.array=[]}};function pp(e,t){return e._indexes[t]}function dp(e,t){const s=pp(e,t);if(s!==void 0)return s;const{array:i,_indexes:n}=e,a=i.push(t);return n[t]=a-1}var mp=0,gp=1,bp=2,yp=3,_p=4,Vu=-1,xp=class{constructor({file:e,sourceRoot:t}={}){this._names=new pn,this._sources=new pn,this._sourcesContent=[],this._mappings=[],this.file=e,this.sourceRoot=t,this._ignoreList=new pn}};var dn=(e,t,s,i,n,a,o,u)=>wp(true,e,t,s,i,n,a);function vp(e){const{_mappings:t,_sources:s,_sourcesContent:i,_names:n,_ignoreList:a}=e;return Tp(t),{version:3,file:e.file||void 0,names:n.array,sourceRoot:e.sourceRoot||void 0,sources:s.array,sourcesContent:i,mappings:t,ignoreList:a.array}}function kp(e){const t=vp(e);return Object.assign({},t,{mappings:hp(t.mappings)})}function wp(e,t,s,i,n,a,o,u,l){const{_mappings:h,_sources:d,_sourcesContent:m,_names:_}=t,k=Sp(h,s),T=Ep(k,i);if(!n)return Ap(k,T)?void 0:Lo(k,T,[i]);const P=dp(d,n),F=Vu;if(P===m.length&&(m[P]=null),!Ip(k,T,P,a,o,F))return Lo(k,T,[i,P,a,o])}function Sp(e,t){for(let s=e.length;s<=t;s++)e[s]=[];return e[t]}function Ep(e,t){let s=e.length;for(let i=s-1;i>=0;s=i--){const n=e[i];if(t>=n[mp])break}return s}function Lo(e,t,s){for(let i=e.length;i>t;i--)e[i]=e[i-1];e[t]=s}function Tp(e){const{length:t}=e;let s=t;for(let i=s-1;i>=0&&!(e[i].length>0);s=i,i--);s<t&&(e.length=s)}function Ap(e,t){return t===0?true:e[t-1].length===1}function Ip(e,t,s,i,n,a){if(t===0)return false;const o=e[t-1];return o.length===1?false:s===o[gp]&&i===o[bp]&&n===o[yp]&&a===(o.length===5?o[_p]:Vu)}function Cp({code:e,mappings:t},s,i,n,a){const o=Rp(n,a),u=new xp({file:i.compiledFilename});let l=0,h=t[0];for(;h===void 0&&l<t.length-1;)l++,h=t[l];let d=0,m=0;h!==m&&dn(u,d,0,s,d,0);for(let P=0;P<e.length;P++){if(P===h){const F=h-m,B=o[l];for(dn(u,d,F,s,d,B);(h===P||h===void 0)&&l<t.length-1;)l++,h=t[l]}e.charCodeAt(P)===y.lineFeed&&(d++,m=P+1,h!==m&&dn(u,d,0,s,d,0))}const{sourceRoot:_,sourcesContent:k,...T}=kp(u);return T}function Rp(e,t){const s=new Array(t.length);let i=0,n=t[i].start,a=0;for(let o=0;o<e.length;o++)o===n&&(s[i]=n-a,i++,n=t[i].start),e.charCodeAt(o)===y.lineFeed&&(a=o+1);return s}const Pp={require:`
|
|
454
|
+
`;else if(i==="&"){const{entity:n,newI:a}=Mu(e,s+1);t+=n,s=a-1}else t+=i}return JSON.stringify(t)}function Mu(e,t){let s="",i=0,n,a=t;if(e[a]==="#"){let o=10;a++;let u;if(e[a]==="x")for(o=16,a++,u=a;a<e.length&&op(e.charCodeAt(a));)a++;else for(u=a;a<e.length&&ap(e.charCodeAt(a));)a++;if(e[a]===";"){const l=e.slice(u,a);l&&(a++,n=String.fromCodePoint(parseInt(l,o)))}}else for(;a<e.length&&i++<10;){const o=e[a];if(a++,o===";"){n=ip.get(s);break}s+=o}return n?{entity:n,newI:a}:{entity:"&",newI:t}}function ap(e){return e>=y.digit0&&e<=y.digit9}function op(e){return e>=y.digit0&&e<=y.digit9||e>=y.lowercaseA&&e<=y.lowercaseF||e>=y.uppercaseA&&e<=y.uppercaseF}function Ou(e,t){const s=Fu(t),i=new Set;for(let n=0;n<e.tokens.length;n++){const a=e.tokens[n];if(a.type===r.name&&!a.isType&&(a.identifierRole===ie.Access||a.identifierRole===ie.ObjectShorthand||a.identifierRole===ie.ExportAccess)&&!a.shadowsGlobal&&i.add(e.identifierNameForToken(a)),a.type===r.jsxTagStart&&i.add(s.base),a.type===r.jsxTagStart&&n+1<e.tokens.length&&e.tokens[n+1].type===r.jsxTagEnd&&(i.add(s.base),i.add(s.fragmentBase)),a.type===r.jsxName&&a.identifierRole===ie.Access){const o=e.identifierNameForToken(a);(!Uu(o)||e.tokens[n+1].type===r.dot)&&i.add(e.identifierNameForToken(a))}}return i}class is{__init(){this.nonTypeIdentifiers=new Set}__init2(){this.importInfoByPath=new Map}__init3(){this.importsToReplace=new Map}__init4(){this.identifierReplacements=new Map}__init5(){this.exportBindingsByLocalName=new Map}constructor(t,s,i,n,a,o,u){this.nameManager=t,this.tokens=s,this.enableLegacyTypeScriptModuleInterop=i,this.options=n,this.isTypeScriptTransformEnabled=a,this.keepUnusedImports=o,this.helperManager=u,is.prototype.__init.call(this),is.prototype.__init2.call(this),is.prototype.__init3.call(this),is.prototype.__init4.call(this),is.prototype.__init5.call(this)}preprocessTokens(){for(let t=0;t<this.tokens.tokens.length;t++)this.tokens.matches1AtIndex(t,r._import)&&!this.tokens.matches3AtIndex(t,r._import,r.name,r.eq)&&this.preprocessImportAtIndex(t),this.tokens.matches1AtIndex(t,r._export)&&!this.tokens.matches2AtIndex(t,r._export,r.eq)&&this.preprocessExportAtIndex(t);this.generateImportReplacements()}pruneTypeOnlyImports(){this.nonTypeIdentifiers=Ou(this.tokens,this.options);for(const[t,s]of this.importInfoByPath.entries()){if(s.hasBareImport||s.hasStarExport||s.exportStarNames.length>0||s.namedExports.length>0)continue;[...s.defaultNames,...s.wildcardNames,...s.namedImports.map(({localName:n})=>n)].every(n=>this.shouldAutomaticallyElideImportedName(n))&&this.importsToReplace.set(t,"")}}shouldAutomaticallyElideImportedName(t){return this.isTypeScriptTransformEnabled&&!this.keepUnusedImports&&!this.nonTypeIdentifiers.has(t)}generateImportReplacements(){for(const[t,s]of this.importInfoByPath.entries()){const{defaultNames:i,wildcardNames:n,namedImports:a,namedExports:o,exportStarNames:u,hasStarExport:l}=s;if(i.length===0&&n.length===0&&a.length===0&&o.length===0&&u.length===0&&!l){this.importsToReplace.set(t,`require('${t}');`);continue}const h=this.getFreeIdentifierForPath(t);let d;this.enableLegacyTypeScriptModuleInterop?d=h:d=n.length>0?n[0]:this.getFreeIdentifierForPath(t);let m=`var ${h} = require('${t}');`;if(n.length>0)for(const _ of n){const k=this.enableLegacyTypeScriptModuleInterop?h:`${this.helperManager.getHelperName("interopRequireWildcard")}(${h})`;m+=` var ${_} = ${k};`}else u.length>0&&d!==h?m+=` var ${d} = ${this.helperManager.getHelperName("interopRequireWildcard")}(${h});`:i.length>0&&d!==h&&(m+=` var ${d} = ${this.helperManager.getHelperName("interopRequireDefault")}(${h});`);for(const{importedName:_,localName:k}of o)m+=` ${this.helperManager.getHelperName("createNamedExportFrom")}(${h}, '${k}', '${_}');`;for(const _ of u)m+=` exports.${_} = ${d};`;l&&(m+=` ${this.helperManager.getHelperName("createStarExport")}(${h});`),this.importsToReplace.set(t,m);for(const _ of i)this.identifierReplacements.set(_,`${d}.default`);for(const{importedName:_,localName:k}of a)this.identifierReplacements.set(k,`${h}.${_}`)}}getFreeIdentifierForPath(t){const s=t.split("/"),n=s[s.length-1].replace(/\W/g,"");return this.nameManager.claimFreeName(`_${n}`)}preprocessImportAtIndex(t){const s=[],i=[],n=[];if(t++,(this.tokens.matchesContextualAtIndex(t,g._type)||this.tokens.matches1AtIndex(t,r._typeof))&&!this.tokens.matches1AtIndex(t+1,r.comma)&&!this.tokens.matchesContextualAtIndex(t+1,g._from)||this.tokens.matches1AtIndex(t,r.parenL))return;if(this.tokens.matches1AtIndex(t,r.name)&&(s.push(this.tokens.identifierNameAtIndex(t)),t++,this.tokens.matches1AtIndex(t,r.comma)&&t++),this.tokens.matches1AtIndex(t,r.star)&&(t+=2,i.push(this.tokens.identifierNameAtIndex(t)),t++),this.tokens.matches1AtIndex(t,r.braceL)){const u=this.getNamedImports(t+1);t=u.newIndex;for(const l of u.namedImports)l.importedName==="default"?s.push(l.localName):n.push(l)}if(this.tokens.matchesContextualAtIndex(t,g._from)&&t++,!this.tokens.matches1AtIndex(t,r.string))throw new Error("Expected string token at the end of import statement.");const a=this.tokens.stringValueAtIndex(t),o=this.getImportInfo(a);o.defaultNames.push(...s),o.wildcardNames.push(...i),o.namedImports.push(...n),s.length===0&&i.length===0&&n.length===0&&(o.hasBareImport=true)}preprocessExportAtIndex(t){if(this.tokens.matches2AtIndex(t,r._export,r._var)||this.tokens.matches2AtIndex(t,r._export,r._let)||this.tokens.matches2AtIndex(t,r._export,r._const))this.preprocessVarExportAtIndex(t);else if(this.tokens.matches2AtIndex(t,r._export,r._function)||this.tokens.matches2AtIndex(t,r._export,r._class)){const s=this.tokens.identifierNameAtIndex(t+2);this.addExportBinding(s,s)}else if(this.tokens.matches3AtIndex(t,r._export,r.name,r._function)){const s=this.tokens.identifierNameAtIndex(t+3);this.addExportBinding(s,s)}else this.tokens.matches2AtIndex(t,r._export,r.braceL)?this.preprocessNamedExportAtIndex(t):this.tokens.matches2AtIndex(t,r._export,r.star)&&this.preprocessExportStarAtIndex(t)}preprocessVarExportAtIndex(t){let s=0;for(let i=t+2;;i++)if(this.tokens.matches1AtIndex(i,r.braceL)||this.tokens.matches1AtIndex(i,r.dollarBraceL)||this.tokens.matches1AtIndex(i,r.bracketL))s++;else if(this.tokens.matches1AtIndex(i,r.braceR)||this.tokens.matches1AtIndex(i,r.bracketR))s--;else{if(s===0&&!this.tokens.matches1AtIndex(i,r.name))break;if(this.tokens.matches1AtIndex(1,r.eq)){const n=this.tokens.currentToken().rhsEndIndex;if(n==null)throw new Error("Expected = token with an end index.");i=n-1}else{const n=this.tokens.tokens[i];if(wu(n)){const a=this.tokens.identifierNameAtIndex(i);this.identifierReplacements.set(a,`exports.${a}`)}}}}preprocessNamedExportAtIndex(t){t+=2;const{newIndex:s,namedImports:i}=this.getNamedImports(t);if(t=s,this.tokens.matchesContextualAtIndex(t,g._from))t++;else{for(const{importedName:o,localName:u}of i)this.addExportBinding(o,u);return}if(!this.tokens.matches1AtIndex(t,r.string))throw new Error("Expected string token at the end of import statement.");const n=this.tokens.stringValueAtIndex(t);this.getImportInfo(n).namedExports.push(...i)}preprocessExportStarAtIndex(t){let s=null;if(this.tokens.matches3AtIndex(t,r._export,r.star,r._as)?(t+=3,s=this.tokens.identifierNameAtIndex(t),t+=2):t+=3,!this.tokens.matches1AtIndex(t,r.string))throw new Error("Expected string token at the end of star export statement.");const i=this.tokens.stringValueAtIndex(t),n=this.getImportInfo(i);s!==null?n.exportStarNames.push(s):n.hasStarExport=true}getNamedImports(t){const s=[];for(;;){if(this.tokens.matches1AtIndex(t,r.braceR)){t++;break}const i=Ys(this.tokens,t);if(t=i.endIndex,i.isType||s.push({importedName:i.leftName,localName:i.rightName}),this.tokens.matches2AtIndex(t,r.comma,r.braceR)){t+=2;break}else if(this.tokens.matches1AtIndex(t,r.braceR)){t++;break}else if(this.tokens.matches1AtIndex(t,r.comma))t++;else throw new Error(`Unexpected token: ${JSON.stringify(this.tokens.tokens[t])}`)}return{newIndex:t,namedImports:s}}getImportInfo(t){const s=this.importInfoByPath.get(t);if(s)return s;const i={defaultNames:[],wildcardNames:[],namedImports:[],namedExports:[],hasBareImport:false,exportStarNames:[],hasStarExport:false};return this.importInfoByPath.set(t,i),i}addExportBinding(t,s){this.exportBindingsByLocalName.has(t)||this.exportBindingsByLocalName.set(t,[]),this.exportBindingsByLocalName.get(t).push(s)}claimImportCode(t){const s=this.importsToReplace.get(t);return this.importsToReplace.set(t,""),s||""}getIdentifierReplacement(t){return this.identifierReplacements.get(t)||null}resolveExportBinding(t){const s=this.exportBindingsByLocalName.get(t);return!s||s.length===0?null:s.map(i=>`exports.${i}`).join(" = ")}getGlobalNames(){return new Set([...this.identifierReplacements.keys(),...this.exportBindingsByLocalName.keys()])}}var cp=44,up=59,Co="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Bu=new Uint8Array(64),lp=new Uint8Array(128);for(let e=0;e<Co.length;e++){const t=Co.charCodeAt(e);Bu[e]=t,lp[t]=e}function Ds(e,t,s){let i=t-s;i=i<0?-i<<1|1:i<<1;do{let n=i&31;i>>>=5,i>0&&(n|=32),e.write(Bu[n])}while(i>0);return t}var Ro=1024*16,Po=typeof TextDecoder<"u"?new TextDecoder:typeof Buffer<"u"?{decode(e){return Buffer.from(e.buffer,e.byteOffset,e.byteLength).toString()}}:{decode(e){let t="";for(let s=0;s<e.length;s++)t+=String.fromCharCode(e[s]);return t}},hp=class{constructor(){this.pos=0,this.out="",this.buffer=new Uint8Array(Ro)}write(e){const{buffer:t}=this;t[this.pos++]=e,this.pos===Ro&&(this.out+=Po.decode(t),this.pos=0)}flush(){const{buffer:e,out:t,pos:s}=this;return s>0?t+Po.decode(e.subarray(0,s)):t}};function fp(e){const t=new hp;let s=0,i=0,n=0,a=0;for(let o=0;o<e.length;o++){const u=e[o];if(o>0&&t.write(up),u.length===0)continue;let l=0;for(let h=0;h<u.length;h++){const d=u[h];h>0&&t.write(cp),l=Ds(t,d[0],l),d.length!==1&&(s=Ds(t,d[1],s),i=Ds(t,d[2],i),n=Ds(t,d[3],n),d.length!==4&&(a=Ds(t,d[4],a)))}}return t.flush()}var os=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},pp={exports:{}};(function(e,t){(function(s,i){e.exports=i()})(os,function(){const s=/^[\w+.-]+:\/\//,i=/^([\w+.-]+:)\/\/([^@/#?]*@)?([^:/#?]*)(:\d+)?(\/[^#?]*)?(\?[^#]*)?(#.*)?/,n=/^file:(?:\/\/((?![a-z]:)[^/#?]*)?)?(\/?[^#?]*)(\?[^#]*)?(#.*)?/i;function a(N){return s.test(N)}function o(N){return N.startsWith("//")}function u(N){return N.startsWith("/")}function l(N){return N.startsWith("file:")}function h(N){return/^[.?#]/.test(N)}function d(N){const Y=i.exec(N);return _(Y[1],Y[2]||"",Y[3],Y[4]||"",Y[5]||"/",Y[6]||"",Y[7]||"")}function m(N){const Y=n.exec(N),q=Y[2];return _("file:","",Y[1]||"","",u(q)?q:"/"+q,Y[3]||"",Y[4]||"")}function _(N,Y,q,z,J,K,X){return{scheme:N,user:Y,host:q,port:z,path:J,query:K,hash:X,type:7}}function k(N){if(o(N)){const q=d("http:"+N);return q.scheme="",q.type=6,q}if(u(N)){const q=d("http://foo.com"+N);return q.scheme="",q.host="",q.type=5,q}if(l(N))return m(N);if(a(N))return d(N);const Y=d("http://foo.com/"+N);return Y.scheme="",Y.host="",Y.type=N?N.startsWith("?")?3:N.startsWith("#")?2:4:1,Y}function T(N){if(N.endsWith("/.."))return N;const Y=N.lastIndexOf("/");return N.slice(0,Y+1)}function P(N,Y){F(Y,Y.type),N.path==="/"?N.path=Y.path:N.path=T(Y.path)+N.path}function F(N,Y){const q=Y<=4,z=N.path.split("/");let J=1,K=0,X=false;for(let x=1;x<z.length;x++){const b=z[x];if(!b){X=true;continue}if(X=false,b!=="."){if(b===".."){K?(X=true,K--,J--):q&&(z[J++]=b);continue}z[J++]=b,K++}}let re="";for(let x=1;x<J;x++)re+="/"+z[x];(!re||X&&!re.endsWith("/.."))&&(re+="/"),N.path=re}function B(N,Y){if(!N&&!Y)return"";const q=k(N);let z=q.type;if(Y&&z!==7){const K=k(Y),X=K.type;switch(z){case 1:q.hash=K.hash;case 2:q.query=K.query;case 3:case 4:P(q,K);case 5:q.user=K.user,q.host=K.host,q.port=K.port;case 6:q.scheme=K.scheme}X>z&&(z=X)}F(q,z);const J=q.query+q.hash;switch(z){case 2:case 3:return J;case 4:{const K=q.path.slice(1);return K?h(Y||N)&&!h(K)?"./"+K+J:K+J:J||"."}case 5:return q.path+J;default:return q.scheme+"//"+q.user+q.host+q.port+q.path+J}}return B})})(pp);var pn=class{constructor(){this._indexes={__proto__:null},this.array=[]}};function dp(e,t){return e._indexes[t]}function mp(e,t){const s=dp(e,t);if(s!==void 0)return s;const{array:i,_indexes:n}=e,a=i.push(t);return n[t]=a-1}var gp=0,bp=1,yp=2,_p=3,xp=4,Vu=-1,vp=class{constructor({file:e,sourceRoot:t}={}){this._names=new pn,this._sources=new pn,this._sourcesContent=[],this._mappings=[],this.file=e,this.sourceRoot=t,this._ignoreList=new pn}};var dn=(e,t,s,i,n,a,o,u)=>Sp(true,e,t,s,i,n,a);function kp(e){const{_mappings:t,_sources:s,_sourcesContent:i,_names:n,_ignoreList:a}=e;return Ap(t),{version:3,file:e.file||void 0,names:n.array,sourceRoot:e.sourceRoot||void 0,sources:s.array,sourcesContent:i,mappings:t,ignoreList:a.array}}function wp(e){const t=kp(e);return Object.assign({},t,{mappings:fp(t.mappings)})}function Sp(e,t,s,i,n,a,o,u,l){const{_mappings:h,_sources:d,_sourcesContent:m,_names:_}=t,k=Ep(h,s),T=Tp(k,i);if(!n)return Ip(k,T)?void 0:Lo(k,T,[i]);const P=mp(d,n),F=Vu;if(P===m.length&&(m[P]=null),!Cp(k,T,P,a,o,F))return Lo(k,T,[i,P,a,o])}function Ep(e,t){for(let s=e.length;s<=t;s++)e[s]=[];return e[t]}function Tp(e,t){let s=e.length;for(let i=s-1;i>=0;s=i--){const n=e[i];if(t>=n[gp])break}return s}function Lo(e,t,s){for(let i=e.length;i>t;i--)e[i]=e[i-1];e[t]=s}function Ap(e){const{length:t}=e;let s=t;for(let i=s-1;i>=0&&!(e[i].length>0);s=i,i--);s<t&&(e.length=s)}function Ip(e,t){return t===0?true:e[t-1].length===1}function Cp(e,t,s,i,n,a){if(t===0)return false;const o=e[t-1];return o.length===1?false:s===o[bp]&&i===o[yp]&&n===o[_p]&&a===(o.length===5?o[xp]:Vu)}function Rp({code:e,mappings:t},s,i,n,a){const o=Pp(n,a),u=new vp({file:i.compiledFilename});let l=0,h=t[0];for(;h===void 0&&l<t.length-1;)l++,h=t[l];let d=0,m=0;h!==m&&dn(u,d,0,s,d,0);for(let P=0;P<e.length;P++){if(P===h){const F=h-m,B=o[l];for(dn(u,d,F,s,d,B);(h===P||h===void 0)&&l<t.length-1;)l++,h=t[l]}e.charCodeAt(P)===y.lineFeed&&(d++,m=P+1,h!==m&&dn(u,d,0,s,d,0))}const{sourceRoot:_,sourcesContent:k,...T}=wp(u);return T}function Pp(e,t){const s=new Array(t.length);let i=0,n=t[i].start,a=0;for(let o=0;o<e.length;o++)o===n&&(s[i]=n-a,i++,n=t[i].start),e.charCodeAt(o)===y.lineFeed&&(a=o+1);return s}const Lp={require:`
|
|
455
455
|
import {createRequire as CREATE_REQUIRE_NAME} from "module";
|
|
456
456
|
const require = CREATE_REQUIRE_NAME(import.meta.url);
|
|
457
457
|
`,interopRequireWildcard:`
|
|
@@ -560,9 +560,9 @@ void main() {
|
|
|
560
560
|
const result = await ASYNC_OPTIONAL_CHAIN_NAME(ops);
|
|
561
561
|
return result == null ? true : result;
|
|
562
562
|
}
|
|
563
|
-
`};class Ri{__init(){this.helperNames={}}__init2(){this.createRequireName=null}constructor(t){this.nameManager=t,Ri.prototype.__init.call(this),Ri.prototype.__init2.call(this)}getHelperName(t){let s=this.helperNames[t];return s||(s=this.nameManager.claimFreeName(`_${t}`),this.helperNames[t]=s,s)}emitHelpers(){let t="";this.helperNames.optionalChainDelete&&this.getHelperName("optionalChain"),this.helperNames.asyncOptionalChainDelete&&this.getHelperName("asyncOptionalChain");for(const[s,i]of Object.entries(Pp)){const n=this.helperNames[s];let a=i;s==="optionalChainDelete"?a=a.replace("OPTIONAL_CHAIN_NAME",this.helperNames.optionalChain):s==="asyncOptionalChainDelete"?a=a.replace("ASYNC_OPTIONAL_CHAIN_NAME",this.helperNames.asyncOptionalChain):s==="require"&&(this.createRequireName===null&&(this.createRequireName=this.nameManager.claimFreeName("_createRequire")),a=a.replace(/CREATE_REQUIRE_NAME/g,this.createRequireName)),n&&(t+=" ",t+=a.replace(s,n).replace(/\s+/g," ").trim())}return t}}function Do(e,t,s){Lp(e,s)&&Dp(e,t,s)}function Lp(e,t){for(const s of e.tokens)if(s.type===r.name&&!s.isType&&Nf(s)&&t.has(e.identifierNameForToken(s)))return true;return false}function Dp(e,t,s){const i=[];let n=t.length-1;for(let a=e.tokens.length-1;;a--){for(;i.length>0&&i[i.length-1].startTokenIndex===a+1;)i.pop();for(;n>=0&&t[n].endTokenIndex===a+1;)i.push(t[n]),n--;if(a<0)break;const o=e.tokens[a],u=e.identifierNameForToken(o);if(i.length>1&&!o.isType&&o.type===r.name&&s.has(u)){if(Ff(o))No(i[i.length-1],e,u);else if(Uf(o)){let l=i.length-1;for(;l>0&&!i[l].isFunctionScope;)l--;if(l<0)throw new Error("Did not find parent function scope.");No(i[l],e,u)}}}if(i.length>0)throw new Error("Expected empty scope stack after processing file.")}function No(e,t,s){for(let i=e.startTokenIndex;i<e.endTokenIndex;i++){const n=t.tokens[i];(n.type===r.name||n.type===r.jsxName)&&t.identifierNameForToken(n)===s&&(n.shadowsGlobal=true)}}function Np(e,t){const s=[];for(const i of t)i.type===r.name&&s.push(e.slice(i.start,i.end));return s}class ba{__init(){this.usedNames=new Set}constructor(t,s){ba.prototype.__init.call(this),this.usedNames=new Set(Np(t,s))}claimFreeName(t){const s=this.findFreeName(t);return this.usedNames.add(s),s}findFreeName(t){if(!this.usedNames.has(t))return t;let s=2;for(;this.usedNames.has(t+String(s));)s++;return t+String(s)}}var we={},Dn={},wt={},Fp=os&&os.__extends||function(){var e=function(t,s){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,n){i.__proto__=n}||function(i,n){for(var a in n)n.hasOwnProperty(a)&&(i[a]=n[a])},e(t,s)};return function(t,s){e(t,s);function i(){this.constructor=t}t.prototype=s===null?Object.create(s):(i.prototype=s.prototype,new i)}}();Object.defineProperty(wt,"__esModule",{value:true});wt.DetailContext=wt.NoopContext=wt.VError=void 0;var ju=function(e){Fp(t,e);function t(s,i){var n=e.call(this,i)||this;return n.path=s,Object.setPrototypeOf(n,t.prototype),n}return t}(Error);wt.VError=ju;var Up=function(){function e(){}return e.prototype.fail=function(t,s,i){return false},e.prototype.unionResolver=function(){return this},e.prototype.createContext=function(){return this},e.prototype.resolveUnion=function(t){},e}();wt.NoopContext=Up;var $u=function(){function e(){this._propNames=[""],this._messages=[null],this._score=0}return e.prototype.fail=function(t,s,i){return this._propNames.push(t),this._messages.push(s),this._score+=i,false},e.prototype.unionResolver=function(){return new Mp},e.prototype.resolveUnion=function(t){for(var s,i,n=t,a=null,o=0,u=n.contexts;o<u.length;o++){var l=u[o];(!a||l._score>=a._score)&&(a=l)}a&&a._score>0&&((s=this._propNames).push.apply(s,a._propNames),(i=this._messages).push.apply(i,a._messages))},e.prototype.getError=function(t){for(var s=[],i=this._propNames.length-1;i>=0;i--){var n=this._propNames[i];t+=typeof n=="number"?"["+n+"]":n?"."+n:"";var a=this._messages[i];a&&s.push(t+" "+a)}return new ju(t,s.join("; "))},e.prototype.getErrorDetail=function(t){for(var s=[],i=this._propNames.length-1;i>=0;i--){var n=this._propNames[i];t+=typeof n=="number"?"["+n+"]":n?"."+n:"";var a=this._messages[i];a&&s.push({path:t,message:a})}for(var o=null,i=s.length-1;i>=0;i--)o&&(s[i].nested=[o]),o=s[i];return o},e}();wt.DetailContext=$u;var Mp=function(){function e(){this.contexts=[]}return e.prototype.createContext=function(){var t=new $u;return this.contexts.push(t),t},e}();(function(e){var t=os&&os.__extends||function(){var w=function(E,D){return w=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(L,j){L.__proto__=j}||function(L,j){for(var se in j)j.hasOwnProperty(se)&&(L[se]=j[se])},w(E,D)};return function(E,D){w(E,D);function L(){this.constructor=E}E.prototype=D===null?Object.create(D):(L.prototype=D.prototype,new L)}}();Object.defineProperty(e,"__esModule",{value:true}),e.basicTypes=e.BasicType=e.TParamList=e.TParam=e.param=e.TFunc=e.func=e.TProp=e.TOptional=e.opt=e.TIface=e.iface=e.TEnumLiteral=e.enumlit=e.TEnumType=e.enumtype=e.TIntersection=e.intersection=e.TUnion=e.union=e.TTuple=e.tuple=e.TArray=e.array=e.TLiteral=e.lit=e.TName=e.name=e.TType=void 0;var s=wt,i=function(){function w(){}return w}();e.TType=i;function n(w){return typeof w=="string"?o(w):w}function a(w,E){var D=w[E];if(!D)throw new Error("Unknown type "+E);return D}function o(w){return new u(w)}e.name=o;var u=function(w){t(E,w);function E(D){var L=w.call(this)||this;return L.name=D,L._failMsg="is not a "+D,L}return E.prototype.getChecker=function(D,L,j){var se=this,ne=a(D,this.name),de=ne.getChecker(D,L,j);return ne instanceof U||ne instanceof E?de:function(Se,ke){return de(Se,ke)?true:ke.fail(null,se._failMsg,0)}},E}(i);e.TName=u;function l(w){return new h(w)}e.lit=l;var h=function(w){t(E,w);function E(D){var L=w.call(this)||this;return L.value=D,L.name=JSON.stringify(D),L._failMsg="is not "+L.name,L}return E.prototype.getChecker=function(D,L){var j=this;return function(se,ne){return se===j.value?true:ne.fail(null,j._failMsg,-1)}},E}(i);e.TLiteral=h;function d(w){return new m(n(w))}e.array=d;var m=function(w){t(E,w);function E(D){var L=w.call(this)||this;return L.ttype=D,L}return E.prototype.getChecker=function(D,L){var j=this.ttype.getChecker(D,L);return function(se,ne){if(!Array.isArray(se))return ne.fail(null,"is not an array",0);for(var de=0;de<se.length;de++){var Se=j(se[de],ne);if(!Se)return ne.fail(de,null,1)}return true}},E}(i);e.TArray=m;function _(){for(var w=[],E=0;E<arguments.length;E++)w[E]=arguments[E];return new k(w.map(function(D){return n(D)}))}e.tuple=_;var k=function(w){t(E,w);function E(D){var L=w.call(this)||this;return L.ttypes=D,L}return E.prototype.getChecker=function(D,L){var j=this.ttypes.map(function(ne){return ne.getChecker(D,L)}),se=function(ne,de){if(!Array.isArray(ne))return de.fail(null,"is not an array",0);for(var Se=0;Se<j.length;Se++){var ke=j[Se](ne[Se],de);if(!ke)return de.fail(Se,null,1)}return true};return L?function(ne,de){return se(ne,de)?ne.length<=j.length?true:de.fail(j.length,"is extraneous",2):false}:se},E}(i);e.TTuple=k;function T(){for(var w=[],E=0;E<arguments.length;E++)w[E]=arguments[E];return new P(w.map(function(D){return n(D)}))}e.union=T;var P=function(w){t(E,w);function E(D){var L=w.call(this)||this;L.ttypes=D;var j=D.map(function(ne){return ne instanceof u||ne instanceof h?ne.name:null}).filter(function(ne){return ne}),se=D.length-j.length;return j.length?(se>0&&j.push(se+" more"),L._failMsg="is none of "+j.join(", ")):L._failMsg="is none of "+se+" types",L}return E.prototype.getChecker=function(D,L){var j=this,se=this.ttypes.map(function(ne){return ne.getChecker(D,L)});return function(ne,de){for(var Se=de.unionResolver(),ke=0;ke<se.length;ke++){var Fe=se[ke](ne,Se.createContext());if(Fe)return true}return de.resolveUnion(Se),de.fail(null,j._failMsg,0)}},E}(i);e.TUnion=P;function F(){for(var w=[],E=0;E<arguments.length;E++)w[E]=arguments[E];return new B(w.map(function(D){return n(D)}))}e.intersection=F;var B=function(w){t(E,w);function E(D){var L=w.call(this)||this;return L.ttypes=D,L}return E.prototype.getChecker=function(D,L){var j=new Set,se=this.ttypes.map(function(ne){return ne.getChecker(D,L,j)});return function(ne,de){var Se=se.every(function(ke){return ke(ne,de)});return Se?true:de.fail(null,null,0)}},E}(i);e.TIntersection=B;function N(w){return new Y(w)}e.enumtype=N;var Y=function(w){t(E,w);function E(D){var L=w.call(this)||this;return L.members=D,L.validValues=new Set,L._failMsg="is not a valid enum value",L.validValues=new Set(Object.keys(D).map(function(j){return D[j]})),L}return E.prototype.getChecker=function(D,L){var j=this;return function(se,ne){return j.validValues.has(se)?true:ne.fail(null,j._failMsg,0)}},E}(i);e.TEnumType=Y;function q(w,E){return new z(w,E)}e.enumlit=q;var z=function(w){t(E,w);function E(D,L){var j=w.call(this)||this;return j.enumName=D,j.prop=L,j._failMsg="is not "+D+"."+L,j}return E.prototype.getChecker=function(D,L){var j=this,se=a(D,this.enumName);if(!(se instanceof Y))throw new Error("Type "+this.enumName+" used in enumlit is not an enum type");var ne=se.members[this.prop];if(!se.members.hasOwnProperty(this.prop))throw new Error("Unknown value "+this.enumName+"."+this.prop+" used in enumlit");return function(de,Se){return de===ne?true:Se.fail(null,j._failMsg,-1)}},E}(i);e.TEnumLiteral=z;function J(w){return Object.keys(w).map(function(E){return K(E,w[E])})}function K(w,E){return E instanceof b?new v(w,E.ttype,true):new v(w,n(E),false)}function X(w,E){return new re(w,J(E))}e.iface=X;var re=function(w){t(E,w);function E(D,L){var j=w.call(this)||this;return j.bases=D,j.props=L,j.propSet=new Set(L.map(function(se){return se.name})),j}return E.prototype.getChecker=function(D,L,j){var se=this,ne=this.bases.map(function(Ce){return a(D,Ce).getChecker(D,L)}),de=this.props.map(function(Ce){return Ce.ttype.getChecker(D,L)}),Se=new s.NoopContext,ke=this.props.map(function(Ce,Ve){return!Ce.isOpt&&!de[Ve](void 0,Se)}),Fe=function(Ce,Ve){if(typeof Ce!="object"||Ce===null)return Ve.fail(null,"is not an object",0);for(var je=0;je<ne.length;je++)if(!ne[je](Ce,Ve))return false;for(var je=0;je<de.length;je++){var ts=se.props[je].name,ds=Ce[ts];if(ds===void 0){if(ke[je])return Ve.fail(ts,"is missing",1)}else{var Rs=de[je](ds,Ve);if(!Rs)return Ve.fail(ts,null,1)}}return true};if(!L)return Fe;var Xe=this.propSet;return j&&(this.propSet.forEach(function(Ce){return j.add(Ce)}),Xe=j),function(Ce,Ve){if(!Fe(Ce,Ve))return false;for(var je in Ce)if(!Xe.has(je))return Ve.fail(je,"is extraneous",2);return true}},E}(i);e.TIface=re;function x(w){return new b(n(w))}e.opt=x;var b=function(w){t(E,w);function E(D){var L=w.call(this)||this;return L.ttype=D,L}return E.prototype.getChecker=function(D,L){var j=this.ttype.getChecker(D,L);return function(se,ne){return se===void 0||j(se,ne)}},E}(i);e.TOptional=b;var v=function(){function w(E,D,L){this.name=E,this.ttype=D,this.isOpt=L}return w}();e.TProp=v;function V(w){for(var E=[],D=1;D<arguments.length;D++)E[D-1]=arguments[D];return new W(new O(E),n(w))}e.func=V;var W=function(w){t(E,w);function E(D,L){var j=w.call(this)||this;return j.paramList=D,j.result=L,j}return E.prototype.getChecker=function(D,L){return function(j,se){return typeof j=="function"?true:se.fail(null,"is not a function",0)}},E}(i);e.TFunc=W;function M(w,E,D){return new R(w,n(E),!!D)}e.param=M;var R=function(){function w(E,D,L){this.name=E,this.ttype=D,this.isOpt=L}return w}();e.TParam=R;var O=function(w){t(E,w);function E(D){var L=w.call(this)||this;return L.params=D,L}return E.prototype.getChecker=function(D,L){var j=this,se=this.params.map(function(ke){return ke.ttype.getChecker(D,L)}),ne=new s.NoopContext,de=this.params.map(function(ke,Fe){return!ke.isOpt&&!se[Fe](void 0,ne)}),Se=function(ke,Fe){if(!Array.isArray(ke))return Fe.fail(null,"is not an array",0);for(var Xe=0;Xe<se.length;Xe++){var Ce=j.params[Xe];if(ke[Xe]===void 0){if(de[Xe])return Fe.fail(Ce.name,"is missing",1)}else{var Ve=se[Xe](ke[Xe],Fe);if(!Ve)return Fe.fail(Ce.name,null,1)}}return true};return L?function(ke,Fe){return Se(ke,Fe)?ke.length<=se.length?true:Fe.fail(se.length,"is extraneous",2):false}:Se},E}(i);e.TParamList=O;var U=function(w){t(E,w);function E(D,L){var j=w.call(this)||this;return j.validator=D,j.message=L,j}return E.prototype.getChecker=function(D,L){var j=this;return function(se,ne){return j.validator(se)?true:ne.fail(null,j.message,0)}},E}(i);e.BasicType=U,e.basicTypes={any:new U(function(w){return true},"is invalid"),number:new U(function(w){return typeof w=="number"},"is not a number"),object:new U(function(w){return typeof w=="object"&&w},"is not an object"),boolean:new U(function(w){return typeof w=="boolean"},"is not a boolean"),string:new U(function(w){return typeof w=="string"},"is not a string"),symbol:new U(function(w){return typeof w=="symbol"},"is not a symbol"),void:new U(function(w){return w==null},"is not void"),undefined:new U(function(w){return w===void 0},"is not undefined"),null:new U(function(w){return w===null},"is not null"),never:new U(function(w){return false},"is unexpected"),Date:new U(H("[object Date]"),"is not a Date"),RegExp:new U(H("[object RegExp]"),"is not a RegExp")};var I=Object.prototype.toString;function H(w){return function(E){return typeof E=="object"&&E&&I.call(E)===w}}typeof Buffer<"u"&&(e.basicTypes.Buffer=new U(function(w){return Buffer.isBuffer(w)},"is not a Buffer"));for(var G=function(w){e.basicTypes[w.name]=new U(function(E){return E instanceof w},"is not a "+w.name)},te=0,ce=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array,ArrayBuffer];te<ce.length;te++){var oe=ce[te];G(oe)}})(Dn);(function(e){var t=os&&os.__spreadArrays||function(){for(var l=0,h=0,d=arguments.length;h<d;h++)l+=arguments[h].length;for(var m=Array(l),_=0,h=0;h<d;h++)for(var k=arguments[h],T=0,P=k.length;T<P;T++,_++)m[_]=k[T];return m};Object.defineProperty(e,"__esModule",{value:true}),e.Checker=e.createCheckers=void 0;var s=Dn,i=wt,n=Dn;Object.defineProperty(e,"TArray",{enumerable:true,get:function(){return n.TArray}}),Object.defineProperty(e,"TEnumType",{enumerable:true,get:function(){return n.TEnumType}}),Object.defineProperty(e,"TEnumLiteral",{enumerable:true,get:function(){return n.TEnumLiteral}}),Object.defineProperty(e,"TFunc",{enumerable:true,get:function(){return n.TFunc}}),Object.defineProperty(e,"TIface",{enumerable:true,get:function(){return n.TIface}}),Object.defineProperty(e,"TLiteral",{enumerable:true,get:function(){return n.TLiteral}}),Object.defineProperty(e,"TName",{enumerable:true,get:function(){return n.TName}}),Object.defineProperty(e,"TOptional",{enumerable:true,get:function(){return n.TOptional}}),Object.defineProperty(e,"TParam",{enumerable:true,get:function(){return n.TParam}}),Object.defineProperty(e,"TParamList",{enumerable:true,get:function(){return n.TParamList}}),Object.defineProperty(e,"TProp",{enumerable:true,get:function(){return n.TProp}}),Object.defineProperty(e,"TTuple",{enumerable:true,get:function(){return n.TTuple}}),Object.defineProperty(e,"TType",{enumerable:true,get:function(){return n.TType}}),Object.defineProperty(e,"TUnion",{enumerable:true,get:function(){return n.TUnion}}),Object.defineProperty(e,"TIntersection",{enumerable:true,get:function(){return n.TIntersection}}),Object.defineProperty(e,"array",{enumerable:true,get:function(){return n.array}}),Object.defineProperty(e,"enumlit",{enumerable:true,get:function(){return n.enumlit}}),Object.defineProperty(e,"enumtype",{enumerable:true,get:function(){return n.enumtype}}),Object.defineProperty(e,"func",{enumerable:true,get:function(){return n.func}}),Object.defineProperty(e,"iface",{enumerable:true,get:function(){return n.iface}}),Object.defineProperty(e,"lit",{enumerable:true,get:function(){return n.lit}}),Object.defineProperty(e,"name",{enumerable:true,get:function(){return n.name}}),Object.defineProperty(e,"opt",{enumerable:true,get:function(){return n.opt}}),Object.defineProperty(e,"param",{enumerable:true,get:function(){return n.param}}),Object.defineProperty(e,"tuple",{enumerable:true,get:function(){return n.tuple}}),Object.defineProperty(e,"union",{enumerable:true,get:function(){return n.union}}),Object.defineProperty(e,"intersection",{enumerable:true,get:function(){return n.intersection}}),Object.defineProperty(e,"BasicType",{enumerable:true,get:function(){return n.BasicType}});var a=wt;Object.defineProperty(e,"VError",{enumerable:true,get:function(){return a.VError}});function o(){for(var l=[],h=0;h<arguments.length;h++)l[h]=arguments[h];for(var d=Object.assign.apply(Object,t([{},s.basicTypes],l)),m={},_=0,k=l;_<k.length;_++)for(var T=k[_],P=0,F=Object.keys(T);P<F.length;P++){var B=F[P];m[B]=new u(d,T[B])}return m}e.createCheckers=o;var u=function(){function l(h,d,m){if(m===void 0&&(m="value"),this.suite=h,this.ttype=d,this._path=m,this.props=new Map,d instanceof s.TIface)for(var _=0,k=d.props;_<k.length;_++){var T=k[_];this.props.set(T.name,T.ttype)}this.checkerPlain=this.ttype.getChecker(h,false),this.checkerStrict=this.ttype.getChecker(h,true)}return l.prototype.setReportedPath=function(h){this._path=h},l.prototype.check=function(h){return this._doCheck(this.checkerPlain,h)},l.prototype.test=function(h){return this.checkerPlain(h,new i.NoopContext)},l.prototype.validate=function(h){return this._doValidate(this.checkerPlain,h)},l.prototype.strictCheck=function(h){return this._doCheck(this.checkerStrict,h)},l.prototype.strictTest=function(h){return this.checkerStrict(h,new i.NoopContext)},l.prototype.strictValidate=function(h){return this._doValidate(this.checkerStrict,h)},l.prototype.getProp=function(h){var d=this.props.get(h);if(!d)throw new Error("Type has no property "+h);return new l(this.suite,d,this._path+"."+h)},l.prototype.methodArgs=function(h){var d=this._getMethod(h);return new l(this.suite,d.paramList)},l.prototype.methodResult=function(h){var d=this._getMethod(h);return new l(this.suite,d.result)},l.prototype.getArgs=function(){if(!(this.ttype instanceof s.TFunc))throw new Error("getArgs() applied to non-function");return new l(this.suite,this.ttype.paramList)},l.prototype.getResult=function(){if(!(this.ttype instanceof s.TFunc))throw new Error("getResult() applied to non-function");return new l(this.suite,this.ttype.result)},l.prototype.getType=function(){return this.ttype},l.prototype._doCheck=function(h,d){var m=new i.NoopContext;if(!h(d,m)){var _=new i.DetailContext;throw h(d,_),_.getError(this._path)}},l.prototype._doValidate=function(h,d){var m=new i.NoopContext;if(h(d,m))return null;var _=new i.DetailContext;return h(d,_),_.getErrorDetail(this._path)},l.prototype._getMethod=function(h){var d=this.props.get(h);if(!d)throw new Error("Type has no property "+h);if(!(d instanceof s.TFunc))throw new Error("Property "+h+" is not a method");return d},l}();e.Checker=u})(we);const Op=we.union(we.lit("jsx"),we.lit("typescript"),we.lit("flow"),we.lit("imports"),we.lit("react-hot-loader"),we.lit("jest")),Bp=we.iface([],{compiledFilename:"string"}),Vp=we.iface([],{transforms:we.array("Transform"),disableESTransforms:we.opt("boolean"),jsxRuntime:we.opt(we.union(we.lit("classic"),we.lit("automatic"),we.lit("preserve"))),production:we.opt("boolean"),jsxImportSource:we.opt("string"),jsxPragma:we.opt("string"),jsxFragmentPragma:we.opt("string"),keepUnusedImports:we.opt("boolean"),preserveDynamicImport:we.opt("boolean"),injectCreateRequireForImportRequire:we.opt("boolean"),enableLegacyTypeScriptModuleInterop:we.opt("boolean"),enableLegacyBabel5ModuleInterop:we.opt("boolean"),sourceMapOptions:we.opt("SourceMapOptions"),filePath:we.opt("string")}),jp={Transform:Op,SourceMapOptions:Bp,Options:Vp},{Options:$p}=we.createCheckers(jp);function qp(e){$p.strictCheck(e)}function qu(){C(),Oe(false)}function Hu(e){C(),er(e)}function es(e){ae(),ya(e)}function Pi(){ae(),c.tokens[c.tokens.length-1].identifierRole=ie.ImportDeclaration}function ya(e){let t;c.scopeDepth===0?t=ie.TopLevelDeclaration:e?t=ie.BlockScopedDeclaration:t=ie.FunctionScopedDeclaration,c.tokens[c.tokens.length-1].identifierRole=t}function er(e){switch(c.type){case r._this:{const t=pe(0);C(),fe(t);return}case r._yield:case r.name:{c.type=r.name,es(e);return}case r.bracketL:{C(),_a(r.bracketR,e,true);return}case r.braceL:Ra(true,e);return;default:le()}}function _a(e,t,s=false,i=false,n=0){let a=true,o=false;const u=c.tokens.length;for(;!S(e)&&!c.error;)if(a?a=false:(A(r.comma),c.tokens[c.tokens.length-1].contextId=n,!o&&c.tokens[u].isType&&(c.tokens[c.tokens.length-1].isType=true,o=true)),!(s&&p(r.comma))){if(S(e))break;if(p(r.ellipsis)){Hu(t),Wu(),S(r.comma),A(e);break}else Hp(i,t)}}function Hp(e,t){e&&xa([g._public,g._protected,g._private,g._readonly,g._override]),Li(t),Wu(),Li(t,true)}function Wu(){_e?c0():me&&Qd()}function Li(e,t=false){if(t||er(e),!S(r.eq))return;const s=c.tokens.length-1;Oe(),c.tokens[s].rhsEndIndex=c.tokens.length}function Nn(){return p(r.name)}function Wp(){return p(r.name)||!!(c.type&r.IS_KEYWORD)||p(r.string)||p(r.num)||p(r.bigint)||p(r.decimal)}function Gu(){const e=c.snapshot();return C(),(p(r.bracketL)||p(r.braceL)||p(r.star)||p(r.ellipsis)||p(r.hash)||Wp())&&!We()?true:(c.restoreFromSnapshot(e),false)}function xa(e){for(;Xu(e)!==null;);}function Xu(e){if(!p(r.name))return null;const t=c.contextualKeyword;if(e.indexOf(t)!==-1&&Gu()){switch(t){case g._readonly:c.tokens[c.tokens.length-1].type=r._readonly;break;case g._abstract:c.tokens[c.tokens.length-1].type=r._abstract;break;case g._static:c.tokens[c.tokens.length-1].type=r._static;break;case g._public:c.tokens[c.tokens.length-1].type=r._public;break;case g._private:c.tokens[c.tokens.length-1].type=r._private;break;case g._protected:c.tokens[c.tokens.length-1].type=r._protected;break;case g._override:c.tokens[c.tokens.length-1].type=r._override;break;case g._declare:c.tokens[c.tokens.length-1].type=r._declare;break}return t}return null}function ni(){for(ae();S(r.dot);)ae()}function Gp(){ni(),!We()&&p(r.lessThan)&&Is()}function Xp(){C(),ai()}function Yp(){C()}function zp(){A(r._typeof),p(r._import)?Yu():ni(),!We()&&p(r.lessThan)&&Is()}function Yu(){A(r._import),A(r.parenL),A(r.string),A(r.parenR),S(r.dot)&&ni(),p(r.lessThan)&&Is()}function Kp(){S(r._const);const e=S(r._in),t=Le(g._out);S(r._const),(e||t)&&!p(r.name)?c.tokens[c.tokens.length-1].type=r.name:ae(),S(r._extends)&&Ie(),S(r.eq)&&Ie()}function fs(){p(r.lessThan)&&tr()}function tr(){const e=pe(0);for(p(r.lessThan)||p(r.typeParameterStart)?C():le();!S(r.greaterThan)&&!c.error;)Kp(),S(r.comma);fe(e)}function va(e){const t=e===r.arrow;fs(),A(r.parenL),c.scopeDepth++,Zp(false),c.scopeDepth--,(t||p(e))&&zs(e)}function Zp(e){_a(r.parenR,e)}function Di(){S(r.comma)||Ee()}function Fo(){va(r.colon),Di()}function Qp(){const e=c.snapshot();C();const t=S(r.name)&&p(r.colon);return c.restoreFromSnapshot(e),t}function zu(){if(!(p(r.bracketL)&&Qp()))return false;const e=pe(0);return A(r.bracketL),ae(),ai(),A(r.bracketR),As(),Di(),fe(e),true}function Uo(e){S(r.question),!e&&(p(r.parenL)||p(r.lessThan))?(va(r.colon),Di()):(As(),Di())}function Jp(){if(p(r.parenL)||p(r.lessThan)){Fo();return}if(p(r._new)){C(),p(r.parenL)||p(r.lessThan)?Fo():Uo(false);return}const e=!!Xu([g._readonly]);zu()||((ee(g._get)||ee(g._set))&&Gu(),Ks(-1),Uo(e))}function ed(){Ku()}function Ku(){for(A(r.braceL);!S(r.braceR)&&!c.error;)Jp()}function td(){const e=c.snapshot(),t=sd();return c.restoreFromSnapshot(e),t}function sd(){return C(),S(r.plus)||S(r.minus)?ee(g._readonly):(ee(g._readonly)&&C(),!p(r.bracketL)||(C(),!Nn())?false:(C(),p(r._in)))}function id(){ae(),A(r._in),Ie()}function rd(){A(r.braceL),p(r.plus)||p(r.minus)?(C(),Re(g._readonly)):Le(g._readonly),A(r.bracketL),id(),Le(g._as)&&Ie(),A(r.bracketR),p(r.plus)||p(r.minus)?(C(),A(r.question)):S(r.question),yd(),Ee(),A(r.braceR)}function nd(){for(A(r.bracketL);!S(r.bracketR)&&!c.error;)ad(),S(r.comma)}function ad(){S(r.ellipsis)?Ie():(Ie(),S(r.question)),S(r.colon)&&Ie()}function od(){A(r.parenL),Ie(),A(r.parenR)}function cd(){for(Xt(),Xt();!p(r.backQuote)&&!c.error;)A(r.dollarBraceL),Ie(),Xt(),Xt();C()}var Yt;(function(e){e[e.TSFunctionType=0]="TSFunctionType";const s=1;e[e.TSConstructorType=s]="TSConstructorType";const i=s+1;e[e.TSAbstractConstructorType=i]="TSAbstractConstructorType"})(Yt||(Yt={}));function mn(e){e===Yt.TSAbstractConstructorType&&Re(g._abstract),(e===Yt.TSConstructorType||e===Yt.TSAbstractConstructorType)&&A(r._new);const t=c.inDisallowConditionalTypesContext;c.inDisallowConditionalTypesContext=false,va(r.arrow),c.inDisallowConditionalTypesContext=t}function ud(){switch(c.type){case r.name:Gp();return;case r._void:case r._null:C();return;case r.string:case r.num:case r.bigint:case r.decimal:case r._true:case r._false:ks();return;case r.minus:C(),ks();return;case r._this:{Yp(),ee(g._is)&&!We()&&Xp();return}case r._typeof:zp();return;case r._import:Yu();return;case r.braceL:td()?rd():ed();return;case r.bracketL:nd();return;case r.parenL:od();return;case r.backQuote:cd();return;default:if(c.type&r.IS_KEYWORD){C(),c.tokens[c.tokens.length-1].type=r.name;return}break}le()}function ld(){for(ud();!We()&&S(r.bracketL);)S(r.bracketR)||(Ie(),A(r.bracketR))}function hd(){if(Re(g._infer),ae(),p(r._extends)){const e=c.snapshot();A(r._extends);const t=c.inDisallowConditionalTypesContext;c.inDisallowConditionalTypesContext=true,Ie(),c.inDisallowConditionalTypesContext=t,(c.error||!c.inDisallowConditionalTypesContext&&p(r.question))&&c.restoreFromSnapshot(e)}}function Fn(){if(ee(g._keyof)||ee(g._unique)||ee(g._readonly))C(),Fn();else if(ee(g._infer))hd();else{const e=c.inDisallowConditionalTypesContext;c.inDisallowConditionalTypesContext=false,ld(),c.inDisallowConditionalTypesContext=e}}function Mo(){if(S(r.bitwiseAND),Fn(),p(r.bitwiseAND))for(;S(r.bitwiseAND);)Fn()}function fd(){if(S(r.bitwiseOR),Mo(),p(r.bitwiseOR))for(;S(r.bitwiseOR);)Mo()}function pd(){return p(r.lessThan)?true:p(r.parenL)&&md()}function dd(){if(p(r.name)||p(r._this))return C(),true;if(p(r.braceL)||p(r.bracketL)){let e=1;for(C();e>0&&!c.error;)p(r.braceL)||p(r.bracketL)?e++:(p(r.braceR)||p(r.bracketR))&&e--,C();return true}return false}function md(){const e=c.snapshot(),t=gd();return c.restoreFromSnapshot(e),t}function gd(){return C(),!!(p(r.parenR)||p(r.ellipsis)||dd()&&(p(r.colon)||p(r.comma)||p(r.question)||p(r.eq)||p(r.parenR)&&(C(),p(r.arrow))))}function zs(e){const t=pe(0);A(e),_d()||Ie(),fe(t)}function bd(){p(r.colon)&&zs(r.colon)}function As(){p(r.colon)&&ai()}function yd(){S(r.colon)&&Ie()}function _d(){const e=c.snapshot();return ee(g._asserts)?(C(),Le(g._is)?(Ie(),true):Nn()||p(r._this)?(C(),Le(g._is)&&Ie(),true):(c.restoreFromSnapshot(e),false)):Nn()||p(r._this)?(C(),ee(g._is)&&!We()?(C(),Ie(),true):(c.restoreFromSnapshot(e),false)):false}function ai(){const e=pe(0);A(r.colon),Ie(),fe(e)}function Ie(){if(Oo(),c.inDisallowConditionalTypesContext||We()||!S(r._extends))return;const e=c.inDisallowConditionalTypesContext;c.inDisallowConditionalTypesContext=true,Oo(),c.inDisallowConditionalTypesContext=e,A(r.question),Ie(),A(r.colon),Ie()}function xd(){return ee(g._abstract)&&Ae()===r._new}function Oo(){if(pd()){mn(Yt.TSFunctionType);return}if(p(r._new)){mn(Yt.TSConstructorType);return}else if(xd()){mn(Yt.TSAbstractConstructorType);return}fd()}function vd(){const e=pe(1);Ie(),A(r.greaterThan),fe(e),oi()}function kd(){if(S(r.jsxTagStart)){c.tokens[c.tokens.length-1].type=r.typeParameterStart;const e=pe(1);for(;!p(r.greaterThan)&&!c.error;)Ie(),S(r.comma);at(),fe(e)}}function Zu(){for(;!p(r.braceL)&&!c.error;)wd(),S(r.comma)}function wd(){ni(),p(r.lessThan)&&Is()}function Sd(){es(false),fs(),S(r._extends)&&Zu(),Ku()}function Ed(){es(false),fs(),A(r.eq),Ie(),Ee()}function Td(){if(p(r.string)?ks():ae(),S(r.eq)){const e=c.tokens.length-1;Oe(),c.tokens[e].rhsEndIndex=c.tokens.length}}function ka(){for(es(false),A(r.braceL);!S(r.braceR)&&!c.error;)Td(),S(r.comma)}function wa(){A(r.braceL),nr(r.braceR)}function Un(){es(false),S(r.dot)?Un():wa()}function Qu(){ee(g._global)?ae():p(r.string)?Bt():le(),p(r.braceL)?wa():Ee()}function Mn(){Pi(),A(r.eq),Id(),Ee()}function Ad(){return ee(g._require)&&Ae()===r.parenL}function Id(){Ad()?Cd():ni()}function Cd(){Re(g._require),A(r.parenL),p(r.string)||le(),ks(),A(r.parenR)}function Rd(){if(vt())return false;switch(c.type){case r._function:{const e=pe(1);C();const t=c.start;return us(t,true),fe(e),true}case r._class:{const e=pe(1);return ls(true,false),fe(e),true}case r._const:if(p(r._const)&&ma(g._enum)){const e=pe(1);return A(r._const),Re(g._enum),c.tokens[c.tokens.length-1].type=r._enum,ka(),fe(e),true}case r._var:case r._let:{const e=pe(1);return bi(c.type!==r._var),fe(e),true}case r.name:{const e=pe(1),t=c.contextualKeyword;let s=false;return t===g._global?(Qu(),s=true):s=sr(t,true),fe(e),s}default:return false}}function Bo(){return sr(c.contextualKeyword,true)}function Pd(e){switch(e){case g._declare:{const t=c.tokens.length-1;if(Rd())return c.tokens[t].type=r._declare,true;break}case g._global:if(p(r.braceL))return wa(),true;break;default:return sr(e,false)}return false}function sr(e,t){switch(e){case g._abstract:if(ms(t)&&p(r._class))return c.tokens[c.tokens.length-1].type=r._abstract,ls(true,false),true;break;case g._enum:if(ms(t)&&p(r.name))return c.tokens[c.tokens.length-1].type=r._enum,ka(),true;break;case g._interface:if(ms(t)&&p(r.name)){const s=pe(t?2:1);return Sd(),fe(s),true}break;case g._module:if(ms(t)){if(p(r.string)){const s=pe(t?2:1);return Qu(),fe(s),true}else if(p(r.name)){const s=pe(t?2:1);return Un(),fe(s),true}}break;case g._namespace:if(ms(t)&&p(r.name)){const s=pe(t?2:1);return Un(),fe(s),true}break;case g._type:if(ms(t)&&p(r.name)){const s=pe(t?2:1);return Ed(),fe(s),true}break}return false}function ms(e){return e?(C(),true):!vt()}function Ld(){const e=c.snapshot();return tr(),Cs(),bd(),A(r.arrow),c.error?(c.restoreFromSnapshot(e),false):(ci(true),true)}function Sa(){c.type===r.bitShiftL&&(c.pos-=1,ue(r.lessThan)),Is()}function Is(){const e=pe(0);for(A(r.lessThan);!p(r.greaterThan)&&!c.error;)Ie(),S(r.comma);e?(A(r.greaterThan),fe(e)):(fe(e),Lu(),A(r.greaterThan),c.tokens[c.tokens.length-1].isType=true)}function Ju(){if(p(r.name))switch(c.contextualKeyword){case g._abstract:case g._declare:case g._enum:case g._interface:case g._module:case g._namespace:case g._type:return true}return false}function Dd(e,t){if(p(r.colon)&&zs(r.colon),!p(r.braceL)&&vt()){let s=c.tokens.length-1;for(;s>=0&&(c.tokens[s].start>=e||c.tokens[s].type===r._default||c.tokens[s].type===r._export);)c.tokens[s].isType=true,s--;return}ci(false,t)}function Nd(e,t,s){if(!We()&&S(r.bang)){c.tokens[c.tokens.length-1].type=r.nonNullAssertion;return}if(p(r.lessThan)||p(r.bitShiftL)){const i=c.snapshot();if(!t&&ol()&&Ld())return;if(Sa(),!t&&S(r.parenL)?(c.tokens[c.tokens.length-1].subscriptStartIndex=e,zt()):p(r.backQuote)?Ca():(c.type===r.greaterThan||c.type!==r.parenL&&c.type&r.IS_EXPRESSION_START&&!We())&&le(),c.error)c.restoreFromSnapshot(i);else return}else!t&&p(r.questionDot)&&Ae()===r.lessThan&&(C(),c.tokens[e].isOptionalChainStart=true,c.tokens[c.tokens.length-1].subscriptStartIndex=e,Is(),A(r.parenL),zt());Ta(e,t,s)}function Fd(){if(S(r._import))return ee(g._type)&&Ae()!==r.eq&&Re(g._type),Mn(),true;if(S(r.eq))return Me(),Ee(),true;if(Le(g._as))return Re(g._namespace),ae(),Ee(),true;if(ee(g._type)){const e=Ae();(e===r.braceL||e===r.star)&&C()}return false}function Ud(){if(ae(),p(r.comma)||p(r.braceR)){c.tokens[c.tokens.length-1].identifierRole=ie.ImportDeclaration;return}if(ae(),p(r.comma)||p(r.braceR)){c.tokens[c.tokens.length-1].identifierRole=ie.ImportDeclaration,c.tokens[c.tokens.length-2].isType=true,c.tokens[c.tokens.length-1].isType=true;return}if(ae(),p(r.comma)||p(r.braceR)){c.tokens[c.tokens.length-3].identifierRole=ie.ImportAccess,c.tokens[c.tokens.length-1].identifierRole=ie.ImportDeclaration;return}ae(),c.tokens[c.tokens.length-3].identifierRole=ie.ImportAccess,c.tokens[c.tokens.length-1].identifierRole=ie.ImportDeclaration,c.tokens[c.tokens.length-4].isType=true,c.tokens[c.tokens.length-3].isType=true,c.tokens[c.tokens.length-2].isType=true,c.tokens[c.tokens.length-1].isType=true}function Md(){if(ae(),p(r.comma)||p(r.braceR)){c.tokens[c.tokens.length-1].identifierRole=ie.ExportAccess;return}if(ae(),p(r.comma)||p(r.braceR)){c.tokens[c.tokens.length-1].identifierRole=ie.ExportAccess,c.tokens[c.tokens.length-2].isType=true,c.tokens[c.tokens.length-1].isType=true;return}if(ae(),p(r.comma)||p(r.braceR)){c.tokens[c.tokens.length-3].identifierRole=ie.ExportAccess;return}ae(),c.tokens[c.tokens.length-3].identifierRole=ie.ExportAccess,c.tokens[c.tokens.length-4].isType=true,c.tokens[c.tokens.length-3].isType=true,c.tokens[c.tokens.length-2].isType=true,c.tokens[c.tokens.length-1].isType=true}function Od(){if(ee(g._abstract)&&Ae()===r._class)return c.type=r._abstract,C(),ls(true,true),true;if(ee(g._interface)){const e=pe(2);return sr(g._interface,true),fe(e),true}return false}function Bd(){if(c.type===r._const){const e=ri();if(e.type===r.name&&e.contextualKeyword===g._enum)return A(r._const),Re(g._enum),c.tokens[c.tokens.length-1].type=r._enum,ka(),true}return false}function Vd(e){const t=c.tokens.length;xa([g._abstract,g._readonly,g._declare,g._static,g._override]);const s=c.tokens.length;if(zu()){const n=e?t-1:t;for(let a=n;a<s;a++)c.tokens[a].isType=true;return true}return false}function jd(e){Pd(e)||Ee()}function $d(){const e=Le(g._declare);e&&(c.tokens[c.tokens.length-1].type=r._declare);let t=false;if(p(r.name))if(e){const s=pe(2);t=Bo(),fe(s)}else t=Bo();if(!t)if(e){const s=pe(2);st(true),fe(s)}else st(true)}function qd(e){if(e&&(p(r.lessThan)||p(r.bitShiftL))&&Sa(),Le(g._implements)){c.tokens[c.tokens.length-1].type=r._implements;const t=pe(1);Zu(),fe(t)}}function Hd(){fs()}function Wd(){fs()}function Gd(){const e=pe(0);We()||S(r.bang),As(),fe(e)}function Xd(){p(r.colon)&&ai()}function Yd(e,t){return Qi?zd(e,t):Kd(e,t)}function zd(e,t){if(!p(r.lessThan))return St(e,t);const s=c.snapshot();let i=St(e,t);if(c.error)c.restoreFromSnapshot(s);else return i;return c.type=r.typeParameterStart,tr(),i=St(e,t),i||le(),i}function Kd(e,t){if(!p(r.lessThan))return St(e,t);const s=c.snapshot();tr();const i=St(e,t);if(i||le(),c.error)c.restoreFromSnapshot(s);else return i;return St(e,t)}function Zd(){if(p(r.colon)){const e=c.snapshot();zs(r.colon),tt()&&le(),p(r.arrow)||le(),c.error&&c.restoreFromSnapshot(e)}return S(r.arrow)}function Qd(){const e=pe(0);S(r.question),As(),fe(e)}function Jd(){(p(r.lessThan)||p(r.bitShiftL))&&Sa(),_l()}function em(){let e=false,t=false;for(;;){if(c.pos>=$.length){le("Unterminated JSX contents");return}const s=$.charCodeAt(c.pos);if(s===y.lessThan||s===y.leftCurlyBrace){if(c.pos===c.start){if(s===y.lessThan){c.pos++,ue(r.jsxTagStart);return}Du(s);return}ue(e&&!t?r.jsxEmptyText:r.jsxText);return}s===y.lineFeed?e=true:s!==y.space&&s!==y.carriageReturn&&s!==y.tab&&(t=true),c.pos++}}function tm(e){for(c.pos++;;){if(c.pos>=$.length){le("Unterminated string constant");return}if($.charCodeAt(c.pos)===e){c.pos++;break}c.pos++}ue(r.string)}function sm(){let e;do{if(c.pos>$.length){le("Unexpectedly reached the end of input.");return}e=$.charCodeAt(++c.pos)}while(mt[e]||e===y.dash);ue(r.jsxName)}function On(){at()}function el(e){if(On(),!S(r.colon)){c.tokens[c.tokens.length-1].identifierRole=e;return}On()}function tl(){const e=c.tokens.length;el(ie.Access);let t=false;for(;p(r.dot);)t=true,at(),On();if(!t){const s=c.tokens[e],i=$.charCodeAt(s.start);i>=y.lowercaseA&&i<=y.lowercaseZ&&(s.identifierRole=null)}}function im(){switch(c.type){case r.braceL:C(),Me(),at();return;case r.jsxTagStart:il(),at();return;case r.string:at();return;default:le("JSX value should be either an expression or a quoted JSX text")}}function rm(){A(r.ellipsis),Me()}function nm(e){if(p(r.jsxTagEnd))return false;tl(),me&&kd();let t=false;for(;!p(r.slash)&&!p(r.jsxTagEnd)&&!c.error;){if(S(r.braceL)){t=true,A(r.ellipsis),Oe(),at();continue}t&&c.end-c.start===3&&$.charCodeAt(c.start)===y.lowercaseK&&$.charCodeAt(c.start+1)===y.lowercaseE&&$.charCodeAt(c.start+2)===y.lowercaseY&&(c.tokens[e].jsxRole=ft.KeyAfterPropSpread),el(ie.ObjectKey),p(r.eq)&&(at(),im())}const s=p(r.slash);return s&&at(),s}function am(){p(r.jsxTagEnd)||tl()}function sl(){const e=c.tokens.length-1;c.tokens[e].jsxRole=ft.NoChildren;let t=0;if(!nm(e))for(gs();;)switch(c.type){case r.jsxTagStart:if(at(),p(r.slash)){at(),am(),c.tokens[e].jsxRole!==ft.KeyAfterPropSpread&&(t===1?c.tokens[e].jsxRole=ft.OneChild:t>1&&(c.tokens[e].jsxRole=ft.StaticChildren));return}t++,sl(),gs();break;case r.jsxText:t++,gs();break;case r.jsxEmptyText:gs();break;case r.braceL:C(),p(r.ellipsis)?(rm(),gs(),t+=2):(p(r.braceR)||(t++,Me()),gs());break;default:le();return}}function il(){at(),sl()}function at(){c.tokens.push(new Ji),Ru(),c.start=c.pos;const e=$.charCodeAt(c.pos);if(ii[e])sm();else if(e===y.quotationMark||e===y.apostrophe)tm(e);else switch(++c.pos,e){case y.greaterThan:ue(r.jsxTagEnd);break;case y.lessThan:ue(r.jsxTagStart);break;case y.slash:ue(r.slash);break;case y.equalsTo:ue(r.eq);break;case y.leftCurlyBrace:ue(r.braceL);break;case y.dot:ue(r.dot);break;case y.colon:ue(r.colon);break;default:le()}}function gs(){c.tokens.push(new Ji),c.start=c.pos,em()}function om(e){if(p(r.question)){const t=Ae();if(t===r.colon||t===r.comma||t===r.parenR)return}rl(e)}function cm(){Eu(r.question),p(r.colon)&&(me?ai():_e&&ps())}class um{constructor(t){this.stop=t}}function Me(e=false){if(Oe(e),p(r.comma))for(;S(r.comma);)Oe(e)}function Oe(e=false,t=false){return me?Yd(e,t):_e?d0(e,t):St(e,t)}function St(e,t){if(p(r._yield))return Em(),false;(p(r.parenL)||p(r.name)||p(r._yield))&&(c.potentialArrowAt=c.start);const s=lm(e);return t&&Ia(),c.type&r.IS_ASSIGN?(C(),Oe(e),false):s}function lm(e){return fm(e)?true:(hm(e),false)}function hm(e){me||_e?om(e):rl(e)}function rl(e){S(r.question)&&(Oe(),A(r.colon),Oe(e))}function fm(e){const t=c.tokens.length;return oi()?true:(mi(t,-1,e),false)}function mi(e,t,s){if(me&&(r._in&r.PRECEDENCE_MASK)>t&&!We()&&(Le(g._as)||Le(g._satisfies))){const n=pe(1);Ie(),fe(n),Lu(),mi(e,t,s);return}const i=c.type&r.PRECEDENCE_MASK;if(i>0&&(!s||!p(r._in))&&i>t){const n=c.type;C(),n===r.nullishCoalescing&&(c.tokens[c.tokens.length-1].nullishStartIndex=e);const a=c.tokens.length;oi(),mi(a,n&r.IS_RIGHT_ASSOCIATIVE?i-1:i,s),n===r.nullishCoalescing&&(c.tokens[e].numNullishCoalesceStarts++,c.tokens[c.tokens.length-1].numNullishCoalesceEnds++),mi(e,t,s)}}function oi(){if(me&&!Qi&&S(r.lessThan))return vd(),false;if(ee(g._module)&&Au()===y.leftCurlyBrace&&!xu())return Tm(),false;if(c.type&r.IS_PREFIX)return C(),oi(),false;if(nl())return true;for(;c.type&r.IS_POSTFIX&&!tt();)c.type===r.preIncDec&&(c.type=r.postIncDec),C();return false}function nl(){const e=c.tokens.length;return Bt()?true:(Ea(e),c.tokens.length>e&&c.tokens[e].isOptionalChainStart&&(c.tokens[c.tokens.length-1].isOptionalChainEnd=true),false)}function Ea(e,t=false){_e?g0(e,t):al(e,t)}function al(e,t=false){const s=new um(false);do pm(e,t,s);while(!s.stop&&!c.error)}function pm(e,t,s){me?Nd(e,t,s):_e?Km(e,t,s):Ta(e,t,s)}function Ta(e,t,s){if(!t&&S(r.doubleColon))Aa(),s.stop=true,Ea(e,t);else if(p(r.questionDot)){if(c.tokens[e].isOptionalChainStart=true,t&&Ae()===r.parenL){s.stop=true;return}C(),c.tokens[c.tokens.length-1].subscriptStartIndex=e,S(r.bracketL)?(Me(),A(r.bracketR)):S(r.parenL)?zt():Ni()}else if(S(r.dot))c.tokens[c.tokens.length-1].subscriptStartIndex=e,Ni();else if(S(r.bracketL))c.tokens[c.tokens.length-1].subscriptStartIndex=e,Me(),A(r.bracketR);else if(!t&&p(r.parenL))if(ol()){const i=c.snapshot(),n=c.tokens.length;C(),c.tokens[c.tokens.length-1].subscriptStartIndex=e;const a=Xs();c.tokens[c.tokens.length-1].contextId=a,zt(),c.tokens[c.tokens.length-1].contextId=a,dm()&&(c.restoreFromSnapshot(i),s.stop=true,c.scopeDepth++,Cs(),mm(n))}else{C(),c.tokens[c.tokens.length-1].subscriptStartIndex=e;const i=Xs();c.tokens[c.tokens.length-1].contextId=i,zt(),c.tokens[c.tokens.length-1].contextId=i}else p(r.backQuote)?Ca():s.stop=true}function ol(){return c.tokens[c.tokens.length-1].contextualKeyword===g._async&&!tt()}function zt(){let e=true;for(;!S(r.parenR)&&!c.error;){if(e)e=false;else if(A(r.comma),S(r.parenR))break;hl(false)}}function dm(){return p(r.colon)||p(r.arrow)}function mm(e){me?Xd():_e&&p0(),A(r.arrow),Zs(e)}function Aa(){const e=c.tokens.length;Bt(),Ea(e,true)}function Bt(){if(S(r.modulo))return ae(),false;if(p(r.jsxText)||p(r.jsxEmptyText))return ks(),false;if(p(r.lessThan)&&Qi)return c.type=r.jsxTagStart,il(),C(),false;const e=c.potentialArrowAt===c.start;switch(c.type){case r.slash:case r.assign:Of();case r._super:case r._this:case r.regexp:case r.num:case r.bigint:case r.decimal:case r.string:case r._null:case r._true:case r._false:return C(),false;case r._import:return C(),p(r.dot)&&(c.tokens[c.tokens.length-1].type=r.name,C(),ae()),false;case r.name:{const t=c.tokens.length,s=c.start,i=c.contextualKeyword;return ae(),i===g._await?(Sm(),false):i===g._async&&p(r._function)&&!tt()?(C(),us(s,false),false):e&&i===g._async&&!tt()&&p(r.name)?(c.scopeDepth++,es(false),A(r.arrow),Zs(t),true):p(r._do)&&!tt()?(C(),Kt(),false):e&&!tt()&&p(r.arrow)?(c.scopeDepth++,ya(false),A(r.arrow),Zs(t),true):(c.tokens[c.tokens.length-1].identifierRole=ie.Access,false)}case r._do:return C(),Kt(),false;case r.parenL:return cl(e);case r.bracketL:return C(),ll(r.bracketR,true),false;case r.braceL:return Ra(false,false),false;case r._function:return gm(),false;case r.at:Ba();case r._class:return ls(false),false;case r._new:return ym(),false;case r.backQuote:return Ca(),false;case r.doubleColon:return C(),Aa(),false;case r.hash:{const t=Au();return ii[t]||t===y.backslash?Ni():C(),false}default:return le(),false}}function Ni(){S(r.hash),ae()}function gm(){const e=c.start;ae(),S(r.dot)&&ae(),us(e,false)}function ks(){C()}function ir(){A(r.parenL),Me(),A(r.parenR)}function cl(e){const t=c.snapshot(),s=c.tokens.length;A(r.parenL);let i=true;for(;!p(r.parenR)&&!c.error;){if(i)i=false;else if(A(r.comma),p(r.parenR))break;if(p(r.ellipsis)){Hu(false),Ia();break}else Oe(false,true)}return A(r.parenR),e&&bm()&&Bn()?(c.restoreFromSnapshot(t),c.scopeDepth++,Cs(),Bn(),Zs(s),c.error?(c.restoreFromSnapshot(t),cl(false),false):true):false}function bm(){return p(r.colon)||!tt()}function Bn(){return me?Zd():_e?m0():S(r.arrow)}function Ia(){(me||_e)&&cm()}function ym(){if(A(r._new),S(r.dot)){ae();return}_m(),_e&&Zm(),S(r.parenL)&&ll(r.parenR)}function _m(){Aa(),S(r.questionDot)}function Ca(){for(Xt(),Xt();!p(r.backQuote)&&!c.error;)A(r.dollarBraceL),Me(),Xt(),Xt();C()}function Ra(e,t){const s=Xs();let i=true;for(C(),c.tokens[c.tokens.length-1].contextId=s;!S(r.braceR)&&!c.error;){if(i)i=false;else if(A(r.comma),S(r.braceR))break;let n=false;if(p(r.ellipsis)){const a=c.tokens.length;if(qu(),e&&(c.tokens.length===a+2&&ya(t),S(r.braceR)))break;continue}e||(n=S(r.star)),!e&&ee(g._async)?(n&&le(),ae(),p(r.colon)||p(r.parenL)||p(r.braceR)||p(r.eq)||p(r.comma)||(p(r.star)&&(C(),n=true),Ks(s))):Ks(s),wm(e,t,s)}c.tokens[c.tokens.length-1].contextId=s}function xm(e){return!e&&(p(r.string)||p(r.num)||p(r.bracketL)||p(r.name)||!!(c.type&r.IS_KEYWORD))}function vm(e,t){const s=c.start;return p(r.parenL)?(e&&le(),Vn(s,false),true):xm(e)?(Ks(t),Vn(s,false),true):false}function km(e,t){if(S(r.colon)){e?Li(t):Oe(false);return}let s;e?c.scopeDepth===0?s=ie.ObjectShorthandTopLevelDeclaration:t?s=ie.ObjectShorthandBlockScopedDeclaration:s=ie.ObjectShorthandFunctionScopedDeclaration:s=ie.ObjectShorthand,c.tokens[c.tokens.length-1].identifierRole=s,Li(t,true)}function wm(e,t,s){me?Hd():_e&&o0(),vm(e,s)||km(e,t)}function Ks(e){_e&&Oa(),S(r.bracketL)?(c.tokens[c.tokens.length-1].contextId=e,Oe(),A(r.bracketR),c.tokens[c.tokens.length-1].contextId=e):(p(r.num)||p(r.string)||p(r.bigint)||p(r.decimal)?Bt():Ni(),c.tokens[c.tokens.length-1].identifierRole=ie.ObjectKey,c.tokens[c.tokens.length-1].contextId=e)}function Vn(e,t){const s=Xs();c.scopeDepth++;const i=c.tokens.length;Cs(t,s),ul(e,s);const a=c.tokens.length;c.scopes.push(new At(i,a,true)),c.scopeDepth--}function Zs(e){ci(true);const t=c.tokens.length;c.scopes.push(new At(e,t,true)),c.scopeDepth--}function ul(e,t=0){me?Dd(e,t):_e?zm(t):ci(false,t)}function ci(e,t=0){e&&!p(r.braceL)?Oe():Kt(true,t)}function ll(e,t=false){let s=true;for(;!S(e)&&!c.error;){if(s)s=false;else if(A(r.comma),S(e))break;hl(t)}}function hl(e){e&&p(r.comma)||(p(r.ellipsis)?(qu(),Ia()):p(r.question)?C():Oe(false,true))}function ae(){C(),c.tokens[c.tokens.length-1].type=r.name}function Sm(){oi()}function Em(){C(),!p(r.semi)&&!tt()&&(S(r.star),Oe())}function Tm(){Re(g._module),A(r.braceL),nr(r.braceR)}function Am(e){return(e.type===r.name||!!(e.type&r.IS_KEYWORD))&&e.contextualKeyword!==g._from}function It(e){const t=pe(0);A(e||r.colon),Qe(),fe(t)}function Vo(){A(r.modulo),Re(g._checks),S(r.parenL)&&(Me(),A(r.parenR))}function Pa(){const e=pe(0);A(r.colon),p(r.modulo)?Vo():(Qe(),p(r.modulo)&&Vo()),fe(e)}function Im(){C(),La(true)}function Cm(){C(),ae(),p(r.lessThan)&&bt(),A(r.parenL),$n(),A(r.parenR),Pa(),Ee()}function jn(){p(r._class)?Im():p(r._function)?Cm():p(r._var)?Rm():Le(g._module)?S(r.dot)?Dm():Pm():ee(g._type)?Nm():ee(g._opaque)?Fm():ee(g._interface)?Um():p(r._export)?Lm():le()}function Rm(){C(),ml(),Ee()}function Pm(){for(p(r.string)?Bt():ae(),A(r.braceL);!p(r.braceR)&&!c.error;)p(r._import)?(C(),El()):le();A(r.braceR)}function Lm(){A(r._export),S(r._default)?p(r._function)||p(r._class)?jn():(Qe(),Ee()):p(r._var)||p(r._function)||p(r._class)||ee(g._opaque)?jn():p(r.star)||p(r.braceL)||ee(g._interface)||ee(g._type)||ee(g._opaque)?wl():le()}function Dm(){Re(g._exports),ps(),Ee()}function Nm(){C(),Na()}function Fm(){C(),Fa(true)}function Um(){C(),La()}function La(e=false){if(rr(),p(r.lessThan)&&bt(),S(r._extends))do gi();while(!e&&S(r.comma));if(ee(g._mixins)){C();do gi();while(S(r.comma))}if(ee(g._implements)){C();do gi();while(S(r.comma))}Fi(e,false,e)}function gi(){fl(false),p(r.lessThan)&&cs()}function Da(){La()}function rr(){ae()}function Na(){rr(),p(r.lessThan)&&bt(),It(r.eq),Ee()}function Fa(e){Re(g._type),rr(),p(r.lessThan)&&bt(),p(r.colon)&&It(r.colon),e||It(r.eq),Ee()}function Mm(){Oa(),ml(),S(r.eq)&&Qe()}function bt(){const e=pe(0);p(r.lessThan)||p(r.typeParameterStart)?C():le();do Mm(),p(r.greaterThan)||A(r.comma);while(!p(r.greaterThan)&&!c.error);A(r.greaterThan),fe(e)}function cs(){const e=pe(0);for(A(r.lessThan);!p(r.greaterThan)&&!c.error;)Qe(),p(r.greaterThan)||A(r.comma);A(r.greaterThan),fe(e)}function Om(){if(Re(g._interface),S(r._extends))do gi();while(S(r.comma));Fi(false,false,false)}function Ua(){p(r.num)||p(r.string)?Bt():ae()}function Bm(){Ae()===r.colon?(Ua(),It()):Qe(),A(r.bracketR),It()}function Vm(){Ua(),A(r.bracketR),A(r.bracketR),p(r.lessThan)||p(r.parenL)?Ma():(S(r.question),It())}function Ma(){for(p(r.lessThan)&&bt(),A(r.parenL);!p(r.parenR)&&!p(r.ellipsis)&&!c.error;)Ui(),p(r.parenR)||A(r.comma);S(r.ellipsis)&&Ui(),A(r.parenR),It()}function jm(){Ma()}function Fi(e,t,s){let i;for(t&&p(r.braceBarL)?(A(r.braceBarL),i=r.braceBarR):(A(r.braceL),i=r.braceR);!p(i)&&!c.error;){if(s&&ee(g._proto)){const n=Ae();n!==r.colon&&n!==r.question&&(C(),e=false)}if(e&&ee(g._static)){const n=Ae();n!==r.colon&&n!==r.question&&C()}if(Oa(),S(r.bracketL))S(r.bracketL)?Vm():Bm();else if(p(r.parenL)||p(r.lessThan))jm();else{if(ee(g._get)||ee(g._set)){const n=Ae();(n===r.name||n===r.string||n===r.num)&&C()}$m()}qm()}A(i)}function $m(){if(p(r.ellipsis)){if(A(r.ellipsis),S(r.comma)||S(r.semi),p(r.braceR))return;Qe()}else Ua(),p(r.lessThan)||p(r.parenL)?Ma():(S(r.question),It())}function qm(){!S(r.semi)&&!S(r.comma)&&!p(r.braceR)&&!p(r.braceBarR)&&le()}function fl(e){for(e||ae();S(r.dot);)ae()}function Hm(){fl(true),p(r.lessThan)&&cs()}function Wm(){A(r._typeof),pl()}function Gm(){for(A(r.bracketL);c.pos<$.length&&!p(r.bracketR)&&(Qe(),!p(r.bracketR));)A(r.comma);A(r.bracketR)}function Ui(){const e=Ae();e===r.colon||e===r.question?(ae(),S(r.question),It()):Qe()}function $n(){for(;!p(r.parenR)&&!p(r.ellipsis)&&!c.error;)Ui(),p(r.parenR)||A(r.comma);S(r.ellipsis)&&Ui()}function pl(){let e=false;const t=c.noAnonFunctionType;switch(c.type){case r.name:{if(ee(g._interface)){Om();return}ae(),Hm();return}case r.braceL:Fi(false,false,false);return;case r.braceBarL:Fi(false,true,false);return;case r.bracketL:Gm();return;case r.lessThan:bt(),A(r.parenL),$n(),A(r.parenR),A(r.arrow),Qe();return;case r.parenL:if(C(),!p(r.parenR)&&!p(r.ellipsis))if(p(r.name)){const s=Ae();e=s!==r.question&&s!==r.colon}else e=true;if(e)if(c.noAnonFunctionType=false,Qe(),c.noAnonFunctionType=t,c.noAnonFunctionType||!(p(r.comma)||p(r.parenR)&&Ae()===r.arrow)){A(r.parenR);return}else S(r.comma);$n(),A(r.parenR),A(r.arrow),Qe();return;case r.minus:C(),ks();return;case r.string:case r.num:case r._true:case r._false:case r._null:case r._this:case r._void:case r.star:C();return;default:if(c.type===r._typeof){Wm();return}else if(c.type&r.IS_KEYWORD){C(),c.tokens[c.tokens.length-1].type=r.name;return}}le()}function Xm(){for(pl();!tt()&&(p(r.bracketL)||p(r.questionDot));)S(r.questionDot),A(r.bracketL),S(r.bracketR)||(Qe(),A(r.bracketR))}function dl(){S(r.question)?dl():Xm()}function jo(){dl(),!c.noAnonFunctionType&&S(r.arrow)&&Qe()}function $o(){for(S(r.bitwiseAND),jo();S(r.bitwiseAND);)jo()}function Ym(){for(S(r.bitwiseOR),$o();S(r.bitwiseOR);)$o()}function Qe(){Ym()}function ps(){It()}function ml(){ae(),p(r.colon)&&ps()}function Oa(){(p(r.plus)||p(r.minus))&&(C(),c.tokens[c.tokens.length-1].isType=true)}function zm(e){p(r.colon)&&Pa(),ci(false,e)}function Km(e,t,s){if(p(r.questionDot)&&Ae()===r.lessThan){if(t){s.stop=true;return}C(),cs(),A(r.parenL),zt();return}else if(!t&&p(r.lessThan)){const i=c.snapshot();if(cs(),A(r.parenL),zt(),c.error)c.restoreFromSnapshot(i);else return}Ta(e,t,s)}function Zm(){if(p(r.lessThan)){const e=c.snapshot();cs(),c.error&&c.restoreFromSnapshot(e)}}function Qm(){if(p(r.name)&&c.contextualKeyword===g._interface){const e=pe(0);return C(),Da(),fe(e),true}else if(ee(g._enum))return gl(),true;return false}function Jm(){return ee(g._enum)?(gl(),true):false}function e0(e){if(e===g._declare){if(p(r._class)||p(r.name)||p(r._function)||p(r._var)||p(r._export)){const t=pe(1);jn(),fe(t)}}else if(p(r.name)){if(e===g._interface){const t=pe(1);Da(),fe(t)}else if(e===g._type){const t=pe(1);Na(),fe(t)}else if(e===g._opaque){const t=pe(1);Fa(false),fe(t)}}Ee()}function t0(){return ee(g._type)||ee(g._interface)||ee(g._opaque)||ee(g._enum)}function s0(){return p(r.name)&&(c.contextualKeyword===g._type||c.contextualKeyword===g._interface||c.contextualKeyword===g._opaque||c.contextualKeyword===g._enum)}function i0(){if(ee(g._type)){const e=pe(1);C(),p(r.braceL)?(Va(),Qs()):Na(),fe(e)}else if(ee(g._opaque)){const e=pe(1);C(),Fa(false),fe(e)}else if(ee(g._interface)){const e=pe(1);C(),Da(),fe(e)}else st(true)}function r0(){return p(r.star)||ee(g._type)&&Ae()===r.star}function n0(){if(Le(g._type)){const e=pe(2);qn(),fe(e)}else qn()}function a0(e){if(e&&p(r.lessThan)&&cs(),ee(g._implements)){const t=pe(0);C(),c.tokens[c.tokens.length-1].type=r._implements;do rr(),p(r.lessThan)&&cs();while(S(r.comma));fe(t)}}function o0(){p(r.lessThan)&&(bt(),p(r.parenL)||le())}function c0(){const e=pe(0);S(r.question),p(r.colon)&&ps(),fe(e)}function u0(){if(p(r._typeof)||ee(g._type)){const e=ri();(Am(e)||e.type===r.braceL||e.type===r.star)&&C()}}function l0(){const e=c.contextualKeyword===g._type||c.type===r._typeof;e?C():ae(),ee(g._as)&&!ma(g._as)?(ae(),e&&!p(r.name)&&!(c.type&r.IS_KEYWORD)||ae()):(e&&(p(r.name)||c.type&r.IS_KEYWORD)&&ae(),Le(g._as)&&ae())}function h0(){if(p(r.lessThan)){const e=pe(0);bt(),fe(e)}}function f0(){p(r.colon)&&ps()}function p0(){if(p(r.colon)){const e=c.noAnonFunctionType;c.noAnonFunctionType=true,ps(),c.noAnonFunctionType=e}}function d0(e,t){if(p(r.lessThan)){const s=c.snapshot();let i=St(e,t);if(c.error)c.restoreFromSnapshot(s),c.type=r.typeParameterStart;else return i;const n=pe(0);if(bt(),fe(n),i=St(e,t),i)return true;le()}return St(e,t)}function m0(){if(p(r.colon)){const e=pe(0),t=c.snapshot(),s=c.noAnonFunctionType;c.noAnonFunctionType=true,Pa(),c.noAnonFunctionType=s,tt()&&le(),p(r.arrow)||le(),c.error&&c.restoreFromSnapshot(t),fe(e)}return S(r.arrow)}function g0(e,t=false){if(c.tokens[c.tokens.length-1].contextualKeyword===g._async&&p(r.lessThan)){const s=c.snapshot();if(b0()&&!c.error)return;c.restoreFromSnapshot(s)}al(e,t)}function b0(){c.scopeDepth++;const e=c.tokens.length;return Cs(),Bn()?(Zs(e),true):false}function gl(){Re(g._enum),c.tokens[c.tokens.length-1].type=r._enum,ae(),y0()}function y0(){Le(g._of)&&C(),A(r.braceL),_0(),A(r.braceR)}function _0(){for(;!p(r.braceR)&&!c.error&&!S(r.ellipsis);)x0(),p(r.braceR)||A(r.comma)}function x0(){ae(),S(r.eq)&&C()}function v0(){if(nr(r.eof),c.scopes.push(new At(0,c.tokens.length,true)),c.scopeDepth!==0)throw new Error(`Invalid scope depth at end of file: ${c.scopeDepth}`);return new og(c.tokens,c.scopes)}function st(e){_e&&Qm()||(p(r.at)&&Ba(),k0(e))}function k0(e){if(me&&Bd())return;const t=c.type;switch(t){case r._break:case r._continue:S0();return;case r._debugger:E0();return;case r._do:T0();return;case r._for:A0();return;case r._function:if(Ae()===r.dot)break;e||le(),R0();return;case r._class:e||le(),ls(true);return;case r._if:P0();return;case r._return:L0();return;case r._switch:D0();return;case r._throw:N0();return;case r._try:U0();return;case r._let:case r._const:e||le();case r._var:bi(t!==r._var);return;case r._while:M0();return;case r.braceL:Kt();return;case r.semi:O0();return;case r._export:case r._import:{const n=Ae();if(n===r.parenL||n===r.dot)break;C(),t===r._import?El():wl();return}case r.name:if(c.contextualKeyword===g._async){const n=c.start,a=c.snapshot();if(C(),p(r._function)&&!tt()){A(r._function),us(n,true);return}else c.restoreFromSnapshot(a)}else if(c.contextualKeyword===g._using&&!xu()&&Ae()===r.name){bi(true);return}else if(bl()){Re(g._await),bi(true);return}}const s=c.tokens.length;Me();let i=null;if(c.tokens.length===s+1){const n=c.tokens[c.tokens.length-1];n.type===r.name&&(i=n.contextualKeyword)}if(i==null){Ee();return}S(r.colon)?B0():V0(i)}function bl(){if(!ee(g._await))return false;const e=c.snapshot();return C(),!ee(g._using)||We()||(C(),!p(r.name)||We())?(c.restoreFromSnapshot(e),false):(c.restoreFromSnapshot(e),true)}function Ba(){for(;p(r.at);)yl()}function yl(){if(C(),S(r.parenL))Me(),A(r.parenR);else{for(ae();S(r.dot);)ae();w0()}}function w0(){me?Jd():_l()}function _l(){S(r.parenL)&&zt()}function S0(){C(),vt()||(ae(),Ee())}function E0(){C(),Ee()}function T0(){C(),st(false),A(r._while),ir(),S(r.semi)}function A0(){c.scopeDepth++;const e=c.tokens.length;C0();const t=c.tokens.length;c.scopes.push(new At(e,t,false)),c.scopeDepth--}function I0(){return!(!ee(g._using)||ma(g._of))}function C0(){C();let e=false;if(ee(g._await)&&(e=true,C()),A(r.parenL),p(r.semi)){e&&le(),gn();return}const t=bl();if(t||p(r._var)||p(r._let)||p(r._const)||I0()){if(t&&Re(g._await),C(),xl(true,c.type!==r._var),p(r._in)||ee(g._of)){qo(e);return}gn();return}if(Me(true),p(r._in)||ee(g._of)){qo(e);return}e&&le(),gn()}function R0(){const e=c.start;C(),us(e,true)}function P0(){C(),ir(),st(false),S(r._else)&&st(false)}function L0(){C(),vt()||(Me(),Ee())}function D0(){C(),ir(),c.scopeDepth++;const e=c.tokens.length;for(A(r.braceL);!p(r.braceR)&&!c.error;)if(p(r._case)||p(r._default)){const s=p(r._case);C(),s&&Me(),A(r.colon)}else st(true);C();const t=c.tokens.length;c.scopes.push(new At(e,t,false)),c.scopeDepth--}function N0(){C(),Me(),Ee()}function F0(){er(true),me&&As()}function U0(){if(C(),Kt(),p(r._catch)){C();let e=null;if(p(r.parenL)&&(c.scopeDepth++,e=c.tokens.length,A(r.parenL),F0(),A(r.parenR)),Kt(),e!=null){const t=c.tokens.length;c.scopes.push(new At(e,t,false)),c.scopeDepth--}}S(r._finally)&&Kt()}function bi(e){C(),xl(false,e),Ee()}function M0(){C(),ir(),st(false)}function O0(){C()}function B0(){st(true)}function V0(e){me?jd(e):_e?e0(e):Ee()}function Kt(e=false,t=0){const s=c.tokens.length;c.scopeDepth++,A(r.braceL),t&&(c.tokens[c.tokens.length-1].contextId=t),nr(r.braceR),t&&(c.tokens[c.tokens.length-1].contextId=t);const i=c.tokens.length;c.scopes.push(new At(s,i,e)),c.scopeDepth--}function nr(e){for(;!S(e)&&!c.error;)st(true)}function gn(){A(r.semi),p(r.semi)||Me(),A(r.semi),p(r.parenR)||Me(),A(r.parenR),st(false)}function qo(e){e?Le(g._of):C(),Me(),A(r.parenR),st(false)}function xl(e,t){for(;;){if(j0(t),S(r.eq)){const s=c.tokens.length-1;Oe(e),c.tokens[s].rhsEndIndex=c.tokens.length}if(!S(r.comma))break}}function j0(e){er(e),me?Gd():_e&&f0()}function us(e,t,s=false){p(r.star)&&C(),t&&!s&&!p(r.name)&&!p(r._yield)&&le();let i=null;p(r.name)&&(t||(i=c.tokens.length,c.scopeDepth++),es(false));const n=c.tokens.length;c.scopeDepth++,Cs(),ul(e);const a=c.tokens.length;c.scopes.push(new At(n,a,true)),c.scopeDepth--,i!==null&&(c.scopes.push(new At(i,a,true)),c.scopeDepth--)}function Cs(e=false,t=0){me?Wd():_e&&h0(),A(r.parenL),t&&(c.tokens[c.tokens.length-1].contextId=t),_a(r.parenR,false,false,e,t),t&&(c.tokens[c.tokens.length-1].contextId=t)}function ls(e,t=false){const s=Xs();C(),c.tokens[c.tokens.length-1].contextId=s,c.tokens[c.tokens.length-1].isExpression=!e;let i=null;e||(i=c.tokens.length,c.scopeDepth++),W0(e,t),G0();const n=c.tokens.length;if($0(s),!c.error&&(c.tokens[n].contextId=s,c.tokens[c.tokens.length-1].contextId=s,i!==null)){const a=c.tokens.length;c.scopes.push(new At(i,a,false)),c.scopeDepth--}}function vl(){return p(r.eq)||p(r.semi)||p(r.braceR)||p(r.bang)||p(r.colon)}function kl(){return p(r.parenL)||p(r.lessThan)}function $0(e){for(A(r.braceL);!S(r.braceR)&&!c.error;){if(S(r.semi))continue;if(p(r.at)){yl();continue}const t=c.start;q0(t,e)}}function q0(e,t){me&&xa([g._declare,g._public,g._protected,g._private,g._override]);let s=false;if(p(r.name)&&c.contextualKeyword===g._static){if(ae(),kl()){Os(e,false);return}else if(vl()){yi();return}if(c.tokens[c.tokens.length-1].type=r._static,s=true,p(r.braceL)){c.tokens[c.tokens.length-1].contextId=t,Kt();return}}H0(e,s,t)}function H0(e,t,s){if(me&&Vd(t))return;if(S(r.star)){Fs(s),Os(e,false);return}Fs(s);let i=false;const n=c.tokens[c.tokens.length-1];n.contextualKeyword===g._constructor&&(i=true),Ho(),kl()?Os(e,i):vl()?yi():n.contextualKeyword===g._async&&!vt()?(c.tokens[c.tokens.length-1].type=r._async,p(r.star)&&C(),Fs(s),Ho(),Os(e,false)):(n.contextualKeyword===g._get||n.contextualKeyword===g._set)&&!(vt()&&p(r.star))?(n.contextualKeyword===g._get?c.tokens[c.tokens.length-1].type=r._get:c.tokens[c.tokens.length-1].type=r._set,Fs(s),Os(e,false)):n.contextualKeyword===g._accessor&&!vt()?(Fs(s),yi()):vt()?yi():le()}function Os(e,t){me?fs():_e&&p(r.lessThan)&&bt(),Vn(e,t)}function Fs(e){Ks(e)}function Ho(){if(me){const e=pe(0);S(r.question),fe(e)}}function yi(){if(me?(Eu(r.bang),As()):_e&&p(r.colon)&&ps(),p(r.eq)){const e=c.tokens.length;C(),Oe(),c.tokens[e].rhsEndIndex=c.tokens.length}Ee()}function W0(e,t=false){me&&(!e||t)&&ee(g._implements)||(p(r.name)&&es(true),me?fs():_e&&p(r.lessThan)&&bt())}function G0(){let e=false;S(r._extends)?(nl(),e=true):e=false,me?qd(e):_e&&a0(e)}function wl(){const e=c.tokens.length-1;me&&Fd()||(K0()?Z0():z0()?(ae(),p(r.comma)&&Ae()===r.star?(A(r.comma),A(r.star),Re(g._as),ae()):Sl(),Qs()):S(r._default)?X0():J0()?Y0():(Va(),Qs()),c.tokens[e].rhsEndIndex=c.tokens.length)}function X0(){if(me&&Od()||_e&&Jm())return;const e=c.start;S(r._function)?us(e,true,true):ee(g._async)&&Ae()===r._function?(Le(g._async),S(r._function),us(e,true,true)):p(r._class)?ls(true,true):p(r.at)?(Ba(),ls(true,true)):(Oe(),Ee())}function Y0(){me?$d():_e?i0():st(true)}function z0(){if(me&&Ju())return false;if(_e&&s0())return false;if(p(r.name))return c.contextualKeyword!==g._async;if(!p(r._default))return false;const e=ga(),t=ri(),s=t.type===r.name&&t.contextualKeyword===g._from;if(t.type===r.comma)return true;if(s){const i=$.charCodeAt(Tu(e+4));return i===y.quotationMark||i===y.apostrophe}return false}function Sl(){S(r.comma)&&Va()}function Qs(){Le(g._from)&&(Bt(),Tl()),Ee()}function K0(){return _e?r0():p(r.star)}function Z0(){_e?n0():qn()}function qn(){A(r.star),ee(g._as)?Q0():Qs()}function Q0(){C(),c.tokens[c.tokens.length-1].type=r._as,ae(),Sl(),Qs()}function J0(){return me&&Ju()||_e&&t0()||c.type===r._var||c.type===r._const||c.type===r._let||c.type===r._function||c.type===r._class||ee(g._async)||p(r.at)}function Va(){let e=true;for(A(r.braceL);!S(r.braceR)&&!c.error;){if(e)e=false;else if(A(r.comma),S(r.braceR))break;eg()}}function eg(){if(me){Md();return}ae(),c.tokens[c.tokens.length-1].identifierRole=ie.ExportAccess,Le(g._as)&&ae()}function tg(){const e=c.snapshot();return Re(g._module),Le(g._from)?ee(g._from)?(c.restoreFromSnapshot(e),true):(c.restoreFromSnapshot(e),false):p(r.comma)?(c.restoreFromSnapshot(e),false):(c.restoreFromSnapshot(e),true)}function sg(){ee(g._module)&&tg()&&C()}function El(){if(me&&p(r.name)&&Ae()===r.eq){Mn();return}if(me&&ee(g._type)){const e=ri();if(e.type===r.name&&e.contextualKeyword!==g._from){if(Re(g._type),Ae()===r.eq){Mn();return}}else(e.type===r.star||e.type===r.braceL)&&Re(g._type)}p(r.string)||(sg(),rg(),Re(g._from)),Bt(),Tl(),Ee()}function ig(){return p(r.name)}function Wo(){Pi()}function rg(){_e&&u0();let e=true;if(!(ig()&&(Wo(),!S(r.comma)))){if(p(r.star)){C(),Re(g._as),Wo();return}for(A(r.braceL);!S(r.braceR)&&!c.error;){if(e)e=false;else if(S(r.colon)&&le("ES2015 named imports do not destructure. Use another statement for destructuring after the import."),A(r.comma),S(r.braceR))break;ng()}}}function ng(){if(me){Ud();return}if(_e){l0();return}Pi(),ee(g._as)&&(c.tokens[c.tokens.length-1].identifierRole=ie.ImportAccess,C(),Pi())}function Tl(){(p(r._with)||ee(g._assert)&&!We())&&(C(),Ra(false,false))}function ag(){return c.pos===0&&$.charCodeAt(0)===y.numberSign&&$.charCodeAt(1)===y.exclamationMark&&Cu(2),Iu(),v0()}class og{constructor(t,s){this.tokens=t,this.scopes=s}}function cg(e,t,s,i){if(i&&s)throw new Error("Cannot combine flow and typescript plugins.");Pf(e,t,s,i);const n=ag();if(c.error)throw If(c.error);return n}function ug(e){let t=e.currentIndex(),s=0;const i=e.currentToken();do{const n=e.tokens[t];if(n.isOptionalChainStart&&s++,n.isOptionalChainEnd&&s--,s+=n.numNullishCoalesceStarts,s-=n.numNullishCoalesceEnds,n.contextualKeyword===g._await&&n.identifierRole==null&&n.scopeDepth===i.scopeDepth)return true;t+=1}while(s>0&&t<e.tokens.length);return false}class js{__init(){this.resultCode=""}__init2(){this.resultMappings=new Array(this.tokens.length)}__init3(){this.tokenIndex=0}constructor(t,s,i,n,a){this.code=t,this.tokens=s,this.isFlowEnabled=i,this.disableESTransforms=n,this.helperManager=a,js.prototype.__init.call(this),js.prototype.__init2.call(this),js.prototype.__init3.call(this)}snapshot(){return{resultCode:this.resultCode,tokenIndex:this.tokenIndex}}restoreToSnapshot(t){this.resultCode=t.resultCode,this.tokenIndex=t.tokenIndex}dangerouslyGetAndRemoveCodeSinceSnapshot(t){const s=this.resultCode.slice(t.resultCode.length);return this.resultCode=t.resultCode,s}reset(){this.resultCode="",this.resultMappings=new Array(this.tokens.length),this.tokenIndex=0}matchesContextualAtIndex(t,s){return this.matches1AtIndex(t,r.name)&&this.tokens[t].contextualKeyword===s}identifierNameAtIndex(t){return this.identifierNameForToken(this.tokens[t])}identifierNameAtRelativeIndex(t){return this.identifierNameForToken(this.tokenAtRelativeIndex(t))}identifierName(){return this.identifierNameForToken(this.currentToken())}identifierNameForToken(t){return this.code.slice(t.start,t.end)}rawCodeForToken(t){return this.code.slice(t.start,t.end)}stringValueAtIndex(t){return this.stringValueForToken(this.tokens[t])}stringValue(){return this.stringValueForToken(this.currentToken())}stringValueForToken(t){return this.code.slice(t.start+1,t.end-1)}matches1AtIndex(t,s){return this.tokens[t].type===s}matches2AtIndex(t,s,i){return this.tokens[t].type===s&&this.tokens[t+1].type===i}matches3AtIndex(t,s,i,n){return this.tokens[t].type===s&&this.tokens[t+1].type===i&&this.tokens[t+2].type===n}matches1(t){return this.tokens[this.tokenIndex].type===t}matches2(t,s){return this.tokens[this.tokenIndex].type===t&&this.tokens[this.tokenIndex+1].type===s}matches3(t,s,i){return this.tokens[this.tokenIndex].type===t&&this.tokens[this.tokenIndex+1].type===s&&this.tokens[this.tokenIndex+2].type===i}matches4(t,s,i,n){return this.tokens[this.tokenIndex].type===t&&this.tokens[this.tokenIndex+1].type===s&&this.tokens[this.tokenIndex+2].type===i&&this.tokens[this.tokenIndex+3].type===n}matches5(t,s,i,n,a){return this.tokens[this.tokenIndex].type===t&&this.tokens[this.tokenIndex+1].type===s&&this.tokens[this.tokenIndex+2].type===i&&this.tokens[this.tokenIndex+3].type===n&&this.tokens[this.tokenIndex+4].type===a}matchesContextual(t){return this.matchesContextualAtIndex(this.tokenIndex,t)}matchesContextIdAndLabel(t,s){return this.matches1(t)&&this.currentToken().contextId===s}previousWhitespaceAndComments(){let t=this.code.slice(this.tokenIndex>0?this.tokens[this.tokenIndex-1].end:0,this.tokenIndex<this.tokens.length?this.tokens[this.tokenIndex].start:this.code.length);return this.isFlowEnabled&&(t=t.replace(/@flow/g,"")),t}replaceToken(t){this.resultCode+=this.previousWhitespaceAndComments(),this.appendTokenPrefix(),this.resultMappings[this.tokenIndex]=this.resultCode.length,this.resultCode+=t,this.appendTokenSuffix(),this.tokenIndex++}replaceTokenTrimmingLeftWhitespace(t){this.resultCode+=this.previousWhitespaceAndComments().replace(/[^\r\n]/g,""),this.appendTokenPrefix(),this.resultMappings[this.tokenIndex]=this.resultCode.length,this.resultCode+=t,this.appendTokenSuffix(),this.tokenIndex++}removeInitialToken(){this.replaceToken("")}removeToken(){this.replaceTokenTrimmingLeftWhitespace("")}removeBalancedCode(){let t=0;for(;!this.isAtEnd();){if(this.matches1(r.braceL))t++;else if(this.matches1(r.braceR)){if(t===0)return;t--}this.removeToken()}}copyExpectedToken(t){if(this.tokens[this.tokenIndex].type!==t)throw new Error(`Expected token ${t}`);this.copyToken()}copyToken(){this.resultCode+=this.previousWhitespaceAndComments(),this.appendTokenPrefix(),this.resultMappings[this.tokenIndex]=this.resultCode.length,this.resultCode+=this.code.slice(this.tokens[this.tokenIndex].start,this.tokens[this.tokenIndex].end),this.appendTokenSuffix(),this.tokenIndex++}copyTokenWithPrefix(t){this.resultCode+=this.previousWhitespaceAndComments(),this.appendTokenPrefix(),this.resultCode+=t,this.resultMappings[this.tokenIndex]=this.resultCode.length,this.resultCode+=this.code.slice(this.tokens[this.tokenIndex].start,this.tokens[this.tokenIndex].end),this.appendTokenSuffix(),this.tokenIndex++}appendTokenPrefix(){const t=this.currentToken();if((t.numNullishCoalesceStarts||t.isOptionalChainStart)&&(t.isAsyncOperation=ug(this)),!this.disableESTransforms){if(t.numNullishCoalesceStarts)for(let s=0;s<t.numNullishCoalesceStarts;s++)t.isAsyncOperation?(this.resultCode+="await ",this.resultCode+=this.helperManager.getHelperName("asyncNullishCoalesce")):this.resultCode+=this.helperManager.getHelperName("nullishCoalesce"),this.resultCode+="(";t.isOptionalChainStart&&(t.isAsyncOperation&&(this.resultCode+="await "),this.tokenIndex>0&&this.tokenAtRelativeIndex(-1).type===r._delete?t.isAsyncOperation?this.resultCode+=this.helperManager.getHelperName("asyncOptionalChainDelete"):this.resultCode+=this.helperManager.getHelperName("optionalChainDelete"):t.isAsyncOperation?this.resultCode+=this.helperManager.getHelperName("asyncOptionalChain"):this.resultCode+=this.helperManager.getHelperName("optionalChain"),this.resultCode+="([")}}appendTokenSuffix(){const t=this.currentToken();if(t.isOptionalChainEnd&&!this.disableESTransforms&&(this.resultCode+="])"),t.numNullishCoalesceEnds&&!this.disableESTransforms)for(let s=0;s<t.numNullishCoalesceEnds;s++)this.resultCode+="))"}appendCode(t){this.resultCode+=t}currentToken(){return this.tokens[this.tokenIndex]}currentTokenCode(){const t=this.currentToken();return this.code.slice(t.start,t.end)}tokenAtRelativeIndex(t){return this.tokens[this.tokenIndex+t]}currentIndex(){return this.tokenIndex}nextToken(){if(this.tokenIndex===this.tokens.length)throw new Error("Unexpectedly reached end of input.");this.tokenIndex++}previousToken(){this.tokenIndex--}finish(){if(this.tokenIndex!==this.tokens.length)throw new Error("Tried to finish processing tokens before reaching the end.");return this.resultCode+=this.previousWhitespaceAndComments(),{code:this.resultCode,mappings:this.resultMappings}}isAtEnd(){return this.tokenIndex===this.tokens.length}}function lg(e,t,s,i){const n=t.snapshot(),a=hg(t);let o=[];const u=[],l=[];let h=null;const d=[],m=[],_=t.currentToken().contextId;if(_==null)throw new Error("Expected non-null class context ID on class open-brace.");for(t.nextToken();!t.matchesContextIdAndLabel(r.braceR,_);)if(t.matchesContextual(g._constructor)&&!t.currentToken().isType)({constructorInitializerStatements:o,constructorInsertPos:h}=Go(t));else if(t.matches1(r.semi))i||m.push({start:t.currentIndex(),end:t.currentIndex()+1}),t.nextToken();else if(t.currentToken().isType)t.nextToken();else{const k=t.currentIndex();let T=false,P=false,F=false;for(;Mi(t.currentToken());)t.matches1(r._static)&&(T=true),t.matches1(r.hash)&&(P=true),(t.matches1(r._declare)||t.matches1(r._abstract))&&(F=true),t.nextToken();if(T&&t.matches1(r.braceL)){bn(t,_);continue}if(P){bn(t,_);continue}if(t.matchesContextual(g._constructor)&&!t.currentToken().isType){({constructorInitializerStatements:o,constructorInsertPos:h}=Go(t));continue}const B=t.currentIndex();if(fg(t),t.matches1(r.lessThan)||t.matches1(r.parenL)){bn(t,_);continue}for(;t.currentToken().isType;)t.nextToken();if(t.matches1(r.eq)){const N=t.currentIndex(),Y=t.currentToken().rhsEndIndex;if(Y==null)throw new Error("Expected rhsEndIndex on class field assignment.");for(t.nextToken();t.currentIndex()<Y;)e.processToken();let q;T?(q=s.claimFreeName("__initStatic"),l.push(q)):(q=s.claimFreeName("__init"),u.push(q)),d.push({initializerName:q,equalsIndex:N,start:B,end:t.currentIndex()})}else(!i||F)&&m.push({start:k,end:t.currentIndex()})}return t.restoreToSnapshot(n),i?{headerInfo:a,constructorInitializerStatements:o,instanceInitializerNames:[],staticInitializerNames:[],constructorInsertPos:h,fields:[],rangesToRemove:m}:{headerInfo:a,constructorInitializerStatements:o,instanceInitializerNames:u,staticInitializerNames:l,constructorInsertPos:h,fields:d,rangesToRemove:m}}function bn(e,t){for(e.nextToken();e.currentToken().contextId!==t;)e.nextToken();for(;Mi(e.tokenAtRelativeIndex(-1));)e.previousToken()}function hg(e){const t=e.currentToken(),s=t.contextId;if(s==null)throw new Error("Expected context ID on class token.");const i=t.isExpression;if(i==null)throw new Error("Expected isExpression on class token.");let n=null,a=false;for(e.nextToken(),e.matches1(r.name)&&(n=e.identifierName());!e.matchesContextIdAndLabel(r.braceL,s);)e.matches1(r._extends)&&!e.currentToken().isType&&(a=true),e.nextToken();return{isExpression:i,className:n,hasSuperclass:a}}function Go(e){const t=[];e.nextToken();const s=e.currentToken().contextId;if(s==null)throw new Error("Expected context ID on open-paren starting constructor params.");for(;!e.matchesContextIdAndLabel(r.parenR,s);)if(e.currentToken().contextId===s){if(e.nextToken(),Mi(e.currentToken())){for(e.nextToken();Mi(e.currentToken());)e.nextToken();const a=e.currentToken();if(a.type!==r.name)throw new Error("Expected identifier after access modifiers in constructor arg.");const o=e.identifierNameForToken(a);t.push(`this.${o} = ${o}`)}}else e.nextToken();for(e.nextToken();e.currentToken().isType;)e.nextToken();let i=e.currentIndex(),n=false;for(;!e.matchesContextIdAndLabel(r.braceR,s);){if(!n&&e.matches2(r._super,r.parenL)){e.nextToken();const a=e.currentToken().contextId;if(a==null)throw new Error("Expected a context ID on the super call");for(;!e.matchesContextIdAndLabel(r.parenR,a);)e.nextToken();i=e.currentIndex(),n=true}e.nextToken()}return e.nextToken(),{constructorInitializerStatements:t,constructorInsertPos:i}}function Mi(e){return[r._async,r._get,r._set,r.plus,r.minus,r._readonly,r._static,r._public,r._private,r._protected,r._override,r._abstract,r.star,r._declare,r.hash].includes(e.type)}function fg(e){if(e.matches1(r.bracketL)){const s=e.currentToken().contextId;if(s==null)throw new Error("Expected class context ID on computed name open bracket.");for(;!e.matchesContextIdAndLabel(r.bracketR,s);)e.nextToken();e.nextToken()}else e.nextToken()}function Al(e){if(e.removeInitialToken(),e.removeToken(),e.removeToken(),e.removeToken(),e.matches1(r.parenL))e.removeToken(),e.removeToken(),e.removeToken();else for(;e.matches1(r.dot);)e.removeToken(),e.removeToken()}const Il={typeDeclarations:new Set,valueDeclarations:new Set};function Cl(e){const t=new Set,s=new Set;for(let i=0;i<e.tokens.length;i++){const n=e.tokens[i];n.type===r.name&&Su(n)&&(n.isType?t.add(e.identifierNameForToken(n)):s.add(e.identifierNameForToken(n)))}return{typeDeclarations:t,valueDeclarations:s}}function Rl(e){let t=e.currentIndex();for(;!e.matches1AtIndex(t,r.braceR);)t++;return e.matchesContextualAtIndex(t+1,g._from)&&e.matches1AtIndex(t+2,r.string)}function as(e){(e.matches2(r._with,r.braceL)||e.matches2(r.name,r.braceL)&&e.matchesContextual(g._assert))&&(e.removeToken(),e.removeToken(),e.removeBalancedCode(),e.removeToken())}function Pl(e,t,s,i){if(!e||t)return false;const n=s.currentToken();if(n.rhsEndIndex==null)throw new Error("Expected non-null rhsEndIndex on export token.");const a=n.rhsEndIndex-s.currentIndex();if(a!==3&&!(a===4&&s.matches1AtIndex(n.rhsEndIndex-1,r.semi)))return false;const o=s.tokenAtRelativeIndex(2);if(o.type!==r.name)return false;const u=s.identifierNameForToken(o);return i.typeDeclarations.has(u)&&!i.valueDeclarations.has(u)}class $s extends gt{__init(){this.hadExport=false}__init2(){this.hadNamedExport=false}__init3(){this.hadDefaultExport=false}constructor(t,s,i,n,a,o,u,l,h,d,m,_){super(),this.rootTransformer=t,this.tokens=s,this.importProcessor=i,this.nameManager=n,this.helperManager=a,this.reactHotLoaderTransformer=o,this.enableLegacyBabel5ModuleInterop=u,this.enableLegacyTypeScriptModuleInterop=l,this.isTypeScriptTransformEnabled=h,this.isFlowTransformEnabled=d,this.preserveDynamicImport=m,this.keepUnusedImports=_,$s.prototype.__init.call(this),$s.prototype.__init2.call(this),$s.prototype.__init3.call(this),this.declarationInfo=h?Cl(s):Il}getPrefixCode(){let t="";return this.hadExport&&(t+='Object.defineProperty(exports, "__esModule", {value: true});'),t}getSuffixCode(){return this.enableLegacyBabel5ModuleInterop&&this.hadDefaultExport&&!this.hadNamedExport?`
|
|
563
|
+
`};class Ri{__init(){this.helperNames={}}__init2(){this.createRequireName=null}constructor(t){this.nameManager=t,Ri.prototype.__init.call(this),Ri.prototype.__init2.call(this)}getHelperName(t){let s=this.helperNames[t];return s||(s=this.nameManager.claimFreeName(`_${t}`),this.helperNames[t]=s,s)}emitHelpers(){let t="";this.helperNames.optionalChainDelete&&this.getHelperName("optionalChain"),this.helperNames.asyncOptionalChainDelete&&this.getHelperName("asyncOptionalChain");for(const[s,i]of Object.entries(Lp)){const n=this.helperNames[s];let a=i;s==="optionalChainDelete"?a=a.replace("OPTIONAL_CHAIN_NAME",this.helperNames.optionalChain):s==="asyncOptionalChainDelete"?a=a.replace("ASYNC_OPTIONAL_CHAIN_NAME",this.helperNames.asyncOptionalChain):s==="require"&&(this.createRequireName===null&&(this.createRequireName=this.nameManager.claimFreeName("_createRequire")),a=a.replace(/CREATE_REQUIRE_NAME/g,this.createRequireName)),n&&(t+=" ",t+=a.replace(s,n).replace(/\s+/g," ").trim())}return t}}function Do(e,t,s){Dp(e,s)&&Np(e,t,s)}function Dp(e,t){for(const s of e.tokens)if(s.type===r.name&&!s.isType&&Ff(s)&&t.has(e.identifierNameForToken(s)))return true;return false}function Np(e,t,s){const i=[];let n=t.length-1;for(let a=e.tokens.length-1;;a--){for(;i.length>0&&i[i.length-1].startTokenIndex===a+1;)i.pop();for(;n>=0&&t[n].endTokenIndex===a+1;)i.push(t[n]),n--;if(a<0)break;const o=e.tokens[a],u=e.identifierNameForToken(o);if(i.length>1&&!o.isType&&o.type===r.name&&s.has(u)){if(Uf(o))No(i[i.length-1],e,u);else if(Mf(o)){let l=i.length-1;for(;l>0&&!i[l].isFunctionScope;)l--;if(l<0)throw new Error("Did not find parent function scope.");No(i[l],e,u)}}}if(i.length>0)throw new Error("Expected empty scope stack after processing file.")}function No(e,t,s){for(let i=e.startTokenIndex;i<e.endTokenIndex;i++){const n=t.tokens[i];(n.type===r.name||n.type===r.jsxName)&&t.identifierNameForToken(n)===s&&(n.shadowsGlobal=true)}}function Fp(e,t){const s=[];for(const i of t)i.type===r.name&&s.push(e.slice(i.start,i.end));return s}class ba{__init(){this.usedNames=new Set}constructor(t,s){ba.prototype.__init.call(this),this.usedNames=new Set(Fp(t,s))}claimFreeName(t){const s=this.findFreeName(t);return this.usedNames.add(s),s}findFreeName(t){if(!this.usedNames.has(t))return t;let s=2;for(;this.usedNames.has(t+String(s));)s++;return t+String(s)}}var we={},Dn={},wt={},Up=os&&os.__extends||function(){var e=function(t,s){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,n){i.__proto__=n}||function(i,n){for(var a in n)n.hasOwnProperty(a)&&(i[a]=n[a])},e(t,s)};return function(t,s){e(t,s);function i(){this.constructor=t}t.prototype=s===null?Object.create(s):(i.prototype=s.prototype,new i)}}();Object.defineProperty(wt,"__esModule",{value:true});wt.DetailContext=wt.NoopContext=wt.VError=void 0;var ju=function(e){Up(t,e);function t(s,i){var n=e.call(this,i)||this;return n.path=s,Object.setPrototypeOf(n,t.prototype),n}return t}(Error);wt.VError=ju;var Mp=function(){function e(){}return e.prototype.fail=function(t,s,i){return false},e.prototype.unionResolver=function(){return this},e.prototype.createContext=function(){return this},e.prototype.resolveUnion=function(t){},e}();wt.NoopContext=Mp;var $u=function(){function e(){this._propNames=[""],this._messages=[null],this._score=0}return e.prototype.fail=function(t,s,i){return this._propNames.push(t),this._messages.push(s),this._score+=i,false},e.prototype.unionResolver=function(){return new Op},e.prototype.resolveUnion=function(t){for(var s,i,n=t,a=null,o=0,u=n.contexts;o<u.length;o++){var l=u[o];(!a||l._score>=a._score)&&(a=l)}a&&a._score>0&&((s=this._propNames).push.apply(s,a._propNames),(i=this._messages).push.apply(i,a._messages))},e.prototype.getError=function(t){for(var s=[],i=this._propNames.length-1;i>=0;i--){var n=this._propNames[i];t+=typeof n=="number"?"["+n+"]":n?"."+n:"";var a=this._messages[i];a&&s.push(t+" "+a)}return new ju(t,s.join("; "))},e.prototype.getErrorDetail=function(t){for(var s=[],i=this._propNames.length-1;i>=0;i--){var n=this._propNames[i];t+=typeof n=="number"?"["+n+"]":n?"."+n:"";var a=this._messages[i];a&&s.push({path:t,message:a})}for(var o=null,i=s.length-1;i>=0;i--)o&&(s[i].nested=[o]),o=s[i];return o},e}();wt.DetailContext=$u;var Op=function(){function e(){this.contexts=[]}return e.prototype.createContext=function(){var t=new $u;return this.contexts.push(t),t},e}();(function(e){var t=os&&os.__extends||function(){var w=function(E,D){return w=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(L,j){L.__proto__=j}||function(L,j){for(var se in j)j.hasOwnProperty(se)&&(L[se]=j[se])},w(E,D)};return function(E,D){w(E,D);function L(){this.constructor=E}E.prototype=D===null?Object.create(D):(L.prototype=D.prototype,new L)}}();Object.defineProperty(e,"__esModule",{value:true}),e.basicTypes=e.BasicType=e.TParamList=e.TParam=e.param=e.TFunc=e.func=e.TProp=e.TOptional=e.opt=e.TIface=e.iface=e.TEnumLiteral=e.enumlit=e.TEnumType=e.enumtype=e.TIntersection=e.intersection=e.TUnion=e.union=e.TTuple=e.tuple=e.TArray=e.array=e.TLiteral=e.lit=e.TName=e.name=e.TType=void 0;var s=wt,i=function(){function w(){}return w}();e.TType=i;function n(w){return typeof w=="string"?o(w):w}function a(w,E){var D=w[E];if(!D)throw new Error("Unknown type "+E);return D}function o(w){return new u(w)}e.name=o;var u=function(w){t(E,w);function E(D){var L=w.call(this)||this;return L.name=D,L._failMsg="is not a "+D,L}return E.prototype.getChecker=function(D,L,j){var se=this,ne=a(D,this.name),de=ne.getChecker(D,L,j);return ne instanceof U||ne instanceof E?de:function(Se,ke){return de(Se,ke)?true:ke.fail(null,se._failMsg,0)}},E}(i);e.TName=u;function l(w){return new h(w)}e.lit=l;var h=function(w){t(E,w);function E(D){var L=w.call(this)||this;return L.value=D,L.name=JSON.stringify(D),L._failMsg="is not "+L.name,L}return E.prototype.getChecker=function(D,L){var j=this;return function(se,ne){return se===j.value?true:ne.fail(null,j._failMsg,-1)}},E}(i);e.TLiteral=h;function d(w){return new m(n(w))}e.array=d;var m=function(w){t(E,w);function E(D){var L=w.call(this)||this;return L.ttype=D,L}return E.prototype.getChecker=function(D,L){var j=this.ttype.getChecker(D,L);return function(se,ne){if(!Array.isArray(se))return ne.fail(null,"is not an array",0);for(var de=0;de<se.length;de++){var Se=j(se[de],ne);if(!Se)return ne.fail(de,null,1)}return true}},E}(i);e.TArray=m;function _(){for(var w=[],E=0;E<arguments.length;E++)w[E]=arguments[E];return new k(w.map(function(D){return n(D)}))}e.tuple=_;var k=function(w){t(E,w);function E(D){var L=w.call(this)||this;return L.ttypes=D,L}return E.prototype.getChecker=function(D,L){var j=this.ttypes.map(function(ne){return ne.getChecker(D,L)}),se=function(ne,de){if(!Array.isArray(ne))return de.fail(null,"is not an array",0);for(var Se=0;Se<j.length;Se++){var ke=j[Se](ne[Se],de);if(!ke)return de.fail(Se,null,1)}return true};return L?function(ne,de){return se(ne,de)?ne.length<=j.length?true:de.fail(j.length,"is extraneous",2):false}:se},E}(i);e.TTuple=k;function T(){for(var w=[],E=0;E<arguments.length;E++)w[E]=arguments[E];return new P(w.map(function(D){return n(D)}))}e.union=T;var P=function(w){t(E,w);function E(D){var L=w.call(this)||this;L.ttypes=D;var j=D.map(function(ne){return ne instanceof u||ne instanceof h?ne.name:null}).filter(function(ne){return ne}),se=D.length-j.length;return j.length?(se>0&&j.push(se+" more"),L._failMsg="is none of "+j.join(", ")):L._failMsg="is none of "+se+" types",L}return E.prototype.getChecker=function(D,L){var j=this,se=this.ttypes.map(function(ne){return ne.getChecker(D,L)});return function(ne,de){for(var Se=de.unionResolver(),ke=0;ke<se.length;ke++){var Fe=se[ke](ne,Se.createContext());if(Fe)return true}return de.resolveUnion(Se),de.fail(null,j._failMsg,0)}},E}(i);e.TUnion=P;function F(){for(var w=[],E=0;E<arguments.length;E++)w[E]=arguments[E];return new B(w.map(function(D){return n(D)}))}e.intersection=F;var B=function(w){t(E,w);function E(D){var L=w.call(this)||this;return L.ttypes=D,L}return E.prototype.getChecker=function(D,L){var j=new Set,se=this.ttypes.map(function(ne){return ne.getChecker(D,L,j)});return function(ne,de){var Se=se.every(function(ke){return ke(ne,de)});return Se?true:de.fail(null,null,0)}},E}(i);e.TIntersection=B;function N(w){return new Y(w)}e.enumtype=N;var Y=function(w){t(E,w);function E(D){var L=w.call(this)||this;return L.members=D,L.validValues=new Set,L._failMsg="is not a valid enum value",L.validValues=new Set(Object.keys(D).map(function(j){return D[j]})),L}return E.prototype.getChecker=function(D,L){var j=this;return function(se,ne){return j.validValues.has(se)?true:ne.fail(null,j._failMsg,0)}},E}(i);e.TEnumType=Y;function q(w,E){return new z(w,E)}e.enumlit=q;var z=function(w){t(E,w);function E(D,L){var j=w.call(this)||this;return j.enumName=D,j.prop=L,j._failMsg="is not "+D+"."+L,j}return E.prototype.getChecker=function(D,L){var j=this,se=a(D,this.enumName);if(!(se instanceof Y))throw new Error("Type "+this.enumName+" used in enumlit is not an enum type");var ne=se.members[this.prop];if(!se.members.hasOwnProperty(this.prop))throw new Error("Unknown value "+this.enumName+"."+this.prop+" used in enumlit");return function(de,Se){return de===ne?true:Se.fail(null,j._failMsg,-1)}},E}(i);e.TEnumLiteral=z;function J(w){return Object.keys(w).map(function(E){return K(E,w[E])})}function K(w,E){return E instanceof b?new v(w,E.ttype,true):new v(w,n(E),false)}function X(w,E){return new re(w,J(E))}e.iface=X;var re=function(w){t(E,w);function E(D,L){var j=w.call(this)||this;return j.bases=D,j.props=L,j.propSet=new Set(L.map(function(se){return se.name})),j}return E.prototype.getChecker=function(D,L,j){var se=this,ne=this.bases.map(function(Ce){return a(D,Ce).getChecker(D,L)}),de=this.props.map(function(Ce){return Ce.ttype.getChecker(D,L)}),Se=new s.NoopContext,ke=this.props.map(function(Ce,Ve){return!Ce.isOpt&&!de[Ve](void 0,Se)}),Fe=function(Ce,Ve){if(typeof Ce!="object"||Ce===null)return Ve.fail(null,"is not an object",0);for(var je=0;je<ne.length;je++)if(!ne[je](Ce,Ve))return false;for(var je=0;je<de.length;je++){var ts=se.props[je].name,ds=Ce[ts];if(ds===void 0){if(ke[je])return Ve.fail(ts,"is missing",1)}else{var Rs=de[je](ds,Ve);if(!Rs)return Ve.fail(ts,null,1)}}return true};if(!L)return Fe;var Xe=this.propSet;return j&&(this.propSet.forEach(function(Ce){return j.add(Ce)}),Xe=j),function(Ce,Ve){if(!Fe(Ce,Ve))return false;for(var je in Ce)if(!Xe.has(je))return Ve.fail(je,"is extraneous",2);return true}},E}(i);e.TIface=re;function x(w){return new b(n(w))}e.opt=x;var b=function(w){t(E,w);function E(D){var L=w.call(this)||this;return L.ttype=D,L}return E.prototype.getChecker=function(D,L){var j=this.ttype.getChecker(D,L);return function(se,ne){return se===void 0||j(se,ne)}},E}(i);e.TOptional=b;var v=function(){function w(E,D,L){this.name=E,this.ttype=D,this.isOpt=L}return w}();e.TProp=v;function V(w){for(var E=[],D=1;D<arguments.length;D++)E[D-1]=arguments[D];return new W(new O(E),n(w))}e.func=V;var W=function(w){t(E,w);function E(D,L){var j=w.call(this)||this;return j.paramList=D,j.result=L,j}return E.prototype.getChecker=function(D,L){return function(j,se){return typeof j=="function"?true:se.fail(null,"is not a function",0)}},E}(i);e.TFunc=W;function M(w,E,D){return new R(w,n(E),!!D)}e.param=M;var R=function(){function w(E,D,L){this.name=E,this.ttype=D,this.isOpt=L}return w}();e.TParam=R;var O=function(w){t(E,w);function E(D){var L=w.call(this)||this;return L.params=D,L}return E.prototype.getChecker=function(D,L){var j=this,se=this.params.map(function(ke){return ke.ttype.getChecker(D,L)}),ne=new s.NoopContext,de=this.params.map(function(ke,Fe){return!ke.isOpt&&!se[Fe](void 0,ne)}),Se=function(ke,Fe){if(!Array.isArray(ke))return Fe.fail(null,"is not an array",0);for(var Xe=0;Xe<se.length;Xe++){var Ce=j.params[Xe];if(ke[Xe]===void 0){if(de[Xe])return Fe.fail(Ce.name,"is missing",1)}else{var Ve=se[Xe](ke[Xe],Fe);if(!Ve)return Fe.fail(Ce.name,null,1)}}return true};return L?function(ke,Fe){return Se(ke,Fe)?ke.length<=se.length?true:Fe.fail(se.length,"is extraneous",2):false}:Se},E}(i);e.TParamList=O;var U=function(w){t(E,w);function E(D,L){var j=w.call(this)||this;return j.validator=D,j.message=L,j}return E.prototype.getChecker=function(D,L){var j=this;return function(se,ne){return j.validator(se)?true:ne.fail(null,j.message,0)}},E}(i);e.BasicType=U,e.basicTypes={any:new U(function(w){return true},"is invalid"),number:new U(function(w){return typeof w=="number"},"is not a number"),object:new U(function(w){return typeof w=="object"&&w},"is not an object"),boolean:new U(function(w){return typeof w=="boolean"},"is not a boolean"),string:new U(function(w){return typeof w=="string"},"is not a string"),symbol:new U(function(w){return typeof w=="symbol"},"is not a symbol"),void:new U(function(w){return w==null},"is not void"),undefined:new U(function(w){return w===void 0},"is not undefined"),null:new U(function(w){return w===null},"is not null"),never:new U(function(w){return false},"is unexpected"),Date:new U(H("[object Date]"),"is not a Date"),RegExp:new U(H("[object RegExp]"),"is not a RegExp")};var I=Object.prototype.toString;function H(w){return function(E){return typeof E=="object"&&E&&I.call(E)===w}}typeof Buffer<"u"&&(e.basicTypes.Buffer=new U(function(w){return Buffer.isBuffer(w)},"is not a Buffer"));for(var G=function(w){e.basicTypes[w.name]=new U(function(E){return E instanceof w},"is not a "+w.name)},te=0,ce=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array,ArrayBuffer];te<ce.length;te++){var oe=ce[te];G(oe)}})(Dn);(function(e){var t=os&&os.__spreadArrays||function(){for(var l=0,h=0,d=arguments.length;h<d;h++)l+=arguments[h].length;for(var m=Array(l),_=0,h=0;h<d;h++)for(var k=arguments[h],T=0,P=k.length;T<P;T++,_++)m[_]=k[T];return m};Object.defineProperty(e,"__esModule",{value:true}),e.Checker=e.createCheckers=void 0;var s=Dn,i=wt,n=Dn;Object.defineProperty(e,"TArray",{enumerable:true,get:function(){return n.TArray}}),Object.defineProperty(e,"TEnumType",{enumerable:true,get:function(){return n.TEnumType}}),Object.defineProperty(e,"TEnumLiteral",{enumerable:true,get:function(){return n.TEnumLiteral}}),Object.defineProperty(e,"TFunc",{enumerable:true,get:function(){return n.TFunc}}),Object.defineProperty(e,"TIface",{enumerable:true,get:function(){return n.TIface}}),Object.defineProperty(e,"TLiteral",{enumerable:true,get:function(){return n.TLiteral}}),Object.defineProperty(e,"TName",{enumerable:true,get:function(){return n.TName}}),Object.defineProperty(e,"TOptional",{enumerable:true,get:function(){return n.TOptional}}),Object.defineProperty(e,"TParam",{enumerable:true,get:function(){return n.TParam}}),Object.defineProperty(e,"TParamList",{enumerable:true,get:function(){return n.TParamList}}),Object.defineProperty(e,"TProp",{enumerable:true,get:function(){return n.TProp}}),Object.defineProperty(e,"TTuple",{enumerable:true,get:function(){return n.TTuple}}),Object.defineProperty(e,"TType",{enumerable:true,get:function(){return n.TType}}),Object.defineProperty(e,"TUnion",{enumerable:true,get:function(){return n.TUnion}}),Object.defineProperty(e,"TIntersection",{enumerable:true,get:function(){return n.TIntersection}}),Object.defineProperty(e,"array",{enumerable:true,get:function(){return n.array}}),Object.defineProperty(e,"enumlit",{enumerable:true,get:function(){return n.enumlit}}),Object.defineProperty(e,"enumtype",{enumerable:true,get:function(){return n.enumtype}}),Object.defineProperty(e,"func",{enumerable:true,get:function(){return n.func}}),Object.defineProperty(e,"iface",{enumerable:true,get:function(){return n.iface}}),Object.defineProperty(e,"lit",{enumerable:true,get:function(){return n.lit}}),Object.defineProperty(e,"name",{enumerable:true,get:function(){return n.name}}),Object.defineProperty(e,"opt",{enumerable:true,get:function(){return n.opt}}),Object.defineProperty(e,"param",{enumerable:true,get:function(){return n.param}}),Object.defineProperty(e,"tuple",{enumerable:true,get:function(){return n.tuple}}),Object.defineProperty(e,"union",{enumerable:true,get:function(){return n.union}}),Object.defineProperty(e,"intersection",{enumerable:true,get:function(){return n.intersection}}),Object.defineProperty(e,"BasicType",{enumerable:true,get:function(){return n.BasicType}});var a=wt;Object.defineProperty(e,"VError",{enumerable:true,get:function(){return a.VError}});function o(){for(var l=[],h=0;h<arguments.length;h++)l[h]=arguments[h];for(var d=Object.assign.apply(Object,t([{},s.basicTypes],l)),m={},_=0,k=l;_<k.length;_++)for(var T=k[_],P=0,F=Object.keys(T);P<F.length;P++){var B=F[P];m[B]=new u(d,T[B])}return m}e.createCheckers=o;var u=function(){function l(h,d,m){if(m===void 0&&(m="value"),this.suite=h,this.ttype=d,this._path=m,this.props=new Map,d instanceof s.TIface)for(var _=0,k=d.props;_<k.length;_++){var T=k[_];this.props.set(T.name,T.ttype)}this.checkerPlain=this.ttype.getChecker(h,false),this.checkerStrict=this.ttype.getChecker(h,true)}return l.prototype.setReportedPath=function(h){this._path=h},l.prototype.check=function(h){return this._doCheck(this.checkerPlain,h)},l.prototype.test=function(h){return this.checkerPlain(h,new i.NoopContext)},l.prototype.validate=function(h){return this._doValidate(this.checkerPlain,h)},l.prototype.strictCheck=function(h){return this._doCheck(this.checkerStrict,h)},l.prototype.strictTest=function(h){return this.checkerStrict(h,new i.NoopContext)},l.prototype.strictValidate=function(h){return this._doValidate(this.checkerStrict,h)},l.prototype.getProp=function(h){var d=this.props.get(h);if(!d)throw new Error("Type has no property "+h);return new l(this.suite,d,this._path+"."+h)},l.prototype.methodArgs=function(h){var d=this._getMethod(h);return new l(this.suite,d.paramList)},l.prototype.methodResult=function(h){var d=this._getMethod(h);return new l(this.suite,d.result)},l.prototype.getArgs=function(){if(!(this.ttype instanceof s.TFunc))throw new Error("getArgs() applied to non-function");return new l(this.suite,this.ttype.paramList)},l.prototype.getResult=function(){if(!(this.ttype instanceof s.TFunc))throw new Error("getResult() applied to non-function");return new l(this.suite,this.ttype.result)},l.prototype.getType=function(){return this.ttype},l.prototype._doCheck=function(h,d){var m=new i.NoopContext;if(!h(d,m)){var _=new i.DetailContext;throw h(d,_),_.getError(this._path)}},l.prototype._doValidate=function(h,d){var m=new i.NoopContext;if(h(d,m))return null;var _=new i.DetailContext;return h(d,_),_.getErrorDetail(this._path)},l.prototype._getMethod=function(h){var d=this.props.get(h);if(!d)throw new Error("Type has no property "+h);if(!(d instanceof s.TFunc))throw new Error("Property "+h+" is not a method");return d},l}();e.Checker=u})(we);const Bp=we.union(we.lit("jsx"),we.lit("typescript"),we.lit("flow"),we.lit("imports"),we.lit("react-hot-loader"),we.lit("jest")),Vp=we.iface([],{compiledFilename:"string"}),jp=we.iface([],{transforms:we.array("Transform"),disableESTransforms:we.opt("boolean"),jsxRuntime:we.opt(we.union(we.lit("classic"),we.lit("automatic"),we.lit("preserve"))),production:we.opt("boolean"),jsxImportSource:we.opt("string"),jsxPragma:we.opt("string"),jsxFragmentPragma:we.opt("string"),keepUnusedImports:we.opt("boolean"),preserveDynamicImport:we.opt("boolean"),injectCreateRequireForImportRequire:we.opt("boolean"),enableLegacyTypeScriptModuleInterop:we.opt("boolean"),enableLegacyBabel5ModuleInterop:we.opt("boolean"),sourceMapOptions:we.opt("SourceMapOptions"),filePath:we.opt("string")}),$p={Transform:Bp,SourceMapOptions:Vp,Options:jp},{Options:qp}=we.createCheckers($p);function Hp(e){qp.strictCheck(e)}function qu(){C(),Oe(false)}function Hu(e){C(),er(e)}function es(e){ae(),ya(e)}function Pi(){ae(),c.tokens[c.tokens.length-1].identifierRole=ie.ImportDeclaration}function ya(e){let t;c.scopeDepth===0?t=ie.TopLevelDeclaration:e?t=ie.BlockScopedDeclaration:t=ie.FunctionScopedDeclaration,c.tokens[c.tokens.length-1].identifierRole=t}function er(e){switch(c.type){case r._this:{const t=pe(0);C(),fe(t);return}case r._yield:case r.name:{c.type=r.name,es(e);return}case r.bracketL:{C(),_a(r.bracketR,e,true);return}case r.braceL:Ra(true,e);return;default:le()}}function _a(e,t,s=false,i=false,n=0){let a=true,o=false;const u=c.tokens.length;for(;!S(e)&&!c.error;)if(a?a=false:(A(r.comma),c.tokens[c.tokens.length-1].contextId=n,!o&&c.tokens[u].isType&&(c.tokens[c.tokens.length-1].isType=true,o=true)),!(s&&p(r.comma))){if(S(e))break;if(p(r.ellipsis)){Hu(t),Wu(),S(r.comma),A(e);break}else Wp(i,t)}}function Wp(e,t){e&&xa([g._public,g._protected,g._private,g._readonly,g._override]),Li(t),Wu(),Li(t,true)}function Wu(){_e?u0():me&&Jd()}function Li(e,t=false){if(t||er(e),!S(r.eq))return;const s=c.tokens.length-1;Oe(),c.tokens[s].rhsEndIndex=c.tokens.length}function Nn(){return p(r.name)}function Gp(){return p(r.name)||!!(c.type&r.IS_KEYWORD)||p(r.string)||p(r.num)||p(r.bigint)||p(r.decimal)}function Gu(){const e=c.snapshot();return C(),(p(r.bracketL)||p(r.braceL)||p(r.star)||p(r.ellipsis)||p(r.hash)||Gp())&&!We()?true:(c.restoreFromSnapshot(e),false)}function xa(e){for(;Xu(e)!==null;);}function Xu(e){if(!p(r.name))return null;const t=c.contextualKeyword;if(e.indexOf(t)!==-1&&Gu()){switch(t){case g._readonly:c.tokens[c.tokens.length-1].type=r._readonly;break;case g._abstract:c.tokens[c.tokens.length-1].type=r._abstract;break;case g._static:c.tokens[c.tokens.length-1].type=r._static;break;case g._public:c.tokens[c.tokens.length-1].type=r._public;break;case g._private:c.tokens[c.tokens.length-1].type=r._private;break;case g._protected:c.tokens[c.tokens.length-1].type=r._protected;break;case g._override:c.tokens[c.tokens.length-1].type=r._override;break;case g._declare:c.tokens[c.tokens.length-1].type=r._declare;break}return t}return null}function ni(){for(ae();S(r.dot);)ae()}function Xp(){ni(),!We()&&p(r.lessThan)&&Is()}function Yp(){C(),ai()}function zp(){C()}function Kp(){A(r._typeof),p(r._import)?Yu():ni(),!We()&&p(r.lessThan)&&Is()}function Yu(){A(r._import),A(r.parenL),A(r.string),A(r.parenR),S(r.dot)&&ni(),p(r.lessThan)&&Is()}function Zp(){S(r._const);const e=S(r._in),t=Le(g._out);S(r._const),(e||t)&&!p(r.name)?c.tokens[c.tokens.length-1].type=r.name:ae(),S(r._extends)&&Ie(),S(r.eq)&&Ie()}function fs(){p(r.lessThan)&&tr()}function tr(){const e=pe(0);for(p(r.lessThan)||p(r.typeParameterStart)?C():le();!S(r.greaterThan)&&!c.error;)Zp(),S(r.comma);fe(e)}function va(e){const t=e===r.arrow;fs(),A(r.parenL),c.scopeDepth++,Qp(false),c.scopeDepth--,(t||p(e))&&zs(e)}function Qp(e){_a(r.parenR,e)}function Di(){S(r.comma)||Ee()}function Fo(){va(r.colon),Di()}function Jp(){const e=c.snapshot();C();const t=S(r.name)&&p(r.colon);return c.restoreFromSnapshot(e),t}function zu(){if(!(p(r.bracketL)&&Jp()))return false;const e=pe(0);return A(r.bracketL),ae(),ai(),A(r.bracketR),As(),Di(),fe(e),true}function Uo(e){S(r.question),!e&&(p(r.parenL)||p(r.lessThan))?(va(r.colon),Di()):(As(),Di())}function ed(){if(p(r.parenL)||p(r.lessThan)){Fo();return}if(p(r._new)){C(),p(r.parenL)||p(r.lessThan)?Fo():Uo(false);return}const e=!!Xu([g._readonly]);zu()||((ee(g._get)||ee(g._set))&&Gu(),Ks(-1),Uo(e))}function td(){Ku()}function Ku(){for(A(r.braceL);!S(r.braceR)&&!c.error;)ed()}function sd(){const e=c.snapshot(),t=id();return c.restoreFromSnapshot(e),t}function id(){return C(),S(r.plus)||S(r.minus)?ee(g._readonly):(ee(g._readonly)&&C(),!p(r.bracketL)||(C(),!Nn())?false:(C(),p(r._in)))}function rd(){ae(),A(r._in),Ie()}function nd(){A(r.braceL),p(r.plus)||p(r.minus)?(C(),Re(g._readonly)):Le(g._readonly),A(r.bracketL),rd(),Le(g._as)&&Ie(),A(r.bracketR),p(r.plus)||p(r.minus)?(C(),A(r.question)):S(r.question),_d(),Ee(),A(r.braceR)}function ad(){for(A(r.bracketL);!S(r.bracketR)&&!c.error;)od(),S(r.comma)}function od(){S(r.ellipsis)?Ie():(Ie(),S(r.question)),S(r.colon)&&Ie()}function cd(){A(r.parenL),Ie(),A(r.parenR)}function ud(){for(Xt(),Xt();!p(r.backQuote)&&!c.error;)A(r.dollarBraceL),Ie(),Xt(),Xt();C()}var Yt;(function(e){e[e.TSFunctionType=0]="TSFunctionType";const s=1;e[e.TSConstructorType=s]="TSConstructorType";const i=s+1;e[e.TSAbstractConstructorType=i]="TSAbstractConstructorType"})(Yt||(Yt={}));function mn(e){e===Yt.TSAbstractConstructorType&&Re(g._abstract),(e===Yt.TSConstructorType||e===Yt.TSAbstractConstructorType)&&A(r._new);const t=c.inDisallowConditionalTypesContext;c.inDisallowConditionalTypesContext=false,va(r.arrow),c.inDisallowConditionalTypesContext=t}function ld(){switch(c.type){case r.name:Xp();return;case r._void:case r._null:C();return;case r.string:case r.num:case r.bigint:case r.decimal:case r._true:case r._false:ks();return;case r.minus:C(),ks();return;case r._this:{zp(),ee(g._is)&&!We()&&Yp();return}case r._typeof:Kp();return;case r._import:Yu();return;case r.braceL:sd()?nd():td();return;case r.bracketL:ad();return;case r.parenL:cd();return;case r.backQuote:ud();return;default:if(c.type&r.IS_KEYWORD){C(),c.tokens[c.tokens.length-1].type=r.name;return}break}le()}function hd(){for(ld();!We()&&S(r.bracketL);)S(r.bracketR)||(Ie(),A(r.bracketR))}function fd(){if(Re(g._infer),ae(),p(r._extends)){const e=c.snapshot();A(r._extends);const t=c.inDisallowConditionalTypesContext;c.inDisallowConditionalTypesContext=true,Ie(),c.inDisallowConditionalTypesContext=t,(c.error||!c.inDisallowConditionalTypesContext&&p(r.question))&&c.restoreFromSnapshot(e)}}function Fn(){if(ee(g._keyof)||ee(g._unique)||ee(g._readonly))C(),Fn();else if(ee(g._infer))fd();else{const e=c.inDisallowConditionalTypesContext;c.inDisallowConditionalTypesContext=false,hd(),c.inDisallowConditionalTypesContext=e}}function Mo(){if(S(r.bitwiseAND),Fn(),p(r.bitwiseAND))for(;S(r.bitwiseAND);)Fn()}function pd(){if(S(r.bitwiseOR),Mo(),p(r.bitwiseOR))for(;S(r.bitwiseOR);)Mo()}function dd(){return p(r.lessThan)?true:p(r.parenL)&&gd()}function md(){if(p(r.name)||p(r._this))return C(),true;if(p(r.braceL)||p(r.bracketL)){let e=1;for(C();e>0&&!c.error;)p(r.braceL)||p(r.bracketL)?e++:(p(r.braceR)||p(r.bracketR))&&e--,C();return true}return false}function gd(){const e=c.snapshot(),t=bd();return c.restoreFromSnapshot(e),t}function bd(){return C(),!!(p(r.parenR)||p(r.ellipsis)||md()&&(p(r.colon)||p(r.comma)||p(r.question)||p(r.eq)||p(r.parenR)&&(C(),p(r.arrow))))}function zs(e){const t=pe(0);A(e),xd()||Ie(),fe(t)}function yd(){p(r.colon)&&zs(r.colon)}function As(){p(r.colon)&&ai()}function _d(){S(r.colon)&&Ie()}function xd(){const e=c.snapshot();return ee(g._asserts)?(C(),Le(g._is)?(Ie(),true):Nn()||p(r._this)?(C(),Le(g._is)&&Ie(),true):(c.restoreFromSnapshot(e),false)):Nn()||p(r._this)?(C(),ee(g._is)&&!We()?(C(),Ie(),true):(c.restoreFromSnapshot(e),false)):false}function ai(){const e=pe(0);A(r.colon),Ie(),fe(e)}function Ie(){if(Oo(),c.inDisallowConditionalTypesContext||We()||!S(r._extends))return;const e=c.inDisallowConditionalTypesContext;c.inDisallowConditionalTypesContext=true,Oo(),c.inDisallowConditionalTypesContext=e,A(r.question),Ie(),A(r.colon),Ie()}function vd(){return ee(g._abstract)&&Ae()===r._new}function Oo(){if(dd()){mn(Yt.TSFunctionType);return}if(p(r._new)){mn(Yt.TSConstructorType);return}else if(vd()){mn(Yt.TSAbstractConstructorType);return}pd()}function kd(){const e=pe(1);Ie(),A(r.greaterThan),fe(e),oi()}function wd(){if(S(r.jsxTagStart)){c.tokens[c.tokens.length-1].type=r.typeParameterStart;const e=pe(1);for(;!p(r.greaterThan)&&!c.error;)Ie(),S(r.comma);at(),fe(e)}}function Zu(){for(;!p(r.braceL)&&!c.error;)Sd(),S(r.comma)}function Sd(){ni(),p(r.lessThan)&&Is()}function Ed(){es(false),fs(),S(r._extends)&&Zu(),Ku()}function Td(){es(false),fs(),A(r.eq),Ie(),Ee()}function Ad(){if(p(r.string)?ks():ae(),S(r.eq)){const e=c.tokens.length-1;Oe(),c.tokens[e].rhsEndIndex=c.tokens.length}}function ka(){for(es(false),A(r.braceL);!S(r.braceR)&&!c.error;)Ad(),S(r.comma)}function wa(){A(r.braceL),nr(r.braceR)}function Un(){es(false),S(r.dot)?Un():wa()}function Qu(){ee(g._global)?ae():p(r.string)?Bt():le(),p(r.braceL)?wa():Ee()}function Mn(){Pi(),A(r.eq),Cd(),Ee()}function Id(){return ee(g._require)&&Ae()===r.parenL}function Cd(){Id()?Rd():ni()}function Rd(){Re(g._require),A(r.parenL),p(r.string)||le(),ks(),A(r.parenR)}function Pd(){if(vt())return false;switch(c.type){case r._function:{const e=pe(1);C();const t=c.start;return us(t,true),fe(e),true}case r._class:{const e=pe(1);return ls(true,false),fe(e),true}case r._const:if(p(r._const)&&ma(g._enum)){const e=pe(1);return A(r._const),Re(g._enum),c.tokens[c.tokens.length-1].type=r._enum,ka(),fe(e),true}case r._var:case r._let:{const e=pe(1);return bi(c.type!==r._var),fe(e),true}case r.name:{const e=pe(1),t=c.contextualKeyword;let s=false;return t===g._global?(Qu(),s=true):s=sr(t,true),fe(e),s}default:return false}}function Bo(){return sr(c.contextualKeyword,true)}function Ld(e){switch(e){case g._declare:{const t=c.tokens.length-1;if(Pd())return c.tokens[t].type=r._declare,true;break}case g._global:if(p(r.braceL))return wa(),true;break;default:return sr(e,false)}return false}function sr(e,t){switch(e){case g._abstract:if(ms(t)&&p(r._class))return c.tokens[c.tokens.length-1].type=r._abstract,ls(true,false),true;break;case g._enum:if(ms(t)&&p(r.name))return c.tokens[c.tokens.length-1].type=r._enum,ka(),true;break;case g._interface:if(ms(t)&&p(r.name)){const s=pe(t?2:1);return Ed(),fe(s),true}break;case g._module:if(ms(t)){if(p(r.string)){const s=pe(t?2:1);return Qu(),fe(s),true}else if(p(r.name)){const s=pe(t?2:1);return Un(),fe(s),true}}break;case g._namespace:if(ms(t)&&p(r.name)){const s=pe(t?2:1);return Un(),fe(s),true}break;case g._type:if(ms(t)&&p(r.name)){const s=pe(t?2:1);return Td(),fe(s),true}break}return false}function ms(e){return e?(C(),true):!vt()}function Dd(){const e=c.snapshot();return tr(),Cs(),yd(),A(r.arrow),c.error?(c.restoreFromSnapshot(e),false):(ci(true),true)}function Sa(){c.type===r.bitShiftL&&(c.pos-=1,ue(r.lessThan)),Is()}function Is(){const e=pe(0);for(A(r.lessThan);!p(r.greaterThan)&&!c.error;)Ie(),S(r.comma);e?(A(r.greaterThan),fe(e)):(fe(e),Lu(),A(r.greaterThan),c.tokens[c.tokens.length-1].isType=true)}function Ju(){if(p(r.name))switch(c.contextualKeyword){case g._abstract:case g._declare:case g._enum:case g._interface:case g._module:case g._namespace:case g._type:return true}return false}function Nd(e,t){if(p(r.colon)&&zs(r.colon),!p(r.braceL)&&vt()){let s=c.tokens.length-1;for(;s>=0&&(c.tokens[s].start>=e||c.tokens[s].type===r._default||c.tokens[s].type===r._export);)c.tokens[s].isType=true,s--;return}ci(false,t)}function Fd(e,t,s){if(!We()&&S(r.bang)){c.tokens[c.tokens.length-1].type=r.nonNullAssertion;return}if(p(r.lessThan)||p(r.bitShiftL)){const i=c.snapshot();if(!t&&ol()&&Dd())return;if(Sa(),!t&&S(r.parenL)?(c.tokens[c.tokens.length-1].subscriptStartIndex=e,zt()):p(r.backQuote)?Ca():(c.type===r.greaterThan||c.type!==r.parenL&&c.type&r.IS_EXPRESSION_START&&!We())&&le(),c.error)c.restoreFromSnapshot(i);else return}else!t&&p(r.questionDot)&&Ae()===r.lessThan&&(C(),c.tokens[e].isOptionalChainStart=true,c.tokens[c.tokens.length-1].subscriptStartIndex=e,Is(),A(r.parenL),zt());Ta(e,t,s)}function Ud(){if(S(r._import))return ee(g._type)&&Ae()!==r.eq&&Re(g._type),Mn(),true;if(S(r.eq))return Me(),Ee(),true;if(Le(g._as))return Re(g._namespace),ae(),Ee(),true;if(ee(g._type)){const e=Ae();(e===r.braceL||e===r.star)&&C()}return false}function Md(){if(ae(),p(r.comma)||p(r.braceR)){c.tokens[c.tokens.length-1].identifierRole=ie.ImportDeclaration;return}if(ae(),p(r.comma)||p(r.braceR)){c.tokens[c.tokens.length-1].identifierRole=ie.ImportDeclaration,c.tokens[c.tokens.length-2].isType=true,c.tokens[c.tokens.length-1].isType=true;return}if(ae(),p(r.comma)||p(r.braceR)){c.tokens[c.tokens.length-3].identifierRole=ie.ImportAccess,c.tokens[c.tokens.length-1].identifierRole=ie.ImportDeclaration;return}ae(),c.tokens[c.tokens.length-3].identifierRole=ie.ImportAccess,c.tokens[c.tokens.length-1].identifierRole=ie.ImportDeclaration,c.tokens[c.tokens.length-4].isType=true,c.tokens[c.tokens.length-3].isType=true,c.tokens[c.tokens.length-2].isType=true,c.tokens[c.tokens.length-1].isType=true}function Od(){if(ae(),p(r.comma)||p(r.braceR)){c.tokens[c.tokens.length-1].identifierRole=ie.ExportAccess;return}if(ae(),p(r.comma)||p(r.braceR)){c.tokens[c.tokens.length-1].identifierRole=ie.ExportAccess,c.tokens[c.tokens.length-2].isType=true,c.tokens[c.tokens.length-1].isType=true;return}if(ae(),p(r.comma)||p(r.braceR)){c.tokens[c.tokens.length-3].identifierRole=ie.ExportAccess;return}ae(),c.tokens[c.tokens.length-3].identifierRole=ie.ExportAccess,c.tokens[c.tokens.length-4].isType=true,c.tokens[c.tokens.length-3].isType=true,c.tokens[c.tokens.length-2].isType=true,c.tokens[c.tokens.length-1].isType=true}function Bd(){if(ee(g._abstract)&&Ae()===r._class)return c.type=r._abstract,C(),ls(true,true),true;if(ee(g._interface)){const e=pe(2);return sr(g._interface,true),fe(e),true}return false}function Vd(){if(c.type===r._const){const e=ri();if(e.type===r.name&&e.contextualKeyword===g._enum)return A(r._const),Re(g._enum),c.tokens[c.tokens.length-1].type=r._enum,ka(),true}return false}function jd(e){const t=c.tokens.length;xa([g._abstract,g._readonly,g._declare,g._static,g._override]);const s=c.tokens.length;if(zu()){const n=e?t-1:t;for(let a=n;a<s;a++)c.tokens[a].isType=true;return true}return false}function $d(e){Ld(e)||Ee()}function qd(){const e=Le(g._declare);e&&(c.tokens[c.tokens.length-1].type=r._declare);let t=false;if(p(r.name))if(e){const s=pe(2);t=Bo(),fe(s)}else t=Bo();if(!t)if(e){const s=pe(2);st(true),fe(s)}else st(true)}function Hd(e){if(e&&(p(r.lessThan)||p(r.bitShiftL))&&Sa(),Le(g._implements)){c.tokens[c.tokens.length-1].type=r._implements;const t=pe(1);Zu(),fe(t)}}function Wd(){fs()}function Gd(){fs()}function Xd(){const e=pe(0);We()||S(r.bang),As(),fe(e)}function Yd(){p(r.colon)&&ai()}function zd(e,t){return Qi?Kd(e,t):Zd(e,t)}function Kd(e,t){if(!p(r.lessThan))return St(e,t);const s=c.snapshot();let i=St(e,t);if(c.error)c.restoreFromSnapshot(s);else return i;return c.type=r.typeParameterStart,tr(),i=St(e,t),i||le(),i}function Zd(e,t){if(!p(r.lessThan))return St(e,t);const s=c.snapshot();tr();const i=St(e,t);if(i||le(),c.error)c.restoreFromSnapshot(s);else return i;return St(e,t)}function Qd(){if(p(r.colon)){const e=c.snapshot();zs(r.colon),tt()&&le(),p(r.arrow)||le(),c.error&&c.restoreFromSnapshot(e)}return S(r.arrow)}function Jd(){const e=pe(0);S(r.question),As(),fe(e)}function em(){(p(r.lessThan)||p(r.bitShiftL))&&Sa(),_l()}function tm(){let e=false,t=false;for(;;){if(c.pos>=$.length){le("Unterminated JSX contents");return}const s=$.charCodeAt(c.pos);if(s===y.lessThan||s===y.leftCurlyBrace){if(c.pos===c.start){if(s===y.lessThan){c.pos++,ue(r.jsxTagStart);return}Du(s);return}ue(e&&!t?r.jsxEmptyText:r.jsxText);return}s===y.lineFeed?e=true:s!==y.space&&s!==y.carriageReturn&&s!==y.tab&&(t=true),c.pos++}}function sm(e){for(c.pos++;;){if(c.pos>=$.length){le("Unterminated string constant");return}if($.charCodeAt(c.pos)===e){c.pos++;break}c.pos++}ue(r.string)}function im(){let e;do{if(c.pos>$.length){le("Unexpectedly reached the end of input.");return}e=$.charCodeAt(++c.pos)}while(mt[e]||e===y.dash);ue(r.jsxName)}function On(){at()}function el(e){if(On(),!S(r.colon)){c.tokens[c.tokens.length-1].identifierRole=e;return}On()}function tl(){const e=c.tokens.length;el(ie.Access);let t=false;for(;p(r.dot);)t=true,at(),On();if(!t){const s=c.tokens[e],i=$.charCodeAt(s.start);i>=y.lowercaseA&&i<=y.lowercaseZ&&(s.identifierRole=null)}}function rm(){switch(c.type){case r.braceL:C(),Me(),at();return;case r.jsxTagStart:il(),at();return;case r.string:at();return;default:le("JSX value should be either an expression or a quoted JSX text")}}function nm(){A(r.ellipsis),Me()}function am(e){if(p(r.jsxTagEnd))return false;tl(),me&&wd();let t=false;for(;!p(r.slash)&&!p(r.jsxTagEnd)&&!c.error;){if(S(r.braceL)){t=true,A(r.ellipsis),Oe(),at();continue}t&&c.end-c.start===3&&$.charCodeAt(c.start)===y.lowercaseK&&$.charCodeAt(c.start+1)===y.lowercaseE&&$.charCodeAt(c.start+2)===y.lowercaseY&&(c.tokens[e].jsxRole=ft.KeyAfterPropSpread),el(ie.ObjectKey),p(r.eq)&&(at(),rm())}const s=p(r.slash);return s&&at(),s}function om(){p(r.jsxTagEnd)||tl()}function sl(){const e=c.tokens.length-1;c.tokens[e].jsxRole=ft.NoChildren;let t=0;if(!am(e))for(gs();;)switch(c.type){case r.jsxTagStart:if(at(),p(r.slash)){at(),om(),c.tokens[e].jsxRole!==ft.KeyAfterPropSpread&&(t===1?c.tokens[e].jsxRole=ft.OneChild:t>1&&(c.tokens[e].jsxRole=ft.StaticChildren));return}t++,sl(),gs();break;case r.jsxText:t++,gs();break;case r.jsxEmptyText:gs();break;case r.braceL:C(),p(r.ellipsis)?(nm(),gs(),t+=2):(p(r.braceR)||(t++,Me()),gs());break;default:le();return}}function il(){at(),sl()}function at(){c.tokens.push(new Ji),Ru(),c.start=c.pos;const e=$.charCodeAt(c.pos);if(ii[e])im();else if(e===y.quotationMark||e===y.apostrophe)sm(e);else switch(++c.pos,e){case y.greaterThan:ue(r.jsxTagEnd);break;case y.lessThan:ue(r.jsxTagStart);break;case y.slash:ue(r.slash);break;case y.equalsTo:ue(r.eq);break;case y.leftCurlyBrace:ue(r.braceL);break;case y.dot:ue(r.dot);break;case y.colon:ue(r.colon);break;default:le()}}function gs(){c.tokens.push(new Ji),c.start=c.pos,tm()}function cm(e){if(p(r.question)){const t=Ae();if(t===r.colon||t===r.comma||t===r.parenR)return}rl(e)}function um(){Eu(r.question),p(r.colon)&&(me?ai():_e&&ps())}class lm{constructor(t){this.stop=t}}function Me(e=false){if(Oe(e),p(r.comma))for(;S(r.comma);)Oe(e)}function Oe(e=false,t=false){return me?zd(e,t):_e?m0(e,t):St(e,t)}function St(e,t){if(p(r._yield))return Tm(),false;(p(r.parenL)||p(r.name)||p(r._yield))&&(c.potentialArrowAt=c.start);const s=hm(e);return t&&Ia(),c.type&r.IS_ASSIGN?(C(),Oe(e),false):s}function hm(e){return pm(e)?true:(fm(e),false)}function fm(e){me||_e?cm(e):rl(e)}function rl(e){S(r.question)&&(Oe(),A(r.colon),Oe(e))}function pm(e){const t=c.tokens.length;return oi()?true:(mi(t,-1,e),false)}function mi(e,t,s){if(me&&(r._in&r.PRECEDENCE_MASK)>t&&!We()&&(Le(g._as)||Le(g._satisfies))){const n=pe(1);Ie(),fe(n),Lu(),mi(e,t,s);return}const i=c.type&r.PRECEDENCE_MASK;if(i>0&&(!s||!p(r._in))&&i>t){const n=c.type;C(),n===r.nullishCoalescing&&(c.tokens[c.tokens.length-1].nullishStartIndex=e);const a=c.tokens.length;oi(),mi(a,n&r.IS_RIGHT_ASSOCIATIVE?i-1:i,s),n===r.nullishCoalescing&&(c.tokens[e].numNullishCoalesceStarts++,c.tokens[c.tokens.length-1].numNullishCoalesceEnds++),mi(e,t,s)}}function oi(){if(me&&!Qi&&S(r.lessThan))return kd(),false;if(ee(g._module)&&Au()===y.leftCurlyBrace&&!xu())return Am(),false;if(c.type&r.IS_PREFIX)return C(),oi(),false;if(nl())return true;for(;c.type&r.IS_POSTFIX&&!tt();)c.type===r.preIncDec&&(c.type=r.postIncDec),C();return false}function nl(){const e=c.tokens.length;return Bt()?true:(Ea(e),c.tokens.length>e&&c.tokens[e].isOptionalChainStart&&(c.tokens[c.tokens.length-1].isOptionalChainEnd=true),false)}function Ea(e,t=false){_e?b0(e,t):al(e,t)}function al(e,t=false){const s=new lm(false);do dm(e,t,s);while(!s.stop&&!c.error)}function dm(e,t,s){me?Fd(e,t,s):_e?Zm(e,t,s):Ta(e,t,s)}function Ta(e,t,s){if(!t&&S(r.doubleColon))Aa(),s.stop=true,Ea(e,t);else if(p(r.questionDot)){if(c.tokens[e].isOptionalChainStart=true,t&&Ae()===r.parenL){s.stop=true;return}C(),c.tokens[c.tokens.length-1].subscriptStartIndex=e,S(r.bracketL)?(Me(),A(r.bracketR)):S(r.parenL)?zt():Ni()}else if(S(r.dot))c.tokens[c.tokens.length-1].subscriptStartIndex=e,Ni();else if(S(r.bracketL))c.tokens[c.tokens.length-1].subscriptStartIndex=e,Me(),A(r.bracketR);else if(!t&&p(r.parenL))if(ol()){const i=c.snapshot(),n=c.tokens.length;C(),c.tokens[c.tokens.length-1].subscriptStartIndex=e;const a=Xs();c.tokens[c.tokens.length-1].contextId=a,zt(),c.tokens[c.tokens.length-1].contextId=a,mm()&&(c.restoreFromSnapshot(i),s.stop=true,c.scopeDepth++,Cs(),gm(n))}else{C(),c.tokens[c.tokens.length-1].subscriptStartIndex=e;const i=Xs();c.tokens[c.tokens.length-1].contextId=i,zt(),c.tokens[c.tokens.length-1].contextId=i}else p(r.backQuote)?Ca():s.stop=true}function ol(){return c.tokens[c.tokens.length-1].contextualKeyword===g._async&&!tt()}function zt(){let e=true;for(;!S(r.parenR)&&!c.error;){if(e)e=false;else if(A(r.comma),S(r.parenR))break;hl(false)}}function mm(){return p(r.colon)||p(r.arrow)}function gm(e){me?Yd():_e&&d0(),A(r.arrow),Zs(e)}function Aa(){const e=c.tokens.length;Bt(),Ea(e,true)}function Bt(){if(S(r.modulo))return ae(),false;if(p(r.jsxText)||p(r.jsxEmptyText))return ks(),false;if(p(r.lessThan)&&Qi)return c.type=r.jsxTagStart,il(),C(),false;const e=c.potentialArrowAt===c.start;switch(c.type){case r.slash:case r.assign:Bf();case r._super:case r._this:case r.regexp:case r.num:case r.bigint:case r.decimal:case r.string:case r._null:case r._true:case r._false:return C(),false;case r._import:return C(),p(r.dot)&&(c.tokens[c.tokens.length-1].type=r.name,C(),ae()),false;case r.name:{const t=c.tokens.length,s=c.start,i=c.contextualKeyword;return ae(),i===g._await?(Em(),false):i===g._async&&p(r._function)&&!tt()?(C(),us(s,false),false):e&&i===g._async&&!tt()&&p(r.name)?(c.scopeDepth++,es(false),A(r.arrow),Zs(t),true):p(r._do)&&!tt()?(C(),Kt(),false):e&&!tt()&&p(r.arrow)?(c.scopeDepth++,ya(false),A(r.arrow),Zs(t),true):(c.tokens[c.tokens.length-1].identifierRole=ie.Access,false)}case r._do:return C(),Kt(),false;case r.parenL:return cl(e);case r.bracketL:return C(),ll(r.bracketR,true),false;case r.braceL:return Ra(false,false),false;case r._function:return bm(),false;case r.at:Ba();case r._class:return ls(false),false;case r._new:return _m(),false;case r.backQuote:return Ca(),false;case r.doubleColon:return C(),Aa(),false;case r.hash:{const t=Au();return ii[t]||t===y.backslash?Ni():C(),false}default:return le(),false}}function Ni(){S(r.hash),ae()}function bm(){const e=c.start;ae(),S(r.dot)&&ae(),us(e,false)}function ks(){C()}function ir(){A(r.parenL),Me(),A(r.parenR)}function cl(e){const t=c.snapshot(),s=c.tokens.length;A(r.parenL);let i=true;for(;!p(r.parenR)&&!c.error;){if(i)i=false;else if(A(r.comma),p(r.parenR))break;if(p(r.ellipsis)){Hu(false),Ia();break}else Oe(false,true)}return A(r.parenR),e&&ym()&&Bn()?(c.restoreFromSnapshot(t),c.scopeDepth++,Cs(),Bn(),Zs(s),c.error?(c.restoreFromSnapshot(t),cl(false),false):true):false}function ym(){return p(r.colon)||!tt()}function Bn(){return me?Qd():_e?g0():S(r.arrow)}function Ia(){(me||_e)&&um()}function _m(){if(A(r._new),S(r.dot)){ae();return}xm(),_e&&Qm(),S(r.parenL)&&ll(r.parenR)}function xm(){Aa(),S(r.questionDot)}function Ca(){for(Xt(),Xt();!p(r.backQuote)&&!c.error;)A(r.dollarBraceL),Me(),Xt(),Xt();C()}function Ra(e,t){const s=Xs();let i=true;for(C(),c.tokens[c.tokens.length-1].contextId=s;!S(r.braceR)&&!c.error;){if(i)i=false;else if(A(r.comma),S(r.braceR))break;let n=false;if(p(r.ellipsis)){const a=c.tokens.length;if(qu(),e&&(c.tokens.length===a+2&&ya(t),S(r.braceR)))break;continue}e||(n=S(r.star)),!e&&ee(g._async)?(n&&le(),ae(),p(r.colon)||p(r.parenL)||p(r.braceR)||p(r.eq)||p(r.comma)||(p(r.star)&&(C(),n=true),Ks(s))):Ks(s),Sm(e,t,s)}c.tokens[c.tokens.length-1].contextId=s}function vm(e){return!e&&(p(r.string)||p(r.num)||p(r.bracketL)||p(r.name)||!!(c.type&r.IS_KEYWORD))}function km(e,t){const s=c.start;return p(r.parenL)?(e&&le(),Vn(s,false),true):vm(e)?(Ks(t),Vn(s,false),true):false}function wm(e,t){if(S(r.colon)){e?Li(t):Oe(false);return}let s;e?c.scopeDepth===0?s=ie.ObjectShorthandTopLevelDeclaration:t?s=ie.ObjectShorthandBlockScopedDeclaration:s=ie.ObjectShorthandFunctionScopedDeclaration:s=ie.ObjectShorthand,c.tokens[c.tokens.length-1].identifierRole=s,Li(t,true)}function Sm(e,t,s){me?Wd():_e&&c0(),km(e,s)||wm(e,t)}function Ks(e){_e&&Oa(),S(r.bracketL)?(c.tokens[c.tokens.length-1].contextId=e,Oe(),A(r.bracketR),c.tokens[c.tokens.length-1].contextId=e):(p(r.num)||p(r.string)||p(r.bigint)||p(r.decimal)?Bt():Ni(),c.tokens[c.tokens.length-1].identifierRole=ie.ObjectKey,c.tokens[c.tokens.length-1].contextId=e)}function Vn(e,t){const s=Xs();c.scopeDepth++;const i=c.tokens.length;Cs(t,s),ul(e,s);const a=c.tokens.length;c.scopes.push(new At(i,a,true)),c.scopeDepth--}function Zs(e){ci(true);const t=c.tokens.length;c.scopes.push(new At(e,t,true)),c.scopeDepth--}function ul(e,t=0){me?Nd(e,t):_e?Km(t):ci(false,t)}function ci(e,t=0){e&&!p(r.braceL)?Oe():Kt(true,t)}function ll(e,t=false){let s=true;for(;!S(e)&&!c.error;){if(s)s=false;else if(A(r.comma),S(e))break;hl(t)}}function hl(e){e&&p(r.comma)||(p(r.ellipsis)?(qu(),Ia()):p(r.question)?C():Oe(false,true))}function ae(){C(),c.tokens[c.tokens.length-1].type=r.name}function Em(){oi()}function Tm(){C(),!p(r.semi)&&!tt()&&(S(r.star),Oe())}function Am(){Re(g._module),A(r.braceL),nr(r.braceR)}function Im(e){return(e.type===r.name||!!(e.type&r.IS_KEYWORD))&&e.contextualKeyword!==g._from}function It(e){const t=pe(0);A(e||r.colon),Qe(),fe(t)}function Vo(){A(r.modulo),Re(g._checks),S(r.parenL)&&(Me(),A(r.parenR))}function Pa(){const e=pe(0);A(r.colon),p(r.modulo)?Vo():(Qe(),p(r.modulo)&&Vo()),fe(e)}function Cm(){C(),La(true)}function Rm(){C(),ae(),p(r.lessThan)&&bt(),A(r.parenL),$n(),A(r.parenR),Pa(),Ee()}function jn(){p(r._class)?Cm():p(r._function)?Rm():p(r._var)?Pm():Le(g._module)?S(r.dot)?Nm():Lm():ee(g._type)?Fm():ee(g._opaque)?Um():ee(g._interface)?Mm():p(r._export)?Dm():le()}function Pm(){C(),ml(),Ee()}function Lm(){for(p(r.string)?Bt():ae(),A(r.braceL);!p(r.braceR)&&!c.error;)p(r._import)?(C(),El()):le();A(r.braceR)}function Dm(){A(r._export),S(r._default)?p(r._function)||p(r._class)?jn():(Qe(),Ee()):p(r._var)||p(r._function)||p(r._class)||ee(g._opaque)?jn():p(r.star)||p(r.braceL)||ee(g._interface)||ee(g._type)||ee(g._opaque)?wl():le()}function Nm(){Re(g._exports),ps(),Ee()}function Fm(){C(),Na()}function Um(){C(),Fa(true)}function Mm(){C(),La()}function La(e=false){if(rr(),p(r.lessThan)&&bt(),S(r._extends))do gi();while(!e&&S(r.comma));if(ee(g._mixins)){C();do gi();while(S(r.comma))}if(ee(g._implements)){C();do gi();while(S(r.comma))}Fi(e,false,e)}function gi(){fl(false),p(r.lessThan)&&cs()}function Da(){La()}function rr(){ae()}function Na(){rr(),p(r.lessThan)&&bt(),It(r.eq),Ee()}function Fa(e){Re(g._type),rr(),p(r.lessThan)&&bt(),p(r.colon)&&It(r.colon),e||It(r.eq),Ee()}function Om(){Oa(),ml(),S(r.eq)&&Qe()}function bt(){const e=pe(0);p(r.lessThan)||p(r.typeParameterStart)?C():le();do Om(),p(r.greaterThan)||A(r.comma);while(!p(r.greaterThan)&&!c.error);A(r.greaterThan),fe(e)}function cs(){const e=pe(0);for(A(r.lessThan);!p(r.greaterThan)&&!c.error;)Qe(),p(r.greaterThan)||A(r.comma);A(r.greaterThan),fe(e)}function Bm(){if(Re(g._interface),S(r._extends))do gi();while(S(r.comma));Fi(false,false,false)}function Ua(){p(r.num)||p(r.string)?Bt():ae()}function Vm(){Ae()===r.colon?(Ua(),It()):Qe(),A(r.bracketR),It()}function jm(){Ua(),A(r.bracketR),A(r.bracketR),p(r.lessThan)||p(r.parenL)?Ma():(S(r.question),It())}function Ma(){for(p(r.lessThan)&&bt(),A(r.parenL);!p(r.parenR)&&!p(r.ellipsis)&&!c.error;)Ui(),p(r.parenR)||A(r.comma);S(r.ellipsis)&&Ui(),A(r.parenR),It()}function $m(){Ma()}function Fi(e,t,s){let i;for(t&&p(r.braceBarL)?(A(r.braceBarL),i=r.braceBarR):(A(r.braceL),i=r.braceR);!p(i)&&!c.error;){if(s&&ee(g._proto)){const n=Ae();n!==r.colon&&n!==r.question&&(C(),e=false)}if(e&&ee(g._static)){const n=Ae();n!==r.colon&&n!==r.question&&C()}if(Oa(),S(r.bracketL))S(r.bracketL)?jm():Vm();else if(p(r.parenL)||p(r.lessThan))$m();else{if(ee(g._get)||ee(g._set)){const n=Ae();(n===r.name||n===r.string||n===r.num)&&C()}qm()}Hm()}A(i)}function qm(){if(p(r.ellipsis)){if(A(r.ellipsis),S(r.comma)||S(r.semi),p(r.braceR))return;Qe()}else Ua(),p(r.lessThan)||p(r.parenL)?Ma():(S(r.question),It())}function Hm(){!S(r.semi)&&!S(r.comma)&&!p(r.braceR)&&!p(r.braceBarR)&&le()}function fl(e){for(e||ae();S(r.dot);)ae()}function Wm(){fl(true),p(r.lessThan)&&cs()}function Gm(){A(r._typeof),pl()}function Xm(){for(A(r.bracketL);c.pos<$.length&&!p(r.bracketR)&&(Qe(),!p(r.bracketR));)A(r.comma);A(r.bracketR)}function Ui(){const e=Ae();e===r.colon||e===r.question?(ae(),S(r.question),It()):Qe()}function $n(){for(;!p(r.parenR)&&!p(r.ellipsis)&&!c.error;)Ui(),p(r.parenR)||A(r.comma);S(r.ellipsis)&&Ui()}function pl(){let e=false;const t=c.noAnonFunctionType;switch(c.type){case r.name:{if(ee(g._interface)){Bm();return}ae(),Wm();return}case r.braceL:Fi(false,false,false);return;case r.braceBarL:Fi(false,true,false);return;case r.bracketL:Xm();return;case r.lessThan:bt(),A(r.parenL),$n(),A(r.parenR),A(r.arrow),Qe();return;case r.parenL:if(C(),!p(r.parenR)&&!p(r.ellipsis))if(p(r.name)){const s=Ae();e=s!==r.question&&s!==r.colon}else e=true;if(e)if(c.noAnonFunctionType=false,Qe(),c.noAnonFunctionType=t,c.noAnonFunctionType||!(p(r.comma)||p(r.parenR)&&Ae()===r.arrow)){A(r.parenR);return}else S(r.comma);$n(),A(r.parenR),A(r.arrow),Qe();return;case r.minus:C(),ks();return;case r.string:case r.num:case r._true:case r._false:case r._null:case r._this:case r._void:case r.star:C();return;default:if(c.type===r._typeof){Gm();return}else if(c.type&r.IS_KEYWORD){C(),c.tokens[c.tokens.length-1].type=r.name;return}}le()}function Ym(){for(pl();!tt()&&(p(r.bracketL)||p(r.questionDot));)S(r.questionDot),A(r.bracketL),S(r.bracketR)||(Qe(),A(r.bracketR))}function dl(){S(r.question)?dl():Ym()}function jo(){dl(),!c.noAnonFunctionType&&S(r.arrow)&&Qe()}function $o(){for(S(r.bitwiseAND),jo();S(r.bitwiseAND);)jo()}function zm(){for(S(r.bitwiseOR),$o();S(r.bitwiseOR);)$o()}function Qe(){zm()}function ps(){It()}function ml(){ae(),p(r.colon)&&ps()}function Oa(){(p(r.plus)||p(r.minus))&&(C(),c.tokens[c.tokens.length-1].isType=true)}function Km(e){p(r.colon)&&Pa(),ci(false,e)}function Zm(e,t,s){if(p(r.questionDot)&&Ae()===r.lessThan){if(t){s.stop=true;return}C(),cs(),A(r.parenL),zt();return}else if(!t&&p(r.lessThan)){const i=c.snapshot();if(cs(),A(r.parenL),zt(),c.error)c.restoreFromSnapshot(i);else return}Ta(e,t,s)}function Qm(){if(p(r.lessThan)){const e=c.snapshot();cs(),c.error&&c.restoreFromSnapshot(e)}}function Jm(){if(p(r.name)&&c.contextualKeyword===g._interface){const e=pe(0);return C(),Da(),fe(e),true}else if(ee(g._enum))return gl(),true;return false}function e0(){return ee(g._enum)?(gl(),true):false}function t0(e){if(e===g._declare){if(p(r._class)||p(r.name)||p(r._function)||p(r._var)||p(r._export)){const t=pe(1);jn(),fe(t)}}else if(p(r.name)){if(e===g._interface){const t=pe(1);Da(),fe(t)}else if(e===g._type){const t=pe(1);Na(),fe(t)}else if(e===g._opaque){const t=pe(1);Fa(false),fe(t)}}Ee()}function s0(){return ee(g._type)||ee(g._interface)||ee(g._opaque)||ee(g._enum)}function i0(){return p(r.name)&&(c.contextualKeyword===g._type||c.contextualKeyword===g._interface||c.contextualKeyword===g._opaque||c.contextualKeyword===g._enum)}function r0(){if(ee(g._type)){const e=pe(1);C(),p(r.braceL)?(Va(),Qs()):Na(),fe(e)}else if(ee(g._opaque)){const e=pe(1);C(),Fa(false),fe(e)}else if(ee(g._interface)){const e=pe(1);C(),Da(),fe(e)}else st(true)}function n0(){return p(r.star)||ee(g._type)&&Ae()===r.star}function a0(){if(Le(g._type)){const e=pe(2);qn(),fe(e)}else qn()}function o0(e){if(e&&p(r.lessThan)&&cs(),ee(g._implements)){const t=pe(0);C(),c.tokens[c.tokens.length-1].type=r._implements;do rr(),p(r.lessThan)&&cs();while(S(r.comma));fe(t)}}function c0(){p(r.lessThan)&&(bt(),p(r.parenL)||le())}function u0(){const e=pe(0);S(r.question),p(r.colon)&&ps(),fe(e)}function l0(){if(p(r._typeof)||ee(g._type)){const e=ri();(Im(e)||e.type===r.braceL||e.type===r.star)&&C()}}function h0(){const e=c.contextualKeyword===g._type||c.type===r._typeof;e?C():ae(),ee(g._as)&&!ma(g._as)?(ae(),e&&!p(r.name)&&!(c.type&r.IS_KEYWORD)||ae()):(e&&(p(r.name)||c.type&r.IS_KEYWORD)&&ae(),Le(g._as)&&ae())}function f0(){if(p(r.lessThan)){const e=pe(0);bt(),fe(e)}}function p0(){p(r.colon)&&ps()}function d0(){if(p(r.colon)){const e=c.noAnonFunctionType;c.noAnonFunctionType=true,ps(),c.noAnonFunctionType=e}}function m0(e,t){if(p(r.lessThan)){const s=c.snapshot();let i=St(e,t);if(c.error)c.restoreFromSnapshot(s),c.type=r.typeParameterStart;else return i;const n=pe(0);if(bt(),fe(n),i=St(e,t),i)return true;le()}return St(e,t)}function g0(){if(p(r.colon)){const e=pe(0),t=c.snapshot(),s=c.noAnonFunctionType;c.noAnonFunctionType=true,Pa(),c.noAnonFunctionType=s,tt()&&le(),p(r.arrow)||le(),c.error&&c.restoreFromSnapshot(t),fe(e)}return S(r.arrow)}function b0(e,t=false){if(c.tokens[c.tokens.length-1].contextualKeyword===g._async&&p(r.lessThan)){const s=c.snapshot();if(y0()&&!c.error)return;c.restoreFromSnapshot(s)}al(e,t)}function y0(){c.scopeDepth++;const e=c.tokens.length;return Cs(),Bn()?(Zs(e),true):false}function gl(){Re(g._enum),c.tokens[c.tokens.length-1].type=r._enum,ae(),_0()}function _0(){Le(g._of)&&C(),A(r.braceL),x0(),A(r.braceR)}function x0(){for(;!p(r.braceR)&&!c.error&&!S(r.ellipsis);)v0(),p(r.braceR)||A(r.comma)}function v0(){ae(),S(r.eq)&&C()}function k0(){if(nr(r.eof),c.scopes.push(new At(0,c.tokens.length,true)),c.scopeDepth!==0)throw new Error(`Invalid scope depth at end of file: ${c.scopeDepth}`);return new cg(c.tokens,c.scopes)}function st(e){_e&&Jm()||(p(r.at)&&Ba(),w0(e))}function w0(e){if(me&&Vd())return;const t=c.type;switch(t){case r._break:case r._continue:E0();return;case r._debugger:T0();return;case r._do:A0();return;case r._for:I0();return;case r._function:if(Ae()===r.dot)break;e||le(),P0();return;case r._class:e||le(),ls(true);return;case r._if:L0();return;case r._return:D0();return;case r._switch:N0();return;case r._throw:F0();return;case r._try:M0();return;case r._let:case r._const:e||le();case r._var:bi(t!==r._var);return;case r._while:O0();return;case r.braceL:Kt();return;case r.semi:B0();return;case r._export:case r._import:{const n=Ae();if(n===r.parenL||n===r.dot)break;C(),t===r._import?El():wl();return}case r.name:if(c.contextualKeyword===g._async){const n=c.start,a=c.snapshot();if(C(),p(r._function)&&!tt()){A(r._function),us(n,true);return}else c.restoreFromSnapshot(a)}else if(c.contextualKeyword===g._using&&!xu()&&Ae()===r.name){bi(true);return}else if(bl()){Re(g._await),bi(true);return}}const s=c.tokens.length;Me();let i=null;if(c.tokens.length===s+1){const n=c.tokens[c.tokens.length-1];n.type===r.name&&(i=n.contextualKeyword)}if(i==null){Ee();return}S(r.colon)?V0():j0(i)}function bl(){if(!ee(g._await))return false;const e=c.snapshot();return C(),!ee(g._using)||We()||(C(),!p(r.name)||We())?(c.restoreFromSnapshot(e),false):(c.restoreFromSnapshot(e),true)}function Ba(){for(;p(r.at);)yl()}function yl(){if(C(),S(r.parenL))Me(),A(r.parenR);else{for(ae();S(r.dot);)ae();S0()}}function S0(){me?em():_l()}function _l(){S(r.parenL)&&zt()}function E0(){C(),vt()||(ae(),Ee())}function T0(){C(),Ee()}function A0(){C(),st(false),A(r._while),ir(),S(r.semi)}function I0(){c.scopeDepth++;const e=c.tokens.length;R0();const t=c.tokens.length;c.scopes.push(new At(e,t,false)),c.scopeDepth--}function C0(){return!(!ee(g._using)||ma(g._of))}function R0(){C();let e=false;if(ee(g._await)&&(e=true,C()),A(r.parenL),p(r.semi)){e&&le(),gn();return}const t=bl();if(t||p(r._var)||p(r._let)||p(r._const)||C0()){if(t&&Re(g._await),C(),xl(true,c.type!==r._var),p(r._in)||ee(g._of)){qo(e);return}gn();return}if(Me(true),p(r._in)||ee(g._of)){qo(e);return}e&&le(),gn()}function P0(){const e=c.start;C(),us(e,true)}function L0(){C(),ir(),st(false),S(r._else)&&st(false)}function D0(){C(),vt()||(Me(),Ee())}function N0(){C(),ir(),c.scopeDepth++;const e=c.tokens.length;for(A(r.braceL);!p(r.braceR)&&!c.error;)if(p(r._case)||p(r._default)){const s=p(r._case);C(),s&&Me(),A(r.colon)}else st(true);C();const t=c.tokens.length;c.scopes.push(new At(e,t,false)),c.scopeDepth--}function F0(){C(),Me(),Ee()}function U0(){er(true),me&&As()}function M0(){if(C(),Kt(),p(r._catch)){C();let e=null;if(p(r.parenL)&&(c.scopeDepth++,e=c.tokens.length,A(r.parenL),U0(),A(r.parenR)),Kt(),e!=null){const t=c.tokens.length;c.scopes.push(new At(e,t,false)),c.scopeDepth--}}S(r._finally)&&Kt()}function bi(e){C(),xl(false,e),Ee()}function O0(){C(),ir(),st(false)}function B0(){C()}function V0(){st(true)}function j0(e){me?$d(e):_e?t0(e):Ee()}function Kt(e=false,t=0){const s=c.tokens.length;c.scopeDepth++,A(r.braceL),t&&(c.tokens[c.tokens.length-1].contextId=t),nr(r.braceR),t&&(c.tokens[c.tokens.length-1].contextId=t);const i=c.tokens.length;c.scopes.push(new At(s,i,e)),c.scopeDepth--}function nr(e){for(;!S(e)&&!c.error;)st(true)}function gn(){A(r.semi),p(r.semi)||Me(),A(r.semi),p(r.parenR)||Me(),A(r.parenR),st(false)}function qo(e){e?Le(g._of):C(),Me(),A(r.parenR),st(false)}function xl(e,t){for(;;){if($0(t),S(r.eq)){const s=c.tokens.length-1;Oe(e),c.tokens[s].rhsEndIndex=c.tokens.length}if(!S(r.comma))break}}function $0(e){er(e),me?Xd():_e&&p0()}function us(e,t,s=false){p(r.star)&&C(),t&&!s&&!p(r.name)&&!p(r._yield)&&le();let i=null;p(r.name)&&(t||(i=c.tokens.length,c.scopeDepth++),es(false));const n=c.tokens.length;c.scopeDepth++,Cs(),ul(e);const a=c.tokens.length;c.scopes.push(new At(n,a,true)),c.scopeDepth--,i!==null&&(c.scopes.push(new At(i,a,true)),c.scopeDepth--)}function Cs(e=false,t=0){me?Gd():_e&&f0(),A(r.parenL),t&&(c.tokens[c.tokens.length-1].contextId=t),_a(r.parenR,false,false,e,t),t&&(c.tokens[c.tokens.length-1].contextId=t)}function ls(e,t=false){const s=Xs();C(),c.tokens[c.tokens.length-1].contextId=s,c.tokens[c.tokens.length-1].isExpression=!e;let i=null;e||(i=c.tokens.length,c.scopeDepth++),G0(e,t),X0();const n=c.tokens.length;if(q0(s),!c.error&&(c.tokens[n].contextId=s,c.tokens[c.tokens.length-1].contextId=s,i!==null)){const a=c.tokens.length;c.scopes.push(new At(i,a,false)),c.scopeDepth--}}function vl(){return p(r.eq)||p(r.semi)||p(r.braceR)||p(r.bang)||p(r.colon)}function kl(){return p(r.parenL)||p(r.lessThan)}function q0(e){for(A(r.braceL);!S(r.braceR)&&!c.error;){if(S(r.semi))continue;if(p(r.at)){yl();continue}const t=c.start;H0(t,e)}}function H0(e,t){me&&xa([g._declare,g._public,g._protected,g._private,g._override]);let s=false;if(p(r.name)&&c.contextualKeyword===g._static){if(ae(),kl()){Os(e,false);return}else if(vl()){yi();return}if(c.tokens[c.tokens.length-1].type=r._static,s=true,p(r.braceL)){c.tokens[c.tokens.length-1].contextId=t,Kt();return}}W0(e,s,t)}function W0(e,t,s){if(me&&jd(t))return;if(S(r.star)){Ns(s),Os(e,false);return}Ns(s);let i=false;const n=c.tokens[c.tokens.length-1];n.contextualKeyword===g._constructor&&(i=true),Ho(),kl()?Os(e,i):vl()?yi():n.contextualKeyword===g._async&&!vt()?(c.tokens[c.tokens.length-1].type=r._async,p(r.star)&&C(),Ns(s),Ho(),Os(e,false)):(n.contextualKeyword===g._get||n.contextualKeyword===g._set)&&!(vt()&&p(r.star))?(n.contextualKeyword===g._get?c.tokens[c.tokens.length-1].type=r._get:c.tokens[c.tokens.length-1].type=r._set,Ns(s),Os(e,false)):n.contextualKeyword===g._accessor&&!vt()?(Ns(s),yi()):vt()?yi():le()}function Os(e,t){me?fs():_e&&p(r.lessThan)&&bt(),Vn(e,t)}function Ns(e){Ks(e)}function Ho(){if(me){const e=pe(0);S(r.question),fe(e)}}function yi(){if(me?(Eu(r.bang),As()):_e&&p(r.colon)&&ps(),p(r.eq)){const e=c.tokens.length;C(),Oe(),c.tokens[e].rhsEndIndex=c.tokens.length}Ee()}function G0(e,t=false){me&&(!e||t)&&ee(g._implements)||(p(r.name)&&es(true),me?fs():_e&&p(r.lessThan)&&bt())}function X0(){let e=false;S(r._extends)?(nl(),e=true):e=false,me?Hd(e):_e&&o0(e)}function wl(){const e=c.tokens.length-1;me&&Ud()||(Z0()?Q0():K0()?(ae(),p(r.comma)&&Ae()===r.star?(A(r.comma),A(r.star),Re(g._as),ae()):Sl(),Qs()):S(r._default)?Y0():eg()?z0():(Va(),Qs()),c.tokens[e].rhsEndIndex=c.tokens.length)}function Y0(){if(me&&Bd()||_e&&e0())return;const e=c.start;S(r._function)?us(e,true,true):ee(g._async)&&Ae()===r._function?(Le(g._async),S(r._function),us(e,true,true)):p(r._class)?ls(true,true):p(r.at)?(Ba(),ls(true,true)):(Oe(),Ee())}function z0(){me?qd():_e?r0():st(true)}function K0(){if(me&&Ju())return false;if(_e&&i0())return false;if(p(r.name))return c.contextualKeyword!==g._async;if(!p(r._default))return false;const e=ga(),t=ri(),s=t.type===r.name&&t.contextualKeyword===g._from;if(t.type===r.comma)return true;if(s){const i=$.charCodeAt(Tu(e+4));return i===y.quotationMark||i===y.apostrophe}return false}function Sl(){S(r.comma)&&Va()}function Qs(){Le(g._from)&&(Bt(),Tl()),Ee()}function Z0(){return _e?n0():p(r.star)}function Q0(){_e?a0():qn()}function qn(){A(r.star),ee(g._as)?J0():Qs()}function J0(){C(),c.tokens[c.tokens.length-1].type=r._as,ae(),Sl(),Qs()}function eg(){return me&&Ju()||_e&&s0()||c.type===r._var||c.type===r._const||c.type===r._let||c.type===r._function||c.type===r._class||ee(g._async)||p(r.at)}function Va(){let e=true;for(A(r.braceL);!S(r.braceR)&&!c.error;){if(e)e=false;else if(A(r.comma),S(r.braceR))break;tg()}}function tg(){if(me){Od();return}ae(),c.tokens[c.tokens.length-1].identifierRole=ie.ExportAccess,Le(g._as)&&ae()}function sg(){const e=c.snapshot();return Re(g._module),Le(g._from)?ee(g._from)?(c.restoreFromSnapshot(e),true):(c.restoreFromSnapshot(e),false):p(r.comma)?(c.restoreFromSnapshot(e),false):(c.restoreFromSnapshot(e),true)}function ig(){ee(g._module)&&sg()&&C()}function El(){if(me&&p(r.name)&&Ae()===r.eq){Mn();return}if(me&&ee(g._type)){const e=ri();if(e.type===r.name&&e.contextualKeyword!==g._from){if(Re(g._type),Ae()===r.eq){Mn();return}}else(e.type===r.star||e.type===r.braceL)&&Re(g._type)}p(r.string)||(ig(),ng(),Re(g._from)),Bt(),Tl(),Ee()}function rg(){return p(r.name)}function Wo(){Pi()}function ng(){_e&&l0();let e=true;if(!(rg()&&(Wo(),!S(r.comma)))){if(p(r.star)){C(),Re(g._as),Wo();return}for(A(r.braceL);!S(r.braceR)&&!c.error;){if(e)e=false;else if(S(r.colon)&&le("ES2015 named imports do not destructure. Use another statement for destructuring after the import."),A(r.comma),S(r.braceR))break;ag()}}}function ag(){if(me){Md();return}if(_e){h0();return}Pi(),ee(g._as)&&(c.tokens[c.tokens.length-1].identifierRole=ie.ImportAccess,C(),Pi())}function Tl(){(p(r._with)||ee(g._assert)&&!We())&&(C(),Ra(false,false))}function og(){return c.pos===0&&$.charCodeAt(0)===y.numberSign&&$.charCodeAt(1)===y.exclamationMark&&Cu(2),Iu(),k0()}class cg{constructor(t,s){this.tokens=t,this.scopes=s}}function ug(e,t,s,i){if(i&&s)throw new Error("Cannot combine flow and typescript plugins.");Lf(e,t,s,i);const n=og();if(c.error)throw Cf(c.error);return n}function lg(e){let t=e.currentIndex(),s=0;const i=e.currentToken();do{const n=e.tokens[t];if(n.isOptionalChainStart&&s++,n.isOptionalChainEnd&&s--,s+=n.numNullishCoalesceStarts,s-=n.numNullishCoalesceEnds,n.contextualKeyword===g._await&&n.identifierRole==null&&n.scopeDepth===i.scopeDepth)return true;t+=1}while(s>0&&t<e.tokens.length);return false}class js{__init(){this.resultCode=""}__init2(){this.resultMappings=new Array(this.tokens.length)}__init3(){this.tokenIndex=0}constructor(t,s,i,n,a){this.code=t,this.tokens=s,this.isFlowEnabled=i,this.disableESTransforms=n,this.helperManager=a,js.prototype.__init.call(this),js.prototype.__init2.call(this),js.prototype.__init3.call(this)}snapshot(){return{resultCode:this.resultCode,tokenIndex:this.tokenIndex}}restoreToSnapshot(t){this.resultCode=t.resultCode,this.tokenIndex=t.tokenIndex}dangerouslyGetAndRemoveCodeSinceSnapshot(t){const s=this.resultCode.slice(t.resultCode.length);return this.resultCode=t.resultCode,s}reset(){this.resultCode="",this.resultMappings=new Array(this.tokens.length),this.tokenIndex=0}matchesContextualAtIndex(t,s){return this.matches1AtIndex(t,r.name)&&this.tokens[t].contextualKeyword===s}identifierNameAtIndex(t){return this.identifierNameForToken(this.tokens[t])}identifierNameAtRelativeIndex(t){return this.identifierNameForToken(this.tokenAtRelativeIndex(t))}identifierName(){return this.identifierNameForToken(this.currentToken())}identifierNameForToken(t){return this.code.slice(t.start,t.end)}rawCodeForToken(t){return this.code.slice(t.start,t.end)}stringValueAtIndex(t){return this.stringValueForToken(this.tokens[t])}stringValue(){return this.stringValueForToken(this.currentToken())}stringValueForToken(t){return this.code.slice(t.start+1,t.end-1)}matches1AtIndex(t,s){return this.tokens[t].type===s}matches2AtIndex(t,s,i){return this.tokens[t].type===s&&this.tokens[t+1].type===i}matches3AtIndex(t,s,i,n){return this.tokens[t].type===s&&this.tokens[t+1].type===i&&this.tokens[t+2].type===n}matches1(t){return this.tokens[this.tokenIndex].type===t}matches2(t,s){return this.tokens[this.tokenIndex].type===t&&this.tokens[this.tokenIndex+1].type===s}matches3(t,s,i){return this.tokens[this.tokenIndex].type===t&&this.tokens[this.tokenIndex+1].type===s&&this.tokens[this.tokenIndex+2].type===i}matches4(t,s,i,n){return this.tokens[this.tokenIndex].type===t&&this.tokens[this.tokenIndex+1].type===s&&this.tokens[this.tokenIndex+2].type===i&&this.tokens[this.tokenIndex+3].type===n}matches5(t,s,i,n,a){return this.tokens[this.tokenIndex].type===t&&this.tokens[this.tokenIndex+1].type===s&&this.tokens[this.tokenIndex+2].type===i&&this.tokens[this.tokenIndex+3].type===n&&this.tokens[this.tokenIndex+4].type===a}matchesContextual(t){return this.matchesContextualAtIndex(this.tokenIndex,t)}matchesContextIdAndLabel(t,s){return this.matches1(t)&&this.currentToken().contextId===s}previousWhitespaceAndComments(){let t=this.code.slice(this.tokenIndex>0?this.tokens[this.tokenIndex-1].end:0,this.tokenIndex<this.tokens.length?this.tokens[this.tokenIndex].start:this.code.length);return this.isFlowEnabled&&(t=t.replace(/@flow/g,"")),t}replaceToken(t){this.resultCode+=this.previousWhitespaceAndComments(),this.appendTokenPrefix(),this.resultMappings[this.tokenIndex]=this.resultCode.length,this.resultCode+=t,this.appendTokenSuffix(),this.tokenIndex++}replaceTokenTrimmingLeftWhitespace(t){this.resultCode+=this.previousWhitespaceAndComments().replace(/[^\r\n]/g,""),this.appendTokenPrefix(),this.resultMappings[this.tokenIndex]=this.resultCode.length,this.resultCode+=t,this.appendTokenSuffix(),this.tokenIndex++}removeInitialToken(){this.replaceToken("")}removeToken(){this.replaceTokenTrimmingLeftWhitespace("")}removeBalancedCode(){let t=0;for(;!this.isAtEnd();){if(this.matches1(r.braceL))t++;else if(this.matches1(r.braceR)){if(t===0)return;t--}this.removeToken()}}copyExpectedToken(t){if(this.tokens[this.tokenIndex].type!==t)throw new Error(`Expected token ${t}`);this.copyToken()}copyToken(){this.resultCode+=this.previousWhitespaceAndComments(),this.appendTokenPrefix(),this.resultMappings[this.tokenIndex]=this.resultCode.length,this.resultCode+=this.code.slice(this.tokens[this.tokenIndex].start,this.tokens[this.tokenIndex].end),this.appendTokenSuffix(),this.tokenIndex++}copyTokenWithPrefix(t){this.resultCode+=this.previousWhitespaceAndComments(),this.appendTokenPrefix(),this.resultCode+=t,this.resultMappings[this.tokenIndex]=this.resultCode.length,this.resultCode+=this.code.slice(this.tokens[this.tokenIndex].start,this.tokens[this.tokenIndex].end),this.appendTokenSuffix(),this.tokenIndex++}appendTokenPrefix(){const t=this.currentToken();if((t.numNullishCoalesceStarts||t.isOptionalChainStart)&&(t.isAsyncOperation=lg(this)),!this.disableESTransforms){if(t.numNullishCoalesceStarts)for(let s=0;s<t.numNullishCoalesceStarts;s++)t.isAsyncOperation?(this.resultCode+="await ",this.resultCode+=this.helperManager.getHelperName("asyncNullishCoalesce")):this.resultCode+=this.helperManager.getHelperName("nullishCoalesce"),this.resultCode+="(";t.isOptionalChainStart&&(t.isAsyncOperation&&(this.resultCode+="await "),this.tokenIndex>0&&this.tokenAtRelativeIndex(-1).type===r._delete?t.isAsyncOperation?this.resultCode+=this.helperManager.getHelperName("asyncOptionalChainDelete"):this.resultCode+=this.helperManager.getHelperName("optionalChainDelete"):t.isAsyncOperation?this.resultCode+=this.helperManager.getHelperName("asyncOptionalChain"):this.resultCode+=this.helperManager.getHelperName("optionalChain"),this.resultCode+="([")}}appendTokenSuffix(){const t=this.currentToken();if(t.isOptionalChainEnd&&!this.disableESTransforms&&(this.resultCode+="])"),t.numNullishCoalesceEnds&&!this.disableESTransforms)for(let s=0;s<t.numNullishCoalesceEnds;s++)this.resultCode+="))"}appendCode(t){this.resultCode+=t}currentToken(){return this.tokens[this.tokenIndex]}currentTokenCode(){const t=this.currentToken();return this.code.slice(t.start,t.end)}tokenAtRelativeIndex(t){return this.tokens[this.tokenIndex+t]}currentIndex(){return this.tokenIndex}nextToken(){if(this.tokenIndex===this.tokens.length)throw new Error("Unexpectedly reached end of input.");this.tokenIndex++}previousToken(){this.tokenIndex--}finish(){if(this.tokenIndex!==this.tokens.length)throw new Error("Tried to finish processing tokens before reaching the end.");return this.resultCode+=this.previousWhitespaceAndComments(),{code:this.resultCode,mappings:this.resultMappings}}isAtEnd(){return this.tokenIndex===this.tokens.length}}function hg(e,t,s,i){const n=t.snapshot(),a=fg(t);let o=[];const u=[],l=[];let h=null;const d=[],m=[],_=t.currentToken().contextId;if(_==null)throw new Error("Expected non-null class context ID on class open-brace.");for(t.nextToken();!t.matchesContextIdAndLabel(r.braceR,_);)if(t.matchesContextual(g._constructor)&&!t.currentToken().isType)({constructorInitializerStatements:o,constructorInsertPos:h}=Go(t));else if(t.matches1(r.semi))i||m.push({start:t.currentIndex(),end:t.currentIndex()+1}),t.nextToken();else if(t.currentToken().isType)t.nextToken();else{const k=t.currentIndex();let T=false,P=false,F=false;for(;Mi(t.currentToken());)t.matches1(r._static)&&(T=true),t.matches1(r.hash)&&(P=true),(t.matches1(r._declare)||t.matches1(r._abstract))&&(F=true),t.nextToken();if(T&&t.matches1(r.braceL)){bn(t,_);continue}if(P){bn(t,_);continue}if(t.matchesContextual(g._constructor)&&!t.currentToken().isType){({constructorInitializerStatements:o,constructorInsertPos:h}=Go(t));continue}const B=t.currentIndex();if(pg(t),t.matches1(r.lessThan)||t.matches1(r.parenL)){bn(t,_);continue}for(;t.currentToken().isType;)t.nextToken();if(t.matches1(r.eq)){const N=t.currentIndex(),Y=t.currentToken().rhsEndIndex;if(Y==null)throw new Error("Expected rhsEndIndex on class field assignment.");for(t.nextToken();t.currentIndex()<Y;)e.processToken();let q;T?(q=s.claimFreeName("__initStatic"),l.push(q)):(q=s.claimFreeName("__init"),u.push(q)),d.push({initializerName:q,equalsIndex:N,start:B,end:t.currentIndex()})}else(!i||F)&&m.push({start:k,end:t.currentIndex()})}return t.restoreToSnapshot(n),i?{headerInfo:a,constructorInitializerStatements:o,instanceInitializerNames:[],staticInitializerNames:[],constructorInsertPos:h,fields:[],rangesToRemove:m}:{headerInfo:a,constructorInitializerStatements:o,instanceInitializerNames:u,staticInitializerNames:l,constructorInsertPos:h,fields:d,rangesToRemove:m}}function bn(e,t){for(e.nextToken();e.currentToken().contextId!==t;)e.nextToken();for(;Mi(e.tokenAtRelativeIndex(-1));)e.previousToken()}function fg(e){const t=e.currentToken(),s=t.contextId;if(s==null)throw new Error("Expected context ID on class token.");const i=t.isExpression;if(i==null)throw new Error("Expected isExpression on class token.");let n=null,a=false;for(e.nextToken(),e.matches1(r.name)&&(n=e.identifierName());!e.matchesContextIdAndLabel(r.braceL,s);)e.matches1(r._extends)&&!e.currentToken().isType&&(a=true),e.nextToken();return{isExpression:i,className:n,hasSuperclass:a}}function Go(e){const t=[];e.nextToken();const s=e.currentToken().contextId;if(s==null)throw new Error("Expected context ID on open-paren starting constructor params.");for(;!e.matchesContextIdAndLabel(r.parenR,s);)if(e.currentToken().contextId===s){if(e.nextToken(),Mi(e.currentToken())){for(e.nextToken();Mi(e.currentToken());)e.nextToken();const a=e.currentToken();if(a.type!==r.name)throw new Error("Expected identifier after access modifiers in constructor arg.");const o=e.identifierNameForToken(a);t.push(`this.${o} = ${o}`)}}else e.nextToken();for(e.nextToken();e.currentToken().isType;)e.nextToken();let i=e.currentIndex(),n=false;for(;!e.matchesContextIdAndLabel(r.braceR,s);){if(!n&&e.matches2(r._super,r.parenL)){e.nextToken();const a=e.currentToken().contextId;if(a==null)throw new Error("Expected a context ID on the super call");for(;!e.matchesContextIdAndLabel(r.parenR,a);)e.nextToken();i=e.currentIndex(),n=true}e.nextToken()}return e.nextToken(),{constructorInitializerStatements:t,constructorInsertPos:i}}function Mi(e){return[r._async,r._get,r._set,r.plus,r.minus,r._readonly,r._static,r._public,r._private,r._protected,r._override,r._abstract,r.star,r._declare,r.hash].includes(e.type)}function pg(e){if(e.matches1(r.bracketL)){const s=e.currentToken().contextId;if(s==null)throw new Error("Expected class context ID on computed name open bracket.");for(;!e.matchesContextIdAndLabel(r.bracketR,s);)e.nextToken();e.nextToken()}else e.nextToken()}function Al(e){if(e.removeInitialToken(),e.removeToken(),e.removeToken(),e.removeToken(),e.matches1(r.parenL))e.removeToken(),e.removeToken(),e.removeToken();else for(;e.matches1(r.dot);)e.removeToken(),e.removeToken()}const Il={typeDeclarations:new Set,valueDeclarations:new Set};function Cl(e){const t=new Set,s=new Set;for(let i=0;i<e.tokens.length;i++){const n=e.tokens[i];n.type===r.name&&Su(n)&&(n.isType?t.add(e.identifierNameForToken(n)):s.add(e.identifierNameForToken(n)))}return{typeDeclarations:t,valueDeclarations:s}}function Rl(e){let t=e.currentIndex();for(;!e.matches1AtIndex(t,r.braceR);)t++;return e.matchesContextualAtIndex(t+1,g._from)&&e.matches1AtIndex(t+2,r.string)}function as(e){(e.matches2(r._with,r.braceL)||e.matches2(r.name,r.braceL)&&e.matchesContextual(g._assert))&&(e.removeToken(),e.removeToken(),e.removeBalancedCode(),e.removeToken())}function Pl(e,t,s,i){if(!e||t)return false;const n=s.currentToken();if(n.rhsEndIndex==null)throw new Error("Expected non-null rhsEndIndex on export token.");const a=n.rhsEndIndex-s.currentIndex();if(a!==3&&!(a===4&&s.matches1AtIndex(n.rhsEndIndex-1,r.semi)))return false;const o=s.tokenAtRelativeIndex(2);if(o.type!==r.name)return false;const u=s.identifierNameForToken(o);return i.typeDeclarations.has(u)&&!i.valueDeclarations.has(u)}class $s extends gt{__init(){this.hadExport=false}__init2(){this.hadNamedExport=false}__init3(){this.hadDefaultExport=false}constructor(t,s,i,n,a,o,u,l,h,d,m,_){super(),this.rootTransformer=t,this.tokens=s,this.importProcessor=i,this.nameManager=n,this.helperManager=a,this.reactHotLoaderTransformer=o,this.enableLegacyBabel5ModuleInterop=u,this.enableLegacyTypeScriptModuleInterop=l,this.isTypeScriptTransformEnabled=h,this.isFlowTransformEnabled=d,this.preserveDynamicImport=m,this.keepUnusedImports=_,$s.prototype.__init.call(this),$s.prototype.__init2.call(this),$s.prototype.__init3.call(this),this.declarationInfo=h?Cl(s):Il}getPrefixCode(){let t="";return this.hadExport&&(t+='Object.defineProperty(exports, "__esModule", {value: true});'),t}getSuffixCode(){return this.enableLegacyBabel5ModuleInterop&&this.hadDefaultExport&&!this.hadNamedExport?`
|
|
564
564
|
module.exports = exports.default;
|
|
565
|
-
`:""}process(){return this.tokens.matches3(r._import,r.name,r.eq)?this.processImportEquals():this.tokens.matches1(r._import)?(this.processImport(),true):this.tokens.matches2(r._export,r.eq)?(this.tokens.replaceToken("module.exports"),true):this.tokens.matches1(r._export)&&!this.tokens.currentToken().isType?(this.hadExport=true,this.processExport()):this.tokens.matches2(r.name,r.postIncDec)&&this.processPostIncDec()?true:this.tokens.matches1(r.name)||this.tokens.matches1(r.jsxName)?this.processIdentifier():this.tokens.matches1(r.eq)?this.processAssignment():this.tokens.matches1(r.assign)?this.processComplexAssignment():this.tokens.matches1(r.preIncDec)?this.processPreIncDec():false}processImportEquals(){const t=this.tokens.identifierNameAtIndex(this.tokens.currentIndex()+1);return this.importProcessor.shouldAutomaticallyElideImportedName(t)?Al(this.tokens):this.tokens.replaceToken("const"),true}processImport(){if(this.tokens.matches2(r._import,r.parenL)){if(this.preserveDynamicImport){this.tokens.copyToken();return}const s=this.enableLegacyTypeScriptModuleInterop?"":`${this.helperManager.getHelperName("interopRequireWildcard")}(`;this.tokens.replaceToken(`Promise.resolve().then(() => ${s}require`);const i=this.tokens.currentToken().contextId;if(i==null)throw new Error("Expected context ID on dynamic import invocation.");for(this.tokens.copyToken();!this.tokens.matchesContextIdAndLabel(r.parenR,i);)this.rootTransformer.processToken();this.tokens.replaceToken(s?")))":"))");return}if(this.removeImportAndDetectIfShouldElide())this.tokens.removeToken();else{const s=this.tokens.stringValue();this.tokens.replaceTokenTrimmingLeftWhitespace(this.importProcessor.claimImportCode(s)),this.tokens.appendCode(this.importProcessor.claimImportCode(s))}as(this.tokens),this.tokens.matches1(r.semi)&&this.tokens.removeToken()}removeImportAndDetectIfShouldElide(){if(this.tokens.removeInitialToken(),this.tokens.matchesContextual(g._type)&&!this.tokens.matches1AtIndex(this.tokens.currentIndex()+1,r.comma)&&!this.tokens.matchesContextualAtIndex(this.tokens.currentIndex()+1,g._from))return this.removeRemainingImport(),true;if(this.tokens.matches1(r.name)||this.tokens.matches1(r.star))return this.removeRemainingImport(),false;if(this.tokens.matches1(r.string))return false;let t=false,s=false;for(;!this.tokens.matches1(r.string);)(!t&&this.tokens.matches1(r.braceL)||this.tokens.matches1(r.comma))&&(this.tokens.removeToken(),this.tokens.matches1(r.braceR)||(s=true),(this.tokens.matches2(r.name,r.comma)||this.tokens.matches2(r.name,r.braceR)||this.tokens.matches4(r.name,r.name,r.name,r.comma)||this.tokens.matches4(r.name,r.name,r.name,r.braceR))&&(t=true)),this.tokens.removeToken();return this.keepUnusedImports?false:this.isTypeScriptTransformEnabled?!t:this.isFlowTransformEnabled?s&&!t:false}removeRemainingImport(){for(;!this.tokens.matches1(r.string);)this.tokens.removeToken()}processIdentifier(){const t=this.tokens.currentToken();if(t.shadowsGlobal)return false;if(t.identifierRole===ie.ObjectShorthand)return this.processObjectShorthand();if(t.identifierRole!==ie.Access)return false;const s=this.importProcessor.getIdentifierReplacement(this.tokens.identifierNameForToken(t));if(!s)return false;let i=this.tokens.currentIndex()+1;for(;i<this.tokens.tokens.length&&this.tokens.tokens[i].type===r.parenR;)i++;return this.tokens.tokens[i].type===r.parenL?this.tokens.tokenAtRelativeIndex(1).type===r.parenL&&this.tokens.tokenAtRelativeIndex(-1).type!==r._new?(this.tokens.replaceToken(`${s}.call(void 0, `),this.tokens.removeToken(),this.rootTransformer.processBalancedCode(),this.tokens.copyExpectedToken(r.parenR)):this.tokens.replaceToken(`(0, ${s})`):this.tokens.replaceToken(s),true}processObjectShorthand(){const t=this.tokens.identifierName(),s=this.importProcessor.getIdentifierReplacement(t);return s?(this.tokens.replaceToken(`${t}: ${s}`),true):false}processExport(){if(this.tokens.matches2(r._export,r._enum)||this.tokens.matches3(r._export,r._const,r._enum))return this.hadNamedExport=true,false;if(this.tokens.matches2(r._export,r._default))return this.tokens.matches3(r._export,r._default,r._enum)?(this.hadDefaultExport=true,false):(this.processExportDefault(),true);if(this.tokens.matches2(r._export,r.braceL))return this.processExportBindings(),true;if(this.tokens.matches2(r._export,r.name)&&this.tokens.matchesContextualAtIndex(this.tokens.currentIndex()+1,g._type)){if(this.tokens.removeInitialToken(),this.tokens.removeToken(),this.tokens.matches1(r.braceL)){for(;!this.tokens.matches1(r.braceR);)this.tokens.removeToken();this.tokens.removeToken()}else this.tokens.removeToken(),this.tokens.matches1(r._as)&&(this.tokens.removeToken(),this.tokens.removeToken());return this.tokens.matchesContextual(g._from)&&this.tokens.matches1AtIndex(this.tokens.currentIndex()+1,r.string)&&(this.tokens.removeToken(),this.tokens.removeToken(),as(this.tokens)),true}if(this.hadNamedExport=true,this.tokens.matches2(r._export,r._var)||this.tokens.matches2(r._export,r._let)||this.tokens.matches2(r._export,r._const))return this.processExportVar(),true;if(this.tokens.matches2(r._export,r._function)||this.tokens.matches3(r._export,r.name,r._function))return this.processExportFunction(),true;if(this.tokens.matches2(r._export,r._class)||this.tokens.matches3(r._export,r._abstract,r._class)||this.tokens.matches2(r._export,r.at))return this.processExportClass(),true;if(this.tokens.matches2(r._export,r.star))return this.processExportStar(),true;throw new Error("Unrecognized export syntax.")}processAssignment(){const t=this.tokens.currentIndex(),s=this.tokens.tokens[t-1];if(s.isType||s.type!==r.name||s.shadowsGlobal||t>=2&&this.tokens.matches1AtIndex(t-2,r.dot)||t>=2&&[r._var,r._let,r._const].includes(this.tokens.tokens[t-2].type))return false;const i=this.importProcessor.resolveExportBinding(this.tokens.identifierNameForToken(s));return i?(this.tokens.copyToken(),this.tokens.appendCode(` ${i} =`),true):false}processComplexAssignment(){const t=this.tokens.currentIndex(),s=this.tokens.tokens[t-1];if(s.type!==r.name||s.shadowsGlobal||t>=2&&this.tokens.matches1AtIndex(t-2,r.dot))return false;const i=this.importProcessor.resolveExportBinding(this.tokens.identifierNameForToken(s));return i?(this.tokens.appendCode(` = ${i}`),this.tokens.copyToken(),true):false}processPreIncDec(){const t=this.tokens.currentIndex(),s=this.tokens.tokens[t+1];if(s.type!==r.name||s.shadowsGlobal||t+2<this.tokens.tokens.length&&(this.tokens.matches1AtIndex(t+2,r.dot)||this.tokens.matches1AtIndex(t+2,r.bracketL)||this.tokens.matches1AtIndex(t+2,r.parenL)))return false;const i=this.tokens.identifierNameForToken(s),n=this.importProcessor.resolveExportBinding(i);return n?(this.tokens.appendCode(`${n} = `),this.tokens.copyToken(),true):false}processPostIncDec(){const t=this.tokens.currentIndex(),s=this.tokens.tokens[t],i=this.tokens.tokens[t+1];if(s.type!==r.name||s.shadowsGlobal||t>=1&&this.tokens.matches1AtIndex(t-1,r.dot))return false;const n=this.tokens.identifierNameForToken(s),a=this.importProcessor.resolveExportBinding(n);if(!a)return false;const o=this.tokens.rawCodeForToken(i),u=this.importProcessor.getIdentifierReplacement(n)||n;if(o==="++")this.tokens.replaceToken(`(${u} = ${a} = ${u} + 1, ${u} - 1)`);else if(o==="--")this.tokens.replaceToken(`(${u} = ${a} = ${u} - 1, ${u} + 1)`);else throw new Error(`Unexpected operator: ${o}`);return this.tokens.removeToken(),true}processExportDefault(){let t=true;if(this.tokens.matches4(r._export,r._default,r._function,r.name)||this.tokens.matches5(r._export,r._default,r.name,r._function,r.name)&&this.tokens.matchesContextualAtIndex(this.tokens.currentIndex()+2,g._async)){this.tokens.removeInitialToken(),this.tokens.removeToken();const s=this.processNamedFunction();this.tokens.appendCode(` exports.default = ${s};`)}else if(this.tokens.matches4(r._export,r._default,r._class,r.name)||this.tokens.matches5(r._export,r._default,r._abstract,r._class,r.name)||this.tokens.matches3(r._export,r._default,r.at)){this.tokens.removeInitialToken(),this.tokens.removeToken(),this.copyDecorators(),this.tokens.matches1(r._abstract)&&this.tokens.removeToken();const s=this.rootTransformer.processNamedClass();this.tokens.appendCode(` exports.default = ${s};`)}else if(Pl(this.isTypeScriptTransformEnabled,this.keepUnusedImports,this.tokens,this.declarationInfo))t=false,this.tokens.removeInitialToken(),this.tokens.removeToken(),this.tokens.removeToken();else if(this.reactHotLoaderTransformer){const s=this.nameManager.claimFreeName("_default");this.tokens.replaceToken(`let ${s}; exports.`),this.tokens.copyToken(),this.tokens.appendCode(` = ${s} =`),this.reactHotLoaderTransformer.setExtractedDefaultExportName(s)}else this.tokens.replaceToken("exports."),this.tokens.copyToken(),this.tokens.appendCode(" =");t&&(this.hadDefaultExport=true)}copyDecorators(){for(;this.tokens.matches1(r.at);)if(this.tokens.copyToken(),this.tokens.matches1(r.parenL))this.tokens.copyExpectedToken(r.parenL),this.rootTransformer.processBalancedCode(),this.tokens.copyExpectedToken(r.parenR);else{for(this.tokens.copyExpectedToken(r.name);this.tokens.matches1(r.dot);)this.tokens.copyExpectedToken(r.dot),this.tokens.copyExpectedToken(r.name);this.tokens.matches1(r.parenL)&&(this.tokens.copyExpectedToken(r.parenL),this.rootTransformer.processBalancedCode(),this.tokens.copyExpectedToken(r.parenR))}}processExportVar(){this.isSimpleExportVar()?this.processSimpleExportVar():this.processComplexExportVar()}isSimpleExportVar(){let t=this.tokens.currentIndex();if(t++,t++,!this.tokens.matches1AtIndex(t,r.name))return false;for(t++;t<this.tokens.tokens.length&&this.tokens.tokens[t].isType;)t++;return!!this.tokens.matches1AtIndex(t,r.eq)}processSimpleExportVar(){this.tokens.removeInitialToken(),this.tokens.copyToken();const t=this.tokens.identifierName();for(;!this.tokens.matches1(r.eq);)this.rootTransformer.processToken();const s=this.tokens.currentToken().rhsEndIndex;if(s==null)throw new Error("Expected = token with an end index.");for(;this.tokens.currentIndex()<s;)this.rootTransformer.processToken();this.tokens.appendCode(`; exports.${t} = ${t}`)}processComplexExportVar(){this.tokens.removeInitialToken(),this.tokens.removeToken();const t=this.tokens.matches1(r.braceL);t&&this.tokens.appendCode("(");let s=0;for(;;)if(this.tokens.matches1(r.braceL)||this.tokens.matches1(r.dollarBraceL)||this.tokens.matches1(r.bracketL))s++,this.tokens.copyToken();else if(this.tokens.matches1(r.braceR)||this.tokens.matches1(r.bracketR))s--,this.tokens.copyToken();else{if(s===0&&!this.tokens.matches1(r.name)&&!this.tokens.currentToken().isType)break;if(this.tokens.matches1(r.eq)){const i=this.tokens.currentToken().rhsEndIndex;if(i==null)throw new Error("Expected = token with an end index.");for(;this.tokens.currentIndex()<i;)this.rootTransformer.processToken()}else{const i=this.tokens.currentToken();if(wu(i)){const n=this.tokens.identifierName();let a=this.importProcessor.getIdentifierReplacement(n);if(a===null)throw new Error(`Expected a replacement for ${n} in \`export var\` syntax.`);Mf(i)&&(a=`${n}: ${a}`),this.tokens.replaceToken(a)}else this.rootTransformer.processToken()}}if(t){const i=this.tokens.currentToken().rhsEndIndex;if(i==null)throw new Error("Expected = token with an end index.");for(;this.tokens.currentIndex()<i;)this.rootTransformer.processToken();this.tokens.appendCode(")")}}processExportFunction(){this.tokens.replaceToken("");const t=this.processNamedFunction();this.tokens.appendCode(` exports.${t} = ${t};`)}processNamedFunction(){if(this.tokens.matches1(r._function))this.tokens.copyToken();else if(this.tokens.matches2(r.name,r._function)){if(!this.tokens.matchesContextual(g._async))throw new Error("Expected async keyword in function export.");this.tokens.copyToken(),this.tokens.copyToken()}if(this.tokens.matches1(r.star)&&this.tokens.copyToken(),!this.tokens.matches1(r.name))throw new Error("Expected identifier for exported function name.");const t=this.tokens.identifierName();if(this.tokens.copyToken(),this.tokens.currentToken().isType)for(this.tokens.removeInitialToken();this.tokens.currentToken().isType;)this.tokens.removeToken();return this.tokens.copyExpectedToken(r.parenL),this.rootTransformer.processBalancedCode(),this.tokens.copyExpectedToken(r.parenR),this.rootTransformer.processPossibleTypeRange(),this.tokens.copyExpectedToken(r.braceL),this.rootTransformer.processBalancedCode(),this.tokens.copyExpectedToken(r.braceR),t}processExportClass(){this.tokens.removeInitialToken(),this.copyDecorators(),this.tokens.matches1(r._abstract)&&this.tokens.removeToken();const t=this.rootTransformer.processNamedClass();this.tokens.appendCode(` exports.${t} = ${t};`)}processExportBindings(){this.tokens.removeInitialToken(),this.tokens.removeToken();const t=Rl(this.tokens),s=[];for(;;){if(this.tokens.matches1(r.braceR)){this.tokens.removeToken();break}const i=Ys(this.tokens);for(;this.tokens.currentIndex()<i.endIndex;)this.tokens.removeToken();if(!(i.isType||!t&&this.shouldElideExportedIdentifier(i.leftName))){const a=i.rightName;a==="default"?this.hadDefaultExport=true:this.hadNamedExport=true;const o=i.leftName,u=this.importProcessor.getIdentifierReplacement(o);s.push(`exports.${a} = ${u||o};`)}if(this.tokens.matches1(r.braceR)){this.tokens.removeToken();break}if(this.tokens.matches2(r.comma,r.braceR)){this.tokens.removeToken(),this.tokens.removeToken();break}else if(this.tokens.matches1(r.comma))this.tokens.removeToken();else throw new Error(`Unexpected token: ${JSON.stringify(this.tokens.currentToken())}`)}if(this.tokens.matchesContextual(g._from)){this.tokens.removeToken();const i=this.tokens.stringValue();this.tokens.replaceTokenTrimmingLeftWhitespace(this.importProcessor.claimImportCode(i)),as(this.tokens)}else this.tokens.appendCode(s.join(" "));this.tokens.matches1(r.semi)&&this.tokens.removeToken()}processExportStar(){for(this.tokens.removeInitialToken();!this.tokens.matches1(r.string);)this.tokens.removeToken();const t=this.tokens.stringValue();this.tokens.replaceTokenTrimmingLeftWhitespace(this.importProcessor.claimImportCode(t)),as(this.tokens),this.tokens.matches1(r.semi)&&this.tokens.removeToken()}shouldElideExportedIdentifier(t){return this.isTypeScriptTransformEnabled&&!this.keepUnusedImports&&!this.declarationInfo.valueDeclarations.has(t)}}class pg extends gt{constructor(t,s,i,n,a,o,u,l){super(),this.tokens=t,this.nameManager=s,this.helperManager=i,this.reactHotLoaderTransformer=n,this.isTypeScriptTransformEnabled=a,this.isFlowTransformEnabled=o,this.keepUnusedImports=u,this.nonTypeIdentifiers=a&&!u?Ou(t,l):new Set,this.declarationInfo=a&&!u?Cl(t):Il,this.injectCreateRequireForImportRequire=!!l.injectCreateRequireForImportRequire}process(){if(this.tokens.matches3(r._import,r.name,r.eq))return this.processImportEquals();if(this.tokens.matches4(r._import,r.name,r.name,r.eq)&&this.tokens.matchesContextualAtIndex(this.tokens.currentIndex()+1,g._type)){this.tokens.removeInitialToken();for(let t=0;t<7;t++)this.tokens.removeToken();return true}if(this.tokens.matches2(r._export,r.eq))return this.tokens.replaceToken("module.exports"),true;if(this.tokens.matches5(r._export,r._import,r.name,r.name,r.eq)&&this.tokens.matchesContextualAtIndex(this.tokens.currentIndex()+2,g._type)){this.tokens.removeInitialToken();for(let t=0;t<8;t++)this.tokens.removeToken();return true}if(this.tokens.matches1(r._import))return this.processImport();if(this.tokens.matches2(r._export,r._default))return this.processExportDefault();if(this.tokens.matches2(r._export,r.braceL))return this.processNamedExports();if(this.tokens.matches2(r._export,r.name)&&this.tokens.matchesContextualAtIndex(this.tokens.currentIndex()+1,g._type)){if(this.tokens.removeInitialToken(),this.tokens.removeToken(),this.tokens.matches1(r.braceL)){for(;!this.tokens.matches1(r.braceR);)this.tokens.removeToken();this.tokens.removeToken()}else this.tokens.removeToken(),this.tokens.matches1(r._as)&&(this.tokens.removeToken(),this.tokens.removeToken());return this.tokens.matchesContextual(g._from)&&this.tokens.matches1AtIndex(this.tokens.currentIndex()+1,r.string)&&(this.tokens.removeToken(),this.tokens.removeToken(),as(this.tokens)),true}return false}processImportEquals(){const t=this.tokens.identifierNameAtIndex(this.tokens.currentIndex()+1);return this.shouldAutomaticallyElideImportedName(t)?Al(this.tokens):this.injectCreateRequireForImportRequire?(this.tokens.replaceToken("const"),this.tokens.copyToken(),this.tokens.copyToken(),this.tokens.replaceToken(this.helperManager.getHelperName("require"))):this.tokens.replaceToken("const"),true}processImport(){if(this.tokens.matches2(r._import,r.parenL))return false;const t=this.tokens.snapshot();if(this.removeImportTypeBindings()){for(this.tokens.restoreToSnapshot(t);!this.tokens.matches1(r.string);)this.tokens.removeToken();this.tokens.removeToken(),as(this.tokens),this.tokens.matches1(r.semi)&&this.tokens.removeToken()}return true}removeImportTypeBindings(){if(this.tokens.copyExpectedToken(r._import),this.tokens.matchesContextual(g._type)&&!this.tokens.matches1AtIndex(this.tokens.currentIndex()+1,r.comma)&&!this.tokens.matchesContextualAtIndex(this.tokens.currentIndex()+1,g._from))return true;if(this.tokens.matches1(r.string))return this.tokens.copyToken(),false;this.tokens.matchesContextual(g._module)&&this.tokens.matchesContextualAtIndex(this.tokens.currentIndex()+2,g._from)&&this.tokens.copyToken();let t=false,s=false,i=false;if(this.tokens.matches1(r.name)&&(this.shouldAutomaticallyElideImportedName(this.tokens.identifierName())?(this.tokens.removeToken(),this.tokens.matches1(r.comma)&&this.tokens.removeToken()):(t=true,this.tokens.copyToken(),this.tokens.matches1(r.comma)&&(i=true,this.tokens.removeToken()))),this.tokens.matches1(r.star))this.shouldAutomaticallyElideImportedName(this.tokens.identifierNameAtRelativeIndex(2))?(this.tokens.removeToken(),this.tokens.removeToken(),this.tokens.removeToken()):(i&&this.tokens.appendCode(","),t=true,this.tokens.copyExpectedToken(r.star),this.tokens.copyExpectedToken(r.name),this.tokens.copyExpectedToken(r.name));else if(this.tokens.matches1(r.braceL)){for(i&&this.tokens.appendCode(","),this.tokens.copyToken();!this.tokens.matches1(r.braceR);){s=true;const n=Ys(this.tokens);if(n.isType||this.shouldAutomaticallyElideImportedName(n.rightName)){for(;this.tokens.currentIndex()<n.endIndex;)this.tokens.removeToken();this.tokens.matches1(r.comma)&&this.tokens.removeToken()}else{for(t=true;this.tokens.currentIndex()<n.endIndex;)this.tokens.copyToken();this.tokens.matches1(r.comma)&&this.tokens.copyToken()}}this.tokens.copyExpectedToken(r.braceR)}return this.keepUnusedImports?false:this.isTypeScriptTransformEnabled?!t:this.isFlowTransformEnabled?s&&!t:false}shouldAutomaticallyElideImportedName(t){return this.isTypeScriptTransformEnabled&&!this.keepUnusedImports&&!this.nonTypeIdentifiers.has(t)}processExportDefault(){if(Pl(this.isTypeScriptTransformEnabled,this.keepUnusedImports,this.tokens,this.declarationInfo))return this.tokens.removeInitialToken(),this.tokens.removeToken(),this.tokens.removeToken(),true;if(!(this.tokens.matches4(r._export,r._default,r._function,r.name)||this.tokens.matches5(r._export,r._default,r.name,r._function,r.name)&&this.tokens.matchesContextualAtIndex(this.tokens.currentIndex()+2,g._async)||this.tokens.matches4(r._export,r._default,r._class,r.name)||this.tokens.matches5(r._export,r._default,r._abstract,r._class,r.name))&&this.reactHotLoaderTransformer){const s=this.nameManager.claimFreeName("_default");return this.tokens.replaceToken(`let ${s}; export`),this.tokens.copyToken(),this.tokens.appendCode(` ${s} =`),this.reactHotLoaderTransformer.setExtractedDefaultExportName(s),true}return false}processNamedExports(){if(!this.isTypeScriptTransformEnabled)return false;this.tokens.copyExpectedToken(r._export),this.tokens.copyExpectedToken(r.braceL);const t=Rl(this.tokens);let s=false;for(;!this.tokens.matches1(r.braceR);){const i=Ys(this.tokens);if(i.isType||!t&&this.shouldElideExportedName(i.leftName)){for(;this.tokens.currentIndex()<i.endIndex;)this.tokens.removeToken();this.tokens.matches1(r.comma)&&this.tokens.removeToken()}else{for(s=true;this.tokens.currentIndex()<i.endIndex;)this.tokens.copyToken();this.tokens.matches1(r.comma)&&this.tokens.copyToken()}}return this.tokens.copyExpectedToken(r.braceR),!this.keepUnusedImports&&t&&!s&&(this.tokens.removeToken(),this.tokens.removeToken(),as(this.tokens)),true}shouldElideExportedName(t){return this.isTypeScriptTransformEnabled&&!this.keepUnusedImports&&this.declarationInfo.typeDeclarations.has(t)&&!this.declarationInfo.valueDeclarations.has(t)}}class dg extends gt{constructor(t,s,i){super(),this.rootTransformer=t,this.tokens=s,this.isImportsTransformEnabled=i}process(){return this.rootTransformer.processPossibleArrowParamEnd()||this.rootTransformer.processPossibleAsyncArrowWithTypeParams()||this.rootTransformer.processPossibleTypeRange()?true:this.tokens.matches1(r._enum)?(this.processEnum(),true):this.tokens.matches2(r._export,r._enum)?(this.processNamedExportEnum(),true):this.tokens.matches3(r._export,r._default,r._enum)?(this.processDefaultExportEnum(),true):false}processNamedExportEnum(){if(this.isImportsTransformEnabled){this.tokens.removeInitialToken();const t=this.tokens.identifierNameAtRelativeIndex(1);this.processEnum(),this.tokens.appendCode(` exports.${t} = ${t};`)}else this.tokens.copyToken(),this.processEnum()}processDefaultExportEnum(){this.tokens.removeInitialToken(),this.tokens.removeToken();const t=this.tokens.identifierNameAtRelativeIndex(1);this.processEnum(),this.isImportsTransformEnabled?this.tokens.appendCode(` exports.default = ${t};`):this.tokens.appendCode(` export default ${t};`)}processEnum(){this.tokens.replaceToken("const"),this.tokens.copyExpectedToken(r.name);let t=false;this.tokens.matchesContextual(g._of)&&(this.tokens.removeToken(),t=this.tokens.matchesContextual(g._symbol),this.tokens.removeToken());const s=this.tokens.matches3(r.braceL,r.name,r.eq);this.tokens.appendCode(' = require("flow-enums-runtime")');const i=!t&&!s;for(this.tokens.replaceTokenTrimmingLeftWhitespace(i?".Mirrored([":"({");!this.tokens.matches1(r.braceR);){if(this.tokens.matches1(r.ellipsis)){this.tokens.removeToken();break}this.processEnumElement(t,s),this.tokens.matches1(r.comma)&&this.tokens.copyToken()}this.tokens.replaceToken(i?"]);":"});")}processEnumElement(t,s){if(t){const i=this.tokens.identifierName();this.tokens.copyToken(),this.tokens.appendCode(`: Symbol("${i}")`)}else s?(this.tokens.copyToken(),this.tokens.replaceTokenTrimmingLeftWhitespace(":"),this.tokens.copyToken()):this.tokens.replaceToken(`"${this.tokens.identifierName()}"`)}}function mg(e){let t,s=e[0],i=1;for(;i<e.length;){const n=e[i],a=e[i+1];if(i+=2,(n==="optionalAccess"||n==="optionalCall")&&s==null)return;n==="access"||n==="optionalAccess"?(t=s,s=a(s)):(n==="call"||n==="optionalCall")&&(s=a((...o)=>s.call(t,...o)),t=void 0)}return s}const pi="jest",gg=["mock","unmock","enableAutomock","disableAutomock"];class ja extends gt{__init(){this.hoistedFunctionNames=[]}constructor(t,s,i,n){super(),this.rootTransformer=t,this.tokens=s,this.nameManager=i,this.importProcessor=n,ja.prototype.__init.call(this)}process(){return this.tokens.currentToken().scopeDepth===0&&this.tokens.matches4(r.name,r.dot,r.name,r.parenL)&&this.tokens.identifierName()===pi?mg([this,"access",t=>t.importProcessor,"optionalAccess",t=>t.getGlobalNames,"call",t=>t(),"optionalAccess",t=>t.has,"call",t=>t(pi)])?false:this.extractHoistedCalls():false}getHoistedCode(){return this.hoistedFunctionNames.length>0?this.hoistedFunctionNames.map(t=>`${t}();`).join(""):""}extractHoistedCalls(){this.tokens.removeToken();let t=false;for(;this.tokens.matches3(r.dot,r.name,r.parenL);){const s=this.tokens.identifierNameAtIndex(this.tokens.currentIndex()+1);if(gg.includes(s)){const n=this.nameManager.claimFreeName("__jestHoist");this.hoistedFunctionNames.push(n),this.tokens.replaceToken(`function ${n}(){${pi}.`),this.tokens.copyToken(),this.tokens.copyToken(),this.rootTransformer.processBalancedCode(),this.tokens.copyExpectedToken(r.parenR),this.tokens.appendCode(";}"),t=false}else t?this.tokens.copyToken():this.tokens.replaceToken(`${pi}.`),this.tokens.copyToken(),this.tokens.copyToken(),this.rootTransformer.processBalancedCode(),this.tokens.copyExpectedToken(r.parenR),t=true}return true}}class bg extends gt{constructor(t){super(),this.tokens=t}process(){if(this.tokens.matches1(r.num)){const t=this.tokens.currentTokenCode();if(t.includes("_"))return this.tokens.replaceToken(t.replace(/_/g,"")),true}return false}}class yg extends gt{constructor(t,s){super(),this.tokens=t,this.nameManager=s}process(){return this.tokens.matches2(r._catch,r.braceL)?(this.tokens.copyToken(),this.tokens.appendCode(` (${this.nameManager.claimFreeName("e")})`),true):false}}class _g extends gt{constructor(t,s){super(),this.tokens=t,this.nameManager=s}process(){if(this.tokens.matches1(r.nullishCoalescing)){const i=this.tokens.currentToken();return this.tokens.tokens[i.nullishStartIndex].isAsyncOperation?this.tokens.replaceTokenTrimmingLeftWhitespace(", async () => ("):this.tokens.replaceTokenTrimmingLeftWhitespace(", () => ("),true}if(this.tokens.matches1(r._delete)&&this.tokens.tokenAtRelativeIndex(1).isOptionalChainStart)return this.tokens.removeInitialToken(),true;const s=this.tokens.currentToken().subscriptStartIndex;if(s!=null&&this.tokens.tokens[s].isOptionalChainStart&&this.tokens.tokenAtRelativeIndex(-1).type!==r._super){const i=this.nameManager.claimFreeName("_");let n;if(s>0&&this.tokens.matches1AtIndex(s-1,r._delete)&&this.isLastSubscriptInChain()?n=`${i} => delete ${i}`:n=`${i} => ${i}`,this.tokens.tokens[s].isAsyncOperation&&(n=`async ${n}`),this.tokens.matches2(r.questionDot,r.parenL)||this.tokens.matches2(r.questionDot,r.lessThan))this.justSkippedSuper()&&this.tokens.appendCode(".bind(this)"),this.tokens.replaceTokenTrimmingLeftWhitespace(`, 'optionalCall', ${n}`);else if(this.tokens.matches2(r.questionDot,r.bracketL))this.tokens.replaceTokenTrimmingLeftWhitespace(`, 'optionalAccess', ${n}`);else if(this.tokens.matches1(r.questionDot))this.tokens.replaceTokenTrimmingLeftWhitespace(`, 'optionalAccess', ${n}.`);else if(this.tokens.matches1(r.dot))this.tokens.replaceTokenTrimmingLeftWhitespace(`, 'access', ${n}.`);else if(this.tokens.matches1(r.bracketL))this.tokens.replaceTokenTrimmingLeftWhitespace(`, 'access', ${n}[`);else if(this.tokens.matches1(r.parenL))this.justSkippedSuper()&&this.tokens.appendCode(".bind(this)"),this.tokens.replaceTokenTrimmingLeftWhitespace(`, 'call', ${n}(`);else throw new Error("Unexpected subscript operator in optional chain.");return true}return false}isLastSubscriptInChain(){let t=0;for(let s=this.tokens.currentIndex()+1;;s++){if(s>=this.tokens.tokens.length)throw new Error("Reached the end of the code while finding the end of the access chain.");if(this.tokens.tokens[s].isOptionalChainStart?t++:this.tokens.tokens[s].isOptionalChainEnd&&t--,t<0)return true;if(t===0&&this.tokens.tokens[s].subscriptStartIndex!=null)return false}}justSkippedSuper(){let t=0,s=this.tokens.currentIndex()-1;for(;;){if(s<0)throw new Error("Reached the start of the code while finding the start of the access chain.");if(this.tokens.tokens[s].isOptionalChainStart?t--:this.tokens.tokens[s].isOptionalChainEnd&&t++,t<0)return false;if(t===0&&this.tokens.tokens[s].subscriptStartIndex!=null)return this.tokens.tokens[s-1].type===r._super;s--}}}class xg extends gt{constructor(t,s,i,n){super(),this.rootTransformer=t,this.tokens=s,this.importProcessor=i,this.options=n}process(){const t=this.tokens.currentIndex();if(this.tokens.identifierName()==="createReactClass"){const s=this.importProcessor&&this.importProcessor.getIdentifierReplacement("createReactClass");return s?this.tokens.replaceToken(`(0, ${s})`):this.tokens.copyToken(),this.tryProcessCreateClassCall(t),true}if(this.tokens.matches3(r.name,r.dot,r.name)&&this.tokens.identifierName()==="React"&&this.tokens.identifierNameAtIndex(this.tokens.currentIndex()+2)==="createClass"){const s=this.importProcessor&&this.importProcessor.getIdentifierReplacement("React")||"React";return s?(this.tokens.replaceToken(s),this.tokens.copyToken(),this.tokens.copyToken()):(this.tokens.copyToken(),this.tokens.copyToken(),this.tokens.copyToken()),this.tryProcessCreateClassCall(t),true}return false}tryProcessCreateClassCall(t){const s=this.findDisplayName(t);s&&this.classNeedsDisplayName()&&(this.tokens.copyExpectedToken(r.parenL),this.tokens.copyExpectedToken(r.braceL),this.tokens.appendCode(`displayName: '${s}',`),this.rootTransformer.processBalancedCode(),this.tokens.copyExpectedToken(r.braceR),this.tokens.copyExpectedToken(r.parenR))}findDisplayName(t){return t<2?null:this.tokens.matches2AtIndex(t-2,r.name,r.eq)?this.tokens.identifierNameAtIndex(t-2):t>=2&&this.tokens.tokens[t-2].identifierRole===ie.ObjectKey?this.tokens.identifierNameAtIndex(t-2):this.tokens.matches2AtIndex(t-2,r._export,r._default)?this.getDisplayNameFromFilename():null}getDisplayNameFromFilename(){const s=(this.options.filePath||"unknown").split("/"),i=s[s.length-1],n=i.lastIndexOf("."),a=n===-1?i:i.slice(0,n);return a==="index"&&s[s.length-2]?s[s.length-2]:a}classNeedsDisplayName(){let t=this.tokens.currentIndex();if(!this.tokens.matches2(r.parenL,r.braceL))return false;const s=t+1,i=this.tokens.tokens[s].contextId;if(i==null)throw new Error("Expected non-null context ID on object open-brace.");for(;t<this.tokens.tokens.length;t++){const n=this.tokens.tokens[t];if(n.type===r.braceR&&n.contextId===i){t++;break}if(this.tokens.identifierNameAtIndex(t)==="displayName"&&this.tokens.tokens[t].identifierRole===ie.ObjectKey&&n.contextId===i)return false}if(t===this.tokens.tokens.length)throw new Error("Unexpected end of input when processing React class.");return this.tokens.matches1AtIndex(t,r.parenR)||this.tokens.matches2AtIndex(t,r.comma,r.parenR)}}class $a extends gt{__init(){this.extractedDefaultExportName=null}constructor(t,s){super(),this.tokens=t,this.filePath=s,$a.prototype.__init.call(this)}setExtractedDefaultExportName(t){this.extractedDefaultExportName=t}getPrefixCode(){return`
|
|
565
|
+
`:""}process(){return this.tokens.matches3(r._import,r.name,r.eq)?this.processImportEquals():this.tokens.matches1(r._import)?(this.processImport(),true):this.tokens.matches2(r._export,r.eq)?(this.tokens.replaceToken("module.exports"),true):this.tokens.matches1(r._export)&&!this.tokens.currentToken().isType?(this.hadExport=true,this.processExport()):this.tokens.matches2(r.name,r.postIncDec)&&this.processPostIncDec()?true:this.tokens.matches1(r.name)||this.tokens.matches1(r.jsxName)?this.processIdentifier():this.tokens.matches1(r.eq)?this.processAssignment():this.tokens.matches1(r.assign)?this.processComplexAssignment():this.tokens.matches1(r.preIncDec)?this.processPreIncDec():false}processImportEquals(){const t=this.tokens.identifierNameAtIndex(this.tokens.currentIndex()+1);return this.importProcessor.shouldAutomaticallyElideImportedName(t)?Al(this.tokens):this.tokens.replaceToken("const"),true}processImport(){if(this.tokens.matches2(r._import,r.parenL)){if(this.preserveDynamicImport){this.tokens.copyToken();return}const s=this.enableLegacyTypeScriptModuleInterop?"":`${this.helperManager.getHelperName("interopRequireWildcard")}(`;this.tokens.replaceToken(`Promise.resolve().then(() => ${s}require`);const i=this.tokens.currentToken().contextId;if(i==null)throw new Error("Expected context ID on dynamic import invocation.");for(this.tokens.copyToken();!this.tokens.matchesContextIdAndLabel(r.parenR,i);)this.rootTransformer.processToken();this.tokens.replaceToken(s?")))":"))");return}if(this.removeImportAndDetectIfShouldElide())this.tokens.removeToken();else{const s=this.tokens.stringValue();this.tokens.replaceTokenTrimmingLeftWhitespace(this.importProcessor.claimImportCode(s)),this.tokens.appendCode(this.importProcessor.claimImportCode(s))}as(this.tokens),this.tokens.matches1(r.semi)&&this.tokens.removeToken()}removeImportAndDetectIfShouldElide(){if(this.tokens.removeInitialToken(),this.tokens.matchesContextual(g._type)&&!this.tokens.matches1AtIndex(this.tokens.currentIndex()+1,r.comma)&&!this.tokens.matchesContextualAtIndex(this.tokens.currentIndex()+1,g._from))return this.removeRemainingImport(),true;if(this.tokens.matches1(r.name)||this.tokens.matches1(r.star))return this.removeRemainingImport(),false;if(this.tokens.matches1(r.string))return false;let t=false,s=false;for(;!this.tokens.matches1(r.string);)(!t&&this.tokens.matches1(r.braceL)||this.tokens.matches1(r.comma))&&(this.tokens.removeToken(),this.tokens.matches1(r.braceR)||(s=true),(this.tokens.matches2(r.name,r.comma)||this.tokens.matches2(r.name,r.braceR)||this.tokens.matches4(r.name,r.name,r.name,r.comma)||this.tokens.matches4(r.name,r.name,r.name,r.braceR))&&(t=true)),this.tokens.removeToken();return this.keepUnusedImports?false:this.isTypeScriptTransformEnabled?!t:this.isFlowTransformEnabled?s&&!t:false}removeRemainingImport(){for(;!this.tokens.matches1(r.string);)this.tokens.removeToken()}processIdentifier(){const t=this.tokens.currentToken();if(t.shadowsGlobal)return false;if(t.identifierRole===ie.ObjectShorthand)return this.processObjectShorthand();if(t.identifierRole!==ie.Access)return false;const s=this.importProcessor.getIdentifierReplacement(this.tokens.identifierNameForToken(t));if(!s)return false;let i=this.tokens.currentIndex()+1;for(;i<this.tokens.tokens.length&&this.tokens.tokens[i].type===r.parenR;)i++;return this.tokens.tokens[i].type===r.parenL?this.tokens.tokenAtRelativeIndex(1).type===r.parenL&&this.tokens.tokenAtRelativeIndex(-1).type!==r._new?(this.tokens.replaceToken(`${s}.call(void 0, `),this.tokens.removeToken(),this.rootTransformer.processBalancedCode(),this.tokens.copyExpectedToken(r.parenR)):this.tokens.replaceToken(`(0, ${s})`):this.tokens.replaceToken(s),true}processObjectShorthand(){const t=this.tokens.identifierName(),s=this.importProcessor.getIdentifierReplacement(t);return s?(this.tokens.replaceToken(`${t}: ${s}`),true):false}processExport(){if(this.tokens.matches2(r._export,r._enum)||this.tokens.matches3(r._export,r._const,r._enum))return this.hadNamedExport=true,false;if(this.tokens.matches2(r._export,r._default))return this.tokens.matches3(r._export,r._default,r._enum)?(this.hadDefaultExport=true,false):(this.processExportDefault(),true);if(this.tokens.matches2(r._export,r.braceL))return this.processExportBindings(),true;if(this.tokens.matches2(r._export,r.name)&&this.tokens.matchesContextualAtIndex(this.tokens.currentIndex()+1,g._type)){if(this.tokens.removeInitialToken(),this.tokens.removeToken(),this.tokens.matches1(r.braceL)){for(;!this.tokens.matches1(r.braceR);)this.tokens.removeToken();this.tokens.removeToken()}else this.tokens.removeToken(),this.tokens.matches1(r._as)&&(this.tokens.removeToken(),this.tokens.removeToken());return this.tokens.matchesContextual(g._from)&&this.tokens.matches1AtIndex(this.tokens.currentIndex()+1,r.string)&&(this.tokens.removeToken(),this.tokens.removeToken(),as(this.tokens)),true}if(this.hadNamedExport=true,this.tokens.matches2(r._export,r._var)||this.tokens.matches2(r._export,r._let)||this.tokens.matches2(r._export,r._const))return this.processExportVar(),true;if(this.tokens.matches2(r._export,r._function)||this.tokens.matches3(r._export,r.name,r._function))return this.processExportFunction(),true;if(this.tokens.matches2(r._export,r._class)||this.tokens.matches3(r._export,r._abstract,r._class)||this.tokens.matches2(r._export,r.at))return this.processExportClass(),true;if(this.tokens.matches2(r._export,r.star))return this.processExportStar(),true;throw new Error("Unrecognized export syntax.")}processAssignment(){const t=this.tokens.currentIndex(),s=this.tokens.tokens[t-1];if(s.isType||s.type!==r.name||s.shadowsGlobal||t>=2&&this.tokens.matches1AtIndex(t-2,r.dot)||t>=2&&[r._var,r._let,r._const].includes(this.tokens.tokens[t-2].type))return false;const i=this.importProcessor.resolveExportBinding(this.tokens.identifierNameForToken(s));return i?(this.tokens.copyToken(),this.tokens.appendCode(` ${i} =`),true):false}processComplexAssignment(){const t=this.tokens.currentIndex(),s=this.tokens.tokens[t-1];if(s.type!==r.name||s.shadowsGlobal||t>=2&&this.tokens.matches1AtIndex(t-2,r.dot))return false;const i=this.importProcessor.resolveExportBinding(this.tokens.identifierNameForToken(s));return i?(this.tokens.appendCode(` = ${i}`),this.tokens.copyToken(),true):false}processPreIncDec(){const t=this.tokens.currentIndex(),s=this.tokens.tokens[t+1];if(s.type!==r.name||s.shadowsGlobal||t+2<this.tokens.tokens.length&&(this.tokens.matches1AtIndex(t+2,r.dot)||this.tokens.matches1AtIndex(t+2,r.bracketL)||this.tokens.matches1AtIndex(t+2,r.parenL)))return false;const i=this.tokens.identifierNameForToken(s),n=this.importProcessor.resolveExportBinding(i);return n?(this.tokens.appendCode(`${n} = `),this.tokens.copyToken(),true):false}processPostIncDec(){const t=this.tokens.currentIndex(),s=this.tokens.tokens[t],i=this.tokens.tokens[t+1];if(s.type!==r.name||s.shadowsGlobal||t>=1&&this.tokens.matches1AtIndex(t-1,r.dot))return false;const n=this.tokens.identifierNameForToken(s),a=this.importProcessor.resolveExportBinding(n);if(!a)return false;const o=this.tokens.rawCodeForToken(i),u=this.importProcessor.getIdentifierReplacement(n)||n;if(o==="++")this.tokens.replaceToken(`(${u} = ${a} = ${u} + 1, ${u} - 1)`);else if(o==="--")this.tokens.replaceToken(`(${u} = ${a} = ${u} - 1, ${u} + 1)`);else throw new Error(`Unexpected operator: ${o}`);return this.tokens.removeToken(),true}processExportDefault(){let t=true;if(this.tokens.matches4(r._export,r._default,r._function,r.name)||this.tokens.matches5(r._export,r._default,r.name,r._function,r.name)&&this.tokens.matchesContextualAtIndex(this.tokens.currentIndex()+2,g._async)){this.tokens.removeInitialToken(),this.tokens.removeToken();const s=this.processNamedFunction();this.tokens.appendCode(` exports.default = ${s};`)}else if(this.tokens.matches4(r._export,r._default,r._class,r.name)||this.tokens.matches5(r._export,r._default,r._abstract,r._class,r.name)||this.tokens.matches3(r._export,r._default,r.at)){this.tokens.removeInitialToken(),this.tokens.removeToken(),this.copyDecorators(),this.tokens.matches1(r._abstract)&&this.tokens.removeToken();const s=this.rootTransformer.processNamedClass();this.tokens.appendCode(` exports.default = ${s};`)}else if(Pl(this.isTypeScriptTransformEnabled,this.keepUnusedImports,this.tokens,this.declarationInfo))t=false,this.tokens.removeInitialToken(),this.tokens.removeToken(),this.tokens.removeToken();else if(this.reactHotLoaderTransformer){const s=this.nameManager.claimFreeName("_default");this.tokens.replaceToken(`let ${s}; exports.`),this.tokens.copyToken(),this.tokens.appendCode(` = ${s} =`),this.reactHotLoaderTransformer.setExtractedDefaultExportName(s)}else this.tokens.replaceToken("exports."),this.tokens.copyToken(),this.tokens.appendCode(" =");t&&(this.hadDefaultExport=true)}copyDecorators(){for(;this.tokens.matches1(r.at);)if(this.tokens.copyToken(),this.tokens.matches1(r.parenL))this.tokens.copyExpectedToken(r.parenL),this.rootTransformer.processBalancedCode(),this.tokens.copyExpectedToken(r.parenR);else{for(this.tokens.copyExpectedToken(r.name);this.tokens.matches1(r.dot);)this.tokens.copyExpectedToken(r.dot),this.tokens.copyExpectedToken(r.name);this.tokens.matches1(r.parenL)&&(this.tokens.copyExpectedToken(r.parenL),this.rootTransformer.processBalancedCode(),this.tokens.copyExpectedToken(r.parenR))}}processExportVar(){this.isSimpleExportVar()?this.processSimpleExportVar():this.processComplexExportVar()}isSimpleExportVar(){let t=this.tokens.currentIndex();if(t++,t++,!this.tokens.matches1AtIndex(t,r.name))return false;for(t++;t<this.tokens.tokens.length&&this.tokens.tokens[t].isType;)t++;return!!this.tokens.matches1AtIndex(t,r.eq)}processSimpleExportVar(){this.tokens.removeInitialToken(),this.tokens.copyToken();const t=this.tokens.identifierName();for(;!this.tokens.matches1(r.eq);)this.rootTransformer.processToken();const s=this.tokens.currentToken().rhsEndIndex;if(s==null)throw new Error("Expected = token with an end index.");for(;this.tokens.currentIndex()<s;)this.rootTransformer.processToken();this.tokens.appendCode(`; exports.${t} = ${t}`)}processComplexExportVar(){this.tokens.removeInitialToken(),this.tokens.removeToken();const t=this.tokens.matches1(r.braceL);t&&this.tokens.appendCode("(");let s=0;for(;;)if(this.tokens.matches1(r.braceL)||this.tokens.matches1(r.dollarBraceL)||this.tokens.matches1(r.bracketL))s++,this.tokens.copyToken();else if(this.tokens.matches1(r.braceR)||this.tokens.matches1(r.bracketR))s--,this.tokens.copyToken();else{if(s===0&&!this.tokens.matches1(r.name)&&!this.tokens.currentToken().isType)break;if(this.tokens.matches1(r.eq)){const i=this.tokens.currentToken().rhsEndIndex;if(i==null)throw new Error("Expected = token with an end index.");for(;this.tokens.currentIndex()<i;)this.rootTransformer.processToken()}else{const i=this.tokens.currentToken();if(wu(i)){const n=this.tokens.identifierName();let a=this.importProcessor.getIdentifierReplacement(n);if(a===null)throw new Error(`Expected a replacement for ${n} in \`export var\` syntax.`);Of(i)&&(a=`${n}: ${a}`),this.tokens.replaceToken(a)}else this.rootTransformer.processToken()}}if(t){const i=this.tokens.currentToken().rhsEndIndex;if(i==null)throw new Error("Expected = token with an end index.");for(;this.tokens.currentIndex()<i;)this.rootTransformer.processToken();this.tokens.appendCode(")")}}processExportFunction(){this.tokens.replaceToken("");const t=this.processNamedFunction();this.tokens.appendCode(` exports.${t} = ${t};`)}processNamedFunction(){if(this.tokens.matches1(r._function))this.tokens.copyToken();else if(this.tokens.matches2(r.name,r._function)){if(!this.tokens.matchesContextual(g._async))throw new Error("Expected async keyword in function export.");this.tokens.copyToken(),this.tokens.copyToken()}if(this.tokens.matches1(r.star)&&this.tokens.copyToken(),!this.tokens.matches1(r.name))throw new Error("Expected identifier for exported function name.");const t=this.tokens.identifierName();if(this.tokens.copyToken(),this.tokens.currentToken().isType)for(this.tokens.removeInitialToken();this.tokens.currentToken().isType;)this.tokens.removeToken();return this.tokens.copyExpectedToken(r.parenL),this.rootTransformer.processBalancedCode(),this.tokens.copyExpectedToken(r.parenR),this.rootTransformer.processPossibleTypeRange(),this.tokens.copyExpectedToken(r.braceL),this.rootTransformer.processBalancedCode(),this.tokens.copyExpectedToken(r.braceR),t}processExportClass(){this.tokens.removeInitialToken(),this.copyDecorators(),this.tokens.matches1(r._abstract)&&this.tokens.removeToken();const t=this.rootTransformer.processNamedClass();this.tokens.appendCode(` exports.${t} = ${t};`)}processExportBindings(){this.tokens.removeInitialToken(),this.tokens.removeToken();const t=Rl(this.tokens),s=[];for(;;){if(this.tokens.matches1(r.braceR)){this.tokens.removeToken();break}const i=Ys(this.tokens);for(;this.tokens.currentIndex()<i.endIndex;)this.tokens.removeToken();if(!(i.isType||!t&&this.shouldElideExportedIdentifier(i.leftName))){const a=i.rightName;a==="default"?this.hadDefaultExport=true:this.hadNamedExport=true;const o=i.leftName,u=this.importProcessor.getIdentifierReplacement(o);s.push(`exports.${a} = ${u||o};`)}if(this.tokens.matches1(r.braceR)){this.tokens.removeToken();break}if(this.tokens.matches2(r.comma,r.braceR)){this.tokens.removeToken(),this.tokens.removeToken();break}else if(this.tokens.matches1(r.comma))this.tokens.removeToken();else throw new Error(`Unexpected token: ${JSON.stringify(this.tokens.currentToken())}`)}if(this.tokens.matchesContextual(g._from)){this.tokens.removeToken();const i=this.tokens.stringValue();this.tokens.replaceTokenTrimmingLeftWhitespace(this.importProcessor.claimImportCode(i)),as(this.tokens)}else this.tokens.appendCode(s.join(" "));this.tokens.matches1(r.semi)&&this.tokens.removeToken()}processExportStar(){for(this.tokens.removeInitialToken();!this.tokens.matches1(r.string);)this.tokens.removeToken();const t=this.tokens.stringValue();this.tokens.replaceTokenTrimmingLeftWhitespace(this.importProcessor.claimImportCode(t)),as(this.tokens),this.tokens.matches1(r.semi)&&this.tokens.removeToken()}shouldElideExportedIdentifier(t){return this.isTypeScriptTransformEnabled&&!this.keepUnusedImports&&!this.declarationInfo.valueDeclarations.has(t)}}class dg extends gt{constructor(t,s,i,n,a,o,u,l){super(),this.tokens=t,this.nameManager=s,this.helperManager=i,this.reactHotLoaderTransformer=n,this.isTypeScriptTransformEnabled=a,this.isFlowTransformEnabled=o,this.keepUnusedImports=u,this.nonTypeIdentifiers=a&&!u?Ou(t,l):new Set,this.declarationInfo=a&&!u?Cl(t):Il,this.injectCreateRequireForImportRequire=!!l.injectCreateRequireForImportRequire}process(){if(this.tokens.matches3(r._import,r.name,r.eq))return this.processImportEquals();if(this.tokens.matches4(r._import,r.name,r.name,r.eq)&&this.tokens.matchesContextualAtIndex(this.tokens.currentIndex()+1,g._type)){this.tokens.removeInitialToken();for(let t=0;t<7;t++)this.tokens.removeToken();return true}if(this.tokens.matches2(r._export,r.eq))return this.tokens.replaceToken("module.exports"),true;if(this.tokens.matches5(r._export,r._import,r.name,r.name,r.eq)&&this.tokens.matchesContextualAtIndex(this.tokens.currentIndex()+2,g._type)){this.tokens.removeInitialToken();for(let t=0;t<8;t++)this.tokens.removeToken();return true}if(this.tokens.matches1(r._import))return this.processImport();if(this.tokens.matches2(r._export,r._default))return this.processExportDefault();if(this.tokens.matches2(r._export,r.braceL))return this.processNamedExports();if(this.tokens.matches2(r._export,r.name)&&this.tokens.matchesContextualAtIndex(this.tokens.currentIndex()+1,g._type)){if(this.tokens.removeInitialToken(),this.tokens.removeToken(),this.tokens.matches1(r.braceL)){for(;!this.tokens.matches1(r.braceR);)this.tokens.removeToken();this.tokens.removeToken()}else this.tokens.removeToken(),this.tokens.matches1(r._as)&&(this.tokens.removeToken(),this.tokens.removeToken());return this.tokens.matchesContextual(g._from)&&this.tokens.matches1AtIndex(this.tokens.currentIndex()+1,r.string)&&(this.tokens.removeToken(),this.tokens.removeToken(),as(this.tokens)),true}return false}processImportEquals(){const t=this.tokens.identifierNameAtIndex(this.tokens.currentIndex()+1);return this.shouldAutomaticallyElideImportedName(t)?Al(this.tokens):this.injectCreateRequireForImportRequire?(this.tokens.replaceToken("const"),this.tokens.copyToken(),this.tokens.copyToken(),this.tokens.replaceToken(this.helperManager.getHelperName("require"))):this.tokens.replaceToken("const"),true}processImport(){if(this.tokens.matches2(r._import,r.parenL))return false;const t=this.tokens.snapshot();if(this.removeImportTypeBindings()){for(this.tokens.restoreToSnapshot(t);!this.tokens.matches1(r.string);)this.tokens.removeToken();this.tokens.removeToken(),as(this.tokens),this.tokens.matches1(r.semi)&&this.tokens.removeToken()}return true}removeImportTypeBindings(){if(this.tokens.copyExpectedToken(r._import),this.tokens.matchesContextual(g._type)&&!this.tokens.matches1AtIndex(this.tokens.currentIndex()+1,r.comma)&&!this.tokens.matchesContextualAtIndex(this.tokens.currentIndex()+1,g._from))return true;if(this.tokens.matches1(r.string))return this.tokens.copyToken(),false;this.tokens.matchesContextual(g._module)&&this.tokens.matchesContextualAtIndex(this.tokens.currentIndex()+2,g._from)&&this.tokens.copyToken();let t=false,s=false,i=false;if(this.tokens.matches1(r.name)&&(this.shouldAutomaticallyElideImportedName(this.tokens.identifierName())?(this.tokens.removeToken(),this.tokens.matches1(r.comma)&&this.tokens.removeToken()):(t=true,this.tokens.copyToken(),this.tokens.matches1(r.comma)&&(i=true,this.tokens.removeToken()))),this.tokens.matches1(r.star))this.shouldAutomaticallyElideImportedName(this.tokens.identifierNameAtRelativeIndex(2))?(this.tokens.removeToken(),this.tokens.removeToken(),this.tokens.removeToken()):(i&&this.tokens.appendCode(","),t=true,this.tokens.copyExpectedToken(r.star),this.tokens.copyExpectedToken(r.name),this.tokens.copyExpectedToken(r.name));else if(this.tokens.matches1(r.braceL)){for(i&&this.tokens.appendCode(","),this.tokens.copyToken();!this.tokens.matches1(r.braceR);){s=true;const n=Ys(this.tokens);if(n.isType||this.shouldAutomaticallyElideImportedName(n.rightName)){for(;this.tokens.currentIndex()<n.endIndex;)this.tokens.removeToken();this.tokens.matches1(r.comma)&&this.tokens.removeToken()}else{for(t=true;this.tokens.currentIndex()<n.endIndex;)this.tokens.copyToken();this.tokens.matches1(r.comma)&&this.tokens.copyToken()}}this.tokens.copyExpectedToken(r.braceR)}return this.keepUnusedImports?false:this.isTypeScriptTransformEnabled?!t:this.isFlowTransformEnabled?s&&!t:false}shouldAutomaticallyElideImportedName(t){return this.isTypeScriptTransformEnabled&&!this.keepUnusedImports&&!this.nonTypeIdentifiers.has(t)}processExportDefault(){if(Pl(this.isTypeScriptTransformEnabled,this.keepUnusedImports,this.tokens,this.declarationInfo))return this.tokens.removeInitialToken(),this.tokens.removeToken(),this.tokens.removeToken(),true;if(!(this.tokens.matches4(r._export,r._default,r._function,r.name)||this.tokens.matches5(r._export,r._default,r.name,r._function,r.name)&&this.tokens.matchesContextualAtIndex(this.tokens.currentIndex()+2,g._async)||this.tokens.matches4(r._export,r._default,r._class,r.name)||this.tokens.matches5(r._export,r._default,r._abstract,r._class,r.name))&&this.reactHotLoaderTransformer){const s=this.nameManager.claimFreeName("_default");return this.tokens.replaceToken(`let ${s}; export`),this.tokens.copyToken(),this.tokens.appendCode(` ${s} =`),this.reactHotLoaderTransformer.setExtractedDefaultExportName(s),true}return false}processNamedExports(){if(!this.isTypeScriptTransformEnabled)return false;this.tokens.copyExpectedToken(r._export),this.tokens.copyExpectedToken(r.braceL);const t=Rl(this.tokens);let s=false;for(;!this.tokens.matches1(r.braceR);){const i=Ys(this.tokens);if(i.isType||!t&&this.shouldElideExportedName(i.leftName)){for(;this.tokens.currentIndex()<i.endIndex;)this.tokens.removeToken();this.tokens.matches1(r.comma)&&this.tokens.removeToken()}else{for(s=true;this.tokens.currentIndex()<i.endIndex;)this.tokens.copyToken();this.tokens.matches1(r.comma)&&this.tokens.copyToken()}}return this.tokens.copyExpectedToken(r.braceR),!this.keepUnusedImports&&t&&!s&&(this.tokens.removeToken(),this.tokens.removeToken(),as(this.tokens)),true}shouldElideExportedName(t){return this.isTypeScriptTransformEnabled&&!this.keepUnusedImports&&this.declarationInfo.typeDeclarations.has(t)&&!this.declarationInfo.valueDeclarations.has(t)}}class mg extends gt{constructor(t,s,i){super(),this.rootTransformer=t,this.tokens=s,this.isImportsTransformEnabled=i}process(){return this.rootTransformer.processPossibleArrowParamEnd()||this.rootTransformer.processPossibleAsyncArrowWithTypeParams()||this.rootTransformer.processPossibleTypeRange()?true:this.tokens.matches1(r._enum)?(this.processEnum(),true):this.tokens.matches2(r._export,r._enum)?(this.processNamedExportEnum(),true):this.tokens.matches3(r._export,r._default,r._enum)?(this.processDefaultExportEnum(),true):false}processNamedExportEnum(){if(this.isImportsTransformEnabled){this.tokens.removeInitialToken();const t=this.tokens.identifierNameAtRelativeIndex(1);this.processEnum(),this.tokens.appendCode(` exports.${t} = ${t};`)}else this.tokens.copyToken(),this.processEnum()}processDefaultExportEnum(){this.tokens.removeInitialToken(),this.tokens.removeToken();const t=this.tokens.identifierNameAtRelativeIndex(1);this.processEnum(),this.isImportsTransformEnabled?this.tokens.appendCode(` exports.default = ${t};`):this.tokens.appendCode(` export default ${t};`)}processEnum(){this.tokens.replaceToken("const"),this.tokens.copyExpectedToken(r.name);let t=false;this.tokens.matchesContextual(g._of)&&(this.tokens.removeToken(),t=this.tokens.matchesContextual(g._symbol),this.tokens.removeToken());const s=this.tokens.matches3(r.braceL,r.name,r.eq);this.tokens.appendCode(' = require("flow-enums-runtime")');const i=!t&&!s;for(this.tokens.replaceTokenTrimmingLeftWhitespace(i?".Mirrored([":"({");!this.tokens.matches1(r.braceR);){if(this.tokens.matches1(r.ellipsis)){this.tokens.removeToken();break}this.processEnumElement(t,s),this.tokens.matches1(r.comma)&&this.tokens.copyToken()}this.tokens.replaceToken(i?"]);":"});")}processEnumElement(t,s){if(t){const i=this.tokens.identifierName();this.tokens.copyToken(),this.tokens.appendCode(`: Symbol("${i}")`)}else s?(this.tokens.copyToken(),this.tokens.replaceTokenTrimmingLeftWhitespace(":"),this.tokens.copyToken()):this.tokens.replaceToken(`"${this.tokens.identifierName()}"`)}}function gg(e){let t,s=e[0],i=1;for(;i<e.length;){const n=e[i],a=e[i+1];if(i+=2,(n==="optionalAccess"||n==="optionalCall")&&s==null)return;n==="access"||n==="optionalAccess"?(t=s,s=a(s)):(n==="call"||n==="optionalCall")&&(s=a((...o)=>s.call(t,...o)),t=void 0)}return s}const pi="jest",bg=["mock","unmock","enableAutomock","disableAutomock"];class ja extends gt{__init(){this.hoistedFunctionNames=[]}constructor(t,s,i,n){super(),this.rootTransformer=t,this.tokens=s,this.nameManager=i,this.importProcessor=n,ja.prototype.__init.call(this)}process(){return this.tokens.currentToken().scopeDepth===0&&this.tokens.matches4(r.name,r.dot,r.name,r.parenL)&&this.tokens.identifierName()===pi?gg([this,"access",t=>t.importProcessor,"optionalAccess",t=>t.getGlobalNames,"call",t=>t(),"optionalAccess",t=>t.has,"call",t=>t(pi)])?false:this.extractHoistedCalls():false}getHoistedCode(){return this.hoistedFunctionNames.length>0?this.hoistedFunctionNames.map(t=>`${t}();`).join(""):""}extractHoistedCalls(){this.tokens.removeToken();let t=false;for(;this.tokens.matches3(r.dot,r.name,r.parenL);){const s=this.tokens.identifierNameAtIndex(this.tokens.currentIndex()+1);if(bg.includes(s)){const n=this.nameManager.claimFreeName("__jestHoist");this.hoistedFunctionNames.push(n),this.tokens.replaceToken(`function ${n}(){${pi}.`),this.tokens.copyToken(),this.tokens.copyToken(),this.rootTransformer.processBalancedCode(),this.tokens.copyExpectedToken(r.parenR),this.tokens.appendCode(";}"),t=false}else t?this.tokens.copyToken():this.tokens.replaceToken(`${pi}.`),this.tokens.copyToken(),this.tokens.copyToken(),this.rootTransformer.processBalancedCode(),this.tokens.copyExpectedToken(r.parenR),t=true}return true}}class yg extends gt{constructor(t){super(),this.tokens=t}process(){if(this.tokens.matches1(r.num)){const t=this.tokens.currentTokenCode();if(t.includes("_"))return this.tokens.replaceToken(t.replace(/_/g,"")),true}return false}}class _g extends gt{constructor(t,s){super(),this.tokens=t,this.nameManager=s}process(){return this.tokens.matches2(r._catch,r.braceL)?(this.tokens.copyToken(),this.tokens.appendCode(` (${this.nameManager.claimFreeName("e")})`),true):false}}class xg extends gt{constructor(t,s){super(),this.tokens=t,this.nameManager=s}process(){if(this.tokens.matches1(r.nullishCoalescing)){const i=this.tokens.currentToken();return this.tokens.tokens[i.nullishStartIndex].isAsyncOperation?this.tokens.replaceTokenTrimmingLeftWhitespace(", async () => ("):this.tokens.replaceTokenTrimmingLeftWhitespace(", () => ("),true}if(this.tokens.matches1(r._delete)&&this.tokens.tokenAtRelativeIndex(1).isOptionalChainStart)return this.tokens.removeInitialToken(),true;const s=this.tokens.currentToken().subscriptStartIndex;if(s!=null&&this.tokens.tokens[s].isOptionalChainStart&&this.tokens.tokenAtRelativeIndex(-1).type!==r._super){const i=this.nameManager.claimFreeName("_");let n;if(s>0&&this.tokens.matches1AtIndex(s-1,r._delete)&&this.isLastSubscriptInChain()?n=`${i} => delete ${i}`:n=`${i} => ${i}`,this.tokens.tokens[s].isAsyncOperation&&(n=`async ${n}`),this.tokens.matches2(r.questionDot,r.parenL)||this.tokens.matches2(r.questionDot,r.lessThan))this.justSkippedSuper()&&this.tokens.appendCode(".bind(this)"),this.tokens.replaceTokenTrimmingLeftWhitespace(`, 'optionalCall', ${n}`);else if(this.tokens.matches2(r.questionDot,r.bracketL))this.tokens.replaceTokenTrimmingLeftWhitespace(`, 'optionalAccess', ${n}`);else if(this.tokens.matches1(r.questionDot))this.tokens.replaceTokenTrimmingLeftWhitespace(`, 'optionalAccess', ${n}.`);else if(this.tokens.matches1(r.dot))this.tokens.replaceTokenTrimmingLeftWhitespace(`, 'access', ${n}.`);else if(this.tokens.matches1(r.bracketL))this.tokens.replaceTokenTrimmingLeftWhitespace(`, 'access', ${n}[`);else if(this.tokens.matches1(r.parenL))this.justSkippedSuper()&&this.tokens.appendCode(".bind(this)"),this.tokens.replaceTokenTrimmingLeftWhitespace(`, 'call', ${n}(`);else throw new Error("Unexpected subscript operator in optional chain.");return true}return false}isLastSubscriptInChain(){let t=0;for(let s=this.tokens.currentIndex()+1;;s++){if(s>=this.tokens.tokens.length)throw new Error("Reached the end of the code while finding the end of the access chain.");if(this.tokens.tokens[s].isOptionalChainStart?t++:this.tokens.tokens[s].isOptionalChainEnd&&t--,t<0)return true;if(t===0&&this.tokens.tokens[s].subscriptStartIndex!=null)return false}}justSkippedSuper(){let t=0,s=this.tokens.currentIndex()-1;for(;;){if(s<0)throw new Error("Reached the start of the code while finding the start of the access chain.");if(this.tokens.tokens[s].isOptionalChainStart?t--:this.tokens.tokens[s].isOptionalChainEnd&&t++,t<0)return false;if(t===0&&this.tokens.tokens[s].subscriptStartIndex!=null)return this.tokens.tokens[s-1].type===r._super;s--}}}class vg extends gt{constructor(t,s,i,n){super(),this.rootTransformer=t,this.tokens=s,this.importProcessor=i,this.options=n}process(){const t=this.tokens.currentIndex();if(this.tokens.identifierName()==="createReactClass"){const s=this.importProcessor&&this.importProcessor.getIdentifierReplacement("createReactClass");return s?this.tokens.replaceToken(`(0, ${s})`):this.tokens.copyToken(),this.tryProcessCreateClassCall(t),true}if(this.tokens.matches3(r.name,r.dot,r.name)&&this.tokens.identifierName()==="React"&&this.tokens.identifierNameAtIndex(this.tokens.currentIndex()+2)==="createClass"){const s=this.importProcessor&&this.importProcessor.getIdentifierReplacement("React")||"React";return s?(this.tokens.replaceToken(s),this.tokens.copyToken(),this.tokens.copyToken()):(this.tokens.copyToken(),this.tokens.copyToken(),this.tokens.copyToken()),this.tryProcessCreateClassCall(t),true}return false}tryProcessCreateClassCall(t){const s=this.findDisplayName(t);s&&this.classNeedsDisplayName()&&(this.tokens.copyExpectedToken(r.parenL),this.tokens.copyExpectedToken(r.braceL),this.tokens.appendCode(`displayName: '${s}',`),this.rootTransformer.processBalancedCode(),this.tokens.copyExpectedToken(r.braceR),this.tokens.copyExpectedToken(r.parenR))}findDisplayName(t){return t<2?null:this.tokens.matches2AtIndex(t-2,r.name,r.eq)?this.tokens.identifierNameAtIndex(t-2):t>=2&&this.tokens.tokens[t-2].identifierRole===ie.ObjectKey?this.tokens.identifierNameAtIndex(t-2):this.tokens.matches2AtIndex(t-2,r._export,r._default)?this.getDisplayNameFromFilename():null}getDisplayNameFromFilename(){const s=(this.options.filePath||"unknown").split("/"),i=s[s.length-1],n=i.lastIndexOf("."),a=n===-1?i:i.slice(0,n);return a==="index"&&s[s.length-2]?s[s.length-2]:a}classNeedsDisplayName(){let t=this.tokens.currentIndex();if(!this.tokens.matches2(r.parenL,r.braceL))return false;const s=t+1,i=this.tokens.tokens[s].contextId;if(i==null)throw new Error("Expected non-null context ID on object open-brace.");for(;t<this.tokens.tokens.length;t++){const n=this.tokens.tokens[t];if(n.type===r.braceR&&n.contextId===i){t++;break}if(this.tokens.identifierNameAtIndex(t)==="displayName"&&this.tokens.tokens[t].identifierRole===ie.ObjectKey&&n.contextId===i)return false}if(t===this.tokens.tokens.length)throw new Error("Unexpected end of input when processing React class.");return this.tokens.matches1AtIndex(t,r.parenR)||this.tokens.matches2AtIndex(t,r.comma,r.parenR)}}class $a extends gt{__init(){this.extractedDefaultExportName=null}constructor(t,s){super(),this.tokens=t,this.filePath=s,$a.prototype.__init.call(this)}setExtractedDefaultExportName(t){this.extractedDefaultExportName=t}getPrefixCode(){return`
|
|
566
566
|
(function () {
|
|
567
567
|
var enterModule = require('react-hot-loader').enterModule;
|
|
568
568
|
enterModule && enterModule(module);
|
|
@@ -576,12 +576,12 @@ module.exports = exports.default;
|
|
|
576
576
|
${s.map(({variableName:i,uniqueLocalName:n})=>` reactHotLoader.register(${i}, "${n}", ${JSON.stringify(this.filePath||"")});`).join(`
|
|
577
577
|
`)}
|
|
578
578
|
leaveModule(module);
|
|
579
|
-
})();`}process(){return false}}const
|
|
579
|
+
})();`}process(){return false}}const kg=new Set(["break","case","catch","class","const","continue","debugger","default","delete","do","else","export","extends","finally","for","function","if","import","in","instanceof","new","return","super","switch","this","throw","try","typeof","var","void","while","with","yield","enum","implements","interface","let","package","private","protected","public","static","await","false","null","true"]);function Xo(e){if(e.length===0||!ii[e.charCodeAt(0)])return false;for(let t=1;t<e.length;t++)if(!mt[e.charCodeAt(t)])return false;return!kg.has(e)}class wg extends gt{constructor(t,s,i){super(),this.rootTransformer=t,this.tokens=s,this.isImportsTransformEnabled=i}process(){return this.rootTransformer.processPossibleArrowParamEnd()||this.rootTransformer.processPossibleAsyncArrowWithTypeParams()||this.rootTransformer.processPossibleTypeRange()?true:this.tokens.matches1(r._public)||this.tokens.matches1(r._protected)||this.tokens.matches1(r._private)||this.tokens.matches1(r._abstract)||this.tokens.matches1(r._readonly)||this.tokens.matches1(r._override)||this.tokens.matches1(r.nonNullAssertion)?(this.tokens.removeInitialToken(),true):this.tokens.matches1(r._enum)||this.tokens.matches2(r._const,r._enum)?(this.processEnum(),true):this.tokens.matches2(r._export,r._enum)||this.tokens.matches3(r._export,r._const,r._enum)?(this.processEnum(true),true):false}processEnum(t=false){for(this.tokens.removeInitialToken();this.tokens.matches1(r._const)||this.tokens.matches1(r._enum);)this.tokens.removeToken();const s=this.tokens.identifierName();this.tokens.removeToken(),t&&!this.isImportsTransformEnabled&&this.tokens.appendCode("export "),this.tokens.appendCode(`var ${s}; (function (${s})`),this.tokens.copyExpectedToken(r.braceL),this.processEnumBody(s),this.tokens.copyExpectedToken(r.braceR),t&&this.isImportsTransformEnabled?this.tokens.appendCode(`)(${s} || (exports.${s} = ${s} = {}));`):this.tokens.appendCode(`)(${s} || (${s} = {}));`)}processEnumBody(t){let s=null;for(;!this.tokens.matches1(r.braceR);){const{nameStringCode:i,variableName:n}=this.extractEnumKeyInfo(this.tokens.currentToken());this.tokens.removeInitialToken(),this.tokens.matches3(r.eq,r.string,r.comma)||this.tokens.matches3(r.eq,r.string,r.braceR)?this.processStringLiteralEnumMember(t,i,n):this.tokens.matches1(r.eq)?this.processExplicitValueEnumMember(t,i,n):this.processImplicitValueEnumMember(t,i,n,s),this.tokens.matches1(r.comma)&&this.tokens.removeToken(),n!=null?s=n:s=`${t}[${i}]`}}extractEnumKeyInfo(t){if(t.type===r.name){const s=this.tokens.identifierNameForToken(t);return{nameStringCode:`"${s}"`,variableName:Xo(s)?s:null}}else if(t.type===r.string){const s=this.tokens.stringValueForToken(t);return{nameStringCode:this.tokens.code.slice(t.start,t.end),variableName:Xo(s)?s:null}}else throw new Error("Expected name or string at beginning of enum element.")}processStringLiteralEnumMember(t,s,i){i!=null?(this.tokens.appendCode(`const ${i}`),this.tokens.copyToken(),this.tokens.copyToken(),this.tokens.appendCode(`; ${t}[${s}] = ${i};`)):(this.tokens.appendCode(`${t}[${s}]`),this.tokens.copyToken(),this.tokens.copyToken(),this.tokens.appendCode(";"))}processExplicitValueEnumMember(t,s,i){const n=this.tokens.currentToken().rhsEndIndex;if(n==null)throw new Error("Expected rhsEndIndex on enum assign.");if(i!=null){for(this.tokens.appendCode(`const ${i}`),this.tokens.copyToken();this.tokens.currentIndex()<n;)this.rootTransformer.processToken();this.tokens.appendCode(`; ${t}[${t}[${s}] = ${i}] = ${s};`)}else{for(this.tokens.appendCode(`${t}[${t}[${s}]`),this.tokens.copyToken();this.tokens.currentIndex()<n;)this.rootTransformer.processToken();this.tokens.appendCode(`] = ${s};`)}}processImplicitValueEnumMember(t,s,i,n){let a=n!=null?`${n} + 1`:"0";i!=null&&(this.tokens.appendCode(`const ${i} = ${a}; `),a=i),this.tokens.appendCode(`${t}[${t}[${s}] = ${a}] = ${s};`)}}class Oi{__init(){this.transformers=[]}__init2(){this.generatedVariables=[]}constructor(t,s,i,n){Oi.prototype.__init.call(this),Oi.prototype.__init2.call(this),this.nameManager=t.nameManager,this.helperManager=t.helperManager;const{tokenProcessor:a,importProcessor:o}=t;this.tokens=a,this.isImportsTransformEnabled=s.includes("imports"),this.isReactHotLoaderTransformEnabled=s.includes("react-hot-loader"),this.disableESTransforms=!!n.disableESTransforms,n.disableESTransforms||(this.transformers.push(new xg(a,this.nameManager)),this.transformers.push(new yg(a)),this.transformers.push(new _g(a,this.nameManager))),s.includes("jsx")&&(n.jsxRuntime!=="preserve"&&this.transformers.push(new ss(this,a,o,this.nameManager,n)),this.transformers.push(new vg(this,a,o,n)));let u=null;if(s.includes("react-hot-loader")){if(!n.filePath)throw new Error("filePath is required when using the react-hot-loader transform.");u=new $a(a,n.filePath),this.transformers.push(u)}if(s.includes("imports")){if(o===null)throw new Error("Expected non-null importProcessor with imports transform enabled.");this.transformers.push(new $s(this,a,o,this.nameManager,this.helperManager,u,i,!!n.enableLegacyTypeScriptModuleInterop,s.includes("typescript"),s.includes("flow"),!!n.preserveDynamicImport,!!n.keepUnusedImports))}else this.transformers.push(new dg(a,this.nameManager,this.helperManager,u,s.includes("typescript"),s.includes("flow"),!!n.keepUnusedImports,n));s.includes("flow")&&this.transformers.push(new mg(this,a,s.includes("imports"))),s.includes("typescript")&&this.transformers.push(new wg(this,a,s.includes("imports"))),s.includes("jest")&&this.transformers.push(new ja(this,a,this.nameManager,o))}transform(){this.tokens.reset(),this.processBalancedCode();let s=this.isImportsTransformEnabled?'"use strict";':"";for(const o of this.transformers)s+=o.getPrefixCode();s+=this.helperManager.emitHelpers(),s+=this.generatedVariables.map(o=>` var ${o};`).join("");for(const o of this.transformers)s+=o.getHoistedCode();let i="";for(const o of this.transformers)i+=o.getSuffixCode();const n=this.tokens.finish();let{code:a}=n;if(a.startsWith("#!")){let o=a.indexOf(`
|
|
580
580
|
`);return o===-1&&(o=a.length,a+=`
|
|
581
|
-
`),{code:a.slice(0,o+1)+s+a.slice(o+1)+i,mappings:this.shiftMappings(n.mappings,s.length)}}else return{code:s+a+i,mappings:this.shiftMappings(n.mappings,s.length)}}processBalancedCode(){let t=0,s=0;for(;!this.tokens.isAtEnd();){if(this.tokens.matches1(r.braceL)||this.tokens.matches1(r.dollarBraceL))t++;else if(this.tokens.matches1(r.braceR)){if(t===0)return;t--}if(this.tokens.matches1(r.parenL))s++;else if(this.tokens.matches1(r.parenR)){if(s===0)return;s--}this.processToken()}}processToken(){if(this.tokens.matches1(r._class)){this.processClass();return}for(const t of this.transformers)if(t.process())return;this.tokens.copyToken()}processNamedClass(){if(!this.tokens.matches2(r._class,r.name))throw new Error("Expected identifier for exported class name.");const t=this.tokens.identifierNameAtIndex(this.tokens.currentIndex()+1);return this.processClass(),t}processClass(){const t=
|
|
582
|
-
`,s="\r",i=function(){function n(a){this.string=a;for(var o=[0],u=0;u<a.length;)switch(a[u]){case t:u+=t.length,o.push(u);break;case s:u+=s.length,a[u]===t&&(u+=t.length),o.push(u);break;default:u++;break}this.offsets=o}return n.prototype.locationForIndex=function(a){if(a<0||a>this.string.length)return null;for(var o=0,u=this.offsets;u[o+1]<=a;)o++;var l=a-u[o];return{line:o,column:l}},n.prototype.indexForLocation=function(a){var o=a.line,u=a.column;return o<0||o>=this.offsets.length||u<0||u>this.lengthOfLine(o)?null:this.offsets[o]+u},n.prototype.lengthOfLine=function(a){var o=this.offsets[a],u=a===this.offsets.length-1?this.string.length:this.offsets[a+1];return u-o},n}();e.LinesAndColumns=i,e.default=i})(wg);function Sg(e){const t=new Set;for(let s=0;s<e.tokens.length;s++)e.matches1AtIndex(s,r._import)&&!e.matches3AtIndex(s,r._import,r.name,r.eq)&&Eg(e,s,t);return t}function Eg(e,t,s){t++,!e.matches1AtIndex(t,r.parenL)&&(e.matches1AtIndex(t,r.name)&&(s.add(e.identifierNameAtIndex(t)),t++,e.matches1AtIndex(t,r.comma)&&t++),e.matches1AtIndex(t,r.star)&&(t+=2,s.add(e.identifierNameAtIndex(t)),t++),e.matches1AtIndex(t,r.braceL)&&(t++,Tg(e,t,s)))}function Tg(e,t,s){for(;;){if(e.matches1AtIndex(t,r.braceR))return;const i=Ys(e,t);if(t=i.endIndex,i.isType||s.add(i.rightName),e.matches2AtIndex(t,r.comma,r.braceR))return;if(e.matches1AtIndex(t,r.braceR))return;if(e.matches1AtIndex(t,r.comma))t++;else throw new Error(`Unexpected token: ${JSON.stringify(e.tokens[t])}`)}}function Ag(e,t){qp(t);try{const s=Ig(e,t),n=new Oi(s,t.transforms,!!t.enableLegacyBabel5ModuleInterop,t).transform();let a={code:n.code};if(t.sourceMapOptions){if(!t.filePath)throw new Error("filePath must be specified when generating a source map.");a={...a,sourceMap:Cp(n,t.filePath,t.sourceMapOptions,e,s.tokenProcessor.tokens)}}return a}catch(s){throw t.filePath&&(s.message=`Error transforming ${t.filePath}: ${s.message}`),s}}function Ig(e,t){const s=t.transforms.includes("jsx"),i=t.transforms.includes("typescript"),n=t.transforms.includes("flow"),a=t.disableESTransforms===true,o=cg(e,s,i,n),u=o.tokens,l=o.scopes,h=new ba(e,u),d=new Ri(h),m=new js(e,u,n,a,d),_=!!t.enableLegacyTypeScriptModuleInterop;let k=null;return t.transforms.includes("imports")?(k=new is(h,m,_,t,t.transforms.includes("typescript"),!!t.keepUnusedImports,d),k.preprocessTokens(),Do(m,l,k.getGlobalNames()),t.transforms.includes("typescript")&&!t.keepUnusedImports&&k.pruneTypeOnlyImports()):t.transforms.includes("typescript")&&!t.keepUnusedImports&&Do(m,l,Sg(m)),{tokenProcessor:m,scopes:l,nameManager:h,importProcessor:k,helperManager:d}}function Hn(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"&&"BYTES_PER_ELEMENT"in e&&e.BYTES_PER_ELEMENT===1}const Bi=e=>e?`"${e}" `:"";function Wn(e,t=""){if(typeof e!="boolean")throw new TypeError(Bi(t)+"expected boolean, got type="+typeof e);return e}function xs(e,t=""){if(typeof e!="number")throw new TypeError(Bi(t)+"expected number, got "+typeof e);if(!Number.isSafeInteger(e)||e<0)throw new RangeError(Bi(t)+"expected integer >= 0, got "+e);return e}function Ue(e,t,s=""){if(Hn(e)&&(t===void 0||e.length===t))return e;t!==void 0&&xs(t,"length");const i=Hn(e),n=t!==void 0?` of length ${t}`:"",a=i?`length=${e.length}`:`type=${typeof e}`,o=Bi(s)+"expected Uint8Array"+n+", got "+a;throw i?new RangeError(o):new TypeError(o)}const Yo=(e,t)=>{if(e===null||typeof e!="object"||Array.isArray(e))throw new TypeError(t==="object"?"expected valid options object":`"${t}" expected object, got type=${typeof e}`)};function zo(e,t=true){if(e.destroyed)throw new Error("hash was destroyed");if(t&&e.finished)throw new Error("digest() was already called")}function Cg(e,t){Ue(e,void 0,"output");const s=t.outputLen;if(!(e.length>=s))throw new RangeError('"output" expected length >= '+s)}function Ft(e){return new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4))}function Et(...e){for(let t=0;t<e.length;t++)e[t].fill(0)}function Rg(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}const kt=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function Pg(e){return e<<24&4278190080|e<<8&16711680|e>>>8&65280|e>>>24&255}function Lg(e){for(let t=0;t<e.length;t++)e[t]=Pg(e[t]);return e}const pt=kt?e=>e:Lg;function Dg(e,t){return Yo(e,"defaults"),Yo(t,"opts"),Object.assign(e,t)}function Ng(e,t){if(e=Ue(e),t=Ue(t),e.length!==t.length)return false;let s=0;for(let i=0;i<e.length;i++)s|=e[i]^t[i];return s===0}function Fg(e,t,s){const i=t,n=()=>[],a=(u,l)=>i(l,...n(u)).update(u).digest(),o=i(new Uint8Array(e),...n(new Uint8Array(0)));return a.outputLen=o.outputLen,a.blockLen=o.blockLen,a.create=(u,...l)=>i(u,...l),a}const Ug=(e,t)=>{function s(i,...n){if(Ue(i,void 0,"key"),e.nonceLength!==void 0){const m=n[0];Ue(m,e.varSizeNonce?void 0:e.nonceLength,"nonce")}const a=e.tagLength,o=e.nonceLength!==void 0?1:0;if(!e.withAAD){for(let m=o;m<n.length;m++)if(Hn(n[m]))throw new Error("AAD not supported")}e.withAAD&&n[o]!==void 0&&Ue(n[o],void 0,"AAD");const u=t(i,...n),l=(m,_)=>{if(_!==void 0){if(m!==2)throw new Error("cipher output not supported");Ue(_,void 0,"output")}};let h=false;return{encrypt(m,_){if(h)throw new Error("cannot encrypt() twice with same key + nonce");return h=true,Ue(m,void 0,"data"),l(u.encrypt.length,_),u.encrypt(m,_)},decrypt(m,_){if(Ue(m,void 0,"data"),a&&m.length<a)throw new Error('"ciphertext" expected length >= tagLength='+a);return l(u.decrypt.length,_),u.decrypt(m,_)}}}return Object.assign(s,e),s};function Gn(e,t,s=true){if(t===void 0)return new Uint8Array(e);if(Ue(t,e,"output"),s&&!Vi(t))throw new Error("invalid output, must be aligned");return t}function Mg(e,t,s){xs(e),xs(t),Wn(s);const i=new Uint8Array(16),n=Rg(i);return n.setBigUint64(0,BigInt(t),s),n.setBigUint64(8,BigInt(e),s),i}function Vi(e){return e.byteOffset%4===0}function ji(e){return Uint8Array.from(Ue(e))}const Ll=e=>Uint8Array.from(e.split(""),t=>t.charCodeAt(0)),Og=pt(Ft(Ll("expand 16-byte k"))),Bg=pt(Ft(Ll("expand 32-byte k")));function xe(e,t){return e<<t|e>>>32-t}const Us=64,Vg=16,Xn=2**32-1,Ko=Uint32Array.of();function jg(e,t,s,i,n,a,o,u){const l=n.length,h=new Uint8Array(Us),d=Ft(h),m=kt&&Vi(n)&&Vi(a),_=m?Ft(n):Ko,k=m?Ft(a):Ko;if(!kt){for(let T=0;T<l;o++){if(e(t,s,i,d,o,u),pt(d),o>=Xn)throw new Error("arx: counter overflow");const P=Math.min(Us,l-T);for(let F=0,B;F<P;F++)B=T+F,a[B]=n[B]^h[F];T+=P}return}for(let T=0;T<l;o++){if(e(t,s,i,d,o,u),o>=Xn)throw new Error("arx: counter overflow");const P=Math.min(Us,l-T);if(m&&P===Us){const F=T/4;if(T%4!==0)throw new Error("arx: invalid block position");for(let B=0,N;B<Vg;B++)N=F+B,k[N]=_[N]^d[B];T+=Us;continue}for(let F=0,B;F<P;F++)B=T+F,a[B]=n[B]^h[F];T+=P}}function $g(e,t){const{allowShortKeys:s,extendNonceFn:i,counterLength:n,counterRight:a,rounds:o}=Dg({allowShortKeys:false,counterLength:8,counterRight:false,rounds:20},t);if(typeof e!="function")throw new Error("core must be a function");return xs(n),xs(o),Wn(a),Wn(s),(u,l,h,d,m=0)=>{Ue(u,void 0,"key"),Ue(l,void 0,"nonce"),Ue(h,void 0,"data");const _=h.length;if(d=Gn(_,d,false),xs(m),m<0||m>=Xn)throw new Error("arx: counter overflow");const k=[];let T=u.length,P,F;if(T===32)k.push(P=ji(u)),F=Bg;else if(T===16&&s)P=new Uint8Array(32),P.set(u),P.set(u,16),F=Og,k.push(P);else throw Ue(u,32,"arx key"),new Error("invalid key size");(!kt||!Vi(l))&&k.push(l=ji(l));let B=Ft(P);if(i){if(l.length!==24)throw new Error("arx: extended nonce must be 24 bytes");const q=l.subarray(0,16);if(kt)i(F,B,Ft(q),B);else{const z=pt(Uint32Array.from(F));i(z,B,Ft(q),B),Et(z),pt(B)}l=l.subarray(16)}else kt||pt(B);const N=16-n;if(N!==l.length)throw new Error(`arx: nonce must be ${N} or 16 bytes`);if(N!==12){const q=new Uint8Array(12);q.set(l,a?0:12-l.length),l=q,k.push(l)}const Y=pt(Ft(l));try{return jg(e,F,B,Y,h,d,m,o),d}finally{Et(...k)}}}function Be(e,t){return e[t++]&255|(e[t++]&255)<<8}class qg{blockLen=16;outputLen=16;buffer=new Uint8Array(16);r=new Uint16Array(10);h=new Uint16Array(10);pad=new Uint16Array(8);pos=0;finished=false;destroyed=false;constructor(t){t=ji(Ue(t,32,"key"));const s=Be(t,0),i=Be(t,2),n=Be(t,4),a=Be(t,6),o=Be(t,8),u=Be(t,10),l=Be(t,12),h=Be(t,14);this.r[0]=s&8191,this.r[1]=(s>>>13|i<<3)&8191,this.r[2]=(i>>>10|n<<6)&7939,this.r[3]=(n>>>7|a<<9)&8191,this.r[4]=(a>>>4|o<<12)&255,this.r[5]=o>>>1&8190,this.r[6]=(o>>>14|u<<2)&8191,this.r[7]=(u>>>11|l<<5)&8065,this.r[8]=(l>>>8|h<<8)&8191,this.r[9]=h>>>5&127;for(let d=0;d<8;d++)this.pad[d]=Be(t,16+2*d)}process(t,s,i=false){const n=i?0:2048,{h:a,r:o}=this,u=o[0],l=o[1],h=o[2],d=o[3],m=o[4],_=o[5],k=o[6],T=o[7],P=o[8],F=o[9],B=Be(t,s+0),N=Be(t,s+2),Y=Be(t,s+4),q=Be(t,s+6),z=Be(t,s+8),J=Be(t,s+10),K=Be(t,s+12),X=Be(t,s+14);let re=a[0]+(B&8191),x=a[1]+((B>>>13|N<<3)&8191),b=a[2]+((N>>>10|Y<<6)&8191),v=a[3]+((Y>>>7|q<<9)&8191),V=a[4]+((q>>>4|z<<12)&8191),W=a[5]+(z>>>1&8191),M=a[6]+((z>>>14|J<<2)&8191),R=a[7]+((J>>>11|K<<5)&8191),O=a[8]+((K>>>8|X<<8)&8191),U=a[9]+(X>>>5|n),I=0,H=I+re*u+x*(5*F)+b*(5*P)+v*(5*T)+V*(5*k);I=H>>>13,H&=8191,H+=W*(5*_)+M*(5*m)+R*(5*d)+O*(5*h)+U*(5*l),I+=H>>>13,H&=8191;let G=I+re*l+x*u+b*(5*F)+v*(5*P)+V*(5*T);I=G>>>13,G&=8191,G+=W*(5*k)+M*(5*_)+R*(5*m)+O*(5*d)+U*(5*h),I+=G>>>13,G&=8191;let te=I+re*h+x*l+b*u+v*(5*F)+V*(5*P);I=te>>>13,te&=8191,te+=W*(5*T)+M*(5*k)+R*(5*_)+O*(5*m)+U*(5*d),I+=te>>>13,te&=8191;let ce=I+re*d+x*h+b*l+v*u+V*(5*F);I=ce>>>13,ce&=8191,ce+=W*(5*P)+M*(5*T)+R*(5*k)+O*(5*_)+U*(5*m),I+=ce>>>13,ce&=8191;let oe=I+re*m+x*d+b*h+v*l+V*u;I=oe>>>13,oe&=8191,oe+=W*(5*F)+M*(5*P)+R*(5*T)+O*(5*k)+U*(5*_),I+=oe>>>13,oe&=8191;let w=I+re*_+x*m+b*d+v*h+V*l;I=w>>>13,w&=8191,w+=W*u+M*(5*F)+R*(5*P)+O*(5*T)+U*(5*k),I+=w>>>13,w&=8191;let E=I+re*k+x*_+b*m+v*d+V*h;I=E>>>13,E&=8191,E+=W*l+M*u+R*(5*F)+O*(5*P)+U*(5*T),I+=E>>>13,E&=8191;let D=I+re*T+x*k+b*_+v*m+V*d;I=D>>>13,D&=8191,D+=W*h+M*l+R*u+O*(5*F)+U*(5*P),I+=D>>>13,D&=8191;let L=I+re*P+x*T+b*k+v*_+V*m;I=L>>>13,L&=8191,L+=W*d+M*h+R*l+O*u+U*(5*F),I+=L>>>13,L&=8191;let j=I+re*F+x*P+b*T+v*k+V*_;I=j>>>13,j&=8191,j+=W*m+M*d+R*h+O*l+U*u,I+=j>>>13,j&=8191,I=(I<<2)+I|0,I=I+H|0,H=I&8191,I=I>>>13,G+=I,a[0]=H,a[1]=G,a[2]=te,a[3]=ce,a[4]=oe,a[5]=w,a[6]=E,a[7]=D,a[8]=L,a[9]=j}finalize(){const{h:t,pad:s}=this,i=new Uint16Array(10);let n=t[1]>>>13;t[1]&=8191;for(let u=2;u<10;u++)t[u]+=n,n=t[u]>>>13,t[u]&=8191;t[0]+=n*5,n=t[0]>>>13,t[0]&=8191,t[1]+=n,n=t[1]>>>13,t[1]&=8191,t[2]+=n,i[0]=t[0]+5,n=i[0]>>>13,i[0]&=8191;for(let u=1;u<10;u++)i[u]=t[u]+n,n=i[u]>>>13,i[u]&=8191;i[9]-=8192;let a=(n^1)-1;for(let u=0;u<10;u++)i[u]&=a;a=~a;for(let u=0;u<10;u++)t[u]=t[u]&a|i[u];t[0]=(t[0]|t[1]<<13)&65535,t[1]=(t[1]>>>3|t[2]<<10)&65535,t[2]=(t[2]>>>6|t[3]<<7)&65535,t[3]=(t[3]>>>9|t[4]<<4)&65535,t[4]=(t[4]>>>12|t[5]<<1|t[6]<<14)&65535,t[5]=(t[6]>>>2|t[7]<<11)&65535,t[6]=(t[7]>>>5|t[8]<<8)&65535,t[7]=(t[8]>>>8|t[9]<<5)&65535;let o=t[0]+s[0];t[0]=o&65535;for(let u=1;u<8;u++)o=(t[u]+s[u]|0)+(o>>>16)|0,t[u]=o&65535;Et(i)}update(t){zo(this),Ue(t),t=ji(t);const{buffer:s,blockLen:i}=this,n=t.length;for(let a=0;a<n;){const o=Math.min(i-this.pos,n-a);if(o===i){for(;i<=n-a;a+=i)this.process(t,a);continue}s.set(t.subarray(a,a+o),this.pos),this.pos+=o,a+=o,this.pos===i&&(this.process(s,0,false),this.pos=0)}return this}destroy(){this.destroyed=true,Et(this.h,this.r,this.buffer,this.pad)}digestInto(t){zo(this),Cg(t,this),this.finished=true;const{buffer:s,h:i}=this;let{pos:n}=this;if(n){for(s[n++]=1;n<16;n++)s[n]=0;this.process(s,0,true)}this.finalize();let a=0;for(let o=0;o<8;o++)t[a++]=i[o]>>>0,t[a++]=i[o]>>>8}digest(){const{buffer:t,outputLen:s}=this;this.digestInto(t);const i=t.slice(0,s);return this.destroy(),i}}const Hg=Fg(32,e=>new qg(e));function Dl(e,t,s,i,n,a=20){let o=e[0],u=e[1],l=e[2],h=e[3],d=t[0],m=t[1],_=t[2],k=t[3],T=t[4],P=t[5],F=t[6],B=t[7],N=n,Y=s[0],q=s[1],z=s[2],J=o,K=u,X=l,re=h,x=d,b=m,v=_,V=k,W=T,M=P,R=F,O=B,U=N,I=Y,H=q,G=z;for(let ce=0;ce<a;ce+=2)J=J+x|0,U=xe(U^J,16),W=W+U|0,x=xe(x^W,12),J=J+x|0,U=xe(U^J,8),W=W+U|0,x=xe(x^W,7),K=K+b|0,I=xe(I^K,16),M=M+I|0,b=xe(b^M,12),K=K+b|0,I=xe(I^K,8),M=M+I|0,b=xe(b^M,7),X=X+v|0,H=xe(H^X,16),R=R+H|0,v=xe(v^R,12),X=X+v|0,H=xe(H^X,8),R=R+H|0,v=xe(v^R,7),re=re+V|0,G=xe(G^re,16),O=O+G|0,V=xe(V^O,12),re=re+V|0,G=xe(G^re,8),O=O+G|0,V=xe(V^O,7),J=J+b|0,G=xe(G^J,16),R=R+G|0,b=xe(b^R,12),J=J+b|0,G=xe(G^J,8),R=R+G|0,b=xe(b^R,7),K=K+v|0,U=xe(U^K,16),O=O+U|0,v=xe(v^O,12),K=K+v|0,U=xe(U^K,8),O=O+U|0,v=xe(v^O,7),X=X+V|0,I=xe(I^X,16),W=W+I|0,V=xe(V^W,12),X=X+V|0,I=xe(I^X,8),W=W+I|0,V=xe(V^W,7),re=re+x|0,H=xe(H^re,16),M=M+H|0,x=xe(x^M,12),re=re+x|0,H=xe(H^re,8),M=M+H|0,x=xe(x^M,7);let te=0;i[te++]=o+J|0,i[te++]=u+K|0,i[te++]=l+X|0,i[te++]=h+re|0,i[te++]=d+x|0,i[te++]=m+b|0,i[te++]=_+v|0,i[te++]=k+V|0,i[te++]=T+W|0,i[te++]=P+M|0,i[te++]=F+R|0,i[te++]=B+O|0,i[te++]=N+U|0,i[te++]=Y+I|0,i[te++]=q+H|0,i[te++]=z+G|0}function Wg(e,t,s,i){const n=kt?e:pt(e.slice(0,4)),a=kt?t:pt(t.slice(0,8)),o=kt?s:pt(s.slice(0,4)),u=new Uint32Array(16);Dl(n,a,o.subarray(1),u,o[0]);let l=0;i[l++]=u[0]-n[0]|0,i[l++]=u[1]-n[1]|0,i[l++]=u[2]-n[2]|0,i[l++]=u[3]-n[3]|0,i[l++]=u[12]-o[0]|0,i[l++]=u[13]-o[1]|0,i[l++]=u[14]-o[2]|0,i[l++]=u[15]-o[3]|0,pt(i),kt||Et(n,a,o),Et(u)}const Gg=$g(Dl,{counterRight:false,counterLength:8,extendNonceFn:Wg,allowShortKeys:false}),Xg=new Uint8Array(16),Zo=(e,t)=>{e.update(t);const s=t.length%16;s&&e.update(Xg.subarray(s))},Yg=new Uint8Array(32);function Qo(e,t,s,i,n){n!==void 0&&Ue(n,void 0,"AAD");const a=e(t,s,Yg),o=Mg(i.length,n?n.length:0,true),u=Hg.create(a);n&&Zo(u,n),Zo(u,i),u.update(o);const l=u.digest();return Et(a,o),l}const zg=e=>(t,s,i)=>({encrypt(a,o){const u=a.length;o=Gn(u+16,o,false),o.set(a);const l=o.subarray(0,-16);e(t,s,l,l,1);const h=Qo(e,t,s,l,i);return o.set(h,u),Et(h),o},decrypt(a,o){o=Gn(a.length-16,o,false);const u=a.subarray(0,-16),l=a.subarray(-16),h=Qo(e,t,s,u,i);if(!Ng(l,h))throw Et(h),new Error("invalid tag");return o.set(a.subarray(0,-16)),e(t,s,o,o,1),Et(h),o}}),Kg=Ug({blockSize:64,nonceLength:24,tagLength:16,withAAD:true},zg(Gg));function Zg(e,t,s){return zi(e),s===void 0&&(s=new Uint8Array(e.outputLen)),ua(e,s,t)}const yn=Uint8Array.of(0),Jo=Uint8Array.of();function Qg(e,t,s,i=32){zi(e),Qt(i,"length"),Ot(t,void 0,"prk");const n=e.outputLen;if(t.length<n)throw new Error('"prk" must be at least HashLen octets');if(i>255*n)throw new Error("Length must be <= 255*HashLen");const a=Math.ceil(i/n);s===void 0?s=Jo:Ot(s,void 0,"info");const o=new Uint8Array(a*n),u=ua.create(e,t),l=u._cloneInto(),h=new Uint8Array(u.outputLen);for(let d=0;d<a;d++)yn[0]=d+1,l.update(d===0?Jo:h).update(s).update(yn).digestInto(h),o.set(h,n*d),u._cloneInto(l);return u.destroy(),l.destroy(),Ws(h,yn),o.slice(0,i)}const Jg=(e,t,s,i,n)=>Qg(e,Zg(e,t,s),i,n),eb="viji-enc:",ec="viji-enc:v1:",tb="viji-enc:v1",_n=24,sb=16,tc=new Uint8Array([224,50,225,138,167,25,229,194,14,250,248,86,248,204,11,44,195,247,74,184,14,218,196,108,241,52,118,61,221,57,106,31]),ib=new Uint8Array([82,90,117,206,53,86,209,181,176,177,126,23,140,253,33,242,212,132,84,23,243,195,189,90,217,131,25,10,37,241,167,245]);function rb(){const e=new Uint8Array(tc.length);for(let t=0;t<e.length;t++)e[t]=tc[t]^ib[t];return e}class bs extends Error{constructor(t,s){super(t),this.reason=s,this.name="SceneEnvelopeError"}}function nb(e){return e.startsWith(eb)}function Nl(e){const t=atob(e),s=new Uint8Array(t.length);for(let i=0;i<t.length;i++)s[i]=t.charCodeAt(i);return s}function ab(e){return Nl(e.replace(/-/g,"+").replace(/_/g,"/"))}function ob(e){return Jg(Hc,rb(),new TextEncoder().encode(tb),ab(e),32)}function cb(e,t){if(!e.startsWith(ec))throw new bs("Unsupported scene envelope version (this core supports viji-enc:v1)","UNSUPPORTED_VERSION");if(!t)throw new bs("Encrypted scene received without a key component","MISSING_KEY_COMPONENT");let s,i;try{s=Nl(e.slice(ec.length)),i=ob(t)}catch{throw new bs("Malformed scene envelope","MALFORMED_ENVELOPE")}if(s.length<_n+sb)throw new bs("Truncated scene envelope","MALFORMED_ENVELOPE");const n=s.subarray(0,_n),a=s.subarray(_n);try{const o=Kg(i,n).decrypt(a);return new TextDecoder().decode(o)}catch{throw new bs("Scene envelope authentication failed","DECRYPT_FAILED")}}function Fl(e){self.postMessage({type:"error",id:`${e.code.toLowerCase()}_${Date.now()}`,timestamp:Date.now(),data:e})}const Js={current:null};self.addEventListener("error",e=>{const t=e.error,s=t?.stack,i=t?.message??e.message??String(e);Js.current?Js.current.reportSceneError({message:i,...s!==void 0&&{stack:s},code:"UNCAUGHT_ERROR"}):Fl({message:i,code:"UNCAUGHT_ERROR",...s!==void 0&&{stack:s}}),e.preventDefault()});self.addEventListener("unhandledrejection",e=>{const t=e.reason,s=t?.stack,i=t?.message??String(e.reason);Js.current?Js.current.reportSceneError({message:i,...s!==void 0&&{stack:s},code:"UNHANDLED_REJECTION"}):Fl({message:i,code:"UNHANDLED_REJECTION",...s!==void 0&&{stack:s}}),e.preventDefault()});const ut=new pa,et=new wf(e=>self.postMessage(e));Js.current=et;ut.setSceneErrorReporter(et);let xn=null;function sc(e){const t=Ag(e,{transforms:["typescript"],disableESTransforms:true,sourceMapOptions:{compiledFilename:"scene.js"},filePath:"scene.ts"});return{code:t.code,mappings:t.sourceMap?.mappings??null}}function ic(e){const{code:t,error:s}=J1(e);return s?(et.reportSceneError({message:s.message,code:s.code,sourceOverride:"scene"}),null):t}async function ub(e,t,s){const i=t.initialParameters;let n,a,o=false;try{nb(e)&&(o=true,e=cb(e,t.keyComponent)),et.resetForSceneReload(),xn=null,self.renderFunction=null,ut.resetParameterState(),n=Ls.detectRendererType(e),ut.setCapabilityUsageMask(Ls.detectUsage(e,n));const u=Ls.detectCapabilities(e,n),l=Ls.detectAnalysedFrameUse(e);a=n==="p5"?Ls.detectP5CanvasMode(e):void 0;const h={renderer:n,capabilities:u,consumesAnalysedFrame:l,...a!==void 0&&{p5CanvasMode:a}};s.resolve(h)}catch(u){if(u instanceof bs){s.reject({message:`Scene decrypt failed: ${u.message}`,code:"SCENE_DECRYPT_ERROR"});return}const l=u;s.reject({message:`Scene analysis failed: ${l.message}`,code:"SCENE_ANALYSIS_ERROR"});return}try{if(n==="shader"){et.setCurrentSourceMap(null);try{await ut.initShaderMode(e,{redactDriverInfoLogs:o})}catch(u){const l=u;if(l.__isShaderCompileError)throw l;et.reportSceneError({message:`Scene code error: ${l.message}`,...l.stack!==void 0&&{stack:l.stack},code:"SCENE_CODE_ERROR",sourceOverride:"scene"});return}ut.sendAllParametersToHost()}else if(n==="p5"){const u=sc(e),{code:l,mappings:h}=u;et.setCurrentSourceMap(h);const d=ic(l);if(d===null)return;const m=d+`
|
|
581
|
+
`),{code:a.slice(0,o+1)+s+a.slice(o+1)+i,mappings:this.shiftMappings(n.mappings,s.length)}}else return{code:s+a+i,mappings:this.shiftMappings(n.mappings,s.length)}}processBalancedCode(){let t=0,s=0;for(;!this.tokens.isAtEnd();){if(this.tokens.matches1(r.braceL)||this.tokens.matches1(r.dollarBraceL))t++;else if(this.tokens.matches1(r.braceR)){if(t===0)return;t--}if(this.tokens.matches1(r.parenL))s++;else if(this.tokens.matches1(r.parenR)){if(s===0)return;s--}this.processToken()}}processToken(){if(this.tokens.matches1(r._class)){this.processClass();return}for(const t of this.transformers)if(t.process())return;this.tokens.copyToken()}processNamedClass(){if(!this.tokens.matches2(r._class,r.name))throw new Error("Expected identifier for exported class name.");const t=this.tokens.identifierNameAtIndex(this.tokens.currentIndex()+1);return this.processClass(),t}processClass(){const t=hg(this,this.tokens,this.nameManager,this.disableESTransforms),s=(t.headerInfo.isExpression||!t.headerInfo.className)&&t.staticInitializerNames.length+t.instanceInitializerNames.length>0;let i=t.headerInfo.className;s&&(i=this.nameManager.claimFreeName("_class"),this.generatedVariables.push(i),this.tokens.appendCode(` (${i} =`));const a=this.tokens.currentToken().contextId;if(a==null)throw new Error("Expected class to have a context ID.");for(this.tokens.copyExpectedToken(r._class);!this.tokens.matchesContextIdAndLabel(r.braceL,a);)this.processToken();this.processClassBody(t,i);const o=t.staticInitializerNames.map(u=>`${i}.${u}()`);s?this.tokens.appendCode(`, ${o.map(u=>`${u}, `).join("")}${i})`):t.staticInitializerNames.length>0&&this.tokens.appendCode(` ${o.map(u=>`${u};`).join(" ")}`)}processClassBody(t,s){const{headerInfo:i,constructorInsertPos:n,constructorInitializerStatements:a,fields:o,instanceInitializerNames:u,rangesToRemove:l}=t;let h=0,d=0;const m=this.tokens.currentToken().contextId;if(m==null)throw new Error("Expected non-null context ID on class.");this.tokens.copyExpectedToken(r.braceL),this.isReactHotLoaderTransformEnabled&&this.tokens.appendCode("__reactstandin__regenerateByEval(key, code) {this[key] = eval(code);}");const _=a.length+u.length>0;if(n===null&&_){const k=this.makeConstructorInitCode(a,u,s);if(i.hasSuperclass){const T=this.nameManager.claimFreeName("args");this.tokens.appendCode(`constructor(...${T}) { super(...${T}); ${k}; }`)}else this.tokens.appendCode(`constructor() { ${k}; }`)}for(;!this.tokens.matchesContextIdAndLabel(r.braceR,m);)if(h<o.length&&this.tokens.currentIndex()===o[h].start){let k=false;for(this.tokens.matches1(r.bracketL)?this.tokens.copyTokenWithPrefix(`${o[h].initializerName}() {this`):this.tokens.matches1(r.string)||this.tokens.matches1(r.num)?(this.tokens.copyTokenWithPrefix(`${o[h].initializerName}() {this[`),k=true):this.tokens.copyTokenWithPrefix(`${o[h].initializerName}() {this.`);this.tokens.currentIndex()<o[h].end;)k&&this.tokens.currentIndex()===o[h].equalsIndex&&this.tokens.appendCode("]"),this.processToken();this.tokens.appendCode("}"),h++}else if(d<l.length&&this.tokens.currentIndex()>=l[d].start){for(this.tokens.currentIndex()<l[d].end&&this.tokens.removeInitialToken();this.tokens.currentIndex()<l[d].end;)this.tokens.removeToken();d++}else this.tokens.currentIndex()===n?(this.tokens.copyToken(),_&&this.tokens.appendCode(`;${this.makeConstructorInitCode(a,u,s)};`),this.processToken()):this.processToken();this.tokens.copyExpectedToken(r.braceR)}makeConstructorInitCode(t,s,i){return[...t,...s.map(n=>`${i}.prototype.${n}.call(this)`)].join(";")}processPossibleArrowParamEnd(){if(this.tokens.matches2(r.parenR,r.colon)&&this.tokens.tokenAtRelativeIndex(1).isType){let t=this.tokens.currentIndex()+1;for(;this.tokens.tokens[t].isType;)t++;if(this.tokens.matches1AtIndex(t,r.arrow)){for(this.tokens.removeInitialToken();this.tokens.currentIndex()<t;)this.tokens.removeToken();return this.tokens.replaceTokenTrimmingLeftWhitespace(") =>"),true}}return false}processPossibleAsyncArrowWithTypeParams(){if(!this.tokens.matchesContextual(g._async)&&!this.tokens.matches1(r._async))return false;const t=this.tokens.tokenAtRelativeIndex(1);if(t.type!==r.lessThan||!t.isType)return false;let s=this.tokens.currentIndex()+1;for(;this.tokens.tokens[s].isType;)s++;if(this.tokens.matches1AtIndex(s,r.parenL)){for(this.tokens.replaceToken("async ("),this.tokens.removeInitialToken();this.tokens.currentIndex()<s;)this.tokens.removeToken();return this.tokens.removeToken(),this.processBalancedCode(),this.processToken(),true}return false}processPossibleTypeRange(){if(this.tokens.currentToken().isType){for(this.tokens.removeInitialToken();this.tokens.currentToken().isType;)this.tokens.removeToken();return true}return false}shiftMappings(t,s){for(let i=0;i<t.length;i++){const n=t[i];n!==void 0&&(t[i]=n+s)}return t}}var Sg={};(function(e){e.__esModule=true,e.LinesAndColumns=void 0;var t=`
|
|
582
|
+
`,s="\r",i=function(){function n(a){this.string=a;for(var o=[0],u=0;u<a.length;)switch(a[u]){case t:u+=t.length,o.push(u);break;case s:u+=s.length,a[u]===t&&(u+=t.length),o.push(u);break;default:u++;break}this.offsets=o}return n.prototype.locationForIndex=function(a){if(a<0||a>this.string.length)return null;for(var o=0,u=this.offsets;u[o+1]<=a;)o++;var l=a-u[o];return{line:o,column:l}},n.prototype.indexForLocation=function(a){var o=a.line,u=a.column;return o<0||o>=this.offsets.length||u<0||u>this.lengthOfLine(o)?null:this.offsets[o]+u},n.prototype.lengthOfLine=function(a){var o=this.offsets[a],u=a===this.offsets.length-1?this.string.length:this.offsets[a+1];return u-o},n}();e.LinesAndColumns=i,e.default=i})(Sg);function Eg(e){const t=new Set;for(let s=0;s<e.tokens.length;s++)e.matches1AtIndex(s,r._import)&&!e.matches3AtIndex(s,r._import,r.name,r.eq)&&Tg(e,s,t);return t}function Tg(e,t,s){t++,!e.matches1AtIndex(t,r.parenL)&&(e.matches1AtIndex(t,r.name)&&(s.add(e.identifierNameAtIndex(t)),t++,e.matches1AtIndex(t,r.comma)&&t++),e.matches1AtIndex(t,r.star)&&(t+=2,s.add(e.identifierNameAtIndex(t)),t++),e.matches1AtIndex(t,r.braceL)&&(t++,Ag(e,t,s)))}function Ag(e,t,s){for(;;){if(e.matches1AtIndex(t,r.braceR))return;const i=Ys(e,t);if(t=i.endIndex,i.isType||s.add(i.rightName),e.matches2AtIndex(t,r.comma,r.braceR))return;if(e.matches1AtIndex(t,r.braceR))return;if(e.matches1AtIndex(t,r.comma))t++;else throw new Error(`Unexpected token: ${JSON.stringify(e.tokens[t])}`)}}function Ig(e,t){Hp(t);try{const s=Cg(e,t),n=new Oi(s,t.transforms,!!t.enableLegacyBabel5ModuleInterop,t).transform();let a={code:n.code};if(t.sourceMapOptions){if(!t.filePath)throw new Error("filePath must be specified when generating a source map.");a={...a,sourceMap:Rp(n,t.filePath,t.sourceMapOptions,e,s.tokenProcessor.tokens)}}return a}catch(s){throw t.filePath&&(s.message=`Error transforming ${t.filePath}: ${s.message}`),s}}function Cg(e,t){const s=t.transforms.includes("jsx"),i=t.transforms.includes("typescript"),n=t.transforms.includes("flow"),a=t.disableESTransforms===true,o=ug(e,s,i,n),u=o.tokens,l=o.scopes,h=new ba(e,u),d=new Ri(h),m=new js(e,u,n,a,d),_=!!t.enableLegacyTypeScriptModuleInterop;let k=null;return t.transforms.includes("imports")?(k=new is(h,m,_,t,t.transforms.includes("typescript"),!!t.keepUnusedImports,d),k.preprocessTokens(),Do(m,l,k.getGlobalNames()),t.transforms.includes("typescript")&&!t.keepUnusedImports&&k.pruneTypeOnlyImports()):t.transforms.includes("typescript")&&!t.keepUnusedImports&&Do(m,l,Eg(m)),{tokenProcessor:m,scopes:l,nameManager:h,importProcessor:k,helperManager:d}}function Hn(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"&&"BYTES_PER_ELEMENT"in e&&e.BYTES_PER_ELEMENT===1}const Bi=e=>e?`"${e}" `:"";function Wn(e,t=""){if(typeof e!="boolean")throw new TypeError(Bi(t)+"expected boolean, got type="+typeof e);return e}function xs(e,t=""){if(typeof e!="number")throw new TypeError(Bi(t)+"expected number, got "+typeof e);if(!Number.isSafeInteger(e)||e<0)throw new RangeError(Bi(t)+"expected integer >= 0, got "+e);return e}function Ue(e,t,s=""){if(Hn(e)&&(t===void 0||e.length===t))return e;t!==void 0&&xs(t,"length");const i=Hn(e),n=t!==void 0?` of length ${t}`:"",a=i?`length=${e.length}`:`type=${typeof e}`,o=Bi(s)+"expected Uint8Array"+n+", got "+a;throw i?new RangeError(o):new TypeError(o)}const Yo=(e,t)=>{if(e===null||typeof e!="object"||Array.isArray(e))throw new TypeError(t==="object"?"expected valid options object":`"${t}" expected object, got type=${typeof e}`)};function zo(e,t=true){if(e.destroyed)throw new Error("hash was destroyed");if(t&&e.finished)throw new Error("digest() was already called")}function Rg(e,t){Ue(e,void 0,"output");const s=t.outputLen;if(!(e.length>=s))throw new RangeError('"output" expected length >= '+s)}function Ft(e){return new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4))}function Et(...e){for(let t=0;t<e.length;t++)e[t].fill(0)}function Pg(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}const kt=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function Lg(e){return e<<24&4278190080|e<<8&16711680|e>>>8&65280|e>>>24&255}function Dg(e){for(let t=0;t<e.length;t++)e[t]=Lg(e[t]);return e}const pt=kt?e=>e:Dg;function Ng(e,t){return Yo(e,"defaults"),Yo(t,"opts"),Object.assign(e,t)}function Fg(e,t){if(e=Ue(e),t=Ue(t),e.length!==t.length)return false;let s=0;for(let i=0;i<e.length;i++)s|=e[i]^t[i];return s===0}function Ug(e,t,s){const i=t,n=()=>[],a=(u,l)=>i(l,...n(u)).update(u).digest(),o=i(new Uint8Array(e),...n(new Uint8Array(0)));return a.outputLen=o.outputLen,a.blockLen=o.blockLen,a.create=(u,...l)=>i(u,...l),a}const Mg=(e,t)=>{function s(i,...n){if(Ue(i,void 0,"key"),e.nonceLength!==void 0){const m=n[0];Ue(m,e.varSizeNonce?void 0:e.nonceLength,"nonce")}const a=e.tagLength,o=e.nonceLength!==void 0?1:0;if(!e.withAAD){for(let m=o;m<n.length;m++)if(Hn(n[m]))throw new Error("AAD not supported")}e.withAAD&&n[o]!==void 0&&Ue(n[o],void 0,"AAD");const u=t(i,...n),l=(m,_)=>{if(_!==void 0){if(m!==2)throw new Error("cipher output not supported");Ue(_,void 0,"output")}};let h=false;return{encrypt(m,_){if(h)throw new Error("cannot encrypt() twice with same key + nonce");return h=true,Ue(m,void 0,"data"),l(u.encrypt.length,_),u.encrypt(m,_)},decrypt(m,_){if(Ue(m,void 0,"data"),a&&m.length<a)throw new Error('"ciphertext" expected length >= tagLength='+a);return l(u.decrypt.length,_),u.decrypt(m,_)}}}return Object.assign(s,e),s};function Gn(e,t,s=true){if(t===void 0)return new Uint8Array(e);if(Ue(t,e,"output"),s&&!Vi(t))throw new Error("invalid output, must be aligned");return t}function Og(e,t,s){xs(e),xs(t),Wn(s);const i=new Uint8Array(16),n=Pg(i);return n.setBigUint64(0,BigInt(t),s),n.setBigUint64(8,BigInt(e),s),i}function Vi(e){return e.byteOffset%4===0}function ji(e){return Uint8Array.from(Ue(e))}const Ll=e=>Uint8Array.from(e.split(""),t=>t.charCodeAt(0)),Bg=pt(Ft(Ll("expand 16-byte k"))),Vg=pt(Ft(Ll("expand 32-byte k")));function xe(e,t){return e<<t|e>>>32-t}const Fs=64,jg=16,Xn=2**32-1,Ko=Uint32Array.of();function $g(e,t,s,i,n,a,o,u){const l=n.length,h=new Uint8Array(Fs),d=Ft(h),m=kt&&Vi(n)&&Vi(a),_=m?Ft(n):Ko,k=m?Ft(a):Ko;if(!kt){for(let T=0;T<l;o++){if(e(t,s,i,d,o,u),pt(d),o>=Xn)throw new Error("arx: counter overflow");const P=Math.min(Fs,l-T);for(let F=0,B;F<P;F++)B=T+F,a[B]=n[B]^h[F];T+=P}return}for(let T=0;T<l;o++){if(e(t,s,i,d,o,u),o>=Xn)throw new Error("arx: counter overflow");const P=Math.min(Fs,l-T);if(m&&P===Fs){const F=T/4;if(T%4!==0)throw new Error("arx: invalid block position");for(let B=0,N;B<jg;B++)N=F+B,k[N]=_[N]^d[B];T+=Fs;continue}for(let F=0,B;F<P;F++)B=T+F,a[B]=n[B]^h[F];T+=P}}function qg(e,t){const{allowShortKeys:s,extendNonceFn:i,counterLength:n,counterRight:a,rounds:o}=Ng({allowShortKeys:false,counterLength:8,counterRight:false,rounds:20},t);if(typeof e!="function")throw new Error("core must be a function");return xs(n),xs(o),Wn(a),Wn(s),(u,l,h,d,m=0)=>{Ue(u,void 0,"key"),Ue(l,void 0,"nonce"),Ue(h,void 0,"data");const _=h.length;if(d=Gn(_,d,false),xs(m),m<0||m>=Xn)throw new Error("arx: counter overflow");const k=[];let T=u.length,P,F;if(T===32)k.push(P=ji(u)),F=Vg;else if(T===16&&s)P=new Uint8Array(32),P.set(u),P.set(u,16),F=Bg,k.push(P);else throw Ue(u,32,"arx key"),new Error("invalid key size");(!kt||!Vi(l))&&k.push(l=ji(l));let B=Ft(P);if(i){if(l.length!==24)throw new Error("arx: extended nonce must be 24 bytes");const q=l.subarray(0,16);if(kt)i(F,B,Ft(q),B);else{const z=pt(Uint32Array.from(F));i(z,B,Ft(q),B),Et(z),pt(B)}l=l.subarray(16)}else kt||pt(B);const N=16-n;if(N!==l.length)throw new Error(`arx: nonce must be ${N} or 16 bytes`);if(N!==12){const q=new Uint8Array(12);q.set(l,a?0:12-l.length),l=q,k.push(l)}const Y=pt(Ft(l));try{return $g(e,F,B,Y,h,d,m,o),d}finally{Et(...k)}}}function Be(e,t){return e[t++]&255|(e[t++]&255)<<8}class Hg{blockLen=16;outputLen=16;buffer=new Uint8Array(16);r=new Uint16Array(10);h=new Uint16Array(10);pad=new Uint16Array(8);pos=0;finished=false;destroyed=false;constructor(t){t=ji(Ue(t,32,"key"));const s=Be(t,0),i=Be(t,2),n=Be(t,4),a=Be(t,6),o=Be(t,8),u=Be(t,10),l=Be(t,12),h=Be(t,14);this.r[0]=s&8191,this.r[1]=(s>>>13|i<<3)&8191,this.r[2]=(i>>>10|n<<6)&7939,this.r[3]=(n>>>7|a<<9)&8191,this.r[4]=(a>>>4|o<<12)&255,this.r[5]=o>>>1&8190,this.r[6]=(o>>>14|u<<2)&8191,this.r[7]=(u>>>11|l<<5)&8065,this.r[8]=(l>>>8|h<<8)&8191,this.r[9]=h>>>5&127;for(let d=0;d<8;d++)this.pad[d]=Be(t,16+2*d)}process(t,s,i=false){const n=i?0:2048,{h:a,r:o}=this,u=o[0],l=o[1],h=o[2],d=o[3],m=o[4],_=o[5],k=o[6],T=o[7],P=o[8],F=o[9],B=Be(t,s+0),N=Be(t,s+2),Y=Be(t,s+4),q=Be(t,s+6),z=Be(t,s+8),J=Be(t,s+10),K=Be(t,s+12),X=Be(t,s+14);let re=a[0]+(B&8191),x=a[1]+((B>>>13|N<<3)&8191),b=a[2]+((N>>>10|Y<<6)&8191),v=a[3]+((Y>>>7|q<<9)&8191),V=a[4]+((q>>>4|z<<12)&8191),W=a[5]+(z>>>1&8191),M=a[6]+((z>>>14|J<<2)&8191),R=a[7]+((J>>>11|K<<5)&8191),O=a[8]+((K>>>8|X<<8)&8191),U=a[9]+(X>>>5|n),I=0,H=I+re*u+x*(5*F)+b*(5*P)+v*(5*T)+V*(5*k);I=H>>>13,H&=8191,H+=W*(5*_)+M*(5*m)+R*(5*d)+O*(5*h)+U*(5*l),I+=H>>>13,H&=8191;let G=I+re*l+x*u+b*(5*F)+v*(5*P)+V*(5*T);I=G>>>13,G&=8191,G+=W*(5*k)+M*(5*_)+R*(5*m)+O*(5*d)+U*(5*h),I+=G>>>13,G&=8191;let te=I+re*h+x*l+b*u+v*(5*F)+V*(5*P);I=te>>>13,te&=8191,te+=W*(5*T)+M*(5*k)+R*(5*_)+O*(5*m)+U*(5*d),I+=te>>>13,te&=8191;let ce=I+re*d+x*h+b*l+v*u+V*(5*F);I=ce>>>13,ce&=8191,ce+=W*(5*P)+M*(5*T)+R*(5*k)+O*(5*_)+U*(5*m),I+=ce>>>13,ce&=8191;let oe=I+re*m+x*d+b*h+v*l+V*u;I=oe>>>13,oe&=8191,oe+=W*(5*F)+M*(5*P)+R*(5*T)+O*(5*k)+U*(5*_),I+=oe>>>13,oe&=8191;let w=I+re*_+x*m+b*d+v*h+V*l;I=w>>>13,w&=8191,w+=W*u+M*(5*F)+R*(5*P)+O*(5*T)+U*(5*k),I+=w>>>13,w&=8191;let E=I+re*k+x*_+b*m+v*d+V*h;I=E>>>13,E&=8191,E+=W*l+M*u+R*(5*F)+O*(5*P)+U*(5*T),I+=E>>>13,E&=8191;let D=I+re*T+x*k+b*_+v*m+V*d;I=D>>>13,D&=8191,D+=W*h+M*l+R*u+O*(5*F)+U*(5*P),I+=D>>>13,D&=8191;let L=I+re*P+x*T+b*k+v*_+V*m;I=L>>>13,L&=8191,L+=W*d+M*h+R*l+O*u+U*(5*F),I+=L>>>13,L&=8191;let j=I+re*F+x*P+b*T+v*k+V*_;I=j>>>13,j&=8191,j+=W*m+M*d+R*h+O*l+U*u,I+=j>>>13,j&=8191,I=(I<<2)+I|0,I=I+H|0,H=I&8191,I=I>>>13,G+=I,a[0]=H,a[1]=G,a[2]=te,a[3]=ce,a[4]=oe,a[5]=w,a[6]=E,a[7]=D,a[8]=L,a[9]=j}finalize(){const{h:t,pad:s}=this,i=new Uint16Array(10);let n=t[1]>>>13;t[1]&=8191;for(let u=2;u<10;u++)t[u]+=n,n=t[u]>>>13,t[u]&=8191;t[0]+=n*5,n=t[0]>>>13,t[0]&=8191,t[1]+=n,n=t[1]>>>13,t[1]&=8191,t[2]+=n,i[0]=t[0]+5,n=i[0]>>>13,i[0]&=8191;for(let u=1;u<10;u++)i[u]=t[u]+n,n=i[u]>>>13,i[u]&=8191;i[9]-=8192;let a=(n^1)-1;for(let u=0;u<10;u++)i[u]&=a;a=~a;for(let u=0;u<10;u++)t[u]=t[u]&a|i[u];t[0]=(t[0]|t[1]<<13)&65535,t[1]=(t[1]>>>3|t[2]<<10)&65535,t[2]=(t[2]>>>6|t[3]<<7)&65535,t[3]=(t[3]>>>9|t[4]<<4)&65535,t[4]=(t[4]>>>12|t[5]<<1|t[6]<<14)&65535,t[5]=(t[6]>>>2|t[7]<<11)&65535,t[6]=(t[7]>>>5|t[8]<<8)&65535,t[7]=(t[8]>>>8|t[9]<<5)&65535;let o=t[0]+s[0];t[0]=o&65535;for(let u=1;u<8;u++)o=(t[u]+s[u]|0)+(o>>>16)|0,t[u]=o&65535;Et(i)}update(t){zo(this),Ue(t),t=ji(t);const{buffer:s,blockLen:i}=this,n=t.length;for(let a=0;a<n;){const o=Math.min(i-this.pos,n-a);if(o===i){for(;i<=n-a;a+=i)this.process(t,a);continue}s.set(t.subarray(a,a+o),this.pos),this.pos+=o,a+=o,this.pos===i&&(this.process(s,0,false),this.pos=0)}return this}destroy(){this.destroyed=true,Et(this.h,this.r,this.buffer,this.pad)}digestInto(t){zo(this),Rg(t,this),this.finished=true;const{buffer:s,h:i}=this;let{pos:n}=this;if(n){for(s[n++]=1;n<16;n++)s[n]=0;this.process(s,0,true)}this.finalize();let a=0;for(let o=0;o<8;o++)t[a++]=i[o]>>>0,t[a++]=i[o]>>>8}digest(){const{buffer:t,outputLen:s}=this;this.digestInto(t);const i=t.slice(0,s);return this.destroy(),i}}const Wg=Ug(32,e=>new Hg(e));function Dl(e,t,s,i,n,a=20){let o=e[0],u=e[1],l=e[2],h=e[3],d=t[0],m=t[1],_=t[2],k=t[3],T=t[4],P=t[5],F=t[6],B=t[7],N=n,Y=s[0],q=s[1],z=s[2],J=o,K=u,X=l,re=h,x=d,b=m,v=_,V=k,W=T,M=P,R=F,O=B,U=N,I=Y,H=q,G=z;for(let ce=0;ce<a;ce+=2)J=J+x|0,U=xe(U^J,16),W=W+U|0,x=xe(x^W,12),J=J+x|0,U=xe(U^J,8),W=W+U|0,x=xe(x^W,7),K=K+b|0,I=xe(I^K,16),M=M+I|0,b=xe(b^M,12),K=K+b|0,I=xe(I^K,8),M=M+I|0,b=xe(b^M,7),X=X+v|0,H=xe(H^X,16),R=R+H|0,v=xe(v^R,12),X=X+v|0,H=xe(H^X,8),R=R+H|0,v=xe(v^R,7),re=re+V|0,G=xe(G^re,16),O=O+G|0,V=xe(V^O,12),re=re+V|0,G=xe(G^re,8),O=O+G|0,V=xe(V^O,7),J=J+b|0,G=xe(G^J,16),R=R+G|0,b=xe(b^R,12),J=J+b|0,G=xe(G^J,8),R=R+G|0,b=xe(b^R,7),K=K+v|0,U=xe(U^K,16),O=O+U|0,v=xe(v^O,12),K=K+v|0,U=xe(U^K,8),O=O+U|0,v=xe(v^O,7),X=X+V|0,I=xe(I^X,16),W=W+I|0,V=xe(V^W,12),X=X+V|0,I=xe(I^X,8),W=W+I|0,V=xe(V^W,7),re=re+x|0,H=xe(H^re,16),M=M+H|0,x=xe(x^M,12),re=re+x|0,H=xe(H^re,8),M=M+H|0,x=xe(x^M,7);let te=0;i[te++]=o+J|0,i[te++]=u+K|0,i[te++]=l+X|0,i[te++]=h+re|0,i[te++]=d+x|0,i[te++]=m+b|0,i[te++]=_+v|0,i[te++]=k+V|0,i[te++]=T+W|0,i[te++]=P+M|0,i[te++]=F+R|0,i[te++]=B+O|0,i[te++]=N+U|0,i[te++]=Y+I|0,i[te++]=q+H|0,i[te++]=z+G|0}function Gg(e,t,s,i){const n=kt?e:pt(e.slice(0,4)),a=kt?t:pt(t.slice(0,8)),o=kt?s:pt(s.slice(0,4)),u=new Uint32Array(16);Dl(n,a,o.subarray(1),u,o[0]);let l=0;i[l++]=u[0]-n[0]|0,i[l++]=u[1]-n[1]|0,i[l++]=u[2]-n[2]|0,i[l++]=u[3]-n[3]|0,i[l++]=u[12]-o[0]|0,i[l++]=u[13]-o[1]|0,i[l++]=u[14]-o[2]|0,i[l++]=u[15]-o[3]|0,pt(i),kt||Et(n,a,o),Et(u)}const Xg=qg(Dl,{counterRight:false,counterLength:8,extendNonceFn:Gg,allowShortKeys:false}),Yg=new Uint8Array(16),Zo=(e,t)=>{e.update(t);const s=t.length%16;s&&e.update(Yg.subarray(s))},zg=new Uint8Array(32);function Qo(e,t,s,i,n){n!==void 0&&Ue(n,void 0,"AAD");const a=e(t,s,zg),o=Og(i.length,n?n.length:0,true),u=Wg.create(a);n&&Zo(u,n),Zo(u,i),u.update(o);const l=u.digest();return Et(a,o),l}const Kg=e=>(t,s,i)=>({encrypt(a,o){const u=a.length;o=Gn(u+16,o,false),o.set(a);const l=o.subarray(0,-16);e(t,s,l,l,1);const h=Qo(e,t,s,l,i);return o.set(h,u),Et(h),o},decrypt(a,o){o=Gn(a.length-16,o,false);const u=a.subarray(0,-16),l=a.subarray(-16),h=Qo(e,t,s,u,i);if(!Fg(l,h))throw Et(h),new Error("invalid tag");return o.set(a.subarray(0,-16)),e(t,s,o,o,1),Et(h),o}}),Zg=Mg({blockSize:64,nonceLength:24,tagLength:16,withAAD:true},Kg(Xg));function Qg(e,t,s){return zi(e),s===void 0&&(s=new Uint8Array(e.outputLen)),ua(e,s,t)}const yn=Uint8Array.of(0),Jo=Uint8Array.of();function Jg(e,t,s,i=32){zi(e),Qt(i,"length"),Ot(t,void 0,"prk");const n=e.outputLen;if(t.length<n)throw new Error('"prk" must be at least HashLen octets');if(i>255*n)throw new Error("Length must be <= 255*HashLen");const a=Math.ceil(i/n);s===void 0?s=Jo:Ot(s,void 0,"info");const o=new Uint8Array(a*n),u=ua.create(e,t),l=u._cloneInto(),h=new Uint8Array(u.outputLen);for(let d=0;d<a;d++)yn[0]=d+1,l.update(d===0?Jo:h).update(s).update(yn).digestInto(h),o.set(h,n*d),u._cloneInto(l);return u.destroy(),l.destroy(),Ws(h,yn),o.slice(0,i)}const eb=(e,t,s,i,n)=>Jg(e,Qg(e,t,s),i,n),tb="viji-enc:",ec="viji-enc:v1:",sb="viji-enc:v1",_n=24,ib=16,tc=new Uint8Array([224,50,225,138,167,25,229,194,14,250,248,86,248,204,11,44,195,247,74,184,14,218,196,108,241,52,118,61,221,57,106,31]),rb=new Uint8Array([82,90,117,206,53,86,209,181,176,177,126,23,140,253,33,242,212,132,84,23,243,195,189,90,217,131,25,10,37,241,167,245]);function nb(){const e=new Uint8Array(tc.length);for(let t=0;t<e.length;t++)e[t]=tc[t]^rb[t];return e}class bs extends Error{constructor(t,s){super(t),this.reason=s,this.name="SceneEnvelopeError"}}function ab(e){return e.startsWith(tb)}function Nl(e){const t=atob(e),s=new Uint8Array(t.length);for(let i=0;i<t.length;i++)s[i]=t.charCodeAt(i);return s}function ob(e){return Nl(e.replace(/-/g,"+").replace(/_/g,"/"))}function cb(e){return eb(Hc,nb(),new TextEncoder().encode(sb),ob(e),32)}function ub(e,t){if(!e.startsWith(ec))throw new bs("Unsupported scene envelope version (this core supports viji-enc:v1)","UNSUPPORTED_VERSION");if(!t)throw new bs("Encrypted scene received without a key component","MISSING_KEY_COMPONENT");let s,i;try{s=Nl(e.slice(ec.length)),i=cb(t)}catch{throw new bs("Malformed scene envelope","MALFORMED_ENVELOPE")}if(s.length<_n+ib)throw new bs("Truncated scene envelope","MALFORMED_ENVELOPE");const n=s.subarray(0,_n),a=s.subarray(_n);try{const o=Zg(i,n).decrypt(a);return new TextDecoder().decode(o)}catch{throw new bs("Scene envelope authentication failed","DECRYPT_FAILED")}}function Fl(e){self.postMessage({type:"error",id:`${e.code.toLowerCase()}_${Date.now()}`,timestamp:Date.now(),data:e})}const Js={current:null};self.addEventListener("error",e=>{const t=e.error,s=t?.stack,i=t?.message??e.message??String(e);Js.current?Js.current.reportSceneError({message:i,...s!==void 0&&{stack:s},code:"UNCAUGHT_ERROR"}):Fl({message:i,code:"UNCAUGHT_ERROR",...s!==void 0&&{stack:s}}),e.preventDefault()});self.addEventListener("unhandledrejection",e=>{const t=e.reason,s=t?.stack,i=t?.message??String(e.reason);Js.current?Js.current.reportSceneError({message:i,...s!==void 0&&{stack:s},code:"UNHANDLED_REJECTION"}):Fl({message:i,code:"UNHANDLED_REJECTION",...s!==void 0&&{stack:s}}),e.preventDefault()});const ut=new pa,et=new Sf(e=>self.postMessage(e));Js.current=et;ut.setSceneErrorReporter(et);let xn=null;function sc(e){const t=Ig(e,{transforms:["typescript"],disableESTransforms:true,sourceMapOptions:{compiledFilename:"scene.js"},filePath:"scene.ts"});return{code:t.code,mappings:t.sourceMap?.mappings??null}}function ic(e){const{code:t,error:s}=J1(e);return s?(et.reportSceneError({message:s.message,code:s.code,sourceOverride:"scene"}),null):t}async function lb(e,t,s){const i=t.initialParameters;let n,a,o=false;try{ab(e)&&(o=true,e=ub(e,t.keyComponent)),et.resetForSceneReload(),xn=null,self.renderFunction=null,ut.resetParameterState();const u=gf(e);n=u.renderer,a=u.p5CanvasMode,ut.setCapabilityUsageMask(Ms.detectUsage(e,n)),s.resolve(u)}catch(u){if(u instanceof bs){s.reject({message:`Scene decrypt failed: ${u.message}`,code:"SCENE_DECRYPT_ERROR"});return}const l=u;s.reject({message:`Scene analysis failed: ${l.message}`,code:"SCENE_ANALYSIS_ERROR"});return}try{if(n==="shader"){et.setCurrentSourceMap(null);try{await ut.initShaderMode(e,{redactDriverInfoLogs:o})}catch(u){const l=u;if(l.__isShaderCompileError)throw l;et.reportSceneError({message:`Scene code error: ${l.message}`,...l.stack!==void 0&&{stack:l.stack},code:"SCENE_CODE_ERROR",sourceOverride:"scene"});return}ut.sendAllParametersToHost()}else if(n==="p5"){const u=sc(e),{code:l,mappings:h}=u;et.setCurrentSourceMap(h);const d=ic(l);if(d===null)return;const m=d+`
|
|
583
583
|
return { setup: typeof setup !== "undefined" ? setup : null, render: typeof render !== "undefined" ? render : null };`,_=new Function("viji","p5","console",m),k=et.makeArtistConsole(globalThis.console),{setup:T,render:P}=_(ut.viji,null,k);if(!P){et.reportSceneError({message:"P5 mode requires a render(viji, p5) function",code:"P5_INIT_ERROR",sourceOverride:"scene"});return}try{await ut.initP5Mode(T,P,{...a!==void 0&&{canvasMode:a}})}catch(F){const B=F;et.reportSceneError({message:`P5 init error: ${B.message}`,...B.stack!==void 0&&{stack:B.stack},code:"P5_INIT_ERROR",sourceOverride:"scene"});return}ut.sendAllParametersToHost()}else{const{code:u,mappings:l}=sc(e);et.setCurrentSourceMap(l);const h=ic(u);if(h===null)return;const d=h+`
|
|
584
584
|
if (typeof render === "function") {
|
|
585
585
|
return render;
|
|
586
586
|
}
|
|
587
|
-
throw new Error("Scene code must define a render function");`,m=Object.getPrototypeOf(async function(){}).constructor,_=new m("viji","console",d),k=et.makeArtistConsole(globalThis.console);xn=await _(ut.viji,k),self.renderFunction=xn,ut.sendAllParametersToHost()}i&&ut.seedInitialValues(i)}catch(u){const l=u;console.error("Failed to load scene code:",l),et.reportSceneError({message:`Scene code error: ${l.message}`,...l.stack!==void 0&&{stack:l.stack},code:l.__isShaderCompileError?"SHADER_COMPILE_ERROR":"SCENE_CODE_ERROR",sourceOverride:"scene",...l.__sourceLocation&&{sourceLocationOverride:l.__sourceLocation}})}}self.setSceneCode=
|
|
587
|
+
throw new Error("Scene code must define a render function");`,m=Object.getPrototypeOf(async function(){}).constructor,_=new m("viji","console",d),k=et.makeArtistConsole(globalThis.console);xn=await _(ut.viji,k),self.renderFunction=xn,ut.sendAllParametersToHost()}i&&ut.seedInitialValues(i)}catch(u){const l=u;console.error("Failed to load scene code:",l),et.reportSceneError({message:`Scene code error: ${l.message}`,...l.stack!==void 0&&{stack:l.stack},code:l.__isShaderCompileError?"SHADER_COMPILE_ERROR":"SCENE_CODE_ERROR",sourceOverride:"scene",...l.__sourceLocation&&{sourceLocationOverride:l.__sourceLocation}})}}self.setSceneCode=lb;
|