agentic-numerical-control 0.1.6 → 0.2.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/README.md +45 -44
- package/dist/engines/cncjs/LICENSES.txt +2593 -0
- package/dist/engines/cncjs/cncjs-headless.cjs +67988 -0
- package/dist/engines/cncjs/manifest.json +195 -0
- package/dist/engines/kiri/LICENSES.txt +1097 -0
- package/dist/engines/kiri/bin/dom-stub.mjs +30 -0
- package/dist/engines/kiri/bin/kiri-main.js +127342 -0
- package/dist/engines/kiri/bin/kiri-pool.js +83963 -0
- package/dist/engines/kiri/bin/kiri-work.js +136718 -0
- package/dist/engines/kiri/bin/runner.mjs +241 -0
- package/dist/engines/kiri/bin/worker-shim.mjs +32 -0
- package/dist/engines/kiri/manifest.json +356 -0
- package/dist/engines/kiri/wasm/manifold.wasm +0 -0
- package/dist/jobs.html +137 -0
- package/dist/machine.html +164 -0
- package/dist/server/analysis.js +356 -0
- package/dist/server/cam.js +592 -0
- package/dist/server/cncjs.js +194 -75
- package/dist/server/history.js +48 -0
- package/dist/server/jobs.js +60 -3
- package/dist/server/machines.js +96 -0
- package/dist/server/program.js +14 -0
- package/dist/server/server.js +577 -52
- package/dist/server/settings-import.js +237 -0
- package/dist/setup.html +156 -0
- package/dist/viewer.html +296 -265
- package/package.json +9 -5
package/dist/viewer.html
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
<!DOCTYPE html>
|
|
2
|
-
<html lang="en">
|
|
3
|
-
<head>
|
|
4
|
-
<meta charset="UTF-8">
|
|
5
|
-
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
6
|
-
<meta name="color-scheme" content="light dark">
|
|
7
|
-
<title>Agentic Numerical Control</title>
|
|
8
|
-
<script type="module" crossorigin>var vS=Object.defineProperty;var xS=(t,e,n)=>e in t?vS(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var He=(t,e,n)=>xS(t,typeof e!="symbol"?e+"":e,n);(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))i(s);new MutationObserver(s=>{for(const r of s)if(r.type==="childList")for(const o of r.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&i(o)}).observe(document,{childList:!0,subtree:!0});function n(s){const r={};return s.integrity&&(r.integrity=s.integrity),s.referrerPolicy&&(r.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?r.credentials="include":s.crossOrigin==="anonymous"?r.credentials="omit":r.credentials="same-origin",r}function i(s){if(s.ep)return;s.ep=!0;const r=n(s);fetch(s.href,r)}})();var yS=Object.create,cu=Object.defineProperty,bS=Object.getOwnPropertyDescriptor,MS=Object.getOwnPropertyNames,ES=Object.getPrototypeOf,TS=Object.prototype.hasOwnProperty,RS=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),wS=(t,e)=>{let n={};for(var i in t)cu(n,i,{get:t[i],enumerable:!0});return n},AS=(t,e,n,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(var s=MS(e),r=0,o=s.length,a;r<o;r++)a=s[r],!TS.call(t,a)&&a!==n&&cu(t,a,{get:(c=>e[c]).bind(null,a),enumerable:!(i=bS(e,a))||i.enumerable});return t},CS=(t,e,n)=>(n=t!=null?yS(ES(t)):{},AS(cu(n,"default",{value:t,enumerable:!0}),t));const PS=new Set(["https://json-schema.org/draft/2019-09/schema","http://json-schema.org/draft/2019-09/schema"]);function IS(t){return typeof t=="string"&&PS.has(t.replace(/#$/,""))}function el(t){const e=Object.values(t).filter(i=>typeof i=="number");return Object.entries(t).filter(([i,s])=>e.indexOf(+i)===-1).map(([i,s])=>s)}function Ld(t,e="|"){return t.map(n=>$f(n)).join(e)}function tl(t,e){return typeof e=="bigint"?e.toString():e}class LS{constructor(e){this._getter=e,this._value=void 0}get value(){const e=this._getter;return e!==void 0&&(this._value=e(),this._getter=void 0),this._value}}function Pa(t){return new LS(t)}function NS(t){return t==null}function lu(t){const e=t.startsWith("^")?1:0,n=t.endsWith("$")?t.length-1:t.length;return t.slice(e,n)}function DS(t,e){const n=t/e,i=Math.round(n),s=4*Number.EPSILON*Math.max(Math.abs(n),1);return Math.abs(n-i)<s?0:n-i}const Nd=Symbol("evaluating");function US(t,e,n){let i;Object.defineProperty(t,e,{get(){if(i!==Nd)return i===void 0&&(i=Nd,i=n()),i},set(s){Object.defineProperty(t,e,{value:s})},configurable:!0})}function gi(t,e,n){Object.defineProperty(t,e,{value:n,writable:!0,enumerable:!0,configurable:!0})}function uu(t){const e=Object.getOwnPropertyDescriptor(t,"shape");return e!=null&&e.get?e.get.raw:e==null?void 0:e.value}function Li(t){return uu(t._zod.def)??t._zod.def.shape}function Hf(t,e,n){Object.defineProperty(t,e,{get(){const i=n();return gi(this,e,i),i},enumerable:!0,configurable:!0})}function Vf(t,e,n){e in t?gi(t,e,n):t[e]=n}function gs(t,e,n,i){const s=Li(e);for(const r of n){const o=Object.getOwnPropertyDescriptor(s,r);o.enumerable&&(o.get?Hf(t,r,()=>{const a=e._zod.def.shape[r];return i?i(a,r):a}):Vf(t,r,i?i(o.value,r):o.value))}}function OS(t,e){for(const n of Reflect.ownKeys(e)){const i=Object.getOwnPropertyDescriptor(e,n);i.enumerable&&(i.get?Hf(t,n,()=>e[n]):Vf(t,n,i.value))}}function Dn(...t){const e={};for(const n of t){const i=Object.getOwnPropertyDescriptors(n);Object.assign(e,i)}return Object.defineProperties({},e)}function FS(t){return JSON.stringify(t)}function kS(t){return t.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}const Gf="captureStackTrace"in Error?Error.captureStackTrace:(...t)=>{};function Vr(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}const zS=Pa(()=>{var t;if(Jn.jitless||typeof navigator<"u"&&((t=navigator==null?void 0:navigator.userAgent)!=null&&t.includes("Cloudflare")))return!1;try{const e=Function;return new e(""),!0}catch{return!1}});function tr(t){if(Vr(t)===!1)return!1;const e=t.constructor;if(e===void 0||typeof e!="function")return!0;const n=e.prototype;return!(Vr(n)===!1||Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")===!1)}function qf(t){return tr(t)?{...t}:Array.isArray(t)?[...t]:t instanceof Map?new Map(t):t instanceof Set?new Set(t):t}const BS=new Set(["string","number","symbol"]);function nr(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Ji(t,e,n){const i=new t._zod.constr(e??t._zod.def);return(!e||n!=null&&n.parent)&&(i._zod.parent=t),i}function Oe(t){const e=t;if(!e)return{};if(typeof e=="string")return{error:()=>e};if((e==null?void 0:e.message)!==void 0){if((e==null?void 0:e.error)!==void 0)throw new Error("Cannot specify both `message` and `error` params");e.error=e.message}return delete e.message,typeof e.error=="string"?{...e,error:()=>e.error}:e}function $f(t){return typeof t=="bigint"?t.toString()+"n":typeof t=="string"?`"${t}"`:`${t}`}function HS(t){return Object.keys(t).filter(e=>t[e]._zod.optin!==void 0&&t[e]._zod.optout==="optional")}const Wf={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},VS={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function GS(t,e){const n=t._zod.def,i=n.checks;if(i&&i.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");const r={};return gs(r,t,Ia(t,e)),Ji(t,Dn(n,{shape:r,checks:[]}))}function Ia(t,e){var s;const n=Li(t),i=[];for(const r of Reflect.ownKeys(e)){if(!((s=Object.getOwnPropertyDescriptor(n,r))!=null&&s.enumerable))throw new Error(`Unrecognized key: "${String(r)}"`);e[r]&&i.push(r)}return i}function qS(t,e){const n=t._zod.def,i=n.checks;if(i&&i.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");const r=new Set(Ia(t,e)),o={};return gs(o,t,Reflect.ownKeys(Li(t)).filter(a=>!r.has(a))),Ji(t,Dn(n,{shape:o,checks:[]}))}function $S(t,e){if(!tr(e))throw new Error("Invalid input to extend: expected a plain object");const n=t._zod.def.checks;if(n&&n.length>0){const s=Li(t);for(const r of Reflect.ownKeys(e))if(Object.getOwnPropertyDescriptor(s,r)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return Ji(t,Dn(t._zod.def,{shape:Zf(t,e)}))}function Zf(t,e){const n={};return gs(n,t,Reflect.ownKeys(Li(t))),OS(n,e),n}function WS(t,e){if(!tr(e))throw new Error("Invalid input to safeExtend: expected a plain object");return Ji(t,Dn(t._zod.def,{shape:Zf(t,e)}))}function ZS(t,e){var s,r;if(!((s=e==null?void 0:e._zod)!=null&&s.def))throw new Error("Invalid input to merge: expected an object schema. To merge a plain shape, use `.extend()`.");if((r=t._zod.def.checks)!=null&&r.length)throw new Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");const n={};gs(n,t,Reflect.ownKeys(Li(t))),gs(n,e,Reflect.ownKeys(Li(e)));const i=Dn(t._zod.def,{shape:n,get catchall(){return e._zod.def.catchall},checks:e._zod.def.checks??[]});return Ji(t,i)}function Dd(t,e,n,i="partial"){const r=e._zod.def.checks;if(r&&r.length>0)throw new Error(`.${i}() cannot be used on object schemas containing refinements`);const a=n?new Set(Ia(e,n)):void 0,c={};return gs(c,e,Reflect.ownKeys(Li(e)),t&&((l,u)=>a&&!a.has(u)?l:new t({type:"optional",innerType:l}))),Ji(e,Dn(e._zod.def,{shape:c,checks:[]}))}function XS(t,e,n){const i=n?new Set(Ia(e,n)):void 0,s={};return gs(s,e,Reflect.ownKeys(Li(e)),(r,o)=>i&&!i.has(o)?r:new t({type:"nonoptional",innerType:r})),Ji(e,Dn(e._zod.def,{shape:s}))}function Ai(t,e=0){var n;if(t.aborted===!0)return!0;for(let i=e;i<t.issues.length;i++)if(((n=t.issues[i])==null?void 0:n.continue)!==!0)return!0;return!1}function YS(t,e=0){var n;if(t.aborted===!0)return!0;for(let i=e;i<t.issues.length;i++)if(((n=t.issues[i])==null?void 0:n.continue)===!1)return!0;return!1}function Gs(t,e){return e.map(n=>{var i;return(i=n).path??(i.path=[]),n.path.unshift(t),n})}function vr(t){return typeof t=="string"?t:t==null?void 0:t.message}function Ud(t){const e=[];for(const n of t??[]){const i=n._zod.def;if(!/_(length|size)$|_equals$/.test(i.check))break;const s=i.maximum??i.length??i.size;s>=0&&e.push([s,n])}return e}function nl(t,e,n){var i;for(let s=e;s<t.length;s++)(i=t[s]).schema??(i.schema=n)}function Yi(t,e,n){var c,l,u,h,d,f,_,x,m,p;var i;const s=(l=(c=t.inst)==null?void 0:c._zod)==null?void 0:l.traits;s!=null&&s.has("$ZodType")&&(s.has("$ZodCheck")?(i=t).schema??(i.schema=t.inst):t.schema=t.inst);const r=t.schema!==t.inst?(h=(u=t.schema)==null?void 0:u._zod.def)==null?void 0:h.error:void 0,o=t.message?t.message:vr((_=(f=(d=t.inst)==null?void 0:d._zod.def)==null?void 0:f.error)==null?void 0:_.call(f,t))??vr(r==null?void 0:r(t))??vr((x=e==null?void 0:e.error)==null?void 0:x.call(e,t))??vr((m=n.customError)==null?void 0:m.call(n,t))??vr((p=n.localeError)==null?void 0:p.call(n,t))??"Invalid input",a={};for(const E of Object.keys(t))E==="inst"||E==="schema"||E==="continue"||E==="input"||E==="__proto__"||(a[E]=t[E]);return a.path??(a.path=[]),a.message=o,e!=null&&e.reportInput&&(a.input=t.input),a}const KS=/[\uD800-\uDBFF]/;function du(t){const e=t.length;if(!KS.test(t))return e;let n=e;for(let i=0;i<e-1;i++)(t.charCodeAt(i)&64512)===55296&&(t.charCodeAt(i+1)&64512)===56320&&(n--,i++);return n}function hu(t){return Array.isArray(t)?"array":typeof t=="string"?"string":"unknown"}function jS(t){const e=typeof t;switch(e){case"number":return Number.isNaN(t)?"nan":"number";case"object":{if(t===null)return"null";if(Array.isArray(t))return"array";const n=t;if(n&&Object.getPrototypeOf(n)!==Object.prototype&&"constructor"in n&&n.constructor)return n.constructor.name}}return e}function Gr(...t){const[e,n,i]=t;return typeof e=="string"?{message:e,code:"custom",input:n,inst:i}:{...e}}function JS(t,e){for(const n in e){const i=Object.getOwnPropertyDescriptor(e,n);i.get?Object.defineProperty(t,n,{...i,enumerable:!1}):QS(t,n,i.value)}}function Ki(t,e,n,i=!0){return Object.defineProperty(t,e,{configurable:!0,writable:!0,enumerable:i,value:n}),n}function Xf(t,e,n){return Ki(t,e,n,!1)}function Yf(t,e){for(const n in t){const i=t[n];Object.defineProperty(e,n,{configurable:!0,enumerable:!0,get(){return Ki(this,n,i(this))},set(s){Ki(this,n,s)}})}return e}function QS(t,e,n){Object.defineProperty(t,e,{configurable:!0,get(){return this==null?n:Ki(this,e,n.bind(this))},set(i){Ki(this,e,i)}})}function ev(t,e){const n=Object.getPrototypeOf(t);return e in n?void 0:n}let oc,Wi=!1;const tv={configurable:!0,get(){Wi=!0}};function ht(t,e,n){const i=Object.getPrototypeOf(t._zod);if(e in i&&oc!==t._zod){oc=void 0;return}oc=t._zod,Object.defineProperty(i,e,{configurable:!0,get(){Object.defineProperty(this,e,tv);const s=Wi;Wi=!1;try{const r=n(this);return Wi?delete this[e]:Object.defineProperty(this,e,{configurable:!0,writable:!0,value:r}),Wi=Wi||s,r}catch(r){throw delete this[e],Wi=Wi||s,r}},set(s){Object.defineProperty(this,e,{configurable:!0,writable:!0,value:s})}})}function nv(t,e,n,i){const s=ev(t,e);s&&Object.defineProperty(s,e,{configurable:!0,get(){const r={configurable:!0,writable:!0,enumerable:i,value:void 0};return Object.defineProperty(this,e,r),r.value=n(this),Object.defineProperty(this,e,r),r.value},set(r){Object.defineProperty(this,e,{configurable:!0,writable:!0,enumerable:i,value:r})}})}const iv="~constantCatch";function sv(t){const e=()=>t;return e[iv]=!0,e}var Od;const rv=Object.freeze({status:"aborted"}),ac={value:void 0,enumerable:!1};let Fd="captureStackTrace"in Error?Error:null;function ov(t){const e=Fd;if(e){const n=e.stackTraceLimit;if(typeof n=="number"){try{e.stackTraceLimit=0}catch{return Fd=null,new t}try{return new t}finally{e.stackTraceLimit=n}}}return new t}function ee(t,e,n,i){const s={};function r(d){this.def=d,this.constr=h,this.traits=new Set}r.prototype=s;const o=n,a=o&&new WeakSet;function c(d,f){if(d._zod){if(d._zod.traits.has(t))return}else{ac.value=new r(f);try{Object.defineProperty(d,"_zod",ac)}finally{ac.value=void 0}}if(d._zod.traits.add(t),e(d,f),a){const x=Object.getPrototypeOf(d),m=d._zod.constr.prototype;let p=x;for(;p&&p!==m;)p=Object.getPrototypeOf(p);const E=p??x;a.has(E)||(a.add(E),JS(E,o))}const _=h.prototype;for(const x in _)Object.prototype.hasOwnProperty.call(_,x)&&(x in d||(d[x]=_[x].bind(d)))}const l=(i==null?void 0:i.Parent)??Object;class u extends l{}Object.defineProperty(u,"name",{value:t});function h(d){var m;const f=i!=null&&i.Parent?ov(u):this;c(f,d);const _=f._zod.deferred;if(_){for(const p of _)p();f._zod.deferred=void 0}const x=(m=globalThis.__zod_globalConfig)==null?void 0:m.postProcessor;return x&&x(f),f}return Object.defineProperty(h,"init",{value:c}),Object.defineProperty(h,Symbol.hasInstance,{value:d=>{var f,_;return i!=null&&i.Parent&&d instanceof i.Parent?!0:(_=(f=d==null?void 0:d._zod)==null?void 0:f.traits)==null?void 0:_.has(t)}}),Object.defineProperty(h,"name",{value:t}),h}class ps extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class Kf extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name="ZodEncodeError"}}(Od=globalThis).__zod_globalConfig??(Od.__zod_globalConfig={});const Jn=globalThis.__zod_globalConfig;function Qn(t){return t&&Object.assign(Jn,t),Jn}function av(){const t=this._zod;return t.message??(t.message=JSON.stringify(t.def,tl,2)),t.message}function cv(t){this._zod.message=t}const lv={get:av,set:cv,enumerable:!0,configurable:!0},cc={value:void 0,enumerable:!1},kd=new WeakSet([Object.prototype,Error.prototype]),uv=(t,e)=>{t.name="$ZodError",cc.value=e,Object.defineProperty(t,"issues",cc),cc.value=void 0,Object.defineProperty(t,"message",lv);const n=Object.getPrototypeOf(t);kd.has(n)||(kd.add(n),Object.defineProperty(n,"toString",{configurable:!0,enumerable:!1,get(){const i=()=>this.message;return Object.defineProperty(this,"toString",{value:i,configurable:!0,writable:!0}),i},set(i){Object.defineProperty(this,"toString",{value:i,configurable:!0,writable:!0})}}))},dv=ee("$ZodError",uv);function hv(t,e,n){return Object.prototype.hasOwnProperty.call(t,e)||(e==="__proto__"?Object.defineProperty(t,e,{value:n(),writable:!0,enumerable:!0,configurable:!0}):t[e]=n()),t[e]}function fv(t,e=n=>n.message){const n={},i=[];for(const s of t.issues)s.path.length>0?hv(n,s.path[0],()=>[]).push(e(s)):i.push(e(s));return{formErrors:i,fieldErrors:n}}function pv(t,e=n=>n.message){const n={_errors:[]},i=(s,r=[])=>{for(const o of s.issues)if(o.code==="invalid_union"&&o.errors.length)o.errors.map(a=>i({issues:a},[...r,...o.path]));else if(o.code==="invalid_key")i({issues:o.issues},[...r,...o.path]);else if(o.code==="invalid_element")i({issues:o.issues},[...r,...o.path]);else{const a=[...r,...o.path];if(a.length===0)n._errors.push(e(o));else{let c=n,l=0;for(;l<a.length;){const u=a[l],h=l===a.length-1;if(u==="_errors"){h&&c._errors.push(e(o)),l++;continue}Object.prototype.hasOwnProperty.call(c,u)||Object.defineProperty(c,u,{value:{_errors:[]},enumerable:!0,writable:!0,configurable:!0});const d=c[u];h&&d._errors.push(e(o)),c=d,l++}}}};return i(t),n}function La(t,e){return{callee:(e==null?void 0:e.callee)??t,Err:e==null?void 0:e.Err}}const fu=t=>{const e=(n,i,s,r)=>{const o=s?{...s,async:!1}:{async:!1},a=n._zod.run({value:i,issues:[]},o);if(a instanceof Promise)throw new ps;if(a.issues.length){const c=new((r==null?void 0:r.Err)??t)(a.issues.map(l=>Yi(l,o,Qn())));throw Gf(c,(r==null?void 0:r.callee)??e),c}return a.value};return e},pu=t=>{const e=async(n,i,s,r)=>{const o=s?{...s,async:!0}:{async:!0};let a=n._zod.run({value:i,issues:[]},o);if(a instanceof Promise&&(a=await a),a.issues.length){const c=new((r==null?void 0:r.Err)??t)(a.issues.map(l=>Yi(l,o,Qn())));throw Gf(c,(r==null?void 0:r.callee)??e),c}return a.value};return e},mu=t=>(e,n,i)=>{const s=i?{...i,async:!1}:{async:!1},r=e._zod.run({value:n,issues:[]},s);if(r instanceof Promise)throw new ps;return r.issues.length?jf(t,r.issues,s):{success:!0,data:r.value}};function jf(t,e,n){let i;return{success:!1,get error(){return i||(i=new t(e.map(s=>Yi(s,n,Qn()))),e=void 0,n=void 0),i},set error(s){i=s,e=void 0,n=void 0}}}const gu=t=>async(e,n,i)=>{const s=i?{...i,async:!0}:{async:!0};let r=e._zod.run({value:n,issues:[]},s);return r instanceof Promise&&(r=await r),r.issues.length?jf(t,r.issues,s):{success:!0,data:r.value}},mv=Symbol.for("zod.compile.invalid"),gv=Symbol.for("zod.compile.fallback"),_v=((t,e,n)=>{const i=t._zod.bag.validator;if(i!==void 0){if(i(e)!==mv)return!0;if(i.definite===!0&&n===void 0)return!1}return Sv(t,e,n)});function Sv(t,e,n){const i=n?{...n,async:!1,abortEarly:!0}:{async:!1,abortEarly:!0},s=t._zod.bag.fallbackRun;let r;if(s?(i[gv]=!0,r=s({value:e,issues:[]},i)):r=t._zod.run({value:e,issues:[]},i),r instanceof Promise)throw new ps;return r.issues.length===0}const vv=async(t,e,n)=>{const i=n?{...n,async:!0,abortEarly:!0}:{async:!0,abortEarly:!0};let s=t._zod.run({value:e,issues:[]},i);return s instanceof Promise&&(s=await s),s.issues.length===0},xv=t=>{const e=fu(t),n=(i,s,r,o)=>{const a=r?{...r,direction:"backward"}:{direction:"backward"};return e(i,s,a,La(n,o))};return n},yv=t=>{const e=fu(t),n=(i,s,r,o)=>e(i,s,r,La(n,o));return n},bv=t=>{const e=pu(t),n=async(i,s,r,o)=>{const a=r?{...r,direction:"backward"}:{direction:"backward"};return await e(i,s,a,La(n,o))};return n},Mv=t=>{const e=pu(t),n=async(i,s,r,o)=>await e(i,s,r,La(n,o));return n},Ev=t=>(e,n,i)=>{const s=i?{...i,direction:"backward"}:{direction:"backward"};return mu(t)(e,n,s)},Tv=t=>(e,n,i)=>mu(t)(e,n,i),Rv=t=>async(e,n,i)=>{const s=i?{...i,direction:"backward"}:{direction:"backward"};return gu(t)(e,n,s)},wv=t=>async(e,n,i)=>gu(t)(e,n,i),Av=/^[cC][0-9a-z]{6,}$/,Cv=/^[0-9a-z]+$/,Pv=/^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/,Iv=/^[0-9a-vA-V]{20}$/,Lv=/^[A-Za-z0-9]{27}$/,Nv=/^[a-zA-Z0-9_-]{21}$/;function Dv(t){return new RegExp(`^[a-zA-Z0-9_-]{${t}}$`)}const Uv=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,Ov=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,zd=t=>t?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${t}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,Fv=/^(?:[A-Za-z0-9_'+\-]+\.)*[A-Za-z0-9_'+\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,kv="^(?=[\\s\\S]*[\\p{Extended_Pictographic}\\p{Regional_Indicator}\\u20E3])[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$";function zv(){return new RegExp(kv,"u")}const Bv=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Hv=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,Vv=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,Gv=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,qv=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,$v=/^(?:[A-Za-z0-9_-]{4})*(?:[A-Za-z0-9_-]{2,3})?$/,Wv=/^https?$/,Zv=/^\+[1-9]\d{6,14}$/,Jf="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))";function Xv(t){return new RegExp(`^${t}$`)}const Yv=Xv(Jf);function il(t){const e="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof t.precision=="number"?t.precision===-1?`${e}`:t.precision===0?`${e}:[0-5]\\d`:`${e}:[0-5]\\d\\.\\d{${t.precision}}`:t.seconds?`${e}:[0-5]\\d(?:\\.\\d+)?`:`${e}(?::[0-5]\\d(?:\\.\\d+)?)?`}function Kv(t){return new RegExp(`^${il(t)}$`)}function jv(t){const e=["Z"];t.offset&&e.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");const n=`${il({precision:t.precision,seconds:!0})}(?:${e.join("|")})`,i=t.local?`${n}|${il({precision:t.precision})}`:n;return new RegExp(`^${Jf}T(?:${i})$`)}const Jv=/^[\s\S]{0,}$/,Qv=/^-?\d+$/,_u=/^-?\d+(?:\.\d+)?$/,e0=/^(?:true|false)$/i,t0=/^null$/i,n0=/^undefined$/i,i0=/^[^A-Z]*$/,s0=/^[^a-z]*$/,wn=ee("$ZodCheck",(t,e)=>{var n;t._zod??(t._zod={}),t._zod.def=e,(n=t._zod).onattach??(n.onattach=[])}),Su=t=>{const e=t.value;return!NS(e)&&e.length!==void 0},ia={number:"number",bigint:"bigint",object:"date"},Qf=ee("$ZodCheckLessThan",(t,e)=>{wn.init(t,e);const n=ia[typeof e.value];t._zod.check=i=>{(e.inclusive?i.value<=e.value:i.value<e.value)||i.issues.push({origin:ia[typeof i.value]??n,code:"too_big",maximum:typeof e.value=="object"?e.value.getTime():e.value,input:i.value,inclusive:e.inclusive,inst:t,continue:!e.abort})}}),ep=ee("$ZodCheckGreaterThan",(t,e)=>{wn.init(t,e);const n=ia[typeof e.value];t._zod.check=i=>{(e.inclusive?i.value>=e.value:i.value>e.value)||i.issues.push({origin:ia[typeof i.value]??n,code:"too_small",minimum:typeof e.value=="object"?e.value.getTime():e.value,input:i.value,inclusive:e.inclusive,inst:t,continue:!e.abort})}}),r0=ee("$ZodCheckMultipleOf",(t,e)=>{wn.init(t,e),t._zod.check=n=>{if(typeof n.value!=typeof e.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof n.value=="bigint"?e.value!==BigInt(0)&&n.value%e.value===BigInt(0):DS(n.value,e.value)===0)||n.issues.push({origin:typeof n.value,code:"not_multiple_of",divisor:e.value,input:n.value,inst:t,continue:!e.abort})}}),o0=ee("$ZodCheckNumberFormat",(t,e)=>{var o;wn.init(t,e),e.format=e.format||"float64";const n=(o=e.format)==null?void 0:o.includes("int"),i=n?"int":"number",[s,r]=Wf[e.format];t._zod.check=a=>{const c=a.value;if(n){if(!Number.isInteger(c)){a.issues.push({expected:i,format:e.format,code:"invalid_type",continue:!1,input:c,inst:t});return}if(!Number.isSafeInteger(c)){c>0?a.issues.push({input:c,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:t,origin:i,inclusive:!0,continue:!e.abort}):a.issues.push({input:c,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:t,origin:i,inclusive:!0,continue:!e.abort});return}}c<s&&a.issues.push({origin:"number",input:c,code:"too_small",minimum:s,inclusive:!0,inst:t,continue:!e.abort}),c>r&&a.issues.push({origin:"number",input:c,code:"too_big",maximum:r,inclusive:!0,inst:t,continue:!e.abort})}}),a0=ee("$ZodCheckMaxLength",(t,e)=>{var n;wn.init(t,e),(n=t._zod.def).when??(n.when=Su),t._zod.check=i=>{const s=i.value,r=s.length;if((typeof s=="string"&&r>e.maximum?du(s):r)<=e.maximum)return;const a=hu(s);i.issues.push({origin:a,code:"too_big",maximum:e.maximum,inclusive:!0,input:s,inst:t,continue:!e.abort})}}),c0=ee("$ZodCheckMinLength",(t,e)=>{var n;wn.init(t,e),(n=t._zod.def).when??(n.when=Su),t._zod.check=i=>{const s=i.value,r=s.length;if((typeof s=="string"&&r>=e.minimum&&r<e.minimum*2?du(s):r)>=e.minimum)return;const a=hu(s);i.issues.push({origin:a,code:"too_small",minimum:e.minimum,inclusive:!0,input:s,inst:t,continue:!e.abort})}}),l0=ee("$ZodCheckLengthEquals",(t,e)=>{var n;wn.init(t,e),(n=t._zod.def).when??(n.when=Su),t._zod.check=i=>{const s=i.value,r=s.length,o=typeof s=="string"&&r>=e.length&&r<=e.length*2?du(s):r;if(o===e.length)return;const a=hu(s),c=o>e.length;i.issues.push({origin:a,...c?{code:"too_big",maximum:e.length}:{code:"too_small",minimum:e.length},inclusive:!0,exact:!0,input:i.value,inst:t,continue:!e.abort})}}),Na=ee("$ZodCheckStringFormat",(t,e)=>{var n,i;wn.init(t,e),e.pattern?(n=t._zod).check??(n.check=s=>{e.pattern.lastIndex=0,!e.pattern.test(s.value)&&s.issues.push({origin:"string",code:"invalid_format",format:e.format,input:s.value,...e.pattern?{pattern:e.pattern.toString()}:{},inst:t,continue:!e.abort})}):(i=t._zod).check??(i.check=()=>{})}),u0=ee("$ZodCheckRegex",(t,e)=>{Na.init(t,e),t._zod.check=n=>{e.pattern.lastIndex=0,!e.pattern.test(n.value)&&n.issues.push({origin:"string",code:"invalid_format",format:"regex",input:n.value,pattern:e.pattern.toString(),inst:t,continue:!e.abort})}}),d0=ee("$ZodCheckLowerCase",(t,e)=>{e.pattern??(e.pattern=i0),Na.init(t,e)}),h0=ee("$ZodCheckUpperCase",(t,e)=>{e.pattern??(e.pattern=s0),Na.init(t,e)}),f0=ee("$ZodCheckIncludes",(t,e)=>{wn.init(t,e);const n=nr(e.includes),i=new RegExp(typeof e.position=="number"?`^.{${e.position},}${n}`:n);e.pattern=i,t._zod.check=s=>{s.value.includes(e.includes,e.position)||s.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:e.includes,input:s.value,inst:t,continue:!e.abort})}}),p0=ee("$ZodCheckStartsWith",(t,e)=>{wn.init(t,e);const n=new RegExp(`^${nr(e.prefix)}.*`);e.pattern??(e.pattern=n),t._zod.check=i=>{i.value.startsWith(e.prefix)||i.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:e.prefix,input:i.value,inst:t,continue:!e.abort})}}),m0=ee("$ZodCheckEndsWith",(t,e)=>{wn.init(t,e);const n=new RegExp(`.*${nr(e.suffix)}$`);e.pattern??(e.pattern=n),t._zod.check=i=>{i.value.endsWith(e.suffix)||i.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:e.suffix,input:i.value,inst:t,continue:!e.abort})}}),g0=ee("$ZodCheckOverwrite",(t,e)=>{wn.init(t,e),t._zod.check=n=>{n.value=e.tx(n.value)}});class _0{constructor(e=[],n={}){this.content=[],this.indent=0,this.args=e,this.closed=n}indented(e){this.indent+=1;try{e(this)}finally{this.indent-=1}}write(e){if(typeof e=="function"){e(this,{execution:"sync"}),e(this,{execution:"async"});return}const i=e.split(`
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8">
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
6
|
+
<meta name="color-scheme" content="light dark">
|
|
7
|
+
<title>Agentic Numerical Control</title>
|
|
8
|
+
<script type="module" crossorigin>var bv=Object.defineProperty;var Mv=(t,e,n)=>e in t?bv(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var Ve=(t,e,n)=>Mv(t,typeof e!="symbol"?e+"":e,n);(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))i(s);new MutationObserver(s=>{for(const r of s)if(r.type==="childList")for(const o of r.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&i(o)}).observe(document,{childList:!0,subtree:!0});function n(s){const r={};return s.integrity&&(r.integrity=s.integrity),s.referrerPolicy&&(r.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?r.credentials="include":s.crossOrigin==="anonymous"?r.credentials="omit":r.credentials="same-origin",r}function i(s){if(s.ep)return;s.ep=!0;const r=n(s);fetch(s.href,r)}})();var Ev=Object.create,Nu=Object.defineProperty,Tv=Object.getOwnPropertyDescriptor,Rv=Object.getOwnPropertyNames,wv=Object.getPrototypeOf,Av=Object.prototype.hasOwnProperty,Cv=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),Pv=(t,e)=>{let n={};for(var i in t)Nu(n,i,{get:t[i],enumerable:!0});return n},Lv=(t,e,n,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(var s=Rv(e),r=0,o=s.length,a;r<o;r++)a=s[r],!Av.call(t,a)&&a!==n&&Nu(t,a,{get:(c=>e[c]).bind(null,a),enumerable:!(i=Tv(e,a))||i.enumerable});return t},Iv=(t,e,n)=>(n=t!=null?Ev(wv(t)):{},Lv(Nu(n,"default",{value:t,enumerable:!0}),t));const Nv=new Set(["https://json-schema.org/draft/2019-09/schema","http://json-schema.org/draft/2019-09/schema"]);function Dv(t){return typeof t=="string"&&Nv.has(t.replace(/#$/,""))}function yl(t){const e=Object.values(t).filter(i=>typeof i=="number");return Object.entries(t).filter(([i,s])=>e.indexOf(+i)===-1).map(([i,s])=>s)}function fh(t,e="|"){return t.map(n=>Lp(n)).join(e)}function bl(t,e){return typeof e=="bigint"?e.toString():e}class Uv{constructor(e){this._getter=e,this._value=void 0}get value(){const e=this._getter;return e!==void 0&&(this._value=e(),this._getter=void 0),this._value}}function Ga(t){return new Uv(t)}function Ov(t){return t==null}function Du(t){const e=t.startsWith("^")?1:0,n=t.endsWith("$")?t.length-1:t.length;return t.slice(e,n)}function Fv(t,e){const n=t/e,i=Math.round(n),s=4*Number.EPSILON*Math.max(Math.abs(n),1);return Math.abs(n-i)<s?0:n-i}const ph=Symbol("evaluating");function kv(t,e,n){let i;Object.defineProperty(t,e,{get(){if(i!==ph)return i===void 0&&(i=ph,i=n()),i},set(s){Object.defineProperty(t,e,{value:s})},configurable:!0})}function bi(t,e,n){Object.defineProperty(t,e,{value:n,writable:!0,enumerable:!0,configurable:!0})}function Uu(t){const e=Object.getOwnPropertyDescriptor(t,"shape");return e!=null&&e.get?e.get.raw:e==null?void 0:e.value}function ki(t){return Uu(t._zod.def)??t._zod.def.shape}function wp(t,e,n){Object.defineProperty(t,e,{get(){const i=n();return bi(this,e,i),i},enumerable:!0,configurable:!0})}function Ap(t,e,n){e in t?bi(t,e,n):t[e]=n}function Ts(t,e,n,i){const s=ki(e);for(const r of n){const o=Object.getOwnPropertyDescriptor(s,r);o.enumerable&&(o.get?wp(t,r,()=>{const a=e._zod.def.shape[r];return i?i(a,r):a}):Ap(t,r,i?i(o.value,r):o.value))}}function zv(t,e){for(const n of Reflect.ownKeys(e)){const i=Object.getOwnPropertyDescriptor(e,n);i.enumerable&&(i.get?wp(t,n,()=>e[n]):Ap(t,n,i.value))}}function kn(...t){const e={};for(const n of t){const i=Object.getOwnPropertyDescriptors(n);Object.assign(e,i)}return Object.defineProperties({},e)}function Bv(t){return JSON.stringify(t)}function Hv(t){return t.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}const Cp="captureStackTrace"in Error?Error.captureStackTrace:(...t)=>{};function eo(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}const Vv=Ga(()=>{var t;if(ni.jitless||typeof navigator<"u"&&((t=navigator==null?void 0:navigator.userAgent)!=null&&t.includes("Cloudflare")))return!1;try{const e=Function;return new e(""),!0}catch{return!1}});function pr(t){if(eo(t)===!1)return!1;const e=t.constructor;if(e===void 0||typeof e!="function")return!0;const n=e.prototype;return!(eo(n)===!1||Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")===!1)}function Pp(t){return pr(t)?{...t}:Array.isArray(t)?[...t]:t instanceof Map?new Map(t):t instanceof Set?new Set(t):t}const Gv=new Set(["string","number","symbol"]);function mr(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function ls(t,e,n){const i=new t._zod.constr(e??t._zod.def);return(!e||n!=null&&n.parent)&&(i._zod.parent=t),i}function Oe(t){const e=t;if(!e)return{};if(typeof e=="string")return{error:()=>e};if((e==null?void 0:e.message)!==void 0){if((e==null?void 0:e.error)!==void 0)throw new Error("Cannot specify both `message` and `error` params");e.error=e.message}return delete e.message,typeof e.error=="string"?{...e,error:()=>e.error}:e}function Lp(t){return typeof t=="bigint"?t.toString()+"n":typeof t=="string"?`"${t}"`:`${t}`}function $v(t){return Object.keys(t).filter(e=>t[e]._zod.optin!==void 0&&t[e]._zod.optout==="optional")}const Ip={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},qv={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function Wv(t,e){const n=t._zod.def,i=n.checks;if(i&&i.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");const r={};return Ts(r,t,$a(t,e)),ls(t,kn(n,{shape:r,checks:[]}))}function $a(t,e){var s;const n=ki(t),i=[];for(const r of Reflect.ownKeys(e)){if(!((s=Object.getOwnPropertyDescriptor(n,r))!=null&&s.enumerable))throw new Error(`Unrecognized key: "${String(r)}"`);e[r]&&i.push(r)}return i}function Zv(t,e){const n=t._zod.def,i=n.checks;if(i&&i.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");const r=new Set($a(t,e)),o={};return Ts(o,t,Reflect.ownKeys(ki(t)).filter(a=>!r.has(a))),ls(t,kn(n,{shape:o,checks:[]}))}function Xv(t,e){if(!pr(e))throw new Error("Invalid input to extend: expected a plain object");const n=t._zod.def.checks;if(n&&n.length>0){const s=ki(t);for(const r of Reflect.ownKeys(e))if(Object.getOwnPropertyDescriptor(s,r)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return ls(t,kn(t._zod.def,{shape:Np(t,e)}))}function Np(t,e){const n={};return Ts(n,t,Reflect.ownKeys(ki(t))),zv(n,e),n}function Yv(t,e){if(!pr(e))throw new Error("Invalid input to safeExtend: expected a plain object");return ls(t,kn(t._zod.def,{shape:Np(t,e)}))}function Kv(t,e){var s,r;if(!((s=e==null?void 0:e._zod)!=null&&s.def))throw new Error("Invalid input to merge: expected an object schema. To merge a plain shape, use `.extend()`.");if((r=t._zod.def.checks)!=null&&r.length)throw new Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");const n={};Ts(n,t,Reflect.ownKeys(ki(t))),Ts(n,e,Reflect.ownKeys(ki(e)));const i=kn(t._zod.def,{shape:n,get catchall(){return e._zod.def.catchall},checks:e._zod.def.checks??[]});return ls(t,i)}function mh(t,e,n,i="partial"){const r=e._zod.def.checks;if(r&&r.length>0)throw new Error(`.${i}() cannot be used on object schemas containing refinements`);const a=n?new Set($a(e,n)):void 0,c={};return Ts(c,e,Reflect.ownKeys(ki(e)),t&&((l,u)=>a&&!a.has(u)?l:new t({type:"optional",innerType:l}))),ls(e,kn(e._zod.def,{shape:c,checks:[]}))}function jv(t,e,n){const i=n?new Set($a(e,n)):void 0,s={};return Ts(s,e,Reflect.ownKeys(ki(e)),(r,o)=>i&&!i.has(o)?r:new t({type:"nonoptional",innerType:r})),ls(e,kn(e._zod.def,{shape:s}))}function Di(t,e=0){var n;if(t.aborted===!0)return!0;for(let i=e;i<t.issues.length;i++)if(((n=t.issues[i])==null?void 0:n.continue)!==!0)return!0;return!1}function Jv(t,e=0){var n;if(t.aborted===!0)return!0;for(let i=e;i<t.issues.length;i++)if(((n=t.issues[i])==null?void 0:n.continue)===!1)return!0;return!1}function tr(t,e){return e.map(n=>{var i;return(i=n).path??(i.path=[]),n.path.unshift(t),n})}function Ir(t){return typeof t=="string"?t:t==null?void 0:t.message}function gh(t){const e=[];for(const n of t??[]){const i=n._zod.def;if(!/_(length|size)$|_equals$/.test(i.check))break;const s=i.maximum??i.length??i.size;s>=0&&e.push([s,n])}return e}function Ml(t,e,n){var i;for(let s=e;s<t.length;s++)(i=t[s]).schema??(i.schema=n)}function os(t,e,n){var c,l,u,h,d,f,_,x,m,p;var i;const s=(l=(c=t.inst)==null?void 0:c._zod)==null?void 0:l.traits;s!=null&&s.has("$ZodType")&&(s.has("$ZodCheck")?(i=t).schema??(i.schema=t.inst):t.schema=t.inst);const r=t.schema!==t.inst?(h=(u=t.schema)==null?void 0:u._zod.def)==null?void 0:h.error:void 0,o=t.message?t.message:Ir((_=(f=(d=t.inst)==null?void 0:d._zod.def)==null?void 0:f.error)==null?void 0:_.call(f,t))??Ir(r==null?void 0:r(t))??Ir((x=e==null?void 0:e.error)==null?void 0:x.call(e,t))??Ir((m=n.customError)==null?void 0:m.call(n,t))??Ir((p=n.localeError)==null?void 0:p.call(n,t))??"Invalid input",a={};for(const E of Object.keys(t))E==="inst"||E==="schema"||E==="continue"||E==="input"||E==="__proto__"||(a[E]=t[E]);return a.path??(a.path=[]),a.message=o,e!=null&&e.reportInput&&(a.input=t.input),a}const Qv=/[\uD800-\uDBFF]/;function Ou(t){const e=t.length;if(!Qv.test(t))return e;let n=e;for(let i=0;i<e-1;i++)(t.charCodeAt(i)&64512)===55296&&(t.charCodeAt(i+1)&64512)===56320&&(n--,i++);return n}function Fu(t){return Array.isArray(t)?"array":typeof t=="string"?"string":"unknown"}function e0(t){const e=typeof t;switch(e){case"number":return Number.isNaN(t)?"nan":"number";case"object":{if(t===null)return"null";if(Array.isArray(t))return"array";const n=t;if(n&&Object.getPrototypeOf(n)!==Object.prototype&&"constructor"in n&&n.constructor)return n.constructor.name}}return e}function to(...t){const[e,n,i]=t;return typeof e=="string"?{message:e,code:"custom",input:n,inst:i}:{...e}}function t0(t,e){for(const n in e){const i=Object.getOwnPropertyDescriptor(e,n);i.get?Object.defineProperty(t,n,{...i,enumerable:!1}):n0(t,n,i.value)}}function as(t,e,n,i=!0){return Object.defineProperty(t,e,{configurable:!0,writable:!0,enumerable:i,value:n}),n}function Dp(t,e,n){return as(t,e,n,!1)}function Up(t,e){for(const n in t){const i=t[n];Object.defineProperty(e,n,{configurable:!0,enumerable:!0,get(){return as(this,n,i(this))},set(s){as(this,n,s)}})}return e}function n0(t,e,n){Object.defineProperty(t,e,{configurable:!0,get(){return this==null?n:as(this,e,n.bind(this))},set(i){as(this,e,i)}})}function i0(t,e){const n=Object.getPrototypeOf(t);return e in n?void 0:n}let Rc,es=!1;const s0={configurable:!0,get(){es=!0}};function pt(t,e,n){const i=Object.getPrototypeOf(t._zod);if(e in i&&Rc!==t._zod){Rc=void 0;return}Rc=t._zod,Object.defineProperty(i,e,{configurable:!0,get(){Object.defineProperty(this,e,s0);const s=es;es=!1;try{const r=n(this);return es?delete this[e]:Object.defineProperty(this,e,{configurable:!0,writable:!0,value:r}),es=es||s,r}catch(r){throw delete this[e],es=es||s,r}},set(s){Object.defineProperty(this,e,{configurable:!0,writable:!0,value:s})}})}function r0(t,e,n,i){const s=i0(t,e);s&&Object.defineProperty(s,e,{configurable:!0,get(){const r={configurable:!0,writable:!0,enumerable:i,value:void 0};return Object.defineProperty(this,e,r),r.value=n(this),Object.defineProperty(this,e,r),r.value},set(r){Object.defineProperty(this,e,{configurable:!0,writable:!0,enumerable:i,value:r})}})}const o0="~constantCatch";function a0(t){const e=()=>t;return e[o0]=!0,e}var _h;const c0=Object.freeze({status:"aborted"}),wc={value:void 0,enumerable:!1};let Sh="captureStackTrace"in Error?Error:null;function l0(t){const e=Sh;if(e){const n=e.stackTraceLimit;if(typeof n=="number"){try{e.stackTraceLimit=0}catch{return Sh=null,new t}try{return new t}finally{e.stackTraceLimit=n}}}return new t}function ee(t,e,n,i){const s={};function r(d){this.def=d,this.constr=h,this.traits=new Set}r.prototype=s;const o=n,a=o&&new WeakSet;function c(d,f){if(d._zod){if(d._zod.traits.has(t))return}else{wc.value=new r(f);try{Object.defineProperty(d,"_zod",wc)}finally{wc.value=void 0}}if(d._zod.traits.add(t),e(d,f),a){const x=Object.getPrototypeOf(d),m=d._zod.constr.prototype;let p=x;for(;p&&p!==m;)p=Object.getPrototypeOf(p);const E=p??x;a.has(E)||(a.add(E),t0(E,o))}const _=h.prototype;for(const x in _)Object.prototype.hasOwnProperty.call(_,x)&&(x in d||(d[x]=_[x].bind(d)))}const l=(i==null?void 0:i.Parent)??Object;class u extends l{}Object.defineProperty(u,"name",{value:t});function h(d){var m;const f=i!=null&&i.Parent?l0(u):this;c(f,d);const _=f._zod.deferred;if(_){for(const p of _)p();f._zod.deferred=void 0}const x=(m=globalThis.__zod_globalConfig)==null?void 0:m.postProcessor;return x&&x(f),f}return Object.defineProperty(h,"init",{value:c}),Object.defineProperty(h,Symbol.hasInstance,{value:d=>{var f,_;return i!=null&&i.Parent&&d instanceof i.Parent?!0:(_=(f=d==null?void 0:d._zod)==null?void 0:f.traits)==null?void 0:_.has(t)}}),Object.defineProperty(h,"name",{value:t}),h}class Ms extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class Op extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name="ZodEncodeError"}}(_h=globalThis).__zod_globalConfig??(_h.__zod_globalConfig={});const ni=globalThis.__zod_globalConfig;function ii(t){return t&&Object.assign(ni,t),ni}function u0(){const t=this._zod;return t.message??(t.message=JSON.stringify(t.def,bl,2)),t.message}function d0(t){this._zod.message=t}const h0={get:u0,set:d0,enumerable:!0,configurable:!0},Ac={value:void 0,enumerable:!1},vh=new WeakSet([Object.prototype,Error.prototype]),f0=(t,e)=>{t.name="$ZodError",Ac.value=e,Object.defineProperty(t,"issues",Ac),Ac.value=void 0,Object.defineProperty(t,"message",h0);const n=Object.getPrototypeOf(t);vh.has(n)||(vh.add(n),Object.defineProperty(n,"toString",{configurable:!0,enumerable:!1,get(){const i=()=>this.message;return Object.defineProperty(this,"toString",{value:i,configurable:!0,writable:!0}),i},set(i){Object.defineProperty(this,"toString",{value:i,configurable:!0,writable:!0})}}))},p0=ee("$ZodError",f0);function m0(t,e,n){return Object.prototype.hasOwnProperty.call(t,e)||(e==="__proto__"?Object.defineProperty(t,e,{value:n(),writable:!0,enumerable:!0,configurable:!0}):t[e]=n()),t[e]}function g0(t,e=n=>n.message){const n={},i=[];for(const s of t.issues)s.path.length>0?m0(n,s.path[0],()=>[]).push(e(s)):i.push(e(s));return{formErrors:i,fieldErrors:n}}function _0(t,e=n=>n.message){const n={_errors:[]},i=(s,r=[])=>{for(const o of s.issues)if(o.code==="invalid_union"&&o.errors.length)o.errors.map(a=>i({issues:a},[...r,...o.path]));else if(o.code==="invalid_key")i({issues:o.issues},[...r,...o.path]);else if(o.code==="invalid_element")i({issues:o.issues},[...r,...o.path]);else{const a=[...r,...o.path];if(a.length===0)n._errors.push(e(o));else{let c=n,l=0;for(;l<a.length;){const u=a[l],h=l===a.length-1;if(u==="_errors"){h&&c._errors.push(e(o)),l++;continue}Object.prototype.hasOwnProperty.call(c,u)||Object.defineProperty(c,u,{value:{_errors:[]},enumerable:!0,writable:!0,configurable:!0});const d=c[u];h&&d._errors.push(e(o)),c=d,l++}}}};return i(t),n}function qa(t,e){return{callee:(e==null?void 0:e.callee)??t,Err:e==null?void 0:e.Err}}const ku=t=>{const e=(n,i,s,r)=>{const o=s?{...s,async:!1}:{async:!1},a=n._zod.run({value:i,issues:[]},o);if(a instanceof Promise)throw new Ms;if(a.issues.length){const c=new((r==null?void 0:r.Err)??t)(a.issues.map(l=>os(l,o,ii())));throw Cp(c,(r==null?void 0:r.callee)??e),c}return a.value};return e},zu=t=>{const e=async(n,i,s,r)=>{const o=s?{...s,async:!0}:{async:!0};let a=n._zod.run({value:i,issues:[]},o);if(a instanceof Promise&&(a=await a),a.issues.length){const c=new((r==null?void 0:r.Err)??t)(a.issues.map(l=>os(l,o,ii())));throw Cp(c,(r==null?void 0:r.callee)??e),c}return a.value};return e},Bu=t=>(e,n,i)=>{const s=i?{...i,async:!1}:{async:!1},r=e._zod.run({value:n,issues:[]},s);if(r instanceof Promise)throw new Ms;return r.issues.length?Fp(t,r.issues,s):{success:!0,data:r.value}};function Fp(t,e,n){let i;return{success:!1,get error(){return i||(i=new t(e.map(s=>os(s,n,ii()))),e=void 0,n=void 0),i},set error(s){i=s,e=void 0,n=void 0}}}const Hu=t=>async(e,n,i)=>{const s=i?{...i,async:!0}:{async:!0};let r=e._zod.run({value:n,issues:[]},s);return r instanceof Promise&&(r=await r),r.issues.length?Fp(t,r.issues,s):{success:!0,data:r.value}},S0=Symbol.for("zod.compile.invalid"),v0=Symbol.for("zod.compile.fallback"),x0=((t,e,n)=>{const i=t._zod.bag.validator;if(i!==void 0){if(i(e)!==S0)return!0;if(i.definite===!0&&n===void 0)return!1}return y0(t,e,n)});function y0(t,e,n){const i=n?{...n,async:!1,abortEarly:!0}:{async:!1,abortEarly:!0},s=t._zod.bag.fallbackRun;let r;if(s?(i[v0]=!0,r=s({value:e,issues:[]},i)):r=t._zod.run({value:e,issues:[]},i),r instanceof Promise)throw new Ms;return r.issues.length===0}const b0=async(t,e,n)=>{const i=n?{...n,async:!0,abortEarly:!0}:{async:!0,abortEarly:!0};let s=t._zod.run({value:e,issues:[]},i);return s instanceof Promise&&(s=await s),s.issues.length===0},M0=t=>{const e=ku(t),n=(i,s,r,o)=>{const a=r?{...r,direction:"backward"}:{direction:"backward"};return e(i,s,a,qa(n,o))};return n},E0=t=>{const e=ku(t),n=(i,s,r,o)=>e(i,s,r,qa(n,o));return n},T0=t=>{const e=zu(t),n=async(i,s,r,o)=>{const a=r?{...r,direction:"backward"}:{direction:"backward"};return await e(i,s,a,qa(n,o))};return n},R0=t=>{const e=zu(t),n=async(i,s,r,o)=>await e(i,s,r,qa(n,o));return n},w0=t=>(e,n,i)=>{const s=i?{...i,direction:"backward"}:{direction:"backward"};return Bu(t)(e,n,s)},A0=t=>(e,n,i)=>Bu(t)(e,n,i),C0=t=>async(e,n,i)=>{const s=i?{...i,direction:"backward"}:{direction:"backward"};return Hu(t)(e,n,s)},P0=t=>async(e,n,i)=>Hu(t)(e,n,i),L0=/^[cC][0-9a-z]{6,}$/,I0=/^[0-9a-z]+$/,N0=/^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/,D0=/^[0-9a-vA-V]{20}$/,U0=/^[A-Za-z0-9]{27}$/,O0=/^[a-zA-Z0-9_-]{21}$/;function F0(t){return new RegExp(`^[a-zA-Z0-9_-]{${t}}$`)}const k0=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,z0=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,xh=t=>t?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${t}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,B0=/^(?:[A-Za-z0-9_'+\-]+\.)*[A-Za-z0-9_'+\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,H0="^(?=[\\s\\S]*[\\p{Extended_Pictographic}\\p{Regional_Indicator}\\u20E3])[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$";function V0(){return new RegExp(H0,"u")}const G0=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,$0=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,q0=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,W0=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Z0=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,X0=/^(?:[A-Za-z0-9_-]{4})*(?:[A-Za-z0-9_-]{2,3})?$/,Y0=/^https?$/,K0=/^\+[1-9]\d{6,14}$/,kp="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))";function j0(t){return new RegExp(`^${t}$`)}const J0=j0(kp);function El(t){const e="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof t.precision=="number"?t.precision===-1?`${e}`:t.precision===0?`${e}:[0-5]\\d`:`${e}:[0-5]\\d\\.\\d{${t.precision}}`:t.seconds?`${e}:[0-5]\\d(?:\\.\\d+)?`:`${e}(?::[0-5]\\d(?:\\.\\d+)?)?`}function Q0(t){return new RegExp(`^${El(t)}$`)}function ex(t){const e=["Z"];t.offset&&e.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");const n=`${El({precision:t.precision,seconds:!0})}(?:${e.join("|")})`,i=t.local?`${n}|${El({precision:t.precision})}`:n;return new RegExp(`^${kp}T(?:${i})$`)}const tx=/^[\s\S]{0,}$/,nx=/^-?\d+$/,Vu=/^-?\d+(?:\.\d+)?$/,ix=/^(?:true|false)$/i,sx=/^null$/i,rx=/^undefined$/i,ox=/^[^A-Z]*$/,ax=/^[^a-z]*$/,Pn=ee("$ZodCheck",(t,e)=>{var n;t._zod??(t._zod={}),t._zod.def=e,(n=t._zod).onattach??(n.onattach=[])}),Gu=t=>{const e=t.value;return!Ov(e)&&e.length!==void 0},pa={number:"number",bigint:"bigint",object:"date"},zp=ee("$ZodCheckLessThan",(t,e)=>{Pn.init(t,e);const n=pa[typeof e.value];t._zod.check=i=>{(e.inclusive?i.value<=e.value:i.value<e.value)||i.issues.push({origin:pa[typeof i.value]??n,code:"too_big",maximum:typeof e.value=="object"?e.value.getTime():e.value,input:i.value,inclusive:e.inclusive,inst:t,continue:!e.abort})}}),Bp=ee("$ZodCheckGreaterThan",(t,e)=>{Pn.init(t,e);const n=pa[typeof e.value];t._zod.check=i=>{(e.inclusive?i.value>=e.value:i.value>e.value)||i.issues.push({origin:pa[typeof i.value]??n,code:"too_small",minimum:typeof e.value=="object"?e.value.getTime():e.value,input:i.value,inclusive:e.inclusive,inst:t,continue:!e.abort})}}),cx=ee("$ZodCheckMultipleOf",(t,e)=>{Pn.init(t,e),t._zod.check=n=>{if(typeof n.value!=typeof e.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof n.value=="bigint"?e.value!==BigInt(0)&&n.value%e.value===BigInt(0):Fv(n.value,e.value)===0)||n.issues.push({origin:typeof n.value,code:"not_multiple_of",divisor:e.value,input:n.value,inst:t,continue:!e.abort})}}),lx=ee("$ZodCheckNumberFormat",(t,e)=>{var o;Pn.init(t,e),e.format=e.format||"float64";const n=(o=e.format)==null?void 0:o.includes("int"),i=n?"int":"number",[s,r]=Ip[e.format];t._zod.check=a=>{const c=a.value;if(n){if(!Number.isInteger(c)){a.issues.push({expected:i,format:e.format,code:"invalid_type",continue:!1,input:c,inst:t});return}if(!Number.isSafeInteger(c)){c>0?a.issues.push({input:c,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:t,origin:i,inclusive:!0,continue:!e.abort}):a.issues.push({input:c,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:t,origin:i,inclusive:!0,continue:!e.abort});return}}c<s&&a.issues.push({origin:"number",input:c,code:"too_small",minimum:s,inclusive:!0,inst:t,continue:!e.abort}),c>r&&a.issues.push({origin:"number",input:c,code:"too_big",maximum:r,inclusive:!0,inst:t,continue:!e.abort})}}),ux=ee("$ZodCheckMaxLength",(t,e)=>{var n;Pn.init(t,e),(n=t._zod.def).when??(n.when=Gu),t._zod.check=i=>{const s=i.value,r=s.length;if((typeof s=="string"&&r>e.maximum?Ou(s):r)<=e.maximum)return;const a=Fu(s);i.issues.push({origin:a,code:"too_big",maximum:e.maximum,inclusive:!0,input:s,inst:t,continue:!e.abort})}}),dx=ee("$ZodCheckMinLength",(t,e)=>{var n;Pn.init(t,e),(n=t._zod.def).when??(n.when=Gu),t._zod.check=i=>{const s=i.value,r=s.length;if((typeof s=="string"&&r>=e.minimum&&r<e.minimum*2?Ou(s):r)>=e.minimum)return;const a=Fu(s);i.issues.push({origin:a,code:"too_small",minimum:e.minimum,inclusive:!0,input:s,inst:t,continue:!e.abort})}}),hx=ee("$ZodCheckLengthEquals",(t,e)=>{var n;Pn.init(t,e),(n=t._zod.def).when??(n.when=Gu),t._zod.check=i=>{const s=i.value,r=s.length,o=typeof s=="string"&&r>=e.length&&r<=e.length*2?Ou(s):r;if(o===e.length)return;const a=Fu(s),c=o>e.length;i.issues.push({origin:a,...c?{code:"too_big",maximum:e.length}:{code:"too_small",minimum:e.length},inclusive:!0,exact:!0,input:i.value,inst:t,continue:!e.abort})}}),Wa=ee("$ZodCheckStringFormat",(t,e)=>{var n,i;Pn.init(t,e),e.pattern?(n=t._zod).check??(n.check=s=>{e.pattern.lastIndex=0,!e.pattern.test(s.value)&&s.issues.push({origin:"string",code:"invalid_format",format:e.format,input:s.value,...e.pattern?{pattern:e.pattern.toString()}:{},inst:t,continue:!e.abort})}):(i=t._zod).check??(i.check=()=>{})}),fx=ee("$ZodCheckRegex",(t,e)=>{Wa.init(t,e),t._zod.check=n=>{e.pattern.lastIndex=0,!e.pattern.test(n.value)&&n.issues.push({origin:"string",code:"invalid_format",format:"regex",input:n.value,pattern:e.pattern.toString(),inst:t,continue:!e.abort})}}),px=ee("$ZodCheckLowerCase",(t,e)=>{e.pattern??(e.pattern=ox),Wa.init(t,e)}),mx=ee("$ZodCheckUpperCase",(t,e)=>{e.pattern??(e.pattern=ax),Wa.init(t,e)}),gx=ee("$ZodCheckIncludes",(t,e)=>{Pn.init(t,e);const n=mr(e.includes),i=new RegExp(typeof e.position=="number"?`^.{${e.position},}${n}`:n);e.pattern=i,t._zod.check=s=>{s.value.includes(e.includes,e.position)||s.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:e.includes,input:s.value,inst:t,continue:!e.abort})}}),_x=ee("$ZodCheckStartsWith",(t,e)=>{Pn.init(t,e);const n=new RegExp(`^${mr(e.prefix)}.*`);e.pattern??(e.pattern=n),t._zod.check=i=>{i.value.startsWith(e.prefix)||i.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:e.prefix,input:i.value,inst:t,continue:!e.abort})}}),Sx=ee("$ZodCheckEndsWith",(t,e)=>{Pn.init(t,e);const n=new RegExp(`.*${mr(e.suffix)}$`);e.pattern??(e.pattern=n),t._zod.check=i=>{i.value.endsWith(e.suffix)||i.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:e.suffix,input:i.value,inst:t,continue:!e.abort})}}),vx=ee("$ZodCheckOverwrite",(t,e)=>{Pn.init(t,e),t._zod.check=n=>{n.value=e.tx(n.value)}});class xx{constructor(e=[],n={}){this.content=[],this.indent=0,this.args=e,this.closed=n}indented(e){this.indent+=1;try{e(this)}finally{this.indent-=1}}write(e){if(typeof e=="function"){e(this,{execution:"sync"}),e(this,{execution:"async"});return}const i=e.split(`
|
|
9
9
|
`).filter(o=>o),s=Math.min(...i.map(o=>o.length-o.trimStart().length)),r=i.map(o=>o.slice(s)).map(o=>" ".repeat(this.indent*2)+o);for(const o of r)this.content.push(o)}compile(){const e=Function,n=(this==null?void 0:this.content)??[""];return new e(...Object.keys(this.closed),`return function (${this.args.join(", ")}) {
|
|
10
10
|
${n.join(`
|
|
11
11
|
`)}
|
|
12
|
-
};`)(...Object.values(this.closed))}}const S0={major:4,minor:6,patch:7},wt=ee("$ZodType",(t,e)=>{var r;var n;t??(t={}),t._zod.def=e,t._zod.bag=t._zod.bag||{},t._zod.version=S0;const i=t._zod.def.checks,s=t._zod.traits.has("$ZodCheck")?[t,...i??[]]:i!=null&&i.length?[...i]:[];for(const o of s)for(const a of o._zod.onattach)a(t);if(s.length===0)(n=t._zod).deferred??(n.deferred=[]),(r=t._zod.deferred)==null||r.push(()=>{t._zod.run=t._zod.parse});else{const o=(c,l,u)=>{if(c.memo)return c;let h=Ai(c),d;for(const f of l){if(f._zod.def.when){if(YS(c)||!f._zod.def.when(c))continue}else if(h)continue;const _=c.issues.length,x=f._zod.check(c);if(x instanceof Promise&&(u==null?void 0:u.async)===!1)throw new ps;if(d||x instanceof Promise)d=(d??Promise.resolve()).then(async()=>{await x,c.issues.length!==_&&(nl(c.issues,_,t),h||(h=Ai(c,_)))});else{if(c.issues.length===_)continue;nl(c.issues,_,t),h||(h=Ai(c,_))}}return d?d.then(()=>c):c},a=(c,l,u)=>{if(Ai(c))return c.aborted=!0,c;const h=o(l,s,u);if(h instanceof Promise){if(u.async===!1)throw new ps;return h.then(d=>t._zod.parse(d,u))}return t._zod.parse(h,u)};t._zod.run=(c,l)=>{if(l.skipChecks)return t._zod.parse(c,l);if(l.direction==="backward"){const h=t._zod.parse({value:c.value,issues:[]},{...l,skipChecks:!0});return h instanceof Promise?h.then(d=>a(d,c,l)):a(h,c,l)}const u=t._zod.parse(c,l);if(u instanceof Promise){if(l.async===!1)throw new ps;return u.then(h=>o(h,s,l))}return o(u,s,l)}}},{get"~standard"(){return Xf(this,"~standard",np(this))},set"~standard"(t){Ki(this,"~standard",t)}}),tp=(t,e)=>t.issues.length?{issues:t.issues.map(n=>Yi(n,e,Qn()))}:{value:t.value};async function v0(t,e){const n={async:!0};return tp(await t._zod.run({value:e,issues:[]},n),n)}function np(t){return{validate:e=>{const n={async:!1};try{const i=t._zod.run({value:e,issues:[]},n);if(!(i instanceof Promise))return tp(i,n)}catch{}return v0(t,e)},vendor:"zod",version:1}}const vu=ee("$ZodString",(t,e)=>{wt.init(t,e),t._zod.pattern=e.pattern??Jv,t._zod.parse=(n,i)=>{if(e.coerce)try{n.value=String(n.value)}catch{}return typeof n.value=="string"||n.issues.push({expected:"string",code:"invalid_type",input:n.value,inst:t}),n}}),Ft=ee("$ZodStringFormat",(t,e)=>{Na.init(t,e),vu.init(t,e)}),x0=ee("$ZodGUID",(t,e)=>{e.pattern??(e.pattern=Ov),Ft.init(t,e)}),y0=ee("$ZodUUID",(t,e)=>{if(e.version){const i={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[e.version];if(i===void 0)throw new Error(`Invalid UUID version: "${e.version}"`);e.pattern??(e.pattern=zd(i))}else e.pattern??(e.pattern=zd());Ft.init(t,e)}),b0=ee("$ZodEmail",(t,e)=>{e.pattern??(e.pattern=Fv),Ft.init(t,e)}),ip=1,sa=2;function sp(t){try{return typeof URL<"u"&&typeof URL.canParse=="function"?URL.canParse(t):(new URL(t),!0)}catch{return!1}}function M0(t,e){return!("normalize"in e)&&!("hostname"in e)&&!("protocol"in e)?sp(t)||sa:E0(t,e)}function E0(t,e){var n;if(!e.normalize&&((n=e.protocol)==null?void 0:n.source)===Wv.source&&!/^https?:\/\//i.test(t))return ip;try{if(typeof URL<"u"){const i=URL;if(typeof i.parse=="function")return i.parse(t)??sa}return new URL(t)}catch{return sa}}const T0=/[\t\n\r]/g;function Bd(t){return t.replace(T0,"")}function R0(t,e){return e.lastIndex=0,e.test(t.hostname)}function w0(t,e){return e.lastIndex=0,e.test(t.protocol.endsWith(":")?t.protocol.slice(0,-1):t.protocol)}const A0=ee("$ZodURL",(t,e)=>{Ft.init(t,e),t._zod.check=n=>{try{const i=n.value.trim(),s=M0(i,e);if(s===ip){n.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:n.value,inst:t,continue:!e.abort});return}if(s===sa){n.issues.push({code:"invalid_format",format:"url",input:n.value,inst:t,continue:!e.abort});return}if(s===!0){n.value=Bd(i);return}e.hostname&&!R0(s,e.hostname)&&n.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:e.hostname.source,input:n.value,inst:t,continue:!e.abort}),e.protocol&&!w0(s,e.protocol)&&n.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:e.protocol.source,input:n.value,inst:t,continue:!e.abort}),n.value=e.normalize?s.href:Bd(i);return}catch{n.issues.push({code:"invalid_format",format:"url",input:n.value,inst:t,continue:!e.abort})}}}),C0=ee("$ZodEmoji",(t,e)=>{e.pattern??(e.pattern=zv()),Ft.init(t,e)}),P0=ee("$ZodNanoID",(t,e)=>{if(e.length!==void 0&&(!Number.isInteger(e.length)||e.length<1))throw new Error(`Invalid nanoid length: ${e.length}`);e.pattern??(e.pattern=e.length===void 0?Nv:Dv(e.length)),Ft.init(t,e)}),I0=ee("$ZodCUID",(t,e)=>{e.pattern??(e.pattern=Av),Ft.init(t,e)}),L0=ee("$ZodCUID2",(t,e)=>{e.pattern??(e.pattern=Cv),Ft.init(t,e)}),N0=ee("$ZodULID",(t,e)=>{e.pattern??(e.pattern=Pv),Ft.init(t,e)}),D0=ee("$ZodXID",(t,e)=>{e.pattern??(e.pattern=Iv),Ft.init(t,e)}),U0=ee("$ZodKSUID",(t,e)=>{e.pattern??(e.pattern=Lv),Ft.init(t,e)}),O0=ee("$ZodISODateTime",(t,e)=>{e.pattern??(e.pattern=jv(e)),Ft.init(t,e)}),F0=ee("$ZodISODate",(t,e)=>{e.pattern??(e.pattern=Yv),Ft.init(t,e)}),k0=ee("$ZodISOTime",(t,e)=>{e.pattern??(e.pattern=Kv(e)),Ft.init(t,e)}),z0=ee("$ZodISODuration",(t,e)=>{e.pattern??(e.pattern=Uv),Ft.init(t,e)}),B0=ee("$ZodIPv4",(t,e)=>{e.pattern??(e.pattern=Bv),Ft.init(t,e)}),H0=/^[0-9a-fA-F:.]+$/;function rp(t){return H0.test(t)?sp(`http://[${t}]`):!1}const V0=ee("$ZodIPv6",(t,e)=>{e.pattern??(e.pattern=Hv),Ft.init(t,e),t._zod.check=n=>{rp(n.value)||n.issues.push({code:"invalid_format",format:"ipv6",input:n.value,inst:t,continue:!e.abort})}}),G0=ee("$ZodCIDRv4",(t,e)=>{e.pattern??(e.pattern=Vv),Ft.init(t,e)});function q0(t){const e=t.split("/");if(e.length!==2)return!1;const[n,i]=e;if(!i)return!1;const s=Number(i);return`${s}`!==i||s<0||s>128?!1:rp(n)}const $0=ee("$ZodCIDRv6",(t,e)=>{e.pattern??(e.pattern=Gv),Ft.init(t,e),t._zod.check=n=>{q0(n.value)||n.issues.push({code:"invalid_format",format:"cidrv6",input:n.value,inst:t,continue:!e.abort})}});function op(t){if(t==="")return!0;if(/\s/.test(t)||t.length%4!==0)return!1;try{return atob(t),!0}catch{return!1}}const ap=/^[0-9a-zA-Z+/]*={0,2}$/,W0=ee("$ZodBase64",(t,e)=>{e.pattern??(e.pattern=ap),Ft.init(t,e),t._zod.check=n=>{op(n.value)||n.issues.push({code:"invalid_format",format:"base64",input:n.value,inst:t,continue:!e.abort})}}),xu=/^[A-Za-z0-9_-]*$/;function Z0(t){if(!xu.test(t))return!1;const e=t.replace(/[-_]/g,i=>i==="-"?"+":"/"),n=e.padEnd(Math.ceil(e.length/4)*4,"=");return op(n)}const X0=ee("$ZodBase64URL",(t,e)=>{e.pattern??(e.pattern=xu),Ft.init(t,e),t._zod.check=n=>{Z0(n.value)||n.issues.push({code:"invalid_format",format:"base64url",input:n.value,inst:t,continue:!e.abort})}}),Y0=ee("$ZodE164",(t,e)=>{e.pattern??(e.pattern=Zv),Ft.init(t,e)});function K0(t,e=null){try{const n=t.split(".");if(n.length!==3)return!1;const[i]=n;if(!i)return!1;const s=JSON.parse(atob(i));return!("typ"in s&&(s==null?void 0:s.typ)!=="JWT"||!s.alg||e&&(!("alg"in s)||s.alg!==e))}catch{return!1}}const j0=ee("$ZodJWT",(t,e)=>{Ft.init(t,e),t._zod.check=n=>{K0(n.value,e.alg)||n.issues.push({code:"invalid_format",format:"jwt",input:n.value,inst:t,continue:!e.abort})}}),cp=ee("$ZodNumber",(t,e)=>{wt.init(t,e),t._zod.pattern=_u,t._zod.parse=(n,i)=>{if(e.coerce)try{n.value=Number(n.value)}catch{}const s=n.value;if(typeof s=="number"&&!Number.isNaN(s)&&Number.isFinite(s))return n;const r=typeof s=="number"?Number.isNaN(s)?"NaN":Number.isFinite(s)?void 0:String(s):void 0;return n.issues.push({expected:"number",code:"invalid_type",input:s,inst:t,...r?{received:r}:{}}),n}}),J0=ee("$ZodNumberFormat",(t,e)=>{o0.init(t,e),cp.init(t,e)}),Q0=ee("$ZodBoolean",(t,e)=>{wt.init(t,e),t._zod.pattern=e0,t._zod.parse=(n,i)=>{if(e.coerce)try{n.value=!!n.value}catch{}const s=n.value;return typeof s=="boolean"||n.issues.push({expected:"boolean",code:"invalid_type",input:s,inst:t}),n}}),ex=ee("$ZodUndefined",(t,e)=>{wt.init(t,e),t._zod.pattern=n0,t._zod.values=new Set([void 0]),t._zod.parse=(n,i)=>{const s=n.value;return typeof s>"u"||n.issues.push({expected:"undefined",code:"invalid_type",input:s,inst:t}),n}}),tx=ee("$ZodNull",(t,e)=>{wt.init(t,e),t._zod.pattern=t0,t._zod.values=new Set([null]),t._zod.parse=(n,i)=>{const s=n.value;return s===null||n.issues.push({expected:"null",code:"invalid_type",input:s,inst:t}),n}}),nx=ee("$ZodAny",(t,e)=>{wt.init(t,e),t._zod.parse=n=>n}),ix=ee("$ZodUnknown",(t,e)=>{wt.init(t,e),t._zod.parse=n=>n}),sx=ee("$ZodNever",(t,e)=>{wt.init(t,e),t._zod.parse=(n,i)=>(n.issues.push({expected:"never",code:"invalid_type",input:n.value,inst:t}),n)});function rx(t,e){const n=Ud(t._zod.def.checks);if(!n.length)return;const i=Math.min(...n.map(r=>r[0])),s=t._zod.parse;t._zod.parse=(r,o)=>{const a=e(r.value);if(a>i&&!(o!=null&&o.skipChecks)&&(o==null?void 0:o.direction)!=="backward"){for(const[c,l]of Ud(t._zod.def.checks))if(a>c&&l._zod.def.when(r)){const u=r.issues.length;return l._zod.check(r),r.issues[u].continue=!1,nl(r.issues,u,t),r}}return s(r,o)}}const ox=t=>Array.isArray(t)?t.length:-1;function Hd(t,e,n){t.issues.length&&e.issues.push(...Gs(n,t.issues)),e.value[n]=t.value}const ax=ee("$ZodArray",(t,e)=>{wt.init(t,e);const n=Jn.memoizer;n==null||n.attach(t),t._zod.parse=(i,s)=>{const r=i.value;if(!Array.isArray(r))return i.issues.push({expected:"array",code:"invalid_type",input:r,inst:t}),i;i.value=n?n.alloc(t,i,Array(r.length),s):Array(r.length);const o=[],a=s==null?void 0:s.abortEarly;for(let c=0;c<r.length;c++){const l=r[c],u=e.element._zod.run({value:l,issues:[]},s);if(u instanceof Promise)o.push(u.then(h=>Hd(h,i,c)));else if(Hd(u,i,c),a&&u.issues.length!==0&&Ai(u))break}return o.length?Promise.all(o).then(()=>i):i},rx(t,ox)});function ra(t,e,n,i,s,r){const o=n in i,a=r==="optional";if(!(!o&&a&&s==="optional")){if(t.issues.length){if(s!==void 0&&a&&!o)return;e.issues.push(...Gs(n,t.issues))}if(!o&&s===void 0){t.issues.length||e.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[n]});return}t.value===void 0?(o||s==="defaulted"&&!a)&&(e.value[n]=void 0):e.value[n]=t.value}}const cx=[];function lp(t){var o,a,c,l;const e=Object.keys(t.shape),n=Object.getOwnPropertySymbols(t.shape),i=n.length?n:cx,s=i.length?[...e,...i]:e;for(const u of s)if(!((l=(c=(a=(o=t.shape)==null?void 0:o[u])==null?void 0:a._zod)==null?void 0:c.traits)!=null&&l.has("$ZodType")))throw new Error(`Invalid element at key "${String(u)}": expected a Zod schema`);const r=HS(t.shape);return{...t,allKeys:s,symbolKeys:i,keySet:new Set(e),numKeys:e.length,optionalKeys:new Set(r)}}function up(t,e,n,i,s,r,o){const a=[],c=s.keySet,l=s.catchall._zod,u=l.def.type,h=l.optin,d=l.optout;let f=0;for(const _ in e){if(o&&n.issues.length!==f){if(Ai(n,f))break;f=n.issues.length}if(c.has(_))continue;if(_==="__proto__"){u==="never"&&a.push(_);continue}if(u==="never"){a.push(_);continue}const x=l.run({value:e[_],issues:[]},i);x instanceof Promise?t.push(x.then(m=>ra(m,n,_,e,h,d))):ra(x,n,_,e,h,d)}return a.length&&n.issues.push({code:"unrecognized_keys",keys:a,input:e,inst:r,continue:!0}),t.length?Promise.all(t).then(()=>n):n}const lx=ee("$ZodObject",(t,e)=>{wt.init(t,e);const n=Object.getOwnPropertyDescriptor(e,"shape"),i=n!=null&&n.get?n.get.raw:e.shape??{};if(i){const l=()=>{const u={...i};return Object.defineProperty(e,"shape",{value:u}),l.raw=u,u};l.raw=i,Object.defineProperty(e,"shape",{get:l})}const s=Pa(()=>lp(e));ht(t,"propValues",l=>{const u=l.def.shape,h={};for(const d in u){const f=u[d]._zod;if(f.values){Object.prototype.hasOwnProperty.call(h,d)||gi(h,d,new Set);for(const _ of f.values)h[d].add(_);f.optin!==void 0&&h[d].add(void 0)}}return h});const r=Vr,o=e.catchall;let a;const c=Jn.memoizer;c==null||c.attach(t),t._zod.parse=(l,u)=>{a??(a=s.value);const h=l.value;if(!r(h))return l.issues.push({expected:"object",code:"invalid_type",input:h,inst:t}),l;l.value=c?c.alloc(t,l,{},u):{};const d=[],f=a.shape,_=u==null?void 0:u.abortEarly;let x=l.issues.length;for(const m of a.allKeys){if(_&&l.issues.length!==x){if(Ai(l,x))break;x=l.issues.length}if(m==="__proto__")continue;const p=f[m],E=p._zod.optin,L=p._zod.optout,b=p._zod.run({value:h[m],issues:[]},u);b instanceof Promise?d.push(b.then(w=>ra(w,l,m,h,E,L))):ra(b,l,m,h,E,L)}return o?up(d,h,l,u,s.value,t,_===!0):d.length?Promise.all(d).then(()=>l):l}}),ux=ee("$ZodObjectJIT",(t,e)=>{lx.init(t,e);const n=t._zod.parse,i=Pa(()=>lp(e)),s=Jn.memoizer,r=f=>{var w,A;const _=i.value,x=_.symbolKeys,m=new _0(["payload","ctx"],{shape:f,inst:t,memo:s,syms:x}),p=P=>`shape[${P}]._zod.run({ value: input[${P}], issues: [] }, ctx)`,E=(P,v)=>`
|
|
12
|
+
};`)(...Object.values(this.closed))}}const yx={major:4,minor:6,patch:7},Ct=ee("$ZodType",(t,e)=>{var r;var n;t??(t={}),t._zod.def=e,t._zod.bag=t._zod.bag||{},t._zod.version=yx;const i=t._zod.def.checks,s=t._zod.traits.has("$ZodCheck")?[t,...i??[]]:i!=null&&i.length?[...i]:[];for(const o of s)for(const a of o._zod.onattach)a(t);if(s.length===0)(n=t._zod).deferred??(n.deferred=[]),(r=t._zod.deferred)==null||r.push(()=>{t._zod.run=t._zod.parse});else{const o=(c,l,u)=>{if(c.memo)return c;let h=Di(c),d;for(const f of l){if(f._zod.def.when){if(Jv(c)||!f._zod.def.when(c))continue}else if(h)continue;const _=c.issues.length,x=f._zod.check(c);if(x instanceof Promise&&(u==null?void 0:u.async)===!1)throw new Ms;if(d||x instanceof Promise)d=(d??Promise.resolve()).then(async()=>{await x,c.issues.length!==_&&(Ml(c.issues,_,t),h||(h=Di(c,_)))});else{if(c.issues.length===_)continue;Ml(c.issues,_,t),h||(h=Di(c,_))}}return d?d.then(()=>c):c},a=(c,l,u)=>{if(Di(c))return c.aborted=!0,c;const h=o(l,s,u);if(h instanceof Promise){if(u.async===!1)throw new Ms;return h.then(d=>t._zod.parse(d,u))}return t._zod.parse(h,u)};t._zod.run=(c,l)=>{if(l.skipChecks)return t._zod.parse(c,l);if(l.direction==="backward"){const h=t._zod.parse({value:c.value,issues:[]},{...l,skipChecks:!0});return h instanceof Promise?h.then(d=>a(d,c,l)):a(h,c,l)}const u=t._zod.parse(c,l);if(u instanceof Promise){if(l.async===!1)throw new Ms;return u.then(h=>o(h,s,l))}return o(u,s,l)}}},{get"~standard"(){return Dp(this,"~standard",Vp(this))},set"~standard"(t){as(this,"~standard",t)}}),Hp=(t,e)=>t.issues.length?{issues:t.issues.map(n=>os(n,e,ii()))}:{value:t.value};async function bx(t,e){const n={async:!0};return Hp(await t._zod.run({value:e,issues:[]},n),n)}function Vp(t){return{validate:e=>{const n={async:!1};try{const i=t._zod.run({value:e,issues:[]},n);if(!(i instanceof Promise))return Hp(i,n)}catch{}return bx(t,e)},vendor:"zod",version:1}}const $u=ee("$ZodString",(t,e)=>{Ct.init(t,e),t._zod.pattern=e.pattern??tx,t._zod.parse=(n,i)=>{if(e.coerce)try{n.value=String(n.value)}catch{}return typeof n.value=="string"||n.issues.push({expected:"string",code:"invalid_type",input:n.value,inst:t}),n}}),kt=ee("$ZodStringFormat",(t,e)=>{Wa.init(t,e),$u.init(t,e)}),Mx=ee("$ZodGUID",(t,e)=>{e.pattern??(e.pattern=z0),kt.init(t,e)}),Ex=ee("$ZodUUID",(t,e)=>{if(e.version){const i={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[e.version];if(i===void 0)throw new Error(`Invalid UUID version: "${e.version}"`);e.pattern??(e.pattern=xh(i))}else e.pattern??(e.pattern=xh());kt.init(t,e)}),Tx=ee("$ZodEmail",(t,e)=>{e.pattern??(e.pattern=B0),kt.init(t,e)}),Gp=1,ma=2;function $p(t){try{return typeof URL<"u"&&typeof URL.canParse=="function"?URL.canParse(t):(new URL(t),!0)}catch{return!1}}function Rx(t,e){return!("normalize"in e)&&!("hostname"in e)&&!("protocol"in e)?$p(t)||ma:wx(t,e)}function wx(t,e){var n;if(!e.normalize&&((n=e.protocol)==null?void 0:n.source)===Y0.source&&!/^https?:\/\//i.test(t))return Gp;try{if(typeof URL<"u"){const i=URL;if(typeof i.parse=="function")return i.parse(t)??ma}return new URL(t)}catch{return ma}}const Ax=/[\t\n\r]/g;function yh(t){return t.replace(Ax,"")}function Cx(t,e){return e.lastIndex=0,e.test(t.hostname)}function Px(t,e){return e.lastIndex=0,e.test(t.protocol.endsWith(":")?t.protocol.slice(0,-1):t.protocol)}const Lx=ee("$ZodURL",(t,e)=>{kt.init(t,e),t._zod.check=n=>{try{const i=n.value.trim(),s=Rx(i,e);if(s===Gp){n.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:n.value,inst:t,continue:!e.abort});return}if(s===ma){n.issues.push({code:"invalid_format",format:"url",input:n.value,inst:t,continue:!e.abort});return}if(s===!0){n.value=yh(i);return}e.hostname&&!Cx(s,e.hostname)&&n.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:e.hostname.source,input:n.value,inst:t,continue:!e.abort}),e.protocol&&!Px(s,e.protocol)&&n.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:e.protocol.source,input:n.value,inst:t,continue:!e.abort}),n.value=e.normalize?s.href:yh(i);return}catch{n.issues.push({code:"invalid_format",format:"url",input:n.value,inst:t,continue:!e.abort})}}}),Ix=ee("$ZodEmoji",(t,e)=>{e.pattern??(e.pattern=V0()),kt.init(t,e)}),Nx=ee("$ZodNanoID",(t,e)=>{if(e.length!==void 0&&(!Number.isInteger(e.length)||e.length<1))throw new Error(`Invalid nanoid length: ${e.length}`);e.pattern??(e.pattern=e.length===void 0?O0:F0(e.length)),kt.init(t,e)}),Dx=ee("$ZodCUID",(t,e)=>{e.pattern??(e.pattern=L0),kt.init(t,e)}),Ux=ee("$ZodCUID2",(t,e)=>{e.pattern??(e.pattern=I0),kt.init(t,e)}),Ox=ee("$ZodULID",(t,e)=>{e.pattern??(e.pattern=N0),kt.init(t,e)}),Fx=ee("$ZodXID",(t,e)=>{e.pattern??(e.pattern=D0),kt.init(t,e)}),kx=ee("$ZodKSUID",(t,e)=>{e.pattern??(e.pattern=U0),kt.init(t,e)}),zx=ee("$ZodISODateTime",(t,e)=>{e.pattern??(e.pattern=ex(e)),kt.init(t,e)}),Bx=ee("$ZodISODate",(t,e)=>{e.pattern??(e.pattern=J0),kt.init(t,e)}),Hx=ee("$ZodISOTime",(t,e)=>{e.pattern??(e.pattern=Q0(e)),kt.init(t,e)}),Vx=ee("$ZodISODuration",(t,e)=>{e.pattern??(e.pattern=k0),kt.init(t,e)}),Gx=ee("$ZodIPv4",(t,e)=>{e.pattern??(e.pattern=G0),kt.init(t,e)}),$x=/^[0-9a-fA-F:.]+$/;function qp(t){return $x.test(t)?$p(`http://[${t}]`):!1}const qx=ee("$ZodIPv6",(t,e)=>{e.pattern??(e.pattern=$0),kt.init(t,e),t._zod.check=n=>{qp(n.value)||n.issues.push({code:"invalid_format",format:"ipv6",input:n.value,inst:t,continue:!e.abort})}}),Wx=ee("$ZodCIDRv4",(t,e)=>{e.pattern??(e.pattern=q0),kt.init(t,e)});function Zx(t){const e=t.split("/");if(e.length!==2)return!1;const[n,i]=e;if(!i)return!1;const s=Number(i);return`${s}`!==i||s<0||s>128?!1:qp(n)}const Xx=ee("$ZodCIDRv6",(t,e)=>{e.pattern??(e.pattern=W0),kt.init(t,e),t._zod.check=n=>{Zx(n.value)||n.issues.push({code:"invalid_format",format:"cidrv6",input:n.value,inst:t,continue:!e.abort})}});function Wp(t){if(t==="")return!0;if(/\s/.test(t)||t.length%4!==0)return!1;try{return atob(t),!0}catch{return!1}}const Zp=/^[0-9a-zA-Z+/]*={0,2}$/,Yx=ee("$ZodBase64",(t,e)=>{e.pattern??(e.pattern=Zp),kt.init(t,e),t._zod.check=n=>{Wp(n.value)||n.issues.push({code:"invalid_format",format:"base64",input:n.value,inst:t,continue:!e.abort})}}),qu=/^[A-Za-z0-9_-]*$/;function Kx(t){if(!qu.test(t))return!1;const e=t.replace(/[-_]/g,i=>i==="-"?"+":"/"),n=e.padEnd(Math.ceil(e.length/4)*4,"=");return Wp(n)}const jx=ee("$ZodBase64URL",(t,e)=>{e.pattern??(e.pattern=qu),kt.init(t,e),t._zod.check=n=>{Kx(n.value)||n.issues.push({code:"invalid_format",format:"base64url",input:n.value,inst:t,continue:!e.abort})}}),Jx=ee("$ZodE164",(t,e)=>{e.pattern??(e.pattern=K0),kt.init(t,e)});function Qx(t,e=null){try{const n=t.split(".");if(n.length!==3)return!1;const[i]=n;if(!i)return!1;const s=JSON.parse(atob(i));return!("typ"in s&&(s==null?void 0:s.typ)!=="JWT"||!s.alg||e&&(!("alg"in s)||s.alg!==e))}catch{return!1}}const ey=ee("$ZodJWT",(t,e)=>{kt.init(t,e),t._zod.check=n=>{Qx(n.value,e.alg)||n.issues.push({code:"invalid_format",format:"jwt",input:n.value,inst:t,continue:!e.abort})}}),Xp=ee("$ZodNumber",(t,e)=>{Ct.init(t,e),t._zod.pattern=Vu,t._zod.parse=(n,i)=>{if(e.coerce)try{n.value=Number(n.value)}catch{}const s=n.value;if(typeof s=="number"&&!Number.isNaN(s)&&Number.isFinite(s))return n;const r=typeof s=="number"?Number.isNaN(s)?"NaN":Number.isFinite(s)?void 0:String(s):void 0;return n.issues.push({expected:"number",code:"invalid_type",input:s,inst:t,...r?{received:r}:{}}),n}}),ty=ee("$ZodNumberFormat",(t,e)=>{lx.init(t,e),Xp.init(t,e)}),ny=ee("$ZodBoolean",(t,e)=>{Ct.init(t,e),t._zod.pattern=ix,t._zod.parse=(n,i)=>{if(e.coerce)try{n.value=!!n.value}catch{}const s=n.value;return typeof s=="boolean"||n.issues.push({expected:"boolean",code:"invalid_type",input:s,inst:t}),n}}),iy=ee("$ZodUndefined",(t,e)=>{Ct.init(t,e),t._zod.pattern=rx,t._zod.values=new Set([void 0]),t._zod.parse=(n,i)=>{const s=n.value;return typeof s>"u"||n.issues.push({expected:"undefined",code:"invalid_type",input:s,inst:t}),n}}),sy=ee("$ZodNull",(t,e)=>{Ct.init(t,e),t._zod.pattern=sx,t._zod.values=new Set([null]),t._zod.parse=(n,i)=>{const s=n.value;return s===null||n.issues.push({expected:"null",code:"invalid_type",input:s,inst:t}),n}}),ry=ee("$ZodAny",(t,e)=>{Ct.init(t,e),t._zod.parse=n=>n}),oy=ee("$ZodUnknown",(t,e)=>{Ct.init(t,e),t._zod.parse=n=>n}),ay=ee("$ZodNever",(t,e)=>{Ct.init(t,e),t._zod.parse=(n,i)=>(n.issues.push({expected:"never",code:"invalid_type",input:n.value,inst:t}),n)});function cy(t,e){const n=gh(t._zod.def.checks);if(!n.length)return;const i=Math.min(...n.map(r=>r[0])),s=t._zod.parse;t._zod.parse=(r,o)=>{const a=e(r.value);if(a>i&&!(o!=null&&o.skipChecks)&&(o==null?void 0:o.direction)!=="backward"){for(const[c,l]of gh(t._zod.def.checks))if(a>c&&l._zod.def.when(r)){const u=r.issues.length;return l._zod.check(r),r.issues[u].continue=!1,Ml(r.issues,u,t),r}}return s(r,o)}}const ly=t=>Array.isArray(t)?t.length:-1;function bh(t,e,n){t.issues.length&&e.issues.push(...tr(n,t.issues)),e.value[n]=t.value}const uy=ee("$ZodArray",(t,e)=>{Ct.init(t,e);const n=ni.memoizer;n==null||n.attach(t),t._zod.parse=(i,s)=>{const r=i.value;if(!Array.isArray(r))return i.issues.push({expected:"array",code:"invalid_type",input:r,inst:t}),i;i.value=n?n.alloc(t,i,Array(r.length),s):Array(r.length);const o=[],a=s==null?void 0:s.abortEarly;for(let c=0;c<r.length;c++){const l=r[c],u=e.element._zod.run({value:l,issues:[]},s);if(u instanceof Promise)o.push(u.then(h=>bh(h,i,c)));else if(bh(u,i,c),a&&u.issues.length!==0&&Di(u))break}return o.length?Promise.all(o).then(()=>i):i},cy(t,ly)});function ga(t,e,n,i,s,r){const o=n in i,a=r==="optional";if(!(!o&&a&&s==="optional")){if(t.issues.length){if(s!==void 0&&a&&!o)return;e.issues.push(...tr(n,t.issues))}if(!o&&s===void 0){t.issues.length||e.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[n]});return}t.value===void 0?(o||s==="defaulted"&&!a)&&(e.value[n]=void 0):e.value[n]=t.value}}const dy=[];function Yp(t){var o,a,c,l;const e=Object.keys(t.shape),n=Object.getOwnPropertySymbols(t.shape),i=n.length?n:dy,s=i.length?[...e,...i]:e;for(const u of s)if(!((l=(c=(a=(o=t.shape)==null?void 0:o[u])==null?void 0:a._zod)==null?void 0:c.traits)!=null&&l.has("$ZodType")))throw new Error(`Invalid element at key "${String(u)}": expected a Zod schema`);const r=$v(t.shape);return{...t,allKeys:s,symbolKeys:i,keySet:new Set(e),numKeys:e.length,optionalKeys:new Set(r)}}function Kp(t,e,n,i,s,r,o){const a=[],c=s.keySet,l=s.catchall._zod,u=l.def.type,h=l.optin,d=l.optout;let f=0;for(const _ in e){if(o&&n.issues.length!==f){if(Di(n,f))break;f=n.issues.length}if(c.has(_))continue;if(_==="__proto__"){u==="never"&&a.push(_);continue}if(u==="never"){a.push(_);continue}const x=l.run({value:e[_],issues:[]},i);x instanceof Promise?t.push(x.then(m=>ga(m,n,_,e,h,d))):ga(x,n,_,e,h,d)}return a.length&&n.issues.push({code:"unrecognized_keys",keys:a,input:e,inst:r,continue:!0}),t.length?Promise.all(t).then(()=>n):n}const hy=ee("$ZodObject",(t,e)=>{Ct.init(t,e);const n=Object.getOwnPropertyDescriptor(e,"shape"),i=n!=null&&n.get?n.get.raw:e.shape??{};if(i){const l=()=>{const u={...i};return Object.defineProperty(e,"shape",{value:u}),l.raw=u,u};l.raw=i,Object.defineProperty(e,"shape",{get:l})}const s=Ga(()=>Yp(e));pt(t,"propValues",l=>{const u=l.def.shape,h={};for(const d in u){const f=u[d]._zod;if(f.values){Object.prototype.hasOwnProperty.call(h,d)||bi(h,d,new Set);for(const _ of f.values)h[d].add(_);f.optin!==void 0&&h[d].add(void 0)}}return h});const r=eo,o=e.catchall;let a;const c=ni.memoizer;c==null||c.attach(t),t._zod.parse=(l,u)=>{a??(a=s.value);const h=l.value;if(!r(h))return l.issues.push({expected:"object",code:"invalid_type",input:h,inst:t}),l;l.value=c?c.alloc(t,l,{},u):{};const d=[],f=a.shape,_=u==null?void 0:u.abortEarly;let x=l.issues.length;for(const m of a.allKeys){if(_&&l.issues.length!==x){if(Di(l,x))break;x=l.issues.length}if(m==="__proto__")continue;const p=f[m],E=p._zod.optin,I=p._zod.optout,b=p._zod.run({value:h[m],issues:[]},u);b instanceof Promise?d.push(b.then(w=>ga(w,l,m,h,E,I))):ga(b,l,m,h,E,I)}return o?Kp(d,h,l,u,s.value,t,_===!0):d.length?Promise.all(d).then(()=>l):l}}),fy=ee("$ZodObjectJIT",(t,e)=>{hy.init(t,e);const n=t._zod.parse,i=Ga(()=>Yp(e)),s=ni.memoizer,r=f=>{var w,A;const _=i.value,x=_.symbolKeys,m=new xx(["payload","ctx"],{shape:f,inst:t,memo:s,syms:x}),p=P=>`shape[${P}]._zod.run({ value: input[${P}], issues: [] }, ctx)`,E=(P,v)=>`
|
|
13
13
|
let ${P}_ab = false;
|
|
14
14
|
for (let i = 0; i < ${P}.issues.length; i++) {
|
|
15
15
|
const iss = ${P}.issues[i];
|
|
@@ -20,8 +20,8 @@ ${n.join(`
|
|
|
20
20
|
if (${P}_ab && ctx && ctx.abortEarly) {
|
|
21
21
|
payload.value = newResult;
|
|
22
22
|
return payload;
|
|
23
|
-
}`;m.write("const input = payload.value;");const
|
|
24
|
-
const ${v}_present = ${
|
|
23
|
+
}`;m.write("const input = payload.value;");const I=Object.create(null);let b=0;for(const P of _.allKeys)I[P]=`key_${b++}`;m.write(s?"const newResult = memo.alloc(inst, payload, {}, ctx);":"const newResult = {};");for(const P of _.allKeys){if(P==="__proto__")continue;const v=I[P],T=typeof P=="symbol"?`syms[${x.indexOf(P)}]`:Bv(P),L=`${T} in input`,N=f[P],k=(w=N==null?void 0:N._zod)==null?void 0:w.optin,q=k!==void 0,U=((A=N==null?void 0:N._zod)==null?void 0:A.optout)==="optional";if(m.write(`const ${v} = ${p(T)};`),q&&U){const V=k==="optional"?`${v}_present`:`${v}.value !== undefined || ${v}_present`;m.write(`
|
|
24
|
+
const ${v}_present = ${L};
|
|
25
25
|
if (!${v}.issues.length || ${v}_present) {
|
|
26
26
|
if (${v}.issues.length) {${E(v,T)}
|
|
27
27
|
}
|
|
@@ -31,15 +31,15 @@ ${n.join(`
|
|
|
31
31
|
}
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
-
`)}else
|
|
34
|
+
`)}else q?(m.write(`
|
|
35
35
|
if (${v}.issues.length) {${E(v,T)}
|
|
36
36
|
}
|
|
37
37
|
`),k==="defaulted"?m.write(`newResult[${T}] = ${v}.value;`):m.write(`
|
|
38
|
-
if (${v}.value !== undefined || ${
|
|
38
|
+
if (${v}.value !== undefined || ${L}) {
|
|
39
39
|
newResult[${T}] = ${v}.value;
|
|
40
40
|
}
|
|
41
41
|
`)):m.write(`
|
|
42
|
-
const ${v}_present = ${
|
|
42
|
+
const ${v}_present = ${L};
|
|
43
43
|
if (${v}.issues.length) {${E(v,T)}
|
|
44
44
|
}
|
|
45
45
|
if (!${v}_present && !${v}.issues.length) {
|
|
@@ -59,19 +59,19 @@ ${n.join(`
|
|
|
59
59
|
newResult[${T}] = ${v}.value;
|
|
60
60
|
}
|
|
61
61
|
|
|
62
|
-
`)}return m.write("payload.value = newResult;"),m.write("return payload;"),m.compile()};let o;const a=Vr,c=!Jn.jitless,u=c&&zS.value,h=e.catchall;let d;t._zod.parse=(f,_)=>{d??(d=i.value);const x=f.value;return a(x)?c&&u&&(_==null?void 0:_.async)===!1&&_.jitless!==!0?(o||(o=r(e.shape)),f=o(f,_),h?up([],x,f,_,d,t,(_==null?void 0:_.abortEarly)===!0):f):n(f,_):(f.issues.push({expected:"object",code:"invalid_type",input:x,inst:t}),f)}});function Vd(t,e,n,i){for(const r of t)if(r.issues.length===0)return e.value=r.value,e;const s=t.filter(r=>!Ai(r));return s.length===1?(e.value=s[0].value,s[0]):(e.issues.push({code:"invalid_union",input:e.value,inst:n,errors:t.map(r=>r.issues.map(o=>Yi(o,i,Qn())))}),e)}const dp=ee("$ZodUnion",(t,e)=>{wt.init(t,e),ht(t,"optin",i=>i.def.options.some(s=>s._zod.optin==="defaulted")?"defaulted":i.def.options.some(s=>s._zod.optin!==void 0)?"optional":void 0),ht(t,"optout",i=>i.def.options.some(s=>s._zod.optout==="optional")?"optional":void 0),ht(t,"values",i=>{if(i.def.options.every(s=>s._zod.values))return new Set(i.def.options.flatMap(s=>Array.from(s._zod.values)))}),ht(t,"pattern",i=>{if(i.def.options.every(s=>s._zod.pattern)){const s=i.def.options.map(r=>r._zod.pattern);return new RegExp(`^(${s.map(r=>lu(r.source)).join("|")})$`)}});const n=e.options.length===1?e.options[0]._zod.run:null;t._zod.parse=(i,s)=>{if(n)return n(i,s);let r=!1;const o=[];for(const a of e.options){const c=a._zod.run({value:i.value,issues:[]},s);if(c instanceof Promise)o.push(c),r=!0;else{if(c.issues.length===0)return c;o.push(c)}}return r?Promise.all(o).then(a=>Vd(a,i,t,s)):Vd(o,i,t,s)}});function dx(t){var n;const e=new Map;for(const i of t.options){const s=(n=i._zod.propValues)==null?void 0:n[t.discriminator];if(!s||s.size===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(i)}"`);for(const r of s)if(e.has(r)){if(r!==void 0)throw new Error(`Duplicate discriminator value "${String(r)}"`);e.set(r,null)}else e.set(r,i)}return e}const hx=ee("$ZodDiscriminatedUnion",(t,e)=>{e.inclusive=!1,dp.init(t,e);const n=t._zod.parse;ht(t,"propValues",s=>{var a,c;const r={};let o=0;for(const l of s.def.options){const u=l._zod.propValues;if(!u||Object.keys(u).length===0)throw new Error(`Invalid discriminated union option at index "${s.def.options.indexOf(l)}"`);(a=u[s.def.discriminator])!=null&&a.has(void 0)&&o++;for(const[h,d]of Object.entries(u)){Object.prototype.hasOwnProperty.call(r,h)||gi(r,h,new Set);for(const f of d)r[h].add(f)}}return!s.def.unionFallback&&o>1&&((c=r[s.def.discriminator])==null||c.delete(void 0)),r}),e.options.forEach((s,r)=>{const o=uu(s._zod.def);if(o&&!Object.prototype.hasOwnProperty.call(o,e.discriminator))throw new Error(`Invalid discriminated union option at index "${r}"`)});const i=Pa(()=>dx(e));t._zod.parse=(s,r)=>{const o=s.value;if(!Vr(o))return s.issues.push({code:"invalid_type",expected:"object",input:o,inst:t}),s;const a=o==null?void 0:o[e.discriminator],c=i.value.get(a);return c&&(a!==void 0||r.direction!=="backward")?c._zod.run(s,r):e.unionFallback||r.direction==="backward"?n(s,r):(s.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:e.discriminator,options:Array.from(i.value.keys()).filter(l=>i.value.get(l)!==null),input:o,path:[e.discriminator],inst:t}),s)}}),fx=ee("$ZodIntersection",(t,e)=>{wt.init(t,e),t._zod.parse=(n,i)=>{const s=n.value,r=e.left._zod.run({value:s,issues:[]},i),o=e.right._zod.run({value:s,issues:[]},i);return r instanceof Promise||o instanceof Promise?Promise.all([r,o]).then(([c,l])=>Gd(n,c,l)):Gd(n,r,o)}});function sl(t,e){if(t===e)return{valid:!0,data:t};if(t instanceof Date&&e instanceof Date&&+t==+e)return{valid:!0,data:t};if(tr(t)&&tr(e)){const n=Object.keys(e),i=Object.keys(t).filter(r=>n.indexOf(r)!==-1),s={...t,...e};Object.prototype.hasOwnProperty.call(s,"__proto__")&&delete s.__proto__;for(const r of i){if(r==="__proto__")continue;const o=sl(t[r],e[r]);if(!o.valid)return{valid:!1,mergeErrorPath:[r,...o.mergeErrorPath]};s[r]=o.data}return{valid:!0,data:s}}if(Array.isArray(t)&&Array.isArray(e)){if(t.length!==e.length)return{valid:!1,mergeErrorPath:[]};const n=[];for(let i=0;i<t.length;i++){const s=t[i],r=e[i],o=sl(s,r);if(!o.valid)return{valid:!1,mergeErrorPath:[i,...o.mergeErrorPath]};n.push(o.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function Gd(t,e,n){const i=new Map;let s;const r=new Map,o=(l,u)=>{var d,f;let h;if(l.code==="unrecognized_keys"&&!((d=l.path)!=null&&d.length))s??(s=l),h=l.keys;else if(l.code==="invalid_key"&&l.origin==="record"&&((f=l.path)==null?void 0:f.length)===1){const _=String(l.path[0]);r.has(_)||r.set(_,l),h=[_]}else return!1;for(const _ of h)i.has(_)||i.set(_,{}),i.get(_)[u]=!0;return!0};for(const l of e.issues)o(l,"l")||t.issues.push(l);for(const l of n.issues)o(l,"r")||t.issues.push(l);const a=[...i].filter(([,l])=>l.l&&l.r).map(([l])=>l);if(a.length){const l=s?a.filter(u=>s.keys.includes(u)):[];l.length&&t.issues.push({...s,keys:l});for(const u of a)!l.includes(u)&&r.has(u)&&t.issues.push(r.get(u))}const c=sl(e.value,n.value);if(!c.valid){if(Ai(t))return t;throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(c.mergeErrorPath)}`)}return t.value=c.data,t}const px=ee("$ZodRecord",(t,e)=>{wt.init(t,e);const n=Jn.memoizer;n==null||n.attach(t),t._zod.parse=(i,s)=>{const r=i.value;if(!tr(r))return i.issues.push({expected:"record",code:"invalid_type",input:r,inst:t}),i;const o=[],a=e.keyType._zod.values;if(a&&!e.partial){i.value=n?n.alloc(t,i,{},s):{};const c=new Set;for(const u of a)if(typeof u=="string"||typeof u=="number"||typeof u=="symbol"){if(c.add(typeof u=="number"?u.toString():u),u==="__proto__")continue;const h=e.keyType._zod.run({value:u,issues:[]},s);if(h instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(h.issues.length){i.issues.push({code:"invalid_key",origin:"record",issues:h.issues.map(_=>Yi(_,s,Qn())),input:u,path:[u],inst:t});continue}const d=h.value;if(d==="__proto__")continue;const f=e.valueType._zod.run({value:r[u],issues:[]},s);f instanceof Promise?o.push(f.then(_=>{_.issues.length&&i.issues.push(...Gs(u,_.issues)),i.value[d]=_.value})):(f.issues.length&&i.issues.push(...Gs(u,f.issues)),i.value[d]=f.value)}let l;for(const u in r)if(!c.has(u))if(e.mode==="loose"){if(u==="__proto__")continue;i.value[u]=r[u]}else l=l??[],l.push(u);l&&l.length>0&&i.issues.push({code:"unrecognized_keys",input:r,inst:t,keys:l,continue:!0})}else{i.value=n?n.alloc(t,i,{},s):{};let c;for(const l of Reflect.ownKeys(r)){if(l==="__proto__"||!Object.prototype.propertyIsEnumerable.call(r,l))continue;let u=e.keyType._zod.run({value:l,issues:[]},s);if(u instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(typeof l=="string"&&_u.test(l)&&u.issues.length){const _=e.keyType._zod.run({value:Number(l),issues:[]},s);if(_ instanceof Promise)throw new Error("Async schemas not supported in object keys currently");_.issues.length===0&&(u=_)}if(u.issues.length){e.mode==="loose"?i.value[l]=r[l]:a?(c=c??[],c.push(l)):i.issues.push({code:"invalid_key",origin:"record",issues:u.issues.map(_=>Yi(_,s,Qn())),input:l,path:[l],inst:t});continue}const d=u.value;if(d==="__proto__")continue;const f=e.valueType._zod.run({value:r[l],issues:[]},s);f instanceof Promise?o.push(f.then(_=>{_.issues.length&&i.issues.push(...Gs(l,_.issues)),i.value[d]=_.value})):(f.issues.length&&i.issues.push(...Gs(l,f.issues)),i.value[d]=f.value)}c&&c.length>0&&i.issues.push({code:"unrecognized_keys",input:r,inst:t,keys:c,continue:!0})}return o.length?Promise.all(o).then(()=>i):i}}),mx=ee("$ZodEnum",(t,e)=>{wt.init(t,e);const n=el(e.entries),i=new Set(n);t._zod.values=i,ht(t,"pattern",s=>{const r=el(s.def.entries).filter(o=>BS.has(typeof o));return new RegExp(r.length?`^(${r.map(o=>nr(o.toString())).join("|")})$`:"^[^\\s\\S]$")}),t._zod.parse=(s,r)=>{const o=s.value;return i.has(o)||s.issues.push({code:"invalid_value",values:n,input:o,inst:t}),s}}),gx=ee("$ZodLiteral",(t,e)=>{wt.init(t,e);const n=new Set(e.values);t._zod.values=n,ht(t,"pattern",i=>{const s=i.def.values;return new RegExp(s.length?`^(${s.map(r=>typeof r=="string"?nr(r):r?nr(r.toString()):String(r)).join("|")})$`:"^[^\\s\\S]$")}),t._zod.parse=(i,s)=>{const r=i.value;return n.has(r)||i.issues.push({code:"invalid_value",values:e.values,input:r,inst:t}),i}}),_x=ee("$ZodTransform",(t,e)=>{var n;wt.init(t,e),t._zod.optin="optional",(n=Jn.memoizer)==null||n.guard(t),t._zod.parse=(i,s)=>{if(s.direction==="backward")throw new Kf(t.constructor.name);const r=e.transform(i.value,i);if(s.async)return(r instanceof Promise?r:Promise.resolve(r)).then(a=>(i.value=a,i));if(r instanceof Promise)throw new ps;return i.value=r,i}});function qd(t,e){return t.value=e.issues.length?void 0:e.value,t}const hp=ee("$ZodOptional",(t,e)=>{wt.init(t,e),ht(t,"optin",n=>n.def.innerType._zod.optin==="defaulted"?"defaulted":"optional"),t._zod.optout="optional",ht(t,"values",n=>{const i=n.def.innerType._zod.values;return i?new Set([...i,void 0]):void 0}),ht(t,"pattern",n=>{const i=n.def.innerType._zod.pattern;return i?new RegExp(`^(${lu(i.source)})?$`):void 0}),t._zod.parse=(n,i)=>{if(n.value===void 0){if(e.innerType._zod.optin!=="defaulted")return n;const s=e.innerType._zod.run({value:n.value,issues:[]},i);return s instanceof Promise?s.then(r=>qd(n,r)):qd(n,s)}return e.innerType._zod.run(n,i)}}),Sx=ee("$ZodExactOptional",(t,e)=>{hp.init(t,e),ht(t,"values",n=>n.def.innerType._zod.values),ht(t,"pattern",n=>n.def.innerType._zod.pattern),t._zod.parse=(n,i)=>e.innerType._zod.run(n,i)}),vx=ee("$ZodNullable",(t,e)=>{wt.init(t,e),ht(t,"optin",n=>n.def.innerType._zod.optin),ht(t,"optout",n=>n.def.innerType._zod.optout),ht(t,"pattern",n=>{const i=n.def.innerType._zod.pattern;return i?new RegExp(`^(${lu(i.source)}|null)$`):void 0}),ht(t,"values",n=>n.def.innerType._zod.values?new Set([...n.def.innerType._zod.values,null]):void 0),t._zod.parse=(n,i)=>n.value===null?n:e.innerType._zod.run(n,i)}),xx=ee("$ZodDefault",(t,e)=>{wt.init(t,e),t._zod.optin="defaulted",ht(t,"values",n=>n.def.innerType._zod.values),t._zod.parse=(n,i)=>{if(i.direction==="backward")return e.innerType._zod.run(n,i);if(n.value===void 0)return n.value=e.defaultValue,n;const s=e.innerType._zod.run(n,i);return s instanceof Promise?s.then(r=>$d(r,e)):$d(s,e)}});function $d(t,e){return t.value===void 0&&(t.value=e.defaultValue),t}const yx=ee("$ZodPrefault",(t,e)=>{wt.init(t,e),t._zod.optin="defaulted",ht(t,"values",n=>n.def.innerType._zod.values),t._zod.parse=(n,i)=>(i.direction==="backward"||n.value===void 0&&(n.value=e.defaultValue),e.innerType._zod.run(n,i))}),bx=ee("$ZodNonOptional",(t,e)=>{wt.init(t,e),ht(t,"values",n=>{const i=n.def.innerType._zod.values;return i?new Set([...i].filter(s=>s!==void 0)):void 0}),t._zod.parse=(n,i)=>{const s=e.innerType._zod.run(n,i);return s instanceof Promise?s.then(r=>Wd(r,t)):Wd(s,t)}});function Wd(t,e){return!t.issues.length&&t.value===void 0&&t.issues.push({code:"invalid_type",expected:"nonoptional",input:t.value,inst:e}),t}function Zd(t,e,n,i){return e.issues.length?(t.value=n.catchValue({...e,value:t.value,error:{issues:e.issues.map(s=>Yi(s,i,Qn()))},input:t.value}),t):(t.value=e.value,e.memo&&(t.memo=!0),t)}const Mx=ee("$ZodCatch",(t,e)=>{wt.init(t,e),ht(t,"optin",n=>n.def.innerType._zod.optin==="defaulted"?"defaulted":"optional"),ht(t,"optout",n=>n.def.innerType._zod.optout),ht(t,"values",n=>n.def.innerType._zod.values),t._zod.parse=(n,i)=>{if(i.direction==="backward")return e.innerType._zod.run(n,i);const s=e.innerType._zod.run({value:n.value,issues:[]},i);return s instanceof Promise?s.then(r=>Zd(n,r,e,i)):Zd(n,s,e,i)}}),fp=ee("$ZodPipe",(t,e)=>{wt.init(t,e),ht(t,"values",n=>n.def.in._zod.values),ht(t,"optin",n=>n.def.in._zod.optin),ht(t,"optout",n=>n.def.out._zod.optout),ht(t,"propValues",n=>n.def.in._zod.propValues),t._zod.parse=(n,i)=>{if(i.direction==="backward"){const r=e.out._zod.run(n,i);return r instanceof Promise?r.then(o=>ho(o,e.in,i)):ho(r,e.in,i)}const s=e.in._zod.run(n,i);return s instanceof Promise?s.then(r=>ho(r,e.out,i)):ho(s,e.out,i)}});function ho(t,e,n){return t.issues.some(i=>i.code!=="unrecognized_keys")?(t.aborted=!0,t):e._zod.run({value:t.value,issues:t.issues},n)}const Ex=ee("$ZodPreprocess",(t,e)=>{fp.init(t,e)}),Tx=ee("$ZodReadonly",(t,e)=>{wt.init(t,e),ht(t,"propValues",n=>n.def.innerType._zod.propValues),ht(t,"values",n=>n.def.innerType._zod.values),ht(t,"optin",n=>{var i,s;return(s=(i=n.def.innerType)==null?void 0:i._zod)==null?void 0:s.optin}),ht(t,"optout",n=>{var i,s;return(s=(i=n.def.innerType)==null?void 0:i._zod)==null?void 0:s.optout}),t._zod.parse=(n,i)=>{if(i.direction==="backward")return e.innerType._zod.run(n,i);const s=e.innerType._zod.run(n,i);return s instanceof Promise?s.then(Xd):Xd(s)}});function Xd(t){return t.memo||(t.value=Object.freeze(t.value)),t}const Rx=ee("$ZodLazy",(t,e)=>{wt.init(t,e),US(t._zod,"innerType",()=>{const n=e;return n._cachedInner||(n._cachedInner=e.getter()),n._cachedInner}),ht(t,"pattern",n=>{var i,s;return(s=(i=n.innerType)==null?void 0:i._zod)==null?void 0:s.pattern}),ht(t,"propValues",n=>{var i,s;return(s=(i=n.innerType)==null?void 0:i._zod)==null?void 0:s.propValues}),ht(t,"optin",n=>{var i,s;return((s=(i=n.innerType)==null?void 0:i._zod)==null?void 0:s.optin)??void 0}),ht(t,"optout",n=>{var i,s;return((s=(i=n.innerType)==null?void 0:i._zod)==null?void 0:s.optout)??void 0}),t._zod.parse=(n,i)=>t._zod.innerType._zod.run(n,i)}),wx=ee("$ZodCustom",(t,e)=>{wn.init(t,e),wt.init(t,e),t._zod.parse=(n,i)=>n,t._zod.check=n=>{const i=n.value,s=e.fn(i);if(s instanceof Promise)return s.then(r=>Yd(r,n,i,t));Yd(s,n,i,t)}});function Yd(t,e,n,i){if(!t){const s={code:"custom",input:n,inst:i,path:[...i._zod.def.path??[]],continue:!i._zod.def.abort};i._zod.def.params&&(s.params=i._zod.def.params),e.issues.push(Gr(s))}}class Ax extends Error{constructor(){super("Cannot parse a reference cycle that closes through a transform"),this.name="ZodCyclicError"}}const rl="~memo",Kd=[];function pp(t){return t!==null&&typeof t=="object"}function lc(t){return t.map(e=>e.path?{...e,path:e.path.slice()}:{...e})}const mp=new WeakMap,Cr=0,Zo=1,Nr=2;function Xo(t,e,n){const i=mp.get(t);if(i!==void 0)return i?Nr:Cr;if(e.has(t))return Nr;e.add(t);let s=Cr;const r=u=>{if(s!==Nr&&(u!=null&&u._zod)){const h=Xo(u,e);h>s&&(s=h)}},o=(u,h)=>{var f;let d=Cr;for(const _ of Reflect.ownKeys(u)){const x=Object.getOwnPropertyDescriptor(u,_);if(!x.enumerable)continue;const m=x.get?Zo:(f=x.value)!=null&&f._zod?Xo(x.value,e):Cr;m>d&&(d=m)}return d},a=u=>{u>s&&(s=u)},c=t._zod.def;switch(c.type){case"object":{const u=uu(c);a(u?o(u):Zo),r(c.catchall);break}case"array":r(c.element);break;case"tuple":for(const u of c.items)r(u);r(c.rest);break;case"record":case"map":r(c.keyType),r(c.valueType);break;case"set":r(c.valueType);break;case"union":for(const u of c.options)r(u);break;case"intersection":r(c.left),r(c.right);break;case"optional":case"nullable":case"default":case"prefault":case"catch":case"readonly":case"nonoptional":case"promise":case"success":r(c.innerType);break;case"pipe":r(c.in),r(c.out);break;case"function":r(c.input),r(c.output);break;case"lazy":{const u=c._cachedInner??void 0;a(u?Xo(u,e):Zo);break}case"template_literal":case"string":case"number":case"int":case"boolean":case"bigint":case"symbol":case"undefined":case"null":case"void":case"never":case"any":case"unknown":case"date":case"nan":case"enum":case"literal":case"file":case"transform":case"custom":break;default:for(const u in c){const h=Object.getOwnPropertyDescriptor(c,u);if(!h||h.get)continue;const d=h.value;if(!(!d||typeof d!="object")){if(d._zod)r(d);else if(Array.isArray(d))for(const f of d)r(f)}}}return e.delete(t),Cx(t,s)}function Cx(t,e){return e!==Zo&&mp.set(t,e===Nr),e}function Px(t,e){let n=t.buckets.get(e);return n||(n=new WeakMap,t.buckets.set(e,n)),n}let fo;const po=[],Ix={alloc(t,e,n){const i=fo;if(!i)return n;fo=void 0;const s={value:n,issues:null};return i.set(e.value,s),po.push(s),n},guard(t){var e;(e=t._zod).deferred??(e.deferred=[]),t._zod.deferred.push(()=>{const n=t._zod.parse,i=(s,r)=>{if(r.direction!=="backward"&&Nx(r,s.value))throw new Ax;return n(s,r)};t._zod.parse=i,t._zod.run===n&&(t._zod.run=i)})},attach(t){var e;let n,i=!1,s,r;(e=t._zod).deferred??(e.deferred=[]),t._zod.deferred.push(()=>{const o=t._zod.parse,a=(c,l)=>{if(n===void 0){const p=Xo(t,new Set);if(p===Cr)return t._zod.parse=o,t._zod.run===a&&(t._zod.run=o),o(c,l);p===Nr||i?n=!0:i=!0}const u=c.value;if(!pp(u))return o(c,l);let h=l[rl];h||(h={buckets:new WeakMap,backEdges:void 0},l[rl]=h);let d;s===l?d=r:(d=Px(h,t),s=l,r=d);const f=d.get(u);if(f)return c.value=f.value,f.issues?f.issues.length&&c.issues.push(...lc(f.issues)):(c.memo=!0,h.backEdges??(h.backEdges=new WeakSet),h.backEdges.add(f.value)),c;fo=d;const _=po.length,x=o(c,l);fo=void 0;const m=po.length>_?po.pop():void 0;return x instanceof Promise?x.then(p=>(m&&(m.issues=p.issues.length?lc(p.issues):Kd),p)):(m&&(m.issues=x.issues.length?lc(x.issues):Kd),x)};t._zod.parse=a,t._zod.run===o&&(t._zod.run=a)})}};function Lx(){return Ix}function Nx(t,e){var i;const n=(i=t[rl])==null?void 0:i.backEdges;return n!==void 0&&pp(e)&&n.has(e)}const Dx=()=>{const t={string:{unit:"characters",verb:"to have"},file:{unit:"bytes",verb:"to have"},array:{unit:"items",verb:"to have"},set:{unit:"items",verb:"to have"},map:{unit:"entries",verb:"to have"}};function e(r){return t[r]??null}const n={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",mac:"MAC address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",currency_code:"currency code",credit_card:"credit card number",iban:"IBAN",jwt:"JWT",template_literal:"input"},i={nan:"NaN"};function s(r,o){return r==="number"&&typeof o=="number"&&!Number.isFinite(o)?String(o):i[r]??r}return r=>{switch(r.code){case"invalid_type":{const o=s(r.expected),a=jS(r.input),c=s(a,r.input);return`Invalid input: expected ${o}, received ${c}`}case"invalid_value":return r.values.length===1?`Invalid input: expected ${$f(r.values[0])}`:`Invalid option: expected one of ${Ld(r.values,"|")}`;case"too_big":{const o=r.exact?"exactly ":r.inclusive?"<=":"<",a=e(r.origin);return a?`Too big: expected ${r.origin??"value"} to have ${o}${r.maximum.toString()} ${a.unit??"elements"}`:`Too big: expected ${r.origin??"value"} to be ${o}${r.maximum.toString()}`}case"too_small":{const o=r.exact?"exactly ":r.inclusive?">=":">",a=e(r.origin);return a?`Too small: expected ${r.origin} to have ${o}${r.minimum.toString()} ${a.unit}`:`Too small: expected ${r.origin} to be ${o}${r.minimum.toString()}`}case"invalid_format":{const o=r;return o.format==="starts_with"?`Invalid string: must start with "${o.prefix}"`:o.format==="ends_with"?`Invalid string: must end with "${o.suffix}"`:o.format==="includes"?`Invalid string: must include "${o.includes}"`:o.format==="regex"?`Invalid string: must match pattern ${o.pattern}`:`Invalid ${n[o.format]??r.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${r.divisor}`;case"unrecognized_keys":return`Unrecognized key${r.keys.length>1?"s":""}: ${Ld(r.keys,", ")}`;case"invalid_key":return`Invalid key in ${r.origin}`;case"invalid_union":return r.options&&Array.isArray(r.options)&&r.options.length>0?`Invalid discriminator value. Expected ${r.options.map(a=>`'${a}'`).join(" | ")}`:r.inclusive===!1?"Invalid input: more than one option matched":"Invalid input";case"invalid_element":return`Invalid value in ${r.origin}`;default:return"Invalid input"}}};function Ux(){return{localeError:Dx()}}var jd;class Ox{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...n){const i=n[0];return this._map.set(e,i),i&&typeof i=="object"&&"id"in i&&this._idmap.set(i.id,e),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){const n=this._map.get(e);return n&&typeof n=="object"&&"id"in n&&this._idmap.delete(n.id),this._map.delete(e),this}get(e){const n=e._zod.parent;if(n){const i={...this.get(n)??{}};delete i.id;const s={...i,...this._map.get(e)};return Object.keys(s).length?s:void 0}return this._map.get(e)}has(e){return this._map.has(e)}}function Fx(){return new Ox}(jd=globalThis).__zod_globalRegistry??(jd.__zod_globalRegistry=Fx());const Pr=globalThis.__zod_globalRegistry;function yu(t){return t.checks&&(t.checks=[...t.checks]),t}function kx(t,e){return new t(yu({type:"string",...Oe(e)}))}function gp(t,e){return new t({type:"string",format:"email",check:"string_format",abort:!1,...Oe(e)})}function zx(t,e){return new t({type:"string",format:"guid",check:"string_format",abort:!1,...Oe(e)})}function Bx(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,...Oe(e)})}function Hx(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...Oe(e)})}function Vx(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...Oe(e)})}function Gx(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...Oe(e)})}function _p(t,e){return new t({type:"string",format:"url",check:"string_format",abort:!1,...Oe(e)})}function qx(t,e){return new t({type:"string",format:"emoji",check:"string_format",abort:!1,...Oe(e)})}function $x(t,e){return new t({type:"string",format:"nanoid",check:"string_format",abort:!1,...Oe(e)})}function Wx(t,e){return new t({type:"string",format:"cuid",check:"string_format",abort:!1,...Oe(e)})}function Zx(t,e){return new t({type:"string",format:"cuid2",check:"string_format",abort:!1,...Oe(e)})}function Xx(t,e){return new t({type:"string",format:"ulid",check:"string_format",abort:!1,...Oe(e)})}function Yx(t,e){return new t({type:"string",format:"xid",check:"string_format",abort:!1,...Oe(e)})}function Kx(t,e){return new t({type:"string",format:"ksuid",check:"string_format",abort:!1,...Oe(e)})}function jx(t,e){return new t({type:"string",format:"ipv4",check:"string_format",abort:!1,...Oe(e)})}function Jx(t,e){return new t({type:"string",format:"ipv6",check:"string_format",abort:!1,...Oe(e)})}function Qx(t,e){return new t({type:"string",format:"cidrv4",check:"string_format",abort:!1,...Oe(e)})}function ey(t,e){return new t({type:"string",format:"cidrv6",check:"string_format",abort:!1,...Oe(e)})}function ty(t,e){return new t({type:"string",format:"base64",check:"string_format",abort:!1,...Oe(e)})}function ny(t,e){return new t({type:"string",format:"base64url",check:"string_format",abort:!1,...Oe(e)})}function iy(t,e){return new t({type:"string",format:"e164",check:"string_format",abort:!1,...Oe(e)})}function sy(t,e){return new t({type:"string",format:"jwt",check:"string_format",abort:!1,...Oe(e)})}function Sp(t,e){return new t({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...Oe(e)})}function vp(t,e){return new t({type:"string",format:"date",check:"string_format",...Oe(e)})}function ry(t,e){return new t({type:"string",format:"time",check:"string_format",precision:null,...Oe(e)})}function oy(t,e){return new t({type:"string",format:"duration",check:"string_format",...Oe(e)})}function ay(t,e){return new t(yu({type:"number",checks:[],...Oe(e)}))}function cy(t,e){return new t(yu({type:"number",coerce:!0,checks:[],...Oe(e)}))}function ly(t,e){return new t({type:"number",check:"number_format",abort:!1,format:"safeint",...Oe(e)})}function uy(t,e){return new t({type:"boolean",...Oe(e)})}function dy(t,e){return new t({type:"undefined",...Oe(e)})}function hy(t,e){return new t({type:"null",...Oe(e)})}function fy(t){return new t({type:"any"})}function py(t){return new t({type:"unknown"})}function my(t,e){return new t({type:"never",...Oe(e)})}function Jd(t,e){return new Qf({check:"less_than",...Oe(e),value:t,inclusive:!1})}function uc(t,e){return new Qf({check:"less_than",...Oe(e),value:t,inclusive:!0})}function Qd(t,e){return new ep({check:"greater_than",...Oe(e),value:t,inclusive:!1})}function dc(t,e){return new ep({check:"greater_than",...Oe(e),value:t,inclusive:!0})}function eh(t,e){return new r0({check:"multiple_of",...Oe(e),value:t})}function xp(t,e){return new a0({check:"max_length",...Oe(e),maximum:t})}function oa(t,e){return new c0({check:"min_length",...Oe(e),minimum:t})}function yp(t,e){return new l0({check:"length_equals",...Oe(e),length:t})}function gy(t,e){return new u0({check:"string_format",format:"regex",...Oe(e),pattern:t})}function _y(t){return new d0({check:"string_format",format:"lowercase",...Oe(t)})}function Sy(t){return new h0({check:"string_format",format:"uppercase",...Oe(t)})}function vy(t,e){return new f0({check:"string_format",format:"includes",...Oe(e),includes:t})}function xy(t,e){return new p0({check:"string_format",format:"starts_with",...Oe(e),prefix:t})}function yy(t,e){return new m0({check:"string_format",format:"ends_with",...Oe(e),suffix:t})}function cr(t){return new g0({check:"overwrite",tx:t})}function by(t){return cr(e=>e.normalize(t))}function My(){return cr(t=>t.trim())}function Ey(){return cr(t=>t.toLowerCase())}function Ty(){return cr(t=>t.toUpperCase())}function Ry(){return cr(t=>kS(t))}function wy(t,e,n){return new t({type:"array",element:e,...Oe(n)})}function Ay(t,e,n){return new t({type:"custom",check:"custom",fn:e,...Oe(n)})}function Cy(t,e){const n=Py(i=>(i.addIssue=s=>{if(typeof s=="string")i.issues.push(Gr(s,i.value,n._zod.def));else{const r=s;r.fatal&&(r.continue=!1),r.code??(r.code="custom"),"input"in r||(r.input=i.value),r.inst??(r.inst=n),r.continue??(r.continue=!n._zod.def.abort),i.issues.push(Gr(r))}},t(i.value,i)),e);return n}function Py(t,e){const n=new wn({check:"custom",...Oe(e)});return n._zod.check=t,n}function Dr(t,...e){for(const n of e)for(const i of Reflect.ownKeys(n))Object.prototype.propertyIsEnumerable.call(n,i)&&gi(t,i,n[i]);return t}function aa(t){let e=(t==null?void 0:t.target)??"draft-2020-12";return e==="draft-4"&&(e="draft-04"),e==="draft-7"&&(e="draft-07"),{processors:t.processors??{},metadataRegistry:(t==null?void 0:t.metadata)??Pr,target:e,unrepresentable:(t==null?void 0:t.unrepresentable)??"throw",override:(t==null?void 0:t.override)??(()=>{}),io:(t==null?void 0:t.io)??"output",counter:0,seen:new Map,sharedDefsExtractedFor:void 0,sharedEmitDoneFor:void 0,cycles:(t==null?void 0:t.cycles)??"ref",reused:(t==null?void 0:t.reused)??"inline",intersections:[],deferred:[],external:(t==null?void 0:t.external)??void 0}}function an(t,e,n,i,s){const r=typeof e.unrepresentable=="function"?e.unrepresentable({zodSchema:t,path:i.path,message:s}):e.unrepresentable;if(r==="any")return!1;if(r===void 0||r==="throw")throw new Error(s);return Object.assign(n,r),!0}function It(t,e,n={path:[],schemaPath:[]}){var u,h;var i;const s=t._zod.def,r=e.seen.get(t);if(r)return r.count++,n.schemaPath.includes(t)&&(r.cycle=n.path),r.schema;const o={schema:{},count:1,cycle:void 0,path:n.path};e.seen.set(t,o),e.sharedDefsExtractedFor=void 0,e.sharedEmitDoneFor=void 0;const a=(h=(u=t._zod).toJSONSchema)==null?void 0:h.call(u);if(a)o.schema=a;else{const d={...n,schemaPath:[...n.schemaPath,t],path:n.path};if(t._zod.processJSONSchema)t._zod.processJSONSchema(e,o.schema,d);else{const _=o.schema,x=e.processors[s.type];if(!x)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${s.type}`);x(t,e,_,d)}const f=t._zod.parent;f&&(o.ref||(o.ref=f),It(f,e,d),e.seen.get(f).isParent=!0)}const c=e.metadataRegistry.get(t);return c&&Dr(o.schema,c),e.io==="input"&&_n(t)&&(delete o.schema.examples,delete o.schema.default),e.io==="input"&&"_prefault"in o.schema&&((i=o.schema).default??(i.default=o.schema._prefault)),delete o.schema._prefault,e.seen.get(t).schema}function th(t){return t.replace(/~/g,"~0").replace(/\//g,"~1")}function ca(t,e){var o,a,c,l;const n=t.seen.get(e);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");if(t.external&&t.sharedDefsExtractedFor===t.external)return;const i=new Map;for(const u of t.seen.entries()){const h=(o=t.metadataRegistry.get(u[0]))==null?void 0:o.id;if(h){const d=i.get(h);if(d&&d!==u[0])throw new Error(`Duplicate schema id "${h}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);i.set(h,u[0])}}const s=u=>{var x;const h=t.target==="draft-2020-12"?"$defs":"definitions";if(t.external){const m=(x=t.external.registry.get(u[0]))==null?void 0:x.id,p=t.external.uri??(L=>L);if(m)return{ref:p(m)};const E=u[1].defId??u[1].schema.id??`schema${t.counter++}`;return u[1].defId=E,{defId:E,ref:`${p("__shared")}#/${h}/${th(E)}`}}const d="#",f=`${d}/${h}/`;if(u[1]===n&&!u[1].schema.id)return{ref:d};const _=u[1].schema.id??`__schema${t.counter++}`;return{defId:_,ref:f+th(_)}},r=u=>{if(u[1].schema.$ref)return;const h=u[1],{ref:d,defId:f}=s(u);h.def={...h.schema},f&&(h.defId=f);const _=h.schema;for(const x in _)delete _[x];_.$ref=d};if(t.cycles==="throw")for(const u of t.seen.entries()){const h=u[1];if(h.cycle)throw new Error(`Cycle detected: #/${(a=h.cycle)==null?void 0:a.join("/")}/<root>
|
|
62
|
+
`)}return m.write("payload.value = newResult;"),m.write("return payload;"),m.compile()};let o;const a=eo,c=!ni.jitless,u=c&&Vv.value,h=e.catchall;let d;t._zod.parse=(f,_)=>{d??(d=i.value);const x=f.value;return a(x)?c&&u&&(_==null?void 0:_.async)===!1&&_.jitless!==!0?(o||(o=r(e.shape)),f=o(f,_),h?Kp([],x,f,_,d,t,(_==null?void 0:_.abortEarly)===!0):f):n(f,_):(f.issues.push({expected:"object",code:"invalid_type",input:x,inst:t}),f)}});function Mh(t,e,n,i){for(const r of t)if(r.issues.length===0)return e.value=r.value,e;const s=t.filter(r=>!Di(r));return s.length===1?(e.value=s[0].value,s[0]):(e.issues.push({code:"invalid_union",input:e.value,inst:n,errors:t.map(r=>r.issues.map(o=>os(o,i,ii())))}),e)}const jp=ee("$ZodUnion",(t,e)=>{Ct.init(t,e),pt(t,"optin",i=>i.def.options.some(s=>s._zod.optin==="defaulted")?"defaulted":i.def.options.some(s=>s._zod.optin!==void 0)?"optional":void 0),pt(t,"optout",i=>i.def.options.some(s=>s._zod.optout==="optional")?"optional":void 0),pt(t,"values",i=>{if(i.def.options.every(s=>s._zod.values))return new Set(i.def.options.flatMap(s=>Array.from(s._zod.values)))}),pt(t,"pattern",i=>{if(i.def.options.every(s=>s._zod.pattern)){const s=i.def.options.map(r=>r._zod.pattern);return new RegExp(`^(${s.map(r=>Du(r.source)).join("|")})$`)}});const n=e.options.length===1?e.options[0]._zod.run:null;t._zod.parse=(i,s)=>{if(n)return n(i,s);let r=!1;const o=[];for(const a of e.options){const c=a._zod.run({value:i.value,issues:[]},s);if(c instanceof Promise)o.push(c),r=!0;else{if(c.issues.length===0)return c;o.push(c)}}return r?Promise.all(o).then(a=>Mh(a,i,t,s)):Mh(o,i,t,s)}});function py(t){var n;const e=new Map;for(const i of t.options){const s=(n=i._zod.propValues)==null?void 0:n[t.discriminator];if(!s||s.size===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(i)}"`);for(const r of s)if(e.has(r)){if(r!==void 0)throw new Error(`Duplicate discriminator value "${String(r)}"`);e.set(r,null)}else e.set(r,i)}return e}const my=ee("$ZodDiscriminatedUnion",(t,e)=>{e.inclusive=!1,jp.init(t,e);const n=t._zod.parse;pt(t,"propValues",s=>{var a,c;const r={};let o=0;for(const l of s.def.options){const u=l._zod.propValues;if(!u||Object.keys(u).length===0)throw new Error(`Invalid discriminated union option at index "${s.def.options.indexOf(l)}"`);(a=u[s.def.discriminator])!=null&&a.has(void 0)&&o++;for(const[h,d]of Object.entries(u)){Object.prototype.hasOwnProperty.call(r,h)||bi(r,h,new Set);for(const f of d)r[h].add(f)}}return!s.def.unionFallback&&o>1&&((c=r[s.def.discriminator])==null||c.delete(void 0)),r}),e.options.forEach((s,r)=>{const o=Uu(s._zod.def);if(o&&!Object.prototype.hasOwnProperty.call(o,e.discriminator))throw new Error(`Invalid discriminated union option at index "${r}"`)});const i=Ga(()=>py(e));t._zod.parse=(s,r)=>{const o=s.value;if(!eo(o))return s.issues.push({code:"invalid_type",expected:"object",input:o,inst:t}),s;const a=o==null?void 0:o[e.discriminator],c=i.value.get(a);return c&&(a!==void 0||r.direction!=="backward")?c._zod.run(s,r):e.unionFallback||r.direction==="backward"?n(s,r):(s.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:e.discriminator,options:Array.from(i.value.keys()).filter(l=>i.value.get(l)!==null),input:o,path:[e.discriminator],inst:t}),s)}}),gy=ee("$ZodIntersection",(t,e)=>{Ct.init(t,e),t._zod.parse=(n,i)=>{const s=n.value,r=e.left._zod.run({value:s,issues:[]},i),o=e.right._zod.run({value:s,issues:[]},i);return r instanceof Promise||o instanceof Promise?Promise.all([r,o]).then(([c,l])=>Eh(n,c,l)):Eh(n,r,o)}});function Tl(t,e){if(t===e)return{valid:!0,data:t};if(t instanceof Date&&e instanceof Date&&+t==+e)return{valid:!0,data:t};if(pr(t)&&pr(e)){const n=Object.keys(e),i=Object.keys(t).filter(r=>n.indexOf(r)!==-1),s={...t,...e};Object.prototype.hasOwnProperty.call(s,"__proto__")&&delete s.__proto__;for(const r of i){if(r==="__proto__")continue;const o=Tl(t[r],e[r]);if(!o.valid)return{valid:!1,mergeErrorPath:[r,...o.mergeErrorPath]};s[r]=o.data}return{valid:!0,data:s}}if(Array.isArray(t)&&Array.isArray(e)){if(t.length!==e.length)return{valid:!1,mergeErrorPath:[]};const n=[];for(let i=0;i<t.length;i++){const s=t[i],r=e[i],o=Tl(s,r);if(!o.valid)return{valid:!1,mergeErrorPath:[i,...o.mergeErrorPath]};n.push(o.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function Eh(t,e,n){const i=new Map;let s;const r=new Map,o=(l,u)=>{var d,f;let h;if(l.code==="unrecognized_keys"&&!((d=l.path)!=null&&d.length))s??(s=l),h=l.keys;else if(l.code==="invalid_key"&&l.origin==="record"&&((f=l.path)==null?void 0:f.length)===1){const _=String(l.path[0]);r.has(_)||r.set(_,l),h=[_]}else return!1;for(const _ of h)i.has(_)||i.set(_,{}),i.get(_)[u]=!0;return!0};for(const l of e.issues)o(l,"l")||t.issues.push(l);for(const l of n.issues)o(l,"r")||t.issues.push(l);const a=[...i].filter(([,l])=>l.l&&l.r).map(([l])=>l);if(a.length){const l=s?a.filter(u=>s.keys.includes(u)):[];l.length&&t.issues.push({...s,keys:l});for(const u of a)!l.includes(u)&&r.has(u)&&t.issues.push(r.get(u))}const c=Tl(e.value,n.value);if(!c.valid){if(Di(t))return t;throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(c.mergeErrorPath)}`)}return t.value=c.data,t}const _y=ee("$ZodRecord",(t,e)=>{Ct.init(t,e);const n=ni.memoizer;n==null||n.attach(t),t._zod.parse=(i,s)=>{const r=i.value;if(!pr(r))return i.issues.push({expected:"record",code:"invalid_type",input:r,inst:t}),i;const o=[],a=e.keyType._zod.values;if(a&&!e.partial){i.value=n?n.alloc(t,i,{},s):{};const c=new Set;for(const u of a)if(typeof u=="string"||typeof u=="number"||typeof u=="symbol"){if(c.add(typeof u=="number"?u.toString():u),u==="__proto__")continue;const h=e.keyType._zod.run({value:u,issues:[]},s);if(h instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(h.issues.length){i.issues.push({code:"invalid_key",origin:"record",issues:h.issues.map(_=>os(_,s,ii())),input:u,path:[u],inst:t});continue}const d=h.value;if(d==="__proto__")continue;const f=e.valueType._zod.run({value:r[u],issues:[]},s);f instanceof Promise?o.push(f.then(_=>{_.issues.length&&i.issues.push(...tr(u,_.issues)),i.value[d]=_.value})):(f.issues.length&&i.issues.push(...tr(u,f.issues)),i.value[d]=f.value)}let l;for(const u in r)if(!c.has(u))if(e.mode==="loose"){if(u==="__proto__")continue;i.value[u]=r[u]}else l=l??[],l.push(u);l&&l.length>0&&i.issues.push({code:"unrecognized_keys",input:r,inst:t,keys:l,continue:!0})}else{i.value=n?n.alloc(t,i,{},s):{};let c;for(const l of Reflect.ownKeys(r)){if(l==="__proto__"||!Object.prototype.propertyIsEnumerable.call(r,l))continue;let u=e.keyType._zod.run({value:l,issues:[]},s);if(u instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(typeof l=="string"&&Vu.test(l)&&u.issues.length){const _=e.keyType._zod.run({value:Number(l),issues:[]},s);if(_ instanceof Promise)throw new Error("Async schemas not supported in object keys currently");_.issues.length===0&&(u=_)}if(u.issues.length){e.mode==="loose"?i.value[l]=r[l]:a?(c=c??[],c.push(l)):i.issues.push({code:"invalid_key",origin:"record",issues:u.issues.map(_=>os(_,s,ii())),input:l,path:[l],inst:t});continue}const d=u.value;if(d==="__proto__")continue;const f=e.valueType._zod.run({value:r[l],issues:[]},s);f instanceof Promise?o.push(f.then(_=>{_.issues.length&&i.issues.push(...tr(l,_.issues)),i.value[d]=_.value})):(f.issues.length&&i.issues.push(...tr(l,f.issues)),i.value[d]=f.value)}c&&c.length>0&&i.issues.push({code:"unrecognized_keys",input:r,inst:t,keys:c,continue:!0})}return o.length?Promise.all(o).then(()=>i):i}}),Sy=ee("$ZodEnum",(t,e)=>{Ct.init(t,e);const n=yl(e.entries),i=new Set(n);t._zod.values=i,pt(t,"pattern",s=>{const r=yl(s.def.entries).filter(o=>Gv.has(typeof o));return new RegExp(r.length?`^(${r.map(o=>mr(o.toString())).join("|")})$`:"^[^\\s\\S]$")}),t._zod.parse=(s,r)=>{const o=s.value;return i.has(o)||s.issues.push({code:"invalid_value",values:n,input:o,inst:t}),s}}),vy=ee("$ZodLiteral",(t,e)=>{Ct.init(t,e);const n=new Set(e.values);t._zod.values=n,pt(t,"pattern",i=>{const s=i.def.values;return new RegExp(s.length?`^(${s.map(r=>typeof r=="string"?mr(r):r?mr(r.toString()):String(r)).join("|")})$`:"^[^\\s\\S]$")}),t._zod.parse=(i,s)=>{const r=i.value;return n.has(r)||i.issues.push({code:"invalid_value",values:e.values,input:r,inst:t}),i}}),xy=ee("$ZodTransform",(t,e)=>{var n;Ct.init(t,e),t._zod.optin="optional",(n=ni.memoizer)==null||n.guard(t),t._zod.parse=(i,s)=>{if(s.direction==="backward")throw new Op(t.constructor.name);const r=e.transform(i.value,i);if(s.async)return(r instanceof Promise?r:Promise.resolve(r)).then(a=>(i.value=a,i));if(r instanceof Promise)throw new Ms;return i.value=r,i}});function Th(t,e){return t.value=e.issues.length?void 0:e.value,t}const Jp=ee("$ZodOptional",(t,e)=>{Ct.init(t,e),pt(t,"optin",n=>n.def.innerType._zod.optin==="defaulted"?"defaulted":"optional"),t._zod.optout="optional",pt(t,"values",n=>{const i=n.def.innerType._zod.values;return i?new Set([...i,void 0]):void 0}),pt(t,"pattern",n=>{const i=n.def.innerType._zod.pattern;return i?new RegExp(`^(${Du(i.source)})?$`):void 0}),t._zod.parse=(n,i)=>{if(n.value===void 0){if(e.innerType._zod.optin!=="defaulted")return n;const s=e.innerType._zod.run({value:n.value,issues:[]},i);return s instanceof Promise?s.then(r=>Th(n,r)):Th(n,s)}return e.innerType._zod.run(n,i)}}),yy=ee("$ZodExactOptional",(t,e)=>{Jp.init(t,e),pt(t,"values",n=>n.def.innerType._zod.values),pt(t,"pattern",n=>n.def.innerType._zod.pattern),t._zod.parse=(n,i)=>e.innerType._zod.run(n,i)}),by=ee("$ZodNullable",(t,e)=>{Ct.init(t,e),pt(t,"optin",n=>n.def.innerType._zod.optin),pt(t,"optout",n=>n.def.innerType._zod.optout),pt(t,"pattern",n=>{const i=n.def.innerType._zod.pattern;return i?new RegExp(`^(${Du(i.source)}|null)$`):void 0}),pt(t,"values",n=>n.def.innerType._zod.values?new Set([...n.def.innerType._zod.values,null]):void 0),t._zod.parse=(n,i)=>n.value===null?n:e.innerType._zod.run(n,i)}),My=ee("$ZodDefault",(t,e)=>{Ct.init(t,e),t._zod.optin="defaulted",pt(t,"values",n=>n.def.innerType._zod.values),t._zod.parse=(n,i)=>{if(i.direction==="backward")return e.innerType._zod.run(n,i);if(n.value===void 0)return n.value=e.defaultValue,n;const s=e.innerType._zod.run(n,i);return s instanceof Promise?s.then(r=>Rh(r,e)):Rh(s,e)}});function Rh(t,e){return t.value===void 0&&(t.value=e.defaultValue),t}const Ey=ee("$ZodPrefault",(t,e)=>{Ct.init(t,e),t._zod.optin="defaulted",pt(t,"values",n=>n.def.innerType._zod.values),t._zod.parse=(n,i)=>(i.direction==="backward"||n.value===void 0&&(n.value=e.defaultValue),e.innerType._zod.run(n,i))}),Ty=ee("$ZodNonOptional",(t,e)=>{Ct.init(t,e),pt(t,"values",n=>{const i=n.def.innerType._zod.values;return i?new Set([...i].filter(s=>s!==void 0)):void 0}),t._zod.parse=(n,i)=>{const s=e.innerType._zod.run(n,i);return s instanceof Promise?s.then(r=>wh(r,t)):wh(s,t)}});function wh(t,e){return!t.issues.length&&t.value===void 0&&t.issues.push({code:"invalid_type",expected:"nonoptional",input:t.value,inst:e}),t}function Ah(t,e,n,i){return e.issues.length?(t.value=n.catchValue({...e,value:t.value,error:{issues:e.issues.map(s=>os(s,i,ii()))},input:t.value}),t):(t.value=e.value,e.memo&&(t.memo=!0),t)}const Ry=ee("$ZodCatch",(t,e)=>{Ct.init(t,e),pt(t,"optin",n=>n.def.innerType._zod.optin==="defaulted"?"defaulted":"optional"),pt(t,"optout",n=>n.def.innerType._zod.optout),pt(t,"values",n=>n.def.innerType._zod.values),t._zod.parse=(n,i)=>{if(i.direction==="backward")return e.innerType._zod.run(n,i);const s=e.innerType._zod.run({value:n.value,issues:[]},i);return s instanceof Promise?s.then(r=>Ah(n,r,e,i)):Ah(n,s,e,i)}}),Qp=ee("$ZodPipe",(t,e)=>{Ct.init(t,e),pt(t,"values",n=>n.def.in._zod.values),pt(t,"optin",n=>n.def.in._zod.optin),pt(t,"optout",n=>n.def.out._zod.optout),pt(t,"propValues",n=>n.def.in._zod.propValues),t._zod.parse=(n,i)=>{if(i.direction==="backward"){const r=e.out._zod.run(n,i);return r instanceof Promise?r.then(o=>bo(o,e.in,i)):bo(r,e.in,i)}const s=e.in._zod.run(n,i);return s instanceof Promise?s.then(r=>bo(r,e.out,i)):bo(s,e.out,i)}});function bo(t,e,n){return t.issues.some(i=>i.code!=="unrecognized_keys")?(t.aborted=!0,t):e._zod.run({value:t.value,issues:t.issues},n)}const wy=ee("$ZodPreprocess",(t,e)=>{Qp.init(t,e)}),Ay=ee("$ZodReadonly",(t,e)=>{Ct.init(t,e),pt(t,"propValues",n=>n.def.innerType._zod.propValues),pt(t,"values",n=>n.def.innerType._zod.values),pt(t,"optin",n=>{var i,s;return(s=(i=n.def.innerType)==null?void 0:i._zod)==null?void 0:s.optin}),pt(t,"optout",n=>{var i,s;return(s=(i=n.def.innerType)==null?void 0:i._zod)==null?void 0:s.optout}),t._zod.parse=(n,i)=>{if(i.direction==="backward")return e.innerType._zod.run(n,i);const s=e.innerType._zod.run(n,i);return s instanceof Promise?s.then(Ch):Ch(s)}});function Ch(t){return t.memo||(t.value=Object.freeze(t.value)),t}const Cy=ee("$ZodLazy",(t,e)=>{Ct.init(t,e),kv(t._zod,"innerType",()=>{const n=e;return n._cachedInner||(n._cachedInner=e.getter()),n._cachedInner}),pt(t,"pattern",n=>{var i,s;return(s=(i=n.innerType)==null?void 0:i._zod)==null?void 0:s.pattern}),pt(t,"propValues",n=>{var i,s;return(s=(i=n.innerType)==null?void 0:i._zod)==null?void 0:s.propValues}),pt(t,"optin",n=>{var i,s;return((s=(i=n.innerType)==null?void 0:i._zod)==null?void 0:s.optin)??void 0}),pt(t,"optout",n=>{var i,s;return((s=(i=n.innerType)==null?void 0:i._zod)==null?void 0:s.optout)??void 0}),t._zod.parse=(n,i)=>t._zod.innerType._zod.run(n,i)}),Py=ee("$ZodCustom",(t,e)=>{Pn.init(t,e),Ct.init(t,e),t._zod.parse=(n,i)=>n,t._zod.check=n=>{const i=n.value,s=e.fn(i);if(s instanceof Promise)return s.then(r=>Ph(r,n,i,t));Ph(s,n,i,t)}});function Ph(t,e,n,i){if(!t){const s={code:"custom",input:n,inst:i,path:[...i._zod.def.path??[]],continue:!i._zod.def.abort};i._zod.def.params&&(s.params=i._zod.def.params),e.issues.push(to(s))}}class Ly extends Error{constructor(){super("Cannot parse a reference cycle that closes through a transform"),this.name="ZodCyclicError"}}const Rl="~memo",Lh=[];function em(t){return t!==null&&typeof t=="object"}function Cc(t){return t.map(e=>e.path?{...e,path:e.path.slice()}:{...e})}const tm=new WeakMap,Vr=0,sa=1,Wr=2;function ra(t,e,n){const i=tm.get(t);if(i!==void 0)return i?Wr:Vr;if(e.has(t))return Wr;e.add(t);let s=Vr;const r=u=>{if(s!==Wr&&(u!=null&&u._zod)){const h=ra(u,e);h>s&&(s=h)}},o=(u,h)=>{var f;let d=Vr;for(const _ of Reflect.ownKeys(u)){const x=Object.getOwnPropertyDescriptor(u,_);if(!x.enumerable)continue;const m=x.get?sa:(f=x.value)!=null&&f._zod?ra(x.value,e):Vr;m>d&&(d=m)}return d},a=u=>{u>s&&(s=u)},c=t._zod.def;switch(c.type){case"object":{const u=Uu(c);a(u?o(u):sa),r(c.catchall);break}case"array":r(c.element);break;case"tuple":for(const u of c.items)r(u);r(c.rest);break;case"record":case"map":r(c.keyType),r(c.valueType);break;case"set":r(c.valueType);break;case"union":for(const u of c.options)r(u);break;case"intersection":r(c.left),r(c.right);break;case"optional":case"nullable":case"default":case"prefault":case"catch":case"readonly":case"nonoptional":case"promise":case"success":r(c.innerType);break;case"pipe":r(c.in),r(c.out);break;case"function":r(c.input),r(c.output);break;case"lazy":{const u=c._cachedInner??void 0;a(u?ra(u,e):sa);break}case"template_literal":case"string":case"number":case"int":case"boolean":case"bigint":case"symbol":case"undefined":case"null":case"void":case"never":case"any":case"unknown":case"date":case"nan":case"enum":case"literal":case"file":case"transform":case"custom":break;default:for(const u in c){const h=Object.getOwnPropertyDescriptor(c,u);if(!h||h.get)continue;const d=h.value;if(!(!d||typeof d!="object")){if(d._zod)r(d);else if(Array.isArray(d))for(const f of d)r(f)}}}return e.delete(t),Iy(t,s)}function Iy(t,e){return e!==sa&&tm.set(t,e===Wr),e}function Ny(t,e){let n=t.buckets.get(e);return n||(n=new WeakMap,t.buckets.set(e,n)),n}let Mo;const Eo=[],Dy={alloc(t,e,n){const i=Mo;if(!i)return n;Mo=void 0;const s={value:n,issues:null};return i.set(e.value,s),Eo.push(s),n},guard(t){var e;(e=t._zod).deferred??(e.deferred=[]),t._zod.deferred.push(()=>{const n=t._zod.parse,i=(s,r)=>{if(r.direction!=="backward"&&Oy(r,s.value))throw new Ly;return n(s,r)};t._zod.parse=i,t._zod.run===n&&(t._zod.run=i)})},attach(t){var e;let n,i=!1,s,r;(e=t._zod).deferred??(e.deferred=[]),t._zod.deferred.push(()=>{const o=t._zod.parse,a=(c,l)=>{if(n===void 0){const p=ra(t,new Set);if(p===Vr)return t._zod.parse=o,t._zod.run===a&&(t._zod.run=o),o(c,l);p===Wr||i?n=!0:i=!0}const u=c.value;if(!em(u))return o(c,l);let h=l[Rl];h||(h={buckets:new WeakMap,backEdges:void 0},l[Rl]=h);let d;s===l?d=r:(d=Ny(h,t),s=l,r=d);const f=d.get(u);if(f)return c.value=f.value,f.issues?f.issues.length&&c.issues.push(...Cc(f.issues)):(c.memo=!0,h.backEdges??(h.backEdges=new WeakSet),h.backEdges.add(f.value)),c;Mo=d;const _=Eo.length,x=o(c,l);Mo=void 0;const m=Eo.length>_?Eo.pop():void 0;return x instanceof Promise?x.then(p=>(m&&(m.issues=p.issues.length?Cc(p.issues):Lh),p)):(m&&(m.issues=x.issues.length?Cc(x.issues):Lh),x)};t._zod.parse=a,t._zod.run===o&&(t._zod.run=a)})}};function Uy(){return Dy}function Oy(t,e){var i;const n=(i=t[Rl])==null?void 0:i.backEdges;return n!==void 0&&em(e)&&n.has(e)}const Fy=()=>{const t={string:{unit:"characters",verb:"to have"},file:{unit:"bytes",verb:"to have"},array:{unit:"items",verb:"to have"},set:{unit:"items",verb:"to have"},map:{unit:"entries",verb:"to have"}};function e(r){return t[r]??null}const n={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",mac:"MAC address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",currency_code:"currency code",credit_card:"credit card number",iban:"IBAN",jwt:"JWT",template_literal:"input"},i={nan:"NaN"};function s(r,o){return r==="number"&&typeof o=="number"&&!Number.isFinite(o)?String(o):i[r]??r}return r=>{switch(r.code){case"invalid_type":{const o=s(r.expected),a=e0(r.input),c=s(a,r.input);return`Invalid input: expected ${o}, received ${c}`}case"invalid_value":return r.values.length===1?`Invalid input: expected ${Lp(r.values[0])}`:`Invalid option: expected one of ${fh(r.values,"|")}`;case"too_big":{const o=r.exact?"exactly ":r.inclusive?"<=":"<",a=e(r.origin);return a?`Too big: expected ${r.origin??"value"} to have ${o}${r.maximum.toString()} ${a.unit??"elements"}`:`Too big: expected ${r.origin??"value"} to be ${o}${r.maximum.toString()}`}case"too_small":{const o=r.exact?"exactly ":r.inclusive?">=":">",a=e(r.origin);return a?`Too small: expected ${r.origin} to have ${o}${r.minimum.toString()} ${a.unit}`:`Too small: expected ${r.origin} to be ${o}${r.minimum.toString()}`}case"invalid_format":{const o=r;return o.format==="starts_with"?`Invalid string: must start with "${o.prefix}"`:o.format==="ends_with"?`Invalid string: must end with "${o.suffix}"`:o.format==="includes"?`Invalid string: must include "${o.includes}"`:o.format==="regex"?`Invalid string: must match pattern ${o.pattern}`:`Invalid ${n[o.format]??r.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${r.divisor}`;case"unrecognized_keys":return`Unrecognized key${r.keys.length>1?"s":""}: ${fh(r.keys,", ")}`;case"invalid_key":return`Invalid key in ${r.origin}`;case"invalid_union":return r.options&&Array.isArray(r.options)&&r.options.length>0?`Invalid discriminator value. Expected ${r.options.map(a=>`'${a}'`).join(" | ")}`:r.inclusive===!1?"Invalid input: more than one option matched":"Invalid input";case"invalid_element":return`Invalid value in ${r.origin}`;default:return"Invalid input"}}};function ky(){return{localeError:Fy()}}var Ih;class zy{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...n){const i=n[0];return this._map.set(e,i),i&&typeof i=="object"&&"id"in i&&this._idmap.set(i.id,e),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){const n=this._map.get(e);return n&&typeof n=="object"&&"id"in n&&this._idmap.delete(n.id),this._map.delete(e),this}get(e){const n=e._zod.parent;if(n){const i={...this.get(n)??{}};delete i.id;const s={...i,...this._map.get(e)};return Object.keys(s).length?s:void 0}return this._map.get(e)}has(e){return this._map.has(e)}}function By(){return new zy}(Ih=globalThis).__zod_globalRegistry??(Ih.__zod_globalRegistry=By());const Gr=globalThis.__zod_globalRegistry;function Wu(t){return t.checks&&(t.checks=[...t.checks]),t}function Hy(t,e){return new t(Wu({type:"string",...Oe(e)}))}function nm(t,e){return new t({type:"string",format:"email",check:"string_format",abort:!1,...Oe(e)})}function Vy(t,e){return new t({type:"string",format:"guid",check:"string_format",abort:!1,...Oe(e)})}function Gy(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,...Oe(e)})}function $y(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...Oe(e)})}function qy(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...Oe(e)})}function Wy(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...Oe(e)})}function im(t,e){return new t({type:"string",format:"url",check:"string_format",abort:!1,...Oe(e)})}function Zy(t,e){return new t({type:"string",format:"emoji",check:"string_format",abort:!1,...Oe(e)})}function Xy(t,e){return new t({type:"string",format:"nanoid",check:"string_format",abort:!1,...Oe(e)})}function Yy(t,e){return new t({type:"string",format:"cuid",check:"string_format",abort:!1,...Oe(e)})}function Ky(t,e){return new t({type:"string",format:"cuid2",check:"string_format",abort:!1,...Oe(e)})}function jy(t,e){return new t({type:"string",format:"ulid",check:"string_format",abort:!1,...Oe(e)})}function Jy(t,e){return new t({type:"string",format:"xid",check:"string_format",abort:!1,...Oe(e)})}function Qy(t,e){return new t({type:"string",format:"ksuid",check:"string_format",abort:!1,...Oe(e)})}function eb(t,e){return new t({type:"string",format:"ipv4",check:"string_format",abort:!1,...Oe(e)})}function tb(t,e){return new t({type:"string",format:"ipv6",check:"string_format",abort:!1,...Oe(e)})}function nb(t,e){return new t({type:"string",format:"cidrv4",check:"string_format",abort:!1,...Oe(e)})}function ib(t,e){return new t({type:"string",format:"cidrv6",check:"string_format",abort:!1,...Oe(e)})}function sb(t,e){return new t({type:"string",format:"base64",check:"string_format",abort:!1,...Oe(e)})}function rb(t,e){return new t({type:"string",format:"base64url",check:"string_format",abort:!1,...Oe(e)})}function ob(t,e){return new t({type:"string",format:"e164",check:"string_format",abort:!1,...Oe(e)})}function ab(t,e){return new t({type:"string",format:"jwt",check:"string_format",abort:!1,...Oe(e)})}function sm(t,e){return new t({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...Oe(e)})}function rm(t,e){return new t({type:"string",format:"date",check:"string_format",...Oe(e)})}function cb(t,e){return new t({type:"string",format:"time",check:"string_format",precision:null,...Oe(e)})}function lb(t,e){return new t({type:"string",format:"duration",check:"string_format",...Oe(e)})}function ub(t,e){return new t(Wu({type:"number",checks:[],...Oe(e)}))}function db(t,e){return new t(Wu({type:"number",coerce:!0,checks:[],...Oe(e)}))}function hb(t,e){return new t({type:"number",check:"number_format",abort:!1,format:"safeint",...Oe(e)})}function fb(t,e){return new t({type:"boolean",...Oe(e)})}function pb(t,e){return new t({type:"undefined",...Oe(e)})}function mb(t,e){return new t({type:"null",...Oe(e)})}function gb(t){return new t({type:"any"})}function _b(t){return new t({type:"unknown"})}function Sb(t,e){return new t({type:"never",...Oe(e)})}function Nh(t,e){return new zp({check:"less_than",...Oe(e),value:t,inclusive:!1})}function Pc(t,e){return new zp({check:"less_than",...Oe(e),value:t,inclusive:!0})}function Dh(t,e){return new Bp({check:"greater_than",...Oe(e),value:t,inclusive:!1})}function Lc(t,e){return new Bp({check:"greater_than",...Oe(e),value:t,inclusive:!0})}function Uh(t,e){return new cx({check:"multiple_of",...Oe(e),value:t})}function om(t,e){return new ux({check:"max_length",...Oe(e),maximum:t})}function _a(t,e){return new dx({check:"min_length",...Oe(e),minimum:t})}function am(t,e){return new hx({check:"length_equals",...Oe(e),length:t})}function vb(t,e){return new fx({check:"string_format",format:"regex",...Oe(e),pattern:t})}function xb(t){return new px({check:"string_format",format:"lowercase",...Oe(t)})}function yb(t){return new mx({check:"string_format",format:"uppercase",...Oe(t)})}function bb(t,e){return new gx({check:"string_format",format:"includes",...Oe(e),includes:t})}function Mb(t,e){return new _x({check:"string_format",format:"starts_with",...Oe(e),prefix:t})}function Eb(t,e){return new Sx({check:"string_format",format:"ends_with",...Oe(e),suffix:t})}function br(t){return new vx({check:"overwrite",tx:t})}function Tb(t){return br(e=>e.normalize(t))}function Rb(){return br(t=>t.trim())}function wb(){return br(t=>t.toLowerCase())}function Ab(){return br(t=>t.toUpperCase())}function Cb(){return br(t=>Hv(t))}function Pb(t,e,n){return new t({type:"array",element:e,...Oe(n)})}function Lb(t,e,n){return new t({type:"custom",check:"custom",fn:e,...Oe(n)})}function Ib(t,e){const n=Nb(i=>(i.addIssue=s=>{if(typeof s=="string")i.issues.push(to(s,i.value,n._zod.def));else{const r=s;r.fatal&&(r.continue=!1),r.code??(r.code="custom"),"input"in r||(r.input=i.value),r.inst??(r.inst=n),r.continue??(r.continue=!n._zod.def.abort),i.issues.push(to(r))}},t(i.value,i)),e);return n}function Nb(t,e){const n=new Pn({check:"custom",...Oe(e)});return n._zod.check=t,n}function Zr(t,...e){for(const n of e)for(const i of Reflect.ownKeys(n))Object.prototype.propertyIsEnumerable.call(n,i)&&bi(t,i,n[i]);return t}function Sa(t){let e=(t==null?void 0:t.target)??"draft-2020-12";return e==="draft-4"&&(e="draft-04"),e==="draft-7"&&(e="draft-07"),{processors:t.processors??{},metadataRegistry:(t==null?void 0:t.metadata)??Gr,target:e,unrepresentable:(t==null?void 0:t.unrepresentable)??"throw",override:(t==null?void 0:t.override)??(()=>{}),io:(t==null?void 0:t.io)??"output",counter:0,seen:new Map,sharedDefsExtractedFor:void 0,sharedEmitDoneFor:void 0,cycles:(t==null?void 0:t.cycles)??"ref",reused:(t==null?void 0:t.reused)??"inline",intersections:[],deferred:[],external:(t==null?void 0:t.external)??void 0}}function un(t,e,n,i,s){const r=typeof e.unrepresentable=="function"?e.unrepresentable({zodSchema:t,path:i.path,message:s}):e.unrepresentable;if(r==="any")return!1;if(r===void 0||r==="throw")throw new Error(s);return Object.assign(n,r),!0}function Nt(t,e,n={path:[],schemaPath:[]}){var u,h;var i;const s=t._zod.def,r=e.seen.get(t);if(r)return r.count++,n.schemaPath.includes(t)&&(r.cycle=n.path),r.schema;const o={schema:{},count:1,cycle:void 0,path:n.path};e.seen.set(t,o),e.sharedDefsExtractedFor=void 0,e.sharedEmitDoneFor=void 0;const a=(h=(u=t._zod).toJSONSchema)==null?void 0:h.call(u);if(a)o.schema=a;else{const d={...n,schemaPath:[...n.schemaPath,t],path:n.path};if(t._zod.processJSONSchema)t._zod.processJSONSchema(e,o.schema,d);else{const _=o.schema,x=e.processors[s.type];if(!x)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${s.type}`);x(t,e,_,d)}const f=t._zod.parent;f&&(o.ref||(o.ref=f),Nt(f,e,d),e.seen.get(f).isParent=!0)}const c=e.metadataRegistry.get(t);return c&&Zr(o.schema,c),e.io==="input"&&xn(t)&&(delete o.schema.examples,delete o.schema.default),e.io==="input"&&"_prefault"in o.schema&&((i=o.schema).default??(i.default=o.schema._prefault)),delete o.schema._prefault,e.seen.get(t).schema}function Oh(t){return t.replace(/~/g,"~0").replace(/\//g,"~1")}function va(t,e){var o,a,c,l;const n=t.seen.get(e);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");if(t.external&&t.sharedDefsExtractedFor===t.external)return;const i=new Map;for(const u of t.seen.entries()){const h=(o=t.metadataRegistry.get(u[0]))==null?void 0:o.id;if(h){const d=i.get(h);if(d&&d!==u[0])throw new Error(`Duplicate schema id "${h}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);i.set(h,u[0])}}const s=u=>{var x;const h=t.target==="draft-2020-12"?"$defs":"definitions";if(t.external){const m=(x=t.external.registry.get(u[0]))==null?void 0:x.id,p=t.external.uri??(I=>I);if(m)return{ref:p(m)};const E=u[1].defId??u[1].schema.id??`schema${t.counter++}`;return u[1].defId=E,{defId:E,ref:`${p("__shared")}#/${h}/${Oh(E)}`}}const d="#",f=`${d}/${h}/`;if(u[1]===n&&!u[1].schema.id)return{ref:d};const _=u[1].schema.id??`__schema${t.counter++}`;return{defId:_,ref:f+Oh(_)}},r=u=>{if(u[1].schema.$ref)return;const h=u[1],{ref:d,defId:f}=s(u);h.def={...h.schema},f&&(h.defId=f);const _=h.schema;for(const x in _)delete _[x];_.$ref=d};if(t.cycles==="throw")for(const u of t.seen.entries()){const h=u[1];if(h.cycle)throw new Error(`Cycle detected: #/${(a=h.cycle)==null?void 0:a.join("/")}/<root>
|
|
63
63
|
|
|
64
|
-
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const u of t.seen.entries()){const h=u[1];if(e===u[0]){r(u);continue}if(t.external){const f=(c=t.external.registry.get(u[0]))==null?void 0:c.id;if(e!==u[0]&&f){r(u);continue}}if((l=t.metadataRegistry.get(u[0]))==null?void 0:l.id){r(u);continue}if(h.cycle){r(u);continue}h.count>1&&t.reused==="ref"&&r(u)}t.external&&(t.sharedDefsExtractedFor=t.external)}function bp(t){const e=t.anyOf;if(!Array.isArray(e)||e.length===0||t.type!==void 0)return;const n=[];for(const i of e){if(!i||typeof i!="object")return;bp(i);const s=Object.keys(i);if(s.length!==1||s[0]!=="type")return;const r=i.type;for(const o of Array.isArray(r)?r:[r]){if(typeof o!="string")return;n.includes(o)||n.push(o)}}delete t.anyOf,t.type=n.length===1?n[0]:n}const Mp=new Set(["type","properties","required","additionalProperties"]),nh=["oneOf","anyOf"];function ih(t){const e=t.additionalProperties;return e===void 0||e===!1||typeof e!="object"||e===null?null:Object.keys(e).length?e:null}function ol(t){var r;const e=[];for(const o of t){if(typeof o!="object"||o.type!=="object")return null;for(const a in o)if(!Mp.has(a))return null;e.push(o)}const n={},i=new Set;for(const o of e){for(const a in o.properties){if(Object.prototype.hasOwnProperty.call(n,a))continue;const c=[];for(const u of e){const h=((r=u.properties)==null?void 0:r[a])??ih(u);h!=null&&(c.some(d=>JSON.stringify(d)===JSON.stringify(h))||c.push(h))}const l=c.length===1?c[0]:ol(c)??{allOf:c};gi(n,a,l)}for(const a of o.required??[])i.add(a)}const s={type:"object",properties:n};if(i.size&&(s.required=[...i]),e.every(o=>o.additionalProperties===!1))s.additionalProperties=!1;else{const o=[];for(const a of e){const c=ih(a);c&&!o.some(l=>JSON.stringify(l)===JSON.stringify(c))&&o.push(c)}o.length===1?s.additionalProperties=o[0]:o.length>1&&(s.additionalProperties={allOf:o})}return s}function Iy(t){const e=t.allOf;if(!Array.isArray(e)||e.length<2)return;for(const s of Mp)if(s in t)return;const n=e.filter(s=>nh.some(r=>Array.isArray(s[r])));let i=null;if(!n.length)i=ol(e);else{const s=n[0],r=nh.find(c=>Array.isArray(s[c]));if(Object.keys(s).length!==1)return;const o=e.filter(c=>c!==s),a=s[r].map(c=>ol([...o,c]));if(a.some(c=>!c))return;i={[r]:a}}i&&(delete t.allOf,Dr(t,i))}function la(t,e){var a,c,l,u;const n=t.seen.get(e);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");const i=h=>{const d=t.seen.get(h);if(d.ref===null)return;const f=d.def??d.schema,_={...f},x=d.ref;if(d.ref=null,x){i(x);const p=t.seen.get(x),E=p.schema;if(E.$ref&&(t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0")?(f.allOf=f.allOf??[],f.allOf.push(E)):Dr(f,E),Dr(f,_),h._zod.parent===x)for(const b in f)b==="$ref"||b==="allOf"||b in _||delete f[b];if(E.$ref&&p.def)for(const b in f)b==="$ref"||b==="allOf"||b in p.def&&JSON.stringify(f[b])===JSON.stringify(p.def[b])&&delete f[b]}const m=h._zod.parent;if(m&&m!==x){i(m);const p=t.seen.get(m);if(p!=null&&p.schema.$ref&&(f.$ref=p.schema.$ref,p.def))for(const E in f)E==="$ref"||E==="allOf"||E in p.def&&JSON.stringify(f[E])===JSON.stringify(p.def[E])&&delete f[E]}t.override({zodSchema:h,jsonSchema:f,path:d.path??[]})};if(!t.external||t.sharedEmitDoneFor!==t.external){for(const h of[...t.seen.entries()].reverse())i(h[0]);if(t.target!=="openapi-3.0")for(const h of t.seen.entries())bp(h[1].def??h[1].schema);for(const h of t.deferred)h();if(t.intersections.length){const h=new Map;for(const d of t.seen.values())for(const f of[d.schema,d.def]){const _=f==null?void 0:f.allOf;if(!Array.isArray(_))continue;const x=h.get(_);x?x.push(f):h.set(_,[f])}for(const d of t.intersections)for(const f of h.get(d)??[])Iy(f)}}const s={};if(t.target==="draft-2020-12"?s.$schema="https://json-schema.org/draft/2020-12/schema":t.target==="draft-07"?s.$schema="http://json-schema.org/draft-07/schema#":t.target==="draft-04"?s.$schema="http://json-schema.org/draft-04/schema#":t.target,(a=t.external)!=null&&a.uri){const h=(c=t.external.registry.get(e))==null?void 0:c.id;if(!h)throw new Error("Schema is missing an `id` property");s.$id=t.external.uri(h)}Dr(s,n.defId?n.schema:n.def??n.schema);const r=(l=t.metadataRegistry.get(e))==null?void 0:l.id;r!==void 0&&s.id===r&&delete s.id;const o=((u=t.external)==null?void 0:u.defs)??{};if(!t.external||t.sharedEmitDoneFor!==t.external)for(const h of t.seen.entries()){const d=h[1];d.def&&d.defId&&(d.def.id===d.defId&&delete d.def.id,gi(o,d.defId,d.def))}t.external&&(t.sharedEmitDoneFor=t.external),t.external||Object.keys(o).length>0&&(t.target==="draft-2020-12"?s.$defs=o:s.definitions=o);try{const h=JSON.parse(JSON.stringify(s));return Object.defineProperty(h,"~standard",{value:{...e["~standard"],jsonSchema:{input:ua(e,"input",t.processors),output:ua(e,"output",t.processors)}},enumerable:!1,writable:!1}),h}catch{throw new Error("Error converting schema to JSON.")}}function _n(t,e){const n=e??{seen:new Set};if(n.seen.has(t))return!1;n.seen.add(t);const i=t._zod.def;if(i.type==="transform")return!0;if(i.type==="array")return _n(i.element,n);if(i.type==="set")return _n(i.valueType,n);if(i.type==="lazy")return _n(i.getter(),n);if(i.type==="promise"||i.type==="optional"||i.type==="nonoptional"||i.type==="nullable"||i.type==="readonly"||i.type==="default"||i.type==="prefault"||i.type==="catch")return _n(i.innerType,n);if(i.type==="intersection")return _n(i.left,n)||_n(i.right,n);if(i.type==="record"||i.type==="map")return _n(i.keyType,n)||_n(i.valueType,n);if(i.type==="pipe")return t._zod.traits.has("$ZodCodec")?!0:_n(i.in,n)||_n(i.out,n);if(i.type==="object"){for(const s in i.shape)if(_n(i.shape[s],n))return!0;return!1}if(i.type==="union"){for(const s of i.options)if(_n(s,n))return!0;return!1}if(i.type==="tuple"){for(const s of i.items)if(_n(s,n))return!0;return!!(i.rest&&_n(i.rest,n))}return!1}const Ly=(t,e={})=>n=>{const i=aa({...n,processors:e});return It(t,i),ca(i,t),la(i,t)},ua=(t,e,n={})=>i=>{const{libraryOptions:s,target:r}=i??{},o=aa({...s??{},target:r,io:e,processors:n});return It(t,o),ca(o,t),la(o,t)},ir=(t,e,n)=>{(t[e]===void 0||n>t[e])&&(t[e]=n)},sr=(t,e,n)=>{(t[e]===void 0||n<t[e])&&(t[e]=n)},sh=(t,e)=>{ir(t,"minimum",e),sr(t,"maximum",e)},Ep=(t,e)=>{t.multipleOf??(t.multipleOf=[]),t.multipleOf.includes(e)||t.multipleOf.push(e)},Tp=(t,e)=>{t.patterns??(t.patterns=new Set),t.patterns.add(e)},Rp=(t,e)=>{t.mime=t.mime?t.mime.filter(n=>e.includes(n)):[...e]},wp=(t,e)=>{t.format=e,e.includes("int")&&(t.isInt=!0)},rh=(t,e)=>ir(t,"minimum",e.minimum),oh=(t,e)=>sr(t,"maximum",e.maximum),ah=t=>(e,n)=>{wp(e,n.format);const[i,s]=t[n.format];ir(e,"minimum",i),sr(e,"maximum",s)},hc={greater_than:(t,e)=>ir(t,e.inclusive?"minimum":"exclusiveMinimum",e.value),less_than:(t,e)=>sr(t,e.inclusive?"maximum":"exclusiveMaximum",e.value),multiple_of:(t,e)=>Ep(t,e.value),number_format:ah(Wf),bigint_format:ah(VS),min_length:rh,max_length:oh,length_equals:(t,e)=>sh(t,e.length),min_size:rh,max_size:oh,size_equals:(t,e)=>sh(t,e.size),string_format:(t,e)=>{wp(t,e.format),e.pattern&&Tp(t,e.pattern),(e.format==="base64"||e.format==="base64url")&&(t.contentEncoding=e.format),(e.local||e.precision===-1)&&(t.laxFormat=!0)},mime_type:(t,e)=>Rp(t,e.mime)};function Un(t){var r;const e={},n=t._zod.def,i=t._zod.traits.has("$ZodCheck")?[t,...n.checks??[]]:n.checks??[];for(const o of i)(r=hc[o._zod.def.check])==null||r.call(hc,e,o._zod.def);const s=t._zod.bag;s.minimum!==void 0&&ir(e,"minimum",s.minimum),s.exclusiveMinimum!==void 0&&ir(e,"exclusiveMinimum",s.exclusiveMinimum),s.maximum!==void 0&&sr(e,"maximum",s.maximum),s.exclusiveMaximum!==void 0&&sr(e,"exclusiveMaximum",s.exclusiveMaximum),s.multipleOf!==void 0&&Ep(e,s.multipleOf),s.format!==void 0&&(e.format??(e.format=s.format),s.format.includes("int")&&(e.isInt=!0)),s.mime&&Rp(e,s.mime);for(const o of s.patterns??[])Tp(e,o);return e}const Ny={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},Dy=new Map([[ap,qv],[xu,$v]]),Ap=t=>Dy.get(t)??t,Cp=(t,e,n,i)=>{const s=n;s.type="string";const{minimum:r,maximum:o,format:a,patterns:c,contentEncoding:l,laxFormat:u}=Un(t);if(typeof r=="number"&&(s.minLength=r),typeof o=="number"&&(s.maxLength=o),a&&(s.format=Ny[a]??a,s.format===""&&delete s.format,(a==="time"||u)&&delete s.format),l&&(s.contentEncoding=l),c&&c.size>0){const h=[...c].map(Ap);h.length===1?s.pattern=h[0].source:h.length>1&&(s.allOf=[...h.map(d=>({...e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0"?{type:"string"}:{},pattern:d.source}))])}},Pp=(t,e,n,i)=>{const s=n,{minimum:r,maximum:o,multipleOf:a,exclusiveMaximum:c,exclusiveMinimum:l,isInt:u}=Un(t);s.type=u?"integer":"number";const h=typeof l=="number"&&l>=(r??Number.NEGATIVE_INFINITY),d=typeof c=="number"&&c<=(o??Number.POSITIVE_INFINITY),f=e.target==="draft-04"||e.target==="openapi-3.0";if(h?f?(s.minimum=l,s.exclusiveMinimum=!0):s.exclusiveMinimum=l:typeof r=="number"&&(s.minimum=r),d?f?(s.maximum=c,s.exclusiveMaximum=!0):s.exclusiveMaximum=c:typeof o=="number"&&(s.maximum=o),a){const _=new Set;for(const p of a)Number.isFinite(p)&&p!==0?_.add(Math.abs(p)):an(t,e,s,i,`A multipleOf divisor of ${p} cannot be represented in JSON Schema`);const[x,...m]=_;x!==void 0&&(s.multipleOf=x),m.length&&(s.allOf=[...s.allOf??[],...m.map(p=>({multipleOf:p}))])}},Ip=(t,e,n,i)=>{n.type="boolean"},Uy=(t,e,n,i)=>{an(t,e,n,i,"BigInt cannot be represented in JSON Schema")},Oy=(t,e,n,i)=>{an(t,e,n,i,"Symbols cannot be represented in JSON Schema")},Lp=(t,e,n,i)=>{e.target==="openapi-3.0"?(n.type="string",n.nullable=!0,n.enum=[null]):n.type="null"},Np=(t,e,n,i)=>{an(t,e,n,i,"Undefined cannot be represented in JSON Schema")},Fy=(t,e,n,i)=>{an(t,e,n,i,"Void cannot be represented in JSON Schema")},Dp=(t,e,n,i)=>{n.not={}},Up=(t,e,n,i)=>{},Op=(t,e,n,i)=>{},ky=(t,e,n,i)=>{an(t,e,n,i,"Date cannot be represented in JSON Schema")},Fp=(t,e,n,i)=>{const s=t._zod.def,r=el(s.entries);if(r.length===0){n.not={};return}r.every(o=>typeof o=="number")&&(n.type="number"),r.every(o=>typeof o=="string")&&(n.type="string"),n.enum=r},kp=(t,e,n,i)=>{const s=t._zod.def;if(s.values.length===0){n.not={};return}const r=[];for(const o of s.values)if(o===void 0){if(an(t,e,n,i,"Literal `undefined` cannot be represented in JSON Schema"))return}else if(typeof o=="bigint"){if(an(t,e,n,i,"BigInt literals cannot be represented in JSON Schema"))return;r.push(Number(o))}else r.push(o);if(r.length!==0)if(r.length===1){const o=r[0];n.type=o===null?"null":typeof o,e.target==="draft-04"||e.target==="openapi-3.0"?n.enum=[o]:n.const=o}else r.every(o=>typeof o=="number")&&(n.type="number"),r.every(o=>typeof o=="string")&&(n.type="string"),r.every(o=>typeof o=="boolean")&&(n.type="boolean"),r.every(o=>o===null)&&(n.type="null"),n.enum=r},zy=(t,e,n,i)=>{an(t,e,n,i,"NaN cannot be represented in JSON Schema")},By=(t,e,n,i)=>{const s=n,r=t._zod.pattern;if(!r)throw new Error("Pattern not found in template literal");s.type="string",s.pattern=r.source},Hy=(t,e,n,i)=>{const s=n;s.type="string",s.format="binary",s.contentEncoding="binary";const{minimum:r,maximum:o,mime:a}=Un(t);r!==void 0&&(s.minLength=r),o!==void 0&&(s.maxLength=o),a&&(a.length===0?s.not={}:a.length===1?s.contentMediaType=a[0]:s.anyOf=a.map(c=>({contentMediaType:c})))},Vy=(t,e,n,i)=>{n.type="boolean"},zp=(t,e,n,i)=>{an(t,e,n,i,"Custom types cannot be represented in JSON Schema")},Gy=(t,e,n,i)=>{an(t,e,n,i,"Function types cannot be represented in JSON Schema")},Bp=(t,e,n,i)=>{an(t,e,n,i,"Transforms cannot be represented in JSON Schema")},qy=(t,e,n,i)=>{an(t,e,n,i,"Map cannot be represented in JSON Schema")},$y=(t,e,n,i)=>{an(t,e,n,i,"Set cannot be represented in JSON Schema")},Hp=(t,e,n,i)=>{const s=n,r=t._zod.def,{minimum:o,maximum:a}=Un(t);typeof o=="number"&&(s.minItems=o),typeof a=="number"&&(s.maxItems=a),s.type="array",s.items=It(r.element,e,{...i,path:[...i.path,"items"]})};function qr(t){const e=t._zod.def;return e.type==="pipe"&&e.in._zod.traits.has("$ZodTransform")?qr(e.out):e.type==="catch"?qr(e.innerType):t._zod.optin}const Vp=(t,e,n,i)=>{var l;const s=n,r=t._zod.def,o=r.shape;if(Object.getOwnPropertySymbols(o).length&&an(t,e,s,i,"Symbol keys cannot be represented in JSON Schema"))return;s.type="object",s.properties={};for(const u in o)gi(s.properties,u,It(o[u],e,{...i,path:[...i.path,"properties",u]}));const c=[];for(const u of Object.keys(o)){const h=r.shape[u];(e.io==="input"?qr(h)===void 0:h._zod.optout===void 0)&&c.push(u)}c.length>0&&(s.required=c),((l=r.catchall)==null?void 0:l._zod.def.type)==="never"?s.additionalProperties=!1:r.catchall?r.catchall&&(s.additionalProperties=It(r.catchall,e,{...i,path:[...i.path,"additionalProperties"]})):e.io==="output"&&(s.additionalProperties=!1)},Gp=(t,e,n,i)=>{const s=t._zod.def,r=s.inclusive===!1,o=s.options.map((a,c)=>It(a,e,{...i,path:[...i.path,r?"oneOf":"anyOf",c]}));r?n.oneOf=o:n.anyOf=o},qp=(t,e,n,i)=>{const s=t._zod.def,r=It(s.left,e,{...i,path:[...i.path,"allOf",0]}),o=It(s.right,e,{...i,path:[...i.path,"allOf",1]}),a=l=>"allOf"in l&&Object.keys(l).length===1,c=[...a(r)?r.allOf:[r],...a(o)?o.allOf:[o]];n.allOf=c,e.intersections.push(c)},Wy=(t,e,n,i)=>{const s=n,r=t._zod.def;s.type="array";const o=e.target==="draft-2020-12"?"prefixItems":"items",a=e.target==="draft-2020-12"||e.target==="openapi-3.0"?"items":"additionalItems",c=r.items.map((x,m)=>It(x,e,{...i,path:[...i.path,o,m]})),l=r.rest?It(r.rest,e,{...i,path:[...i.path,a,...e.target==="openapi-3.0"?[r.items.length]:[]]}):null;let u=r.items.length;for(;u>0;){const x=r.items[u-1];if(!(e.io==="input"?qr(x)!==void 0:x._zod.optout==="optional"))break;u--}const h=r.items.length,d=!r.rest;e.target==="draft-2020-12"?(s.prefixItems=c,d?s.items=!1:l&&(s.items=l),u>0&&(s.minItems=u),d&&(s.maxItems=h)):e.target==="openapi-3.0"?(s.items={anyOf:c},l&&s.items.anyOf.push(l),u>0&&(s.minItems=u),d&&(s.maxItems=h)):(s.items=c,d?s.additionalItems=!1:l&&(s.additionalItems=l),u>0&&(s.minItems=u),d&&(s.maxItems=h));const{minimum:f,maximum:_}=Un(t);typeof f=="number"&&(s.minItems=f),typeof _=="number"&&(s.maxItems=_)};function al(t,e,n){var _;if(e.$ref){if(n.has(e))return e;n.add(e);const x=(_=t.get(e))==null?void 0:_.def;if(!x)return e;const m=al(t,x,n);return m===x?e:m}for(const x of["anyOf","oneOf"]){const m=e[x];if(!Array.isArray(m))continue;const p=m.map(E=>al(t,E,n));p.some((E,L)=>E!==m[L])&&(e={...e,[x]:p})}const i=Array.isArray(e.type)?e.type:[e.type],s=!i.includes("string")&&i.some(x=>x==="number"||x==="integer"),r=e.enum??(e.const!==void 0?[e.const]:void 0);if(!s&&!(r!=null&&r.some(x=>typeof x=="number")))return e;const{minimum:o,maximum:a,exclusiveMinimum:c,exclusiveMaximum:l,multipleOf:u,format:h,id:d,...f}=e;return f.enum?f.enum=f.enum.map(x=>typeof x=="number"?String(x):x):typeof f.const=="number"&&(f.const=String(f.const)),s&&(f.type="string",r||(f.pattern=(i.includes("number")?_u:Qv).source)),f}const cl=new WeakMap;function Zy(t){var i;const e=new Map;for(const s of t.seen.values())s.def&&!e.has(s.schema)&&e.set(s.schema,s);const n=new Map;for(const s of cl.get(t)??[]){const r=t.seen.get(s),o=(i=(r==null?void 0:r.def)??(r==null?void 0:r.schema))==null?void 0:i.propertyNames;if(!o||o===!0||n.has(o))continue;const a=al(e,o,new Set);a!==o&&n.set(o,a)}if(n.size)for(const s of t.seen.values())for(const r of[s.schema,s.def]){const o=r&&n.get(r.propertyNames);o&&(r.propertyNames=o)}}const $p=(t,e,n,i)=>{const s=n,r=t._zod.def;s.type="object";const o=r.keyType,a=Un(o).patterns;if(r.mode==="loose"&&a&&a.size>0){const u=It(r.valueType,e,{...i,path:[...i.path,"patternProperties","*"]});s.patternProperties={};for(const h of a)gi(s.patternProperties,Ap(h).source,u)}else{if(e.target==="draft-07"||e.target==="draft-2020-12"){s.propertyNames=It(r.keyType,e,{...i,path:[...i.path,"propertyNames"]});let u=cl.get(e);u||(u=[],cl.set(e,u),e.deferred.push(()=>Zy(e))),u.push(t)}s.additionalProperties=It(r.valueType,e,{...i,path:[...i.path,"additionalProperties"]})}const c=o._zod.values,l=e.io==="input"&&qr(r.valueType)!==void 0;if(c&&!r.partial&&!l){const u=[...c].filter(h=>typeof h=="string"||typeof h=="number");u.length>0&&(s.required=u.map(String))}},Wp=(t,e,n,i)=>{const s=t._zod.def,r=It(s.innerType,e,i),o=e.seen.get(t);e.target==="openapi-3.0"?(o.ref=s.innerType,n.nullable=!0):n.anyOf=[r,{type:"null"}]},Zp=(t,e,n,i)=>{const s=t._zod.def;It(s.innerType,e,i);const r=e.seen.get(t);r.ref=s.innerType},bu=Symbol();function Xp(t,e,n,i,s){let r=!1;const o=JSON.stringify(t,(a,c)=>typeof c!="bigint"?c:(r=!0,null));return r?(an(e,n,i,s,"BigInt defaults cannot be represented in JSON Schema"),bu):JSON.parse(o)}const Yp=(t,e,n,i)=>{const s=t._zod.def;It(s.innerType,e,i);const r=e.seen.get(t);r.ref=s.innerType;const o=Xp(s.defaultValue,t,e,n,i);o!==bu&&(n.default=o)},Kp=(t,e,n,i)=>{const s=t._zod.def;It(s.innerType,e,i);const r=e.seen.get(t);if(r.ref=s.innerType,e.io!=="input")return;const o=Xp(s.defaultValue,t,e,n,i);o!==bu&&(n._prefault=o)},jp=(t,e,n,i)=>{const s=t._zod.def;It(s.innerType,e,i);const r=e.seen.get(t);r.ref=s.innerType;let o;try{o=s.catchValue(void 0)}catch{an(t,e,n,i,"Dynamic catch values are not supported in JSON Schema");return}n.default=o},Jp=(t,e,n,i)=>{const s=t._zod.def,r=s.in._zod.traits.has("$ZodTransform"),o=e.io==="input"?r?s.out:s.in:s.out;It(o,e,i);const a=e.seen.get(t);a.ref=o},Qp=(t,e,n,i)=>{const s=t._zod.def;It(s.innerType,e,i);const r=e.seen.get(t);r.ref=s.innerType,n.readOnly=!0},Xy=(t,e,n,i)=>{const s=t._zod.def;It(s.innerType,e,i);const r=e.seen.get(t);r.ref=s.innerType},Mu=(t,e,n,i)=>{const s=t._zod.def;It(s.innerType,e,i);const r=e.seen.get(t);r.ref=s.innerType},em=(t,e,n,i)=>{const s=t._zod.innerType;It(s,e,i);const r=e.seen.get(t);r.ref=s},ch={string:Cp,number:Pp,boolean:Ip,bigint:Uy,symbol:Oy,null:Lp,undefined:Np,void:Fy,never:Dp,any:Up,unknown:Op,date:ky,enum:Fp,literal:kp,nan:zy,template_literal:By,file:Hy,success:Vy,custom:zp,function:Gy,transform:Bp,map:qy,set:$y,array:Hp,object:Vp,union:Gp,intersection:qp,tuple:Wy,record:$p,nullable:Wp,nonoptional:Zp,default:Yp,prefault:Kp,catch:jp,pipe:Jp,readonly:Qp,promise:Xy,optional:Mu,lazy:em};function tm(t,e){if("_idmap"in t){const i=t,s=aa({...e,processors:ch}),r={};for(const c of i._idmap.entries()){const[l,u]=c;It(u,s)}const o={},a={registry:i,uri:e==null?void 0:e.uri,defs:r};s.external=a;for(const c of i._idmap.entries()){const[l,u]=c;ca(s,u),gi(o,l,la(s,u))}if(Object.keys(r).length>0){const c=s.target==="draft-2020-12"?"$defs":"definitions";o.__shared={[c]:r}}return{schemas:o}}const n=aa({...e,processors:ch});return It(t,n),ca(n,t),la(n,t)}const lh=new WeakSet([Object.prototype,Error.prototype]);function mo(t,e,n){Object.defineProperty(t,e,{configurable:!0,enumerable:!1,get(){const i=n(this);return Object.defineProperty(this,e,{value:i,configurable:!0,writable:!0}),i},set(i){Object.defineProperty(this,e,{value:i,configurable:!0,writable:!0})}})}const Yy=(t,e)=>{dv.init(t,e),t.name="ZodError";const n=Object.getPrototypeOf(t);lh.has(n)||(lh.add(n),mo(n,"format",i=>s=>pv(i,s)),mo(n,"flatten",i=>s=>fv(i,s)),mo(n,"addIssue",i=>s=>{i.issues.push(s),i.message=JSON.stringify(i.issues,tl,2)}),mo(n,"addIssues",i=>s=>{i.issues.push(...s),i.message=JSON.stringify(i.issues,tl,2)}),Object.defineProperty(n,"isEmpty",{configurable:!0,enumerable:!1,get(){return this.issues.length===0}}))},Gn=ee("ZodError",Yy,void 0,{Parent:Error}),Ky=fu(Gn),jy=pu(Gn),nm=mu(Gn),Jy=gu(Gn),Qy=xv(Gn),eb=yv(Gn),tb=bv(Gn),nb=Mv(Gn),ib=Ev(Gn),sb=Tv(Gn),rb=Rv(Gn),ob=wv(Gn);function ab(){Jn.localeError||Qn(Ux())}function Da(){Jn.memoizer||Qn({memoizer:Lx()})}const At=ee("ZodType",(t,e)=>(ab(),wt.init(t,e),t.def=e,t.type=e.type,t),{check(...t){const e=this.def;return this.clone(Dn(e,{checks:[...e.checks??[],...t.map(n=>typeof n=="function"?{_zod:{check:n,def:{check:"custom"},onattach:[]}}:n)]}),{parent:!0})},with(...t){return this.check(...t)},clone(t,e){return Ji(this,t,e)},brand(){return this},register(t,e){return t.add(this,e),this},refine(t,e){return this.check(eM(t,e))},superRefine(t,e){return this.check(tM(t,e))},overwrite(t){return this.check(cr(t))},optional(){return ze(this)},exactOptional(){return Bb(this)},nullable(){return hh(this)},nullish(){return ze(hh(this))},nonoptional(t){return Wb(this,t)},array(){return G(this)},or(t){return Se([this,t])},and(t){return _s(this,t)},transform(t){return fh(this,dm(t))},default(t){return Gb(this,t)},prefault(t){return $b(this,t)},catch(t){return Xb(this,t)},pipe(t){return fh(this,t)},readonly(){return jb(this)},describe(t){const e=this.clone();return Pr.add(e,{description:t}),e},meta(...t){if(t.length===0)return Pr.get(this);const e=this.clone();return Pr.add(e,t[0]),e},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(t,...e){return e.length===0?t(this):t(this,...e)},get"~standard"(){return Xf(this,"~standard",{...np(this),jsonSchema:{input:ua(this,"input"),output:ua(this,"output")}})},set"~standard"(t){Ki(this,"~standard",t)},parse:function t(e,n){return Ky(this,e,n,{callee:t})},parseAsync:async function t(e,n){return await jy(this,e,n,{callee:t})},safeParse(t,e){return nm(this,t,e)},async safeParseAsync(t,e){return Jy(this,t,e)},get spa(){return this==null?void 0:this.safeParseAsync},set spa(t){Ki(this,"spa",t)},validate(t,e){return _v(this,t,e)},validateAsync(t,e){return vv(this,t,e)},encode:function t(e,n){return Qy(this,e,n,{callee:t})},decode:function t(e,n){return eb(this,e,n,{callee:t})},encodeAsync:async function t(e,n){return await tb(this,e,n,{callee:t})},decodeAsync:async function t(e,n){return await nb(this,e,n,{callee:t})},safeEncode(t,e){return ib(this,t,e)},safeDecode(t,e){return sb(this,t,e)},async safeEncodeAsync(t,e){return rb(this,t,e)},async safeDecodeAsync(t,e){return ob(this,t,e)},toJSONSchema(t){return Ly(this,{})(t)},get description(){var t;return(t=Pr.get(this))==null?void 0:t.description},get _def(){return this._zod.def}}),im=ee("_ZodString",(t,e)=>{vu.init(t,e),At.init(t,e),t._zod.processJSONSchema=(n,i,s)=>Cp(t,n,i)},Yf({format:t=>Un(t).format??null,minLength:t=>Un(t).minimum??null,maxLength:t=>Un(t).maximum??null},{regex(...t){return this.check(gy(...t))},includes(...t){return this.check(vy(...t))},startsWith(...t){return this.check(xy(...t))},endsWith(...t){return this.check(yy(...t))},min(...t){return this.check(oa(...t))},max(...t){return this.check(xp(...t))},length(...t){return this.check(yp(...t))},nonempty(...t){return this.check(oa(1,...t))},lowercase(t){return this.check(_y(t))},uppercase(t){return this.check(Sy(t))},trim(){return this.check(My())},normalize(...t){return this.check(by(...t))},toLowerCase(){return this.check(Ey())},toUpperCase(){return this.check(Ty())},slugify(){return this.check(Ry())}})),cb=ee("ZodString",(t,e)=>{vu.init(t,e),im.init(t,e)},{email(t){return this.check(gp(om,t))},url(t){return this.check(_p(am,t))},jwt(t){return this.check(sy(wb,t))},emoji(t){return this.check(qx(fb,t))},guid(t){return this.check(zx(hb,t))},uuid(t){return this.check(Bx(go,t))},uuidv4(t){return this.check(Hx(go,t))},uuidv6(t){return this.check(Vx(go,t))},uuidv7(t){return this.check(Gx(go,t))},nanoid(t){return this.check($x(pb,t))},cuid(t){return this.check(Wx(mb,t))},cuid2(t){return this.check(Zx(gb,t))},ulid(t){return this.check(Xx(_b,t))},base64(t){return this.check(ty(Eb,t))},base64url(t){return this.check(ny(Tb,t))},xid(t){return this.check(Yx(Sb,t))},ksuid(t){return this.check(Kx(vb,t))},ipv4(t){return this.check(jx(xb,t))},ipv6(t){return this.check(Jx(yb,t))},cidrv4(t){return this.check(Qx(bb,t))},cidrv6(t){return this.check(ey(Mb,t))},e164(t){return this.check(iy(Rb,t))},datetime(t){return this.check(Sp(sm,t))},date(t){return this.check(vp(rm,t))},time(t){return this.check(ry(lb,t))},duration(t){return this.check(oy(ub,t))}});function g(t){return kx(cb,t)}const kt=ee("ZodStringFormat",(t,e)=>{Ft.init(t,e),im.init(t,e)}),sm=ee("ZodISODateTime",(t,e)=>{O0.init(t,e),kt.init(t,e)}),rm=ee("ZodISODate",(t,e)=>{F0.init(t,e),kt.init(t,e)}),lb=ee("ZodISOTime",(t,e)=>{k0.init(t,e),kt.init(t,e)}),ub=ee("ZodISODuration",(t,e)=>{z0.init(t,e),kt.init(t,e)}),om=ee("ZodEmail",(t,e)=>{b0.init(t,e),kt.init(t,e)});function db(t){return gp(om,t)}const hb=ee("ZodGUID",(t,e)=>{x0.init(t,e),kt.init(t,e)}),go=ee("ZodUUID",(t,e)=>{y0.init(t,e),kt.init(t,e)}),am=ee("ZodURL",(t,e)=>{A0.init(t,e),kt.init(t,e)});function cm(t){return _p(am,t)}const fb=ee("ZodEmoji",(t,e)=>{C0.init(t,e),kt.init(t,e)}),pb=ee("ZodNanoID",(t,e)=>{P0.init(t,e),kt.init(t,e)}),mb=ee("ZodCUID",(t,e)=>{I0.init(t,e),kt.init(t,e)}),gb=ee("ZodCUID2",(t,e)=>{L0.init(t,e),kt.init(t,e)}),_b=ee("ZodULID",(t,e)=>{N0.init(t,e),kt.init(t,e)}),Sb=ee("ZodXID",(t,e)=>{D0.init(t,e),kt.init(t,e)}),vb=ee("ZodKSUID",(t,e)=>{U0.init(t,e),kt.init(t,e)}),xb=ee("ZodIPv4",(t,e)=>{B0.init(t,e),kt.init(t,e)}),yb=ee("ZodIPv6",(t,e)=>{V0.init(t,e),kt.init(t,e)}),bb=ee("ZodCIDRv4",(t,e)=>{G0.init(t,e),kt.init(t,e)}),Mb=ee("ZodCIDRv6",(t,e)=>{$0.init(t,e),kt.init(t,e)}),Eb=ee("ZodBase64",(t,e)=>{W0.init(t,e),kt.init(t,e)}),Tb=ee("ZodBase64URL",(t,e)=>{X0.init(t,e),kt.init(t,e)}),Rb=ee("ZodE164",(t,e)=>{Y0.init(t,e),kt.init(t,e)}),wb=ee("ZodJWT",(t,e)=>{j0.init(t,e),kt.init(t,e)}),Eu=ee("ZodNumber",(t,e)=>{cp.init(t,e),At.init(t,e),t._zod.processJSONSchema=(n,i,s)=>Pp(t,n,i,s),t.isFinite=!0},Yf({minValue:t=>{const{minimum:e,exclusiveMinimum:n}=Un(t);return Math.max(e??Number.NEGATIVE_INFINITY,n??Number.NEGATIVE_INFINITY)},maxValue:t=>{const{maximum:e,exclusiveMaximum:n}=Un(t);return Math.min(e??Number.POSITIVE_INFINITY,n??Number.POSITIVE_INFINITY)},isInt:t=>{const{isInt:e,multipleOf:n}=Un(t);return!!e||!!(n!=null&&n.some(Number.isSafeInteger))},format:t=>Un(t).format??null},{gt(t,e){return this.check(Qd(t,e))},gte(t,e){return this.check(dc(t,e))},min(t,e){return this.check(dc(t,e))},lt(t,e){return this.check(Jd(t,e))},lte(t,e){return this.check(uc(t,e))},max(t,e){return this.check(uc(t,e))},int(t){return this.check(uh(t))},safe(t){return this.check(uh(t))},positive(t){return this.check(Qd(0,t))},nonnegative(t){return this.check(dc(0,t))},negative(t){return this.check(Jd(0,t))},nonpositive(t){return this.check(uc(0,t))},multipleOf(t,e){return this.check(eh(t,e))},step(t,e){return this.check(eh(t,e))},finite(){return this}}));function ae(t){return ay(Eu,t)}const Ab=ee("ZodNumberFormat",(t,e)=>{J0.init(t,e),Eu.init(t,e)});function uh(t){return ly(Ab,t)}const Cb=ee("ZodBoolean",(t,e)=>{Q0.init(t,e),At.init(t,e),t._zod.processJSONSchema=(n,i,s)=>Ip(t,n,i)});function xe(t){return uy(Cb,t)}const Pb=ee("ZodUndefined",(t,e)=>{ex.init(t,e),At.init(t,e),t._zod.processJSONSchema=(n,i,s)=>Np(t,n,i,s)});function ll(t){return dy(Pb,t)}const Ib=ee("ZodNull",(t,e)=>{tx.init(t,e),At.init(t,e),t._zod.processJSONSchema=(n,i,s)=>Lp(t,n,i)});function $r(t){return hy(Ib,t)}const Lb=ee("ZodAny",(t,e)=>{nx.init(t,e),At.init(t,e),t._zod.processJSONSchema=(n,i,s)=>Up()});function Tu(){return fy(Lb)}const Nb=ee("ZodUnknown",(t,e)=>{ix.init(t,e),At.init(t,e),t._zod.processJSONSchema=(n,i,s)=>Op()});function Ue(){return py(Nb)}const Db=ee("ZodNever",(t,e)=>{sx.init(t,e),At.init(t,e),t._zod.processJSONSchema=(n,i,s)=>Dp(t,n,i)});function ul(t){return my(Db,t)}const Ub=ee("ZodArray",(t,e)=>{Da(),ax.init(t,e),At.init(t,e),t._zod.processJSONSchema=(n,i,s)=>Hp(t,n,i,s),t.element=e.element},{min(t,e){return this.check(oa(t,e))},nonempty(t){return this.check(oa(1,t))},max(t,e){return this.check(xp(t,e))},length(t,e){return this.check(yp(t,e))},unwrap(){return this.element}});function G(t,e){return wy(Ub,t,e)}const lm=ee("ZodObject",(t,e)=>{Da(),ux.init(t,e),At.init(t,e),t._zod.processJSONSchema=(n,i,s)=>Vp(t,n,i,s),nv(t,"shape",n=>n._zod.def.shape,!1)},{keyof(){return We(Object.keys(this._zod.def.shape))},catchall(t){return this.clone(Dn(this._zod.def,{catchall:t}))},passthrough(){return this.clone(Dn(this._zod.def,{catchall:Ue()}))},loose(){return this.clone(Dn(this._zod.def,{catchall:Ue()}))},strict(){return this.clone(Dn(this._zod.def,{catchall:ul()}))},strip(){return this.clone(Dn(this._zod.def,{catchall:void 0}))},extend(t){return $S(this,t)},safeExtend(t){return WS(this,t)},merge(t){return ZS(this,t)},pick(t){return GS(this,t)},omit(t){return qS(this,t)},partial(...t){return Dd(hm,this,t[0])},exactPartial(...t){return Dd(fm,this,t[0],"exactPartial")},required(...t){return XS(pm,this,t[0])}});function M(t,e){const n={type:"object",shape:t??{},...Oe(e)};return new lm(n)}function Be(t,e){return new lm({type:"object",shape:t,catchall:Ue(),...Oe(e)})}const um=ee("ZodUnion",(t,e)=>{dp.init(t,e),At.init(t,e),t._zod.processJSONSchema=(n,i,s)=>Gp(t,n,i,s),t.options=e.options});function Se(t,e){return new um({type:"union",options:t,...Oe(e)})}const Ob=ee("ZodDiscriminatedUnion",(t,e)=>{um.init(t,e),hx.init(t,e)});function da(t,e,n){return new Ob({type:"union",options:e,discriminator:t,...Oe(n)})}const Fb=ee("ZodIntersection",(t,e)=>{fx.init(t,e),At.init(t,e),t._zod.processJSONSchema=(n,i,s)=>qp(t,n,i,s)});function _s(t,e){return new Fb({type:"intersection",left:t,right:e})}const dh=ee("ZodRecord",(t,e)=>{Da(),px.init(t,e),At.init(t,e),t._zod.processJSONSchema=(n,i,s)=>$p(t,n,i,s),t.keyType=e.keyType,t.valueType=e.valueType});function _e(t,e,n){return!e||!e._zod?new dh({type:"record",keyType:g(),valueType:t,...Oe(e)}):new dh({type:"record",keyType:t,valueType:e,...Oe(n)})}const dl=ee("ZodEnum",(t,e)=>{mx.init(t,e),At.init(t,e),t._zod.processJSONSchema=(i,s,r)=>Fp(t,i,s),t.enum=e.entries,t.options=[...t._zod.values];const n=new Set(Object.keys(e.entries));t.extract=(i,s)=>{const r={};for(const o of i)if(n.has(o))r[o]=e.entries[o];else throw new Error(`Key ${o} not found in enum`);return new dl({...e,checks:[],...Oe(s),entries:r})},t.exclude=(i,s)=>{const r={...e.entries};for(const o of i)if(n.has(o))delete r[o];else throw new Error(`Key ${o} not found in enum`);return new dl({...e,checks:[],...Oe(s),entries:r})}});function We(t,e){const n=Array.isArray(t)?Object.fromEntries(t.map(i=>[i,i])):t;return new dl({type:"enum",entries:n,...Oe(e)})}const kb=ee("ZodLiteral",(t,e)=>{gx.init(t,e),At.init(t,e),t._zod.processJSONSchema=(n,i,s)=>kp(t,n,i,s),t.values=new Set(e.values),Object.defineProperty(t,"value",{get(){if(e.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return e.values[0]}})});function C(t,e){return new kb({type:"literal",values:Array.isArray(t)?t:[t],...Oe(e)})}const zb=ee("ZodTransform",(t,e)=>{Da(),_x.init(t,e),At.init(t,e),t._zod.processJSONSchema=(n,i,s)=>Bp(t,n,i,s),t._zod.parse=(n,i)=>{if(i.direction==="backward")throw new Kf(t.constructor.name);n.addIssue=r=>{if(typeof r=="string")n.issues.push(Gr(r,n.value,e));else{const o=r;o.fatal&&(o.continue=!1),o.code??(o.code="custom"),"input"in o||(o.input=n.value),o.inst??(o.inst=t),n.issues.push(Gr(o))}};const s=e.transform(n.value,n);return s instanceof Promise?s.then(r=>(n.value=r,n)):(n.value=s,n)}});function dm(t){return new zb({type:"transform",transform:t})}const hm=ee("ZodOptional",(t,e)=>{hp.init(t,e),At.init(t,e),t._zod.processJSONSchema=(n,i,s)=>Mu(t,n,i,s),t.unwrap=()=>t._zod.def.innerType});function ze(t){return new hm({type:"optional",innerType:t})}const fm=ee("ZodExactOptional",(t,e)=>{Sx.init(t,e),At.init(t,e),t._zod.processJSONSchema=(n,i,s)=>Mu(t,n,i,s),t.unwrap=()=>t._zod.def.innerType});function Bb(t){return new fm({type:"optional",innerType:t})}const Hb=ee("ZodNullable",(t,e)=>{vx.init(t,e),At.init(t,e),t._zod.processJSONSchema=(n,i,s)=>Wp(t,n,i,s),t.unwrap=()=>t._zod.def.innerType});function hh(t){return new Hb({type:"nullable",innerType:t})}const Vb=ee("ZodDefault",(t,e)=>{xx.init(t,e),At.init(t,e),t._zod.processJSONSchema=(n,i,s)=>Yp(t,n,i,s),t.unwrap=()=>t._zod.def.innerType,t.removeDefault=t.unwrap});function Gb(t,e){return new Vb({type:"default",innerType:t,get defaultValue(){return typeof e=="function"?e():qf(e)}})}const qb=ee("ZodPrefault",(t,e)=>{yx.init(t,e),At.init(t,e),t._zod.processJSONSchema=(n,i,s)=>Kp(t,n,i,s),t.unwrap=()=>t._zod.def.innerType});function $b(t,e){return new qb({type:"prefault",innerType:t,get defaultValue(){return typeof e=="function"?e():qf(e)}})}const pm=ee("ZodNonOptional",(t,e)=>{bx.init(t,e),At.init(t,e),t._zod.processJSONSchema=(n,i,s)=>Zp(t,n,i,s),t.unwrap=()=>t._zod.def.innerType});function Wb(t,e){return new pm({type:"nonoptional",innerType:t,...Oe(e)})}const Zb=ee("ZodCatch",(t,e)=>{Mx.init(t,e),At.init(t,e),t._zod.processJSONSchema=(n,i,s)=>jp(t,n,i,s),t.unwrap=()=>t._zod.def.innerType,t.removeCatch=t.unwrap});function Xb(t,e){return new Zb({type:"catch",innerType:t,catchValue:typeof e=="function"?e:sv(e)})}const mm=ee("ZodPipe",(t,e)=>{fp.init(t,e),At.init(t,e),t._zod.processJSONSchema=(n,i,s)=>Jp(t,n,i,s),t.in=e.in,t.out=e.out});function fh(t,e){return new mm({type:"pipe",in:t,out:e})}const Yb=ee("ZodPreprocess",(t,e)=>{mm.init(t,e),Ex.init(t,e)}),Kb=ee("ZodReadonly",(t,e)=>{Tx.init(t,e),At.init(t,e),t._zod.processJSONSchema=(n,i,s)=>Qp(t,n,i,s),t.unwrap=()=>t._zod.def.innerType});function jb(t){return new Kb({type:"readonly",innerType:t})}const Jb=ee("ZodLazy",(t,e)=>{Rx.init(t,e),At.init(t,e),t._zod.processJSONSchema=(n,i,s)=>em(t,n,i,s),t.unwrap=()=>t._zod.def.getter()});function Ru(t){return new Jb({type:"lazy",getter:t})}const Qb=ee("ZodCustom",(t,e)=>{wx.init(t,e),At.init(t,e),t._zod.processJSONSchema=(n,i,s)=>zp(t,n,i,s)});function eM(t,e={}){return Ay(Qb,t,e)}function tM(t,e){return Cy(t,e)}function Wr(t,e){return new Yb({type:"pipe",in:dm(t),out:e})}const nM={custom:"custom"};function Ua(t){return Sp(sm,t)}function iM(t){return vp(rm,t)}function sM(t){return cy(Eu,t)}const rM="2025-11-25",oM=[rM,"2025-06-18","2025-03-26","2024-11-05","2024-10-07"],aM="io.modelcontextprotocol/related-task",Oa="io.modelcontextprotocol/protocolVersion",wu="io.modelcontextprotocol/clientInfo",Ur="io.modelcontextprotocol/serverInfo",Fa="io.modelcontextprotocol/clientCapabilities",cM="io.modelcontextprotocol/subscriptionId",Au="io.modelcontextprotocol/logLevel",ka="2.0",rr=Ru(()=>Se([g(),ae(),xe(),$r(),_e(g(),rr),G(rr)])),Zt=_e(g(),rr),lM=G(rr),Cu=Se([g(),ae().int()]),Pu=g(),gm=M({ttl:ae().optional()}),_m=M({taskId:g()}),Iu=Be({progressToken:Cu.optional(),[aM]:_m.optional()}),mn=M({_meta:Iu.optional()}),so=mn.extend({task:gm.optional()}),Xt=M({method:g(),params:mn.loose().optional()}),An=M({_meta:Iu.optional()}),Cn=M({method:g(),params:An.loose().optional()}),Lu=Be({get[Ur](){return ur.optional().catch(void 0)}}),Yt=Be({_meta:Lu.optional()}),Ts=Se([g(),ae().int()]),Nu=M({jsonrpc:C(ka),id:Ts,...Xt.shape}).strict(),Du=M({jsonrpc:C(ka),...Cn.shape}).strict(),za=M({jsonrpc:C(ka),id:Ts,result:Yt}).strict(),Ba=M({jsonrpc:C(ka),id:Ts.optional(),error:M({code:ae().int(),message:g(),data:Ue().optional()})}).strict(),Sm=Se([Nu,Du,za,Ba]),uM=Se([za,Ba]),Ha=Yt.strict(),vm=An.extend({requestId:Ts.optional(),reason:g().optional()}),Uu=Cn.extend({method:C("notifications/cancelled"),params:vm}),xm=M({src:g(),mimeType:g().optional(),sizes:G(g()).optional(),theme:We(["light","dark"]).optional()}),lr=M({icons:G(xm).optional()}),Ss=M({name:g(),title:g().optional()}),ur=Ss.extend({...Ss.shape,...lr.shape,version:g(),websiteUrl:g().optional(),description:g().optional()}),dM=_s(M({applyDefaults:xe().optional()}),Zt),hM=Wr(t=>t&&typeof t=="object"&&!Array.isArray(t)&&Object.keys(t).length===0?{form:{}}:t,_s(M({form:dM.optional(),url:Zt.optional()}),Zt.optional())),ym=Be({list:Zt.optional(),cancel:Zt.optional(),requests:Be({sampling:Be({createMessage:Zt.optional()}).optional(),elicitation:Be({create:Zt.optional()}).optional()}).optional()}),bm=Be({list:Zt.optional(),cancel:Zt.optional(),requests:Be({tools:Be({call:Zt.optional()}).optional()}).optional()}),Mm=M({experimental:_e(g(),Zt).optional(),sampling:M({context:Zt.optional(),tools:Zt.optional()}).optional(),elicitation:hM.optional(),roots:M({listChanged:xe().optional()}).optional(),tasks:ym.optional(),extensions:_e(g(),Zt).optional()}),Em=mn.extend({protocolVersion:g(),capabilities:Mm,clientInfo:ur}),Tm=Xt.extend({method:C("initialize"),params:Em}),Ou=M({experimental:_e(g(),Zt).optional(),logging:Zt.optional(),completions:Zt.optional(),prompts:M({listChanged:xe().optional()}).optional(),resources:M({subscribe:xe().optional(),listChanged:xe().optional()}).optional(),tools:M({listChanged:xe().optional()}).optional(),tasks:bm.optional(),extensions:_e(g(),Zt).optional()}),Rm=Yt.extend({protocolVersion:g(),capabilities:Ou,serverInfo:ur,instructions:g().optional()}),wm=Cn.extend({method:C("notifications/initialized"),params:An.optional()}),Am=Xt.extend({method:C("server/discover"),params:mn.optional()}),Cm=Yt.extend({supportedVersions:G(g()),capabilities:Ou,instructions:g().optional()}),Fu=Xt.extend({method:C("ping"),params:mn.optional()}),Pm=M({progress:ae(),total:ze(ae()),message:ze(g())}),Im=M({...An.shape,...Pm.shape,progressToken:Cu}),ku=Cn.extend({method:C("notifications/progress"),params:Im}),Lm=mn.extend({cursor:Pu.optional()}),dr=Xt.extend({params:Lm.optional()}),hr=Yt.extend({nextCursor:Pu.optional()}),zu=M({uri:g(),mimeType:ze(g()),_meta:_e(g(),Ue()).optional()}),Bu=zu.extend({text:g()}),Hu=g().refine(t=>{try{return atob(t),!0}catch{return!1}},{message:"Invalid Base64 string"}),Vu=zu.extend({blob:Hu}),fr=We(["user","assistant"]),Rs=M({audience:G(fr).optional(),priority:ae().min(0).max(1).optional(),lastModified:Ua({offset:!0}).optional()}),Gu=M({...Ss.shape,...lr.shape,uri:g(),description:ze(g()),mimeType:ze(g()),size:ze(ae()),annotations:Rs.optional(),_meta:ze(Be({}))}),Nm=M({...Ss.shape,...lr.shape,uriTemplate:g(),description:ze(g()),mimeType:ze(g()),annotations:Rs.optional(),_meta:ze(Be({}))}),Dm=dr.extend({method:C("resources/list")}),Um=hr.extend({resources:G(Gu)}),Om=dr.extend({method:C("resources/templates/list")}),Fm=hr.extend({resourceTemplates:G(Nm)}),Va=mn.extend({uri:g()}),km=Va,zm=Xt.extend({method:C("resources/read"),params:km}),Bm=Yt.extend({contents:G(Se([Bu,Vu]))}),Hm=Cn.extend({method:C("notifications/resources/list_changed"),params:An.optional()}),Vm=Va,Gm=Xt.extend({method:C("resources/subscribe"),params:Vm}),qm=Va,$m=Xt.extend({method:C("resources/unsubscribe"),params:qm}),qu=M({toolsListChanged:xe().optional(),promptsListChanged:xe().optional(),resourcesListChanged:xe().optional(),resourceSubscriptions:G(g()).optional()}),Wm=mn.extend({notifications:qu}),Zm=Xt.extend({method:C("subscriptions/listen"),params:Wm}),Xm=An.extend({notifications:qu}),Ym=Cn.extend({method:C("notifications/subscriptions/acknowledged"),params:Xm}),Km=Lu.extend({[cM]:Ts}),jm=Yt.extend({_meta:Km}),Jm=An.extend({uri:g()}),Qm=Cn.extend({method:C("notifications/resources/updated"),params:Jm}),eg=M({name:g(),description:ze(g()),required:ze(xe())}),tg=M({...Ss.shape,...lr.shape,description:ze(g()),arguments:ze(G(eg)),_meta:ze(Be({}))}),ng=dr.extend({method:C("prompts/list")}),ig=hr.extend({prompts:G(tg)}),sg=mn.extend({name:g(),arguments:_e(g(),g()).optional()}),rg=Xt.extend({method:C("prompts/get"),params:sg}),Ga=M({type:C("text"),text:g(),annotations:Rs.optional(),_meta:_e(g(),Ue()).optional()}),qa=M({type:C("image"),data:Hu,mimeType:g(),annotations:Rs.optional(),_meta:_e(g(),Ue()).optional()}),$a=M({type:C("audio"),data:Hu,mimeType:g(),annotations:Rs.optional(),_meta:_e(g(),Ue()).optional()}),og=M({type:C("tool_use"),name:g(),id:g(),input:_e(g(),Ue()),_meta:_e(g(),Ue()).optional()}),$u=M({type:C("resource"),resource:Se([Bu,Vu]),annotations:Rs.optional(),_meta:_e(g(),Ue()).optional()}),Wu=Gu.extend({type:C("resource_link")}),pr=Se([Ga,qa,$a,Wu,$u]),ag=M({role:fr,content:pr}),cg=Yt.extend({description:g().optional(),messages:G(ag)}),lg=Cn.extend({method:C("notifications/prompts/list_changed"),params:An.optional()}),ug=M({title:g().optional(),readOnlyHint:xe().optional(),destructiveHint:xe().optional(),idempotentHint:xe().optional(),openWorldHint:xe().optional()}),dg=M({taskSupport:We(["required","optional","forbidden"]).optional()}),Wa=M({...Ss.shape,...lr.shape,description:g().optional(),inputSchema:M({type:C("object"),properties:_e(g(),rr).optional(),required:G(g()).optional()}).catchall(Ue()),outputSchema:Be({$schema:g().optional()}).optional(),annotations:ug.optional(),execution:dg.optional(),_meta:_e(g(),Ue()).optional()}),hg=dr.extend({method:C("tools/list")}),fg=hr.extend({tools:G(Wa)}),Za=Yt.extend({content:G(pr).default([]),structuredContent:Ue().optional(),isError:xe().optional()}),fM=Za.or(Yt.extend({toolResult:Ue()})),pg=so.extend({name:g(),arguments:_e(g(),Ue()).optional()}),mg=Xt.extend({method:C("tools/call"),params:pg}),gg=Cn.extend({method:C("notifications/tools/list_changed"),params:An.optional()}),pM=M({autoRefresh:xe().default(!0),debounceMs:ae().int().nonnegative().default(300)}),Zu=We(["debug","info","notice","warning","error","critical","alert","emergency"]),_g=mn.extend({level:Zu}),Sg=Xt.extend({method:C("logging/setLevel"),params:_g}),vg=An.extend({level:Zu,logger:g().optional(),data:Ue()}),xg=Cn.extend({method:C("notifications/message"),params:vg}),yg=M({name:g().optional()}),bg=M({hints:G(yg).optional(),costPriority:ae().min(0).max(1).optional(),speedPriority:ae().min(0).max(1).optional(),intelligencePriority:ae().min(0).max(1).optional()}),Mg=M({mode:We(["auto","required","none"]).optional()}),Eg=M({type:C("tool_result"),toolUseId:g().describe("The unique identifier for the corresponding tool call."),content:G(pr),structuredContent:Ue().optional(),isError:xe().optional(),_meta:_e(g(),Ue()).optional()}),Tg=da("type",[Ga,qa,$a]),Zr=da("type",[Ga,qa,$a,og,Eg]),Rg=M({role:fr,content:Se([Zr,G(Zr)]),_meta:_e(g(),Ue()).optional()}),wg=so.extend({messages:G(Rg),modelPreferences:bg.optional(),systemPrompt:g().optional(),includeContext:We(["none","thisServer","allServers"]).optional(),temperature:ae().optional(),maxTokens:ae().int(),stopSequences:G(g()).optional(),metadata:Zt.optional(),tools:G(Wa).optional(),toolChoice:Mg.optional()}),Ag=Xt.extend({method:C("sampling/createMessage"),params:wg}),Cg=Yt.extend({model:g(),stopReason:ze(We(["endTurn","stopSequence","maxTokens"]).or(g())),role:fr,content:Tg}),Pg=Yt.extend({model:g(),stopReason:ze(We(["endTurn","stopSequence","maxTokens","toolUse"]).or(g())),role:fr,content:Se([Zr,G(Zr)])}),Xu=M({type:C("boolean"),title:g().optional(),description:g().optional(),default:xe().optional()}),Xa=M({type:C("string"),title:g().optional(),description:g().optional(),minLength:ae().optional(),maxLength:ae().optional(),format:We(["email","uri","date","date-time"]).optional(),default:g().optional()}),ha=M({type:We(["number","integer"]),title:g().optional(),description:g().optional(),minimum:ae().optional(),maximum:ae().optional(),default:ae().optional()}),Yu=M({type:C("string"),title:g().optional(),description:g().optional(),enum:G(g()),default:g().optional()}),Ku=M({type:C("string"),title:g().optional(),description:g().optional(),oneOf:G(M({const:g(),title:g()})),default:g().optional()}),ju=M({type:C("string"),title:g().optional(),description:g().optional(),enum:G(g()),enumNames:G(g()).optional(),default:g().optional()}),Ig=Se([Yu,Ku]),Ju=M({type:C("array"),title:g().optional(),description:g().optional(),minItems:ae().optional(),maxItems:ae().optional(),items:M({type:C("string"),enum:G(g())}),default:G(g()).optional()}),Qu=M({type:C("array"),title:g().optional(),description:g().optional(),minItems:ae().optional(),maxItems:ae().optional(),items:M({anyOf:G(M({const:g(),title:g()}))}),default:G(g()).optional()}),Lg=Se([Ju,Qu]),Ng=Se([ju,Ig,Lg]),ed=Se([Ng,Xu,Xa,ha]),Ya=so.extend({mode:C("form").optional(),message:g(),requestedSchema:M({type:C("object"),properties:_e(g(),ed),required:G(g()).optional()}).catchall(Ue())}),Dg=so.extend({mode:C("url"),message:g(),elicitationId:g(),url:g().url()}),Ug=Se([Ya,Dg]),Og=Xt.extend({method:C("elicitation/create"),params:Ug}),Fg=An.extend({elicitationId:g()}),kg=Cn.extend({method:C("notifications/elicitation/complete"),params:Fg}),zg=Yt.extend({action:We(["accept","decline","cancel"]),content:Wr(t=>t===null?void 0:t,_e(g(),Se([g(),ae(),xe(),G(g())])).optional())}),Bg=M({type:C("ref/resource"),uri:g()}),Hg=M({type:C("ref/prompt"),name:g()}),Vg=mn.extend({ref:Se([Hg,Bg]),argument:M({name:g(),value:g()}),context:M({arguments:_e(g(),g()).optional()}).optional()}),Gg=Xt.extend({method:C("completion/complete"),params:Vg}),qg=Yt.extend({completion:Be({values:G(g()).max(100),total:ze(ae().int()),hasMore:ze(xe())})}),$g=M({uri:g().startsWith("file://"),name:g().optional(),_meta:_e(g(),Ue()).optional()}),Wg=Xt.extend({method:C("roots/list"),params:mn.optional()}),Zg=Yt.extend({roots:G($g)}),Xg=Cn.extend({method:C("notifications/roots/list_changed"),params:An.optional()}),mM=Be({ttl:ae().optional(),pollInterval:ae().optional()}),Yg=We(["working","input_required","completed","failed","cancelled"]),mr=M({taskId:g(),status:Yg,ttl:Se([ae(),$r()]),createdAt:g(),lastUpdatedAt:g(),pollInterval:ze(ae()),statusMessage:ze(g())}),gM=Yt.extend({task:mr}),Kg=An.merge(mr),_M=Cn.extend({method:C("notifications/tasks/status"),params:Kg}),SM=Xt.extend({method:C("tasks/get"),params:mn.extend({taskId:g()})}),vM=Yt.merge(mr),xM=Xt.extend({method:C("tasks/result"),params:mn.extend({taskId:g()})}),yM=Yt.loose(),bM=dr.extend({method:C("tasks/list")}),MM=hr.extend({tasks:G(mr)}),EM=Xt.extend({method:C("tasks/cancel"),params:mn.extend({taskId:g()})}),TM=Yt.merge(mr),RM=Se([Fu,Tm,Am,Gg,Sg,rg,ng,Dm,Om,zm,Gm,$m,Zm,mg,hg]),wM=Se([Uu,ku,wm,Xg]),AM=Se([Ha,Cg,Pg,zg,Zg]),CM=Se([Fu,Ag,Og,Wg]),PM=Se([Uu,ku,xg,Qm,Hm,gg,lg,Ym,kg]),IM=Se([Ha,Rm,Cm,qg,cg,ig,Um,Fm,Bm,Za,fg,jm]),sn=cm().superRefine((t,e)=>{if(!URL.canParse(t))return e.addIssue({code:nM.custom,message:"URL must be parseable",fatal:!0}),rv}).refine(t=>{const e=new URL(t);return e.protocol!=="javascript:"&&e.protocol!=="data:"&&e.protocol!=="vbscript:"},{message:"URL cannot use javascript:, data:, or vbscript: scheme"}),LM=Be({resource:g().url(),authorization_servers:G(sn).optional(),jwks_uri:g().url().optional(),scopes_supported:G(g()).optional(),bearer_methods_supported:G(g()).optional(),resource_signing_alg_values_supported:G(g()).optional(),resource_name:g().optional(),resource_documentation:g().optional(),resource_policy_uri:g().url().optional(),resource_tos_uri:g().url().optional(),tls_client_certificate_bound_access_tokens:xe().optional(),authorization_details_types_supported:G(g()).optional(),dpop_signing_alg_values_supported:G(g()).optional(),dpop_bound_access_tokens_required:xe().optional()}),jg=Be({issuer:g(),authorization_endpoint:sn,token_endpoint:sn,registration_endpoint:sn.optional(),scopes_supported:G(g()).optional(),response_types_supported:G(g()),response_modes_supported:G(g()).optional(),grant_types_supported:G(g()).optional(),token_endpoint_auth_methods_supported:G(g()).optional(),token_endpoint_auth_signing_alg_values_supported:G(g()).optional(),service_documentation:sn.optional(),revocation_endpoint:sn.optional(),revocation_endpoint_auth_methods_supported:G(g()).optional(),revocation_endpoint_auth_signing_alg_values_supported:G(g()).optional(),introspection_endpoint:g().optional(),introspection_endpoint_auth_methods_supported:G(g()).optional(),introspection_endpoint_auth_signing_alg_values_supported:G(g()).optional(),code_challenge_methods_supported:G(g()).optional(),client_id_metadata_document_supported:xe().optional(),authorization_response_iss_parameter_supported:xe().optional().catch(void 0),dpop_signing_alg_values_supported:G(g()).optional()}),Jg=Be({issuer:g(),authorization_endpoint:sn,token_endpoint:sn,userinfo_endpoint:sn.optional(),jwks_uri:sn,registration_endpoint:sn.optional(),scopes_supported:G(g()).optional(),response_types_supported:G(g()),response_modes_supported:G(g()).optional(),grant_types_supported:G(g()).optional(),acr_values_supported:G(g()).optional(),subject_types_supported:G(g()),id_token_signing_alg_values_supported:G(g()),id_token_encryption_alg_values_supported:G(g()).optional(),id_token_encryption_enc_values_supported:G(g()).optional(),userinfo_signing_alg_values_supported:G(g()).optional(),userinfo_encryption_alg_values_supported:G(g()).optional(),userinfo_encryption_enc_values_supported:G(g()).optional(),request_object_signing_alg_values_supported:G(g()).optional(),request_object_encryption_alg_values_supported:G(g()).optional(),request_object_encryption_enc_values_supported:G(g()).optional(),token_endpoint_auth_methods_supported:G(g()).optional(),token_endpoint_auth_signing_alg_values_supported:G(g()).optional(),display_values_supported:G(g()).optional(),claim_types_supported:G(g()).optional(),claims_supported:G(g()).optional(),service_documentation:g().optional(),claims_locales_supported:G(g()).optional(),ui_locales_supported:G(g()).optional(),claims_parameter_supported:xe().optional(),request_parameter_supported:xe().optional(),request_uri_parameter_supported:xe().optional(),require_request_uri_registration:xe().optional(),op_policy_uri:sn.optional(),op_tos_uri:sn.optional(),client_id_metadata_document_supported:xe().optional(),authorization_response_iss_parameter_supported:xe().optional().catch(void 0)}),NM=M({...Jg.shape,...jg.pick({code_challenge_methods_supported:!0}).shape}),DM=M({access_token:g(),id_token:g().optional(),token_type:g(),expires_in:sM().optional(),scope:g().optional(),refresh_token:g().optional(),issuer:g().optional().catch(void 0)}).strip(),UM=M({issued_token_type:C("urn:ietf:params:oauth:token-type:id-jag"),access_token:g(),token_type:g().optional(),expires_in:ae().optional(),scope:g().optional()}).strip(),OM=M({error:g(),error_description:g().optional(),error_uri:g().optional()}),ph=sn.optional().or(C("").transform(()=>{})),Qg=M({redirect_uris:G(sn),token_endpoint_auth_method:g().optional(),grant_types:G(g()).optional(),response_types:G(g()).optional(),application_type:g().optional(),client_name:g().optional(),client_uri:sn.optional(),logo_uri:ph,scope:g().optional(),contacts:G(g()).optional(),tos_uri:ph,policy_uri:g().optional(),jwks_uri:sn.optional(),jwks:Tu().optional(),software_id:g().optional(),software_version:g().optional(),software_statement:g().optional()}).strip(),e_=M({client_id:g(),client_secret:g().optional(),client_id_issued_at:ae().optional(),client_secret_expires_at:ae().optional(),issuer:g().optional().catch(void 0)}).strip(),FM=Qg.merge(e_),kM=M({error:g(),error_description:g().optional()}).strip(),zM=M({token:g(),token_type_hint:g().optional()}).strip(),hl=Symbol.for("mcp.sdk.errorBrands");function t_(t,e){const n=new Set;let i=e;for(;typeof i=="function";){const s=i.mcpBrand;Object.prototype.hasOwnProperty.call(i,"mcpBrand")&&typeof s=="string"&&n.add(s),i=Object.getPrototypeOf(i)}n.size!==0&&Object.defineProperty(t,hl,{value:n,enumerable:!1,configurable:!0})}function fa(t,e){try{if(typeof e=="object"&&e!==null&&Object.prototype.hasOwnProperty.call(t,"mcpBrand")&&typeof t.mcpBrand=="string"&&Object.prototype.hasOwnProperty.call(e,hl)){const n=e[hl];if(n&&typeof n.has=="function"&&n.has(t.mcpBrand))return!0}}catch{}return Function.prototype[Symbol.hasInstance].call(t,e)}let hn=(function(t){return t.NotConnected="NOT_CONNECTED",t.AlreadyConnected="ALREADY_CONNECTED",t.NotInitialized="NOT_INITIALIZED",t.CapabilityNotSupported="CAPABILITY_NOT_SUPPORTED",t.RequestTimeout="REQUEST_TIMEOUT",t.ConnectionClosed="CONNECTION_CLOSED",t.SendFailed="SEND_FAILED",t.InvalidResult="INVALID_RESULT",t.UnsupportedResultType="UNSUPPORTED_RESULT_TYPE",t.InputRequiredRoundsExceeded="INPUT_REQUIRED_ROUNDS_EXCEEDED",t.ListPaginationExceeded="LIST_PAGINATION_EXCEEDED",t.MethodNotSupportedByProtocolVersion="METHOD_NOT_SUPPORTED_BY_PROTOCOL_VERSION",t.EraNegotiationFailed="ERA_NEGOTIATION_FAILED",t.ClientHttpNotImplemented="CLIENT_HTTP_NOT_IMPLEMENTED",t.ClientHttpAuthentication="CLIENT_HTTP_AUTHENTICATION",t.ClientHttpForbidden="CLIENT_HTTP_FORBIDDEN",t.ClientHttpUnexpectedContent="CLIENT_HTTP_UNEXPECTED_CONTENT",t.ClientHttpFailedToOpenStream="CLIENT_HTTP_FAILED_TO_OPEN_STREAM",t.ClientHttpFailedToTerminateSession="CLIENT_HTTP_FAILED_TO_TERMINATE_SESSION",t})({});var Ks,en=(Ks=class extends Error{static[Symbol.hasInstance](e){return fa(this,e)}static isInstance(e){if(typeof this!="function")throw new TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return fa(this,e)}constructor(e,n,i,s){super(n,s),this.code=e,this.data=i,this.name="SdkError",t_(this,new.target)}},Object.defineProperty(Ks,"mcpBrand",{value:"mcp.SdkError"}),Ks);const BM="2026-07-28";function HM(t){return t>=BM}function n_(t){var n;const e=t.structuredContent;return e===void 0||!(typeof e!="object"||e===null||Array.isArray(e))||(((n=t.content)==null?void 0:n.some(i=>i.type==="text"))??!1)?t:{...t,content:[...t.content??[],{type:"text",text:JSON.stringify(e)}]}}const i_=["task","inputRequests","requestState"];function VM(t){return t===null||typeof t!="object"||Array.isArray(t)||t.content!==void 0||i_.some(e=>e in t)?t:{...t,content:[]}}function GM(){const t=Ru(()=>Se([g(),ae(),xe(),$r(),_e(g(),t),G(t)])),e=_e(g(),t),n=Se([g(),ae().int()]),i=g(),s=M({ttl:ae().optional()}),r=M({taskId:g()}),o=Be({progressToken:n.optional(),"io.modelcontextprotocol/related-task":r.optional()}),a=M({_meta:o.optional()}),c=a.extend({task:s.optional()}),l=M({method:g(),params:a.loose().optional()}),u=M({_meta:o.optional()}),h=M({method:g(),params:u.loose().optional()}),d=Be({_meta:o.optional()}),f=Se([g(),ae().int()]),_=d.strict(),x=u.extend({requestId:f.optional(),reason:g().optional()}),m=h.extend({method:C("notifications/cancelled"),params:x}),p=M({src:g(),mimeType:g().optional(),sizes:G(g()).optional(),theme:We(["light","dark"]).optional()}),E=M({icons:G(p).optional()}),L=M({name:g(),title:g().optional()}),b=L.extend({...L.shape,...E.shape,version:g(),websiteUrl:g().optional(),description:g().optional()}),w=_s(M({applyDefaults:xe().optional()}),e),A=Wr(ln=>ln&&typeof ln=="object"&&!Array.isArray(ln)&&Object.keys(ln).length===0?{form:{}}:ln,_s(M({form:w.optional(),url:e.optional()}),e.optional())),P=Be({list:e.optional(),cancel:e.optional(),requests:Be({sampling:Be({createMessage:e.optional()}).optional(),elicitation:Be({create:e.optional()}).optional()}).optional()}),v=Be({list:e.optional(),cancel:e.optional(),requests:Be({tools:Be({call:e.optional()}).optional()}).optional()}),T=M({experimental:_e(g(),e).optional(),sampling:M({context:e.optional(),tools:e.optional()}).optional(),elicitation:A.optional(),roots:M({listChanged:xe().optional()}).optional(),tasks:P.optional(),extensions:_e(g(),e).optional()}),I=a.extend({protocolVersion:g(),capabilities:T,clientInfo:b}),N=l.extend({method:C("initialize"),params:I}),k=M({experimental:_e(g(),e).optional(),logging:e.optional(),completions:e.optional(),prompts:M({listChanged:xe().optional()}).optional(),resources:M({subscribe:xe().optional(),listChanged:xe().optional()}).optional(),tools:M({listChanged:xe().optional()}).optional(),tasks:v.optional(),extensions:_e(g(),e).optional()}),$=d.extend({protocolVersion:g(),capabilities:k,serverInfo:b,instructions:g().optional()}),U=h.extend({method:C("notifications/initialized"),params:u.optional()}),V=l.extend({method:C("ping"),params:a.optional()}),Q=M({progress:ae(),total:ze(ae()),message:ze(g())}),X=M({...u.shape,...Q.shape,progressToken:n}),ce=h.extend({method:C("notifications/progress"),params:X}),j=a.extend({cursor:i.optional()}),se=l.extend({params:j.optional()}),oe=d.extend({nextCursor:i.optional()}),Fe=M({uri:g(),mimeType:ze(g()),_meta:_e(g(),Ue()).optional()}),Le=Fe.extend({text:g()}),ft=g().refine(ln=>{try{return atob(ln),!0}catch{return!1}},{message:"Invalid Base64 string"}),et=Fe.extend({blob:ft}),je=We(["user","assistant"]),Y=M({audience:G(je).optional(),priority:ae().min(0).max(1).optional(),lastModified:Ua({offset:!0}).optional()}),re=M({...L.shape,...E.shape,uri:g(),description:ze(g()),mimeType:ze(g()),size:ze(ae()),annotations:Y.optional(),_meta:ze(Be({}))}),Re=M({...L.shape,...E.shape,uriTemplate:g(),description:ze(g()),mimeType:ze(g()),annotations:Y.optional(),_meta:ze(Be({}))}),Ve=se.extend({method:C("resources/list")}),Me=oe.extend({resources:G(re)}),$e=se.extend({method:C("resources/templates/list")}),Ct=oe.extend({resourceTemplates:G(Re)}),Ze=a.extend({uri:g()}),it=Ze,_t=l.extend({method:C("resources/read"),params:it}),Je=d.extend({contents:G(Se([Le,et]))}),vt=h.extend({method:C("notifications/resources/list_changed"),params:u.optional()}),Ut=Ze,qt=l.extend({method:C("resources/subscribe"),params:Ut}),bt=Ze,Pt=l.extend({method:C("resources/unsubscribe"),params:bt}),F=u.extend({uri:g()}),zt=h.extend({method:C("notifications/resources/updated"),params:F}),lt=M({name:g(),description:ze(g()),required:ze(xe())}),R=M({...L.shape,...E.shape,description:ze(g()),arguments:ze(G(lt)),_meta:ze(Be({}))}),S=se.extend({method:C("prompts/list")}),z=oe.extend({prompts:G(R)}),Z=a.extend({name:g(),arguments:_e(g(),g()).optional()}),K=l.extend({method:C("prompts/get"),params:Z}),le=M({type:C("text"),text:g(),annotations:Y.optional(),_meta:_e(g(),Ue()).optional()}),de=M({type:C("image"),data:ft,mimeType:g(),annotations:Y.optional(),_meta:_e(g(),Ue()).optional()}),J=M({type:C("audio"),data:ft,mimeType:g(),annotations:Y.optional(),_meta:_e(g(),Ue()).optional()}),ne=M({type:C("tool_use"),name:g(),id:g(),input:_e(g(),Ue()),_meta:_e(g(),Ue()).optional()}),he=M({type:C("resource"),resource:Se([Le,et]),annotations:Y.optional(),_meta:_e(g(),Ue()).optional()}),Ne=re.extend({type:C("resource_link")}),ue=Se([le,de,J,Ne,he]),me=M({role:je,content:ue}),Pe=d.extend({description:g().optional(),messages:G(me)}),ke=h.extend({method:C("notifications/prompts/list_changed"),params:u.optional()}),qe=M({title:g().optional(),readOnlyHint:xe().optional(),destructiveHint:xe().optional(),idempotentHint:xe().optional(),openWorldHint:xe().optional()}),O=M({taskSupport:We(["required","optional","forbidden"]).optional()}),fe=M({...L.shape,...E.shape,description:g().optional(),inputSchema:M({type:C("object"),properties:_e(g(),t).optional(),required:G(g()).optional()}).catchall(Ue()),outputSchema:M({type:C("object"),properties:_e(g(),t).optional(),required:G(g()).optional()}).catchall(Ue()).optional(),annotations:qe.optional(),execution:O.optional(),_meta:_e(g(),Ue()).optional()}),te=se.extend({method:C("tools/list")}),ge=oe.extend({tools:G(fe)}),ye=d.extend({content:G(ue),structuredContent:_e(g(),Ue()).optional(),isError:xe().optional()}),ie=c.extend({name:g(),arguments:_e(g(),Ue()).optional()}),De=l.extend({method:C("tools/call"),params:ie}),Ce=h.extend({method:C("notifications/tools/list_changed"),params:u.optional()}),gt=We(["debug","info","notice","warning","error","critical","alert","emergency"]),at=a.extend({level:gt}),nn=l.extend({method:C("logging/setLevel"),params:at}),cn=u.extend({level:gt,logger:g().optional(),data:Ue()}),es=h.extend({method:C("notifications/message"),params:cn}),ts=M({name:g().optional()}),Di=M({hints:G(ts).optional(),costPriority:ae().min(0).max(1).optional(),speedPriority:ae().min(0).max(1).optional(),intelligencePriority:ae().min(0).max(1).optional()}),_i=M({mode:We(["auto","required","none"]).optional()}),ws=M({type:C("tool_result"),toolUseId:g().describe("The unique identifier for the corresponding tool call."),content:G(ue),structuredContent:M({}).loose().optional(),isError:xe().optional(),_meta:_e(g(),Ue()).optional()}),Ui=da("type",[le,de,J]),qn=da("type",[le,de,J,ne,ws]),Pn=M({role:je,content:Se([qn,G(qn)]),_meta:_e(g(),Ue()).optional()}),Si=c.extend({messages:G(Pn),modelPreferences:Di.optional(),systemPrompt:g().optional(),includeContext:We(["none","thisServer","allServers"]).optional(),temperature:ae().optional(),maxTokens:ae().int(),stopSequences:G(g()).optional(),metadata:e.optional(),tools:G(fe).optional(),toolChoice:_i.optional()}),Oi=l.extend({method:C("sampling/createMessage"),params:Si}),Fi=d.extend({model:g(),stopReason:ze(We(["endTurn","stopSequence","maxTokens"]).or(g())),role:je,content:Ui}),ti=d.extend({model:g(),stopReason:ze(We(["endTurn","stopSequence","maxTokens","toolUse"]).or(g())),role:je,content:Se([qn,G(qn)])}),ki=M({type:C("boolean"),title:g().optional(),description:g().optional(),default:xe().optional()}),ni=M({type:C("string"),title:g().optional(),description:g().optional(),minLength:ae().optional(),maxLength:ae().optional(),format:We(["email","uri","date","date-time"]).optional(),default:g().optional()}),zi=M({type:We(["number","integer"]),title:g().optional(),description:g().optional(),minimum:ae().optional(),maximum:ae().optional(),default:ae().optional()}),Bi=M({type:C("string"),title:g().optional(),description:g().optional(),enum:G(g()),default:g().optional()}),ns=M({type:C("string"),title:g().optional(),description:g().optional(),oneOf:G(M({const:g(),title:g()})),default:g().optional()}),is=M({type:C("string"),title:g().optional(),description:g().optional(),enum:G(g()),enumNames:G(g()).optional(),default:g().optional()}),ss=Se([Bi,ns]),vi=M({type:C("array"),title:g().optional(),description:g().optional(),minItems:ae().optional(),maxItems:ae().optional(),items:M({type:C("string"),enum:G(g())}),default:G(g()).optional()}),ii=M({type:C("array"),title:g().optional(),description:g().optional(),minItems:ae().optional(),maxItems:ae().optional(),items:M({anyOf:G(M({const:g(),title:g()}))}),default:G(g()).optional()}),y=Se([vi,ii]),D=Se([is,ss,y]),W=Se([D,ki,ni,zi]),B=c.extend({mode:C("form").optional(),message:g(),requestedSchema:M({type:C("object"),properties:_e(g(),W),required:G(g()).optional()}).catchall(Ue())}),q=c.extend({mode:C("url"),message:g(),elicitationId:g(),url:g().url()}),pe=Se([B,q]),Te=l.extend({method:C("elicitation/create"),params:pe}),ve=u.extend({elicitationId:g()}),we=h.extend({method:C("notifications/elicitation/complete"),params:ve}),Ie=d.extend({action:We(["accept","decline","cancel"]),content:Wr(ln=>ln===null?void 0:ln,_e(g(),Se([g(),ae(),xe(),G(g())])).optional())}),Xe=M({type:C("ref/resource"),uri:g()}),Qe=M({type:C("ref/prompt"),name:g()}),Ae=a.extend({ref:Se([Qe,Xe]),argument:M({name:g(),value:g()}),context:M({arguments:_e(g(),g()).optional()}).optional()}),ct=l.extend({method:C("completion/complete"),params:Ae}),Lt=d.extend({completion:Be({values:G(g()).max(100),total:ze(ae().int()),hasMore:ze(xe())})}),xt=M({uri:g().startsWith("file://"),name:g().optional(),_meta:_e(g(),Ue()).optional()}),pt=l.extend({method:C("roots/list"),params:a.optional()}),Bt=d.extend({roots:G(xt)}),Ee=h.extend({method:C("notifications/roots/list_changed"),params:u.optional()}),$t=Be({ttl:ae().optional(),pollInterval:ae().optional()}),nt=We(["working","input_required","completed","failed","cancelled"]),Vt=M({taskId:g(),status:nt,ttl:Se([ae(),$r()]),createdAt:g(),lastUpdatedAt:g(),pollInterval:ze(ae()),statusMessage:ze(g())}),Nt=d.extend({task:Vt}),In=u.merge(Vt),En=h.extend({method:C("notifications/tasks/status"),params:In}),ut=l.extend({method:C("tasks/get"),params:a.extend({taskId:g()})}),Tt=d.merge(Vt),gn=l.extend({method:C("tasks/result"),params:a.extend({taskId:g()})}),yt=d.loose(),Ot=se.extend({method:C("tasks/list")}),Rt=oe.extend({tasks:G(Vt)}),si=l.extend({method:C("tasks/cancel"),params:a.extend({taskId:g()})});return{JSONValueSchema:t,JSONObjectSchema:e,ProgressTokenSchema:n,CursorSchema:i,TaskMetadataSchema:s,RelatedTaskMetadataSchema:r,RequestMetaSchema:o,BaseRequestParamsSchema:a,TaskAugmentedRequestParamsSchema:c,RequestSchema:l,NotificationsParamsSchema:u,NotificationSchema:h,ResultSchema:d,RequestIdSchema:f,EmptyResultSchema:_,CancelledNotificationParamsSchema:x,CancelledNotificationSchema:m,IconSchema:p,IconsSchema:E,BaseMetadataSchema:L,ImplementationSchema:b,ClientTasksCapabilitySchema:P,ServerTasksCapabilitySchema:v,ClientCapabilitiesSchema:T,InitializeRequestParamsSchema:I,InitializeRequestSchema:N,ServerCapabilitiesSchema:k,InitializeResultSchema:$,InitializedNotificationSchema:U,PingRequestSchema:V,ProgressSchema:Q,ProgressNotificationParamsSchema:X,ProgressNotificationSchema:ce,PaginatedRequestParamsSchema:j,PaginatedRequestSchema:se,PaginatedResultSchema:oe,ResourceContentsSchema:Fe,TextResourceContentsSchema:Le,BlobResourceContentsSchema:et,RoleSchema:je,AnnotationsSchema:Y,ResourceSchema:re,ResourceTemplateSchema:Re,ListResourcesRequestSchema:Ve,ListResourcesResultSchema:Me,ListResourceTemplatesRequestSchema:$e,ListResourceTemplatesResultSchema:Ct,ResourceRequestParamsSchema:Ze,ReadResourceRequestParamsSchema:it,ReadResourceRequestSchema:_t,ReadResourceResultSchema:Je,ResourceListChangedNotificationSchema:vt,SubscribeRequestParamsSchema:Ut,SubscribeRequestSchema:qt,UnsubscribeRequestParamsSchema:bt,UnsubscribeRequestSchema:Pt,ResourceUpdatedNotificationParamsSchema:F,ResourceUpdatedNotificationSchema:zt,PromptArgumentSchema:lt,PromptSchema:R,ListPromptsRequestSchema:S,ListPromptsResultSchema:z,GetPromptRequestParamsSchema:Z,GetPromptRequestSchema:K,TextContentSchema:le,ImageContentSchema:de,AudioContentSchema:J,ToolUseContentSchema:ne,EmbeddedResourceSchema:he,ResourceLinkSchema:Ne,ContentBlockSchema:ue,PromptMessageSchema:me,GetPromptResultSchema:Pe,PromptListChangedNotificationSchema:ke,ToolAnnotationsSchema:qe,ToolExecutionSchema:O,ToolSchema:fe,ListToolsRequestSchema:te,ListToolsResultSchema:ge,CallToolResultSchema:ye,CallToolRequestParamsSchema:ie,CallToolRequestSchema:De,ToolListChangedNotificationSchema:Ce,LoggingLevelSchema:gt,SetLevelRequestParamsSchema:at,SetLevelRequestSchema:nn,LoggingMessageNotificationParamsSchema:cn,LoggingMessageNotificationSchema:es,ModelHintSchema:ts,ModelPreferencesSchema:Di,ToolChoiceSchema:_i,ToolResultContentSchema:ws,SamplingContentSchema:Ui,SamplingMessageContentBlockSchema:qn,SamplingMessageSchema:Pn,CreateMessageRequestParamsSchema:Si,CreateMessageRequestSchema:Oi,CreateMessageResultSchema:Fi,CreateMessageResultWithToolsSchema:ti,BooleanSchemaSchema:ki,StringSchemaSchema:ni,NumberSchemaSchema:zi,UntitledSingleSelectEnumSchemaSchema:Bi,TitledSingleSelectEnumSchemaSchema:ns,LegacyTitledEnumSchemaSchema:is,SingleSelectEnumSchemaSchema:ss,UntitledMultiSelectEnumSchemaSchema:vi,TitledMultiSelectEnumSchemaSchema:ii,MultiSelectEnumSchemaSchema:y,EnumSchemaSchema:D,PrimitiveSchemaDefinitionSchema:W,ElicitRequestFormParamsSchema:B,ElicitRequestURLParamsSchema:q,ElicitRequestParamsSchema:pe,ElicitRequestSchema:Te,ElicitationCompleteNotificationParamsSchema:ve,ElicitationCompleteNotificationSchema:we,ElicitResultSchema:Ie,ResourceTemplateReferenceSchema:Xe,PromptReferenceSchema:Qe,CompleteRequestParamsSchema:Ae,CompleteRequestSchema:ct,CompleteResultSchema:Lt,RootSchema:xt,ListRootsRequestSchema:pt,ListRootsResultSchema:Bt,RootsListChangedNotificationSchema:Ee,TaskCreationParamsSchema:$t,TaskStatusSchema:nt,TaskSchema:Vt,CreateTaskResultSchema:Nt,TaskStatusNotificationParamsSchema:In,TaskStatusNotificationSchema:En,GetTaskRequestSchema:ut,GetTaskResultSchema:Tt,GetTaskPayloadRequestSchema:gn,GetTaskPayloadResultSchema:yt,ListTasksRequestSchema:Ot,ListTasksResultSchema:Rt,CancelTaskRequestSchema:si,CancelTaskResultSchema:d.merge(Vt),ClientRequestSchema:Se([V,N,ct,nn,K,S,Ve,$e,_t,qt,Pt,De,te,ut,gn,Ot,si]),ClientNotificationSchema:Se([m,ce,U,Ee,En]),ClientResultSchema:Se([_,Fi,ti,Ie,Bt,Tt,Rt,Nt]),ServerRequestSchema:Se([V,Oi,Te,pt,ut,gn,Ot,si]),ServerNotificationSchema:Se([m,ce,es,zt,vt,Ce,ke,En,we]),ServerResultSchema:Se([_,$,Lt,Pe,z,Me,Ct,Je,ye,ge,Tt,Rt,Nt]),CallToolResultWireSchema:Ue().superRefine((ln,SS)=>{if(!(typeof ln!="object"||ln===null||Array.isArray(ln)||ln.content!==void 0)){for(const Id of i_)if(Id in ln){SS.addIssue({code:"custom",message:`content is required when the body carries '${Id}' — another result family cannot default into an empty tools/call success`});return}}}).transform(VM).pipe(ye)}}let qM;function s_(){return qM??(qM=GM())}function r_(t){return t.type!=="object"}const $M=new Set(["const","enum","default","examples"]),WM=new Set(["properties","patternProperties","$defs","definitions","dependentSchemas","dependencies"]);function mh(t){return t!==void 0&&!(typeof t=="string"&&t.startsWith("#"))}function ZM(t){const e=typeof t.$schema=="string"?t.$schema:void 0;if(mh(t.$id))return{...e!==void 0&&{$schema:e},type:"object",properties:{result:t},required:["result"]};const n=IS(t.$schema)&&t.$recursiveAnchor!==!0,i=(s,r)=>{if(Array.isArray(s))return s.map(c=>i(c,!1));if(s===null||typeof s!="object"||!r&&mh(s.$id))return s;const o={};let a=!1;for(const[c,l]of Object.entries(s))r?o[c]=i(l,!1):(c==="$ref"||c==="$dynamicRef")&&typeof l=="string"?o[c]=l==="#"?"#/properties/result":l.startsWith("#/")?`#/properties/result${l.slice(1)}`:l:c==="$recursiveRef"&&l==="#"&&n?a=!0:$M.has(c)?o[c]=l:WM.has(c)?o[c]=i(l,!0):o[c]=i(l,!1);return a&&("$ref"in o?o.allOf=[...Array.isArray(o.allOf)?o.allOf:[],{$ref:"#/properties/result"}]:o.$ref="#/properties/result"),o};return{...e!==void 0&&{$schema:e},type:"object",properties:{result:i(t,!1)},required:["result"]}}const XM={ping:null,initialize:null,"completion/complete":null,"logging/setLevel":null,"prompts/get":null,"prompts/list":null,"resources/list":null,"resources/templates/list":null,"resources/read":null,"resources/subscribe":null,"resources/unsubscribe":null,"tools/call":null,"tools/list":null,"tasks/get":null,"tasks/result":null,"tasks/list":null,"tasks/cancel":null,"sampling/createMessage":null,"elicitation/create":null,"roots/list":null},YM={"notifications/cancelled":null,"notifications/progress":null,"notifications/initialized":null,"notifications/roots/list_changed":null,"notifications/tasks/status":null,"notifications/message":null,"notifications/resources/updated":null,"notifications/resources/list_changed":null,"notifications/tools/list_changed":null,"notifications/prompts/list_changed":null,"notifications/elicitation/complete":null},KM={ping:null,initialize:null,"completion/complete":null,"logging/setLevel":null,"prompts/get":null,"prompts/list":null,"resources/list":null,"resources/templates/list":null,"resources/read":null,"resources/subscribe":null,"resources/unsubscribe":null,"tools/call":null,"tools/list":null,"sampling/createMessage":null,"elicitation/create":null,"roots/list":null};let _o;function td(){if(_o)return _o;const t=s_();return _o={requestSchemas:{ping:t.PingRequestSchema,initialize:t.InitializeRequestSchema,"completion/complete":t.CompleteRequestSchema,"logging/setLevel":t.SetLevelRequestSchema,"prompts/get":t.GetPromptRequestSchema,"prompts/list":t.ListPromptsRequestSchema,"resources/list":t.ListResourcesRequestSchema,"resources/templates/list":t.ListResourceTemplatesRequestSchema,"resources/read":t.ReadResourceRequestSchema,"resources/subscribe":t.SubscribeRequestSchema,"resources/unsubscribe":t.UnsubscribeRequestSchema,"tools/call":t.CallToolRequestSchema,"tools/list":t.ListToolsRequestSchema,"tasks/get":t.GetTaskRequestSchema,"tasks/result":t.GetTaskPayloadRequestSchema,"tasks/list":t.ListTasksRequestSchema,"tasks/cancel":t.CancelTaskRequestSchema,"sampling/createMessage":t.CreateMessageRequestSchema,"elicitation/create":t.ElicitRequestSchema,"roots/list":t.ListRootsRequestSchema},notificationSchemas:{"notifications/cancelled":t.CancelledNotificationSchema,"notifications/progress":t.ProgressNotificationSchema,"notifications/initialized":t.InitializedNotificationSchema,"notifications/roots/list_changed":t.RootsListChangedNotificationSchema,"notifications/tasks/status":t.TaskStatusNotificationSchema,"notifications/message":t.LoggingMessageNotificationSchema,"notifications/resources/updated":t.ResourceUpdatedNotificationSchema,"notifications/resources/list_changed":t.ResourceListChangedNotificationSchema,"notifications/tools/list_changed":t.ToolListChangedNotificationSchema,"notifications/prompts/list_changed":t.PromptListChangedNotificationSchema,"notifications/elicitation/complete":t.ElicitationCompleteNotificationSchema},resultSchemas:{ping:t.EmptyResultSchema,initialize:t.InitializeResultSchema,"completion/complete":t.CompleteResultSchema,"logging/setLevel":t.EmptyResultSchema,"prompts/get":t.GetPromptResultSchema,"prompts/list":t.ListPromptsResultSchema,"resources/list":t.ListResourcesResultSchema,"resources/templates/list":t.ListResourceTemplatesResultSchema,"resources/read":t.ReadResourceResultSchema,"resources/subscribe":t.EmptyResultSchema,"resources/unsubscribe":t.EmptyResultSchema,"tools/call":t.CallToolResultWireSchema,"tools/list":t.ListToolsResultSchema,"sampling/createMessage":t.CreateMessageResultWithToolsSchema,"elicitation/create":t.ElicitResultSchema,"roots/list":t.ListRootsResultSchema}},_o}function o_(t){return Object.prototype.hasOwnProperty.call(XM,t)}function a_(t){return Object.prototype.hasOwnProperty.call(YM,t)}function jM(t){return Object.prototype.hasOwnProperty.call(KM,t)}function JM(t){return jM(t)?td().resultSchemas[t]:void 0}function QM(t){return o_(t)?td().requestSchemas[t]:void 0}function eE(t){return a_(t)?td().notificationSchemas[t]:void 0}function fl(t){return t!==null&&typeof t=="object"&&!Array.isArray(t)}function So(t,e){if(t===void 0)return{ok:!1,reason:"not-in-era"};const n=t.safeParse(e);return n.success?{ok:!0,value:n.data}:{ok:!1,reason:"invalid",message:String(n.error)}}const gh={ok:!1,reason:"not-in-era"};function _h(t){return fl(t)&&fl(t.outputSchema)&&r_(t.outputSchema)}const nd={era:"2025-11-25",hasRequestMethod:o_,hasNotificationMethod:a_,validateRequest:(t,e)=>So(QM(t),e),validateResult:(t,e)=>So(JM(t),e),validateNotification:(t,e)=>So(eE(t),e),hasInputRequestMethod:()=>!1,validateInputRequest:()=>gh,validateInputResponse:()=>gh,samplingResultVariant:((t,e)=>{const n=s_();return So(t?n.CreateMessageResultWithToolsSchema:n.CreateMessageResultSchema,e)}),outboundEnvelope:t=>{},validateEnvelopeMeta:t=>[],projectCallToolResult(t,e){const n=n_(t),i=n.structuredContent;if(i===void 0)return n;const s=typeof i!="object"||i===null||Array.isArray(i),r=e!==void 0&&r_(e);return!s&&!r?n:{...n,structuredContent:{result:i}}},decodeResult(t,e){if(fl(e)&&"resultType"in e){const n={...e};return delete n.resultType,{kind:"complete",result:n}}return{kind:"complete",result:e}},encodeResult(t,e){if(t!=="tools/list")return e;const n=e.tools;return!Array.isArray(n)||!n.some(i=>_h(i))?e:{...e,tools:n.map(i=>_h(i)?{...i,outputSchema:ZM(i.outputSchema)}:i)}},encodeErrorCode:t=>t===-32002?-32602:t,checkInboundEnvelope:t=>{}};function tE(){const t=Ru(()=>Se([g(),ae(),xe(),$r(),_e(g(),t),G(t)])),e=_e(g(),t),n=Se([g(),ae().int()]),i=g(),s=Se([g(),ae().int()]),r=We(["user","assistant"]),o=We(["debug","info","notice","warning","error","critical","alert","emergency"]),a=g().refine(Rt=>{try{return atob(Rt),!0}catch{return!1}},{message:"Invalid Base64 string"}),c=M({ttl:ae().optional()}),l=M({taskId:g()}),u=Be({progressToken:n.optional(),"io.modelcontextprotocol/related-task":l.optional()}),h=M({_meta:u.optional()}),d=h.extend({task:c.optional()}),f=M({_meta:u.optional()}),_=M({method:g(),params:f.loose().optional()}),x=M({src:g(),mimeType:g().optional(),sizes:G(g()).optional(),theme:We(["light","dark"]).optional()}),m=M({icons:G(x).optional()}),p=M({name:g(),title:g().optional()}),E=p.extend({...p.shape,...m.shape,version:g(),websiteUrl:g().optional(),description:g().optional()}),L=_s(M({applyDefaults:xe().optional()}),e),b=Wr(Rt=>Rt&&typeof Rt=="object"&&!Array.isArray(Rt)&&Object.keys(Rt).length===0?{form:{}}:Rt,_s(M({form:L.optional(),url:e.optional()}),e.optional())),w=Be({list:e.optional(),cancel:e.optional(),requests:Be({sampling:Be({createMessage:e.optional()}).optional(),elicitation:Be({create:e.optional()}).optional()}).optional()}),A=Be({list:e.optional(),cancel:e.optional(),requests:Be({tools:Be({call:e.optional()}).optional()}).optional()}),P=M({experimental:_e(g(),e).optional(),sampling:M({context:e.optional(),tools:e.optional()}).optional(),elicitation:b.optional(),roots:M({listChanged:xe().optional()}).optional(),tasks:w.optional(),extensions:_e(g(),e).optional()}),v=M({experimental:_e(g(),e).optional(),logging:e.optional(),completions:e.optional(),prompts:M({listChanged:xe().optional()}).optional(),resources:M({subscribe:xe().optional(),listChanged:xe().optional()}).optional(),tools:M({listChanged:xe().optional()}).optional(),tasks:A.optional(),extensions:_e(g(),e).optional()}),T=M({progress:ae(),total:ze(ae()),message:ze(g())}),I=M({...f.shape,...T.shape,progressToken:n}),N=_.extend({method:C("notifications/progress"),params:I}),k=f.extend({level:o,logger:g().optional(),data:Ue()}),$=_.extend({method:C("notifications/message"),params:k}),U=M({uri:g(),mimeType:ze(g()),_meta:_e(g(),Ue()).optional()}),V=U.extend({text:g()}),Q=U.extend({blob:a}),X=M({audience:G(r).optional(),priority:ae().min(0).max(1).optional(),lastModified:Ua({offset:!0}).optional()}),ce=M({...p.shape,...m.shape,uri:g(),description:ze(g()),mimeType:ze(g()),size:ze(ae()),annotations:X.optional(),_meta:ze(Be({}))}),j=M({...p.shape,...m.shape,uriTemplate:g(),description:ze(g()),mimeType:ze(g()),annotations:X.optional(),_meta:ze(Be({}))}),se=_.extend({method:C("notifications/resources/list_changed"),params:f.optional()}),oe=f.extend({uri:g()}),Fe=_.extend({method:C("notifications/resources/updated"),params:oe}),Le=M({name:g(),description:ze(g()),required:ze(xe())}),ft=M({...p.shape,...m.shape,description:ze(g()),arguments:ze(G(Le)),_meta:ze(Be({}))}),et=_.extend({method:C("notifications/prompts/list_changed"),params:f.optional()}),je=M({type:C("text"),text:g(),annotations:X.optional(),_meta:_e(g(),Ue()).optional()}),Y=M({type:C("image"),data:a,mimeType:g(),annotations:X.optional(),_meta:_e(g(),Ue()).optional()}),re=M({type:C("audio"),data:a,mimeType:g(),annotations:X.optional(),_meta:_e(g(),Ue()).optional()}),Re=M({type:C("tool_use"),name:g(),id:g(),input:_e(g(),Ue()),_meta:_e(g(),Ue()).optional()}),Ve=M({type:C("resource"),resource:Se([V,Q]),annotations:X.optional(),_meta:_e(g(),Ue()).optional()}),Me=ce.extend({type:C("resource_link")}),$e=Se([je,Y,re,Me,Ve]),Ct=M({role:r,content:$e}),Ze=M({title:g().optional(),readOnlyHint:xe().optional(),destructiveHint:xe().optional(),idempotentHint:xe().optional(),openWorldHint:xe().optional()}),it=_.extend({method:C("notifications/tools/list_changed"),params:f.optional()}),_t=M({name:g().optional()}),Je=M({hints:G(_t).optional(),costPriority:ae().min(0).max(1).optional(),speedPriority:ae().min(0).max(1).optional(),intelligencePriority:ae().min(0).max(1).optional()}),vt=M({mode:We(["auto","required","none"]).optional()}),Ut=M({type:C("boolean"),title:g().optional(),description:g().optional(),default:xe().optional()}),qt=M({type:C("string"),title:g().optional(),description:g().optional(),minLength:ae().optional(),maxLength:ae().optional(),format:We(["email","uri","date","date-time"]).optional(),default:g().optional()}),bt=M({type:We(["number","integer"]),title:g().optional(),description:g().optional(),minimum:ae().optional(),maximum:ae().optional(),default:ae().optional()}),Pt=M({type:C("string"),title:g().optional(),description:g().optional(),enum:G(g()),default:g().optional()}),F=M({type:C("string"),title:g().optional(),description:g().optional(),oneOf:G(M({const:g(),title:g()})),default:g().optional()}),zt=M({type:C("string"),title:g().optional(),description:g().optional(),enum:G(g()),enumNames:G(g()).optional(),default:g().optional()}),lt=Se([Pt,F]),R=M({type:C("array"),title:g().optional(),description:g().optional(),minItems:ae().optional(),maxItems:ae().optional(),items:M({type:C("string"),enum:G(g())}),default:G(g()).optional()}),S=M({type:C("array"),title:g().optional(),description:g().optional(),minItems:ae().optional(),maxItems:ae().optional(),items:M({anyOf:G(M({const:g(),title:g()}))}),default:G(g()).optional()}),z=Se([R,S]),Z=Se([zt,lt,z]),K=Se([Z,Ut,qt,bt]),le=d.extend({mode:C("form").optional(),message:g(),requestedSchema:M({type:C("object"),properties:_e(g(),K),required:G(g()).optional()}).catchall(Ue())}),de=M({type:C("ref/resource"),uri:g()}),J=M({type:C("ref/prompt"),name:g()}),ne=M({uri:g().startsWith("file://"),name:g().optional(),_meta:_e(g(),Ue()).optional()}),he=P.shape,Ne=M({experimental:he.experimental,sampling:he.sampling,elicitation:he.elicitation,roots:he.roots,extensions:he.extensions}),ue=v.shape,me=M({experimental:ue.experimental,logging:ue.logging,completions:ue.completions,prompts:ue.prompts,resources:ue.resources,tools:ue.tools,extensions:ue.extensions}),Pe=Be({progressToken:n.optional(),[Oa]:g(),[wu]:E.optional(),[Fa]:Ne,[Au]:o.optional()}),ke=M({...p.shape,...m.shape,description:g().optional(),inputSchema:Be({$schema:g().optional(),type:C("object")}),outputSchema:Be({$schema:g().optional()}).optional(),annotations:Ze.optional(),_meta:_e(g(),Ue()).optional()}),qe=M({type:C("tool_result"),toolUseId:g(),content:G($e),structuredContent:Ue().optional(),isError:xe().optional(),_meta:_e(g(),Ue()).optional()}),O=Se([je,Y,re,Re,qe]),fe=M({role:r,content:Se([O,G(O)]),_meta:_e(g(),Ue()).optional()}),te=g(),ge=Be({[Ur]:E.optional().catch(void 0)}),ye=ge.optional();function ie(Rt){return Be({_meta:ye,resultType:te.default("complete"),...Rt})}const De=ie({}),Ce=ie({nextCursor:i.optional()}),gt=ie({content:G($e),structuredContent:Ue().optional(),isError:xe().optional()}),at=ie({ttlMs:ae().int().min(0),cacheScope:We(["public","private"]),tools:G(ke),nextCursor:i.optional()}),nn=ie({ttlMs:ae().int().min(0),cacheScope:We(["public","private"]),prompts:G(ft),nextCursor:i.optional()}),cn=ie({description:g().optional(),messages:G(Ct)}),es=ie({ttlMs:ae().int().min(0),cacheScope:We(["public","private"]),resources:G(ce),nextCursor:i.optional()}),ts=ie({ttlMs:ae().int().min(0),cacheScope:We(["public","private"]),resourceTemplates:G(j),nextCursor:i.optional()}),Di=ie({ttlMs:ae().int().min(0),cacheScope:We(["public","private"]),contents:G(Se([V,Q]))}),_i=ie({completion:M({values:G(g()).max(100),total:ae().int().optional(),hasMore:xe().optional()}).loose()}),ws=ie({ttlMs:ae().int().min(0),cacheScope:We(["public","private"])}),Ui=ie({ttlMs:ae().int().min(0).catch(0),cacheScope:We(["public","private"]).catch("private"),supportedVersions:G(g()),capabilities:me,instructions:g().optional()}),qn=M({messages:G(fe),modelPreferences:Je.optional(),systemPrompt:g().optional(),includeContext:We(["none","thisServer","allServers"]).optional(),temperature:ae().optional(),maxTokens:ae().int(),stopSequences:G(g()).optional(),metadata:e.optional(),tools:G(ke).optional(),toolChoice:vt.optional()}),Pn=M({method:C("sampling/createMessage"),params:qn}),Si=M({method:C("roots/list"),params:M({_meta:_e(g(),Ue()).optional()}).optional()}),Oi=M({...fe.shape,model:g(),stopReason:g().optional()}),Fi=M({roots:G(ne)}),ti=M({action:We(["accept","decline","cancel"]),content:_e(g(),Se([g(),ae(),xe(),G(g())])).optional()}),ki=M({mode:C("url"),message:g(),url:g().url()}),ni=Se([le,ki]),zi=M({method:C("elicitation/create"),params:ni}),Bi=Se([Pn,Si,zi]),ns=Se([Oi,Fi,ti]),is=_e(g(),Bi),ss=_e(g(),ns),vi=ie({inputRequests:is.optional(),requestState:g().optional()}),ii={inputResponses:ss.optional(),requestState:g().optional()},y=M({_meta:Pe,...ii}),D=Be({progressToken:n.optional()});function W(Rt,si){return M({method:C(Rt),params:M({_meta:Pe,...si})})}function B(Rt,si){return M({method:C(Rt),params:M({_meta:D.optional(),...si}).optional()})}const q={name:g(),arguments:_e(g(),Ue()).optional(),...ii},pe={cursor:i.optional()},Te=W("tools/call",q),ve=W("tools/list",pe),we=W("prompts/list",pe),Ie=W("prompts/get",{name:g(),arguments:_e(g(),g()).optional(),...ii}),Xe=W("resources/list",pe),Qe=W("resources/templates/list",pe),Ae=W("resources/read",{uri:g(),...ii}),ct={ref:Se([J,de]),argument:M({name:g(),value:g()}),context:M({arguments:_e(g(),g()).optional()}).optional()},Lt=W("completion/complete",ct),xt=W("server/discover",{}),pt=M({toolsListChanged:xe().optional(),promptsListChanged:xe().optional(),resourcesListChanged:xe().optional(),resourceSubscriptions:G(g()).optional()}),Bt={notifications:pt},Ee=W("subscriptions/listen",Bt),$t=ge.extend({"io.modelcontextprotocol/subscriptionId":s}),nt=Be({_meta:$t,resultType:te.default("complete")}),Vt={"tools/call":B("tools/call",q),"tools/list":B("tools/list",pe),"prompts/get":B("prompts/get",{name:g(),arguments:_e(g(),g()).optional()}),"prompts/list":B("prompts/list",pe),"resources/list":B("resources/list",pe),"resources/templates/list":B("resources/templates/list",pe),"resources/read":B("resources/read",{uri:g()}),"completion/complete":B("completion/complete",ct),"server/discover":B("server/discover",{}),"subscriptions/listen":B("subscriptions/listen",Bt)};function Nt(Rt){return Be({_meta:ye,...Rt})}const In={"tools/call":Nt({content:G($e),structuredContent:Ue().optional(),isError:xe().optional()}),"tools/list":Nt({ttlMs:ae().int().min(0),cacheScope:We(["public","private"]),tools:G(ke),nextCursor:i.optional()}),"prompts/get":Nt({description:g().optional(),messages:G(Ct)}),"prompts/list":Nt({ttlMs:ae().int().min(0),cacheScope:We(["public","private"]),prompts:G(ft),nextCursor:i.optional()}),"resources/list":Nt({ttlMs:ae().int().min(0),cacheScope:We(["public","private"]),resources:G(ce),nextCursor:i.optional()}),"resources/templates/list":Nt({ttlMs:ae().int().min(0),cacheScope:We(["public","private"]),resourceTemplates:G(j),nextCursor:i.optional()}),"resources/read":Nt({ttlMs:ae().int().min(0),cacheScope:We(["public","private"]),contents:G(Se([V,Q]))}),"completion/complete":Nt({completion:M({values:G(g()).max(100),total:ae().int().optional(),hasMore:xe().optional()}).loose()}),"server/discover":Nt({ttlMs:ae().int().min(0).catch(0),cacheScope:We(["public","private"]).catch("private"),supportedVersions:G(g()),capabilities:me,instructions:g().optional()}),"subscriptions/listen":Nt({})},En=Be({"io.modelcontextprotocol/subscriptionId":s.optional()}),ut=M({method:C("notifications/subscriptions/acknowledged"),params:M({_meta:En.optional(),notifications:pt})}),Tt=M({_meta:En.optional(),requestId:s,reason:g().optional()}),gn=M({method:C("notifications/cancelled"),params:Tt}),yt={"notifications/cancelled":gn,"notifications/progress":N,"notifications/message":$,"notifications/resources/updated":Fe,"notifications/resources/list_changed":se,"notifications/tools/list_changed":it,"notifications/prompts/list_changed":et,"notifications/subscriptions/acknowledged":ut},Ot=Rt=>M({jsonrpc:C("2.0"),id:Se([g(),ae().int()]),result:Rt}).strict();return{JSONValueSchema:t,JSONObjectSchema:e,ProgressTokenSchema:n,CursorSchema:i,RequestIdSchema:s,RoleSchema:r,LoggingLevelSchema:o,TaskMetadataSchema:c,RelatedTaskMetadataSchema:l,RequestMetaSchema:u,BaseRequestParamsSchema:h,TaskAugmentedRequestParamsSchema:d,NotificationsParamsSchema:f,NotificationSchema:_,IconSchema:x,IconsSchema:m,BaseMetadataSchema:p,ImplementationSchema:E,ClientTasksCapabilitySchema:w,ServerTasksCapabilitySchema:A,ClientCapabilitiesSchema:P,ServerCapabilitiesSchema:v,ProgressSchema:T,ProgressNotificationParamsSchema:I,ProgressNotificationSchema:N,LoggingMessageNotificationParamsSchema:k,LoggingMessageNotificationSchema:$,ResourceContentsSchema:U,TextResourceContentsSchema:V,BlobResourceContentsSchema:Q,AnnotationsSchema:X,ResourceSchema:ce,ResourceTemplateSchema:j,ResourceListChangedNotificationSchema:se,ResourceUpdatedNotificationParamsSchema:oe,ResourceUpdatedNotificationSchema:Fe,PromptArgumentSchema:Le,PromptSchema:ft,PromptListChangedNotificationSchema:et,TextContentSchema:je,ImageContentSchema:Y,AudioContentSchema:re,ToolUseContentSchema:Re,EmbeddedResourceSchema:Ve,ResourceLinkSchema:Me,ContentBlockSchema:$e,PromptMessageSchema:Ct,ToolAnnotationsSchema:Ze,ToolListChangedNotificationSchema:it,ModelHintSchema:_t,ModelPreferencesSchema:Je,ToolChoiceSchema:vt,BooleanSchemaSchema:Ut,StringSchemaSchema:qt,NumberSchemaSchema:bt,UntitledSingleSelectEnumSchemaSchema:Pt,TitledSingleSelectEnumSchemaSchema:F,LegacyTitledEnumSchemaSchema:zt,SingleSelectEnumSchemaSchema:lt,UntitledMultiSelectEnumSchemaSchema:R,TitledMultiSelectEnumSchemaSchema:S,MultiSelectEnumSchemaSchema:z,EnumSchemaSchema:Z,PrimitiveSchemaDefinitionSchema:K,ElicitRequestFormParamsSchema:le,ResourceTemplateReferenceSchema:de,PromptReferenceSchema:J,RootSchema:ne,ClientCapabilities2026Schema:Ne,ServerCapabilities2026Schema:me,RequestMetaEnvelopeSchema:Pe,ToolSchema:ke,ToolResultContentSchema:qe,SamplingMessageContentBlockSchema:O,SamplingMessageSchema:fe,ResultTypeSchema:te,ResultMetaSchema:ge,ResultSchema:De,PaginatedResultSchema:Ce,CallToolResultSchema:gt,ListToolsResultSchema:at,ListPromptsResultSchema:nn,GetPromptResultSchema:cn,ListResourcesResultSchema:es,ListResourceTemplatesResultSchema:ts,ReadResourceResultSchema:Di,CompleteResultSchema:_i,CacheableResultSchema:ws,DiscoverResultSchema:Ui,CreateMessageRequestParamsSchema:qn,CreateMessageRequestSchema:Pn,ListRootsRequestSchema:Si,CreateMessageResultSchema:Oi,ListRootsResultSchema:Fi,ElicitResultSchema:ti,ElicitRequestURLParamsSchema:ki,ElicitRequestParamsSchema:ni,ElicitRequestSchema:zi,InputRequestSchema:Bi,InputResponseSchema:ns,InputRequestsSchema:is,InputResponsesSchema:ss,InputRequiredResultSchema:vi,InputResponseRequestParamsSchema:y,CallToolRequestSchema:Te,ListToolsRequestSchema:ve,ListPromptsRequestSchema:we,GetPromptRequestSchema:Ie,ListResourcesRequestSchema:Xe,ListResourceTemplatesRequestSchema:Qe,ReadResourceRequestSchema:Ae,CompleteRequestSchema:Lt,DiscoverRequestSchema:xt,SubscriptionFilterSchema:pt,SubscriptionsListenRequestSchema:Ee,SubscriptionsListenResultMetaSchema:$t,SubscriptionsListenResultSchema:nt,dispatchRequestSchemas:Vt,dispatchResultSchemas:In,NotificationMetaSchema:En,SubscriptionsAcknowledgedNotificationSchema:ut,CancelledNotificationParamsSchema:Tt,CancelledNotificationSchema:gn,notificationSchemas2026:yt,JSONRPCResultResponseSchema:Ot(De),CallToolResultResponseSchema:Ot(Se([gt,vi])),ListToolsResultResponseSchema:Ot(at),ListPromptsResultResponseSchema:Ot(nn),GetPromptResultResponseSchema:Ot(Se([cn,vi])),ListResourcesResultResponseSchema:Ot(es),ListResourceTemplatesResultResponseSchema:Ot(ts),ReadResourceResultResponseSchema:Ot(Se([Di,vi])),CompleteResultResponseSchema:Ot(_i),DiscoverResultResponseSchema:Ot(Ui),SubscriptionsListenResultResponseSchema:Ot(nt)}}let nE;function Xi(){return nE??(nE=tE())}const iE=["tools/list","prompts/list","resources/list","resources/templates/list","resources/read","server/discover"];function sE(t){return iE.includes(t)}const id=Symbol("modelcontextprotocol.resultCacheHintFallback");function rE(t){return t[id]}function c_(t){return typeof t=="number"&&Number.isSafeInteger(t)&&t>=0}function l_(t){return t==="public"||t==="private"}let rt=(function(t){return t[t.ParseError=-32700]="ParseError",t[t.InvalidRequest=-32600]="InvalidRequest",t[t.MethodNotFound=-32601]="MethodNotFound",t[t.InvalidParams=-32602]="InvalidParams",t[t.InternalError=-32603]="InternalError",t[t.ResourceNotFound=-32002]="ResourceNotFound",t[t.MissingRequiredClientCapability=-32021]="MissingRequiredClientCapability",t[t.UnsupportedProtocolVersion=-32022]="UnsupportedProtocolVersion",t[t.UrlElicitationRequired=-32042]="UrlElicitationRequired",t})({});var ms,fn=(ms=class extends Error{static[Symbol.hasInstance](e){return fa(this,e)}static isInstance(e){if(typeof this!="function")throw new TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return fa(this,e)}constructor(e,n,i){super(n),this.code=e,this.data=i,this.name="ProtocolError",t_(this,new.target)}static fromError(e,n,i){if(e===rt.UrlElicitationRequired&&i){const s=i;if(s.elicitations)return new aE(s.elicitations,n)}if(e===rt.UnsupportedProtocolVersion&&i){const s=i;if(Array.isArray(s.supported)&&typeof s.requested=="string")return new cE({supported:s.supported,requested:s.requested},n)}if(e===rt.InvalidParams||e===rt.ResourceNotFound){const s=i;if(typeof(s==null?void 0:s.uri)=="string"&&(e===rt.ResourceNotFound||Object.keys(s).length===1))return new oE(s.uri,n)}if(e===rt.MissingRequiredClientCapability&&i){const s=i;if(s.requiredCapabilities!==null&&typeof s.requiredCapabilities=="object"&&!Array.isArray(s.requiredCapabilities))return new lE({requiredCapabilities:s.requiredCapabilities},n)}return new ms(e,n,i)}},Object.defineProperty(ms,"mcpBrand",{value:"mcp.ProtocolError"}),ms),js,oE=(js=class extends fn{constructor(e,n=`Resource not found: ${e}`){super(rt.InvalidParams,n,{uri:e})}get uri(){return this.data.uri}},Object.defineProperty(js,"mcpBrand",{value:"mcp.ResourceNotFoundError"}),js),Js,aE=(Js=class extends fn{constructor(e,n=`URL elicitation${e.length>1?"s":""} required`){super(rt.UrlElicitationRequired,n,{elicitations:e})}get elicitations(){var e;return((e=this.data)==null?void 0:e.elicitations)??[]}},Object.defineProperty(Js,"mcpBrand",{value:"mcp.UrlElicitationRequiredError"}),Js),Qs,cE=(Qs=class extends fn{constructor(e,n=`Unsupported protocol version: ${e.requested}`){super(rt.UnsupportedProtocolVersion,n,e)}get supported(){return this.data.supported}get requested(){return this.data.requested}},Object.defineProperty(Qs,"mcpBrand",{value:"mcp.UnsupportedProtocolVersionError"}),Qs),er,lE=(er=class extends fn{constructor(e,n=`Missing required client capabilities: ${Object.keys(e.requiredCapabilities).join(", ")}`){super(rt.MissingRequiredClientCapability,n,e)}get requiredCapabilities(){return this.data.requiredCapabilities}},Object.defineProperty(er,"mcpBrand",{value:"mcp.MissingRequiredClientCapabilityError"}),er);const uE=0,dE="private",hE=["tools/call","prompts/get","resources/read"];function fE(t,e){const n=e.resultType;if(n===void 0)return{...e,resultType:"complete"};if(n==="complete"||hE.includes(t))return e;throw new fn(rt.InternalError,`Handler for ${t} returned resultType '${String(n)}', but results of ${t} only support 'complete' on protocol revision 2026-07-28`)}function pE(t,e){const n=rE(e);if(e.resultType!=="complete"||!sE(t))return n===void 0?e:vE(e);const i=e,s=c_(i.ttlMs)?i.ttlMs:_E(n),r=l_(i.cacheScope)?i.cacheScope:SE(n),o={...i,ttlMs:s,cacheScope:r};return delete o[id],o}function mE(t){return t!==null&&typeof t=="object"&&!Array.isArray(t)}function gE(t,e){if(e===void 0)return t;const n=t._meta;return n===void 0?{...t,_meta:{[Ur]:e}}:!mE(n)||n[Ur]!==void 0?t:{...t,_meta:{...n,[Ur]:e}}}function _E(t){return t!==void 0&&c_(t.ttlMs)?t.ttlMs:uE}function SE(t){return t!==void 0&&l_(t.cacheScope)?t.cacheScope:dE}function vE(t){const e={...t};return delete e[id],e}const xE=["elicitation/create","sampling/createMessage","roots/list"];let vo;function u_(){if(vo)return vo;const t=Xi();return vo={request:{"elicitation/create":M({method:C("elicitation/create"),params:t.ElicitRequestParamsSchema}),"sampling/createMessage":M({method:C("sampling/createMessage"),params:t.CreateMessageRequestParamsSchema}),"roots/list":M({method:C("roots/list"),params:Be({}).optional()})},response:{"elicitation/create":t.ElicitResultSchema,"sampling/createMessage":t.CreateMessageResultSchema,"roots/list":t.ListRootsResultSchema}},vo}function d_(t){return xE.includes(t)}function fc(t){return d_(t)?u_().request[t]:void 0}function yE(t){return d_(t)?u_().response[t]:void 0}const h_={"tools/call":null,"tools/list":null,"prompts/get":null,"prompts/list":null,"resources/list":null,"resources/templates/list":null,"resources/read":null,"completion/complete":null,"server/discover":null,"subscriptions/listen":null},bE={"notifications/cancelled":null,"notifications/progress":null,"notifications/message":null,"notifications/resources/updated":null,"notifications/resources/list_changed":null,"notifications/tools/list_changed":null,"notifications/prompts/list_changed":null,"notifications/subscriptions/acknowledged":null};function f_(t){return Object.prototype.hasOwnProperty.call(h_,t)}function p_(t){return Object.prototype.hasOwnProperty.call(bE,t)}function ME(t){return Object.prototype.hasOwnProperty.call(h_,t)}function EE(t){return f_(t)?Xi().dispatchRequestSchemas[t]:void 0}function TE(t){return ME(t)?Xi().dispatchResultSchemas[t]:void 0}function RE(t){return p_(t)?Xi().notificationSchemas2026[t]:void 0}function Or(t){return t!==null&&typeof t=="object"&&!Array.isArray(t)}function xr(t,e){if(t===void 0)return{ok:!1,reason:"not-in-era"};const n=t.safeParse(e);return n.success?{ok:!0,value:n.data}:{ok:!1,reason:"invalid",message:String(n.error)}}const wE={ok:!1,reason:"not-in-era"},AE=[Oa,Fa];function CE(t,e){let n=e,i=!1;const s=()=>(i||(n={...n},i=!0),n),r=e.tools;t==="tools/list"&&Array.isArray(r)&&r.some(a=>Or(a)&&"execution"in a)&&(s().tools=r.map(a=>{if(!Or(a)||!("execution"in a))return a;const c={...a};return delete c.execution,c}));const o=e.capabilities;if(Or(o)&&"tasks"in o){const a={...o};delete a.tasks,s().capabilities=a}return n}const sd={era:"2026-07-28",hasRequestMethod:f_,hasNotificationMethod:p_,hasInputRequestMethod:t=>fc(t)!==void 0,validateRequest:(t,e)=>xr(EE(t),e),validateResult:(t,e)=>xr(TE(t),e),validateNotification:(t,e)=>xr(RE(t),e),validateInputRequest:(t,e)=>xr(fc(t),e),validateInputResponse:(t,e)=>xr(yE(t),e),samplingResultVariant:()=>wE,outboundEnvelope(t){return{[Oa]:t.protocolVersion,[wu]:t.clientInfo,[Fa]:t.clientCapabilities,...t.logLevel!==void 0&&{[Au]:t.logLevel}}},validateEnvelopeMeta(t){const e=[];for(const i of AE)i in t||e.push({key:i,problem:"missing"});const n=Xi().RequestMetaEnvelopeSchema.safeParse(t);if(!n.success)for(const i of n.error.issues){const s=i.path.map(String),r=s.length>0?s.join("."):"_meta";s.length===1&&e.some(o=>o.key===r&&o.problem==="missing")||e.push({key:r,problem:i.message})}return e},projectCallToolResult:t=>n_(t),inputRequestSchema:fc,decodeResult(t,e){if(!Or(e))return{kind:"invalid",error:new en(hn.InvalidResult,`Invalid result for ${t}: not an object`,{method:t})};const n=e.resultType;if(n===void 0)return{kind:"invalid",error:new en(hn.InvalidResult,`Invalid result for ${t}: missing required resultType — servers implementing protocol revision 2026-07-28 MUST include it (the absent-means-complete bridge applies only to earlier-revision servers)`,{method:t,violation:"missing-resultType"})};if(typeof n!="string")return{kind:"invalid",error:new en(hn.InvalidResult,`Invalid result for ${t}: non-string resultType`,{method:t,resultType:n})};if(n==="input_required"){const o=e.inputRequests,a=Or(o)?o:{},c=e.requestState,l=e._meta===void 0?void 0:Xi().ResultMetaSchema.safeParse(e._meta),u=l!=null&&l.success?l.data:void 0;return Object.keys(a).length===0&&typeof c!="string"?{kind:"invalid",error:new en(hn.InvalidResult,`Invalid result for ${t}: input_required carries neither inputRequests nor requestState (every input_required result must include at least one of the two)`,{method:t,violation:"input-required-missing-both"})}:{kind:"input_required",inputRequests:a,...typeof c=="string"&&{requestState:c},...u!==void 0&&{_meta:u}}}if(n!=="complete")return{kind:"invalid",error:new en(hn.UnsupportedResultType,`Unsupported result type '${n}' for ${t}`,{resultType:n,method:t})};const i=PE(),s=Object.hasOwn(i,t)?i[t]:void 0;if(s!==void 0){const o=s.safeParse(e);if(!o.success)return{kind:"invalid",error:new en(hn.InvalidResult,`Invalid result for ${t}: ${o.error}`,{method:t})}}const r={...e};return delete r.resultType,{kind:"complete",result:r}},encodeResult(t,e,n){return gE(pE(t,fE(t,CE(t,e))),n)},encodeErrorCode:t=>t===-32002?-32602:t,checkInboundEnvelope(t){if(t.envelope===void 0)return"Request is missing the required _meta envelope for protocol revision 2026-07-28 (io.modelcontextprotocol/protocolVersion, io.modelcontextprotocol/clientCapabilities)";const e=Xi().RequestMetaEnvelopeSchema.safeParse(t.envelope);if(!e.success)return`Invalid _meta envelope for protocol revision 2026-07-28: ${e.error.issues.map(n=>n.message).join("; ")}`}};let xo;function PE(){if(xo)return xo;const t=Xi();return xo={"tools/call":t.CallToolResultSchema,"tools/list":t.ListToolsResultSchema,"prompts/get":t.GetPromptResultSchema,"prompts/list":t.ListPromptsResultSchema,"resources/list":t.ListResourcesResultSchema,"resources/templates/list":t.ListResourceTemplatesResultSchema,"resources/read":t.ReadResourceResultSchema,"completion/complete":t.CompleteResultSchema,"server/discover":t.DiscoverResultSchema},xo}const m_="2026-07-28";function pa(t){return t!==void 0&&HM(t)?sd:nd}function Sh(t){return t.revision!==void 0?pa(t.revision).era:t.era==="modern"?sd.era:nd.era}function pc(t){return g_.some(e=>e.hasRequestMethod(t))}function mc(t){return g_.some(e=>e.hasNotificationMethod(t))}function vh(t){return t==="tasks/get"||t==="tasks/cancel"}const g_=[nd,sd];var IE=wS({AnnotationsSchema:()=>Rs,AudioContentSchema:()=>$a,BaseMetadataSchema:()=>Ss,BaseRequestParamsSchema:()=>mn,BlobResourceContentsSchema:()=>Vu,BooleanSchemaSchema:()=>Xu,CallToolRequestParamsSchema:()=>pg,CallToolRequestSchema:()=>mg,CallToolResultSchema:()=>Za,CancelTaskRequestSchema:()=>EM,CancelTaskResultSchema:()=>TM,CancelledNotificationParamsSchema:()=>vm,CancelledNotificationSchema:()=>Uu,ClientCapabilitiesSchema:()=>Mm,ClientNotificationSchema:()=>wM,ClientRequestSchema:()=>RM,ClientResultSchema:()=>AM,ClientTasksCapabilitySchema:()=>ym,CompatibilityCallToolResultSchema:()=>fM,CompleteRequestParamsSchema:()=>Vg,CompleteRequestSchema:()=>Gg,CompleteResultSchema:()=>qg,ContentBlockSchema:()=>pr,CreateMessageRequestParamsSchema:()=>wg,CreateMessageRequestSchema:()=>Ag,CreateMessageResultSchema:()=>Cg,CreateMessageResultWithToolsSchema:()=>Pg,CreateTaskResultSchema:()=>gM,CursorSchema:()=>Pu,DiscoverRequestSchema:()=>Am,DiscoverResultSchema:()=>Cm,ElicitRequestFormParamsSchema:()=>Ya,ElicitRequestParamsSchema:()=>Ug,ElicitRequestSchema:()=>Og,ElicitRequestURLParamsSchema:()=>Dg,ElicitResultSchema:()=>zg,ElicitationCompleteNotificationParamsSchema:()=>Fg,ElicitationCompleteNotificationSchema:()=>kg,EmbeddedResourceSchema:()=>$u,EmptyResultSchema:()=>Ha,EnumSchemaSchema:()=>Ng,GetPromptRequestParamsSchema:()=>sg,GetPromptRequestSchema:()=>rg,GetPromptResultSchema:()=>cg,GetTaskPayloadRequestSchema:()=>xM,GetTaskPayloadResultSchema:()=>yM,GetTaskRequestSchema:()=>SM,GetTaskResultSchema:()=>vM,IconSchema:()=>xm,IconsSchema:()=>lr,ImageContentSchema:()=>qa,ImplementationSchema:()=>ur,InitializeRequestParamsSchema:()=>Em,InitializeRequestSchema:()=>Tm,InitializeResultSchema:()=>Rm,InitializedNotificationSchema:()=>wm,JSONArraySchema:()=>lM,JSONObjectSchema:()=>Zt,JSONRPCErrorResponseSchema:()=>Ba,JSONRPCMessageSchema:()=>Sm,JSONRPCNotificationSchema:()=>Du,JSONRPCRequestSchema:()=>Nu,JSONRPCResponseSchema:()=>uM,JSONRPCResultResponseSchema:()=>za,JSONValueSchema:()=>rr,LegacyTitledEnumSchemaSchema:()=>ju,ListChangedOptionsBaseSchema:()=>pM,ListPromptsRequestSchema:()=>ng,ListPromptsResultSchema:()=>ig,ListResourceTemplatesRequestSchema:()=>Om,ListResourceTemplatesResultSchema:()=>Fm,ListResourcesRequestSchema:()=>Dm,ListResourcesResultSchema:()=>Um,ListRootsRequestSchema:()=>Wg,ListRootsResultSchema:()=>Zg,ListTasksRequestSchema:()=>bM,ListTasksResultSchema:()=>MM,ListToolsRequestSchema:()=>hg,ListToolsResultSchema:()=>fg,LoggingLevelSchema:()=>Zu,LoggingMessageNotificationParamsSchema:()=>vg,LoggingMessageNotificationSchema:()=>xg,ModelHintSchema:()=>yg,ModelPreferencesSchema:()=>bg,MultiSelectEnumSchemaSchema:()=>Lg,NotificationSchema:()=>Cn,NotificationsParamsSchema:()=>An,NumberSchemaSchema:()=>ha,PaginatedRequestParamsSchema:()=>Lm,PaginatedRequestSchema:()=>dr,PaginatedResultSchema:()=>hr,PingRequestSchema:()=>Fu,PrimitiveSchemaDefinitionSchema:()=>ed,ProgressNotificationParamsSchema:()=>Im,ProgressNotificationSchema:()=>ku,ProgressSchema:()=>Pm,ProgressTokenSchema:()=>Cu,PromptArgumentSchema:()=>eg,PromptListChangedNotificationSchema:()=>lg,PromptMessageSchema:()=>ag,PromptReferenceSchema:()=>Hg,PromptSchema:()=>tg,ReadResourceRequestParamsSchema:()=>km,ReadResourceRequestSchema:()=>zm,ReadResourceResultSchema:()=>Bm,RelatedTaskMetadataSchema:()=>_m,RequestIdSchema:()=>Ts,RequestMetaSchema:()=>Iu,RequestSchema:()=>Xt,ResourceContentsSchema:()=>zu,ResourceLinkSchema:()=>Wu,ResourceListChangedNotificationSchema:()=>Hm,ResourceRequestParamsSchema:()=>Va,ResourceSchema:()=>Gu,ResourceTemplateReferenceSchema:()=>Bg,ResourceTemplateSchema:()=>Nm,ResourceUpdatedNotificationParamsSchema:()=>Jm,ResourceUpdatedNotificationSchema:()=>Qm,ResultMetaObjectSchema:()=>Lu,ResultSchema:()=>Yt,RoleSchema:()=>fr,RootSchema:()=>$g,RootsListChangedNotificationSchema:()=>Xg,SamplingContentSchema:()=>Tg,SamplingMessageContentBlockSchema:()=>Zr,SamplingMessageSchema:()=>Rg,ServerCapabilitiesSchema:()=>Ou,ServerNotificationSchema:()=>PM,ServerRequestSchema:()=>CM,ServerResultSchema:()=>IM,ServerTasksCapabilitySchema:()=>bm,SetLevelRequestParamsSchema:()=>_g,SetLevelRequestSchema:()=>Sg,SingleSelectEnumSchemaSchema:()=>Ig,StringSchemaSchema:()=>Xa,SubscribeRequestParamsSchema:()=>Vm,SubscribeRequestSchema:()=>Gm,SubscriptionFilterSchema:()=>qu,SubscriptionsAcknowledgedNotificationParamsSchema:()=>Xm,SubscriptionsAcknowledgedNotificationSchema:()=>Ym,SubscriptionsListenRequestParamsSchema:()=>Wm,SubscriptionsListenRequestSchema:()=>Zm,SubscriptionsListenResultMetaSchema:()=>Km,SubscriptionsListenResultSchema:()=>jm,TaskAugmentedRequestParamsSchema:()=>so,TaskCreationParamsSchema:()=>mM,TaskMetadataSchema:()=>gm,TaskSchema:()=>mr,TaskStatusNotificationParamsSchema:()=>Kg,TaskStatusNotificationSchema:()=>_M,TaskStatusSchema:()=>Yg,TextContentSchema:()=>Ga,TextResourceContentsSchema:()=>Bu,TitledMultiSelectEnumSchemaSchema:()=>Qu,TitledSingleSelectEnumSchemaSchema:()=>Ku,ToolAnnotationsSchema:()=>ug,ToolChoiceSchema:()=>Mg,ToolExecutionSchema:()=>dg,ToolListChangedNotificationSchema:()=>gg,ToolResultContentSchema:()=>Eg,ToolSchema:()=>Wa,ToolUseContentSchema:()=>og,UnsubscribeRequestParamsSchema:()=>qm,UnsubscribeRequestSchema:()=>$m,UntitledMultiSelectEnumSchemaSchema:()=>Ju,UntitledSingleSelectEnumSchemaSchema:()=>Yu});const LE=t=>Nu.safeParse(t).success,NE=t=>Du.safeParse(t).success,xh=t=>za.safeParse(t).success,DE=t=>Ba.safeParse(t).success,gc=-32020;rt.InvalidRequest,rt.UnsupportedProtocolVersion,rt.InvalidParams,rt.MethodNotFound,rt.InvalidParams,rt.MissingRequiredClientCapability;rt.ParseError+"",rt.InvalidRequest+"",rt.MethodNotFound+"",rt.UnsupportedProtocolVersion+"",rt.MissingRequiredClientCapability+"";function __(t,e){return nm(t,e)}function yr(t){return new Set(t.flatMap(e=>Object.keys(e.shape)))}function pl(t){var n;if(t==null)return!1;const e=typeof t;return e!=="object"&&e!=="function"||!("~standard"in t)?!1:typeof((n=t["~standard"])==null?void 0:n.validate)=="function"}let yh=!1;const ml="draft-2020-12";function UE(t,e="input"){const n=t["~standard"];let i;if(n.jsonSchema)i=n.jsonSchema[e]({target:ml});else if(n.vendor==="zod"){if(!("_zod"in t))throw new Error("Schema appears to be from zod 3, which the SDK cannot convert to JSON Schema. Upgrade to zod >=4.2.0, or wrap your JSON Schema with fromJsonSchema().");yh||(yh=!0,console.warn("[mcp-sdk] Your zod version does not implement `~standard.jsonSchema` (added in zod 4.2.0). Falling back to z.toJSONSchema(). Upgrade to zod >=4.2.0 to silence this warning.")),i=tm(t,{target:ml,io:e})}else throw new Error(`Schema library "${n.vendor}" does not implement StandardJSONSchemaV1 (\`~standard.jsonSchema\`). Upgrade to a version that does, or wrap your JSON Schema with fromJsonSchema().`);if(e==="output")return i.type!==void 0?i:S_(i)?{type:"object",...i}:i;if(i.type!==void 0&&i.type!=="object")throw new Error(`MCP tool and prompt schemas must describe objects (got type: ${JSON.stringify(i.type)}). Wrap your schema in z.object({...}) or equivalent.`);return{type:"object",...i}}function S_(t){if("properties"in t||"patternProperties"in t||"additionalProperties"in t||"required"in t)return!0;for(const e of["oneOf","anyOf","allOf"]){const n=t[e];if(Array.isArray(n)&&n.length>0)return n.every(i=>i!==null&&typeof i=="object"&&(i.type==="object"||S_(i)))}return!1}function OE(t){var e;return(e=t.path)!=null&&e.length?`${t.path.map(n=>String(typeof n=="object"?n.key:n)).join(".")}: ${t.message}`:t.message}async function _c(t,e){const n=await t["~standard"].validate(e);return n.issues&&n.issues.length>0?{success:!1,error:n.issues.map(i=>OE(i)).join(", ")}:{success:!0,data:n.value}}function FE(t){const e=tm(t,{target:ml,io:"input"});return typeof e.pattern=="string"?e.pattern:void 0}const kE=/\\\.\\d\{(\d+)\}/;function zE(t){const e=kE.exec(t),n=[void 0,-1,0];return e&&n.push(Number(e[1])),[!1,!0].flatMap(i=>[!1,!0].flatMap(s=>n.map(r=>Ua({local:i,offset:s,precision:r}))))}function BE(t,e){let n;switch(t){case"email":n=[db()];break;case"uri":n=[cm()];break;case"date":n=[iM()];break;case"date-time":n=zE(e);break}return new Set(n.map(i=>FE(i)).filter(i=>i!==void 0))}function HE(t,e,n){return n!=="zod"?!0:BE(t,e).has(e)}function Xr(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function VE(t){try{return UE(t,"input")}catch(e){const n=e instanceof Error?e.message:String(e);throw new fn(rt.InvalidParams,`Elicitation requestedSchema must describe an object with flat primitive properties: ${n}`)}}const GE=new Set(["$comment","deprecated","description","examples","readOnly","title","writeOnly"]);function rd(t){return GE.has(t)||t.startsWith("x-")}const qE=new Set(["$schema",...Object.keys(Ya.shape.requestedSchema.shape)]),bh={string:yr([Xa,Yu,Ku,ju]),number:yr([ha]),integer:yr([ha]),boolean:yr([Xu]),array:yr([Ju,Qu])},$E=new Set(Xa.shape.format.unwrap().options);function WE(t,e,n,i){if(!Xr(t))return t;const s=typeof t.type=="string"&&Object.hasOwn(bh,t.type)?bh[t.type]:void 0;if(s===void 0)return t;const r={};for(const[o,a]of Object.entries(t))s.has(o)||rd(o)?r[o]=a:o==="pattern"&&t.type==="string"&&typeof t.format=="string"?$E.has(t.format)?(typeof a!="string"||!HE(t.format,a,n))&&i.push(`${e}.${o}`):r[o]=a:i.push(`${e}.${o}`);return r}function ZE(t,e){const n={},i=[];for(const[s,r]of Object.entries(t))s==="properties"&&Xr(r)?n[s]=Object.fromEntries(Object.entries(r).map(([o,a])=>[o,WE(a,`properties.${o}`,e,i)])):qE.has(s)?n[s]=r:rd(s)||i.push(s);if(i.length>0)throw new fn(rt.InvalidParams,`Elicitation requestedSchema contains unsupported JSON Schema constraint(s) after Standard Schema conversion: ${i.join(", ")}`);return n}function XE(t,e){if(!Xr(t.properties))return e;const n=Object.entries(t.properties).filter(([,i])=>!__(ed,i).success).map(([i])=>`properties.${i}`);return n.length>0?n.join(", "):e}function gl(t,e,n=""){return Array.isArray(t)&&Array.isArray(e)?t.flatMap((i,s)=>gl(i,e[s],`${n}[${s}]`)):!Xr(t)||!Xr(e)?[]:Object.entries(t).flatMap(([i,s])=>{const r=n?`${n}.${i}`:i;return Object.prototype.hasOwnProperty.call(e,i)?gl(s,e[i],r):rd(i)?[]:[r]})}function YE(t){if(!pl(t.requestedSchema))return{...t,mode:"form",requestedSchema:t.requestedSchema};const e=t.requestedSchema["~standard"].vendor,n=ZE(VE(t.requestedSchema),e),i=__(Ya.shape.requestedSchema,n);if(!i.success)throw new fn(rt.InvalidParams,`Elicitation requestedSchema only supports flat primitive properties (string, number, integer, boolean, and string enums): ${XE(n,i.error.message)}`);const s=gl(n,i.data);if(s.length>0)throw new fn(rt.InvalidParams,`Elicitation requestedSchema contains unsupported JSON Schema constraint(s) after Standard Schema conversion: ${s.join(", ")}`);const r=(i.data.required??[]).filter(o=>!Object.prototype.hasOwnProperty.call(i.data.properties,o));if(r.length>0)throw new fn(rt.InvalidParams,`Elicitation requestedSchema lists required properties that are not defined in properties: ${r.join(", ")}`);return{...t,mode:"form",requestedSchema:i.data}}function KE(t){const e=t.inputRequests!==void 0&&Object.keys(t.inputRequests).length>0,n=typeof t.requestState=="string";if(!e&&!n)throw new TypeError("inputRequired() requires at least one of inputRequests (with at least one entry) or requestState (spec: every InputRequiredResult MUST include at least one of the two)");return{resultType:"input_required",...t.inputRequests!==void 0&&{inputRequests:t.inputRequests},...t.requestState!==void 0&&{requestState:t.requestState}}}Object.assign(KE,{elicit(t){try{return{method:"elicitation/create",params:YE(t)}}catch(e){throw e instanceof fn?new TypeError(e.message,{cause:e}):e}},elicitUrl(t){return{method:"elicitation/create",params:{...t,mode:"url"}}},createMessage(t){return{method:"sampling/createMessage",params:t}},listRoots(){return{method:"roots/list"}}});const jE=["AnnotationsSchema","AudioContentSchema","BaseMetadataSchema","BlobResourceContentsSchema","BooleanSchemaSchema","CallToolRequestSchema","CallToolRequestParamsSchema","CallToolResultSchema","CancelledNotificationSchema","CancelledNotificationParamsSchema","CancelTaskRequestSchema","CancelTaskResultSchema","ClientCapabilitiesSchema","ClientNotificationSchema","ClientRequestSchema","ClientResultSchema","CompatibilityCallToolResultSchema","CompleteRequestSchema","CompleteRequestParamsSchema","CompleteResultSchema","ContentBlockSchema","CreateMessageRequestSchema","CreateMessageRequestParamsSchema","CreateMessageResultSchema","CreateMessageResultWithToolsSchema","CreateTaskResultSchema","CursorSchema","DiscoverRequestSchema","DiscoverResultSchema","ElicitationCompleteNotificationSchema","ElicitationCompleteNotificationParamsSchema","ElicitRequestSchema","ElicitRequestFormParamsSchema","ElicitRequestParamsSchema","ElicitRequestURLParamsSchema","ElicitResultSchema","EmbeddedResourceSchema","EmptyResultSchema","EnumSchemaSchema","GetPromptRequestSchema","GetPromptRequestParamsSchema","GetPromptResultSchema","GetTaskPayloadRequestSchema","GetTaskPayloadResultSchema","GetTaskRequestSchema","GetTaskResultSchema","IconSchema","IconsSchema","ImageContentSchema","ImplementationSchema","InitializedNotificationSchema","InitializeRequestSchema","InitializeRequestParamsSchema","InitializeResultSchema","JSONArraySchema","JSONObjectSchema","JSONRPCErrorResponseSchema","JSONRPCMessageSchema","JSONRPCNotificationSchema","JSONRPCRequestSchema","JSONRPCResponseSchema","JSONRPCResultResponseSchema","JSONValueSchema","LegacyTitledEnumSchemaSchema","ListPromptsRequestSchema","ListPromptsResultSchema","ListResourcesRequestSchema","ListResourcesResultSchema","ListResourceTemplatesRequestSchema","ListResourceTemplatesResultSchema","ListRootsRequestSchema","ListRootsResultSchema","ListTasksRequestSchema","ListTasksResultSchema","ListToolsRequestSchema","ListToolsResultSchema","LoggingLevelSchema","LoggingMessageNotificationSchema","LoggingMessageNotificationParamsSchema","ModelHintSchema","ModelPreferencesSchema","MultiSelectEnumSchemaSchema","NotificationSchema","NumberSchemaSchema","PaginatedRequestSchema","PaginatedRequestParamsSchema","PaginatedResultSchema","PingRequestSchema","PrimitiveSchemaDefinitionSchema","ProgressSchema","ProgressNotificationSchema","ProgressNotificationParamsSchema","ProgressTokenSchema","PromptSchema","PromptArgumentSchema","PromptListChangedNotificationSchema","PromptMessageSchema","PromptReferenceSchema","ReadResourceRequestSchema","ReadResourceRequestParamsSchema","ReadResourceResultSchema","RelatedTaskMetadataSchema","RequestSchema","RequestIdSchema","RequestMetaSchema","ResourceSchema","ResourceContentsSchema","ResourceLinkSchema","ResourceListChangedNotificationSchema","ResourceRequestParamsSchema","ResourceTemplateSchema","ResourceTemplateReferenceSchema","ResourceUpdatedNotificationSchema","ResourceUpdatedNotificationParamsSchema","ResultMetaObjectSchema","ResultSchema","RoleSchema","RootSchema","RootsListChangedNotificationSchema","SamplingContentSchema","SamplingMessageSchema","SamplingMessageContentBlockSchema","ServerCapabilitiesSchema","ServerNotificationSchema","ServerRequestSchema","ServerResultSchema","SetLevelRequestSchema","SetLevelRequestParamsSchema","SingleSelectEnumSchemaSchema","StringSchemaSchema","SubscribeRequestSchema","SubscribeRequestParamsSchema","SubscriptionFilterSchema","SubscriptionsAcknowledgedNotificationSchema","SubscriptionsAcknowledgedNotificationParamsSchema","SubscriptionsListenRequestSchema","SubscriptionsListenRequestParamsSchema","SubscriptionsListenResultSchema","SubscriptionsListenResultMetaSchema","TaskAugmentedRequestParamsSchema","TaskCreationParamsSchema","TaskMetadataSchema","TaskSchema","TaskStatusSchema","TaskStatusNotificationSchema","TaskStatusNotificationParamsSchema","TextContentSchema","TextResourceContentsSchema","TitledMultiSelectEnumSchemaSchema","TitledSingleSelectEnumSchemaSchema","ToolSchema","ToolAnnotationsSchema","ToolChoiceSchema","ToolExecutionSchema","ToolListChangedNotificationSchema","ToolResultContentSchema","ToolUseContentSchema","UnsubscribeRequestSchema","UnsubscribeRequestParamsSchema","UntitledMultiSelectEnumSchemaSchema","UntitledSingleSelectEnumSchemaSchema"],JE={IdJagTokenExchangeResponseSchema:UM,OAuthClientInformationFullSchema:FM,OAuthClientInformationSchema:e_,OAuthClientMetadataSchema:Qg,OAuthClientRegistrationErrorSchema:kM,OAuthErrorResponseSchema:OM,OAuthMetadataSchema:jg,OAuthProtectedResourceMetadataSchema:LM,OAuthTokenRevocationRequestSchema:zM,OAuthTokensSchema:DM,OpenIdProviderDiscoveryMetadataSchema:NM,OpenIdProviderMetadataSchema:Jg},v_={},x_={};function y_(t,e){const n=t.slice(0,-6);v_[n]=e,x_[n]=i=>e.safeParse(i).success}for(const t of jE)y_(t,IE[t]);for(const[t,e]of Object.entries(JE))y_(t,e);Object.freeze(v_);Object.freeze(x_);function QE(t){switch(t){case"initialize":case"notifications/initialized":return pa(void 0);case"server/discover":return pa(m_);default:return}}const eT=6e4,tT=[Oa,wu,Fa,Au],nT=["inputResponses","requestState"];function Mh(t,e){const n=t.params;if(!Sc(n))return{message:t,lifted:{}};const i=n._meta,s=Sc(i)?tT.filter(c=>c in i):[],r=e==="request"?nT.filter(c=>c in n):[];if(s.length===0&&r.length===0)return{message:t,lifted:{}};const o={},a={...n};if(s.length>0&&Sc(i)){const c={},l={...i};for(const u of s)c[u]=i[u],delete l[u];o.envelope=c,Object.keys(l).length>0?a._meta=l:delete a._meta}for(const c of r)c==="inputResponses"&&(o.inputResponses=a[c]),c==="requestState"&&(o.requestState=a[c]),delete a[c];return{message:{...t,params:a},lifted:o}}function Eh(t,e){const n=t.validateResult(e,void 0);if(!(!n.ok&&n.reason==="not-in-era"))return{"~standard":{version:1,vendor:"mcp-wire-codec",validate(i){const s=t.validateResult(e,i);return s.ok?{value:s.value}:{issues:[{message:s.reason==="invalid"?s.message:`not-in-era: ${e}`}]}}}}}function b_(t){return()=>t}const iT=b_(void 0);var sT=class{constructor(t){He(this,"_transport");He(this,"_requestMessageId",0);He(this,"_requestHandlers",new Map);He(this,"_customSchemaRequestMethods",new Set);He(this,"_requestHandlerAbortControllers",new Map);He(this,"_notificationHandlers",new Map);He(this,"_responseHandlers",new Map);He(this,"_progressHandlers",new Map);He(this,"_timeoutInfo",new Map);He(this,"_pendingDebouncedNotifications",new Set);He(this,"_negotiatedProtocolVersion");He(this,"_supportedProtocolVersions");He(this,"onclose");He(this,"onerror");He(this,"fallbackRequestHandler");He(this,"fallbackNotificationHandler");this._options=t,this._supportedProtocolVersions=(t==null?void 0:t.supportedProtocolVersions)??oM,this.setNotificationHandler("notifications/cancelled",e=>{this._oncancel(e)}),this.setNotificationHandler("notifications/progress",e=>{this._onprogress(e)}),this.setRequestHandler("ping",e=>({}))}_shouldDropInbound(t){}_outboundMetaEnvelope(){}_envelopeOutbound(t){const e=this._outboundMetaEnvelope();if(e===void 0)return t;const n=t.params??{};return{...t,params:{...n,_meta:{...e,...n._meta}}}}_resolveNonCompleteResult(t,e){return Promise.reject(new en(hn.UnsupportedResultType,`Unsupported result type '${t.kind}' for ${e.request.method}`,{resultType:t.kind,method:e.request.method}))}_getRequestHandler(t){return this._requestHandlers.get(t)}async _oncancel(t){var e;t.params.requestId!==void 0&&((e=this._requestHandlerAbortControllers.get(t.params.requestId))==null||e.abort(t.params.reason))}_setupTimeout(t,e,n,i,s=!1){this._timeoutInfo.set(t,{timeoutId:setTimeout(i,e),startTime:Date.now(),timeout:e,maxTotalTimeout:n,resetTimeoutOnProgress:s,onTimeout:i})}_resetTimeout(t){const e=this._timeoutInfo.get(t);if(!e)return!1;const n=Date.now()-e.startTime;if(e.maxTotalTimeout&&n>=e.maxTotalTimeout)throw this._timeoutInfo.delete(t),new en(hn.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:e.maxTotalTimeout,totalElapsed:n});return clearTimeout(e.timeoutId),e.timeoutId=setTimeout(e.onTimeout,e.timeout),!0}_cleanupTimeout(t){const e=this._timeoutInfo.get(t);e&&(clearTimeout(e.timeoutId),this._timeoutInfo.delete(t))}async connect(t){var s,r,o,a;this._transport=t;const e=(s=this.transport)==null?void 0:s.onclose;this._transport.onclose=()=>{try{e==null||e()}finally{this._onclose()}};const n=(r=this.transport)==null?void 0:r.onerror;this._transport.onerror=c=>{n==null||n(c),this._onerror(c)};const i=(o=this._transport)==null?void 0:o.onmessage;this._transport.onmessage=(c,l)=>{i==null||i(c,l),xh(c)||DE(c)?this._onresponse(c):LE(c)?this._onrequest(c,l):NE(c)?this._onnotification(c,l):this._onerror(new Error(`Unknown message type: ${JSON.stringify(c)}`))},(a=t.setSupportedProtocolVersions)==null||a.call(t,this._supportedProtocolVersions),await this._transport.start()}_onclose(){var i;const t=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._pendingDebouncedNotifications.clear();for(const s of this._timeoutInfo.values())clearTimeout(s.timeoutId);this._timeoutInfo.clear();const e=this._requestHandlerAbortControllers;this._requestHandlerAbortControllers=new Map;const n=new en(hn.ConnectionClosed,"Connection closed");this._transport=void 0;try{(i=this.onclose)==null||i.call(this)}finally{for(const s of t.values())s(n);for(const s of e.values())s.abort(n)}}_onerror(t){var e;(e=this.onerror)==null||e.call(this,t)}_onnotification(t,e){const{message:n}=Mh(t,"notification"),i=this._negotiatedWireCodec();if((e==null?void 0:e.classification)===void 0&&this._shouldDropInbound(t)==="drop")return;if((e==null?void 0:e.classification)!==void 0){const o=Sh(e.classification);if(o!==i.era){this._onerror(new Error(`Era mismatch on inbound notification '${n.method}': classified as ${o} but this instance serves ${i.era}`));return}}if(mc(n.method)&&!i.hasNotificationMethod(n.method))return;const s=this._notificationHandlers.get(n.method),r=this.fallbackNotificationHandler;s===void 0&&r===void 0||Promise.resolve().then(()=>s===void 0?r(n):s(n,i)).catch(o=>this._onerror(new Error(`Uncaught error in notification handler: ${o}`)))}_onrequest(t,e){var x;const{message:n,lifted:i}=Mh(t,"request"),s=this._negotiatedWireCodec();if((e==null?void 0:e.classification)===void 0&&this._shouldDropInbound(t)==="drop"){this._onerror(new Error(`Dropped inbound request '${t.method}': not servable on this connection's protocol era`));return}const r=this._transport,o=(m,p,E)=>{const L={jsonrpc:"2.0",id:n.id,error:{code:m,message:p,...E!==void 0&&{data:E}}};r==null||r.send(L).catch(b=>this._onerror(new Error(`Failed to send an error response: ${b}`)))};if((e==null?void 0:e.classification)!==void 0){const m=Sh(e.classification);if(m!==s.era){this._onerror(new Error(`Era mismatch on inbound request '${n.method}': classified as ${m} but this instance serves ${s.era}`));const p=e.classification.revision??m;o(rt.UnsupportedProtocolVersion,`Unsupported protocol version: ${p}`,{supported:this._supportedProtocolVersions,requested:p});return}}if(pc(n.method)&&!s.hasRequestMethod(n.method)&&!(vh(n.method)&&this._customSchemaRequestMethods.has(n.method))){o(rt.MethodNotFound,"Method not found");return}const a=this._requestHandlers.get(n.method)??this.fallbackRequestHandler;if(a===void 0){o(rt.MethodNotFound,"Method not found");return}const c=s.checkInboundEnvelope(i);if(c!==void 0){o(rt.InvalidParams,c);return}const l=(m,p)=>this._notificationViaCodec(this._resolveOutboundCodec(m.method),m,{...p,relatedRequestId:n.id}),u=(m,p,E)=>this._requestWithSchemaViaCodec(this._resolveOutboundCodec(m.method),m,p,{...E,relatedRequestId:n.id}),h=new AbortController;this._requestHandlerAbortControllers.set(n.id,h);const d=i.inputResponses===void 0?void 0:rT(i.inputResponses),f={sessionId:r==null?void 0:r.sessionId,mcpReq:{id:n.id,method:n.method,_meta:(x=n.params)==null?void 0:x._meta,...i.envelope!==void 0&&{envelope:i.envelope},...d!==void 0&&{inputResponses:d.accepted},...d!==void 0&&d.droppedKeys.length>0&&{droppedInputResponseKeys:d.droppedKeys},requestState:i.requestState===void 0?iT:b_(i.requestState),signal:h.signal,send:((m,p,E)=>{const L=this._resolveOutboundCodec(m.method);if(this._assertOutboundRequestInEra(L,m.method),pl(p))return u(m,p,E);const b=Eh(L,m.method);if(b===void 0)throw new TypeError(`'${m.method}' is not a spec method; pass a result schema as the second argument to ctx.mcpReq.send().`);return u(m,b,p)}),notify:l},http:e!=null&&e.authInfo?{authInfo:e.authInfo}:void 0},_=this.buildContext(f,e);Promise.resolve().then(()=>a(n,_)).then(async m=>{if(h.signal.aborted)return;let p;try{p=s.encodeResult(n.method,m,this._outboundServerInfo())}catch(L){this._onerror(new Error(`Failed to encode result for ${n.method}: ${L}`)),o(rt.InternalError,"Internal error");return}const E={result:p,jsonrpc:"2.0",id:n.id};await(r==null?void 0:r.send(E))},async m=>{if(h.signal.aborted)return;const p=Number.isSafeInteger(m.code)?m.code:rt.InternalError,E={jsonrpc:"2.0",id:n.id,error:{code:s.encodeErrorCode(p),message:m.message??"Internal error",...m.data!==void 0&&{data:m.data}}};await(r==null?void 0:r.send(E))}).catch(m=>this._onerror(new Error(`Failed to send response: ${m}`))).finally(()=>{this._requestHandlerAbortControllers.get(n.id)===h&&this._requestHandlerAbortControllers.delete(n.id)})}_onprogress(t){const{progressToken:e,...n}=t.params,i=Number(e),s=this._progressHandlers.get(i);if(!s){this._onerror(new Error(`Received a progress notification for an unknown token: ${JSON.stringify(t)}`));return}const r=this._responseHandlers.get(i),o=this._timeoutInfo.get(i);if(o&&r&&o.resetTimeoutOnProgress)try{this._resetTimeout(i)}catch(a){this._responseHandlers.delete(i),this._progressHandlers.delete(i),this._cleanupTimeout(i),r(a);return}s(n)}_onresponse(t){const e=Number(t.id),n=this._responseHandlers.get(e);if(n===void 0){this._onerror(new Error(`Received a response for an unknown message ID: ${JSON.stringify(t)}`));return}this._responseHandlers.delete(e),this._cleanupTimeout(e),this._progressHandlers.delete(e),xh(t)?n(t):n(fn.fromError(t.error.code,t.error.message,t.error.data))}get transport(){return this._transport}async close(){var t;await((t=this._transport)==null?void 0:t.close())}request(t,e,n){const i=this._resolveOutboundCodec(t.method);if(pl(e))return vh(t.method)||this._assertOutboundRequestInEra(i,t.method),this._requestWithSchemaViaCodec(i,t,e,n);this._assertOutboundRequestInEra(i,t.method);const s=Eh(i,t.method);if(s===void 0)throw new TypeError(`'${t.method}' is not a spec method; pass a result schema as the second argument to request().`);return this._requestWithSchemaViaCodec(i,t,s,e)}_negotiatedWireCodec(){return pa(this._negotiatedProtocolVersion)}_wireCodec(){return this._negotiatedWireCodec()}_resolveOutboundCodec(t){if(this._negotiatedProtocolVersion===void 0){const e=QE(t);if(e)return e}return this._negotiatedWireCodec()}_assertOutboundRequestInEra(t,e){if(pc(e)&&!t.hasRequestMethod(e))throw new en(hn.MethodNotSupportedByProtocolVersion,`Method '${e}' is not supported by the negotiated protocol version (wire era ${t.era})`,{method:e,era:t.era})}_requestWithSchema(t,e,n){const i=this._resolveOutboundCodec(t.method);return this._assertOutboundRequestInEra(i,t.method),this._requestWithSchemaViaCodec(i,t,e,n)}_requestWithSchemaViaCodec(t,e,n,i){const{relatedRequestId:s,resumptionToken:r,onresumptiontoken:o,headers:a}=i??{},c=Date.now();let l,u;return new Promise((h,d)=>{var A,P,v,T;const f=I=>{d(I)};if(!this._transport){f(new Error("Not connected"));return}if(((A=this._options)==null?void 0:A.enforceStrictCapabilities)===!0)try{this.assertCapabilityForMethod(e.method)}catch(I){f(I);return}if((P=i==null?void 0:i.signal)!=null&&P.aborted){const I=i.signal.reason;throw I instanceof en?I:new en(hn.RequestTimeout,String(I))}const _=t.era===m_&&this._transport.hasPerRequestStream===!0?new AbortController:void 0,x=this._requestMessageId++;u=x;const m={...e,jsonrpc:"2.0",id:x};i!=null&&i.onprogress&&(this._progressHandlers.set(x,i.onprogress),m.params={...e.params,_meta:{...(v=e.params)==null?void 0:v._meta,progressToken:x}});const p=this._envelopeOutbound(m);let E=!1;const L=I=>{var N;E||(this._progressHandlers.delete(x),_===void 0?e.method!=="initialize"&&((N=this._transport)==null||N.send(this._envelopeOutbound({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:x,reason:String(I)}}),{relatedRequestId:s,resumptionToken:r,onresumptiontoken:o}).catch(k=>this._onerror(new Error(`Failed to send cancellation: ${k}`)))):_.abort(),d(I instanceof en?I:new en(hn.RequestTimeout,String(I))))};this._responseHandlers.set(x,I=>{var $;if(($=i==null?void 0:i.signal)!=null&&$.aborted)return;if(E=!0,I instanceof Error)return d(I);let N;try{N=t.decodeResult(e.method,I.result)}catch(U){return d(U instanceof Error?U:new Error(String(U)))}if(N.kind==="invalid")return d(N.error);if(N.kind==="input_required"){if((i==null?void 0:i.allowInputRequired)===!0)return h(oT(N));const U={codec:t,request:e,resultSchema:n,options:i,flowStartedAt:c,retry:(V,Q)=>this._requestWithSchemaViaCodec(t,V===void 0?{method:e.method}:{method:e.method,params:V},n,Q)};return h(this._resolveNonCompleteResult(N,U))}const k=N.result;_c(n,k).then(U=>{U.success?h(U.data):d(new en(hn.InvalidResult,`Invalid result for ${e.method}: ${U.error}`))},d)}),l=()=>{var I;return L((I=i==null?void 0:i.signal)==null?void 0:I.reason)},(T=i==null?void 0:i.signal)==null||T.addEventListener("abort",l,{once:!0});const b=(i==null?void 0:i.timeout)??eT,w=()=>L(new en(hn.RequestTimeout,"Request timed out",{timeout:b}));this._setupTimeout(x,b,i==null?void 0:i.maxTotalTimeout,w,(i==null?void 0:i.resetTimeoutOnProgress)??!1),this._transport.send(p,{relatedRequestId:s,resumptionToken:r,onresumptiontoken:o,headers:a,requestSignal:_==null?void 0:_.signal}).catch(I=>{this._progressHandlers.delete(x),d(I)})}).finally(()=>{var h;l&&((h=i==null?void 0:i.signal)==null||h.removeEventListener("abort",l)),u!==void 0&&(this._responseHandlers.delete(u),this._cleanupTimeout(u))})}async notification(t,e){return await this._notificationViaCodec(this._resolveOutboundCodec(t.method),t,e)}async _notificationViaCodec(t,e,n){var s;if(!this._transport)throw new en(hn.NotConnected,"Not connected");if(mc(e.method)&&!t.hasNotificationMethod(e.method))throw new en(hn.MethodNotSupportedByProtocolVersion,`Notification '${e.method}' is not supported by the negotiated protocol version (wire era ${t.era})`,{method:e.method,era:t.era});this.assertNotificationCapability(e.method);const i=this._envelopeOutbound({jsonrpc:"2.0",...e});if((((s=this._options)==null?void 0:s.debouncedNotificationMethods)??[]).includes(e.method)&&!e.params&&(n==null?void 0:n.relatedRequestId)===void 0){if(this._pendingDebouncedNotifications.has(e.method))return;this._pendingDebouncedNotifications.add(e.method),Promise.resolve().then(()=>{var r;this._pendingDebouncedNotifications.delete(e.method),this._transport&&((r=this._transport)==null||r.send(i,n).catch(o=>this._onerror(o)))});return}await this._transport.send(i,n)}setRequestHandler(t,e,n){this.assertRequestHandlerCapability(t);let i;if(typeof e=="function"){if(!pc(t))throw new TypeError(`'${t}' is not a spec request method; pass schemas as the second argument to setRequestHandler().`);i=(s,r)=>{const o=this._negotiatedWireCodec();let a=o.validateRequest(t,s);if(!a.ok&&a.reason==="not-in-era"&&(a=o.validateInputRequest(t,s)),!a.ok)throw a.reason==="not-in-era"?new fn(rt.InternalError,`No wire schema for ${t} in the resolved era`):new Error(a.message);return Promise.resolve(e(a.value,r))}}else if(n)i=async(s,r)=>{const o=await _c(e.params,{...s.params});if(!o.success)throw new fn(rt.InvalidParams,`Invalid params for ${t}: ${o.error}`);return n(o.data,r)};else throw new TypeError("setRequestHandler: handler is required");typeof e=="function"?this._customSchemaRequestMethods.delete(t):this._customSchemaRequestMethods.add(t),this._requestHandlers.set(t,this._wrapHandler(t,i))}_wrapHandler(t,e){return e}_outboundServerInfo(){}removeRequestHandler(t){this._requestHandlers.delete(t),this._customSchemaRequestMethods.delete(t)}assertCanSetRequestHandler(t){if(this._requestHandlers.has(t))throw new Error(`A request handler for ${t} already exists, which would be overridden`)}setNotificationHandler(t,e,n){if(typeof e=="function"){if(!mc(t))throw new TypeError(`'${t}' is not a spec notification method; pass schemas as the second argument to setNotificationHandler().`);this._notificationHandlers.set(t,(i,s)=>{const r=s.validateNotification(t,i);if(!r.ok)throw r.reason==="not-in-era"?new fn(rt.InternalError,`No wire schema for ${t} in the resolved era`):new Error(r.message);return Promise.resolve(e(r.value))});return}if(!n)throw new TypeError("setNotificationHandler: handler is required");this._notificationHandlers.set(t,async i=>{const s=await _c(e.params,{...i.params});if(!s.success)throw new fn(rt.InvalidParams,`Invalid params for notification ${t}: ${s.error}`);await n(s.data,i)})}removeNotificationHandler(t){this._notificationHandlers.delete(t)}};function Sc(t){return t!==null&&typeof t=="object"&&!Array.isArray(t)}function Th(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function rT(t){const e={},n=[];if(!Th(t))return{accepted:e,droppedKeys:n};for(const[i,s]of Object.entries(t)){if(!Th(s)||"method"in s||"result"in s){n.push(i);continue}e[i]=s}return{accepted:e,droppedKeys:n}}function oT(t){return{resultType:"input_required",inputRequests:t.inputRequests,...t.requestState!==void 0&&{requestState:t.requestState},...t._meta!==void 0&&{_meta:t._meta}}}/*!
|
|
64
|
+
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const u of t.seen.entries()){const h=u[1];if(e===u[0]){r(u);continue}if(t.external){const f=(c=t.external.registry.get(u[0]))==null?void 0:c.id;if(e!==u[0]&&f){r(u);continue}}if((l=t.metadataRegistry.get(u[0]))==null?void 0:l.id){r(u);continue}if(h.cycle){r(u);continue}h.count>1&&t.reused==="ref"&&r(u)}t.external&&(t.sharedDefsExtractedFor=t.external)}function cm(t){const e=t.anyOf;if(!Array.isArray(e)||e.length===0||t.type!==void 0)return;const n=[];for(const i of e){if(!i||typeof i!="object")return;cm(i);const s=Object.keys(i);if(s.length!==1||s[0]!=="type")return;const r=i.type;for(const o of Array.isArray(r)?r:[r]){if(typeof o!="string")return;n.includes(o)||n.push(o)}}delete t.anyOf,t.type=n.length===1?n[0]:n}const lm=new Set(["type","properties","required","additionalProperties"]),Fh=["oneOf","anyOf"];function kh(t){const e=t.additionalProperties;return e===void 0||e===!1||typeof e!="object"||e===null?null:Object.keys(e).length?e:null}function wl(t){var r;const e=[];for(const o of t){if(typeof o!="object"||o.type!=="object")return null;for(const a in o)if(!lm.has(a))return null;e.push(o)}const n={},i=new Set;for(const o of e){for(const a in o.properties){if(Object.prototype.hasOwnProperty.call(n,a))continue;const c=[];for(const u of e){const h=((r=u.properties)==null?void 0:r[a])??kh(u);h!=null&&(c.some(d=>JSON.stringify(d)===JSON.stringify(h))||c.push(h))}const l=c.length===1?c[0]:wl(c)??{allOf:c};bi(n,a,l)}for(const a of o.required??[])i.add(a)}const s={type:"object",properties:n};if(i.size&&(s.required=[...i]),e.every(o=>o.additionalProperties===!1))s.additionalProperties=!1;else{const o=[];for(const a of e){const c=kh(a);c&&!o.some(l=>JSON.stringify(l)===JSON.stringify(c))&&o.push(c)}o.length===1?s.additionalProperties=o[0]:o.length>1&&(s.additionalProperties={allOf:o})}return s}function Db(t){const e=t.allOf;if(!Array.isArray(e)||e.length<2)return;for(const s of lm)if(s in t)return;const n=e.filter(s=>Fh.some(r=>Array.isArray(s[r])));let i=null;if(!n.length)i=wl(e);else{const s=n[0],r=Fh.find(c=>Array.isArray(s[c]));if(Object.keys(s).length!==1)return;const o=e.filter(c=>c!==s),a=s[r].map(c=>wl([...o,c]));if(a.some(c=>!c))return;i={[r]:a}}i&&(delete t.allOf,Zr(t,i))}function xa(t,e){var a,c,l,u;const n=t.seen.get(e);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");const i=h=>{const d=t.seen.get(h);if(d.ref===null)return;const f=d.def??d.schema,_={...f},x=d.ref;if(d.ref=null,x){i(x);const p=t.seen.get(x),E=p.schema;if(E.$ref&&(t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0")?(f.allOf=f.allOf??[],f.allOf.push(E)):Zr(f,E),Zr(f,_),h._zod.parent===x)for(const b in f)b==="$ref"||b==="allOf"||b in _||delete f[b];if(E.$ref&&p.def)for(const b in f)b==="$ref"||b==="allOf"||b in p.def&&JSON.stringify(f[b])===JSON.stringify(p.def[b])&&delete f[b]}const m=h._zod.parent;if(m&&m!==x){i(m);const p=t.seen.get(m);if(p!=null&&p.schema.$ref&&(f.$ref=p.schema.$ref,p.def))for(const E in f)E==="$ref"||E==="allOf"||E in p.def&&JSON.stringify(f[E])===JSON.stringify(p.def[E])&&delete f[E]}t.override({zodSchema:h,jsonSchema:f,path:d.path??[]})};if(!t.external||t.sharedEmitDoneFor!==t.external){for(const h of[...t.seen.entries()].reverse())i(h[0]);if(t.target!=="openapi-3.0")for(const h of t.seen.entries())cm(h[1].def??h[1].schema);for(const h of t.deferred)h();if(t.intersections.length){const h=new Map;for(const d of t.seen.values())for(const f of[d.schema,d.def]){const _=f==null?void 0:f.allOf;if(!Array.isArray(_))continue;const x=h.get(_);x?x.push(f):h.set(_,[f])}for(const d of t.intersections)for(const f of h.get(d)??[])Db(f)}}const s={};if(t.target==="draft-2020-12"?s.$schema="https://json-schema.org/draft/2020-12/schema":t.target==="draft-07"?s.$schema="http://json-schema.org/draft-07/schema#":t.target==="draft-04"?s.$schema="http://json-schema.org/draft-04/schema#":t.target,(a=t.external)!=null&&a.uri){const h=(c=t.external.registry.get(e))==null?void 0:c.id;if(!h)throw new Error("Schema is missing an `id` property");s.$id=t.external.uri(h)}Zr(s,n.defId?n.schema:n.def??n.schema);const r=(l=t.metadataRegistry.get(e))==null?void 0:l.id;r!==void 0&&s.id===r&&delete s.id;const o=((u=t.external)==null?void 0:u.defs)??{};if(!t.external||t.sharedEmitDoneFor!==t.external)for(const h of t.seen.entries()){const d=h[1];d.def&&d.defId&&(d.def.id===d.defId&&delete d.def.id,bi(o,d.defId,d.def))}t.external&&(t.sharedEmitDoneFor=t.external),t.external||Object.keys(o).length>0&&(t.target==="draft-2020-12"?s.$defs=o:s.definitions=o);try{const h=JSON.parse(JSON.stringify(s));return Object.defineProperty(h,"~standard",{value:{...e["~standard"],jsonSchema:{input:ya(e,"input",t.processors),output:ya(e,"output",t.processors)}},enumerable:!1,writable:!1}),h}catch{throw new Error("Error converting schema to JSON.")}}function xn(t,e){const n=e??{seen:new Set};if(n.seen.has(t))return!1;n.seen.add(t);const i=t._zod.def;if(i.type==="transform")return!0;if(i.type==="array")return xn(i.element,n);if(i.type==="set")return xn(i.valueType,n);if(i.type==="lazy")return xn(i.getter(),n);if(i.type==="promise"||i.type==="optional"||i.type==="nonoptional"||i.type==="nullable"||i.type==="readonly"||i.type==="default"||i.type==="prefault"||i.type==="catch")return xn(i.innerType,n);if(i.type==="intersection")return xn(i.left,n)||xn(i.right,n);if(i.type==="record"||i.type==="map")return xn(i.keyType,n)||xn(i.valueType,n);if(i.type==="pipe")return t._zod.traits.has("$ZodCodec")?!0:xn(i.in,n)||xn(i.out,n);if(i.type==="object"){for(const s in i.shape)if(xn(i.shape[s],n))return!0;return!1}if(i.type==="union"){for(const s of i.options)if(xn(s,n))return!0;return!1}if(i.type==="tuple"){for(const s of i.items)if(xn(s,n))return!0;return!!(i.rest&&xn(i.rest,n))}return!1}const Ub=(t,e={})=>n=>{const i=Sa({...n,processors:e});return Nt(t,i),va(i,t),xa(i,t)},ya=(t,e,n={})=>i=>{const{libraryOptions:s,target:r}=i??{},o=Sa({...s??{},target:r,io:e,processors:n});return Nt(t,o),va(o,t),xa(o,t)},gr=(t,e,n)=>{(t[e]===void 0||n>t[e])&&(t[e]=n)},_r=(t,e,n)=>{(t[e]===void 0||n<t[e])&&(t[e]=n)},zh=(t,e)=>{gr(t,"minimum",e),_r(t,"maximum",e)},um=(t,e)=>{t.multipleOf??(t.multipleOf=[]),t.multipleOf.includes(e)||t.multipleOf.push(e)},dm=(t,e)=>{t.patterns??(t.patterns=new Set),t.patterns.add(e)},hm=(t,e)=>{t.mime=t.mime?t.mime.filter(n=>e.includes(n)):[...e]},fm=(t,e)=>{t.format=e,e.includes("int")&&(t.isInt=!0)},Bh=(t,e)=>gr(t,"minimum",e.minimum),Hh=(t,e)=>_r(t,"maximum",e.maximum),Vh=t=>(e,n)=>{fm(e,n.format);const[i,s]=t[n.format];gr(e,"minimum",i),_r(e,"maximum",s)},Ic={greater_than:(t,e)=>gr(t,e.inclusive?"minimum":"exclusiveMinimum",e.value),less_than:(t,e)=>_r(t,e.inclusive?"maximum":"exclusiveMaximum",e.value),multiple_of:(t,e)=>um(t,e.value),number_format:Vh(Ip),bigint_format:Vh(qv),min_length:Bh,max_length:Hh,length_equals:(t,e)=>zh(t,e.length),min_size:Bh,max_size:Hh,size_equals:(t,e)=>zh(t,e.size),string_format:(t,e)=>{fm(t,e.format),e.pattern&&dm(t,e.pattern),(e.format==="base64"||e.format==="base64url")&&(t.contentEncoding=e.format),(e.local||e.precision===-1)&&(t.laxFormat=!0)},mime_type:(t,e)=>hm(t,e.mime)};function zn(t){var r;const e={},n=t._zod.def,i=t._zod.traits.has("$ZodCheck")?[t,...n.checks??[]]:n.checks??[];for(const o of i)(r=Ic[o._zod.def.check])==null||r.call(Ic,e,o._zod.def);const s=t._zod.bag;s.minimum!==void 0&&gr(e,"minimum",s.minimum),s.exclusiveMinimum!==void 0&&gr(e,"exclusiveMinimum",s.exclusiveMinimum),s.maximum!==void 0&&_r(e,"maximum",s.maximum),s.exclusiveMaximum!==void 0&&_r(e,"exclusiveMaximum",s.exclusiveMaximum),s.multipleOf!==void 0&&um(e,s.multipleOf),s.format!==void 0&&(e.format??(e.format=s.format),s.format.includes("int")&&(e.isInt=!0)),s.mime&&hm(e,s.mime);for(const o of s.patterns??[])dm(e,o);return e}const Ob={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},Fb=new Map([[Zp,Z0],[qu,X0]]),pm=t=>Fb.get(t)??t,mm=(t,e,n,i)=>{const s=n;s.type="string";const{minimum:r,maximum:o,format:a,patterns:c,contentEncoding:l,laxFormat:u}=zn(t);if(typeof r=="number"&&(s.minLength=r),typeof o=="number"&&(s.maxLength=o),a&&(s.format=Ob[a]??a,s.format===""&&delete s.format,(a==="time"||u)&&delete s.format),l&&(s.contentEncoding=l),c&&c.size>0){const h=[...c].map(pm);h.length===1?s.pattern=h[0].source:h.length>1&&(s.allOf=[...h.map(d=>({...e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0"?{type:"string"}:{},pattern:d.source}))])}},gm=(t,e,n,i)=>{const s=n,{minimum:r,maximum:o,multipleOf:a,exclusiveMaximum:c,exclusiveMinimum:l,isInt:u}=zn(t);s.type=u?"integer":"number";const h=typeof l=="number"&&l>=(r??Number.NEGATIVE_INFINITY),d=typeof c=="number"&&c<=(o??Number.POSITIVE_INFINITY),f=e.target==="draft-04"||e.target==="openapi-3.0";if(h?f?(s.minimum=l,s.exclusiveMinimum=!0):s.exclusiveMinimum=l:typeof r=="number"&&(s.minimum=r),d?f?(s.maximum=c,s.exclusiveMaximum=!0):s.exclusiveMaximum=c:typeof o=="number"&&(s.maximum=o),a){const _=new Set;for(const p of a)Number.isFinite(p)&&p!==0?_.add(Math.abs(p)):un(t,e,s,i,`A multipleOf divisor of ${p} cannot be represented in JSON Schema`);const[x,...m]=_;x!==void 0&&(s.multipleOf=x),m.length&&(s.allOf=[...s.allOf??[],...m.map(p=>({multipleOf:p}))])}},_m=(t,e,n,i)=>{n.type="boolean"},kb=(t,e,n,i)=>{un(t,e,n,i,"BigInt cannot be represented in JSON Schema")},zb=(t,e,n,i)=>{un(t,e,n,i,"Symbols cannot be represented in JSON Schema")},Sm=(t,e,n,i)=>{e.target==="openapi-3.0"?(n.type="string",n.nullable=!0,n.enum=[null]):n.type="null"},vm=(t,e,n,i)=>{un(t,e,n,i,"Undefined cannot be represented in JSON Schema")},Bb=(t,e,n,i)=>{un(t,e,n,i,"Void cannot be represented in JSON Schema")},xm=(t,e,n,i)=>{n.not={}},ym=(t,e,n,i)=>{},bm=(t,e,n,i)=>{},Hb=(t,e,n,i)=>{un(t,e,n,i,"Date cannot be represented in JSON Schema")},Mm=(t,e,n,i)=>{const s=t._zod.def,r=yl(s.entries);if(r.length===0){n.not={};return}r.every(o=>typeof o=="number")&&(n.type="number"),r.every(o=>typeof o=="string")&&(n.type="string"),n.enum=r},Em=(t,e,n,i)=>{const s=t._zod.def;if(s.values.length===0){n.not={};return}const r=[];for(const o of s.values)if(o===void 0){if(un(t,e,n,i,"Literal `undefined` cannot be represented in JSON Schema"))return}else if(typeof o=="bigint"){if(un(t,e,n,i,"BigInt literals cannot be represented in JSON Schema"))return;r.push(Number(o))}else r.push(o);if(r.length!==0)if(r.length===1){const o=r[0];n.type=o===null?"null":typeof o,e.target==="draft-04"||e.target==="openapi-3.0"?n.enum=[o]:n.const=o}else r.every(o=>typeof o=="number")&&(n.type="number"),r.every(o=>typeof o=="string")&&(n.type="string"),r.every(o=>typeof o=="boolean")&&(n.type="boolean"),r.every(o=>o===null)&&(n.type="null"),n.enum=r},Vb=(t,e,n,i)=>{un(t,e,n,i,"NaN cannot be represented in JSON Schema")},Gb=(t,e,n,i)=>{const s=n,r=t._zod.pattern;if(!r)throw new Error("Pattern not found in template literal");s.type="string",s.pattern=r.source},$b=(t,e,n,i)=>{const s=n;s.type="string",s.format="binary",s.contentEncoding="binary";const{minimum:r,maximum:o,mime:a}=zn(t);r!==void 0&&(s.minLength=r),o!==void 0&&(s.maxLength=o),a&&(a.length===0?s.not={}:a.length===1?s.contentMediaType=a[0]:s.anyOf=a.map(c=>({contentMediaType:c})))},qb=(t,e,n,i)=>{n.type="boolean"},Tm=(t,e,n,i)=>{un(t,e,n,i,"Custom types cannot be represented in JSON Schema")},Wb=(t,e,n,i)=>{un(t,e,n,i,"Function types cannot be represented in JSON Schema")},Rm=(t,e,n,i)=>{un(t,e,n,i,"Transforms cannot be represented in JSON Schema")},Zb=(t,e,n,i)=>{un(t,e,n,i,"Map cannot be represented in JSON Schema")},Xb=(t,e,n,i)=>{un(t,e,n,i,"Set cannot be represented in JSON Schema")},wm=(t,e,n,i)=>{const s=n,r=t._zod.def,{minimum:o,maximum:a}=zn(t);typeof o=="number"&&(s.minItems=o),typeof a=="number"&&(s.maxItems=a),s.type="array",s.items=Nt(r.element,e,{...i,path:[...i.path,"items"]})};function no(t){const e=t._zod.def;return e.type==="pipe"&&e.in._zod.traits.has("$ZodTransform")?no(e.out):e.type==="catch"?no(e.innerType):t._zod.optin}const Am=(t,e,n,i)=>{var l;const s=n,r=t._zod.def,o=r.shape;if(Object.getOwnPropertySymbols(o).length&&un(t,e,s,i,"Symbol keys cannot be represented in JSON Schema"))return;s.type="object",s.properties={};for(const u in o)bi(s.properties,u,Nt(o[u],e,{...i,path:[...i.path,"properties",u]}));const c=[];for(const u of Object.keys(o)){const h=r.shape[u];(e.io==="input"?no(h)===void 0:h._zod.optout===void 0)&&c.push(u)}c.length>0&&(s.required=c),((l=r.catchall)==null?void 0:l._zod.def.type)==="never"?s.additionalProperties=!1:r.catchall?r.catchall&&(s.additionalProperties=Nt(r.catchall,e,{...i,path:[...i.path,"additionalProperties"]})):e.io==="output"&&(s.additionalProperties=!1)},Cm=(t,e,n,i)=>{const s=t._zod.def,r=s.inclusive===!1,o=s.options.map((a,c)=>Nt(a,e,{...i,path:[...i.path,r?"oneOf":"anyOf",c]}));r?n.oneOf=o:n.anyOf=o},Pm=(t,e,n,i)=>{const s=t._zod.def,r=Nt(s.left,e,{...i,path:[...i.path,"allOf",0]}),o=Nt(s.right,e,{...i,path:[...i.path,"allOf",1]}),a=l=>"allOf"in l&&Object.keys(l).length===1,c=[...a(r)?r.allOf:[r],...a(o)?o.allOf:[o]];n.allOf=c,e.intersections.push(c)},Yb=(t,e,n,i)=>{const s=n,r=t._zod.def;s.type="array";const o=e.target==="draft-2020-12"?"prefixItems":"items",a=e.target==="draft-2020-12"||e.target==="openapi-3.0"?"items":"additionalItems",c=r.items.map((x,m)=>Nt(x,e,{...i,path:[...i.path,o,m]})),l=r.rest?Nt(r.rest,e,{...i,path:[...i.path,a,...e.target==="openapi-3.0"?[r.items.length]:[]]}):null;let u=r.items.length;for(;u>0;){const x=r.items[u-1];if(!(e.io==="input"?no(x)!==void 0:x._zod.optout==="optional"))break;u--}const h=r.items.length,d=!r.rest;e.target==="draft-2020-12"?(s.prefixItems=c,d?s.items=!1:l&&(s.items=l),u>0&&(s.minItems=u),d&&(s.maxItems=h)):e.target==="openapi-3.0"?(s.items={anyOf:c},l&&s.items.anyOf.push(l),u>0&&(s.minItems=u),d&&(s.maxItems=h)):(s.items=c,d?s.additionalItems=!1:l&&(s.additionalItems=l),u>0&&(s.minItems=u),d&&(s.maxItems=h));const{minimum:f,maximum:_}=zn(t);typeof f=="number"&&(s.minItems=f),typeof _=="number"&&(s.maxItems=_)};function Al(t,e,n){var _;if(e.$ref){if(n.has(e))return e;n.add(e);const x=(_=t.get(e))==null?void 0:_.def;if(!x)return e;const m=Al(t,x,n);return m===x?e:m}for(const x of["anyOf","oneOf"]){const m=e[x];if(!Array.isArray(m))continue;const p=m.map(E=>Al(t,E,n));p.some((E,I)=>E!==m[I])&&(e={...e,[x]:p})}const i=Array.isArray(e.type)?e.type:[e.type],s=!i.includes("string")&&i.some(x=>x==="number"||x==="integer"),r=e.enum??(e.const!==void 0?[e.const]:void 0);if(!s&&!(r!=null&&r.some(x=>typeof x=="number")))return e;const{minimum:o,maximum:a,exclusiveMinimum:c,exclusiveMaximum:l,multipleOf:u,format:h,id:d,...f}=e;return f.enum?f.enum=f.enum.map(x=>typeof x=="number"?String(x):x):typeof f.const=="number"&&(f.const=String(f.const)),s&&(f.type="string",r||(f.pattern=(i.includes("number")?Vu:nx).source)),f}const Cl=new WeakMap;function Kb(t){var i;const e=new Map;for(const s of t.seen.values())s.def&&!e.has(s.schema)&&e.set(s.schema,s);const n=new Map;for(const s of Cl.get(t)??[]){const r=t.seen.get(s),o=(i=(r==null?void 0:r.def)??(r==null?void 0:r.schema))==null?void 0:i.propertyNames;if(!o||o===!0||n.has(o))continue;const a=Al(e,o,new Set);a!==o&&n.set(o,a)}if(n.size)for(const s of t.seen.values())for(const r of[s.schema,s.def]){const o=r&&n.get(r.propertyNames);o&&(r.propertyNames=o)}}const Lm=(t,e,n,i)=>{const s=n,r=t._zod.def;s.type="object";const o=r.keyType,a=zn(o).patterns;if(r.mode==="loose"&&a&&a.size>0){const u=Nt(r.valueType,e,{...i,path:[...i.path,"patternProperties","*"]});s.patternProperties={};for(const h of a)bi(s.patternProperties,pm(h).source,u)}else{if(e.target==="draft-07"||e.target==="draft-2020-12"){s.propertyNames=Nt(r.keyType,e,{...i,path:[...i.path,"propertyNames"]});let u=Cl.get(e);u||(u=[],Cl.set(e,u),e.deferred.push(()=>Kb(e))),u.push(t)}s.additionalProperties=Nt(r.valueType,e,{...i,path:[...i.path,"additionalProperties"]})}const c=o._zod.values,l=e.io==="input"&&no(r.valueType)!==void 0;if(c&&!r.partial&&!l){const u=[...c].filter(h=>typeof h=="string"||typeof h=="number");u.length>0&&(s.required=u.map(String))}},Im=(t,e,n,i)=>{const s=t._zod.def,r=Nt(s.innerType,e,i),o=e.seen.get(t);e.target==="openapi-3.0"?(o.ref=s.innerType,n.nullable=!0):n.anyOf=[r,{type:"null"}]},Nm=(t,e,n,i)=>{const s=t._zod.def;Nt(s.innerType,e,i);const r=e.seen.get(t);r.ref=s.innerType},Zu=Symbol();function Dm(t,e,n,i,s){let r=!1;const o=JSON.stringify(t,(a,c)=>typeof c!="bigint"?c:(r=!0,null));return r?(un(e,n,i,s,"BigInt defaults cannot be represented in JSON Schema"),Zu):JSON.parse(o)}const Um=(t,e,n,i)=>{const s=t._zod.def;Nt(s.innerType,e,i);const r=e.seen.get(t);r.ref=s.innerType;const o=Dm(s.defaultValue,t,e,n,i);o!==Zu&&(n.default=o)},Om=(t,e,n,i)=>{const s=t._zod.def;Nt(s.innerType,e,i);const r=e.seen.get(t);if(r.ref=s.innerType,e.io!=="input")return;const o=Dm(s.defaultValue,t,e,n,i);o!==Zu&&(n._prefault=o)},Fm=(t,e,n,i)=>{const s=t._zod.def;Nt(s.innerType,e,i);const r=e.seen.get(t);r.ref=s.innerType;let o;try{o=s.catchValue(void 0)}catch{un(t,e,n,i,"Dynamic catch values are not supported in JSON Schema");return}n.default=o},km=(t,e,n,i)=>{const s=t._zod.def,r=s.in._zod.traits.has("$ZodTransform"),o=e.io==="input"?r?s.out:s.in:s.out;Nt(o,e,i);const a=e.seen.get(t);a.ref=o},zm=(t,e,n,i)=>{const s=t._zod.def;Nt(s.innerType,e,i);const r=e.seen.get(t);r.ref=s.innerType,n.readOnly=!0},jb=(t,e,n,i)=>{const s=t._zod.def;Nt(s.innerType,e,i);const r=e.seen.get(t);r.ref=s.innerType},Xu=(t,e,n,i)=>{const s=t._zod.def;Nt(s.innerType,e,i);const r=e.seen.get(t);r.ref=s.innerType},Bm=(t,e,n,i)=>{const s=t._zod.innerType;Nt(s,e,i);const r=e.seen.get(t);r.ref=s},Gh={string:mm,number:gm,boolean:_m,bigint:kb,symbol:zb,null:Sm,undefined:vm,void:Bb,never:xm,any:ym,unknown:bm,date:Hb,enum:Mm,literal:Em,nan:Vb,template_literal:Gb,file:$b,success:qb,custom:Tm,function:Wb,transform:Rm,map:Zb,set:Xb,array:wm,object:Am,union:Cm,intersection:Pm,tuple:Yb,record:Lm,nullable:Im,nonoptional:Nm,default:Um,prefault:Om,catch:Fm,pipe:km,readonly:zm,promise:jb,optional:Xu,lazy:Bm};function Hm(t,e){if("_idmap"in t){const i=t,s=Sa({...e,processors:Gh}),r={};for(const c of i._idmap.entries()){const[l,u]=c;Nt(u,s)}const o={},a={registry:i,uri:e==null?void 0:e.uri,defs:r};s.external=a;for(const c of i._idmap.entries()){const[l,u]=c;va(s,u),bi(o,l,xa(s,u))}if(Object.keys(r).length>0){const c=s.target==="draft-2020-12"?"$defs":"definitions";o.__shared={[c]:r}}return{schemas:o}}const n=Sa({...e,processors:Gh});return Nt(t,n),va(n,t),xa(n,t)}const $h=new WeakSet([Object.prototype,Error.prototype]);function To(t,e,n){Object.defineProperty(t,e,{configurable:!0,enumerable:!1,get(){const i=n(this);return Object.defineProperty(this,e,{value:i,configurable:!0,writable:!0}),i},set(i){Object.defineProperty(this,e,{value:i,configurable:!0,writable:!0})}})}const Jb=(t,e)=>{p0.init(t,e),t.name="ZodError";const n=Object.getPrototypeOf(t);$h.has(n)||($h.add(n),To(n,"format",i=>s=>_0(i,s)),To(n,"flatten",i=>s=>g0(i,s)),To(n,"addIssue",i=>s=>{i.issues.push(s),i.message=JSON.stringify(i.issues,bl,2)}),To(n,"addIssues",i=>s=>{i.issues.push(...s),i.message=JSON.stringify(i.issues,bl,2)}),Object.defineProperty(n,"isEmpty",{configurable:!0,enumerable:!1,get(){return this.issues.length===0}}))},Wn=ee("ZodError",Jb,void 0,{Parent:Error}),Qb=ku(Wn),eM=zu(Wn),Vm=Bu(Wn),tM=Hu(Wn),nM=M0(Wn),iM=E0(Wn),sM=T0(Wn),rM=R0(Wn),oM=w0(Wn),aM=A0(Wn),cM=C0(Wn),lM=P0(Wn);function uM(){ni.localeError||ii(ky())}function Za(){ni.memoizer||ii({memoizer:Uy()})}const Pt=ee("ZodType",(t,e)=>(uM(),Ct.init(t,e),t.def=e,t.type=e.type,t),{check(...t){const e=this.def;return this.clone(kn(e,{checks:[...e.checks??[],...t.map(n=>typeof n=="function"?{_zod:{check:n,def:{check:"custom"},onattach:[]}}:n)]}),{parent:!0})},with(...t){return this.check(...t)},clone(t,e){return ls(this,t,e)},brand(){return this},register(t,e){return t.add(this,e),this},refine(t,e){return this.check(iE(t,e))},superRefine(t,e){return this.check(sE(t,e))},overwrite(t){return this.check(br(t))},optional(){return Be(this)},exactOptional(){return GM(this)},nullable(){return Zh(this)},nullish(){return Be(Zh(this))},nonoptional(t){return YM(this,t)},array(){return G(this)},or(t){return Se([this,t])},and(t){return Rs(this,t)},transform(t){return Xh(this,jm(t))},default(t){return WM(this,t)},prefault(t){return XM(this,t)},catch(t){return jM(this,t)},pipe(t){return Xh(this,t)},readonly(){return eE(this)},describe(t){const e=this.clone();return Gr.add(e,{description:t}),e},meta(...t){if(t.length===0)return Gr.get(this);const e=this.clone();return Gr.add(e,t[0]),e},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(t,...e){return e.length===0?t(this):t(this,...e)},get"~standard"(){return Dp(this,"~standard",{...Vp(this),jsonSchema:{input:ya(this,"input"),output:ya(this,"output")}})},set"~standard"(t){as(this,"~standard",t)},parse:function t(e,n){return Qb(this,e,n,{callee:t})},parseAsync:async function t(e,n){return await eM(this,e,n,{callee:t})},safeParse(t,e){return Vm(this,t,e)},async safeParseAsync(t,e){return tM(this,t,e)},get spa(){return this==null?void 0:this.safeParseAsync},set spa(t){as(this,"spa",t)},validate(t,e){return x0(this,t,e)},validateAsync(t,e){return b0(this,t,e)},encode:function t(e,n){return nM(this,e,n,{callee:t})},decode:function t(e,n){return iM(this,e,n,{callee:t})},encodeAsync:async function t(e,n){return await sM(this,e,n,{callee:t})},decodeAsync:async function t(e,n){return await rM(this,e,n,{callee:t})},safeEncode(t,e){return oM(this,t,e)},safeDecode(t,e){return aM(this,t,e)},async safeEncodeAsync(t,e){return cM(this,t,e)},async safeDecodeAsync(t,e){return lM(this,t,e)},toJSONSchema(t){return Ub(this,{})(t)},get description(){var t;return(t=Gr.get(this))==null?void 0:t.description},get _def(){return this._zod.def}}),Gm=ee("_ZodString",(t,e)=>{$u.init(t,e),Pt.init(t,e),t._zod.processJSONSchema=(n,i,s)=>mm(t,n,i)},Up({format:t=>zn(t).format??null,minLength:t=>zn(t).minimum??null,maxLength:t=>zn(t).maximum??null},{regex(...t){return this.check(vb(...t))},includes(...t){return this.check(bb(...t))},startsWith(...t){return this.check(Mb(...t))},endsWith(...t){return this.check(Eb(...t))},min(...t){return this.check(_a(...t))},max(...t){return this.check(om(...t))},length(...t){return this.check(am(...t))},nonempty(...t){return this.check(_a(1,...t))},lowercase(t){return this.check(xb(t))},uppercase(t){return this.check(yb(t))},trim(){return this.check(Rb())},normalize(...t){return this.check(Tb(...t))},toLowerCase(){return this.check(wb())},toUpperCase(){return this.check(Ab())},slugify(){return this.check(Cb())}})),dM=ee("ZodString",(t,e)=>{$u.init(t,e),Gm.init(t,e)},{email(t){return this.check(nm(Wm,t))},url(t){return this.check(im(Zm,t))},jwt(t){return this.check(ab(PM,t))},emoji(t){return this.check(Zy(gM,t))},guid(t){return this.check(Vy(mM,t))},uuid(t){return this.check(Gy(Ro,t))},uuidv4(t){return this.check($y(Ro,t))},uuidv6(t){return this.check(qy(Ro,t))},uuidv7(t){return this.check(Wy(Ro,t))},nanoid(t){return this.check(Xy(_M,t))},cuid(t){return this.check(Yy(SM,t))},cuid2(t){return this.check(Ky(vM,t))},ulid(t){return this.check(jy(xM,t))},base64(t){return this.check(sb(wM,t))},base64url(t){return this.check(rb(AM,t))},xid(t){return this.check(Jy(yM,t))},ksuid(t){return this.check(Qy(bM,t))},ipv4(t){return this.check(eb(MM,t))},ipv6(t){return this.check(tb(EM,t))},cidrv4(t){return this.check(nb(TM,t))},cidrv6(t){return this.check(ib(RM,t))},e164(t){return this.check(ob(CM,t))},datetime(t){return this.check(sm($m,t))},date(t){return this.check(rm(qm,t))},time(t){return this.check(cb(hM,t))},duration(t){return this.check(lb(fM,t))}});function g(t){return Hy(dM,t)}const zt=ee("ZodStringFormat",(t,e)=>{kt.init(t,e),Gm.init(t,e)}),$m=ee("ZodISODateTime",(t,e)=>{zx.init(t,e),zt.init(t,e)}),qm=ee("ZodISODate",(t,e)=>{Bx.init(t,e),zt.init(t,e)}),hM=ee("ZodISOTime",(t,e)=>{Hx.init(t,e),zt.init(t,e)}),fM=ee("ZodISODuration",(t,e)=>{Vx.init(t,e),zt.init(t,e)}),Wm=ee("ZodEmail",(t,e)=>{Tx.init(t,e),zt.init(t,e)});function pM(t){return nm(Wm,t)}const mM=ee("ZodGUID",(t,e)=>{Mx.init(t,e),zt.init(t,e)}),Ro=ee("ZodUUID",(t,e)=>{Ex.init(t,e),zt.init(t,e)}),Zm=ee("ZodURL",(t,e)=>{Lx.init(t,e),zt.init(t,e)});function Xm(t){return im(Zm,t)}const gM=ee("ZodEmoji",(t,e)=>{Ix.init(t,e),zt.init(t,e)}),_M=ee("ZodNanoID",(t,e)=>{Nx.init(t,e),zt.init(t,e)}),SM=ee("ZodCUID",(t,e)=>{Dx.init(t,e),zt.init(t,e)}),vM=ee("ZodCUID2",(t,e)=>{Ux.init(t,e),zt.init(t,e)}),xM=ee("ZodULID",(t,e)=>{Ox.init(t,e),zt.init(t,e)}),yM=ee("ZodXID",(t,e)=>{Fx.init(t,e),zt.init(t,e)}),bM=ee("ZodKSUID",(t,e)=>{kx.init(t,e),zt.init(t,e)}),MM=ee("ZodIPv4",(t,e)=>{Gx.init(t,e),zt.init(t,e)}),EM=ee("ZodIPv6",(t,e)=>{qx.init(t,e),zt.init(t,e)}),TM=ee("ZodCIDRv4",(t,e)=>{Wx.init(t,e),zt.init(t,e)}),RM=ee("ZodCIDRv6",(t,e)=>{Xx.init(t,e),zt.init(t,e)}),wM=ee("ZodBase64",(t,e)=>{Yx.init(t,e),zt.init(t,e)}),AM=ee("ZodBase64URL",(t,e)=>{jx.init(t,e),zt.init(t,e)}),CM=ee("ZodE164",(t,e)=>{Jx.init(t,e),zt.init(t,e)}),PM=ee("ZodJWT",(t,e)=>{ey.init(t,e),zt.init(t,e)}),Yu=ee("ZodNumber",(t,e)=>{Xp.init(t,e),Pt.init(t,e),t._zod.processJSONSchema=(n,i,s)=>gm(t,n,i,s),t.isFinite=!0},Up({minValue:t=>{const{minimum:e,exclusiveMinimum:n}=zn(t);return Math.max(e??Number.NEGATIVE_INFINITY,n??Number.NEGATIVE_INFINITY)},maxValue:t=>{const{maximum:e,exclusiveMaximum:n}=zn(t);return Math.min(e??Number.POSITIVE_INFINITY,n??Number.POSITIVE_INFINITY)},isInt:t=>{const{isInt:e,multipleOf:n}=zn(t);return!!e||!!(n!=null&&n.some(Number.isSafeInteger))},format:t=>zn(t).format??null},{gt(t,e){return this.check(Dh(t,e))},gte(t,e){return this.check(Lc(t,e))},min(t,e){return this.check(Lc(t,e))},lt(t,e){return this.check(Nh(t,e))},lte(t,e){return this.check(Pc(t,e))},max(t,e){return this.check(Pc(t,e))},int(t){return this.check(qh(t))},safe(t){return this.check(qh(t))},positive(t){return this.check(Dh(0,t))},nonnegative(t){return this.check(Lc(0,t))},negative(t){return this.check(Nh(0,t))},nonpositive(t){return this.check(Pc(0,t))},multipleOf(t,e){return this.check(Uh(t,e))},step(t,e){return this.check(Uh(t,e))},finite(){return this}}));function ae(t){return ub(Yu,t)}const LM=ee("ZodNumberFormat",(t,e)=>{ty.init(t,e),Yu.init(t,e)});function qh(t){return hb(LM,t)}const IM=ee("ZodBoolean",(t,e)=>{ny.init(t,e),Pt.init(t,e),t._zod.processJSONSchema=(n,i,s)=>_m(t,n,i)});function xe(t){return fb(IM,t)}const NM=ee("ZodUndefined",(t,e)=>{iy.init(t,e),Pt.init(t,e),t._zod.processJSONSchema=(n,i,s)=>vm(t,n,i,s)});function Pl(t){return pb(NM,t)}const DM=ee("ZodNull",(t,e)=>{sy.init(t,e),Pt.init(t,e),t._zod.processJSONSchema=(n,i,s)=>Sm(t,n,i)});function io(t){return mb(DM,t)}const UM=ee("ZodAny",(t,e)=>{ry.init(t,e),Pt.init(t,e),t._zod.processJSONSchema=(n,i,s)=>ym()});function Ku(){return gb(UM)}const OM=ee("ZodUnknown",(t,e)=>{oy.init(t,e),Pt.init(t,e),t._zod.processJSONSchema=(n,i,s)=>bm()});function Ue(){return _b(OM)}const FM=ee("ZodNever",(t,e)=>{ay.init(t,e),Pt.init(t,e),t._zod.processJSONSchema=(n,i,s)=>xm(t,n,i)});function Ll(t){return Sb(FM,t)}const kM=ee("ZodArray",(t,e)=>{Za(),uy.init(t,e),Pt.init(t,e),t._zod.processJSONSchema=(n,i,s)=>wm(t,n,i,s),t.element=e.element},{min(t,e){return this.check(_a(t,e))},nonempty(t){return this.check(_a(1,t))},max(t,e){return this.check(om(t,e))},length(t,e){return this.check(am(t,e))},unwrap(){return this.element}});function G(t,e){return Pb(kM,t,e)}const Ym=ee("ZodObject",(t,e)=>{Za(),fy.init(t,e),Pt.init(t,e),t._zod.processJSONSchema=(n,i,s)=>Am(t,n,i,s),r0(t,"shape",n=>n._zod.def.shape,!1)},{keyof(){return Ze(Object.keys(this._zod.def.shape))},catchall(t){return this.clone(kn(this._zod.def,{catchall:t}))},passthrough(){return this.clone(kn(this._zod.def,{catchall:Ue()}))},loose(){return this.clone(kn(this._zod.def,{catchall:Ue()}))},strict(){return this.clone(kn(this._zod.def,{catchall:Ll()}))},strip(){return this.clone(kn(this._zod.def,{catchall:void 0}))},extend(t){return Xv(this,t)},safeExtend(t){return Yv(this,t)},merge(t){return Kv(this,t)},pick(t){return Wv(this,t)},omit(t){return Zv(this,t)},partial(...t){return mh(Jm,this,t[0])},exactPartial(...t){return mh(Qm,this,t[0],"exactPartial")},required(...t){return jv(eg,this,t[0])}});function M(t,e){const n={type:"object",shape:t??{},...Oe(e)};return new Ym(n)}function He(t,e){return new Ym({type:"object",shape:t,catchall:Ue(),...Oe(e)})}const Km=ee("ZodUnion",(t,e)=>{jp.init(t,e),Pt.init(t,e),t._zod.processJSONSchema=(n,i,s)=>Cm(t,n,i,s),t.options=e.options});function Se(t,e){return new Km({type:"union",options:t,...Oe(e)})}const zM=ee("ZodDiscriminatedUnion",(t,e)=>{Km.init(t,e),my.init(t,e)});function ba(t,e,n){return new zM({type:"union",options:e,discriminator:t,...Oe(n)})}const BM=ee("ZodIntersection",(t,e)=>{gy.init(t,e),Pt.init(t,e),t._zod.processJSONSchema=(n,i,s)=>Pm(t,n,i,s)});function Rs(t,e){return new BM({type:"intersection",left:t,right:e})}const Wh=ee("ZodRecord",(t,e)=>{Za(),_y.init(t,e),Pt.init(t,e),t._zod.processJSONSchema=(n,i,s)=>Lm(t,n,i,s),t.keyType=e.keyType,t.valueType=e.valueType});function _e(t,e,n){return!e||!e._zod?new Wh({type:"record",keyType:g(),valueType:t,...Oe(e)}):new Wh({type:"record",keyType:t,valueType:e,...Oe(n)})}const Il=ee("ZodEnum",(t,e)=>{Sy.init(t,e),Pt.init(t,e),t._zod.processJSONSchema=(i,s,r)=>Mm(t,i,s),t.enum=e.entries,t.options=[...t._zod.values];const n=new Set(Object.keys(e.entries));t.extract=(i,s)=>{const r={};for(const o of i)if(n.has(o))r[o]=e.entries[o];else throw new Error(`Key ${o} not found in enum`);return new Il({...e,checks:[],...Oe(s),entries:r})},t.exclude=(i,s)=>{const r={...e.entries};for(const o of i)if(n.has(o))delete r[o];else throw new Error(`Key ${o} not found in enum`);return new Il({...e,checks:[],...Oe(s),entries:r})}});function Ze(t,e){const n=Array.isArray(t)?Object.fromEntries(t.map(i=>[i,i])):t;return new Il({type:"enum",entries:n,...Oe(e)})}const HM=ee("ZodLiteral",(t,e)=>{vy.init(t,e),Pt.init(t,e),t._zod.processJSONSchema=(n,i,s)=>Em(t,n,i,s),t.values=new Set(e.values),Object.defineProperty(t,"value",{get(){if(e.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return e.values[0]}})});function C(t,e){return new HM({type:"literal",values:Array.isArray(t)?t:[t],...Oe(e)})}const VM=ee("ZodTransform",(t,e)=>{Za(),xy.init(t,e),Pt.init(t,e),t._zod.processJSONSchema=(n,i,s)=>Rm(t,n,i,s),t._zod.parse=(n,i)=>{if(i.direction==="backward")throw new Op(t.constructor.name);n.addIssue=r=>{if(typeof r=="string")n.issues.push(to(r,n.value,e));else{const o=r;o.fatal&&(o.continue=!1),o.code??(o.code="custom"),"input"in o||(o.input=n.value),o.inst??(o.inst=t),n.issues.push(to(o))}};const s=e.transform(n.value,n);return s instanceof Promise?s.then(r=>(n.value=r,n)):(n.value=s,n)}});function jm(t){return new VM({type:"transform",transform:t})}const Jm=ee("ZodOptional",(t,e)=>{Jp.init(t,e),Pt.init(t,e),t._zod.processJSONSchema=(n,i,s)=>Xu(t,n,i,s),t.unwrap=()=>t._zod.def.innerType});function Be(t){return new Jm({type:"optional",innerType:t})}const Qm=ee("ZodExactOptional",(t,e)=>{yy.init(t,e),Pt.init(t,e),t._zod.processJSONSchema=(n,i,s)=>Xu(t,n,i,s),t.unwrap=()=>t._zod.def.innerType});function GM(t){return new Qm({type:"optional",innerType:t})}const $M=ee("ZodNullable",(t,e)=>{by.init(t,e),Pt.init(t,e),t._zod.processJSONSchema=(n,i,s)=>Im(t,n,i,s),t.unwrap=()=>t._zod.def.innerType});function Zh(t){return new $M({type:"nullable",innerType:t})}const qM=ee("ZodDefault",(t,e)=>{My.init(t,e),Pt.init(t,e),t._zod.processJSONSchema=(n,i,s)=>Um(t,n,i,s),t.unwrap=()=>t._zod.def.innerType,t.removeDefault=t.unwrap});function WM(t,e){return new qM({type:"default",innerType:t,get defaultValue(){return typeof e=="function"?e():Pp(e)}})}const ZM=ee("ZodPrefault",(t,e)=>{Ey.init(t,e),Pt.init(t,e),t._zod.processJSONSchema=(n,i,s)=>Om(t,n,i,s),t.unwrap=()=>t._zod.def.innerType});function XM(t,e){return new ZM({type:"prefault",innerType:t,get defaultValue(){return typeof e=="function"?e():Pp(e)}})}const eg=ee("ZodNonOptional",(t,e)=>{Ty.init(t,e),Pt.init(t,e),t._zod.processJSONSchema=(n,i,s)=>Nm(t,n,i,s),t.unwrap=()=>t._zod.def.innerType});function YM(t,e){return new eg({type:"nonoptional",innerType:t,...Oe(e)})}const KM=ee("ZodCatch",(t,e)=>{Ry.init(t,e),Pt.init(t,e),t._zod.processJSONSchema=(n,i,s)=>Fm(t,n,i,s),t.unwrap=()=>t._zod.def.innerType,t.removeCatch=t.unwrap});function jM(t,e){return new KM({type:"catch",innerType:t,catchValue:typeof e=="function"?e:a0(e)})}const tg=ee("ZodPipe",(t,e)=>{Qp.init(t,e),Pt.init(t,e),t._zod.processJSONSchema=(n,i,s)=>km(t,n,i,s),t.in=e.in,t.out=e.out});function Xh(t,e){return new tg({type:"pipe",in:t,out:e})}const JM=ee("ZodPreprocess",(t,e)=>{tg.init(t,e),wy.init(t,e)}),QM=ee("ZodReadonly",(t,e)=>{Ay.init(t,e),Pt.init(t,e),t._zod.processJSONSchema=(n,i,s)=>zm(t,n,i,s),t.unwrap=()=>t._zod.def.innerType});function eE(t){return new QM({type:"readonly",innerType:t})}const tE=ee("ZodLazy",(t,e)=>{Cy.init(t,e),Pt.init(t,e),t._zod.processJSONSchema=(n,i,s)=>Bm(t,n,i,s),t.unwrap=()=>t._zod.def.getter()});function ju(t){return new tE({type:"lazy",getter:t})}const nE=ee("ZodCustom",(t,e)=>{Py.init(t,e),Pt.init(t,e),t._zod.processJSONSchema=(n,i,s)=>Tm(t,n,i,s)});function iE(t,e={}){return Lb(nE,t,e)}function sE(t,e){return Ib(t,e)}function so(t,e){return new JM({type:"pipe",in:jm(t),out:e})}const rE={custom:"custom"};function Xa(t){return sm($m,t)}function oE(t){return rm(qm,t)}function aE(t){return db(Yu,t)}const cE="2025-11-25",lE=[cE,"2025-06-18","2025-03-26","2024-11-05","2024-10-07"],uE="io.modelcontextprotocol/related-task",Ya="io.modelcontextprotocol/protocolVersion",Ju="io.modelcontextprotocol/clientInfo",Xr="io.modelcontextprotocol/serverInfo",Ka="io.modelcontextprotocol/clientCapabilities",dE="io.modelcontextprotocol/subscriptionId",Qu="io.modelcontextprotocol/logLevel",ja="2.0",Sr=ju(()=>Se([g(),ae(),xe(),io(),_e(g(),Sr),G(Sr)])),Xt=_e(g(),Sr),hE=G(Sr),ed=Se([g(),ae().int()]),td=g(),ng=M({ttl:ae().optional()}),ig=M({taskId:g()}),nd=He({progressToken:ed.optional(),[uE]:ig.optional()}),Sn=M({_meta:nd.optional()}),go=Sn.extend({task:ng.optional()}),Kt=M({method:g(),params:Sn.loose().optional()}),Ln=M({_meta:nd.optional()}),In=M({method:g(),params:Ln.loose().optional()}),id=He({get[Xr](){return Er.optional().catch(void 0)}}),jt=He({_meta:id.optional()}),Us=Se([g(),ae().int()]),sd=M({jsonrpc:C(ja),id:Us,...Kt.shape}).strict(),rd=M({jsonrpc:C(ja),...In.shape}).strict(),Ja=M({jsonrpc:C(ja),id:Us,result:jt}).strict(),Qa=M({jsonrpc:C(ja),id:Us.optional(),error:M({code:ae().int(),message:g(),data:Ue().optional()})}).strict(),sg=Se([sd,rd,Ja,Qa]),fE=Se([Ja,Qa]),ec=jt.strict(),rg=Ln.extend({requestId:Us.optional(),reason:g().optional()}),od=In.extend({method:C("notifications/cancelled"),params:rg}),og=M({src:g(),mimeType:g().optional(),sizes:G(g()).optional(),theme:Ze(["light","dark"]).optional()}),Mr=M({icons:G(og).optional()}),ws=M({name:g(),title:g().optional()}),Er=ws.extend({...ws.shape,...Mr.shape,version:g(),websiteUrl:g().optional(),description:g().optional()}),pE=Rs(M({applyDefaults:xe().optional()}),Xt),mE=so(t=>t&&typeof t=="object"&&!Array.isArray(t)&&Object.keys(t).length===0?{form:{}}:t,Rs(M({form:pE.optional(),url:Xt.optional()}),Xt.optional())),ag=He({list:Xt.optional(),cancel:Xt.optional(),requests:He({sampling:He({createMessage:Xt.optional()}).optional(),elicitation:He({create:Xt.optional()}).optional()}).optional()}),cg=He({list:Xt.optional(),cancel:Xt.optional(),requests:He({tools:He({call:Xt.optional()}).optional()}).optional()}),lg=M({experimental:_e(g(),Xt).optional(),sampling:M({context:Xt.optional(),tools:Xt.optional()}).optional(),elicitation:mE.optional(),roots:M({listChanged:xe().optional()}).optional(),tasks:ag.optional(),extensions:_e(g(),Xt).optional()}),ug=Sn.extend({protocolVersion:g(),capabilities:lg,clientInfo:Er}),dg=Kt.extend({method:C("initialize"),params:ug}),ad=M({experimental:_e(g(),Xt).optional(),logging:Xt.optional(),completions:Xt.optional(),prompts:M({listChanged:xe().optional()}).optional(),resources:M({subscribe:xe().optional(),listChanged:xe().optional()}).optional(),tools:M({listChanged:xe().optional()}).optional(),tasks:cg.optional(),extensions:_e(g(),Xt).optional()}),hg=jt.extend({protocolVersion:g(),capabilities:ad,serverInfo:Er,instructions:g().optional()}),fg=In.extend({method:C("notifications/initialized"),params:Ln.optional()}),pg=Kt.extend({method:C("server/discover"),params:Sn.optional()}),mg=jt.extend({supportedVersions:G(g()),capabilities:ad,instructions:g().optional()}),cd=Kt.extend({method:C("ping"),params:Sn.optional()}),gg=M({progress:ae(),total:Be(ae()),message:Be(g())}),_g=M({...Ln.shape,...gg.shape,progressToken:ed}),ld=In.extend({method:C("notifications/progress"),params:_g}),Sg=Sn.extend({cursor:td.optional()}),Tr=Kt.extend({params:Sg.optional()}),Rr=jt.extend({nextCursor:td.optional()}),ud=M({uri:g(),mimeType:Be(g()),_meta:_e(g(),Ue()).optional()}),dd=ud.extend({text:g()}),hd=g().refine(t=>{try{return atob(t),!0}catch{return!1}},{message:"Invalid Base64 string"}),fd=ud.extend({blob:hd}),wr=Ze(["user","assistant"]),Os=M({audience:G(wr).optional(),priority:ae().min(0).max(1).optional(),lastModified:Xa({offset:!0}).optional()}),pd=M({...ws.shape,...Mr.shape,uri:g(),description:Be(g()),mimeType:Be(g()),size:Be(ae()),annotations:Os.optional(),_meta:Be(He({}))}),vg=M({...ws.shape,...Mr.shape,uriTemplate:g(),description:Be(g()),mimeType:Be(g()),annotations:Os.optional(),_meta:Be(He({}))}),xg=Tr.extend({method:C("resources/list")}),yg=Rr.extend({resources:G(pd)}),bg=Tr.extend({method:C("resources/templates/list")}),Mg=Rr.extend({resourceTemplates:G(vg)}),tc=Sn.extend({uri:g()}),Eg=tc,Tg=Kt.extend({method:C("resources/read"),params:Eg}),Rg=jt.extend({contents:G(Se([dd,fd]))}),wg=In.extend({method:C("notifications/resources/list_changed"),params:Ln.optional()}),Ag=tc,Cg=Kt.extend({method:C("resources/subscribe"),params:Ag}),Pg=tc,Lg=Kt.extend({method:C("resources/unsubscribe"),params:Pg}),md=M({toolsListChanged:xe().optional(),promptsListChanged:xe().optional(),resourcesListChanged:xe().optional(),resourceSubscriptions:G(g()).optional()}),Ig=Sn.extend({notifications:md}),Ng=Kt.extend({method:C("subscriptions/listen"),params:Ig}),Dg=Ln.extend({notifications:md}),Ug=In.extend({method:C("notifications/subscriptions/acknowledged"),params:Dg}),Og=id.extend({[dE]:Us}),Fg=jt.extend({_meta:Og}),kg=Ln.extend({uri:g()}),zg=In.extend({method:C("notifications/resources/updated"),params:kg}),Bg=M({name:g(),description:Be(g()),required:Be(xe())}),Hg=M({...ws.shape,...Mr.shape,description:Be(g()),arguments:Be(G(Bg)),_meta:Be(He({}))}),Vg=Tr.extend({method:C("prompts/list")}),Gg=Rr.extend({prompts:G(Hg)}),$g=Sn.extend({name:g(),arguments:_e(g(),g()).optional()}),qg=Kt.extend({method:C("prompts/get"),params:$g}),nc=M({type:C("text"),text:g(),annotations:Os.optional(),_meta:_e(g(),Ue()).optional()}),ic=M({type:C("image"),data:hd,mimeType:g(),annotations:Os.optional(),_meta:_e(g(),Ue()).optional()}),sc=M({type:C("audio"),data:hd,mimeType:g(),annotations:Os.optional(),_meta:_e(g(),Ue()).optional()}),Wg=M({type:C("tool_use"),name:g(),id:g(),input:_e(g(),Ue()),_meta:_e(g(),Ue()).optional()}),gd=M({type:C("resource"),resource:Se([dd,fd]),annotations:Os.optional(),_meta:_e(g(),Ue()).optional()}),_d=pd.extend({type:C("resource_link")}),Ar=Se([nc,ic,sc,_d,gd]),Zg=M({role:wr,content:Ar}),Xg=jt.extend({description:g().optional(),messages:G(Zg)}),Yg=In.extend({method:C("notifications/prompts/list_changed"),params:Ln.optional()}),Kg=M({title:g().optional(),readOnlyHint:xe().optional(),destructiveHint:xe().optional(),idempotentHint:xe().optional(),openWorldHint:xe().optional()}),jg=M({taskSupport:Ze(["required","optional","forbidden"]).optional()}),rc=M({...ws.shape,...Mr.shape,description:g().optional(),inputSchema:M({type:C("object"),properties:_e(g(),Sr).optional(),required:G(g()).optional()}).catchall(Ue()),outputSchema:He({$schema:g().optional()}).optional(),annotations:Kg.optional(),execution:jg.optional(),_meta:_e(g(),Ue()).optional()}),Jg=Tr.extend({method:C("tools/list")}),Qg=Rr.extend({tools:G(rc)}),oc=jt.extend({content:G(Ar).default([]),structuredContent:Ue().optional(),isError:xe().optional()}),gE=oc.or(jt.extend({toolResult:Ue()})),e_=go.extend({name:g(),arguments:_e(g(),Ue()).optional()}),t_=Kt.extend({method:C("tools/call"),params:e_}),n_=In.extend({method:C("notifications/tools/list_changed"),params:Ln.optional()}),_E=M({autoRefresh:xe().default(!0),debounceMs:ae().int().nonnegative().default(300)}),Sd=Ze(["debug","info","notice","warning","error","critical","alert","emergency"]),i_=Sn.extend({level:Sd}),s_=Kt.extend({method:C("logging/setLevel"),params:i_}),r_=Ln.extend({level:Sd,logger:g().optional(),data:Ue()}),o_=In.extend({method:C("notifications/message"),params:r_}),a_=M({name:g().optional()}),c_=M({hints:G(a_).optional(),costPriority:ae().min(0).max(1).optional(),speedPriority:ae().min(0).max(1).optional(),intelligencePriority:ae().min(0).max(1).optional()}),l_=M({mode:Ze(["auto","required","none"]).optional()}),u_=M({type:C("tool_result"),toolUseId:g().describe("The unique identifier for the corresponding tool call."),content:G(Ar),structuredContent:Ue().optional(),isError:xe().optional(),_meta:_e(g(),Ue()).optional()}),d_=ba("type",[nc,ic,sc]),ro=ba("type",[nc,ic,sc,Wg,u_]),h_=M({role:wr,content:Se([ro,G(ro)]),_meta:_e(g(),Ue()).optional()}),f_=go.extend({messages:G(h_),modelPreferences:c_.optional(),systemPrompt:g().optional(),includeContext:Ze(["none","thisServer","allServers"]).optional(),temperature:ae().optional(),maxTokens:ae().int(),stopSequences:G(g()).optional(),metadata:Xt.optional(),tools:G(rc).optional(),toolChoice:l_.optional()}),p_=Kt.extend({method:C("sampling/createMessage"),params:f_}),m_=jt.extend({model:g(),stopReason:Be(Ze(["endTurn","stopSequence","maxTokens"]).or(g())),role:wr,content:d_}),g_=jt.extend({model:g(),stopReason:Be(Ze(["endTurn","stopSequence","maxTokens","toolUse"]).or(g())),role:wr,content:Se([ro,G(ro)])}),vd=M({type:C("boolean"),title:g().optional(),description:g().optional(),default:xe().optional()}),ac=M({type:C("string"),title:g().optional(),description:g().optional(),minLength:ae().optional(),maxLength:ae().optional(),format:Ze(["email","uri","date","date-time"]).optional(),default:g().optional()}),Ma=M({type:Ze(["number","integer"]),title:g().optional(),description:g().optional(),minimum:ae().optional(),maximum:ae().optional(),default:ae().optional()}),xd=M({type:C("string"),title:g().optional(),description:g().optional(),enum:G(g()),default:g().optional()}),yd=M({type:C("string"),title:g().optional(),description:g().optional(),oneOf:G(M({const:g(),title:g()})),default:g().optional()}),bd=M({type:C("string"),title:g().optional(),description:g().optional(),enum:G(g()),enumNames:G(g()).optional(),default:g().optional()}),__=Se([xd,yd]),Md=M({type:C("array"),title:g().optional(),description:g().optional(),minItems:ae().optional(),maxItems:ae().optional(),items:M({type:C("string"),enum:G(g())}),default:G(g()).optional()}),Ed=M({type:C("array"),title:g().optional(),description:g().optional(),minItems:ae().optional(),maxItems:ae().optional(),items:M({anyOf:G(M({const:g(),title:g()}))}),default:G(g()).optional()}),S_=Se([Md,Ed]),v_=Se([bd,__,S_]),Td=Se([v_,vd,ac,Ma]),cc=go.extend({mode:C("form").optional(),message:g(),requestedSchema:M({type:C("object"),properties:_e(g(),Td),required:G(g()).optional()}).catchall(Ue())}),x_=go.extend({mode:C("url"),message:g(),elicitationId:g(),url:g().url()}),y_=Se([cc,x_]),b_=Kt.extend({method:C("elicitation/create"),params:y_}),M_=Ln.extend({elicitationId:g()}),E_=In.extend({method:C("notifications/elicitation/complete"),params:M_}),T_=jt.extend({action:Ze(["accept","decline","cancel"]),content:so(t=>t===null?void 0:t,_e(g(),Se([g(),ae(),xe(),G(g())])).optional())}),R_=M({type:C("ref/resource"),uri:g()}),w_=M({type:C("ref/prompt"),name:g()}),A_=Sn.extend({ref:Se([w_,R_]),argument:M({name:g(),value:g()}),context:M({arguments:_e(g(),g()).optional()}).optional()}),C_=Kt.extend({method:C("completion/complete"),params:A_}),P_=jt.extend({completion:He({values:G(g()).max(100),total:Be(ae().int()),hasMore:Be(xe())})}),L_=M({uri:g().startsWith("file://"),name:g().optional(),_meta:_e(g(),Ue()).optional()}),I_=Kt.extend({method:C("roots/list"),params:Sn.optional()}),N_=jt.extend({roots:G(L_)}),D_=In.extend({method:C("notifications/roots/list_changed"),params:Ln.optional()}),SE=He({ttl:ae().optional(),pollInterval:ae().optional()}),U_=Ze(["working","input_required","completed","failed","cancelled"]),Cr=M({taskId:g(),status:U_,ttl:Se([ae(),io()]),createdAt:g(),lastUpdatedAt:g(),pollInterval:Be(ae()),statusMessage:Be(g())}),vE=jt.extend({task:Cr}),O_=Ln.merge(Cr),xE=In.extend({method:C("notifications/tasks/status"),params:O_}),yE=Kt.extend({method:C("tasks/get"),params:Sn.extend({taskId:g()})}),bE=jt.merge(Cr),ME=Kt.extend({method:C("tasks/result"),params:Sn.extend({taskId:g()})}),EE=jt.loose(),TE=Tr.extend({method:C("tasks/list")}),RE=Rr.extend({tasks:G(Cr)}),wE=Kt.extend({method:C("tasks/cancel"),params:Sn.extend({taskId:g()})}),AE=jt.merge(Cr),CE=Se([cd,dg,pg,C_,s_,qg,Vg,xg,bg,Tg,Cg,Lg,Ng,t_,Jg]),PE=Se([od,ld,fg,D_]),LE=Se([ec,m_,g_,T_,N_]),IE=Se([cd,p_,b_,I_]),NE=Se([od,ld,o_,zg,wg,n_,Yg,Ug,E_]),DE=Se([ec,hg,mg,P_,Xg,Gg,yg,Mg,Rg,oc,Qg,Fg]),cn=Xm().superRefine((t,e)=>{if(!URL.canParse(t))return e.addIssue({code:rE.custom,message:"URL must be parseable",fatal:!0}),c0}).refine(t=>{const e=new URL(t);return e.protocol!=="javascript:"&&e.protocol!=="data:"&&e.protocol!=="vbscript:"},{message:"URL cannot use javascript:, data:, or vbscript: scheme"}),UE=He({resource:g().url(),authorization_servers:G(cn).optional(),jwks_uri:g().url().optional(),scopes_supported:G(g()).optional(),bearer_methods_supported:G(g()).optional(),resource_signing_alg_values_supported:G(g()).optional(),resource_name:g().optional(),resource_documentation:g().optional(),resource_policy_uri:g().url().optional(),resource_tos_uri:g().url().optional(),tls_client_certificate_bound_access_tokens:xe().optional(),authorization_details_types_supported:G(g()).optional(),dpop_signing_alg_values_supported:G(g()).optional(),dpop_bound_access_tokens_required:xe().optional()}),F_=He({issuer:g(),authorization_endpoint:cn,token_endpoint:cn,registration_endpoint:cn.optional(),scopes_supported:G(g()).optional(),response_types_supported:G(g()),response_modes_supported:G(g()).optional(),grant_types_supported:G(g()).optional(),token_endpoint_auth_methods_supported:G(g()).optional(),token_endpoint_auth_signing_alg_values_supported:G(g()).optional(),service_documentation:cn.optional(),revocation_endpoint:cn.optional(),revocation_endpoint_auth_methods_supported:G(g()).optional(),revocation_endpoint_auth_signing_alg_values_supported:G(g()).optional(),introspection_endpoint:g().optional(),introspection_endpoint_auth_methods_supported:G(g()).optional(),introspection_endpoint_auth_signing_alg_values_supported:G(g()).optional(),code_challenge_methods_supported:G(g()).optional(),client_id_metadata_document_supported:xe().optional(),authorization_response_iss_parameter_supported:xe().optional().catch(void 0),dpop_signing_alg_values_supported:G(g()).optional()}),k_=He({issuer:g(),authorization_endpoint:cn,token_endpoint:cn,userinfo_endpoint:cn.optional(),jwks_uri:cn,registration_endpoint:cn.optional(),scopes_supported:G(g()).optional(),response_types_supported:G(g()),response_modes_supported:G(g()).optional(),grant_types_supported:G(g()).optional(),acr_values_supported:G(g()).optional(),subject_types_supported:G(g()),id_token_signing_alg_values_supported:G(g()),id_token_encryption_alg_values_supported:G(g()).optional(),id_token_encryption_enc_values_supported:G(g()).optional(),userinfo_signing_alg_values_supported:G(g()).optional(),userinfo_encryption_alg_values_supported:G(g()).optional(),userinfo_encryption_enc_values_supported:G(g()).optional(),request_object_signing_alg_values_supported:G(g()).optional(),request_object_encryption_alg_values_supported:G(g()).optional(),request_object_encryption_enc_values_supported:G(g()).optional(),token_endpoint_auth_methods_supported:G(g()).optional(),token_endpoint_auth_signing_alg_values_supported:G(g()).optional(),display_values_supported:G(g()).optional(),claim_types_supported:G(g()).optional(),claims_supported:G(g()).optional(),service_documentation:g().optional(),claims_locales_supported:G(g()).optional(),ui_locales_supported:G(g()).optional(),claims_parameter_supported:xe().optional(),request_parameter_supported:xe().optional(),request_uri_parameter_supported:xe().optional(),require_request_uri_registration:xe().optional(),op_policy_uri:cn.optional(),op_tos_uri:cn.optional(),client_id_metadata_document_supported:xe().optional(),authorization_response_iss_parameter_supported:xe().optional().catch(void 0)}),OE=M({...k_.shape,...F_.pick({code_challenge_methods_supported:!0}).shape}),FE=M({access_token:g(),id_token:g().optional(),token_type:g(),expires_in:aE().optional(),scope:g().optional(),refresh_token:g().optional(),issuer:g().optional().catch(void 0)}).strip(),kE=M({issued_token_type:C("urn:ietf:params:oauth:token-type:id-jag"),access_token:g(),token_type:g().optional(),expires_in:ae().optional(),scope:g().optional()}).strip(),zE=M({error:g(),error_description:g().optional(),error_uri:g().optional()}),Yh=cn.optional().or(C("").transform(()=>{})),z_=M({redirect_uris:G(cn),token_endpoint_auth_method:g().optional(),grant_types:G(g()).optional(),response_types:G(g()).optional(),application_type:g().optional(),client_name:g().optional(),client_uri:cn.optional(),logo_uri:Yh,scope:g().optional(),contacts:G(g()).optional(),tos_uri:Yh,policy_uri:g().optional(),jwks_uri:cn.optional(),jwks:Ku().optional(),software_id:g().optional(),software_version:g().optional(),software_statement:g().optional()}).strip(),B_=M({client_id:g(),client_secret:g().optional(),client_id_issued_at:ae().optional(),client_secret_expires_at:ae().optional(),issuer:g().optional().catch(void 0)}).strip(),BE=z_.merge(B_),HE=M({error:g(),error_description:g().optional()}).strip(),VE=M({token:g(),token_type_hint:g().optional()}).strip(),Nl=Symbol.for("mcp.sdk.errorBrands");function H_(t,e){const n=new Set;let i=e;for(;typeof i=="function";){const s=i.mcpBrand;Object.prototype.hasOwnProperty.call(i,"mcpBrand")&&typeof s=="string"&&n.add(s),i=Object.getPrototypeOf(i)}n.size!==0&&Object.defineProperty(t,Nl,{value:n,enumerable:!1,configurable:!0})}function Ea(t,e){try{if(typeof e=="object"&&e!==null&&Object.prototype.hasOwnProperty.call(t,"mcpBrand")&&typeof t.mcpBrand=="string"&&Object.prototype.hasOwnProperty.call(e,Nl)){const n=e[Nl];if(n&&typeof n.has=="function"&&n.has(t.mcpBrand))return!0}}catch{}return Function.prototype[Symbol.hasInstance].call(t,e)}let mn=(function(t){return t.NotConnected="NOT_CONNECTED",t.AlreadyConnected="ALREADY_CONNECTED",t.NotInitialized="NOT_INITIALIZED",t.CapabilityNotSupported="CAPABILITY_NOT_SUPPORTED",t.RequestTimeout="REQUEST_TIMEOUT",t.ConnectionClosed="CONNECTION_CLOSED",t.SendFailed="SEND_FAILED",t.InvalidResult="INVALID_RESULT",t.UnsupportedResultType="UNSUPPORTED_RESULT_TYPE",t.InputRequiredRoundsExceeded="INPUT_REQUIRED_ROUNDS_EXCEEDED",t.ListPaginationExceeded="LIST_PAGINATION_EXCEEDED",t.MethodNotSupportedByProtocolVersion="METHOD_NOT_SUPPORTED_BY_PROTOCOL_VERSION",t.EraNegotiationFailed="ERA_NEGOTIATION_FAILED",t.ClientHttpNotImplemented="CLIENT_HTTP_NOT_IMPLEMENTED",t.ClientHttpAuthentication="CLIENT_HTTP_AUTHENTICATION",t.ClientHttpForbidden="CLIENT_HTTP_FORBIDDEN",t.ClientHttpUnexpectedContent="CLIENT_HTTP_UNEXPECTED_CONTENT",t.ClientHttpFailedToOpenStream="CLIENT_HTTP_FAILED_TO_OPEN_STREAM",t.ClientHttpFailedToTerminateSession="CLIENT_HTTP_FAILED_TO_TERMINATE_SESSION",t})({});var lr,sn=(lr=class extends Error{static[Symbol.hasInstance](e){return Ea(this,e)}static isInstance(e){if(typeof this!="function")throw new TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return Ea(this,e)}constructor(e,n,i,s){super(n,s),this.code=e,this.data=i,this.name="SdkError",H_(this,new.target)}},Object.defineProperty(lr,"mcpBrand",{value:"mcp.SdkError"}),lr);const GE="2026-07-28";function $E(t){return t>=GE}function V_(t){var n;const e=t.structuredContent;return e===void 0||!(typeof e!="object"||e===null||Array.isArray(e))||(((n=t.content)==null?void 0:n.some(i=>i.type==="text"))??!1)?t:{...t,content:[...t.content??[],{type:"text",text:JSON.stringify(e)}]}}const G_=["task","inputRequests","requestState"];function qE(t){return t===null||typeof t!="object"||Array.isArray(t)||t.content!==void 0||G_.some(e=>e in t)?t:{...t,content:[]}}function WE(){const t=ju(()=>Se([g(),ae(),xe(),io(),_e(g(),t),G(t)])),e=_e(g(),t),n=Se([g(),ae().int()]),i=g(),s=M({ttl:ae().optional()}),r=M({taskId:g()}),o=He({progressToken:n.optional(),"io.modelcontextprotocol/related-task":r.optional()}),a=M({_meta:o.optional()}),c=a.extend({task:s.optional()}),l=M({method:g(),params:a.loose().optional()}),u=M({_meta:o.optional()}),h=M({method:g(),params:u.loose().optional()}),d=He({_meta:o.optional()}),f=Se([g(),ae().int()]),_=d.strict(),x=u.extend({requestId:f.optional(),reason:g().optional()}),m=h.extend({method:C("notifications/cancelled"),params:x}),p=M({src:g(),mimeType:g().optional(),sizes:G(g()).optional(),theme:Ze(["light","dark"]).optional()}),E=M({icons:G(p).optional()}),I=M({name:g(),title:g().optional()}),b=I.extend({...I.shape,...E.shape,version:g(),websiteUrl:g().optional(),description:g().optional()}),w=Rs(M({applyDefaults:xe().optional()}),e),A=so(hn=>hn&&typeof hn=="object"&&!Array.isArray(hn)&&Object.keys(hn).length===0?{form:{}}:hn,Rs(M({form:w.optional(),url:e.optional()}),e.optional())),P=He({list:e.optional(),cancel:e.optional(),requests:He({sampling:He({createMessage:e.optional()}).optional(),elicitation:He({create:e.optional()}).optional()}).optional()}),v=He({list:e.optional(),cancel:e.optional(),requests:He({tools:He({call:e.optional()}).optional()}).optional()}),T=M({experimental:_e(g(),e).optional(),sampling:M({context:e.optional(),tools:e.optional()}).optional(),elicitation:A.optional(),roots:M({listChanged:xe().optional()}).optional(),tasks:P.optional(),extensions:_e(g(),e).optional()}),L=a.extend({protocolVersion:g(),capabilities:T,clientInfo:b}),N=l.extend({method:C("initialize"),params:L}),k=M({experimental:_e(g(),e).optional(),logging:e.optional(),completions:e.optional(),prompts:M({listChanged:xe().optional()}).optional(),resources:M({subscribe:xe().optional(),listChanged:xe().optional()}).optional(),tools:M({listChanged:xe().optional()}).optional(),tasks:v.optional(),extensions:_e(g(),e).optional()}),q=d.extend({protocolVersion:g(),capabilities:k,serverInfo:b,instructions:g().optional()}),U=h.extend({method:C("notifications/initialized"),params:u.optional()}),V=l.extend({method:C("ping"),params:a.optional()}),Q=M({progress:ae(),total:Be(ae()),message:Be(g())}),X=M({...u.shape,...Q.shape,progressToken:n}),ce=h.extend({method:C("notifications/progress"),params:X}),j=a.extend({cursor:i.optional()}),se=l.extend({params:j.optional()}),oe=d.extend({nextCursor:i.optional()}),Fe=M({uri:g(),mimeType:Be(g()),_meta:_e(g(),Ue()).optional()}),Ie=Fe.extend({text:g()}),mt=g().refine(hn=>{try{return atob(hn),!0}catch{return!1}},{message:"Invalid Base64 string"}),tt=Fe.extend({blob:mt}),Je=Ze(["user","assistant"]),Y=M({audience:G(Je).optional(),priority:ae().min(0).max(1).optional(),lastModified:Xa({offset:!0}).optional()}),re=M({...I.shape,...E.shape,uri:g(),description:Be(g()),mimeType:Be(g()),size:Be(ae()),annotations:Y.optional(),_meta:Be(He({}))}),Re=M({...I.shape,...E.shape,uriTemplate:g(),description:Be(g()),mimeType:Be(g()),annotations:Y.optional(),_meta:Be(He({}))}),Ge=se.extend({method:C("resources/list")}),Me=oe.extend({resources:G(re)}),We=se.extend({method:C("resources/templates/list")}),Lt=oe.extend({resourceTemplates:G(Re)}),Xe=a.extend({uri:g()}),st=Xe,St=l.extend({method:C("resources/read"),params:st}),Qe=d.extend({contents:G(Se([Ie,tt]))}),xt=h.extend({method:C("notifications/resources/list_changed"),params:u.optional()}),Ot=Xe,qt=l.extend({method:C("resources/subscribe"),params:Ot}),Mt=Xe,It=l.extend({method:C("resources/unsubscribe"),params:Mt}),F=u.extend({uri:g()}),Bt=h.extend({method:C("notifications/resources/updated"),params:F}),dt=M({name:g(),description:Be(g()),required:Be(xe())}),R=M({...I.shape,...E.shape,description:Be(g()),arguments:Be(G(dt)),_meta:Be(He({}))}),S=se.extend({method:C("prompts/list")}),z=oe.extend({prompts:G(R)}),Z=a.extend({name:g(),arguments:_e(g(),g()).optional()}),K=l.extend({method:C("prompts/get"),params:Z}),le=M({type:C("text"),text:g(),annotations:Y.optional(),_meta:_e(g(),Ue()).optional()}),de=M({type:C("image"),data:mt,mimeType:g(),annotations:Y.optional(),_meta:_e(g(),Ue()).optional()}),J=M({type:C("audio"),data:mt,mimeType:g(),annotations:Y.optional(),_meta:_e(g(),Ue()).optional()}),ne=M({type:C("tool_use"),name:g(),id:g(),input:_e(g(),Ue()),_meta:_e(g(),Ue()).optional()}),he=M({type:C("resource"),resource:Se([Ie,tt]),annotations:Y.optional(),_meta:_e(g(),Ue()).optional()}),Ne=re.extend({type:C("resource_link")}),ue=Se([le,de,J,Ne,he]),me=M({role:Je,content:ue}),Pe=d.extend({description:g().optional(),messages:G(me)}),ze=h.extend({method:C("notifications/prompts/list_changed"),params:u.optional()}),qe=M({title:g().optional(),readOnlyHint:xe().optional(),destructiveHint:xe().optional(),idempotentHint:xe().optional(),openWorldHint:xe().optional()}),O=M({taskSupport:Ze(["required","optional","forbidden"]).optional()}),fe=M({...I.shape,...E.shape,description:g().optional(),inputSchema:M({type:C("object"),properties:_e(g(),t).optional(),required:G(g()).optional()}).catchall(Ue()),outputSchema:M({type:C("object"),properties:_e(g(),t).optional(),required:G(g()).optional()}).catchall(Ue()).optional(),annotations:qe.optional(),execution:O.optional(),_meta:_e(g(),Ue()).optional()}),te=se.extend({method:C("tools/list")}),ge=oe.extend({tools:G(fe)}),ye=d.extend({content:G(ue),structuredContent:_e(g(),Ue()).optional(),isError:xe().optional()}),ie=c.extend({name:g(),arguments:_e(g(),Ue()).optional()}),De=l.extend({method:C("tools/call"),params:ie}),Ce=h.extend({method:C("notifications/tools/list_changed"),params:u.optional()}),_t=Ze(["debug","info","notice","warning","error","critical","alert","emergency"]),lt=a.extend({level:_t}),an=l.extend({method:C("logging/setLevel"),params:lt}),dn=u.extend({level:_t,logger:g().optional(),data:Ue()}),ds=h.extend({method:C("notifications/message"),params:dn}),hs=M({name:g().optional()}),Vi=M({hints:G(hs).optional(),costPriority:ae().min(0).max(1).optional(),speedPriority:ae().min(0).max(1).optional(),intelligencePriority:ae().min(0).max(1).optional()}),Mi=M({mode:Ze(["auto","required","none"]).optional()}),zs=M({type:C("tool_result"),toolUseId:g().describe("The unique identifier for the corresponding tool call."),content:G(ue),structuredContent:M({}).loose().optional(),isError:xe().optional(),_meta:_e(g(),Ue()).optional()}),Gi=ba("type",[le,de,J]),Zn=ba("type",[le,de,J,ne,zs]),Dn=M({role:Je,content:Se([Zn,G(Zn)]),_meta:_e(g(),Ue()).optional()}),Ei=c.extend({messages:G(Dn),modelPreferences:Vi.optional(),systemPrompt:g().optional(),includeContext:Ze(["none","thisServer","allServers"]).optional(),temperature:ae().optional(),maxTokens:ae().int(),stopSequences:G(g()).optional(),metadata:e.optional(),tools:G(fe).optional(),toolChoice:Mi.optional()}),$i=l.extend({method:C("sampling/createMessage"),params:Ei}),qi=d.extend({model:g(),stopReason:Be(Ze(["endTurn","stopSequence","maxTokens"]).or(g())),role:Je,content:Gi}),oi=d.extend({model:g(),stopReason:Be(Ze(["endTurn","stopSequence","maxTokens","toolUse"]).or(g())),role:Je,content:Se([Zn,G(Zn)])}),Wi=M({type:C("boolean"),title:g().optional(),description:g().optional(),default:xe().optional()}),ai=M({type:C("string"),title:g().optional(),description:g().optional(),minLength:ae().optional(),maxLength:ae().optional(),format:Ze(["email","uri","date","date-time"]).optional(),default:g().optional()}),Zi=M({type:Ze(["number","integer"]),title:g().optional(),description:g().optional(),minimum:ae().optional(),maximum:ae().optional(),default:ae().optional()}),Xi=M({type:C("string"),title:g().optional(),description:g().optional(),enum:G(g()),default:g().optional()}),fs=M({type:C("string"),title:g().optional(),description:g().optional(),oneOf:G(M({const:g(),title:g()})),default:g().optional()}),ps=M({type:C("string"),title:g().optional(),description:g().optional(),enum:G(g()),enumNames:G(g()).optional(),default:g().optional()}),ms=Se([Xi,fs]),Ti=M({type:C("array"),title:g().optional(),description:g().optional(),minItems:ae().optional(),maxItems:ae().optional(),items:M({type:C("string"),enum:G(g())}),default:G(g()).optional()}),ci=M({type:C("array"),title:g().optional(),description:g().optional(),minItems:ae().optional(),maxItems:ae().optional(),items:M({anyOf:G(M({const:g(),title:g()}))}),default:G(g()).optional()}),y=Se([Ti,ci]),D=Se([ps,ms,y]),W=Se([D,Wi,ai,Zi]),B=c.extend({mode:C("form").optional(),message:g(),requestedSchema:M({type:C("object"),properties:_e(g(),W),required:G(g()).optional()}).catchall(Ue())}),$=c.extend({mode:C("url"),message:g(),elicitationId:g(),url:g().url()}),pe=Se([B,$]),Te=l.extend({method:C("elicitation/create"),params:pe}),ve=u.extend({elicitationId:g()}),we=h.extend({method:C("notifications/elicitation/complete"),params:ve}),Le=d.extend({action:Ze(["accept","decline","cancel"]),content:so(hn=>hn===null?void 0:hn,_e(g(),Se([g(),ae(),xe(),G(g())])).optional())}),Ye=M({type:C("ref/resource"),uri:g()}),et=M({type:C("ref/prompt"),name:g()}),Ae=a.extend({ref:Se([et,Ye]),argument:M({name:g(),value:g()}),context:M({arguments:_e(g(),g()).optional()}).optional()}),ut=l.extend({method:C("completion/complete"),params:Ae}),Dt=d.extend({completion:He({values:G(g()).max(100),total:Be(ae().int()),hasMore:Be(xe())})}),yt=M({uri:g().startsWith("file://"),name:g().optional(),_meta:_e(g(),Ue()).optional()}),gt=l.extend({method:C("roots/list"),params:a.optional()}),Ht=d.extend({roots:G(yt)}),Ee=h.extend({method:C("notifications/roots/list_changed"),params:u.optional()}),Wt=He({ttl:ae().optional(),pollInterval:ae().optional()}),it=Ze(["working","input_required","completed","failed","cancelled"]),Gt=M({taskId:g(),status:it,ttl:Se([ae(),io()]),createdAt:g(),lastUpdatedAt:g(),pollInterval:Be(ae()),statusMessage:Be(g())}),Ut=d.extend({task:Gt}),Un=u.merge(Gt),Rn=h.extend({method:C("notifications/tasks/status"),params:Un}),ht=l.extend({method:C("tasks/get"),params:a.extend({taskId:g()})}),Rt=d.merge(Gt),vn=l.extend({method:C("tasks/result"),params:a.extend({taskId:g()})}),bt=d.loose(),Ft=se.extend({method:C("tasks/list")}),wt=oe.extend({tasks:G(Gt)}),li=l.extend({method:C("tasks/cancel"),params:a.extend({taskId:g()})});return{JSONValueSchema:t,JSONObjectSchema:e,ProgressTokenSchema:n,CursorSchema:i,TaskMetadataSchema:s,RelatedTaskMetadataSchema:r,RequestMetaSchema:o,BaseRequestParamsSchema:a,TaskAugmentedRequestParamsSchema:c,RequestSchema:l,NotificationsParamsSchema:u,NotificationSchema:h,ResultSchema:d,RequestIdSchema:f,EmptyResultSchema:_,CancelledNotificationParamsSchema:x,CancelledNotificationSchema:m,IconSchema:p,IconsSchema:E,BaseMetadataSchema:I,ImplementationSchema:b,ClientTasksCapabilitySchema:P,ServerTasksCapabilitySchema:v,ClientCapabilitiesSchema:T,InitializeRequestParamsSchema:L,InitializeRequestSchema:N,ServerCapabilitiesSchema:k,InitializeResultSchema:q,InitializedNotificationSchema:U,PingRequestSchema:V,ProgressSchema:Q,ProgressNotificationParamsSchema:X,ProgressNotificationSchema:ce,PaginatedRequestParamsSchema:j,PaginatedRequestSchema:se,PaginatedResultSchema:oe,ResourceContentsSchema:Fe,TextResourceContentsSchema:Ie,BlobResourceContentsSchema:tt,RoleSchema:Je,AnnotationsSchema:Y,ResourceSchema:re,ResourceTemplateSchema:Re,ListResourcesRequestSchema:Ge,ListResourcesResultSchema:Me,ListResourceTemplatesRequestSchema:We,ListResourceTemplatesResultSchema:Lt,ResourceRequestParamsSchema:Xe,ReadResourceRequestParamsSchema:st,ReadResourceRequestSchema:St,ReadResourceResultSchema:Qe,ResourceListChangedNotificationSchema:xt,SubscribeRequestParamsSchema:Ot,SubscribeRequestSchema:qt,UnsubscribeRequestParamsSchema:Mt,UnsubscribeRequestSchema:It,ResourceUpdatedNotificationParamsSchema:F,ResourceUpdatedNotificationSchema:Bt,PromptArgumentSchema:dt,PromptSchema:R,ListPromptsRequestSchema:S,ListPromptsResultSchema:z,GetPromptRequestParamsSchema:Z,GetPromptRequestSchema:K,TextContentSchema:le,ImageContentSchema:de,AudioContentSchema:J,ToolUseContentSchema:ne,EmbeddedResourceSchema:he,ResourceLinkSchema:Ne,ContentBlockSchema:ue,PromptMessageSchema:me,GetPromptResultSchema:Pe,PromptListChangedNotificationSchema:ze,ToolAnnotationsSchema:qe,ToolExecutionSchema:O,ToolSchema:fe,ListToolsRequestSchema:te,ListToolsResultSchema:ge,CallToolResultSchema:ye,CallToolRequestParamsSchema:ie,CallToolRequestSchema:De,ToolListChangedNotificationSchema:Ce,LoggingLevelSchema:_t,SetLevelRequestParamsSchema:lt,SetLevelRequestSchema:an,LoggingMessageNotificationParamsSchema:dn,LoggingMessageNotificationSchema:ds,ModelHintSchema:hs,ModelPreferencesSchema:Vi,ToolChoiceSchema:Mi,ToolResultContentSchema:zs,SamplingContentSchema:Gi,SamplingMessageContentBlockSchema:Zn,SamplingMessageSchema:Dn,CreateMessageRequestParamsSchema:Ei,CreateMessageRequestSchema:$i,CreateMessageResultSchema:qi,CreateMessageResultWithToolsSchema:oi,BooleanSchemaSchema:Wi,StringSchemaSchema:ai,NumberSchemaSchema:Zi,UntitledSingleSelectEnumSchemaSchema:Xi,TitledSingleSelectEnumSchemaSchema:fs,LegacyTitledEnumSchemaSchema:ps,SingleSelectEnumSchemaSchema:ms,UntitledMultiSelectEnumSchemaSchema:Ti,TitledMultiSelectEnumSchemaSchema:ci,MultiSelectEnumSchemaSchema:y,EnumSchemaSchema:D,PrimitiveSchemaDefinitionSchema:W,ElicitRequestFormParamsSchema:B,ElicitRequestURLParamsSchema:$,ElicitRequestParamsSchema:pe,ElicitRequestSchema:Te,ElicitationCompleteNotificationParamsSchema:ve,ElicitationCompleteNotificationSchema:we,ElicitResultSchema:Le,ResourceTemplateReferenceSchema:Ye,PromptReferenceSchema:et,CompleteRequestParamsSchema:Ae,CompleteRequestSchema:ut,CompleteResultSchema:Dt,RootSchema:yt,ListRootsRequestSchema:gt,ListRootsResultSchema:Ht,RootsListChangedNotificationSchema:Ee,TaskCreationParamsSchema:Wt,TaskStatusSchema:it,TaskSchema:Gt,CreateTaskResultSchema:Ut,TaskStatusNotificationParamsSchema:Un,TaskStatusNotificationSchema:Rn,GetTaskRequestSchema:ht,GetTaskResultSchema:Rt,GetTaskPayloadRequestSchema:vn,GetTaskPayloadResultSchema:bt,ListTasksRequestSchema:Ft,ListTasksResultSchema:wt,CancelTaskRequestSchema:li,CancelTaskResultSchema:d.merge(Gt),ClientRequestSchema:Se([V,N,ut,an,K,S,Ge,We,St,qt,It,De,te,ht,vn,Ft,li]),ClientNotificationSchema:Se([m,ce,U,Ee,Rn]),ClientResultSchema:Se([_,qi,oi,Le,Ht,Rt,wt,Ut]),ServerRequestSchema:Se([V,$i,Te,gt,ht,vn,Ft,li]),ServerNotificationSchema:Se([m,ce,ds,Bt,xt,Ce,ze,Rn,we]),ServerResultSchema:Se([_,q,Dt,Pe,z,Me,Lt,Qe,ye,ge,Rt,wt,Ut]),CallToolResultWireSchema:Ue().superRefine((hn,yv)=>{if(!(typeof hn!="object"||hn===null||Array.isArray(hn)||hn.content!==void 0)){for(const hh of G_)if(hh in hn){yv.addIssue({code:"custom",message:`content is required when the body carries '${hh}' — another result family cannot default into an empty tools/call success`});return}}}).transform(qE).pipe(ye)}}let ZE;function $_(){return ZE??(ZE=WE())}function q_(t){return t.type!=="object"}const XE=new Set(["const","enum","default","examples"]),YE=new Set(["properties","patternProperties","$defs","definitions","dependentSchemas","dependencies"]);function Kh(t){return t!==void 0&&!(typeof t=="string"&&t.startsWith("#"))}function KE(t){const e=typeof t.$schema=="string"?t.$schema:void 0;if(Kh(t.$id))return{...e!==void 0&&{$schema:e},type:"object",properties:{result:t},required:["result"]};const n=Dv(t.$schema)&&t.$recursiveAnchor!==!0,i=(s,r)=>{if(Array.isArray(s))return s.map(c=>i(c,!1));if(s===null||typeof s!="object"||!r&&Kh(s.$id))return s;const o={};let a=!1;for(const[c,l]of Object.entries(s))r?o[c]=i(l,!1):(c==="$ref"||c==="$dynamicRef")&&typeof l=="string"?o[c]=l==="#"?"#/properties/result":l.startsWith("#/")?`#/properties/result${l.slice(1)}`:l:c==="$recursiveRef"&&l==="#"&&n?a=!0:XE.has(c)?o[c]=l:YE.has(c)?o[c]=i(l,!0):o[c]=i(l,!1);return a&&("$ref"in o?o.allOf=[...Array.isArray(o.allOf)?o.allOf:[],{$ref:"#/properties/result"}]:o.$ref="#/properties/result"),o};return{...e!==void 0&&{$schema:e},type:"object",properties:{result:i(t,!1)},required:["result"]}}const jE={ping:null,initialize:null,"completion/complete":null,"logging/setLevel":null,"prompts/get":null,"prompts/list":null,"resources/list":null,"resources/templates/list":null,"resources/read":null,"resources/subscribe":null,"resources/unsubscribe":null,"tools/call":null,"tools/list":null,"tasks/get":null,"tasks/result":null,"tasks/list":null,"tasks/cancel":null,"sampling/createMessage":null,"elicitation/create":null,"roots/list":null},JE={"notifications/cancelled":null,"notifications/progress":null,"notifications/initialized":null,"notifications/roots/list_changed":null,"notifications/tasks/status":null,"notifications/message":null,"notifications/resources/updated":null,"notifications/resources/list_changed":null,"notifications/tools/list_changed":null,"notifications/prompts/list_changed":null,"notifications/elicitation/complete":null},QE={ping:null,initialize:null,"completion/complete":null,"logging/setLevel":null,"prompts/get":null,"prompts/list":null,"resources/list":null,"resources/templates/list":null,"resources/read":null,"resources/subscribe":null,"resources/unsubscribe":null,"tools/call":null,"tools/list":null,"sampling/createMessage":null,"elicitation/create":null,"roots/list":null};let wo;function Rd(){if(wo)return wo;const t=$_();return wo={requestSchemas:{ping:t.PingRequestSchema,initialize:t.InitializeRequestSchema,"completion/complete":t.CompleteRequestSchema,"logging/setLevel":t.SetLevelRequestSchema,"prompts/get":t.GetPromptRequestSchema,"prompts/list":t.ListPromptsRequestSchema,"resources/list":t.ListResourcesRequestSchema,"resources/templates/list":t.ListResourceTemplatesRequestSchema,"resources/read":t.ReadResourceRequestSchema,"resources/subscribe":t.SubscribeRequestSchema,"resources/unsubscribe":t.UnsubscribeRequestSchema,"tools/call":t.CallToolRequestSchema,"tools/list":t.ListToolsRequestSchema,"tasks/get":t.GetTaskRequestSchema,"tasks/result":t.GetTaskPayloadRequestSchema,"tasks/list":t.ListTasksRequestSchema,"tasks/cancel":t.CancelTaskRequestSchema,"sampling/createMessage":t.CreateMessageRequestSchema,"elicitation/create":t.ElicitRequestSchema,"roots/list":t.ListRootsRequestSchema},notificationSchemas:{"notifications/cancelled":t.CancelledNotificationSchema,"notifications/progress":t.ProgressNotificationSchema,"notifications/initialized":t.InitializedNotificationSchema,"notifications/roots/list_changed":t.RootsListChangedNotificationSchema,"notifications/tasks/status":t.TaskStatusNotificationSchema,"notifications/message":t.LoggingMessageNotificationSchema,"notifications/resources/updated":t.ResourceUpdatedNotificationSchema,"notifications/resources/list_changed":t.ResourceListChangedNotificationSchema,"notifications/tools/list_changed":t.ToolListChangedNotificationSchema,"notifications/prompts/list_changed":t.PromptListChangedNotificationSchema,"notifications/elicitation/complete":t.ElicitationCompleteNotificationSchema},resultSchemas:{ping:t.EmptyResultSchema,initialize:t.InitializeResultSchema,"completion/complete":t.CompleteResultSchema,"logging/setLevel":t.EmptyResultSchema,"prompts/get":t.GetPromptResultSchema,"prompts/list":t.ListPromptsResultSchema,"resources/list":t.ListResourcesResultSchema,"resources/templates/list":t.ListResourceTemplatesResultSchema,"resources/read":t.ReadResourceResultSchema,"resources/subscribe":t.EmptyResultSchema,"resources/unsubscribe":t.EmptyResultSchema,"tools/call":t.CallToolResultWireSchema,"tools/list":t.ListToolsResultSchema,"sampling/createMessage":t.CreateMessageResultWithToolsSchema,"elicitation/create":t.ElicitResultSchema,"roots/list":t.ListRootsResultSchema}},wo}function W_(t){return Object.prototype.hasOwnProperty.call(jE,t)}function Z_(t){return Object.prototype.hasOwnProperty.call(JE,t)}function eT(t){return Object.prototype.hasOwnProperty.call(QE,t)}function tT(t){return eT(t)?Rd().resultSchemas[t]:void 0}function nT(t){return W_(t)?Rd().requestSchemas[t]:void 0}function iT(t){return Z_(t)?Rd().notificationSchemas[t]:void 0}function Dl(t){return t!==null&&typeof t=="object"&&!Array.isArray(t)}function Ao(t,e){if(t===void 0)return{ok:!1,reason:"not-in-era"};const n=t.safeParse(e);return n.success?{ok:!0,value:n.data}:{ok:!1,reason:"invalid",message:String(n.error)}}const jh={ok:!1,reason:"not-in-era"};function Jh(t){return Dl(t)&&Dl(t.outputSchema)&&q_(t.outputSchema)}const wd={era:"2025-11-25",hasRequestMethod:W_,hasNotificationMethod:Z_,validateRequest:(t,e)=>Ao(nT(t),e),validateResult:(t,e)=>Ao(tT(t),e),validateNotification:(t,e)=>Ao(iT(t),e),hasInputRequestMethod:()=>!1,validateInputRequest:()=>jh,validateInputResponse:()=>jh,samplingResultVariant:((t,e)=>{const n=$_();return Ao(t?n.CreateMessageResultWithToolsSchema:n.CreateMessageResultSchema,e)}),outboundEnvelope:t=>{},validateEnvelopeMeta:t=>[],projectCallToolResult(t,e){const n=V_(t),i=n.structuredContent;if(i===void 0)return n;const s=typeof i!="object"||i===null||Array.isArray(i),r=e!==void 0&&q_(e);return!s&&!r?n:{...n,structuredContent:{result:i}}},decodeResult(t,e){if(Dl(e)&&"resultType"in e){const n={...e};return delete n.resultType,{kind:"complete",result:n}}return{kind:"complete",result:e}},encodeResult(t,e){if(t!=="tools/list")return e;const n=e.tools;return!Array.isArray(n)||!n.some(i=>Jh(i))?e:{...e,tools:n.map(i=>Jh(i)?{...i,outputSchema:KE(i.outputSchema)}:i)}},encodeErrorCode:t=>t===-32002?-32602:t,checkInboundEnvelope:t=>{}};function sT(){const t=ju(()=>Se([g(),ae(),xe(),io(),_e(g(),t),G(t)])),e=_e(g(),t),n=Se([g(),ae().int()]),i=g(),s=Se([g(),ae().int()]),r=Ze(["user","assistant"]),o=Ze(["debug","info","notice","warning","error","critical","alert","emergency"]),a=g().refine(wt=>{try{return atob(wt),!0}catch{return!1}},{message:"Invalid Base64 string"}),c=M({ttl:ae().optional()}),l=M({taskId:g()}),u=He({progressToken:n.optional(),"io.modelcontextprotocol/related-task":l.optional()}),h=M({_meta:u.optional()}),d=h.extend({task:c.optional()}),f=M({_meta:u.optional()}),_=M({method:g(),params:f.loose().optional()}),x=M({src:g(),mimeType:g().optional(),sizes:G(g()).optional(),theme:Ze(["light","dark"]).optional()}),m=M({icons:G(x).optional()}),p=M({name:g(),title:g().optional()}),E=p.extend({...p.shape,...m.shape,version:g(),websiteUrl:g().optional(),description:g().optional()}),I=Rs(M({applyDefaults:xe().optional()}),e),b=so(wt=>wt&&typeof wt=="object"&&!Array.isArray(wt)&&Object.keys(wt).length===0?{form:{}}:wt,Rs(M({form:I.optional(),url:e.optional()}),e.optional())),w=He({list:e.optional(),cancel:e.optional(),requests:He({sampling:He({createMessage:e.optional()}).optional(),elicitation:He({create:e.optional()}).optional()}).optional()}),A=He({list:e.optional(),cancel:e.optional(),requests:He({tools:He({call:e.optional()}).optional()}).optional()}),P=M({experimental:_e(g(),e).optional(),sampling:M({context:e.optional(),tools:e.optional()}).optional(),elicitation:b.optional(),roots:M({listChanged:xe().optional()}).optional(),tasks:w.optional(),extensions:_e(g(),e).optional()}),v=M({experimental:_e(g(),e).optional(),logging:e.optional(),completions:e.optional(),prompts:M({listChanged:xe().optional()}).optional(),resources:M({subscribe:xe().optional(),listChanged:xe().optional()}).optional(),tools:M({listChanged:xe().optional()}).optional(),tasks:A.optional(),extensions:_e(g(),e).optional()}),T=M({progress:ae(),total:Be(ae()),message:Be(g())}),L=M({...f.shape,...T.shape,progressToken:n}),N=_.extend({method:C("notifications/progress"),params:L}),k=f.extend({level:o,logger:g().optional(),data:Ue()}),q=_.extend({method:C("notifications/message"),params:k}),U=M({uri:g(),mimeType:Be(g()),_meta:_e(g(),Ue()).optional()}),V=U.extend({text:g()}),Q=U.extend({blob:a}),X=M({audience:G(r).optional(),priority:ae().min(0).max(1).optional(),lastModified:Xa({offset:!0}).optional()}),ce=M({...p.shape,...m.shape,uri:g(),description:Be(g()),mimeType:Be(g()),size:Be(ae()),annotations:X.optional(),_meta:Be(He({}))}),j=M({...p.shape,...m.shape,uriTemplate:g(),description:Be(g()),mimeType:Be(g()),annotations:X.optional(),_meta:Be(He({}))}),se=_.extend({method:C("notifications/resources/list_changed"),params:f.optional()}),oe=f.extend({uri:g()}),Fe=_.extend({method:C("notifications/resources/updated"),params:oe}),Ie=M({name:g(),description:Be(g()),required:Be(xe())}),mt=M({...p.shape,...m.shape,description:Be(g()),arguments:Be(G(Ie)),_meta:Be(He({}))}),tt=_.extend({method:C("notifications/prompts/list_changed"),params:f.optional()}),Je=M({type:C("text"),text:g(),annotations:X.optional(),_meta:_e(g(),Ue()).optional()}),Y=M({type:C("image"),data:a,mimeType:g(),annotations:X.optional(),_meta:_e(g(),Ue()).optional()}),re=M({type:C("audio"),data:a,mimeType:g(),annotations:X.optional(),_meta:_e(g(),Ue()).optional()}),Re=M({type:C("tool_use"),name:g(),id:g(),input:_e(g(),Ue()),_meta:_e(g(),Ue()).optional()}),Ge=M({type:C("resource"),resource:Se([V,Q]),annotations:X.optional(),_meta:_e(g(),Ue()).optional()}),Me=ce.extend({type:C("resource_link")}),We=Se([Je,Y,re,Me,Ge]),Lt=M({role:r,content:We}),Xe=M({title:g().optional(),readOnlyHint:xe().optional(),destructiveHint:xe().optional(),idempotentHint:xe().optional(),openWorldHint:xe().optional()}),st=_.extend({method:C("notifications/tools/list_changed"),params:f.optional()}),St=M({name:g().optional()}),Qe=M({hints:G(St).optional(),costPriority:ae().min(0).max(1).optional(),speedPriority:ae().min(0).max(1).optional(),intelligencePriority:ae().min(0).max(1).optional()}),xt=M({mode:Ze(["auto","required","none"]).optional()}),Ot=M({type:C("boolean"),title:g().optional(),description:g().optional(),default:xe().optional()}),qt=M({type:C("string"),title:g().optional(),description:g().optional(),minLength:ae().optional(),maxLength:ae().optional(),format:Ze(["email","uri","date","date-time"]).optional(),default:g().optional()}),Mt=M({type:Ze(["number","integer"]),title:g().optional(),description:g().optional(),minimum:ae().optional(),maximum:ae().optional(),default:ae().optional()}),It=M({type:C("string"),title:g().optional(),description:g().optional(),enum:G(g()),default:g().optional()}),F=M({type:C("string"),title:g().optional(),description:g().optional(),oneOf:G(M({const:g(),title:g()})),default:g().optional()}),Bt=M({type:C("string"),title:g().optional(),description:g().optional(),enum:G(g()),enumNames:G(g()).optional(),default:g().optional()}),dt=Se([It,F]),R=M({type:C("array"),title:g().optional(),description:g().optional(),minItems:ae().optional(),maxItems:ae().optional(),items:M({type:C("string"),enum:G(g())}),default:G(g()).optional()}),S=M({type:C("array"),title:g().optional(),description:g().optional(),minItems:ae().optional(),maxItems:ae().optional(),items:M({anyOf:G(M({const:g(),title:g()}))}),default:G(g()).optional()}),z=Se([R,S]),Z=Se([Bt,dt,z]),K=Se([Z,Ot,qt,Mt]),le=d.extend({mode:C("form").optional(),message:g(),requestedSchema:M({type:C("object"),properties:_e(g(),K),required:G(g()).optional()}).catchall(Ue())}),de=M({type:C("ref/resource"),uri:g()}),J=M({type:C("ref/prompt"),name:g()}),ne=M({uri:g().startsWith("file://"),name:g().optional(),_meta:_e(g(),Ue()).optional()}),he=P.shape,Ne=M({experimental:he.experimental,sampling:he.sampling,elicitation:he.elicitation,roots:he.roots,extensions:he.extensions}),ue=v.shape,me=M({experimental:ue.experimental,logging:ue.logging,completions:ue.completions,prompts:ue.prompts,resources:ue.resources,tools:ue.tools,extensions:ue.extensions}),Pe=He({progressToken:n.optional(),[Ya]:g(),[Ju]:E.optional(),[Ka]:Ne,[Qu]:o.optional()}),ze=M({...p.shape,...m.shape,description:g().optional(),inputSchema:He({$schema:g().optional(),type:C("object")}),outputSchema:He({$schema:g().optional()}).optional(),annotations:Xe.optional(),_meta:_e(g(),Ue()).optional()}),qe=M({type:C("tool_result"),toolUseId:g(),content:G(We),structuredContent:Ue().optional(),isError:xe().optional(),_meta:_e(g(),Ue()).optional()}),O=Se([Je,Y,re,Re,qe]),fe=M({role:r,content:Se([O,G(O)]),_meta:_e(g(),Ue()).optional()}),te=g(),ge=He({[Xr]:E.optional().catch(void 0)}),ye=ge.optional();function ie(wt){return He({_meta:ye,resultType:te.default("complete"),...wt})}const De=ie({}),Ce=ie({nextCursor:i.optional()}),_t=ie({content:G(We),structuredContent:Ue().optional(),isError:xe().optional()}),lt=ie({ttlMs:ae().int().min(0),cacheScope:Ze(["public","private"]),tools:G(ze),nextCursor:i.optional()}),an=ie({ttlMs:ae().int().min(0),cacheScope:Ze(["public","private"]),prompts:G(mt),nextCursor:i.optional()}),dn=ie({description:g().optional(),messages:G(Lt)}),ds=ie({ttlMs:ae().int().min(0),cacheScope:Ze(["public","private"]),resources:G(ce),nextCursor:i.optional()}),hs=ie({ttlMs:ae().int().min(0),cacheScope:Ze(["public","private"]),resourceTemplates:G(j),nextCursor:i.optional()}),Vi=ie({ttlMs:ae().int().min(0),cacheScope:Ze(["public","private"]),contents:G(Se([V,Q]))}),Mi=ie({completion:M({values:G(g()).max(100),total:ae().int().optional(),hasMore:xe().optional()}).loose()}),zs=ie({ttlMs:ae().int().min(0),cacheScope:Ze(["public","private"])}),Gi=ie({ttlMs:ae().int().min(0).catch(0),cacheScope:Ze(["public","private"]).catch("private"),supportedVersions:G(g()),capabilities:me,instructions:g().optional()}),Zn=M({messages:G(fe),modelPreferences:Qe.optional(),systemPrompt:g().optional(),includeContext:Ze(["none","thisServer","allServers"]).optional(),temperature:ae().optional(),maxTokens:ae().int(),stopSequences:G(g()).optional(),metadata:e.optional(),tools:G(ze).optional(),toolChoice:xt.optional()}),Dn=M({method:C("sampling/createMessage"),params:Zn}),Ei=M({method:C("roots/list"),params:M({_meta:_e(g(),Ue()).optional()}).optional()}),$i=M({...fe.shape,model:g(),stopReason:g().optional()}),qi=M({roots:G(ne)}),oi=M({action:Ze(["accept","decline","cancel"]),content:_e(g(),Se([g(),ae(),xe(),G(g())])).optional()}),Wi=M({mode:C("url"),message:g(),url:g().url()}),ai=Se([le,Wi]),Zi=M({method:C("elicitation/create"),params:ai}),Xi=Se([Dn,Ei,Zi]),fs=Se([$i,qi,oi]),ps=_e(g(),Xi),ms=_e(g(),fs),Ti=ie({inputRequests:ps.optional(),requestState:g().optional()}),ci={inputResponses:ms.optional(),requestState:g().optional()},y=M({_meta:Pe,...ci}),D=He({progressToken:n.optional()});function W(wt,li){return M({method:C(wt),params:M({_meta:Pe,...li})})}function B(wt,li){return M({method:C(wt),params:M({_meta:D.optional(),...li}).optional()})}const $={name:g(),arguments:_e(g(),Ue()).optional(),...ci},pe={cursor:i.optional()},Te=W("tools/call",$),ve=W("tools/list",pe),we=W("prompts/list",pe),Le=W("prompts/get",{name:g(),arguments:_e(g(),g()).optional(),...ci}),Ye=W("resources/list",pe),et=W("resources/templates/list",pe),Ae=W("resources/read",{uri:g(),...ci}),ut={ref:Se([J,de]),argument:M({name:g(),value:g()}),context:M({arguments:_e(g(),g()).optional()}).optional()},Dt=W("completion/complete",ut),yt=W("server/discover",{}),gt=M({toolsListChanged:xe().optional(),promptsListChanged:xe().optional(),resourcesListChanged:xe().optional(),resourceSubscriptions:G(g()).optional()}),Ht={notifications:gt},Ee=W("subscriptions/listen",Ht),Wt=ge.extend({"io.modelcontextprotocol/subscriptionId":s}),it=He({_meta:Wt,resultType:te.default("complete")}),Gt={"tools/call":B("tools/call",$),"tools/list":B("tools/list",pe),"prompts/get":B("prompts/get",{name:g(),arguments:_e(g(),g()).optional()}),"prompts/list":B("prompts/list",pe),"resources/list":B("resources/list",pe),"resources/templates/list":B("resources/templates/list",pe),"resources/read":B("resources/read",{uri:g()}),"completion/complete":B("completion/complete",ut),"server/discover":B("server/discover",{}),"subscriptions/listen":B("subscriptions/listen",Ht)};function Ut(wt){return He({_meta:ye,...wt})}const Un={"tools/call":Ut({content:G(We),structuredContent:Ue().optional(),isError:xe().optional()}),"tools/list":Ut({ttlMs:ae().int().min(0),cacheScope:Ze(["public","private"]),tools:G(ze),nextCursor:i.optional()}),"prompts/get":Ut({description:g().optional(),messages:G(Lt)}),"prompts/list":Ut({ttlMs:ae().int().min(0),cacheScope:Ze(["public","private"]),prompts:G(mt),nextCursor:i.optional()}),"resources/list":Ut({ttlMs:ae().int().min(0),cacheScope:Ze(["public","private"]),resources:G(ce),nextCursor:i.optional()}),"resources/templates/list":Ut({ttlMs:ae().int().min(0),cacheScope:Ze(["public","private"]),resourceTemplates:G(j),nextCursor:i.optional()}),"resources/read":Ut({ttlMs:ae().int().min(0),cacheScope:Ze(["public","private"]),contents:G(Se([V,Q]))}),"completion/complete":Ut({completion:M({values:G(g()).max(100),total:ae().int().optional(),hasMore:xe().optional()}).loose()}),"server/discover":Ut({ttlMs:ae().int().min(0).catch(0),cacheScope:Ze(["public","private"]).catch("private"),supportedVersions:G(g()),capabilities:me,instructions:g().optional()}),"subscriptions/listen":Ut({})},Rn=He({"io.modelcontextprotocol/subscriptionId":s.optional()}),ht=M({method:C("notifications/subscriptions/acknowledged"),params:M({_meta:Rn.optional(),notifications:gt})}),Rt=M({_meta:Rn.optional(),requestId:s,reason:g().optional()}),vn=M({method:C("notifications/cancelled"),params:Rt}),bt={"notifications/cancelled":vn,"notifications/progress":N,"notifications/message":q,"notifications/resources/updated":Fe,"notifications/resources/list_changed":se,"notifications/tools/list_changed":st,"notifications/prompts/list_changed":tt,"notifications/subscriptions/acknowledged":ht},Ft=wt=>M({jsonrpc:C("2.0"),id:Se([g(),ae().int()]),result:wt}).strict();return{JSONValueSchema:t,JSONObjectSchema:e,ProgressTokenSchema:n,CursorSchema:i,RequestIdSchema:s,RoleSchema:r,LoggingLevelSchema:o,TaskMetadataSchema:c,RelatedTaskMetadataSchema:l,RequestMetaSchema:u,BaseRequestParamsSchema:h,TaskAugmentedRequestParamsSchema:d,NotificationsParamsSchema:f,NotificationSchema:_,IconSchema:x,IconsSchema:m,BaseMetadataSchema:p,ImplementationSchema:E,ClientTasksCapabilitySchema:w,ServerTasksCapabilitySchema:A,ClientCapabilitiesSchema:P,ServerCapabilitiesSchema:v,ProgressSchema:T,ProgressNotificationParamsSchema:L,ProgressNotificationSchema:N,LoggingMessageNotificationParamsSchema:k,LoggingMessageNotificationSchema:q,ResourceContentsSchema:U,TextResourceContentsSchema:V,BlobResourceContentsSchema:Q,AnnotationsSchema:X,ResourceSchema:ce,ResourceTemplateSchema:j,ResourceListChangedNotificationSchema:se,ResourceUpdatedNotificationParamsSchema:oe,ResourceUpdatedNotificationSchema:Fe,PromptArgumentSchema:Ie,PromptSchema:mt,PromptListChangedNotificationSchema:tt,TextContentSchema:Je,ImageContentSchema:Y,AudioContentSchema:re,ToolUseContentSchema:Re,EmbeddedResourceSchema:Ge,ResourceLinkSchema:Me,ContentBlockSchema:We,PromptMessageSchema:Lt,ToolAnnotationsSchema:Xe,ToolListChangedNotificationSchema:st,ModelHintSchema:St,ModelPreferencesSchema:Qe,ToolChoiceSchema:xt,BooleanSchemaSchema:Ot,StringSchemaSchema:qt,NumberSchemaSchema:Mt,UntitledSingleSelectEnumSchemaSchema:It,TitledSingleSelectEnumSchemaSchema:F,LegacyTitledEnumSchemaSchema:Bt,SingleSelectEnumSchemaSchema:dt,UntitledMultiSelectEnumSchemaSchema:R,TitledMultiSelectEnumSchemaSchema:S,MultiSelectEnumSchemaSchema:z,EnumSchemaSchema:Z,PrimitiveSchemaDefinitionSchema:K,ElicitRequestFormParamsSchema:le,ResourceTemplateReferenceSchema:de,PromptReferenceSchema:J,RootSchema:ne,ClientCapabilities2026Schema:Ne,ServerCapabilities2026Schema:me,RequestMetaEnvelopeSchema:Pe,ToolSchema:ze,ToolResultContentSchema:qe,SamplingMessageContentBlockSchema:O,SamplingMessageSchema:fe,ResultTypeSchema:te,ResultMetaSchema:ge,ResultSchema:De,PaginatedResultSchema:Ce,CallToolResultSchema:_t,ListToolsResultSchema:lt,ListPromptsResultSchema:an,GetPromptResultSchema:dn,ListResourcesResultSchema:ds,ListResourceTemplatesResultSchema:hs,ReadResourceResultSchema:Vi,CompleteResultSchema:Mi,CacheableResultSchema:zs,DiscoverResultSchema:Gi,CreateMessageRequestParamsSchema:Zn,CreateMessageRequestSchema:Dn,ListRootsRequestSchema:Ei,CreateMessageResultSchema:$i,ListRootsResultSchema:qi,ElicitResultSchema:oi,ElicitRequestURLParamsSchema:Wi,ElicitRequestParamsSchema:ai,ElicitRequestSchema:Zi,InputRequestSchema:Xi,InputResponseSchema:fs,InputRequestsSchema:ps,InputResponsesSchema:ms,InputRequiredResultSchema:Ti,InputResponseRequestParamsSchema:y,CallToolRequestSchema:Te,ListToolsRequestSchema:ve,ListPromptsRequestSchema:we,GetPromptRequestSchema:Le,ListResourcesRequestSchema:Ye,ListResourceTemplatesRequestSchema:et,ReadResourceRequestSchema:Ae,CompleteRequestSchema:Dt,DiscoverRequestSchema:yt,SubscriptionFilterSchema:gt,SubscriptionsListenRequestSchema:Ee,SubscriptionsListenResultMetaSchema:Wt,SubscriptionsListenResultSchema:it,dispatchRequestSchemas:Gt,dispatchResultSchemas:Un,NotificationMetaSchema:Rn,SubscriptionsAcknowledgedNotificationSchema:ht,CancelledNotificationParamsSchema:Rt,CancelledNotificationSchema:vn,notificationSchemas2026:bt,JSONRPCResultResponseSchema:Ft(De),CallToolResultResponseSchema:Ft(Se([_t,Ti])),ListToolsResultResponseSchema:Ft(lt),ListPromptsResultResponseSchema:Ft(an),GetPromptResultResponseSchema:Ft(Se([dn,Ti])),ListResourcesResultResponseSchema:Ft(ds),ListResourceTemplatesResultResponseSchema:Ft(hs),ReadResourceResultResponseSchema:Ft(Se([Vi,Ti])),CompleteResultResponseSchema:Ft(Mi),DiscoverResultResponseSchema:Ft(Gi),SubscriptionsListenResultResponseSchema:Ft(it)}}let rT;function rs(){return rT??(rT=sT())}const oT=["tools/list","prompts/list","resources/list","resources/templates/list","resources/read","server/discover"];function aT(t){return oT.includes(t)}const Ad=Symbol("modelcontextprotocol.resultCacheHintFallback");function cT(t){return t[Ad]}function X_(t){return typeof t=="number"&&Number.isSafeInteger(t)&&t>=0}function Y_(t){return t==="public"||t==="private"}let ot=(function(t){return t[t.ParseError=-32700]="ParseError",t[t.InvalidRequest=-32600]="InvalidRequest",t[t.MethodNotFound=-32601]="MethodNotFound",t[t.InvalidParams=-32602]="InvalidParams",t[t.InternalError=-32603]="InternalError",t[t.ResourceNotFound=-32002]="ResourceNotFound",t[t.MissingRequiredClientCapability=-32021]="MissingRequiredClientCapability",t[t.UnsupportedProtocolVersion=-32022]="UnsupportedProtocolVersion",t[t.UrlElicitationRequired=-32042]="UrlElicitationRequired",t})({});var Es,gn=(Es=class extends Error{static[Symbol.hasInstance](e){return Ea(this,e)}static isInstance(e){if(typeof this!="function")throw new TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return Ea(this,e)}constructor(e,n,i){super(n),this.code=e,this.data=i,this.name="ProtocolError",H_(this,new.target)}static fromError(e,n,i){if(e===ot.UrlElicitationRequired&&i){const s=i;if(s.elicitations)return new uT(s.elicitations,n)}if(e===ot.UnsupportedProtocolVersion&&i){const s=i;if(Array.isArray(s.supported)&&typeof s.requested=="string")return new dT({supported:s.supported,requested:s.requested},n)}if(e===ot.InvalidParams||e===ot.ResourceNotFound){const s=i;if(typeof(s==null?void 0:s.uri)=="string"&&(e===ot.ResourceNotFound||Object.keys(s).length===1))return new lT(s.uri,n)}if(e===ot.MissingRequiredClientCapability&&i){const s=i;if(s.requiredCapabilities!==null&&typeof s.requiredCapabilities=="object"&&!Array.isArray(s.requiredCapabilities))return new hT({requiredCapabilities:s.requiredCapabilities},n)}return new Es(e,n,i)}},Object.defineProperty(Es,"mcpBrand",{value:"mcp.ProtocolError"}),Es),ur,lT=(ur=class extends gn{constructor(e,n=`Resource not found: ${e}`){super(ot.InvalidParams,n,{uri:e})}get uri(){return this.data.uri}},Object.defineProperty(ur,"mcpBrand",{value:"mcp.ResourceNotFoundError"}),ur),dr,uT=(dr=class extends gn{constructor(e,n=`URL elicitation${e.length>1?"s":""} required`){super(ot.UrlElicitationRequired,n,{elicitations:e})}get elicitations(){var e;return((e=this.data)==null?void 0:e.elicitations)??[]}},Object.defineProperty(dr,"mcpBrand",{value:"mcp.UrlElicitationRequiredError"}),dr),hr,dT=(hr=class extends gn{constructor(e,n=`Unsupported protocol version: ${e.requested}`){super(ot.UnsupportedProtocolVersion,n,e)}get supported(){return this.data.supported}get requested(){return this.data.requested}},Object.defineProperty(hr,"mcpBrand",{value:"mcp.UnsupportedProtocolVersionError"}),hr),fr,hT=(fr=class extends gn{constructor(e,n=`Missing required client capabilities: ${Object.keys(e.requiredCapabilities).join(", ")}`){super(ot.MissingRequiredClientCapability,n,e)}get requiredCapabilities(){return this.data.requiredCapabilities}},Object.defineProperty(fr,"mcpBrand",{value:"mcp.MissingRequiredClientCapabilityError"}),fr);const fT=0,pT="private",mT=["tools/call","prompts/get","resources/read"];function gT(t,e){const n=e.resultType;if(n===void 0)return{...e,resultType:"complete"};if(n==="complete"||mT.includes(t))return e;throw new gn(ot.InternalError,`Handler for ${t} returned resultType '${String(n)}', but results of ${t} only support 'complete' on protocol revision 2026-07-28`)}function _T(t,e){const n=cT(e);if(e.resultType!=="complete"||!aT(t))return n===void 0?e:bT(e);const i=e,s=X_(i.ttlMs)?i.ttlMs:xT(n),r=Y_(i.cacheScope)?i.cacheScope:yT(n),o={...i,ttlMs:s,cacheScope:r};return delete o[Ad],o}function ST(t){return t!==null&&typeof t=="object"&&!Array.isArray(t)}function vT(t,e){if(e===void 0)return t;const n=t._meta;return n===void 0?{...t,_meta:{[Xr]:e}}:!ST(n)||n[Xr]!==void 0?t:{...t,_meta:{...n,[Xr]:e}}}function xT(t){return t!==void 0&&X_(t.ttlMs)?t.ttlMs:fT}function yT(t){return t!==void 0&&Y_(t.cacheScope)?t.cacheScope:pT}function bT(t){const e={...t};return delete e[Ad],e}const MT=["elicitation/create","sampling/createMessage","roots/list"];let Co;function K_(){if(Co)return Co;const t=rs();return Co={request:{"elicitation/create":M({method:C("elicitation/create"),params:t.ElicitRequestParamsSchema}),"sampling/createMessage":M({method:C("sampling/createMessage"),params:t.CreateMessageRequestParamsSchema}),"roots/list":M({method:C("roots/list"),params:He({}).optional()})},response:{"elicitation/create":t.ElicitResultSchema,"sampling/createMessage":t.CreateMessageResultSchema,"roots/list":t.ListRootsResultSchema}},Co}function j_(t){return MT.includes(t)}function Nc(t){return j_(t)?K_().request[t]:void 0}function ET(t){return j_(t)?K_().response[t]:void 0}const J_={"tools/call":null,"tools/list":null,"prompts/get":null,"prompts/list":null,"resources/list":null,"resources/templates/list":null,"resources/read":null,"completion/complete":null,"server/discover":null,"subscriptions/listen":null},TT={"notifications/cancelled":null,"notifications/progress":null,"notifications/message":null,"notifications/resources/updated":null,"notifications/resources/list_changed":null,"notifications/tools/list_changed":null,"notifications/prompts/list_changed":null,"notifications/subscriptions/acknowledged":null};function Q_(t){return Object.prototype.hasOwnProperty.call(J_,t)}function eS(t){return Object.prototype.hasOwnProperty.call(TT,t)}function RT(t){return Object.prototype.hasOwnProperty.call(J_,t)}function wT(t){return Q_(t)?rs().dispatchRequestSchemas[t]:void 0}function AT(t){return RT(t)?rs().dispatchResultSchemas[t]:void 0}function CT(t){return eS(t)?rs().notificationSchemas2026[t]:void 0}function Yr(t){return t!==null&&typeof t=="object"&&!Array.isArray(t)}function Nr(t,e){if(t===void 0)return{ok:!1,reason:"not-in-era"};const n=t.safeParse(e);return n.success?{ok:!0,value:n.data}:{ok:!1,reason:"invalid",message:String(n.error)}}const PT={ok:!1,reason:"not-in-era"},LT=[Ya,Ka];function IT(t,e){let n=e,i=!1;const s=()=>(i||(n={...n},i=!0),n),r=e.tools;t==="tools/list"&&Array.isArray(r)&&r.some(a=>Yr(a)&&"execution"in a)&&(s().tools=r.map(a=>{if(!Yr(a)||!("execution"in a))return a;const c={...a};return delete c.execution,c}));const o=e.capabilities;if(Yr(o)&&"tasks"in o){const a={...o};delete a.tasks,s().capabilities=a}return n}const Cd={era:"2026-07-28",hasRequestMethod:Q_,hasNotificationMethod:eS,hasInputRequestMethod:t=>Nc(t)!==void 0,validateRequest:(t,e)=>Nr(wT(t),e),validateResult:(t,e)=>Nr(AT(t),e),validateNotification:(t,e)=>Nr(CT(t),e),validateInputRequest:(t,e)=>Nr(Nc(t),e),validateInputResponse:(t,e)=>Nr(ET(t),e),samplingResultVariant:()=>PT,outboundEnvelope(t){return{[Ya]:t.protocolVersion,[Ju]:t.clientInfo,[Ka]:t.clientCapabilities,...t.logLevel!==void 0&&{[Qu]:t.logLevel}}},validateEnvelopeMeta(t){const e=[];for(const i of LT)i in t||e.push({key:i,problem:"missing"});const n=rs().RequestMetaEnvelopeSchema.safeParse(t);if(!n.success)for(const i of n.error.issues){const s=i.path.map(String),r=s.length>0?s.join("."):"_meta";s.length===1&&e.some(o=>o.key===r&&o.problem==="missing")||e.push({key:r,problem:i.message})}return e},projectCallToolResult:t=>V_(t),inputRequestSchema:Nc,decodeResult(t,e){if(!Yr(e))return{kind:"invalid",error:new sn(mn.InvalidResult,`Invalid result for ${t}: not an object`,{method:t})};const n=e.resultType;if(n===void 0)return{kind:"invalid",error:new sn(mn.InvalidResult,`Invalid result for ${t}: missing required resultType — servers implementing protocol revision 2026-07-28 MUST include it (the absent-means-complete bridge applies only to earlier-revision servers)`,{method:t,violation:"missing-resultType"})};if(typeof n!="string")return{kind:"invalid",error:new sn(mn.InvalidResult,`Invalid result for ${t}: non-string resultType`,{method:t,resultType:n})};if(n==="input_required"){const o=e.inputRequests,a=Yr(o)?o:{},c=e.requestState,l=e._meta===void 0?void 0:rs().ResultMetaSchema.safeParse(e._meta),u=l!=null&&l.success?l.data:void 0;return Object.keys(a).length===0&&typeof c!="string"?{kind:"invalid",error:new sn(mn.InvalidResult,`Invalid result for ${t}: input_required carries neither inputRequests nor requestState (every input_required result must include at least one of the two)`,{method:t,violation:"input-required-missing-both"})}:{kind:"input_required",inputRequests:a,...typeof c=="string"&&{requestState:c},...u!==void 0&&{_meta:u}}}if(n!=="complete")return{kind:"invalid",error:new sn(mn.UnsupportedResultType,`Unsupported result type '${n}' for ${t}`,{resultType:n,method:t})};const i=NT(),s=Object.hasOwn(i,t)?i[t]:void 0;if(s!==void 0){const o=s.safeParse(e);if(!o.success)return{kind:"invalid",error:new sn(mn.InvalidResult,`Invalid result for ${t}: ${o.error}`,{method:t})}}const r={...e};return delete r.resultType,{kind:"complete",result:r}},encodeResult(t,e,n){return vT(_T(t,gT(t,IT(t,e))),n)},encodeErrorCode:t=>t===-32002?-32602:t,checkInboundEnvelope(t){if(t.envelope===void 0)return"Request is missing the required _meta envelope for protocol revision 2026-07-28 (io.modelcontextprotocol/protocolVersion, io.modelcontextprotocol/clientCapabilities)";const e=rs().RequestMetaEnvelopeSchema.safeParse(t.envelope);if(!e.success)return`Invalid _meta envelope for protocol revision 2026-07-28: ${e.error.issues.map(n=>n.message).join("; ")}`}};let Po;function NT(){if(Po)return Po;const t=rs();return Po={"tools/call":t.CallToolResultSchema,"tools/list":t.ListToolsResultSchema,"prompts/get":t.GetPromptResultSchema,"prompts/list":t.ListPromptsResultSchema,"resources/list":t.ListResourcesResultSchema,"resources/templates/list":t.ListResourceTemplatesResultSchema,"resources/read":t.ReadResourceResultSchema,"completion/complete":t.CompleteResultSchema,"server/discover":t.DiscoverResultSchema},Po}const tS="2026-07-28";function Ta(t){return t!==void 0&&$E(t)?Cd:wd}function Qh(t){return t.revision!==void 0?Ta(t.revision).era:t.era==="modern"?Cd.era:wd.era}function Dc(t){return nS.some(e=>e.hasRequestMethod(t))}function Uc(t){return nS.some(e=>e.hasNotificationMethod(t))}function ef(t){return t==="tasks/get"||t==="tasks/cancel"}const nS=[wd,Cd];var DT=Pv({AnnotationsSchema:()=>Os,AudioContentSchema:()=>sc,BaseMetadataSchema:()=>ws,BaseRequestParamsSchema:()=>Sn,BlobResourceContentsSchema:()=>fd,BooleanSchemaSchema:()=>vd,CallToolRequestParamsSchema:()=>e_,CallToolRequestSchema:()=>t_,CallToolResultSchema:()=>oc,CancelTaskRequestSchema:()=>wE,CancelTaskResultSchema:()=>AE,CancelledNotificationParamsSchema:()=>rg,CancelledNotificationSchema:()=>od,ClientCapabilitiesSchema:()=>lg,ClientNotificationSchema:()=>PE,ClientRequestSchema:()=>CE,ClientResultSchema:()=>LE,ClientTasksCapabilitySchema:()=>ag,CompatibilityCallToolResultSchema:()=>gE,CompleteRequestParamsSchema:()=>A_,CompleteRequestSchema:()=>C_,CompleteResultSchema:()=>P_,ContentBlockSchema:()=>Ar,CreateMessageRequestParamsSchema:()=>f_,CreateMessageRequestSchema:()=>p_,CreateMessageResultSchema:()=>m_,CreateMessageResultWithToolsSchema:()=>g_,CreateTaskResultSchema:()=>vE,CursorSchema:()=>td,DiscoverRequestSchema:()=>pg,DiscoverResultSchema:()=>mg,ElicitRequestFormParamsSchema:()=>cc,ElicitRequestParamsSchema:()=>y_,ElicitRequestSchema:()=>b_,ElicitRequestURLParamsSchema:()=>x_,ElicitResultSchema:()=>T_,ElicitationCompleteNotificationParamsSchema:()=>M_,ElicitationCompleteNotificationSchema:()=>E_,EmbeddedResourceSchema:()=>gd,EmptyResultSchema:()=>ec,EnumSchemaSchema:()=>v_,GetPromptRequestParamsSchema:()=>$g,GetPromptRequestSchema:()=>qg,GetPromptResultSchema:()=>Xg,GetTaskPayloadRequestSchema:()=>ME,GetTaskPayloadResultSchema:()=>EE,GetTaskRequestSchema:()=>yE,GetTaskResultSchema:()=>bE,IconSchema:()=>og,IconsSchema:()=>Mr,ImageContentSchema:()=>ic,ImplementationSchema:()=>Er,InitializeRequestParamsSchema:()=>ug,InitializeRequestSchema:()=>dg,InitializeResultSchema:()=>hg,InitializedNotificationSchema:()=>fg,JSONArraySchema:()=>hE,JSONObjectSchema:()=>Xt,JSONRPCErrorResponseSchema:()=>Qa,JSONRPCMessageSchema:()=>sg,JSONRPCNotificationSchema:()=>rd,JSONRPCRequestSchema:()=>sd,JSONRPCResponseSchema:()=>fE,JSONRPCResultResponseSchema:()=>Ja,JSONValueSchema:()=>Sr,LegacyTitledEnumSchemaSchema:()=>bd,ListChangedOptionsBaseSchema:()=>_E,ListPromptsRequestSchema:()=>Vg,ListPromptsResultSchema:()=>Gg,ListResourceTemplatesRequestSchema:()=>bg,ListResourceTemplatesResultSchema:()=>Mg,ListResourcesRequestSchema:()=>xg,ListResourcesResultSchema:()=>yg,ListRootsRequestSchema:()=>I_,ListRootsResultSchema:()=>N_,ListTasksRequestSchema:()=>TE,ListTasksResultSchema:()=>RE,ListToolsRequestSchema:()=>Jg,ListToolsResultSchema:()=>Qg,LoggingLevelSchema:()=>Sd,LoggingMessageNotificationParamsSchema:()=>r_,LoggingMessageNotificationSchema:()=>o_,ModelHintSchema:()=>a_,ModelPreferencesSchema:()=>c_,MultiSelectEnumSchemaSchema:()=>S_,NotificationSchema:()=>In,NotificationsParamsSchema:()=>Ln,NumberSchemaSchema:()=>Ma,PaginatedRequestParamsSchema:()=>Sg,PaginatedRequestSchema:()=>Tr,PaginatedResultSchema:()=>Rr,PingRequestSchema:()=>cd,PrimitiveSchemaDefinitionSchema:()=>Td,ProgressNotificationParamsSchema:()=>_g,ProgressNotificationSchema:()=>ld,ProgressSchema:()=>gg,ProgressTokenSchema:()=>ed,PromptArgumentSchema:()=>Bg,PromptListChangedNotificationSchema:()=>Yg,PromptMessageSchema:()=>Zg,PromptReferenceSchema:()=>w_,PromptSchema:()=>Hg,ReadResourceRequestParamsSchema:()=>Eg,ReadResourceRequestSchema:()=>Tg,ReadResourceResultSchema:()=>Rg,RelatedTaskMetadataSchema:()=>ig,RequestIdSchema:()=>Us,RequestMetaSchema:()=>nd,RequestSchema:()=>Kt,ResourceContentsSchema:()=>ud,ResourceLinkSchema:()=>_d,ResourceListChangedNotificationSchema:()=>wg,ResourceRequestParamsSchema:()=>tc,ResourceSchema:()=>pd,ResourceTemplateReferenceSchema:()=>R_,ResourceTemplateSchema:()=>vg,ResourceUpdatedNotificationParamsSchema:()=>kg,ResourceUpdatedNotificationSchema:()=>zg,ResultMetaObjectSchema:()=>id,ResultSchema:()=>jt,RoleSchema:()=>wr,RootSchema:()=>L_,RootsListChangedNotificationSchema:()=>D_,SamplingContentSchema:()=>d_,SamplingMessageContentBlockSchema:()=>ro,SamplingMessageSchema:()=>h_,ServerCapabilitiesSchema:()=>ad,ServerNotificationSchema:()=>NE,ServerRequestSchema:()=>IE,ServerResultSchema:()=>DE,ServerTasksCapabilitySchema:()=>cg,SetLevelRequestParamsSchema:()=>i_,SetLevelRequestSchema:()=>s_,SingleSelectEnumSchemaSchema:()=>__,StringSchemaSchema:()=>ac,SubscribeRequestParamsSchema:()=>Ag,SubscribeRequestSchema:()=>Cg,SubscriptionFilterSchema:()=>md,SubscriptionsAcknowledgedNotificationParamsSchema:()=>Dg,SubscriptionsAcknowledgedNotificationSchema:()=>Ug,SubscriptionsListenRequestParamsSchema:()=>Ig,SubscriptionsListenRequestSchema:()=>Ng,SubscriptionsListenResultMetaSchema:()=>Og,SubscriptionsListenResultSchema:()=>Fg,TaskAugmentedRequestParamsSchema:()=>go,TaskCreationParamsSchema:()=>SE,TaskMetadataSchema:()=>ng,TaskSchema:()=>Cr,TaskStatusNotificationParamsSchema:()=>O_,TaskStatusNotificationSchema:()=>xE,TaskStatusSchema:()=>U_,TextContentSchema:()=>nc,TextResourceContentsSchema:()=>dd,TitledMultiSelectEnumSchemaSchema:()=>Ed,TitledSingleSelectEnumSchemaSchema:()=>yd,ToolAnnotationsSchema:()=>Kg,ToolChoiceSchema:()=>l_,ToolExecutionSchema:()=>jg,ToolListChangedNotificationSchema:()=>n_,ToolResultContentSchema:()=>u_,ToolSchema:()=>rc,ToolUseContentSchema:()=>Wg,UnsubscribeRequestParamsSchema:()=>Pg,UnsubscribeRequestSchema:()=>Lg,UntitledMultiSelectEnumSchemaSchema:()=>Md,UntitledSingleSelectEnumSchemaSchema:()=>xd});const UT=t=>sd.safeParse(t).success,OT=t=>rd.safeParse(t).success,tf=t=>Ja.safeParse(t).success,FT=t=>Qa.safeParse(t).success,Oc=-32020;ot.InvalidRequest,ot.UnsupportedProtocolVersion,ot.InvalidParams,ot.MethodNotFound,ot.InvalidParams,ot.MissingRequiredClientCapability;ot.ParseError+"",ot.InvalidRequest+"",ot.MethodNotFound+"",ot.UnsupportedProtocolVersion+"",ot.MissingRequiredClientCapability+"";function iS(t,e){return Vm(t,e)}function Dr(t){return new Set(t.flatMap(e=>Object.keys(e.shape)))}function Ul(t){var n;if(t==null)return!1;const e=typeof t;return e!=="object"&&e!=="function"||!("~standard"in t)?!1:typeof((n=t["~standard"])==null?void 0:n.validate)=="function"}let nf=!1;const Ol="draft-2020-12";function kT(t,e="input"){const n=t["~standard"];let i;if(n.jsonSchema)i=n.jsonSchema[e]({target:Ol});else if(n.vendor==="zod"){if(!("_zod"in t))throw new Error("Schema appears to be from zod 3, which the SDK cannot convert to JSON Schema. Upgrade to zod >=4.2.0, or wrap your JSON Schema with fromJsonSchema().");nf||(nf=!0,console.warn("[mcp-sdk] Your zod version does not implement `~standard.jsonSchema` (added in zod 4.2.0). Falling back to z.toJSONSchema(). Upgrade to zod >=4.2.0 to silence this warning.")),i=Hm(t,{target:Ol,io:e})}else throw new Error(`Schema library "${n.vendor}" does not implement StandardJSONSchemaV1 (\`~standard.jsonSchema\`). Upgrade to a version that does, or wrap your JSON Schema with fromJsonSchema().`);if(e==="output")return i.type!==void 0?i:sS(i)?{type:"object",...i}:i;if(i.type!==void 0&&i.type!=="object")throw new Error(`MCP tool and prompt schemas must describe objects (got type: ${JSON.stringify(i.type)}). Wrap your schema in z.object({...}) or equivalent.`);return{type:"object",...i}}function sS(t){if("properties"in t||"patternProperties"in t||"additionalProperties"in t||"required"in t)return!0;for(const e of["oneOf","anyOf","allOf"]){const n=t[e];if(Array.isArray(n)&&n.length>0)return n.every(i=>i!==null&&typeof i=="object"&&(i.type==="object"||sS(i)))}return!1}function zT(t){var e;return(e=t.path)!=null&&e.length?`${t.path.map(n=>String(typeof n=="object"?n.key:n)).join(".")}: ${t.message}`:t.message}async function Fc(t,e){const n=await t["~standard"].validate(e);return n.issues&&n.issues.length>0?{success:!1,error:n.issues.map(i=>zT(i)).join(", ")}:{success:!0,data:n.value}}function BT(t){const e=Hm(t,{target:Ol,io:"input"});return typeof e.pattern=="string"?e.pattern:void 0}const HT=/\\\.\\d\{(\d+)\}/;function VT(t){const e=HT.exec(t),n=[void 0,-1,0];return e&&n.push(Number(e[1])),[!1,!0].flatMap(i=>[!1,!0].flatMap(s=>n.map(r=>Xa({local:i,offset:s,precision:r}))))}function GT(t,e){let n;switch(t){case"email":n=[pM()];break;case"uri":n=[Xm()];break;case"date":n=[oE()];break;case"date-time":n=VT(e);break}return new Set(n.map(i=>BT(i)).filter(i=>i!==void 0))}function $T(t,e,n){return n!=="zod"?!0:GT(t,e).has(e)}function oo(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function qT(t){try{return kT(t,"input")}catch(e){const n=e instanceof Error?e.message:String(e);throw new gn(ot.InvalidParams,`Elicitation requestedSchema must describe an object with flat primitive properties: ${n}`)}}const WT=new Set(["$comment","deprecated","description","examples","readOnly","title","writeOnly"]);function Pd(t){return WT.has(t)||t.startsWith("x-")}const ZT=new Set(["$schema",...Object.keys(cc.shape.requestedSchema.shape)]),sf={string:Dr([ac,xd,yd,bd]),number:Dr([Ma]),integer:Dr([Ma]),boolean:Dr([vd]),array:Dr([Md,Ed])},XT=new Set(ac.shape.format.unwrap().options);function YT(t,e,n,i){if(!oo(t))return t;const s=typeof t.type=="string"&&Object.hasOwn(sf,t.type)?sf[t.type]:void 0;if(s===void 0)return t;const r={};for(const[o,a]of Object.entries(t))s.has(o)||Pd(o)?r[o]=a:o==="pattern"&&t.type==="string"&&typeof t.format=="string"?XT.has(t.format)?(typeof a!="string"||!$T(t.format,a,n))&&i.push(`${e}.${o}`):r[o]=a:i.push(`${e}.${o}`);return r}function KT(t,e){const n={},i=[];for(const[s,r]of Object.entries(t))s==="properties"&&oo(r)?n[s]=Object.fromEntries(Object.entries(r).map(([o,a])=>[o,YT(a,`properties.${o}`,e,i)])):ZT.has(s)?n[s]=r:Pd(s)||i.push(s);if(i.length>0)throw new gn(ot.InvalidParams,`Elicitation requestedSchema contains unsupported JSON Schema constraint(s) after Standard Schema conversion: ${i.join(", ")}`);return n}function jT(t,e){if(!oo(t.properties))return e;const n=Object.entries(t.properties).filter(([,i])=>!iS(Td,i).success).map(([i])=>`properties.${i}`);return n.length>0?n.join(", "):e}function Fl(t,e,n=""){return Array.isArray(t)&&Array.isArray(e)?t.flatMap((i,s)=>Fl(i,e[s],`${n}[${s}]`)):!oo(t)||!oo(e)?[]:Object.entries(t).flatMap(([i,s])=>{const r=n?`${n}.${i}`:i;return Object.prototype.hasOwnProperty.call(e,i)?Fl(s,e[i],r):Pd(i)?[]:[r]})}function JT(t){if(!Ul(t.requestedSchema))return{...t,mode:"form",requestedSchema:t.requestedSchema};const e=t.requestedSchema["~standard"].vendor,n=KT(qT(t.requestedSchema),e),i=iS(cc.shape.requestedSchema,n);if(!i.success)throw new gn(ot.InvalidParams,`Elicitation requestedSchema only supports flat primitive properties (string, number, integer, boolean, and string enums): ${jT(n,i.error.message)}`);const s=Fl(n,i.data);if(s.length>0)throw new gn(ot.InvalidParams,`Elicitation requestedSchema contains unsupported JSON Schema constraint(s) after Standard Schema conversion: ${s.join(", ")}`);const r=(i.data.required??[]).filter(o=>!Object.prototype.hasOwnProperty.call(i.data.properties,o));if(r.length>0)throw new gn(ot.InvalidParams,`Elicitation requestedSchema lists required properties that are not defined in properties: ${r.join(", ")}`);return{...t,mode:"form",requestedSchema:i.data}}function QT(t){const e=t.inputRequests!==void 0&&Object.keys(t.inputRequests).length>0,n=typeof t.requestState=="string";if(!e&&!n)throw new TypeError("inputRequired() requires at least one of inputRequests (with at least one entry) or requestState (spec: every InputRequiredResult MUST include at least one of the two)");return{resultType:"input_required",...t.inputRequests!==void 0&&{inputRequests:t.inputRequests},...t.requestState!==void 0&&{requestState:t.requestState}}}Object.assign(QT,{elicit(t){try{return{method:"elicitation/create",params:JT(t)}}catch(e){throw e instanceof gn?new TypeError(e.message,{cause:e}):e}},elicitUrl(t){return{method:"elicitation/create",params:{...t,mode:"url"}}},createMessage(t){return{method:"sampling/createMessage",params:t}},listRoots(){return{method:"roots/list"}}});const eR=["AnnotationsSchema","AudioContentSchema","BaseMetadataSchema","BlobResourceContentsSchema","BooleanSchemaSchema","CallToolRequestSchema","CallToolRequestParamsSchema","CallToolResultSchema","CancelledNotificationSchema","CancelledNotificationParamsSchema","CancelTaskRequestSchema","CancelTaskResultSchema","ClientCapabilitiesSchema","ClientNotificationSchema","ClientRequestSchema","ClientResultSchema","CompatibilityCallToolResultSchema","CompleteRequestSchema","CompleteRequestParamsSchema","CompleteResultSchema","ContentBlockSchema","CreateMessageRequestSchema","CreateMessageRequestParamsSchema","CreateMessageResultSchema","CreateMessageResultWithToolsSchema","CreateTaskResultSchema","CursorSchema","DiscoverRequestSchema","DiscoverResultSchema","ElicitationCompleteNotificationSchema","ElicitationCompleteNotificationParamsSchema","ElicitRequestSchema","ElicitRequestFormParamsSchema","ElicitRequestParamsSchema","ElicitRequestURLParamsSchema","ElicitResultSchema","EmbeddedResourceSchema","EmptyResultSchema","EnumSchemaSchema","GetPromptRequestSchema","GetPromptRequestParamsSchema","GetPromptResultSchema","GetTaskPayloadRequestSchema","GetTaskPayloadResultSchema","GetTaskRequestSchema","GetTaskResultSchema","IconSchema","IconsSchema","ImageContentSchema","ImplementationSchema","InitializedNotificationSchema","InitializeRequestSchema","InitializeRequestParamsSchema","InitializeResultSchema","JSONArraySchema","JSONObjectSchema","JSONRPCErrorResponseSchema","JSONRPCMessageSchema","JSONRPCNotificationSchema","JSONRPCRequestSchema","JSONRPCResponseSchema","JSONRPCResultResponseSchema","JSONValueSchema","LegacyTitledEnumSchemaSchema","ListPromptsRequestSchema","ListPromptsResultSchema","ListResourcesRequestSchema","ListResourcesResultSchema","ListResourceTemplatesRequestSchema","ListResourceTemplatesResultSchema","ListRootsRequestSchema","ListRootsResultSchema","ListTasksRequestSchema","ListTasksResultSchema","ListToolsRequestSchema","ListToolsResultSchema","LoggingLevelSchema","LoggingMessageNotificationSchema","LoggingMessageNotificationParamsSchema","ModelHintSchema","ModelPreferencesSchema","MultiSelectEnumSchemaSchema","NotificationSchema","NumberSchemaSchema","PaginatedRequestSchema","PaginatedRequestParamsSchema","PaginatedResultSchema","PingRequestSchema","PrimitiveSchemaDefinitionSchema","ProgressSchema","ProgressNotificationSchema","ProgressNotificationParamsSchema","ProgressTokenSchema","PromptSchema","PromptArgumentSchema","PromptListChangedNotificationSchema","PromptMessageSchema","PromptReferenceSchema","ReadResourceRequestSchema","ReadResourceRequestParamsSchema","ReadResourceResultSchema","RelatedTaskMetadataSchema","RequestSchema","RequestIdSchema","RequestMetaSchema","ResourceSchema","ResourceContentsSchema","ResourceLinkSchema","ResourceListChangedNotificationSchema","ResourceRequestParamsSchema","ResourceTemplateSchema","ResourceTemplateReferenceSchema","ResourceUpdatedNotificationSchema","ResourceUpdatedNotificationParamsSchema","ResultMetaObjectSchema","ResultSchema","RoleSchema","RootSchema","RootsListChangedNotificationSchema","SamplingContentSchema","SamplingMessageSchema","SamplingMessageContentBlockSchema","ServerCapabilitiesSchema","ServerNotificationSchema","ServerRequestSchema","ServerResultSchema","SetLevelRequestSchema","SetLevelRequestParamsSchema","SingleSelectEnumSchemaSchema","StringSchemaSchema","SubscribeRequestSchema","SubscribeRequestParamsSchema","SubscriptionFilterSchema","SubscriptionsAcknowledgedNotificationSchema","SubscriptionsAcknowledgedNotificationParamsSchema","SubscriptionsListenRequestSchema","SubscriptionsListenRequestParamsSchema","SubscriptionsListenResultSchema","SubscriptionsListenResultMetaSchema","TaskAugmentedRequestParamsSchema","TaskCreationParamsSchema","TaskMetadataSchema","TaskSchema","TaskStatusSchema","TaskStatusNotificationSchema","TaskStatusNotificationParamsSchema","TextContentSchema","TextResourceContentsSchema","TitledMultiSelectEnumSchemaSchema","TitledSingleSelectEnumSchemaSchema","ToolSchema","ToolAnnotationsSchema","ToolChoiceSchema","ToolExecutionSchema","ToolListChangedNotificationSchema","ToolResultContentSchema","ToolUseContentSchema","UnsubscribeRequestSchema","UnsubscribeRequestParamsSchema","UntitledMultiSelectEnumSchemaSchema","UntitledSingleSelectEnumSchemaSchema"],tR={IdJagTokenExchangeResponseSchema:kE,OAuthClientInformationFullSchema:BE,OAuthClientInformationSchema:B_,OAuthClientMetadataSchema:z_,OAuthClientRegistrationErrorSchema:HE,OAuthErrorResponseSchema:zE,OAuthMetadataSchema:F_,OAuthProtectedResourceMetadataSchema:UE,OAuthTokenRevocationRequestSchema:VE,OAuthTokensSchema:FE,OpenIdProviderDiscoveryMetadataSchema:OE,OpenIdProviderMetadataSchema:k_},rS={},oS={};function aS(t,e){const n=t.slice(0,-6);rS[n]=e,oS[n]=i=>e.safeParse(i).success}for(const t of eR)aS(t,DT[t]);for(const[t,e]of Object.entries(tR))aS(t,e);Object.freeze(rS);Object.freeze(oS);function nR(t){switch(t){case"initialize":case"notifications/initialized":return Ta(void 0);case"server/discover":return Ta(tS);default:return}}const iR=6e4,sR=[Ya,Ju,Ka,Qu],rR=["inputResponses","requestState"];function rf(t,e){const n=t.params;if(!kc(n))return{message:t,lifted:{}};const i=n._meta,s=kc(i)?sR.filter(c=>c in i):[],r=e==="request"?rR.filter(c=>c in n):[];if(s.length===0&&r.length===0)return{message:t,lifted:{}};const o={},a={...n};if(s.length>0&&kc(i)){const c={},l={...i};for(const u of s)c[u]=i[u],delete l[u];o.envelope=c,Object.keys(l).length>0?a._meta=l:delete a._meta}for(const c of r)c==="inputResponses"&&(o.inputResponses=a[c]),c==="requestState"&&(o.requestState=a[c]),delete a[c];return{message:{...t,params:a},lifted:o}}function of(t,e){const n=t.validateResult(e,void 0);if(!(!n.ok&&n.reason==="not-in-era"))return{"~standard":{version:1,vendor:"mcp-wire-codec",validate(i){const s=t.validateResult(e,i);return s.ok?{value:s.value}:{issues:[{message:s.reason==="invalid"?s.message:`not-in-era: ${e}`}]}}}}}function cS(t){return()=>t}const oR=cS(void 0);var aR=class{constructor(t){Ve(this,"_transport");Ve(this,"_requestMessageId",0);Ve(this,"_requestHandlers",new Map);Ve(this,"_customSchemaRequestMethods",new Set);Ve(this,"_requestHandlerAbortControllers",new Map);Ve(this,"_notificationHandlers",new Map);Ve(this,"_responseHandlers",new Map);Ve(this,"_progressHandlers",new Map);Ve(this,"_timeoutInfo",new Map);Ve(this,"_pendingDebouncedNotifications",new Set);Ve(this,"_negotiatedProtocolVersion");Ve(this,"_supportedProtocolVersions");Ve(this,"onclose");Ve(this,"onerror");Ve(this,"fallbackRequestHandler");Ve(this,"fallbackNotificationHandler");this._options=t,this._supportedProtocolVersions=(t==null?void 0:t.supportedProtocolVersions)??lE,this.setNotificationHandler("notifications/cancelled",e=>{this._oncancel(e)}),this.setNotificationHandler("notifications/progress",e=>{this._onprogress(e)}),this.setRequestHandler("ping",e=>({}))}_shouldDropInbound(t){}_outboundMetaEnvelope(){}_envelopeOutbound(t){const e=this._outboundMetaEnvelope();if(e===void 0)return t;const n=t.params??{};return{...t,params:{...n,_meta:{...e,...n._meta}}}}_resolveNonCompleteResult(t,e){return Promise.reject(new sn(mn.UnsupportedResultType,`Unsupported result type '${t.kind}' for ${e.request.method}`,{resultType:t.kind,method:e.request.method}))}_getRequestHandler(t){return this._requestHandlers.get(t)}async _oncancel(t){var e;t.params.requestId!==void 0&&((e=this._requestHandlerAbortControllers.get(t.params.requestId))==null||e.abort(t.params.reason))}_setupTimeout(t,e,n,i,s=!1){this._timeoutInfo.set(t,{timeoutId:setTimeout(i,e),startTime:Date.now(),timeout:e,maxTotalTimeout:n,resetTimeoutOnProgress:s,onTimeout:i})}_resetTimeout(t){const e=this._timeoutInfo.get(t);if(!e)return!1;const n=Date.now()-e.startTime;if(e.maxTotalTimeout&&n>=e.maxTotalTimeout)throw this._timeoutInfo.delete(t),new sn(mn.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:e.maxTotalTimeout,totalElapsed:n});return clearTimeout(e.timeoutId),e.timeoutId=setTimeout(e.onTimeout,e.timeout),!0}_cleanupTimeout(t){const e=this._timeoutInfo.get(t);e&&(clearTimeout(e.timeoutId),this._timeoutInfo.delete(t))}async connect(t){var s,r,o,a;this._transport=t;const e=(s=this.transport)==null?void 0:s.onclose;this._transport.onclose=()=>{try{e==null||e()}finally{this._onclose()}};const n=(r=this.transport)==null?void 0:r.onerror;this._transport.onerror=c=>{n==null||n(c),this._onerror(c)};const i=(o=this._transport)==null?void 0:o.onmessage;this._transport.onmessage=(c,l)=>{i==null||i(c,l),tf(c)||FT(c)?this._onresponse(c):UT(c)?this._onrequest(c,l):OT(c)?this._onnotification(c,l):this._onerror(new Error(`Unknown message type: ${JSON.stringify(c)}`))},(a=t.setSupportedProtocolVersions)==null||a.call(t,this._supportedProtocolVersions),await this._transport.start()}_onclose(){var i;const t=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._pendingDebouncedNotifications.clear();for(const s of this._timeoutInfo.values())clearTimeout(s.timeoutId);this._timeoutInfo.clear();const e=this._requestHandlerAbortControllers;this._requestHandlerAbortControllers=new Map;const n=new sn(mn.ConnectionClosed,"Connection closed");this._transport=void 0;try{(i=this.onclose)==null||i.call(this)}finally{for(const s of t.values())s(n);for(const s of e.values())s.abort(n)}}_onerror(t){var e;(e=this.onerror)==null||e.call(this,t)}_onnotification(t,e){const{message:n}=rf(t,"notification"),i=this._negotiatedWireCodec();if((e==null?void 0:e.classification)===void 0&&this._shouldDropInbound(t)==="drop")return;if((e==null?void 0:e.classification)!==void 0){const o=Qh(e.classification);if(o!==i.era){this._onerror(new Error(`Era mismatch on inbound notification '${n.method}': classified as ${o} but this instance serves ${i.era}`));return}}if(Uc(n.method)&&!i.hasNotificationMethod(n.method))return;const s=this._notificationHandlers.get(n.method),r=this.fallbackNotificationHandler;s===void 0&&r===void 0||Promise.resolve().then(()=>s===void 0?r(n):s(n,i)).catch(o=>this._onerror(new Error(`Uncaught error in notification handler: ${o}`)))}_onrequest(t,e){var x;const{message:n,lifted:i}=rf(t,"request"),s=this._negotiatedWireCodec();if((e==null?void 0:e.classification)===void 0&&this._shouldDropInbound(t)==="drop"){this._onerror(new Error(`Dropped inbound request '${t.method}': not servable on this connection's protocol era`));return}const r=this._transport,o=(m,p,E)=>{const I={jsonrpc:"2.0",id:n.id,error:{code:m,message:p,...E!==void 0&&{data:E}}};r==null||r.send(I).catch(b=>this._onerror(new Error(`Failed to send an error response: ${b}`)))};if((e==null?void 0:e.classification)!==void 0){const m=Qh(e.classification);if(m!==s.era){this._onerror(new Error(`Era mismatch on inbound request '${n.method}': classified as ${m} but this instance serves ${s.era}`));const p=e.classification.revision??m;o(ot.UnsupportedProtocolVersion,`Unsupported protocol version: ${p}`,{supported:this._supportedProtocolVersions,requested:p});return}}if(Dc(n.method)&&!s.hasRequestMethod(n.method)&&!(ef(n.method)&&this._customSchemaRequestMethods.has(n.method))){o(ot.MethodNotFound,"Method not found");return}const a=this._requestHandlers.get(n.method)??this.fallbackRequestHandler;if(a===void 0){o(ot.MethodNotFound,"Method not found");return}const c=s.checkInboundEnvelope(i);if(c!==void 0){o(ot.InvalidParams,c);return}const l=(m,p)=>this._notificationViaCodec(this._resolveOutboundCodec(m.method),m,{...p,relatedRequestId:n.id}),u=(m,p,E)=>this._requestWithSchemaViaCodec(this._resolveOutboundCodec(m.method),m,p,{...E,relatedRequestId:n.id}),h=new AbortController;this._requestHandlerAbortControllers.set(n.id,h);const d=i.inputResponses===void 0?void 0:cR(i.inputResponses),f={sessionId:r==null?void 0:r.sessionId,mcpReq:{id:n.id,method:n.method,_meta:(x=n.params)==null?void 0:x._meta,...i.envelope!==void 0&&{envelope:i.envelope},...d!==void 0&&{inputResponses:d.accepted},...d!==void 0&&d.droppedKeys.length>0&&{droppedInputResponseKeys:d.droppedKeys},requestState:i.requestState===void 0?oR:cS(i.requestState),signal:h.signal,send:((m,p,E)=>{const I=this._resolveOutboundCodec(m.method);if(this._assertOutboundRequestInEra(I,m.method),Ul(p))return u(m,p,E);const b=of(I,m.method);if(b===void 0)throw new TypeError(`'${m.method}' is not a spec method; pass a result schema as the second argument to ctx.mcpReq.send().`);return u(m,b,p)}),notify:l},http:e!=null&&e.authInfo?{authInfo:e.authInfo}:void 0},_=this.buildContext(f,e);Promise.resolve().then(()=>a(n,_)).then(async m=>{if(h.signal.aborted)return;let p;try{p=s.encodeResult(n.method,m,this._outboundServerInfo())}catch(I){this._onerror(new Error(`Failed to encode result for ${n.method}: ${I}`)),o(ot.InternalError,"Internal error");return}const E={result:p,jsonrpc:"2.0",id:n.id};await(r==null?void 0:r.send(E))},async m=>{if(h.signal.aborted)return;const p=Number.isSafeInteger(m.code)?m.code:ot.InternalError,E={jsonrpc:"2.0",id:n.id,error:{code:s.encodeErrorCode(p),message:m.message??"Internal error",...m.data!==void 0&&{data:m.data}}};await(r==null?void 0:r.send(E))}).catch(m=>this._onerror(new Error(`Failed to send response: ${m}`))).finally(()=>{this._requestHandlerAbortControllers.get(n.id)===h&&this._requestHandlerAbortControllers.delete(n.id)})}_onprogress(t){const{progressToken:e,...n}=t.params,i=Number(e),s=this._progressHandlers.get(i);if(!s){this._onerror(new Error(`Received a progress notification for an unknown token: ${JSON.stringify(t)}`));return}const r=this._responseHandlers.get(i),o=this._timeoutInfo.get(i);if(o&&r&&o.resetTimeoutOnProgress)try{this._resetTimeout(i)}catch(a){this._responseHandlers.delete(i),this._progressHandlers.delete(i),this._cleanupTimeout(i),r(a);return}s(n)}_onresponse(t){const e=Number(t.id),n=this._responseHandlers.get(e);if(n===void 0){this._onerror(new Error(`Received a response for an unknown message ID: ${JSON.stringify(t)}`));return}this._responseHandlers.delete(e),this._cleanupTimeout(e),this._progressHandlers.delete(e),tf(t)?n(t):n(gn.fromError(t.error.code,t.error.message,t.error.data))}get transport(){return this._transport}async close(){var t;await((t=this._transport)==null?void 0:t.close())}request(t,e,n){const i=this._resolveOutboundCodec(t.method);if(Ul(e))return ef(t.method)||this._assertOutboundRequestInEra(i,t.method),this._requestWithSchemaViaCodec(i,t,e,n);this._assertOutboundRequestInEra(i,t.method);const s=of(i,t.method);if(s===void 0)throw new TypeError(`'${t.method}' is not a spec method; pass a result schema as the second argument to request().`);return this._requestWithSchemaViaCodec(i,t,s,e)}_negotiatedWireCodec(){return Ta(this._negotiatedProtocolVersion)}_wireCodec(){return this._negotiatedWireCodec()}_resolveOutboundCodec(t){if(this._negotiatedProtocolVersion===void 0){const e=nR(t);if(e)return e}return this._negotiatedWireCodec()}_assertOutboundRequestInEra(t,e){if(Dc(e)&&!t.hasRequestMethod(e))throw new sn(mn.MethodNotSupportedByProtocolVersion,`Method '${e}' is not supported by the negotiated protocol version (wire era ${t.era})`,{method:e,era:t.era})}_requestWithSchema(t,e,n){const i=this._resolveOutboundCodec(t.method);return this._assertOutboundRequestInEra(i,t.method),this._requestWithSchemaViaCodec(i,t,e,n)}_requestWithSchemaViaCodec(t,e,n,i){const{relatedRequestId:s,resumptionToken:r,onresumptiontoken:o,headers:a}=i??{},c=Date.now();let l,u;return new Promise((h,d)=>{var A,P,v,T;const f=L=>{d(L)};if(!this._transport){f(new Error("Not connected"));return}if(((A=this._options)==null?void 0:A.enforceStrictCapabilities)===!0)try{this.assertCapabilityForMethod(e.method)}catch(L){f(L);return}if((P=i==null?void 0:i.signal)!=null&&P.aborted){const L=i.signal.reason;throw L instanceof sn?L:new sn(mn.RequestTimeout,String(L))}const _=t.era===tS&&this._transport.hasPerRequestStream===!0?new AbortController:void 0,x=this._requestMessageId++;u=x;const m={...e,jsonrpc:"2.0",id:x};i!=null&&i.onprogress&&(this._progressHandlers.set(x,i.onprogress),m.params={...e.params,_meta:{...(v=e.params)==null?void 0:v._meta,progressToken:x}});const p=this._envelopeOutbound(m);let E=!1;const I=L=>{var N;E||(this._progressHandlers.delete(x),_===void 0?e.method!=="initialize"&&((N=this._transport)==null||N.send(this._envelopeOutbound({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:x,reason:String(L)}}),{relatedRequestId:s,resumptionToken:r,onresumptiontoken:o}).catch(k=>this._onerror(new Error(`Failed to send cancellation: ${k}`)))):_.abort(),d(L instanceof sn?L:new sn(mn.RequestTimeout,String(L))))};this._responseHandlers.set(x,L=>{var q;if((q=i==null?void 0:i.signal)!=null&&q.aborted)return;if(E=!0,L instanceof Error)return d(L);let N;try{N=t.decodeResult(e.method,L.result)}catch(U){return d(U instanceof Error?U:new Error(String(U)))}if(N.kind==="invalid")return d(N.error);if(N.kind==="input_required"){if((i==null?void 0:i.allowInputRequired)===!0)return h(lR(N));const U={codec:t,request:e,resultSchema:n,options:i,flowStartedAt:c,retry:(V,Q)=>this._requestWithSchemaViaCodec(t,V===void 0?{method:e.method}:{method:e.method,params:V},n,Q)};return h(this._resolveNonCompleteResult(N,U))}const k=N.result;Fc(n,k).then(U=>{U.success?h(U.data):d(new sn(mn.InvalidResult,`Invalid result for ${e.method}: ${U.error}`))},d)}),l=()=>{var L;return I((L=i==null?void 0:i.signal)==null?void 0:L.reason)},(T=i==null?void 0:i.signal)==null||T.addEventListener("abort",l,{once:!0});const b=(i==null?void 0:i.timeout)??iR,w=()=>I(new sn(mn.RequestTimeout,"Request timed out",{timeout:b}));this._setupTimeout(x,b,i==null?void 0:i.maxTotalTimeout,w,(i==null?void 0:i.resetTimeoutOnProgress)??!1),this._transport.send(p,{relatedRequestId:s,resumptionToken:r,onresumptiontoken:o,headers:a,requestSignal:_==null?void 0:_.signal}).catch(L=>{this._progressHandlers.delete(x),d(L)})}).finally(()=>{var h;l&&((h=i==null?void 0:i.signal)==null||h.removeEventListener("abort",l)),u!==void 0&&(this._responseHandlers.delete(u),this._cleanupTimeout(u))})}async notification(t,e){return await this._notificationViaCodec(this._resolveOutboundCodec(t.method),t,e)}async _notificationViaCodec(t,e,n){var s;if(!this._transport)throw new sn(mn.NotConnected,"Not connected");if(Uc(e.method)&&!t.hasNotificationMethod(e.method))throw new sn(mn.MethodNotSupportedByProtocolVersion,`Notification '${e.method}' is not supported by the negotiated protocol version (wire era ${t.era})`,{method:e.method,era:t.era});this.assertNotificationCapability(e.method);const i=this._envelopeOutbound({jsonrpc:"2.0",...e});if((((s=this._options)==null?void 0:s.debouncedNotificationMethods)??[]).includes(e.method)&&!e.params&&(n==null?void 0:n.relatedRequestId)===void 0){if(this._pendingDebouncedNotifications.has(e.method))return;this._pendingDebouncedNotifications.add(e.method),Promise.resolve().then(()=>{var r;this._pendingDebouncedNotifications.delete(e.method),this._transport&&((r=this._transport)==null||r.send(i,n).catch(o=>this._onerror(o)))});return}await this._transport.send(i,n)}setRequestHandler(t,e,n){this.assertRequestHandlerCapability(t);let i;if(typeof e=="function"){if(!Dc(t))throw new TypeError(`'${t}' is not a spec request method; pass schemas as the second argument to setRequestHandler().`);i=(s,r)=>{const o=this._negotiatedWireCodec();let a=o.validateRequest(t,s);if(!a.ok&&a.reason==="not-in-era"&&(a=o.validateInputRequest(t,s)),!a.ok)throw a.reason==="not-in-era"?new gn(ot.InternalError,`No wire schema for ${t} in the resolved era`):new Error(a.message);return Promise.resolve(e(a.value,r))}}else if(n)i=async(s,r)=>{const o=await Fc(e.params,{...s.params});if(!o.success)throw new gn(ot.InvalidParams,`Invalid params for ${t}: ${o.error}`);return n(o.data,r)};else throw new TypeError("setRequestHandler: handler is required");typeof e=="function"?this._customSchemaRequestMethods.delete(t):this._customSchemaRequestMethods.add(t),this._requestHandlers.set(t,this._wrapHandler(t,i))}_wrapHandler(t,e){return e}_outboundServerInfo(){}removeRequestHandler(t){this._requestHandlers.delete(t),this._customSchemaRequestMethods.delete(t)}assertCanSetRequestHandler(t){if(this._requestHandlers.has(t))throw new Error(`A request handler for ${t} already exists, which would be overridden`)}setNotificationHandler(t,e,n){if(typeof e=="function"){if(!Uc(t))throw new TypeError(`'${t}' is not a spec notification method; pass schemas as the second argument to setNotificationHandler().`);this._notificationHandlers.set(t,(i,s)=>{const r=s.validateNotification(t,i);if(!r.ok)throw r.reason==="not-in-era"?new gn(ot.InternalError,`No wire schema for ${t} in the resolved era`):new Error(r.message);return Promise.resolve(e(r.value))});return}if(!n)throw new TypeError("setNotificationHandler: handler is required");this._notificationHandlers.set(t,async i=>{const s=await Fc(e.params,{...i.params});if(!s.success)throw new gn(ot.InvalidParams,`Invalid params for notification ${t}: ${s.error}`);await n(s.data,i)})}removeNotificationHandler(t){this._notificationHandlers.delete(t)}};function kc(t){return t!==null&&typeof t=="object"&&!Array.isArray(t)}function af(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function cR(t){const e={},n=[];if(!af(t))return{accepted:e,droppedKeys:n};for(const[i,s]of Object.entries(t)){if(!af(s)||"method"in s||"result"in s){n.push(i);continue}e[i]=s}return{accepted:e,droppedKeys:n}}function lR(t){return{resultType:"input_required",inputRequests:t.inputRequests,...t.requestState!==void 0&&{requestState:t.requestState},...t._meta!==void 0&&{_meta:t._meta}}}/*!
|
|
65
65
|
* content-type
|
|
66
66
|
* Copyright(c) 2015 Douglas Christopher Wilson
|
|
67
67
|
* MIT Licensed
|
|
68
|
-
*/var aT=RS((t=>{var e=/; *([!#$%&'*+.^_`|~0-9A-Za-z-]+) *= *("(?:[\u000b\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u000b\u0020-\u00ff])*"|[!#$%&'*+.^_`|~0-9A-Za-z-]+) */g,n=/\\([\u000b\u0020-\u00ff])/g,i=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;t.parse=s;function s(a){if(!a)throw new TypeError("argument string is required");var c=typeof a=="object"?r(a):a;if(typeof c!="string")throw new TypeError("argument string is required to be a string");var l=c.indexOf(";"),u=l!==-1?c.slice(0,l).trim():c.trim();if(!i.test(u))throw new TypeError("invalid media type");var h=new o(u.toLowerCase());if(l!==-1){var d,f,_;for(e.lastIndex=l;f=e.exec(c);){if(f.index!==l)throw new TypeError("invalid parameter format");l+=f[0].length,d=f[1].toLowerCase(),_=f[2],_.charCodeAt(0)===34&&(_=_.slice(1,-1),_.indexOf("\\")!==-1&&(_=_.replace(n,"$1"))),h.parameters[d]=_}if(l!==c.length)throw new TypeError("invalid parameter format")}return h}function r(a){var c;if(typeof a.getHeader=="function"?c=a.getHeader("content-type"):typeof a.headers=="object"&&(c=a.headers&&a.headers["content-type"]),typeof c!="string")throw new TypeError("content-type header is missing from object");return c}function o(a){this.parameters=Object.create(null),this.type=a}}));aT();typeof self<"u"&&self.location&&self.location.origin!=="null"?new URL(self.location.origin+self.location.pathname+location.search):new URL("https://github.com/cfworker");const cT=/^(\d\d):(\d\d):(\d\d)(\.\d+)?(z|[+-]\d\d(?::?\d\d)?)?$/i,lT=/^(?=.{1,253}\.?$)[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[-0-9a-z]{0,61}[0-9a-z])?)*\.?$/i,uT=/^(?:[a-z][a-z0-9+\-.]*:)?(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'"()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?(?:\?(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,dT=/^(?:(?:[^\x00-\x20"'<>%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i,hT=/^(?:(?:https?|ftp):\/\/)(?:\S+(?::\S*)?@)?(?:(?!10(?:\.\d{1,3}){3})(?!127(?:\.\d{1,3}){3})(?!169\.254(?:\.\d{1,3}){2})(?!192\.168(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z\u{00a1}-\u{ffff}0-9]+-?)*[a-z\u{00a1}-\u{ffff}0-9]+)(?:\.(?:[a-z\u{00a1}-\u{ffff}0-9]+-?)*[a-z\u{00a1}-\u{ffff}0-9]+)*(?:\.(?:[a-z\u{00a1}-\u{ffff}]{2,})))(?::\d{2,5})?(?:\/[^\s]*)?$/iu,fT=/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,pT=/^(?:\/(?:[^~/]|~0|~1)*)*$/,mT=/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,gT=/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/,_T=/^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/,ST=/^((([0-9a-f]{1,4}:){7}([0-9a-f]{1,4}|:))|(([0-9a-f]{1,4}:){6}(:[0-9a-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){5}(((:[0-9a-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){4}(((:[0-9a-f]{1,4}){1,3})|((:[0-9a-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){3}(((:[0-9a-f]{1,4}){1,4})|((:[0-9a-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){2}(((:[0-9a-f]{1,4}){1,5})|((:[0-9a-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){1}(((:[0-9a-f]{1,4}){1,6})|((:[0-9a-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9a-f]{1,4}){1,7})|((:[0-9a-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))$/i;function ri(t){return t.test.bind(t)}vT.bind(void 0,!1),ri(uT),ri(dT),ri(hT),ri(lT),ri(_T),ri(ST),ri(fT),ri(pT),ri(mT),ri(gT);function vT(t,e){const n=e.match(cT);if(!n)return!1;const i=+n[1],s=+n[2],r=+n[3],o=!!n[5];return(i<=23&&s<=59&&r<=59||i==23&&s==59&&r==60)&&(!t||o)}class xT{constructor(){He(this,"_eventSlots",new Map)}setHandler(e,n){let i=this._ensureEventSlot(e);i.onHandler&&n&&console.warn(`[MCP Apps] on${String(e)} handler replaced. Use addEventListener("${String(e)}", …) to add multiple listeners without replacing.`),i.onHandler=n}getHandler(e){var n;return(n=this._eventSlots.get(e))==null?void 0:n.onHandler}addEventListener(e,n){this._ensureEventSlot(e).listeners.push(n)}removeEventListener(e,n){let i=this._eventSlots.get(e);if(!i)return;let s=i.listeners.indexOf(n);s!==-1&&i.listeners.splice(s,1)}dispatch(e,n){var s;let i=this._eventSlots.get(e);if(i){(s=i.onHandler)==null||s.call(i,n);for(let r of[...i.listeners])r(n)}}_ensureEventSlot(e){let n=this._eventSlots.get(e);return n||(n={listeners:[]},this._eventSlots.set(e,n)),n}}class yT{constructor(){He(this,"_methods",new Set)}claim(e,n){if(this._methods.has(e))throw Error(`Handler for "${e}" already registered (via ${n}). Use addEventListener() to attach multiple listeners, or the on* setter for replace semantics.`);this._methods.add(e)}replace(e){this._methods.add(e)}release(e){this._methods.delete(e)}has(e){return this._methods.has(e)}}var Rh=new Set;function wh(t,e){var c;let[n,i]=e,s=n==null?void 0:n.shape;if(typeof((c=s==null?void 0:s.method)==null?void 0:c.value)!="string")return;let r=s.method.value,o=t==="request"?"setRequestHandler":"setNotificationHandler";Rh.has(o)||(Rh.add(o),console.warn(`[ext-apps] ${o}(Schema, handler) is deprecated; use ${o}("${r}", { params: Schema.shape.params }, handler).`));let a=i;return[r,{params:s.params},t==="request"?(l,u)=>a({method:r,params:l},bT(u)):l=>a({method:r,params:l})]}function bT(t){var e;return{signal:t.mcpReq.signal,requestId:t.mcpReq.id,sessionId:t.sessionId,_meta:t.mcpReq._meta,sendRequest:t.mcpReq.send,sendNotification:t.mcpReq.notify,authInfo:(e=t.http)==null?void 0:e.authInfo}}var MT="2026-01-26",ET="ui/notifications/tool-input-partial";class TT{constructor(e=window.parent,n){He(this,"eventTarget");He(this,"eventSource");He(this,"messageListener");He(this,"onclose");He(this,"onerror");He(this,"onmessage");He(this,"sessionId");He(this,"setProtocolVersion");this.eventTarget=e,this.eventSource=n,this.messageListener=i=>{var r,o,a;if(n&&i.source!==this.eventSource){console.debug("Ignoring message from unknown source",i);return}let s=Sm.safeParse(i.data);s.success?(console.debug("Parsed message",s.data),(r=this.onmessage)==null||r.call(this,s.data)):((o=i.data)==null?void 0:o.jsonrpc)!=="2.0"?console.debug("Ignoring non-JSON-RPC message",s.error.message,i):(console.error("Failed to parse message",s.error.message,i),(a=this.onerror)==null||a.call(this,Error("Invalid JSON-RPC message received: "+s.error.message)))}}async start(){window.addEventListener("message",this.messageListener)}async send(e,n){e.method!==ET&&console.debug("Sending message",e),this.eventTarget.postMessage(e,"*")}async close(){var e;window.removeEventListener("message",this.messageListener),(e=this.onclose)==null||e.call(this)}}var RT=Se([C("light"),C("dark")]).describe("Color theme preference for the host environment."),Yr=Se([C("inline"),C("fullscreen"),C("pip")]).describe("Display mode for UI presentation."),wT=Se([C("--color-background-primary"),C("--color-background-secondary"),C("--color-background-tertiary"),C("--color-background-inverse"),C("--color-background-ghost"),C("--color-background-info"),C("--color-background-danger"),C("--color-background-success"),C("--color-background-warning"),C("--color-background-disabled"),C("--color-text-primary"),C("--color-text-secondary"),C("--color-text-tertiary"),C("--color-text-inverse"),C("--color-text-ghost"),C("--color-text-info"),C("--color-text-danger"),C("--color-text-success"),C("--color-text-warning"),C("--color-text-disabled"),C("--color-border-primary"),C("--color-border-secondary"),C("--color-border-tertiary"),C("--color-border-inverse"),C("--color-border-ghost"),C("--color-border-info"),C("--color-border-danger"),C("--color-border-success"),C("--color-border-warning"),C("--color-border-disabled"),C("--color-ring-primary"),C("--color-ring-secondary"),C("--color-ring-inverse"),C("--color-ring-info"),C("--color-ring-danger"),C("--color-ring-success"),C("--color-ring-warning"),C("--font-sans"),C("--font-mono"),C("--font-weight-normal"),C("--font-weight-medium"),C("--font-weight-semibold"),C("--font-weight-bold"),C("--font-text-xs-size"),C("--font-text-sm-size"),C("--font-text-md-size"),C("--font-text-lg-size"),C("--font-heading-xs-size"),C("--font-heading-sm-size"),C("--font-heading-md-size"),C("--font-heading-lg-size"),C("--font-heading-xl-size"),C("--font-heading-2xl-size"),C("--font-heading-3xl-size"),C("--font-text-xs-line-height"),C("--font-text-sm-line-height"),C("--font-text-md-line-height"),C("--font-text-lg-line-height"),C("--font-heading-xs-line-height"),C("--font-heading-sm-line-height"),C("--font-heading-md-line-height"),C("--font-heading-lg-line-height"),C("--font-heading-xl-line-height"),C("--font-heading-2xl-line-height"),C("--font-heading-3xl-line-height"),C("--border-radius-xs"),C("--border-radius-sm"),C("--border-radius-md"),C("--border-radius-lg"),C("--border-radius-xl"),C("--border-radius-full"),C("--border-width-regular"),C("--shadow-hairline"),C("--shadow-sm"),C("--shadow-md"),C("--shadow-lg")]).describe("CSS variable keys available to MCP apps for theming."),AT=_e(wT.describe(`Style variables for theming MCP apps.
|
|
68
|
+
*/var uR=Cv((t=>{var e=/; *([!#$%&'*+.^_`|~0-9A-Za-z-]+) *= *("(?:[\u000b\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u000b\u0020-\u00ff])*"|[!#$%&'*+.^_`|~0-9A-Za-z-]+) */g,n=/\\([\u000b\u0020-\u00ff])/g,i=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;t.parse=s;function s(a){if(!a)throw new TypeError("argument string is required");var c=typeof a=="object"?r(a):a;if(typeof c!="string")throw new TypeError("argument string is required to be a string");var l=c.indexOf(";"),u=l!==-1?c.slice(0,l).trim():c.trim();if(!i.test(u))throw new TypeError("invalid media type");var h=new o(u.toLowerCase());if(l!==-1){var d,f,_;for(e.lastIndex=l;f=e.exec(c);){if(f.index!==l)throw new TypeError("invalid parameter format");l+=f[0].length,d=f[1].toLowerCase(),_=f[2],_.charCodeAt(0)===34&&(_=_.slice(1,-1),_.indexOf("\\")!==-1&&(_=_.replace(n,"$1"))),h.parameters[d]=_}if(l!==c.length)throw new TypeError("invalid parameter format")}return h}function r(a){var c;if(typeof a.getHeader=="function"?c=a.getHeader("content-type"):typeof a.headers=="object"&&(c=a.headers&&a.headers["content-type"]),typeof c!="string")throw new TypeError("content-type header is missing from object");return c}function o(a){this.parameters=Object.create(null),this.type=a}}));uR();typeof self<"u"&&self.location&&self.location.origin!=="null"?new URL(self.location.origin+self.location.pathname+location.search):new URL("https://github.com/cfworker");const dR=/^(\d\d):(\d\d):(\d\d)(\.\d+)?(z|[+-]\d\d(?::?\d\d)?)?$/i,hR=/^(?=.{1,253}\.?$)[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[-0-9a-z]{0,61}[0-9a-z])?)*\.?$/i,fR=/^(?:[a-z][a-z0-9+\-.]*:)?(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'"()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?(?:\?(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,pR=/^(?:(?:[^\x00-\x20"'<>%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i,mR=/^(?:(?:https?|ftp):\/\/)(?:\S+(?::\S*)?@)?(?:(?!10(?:\.\d{1,3}){3})(?!127(?:\.\d{1,3}){3})(?!169\.254(?:\.\d{1,3}){2})(?!192\.168(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z\u{00a1}-\u{ffff}0-9]+-?)*[a-z\u{00a1}-\u{ffff}0-9]+)(?:\.(?:[a-z\u{00a1}-\u{ffff}0-9]+-?)*[a-z\u{00a1}-\u{ffff}0-9]+)*(?:\.(?:[a-z\u{00a1}-\u{ffff}]{2,})))(?::\d{2,5})?(?:\/[^\s]*)?$/iu,gR=/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,_R=/^(?:\/(?:[^~/]|~0|~1)*)*$/,SR=/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,vR=/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/,xR=/^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/,yR=/^((([0-9a-f]{1,4}:){7}([0-9a-f]{1,4}|:))|(([0-9a-f]{1,4}:){6}(:[0-9a-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){5}(((:[0-9a-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){4}(((:[0-9a-f]{1,4}){1,3})|((:[0-9a-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){3}(((:[0-9a-f]{1,4}){1,4})|((:[0-9a-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){2}(((:[0-9a-f]{1,4}){1,5})|((:[0-9a-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){1}(((:[0-9a-f]{1,4}){1,6})|((:[0-9a-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9a-f]{1,4}){1,7})|((:[0-9a-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))$/i;function ui(t){return t.test.bind(t)}bR.bind(void 0,!1),ui(fR),ui(pR),ui(mR),ui(hR),ui(xR),ui(yR),ui(gR),ui(_R),ui(SR),ui(vR);function bR(t,e){const n=e.match(dR);if(!n)return!1;const i=+n[1],s=+n[2],r=+n[3],o=!!n[5];return(i<=23&&s<=59&&r<=59||i==23&&s==59&&r==60)&&(!t||o)}class MR{constructor(){Ve(this,"_eventSlots",new Map)}setHandler(e,n){let i=this._ensureEventSlot(e);i.onHandler&&n&&console.warn(`[MCP Apps] on${String(e)} handler replaced. Use addEventListener("${String(e)}", …) to add multiple listeners without replacing.`),i.onHandler=n}getHandler(e){var n;return(n=this._eventSlots.get(e))==null?void 0:n.onHandler}addEventListener(e,n){this._ensureEventSlot(e).listeners.push(n)}removeEventListener(e,n){let i=this._eventSlots.get(e);if(!i)return;let s=i.listeners.indexOf(n);s!==-1&&i.listeners.splice(s,1)}dispatch(e,n){var s;let i=this._eventSlots.get(e);if(i){(s=i.onHandler)==null||s.call(i,n);for(let r of[...i.listeners])r(n)}}_ensureEventSlot(e){let n=this._eventSlots.get(e);return n||(n={listeners:[]},this._eventSlots.set(e,n)),n}}class ER{constructor(){Ve(this,"_methods",new Set)}claim(e,n){if(this._methods.has(e))throw Error(`Handler for "${e}" already registered (via ${n}). Use addEventListener() to attach multiple listeners, or the on* setter for replace semantics.`);this._methods.add(e)}replace(e){this._methods.add(e)}release(e){this._methods.delete(e)}has(e){return this._methods.has(e)}}var cf=new Set;function lf(t,e){var c;let[n,i]=e,s=n==null?void 0:n.shape;if(typeof((c=s==null?void 0:s.method)==null?void 0:c.value)!="string")return;let r=s.method.value,o=t==="request"?"setRequestHandler":"setNotificationHandler";cf.has(o)||(cf.add(o),console.warn(`[ext-apps] ${o}(Schema, handler) is deprecated; use ${o}("${r}", { params: Schema.shape.params }, handler).`));let a=i;return[r,{params:s.params},t==="request"?(l,u)=>a({method:r,params:l},TR(u)):l=>a({method:r,params:l})]}function TR(t){var e;return{signal:t.mcpReq.signal,requestId:t.mcpReq.id,sessionId:t.sessionId,_meta:t.mcpReq._meta,sendRequest:t.mcpReq.send,sendNotification:t.mcpReq.notify,authInfo:(e=t.http)==null?void 0:e.authInfo}}var RR="2026-01-26",wR="ui/notifications/tool-input-partial";class AR{constructor(e=window.parent,n){Ve(this,"eventTarget");Ve(this,"eventSource");Ve(this,"messageListener");Ve(this,"onclose");Ve(this,"onerror");Ve(this,"onmessage");Ve(this,"sessionId");Ve(this,"setProtocolVersion");this.eventTarget=e,this.eventSource=n,this.messageListener=i=>{var r,o,a;if(n&&i.source!==this.eventSource){console.debug("Ignoring message from unknown source",i);return}let s=sg.safeParse(i.data);s.success?(console.debug("Parsed message",s.data),(r=this.onmessage)==null||r.call(this,s.data)):((o=i.data)==null?void 0:o.jsonrpc)!=="2.0"?console.debug("Ignoring non-JSON-RPC message",s.error.message,i):(console.error("Failed to parse message",s.error.message,i),(a=this.onerror)==null||a.call(this,Error("Invalid JSON-RPC message received: "+s.error.message)))}}async start(){window.addEventListener("message",this.messageListener)}async send(e,n){e.method!==wR&&console.debug("Sending message",e),this.eventTarget.postMessage(e,"*")}async close(){var e;window.removeEventListener("message",this.messageListener),(e=this.onclose)==null||e.call(this)}}var CR=Se([C("light"),C("dark")]).describe("Color theme preference for the host environment."),ao=Se([C("inline"),C("fullscreen"),C("pip")]).describe("Display mode for UI presentation."),PR=Se([C("--color-background-primary"),C("--color-background-secondary"),C("--color-background-tertiary"),C("--color-background-inverse"),C("--color-background-ghost"),C("--color-background-info"),C("--color-background-danger"),C("--color-background-success"),C("--color-background-warning"),C("--color-background-disabled"),C("--color-text-primary"),C("--color-text-secondary"),C("--color-text-tertiary"),C("--color-text-inverse"),C("--color-text-ghost"),C("--color-text-info"),C("--color-text-danger"),C("--color-text-success"),C("--color-text-warning"),C("--color-text-disabled"),C("--color-border-primary"),C("--color-border-secondary"),C("--color-border-tertiary"),C("--color-border-inverse"),C("--color-border-ghost"),C("--color-border-info"),C("--color-border-danger"),C("--color-border-success"),C("--color-border-warning"),C("--color-border-disabled"),C("--color-ring-primary"),C("--color-ring-secondary"),C("--color-ring-inverse"),C("--color-ring-info"),C("--color-ring-danger"),C("--color-ring-success"),C("--color-ring-warning"),C("--font-sans"),C("--font-mono"),C("--font-weight-normal"),C("--font-weight-medium"),C("--font-weight-semibold"),C("--font-weight-bold"),C("--font-text-xs-size"),C("--font-text-sm-size"),C("--font-text-md-size"),C("--font-text-lg-size"),C("--font-heading-xs-size"),C("--font-heading-sm-size"),C("--font-heading-md-size"),C("--font-heading-lg-size"),C("--font-heading-xl-size"),C("--font-heading-2xl-size"),C("--font-heading-3xl-size"),C("--font-text-xs-line-height"),C("--font-text-sm-line-height"),C("--font-text-md-line-height"),C("--font-text-lg-line-height"),C("--font-heading-xs-line-height"),C("--font-heading-sm-line-height"),C("--font-heading-md-line-height"),C("--font-heading-lg-line-height"),C("--font-heading-xl-line-height"),C("--font-heading-2xl-line-height"),C("--font-heading-3xl-line-height"),C("--border-radius-xs"),C("--border-radius-sm"),C("--border-radius-md"),C("--border-radius-lg"),C("--border-radius-xl"),C("--border-radius-full"),C("--border-width-regular"),C("--shadow-hairline"),C("--shadow-sm"),C("--shadow-md"),C("--shadow-lg")]).describe("CSS variable keys available to MCP apps for theming."),LR=_e(PR.describe(`Style variables for theming MCP apps.
|
|
69
69
|
|
|
70
70
|
Individual style keys are optional - hosts may provide any subset of these values.
|
|
71
71
|
Values are strings containing CSS values (colors, sizes, font stacks, etc.).
|
|
72
72
|
|
|
73
73
|
Note: This type uses \`Record<K, string | undefined>\` rather than \`Partial<Record<K, string>>\`
|
|
74
|
-
for compatibility with Zod schema generation. Both are functionally equivalent for validation.`),Se([g(),
|
|
74
|
+
for compatibility with Zod schema generation. Both are functionally equivalent for validation.`),Se([g(),Pl()]).describe(`Style variables for theming MCP apps.
|
|
75
75
|
|
|
76
76
|
Individual style keys are optional - hosts may provide any subset of these values.
|
|
77
77
|
Values are strings containing CSS values (colors, sizes, font stacks, etc.).
|
|
@@ -83,10 +83,10 @@ Individual style keys are optional - hosts may provide any subset of these value
|
|
|
83
83
|
Values are strings containing CSS values (colors, sizes, font stacks, etc.).
|
|
84
84
|
|
|
85
85
|
Note: This type uses \`Record<K, string | undefined>\` rather than \`Partial<Record<K, string>>\`
|
|
86
|
-
for compatibility with Zod schema generation. Both are functionally equivalent for validation.`);M({method:C("ui/open-link"),params:M({url:g().describe("URL to open in the host's browser")})});var
|
|
86
|
+
for compatibility with Zod schema generation. Both are functionally equivalent for validation.`);M({method:C("ui/open-link"),params:M({url:g().describe("URL to open in the host's browser")})});var IR=M({isError:xe().optional().describe("True if the host failed to open the URL (e.g., due to security policy).")}).passthrough(),NR=M({isError:xe().optional().describe("True if the download failed (e.g., user cancelled or host denied).")}).passthrough(),DR=M({isError:xe().optional().describe("True if the host rejected or failed to deliver the message.")}).passthrough();M({method:C("ui/notifications/sandbox-proxy-ready"),params:M({})});var Ld=M({connectDomains:G(g()).optional().describe(`Origins for network requests (fetch/XHR/WebSocket).
|
|
87
87
|
|
|
88
88
|
- Maps to CSP \`connect-src\` directive
|
|
89
|
-
- Empty or omitted → no network connections (secure default)`),resourceDomains:G(g()).optional().describe("Origins for static resources (images, scripts, stylesheets, fonts, media).\n\n- Maps to CSP `img-src`, `script-src`, `style-src`, `font-src`, `media-src` directives\n- Wildcard subdomains supported: `https://*.example.com`\n- Empty or omitted → no network resources (secure default)"),frameDomains:G(g()).optional().describe("Origins for nested iframes.\n\n- Maps to CSP `frame-src` directive\n- Empty or omitted → no nested iframes allowed (`frame-src 'none'`)"),baseUriDomains:G(g()).optional().describe("Allowed base URIs for the document.\n\n- Maps to CSP `base-uri` directive\n- Empty or omitted → only same origin allowed (`base-uri 'self'`)")}),
|
|
89
|
+
- Empty or omitted → no network connections (secure default)`),resourceDomains:G(g()).optional().describe("Origins for static resources (images, scripts, stylesheets, fonts, media).\n\n- Maps to CSP `img-src`, `script-src`, `style-src`, `font-src`, `media-src` directives\n- Wildcard subdomains supported: `https://*.example.com`\n- Empty or omitted → no network resources (secure default)"),frameDomains:G(g()).optional().describe("Origins for nested iframes.\n\n- Maps to CSP `frame-src` directive\n- Empty or omitted → no nested iframes allowed (`frame-src 'none'`)"),baseUriDomains:G(g()).optional().describe("Allowed base URIs for the document.\n\n- Maps to CSP `base-uri` directive\n- Empty or omitted → only same origin allowed (`base-uri 'self'`)")}),Id=M({camera:M({}).optional().describe("Request camera access.\n\nMaps to Permission Policy `camera` feature."),microphone:M({}).optional().describe("Request microphone access.\n\nMaps to Permission Policy `microphone` feature."),geolocation:M({}).optional().describe("Request geolocation access.\n\nMaps to Permission Policy `geolocation` feature."),clipboardWrite:M({}).optional().describe("Request clipboard write access.\n\nMaps to Permission Policy `clipboard-write` feature.")});M({method:C("ui/notifications/size-changed"),params:M({width:ae().optional().describe("New width in pixels."),height:ae().optional().describe("New height in pixels.")})});var UR=M({method:C("ui/notifications/tool-input"),params:M({arguments:_e(g(),Ue().describe("Complete tool call arguments as key-value pairs.")).optional().describe("Complete tool call arguments as key-value pairs.")})}),OR=M({method:C("ui/notifications/tool-input-partial"),params:M({arguments:_e(g(),Ue().describe("Partial tool call arguments (incomplete, may change).")).optional().describe("Partial tool call arguments (incomplete, may change).")})}),FR=M({method:C("ui/notifications/tool-cancelled"),params:M({reason:g().optional().describe('Optional reason for the cancellation (e.g., "user action", "timeout").')})}),kR=M({fonts:g().optional()}),zR=M({variables:LR.optional().describe("CSS variables for theming the app."),css:kR.optional().describe("CSS blocks that apps can inject.")}),BR=M({method:C("ui/resource-teardown"),params:M({})}),HR=_e(g(),Ue()),uf=M({text:M({}).optional().describe("Host supports text content blocks."),image:M({}).optional().describe("Host supports image content blocks."),audio:M({}).optional().describe("Host supports audio content blocks."),resource:M({}).optional().describe("Host supports resource content blocks."),resourceLink:M({}).optional().describe("Host supports resource link content blocks."),structuredContent:M({}).optional().describe("Host supports structured content.")});M({method:C("ui/notifications/request-teardown"),params:M({}).optional()});var VR=M({experimental:_e(g(),_e(g(),Ku()).describe("Experimental features keyed by identifier.")).optional().describe("Experimental features keyed by identifier."),openLinks:M({}).optional().describe("Host supports opening external URLs."),downloadFile:M({}).optional().describe("Host supports file downloads via ui/download-file."),serverTools:M({listChanged:xe().optional().describe("Host supports tools/list_changed notifications.")}).optional().describe("Host can proxy tool calls to the MCP server."),serverResources:M({listChanged:xe().optional().describe("Host supports resources/list_changed notifications.")}).optional().describe("Host can proxy resource reads to the MCP server."),logging:M({}).optional().describe("Host accepts log messages."),sandbox:M({permissions:Id.optional().describe("Permissions granted by the host (camera, microphone, geolocation)."),csp:Ld.optional().describe("CSP domains approved by the host.")}).optional().describe("Sandbox configuration applied by the host."),updateModelContext:uf.optional().describe("Host accepts context updates (ui/update-model-context) to be included in the model's context for future turns."),message:uf.optional().describe("Host supports receiving content messages (ui/message) from the view."),sampling:M({tools:M({}).optional().describe("Host supports tool use via `tools` and `toolChoice` parameters.")}).optional().describe("Host supports LLM sampling (sampling/createMessage) from the view.\nMirrors the MCP `ClientCapabilities.sampling` shape so hosts can pass it through.")}),GR=M({experimental:_e(g(),_e(g(),Ku()).describe("Experimental features keyed by identifier.")).optional().describe("Experimental features keyed by identifier."),tools:M({listChanged:xe().optional().describe("App supports tools/list_changed notifications.")}).optional().describe("App exposes MCP-style tools that the host can call."),availableDisplayModes:G(ao).optional().describe("Display modes the app supports.")});M({method:C("ui/notifications/initialized"),params:M({}).optional()});M({csp:Ld.optional().describe("Content Security Policy configuration for UI resources."),permissions:Id.optional().describe("Sandbox permissions requested by the UI resource."),domain:g().optional().describe(`Dedicated origin for view sandbox.
|
|
90
90
|
|
|
91
91
|
Useful when views need stable, dedicated origins for OAuth callbacks, CORS policies, or API key allowlists.
|
|
92
92
|
|
|
@@ -100,24 +100,24 @@ Boolean requesting whether a visible border and background is provided by the ho
|
|
|
100
100
|
|
|
101
101
|
- \`true\`: request visible border + background
|
|
102
102
|
- \`false\`: request no visible border + background
|
|
103
|
-
- omitted: host decides border`)});M({method:C("ui/request-display-mode"),params:M({mode:
|
|
103
|
+
- omitted: host decides border`)});M({method:C("ui/request-display-mode"),params:M({mode:ao.describe("The display mode being requested.")})});var $R=M({mode:ao.describe("The display mode that was actually set. May differ from requested if not supported.")}).passthrough(),qR=Se([C("model"),C("app")]).describe("Tool visibility scope - who can access the tool.");M({resourceUri:g().optional(),visibility:G(qR).optional().describe(`Who can access this tool. Default: ["model", "app"]
|
|
104
104
|
- "model": Tool visible to and callable by the agent
|
|
105
|
-
- "app": Tool callable by the app from this server only`),csp:
|
|
106
|
-
container holding the app. Specify either width or maxWidth, and either height or maxHeight.`),locale:g().optional().describe("User's language and region preference in BCP 47 format."),timeZone:g().optional().describe("User's timezone in IANA format."),userAgent:g().optional().describe("Host application identifier."),platform:Se([C("web"),C("desktop"),C("mobile")]).optional().describe("Platform type for responsive design decisions."),deviceCapabilities:M({touch:xe().optional().describe("Whether the device supports touch input."),hover:xe().optional().describe("Whether the device supports hover interactions.")}).optional().describe("Device input capabilities."),safeAreaInsets:M({top:ae().describe("Top safe area inset in pixels."),right:ae().describe("Right safe area inset in pixels."),bottom:ae().describe("Bottom safe area inset in pixels."),left:ae().describe("Left safe area inset in pixels.")}).optional().describe("Mobile safe area boundaries in pixels.")}).passthrough(),qT=M({method:C("ui/notifications/host-context-changed"),params:M_.describe("Partial context update containing only changed fields.")});M({method:C("ui/update-model-context"),params:M({content:G(pr).optional().describe("Context content blocks (text, image, etc.)."),structuredContent:_e(g(),Ue().describe("Structured content for machine-readable context data.")).optional().describe("Structured content for machine-readable context data.")})});M({method:C("ui/initialize"),params:M({appInfo:ur.describe("App identification (name and version)."),appCapabilities:BT.describe("Features and capabilities this app provides."),protocolVersion:g().describe("Protocol version this app supports.")})});var $T=M({protocolVersion:g().describe('Negotiated protocol version string (e.g., "2025-11-21").'),hostInfo:ur.describe("Host application identification and version."),hostCapabilities:zT.describe("Features and capabilities provided by the host."),hostContext:M_.describe("Rich context about the host environment.")}).passthrough(),WT={target:"draft-2020-12"};async function Ch(t,e){let n=t["~standard"];if(n.jsonSchema)return n.jsonSchema[e](WT);throw Error(`Schema (vendor: ${n.vendor}) does not implement Standard JSON Schema (~standard.jsonSchema). Use a library that does (zod v4, ArkType, Valibot) or wrap your schema accordingly.`)}async function Ph(t,e,n=""){let i=await t["~standard"].validate(e);if(i.issues){let s=i.issues.map(r=>{var a;let o=(a=r.path)==null?void 0:a.map(c=>typeof c=="object"?c.key:c).join(".");return o?`${o}: ${r.message}`:r.message}).join("; ");throw Error(n+s)}return i.value}function ZT(t,e){let n={...t,...e};return e.experimental!==void 0&&(n.experimental={...t.experimental,...e.experimental}),e.tools!==void 0&&(n.tools={...t.tools,...e.tools}),n}const Aa=class Aa extends sT{constructor(n,i={},s={autoResize:!0}){super(s);He(this,"_appInfo");He(this,"_appCapabilities");He(this,"options");He(this,"_hostCapabilities");He(this,"_hostInfo");He(this,"_hostContext");He(this,"_registeredTools",{});He(this,"_initializedSent",!1);He(this,"_registeredEvents",new Set);He(this,"_events",new xT);He(this,"_methods",new yT);He(this,"setRequestHandler",(...n)=>{let[i,...s]=wh("request",n)??n;this._methods.claim(i,"setRequestHandler"),super.setRequestHandler.call(this,i,...s)});He(this,"setNotificationHandler",(...n)=>{let[i,...s]=wh("notification",n)??n;this._methods.claim(i,"setNotificationHandler"),super.setNotificationHandler.call(this,i,...s)});He(this,"removeRequestHandler",n=>{this._methods.release(n),super.removeRequestHandler(n)});He(this,"removeNotificationHandler",n=>{this._methods.release(n),super.removeNotificationHandler(n)});He(this,"replaceRequestHandler",(n,...i)=>{this._methods.replace(n),super.setRequestHandler.call(this,n,...i)});He(this,"eventSchemas",{toolinput:LT,toolinputpartial:NT,toolresult:GT,toolcancelled:DT,hostcontextchanged:qT});He(this,"_everHadListener",new Set);He(this,"_toolHandlersInitialized",!1);He(this,"_onteardown");He(this,"_oncalltool");He(this,"_onlisttools");He(this,"sendOpenLink",this.openLink);this._appInfo=n,this._appCapabilities=i,this.options=s,this._methods.replace("notifications/cancelled"),this._methods.replace("notifications/progress"),!s.allowUnsafeEval&&Qn({jitless:!0}),this.replaceRequestHandler("ping",r=>(console.log("Received ping:",r.params),{})),this.setEventHandler("hostcontextchanged",void 0)}_assertInitialized(n){var s;if(this._initializedSent)return;let i=`[ext-apps] App.${n}() called before connect() completed the ui/initialize handshake. Await app.connect() before calling this method, or move data loading to an ontoolresult handler.`;if((s=this.options)!=null&&s.strict)throw Error(i);console.warn(`${i}. This will throw in a future release.`)}_assertHandlerTiming(n){var s;if(!Aa.ONE_SHOT_EVENTS.has(n)||this._everHadListener.has(n)||(this._everHadListener.add(n),!this._initializedSent))return;let i=`[ext-apps] "${String(n)}" handler registered after connect() completed the ui/initialize handshake. The host may have already sent this notification. Register handlers before calling app.connect().`;if((s=this.options)!=null&&s.strict)throw Error(i);console.warn(i)}setEventHandler(n,i){i&&this._assertHandlerTiming(n),this._ensureEventSlot(n),this._events.setHandler(n,i)}addEventListener(n,i){this._assertHandlerTiming(n),this._ensureEventSlot(n),this._events.addEventListener(n,i)}removeEventListener(n,i){this._events.removeEventListener(n,i)}_ensureEventSlot(n){if(this._registeredEvents.has(n))return;let i=this.eventSchemas[n];if(!i)throw Error(`Unknown event: ${String(n)}`);this.setNotificationHandler(i.shape.method.value,{params:i.shape.params},s=>{let r=s;n==="hostcontextchanged"&&(this._hostContext={...this._hostContext,...r}),this._events.dispatch(n,r)}),this._registeredEvents.add(n)}getEventHandler(n){return this._events.getHandler(n)}warnIfRequestHandlerReplaced(n,i,s){i&&s&&console.warn(`[MCP Apps] ${n} handler replaced. Previous handler will no longer be called.`)}buildContext(n){return n}registerAppCapabilities(n){if(this.transport)throw Error("Cannot register capabilities after transport is established");this._appCapabilities=ZT(this._appCapabilities,n)}registerTool(n,i,s){if(this._registeredTools[n])throw Error(`Tool ${n} is already registered`);let r=this,o=()=>{var l;r._initializedSent&&((l=r._appCapabilities.tools)!=null&&l.listChanged)&&r.sendToolListChanged()},a=i.inputSchema!==void 0,c={title:i.title,description:i.description,inputSchema:i.inputSchema,outputSchema:i.outputSchema,annotations:i.annotations,_meta:i._meta,enabled:!0,enable(){this.enabled=!0,o()},disable(){this.enabled=!1,o()},update(l){Object.assign(this,l),o()},remove(){r._registeredTools[n]===c&&(delete r._registeredTools[n],o())},handler:async(l,u)=>{if(!c.enabled)throw Error(`Tool ${n} is disabled`);let h;if(a){let d=c.inputSchema,f=d?await Ph(d,l??{},`Invalid input for tool ${n}: `):l??{};h=await s(f,u)}else h=await s(u);return c.outputSchema&&!h.isError&&(h.structuredContent=await Ph(c.outputSchema,h.structuredContent,`Invalid output for tool ${n}: `)),h}};return this._registeredTools[n]=c,!this._appCapabilities.tools&&!this.transport&&this.registerAppCapabilities({tools:{listChanged:!0}}),this.ensureToolHandlersInitialized(),o(),c}ensureToolHandlersInitialized(){this._toolHandlersInitialized||(this._toolHandlersInitialized=!0,this.oncalltool=async(n,i)=>{let s=this._registeredTools[n.name];if(!s)throw Error(`Tool ${n.name} not found`);return s.handler(n.arguments,i)},this.onlisttools=async(n,i)=>({tools:await Promise.all(Object.entries(this._registeredTools).filter(([s,r])=>r.enabled).map(async([s,r])=>{let o={name:s,title:r.title,description:r.description,inputSchema:r.inputSchema?await Ch(r.inputSchema,"input"):{type:"object",properties:{}}};return r.outputSchema&&(o.outputSchema=await Ch(r.outputSchema,"output")),r.annotations&&(o.annotations=r.annotations),r._meta&&(o._meta=r._meta),o}))}))}async sendToolListChanged(n={}){this._assertInitialized("sendToolListChanged"),await this.notification({method:"notifications/tools/list_changed",params:n})}getHostCapabilities(){return this._hostCapabilities}getHostVersion(){return this._hostInfo}getHostContext(){return this._hostContext}get ontoolinput(){return this.getEventHandler("toolinput")}set ontoolinput(n){this.setEventHandler("toolinput",n)}get ontoolinputpartial(){return this.getEventHandler("toolinputpartial")}set ontoolinputpartial(n){this.setEventHandler("toolinputpartial",n)}get ontoolresult(){return this.getEventHandler("toolresult")}set ontoolresult(n){this.setEventHandler("toolresult",n)}get ontoolcancelled(){return this.getEventHandler("toolcancelled")}set ontoolcancelled(n){this.setEventHandler("toolcancelled",n)}get onhostcontextchanged(){return this.getEventHandler("hostcontextchanged")}set onhostcontextchanged(n){this.setEventHandler("hostcontextchanged",n)}get onteardown(){return this._onteardown}set onteardown(n){this.warnIfRequestHandlerReplaced("onteardown",this._onteardown,n),this._onteardown=n,this.replaceRequestHandler("ui/resource-teardown",{params:FT.shape.params,result:kT},(i,s)=>{if(!this._onteardown)throw Error("No onteardown handler set");return this._onteardown(i,s)})}get oncalltool(){return this._oncalltool}set oncalltool(n){this.warnIfRequestHandlerReplaced("oncalltool",this._oncalltool,n),this._oncalltool=n,this.replaceRequestHandler("tools/call",(i,s)=>{if(!this._oncalltool)throw Error("No oncalltool handler set");return this._oncalltool(i.params,s)})}get onlisttools(){return this._onlisttools}set onlisttools(n){this.warnIfRequestHandlerReplaced("onlisttools",this._onlisttools,n),this._onlisttools=n,this.replaceRequestHandler("tools/list",(i,s)=>{if(!this._onlisttools)throw Error("No onlisttools handler set");return this._onlisttools(i.params,s)})}assertCapabilityForMethod(n){var i;switch(n){case"sampling/createMessage":if(!((i=this._hostCapabilities)!=null&&i.sampling))throw Error(`Host does not support sampling (required for ${n})`);break}}assertRequestHandlerCapability(n){switch(n){case"tools/call":case"tools/list":if(!this._appCapabilities.tools)throw Error(`Client does not support tool capability (required for ${n})`);return;default:return}}assertNotificationCapability(n){}async callServerTool(n,i){if(this._assertInitialized("callServerTool"),typeof n=="string")throw Error(`callServerTool() expects an object as its first argument, but received a string ("${n}"). Did you mean: callServerTool({ name: "${n}", arguments: { ... } })?`);return await this.request({method:"tools/call",params:n},{onprogress:()=>{},resetTimeoutOnProgress:!0,...i})}async readServerResource(n,i){return this._assertInitialized("readServerResource"),await this.request({method:"resources/read",params:n},i)}async listServerResources(n,i){return this._assertInitialized("listServerResources"),await this.request({method:"resources/list",params:n},i)}async createSamplingMessage(n,i){return this._assertInitialized("createSamplingMessage"),await this.request({method:"sampling/createMessage",params:n},i)}sendMessage(n,i){return this._assertInitialized("sendMessage"),this.request({method:"ui/message",params:n},IT,i)}sendLog(n){return this.notification({method:"notifications/message",params:n})}updateModelContext(n,i){return this._assertInitialized("updateModelContext"),this.request({method:"ui/update-model-context",params:n},Ha,i)}openLink(n,i){return this._assertInitialized("openLink"),this.request({method:"ui/open-link",params:n},CT,i)}downloadFile(n,i){return this._assertInitialized("downloadFile"),this.request({method:"ui/download-file",params:n},PT,i)}requestTeardown(n={}){return this.notification({method:"ui/notifications/request-teardown",params:n})}requestDisplayMode(n,i){return this._assertInitialized("requestDisplayMode"),this.request({method:"ui/request-display-mode",params:n},HT,i)}sendSizeChanged(n){return this.notification({method:"ui/notifications/size-changed",params:n})}setupSizeChangedNotifications(){let n=!1,i=0,s=0,r=()=>{n||(n=!0,requestAnimationFrame(()=>{n=!1;let a=document.documentElement,c=a.style.height;a.style.height="max-content";let l=Math.ceil(a.getBoundingClientRect().height);a.style.height=c;let u=Math.ceil(window.innerWidth);(u!==i||l!==s)&&(i=u,s=l,this.sendSizeChanged({width:u,height:l}))}))};r();let o=new ResizeObserver(r);return o.observe(document.documentElement),o.observe(document.body),()=>o.disconnect()}async connect(n=new TT(window.parent,window.parent),i){var s;if(this.transport)throw Error("App is already connected. Call close() before connecting again.");this._initializedSent=!1;try{await super.connect(n);let r=await this.request({method:"ui/initialize",params:{appCapabilities:this._appCapabilities,appInfo:this._appInfo,protocolVersion:MT}},$T,i);if(r===void 0)throw Error(`Server sent invalid initialize result: ${r}`);this._hostCapabilities=r.hostCapabilities,this._hostInfo=r.hostInfo,this._hostContext=r.hostContext,await this.notification({method:"ui/notifications/initialized"}),this._initializedSent=!0,(s=this.options)!=null&&s.autoResize&&this.setupSizeChangedNotifications()}catch(r){throw this.close(),r}}};He(Aa,"ONE_SHOT_EVENTS",new Set(["toolinput","toolinputpartial","toolresult","toolcancelled"]));let _l=Aa;/**
|
|
105
|
+
- "app": Tool callable by the app from this server only`),csp:Ll().optional(),permissions:Ll().optional()});M({mimeTypes:G(g()).optional().describe('Array of supported MIME types for UI resources.\nMust include `"text/html;profile=mcp-app"` for MCP Apps support.')});M({method:C("ui/download-file"),params:M({contents:G(Se([gd,_d])).describe("Resource contents to download — embedded (inline data) or linked (host fetches). Uses standard MCP resource types.")})});M({method:C("ui/message"),params:M({role:C("user").describe('Message role, currently only "user" is supported.'),content:G(Ar).describe("Message content blocks (text, image, etc.).")})});M({method:C("ui/notifications/sandbox-resource-ready"),params:M({html:g().describe("HTML content to load into the inner iframe."),sandbox:g().optional().describe("Optional override for the inner iframe's sandbox attribute."),csp:Ld.optional().describe("CSP configuration from resource metadata."),permissions:Id.optional().describe("Sandbox permissions from resource metadata.")})});var WR=M({method:C("ui/notifications/tool-result"),params:oc.describe("Standard MCP tool execution result.")}),lS=M({toolInfo:M({id:Us.optional().describe("JSON-RPC id of the tools/call request."),tool:rc.describe("Tool definition including name, inputSchema, etc.")}).optional().describe("Metadata of the tool call that instantiated this App."),theme:CR.optional().describe("Current color theme preference."),styles:zR.optional().describe("Style configuration for theming the app."),displayMode:ao.optional().describe("How the UI is currently displayed."),availableDisplayModes:G(ao).optional().describe("Display modes the host supports."),containerDimensions:Se([M({height:ae().describe("Fixed container height in pixels.")}),M({maxHeight:Se([ae(),Pl()]).optional().describe("Maximum container height in pixels.")})]).and(Se([M({width:ae().describe("Fixed container width in pixels.")}),M({maxWidth:Se([ae(),Pl()]).optional().describe("Maximum container width in pixels.")})])).optional().describe(`Container dimensions. Represents the dimensions of the iframe or other
|
|
106
|
+
container holding the app. Specify either width or maxWidth, and either height or maxHeight.`),locale:g().optional().describe("User's language and region preference in BCP 47 format."),timeZone:g().optional().describe("User's timezone in IANA format."),userAgent:g().optional().describe("Host application identifier."),platform:Se([C("web"),C("desktop"),C("mobile")]).optional().describe("Platform type for responsive design decisions."),deviceCapabilities:M({touch:xe().optional().describe("Whether the device supports touch input."),hover:xe().optional().describe("Whether the device supports hover interactions.")}).optional().describe("Device input capabilities."),safeAreaInsets:M({top:ae().describe("Top safe area inset in pixels."),right:ae().describe("Right safe area inset in pixels."),bottom:ae().describe("Bottom safe area inset in pixels."),left:ae().describe("Left safe area inset in pixels.")}).optional().describe("Mobile safe area boundaries in pixels.")}).passthrough(),ZR=M({method:C("ui/notifications/host-context-changed"),params:lS.describe("Partial context update containing only changed fields.")});M({method:C("ui/update-model-context"),params:M({content:G(Ar).optional().describe("Context content blocks (text, image, etc.)."),structuredContent:_e(g(),Ue().describe("Structured content for machine-readable context data.")).optional().describe("Structured content for machine-readable context data.")})});M({method:C("ui/initialize"),params:M({appInfo:Er.describe("App identification (name and version)."),appCapabilities:GR.describe("Features and capabilities this app provides."),protocolVersion:g().describe("Protocol version this app supports.")})});var XR=M({protocolVersion:g().describe('Negotiated protocol version string (e.g., "2025-11-21").'),hostInfo:Er.describe("Host application identification and version."),hostCapabilities:VR.describe("Features and capabilities provided by the host."),hostContext:lS.describe("Rich context about the host environment.")}).passthrough(),YR={target:"draft-2020-12"};async function df(t,e){let n=t["~standard"];if(n.jsonSchema)return n.jsonSchema[e](YR);throw Error(`Schema (vendor: ${n.vendor}) does not implement Standard JSON Schema (~standard.jsonSchema). Use a library that does (zod v4, ArkType, Valibot) or wrap your schema accordingly.`)}async function hf(t,e,n=""){let i=await t["~standard"].validate(e);if(i.issues){let s=i.issues.map(r=>{var a;let o=(a=r.path)==null?void 0:a.map(c=>typeof c=="object"?c.key:c).join(".");return o?`${o}: ${r.message}`:r.message}).join("; ");throw Error(n+s)}return i.value}function KR(t,e){let n={...t,...e};return e.experimental!==void 0&&(n.experimental={...t.experimental,...e.experimental}),e.tools!==void 0&&(n.tools={...t.tools,...e.tools}),n}const Ha=class Ha extends aR{constructor(n,i={},s={autoResize:!0}){super(s);Ve(this,"_appInfo");Ve(this,"_appCapabilities");Ve(this,"options");Ve(this,"_hostCapabilities");Ve(this,"_hostInfo");Ve(this,"_hostContext");Ve(this,"_registeredTools",{});Ve(this,"_initializedSent",!1);Ve(this,"_registeredEvents",new Set);Ve(this,"_events",new MR);Ve(this,"_methods",new ER);Ve(this,"setRequestHandler",(...n)=>{let[i,...s]=lf("request",n)??n;this._methods.claim(i,"setRequestHandler"),super.setRequestHandler.call(this,i,...s)});Ve(this,"setNotificationHandler",(...n)=>{let[i,...s]=lf("notification",n)??n;this._methods.claim(i,"setNotificationHandler"),super.setNotificationHandler.call(this,i,...s)});Ve(this,"removeRequestHandler",n=>{this._methods.release(n),super.removeRequestHandler(n)});Ve(this,"removeNotificationHandler",n=>{this._methods.release(n),super.removeNotificationHandler(n)});Ve(this,"replaceRequestHandler",(n,...i)=>{this._methods.replace(n),super.setRequestHandler.call(this,n,...i)});Ve(this,"eventSchemas",{toolinput:UR,toolinputpartial:OR,toolresult:WR,toolcancelled:FR,hostcontextchanged:ZR});Ve(this,"_everHadListener",new Set);Ve(this,"_toolHandlersInitialized",!1);Ve(this,"_onteardown");Ve(this,"_oncalltool");Ve(this,"_onlisttools");Ve(this,"sendOpenLink",this.openLink);this._appInfo=n,this._appCapabilities=i,this.options=s,this._methods.replace("notifications/cancelled"),this._methods.replace("notifications/progress"),!s.allowUnsafeEval&&ii({jitless:!0}),this.replaceRequestHandler("ping",r=>(console.log("Received ping:",r.params),{})),this.setEventHandler("hostcontextchanged",void 0)}_assertInitialized(n){var s;if(this._initializedSent)return;let i=`[ext-apps] App.${n}() called before connect() completed the ui/initialize handshake. Await app.connect() before calling this method, or move data loading to an ontoolresult handler.`;if((s=this.options)!=null&&s.strict)throw Error(i);console.warn(`${i}. This will throw in a future release.`)}_assertHandlerTiming(n){var s;if(!Ha.ONE_SHOT_EVENTS.has(n)||this._everHadListener.has(n)||(this._everHadListener.add(n),!this._initializedSent))return;let i=`[ext-apps] "${String(n)}" handler registered after connect() completed the ui/initialize handshake. The host may have already sent this notification. Register handlers before calling app.connect().`;if((s=this.options)!=null&&s.strict)throw Error(i);console.warn(i)}setEventHandler(n,i){i&&this._assertHandlerTiming(n),this._ensureEventSlot(n),this._events.setHandler(n,i)}addEventListener(n,i){this._assertHandlerTiming(n),this._ensureEventSlot(n),this._events.addEventListener(n,i)}removeEventListener(n,i){this._events.removeEventListener(n,i)}_ensureEventSlot(n){if(this._registeredEvents.has(n))return;let i=this.eventSchemas[n];if(!i)throw Error(`Unknown event: ${String(n)}`);this.setNotificationHandler(i.shape.method.value,{params:i.shape.params},s=>{let r=s;n==="hostcontextchanged"&&(this._hostContext={...this._hostContext,...r}),this._events.dispatch(n,r)}),this._registeredEvents.add(n)}getEventHandler(n){return this._events.getHandler(n)}warnIfRequestHandlerReplaced(n,i,s){i&&s&&console.warn(`[MCP Apps] ${n} handler replaced. Previous handler will no longer be called.`)}buildContext(n){return n}registerAppCapabilities(n){if(this.transport)throw Error("Cannot register capabilities after transport is established");this._appCapabilities=KR(this._appCapabilities,n)}registerTool(n,i,s){if(this._registeredTools[n])throw Error(`Tool ${n} is already registered`);let r=this,o=()=>{var l;r._initializedSent&&((l=r._appCapabilities.tools)!=null&&l.listChanged)&&r.sendToolListChanged()},a=i.inputSchema!==void 0,c={title:i.title,description:i.description,inputSchema:i.inputSchema,outputSchema:i.outputSchema,annotations:i.annotations,_meta:i._meta,enabled:!0,enable(){this.enabled=!0,o()},disable(){this.enabled=!1,o()},update(l){Object.assign(this,l),o()},remove(){r._registeredTools[n]===c&&(delete r._registeredTools[n],o())},handler:async(l,u)=>{if(!c.enabled)throw Error(`Tool ${n} is disabled`);let h;if(a){let d=c.inputSchema,f=d?await hf(d,l??{},`Invalid input for tool ${n}: `):l??{};h=await s(f,u)}else h=await s(u);return c.outputSchema&&!h.isError&&(h.structuredContent=await hf(c.outputSchema,h.structuredContent,`Invalid output for tool ${n}: `)),h}};return this._registeredTools[n]=c,!this._appCapabilities.tools&&!this.transport&&this.registerAppCapabilities({tools:{listChanged:!0}}),this.ensureToolHandlersInitialized(),o(),c}ensureToolHandlersInitialized(){this._toolHandlersInitialized||(this._toolHandlersInitialized=!0,this.oncalltool=async(n,i)=>{let s=this._registeredTools[n.name];if(!s)throw Error(`Tool ${n.name} not found`);return s.handler(n.arguments,i)},this.onlisttools=async(n,i)=>({tools:await Promise.all(Object.entries(this._registeredTools).filter(([s,r])=>r.enabled).map(async([s,r])=>{let o={name:s,title:r.title,description:r.description,inputSchema:r.inputSchema?await df(r.inputSchema,"input"):{type:"object",properties:{}}};return r.outputSchema&&(o.outputSchema=await df(r.outputSchema,"output")),r.annotations&&(o.annotations=r.annotations),r._meta&&(o._meta=r._meta),o}))}))}async sendToolListChanged(n={}){this._assertInitialized("sendToolListChanged"),await this.notification({method:"notifications/tools/list_changed",params:n})}getHostCapabilities(){return this._hostCapabilities}getHostVersion(){return this._hostInfo}getHostContext(){return this._hostContext}get ontoolinput(){return this.getEventHandler("toolinput")}set ontoolinput(n){this.setEventHandler("toolinput",n)}get ontoolinputpartial(){return this.getEventHandler("toolinputpartial")}set ontoolinputpartial(n){this.setEventHandler("toolinputpartial",n)}get ontoolresult(){return this.getEventHandler("toolresult")}set ontoolresult(n){this.setEventHandler("toolresult",n)}get ontoolcancelled(){return this.getEventHandler("toolcancelled")}set ontoolcancelled(n){this.setEventHandler("toolcancelled",n)}get onhostcontextchanged(){return this.getEventHandler("hostcontextchanged")}set onhostcontextchanged(n){this.setEventHandler("hostcontextchanged",n)}get onteardown(){return this._onteardown}set onteardown(n){this.warnIfRequestHandlerReplaced("onteardown",this._onteardown,n),this._onteardown=n,this.replaceRequestHandler("ui/resource-teardown",{params:BR.shape.params,result:HR},(i,s)=>{if(!this._onteardown)throw Error("No onteardown handler set");return this._onteardown(i,s)})}get oncalltool(){return this._oncalltool}set oncalltool(n){this.warnIfRequestHandlerReplaced("oncalltool",this._oncalltool,n),this._oncalltool=n,this.replaceRequestHandler("tools/call",(i,s)=>{if(!this._oncalltool)throw Error("No oncalltool handler set");return this._oncalltool(i.params,s)})}get onlisttools(){return this._onlisttools}set onlisttools(n){this.warnIfRequestHandlerReplaced("onlisttools",this._onlisttools,n),this._onlisttools=n,this.replaceRequestHandler("tools/list",(i,s)=>{if(!this._onlisttools)throw Error("No onlisttools handler set");return this._onlisttools(i.params,s)})}assertCapabilityForMethod(n){var i;switch(n){case"sampling/createMessage":if(!((i=this._hostCapabilities)!=null&&i.sampling))throw Error(`Host does not support sampling (required for ${n})`);break}}assertRequestHandlerCapability(n){switch(n){case"tools/call":case"tools/list":if(!this._appCapabilities.tools)throw Error(`Client does not support tool capability (required for ${n})`);return;default:return}}assertNotificationCapability(n){}async callServerTool(n,i){if(this._assertInitialized("callServerTool"),typeof n=="string")throw Error(`callServerTool() expects an object as its first argument, but received a string ("${n}"). Did you mean: callServerTool({ name: "${n}", arguments: { ... } })?`);return await this.request({method:"tools/call",params:n},{onprogress:()=>{},resetTimeoutOnProgress:!0,...i})}async readServerResource(n,i){return this._assertInitialized("readServerResource"),await this.request({method:"resources/read",params:n},i)}async listServerResources(n,i){return this._assertInitialized("listServerResources"),await this.request({method:"resources/list",params:n},i)}async createSamplingMessage(n,i){return this._assertInitialized("createSamplingMessage"),await this.request({method:"sampling/createMessage",params:n},i)}sendMessage(n,i){return this._assertInitialized("sendMessage"),this.request({method:"ui/message",params:n},DR,i)}sendLog(n){return this.notification({method:"notifications/message",params:n})}updateModelContext(n,i){return this._assertInitialized("updateModelContext"),this.request({method:"ui/update-model-context",params:n},ec,i)}openLink(n,i){return this._assertInitialized("openLink"),this.request({method:"ui/open-link",params:n},IR,i)}downloadFile(n,i){return this._assertInitialized("downloadFile"),this.request({method:"ui/download-file",params:n},NR,i)}requestTeardown(n={}){return this.notification({method:"ui/notifications/request-teardown",params:n})}requestDisplayMode(n,i){return this._assertInitialized("requestDisplayMode"),this.request({method:"ui/request-display-mode",params:n},$R,i)}sendSizeChanged(n){return this.notification({method:"ui/notifications/size-changed",params:n})}setupSizeChangedNotifications(){let n=!1,i=0,s=0,r=()=>{n||(n=!0,requestAnimationFrame(()=>{n=!1;let a=document.documentElement,c=a.style.height;a.style.height="max-content";let l=Math.ceil(a.getBoundingClientRect().height);a.style.height=c;let u=Math.ceil(window.innerWidth);(u!==i||l!==s)&&(i=u,s=l,this.sendSizeChanged({width:u,height:l}))}))};r();let o=new ResizeObserver(r);return o.observe(document.documentElement),o.observe(document.body),()=>o.disconnect()}async connect(n=new AR(window.parent,window.parent),i){var s;if(this.transport)throw Error("App is already connected. Call close() before connecting again.");this._initializedSent=!1;try{await super.connect(n);let r=await this.request({method:"ui/initialize",params:{appCapabilities:this._appCapabilities,appInfo:this._appInfo,protocolVersion:RR}},XR,i);if(r===void 0)throw Error(`Server sent invalid initialize result: ${r}`);this._hostCapabilities=r.hostCapabilities,this._hostInfo=r.hostInfo,this._hostContext=r.hostContext,await this.notification({method:"ui/notifications/initialized"}),this._initializedSent=!0,(s=this.options)!=null&&s.autoResize&&this.setupSizeChangedNotifications()}catch(r){throw this.close(),r}}};Ve(Ha,"ONE_SHOT_EVENTS",new Set(["toolinput","toolinputpartial","toolresult","toolcancelled"]));let kl=Ha;/**
|
|
107
107
|
* @license
|
|
108
108
|
* Copyright 2010-2026 Three.js Authors
|
|
109
109
|
* SPDX-License-Identifier: MIT
|
|
110
|
-
*/const cd="186",Ws={ROTATE:0,DOLLY:1,PAN:2},qs={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},XT=0,Ih=1,YT=2,Yo=1,KT=2,Ir=3,vs=0,Rn=1,wi=2,Pi=0,Fr=1,Lh=2,Nh=3,Dh=4,jT=5,Hs=100,JT=101,QT=102,eR=103,tR=104,nR=200,iR=201,sR=202,rR=203,E_=204,T_=205,oR=206,aR=207,cR=208,lR=209,uR=210,dR=211,hR=212,fR=213,pR=214,Sl=0,vl=1,xl=2,Kr=3,yl=4,bl=5,Ml=6,El=7,R_=0,mR=1,gR=2,hi=0,w_=1,A_=2,C_=3,P_=4,I_=5,L_=6,N_=7,D_=300,xs=301,or=302,vc=303,xc=304,Ka=306,Tl=1e3,Ci=1001,Rl=1002,on=1003,_R=1004,yo=1005,pn=1006,yc=1007,us=1008,Hn=1009,U_=1010,O_=1011,jr=1012,ld=1013,fi=1014,ui=1015,pi=1016,ud=1017,dd=1018,Jr=1020,F_=35902,k_=35899,z_=1021,B_=1022,Yn=1023,Ni=1026,ds=1027,H_=1028,hd=1029,ys=1030,fd=1031,pd=1033,Ko=33776,jo=33777,Jo=33778,Qo=33779,wl=35840,Al=35841,Cl=35842,Pl=35843,Il=36196,Ll=37492,Nl=37496,Dl=37488,Ul=37489,ma=37490,Ol=37491,Fl=37808,kl=37809,zl=37810,Bl=37811,Hl=37812,Vl=37813,Gl=37814,ql=37815,$l=37816,Wl=37817,Zl=37818,Xl=37819,Yl=37820,Kl=37821,jl=36492,Jl=36494,Ql=36495,eu=36283,tu=36284,ga=36285,nu=36286,SR=3200,Uh=0,vR=1,Zi="",kn="srgb",_a="srgb-linear",Sa="linear",Mt="srgb",bc=7680,xR=519,yR=512,bR=513,MR=514,md=515,ER=516,TR=517,gd=518,RR=519,wR=35044,Oh="300 es",di=2e3,va=2001;function AR(t){for(let e=t.length-1;e>=0;--e)if(t[e]>=65535)return!0;return!1}function xa(t){return document.createElementNS("http://www.w3.org/1999/xhtml",t)}function CR(){const t=xa("canvas");return t.style.display="block",t}const Fh={};function kh(...t){const e="THREE."+t.shift();console.log(e,...t)}function V_(t){const e=t[0];if(typeof e=="string"&&e.startsWith("TSL:")){const n=t[1];n&&n.isStackTrace?t[0]+=" "+n.getLocation():t[1]='Stack trace not available. Enable "THREE.Node.captureStackTrace" to capture stack traces.'}return t}function Ge(...t){t=V_(t);const e="THREE."+t.shift();{const n=t[0];n&&n.isStackTrace?console.warn(n.getError(e)):console.warn(e,...t)}}function St(...t){t=V_(t);const e="THREE."+t.shift();{const n=t[0];n&&n.isStackTrace?console.error(n.getError(e)):console.error(e,...t)}}function Zs(...t){const e=t.join(" ");e in Fh||(Fh[e]=!0,Ge(...t))}function PR(t,e,n){return new Promise(function(i,s){function r(){switch(t.clientWaitSync(e,t.SYNC_FLUSH_COMMANDS_BIT,0)){case t.WAIT_FAILED:s();break;case t.TIMEOUT_EXPIRED:setTimeout(r,n);break;default:i()}}setTimeout(r,n)})}const IR={[Sl]:vl,[xl]:Ml,[yl]:El,[Kr]:bl,[vl]:Sl,[Ml]:xl,[El]:yl,[bl]:Kr};class Qi{addEventListener(e,n){this._listeners===void 0&&(this._listeners={});const i=this._listeners;i[e]===void 0&&(i[e]=[]),i[e].indexOf(n)===-1&&i[e].push(n)}hasEventListener(e,n){const i=this._listeners;return i===void 0?!1:i[e]!==void 0&&i[e].indexOf(n)!==-1}removeEventListener(e,n){const i=this._listeners;if(i===void 0)return;const s=i[e];if(s!==void 0){const r=s.indexOf(n);r!==-1&&s.splice(r,1)}}dispatchEvent(e){const n=this._listeners;if(n===void 0)return;const i=n[e.type];if(i!==void 0){e.target=this;const s=i.slice(0);for(let r=0,o=s.length;r<o;r++)s[r].call(this,e);e.target=null}}}const un=["00","01","02","03","04","05","06","07","08","09","0a","0b","0c","0d","0e","0f","10","11","12","13","14","15","16","17","18","19","1a","1b","1c","1d","1e","1f","20","21","22","23","24","25","26","27","28","29","2a","2b","2c","2d","2e","2f","30","31","32","33","34","35","36","37","38","39","3a","3b","3c","3d","3e","3f","40","41","42","43","44","45","46","47","48","49","4a","4b","4c","4d","4e","4f","50","51","52","53","54","55","56","57","58","59","5a","5b","5c","5d","5e","5f","60","61","62","63","64","65","66","67","68","69","6a","6b","6c","6d","6e","6f","70","71","72","73","74","75","76","77","78","79","7a","7b","7c","7d","7e","7f","80","81","82","83","84","85","86","87","88","89","8a","8b","8c","8d","8e","8f","90","91","92","93","94","95","96","97","98","99","9a","9b","9c","9d","9e","9f","a0","a1","a2","a3","a4","a5","a6","a7","a8","a9","aa","ab","ac","ad","ae","af","b0","b1","b2","b3","b4","b5","b6","b7","b8","b9","ba","bb","bc","bd","be","bf","c0","c1","c2","c3","c4","c5","c6","c7","c8","c9","ca","cb","cc","cd","ce","cf","d0","d1","d2","d3","d4","d5","d6","d7","d8","d9","da","db","dc","dd","de","df","e0","e1","e2","e3","e4","e5","e6","e7","e8","e9","ea","eb","ec","ed","ee","ef","f0","f1","f2","f3","f4","f5","f6","f7","f8","f9","fa","fb","fc","fd","fe","ff"];let zh=1234567;const kr=Math.PI/180,Qr=180/Math.PI;function gr(){const t=Math.random()*4294967295|0,e=Math.random()*4294967295|0,n=Math.random()*4294967295|0,i=Math.random()*4294967295|0;return(un[t&255]+un[t>>8&255]+un[t>>16&255]+un[t>>24&255]+"-"+un[e&255]+un[e>>8&255]+"-"+un[e>>16&15|64]+un[e>>24&255]+"-"+un[n&63|128]+un[n>>8&255]+"-"+un[n>>16&255]+un[n>>24&255]+un[i&255]+un[i>>8&255]+un[i>>16&255]+un[i>>24&255]).toLowerCase()}function st(t,e,n){return Math.max(e,Math.min(n,t))}function _d(t,e){return(t%e+e)%e}function LR(t,e,n,i,s){return i+(t-e)*(s-i)/(n-e)}function NR(t,e,n){return t!==e?(n-t)/(e-t):0}function zr(t,e,n){return(1-n)*t+n*e}function DR(t,e,n,i){return zr(t,e,1-Math.exp(-n*i))}function UR(t,e=1){return e-Math.abs(_d(t,e*2)-e)}function OR(t,e,n){return t<=e?0:t>=n?1:(t=(t-e)/(n-e),t*t*(3-2*t))}function FR(t,e,n){return t<=e?0:t>=n?1:(t=(t-e)/(n-e),t*t*t*(t*(t*6-15)+10))}function kR(t,e){return t+Math.floor(Math.random()*(e-t+1))}function zR(t,e){return t+Math.random()*(e-t)}function BR(t){return t*(.5-Math.random())}function HR(t){t!==void 0&&(zh=t);let e=zh+=1831565813;return e=Math.imul(e^e>>>15,e|1),e^=e+Math.imul(e^e>>>7,e|61),((e^e>>>14)>>>0)/4294967296}function VR(t){return t*kr}function GR(t){return t*Qr}function qR(t){return t>0&&Number.isInteger(t)&&2**Math.round(Math.log2(t))===t}function $R(t){return Math.pow(2,Math.ceil(Math.log(t)/Math.LN2))}function WR(t){return Math.pow(2,Math.floor(Math.log(t)/Math.LN2))}function ZR(t,e,n,i,s){const r=Math.cos,o=Math.sin,a=r(n/2),c=o(n/2),l=r((e+i)/2),u=o((e+i)/2),h=r((e-i)/2),d=o((e-i)/2),f=r((i-e)/2),_=o((i-e)/2);switch(s){case"XYX":t.set(a*u,c*h,c*d,a*l);break;case"YZY":t.set(c*d,a*u,c*h,a*l);break;case"ZXZ":t.set(c*h,c*d,a*u,a*l);break;case"XZX":t.set(a*u,c*_,c*f,a*l);break;case"YXY":t.set(c*f,a*u,c*_,a*l);break;case"ZYZ":t.set(c*_,c*f,a*u,a*l);break;default:Ge("MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+s)}}function Vs(t,e){switch(e.constructor){case Float32Array:return t;case Uint32Array:return t/4294967295;case Uint16Array:return t/65535;case Uint8Array:case Uint8ClampedArray:return t/255;case Int32Array:return Math.max(t/2147483647,-1);case Int16Array:return Math.max(t/32767,-1);case Int8Array:return Math.max(t/127,-1);default:throw new Error("THREE.MathUtils: Invalid component type.")}}function Sn(t,e){switch(e.constructor){case Float32Array:return t;case Uint32Array:return Math.round(t*4294967295);case Uint16Array:return Math.round(t*65535);case Uint8Array:case Uint8ClampedArray:return Math.round(t*255);case Int32Array:return Math.round(t*2147483647);case Int16Array:return Math.round(t*32767);case Int8Array:return Math.round(t*127);default:throw new Error("THREE.MathUtils: Invalid component type.")}}const G_={DEG2RAD:kr,RAD2DEG:Qr,generateUUID:gr,clamp:st,euclideanModulo:_d,mapLinear:LR,inverseLerp:NR,lerp:zr,damp:DR,pingpong:UR,smoothstep:OR,smootherstep:FR,randInt:kR,randFloat:zR,randFloatSpread:BR,seededRandom:HR,degToRad:VR,radToDeg:GR,isPowerOfTwo:qR,ceilPowerOfTwo:$R,floorPowerOfTwo:WR,setQuaternionFromProperEuler:ZR,normalize:Sn,denormalize:Vs},Rd=class Rd{constructor(e=0,n=0){this.x=e,this.y=n}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,n){return this.x=e,this.y=n,this}setScalar(e){return this.x=e,this.y=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setComponent(e,n){switch(e){case 0:this.x=n;break;case 1:this.y=n;break;default:throw new Error("THREE.Vector2: index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("THREE.Vector2: index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}add(e){return this.x+=e.x,this.y+=e.y,this}addScalar(e){return this.x+=e,this.y+=e,this}addVectors(e,n){return this.x=e.x+n.x,this.y=e.y+n.y,this}addScaledVector(e,n){return this.x+=e.x*n,this.y+=e.y*n,this}sub(e){return this.x-=e.x,this.y-=e.y,this}subScalar(e){return this.x-=e,this.y-=e,this}subVectors(e,n){return this.x=e.x-n.x,this.y=e.y-n.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divide(e){return this.x/=e.x,this.y/=e.y,this}divideScalar(e){return this.multiplyScalar(1/e)}applyMatrix3(e){const n=this.x,i=this.y,s=e.elements;return this.x=s[0]*n+s[3]*i+s[6],this.y=s[1]*n+s[4]*i+s[7],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}clamp(e,n){return this.x=st(this.x,e.x,n.x),this.y=st(this.y,e.y,n.y),this}clampScalar(e,n){return this.x=st(this.x,e,n),this.y=st(this.y,e,n),this}clampLength(e,n){const i=this.length();return this.divideScalar(i||1).multiplyScalar(st(i,e,n))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(e){const n=Math.sqrt(this.lengthSq()*e.lengthSq());if(n===0)return Math.PI/2;const i=this.dot(e)/n;return Math.acos(st(i,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const n=this.x-e.x,i=this.y-e.y;return n*n+i*i}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,n){return this.x+=(e.x-this.x)*n,this.y+=(e.y-this.y)*n,this}lerpVectors(e,n,i){return this.x=e.x+(n.x-e.x)*i,this.y=e.y+(n.y-e.y)*i,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e,n=0){return this.x=e[n],this.y=e[n+1],this}toArray(e=[],n=0){return e[n]=this.x,e[n+1]=this.y,e}fromBufferAttribute(e,n){return this.x=e.getX(n),this.y=e.getY(n),this}rotateAround(e,n){const i=Math.cos(n),s=Math.sin(n),r=this.x-e.x,o=this.y-e.y;return this.x=r*i-o*s+e.x,this.y=r*s+o*i+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}};Rd.prototype.isVector2=!0;let Ke=Rd;class ji{constructor(e=0,n=0,i=0,s=1){this.isQuaternion=!0,this._x=e,this._y=n,this._z=i,this._w=s}static slerpFlat(e,n,i,s,r,o,a){let c=i[s+0],l=i[s+1],u=i[s+2],h=i[s+3],d=r[o+0],f=r[o+1],_=r[o+2],x=r[o+3];if(h!==x||c!==d||l!==f||u!==_){let m=c*d+l*f+u*_+h*x;m<0&&(d=-d,f=-f,_=-_,x=-x,m=-m);let p=1-a;if(m<.9995){const E=Math.acos(m),L=Math.sin(E);p=Math.sin(p*E)/L,a=Math.sin(a*E)/L,c=c*p+d*a,l=l*p+f*a,u=u*p+_*a,h=h*p+x*a}else{c=c*p+d*a,l=l*p+f*a,u=u*p+_*a,h=h*p+x*a;const E=1/Math.sqrt(c*c+l*l+u*u+h*h);c*=E,l*=E,u*=E,h*=E}}e[n]=c,e[n+1]=l,e[n+2]=u,e[n+3]=h}static multiplyQuaternionsFlat(e,n,i,s,r,o){const a=i[s],c=i[s+1],l=i[s+2],u=i[s+3],h=r[o],d=r[o+1],f=r[o+2],_=r[o+3];return e[n]=a*_+u*h+c*f-l*d,e[n+1]=c*_+u*d+l*h-a*f,e[n+2]=l*_+u*f+a*d-c*h,e[n+3]=u*_-a*h-c*d-l*f,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,n,i,s){return this._x=e,this._y=n,this._z=i,this._w=s,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(e,n=!0){const i=e._x,s=e._y,r=e._z,o=e._order,a=Math.cos,c=Math.sin,l=a(i/2),u=a(s/2),h=a(r/2),d=c(i/2),f=c(s/2),_=c(r/2);switch(o){case"XYZ":this._x=d*u*h+l*f*_,this._y=l*f*h-d*u*_,this._z=l*u*_+d*f*h,this._w=l*u*h-d*f*_;break;case"YXZ":this._x=d*u*h+l*f*_,this._y=l*f*h-d*u*_,this._z=l*u*_-d*f*h,this._w=l*u*h+d*f*_;break;case"ZXY":this._x=d*u*h-l*f*_,this._y=l*f*h+d*u*_,this._z=l*u*_+d*f*h,this._w=l*u*h-d*f*_;break;case"ZYX":this._x=d*u*h-l*f*_,this._y=l*f*h+d*u*_,this._z=l*u*_-d*f*h,this._w=l*u*h+d*f*_;break;case"YZX":this._x=d*u*h+l*f*_,this._y=l*f*h+d*u*_,this._z=l*u*_-d*f*h,this._w=l*u*h-d*f*_;break;case"XZY":this._x=d*u*h-l*f*_,this._y=l*f*h-d*u*_,this._z=l*u*_+d*f*h,this._w=l*u*h+d*f*_;break;default:Ge("Quaternion: .setFromEuler() encountered an unknown order: "+o)}return n===!0&&this._onChangeCallback(),this}setFromAxisAngle(e,n){const i=n/2,s=Math.sin(i);return this._x=e.x*s,this._y=e.y*s,this._z=e.z*s,this._w=Math.cos(i),this._onChangeCallback(),this}setFromRotationMatrix(e){const n=e.elements,i=n[0],s=n[4],r=n[8],o=n[1],a=n[5],c=n[9],l=n[2],u=n[6],h=n[10],d=i+a+h;if(d>0){const f=.5/Math.sqrt(d+1);this._w=.25/f,this._x=(u-c)*f,this._y=(r-l)*f,this._z=(o-s)*f}else if(i>a&&i>h){const f=2*Math.sqrt(1+i-a-h);this._w=(u-c)/f,this._x=.25*f,this._y=(s+o)/f,this._z=(r+l)/f}else if(a>h){const f=2*Math.sqrt(1+a-i-h);this._w=(r-l)/f,this._x=(s+o)/f,this._y=.25*f,this._z=(c+u)/f}else{const f=2*Math.sqrt(1+h-i-a);this._w=(o-s)/f,this._x=(r+l)/f,this._y=(c+u)/f,this._z=.25*f}return this._onChangeCallback(),this}setFromUnitVectors(e,n){let i=e.dot(n)+1;return i<1e-8?(i=0,Math.abs(e.x)>Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=i):(this._x=0,this._y=-e.z,this._z=e.y,this._w=i)):(this._x=e.y*n.z-e.z*n.y,this._y=e.z*n.x-e.x*n.z,this._z=e.x*n.y-e.y*n.x,this._w=i),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(st(this.dot(e),-1,1)))}rotateTowards(e,n){const i=this.angleTo(e);if(i===0)return this;const s=Math.min(1,n/i);return this.slerp(e,s),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let e=this.length();return e===0?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this._onChangeCallback(),this}multiply(e){return this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,n){const i=e._x,s=e._y,r=e._z,o=e._w,a=n._x,c=n._y,l=n._z,u=n._w;return this._x=i*u+o*a+s*l-r*c,this._y=s*u+o*c+r*a-i*l,this._z=r*u+o*l+i*c-s*a,this._w=o*u-i*a-s*c-r*l,this._onChangeCallback(),this}slerp(e,n){let i=e._x,s=e._y,r=e._z,o=e._w,a=this.dot(e);a<0&&(i=-i,s=-s,r=-r,o=-o,a=-a);let c=1-n;if(a<.9995){const l=Math.acos(a),u=Math.sin(l);c=Math.sin(c*l)/u,n=Math.sin(n*l)/u,this._x=this._x*c+i*n,this._y=this._y*c+s*n,this._z=this._z*c+r*n,this._w=this._w*c+o*n,this._onChangeCallback()}else this._x=this._x*c+i*n,this._y=this._y*c+s*n,this._z=this._z*c+r*n,this._w=this._w*c+o*n,this.normalize();return this}slerpQuaternions(e,n,i){return this.copy(e).slerp(n,i)}random(){const e=2*Math.PI*Math.random(),n=2*Math.PI*Math.random(),i=Math.random(),s=Math.sqrt(1-i),r=Math.sqrt(i);return this.set(s*Math.sin(e),s*Math.cos(e),r*Math.sin(n),r*Math.cos(n))}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e,n=0){return this._x=e[n],this._y=e[n+1],this._z=e[n+2],this._w=e[n+3],this._onChangeCallback(),this}toArray(e=[],n=0){return e[n]=this._x,e[n+1]=this._y,e[n+2]=this._z,e[n+3]=this._w,e}fromBufferAttribute(e,n){return this._x=e.getX(n),this._y=e.getY(n),this._z=e.getZ(n),this._w=e.getW(n),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}const wd=class wd{constructor(e=0,n=0,i=0){this.x=e,this.y=n,this.z=i}set(e,n,i){return i===void 0&&(i=this.z),this.x=e,this.y=n,this.z=i,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setComponent(e,n){switch(e){case 0:this.x=n;break;case 1:this.y=n;break;case 2:this.z=n;break;default:throw new Error("THREE.Vector3: index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("THREE.Vector3: index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this}addVectors(e,n){return this.x=e.x+n.x,this.y=e.y+n.y,this.z=e.z+n.z,this}addScaledVector(e,n){return this.x+=e.x*n,this.y+=e.y*n,this.z+=e.z*n,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this}subVectors(e,n){return this.x=e.x-n.x,this.y=e.y-n.y,this.z=e.z-n.z,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}multiplyVectors(e,n){return this.x=e.x*n.x,this.y=e.y*n.y,this.z=e.z*n.z,this}applyEuler(e){return this.applyQuaternion(Bh.setFromEuler(e))}applyAxisAngle(e,n){return this.applyQuaternion(Bh.setFromAxisAngle(e,n))}applyMatrix3(e){const n=this.x,i=this.y,s=this.z,r=e.elements;return this.x=r[0]*n+r[3]*i+r[6]*s,this.y=r[1]*n+r[4]*i+r[7]*s,this.z=r[2]*n+r[5]*i+r[8]*s,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){const n=this.x,i=this.y,s=this.z,r=e.elements,o=1/(r[3]*n+r[7]*i+r[11]*s+r[15]);return this.x=(r[0]*n+r[4]*i+r[8]*s+r[12])*o,this.y=(r[1]*n+r[5]*i+r[9]*s+r[13])*o,this.z=(r[2]*n+r[6]*i+r[10]*s+r[14])*o,this}applyQuaternion(e){const n=this.x,i=this.y,s=this.z,r=e.x,o=e.y,a=e.z,c=e.w,l=2*(o*s-a*i),u=2*(a*n-r*s),h=2*(r*i-o*n);return this.x=n+c*l+o*h-a*u,this.y=i+c*u+a*l-r*h,this.z=s+c*h+r*u-o*l,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){const n=this.x,i=this.y,s=this.z,r=e.elements;return this.x=r[0]*n+r[4]*i+r[8]*s,this.y=r[1]*n+r[5]*i+r[9]*s,this.z=r[2]*n+r[6]*i+r[10]*s,this.normalize()}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}divideScalar(e){return this.multiplyScalar(1/e)}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this}clamp(e,n){return this.x=st(this.x,e.x,n.x),this.y=st(this.y,e.y,n.y),this.z=st(this.z,e.z,n.z),this}clampScalar(e,n){return this.x=st(this.x,e,n),this.y=st(this.y,e,n),this.z=st(this.z,e,n),this}clampLength(e,n){const i=this.length();return this.divideScalar(i||1).multiplyScalar(st(i,e,n))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,n){return this.x+=(e.x-this.x)*n,this.y+=(e.y-this.y)*n,this.z+=(e.z-this.z)*n,this}lerpVectors(e,n,i){return this.x=e.x+(n.x-e.x)*i,this.y=e.y+(n.y-e.y)*i,this.z=e.z+(n.z-e.z)*i,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,n){const i=e.x,s=e.y,r=e.z,o=n.x,a=n.y,c=n.z;return this.x=s*c-r*a,this.y=r*o-i*c,this.z=i*a-s*o,this}projectOnVector(e){const n=e.lengthSq();if(n===0)return this.set(0,0,0);const i=e.dot(this)/n;return this.copy(e).multiplyScalar(i)}projectOnPlane(e){return Mc.copy(this).projectOnVector(e),this.sub(Mc)}reflect(e){return this.sub(Mc.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){const n=Math.sqrt(this.lengthSq()*e.lengthSq());if(n===0)return Math.PI/2;const i=this.dot(e)/n;return Math.acos(st(i,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const n=this.x-e.x,i=this.y-e.y,s=this.z-e.z;return n*n+i*i+s*s}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}setFromSpherical(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}setFromSphericalCoords(e,n,i){const s=Math.sin(n)*e;return this.x=s*Math.sin(i),this.y=Math.cos(n)*e,this.z=s*Math.cos(i),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,n,i){return this.x=e*Math.sin(n),this.y=i,this.z=e*Math.cos(n),this}setFromMatrixPosition(e){const n=e.elements;return this.x=n[12],this.y=n[13],this.z=n[14],this}setFromMatrixScale(e){const n=this.setFromMatrixColumn(e,0).length(),i=this.setFromMatrixColumn(e,1).length(),s=this.setFromMatrixColumn(e,2).length();return this.x=n,this.y=i,this.z=s,this}setFromMatrixColumn(e,n){return this.fromArray(e.elements,n*4)}setFromMatrix3Column(e,n){return this.fromArray(e.elements,n*3)}setFromEuler(e){return this.x=e._x,this.y=e._y,this.z=e._z,this}setFromColor(e){return this.x=e.r,this.y=e.g,this.z=e.b,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}fromArray(e,n=0){return this.x=e[n],this.y=e[n+1],this.z=e[n+2],this}toArray(e=[],n=0){return e[n]=this.x,e[n+1]=this.y,e[n+2]=this.z,e}fromBufferAttribute(e,n){return this.x=e.getX(n),this.y=e.getY(n),this.z=e.getZ(n),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){const e=Math.random()*Math.PI*2,n=Math.random()*2-1,i=Math.sqrt(1-n*n);return this.x=i*Math.cos(e),this.y=n,this.z=i*Math.sin(e),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}};wd.prototype.isVector3=!0;let H=wd;const Mc=new H,Bh=new ji,Ad=class Ad{constructor(e,n,i,s,r,o,a,c,l){this.elements=[1,0,0,0,1,0,0,0,1],e!==void 0&&this.set(e,n,i,s,r,o,a,c,l)}set(e,n,i,s,r,o,a,c,l){const u=this.elements;return u[0]=e,u[1]=s,u[2]=a,u[3]=n,u[4]=r,u[5]=c,u[6]=i,u[7]=o,u[8]=l,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){const n=this.elements,i=e.elements;return n[0]=i[0],n[1]=i[1],n[2]=i[2],n[3]=i[3],n[4]=i[4],n[5]=i[5],n[6]=i[6],n[7]=i[7],n[8]=i[8],this}extractBasis(e,n,i){return e.setFromMatrix3Column(this,0),n.setFromMatrix3Column(this,1),i.setFromMatrix3Column(this,2),this}setFromMatrix4(e){const n=e.elements;return this.set(n[0],n[4],n[8],n[1],n[5],n[9],n[2],n[6],n[10]),this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,n){const i=e.elements,s=n.elements,r=this.elements,o=i[0],a=i[3],c=i[6],l=i[1],u=i[4],h=i[7],d=i[2],f=i[5],_=i[8],x=s[0],m=s[3],p=s[6],E=s[1],L=s[4],b=s[7],w=s[2],A=s[5],P=s[8];return r[0]=o*x+a*E+c*w,r[3]=o*m+a*L+c*A,r[6]=o*p+a*b+c*P,r[1]=l*x+u*E+h*w,r[4]=l*m+u*L+h*A,r[7]=l*p+u*b+h*P,r[2]=d*x+f*E+_*w,r[5]=d*m+f*L+_*A,r[8]=d*p+f*b+_*P,this}multiplyScalar(e){const n=this.elements;return n[0]*=e,n[3]*=e,n[6]*=e,n[1]*=e,n[4]*=e,n[7]*=e,n[2]*=e,n[5]*=e,n[8]*=e,this}determinant(){const e=this.elements,n=e[0],i=e[1],s=e[2],r=e[3],o=e[4],a=e[5],c=e[6],l=e[7],u=e[8];return n*o*u-n*a*l-i*r*u+i*a*c+s*r*l-s*o*c}invert(){const e=this.elements,n=e[0],i=e[1],s=e[2],r=e[3],o=e[4],a=e[5],c=e[6],l=e[7],u=e[8],h=u*o-a*l,d=a*c-u*r,f=l*r-o*c,_=n*h+i*d+s*f;if(_===0)return this.set(0,0,0,0,0,0,0,0,0);const x=1/_;return e[0]=h*x,e[1]=(s*l-u*i)*x,e[2]=(a*i-s*o)*x,e[3]=d*x,e[4]=(u*n-s*c)*x,e[5]=(s*r-a*n)*x,e[6]=f*x,e[7]=(i*c-l*n)*x,e[8]=(o*n-i*r)*x,this}transpose(){let e;const n=this.elements;return e=n[1],n[1]=n[3],n[3]=e,e=n[2],n[2]=n[6],n[6]=e,e=n[5],n[5]=n[7],n[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){const n=this.elements;return e[0]=n[0],e[1]=n[3],e[2]=n[6],e[3]=n[1],e[4]=n[4],e[5]=n[7],e[6]=n[2],e[7]=n[5],e[8]=n[8],this}setUvTransform(e,n,i,s,r,o,a){const c=Math.cos(r),l=Math.sin(r);return this.set(i*c,i*l,-i*(c*o+l*a)+o+e,-s*l,s*c,-s*(-l*o+c*a)+a+n,0,0,1),this}scale(e,n){return Zs("Matrix3: .scale() is deprecated. Use .makeScale() instead."),this.premultiply(Ec.makeScale(e,n)),this}rotate(e){return Zs("Matrix3: .rotate() is deprecated. Use .makeRotation() instead."),this.premultiply(Ec.makeRotation(-e)),this}translate(e,n){return Zs("Matrix3: .translate() is deprecated. Use .makeTranslation() instead."),this.premultiply(Ec.makeTranslation(e,n)),this}makeTranslation(e,n){return e.isVector2?this.set(1,0,e.x,0,1,e.y,0,0,1):this.set(1,0,e,0,1,n,0,0,1),this}makeRotation(e){const n=Math.cos(e),i=Math.sin(e);return this.set(n,-i,0,i,n,0,0,0,1),this}makeScale(e,n){return this.set(e,0,0,0,n,0,0,0,1),this}equals(e){const n=this.elements,i=e.elements;for(let s=0;s<9;s++)if(n[s]!==i[s])return!1;return!0}fromArray(e,n=0){for(let i=0;i<9;i++)this.elements[i]=e[i+n];return this}toArray(e=[],n=0){const i=this.elements;return e[n]=i[0],e[n+1]=i[1],e[n+2]=i[2],e[n+3]=i[3],e[n+4]=i[4],e[n+5]=i[5],e[n+6]=i[6],e[n+7]=i[7],e[n+8]=i[8],e}clone(){return new this.constructor().fromArray(this.elements)}};Ad.prototype.isMatrix3=!0;let Ye=Ad;const Ec=new Ye,Hh=new Ye().set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),Vh=new Ye().set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715);function XR(){const t={enabled:!0,workingColorSpace:_a,spaces:{},convert:function(s,r,o){return this.enabled===!1||r===o||!r||!o||(this.spaces[r].transfer===Mt&&(s.r=Ii(s.r),s.g=Ii(s.g),s.b=Ii(s.b)),this.spaces[r].primaries!==this.spaces[o].primaries&&(s.applyMatrix3(this.spaces[r].toXYZ),s.applyMatrix3(this.spaces[o].fromXYZ)),this.spaces[o].transfer===Mt&&(s.r=Xs(s.r),s.g=Xs(s.g),s.b=Xs(s.b))),s},workingToColorSpace:function(s,r){return this.convert(s,this.workingColorSpace,r)},colorSpaceToWorking:function(s,r){return this.convert(s,r,this.workingColorSpace)},getPrimaries:function(s){return this.spaces[s].primaries},getTransfer:function(s){return s===Zi?Sa:this.spaces[s].transfer},getToneMappingMode:function(s){return this.spaces[s].outputColorSpaceConfig.toneMappingMode||"standard"},getLuminanceCoefficients:function(s,r=this.workingColorSpace){return s.fromArray(this.spaces[r].luminanceCoefficients)},define:function(s){Object.assign(this.spaces,s)},_getMatrix:function(s,r,o){return s.copy(this.spaces[r].toXYZ).multiply(this.spaces[o].fromXYZ)},_getDrawingBufferColorSpace:function(s){return this.spaces[s].outputColorSpaceConfig.drawingBufferColorSpace},_getUnpackColorSpace:function(s=this.workingColorSpace){return this.spaces[s].workingColorSpaceConfig.unpackColorSpace},fromWorkingColorSpace:function(s,r){return Zs("ColorManagement: .fromWorkingColorSpace() has been renamed to .workingToColorSpace()."),t.workingToColorSpace(s,r)},toWorkingColorSpace:function(s,r){return Zs("ColorManagement: .toWorkingColorSpace() has been renamed to .colorSpaceToWorking()."),t.colorSpaceToWorking(s,r)}},e=[.64,.33,.3,.6,.15,.06],n=[.2126,.7152,.0722],i=[.3127,.329];return t.define({[_a]:{primaries:e,whitePoint:i,transfer:Sa,toXYZ:Hh,fromXYZ:Vh,luminanceCoefficients:n,workingColorSpaceConfig:{unpackColorSpace:kn},outputColorSpaceConfig:{drawingBufferColorSpace:kn}},[kn]:{primaries:e,whitePoint:i,transfer:Mt,toXYZ:Hh,fromXYZ:Vh,luminanceCoefficients:n,outputColorSpaceConfig:{drawingBufferColorSpace:kn}}}),t}const dt=XR();function Ii(t){return t<.04045?t*.0773993808:Math.pow(t*.9478672986+.0521327014,2.4)}function Xs(t){return t<.0031308?t*12.92:1.055*Math.pow(t,.41666)-.055}let As;class YR{static getDataURL(e,n="image/png"){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement>"u")return e.src;let i;if(e instanceof HTMLCanvasElement)i=e;else{As===void 0&&(As=xa("canvas")),As.width=e.width,As.height=e.height;const s=As.getContext("2d");e instanceof ImageData?s.putImageData(e,0,0):s.drawImage(e,0,0,e.width,e.height),i=As}return i.toDataURL(n)}static sRGBToLinear(e){if(typeof HTMLImageElement<"u"&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&e instanceof ImageBitmap){const n=xa("canvas");n.width=e.width,n.height=e.height;const i=n.getContext("2d");i.drawImage(e,0,0,e.width,e.height);const s=i.getImageData(0,0,e.width,e.height),r=s.data;for(let o=0;o<r.length;o++)r[o]=Ii(r[o]/255)*255;return i.putImageData(s,0,0),n}else if(e.data){const n=e.data.slice(0);for(let i=0;i<n.length;i++)n instanceof Uint8Array||n instanceof Uint8ClampedArray?n[i]=Math.floor(Ii(n[i]/255)*255):n[i]=Ii(n[i]);return{data:n,width:e.width,height:e.height}}else return Ge("ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),e}}let KR=0;class Sd{constructor(e=null){this.isTextureSource=!0,Object.defineProperty(this,"id",{value:KR++}),this.uuid=gr(),this.data=e,this.dataReady=!0,this.version=0}getSize(e){const n=this.data;return typeof HTMLVideoElement<"u"&&n instanceof HTMLVideoElement?e.set(n.videoWidth,n.videoHeight,0):typeof VideoFrame<"u"&&n instanceof VideoFrame?e.set(n.displayWidth,n.displayHeight,0):n!==null?e.set(n.width,n.height,n.depth||0):e.set(0,0,0),e}set needsUpdate(e){e===!0&&this.version++}toJSON(e){const n=e===void 0||typeof e=="string";if(!n&&e.images[this.uuid]!==void 0)return e.images[this.uuid];const i={uuid:this.uuid,url:""},s=this.data;if(s!==null){let r;if(Array.isArray(s)){r=[];for(let o=0,a=s.length;o<a;o++)s[o].isDataTexture?r.push(Tc(s[o].image)):r.push(Tc(s[o]))}else r=Tc(s);i.url=r}return n||(e.images[this.uuid]=i),i}}function Tc(t){return typeof HTMLImageElement<"u"&&t instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&t instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&t instanceof ImageBitmap?YR.getDataURL(t):t.data?{data:Array.from(t.data),width:t.width,height:t.height,type:t.data.constructor.name}:(Ge("Texture: Unable to serialize Texture."),{})}let jR=0;const Rc=new H;class yn extends Qi{constructor(e=yn.DEFAULT_IMAGE,n=yn.DEFAULT_MAPPING,i=Ci,s=Ci,r=pn,o=us,a=Yn,c=Hn,l=yn.DEFAULT_ANISOTROPY,u=Zi){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:jR++}),this.uuid=gr(),this.name="",this.source=new Sd(e),this.mipmaps=[],this.mapping=n,this.channel=0,this.wrapS=i,this.wrapT=s,this.magFilter=r,this.minFilter=o,this.anisotropy=l,this.format=a,this.internalFormat=null,this.type=c,this.offset=new Ke(0,0),this.repeat=new Ke(1,1),this.center=new Ke(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new Ye,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.colorSpace=u,this.userData={},this.updateRanges=[],this.version=0,this.onUpdate=null,this.renderTarget=null,this.isRenderTargetTexture=!1,this.isArrayTexture=!!(e&&e.depth&&e.depth>1),this.pmremVersion=0,this.normalized=!1}get width(){return this.source.getSize(Rc).x}get height(){return this.source.getSize(Rc).y}get depth(){return this.source.getSize(Rc).z}get image(){return this.source.data}set image(e){this.source.data=e}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}addUpdateRange(e,n){this.updateRanges.push({start:e,count:n})}clearUpdateRanges(){this.updateRanges.length=0}clone(){return new this.constructor().copy(this)}copy(e){return this.name=e.name,this.source=e.source,this.mipmaps=e.mipmaps.slice(0),this.mapping=e.mapping,this.channel=e.channel,this.wrapS=e.wrapS,this.wrapT=e.wrapT,this.magFilter=e.magFilter,this.minFilter=e.minFilter,this.anisotropy=e.anisotropy,this.format=e.format,this.internalFormat=e.internalFormat,this.type=e.type,this.normalized=e.normalized,this.offset.copy(e.offset),this.repeat.copy(e.repeat),this.center.copy(e.center),this.rotation=e.rotation,this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrix.copy(e.matrix),this.generateMipmaps=e.generateMipmaps,this.premultiplyAlpha=e.premultiplyAlpha,this.flipY=e.flipY,this.unpackAlignment=e.unpackAlignment,this.colorSpace=e.colorSpace,this.renderTarget=e.renderTarget,this.isRenderTargetTexture=e.isRenderTargetTexture,this.isArrayTexture=e.isArrayTexture,this.userData=JSON.parse(JSON.stringify(e.userData)),this.needsUpdate=!0,this}setValues(e){for(const n in e){const i=e[n];if(i===void 0){Ge(`Texture.setValues(): parameter '${n}' has value of undefined.`);continue}const s=this[n];if(s===void 0){Ge(`Texture.setValues(): property '${n}' does not exist.`);continue}s&&i&&s.isVector2&&i.isVector2||s&&i&&s.isVector3&&i.isVector3||s&&i&&s.isMatrix3&&i.isMatrix3?s.copy(i):this[n]=i}}toJSON(e){const n=e===void 0||typeof e=="string";if(!n&&e.textures[this.uuid]!==void 0)return e.textures[this.uuid];const i={metadata:{version:4.7,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(e).uuid,mapping:this.mapping,channel:this.channel,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,internalFormat:this.internalFormat,type:this.type,normalized:this.normalized,colorSpace:this.colorSpace,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,generateMipmaps:this.generateMipmaps,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};return Object.keys(this.userData).length>0&&(i.userData=this.userData),n||(e.textures[this.uuid]=i),i}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(this.mapping!==D_)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case Tl:e.x=e.x-Math.floor(e.x);break;case Ci:e.x=e.x<0?0:1;break;case Rl:Math.abs(Math.floor(e.x)%2)===1?e.x=Math.ceil(e.x)-e.x:e.x=e.x-Math.floor(e.x);break}if(e.y<0||e.y>1)switch(this.wrapT){case Tl:e.y=e.y-Math.floor(e.y);break;case Ci:e.y=e.y<0?0:1;break;case Rl:Math.abs(Math.floor(e.y)%2)===1?e.y=Math.ceil(e.y)-e.y:e.y=e.y-Math.floor(e.y);break}return this.flipY&&(e.y=1-e.y),e}set needsUpdate(e){e===!0&&(this.version++,this.source.needsUpdate=!0)}set needsPMREMUpdate(e){e===!0&&this.pmremVersion++}}yn.DEFAULT_IMAGE=null;yn.DEFAULT_MAPPING=D_;yn.DEFAULT_ANISOTROPY=1;const Cd=class Cd{constructor(e=0,n=0,i=0,s=1){this.x=e,this.y=n,this.z=i,this.w=s}get width(){return this.z}set width(e){this.z=e}get height(){return this.w}set height(e){this.w=e}set(e,n,i,s){return this.x=e,this.y=n,this.z=i,this.w=s,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this.w=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setW(e){return this.w=e,this}setComponent(e,n){switch(e){case 0:this.x=n;break;case 1:this.y=n;break;case 2:this.z=n;break;case 3:this.w=n;break;default:throw new Error("THREE.Vector4: index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("THREE.Vector4: index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w!==void 0?e.w:1,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this}addVectors(e,n){return this.x=e.x+n.x,this.y=e.y+n.y,this.z=e.z+n.z,this.w=e.w+n.w,this}addScaledVector(e,n){return this.x+=e.x*n,this.y+=e.y*n,this.z+=e.z*n,this.w+=e.w*n,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this}subVectors(e,n){return this.x=e.x-n.x,this.y=e.y-n.y,this.z=e.z-n.z,this.w=e.w-n.w,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}applyMatrix4(e){const n=this.x,i=this.y,s=this.z,r=this.w,o=e.elements;return this.x=o[0]*n+o[4]*i+o[8]*s+o[12]*r,this.y=o[1]*n+o[5]*i+o[9]*s+o[13]*r,this.z=o[2]*n+o[6]*i+o[10]*s+o[14]*r,this.w=o[3]*n+o[7]*i+o[11]*s+o[15]*r,this}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this.w/=e.w,this}divideScalar(e){return this.multiplyScalar(1/e)}setAxisAngleFromQuaternion(e){this.w=2*Math.acos(e.w);const n=Math.sqrt(1-e.w*e.w);return n<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/n,this.y=e.y/n,this.z=e.z/n),this}setAxisAngleFromRotationMatrix(e){let n,i,s,r;const c=e.elements,l=c[0],u=c[4],h=c[8],d=c[1],f=c[5],_=c[9],x=c[2],m=c[6],p=c[10];if(Math.abs(u-d)<.01&&Math.abs(h-x)<.01&&Math.abs(_-m)<.01){if(Math.abs(u+d)<.1&&Math.abs(h+x)<.1&&Math.abs(_+m)<.1&&Math.abs(l+f+p-3)<.1)return this.set(1,0,0,0),this;n=Math.PI;const L=(l+1)/2,b=(f+1)/2,w=(p+1)/2,A=(u+d)/4,P=(h+x)/4,v=(_+m)/4;return L>b&&L>w?L<.01?(i=0,s=.707106781,r=.707106781):(i=Math.sqrt(L),s=A/i,r=P/i):b>w?b<.01?(i=.707106781,s=0,r=.707106781):(s=Math.sqrt(b),i=A/s,r=v/s):w<.01?(i=.707106781,s=.707106781,r=0):(r=Math.sqrt(w),i=P/r,s=v/r),this.set(i,s,r,n),this}let E=Math.sqrt((m-_)*(m-_)+(h-x)*(h-x)+(d-u)*(d-u));return Math.abs(E)<.001&&(E=1),this.x=(m-_)/E,this.y=(h-x)/E,this.z=(d-u)/E,this.w=Math.acos((l+f+p-1)/2),this}setFromMatrixPosition(e){const n=e.elements;return this.x=n[12],this.y=n[13],this.z=n[14],this.w=n[15],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this.w=Math.min(this.w,e.w),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this.w=Math.max(this.w,e.w),this}clamp(e,n){return this.x=st(this.x,e.x,n.x),this.y=st(this.y,e.y,n.y),this.z=st(this.z,e.z,n.z),this.w=st(this.w,e.w,n.w),this}clampScalar(e,n){return this.x=st(this.x,e,n),this.y=st(this.y,e,n),this.z=st(this.z,e,n),this.w=st(this.w,e,n),this}clampLength(e,n){const i=this.length();return this.divideScalar(i||1).multiplyScalar(st(i,e,n))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this.w=Math.trunc(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,n){return this.x+=(e.x-this.x)*n,this.y+=(e.y-this.y)*n,this.z+=(e.z-this.z)*n,this.w+=(e.w-this.w)*n,this}lerpVectors(e,n,i){return this.x=e.x+(n.x-e.x)*i,this.y=e.y+(n.y-e.y)*i,this.z=e.z+(n.z-e.z)*i,this.w=e.w+(n.w-e.w)*i,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w}fromArray(e,n=0){return this.x=e[n],this.y=e[n+1],this.z=e[n+2],this.w=e[n+3],this}toArray(e=[],n=0){return e[n]=this.x,e[n+1]=this.y,e[n+2]=this.z,e[n+3]=this.w,e}fromBufferAttribute(e,n){return this.x=e.getX(n),this.y=e.getY(n),this.z=e.getZ(n),this.w=e.getW(n),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}};Cd.prototype.isVector4=!0;let Ht=Cd;class JR extends Qi{constructor(e=1,n=1,i={}){super(),i=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:pn,depthBuffer:!0,stencilBuffer:!1,resolveColorBuffer:!0,resolveDepthBuffer:!0,resolveStencilBuffer:!0,storeMultisampledColorBuffer:!0,storeMultisampledDepthBuffer:!0,storeMultisampledStencilBuffer:!0,depthTexture:null,samples:0,count:1,depth:1,multiview:!1,useArrayDepthTexture:!1},i),this.isRenderTarget=!0,this.width=e,this.height=n,this.depth=i.depth,this.scissor=new Ht(0,0,e,n),this.scissorTest=!1,this.viewport=new Ht(0,0,e,n),this.textures=[];const s={width:e,height:n,depth:i.depth},r=new yn(s),o=i.count;for(let a=0;a<o;a++)this.textures[a]=r.clone(),this.textures[a].isRenderTargetTexture=!0,this.textures[a].renderTarget=this;this._setTextureOptions(i),this.depthBuffer=i.depthBuffer,this.stencilBuffer=i.stencilBuffer,this.resolveColorBuffer=i.resolveColorBuffer,this.resolveDepthBuffer=i.resolveDepthBuffer,this.resolveStencilBuffer=i.resolveStencilBuffer,this.storeMultisampledColorBuffer=i.storeMultisampledColorBuffer,this.storeMultisampledDepthBuffer=i.storeMultisampledDepthBuffer,this.storeMultisampledStencilBuffer=i.storeMultisampledStencilBuffer,this._depthTexture=null,this.depthTexture=i.depthTexture,this.samples=i.samples,this.multiview=i.multiview,this.useArrayDepthTexture=i.useArrayDepthTexture}_setTextureOptions(e={}){const n={minFilter:pn,generateMipmaps:!1,flipY:!1,internalFormat:null};e.mapping!==void 0&&(n.mapping=e.mapping),e.wrapS!==void 0&&(n.wrapS=e.wrapS),e.wrapT!==void 0&&(n.wrapT=e.wrapT),e.wrapR!==void 0&&(n.wrapR=e.wrapR),e.magFilter!==void 0&&(n.magFilter=e.magFilter),e.minFilter!==void 0&&(n.minFilter=e.minFilter),e.format!==void 0&&(n.format=e.format),e.type!==void 0&&(n.type=e.type),e.anisotropy!==void 0&&(n.anisotropy=e.anisotropy),e.colorSpace!==void 0&&(n.colorSpace=e.colorSpace),e.flipY!==void 0&&(n.flipY=e.flipY),e.generateMipmaps!==void 0&&(n.generateMipmaps=e.generateMipmaps),e.internalFormat!==void 0&&(n.internalFormat=e.internalFormat);for(let i=0;i<this.textures.length;i++)this.textures[i].setValues(n)}get texture(){return this.textures[0]}set texture(e){this.textures[0]=e}set depthTexture(e){this._depthTexture!==null&&this._depthTexture.renderTarget===this&&(this._depthTexture.renderTarget=null),e!==null&&e.renderTarget===null&&(e.renderTarget=this),this._depthTexture=e}get depthTexture(){return this._depthTexture}setSize(e,n,i=1){if(this.width!==e||this.height!==n||this.depth!==i){this.width=e,this.height=n,this.depth=i;for(let s=0,r=this.textures.length;s<r;s++)this.textures[s].image.width=e,this.textures[s].image.height=n,this.textures[s].image.depth=i,this.textures[s].isData3DTexture!==!0&&(this.textures[s].isArrayTexture=this.textures[s].image.depth>1);this.dispose()}this.viewport.set(0,0,e,n),this.scissor.set(0,0,e,n)}clone(){return new this.constructor().copy(this)}copy(e){this.width=e.width,this.height=e.height,this.depth=e.depth,this.scissor.copy(e.scissor),this.scissorTest=e.scissorTest,this.viewport.copy(e.viewport),this.textures.length=0;for(let n=0,i=e.textures.length;n<i;n++){this.textures[n]=e.textures[n].clone(),this.textures[n].isRenderTargetTexture=!0,this.textures[n].renderTarget=this;const s=Object.assign({},e.textures[n].image);this.textures[n].source=new Sd(s)}if(this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,this.resolveColorBuffer=e.resolveColorBuffer,this.resolveDepthBuffer=e.resolveDepthBuffer,this.resolveStencilBuffer=e.resolveStencilBuffer,this.storeMultisampledColorBuffer=e.storeMultisampledColorBuffer,this.storeMultisampledDepthBuffer=e.storeMultisampledDepthBuffer,this.storeMultisampledStencilBuffer=e.storeMultisampledStencilBuffer,e.depthTexture!==null)if(e.depthTexture.renderTarget===e){const n=e.depthTexture.clone();n.renderTarget=null,this.depthTexture=n}else this.depthTexture=e.depthTexture;return this.samples=e.samples,this.multiview=e.multiview,this.useArrayDepthTexture=e.useArrayDepthTexture,this}dispose(){this.dispatchEvent({type:"dispose"})}}class Kn extends JR{constructor(e=1,n=1,i={}){super(e,n,i),this.isWebGLRenderTarget=!0}}class q_ extends yn{constructor(e=null,n=1,i=1,s=1){super(null),this.isDataArrayTexture=!0,this.image={data:e,width:n,height:i,depth:s},this.magFilter=on,this.minFilter=on,this.wrapR=Ci,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.layerUpdates=new Set}copy(e){return super.copy(e),this.wrapR=e.wrapR,this}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}}class QR extends yn{constructor(e=null,n=1,i=1,s=1){super(null),this.isData3DTexture=!0,this.image={data:e,width:n,height:i,depth:s},this.magFilter=on,this.minFilter=on,this.wrapR=Ci,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}copy(e){return super.copy(e),this.wrapR=e.wrapR,this}}const Ca=class Ca{constructor(e,n,i,s,r,o,a,c,l,u,h,d,f,_,x,m){this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],e!==void 0&&this.set(e,n,i,s,r,o,a,c,l,u,h,d,f,_,x,m)}set(e,n,i,s,r,o,a,c,l,u,h,d,f,_,x,m){const p=this.elements;return p[0]=e,p[4]=n,p[8]=i,p[12]=s,p[1]=r,p[5]=o,p[9]=a,p[13]=c,p[2]=l,p[6]=u,p[10]=h,p[14]=d,p[3]=f,p[7]=_,p[11]=x,p[15]=m,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return new Ca().fromArray(this.elements)}copy(e){const n=this.elements,i=e.elements;return n[0]=i[0],n[1]=i[1],n[2]=i[2],n[3]=i[3],n[4]=i[4],n[5]=i[5],n[6]=i[6],n[7]=i[7],n[8]=i[8],n[9]=i[9],n[10]=i[10],n[11]=i[11],n[12]=i[12],n[13]=i[13],n[14]=i[14],n[15]=i[15],this}copyPosition(e){const n=this.elements,i=e.elements;return n[12]=i[12],n[13]=i[13],n[14]=i[14],this}setFromMatrix3(e){const n=e.elements;return this.set(n[0],n[3],n[6],0,n[1],n[4],n[7],0,n[2],n[5],n[8],0,0,0,0,1),this}extractBasis(e,n,i){return this.determinantAffine()===0?(e.set(1,0,0),n.set(0,1,0),i.set(0,0,1),this):(e.setFromMatrixColumn(this,0),n.setFromMatrixColumn(this,1),i.setFromMatrixColumn(this,2),this)}makeBasis(e,n,i){return this.set(e.x,n.x,i.x,0,e.y,n.y,i.y,0,e.z,n.z,i.z,0,0,0,0,1),this}extractRotation(e){if(e.determinantAffine()===0)return this.identity();const n=this.elements,i=e.elements,s=1/Cs.setFromMatrixColumn(e,0).length(),r=1/Cs.setFromMatrixColumn(e,1).length(),o=1/Cs.setFromMatrixColumn(e,2).length();return n[0]=i[0]*s,n[1]=i[1]*s,n[2]=i[2]*s,n[3]=0,n[4]=i[4]*r,n[5]=i[5]*r,n[6]=i[6]*r,n[7]=0,n[8]=i[8]*o,n[9]=i[9]*o,n[10]=i[10]*o,n[11]=0,n[12]=0,n[13]=0,n[14]=0,n[15]=1,this}makeRotationFromEuler(e){const n=this.elements,i=e.x,s=e.y,r=e.z,o=Math.cos(i),a=Math.sin(i),c=Math.cos(s),l=Math.sin(s),u=Math.cos(r),h=Math.sin(r);if(e.order==="XYZ"){const d=o*u,f=o*h,_=a*u,x=a*h;n[0]=c*u,n[4]=-c*h,n[8]=l,n[1]=f+_*l,n[5]=d-x*l,n[9]=-a*c,n[2]=x-d*l,n[6]=_+f*l,n[10]=o*c}else if(e.order==="YXZ"){const d=c*u,f=c*h,_=l*u,x=l*h;n[0]=d+x*a,n[4]=_*a-f,n[8]=o*l,n[1]=o*h,n[5]=o*u,n[9]=-a,n[2]=f*a-_,n[6]=x+d*a,n[10]=o*c}else if(e.order==="ZXY"){const d=c*u,f=c*h,_=l*u,x=l*h;n[0]=d-x*a,n[4]=-o*h,n[8]=_+f*a,n[1]=f+_*a,n[5]=o*u,n[9]=x-d*a,n[2]=-o*l,n[6]=a,n[10]=o*c}else if(e.order==="ZYX"){const d=o*u,f=o*h,_=a*u,x=a*h;n[0]=c*u,n[4]=_*l-f,n[8]=d*l+x,n[1]=c*h,n[5]=x*l+d,n[9]=f*l-_,n[2]=-l,n[6]=a*c,n[10]=o*c}else if(e.order==="YZX"){const d=o*c,f=o*l,_=a*c,x=a*l;n[0]=c*u,n[4]=x-d*h,n[8]=_*h+f,n[1]=h,n[5]=o*u,n[9]=-a*u,n[2]=-l*u,n[6]=f*h+_,n[10]=d-x*h}else if(e.order==="XZY"){const d=o*c,f=o*l,_=a*c,x=a*l;n[0]=c*u,n[4]=-h,n[8]=l*u,n[1]=d*h+x,n[5]=o*u,n[9]=f*h-_,n[2]=_*h-f,n[6]=a*u,n[10]=x*h+d}return n[3]=0,n[7]=0,n[11]=0,n[12]=0,n[13]=0,n[14]=0,n[15]=1,this}makeRotationFromQuaternion(e){return this.compose(ew,e,tw)}lookAt(e,n,i){const s=this.elements;return Ln.subVectors(e,n),Ln.lengthSq()===0&&(Ln.z=1),Ln.normalize(),Hi.crossVectors(i,Ln),Hi.lengthSq()===0&&(Math.abs(i.z)===1?Ln.x+=1e-4:Ln.z+=1e-4,Ln.normalize(),Hi.crossVectors(i,Ln)),Hi.normalize(),bo.crossVectors(Ln,Hi),s[0]=Hi.x,s[4]=bo.x,s[8]=Ln.x,s[1]=Hi.y,s[5]=bo.y,s[9]=Ln.y,s[2]=Hi.z,s[6]=bo.z,s[10]=Ln.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,n){const i=e.elements,s=n.elements,r=this.elements,o=i[0],a=i[4],c=i[8],l=i[12],u=i[1],h=i[5],d=i[9],f=i[13],_=i[2],x=i[6],m=i[10],p=i[14],E=i[3],L=i[7],b=i[11],w=i[15],A=s[0],P=s[4],v=s[8],T=s[12],I=s[1],N=s[5],k=s[9],$=s[13],U=s[2],V=s[6],Q=s[10],X=s[14],ce=s[3],j=s[7],se=s[11],oe=s[15];return r[0]=o*A+a*I+c*U+l*ce,r[4]=o*P+a*N+c*V+l*j,r[8]=o*v+a*k+c*Q+l*se,r[12]=o*T+a*$+c*X+l*oe,r[1]=u*A+h*I+d*U+f*ce,r[5]=u*P+h*N+d*V+f*j,r[9]=u*v+h*k+d*Q+f*se,r[13]=u*T+h*$+d*X+f*oe,r[2]=_*A+x*I+m*U+p*ce,r[6]=_*P+x*N+m*V+p*j,r[10]=_*v+x*k+m*Q+p*se,r[14]=_*T+x*$+m*X+p*oe,r[3]=E*A+L*I+b*U+w*ce,r[7]=E*P+L*N+b*V+w*j,r[11]=E*v+L*k+b*Q+w*se,r[15]=E*T+L*$+b*X+w*oe,this}multiplyScalar(e){const n=this.elements;return n[0]*=e,n[4]*=e,n[8]*=e,n[12]*=e,n[1]*=e,n[5]*=e,n[9]*=e,n[13]*=e,n[2]*=e,n[6]*=e,n[10]*=e,n[14]*=e,n[3]*=e,n[7]*=e,n[11]*=e,n[15]*=e,this}determinant(){const e=this.elements,n=e[0],i=e[4],s=e[8],r=e[12],o=e[1],a=e[5],c=e[9],l=e[13],u=e[2],h=e[6],d=e[10],f=e[14],_=e[3],x=e[7],m=e[11],p=e[15],E=c*f-l*d,L=a*f-l*h,b=a*d-c*h,w=o*f-l*u,A=o*d-c*u,P=o*h-a*u;return n*(x*E-m*L+p*b)-i*(_*E-m*w+p*A)+s*(_*L-x*w+p*P)-r*(_*b-x*A+m*P)}determinantAffine(){const e=this.elements,n=e[0],i=e[4],s=e[8],r=e[1],o=e[5],a=e[9],c=e[2],l=e[6],u=e[10];return n*(o*u-a*l)-i*(r*u-a*c)+s*(r*l-o*c)}transpose(){const e=this.elements;let n;return n=e[1],e[1]=e[4],e[4]=n,n=e[2],e[2]=e[8],e[8]=n,n=e[6],e[6]=e[9],e[9]=n,n=e[3],e[3]=e[12],e[12]=n,n=e[7],e[7]=e[13],e[13]=n,n=e[11],e[11]=e[14],e[14]=n,this}setPosition(e,n,i){const s=this.elements;return e.isVector3?(s[12]=e.x,s[13]=e.y,s[14]=e.z):(s[12]=e,s[13]=n,s[14]=i),this}invert(){const e=this.elements,n=e[0],i=e[1],s=e[2],r=e[3],o=e[4],a=e[5],c=e[6],l=e[7],u=e[8],h=e[9],d=e[10],f=e[11],_=e[12],x=e[13],m=e[14],p=e[15],E=n*a-i*o,L=n*c-s*o,b=n*l-r*o,w=i*c-s*a,A=i*l-r*a,P=s*l-r*c,v=u*x-h*_,T=u*m-d*_,I=u*p-f*_,N=h*m-d*x,k=h*p-f*x,$=d*p-f*m,U=E*$-L*k+b*N+w*I-A*T+P*v;if(U===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const V=1/U;return e[0]=(a*$-c*k+l*N)*V,e[1]=(s*k-i*$-r*N)*V,e[2]=(x*P-m*A+p*w)*V,e[3]=(d*A-h*P-f*w)*V,e[4]=(c*I-o*$-l*T)*V,e[5]=(n*$-s*I+r*T)*V,e[6]=(m*b-_*P-p*L)*V,e[7]=(u*P-d*b+f*L)*V,e[8]=(o*k-a*I+l*v)*V,e[9]=(i*I-n*k-r*v)*V,e[10]=(_*A-x*b+p*E)*V,e[11]=(h*b-u*A-f*E)*V,e[12]=(a*T-o*N-c*v)*V,e[13]=(n*N-i*T+s*v)*V,e[14]=(x*L-_*w-m*E)*V,e[15]=(u*w-h*L+d*E)*V,this}scale(e){const n=this.elements,i=e.x,s=e.y,r=e.z;return n[0]*=i,n[4]*=s,n[8]*=r,n[1]*=i,n[5]*=s,n[9]*=r,n[2]*=i,n[6]*=s,n[10]*=r,n[3]*=i,n[7]*=s,n[11]*=r,this}getMaxScaleOnAxis(){const e=this.elements,n=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],i=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],s=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(n,i,s))}makeTranslation(e,n,i){return e.isVector3?this.set(1,0,0,e.x,0,1,0,e.y,0,0,1,e.z,0,0,0,1):this.set(1,0,0,e,0,1,0,n,0,0,1,i,0,0,0,1),this}makeRotationX(e){const n=Math.cos(e),i=Math.sin(e);return this.set(1,0,0,0,0,n,-i,0,0,i,n,0,0,0,0,1),this}makeRotationY(e){const n=Math.cos(e),i=Math.sin(e);return this.set(n,0,i,0,0,1,0,0,-i,0,n,0,0,0,0,1),this}makeRotationZ(e){const n=Math.cos(e),i=Math.sin(e);return this.set(n,-i,0,0,i,n,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,n){const i=Math.cos(n),s=Math.sin(n),r=1-i,o=e.x,a=e.y,c=e.z,l=r*o,u=r*a;return this.set(l*o+i,l*a-s*c,l*c+s*a,0,l*a+s*c,u*a+i,u*c-s*o,0,l*c-s*a,u*c+s*o,r*c*c+i,0,0,0,0,1),this}makeScale(e,n,i){return this.set(e,0,0,0,0,n,0,0,0,0,i,0,0,0,0,1),this}makeShear(e,n,i,s,r,o){return this.set(1,i,r,0,e,1,o,0,n,s,1,0,0,0,0,1),this}compose(e,n,i){const s=this.elements,r=n._x,o=n._y,a=n._z,c=n._w,l=r+r,u=o+o,h=a+a,d=r*l,f=r*u,_=r*h,x=o*u,m=o*h,p=a*h,E=c*l,L=c*u,b=c*h,w=i.x,A=i.y,P=i.z;return s[0]=(1-(x+p))*w,s[1]=(f+b)*w,s[2]=(_-L)*w,s[3]=0,s[4]=(f-b)*A,s[5]=(1-(d+p))*A,s[6]=(m+E)*A,s[7]=0,s[8]=(_+L)*P,s[9]=(m-E)*P,s[10]=(1-(d+x))*P,s[11]=0,s[12]=e.x,s[13]=e.y,s[14]=e.z,s[15]=1,this}decompose(e,n,i){const s=this.elements;e.x=s[12],e.y=s[13],e.z=s[14];const r=this.determinantAffine();if(r===0)return i.set(1,1,1),n.identity(),this;let o=Cs.set(s[0],s[1],s[2]).length();const a=Cs.set(s[4],s[5],s[6]).length(),c=Cs.set(s[8],s[9],s[10]).length();r<0&&(o=-o),$n.copy(this);const l=1/o,u=1/a,h=1/c;return $n.elements[0]*=l,$n.elements[1]*=l,$n.elements[2]*=l,$n.elements[4]*=u,$n.elements[5]*=u,$n.elements[6]*=u,$n.elements[8]*=h,$n.elements[9]*=h,$n.elements[10]*=h,n.setFromRotationMatrix($n),i.x=o,i.y=a,i.z=c,this}makePerspective(e,n,i,s,r,o,a=di,c=!1){const l=this.elements,u=2*r/(n-e),h=2*r/(i-s),d=(n+e)/(n-e),f=(i+s)/(i-s);let _,x;if(c)_=r/(o-r),x=o*r/(o-r);else if(a===di)_=-(o+r)/(o-r),x=-2*o*r/(o-r);else if(a===va)_=-o/(o-r),x=-o*r/(o-r);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+a);return l[0]=u,l[4]=0,l[8]=d,l[12]=0,l[1]=0,l[5]=h,l[9]=f,l[13]=0,l[2]=0,l[6]=0,l[10]=_,l[14]=x,l[3]=0,l[7]=0,l[11]=-1,l[15]=0,this}makeOrthographic(e,n,i,s,r,o,a=di,c=!1){const l=this.elements,u=2/(n-e),h=2/(i-s),d=-(n+e)/(n-e),f=-(i+s)/(i-s);let _,x;if(c)_=1/(o-r),x=o/(o-r);else if(a===di)_=-2/(o-r),x=-(o+r)/(o-r);else if(a===va)_=-1/(o-r),x=-r/(o-r);else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+a);return l[0]=u,l[4]=0,l[8]=0,l[12]=d,l[1]=0,l[5]=h,l[9]=0,l[13]=f,l[2]=0,l[6]=0,l[10]=_,l[14]=x,l[3]=0,l[7]=0,l[11]=0,l[15]=1,this}equals(e){const n=this.elements,i=e.elements;for(let s=0;s<16;s++)if(n[s]!==i[s])return!1;return!0}fromArray(e,n=0){for(let i=0;i<16;i++)this.elements[i]=e[i+n];return this}toArray(e=[],n=0){const i=this.elements;return e[n]=i[0],e[n+1]=i[1],e[n+2]=i[2],e[n+3]=i[3],e[n+4]=i[4],e[n+5]=i[5],e[n+6]=i[6],e[n+7]=i[7],e[n+8]=i[8],e[n+9]=i[9],e[n+10]=i[10],e[n+11]=i[11],e[n+12]=i[12],e[n+13]=i[13],e[n+14]=i[14],e[n+15]=i[15],e}};Ca.prototype.isMatrix4=!0;let Gt=Ca;const Cs=new H,$n=new Gt,ew=new H(0,0,0),tw=new H(1,1,1),Hi=new H,bo=new H,Ln=new H,Gh=new Gt,qh=new ji;class bs{constructor(e=0,n=0,i=0,s=bs.DEFAULT_ORDER){this.isEuler=!0,this._x=e,this._y=n,this._z=i,this._order=s}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get order(){return this._order}set order(e){this._order=e,this._onChangeCallback()}set(e,n,i,s=this._order){return this._x=e,this._y=n,this._z=i,this._order=s,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this}setFromRotationMatrix(e,n=this._order,i=!0){const s=e.elements,r=s[0],o=s[4],a=s[8],c=s[1],l=s[5],u=s[9],h=s[2],d=s[6],f=s[10];switch(n){case"XYZ":this._y=Math.asin(st(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(-u,f),this._z=Math.atan2(-o,r)):(this._x=Math.atan2(d,l),this._z=0);break;case"YXZ":this._x=Math.asin(-st(u,-1,1)),Math.abs(u)<.9999999?(this._y=Math.atan2(a,f),this._z=Math.atan2(c,l)):(this._y=Math.atan2(-h,r),this._z=0);break;case"ZXY":this._x=Math.asin(st(d,-1,1)),Math.abs(d)<.9999999?(this._y=Math.atan2(-h,f),this._z=Math.atan2(-o,l)):(this._y=0,this._z=Math.atan2(c,r));break;case"ZYX":this._y=Math.asin(-st(h,-1,1)),Math.abs(h)<.9999999?(this._x=Math.atan2(d,f),this._z=Math.atan2(c,r)):(this._x=0,this._z=Math.atan2(-o,l));break;case"YZX":this._z=Math.asin(st(c,-1,1)),Math.abs(c)<.9999999?(this._x=Math.atan2(-u,l),this._y=Math.atan2(-h,r)):(this._x=0,this._y=Math.atan2(a,f));break;case"XZY":this._z=Math.asin(-st(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(d,l),this._y=Math.atan2(a,r)):(this._x=Math.atan2(-u,f),this._y=0);break;default:Ge("Euler: .setFromRotationMatrix() encountered an unknown order: "+n)}return this._order=n,i===!0&&this._onChangeCallback(),this}setFromQuaternion(e,n,i){return Gh.makeRotationFromQuaternion(e),this.setFromRotationMatrix(Gh,n,i)}setFromVector3(e,n=this._order){return this.set(e.x,e.y,e.z,n)}reorder(e){return qh.setFromEuler(this),this.setFromQuaternion(qh,e)}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order}fromArray(e){return this._x=e[0],this._y=e[1],this._z=e[2],e[3]!==void 0&&(this._order=e[3]),this._onChangeCallback(),this}toArray(e=[],n=0){return e[n]=this._x,e[n+1]=this._y,e[n+2]=this._z,e[n+3]=this._order,e}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}}bs.DEFAULT_ORDER="XYZ";class $_{constructor(){this.mask=1}set(e){this.mask=(1<<e|0)>>>0}enable(e){this.mask|=1<<e|0}enableAll(){this.mask=-1}toggle(e){this.mask^=1<<e|0}disable(e){this.mask&=~(1<<e|0)}disableAll(){this.mask=0}test(e){return(this.mask&e.mask)!==0}isEnabled(e){return(this.mask&(1<<e|0))!==0}}let nw=0;const $h=new H,Ps=new ji,xi=new Gt,Mo=new H,br=new H,iw=new H,sw=new ji,Wh=new H(1,0,0),Zh=new H(0,1,0),Xh=new H(0,0,1),Yh={type:"added"},rw={type:"removed"},Is={type:"childadded",child:null},wc={type:"childremoved",child:null};class bn extends Qi{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:nw++}),this.uuid=gr(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=bn.DEFAULT_UP.clone();const e=new H,n=new bs,i=new ji,s=new H(1,1,1);function r(){i.setFromEuler(n,!1)}function o(){n.setFromQuaternion(i,void 0,!1)}n._onChange(r),i._onChange(o),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:e},rotation:{configurable:!0,enumerable:!0,value:n},quaternion:{configurable:!0,enumerable:!0,value:i},scale:{configurable:!0,enumerable:!0,value:s},modelViewMatrix:{value:new Gt},normalMatrix:{value:new Ye}}),this.matrix=new Gt,this.matrixWorld=new Gt,this.matrixAutoUpdate=bn.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=bn.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new $_,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.customDepthMaterial=void 0,this.customDistanceMaterial=void 0,this.static=!1,this.userData={},this.pivot=null}onBeforeShadow(){}onAfterShadow(){}onBeforeRender(){}onAfterRender(){}applyMatrix4(e){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(e),this.matrix.decompose(this.position,this.quaternion,this.scale)}applyQuaternion(e){return this.quaternion.premultiply(e),this}setRotationFromAxisAngle(e,n){this.quaternion.setFromAxisAngle(e,n)}setRotationFromEuler(e){this.quaternion.setFromEuler(e,!0)}setRotationFromMatrix(e){this.quaternion.setFromRotationMatrix(e)}setRotationFromQuaternion(e){this.quaternion.copy(e)}rotateOnAxis(e,n){return Ps.setFromAxisAngle(e,n),this.quaternion.multiply(Ps),this}rotateOnWorldAxis(e,n){return Ps.setFromAxisAngle(e,n),this.quaternion.premultiply(Ps),this}rotateX(e){return this.rotateOnAxis(Wh,e)}rotateY(e){return this.rotateOnAxis(Zh,e)}rotateZ(e){return this.rotateOnAxis(Xh,e)}translateOnAxis(e,n){return $h.copy(e).applyQuaternion(this.quaternion),this.position.add($h.multiplyScalar(n)),this}translateX(e){return this.translateOnAxis(Wh,e)}translateY(e){return this.translateOnAxis(Zh,e)}translateZ(e){return this.translateOnAxis(Xh,e)}localToWorld(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(this.matrixWorld)}worldToLocal(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(xi.copy(this.matrixWorld).invert())}lookAt(e,n,i){e.isVector3?Mo.copy(e):Mo.set(e,n,i);const s=this.parent;this.updateWorldMatrix(!0,!1),br.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?xi.lookAt(br,Mo,this.up):xi.lookAt(Mo,br,this.up),this.quaternion.setFromRotationMatrix(xi),s&&(xi.extractRotation(s.matrixWorld),Ps.setFromRotationMatrix(xi),this.quaternion.premultiply(Ps.invert()))}add(e){if(arguments.length>1){for(let n=0;n<arguments.length;n++)this.add(arguments[n]);return this}return e===this?(St("Object3D.add: object can't be added as a child of itself.",e),this):(e&&e.isObject3D?(e.removeFromParent(),e.parent=this,this.children.push(e),e.dispatchEvent(Yh),Is.child=e,this.dispatchEvent(Is),Is.child=null):St("Object3D.add: object not an instance of THREE.Object3D.",e),this)}remove(e){if(arguments.length>1){for(let i=0;i<arguments.length;i++)this.remove(arguments[i]);return this}const n=this.children.indexOf(e);return n!==-1&&(e.parent=null,this.children.splice(n,1),e.dispatchEvent(rw),wc.child=e,this.dispatchEvent(wc),wc.child=null),this}removeFromParent(){const e=this.parent;return e!==null&&e.remove(this),this}clear(){return this.remove(...this.children)}attach(e){return this.updateWorldMatrix(!0,!1),xi.copy(this.matrixWorld).invert(),e.parent!==null&&(e.parent.updateWorldMatrix(!0,!1),xi.multiply(e.parent.matrixWorld)),e.applyMatrix4(xi),e.removeFromParent(),e.parent=this,this.children.push(e),e.updateWorldMatrix(!1,!0),e.dispatchEvent(Yh),Is.child=e,this.dispatchEvent(Is),Is.child=null,this}getObjectById(e){return this.getObjectByProperty("id",e)}getObjectByName(e){return this.getObjectByProperty("name",e)}getObjectByProperty(e,n){if(this[e]===n)return this;for(let i=0,s=this.children.length;i<s;i++){const o=this.children[i].getObjectByProperty(e,n);if(o!==void 0)return o}}getObjectsByProperty(e,n,i=[]){this[e]===n&&i.push(this);const s=this.children;for(let r=0,o=s.length;r<o;r++)s[r].getObjectsByProperty(e,n,i);return i}getWorldPosition(e){return this.updateWorldMatrix(!0,!1),e.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(br,e,iw),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(br,sw,e),e}getWorldDirection(e){this.updateWorldMatrix(!0,!1);const n=this.matrixWorld.elements;return e.set(n[8],n[9],n[10]).normalize()}raycast(){}intersectsFrustum(){}traverse(e){e(this);const n=this.children;for(let i=0,s=n.length;i<s;i++)n[i].traverse(e)}traverseVisible(e){if(this.visible===!1)return;e(this);const n=this.children;for(let i=0,s=n.length;i<s;i++)n[i].traverseVisible(e)}traverseAncestors(e){const n=this.parent;n!==null&&(e(n),n.traverseAncestors(e))}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale);const e=this.pivot;if(e!==null){const n=e.x,i=e.y,s=e.z,r=this.matrix.elements;r[12]+=n-r[0]*n-r[4]*i-r[8]*s,r[13]+=i-r[1]*n-r[5]*i-r[9]*s,r[14]+=s-r[2]*n-r[6]*i-r[10]*s}this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(e){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||e)&&(this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),this.matrixWorldNeedsUpdate=!1,e=!0);const n=this.children;for(let i=0,s=n.length;i<s;i++)n[i].updateMatrixWorld(e)}updateWorldMatrix(e,n,i=!1){const s=this.parent;if(e===!0&&s!==null&&s.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||i)&&(this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),this.matrixWorldNeedsUpdate=!1,i=!0),n===!0){const r=this.children;for(let o=0,a=r.length;o<a;o++)r[o].updateWorldMatrix(!1,!0,i)}}toJSON(e){const n=e===void 0||typeof e=="string",i={};n&&(e={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},i.metadata={version:4.7,type:"Object",generator:"Object3D.toJSON"});const s={};s.uuid=this.uuid,s.type=this.type,s.name=this.name,s.castShadow=this.castShadow,s.receiveShadow=this.receiveShadow,s.visible=this.visible,s.frustumCulled=this.frustumCulled,s.renderOrder=this.renderOrder,s.static=this.static,s.matrixAutoUpdate=this.matrixAutoUpdate,Object.keys(this.userData).length>0&&(s.userData=this.userData),s.layers=this.layers.mask,s.matrix=this.matrix.toArray(),s.up=this.up.toArray(),this.pivot!==null&&(s.pivot=this.pivot.toArray()),this.morphTargetDictionary!==void 0&&(s.morphTargetDictionary=Object.assign({},this.morphTargetDictionary)),this.morphTargetInfluences!==void 0&&(s.morphTargetInfluences=this.morphTargetInfluences.slice()),this.isInstancedMesh&&(s.type="InstancedMesh",s.count=this.count,s.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(s.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(s.type="BatchedMesh",s.perObjectFrustumCulled=this.perObjectFrustumCulled,s.sortObjects=this.sortObjects,s.drawRanges=this._drawRanges,s.reservedRanges=this._reservedRanges,s.geometryInfo=this._geometryInfo.map(a=>({...a,boundingBox:a.boundingBox?a.boundingBox.toJSON():void 0,boundingSphere:a.boundingSphere?a.boundingSphere.toJSON():void 0})),s.instanceInfo=this._instanceInfo.map(a=>({...a})),s.availableInstanceIds=this._availableInstanceIds.slice(),s.availableGeometryIds=this._availableGeometryIds.slice(),s.nextIndexStart=this._nextIndexStart,s.nextVertexStart=this._nextVertexStart,s.geometryCount=this._geometryCount,s.maxInstanceCount=this._maxInstanceCount,s.maxVertexCount=this._maxVertexCount,s.maxIndexCount=this._maxIndexCount,s.geometryInitialized=this._geometryInitialized,s.matricesTexture=this._matricesTexture.toJSON(e),s.indirectTexture=this._indirectTexture.toJSON(e),this._colorsTexture!==null&&(s.colorsTexture=this._colorsTexture.toJSON(e)),this.boundingSphere!==null&&(s.boundingSphere=this.boundingSphere.toJSON()),this.boundingBox!==null&&(s.boundingBox=this.boundingBox.toJSON()));function r(a,c){return a[c.uuid]===void 0&&(a[c.uuid]=c.toJSON(e)),c.uuid}if(this.isScene)this.background&&(this.background.isColor?s.background=this.background.toJSON():this.background.isTexture&&(s.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(s.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){s.geometry=r(e.geometries,this.geometry);const a=this.geometry.parameters;if(a!==void 0&&a.shapes!==void 0){const c=a.shapes;if(Array.isArray(c))for(let l=0,u=c.length;l<u;l++){const h=c[l];r(e.shapes,h)}else r(e.shapes,c)}}if(this.isSkinnedMesh&&(s.bindMode=this.bindMode,s.bindMatrix=this.bindMatrix.toArray(),this.skeleton!==void 0&&(r(e.skeletons,this.skeleton),s.skeleton=this.skeleton.uuid)),this.material!==void 0)if(Array.isArray(this.material)){const a=[];for(let c=0,l=this.material.length;c<l;c++)a.push(r(e.materials,this.material[c]));s.material=a}else s.material=r(e.materials,this.material);if(this.children.length>0){s.children=[];for(let a=0;a<this.children.length;a++)s.children.push(this.children[a].toJSON(e).object)}if(this.animations.length>0){s.animations=[];for(let a=0;a<this.animations.length;a++){const c=this.animations[a];s.animations.push(r(e.animations,c))}}if(n){const a=o(e.geometries),c=o(e.materials),l=o(e.textures),u=o(e.images),h=o(e.shapes),d=o(e.skeletons),f=o(e.animations),_=o(e.nodes);a.length>0&&(i.geometries=a),c.length>0&&(i.materials=c),l.length>0&&(i.textures=l),u.length>0&&(i.images=u),h.length>0&&(i.shapes=h),d.length>0&&(i.skeletons=d),f.length>0&&(i.animations=f),_.length>0&&(i.nodes=_)}return i.object=s,i;function o(a){const c=[];for(const l in a){const u=a[l];delete u.metadata,c.push(u)}return c}}clone(e){return new this.constructor().copy(this,e)}copy(e,n=!0){if(this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.rotation.order=e.rotation.order,this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.pivot=e.pivot!==null?e.pivot.clone():null,this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldAutoUpdate=e.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.static=e.static,this.animations=e.animations.slice(),this.userData=JSON.parse(JSON.stringify(e.userData)),n===!0)for(let i=0;i<e.children.length;i++){const s=e.children[i];this.add(s.clone())}return this}dispose(){this.dispatchEvent({type:"dispose"})}}bn.DEFAULT_UP=new H(0,1,0);bn.DEFAULT_MATRIX_AUTO_UPDATE=!0;bn.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;class Eo extends bn{constructor(){super(),this.isGroup=!0,this.type="Group"}}const ow={type:"move"};class Ac{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new Eo,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand}getTargetRaySpace(){return this._targetRay===null&&(this._targetRay=new Eo,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new H,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new H),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new Eo,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new H,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new H,this._grip.eventsEnabled=!1),this._grip}dispatchEvent(e){return this._targetRay!==null&&this._targetRay.dispatchEvent(e),this._grip!==null&&this._grip.dispatchEvent(e),this._hand!==null&&this._hand.dispatchEvent(e),this}connect(e){if(e&&e.hand){const n=this._hand;if(n)for(const i of e.hand.values())this._getHandJoint(n,i)}return this.dispatchEvent({type:"connected",data:e}),this}disconnect(e){return this.dispatchEvent({type:"disconnected",data:e}),this._targetRay!==null&&(this._targetRay.visible=!1),this._grip!==null&&(this._grip.visible=!1),this._hand!==null&&(this._hand.visible=!1),this}update(e,n,i){let s=null,r=null,o=null;const a=this._targetRay,c=this._grip,l=this._hand;if(e&&n.session.visibilityState!=="visible-blurred"){if(l&&e.hand){o=!0;for(const x of e.hand.values()){const m=n.getJointPose(x,i),p=this._getHandJoint(l,x);m!==null&&(p.matrix.fromArray(m.transform.matrix),p.matrix.decompose(p.position,p.rotation,p.scale),p.matrixWorldNeedsUpdate=!0,p.jointRadius=m.radius),p.visible=m!==null}const u=l.joints["index-finger-tip"],h=l.joints["thumb-tip"],d=u.position.distanceTo(h.position),f=.02,_=.005;l.inputState.pinching&&d>f+_?(l.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!l.inputState.pinching&&d<=f-_&&(l.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else c!==null&&e.gripSpace&&(r=n.getPose(e.gripSpace,i),r!==null&&(c.matrix.fromArray(r.transform.matrix),c.matrix.decompose(c.position,c.rotation,c.scale),c.matrixWorldNeedsUpdate=!0,r.linearVelocity?(c.hasLinearVelocity=!0,c.linearVelocity.copy(r.linearVelocity)):c.hasLinearVelocity=!1,r.angularVelocity?(c.hasAngularVelocity=!0,c.angularVelocity.copy(r.angularVelocity)):c.hasAngularVelocity=!1,c.eventsEnabled&&c.dispatchEvent({type:"gripUpdated",data:e,target:this})));a!==null&&(s=n.getPose(e.targetRaySpace,i),s===null&&r!==null&&(s=r),s!==null&&(a.matrix.fromArray(s.transform.matrix),a.matrix.decompose(a.position,a.rotation,a.scale),a.matrixWorldNeedsUpdate=!0,s.linearVelocity?(a.hasLinearVelocity=!0,a.linearVelocity.copy(s.linearVelocity)):a.hasLinearVelocity=!1,s.angularVelocity?(a.hasAngularVelocity=!0,a.angularVelocity.copy(s.angularVelocity)):a.hasAngularVelocity=!1,this.dispatchEvent(ow)))}return a!==null&&(a.visible=s!==null),c!==null&&(c.visible=r!==null),l!==null&&(l.visible=o!==null),this}_getHandJoint(e,n){if(e.joints[n.jointName]===void 0){const i=new Eo;i.matrixAutoUpdate=!1,i.visible=!1,e.joints[n.jointName]=i,e.add(i)}return e.joints[n.jointName]}}const W_={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},Vi={h:0,s:0,l:0},To={h:0,s:0,l:0};function Cc(t,e,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?t+(e-t)*6*n:n<1/2?e:n<2/3?t+(e-t)*6*(2/3-n):t}class ot{constructor(e,n,i){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(e,n,i)}set(e,n,i){if(n===void 0&&i===void 0){const s=e;s&&s.isColor?this.copy(s):typeof s=="number"?this.setHex(s):typeof s=="string"&&this.setStyle(s)}else this.setRGB(e,n,i);return this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,n=kn){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,dt.colorSpaceToWorking(this,n),this}setRGB(e,n,i,s=dt.workingColorSpace){return this.r=e,this.g=n,this.b=i,dt.colorSpaceToWorking(this,s),this}setHSL(e,n,i,s=dt.workingColorSpace){if(e=_d(e,1),n=st(n,0,1),i=st(i,0,1),n===0)this.r=this.g=this.b=i;else{const r=i<=.5?i*(1+n):i+n-i*n,o=2*i-r;this.r=Cc(o,r,e+1/3),this.g=Cc(o,r,e),this.b=Cc(o,r,e-1/3)}return dt.colorSpaceToWorking(this,s),this}setStyle(e,n=kn){function i(r){r!==void 0&&parseFloat(r)<1&&Ge("Color: Alpha component of "+e+" will be ignored.")}let s;if(s=/^(\w+)\(([^\)]*)\)/.exec(e)){let r;const o=s[1],a=s[2];switch(o){case"rgb":case"rgba":if(r=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return i(r[4]),this.setRGB(Math.min(255,parseInt(r[1],10))/255,Math.min(255,parseInt(r[2],10))/255,Math.min(255,parseInt(r[3],10))/255,n);if(r=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return i(r[4]),this.setRGB(Math.min(100,parseInt(r[1],10))/100,Math.min(100,parseInt(r[2],10))/100,Math.min(100,parseInt(r[3],10))/100,n);break;case"hsl":case"hsla":if(r=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return i(r[4]),this.setHSL(parseFloat(r[1])/360,parseFloat(r[2])/100,parseFloat(r[3])/100,n);break;default:Ge("Color: Unknown color model "+e)}}else if(s=/^\#([A-Fa-f\d]+)$/.exec(e)){const r=s[1],o=r.length;if(o===3)return this.setRGB(parseInt(r.charAt(0),16)/15,parseInt(r.charAt(1),16)/15,parseInt(r.charAt(2),16)/15,n);if(o===6)return this.setHex(parseInt(r,16),n);Ge("Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,n);return this}setColorName(e,n=kn){const i=W_[e.toLowerCase()];return i!==void 0?this.setHex(i,n):Ge("Color: Unknown color "+e),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(e){return this.r=e.r,this.g=e.g,this.b=e.b,this}copySRGBToLinear(e){return this.r=Ii(e.r),this.g=Ii(e.g),this.b=Ii(e.b),this}copyLinearToSRGB(e){return this.r=Xs(e.r),this.g=Xs(e.g),this.b=Xs(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=kn){return dt.workingToColorSpace(dn.copy(this),e),Math.round(st(dn.r*255,0,255))*65536+Math.round(st(dn.g*255,0,255))*256+Math.round(st(dn.b*255,0,255))}getHexString(e=kn){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,n=dt.workingColorSpace){dt.workingToColorSpace(dn.copy(this),n);const i=dn.r,s=dn.g,r=dn.b,o=Math.max(i,s,r),a=Math.min(i,s,r);let c,l;const u=(a+o)/2;if(a===o)c=0,l=0;else{const h=o-a;switch(l=u<=.5?h/(o+a):h/(2-o-a),o){case i:c=(s-r)/h+(s<r?6:0);break;case s:c=(r-i)/h+2;break;case r:c=(i-s)/h+4;break}c/=6}return e.h=c,e.s=l,e.l=u,e}getRGB(e,n=dt.workingColorSpace){return dt.workingToColorSpace(dn.copy(this),n),e.r=dn.r,e.g=dn.g,e.b=dn.b,e}getStyle(e=kn){dt.workingToColorSpace(dn.copy(this),e);const n=dn.r,i=dn.g,s=dn.b;return e!==kn?`color(${e} ${n.toFixed(3)} ${i.toFixed(3)} ${s.toFixed(3)})`:`rgb(${Math.round(n*255)},${Math.round(i*255)},${Math.round(s*255)})`}offsetHSL(e,n,i){return this.getHSL(Vi),this.setHSL(Vi.h+e,Vi.s+n,Vi.l+i)}add(e){return this.r+=e.r,this.g+=e.g,this.b+=e.b,this}addColors(e,n){return this.r=e.r+n.r,this.g=e.g+n.g,this.b=e.b+n.b,this}addScalar(e){return this.r+=e,this.g+=e,this.b+=e,this}sub(e){return this.r=Math.max(0,this.r-e.r),this.g=Math.max(0,this.g-e.g),this.b=Math.max(0,this.b-e.b),this}multiply(e){return this.r*=e.r,this.g*=e.g,this.b*=e.b,this}multiplyScalar(e){return this.r*=e,this.g*=e,this.b*=e,this}lerp(e,n){return this.r+=(e.r-this.r)*n,this.g+=(e.g-this.g)*n,this.b+=(e.b-this.b)*n,this}lerpColors(e,n,i){return this.r=e.r+(n.r-e.r)*i,this.g=e.g+(n.g-e.g)*i,this.b=e.b+(n.b-e.b)*i,this}lerpHSL(e,n){this.getHSL(Vi),e.getHSL(To);const i=zr(Vi.h,To.h,n),s=zr(Vi.s,To.s,n),r=zr(Vi.l,To.l,n);return this.setHSL(i,s,r),this}setFromVector3(e){return this.r=e.x,this.g=e.y,this.b=e.z,this}applyMatrix3(e){const n=this.r,i=this.g,s=this.b,r=e.elements;return this.r=r[0]*n+r[3]*i+r[6]*s,this.g=r[1]*n+r[4]*i+r[7]*s,this.b=r[2]*n+r[5]*i+r[8]*s,this}equals(e){return e.r===this.r&&e.g===this.g&&e.b===this.b}fromArray(e,n=0){return this.r=e[n],this.g=e[n+1],this.b=e[n+2],this}toArray(e=[],n=0){return e[n]=this.r,e[n+1]=this.g,e[n+2]=this.b,e}fromBufferAttribute(e,n){return this.r=e.getX(n),this.g=e.getY(n),this.b=e.getZ(n),this}toJSON(){return this.getHex()}*[Symbol.iterator](){yield this.r,yield this.g,yield this.b}}const dn=new ot;ot.NAMES=W_;class aw extends bn{constructor(){super(),this.isScene=!0,this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.backgroundBlurriness=0,this.backgroundIntensity=1,this.backgroundRotation=new bs,this.environmentIntensity=1,this.environmentRotation=new bs,this.overrideMaterial=null,typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(e,n){return super.copy(e,n),e.background!==null&&(this.background=e.background.clone()),e.environment!==null&&(this.environment=e.environment.clone()),e.fog!==null&&(this.fog=e.fog.clone()),this.backgroundBlurriness=e.backgroundBlurriness,this.backgroundIntensity=e.backgroundIntensity,this.backgroundRotation.copy(e.backgroundRotation),this.environmentIntensity=e.environmentIntensity,this.environmentRotation.copy(e.environmentRotation),e.overrideMaterial!==null&&(this.overrideMaterial=e.overrideMaterial.clone()),this.matrixAutoUpdate=e.matrixAutoUpdate,this}toJSON(e){const n=super.toJSON(e);return this.fog!==null&&(n.object.fog=this.fog.toJSON()),n.object.backgroundBlurriness=this.backgroundBlurriness,n.object.backgroundIntensity=this.backgroundIntensity,n.object.backgroundRotation=this.backgroundRotation.toArray(),n.object.environmentIntensity=this.environmentIntensity,n.object.environmentRotation=this.environmentRotation.toArray(),n}}const Wn=new H,yi=new H,Pc=new H,bi=new H,Ls=new H,Ns=new H,Kh=new H,Ic=new H,Lc=new H,Nc=new H,Dc=new Ht,Uc=new Ht,Oc=new Ht;class Xn{constructor(e=new H,n=new H,i=new H){this.a=e,this.b=n,this.c=i}static getNormal(e,n,i,s){s.subVectors(i,n),Wn.subVectors(e,n),s.cross(Wn);const r=s.lengthSq();return r>0?s.multiplyScalar(1/Math.sqrt(r)):s.set(0,0,0)}static getBarycoord(e,n,i,s,r){Wn.subVectors(s,n),yi.subVectors(i,n),Pc.subVectors(e,n);const o=Wn.dot(Wn),a=Wn.dot(yi),c=Wn.dot(Pc),l=yi.dot(yi),u=yi.dot(Pc),h=o*l-a*a;if(h===0)return r.set(0,0,0),null;const d=1/h,f=(l*c-a*u)*d,_=(o*u-a*c)*d;return r.set(1-f-_,_,f)}static containsPoint(e,n,i,s){return this.getBarycoord(e,n,i,s,bi)===null?!1:bi.x>=0&&bi.y>=0&&bi.x+bi.y<=1}static getInterpolation(e,n,i,s,r,o,a,c){return this.getBarycoord(e,n,i,s,bi)===null?(c.x=0,c.y=0,"z"in c&&(c.z=0),"w"in c&&(c.w=0),null):(c.setScalar(0),c.addScaledVector(r,bi.x),c.addScaledVector(o,bi.y),c.addScaledVector(a,bi.z),c)}static getInterpolatedAttribute(e,n,i,s,r,o){return Dc.setScalar(0),Uc.setScalar(0),Oc.setScalar(0),Dc.fromBufferAttribute(e,n),Uc.fromBufferAttribute(e,i),Oc.fromBufferAttribute(e,s),o.setScalar(0),o.addScaledVector(Dc,r.x),o.addScaledVector(Uc,r.y),o.addScaledVector(Oc,r.z),o}static isFrontFacing(e,n,i,s){return Wn.subVectors(i,n),yi.subVectors(e,n),Wn.cross(yi).dot(s)<0}set(e,n,i){return this.a.copy(e),this.b.copy(n),this.c.copy(i),this}setFromPointsAndIndices(e,n,i,s){return this.a.copy(e[n]),this.b.copy(e[i]),this.c.copy(e[s]),this}setFromAttributeAndIndices(e,n,i,s){return this.a.fromBufferAttribute(e,n),this.b.fromBufferAttribute(e,i),this.c.fromBufferAttribute(e,s),this}clone(){return new this.constructor().copy(this)}copy(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this}getArea(){return Wn.subVectors(this.c,this.b),yi.subVectors(this.a,this.b),Wn.cross(yi).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return Xn.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,n){return Xn.getBarycoord(e,this.a,this.b,this.c,n)}getInterpolation(e,n,i,s,r){return Xn.getInterpolation(e,this.a,this.b,this.c,n,i,s,r)}containsPoint(e){return Xn.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return Xn.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,n){const i=this.a,s=this.b,r=this.c;let o,a;Ls.subVectors(s,i),Ns.subVectors(r,i),Ic.subVectors(e,i);const c=Ls.dot(Ic),l=Ns.dot(Ic);if(c<=0&&l<=0)return n.copy(i);Lc.subVectors(e,s);const u=Ls.dot(Lc),h=Ns.dot(Lc);if(u>=0&&h<=u)return n.copy(s);const d=c*h-u*l;if(d<=0&&c>=0&&u<=0)return o=c/(c-u),n.copy(i).addScaledVector(Ls,o);Nc.subVectors(e,r);const f=Ls.dot(Nc),_=Ns.dot(Nc);if(_>=0&&f<=_)return n.copy(r);const x=f*l-c*_;if(x<=0&&l>=0&&_<=0)return a=l/(l-_),n.copy(i).addScaledVector(Ns,a);const m=u*_-f*h;if(m<=0&&h-u>=0&&f-_>=0)return Kh.subVectors(r,s),a=(h-u)/(h-u+(f-_)),n.copy(s).addScaledVector(Kh,a);const p=1/(m+x+d);return o=x*p,a=d*p,n.copy(i).addScaledVector(Ls,o).addScaledVector(Ns,a)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}class Ms{constructor(e=new H(1/0,1/0,1/0),n=new H(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=e,this.max=n}set(e,n){return this.min.copy(e),this.max.copy(n),this}setFromArray(e){this.makeEmpty();for(let n=0,i=e.length;n<i;n+=3)this.expandByPoint(Zn.fromArray(e,n));return this}setFromBufferAttribute(e){this.makeEmpty();for(let n=0,i=e.count;n<i;n++)this.expandByPoint(Zn.fromBufferAttribute(e,n));return this}setFromPoints(e){this.makeEmpty();for(let n=0,i=e.length;n<i;n++)this.expandByPoint(e[n]);return this}setFromCenterAndSize(e,n){const i=Zn.copy(n).multiplyScalar(.5);return this.min.copy(e).sub(i),this.max.copy(e).add(i),this}setFromObject(e,n=!1){return this.makeEmpty(),this.expandByObject(e,n)}clone(){return new this.constructor().copy(this)}copy(e){return this.min.copy(e.min),this.max.copy(e.max),this}makeEmpty(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z}getCenter(e){return this.isEmpty()?e.set(0,0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(e){return this.isEmpty()?e.set(0,0,0):e.subVectors(this.max,this.min)}expandByPoint(e){return this.min.min(e),this.max.max(e),this}expandByVector(e){return this.min.sub(e),this.max.add(e),this}expandByScalar(e){return this.min.addScalar(-e),this.max.addScalar(e),this}expandByObject(e,n=!1){e.updateWorldMatrix(!1,!1);const i=e.geometry;if(i!==void 0){const r=i.getAttribute("position");if(n===!0&&r!==void 0&&e.isInstancedMesh!==!0)for(let o=0,a=r.count;o<a;o++)e.isMesh===!0?e.getVertexPosition(o,Zn):Zn.fromBufferAttribute(r,o),Zn.applyMatrix4(e.matrixWorld),this.expandByPoint(Zn);else e.boundingBox!==void 0?(e.boundingBox===null&&e.computeBoundingBox(),Ro.copy(e.boundingBox)):(i.boundingBox===null&&i.computeBoundingBox(),Ro.copy(i.boundingBox)),Ro.applyMatrix4(e.matrixWorld),this.union(Ro)}const s=e.children;for(let r=0,o=s.length;r<o;r++)this.expandByObject(s[r],n);return this}containsPoint(e){return e.x>=this.min.x&&e.x<=this.max.x&&e.y>=this.min.y&&e.y<=this.max.y&&e.z>=this.min.z&&e.z<=this.max.z}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z}getParameter(e,n){return n.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(e){return e.max.x>=this.min.x&&e.min.x<=this.max.x&&e.max.y>=this.min.y&&e.min.y<=this.max.y&&e.max.z>=this.min.z&&e.min.z<=this.max.z}intersectsSphere(e){return this.clampPoint(e.center,Zn),Zn.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let n,i;return e.normal.x>0?(n=e.normal.x*this.min.x,i=e.normal.x*this.max.x):(n=e.normal.x*this.max.x,i=e.normal.x*this.min.x),e.normal.y>0?(n+=e.normal.y*this.min.y,i+=e.normal.y*this.max.y):(n+=e.normal.y*this.max.y,i+=e.normal.y*this.min.y),e.normal.z>0?(n+=e.normal.z*this.min.z,i+=e.normal.z*this.max.z):(n+=e.normal.z*this.max.z,i+=e.normal.z*this.min.z),n<=-e.constant&&i>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(Mr),wo.subVectors(this.max,Mr),Ds.subVectors(e.a,Mr),Us.subVectors(e.b,Mr),Os.subVectors(e.c,Mr),Gi.subVectors(Us,Ds),qi.subVectors(Os,Us),rs.subVectors(Ds,Os);let n=[0,-Gi.z,Gi.y,0,-qi.z,qi.y,0,-rs.z,rs.y,Gi.z,0,-Gi.x,qi.z,0,-qi.x,rs.z,0,-rs.x,-Gi.y,Gi.x,0,-qi.y,qi.x,0,-rs.y,rs.x,0];return!Fc(n,Ds,Us,Os,wo)||(n=[1,0,0,0,1,0,0,0,1],!Fc(n,Ds,Us,Os,wo))?!1:(Ao.crossVectors(Gi,qi),n=[Ao.x,Ao.y,Ao.z],Fc(n,Ds,Us,Os,wo))}clampPoint(e,n){return n.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,Zn).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(Zn).length()*.5),e}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}applyMatrix4(e){return this.isEmpty()?this:(Mi[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),Mi[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),Mi[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),Mi[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),Mi[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),Mi[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),Mi[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),Mi[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(Mi),this)}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}toJSON(){return{min:this.min.toArray(),max:this.max.toArray()}}fromJSON(e){return this.min.fromArray(e.min),this.max.fromArray(e.max),this}}const Mi=[new H,new H,new H,new H,new H,new H,new H,new H],Zn=new H,Ro=new Ms,Ds=new H,Us=new H,Os=new H,Gi=new H,qi=new H,rs=new H,Mr=new H,wo=new H,Ao=new H,os=new H;function Fc(t,e,n,i,s){for(let r=0,o=t.length-3;r<=o;r+=3){os.fromArray(t,r);const a=s.x*Math.abs(os.x)+s.y*Math.abs(os.y)+s.z*Math.abs(os.z),c=e.dot(os),l=n.dot(os),u=i.dot(os);if(Math.max(-Math.max(c,l,u),Math.min(c,l,u))>a)return!1}return!0}const Wt=new H,Co=new Ke;let cw=0;class jn extends Qi{constructor(e,n,i=!1){if(super(),Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,Object.defineProperty(this,"id",{value:cw++}),this.name="",this.array=e,this.itemSize=n,this.count=e!==void 0?e.length/n:0,this.normalized=i,this.usage=wR,this.updateRanges=[],this.gpuType=ui,this.version=0}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}addUpdateRange(e,n){this.updateRanges.push({start:e,count:n})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.usage=e.usage,this.gpuType=e.gpuType,this}copyAt(e,n,i){e*=this.itemSize,i*=n.itemSize;for(let s=0,r=this.itemSize;s<r;s++)this.array[e+s]=n.array[i+s];return this}copyArray(e){return this.array.set(e),this}applyMatrix3(e){if(this.itemSize===2)for(let n=0,i=this.count;n<i;n++)Co.fromBufferAttribute(this,n),Co.applyMatrix3(e),this.setXY(n,Co.x,Co.y);else if(this.itemSize===3)for(let n=0,i=this.count;n<i;n++)Wt.fromBufferAttribute(this,n),Wt.applyMatrix3(e),this.setXYZ(n,Wt.x,Wt.y,Wt.z);return this}applyMatrix4(e){for(let n=0,i=this.count;n<i;n++)Wt.fromBufferAttribute(this,n),Wt.applyMatrix4(e),this.setXYZ(n,Wt.x,Wt.y,Wt.z);return this}applyNormalMatrix(e){for(let n=0,i=this.count;n<i;n++)Wt.fromBufferAttribute(this,n),Wt.applyNormalMatrix(e),this.setXYZ(n,Wt.x,Wt.y,Wt.z);return this}transformDirection(e){for(let n=0,i=this.count;n<i;n++)Wt.fromBufferAttribute(this,n),Wt.transformDirection(e),this.setXYZ(n,Wt.x,Wt.y,Wt.z);return this}set(e,n=0){return this.array.set(e,n),this}getComponent(e,n){let i=this.array[e*this.itemSize+n];return this.normalized&&(i=Vs(i,this.array)),i}setComponent(e,n,i){return this.normalized&&(i=Sn(i,this.array)),this.array[e*this.itemSize+n]=i,this}getX(e){let n=this.array[e*this.itemSize];return this.normalized&&(n=Vs(n,this.array)),n}setX(e,n){return this.normalized&&(n=Sn(n,this.array)),this.array[e*this.itemSize]=n,this}getY(e){let n=this.array[e*this.itemSize+1];return this.normalized&&(n=Vs(n,this.array)),n}setY(e,n){return this.normalized&&(n=Sn(n,this.array)),this.array[e*this.itemSize+1]=n,this}getZ(e){let n=this.array[e*this.itemSize+2];return this.normalized&&(n=Vs(n,this.array)),n}setZ(e,n){return this.normalized&&(n=Sn(n,this.array)),this.array[e*this.itemSize+2]=n,this}getW(e){let n=this.array[e*this.itemSize+3];return this.normalized&&(n=Vs(n,this.array)),n}setW(e,n){return this.normalized&&(n=Sn(n,this.array)),this.array[e*this.itemSize+3]=n,this}setXY(e,n,i){return e*=this.itemSize,this.normalized&&(n=Sn(n,this.array),i=Sn(i,this.array)),this.array[e+0]=n,this.array[e+1]=i,this}setXYZ(e,n,i,s){return e*=this.itemSize,this.normalized&&(n=Sn(n,this.array),i=Sn(i,this.array),s=Sn(s,this.array)),this.array[e+0]=n,this.array[e+1]=i,this.array[e+2]=s,this}setXYZW(e,n,i,s,r){return e*=this.itemSize,this.normalized&&(n=Sn(n,this.array),i=Sn(i,this.array),s=Sn(s,this.array),r=Sn(r,this.array)),this.array[e+0]=n,this.array[e+1]=i,this.array[e+2]=s,this.array[e+3]=r,this}onUpload(e){return this.onUploadCallback=e,this}clone(){return new this.constructor(this.array,this.itemSize).copy(this)}toJSON(){const e={itemSize:this.itemSize,type:this.array.constructor.name,array:Array.from(this.array),normalized:this.normalized};return e.name=this.name,e.usage=this.usage,e.gpuType=this.gpuType,e}dispose(){this.dispatchEvent({type:"dispose"})}}class Z_ extends jn{constructor(e,n,i){super(new Uint16Array(e),n,i)}}class X_ extends jn{constructor(e,n,i){super(new Uint32Array(e),n,i)}}class tn extends jn{constructor(e,n,i){super(new Float32Array(e),n,i)}}const lw=new Ms,Er=new H,kc=new H;class ja{constructor(e=new H,n=-1){this.isSphere=!0,this.center=e,this.radius=n}set(e,n){return this.center.copy(e),this.radius=n,this}setFromPoints(e,n){const i=this.center;n!==void 0?i.copy(n):lw.setFromPoints(e).getCenter(i);let s=0;for(let r=0,o=e.length;r<o;r++)s=Math.max(s,i.distanceToSquared(e[r]));return this.radius=Math.sqrt(s),this}copy(e){return this.center.copy(e.center),this.radius=e.radius,this}isEmpty(){return this.radius<0}makeEmpty(){return this.center.set(0,0,0),this.radius=-1,this}containsPoint(e){return e.distanceToSquared(this.center)<=this.radius*this.radius}distanceToPoint(e){return e.distanceTo(this.center)-this.radius}intersectsSphere(e){const n=this.radius+e.radius;return e.center.distanceToSquared(this.center)<=n*n}intersectsBox(e){return e.intersectsSphere(this)}intersectsPlane(e){return Math.abs(e.distanceToPoint(this.center))<=this.radius}clampPoint(e,n){const i=this.center.distanceToSquared(e);return n.copy(e),i>this.radius*this.radius&&(n.sub(this.center).normalize(),n.multiplyScalar(this.radius).add(this.center)),n}getBoundingBox(e){return this.isEmpty()?(e.makeEmpty(),e):(e.set(this.center,this.center),e.expandByScalar(this.radius),e)}applyMatrix4(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this}translate(e){return this.center.add(e),this}expandByPoint(e){if(this.isEmpty())return this.center.copy(e),this.radius=0,this;Er.subVectors(e,this.center);const n=Er.lengthSq();if(n>this.radius*this.radius){const i=Math.sqrt(n),s=(i-this.radius)*.5;this.center.addScaledVector(Er,s/i),this.radius+=s}return this}union(e){return e.isEmpty()?this:this.isEmpty()?(this.copy(e),this):(this.center.equals(e.center)===!0?this.radius=Math.max(this.radius,e.radius):(kc.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(Er.copy(e.center).add(kc)),this.expandByPoint(Er.copy(e.center).sub(kc))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}toJSON(){return{radius:this.radius,center:this.center.toArray()}}fromJSON(e){return this.radius=e.radius,this.center.fromArray(e.center),this}}let uw=0;const On=new Gt,zc=new bn,Fs=new H,Nn=new Ms,Tr=new Ms,Qt=new H;class Mn extends Qi{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:uw++}),this.uuid=gr(),this.name="",this.type="BufferGeometry",this.index=null,this.indirect=null,this.indirectOffset=0,this.attributes={},this.morphAttributes={},this.morphTargetsRelative=!1,this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={},this._transformed=!1}getIndex(){return this.index}setIndex(e){return Array.isArray(e)?this.index=new(AR(e)?X_:Z_)(e,1):this.index=e,this}setIndirect(e,n=0){return this.indirect=e,this.indirectOffset=n,this}getIndirect(){return this.indirect}getAttribute(e){return this.attributes[e]}setAttribute(e,n){return this.attributes[e]=n,this}deleteAttribute(e){return delete this.attributes[e],this}hasAttribute(e){return this.attributes[e]!==void 0}addGroup(e,n,i=0){this.groups.push({start:e,count:n,materialIndex:i})}clearGroups(){this.groups=[]}setDrawRange(e,n){this.drawRange.start=e,this.drawRange.count=n}applyMatrix4(e){const n=this.attributes.position;n!==void 0&&(n.applyMatrix4(e),n.needsUpdate=!0);const i=this.attributes.normal;if(i!==void 0){const r=new Ye().getNormalMatrix(e);i.applyNormalMatrix(r),i.needsUpdate=!0}const s=this.attributes.tangent;return s!==void 0&&(s.transformDirection(e),s.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this._transformed=!0,this}applyQuaternion(e){return On.makeRotationFromQuaternion(e),this.applyMatrix4(On),this}rotateX(e){return On.makeRotationX(e),this.applyMatrix4(On),this}rotateY(e){return On.makeRotationY(e),this.applyMatrix4(On),this}rotateZ(e){return On.makeRotationZ(e),this.applyMatrix4(On),this}translate(e,n,i){return On.makeTranslation(e,n,i),this.applyMatrix4(On),this}scale(e,n,i){return On.makeScale(e,n,i),this.applyMatrix4(On),this}lookAt(e){return zc.lookAt(e),zc.updateMatrix(),this.applyMatrix4(zc.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(Fs).negate(),this.translate(Fs.x,Fs.y,Fs.z),this}setFromPoints(e){const n=this.getAttribute("position");if(n===void 0){const i=[];for(let s=0,r=e.length;s<r;s++){const o=e[s];i.push(o.x,o.y,o.z||0)}this.setAttribute("position",new tn(i,3))}else{const i=Math.min(e.length,n.count);for(let s=0;s<i;s++){const r=e[s];n.setXYZ(s,r.x,r.y,r.z||0)}e.length>n.count&&Ge("BufferGeometry: Buffer size too small for points data. Use .dispose() and create a new geometry."),n.needsUpdate=!0}return this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new Ms);const e=this.attributes.position,n=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){St("BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),this.boundingBox.set(new H(-1/0,-1/0,-1/0),new H(1/0,1/0,1/0));return}if(e!==void 0){if(this.boundingBox.setFromBufferAttribute(e),n)for(let i=0,s=n.length;i<s;i++){const r=n[i];Nn.setFromBufferAttribute(r),this.morphTargetsRelative?(Qt.addVectors(this.boundingBox.min,Nn.min),this.boundingBox.expandByPoint(Qt),Qt.addVectors(this.boundingBox.max,Nn.max),this.boundingBox.expandByPoint(Qt)):(this.boundingBox.expandByPoint(Nn.min),this.boundingBox.expandByPoint(Nn.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&St('BufferGeometry.computeBoundingBox(): Computed min/max have NaN values. The "position" attribute is likely to have NaN values.',this)}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new ja);const e=this.attributes.position,n=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){St("BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere.",this),this.boundingSphere.set(new H,1/0);return}if(e){const i=this.boundingSphere.center;if(Nn.setFromBufferAttribute(e),n)for(let r=0,o=n.length;r<o;r++){const a=n[r];Tr.setFromBufferAttribute(a),this.morphTargetsRelative?(Qt.addVectors(Nn.min,Tr.min),Nn.expandByPoint(Qt),Qt.addVectors(Nn.max,Tr.max),Nn.expandByPoint(Qt)):(Nn.expandByPoint(Tr.min),Nn.expandByPoint(Tr.max))}Nn.getCenter(i);let s=0;for(let r=0,o=e.count;r<o;r++)Qt.fromBufferAttribute(e,r),s=Math.max(s,i.distanceToSquared(Qt));if(n)for(let r=0,o=n.length;r<o;r++){const a=n[r],c=this.morphTargetsRelative;for(let l=0,u=a.count;l<u;l++)Qt.fromBufferAttribute(a,l),c&&(Fs.fromBufferAttribute(e,l),Qt.add(Fs)),s=Math.max(s,i.distanceToSquared(Qt))}this.boundingSphere.radius=Math.sqrt(s),isNaN(this.boundingSphere.radius)&&St('BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}computeTangents(){const e=this.index,n=this.attributes;if(e===null||n.position===void 0||n.normal===void 0||n.uv===void 0){St("BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");return}const i=n.position,s=n.normal,r=n.uv;let o=this.getAttribute("tangent");(o===void 0||o.count!==i.count)&&(o=new jn(new Float32Array(4*i.count),4),this.setAttribute("tangent",o));const a=[],c=[];for(let v=0;v<i.count;v++)a[v]=new H,c[v]=new H;const l=new H,u=new H,h=new H,d=new Ke,f=new Ke,_=new Ke,x=new H,m=new H;function p(v,T,I){l.fromBufferAttribute(i,v),u.fromBufferAttribute(i,T),h.fromBufferAttribute(i,I),d.fromBufferAttribute(r,v),f.fromBufferAttribute(r,T),_.fromBufferAttribute(r,I),u.sub(l),h.sub(l),f.sub(d),_.sub(d);const N=1/(f.x*_.y-_.x*f.y);isFinite(N)&&(x.copy(u).multiplyScalar(_.y).addScaledVector(h,-f.y).multiplyScalar(N),m.copy(h).multiplyScalar(f.x).addScaledVector(u,-_.x).multiplyScalar(N),a[v].add(x),a[T].add(x),a[I].add(x),c[v].add(m),c[T].add(m),c[I].add(m))}let E=this.groups;E.length===0&&(E=[{start:0,count:e.count}]);for(let v=0,T=E.length;v<T;++v){const I=E[v],N=I.start,k=I.count;for(let $=N,U=N+k;$<U;$+=3)p(e.getX($+0),e.getX($+1),e.getX($+2))}const L=new H,b=new H,w=new H,A=new H;function P(v){w.fromBufferAttribute(s,v),A.copy(w);const T=a[v];L.copy(T),L.sub(w.multiplyScalar(w.dot(T))).normalize(),b.crossVectors(A,T);const N=b.dot(c[v])<0?-1:1;o.setXYZW(v,L.x,L.y,L.z,N)}for(let v=0,T=E.length;v<T;++v){const I=E[v],N=I.start,k=I.count;for(let $=N,U=N+k;$<U;$+=3)P(e.getX($+0)),P(e.getX($+1)),P(e.getX($+2))}this._transformed=!0}computeVertexNormals(){const e=this.index,n=this.getAttribute("position");if(n!==void 0){let i=this.getAttribute("normal");if(i===void 0||i.count!==n.count)i=new jn(new Float32Array(n.count*3),3),this.setAttribute("normal",i);else for(let d=0,f=i.count;d<f;d++)i.setXYZ(d,0,0,0);const s=new H,r=new H,o=new H,a=new H,c=new H,l=new H,u=new H,h=new H;if(e)for(let d=0,f=e.count;d<f;d+=3){const _=e.getX(d+0),x=e.getX(d+1),m=e.getX(d+2);s.fromBufferAttribute(n,_),r.fromBufferAttribute(n,x),o.fromBufferAttribute(n,m),u.subVectors(o,r),h.subVectors(s,r),u.cross(h),a.fromBufferAttribute(i,_),c.fromBufferAttribute(i,x),l.fromBufferAttribute(i,m),a.add(u),c.add(u),l.add(u),i.setXYZ(_,a.x,a.y,a.z),i.setXYZ(x,c.x,c.y,c.z),i.setXYZ(m,l.x,l.y,l.z)}else for(let d=0,f=n.count;d<f;d+=3)s.fromBufferAttribute(n,d+0),r.fromBufferAttribute(n,d+1),o.fromBufferAttribute(n,d+2),u.subVectors(o,r),h.subVectors(s,r),u.cross(h),i.setXYZ(d+0,u.x,u.y,u.z),i.setXYZ(d+1,u.x,u.y,u.z),i.setXYZ(d+2,u.x,u.y,u.z);this.normalizeNormals(),i.needsUpdate=!0}}normalizeNormals(){const e=this.attributes.normal;for(let n=0,i=e.count;n<i;n++)Qt.fromBufferAttribute(e,n),Qt.normalize(),e.setXYZ(n,Qt.x,Qt.y,Qt.z)}toNonIndexed(){function e(a,c){const l=a.array,u=a.itemSize,h=a.normalized,d=new l.constructor(c.length*u);let f=0,_=0;for(let x=0,m=c.length;x<m;x++){a.isInterleavedBufferAttribute?f=c[x]*a.data.stride+a.offset:f=c[x]*u;for(let p=0;p<u;p++)d[_++]=l[f++]}return new jn(d,u,h)}if(this.index===null)return Ge("BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;const n=new Mn,i=this.index.array,s=this.attributes;for(const a in s){const c=s[a],l=e(c,i);n.setAttribute(a,l)}const r=this.morphAttributes;for(const a in r){const c=[],l=r[a];for(let u=0,h=l.length;u<h;u++){const d=l[u],f=e(d,i);c.push(f)}n.morphAttributes[a]=c}n.morphTargetsRelative=this.morphTargetsRelative;const o=this.groups;for(let a=0,c=o.length;a<c;a++){const l=o[a];n.addGroup(l.start,l.count,l.materialIndex)}return n}toJSON(){const e={metadata:{version:4.7,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(e.uuid=this.uuid,e.type=this.parameters!==void 0&&this._transformed===!0?"BufferGeometry":this.type,e.name=this.name,Object.keys(this.userData).length>0&&(e.userData=this.userData),this.parameters!==void 0&&this._transformed!==!0){const c=this.parameters;for(const l in c)c[l]!==void 0&&(e[l]=c[l]);return e}e.data={attributes:{}};const n=this.index;n!==null&&(e.data.index={type:n.array.constructor.name,array:Array.prototype.slice.call(n.array)});const i=this.attributes;for(const c in i){const l=i[c];e.data.attributes[c]=l.toJSON(e.data)}const s={};let r=!1;for(const c in this.morphAttributes){const l=this.morphAttributes[c],u=[];for(let h=0,d=l.length;h<d;h++){const f=l[h];u.push(f.toJSON(e.data))}u.length>0&&(s[c]=u,r=!0)}r&&(e.data.morphAttributes=s,e.data.morphTargetsRelative=this.morphTargetsRelative);const o=this.groups;o.length>0&&(e.data.groups=JSON.parse(JSON.stringify(o)));const a=this.boundingSphere;return a!==null&&(e.data.boundingSphere=a.toJSON()),e}clone(){return new this.constructor().copy(this)}copy(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;const n={};this.name=e.name;const i=e.index;i!==null&&this.setIndex(i.clone());const s=e.attributes;for(const l in s){const u=s[l];this.setAttribute(l,u.clone(n))}const r=e.morphAttributes;for(const l in r){const u=[],h=r[l];for(let d=0,f=h.length;d<f;d++)u.push(h[d].clone(n));this.morphAttributes[l]=u}this.morphTargetsRelative=e.morphTargetsRelative;const o=e.groups;for(let l=0,u=o.length;l<u;l++){const h=o[l];this.addGroup(h.start,h.count,h.materialIndex)}const a=e.boundingBox;a!==null&&(this.boundingBox=a.clone());const c=e.boundingSphere;return c!==null&&(this.boundingSphere=c.clone()),this.drawRange.start=e.drawRange.start,this.drawRange.count=e.drawRange.count,this.userData=e.userData,this._transformed=e._transformed,this}dispose(){this.dispatchEvent({type:"dispose"})}}const Bc=new H,dw=new H,hw=new Ye;class Ri{constructor(e=new H(1,0,0),n=0){this.isPlane=!0,this.normal=e,this.constant=n}set(e,n){return this.normal.copy(e),this.constant=n,this}setComponents(e,n,i,s){return this.normal.set(e,n,i),this.constant=s,this}setFromNormalAndCoplanarPoint(e,n){return this.normal.copy(e),this.constant=-n.dot(this.normal),this}setFromCoplanarPoints(e,n,i){const s=Bc.subVectors(i,n).cross(dw.subVectors(e,n)).normalize();return this.setFromNormalAndCoplanarPoint(s,e),this}copy(e){return this.normal.copy(e.normal),this.constant=e.constant,this}normalize(){const e=1/this.normal.length();return this.normal.multiplyScalar(e),this.constant*=e,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(e){return this.normal.dot(e)+this.constant}distanceToSphere(e){return this.distanceToPoint(e.center)-e.radius}projectPoint(e,n){return n.copy(e).addScaledVector(this.normal,-this.distanceToPoint(e))}intersectLine(e,n,i=!0){const s=e.delta(Bc),r=this.normal.dot(s);if(r===0)return this.distanceToPoint(e.start)===0?n.copy(e.start):null;const o=-(e.start.dot(this.normal)+this.constant)/r;return i===!0&&(o<0||o>1)?null:n.copy(e.start).addScaledVector(s,o)}intersectsLine(e){const n=this.distanceToPoint(e.start),i=this.distanceToPoint(e.end);return n<0&&i>0||i<0&&n>0}intersectsBox(e){return e.intersectsPlane(this)}intersectsSphere(e){return e.intersectsPlane(this)}coplanarPoint(e){return e.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(e,n){const i=n||hw.getNormalMatrix(e),s=this.coplanarPoint(Bc).applyMatrix4(e),r=this.normal.applyMatrix3(i).normalize();return this.constant=-s.dot(r),this}translate(e){return this.constant-=e.dot(this.normal),this}equals(e){return e.normal.equals(this.normal)&&e.constant===this.constant}clone(){return new this.constructor().copy(this)}toJSON(){return{normal:this.normal.toArray(),constant:this.constant}}fromJSON(e){return this.normal.fromArray(e.normal),this.constant=e.constant,this}}let fw=0;class ro extends Qi{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:fw++}),this.uuid=gr(),this.name="",this.type="Material",this.blending=Fr,this.side=vs,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=E_,this.blendDst=T_,this.blendEquation=Hs,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new ot(0,0,0),this.blendAlpha=0,this.depthFunc=Kr,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=xR,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=bc,this.stencilZFail=bc,this.stencilZPass=bc,this.stencilWrite=!1,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaToCoverage=!1,this.premultipliedAlpha=!1,this.forceSinglePass=!1,this.allowOverride=!0,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0,this._alphaTest=0}get alphaTest(){return this._alphaTest}set alphaTest(e){this._alphaTest>0!=e>0&&this.version++,this._alphaTest=e}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(e!==void 0)for(const n in e){const i=e[n];if(i===void 0){Ge(`Material: parameter '${n}' has value of undefined.`);continue}const s=this[n];if(s===void 0){Ge(`Material: '${n}' is not a property of THREE.${this.type}.`);continue}s&&s.isColor?s.set(i):s&&s.isVector2&&i&&i.isVector2||s&&s.isEuler&&i&&i.isEuler||s&&s.isVector3&&i&&i.isVector3?s.copy(i):this[n]=i}}toJSON(e){const n=e===void 0||typeof e=="string";n&&(e={textures:{},images:{}});const i={metadata:{version:4.7,type:"Material",generator:"Material.toJSON"}};i.uuid=this.uuid,i.type=this.type,i.blending=this.blending,i.side=this.side,i.shadowSide=this.shadowSide,i.vertexColors=this.vertexColors,i.opacity=this.opacity,i.transparent=this.transparent,i.blendSrc=this.blendSrc,i.blendDst=this.blendDst,i.blendEquation=this.blendEquation,i.blendSrcAlpha=this.blendSrcAlpha,i.blendDstAlpha=this.blendDstAlpha,i.blendEquationAlpha=this.blendEquationAlpha,i.blendColor=this.blendColor.getHex(),i.blendAlpha=this.blendAlpha,i.depthFunc=this.depthFunc,i.depthTest=this.depthTest,i.depthWrite=this.depthWrite,i.colorWrite=this.colorWrite,i.clipIntersection=this.clipIntersection,i.clipShadows=this.clipShadows,i.stencilWriteMask=this.stencilWriteMask,i.stencilFunc=this.stencilFunc,i.stencilRef=this.stencilRef,i.stencilFuncMask=this.stencilFuncMask,i.stencilFail=this.stencilFail,i.stencilZFail=this.stencilZFail,i.stencilZPass=this.stencilZPass,i.stencilWrite=this.stencilWrite,i.polygonOffset=this.polygonOffset,i.polygonOffsetFactor=this.polygonOffsetFactor,i.polygonOffsetUnits=this.polygonOffsetUnits,i.dithering=this.dithering,i.alphaTest=this.alphaTest,i.alphaHash=this.alphaHash,i.alphaToCoverage=this.alphaToCoverage,i.premultipliedAlpha=this.premultipliedAlpha,i.forceSinglePass=this.forceSinglePass,i.allowOverride=this.allowOverride,i.visible=this.visible,i.toneMapped=this.toneMapped,i.name=this.name,this.color&&this.color.isColor&&(i.color=this.color.getHex()),this.roughness!==void 0&&(i.roughness=this.roughness),this.metalness!==void 0&&(i.metalness=this.metalness),this.sheen!==void 0&&(i.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(i.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(i.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(i.emissive=this.emissive.getHex()),this.emissiveIntensity!==void 0&&(i.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(i.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(i.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(i.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(i.shininess=this.shininess),this.clearcoat!==void 0&&(i.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(i.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(i.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(i.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(i.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,i.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.sheenColorMap&&this.sheenColorMap.isTexture&&(i.sheenColorMap=this.sheenColorMap.toJSON(e).uuid),this.sheenRoughnessMap&&this.sheenRoughnessMap.isTexture&&(i.sheenRoughnessMap=this.sheenRoughnessMap.toJSON(e).uuid),this.dispersion!==void 0&&(i.dispersion=this.dispersion),this.retroreflectivity!==void 0&&(i.retroreflectivity=this.retroreflectivity),this.iridescence!==void 0&&(i.iridescence=this.iridescence),this.iridescenceIOR!==void 0&&(i.iridescenceIOR=this.iridescenceIOR),this.iridescenceThicknessRange!==void 0&&(i.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(i.iridescenceMap=this.iridescenceMap.toJSON(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(i.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid),this.anisotropy!==void 0&&(i.anisotropy=this.anisotropy),this.anisotropyRotation!==void 0&&(i.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(i.anisotropyMap=this.anisotropyMap.toJSON(e).uuid),this.map&&this.map.isTexture&&(i.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(i.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(i.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(i.lightMap=this.lightMap.toJSON(e).uuid,i.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(i.aoMap=this.aoMap.toJSON(e).uuid,i.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(i.bumpMap=this.bumpMap.toJSON(e).uuid,i.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(i.normalMap=this.normalMap.toJSON(e).uuid,i.normalMapType=this.normalMapType,i.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(i.displacementMap=this.displacementMap.toJSON(e).uuid,i.displacementScale=this.displacementScale,i.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(i.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(i.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(i.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(i.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(i.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(i.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(i.envMap=this.envMap.toJSON(e).uuid,this.combine!==void 0&&(i.combine=this.combine)),this.envMapRotation!==void 0&&(i.envMapRotation=this.envMapRotation.toArray()),this.envMapIntensity!==void 0&&(i.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(i.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(i.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(i.gradientMap=this.gradientMap.toJSON(e).uuid),this.transmission!==void 0&&(i.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(i.transmissionMap=this.transmissionMap.toJSON(e).uuid),this.thickness!==void 0&&(i.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(i.thicknessMap=this.thicknessMap.toJSON(e).uuid),this.attenuationDistance!==void 0&&(i.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(i.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(i.size=this.size),this.sizeAttenuation!==void 0&&(i.sizeAttenuation=this.sizeAttenuation),Array.isArray(this.clippingPlanes)&&this.clippingPlanes.length>0&&(i.clippingPlanes=this.clippingPlanes.map(r=>r.toJSON())),this.rotation!==void 0&&(i.rotation=this.rotation),this.depthPacking!==void 0&&(i.depthPacking=this.depthPacking),this.linewidth!==void 0&&(i.linewidth=this.linewidth),this.linecap!==void 0&&(i.linecap=this.linecap),this.linejoin!==void 0&&(i.linejoin=this.linejoin),this.dashSize!==void 0&&(i.dashSize=this.dashSize),this.gapSize!==void 0&&(i.gapSize=this.gapSize),this.scale!==void 0&&(i.scale=this.scale),this.wireframe!==void 0&&(i.wireframe=this.wireframe),this.wireframeLinewidth!==void 0&&(i.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!==void 0&&(i.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!==void 0&&(i.wireframeLinejoin=this.wireframeLinejoin),this.flatShading!==void 0&&(i.flatShading=this.flatShading),this.fog!==void 0&&(i.fog=this.fog),Object.keys(this.userData).length>0&&(i.userData=this.userData);function s(r){const o=[];for(const a in r){const c=r[a];delete c.metadata,o.push(c)}return o}if(n){const r=s(e.textures),o=s(e.images);r.length>0&&(i.textures=r),o.length>0&&(i.images=o)}return i}fromJSON(e,n){if(e.uuid!==void 0&&(this.uuid=e.uuid),e.name!==void 0&&(this.name=e.name),e.color!==void 0&&this.color!==void 0&&this.color.setHex(e.color),e.roughness!==void 0&&(this.roughness=e.roughness),e.metalness!==void 0&&(this.metalness=e.metalness),e.sheen!==void 0&&(this.sheen=e.sheen),e.sheenColor!==void 0&&(this.sheenColor=new ot().setHex(e.sheenColor)),e.sheenRoughness!==void 0&&(this.sheenRoughness=e.sheenRoughness),e.emissive!==void 0&&this.emissive!==void 0&&this.emissive.setHex(e.emissive),e.specular!==void 0&&this.specular!==void 0&&this.specular.setHex(e.specular),e.specularIntensity!==void 0&&(this.specularIntensity=e.specularIntensity),e.specularColor!==void 0&&this.specularColor!==void 0&&this.specularColor.setHex(e.specularColor),e.shininess!==void 0&&(this.shininess=e.shininess),e.clearcoat!==void 0&&(this.clearcoat=e.clearcoat),e.clearcoatRoughness!==void 0&&(this.clearcoatRoughness=e.clearcoatRoughness),e.dispersion!==void 0&&(this.dispersion=e.dispersion),e.retroreflectivity!==void 0&&(this.retroreflectivity=e.retroreflectivity),e.iridescence!==void 0&&(this.iridescence=e.iridescence),e.iridescenceIOR!==void 0&&(this.iridescenceIOR=e.iridescenceIOR),e.iridescenceThicknessRange!==void 0&&(this.iridescenceThicknessRange=e.iridescenceThicknessRange),e.transmission!==void 0&&(this.transmission=e.transmission),e.thickness!==void 0&&(this.thickness=e.thickness),e.attenuationDistance!==void 0&&(this.attenuationDistance=e.attenuationDistance),e.attenuationColor!==void 0&&this.attenuationColor!==void 0&&this.attenuationColor.setHex(e.attenuationColor),e.anisotropy!==void 0&&(this.anisotropy=e.anisotropy),e.anisotropyRotation!==void 0&&(this.anisotropyRotation=e.anisotropyRotation),e.fog!==void 0&&(this.fog=e.fog),e.flatShading!==void 0&&(this.flatShading=e.flatShading),e.blending!==void 0&&(this.blending=e.blending),e.combine!==void 0&&(this.combine=e.combine),e.side!==void 0&&(this.side=e.side),e.shadowSide!==void 0&&(this.shadowSide=e.shadowSide),e.opacity!==void 0&&(this.opacity=e.opacity),e.transparent!==void 0&&(this.transparent=e.transparent),e.alphaTest!==void 0&&(this.alphaTest=e.alphaTest),e.alphaHash!==void 0&&(this.alphaHash=e.alphaHash),e.depthFunc!==void 0&&(this.depthFunc=e.depthFunc),e.depthTest!==void 0&&(this.depthTest=e.depthTest),e.depthWrite!==void 0&&(this.depthWrite=e.depthWrite),e.colorWrite!==void 0&&(this.colorWrite=e.colorWrite),e.clippingPlanes!==void 0&&(this.clippingPlanes=e.clippingPlanes.map(i=>new Ri().fromJSON(i))),e.clipIntersection!==void 0&&(this.clipIntersection=e.clipIntersection),e.clipShadows!==void 0&&(this.clipShadows=e.clipShadows),e.depthPacking!==void 0&&(this.depthPacking=e.depthPacking),e.blendSrc!==void 0&&(this.blendSrc=e.blendSrc),e.blendDst!==void 0&&(this.blendDst=e.blendDst),e.blendEquation!==void 0&&(this.blendEquation=e.blendEquation),e.blendSrcAlpha!==void 0&&(this.blendSrcAlpha=e.blendSrcAlpha),e.blendDstAlpha!==void 0&&(this.blendDstAlpha=e.blendDstAlpha),e.blendEquationAlpha!==void 0&&(this.blendEquationAlpha=e.blendEquationAlpha),e.blendColor!==void 0&&this.blendColor!==void 0&&this.blendColor.setHex(e.blendColor),e.blendAlpha!==void 0&&(this.blendAlpha=e.blendAlpha),e.stencilWriteMask!==void 0&&(this.stencilWriteMask=e.stencilWriteMask),e.stencilFunc!==void 0&&(this.stencilFunc=e.stencilFunc),e.stencilRef!==void 0&&(this.stencilRef=e.stencilRef),e.stencilFuncMask!==void 0&&(this.stencilFuncMask=e.stencilFuncMask),e.stencilFail!==void 0&&(this.stencilFail=e.stencilFail),e.stencilZFail!==void 0&&(this.stencilZFail=e.stencilZFail),e.stencilZPass!==void 0&&(this.stencilZPass=e.stencilZPass),e.stencilWrite!==void 0&&(this.stencilWrite=e.stencilWrite),e.wireframe!==void 0&&(this.wireframe=e.wireframe),e.wireframeLinewidth!==void 0&&(this.wireframeLinewidth=e.wireframeLinewidth),e.wireframeLinecap!==void 0&&(this.wireframeLinecap=e.wireframeLinecap),e.wireframeLinejoin!==void 0&&(this.wireframeLinejoin=e.wireframeLinejoin),e.rotation!==void 0&&(this.rotation=e.rotation),e.linewidth!==void 0&&(this.linewidth=e.linewidth),e.linecap!==void 0&&(this.linecap=e.linecap),e.linejoin!==void 0&&(this.linejoin=e.linejoin),e.dashSize!==void 0&&(this.dashSize=e.dashSize),e.gapSize!==void 0&&(this.gapSize=e.gapSize),e.scale!==void 0&&(this.scale=e.scale),e.polygonOffset!==void 0&&(this.polygonOffset=e.polygonOffset),e.polygonOffsetFactor!==void 0&&(this.polygonOffsetFactor=e.polygonOffsetFactor),e.polygonOffsetUnits!==void 0&&(this.polygonOffsetUnits=e.polygonOffsetUnits),e.dithering!==void 0&&(this.dithering=e.dithering),e.alphaToCoverage!==void 0&&(this.alphaToCoverage=e.alphaToCoverage),e.premultipliedAlpha!==void 0&&(this.premultipliedAlpha=e.premultipliedAlpha),e.forceSinglePass!==void 0&&(this.forceSinglePass=e.forceSinglePass),e.allowOverride!==void 0&&(this.allowOverride=e.allowOverride),e.visible!==void 0&&(this.visible=e.visible),e.toneMapped!==void 0&&(this.toneMapped=e.toneMapped),e.userData!==void 0&&(this.userData=e.userData),e.vertexColors!==void 0&&(typeof e.vertexColors=="number"?this.vertexColors=e.vertexColors>0:this.vertexColors=e.vertexColors),e.size!==void 0&&(this.size=e.size),e.sizeAttenuation!==void 0&&(this.sizeAttenuation=e.sizeAttenuation),e.map!==void 0&&(this.map=n[e.map]||null),e.matcap!==void 0&&(this.matcap=n[e.matcap]||null),e.alphaMap!==void 0&&(this.alphaMap=n[e.alphaMap]||null),e.bumpMap!==void 0&&(this.bumpMap=n[e.bumpMap]||null),e.bumpScale!==void 0&&(this.bumpScale=e.bumpScale),e.normalMap!==void 0&&(this.normalMap=n[e.normalMap]||null),e.normalMapType!==void 0&&(this.normalMapType=e.normalMapType),e.normalScale!==void 0){let i=e.normalScale;Array.isArray(i)===!1&&(i=[i,i]),this.normalScale=new Ke().fromArray(i)}return e.displacementMap!==void 0&&(this.displacementMap=n[e.displacementMap]||null),e.displacementScale!==void 0&&(this.displacementScale=e.displacementScale),e.displacementBias!==void 0&&(this.displacementBias=e.displacementBias),e.roughnessMap!==void 0&&(this.roughnessMap=n[e.roughnessMap]||null),e.metalnessMap!==void 0&&(this.metalnessMap=n[e.metalnessMap]||null),e.emissiveMap!==void 0&&(this.emissiveMap=n[e.emissiveMap]||null),e.emissiveIntensity!==void 0&&(this.emissiveIntensity=e.emissiveIntensity),e.specularMap!==void 0&&(this.specularMap=n[e.specularMap]||null),e.specularIntensityMap!==void 0&&(this.specularIntensityMap=n[e.specularIntensityMap]||null),e.specularColorMap!==void 0&&(this.specularColorMap=n[e.specularColorMap]||null),e.envMap!==void 0&&(this.envMap=n[e.envMap]||null),e.envMapRotation!==void 0&&this.envMapRotation.fromArray(e.envMapRotation),e.envMapIntensity!==void 0&&(this.envMapIntensity=e.envMapIntensity),e.reflectivity!==void 0&&(this.reflectivity=e.reflectivity),e.refractionRatio!==void 0&&(this.refractionRatio=e.refractionRatio),e.lightMap!==void 0&&(this.lightMap=n[e.lightMap]||null),e.lightMapIntensity!==void 0&&(this.lightMapIntensity=e.lightMapIntensity),e.aoMap!==void 0&&(this.aoMap=n[e.aoMap]||null),e.aoMapIntensity!==void 0&&(this.aoMapIntensity=e.aoMapIntensity),e.gradientMap!==void 0&&(this.gradientMap=n[e.gradientMap]||null),e.clearcoatMap!==void 0&&(this.clearcoatMap=n[e.clearcoatMap]||null),e.clearcoatRoughnessMap!==void 0&&(this.clearcoatRoughnessMap=n[e.clearcoatRoughnessMap]||null),e.clearcoatNormalMap!==void 0&&(this.clearcoatNormalMap=n[e.clearcoatNormalMap]||null),e.clearcoatNormalScale!==void 0&&(this.clearcoatNormalScale=new Ke().fromArray(e.clearcoatNormalScale)),e.iridescenceMap!==void 0&&(this.iridescenceMap=n[e.iridescenceMap]||null),e.iridescenceThicknessMap!==void 0&&(this.iridescenceThicknessMap=n[e.iridescenceThicknessMap]||null),e.transmissionMap!==void 0&&(this.transmissionMap=n[e.transmissionMap]||null),e.thicknessMap!==void 0&&(this.thicknessMap=n[e.thicknessMap]||null),e.anisotropyMap!==void 0&&(this.anisotropyMap=n[e.anisotropyMap]||null),e.sheenColorMap!==void 0&&(this.sheenColorMap=n[e.sheenColorMap]||null),e.sheenRoughnessMap!==void 0&&(this.sheenRoughnessMap=n[e.sheenRoughnessMap]||null),this}clone(){return new this.constructor().copy(this)}copy(e){this.name=e.name,this.blending=e.blending,this.side=e.side,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.blendColor.copy(e.blendColor),this.blendAlpha=e.blendAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;const n=e.clippingPlanes;let i=null;if(n!==null){const s=n.length;i=new Array(s);for(let r=0;r!==s;++r)i[r]=n[r].clone()}return this.clippingPlanes=i,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipShadows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.alphaHash=e.alphaHash,this.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.forceSinglePass=e.forceSinglePass,this.allowOverride=e.allowOverride,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(e){e===!0&&this.version++}}const Ei=new H,Hc=new H,Po=new H,Io=new H;class vd{constructor(e=new H,n=new H(0,0,-1)){this.origin=e,this.direction=n}set(e,n){return this.origin.copy(e),this.direction.copy(n),this}copy(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this}at(e,n){return n.copy(this.origin).addScaledVector(this.direction,e)}lookAt(e){return this.direction.copy(e).sub(this.origin).normalize(),this}recast(e){return this.origin.copy(this.at(e,Ei)),this}closestPointToPoint(e,n){n.subVectors(e,this.origin);const i=n.dot(this.direction);return i<0?n.copy(this.origin):n.copy(this.origin).addScaledVector(this.direction,i)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){const n=Ei.subVectors(e,this.origin).dot(this.direction);return n<0?this.origin.distanceToSquared(e):(Ei.copy(this.origin).addScaledVector(this.direction,n),Ei.distanceToSquared(e))}distanceSqToSegment(e,n,i,s){Hc.copy(e).add(n).multiplyScalar(.5),Po.copy(n).sub(e).normalize(),Io.copy(this.origin).sub(Hc);const r=e.distanceTo(n)*.5,o=-this.direction.dot(Po),a=Io.dot(this.direction),c=-Io.dot(Po),l=Io.lengthSq(),u=Math.abs(1-o*o);let h,d,f,_;if(u>0)if(h=o*c-a,d=o*a-c,_=r*u,h>=0)if(d>=-_)if(d<=_){const x=1/u;h*=x,d*=x,f=h*(h+o*d+2*a)+d*(o*h+d+2*c)+l}else d=r,h=Math.max(0,-(o*d+a)),f=-h*h+d*(d+2*c)+l;else d=-r,h=Math.max(0,-(o*d+a)),f=-h*h+d*(d+2*c)+l;else d<=-_?(h=Math.max(0,-(-o*r+a)),d=h>0?-r:Math.min(Math.max(-r,-c),r),f=-h*h+d*(d+2*c)+l):d<=_?(h=0,d=Math.min(Math.max(-r,-c),r),f=d*(d+2*c)+l):(h=Math.max(0,-(o*r+a)),d=h>0?r:Math.min(Math.max(-r,-c),r),f=-h*h+d*(d+2*c)+l);else d=o>0?-r:r,h=Math.max(0,-(o*d+a)),f=-h*h+d*(d+2*c)+l;return i&&i.copy(this.origin).addScaledVector(this.direction,h),s&&s.copy(Hc).addScaledVector(Po,d),f}intersectSphere(e,n){if(e.radius<0)return null;Ei.subVectors(e.center,this.origin);const i=Ei.dot(this.direction),s=Ei.dot(Ei)-i*i,r=e.radius*e.radius;if(s>r)return null;const o=Math.sqrt(r-s),a=i-o,c=i+o;return c<0?null:a<0?this.at(c,n):this.at(a,n)}intersectsSphere(e){return e.radius<0?!1:this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){const n=e.normal.dot(this.direction);if(n===0)return e.distanceToPoint(this.origin)===0?0:null;const i=-(this.origin.dot(e.normal)+e.constant)/n;return i>=0?i:null}intersectPlane(e,n){const i=this.distanceToPlane(e);return i===null?null:this.at(i,n)}intersectsPlane(e){const n=e.distanceToPoint(this.origin);return n===0||e.normal.dot(this.direction)*n<0}intersectBox(e,n){let i,s,r,o,a,c;const l=1/this.direction.x,u=1/this.direction.y,h=1/this.direction.z,d=this.origin;return l>=0?(i=(e.min.x-d.x)*l,s=(e.max.x-d.x)*l):(i=(e.max.x-d.x)*l,s=(e.min.x-d.x)*l),u>=0?(r=(e.min.y-d.y)*u,o=(e.max.y-d.y)*u):(r=(e.max.y-d.y)*u,o=(e.min.y-d.y)*u),i>o||r>s||((r>i||isNaN(i))&&(i=r),(o<s||isNaN(s))&&(s=o),h>=0?(a=(e.min.z-d.z)*h,c=(e.max.z-d.z)*h):(a=(e.max.z-d.z)*h,c=(e.min.z-d.z)*h),i>c||a>s)||((a>i||i!==i)&&(i=a),(c<s||s!==s)&&(s=c),s<0)?null:this.at(i>=0?i:s,n)}intersectsBox(e){return this.intersectBox(e,Ei)!==null}intersectTriangle(e,n,i,s,r){const o=this.origin,a=this.direction,c=a.x,l=a.y,u=a.z,h=e.x-o.x,d=e.y-o.y,f=e.z-o.z,_=n.x-o.x,x=n.y-o.y,m=n.z-o.z,p=i.x-o.x,E=i.y-o.y,L=i.z-o.z,b=Math.abs(c),w=Math.abs(l),A=Math.abs(u);let P,v,T,I,N,k,$,U,V,Q,X,ce;if(b>=w&&b>=A?(T=c,k=h,V=_,ce=p,c>=0?(P=l,v=u,I=d,N=f,$=x,U=m,Q=E,X=L):(P=u,v=l,I=f,N=d,$=m,U=x,Q=L,X=E)):w>=A?(T=l,k=d,V=x,ce=E,l>=0?(P=u,v=c,I=f,N=h,$=m,U=_,Q=L,X=p):(P=c,v=u,I=h,N=f,$=_,U=m,Q=p,X=L)):(T=u,k=f,V=m,ce=L,u>=0?(P=c,v=l,I=h,N=d,$=_,U=x,Q=p,X=E):(P=l,v=c,I=d,N=h,$=x,U=_,Q=E,X=p)),T===0)return null;const j=P/T,se=v/T,oe=1/T,Fe=I-j*k,Le=N-se*k,ft=$-j*V,et=U-se*V,je=Q-j*ce,Y=X-se*ce,re=je*et-Y*ft,Re=Fe*Y-Le*je,Ve=ft*Le-et*Fe;if(s){if(re<0||Re<0||Ve<0)return null}else if((re<0||Re<0||Ve<0)&&(re>0||Re>0||Ve>0))return null;const Me=re+Re+Ve;if(Me===0)return null;const $e=oe*(re*k+Re*V+Ve*ce);return(Me>0?$e<0:$e>0)?null:this.at($e/Me,r)}applyMatrix4(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this}equals(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}clone(){return new this.constructor().copy(this)}}class Ja extends ro{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new ot(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new bs,this.combine=R_,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}}const jh=new Gt,as=new vd,Lo=new ja,Jh=new H,No=new H,Do=new H,Uo=new H,Vc=new H,Oo=new H,Qh=new H,Fo=new H;class ei extends bn{constructor(e=new Mn,n=new Ja){super(),this.isMesh=!0,this.type="Mesh",this.geometry=e,this.material=n,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.count=1,this.updateMorphTargets()}copy(e,n){return super.copy(e,n),e.morphTargetInfluences!==void 0&&(this.morphTargetInfluences=e.morphTargetInfluences.slice()),e.morphTargetDictionary!==void 0&&(this.morphTargetDictionary=Object.assign({},e.morphTargetDictionary)),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}updateMorphTargets(){const n=this.geometry.morphAttributes,i=Object.keys(n);if(i.length>0){const s=n[i[0]];if(s!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let r=0,o=s.length;r<o;r++){const a=s[r].name||String(r);this.morphTargetInfluences.push(0),this.morphTargetDictionary[a]=r}}}}getVertexPosition(e,n){const i=this.geometry,s=i.attributes.position,r=i.morphAttributes.position,o=i.morphTargetsRelative;n.fromBufferAttribute(s,e);const a=this.morphTargetInfluences;if(r&&a){Oo.set(0,0,0);for(let c=0,l=r.length;c<l;c++){const u=a[c],h=r[c];u!==0&&(Vc.fromBufferAttribute(h,e),o?Oo.addScaledVector(Vc,u):Oo.addScaledVector(Vc.sub(n),u))}n.add(Oo)}return n}intersectsFrustum(e){return e.intersectsObject(this)}raycast(e,n){const i=this.geometry,s=this.material,r=this.matrixWorld;s!==void 0&&(i.boundingSphere===null&&i.computeBoundingSphere(),Lo.copy(i.boundingSphere),Lo.applyMatrix4(r),as.copy(e.ray).recast(e.near),!(Lo.containsPoint(as.origin)===!1&&(as.intersectSphere(Lo,Jh)===null||as.origin.distanceToSquared(Jh)>(e.far-e.near)**2))&&(jh.copy(r).invert(),as.copy(e.ray).applyMatrix4(jh),!(i.boundingBox!==null&&as.intersectsBox(i.boundingBox)===!1)&&this._computeIntersections(e,n,as)))}_computeIntersections(e,n,i){let s;const r=this.geometry,o=this.material,a=r.index,c=r.attributes.position,l=r.attributes.uv,u=r.attributes.uv1,h=r.attributes.normal,d=r.groups,f=r.drawRange;if(a!==null)if(Array.isArray(o))for(let _=0,x=d.length;_<x;_++){const m=d[_],p=o[m.materialIndex],E=Math.max(m.start,f.start),L=Math.min(a.count,Math.min(m.start+m.count,f.start+f.count));for(let b=E,w=L;b<w;b+=3){const A=a.getX(b),P=a.getX(b+1),v=a.getX(b+2);s=ko(this,p,e,i,l,u,h,A,P,v),s&&(s.faceIndex=Math.floor(b/3),s.face.materialIndex=m.materialIndex,n.push(s))}}else{const _=Math.max(0,f.start),x=Math.min(a.count,f.start+f.count);for(let m=_,p=x;m<p;m+=3){const E=a.getX(m),L=a.getX(m+1),b=a.getX(m+2);s=ko(this,o,e,i,l,u,h,E,L,b),s&&(s.faceIndex=Math.floor(m/3),n.push(s))}}else if(c!==void 0)if(Array.isArray(o))for(let _=0,x=d.length;_<x;_++){const m=d[_],p=o[m.materialIndex],E=Math.max(m.start,f.start),L=Math.min(c.count,Math.min(m.start+m.count,f.start+f.count));for(let b=E,w=L;b<w;b+=3){const A=b,P=b+1,v=b+2;s=ko(this,p,e,i,l,u,h,A,P,v),s&&(s.faceIndex=Math.floor(b/3),s.face.materialIndex=m.materialIndex,n.push(s))}}else{const _=Math.max(0,f.start),x=Math.min(c.count,f.start+f.count);for(let m=_,p=x;m<p;m+=3){const E=m,L=m+1,b=m+2;s=ko(this,o,e,i,l,u,h,E,L,b),s&&(s.faceIndex=Math.floor(m/3),n.push(s))}}}}function pw(t,e,n,i,s,r,o,a){let c;if(e.side===Rn?c=i.intersectTriangle(o,r,s,!0,a):c=i.intersectTriangle(s,r,o,e.side===vs,a),c===null)return null;Fo.copy(a),Fo.applyMatrix4(t.matrixWorld);const l=n.ray.origin.distanceTo(Fo);return l<n.near||l>n.far?null:{distance:l,point:Fo.clone(),object:t}}function ko(t,e,n,i,s,r,o,a,c,l){t.getVertexPosition(a,No),t.getVertexPosition(c,Do),t.getVertexPosition(l,Uo);const u=pw(t,e,n,i,No,Do,Uo,Qh);if(u){const h=new H;Xn.getBarycoord(Qh,No,Do,Uo,h),s&&(u.uv=Xn.getInterpolatedAttribute(s,a,c,l,h,new Ke)),r&&(u.uv1=Xn.getInterpolatedAttribute(r,a,c,l,h,new Ke)),o&&(u.normal=Xn.getInterpolatedAttribute(o,a,c,l,h,new H),u.normal.dot(i.direction)>0&&u.normal.multiplyScalar(-1));const d={a,b:c,c:l,normal:new H,materialIndex:0};Xn.getNormal(No,Do,Uo,d.normal),u.face=d,u.barycoord=h}return u}class mw extends yn{constructor(e=null,n=1,i=1,s,r,o,a,c,l=on,u=on,h,d){super(null,o,a,c,l,u,s,r,h,d),this.isDataTexture=!0,this.image={data:e,width:n,height:i},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}const cs=new ja,gw=new Ke(.5,.5),zo=new H;class Y_{constructor(e=new Ri,n=new Ri,i=new Ri,s=new Ri,r=new Ri,o=new Ri){this.planes=[e,n,i,s,r,o]}set(e,n,i,s,r,o){const a=this.planes;return a[0].copy(e),a[1].copy(n),a[2].copy(i),a[3].copy(s),a[4].copy(r),a[5].copy(o),this}copy(e){const n=this.planes;for(let i=0;i<6;i++)n[i].copy(e.planes[i]);return this}setFromProjectionMatrix(e,n=di,i=!1){const s=this.planes,r=e.elements,o=r[0],a=r[1],c=r[2],l=r[3],u=r[4],h=r[5],d=r[6],f=r[7],_=r[8],x=r[9],m=r[10],p=r[11],E=r[12],L=r[13],b=r[14],w=r[15];if(s[0].setComponents(l-o,f-u,p-_,w-E).normalize(),s[1].setComponents(l+o,f+u,p+_,w+E).normalize(),s[2].setComponents(l+a,f+h,p+x,w+L).normalize(),s[3].setComponents(l-a,f-h,p-x,w-L).normalize(),i)s[4].setComponents(c,d,m,b).normalize(),s[5].setComponents(l-c,f-d,p-m,w-b).normalize();else if(s[4].setComponents(l-c,f-d,p-m,w-b).normalize(),n===di)s[5].setComponents(l+c,f+d,p+m,w+b).normalize();else if(n===va)s[5].setComponents(c,d,m,b).normalize();else throw new Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+n);return this}intersectsObject(e){if(e.boundingSphere!==void 0)e.boundingSphere===null&&e.computeBoundingSphere(),cs.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{const n=e.geometry;n.boundingSphere===null&&n.computeBoundingSphere(),cs.copy(n.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(cs)}intersectsSprite(e){cs.center.set(0,0,0);const n=gw.distanceTo(e.center);return cs.radius=.7071067811865476+n,cs.applyMatrix4(e.matrixWorld),this.intersectsSphere(cs)}intersectsSphere(e){const n=this.planes,i=e.center,s=-e.radius;for(let r=0;r<6;r++)if(n[r].distanceToPoint(i)<s)return!1;return!0}intersectsBox(e){const n=this.planes;for(let i=0;i<6;i++){const s=n[i];if(zo.x=s.normal.x>0?e.max.x:e.min.x,zo.y=s.normal.y>0?e.max.y:e.min.y,zo.z=s.normal.z>0?e.max.z:e.min.z,s.distanceToPoint(zo)<0)return!1}return!0}containsPoint(e){const n=this.planes;for(let i=0;i<6;i++)if(n[i].distanceToPoint(e)<0)return!1;return!0}clone(){return new this.constructor().copy(this)}}class oo extends ro{constructor(e){super(),this.isLineBasicMaterial=!0,this.type="LineBasicMaterial",this.color=new ot(16777215),this.map=null,this.linewidth=1,this.linecap="round",this.linejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.linewidth=e.linewidth,this.linecap=e.linecap,this.linejoin=e.linejoin,this.fog=e.fog,this}}const ya=new H,ba=new H,ef=new Gt,Rr=new vd,Bo=new ja,Gc=new H,tf=new H;class _w extends bn{constructor(e=new Mn,n=new oo){super(),this.isLine=!0,this.type="Line",this.geometry=e,this.material=n,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.updateMorphTargets()}copy(e,n){return super.copy(e,n),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}computeLineDistances(){const e=this.geometry;if(e.index===null){const n=e.attributes.position,i=[0];for(let s=1,r=n.count;s<r;s++)ya.fromBufferAttribute(n,s-1),ba.fromBufferAttribute(n,s),i[s]=i[s-1],i[s]+=ya.distanceTo(ba);e.setAttribute("lineDistance",new tn(i,1))}else Ge("Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}intersectsFrustum(e){return e.intersectsObject(this)}raycast(e,n){const i=this.geometry,s=this.matrixWorld,r=e.params.Line.threshold,o=i.drawRange;if(i.boundingSphere===null&&i.computeBoundingSphere(),Bo.copy(i.boundingSphere),Bo.applyMatrix4(s),Bo.radius+=r,e.ray.intersectsSphere(Bo)===!1)return;ef.copy(s).invert(),Rr.copy(e.ray).applyMatrix4(ef);const a=r/((this.scale.x+this.scale.y+this.scale.z)/3),c=a*a,l=this.isLineSegments?2:1,u=i.index,d=i.attributes.position;if(u!==null){const f=Math.max(0,o.start),_=Math.min(u.count,o.start+o.count);for(let x=f,m=_-1;x<m;x+=l){const p=u.getX(x),E=u.getX(x+1),L=Ho(this,e,Rr,c,p,E,x);L&&n.push(L)}if(this.isLineLoop){const x=u.getX(_-1),m=u.getX(f),p=Ho(this,e,Rr,c,x,m,_-1);p&&n.push(p)}}else{const f=Math.max(0,o.start),_=Math.min(d.count,o.start+o.count);for(let x=f,m=_-1;x<m;x+=l){const p=Ho(this,e,Rr,c,x,x+1,x);p&&n.push(p)}if(this.isLineLoop){const x=Ho(this,e,Rr,c,_-1,f,_-1);x&&n.push(x)}}}updateMorphTargets(){const n=this.geometry.morphAttributes,i=Object.keys(n);if(i.length>0){const s=n[i[0]];if(s!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let r=0,o=s.length;r<o;r++){const a=s[r].name||String(r);this.morphTargetInfluences.push(0),this.morphTargetDictionary[a]=r}}}}}function Ho(t,e,n,i,s,r,o){const a=t.geometry.attributes.position;if(ya.fromBufferAttribute(a,s),ba.fromBufferAttribute(a,r),n.distanceSqToSegment(ya,ba,Gc,tf)>i)return;Gc.applyMatrix4(t.matrixWorld);const l=e.ray.origin.distanceTo(Gc);if(!(l<e.near||l>e.far))return{distance:l,point:tf.clone().applyMatrix4(t.matrixWorld),index:o,face:null,faceIndex:null,barycoord:null,object:t}}const nf=new H,sf=new H;class Ma extends _w{constructor(e,n){super(e,n),this.isLineSegments=!0,this.type="LineSegments"}computeLineDistances(){const e=this.geometry;if(e.index===null){const n=e.attributes.position,i=[];for(let s=0,r=n.count;s<r;s+=2)nf.fromBufferAttribute(n,s),sf.fromBufferAttribute(n,s+1),i[s]=s===0?0:i[s-1],i[s+1]=i[s]+nf.distanceTo(sf);e.setAttribute("lineDistance",new tn(i,1))}else Ge("LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}}class K_ extends yn{constructor(e=[],n=xs,i,s,r,o,a,c,l,u){super(e,n,i,s,r,o,a,c,l,u),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}}class eo extends yn{constructor(e,n,i=fi,s,r,o,a=on,c=on,l,u=Ni,h=1){if(u!==Ni&&u!==ds)throw new Error("THREE.DepthTexture: format must be either THREE.DepthFormat or THREE.DepthStencilFormat");const d={width:e,height:n,depth:h};super(d,s,r,o,a,c,u,i,l),this.isDepthTexture=!0,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(e){return super.copy(e),this.source=new Sd(Object.assign({},e.image)),this.compareFunction=e.compareFunction,this}toJSON(e){const n=super.toJSON(e);return n.compareFunction=this.compareFunction,n}}class Sw extends eo{constructor(e,n=fi,i=xs,s,r,o=on,a=on,c,l=Ni){const u={width:e,height:e,depth:1},h=[u,u,u,u,u,u];super(e,e,n,i,s,r,o,a,c,l),this.image=h,this.isCubeDepthTexture=!0,this.isCubeTexture=!0}get images(){return this.image}set images(e){this.image=e}}class j_ extends yn{constructor(e=null){super(),this.sourceTexture=e,this.isExternalTexture=!0}copy(e){return super.copy(e),this.sourceTexture=e.sourceTexture,this}}class ao extends Mn{constructor(e=1,n=1,i=1,s=1,r=1,o=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:n,depth:i,widthSegments:s,heightSegments:r,depthSegments:o};const a=this;s=Math.floor(s),r=Math.floor(r),o=Math.floor(o);const c=[],l=[],u=[],h=[];let d=0,f=0;_("z","y","x",-1,-1,i,n,e,o,r,0),_("z","y","x",1,-1,i,n,-e,o,r,1),_("x","z","y",1,1,e,i,n,s,o,2),_("x","z","y",1,-1,e,i,-n,s,o,3),_("x","y","z",1,-1,e,n,i,s,r,4),_("x","y","z",-1,-1,e,n,-i,s,r,5),this.setIndex(c),this.setAttribute("position",new tn(l,3)),this.setAttribute("normal",new tn(u,3)),this.setAttribute("uv",new tn(h,2));function _(x,m,p,E,L,b,w,A,P,v,T){const I=b/P,N=w/v,k=b/2,$=w/2,U=A/2,V=P+1,Q=v+1;let X=0,ce=0;const j=new H;for(let se=0;se<Q;se++){const oe=se*N-$;for(let Fe=0;Fe<V;Fe++){const Le=Fe*I-k;j[x]=Le*E,j[m]=oe*L,j[p]=U,l.push(j.x,j.y,j.z),j[x]=0,j[m]=0,j[p]=A>0?1:-1,u.push(j.x,j.y,j.z),h.push(Fe/P),h.push(1-se/v),X+=1}}for(let se=0;se<v;se++)for(let oe=0;oe<P;oe++){const Fe=d+oe+V*se,Le=d+oe+V*(se+1),ft=d+(oe+1)+V*(se+1),et=d+(oe+1)+V*se;c.push(Fe,Le,et),c.push(Le,ft,et),ce+=6}a.addGroup(f,ce,T),f+=ce,d+=X}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new ao(e.width,e.height,e.depth,e.widthSegments,e.heightSegments,e.depthSegments)}}class xd extends Mn{constructor(e=1,n=1,i=1,s=32,r=1,o=!1,a=0,c=Math.PI*2){super(),this.type="CylinderGeometry",this.parameters={radiusTop:e,radiusBottom:n,height:i,radialSegments:s,heightSegments:r,openEnded:o,thetaStart:a,thetaLength:c};const l=this;s=Math.floor(s),r=Math.floor(r);const u=[],h=[],d=[],f=[];let _=0;const x=[],m=i/2;let p=0;E(),o===!1&&(e>0&&L(!0),n>0&&L(!1)),this.setIndex(u),this.setAttribute("position",new tn(h,3)),this.setAttribute("normal",new tn(d,3)),this.setAttribute("uv",new tn(f,2));function E(){const b=new H,w=new H;let A=0;const P=(n-e)/i;for(let v=0;v<=r;v++){const T=[],I=v/r,N=I*(n-e)+e;for(let k=0;k<=s;k++){const $=k/s,U=$*c+a,V=Math.sin(U),Q=Math.cos(U);w.x=N*V,w.y=-I*i+m,w.z=N*Q,h.push(w.x,w.y,w.z),b.set(V,P,Q).normalize(),d.push(b.x,b.y,b.z),f.push($,1-I),T.push(_++)}x.push(T)}for(let v=0;v<s;v++)for(let T=0;T<r;T++){const I=x[T][v],N=x[T+1][v],k=x[T+1][v+1],$=x[T][v+1];(e>0||T!==0)&&(u.push(I,N,$),A+=3),(n>0||T!==r-1)&&(u.push(N,k,$),A+=3)}l.addGroup(p,A,0),p+=A}function L(b){const w=_,A=new Ke,P=new H;let v=0;const T=b===!0?e:n,I=b===!0?1:-1;for(let k=1;k<=s;k++)h.push(0,m*I,0),d.push(0,I,0),f.push(.5,.5),_++;const N=_;for(let k=0;k<=s;k++){const U=k/s*c+a,V=Math.cos(U),Q=Math.sin(U);P.x=T*Q,P.y=m*I,P.z=T*V,h.push(P.x,P.y,P.z),d.push(0,I,0),A.x=V*.5+.5,A.y=Q*.5*I+.5,f.push(A.x,A.y),_++}for(let k=0;k<s;k++){const $=w+k,U=N+k;b===!0?u.push(U,U+1,$):u.push(U+1,U,$),v+=3}l.addGroup(p,v,b===!0?1:2),p+=v}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new xd(e.radiusTop,e.radiusBottom,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}}class Qa extends xd{constructor(e=1,n=1,i=32,s=1,r=!1,o=0,a=Math.PI*2){super(0,e,n,i,s,r,o,a),this.type="ConeGeometry",this.parameters={radius:e,height:n,radialSegments:i,heightSegments:s,openEnded:r,thetaStart:o,thetaLength:a}}static fromJSON(e){return new Qa(e.radius,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}}class ec extends Mn{constructor(e=1,n=1,i=1,s=1){super(),this.type="PlaneGeometry",this.parameters={width:e,height:n,widthSegments:i,heightSegments:s};const r=e/2,o=n/2,a=Math.floor(i),c=Math.floor(s),l=a+1,u=c+1,h=e/a,d=n/c,f=[],_=[],x=[],m=[];for(let p=0;p<u;p++){const E=p*d-o;for(let L=0;L<l;L++){const b=L*h-r;_.push(b,-E,0),x.push(0,0,1),m.push(L/a),m.push(1-p/c)}}for(let p=0;p<c;p++)for(let E=0;E<a;E++){const L=E+l*p,b=E+l*(p+1),w=E+1+l*(p+1),A=E+1+l*p;f.push(L,b,A),f.push(b,w,A)}this.setIndex(f),this.setAttribute("position",new tn(_,3)),this.setAttribute("normal",new tn(x,3)),this.setAttribute("uv",new tn(m,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new ec(e.width,e.height,e.widthSegments,e.heightSegments)}}function ar(t){const e={};for(const n in t){e[n]={};for(const i in t[n]){const s=t[n][i];if(rf(s))s.isRenderTargetTexture?(Ge("UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms()."),e[n][i]=null):e[n][i]=s.clone();else if(Array.isArray(s))if(rf(s[0])){const r=[];for(let o=0,a=s.length;o<a;o++)r[o]=s[o].clone();e[n][i]=r}else e[n][i]=s.slice();else e[n][i]=s}}return e}function vn(t){const e={};for(let n=0;n<t.length;n++){const i=ar(t[n]);for(const s in i)e[s]=i[s]}return e}function rf(t){return t&&(t.isColor||t.isMatrix3||t.isMatrix4||t.isVector2||t.isVector3||t.isVector4||t.isTexture||t.isQuaternion)}function vw(t){const e=[];for(let n=0;n<t.length;n++)e.push(t[n].clone());return e}function J_(t){const e=t.getRenderTarget();return e===null?t.outputColorSpace:e.isXRRenderTarget===!0?e.texture.colorSpace:dt.workingColorSpace}const xw={clone:ar,merge:vn};var yw=`void main() {
|
|
110
|
+
*/const Nd="186",rr={ROTATE:0,DOLLY:1,PAN:2},nr={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},jR=0,ff=1,JR=2,oa=1,QR=2,$r=3,As=0,Cn=1,Ni=2,Oi=0,Kr=1,pf=2,mf=3,gf=4,ew=5,Qs=100,tw=101,nw=102,iw=103,sw=104,rw=200,ow=201,aw=202,cw=203,uS=204,dS=205,lw=206,uw=207,dw=208,hw=209,fw=210,pw=211,mw=212,gw=213,_w=214,zl=0,Bl=1,Hl=2,co=3,Vl=4,Gl=5,$l=6,ql=7,hS=0,Sw=1,vw=2,_i=0,fS=1,pS=2,mS=3,gS=4,_S=5,SS=6,vS=7,xS=300,Cs=301,vr=302,zc=303,Bc=304,lc=306,Wl=1e3,Ui=1001,Zl=1002,ln=1003,xw=1004,Lo=1005,_n=1006,Hc=1007,ys=1008,$n=1009,yS=1010,bS=1011,lo=1012,Dd=1013,vi=1014,mi=1015,xi=1016,Ud=1017,Od=1018,uo=1020,MS=35902,ES=35899,TS=1021,RS=1022,Qn=1023,zi=1026,bs=1027,wS=1028,Fd=1029,Ps=1030,kd=1031,zd=1033,aa=33776,ca=33777,la=33778,ua=33779,Xl=35840,Yl=35841,Kl=35842,jl=35843,Jl=36196,Ql=37492,eu=37496,tu=37488,nu=37489,Ra=37490,iu=37491,su=37808,ru=37809,ou=37810,au=37811,cu=37812,lu=37813,uu=37814,du=37815,hu=37816,fu=37817,pu=37818,mu=37819,gu=37820,_u=37821,Su=36492,vu=36494,xu=36495,yu=36283,bu=36284,wa=36285,Mu=36286,yw=3200,_f=0,bw=1,ts="",Vn="srgb",Aa="srgb-linear",Ca="linear",Et="srgb",Vc=7680,Mw=519,Ew=512,Tw=513,Rw=514,Bd=515,ww=516,Aw=517,Hd=518,Cw=519,Pw=35044,Sf="300 es",gi=2e3,Pa=2001;function Lw(t){for(let e=t.length-1;e>=0;--e)if(t[e]>=65535)return!0;return!1}function La(t){return document.createElementNS("http://www.w3.org/1999/xhtml",t)}function Iw(){const t=La("canvas");return t.style.display="block",t}const vf={};function xf(...t){const e="THREE."+t.shift();console.log(e,...t)}function AS(t){const e=t[0];if(typeof e=="string"&&e.startsWith("TSL:")){const n=t[1];n&&n.isStackTrace?t[0]+=" "+n.getLocation():t[1]='Stack trace not available. Enable "THREE.Node.captureStackTrace" to capture stack traces.'}return t}function $e(...t){t=AS(t);const e="THREE."+t.shift();{const n=t[0];n&&n.isStackTrace?console.warn(n.getError(e)):console.warn(e,...t)}}function vt(...t){t=AS(t);const e="THREE."+t.shift();{const n=t[0];n&&n.isStackTrace?console.error(n.getError(e)):console.error(e,...t)}}function or(...t){const e=t.join(" ");e in vf||(vf[e]=!0,$e(...t))}function Nw(t,e,n){return new Promise(function(i,s){function r(){switch(t.clientWaitSync(e,t.SYNC_FLUSH_COMMANDS_BIT,0)){case t.WAIT_FAILED:s();break;case t.TIMEOUT_EXPIRED:setTimeout(r,n);break;default:i()}}setTimeout(r,n)})}const Dw={[zl]:Bl,[Hl]:$l,[Vl]:ql,[co]:Gl,[Bl]:zl,[$l]:Hl,[ql]:Vl,[Gl]:co};class us{addEventListener(e,n){this._listeners===void 0&&(this._listeners={});const i=this._listeners;i[e]===void 0&&(i[e]=[]),i[e].indexOf(n)===-1&&i[e].push(n)}hasEventListener(e,n){const i=this._listeners;return i===void 0?!1:i[e]!==void 0&&i[e].indexOf(n)!==-1}removeEventListener(e,n){const i=this._listeners;if(i===void 0)return;const s=i[e];if(s!==void 0){const r=s.indexOf(n);r!==-1&&s.splice(r,1)}}dispatchEvent(e){const n=this._listeners;if(n===void 0)return;const i=n[e.type];if(i!==void 0){e.target=this;const s=i.slice(0);for(let r=0,o=s.length;r<o;r++)s[r].call(this,e);e.target=null}}}const fn=["00","01","02","03","04","05","06","07","08","09","0a","0b","0c","0d","0e","0f","10","11","12","13","14","15","16","17","18","19","1a","1b","1c","1d","1e","1f","20","21","22","23","24","25","26","27","28","29","2a","2b","2c","2d","2e","2f","30","31","32","33","34","35","36","37","38","39","3a","3b","3c","3d","3e","3f","40","41","42","43","44","45","46","47","48","49","4a","4b","4c","4d","4e","4f","50","51","52","53","54","55","56","57","58","59","5a","5b","5c","5d","5e","5f","60","61","62","63","64","65","66","67","68","69","6a","6b","6c","6d","6e","6f","70","71","72","73","74","75","76","77","78","79","7a","7b","7c","7d","7e","7f","80","81","82","83","84","85","86","87","88","89","8a","8b","8c","8d","8e","8f","90","91","92","93","94","95","96","97","98","99","9a","9b","9c","9d","9e","9f","a0","a1","a2","a3","a4","a5","a6","a7","a8","a9","aa","ab","ac","ad","ae","af","b0","b1","b2","b3","b4","b5","b6","b7","b8","b9","ba","bb","bc","bd","be","bf","c0","c1","c2","c3","c4","c5","c6","c7","c8","c9","ca","cb","cc","cd","ce","cf","d0","d1","d2","d3","d4","d5","d6","d7","d8","d9","da","db","dc","dd","de","df","e0","e1","e2","e3","e4","e5","e6","e7","e8","e9","ea","eb","ec","ed","ee","ef","f0","f1","f2","f3","f4","f5","f6","f7","f8","f9","fa","fb","fc","fd","fe","ff"];let yf=1234567;const jr=Math.PI/180,ho=180/Math.PI;function Pr(){const t=Math.random()*4294967295|0,e=Math.random()*4294967295|0,n=Math.random()*4294967295|0,i=Math.random()*4294967295|0;return(fn[t&255]+fn[t>>8&255]+fn[t>>16&255]+fn[t>>24&255]+"-"+fn[e&255]+fn[e>>8&255]+"-"+fn[e>>16&15|64]+fn[e>>24&255]+"-"+fn[n&63|128]+fn[n>>8&255]+"-"+fn[n>>16&255]+fn[n>>24&255]+fn[i&255]+fn[i>>8&255]+fn[i>>16&255]+fn[i>>24&255]).toLowerCase()}function rt(t,e,n){return Math.max(e,Math.min(n,t))}function Vd(t,e){return(t%e+e)%e}function Uw(t,e,n,i,s){return i+(t-e)*(s-i)/(n-e)}function Ow(t,e,n){return t!==e?(n-t)/(e-t):0}function Jr(t,e,n){return(1-n)*t+n*e}function Fw(t,e,n,i){return Jr(t,e,1-Math.exp(-n*i))}function kw(t,e=1){return e-Math.abs(Vd(t,e*2)-e)}function zw(t,e,n){return t<=e?0:t>=n?1:(t=(t-e)/(n-e),t*t*(3-2*t))}function Bw(t,e,n){return t<=e?0:t>=n?1:(t=(t-e)/(n-e),t*t*t*(t*(t*6-15)+10))}function Hw(t,e){return t+Math.floor(Math.random()*(e-t+1))}function Vw(t,e){return t+Math.random()*(e-t)}function Gw(t){return t*(.5-Math.random())}function $w(t){t!==void 0&&(yf=t);let e=yf+=1831565813;return e=Math.imul(e^e>>>15,e|1),e^=e+Math.imul(e^e>>>7,e|61),((e^e>>>14)>>>0)/4294967296}function qw(t){return t*jr}function Ww(t){return t*ho}function Zw(t){return t>0&&Number.isInteger(t)&&2**Math.round(Math.log2(t))===t}function Xw(t){return Math.pow(2,Math.ceil(Math.log(t)/Math.LN2))}function Yw(t){return Math.pow(2,Math.floor(Math.log(t)/Math.LN2))}function Kw(t,e,n,i,s){const r=Math.cos,o=Math.sin,a=r(n/2),c=o(n/2),l=r((e+i)/2),u=o((e+i)/2),h=r((e-i)/2),d=o((e-i)/2),f=r((i-e)/2),_=o((i-e)/2);switch(s){case"XYX":t.set(a*u,c*h,c*d,a*l);break;case"YZY":t.set(c*d,a*u,c*h,a*l);break;case"ZXZ":t.set(c*h,c*d,a*u,a*l);break;case"XZX":t.set(a*u,c*_,c*f,a*l);break;case"YXY":t.set(c*f,a*u,c*_,a*l);break;case"ZYZ":t.set(c*_,c*f,a*u,a*l);break;default:$e("MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+s)}}function er(t,e){switch(e.constructor){case Float32Array:return t;case Uint32Array:return t/4294967295;case Uint16Array:return t/65535;case Uint8Array:case Uint8ClampedArray:return t/255;case Int32Array:return Math.max(t/2147483647,-1);case Int16Array:return Math.max(t/32767,-1);case Int8Array:return Math.max(t/127,-1);default:throw new Error("THREE.MathUtils: Invalid component type.")}}function yn(t,e){switch(e.constructor){case Float32Array:return t;case Uint32Array:return Math.round(t*4294967295);case Uint16Array:return Math.round(t*65535);case Uint8Array:case Uint8ClampedArray:return Math.round(t*255);case Int32Array:return Math.round(t*2147483647);case Int16Array:return Math.round(t*32767);case Int8Array:return Math.round(t*127);default:throw new Error("THREE.MathUtils: Invalid component type.")}}const CS={DEG2RAD:jr,RAD2DEG:ho,generateUUID:Pr,clamp:rt,euclideanModulo:Vd,mapLinear:Uw,inverseLerp:Ow,lerp:Jr,damp:Fw,pingpong:kw,smoothstep:zw,smootherstep:Bw,randInt:Hw,randFloat:Vw,randFloatSpread:Gw,seededRandom:$w,degToRad:qw,radToDeg:Ww,isPowerOfTwo:Zw,ceilPowerOfTwo:Xw,floorPowerOfTwo:Yw,setQuaternionFromProperEuler:Kw,normalize:yn,denormalize:er},ah=class ah{constructor(e=0,n=0){this.x=e,this.y=n}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,n){return this.x=e,this.y=n,this}setScalar(e){return this.x=e,this.y=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setComponent(e,n){switch(e){case 0:this.x=n;break;case 1:this.y=n;break;default:throw new Error("THREE.Vector2: index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("THREE.Vector2: index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}add(e){return this.x+=e.x,this.y+=e.y,this}addScalar(e){return this.x+=e,this.y+=e,this}addVectors(e,n){return this.x=e.x+n.x,this.y=e.y+n.y,this}addScaledVector(e,n){return this.x+=e.x*n,this.y+=e.y*n,this}sub(e){return this.x-=e.x,this.y-=e.y,this}subScalar(e){return this.x-=e,this.y-=e,this}subVectors(e,n){return this.x=e.x-n.x,this.y=e.y-n.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divide(e){return this.x/=e.x,this.y/=e.y,this}divideScalar(e){return this.multiplyScalar(1/e)}applyMatrix3(e){const n=this.x,i=this.y,s=e.elements;return this.x=s[0]*n+s[3]*i+s[6],this.y=s[1]*n+s[4]*i+s[7],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}clamp(e,n){return this.x=rt(this.x,e.x,n.x),this.y=rt(this.y,e.y,n.y),this}clampScalar(e,n){return this.x=rt(this.x,e,n),this.y=rt(this.y,e,n),this}clampLength(e,n){const i=this.length();return this.divideScalar(i||1).multiplyScalar(rt(i,e,n))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(e){const n=Math.sqrt(this.lengthSq()*e.lengthSq());if(n===0)return Math.PI/2;const i=this.dot(e)/n;return Math.acos(rt(i,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const n=this.x-e.x,i=this.y-e.y;return n*n+i*i}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,n){return this.x+=(e.x-this.x)*n,this.y+=(e.y-this.y)*n,this}lerpVectors(e,n,i){return this.x=e.x+(n.x-e.x)*i,this.y=e.y+(n.y-e.y)*i,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e,n=0){return this.x=e[n],this.y=e[n+1],this}toArray(e=[],n=0){return e[n]=this.x,e[n+1]=this.y,e}fromBufferAttribute(e,n){return this.x=e.getX(n),this.y=e.getY(n),this}rotateAround(e,n){const i=Math.cos(n),s=Math.sin(n),r=this.x-e.x,o=this.y-e.y;return this.x=r*i-o*s+e.x,this.y=r*s+o*i+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}};ah.prototype.isVector2=!0;let je=ah;class cs{constructor(e=0,n=0,i=0,s=1){this.isQuaternion=!0,this._x=e,this._y=n,this._z=i,this._w=s}static slerpFlat(e,n,i,s,r,o,a){let c=i[s+0],l=i[s+1],u=i[s+2],h=i[s+3],d=r[o+0],f=r[o+1],_=r[o+2],x=r[o+3];if(h!==x||c!==d||l!==f||u!==_){let m=c*d+l*f+u*_+h*x;m<0&&(d=-d,f=-f,_=-_,x=-x,m=-m);let p=1-a;if(m<.9995){const E=Math.acos(m),I=Math.sin(E);p=Math.sin(p*E)/I,a=Math.sin(a*E)/I,c=c*p+d*a,l=l*p+f*a,u=u*p+_*a,h=h*p+x*a}else{c=c*p+d*a,l=l*p+f*a,u=u*p+_*a,h=h*p+x*a;const E=1/Math.sqrt(c*c+l*l+u*u+h*h);c*=E,l*=E,u*=E,h*=E}}e[n]=c,e[n+1]=l,e[n+2]=u,e[n+3]=h}static multiplyQuaternionsFlat(e,n,i,s,r,o){const a=i[s],c=i[s+1],l=i[s+2],u=i[s+3],h=r[o],d=r[o+1],f=r[o+2],_=r[o+3];return e[n]=a*_+u*h+c*f-l*d,e[n+1]=c*_+u*d+l*h-a*f,e[n+2]=l*_+u*f+a*d-c*h,e[n+3]=u*_-a*h-c*d-l*f,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,n,i,s){return this._x=e,this._y=n,this._z=i,this._w=s,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(e,n=!0){const i=e._x,s=e._y,r=e._z,o=e._order,a=Math.cos,c=Math.sin,l=a(i/2),u=a(s/2),h=a(r/2),d=c(i/2),f=c(s/2),_=c(r/2);switch(o){case"XYZ":this._x=d*u*h+l*f*_,this._y=l*f*h-d*u*_,this._z=l*u*_+d*f*h,this._w=l*u*h-d*f*_;break;case"YXZ":this._x=d*u*h+l*f*_,this._y=l*f*h-d*u*_,this._z=l*u*_-d*f*h,this._w=l*u*h+d*f*_;break;case"ZXY":this._x=d*u*h-l*f*_,this._y=l*f*h+d*u*_,this._z=l*u*_+d*f*h,this._w=l*u*h-d*f*_;break;case"ZYX":this._x=d*u*h-l*f*_,this._y=l*f*h+d*u*_,this._z=l*u*_-d*f*h,this._w=l*u*h+d*f*_;break;case"YZX":this._x=d*u*h+l*f*_,this._y=l*f*h+d*u*_,this._z=l*u*_-d*f*h,this._w=l*u*h-d*f*_;break;case"XZY":this._x=d*u*h-l*f*_,this._y=l*f*h-d*u*_,this._z=l*u*_+d*f*h,this._w=l*u*h+d*f*_;break;default:$e("Quaternion: .setFromEuler() encountered an unknown order: "+o)}return n===!0&&this._onChangeCallback(),this}setFromAxisAngle(e,n){const i=n/2,s=Math.sin(i);return this._x=e.x*s,this._y=e.y*s,this._z=e.z*s,this._w=Math.cos(i),this._onChangeCallback(),this}setFromRotationMatrix(e){const n=e.elements,i=n[0],s=n[4],r=n[8],o=n[1],a=n[5],c=n[9],l=n[2],u=n[6],h=n[10],d=i+a+h;if(d>0){const f=.5/Math.sqrt(d+1);this._w=.25/f,this._x=(u-c)*f,this._y=(r-l)*f,this._z=(o-s)*f}else if(i>a&&i>h){const f=2*Math.sqrt(1+i-a-h);this._w=(u-c)/f,this._x=.25*f,this._y=(s+o)/f,this._z=(r+l)/f}else if(a>h){const f=2*Math.sqrt(1+a-i-h);this._w=(r-l)/f,this._x=(s+o)/f,this._y=.25*f,this._z=(c+u)/f}else{const f=2*Math.sqrt(1+h-i-a);this._w=(o-s)/f,this._x=(r+l)/f,this._y=(c+u)/f,this._z=.25*f}return this._onChangeCallback(),this}setFromUnitVectors(e,n){let i=e.dot(n)+1;return i<1e-8?(i=0,Math.abs(e.x)>Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=i):(this._x=0,this._y=-e.z,this._z=e.y,this._w=i)):(this._x=e.y*n.z-e.z*n.y,this._y=e.z*n.x-e.x*n.z,this._z=e.x*n.y-e.y*n.x,this._w=i),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(rt(this.dot(e),-1,1)))}rotateTowards(e,n){const i=this.angleTo(e);if(i===0)return this;const s=Math.min(1,n/i);return this.slerp(e,s),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let e=this.length();return e===0?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this._onChangeCallback(),this}multiply(e){return this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,n){const i=e._x,s=e._y,r=e._z,o=e._w,a=n._x,c=n._y,l=n._z,u=n._w;return this._x=i*u+o*a+s*l-r*c,this._y=s*u+o*c+r*a-i*l,this._z=r*u+o*l+i*c-s*a,this._w=o*u-i*a-s*c-r*l,this._onChangeCallback(),this}slerp(e,n){let i=e._x,s=e._y,r=e._z,o=e._w,a=this.dot(e);a<0&&(i=-i,s=-s,r=-r,o=-o,a=-a);let c=1-n;if(a<.9995){const l=Math.acos(a),u=Math.sin(l);c=Math.sin(c*l)/u,n=Math.sin(n*l)/u,this._x=this._x*c+i*n,this._y=this._y*c+s*n,this._z=this._z*c+r*n,this._w=this._w*c+o*n,this._onChangeCallback()}else this._x=this._x*c+i*n,this._y=this._y*c+s*n,this._z=this._z*c+r*n,this._w=this._w*c+o*n,this.normalize();return this}slerpQuaternions(e,n,i){return this.copy(e).slerp(n,i)}random(){const e=2*Math.PI*Math.random(),n=2*Math.PI*Math.random(),i=Math.random(),s=Math.sqrt(1-i),r=Math.sqrt(i);return this.set(s*Math.sin(e),s*Math.cos(e),r*Math.sin(n),r*Math.cos(n))}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e,n=0){return this._x=e[n],this._y=e[n+1],this._z=e[n+2],this._w=e[n+3],this._onChangeCallback(),this}toArray(e=[],n=0){return e[n]=this._x,e[n+1]=this._y,e[n+2]=this._z,e[n+3]=this._w,e}fromBufferAttribute(e,n){return this._x=e.getX(n),this._y=e.getY(n),this._z=e.getZ(n),this._w=e.getW(n),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}const ch=class ch{constructor(e=0,n=0,i=0){this.x=e,this.y=n,this.z=i}set(e,n,i){return i===void 0&&(i=this.z),this.x=e,this.y=n,this.z=i,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setComponent(e,n){switch(e){case 0:this.x=n;break;case 1:this.y=n;break;case 2:this.z=n;break;default:throw new Error("THREE.Vector3: index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("THREE.Vector3: index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this}addVectors(e,n){return this.x=e.x+n.x,this.y=e.y+n.y,this.z=e.z+n.z,this}addScaledVector(e,n){return this.x+=e.x*n,this.y+=e.y*n,this.z+=e.z*n,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this}subVectors(e,n){return this.x=e.x-n.x,this.y=e.y-n.y,this.z=e.z-n.z,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}multiplyVectors(e,n){return this.x=e.x*n.x,this.y=e.y*n.y,this.z=e.z*n.z,this}applyEuler(e){return this.applyQuaternion(bf.setFromEuler(e))}applyAxisAngle(e,n){return this.applyQuaternion(bf.setFromAxisAngle(e,n))}applyMatrix3(e){const n=this.x,i=this.y,s=this.z,r=e.elements;return this.x=r[0]*n+r[3]*i+r[6]*s,this.y=r[1]*n+r[4]*i+r[7]*s,this.z=r[2]*n+r[5]*i+r[8]*s,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){const n=this.x,i=this.y,s=this.z,r=e.elements,o=1/(r[3]*n+r[7]*i+r[11]*s+r[15]);return this.x=(r[0]*n+r[4]*i+r[8]*s+r[12])*o,this.y=(r[1]*n+r[5]*i+r[9]*s+r[13])*o,this.z=(r[2]*n+r[6]*i+r[10]*s+r[14])*o,this}applyQuaternion(e){const n=this.x,i=this.y,s=this.z,r=e.x,o=e.y,a=e.z,c=e.w,l=2*(o*s-a*i),u=2*(a*n-r*s),h=2*(r*i-o*n);return this.x=n+c*l+o*h-a*u,this.y=i+c*u+a*l-r*h,this.z=s+c*h+r*u-o*l,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){const n=this.x,i=this.y,s=this.z,r=e.elements;return this.x=r[0]*n+r[4]*i+r[8]*s,this.y=r[1]*n+r[5]*i+r[9]*s,this.z=r[2]*n+r[6]*i+r[10]*s,this.normalize()}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}divideScalar(e){return this.multiplyScalar(1/e)}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this}clamp(e,n){return this.x=rt(this.x,e.x,n.x),this.y=rt(this.y,e.y,n.y),this.z=rt(this.z,e.z,n.z),this}clampScalar(e,n){return this.x=rt(this.x,e,n),this.y=rt(this.y,e,n),this.z=rt(this.z,e,n),this}clampLength(e,n){const i=this.length();return this.divideScalar(i||1).multiplyScalar(rt(i,e,n))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,n){return this.x+=(e.x-this.x)*n,this.y+=(e.y-this.y)*n,this.z+=(e.z-this.z)*n,this}lerpVectors(e,n,i){return this.x=e.x+(n.x-e.x)*i,this.y=e.y+(n.y-e.y)*i,this.z=e.z+(n.z-e.z)*i,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,n){const i=e.x,s=e.y,r=e.z,o=n.x,a=n.y,c=n.z;return this.x=s*c-r*a,this.y=r*o-i*c,this.z=i*a-s*o,this}projectOnVector(e){const n=e.lengthSq();if(n===0)return this.set(0,0,0);const i=e.dot(this)/n;return this.copy(e).multiplyScalar(i)}projectOnPlane(e){return Gc.copy(this).projectOnVector(e),this.sub(Gc)}reflect(e){return this.sub(Gc.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){const n=Math.sqrt(this.lengthSq()*e.lengthSq());if(n===0)return Math.PI/2;const i=this.dot(e)/n;return Math.acos(rt(i,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const n=this.x-e.x,i=this.y-e.y,s=this.z-e.z;return n*n+i*i+s*s}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}setFromSpherical(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}setFromSphericalCoords(e,n,i){const s=Math.sin(n)*e;return this.x=s*Math.sin(i),this.y=Math.cos(n)*e,this.z=s*Math.cos(i),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,n,i){return this.x=e*Math.sin(n),this.y=i,this.z=e*Math.cos(n),this}setFromMatrixPosition(e){const n=e.elements;return this.x=n[12],this.y=n[13],this.z=n[14],this}setFromMatrixScale(e){const n=this.setFromMatrixColumn(e,0).length(),i=this.setFromMatrixColumn(e,1).length(),s=this.setFromMatrixColumn(e,2).length();return this.x=n,this.y=i,this.z=s,this}setFromMatrixColumn(e,n){return this.fromArray(e.elements,n*4)}setFromMatrix3Column(e,n){return this.fromArray(e.elements,n*3)}setFromEuler(e){return this.x=e._x,this.y=e._y,this.z=e._z,this}setFromColor(e){return this.x=e.r,this.y=e.g,this.z=e.b,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}fromArray(e,n=0){return this.x=e[n],this.y=e[n+1],this.z=e[n+2],this}toArray(e=[],n=0){return e[n]=this.x,e[n+1]=this.y,e[n+2]=this.z,e}fromBufferAttribute(e,n){return this.x=e.getX(n),this.y=e.getY(n),this.z=e.getZ(n),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){const e=Math.random()*Math.PI*2,n=Math.random()*2-1,i=Math.sqrt(1-n*n);return this.x=i*Math.cos(e),this.y=n,this.z=i*Math.sin(e),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}};ch.prototype.isVector3=!0;let H=ch;const Gc=new H,bf=new cs,lh=class lh{constructor(e,n,i,s,r,o,a,c,l){this.elements=[1,0,0,0,1,0,0,0,1],e!==void 0&&this.set(e,n,i,s,r,o,a,c,l)}set(e,n,i,s,r,o,a,c,l){const u=this.elements;return u[0]=e,u[1]=s,u[2]=a,u[3]=n,u[4]=r,u[5]=c,u[6]=i,u[7]=o,u[8]=l,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){const n=this.elements,i=e.elements;return n[0]=i[0],n[1]=i[1],n[2]=i[2],n[3]=i[3],n[4]=i[4],n[5]=i[5],n[6]=i[6],n[7]=i[7],n[8]=i[8],this}extractBasis(e,n,i){return e.setFromMatrix3Column(this,0),n.setFromMatrix3Column(this,1),i.setFromMatrix3Column(this,2),this}setFromMatrix4(e){const n=e.elements;return this.set(n[0],n[4],n[8],n[1],n[5],n[9],n[2],n[6],n[10]),this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,n){const i=e.elements,s=n.elements,r=this.elements,o=i[0],a=i[3],c=i[6],l=i[1],u=i[4],h=i[7],d=i[2],f=i[5],_=i[8],x=s[0],m=s[3],p=s[6],E=s[1],I=s[4],b=s[7],w=s[2],A=s[5],P=s[8];return r[0]=o*x+a*E+c*w,r[3]=o*m+a*I+c*A,r[6]=o*p+a*b+c*P,r[1]=l*x+u*E+h*w,r[4]=l*m+u*I+h*A,r[7]=l*p+u*b+h*P,r[2]=d*x+f*E+_*w,r[5]=d*m+f*I+_*A,r[8]=d*p+f*b+_*P,this}multiplyScalar(e){const n=this.elements;return n[0]*=e,n[3]*=e,n[6]*=e,n[1]*=e,n[4]*=e,n[7]*=e,n[2]*=e,n[5]*=e,n[8]*=e,this}determinant(){const e=this.elements,n=e[0],i=e[1],s=e[2],r=e[3],o=e[4],a=e[5],c=e[6],l=e[7],u=e[8];return n*o*u-n*a*l-i*r*u+i*a*c+s*r*l-s*o*c}invert(){const e=this.elements,n=e[0],i=e[1],s=e[2],r=e[3],o=e[4],a=e[5],c=e[6],l=e[7],u=e[8],h=u*o-a*l,d=a*c-u*r,f=l*r-o*c,_=n*h+i*d+s*f;if(_===0)return this.set(0,0,0,0,0,0,0,0,0);const x=1/_;return e[0]=h*x,e[1]=(s*l-u*i)*x,e[2]=(a*i-s*o)*x,e[3]=d*x,e[4]=(u*n-s*c)*x,e[5]=(s*r-a*n)*x,e[6]=f*x,e[7]=(i*c-l*n)*x,e[8]=(o*n-i*r)*x,this}transpose(){let e;const n=this.elements;return e=n[1],n[1]=n[3],n[3]=e,e=n[2],n[2]=n[6],n[6]=e,e=n[5],n[5]=n[7],n[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){const n=this.elements;return e[0]=n[0],e[1]=n[3],e[2]=n[6],e[3]=n[1],e[4]=n[4],e[5]=n[7],e[6]=n[2],e[7]=n[5],e[8]=n[8],this}setUvTransform(e,n,i,s,r,o,a){const c=Math.cos(r),l=Math.sin(r);return this.set(i*c,i*l,-i*(c*o+l*a)+o+e,-s*l,s*c,-s*(-l*o+c*a)+a+n,0,0,1),this}scale(e,n){return or("Matrix3: .scale() is deprecated. Use .makeScale() instead."),this.premultiply($c.makeScale(e,n)),this}rotate(e){return or("Matrix3: .rotate() is deprecated. Use .makeRotation() instead."),this.premultiply($c.makeRotation(-e)),this}translate(e,n){return or("Matrix3: .translate() is deprecated. Use .makeTranslation() instead."),this.premultiply($c.makeTranslation(e,n)),this}makeTranslation(e,n){return e.isVector2?this.set(1,0,e.x,0,1,e.y,0,0,1):this.set(1,0,e,0,1,n,0,0,1),this}makeRotation(e){const n=Math.cos(e),i=Math.sin(e);return this.set(n,-i,0,i,n,0,0,0,1),this}makeScale(e,n){return this.set(e,0,0,0,n,0,0,0,1),this}equals(e){const n=this.elements,i=e.elements;for(let s=0;s<9;s++)if(n[s]!==i[s])return!1;return!0}fromArray(e,n=0){for(let i=0;i<9;i++)this.elements[i]=e[i+n];return this}toArray(e=[],n=0){const i=this.elements;return e[n]=i[0],e[n+1]=i[1],e[n+2]=i[2],e[n+3]=i[3],e[n+4]=i[4],e[n+5]=i[5],e[n+6]=i[6],e[n+7]=i[7],e[n+8]=i[8],e}clone(){return new this.constructor().fromArray(this.elements)}};lh.prototype.isMatrix3=!0;let Ke=lh;const $c=new Ke,Mf=new Ke().set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),Ef=new Ke().set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715);function jw(){const t={enabled:!0,workingColorSpace:Aa,spaces:{},convert:function(s,r,o){return this.enabled===!1||r===o||!r||!o||(this.spaces[r].transfer===Et&&(s.r=Fi(s.r),s.g=Fi(s.g),s.b=Fi(s.b)),this.spaces[r].primaries!==this.spaces[o].primaries&&(s.applyMatrix3(this.spaces[r].toXYZ),s.applyMatrix3(this.spaces[o].fromXYZ)),this.spaces[o].transfer===Et&&(s.r=ar(s.r),s.g=ar(s.g),s.b=ar(s.b))),s},workingToColorSpace:function(s,r){return this.convert(s,this.workingColorSpace,r)},colorSpaceToWorking:function(s,r){return this.convert(s,r,this.workingColorSpace)},getPrimaries:function(s){return this.spaces[s].primaries},getTransfer:function(s){return s===ts?Ca:this.spaces[s].transfer},getToneMappingMode:function(s){return this.spaces[s].outputColorSpaceConfig.toneMappingMode||"standard"},getLuminanceCoefficients:function(s,r=this.workingColorSpace){return s.fromArray(this.spaces[r].luminanceCoefficients)},define:function(s){Object.assign(this.spaces,s)},_getMatrix:function(s,r,o){return s.copy(this.spaces[r].toXYZ).multiply(this.spaces[o].fromXYZ)},_getDrawingBufferColorSpace:function(s){return this.spaces[s].outputColorSpaceConfig.drawingBufferColorSpace},_getUnpackColorSpace:function(s=this.workingColorSpace){return this.spaces[s].workingColorSpaceConfig.unpackColorSpace},fromWorkingColorSpace:function(s,r){return or("ColorManagement: .fromWorkingColorSpace() has been renamed to .workingToColorSpace()."),t.workingToColorSpace(s,r)},toWorkingColorSpace:function(s,r){return or("ColorManagement: .toWorkingColorSpace() has been renamed to .colorSpaceToWorking()."),t.colorSpaceToWorking(s,r)}},e=[.64,.33,.3,.6,.15,.06],n=[.2126,.7152,.0722],i=[.3127,.329];return t.define({[Aa]:{primaries:e,whitePoint:i,transfer:Ca,toXYZ:Mf,fromXYZ:Ef,luminanceCoefficients:n,workingColorSpaceConfig:{unpackColorSpace:Vn},outputColorSpaceConfig:{drawingBufferColorSpace:Vn}},[Vn]:{primaries:e,whitePoint:i,transfer:Et,toXYZ:Mf,fromXYZ:Ef,luminanceCoefficients:n,outputColorSpaceConfig:{drawingBufferColorSpace:Vn}}}),t}const ft=jw();function Fi(t){return t<.04045?t*.0773993808:Math.pow(t*.9478672986+.0521327014,2.4)}function ar(t){return t<.0031308?t*12.92:1.055*Math.pow(t,.41666)-.055}let Bs;class Jw{static getDataURL(e,n="image/png"){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement>"u")return e.src;let i;if(e instanceof HTMLCanvasElement)i=e;else{Bs===void 0&&(Bs=La("canvas")),Bs.width=e.width,Bs.height=e.height;const s=Bs.getContext("2d");e instanceof ImageData?s.putImageData(e,0,0):s.drawImage(e,0,0,e.width,e.height),i=Bs}return i.toDataURL(n)}static sRGBToLinear(e){if(typeof HTMLImageElement<"u"&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&e instanceof ImageBitmap){const n=La("canvas");n.width=e.width,n.height=e.height;const i=n.getContext("2d");i.drawImage(e,0,0,e.width,e.height);const s=i.getImageData(0,0,e.width,e.height),r=s.data;for(let o=0;o<r.length;o++)r[o]=Fi(r[o]/255)*255;return i.putImageData(s,0,0),n}else if(e.data){const n=e.data.slice(0);for(let i=0;i<n.length;i++)n instanceof Uint8Array||n instanceof Uint8ClampedArray?n[i]=Math.floor(Fi(n[i]/255)*255):n[i]=Fi(n[i]);return{data:n,width:e.width,height:e.height}}else return $e("ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),e}}let Qw=0;class Gd{constructor(e=null){this.isTextureSource=!0,Object.defineProperty(this,"id",{value:Qw++}),this.uuid=Pr(),this.data=e,this.dataReady=!0,this.version=0}getSize(e){const n=this.data;return typeof HTMLVideoElement<"u"&&n instanceof HTMLVideoElement?e.set(n.videoWidth,n.videoHeight,0):typeof VideoFrame<"u"&&n instanceof VideoFrame?e.set(n.displayWidth,n.displayHeight,0):n!==null?e.set(n.width,n.height,n.depth||0):e.set(0,0,0),e}set needsUpdate(e){e===!0&&this.version++}toJSON(e){const n=e===void 0||typeof e=="string";if(!n&&e.images[this.uuid]!==void 0)return e.images[this.uuid];const i={uuid:this.uuid,url:""},s=this.data;if(s!==null){let r;if(Array.isArray(s)){r=[];for(let o=0,a=s.length;o<a;o++)s[o].isDataTexture?r.push(qc(s[o].image)):r.push(qc(s[o]))}else r=qc(s);i.url=r}return n||(e.images[this.uuid]=i),i}}function qc(t){return typeof HTMLImageElement<"u"&&t instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&t instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&t instanceof ImageBitmap?Jw.getDataURL(t):t.data?{data:Array.from(t.data),width:t.width,height:t.height,type:t.data.constructor.name}:($e("Texture: Unable to serialize Texture."),{})}let eA=0;const Wc=new H;class En extends us{constructor(e=En.DEFAULT_IMAGE,n=En.DEFAULT_MAPPING,i=Ui,s=Ui,r=_n,o=ys,a=Qn,c=$n,l=En.DEFAULT_ANISOTROPY,u=ts){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:eA++}),this.uuid=Pr(),this.name="",this.source=new Gd(e),this.mipmaps=[],this.mapping=n,this.channel=0,this.wrapS=i,this.wrapT=s,this.magFilter=r,this.minFilter=o,this.anisotropy=l,this.format=a,this.internalFormat=null,this.type=c,this.offset=new je(0,0),this.repeat=new je(1,1),this.center=new je(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new Ke,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.colorSpace=u,this.userData={},this.updateRanges=[],this.version=0,this.onUpdate=null,this.renderTarget=null,this.isRenderTargetTexture=!1,this.isArrayTexture=!!(e&&e.depth&&e.depth>1),this.pmremVersion=0,this.normalized=!1}get width(){return this.source.getSize(Wc).x}get height(){return this.source.getSize(Wc).y}get depth(){return this.source.getSize(Wc).z}get image(){return this.source.data}set image(e){this.source.data=e}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}addUpdateRange(e,n){this.updateRanges.push({start:e,count:n})}clearUpdateRanges(){this.updateRanges.length=0}clone(){return new this.constructor().copy(this)}copy(e){return this.name=e.name,this.source=e.source,this.mipmaps=e.mipmaps.slice(0),this.mapping=e.mapping,this.channel=e.channel,this.wrapS=e.wrapS,this.wrapT=e.wrapT,this.magFilter=e.magFilter,this.minFilter=e.minFilter,this.anisotropy=e.anisotropy,this.format=e.format,this.internalFormat=e.internalFormat,this.type=e.type,this.normalized=e.normalized,this.offset.copy(e.offset),this.repeat.copy(e.repeat),this.center.copy(e.center),this.rotation=e.rotation,this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrix.copy(e.matrix),this.generateMipmaps=e.generateMipmaps,this.premultiplyAlpha=e.premultiplyAlpha,this.flipY=e.flipY,this.unpackAlignment=e.unpackAlignment,this.colorSpace=e.colorSpace,this.renderTarget=e.renderTarget,this.isRenderTargetTexture=e.isRenderTargetTexture,this.isArrayTexture=e.isArrayTexture,this.userData=JSON.parse(JSON.stringify(e.userData)),this.needsUpdate=!0,this}setValues(e){for(const n in e){const i=e[n];if(i===void 0){$e(`Texture.setValues(): parameter '${n}' has value of undefined.`);continue}const s=this[n];if(s===void 0){$e(`Texture.setValues(): property '${n}' does not exist.`);continue}s&&i&&s.isVector2&&i.isVector2||s&&i&&s.isVector3&&i.isVector3||s&&i&&s.isMatrix3&&i.isMatrix3?s.copy(i):this[n]=i}}toJSON(e){const n=e===void 0||typeof e=="string";if(!n&&e.textures[this.uuid]!==void 0)return e.textures[this.uuid];const i={metadata:{version:4.7,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(e).uuid,mapping:this.mapping,channel:this.channel,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,internalFormat:this.internalFormat,type:this.type,normalized:this.normalized,colorSpace:this.colorSpace,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,generateMipmaps:this.generateMipmaps,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};return Object.keys(this.userData).length>0&&(i.userData=this.userData),n||(e.textures[this.uuid]=i),i}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(this.mapping!==xS)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case Wl:e.x=e.x-Math.floor(e.x);break;case Ui:e.x=e.x<0?0:1;break;case Zl:Math.abs(Math.floor(e.x)%2)===1?e.x=Math.ceil(e.x)-e.x:e.x=e.x-Math.floor(e.x);break}if(e.y<0||e.y>1)switch(this.wrapT){case Wl:e.y=e.y-Math.floor(e.y);break;case Ui:e.y=e.y<0?0:1;break;case Zl:Math.abs(Math.floor(e.y)%2)===1?e.y=Math.ceil(e.y)-e.y:e.y=e.y-Math.floor(e.y);break}return this.flipY&&(e.y=1-e.y),e}set needsUpdate(e){e===!0&&(this.version++,this.source.needsUpdate=!0)}set needsPMREMUpdate(e){e===!0&&this.pmremVersion++}}En.DEFAULT_IMAGE=null;En.DEFAULT_MAPPING=xS;En.DEFAULT_ANISOTROPY=1;const uh=class uh{constructor(e=0,n=0,i=0,s=1){this.x=e,this.y=n,this.z=i,this.w=s}get width(){return this.z}set width(e){this.z=e}get height(){return this.w}set height(e){this.w=e}set(e,n,i,s){return this.x=e,this.y=n,this.z=i,this.w=s,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this.w=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setW(e){return this.w=e,this}setComponent(e,n){switch(e){case 0:this.x=n;break;case 1:this.y=n;break;case 2:this.z=n;break;case 3:this.w=n;break;default:throw new Error("THREE.Vector4: index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("THREE.Vector4: index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w!==void 0?e.w:1,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this}addVectors(e,n){return this.x=e.x+n.x,this.y=e.y+n.y,this.z=e.z+n.z,this.w=e.w+n.w,this}addScaledVector(e,n){return this.x+=e.x*n,this.y+=e.y*n,this.z+=e.z*n,this.w+=e.w*n,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this}subVectors(e,n){return this.x=e.x-n.x,this.y=e.y-n.y,this.z=e.z-n.z,this.w=e.w-n.w,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}applyMatrix4(e){const n=this.x,i=this.y,s=this.z,r=this.w,o=e.elements;return this.x=o[0]*n+o[4]*i+o[8]*s+o[12]*r,this.y=o[1]*n+o[5]*i+o[9]*s+o[13]*r,this.z=o[2]*n+o[6]*i+o[10]*s+o[14]*r,this.w=o[3]*n+o[7]*i+o[11]*s+o[15]*r,this}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this.w/=e.w,this}divideScalar(e){return this.multiplyScalar(1/e)}setAxisAngleFromQuaternion(e){this.w=2*Math.acos(e.w);const n=Math.sqrt(1-e.w*e.w);return n<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/n,this.y=e.y/n,this.z=e.z/n),this}setAxisAngleFromRotationMatrix(e){let n,i,s,r;const c=e.elements,l=c[0],u=c[4],h=c[8],d=c[1],f=c[5],_=c[9],x=c[2],m=c[6],p=c[10];if(Math.abs(u-d)<.01&&Math.abs(h-x)<.01&&Math.abs(_-m)<.01){if(Math.abs(u+d)<.1&&Math.abs(h+x)<.1&&Math.abs(_+m)<.1&&Math.abs(l+f+p-3)<.1)return this.set(1,0,0,0),this;n=Math.PI;const I=(l+1)/2,b=(f+1)/2,w=(p+1)/2,A=(u+d)/4,P=(h+x)/4,v=(_+m)/4;return I>b&&I>w?I<.01?(i=0,s=.707106781,r=.707106781):(i=Math.sqrt(I),s=A/i,r=P/i):b>w?b<.01?(i=.707106781,s=0,r=.707106781):(s=Math.sqrt(b),i=A/s,r=v/s):w<.01?(i=.707106781,s=.707106781,r=0):(r=Math.sqrt(w),i=P/r,s=v/r),this.set(i,s,r,n),this}let E=Math.sqrt((m-_)*(m-_)+(h-x)*(h-x)+(d-u)*(d-u));return Math.abs(E)<.001&&(E=1),this.x=(m-_)/E,this.y=(h-x)/E,this.z=(d-u)/E,this.w=Math.acos((l+f+p-1)/2),this}setFromMatrixPosition(e){const n=e.elements;return this.x=n[12],this.y=n[13],this.z=n[14],this.w=n[15],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this.w=Math.min(this.w,e.w),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this.w=Math.max(this.w,e.w),this}clamp(e,n){return this.x=rt(this.x,e.x,n.x),this.y=rt(this.y,e.y,n.y),this.z=rt(this.z,e.z,n.z),this.w=rt(this.w,e.w,n.w),this}clampScalar(e,n){return this.x=rt(this.x,e,n),this.y=rt(this.y,e,n),this.z=rt(this.z,e,n),this.w=rt(this.w,e,n),this}clampLength(e,n){const i=this.length();return this.divideScalar(i||1).multiplyScalar(rt(i,e,n))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this.w=Math.trunc(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,n){return this.x+=(e.x-this.x)*n,this.y+=(e.y-this.y)*n,this.z+=(e.z-this.z)*n,this.w+=(e.w-this.w)*n,this}lerpVectors(e,n,i){return this.x=e.x+(n.x-e.x)*i,this.y=e.y+(n.y-e.y)*i,this.z=e.z+(n.z-e.z)*i,this.w=e.w+(n.w-e.w)*i,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w}fromArray(e,n=0){return this.x=e[n],this.y=e[n+1],this.z=e[n+2],this.w=e[n+3],this}toArray(e=[],n=0){return e[n]=this.x,e[n+1]=this.y,e[n+2]=this.z,e[n+3]=this.w,e}fromBufferAttribute(e,n){return this.x=e.getX(n),this.y=e.getY(n),this.z=e.getZ(n),this.w=e.getW(n),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}};uh.prototype.isVector4=!0;let Vt=uh;class tA extends us{constructor(e=1,n=1,i={}){super(),i=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:_n,depthBuffer:!0,stencilBuffer:!1,resolveColorBuffer:!0,resolveDepthBuffer:!0,resolveStencilBuffer:!0,storeMultisampledColorBuffer:!0,storeMultisampledDepthBuffer:!0,storeMultisampledStencilBuffer:!0,depthTexture:null,samples:0,count:1,depth:1,multiview:!1,useArrayDepthTexture:!1},i),this.isRenderTarget=!0,this.width=e,this.height=n,this.depth=i.depth,this.scissor=new Vt(0,0,e,n),this.scissorTest=!1,this.viewport=new Vt(0,0,e,n),this.textures=[];const s={width:e,height:n,depth:i.depth},r=new En(s),o=i.count;for(let a=0;a<o;a++)this.textures[a]=r.clone(),this.textures[a].isRenderTargetTexture=!0,this.textures[a].renderTarget=this;this._setTextureOptions(i),this.depthBuffer=i.depthBuffer,this.stencilBuffer=i.stencilBuffer,this.resolveColorBuffer=i.resolveColorBuffer,this.resolveDepthBuffer=i.resolveDepthBuffer,this.resolveStencilBuffer=i.resolveStencilBuffer,this.storeMultisampledColorBuffer=i.storeMultisampledColorBuffer,this.storeMultisampledDepthBuffer=i.storeMultisampledDepthBuffer,this.storeMultisampledStencilBuffer=i.storeMultisampledStencilBuffer,this._depthTexture=null,this.depthTexture=i.depthTexture,this.samples=i.samples,this.multiview=i.multiview,this.useArrayDepthTexture=i.useArrayDepthTexture}_setTextureOptions(e={}){const n={minFilter:_n,generateMipmaps:!1,flipY:!1,internalFormat:null};e.mapping!==void 0&&(n.mapping=e.mapping),e.wrapS!==void 0&&(n.wrapS=e.wrapS),e.wrapT!==void 0&&(n.wrapT=e.wrapT),e.wrapR!==void 0&&(n.wrapR=e.wrapR),e.magFilter!==void 0&&(n.magFilter=e.magFilter),e.minFilter!==void 0&&(n.minFilter=e.minFilter),e.format!==void 0&&(n.format=e.format),e.type!==void 0&&(n.type=e.type),e.anisotropy!==void 0&&(n.anisotropy=e.anisotropy),e.colorSpace!==void 0&&(n.colorSpace=e.colorSpace),e.flipY!==void 0&&(n.flipY=e.flipY),e.generateMipmaps!==void 0&&(n.generateMipmaps=e.generateMipmaps),e.internalFormat!==void 0&&(n.internalFormat=e.internalFormat);for(let i=0;i<this.textures.length;i++)this.textures[i].setValues(n)}get texture(){return this.textures[0]}set texture(e){this.textures[0]=e}set depthTexture(e){this._depthTexture!==null&&this._depthTexture.renderTarget===this&&(this._depthTexture.renderTarget=null),e!==null&&e.renderTarget===null&&(e.renderTarget=this),this._depthTexture=e}get depthTexture(){return this._depthTexture}setSize(e,n,i=1){if(this.width!==e||this.height!==n||this.depth!==i){this.width=e,this.height=n,this.depth=i;for(let s=0,r=this.textures.length;s<r;s++)this.textures[s].image.width=e,this.textures[s].image.height=n,this.textures[s].image.depth=i,this.textures[s].isData3DTexture!==!0&&(this.textures[s].isArrayTexture=this.textures[s].image.depth>1);this.dispose()}this.viewport.set(0,0,e,n),this.scissor.set(0,0,e,n)}clone(){return new this.constructor().copy(this)}copy(e){this.width=e.width,this.height=e.height,this.depth=e.depth,this.scissor.copy(e.scissor),this.scissorTest=e.scissorTest,this.viewport.copy(e.viewport),this.textures.length=0;for(let n=0,i=e.textures.length;n<i;n++){this.textures[n]=e.textures[n].clone(),this.textures[n].isRenderTargetTexture=!0,this.textures[n].renderTarget=this;const s=Object.assign({},e.textures[n].image);this.textures[n].source=new Gd(s)}if(this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,this.resolveColorBuffer=e.resolveColorBuffer,this.resolveDepthBuffer=e.resolveDepthBuffer,this.resolveStencilBuffer=e.resolveStencilBuffer,this.storeMultisampledColorBuffer=e.storeMultisampledColorBuffer,this.storeMultisampledDepthBuffer=e.storeMultisampledDepthBuffer,this.storeMultisampledStencilBuffer=e.storeMultisampledStencilBuffer,e.depthTexture!==null)if(e.depthTexture.renderTarget===e){const n=e.depthTexture.clone();n.renderTarget=null,this.depthTexture=n}else this.depthTexture=e.depthTexture;return this.samples=e.samples,this.multiview=e.multiview,this.useArrayDepthTexture=e.useArrayDepthTexture,this}dispose(){this.dispatchEvent({type:"dispose"})}}class ei extends tA{constructor(e=1,n=1,i={}){super(e,n,i),this.isWebGLRenderTarget=!0}}class PS extends En{constructor(e=null,n=1,i=1,s=1){super(null),this.isDataArrayTexture=!0,this.image={data:e,width:n,height:i,depth:s},this.magFilter=ln,this.minFilter=ln,this.wrapR=Ui,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.layerUpdates=new Set}copy(e){return super.copy(e),this.wrapR=e.wrapR,this}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}}class nA extends En{constructor(e=null,n=1,i=1,s=1){super(null),this.isData3DTexture=!0,this.image={data:e,width:n,height:i,depth:s},this.magFilter=ln,this.minFilter=ln,this.wrapR=Ui,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}copy(e){return super.copy(e),this.wrapR=e.wrapR,this}}const Va=class Va{constructor(e,n,i,s,r,o,a,c,l,u,h,d,f,_,x,m){this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],e!==void 0&&this.set(e,n,i,s,r,o,a,c,l,u,h,d,f,_,x,m)}set(e,n,i,s,r,o,a,c,l,u,h,d,f,_,x,m){const p=this.elements;return p[0]=e,p[4]=n,p[8]=i,p[12]=s,p[1]=r,p[5]=o,p[9]=a,p[13]=c,p[2]=l,p[6]=u,p[10]=h,p[14]=d,p[3]=f,p[7]=_,p[11]=x,p[15]=m,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return new Va().fromArray(this.elements)}copy(e){const n=this.elements,i=e.elements;return n[0]=i[0],n[1]=i[1],n[2]=i[2],n[3]=i[3],n[4]=i[4],n[5]=i[5],n[6]=i[6],n[7]=i[7],n[8]=i[8],n[9]=i[9],n[10]=i[10],n[11]=i[11],n[12]=i[12],n[13]=i[13],n[14]=i[14],n[15]=i[15],this}copyPosition(e){const n=this.elements,i=e.elements;return n[12]=i[12],n[13]=i[13],n[14]=i[14],this}setFromMatrix3(e){const n=e.elements;return this.set(n[0],n[3],n[6],0,n[1],n[4],n[7],0,n[2],n[5],n[8],0,0,0,0,1),this}extractBasis(e,n,i){return this.determinantAffine()===0?(e.set(1,0,0),n.set(0,1,0),i.set(0,0,1),this):(e.setFromMatrixColumn(this,0),n.setFromMatrixColumn(this,1),i.setFromMatrixColumn(this,2),this)}makeBasis(e,n,i){return this.set(e.x,n.x,i.x,0,e.y,n.y,i.y,0,e.z,n.z,i.z,0,0,0,0,1),this}extractRotation(e){if(e.determinantAffine()===0)return this.identity();const n=this.elements,i=e.elements,s=1/Hs.setFromMatrixColumn(e,0).length(),r=1/Hs.setFromMatrixColumn(e,1).length(),o=1/Hs.setFromMatrixColumn(e,2).length();return n[0]=i[0]*s,n[1]=i[1]*s,n[2]=i[2]*s,n[3]=0,n[4]=i[4]*r,n[5]=i[5]*r,n[6]=i[6]*r,n[7]=0,n[8]=i[8]*o,n[9]=i[9]*o,n[10]=i[10]*o,n[11]=0,n[12]=0,n[13]=0,n[14]=0,n[15]=1,this}makeRotationFromEuler(e){const n=this.elements,i=e.x,s=e.y,r=e.z,o=Math.cos(i),a=Math.sin(i),c=Math.cos(s),l=Math.sin(s),u=Math.cos(r),h=Math.sin(r);if(e.order==="XYZ"){const d=o*u,f=o*h,_=a*u,x=a*h;n[0]=c*u,n[4]=-c*h,n[8]=l,n[1]=f+_*l,n[5]=d-x*l,n[9]=-a*c,n[2]=x-d*l,n[6]=_+f*l,n[10]=o*c}else if(e.order==="YXZ"){const d=c*u,f=c*h,_=l*u,x=l*h;n[0]=d+x*a,n[4]=_*a-f,n[8]=o*l,n[1]=o*h,n[5]=o*u,n[9]=-a,n[2]=f*a-_,n[6]=x+d*a,n[10]=o*c}else if(e.order==="ZXY"){const d=c*u,f=c*h,_=l*u,x=l*h;n[0]=d-x*a,n[4]=-o*h,n[8]=_+f*a,n[1]=f+_*a,n[5]=o*u,n[9]=x-d*a,n[2]=-o*l,n[6]=a,n[10]=o*c}else if(e.order==="ZYX"){const d=o*u,f=o*h,_=a*u,x=a*h;n[0]=c*u,n[4]=_*l-f,n[8]=d*l+x,n[1]=c*h,n[5]=x*l+d,n[9]=f*l-_,n[2]=-l,n[6]=a*c,n[10]=o*c}else if(e.order==="YZX"){const d=o*c,f=o*l,_=a*c,x=a*l;n[0]=c*u,n[4]=x-d*h,n[8]=_*h+f,n[1]=h,n[5]=o*u,n[9]=-a*u,n[2]=-l*u,n[6]=f*h+_,n[10]=d-x*h}else if(e.order==="XZY"){const d=o*c,f=o*l,_=a*c,x=a*l;n[0]=c*u,n[4]=-h,n[8]=l*u,n[1]=d*h+x,n[5]=o*u,n[9]=f*h-_,n[2]=_*h-f,n[6]=a*u,n[10]=x*h+d}return n[3]=0,n[7]=0,n[11]=0,n[12]=0,n[13]=0,n[14]=0,n[15]=1,this}makeRotationFromQuaternion(e){return this.compose(iA,e,sA)}lookAt(e,n,i){const s=this.elements;return On.subVectors(e,n),On.lengthSq()===0&&(On.z=1),On.normalize(),Yi.crossVectors(i,On),Yi.lengthSq()===0&&(Math.abs(i.z)===1?On.x+=1e-4:On.z+=1e-4,On.normalize(),Yi.crossVectors(i,On)),Yi.normalize(),Io.crossVectors(On,Yi),s[0]=Yi.x,s[4]=Io.x,s[8]=On.x,s[1]=Yi.y,s[5]=Io.y,s[9]=On.y,s[2]=Yi.z,s[6]=Io.z,s[10]=On.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,n){const i=e.elements,s=n.elements,r=this.elements,o=i[0],a=i[4],c=i[8],l=i[12],u=i[1],h=i[5],d=i[9],f=i[13],_=i[2],x=i[6],m=i[10],p=i[14],E=i[3],I=i[7],b=i[11],w=i[15],A=s[0],P=s[4],v=s[8],T=s[12],L=s[1],N=s[5],k=s[9],q=s[13],U=s[2],V=s[6],Q=s[10],X=s[14],ce=s[3],j=s[7],se=s[11],oe=s[15];return r[0]=o*A+a*L+c*U+l*ce,r[4]=o*P+a*N+c*V+l*j,r[8]=o*v+a*k+c*Q+l*se,r[12]=o*T+a*q+c*X+l*oe,r[1]=u*A+h*L+d*U+f*ce,r[5]=u*P+h*N+d*V+f*j,r[9]=u*v+h*k+d*Q+f*se,r[13]=u*T+h*q+d*X+f*oe,r[2]=_*A+x*L+m*U+p*ce,r[6]=_*P+x*N+m*V+p*j,r[10]=_*v+x*k+m*Q+p*se,r[14]=_*T+x*q+m*X+p*oe,r[3]=E*A+I*L+b*U+w*ce,r[7]=E*P+I*N+b*V+w*j,r[11]=E*v+I*k+b*Q+w*se,r[15]=E*T+I*q+b*X+w*oe,this}multiplyScalar(e){const n=this.elements;return n[0]*=e,n[4]*=e,n[8]*=e,n[12]*=e,n[1]*=e,n[5]*=e,n[9]*=e,n[13]*=e,n[2]*=e,n[6]*=e,n[10]*=e,n[14]*=e,n[3]*=e,n[7]*=e,n[11]*=e,n[15]*=e,this}determinant(){const e=this.elements,n=e[0],i=e[4],s=e[8],r=e[12],o=e[1],a=e[5],c=e[9],l=e[13],u=e[2],h=e[6],d=e[10],f=e[14],_=e[3],x=e[7],m=e[11],p=e[15],E=c*f-l*d,I=a*f-l*h,b=a*d-c*h,w=o*f-l*u,A=o*d-c*u,P=o*h-a*u;return n*(x*E-m*I+p*b)-i*(_*E-m*w+p*A)+s*(_*I-x*w+p*P)-r*(_*b-x*A+m*P)}determinantAffine(){const e=this.elements,n=e[0],i=e[4],s=e[8],r=e[1],o=e[5],a=e[9],c=e[2],l=e[6],u=e[10];return n*(o*u-a*l)-i*(r*u-a*c)+s*(r*l-o*c)}transpose(){const e=this.elements;let n;return n=e[1],e[1]=e[4],e[4]=n,n=e[2],e[2]=e[8],e[8]=n,n=e[6],e[6]=e[9],e[9]=n,n=e[3],e[3]=e[12],e[12]=n,n=e[7],e[7]=e[13],e[13]=n,n=e[11],e[11]=e[14],e[14]=n,this}setPosition(e,n,i){const s=this.elements;return e.isVector3?(s[12]=e.x,s[13]=e.y,s[14]=e.z):(s[12]=e,s[13]=n,s[14]=i),this}invert(){const e=this.elements,n=e[0],i=e[1],s=e[2],r=e[3],o=e[4],a=e[5],c=e[6],l=e[7],u=e[8],h=e[9],d=e[10],f=e[11],_=e[12],x=e[13],m=e[14],p=e[15],E=n*a-i*o,I=n*c-s*o,b=n*l-r*o,w=i*c-s*a,A=i*l-r*a,P=s*l-r*c,v=u*x-h*_,T=u*m-d*_,L=u*p-f*_,N=h*m-d*x,k=h*p-f*x,q=d*p-f*m,U=E*q-I*k+b*N+w*L-A*T+P*v;if(U===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const V=1/U;return e[0]=(a*q-c*k+l*N)*V,e[1]=(s*k-i*q-r*N)*V,e[2]=(x*P-m*A+p*w)*V,e[3]=(d*A-h*P-f*w)*V,e[4]=(c*L-o*q-l*T)*V,e[5]=(n*q-s*L+r*T)*V,e[6]=(m*b-_*P-p*I)*V,e[7]=(u*P-d*b+f*I)*V,e[8]=(o*k-a*L+l*v)*V,e[9]=(i*L-n*k-r*v)*V,e[10]=(_*A-x*b+p*E)*V,e[11]=(h*b-u*A-f*E)*V,e[12]=(a*T-o*N-c*v)*V,e[13]=(n*N-i*T+s*v)*V,e[14]=(x*I-_*w-m*E)*V,e[15]=(u*w-h*I+d*E)*V,this}scale(e){const n=this.elements,i=e.x,s=e.y,r=e.z;return n[0]*=i,n[4]*=s,n[8]*=r,n[1]*=i,n[5]*=s,n[9]*=r,n[2]*=i,n[6]*=s,n[10]*=r,n[3]*=i,n[7]*=s,n[11]*=r,this}getMaxScaleOnAxis(){const e=this.elements,n=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],i=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],s=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(n,i,s))}makeTranslation(e,n,i){return e.isVector3?this.set(1,0,0,e.x,0,1,0,e.y,0,0,1,e.z,0,0,0,1):this.set(1,0,0,e,0,1,0,n,0,0,1,i,0,0,0,1),this}makeRotationX(e){const n=Math.cos(e),i=Math.sin(e);return this.set(1,0,0,0,0,n,-i,0,0,i,n,0,0,0,0,1),this}makeRotationY(e){const n=Math.cos(e),i=Math.sin(e);return this.set(n,0,i,0,0,1,0,0,-i,0,n,0,0,0,0,1),this}makeRotationZ(e){const n=Math.cos(e),i=Math.sin(e);return this.set(n,-i,0,0,i,n,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,n){const i=Math.cos(n),s=Math.sin(n),r=1-i,o=e.x,a=e.y,c=e.z,l=r*o,u=r*a;return this.set(l*o+i,l*a-s*c,l*c+s*a,0,l*a+s*c,u*a+i,u*c-s*o,0,l*c-s*a,u*c+s*o,r*c*c+i,0,0,0,0,1),this}makeScale(e,n,i){return this.set(e,0,0,0,0,n,0,0,0,0,i,0,0,0,0,1),this}makeShear(e,n,i,s,r,o){return this.set(1,i,r,0,e,1,o,0,n,s,1,0,0,0,0,1),this}compose(e,n,i){const s=this.elements,r=n._x,o=n._y,a=n._z,c=n._w,l=r+r,u=o+o,h=a+a,d=r*l,f=r*u,_=r*h,x=o*u,m=o*h,p=a*h,E=c*l,I=c*u,b=c*h,w=i.x,A=i.y,P=i.z;return s[0]=(1-(x+p))*w,s[1]=(f+b)*w,s[2]=(_-I)*w,s[3]=0,s[4]=(f-b)*A,s[5]=(1-(d+p))*A,s[6]=(m+E)*A,s[7]=0,s[8]=(_+I)*P,s[9]=(m-E)*P,s[10]=(1-(d+x))*P,s[11]=0,s[12]=e.x,s[13]=e.y,s[14]=e.z,s[15]=1,this}decompose(e,n,i){const s=this.elements;e.x=s[12],e.y=s[13],e.z=s[14];const r=this.determinantAffine();if(r===0)return i.set(1,1,1),n.identity(),this;let o=Hs.set(s[0],s[1],s[2]).length();const a=Hs.set(s[4],s[5],s[6]).length(),c=Hs.set(s[8],s[9],s[10]).length();r<0&&(o=-o),Xn.copy(this);const l=1/o,u=1/a,h=1/c;return Xn.elements[0]*=l,Xn.elements[1]*=l,Xn.elements[2]*=l,Xn.elements[4]*=u,Xn.elements[5]*=u,Xn.elements[6]*=u,Xn.elements[8]*=h,Xn.elements[9]*=h,Xn.elements[10]*=h,n.setFromRotationMatrix(Xn),i.x=o,i.y=a,i.z=c,this}makePerspective(e,n,i,s,r,o,a=gi,c=!1){const l=this.elements,u=2*r/(n-e),h=2*r/(i-s),d=(n+e)/(n-e),f=(i+s)/(i-s);let _,x;if(c)_=r/(o-r),x=o*r/(o-r);else if(a===gi)_=-(o+r)/(o-r),x=-2*o*r/(o-r);else if(a===Pa)_=-o/(o-r),x=-o*r/(o-r);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+a);return l[0]=u,l[4]=0,l[8]=d,l[12]=0,l[1]=0,l[5]=h,l[9]=f,l[13]=0,l[2]=0,l[6]=0,l[10]=_,l[14]=x,l[3]=0,l[7]=0,l[11]=-1,l[15]=0,this}makeOrthographic(e,n,i,s,r,o,a=gi,c=!1){const l=this.elements,u=2/(n-e),h=2/(i-s),d=-(n+e)/(n-e),f=-(i+s)/(i-s);let _,x;if(c)_=1/(o-r),x=o/(o-r);else if(a===gi)_=-2/(o-r),x=-(o+r)/(o-r);else if(a===Pa)_=-1/(o-r),x=-r/(o-r);else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+a);return l[0]=u,l[4]=0,l[8]=0,l[12]=d,l[1]=0,l[5]=h,l[9]=0,l[13]=f,l[2]=0,l[6]=0,l[10]=_,l[14]=x,l[3]=0,l[7]=0,l[11]=0,l[15]=1,this}equals(e){const n=this.elements,i=e.elements;for(let s=0;s<16;s++)if(n[s]!==i[s])return!1;return!0}fromArray(e,n=0){for(let i=0;i<16;i++)this.elements[i]=e[i+n];return this}toArray(e=[],n=0){const i=this.elements;return e[n]=i[0],e[n+1]=i[1],e[n+2]=i[2],e[n+3]=i[3],e[n+4]=i[4],e[n+5]=i[5],e[n+6]=i[6],e[n+7]=i[7],e[n+8]=i[8],e[n+9]=i[9],e[n+10]=i[10],e[n+11]=i[11],e[n+12]=i[12],e[n+13]=i[13],e[n+14]=i[14],e[n+15]=i[15],e}};Va.prototype.isMatrix4=!0;let $t=Va;const Hs=new H,Xn=new $t,iA=new H(0,0,0),sA=new H(1,1,1),Yi=new H,Io=new H,On=new H,Tf=new $t,Rf=new cs;class Ls{constructor(e=0,n=0,i=0,s=Ls.DEFAULT_ORDER){this.isEuler=!0,this._x=e,this._y=n,this._z=i,this._order=s}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get order(){return this._order}set order(e){this._order=e,this._onChangeCallback()}set(e,n,i,s=this._order){return this._x=e,this._y=n,this._z=i,this._order=s,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this}setFromRotationMatrix(e,n=this._order,i=!0){const s=e.elements,r=s[0],o=s[4],a=s[8],c=s[1],l=s[5],u=s[9],h=s[2],d=s[6],f=s[10];switch(n){case"XYZ":this._y=Math.asin(rt(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(-u,f),this._z=Math.atan2(-o,r)):(this._x=Math.atan2(d,l),this._z=0);break;case"YXZ":this._x=Math.asin(-rt(u,-1,1)),Math.abs(u)<.9999999?(this._y=Math.atan2(a,f),this._z=Math.atan2(c,l)):(this._y=Math.atan2(-h,r),this._z=0);break;case"ZXY":this._x=Math.asin(rt(d,-1,1)),Math.abs(d)<.9999999?(this._y=Math.atan2(-h,f),this._z=Math.atan2(-o,l)):(this._y=0,this._z=Math.atan2(c,r));break;case"ZYX":this._y=Math.asin(-rt(h,-1,1)),Math.abs(h)<.9999999?(this._x=Math.atan2(d,f),this._z=Math.atan2(c,r)):(this._x=0,this._z=Math.atan2(-o,l));break;case"YZX":this._z=Math.asin(rt(c,-1,1)),Math.abs(c)<.9999999?(this._x=Math.atan2(-u,l),this._y=Math.atan2(-h,r)):(this._x=0,this._y=Math.atan2(a,f));break;case"XZY":this._z=Math.asin(-rt(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(d,l),this._y=Math.atan2(a,r)):(this._x=Math.atan2(-u,f),this._y=0);break;default:$e("Euler: .setFromRotationMatrix() encountered an unknown order: "+n)}return this._order=n,i===!0&&this._onChangeCallback(),this}setFromQuaternion(e,n,i){return Tf.makeRotationFromQuaternion(e),this.setFromRotationMatrix(Tf,n,i)}setFromVector3(e,n=this._order){return this.set(e.x,e.y,e.z,n)}reorder(e){return Rf.setFromEuler(this),this.setFromQuaternion(Rf,e)}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order}fromArray(e){return this._x=e[0],this._y=e[1],this._z=e[2],e[3]!==void 0&&(this._order=e[3]),this._onChangeCallback(),this}toArray(e=[],n=0){return e[n]=this._x,e[n+1]=this._y,e[n+2]=this._z,e[n+3]=this._order,e}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}}Ls.DEFAULT_ORDER="XYZ";class LS{constructor(){this.mask=1}set(e){this.mask=(1<<e|0)>>>0}enable(e){this.mask|=1<<e|0}enableAll(){this.mask=-1}toggle(e){this.mask^=1<<e|0}disable(e){this.mask&=~(1<<e|0)}disableAll(){this.mask=0}test(e){return(this.mask&e.mask)!==0}isEnabled(e){return(this.mask&(1<<e|0))!==0}}let rA=0;const wf=new H,Vs=new cs,Ri=new $t,No=new H,Ur=new H,oA=new H,aA=new cs,Af=new H(1,0,0),Cf=new H(0,1,0),Pf=new H(0,0,1),Lf={type:"added"},cA={type:"removed"},Gs={type:"childadded",child:null},Zc={type:"childremoved",child:null};class Tn extends us{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:rA++}),this.uuid=Pr(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=Tn.DEFAULT_UP.clone();const e=new H,n=new Ls,i=new cs,s=new H(1,1,1);function r(){i.setFromEuler(n,!1)}function o(){n.setFromQuaternion(i,void 0,!1)}n._onChange(r),i._onChange(o),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:e},rotation:{configurable:!0,enumerable:!0,value:n},quaternion:{configurable:!0,enumerable:!0,value:i},scale:{configurable:!0,enumerable:!0,value:s},modelViewMatrix:{value:new $t},normalMatrix:{value:new Ke}}),this.matrix=new $t,this.matrixWorld=new $t,this.matrixAutoUpdate=Tn.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=Tn.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new LS,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.customDepthMaterial=void 0,this.customDistanceMaterial=void 0,this.static=!1,this.userData={},this.pivot=null}onBeforeShadow(){}onAfterShadow(){}onBeforeRender(){}onAfterRender(){}applyMatrix4(e){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(e),this.matrix.decompose(this.position,this.quaternion,this.scale)}applyQuaternion(e){return this.quaternion.premultiply(e),this}setRotationFromAxisAngle(e,n){this.quaternion.setFromAxisAngle(e,n)}setRotationFromEuler(e){this.quaternion.setFromEuler(e,!0)}setRotationFromMatrix(e){this.quaternion.setFromRotationMatrix(e)}setRotationFromQuaternion(e){this.quaternion.copy(e)}rotateOnAxis(e,n){return Vs.setFromAxisAngle(e,n),this.quaternion.multiply(Vs),this}rotateOnWorldAxis(e,n){return Vs.setFromAxisAngle(e,n),this.quaternion.premultiply(Vs),this}rotateX(e){return this.rotateOnAxis(Af,e)}rotateY(e){return this.rotateOnAxis(Cf,e)}rotateZ(e){return this.rotateOnAxis(Pf,e)}translateOnAxis(e,n){return wf.copy(e).applyQuaternion(this.quaternion),this.position.add(wf.multiplyScalar(n)),this}translateX(e){return this.translateOnAxis(Af,e)}translateY(e){return this.translateOnAxis(Cf,e)}translateZ(e){return this.translateOnAxis(Pf,e)}localToWorld(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(this.matrixWorld)}worldToLocal(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(Ri.copy(this.matrixWorld).invert())}lookAt(e,n,i){e.isVector3?No.copy(e):No.set(e,n,i);const s=this.parent;this.updateWorldMatrix(!0,!1),Ur.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?Ri.lookAt(Ur,No,this.up):Ri.lookAt(No,Ur,this.up),this.quaternion.setFromRotationMatrix(Ri),s&&(Ri.extractRotation(s.matrixWorld),Vs.setFromRotationMatrix(Ri),this.quaternion.premultiply(Vs.invert()))}add(e){if(arguments.length>1){for(let n=0;n<arguments.length;n++)this.add(arguments[n]);return this}return e===this?(vt("Object3D.add: object can't be added as a child of itself.",e),this):(e&&e.isObject3D?(e.removeFromParent(),e.parent=this,this.children.push(e),e.dispatchEvent(Lf),Gs.child=e,this.dispatchEvent(Gs),Gs.child=null):vt("Object3D.add: object not an instance of THREE.Object3D.",e),this)}remove(e){if(arguments.length>1){for(let i=0;i<arguments.length;i++)this.remove(arguments[i]);return this}const n=this.children.indexOf(e);return n!==-1&&(e.parent=null,this.children.splice(n,1),e.dispatchEvent(cA),Zc.child=e,this.dispatchEvent(Zc),Zc.child=null),this}removeFromParent(){const e=this.parent;return e!==null&&e.remove(this),this}clear(){return this.remove(...this.children)}attach(e){return this.updateWorldMatrix(!0,!1),Ri.copy(this.matrixWorld).invert(),e.parent!==null&&(e.parent.updateWorldMatrix(!0,!1),Ri.multiply(e.parent.matrixWorld)),e.applyMatrix4(Ri),e.removeFromParent(),e.parent=this,this.children.push(e),e.updateWorldMatrix(!1,!0),e.dispatchEvent(Lf),Gs.child=e,this.dispatchEvent(Gs),Gs.child=null,this}getObjectById(e){return this.getObjectByProperty("id",e)}getObjectByName(e){return this.getObjectByProperty("name",e)}getObjectByProperty(e,n){if(this[e]===n)return this;for(let i=0,s=this.children.length;i<s;i++){const o=this.children[i].getObjectByProperty(e,n);if(o!==void 0)return o}}getObjectsByProperty(e,n,i=[]){this[e]===n&&i.push(this);const s=this.children;for(let r=0,o=s.length;r<o;r++)s[r].getObjectsByProperty(e,n,i);return i}getWorldPosition(e){return this.updateWorldMatrix(!0,!1),e.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Ur,e,oA),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Ur,aA,e),e}getWorldDirection(e){this.updateWorldMatrix(!0,!1);const n=this.matrixWorld.elements;return e.set(n[8],n[9],n[10]).normalize()}raycast(){}intersectsFrustum(){}traverse(e){e(this);const n=this.children;for(let i=0,s=n.length;i<s;i++)n[i].traverse(e)}traverseVisible(e){if(this.visible===!1)return;e(this);const n=this.children;for(let i=0,s=n.length;i<s;i++)n[i].traverseVisible(e)}traverseAncestors(e){const n=this.parent;n!==null&&(e(n),n.traverseAncestors(e))}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale);const e=this.pivot;if(e!==null){const n=e.x,i=e.y,s=e.z,r=this.matrix.elements;r[12]+=n-r[0]*n-r[4]*i-r[8]*s,r[13]+=i-r[1]*n-r[5]*i-r[9]*s,r[14]+=s-r[2]*n-r[6]*i-r[10]*s}this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(e){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||e)&&(this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),this.matrixWorldNeedsUpdate=!1,e=!0);const n=this.children;for(let i=0,s=n.length;i<s;i++)n[i].updateMatrixWorld(e)}updateWorldMatrix(e,n,i=!1){const s=this.parent;if(e===!0&&s!==null&&s.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||i)&&(this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),this.matrixWorldNeedsUpdate=!1,i=!0),n===!0){const r=this.children;for(let o=0,a=r.length;o<a;o++)r[o].updateWorldMatrix(!1,!0,i)}}toJSON(e){const n=e===void 0||typeof e=="string",i={};n&&(e={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},i.metadata={version:4.7,type:"Object",generator:"Object3D.toJSON"});const s={};s.uuid=this.uuid,s.type=this.type,s.name=this.name,s.castShadow=this.castShadow,s.receiveShadow=this.receiveShadow,s.visible=this.visible,s.frustumCulled=this.frustumCulled,s.renderOrder=this.renderOrder,s.static=this.static,s.matrixAutoUpdate=this.matrixAutoUpdate,Object.keys(this.userData).length>0&&(s.userData=this.userData),s.layers=this.layers.mask,s.matrix=this.matrix.toArray(),s.up=this.up.toArray(),this.pivot!==null&&(s.pivot=this.pivot.toArray()),this.morphTargetDictionary!==void 0&&(s.morphTargetDictionary=Object.assign({},this.morphTargetDictionary)),this.morphTargetInfluences!==void 0&&(s.morphTargetInfluences=this.morphTargetInfluences.slice()),this.isInstancedMesh&&(s.type="InstancedMesh",s.count=this.count,s.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(s.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(s.type="BatchedMesh",s.perObjectFrustumCulled=this.perObjectFrustumCulled,s.sortObjects=this.sortObjects,s.drawRanges=this._drawRanges,s.reservedRanges=this._reservedRanges,s.geometryInfo=this._geometryInfo.map(a=>({...a,boundingBox:a.boundingBox?a.boundingBox.toJSON():void 0,boundingSphere:a.boundingSphere?a.boundingSphere.toJSON():void 0})),s.instanceInfo=this._instanceInfo.map(a=>({...a})),s.availableInstanceIds=this._availableInstanceIds.slice(),s.availableGeometryIds=this._availableGeometryIds.slice(),s.nextIndexStart=this._nextIndexStart,s.nextVertexStart=this._nextVertexStart,s.geometryCount=this._geometryCount,s.maxInstanceCount=this._maxInstanceCount,s.maxVertexCount=this._maxVertexCount,s.maxIndexCount=this._maxIndexCount,s.geometryInitialized=this._geometryInitialized,s.matricesTexture=this._matricesTexture.toJSON(e),s.indirectTexture=this._indirectTexture.toJSON(e),this._colorsTexture!==null&&(s.colorsTexture=this._colorsTexture.toJSON(e)),this.boundingSphere!==null&&(s.boundingSphere=this.boundingSphere.toJSON()),this.boundingBox!==null&&(s.boundingBox=this.boundingBox.toJSON()));function r(a,c){return a[c.uuid]===void 0&&(a[c.uuid]=c.toJSON(e)),c.uuid}if(this.isScene)this.background&&(this.background.isColor?s.background=this.background.toJSON():this.background.isTexture&&(s.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(s.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){s.geometry=r(e.geometries,this.geometry);const a=this.geometry.parameters;if(a!==void 0&&a.shapes!==void 0){const c=a.shapes;if(Array.isArray(c))for(let l=0,u=c.length;l<u;l++){const h=c[l];r(e.shapes,h)}else r(e.shapes,c)}}if(this.isSkinnedMesh&&(s.bindMode=this.bindMode,s.bindMatrix=this.bindMatrix.toArray(),this.skeleton!==void 0&&(r(e.skeletons,this.skeleton),s.skeleton=this.skeleton.uuid)),this.material!==void 0)if(Array.isArray(this.material)){const a=[];for(let c=0,l=this.material.length;c<l;c++)a.push(r(e.materials,this.material[c]));s.material=a}else s.material=r(e.materials,this.material);if(this.children.length>0){s.children=[];for(let a=0;a<this.children.length;a++)s.children.push(this.children[a].toJSON(e).object)}if(this.animations.length>0){s.animations=[];for(let a=0;a<this.animations.length;a++){const c=this.animations[a];s.animations.push(r(e.animations,c))}}if(n){const a=o(e.geometries),c=o(e.materials),l=o(e.textures),u=o(e.images),h=o(e.shapes),d=o(e.skeletons),f=o(e.animations),_=o(e.nodes);a.length>0&&(i.geometries=a),c.length>0&&(i.materials=c),l.length>0&&(i.textures=l),u.length>0&&(i.images=u),h.length>0&&(i.shapes=h),d.length>0&&(i.skeletons=d),f.length>0&&(i.animations=f),_.length>0&&(i.nodes=_)}return i.object=s,i;function o(a){const c=[];for(const l in a){const u=a[l];delete u.metadata,c.push(u)}return c}}clone(e){return new this.constructor().copy(this,e)}copy(e,n=!0){if(this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.rotation.order=e.rotation.order,this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.pivot=e.pivot!==null?e.pivot.clone():null,this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldAutoUpdate=e.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.static=e.static,this.animations=e.animations.slice(),this.userData=JSON.parse(JSON.stringify(e.userData)),n===!0)for(let i=0;i<e.children.length;i++){const s=e.children[i];this.add(s.clone())}return this}dispose(){this.dispatchEvent({type:"dispose"})}}Tn.DEFAULT_UP=new H(0,1,0);Tn.DEFAULT_MATRIX_AUTO_UPDATE=!0;Tn.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;class Do extends Tn{constructor(){super(),this.isGroup=!0,this.type="Group"}}const lA={type:"move"};class Xc{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new Do,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand}getTargetRaySpace(){return this._targetRay===null&&(this._targetRay=new Do,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new H,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new H),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new Do,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new H,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new H,this._grip.eventsEnabled=!1),this._grip}dispatchEvent(e){return this._targetRay!==null&&this._targetRay.dispatchEvent(e),this._grip!==null&&this._grip.dispatchEvent(e),this._hand!==null&&this._hand.dispatchEvent(e),this}connect(e){if(e&&e.hand){const n=this._hand;if(n)for(const i of e.hand.values())this._getHandJoint(n,i)}return this.dispatchEvent({type:"connected",data:e}),this}disconnect(e){return this.dispatchEvent({type:"disconnected",data:e}),this._targetRay!==null&&(this._targetRay.visible=!1),this._grip!==null&&(this._grip.visible=!1),this._hand!==null&&(this._hand.visible=!1),this}update(e,n,i){let s=null,r=null,o=null;const a=this._targetRay,c=this._grip,l=this._hand;if(e&&n.session.visibilityState!=="visible-blurred"){if(l&&e.hand){o=!0;for(const x of e.hand.values()){const m=n.getJointPose(x,i),p=this._getHandJoint(l,x);m!==null&&(p.matrix.fromArray(m.transform.matrix),p.matrix.decompose(p.position,p.rotation,p.scale),p.matrixWorldNeedsUpdate=!0,p.jointRadius=m.radius),p.visible=m!==null}const u=l.joints["index-finger-tip"],h=l.joints["thumb-tip"],d=u.position.distanceTo(h.position),f=.02,_=.005;l.inputState.pinching&&d>f+_?(l.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!l.inputState.pinching&&d<=f-_&&(l.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else c!==null&&e.gripSpace&&(r=n.getPose(e.gripSpace,i),r!==null&&(c.matrix.fromArray(r.transform.matrix),c.matrix.decompose(c.position,c.rotation,c.scale),c.matrixWorldNeedsUpdate=!0,r.linearVelocity?(c.hasLinearVelocity=!0,c.linearVelocity.copy(r.linearVelocity)):c.hasLinearVelocity=!1,r.angularVelocity?(c.hasAngularVelocity=!0,c.angularVelocity.copy(r.angularVelocity)):c.hasAngularVelocity=!1,c.eventsEnabled&&c.dispatchEvent({type:"gripUpdated",data:e,target:this})));a!==null&&(s=n.getPose(e.targetRaySpace,i),s===null&&r!==null&&(s=r),s!==null&&(a.matrix.fromArray(s.transform.matrix),a.matrix.decompose(a.position,a.rotation,a.scale),a.matrixWorldNeedsUpdate=!0,s.linearVelocity?(a.hasLinearVelocity=!0,a.linearVelocity.copy(s.linearVelocity)):a.hasLinearVelocity=!1,s.angularVelocity?(a.hasAngularVelocity=!0,a.angularVelocity.copy(s.angularVelocity)):a.hasAngularVelocity=!1,this.dispatchEvent(lA)))}return a!==null&&(a.visible=s!==null),c!==null&&(c.visible=r!==null),l!==null&&(l.visible=o!==null),this}_getHandJoint(e,n){if(e.joints[n.jointName]===void 0){const i=new Do;i.matrixAutoUpdate=!1,i.visible=!1,e.joints[n.jointName]=i,e.add(i)}return e.joints[n.jointName]}}const IS={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},Ki={h:0,s:0,l:0},Uo={h:0,s:0,l:0};function Yc(t,e,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?t+(e-t)*6*n:n<1/2?e:n<2/3?t+(e-t)*6*(2/3-n):t}class at{constructor(e,n,i){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(e,n,i)}set(e,n,i){if(n===void 0&&i===void 0){const s=e;s&&s.isColor?this.copy(s):typeof s=="number"?this.setHex(s):typeof s=="string"&&this.setStyle(s)}else this.setRGB(e,n,i);return this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,n=Vn){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,ft.colorSpaceToWorking(this,n),this}setRGB(e,n,i,s=ft.workingColorSpace){return this.r=e,this.g=n,this.b=i,ft.colorSpaceToWorking(this,s),this}setHSL(e,n,i,s=ft.workingColorSpace){if(e=Vd(e,1),n=rt(n,0,1),i=rt(i,0,1),n===0)this.r=this.g=this.b=i;else{const r=i<=.5?i*(1+n):i+n-i*n,o=2*i-r;this.r=Yc(o,r,e+1/3),this.g=Yc(o,r,e),this.b=Yc(o,r,e-1/3)}return ft.colorSpaceToWorking(this,s),this}setStyle(e,n=Vn){function i(r){r!==void 0&&parseFloat(r)<1&&$e("Color: Alpha component of "+e+" will be ignored.")}let s;if(s=/^(\w+)\(([^\)]*)\)/.exec(e)){let r;const o=s[1],a=s[2];switch(o){case"rgb":case"rgba":if(r=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return i(r[4]),this.setRGB(Math.min(255,parseInt(r[1],10))/255,Math.min(255,parseInt(r[2],10))/255,Math.min(255,parseInt(r[3],10))/255,n);if(r=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return i(r[4]),this.setRGB(Math.min(100,parseInt(r[1],10))/100,Math.min(100,parseInt(r[2],10))/100,Math.min(100,parseInt(r[3],10))/100,n);break;case"hsl":case"hsla":if(r=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return i(r[4]),this.setHSL(parseFloat(r[1])/360,parseFloat(r[2])/100,parseFloat(r[3])/100,n);break;default:$e("Color: Unknown color model "+e)}}else if(s=/^\#([A-Fa-f\d]+)$/.exec(e)){const r=s[1],o=r.length;if(o===3)return this.setRGB(parseInt(r.charAt(0),16)/15,parseInt(r.charAt(1),16)/15,parseInt(r.charAt(2),16)/15,n);if(o===6)return this.setHex(parseInt(r,16),n);$e("Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,n);return this}setColorName(e,n=Vn){const i=IS[e.toLowerCase()];return i!==void 0?this.setHex(i,n):$e("Color: Unknown color "+e),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(e){return this.r=e.r,this.g=e.g,this.b=e.b,this}copySRGBToLinear(e){return this.r=Fi(e.r),this.g=Fi(e.g),this.b=Fi(e.b),this}copyLinearToSRGB(e){return this.r=ar(e.r),this.g=ar(e.g),this.b=ar(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=Vn){return ft.workingToColorSpace(pn.copy(this),e),Math.round(rt(pn.r*255,0,255))*65536+Math.round(rt(pn.g*255,0,255))*256+Math.round(rt(pn.b*255,0,255))}getHexString(e=Vn){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,n=ft.workingColorSpace){ft.workingToColorSpace(pn.copy(this),n);const i=pn.r,s=pn.g,r=pn.b,o=Math.max(i,s,r),a=Math.min(i,s,r);let c,l;const u=(a+o)/2;if(a===o)c=0,l=0;else{const h=o-a;switch(l=u<=.5?h/(o+a):h/(2-o-a),o){case i:c=(s-r)/h+(s<r?6:0);break;case s:c=(r-i)/h+2;break;case r:c=(i-s)/h+4;break}c/=6}return e.h=c,e.s=l,e.l=u,e}getRGB(e,n=ft.workingColorSpace){return ft.workingToColorSpace(pn.copy(this),n),e.r=pn.r,e.g=pn.g,e.b=pn.b,e}getStyle(e=Vn){ft.workingToColorSpace(pn.copy(this),e);const n=pn.r,i=pn.g,s=pn.b;return e!==Vn?`color(${e} ${n.toFixed(3)} ${i.toFixed(3)} ${s.toFixed(3)})`:`rgb(${Math.round(n*255)},${Math.round(i*255)},${Math.round(s*255)})`}offsetHSL(e,n,i){return this.getHSL(Ki),this.setHSL(Ki.h+e,Ki.s+n,Ki.l+i)}add(e){return this.r+=e.r,this.g+=e.g,this.b+=e.b,this}addColors(e,n){return this.r=e.r+n.r,this.g=e.g+n.g,this.b=e.b+n.b,this}addScalar(e){return this.r+=e,this.g+=e,this.b+=e,this}sub(e){return this.r=Math.max(0,this.r-e.r),this.g=Math.max(0,this.g-e.g),this.b=Math.max(0,this.b-e.b),this}multiply(e){return this.r*=e.r,this.g*=e.g,this.b*=e.b,this}multiplyScalar(e){return this.r*=e,this.g*=e,this.b*=e,this}lerp(e,n){return this.r+=(e.r-this.r)*n,this.g+=(e.g-this.g)*n,this.b+=(e.b-this.b)*n,this}lerpColors(e,n,i){return this.r=e.r+(n.r-e.r)*i,this.g=e.g+(n.g-e.g)*i,this.b=e.b+(n.b-e.b)*i,this}lerpHSL(e,n){this.getHSL(Ki),e.getHSL(Uo);const i=Jr(Ki.h,Uo.h,n),s=Jr(Ki.s,Uo.s,n),r=Jr(Ki.l,Uo.l,n);return this.setHSL(i,s,r),this}setFromVector3(e){return this.r=e.x,this.g=e.y,this.b=e.z,this}applyMatrix3(e){const n=this.r,i=this.g,s=this.b,r=e.elements;return this.r=r[0]*n+r[3]*i+r[6]*s,this.g=r[1]*n+r[4]*i+r[7]*s,this.b=r[2]*n+r[5]*i+r[8]*s,this}equals(e){return e.r===this.r&&e.g===this.g&&e.b===this.b}fromArray(e,n=0){return this.r=e[n],this.g=e[n+1],this.b=e[n+2],this}toArray(e=[],n=0){return e[n]=this.r,e[n+1]=this.g,e[n+2]=this.b,e}fromBufferAttribute(e,n){return this.r=e.getX(n),this.g=e.getY(n),this.b=e.getZ(n),this}toJSON(){return this.getHex()}*[Symbol.iterator](){yield this.r,yield this.g,yield this.b}}const pn=new at;at.NAMES=IS;class uA extends Tn{constructor(){super(),this.isScene=!0,this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.backgroundBlurriness=0,this.backgroundIntensity=1,this.backgroundRotation=new Ls,this.environmentIntensity=1,this.environmentRotation=new Ls,this.overrideMaterial=null,typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(e,n){return super.copy(e,n),e.background!==null&&(this.background=e.background.clone()),e.environment!==null&&(this.environment=e.environment.clone()),e.fog!==null&&(this.fog=e.fog.clone()),this.backgroundBlurriness=e.backgroundBlurriness,this.backgroundIntensity=e.backgroundIntensity,this.backgroundRotation.copy(e.backgroundRotation),this.environmentIntensity=e.environmentIntensity,this.environmentRotation.copy(e.environmentRotation),e.overrideMaterial!==null&&(this.overrideMaterial=e.overrideMaterial.clone()),this.matrixAutoUpdate=e.matrixAutoUpdate,this}toJSON(e){const n=super.toJSON(e);return this.fog!==null&&(n.object.fog=this.fog.toJSON()),n.object.backgroundBlurriness=this.backgroundBlurriness,n.object.backgroundIntensity=this.backgroundIntensity,n.object.backgroundRotation=this.backgroundRotation.toArray(),n.object.environmentIntensity=this.environmentIntensity,n.object.environmentRotation=this.environmentRotation.toArray(),n}}const Yn=new H,wi=new H,Kc=new H,Ai=new H,$s=new H,qs=new H,If=new H,jc=new H,Jc=new H,Qc=new H,el=new Vt,tl=new Vt,nl=new Vt;class Jn{constructor(e=new H,n=new H,i=new H){this.a=e,this.b=n,this.c=i}static getNormal(e,n,i,s){s.subVectors(i,n),Yn.subVectors(e,n),s.cross(Yn);const r=s.lengthSq();return r>0?s.multiplyScalar(1/Math.sqrt(r)):s.set(0,0,0)}static getBarycoord(e,n,i,s,r){Yn.subVectors(s,n),wi.subVectors(i,n),Kc.subVectors(e,n);const o=Yn.dot(Yn),a=Yn.dot(wi),c=Yn.dot(Kc),l=wi.dot(wi),u=wi.dot(Kc),h=o*l-a*a;if(h===0)return r.set(0,0,0),null;const d=1/h,f=(l*c-a*u)*d,_=(o*u-a*c)*d;return r.set(1-f-_,_,f)}static containsPoint(e,n,i,s){return this.getBarycoord(e,n,i,s,Ai)===null?!1:Ai.x>=0&&Ai.y>=0&&Ai.x+Ai.y<=1}static getInterpolation(e,n,i,s,r,o,a,c){return this.getBarycoord(e,n,i,s,Ai)===null?(c.x=0,c.y=0,"z"in c&&(c.z=0),"w"in c&&(c.w=0),null):(c.setScalar(0),c.addScaledVector(r,Ai.x),c.addScaledVector(o,Ai.y),c.addScaledVector(a,Ai.z),c)}static getInterpolatedAttribute(e,n,i,s,r,o){return el.setScalar(0),tl.setScalar(0),nl.setScalar(0),el.fromBufferAttribute(e,n),tl.fromBufferAttribute(e,i),nl.fromBufferAttribute(e,s),o.setScalar(0),o.addScaledVector(el,r.x),o.addScaledVector(tl,r.y),o.addScaledVector(nl,r.z),o}static isFrontFacing(e,n,i,s){return Yn.subVectors(i,n),wi.subVectors(e,n),Yn.cross(wi).dot(s)<0}set(e,n,i){return this.a.copy(e),this.b.copy(n),this.c.copy(i),this}setFromPointsAndIndices(e,n,i,s){return this.a.copy(e[n]),this.b.copy(e[i]),this.c.copy(e[s]),this}setFromAttributeAndIndices(e,n,i,s){return this.a.fromBufferAttribute(e,n),this.b.fromBufferAttribute(e,i),this.c.fromBufferAttribute(e,s),this}clone(){return new this.constructor().copy(this)}copy(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this}getArea(){return Yn.subVectors(this.c,this.b),wi.subVectors(this.a,this.b),Yn.cross(wi).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return Jn.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,n){return Jn.getBarycoord(e,this.a,this.b,this.c,n)}getInterpolation(e,n,i,s,r){return Jn.getInterpolation(e,this.a,this.b,this.c,n,i,s,r)}containsPoint(e){return Jn.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return Jn.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,n){const i=this.a,s=this.b,r=this.c;let o,a;$s.subVectors(s,i),qs.subVectors(r,i),jc.subVectors(e,i);const c=$s.dot(jc),l=qs.dot(jc);if(c<=0&&l<=0)return n.copy(i);Jc.subVectors(e,s);const u=$s.dot(Jc),h=qs.dot(Jc);if(u>=0&&h<=u)return n.copy(s);const d=c*h-u*l;if(d<=0&&c>=0&&u<=0)return o=c/(c-u),n.copy(i).addScaledVector($s,o);Qc.subVectors(e,r);const f=$s.dot(Qc),_=qs.dot(Qc);if(_>=0&&f<=_)return n.copy(r);const x=f*l-c*_;if(x<=0&&l>=0&&_<=0)return a=l/(l-_),n.copy(i).addScaledVector(qs,a);const m=u*_-f*h;if(m<=0&&h-u>=0&&f-_>=0)return If.subVectors(r,s),a=(h-u)/(h-u+(f-_)),n.copy(s).addScaledVector(If,a);const p=1/(m+x+d);return o=x*p,a=d*p,n.copy(i).addScaledVector($s,o).addScaledVector(qs,a)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}class Is{constructor(e=new H(1/0,1/0,1/0),n=new H(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=e,this.max=n}set(e,n){return this.min.copy(e),this.max.copy(n),this}setFromArray(e){this.makeEmpty();for(let n=0,i=e.length;n<i;n+=3)this.expandByPoint(Kn.fromArray(e,n));return this}setFromBufferAttribute(e){this.makeEmpty();for(let n=0,i=e.count;n<i;n++)this.expandByPoint(Kn.fromBufferAttribute(e,n));return this}setFromPoints(e){this.makeEmpty();for(let n=0,i=e.length;n<i;n++)this.expandByPoint(e[n]);return this}setFromCenterAndSize(e,n){const i=Kn.copy(n).multiplyScalar(.5);return this.min.copy(e).sub(i),this.max.copy(e).add(i),this}setFromObject(e,n=!1){return this.makeEmpty(),this.expandByObject(e,n)}clone(){return new this.constructor().copy(this)}copy(e){return this.min.copy(e.min),this.max.copy(e.max),this}makeEmpty(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z}getCenter(e){return this.isEmpty()?e.set(0,0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(e){return this.isEmpty()?e.set(0,0,0):e.subVectors(this.max,this.min)}expandByPoint(e){return this.min.min(e),this.max.max(e),this}expandByVector(e){return this.min.sub(e),this.max.add(e),this}expandByScalar(e){return this.min.addScalar(-e),this.max.addScalar(e),this}expandByObject(e,n=!1){e.updateWorldMatrix(!1,!1);const i=e.geometry;if(i!==void 0){const r=i.getAttribute("position");if(n===!0&&r!==void 0&&e.isInstancedMesh!==!0)for(let o=0,a=r.count;o<a;o++)e.isMesh===!0?e.getVertexPosition(o,Kn):Kn.fromBufferAttribute(r,o),Kn.applyMatrix4(e.matrixWorld),this.expandByPoint(Kn);else e.boundingBox!==void 0?(e.boundingBox===null&&e.computeBoundingBox(),Oo.copy(e.boundingBox)):(i.boundingBox===null&&i.computeBoundingBox(),Oo.copy(i.boundingBox)),Oo.applyMatrix4(e.matrixWorld),this.union(Oo)}const s=e.children;for(let r=0,o=s.length;r<o;r++)this.expandByObject(s[r],n);return this}containsPoint(e){return e.x>=this.min.x&&e.x<=this.max.x&&e.y>=this.min.y&&e.y<=this.max.y&&e.z>=this.min.z&&e.z<=this.max.z}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z}getParameter(e,n){return n.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(e){return e.max.x>=this.min.x&&e.min.x<=this.max.x&&e.max.y>=this.min.y&&e.min.y<=this.max.y&&e.max.z>=this.min.z&&e.min.z<=this.max.z}intersectsSphere(e){return this.clampPoint(e.center,Kn),Kn.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let n,i;return e.normal.x>0?(n=e.normal.x*this.min.x,i=e.normal.x*this.max.x):(n=e.normal.x*this.max.x,i=e.normal.x*this.min.x),e.normal.y>0?(n+=e.normal.y*this.min.y,i+=e.normal.y*this.max.y):(n+=e.normal.y*this.max.y,i+=e.normal.y*this.min.y),e.normal.z>0?(n+=e.normal.z*this.min.z,i+=e.normal.z*this.max.z):(n+=e.normal.z*this.max.z,i+=e.normal.z*this.min.z),n<=-e.constant&&i>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(Or),Fo.subVectors(this.max,Or),Ws.subVectors(e.a,Or),Zs.subVectors(e.b,Or),Xs.subVectors(e.c,Or),ji.subVectors(Zs,Ws),Ji.subVectors(Xs,Zs),gs.subVectors(Ws,Xs);let n=[0,-ji.z,ji.y,0,-Ji.z,Ji.y,0,-gs.z,gs.y,ji.z,0,-ji.x,Ji.z,0,-Ji.x,gs.z,0,-gs.x,-ji.y,ji.x,0,-Ji.y,Ji.x,0,-gs.y,gs.x,0];return!il(n,Ws,Zs,Xs,Fo)||(n=[1,0,0,0,1,0,0,0,1],!il(n,Ws,Zs,Xs,Fo))?!1:(ko.crossVectors(ji,Ji),n=[ko.x,ko.y,ko.z],il(n,Ws,Zs,Xs,Fo))}clampPoint(e,n){return n.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,Kn).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(Kn).length()*.5),e}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}applyMatrix4(e){return this.isEmpty()?this:(Ci[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),Ci[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),Ci[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),Ci[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),Ci[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),Ci[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),Ci[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),Ci[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(Ci),this)}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}toJSON(){return{min:this.min.toArray(),max:this.max.toArray()}}fromJSON(e){return this.min.fromArray(e.min),this.max.fromArray(e.max),this}}const Ci=[new H,new H,new H,new H,new H,new H,new H,new H],Kn=new H,Oo=new Is,Ws=new H,Zs=new H,Xs=new H,ji=new H,Ji=new H,gs=new H,Or=new H,Fo=new H,ko=new H,_s=new H;function il(t,e,n,i,s){for(let r=0,o=t.length-3;r<=o;r+=3){_s.fromArray(t,r);const a=s.x*Math.abs(_s.x)+s.y*Math.abs(_s.y)+s.z*Math.abs(_s.z),c=e.dot(_s),l=n.dot(_s),u=i.dot(_s);if(Math.max(-Math.max(c,l,u),Math.min(c,l,u))>a)return!1}return!0}const Zt=new H,zo=new je;let dA=0;class ti extends us{constructor(e,n,i=!1){if(super(),Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,Object.defineProperty(this,"id",{value:dA++}),this.name="",this.array=e,this.itemSize=n,this.count=e!==void 0?e.length/n:0,this.normalized=i,this.usage=Pw,this.updateRanges=[],this.gpuType=mi,this.version=0}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}addUpdateRange(e,n){this.updateRanges.push({start:e,count:n})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.usage=e.usage,this.gpuType=e.gpuType,this}copyAt(e,n,i){e*=this.itemSize,i*=n.itemSize;for(let s=0,r=this.itemSize;s<r;s++)this.array[e+s]=n.array[i+s];return this}copyArray(e){return this.array.set(e),this}applyMatrix3(e){if(this.itemSize===2)for(let n=0,i=this.count;n<i;n++)zo.fromBufferAttribute(this,n),zo.applyMatrix3(e),this.setXY(n,zo.x,zo.y);else if(this.itemSize===3)for(let n=0,i=this.count;n<i;n++)Zt.fromBufferAttribute(this,n),Zt.applyMatrix3(e),this.setXYZ(n,Zt.x,Zt.y,Zt.z);return this}applyMatrix4(e){for(let n=0,i=this.count;n<i;n++)Zt.fromBufferAttribute(this,n),Zt.applyMatrix4(e),this.setXYZ(n,Zt.x,Zt.y,Zt.z);return this}applyNormalMatrix(e){for(let n=0,i=this.count;n<i;n++)Zt.fromBufferAttribute(this,n),Zt.applyNormalMatrix(e),this.setXYZ(n,Zt.x,Zt.y,Zt.z);return this}transformDirection(e){for(let n=0,i=this.count;n<i;n++)Zt.fromBufferAttribute(this,n),Zt.transformDirection(e),this.setXYZ(n,Zt.x,Zt.y,Zt.z);return this}set(e,n=0){return this.array.set(e,n),this}getComponent(e,n){let i=this.array[e*this.itemSize+n];return this.normalized&&(i=er(i,this.array)),i}setComponent(e,n,i){return this.normalized&&(i=yn(i,this.array)),this.array[e*this.itemSize+n]=i,this}getX(e){let n=this.array[e*this.itemSize];return this.normalized&&(n=er(n,this.array)),n}setX(e,n){return this.normalized&&(n=yn(n,this.array)),this.array[e*this.itemSize]=n,this}getY(e){let n=this.array[e*this.itemSize+1];return this.normalized&&(n=er(n,this.array)),n}setY(e,n){return this.normalized&&(n=yn(n,this.array)),this.array[e*this.itemSize+1]=n,this}getZ(e){let n=this.array[e*this.itemSize+2];return this.normalized&&(n=er(n,this.array)),n}setZ(e,n){return this.normalized&&(n=yn(n,this.array)),this.array[e*this.itemSize+2]=n,this}getW(e){let n=this.array[e*this.itemSize+3];return this.normalized&&(n=er(n,this.array)),n}setW(e,n){return this.normalized&&(n=yn(n,this.array)),this.array[e*this.itemSize+3]=n,this}setXY(e,n,i){return e*=this.itemSize,this.normalized&&(n=yn(n,this.array),i=yn(i,this.array)),this.array[e+0]=n,this.array[e+1]=i,this}setXYZ(e,n,i,s){return e*=this.itemSize,this.normalized&&(n=yn(n,this.array),i=yn(i,this.array),s=yn(s,this.array)),this.array[e+0]=n,this.array[e+1]=i,this.array[e+2]=s,this}setXYZW(e,n,i,s,r){return e*=this.itemSize,this.normalized&&(n=yn(n,this.array),i=yn(i,this.array),s=yn(s,this.array),r=yn(r,this.array)),this.array[e+0]=n,this.array[e+1]=i,this.array[e+2]=s,this.array[e+3]=r,this}onUpload(e){return this.onUploadCallback=e,this}clone(){return new this.constructor(this.array,this.itemSize).copy(this)}toJSON(){const e={itemSize:this.itemSize,type:this.array.constructor.name,array:Array.from(this.array),normalized:this.normalized};return e.name=this.name,e.usage=this.usage,e.gpuType=this.gpuType,e}dispose(){this.dispatchEvent({type:"dispose"})}}class NS extends ti{constructor(e,n,i){super(new Uint16Array(e),n,i)}}class DS extends ti{constructor(e,n,i){super(new Uint32Array(e),n,i)}}class on extends ti{constructor(e,n,i){super(new Float32Array(e),n,i)}}const hA=new Is,Fr=new H,sl=new H;class uc{constructor(e=new H,n=-1){this.isSphere=!0,this.center=e,this.radius=n}set(e,n){return this.center.copy(e),this.radius=n,this}setFromPoints(e,n){const i=this.center;n!==void 0?i.copy(n):hA.setFromPoints(e).getCenter(i);let s=0;for(let r=0,o=e.length;r<o;r++)s=Math.max(s,i.distanceToSquared(e[r]));return this.radius=Math.sqrt(s),this}copy(e){return this.center.copy(e.center),this.radius=e.radius,this}isEmpty(){return this.radius<0}makeEmpty(){return this.center.set(0,0,0),this.radius=-1,this}containsPoint(e){return e.distanceToSquared(this.center)<=this.radius*this.radius}distanceToPoint(e){return e.distanceTo(this.center)-this.radius}intersectsSphere(e){const n=this.radius+e.radius;return e.center.distanceToSquared(this.center)<=n*n}intersectsBox(e){return e.intersectsSphere(this)}intersectsPlane(e){return Math.abs(e.distanceToPoint(this.center))<=this.radius}clampPoint(e,n){const i=this.center.distanceToSquared(e);return n.copy(e),i>this.radius*this.radius&&(n.sub(this.center).normalize(),n.multiplyScalar(this.radius).add(this.center)),n}getBoundingBox(e){return this.isEmpty()?(e.makeEmpty(),e):(e.set(this.center,this.center),e.expandByScalar(this.radius),e)}applyMatrix4(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this}translate(e){return this.center.add(e),this}expandByPoint(e){if(this.isEmpty())return this.center.copy(e),this.radius=0,this;Fr.subVectors(e,this.center);const n=Fr.lengthSq();if(n>this.radius*this.radius){const i=Math.sqrt(n),s=(i-this.radius)*.5;this.center.addScaledVector(Fr,s/i),this.radius+=s}return this}union(e){return e.isEmpty()?this:this.isEmpty()?(this.copy(e),this):(this.center.equals(e.center)===!0?this.radius=Math.max(this.radius,e.radius):(sl.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(Fr.copy(e.center).add(sl)),this.expandByPoint(Fr.copy(e.center).sub(sl))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}toJSON(){return{radius:this.radius,center:this.center.toArray()}}fromJSON(e){return this.radius=e.radius,this.center.fromArray(e.center),this}}let fA=0;const Hn=new $t,rl=new Tn,Ys=new H,Fn=new Is,kr=new Is,tn=new H;class Nn extends us{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:fA++}),this.uuid=Pr(),this.name="",this.type="BufferGeometry",this.index=null,this.indirect=null,this.indirectOffset=0,this.attributes={},this.morphAttributes={},this.morphTargetsRelative=!1,this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={},this._transformed=!1}getIndex(){return this.index}setIndex(e){return Array.isArray(e)?this.index=new(Lw(e)?DS:NS)(e,1):this.index=e,this}setIndirect(e,n=0){return this.indirect=e,this.indirectOffset=n,this}getIndirect(){return this.indirect}getAttribute(e){return this.attributes[e]}setAttribute(e,n){return this.attributes[e]=n,this}deleteAttribute(e){return delete this.attributes[e],this}hasAttribute(e){return this.attributes[e]!==void 0}addGroup(e,n,i=0){this.groups.push({start:e,count:n,materialIndex:i})}clearGroups(){this.groups=[]}setDrawRange(e,n){this.drawRange.start=e,this.drawRange.count=n}applyMatrix4(e){const n=this.attributes.position;n!==void 0&&(n.applyMatrix4(e),n.needsUpdate=!0);const i=this.attributes.normal;if(i!==void 0){const r=new Ke().getNormalMatrix(e);i.applyNormalMatrix(r),i.needsUpdate=!0}const s=this.attributes.tangent;return s!==void 0&&(s.transformDirection(e),s.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this._transformed=!0,this}applyQuaternion(e){return Hn.makeRotationFromQuaternion(e),this.applyMatrix4(Hn),this}rotateX(e){return Hn.makeRotationX(e),this.applyMatrix4(Hn),this}rotateY(e){return Hn.makeRotationY(e),this.applyMatrix4(Hn),this}rotateZ(e){return Hn.makeRotationZ(e),this.applyMatrix4(Hn),this}translate(e,n,i){return Hn.makeTranslation(e,n,i),this.applyMatrix4(Hn),this}scale(e,n,i){return Hn.makeScale(e,n,i),this.applyMatrix4(Hn),this}lookAt(e){return rl.lookAt(e),rl.updateMatrix(),this.applyMatrix4(rl.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(Ys).negate(),this.translate(Ys.x,Ys.y,Ys.z),this}setFromPoints(e){const n=this.getAttribute("position");if(n===void 0){const i=[];for(let s=0,r=e.length;s<r;s++){const o=e[s];i.push(o.x,o.y,o.z||0)}this.setAttribute("position",new on(i,3))}else{const i=Math.min(e.length,n.count);for(let s=0;s<i;s++){const r=e[s];n.setXYZ(s,r.x,r.y,r.z||0)}e.length>n.count&&$e("BufferGeometry: Buffer size too small for points data. Use .dispose() and create a new geometry."),n.needsUpdate=!0}return this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new Is);const e=this.attributes.position,n=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){vt("BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),this.boundingBox.set(new H(-1/0,-1/0,-1/0),new H(1/0,1/0,1/0));return}if(e!==void 0){if(this.boundingBox.setFromBufferAttribute(e),n)for(let i=0,s=n.length;i<s;i++){const r=n[i];Fn.setFromBufferAttribute(r),this.morphTargetsRelative?(tn.addVectors(this.boundingBox.min,Fn.min),this.boundingBox.expandByPoint(tn),tn.addVectors(this.boundingBox.max,Fn.max),this.boundingBox.expandByPoint(tn)):(this.boundingBox.expandByPoint(Fn.min),this.boundingBox.expandByPoint(Fn.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&vt('BufferGeometry.computeBoundingBox(): Computed min/max have NaN values. The "position" attribute is likely to have NaN values.',this)}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new uc);const e=this.attributes.position,n=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){vt("BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere.",this),this.boundingSphere.set(new H,1/0);return}if(e){const i=this.boundingSphere.center;if(Fn.setFromBufferAttribute(e),n)for(let r=0,o=n.length;r<o;r++){const a=n[r];kr.setFromBufferAttribute(a),this.morphTargetsRelative?(tn.addVectors(Fn.min,kr.min),Fn.expandByPoint(tn),tn.addVectors(Fn.max,kr.max),Fn.expandByPoint(tn)):(Fn.expandByPoint(kr.min),Fn.expandByPoint(kr.max))}Fn.getCenter(i);let s=0;for(let r=0,o=e.count;r<o;r++)tn.fromBufferAttribute(e,r),s=Math.max(s,i.distanceToSquared(tn));if(n)for(let r=0,o=n.length;r<o;r++){const a=n[r],c=this.morphTargetsRelative;for(let l=0,u=a.count;l<u;l++)tn.fromBufferAttribute(a,l),c&&(Ys.fromBufferAttribute(e,l),tn.add(Ys)),s=Math.max(s,i.distanceToSquared(tn))}this.boundingSphere.radius=Math.sqrt(s),isNaN(this.boundingSphere.radius)&&vt('BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}computeTangents(){const e=this.index,n=this.attributes;if(e===null||n.position===void 0||n.normal===void 0||n.uv===void 0){vt("BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");return}const i=n.position,s=n.normal,r=n.uv;let o=this.getAttribute("tangent");(o===void 0||o.count!==i.count)&&(o=new ti(new Float32Array(4*i.count),4),this.setAttribute("tangent",o));const a=[],c=[];for(let v=0;v<i.count;v++)a[v]=new H,c[v]=new H;const l=new H,u=new H,h=new H,d=new je,f=new je,_=new je,x=new H,m=new H;function p(v,T,L){l.fromBufferAttribute(i,v),u.fromBufferAttribute(i,T),h.fromBufferAttribute(i,L),d.fromBufferAttribute(r,v),f.fromBufferAttribute(r,T),_.fromBufferAttribute(r,L),u.sub(l),h.sub(l),f.sub(d),_.sub(d);const N=1/(f.x*_.y-_.x*f.y);isFinite(N)&&(x.copy(u).multiplyScalar(_.y).addScaledVector(h,-f.y).multiplyScalar(N),m.copy(h).multiplyScalar(f.x).addScaledVector(u,-_.x).multiplyScalar(N),a[v].add(x),a[T].add(x),a[L].add(x),c[v].add(m),c[T].add(m),c[L].add(m))}let E=this.groups;E.length===0&&(E=[{start:0,count:e.count}]);for(let v=0,T=E.length;v<T;++v){const L=E[v],N=L.start,k=L.count;for(let q=N,U=N+k;q<U;q+=3)p(e.getX(q+0),e.getX(q+1),e.getX(q+2))}const I=new H,b=new H,w=new H,A=new H;function P(v){w.fromBufferAttribute(s,v),A.copy(w);const T=a[v];I.copy(T),I.sub(w.multiplyScalar(w.dot(T))).normalize(),b.crossVectors(A,T);const N=b.dot(c[v])<0?-1:1;o.setXYZW(v,I.x,I.y,I.z,N)}for(let v=0,T=E.length;v<T;++v){const L=E[v],N=L.start,k=L.count;for(let q=N,U=N+k;q<U;q+=3)P(e.getX(q+0)),P(e.getX(q+1)),P(e.getX(q+2))}this._transformed=!0}computeVertexNormals(){const e=this.index,n=this.getAttribute("position");if(n!==void 0){let i=this.getAttribute("normal");if(i===void 0||i.count!==n.count)i=new ti(new Float32Array(n.count*3),3),this.setAttribute("normal",i);else for(let d=0,f=i.count;d<f;d++)i.setXYZ(d,0,0,0);const s=new H,r=new H,o=new H,a=new H,c=new H,l=new H,u=new H,h=new H;if(e)for(let d=0,f=e.count;d<f;d+=3){const _=e.getX(d+0),x=e.getX(d+1),m=e.getX(d+2);s.fromBufferAttribute(n,_),r.fromBufferAttribute(n,x),o.fromBufferAttribute(n,m),u.subVectors(o,r),h.subVectors(s,r),u.cross(h),a.fromBufferAttribute(i,_),c.fromBufferAttribute(i,x),l.fromBufferAttribute(i,m),a.add(u),c.add(u),l.add(u),i.setXYZ(_,a.x,a.y,a.z),i.setXYZ(x,c.x,c.y,c.z),i.setXYZ(m,l.x,l.y,l.z)}else for(let d=0,f=n.count;d<f;d+=3)s.fromBufferAttribute(n,d+0),r.fromBufferAttribute(n,d+1),o.fromBufferAttribute(n,d+2),u.subVectors(o,r),h.subVectors(s,r),u.cross(h),i.setXYZ(d+0,u.x,u.y,u.z),i.setXYZ(d+1,u.x,u.y,u.z),i.setXYZ(d+2,u.x,u.y,u.z);this.normalizeNormals(),i.needsUpdate=!0}}normalizeNormals(){const e=this.attributes.normal;for(let n=0,i=e.count;n<i;n++)tn.fromBufferAttribute(e,n),tn.normalize(),e.setXYZ(n,tn.x,tn.y,tn.z)}toNonIndexed(){function e(a,c){const l=a.array,u=a.itemSize,h=a.normalized,d=new l.constructor(c.length*u);let f=0,_=0;for(let x=0,m=c.length;x<m;x++){a.isInterleavedBufferAttribute?f=c[x]*a.data.stride+a.offset:f=c[x]*u;for(let p=0;p<u;p++)d[_++]=l[f++]}return new ti(d,u,h)}if(this.index===null)return $e("BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;const n=new Nn,i=this.index.array,s=this.attributes;for(const a in s){const c=s[a],l=e(c,i);n.setAttribute(a,l)}const r=this.morphAttributes;for(const a in r){const c=[],l=r[a];for(let u=0,h=l.length;u<h;u++){const d=l[u],f=e(d,i);c.push(f)}n.morphAttributes[a]=c}n.morphTargetsRelative=this.morphTargetsRelative;const o=this.groups;for(let a=0,c=o.length;a<c;a++){const l=o[a];n.addGroup(l.start,l.count,l.materialIndex)}return n}toJSON(){const e={metadata:{version:4.7,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(e.uuid=this.uuid,e.type=this.parameters!==void 0&&this._transformed===!0?"BufferGeometry":this.type,e.name=this.name,Object.keys(this.userData).length>0&&(e.userData=this.userData),this.parameters!==void 0&&this._transformed!==!0){const c=this.parameters;for(const l in c)c[l]!==void 0&&(e[l]=c[l]);return e}e.data={attributes:{}};const n=this.index;n!==null&&(e.data.index={type:n.array.constructor.name,array:Array.prototype.slice.call(n.array)});const i=this.attributes;for(const c in i){const l=i[c];e.data.attributes[c]=l.toJSON(e.data)}const s={};let r=!1;for(const c in this.morphAttributes){const l=this.morphAttributes[c],u=[];for(let h=0,d=l.length;h<d;h++){const f=l[h];u.push(f.toJSON(e.data))}u.length>0&&(s[c]=u,r=!0)}r&&(e.data.morphAttributes=s,e.data.morphTargetsRelative=this.morphTargetsRelative);const o=this.groups;o.length>0&&(e.data.groups=JSON.parse(JSON.stringify(o)));const a=this.boundingSphere;return a!==null&&(e.data.boundingSphere=a.toJSON()),e}clone(){return new this.constructor().copy(this)}copy(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;const n={};this.name=e.name;const i=e.index;i!==null&&this.setIndex(i.clone());const s=e.attributes;for(const l in s){const u=s[l];this.setAttribute(l,u.clone(n))}const r=e.morphAttributes;for(const l in r){const u=[],h=r[l];for(let d=0,f=h.length;d<f;d++)u.push(h[d].clone(n));this.morphAttributes[l]=u}this.morphTargetsRelative=e.morphTargetsRelative;const o=e.groups;for(let l=0,u=o.length;l<u;l++){const h=o[l];this.addGroup(h.start,h.count,h.materialIndex)}const a=e.boundingBox;a!==null&&(this.boundingBox=a.clone());const c=e.boundingSphere;return c!==null&&(this.boundingSphere=c.clone()),this.drawRange.start=e.drawRange.start,this.drawRange.count=e.drawRange.count,this.userData=e.userData,this._transformed=e._transformed,this}dispose(){this.dispatchEvent({type:"dispose"})}}const ol=new H,pA=new H,mA=new Ke;class Ii{constructor(e=new H(1,0,0),n=0){this.isPlane=!0,this.normal=e,this.constant=n}set(e,n){return this.normal.copy(e),this.constant=n,this}setComponents(e,n,i,s){return this.normal.set(e,n,i),this.constant=s,this}setFromNormalAndCoplanarPoint(e,n){return this.normal.copy(e),this.constant=-n.dot(this.normal),this}setFromCoplanarPoints(e,n,i){const s=ol.subVectors(i,n).cross(pA.subVectors(e,n)).normalize();return this.setFromNormalAndCoplanarPoint(s,e),this}copy(e){return this.normal.copy(e.normal),this.constant=e.constant,this}normalize(){const e=1/this.normal.length();return this.normal.multiplyScalar(e),this.constant*=e,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(e){return this.normal.dot(e)+this.constant}distanceToSphere(e){return this.distanceToPoint(e.center)-e.radius}projectPoint(e,n){return n.copy(e).addScaledVector(this.normal,-this.distanceToPoint(e))}intersectLine(e,n,i=!0){const s=e.delta(ol),r=this.normal.dot(s);if(r===0)return this.distanceToPoint(e.start)===0?n.copy(e.start):null;const o=-(e.start.dot(this.normal)+this.constant)/r;return i===!0&&(o<0||o>1)?null:n.copy(e.start).addScaledVector(s,o)}intersectsLine(e){const n=this.distanceToPoint(e.start),i=this.distanceToPoint(e.end);return n<0&&i>0||i<0&&n>0}intersectsBox(e){return e.intersectsPlane(this)}intersectsSphere(e){return e.intersectsPlane(this)}coplanarPoint(e){return e.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(e,n){const i=n||mA.getNormalMatrix(e),s=this.coplanarPoint(ol).applyMatrix4(e),r=this.normal.applyMatrix3(i).normalize();return this.constant=-s.dot(r),this}translate(e){return this.constant-=e.dot(this.normal),this}equals(e){return e.normal.equals(this.normal)&&e.constant===this.constant}clone(){return new this.constructor().copy(this)}toJSON(){return{normal:this.normal.toArray(),constant:this.constant}}fromJSON(e){return this.normal.fromArray(e.normal),this.constant=e.constant,this}}let gA=0;class _o extends us{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:gA++}),this.uuid=Pr(),this.name="",this.type="Material",this.blending=Kr,this.side=As,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=uS,this.blendDst=dS,this.blendEquation=Qs,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new at(0,0,0),this.blendAlpha=0,this.depthFunc=co,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=Mw,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=Vc,this.stencilZFail=Vc,this.stencilZPass=Vc,this.stencilWrite=!1,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaToCoverage=!1,this.premultipliedAlpha=!1,this.forceSinglePass=!1,this.allowOverride=!0,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0,this._alphaTest=0}get alphaTest(){return this._alphaTest}set alphaTest(e){this._alphaTest>0!=e>0&&this.version++,this._alphaTest=e}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(e!==void 0)for(const n in e){const i=e[n];if(i===void 0){$e(`Material: parameter '${n}' has value of undefined.`);continue}const s=this[n];if(s===void 0){$e(`Material: '${n}' is not a property of THREE.${this.type}.`);continue}s&&s.isColor?s.set(i):s&&s.isVector2&&i&&i.isVector2||s&&s.isEuler&&i&&i.isEuler||s&&s.isVector3&&i&&i.isVector3?s.copy(i):this[n]=i}}toJSON(e){const n=e===void 0||typeof e=="string";n&&(e={textures:{},images:{}});const i={metadata:{version:4.7,type:"Material",generator:"Material.toJSON"}};i.uuid=this.uuid,i.type=this.type,i.blending=this.blending,i.side=this.side,i.shadowSide=this.shadowSide,i.vertexColors=this.vertexColors,i.opacity=this.opacity,i.transparent=this.transparent,i.blendSrc=this.blendSrc,i.blendDst=this.blendDst,i.blendEquation=this.blendEquation,i.blendSrcAlpha=this.blendSrcAlpha,i.blendDstAlpha=this.blendDstAlpha,i.blendEquationAlpha=this.blendEquationAlpha,i.blendColor=this.blendColor.getHex(),i.blendAlpha=this.blendAlpha,i.depthFunc=this.depthFunc,i.depthTest=this.depthTest,i.depthWrite=this.depthWrite,i.colorWrite=this.colorWrite,i.clipIntersection=this.clipIntersection,i.clipShadows=this.clipShadows,i.stencilWriteMask=this.stencilWriteMask,i.stencilFunc=this.stencilFunc,i.stencilRef=this.stencilRef,i.stencilFuncMask=this.stencilFuncMask,i.stencilFail=this.stencilFail,i.stencilZFail=this.stencilZFail,i.stencilZPass=this.stencilZPass,i.stencilWrite=this.stencilWrite,i.polygonOffset=this.polygonOffset,i.polygonOffsetFactor=this.polygonOffsetFactor,i.polygonOffsetUnits=this.polygonOffsetUnits,i.dithering=this.dithering,i.alphaTest=this.alphaTest,i.alphaHash=this.alphaHash,i.alphaToCoverage=this.alphaToCoverage,i.premultipliedAlpha=this.premultipliedAlpha,i.forceSinglePass=this.forceSinglePass,i.allowOverride=this.allowOverride,i.visible=this.visible,i.toneMapped=this.toneMapped,i.name=this.name,this.color&&this.color.isColor&&(i.color=this.color.getHex()),this.roughness!==void 0&&(i.roughness=this.roughness),this.metalness!==void 0&&(i.metalness=this.metalness),this.sheen!==void 0&&(i.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(i.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(i.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(i.emissive=this.emissive.getHex()),this.emissiveIntensity!==void 0&&(i.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(i.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(i.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(i.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(i.shininess=this.shininess),this.clearcoat!==void 0&&(i.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(i.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(i.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(i.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(i.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,i.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.sheenColorMap&&this.sheenColorMap.isTexture&&(i.sheenColorMap=this.sheenColorMap.toJSON(e).uuid),this.sheenRoughnessMap&&this.sheenRoughnessMap.isTexture&&(i.sheenRoughnessMap=this.sheenRoughnessMap.toJSON(e).uuid),this.dispersion!==void 0&&(i.dispersion=this.dispersion),this.retroreflectivity!==void 0&&(i.retroreflectivity=this.retroreflectivity),this.iridescence!==void 0&&(i.iridescence=this.iridescence),this.iridescenceIOR!==void 0&&(i.iridescenceIOR=this.iridescenceIOR),this.iridescenceThicknessRange!==void 0&&(i.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(i.iridescenceMap=this.iridescenceMap.toJSON(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(i.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid),this.anisotropy!==void 0&&(i.anisotropy=this.anisotropy),this.anisotropyRotation!==void 0&&(i.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(i.anisotropyMap=this.anisotropyMap.toJSON(e).uuid),this.map&&this.map.isTexture&&(i.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(i.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(i.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(i.lightMap=this.lightMap.toJSON(e).uuid,i.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(i.aoMap=this.aoMap.toJSON(e).uuid,i.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(i.bumpMap=this.bumpMap.toJSON(e).uuid,i.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(i.normalMap=this.normalMap.toJSON(e).uuid,i.normalMapType=this.normalMapType,i.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(i.displacementMap=this.displacementMap.toJSON(e).uuid,i.displacementScale=this.displacementScale,i.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(i.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(i.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(i.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(i.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(i.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(i.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(i.envMap=this.envMap.toJSON(e).uuid,this.combine!==void 0&&(i.combine=this.combine)),this.envMapRotation!==void 0&&(i.envMapRotation=this.envMapRotation.toArray()),this.envMapIntensity!==void 0&&(i.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(i.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(i.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(i.gradientMap=this.gradientMap.toJSON(e).uuid),this.transmission!==void 0&&(i.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(i.transmissionMap=this.transmissionMap.toJSON(e).uuid),this.thickness!==void 0&&(i.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(i.thicknessMap=this.thicknessMap.toJSON(e).uuid),this.attenuationDistance!==void 0&&(i.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(i.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(i.size=this.size),this.sizeAttenuation!==void 0&&(i.sizeAttenuation=this.sizeAttenuation),Array.isArray(this.clippingPlanes)&&this.clippingPlanes.length>0&&(i.clippingPlanes=this.clippingPlanes.map(r=>r.toJSON())),this.rotation!==void 0&&(i.rotation=this.rotation),this.depthPacking!==void 0&&(i.depthPacking=this.depthPacking),this.linewidth!==void 0&&(i.linewidth=this.linewidth),this.linecap!==void 0&&(i.linecap=this.linecap),this.linejoin!==void 0&&(i.linejoin=this.linejoin),this.dashSize!==void 0&&(i.dashSize=this.dashSize),this.gapSize!==void 0&&(i.gapSize=this.gapSize),this.scale!==void 0&&(i.scale=this.scale),this.wireframe!==void 0&&(i.wireframe=this.wireframe),this.wireframeLinewidth!==void 0&&(i.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!==void 0&&(i.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!==void 0&&(i.wireframeLinejoin=this.wireframeLinejoin),this.flatShading!==void 0&&(i.flatShading=this.flatShading),this.fog!==void 0&&(i.fog=this.fog),Object.keys(this.userData).length>0&&(i.userData=this.userData);function s(r){const o=[];for(const a in r){const c=r[a];delete c.metadata,o.push(c)}return o}if(n){const r=s(e.textures),o=s(e.images);r.length>0&&(i.textures=r),o.length>0&&(i.images=o)}return i}fromJSON(e,n){if(e.uuid!==void 0&&(this.uuid=e.uuid),e.name!==void 0&&(this.name=e.name),e.color!==void 0&&this.color!==void 0&&this.color.setHex(e.color),e.roughness!==void 0&&(this.roughness=e.roughness),e.metalness!==void 0&&(this.metalness=e.metalness),e.sheen!==void 0&&(this.sheen=e.sheen),e.sheenColor!==void 0&&(this.sheenColor=new at().setHex(e.sheenColor)),e.sheenRoughness!==void 0&&(this.sheenRoughness=e.sheenRoughness),e.emissive!==void 0&&this.emissive!==void 0&&this.emissive.setHex(e.emissive),e.specular!==void 0&&this.specular!==void 0&&this.specular.setHex(e.specular),e.specularIntensity!==void 0&&(this.specularIntensity=e.specularIntensity),e.specularColor!==void 0&&this.specularColor!==void 0&&this.specularColor.setHex(e.specularColor),e.shininess!==void 0&&(this.shininess=e.shininess),e.clearcoat!==void 0&&(this.clearcoat=e.clearcoat),e.clearcoatRoughness!==void 0&&(this.clearcoatRoughness=e.clearcoatRoughness),e.dispersion!==void 0&&(this.dispersion=e.dispersion),e.retroreflectivity!==void 0&&(this.retroreflectivity=e.retroreflectivity),e.iridescence!==void 0&&(this.iridescence=e.iridescence),e.iridescenceIOR!==void 0&&(this.iridescenceIOR=e.iridescenceIOR),e.iridescenceThicknessRange!==void 0&&(this.iridescenceThicknessRange=e.iridescenceThicknessRange),e.transmission!==void 0&&(this.transmission=e.transmission),e.thickness!==void 0&&(this.thickness=e.thickness),e.attenuationDistance!==void 0&&(this.attenuationDistance=e.attenuationDistance),e.attenuationColor!==void 0&&this.attenuationColor!==void 0&&this.attenuationColor.setHex(e.attenuationColor),e.anisotropy!==void 0&&(this.anisotropy=e.anisotropy),e.anisotropyRotation!==void 0&&(this.anisotropyRotation=e.anisotropyRotation),e.fog!==void 0&&(this.fog=e.fog),e.flatShading!==void 0&&(this.flatShading=e.flatShading),e.blending!==void 0&&(this.blending=e.blending),e.combine!==void 0&&(this.combine=e.combine),e.side!==void 0&&(this.side=e.side),e.shadowSide!==void 0&&(this.shadowSide=e.shadowSide),e.opacity!==void 0&&(this.opacity=e.opacity),e.transparent!==void 0&&(this.transparent=e.transparent),e.alphaTest!==void 0&&(this.alphaTest=e.alphaTest),e.alphaHash!==void 0&&(this.alphaHash=e.alphaHash),e.depthFunc!==void 0&&(this.depthFunc=e.depthFunc),e.depthTest!==void 0&&(this.depthTest=e.depthTest),e.depthWrite!==void 0&&(this.depthWrite=e.depthWrite),e.colorWrite!==void 0&&(this.colorWrite=e.colorWrite),e.clippingPlanes!==void 0&&(this.clippingPlanes=e.clippingPlanes.map(i=>new Ii().fromJSON(i))),e.clipIntersection!==void 0&&(this.clipIntersection=e.clipIntersection),e.clipShadows!==void 0&&(this.clipShadows=e.clipShadows),e.depthPacking!==void 0&&(this.depthPacking=e.depthPacking),e.blendSrc!==void 0&&(this.blendSrc=e.blendSrc),e.blendDst!==void 0&&(this.blendDst=e.blendDst),e.blendEquation!==void 0&&(this.blendEquation=e.blendEquation),e.blendSrcAlpha!==void 0&&(this.blendSrcAlpha=e.blendSrcAlpha),e.blendDstAlpha!==void 0&&(this.blendDstAlpha=e.blendDstAlpha),e.blendEquationAlpha!==void 0&&(this.blendEquationAlpha=e.blendEquationAlpha),e.blendColor!==void 0&&this.blendColor!==void 0&&this.blendColor.setHex(e.blendColor),e.blendAlpha!==void 0&&(this.blendAlpha=e.blendAlpha),e.stencilWriteMask!==void 0&&(this.stencilWriteMask=e.stencilWriteMask),e.stencilFunc!==void 0&&(this.stencilFunc=e.stencilFunc),e.stencilRef!==void 0&&(this.stencilRef=e.stencilRef),e.stencilFuncMask!==void 0&&(this.stencilFuncMask=e.stencilFuncMask),e.stencilFail!==void 0&&(this.stencilFail=e.stencilFail),e.stencilZFail!==void 0&&(this.stencilZFail=e.stencilZFail),e.stencilZPass!==void 0&&(this.stencilZPass=e.stencilZPass),e.stencilWrite!==void 0&&(this.stencilWrite=e.stencilWrite),e.wireframe!==void 0&&(this.wireframe=e.wireframe),e.wireframeLinewidth!==void 0&&(this.wireframeLinewidth=e.wireframeLinewidth),e.wireframeLinecap!==void 0&&(this.wireframeLinecap=e.wireframeLinecap),e.wireframeLinejoin!==void 0&&(this.wireframeLinejoin=e.wireframeLinejoin),e.rotation!==void 0&&(this.rotation=e.rotation),e.linewidth!==void 0&&(this.linewidth=e.linewidth),e.linecap!==void 0&&(this.linecap=e.linecap),e.linejoin!==void 0&&(this.linejoin=e.linejoin),e.dashSize!==void 0&&(this.dashSize=e.dashSize),e.gapSize!==void 0&&(this.gapSize=e.gapSize),e.scale!==void 0&&(this.scale=e.scale),e.polygonOffset!==void 0&&(this.polygonOffset=e.polygonOffset),e.polygonOffsetFactor!==void 0&&(this.polygonOffsetFactor=e.polygonOffsetFactor),e.polygonOffsetUnits!==void 0&&(this.polygonOffsetUnits=e.polygonOffsetUnits),e.dithering!==void 0&&(this.dithering=e.dithering),e.alphaToCoverage!==void 0&&(this.alphaToCoverage=e.alphaToCoverage),e.premultipliedAlpha!==void 0&&(this.premultipliedAlpha=e.premultipliedAlpha),e.forceSinglePass!==void 0&&(this.forceSinglePass=e.forceSinglePass),e.allowOverride!==void 0&&(this.allowOverride=e.allowOverride),e.visible!==void 0&&(this.visible=e.visible),e.toneMapped!==void 0&&(this.toneMapped=e.toneMapped),e.userData!==void 0&&(this.userData=e.userData),e.vertexColors!==void 0&&(typeof e.vertexColors=="number"?this.vertexColors=e.vertexColors>0:this.vertexColors=e.vertexColors),e.size!==void 0&&(this.size=e.size),e.sizeAttenuation!==void 0&&(this.sizeAttenuation=e.sizeAttenuation),e.map!==void 0&&(this.map=n[e.map]||null),e.matcap!==void 0&&(this.matcap=n[e.matcap]||null),e.alphaMap!==void 0&&(this.alphaMap=n[e.alphaMap]||null),e.bumpMap!==void 0&&(this.bumpMap=n[e.bumpMap]||null),e.bumpScale!==void 0&&(this.bumpScale=e.bumpScale),e.normalMap!==void 0&&(this.normalMap=n[e.normalMap]||null),e.normalMapType!==void 0&&(this.normalMapType=e.normalMapType),e.normalScale!==void 0){let i=e.normalScale;Array.isArray(i)===!1&&(i=[i,i]),this.normalScale=new je().fromArray(i)}return e.displacementMap!==void 0&&(this.displacementMap=n[e.displacementMap]||null),e.displacementScale!==void 0&&(this.displacementScale=e.displacementScale),e.displacementBias!==void 0&&(this.displacementBias=e.displacementBias),e.roughnessMap!==void 0&&(this.roughnessMap=n[e.roughnessMap]||null),e.metalnessMap!==void 0&&(this.metalnessMap=n[e.metalnessMap]||null),e.emissiveMap!==void 0&&(this.emissiveMap=n[e.emissiveMap]||null),e.emissiveIntensity!==void 0&&(this.emissiveIntensity=e.emissiveIntensity),e.specularMap!==void 0&&(this.specularMap=n[e.specularMap]||null),e.specularIntensityMap!==void 0&&(this.specularIntensityMap=n[e.specularIntensityMap]||null),e.specularColorMap!==void 0&&(this.specularColorMap=n[e.specularColorMap]||null),e.envMap!==void 0&&(this.envMap=n[e.envMap]||null),e.envMapRotation!==void 0&&this.envMapRotation.fromArray(e.envMapRotation),e.envMapIntensity!==void 0&&(this.envMapIntensity=e.envMapIntensity),e.reflectivity!==void 0&&(this.reflectivity=e.reflectivity),e.refractionRatio!==void 0&&(this.refractionRatio=e.refractionRatio),e.lightMap!==void 0&&(this.lightMap=n[e.lightMap]||null),e.lightMapIntensity!==void 0&&(this.lightMapIntensity=e.lightMapIntensity),e.aoMap!==void 0&&(this.aoMap=n[e.aoMap]||null),e.aoMapIntensity!==void 0&&(this.aoMapIntensity=e.aoMapIntensity),e.gradientMap!==void 0&&(this.gradientMap=n[e.gradientMap]||null),e.clearcoatMap!==void 0&&(this.clearcoatMap=n[e.clearcoatMap]||null),e.clearcoatRoughnessMap!==void 0&&(this.clearcoatRoughnessMap=n[e.clearcoatRoughnessMap]||null),e.clearcoatNormalMap!==void 0&&(this.clearcoatNormalMap=n[e.clearcoatNormalMap]||null),e.clearcoatNormalScale!==void 0&&(this.clearcoatNormalScale=new je().fromArray(e.clearcoatNormalScale)),e.iridescenceMap!==void 0&&(this.iridescenceMap=n[e.iridescenceMap]||null),e.iridescenceThicknessMap!==void 0&&(this.iridescenceThicknessMap=n[e.iridescenceThicknessMap]||null),e.transmissionMap!==void 0&&(this.transmissionMap=n[e.transmissionMap]||null),e.thicknessMap!==void 0&&(this.thicknessMap=n[e.thicknessMap]||null),e.anisotropyMap!==void 0&&(this.anisotropyMap=n[e.anisotropyMap]||null),e.sheenColorMap!==void 0&&(this.sheenColorMap=n[e.sheenColorMap]||null),e.sheenRoughnessMap!==void 0&&(this.sheenRoughnessMap=n[e.sheenRoughnessMap]||null),this}clone(){return new this.constructor().copy(this)}copy(e){this.name=e.name,this.blending=e.blending,this.side=e.side,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.blendColor.copy(e.blendColor),this.blendAlpha=e.blendAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;const n=e.clippingPlanes;let i=null;if(n!==null){const s=n.length;i=new Array(s);for(let r=0;r!==s;++r)i[r]=n[r].clone()}return this.clippingPlanes=i,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipShadows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.alphaHash=e.alphaHash,this.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.forceSinglePass=e.forceSinglePass,this.allowOverride=e.allowOverride,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(e){e===!0&&this.version++}}const Pi=new H,al=new H,Bo=new H,Ho=new H;class $d{constructor(e=new H,n=new H(0,0,-1)){this.origin=e,this.direction=n}set(e,n){return this.origin.copy(e),this.direction.copy(n),this}copy(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this}at(e,n){return n.copy(this.origin).addScaledVector(this.direction,e)}lookAt(e){return this.direction.copy(e).sub(this.origin).normalize(),this}recast(e){return this.origin.copy(this.at(e,Pi)),this}closestPointToPoint(e,n){n.subVectors(e,this.origin);const i=n.dot(this.direction);return i<0?n.copy(this.origin):n.copy(this.origin).addScaledVector(this.direction,i)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){const n=Pi.subVectors(e,this.origin).dot(this.direction);return n<0?this.origin.distanceToSquared(e):(Pi.copy(this.origin).addScaledVector(this.direction,n),Pi.distanceToSquared(e))}distanceSqToSegment(e,n,i,s){al.copy(e).add(n).multiplyScalar(.5),Bo.copy(n).sub(e).normalize(),Ho.copy(this.origin).sub(al);const r=e.distanceTo(n)*.5,o=-this.direction.dot(Bo),a=Ho.dot(this.direction),c=-Ho.dot(Bo),l=Ho.lengthSq(),u=Math.abs(1-o*o);let h,d,f,_;if(u>0)if(h=o*c-a,d=o*a-c,_=r*u,h>=0)if(d>=-_)if(d<=_){const x=1/u;h*=x,d*=x,f=h*(h+o*d+2*a)+d*(o*h+d+2*c)+l}else d=r,h=Math.max(0,-(o*d+a)),f=-h*h+d*(d+2*c)+l;else d=-r,h=Math.max(0,-(o*d+a)),f=-h*h+d*(d+2*c)+l;else d<=-_?(h=Math.max(0,-(-o*r+a)),d=h>0?-r:Math.min(Math.max(-r,-c),r),f=-h*h+d*(d+2*c)+l):d<=_?(h=0,d=Math.min(Math.max(-r,-c),r),f=d*(d+2*c)+l):(h=Math.max(0,-(o*r+a)),d=h>0?r:Math.min(Math.max(-r,-c),r),f=-h*h+d*(d+2*c)+l);else d=o>0?-r:r,h=Math.max(0,-(o*d+a)),f=-h*h+d*(d+2*c)+l;return i&&i.copy(this.origin).addScaledVector(this.direction,h),s&&s.copy(al).addScaledVector(Bo,d),f}intersectSphere(e,n){if(e.radius<0)return null;Pi.subVectors(e.center,this.origin);const i=Pi.dot(this.direction),s=Pi.dot(Pi)-i*i,r=e.radius*e.radius;if(s>r)return null;const o=Math.sqrt(r-s),a=i-o,c=i+o;return c<0?null:a<0?this.at(c,n):this.at(a,n)}intersectsSphere(e){return e.radius<0?!1:this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){const n=e.normal.dot(this.direction);if(n===0)return e.distanceToPoint(this.origin)===0?0:null;const i=-(this.origin.dot(e.normal)+e.constant)/n;return i>=0?i:null}intersectPlane(e,n){const i=this.distanceToPlane(e);return i===null?null:this.at(i,n)}intersectsPlane(e){const n=e.distanceToPoint(this.origin);return n===0||e.normal.dot(this.direction)*n<0}intersectBox(e,n){let i,s,r,o,a,c;const l=1/this.direction.x,u=1/this.direction.y,h=1/this.direction.z,d=this.origin;return l>=0?(i=(e.min.x-d.x)*l,s=(e.max.x-d.x)*l):(i=(e.max.x-d.x)*l,s=(e.min.x-d.x)*l),u>=0?(r=(e.min.y-d.y)*u,o=(e.max.y-d.y)*u):(r=(e.max.y-d.y)*u,o=(e.min.y-d.y)*u),i>o||r>s||((r>i||isNaN(i))&&(i=r),(o<s||isNaN(s))&&(s=o),h>=0?(a=(e.min.z-d.z)*h,c=(e.max.z-d.z)*h):(a=(e.max.z-d.z)*h,c=(e.min.z-d.z)*h),i>c||a>s)||((a>i||i!==i)&&(i=a),(c<s||s!==s)&&(s=c),s<0)?null:this.at(i>=0?i:s,n)}intersectsBox(e){return this.intersectBox(e,Pi)!==null}intersectTriangle(e,n,i,s,r){const o=this.origin,a=this.direction,c=a.x,l=a.y,u=a.z,h=e.x-o.x,d=e.y-o.y,f=e.z-o.z,_=n.x-o.x,x=n.y-o.y,m=n.z-o.z,p=i.x-o.x,E=i.y-o.y,I=i.z-o.z,b=Math.abs(c),w=Math.abs(l),A=Math.abs(u);let P,v,T,L,N,k,q,U,V,Q,X,ce;if(b>=w&&b>=A?(T=c,k=h,V=_,ce=p,c>=0?(P=l,v=u,L=d,N=f,q=x,U=m,Q=E,X=I):(P=u,v=l,L=f,N=d,q=m,U=x,Q=I,X=E)):w>=A?(T=l,k=d,V=x,ce=E,l>=0?(P=u,v=c,L=f,N=h,q=m,U=_,Q=I,X=p):(P=c,v=u,L=h,N=f,q=_,U=m,Q=p,X=I)):(T=u,k=f,V=m,ce=I,u>=0?(P=c,v=l,L=h,N=d,q=_,U=x,Q=p,X=E):(P=l,v=c,L=d,N=h,q=x,U=_,Q=E,X=p)),T===0)return null;const j=P/T,se=v/T,oe=1/T,Fe=L-j*k,Ie=N-se*k,mt=q-j*V,tt=U-se*V,Je=Q-j*ce,Y=X-se*ce,re=Je*tt-Y*mt,Re=Fe*Y-Ie*Je,Ge=mt*Ie-tt*Fe;if(s){if(re<0||Re<0||Ge<0)return null}else if((re<0||Re<0||Ge<0)&&(re>0||Re>0||Ge>0))return null;const Me=re+Re+Ge;if(Me===0)return null;const We=oe*(re*k+Re*V+Ge*ce);return(Me>0?We<0:We>0)?null:this.at(We/Me,r)}applyMatrix4(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this}equals(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}clone(){return new this.constructor().copy(this)}}class dc extends _o{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new at(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Ls,this.combine=hS,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}}const Nf=new $t,Ss=new $d,Vo=new uc,Df=new H,Go=new H,$o=new H,qo=new H,cl=new H,Wo=new H,Uf=new H,Zo=new H;class si extends Tn{constructor(e=new Nn,n=new dc){super(),this.isMesh=!0,this.type="Mesh",this.geometry=e,this.material=n,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.count=1,this.updateMorphTargets()}copy(e,n){return super.copy(e,n),e.morphTargetInfluences!==void 0&&(this.morphTargetInfluences=e.morphTargetInfluences.slice()),e.morphTargetDictionary!==void 0&&(this.morphTargetDictionary=Object.assign({},e.morphTargetDictionary)),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}updateMorphTargets(){const n=this.geometry.morphAttributes,i=Object.keys(n);if(i.length>0){const s=n[i[0]];if(s!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let r=0,o=s.length;r<o;r++){const a=s[r].name||String(r);this.morphTargetInfluences.push(0),this.morphTargetDictionary[a]=r}}}}getVertexPosition(e,n){const i=this.geometry,s=i.attributes.position,r=i.morphAttributes.position,o=i.morphTargetsRelative;n.fromBufferAttribute(s,e);const a=this.morphTargetInfluences;if(r&&a){Wo.set(0,0,0);for(let c=0,l=r.length;c<l;c++){const u=a[c],h=r[c];u!==0&&(cl.fromBufferAttribute(h,e),o?Wo.addScaledVector(cl,u):Wo.addScaledVector(cl.sub(n),u))}n.add(Wo)}return n}intersectsFrustum(e){return e.intersectsObject(this)}raycast(e,n){const i=this.geometry,s=this.material,r=this.matrixWorld;s!==void 0&&(i.boundingSphere===null&&i.computeBoundingSphere(),Vo.copy(i.boundingSphere),Vo.applyMatrix4(r),Ss.copy(e.ray).recast(e.near),!(Vo.containsPoint(Ss.origin)===!1&&(Ss.intersectSphere(Vo,Df)===null||Ss.origin.distanceToSquared(Df)>(e.far-e.near)**2))&&(Nf.copy(r).invert(),Ss.copy(e.ray).applyMatrix4(Nf),!(i.boundingBox!==null&&Ss.intersectsBox(i.boundingBox)===!1)&&this._computeIntersections(e,n,Ss)))}_computeIntersections(e,n,i){let s;const r=this.geometry,o=this.material,a=r.index,c=r.attributes.position,l=r.attributes.uv,u=r.attributes.uv1,h=r.attributes.normal,d=r.groups,f=r.drawRange;if(a!==null)if(Array.isArray(o))for(let _=0,x=d.length;_<x;_++){const m=d[_],p=o[m.materialIndex],E=Math.max(m.start,f.start),I=Math.min(a.count,Math.min(m.start+m.count,f.start+f.count));for(let b=E,w=I;b<w;b+=3){const A=a.getX(b),P=a.getX(b+1),v=a.getX(b+2);s=Xo(this,p,e,i,l,u,h,A,P,v),s&&(s.faceIndex=Math.floor(b/3),s.face.materialIndex=m.materialIndex,n.push(s))}}else{const _=Math.max(0,f.start),x=Math.min(a.count,f.start+f.count);for(let m=_,p=x;m<p;m+=3){const E=a.getX(m),I=a.getX(m+1),b=a.getX(m+2);s=Xo(this,o,e,i,l,u,h,E,I,b),s&&(s.faceIndex=Math.floor(m/3),n.push(s))}}else if(c!==void 0)if(Array.isArray(o))for(let _=0,x=d.length;_<x;_++){const m=d[_],p=o[m.materialIndex],E=Math.max(m.start,f.start),I=Math.min(c.count,Math.min(m.start+m.count,f.start+f.count));for(let b=E,w=I;b<w;b+=3){const A=b,P=b+1,v=b+2;s=Xo(this,p,e,i,l,u,h,A,P,v),s&&(s.faceIndex=Math.floor(b/3),s.face.materialIndex=m.materialIndex,n.push(s))}}else{const _=Math.max(0,f.start),x=Math.min(c.count,f.start+f.count);for(let m=_,p=x;m<p;m+=3){const E=m,I=m+1,b=m+2;s=Xo(this,o,e,i,l,u,h,E,I,b),s&&(s.faceIndex=Math.floor(m/3),n.push(s))}}}}function _A(t,e,n,i,s,r,o,a){let c;if(e.side===Cn?c=i.intersectTriangle(o,r,s,!0,a):c=i.intersectTriangle(s,r,o,e.side===As,a),c===null)return null;Zo.copy(a),Zo.applyMatrix4(t.matrixWorld);const l=n.ray.origin.distanceTo(Zo);return l<n.near||l>n.far?null:{distance:l,point:Zo.clone(),object:t}}function Xo(t,e,n,i,s,r,o,a,c,l){t.getVertexPosition(a,Go),t.getVertexPosition(c,$o),t.getVertexPosition(l,qo);const u=_A(t,e,n,i,Go,$o,qo,Uf);if(u){const h=new H;Jn.getBarycoord(Uf,Go,$o,qo,h),s&&(u.uv=Jn.getInterpolatedAttribute(s,a,c,l,h,new je)),r&&(u.uv1=Jn.getInterpolatedAttribute(r,a,c,l,h,new je)),o&&(u.normal=Jn.getInterpolatedAttribute(o,a,c,l,h,new H),u.normal.dot(i.direction)>0&&u.normal.multiplyScalar(-1));const d={a,b:c,c:l,normal:new H,materialIndex:0};Jn.getNormal(Go,$o,qo,d.normal),u.face=d,u.barycoord=h}return u}class SA extends En{constructor(e=null,n=1,i=1,s,r,o,a,c,l=ln,u=ln,h,d){super(null,o,a,c,l,u,s,r,h,d),this.isDataTexture=!0,this.image={data:e,width:n,height:i},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}const vs=new uc,vA=new je(.5,.5),Yo=new H;class US{constructor(e=new Ii,n=new Ii,i=new Ii,s=new Ii,r=new Ii,o=new Ii){this.planes=[e,n,i,s,r,o]}set(e,n,i,s,r,o){const a=this.planes;return a[0].copy(e),a[1].copy(n),a[2].copy(i),a[3].copy(s),a[4].copy(r),a[5].copy(o),this}copy(e){const n=this.planes;for(let i=0;i<6;i++)n[i].copy(e.planes[i]);return this}setFromProjectionMatrix(e,n=gi,i=!1){const s=this.planes,r=e.elements,o=r[0],a=r[1],c=r[2],l=r[3],u=r[4],h=r[5],d=r[6],f=r[7],_=r[8],x=r[9],m=r[10],p=r[11],E=r[12],I=r[13],b=r[14],w=r[15];if(s[0].setComponents(l-o,f-u,p-_,w-E).normalize(),s[1].setComponents(l+o,f+u,p+_,w+E).normalize(),s[2].setComponents(l+a,f+h,p+x,w+I).normalize(),s[3].setComponents(l-a,f-h,p-x,w-I).normalize(),i)s[4].setComponents(c,d,m,b).normalize(),s[5].setComponents(l-c,f-d,p-m,w-b).normalize();else if(s[4].setComponents(l-c,f-d,p-m,w-b).normalize(),n===gi)s[5].setComponents(l+c,f+d,p+m,w+b).normalize();else if(n===Pa)s[5].setComponents(c,d,m,b).normalize();else throw new Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+n);return this}intersectsObject(e){if(e.boundingSphere!==void 0)e.boundingSphere===null&&e.computeBoundingSphere(),vs.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{const n=e.geometry;n.boundingSphere===null&&n.computeBoundingSphere(),vs.copy(n.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(vs)}intersectsSprite(e){vs.center.set(0,0,0);const n=vA.distanceTo(e.center);return vs.radius=.7071067811865476+n,vs.applyMatrix4(e.matrixWorld),this.intersectsSphere(vs)}intersectsSphere(e){const n=this.planes,i=e.center,s=-e.radius;for(let r=0;r<6;r++)if(n[r].distanceToPoint(i)<s)return!1;return!0}intersectsBox(e){const n=this.planes;for(let i=0;i<6;i++){const s=n[i];if(Yo.x=s.normal.x>0?e.max.x:e.min.x,Yo.y=s.normal.y>0?e.max.y:e.min.y,Yo.z=s.normal.z>0?e.max.z:e.min.z,s.distanceToPoint(Yo)<0)return!1}return!0}containsPoint(e){const n=this.planes;for(let i=0;i<6;i++)if(n[i].distanceToPoint(e)<0)return!1;return!0}clone(){return new this.constructor().copy(this)}}class Fs extends _o{constructor(e){super(),this.isLineBasicMaterial=!0,this.type="LineBasicMaterial",this.color=new at(16777215),this.map=null,this.linewidth=1,this.linecap="round",this.linejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.linewidth=e.linewidth,this.linecap=e.linecap,this.linejoin=e.linejoin,this.fog=e.fog,this}}const Ia=new H,Na=new H,Of=new $t,zr=new $d,Ko=new uc,ll=new H,Ff=new H;class xA extends Tn{constructor(e=new Nn,n=new Fs){super(),this.isLine=!0,this.type="Line",this.geometry=e,this.material=n,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.updateMorphTargets()}copy(e,n){return super.copy(e,n),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}computeLineDistances(){const e=this.geometry;if(e.index===null){const n=e.attributes.position,i=[0];for(let s=1,r=n.count;s<r;s++)Ia.fromBufferAttribute(n,s-1),Na.fromBufferAttribute(n,s),i[s]=i[s-1],i[s]+=Ia.distanceTo(Na);e.setAttribute("lineDistance",new on(i,1))}else $e("Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}intersectsFrustum(e){return e.intersectsObject(this)}raycast(e,n){const i=this.geometry,s=this.matrixWorld,r=e.params.Line.threshold,o=i.drawRange;if(i.boundingSphere===null&&i.computeBoundingSphere(),Ko.copy(i.boundingSphere),Ko.applyMatrix4(s),Ko.radius+=r,e.ray.intersectsSphere(Ko)===!1)return;Of.copy(s).invert(),zr.copy(e.ray).applyMatrix4(Of);const a=r/((this.scale.x+this.scale.y+this.scale.z)/3),c=a*a,l=this.isLineSegments?2:1,u=i.index,d=i.attributes.position;if(u!==null){const f=Math.max(0,o.start),_=Math.min(u.count,o.start+o.count);for(let x=f,m=_-1;x<m;x+=l){const p=u.getX(x),E=u.getX(x+1),I=jo(this,e,zr,c,p,E,x);I&&n.push(I)}if(this.isLineLoop){const x=u.getX(_-1),m=u.getX(f),p=jo(this,e,zr,c,x,m,_-1);p&&n.push(p)}}else{const f=Math.max(0,o.start),_=Math.min(d.count,o.start+o.count);for(let x=f,m=_-1;x<m;x+=l){const p=jo(this,e,zr,c,x,x+1,x);p&&n.push(p)}if(this.isLineLoop){const x=jo(this,e,zr,c,_-1,f,_-1);x&&n.push(x)}}}updateMorphTargets(){const n=this.geometry.morphAttributes,i=Object.keys(n);if(i.length>0){const s=n[i[0]];if(s!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let r=0,o=s.length;r<o;r++){const a=s[r].name||String(r);this.morphTargetInfluences.push(0),this.morphTargetDictionary[a]=r}}}}}function jo(t,e,n,i,s,r,o){const a=t.geometry.attributes.position;if(Ia.fromBufferAttribute(a,s),Na.fromBufferAttribute(a,r),n.distanceSqToSegment(Ia,Na,ll,Ff)>i)return;ll.applyMatrix4(t.matrixWorld);const l=e.ray.origin.distanceTo(ll);if(!(l<e.near||l>e.far))return{distance:l,point:Ff.clone().applyMatrix4(t.matrixWorld),index:o,face:null,faceIndex:null,barycoord:null,object:t}}const kf=new H,zf=new H;class ir extends xA{constructor(e,n){super(e,n),this.isLineSegments=!0,this.type="LineSegments"}computeLineDistances(){const e=this.geometry;if(e.index===null){const n=e.attributes.position,i=[];for(let s=0,r=n.count;s<r;s+=2)kf.fromBufferAttribute(n,s),zf.fromBufferAttribute(n,s+1),i[s]=s===0?0:i[s-1],i[s+1]=i[s]+kf.distanceTo(zf);e.setAttribute("lineDistance",new on(i,1))}else $e("LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}}class OS extends En{constructor(e=[],n=Cs,i,s,r,o,a,c,l,u){super(e,n,i,s,r,o,a,c,l,u),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}}class fo extends En{constructor(e,n,i=vi,s,r,o,a=ln,c=ln,l,u=zi,h=1){if(u!==zi&&u!==bs)throw new Error("THREE.DepthTexture: format must be either THREE.DepthFormat or THREE.DepthStencilFormat");const d={width:e,height:n,depth:h};super(d,s,r,o,a,c,u,i,l),this.isDepthTexture=!0,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(e){return super.copy(e),this.source=new Gd(Object.assign({},e.image)),this.compareFunction=e.compareFunction,this}toJSON(e){const n=super.toJSON(e);return n.compareFunction=this.compareFunction,n}}class yA extends fo{constructor(e,n=vi,i=Cs,s,r,o=ln,a=ln,c,l=zi){const u={width:e,height:e,depth:1},h=[u,u,u,u,u,u];super(e,e,n,i,s,r,o,a,c,l),this.image=h,this.isCubeDepthTexture=!0,this.isCubeTexture=!0}get images(){return this.image}set images(e){this.image=e}}class FS extends En{constructor(e=null){super(),this.sourceTexture=e,this.isExternalTexture=!0}copy(e){return super.copy(e),this.sourceTexture=e.sourceTexture,this}}class So extends Nn{constructor(e=1,n=1,i=1,s=1,r=1,o=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:n,depth:i,widthSegments:s,heightSegments:r,depthSegments:o};const a=this;s=Math.floor(s),r=Math.floor(r),o=Math.floor(o);const c=[],l=[],u=[],h=[];let d=0,f=0;_("z","y","x",-1,-1,i,n,e,o,r,0),_("z","y","x",1,-1,i,n,-e,o,r,1),_("x","z","y",1,1,e,i,n,s,o,2),_("x","z","y",1,-1,e,i,-n,s,o,3),_("x","y","z",1,-1,e,n,i,s,r,4),_("x","y","z",-1,-1,e,n,-i,s,r,5),this.setIndex(c),this.setAttribute("position",new on(l,3)),this.setAttribute("normal",new on(u,3)),this.setAttribute("uv",new on(h,2));function _(x,m,p,E,I,b,w,A,P,v,T){const L=b/P,N=w/v,k=b/2,q=w/2,U=A/2,V=P+1,Q=v+1;let X=0,ce=0;const j=new H;for(let se=0;se<Q;se++){const oe=se*N-q;for(let Fe=0;Fe<V;Fe++){const Ie=Fe*L-k;j[x]=Ie*E,j[m]=oe*I,j[p]=U,l.push(j.x,j.y,j.z),j[x]=0,j[m]=0,j[p]=A>0?1:-1,u.push(j.x,j.y,j.z),h.push(Fe/P),h.push(1-se/v),X+=1}}for(let se=0;se<v;se++)for(let oe=0;oe<P;oe++){const Fe=d+oe+V*se,Ie=d+oe+V*(se+1),mt=d+(oe+1)+V*(se+1),tt=d+(oe+1)+V*se;c.push(Fe,Ie,tt),c.push(Ie,mt,tt),ce+=6}a.addGroup(f,ce,T),f+=ce,d+=X}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new So(e.width,e.height,e.depth,e.widthSegments,e.heightSegments,e.depthSegments)}}class qd extends Nn{constructor(e=1,n=1,i=1,s=32,r=1,o=!1,a=0,c=Math.PI*2){super(),this.type="CylinderGeometry",this.parameters={radiusTop:e,radiusBottom:n,height:i,radialSegments:s,heightSegments:r,openEnded:o,thetaStart:a,thetaLength:c};const l=this;s=Math.floor(s),r=Math.floor(r);const u=[],h=[],d=[],f=[];let _=0;const x=[],m=i/2;let p=0;E(),o===!1&&(e>0&&I(!0),n>0&&I(!1)),this.setIndex(u),this.setAttribute("position",new on(h,3)),this.setAttribute("normal",new on(d,3)),this.setAttribute("uv",new on(f,2));function E(){const b=new H,w=new H;let A=0;const P=(n-e)/i;for(let v=0;v<=r;v++){const T=[],L=v/r,N=L*(n-e)+e;for(let k=0;k<=s;k++){const q=k/s,U=q*c+a,V=Math.sin(U),Q=Math.cos(U);w.x=N*V,w.y=-L*i+m,w.z=N*Q,h.push(w.x,w.y,w.z),b.set(V,P,Q).normalize(),d.push(b.x,b.y,b.z),f.push(q,1-L),T.push(_++)}x.push(T)}for(let v=0;v<s;v++)for(let T=0;T<r;T++){const L=x[T][v],N=x[T+1][v],k=x[T+1][v+1],q=x[T][v+1];(e>0||T!==0)&&(u.push(L,N,q),A+=3),(n>0||T!==r-1)&&(u.push(N,k,q),A+=3)}l.addGroup(p,A,0),p+=A}function I(b){const w=_,A=new je,P=new H;let v=0;const T=b===!0?e:n,L=b===!0?1:-1;for(let k=1;k<=s;k++)h.push(0,m*L,0),d.push(0,L,0),f.push(.5,.5),_++;const N=_;for(let k=0;k<=s;k++){const U=k/s*c+a,V=Math.cos(U),Q=Math.sin(U);P.x=T*Q,P.y=m*L,P.z=T*V,h.push(P.x,P.y,P.z),d.push(0,L,0),A.x=V*.5+.5,A.y=Q*.5*L+.5,f.push(A.x,A.y),_++}for(let k=0;k<s;k++){const q=w+k,U=N+k;b===!0?u.push(U,U+1,q):u.push(U+1,U,q),v+=3}l.addGroup(p,v,b===!0?1:2),p+=v}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new qd(e.radiusTop,e.radiusBottom,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}}class hc extends qd{constructor(e=1,n=1,i=32,s=1,r=!1,o=0,a=Math.PI*2){super(0,e,n,i,s,r,o,a),this.type="ConeGeometry",this.parameters={radius:e,height:n,radialSegments:i,heightSegments:s,openEnded:r,thetaStart:o,thetaLength:a}}static fromJSON(e){return new hc(e.radius,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}}class fc extends Nn{constructor(e=1,n=1,i=1,s=1){super(),this.type="PlaneGeometry",this.parameters={width:e,height:n,widthSegments:i,heightSegments:s};const r=e/2,o=n/2,a=Math.floor(i),c=Math.floor(s),l=a+1,u=c+1,h=e/a,d=n/c,f=[],_=[],x=[],m=[];for(let p=0;p<u;p++){const E=p*d-o;for(let I=0;I<l;I++){const b=I*h-r;_.push(b,-E,0),x.push(0,0,1),m.push(I/a),m.push(1-p/c)}}for(let p=0;p<c;p++)for(let E=0;E<a;E++){const I=E+l*p,b=E+l*(p+1),w=E+1+l*(p+1),A=E+1+l*p;f.push(I,b,A),f.push(b,w,A)}this.setIndex(f),this.setAttribute("position",new on(_,3)),this.setAttribute("normal",new on(x,3)),this.setAttribute("uv",new on(m,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new fc(e.width,e.height,e.widthSegments,e.heightSegments)}}function xr(t){const e={};for(const n in t){e[n]={};for(const i in t[n]){const s=t[n][i];if(Bf(s))s.isRenderTargetTexture?($e("UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms()."),e[n][i]=null):e[n][i]=s.clone();else if(Array.isArray(s))if(Bf(s[0])){const r=[];for(let o=0,a=s.length;o<a;o++)r[o]=s[o].clone();e[n][i]=r}else e[n][i]=s.slice();else e[n][i]=s}}return e}function bn(t){const e={};for(let n=0;n<t.length;n++){const i=xr(t[n]);for(const s in i)e[s]=i[s]}return e}function Bf(t){return t&&(t.isColor||t.isMatrix3||t.isMatrix4||t.isVector2||t.isVector3||t.isVector4||t.isTexture||t.isQuaternion)}function bA(t){const e=[];for(let n=0;n<t.length;n++)e.push(t[n].clone());return e}function kS(t){const e=t.getRenderTarget();return e===null?t.outputColorSpace:e.isXRRenderTarget===!0?e.texture.colorSpace:ft.workingColorSpace}const MA={clone:xr,merge:bn};var EA=`void main() {
|
|
111
111
|
gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
|
|
112
|
-
}`,
|
|
112
|
+
}`,TA=`void main() {
|
|
113
113
|
gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );
|
|
114
|
-
}`;class mi extends ro{constructor(e){super(),this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader=yw,this.fragmentShader=bw,this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.clipping=!1,this.forceSinglePass=!0,this.extensions={clipCullDistance:!1,multiDraw:!1},this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv1:[0,0]},this.index0AttributeName=void 0,this.uniformsNeedUpdate=!1,this.glslVersion=null,e!==void 0&&this.setValues(e)}copy(e){return super.copy(e),this.fragmentShader=e.fragmentShader,this.vertexShader=e.vertexShader,this.uniforms=ar(e.uniforms),this.uniformsGroups=vw(e.uniformsGroups),this.defines=Object.assign({},e.defines),this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.fog=e.fog,this.lights=e.lights,this.clipping=e.clipping,this.extensions=Object.assign({},e.extensions),this.glslVersion=e.glslVersion,this.defaultAttributeValues=Object.assign({},e.defaultAttributeValues),this.index0AttributeName=e.index0AttributeName,this.uniformsNeedUpdate=e.uniformsNeedUpdate,this}toJSON(e){const n=super.toJSON(e);n.glslVersion=this.glslVersion,n.uniforms={};for(const s in this.uniforms){const o=this.uniforms[s].value;o&&o.isTexture?n.uniforms[s]={type:"t",value:o.toJSON(e).uuid}:o&&o.isColor?n.uniforms[s]={type:"c",value:o.getHex()}:o&&o.isVector2?n.uniforms[s]={type:"v2",value:o.toArray()}:o&&o.isVector3?n.uniforms[s]={type:"v3",value:o.toArray()}:o&&o.isVector4?n.uniforms[s]={type:"v4",value:o.toArray()}:o&&o.isMatrix3?n.uniforms[s]={type:"m3",value:o.toArray()}:o&&o.isMatrix4?n.uniforms[s]={type:"m4",value:o.toArray()}:n.uniforms[s]={value:o}}Object.keys(this.defines).length>0&&(n.defines=this.defines),n.vertexShader=this.vertexShader,n.fragmentShader=this.fragmentShader,n.lights=this.lights,n.clipping=this.clipping;const i={};for(const s in this.extensions)this.extensions[s]===!0&&(i[s]=!0);return Object.keys(i).length>0&&(n.extensions=i),n}fromJSON(e,n){if(super.fromJSON(e,n),e.uniforms!==void 0)for(const i in e.uniforms){const s=e.uniforms[i];switch(this.uniforms[i]={},s.type){case"t":this.uniforms[i].value=n[s.value]||null;break;case"c":this.uniforms[i].value=new ot().setHex(s.value);break;case"v2":this.uniforms[i].value=new Ke().fromArray(s.value);break;case"v3":this.uniforms[i].value=new H().fromArray(s.value);break;case"v4":this.uniforms[i].value=new Ht().fromArray(s.value);break;case"m3":this.uniforms[i].value=new Ye().fromArray(s.value);break;case"m4":this.uniforms[i].value=new Gt().fromArray(s.value);break;default:this.uniforms[i].value=s.value}}if(e.defines!==void 0&&(this.defines=e.defines),e.vertexShader!==void 0&&(this.vertexShader=e.vertexShader),e.fragmentShader!==void 0&&(this.fragmentShader=e.fragmentShader),e.glslVersion!==void 0&&(this.glslVersion=e.glslVersion),e.extensions!==void 0)for(const i in e.extensions)this.extensions[i]=e.extensions[i];return e.lights!==void 0&&(this.lights=e.lights),e.clipping!==void 0&&(this.clipping=e.clipping),this}}class Mw extends mi{constructor(e){super(e),this.isRawShaderMaterial=!0,this.type="RawShaderMaterial"}}class Ew extends ro{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=SR,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.setValues(e)}copy(e){return super.copy(e),this.depthPacking=e.depthPacking,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this}}class Tw extends ro{constructor(e){super(),this.isMeshDistanceMaterial=!0,this.type="MeshDistanceMaterial",this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.setValues(e)}copy(e){return super.copy(e),this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this}}const Vo=new H,Go=new ji,oi=new H;class Q_ extends bn{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new Gt,this.projectionMatrix=new Gt,this.projectionMatrixInverse=new Gt,this.coordinateSystem=di,this._reversedDepth=!1}get reversedDepth(){return this._reversedDepth}copy(e,n){return super.copy(e,n),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this.projectionMatrixInverse.copy(e.projectionMatrixInverse),this.coordinateSystem=e.coordinateSystem,this}getWorldDirection(e){return super.getWorldDirection(e).negate()}updateMatrixWorld(e){super.updateMatrixWorld(e),this.matrixWorld.decompose(Vo,Go,oi),oi.x===1&&oi.y===1&&oi.z===1?this.matrixWorldInverse.copy(this.matrixWorld).invert():this.matrixWorldInverse.compose(Vo,Go,oi.set(1,1,1)).invert()}updateWorldMatrix(e,n,i=!1){super.updateWorldMatrix(e,n,i),this.matrixWorld.decompose(Vo,Go,oi),oi.x===1&&oi.y===1&&oi.z===1?this.matrixWorldInverse.copy(this.matrixWorld).invert():this.matrixWorldInverse.compose(Vo,Go,oi.set(1,1,1)).invert()}clone(){return new this.constructor().copy(this)}}const $i=new H,of=new Ke,af=new Ke;class zn extends Q_{constructor(e=50,n=1,i=.1,s=2e3){super(),this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=e,this.zoom=1,this.near=i,this.far=s,this.focus=10,this.aspect=n,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(e,n){return super.copy(e,n),this.fov=e.fov,this.zoom=e.zoom,this.near=e.near,this.far=e.far,this.focus=e.focus,this.aspect=e.aspect,this.view=e.view===null?null:Object.assign({},e.view),this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this}setFocalLength(e){const n=.5*this.getFilmHeight()/e;this.fov=Qr*2*Math.atan(n),this.updateProjectionMatrix()}getFocalLength(){const e=Math.tan(kr*.5*this.fov);return .5*this.getFilmHeight()/e}getEffectiveFOV(){return Qr*2*Math.atan(Math.tan(kr*.5*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}getViewBounds(e,n,i){$i.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),n.set($i.x,$i.y).multiplyScalar(-e/$i.z),$i.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),i.set($i.x,$i.y).multiplyScalar(-e/$i.z)}getViewSize(e,n){return this.getViewBounds(e,of,af),n.subVectors(af,of)}setViewOffset(e,n,i,s,r,o){this.aspect=e/n,this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=n,this.view.offsetX=i,this.view.offsetY=s,this.view.width=r,this.view.height=o,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=this.near;let n=e*Math.tan(kr*.5*this.fov)/this.zoom,i=2*n,s=this.aspect*i,r=-.5*s;const o=this.view;if(this.view!==null&&this.view.enabled){const c=o.fullWidth,l=o.fullHeight;r+=o.offsetX*s/c,n-=o.offsetY*i/l,s*=o.width/c,i*=o.height/l}const a=this.filmOffset;a!==0&&(r+=e*a/this.getFilmWidth()),this.projectionMatrix.makePerspective(r,r+s,n,n-i,e,this.far,this.coordinateSystem,this.reversedDepth),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const n=super.toJSON(e);return n.object.fov=this.fov,n.object.zoom=this.zoom,n.object.near=this.near,n.object.far=this.far,n.object.focus=this.focus,n.object.aspect=this.aspect,this.view!==null&&(n.object.view=Object.assign({},this.view)),n.object.filmGauge=this.filmGauge,n.object.filmOffset=this.filmOffset,n}}class eS extends Q_{constructor(e=-1,n=1,i=1,s=-1,r=.1,o=2e3){super(),this.isOrthographicCamera=!0,this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=e,this.right=n,this.top=i,this.bottom=s,this.near=r,this.far=o,this.updateProjectionMatrix()}copy(e,n){return super.copy(e,n),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.near=e.near,this.far=e.far,this.zoom=e.zoom,this.view=e.view===null?null:Object.assign({},e.view),this}setViewOffset(e,n,i,s,r,o){this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=n,this.view.offsetX=i,this.view.offsetY=s,this.view.width=r,this.view.height=o,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=(this.right-this.left)/(2*this.zoom),n=(this.top-this.bottom)/(2*this.zoom),i=(this.right+this.left)/2,s=(this.top+this.bottom)/2;let r=i-e,o=i+e,a=s+n,c=s-n;if(this.view!==null&&this.view.enabled){const l=(this.right-this.left)/this.view.fullWidth/this.zoom,u=(this.top-this.bottom)/this.view.fullHeight/this.zoom;r+=l*this.view.offsetX,o=r+l*this.view.width,a-=u*this.view.offsetY,c=a-u*this.view.height}this.projectionMatrix.makeOrthographic(r,o,a,c,this.near,this.far,this.coordinateSystem,this.reversedDepth),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const n=super.toJSON(e);return n.object.zoom=this.zoom,n.object.left=this.left,n.object.right=this.right,n.object.top=this.top,n.object.bottom=this.bottom,n.object.near=this.near,n.object.far=this.far,this.view!==null&&(n.object.view=Object.assign({},this.view)),n}}const ks=-90,zs=1;class Rw extends bn{constructor(e,n,i){super(),this.type="CubeCamera",this.renderTarget=i,this.coordinateSystem=null,this.activeMipmapLevel=0;const s=new zn(ks,zs,e,n);s.layers=this.layers,this.add(s);const r=new zn(ks,zs,e,n);r.layers=this.layers,this.add(r);const o=new zn(ks,zs,e,n);o.layers=this.layers,this.add(o);const a=new zn(ks,zs,e,n);a.layers=this.layers,this.add(a);const c=new zn(ks,zs,e,n);c.layers=this.layers,this.add(c);const l=new zn(ks,zs,e,n);l.layers=this.layers,this.add(l)}updateCoordinateSystem(){const e=this.coordinateSystem,n=this.children.concat(),[i,s,r,o,a,c]=n;for(const l of n)this.remove(l);if(e===di)i.up.set(0,1,0),i.lookAt(1,0,0),s.up.set(0,1,0),s.lookAt(-1,0,0),r.up.set(0,0,-1),r.lookAt(0,1,0),o.up.set(0,0,1),o.lookAt(0,-1,0),a.up.set(0,1,0),a.lookAt(0,0,1),c.up.set(0,1,0),c.lookAt(0,0,-1);else if(e===va)i.up.set(0,-1,0),i.lookAt(-1,0,0),s.up.set(0,-1,0),s.lookAt(1,0,0),r.up.set(0,0,1),r.lookAt(0,1,0),o.up.set(0,0,-1),o.lookAt(0,-1,0),a.up.set(0,-1,0),a.lookAt(0,0,1),c.up.set(0,-1,0),c.lookAt(0,0,-1);else throw new Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: "+e);for(const l of n)this.add(l),l.updateMatrixWorld()}update(e,n){this.parent===null&&this.updateMatrixWorld();const{renderTarget:i,activeMipmapLevel:s}=this;this.coordinateSystem!==e.coordinateSystem&&(this.coordinateSystem=e.coordinateSystem,this.updateCoordinateSystem());const[r,o,a,c,l,u]=this.children,h=e.getRenderTarget(),d=e.getActiveCubeFace(),f=e.getActiveMipmapLevel(),_=e.xr.enabled;e.xr.enabled=!1;const x=i.texture.generateMipmaps;i.texture.generateMipmaps=!1;let m=!1;e.isWebGLRenderer===!0?m=e.state.buffers.depth.getReversed():m=e.reversedDepthBuffer,e.setRenderTarget(i,0,s),m&&e.autoClear===!1&&e.clearDepth(),e.render(n,r),e.setRenderTarget(i,1,s),m&&e.autoClear===!1&&e.clearDepth(),e.render(n,o),e.setRenderTarget(i,2,s),m&&e.autoClear===!1&&e.clearDepth(),e.render(n,a),e.setRenderTarget(i,3,s),m&&e.autoClear===!1&&e.clearDepth(),e.render(n,c),e.setRenderTarget(i,4,s),m&&e.autoClear===!1&&e.clearDepth(),e.render(n,l),i.texture.generateMipmaps=x,e.setRenderTarget(i,5,s),m&&e.autoClear===!1&&e.clearDepth(),e.render(n,u),e.setRenderTarget(h,d,f),e.xr.enabled=_,i.texture.needsPMREMUpdate=!0}}class ww extends zn{constructor(e=[]){super(),this.isArrayCamera=!0,this.isMultiViewCamera=!1,this.cameras=e}}class cf{constructor(e=1,n=0,i=0){this.radius=e,this.phi=n,this.theta=i}set(e,n,i){return this.radius=e,this.phi=n,this.theta=i,this}copy(e){return this.radius=e.radius,this.phi=e.phi,this.theta=e.theta,this}makeSafe(){return this.phi=st(this.phi,1e-6,Math.PI-1e-6),this}setFromVector3(e){return this.setFromCartesianCoords(e.x,e.y,e.z)}setFromCartesianCoords(e,n,i){return this.radius=Math.sqrt(e*e+n*n+i*i),this.radius===0?(this.theta=0,this.phi=0):(this.theta=Math.atan2(e,i),this.phi=Math.acos(st(n/this.radius,-1,1))),this}clone(){return new this.constructor().copy(this)}}const Pd=class Pd{constructor(e,n,i,s){this.elements=[1,0,0,1],e!==void 0&&this.set(e,n,i,s)}identity(){return this.set(1,0,0,1),this}fromArray(e,n=0){for(let i=0;i<4;i++)this.elements[i]=e[i+n];return this}set(e,n,i,s){const r=this.elements;return r[0]=e,r[2]=n,r[1]=i,r[3]=s,this}};Pd.prototype.isMatrix2=!0;let lf=Pd;class Aw extends Ma{constructor(e=10,n=10,i=4473924,s=8947848){i=new ot(i),s=new ot(s);const r=n/2,o=e/n,a=e/2,c=[],l=[];for(let d=0,f=0,_=-a;d<=n;d++,_+=o){c.push(-a,0,_,a,0,_),c.push(_,0,-a,_,0,a);const x=d===r?i:s;x.toArray(l,f),f+=3,x.toArray(l,f),f+=3,x.toArray(l,f),f+=3,x.toArray(l,f),f+=3}const u=new Mn;u.setAttribute("position",new tn(c,3)),u.setAttribute("color",new tn(l,3));const h=new oo({vertexColors:!0,toneMapped:!1});super(u,h),this.type="GridHelper"}dispose(){super.dispose(),this.geometry.dispose(),this.material.dispose()}}class Cw extends Ma{constructor(e=1){const n=[0,0,0,e,0,0,0,0,0,0,e,0,0,0,0,0,0,e],i=[1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1],s=new Mn;s.setAttribute("position",new tn(n,3)),s.setAttribute("color",new tn(i,3));const r=new oo({vertexColors:!0,toneMapped:!1});super(s,r),this.type="AxesHelper"}setColors(e,n,i){const s=new ot,r=this.geometry.attributes.color.array;return s.set(e),s.toArray(r,0),s.toArray(r,3),s.set(n),s.toArray(r,6),s.toArray(r,9),s.set(i),s.toArray(r,12),s.toArray(r,15),this.geometry.attributes.color.needsUpdate=!0,this}dispose(){super.dispose(),this.geometry.dispose(),this.material.dispose()}}class Pw extends Qi{constructor(e,n=null){super(),this.object=e,this.domElement=n,this.enabled=!0,this.state=-1,this.keys={},this.mouseButtons={LEFT:null,MIDDLE:null,RIGHT:null},this.touches={ONE:null,TWO:null}}connect(e){this.domElement!==null&&this.disconnect(),this.domElement=e}disconnect(){}dispose(){}update(){}}function uf(t,e,n,i){const s=Iw(i);switch(n){case z_:return t*e;case H_:return t*e/s.components*s.byteLength;case hd:return t*e/s.components*s.byteLength;case ys:return t*e*2/s.components*s.byteLength;case fd:return t*e*2/s.components*s.byteLength;case B_:return t*e*3/s.components*s.byteLength;case Yn:return t*e*4/s.components*s.byteLength;case pd:return t*e*4/s.components*s.byteLength;case Ko:case jo:return Math.floor((t+3)/4)*Math.floor((e+3)/4)*8;case Jo:case Qo:return Math.floor((t+3)/4)*Math.floor((e+3)/4)*16;case Al:case Pl:return Math.max(t,16)*Math.max(e,8)/4;case wl:case Cl:return Math.max(t,8)*Math.max(e,8)/2;case Il:case Ll:case Dl:case Ul:return Math.floor((t+3)/4)*Math.floor((e+3)/4)*8;case Nl:case ma:case Ol:return Math.floor((t+3)/4)*Math.floor((e+3)/4)*16;case Fl:return Math.floor((t+3)/4)*Math.floor((e+3)/4)*16;case kl:return Math.floor((t+4)/5)*Math.floor((e+3)/4)*16;case zl:return Math.floor((t+4)/5)*Math.floor((e+4)/5)*16;case Bl:return Math.floor((t+5)/6)*Math.floor((e+4)/5)*16;case Hl:return Math.floor((t+5)/6)*Math.floor((e+5)/6)*16;case Vl:return Math.floor((t+7)/8)*Math.floor((e+4)/5)*16;case Gl:return Math.floor((t+7)/8)*Math.floor((e+5)/6)*16;case ql:return Math.floor((t+7)/8)*Math.floor((e+7)/8)*16;case $l:return Math.floor((t+9)/10)*Math.floor((e+4)/5)*16;case Wl:return Math.floor((t+9)/10)*Math.floor((e+5)/6)*16;case Zl:return Math.floor((t+9)/10)*Math.floor((e+7)/8)*16;case Xl:return Math.floor((t+9)/10)*Math.floor((e+9)/10)*16;case Yl:return Math.floor((t+11)/12)*Math.floor((e+9)/10)*16;case Kl:return Math.floor((t+11)/12)*Math.floor((e+11)/12)*16;case jl:case Jl:case Ql:return Math.ceil(t/4)*Math.ceil(e/4)*16;case eu:case tu:return Math.ceil(t/4)*Math.ceil(e/4)*8;case ga:case nu:return Math.ceil(t/4)*Math.ceil(e/4)*16}throw new Error(`Unable to determine texture byte length for ${n} format.`)}function Iw(t){switch(t){case Hn:case U_:return{byteLength:1,components:1};case jr:case O_:case pi:return{byteLength:2,components:1};case ud:case dd:return{byteLength:2,components:4};case fi:case ld:case ui:return{byteLength:4,components:1};case F_:case k_:return{byteLength:4,components:3}}throw new Error(`THREE.TextureUtils: Unknown texture type ${t}.`)}typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:cd}}));typeof window<"u"&&(window.__THREE__?Ge("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=cd);/**
|
|
114
|
+
}`;class yi extends _o{constructor(e){super(),this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader=EA,this.fragmentShader=TA,this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.clipping=!1,this.forceSinglePass=!0,this.extensions={clipCullDistance:!1,multiDraw:!1},this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv1:[0,0]},this.index0AttributeName=void 0,this.uniformsNeedUpdate=!1,this.glslVersion=null,e!==void 0&&this.setValues(e)}copy(e){return super.copy(e),this.fragmentShader=e.fragmentShader,this.vertexShader=e.vertexShader,this.uniforms=xr(e.uniforms),this.uniformsGroups=bA(e.uniformsGroups),this.defines=Object.assign({},e.defines),this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.fog=e.fog,this.lights=e.lights,this.clipping=e.clipping,this.extensions=Object.assign({},e.extensions),this.glslVersion=e.glslVersion,this.defaultAttributeValues=Object.assign({},e.defaultAttributeValues),this.index0AttributeName=e.index0AttributeName,this.uniformsNeedUpdate=e.uniformsNeedUpdate,this}toJSON(e){const n=super.toJSON(e);n.glslVersion=this.glslVersion,n.uniforms={};for(const s in this.uniforms){const o=this.uniforms[s].value;o&&o.isTexture?n.uniforms[s]={type:"t",value:o.toJSON(e).uuid}:o&&o.isColor?n.uniforms[s]={type:"c",value:o.getHex()}:o&&o.isVector2?n.uniforms[s]={type:"v2",value:o.toArray()}:o&&o.isVector3?n.uniforms[s]={type:"v3",value:o.toArray()}:o&&o.isVector4?n.uniforms[s]={type:"v4",value:o.toArray()}:o&&o.isMatrix3?n.uniforms[s]={type:"m3",value:o.toArray()}:o&&o.isMatrix4?n.uniforms[s]={type:"m4",value:o.toArray()}:n.uniforms[s]={value:o}}Object.keys(this.defines).length>0&&(n.defines=this.defines),n.vertexShader=this.vertexShader,n.fragmentShader=this.fragmentShader,n.lights=this.lights,n.clipping=this.clipping;const i={};for(const s in this.extensions)this.extensions[s]===!0&&(i[s]=!0);return Object.keys(i).length>0&&(n.extensions=i),n}fromJSON(e,n){if(super.fromJSON(e,n),e.uniforms!==void 0)for(const i in e.uniforms){const s=e.uniforms[i];switch(this.uniforms[i]={},s.type){case"t":this.uniforms[i].value=n[s.value]||null;break;case"c":this.uniforms[i].value=new at().setHex(s.value);break;case"v2":this.uniforms[i].value=new je().fromArray(s.value);break;case"v3":this.uniforms[i].value=new H().fromArray(s.value);break;case"v4":this.uniforms[i].value=new Vt().fromArray(s.value);break;case"m3":this.uniforms[i].value=new Ke().fromArray(s.value);break;case"m4":this.uniforms[i].value=new $t().fromArray(s.value);break;default:this.uniforms[i].value=s.value}}if(e.defines!==void 0&&(this.defines=e.defines),e.vertexShader!==void 0&&(this.vertexShader=e.vertexShader),e.fragmentShader!==void 0&&(this.fragmentShader=e.fragmentShader),e.glslVersion!==void 0&&(this.glslVersion=e.glslVersion),e.extensions!==void 0)for(const i in e.extensions)this.extensions[i]=e.extensions[i];return e.lights!==void 0&&(this.lights=e.lights),e.clipping!==void 0&&(this.clipping=e.clipping),this}}class RA extends yi{constructor(e){super(e),this.isRawShaderMaterial=!0,this.type="RawShaderMaterial"}}class wA extends _o{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=yw,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.setValues(e)}copy(e){return super.copy(e),this.depthPacking=e.depthPacking,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this}}class AA extends _o{constructor(e){super(),this.isMeshDistanceMaterial=!0,this.type="MeshDistanceMaterial",this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.setValues(e)}copy(e){return super.copy(e),this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this}}class zS extends Fs{constructor(e){super(),this.isLineDashedMaterial=!0,this.type="LineDashedMaterial",this.scale=1,this.dashSize=3,this.gapSize=1,this.setValues(e)}copy(e){return super.copy(e),this.scale=e.scale,this.dashSize=e.dashSize,this.gapSize=e.gapSize,this}}const Jo=new H,Qo=new cs,di=new H;class BS extends Tn{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new $t,this.projectionMatrix=new $t,this.projectionMatrixInverse=new $t,this.coordinateSystem=gi,this._reversedDepth=!1}get reversedDepth(){return this._reversedDepth}copy(e,n){return super.copy(e,n),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this.projectionMatrixInverse.copy(e.projectionMatrixInverse),this.coordinateSystem=e.coordinateSystem,this}getWorldDirection(e){return super.getWorldDirection(e).negate()}updateMatrixWorld(e){super.updateMatrixWorld(e),this.matrixWorld.decompose(Jo,Qo,di),di.x===1&&di.y===1&&di.z===1?this.matrixWorldInverse.copy(this.matrixWorld).invert():this.matrixWorldInverse.compose(Jo,Qo,di.set(1,1,1)).invert()}updateWorldMatrix(e,n,i=!1){super.updateWorldMatrix(e,n,i),this.matrixWorld.decompose(Jo,Qo,di),di.x===1&&di.y===1&&di.z===1?this.matrixWorldInverse.copy(this.matrixWorld).invert():this.matrixWorldInverse.compose(Jo,Qo,di.set(1,1,1)).invert()}clone(){return new this.constructor().copy(this)}}const Qi=new H,Hf=new je,Vf=new je;class Gn extends BS{constructor(e=50,n=1,i=.1,s=2e3){super(),this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=e,this.zoom=1,this.near=i,this.far=s,this.focus=10,this.aspect=n,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(e,n){return super.copy(e,n),this.fov=e.fov,this.zoom=e.zoom,this.near=e.near,this.far=e.far,this.focus=e.focus,this.aspect=e.aspect,this.view=e.view===null?null:Object.assign({},e.view),this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this}setFocalLength(e){const n=.5*this.getFilmHeight()/e;this.fov=ho*2*Math.atan(n),this.updateProjectionMatrix()}getFocalLength(){const e=Math.tan(jr*.5*this.fov);return .5*this.getFilmHeight()/e}getEffectiveFOV(){return ho*2*Math.atan(Math.tan(jr*.5*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}getViewBounds(e,n,i){Qi.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),n.set(Qi.x,Qi.y).multiplyScalar(-e/Qi.z),Qi.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),i.set(Qi.x,Qi.y).multiplyScalar(-e/Qi.z)}getViewSize(e,n){return this.getViewBounds(e,Hf,Vf),n.subVectors(Vf,Hf)}setViewOffset(e,n,i,s,r,o){this.aspect=e/n,this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=n,this.view.offsetX=i,this.view.offsetY=s,this.view.width=r,this.view.height=o,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=this.near;let n=e*Math.tan(jr*.5*this.fov)/this.zoom,i=2*n,s=this.aspect*i,r=-.5*s;const o=this.view;if(this.view!==null&&this.view.enabled){const c=o.fullWidth,l=o.fullHeight;r+=o.offsetX*s/c,n-=o.offsetY*i/l,s*=o.width/c,i*=o.height/l}const a=this.filmOffset;a!==0&&(r+=e*a/this.getFilmWidth()),this.projectionMatrix.makePerspective(r,r+s,n,n-i,e,this.far,this.coordinateSystem,this.reversedDepth),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const n=super.toJSON(e);return n.object.fov=this.fov,n.object.zoom=this.zoom,n.object.near=this.near,n.object.far=this.far,n.object.focus=this.focus,n.object.aspect=this.aspect,this.view!==null&&(n.object.view=Object.assign({},this.view)),n.object.filmGauge=this.filmGauge,n.object.filmOffset=this.filmOffset,n}}class HS extends BS{constructor(e=-1,n=1,i=1,s=-1,r=.1,o=2e3){super(),this.isOrthographicCamera=!0,this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=e,this.right=n,this.top=i,this.bottom=s,this.near=r,this.far=o,this.updateProjectionMatrix()}copy(e,n){return super.copy(e,n),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.near=e.near,this.far=e.far,this.zoom=e.zoom,this.view=e.view===null?null:Object.assign({},e.view),this}setViewOffset(e,n,i,s,r,o){this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=n,this.view.offsetX=i,this.view.offsetY=s,this.view.width=r,this.view.height=o,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=(this.right-this.left)/(2*this.zoom),n=(this.top-this.bottom)/(2*this.zoom),i=(this.right+this.left)/2,s=(this.top+this.bottom)/2;let r=i-e,o=i+e,a=s+n,c=s-n;if(this.view!==null&&this.view.enabled){const l=(this.right-this.left)/this.view.fullWidth/this.zoom,u=(this.top-this.bottom)/this.view.fullHeight/this.zoom;r+=l*this.view.offsetX,o=r+l*this.view.width,a-=u*this.view.offsetY,c=a-u*this.view.height}this.projectionMatrix.makeOrthographic(r,o,a,c,this.near,this.far,this.coordinateSystem,this.reversedDepth),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const n=super.toJSON(e);return n.object.zoom=this.zoom,n.object.left=this.left,n.object.right=this.right,n.object.top=this.top,n.object.bottom=this.bottom,n.object.near=this.near,n.object.far=this.far,this.view!==null&&(n.object.view=Object.assign({},this.view)),n}}const Ks=-90,js=1;class CA extends Tn{constructor(e,n,i){super(),this.type="CubeCamera",this.renderTarget=i,this.coordinateSystem=null,this.activeMipmapLevel=0;const s=new Gn(Ks,js,e,n);s.layers=this.layers,this.add(s);const r=new Gn(Ks,js,e,n);r.layers=this.layers,this.add(r);const o=new Gn(Ks,js,e,n);o.layers=this.layers,this.add(o);const a=new Gn(Ks,js,e,n);a.layers=this.layers,this.add(a);const c=new Gn(Ks,js,e,n);c.layers=this.layers,this.add(c);const l=new Gn(Ks,js,e,n);l.layers=this.layers,this.add(l)}updateCoordinateSystem(){const e=this.coordinateSystem,n=this.children.concat(),[i,s,r,o,a,c]=n;for(const l of n)this.remove(l);if(e===gi)i.up.set(0,1,0),i.lookAt(1,0,0),s.up.set(0,1,0),s.lookAt(-1,0,0),r.up.set(0,0,-1),r.lookAt(0,1,0),o.up.set(0,0,1),o.lookAt(0,-1,0),a.up.set(0,1,0),a.lookAt(0,0,1),c.up.set(0,1,0),c.lookAt(0,0,-1);else if(e===Pa)i.up.set(0,-1,0),i.lookAt(-1,0,0),s.up.set(0,-1,0),s.lookAt(1,0,0),r.up.set(0,0,1),r.lookAt(0,1,0),o.up.set(0,0,-1),o.lookAt(0,-1,0),a.up.set(0,-1,0),a.lookAt(0,0,1),c.up.set(0,-1,0),c.lookAt(0,0,-1);else throw new Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: "+e);for(const l of n)this.add(l),l.updateMatrixWorld()}update(e,n){this.parent===null&&this.updateMatrixWorld();const{renderTarget:i,activeMipmapLevel:s}=this;this.coordinateSystem!==e.coordinateSystem&&(this.coordinateSystem=e.coordinateSystem,this.updateCoordinateSystem());const[r,o,a,c,l,u]=this.children,h=e.getRenderTarget(),d=e.getActiveCubeFace(),f=e.getActiveMipmapLevel(),_=e.xr.enabled;e.xr.enabled=!1;const x=i.texture.generateMipmaps;i.texture.generateMipmaps=!1;let m=!1;e.isWebGLRenderer===!0?m=e.state.buffers.depth.getReversed():m=e.reversedDepthBuffer,e.setRenderTarget(i,0,s),m&&e.autoClear===!1&&e.clearDepth(),e.render(n,r),e.setRenderTarget(i,1,s),m&&e.autoClear===!1&&e.clearDepth(),e.render(n,o),e.setRenderTarget(i,2,s),m&&e.autoClear===!1&&e.clearDepth(),e.render(n,a),e.setRenderTarget(i,3,s),m&&e.autoClear===!1&&e.clearDepth(),e.render(n,c),e.setRenderTarget(i,4,s),m&&e.autoClear===!1&&e.clearDepth(),e.render(n,l),i.texture.generateMipmaps=x,e.setRenderTarget(i,5,s),m&&e.autoClear===!1&&e.clearDepth(),e.render(n,u),e.setRenderTarget(h,d,f),e.xr.enabled=_,i.texture.needsPMREMUpdate=!0}}class PA extends Gn{constructor(e=[]){super(),this.isArrayCamera=!0,this.isMultiViewCamera=!1,this.cameras=e}}class Gf{constructor(e=1,n=0,i=0){this.radius=e,this.phi=n,this.theta=i}set(e,n,i){return this.radius=e,this.phi=n,this.theta=i,this}copy(e){return this.radius=e.radius,this.phi=e.phi,this.theta=e.theta,this}makeSafe(){return this.phi=rt(this.phi,1e-6,Math.PI-1e-6),this}setFromVector3(e){return this.setFromCartesianCoords(e.x,e.y,e.z)}setFromCartesianCoords(e,n,i){return this.radius=Math.sqrt(e*e+n*n+i*i),this.radius===0?(this.theta=0,this.phi=0):(this.theta=Math.atan2(e,i),this.phi=Math.acos(rt(n/this.radius,-1,1))),this}clone(){return new this.constructor().copy(this)}}const dh=class dh{constructor(e,n,i,s){this.elements=[1,0,0,1],e!==void 0&&this.set(e,n,i,s)}identity(){return this.set(1,0,0,1),this}fromArray(e,n=0){for(let i=0;i<4;i++)this.elements[i]=e[i+n];return this}set(e,n,i,s){const r=this.elements;return r[0]=e,r[2]=n,r[1]=i,r[3]=s,this}};dh.prototype.isMatrix2=!0;let $f=dh;class LA extends ir{constructor(e=10,n=10,i=4473924,s=8947848){i=new at(i),s=new at(s);const r=n/2,o=e/n,a=e/2,c=[],l=[];for(let d=0,f=0,_=-a;d<=n;d++,_+=o){c.push(-a,0,_,a,0,_),c.push(_,0,-a,_,0,a);const x=d===r?i:s;x.toArray(l,f),f+=3,x.toArray(l,f),f+=3,x.toArray(l,f),f+=3,x.toArray(l,f),f+=3}const u=new Nn;u.setAttribute("position",new on(c,3)),u.setAttribute("color",new on(l,3));const h=new Fs({vertexColors:!0,toneMapped:!1});super(u,h),this.type="GridHelper"}dispose(){super.dispose(),this.geometry.dispose(),this.material.dispose()}}class IA extends ir{constructor(e=1){const n=[0,0,0,e,0,0,0,0,0,0,e,0,0,0,0,0,0,e],i=[1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1],s=new Nn;s.setAttribute("position",new on(n,3)),s.setAttribute("color",new on(i,3));const r=new Fs({vertexColors:!0,toneMapped:!1});super(s,r),this.type="AxesHelper"}setColors(e,n,i){const s=new at,r=this.geometry.attributes.color.array;return s.set(e),s.toArray(r,0),s.toArray(r,3),s.set(n),s.toArray(r,6),s.toArray(r,9),s.set(i),s.toArray(r,12),s.toArray(r,15),this.geometry.attributes.color.needsUpdate=!0,this}dispose(){super.dispose(),this.geometry.dispose(),this.material.dispose()}}class NA extends us{constructor(e,n=null){super(),this.object=e,this.domElement=n,this.enabled=!0,this.state=-1,this.keys={},this.mouseButtons={LEFT:null,MIDDLE:null,RIGHT:null},this.touches={ONE:null,TWO:null}}connect(e){this.domElement!==null&&this.disconnect(),this.domElement=e}disconnect(){}dispose(){}update(){}}function qf(t,e,n,i){const s=DA(i);switch(n){case TS:return t*e;case wS:return t*e/s.components*s.byteLength;case Fd:return t*e/s.components*s.byteLength;case Ps:return t*e*2/s.components*s.byteLength;case kd:return t*e*2/s.components*s.byteLength;case RS:return t*e*3/s.components*s.byteLength;case Qn:return t*e*4/s.components*s.byteLength;case zd:return t*e*4/s.components*s.byteLength;case aa:case ca:return Math.floor((t+3)/4)*Math.floor((e+3)/4)*8;case la:case ua:return Math.floor((t+3)/4)*Math.floor((e+3)/4)*16;case Yl:case jl:return Math.max(t,16)*Math.max(e,8)/4;case Xl:case Kl:return Math.max(t,8)*Math.max(e,8)/2;case Jl:case Ql:case tu:case nu:return Math.floor((t+3)/4)*Math.floor((e+3)/4)*8;case eu:case Ra:case iu:return Math.floor((t+3)/4)*Math.floor((e+3)/4)*16;case su:return Math.floor((t+3)/4)*Math.floor((e+3)/4)*16;case ru:return Math.floor((t+4)/5)*Math.floor((e+3)/4)*16;case ou:return Math.floor((t+4)/5)*Math.floor((e+4)/5)*16;case au:return Math.floor((t+5)/6)*Math.floor((e+4)/5)*16;case cu:return Math.floor((t+5)/6)*Math.floor((e+5)/6)*16;case lu:return Math.floor((t+7)/8)*Math.floor((e+4)/5)*16;case uu:return Math.floor((t+7)/8)*Math.floor((e+5)/6)*16;case du:return Math.floor((t+7)/8)*Math.floor((e+7)/8)*16;case hu:return Math.floor((t+9)/10)*Math.floor((e+4)/5)*16;case fu:return Math.floor((t+9)/10)*Math.floor((e+5)/6)*16;case pu:return Math.floor((t+9)/10)*Math.floor((e+7)/8)*16;case mu:return Math.floor((t+9)/10)*Math.floor((e+9)/10)*16;case gu:return Math.floor((t+11)/12)*Math.floor((e+9)/10)*16;case _u:return Math.floor((t+11)/12)*Math.floor((e+11)/12)*16;case Su:case vu:case xu:return Math.ceil(t/4)*Math.ceil(e/4)*16;case yu:case bu:return Math.ceil(t/4)*Math.ceil(e/4)*8;case wa:case Mu:return Math.ceil(t/4)*Math.ceil(e/4)*16}throw new Error(`Unable to determine texture byte length for ${n} format.`)}function DA(t){switch(t){case $n:case yS:return{byteLength:1,components:1};case lo:case bS:case xi:return{byteLength:2,components:1};case Ud:case Od:return{byteLength:2,components:4};case vi:case Dd:case mi:return{byteLength:4,components:1};case MS:case ES:return{byteLength:4,components:3}}throw new Error(`THREE.TextureUtils: Unknown texture type ${t}.`)}typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:Nd}}));typeof window<"u"&&(window.__THREE__?$e("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=Nd);/**
|
|
115
115
|
* @license
|
|
116
116
|
* Copyright 2010-2026 Three.js Authors
|
|
117
117
|
* SPDX-License-Identifier: MIT
|
|
118
|
-
*/function
|
|
118
|
+
*/function VS(){let t=null,e=!1,n=null,i=null;function s(r,o){i=t.requestAnimationFrame(s),n(r,o)}return{start:function(){e!==!0&&n!==null&&t!==null&&(i=t.requestAnimationFrame(s),e=!0)},stop:function(){t!==null&&t.cancelAnimationFrame(i),e=!1},setAnimationLoop:function(r){n=r},setContext:function(r){t=r}}}function UA(t){const e=new WeakMap;function n(a,c){const l=a.array,u=a.usage,h=l.byteLength,d=t.createBuffer();t.bindBuffer(c,d),t.bufferData(c,l,u),a.onUploadCallback();let f;if(l instanceof Float32Array)f=t.FLOAT;else if(typeof Float16Array<"u"&&l instanceof Float16Array)f=t.HALF_FLOAT;else if(l instanceof Uint16Array)a.isFloat16BufferAttribute?f=t.HALF_FLOAT:f=t.UNSIGNED_SHORT;else if(l instanceof Int16Array)f=t.SHORT;else if(l instanceof Uint32Array)f=t.UNSIGNED_INT;else if(l instanceof Int32Array)f=t.INT;else if(l instanceof Int8Array)f=t.BYTE;else if(l instanceof Uint8Array)f=t.UNSIGNED_BYTE;else if(l instanceof Uint8ClampedArray)f=t.UNSIGNED_BYTE;else throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+l);return{buffer:d,type:f,bytesPerElement:l.BYTES_PER_ELEMENT,version:a.version,size:h}}function i(a,c,l){const u=c.array,h=c.updateRanges;if(t.bindBuffer(l,a),h.length===0)t.bufferSubData(l,0,u);else{h.sort((f,_)=>f.start-_.start);let d=0;for(let f=1;f<h.length;f++){const _=h[d],x=h[f];x.start<=_.start+_.count+1?_.count=Math.max(_.count,x.start+x.count-_.start):(++d,h[d]=x)}h.length=d+1;for(let f=0,_=h.length;f<_;f++){const x=h[f];t.bufferSubData(l,x.start*u.BYTES_PER_ELEMENT,u,x.start,x.count)}c.clearUpdateRanges()}c.onUploadCallback()}function s(a){return a.isInterleavedBufferAttribute&&(a=a.data),e.get(a)}function r(a){a.isInterleavedBufferAttribute&&(a=a.data);const c=e.get(a);c&&(t.deleteBuffer(c.buffer),e.delete(a))}function o(a,c){if(a.isInterleavedBufferAttribute&&(a=a.data),a.isGLBufferAttribute){const u=e.get(a);(!u||u.version<a.version)&&e.set(a,{buffer:a.buffer,type:a.type,bytesPerElement:a.elementSize,version:a.version});return}const l=e.get(a);if(l===void 0)e.set(a,n(a,c));else if(l.version<a.version){if(l.size!==a.array.byteLength)throw new Error("THREE.WebGLAttributes: The size of the buffer attribute's array buffer does not match the original size. Resizing buffer attributes is not supported.");i(l.buffer,a,c),l.version=a.version}}return{get:s,remove:r,update:o}}var OA=`#ifdef USE_ALPHAHASH
|
|
119
119
|
if ( diffuseColor.a < getAlphaHashThreshold( vPosition ) ) discard;
|
|
120
|
-
#endif`,
|
|
120
|
+
#endif`,FA=`#ifdef USE_ALPHAHASH
|
|
121
121
|
const float ALPHA_HASH_SCALE = 0.05;
|
|
122
122
|
float hash2D( vec2 value ) {
|
|
123
123
|
return fract( 1.0e4 * sin( 17.0 * value.x + 0.1 * value.y ) * ( 0.1 + abs( sin( 13.0 * value.y + value.x ) ) ) );
|
|
@@ -152,20 +152,20 @@ container holding the app. Specify either width or maxWidth, and either height o
|
|
|
152
152
|
: cases.z;
|
|
153
153
|
return clamp( threshold , 1.0e-6, 1.0 );
|
|
154
154
|
}
|
|
155
|
-
#endif`,
|
|
155
|
+
#endif`,kA=`#ifdef USE_ALPHAMAP
|
|
156
156
|
diffuseColor.a *= texture2D( alphaMap, vAlphaMapUv ).g;
|
|
157
|
-
#endif`,
|
|
157
|
+
#endif`,zA=`#ifdef USE_ALPHAMAP
|
|
158
158
|
uniform sampler2D alphaMap;
|
|
159
|
-
#endif`,
|
|
159
|
+
#endif`,BA=`#ifdef USE_ALPHATEST
|
|
160
160
|
#ifdef ALPHA_TO_COVERAGE
|
|
161
161
|
diffuseColor.a = smoothstep( alphaTest, alphaTest + fwidth( diffuseColor.a ), diffuseColor.a );
|
|
162
162
|
if ( diffuseColor.a == 0.0 ) discard;
|
|
163
163
|
#else
|
|
164
164
|
if ( diffuseColor.a < alphaTest ) discard;
|
|
165
165
|
#endif
|
|
166
|
-
#endif`,
|
|
166
|
+
#endif`,HA=`#ifdef USE_ALPHATEST
|
|
167
167
|
uniform float alphaTest;
|
|
168
|
-
#endif`,
|
|
168
|
+
#endif`,VA=`#ifdef USE_AOMAP
|
|
169
169
|
float ambientOcclusion = ( texture2D( aoMap, vAoMapUv ).r - 1.0 ) * aoMapIntensity + 1.0;
|
|
170
170
|
reflectedLight.indirectDiffuse *= ambientOcclusion;
|
|
171
171
|
#if defined( USE_CLEARCOAT )
|
|
@@ -178,10 +178,10 @@ container holding the app. Specify either width or maxWidth, and either height o
|
|
|
178
178
|
float dotNV = saturate( dot( geometryNormal, geometryViewDir ) );
|
|
179
179
|
reflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.roughness );
|
|
180
180
|
#endif
|
|
181
|
-
#endif`,
|
|
181
|
+
#endif`,GA=`#ifdef USE_AOMAP
|
|
182
182
|
uniform sampler2D aoMap;
|
|
183
183
|
uniform float aoMapIntensity;
|
|
184
|
-
#endif
|
|
184
|
+
#endif`,$A=`#ifdef USE_BATCHING
|
|
185
185
|
#if ! defined( GL_ANGLE_multi_draw )
|
|
186
186
|
#define gl_DrawID _gl_DrawID
|
|
187
187
|
uniform int _gl_DrawID;
|
|
@@ -215,15 +215,15 @@ container holding the app. Specify either width or maxWidth, and either height o
|
|
|
215
215
|
int y = j / size;
|
|
216
216
|
return texelFetch( batchingColorTexture, ivec2( x, y ), 0 );
|
|
217
217
|
}
|
|
218
|
-
#endif`,
|
|
218
|
+
#endif`,qA=`#ifdef USE_BATCHING
|
|
219
219
|
mat4 batchingMatrix = getBatchingMatrix( getIndirectIndex( gl_DrawID ) );
|
|
220
|
-
#endif`,
|
|
220
|
+
#endif`,WA=`vec3 transformed = vec3( position );
|
|
221
221
|
#ifdef USE_ALPHAHASH
|
|
222
222
|
vPosition = vec3( position );
|
|
223
|
-
#endif`,
|
|
223
|
+
#endif`,ZA=`vec3 objectNormal = vec3( normal );
|
|
224
224
|
#ifdef USE_TANGENT
|
|
225
225
|
vec3 objectTangent = vec3( tangent.xyz );
|
|
226
|
-
#endif
|
|
226
|
+
#endif`,XA=`float G_BlinnPhong_Implicit( ) {
|
|
227
227
|
return 0.25;
|
|
228
228
|
}
|
|
229
229
|
float D_BlinnPhong( const in float shininess, const in float dotNH ) {
|
|
@@ -237,7 +237,7 @@ vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in ve
|
|
|
237
237
|
float G = G_BlinnPhong_Implicit( );
|
|
238
238
|
float D = D_BlinnPhong( shininess, dotNH );
|
|
239
239
|
return F * ( G * D );
|
|
240
|
-
} // validated`,
|
|
240
|
+
} // validated`,YA=`#ifdef USE_IRIDESCENCE
|
|
241
241
|
const mat3 XYZ_TO_REC709 = mat3(
|
|
242
242
|
3.2404542, -0.9692660, 0.0556434,
|
|
243
243
|
-1.5371385, 1.8760108, -0.2040259,
|
|
@@ -300,7 +300,7 @@ vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in ve
|
|
|
300
300
|
}
|
|
301
301
|
return max( I, vec3( 0.0 ) );
|
|
302
302
|
}
|
|
303
|
-
#endif`,
|
|
303
|
+
#endif`,KA=`#ifdef USE_BUMPMAP
|
|
304
304
|
uniform sampler2D bumpMap;
|
|
305
305
|
uniform float bumpScale;
|
|
306
306
|
vec2 dHdxy_fwd() {
|
|
@@ -321,7 +321,7 @@ vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in ve
|
|
|
321
321
|
vec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );
|
|
322
322
|
return normalize( abs( fDet ) * surf_norm - vGrad );
|
|
323
323
|
}
|
|
324
|
-
#endif`,
|
|
324
|
+
#endif`,jA=`#if NUM_CLIPPING_PLANES > 0
|
|
325
325
|
vec4 plane;
|
|
326
326
|
#ifdef ALPHA_TO_COVERAGE
|
|
327
327
|
float distanceToPlane, distanceGradient;
|
|
@@ -367,20 +367,20 @@ vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in ve
|
|
|
367
367
|
if ( clipped ) discard;
|
|
368
368
|
#endif
|
|
369
369
|
#endif
|
|
370
|
-
#endif`,
|
|
370
|
+
#endif`,JA=`#if NUM_CLIPPING_PLANES > 0
|
|
371
371
|
varying vec3 vClipPosition;
|
|
372
372
|
uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];
|
|
373
|
-
#endif`,
|
|
373
|
+
#endif`,QA=`#if NUM_CLIPPING_PLANES > 0
|
|
374
374
|
varying vec3 vClipPosition;
|
|
375
|
-
#endif`,
|
|
375
|
+
#endif`,eC=`#if NUM_CLIPPING_PLANES > 0
|
|
376
376
|
vClipPosition = - mvPosition.xyz;
|
|
377
|
-
#endif`,
|
|
377
|
+
#endif`,tC=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA )
|
|
378
378
|
diffuseColor *= vColor;
|
|
379
|
-
#endif`,
|
|
379
|
+
#endif`,nC=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA )
|
|
380
380
|
varying vec4 vColor;
|
|
381
|
-
#endif`,
|
|
381
|
+
#endif`,iC=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )
|
|
382
382
|
varying vec4 vColor;
|
|
383
|
-
#endif`,
|
|
383
|
+
#endif`,sC=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )
|
|
384
384
|
vColor = vec4( 1.0 );
|
|
385
385
|
#endif
|
|
386
386
|
#ifdef USE_COLOR_ALPHA
|
|
@@ -393,7 +393,7 @@ vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in ve
|
|
|
393
393
|
#endif
|
|
394
394
|
#ifdef USE_BATCHING_COLOR
|
|
395
395
|
vColor *= getBatchingColor( getIndirectIndex( gl_DrawID ) );
|
|
396
|
-
#endif`,
|
|
396
|
+
#endif`,rC=`#define PI 3.141592653589793
|
|
397
397
|
#define PI2 6.283185307179586
|
|
398
398
|
#define PI_HALF 1.5707963267948966
|
|
399
399
|
#define RECIPROCAL_PI 0.3183098861837907
|
|
@@ -464,7 +464,7 @@ vec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) {
|
|
|
464
464
|
float F_Schlick( const in float f0, const in float f90, const in float dotVH ) {
|
|
465
465
|
float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );
|
|
466
466
|
return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );
|
|
467
|
-
} // validated`,
|
|
467
|
+
} // validated`,oC=`#ifdef ENVMAP_TYPE_CUBE_UV
|
|
468
468
|
#define cubeUV_minMipLevel 4.0
|
|
469
469
|
#define cubeUV_minTileSize 16.0
|
|
470
470
|
float getFace( vec3 direction ) {
|
|
@@ -557,7 +557,7 @@ float F_Schlick( const in float f0, const in float f90, const in float dotVH ) {
|
|
|
557
557
|
return vec4( mix( color0, color1, mipF ), 1.0 );
|
|
558
558
|
}
|
|
559
559
|
}
|
|
560
|
-
#endif`,
|
|
560
|
+
#endif`,aC=`vec3 transformedNormal = objectNormal;
|
|
561
561
|
#ifdef USE_TANGENT
|
|
562
562
|
vec3 transformedTangent = objectTangent;
|
|
563
563
|
#endif
|
|
@@ -583,21 +583,21 @@ transformedNormal = normalMatrix * transformedNormal;
|
|
|
583
583
|
#endif
|
|
584
584
|
#ifdef USE_TANGENT
|
|
585
585
|
transformedTangent = ( modelViewMatrix * vec4( transformedTangent, 0.0 ) ).xyz;
|
|
586
|
-
#endif`,
|
|
586
|
+
#endif`,cC=`#ifdef USE_DISPLACEMENTMAP
|
|
587
587
|
uniform sampler2D displacementMap;
|
|
588
588
|
uniform float displacementScale;
|
|
589
589
|
uniform float displacementBias;
|
|
590
|
-
#endif`,
|
|
590
|
+
#endif`,lC=`#ifdef USE_DISPLACEMENTMAP
|
|
591
591
|
transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias );
|
|
592
|
-
#endif`,
|
|
592
|
+
#endif`,uC=`#ifdef USE_EMISSIVEMAP
|
|
593
593
|
vec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv );
|
|
594
594
|
#ifdef DECODE_VIDEO_TEXTURE_EMISSIVE
|
|
595
595
|
emissiveColor = sRGBTransferEOTF( emissiveColor );
|
|
596
596
|
#endif
|
|
597
597
|
totalEmissiveRadiance *= emissiveColor.rgb;
|
|
598
|
-
#endif`,
|
|
598
|
+
#endif`,dC=`#ifdef USE_EMISSIVEMAP
|
|
599
599
|
uniform sampler2D emissiveMap;
|
|
600
|
-
#endif`,
|
|
600
|
+
#endif`,hC="gl_FragColor = linearToOutputTexel( gl_FragColor );",fC=`vec4 LinearTransferOETF( in vec4 value ) {
|
|
601
601
|
return value;
|
|
602
602
|
}
|
|
603
603
|
vec4 sRGBTransferEOTF( in vec4 value ) {
|
|
@@ -605,7 +605,7 @@ vec4 sRGBTransferEOTF( in vec4 value ) {
|
|
|
605
605
|
}
|
|
606
606
|
vec4 sRGBTransferOETF( in vec4 value ) {
|
|
607
607
|
return vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a );
|
|
608
|
-
}`,
|
|
608
|
+
}`,pC=`#ifdef USE_ENVMAP
|
|
609
609
|
#ifdef ENV_WORLDPOS
|
|
610
610
|
vec3 cameraToFrag;
|
|
611
611
|
if ( isOrthographic ) {
|
|
@@ -632,7 +632,7 @@ vec4 sRGBTransferOETF( in vec4 value ) {
|
|
|
632
632
|
outgoingLight += envColor.xyz * specularStrength * reflectivity;
|
|
633
633
|
#endif
|
|
634
634
|
#endif
|
|
635
|
-
#endif`,
|
|
635
|
+
#endif`,mC=`#ifdef USE_ENVMAP
|
|
636
636
|
uniform float envMapIntensity;
|
|
637
637
|
uniform mat3 envMapRotation;
|
|
638
638
|
#ifdef ENVMAP_TYPE_CUBE
|
|
@@ -640,7 +640,7 @@ vec4 sRGBTransferOETF( in vec4 value ) {
|
|
|
640
640
|
#else
|
|
641
641
|
uniform sampler2D envMap;
|
|
642
642
|
#endif
|
|
643
|
-
#endif`,
|
|
643
|
+
#endif`,gC=`#ifdef USE_ENVMAP
|
|
644
644
|
uniform float reflectivity;
|
|
645
645
|
#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )
|
|
646
646
|
#define ENV_WORLDPOS
|
|
@@ -651,7 +651,7 @@ vec4 sRGBTransferOETF( in vec4 value ) {
|
|
|
651
651
|
#else
|
|
652
652
|
varying vec3 vReflect;
|
|
653
653
|
#endif
|
|
654
|
-
#endif`,
|
|
654
|
+
#endif`,_C=`#ifdef USE_ENVMAP
|
|
655
655
|
#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )
|
|
656
656
|
#define ENV_WORLDPOS
|
|
657
657
|
#endif
|
|
@@ -662,7 +662,7 @@ vec4 sRGBTransferOETF( in vec4 value ) {
|
|
|
662
662
|
varying vec3 vReflect;
|
|
663
663
|
uniform float refractionRatio;
|
|
664
664
|
#endif
|
|
665
|
-
#endif`,
|
|
665
|
+
#endif`,SC=`#ifdef USE_ENVMAP
|
|
666
666
|
#ifdef ENV_WORLDPOS
|
|
667
667
|
vWorldPosition = worldPosition.xyz;
|
|
668
668
|
#else
|
|
@@ -679,18 +679,18 @@ vec4 sRGBTransferOETF( in vec4 value ) {
|
|
|
679
679
|
vReflect = refract( cameraToVertex, worldNormal, refractionRatio );
|
|
680
680
|
#endif
|
|
681
681
|
#endif
|
|
682
|
-
#endif`,
|
|
682
|
+
#endif`,vC=`#ifdef USE_FOG
|
|
683
683
|
vFogDepth = - mvPosition.z;
|
|
684
|
-
#endif`,
|
|
684
|
+
#endif`,xC=`#ifdef USE_FOG
|
|
685
685
|
varying float vFogDepth;
|
|
686
|
-
#endif`,
|
|
686
|
+
#endif`,yC=`#ifdef USE_FOG
|
|
687
687
|
#ifdef FOG_EXP2
|
|
688
688
|
float fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth );
|
|
689
689
|
#else
|
|
690
690
|
float fogFactor = smoothstep( fogNear, fogFar, vFogDepth );
|
|
691
691
|
#endif
|
|
692
692
|
gl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );
|
|
693
|
-
#endif`,
|
|
693
|
+
#endif`,bC=`#ifdef USE_FOG
|
|
694
694
|
uniform vec3 fogColor;
|
|
695
695
|
varying float vFogDepth;
|
|
696
696
|
#ifdef FOG_EXP2
|
|
@@ -699,7 +699,7 @@ vec4 sRGBTransferOETF( in vec4 value ) {
|
|
|
699
699
|
uniform float fogNear;
|
|
700
700
|
uniform float fogFar;
|
|
701
701
|
#endif
|
|
702
|
-
#endif`,
|
|
702
|
+
#endif`,MC=`#ifdef USE_GRADIENTMAP
|
|
703
703
|
uniform sampler2D gradientMap;
|
|
704
704
|
#endif
|
|
705
705
|
vec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {
|
|
@@ -711,12 +711,12 @@ vec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {
|
|
|
711
711
|
vec2 fw = fwidth( coord ) * 0.5;
|
|
712
712
|
return mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) );
|
|
713
713
|
#endif
|
|
714
|
-
}`,
|
|
714
|
+
}`,EC=`#ifdef USE_LIGHTMAP
|
|
715
715
|
uniform sampler2D lightMap;
|
|
716
716
|
uniform float lightMapIntensity;
|
|
717
|
-
#endif`,
|
|
717
|
+
#endif`,TC=`LambertMaterial material;
|
|
718
718
|
material.diffuseColor = diffuseColor.rgb;
|
|
719
|
-
material.specularStrength = specularStrength;`,
|
|
719
|
+
material.specularStrength = specularStrength;`,RC=`varying vec3 vViewPosition;
|
|
720
720
|
struct LambertMaterial {
|
|
721
721
|
vec3 diffuseColor;
|
|
722
722
|
float specularStrength;
|
|
@@ -730,7 +730,7 @@ void RE_IndirectDiffuse_Lambert( const in vec3 irradiance, const in vec3 geometr
|
|
|
730
730
|
reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
|
|
731
731
|
}
|
|
732
732
|
#define RE_Direct RE_Direct_Lambert
|
|
733
|
-
#define RE_IndirectDiffuse RE_IndirectDiffuse_Lambert`,
|
|
733
|
+
#define RE_IndirectDiffuse RE_IndirectDiffuse_Lambert`,wC=`uniform bool receiveShadow;
|
|
734
734
|
uniform vec3 ambientLightColor;
|
|
735
735
|
#if defined( USE_LIGHT_PROBES )
|
|
736
736
|
uniform vec3 lightProbe[ 9 ];
|
|
@@ -859,7 +859,7 @@ float getSpotAttenuation( const in float coneCosine, const in float penumbraCosi
|
|
|
859
859
|
return irradiance;
|
|
860
860
|
}
|
|
861
861
|
#endif
|
|
862
|
-
#include <lightprobes_pars_fragment>`,
|
|
862
|
+
#include <lightprobes_pars_fragment>`,AC=`#ifdef USE_ENVMAP
|
|
863
863
|
vec3 getIBLIrradiance( const in vec3 normal ) {
|
|
864
864
|
#ifdef ENVMAP_TYPE_CUBE_UV
|
|
865
865
|
vec3 worldNormal = transformNormalByInverseViewMatrix( normal, viewMatrix );
|
|
@@ -916,8 +916,8 @@ float getSpotAttenuation( const in float coneCosine, const in float penumbraCosi
|
|
|
916
916
|
}
|
|
917
917
|
#endif
|
|
918
918
|
#endif
|
|
919
|
-
#endif`,
|
|
920
|
-
material.diffuseColor = diffuseColor.rgb;`,
|
|
919
|
+
#endif`,CC=`ToonMaterial material;
|
|
920
|
+
material.diffuseColor = diffuseColor.rgb;`,PC=`varying vec3 vViewPosition;
|
|
921
921
|
struct ToonMaterial {
|
|
922
922
|
vec3 diffuseColor;
|
|
923
923
|
};
|
|
@@ -929,11 +929,11 @@ void RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in vec3 geometryPo
|
|
|
929
929
|
reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
|
|
930
930
|
}
|
|
931
931
|
#define RE_Direct RE_Direct_Toon
|
|
932
|
-
#define RE_IndirectDiffuse RE_IndirectDiffuse_Toon`,
|
|
932
|
+
#define RE_IndirectDiffuse RE_IndirectDiffuse_Toon`,LC=`BlinnPhongMaterial material;
|
|
933
933
|
material.diffuseColor = diffuseColor.rgb;
|
|
934
934
|
material.specularColor = specular;
|
|
935
935
|
material.specularShininess = shininess;
|
|
936
|
-
material.specularStrength = specularStrength;`,
|
|
936
|
+
material.specularStrength = specularStrength;`,IC=`varying vec3 vViewPosition;
|
|
937
937
|
struct BlinnPhongMaterial {
|
|
938
938
|
vec3 diffuseColor;
|
|
939
939
|
vec3 specularColor;
|
|
@@ -950,7 +950,7 @@ void RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in vec3 geom
|
|
|
950
950
|
reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
|
|
951
951
|
}
|
|
952
952
|
#define RE_Direct RE_Direct_BlinnPhong
|
|
953
|
-
#define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong`,
|
|
953
|
+
#define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong`,NC=`PhysicalMaterial material;
|
|
954
954
|
material.diffuseColor = diffuseColor.rgb;
|
|
955
955
|
material.diffuseContribution = diffuseColor.rgb * ( 1.0 - metalnessFactor );
|
|
956
956
|
material.metalness = metalnessFactor;
|
|
@@ -1043,7 +1043,7 @@ material.roughness = min( material.roughness, 1.0 );
|
|
|
1043
1043
|
material.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) );
|
|
1044
1044
|
material.anisotropyT = tbn[ 0 ] * anisotropyV.x + tbn[ 1 ] * anisotropyV.y;
|
|
1045
1045
|
material.anisotropyB = tbn[ 1 ] * anisotropyV.x - tbn[ 0 ] * anisotropyV.y;
|
|
1046
|
-
#endif`,
|
|
1046
|
+
#endif`,DC=`uniform sampler2D dfgLUT;
|
|
1047
1047
|
struct PhysicalMaterial {
|
|
1048
1048
|
vec3 diffuseColor;
|
|
1049
1049
|
vec3 diffuseContribution;
|
|
@@ -1410,7 +1410,7 @@ void RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradia
|
|
|
1410
1410
|
#define RE_IndirectSpecular RE_IndirectSpecular_Physical
|
|
1411
1411
|
float computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {
|
|
1412
1412
|
return saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );
|
|
1413
|
-
}`,
|
|
1413
|
+
}`,UC=`
|
|
1414
1414
|
vec3 geometryPosition = - vViewPosition;
|
|
1415
1415
|
vec3 geometryNormal = normal;
|
|
1416
1416
|
vec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );
|
|
@@ -1558,7 +1558,7 @@ IncidentLight directLight;
|
|
|
1558
1558
|
#if defined( RE_IndirectSpecular )
|
|
1559
1559
|
vec3 radiance = vec3( 0.0 );
|
|
1560
1560
|
vec3 clearcoatRadiance = vec3( 0.0 );
|
|
1561
|
-
#endif`,
|
|
1561
|
+
#endif`,OC=`#if defined( RE_IndirectDiffuse )
|
|
1562
1562
|
#ifdef USE_LIGHTMAP
|
|
1563
1563
|
vec4 lightMapTexel = texture2D( lightMap, vLightMapUv );
|
|
1564
1564
|
vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;
|
|
@@ -1588,7 +1588,7 @@ IncidentLight directLight;
|
|
|
1588
1588
|
#ifdef USE_CLEARCOAT
|
|
1589
1589
|
clearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal, material.clearcoatRoughness );
|
|
1590
1590
|
#endif
|
|
1591
|
-
#endif`,
|
|
1591
|
+
#endif`,FC=`#if defined( RE_IndirectDiffuse )
|
|
1592
1592
|
#if defined( LAMBERT ) || defined( PHONG )
|
|
1593
1593
|
irradiance += iblIrradiance;
|
|
1594
1594
|
#endif
|
|
@@ -1596,7 +1596,7 @@ IncidentLight directLight;
|
|
|
1596
1596
|
#endif
|
|
1597
1597
|
#if defined( RE_IndirectSpecular )
|
|
1598
1598
|
RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
|
|
1599
|
-
#endif`,
|
|
1599
|
+
#endif`,kC=`#ifdef USE_LIGHT_PROBES_GRID
|
|
1600
1600
|
uniform highp sampler3D probesSH;
|
|
1601
1601
|
uniform vec3 probesMin;
|
|
1602
1602
|
uniform vec3 probesMax;
|
|
@@ -1641,27 +1641,27 @@ vec3 getLightProbeGridIrradiance( vec3 worldPos, vec3 worldNormal ) {
|
|
|
1641
1641
|
result += c8 * 0.429043 * ( x * x - y * y );
|
|
1642
1642
|
return max( result, vec3( 0.0 ) );
|
|
1643
1643
|
}
|
|
1644
|
-
#endif`,
|
|
1644
|
+
#endif`,zC=`#if defined( USE_LOGARITHMIC_DEPTH_BUFFER )
|
|
1645
1645
|
gl_FragDepth = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;
|
|
1646
|
-
#endif`,
|
|
1646
|
+
#endif`,BC=`#if defined( USE_LOGARITHMIC_DEPTH_BUFFER )
|
|
1647
1647
|
uniform float logDepthBufFC;
|
|
1648
1648
|
varying float vFragDepth;
|
|
1649
1649
|
varying float vIsPerspective;
|
|
1650
|
-
#endif`,
|
|
1650
|
+
#endif`,HC=`#ifdef USE_LOGARITHMIC_DEPTH_BUFFER
|
|
1651
1651
|
varying float vFragDepth;
|
|
1652
1652
|
varying float vIsPerspective;
|
|
1653
|
-
#endif`,
|
|
1653
|
+
#endif`,VC=`#ifdef USE_LOGARITHMIC_DEPTH_BUFFER
|
|
1654
1654
|
vFragDepth = 1.0 + gl_Position.w;
|
|
1655
1655
|
vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );
|
|
1656
|
-
#endif`,
|
|
1656
|
+
#endif`,GC=`#ifdef USE_MAP
|
|
1657
1657
|
vec4 sampledDiffuseColor = texture2D( map, vMapUv );
|
|
1658
1658
|
#ifdef DECODE_VIDEO_TEXTURE
|
|
1659
1659
|
sampledDiffuseColor = sRGBTransferEOTF( sampledDiffuseColor );
|
|
1660
1660
|
#endif
|
|
1661
1661
|
diffuseColor *= sampledDiffuseColor;
|
|
1662
|
-
#endif
|
|
1662
|
+
#endif`,$C=`#ifdef USE_MAP
|
|
1663
1663
|
uniform sampler2D map;
|
|
1664
|
-
#endif`,
|
|
1664
|
+
#endif`,qC=`#if defined( USE_MAP ) || defined( USE_ALPHAMAP )
|
|
1665
1665
|
#if defined( USE_POINTS_UV )
|
|
1666
1666
|
vec2 uv = vUv;
|
|
1667
1667
|
#else
|
|
@@ -1673,7 +1673,7 @@ vec3 getLightProbeGridIrradiance( vec3 worldPos, vec3 worldNormal ) {
|
|
|
1673
1673
|
#endif
|
|
1674
1674
|
#ifdef USE_ALPHAMAP
|
|
1675
1675
|
diffuseColor.a *= texture2D( alphaMap, uv ).g;
|
|
1676
|
-
#endif`,
|
|
1676
|
+
#endif`,WC=`#if defined( USE_POINTS_UV )
|
|
1677
1677
|
varying vec2 vUv;
|
|
1678
1678
|
#else
|
|
1679
1679
|
#if defined( USE_MAP ) || defined( USE_ALPHAMAP )
|
|
@@ -1685,19 +1685,19 @@ vec3 getLightProbeGridIrradiance( vec3 worldPos, vec3 worldNormal ) {
|
|
|
1685
1685
|
#endif
|
|
1686
1686
|
#ifdef USE_ALPHAMAP
|
|
1687
1687
|
uniform sampler2D alphaMap;
|
|
1688
|
-
#endif`,
|
|
1688
|
+
#endif`,ZC=`float metalnessFactor = metalness;
|
|
1689
1689
|
#ifdef USE_METALNESSMAP
|
|
1690
1690
|
vec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv );
|
|
1691
1691
|
metalnessFactor *= texelMetalness.b;
|
|
1692
|
-
#endif
|
|
1692
|
+
#endif`,XC=`#ifdef USE_METALNESSMAP
|
|
1693
1693
|
uniform sampler2D metalnessMap;
|
|
1694
|
-
#endif`,
|
|
1694
|
+
#endif`,YC=`#ifdef USE_INSTANCING_MORPH
|
|
1695
1695
|
float morphTargetInfluences[ MORPHTARGETS_COUNT ];
|
|
1696
1696
|
float morphTargetBaseInfluence = texelFetch( morphTexture, ivec2( 0, gl_InstanceID ), 0 ).r;
|
|
1697
1697
|
for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
|
|
1698
1698
|
morphTargetInfluences[i] = texelFetch( morphTexture, ivec2( i + 1, gl_InstanceID ), 0 ).r;
|
|
1699
1699
|
}
|
|
1700
|
-
#endif`,
|
|
1700
|
+
#endif`,KC=`#if defined( USE_MORPHCOLORS )
|
|
1701
1701
|
vColor *= morphTargetBaseInfluence;
|
|
1702
1702
|
for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
|
|
1703
1703
|
#if defined( USE_COLOR_ALPHA )
|
|
@@ -1706,12 +1706,12 @@ vec3 getLightProbeGridIrradiance( vec3 worldPos, vec3 worldNormal ) {
|
|
|
1706
1706
|
if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ];
|
|
1707
1707
|
#endif
|
|
1708
1708
|
}
|
|
1709
|
-
#endif`,
|
|
1709
|
+
#endif`,jC=`#ifdef USE_MORPHNORMALS
|
|
1710
1710
|
objectNormal *= morphTargetBaseInfluence;
|
|
1711
1711
|
for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
|
|
1712
1712
|
if ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ];
|
|
1713
1713
|
}
|
|
1714
|
-
#endif`,
|
|
1714
|
+
#endif`,JC=`#ifdef USE_MORPHTARGETS
|
|
1715
1715
|
#ifndef USE_INSTANCING_MORPH
|
|
1716
1716
|
uniform float morphTargetBaseInfluence;
|
|
1717
1717
|
uniform float morphTargetInfluences[ MORPHTARGETS_COUNT ];
|
|
@@ -1725,12 +1725,12 @@ vec3 getLightProbeGridIrradiance( vec3 worldPos, vec3 worldNormal ) {
|
|
|
1725
1725
|
ivec3 morphUV = ivec3( x, y, morphTargetIndex );
|
|
1726
1726
|
return texelFetch( morphTargetsTexture, morphUV, 0 );
|
|
1727
1727
|
}
|
|
1728
|
-
#endif`,
|
|
1728
|
+
#endif`,QC=`#ifdef USE_MORPHTARGETS
|
|
1729
1729
|
transformed *= morphTargetBaseInfluence;
|
|
1730
1730
|
for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
|
|
1731
1731
|
if ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ];
|
|
1732
1732
|
}
|
|
1733
|
-
#endif`,
|
|
1733
|
+
#endif`,eP=`float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;
|
|
1734
1734
|
#ifdef FLAT_SHADED
|
|
1735
1735
|
vec3 fdx = dFdx( vViewPosition );
|
|
1736
1736
|
vec3 fdy = dFdy( vViewPosition );
|
|
@@ -1771,7 +1771,7 @@ vec3 getLightProbeGridIrradiance( vec3 worldPos, vec3 worldNormal ) {
|
|
|
1771
1771
|
tbn2[1] *= faceDirection;
|
|
1772
1772
|
#endif
|
|
1773
1773
|
#endif
|
|
1774
|
-
vec3 nonPerturbedNormal = normal;`,
|
|
1774
|
+
vec3 nonPerturbedNormal = normal;`,tP=`#ifdef USE_NORMALMAP_OBJECTSPACE
|
|
1775
1775
|
normal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;
|
|
1776
1776
|
#ifdef FLIP_SIDED
|
|
1777
1777
|
normal = - normal;
|
|
@@ -1789,19 +1789,19 @@ vec3 nonPerturbedNormal = normal;`,JA=`#ifdef USE_NORMALMAP_OBJECTSPACE
|
|
|
1789
1789
|
normal = normalize( tbn * mapN );
|
|
1790
1790
|
#elif defined( USE_BUMPMAP )
|
|
1791
1791
|
normal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection );
|
|
1792
|
-
#endif`,
|
|
1792
|
+
#endif`,nP=`#ifndef FLAT_SHADED
|
|
1793
1793
|
varying vec3 vNormal;
|
|
1794
1794
|
#ifdef USE_TANGENT
|
|
1795
1795
|
varying vec3 vTangent;
|
|
1796
1796
|
varying vec3 vBitangent;
|
|
1797
1797
|
#endif
|
|
1798
|
-
#endif`,
|
|
1798
|
+
#endif`,iP=`#ifndef FLAT_SHADED
|
|
1799
1799
|
varying vec3 vNormal;
|
|
1800
1800
|
#ifdef USE_TANGENT
|
|
1801
1801
|
varying vec3 vTangent;
|
|
1802
1802
|
varying vec3 vBitangent;
|
|
1803
1803
|
#endif
|
|
1804
|
-
#endif`,
|
|
1804
|
+
#endif`,sP=`#ifndef FLAT_SHADED
|
|
1805
1805
|
vNormal = normalize( transformedNormal );
|
|
1806
1806
|
#ifdef USE_TANGENT
|
|
1807
1807
|
vTangent = normalize( transformedTangent );
|
|
@@ -1810,7 +1810,7 @@ vec3 nonPerturbedNormal = normal;`,JA=`#ifdef USE_NORMALMAP_OBJECTSPACE
|
|
|
1810
1810
|
vBitangent = - vBitangent;
|
|
1811
1811
|
#endif
|
|
1812
1812
|
#endif
|
|
1813
|
-
#endif`,
|
|
1813
|
+
#endif`,rP=`#ifdef USE_NORMALMAP
|
|
1814
1814
|
uniform sampler2D normalMap;
|
|
1815
1815
|
uniform vec2 normalScale;
|
|
1816
1816
|
#endif
|
|
@@ -1832,13 +1832,13 @@ vec3 nonPerturbedNormal = normal;`,JA=`#ifdef USE_NORMALMAP_OBJECTSPACE
|
|
|
1832
1832
|
float scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det );
|
|
1833
1833
|
return mat3( T * scale, B * scale, N );
|
|
1834
1834
|
}
|
|
1835
|
-
#endif`,
|
|
1835
|
+
#endif`,oP=`#ifdef USE_CLEARCOAT
|
|
1836
1836
|
vec3 clearcoatNormal = nonPerturbedNormal;
|
|
1837
|
-
#endif`,
|
|
1837
|
+
#endif`,aP=`#ifdef USE_CLEARCOAT_NORMALMAP
|
|
1838
1838
|
vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0;
|
|
1839
1839
|
clearcoatMapN.xy *= clearcoatNormalScale;
|
|
1840
1840
|
clearcoatNormal = normalize( tbn2 * clearcoatMapN );
|
|
1841
|
-
#endif`,
|
|
1841
|
+
#endif`,cP=`#ifdef USE_CLEARCOATMAP
|
|
1842
1842
|
uniform sampler2D clearcoatMap;
|
|
1843
1843
|
#endif
|
|
1844
1844
|
#ifdef USE_CLEARCOAT_NORMALMAP
|
|
@@ -1847,18 +1847,18 @@ vec3 nonPerturbedNormal = normal;`,JA=`#ifdef USE_NORMALMAP_OBJECTSPACE
|
|
|
1847
1847
|
#endif
|
|
1848
1848
|
#ifdef USE_CLEARCOAT_ROUGHNESSMAP
|
|
1849
1849
|
uniform sampler2D clearcoatRoughnessMap;
|
|
1850
|
-
#endif`,
|
|
1850
|
+
#endif`,lP=`#ifdef USE_IRIDESCENCEMAP
|
|
1851
1851
|
uniform sampler2D iridescenceMap;
|
|
1852
1852
|
#endif
|
|
1853
1853
|
#ifdef USE_IRIDESCENCE_THICKNESSMAP
|
|
1854
1854
|
uniform sampler2D iridescenceThicknessMap;
|
|
1855
|
-
#endif`,
|
|
1855
|
+
#endif`,uP=`#ifdef OPAQUE
|
|
1856
1856
|
diffuseColor.a = 1.0;
|
|
1857
1857
|
#endif
|
|
1858
1858
|
#ifdef USE_TRANSMISSION
|
|
1859
1859
|
diffuseColor.a *= material.transmissionAlpha;
|
|
1860
1860
|
#endif
|
|
1861
|
-
gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,
|
|
1861
|
+
gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,dP=`vec3 packNormalToRGB( const in vec3 normal ) {
|
|
1862
1862
|
return normalize( normal ) * 0.5 + 0.5;
|
|
1863
1863
|
}
|
|
1864
1864
|
vec3 unpackRGBToNormal( const in vec3 rgb ) {
|
|
@@ -1937,9 +1937,9 @@ float perspectiveDepthToViewZ( const in float depth, const in float near, const
|
|
|
1937
1937
|
#else
|
|
1938
1938
|
return ( near * far ) / ( ( far - near ) * depth - far );
|
|
1939
1939
|
#endif
|
|
1940
|
-
}`,
|
|
1940
|
+
}`,hP=`#ifdef PREMULTIPLIED_ALPHA
|
|
1941
1941
|
gl_FragColor.rgb *= gl_FragColor.a;
|
|
1942
|
-
#endif`,
|
|
1942
|
+
#endif`,fP=`vec4 mvPosition = vec4( transformed, 1.0 );
|
|
1943
1943
|
#ifdef USE_BATCHING
|
|
1944
1944
|
mvPosition = batchingMatrix * mvPosition;
|
|
1945
1945
|
#endif
|
|
@@ -1947,22 +1947,22 @@ float perspectiveDepthToViewZ( const in float depth, const in float near, const
|
|
|
1947
1947
|
mvPosition = instanceMatrix * mvPosition;
|
|
1948
1948
|
#endif
|
|
1949
1949
|
mvPosition = modelViewMatrix * mvPosition;
|
|
1950
|
-
gl_Position = projectionMatrix * mvPosition;`,
|
|
1950
|
+
gl_Position = projectionMatrix * mvPosition;`,pP=`#ifdef DITHERING
|
|
1951
1951
|
gl_FragColor.rgb = dithering( gl_FragColor.rgb );
|
|
1952
|
-
#endif`,
|
|
1952
|
+
#endif`,mP=`#ifdef DITHERING
|
|
1953
1953
|
vec3 dithering( vec3 color ) {
|
|
1954
1954
|
float grid_position = rand( gl_FragCoord.xy );
|
|
1955
1955
|
vec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );
|
|
1956
1956
|
dither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );
|
|
1957
1957
|
return color + dither_shift_RGB;
|
|
1958
1958
|
}
|
|
1959
|
-
#endif`,
|
|
1959
|
+
#endif`,gP=`float roughnessFactor = roughness;
|
|
1960
1960
|
#ifdef USE_ROUGHNESSMAP
|
|
1961
1961
|
vec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv );
|
|
1962
1962
|
roughnessFactor *= texelRoughness.g;
|
|
1963
|
-
#endif`,
|
|
1963
|
+
#endif`,_P=`#ifdef USE_ROUGHNESSMAP
|
|
1964
1964
|
uniform sampler2D roughnessMap;
|
|
1965
|
-
#endif`,
|
|
1965
|
+
#endif`,SP=`#if NUM_SPOT_LIGHT_COORDS > 0
|
|
1966
1966
|
varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];
|
|
1967
1967
|
#endif
|
|
1968
1968
|
#if NUM_SPOT_LIGHT_MAPS > 0
|
|
@@ -2213,7 +2213,7 @@ gl_Position = projectionMatrix * mvPosition;`,dC=`#ifdef DITHERING
|
|
|
2213
2213
|
}
|
|
2214
2214
|
#endif
|
|
2215
2215
|
#endif
|
|
2216
|
-
#endif`,
|
|
2216
|
+
#endif`,vP=`#if NUM_SPOT_LIGHT_COORDS > 0
|
|
2217
2217
|
uniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ];
|
|
2218
2218
|
varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];
|
|
2219
2219
|
#endif
|
|
@@ -2258,7 +2258,7 @@ gl_Position = projectionMatrix * mvPosition;`,dC=`#ifdef DITHERING
|
|
|
2258
2258
|
};
|
|
2259
2259
|
uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];
|
|
2260
2260
|
#endif
|
|
2261
|
-
#endif`,
|
|
2261
|
+
#endif`,xP=`#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_SUN_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 )
|
|
2262
2262
|
#ifdef HAS_NORMAL
|
|
2263
2263
|
vec3 shadowWorldNormal = transformNormalByInverseViewMatrix( transformedNormal, viewMatrix );
|
|
2264
2264
|
#else
|
|
@@ -2298,7 +2298,7 @@ gl_Position = projectionMatrix * mvPosition;`,dC=`#ifdef DITHERING
|
|
|
2298
2298
|
vSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition;
|
|
2299
2299
|
}
|
|
2300
2300
|
#pragma unroll_loop_end
|
|
2301
|
-
#endif`,
|
|
2301
|
+
#endif`,yP=`float getShadowMask() {
|
|
2302
2302
|
float shadow = 1.0;
|
|
2303
2303
|
#ifdef USE_SHADOWMAP
|
|
2304
2304
|
#if NUM_SUN_LIGHT_SHADOWS > 0
|
|
@@ -2339,12 +2339,12 @@ gl_Position = projectionMatrix * mvPosition;`,dC=`#ifdef DITHERING
|
|
|
2339
2339
|
#endif
|
|
2340
2340
|
#endif
|
|
2341
2341
|
return shadow;
|
|
2342
|
-
}`,
|
|
2342
|
+
}`,bP=`#ifdef USE_SKINNING
|
|
2343
2343
|
mat4 boneMatX = getBoneMatrix( skinIndex.x );
|
|
2344
2344
|
mat4 boneMatY = getBoneMatrix( skinIndex.y );
|
|
2345
2345
|
mat4 boneMatZ = getBoneMatrix( skinIndex.z );
|
|
2346
2346
|
mat4 boneMatW = getBoneMatrix( skinIndex.w );
|
|
2347
|
-
#endif`,
|
|
2347
|
+
#endif`,MP=`#ifdef USE_SKINNING
|
|
2348
2348
|
uniform mat4 bindMatrix;
|
|
2349
2349
|
uniform mat4 bindMatrixInverse;
|
|
2350
2350
|
uniform highp sampler2D boneTexture;
|
|
@@ -2359,7 +2359,7 @@ gl_Position = projectionMatrix * mvPosition;`,dC=`#ifdef DITHERING
|
|
|
2359
2359
|
vec4 v4 = texelFetch( boneTexture, ivec2( x + 3, y ), 0 );
|
|
2360
2360
|
return mat4( v1, v2, v3, v4 );
|
|
2361
2361
|
}
|
|
2362
|
-
#endif`,
|
|
2362
|
+
#endif`,EP=`#ifdef USE_SKINNING
|
|
2363
2363
|
vec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );
|
|
2364
2364
|
vec4 skinned = vec4( 0.0 );
|
|
2365
2365
|
skinned += boneMatX * skinVertex * skinWeight.x;
|
|
@@ -2367,7 +2367,7 @@ gl_Position = projectionMatrix * mvPosition;`,dC=`#ifdef DITHERING
|
|
|
2367
2367
|
skinned += boneMatZ * skinVertex * skinWeight.z;
|
|
2368
2368
|
skinned += boneMatW * skinVertex * skinWeight.w;
|
|
2369
2369
|
transformed = ( bindMatrixInverse * skinned ).xyz;
|
|
2370
|
-
#endif`,
|
|
2370
|
+
#endif`,TP=`#ifdef USE_SKINNING
|
|
2371
2371
|
mat4 skinMatrix = mat4( 0.0 );
|
|
2372
2372
|
skinMatrix += skinWeight.x * boneMatX;
|
|
2373
2373
|
skinMatrix += skinWeight.y * boneMatY;
|
|
@@ -2378,17 +2378,17 @@ gl_Position = projectionMatrix * mvPosition;`,dC=`#ifdef DITHERING
|
|
|
2378
2378
|
#ifdef USE_TANGENT
|
|
2379
2379
|
objectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;
|
|
2380
2380
|
#endif
|
|
2381
|
-
#endif`,
|
|
2381
|
+
#endif`,RP=`float specularStrength;
|
|
2382
2382
|
#ifdef USE_SPECULARMAP
|
|
2383
2383
|
vec4 texelSpecular = texture2D( specularMap, vSpecularMapUv );
|
|
2384
2384
|
specularStrength = texelSpecular.r;
|
|
2385
2385
|
#else
|
|
2386
2386
|
specularStrength = 1.0;
|
|
2387
|
-
#endif`,
|
|
2387
|
+
#endif`,wP=`#ifdef USE_SPECULARMAP
|
|
2388
2388
|
uniform sampler2D specularMap;
|
|
2389
|
-
#endif`,
|
|
2389
|
+
#endif`,AP=`#if defined( TONE_MAPPING )
|
|
2390
2390
|
gl_FragColor.rgb = toneMapping( gl_FragColor.rgb );
|
|
2391
|
-
#endif`,
|
|
2391
|
+
#endif`,CP=`#ifndef saturate
|
|
2392
2392
|
#define saturate( a ) clamp( a, 0.0, 1.0 )
|
|
2393
2393
|
#endif
|
|
2394
2394
|
uniform float toneMappingExposure;
|
|
@@ -2485,7 +2485,7 @@ vec3 NeutralToneMapping( vec3 color ) {
|
|
|
2485
2485
|
float g = 1. - 1. / ( Desaturation * ( peak - newPeak ) + 1. );
|
|
2486
2486
|
return mix( color, vec3( newPeak ), g );
|
|
2487
2487
|
}
|
|
2488
|
-
vec3 CustomToneMapping( vec3 color ) { return color; }`,
|
|
2488
|
+
vec3 CustomToneMapping( vec3 color ) { return color; }`,PP=`#ifdef USE_TRANSMISSION
|
|
2489
2489
|
material.transmission = transmission;
|
|
2490
2490
|
material.transmissionAlpha = 1.0;
|
|
2491
2491
|
material.thickness = thickness;
|
|
@@ -2506,7 +2506,7 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,wC=`#ifdef USE_TRANSMISS
|
|
|
2506
2506
|
material.attenuationColor, material.attenuationDistance );
|
|
2507
2507
|
material.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission );
|
|
2508
2508
|
totalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission );
|
|
2509
|
-
#endif`,
|
|
2509
|
+
#endif`,LP=`#ifdef USE_TRANSMISSION
|
|
2510
2510
|
uniform float transmission;
|
|
2511
2511
|
uniform float thickness;
|
|
2512
2512
|
uniform float attenuationDistance;
|
|
@@ -2632,7 +2632,7 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,wC=`#ifdef USE_TRANSMISS
|
|
|
2632
2632
|
float transmittanceFactor = ( transmittance.r + transmittance.g + transmittance.b ) / 3.0;
|
|
2633
2633
|
return vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a ) * transmittanceFactor );
|
|
2634
2634
|
}
|
|
2635
|
-
#endif`,
|
|
2635
|
+
#endif`,IP=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
|
|
2636
2636
|
varying vec2 vUv;
|
|
2637
2637
|
#endif
|
|
2638
2638
|
#ifdef USE_MAP
|
|
@@ -2702,7 +2702,7 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,wC=`#ifdef USE_TRANSMISS
|
|
|
2702
2702
|
#ifdef USE_THICKNESSMAP
|
|
2703
2703
|
uniform mat3 thicknessMapTransform;
|
|
2704
2704
|
varying vec2 vThicknessMapUv;
|
|
2705
|
-
#endif`,
|
|
2705
|
+
#endif`,NP=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
|
|
2706
2706
|
varying vec2 vUv;
|
|
2707
2707
|
#endif
|
|
2708
2708
|
#ifdef USE_MAP
|
|
@@ -2796,7 +2796,7 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,wC=`#ifdef USE_TRANSMISS
|
|
|
2796
2796
|
#ifdef USE_THICKNESSMAP
|
|
2797
2797
|
uniform mat3 thicknessMapTransform;
|
|
2798
2798
|
varying vec2 vThicknessMapUv;
|
|
2799
|
-
#endif`,
|
|
2799
|
+
#endif`,DP=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
|
|
2800
2800
|
vUv = vec3( uv, 1 ).xy;
|
|
2801
2801
|
#endif
|
|
2802
2802
|
#ifdef USE_MAP
|
|
@@ -2867,7 +2867,7 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,wC=`#ifdef USE_TRANSMISS
|
|
|
2867
2867
|
#endif
|
|
2868
2868
|
#ifdef USE_THICKNESSMAP
|
|
2869
2869
|
vThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy;
|
|
2870
|
-
#endif`,
|
|
2870
|
+
#endif`,UP=`#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0
|
|
2871
2871
|
vec4 worldPosition = vec4( transformed, 1.0 );
|
|
2872
2872
|
#ifdef USE_BATCHING
|
|
2873
2873
|
worldPosition = batchingMatrix * worldPosition;
|
|
@@ -2876,12 +2876,12 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,wC=`#ifdef USE_TRANSMISS
|
|
|
2876
2876
|
worldPosition = instanceMatrix * worldPosition;
|
|
2877
2877
|
#endif
|
|
2878
2878
|
worldPosition = modelMatrix * worldPosition;
|
|
2879
|
-
#endif`;const
|
|
2879
|
+
#endif`;const OP=`varying vec2 vUv;
|
|
2880
2880
|
uniform mat3 uvTransform;
|
|
2881
2881
|
void main() {
|
|
2882
2882
|
vUv = ( uvTransform * vec3( uv, 1 ) ).xy;
|
|
2883
2883
|
gl_Position = vec4( position.xy, 1.0, 1.0 );
|
|
2884
|
-
}`,
|
|
2884
|
+
}`,FP=`uniform sampler2D t2D;
|
|
2885
2885
|
uniform float backgroundIntensity;
|
|
2886
2886
|
varying vec2 vUv;
|
|
2887
2887
|
void main() {
|
|
@@ -2893,14 +2893,14 @@ void main() {
|
|
|
2893
2893
|
gl_FragColor = texColor;
|
|
2894
2894
|
#include <tonemapping_fragment>
|
|
2895
2895
|
#include <colorspace_fragment>
|
|
2896
|
-
}`,
|
|
2896
|
+
}`,kP=`varying vec3 vWorldDirection;
|
|
2897
2897
|
#include <common>
|
|
2898
2898
|
void main() {
|
|
2899
2899
|
vWorldDirection = transformDirection( position, modelMatrix );
|
|
2900
2900
|
#include <begin_vertex>
|
|
2901
2901
|
#include <project_vertex>
|
|
2902
2902
|
gl_Position.z = gl_Position.w;
|
|
2903
|
-
}`,
|
|
2903
|
+
}`,zP=`#ifdef ENVMAP_TYPE_CUBE
|
|
2904
2904
|
uniform samplerCube envMap;
|
|
2905
2905
|
#elif defined( ENVMAP_TYPE_CUBE_UV )
|
|
2906
2906
|
uniform sampler2D envMap;
|
|
@@ -2922,14 +2922,14 @@ void main() {
|
|
|
2922
2922
|
gl_FragColor = texColor;
|
|
2923
2923
|
#include <tonemapping_fragment>
|
|
2924
2924
|
#include <colorspace_fragment>
|
|
2925
|
-
}`,
|
|
2925
|
+
}`,BP=`varying vec3 vWorldDirection;
|
|
2926
2926
|
#include <common>
|
|
2927
2927
|
void main() {
|
|
2928
2928
|
vWorldDirection = transformDirection( position, modelMatrix );
|
|
2929
2929
|
#include <begin_vertex>
|
|
2930
2930
|
#include <project_vertex>
|
|
2931
2931
|
gl_Position.z = gl_Position.w;
|
|
2932
|
-
}`,
|
|
2932
|
+
}`,HP=`uniform samplerCube tCube;
|
|
2933
2933
|
uniform float tFlip;
|
|
2934
2934
|
uniform float opacity;
|
|
2935
2935
|
varying vec3 vWorldDirection;
|
|
@@ -2939,7 +2939,7 @@ void main() {
|
|
|
2939
2939
|
gl_FragColor.a *= opacity;
|
|
2940
2940
|
#include <tonemapping_fragment>
|
|
2941
2941
|
#include <colorspace_fragment>
|
|
2942
|
-
}`,
|
|
2942
|
+
}`,VP=`#include <common>
|
|
2943
2943
|
#include <batching_pars_vertex>
|
|
2944
2944
|
#include <uv_pars_vertex>
|
|
2945
2945
|
#include <displacementmap_pars_vertex>
|
|
@@ -2966,7 +2966,7 @@ void main() {
|
|
|
2966
2966
|
#include <logdepthbuf_vertex>
|
|
2967
2967
|
#include <clipping_planes_vertex>
|
|
2968
2968
|
vHighPrecisionZW = gl_Position.zw;
|
|
2969
|
-
}`,
|
|
2969
|
+
}`,GP=`#if DEPTH_PACKING == 3200
|
|
2970
2970
|
uniform float opacity;
|
|
2971
2971
|
#endif
|
|
2972
2972
|
#include <common>
|
|
@@ -3004,7 +3004,7 @@ void main() {
|
|
|
3004
3004
|
#elif DEPTH_PACKING == 3203
|
|
3005
3005
|
gl_FragColor = vec4( packDepthToRG( fragCoordZ ), 0.0, 1.0 );
|
|
3006
3006
|
#endif
|
|
3007
|
-
}
|
|
3007
|
+
}`,$P=`#define DISTANCE
|
|
3008
3008
|
varying vec3 vWorldPosition;
|
|
3009
3009
|
#include <common>
|
|
3010
3010
|
#include <batching_pars_vertex>
|
|
@@ -3031,7 +3031,7 @@ void main() {
|
|
|
3031
3031
|
#include <worldpos_vertex>
|
|
3032
3032
|
#include <clipping_planes_vertex>
|
|
3033
3033
|
vWorldPosition = worldPosition.xyz;
|
|
3034
|
-
}`,
|
|
3034
|
+
}`,qP=`#define DISTANCE
|
|
3035
3035
|
uniform vec3 referencePosition;
|
|
3036
3036
|
uniform float nearDistance;
|
|
3037
3037
|
uniform float farDistance;
|
|
@@ -3054,13 +3054,13 @@ void main() {
|
|
|
3054
3054
|
dist = ( dist - nearDistance ) / ( farDistance - nearDistance );
|
|
3055
3055
|
dist = saturate( dist );
|
|
3056
3056
|
gl_FragColor = vec4( dist, 0.0, 0.0, 1.0 );
|
|
3057
|
-
}`,
|
|
3057
|
+
}`,WP=`varying vec3 vWorldDirection;
|
|
3058
3058
|
#include <common>
|
|
3059
3059
|
void main() {
|
|
3060
3060
|
vWorldDirection = transformDirection( position, modelMatrix );
|
|
3061
3061
|
#include <begin_vertex>
|
|
3062
3062
|
#include <project_vertex>
|
|
3063
|
-
}`,
|
|
3063
|
+
}`,ZP=`uniform sampler2D tEquirect;
|
|
3064
3064
|
varying vec3 vWorldDirection;
|
|
3065
3065
|
#include <common>
|
|
3066
3066
|
void main() {
|
|
@@ -3069,7 +3069,7 @@ void main() {
|
|
|
3069
3069
|
gl_FragColor = texture2D( tEquirect, sampleUV );
|
|
3070
3070
|
#include <tonemapping_fragment>
|
|
3071
3071
|
#include <colorspace_fragment>
|
|
3072
|
-
}
|
|
3072
|
+
}`,XP=`uniform float scale;
|
|
3073
3073
|
attribute float lineDistance;
|
|
3074
3074
|
varying float vLineDistance;
|
|
3075
3075
|
#include <common>
|
|
@@ -3091,7 +3091,7 @@ void main() {
|
|
|
3091
3091
|
#include <logdepthbuf_vertex>
|
|
3092
3092
|
#include <clipping_planes_vertex>
|
|
3093
3093
|
#include <fog_vertex>
|
|
3094
|
-
}`,
|
|
3094
|
+
}`,YP=`uniform vec3 diffuse;
|
|
3095
3095
|
uniform float opacity;
|
|
3096
3096
|
uniform float dashSize;
|
|
3097
3097
|
uniform float totalSize;
|
|
@@ -3119,7 +3119,7 @@ void main() {
|
|
|
3119
3119
|
#include <colorspace_fragment>
|
|
3120
3120
|
#include <fog_fragment>
|
|
3121
3121
|
#include <premultiplied_alpha_fragment>
|
|
3122
|
-
}`,
|
|
3122
|
+
}`,KP=`#include <common>
|
|
3123
3123
|
#include <batching_pars_vertex>
|
|
3124
3124
|
#include <uv_pars_vertex>
|
|
3125
3125
|
#include <envmap_pars_vertex>
|
|
@@ -3151,7 +3151,7 @@ void main() {
|
|
|
3151
3151
|
#include <worldpos_vertex>
|
|
3152
3152
|
#include <envmap_vertex>
|
|
3153
3153
|
#include <fog_vertex>
|
|
3154
|
-
}`,
|
|
3154
|
+
}`,jP=`uniform vec3 diffuse;
|
|
3155
3155
|
uniform float opacity;
|
|
3156
3156
|
#ifndef FLAT_SHADED
|
|
3157
3157
|
varying vec3 vNormal;
|
|
@@ -3199,7 +3199,7 @@ void main() {
|
|
|
3199
3199
|
#include <fog_fragment>
|
|
3200
3200
|
#include <premultiplied_alpha_fragment>
|
|
3201
3201
|
#include <dithering_fragment>
|
|
3202
|
-
}`,
|
|
3202
|
+
}`,JP=`#define LAMBERT
|
|
3203
3203
|
varying vec3 vViewPosition;
|
|
3204
3204
|
#include <common>
|
|
3205
3205
|
#include <batching_pars_vertex>
|
|
@@ -3238,7 +3238,7 @@ void main() {
|
|
|
3238
3238
|
#include <envmap_vertex>
|
|
3239
3239
|
#include <shadowmap_vertex>
|
|
3240
3240
|
#include <fog_vertex>
|
|
3241
|
-
}`,
|
|
3241
|
+
}`,QP=`#define LAMBERT
|
|
3242
3242
|
uniform vec3 diffuse;
|
|
3243
3243
|
uniform vec3 emissive;
|
|
3244
3244
|
uniform float opacity;
|
|
@@ -3296,7 +3296,7 @@ void main() {
|
|
|
3296
3296
|
#include <fog_fragment>
|
|
3297
3297
|
#include <premultiplied_alpha_fragment>
|
|
3298
3298
|
#include <dithering_fragment>
|
|
3299
|
-
}`,
|
|
3299
|
+
}`,e1=`#define MATCAP
|
|
3300
3300
|
varying vec3 vViewPosition;
|
|
3301
3301
|
#include <common>
|
|
3302
3302
|
#include <batching_pars_vertex>
|
|
@@ -3330,7 +3330,7 @@ void main() {
|
|
|
3330
3330
|
#include <clipping_planes_vertex>
|
|
3331
3331
|
#include <fog_vertex>
|
|
3332
3332
|
vViewPosition = - mvPosition.xyz;
|
|
3333
|
-
}`,
|
|
3333
|
+
}`,t1=`#define MATCAP
|
|
3334
3334
|
uniform vec3 diffuse;
|
|
3335
3335
|
uniform float opacity;
|
|
3336
3336
|
uniform sampler2D matcap;
|
|
@@ -3376,7 +3376,7 @@ void main() {
|
|
|
3376
3376
|
#include <fog_fragment>
|
|
3377
3377
|
#include <premultiplied_alpha_fragment>
|
|
3378
3378
|
#include <dithering_fragment>
|
|
3379
|
-
}`,
|
|
3379
|
+
}`,n1=`#define NORMAL
|
|
3380
3380
|
#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
|
|
3381
3381
|
varying vec3 vViewPosition;
|
|
3382
3382
|
#endif
|
|
@@ -3409,7 +3409,7 @@ void main() {
|
|
|
3409
3409
|
#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
|
|
3410
3410
|
vViewPosition = - mvPosition.xyz;
|
|
3411
3411
|
#endif
|
|
3412
|
-
}`,
|
|
3412
|
+
}`,i1=`#define NORMAL
|
|
3413
3413
|
uniform float opacity;
|
|
3414
3414
|
#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
|
|
3415
3415
|
varying vec3 vViewPosition;
|
|
@@ -3430,7 +3430,7 @@ void main() {
|
|
|
3430
3430
|
#ifdef OPAQUE
|
|
3431
3431
|
gl_FragColor.a = 1.0;
|
|
3432
3432
|
#endif
|
|
3433
|
-
}`,
|
|
3433
|
+
}`,s1=`#define PHONG
|
|
3434
3434
|
varying vec3 vViewPosition;
|
|
3435
3435
|
#include <common>
|
|
3436
3436
|
#include <batching_pars_vertex>
|
|
@@ -3469,7 +3469,7 @@ void main() {
|
|
|
3469
3469
|
#include <envmap_vertex>
|
|
3470
3470
|
#include <shadowmap_vertex>
|
|
3471
3471
|
#include <fog_vertex>
|
|
3472
|
-
}`,
|
|
3472
|
+
}`,r1=`#define PHONG
|
|
3473
3473
|
uniform vec3 diffuse;
|
|
3474
3474
|
uniform vec3 emissive;
|
|
3475
3475
|
uniform vec3 specular;
|
|
@@ -3529,7 +3529,7 @@ void main() {
|
|
|
3529
3529
|
#include <fog_fragment>
|
|
3530
3530
|
#include <premultiplied_alpha_fragment>
|
|
3531
3531
|
#include <dithering_fragment>
|
|
3532
|
-
}`,
|
|
3532
|
+
}`,o1=`#define STANDARD
|
|
3533
3533
|
varying vec3 vViewPosition;
|
|
3534
3534
|
#ifdef USE_TRANSMISSION
|
|
3535
3535
|
varying vec3 vWorldPosition;
|
|
@@ -3572,7 +3572,7 @@ void main() {
|
|
|
3572
3572
|
#ifdef USE_TRANSMISSION
|
|
3573
3573
|
vWorldPosition = worldPosition.xyz;
|
|
3574
3574
|
#endif
|
|
3575
|
-
}`,
|
|
3575
|
+
}`,a1=`#define STANDARD
|
|
3576
3576
|
#ifdef PHYSICAL
|
|
3577
3577
|
#define IOR
|
|
3578
3578
|
#define USE_SPECULAR
|
|
@@ -3700,7 +3700,7 @@ void main() {
|
|
|
3700
3700
|
#include <fog_fragment>
|
|
3701
3701
|
#include <premultiplied_alpha_fragment>
|
|
3702
3702
|
#include <dithering_fragment>
|
|
3703
|
-
}`,
|
|
3703
|
+
}`,c1=`#define TOON
|
|
3704
3704
|
varying vec3 vViewPosition;
|
|
3705
3705
|
#include <common>
|
|
3706
3706
|
#include <batching_pars_vertex>
|
|
@@ -3737,7 +3737,7 @@ void main() {
|
|
|
3737
3737
|
#include <worldpos_vertex>
|
|
3738
3738
|
#include <shadowmap_vertex>
|
|
3739
3739
|
#include <fog_vertex>
|
|
3740
|
-
}`,
|
|
3740
|
+
}`,l1=`#define TOON
|
|
3741
3741
|
uniform vec3 diffuse;
|
|
3742
3742
|
uniform vec3 emissive;
|
|
3743
3743
|
uniform float opacity;
|
|
@@ -3789,7 +3789,7 @@ void main() {
|
|
|
3789
3789
|
#include <fog_fragment>
|
|
3790
3790
|
#include <premultiplied_alpha_fragment>
|
|
3791
3791
|
#include <dithering_fragment>
|
|
3792
|
-
}`,
|
|
3792
|
+
}`,u1=`uniform float size;
|
|
3793
3793
|
uniform float scale;
|
|
3794
3794
|
#include <common>
|
|
3795
3795
|
#include <color_pars_vertex>
|
|
@@ -3820,7 +3820,7 @@ void main() {
|
|
|
3820
3820
|
#include <clipping_planes_vertex>
|
|
3821
3821
|
#include <worldpos_vertex>
|
|
3822
3822
|
#include <fog_vertex>
|
|
3823
|
-
}`,
|
|
3823
|
+
}`,d1=`uniform vec3 diffuse;
|
|
3824
3824
|
uniform float opacity;
|
|
3825
3825
|
#include <common>
|
|
3826
3826
|
#include <color_pars_fragment>
|
|
@@ -3845,7 +3845,7 @@ void main() {
|
|
|
3845
3845
|
#include <colorspace_fragment>
|
|
3846
3846
|
#include <fog_fragment>
|
|
3847
3847
|
#include <premultiplied_alpha_fragment>
|
|
3848
|
-
}`,
|
|
3848
|
+
}`,h1=`#include <common>
|
|
3849
3849
|
#include <batching_pars_vertex>
|
|
3850
3850
|
#include <fog_pars_vertex>
|
|
3851
3851
|
#include <morphtarget_pars_vertex>
|
|
@@ -3868,7 +3868,7 @@ void main() {
|
|
|
3868
3868
|
#include <worldpos_vertex>
|
|
3869
3869
|
#include <shadowmap_vertex>
|
|
3870
3870
|
#include <fog_vertex>
|
|
3871
|
-
}`,
|
|
3871
|
+
}`,f1=`uniform vec3 color;
|
|
3872
3872
|
uniform float opacity;
|
|
3873
3873
|
#include <common>
|
|
3874
3874
|
#include <fog_pars_fragment>
|
|
@@ -3884,7 +3884,7 @@ void main() {
|
|
|
3884
3884
|
#include <colorspace_fragment>
|
|
3885
3885
|
#include <fog_fragment>
|
|
3886
3886
|
#include <premultiplied_alpha_fragment>
|
|
3887
|
-
}`,
|
|
3887
|
+
}`,p1=`uniform float rotation;
|
|
3888
3888
|
uniform vec2 center;
|
|
3889
3889
|
#include <common>
|
|
3890
3890
|
#include <uv_pars_vertex>
|
|
@@ -3908,7 +3908,7 @@ void main() {
|
|
|
3908
3908
|
#include <logdepthbuf_vertex>
|
|
3909
3909
|
#include <clipping_planes_vertex>
|
|
3910
3910
|
#include <fog_vertex>
|
|
3911
|
-
}`,
|
|
3911
|
+
}`,m1=`uniform vec3 diffuse;
|
|
3912
3912
|
uniform float opacity;
|
|
3913
3913
|
#include <common>
|
|
3914
3914
|
#include <uv_pars_fragment>
|
|
@@ -3933,7 +3933,7 @@ void main() {
|
|
|
3933
3933
|
#include <tonemapping_fragment>
|
|
3934
3934
|
#include <colorspace_fragment>
|
|
3935
3935
|
#include <fog_fragment>
|
|
3936
|
-
}`,tt={alphahash_fragment:Nw,alphahash_pars_fragment:Dw,alphamap_fragment:Uw,alphamap_pars_fragment:Ow,alphatest_fragment:Fw,alphatest_pars_fragment:kw,aomap_fragment:zw,aomap_pars_fragment:Bw,batching_pars_vertex:Hw,batching_vertex:Vw,begin_vertex:Gw,beginnormal_vertex:qw,bsdfs:$w,iridescence_fragment:Ww,bumpmap_pars_fragment:Zw,clipping_planes_fragment:Xw,clipping_planes_pars_fragment:Yw,clipping_planes_pars_vertex:Kw,clipping_planes_vertex:jw,color_fragment:Jw,color_pars_fragment:Qw,color_pars_vertex:eA,color_vertex:tA,common:nA,cube_uv_reflection_fragment:iA,defaultnormal_vertex:sA,displacementmap_pars_vertex:rA,displacementmap_vertex:oA,emissivemap_fragment:aA,emissivemap_pars_fragment:cA,colorspace_fragment:lA,colorspace_pars_fragment:uA,envmap_fragment:dA,envmap_common_pars_fragment:hA,envmap_pars_fragment:fA,envmap_pars_vertex:pA,envmap_physical_pars_fragment:TA,envmap_vertex:mA,fog_vertex:gA,fog_pars_vertex:_A,fog_fragment:SA,fog_pars_fragment:vA,gradientmap_pars_fragment:xA,lightmap_pars_fragment:yA,lights_lambert_fragment:bA,lights_lambert_pars_fragment:MA,lights_pars_begin:EA,lights_toon_fragment:RA,lights_toon_pars_fragment:wA,lights_phong_fragment:AA,lights_phong_pars_fragment:CA,lights_physical_fragment:PA,lights_physical_pars_fragment:IA,lights_fragment_begin:LA,lights_fragment_maps:NA,lights_fragment_end:DA,lightprobes_pars_fragment:UA,logdepthbuf_fragment:OA,logdepthbuf_pars_fragment:FA,logdepthbuf_pars_vertex:kA,logdepthbuf_vertex:zA,map_fragment:BA,map_pars_fragment:HA,map_particle_fragment:VA,map_particle_pars_fragment:GA,metalnessmap_fragment:qA,metalnessmap_pars_fragment:$A,morphinstance_vertex:WA,morphcolor_vertex:ZA,morphnormal_vertex:XA,morphtarget_pars_vertex:YA,morphtarget_vertex:KA,normal_fragment_begin:jA,normal_fragment_maps:JA,normal_pars_fragment:QA,normal_pars_vertex:eC,normal_vertex:tC,normalmap_pars_fragment:nC,clearcoat_normal_fragment_begin:iC,clearcoat_normal_fragment_maps:sC,clearcoat_pars_fragment:rC,iridescence_pars_fragment:oC,opaque_fragment:aC,packing:cC,premultiplied_alpha_fragment:lC,project_vertex:uC,dithering_fragment:dC,dithering_pars_fragment:hC,roughnessmap_fragment:fC,roughnessmap_pars_fragment:pC,shadowmap_pars_fragment:mC,shadowmap_pars_vertex:gC,shadowmap_vertex:_C,shadowmask_pars_fragment:SC,skinbase_vertex:vC,skinning_pars_vertex:xC,skinning_vertex:yC,skinnormal_vertex:bC,specularmap_fragment:MC,specularmap_pars_fragment:EC,tonemapping_fragment:TC,tonemapping_pars_fragment:RC,transmission_fragment:wC,transmission_pars_fragment:AC,uv_pars_fragment:CC,uv_pars_vertex:PC,uv_vertex:IC,worldpos_vertex:LC,background_vert:NC,background_frag:DC,backgroundCube_vert:UC,backgroundCube_frag:OC,cube_vert:FC,cube_frag:kC,depth_vert:zC,depth_frag:BC,distance_vert:HC,distance_frag:VC,equirect_vert:GC,equirect_frag:qC,linedashed_vert:$C,linedashed_frag:WC,meshbasic_vert:ZC,meshbasic_frag:XC,meshlambert_vert:YC,meshlambert_frag:KC,meshmatcap_vert:jC,meshmatcap_frag:JC,meshnormal_vert:QC,meshnormal_frag:eP,meshphong_vert:tP,meshphong_frag:nP,meshphysical_vert:iP,meshphysical_frag:sP,meshtoon_vert:rP,meshtoon_frag:oP,points_vert:aP,points_frag:cP,shadow_vert:lP,shadow_frag:uP,sprite_vert:dP,sprite_frag:hP},be={common:{diffuse:{value:new ot(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new Ye},alphaMap:{value:null},alphaMapTransform:{value:new Ye},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new Ye}},envmap:{envMap:{value:null},envMapRotation:{value:new Ye},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98},dfgLUT:{value:null}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new Ye}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new Ye}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new Ye},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new Ye},normalScale:{value:new Ke(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new Ye},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new Ye}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new Ye}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new Ye}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new ot(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},sunLights:{value:[],properties:{direction:{},color:{}}},sunLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},sunShadowMatrix:{value:[]},sunShadowCascade:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null},probesSH:{value:null},probesMin:{value:new H},probesMax:{value:new H},probesResolution:{value:new H}},points:{diffuse:{value:new ot(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new Ye},alphaTest:{value:0},uvTransform:{value:new Ye}},sprite:{diffuse:{value:new ot(16777215)},opacity:{value:1},center:{value:new Ke(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new Ye},alphaMap:{value:null},alphaMapTransform:{value:new Ye},alphaTest:{value:0}}},ci={basic:{uniforms:vn([be.common,be.specularmap,be.envmap,be.aomap,be.lightmap,be.fog]),vertexShader:tt.meshbasic_vert,fragmentShader:tt.meshbasic_frag},lambert:{uniforms:vn([be.common,be.specularmap,be.envmap,be.aomap,be.lightmap,be.emissivemap,be.bumpmap,be.normalmap,be.displacementmap,be.fog,be.lights,{emissive:{value:new ot(0)},envMapIntensity:{value:1}}]),vertexShader:tt.meshlambert_vert,fragmentShader:tt.meshlambert_frag},phong:{uniforms:vn([be.common,be.specularmap,be.envmap,be.aomap,be.lightmap,be.emissivemap,be.bumpmap,be.normalmap,be.displacementmap,be.fog,be.lights,{emissive:{value:new ot(0)},specular:{value:new ot(1118481)},shininess:{value:30},envMapIntensity:{value:1}}]),vertexShader:tt.meshphong_vert,fragmentShader:tt.meshphong_frag},standard:{uniforms:vn([be.common,be.envmap,be.aomap,be.lightmap,be.emissivemap,be.bumpmap,be.normalmap,be.displacementmap,be.roughnessmap,be.metalnessmap,be.fog,be.lights,{emissive:{value:new ot(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:tt.meshphysical_vert,fragmentShader:tt.meshphysical_frag},toon:{uniforms:vn([be.common,be.aomap,be.lightmap,be.emissivemap,be.bumpmap,be.normalmap,be.displacementmap,be.gradientmap,be.fog,be.lights,{emissive:{value:new ot(0)}}]),vertexShader:tt.meshtoon_vert,fragmentShader:tt.meshtoon_frag},matcap:{uniforms:vn([be.common,be.bumpmap,be.normalmap,be.displacementmap,be.fog,{matcap:{value:null}}]),vertexShader:tt.meshmatcap_vert,fragmentShader:tt.meshmatcap_frag},points:{uniforms:vn([be.points,be.fog]),vertexShader:tt.points_vert,fragmentShader:tt.points_frag},dashed:{uniforms:vn([be.common,be.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:tt.linedashed_vert,fragmentShader:tt.linedashed_frag},depth:{uniforms:vn([be.common,be.displacementmap]),vertexShader:tt.depth_vert,fragmentShader:tt.depth_frag},normal:{uniforms:vn([be.common,be.bumpmap,be.normalmap,be.displacementmap,{opacity:{value:1}}]),vertexShader:tt.meshnormal_vert,fragmentShader:tt.meshnormal_frag},sprite:{uniforms:vn([be.sprite,be.fog]),vertexShader:tt.sprite_vert,fragmentShader:tt.sprite_frag},background:{uniforms:{uvTransform:{value:new Ye},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:tt.background_vert,fragmentShader:tt.background_frag},backgroundCube:{uniforms:{envMap:{value:null},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new Ye}},vertexShader:tt.backgroundCube_vert,fragmentShader:tt.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:tt.cube_vert,fragmentShader:tt.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:tt.equirect_vert,fragmentShader:tt.equirect_frag},distance:{uniforms:vn([be.common,be.displacementmap,{referencePosition:{value:new H},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:tt.distance_vert,fragmentShader:tt.distance_frag},shadow:{uniforms:vn([be.lights,be.fog,{color:{value:new ot(0)},opacity:{value:1}}]),vertexShader:tt.shadow_vert,fragmentShader:tt.shadow_frag}};ci.physical={uniforms:vn([ci.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new Ye},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new Ye},clearcoatNormalScale:{value:new Ke(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new Ye},dispersion:{value:0},retroreflectivity:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new Ye},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new Ye},sheen:{value:0},sheenColor:{value:new ot(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new Ye},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new Ye},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new Ye},transmissionSamplerSize:{value:new Ke},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new Ye},attenuationDistance:{value:0},attenuationColor:{value:new ot(0)},specularColor:{value:new ot(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new Ye},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new Ye},anisotropyVector:{value:new Ke},anisotropyMap:{value:null},anisotropyMapTransform:{value:new Ye}}]),vertexShader:tt.meshphysical_vert,fragmentShader:tt.meshphysical_frag};const qo={r:0,b:0,g:0},fP=new Gt,nS=new Ye;nS.set(-1,0,0,0,1,0,0,0,1);function pP(t,e,n,i,s,r){const o=new ot(0);let a=s===!0?0:1,c,l,u=null,h=0,d=null;function f(E){let L=E.isScene===!0?E.background:null;if(L&&L.isTexture){const b=E.backgroundBlurriness>0;L=e.get(L,b)}return L}function _(E){let L=!1;const b=f(E);b===null?m(o,a):b&&b.isColor&&(m(b,1),L=!0);const w=t.xr.getEnvironmentBlendMode();w==="additive"?n.buffers.color.setClear(0,0,0,1,r):w==="alpha-blend"&&n.buffers.color.setClear(0,0,0,0,r),(t.autoClear||L)&&(n.buffers.depth.setTest(!0),n.buffers.depth.setMask(!0),n.buffers.color.setMask(!0),t.clear(t.autoClearColor,t.autoClearDepth,t.autoClearStencil))}function x(E,L){const b=f(L);b&&(b.isCubeTexture||b.mapping===Ka)?(l===void 0&&(l=new ei(new ao(1,1,1),new mi({name:"BackgroundCubeMaterial",uniforms:ar(ci.backgroundCube.uniforms),vertexShader:ci.backgroundCube.vertexShader,fragmentShader:ci.backgroundCube.fragmentShader,side:Rn,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),l.geometry.deleteAttribute("normal"),l.geometry.deleteAttribute("uv"),l.onBeforeRender=function(w,A,P){this.matrixWorld.copyPosition(P.matrixWorld)},Object.defineProperty(l.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),i.update(l)),l.material.uniforms.envMap.value=b,l.material.uniforms.backgroundBlurriness.value=L.backgroundBlurriness,l.material.uniforms.backgroundIntensity.value=L.backgroundIntensity,l.material.uniforms.backgroundRotation.value.setFromMatrix4(fP.makeRotationFromEuler(L.backgroundRotation)).transpose(),b.isCubeTexture&&b.isRenderTargetTexture===!1&&l.material.uniforms.backgroundRotation.value.premultiply(nS),l.material.toneMapped=dt.getTransfer(b.colorSpace)!==Mt,(u!==b||h!==b.version||d!==t.toneMapping)&&(l.material.needsUpdate=!0,u=b,h=b.version,d=t.toneMapping),l.layers.enableAll(),E.unshift(l,l.geometry,l.material,0,0,null)):b&&b.isTexture&&(c===void 0&&(c=new ei(new ec(2,2),new mi({name:"BackgroundMaterial",uniforms:ar(ci.background.uniforms),vertexShader:ci.background.vertexShader,fragmentShader:ci.background.fragmentShader,side:vs,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),c.geometry.deleteAttribute("normal"),Object.defineProperty(c.material,"map",{get:function(){return this.uniforms.t2D.value}}),i.update(c)),c.material.uniforms.t2D.value=b,c.material.uniforms.backgroundIntensity.value=L.backgroundIntensity,c.material.toneMapped=dt.getTransfer(b.colorSpace)!==Mt,b.matrixAutoUpdate===!0&&b.updateMatrix(),c.material.uniforms.uvTransform.value.copy(b.matrix),(u!==b||h!==b.version||d!==t.toneMapping)&&(c.material.needsUpdate=!0,u=b,h=b.version,d=t.toneMapping),c.layers.enableAll(),E.unshift(c,c.geometry,c.material,0,0,null))}function m(E,L){E.getRGB(qo,J_(t)),n.buffers.color.setClear(qo.r,qo.g,qo.b,L,r)}function p(){l!==void 0&&(l.geometry.dispose(),l.material.dispose(),l=void 0),c!==void 0&&(c.geometry.dispose(),c.material.dispose(),c=void 0)}return{getClearColor:function(){return o},setClearColor:function(E,L=1){o.set(E),a=L,m(o,a)},getClearAlpha:function(){return a},setClearAlpha:function(E){a=E,m(o,a)},render:_,addToRenderList:x,dispose:p}}function mP(t,e){const n=t.getParameter(t.MAX_VERTEX_ATTRIBS),i={},s=d(null);let r=s,o=!1;function a(N,k,$,U,V){let Q=!1;const X=h(N,U,$,k);r!==X&&(r=X,l(r.object)),Q=f(N,U,$,V),Q&&_(N,U,$,V),V!==null&&e.update(V,t.ELEMENT_ARRAY_BUFFER),(Q||o)&&(o=!1,b(N,k,$,U),V!==null&&t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,e.get(V).buffer))}function c(){return t.createVertexArray()}function l(N){return t.bindVertexArray(N)}function u(N){return t.deleteVertexArray(N)}function h(N,k,$,U){const V=U.wireframe===!0;let Q=i[k.id];Q===void 0&&(Q={},i[k.id]=Q);const X=N.isInstancedMesh===!0?N.id:0;let ce=Q[X];ce===void 0&&(ce={},Q[X]=ce);let j=ce[$.id];j===void 0&&(j={},ce[$.id]=j);let se=j[V];return se===void 0&&(se=d(c()),j[V]=se),se}function d(N){const k=[],$=[],U=[];for(let V=0;V<n;V++)k[V]=0,$[V]=0,U[V]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:k,enabledAttributes:$,attributeDivisors:U,object:N,attributes:{},index:null}}function f(N,k,$,U){const V=r.attributes,Q=k.attributes;let X=0;const ce=$.getAttributes();for(const j in ce)if(ce[j].location>=0){const oe=V[j];let Fe=Q[j];if(Fe===void 0&&(j==="instanceMatrix"&&N.instanceMatrix&&(Fe=N.instanceMatrix),j==="instanceColor"&&N.instanceColor&&(Fe=N.instanceColor)),oe===void 0||oe.attribute!==Fe||Fe&&oe.data!==Fe.data)return!0;X++}return r.attributesNum!==X||r.index!==U}function _(N,k,$,U){const V={},Q=k.attributes;let X=0;const ce=$.getAttributes();for(const j in ce)if(ce[j].location>=0){let oe=Q[j];oe===void 0&&(j==="instanceMatrix"&&N.instanceMatrix&&(oe=N.instanceMatrix),j==="instanceColor"&&N.instanceColor&&(oe=N.instanceColor));const Fe={};Fe.attribute=oe,oe&&oe.data&&(Fe.data=oe.data),V[j]=Fe,X++}r.attributes=V,r.attributesNum=X,r.index=U}function x(){const N=r.newAttributes;for(let k=0,$=N.length;k<$;k++)N[k]=0}function m(N){p(N,0)}function p(N,k){const $=r.newAttributes,U=r.enabledAttributes,V=r.attributeDivisors;$[N]=1,U[N]===0&&(t.enableVertexAttribArray(N),U[N]=1),V[N]!==k&&(t.vertexAttribDivisor(N,k),V[N]=k)}function E(){const N=r.newAttributes,k=r.enabledAttributes;for(let $=0,U=k.length;$<U;$++)k[$]!==N[$]&&(t.disableVertexAttribArray($),k[$]=0)}function L(N,k,$,U,V,Q,X){X===!0?t.vertexAttribIPointer(N,k,$,V,Q):t.vertexAttribPointer(N,k,$,U,V,Q)}function b(N,k,$,U){x();const V=U.attributes,Q=$.getAttributes(),X=k.defaultAttributeValues;for(const ce in Q){const j=Q[ce];if(j.location>=0){let se=V[ce];if(se===void 0&&(ce==="instanceMatrix"&&N.instanceMatrix&&(se=N.instanceMatrix),ce==="instanceColor"&&N.instanceColor&&(se=N.instanceColor)),se!==void 0){const oe=se.normalized,Fe=se.itemSize,Le=e.get(se);if(Le===void 0)continue;const ft=Le.buffer,et=Le.type,je=Le.bytesPerElement,Y=et===t.INT||et===t.UNSIGNED_INT||se.gpuType===ld;if(se.isInterleavedBufferAttribute){const re=se.data,Re=re.stride,Ve=se.offset;if(re.isInstancedInterleavedBuffer){for(let Me=0;Me<j.locationSize;Me++)p(j.location+Me,re.meshPerAttribute);N.isInstancedMesh!==!0&&U._maxInstanceCount===void 0&&(U._maxInstanceCount=re.meshPerAttribute*re.count)}else for(let Me=0;Me<j.locationSize;Me++)m(j.location+Me);t.bindBuffer(t.ARRAY_BUFFER,ft);for(let Me=0;Me<j.locationSize;Me++)L(j.location+Me,Fe/j.locationSize,et,oe,Re*je,(Ve+Fe/j.locationSize*Me)*je,Y)}else{if(se.isInstancedBufferAttribute){for(let re=0;re<j.locationSize;re++)p(j.location+re,se.meshPerAttribute);N.isInstancedMesh!==!0&&U._maxInstanceCount===void 0&&(U._maxInstanceCount=se.meshPerAttribute*se.count)}else for(let re=0;re<j.locationSize;re++)m(j.location+re);t.bindBuffer(t.ARRAY_BUFFER,ft);for(let re=0;re<j.locationSize;re++)L(j.location+re,Fe/j.locationSize,et,oe,Fe*je,Fe/j.locationSize*re*je,Y)}}else if(X!==void 0){const oe=X[ce];if(oe!==void 0)switch(oe.length){case 2:t.vertexAttrib2fv(j.location,oe);break;case 3:t.vertexAttrib3fv(j.location,oe);break;case 4:t.vertexAttrib4fv(j.location,oe);break;default:t.vertexAttrib1fv(j.location,oe)}}}}E()}function w(){T();for(const N in i){const k=i[N];for(const $ in k){const U=k[$];for(const V in U){const Q=U[V];for(const X in Q)u(Q[X].object),delete Q[X];delete U[V]}}delete i[N]}}function A(N){if(i[N.id]===void 0)return;const k=i[N.id];for(const $ in k){const U=k[$];for(const V in U){const Q=U[V];for(const X in Q)u(Q[X].object),delete Q[X];delete U[V]}}delete i[N.id]}function P(N){for(const k in i){const $=i[k];for(const U in $){const V=$[U];if(V[N.id]===void 0)continue;const Q=V[N.id];for(const X in Q)u(Q[X].object),delete Q[X];delete V[N.id]}}}function v(N){for(const k in i){const $=i[k],U=N.isInstancedMesh===!0?N.id:0,V=$[U];if(V!==void 0){for(const Q in V){const X=V[Q];for(const ce in X)u(X[ce].object),delete X[ce];delete V[Q]}delete $[U],Object.keys($).length===0&&delete i[k]}}}function T(){I(),o=!0,r!==s&&(r=s,l(r.object))}function I(){s.geometry=null,s.program=null,s.wireframe=!1}return{setup:a,reset:T,resetDefaultState:I,dispose:w,releaseStatesOfGeometry:A,releaseStatesOfObject:v,releaseStatesOfProgram:P,initAttributes:x,enableAttribute:m,disableUnusedAttributes:E}}function gP(t,e,n){let i;function s(c){i=c}function r(c,l){t.drawArrays(i,c,l),n.update(l,i,1)}function o(c,l,u){u!==0&&(t.drawArraysInstanced(i,c,l,u),n.update(l,i,u))}function a(c,l,u){if(u===0)return;e.get("WEBGL_multi_draw").multiDrawArraysWEBGL(i,c,0,l,0,u);let d=0;for(let f=0;f<u;f++)d+=l[f];n.update(d,i,1)}this.setMode=s,this.render=r,this.renderInstances=o,this.renderMultiDraw=a}function _P(t,e,n,i){let s;function r(){if(s!==void 0)return s;if(e.has("EXT_texture_filter_anisotropic")===!0){const P=e.get("EXT_texture_filter_anisotropic");s=t.getParameter(P.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else s=0;return s}function o(P){return!(P!==Yn&&i.convert(P)!==t.getParameter(t.IMPLEMENTATION_COLOR_READ_FORMAT))}function a(P){const v=P===pi&&(e.has("EXT_color_buffer_half_float")||e.has("EXT_color_buffer_float"));return!(P!==Hn&&P!==ui&&!v&&i.convert(P)!==t.getParameter(t.IMPLEMENTATION_COLOR_READ_TYPE))}function c(P){if(P==="highp"){if(t.getShaderPrecisionFormat(t.VERTEX_SHADER,t.HIGH_FLOAT).precision>0&&t.getShaderPrecisionFormat(t.FRAGMENT_SHADER,t.HIGH_FLOAT).precision>0)return"highp";P="mediump"}return P==="mediump"&&t.getShaderPrecisionFormat(t.VERTEX_SHADER,t.MEDIUM_FLOAT).precision>0&&t.getShaderPrecisionFormat(t.FRAGMENT_SHADER,t.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}let l=n.precision!==void 0?n.precision:"highp";const u=c(l);u!==l&&(Ge("WebGLRenderer:",l,"not supported, using",u,"instead."),l=u);const h=n.logarithmicDepthBuffer===!0,d=n.reversedDepthBuffer===!0&&e.has("EXT_clip_control");n.reversedDepthBuffer===!0&&d===!1&&Ge("WebGLRenderer: Unable to use reversed depth buffer due to missing EXT_clip_control extension. Fallback to default depth buffer.");const f=t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS),_=t.getParameter(t.MAX_VERTEX_TEXTURE_IMAGE_UNITS),x=t.getParameter(t.MAX_TEXTURE_SIZE),m=t.getParameter(t.MAX_CUBE_MAP_TEXTURE_SIZE),p=t.getParameter(t.MAX_VERTEX_ATTRIBS),E=t.getParameter(t.MAX_VERTEX_UNIFORM_VECTORS),L=t.getParameter(t.MAX_VARYING_VECTORS),b=t.getParameter(t.MAX_FRAGMENT_UNIFORM_VECTORS),w=t.getParameter(t.MAX_SAMPLES),A=t.getParameter(t.SAMPLES);return{isWebGL2:!0,getMaxAnisotropy:r,getMaxPrecision:c,textureFormatReadable:o,textureTypeReadable:a,precision:l,logarithmicDepthBuffer:h,reversedDepthBuffer:d,maxTextures:f,maxVertexTextures:_,maxTextureSize:x,maxCubemapSize:m,maxAttributes:p,maxVertexUniforms:E,maxVaryings:L,maxFragmentUniforms:b,maxSamples:w,samples:A}}function SP(t){const e=this;let n=null,i=0,s=!1,r=!1;const o=new Ri,a=new Ye,c={value:null,needsUpdate:!1};this.uniform=c,this.numPlanes=0,this.numIntersection=0,this.init=function(h,d){const f=h.length!==0||d||i!==0||s;return s=d,i=h.length,f},this.beginShadows=function(){r=!0,u(null)},this.endShadows=function(){r=!1},this.setGlobalState=function(h,d){n=u(h,d,0)},this.setState=function(h,d,f){const _=h.clippingPlanes,x=h.clipIntersection,m=h.clipShadows,p=t.get(h);if(!s||_===null||_.length===0||r&&!m)r?u(null):l();else{const E=r?0:i,L=E*4;let b=p.clippingState||null;c.value=b,b=u(_,d,L,f);for(let w=0;w!==L;++w)b[w]=n[w];p.clippingState=b,this.numIntersection=x?this.numPlanes:0,this.numPlanes+=E}};function l(){c.value!==n&&(c.value=n,c.needsUpdate=i>0),e.numPlanes=i,e.numIntersection=0}function u(h,d,f,_){const x=h!==null?h.length:0;let m=null;if(x!==0){if(m=c.value,_!==!0||m===null){const p=f+x*4,E=d.matrixWorldInverse;a.getNormalMatrix(E),(m===null||m.length<p)&&(m=new Float32Array(p));for(let L=0,b=f;L!==x;++L,b+=4)o.copy(h[L]).applyMatrix4(E,a),o.normal.toArray(m,b),m[b+3]=o.constant}c.value=m,c.needsUpdate=!0}return e.numPlanes=x,e.numIntersection=0,m}}const $s=4,vP=6,xP=20,yP=256,wr=new eS,df=new ot;let qc=null,$c=0,Wc=0,Zc=!1;const bP=new H,ls=new H;class hf{constructor(e){this._renderer=e,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._sizeLods=[],this._lodMeshes=[],this._backgroundBox=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._blurMaterial=null,this._ggxMaterial=null}fromScene(e,n=0,i=.1,s=100,r={}){const{size:o=256,position:a=bP}=r;qc=this._renderer.getRenderTarget(),$c=this._renderer.getActiveCubeFace(),Wc=this._renderer.getActiveMipmapLevel(),Zc=this._renderer.xr.enabled,this._renderer.xr.enabled=!1,this._setSize(o);const c=this._allocateTargets();return c.depthBuffer=!0,this._sceneToCubeUV(e,i,s,c,a),n>0&&this._blur(c,0,0,n),this._applyPMREM(c),this._cleanup(c),c}fromEquirectangular(e,n=null){return this._fromTexture(e,n)}fromCubemap(e,n=null){return this._fromTexture(e,n)}compileCubemapShader(){this._cubemapMaterial===null&&(this._cubemapMaterial=mf(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=pf(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),this._cubemapMaterial!==null&&this._cubemapMaterial.dispose(),this._equirectMaterial!==null&&this._equirectMaterial.dispose(),this._backgroundBox!==null&&(this._backgroundBox.geometry.dispose(),this._backgroundBox.material.dispose())}_setSize(e){this._lodMax=Math.floor(Math.log2(e)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){this._blurMaterial!==null&&this._blurMaterial.dispose(),this._ggxMaterial!==null&&this._ggxMaterial.dispose(),this._pingPongRenderTarget!==null&&this._pingPongRenderTarget.dispose();for(let e=0;e<this._lodMeshes.length;e++)this._lodMeshes[e].geometry.dispose()}_cleanup(e){this._renderer.setRenderTarget(qc,$c,Wc),this._renderer.xr.enabled=Zc,e.scissorTest=!1,Bs(e,0,0,e.width,e.height)}_fromTexture(e,n){e.mapping===xs||e.mapping===or?this._setSize(e.image.length===0?16:e.image[0].width||e.image[0].image.width):this._setSize(e.image.width/4),qc=this._renderer.getRenderTarget(),$c=this._renderer.getActiveCubeFace(),Wc=this._renderer.getActiveMipmapLevel(),Zc=this._renderer.xr.enabled,this._renderer.xr.enabled=!1;const i=n||this._allocateTargets();return this._textureToCubeUV(e,i),this._applyPMREM(i),this._cleanup(i),i}_allocateTargets(){const e=3*Math.max(this._cubeSize,112),n=4*this._cubeSize,i={magFilter:pn,minFilter:pn,generateMipmaps:!1,type:pi,format:Yn,colorSpace:_a,depthBuffer:!1},s=ff(e,n,i);if(this._pingPongRenderTarget===null||this._pingPongRenderTarget.width!==e||this._pingPongRenderTarget.height!==n){this._pingPongRenderTarget!==null&&this._dispose(),this._pingPongRenderTarget=ff(e,n,i);const{_lodMax:r}=this;({lodMeshes:this._lodMeshes,sizeLods:this._sizeLods}=MP(r)),this._blurMaterial=TP(r,e,n),this._ggxMaterial=EP(r,e,n)}return s}_compileMaterial(e){const n=new ei(new Mn,e);this._renderer.compile(n,wr)}_sceneToCubeUV(e,n,i,s,r){const c=new zn(90,1,n,i),l=[1,-1,1,1,1,1],u=[1,1,1,-1,-1,-1],h=this._renderer,d=h.autoClear,f=h.toneMapping;h.getClearColor(df),h.toneMapping=hi,h.autoClear=!1,h.state.buffers.depth.getReversed()&&(h.setRenderTarget(s),h.clearDepth(),h.setRenderTarget(null)),this._backgroundBox===null&&(this._backgroundBox=new ei(new ao,new Ja({name:"PMREM.Background",side:Rn,depthWrite:!1,depthTest:!1})));const x=this._backgroundBox,m=x.material;let p=!1;const E=e.background;E?E.isColor&&(m.color.copy(E),e.background=null,p=!0):(m.color.copy(df),p=!0);for(let L=0;L<6;L++){const b=L%3;b===0?(c.up.set(0,l[L],0),c.position.set(r.x,r.y,r.z),c.lookAt(r.x+u[L],r.y,r.z)):b===1?(c.up.set(0,0,l[L]),c.position.set(r.x,r.y,r.z),c.lookAt(r.x,r.y+u[L],r.z)):(c.up.set(0,l[L],0),c.position.set(r.x,r.y,r.z),c.lookAt(r.x,r.y,r.z+u[L]));const w=this._cubeSize;Bs(s,b*w,L>2?w:0,w,w),h.setRenderTarget(s),p&&h.render(x,c),h.render(e,c)}h.toneMapping=f,h.autoClear=d,e.background=E}_textureToCubeUV(e,n){const i=this._renderer,s=e.mapping===xs||e.mapping===or;s?(this._cubemapMaterial===null&&(this._cubemapMaterial=mf()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=pf());const r=s?this._cubemapMaterial:this._equirectMaterial,o=this._lodMeshes[0];o.material=r;const a=r.uniforms;a.envMap.value=e;const c=this._cubeSize;Bs(n,0,0,3*c,2*c),i.setRenderTarget(n),i.render(o,wr)}_applyPMREM(e){const n=this._renderer,i=n.autoClear;n.autoClear=!1;const s=this._lodMeshes.length;for(let r=1;r<s;r++)this._applyGGXFilter(e,r-1,r);n.autoClear=i}_applyGGXFilter(e,n,i){const s=this._renderer,r=this._pingPongRenderTarget,o=this._ggxMaterial,a=this._lodMeshes[i];a.material=o;const c=o.uniforms,l=i/(this._lodMeshes.length-1),u=n/(this._lodMeshes.length-1),h=Math.sqrt(l*l-u*u),d=l*1.25,f=h*d,{_lodMax:_}=this,x=this._sizeLods[i],m=3*x*(i>_-$s?i-_+$s:0),p=4*(this._cubeSize-x);c.envMap.value=e.texture,c.roughness.value=f,c.mipInt.value=_-n,Bs(r,m,p,3*x,2*x),s.setRenderTarget(r),s.render(a,wr),c.envMap.value=r.texture,c.roughness.value=0,c.mipInt.value=_-i,Bs(e,m,p,3*x,2*x),s.setRenderTarget(e),s.render(a,wr)}_blur(e,n,i,s){const r=this._pingPongRenderTarget,o=Math.min(s,Math.PI)/Math.SQRT2;this._blurPass(e,r,n,i,o),this._blurPass(r,e,i,i,o)}_blurPass(e,n,i,s,r){const o=this._renderer,a=this._blurMaterial,c=this._lodMeshes[s];c.material=a;const l=a.uniforms;l.envMap.value=e.texture,l.sigma.value=r,l.mipInt.value=this._lodMax-i;const u=this._sizeLods[s],h=3*u*(s>this._lodMax-$s?s-this._lodMax+$s:0),d=4*(this._cubeSize-u);Bs(n,h,d,3*u,2*u),o.setRenderTarget(n),o.render(c,wr)}}function MP(t){const e=[],n=[];let i=t;const s=t-$s+1+vP;for(let r=0;r<s;r++){const o=Math.pow(2,i);e.push(o);const a=1/(o-2),c=-a,l=1+a,u=[c,c,l,c,l,l,c,c,l,l,c,l],h=6,d=6,f=3,_=new Float32Array(f*d*h),x=new Float32Array(f*d*h);for(let p=0;p<h;p++){const E=p%3*2/3-1,L=p>2?0:-1,b=[E,L,0,E+2/3,L,0,E+2/3,L+1,0,E,L,0,E+2/3,L+1,0,E,L+1,0];_.set(b,f*d*p);for(let w=0;w<d;w++){const A=u[w*2]*2-1,P=u[w*2+1]*2-1;p===0?ls.set(1,P,A):p===1?ls.set(-A,1,-P):p===2?ls.set(-A,P,1):p===3?ls.set(-1,P,-A):p===4?ls.set(-A,-1,P):ls.set(A,P,-1),ls.toArray(x,(p*d+w)*f)}}const m=new Mn;m.setAttribute("position",new jn(_,f)),m.setAttribute("outputDirection",new jn(x,f)),n.push(new ei(m,null)),i>$s&&i--}return{lodMeshes:n,sizeLods:e}}function ff(t,e,n){const i=new Kn(t,e,n);return i.texture.mapping=Ka,i.texture.name="PMREM.cubeUv",i.scissorTest=!0,i}function Bs(t,e,n,i,s){t.viewport.set(e,n,i,s),t.scissor.set(e,n,i,s)}function EP(t,e,n){return new mi({name:"PMREMGGXConvolution",defines:{GGX_SAMPLES:yP,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/n,CUBEUV_MAX_MIP:`${t}.0`},uniforms:{envMap:{value:null},roughness:{value:0},mipInt:{value:0}},vertexShader:tc(),fragmentShader:`
|
|
3936
|
+
}`,nt={alphahash_fragment:OA,alphahash_pars_fragment:FA,alphamap_fragment:kA,alphamap_pars_fragment:zA,alphatest_fragment:BA,alphatest_pars_fragment:HA,aomap_fragment:VA,aomap_pars_fragment:GA,batching_pars_vertex:$A,batching_vertex:qA,begin_vertex:WA,beginnormal_vertex:ZA,bsdfs:XA,iridescence_fragment:YA,bumpmap_pars_fragment:KA,clipping_planes_fragment:jA,clipping_planes_pars_fragment:JA,clipping_planes_pars_vertex:QA,clipping_planes_vertex:eC,color_fragment:tC,color_pars_fragment:nC,color_pars_vertex:iC,color_vertex:sC,common:rC,cube_uv_reflection_fragment:oC,defaultnormal_vertex:aC,displacementmap_pars_vertex:cC,displacementmap_vertex:lC,emissivemap_fragment:uC,emissivemap_pars_fragment:dC,colorspace_fragment:hC,colorspace_pars_fragment:fC,envmap_fragment:pC,envmap_common_pars_fragment:mC,envmap_pars_fragment:gC,envmap_pars_vertex:_C,envmap_physical_pars_fragment:AC,envmap_vertex:SC,fog_vertex:vC,fog_pars_vertex:xC,fog_fragment:yC,fog_pars_fragment:bC,gradientmap_pars_fragment:MC,lightmap_pars_fragment:EC,lights_lambert_fragment:TC,lights_lambert_pars_fragment:RC,lights_pars_begin:wC,lights_toon_fragment:CC,lights_toon_pars_fragment:PC,lights_phong_fragment:LC,lights_phong_pars_fragment:IC,lights_physical_fragment:NC,lights_physical_pars_fragment:DC,lights_fragment_begin:UC,lights_fragment_maps:OC,lights_fragment_end:FC,lightprobes_pars_fragment:kC,logdepthbuf_fragment:zC,logdepthbuf_pars_fragment:BC,logdepthbuf_pars_vertex:HC,logdepthbuf_vertex:VC,map_fragment:GC,map_pars_fragment:$C,map_particle_fragment:qC,map_particle_pars_fragment:WC,metalnessmap_fragment:ZC,metalnessmap_pars_fragment:XC,morphinstance_vertex:YC,morphcolor_vertex:KC,morphnormal_vertex:jC,morphtarget_pars_vertex:JC,morphtarget_vertex:QC,normal_fragment_begin:eP,normal_fragment_maps:tP,normal_pars_fragment:nP,normal_pars_vertex:iP,normal_vertex:sP,normalmap_pars_fragment:rP,clearcoat_normal_fragment_begin:oP,clearcoat_normal_fragment_maps:aP,clearcoat_pars_fragment:cP,iridescence_pars_fragment:lP,opaque_fragment:uP,packing:dP,premultiplied_alpha_fragment:hP,project_vertex:fP,dithering_fragment:pP,dithering_pars_fragment:mP,roughnessmap_fragment:gP,roughnessmap_pars_fragment:_P,shadowmap_pars_fragment:SP,shadowmap_pars_vertex:vP,shadowmap_vertex:xP,shadowmask_pars_fragment:yP,skinbase_vertex:bP,skinning_pars_vertex:MP,skinning_vertex:EP,skinnormal_vertex:TP,specularmap_fragment:RP,specularmap_pars_fragment:wP,tonemapping_fragment:AP,tonemapping_pars_fragment:CP,transmission_fragment:PP,transmission_pars_fragment:LP,uv_pars_fragment:IP,uv_pars_vertex:NP,uv_vertex:DP,worldpos_vertex:UP,background_vert:OP,background_frag:FP,backgroundCube_vert:kP,backgroundCube_frag:zP,cube_vert:BP,cube_frag:HP,depth_vert:VP,depth_frag:GP,distance_vert:$P,distance_frag:qP,equirect_vert:WP,equirect_frag:ZP,linedashed_vert:XP,linedashed_frag:YP,meshbasic_vert:KP,meshbasic_frag:jP,meshlambert_vert:JP,meshlambert_frag:QP,meshmatcap_vert:e1,meshmatcap_frag:t1,meshnormal_vert:n1,meshnormal_frag:i1,meshphong_vert:s1,meshphong_frag:r1,meshphysical_vert:o1,meshphysical_frag:a1,meshtoon_vert:c1,meshtoon_frag:l1,points_vert:u1,points_frag:d1,shadow_vert:h1,shadow_frag:f1,sprite_vert:p1,sprite_frag:m1},be={common:{diffuse:{value:new at(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new Ke},alphaMap:{value:null},alphaMapTransform:{value:new Ke},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new Ke}},envmap:{envMap:{value:null},envMapRotation:{value:new Ke},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98},dfgLUT:{value:null}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new Ke}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new Ke}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new Ke},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new Ke},normalScale:{value:new je(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new Ke},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new Ke}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new Ke}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new Ke}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new at(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},sunLights:{value:[],properties:{direction:{},color:{}}},sunLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},sunShadowMatrix:{value:[]},sunShadowCascade:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null},probesSH:{value:null},probesMin:{value:new H},probesMax:{value:new H},probesResolution:{value:new H}},points:{diffuse:{value:new at(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new Ke},alphaTest:{value:0},uvTransform:{value:new Ke}},sprite:{diffuse:{value:new at(16777215)},opacity:{value:1},center:{value:new je(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new Ke},alphaMap:{value:null},alphaMapTransform:{value:new Ke},alphaTest:{value:0}}},fi={basic:{uniforms:bn([be.common,be.specularmap,be.envmap,be.aomap,be.lightmap,be.fog]),vertexShader:nt.meshbasic_vert,fragmentShader:nt.meshbasic_frag},lambert:{uniforms:bn([be.common,be.specularmap,be.envmap,be.aomap,be.lightmap,be.emissivemap,be.bumpmap,be.normalmap,be.displacementmap,be.fog,be.lights,{emissive:{value:new at(0)},envMapIntensity:{value:1}}]),vertexShader:nt.meshlambert_vert,fragmentShader:nt.meshlambert_frag},phong:{uniforms:bn([be.common,be.specularmap,be.envmap,be.aomap,be.lightmap,be.emissivemap,be.bumpmap,be.normalmap,be.displacementmap,be.fog,be.lights,{emissive:{value:new at(0)},specular:{value:new at(1118481)},shininess:{value:30},envMapIntensity:{value:1}}]),vertexShader:nt.meshphong_vert,fragmentShader:nt.meshphong_frag},standard:{uniforms:bn([be.common,be.envmap,be.aomap,be.lightmap,be.emissivemap,be.bumpmap,be.normalmap,be.displacementmap,be.roughnessmap,be.metalnessmap,be.fog,be.lights,{emissive:{value:new at(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:nt.meshphysical_vert,fragmentShader:nt.meshphysical_frag},toon:{uniforms:bn([be.common,be.aomap,be.lightmap,be.emissivemap,be.bumpmap,be.normalmap,be.displacementmap,be.gradientmap,be.fog,be.lights,{emissive:{value:new at(0)}}]),vertexShader:nt.meshtoon_vert,fragmentShader:nt.meshtoon_frag},matcap:{uniforms:bn([be.common,be.bumpmap,be.normalmap,be.displacementmap,be.fog,{matcap:{value:null}}]),vertexShader:nt.meshmatcap_vert,fragmentShader:nt.meshmatcap_frag},points:{uniforms:bn([be.points,be.fog]),vertexShader:nt.points_vert,fragmentShader:nt.points_frag},dashed:{uniforms:bn([be.common,be.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:nt.linedashed_vert,fragmentShader:nt.linedashed_frag},depth:{uniforms:bn([be.common,be.displacementmap]),vertexShader:nt.depth_vert,fragmentShader:nt.depth_frag},normal:{uniforms:bn([be.common,be.bumpmap,be.normalmap,be.displacementmap,{opacity:{value:1}}]),vertexShader:nt.meshnormal_vert,fragmentShader:nt.meshnormal_frag},sprite:{uniforms:bn([be.sprite,be.fog]),vertexShader:nt.sprite_vert,fragmentShader:nt.sprite_frag},background:{uniforms:{uvTransform:{value:new Ke},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:nt.background_vert,fragmentShader:nt.background_frag},backgroundCube:{uniforms:{envMap:{value:null},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new Ke}},vertexShader:nt.backgroundCube_vert,fragmentShader:nt.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:nt.cube_vert,fragmentShader:nt.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:nt.equirect_vert,fragmentShader:nt.equirect_frag},distance:{uniforms:bn([be.common,be.displacementmap,{referencePosition:{value:new H},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:nt.distance_vert,fragmentShader:nt.distance_frag},shadow:{uniforms:bn([be.lights,be.fog,{color:{value:new at(0)},opacity:{value:1}}]),vertexShader:nt.shadow_vert,fragmentShader:nt.shadow_frag}};fi.physical={uniforms:bn([fi.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new Ke},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new Ke},clearcoatNormalScale:{value:new je(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new Ke},dispersion:{value:0},retroreflectivity:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new Ke},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new Ke},sheen:{value:0},sheenColor:{value:new at(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new Ke},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new Ke},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new Ke},transmissionSamplerSize:{value:new je},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new Ke},attenuationDistance:{value:0},attenuationColor:{value:new at(0)},specularColor:{value:new at(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new Ke},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new Ke},anisotropyVector:{value:new je},anisotropyMap:{value:null},anisotropyMapTransform:{value:new Ke}}]),vertexShader:nt.meshphysical_vert,fragmentShader:nt.meshphysical_frag};const ea={r:0,b:0,g:0},g1=new $t,GS=new Ke;GS.set(-1,0,0,0,1,0,0,0,1);function _1(t,e,n,i,s,r){const o=new at(0);let a=s===!0?0:1,c,l,u=null,h=0,d=null;function f(E){let I=E.isScene===!0?E.background:null;if(I&&I.isTexture){const b=E.backgroundBlurriness>0;I=e.get(I,b)}return I}function _(E){let I=!1;const b=f(E);b===null?m(o,a):b&&b.isColor&&(m(b,1),I=!0);const w=t.xr.getEnvironmentBlendMode();w==="additive"?n.buffers.color.setClear(0,0,0,1,r):w==="alpha-blend"&&n.buffers.color.setClear(0,0,0,0,r),(t.autoClear||I)&&(n.buffers.depth.setTest(!0),n.buffers.depth.setMask(!0),n.buffers.color.setMask(!0),t.clear(t.autoClearColor,t.autoClearDepth,t.autoClearStencil))}function x(E,I){const b=f(I);b&&(b.isCubeTexture||b.mapping===lc)?(l===void 0&&(l=new si(new So(1,1,1),new yi({name:"BackgroundCubeMaterial",uniforms:xr(fi.backgroundCube.uniforms),vertexShader:fi.backgroundCube.vertexShader,fragmentShader:fi.backgroundCube.fragmentShader,side:Cn,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),l.geometry.deleteAttribute("normal"),l.geometry.deleteAttribute("uv"),l.onBeforeRender=function(w,A,P){this.matrixWorld.copyPosition(P.matrixWorld)},Object.defineProperty(l.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),i.update(l)),l.material.uniforms.envMap.value=b,l.material.uniforms.backgroundBlurriness.value=I.backgroundBlurriness,l.material.uniforms.backgroundIntensity.value=I.backgroundIntensity,l.material.uniforms.backgroundRotation.value.setFromMatrix4(g1.makeRotationFromEuler(I.backgroundRotation)).transpose(),b.isCubeTexture&&b.isRenderTargetTexture===!1&&l.material.uniforms.backgroundRotation.value.premultiply(GS),l.material.toneMapped=ft.getTransfer(b.colorSpace)!==Et,(u!==b||h!==b.version||d!==t.toneMapping)&&(l.material.needsUpdate=!0,u=b,h=b.version,d=t.toneMapping),l.layers.enableAll(),E.unshift(l,l.geometry,l.material,0,0,null)):b&&b.isTexture&&(c===void 0&&(c=new si(new fc(2,2),new yi({name:"BackgroundMaterial",uniforms:xr(fi.background.uniforms),vertexShader:fi.background.vertexShader,fragmentShader:fi.background.fragmentShader,side:As,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),c.geometry.deleteAttribute("normal"),Object.defineProperty(c.material,"map",{get:function(){return this.uniforms.t2D.value}}),i.update(c)),c.material.uniforms.t2D.value=b,c.material.uniforms.backgroundIntensity.value=I.backgroundIntensity,c.material.toneMapped=ft.getTransfer(b.colorSpace)!==Et,b.matrixAutoUpdate===!0&&b.updateMatrix(),c.material.uniforms.uvTransform.value.copy(b.matrix),(u!==b||h!==b.version||d!==t.toneMapping)&&(c.material.needsUpdate=!0,u=b,h=b.version,d=t.toneMapping),c.layers.enableAll(),E.unshift(c,c.geometry,c.material,0,0,null))}function m(E,I){E.getRGB(ea,kS(t)),n.buffers.color.setClear(ea.r,ea.g,ea.b,I,r)}function p(){l!==void 0&&(l.geometry.dispose(),l.material.dispose(),l=void 0),c!==void 0&&(c.geometry.dispose(),c.material.dispose(),c=void 0)}return{getClearColor:function(){return o},setClearColor:function(E,I=1){o.set(E),a=I,m(o,a)},getClearAlpha:function(){return a},setClearAlpha:function(E){a=E,m(o,a)},render:_,addToRenderList:x,dispose:p}}function S1(t,e){const n=t.getParameter(t.MAX_VERTEX_ATTRIBS),i={},s=d(null);let r=s,o=!1;function a(N,k,q,U,V){let Q=!1;const X=h(N,U,q,k);r!==X&&(r=X,l(r.object)),Q=f(N,U,q,V),Q&&_(N,U,q,V),V!==null&&e.update(V,t.ELEMENT_ARRAY_BUFFER),(Q||o)&&(o=!1,b(N,k,q,U),V!==null&&t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,e.get(V).buffer))}function c(){return t.createVertexArray()}function l(N){return t.bindVertexArray(N)}function u(N){return t.deleteVertexArray(N)}function h(N,k,q,U){const V=U.wireframe===!0;let Q=i[k.id];Q===void 0&&(Q={},i[k.id]=Q);const X=N.isInstancedMesh===!0?N.id:0;let ce=Q[X];ce===void 0&&(ce={},Q[X]=ce);let j=ce[q.id];j===void 0&&(j={},ce[q.id]=j);let se=j[V];return se===void 0&&(se=d(c()),j[V]=se),se}function d(N){const k=[],q=[],U=[];for(let V=0;V<n;V++)k[V]=0,q[V]=0,U[V]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:k,enabledAttributes:q,attributeDivisors:U,object:N,attributes:{},index:null}}function f(N,k,q,U){const V=r.attributes,Q=k.attributes;let X=0;const ce=q.getAttributes();for(const j in ce)if(ce[j].location>=0){const oe=V[j];let Fe=Q[j];if(Fe===void 0&&(j==="instanceMatrix"&&N.instanceMatrix&&(Fe=N.instanceMatrix),j==="instanceColor"&&N.instanceColor&&(Fe=N.instanceColor)),oe===void 0||oe.attribute!==Fe||Fe&&oe.data!==Fe.data)return!0;X++}return r.attributesNum!==X||r.index!==U}function _(N,k,q,U){const V={},Q=k.attributes;let X=0;const ce=q.getAttributes();for(const j in ce)if(ce[j].location>=0){let oe=Q[j];oe===void 0&&(j==="instanceMatrix"&&N.instanceMatrix&&(oe=N.instanceMatrix),j==="instanceColor"&&N.instanceColor&&(oe=N.instanceColor));const Fe={};Fe.attribute=oe,oe&&oe.data&&(Fe.data=oe.data),V[j]=Fe,X++}r.attributes=V,r.attributesNum=X,r.index=U}function x(){const N=r.newAttributes;for(let k=0,q=N.length;k<q;k++)N[k]=0}function m(N){p(N,0)}function p(N,k){const q=r.newAttributes,U=r.enabledAttributes,V=r.attributeDivisors;q[N]=1,U[N]===0&&(t.enableVertexAttribArray(N),U[N]=1),V[N]!==k&&(t.vertexAttribDivisor(N,k),V[N]=k)}function E(){const N=r.newAttributes,k=r.enabledAttributes;for(let q=0,U=k.length;q<U;q++)k[q]!==N[q]&&(t.disableVertexAttribArray(q),k[q]=0)}function I(N,k,q,U,V,Q,X){X===!0?t.vertexAttribIPointer(N,k,q,V,Q):t.vertexAttribPointer(N,k,q,U,V,Q)}function b(N,k,q,U){x();const V=U.attributes,Q=q.getAttributes(),X=k.defaultAttributeValues;for(const ce in Q){const j=Q[ce];if(j.location>=0){let se=V[ce];if(se===void 0&&(ce==="instanceMatrix"&&N.instanceMatrix&&(se=N.instanceMatrix),ce==="instanceColor"&&N.instanceColor&&(se=N.instanceColor)),se!==void 0){const oe=se.normalized,Fe=se.itemSize,Ie=e.get(se);if(Ie===void 0)continue;const mt=Ie.buffer,tt=Ie.type,Je=Ie.bytesPerElement,Y=tt===t.INT||tt===t.UNSIGNED_INT||se.gpuType===Dd;if(se.isInterleavedBufferAttribute){const re=se.data,Re=re.stride,Ge=se.offset;if(re.isInstancedInterleavedBuffer){for(let Me=0;Me<j.locationSize;Me++)p(j.location+Me,re.meshPerAttribute);N.isInstancedMesh!==!0&&U._maxInstanceCount===void 0&&(U._maxInstanceCount=re.meshPerAttribute*re.count)}else for(let Me=0;Me<j.locationSize;Me++)m(j.location+Me);t.bindBuffer(t.ARRAY_BUFFER,mt);for(let Me=0;Me<j.locationSize;Me++)I(j.location+Me,Fe/j.locationSize,tt,oe,Re*Je,(Ge+Fe/j.locationSize*Me)*Je,Y)}else{if(se.isInstancedBufferAttribute){for(let re=0;re<j.locationSize;re++)p(j.location+re,se.meshPerAttribute);N.isInstancedMesh!==!0&&U._maxInstanceCount===void 0&&(U._maxInstanceCount=se.meshPerAttribute*se.count)}else for(let re=0;re<j.locationSize;re++)m(j.location+re);t.bindBuffer(t.ARRAY_BUFFER,mt);for(let re=0;re<j.locationSize;re++)I(j.location+re,Fe/j.locationSize,tt,oe,Fe*Je,Fe/j.locationSize*re*Je,Y)}}else if(X!==void 0){const oe=X[ce];if(oe!==void 0)switch(oe.length){case 2:t.vertexAttrib2fv(j.location,oe);break;case 3:t.vertexAttrib3fv(j.location,oe);break;case 4:t.vertexAttrib4fv(j.location,oe);break;default:t.vertexAttrib1fv(j.location,oe)}}}}E()}function w(){T();for(const N in i){const k=i[N];for(const q in k){const U=k[q];for(const V in U){const Q=U[V];for(const X in Q)u(Q[X].object),delete Q[X];delete U[V]}}delete i[N]}}function A(N){if(i[N.id]===void 0)return;const k=i[N.id];for(const q in k){const U=k[q];for(const V in U){const Q=U[V];for(const X in Q)u(Q[X].object),delete Q[X];delete U[V]}}delete i[N.id]}function P(N){for(const k in i){const q=i[k];for(const U in q){const V=q[U];if(V[N.id]===void 0)continue;const Q=V[N.id];for(const X in Q)u(Q[X].object),delete Q[X];delete V[N.id]}}}function v(N){for(const k in i){const q=i[k],U=N.isInstancedMesh===!0?N.id:0,V=q[U];if(V!==void 0){for(const Q in V){const X=V[Q];for(const ce in X)u(X[ce].object),delete X[ce];delete V[Q]}delete q[U],Object.keys(q).length===0&&delete i[k]}}}function T(){L(),o=!0,r!==s&&(r=s,l(r.object))}function L(){s.geometry=null,s.program=null,s.wireframe=!1}return{setup:a,reset:T,resetDefaultState:L,dispose:w,releaseStatesOfGeometry:A,releaseStatesOfObject:v,releaseStatesOfProgram:P,initAttributes:x,enableAttribute:m,disableUnusedAttributes:E}}function v1(t,e,n){let i;function s(c){i=c}function r(c,l){t.drawArrays(i,c,l),n.update(l,i,1)}function o(c,l,u){u!==0&&(t.drawArraysInstanced(i,c,l,u),n.update(l,i,u))}function a(c,l,u){if(u===0)return;e.get("WEBGL_multi_draw").multiDrawArraysWEBGL(i,c,0,l,0,u);let d=0;for(let f=0;f<u;f++)d+=l[f];n.update(d,i,1)}this.setMode=s,this.render=r,this.renderInstances=o,this.renderMultiDraw=a}function x1(t,e,n,i){let s;function r(){if(s!==void 0)return s;if(e.has("EXT_texture_filter_anisotropic")===!0){const P=e.get("EXT_texture_filter_anisotropic");s=t.getParameter(P.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else s=0;return s}function o(P){return!(P!==Qn&&i.convert(P)!==t.getParameter(t.IMPLEMENTATION_COLOR_READ_FORMAT))}function a(P){const v=P===xi&&(e.has("EXT_color_buffer_half_float")||e.has("EXT_color_buffer_float"));return!(P!==$n&&P!==mi&&!v&&i.convert(P)!==t.getParameter(t.IMPLEMENTATION_COLOR_READ_TYPE))}function c(P){if(P==="highp"){if(t.getShaderPrecisionFormat(t.VERTEX_SHADER,t.HIGH_FLOAT).precision>0&&t.getShaderPrecisionFormat(t.FRAGMENT_SHADER,t.HIGH_FLOAT).precision>0)return"highp";P="mediump"}return P==="mediump"&&t.getShaderPrecisionFormat(t.VERTEX_SHADER,t.MEDIUM_FLOAT).precision>0&&t.getShaderPrecisionFormat(t.FRAGMENT_SHADER,t.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}let l=n.precision!==void 0?n.precision:"highp";const u=c(l);u!==l&&($e("WebGLRenderer:",l,"not supported, using",u,"instead."),l=u);const h=n.logarithmicDepthBuffer===!0,d=n.reversedDepthBuffer===!0&&e.has("EXT_clip_control");n.reversedDepthBuffer===!0&&d===!1&&$e("WebGLRenderer: Unable to use reversed depth buffer due to missing EXT_clip_control extension. Fallback to default depth buffer.");const f=t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS),_=t.getParameter(t.MAX_VERTEX_TEXTURE_IMAGE_UNITS),x=t.getParameter(t.MAX_TEXTURE_SIZE),m=t.getParameter(t.MAX_CUBE_MAP_TEXTURE_SIZE),p=t.getParameter(t.MAX_VERTEX_ATTRIBS),E=t.getParameter(t.MAX_VERTEX_UNIFORM_VECTORS),I=t.getParameter(t.MAX_VARYING_VECTORS),b=t.getParameter(t.MAX_FRAGMENT_UNIFORM_VECTORS),w=t.getParameter(t.MAX_SAMPLES),A=t.getParameter(t.SAMPLES);return{isWebGL2:!0,getMaxAnisotropy:r,getMaxPrecision:c,textureFormatReadable:o,textureTypeReadable:a,precision:l,logarithmicDepthBuffer:h,reversedDepthBuffer:d,maxTextures:f,maxVertexTextures:_,maxTextureSize:x,maxCubemapSize:m,maxAttributes:p,maxVertexUniforms:E,maxVaryings:I,maxFragmentUniforms:b,maxSamples:w,samples:A}}function y1(t){const e=this;let n=null,i=0,s=!1,r=!1;const o=new Ii,a=new Ke,c={value:null,needsUpdate:!1};this.uniform=c,this.numPlanes=0,this.numIntersection=0,this.init=function(h,d){const f=h.length!==0||d||i!==0||s;return s=d,i=h.length,f},this.beginShadows=function(){r=!0,u(null)},this.endShadows=function(){r=!1},this.setGlobalState=function(h,d){n=u(h,d,0)},this.setState=function(h,d,f){const _=h.clippingPlanes,x=h.clipIntersection,m=h.clipShadows,p=t.get(h);if(!s||_===null||_.length===0||r&&!m)r?u(null):l();else{const E=r?0:i,I=E*4;let b=p.clippingState||null;c.value=b,b=u(_,d,I,f);for(let w=0;w!==I;++w)b[w]=n[w];p.clippingState=b,this.numIntersection=x?this.numPlanes:0,this.numPlanes+=E}};function l(){c.value!==n&&(c.value=n,c.needsUpdate=i>0),e.numPlanes=i,e.numIntersection=0}function u(h,d,f,_){const x=h!==null?h.length:0;let m=null;if(x!==0){if(m=c.value,_!==!0||m===null){const p=f+x*4,E=d.matrixWorldInverse;a.getNormalMatrix(E),(m===null||m.length<p)&&(m=new Float32Array(p));for(let I=0,b=f;I!==x;++I,b+=4)o.copy(h[I]).applyMatrix4(E,a),o.normal.toArray(m,b),m[b+3]=o.constant}c.value=m,c.needsUpdate=!0}return e.numPlanes=x,e.numIntersection=0,m}}const sr=4,b1=6,M1=20,E1=256,Br=new HS,Wf=new at;let ul=null,dl=0,hl=0,fl=!1;const T1=new H,xs=new H;class Zf{constructor(e){this._renderer=e,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._sizeLods=[],this._lodMeshes=[],this._backgroundBox=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._blurMaterial=null,this._ggxMaterial=null}fromScene(e,n=0,i=.1,s=100,r={}){const{size:o=256,position:a=T1}=r;ul=this._renderer.getRenderTarget(),dl=this._renderer.getActiveCubeFace(),hl=this._renderer.getActiveMipmapLevel(),fl=this._renderer.xr.enabled,this._renderer.xr.enabled=!1,this._setSize(o);const c=this._allocateTargets();return c.depthBuffer=!0,this._sceneToCubeUV(e,i,s,c,a),n>0&&this._blur(c,0,0,n),this._applyPMREM(c),this._cleanup(c),c}fromEquirectangular(e,n=null){return this._fromTexture(e,n)}fromCubemap(e,n=null){return this._fromTexture(e,n)}compileCubemapShader(){this._cubemapMaterial===null&&(this._cubemapMaterial=Kf(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=Yf(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),this._cubemapMaterial!==null&&this._cubemapMaterial.dispose(),this._equirectMaterial!==null&&this._equirectMaterial.dispose(),this._backgroundBox!==null&&(this._backgroundBox.geometry.dispose(),this._backgroundBox.material.dispose())}_setSize(e){this._lodMax=Math.floor(Math.log2(e)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){this._blurMaterial!==null&&this._blurMaterial.dispose(),this._ggxMaterial!==null&&this._ggxMaterial.dispose(),this._pingPongRenderTarget!==null&&this._pingPongRenderTarget.dispose();for(let e=0;e<this._lodMeshes.length;e++)this._lodMeshes[e].geometry.dispose()}_cleanup(e){this._renderer.setRenderTarget(ul,dl,hl),this._renderer.xr.enabled=fl,e.scissorTest=!1,Js(e,0,0,e.width,e.height)}_fromTexture(e,n){e.mapping===Cs||e.mapping===vr?this._setSize(e.image.length===0?16:e.image[0].width||e.image[0].image.width):this._setSize(e.image.width/4),ul=this._renderer.getRenderTarget(),dl=this._renderer.getActiveCubeFace(),hl=this._renderer.getActiveMipmapLevel(),fl=this._renderer.xr.enabled,this._renderer.xr.enabled=!1;const i=n||this._allocateTargets();return this._textureToCubeUV(e,i),this._applyPMREM(i),this._cleanup(i),i}_allocateTargets(){const e=3*Math.max(this._cubeSize,112),n=4*this._cubeSize,i={magFilter:_n,minFilter:_n,generateMipmaps:!1,type:xi,format:Qn,colorSpace:Aa,depthBuffer:!1},s=Xf(e,n,i);if(this._pingPongRenderTarget===null||this._pingPongRenderTarget.width!==e||this._pingPongRenderTarget.height!==n){this._pingPongRenderTarget!==null&&this._dispose(),this._pingPongRenderTarget=Xf(e,n,i);const{_lodMax:r}=this;({lodMeshes:this._lodMeshes,sizeLods:this._sizeLods}=R1(r)),this._blurMaterial=A1(r,e,n),this._ggxMaterial=w1(r,e,n)}return s}_compileMaterial(e){const n=new si(new Nn,e);this._renderer.compile(n,Br)}_sceneToCubeUV(e,n,i,s,r){const c=new Gn(90,1,n,i),l=[1,-1,1,1,1,1],u=[1,1,1,-1,-1,-1],h=this._renderer,d=h.autoClear,f=h.toneMapping;h.getClearColor(Wf),h.toneMapping=_i,h.autoClear=!1,h.state.buffers.depth.getReversed()&&(h.setRenderTarget(s),h.clearDepth(),h.setRenderTarget(null)),this._backgroundBox===null&&(this._backgroundBox=new si(new So,new dc({name:"PMREM.Background",side:Cn,depthWrite:!1,depthTest:!1})));const x=this._backgroundBox,m=x.material;let p=!1;const E=e.background;E?E.isColor&&(m.color.copy(E),e.background=null,p=!0):(m.color.copy(Wf),p=!0);for(let I=0;I<6;I++){const b=I%3;b===0?(c.up.set(0,l[I],0),c.position.set(r.x,r.y,r.z),c.lookAt(r.x+u[I],r.y,r.z)):b===1?(c.up.set(0,0,l[I]),c.position.set(r.x,r.y,r.z),c.lookAt(r.x,r.y+u[I],r.z)):(c.up.set(0,l[I],0),c.position.set(r.x,r.y,r.z),c.lookAt(r.x,r.y,r.z+u[I]));const w=this._cubeSize;Js(s,b*w,I>2?w:0,w,w),h.setRenderTarget(s),p&&h.render(x,c),h.render(e,c)}h.toneMapping=f,h.autoClear=d,e.background=E}_textureToCubeUV(e,n){const i=this._renderer,s=e.mapping===Cs||e.mapping===vr;s?(this._cubemapMaterial===null&&(this._cubemapMaterial=Kf()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=Yf());const r=s?this._cubemapMaterial:this._equirectMaterial,o=this._lodMeshes[0];o.material=r;const a=r.uniforms;a.envMap.value=e;const c=this._cubeSize;Js(n,0,0,3*c,2*c),i.setRenderTarget(n),i.render(o,Br)}_applyPMREM(e){const n=this._renderer,i=n.autoClear;n.autoClear=!1;const s=this._lodMeshes.length;for(let r=1;r<s;r++)this._applyGGXFilter(e,r-1,r);n.autoClear=i}_applyGGXFilter(e,n,i){const s=this._renderer,r=this._pingPongRenderTarget,o=this._ggxMaterial,a=this._lodMeshes[i];a.material=o;const c=o.uniforms,l=i/(this._lodMeshes.length-1),u=n/(this._lodMeshes.length-1),h=Math.sqrt(l*l-u*u),d=l*1.25,f=h*d,{_lodMax:_}=this,x=this._sizeLods[i],m=3*x*(i>_-sr?i-_+sr:0),p=4*(this._cubeSize-x);c.envMap.value=e.texture,c.roughness.value=f,c.mipInt.value=_-n,Js(r,m,p,3*x,2*x),s.setRenderTarget(r),s.render(a,Br),c.envMap.value=r.texture,c.roughness.value=0,c.mipInt.value=_-i,Js(e,m,p,3*x,2*x),s.setRenderTarget(e),s.render(a,Br)}_blur(e,n,i,s){const r=this._pingPongRenderTarget,o=Math.min(s,Math.PI)/Math.SQRT2;this._blurPass(e,r,n,i,o),this._blurPass(r,e,i,i,o)}_blurPass(e,n,i,s,r){const o=this._renderer,a=this._blurMaterial,c=this._lodMeshes[s];c.material=a;const l=a.uniforms;l.envMap.value=e.texture,l.sigma.value=r,l.mipInt.value=this._lodMax-i;const u=this._sizeLods[s],h=3*u*(s>this._lodMax-sr?s-this._lodMax+sr:0),d=4*(this._cubeSize-u);Js(n,h,d,3*u,2*u),o.setRenderTarget(n),o.render(c,Br)}}function R1(t){const e=[],n=[];let i=t;const s=t-sr+1+b1;for(let r=0;r<s;r++){const o=Math.pow(2,i);e.push(o);const a=1/(o-2),c=-a,l=1+a,u=[c,c,l,c,l,l,c,c,l,l,c,l],h=6,d=6,f=3,_=new Float32Array(f*d*h),x=new Float32Array(f*d*h);for(let p=0;p<h;p++){const E=p%3*2/3-1,I=p>2?0:-1,b=[E,I,0,E+2/3,I,0,E+2/3,I+1,0,E,I,0,E+2/3,I+1,0,E,I+1,0];_.set(b,f*d*p);for(let w=0;w<d;w++){const A=u[w*2]*2-1,P=u[w*2+1]*2-1;p===0?xs.set(1,P,A):p===1?xs.set(-A,1,-P):p===2?xs.set(-A,P,1):p===3?xs.set(-1,P,-A):p===4?xs.set(-A,-1,P):xs.set(A,P,-1),xs.toArray(x,(p*d+w)*f)}}const m=new Nn;m.setAttribute("position",new ti(_,f)),m.setAttribute("outputDirection",new ti(x,f)),n.push(new si(m,null)),i>sr&&i--}return{lodMeshes:n,sizeLods:e}}function Xf(t,e,n){const i=new ei(t,e,n);return i.texture.mapping=lc,i.texture.name="PMREM.cubeUv",i.scissorTest=!0,i}function Js(t,e,n,i,s){t.viewport.set(e,n,i,s),t.scissor.set(e,n,i,s)}function w1(t,e,n){return new yi({name:"PMREMGGXConvolution",defines:{GGX_SAMPLES:E1,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/n,CUBEUV_MAX_MIP:`${t}.0`},uniforms:{envMap:{value:null},roughness:{value:0},mipInt:{value:0}},vertexShader:pc(),fragmentShader:`
|
|
3937
3937
|
|
|
3938
3938
|
precision highp float;
|
|
3939
3939
|
precision highp int;
|
|
@@ -4037,7 +4037,7 @@ void main() {
|
|
|
4037
4037
|
|
|
4038
4038
|
gl_FragColor = vec4(prefilteredColor, 1.0);
|
|
4039
4039
|
}
|
|
4040
|
-
`,blending:
|
|
4040
|
+
`,blending:Oi,depthTest:!1,depthWrite:!1})}function A1(t,e,n){return new yi({name:"SphericalGaussianBlur",defines:{SAMPLES:M1,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/n,CUBEUV_MAX_MIP:`${t}.0`},uniforms:{envMap:{value:null},sigma:{value:0},mipInt:{value:0}},vertexShader:pc(),fragmentShader:`
|
|
4041
4041
|
|
|
4042
4042
|
precision highp float;
|
|
4043
4043
|
precision highp int;
|
|
@@ -4097,7 +4097,7 @@ void main() {
|
|
|
4097
4097
|
gl_FragColor = vec4( accumColor / accumWeight, 1.0 );
|
|
4098
4098
|
|
|
4099
4099
|
}
|
|
4100
|
-
`,blending:
|
|
4100
|
+
`,blending:Oi,depthTest:!1,depthWrite:!1})}function Yf(){return new yi({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:pc(),fragmentShader:`
|
|
4101
4101
|
|
|
4102
4102
|
precision mediump float;
|
|
4103
4103
|
precision mediump int;
|
|
@@ -4116,7 +4116,7 @@ void main() {
|
|
|
4116
4116
|
gl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 );
|
|
4117
4117
|
|
|
4118
4118
|
}
|
|
4119
|
-
`,blending:
|
|
4119
|
+
`,blending:Oi,depthTest:!1,depthWrite:!1})}function Kf(){return new yi({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:pc(),fragmentShader:`
|
|
4120
4120
|
|
|
4121
4121
|
precision mediump float;
|
|
4122
4122
|
precision mediump int;
|
|
@@ -4132,7 +4132,7 @@ void main() {
|
|
|
4132
4132
|
gl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) );
|
|
4133
4133
|
|
|
4134
4134
|
}
|
|
4135
|
-
`,blending:
|
|
4135
|
+
`,blending:Oi,depthTest:!1,depthWrite:!1})}function pc(){return`
|
|
4136
4136
|
|
|
4137
4137
|
precision mediump float;
|
|
4138
4138
|
precision mediump int;
|
|
@@ -4147,7 +4147,7 @@ void main() {
|
|
|
4147
4147
|
gl_Position = vec4( position, 1.0 );
|
|
4148
4148
|
|
|
4149
4149
|
}
|
|
4150
|
-
`}class
|
|
4150
|
+
`}class $S extends ei{constructor(e=1,n={}){super(e,e,n),this.isWebGLCubeRenderTarget=!0;const i={width:e,height:e,depth:1},s=[i,i,i,i,i,i];this.texture=new OS(s),this._setTextureOptions(n),this.texture.isRenderTargetTexture=!0}fromEquirectangularTexture(e,n){this.texture.type=n.type,this.texture.colorSpace=n.colorSpace,this.texture.generateMipmaps=n.generateMipmaps,this.texture.minFilter=n.minFilter,this.texture.magFilter=n.magFilter;const i={uniforms:{tEquirect:{value:null}},vertexShader:`
|
|
4151
4151
|
|
|
4152
4152
|
varying vec3 vWorldDirection;
|
|
4153
4153
|
|
|
@@ -4182,7 +4182,7 @@ void main() {
|
|
|
4182
4182
|
gl_FragColor = texture2D( tEquirect, sampleUV );
|
|
4183
4183
|
|
|
4184
4184
|
}
|
|
4185
|
-
`},s=new
|
|
4185
|
+
`},s=new So(5,5,5),r=new yi({name:"CubemapFromEquirect",uniforms:xr(i.uniforms),vertexShader:i.vertexShader,fragmentShader:i.fragmentShader,side:Cn,blending:Oi});r.uniforms.tEquirect.value=n;const o=new si(s,r),a=n.minFilter;return n.minFilter===ys&&(n.minFilter=_n),new CA(1,10,this).update(e,o),n.minFilter=a,o.geometry.dispose(),o.material.dispose(),this}clear(e,n=!0,i=!0,s=!0){const r=e.getRenderTarget();for(let o=0;o<6;o++)e.setRenderTarget(this,o),e.clear(n,i,s);e.setRenderTarget(r)}}function C1(t){let e=new WeakMap,n=new WeakMap,i=null;function s(d,f=!1){return d==null?null:f?o(d):r(d)}function r(d){if(d&&d.isTexture){const f=d.mapping;if(f===zc||f===Bc)if(e.has(d)){const _=e.get(d).texture;return a(_,d.mapping)}else{const _=d.image;if(_&&_.height>0){const x=new $S(_.height);return x.fromEquirectangularTexture(t,d),e.set(d,x),d.addEventListener("dispose",l),a(x.texture,d.mapping)}else return null}}return d}function o(d){if(d&&d.isTexture){const f=d.mapping,_=f===zc||f===Bc,x=f===Cs||f===vr;if(_||x){let m=n.get(d);const p=m!==void 0?m.texture.pmremVersion:0;if(d.isRenderTargetTexture&&d.pmremVersion!==p)return i===null&&(i=new Zf(t)),m=_?i.fromEquirectangular(d,m):i.fromCubemap(d,m),m.texture.pmremVersion=d.pmremVersion,n.set(d,m),m.texture;if(m!==void 0)return m.texture;{const E=d.image;return _&&E&&E.height>0||x&&E&&c(E)?(i===null&&(i=new Zf(t)),m=_?i.fromEquirectangular(d):i.fromCubemap(d),m.texture.pmremVersion=d.pmremVersion,n.set(d,m),d.addEventListener("dispose",u),m.texture):null}}}return d}function a(d,f){return f===zc?d.mapping=Cs:f===Bc&&(d.mapping=vr),d}function c(d){let f=0;const _=6;for(let x=0;x<_;x++)d[x]!==void 0&&f++;return f===_}function l(d){const f=d.target;f.removeEventListener("dispose",l);const _=e.get(f);_!==void 0&&(e.delete(f),_.dispose())}function u(d){const f=d.target;f.removeEventListener("dispose",u);const _=n.get(f);_!==void 0&&(n.delete(f),_.dispose())}function h(){e=new WeakMap,n=new WeakMap,i!==null&&(i.dispose(),i=null)}return{get:s,dispose:h}}function P1(t){const e={};function n(i){if(e[i]!==void 0)return e[i];const s=t.getExtension(i);return e[i]=s,s}return{has:function(i){return n(i)!==null},init:function(){n("EXT_color_buffer_float"),n("WEBGL_clip_cull_distance"),n("OES_texture_float_linear"),n("EXT_color_buffer_half_float"),n("WEBGL_multisampled_render_to_texture"),n("WEBGL_render_shared_exponent")},get:function(i){const s=n(i);return s===null&&or("WebGLRenderer: "+i+" extension not supported."),s}}}function L1(t,e,n,i){const s={},r=new WeakMap;function o(h){const d=h.target;d.index!==null&&e.remove(d.index);for(const _ in d.attributes)e.remove(d.attributes[_]);d.removeEventListener("dispose",o),delete s[d.id];const f=r.get(d);f&&(e.remove(f),r.delete(d)),i.releaseStatesOfGeometry(d),d.isInstancedBufferGeometry===!0&&delete d._maxInstanceCount,n.memory.geometries--}function a(h,d){return s[d.id]===!0||(d.addEventListener("dispose",o),s[d.id]=!0,n.memory.geometries++),d}function c(h){const d=h.attributes;for(const f in d)e.update(d[f],t.ARRAY_BUFFER)}function l(h){const d=[],f=h.index,_=h.attributes.position;let x=0;if(_===void 0)return;if(f!==null){const E=f.array;x=f.version;for(let I=0,b=E.length;I<b;I+=3){const w=E[I+0],A=E[I+1],P=E[I+2];d.push(w,A,A,P,P,w)}}else{const E=_.array;x=_.version;for(let I=0,b=E.length/3-1;I<b;I+=3){const w=I+0,A=I+1,P=I+2;d.push(w,A,A,P,P,w)}}const m=new(_.count>=65535?DS:NS)(d,1);m.version=x;const p=r.get(h);p&&e.remove(p),r.set(h,m)}function u(h){const d=r.get(h);if(d){const f=h.index;f!==null&&d.version<f.version&&l(h)}else l(h);return r.get(h)}return{get:a,update:c,getWireframeAttribute:u}}function I1(t,e,n){let i;function s(h){i=h}let r,o;function a(h){r=h.type,o=h.bytesPerElement}function c(h,d){t.drawElements(i,d,r,h*o),n.update(d,i,1)}function l(h,d,f){f!==0&&(t.drawElementsInstanced(i,d,r,h*o,f),n.update(d,i,f))}function u(h,d,f){if(f===0)return;e.get("WEBGL_multi_draw").multiDrawElementsWEBGL(i,d,0,r,h,0,f);let x=0;for(let m=0;m<f;m++)x+=d[m];n.update(x,i,1)}this.setMode=s,this.setIndex=a,this.render=c,this.renderInstances=l,this.renderMultiDraw=u}function N1(t){const e={geometries:0,textures:0},n={frame:0,calls:0,triangles:0,points:0,lines:0};function i(r,o,a){switch(n.calls++,o){case t.TRIANGLES:n.triangles+=a*(r/3);break;case t.LINES:n.lines+=a*(r/2);break;case t.LINE_STRIP:n.lines+=a*(r-1);break;case t.LINE_LOOP:n.lines+=a*r;break;case t.POINTS:n.points+=a*r;break;default:vt("WebGLInfo: Unknown draw mode:",o);break}}function s(){n.calls=0,n.triangles=0,n.points=0,n.lines=0}return{memory:e,render:n,programs:null,autoReset:!0,reset:s,update:i}}function D1(t,e,n){const i=new WeakMap,s=new Vt;function r(o,a,c){const l=o.morphTargetInfluences,u=a.morphAttributes.position||a.morphAttributes.normal||a.morphAttributes.color,h=u!==void 0?u.length:0;let d=i.get(a);if(d===void 0||d.count!==h){let L=function(){v.dispose(),i.delete(a),a.removeEventListener("dispose",L)};var f=L;d!==void 0&&d.texture.dispose();const _=a.morphAttributes.position!==void 0,x=a.morphAttributes.normal!==void 0,m=a.morphAttributes.color!==void 0,p=a.morphAttributes.position||[],E=a.morphAttributes.normal||[],I=a.morphAttributes.color||[];let b=0;_===!0&&(b=1),x===!0&&(b=2),m===!0&&(b=3);let w=a.attributes.position.count*b,A=1;w>e.maxTextureSize&&(A=Math.ceil(w/e.maxTextureSize),w=e.maxTextureSize);const P=new Float32Array(w*A*4*h),v=new PS(P,w,A,h);v.type=mi,v.needsUpdate=!0;const T=b*4;for(let N=0;N<h;N++){const k=p[N],q=E[N],U=I[N],V=w*A*4*N;for(let Q=0;Q<k.count;Q++){const X=Q*T;_===!0&&(s.fromBufferAttribute(k,Q),P[V+X+0]=s.x,P[V+X+1]=s.y,P[V+X+2]=s.z,P[V+X+3]=0),x===!0&&(s.fromBufferAttribute(q,Q),P[V+X+4]=s.x,P[V+X+5]=s.y,P[V+X+6]=s.z,P[V+X+7]=0),m===!0&&(s.fromBufferAttribute(U,Q),P[V+X+8]=s.x,P[V+X+9]=s.y,P[V+X+10]=s.z,P[V+X+11]=U.itemSize===4?s.w:1)}}d={count:h,texture:v,size:new je(w,A)},i.set(a,d),a.addEventListener("dispose",L)}if(o.isInstancedMesh===!0&&o.morphTexture!==null)c.getUniforms().setValue(t,"morphTexture",o.morphTexture,n);else{let _=0;for(let m=0;m<l.length;m++)_+=l[m];const x=a.morphTargetsRelative?1:1-_;c.getUniforms().setValue(t,"morphTargetBaseInfluence",x),c.getUniforms().setValue(t,"morphTargetInfluences",l)}c.getUniforms().setValue(t,"morphTargetsTexture",d.texture,n),c.getUniforms().setValue(t,"morphTargetsTextureSize",d.size)}return{update:r}}function U1(t,e,n,i,s){let r=new WeakMap;function o(l){const u=s.render.frame,h=l.geometry,d=e.get(l,h);if(r.get(d)!==u&&(e.update(d),r.set(d,u)),l.isInstancedMesh&&(l.hasEventListener("dispose",c)===!1&&l.addEventListener("dispose",c),r.get(l)!==u&&(n.update(l.instanceMatrix,t.ARRAY_BUFFER),l.instanceColor!==null&&n.update(l.instanceColor,t.ARRAY_BUFFER),r.set(l,u))),l.isSkinnedMesh){const f=l.skeleton;r.get(f)!==u&&(f.update(),r.set(f,u))}return d}function a(){r=new WeakMap}function c(l){const u=l.target;u.removeEventListener("dispose",c),i.releaseStatesOfObject(u),n.remove(u.instanceMatrix),u.instanceColor!==null&&n.remove(u.instanceColor)}return{update:o,dispose:a}}const O1={[fS]:"LINEAR_TONE_MAPPING",[pS]:"REINHARD_TONE_MAPPING",[mS]:"CINEON_TONE_MAPPING",[gS]:"ACES_FILMIC_TONE_MAPPING",[SS]:"AGX_TONE_MAPPING",[vS]:"NEUTRAL_TONE_MAPPING",[_S]:"CUSTOM_TONE_MAPPING"};function F1(t,e,n,i,s,r){const o=new ei(e,n,{type:t,depthBuffer:s,stencilBuffer:r,samples:i?4:0,storeMultisampledDepthBuffer:!1,storeMultisampledStencilBuffer:!1,resolveDepthBuffer:!1,resolveStencilBuffer:!1});let a=null,c=null;const l=new Nn;l.setAttribute("position",new on([-1,3,0,-1,-1,0,3,-1,0],3)),l.setAttribute("uv",new on([0,2,0,0,2,0],2));const u=new RA({uniforms:{tDiffuse:{value:null}},vertexShader:`
|
|
4186
4186
|
precision highp float;
|
|
4187
4187
|
|
|
4188
4188
|
uniform mat4 modelViewMatrix;
|
|
@@ -4228,17 +4228,17 @@ void main() {
|
|
|
4228
4228
|
#ifdef SRGB_TRANSFER
|
|
4229
4229
|
gl_FragColor = sRGBTransferOETF( gl_FragColor );
|
|
4230
4230
|
#endif
|
|
4231
|
-
}`,depthTest:!1,depthWrite:!1}),h=new ei(l,u),d=new eS(-1,1,1,-1,0,1);let f=null,_=null,x=!1,m,p=null,E=[],L=!1;this.setSize=function(b,w){o.setSize(b,w),a!==null&&a.setSize(b,w),c!==null&&c.setSize(b,w);for(let A=0;A<E.length;A++){const P=E[A];P.setSize&&P.setSize(b,w)}},this.setEffects=function(b){E=b,L=E.length>0&&E[0].isRenderPass===!0;const w=o.width,A=o.height;E.length>0&&a===null&&(a=new Kn(w,A,{type:pi,depthBuffer:!1,stencilBuffer:!1}),c=new Kn(w,A,{type:pi,depthBuffer:!1,stencilBuffer:!1}));for(let P=0;P<E.length;P++){const v=E[P];v.setSize&&v.setSize(w,A)}},this.begin=function(b,w){if(x||b.toneMapping===hi&&E.length===0)return!1;if(p=w,w!==null){const A=w.width,P=w.height;(o.width!==A||o.height!==P)&&this.setSize(A,P)}return L===!1&&b.setRenderTarget(o),m=b.toneMapping,b.toneMapping=hi,!0},this.hasRenderPass=function(){return L},this.end=function(b,w){b.toneMapping=m,x=!0;let A=o,P=a;for(let v=0;v<E.length;v++){const T=E[v];T.enabled!==!1&&(T.render(b,P,A,w),T.needsSwap!==!1&&(A=P,P=P===a?c:a))}if(f!==b.outputColorSpace||_!==b.toneMapping){f=b.outputColorSpace,_=b.toneMapping,u.defines={},dt.getTransfer(f)===Mt&&(u.defines.SRGB_TRANSFER="");const v=NP[_];v&&(u.defines[v]=""),u.needsUpdate=!0}u.uniforms.tDiffuse.value=A.texture,b.setRenderTarget(p),b.render(h,d),p=null,x=!1},this.isCompositing=function(){return x},this.dispose=function(){o.dispose(),a!==null&&a.dispose(),c!==null&&c.dispose(),l.dispose(),u.dispose()}}const sS=new yn,iu=new eo(1,1),rS=new q_,oS=new QR,aS=new K_,gf=[],_f=[],Sf=new Float32Array(16),vf=new Float32Array(9),xf=new Float32Array(4);function _r(t,e,n){const i=t[0];if(i<=0||i>0)return t;const s=e*n;let r=gf[s];if(r===void 0&&(r=new Float32Array(s),gf[s]=r),e!==0){i.toArray(r,0);for(let o=1,a=0;o!==e;++o)a+=n,t[o].toArray(r,a)}return r}function jt(t,e){if(t.length!==e.length)return!1;for(let n=0,i=t.length;n<i;n++)if(t[n]!==e[n])return!1;return!0}function Jt(t,e){for(let n=0,i=e.length;n<i;n++)t[n]=e[n]}function nc(t,e){let n=_f[e];n===void 0&&(n=new Int32Array(e),_f[e]=n);for(let i=0;i!==e;++i)n[i]=t.allocateTextureUnit();return n}function UP(t,e){const n=this.cache;n[0]!==e&&(t.uniform1f(this.addr,e),n[0]=e)}function OP(t,e){const n=this.cache;if(e.x!==void 0)(n[0]!==e.x||n[1]!==e.y)&&(t.uniform2f(this.addr,e.x,e.y),n[0]=e.x,n[1]=e.y);else{if(jt(n,e))return;t.uniform2fv(this.addr,e),Jt(n,e)}}function FP(t,e){const n=this.cache;if(e.x!==void 0)(n[0]!==e.x||n[1]!==e.y||n[2]!==e.z)&&(t.uniform3f(this.addr,e.x,e.y,e.z),n[0]=e.x,n[1]=e.y,n[2]=e.z);else if(e.r!==void 0)(n[0]!==e.r||n[1]!==e.g||n[2]!==e.b)&&(t.uniform3f(this.addr,e.r,e.g,e.b),n[0]=e.r,n[1]=e.g,n[2]=e.b);else{if(jt(n,e))return;t.uniform3fv(this.addr,e),Jt(n,e)}}function kP(t,e){const n=this.cache;if(e.x!==void 0)(n[0]!==e.x||n[1]!==e.y||n[2]!==e.z||n[3]!==e.w)&&(t.uniform4f(this.addr,e.x,e.y,e.z,e.w),n[0]=e.x,n[1]=e.y,n[2]=e.z,n[3]=e.w);else{if(jt(n,e))return;t.uniform4fv(this.addr,e),Jt(n,e)}}function zP(t,e){const n=this.cache,i=e.elements;if(i===void 0){if(jt(n,e))return;t.uniformMatrix2fv(this.addr,!1,e),Jt(n,e)}else{if(jt(n,i))return;xf.set(i),t.uniformMatrix2fv(this.addr,!1,xf),Jt(n,i)}}function BP(t,e){const n=this.cache,i=e.elements;if(i===void 0){if(jt(n,e))return;t.uniformMatrix3fv(this.addr,!1,e),Jt(n,e)}else{if(jt(n,i))return;vf.set(i),t.uniformMatrix3fv(this.addr,!1,vf),Jt(n,i)}}function HP(t,e){const n=this.cache,i=e.elements;if(i===void 0){if(jt(n,e))return;t.uniformMatrix4fv(this.addr,!1,e),Jt(n,e)}else{if(jt(n,i))return;Sf.set(i),t.uniformMatrix4fv(this.addr,!1,Sf),Jt(n,i)}}function VP(t,e){const n=this.cache;n[0]!==e&&(t.uniform1i(this.addr,e),n[0]=e)}function GP(t,e){const n=this.cache;if(e.x!==void 0)(n[0]!==e.x||n[1]!==e.y)&&(t.uniform2i(this.addr,e.x,e.y),n[0]=e.x,n[1]=e.y);else{if(jt(n,e))return;t.uniform2iv(this.addr,e),Jt(n,e)}}function qP(t,e){const n=this.cache;if(e.x!==void 0)(n[0]!==e.x||n[1]!==e.y||n[2]!==e.z)&&(t.uniform3i(this.addr,e.x,e.y,e.z),n[0]=e.x,n[1]=e.y,n[2]=e.z);else{if(jt(n,e))return;t.uniform3iv(this.addr,e),Jt(n,e)}}function $P(t,e){const n=this.cache;if(e.x!==void 0)(n[0]!==e.x||n[1]!==e.y||n[2]!==e.z||n[3]!==e.w)&&(t.uniform4i(this.addr,e.x,e.y,e.z,e.w),n[0]=e.x,n[1]=e.y,n[2]=e.z,n[3]=e.w);else{if(jt(n,e))return;t.uniform4iv(this.addr,e),Jt(n,e)}}function WP(t,e){const n=this.cache;n[0]!==e&&(t.uniform1ui(this.addr,e),n[0]=e)}function ZP(t,e){const n=this.cache;if(e.x!==void 0)(n[0]!==e.x||n[1]!==e.y)&&(t.uniform2ui(this.addr,e.x,e.y),n[0]=e.x,n[1]=e.y);else{if(jt(n,e))return;t.uniform2uiv(this.addr,e),Jt(n,e)}}function XP(t,e){const n=this.cache;if(e.x!==void 0)(n[0]!==e.x||n[1]!==e.y||n[2]!==e.z)&&(t.uniform3ui(this.addr,e.x,e.y,e.z),n[0]=e.x,n[1]=e.y,n[2]=e.z);else{if(jt(n,e))return;t.uniform3uiv(this.addr,e),Jt(n,e)}}function YP(t,e){const n=this.cache;if(e.x!==void 0)(n[0]!==e.x||n[1]!==e.y||n[2]!==e.z||n[3]!==e.w)&&(t.uniform4ui(this.addr,e.x,e.y,e.z,e.w),n[0]=e.x,n[1]=e.y,n[2]=e.z,n[3]=e.w);else{if(jt(n,e))return;t.uniform4uiv(this.addr,e),Jt(n,e)}}function KP(t,e,n){const i=this.cache,s=n.allocateTextureUnit();i[0]!==s&&(t.uniform1i(this.addr,s),i[0]=s);let r;this.type===t.SAMPLER_2D_SHADOW?(iu.compareFunction=n.isReversedDepthBuffer()?gd:md,r=iu):r=sS,n.setTexture2D(e||r,s)}function jP(t,e,n){const i=this.cache,s=n.allocateTextureUnit();i[0]!==s&&(t.uniform1i(this.addr,s),i[0]=s),n.setTexture3D(e||oS,s)}function JP(t,e,n){const i=this.cache,s=n.allocateTextureUnit();i[0]!==s&&(t.uniform1i(this.addr,s),i[0]=s),n.setTextureCube(e||aS,s)}function QP(t,e,n){const i=this.cache,s=n.allocateTextureUnit();i[0]!==s&&(t.uniform1i(this.addr,s),i[0]=s),n.setTexture2DArray(e||rS,s)}function e1(t){switch(t){case 5126:return UP;case 35664:return OP;case 35665:return FP;case 35666:return kP;case 35674:return zP;case 35675:return BP;case 35676:return HP;case 5124:case 35670:return VP;case 35667:case 35671:return GP;case 35668:case 35672:return qP;case 35669:case 35673:return $P;case 5125:return WP;case 36294:return ZP;case 36295:return XP;case 36296:return YP;case 35678:case 36198:case 36298:case 36306:case 35682:return KP;case 35679:case 36299:case 36307:return jP;case 35680:case 36300:case 36308:case 36293:return JP;case 36289:case 36303:case 36311:case 36292:return QP}}function t1(t,e){t.uniform1fv(this.addr,e)}function n1(t,e){const n=_r(e,this.size,2);t.uniform2fv(this.addr,n)}function i1(t,e){const n=_r(e,this.size,3);t.uniform3fv(this.addr,n)}function s1(t,e){const n=_r(e,this.size,4);t.uniform4fv(this.addr,n)}function r1(t,e){const n=_r(e,this.size,4);t.uniformMatrix2fv(this.addr,!1,n)}function o1(t,e){const n=_r(e,this.size,9);t.uniformMatrix3fv(this.addr,!1,n)}function a1(t,e){const n=_r(e,this.size,16);t.uniformMatrix4fv(this.addr,!1,n)}function c1(t,e){t.uniform1iv(this.addr,e)}function l1(t,e){t.uniform2iv(this.addr,e)}function u1(t,e){t.uniform3iv(this.addr,e)}function d1(t,e){t.uniform4iv(this.addr,e)}function h1(t,e){t.uniform1uiv(this.addr,e)}function f1(t,e){t.uniform2uiv(this.addr,e)}function p1(t,e){t.uniform3uiv(this.addr,e)}function m1(t,e){t.uniform4uiv(this.addr,e)}function g1(t,e,n){const i=this.cache,s=e.length,r=nc(n,s);jt(i,r)||(t.uniform1iv(this.addr,r),Jt(i,r));let o;this.type===t.SAMPLER_2D_SHADOW?o=iu:o=sS;for(let a=0;a!==s;++a)n.setTexture2D(e[a]||o,r[a])}function _1(t,e,n){const i=this.cache,s=e.length,r=nc(n,s);jt(i,r)||(t.uniform1iv(this.addr,r),Jt(i,r));for(let o=0;o!==s;++o)n.setTexture3D(e[o]||oS,r[o])}function S1(t,e,n){const i=this.cache,s=e.length,r=nc(n,s);jt(i,r)||(t.uniform1iv(this.addr,r),Jt(i,r));for(let o=0;o!==s;++o)n.setTextureCube(e[o]||aS,r[o])}function v1(t,e,n){const i=this.cache,s=e.length,r=nc(n,s);jt(i,r)||(t.uniform1iv(this.addr,r),Jt(i,r));for(let o=0;o!==s;++o)n.setTexture2DArray(e[o]||rS,r[o])}function x1(t){switch(t){case 5126:return t1;case 35664:return n1;case 35665:return i1;case 35666:return s1;case 35674:return r1;case 35675:return o1;case 35676:return a1;case 5124:case 35670:return c1;case 35667:case 35671:return l1;case 35668:case 35672:return u1;case 35669:case 35673:return d1;case 5125:return h1;case 36294:return f1;case 36295:return p1;case 36296:return m1;case 35678:case 36198:case 36298:case 36306:case 35682:return g1;case 35679:case 36299:case 36307:return _1;case 35680:case 36300:case 36308:case 36293:return S1;case 36289:case 36303:case 36311:case 36292:return v1}}class y1{constructor(e,n,i){this.id=e,this.addr=i,this.cache=[],this.type=n.type,this.setValue=e1(n.type)}}class b1{constructor(e,n,i){this.id=e,this.addr=i,this.cache=[],this.type=n.type,this.size=n.size,this.setValue=x1(n.type)}}class M1{constructor(e){this.id=e,this.seq=[],this.map={}}setValue(e,n,i){const s=this.seq;for(let r=0,o=s.length;r!==o;++r){const a=s[r];a.setValue(e,n[a.id],i)}}}const Xc=/(\w+)(\])?(\[|\.)?/g;function yf(t,e){t.seq.push(e),t.map[e.id]=e}function E1(t,e,n){const i=t.name,s=i.length;for(Xc.lastIndex=0;;){const r=Xc.exec(i),o=Xc.lastIndex;let a=r[1];const c=r[2]==="]",l=r[3];if(c&&(a=a|0),l===void 0||l==="["&&o+2===s){yf(n,l===void 0?new y1(a,t,e):new b1(a,t,e));break}else{let h=n.map[a];h===void 0&&(h=new M1(a),yf(n,h)),n=h}}}class ea{constructor(e,n){this.seq=[],this.map={};const i=e.getProgramParameter(n,e.ACTIVE_UNIFORMS);for(let o=0;o<i;++o){const a=e.getActiveUniform(n,o),c=e.getUniformLocation(n,a.name);E1(a,c,this)}const s=[],r=[];for(const o of this.seq)o.type===e.SAMPLER_2D_SHADOW||o.type===e.SAMPLER_CUBE_SHADOW||o.type===e.SAMPLER_2D_ARRAY_SHADOW?s.push(o):r.push(o);s.length>0&&(this.seq=s.concat(r))}setValue(e,n,i,s){const r=this.map[n];r!==void 0&&r.setValue(e,i,s)}setOptional(e,n,i){const s=n[i];s!==void 0&&this.setValue(e,i,s)}static upload(e,n,i,s){for(let r=0,o=n.length;r!==o;++r){const a=n[r],c=i[a.id];c.needsUpdate!==!1&&a.setValue(e,c.value,s)}}static seqWithValue(e,n){const i=[];for(let s=0,r=e.length;s!==r;++s){const o=e[s];o.id in n&&i.push(o)}return i}}function bf(t,e,n){const i=t.createShader(e);return t.shaderSource(i,n),t.compileShader(i),i}const T1=37297;let R1=0;function w1(t,e){const n=t.split(`
|
|
4231
|
+
}`,depthTest:!1,depthWrite:!1}),h=new si(l,u),d=new HS(-1,1,1,-1,0,1);let f=null,_=null,x=!1,m,p=null,E=[],I=!1;this.setSize=function(b,w){o.setSize(b,w),a!==null&&a.setSize(b,w),c!==null&&c.setSize(b,w);for(let A=0;A<E.length;A++){const P=E[A];P.setSize&&P.setSize(b,w)}},this.setEffects=function(b){E=b,I=E.length>0&&E[0].isRenderPass===!0;const w=o.width,A=o.height;E.length>0&&a===null&&(a=new ei(w,A,{type:xi,depthBuffer:!1,stencilBuffer:!1}),c=new ei(w,A,{type:xi,depthBuffer:!1,stencilBuffer:!1}));for(let P=0;P<E.length;P++){const v=E[P];v.setSize&&v.setSize(w,A)}},this.begin=function(b,w){if(x||b.toneMapping===_i&&E.length===0)return!1;if(p=w,w!==null){const A=w.width,P=w.height;(o.width!==A||o.height!==P)&&this.setSize(A,P)}return I===!1&&b.setRenderTarget(o),m=b.toneMapping,b.toneMapping=_i,!0},this.hasRenderPass=function(){return I},this.end=function(b,w){b.toneMapping=m,x=!0;let A=o,P=a;for(let v=0;v<E.length;v++){const T=E[v];T.enabled!==!1&&(T.render(b,P,A,w),T.needsSwap!==!1&&(A=P,P=P===a?c:a))}if(f!==b.outputColorSpace||_!==b.toneMapping){f=b.outputColorSpace,_=b.toneMapping,u.defines={},ft.getTransfer(f)===Et&&(u.defines.SRGB_TRANSFER="");const v=O1[_];v&&(u.defines[v]=""),u.needsUpdate=!0}u.uniforms.tDiffuse.value=A.texture,b.setRenderTarget(p),b.render(h,d),p=null,x=!1},this.isCompositing=function(){return x},this.dispose=function(){o.dispose(),a!==null&&a.dispose(),c!==null&&c.dispose(),l.dispose(),u.dispose()}}const qS=new En,Eu=new fo(1,1),WS=new PS,ZS=new nA,XS=new OS,jf=[],Jf=[],Qf=new Float32Array(16),ep=new Float32Array(9),tp=new Float32Array(4);function Lr(t,e,n){const i=t[0];if(i<=0||i>0)return t;const s=e*n;let r=jf[s];if(r===void 0&&(r=new Float32Array(s),jf[s]=r),e!==0){i.toArray(r,0);for(let o=1,a=0;o!==e;++o)a+=n,t[o].toArray(r,a)}return r}function Qt(t,e){if(t.length!==e.length)return!1;for(let n=0,i=t.length;n<i;n++)if(t[n]!==e[n])return!1;return!0}function en(t,e){for(let n=0,i=e.length;n<i;n++)t[n]=e[n]}function mc(t,e){let n=Jf[e];n===void 0&&(n=new Int32Array(e),Jf[e]=n);for(let i=0;i!==e;++i)n[i]=t.allocateTextureUnit();return n}function k1(t,e){const n=this.cache;n[0]!==e&&(t.uniform1f(this.addr,e),n[0]=e)}function z1(t,e){const n=this.cache;if(e.x!==void 0)(n[0]!==e.x||n[1]!==e.y)&&(t.uniform2f(this.addr,e.x,e.y),n[0]=e.x,n[1]=e.y);else{if(Qt(n,e))return;t.uniform2fv(this.addr,e),en(n,e)}}function B1(t,e){const n=this.cache;if(e.x!==void 0)(n[0]!==e.x||n[1]!==e.y||n[2]!==e.z)&&(t.uniform3f(this.addr,e.x,e.y,e.z),n[0]=e.x,n[1]=e.y,n[2]=e.z);else if(e.r!==void 0)(n[0]!==e.r||n[1]!==e.g||n[2]!==e.b)&&(t.uniform3f(this.addr,e.r,e.g,e.b),n[0]=e.r,n[1]=e.g,n[2]=e.b);else{if(Qt(n,e))return;t.uniform3fv(this.addr,e),en(n,e)}}function H1(t,e){const n=this.cache;if(e.x!==void 0)(n[0]!==e.x||n[1]!==e.y||n[2]!==e.z||n[3]!==e.w)&&(t.uniform4f(this.addr,e.x,e.y,e.z,e.w),n[0]=e.x,n[1]=e.y,n[2]=e.z,n[3]=e.w);else{if(Qt(n,e))return;t.uniform4fv(this.addr,e),en(n,e)}}function V1(t,e){const n=this.cache,i=e.elements;if(i===void 0){if(Qt(n,e))return;t.uniformMatrix2fv(this.addr,!1,e),en(n,e)}else{if(Qt(n,i))return;tp.set(i),t.uniformMatrix2fv(this.addr,!1,tp),en(n,i)}}function G1(t,e){const n=this.cache,i=e.elements;if(i===void 0){if(Qt(n,e))return;t.uniformMatrix3fv(this.addr,!1,e),en(n,e)}else{if(Qt(n,i))return;ep.set(i),t.uniformMatrix3fv(this.addr,!1,ep),en(n,i)}}function $1(t,e){const n=this.cache,i=e.elements;if(i===void 0){if(Qt(n,e))return;t.uniformMatrix4fv(this.addr,!1,e),en(n,e)}else{if(Qt(n,i))return;Qf.set(i),t.uniformMatrix4fv(this.addr,!1,Qf),en(n,i)}}function q1(t,e){const n=this.cache;n[0]!==e&&(t.uniform1i(this.addr,e),n[0]=e)}function W1(t,e){const n=this.cache;if(e.x!==void 0)(n[0]!==e.x||n[1]!==e.y)&&(t.uniform2i(this.addr,e.x,e.y),n[0]=e.x,n[1]=e.y);else{if(Qt(n,e))return;t.uniform2iv(this.addr,e),en(n,e)}}function Z1(t,e){const n=this.cache;if(e.x!==void 0)(n[0]!==e.x||n[1]!==e.y||n[2]!==e.z)&&(t.uniform3i(this.addr,e.x,e.y,e.z),n[0]=e.x,n[1]=e.y,n[2]=e.z);else{if(Qt(n,e))return;t.uniform3iv(this.addr,e),en(n,e)}}function X1(t,e){const n=this.cache;if(e.x!==void 0)(n[0]!==e.x||n[1]!==e.y||n[2]!==e.z||n[3]!==e.w)&&(t.uniform4i(this.addr,e.x,e.y,e.z,e.w),n[0]=e.x,n[1]=e.y,n[2]=e.z,n[3]=e.w);else{if(Qt(n,e))return;t.uniform4iv(this.addr,e),en(n,e)}}function Y1(t,e){const n=this.cache;n[0]!==e&&(t.uniform1ui(this.addr,e),n[0]=e)}function K1(t,e){const n=this.cache;if(e.x!==void 0)(n[0]!==e.x||n[1]!==e.y)&&(t.uniform2ui(this.addr,e.x,e.y),n[0]=e.x,n[1]=e.y);else{if(Qt(n,e))return;t.uniform2uiv(this.addr,e),en(n,e)}}function j1(t,e){const n=this.cache;if(e.x!==void 0)(n[0]!==e.x||n[1]!==e.y||n[2]!==e.z)&&(t.uniform3ui(this.addr,e.x,e.y,e.z),n[0]=e.x,n[1]=e.y,n[2]=e.z);else{if(Qt(n,e))return;t.uniform3uiv(this.addr,e),en(n,e)}}function J1(t,e){const n=this.cache;if(e.x!==void 0)(n[0]!==e.x||n[1]!==e.y||n[2]!==e.z||n[3]!==e.w)&&(t.uniform4ui(this.addr,e.x,e.y,e.z,e.w),n[0]=e.x,n[1]=e.y,n[2]=e.z,n[3]=e.w);else{if(Qt(n,e))return;t.uniform4uiv(this.addr,e),en(n,e)}}function Q1(t,e,n){const i=this.cache,s=n.allocateTextureUnit();i[0]!==s&&(t.uniform1i(this.addr,s),i[0]=s);let r;this.type===t.SAMPLER_2D_SHADOW?(Eu.compareFunction=n.isReversedDepthBuffer()?Hd:Bd,r=Eu):r=qS,n.setTexture2D(e||r,s)}function eL(t,e,n){const i=this.cache,s=n.allocateTextureUnit();i[0]!==s&&(t.uniform1i(this.addr,s),i[0]=s),n.setTexture3D(e||ZS,s)}function tL(t,e,n){const i=this.cache,s=n.allocateTextureUnit();i[0]!==s&&(t.uniform1i(this.addr,s),i[0]=s),n.setTextureCube(e||XS,s)}function nL(t,e,n){const i=this.cache,s=n.allocateTextureUnit();i[0]!==s&&(t.uniform1i(this.addr,s),i[0]=s),n.setTexture2DArray(e||WS,s)}function iL(t){switch(t){case 5126:return k1;case 35664:return z1;case 35665:return B1;case 35666:return H1;case 35674:return V1;case 35675:return G1;case 35676:return $1;case 5124:case 35670:return q1;case 35667:case 35671:return W1;case 35668:case 35672:return Z1;case 35669:case 35673:return X1;case 5125:return Y1;case 36294:return K1;case 36295:return j1;case 36296:return J1;case 35678:case 36198:case 36298:case 36306:case 35682:return Q1;case 35679:case 36299:case 36307:return eL;case 35680:case 36300:case 36308:case 36293:return tL;case 36289:case 36303:case 36311:case 36292:return nL}}function sL(t,e){t.uniform1fv(this.addr,e)}function rL(t,e){const n=Lr(e,this.size,2);t.uniform2fv(this.addr,n)}function oL(t,e){const n=Lr(e,this.size,3);t.uniform3fv(this.addr,n)}function aL(t,e){const n=Lr(e,this.size,4);t.uniform4fv(this.addr,n)}function cL(t,e){const n=Lr(e,this.size,4);t.uniformMatrix2fv(this.addr,!1,n)}function lL(t,e){const n=Lr(e,this.size,9);t.uniformMatrix3fv(this.addr,!1,n)}function uL(t,e){const n=Lr(e,this.size,16);t.uniformMatrix4fv(this.addr,!1,n)}function dL(t,e){t.uniform1iv(this.addr,e)}function hL(t,e){t.uniform2iv(this.addr,e)}function fL(t,e){t.uniform3iv(this.addr,e)}function pL(t,e){t.uniform4iv(this.addr,e)}function mL(t,e){t.uniform1uiv(this.addr,e)}function gL(t,e){t.uniform2uiv(this.addr,e)}function _L(t,e){t.uniform3uiv(this.addr,e)}function SL(t,e){t.uniform4uiv(this.addr,e)}function vL(t,e,n){const i=this.cache,s=e.length,r=mc(n,s);Qt(i,r)||(t.uniform1iv(this.addr,r),en(i,r));let o;this.type===t.SAMPLER_2D_SHADOW?o=Eu:o=qS;for(let a=0;a!==s;++a)n.setTexture2D(e[a]||o,r[a])}function xL(t,e,n){const i=this.cache,s=e.length,r=mc(n,s);Qt(i,r)||(t.uniform1iv(this.addr,r),en(i,r));for(let o=0;o!==s;++o)n.setTexture3D(e[o]||ZS,r[o])}function yL(t,e,n){const i=this.cache,s=e.length,r=mc(n,s);Qt(i,r)||(t.uniform1iv(this.addr,r),en(i,r));for(let o=0;o!==s;++o)n.setTextureCube(e[o]||XS,r[o])}function bL(t,e,n){const i=this.cache,s=e.length,r=mc(n,s);Qt(i,r)||(t.uniform1iv(this.addr,r),en(i,r));for(let o=0;o!==s;++o)n.setTexture2DArray(e[o]||WS,r[o])}function ML(t){switch(t){case 5126:return sL;case 35664:return rL;case 35665:return oL;case 35666:return aL;case 35674:return cL;case 35675:return lL;case 35676:return uL;case 5124:case 35670:return dL;case 35667:case 35671:return hL;case 35668:case 35672:return fL;case 35669:case 35673:return pL;case 5125:return mL;case 36294:return gL;case 36295:return _L;case 36296:return SL;case 35678:case 36198:case 36298:case 36306:case 35682:return vL;case 35679:case 36299:case 36307:return xL;case 35680:case 36300:case 36308:case 36293:return yL;case 36289:case 36303:case 36311:case 36292:return bL}}class EL{constructor(e,n,i){this.id=e,this.addr=i,this.cache=[],this.type=n.type,this.setValue=iL(n.type)}}class TL{constructor(e,n,i){this.id=e,this.addr=i,this.cache=[],this.type=n.type,this.size=n.size,this.setValue=ML(n.type)}}class RL{constructor(e){this.id=e,this.seq=[],this.map={}}setValue(e,n,i){const s=this.seq;for(let r=0,o=s.length;r!==o;++r){const a=s[r];a.setValue(e,n[a.id],i)}}}const pl=/(\w+)(\])?(\[|\.)?/g;function np(t,e){t.seq.push(e),t.map[e.id]=e}function wL(t,e,n){const i=t.name,s=i.length;for(pl.lastIndex=0;;){const r=pl.exec(i),o=pl.lastIndex;let a=r[1];const c=r[2]==="]",l=r[3];if(c&&(a=a|0),l===void 0||l==="["&&o+2===s){np(n,l===void 0?new EL(a,t,e):new TL(a,t,e));break}else{let h=n.map[a];h===void 0&&(h=new RL(a),np(n,h)),n=h}}}class da{constructor(e,n){this.seq=[],this.map={};const i=e.getProgramParameter(n,e.ACTIVE_UNIFORMS);for(let o=0;o<i;++o){const a=e.getActiveUniform(n,o),c=e.getUniformLocation(n,a.name);wL(a,c,this)}const s=[],r=[];for(const o of this.seq)o.type===e.SAMPLER_2D_SHADOW||o.type===e.SAMPLER_CUBE_SHADOW||o.type===e.SAMPLER_2D_ARRAY_SHADOW?s.push(o):r.push(o);s.length>0&&(this.seq=s.concat(r))}setValue(e,n,i,s){const r=this.map[n];r!==void 0&&r.setValue(e,i,s)}setOptional(e,n,i){const s=n[i];s!==void 0&&this.setValue(e,i,s)}static upload(e,n,i,s){for(let r=0,o=n.length;r!==o;++r){const a=n[r],c=i[a.id];c.needsUpdate!==!1&&a.setValue(e,c.value,s)}}static seqWithValue(e,n){const i=[];for(let s=0,r=e.length;s!==r;++s){const o=e[s];o.id in n&&i.push(o)}return i}}function ip(t,e,n){const i=t.createShader(e);return t.shaderSource(i,n),t.compileShader(i),i}const AL=37297;let CL=0;function PL(t,e){const n=t.split(`
|
|
4232
4232
|
`),i=[],s=Math.max(e-6,0),r=Math.min(e+6,n.length);for(let o=s;o<r;o++){const a=o+1;i.push(`${a===e?">":" "} ${a}: ${n[o]}`)}return i.join(`
|
|
4233
|
-
`)}const
|
|
4233
|
+
`)}const sp=new Ke;function LL(t){ft._getMatrix(sp,ft.workingColorSpace,t);const e=`mat3( ${sp.elements.map(n=>n.toFixed(4))} )`;switch(ft.getTransfer(t)){case Ca:return[e,"LinearTransferOETF"];case Et:return[e,"sRGBTransferOETF"];default:return $e("WebGLProgram: Unsupported color space: ",t),[e,"LinearTransferOETF"]}}function rp(t,e,n){const i=t.getShaderParameter(e,t.COMPILE_STATUS),r=(t.getShaderInfoLog(e)||"").trim();if(i&&r==="")return"";const o=/ERROR: 0:(\d+)/.exec(r);if(o){const a=parseInt(o[1]);return n.toUpperCase()+`
|
|
4234
4234
|
|
|
4235
4235
|
`+r+`
|
|
4236
4236
|
|
|
4237
|
-
`+
|
|
4238
|
-
`)}const
|
|
4239
|
-
`)}function
|
|
4240
|
-
`)}function
|
|
4241
|
-
`)}function
|
|
4237
|
+
`+PL(t.getShaderSource(e),a)}else return r}function IL(t,e){const n=LL(e);return[`vec4 ${t}( vec4 value ) {`,` return ${n[1]}( vec4( value.rgb * ${n[0]}, value.a ) );`,"}"].join(`
|
|
4238
|
+
`)}const NL={[fS]:"Linear",[pS]:"Reinhard",[mS]:"Cineon",[gS]:"ACESFilmic",[SS]:"AgX",[vS]:"Neutral",[_S]:"Custom"};function DL(t,e){const n=NL[e];return n===void 0?($e("WebGLProgram: Unsupported toneMapping:",e),"vec3 "+t+"( vec3 color ) { return LinearToneMapping( color ); }"):"vec3 "+t+"( vec3 color ) { return "+n+"ToneMapping( color ); }"}const ta=new H;function UL(){ft.getLuminanceCoefficients(ta);const t=ta.x.toFixed(4),e=ta.y.toFixed(4),n=ta.z.toFixed(4);return["float luminance( const in vec3 rgb ) {",` const vec3 weights = vec3( ${t}, ${e}, ${n} );`," return dot( weights, rgb );","}"].join(`
|
|
4239
|
+
`)}function OL(t){return[t.extensionClipCullDistance?"#extension GL_ANGLE_clip_cull_distance : require":"",t.extensionMultiDraw?"#extension GL_ANGLE_multi_draw : require":""].filter(qr).join(`
|
|
4240
|
+
`)}function FL(t){const e=[];for(const n in t){const i=t[n];i!==!1&&e.push("#define "+n+" "+i)}return e.join(`
|
|
4241
|
+
`)}function kL(t,e){const n={},i=t.getProgramParameter(e,t.ACTIVE_ATTRIBUTES);for(let s=0;s<i;s++){const r=t.getActiveAttrib(e,s),o=r.name;let a=1;r.type===t.FLOAT_MAT2&&(a=2),r.type===t.FLOAT_MAT3&&(a=3),r.type===t.FLOAT_MAT4&&(a=4),n[o]={type:r.type,location:t.getAttribLocation(e,o),locationSize:a}}return n}function qr(t){return t!==""}function op(t,e){const n=e.numSpotLightShadows+e.numSpotLightMaps-e.numSpotLightShadowsWithMaps;return t.replace(/NUM_SUN_LIGHTS/g,e.numSunLights).replace(/NUM_DIR_LIGHTS/g,e.numDirLights).replace(/NUM_SPOT_LIGHTS/g,e.numSpotLights).replace(/NUM_SPOT_LIGHT_MAPS/g,e.numSpotLightMaps).replace(/NUM_SPOT_LIGHT_COORDS/g,n).replace(/NUM_RECT_AREA_LIGHTS/g,e.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g,e.numPointLights).replace(/NUM_HEMI_LIGHTS/g,e.numHemiLights).replace(/NUM_SUN_LIGHT_SHADOWS/g,e.numSunLightShadows).replace(/NUM_DIR_LIGHT_SHADOWS/g,e.numDirLightShadows).replace(/NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS/g,e.numSpotLightShadowsWithMaps).replace(/NUM_SPOT_LIGHT_SHADOWS/g,e.numSpotLightShadows).replace(/NUM_POINT_LIGHT_SHADOWS/g,e.numPointLightShadows)}function ap(t,e){return t.replace(/NUM_CLIPPING_PLANES/g,e.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,e.numClippingPlanes-e.numClipIntersection)}const zL=/^[ \t]*#include +<([\w\d./]+)>/gm;function Tu(t){return t.replace(zL,HL)}const BL=new Map;function HL(t,e){let n=nt[e];if(n===void 0){const i=BL.get(e);if(i!==void 0)n=nt[i],$e('WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',e,i);else throw new Error("THREE.WebGLProgram: Can not resolve #include <"+e+">")}return Tu(n)}const VL=/#pragma unroll_loop_start\s+for\s*\(\s*int\s+i\s*=\s*(\d+)\s*;\s*i\s*<\s*(\d+)\s*;\s*i\s*\+\+\s*\)\s*{([\s\S]+?)}\s+#pragma unroll_loop_end/g;function cp(t){return t.replace(VL,GL)}function GL(t,e,n,i){let s="";for(let r=parseInt(e);r<parseInt(n);r++)s+=i.replace(/\[\s*i\s*\]/g,"[ "+r+" ]").replace(/UNROLLED_LOOP_INDEX/g,r);return s}function lp(t){let e=`precision ${t.precision} float;
|
|
4242
4242
|
precision ${t.precision} int;
|
|
4243
4243
|
precision ${t.precision} sampler2D;
|
|
4244
4244
|
precision ${t.precision} samplerCube;
|
|
@@ -4258,30 +4258,30 @@ void main() {
|
|
|
4258
4258
|
`;return t.precision==="highp"?e+=`
|
|
4259
4259
|
#define HIGH_PRECISION`:t.precision==="mediump"?e+=`
|
|
4260
4260
|
#define MEDIUM_PRECISION`:t.precision==="lowp"&&(e+=`
|
|
4261
|
-
#define LOW_PRECISION`),e}const
|
|
4262
|
-
`:"";n.isRawShaderMaterial?(m=["#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,_].filter(
|
|
4261
|
+
#define LOW_PRECISION`),e}const $L={[oa]:"SHADOWMAP_TYPE_PCF",[$r]:"SHADOWMAP_TYPE_VSM"};function qL(t){return $L[t.shadowMapType]||"SHADOWMAP_TYPE_BASIC"}const WL={[Cs]:"ENVMAP_TYPE_CUBE",[vr]:"ENVMAP_TYPE_CUBE",[lc]:"ENVMAP_TYPE_CUBE_UV"};function ZL(t){return t.envMap===!1?"ENVMAP_TYPE_CUBE":WL[t.envMapMode]||"ENVMAP_TYPE_CUBE"}const XL={[vr]:"ENVMAP_MODE_REFRACTION"};function YL(t){return t.envMap===!1?"ENVMAP_MODE_REFLECTION":XL[t.envMapMode]||"ENVMAP_MODE_REFLECTION"}const KL={[hS]:"ENVMAP_BLENDING_MULTIPLY",[Sw]:"ENVMAP_BLENDING_MIX",[vw]:"ENVMAP_BLENDING_ADD"};function jL(t){return t.envMap===!1?"ENVMAP_BLENDING_NONE":KL[t.combine]||"ENVMAP_BLENDING_NONE"}function JL(t){const e=t.envMapCubeUVHeight;if(e===null)return null;const n=Math.log2(e)-2,i=1/e;return{texelWidth:1/(3*Math.max(Math.pow(2,n),112)),texelHeight:i,maxMip:n}}function QL(t,e,n,i){const s=t.getContext(),r=n.defines;let o=n.vertexShader,a=n.fragmentShader;const c=qL(n),l=ZL(n),u=YL(n),h=jL(n),d=JL(n),f=OL(n),_=FL(r),x=s.createProgram();let m,p,E=n.glslVersion?"#version "+n.glslVersion+`
|
|
4262
|
+
`:"";n.isRawShaderMaterial?(m=["#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,_].filter(qr).join(`
|
|
4263
4263
|
`),m.length>0&&(m+=`
|
|
4264
|
-
`),p=["#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,_].filter(
|
|
4264
|
+
`),p=["#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,_].filter(qr).join(`
|
|
4265
4265
|
`),p.length>0&&(p+=`
|
|
4266
|
-
`)):(m=[
|
|
4267
|
-
`].filter(
|
|
4268
|
-
`),p=[
|
|
4269
|
-
`].filter(
|
|
4270
|
-
`)),o=
|
|
4266
|
+
`)):(m=[lp(n),"#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,_,n.extensionClipCullDistance?"#define USE_CLIP_DISTANCE":"",n.batching?"#define USE_BATCHING":"",n.batchingColor?"#define USE_BATCHING_COLOR":"",n.instancing?"#define USE_INSTANCING":"",n.instancingColor?"#define USE_INSTANCING_COLOR":"",n.instancingMorph?"#define USE_INSTANCING_MORPH":"",n.useFog&&n.fog?"#define USE_FOG":"",n.useFog&&n.fogExp2?"#define FOG_EXP2":"",n.map?"#define USE_MAP":"",n.envMap?"#define USE_ENVMAP":"",n.envMap?"#define "+u:"",n.lightMap?"#define USE_LIGHTMAP":"",n.aoMap?"#define USE_AOMAP":"",n.bumpMap?"#define USE_BUMPMAP":"",n.normalMap?"#define USE_NORMALMAP":"",n.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",n.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",n.displacementMap?"#define USE_DISPLACEMENTMAP":"",n.emissiveMap?"#define USE_EMISSIVEMAP":"",n.anisotropy?"#define USE_ANISOTROPY":"",n.anisotropyMap?"#define USE_ANISOTROPYMAP":"",n.clearcoatMap?"#define USE_CLEARCOATMAP":"",n.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",n.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",n.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",n.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",n.specularMap?"#define USE_SPECULARMAP":"",n.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",n.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.alphaHash?"#define USE_ALPHAHASH":"",n.transmission?"#define USE_TRANSMISSION":"",n.transmissionMap?"#define USE_TRANSMISSIONMAP":"",n.thicknessMap?"#define USE_THICKNESSMAP":"",n.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",n.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",n.mapUv?"#define MAP_UV "+n.mapUv:"",n.alphaMapUv?"#define ALPHAMAP_UV "+n.alphaMapUv:"",n.lightMapUv?"#define LIGHTMAP_UV "+n.lightMapUv:"",n.aoMapUv?"#define AOMAP_UV "+n.aoMapUv:"",n.emissiveMapUv?"#define EMISSIVEMAP_UV "+n.emissiveMapUv:"",n.bumpMapUv?"#define BUMPMAP_UV "+n.bumpMapUv:"",n.normalMapUv?"#define NORMALMAP_UV "+n.normalMapUv:"",n.displacementMapUv?"#define DISPLACEMENTMAP_UV "+n.displacementMapUv:"",n.metalnessMapUv?"#define METALNESSMAP_UV "+n.metalnessMapUv:"",n.roughnessMapUv?"#define ROUGHNESSMAP_UV "+n.roughnessMapUv:"",n.anisotropyMapUv?"#define ANISOTROPYMAP_UV "+n.anisotropyMapUv:"",n.clearcoatMapUv?"#define CLEARCOATMAP_UV "+n.clearcoatMapUv:"",n.clearcoatNormalMapUv?"#define CLEARCOAT_NORMALMAP_UV "+n.clearcoatNormalMapUv:"",n.clearcoatRoughnessMapUv?"#define CLEARCOAT_ROUGHNESSMAP_UV "+n.clearcoatRoughnessMapUv:"",n.iridescenceMapUv?"#define IRIDESCENCEMAP_UV "+n.iridescenceMapUv:"",n.iridescenceThicknessMapUv?"#define IRIDESCENCE_THICKNESSMAP_UV "+n.iridescenceThicknessMapUv:"",n.sheenColorMapUv?"#define SHEEN_COLORMAP_UV "+n.sheenColorMapUv:"",n.sheenRoughnessMapUv?"#define SHEEN_ROUGHNESSMAP_UV "+n.sheenRoughnessMapUv:"",n.specularMapUv?"#define SPECULARMAP_UV "+n.specularMapUv:"",n.specularColorMapUv?"#define SPECULAR_COLORMAP_UV "+n.specularColorMapUv:"",n.specularIntensityMapUv?"#define SPECULAR_INTENSITYMAP_UV "+n.specularIntensityMapUv:"",n.transmissionMapUv?"#define TRANSMISSIONMAP_UV "+n.transmissionMapUv:"",n.thicknessMapUv?"#define THICKNESSMAP_UV "+n.thicknessMapUv:"",n.vertexTangents&&n.flatShading===!1?"#define USE_TANGENT":"",n.vertexNormals?"#define HAS_NORMAL":"",n.vertexColors?"#define USE_COLOR":"",n.vertexAlphas?"#define USE_COLOR_ALPHA":"",n.vertexUv1s?"#define USE_UV1":"",n.vertexUv2s?"#define USE_UV2":"",n.vertexUv3s?"#define USE_UV3":"",n.pointsUvs?"#define USE_POINTS_UV":"",n.flatShading?"#define FLAT_SHADED":"",n.skinning?"#define USE_SKINNING":"",n.morphTargets?"#define USE_MORPHTARGETS":"",n.morphNormals&&n.flatShading===!1?"#define USE_MORPHNORMALS":"",n.morphColors?"#define USE_MORPHCOLORS":"",n.morphTargetsCount>0?"#define MORPHTARGETS_TEXTURE_STRIDE "+n.morphTextureStride:"",n.morphTargetsCount>0?"#define MORPHTARGETS_COUNT "+n.morphTargetsCount:"",n.doubleSided?"#define DOUBLE_SIDED":"",n.flipSided?"#define FLIP_SIDED":"",n.shadowMapEnabled?"#define USE_SHADOWMAP":"",n.shadowMapEnabled?"#define "+c:"",n.sizeAttenuation?"#define USE_SIZEATTENUATION":"",n.numLightProbes>0?"#define USE_LIGHT_PROBES":"",n.logarithmicDepthBuffer?"#define USE_LOGARITHMIC_DEPTH_BUFFER":"",n.reversedDepthBuffer?"#define USE_REVERSED_DEPTH_BUFFER":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING"," attribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR"," attribute vec3 instanceColor;","#endif","#ifdef USE_INSTANCING_MORPH"," uniform sampler2D morphTexture;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_UV1"," attribute vec2 uv1;","#endif","#ifdef USE_UV2"," attribute vec2 uv2;","#endif","#ifdef USE_UV3"," attribute vec2 uv3;","#endif","#ifdef USE_TANGENT"," attribute vec4 tangent;","#endif","#if defined( USE_COLOR_ALPHA )"," attribute vec4 color;","#elif defined( USE_COLOR )"," attribute vec3 color;","#endif","#ifdef USE_SKINNING"," attribute vec4 skinIndex;"," attribute vec4 skinWeight;","#endif",`
|
|
4267
|
+
`].filter(qr).join(`
|
|
4268
|
+
`),p=[lp(n),"#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,_,n.useFog&&n.fog?"#define USE_FOG":"",n.useFog&&n.fogExp2?"#define FOG_EXP2":"",n.alphaToCoverage?"#define ALPHA_TO_COVERAGE":"",n.map?"#define USE_MAP":"",n.matcap?"#define USE_MATCAP":"",n.envMap?"#define USE_ENVMAP":"",n.envMap?"#define "+l:"",n.envMap?"#define "+u:"",n.envMap?"#define "+h:"",d?"#define CUBEUV_TEXEL_WIDTH "+d.texelWidth:"",d?"#define CUBEUV_TEXEL_HEIGHT "+d.texelHeight:"",d?"#define CUBEUV_MAX_MIP "+d.maxMip+".0":"",n.lightMap?"#define USE_LIGHTMAP":"",n.aoMap?"#define USE_AOMAP":"",n.bumpMap?"#define USE_BUMPMAP":"",n.normalMap?"#define USE_NORMALMAP":"",n.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",n.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",n.packedNormalMap?"#define USE_PACKED_NORMALMAP":"",n.emissiveMap?"#define USE_EMISSIVEMAP":"",n.anisotropy?"#define USE_ANISOTROPY":"",n.anisotropyMap?"#define USE_ANISOTROPYMAP":"",n.clearcoat?"#define USE_CLEARCOAT":"",n.clearcoatMap?"#define USE_CLEARCOATMAP":"",n.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",n.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",n.dispersion?"#define USE_DISPERSION":"",n.retroreflection?"#define USE_RETROREFLECTION":"",n.iridescence?"#define USE_IRIDESCENCE":"",n.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",n.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",n.specularMap?"#define USE_SPECULARMAP":"",n.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",n.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.alphaTest?"#define USE_ALPHATEST":"",n.alphaHash?"#define USE_ALPHAHASH":"",n.sheen?"#define USE_SHEEN":"",n.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",n.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",n.transmission?"#define USE_TRANSMISSION":"",n.transmissionMap?"#define USE_TRANSMISSIONMAP":"",n.thicknessMap?"#define USE_THICKNESSMAP":"",n.vertexTangents&&n.flatShading===!1?"#define USE_TANGENT":"",n.vertexColors||n.instancingColor?"#define USE_COLOR":"",n.vertexAlphas||n.batchingColor?"#define USE_COLOR_ALPHA":"",n.vertexUv1s?"#define USE_UV1":"",n.vertexUv2s?"#define USE_UV2":"",n.vertexUv3s?"#define USE_UV3":"",n.pointsUvs?"#define USE_POINTS_UV":"",n.gradientMap?"#define USE_GRADIENTMAP":"",n.flatShading?"#define FLAT_SHADED":"",n.doubleSided?"#define DOUBLE_SIDED":"",n.flipSided?"#define FLIP_SIDED":"",n.shadowMapEnabled?"#define USE_SHADOWMAP":"",n.shadowMapEnabled?"#define "+c:"",n.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",n.numLightProbes>0?"#define USE_LIGHT_PROBES":"",n.numLightProbeGrids>0?"#define USE_LIGHT_PROBES_GRID":"",n.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",n.decodeVideoTextureEmissive?"#define DECODE_VIDEO_TEXTURE_EMISSIVE":"",n.logarithmicDepthBuffer?"#define USE_LOGARITHMIC_DEPTH_BUFFER":"",n.reversedDepthBuffer?"#define USE_REVERSED_DEPTH_BUFFER":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",n.toneMapping!==_i?"#define TONE_MAPPING":"",n.toneMapping!==_i?nt.tonemapping_pars_fragment:"",n.toneMapping!==_i?DL("toneMapping",n.toneMapping):"",n.dithering?"#define DITHERING":"",n.opaque?"#define OPAQUE":"",nt.colorspace_pars_fragment,IL("linearToOutputTexel",n.outputColorSpace),UL(),n.useDepthPacking?"#define DEPTH_PACKING "+n.depthPacking:"",`
|
|
4269
|
+
`].filter(qr).join(`
|
|
4270
|
+
`)),o=Tu(o),o=op(o,n),o=ap(o,n),a=Tu(a),a=op(a,n),a=ap(a,n),o=cp(o),a=cp(a),n.isRawShaderMaterial!==!0&&(E=`#version 300 es
|
|
4271
4271
|
`,m=[f,"#define attribute in","#define varying out","#define texture2D texture"].join(`
|
|
4272
4272
|
`)+`
|
|
4273
|
-
`+m,p=["#define varying in",n.glslVersion===
|
|
4273
|
+
`+m,p=["#define varying in",n.glslVersion===Sf?"":"layout(location = 0) out highp vec4 pc_fragColor;",n.glslVersion===Sf?"":"#define gl_FragColor pc_fragColor","#define gl_FragDepthEXT gl_FragDepth","#define texture2D texture","#define textureCube texture","#define texture2DProj textureProj","#define texture2DLodEXT textureLod","#define texture2DProjLodEXT textureProjLod","#define textureCubeLodEXT textureLod","#define texture2DGradEXT textureGrad","#define texture2DProjGradEXT textureProjGrad","#define textureCubeGradEXT textureGrad"].join(`
|
|
4274
4274
|
`)+`
|
|
4275
|
-
`+p);const
|
|
4275
|
+
`+p);const I=E+m+o,b=E+p+a,w=ip(s,s.VERTEX_SHADER,I),A=ip(s,s.FRAGMENT_SHADER,b);s.attachShader(x,w),s.attachShader(x,A),n.index0AttributeName!==void 0?s.bindAttribLocation(x,0,n.index0AttributeName):n.hasPositionAttribute===!0&&s.bindAttribLocation(x,0,"position"),s.linkProgram(x);function P(N){if(t.debug.checkShaderErrors){const k=s.getProgramInfoLog(x)||"",q=s.getShaderInfoLog(w)||"",U=s.getShaderInfoLog(A)||"",V=k.trim(),Q=q.trim(),X=U.trim();let ce=!0,j=!0;if(s.getProgramParameter(x,s.LINK_STATUS)===!1)if(ce=!1,typeof t.debug.onShaderError=="function")t.debug.onShaderError(s,x,w,A);else{const se=rp(s,w,"vertex"),oe=rp(s,A,"fragment");vt("WebGLProgram: Shader Error "+s.getError()+" - VALIDATE_STATUS "+s.getProgramParameter(x,s.VALIDATE_STATUS)+`
|
|
4276
4276
|
|
|
4277
4277
|
Material Name: `+N.name+`
|
|
4278
4278
|
Material Type: `+N.type+`
|
|
4279
4279
|
|
|
4280
4280
|
Program Info Log: `+V+`
|
|
4281
4281
|
`+se+`
|
|
4282
|
-
`+oe)}else V!==""?Ge("WebGLProgram: Program Info Log:",V):(Q===""||X==="")&&(j=!1);j&&(N.diagnostics={runnable:ce,programLog:V,vertexShader:{log:Q,prefix:m},fragmentShader:{log:X,prefix:p}})}s.deleteShader(w),s.deleteShader(A),v=new ea(s,x),T=U1(s,x)}let v;this.getUniforms=function(){return v===void 0&&P(this),v};let T;this.getAttributes=function(){return T===void 0&&P(this),T};let I=n.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return I===!1&&(I=s.getProgramParameter(x,T1)),I},this.destroy=function(){i.releaseStatesOfProgram(this),s.deleteProgram(x),this.program=void 0},this.type=n.shaderType,this.name=n.shaderName,this.id=R1++,this.cacheKey=e,this.usedTimes=1,this.program=x,this.vertexShader=w,this.fragmentShader=A,this}let j1=0;class J1{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e,n,i){const s=this._getShaderCacheForMaterial(e);return s.has(n)===!1&&(s.add(n),n.usedTimes++),s.has(i)===!1&&(s.add(i),i.usedTimes++),this}remove(e){const n=this.materialCache.get(e);for(const i of n)i.usedTimes--,i.usedTimes===0&&this.shaderCache.delete(i.code);return this.materialCache.delete(e),this}getVertexShaderStage(e){return this._getShaderStage(e.vertexShader)}getFragmentShaderStage(e){return this._getShaderStage(e.fragmentShader)}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(e){const n=this.materialCache;let i=n.get(e);return i===void 0&&(i=new Set,n.set(e,i)),i}_getShaderStage(e){const n=this.shaderCache;let i=n.get(e);return i===void 0&&(i=new Q1(e),n.set(e,i)),i}}class Q1{constructor(e){this.id=j1++,this.code=e,this.usedTimes=0}}function eI(t){return t===ys||t===ma||t===ga}function tI(t,e,n,i,s,r){const o=new $_,a=new J1,c=new Set,l=[],u=new Map,h=i.logarithmicDepthBuffer;let d=i.precision;const f={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distance",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"toon",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite"};function _(v){return c.add(v),v===0?"uv":`uv${v}`}function x(v,T,I,N,k,$){const U=N.fog,V=k.geometry,Q=v.isMeshStandardMaterial||v.isMeshLambertMaterial||v.isMeshPhongMaterial?N.environment:null,X=v.isMeshStandardMaterial||v.isMeshLambertMaterial&&!v.envMap||v.isMeshPhongMaterial&&!v.envMap,ce=e.get(v.envMap||Q,X),j=ce&&ce.mapping===Ka?ce.image.height:null,se=f[v.type];v.precision!==null&&(d=i.getMaxPrecision(v.precision),d!==v.precision&&Ge("WebGLProgram.getParameters:",v.precision,"not supported, using",d,"instead."));const oe=V.morphAttributes.position||V.morphAttributes.normal||V.morphAttributes.color,Fe=oe!==void 0?oe.length:0;let Le=0;V.morphAttributes.position!==void 0&&(Le=1),V.morphAttributes.normal!==void 0&&(Le=2),V.morphAttributes.color!==void 0&&(Le=3);let ft,et,je,Y;if(se){const gt=ci[se];ft=gt.vertexShader,et=gt.fragmentShader}else{ft=v.vertexShader,et=v.fragmentShader;const gt=a.getVertexShaderStage(v),at=a.getFragmentShaderStage(v);a.update(v,gt,at),je=gt.id,Y=at.id}const re=t.getRenderTarget(),Re=t.state.buffers.depth.getReversed(),Ve=k.isInstancedMesh===!0,Me=k.isBatchedMesh===!0,$e=!!v.map,Ct=!!v.matcap,Ze=!!ce,it=!!v.aoMap,_t=!!v.lightMap,Je=!!v.bumpMap&&v.wireframe===!1,vt=!!v.normalMap,Ut=!!v.displacementMap,qt=!!v.emissiveMap,bt=!!v.metalnessMap,Pt=!!v.roughnessMap,F=v.anisotropy>0,zt=v.clearcoat>0,lt=v.dispersion>0,R=v.retroreflectivity>0,S=v.iridescence>0,z=v.sheen>0,Z=v.transmission>0,K=F&&!!v.anisotropyMap,le=zt&&!!v.clearcoatMap,de=zt&&!!v.clearcoatNormalMap,J=zt&&!!v.clearcoatRoughnessMap,ne=S&&!!v.iridescenceMap,he=S&&!!v.iridescenceThicknessMap,Ne=z&&!!v.sheenColorMap,ue=z&&!!v.sheenRoughnessMap,me=!!v.specularMap,Pe=!!v.specularColorMap,ke=!!v.specularIntensityMap,qe=Z&&!!v.transmissionMap,O=Z&&!!v.thicknessMap,fe=!!v.gradientMap,te=!!v.alphaMap,ge=v.alphaTest>0,ye=!!v.alphaHash,ie=!!v.extensions;let De=hi;v.toneMapped&&(re===null||re.isXRRenderTarget===!0)&&(De=t.toneMapping);const Ce={shaderID:se,shaderType:v.type,shaderName:v.name,vertexShader:ft,fragmentShader:et,defines:v.defines,customVertexShaderID:je,customFragmentShaderID:Y,isRawShaderMaterial:v.isRawShaderMaterial===!0,glslVersion:v.glslVersion,precision:d,batching:Me,batchingColor:Me&&k._colorsTexture!==null,instancing:Ve,instancingColor:Ve&&k.instanceColor!==null,instancingMorph:Ve&&k.morphTexture!==null,outputColorSpace:re===null?t.outputColorSpace:re.isXRRenderTarget===!0?re.texture.colorSpace:dt.workingColorSpace,alphaToCoverage:!!v.alphaToCoverage,map:$e,matcap:Ct,envMap:Ze,envMapMode:Ze&&ce.mapping,envMapCubeUVHeight:j,aoMap:it,lightMap:_t,bumpMap:Je,normalMap:vt,displacementMap:Ut,emissiveMap:qt,normalMapObjectSpace:vt&&v.normalMapType===vR,normalMapTangentSpace:vt&&v.normalMapType===Uh,packedNormalMap:vt&&v.normalMapType===Uh&&eI(v.normalMap.format),metalnessMap:bt,roughnessMap:Pt,anisotropy:F,anisotropyMap:K,clearcoat:zt,clearcoatMap:le,clearcoatNormalMap:de,clearcoatRoughnessMap:J,dispersion:lt,retroreflection:R,iridescence:S,iridescenceMap:ne,iridescenceThicknessMap:he,sheen:z,sheenColorMap:Ne,sheenRoughnessMap:ue,specularMap:me,specularColorMap:Pe,specularIntensityMap:ke,transmission:Z,transmissionMap:qe,thicknessMap:O,gradientMap:fe,opaque:v.transparent===!1&&v.blending===Fr&&v.alphaToCoverage===!1,alphaMap:te,alphaTest:ge,alphaHash:ye,combine:v.combine,mapUv:$e&&_(v.map.channel),aoMapUv:it&&_(v.aoMap.channel),lightMapUv:_t&&_(v.lightMap.channel),bumpMapUv:Je&&_(v.bumpMap.channel),normalMapUv:vt&&_(v.normalMap.channel),displacementMapUv:Ut&&_(v.displacementMap.channel),emissiveMapUv:qt&&_(v.emissiveMap.channel),metalnessMapUv:bt&&_(v.metalnessMap.channel),roughnessMapUv:Pt&&_(v.roughnessMap.channel),anisotropyMapUv:K&&_(v.anisotropyMap.channel),clearcoatMapUv:le&&_(v.clearcoatMap.channel),clearcoatNormalMapUv:de&&_(v.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:J&&_(v.clearcoatRoughnessMap.channel),iridescenceMapUv:ne&&_(v.iridescenceMap.channel),iridescenceThicknessMapUv:he&&_(v.iridescenceThicknessMap.channel),sheenColorMapUv:Ne&&_(v.sheenColorMap.channel),sheenRoughnessMapUv:ue&&_(v.sheenRoughnessMap.channel),specularMapUv:me&&_(v.specularMap.channel),specularColorMapUv:Pe&&_(v.specularColorMap.channel),specularIntensityMapUv:ke&&_(v.specularIntensityMap.channel),transmissionMapUv:qe&&_(v.transmissionMap.channel),thicknessMapUv:O&&_(v.thicknessMap.channel),alphaMapUv:te&&_(v.alphaMap.channel),vertexTangents:!!V.attributes.tangent&&(vt||F),vertexNormals:!!V.attributes.normal,vertexColors:v.vertexColors,vertexAlphas:v.vertexColors===!0&&!!V.attributes.color&&V.attributes.color.itemSize===4,pointsUvs:k.isPoints===!0&&!!V.attributes.uv&&($e||te),fog:!!U,useFog:v.fog===!0,fogExp2:!!U&&U.isFogExp2,flatShading:v.wireframe===!1&&(v.flatShading===!0||V.attributes.normal===void 0&&vt===!1&&(v.isMeshLambertMaterial||v.isMeshPhongMaterial||v.isMeshStandardMaterial||v.isMeshPhysicalMaterial)),sizeAttenuation:v.sizeAttenuation===!0,logarithmicDepthBuffer:h,reversedDepthBuffer:Re,skinning:k.isSkinnedMesh===!0,hasPositionAttribute:V.attributes.position!==void 0,morphTargets:V.morphAttributes.position!==void 0,morphNormals:V.morphAttributes.normal!==void 0,morphColors:V.morphAttributes.color!==void 0,morphTargetsCount:Fe,morphTextureStride:Le,numSunLights:T.sun.length,numDirLights:T.directional.length,numPointLights:T.point.length,numSpotLights:T.spot.length,numSpotLightMaps:T.spotLightMap.length,numRectAreaLights:T.rectArea.length,numHemiLights:T.hemi.length,numSunLightShadows:T.sunShadowMap.length,numDirLightShadows:T.directionalShadowMap.length,numPointLightShadows:T.pointShadowMap.length,numSpotLightShadows:T.spotShadowMap.length,numSpotLightShadowsWithMaps:T.numSpotLightShadowsWithMaps,numLightProbes:T.numLightProbes,numLightProbeGrids:$.length,numClippingPlanes:r.numPlanes,numClipIntersection:r.numIntersection,dithering:v.dithering,shadowMapEnabled:t.shadowMap.enabled&&I.length>0,shadowMapType:t.shadowMap.type,toneMapping:De,decodeVideoTexture:$e&&v.map.isVideoTexture===!0&&dt.getTransfer(v.map.colorSpace)===Mt,decodeVideoTextureEmissive:qt&&v.emissiveMap.isVideoTexture===!0&&dt.getTransfer(v.emissiveMap.colorSpace)===Mt,premultipliedAlpha:v.premultipliedAlpha,doubleSided:v.side===wi,flipSided:v.side===Rn,useDepthPacking:v.depthPacking>=0,depthPacking:v.depthPacking||0,index0AttributeName:v.index0AttributeName,extensionClipCullDistance:ie&&v.extensions.clipCullDistance===!0&&n.has("WEBGL_clip_cull_distance"),extensionMultiDraw:(ie&&v.extensions.multiDraw===!0||Me)&&n.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:n.has("KHR_parallel_shader_compile"),customProgramCacheKey:v.customProgramCacheKey()};return Ce.vertexUv1s=c.has(1),Ce.vertexUv2s=c.has(2),Ce.vertexUv3s=c.has(3),c.clear(),Ce}function m(v){const T=[];if(v.shaderID?T.push(v.shaderID):(T.push(v.customVertexShaderID),T.push(v.customFragmentShaderID)),v.defines!==void 0)for(const I in v.defines)T.push(I),T.push(v.defines[I]);return v.isRawShaderMaterial===!1&&(p(T,v),E(T,v),T.push(t.outputColorSpace)),T.push(v.customProgramCacheKey),T.join()}function p(v,T){v.push(T.precision),v.push(T.outputColorSpace),v.push(T.envMapMode),v.push(T.envMapCubeUVHeight),v.push(T.mapUv),v.push(T.alphaMapUv),v.push(T.lightMapUv),v.push(T.aoMapUv),v.push(T.bumpMapUv),v.push(T.normalMapUv),v.push(T.displacementMapUv),v.push(T.emissiveMapUv),v.push(T.metalnessMapUv),v.push(T.roughnessMapUv),v.push(T.anisotropyMapUv),v.push(T.clearcoatMapUv),v.push(T.clearcoatNormalMapUv),v.push(T.clearcoatRoughnessMapUv),v.push(T.iridescenceMapUv),v.push(T.iridescenceThicknessMapUv),v.push(T.sheenColorMapUv),v.push(T.sheenRoughnessMapUv),v.push(T.specularMapUv),v.push(T.specularColorMapUv),v.push(T.specularIntensityMapUv),v.push(T.transmissionMapUv),v.push(T.thicknessMapUv),v.push(T.combine),v.push(T.fogExp2),v.push(T.sizeAttenuation),v.push(T.morphTargetsCount),v.push(T.morphAttributeCount),v.push(T.numSunLights),v.push(T.numDirLights),v.push(T.numPointLights),v.push(T.numSpotLights),v.push(T.numSpotLightMaps),v.push(T.numHemiLights),v.push(T.numRectAreaLights),v.push(T.numSunLightShadows),v.push(T.numDirLightShadows),v.push(T.numPointLightShadows),v.push(T.numSpotLightShadows),v.push(T.numSpotLightShadowsWithMaps),v.push(T.numLightProbes),v.push(T.shadowMapType),v.push(T.toneMapping),v.push(T.numClippingPlanes),v.push(T.numClipIntersection),v.push(T.depthPacking)}function E(v,T){o.disableAll(),T.instancing&&o.enable(0),T.instancingColor&&o.enable(1),T.instancingMorph&&o.enable(2),T.matcap&&o.enable(3),T.envMap&&o.enable(4),T.normalMapObjectSpace&&o.enable(5),T.normalMapTangentSpace&&o.enable(6),T.clearcoat&&o.enable(7),T.iridescence&&o.enable(8),T.alphaTest&&o.enable(9),T.vertexColors&&o.enable(10),T.vertexAlphas&&o.enable(11),T.vertexUv1s&&o.enable(12),T.vertexUv2s&&o.enable(13),T.vertexUv3s&&o.enable(14),T.vertexTangents&&o.enable(15),T.anisotropy&&o.enable(16),T.alphaHash&&o.enable(17),T.batching&&o.enable(18),T.dispersion&&o.enable(19),T.retroreflection&&o.enable(24),T.batchingColor&&o.enable(20),T.gradientMap&&o.enable(21),T.packedNormalMap&&o.enable(22),T.vertexNormals&&o.enable(23),v.push(o.mask),o.disableAll(),T.fog&&o.enable(0),T.useFog&&o.enable(1),T.flatShading&&o.enable(2),T.logarithmicDepthBuffer&&o.enable(3),T.reversedDepthBuffer&&o.enable(4),T.skinning&&o.enable(5),T.morphTargets&&o.enable(6),T.morphNormals&&o.enable(7),T.morphColors&&o.enable(8),T.premultipliedAlpha&&o.enable(9),T.shadowMapEnabled&&o.enable(10),T.doubleSided&&o.enable(11),T.flipSided&&o.enable(12),T.useDepthPacking&&o.enable(13),T.dithering&&o.enable(14),T.transmission&&o.enable(15),T.sheen&&o.enable(16),T.opaque&&o.enable(17),T.pointsUvs&&o.enable(18),T.decodeVideoTexture&&o.enable(19),T.decodeVideoTextureEmissive&&o.enable(20),T.alphaToCoverage&&o.enable(21),T.numLightProbeGrids>0&&o.enable(22),T.hasPositionAttribute&&o.enable(23),v.push(o.mask)}function L(v){const T=f[v.type];let I;if(T){const N=ci[T];I=xw.clone(N.uniforms)}else I=v.uniforms;return I}function b(v,T){let I=u.get(T);return I!==void 0?++I.usedTimes:(I=new K1(t,T,v,s),l.push(I),u.set(T,I)),I}function w(v){if(--v.usedTimes===0){const T=l.indexOf(v);l[T]=l[l.length-1],l.pop(),u.delete(v.cacheKey),v.destroy()}}function A(v){a.remove(v)}function P(){a.dispose()}return{getParameters:x,getProgramCacheKey:m,getUniforms:L,acquireProgram:b,releaseProgram:w,releaseShaderCache:A,programs:l,dispose:P}}function nI(){let t=new WeakMap;function e(o){return t.has(o)}function n(o){let a=t.get(o);return a===void 0&&(a={},t.set(o,a)),a}function i(o){t.delete(o)}function s(o,a,c){t.get(o)[a]=c}function r(){t=new WeakMap}return{has:e,get:n,remove:i,update:s,dispose:r}}function iI(t,e){return t.groupOrder!==e.groupOrder?t.groupOrder-e.groupOrder:t.renderOrder!==e.renderOrder?t.renderOrder-e.renderOrder:t.material.id!==e.material.id?t.material.id-e.material.id:t.materialVariant!==e.materialVariant?t.materialVariant-e.materialVariant:t.z!==e.z?t.z-e.z:t.id-e.id}function Cf(t,e){return t.groupOrder!==e.groupOrder?t.groupOrder-e.groupOrder:t.renderOrder!==e.renderOrder?t.renderOrder-e.renderOrder:t.z!==e.z?e.z-t.z:t.id-e.id}function Pf(){const t=[];let e=0;const n=[],i=[],s=[];function r(){e=0,n.length=0,i.length=0,s.length=0}function o(d){let f=0;return d.isInstancedMesh&&(f+=2),d.isSkinnedMesh&&(f+=1),f}function a(d,f,_,x,m,p){let E=t[e];return E===void 0?(E={id:d.id,object:d,geometry:f,material:_,materialVariant:o(d),groupOrder:x,renderOrder:d.renderOrder,z:m,group:p},t[e]=E):(E.id=d.id,E.object=d,E.geometry=f,E.material=_,E.materialVariant=o(d),E.groupOrder=x,E.renderOrder=d.renderOrder,E.z=m,E.group=p),e++,E}function c(d,f,_,x,m,p,E){E.reversedDepth===!0&&(m=-m);const L=a(d,f,_,x,m,p);_.transmission>0?i.push(L):_.transparent===!0?s.push(L):n.push(L)}function l(d,f,_,x,m,p){const E=a(d,f,_,x,m,p);_.transmission>0?i.unshift(E):_.transparent===!0?s.unshift(E):n.unshift(E)}function u(d,f){n.length>1&&n.sort(d||iI),i.length>1&&i.sort(f||Cf),s.length>1&&s.sort(f||Cf)}function h(){for(let d=e,f=t.length;d<f;d++){const _=t[d];if(_.id===null)break;_.id=null,_.object=null,_.geometry=null,_.material=null,_.group=null}}return{opaque:n,transmissive:i,transparent:s,init:r,push:c,unshift:l,finish:h,sort:u}}function sI(){let t=new WeakMap;function e(i,s){const r=t.get(i);let o;return r===void 0?(o=new Pf,t.set(i,[o])):s>=r.length?(o=new Pf,r.push(o)):o=r[s],o}function n(){t=new WeakMap}return{get:e,dispose:n}}function rI(){const t={};return{get:function(e){if(t[e.id]!==void 0)return t[e.id];let n;switch(e.type){case"SunLight":case"DirectionalLight":n={direction:new H,color:new ot};break;case"SpotLight":n={position:new H,direction:new H,color:new ot,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":n={position:new H,color:new ot,distance:0,decay:0};break;case"HemisphereLight":n={direction:new H,skyColor:new ot,groundColor:new ot};break;case"RectAreaLight":n={color:new ot,position:new H,halfWidth:new H,halfHeight:new H};break}return t[e.id]=n,n}}}function oI(){const t={};return{get:function(e){if(t[e.id]!==void 0)return t[e.id];let n;switch(e.type){case"SunLight":case"DirectionalLight":n={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Ke};break;case"SpotLight":n={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Ke};break;case"PointLight":n={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Ke,shadowCameraNear:1,shadowCameraFar:1e3};break}return t[e.id]=n,n}}}let aI=0;function cI(t,e){return(e.castShadow?2:0)-(t.castShadow?2:0)+(e.map?1:0)-(t.map?1:0)}function lI(t){const e=new rI,n=oI(),i={version:0,hash:{sunLength:-1,directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numSunShadows:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-1,numLightProbes:-1},ambient:[0,0,0],probe:[],sun:[],sunShadow:[],sunShadowMap:[],sunShadowMatrix:[],sunShadowCascade:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotLightMap:[],spotShadow:[],spotShadowMap:[],spotLightMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],numSpotLightShadowsWithMaps:0,numLightProbes:0};for(let l=0;l<9;l++)i.probe.push(new H);const s=new H,r=new Gt,o=new Gt;function a(l){let u=0,h=0,d=0;for(let k=0;k<9;k++)i.probe[k].set(0,0,0);let f=0,_=0,x=0,m=0,p=0,E=0,L=0,b=0,w=0,A=0,P=0,v=0,T=0,I=0;l.sort(cI);for(let k=0,$=l.length;k<$;k++){const U=l[k],V=U.color,Q=U.intensity,X=U.distance;let ce=null;if(U.shadow&&U.shadow.map&&(U.shadow.map.texture.format===ys?ce=U.shadow.map.texture:ce=U.shadow.map.depthTexture||U.shadow.map.texture),U.isAmbientLight)u+=V.r*Q,h+=V.g*Q,d+=V.b*Q;else if(U.isLightProbe){for(let j=0;j<9;j++)i.probe[j].addScaledVector(U.sh.coefficients[j],Q);I++}else if(U.isSunLight){const j=e.get(U);if(j.color.copy(U.color).multiplyScalar(U.intensity),U.castShadow){const se=U.shadow,oe=n.get(U);oe.shadowIntensity=se.intensity,oe.shadowBias=se.bias,oe.shadowNormalBias=se.normalBias,oe.shadowRadius=se.radius,oe.shadowMapSize.copy(se.mapSize).multiply(se.getFrameExtents()),i.sunShadow[_]=oe,i.sunShadowMap[_]=ce;const Fe=se.getViewportCount();for(let Le=0;Le<Fe;Le++)i.sunShadowMatrix[x+Le]=se.getMatrix(Le),i.sunShadowCascade[x+Le]=se._cascadeData[Le];x+=Fe,_++}i.sun[f]=j,f++}else if(U.isDirectionalLight){const j=e.get(U);if(j.color.copy(U.color).multiplyScalar(U.intensity),U.castShadow){const se=U.shadow,oe=n.get(U);oe.shadowIntensity=se.intensity,oe.shadowBias=se.bias,oe.shadowNormalBias=se.normalBias,oe.shadowRadius=se.radius,oe.shadowMapSize=se.mapSize,i.directionalShadow[m]=oe,i.directionalShadowMap[m]=ce,i.directionalShadowMatrix[m]=U.shadow.matrix,w++}i.directional[m]=j,m++}else if(U.isSpotLight){const j=e.get(U);j.position.setFromMatrixPosition(U.matrixWorld),j.color.copy(V).multiplyScalar(Q),j.distance=X,j.coneCos=Math.cos(U.angle),j.penumbraCos=Math.cos(U.angle*(1-U.penumbra)),j.decay=U.decay,i.spot[E]=j;const se=U.shadow;if(U.map&&(i.spotLightMap[v]=U.map,v++,se.updateMatrices(U),U.castShadow&&T++),i.spotLightMatrix[E]=se.matrix,U.castShadow){const oe=n.get(U);oe.shadowIntensity=se.intensity,oe.shadowBias=se.bias,oe.shadowNormalBias=se.normalBias,oe.shadowRadius=se.radius,oe.shadowMapSize=se.mapSize,i.spotShadow[E]=oe,i.spotShadowMap[E]=ce,P++}E++}else if(U.isRectAreaLight){const j=e.get(U);j.color.copy(V).multiplyScalar(Q),j.halfWidth.set(U.width*.5,0,0),j.halfHeight.set(0,U.height*.5,0),i.rectArea[L]=j,L++}else if(U.isPointLight){const j=e.get(U);if(j.color.copy(U.color).multiplyScalar(U.intensity),j.distance=U.distance,j.decay=U.decay,U.castShadow){const se=U.shadow,oe=n.get(U);oe.shadowIntensity=se.intensity,oe.shadowBias=se.bias,oe.shadowNormalBias=se.normalBias,oe.shadowRadius=se.radius,oe.shadowMapSize=se.mapSize,oe.shadowCameraNear=se.camera.near,oe.shadowCameraFar=se.camera.far,i.pointShadow[p]=oe,i.pointShadowMap[p]=ce,i.pointShadowMatrix[p]=U.shadow.matrix,A++}i.point[p]=j,p++}else if(U.isHemisphereLight){const j=e.get(U);j.skyColor.copy(U.color).multiplyScalar(Q),j.groundColor.copy(U.groundColor).multiplyScalar(Q),i.hemi[b]=j,b++}}L>0&&(t.has("OES_texture_float_linear")===!0?(i.rectAreaLTC1=be.LTC_FLOAT_1,i.rectAreaLTC2=be.LTC_FLOAT_2):(i.rectAreaLTC1=be.LTC_HALF_1,i.rectAreaLTC2=be.LTC_HALF_2)),i.ambient[0]=u,i.ambient[1]=h,i.ambient[2]=d;const N=i.hash;(N.sunLength!==f||N.directionalLength!==m||N.pointLength!==p||N.spotLength!==E||N.rectAreaLength!==L||N.hemiLength!==b||N.numSunShadows!==_||N.numDirectionalShadows!==w||N.numPointShadows!==A||N.numSpotShadows!==P||N.numSpotMaps!==v||N.numLightProbes!==I)&&(i.sun.length=f,i.directional.length=m,i.spot.length=E,i.rectArea.length=L,i.point.length=p,i.hemi.length=b,i.sunShadow.length=_,i.sunShadowMap.length=_,i.sunShadowMatrix.length=x,i.sunShadowCascade.length=x,i.directionalShadow.length=w,i.directionalShadowMap.length=w,i.directionalShadowMatrix.length=w,i.pointShadow.length=A,i.pointShadowMap.length=A,i.pointShadowMatrix.length=A,i.spotShadow.length=P,i.spotShadowMap.length=P,i.spotLightMatrix.length=P+v-T,i.spotLightMap.length=v,i.numSpotLightShadowsWithMaps=T,i.numLightProbes=I,N.sunLength=f,N.directionalLength=m,N.pointLength=p,N.spotLength=E,N.rectAreaLength=L,N.hemiLength=b,N.numSunShadows=_,N.numDirectionalShadows=w,N.numPointShadows=A,N.numSpotShadows=P,N.numSpotMaps=v,N.numLightProbes=I,i.version=aI++)}function c(l,u){let h=0,d=0,f=0,_=0,x=0,m=0;const p=u.matrixWorldInverse;for(let E=0,L=l.length;E<L;E++){const b=l[E];if(b.isSunLight){const w=i.sun[h];w.direction.setFromMatrixPosition(b.matrixWorld),w.direction.transformDirection(p),h++}else if(b.isDirectionalLight){const w=i.directional[d];w.direction.setFromMatrixPosition(b.matrixWorld),s.setFromMatrixPosition(b.target.matrixWorld),w.direction.sub(s),w.direction.transformDirection(p),d++}else if(b.isSpotLight){const w=i.spot[_];w.position.setFromMatrixPosition(b.matrixWorld),w.position.applyMatrix4(p),w.direction.setFromMatrixPosition(b.matrixWorld),s.setFromMatrixPosition(b.target.matrixWorld),w.direction.sub(s),w.direction.transformDirection(p),_++}else if(b.isRectAreaLight){const w=i.rectArea[x];w.position.setFromMatrixPosition(b.matrixWorld),w.position.applyMatrix4(p),o.identity(),r.copy(b.matrixWorld),r.premultiply(p),o.extractRotation(r),w.halfWidth.set(b.width*.5,0,0),w.halfHeight.set(0,b.height*.5,0),w.halfWidth.applyMatrix4(o),w.halfHeight.applyMatrix4(o),x++}else if(b.isPointLight){const w=i.point[f];w.position.setFromMatrixPosition(b.matrixWorld),w.position.applyMatrix4(p),f++}else if(b.isHemisphereLight){const w=i.hemi[m];w.direction.setFromMatrixPosition(b.matrixWorld),w.direction.transformDirection(p),m++}}}return{setup:a,setupView:c,state:i}}function If(t){const e=new lI(t),n=[],i=[],s=[];function r(d){h.camera=d,n.length=0,i.length=0,s.length=0}function o(d){n.push(d)}function a(d){i.push(d)}function c(d){s.push(d)}function l(){e.setup(n)}function u(d){e.setupView(n,d)}const h={lightsArray:n,shadowsArray:i,lightProbeGridArray:s,camera:null,lights:e,transmissionRenderTarget:{},textureUnits:0};return{init:r,state:h,setupLights:l,setupLightsView:u,pushLight:o,pushShadow:a,pushLightProbeGrid:c}}function uI(t){let e=new WeakMap;function n(s,r=0){const o=e.get(s);let a;return o===void 0?(a=new If(t),e.set(s,[a])):r>=o.length?(a=new If(t),o.push(a)):a=o[r],a}function i(){e=new WeakMap}return{get:n,dispose:i}}const dI=`void main() {
|
|
4282
|
+
`+oe)}else V!==""?$e("WebGLProgram: Program Info Log:",V):(Q===""||X==="")&&(j=!1);j&&(N.diagnostics={runnable:ce,programLog:V,vertexShader:{log:Q,prefix:m},fragmentShader:{log:X,prefix:p}})}s.deleteShader(w),s.deleteShader(A),v=new da(s,x),T=kL(s,x)}let v;this.getUniforms=function(){return v===void 0&&P(this),v};let T;this.getAttributes=function(){return T===void 0&&P(this),T};let L=n.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return L===!1&&(L=s.getProgramParameter(x,AL)),L},this.destroy=function(){i.releaseStatesOfProgram(this),s.deleteProgram(x),this.program=void 0},this.type=n.shaderType,this.name=n.shaderName,this.id=CL++,this.cacheKey=e,this.usedTimes=1,this.program=x,this.vertexShader=w,this.fragmentShader=A,this}let eI=0;class tI{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e,n,i){const s=this._getShaderCacheForMaterial(e);return s.has(n)===!1&&(s.add(n),n.usedTimes++),s.has(i)===!1&&(s.add(i),i.usedTimes++),this}remove(e){const n=this.materialCache.get(e);for(const i of n)i.usedTimes--,i.usedTimes===0&&this.shaderCache.delete(i.code);return this.materialCache.delete(e),this}getVertexShaderStage(e){return this._getShaderStage(e.vertexShader)}getFragmentShaderStage(e){return this._getShaderStage(e.fragmentShader)}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(e){const n=this.materialCache;let i=n.get(e);return i===void 0&&(i=new Set,n.set(e,i)),i}_getShaderStage(e){const n=this.shaderCache;let i=n.get(e);return i===void 0&&(i=new nI(e),n.set(e,i)),i}}class nI{constructor(e){this.id=eI++,this.code=e,this.usedTimes=0}}function iI(t){return t===Ps||t===Ra||t===wa}function sI(t,e,n,i,s,r){const o=new LS,a=new tI,c=new Set,l=[],u=new Map,h=i.logarithmicDepthBuffer;let d=i.precision;const f={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distance",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"toon",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite"};function _(v){return c.add(v),v===0?"uv":`uv${v}`}function x(v,T,L,N,k,q){const U=N.fog,V=k.geometry,Q=v.isMeshStandardMaterial||v.isMeshLambertMaterial||v.isMeshPhongMaterial?N.environment:null,X=v.isMeshStandardMaterial||v.isMeshLambertMaterial&&!v.envMap||v.isMeshPhongMaterial&&!v.envMap,ce=e.get(v.envMap||Q,X),j=ce&&ce.mapping===lc?ce.image.height:null,se=f[v.type];v.precision!==null&&(d=i.getMaxPrecision(v.precision),d!==v.precision&&$e("WebGLProgram.getParameters:",v.precision,"not supported, using",d,"instead."));const oe=V.morphAttributes.position||V.morphAttributes.normal||V.morphAttributes.color,Fe=oe!==void 0?oe.length:0;let Ie=0;V.morphAttributes.position!==void 0&&(Ie=1),V.morphAttributes.normal!==void 0&&(Ie=2),V.morphAttributes.color!==void 0&&(Ie=3);let mt,tt,Je,Y;if(se){const _t=fi[se];mt=_t.vertexShader,tt=_t.fragmentShader}else{mt=v.vertexShader,tt=v.fragmentShader;const _t=a.getVertexShaderStage(v),lt=a.getFragmentShaderStage(v);a.update(v,_t,lt),Je=_t.id,Y=lt.id}const re=t.getRenderTarget(),Re=t.state.buffers.depth.getReversed(),Ge=k.isInstancedMesh===!0,Me=k.isBatchedMesh===!0,We=!!v.map,Lt=!!v.matcap,Xe=!!ce,st=!!v.aoMap,St=!!v.lightMap,Qe=!!v.bumpMap&&v.wireframe===!1,xt=!!v.normalMap,Ot=!!v.displacementMap,qt=!!v.emissiveMap,Mt=!!v.metalnessMap,It=!!v.roughnessMap,F=v.anisotropy>0,Bt=v.clearcoat>0,dt=v.dispersion>0,R=v.retroreflectivity>0,S=v.iridescence>0,z=v.sheen>0,Z=v.transmission>0,K=F&&!!v.anisotropyMap,le=Bt&&!!v.clearcoatMap,de=Bt&&!!v.clearcoatNormalMap,J=Bt&&!!v.clearcoatRoughnessMap,ne=S&&!!v.iridescenceMap,he=S&&!!v.iridescenceThicknessMap,Ne=z&&!!v.sheenColorMap,ue=z&&!!v.sheenRoughnessMap,me=!!v.specularMap,Pe=!!v.specularColorMap,ze=!!v.specularIntensityMap,qe=Z&&!!v.transmissionMap,O=Z&&!!v.thicknessMap,fe=!!v.gradientMap,te=!!v.alphaMap,ge=v.alphaTest>0,ye=!!v.alphaHash,ie=!!v.extensions;let De=_i;v.toneMapped&&(re===null||re.isXRRenderTarget===!0)&&(De=t.toneMapping);const Ce={shaderID:se,shaderType:v.type,shaderName:v.name,vertexShader:mt,fragmentShader:tt,defines:v.defines,customVertexShaderID:Je,customFragmentShaderID:Y,isRawShaderMaterial:v.isRawShaderMaterial===!0,glslVersion:v.glslVersion,precision:d,batching:Me,batchingColor:Me&&k._colorsTexture!==null,instancing:Ge,instancingColor:Ge&&k.instanceColor!==null,instancingMorph:Ge&&k.morphTexture!==null,outputColorSpace:re===null?t.outputColorSpace:re.isXRRenderTarget===!0?re.texture.colorSpace:ft.workingColorSpace,alphaToCoverage:!!v.alphaToCoverage,map:We,matcap:Lt,envMap:Xe,envMapMode:Xe&&ce.mapping,envMapCubeUVHeight:j,aoMap:st,lightMap:St,bumpMap:Qe,normalMap:xt,displacementMap:Ot,emissiveMap:qt,normalMapObjectSpace:xt&&v.normalMapType===bw,normalMapTangentSpace:xt&&v.normalMapType===_f,packedNormalMap:xt&&v.normalMapType===_f&&iI(v.normalMap.format),metalnessMap:Mt,roughnessMap:It,anisotropy:F,anisotropyMap:K,clearcoat:Bt,clearcoatMap:le,clearcoatNormalMap:de,clearcoatRoughnessMap:J,dispersion:dt,retroreflection:R,iridescence:S,iridescenceMap:ne,iridescenceThicknessMap:he,sheen:z,sheenColorMap:Ne,sheenRoughnessMap:ue,specularMap:me,specularColorMap:Pe,specularIntensityMap:ze,transmission:Z,transmissionMap:qe,thicknessMap:O,gradientMap:fe,opaque:v.transparent===!1&&v.blending===Kr&&v.alphaToCoverage===!1,alphaMap:te,alphaTest:ge,alphaHash:ye,combine:v.combine,mapUv:We&&_(v.map.channel),aoMapUv:st&&_(v.aoMap.channel),lightMapUv:St&&_(v.lightMap.channel),bumpMapUv:Qe&&_(v.bumpMap.channel),normalMapUv:xt&&_(v.normalMap.channel),displacementMapUv:Ot&&_(v.displacementMap.channel),emissiveMapUv:qt&&_(v.emissiveMap.channel),metalnessMapUv:Mt&&_(v.metalnessMap.channel),roughnessMapUv:It&&_(v.roughnessMap.channel),anisotropyMapUv:K&&_(v.anisotropyMap.channel),clearcoatMapUv:le&&_(v.clearcoatMap.channel),clearcoatNormalMapUv:de&&_(v.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:J&&_(v.clearcoatRoughnessMap.channel),iridescenceMapUv:ne&&_(v.iridescenceMap.channel),iridescenceThicknessMapUv:he&&_(v.iridescenceThicknessMap.channel),sheenColorMapUv:Ne&&_(v.sheenColorMap.channel),sheenRoughnessMapUv:ue&&_(v.sheenRoughnessMap.channel),specularMapUv:me&&_(v.specularMap.channel),specularColorMapUv:Pe&&_(v.specularColorMap.channel),specularIntensityMapUv:ze&&_(v.specularIntensityMap.channel),transmissionMapUv:qe&&_(v.transmissionMap.channel),thicknessMapUv:O&&_(v.thicknessMap.channel),alphaMapUv:te&&_(v.alphaMap.channel),vertexTangents:!!V.attributes.tangent&&(xt||F),vertexNormals:!!V.attributes.normal,vertexColors:v.vertexColors,vertexAlphas:v.vertexColors===!0&&!!V.attributes.color&&V.attributes.color.itemSize===4,pointsUvs:k.isPoints===!0&&!!V.attributes.uv&&(We||te),fog:!!U,useFog:v.fog===!0,fogExp2:!!U&&U.isFogExp2,flatShading:v.wireframe===!1&&(v.flatShading===!0||V.attributes.normal===void 0&&xt===!1&&(v.isMeshLambertMaterial||v.isMeshPhongMaterial||v.isMeshStandardMaterial||v.isMeshPhysicalMaterial)),sizeAttenuation:v.sizeAttenuation===!0,logarithmicDepthBuffer:h,reversedDepthBuffer:Re,skinning:k.isSkinnedMesh===!0,hasPositionAttribute:V.attributes.position!==void 0,morphTargets:V.morphAttributes.position!==void 0,morphNormals:V.morphAttributes.normal!==void 0,morphColors:V.morphAttributes.color!==void 0,morphTargetsCount:Fe,morphTextureStride:Ie,numSunLights:T.sun.length,numDirLights:T.directional.length,numPointLights:T.point.length,numSpotLights:T.spot.length,numSpotLightMaps:T.spotLightMap.length,numRectAreaLights:T.rectArea.length,numHemiLights:T.hemi.length,numSunLightShadows:T.sunShadowMap.length,numDirLightShadows:T.directionalShadowMap.length,numPointLightShadows:T.pointShadowMap.length,numSpotLightShadows:T.spotShadowMap.length,numSpotLightShadowsWithMaps:T.numSpotLightShadowsWithMaps,numLightProbes:T.numLightProbes,numLightProbeGrids:q.length,numClippingPlanes:r.numPlanes,numClipIntersection:r.numIntersection,dithering:v.dithering,shadowMapEnabled:t.shadowMap.enabled&&L.length>0,shadowMapType:t.shadowMap.type,toneMapping:De,decodeVideoTexture:We&&v.map.isVideoTexture===!0&&ft.getTransfer(v.map.colorSpace)===Et,decodeVideoTextureEmissive:qt&&v.emissiveMap.isVideoTexture===!0&&ft.getTransfer(v.emissiveMap.colorSpace)===Et,premultipliedAlpha:v.premultipliedAlpha,doubleSided:v.side===Ni,flipSided:v.side===Cn,useDepthPacking:v.depthPacking>=0,depthPacking:v.depthPacking||0,index0AttributeName:v.index0AttributeName,extensionClipCullDistance:ie&&v.extensions.clipCullDistance===!0&&n.has("WEBGL_clip_cull_distance"),extensionMultiDraw:(ie&&v.extensions.multiDraw===!0||Me)&&n.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:n.has("KHR_parallel_shader_compile"),customProgramCacheKey:v.customProgramCacheKey()};return Ce.vertexUv1s=c.has(1),Ce.vertexUv2s=c.has(2),Ce.vertexUv3s=c.has(3),c.clear(),Ce}function m(v){const T=[];if(v.shaderID?T.push(v.shaderID):(T.push(v.customVertexShaderID),T.push(v.customFragmentShaderID)),v.defines!==void 0)for(const L in v.defines)T.push(L),T.push(v.defines[L]);return v.isRawShaderMaterial===!1&&(p(T,v),E(T,v),T.push(t.outputColorSpace)),T.push(v.customProgramCacheKey),T.join()}function p(v,T){v.push(T.precision),v.push(T.outputColorSpace),v.push(T.envMapMode),v.push(T.envMapCubeUVHeight),v.push(T.mapUv),v.push(T.alphaMapUv),v.push(T.lightMapUv),v.push(T.aoMapUv),v.push(T.bumpMapUv),v.push(T.normalMapUv),v.push(T.displacementMapUv),v.push(T.emissiveMapUv),v.push(T.metalnessMapUv),v.push(T.roughnessMapUv),v.push(T.anisotropyMapUv),v.push(T.clearcoatMapUv),v.push(T.clearcoatNormalMapUv),v.push(T.clearcoatRoughnessMapUv),v.push(T.iridescenceMapUv),v.push(T.iridescenceThicknessMapUv),v.push(T.sheenColorMapUv),v.push(T.sheenRoughnessMapUv),v.push(T.specularMapUv),v.push(T.specularColorMapUv),v.push(T.specularIntensityMapUv),v.push(T.transmissionMapUv),v.push(T.thicknessMapUv),v.push(T.combine),v.push(T.fogExp2),v.push(T.sizeAttenuation),v.push(T.morphTargetsCount),v.push(T.morphAttributeCount),v.push(T.numSunLights),v.push(T.numDirLights),v.push(T.numPointLights),v.push(T.numSpotLights),v.push(T.numSpotLightMaps),v.push(T.numHemiLights),v.push(T.numRectAreaLights),v.push(T.numSunLightShadows),v.push(T.numDirLightShadows),v.push(T.numPointLightShadows),v.push(T.numSpotLightShadows),v.push(T.numSpotLightShadowsWithMaps),v.push(T.numLightProbes),v.push(T.shadowMapType),v.push(T.toneMapping),v.push(T.numClippingPlanes),v.push(T.numClipIntersection),v.push(T.depthPacking)}function E(v,T){o.disableAll(),T.instancing&&o.enable(0),T.instancingColor&&o.enable(1),T.instancingMorph&&o.enable(2),T.matcap&&o.enable(3),T.envMap&&o.enable(4),T.normalMapObjectSpace&&o.enable(5),T.normalMapTangentSpace&&o.enable(6),T.clearcoat&&o.enable(7),T.iridescence&&o.enable(8),T.alphaTest&&o.enable(9),T.vertexColors&&o.enable(10),T.vertexAlphas&&o.enable(11),T.vertexUv1s&&o.enable(12),T.vertexUv2s&&o.enable(13),T.vertexUv3s&&o.enable(14),T.vertexTangents&&o.enable(15),T.anisotropy&&o.enable(16),T.alphaHash&&o.enable(17),T.batching&&o.enable(18),T.dispersion&&o.enable(19),T.retroreflection&&o.enable(24),T.batchingColor&&o.enable(20),T.gradientMap&&o.enable(21),T.packedNormalMap&&o.enable(22),T.vertexNormals&&o.enable(23),v.push(o.mask),o.disableAll(),T.fog&&o.enable(0),T.useFog&&o.enable(1),T.flatShading&&o.enable(2),T.logarithmicDepthBuffer&&o.enable(3),T.reversedDepthBuffer&&o.enable(4),T.skinning&&o.enable(5),T.morphTargets&&o.enable(6),T.morphNormals&&o.enable(7),T.morphColors&&o.enable(8),T.premultipliedAlpha&&o.enable(9),T.shadowMapEnabled&&o.enable(10),T.doubleSided&&o.enable(11),T.flipSided&&o.enable(12),T.useDepthPacking&&o.enable(13),T.dithering&&o.enable(14),T.transmission&&o.enable(15),T.sheen&&o.enable(16),T.opaque&&o.enable(17),T.pointsUvs&&o.enable(18),T.decodeVideoTexture&&o.enable(19),T.decodeVideoTextureEmissive&&o.enable(20),T.alphaToCoverage&&o.enable(21),T.numLightProbeGrids>0&&o.enable(22),T.hasPositionAttribute&&o.enable(23),v.push(o.mask)}function I(v){const T=f[v.type];let L;if(T){const N=fi[T];L=MA.clone(N.uniforms)}else L=v.uniforms;return L}function b(v,T){let L=u.get(T);return L!==void 0?++L.usedTimes:(L=new QL(t,T,v,s),l.push(L),u.set(T,L)),L}function w(v){if(--v.usedTimes===0){const T=l.indexOf(v);l[T]=l[l.length-1],l.pop(),u.delete(v.cacheKey),v.destroy()}}function A(v){a.remove(v)}function P(){a.dispose()}return{getParameters:x,getProgramCacheKey:m,getUniforms:I,acquireProgram:b,releaseProgram:w,releaseShaderCache:A,programs:l,dispose:P}}function rI(){let t=new WeakMap;function e(o){return t.has(o)}function n(o){let a=t.get(o);return a===void 0&&(a={},t.set(o,a)),a}function i(o){t.delete(o)}function s(o,a,c){t.get(o)[a]=c}function r(){t=new WeakMap}return{has:e,get:n,remove:i,update:s,dispose:r}}function oI(t,e){return t.groupOrder!==e.groupOrder?t.groupOrder-e.groupOrder:t.renderOrder!==e.renderOrder?t.renderOrder-e.renderOrder:t.material.id!==e.material.id?t.material.id-e.material.id:t.materialVariant!==e.materialVariant?t.materialVariant-e.materialVariant:t.z!==e.z?t.z-e.z:t.id-e.id}function up(t,e){return t.groupOrder!==e.groupOrder?t.groupOrder-e.groupOrder:t.renderOrder!==e.renderOrder?t.renderOrder-e.renderOrder:t.z!==e.z?e.z-t.z:t.id-e.id}function dp(){const t=[];let e=0;const n=[],i=[],s=[];function r(){e=0,n.length=0,i.length=0,s.length=0}function o(d){let f=0;return d.isInstancedMesh&&(f+=2),d.isSkinnedMesh&&(f+=1),f}function a(d,f,_,x,m,p){let E=t[e];return E===void 0?(E={id:d.id,object:d,geometry:f,material:_,materialVariant:o(d),groupOrder:x,renderOrder:d.renderOrder,z:m,group:p},t[e]=E):(E.id=d.id,E.object=d,E.geometry=f,E.material=_,E.materialVariant=o(d),E.groupOrder=x,E.renderOrder=d.renderOrder,E.z=m,E.group=p),e++,E}function c(d,f,_,x,m,p,E){E.reversedDepth===!0&&(m=-m);const I=a(d,f,_,x,m,p);_.transmission>0?i.push(I):_.transparent===!0?s.push(I):n.push(I)}function l(d,f,_,x,m,p){const E=a(d,f,_,x,m,p);_.transmission>0?i.unshift(E):_.transparent===!0?s.unshift(E):n.unshift(E)}function u(d,f){n.length>1&&n.sort(d||oI),i.length>1&&i.sort(f||up),s.length>1&&s.sort(f||up)}function h(){for(let d=e,f=t.length;d<f;d++){const _=t[d];if(_.id===null)break;_.id=null,_.object=null,_.geometry=null,_.material=null,_.group=null}}return{opaque:n,transmissive:i,transparent:s,init:r,push:c,unshift:l,finish:h,sort:u}}function aI(){let t=new WeakMap;function e(i,s){const r=t.get(i);let o;return r===void 0?(o=new dp,t.set(i,[o])):s>=r.length?(o=new dp,r.push(o)):o=r[s],o}function n(){t=new WeakMap}return{get:e,dispose:n}}function cI(){const t={};return{get:function(e){if(t[e.id]!==void 0)return t[e.id];let n;switch(e.type){case"SunLight":case"DirectionalLight":n={direction:new H,color:new at};break;case"SpotLight":n={position:new H,direction:new H,color:new at,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":n={position:new H,color:new at,distance:0,decay:0};break;case"HemisphereLight":n={direction:new H,skyColor:new at,groundColor:new at};break;case"RectAreaLight":n={color:new at,position:new H,halfWidth:new H,halfHeight:new H};break}return t[e.id]=n,n}}}function lI(){const t={};return{get:function(e){if(t[e.id]!==void 0)return t[e.id];let n;switch(e.type){case"SunLight":case"DirectionalLight":n={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new je};break;case"SpotLight":n={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new je};break;case"PointLight":n={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new je,shadowCameraNear:1,shadowCameraFar:1e3};break}return t[e.id]=n,n}}}let uI=0;function dI(t,e){return(e.castShadow?2:0)-(t.castShadow?2:0)+(e.map?1:0)-(t.map?1:0)}function hI(t){const e=new cI,n=lI(),i={version:0,hash:{sunLength:-1,directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numSunShadows:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-1,numLightProbes:-1},ambient:[0,0,0],probe:[],sun:[],sunShadow:[],sunShadowMap:[],sunShadowMatrix:[],sunShadowCascade:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotLightMap:[],spotShadow:[],spotShadowMap:[],spotLightMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],numSpotLightShadowsWithMaps:0,numLightProbes:0};for(let l=0;l<9;l++)i.probe.push(new H);const s=new H,r=new $t,o=new $t;function a(l){let u=0,h=0,d=0;for(let k=0;k<9;k++)i.probe[k].set(0,0,0);let f=0,_=0,x=0,m=0,p=0,E=0,I=0,b=0,w=0,A=0,P=0,v=0,T=0,L=0;l.sort(dI);for(let k=0,q=l.length;k<q;k++){const U=l[k],V=U.color,Q=U.intensity,X=U.distance;let ce=null;if(U.shadow&&U.shadow.map&&(U.shadow.map.texture.format===Ps?ce=U.shadow.map.texture:ce=U.shadow.map.depthTexture||U.shadow.map.texture),U.isAmbientLight)u+=V.r*Q,h+=V.g*Q,d+=V.b*Q;else if(U.isLightProbe){for(let j=0;j<9;j++)i.probe[j].addScaledVector(U.sh.coefficients[j],Q);L++}else if(U.isSunLight){const j=e.get(U);if(j.color.copy(U.color).multiplyScalar(U.intensity),U.castShadow){const se=U.shadow,oe=n.get(U);oe.shadowIntensity=se.intensity,oe.shadowBias=se.bias,oe.shadowNormalBias=se.normalBias,oe.shadowRadius=se.radius,oe.shadowMapSize.copy(se.mapSize).multiply(se.getFrameExtents()),i.sunShadow[_]=oe,i.sunShadowMap[_]=ce;const Fe=se.getViewportCount();for(let Ie=0;Ie<Fe;Ie++)i.sunShadowMatrix[x+Ie]=se.getMatrix(Ie),i.sunShadowCascade[x+Ie]=se._cascadeData[Ie];x+=Fe,_++}i.sun[f]=j,f++}else if(U.isDirectionalLight){const j=e.get(U);if(j.color.copy(U.color).multiplyScalar(U.intensity),U.castShadow){const se=U.shadow,oe=n.get(U);oe.shadowIntensity=se.intensity,oe.shadowBias=se.bias,oe.shadowNormalBias=se.normalBias,oe.shadowRadius=se.radius,oe.shadowMapSize=se.mapSize,i.directionalShadow[m]=oe,i.directionalShadowMap[m]=ce,i.directionalShadowMatrix[m]=U.shadow.matrix,w++}i.directional[m]=j,m++}else if(U.isSpotLight){const j=e.get(U);j.position.setFromMatrixPosition(U.matrixWorld),j.color.copy(V).multiplyScalar(Q),j.distance=X,j.coneCos=Math.cos(U.angle),j.penumbraCos=Math.cos(U.angle*(1-U.penumbra)),j.decay=U.decay,i.spot[E]=j;const se=U.shadow;if(U.map&&(i.spotLightMap[v]=U.map,v++,se.updateMatrices(U),U.castShadow&&T++),i.spotLightMatrix[E]=se.matrix,U.castShadow){const oe=n.get(U);oe.shadowIntensity=se.intensity,oe.shadowBias=se.bias,oe.shadowNormalBias=se.normalBias,oe.shadowRadius=se.radius,oe.shadowMapSize=se.mapSize,i.spotShadow[E]=oe,i.spotShadowMap[E]=ce,P++}E++}else if(U.isRectAreaLight){const j=e.get(U);j.color.copy(V).multiplyScalar(Q),j.halfWidth.set(U.width*.5,0,0),j.halfHeight.set(0,U.height*.5,0),i.rectArea[I]=j,I++}else if(U.isPointLight){const j=e.get(U);if(j.color.copy(U.color).multiplyScalar(U.intensity),j.distance=U.distance,j.decay=U.decay,U.castShadow){const se=U.shadow,oe=n.get(U);oe.shadowIntensity=se.intensity,oe.shadowBias=se.bias,oe.shadowNormalBias=se.normalBias,oe.shadowRadius=se.radius,oe.shadowMapSize=se.mapSize,oe.shadowCameraNear=se.camera.near,oe.shadowCameraFar=se.camera.far,i.pointShadow[p]=oe,i.pointShadowMap[p]=ce,i.pointShadowMatrix[p]=U.shadow.matrix,A++}i.point[p]=j,p++}else if(U.isHemisphereLight){const j=e.get(U);j.skyColor.copy(U.color).multiplyScalar(Q),j.groundColor.copy(U.groundColor).multiplyScalar(Q),i.hemi[b]=j,b++}}I>0&&(t.has("OES_texture_float_linear")===!0?(i.rectAreaLTC1=be.LTC_FLOAT_1,i.rectAreaLTC2=be.LTC_FLOAT_2):(i.rectAreaLTC1=be.LTC_HALF_1,i.rectAreaLTC2=be.LTC_HALF_2)),i.ambient[0]=u,i.ambient[1]=h,i.ambient[2]=d;const N=i.hash;(N.sunLength!==f||N.directionalLength!==m||N.pointLength!==p||N.spotLength!==E||N.rectAreaLength!==I||N.hemiLength!==b||N.numSunShadows!==_||N.numDirectionalShadows!==w||N.numPointShadows!==A||N.numSpotShadows!==P||N.numSpotMaps!==v||N.numLightProbes!==L)&&(i.sun.length=f,i.directional.length=m,i.spot.length=E,i.rectArea.length=I,i.point.length=p,i.hemi.length=b,i.sunShadow.length=_,i.sunShadowMap.length=_,i.sunShadowMatrix.length=x,i.sunShadowCascade.length=x,i.directionalShadow.length=w,i.directionalShadowMap.length=w,i.directionalShadowMatrix.length=w,i.pointShadow.length=A,i.pointShadowMap.length=A,i.pointShadowMatrix.length=A,i.spotShadow.length=P,i.spotShadowMap.length=P,i.spotLightMatrix.length=P+v-T,i.spotLightMap.length=v,i.numSpotLightShadowsWithMaps=T,i.numLightProbes=L,N.sunLength=f,N.directionalLength=m,N.pointLength=p,N.spotLength=E,N.rectAreaLength=I,N.hemiLength=b,N.numSunShadows=_,N.numDirectionalShadows=w,N.numPointShadows=A,N.numSpotShadows=P,N.numSpotMaps=v,N.numLightProbes=L,i.version=uI++)}function c(l,u){let h=0,d=0,f=0,_=0,x=0,m=0;const p=u.matrixWorldInverse;for(let E=0,I=l.length;E<I;E++){const b=l[E];if(b.isSunLight){const w=i.sun[h];w.direction.setFromMatrixPosition(b.matrixWorld),w.direction.transformDirection(p),h++}else if(b.isDirectionalLight){const w=i.directional[d];w.direction.setFromMatrixPosition(b.matrixWorld),s.setFromMatrixPosition(b.target.matrixWorld),w.direction.sub(s),w.direction.transformDirection(p),d++}else if(b.isSpotLight){const w=i.spot[_];w.position.setFromMatrixPosition(b.matrixWorld),w.position.applyMatrix4(p),w.direction.setFromMatrixPosition(b.matrixWorld),s.setFromMatrixPosition(b.target.matrixWorld),w.direction.sub(s),w.direction.transformDirection(p),_++}else if(b.isRectAreaLight){const w=i.rectArea[x];w.position.setFromMatrixPosition(b.matrixWorld),w.position.applyMatrix4(p),o.identity(),r.copy(b.matrixWorld),r.premultiply(p),o.extractRotation(r),w.halfWidth.set(b.width*.5,0,0),w.halfHeight.set(0,b.height*.5,0),w.halfWidth.applyMatrix4(o),w.halfHeight.applyMatrix4(o),x++}else if(b.isPointLight){const w=i.point[f];w.position.setFromMatrixPosition(b.matrixWorld),w.position.applyMatrix4(p),f++}else if(b.isHemisphereLight){const w=i.hemi[m];w.direction.setFromMatrixPosition(b.matrixWorld),w.direction.transformDirection(p),m++}}}return{setup:a,setupView:c,state:i}}function hp(t){const e=new hI(t),n=[],i=[],s=[];function r(d){h.camera=d,n.length=0,i.length=0,s.length=0}function o(d){n.push(d)}function a(d){i.push(d)}function c(d){s.push(d)}function l(){e.setup(n)}function u(d){e.setupView(n,d)}const h={lightsArray:n,shadowsArray:i,lightProbeGridArray:s,camera:null,lights:e,transmissionRenderTarget:{},textureUnits:0};return{init:r,state:h,setupLights:l,setupLightsView:u,pushLight:o,pushShadow:a,pushLightProbeGrid:c}}function fI(t){let e=new WeakMap;function n(s,r=0){const o=e.get(s);let a;return o===void 0?(a=new hp(t),e.set(s,[a])):r>=o.length?(a=new hp(t),o.push(a)):a=o[r],a}function i(){e=new WeakMap}return{get:n,dispose:i}}const pI=`void main() {
|
|
4283
4283
|
gl_Position = vec4( position, 1.0 );
|
|
4284
|
-
}`,
|
|
4284
|
+
}`,mI=`uniform sampler2D shadow_pass;
|
|
4285
4285
|
uniform vec2 resolution;
|
|
4286
4286
|
uniform float radius;
|
|
4287
4287
|
void main() {
|
|
@@ -4306,12 +4306,12 @@ void main() {
|
|
|
4306
4306
|
squared_mean = squared_mean / samples;
|
|
4307
4307
|
float std_dev = sqrt( max( 0.0, squared_mean - mean * mean ) );
|
|
4308
4308
|
gl_FragColor = vec4( mean, std_dev, 0.0, 1.0 );
|
|
4309
|
-
}`,fI=[new H(1,0,0),new H(-1,0,0),new H(0,1,0),new H(0,-1,0),new H(0,0,1),new H(0,0,-1)],pI=[new H(0,-1,0),new H(0,-1,0),new H(0,0,1),new H(0,0,-1),new H(0,-1,0),new H(0,-1,0)],Lf=new Gt,Ar=new H,Yc=new H;function mI(t,e,n){let i=new Y_;const s=new Ke,r=new Ke,o=new Ht,a=new Ew,c=new Tw,l={},u=n.maxTextureSize,h={[vs]:Rn,[Rn]:vs,[wi]:wi},d=new mi({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new Ke},radius:{value:4}},vertexShader:dI,fragmentShader:hI}),f=d.clone();f.defines.HORIZONTAL_PASS=1;const _=new Mn;_.setAttribute("position",new jn(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const x=new ei(_,d),m=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=Yo;let p=this.type;this.render=function(A,P,v){if(m.enabled===!1||m.autoUpdate===!1&&m.needsUpdate===!1||A.length===0)return;this.type===KT&&(Ge("WebGLShadowMap: PCFSoftShadowMap has been removed. Using PCFShadowMap instead."),this.type=Yo);const T=t.getRenderTarget(),I=t.getActiveCubeFace(),N=t.getActiveMipmapLevel(),k=t.state;k.setBlending(Pi),k.buffers.depth.getReversed()===!0?k.buffers.color.setClear(0,0,0,0):k.buffers.color.setClear(1,1,1,1),k.buffers.depth.setTest(!0),k.setScissorTest(!1);const $=p!==this.type;$&&P.traverse(function(U){U.material&&(Array.isArray(U.material)?U.material.forEach(V=>V.needsUpdate=!0):U.material.needsUpdate=!0)});for(let U=0,V=A.length;U<V;U++){const Q=A[U],X=Q.shadow;if(X===void 0){Ge("WebGLShadowMap:",Q,"has no shadow.");continue}if(X.autoUpdate===!1&&X.needsUpdate===!1)continue;s.copy(X.mapSize);const ce=X.getFrameExtents();s.multiply(ce),r.copy(X.mapSize),(s.x>u||s.y>u)&&(s.x>u&&(r.x=Math.floor(u/ce.x),s.x=r.x*ce.x,X.mapSize.x=r.x),s.y>u&&(r.y=Math.floor(u/ce.y),s.y=r.y*ce.y,X.mapSize.y=r.y));const j=t.state.buffers.depth.getReversed();if(X.camera._reversedDepth=j,X.map===null||$===!0){if(X.map!==null&&(X.map.depthTexture!==null&&(X.map.depthTexture.dispose(),X.map.depthTexture=null),X.map.dispose()),this.type===Ir){if(Q.isPointLight){Ge("WebGLShadowMap: VSM shadow maps are not supported for PointLights. Use PCF or BasicShadowMap instead.");continue}X.map=new Kn(s.x,s.y,{format:ys,type:pi,minFilter:pn,magFilter:pn,generateMipmaps:!1}),X.map.texture.name=Q.name+".shadowMap",X.map.depthTexture=new eo(s.x,s.y,ui),X.map.depthTexture.name=Q.name+".shadowMapDepth",X.map.depthTexture.format=Ni,X.map.depthTexture.compareFunction=null,X.map.depthTexture.minFilter=on,X.map.depthTexture.magFilter=on}else Q.isPointLight?(X.map=new iS(s.x),X.map.depthTexture=new Sw(s.x,fi)):(X.map=new Kn(s.x,s.y),X.map.depthTexture=new eo(s.x,s.y,fi)),X.map.depthTexture.name=Q.name+".shadowMap",X.map.depthTexture.format=Ni,this.type===Yo?(X.map.depthTexture.compareFunction=j?gd:md,X.map.depthTexture.minFilter=pn,X.map.depthTexture.magFilter=pn):(X.map.depthTexture.compareFunction=null,X.map.depthTexture.minFilter=on,X.map.depthTexture.magFilter=on);X.camera.updateProjectionMatrix()}X.map.isWebGLCubeRenderTarget!==!0&&(X.map.width!==s.x||X.map.height!==s.y)&&X.map.setSize(s.x,s.y);const se=X.map.isWebGLCubeRenderTarget?6:X.getViewportCount();Q.isPointLight!==!0&&X.updateMatrices(Q,v);for(let oe=0;oe<se;oe++){const Fe=X.getCamera(oe);if(Q.isPointLight){const Le=X.camera,ft=X.matrix,et=Q.distance||Le.far;et!==Le.far&&(Le.far=et,Le.updateProjectionMatrix()),Ar.setFromMatrixPosition(Q.matrixWorld),Le.position.copy(Ar),Yc.copy(Le.position),Yc.add(fI[oe]),Le.up.copy(pI[oe]),Le.lookAt(Yc),Le.updateMatrixWorld(),ft.makeTranslation(-Ar.x,-Ar.y,-Ar.z),Lf.multiplyMatrices(Le.projectionMatrix,Le.matrixWorldInverse),X._frustum.setFromProjectionMatrix(Lf,Le.coordinateSystem,Le.reversedDepth)}if(X.map.isWebGLCubeRenderTarget)t.setRenderTarget(X.map,oe),t.clear();else{oe===0&&(t.setRenderTarget(X.map),t.clear());const Le=X.getViewport(oe);o.set(r.x*Le.x,r.y*Le.y,r.x*Le.z,r.y*Le.w),k.viewport(o)}i=X.getFrustum(oe),b(P,v,Fe,Q,this.type)}X.isPointLightShadow!==!0&&this.type===Ir&&E(X,v),X.needsUpdate=!1}p=this.type,m.needsUpdate=!1,t.setRenderTarget(T,I,N)};function E(A,P){const v=e.update(x);d.defines.VSM_SAMPLES!==A.blurSamples&&(d.defines.VSM_SAMPLES=A.blurSamples,f.defines.VSM_SAMPLES=A.blurSamples,d.needsUpdate=!0,f.needsUpdate=!0),A.mapPass===null?A.mapPass=new Kn(s.x,s.y,{format:ys,type:pi}):(A.mapPass.width!==A.map.width||A.mapPass.height!==A.map.height)&&A.mapPass.setSize(A.map.width,A.map.height),d.uniforms.shadow_pass.value=A.map.depthTexture,d.uniforms.resolution.value.set(A.map.width,A.map.height),d.uniforms.radius.value=A.radius,t.setRenderTarget(A.mapPass),t.clear(),t.renderBufferDirect(P,null,v,d,x,null),f.uniforms.shadow_pass.value=A.mapPass.texture,f.uniforms.resolution.value.set(A.map.width,A.map.height),f.uniforms.radius.value=A.radius,t.setRenderTarget(A.map),t.clear(),t.renderBufferDirect(P,null,v,f,x,null)}function L(A,P,v,T){let I=null;const N=v.isPointLight===!0?A.customDistanceMaterial:A.customDepthMaterial;if(N!==void 0)I=N;else if(I=v.isPointLight===!0?c:a,t.localClippingEnabled&&P.clipShadows===!0&&Array.isArray(P.clippingPlanes)&&P.clippingPlanes.length!==0||P.displacementMap&&P.displacementScale!==0||P.alphaMap&&P.alphaTest>0||P.map&&P.alphaTest>0||P.alphaToCoverage===!0){const k=I.uuid,$=P.uuid;let U=l[k];U===void 0&&(U={},l[k]=U);let V=U[$];V===void 0&&(V=I.clone(),U[$]=V,P.addEventListener("dispose",w)),I=V}if(I.visible=P.visible,I.wireframe=P.wireframe,T===Ir?I.side=P.shadowSide!==null?P.shadowSide:P.side:I.side=P.shadowSide!==null?P.shadowSide:h[P.side],I.alphaMap=P.alphaMap,I.alphaTest=P.alphaToCoverage===!0?.5:P.alphaTest,I.map=P.map,I.clipShadows=P.clipShadows,I.clippingPlanes=P.clippingPlanes,I.clipIntersection=P.clipIntersection,I.displacementMap=P.displacementMap,I.displacementScale=P.displacementScale,I.displacementBias=P.displacementBias,I.wireframeLinewidth=P.wireframeLinewidth,I.linewidth=P.linewidth,v.isPointLight===!0&&I.isMeshDistanceMaterial===!0){const k=t.properties.get(I);k.light=v}return I}function b(A,P,v,T,I){if(A.visible===!1)return;if(A.layers.test(P.layers)&&(A.isMesh||A.isLine||A.isPoints)&&(A.castShadow||A.receiveShadow&&I===Ir)&&(!A.frustumCulled||A.intersectsFrustum(i))){A.modelViewMatrix.multiplyMatrices(v.matrixWorldInverse,A.matrixWorld);const $=e.update(A),U=A.material;if(Array.isArray(U)){const V=$.groups;for(let Q=0,X=V.length;Q<X;Q++){const ce=V[Q],j=U[ce.materialIndex];if(j&&j.visible){const se=L(A,j,T,I);A.onBeforeShadow(t,A,P,v,$,se,ce),t.renderBufferDirect(v,null,$,se,A,ce),A.onAfterShadow(t,A,P,v,$,se,ce)}}}else if(U.visible){const V=L(A,U,T,I);A.onBeforeShadow(t,A,P,v,$,V,null),t.renderBufferDirect(v,null,$,V,A,null),A.onAfterShadow(t,A,P,v,$,V,null)}}const k=A.children;for(let $=0,U=k.length;$<U;$++)b(k[$],P,v,T,I)}function w(A){A.target.removeEventListener("dispose",w);for(const v in l){const T=l[v],I=A.target.uuid;I in T&&(T[I].dispose(),delete T[I])}}}function gI(t,e){function n(){let O=!1;const fe=new Ht;let te=null;const ge=new Ht(0,0,0,0);return{setMask:function(ye){te!==ye&&!O&&(t.colorMask(ye,ye,ye,ye),te=ye)},setLocked:function(ye){O=ye},setClear:function(ye,ie,De,Ce,gt){gt===!0&&(ye*=Ce,ie*=Ce,De*=Ce),fe.set(ye,ie,De,Ce),ge.equals(fe)===!1&&(t.clearColor(ye,ie,De,Ce),ge.copy(fe))},reset:function(){O=!1,te=null,ge.set(-1,0,0,0)}}}function i(){let O=!1,fe=!1,te=null,ge=null,ye=null;return{setReversed:function(ie){if(fe!==ie){const De=e.get("EXT_clip_control");ie?De.clipControlEXT(De.LOWER_LEFT_EXT,De.ZERO_TO_ONE_EXT):De.clipControlEXT(De.LOWER_LEFT_EXT,De.NEGATIVE_ONE_TO_ONE_EXT),fe=ie;const Ce=ye;ye=null,this.setClear(Ce)}},getReversed:function(){return fe},setTest:function(ie){ie?re(t.DEPTH_TEST):Re(t.DEPTH_TEST)},setMask:function(ie){te!==ie&&!O&&(t.depthMask(ie),te=ie)},setFunc:function(ie){if(fe&&(ie=IR[ie]),ge!==ie){switch(ie){case Sl:t.depthFunc(t.NEVER);break;case vl:t.depthFunc(t.ALWAYS);break;case xl:t.depthFunc(t.LESS);break;case Kr:t.depthFunc(t.LEQUAL);break;case yl:t.depthFunc(t.EQUAL);break;case bl:t.depthFunc(t.GEQUAL);break;case Ml:t.depthFunc(t.GREATER);break;case El:t.depthFunc(t.NOTEQUAL);break;default:t.depthFunc(t.LEQUAL)}ge=ie}},setLocked:function(ie){O=ie},setClear:function(ie){ye!==ie&&(ye=ie,fe&&(ie=1-ie),t.clearDepth(ie))},reset:function(){O=!1,te=null,ge=null,ye=null,fe=!1}}}function s(){let O=!1,fe=null,te=null,ge=null,ye=null,ie=null,De=null,Ce=null,gt=null;return{setTest:function(at){O||(at?re(t.STENCIL_TEST):Re(t.STENCIL_TEST))},setMask:function(at){fe!==at&&!O&&(t.stencilMask(at),fe=at)},setFunc:function(at,nn,cn){(te!==at||ge!==nn||ye!==cn)&&(t.stencilFunc(at,nn,cn),te=at,ge=nn,ye=cn)},setOp:function(at,nn,cn){(ie!==at||De!==nn||Ce!==cn)&&(t.stencilOp(at,nn,cn),ie=at,De=nn,Ce=cn)},setLocked:function(at){O=at},setClear:function(at){gt!==at&&(t.clearStencil(at),gt=at)},reset:function(){O=!1,fe=null,te=null,ge=null,ye=null,ie=null,De=null,Ce=null,gt=null}}}const r=new n,o=new i,a=new s,c=new WeakMap,l=new WeakMap;let u={},h={},d={},f=new WeakMap,_=[],x=null,m=!1,p=null,E=null,L=null,b=null,w=null,A=null,P=null,v=new ot(0,0,0),T=0,I=!1,N=null,k=null,$=null,U=null,V=null;const Q=t.getParameter(t.MAX_COMBINED_TEXTURE_IMAGE_UNITS);let X=!1,ce=0;const j=t.getParameter(t.VERSION);j.indexOf("WebGL")!==-1?(ce=parseFloat(/^WebGL (\d)/.exec(j)[1]),X=ce>=1):j.indexOf("OpenGL ES")!==-1&&(ce=parseFloat(/^OpenGL ES (\d)/.exec(j)[1]),X=ce>=2);let se=null,oe={};const Fe=t.getParameter(t.SCISSOR_BOX),Le=t.getParameter(t.VIEWPORT),ft=new Ht().fromArray(Fe),et=new Ht().fromArray(Le);function je(O,fe,te,ge){const ye=new Uint8Array(4),ie=t.createTexture();t.bindTexture(O,ie),t.texParameteri(O,t.TEXTURE_MIN_FILTER,t.NEAREST),t.texParameteri(O,t.TEXTURE_MAG_FILTER,t.NEAREST);for(let De=0;De<te;De++)O===t.TEXTURE_3D||O===t.TEXTURE_2D_ARRAY?t.texImage3D(fe,0,t.RGBA,1,1,ge,0,t.RGBA,t.UNSIGNED_BYTE,ye):t.texImage2D(fe+De,0,t.RGBA,1,1,0,t.RGBA,t.UNSIGNED_BYTE,ye);return ie}const Y={};Y[t.TEXTURE_2D]=je(t.TEXTURE_2D,t.TEXTURE_2D,1),Y[t.TEXTURE_CUBE_MAP]=je(t.TEXTURE_CUBE_MAP,t.TEXTURE_CUBE_MAP_POSITIVE_X,6),Y[t.TEXTURE_2D_ARRAY]=je(t.TEXTURE_2D_ARRAY,t.TEXTURE_2D_ARRAY,1,1),Y[t.TEXTURE_3D]=je(t.TEXTURE_3D,t.TEXTURE_3D,1,1),r.setClear(0,0,0,1),o.setClear(1),a.setClear(0),re(t.DEPTH_TEST),o.setFunc(Kr),Je(!1),vt(Ih),re(t.CULL_FACE),it(Pi);function re(O){u[O]!==!0&&(t.enable(O),u[O]=!0)}function Re(O){u[O]!==!1&&(t.disable(O),u[O]=!1)}function Ve(O,fe){return d[O]!==fe?(t.bindFramebuffer(O,fe),d[O]=fe,O===t.DRAW_FRAMEBUFFER&&(d[t.FRAMEBUFFER]=fe),O===t.FRAMEBUFFER&&(d[t.DRAW_FRAMEBUFFER]=fe),!0):!1}function Me(O,fe){let te=_,ge=!1;if(O){te=f.get(fe),te===void 0&&(te=[],f.set(fe,te));const ye=O.textures;if(te.length!==ye.length||te[0]!==t.COLOR_ATTACHMENT0){for(let ie=0,De=ye.length;ie<De;ie++)te[ie]=t.COLOR_ATTACHMENT0+ie;te.length=ye.length,ge=!0}}else te[0]!==t.BACK&&(te[0]=t.BACK,ge=!0);ge&&t.drawBuffers(te)}function $e(O){return x!==O?(t.useProgram(O),x=O,!0):!1}const Ct={[Hs]:t.FUNC_ADD,[JT]:t.FUNC_SUBTRACT,[QT]:t.FUNC_REVERSE_SUBTRACT};Ct[eR]=t.MIN,Ct[tR]=t.MAX;const Ze={[nR]:t.ZERO,[iR]:t.ONE,[sR]:t.SRC_COLOR,[E_]:t.SRC_ALPHA,[uR]:t.SRC_ALPHA_SATURATE,[cR]:t.DST_COLOR,[oR]:t.DST_ALPHA,[rR]:t.ONE_MINUS_SRC_COLOR,[T_]:t.ONE_MINUS_SRC_ALPHA,[lR]:t.ONE_MINUS_DST_COLOR,[aR]:t.ONE_MINUS_DST_ALPHA,[dR]:t.CONSTANT_COLOR,[hR]:t.ONE_MINUS_CONSTANT_COLOR,[fR]:t.CONSTANT_ALPHA,[pR]:t.ONE_MINUS_CONSTANT_ALPHA};function it(O,fe,te,ge,ye,ie,De,Ce,gt,at){if(O===Pi){m===!0&&(Re(t.BLEND),m=!1);return}if(m===!1&&(re(t.BLEND),m=!0),O!==jT){if(O!==p||at!==I){if((E!==Hs||w!==Hs)&&(t.blendEquation(t.FUNC_ADD),E=Hs,w=Hs),at)switch(O){case Fr:t.blendFuncSeparate(t.ONE,t.ONE_MINUS_SRC_ALPHA,t.ONE,t.ONE_MINUS_SRC_ALPHA);break;case Lh:t.blendFunc(t.ONE,t.ONE);break;case Nh:t.blendFuncSeparate(t.ZERO,t.ONE_MINUS_SRC_COLOR,t.ZERO,t.ONE);break;case Dh:t.blendFuncSeparate(t.DST_COLOR,t.ONE_MINUS_SRC_ALPHA,t.ZERO,t.ONE);break;default:St("WebGLState: Invalid blending: ",O);break}else switch(O){case Fr:t.blendFuncSeparate(t.SRC_ALPHA,t.ONE_MINUS_SRC_ALPHA,t.ONE,t.ONE_MINUS_SRC_ALPHA);break;case Lh:t.blendFuncSeparate(t.SRC_ALPHA,t.ONE,t.ONE,t.ONE);break;case Nh:St("WebGLState: SubtractiveBlending requires material.premultipliedAlpha = true");break;case Dh:St("WebGLState: MultiplyBlending requires material.premultipliedAlpha = true");break;default:St("WebGLState: Invalid blending: ",O);break}L=null,b=null,A=null,P=null,v.set(0,0,0),T=0,p=O,I=at}return}ye=ye||fe,ie=ie||te,De=De||ge,(fe!==E||ye!==w)&&(t.blendEquationSeparate(Ct[fe],Ct[ye]),E=fe,w=ye),(te!==L||ge!==b||ie!==A||De!==P)&&(t.blendFuncSeparate(Ze[te],Ze[ge],Ze[ie],Ze[De]),L=te,b=ge,A=ie,P=De),(Ce.equals(v)===!1||gt!==T)&&(t.blendColor(Ce.r,Ce.g,Ce.b,gt),v.copy(Ce),T=gt),p=O,I=!1}function _t(O,fe){O.side===wi?Re(t.CULL_FACE):re(t.CULL_FACE);let te=O.side===Rn;fe&&(te=!te),Je(te),O.blending===Fr&&O.transparent===!1?it(Pi):it(O.blending,O.blendEquation,O.blendSrc,O.blendDst,O.blendEquationAlpha,O.blendSrcAlpha,O.blendDstAlpha,O.blendColor,O.blendAlpha,O.premultipliedAlpha),o.setFunc(O.depthFunc),o.setTest(O.depthTest),o.setMask(O.depthWrite),r.setMask(O.colorWrite);const ge=O.stencilWrite;a.setTest(ge),ge&&(a.setMask(O.stencilWriteMask),a.setFunc(O.stencilFunc,O.stencilRef,O.stencilFuncMask),a.setOp(O.stencilFail,O.stencilZFail,O.stencilZPass)),qt(O.polygonOffset,O.polygonOffsetFactor,O.polygonOffsetUnits),O.alphaToCoverage===!0?re(t.SAMPLE_ALPHA_TO_COVERAGE):Re(t.SAMPLE_ALPHA_TO_COVERAGE)}function Je(O){N!==O&&(O?t.frontFace(t.CW):t.frontFace(t.CCW),N=O)}function vt(O){O!==XT?(re(t.CULL_FACE),O!==k&&(O===Ih?t.cullFace(t.BACK):O===YT?t.cullFace(t.FRONT):t.cullFace(t.FRONT_AND_BACK))):Re(t.CULL_FACE),k=O}function Ut(O){O!==$&&(X&&t.lineWidth(O),$=O)}function qt(O,fe,te){O?(re(t.POLYGON_OFFSET_FILL),(U!==fe||V!==te)&&(U=fe,V=te,o.getReversed()&&(fe=-fe),t.polygonOffset(fe,te))):Re(t.POLYGON_OFFSET_FILL)}function bt(O){O?re(t.SCISSOR_TEST):Re(t.SCISSOR_TEST)}function Pt(O){O===void 0&&(O=t.TEXTURE0+Q-1),se!==O&&(t.activeTexture(O),se=O)}function F(O,fe,te){te===void 0&&(se===null?te=t.TEXTURE0+Q-1:te=se);let ge=oe[te];ge===void 0&&(ge={type:void 0,texture:void 0},oe[te]=ge),(ge.type!==O||ge.texture!==fe)&&(se!==te&&(t.activeTexture(te),se=te),t.bindTexture(O,fe||Y[O]),ge.type=O,ge.texture=fe)}function zt(){const O=oe[se];O!==void 0&&O.type!==void 0&&(t.bindTexture(O.type,null),O.type=void 0,O.texture=void 0)}function lt(){try{t.compressedTexImage2D(...arguments)}catch(O){St("WebGLState:",O)}}function R(){try{t.compressedTexImage3D(...arguments)}catch(O){St("WebGLState:",O)}}function S(){try{t.texSubImage2D(...arguments)}catch(O){St("WebGLState:",O)}}function z(){try{t.texSubImage3D(...arguments)}catch(O){St("WebGLState:",O)}}function Z(){try{t.compressedTexSubImage2D(...arguments)}catch(O){St("WebGLState:",O)}}function K(){try{t.compressedTexSubImage3D(...arguments)}catch(O){St("WebGLState:",O)}}function le(){try{t.texStorage2D(...arguments)}catch(O){St("WebGLState:",O)}}function de(){try{t.texStorage3D(...arguments)}catch(O){St("WebGLState:",O)}}function J(){try{t.texImage2D(...arguments)}catch(O){St("WebGLState:",O)}}function ne(){try{t.texImage3D(...arguments)}catch(O){St("WebGLState:",O)}}function he(O){return h[O]!==void 0?h[O]:t.getParameter(O)}function Ne(O,fe){h[O]!==fe&&(t.pixelStorei(O,fe),h[O]=fe)}function ue(O){ft.equals(O)===!1&&(t.scissor(O.x,O.y,O.z,O.w),ft.copy(O))}function me(O){et.equals(O)===!1&&(t.viewport(O.x,O.y,O.z,O.w),et.copy(O))}function Pe(O,fe){let te=l.get(fe);te===void 0&&(te=new WeakMap,l.set(fe,te));let ge=te.get(O);ge===void 0&&(ge=t.getUniformBlockIndex(fe,O.name),te.set(O,ge))}function ke(O,fe){const ge=l.get(fe).get(O);c.get(fe)!==ge&&(t.uniformBlockBinding(fe,ge,O.__bindingPointIndex),c.set(fe,ge))}function qe(){t.disable(t.BLEND),t.disable(t.CULL_FACE),t.disable(t.DEPTH_TEST),t.disable(t.POLYGON_OFFSET_FILL),t.disable(t.SCISSOR_TEST),t.disable(t.STENCIL_TEST),t.disable(t.SAMPLE_ALPHA_TO_COVERAGE),t.blendEquation(t.FUNC_ADD),t.blendFunc(t.ONE,t.ZERO),t.blendFuncSeparate(t.ONE,t.ZERO,t.ONE,t.ZERO),t.blendColor(0,0,0,0),t.colorMask(!0,!0,!0,!0),t.clearColor(0,0,0,0),t.depthMask(!0),t.depthFunc(t.LESS),o.setReversed(!1),t.clearDepth(1),t.stencilMask(4294967295),t.stencilFunc(t.ALWAYS,0,4294967295),t.stencilOp(t.KEEP,t.KEEP,t.KEEP),t.clearStencil(0),t.cullFace(t.BACK),t.frontFace(t.CCW),t.polygonOffset(0,0),t.activeTexture(t.TEXTURE0),t.bindFramebuffer(t.FRAMEBUFFER,null),t.bindFramebuffer(t.DRAW_FRAMEBUFFER,null),t.bindFramebuffer(t.READ_FRAMEBUFFER,null),t.useProgram(null),t.lineWidth(1),t.scissor(0,0,t.canvas.width,t.canvas.height),t.viewport(0,0,t.canvas.width,t.canvas.height),t.pixelStorei(t.PACK_ALIGNMENT,4),t.pixelStorei(t.UNPACK_ALIGNMENT,4),t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,!1),t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),t.pixelStorei(t.UNPACK_COLORSPACE_CONVERSION_WEBGL,t.BROWSER_DEFAULT_WEBGL),t.pixelStorei(t.PACK_ROW_LENGTH,0),t.pixelStorei(t.PACK_SKIP_PIXELS,0),t.pixelStorei(t.PACK_SKIP_ROWS,0),t.pixelStorei(t.UNPACK_ROW_LENGTH,0),t.pixelStorei(t.UNPACK_IMAGE_HEIGHT,0),t.pixelStorei(t.UNPACK_SKIP_PIXELS,0),t.pixelStorei(t.UNPACK_SKIP_ROWS,0),t.pixelStorei(t.UNPACK_SKIP_IMAGES,0),u={},h={},se=null,oe={},d={},f=new WeakMap,_=[],x=null,m=!1,p=null,E=null,L=null,b=null,w=null,A=null,P=null,v=new ot(0,0,0),T=0,I=!1,N=null,k=null,$=null,U=null,V=null,ft.set(0,0,t.canvas.width,t.canvas.height),et.set(0,0,t.canvas.width,t.canvas.height),r.reset(),o.reset(),a.reset()}return{buffers:{color:r,depth:o,stencil:a},enable:re,disable:Re,bindFramebuffer:Ve,drawBuffers:Me,useProgram:$e,setBlending:it,setMaterial:_t,setFlipSided:Je,setCullFace:vt,setLineWidth:Ut,setPolygonOffset:qt,setScissorTest:bt,activeTexture:Pt,bindTexture:F,unbindTexture:zt,compressedTexImage2D:lt,compressedTexImage3D:R,texImage2D:J,texImage3D:ne,pixelStorei:Ne,getParameter:he,updateUBOMapping:Pe,uniformBlockBinding:ke,texStorage2D:le,texStorage3D:de,texSubImage2D:S,texSubImage3D:z,compressedTexSubImage2D:Z,compressedTexSubImage3D:K,scissor:ue,viewport:me,reset:qe}}function _I(t,e,n,i,s,r,o){const a=e.has("WEBGL_multisampled_render_to_texture")?e.get("WEBGL_multisampled_render_to_texture"):null,c=typeof navigator>"u"?!1:/OculusBrowser/g.test(navigator.userAgent),l=new Ke,u=new WeakMap,h=new Set;let d;const f=new WeakMap;let _=!1;try{_=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function x(R,S){return _?new OffscreenCanvas(R,S):xa("canvas")}function m(R,S,z){let Z=1;const K=lt(R);if((K.width>z||K.height>z)&&(Z=z/Math.max(K.width,K.height)),Z<1)if(typeof HTMLImageElement<"u"&&R instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&R instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&R instanceof ImageBitmap||typeof VideoFrame<"u"&&R instanceof VideoFrame){const le=Math.floor(Z*K.width),de=Math.floor(Z*K.height);d===void 0&&(d=x(le,de));const J=S?x(le,de):d;return J.width=le,J.height=de,J.getContext("2d").drawImage(R,0,0,le,de),Ge("WebGLRenderer: Texture has been resized from ("+K.width+"x"+K.height+") to ("+le+"x"+de+")."),J}else return"data"in R&&Ge("WebGLRenderer: Image in DataTexture is too big ("+K.width+"x"+K.height+")."),R;return R}function p(R){return R.generateMipmaps}function E(R){t.generateMipmap(R)}function L(R){return R.isWebGLCubeRenderTarget?t.TEXTURE_CUBE_MAP:R.isWebGL3DRenderTarget?t.TEXTURE_3D:R.isWebGLArrayRenderTarget||R.isCompressedArrayTexture?t.TEXTURE_2D_ARRAY:t.TEXTURE_2D}function b(R,S,z,Z,K,le=!1){if(R!==null){if(t[R]!==void 0)return t[R];Ge("WebGLRenderer: Attempt to use non-existing WebGL internal format '"+R+"'")}let de;Z&&(de=e.get("EXT_texture_norm16"),de||Ge("WebGLRenderer: Unable to use normalized textures without EXT_texture_norm16 extension"));let J=S;if(S===t.RED&&(z===t.FLOAT&&(J=t.R32F),z===t.HALF_FLOAT&&(J=t.R16F),z===t.UNSIGNED_BYTE&&(J=t.R8),z===t.UNSIGNED_SHORT&&de&&(J=de.R16_EXT),z===t.SHORT&&de&&(J=de.R16_SNORM_EXT)),S===t.RED_INTEGER&&(z===t.UNSIGNED_BYTE&&(J=t.R8UI),z===t.UNSIGNED_SHORT&&(J=t.R16UI),z===t.UNSIGNED_INT&&(J=t.R32UI),z===t.BYTE&&(J=t.R8I),z===t.SHORT&&(J=t.R16I),z===t.INT&&(J=t.R32I)),S===t.RG&&(z===t.FLOAT&&(J=t.RG32F),z===t.HALF_FLOAT&&(J=t.RG16F),z===t.UNSIGNED_BYTE&&(J=t.RG8),z===t.UNSIGNED_SHORT&&de&&(J=de.RG16_EXT),z===t.SHORT&&de&&(J=de.RG16_SNORM_EXT)),S===t.RG_INTEGER&&(z===t.UNSIGNED_BYTE&&(J=t.RG8UI),z===t.UNSIGNED_SHORT&&(J=t.RG16UI),z===t.UNSIGNED_INT&&(J=t.RG32UI),z===t.BYTE&&(J=t.RG8I),z===t.SHORT&&(J=t.RG16I),z===t.INT&&(J=t.RG32I)),S===t.RGB_INTEGER&&(z===t.UNSIGNED_BYTE&&(J=t.RGB8UI),z===t.UNSIGNED_SHORT&&(J=t.RGB16UI),z===t.UNSIGNED_INT&&(J=t.RGB32UI),z===t.BYTE&&(J=t.RGB8I),z===t.SHORT&&(J=t.RGB16I),z===t.INT&&(J=t.RGB32I)),S===t.RGBA_INTEGER&&(z===t.UNSIGNED_BYTE&&(J=t.RGBA8UI),z===t.UNSIGNED_SHORT&&(J=t.RGBA16UI),z===t.UNSIGNED_INT&&(J=t.RGBA32UI),z===t.BYTE&&(J=t.RGBA8I),z===t.SHORT&&(J=t.RGBA16I),z===t.INT&&(J=t.RGBA32I)),S===t.RGB&&(z===t.UNSIGNED_SHORT&&de&&(J=de.RGB16_EXT),z===t.SHORT&&de&&(J=de.RGB16_SNORM_EXT),z===t.UNSIGNED_INT_5_9_9_9_REV&&(J=t.RGB9_E5),z===t.UNSIGNED_INT_10F_11F_11F_REV&&(J=t.R11F_G11F_B10F)),S===t.RGBA){const ne=le?Sa:dt.getTransfer(K);z===t.FLOAT&&(J=t.RGBA32F),z===t.HALF_FLOAT&&(J=t.RGBA16F),z===t.UNSIGNED_BYTE&&(J=ne===Mt?t.SRGB8_ALPHA8:t.RGBA8),z===t.UNSIGNED_SHORT&&de&&(J=de.RGBA16_EXT),z===t.SHORT&&de&&(J=de.RGBA16_SNORM_EXT),z===t.UNSIGNED_SHORT_4_4_4_4&&(J=t.RGBA4),z===t.UNSIGNED_SHORT_5_5_5_1&&(J=t.RGB5_A1)}return(J===t.R16F||J===t.R32F||J===t.RG16F||J===t.RG32F||J===t.RGBA16F||J===t.RGBA32F)&&e.get("EXT_color_buffer_float"),J}function w(R,S){let z;return R?S===null||S===fi||S===Jr?z=t.DEPTH24_STENCIL8:S===ui?z=t.DEPTH32F_STENCIL8:S===jr&&(z=t.DEPTH24_STENCIL8,Ge("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.")):S===null||S===fi||S===Jr?z=t.DEPTH_COMPONENT24:S===ui?z=t.DEPTH_COMPONENT32F:S===jr&&(z=t.DEPTH_COMPONENT16),z}function A(R,S){return p(R)===!0||R.isFramebufferTexture&&R.minFilter!==on&&R.minFilter!==pn?Math.log2(Math.max(S.width,S.height))+1:R.mipmaps!==void 0&&R.mipmaps.length>0?R.mipmaps.length:R.isCompressedTexture&&Array.isArray(R.image)?S.mipmaps.length:1}function P(R){const S=R.target;S.removeEventListener("dispose",P),T(S),S.isVideoTexture&&u.delete(S),S.isHTMLTexture&&h.delete(S)}function v(R){const S=R.target;S.removeEventListener("dispose",v),N(S)}function T(R){const S=i.get(R);if(S.__webglInit===void 0)return;const z=R.source,Z=f.get(z);if(Z){const K=Z[S.__cacheKey];K.usedTimes--,K.usedTimes===0&&I(R),Object.keys(Z).length===0&&f.delete(z)}i.remove(R)}function I(R){const S=i.get(R);t.deleteTexture(S.__webglTexture);const z=R.source,Z=f.get(z);delete Z[S.__cacheKey],o.memory.textures--}function N(R){const S=i.get(R);if(R.depthTexture&&(R.depthTexture.dispose(),i.remove(R.depthTexture)),R.isWebGLCubeRenderTarget)for(let Z=0;Z<6;Z++){if(Array.isArray(S.__webglFramebuffer[Z]))for(let K=0;K<S.__webglFramebuffer[Z].length;K++)t.deleteFramebuffer(S.__webglFramebuffer[Z][K]);else t.deleteFramebuffer(S.__webglFramebuffer[Z]);S.__webglDepthbuffer&&t.deleteRenderbuffer(S.__webglDepthbuffer[Z])}else{if(Array.isArray(S.__webglFramebuffer))for(let Z=0;Z<S.__webglFramebuffer.length;Z++)t.deleteFramebuffer(S.__webglFramebuffer[Z]);else t.deleteFramebuffer(S.__webglFramebuffer);if(S.__webglDepthbuffer&&t.deleteRenderbuffer(S.__webglDepthbuffer),S.__webglMultisampledFramebuffer&&t.deleteFramebuffer(S.__webglMultisampledFramebuffer),S.__webglColorRenderbuffer)for(let Z=0;Z<S.__webglColorRenderbuffer.length;Z++)S.__webglColorRenderbuffer[Z]&&t.deleteRenderbuffer(S.__webglColorRenderbuffer[Z]);S.__webglDepthRenderbuffer&&t.deleteRenderbuffer(S.__webglDepthRenderbuffer)}const z=R.textures;for(let Z=0,K=z.length;Z<K;Z++){const le=i.get(z[Z]);le.__webglTexture&&(t.deleteTexture(le.__webglTexture),o.memory.textures--),i.remove(z[Z])}i.remove(R)}let k=0;function $(){k=0}function U(){return k}function V(R){k=R}function Q(){const R=k;return R>=s.maxTextures&&Ge("WebGLTextures: Trying to use "+(R+1)+" texture units while this GPU supports only "+s.maxTextures),k+=1,R}function X(R){const S=[];return S.push(R.wrapS),S.push(R.wrapT),S.push(R.wrapR||0),S.push(R.magFilter),S.push(R.minFilter),S.push(R.anisotropy),S.push(R.internalFormat),S.push(R.format),S.push(R.type),S.push(R.generateMipmaps),S.push(R.premultiplyAlpha),S.push(R.flipY),S.push(R.unpackAlignment),S.push(R.colorSpace),S.join()}function ce(R,S){const z=i.get(R);if(R.isVideoTexture&&F(R),R.isRenderTargetTexture===!1&&R.isExternalTexture!==!0&&R.version>0&&z.__version!==R.version){const Z=R.image;if(Z===null)Ge("WebGLRenderer: Texture marked for update but no image data found.");else if(Z.complete===!1)Ge("WebGLRenderer: Texture marked for update but image is incomplete");else{Re(z,R,S);return}}else R.isExternalTexture&&(z.__webglTexture=R.sourceTexture?R.sourceTexture:null);n.bindTexture(t.TEXTURE_2D,z.__webglTexture,t.TEXTURE0+S)}function j(R,S){const z=i.get(R);if(R.isRenderTargetTexture===!1&&R.version>0&&z.__version!==R.version){Re(z,R,S);return}else R.isExternalTexture&&(z.__webglTexture=R.sourceTexture?R.sourceTexture:null);n.bindTexture(t.TEXTURE_2D_ARRAY,z.__webglTexture,t.TEXTURE0+S)}function se(R,S){const z=i.get(R);if(R.isRenderTargetTexture===!1&&R.version>0&&z.__version!==R.version){Re(z,R,S);return}n.bindTexture(t.TEXTURE_3D,z.__webglTexture,t.TEXTURE0+S)}function oe(R,S){const z=i.get(R);if(R.isCubeDepthTexture!==!0&&R.version>0&&z.__version!==R.version){Ve(z,R,S);return}n.bindTexture(t.TEXTURE_CUBE_MAP,z.__webglTexture,t.TEXTURE0+S)}const Fe={[Tl]:t.REPEAT,[Ci]:t.CLAMP_TO_EDGE,[Rl]:t.MIRRORED_REPEAT},Le={[on]:t.NEAREST,[_R]:t.NEAREST_MIPMAP_NEAREST,[yo]:t.NEAREST_MIPMAP_LINEAR,[pn]:t.LINEAR,[yc]:t.LINEAR_MIPMAP_NEAREST,[us]:t.LINEAR_MIPMAP_LINEAR},ft={[yR]:t.NEVER,[RR]:t.ALWAYS,[bR]:t.LESS,[md]:t.LEQUAL,[MR]:t.EQUAL,[gd]:t.GEQUAL,[ER]:t.GREATER,[TR]:t.NOTEQUAL};function et(R,S){if(S.type===ui&&e.has("OES_texture_float_linear")===!1&&(S.magFilter===pn||S.magFilter===yc||S.magFilter===yo||S.magFilter===us||S.minFilter===pn||S.minFilter===yc||S.minFilter===yo||S.minFilter===us)&&Ge("WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."),t.texParameteri(R,t.TEXTURE_WRAP_S,Fe[S.wrapS]),t.texParameteri(R,t.TEXTURE_WRAP_T,Fe[S.wrapT]),(R===t.TEXTURE_3D||R===t.TEXTURE_2D_ARRAY)&&t.texParameteri(R,t.TEXTURE_WRAP_R,Fe[S.wrapR]),t.texParameteri(R,t.TEXTURE_MAG_FILTER,Le[S.magFilter]),t.texParameteri(R,t.TEXTURE_MIN_FILTER,Le[S.minFilter]),S.compareFunction&&(t.texParameteri(R,t.TEXTURE_COMPARE_MODE,t.COMPARE_REF_TO_TEXTURE),t.texParameteri(R,t.TEXTURE_COMPARE_FUNC,ft[S.compareFunction])),e.has("EXT_texture_filter_anisotropic")===!0){if(S.magFilter===on||S.minFilter!==yo&&S.minFilter!==us||S.type===ui&&e.has("OES_texture_float_linear")===!1)return;if(S.anisotropy>1||i.get(S).__currentAnisotropy){const z=e.get("EXT_texture_filter_anisotropic");t.texParameterf(R,z.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(S.anisotropy,s.getMaxAnisotropy())),i.get(S).__currentAnisotropy=S.anisotropy}}}function je(R,S){let z=!1;R.__webglInit===void 0&&(R.__webglInit=!0,S.addEventListener("dispose",P));const Z=S.source;let K=f.get(Z);K===void 0&&(K={},f.set(Z,K));const le=X(S);if(le!==R.__cacheKey){K[le]===void 0&&(K[le]={texture:t.createTexture(),usedTimes:0},o.memory.textures++,z=!0),K[le].usedTimes++;const de=K[R.__cacheKey];de!==void 0&&(K[R.__cacheKey].usedTimes--,de.usedTimes===0&&I(S)),R.__cacheKey=le,R.__webglTexture=K[le].texture}return z}function Y(R,S,z){return Math.floor(Math.floor(R/z)/S)}function re(R,S,z,Z){const le=R.updateRanges;if(le.length===0)n.texSubImage2D(t.TEXTURE_2D,0,0,0,S.width,S.height,z,Z,S.data);else{le.sort((Ne,ue)=>Ne.start-ue.start);let de=0;for(let Ne=1;Ne<le.length;Ne++){const ue=le[de],me=le[Ne],Pe=ue.start+ue.count,ke=Y(me.start,S.width,4),qe=Y(ue.start,S.width,4);me.start<=Pe+1&&ke===qe&&Y(me.start+me.count-1,S.width,4)===ke?ue.count=Math.max(ue.count,me.start+me.count-ue.start):(++de,le[de]=me)}le.length=de+1;const J=n.getParameter(t.UNPACK_ROW_LENGTH),ne=n.getParameter(t.UNPACK_SKIP_PIXELS),he=n.getParameter(t.UNPACK_SKIP_ROWS);n.pixelStorei(t.UNPACK_ROW_LENGTH,S.width);for(let Ne=0,ue=le.length;Ne<ue;Ne++){const me=le[Ne],Pe=Math.floor(me.start/4),ke=Math.ceil(me.count/4),qe=Pe%S.width,O=Math.floor(Pe/S.width),fe=ke,te=1;n.pixelStorei(t.UNPACK_SKIP_PIXELS,qe),n.pixelStorei(t.UNPACK_SKIP_ROWS,O),n.texSubImage2D(t.TEXTURE_2D,0,qe,O,fe,te,z,Z,S.data)}R.clearUpdateRanges(),n.pixelStorei(t.UNPACK_ROW_LENGTH,J),n.pixelStorei(t.UNPACK_SKIP_PIXELS,ne),n.pixelStorei(t.UNPACK_SKIP_ROWS,he)}}function Re(R,S,z){let Z=t.TEXTURE_2D;(S.isDataArrayTexture||S.isCompressedArrayTexture)&&(Z=t.TEXTURE_2D_ARRAY),S.isData3DTexture&&(Z=t.TEXTURE_3D);const K=je(R,S),le=S.source;n.bindTexture(Z,R.__webglTexture,t.TEXTURE0+z);const de=i.get(le);if(le.version!==de.__version||K===!0){if(n.activeTexture(t.TEXTURE0+z),(typeof ImageBitmap<"u"&&S.image instanceof ImageBitmap)===!1){const te=dt.getPrimaries(dt.workingColorSpace),ge=S.colorSpace===Zi?null:dt.getPrimaries(S.colorSpace),ye=S.colorSpace===Zi||te===ge?t.NONE:t.BROWSER_DEFAULT_WEBGL;n.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,S.flipY),n.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,S.premultiplyAlpha),n.pixelStorei(t.UNPACK_COLORSPACE_CONVERSION_WEBGL,ye)}n.pixelStorei(t.UNPACK_ALIGNMENT,S.unpackAlignment);let ne=m(S.image,!1,s.maxTextureSize);ne=zt(S,ne);const he=r.convert(S.format,S.colorSpace),Ne=r.convert(S.type);let ue=b(S.internalFormat,he,Ne,S.normalized,S.colorSpace,S.isVideoTexture);et(Z,S);let me;const Pe=S.mipmaps,ke=S.isVideoTexture!==!0,qe=de.__version===void 0||K===!0,O=le.dataReady,fe=A(S,ne);if(S.isDepthTexture)ue=w(S.format===ds,S.type),qe&&(ke?n.texStorage2D(t.TEXTURE_2D,1,ue,ne.width,ne.height):n.texImage2D(t.TEXTURE_2D,0,ue,ne.width,ne.height,0,he,Ne,null));else if(S.isDataTexture)if(Pe.length>0){ke&&qe&&n.texStorage2D(t.TEXTURE_2D,fe,ue,Pe[0].width,Pe[0].height);for(let te=0,ge=Pe.length;te<ge;te++)me=Pe[te],ke?O&&n.texSubImage2D(t.TEXTURE_2D,te,0,0,me.width,me.height,he,Ne,me.data):n.texImage2D(t.TEXTURE_2D,te,ue,me.width,me.height,0,he,Ne,me.data);S.generateMipmaps=!1}else ke?(qe&&n.texStorage2D(t.TEXTURE_2D,fe,ue,ne.width,ne.height),O&&re(S,ne,he,Ne)):n.texImage2D(t.TEXTURE_2D,0,ue,ne.width,ne.height,0,he,Ne,ne.data);else if(S.isCompressedTexture)if(S.isCompressedArrayTexture){ke&&qe&&n.texStorage3D(t.TEXTURE_2D_ARRAY,fe,ue,Pe[0].width,Pe[0].height,ne.depth);for(let te=0,ge=Pe.length;te<ge;te++)if(me=Pe[te],S.format!==Yn)if(he!==null)if(ke){if(O)if(S.layerUpdates.size>0){const ye=uf(me.width,me.height,S.format,S.type);for(const ie of S.layerUpdates){const De=me.data.subarray(ie*ye/me.data.BYTES_PER_ELEMENT,(ie+1)*ye/me.data.BYTES_PER_ELEMENT);n.compressedTexSubImage3D(t.TEXTURE_2D_ARRAY,te,0,0,ie,me.width,me.height,1,he,De)}}else n.compressedTexSubImage3D(t.TEXTURE_2D_ARRAY,te,0,0,0,me.width,me.height,ne.depth,he,me.data)}else n.compressedTexImage3D(t.TEXTURE_2D_ARRAY,te,ue,me.width,me.height,ne.depth,0,me.data,0,0);else Ge("WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");else ke?O&&n.texSubImage3D(t.TEXTURE_2D_ARRAY,te,0,0,0,me.width,me.height,ne.depth,he,Ne,me.data):n.texImage3D(t.TEXTURE_2D_ARRAY,te,ue,me.width,me.height,ne.depth,0,he,Ne,me.data);S.layerUpdates.size>0&&S.clearLayerUpdates()}else{ke&&qe&&n.texStorage2D(t.TEXTURE_2D,fe,ue,Pe[0].width,Pe[0].height);for(let te=0,ge=Pe.length;te<ge;te++)me=Pe[te],S.format!==Yn?he!==null?ke?O&&n.compressedTexSubImage2D(t.TEXTURE_2D,te,0,0,me.width,me.height,he,me.data):n.compressedTexImage2D(t.TEXTURE_2D,te,ue,me.width,me.height,0,me.data):Ge("WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):ke?O&&n.texSubImage2D(t.TEXTURE_2D,te,0,0,me.width,me.height,he,Ne,me.data):n.texImage2D(t.TEXTURE_2D,te,ue,me.width,me.height,0,he,Ne,me.data)}else if(S.isDataArrayTexture)if(ke){if(qe&&n.texStorage3D(t.TEXTURE_2D_ARRAY,fe,ue,ne.width,ne.height,ne.depth),O)if(S.layerUpdates.size>0){const te=uf(ne.width,ne.height,S.format,S.type);for(const ge of S.layerUpdates){const ye=ne.data.subarray(ge*te/ne.data.BYTES_PER_ELEMENT,(ge+1)*te/ne.data.BYTES_PER_ELEMENT);n.texSubImage3D(t.TEXTURE_2D_ARRAY,0,0,0,ge,ne.width,ne.height,1,he,Ne,ye)}S.clearLayerUpdates()}else n.texSubImage3D(t.TEXTURE_2D_ARRAY,0,0,0,0,ne.width,ne.height,ne.depth,he,Ne,ne.data)}else n.texImage3D(t.TEXTURE_2D_ARRAY,0,ue,ne.width,ne.height,ne.depth,0,he,Ne,ne.data);else if(S.isData3DTexture)ke?(qe&&n.texStorage3D(t.TEXTURE_3D,fe,ue,ne.width,ne.height,ne.depth),O&&n.texSubImage3D(t.TEXTURE_3D,0,0,0,0,ne.width,ne.height,ne.depth,he,Ne,ne.data)):n.texImage3D(t.TEXTURE_3D,0,ue,ne.width,ne.height,ne.depth,0,he,Ne,ne.data);else if(S.isFramebufferTexture){if(qe)if(ke)n.texStorage2D(t.TEXTURE_2D,fe,ue,ne.width,ne.height);else{let te=ne.width,ge=ne.height;for(let ye=0;ye<fe;ye++)n.texImage2D(t.TEXTURE_2D,ye,ue,te,ge,0,he,Ne,null),te>>=1,ge>>=1}}else if(S.isHTMLTexture){if("texElementImage2D"in t){const te=t.canvas;if(te.hasAttribute("layoutsubtree")||te.setAttribute("layoutsubtree","true"),ne.parentNode!==te){te.appendChild(ne),h.add(S),te.onpaint=ge=>{const ye=ge.changedElements;for(const ie of h)ye.includes(ie.image)&&(ie.needsUpdate=!0)},te.requestPaint();return}if(t.texElementImage2D.length===3)t.texElementImage2D(t.TEXTURE_2D,t.RGBA8,ne);else{const ye=t.RGBA,ie=t.RGBA,De=t.UNSIGNED_BYTE;t.texElementImage2D(t.TEXTURE_2D,0,ye,ie,De,ne)}t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_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)}}else if(Pe.length>0){if(ke&&qe){const te=lt(Pe[0]);n.texStorage2D(t.TEXTURE_2D,fe,ue,te.width,te.height)}for(let te=0,ge=Pe.length;te<ge;te++)me=Pe[te],ke?O&&n.texSubImage2D(t.TEXTURE_2D,te,0,0,he,Ne,me):n.texImage2D(t.TEXTURE_2D,te,ue,he,Ne,me);S.generateMipmaps=!1}else if(ke){if(qe){const te=lt(ne);n.texStorage2D(t.TEXTURE_2D,fe,ue,te.width,te.height)}O&&n.texSubImage2D(t.TEXTURE_2D,0,0,0,he,Ne,ne)}else n.texImage2D(t.TEXTURE_2D,0,ue,he,Ne,ne);p(S)&&E(Z),de.__version=le.version,S.onUpdate&&S.onUpdate(S)}R.__version=S.version}function Ve(R,S,z){if(S.image.length!==6)return;const Z=je(R,S),K=S.source;n.bindTexture(t.TEXTURE_CUBE_MAP,R.__webglTexture,t.TEXTURE0+z);const le=i.get(K);if(K.version!==le.__version||Z===!0){n.activeTexture(t.TEXTURE0+z);const de=dt.getPrimaries(dt.workingColorSpace),J=S.colorSpace===Zi?null:dt.getPrimaries(S.colorSpace),ne=S.colorSpace===Zi||de===J?t.NONE:t.BROWSER_DEFAULT_WEBGL;n.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,S.flipY),n.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,S.premultiplyAlpha),n.pixelStorei(t.UNPACK_ALIGNMENT,S.unpackAlignment),n.pixelStorei(t.UNPACK_COLORSPACE_CONVERSION_WEBGL,ne);const he=S.isCompressedTexture||S.image[0].isCompressedTexture,Ne=S.image[0]&&S.image[0].isDataTexture,ue=[];for(let ie=0;ie<6;ie++)!he&&!Ne?ue[ie]=m(S.image[ie],!0,s.maxCubemapSize):ue[ie]=Ne?S.image[ie].image:S.image[ie],ue[ie]=zt(S,ue[ie]);const me=ue[0],Pe=r.convert(S.format,S.colorSpace),ke=r.convert(S.type),qe=b(S.internalFormat,Pe,ke,S.normalized,S.colorSpace),O=S.isVideoTexture!==!0,fe=le.__version===void 0||Z===!0,te=K.dataReady;let ge=A(S,me);et(t.TEXTURE_CUBE_MAP,S);let ye;if(he){O&&fe&&n.texStorage2D(t.TEXTURE_CUBE_MAP,ge,qe,me.width,me.height);for(let ie=0;ie<6;ie++){ye=ue[ie].mipmaps;for(let De=0;De<ye.length;De++){const Ce=ye[De];S.format!==Yn?Pe!==null?O?te&&n.compressedTexSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+ie,De,0,0,Ce.width,Ce.height,Pe,Ce.data):n.compressedTexImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+ie,De,qe,Ce.width,Ce.height,0,Ce.data):Ge("WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):O?te&&n.texSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+ie,De,0,0,Ce.width,Ce.height,Pe,ke,Ce.data):n.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+ie,De,qe,Ce.width,Ce.height,0,Pe,ke,Ce.data)}}}else{if(ye=S.mipmaps,O&&fe){ye.length>0&&ge++;const ie=lt(ue[0]);n.texStorage2D(t.TEXTURE_CUBE_MAP,ge,qe,ie.width,ie.height)}for(let ie=0;ie<6;ie++)if(Ne){O?te&&n.texSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+ie,0,0,0,ue[ie].width,ue[ie].height,Pe,ke,ue[ie].data):n.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+ie,0,qe,ue[ie].width,ue[ie].height,0,Pe,ke,ue[ie].data);for(let De=0;De<ye.length;De++){const gt=ye[De].image[ie].image;O?te&&n.texSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+ie,De+1,0,0,gt.width,gt.height,Pe,ke,gt.data):n.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+ie,De+1,qe,gt.width,gt.height,0,Pe,ke,gt.data)}}else{O?te&&n.texSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+ie,0,0,0,Pe,ke,ue[ie]):n.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+ie,0,qe,Pe,ke,ue[ie]);for(let De=0;De<ye.length;De++){const Ce=ye[De];O?te&&n.texSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+ie,De+1,0,0,Pe,ke,Ce.image[ie]):n.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+ie,De+1,qe,Pe,ke,Ce.image[ie])}}}p(S)&&E(t.TEXTURE_CUBE_MAP),le.__version=K.version,S.onUpdate&&S.onUpdate(S)}R.__version=S.version}function Me(R,S,z,Z,K,le){const de=r.convert(z.format,z.colorSpace),J=r.convert(z.type),ne=b(z.internalFormat,de,J,z.normalized,z.colorSpace),he=i.get(S),Ne=i.get(z);if(Ne.__renderTarget=S,!he.__hasExternalTextures){const ue=Math.max(1,S.width>>le),me=Math.max(1,S.height>>le);K===t.TEXTURE_3D||K===t.TEXTURE_2D_ARRAY?n.texImage3D(K,le,ne,ue,me,S.depth,0,de,J,null):n.texImage2D(K,le,ne,ue,me,0,de,J,null)}n.bindFramebuffer(t.FRAMEBUFFER,R),Pt(S)?a.framebufferTexture2DMultisampleEXT(t.FRAMEBUFFER,Z,K,Ne.__webglTexture,0,bt(S)):(K===t.TEXTURE_2D||K>=t.TEXTURE_CUBE_MAP_POSITIVE_X&&K<=t.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&t.framebufferTexture2D(t.FRAMEBUFFER,Z,K,Ne.__webglTexture,le),n.bindFramebuffer(t.FRAMEBUFFER,null)}function $e(R,S,z){if(t.bindRenderbuffer(t.RENDERBUFFER,R),S.depthBuffer){const Z=S.depthTexture,K=Z&&Z.isDepthTexture?Z.type:null,le=w(S.stencilBuffer,K),de=S.stencilBuffer?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT;Pt(S)?a.renderbufferStorageMultisampleEXT(t.RENDERBUFFER,bt(S),le,S.width,S.height):z?t.renderbufferStorageMultisample(t.RENDERBUFFER,bt(S),le,S.width,S.height):t.renderbufferStorage(t.RENDERBUFFER,le,S.width,S.height),t.framebufferRenderbuffer(t.FRAMEBUFFER,de,t.RENDERBUFFER,R)}else{const Z=S.textures;for(let K=0;K<Z.length;K++){const le=Z[K],de=r.convert(le.format,le.colorSpace),J=r.convert(le.type),ne=b(le.internalFormat,de,J,le.normalized,le.colorSpace);Pt(S)?a.renderbufferStorageMultisampleEXT(t.RENDERBUFFER,bt(S),ne,S.width,S.height):z?t.renderbufferStorageMultisample(t.RENDERBUFFER,bt(S),ne,S.width,S.height):t.renderbufferStorage(t.RENDERBUFFER,ne,S.width,S.height)}}t.bindRenderbuffer(t.RENDERBUFFER,null)}function Ct(R,S,z){const Z=S.isWebGLCubeRenderTarget===!0;if(n.bindFramebuffer(t.FRAMEBUFFER,R),!(S.depthTexture&&S.depthTexture.isDepthTexture))throw new Error("THREE.WebGLTextures: renderTarget.depthTexture must be an instance of THREE.DepthTexture.");const K=i.get(S.depthTexture);if(K.__renderTarget=S,(!K.__webglTexture||S.depthTexture.image.width!==S.width||S.depthTexture.image.height!==S.height)&&(S.depthTexture.image.width=S.width,S.depthTexture.image.height=S.height,S.depthTexture.needsUpdate=!0),Z){if(K.__webglInit===void 0&&(K.__webglInit=!0,S.depthTexture.addEventListener("dispose",P)),K.__webglTexture===void 0){K.__webglTexture=t.createTexture(),n.bindTexture(t.TEXTURE_CUBE_MAP,K.__webglTexture),et(t.TEXTURE_CUBE_MAP,S.depthTexture);const he=r.convert(S.depthTexture.format),Ne=r.convert(S.depthTexture.type);let ue;S.depthTexture.format===Ni?ue=t.DEPTH_COMPONENT24:S.depthTexture.format===ds&&(ue=t.DEPTH24_STENCIL8);for(let me=0;me<6;me++)t.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+me,0,ue,S.width,S.height,0,he,Ne,null)}}else ce(S.depthTexture,0);const le=K.__webglTexture,de=bt(S),J=Z?t.TEXTURE_CUBE_MAP_POSITIVE_X+z:t.TEXTURE_2D,ne=S.depthTexture.format===ds?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT;if(S.depthTexture.format===Ni)Pt(S)?a.framebufferTexture2DMultisampleEXT(t.FRAMEBUFFER,ne,J,le,0,de):t.framebufferTexture2D(t.FRAMEBUFFER,ne,J,le,0);else if(S.depthTexture.format===ds)Pt(S)?a.framebufferTexture2DMultisampleEXT(t.FRAMEBUFFER,ne,J,le,0,de):t.framebufferTexture2D(t.FRAMEBUFFER,ne,J,le,0);else throw new Error("THREE.WebGLTextures: Unknown depthTexture format.")}function Ze(R){const S=i.get(R),z=R.isWebGLCubeRenderTarget===!0;if(S.__boundDepthTexture!==R.depthTexture){const Z=R.depthTexture;if(S.__depthDisposeCallback&&S.__depthDisposeCallback(),Z){const K=()=>{delete S.__boundDepthTexture,delete S.__depthDisposeCallback,Z.removeEventListener("dispose",K)};Z.addEventListener("dispose",K),S.__depthDisposeCallback=K}S.__boundDepthTexture=Z}if(R.depthTexture&&!S.__autoAllocateDepthBuffer)if(z)for(let Z=0;Z<6;Z++)Ct(S.__webglFramebuffer[Z],R,Z);else{const Z=R.texture.mipmaps;Z&&Z.length>0?Ct(S.__webglFramebuffer[0],R,0):Ct(S.__webglFramebuffer,R,0)}else if(z){S.__webglDepthbuffer=[];for(let Z=0;Z<6;Z++)if(n.bindFramebuffer(t.FRAMEBUFFER,S.__webglFramebuffer[Z]),S.__webglDepthbuffer[Z]===void 0)S.__webglDepthbuffer[Z]=t.createRenderbuffer(),$e(S.__webglDepthbuffer[Z],R,!1);else{const K=R.stencilBuffer?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT,le=S.__webglDepthbuffer[Z];t.bindRenderbuffer(t.RENDERBUFFER,le),t.framebufferRenderbuffer(t.FRAMEBUFFER,K,t.RENDERBUFFER,le)}}else{const Z=R.texture.mipmaps;if(Z&&Z.length>0?n.bindFramebuffer(t.FRAMEBUFFER,S.__webglFramebuffer[0]):n.bindFramebuffer(t.FRAMEBUFFER,S.__webglFramebuffer),S.__webglDepthbuffer===void 0)S.__webglDepthbuffer=t.createRenderbuffer(),$e(S.__webglDepthbuffer,R,!1);else{const K=R.stencilBuffer?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT,le=S.__webglDepthbuffer;t.bindRenderbuffer(t.RENDERBUFFER,le),t.framebufferRenderbuffer(t.FRAMEBUFFER,K,t.RENDERBUFFER,le)}}n.bindFramebuffer(t.FRAMEBUFFER,null)}function it(R,S,z){const Z=i.get(R);S!==void 0&&Me(Z.__webglFramebuffer,R,R.texture,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,0),z!==void 0&&Ze(R)}function _t(R){const S=R.texture,z=i.get(R),Z=i.get(S);R.addEventListener("dispose",v);const K=R.textures,le=R.isWebGLCubeRenderTarget===!0,de=K.length>1;if(de||(Z.__webglTexture===void 0&&(Z.__webglTexture=t.createTexture()),Z.__version=S.version,o.memory.textures++),le){z.__webglFramebuffer=[];for(let J=0;J<6;J++)if(S.mipmaps&&S.mipmaps.length>0){z.__webglFramebuffer[J]=[];for(let ne=0;ne<S.mipmaps.length;ne++)z.__webglFramebuffer[J][ne]=t.createFramebuffer()}else z.__webglFramebuffer[J]=t.createFramebuffer()}else{if(S.mipmaps&&S.mipmaps.length>0){z.__webglFramebuffer=[];for(let J=0;J<S.mipmaps.length;J++)z.__webglFramebuffer[J]=t.createFramebuffer()}else z.__webglFramebuffer=t.createFramebuffer();if(de)for(let J=0,ne=K.length;J<ne;J++){const he=i.get(K[J]);he.__webglTexture===void 0&&(he.__webglTexture=t.createTexture(),o.memory.textures++)}if(R.samples>0&&Pt(R)===!1){z.__webglMultisampledFramebuffer=t.createFramebuffer(),z.__webglColorRenderbuffer=[],n.bindFramebuffer(t.FRAMEBUFFER,z.__webglMultisampledFramebuffer);for(let J=0;J<K.length;J++){const ne=K[J];z.__webglColorRenderbuffer[J]=t.createRenderbuffer(),t.bindRenderbuffer(t.RENDERBUFFER,z.__webglColorRenderbuffer[J]);const he=r.convert(ne.format,ne.colorSpace),Ne=r.convert(ne.type),ue=b(ne.internalFormat,he,Ne,ne.normalized,ne.colorSpace,R.isXRRenderTarget===!0),me=bt(R);t.renderbufferStorageMultisample(t.RENDERBUFFER,me,ue,R.width,R.height),t.framebufferRenderbuffer(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0+J,t.RENDERBUFFER,z.__webglColorRenderbuffer[J])}t.bindRenderbuffer(t.RENDERBUFFER,null),R.depthBuffer&&(z.__webglDepthRenderbuffer=t.createRenderbuffer(),$e(z.__webglDepthRenderbuffer,R,!0)),n.bindFramebuffer(t.FRAMEBUFFER,null)}}if(le){n.bindTexture(t.TEXTURE_CUBE_MAP,Z.__webglTexture),et(t.TEXTURE_CUBE_MAP,S);for(let J=0;J<6;J++)if(S.mipmaps&&S.mipmaps.length>0)for(let ne=0;ne<S.mipmaps.length;ne++)Me(z.__webglFramebuffer[J][ne],R,S,t.COLOR_ATTACHMENT0,t.TEXTURE_CUBE_MAP_POSITIVE_X+J,ne);else Me(z.__webglFramebuffer[J],R,S,t.COLOR_ATTACHMENT0,t.TEXTURE_CUBE_MAP_POSITIVE_X+J,0);p(S)&&E(t.TEXTURE_CUBE_MAP),n.unbindTexture()}else if(de){for(let J=0,ne=K.length;J<ne;J++){const he=K[J],Ne=i.get(he);let ue=t.TEXTURE_2D;(R.isWebGL3DRenderTarget||R.isWebGLArrayRenderTarget)&&(ue=R.isWebGL3DRenderTarget?t.TEXTURE_3D:t.TEXTURE_2D_ARRAY),n.bindTexture(ue,Ne.__webglTexture),et(ue,he),Me(z.__webglFramebuffer,R,he,t.COLOR_ATTACHMENT0+J,ue,0),p(he)&&E(ue)}n.unbindTexture()}else{let J=t.TEXTURE_2D;if((R.isWebGL3DRenderTarget||R.isWebGLArrayRenderTarget)&&(J=R.isWebGL3DRenderTarget?t.TEXTURE_3D:t.TEXTURE_2D_ARRAY),n.bindTexture(J,Z.__webglTexture),et(J,S),S.mipmaps&&S.mipmaps.length>0)for(let ne=0;ne<S.mipmaps.length;ne++)Me(z.__webglFramebuffer[ne],R,S,t.COLOR_ATTACHMENT0,J,ne);else Me(z.__webglFramebuffer,R,S,t.COLOR_ATTACHMENT0,J,0);p(S)&&E(J),n.unbindTexture()}R.depthBuffer&&Ze(R)}function Je(R){const S=R.textures;for(let z=0,Z=S.length;z<Z;z++){const K=S[z];if(p(K)){const le=L(R),de=i.get(K).__webglTexture;n.bindTexture(le,de),E(le),n.unbindTexture()}}}const vt=[],Ut=[];function qt(R){if(R.samples>0){if(Pt(R)===!1){const S=R.textures,z=R.width,Z=R.height;let K=t.COLOR_BUFFER_BIT;const le=R.stencilBuffer?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT,de=i.get(R),J=S.length>1;if(J)for(let he=0;he<S.length;he++)n.bindFramebuffer(t.FRAMEBUFFER,de.__webglMultisampledFramebuffer),t.framebufferRenderbuffer(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0+he,t.RENDERBUFFER,null),n.bindFramebuffer(t.FRAMEBUFFER,de.__webglFramebuffer),t.framebufferTexture2D(t.DRAW_FRAMEBUFFER,t.COLOR_ATTACHMENT0+he,t.TEXTURE_2D,null,0);n.bindFramebuffer(t.READ_FRAMEBUFFER,de.__webglMultisampledFramebuffer);const ne=R.texture.mipmaps;ne&&ne.length>0?n.bindFramebuffer(t.DRAW_FRAMEBUFFER,de.__webglFramebuffer[0]):n.bindFramebuffer(t.DRAW_FRAMEBUFFER,de.__webglFramebuffer);for(let he=0;he<S.length;he++){if(R.resolveDepthBuffer&&(R.depthBuffer&&(K|=t.DEPTH_BUFFER_BIT),R.stencilBuffer&&R.resolveStencilBuffer&&(K|=t.STENCIL_BUFFER_BIT)),J){t.framebufferRenderbuffer(t.READ_FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.RENDERBUFFER,de.__webglColorRenderbuffer[he]);const Ne=i.get(S[he]).__webglTexture;t.framebufferTexture2D(t.DRAW_FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,Ne,0)}t.blitFramebuffer(0,0,z,Z,0,0,z,Z,K,t.NEAREST),c===!0&&(vt.length=0,Ut.length=0,vt.push(t.COLOR_ATTACHMENT0+he),R.depthBuffer&&R.storeMultisampledDepthBuffer===!1&&(vt.push(le),Ut.push(le),t.invalidateFramebuffer(t.DRAW_FRAMEBUFFER,Ut)),t.invalidateFramebuffer(t.READ_FRAMEBUFFER,vt))}if(n.bindFramebuffer(t.READ_FRAMEBUFFER,null),n.bindFramebuffer(t.DRAW_FRAMEBUFFER,null),J)for(let he=0;he<S.length;he++){n.bindFramebuffer(t.FRAMEBUFFER,de.__webglMultisampledFramebuffer),t.framebufferRenderbuffer(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0+he,t.RENDERBUFFER,de.__webglColorRenderbuffer[he]);const Ne=i.get(S[he]).__webglTexture;n.bindFramebuffer(t.FRAMEBUFFER,de.__webglFramebuffer),t.framebufferTexture2D(t.DRAW_FRAMEBUFFER,t.COLOR_ATTACHMENT0+he,t.TEXTURE_2D,Ne,0)}n.bindFramebuffer(t.DRAW_FRAMEBUFFER,de.__webglMultisampledFramebuffer)}else if(R.depthBuffer&&R.storeMultisampledDepthBuffer===!1&&c){const S=R.stencilBuffer?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT;t.invalidateFramebuffer(t.DRAW_FRAMEBUFFER,[S])}}}function bt(R){return Math.min(s.maxSamples,R.samples)}function Pt(R){const S=i.get(R);return R.samples>0&&e.has("WEBGL_multisampled_render_to_texture")===!0&&S.__useRenderToTexture!==!1}function F(R){const S=o.render.frame;u.get(R)!==S&&(u.set(R,S),R.update())}function zt(R,S){const z=R.colorSpace,Z=R.format,K=R.type;return R.isCompressedTexture===!0||R.isVideoTexture===!0||z!==_a&&z!==Zi&&(dt.getTransfer(z)===Mt?(Z!==Yn||K!==Hn)&&Ge("WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):St("WebGLTextures: Unsupported texture color space:",z)),S}function lt(R){return typeof HTMLImageElement<"u"&&R instanceof HTMLImageElement?(l.width=R.naturalWidth||R.width,l.height=R.naturalHeight||R.height):typeof VideoFrame<"u"&&R instanceof VideoFrame?(l.width=R.displayWidth,l.height=R.displayHeight):(l.width=R.width,l.height=R.height),l}this.allocateTextureUnit=Q,this.resetTextureUnits=$,this.getTextureUnits=U,this.setTextureUnits=V,this.setTexture2D=ce,this.setTexture2DArray=j,this.setTexture3D=se,this.setTextureCube=oe,this.rebindTextures=it,this.setupRenderTarget=_t,this.updateRenderTargetMipmap=Je,this.updateMultisampleRenderTarget=qt,this.setupDepthRenderbuffer=Ze,this.setupFrameBufferTexture=Me,this.useMultisampledRTT=Pt,this.isReversedDepthBuffer=function(){return n.buffers.depth.getReversed()}}function SI(t,e){function n(i,s=Zi){let r;const o=dt.getTransfer(s);if(i===Hn)return t.UNSIGNED_BYTE;if(i===ud)return t.UNSIGNED_SHORT_4_4_4_4;if(i===dd)return t.UNSIGNED_SHORT_5_5_5_1;if(i===F_)return t.UNSIGNED_INT_5_9_9_9_REV;if(i===k_)return t.UNSIGNED_INT_10F_11F_11F_REV;if(i===U_)return t.BYTE;if(i===O_)return t.SHORT;if(i===jr)return t.UNSIGNED_SHORT;if(i===ld)return t.INT;if(i===fi)return t.UNSIGNED_INT;if(i===ui)return t.FLOAT;if(i===pi)return t.HALF_FLOAT;if(i===z_)return t.ALPHA;if(i===B_)return t.RGB;if(i===Yn)return t.RGBA;if(i===Ni)return t.DEPTH_COMPONENT;if(i===ds)return t.DEPTH_STENCIL;if(i===H_)return t.RED;if(i===hd)return t.RED_INTEGER;if(i===ys)return t.RG;if(i===fd)return t.RG_INTEGER;if(i===pd)return t.RGBA_INTEGER;if(i===Ko||i===jo||i===Jo||i===Qo)if(o===Mt)if(r=e.get("WEBGL_compressed_texture_s3tc_srgb"),r!==null){if(i===Ko)return r.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(i===jo)return r.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(i===Jo)return r.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(i===Qo)return r.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(r=e.get("WEBGL_compressed_texture_s3tc"),r!==null){if(i===Ko)return r.COMPRESSED_RGB_S3TC_DXT1_EXT;if(i===jo)return r.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(i===Jo)return r.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(i===Qo)return r.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(i===wl||i===Al||i===Cl||i===Pl)if(r=e.get("WEBGL_compressed_texture_pvrtc"),r!==null){if(i===wl)return r.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(i===Al)return r.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(i===Cl)return r.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(i===Pl)return r.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(i===Il||i===Ll||i===Nl||i===Dl||i===Ul||i===ma||i===Ol)if(r=e.get("WEBGL_compressed_texture_etc"),r!==null){if(i===Il||i===Ll)return o===Mt?r.COMPRESSED_SRGB8_ETC2:r.COMPRESSED_RGB8_ETC2;if(i===Nl)return o===Mt?r.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:r.COMPRESSED_RGBA8_ETC2_EAC;if(i===Dl)return r.COMPRESSED_R11_EAC;if(i===Ul)return r.COMPRESSED_SIGNED_R11_EAC;if(i===ma)return r.COMPRESSED_RG11_EAC;if(i===Ol)return r.COMPRESSED_SIGNED_RG11_EAC}else return null;if(i===Fl||i===kl||i===zl||i===Bl||i===Hl||i===Vl||i===Gl||i===ql||i===$l||i===Wl||i===Zl||i===Xl||i===Yl||i===Kl)if(r=e.get("WEBGL_compressed_texture_astc"),r!==null){if(i===Fl)return o===Mt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:r.COMPRESSED_RGBA_ASTC_4x4_KHR;if(i===kl)return o===Mt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:r.COMPRESSED_RGBA_ASTC_5x4_KHR;if(i===zl)return o===Mt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:r.COMPRESSED_RGBA_ASTC_5x5_KHR;if(i===Bl)return o===Mt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:r.COMPRESSED_RGBA_ASTC_6x5_KHR;if(i===Hl)return o===Mt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:r.COMPRESSED_RGBA_ASTC_6x6_KHR;if(i===Vl)return o===Mt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:r.COMPRESSED_RGBA_ASTC_8x5_KHR;if(i===Gl)return o===Mt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:r.COMPRESSED_RGBA_ASTC_8x6_KHR;if(i===ql)return o===Mt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:r.COMPRESSED_RGBA_ASTC_8x8_KHR;if(i===$l)return o===Mt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:r.COMPRESSED_RGBA_ASTC_10x5_KHR;if(i===Wl)return o===Mt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:r.COMPRESSED_RGBA_ASTC_10x6_KHR;if(i===Zl)return o===Mt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:r.COMPRESSED_RGBA_ASTC_10x8_KHR;if(i===Xl)return o===Mt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:r.COMPRESSED_RGBA_ASTC_10x10_KHR;if(i===Yl)return o===Mt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:r.COMPRESSED_RGBA_ASTC_12x10_KHR;if(i===Kl)return o===Mt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:r.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(i===jl||i===Jl||i===Ql)if(r=e.get("EXT_texture_compression_bptc"),r!==null){if(i===jl)return o===Mt?r.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:r.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(i===Jl)return r.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(i===Ql)return r.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(i===eu||i===tu||i===ga||i===nu)if(r=e.get("EXT_texture_compression_rgtc"),r!==null){if(i===eu)return r.COMPRESSED_RED_RGTC1_EXT;if(i===tu)return r.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(i===ga)return r.COMPRESSED_RED_GREEN_RGTC2_EXT;if(i===nu)return r.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return i===Jr?t.UNSIGNED_INT_24_8:t[i]!==void 0?t[i]:null}return{convert:n}}const vI=`
|
|
4309
|
+
}`,gI=[new H(1,0,0),new H(-1,0,0),new H(0,1,0),new H(0,-1,0),new H(0,0,1),new H(0,0,-1)],_I=[new H(0,-1,0),new H(0,-1,0),new H(0,0,1),new H(0,0,-1),new H(0,-1,0),new H(0,-1,0)],fp=new $t,Hr=new H,ml=new H;function SI(t,e,n){let i=new US;const s=new je,r=new je,o=new Vt,a=new wA,c=new AA,l={},u=n.maxTextureSize,h={[As]:Cn,[Cn]:As,[Ni]:Ni},d=new yi({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new je},radius:{value:4}},vertexShader:pI,fragmentShader:mI}),f=d.clone();f.defines.HORIZONTAL_PASS=1;const _=new Nn;_.setAttribute("position",new ti(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const x=new si(_,d),m=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=oa;let p=this.type;this.render=function(A,P,v){if(m.enabled===!1||m.autoUpdate===!1&&m.needsUpdate===!1||A.length===0)return;this.type===QR&&($e("WebGLShadowMap: PCFSoftShadowMap has been removed. Using PCFShadowMap instead."),this.type=oa);const T=t.getRenderTarget(),L=t.getActiveCubeFace(),N=t.getActiveMipmapLevel(),k=t.state;k.setBlending(Oi),k.buffers.depth.getReversed()===!0?k.buffers.color.setClear(0,0,0,0):k.buffers.color.setClear(1,1,1,1),k.buffers.depth.setTest(!0),k.setScissorTest(!1);const q=p!==this.type;q&&P.traverse(function(U){U.material&&(Array.isArray(U.material)?U.material.forEach(V=>V.needsUpdate=!0):U.material.needsUpdate=!0)});for(let U=0,V=A.length;U<V;U++){const Q=A[U],X=Q.shadow;if(X===void 0){$e("WebGLShadowMap:",Q,"has no shadow.");continue}if(X.autoUpdate===!1&&X.needsUpdate===!1)continue;s.copy(X.mapSize);const ce=X.getFrameExtents();s.multiply(ce),r.copy(X.mapSize),(s.x>u||s.y>u)&&(s.x>u&&(r.x=Math.floor(u/ce.x),s.x=r.x*ce.x,X.mapSize.x=r.x),s.y>u&&(r.y=Math.floor(u/ce.y),s.y=r.y*ce.y,X.mapSize.y=r.y));const j=t.state.buffers.depth.getReversed();if(X.camera._reversedDepth=j,X.map===null||q===!0){if(X.map!==null&&(X.map.depthTexture!==null&&(X.map.depthTexture.dispose(),X.map.depthTexture=null),X.map.dispose()),this.type===$r){if(Q.isPointLight){$e("WebGLShadowMap: VSM shadow maps are not supported for PointLights. Use PCF or BasicShadowMap instead.");continue}X.map=new ei(s.x,s.y,{format:Ps,type:xi,minFilter:_n,magFilter:_n,generateMipmaps:!1}),X.map.texture.name=Q.name+".shadowMap",X.map.depthTexture=new fo(s.x,s.y,mi),X.map.depthTexture.name=Q.name+".shadowMapDepth",X.map.depthTexture.format=zi,X.map.depthTexture.compareFunction=null,X.map.depthTexture.minFilter=ln,X.map.depthTexture.magFilter=ln}else Q.isPointLight?(X.map=new $S(s.x),X.map.depthTexture=new yA(s.x,vi)):(X.map=new ei(s.x,s.y),X.map.depthTexture=new fo(s.x,s.y,vi)),X.map.depthTexture.name=Q.name+".shadowMap",X.map.depthTexture.format=zi,this.type===oa?(X.map.depthTexture.compareFunction=j?Hd:Bd,X.map.depthTexture.minFilter=_n,X.map.depthTexture.magFilter=_n):(X.map.depthTexture.compareFunction=null,X.map.depthTexture.minFilter=ln,X.map.depthTexture.magFilter=ln);X.camera.updateProjectionMatrix()}X.map.isWebGLCubeRenderTarget!==!0&&(X.map.width!==s.x||X.map.height!==s.y)&&X.map.setSize(s.x,s.y);const se=X.map.isWebGLCubeRenderTarget?6:X.getViewportCount();Q.isPointLight!==!0&&X.updateMatrices(Q,v);for(let oe=0;oe<se;oe++){const Fe=X.getCamera(oe);if(Q.isPointLight){const Ie=X.camera,mt=X.matrix,tt=Q.distance||Ie.far;tt!==Ie.far&&(Ie.far=tt,Ie.updateProjectionMatrix()),Hr.setFromMatrixPosition(Q.matrixWorld),Ie.position.copy(Hr),ml.copy(Ie.position),ml.add(gI[oe]),Ie.up.copy(_I[oe]),Ie.lookAt(ml),Ie.updateMatrixWorld(),mt.makeTranslation(-Hr.x,-Hr.y,-Hr.z),fp.multiplyMatrices(Ie.projectionMatrix,Ie.matrixWorldInverse),X._frustum.setFromProjectionMatrix(fp,Ie.coordinateSystem,Ie.reversedDepth)}if(X.map.isWebGLCubeRenderTarget)t.setRenderTarget(X.map,oe),t.clear();else{oe===0&&(t.setRenderTarget(X.map),t.clear());const Ie=X.getViewport(oe);o.set(r.x*Ie.x,r.y*Ie.y,r.x*Ie.z,r.y*Ie.w),k.viewport(o)}i=X.getFrustum(oe),b(P,v,Fe,Q,this.type)}X.isPointLightShadow!==!0&&this.type===$r&&E(X,v),X.needsUpdate=!1}p=this.type,m.needsUpdate=!1,t.setRenderTarget(T,L,N)};function E(A,P){const v=e.update(x);d.defines.VSM_SAMPLES!==A.blurSamples&&(d.defines.VSM_SAMPLES=A.blurSamples,f.defines.VSM_SAMPLES=A.blurSamples,d.needsUpdate=!0,f.needsUpdate=!0),A.mapPass===null?A.mapPass=new ei(s.x,s.y,{format:Ps,type:xi}):(A.mapPass.width!==A.map.width||A.mapPass.height!==A.map.height)&&A.mapPass.setSize(A.map.width,A.map.height),d.uniforms.shadow_pass.value=A.map.depthTexture,d.uniforms.resolution.value.set(A.map.width,A.map.height),d.uniforms.radius.value=A.radius,t.setRenderTarget(A.mapPass),t.clear(),t.renderBufferDirect(P,null,v,d,x,null),f.uniforms.shadow_pass.value=A.mapPass.texture,f.uniforms.resolution.value.set(A.map.width,A.map.height),f.uniforms.radius.value=A.radius,t.setRenderTarget(A.map),t.clear(),t.renderBufferDirect(P,null,v,f,x,null)}function I(A,P,v,T){let L=null;const N=v.isPointLight===!0?A.customDistanceMaterial:A.customDepthMaterial;if(N!==void 0)L=N;else if(L=v.isPointLight===!0?c:a,t.localClippingEnabled&&P.clipShadows===!0&&Array.isArray(P.clippingPlanes)&&P.clippingPlanes.length!==0||P.displacementMap&&P.displacementScale!==0||P.alphaMap&&P.alphaTest>0||P.map&&P.alphaTest>0||P.alphaToCoverage===!0){const k=L.uuid,q=P.uuid;let U=l[k];U===void 0&&(U={},l[k]=U);let V=U[q];V===void 0&&(V=L.clone(),U[q]=V,P.addEventListener("dispose",w)),L=V}if(L.visible=P.visible,L.wireframe=P.wireframe,T===$r?L.side=P.shadowSide!==null?P.shadowSide:P.side:L.side=P.shadowSide!==null?P.shadowSide:h[P.side],L.alphaMap=P.alphaMap,L.alphaTest=P.alphaToCoverage===!0?.5:P.alphaTest,L.map=P.map,L.clipShadows=P.clipShadows,L.clippingPlanes=P.clippingPlanes,L.clipIntersection=P.clipIntersection,L.displacementMap=P.displacementMap,L.displacementScale=P.displacementScale,L.displacementBias=P.displacementBias,L.wireframeLinewidth=P.wireframeLinewidth,L.linewidth=P.linewidth,v.isPointLight===!0&&L.isMeshDistanceMaterial===!0){const k=t.properties.get(L);k.light=v}return L}function b(A,P,v,T,L){if(A.visible===!1)return;if(A.layers.test(P.layers)&&(A.isMesh||A.isLine||A.isPoints)&&(A.castShadow||A.receiveShadow&&L===$r)&&(!A.frustumCulled||A.intersectsFrustum(i))){A.modelViewMatrix.multiplyMatrices(v.matrixWorldInverse,A.matrixWorld);const q=e.update(A),U=A.material;if(Array.isArray(U)){const V=q.groups;for(let Q=0,X=V.length;Q<X;Q++){const ce=V[Q],j=U[ce.materialIndex];if(j&&j.visible){const se=I(A,j,T,L);A.onBeforeShadow(t,A,P,v,q,se,ce),t.renderBufferDirect(v,null,q,se,A,ce),A.onAfterShadow(t,A,P,v,q,se,ce)}}}else if(U.visible){const V=I(A,U,T,L);A.onBeforeShadow(t,A,P,v,q,V,null),t.renderBufferDirect(v,null,q,V,A,null),A.onAfterShadow(t,A,P,v,q,V,null)}}const k=A.children;for(let q=0,U=k.length;q<U;q++)b(k[q],P,v,T,L)}function w(A){A.target.removeEventListener("dispose",w);for(const v in l){const T=l[v],L=A.target.uuid;L in T&&(T[L].dispose(),delete T[L])}}}function vI(t,e){function n(){let O=!1;const fe=new Vt;let te=null;const ge=new Vt(0,0,0,0);return{setMask:function(ye){te!==ye&&!O&&(t.colorMask(ye,ye,ye,ye),te=ye)},setLocked:function(ye){O=ye},setClear:function(ye,ie,De,Ce,_t){_t===!0&&(ye*=Ce,ie*=Ce,De*=Ce),fe.set(ye,ie,De,Ce),ge.equals(fe)===!1&&(t.clearColor(ye,ie,De,Ce),ge.copy(fe))},reset:function(){O=!1,te=null,ge.set(-1,0,0,0)}}}function i(){let O=!1,fe=!1,te=null,ge=null,ye=null;return{setReversed:function(ie){if(fe!==ie){const De=e.get("EXT_clip_control");ie?De.clipControlEXT(De.LOWER_LEFT_EXT,De.ZERO_TO_ONE_EXT):De.clipControlEXT(De.LOWER_LEFT_EXT,De.NEGATIVE_ONE_TO_ONE_EXT),fe=ie;const Ce=ye;ye=null,this.setClear(Ce)}},getReversed:function(){return fe},setTest:function(ie){ie?re(t.DEPTH_TEST):Re(t.DEPTH_TEST)},setMask:function(ie){te!==ie&&!O&&(t.depthMask(ie),te=ie)},setFunc:function(ie){if(fe&&(ie=Dw[ie]),ge!==ie){switch(ie){case zl:t.depthFunc(t.NEVER);break;case Bl:t.depthFunc(t.ALWAYS);break;case Hl:t.depthFunc(t.LESS);break;case co:t.depthFunc(t.LEQUAL);break;case Vl:t.depthFunc(t.EQUAL);break;case Gl:t.depthFunc(t.GEQUAL);break;case $l:t.depthFunc(t.GREATER);break;case ql:t.depthFunc(t.NOTEQUAL);break;default:t.depthFunc(t.LEQUAL)}ge=ie}},setLocked:function(ie){O=ie},setClear:function(ie){ye!==ie&&(ye=ie,fe&&(ie=1-ie),t.clearDepth(ie))},reset:function(){O=!1,te=null,ge=null,ye=null,fe=!1}}}function s(){let O=!1,fe=null,te=null,ge=null,ye=null,ie=null,De=null,Ce=null,_t=null;return{setTest:function(lt){O||(lt?re(t.STENCIL_TEST):Re(t.STENCIL_TEST))},setMask:function(lt){fe!==lt&&!O&&(t.stencilMask(lt),fe=lt)},setFunc:function(lt,an,dn){(te!==lt||ge!==an||ye!==dn)&&(t.stencilFunc(lt,an,dn),te=lt,ge=an,ye=dn)},setOp:function(lt,an,dn){(ie!==lt||De!==an||Ce!==dn)&&(t.stencilOp(lt,an,dn),ie=lt,De=an,Ce=dn)},setLocked:function(lt){O=lt},setClear:function(lt){_t!==lt&&(t.clearStencil(lt),_t=lt)},reset:function(){O=!1,fe=null,te=null,ge=null,ye=null,ie=null,De=null,Ce=null,_t=null}}}const r=new n,o=new i,a=new s,c=new WeakMap,l=new WeakMap;let u={},h={},d={},f=new WeakMap,_=[],x=null,m=!1,p=null,E=null,I=null,b=null,w=null,A=null,P=null,v=new at(0,0,0),T=0,L=!1,N=null,k=null,q=null,U=null,V=null;const Q=t.getParameter(t.MAX_COMBINED_TEXTURE_IMAGE_UNITS);let X=!1,ce=0;const j=t.getParameter(t.VERSION);j.indexOf("WebGL")!==-1?(ce=parseFloat(/^WebGL (\d)/.exec(j)[1]),X=ce>=1):j.indexOf("OpenGL ES")!==-1&&(ce=parseFloat(/^OpenGL ES (\d)/.exec(j)[1]),X=ce>=2);let se=null,oe={};const Fe=t.getParameter(t.SCISSOR_BOX),Ie=t.getParameter(t.VIEWPORT),mt=new Vt().fromArray(Fe),tt=new Vt().fromArray(Ie);function Je(O,fe,te,ge){const ye=new Uint8Array(4),ie=t.createTexture();t.bindTexture(O,ie),t.texParameteri(O,t.TEXTURE_MIN_FILTER,t.NEAREST),t.texParameteri(O,t.TEXTURE_MAG_FILTER,t.NEAREST);for(let De=0;De<te;De++)O===t.TEXTURE_3D||O===t.TEXTURE_2D_ARRAY?t.texImage3D(fe,0,t.RGBA,1,1,ge,0,t.RGBA,t.UNSIGNED_BYTE,ye):t.texImage2D(fe+De,0,t.RGBA,1,1,0,t.RGBA,t.UNSIGNED_BYTE,ye);return ie}const Y={};Y[t.TEXTURE_2D]=Je(t.TEXTURE_2D,t.TEXTURE_2D,1),Y[t.TEXTURE_CUBE_MAP]=Je(t.TEXTURE_CUBE_MAP,t.TEXTURE_CUBE_MAP_POSITIVE_X,6),Y[t.TEXTURE_2D_ARRAY]=Je(t.TEXTURE_2D_ARRAY,t.TEXTURE_2D_ARRAY,1,1),Y[t.TEXTURE_3D]=Je(t.TEXTURE_3D,t.TEXTURE_3D,1,1),r.setClear(0,0,0,1),o.setClear(1),a.setClear(0),re(t.DEPTH_TEST),o.setFunc(co),Qe(!1),xt(ff),re(t.CULL_FACE),st(Oi);function re(O){u[O]!==!0&&(t.enable(O),u[O]=!0)}function Re(O){u[O]!==!1&&(t.disable(O),u[O]=!1)}function Ge(O,fe){return d[O]!==fe?(t.bindFramebuffer(O,fe),d[O]=fe,O===t.DRAW_FRAMEBUFFER&&(d[t.FRAMEBUFFER]=fe),O===t.FRAMEBUFFER&&(d[t.DRAW_FRAMEBUFFER]=fe),!0):!1}function Me(O,fe){let te=_,ge=!1;if(O){te=f.get(fe),te===void 0&&(te=[],f.set(fe,te));const ye=O.textures;if(te.length!==ye.length||te[0]!==t.COLOR_ATTACHMENT0){for(let ie=0,De=ye.length;ie<De;ie++)te[ie]=t.COLOR_ATTACHMENT0+ie;te.length=ye.length,ge=!0}}else te[0]!==t.BACK&&(te[0]=t.BACK,ge=!0);ge&&t.drawBuffers(te)}function We(O){return x!==O?(t.useProgram(O),x=O,!0):!1}const Lt={[Qs]:t.FUNC_ADD,[tw]:t.FUNC_SUBTRACT,[nw]:t.FUNC_REVERSE_SUBTRACT};Lt[iw]=t.MIN,Lt[sw]=t.MAX;const Xe={[rw]:t.ZERO,[ow]:t.ONE,[aw]:t.SRC_COLOR,[uS]:t.SRC_ALPHA,[fw]:t.SRC_ALPHA_SATURATE,[dw]:t.DST_COLOR,[lw]:t.DST_ALPHA,[cw]:t.ONE_MINUS_SRC_COLOR,[dS]:t.ONE_MINUS_SRC_ALPHA,[hw]:t.ONE_MINUS_DST_COLOR,[uw]:t.ONE_MINUS_DST_ALPHA,[pw]:t.CONSTANT_COLOR,[mw]:t.ONE_MINUS_CONSTANT_COLOR,[gw]:t.CONSTANT_ALPHA,[_w]:t.ONE_MINUS_CONSTANT_ALPHA};function st(O,fe,te,ge,ye,ie,De,Ce,_t,lt){if(O===Oi){m===!0&&(Re(t.BLEND),m=!1);return}if(m===!1&&(re(t.BLEND),m=!0),O!==ew){if(O!==p||lt!==L){if((E!==Qs||w!==Qs)&&(t.blendEquation(t.FUNC_ADD),E=Qs,w=Qs),lt)switch(O){case Kr:t.blendFuncSeparate(t.ONE,t.ONE_MINUS_SRC_ALPHA,t.ONE,t.ONE_MINUS_SRC_ALPHA);break;case pf:t.blendFunc(t.ONE,t.ONE);break;case mf:t.blendFuncSeparate(t.ZERO,t.ONE_MINUS_SRC_COLOR,t.ZERO,t.ONE);break;case gf:t.blendFuncSeparate(t.DST_COLOR,t.ONE_MINUS_SRC_ALPHA,t.ZERO,t.ONE);break;default:vt("WebGLState: Invalid blending: ",O);break}else switch(O){case Kr:t.blendFuncSeparate(t.SRC_ALPHA,t.ONE_MINUS_SRC_ALPHA,t.ONE,t.ONE_MINUS_SRC_ALPHA);break;case pf:t.blendFuncSeparate(t.SRC_ALPHA,t.ONE,t.ONE,t.ONE);break;case mf:vt("WebGLState: SubtractiveBlending requires material.premultipliedAlpha = true");break;case gf:vt("WebGLState: MultiplyBlending requires material.premultipliedAlpha = true");break;default:vt("WebGLState: Invalid blending: ",O);break}I=null,b=null,A=null,P=null,v.set(0,0,0),T=0,p=O,L=lt}return}ye=ye||fe,ie=ie||te,De=De||ge,(fe!==E||ye!==w)&&(t.blendEquationSeparate(Lt[fe],Lt[ye]),E=fe,w=ye),(te!==I||ge!==b||ie!==A||De!==P)&&(t.blendFuncSeparate(Xe[te],Xe[ge],Xe[ie],Xe[De]),I=te,b=ge,A=ie,P=De),(Ce.equals(v)===!1||_t!==T)&&(t.blendColor(Ce.r,Ce.g,Ce.b,_t),v.copy(Ce),T=_t),p=O,L=!1}function St(O,fe){O.side===Ni?Re(t.CULL_FACE):re(t.CULL_FACE);let te=O.side===Cn;fe&&(te=!te),Qe(te),O.blending===Kr&&O.transparent===!1?st(Oi):st(O.blending,O.blendEquation,O.blendSrc,O.blendDst,O.blendEquationAlpha,O.blendSrcAlpha,O.blendDstAlpha,O.blendColor,O.blendAlpha,O.premultipliedAlpha),o.setFunc(O.depthFunc),o.setTest(O.depthTest),o.setMask(O.depthWrite),r.setMask(O.colorWrite);const ge=O.stencilWrite;a.setTest(ge),ge&&(a.setMask(O.stencilWriteMask),a.setFunc(O.stencilFunc,O.stencilRef,O.stencilFuncMask),a.setOp(O.stencilFail,O.stencilZFail,O.stencilZPass)),qt(O.polygonOffset,O.polygonOffsetFactor,O.polygonOffsetUnits),O.alphaToCoverage===!0?re(t.SAMPLE_ALPHA_TO_COVERAGE):Re(t.SAMPLE_ALPHA_TO_COVERAGE)}function Qe(O){N!==O&&(O?t.frontFace(t.CW):t.frontFace(t.CCW),N=O)}function xt(O){O!==jR?(re(t.CULL_FACE),O!==k&&(O===ff?t.cullFace(t.BACK):O===JR?t.cullFace(t.FRONT):t.cullFace(t.FRONT_AND_BACK))):Re(t.CULL_FACE),k=O}function Ot(O){O!==q&&(X&&t.lineWidth(O),q=O)}function qt(O,fe,te){O?(re(t.POLYGON_OFFSET_FILL),(U!==fe||V!==te)&&(U=fe,V=te,o.getReversed()&&(fe=-fe),t.polygonOffset(fe,te))):Re(t.POLYGON_OFFSET_FILL)}function Mt(O){O?re(t.SCISSOR_TEST):Re(t.SCISSOR_TEST)}function It(O){O===void 0&&(O=t.TEXTURE0+Q-1),se!==O&&(t.activeTexture(O),se=O)}function F(O,fe,te){te===void 0&&(se===null?te=t.TEXTURE0+Q-1:te=se);let ge=oe[te];ge===void 0&&(ge={type:void 0,texture:void 0},oe[te]=ge),(ge.type!==O||ge.texture!==fe)&&(se!==te&&(t.activeTexture(te),se=te),t.bindTexture(O,fe||Y[O]),ge.type=O,ge.texture=fe)}function Bt(){const O=oe[se];O!==void 0&&O.type!==void 0&&(t.bindTexture(O.type,null),O.type=void 0,O.texture=void 0)}function dt(){try{t.compressedTexImage2D(...arguments)}catch(O){vt("WebGLState:",O)}}function R(){try{t.compressedTexImage3D(...arguments)}catch(O){vt("WebGLState:",O)}}function S(){try{t.texSubImage2D(...arguments)}catch(O){vt("WebGLState:",O)}}function z(){try{t.texSubImage3D(...arguments)}catch(O){vt("WebGLState:",O)}}function Z(){try{t.compressedTexSubImage2D(...arguments)}catch(O){vt("WebGLState:",O)}}function K(){try{t.compressedTexSubImage3D(...arguments)}catch(O){vt("WebGLState:",O)}}function le(){try{t.texStorage2D(...arguments)}catch(O){vt("WebGLState:",O)}}function de(){try{t.texStorage3D(...arguments)}catch(O){vt("WebGLState:",O)}}function J(){try{t.texImage2D(...arguments)}catch(O){vt("WebGLState:",O)}}function ne(){try{t.texImage3D(...arguments)}catch(O){vt("WebGLState:",O)}}function he(O){return h[O]!==void 0?h[O]:t.getParameter(O)}function Ne(O,fe){h[O]!==fe&&(t.pixelStorei(O,fe),h[O]=fe)}function ue(O){mt.equals(O)===!1&&(t.scissor(O.x,O.y,O.z,O.w),mt.copy(O))}function me(O){tt.equals(O)===!1&&(t.viewport(O.x,O.y,O.z,O.w),tt.copy(O))}function Pe(O,fe){let te=l.get(fe);te===void 0&&(te=new WeakMap,l.set(fe,te));let ge=te.get(O);ge===void 0&&(ge=t.getUniformBlockIndex(fe,O.name),te.set(O,ge))}function ze(O,fe){const ge=l.get(fe).get(O);c.get(fe)!==ge&&(t.uniformBlockBinding(fe,ge,O.__bindingPointIndex),c.set(fe,ge))}function qe(){t.disable(t.BLEND),t.disable(t.CULL_FACE),t.disable(t.DEPTH_TEST),t.disable(t.POLYGON_OFFSET_FILL),t.disable(t.SCISSOR_TEST),t.disable(t.STENCIL_TEST),t.disable(t.SAMPLE_ALPHA_TO_COVERAGE),t.blendEquation(t.FUNC_ADD),t.blendFunc(t.ONE,t.ZERO),t.blendFuncSeparate(t.ONE,t.ZERO,t.ONE,t.ZERO),t.blendColor(0,0,0,0),t.colorMask(!0,!0,!0,!0),t.clearColor(0,0,0,0),t.depthMask(!0),t.depthFunc(t.LESS),o.setReversed(!1),t.clearDepth(1),t.stencilMask(4294967295),t.stencilFunc(t.ALWAYS,0,4294967295),t.stencilOp(t.KEEP,t.KEEP,t.KEEP),t.clearStencil(0),t.cullFace(t.BACK),t.frontFace(t.CCW),t.polygonOffset(0,0),t.activeTexture(t.TEXTURE0),t.bindFramebuffer(t.FRAMEBUFFER,null),t.bindFramebuffer(t.DRAW_FRAMEBUFFER,null),t.bindFramebuffer(t.READ_FRAMEBUFFER,null),t.useProgram(null),t.lineWidth(1),t.scissor(0,0,t.canvas.width,t.canvas.height),t.viewport(0,0,t.canvas.width,t.canvas.height),t.pixelStorei(t.PACK_ALIGNMENT,4),t.pixelStorei(t.UNPACK_ALIGNMENT,4),t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,!1),t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),t.pixelStorei(t.UNPACK_COLORSPACE_CONVERSION_WEBGL,t.BROWSER_DEFAULT_WEBGL),t.pixelStorei(t.PACK_ROW_LENGTH,0),t.pixelStorei(t.PACK_SKIP_PIXELS,0),t.pixelStorei(t.PACK_SKIP_ROWS,0),t.pixelStorei(t.UNPACK_ROW_LENGTH,0),t.pixelStorei(t.UNPACK_IMAGE_HEIGHT,0),t.pixelStorei(t.UNPACK_SKIP_PIXELS,0),t.pixelStorei(t.UNPACK_SKIP_ROWS,0),t.pixelStorei(t.UNPACK_SKIP_IMAGES,0),u={},h={},se=null,oe={},d={},f=new WeakMap,_=[],x=null,m=!1,p=null,E=null,I=null,b=null,w=null,A=null,P=null,v=new at(0,0,0),T=0,L=!1,N=null,k=null,q=null,U=null,V=null,mt.set(0,0,t.canvas.width,t.canvas.height),tt.set(0,0,t.canvas.width,t.canvas.height),r.reset(),o.reset(),a.reset()}return{buffers:{color:r,depth:o,stencil:a},enable:re,disable:Re,bindFramebuffer:Ge,drawBuffers:Me,useProgram:We,setBlending:st,setMaterial:St,setFlipSided:Qe,setCullFace:xt,setLineWidth:Ot,setPolygonOffset:qt,setScissorTest:Mt,activeTexture:It,bindTexture:F,unbindTexture:Bt,compressedTexImage2D:dt,compressedTexImage3D:R,texImage2D:J,texImage3D:ne,pixelStorei:Ne,getParameter:he,updateUBOMapping:Pe,uniformBlockBinding:ze,texStorage2D:le,texStorage3D:de,texSubImage2D:S,texSubImage3D:z,compressedTexSubImage2D:Z,compressedTexSubImage3D:K,scissor:ue,viewport:me,reset:qe}}function xI(t,e,n,i,s,r,o){const a=e.has("WEBGL_multisampled_render_to_texture")?e.get("WEBGL_multisampled_render_to_texture"):null,c=typeof navigator>"u"?!1:/OculusBrowser/g.test(navigator.userAgent),l=new je,u=new WeakMap,h=new Set;let d;const f=new WeakMap;let _=!1;try{_=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function x(R,S){return _?new OffscreenCanvas(R,S):La("canvas")}function m(R,S,z){let Z=1;const K=dt(R);if((K.width>z||K.height>z)&&(Z=z/Math.max(K.width,K.height)),Z<1)if(typeof HTMLImageElement<"u"&&R instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&R instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&R instanceof ImageBitmap||typeof VideoFrame<"u"&&R instanceof VideoFrame){const le=Math.floor(Z*K.width),de=Math.floor(Z*K.height);d===void 0&&(d=x(le,de));const J=S?x(le,de):d;return J.width=le,J.height=de,J.getContext("2d").drawImage(R,0,0,le,de),$e("WebGLRenderer: Texture has been resized from ("+K.width+"x"+K.height+") to ("+le+"x"+de+")."),J}else return"data"in R&&$e("WebGLRenderer: Image in DataTexture is too big ("+K.width+"x"+K.height+")."),R;return R}function p(R){return R.generateMipmaps}function E(R){t.generateMipmap(R)}function I(R){return R.isWebGLCubeRenderTarget?t.TEXTURE_CUBE_MAP:R.isWebGL3DRenderTarget?t.TEXTURE_3D:R.isWebGLArrayRenderTarget||R.isCompressedArrayTexture?t.TEXTURE_2D_ARRAY:t.TEXTURE_2D}function b(R,S,z,Z,K,le=!1){if(R!==null){if(t[R]!==void 0)return t[R];$e("WebGLRenderer: Attempt to use non-existing WebGL internal format '"+R+"'")}let de;Z&&(de=e.get("EXT_texture_norm16"),de||$e("WebGLRenderer: Unable to use normalized textures without EXT_texture_norm16 extension"));let J=S;if(S===t.RED&&(z===t.FLOAT&&(J=t.R32F),z===t.HALF_FLOAT&&(J=t.R16F),z===t.UNSIGNED_BYTE&&(J=t.R8),z===t.UNSIGNED_SHORT&&de&&(J=de.R16_EXT),z===t.SHORT&&de&&(J=de.R16_SNORM_EXT)),S===t.RED_INTEGER&&(z===t.UNSIGNED_BYTE&&(J=t.R8UI),z===t.UNSIGNED_SHORT&&(J=t.R16UI),z===t.UNSIGNED_INT&&(J=t.R32UI),z===t.BYTE&&(J=t.R8I),z===t.SHORT&&(J=t.R16I),z===t.INT&&(J=t.R32I)),S===t.RG&&(z===t.FLOAT&&(J=t.RG32F),z===t.HALF_FLOAT&&(J=t.RG16F),z===t.UNSIGNED_BYTE&&(J=t.RG8),z===t.UNSIGNED_SHORT&&de&&(J=de.RG16_EXT),z===t.SHORT&&de&&(J=de.RG16_SNORM_EXT)),S===t.RG_INTEGER&&(z===t.UNSIGNED_BYTE&&(J=t.RG8UI),z===t.UNSIGNED_SHORT&&(J=t.RG16UI),z===t.UNSIGNED_INT&&(J=t.RG32UI),z===t.BYTE&&(J=t.RG8I),z===t.SHORT&&(J=t.RG16I),z===t.INT&&(J=t.RG32I)),S===t.RGB_INTEGER&&(z===t.UNSIGNED_BYTE&&(J=t.RGB8UI),z===t.UNSIGNED_SHORT&&(J=t.RGB16UI),z===t.UNSIGNED_INT&&(J=t.RGB32UI),z===t.BYTE&&(J=t.RGB8I),z===t.SHORT&&(J=t.RGB16I),z===t.INT&&(J=t.RGB32I)),S===t.RGBA_INTEGER&&(z===t.UNSIGNED_BYTE&&(J=t.RGBA8UI),z===t.UNSIGNED_SHORT&&(J=t.RGBA16UI),z===t.UNSIGNED_INT&&(J=t.RGBA32UI),z===t.BYTE&&(J=t.RGBA8I),z===t.SHORT&&(J=t.RGBA16I),z===t.INT&&(J=t.RGBA32I)),S===t.RGB&&(z===t.UNSIGNED_SHORT&&de&&(J=de.RGB16_EXT),z===t.SHORT&&de&&(J=de.RGB16_SNORM_EXT),z===t.UNSIGNED_INT_5_9_9_9_REV&&(J=t.RGB9_E5),z===t.UNSIGNED_INT_10F_11F_11F_REV&&(J=t.R11F_G11F_B10F)),S===t.RGBA){const ne=le?Ca:ft.getTransfer(K);z===t.FLOAT&&(J=t.RGBA32F),z===t.HALF_FLOAT&&(J=t.RGBA16F),z===t.UNSIGNED_BYTE&&(J=ne===Et?t.SRGB8_ALPHA8:t.RGBA8),z===t.UNSIGNED_SHORT&&de&&(J=de.RGBA16_EXT),z===t.SHORT&&de&&(J=de.RGBA16_SNORM_EXT),z===t.UNSIGNED_SHORT_4_4_4_4&&(J=t.RGBA4),z===t.UNSIGNED_SHORT_5_5_5_1&&(J=t.RGB5_A1)}return(J===t.R16F||J===t.R32F||J===t.RG16F||J===t.RG32F||J===t.RGBA16F||J===t.RGBA32F)&&e.get("EXT_color_buffer_float"),J}function w(R,S){let z;return R?S===null||S===vi||S===uo?z=t.DEPTH24_STENCIL8:S===mi?z=t.DEPTH32F_STENCIL8:S===lo&&(z=t.DEPTH24_STENCIL8,$e("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.")):S===null||S===vi||S===uo?z=t.DEPTH_COMPONENT24:S===mi?z=t.DEPTH_COMPONENT32F:S===lo&&(z=t.DEPTH_COMPONENT16),z}function A(R,S){return p(R)===!0||R.isFramebufferTexture&&R.minFilter!==ln&&R.minFilter!==_n?Math.log2(Math.max(S.width,S.height))+1:R.mipmaps!==void 0&&R.mipmaps.length>0?R.mipmaps.length:R.isCompressedTexture&&Array.isArray(R.image)?S.mipmaps.length:1}function P(R){const S=R.target;S.removeEventListener("dispose",P),T(S),S.isVideoTexture&&u.delete(S),S.isHTMLTexture&&h.delete(S)}function v(R){const S=R.target;S.removeEventListener("dispose",v),N(S)}function T(R){const S=i.get(R);if(S.__webglInit===void 0)return;const z=R.source,Z=f.get(z);if(Z){const K=Z[S.__cacheKey];K.usedTimes--,K.usedTimes===0&&L(R),Object.keys(Z).length===0&&f.delete(z)}i.remove(R)}function L(R){const S=i.get(R);t.deleteTexture(S.__webglTexture);const z=R.source,Z=f.get(z);delete Z[S.__cacheKey],o.memory.textures--}function N(R){const S=i.get(R);if(R.depthTexture&&(R.depthTexture.dispose(),i.remove(R.depthTexture)),R.isWebGLCubeRenderTarget)for(let Z=0;Z<6;Z++){if(Array.isArray(S.__webglFramebuffer[Z]))for(let K=0;K<S.__webglFramebuffer[Z].length;K++)t.deleteFramebuffer(S.__webglFramebuffer[Z][K]);else t.deleteFramebuffer(S.__webglFramebuffer[Z]);S.__webglDepthbuffer&&t.deleteRenderbuffer(S.__webglDepthbuffer[Z])}else{if(Array.isArray(S.__webglFramebuffer))for(let Z=0;Z<S.__webglFramebuffer.length;Z++)t.deleteFramebuffer(S.__webglFramebuffer[Z]);else t.deleteFramebuffer(S.__webglFramebuffer);if(S.__webglDepthbuffer&&t.deleteRenderbuffer(S.__webglDepthbuffer),S.__webglMultisampledFramebuffer&&t.deleteFramebuffer(S.__webglMultisampledFramebuffer),S.__webglColorRenderbuffer)for(let Z=0;Z<S.__webglColorRenderbuffer.length;Z++)S.__webglColorRenderbuffer[Z]&&t.deleteRenderbuffer(S.__webglColorRenderbuffer[Z]);S.__webglDepthRenderbuffer&&t.deleteRenderbuffer(S.__webglDepthRenderbuffer)}const z=R.textures;for(let Z=0,K=z.length;Z<K;Z++){const le=i.get(z[Z]);le.__webglTexture&&(t.deleteTexture(le.__webglTexture),o.memory.textures--),i.remove(z[Z])}i.remove(R)}let k=0;function q(){k=0}function U(){return k}function V(R){k=R}function Q(){const R=k;return R>=s.maxTextures&&$e("WebGLTextures: Trying to use "+(R+1)+" texture units while this GPU supports only "+s.maxTextures),k+=1,R}function X(R){const S=[];return S.push(R.wrapS),S.push(R.wrapT),S.push(R.wrapR||0),S.push(R.magFilter),S.push(R.minFilter),S.push(R.anisotropy),S.push(R.internalFormat),S.push(R.format),S.push(R.type),S.push(R.generateMipmaps),S.push(R.premultiplyAlpha),S.push(R.flipY),S.push(R.unpackAlignment),S.push(R.colorSpace),S.join()}function ce(R,S){const z=i.get(R);if(R.isVideoTexture&&F(R),R.isRenderTargetTexture===!1&&R.isExternalTexture!==!0&&R.version>0&&z.__version!==R.version){const Z=R.image;if(Z===null)$e("WebGLRenderer: Texture marked for update but no image data found.");else if(Z.complete===!1)$e("WebGLRenderer: Texture marked for update but image is incomplete");else{Re(z,R,S);return}}else R.isExternalTexture&&(z.__webglTexture=R.sourceTexture?R.sourceTexture:null);n.bindTexture(t.TEXTURE_2D,z.__webglTexture,t.TEXTURE0+S)}function j(R,S){const z=i.get(R);if(R.isRenderTargetTexture===!1&&R.version>0&&z.__version!==R.version){Re(z,R,S);return}else R.isExternalTexture&&(z.__webglTexture=R.sourceTexture?R.sourceTexture:null);n.bindTexture(t.TEXTURE_2D_ARRAY,z.__webglTexture,t.TEXTURE0+S)}function se(R,S){const z=i.get(R);if(R.isRenderTargetTexture===!1&&R.version>0&&z.__version!==R.version){Re(z,R,S);return}n.bindTexture(t.TEXTURE_3D,z.__webglTexture,t.TEXTURE0+S)}function oe(R,S){const z=i.get(R);if(R.isCubeDepthTexture!==!0&&R.version>0&&z.__version!==R.version){Ge(z,R,S);return}n.bindTexture(t.TEXTURE_CUBE_MAP,z.__webglTexture,t.TEXTURE0+S)}const Fe={[Wl]:t.REPEAT,[Ui]:t.CLAMP_TO_EDGE,[Zl]:t.MIRRORED_REPEAT},Ie={[ln]:t.NEAREST,[xw]:t.NEAREST_MIPMAP_NEAREST,[Lo]:t.NEAREST_MIPMAP_LINEAR,[_n]:t.LINEAR,[Hc]:t.LINEAR_MIPMAP_NEAREST,[ys]:t.LINEAR_MIPMAP_LINEAR},mt={[Ew]:t.NEVER,[Cw]:t.ALWAYS,[Tw]:t.LESS,[Bd]:t.LEQUAL,[Rw]:t.EQUAL,[Hd]:t.GEQUAL,[ww]:t.GREATER,[Aw]:t.NOTEQUAL};function tt(R,S){if(S.type===mi&&e.has("OES_texture_float_linear")===!1&&(S.magFilter===_n||S.magFilter===Hc||S.magFilter===Lo||S.magFilter===ys||S.minFilter===_n||S.minFilter===Hc||S.minFilter===Lo||S.minFilter===ys)&&$e("WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."),t.texParameteri(R,t.TEXTURE_WRAP_S,Fe[S.wrapS]),t.texParameteri(R,t.TEXTURE_WRAP_T,Fe[S.wrapT]),(R===t.TEXTURE_3D||R===t.TEXTURE_2D_ARRAY)&&t.texParameteri(R,t.TEXTURE_WRAP_R,Fe[S.wrapR]),t.texParameteri(R,t.TEXTURE_MAG_FILTER,Ie[S.magFilter]),t.texParameteri(R,t.TEXTURE_MIN_FILTER,Ie[S.minFilter]),S.compareFunction&&(t.texParameteri(R,t.TEXTURE_COMPARE_MODE,t.COMPARE_REF_TO_TEXTURE),t.texParameteri(R,t.TEXTURE_COMPARE_FUNC,mt[S.compareFunction])),e.has("EXT_texture_filter_anisotropic")===!0){if(S.magFilter===ln||S.minFilter!==Lo&&S.minFilter!==ys||S.type===mi&&e.has("OES_texture_float_linear")===!1)return;if(S.anisotropy>1||i.get(S).__currentAnisotropy){const z=e.get("EXT_texture_filter_anisotropic");t.texParameterf(R,z.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(S.anisotropy,s.getMaxAnisotropy())),i.get(S).__currentAnisotropy=S.anisotropy}}}function Je(R,S){let z=!1;R.__webglInit===void 0&&(R.__webglInit=!0,S.addEventListener("dispose",P));const Z=S.source;let K=f.get(Z);K===void 0&&(K={},f.set(Z,K));const le=X(S);if(le!==R.__cacheKey){K[le]===void 0&&(K[le]={texture:t.createTexture(),usedTimes:0},o.memory.textures++,z=!0),K[le].usedTimes++;const de=K[R.__cacheKey];de!==void 0&&(K[R.__cacheKey].usedTimes--,de.usedTimes===0&&L(S)),R.__cacheKey=le,R.__webglTexture=K[le].texture}return z}function Y(R,S,z){return Math.floor(Math.floor(R/z)/S)}function re(R,S,z,Z){const le=R.updateRanges;if(le.length===0)n.texSubImage2D(t.TEXTURE_2D,0,0,0,S.width,S.height,z,Z,S.data);else{le.sort((Ne,ue)=>Ne.start-ue.start);let de=0;for(let Ne=1;Ne<le.length;Ne++){const ue=le[de],me=le[Ne],Pe=ue.start+ue.count,ze=Y(me.start,S.width,4),qe=Y(ue.start,S.width,4);me.start<=Pe+1&&ze===qe&&Y(me.start+me.count-1,S.width,4)===ze?ue.count=Math.max(ue.count,me.start+me.count-ue.start):(++de,le[de]=me)}le.length=de+1;const J=n.getParameter(t.UNPACK_ROW_LENGTH),ne=n.getParameter(t.UNPACK_SKIP_PIXELS),he=n.getParameter(t.UNPACK_SKIP_ROWS);n.pixelStorei(t.UNPACK_ROW_LENGTH,S.width);for(let Ne=0,ue=le.length;Ne<ue;Ne++){const me=le[Ne],Pe=Math.floor(me.start/4),ze=Math.ceil(me.count/4),qe=Pe%S.width,O=Math.floor(Pe/S.width),fe=ze,te=1;n.pixelStorei(t.UNPACK_SKIP_PIXELS,qe),n.pixelStorei(t.UNPACK_SKIP_ROWS,O),n.texSubImage2D(t.TEXTURE_2D,0,qe,O,fe,te,z,Z,S.data)}R.clearUpdateRanges(),n.pixelStorei(t.UNPACK_ROW_LENGTH,J),n.pixelStorei(t.UNPACK_SKIP_PIXELS,ne),n.pixelStorei(t.UNPACK_SKIP_ROWS,he)}}function Re(R,S,z){let Z=t.TEXTURE_2D;(S.isDataArrayTexture||S.isCompressedArrayTexture)&&(Z=t.TEXTURE_2D_ARRAY),S.isData3DTexture&&(Z=t.TEXTURE_3D);const K=Je(R,S),le=S.source;n.bindTexture(Z,R.__webglTexture,t.TEXTURE0+z);const de=i.get(le);if(le.version!==de.__version||K===!0){if(n.activeTexture(t.TEXTURE0+z),(typeof ImageBitmap<"u"&&S.image instanceof ImageBitmap)===!1){const te=ft.getPrimaries(ft.workingColorSpace),ge=S.colorSpace===ts?null:ft.getPrimaries(S.colorSpace),ye=S.colorSpace===ts||te===ge?t.NONE:t.BROWSER_DEFAULT_WEBGL;n.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,S.flipY),n.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,S.premultiplyAlpha),n.pixelStorei(t.UNPACK_COLORSPACE_CONVERSION_WEBGL,ye)}n.pixelStorei(t.UNPACK_ALIGNMENT,S.unpackAlignment);let ne=m(S.image,!1,s.maxTextureSize);ne=Bt(S,ne);const he=r.convert(S.format,S.colorSpace),Ne=r.convert(S.type);let ue=b(S.internalFormat,he,Ne,S.normalized,S.colorSpace,S.isVideoTexture);tt(Z,S);let me;const Pe=S.mipmaps,ze=S.isVideoTexture!==!0,qe=de.__version===void 0||K===!0,O=le.dataReady,fe=A(S,ne);if(S.isDepthTexture)ue=w(S.format===bs,S.type),qe&&(ze?n.texStorage2D(t.TEXTURE_2D,1,ue,ne.width,ne.height):n.texImage2D(t.TEXTURE_2D,0,ue,ne.width,ne.height,0,he,Ne,null));else if(S.isDataTexture)if(Pe.length>0){ze&&qe&&n.texStorage2D(t.TEXTURE_2D,fe,ue,Pe[0].width,Pe[0].height);for(let te=0,ge=Pe.length;te<ge;te++)me=Pe[te],ze?O&&n.texSubImage2D(t.TEXTURE_2D,te,0,0,me.width,me.height,he,Ne,me.data):n.texImage2D(t.TEXTURE_2D,te,ue,me.width,me.height,0,he,Ne,me.data);S.generateMipmaps=!1}else ze?(qe&&n.texStorage2D(t.TEXTURE_2D,fe,ue,ne.width,ne.height),O&&re(S,ne,he,Ne)):n.texImage2D(t.TEXTURE_2D,0,ue,ne.width,ne.height,0,he,Ne,ne.data);else if(S.isCompressedTexture)if(S.isCompressedArrayTexture){ze&&qe&&n.texStorage3D(t.TEXTURE_2D_ARRAY,fe,ue,Pe[0].width,Pe[0].height,ne.depth);for(let te=0,ge=Pe.length;te<ge;te++)if(me=Pe[te],S.format!==Qn)if(he!==null)if(ze){if(O)if(S.layerUpdates.size>0){const ye=qf(me.width,me.height,S.format,S.type);for(const ie of S.layerUpdates){const De=me.data.subarray(ie*ye/me.data.BYTES_PER_ELEMENT,(ie+1)*ye/me.data.BYTES_PER_ELEMENT);n.compressedTexSubImage3D(t.TEXTURE_2D_ARRAY,te,0,0,ie,me.width,me.height,1,he,De)}}else n.compressedTexSubImage3D(t.TEXTURE_2D_ARRAY,te,0,0,0,me.width,me.height,ne.depth,he,me.data)}else n.compressedTexImage3D(t.TEXTURE_2D_ARRAY,te,ue,me.width,me.height,ne.depth,0,me.data,0,0);else $e("WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");else ze?O&&n.texSubImage3D(t.TEXTURE_2D_ARRAY,te,0,0,0,me.width,me.height,ne.depth,he,Ne,me.data):n.texImage3D(t.TEXTURE_2D_ARRAY,te,ue,me.width,me.height,ne.depth,0,he,Ne,me.data);S.layerUpdates.size>0&&S.clearLayerUpdates()}else{ze&&qe&&n.texStorage2D(t.TEXTURE_2D,fe,ue,Pe[0].width,Pe[0].height);for(let te=0,ge=Pe.length;te<ge;te++)me=Pe[te],S.format!==Qn?he!==null?ze?O&&n.compressedTexSubImage2D(t.TEXTURE_2D,te,0,0,me.width,me.height,he,me.data):n.compressedTexImage2D(t.TEXTURE_2D,te,ue,me.width,me.height,0,me.data):$e("WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):ze?O&&n.texSubImage2D(t.TEXTURE_2D,te,0,0,me.width,me.height,he,Ne,me.data):n.texImage2D(t.TEXTURE_2D,te,ue,me.width,me.height,0,he,Ne,me.data)}else if(S.isDataArrayTexture)if(ze){if(qe&&n.texStorage3D(t.TEXTURE_2D_ARRAY,fe,ue,ne.width,ne.height,ne.depth),O)if(S.layerUpdates.size>0){const te=qf(ne.width,ne.height,S.format,S.type);for(const ge of S.layerUpdates){const ye=ne.data.subarray(ge*te/ne.data.BYTES_PER_ELEMENT,(ge+1)*te/ne.data.BYTES_PER_ELEMENT);n.texSubImage3D(t.TEXTURE_2D_ARRAY,0,0,0,ge,ne.width,ne.height,1,he,Ne,ye)}S.clearLayerUpdates()}else n.texSubImage3D(t.TEXTURE_2D_ARRAY,0,0,0,0,ne.width,ne.height,ne.depth,he,Ne,ne.data)}else n.texImage3D(t.TEXTURE_2D_ARRAY,0,ue,ne.width,ne.height,ne.depth,0,he,Ne,ne.data);else if(S.isData3DTexture)ze?(qe&&n.texStorage3D(t.TEXTURE_3D,fe,ue,ne.width,ne.height,ne.depth),O&&n.texSubImage3D(t.TEXTURE_3D,0,0,0,0,ne.width,ne.height,ne.depth,he,Ne,ne.data)):n.texImage3D(t.TEXTURE_3D,0,ue,ne.width,ne.height,ne.depth,0,he,Ne,ne.data);else if(S.isFramebufferTexture){if(qe)if(ze)n.texStorage2D(t.TEXTURE_2D,fe,ue,ne.width,ne.height);else{let te=ne.width,ge=ne.height;for(let ye=0;ye<fe;ye++)n.texImage2D(t.TEXTURE_2D,ye,ue,te,ge,0,he,Ne,null),te>>=1,ge>>=1}}else if(S.isHTMLTexture){if("texElementImage2D"in t){const te=t.canvas;if(te.hasAttribute("layoutsubtree")||te.setAttribute("layoutsubtree","true"),ne.parentNode!==te){te.appendChild(ne),h.add(S),te.onpaint=ge=>{const ye=ge.changedElements;for(const ie of h)ye.includes(ie.image)&&(ie.needsUpdate=!0)},te.requestPaint();return}if(t.texElementImage2D.length===3)t.texElementImage2D(t.TEXTURE_2D,t.RGBA8,ne);else{const ye=t.RGBA,ie=t.RGBA,De=t.UNSIGNED_BYTE;t.texElementImage2D(t.TEXTURE_2D,0,ye,ie,De,ne)}t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_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)}}else if(Pe.length>0){if(ze&&qe){const te=dt(Pe[0]);n.texStorage2D(t.TEXTURE_2D,fe,ue,te.width,te.height)}for(let te=0,ge=Pe.length;te<ge;te++)me=Pe[te],ze?O&&n.texSubImage2D(t.TEXTURE_2D,te,0,0,he,Ne,me):n.texImage2D(t.TEXTURE_2D,te,ue,he,Ne,me);S.generateMipmaps=!1}else if(ze){if(qe){const te=dt(ne);n.texStorage2D(t.TEXTURE_2D,fe,ue,te.width,te.height)}O&&n.texSubImage2D(t.TEXTURE_2D,0,0,0,he,Ne,ne)}else n.texImage2D(t.TEXTURE_2D,0,ue,he,Ne,ne);p(S)&&E(Z),de.__version=le.version,S.onUpdate&&S.onUpdate(S)}R.__version=S.version}function Ge(R,S,z){if(S.image.length!==6)return;const Z=Je(R,S),K=S.source;n.bindTexture(t.TEXTURE_CUBE_MAP,R.__webglTexture,t.TEXTURE0+z);const le=i.get(K);if(K.version!==le.__version||Z===!0){n.activeTexture(t.TEXTURE0+z);const de=ft.getPrimaries(ft.workingColorSpace),J=S.colorSpace===ts?null:ft.getPrimaries(S.colorSpace),ne=S.colorSpace===ts||de===J?t.NONE:t.BROWSER_DEFAULT_WEBGL;n.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,S.flipY),n.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,S.premultiplyAlpha),n.pixelStorei(t.UNPACK_ALIGNMENT,S.unpackAlignment),n.pixelStorei(t.UNPACK_COLORSPACE_CONVERSION_WEBGL,ne);const he=S.isCompressedTexture||S.image[0].isCompressedTexture,Ne=S.image[0]&&S.image[0].isDataTexture,ue=[];for(let ie=0;ie<6;ie++)!he&&!Ne?ue[ie]=m(S.image[ie],!0,s.maxCubemapSize):ue[ie]=Ne?S.image[ie].image:S.image[ie],ue[ie]=Bt(S,ue[ie]);const me=ue[0],Pe=r.convert(S.format,S.colorSpace),ze=r.convert(S.type),qe=b(S.internalFormat,Pe,ze,S.normalized,S.colorSpace),O=S.isVideoTexture!==!0,fe=le.__version===void 0||Z===!0,te=K.dataReady;let ge=A(S,me);tt(t.TEXTURE_CUBE_MAP,S);let ye;if(he){O&&fe&&n.texStorage2D(t.TEXTURE_CUBE_MAP,ge,qe,me.width,me.height);for(let ie=0;ie<6;ie++){ye=ue[ie].mipmaps;for(let De=0;De<ye.length;De++){const Ce=ye[De];S.format!==Qn?Pe!==null?O?te&&n.compressedTexSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+ie,De,0,0,Ce.width,Ce.height,Pe,Ce.data):n.compressedTexImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+ie,De,qe,Ce.width,Ce.height,0,Ce.data):$e("WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):O?te&&n.texSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+ie,De,0,0,Ce.width,Ce.height,Pe,ze,Ce.data):n.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+ie,De,qe,Ce.width,Ce.height,0,Pe,ze,Ce.data)}}}else{if(ye=S.mipmaps,O&&fe){ye.length>0&&ge++;const ie=dt(ue[0]);n.texStorage2D(t.TEXTURE_CUBE_MAP,ge,qe,ie.width,ie.height)}for(let ie=0;ie<6;ie++)if(Ne){O?te&&n.texSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+ie,0,0,0,ue[ie].width,ue[ie].height,Pe,ze,ue[ie].data):n.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+ie,0,qe,ue[ie].width,ue[ie].height,0,Pe,ze,ue[ie].data);for(let De=0;De<ye.length;De++){const _t=ye[De].image[ie].image;O?te&&n.texSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+ie,De+1,0,0,_t.width,_t.height,Pe,ze,_t.data):n.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+ie,De+1,qe,_t.width,_t.height,0,Pe,ze,_t.data)}}else{O?te&&n.texSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+ie,0,0,0,Pe,ze,ue[ie]):n.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+ie,0,qe,Pe,ze,ue[ie]);for(let De=0;De<ye.length;De++){const Ce=ye[De];O?te&&n.texSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+ie,De+1,0,0,Pe,ze,Ce.image[ie]):n.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+ie,De+1,qe,Pe,ze,Ce.image[ie])}}}p(S)&&E(t.TEXTURE_CUBE_MAP),le.__version=K.version,S.onUpdate&&S.onUpdate(S)}R.__version=S.version}function Me(R,S,z,Z,K,le){const de=r.convert(z.format,z.colorSpace),J=r.convert(z.type),ne=b(z.internalFormat,de,J,z.normalized,z.colorSpace),he=i.get(S),Ne=i.get(z);if(Ne.__renderTarget=S,!he.__hasExternalTextures){const ue=Math.max(1,S.width>>le),me=Math.max(1,S.height>>le);K===t.TEXTURE_3D||K===t.TEXTURE_2D_ARRAY?n.texImage3D(K,le,ne,ue,me,S.depth,0,de,J,null):n.texImage2D(K,le,ne,ue,me,0,de,J,null)}n.bindFramebuffer(t.FRAMEBUFFER,R),It(S)?a.framebufferTexture2DMultisampleEXT(t.FRAMEBUFFER,Z,K,Ne.__webglTexture,0,Mt(S)):(K===t.TEXTURE_2D||K>=t.TEXTURE_CUBE_MAP_POSITIVE_X&&K<=t.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&t.framebufferTexture2D(t.FRAMEBUFFER,Z,K,Ne.__webglTexture,le),n.bindFramebuffer(t.FRAMEBUFFER,null)}function We(R,S,z){if(t.bindRenderbuffer(t.RENDERBUFFER,R),S.depthBuffer){const Z=S.depthTexture,K=Z&&Z.isDepthTexture?Z.type:null,le=w(S.stencilBuffer,K),de=S.stencilBuffer?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT;It(S)?a.renderbufferStorageMultisampleEXT(t.RENDERBUFFER,Mt(S),le,S.width,S.height):z?t.renderbufferStorageMultisample(t.RENDERBUFFER,Mt(S),le,S.width,S.height):t.renderbufferStorage(t.RENDERBUFFER,le,S.width,S.height),t.framebufferRenderbuffer(t.FRAMEBUFFER,de,t.RENDERBUFFER,R)}else{const Z=S.textures;for(let K=0;K<Z.length;K++){const le=Z[K],de=r.convert(le.format,le.colorSpace),J=r.convert(le.type),ne=b(le.internalFormat,de,J,le.normalized,le.colorSpace);It(S)?a.renderbufferStorageMultisampleEXT(t.RENDERBUFFER,Mt(S),ne,S.width,S.height):z?t.renderbufferStorageMultisample(t.RENDERBUFFER,Mt(S),ne,S.width,S.height):t.renderbufferStorage(t.RENDERBUFFER,ne,S.width,S.height)}}t.bindRenderbuffer(t.RENDERBUFFER,null)}function Lt(R,S,z){const Z=S.isWebGLCubeRenderTarget===!0;if(n.bindFramebuffer(t.FRAMEBUFFER,R),!(S.depthTexture&&S.depthTexture.isDepthTexture))throw new Error("THREE.WebGLTextures: renderTarget.depthTexture must be an instance of THREE.DepthTexture.");const K=i.get(S.depthTexture);if(K.__renderTarget=S,(!K.__webglTexture||S.depthTexture.image.width!==S.width||S.depthTexture.image.height!==S.height)&&(S.depthTexture.image.width=S.width,S.depthTexture.image.height=S.height,S.depthTexture.needsUpdate=!0),Z){if(K.__webglInit===void 0&&(K.__webglInit=!0,S.depthTexture.addEventListener("dispose",P)),K.__webglTexture===void 0){K.__webglTexture=t.createTexture(),n.bindTexture(t.TEXTURE_CUBE_MAP,K.__webglTexture),tt(t.TEXTURE_CUBE_MAP,S.depthTexture);const he=r.convert(S.depthTexture.format),Ne=r.convert(S.depthTexture.type);let ue;S.depthTexture.format===zi?ue=t.DEPTH_COMPONENT24:S.depthTexture.format===bs&&(ue=t.DEPTH24_STENCIL8);for(let me=0;me<6;me++)t.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+me,0,ue,S.width,S.height,0,he,Ne,null)}}else ce(S.depthTexture,0);const le=K.__webglTexture,de=Mt(S),J=Z?t.TEXTURE_CUBE_MAP_POSITIVE_X+z:t.TEXTURE_2D,ne=S.depthTexture.format===bs?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT;if(S.depthTexture.format===zi)It(S)?a.framebufferTexture2DMultisampleEXT(t.FRAMEBUFFER,ne,J,le,0,de):t.framebufferTexture2D(t.FRAMEBUFFER,ne,J,le,0);else if(S.depthTexture.format===bs)It(S)?a.framebufferTexture2DMultisampleEXT(t.FRAMEBUFFER,ne,J,le,0,de):t.framebufferTexture2D(t.FRAMEBUFFER,ne,J,le,0);else throw new Error("THREE.WebGLTextures: Unknown depthTexture format.")}function Xe(R){const S=i.get(R),z=R.isWebGLCubeRenderTarget===!0;if(S.__boundDepthTexture!==R.depthTexture){const Z=R.depthTexture;if(S.__depthDisposeCallback&&S.__depthDisposeCallback(),Z){const K=()=>{delete S.__boundDepthTexture,delete S.__depthDisposeCallback,Z.removeEventListener("dispose",K)};Z.addEventListener("dispose",K),S.__depthDisposeCallback=K}S.__boundDepthTexture=Z}if(R.depthTexture&&!S.__autoAllocateDepthBuffer)if(z)for(let Z=0;Z<6;Z++)Lt(S.__webglFramebuffer[Z],R,Z);else{const Z=R.texture.mipmaps;Z&&Z.length>0?Lt(S.__webglFramebuffer[0],R,0):Lt(S.__webglFramebuffer,R,0)}else if(z){S.__webglDepthbuffer=[];for(let Z=0;Z<6;Z++)if(n.bindFramebuffer(t.FRAMEBUFFER,S.__webglFramebuffer[Z]),S.__webglDepthbuffer[Z]===void 0)S.__webglDepthbuffer[Z]=t.createRenderbuffer(),We(S.__webglDepthbuffer[Z],R,!1);else{const K=R.stencilBuffer?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT,le=S.__webglDepthbuffer[Z];t.bindRenderbuffer(t.RENDERBUFFER,le),t.framebufferRenderbuffer(t.FRAMEBUFFER,K,t.RENDERBUFFER,le)}}else{const Z=R.texture.mipmaps;if(Z&&Z.length>0?n.bindFramebuffer(t.FRAMEBUFFER,S.__webglFramebuffer[0]):n.bindFramebuffer(t.FRAMEBUFFER,S.__webglFramebuffer),S.__webglDepthbuffer===void 0)S.__webglDepthbuffer=t.createRenderbuffer(),We(S.__webglDepthbuffer,R,!1);else{const K=R.stencilBuffer?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT,le=S.__webglDepthbuffer;t.bindRenderbuffer(t.RENDERBUFFER,le),t.framebufferRenderbuffer(t.FRAMEBUFFER,K,t.RENDERBUFFER,le)}}n.bindFramebuffer(t.FRAMEBUFFER,null)}function st(R,S,z){const Z=i.get(R);S!==void 0&&Me(Z.__webglFramebuffer,R,R.texture,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,0),z!==void 0&&Xe(R)}function St(R){const S=R.texture,z=i.get(R),Z=i.get(S);R.addEventListener("dispose",v);const K=R.textures,le=R.isWebGLCubeRenderTarget===!0,de=K.length>1;if(de||(Z.__webglTexture===void 0&&(Z.__webglTexture=t.createTexture()),Z.__version=S.version,o.memory.textures++),le){z.__webglFramebuffer=[];for(let J=0;J<6;J++)if(S.mipmaps&&S.mipmaps.length>0){z.__webglFramebuffer[J]=[];for(let ne=0;ne<S.mipmaps.length;ne++)z.__webglFramebuffer[J][ne]=t.createFramebuffer()}else z.__webglFramebuffer[J]=t.createFramebuffer()}else{if(S.mipmaps&&S.mipmaps.length>0){z.__webglFramebuffer=[];for(let J=0;J<S.mipmaps.length;J++)z.__webglFramebuffer[J]=t.createFramebuffer()}else z.__webglFramebuffer=t.createFramebuffer();if(de)for(let J=0,ne=K.length;J<ne;J++){const he=i.get(K[J]);he.__webglTexture===void 0&&(he.__webglTexture=t.createTexture(),o.memory.textures++)}if(R.samples>0&&It(R)===!1){z.__webglMultisampledFramebuffer=t.createFramebuffer(),z.__webglColorRenderbuffer=[],n.bindFramebuffer(t.FRAMEBUFFER,z.__webglMultisampledFramebuffer);for(let J=0;J<K.length;J++){const ne=K[J];z.__webglColorRenderbuffer[J]=t.createRenderbuffer(),t.bindRenderbuffer(t.RENDERBUFFER,z.__webglColorRenderbuffer[J]);const he=r.convert(ne.format,ne.colorSpace),Ne=r.convert(ne.type),ue=b(ne.internalFormat,he,Ne,ne.normalized,ne.colorSpace,R.isXRRenderTarget===!0),me=Mt(R);t.renderbufferStorageMultisample(t.RENDERBUFFER,me,ue,R.width,R.height),t.framebufferRenderbuffer(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0+J,t.RENDERBUFFER,z.__webglColorRenderbuffer[J])}t.bindRenderbuffer(t.RENDERBUFFER,null),R.depthBuffer&&(z.__webglDepthRenderbuffer=t.createRenderbuffer(),We(z.__webglDepthRenderbuffer,R,!0)),n.bindFramebuffer(t.FRAMEBUFFER,null)}}if(le){n.bindTexture(t.TEXTURE_CUBE_MAP,Z.__webglTexture),tt(t.TEXTURE_CUBE_MAP,S);for(let J=0;J<6;J++)if(S.mipmaps&&S.mipmaps.length>0)for(let ne=0;ne<S.mipmaps.length;ne++)Me(z.__webglFramebuffer[J][ne],R,S,t.COLOR_ATTACHMENT0,t.TEXTURE_CUBE_MAP_POSITIVE_X+J,ne);else Me(z.__webglFramebuffer[J],R,S,t.COLOR_ATTACHMENT0,t.TEXTURE_CUBE_MAP_POSITIVE_X+J,0);p(S)&&E(t.TEXTURE_CUBE_MAP),n.unbindTexture()}else if(de){for(let J=0,ne=K.length;J<ne;J++){const he=K[J],Ne=i.get(he);let ue=t.TEXTURE_2D;(R.isWebGL3DRenderTarget||R.isWebGLArrayRenderTarget)&&(ue=R.isWebGL3DRenderTarget?t.TEXTURE_3D:t.TEXTURE_2D_ARRAY),n.bindTexture(ue,Ne.__webglTexture),tt(ue,he),Me(z.__webglFramebuffer,R,he,t.COLOR_ATTACHMENT0+J,ue,0),p(he)&&E(ue)}n.unbindTexture()}else{let J=t.TEXTURE_2D;if((R.isWebGL3DRenderTarget||R.isWebGLArrayRenderTarget)&&(J=R.isWebGL3DRenderTarget?t.TEXTURE_3D:t.TEXTURE_2D_ARRAY),n.bindTexture(J,Z.__webglTexture),tt(J,S),S.mipmaps&&S.mipmaps.length>0)for(let ne=0;ne<S.mipmaps.length;ne++)Me(z.__webglFramebuffer[ne],R,S,t.COLOR_ATTACHMENT0,J,ne);else Me(z.__webglFramebuffer,R,S,t.COLOR_ATTACHMENT0,J,0);p(S)&&E(J),n.unbindTexture()}R.depthBuffer&&Xe(R)}function Qe(R){const S=R.textures;for(let z=0,Z=S.length;z<Z;z++){const K=S[z];if(p(K)){const le=I(R),de=i.get(K).__webglTexture;n.bindTexture(le,de),E(le),n.unbindTexture()}}}const xt=[],Ot=[];function qt(R){if(R.samples>0){if(It(R)===!1){const S=R.textures,z=R.width,Z=R.height;let K=t.COLOR_BUFFER_BIT;const le=R.stencilBuffer?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT,de=i.get(R),J=S.length>1;if(J)for(let he=0;he<S.length;he++)n.bindFramebuffer(t.FRAMEBUFFER,de.__webglMultisampledFramebuffer),t.framebufferRenderbuffer(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0+he,t.RENDERBUFFER,null),n.bindFramebuffer(t.FRAMEBUFFER,de.__webglFramebuffer),t.framebufferTexture2D(t.DRAW_FRAMEBUFFER,t.COLOR_ATTACHMENT0+he,t.TEXTURE_2D,null,0);n.bindFramebuffer(t.READ_FRAMEBUFFER,de.__webglMultisampledFramebuffer);const ne=R.texture.mipmaps;ne&&ne.length>0?n.bindFramebuffer(t.DRAW_FRAMEBUFFER,de.__webglFramebuffer[0]):n.bindFramebuffer(t.DRAW_FRAMEBUFFER,de.__webglFramebuffer);for(let he=0;he<S.length;he++){if(R.resolveDepthBuffer&&(R.depthBuffer&&(K|=t.DEPTH_BUFFER_BIT),R.stencilBuffer&&R.resolveStencilBuffer&&(K|=t.STENCIL_BUFFER_BIT)),J){t.framebufferRenderbuffer(t.READ_FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.RENDERBUFFER,de.__webglColorRenderbuffer[he]);const Ne=i.get(S[he]).__webglTexture;t.framebufferTexture2D(t.DRAW_FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,Ne,0)}t.blitFramebuffer(0,0,z,Z,0,0,z,Z,K,t.NEAREST),c===!0&&(xt.length=0,Ot.length=0,xt.push(t.COLOR_ATTACHMENT0+he),R.depthBuffer&&R.storeMultisampledDepthBuffer===!1&&(xt.push(le),Ot.push(le),t.invalidateFramebuffer(t.DRAW_FRAMEBUFFER,Ot)),t.invalidateFramebuffer(t.READ_FRAMEBUFFER,xt))}if(n.bindFramebuffer(t.READ_FRAMEBUFFER,null),n.bindFramebuffer(t.DRAW_FRAMEBUFFER,null),J)for(let he=0;he<S.length;he++){n.bindFramebuffer(t.FRAMEBUFFER,de.__webglMultisampledFramebuffer),t.framebufferRenderbuffer(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0+he,t.RENDERBUFFER,de.__webglColorRenderbuffer[he]);const Ne=i.get(S[he]).__webglTexture;n.bindFramebuffer(t.FRAMEBUFFER,de.__webglFramebuffer),t.framebufferTexture2D(t.DRAW_FRAMEBUFFER,t.COLOR_ATTACHMENT0+he,t.TEXTURE_2D,Ne,0)}n.bindFramebuffer(t.DRAW_FRAMEBUFFER,de.__webglMultisampledFramebuffer)}else if(R.depthBuffer&&R.storeMultisampledDepthBuffer===!1&&c){const S=R.stencilBuffer?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT;t.invalidateFramebuffer(t.DRAW_FRAMEBUFFER,[S])}}}function Mt(R){return Math.min(s.maxSamples,R.samples)}function It(R){const S=i.get(R);return R.samples>0&&e.has("WEBGL_multisampled_render_to_texture")===!0&&S.__useRenderToTexture!==!1}function F(R){const S=o.render.frame;u.get(R)!==S&&(u.set(R,S),R.update())}function Bt(R,S){const z=R.colorSpace,Z=R.format,K=R.type;return R.isCompressedTexture===!0||R.isVideoTexture===!0||z!==Aa&&z!==ts&&(ft.getTransfer(z)===Et?(Z!==Qn||K!==$n)&&$e("WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):vt("WebGLTextures: Unsupported texture color space:",z)),S}function dt(R){return typeof HTMLImageElement<"u"&&R instanceof HTMLImageElement?(l.width=R.naturalWidth||R.width,l.height=R.naturalHeight||R.height):typeof VideoFrame<"u"&&R instanceof VideoFrame?(l.width=R.displayWidth,l.height=R.displayHeight):(l.width=R.width,l.height=R.height),l}this.allocateTextureUnit=Q,this.resetTextureUnits=q,this.getTextureUnits=U,this.setTextureUnits=V,this.setTexture2D=ce,this.setTexture2DArray=j,this.setTexture3D=se,this.setTextureCube=oe,this.rebindTextures=st,this.setupRenderTarget=St,this.updateRenderTargetMipmap=Qe,this.updateMultisampleRenderTarget=qt,this.setupDepthRenderbuffer=Xe,this.setupFrameBufferTexture=Me,this.useMultisampledRTT=It,this.isReversedDepthBuffer=function(){return n.buffers.depth.getReversed()}}function yI(t,e){function n(i,s=ts){let r;const o=ft.getTransfer(s);if(i===$n)return t.UNSIGNED_BYTE;if(i===Ud)return t.UNSIGNED_SHORT_4_4_4_4;if(i===Od)return t.UNSIGNED_SHORT_5_5_5_1;if(i===MS)return t.UNSIGNED_INT_5_9_9_9_REV;if(i===ES)return t.UNSIGNED_INT_10F_11F_11F_REV;if(i===yS)return t.BYTE;if(i===bS)return t.SHORT;if(i===lo)return t.UNSIGNED_SHORT;if(i===Dd)return t.INT;if(i===vi)return t.UNSIGNED_INT;if(i===mi)return t.FLOAT;if(i===xi)return t.HALF_FLOAT;if(i===TS)return t.ALPHA;if(i===RS)return t.RGB;if(i===Qn)return t.RGBA;if(i===zi)return t.DEPTH_COMPONENT;if(i===bs)return t.DEPTH_STENCIL;if(i===wS)return t.RED;if(i===Fd)return t.RED_INTEGER;if(i===Ps)return t.RG;if(i===kd)return t.RG_INTEGER;if(i===zd)return t.RGBA_INTEGER;if(i===aa||i===ca||i===la||i===ua)if(o===Et)if(r=e.get("WEBGL_compressed_texture_s3tc_srgb"),r!==null){if(i===aa)return r.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(i===ca)return r.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(i===la)return r.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(i===ua)return r.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(r=e.get("WEBGL_compressed_texture_s3tc"),r!==null){if(i===aa)return r.COMPRESSED_RGB_S3TC_DXT1_EXT;if(i===ca)return r.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(i===la)return r.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(i===ua)return r.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(i===Xl||i===Yl||i===Kl||i===jl)if(r=e.get("WEBGL_compressed_texture_pvrtc"),r!==null){if(i===Xl)return r.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(i===Yl)return r.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(i===Kl)return r.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(i===jl)return r.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(i===Jl||i===Ql||i===eu||i===tu||i===nu||i===Ra||i===iu)if(r=e.get("WEBGL_compressed_texture_etc"),r!==null){if(i===Jl||i===Ql)return o===Et?r.COMPRESSED_SRGB8_ETC2:r.COMPRESSED_RGB8_ETC2;if(i===eu)return o===Et?r.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:r.COMPRESSED_RGBA8_ETC2_EAC;if(i===tu)return r.COMPRESSED_R11_EAC;if(i===nu)return r.COMPRESSED_SIGNED_R11_EAC;if(i===Ra)return r.COMPRESSED_RG11_EAC;if(i===iu)return r.COMPRESSED_SIGNED_RG11_EAC}else return null;if(i===su||i===ru||i===ou||i===au||i===cu||i===lu||i===uu||i===du||i===hu||i===fu||i===pu||i===mu||i===gu||i===_u)if(r=e.get("WEBGL_compressed_texture_astc"),r!==null){if(i===su)return o===Et?r.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:r.COMPRESSED_RGBA_ASTC_4x4_KHR;if(i===ru)return o===Et?r.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:r.COMPRESSED_RGBA_ASTC_5x4_KHR;if(i===ou)return o===Et?r.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:r.COMPRESSED_RGBA_ASTC_5x5_KHR;if(i===au)return o===Et?r.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:r.COMPRESSED_RGBA_ASTC_6x5_KHR;if(i===cu)return o===Et?r.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:r.COMPRESSED_RGBA_ASTC_6x6_KHR;if(i===lu)return o===Et?r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:r.COMPRESSED_RGBA_ASTC_8x5_KHR;if(i===uu)return o===Et?r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:r.COMPRESSED_RGBA_ASTC_8x6_KHR;if(i===du)return o===Et?r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:r.COMPRESSED_RGBA_ASTC_8x8_KHR;if(i===hu)return o===Et?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:r.COMPRESSED_RGBA_ASTC_10x5_KHR;if(i===fu)return o===Et?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:r.COMPRESSED_RGBA_ASTC_10x6_KHR;if(i===pu)return o===Et?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:r.COMPRESSED_RGBA_ASTC_10x8_KHR;if(i===mu)return o===Et?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:r.COMPRESSED_RGBA_ASTC_10x10_KHR;if(i===gu)return o===Et?r.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:r.COMPRESSED_RGBA_ASTC_12x10_KHR;if(i===_u)return o===Et?r.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:r.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(i===Su||i===vu||i===xu)if(r=e.get("EXT_texture_compression_bptc"),r!==null){if(i===Su)return o===Et?r.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:r.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(i===vu)return r.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(i===xu)return r.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(i===yu||i===bu||i===wa||i===Mu)if(r=e.get("EXT_texture_compression_rgtc"),r!==null){if(i===yu)return r.COMPRESSED_RED_RGTC1_EXT;if(i===bu)return r.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(i===wa)return r.COMPRESSED_RED_GREEN_RGTC2_EXT;if(i===Mu)return r.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return i===uo?t.UNSIGNED_INT_24_8:t[i]!==void 0?t[i]:null}return{convert:n}}const bI=`
|
|
4310
4310
|
void main() {
|
|
4311
4311
|
|
|
4312
4312
|
gl_Position = vec4( position, 1.0 );
|
|
4313
4313
|
|
|
4314
|
-
}`,
|
|
4314
|
+
}`,MI=`
|
|
4315
4315
|
uniform sampler2DArray depthColor;
|
|
4316
4316
|
uniform float depthWidth;
|
|
4317
4317
|
uniform float depthHeight;
|
|
@@ -4330,73 +4330,104 @@ void main() {
|
|
|
4330
4330
|
|
|
4331
4331
|
}
|
|
4332
4332
|
|
|
4333
|
-
}`;class yI{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(e,n){if(this.texture===null){const i=new j_(e.texture);(e.depthNear!==n.depthNear||e.depthFar!==n.depthFar)&&(this.depthNear=e.depthNear,this.depthFar=e.depthFar),this.texture=i}}getMesh(e){if(this.texture!==null&&this.mesh===null){const n=e.cameras[0].viewport,i=new mi({vertexShader:vI,fragmentShader:xI,uniforms:{depthColor:{value:this.texture},depthWidth:{value:n.z},depthHeight:{value:n.w}}});this.mesh=new ei(new ec(20,20),i)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}}class bI extends Qi{constructor(e,n){super();const i=this;let s=null,r=1,o=null,a="local-floor",c=1,l=null,u=null,h=null,d=null,f=null,_=null;const x=typeof XRWebGLBinding<"u",m=new yI,p={},E=n.getContextAttributes();let L=null,b=null;const w=[],A=[],P=new Ke;let v=null,T=null;const I=new zn;I.viewport=new Ht;const N=new zn;N.viewport=new Ht;const k=[I,N],$=new ww;let U=null,V=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(Y){let re=w[Y];return re===void 0&&(re=new Ac,w[Y]=re),re.getTargetRaySpace()},this.getControllerGrip=function(Y){let re=w[Y];return re===void 0&&(re=new Ac,w[Y]=re),re.getGripSpace()},this.getHand=function(Y){let re=w[Y];return re===void 0&&(re=new Ac,w[Y]=re),re.getHandSpace()};function Q(Y){const re=A.indexOf(Y.inputSource);if(re===-1)return;const Re=w[re];Re!==void 0&&(Re.update(Y.inputSource,Y.frame,l||o),Re.dispatchEvent({type:Y.type,data:Y.inputSource}))}function X(){s.removeEventListener("select",Q),s.removeEventListener("selectstart",Q),s.removeEventListener("selectend",Q),s.removeEventListener("squeeze",Q),s.removeEventListener("squeezestart",Q),s.removeEventListener("squeezeend",Q),s.removeEventListener("end",X),s.removeEventListener("inputsourceschange",ce);for(let Y=0;Y<w.length;Y++){const re=A[Y];re!==null&&(A[Y]=null,w[Y].disconnect(re))}U=null,V=null,m.reset();for(const Y in p)delete p[Y];if(e.setRenderTarget(L),f=null,d=null,h=null,s=null,b=null,je.stop(),i.isPresenting=!1,e.setPixelRatio(v),e.setSize(P.width,P.height,!1),T!==null){const Y=T.camera;Y.fov=T.fov,Y.zoom=T.zoom,Y.updateProjectionMatrix(),T=null}i.dispatchEvent({type:"sessionend"})}this.setFramebufferScaleFactor=function(Y){r=Y,i.isPresenting===!0&&Ge("WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(Y){a=Y,i.isPresenting===!0&&Ge("WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return l||o},this.setReferenceSpace=function(Y){l=Y},this.getBaseLayer=function(){return d!==null?d:f},this.getBinding=function(){return h===null&&x&&(h=new XRWebGLBinding(s,n)),h},this.getFrame=function(){return _},this.getSession=function(){return s},this.setSession=async function(Y){if(s=Y,s!==null){if(L=e.getRenderTarget(),s.addEventListener("select",Q),s.addEventListener("selectstart",Q),s.addEventListener("selectend",Q),s.addEventListener("squeeze",Q),s.addEventListener("squeezestart",Q),s.addEventListener("squeezeend",Q),s.addEventListener("end",X),s.addEventListener("inputsourceschange",ce),E.xrCompatible!==!0&&await n.makeXRCompatible(),v=e.getPixelRatio(),e.getSize(P),x&&"createProjectionLayer"in XRWebGLBinding.prototype){let Re=null,Ve=null,Me=null;E.depth&&(Me=E.stencil?n.DEPTH24_STENCIL8:n.DEPTH_COMPONENT24,Re=E.stencil?ds:Ni,Ve=E.stencil?Jr:fi);const $e={colorFormat:n.RGBA8,depthFormat:Me,scaleFactor:r};h=this.getBinding(),d=h.createProjectionLayer($e),s.updateRenderState({layers:[d]}),e.setPixelRatio(1),e.setSize(d.textureWidth,d.textureHeight,!1),b=new Kn(d.textureWidth,d.textureHeight,{format:Yn,type:Hn,depthTexture:new eo(d.textureWidth,d.textureHeight,Ve,void 0,void 0,void 0,void 0,void 0,void 0,Re),stencilBuffer:E.stencil,colorSpace:e.outputColorSpace,samples:E.antialias?4:0,resolveDepthBuffer:d.ignoreDepthValues===!1,resolveStencilBuffer:d.ignoreDepthValues===!1,storeMultisampledDepthBuffer:d.ignoreDepthValues===!1,storeMultisampledStencilBuffer:d.ignoreDepthValues===!1})}else{const Re={antialias:E.antialias,alpha:!0,depth:E.depth,stencil:E.stencil,framebufferScaleFactor:r};f=new XRWebGLLayer(s,n,Re),s.updateRenderState({baseLayer:f}),e.setPixelRatio(1),e.setSize(f.framebufferWidth,f.framebufferHeight,!1),b=new Kn(f.framebufferWidth,f.framebufferHeight,{format:Yn,type:Hn,colorSpace:e.outputColorSpace,stencilBuffer:E.stencil,resolveDepthBuffer:f.ignoreDepthValues===!1,resolveStencilBuffer:f.ignoreDepthValues===!1,storeMultisampledDepthBuffer:f.ignoreDepthValues===!1,storeMultisampledStencilBuffer:f.ignoreDepthValues===!1})}b.isXRRenderTarget=!0,this.setFoveation(c),l=null,o=await s.requestReferenceSpace(a),je.setContext(s),je.start(),i.isPresenting=!0,i.dispatchEvent({type:"sessionstart"})}},this.getEnvironmentBlendMode=function(){if(s!==null)return s.environmentBlendMode},this.getDepthTexture=function(){return m.getDepthTexture()};function ce(Y){for(let re=0;re<Y.removed.length;re++){const Re=Y.removed[re],Ve=A.indexOf(Re);Ve>=0&&(A[Ve]=null,w[Ve].disconnect(Re))}for(let re=0;re<Y.added.length;re++){const Re=Y.added[re];let Ve=A.indexOf(Re);if(Ve===-1){for(let $e=0;$e<w.length;$e++)if($e>=A.length){A.push(Re),Ve=$e;break}else if(A[$e]===null){A[$e]=Re,Ve=$e;break}if(Ve===-1)break}const Me=w[Ve];Me&&Me.connect(Re)}}const j=new H,se=new H;function oe(Y,re,Re){j.setFromMatrixPosition(re.matrixWorld),se.setFromMatrixPosition(Re.matrixWorld);const Ve=j.distanceTo(se),Me=re.projectionMatrix.elements,$e=Re.projectionMatrix.elements,Ct=Me[14]/(Me[10]-1),Ze=Me[14]/(Me[10]+1),it=(Me[9]+1)/Me[5],_t=(Me[9]-1)/Me[5],Je=(Me[8]-1)/Me[0],vt=($e[8]+1)/$e[0],Ut=Ct*Je,qt=Ct*vt,bt=Ve/(-Je+vt),Pt=bt*-Je;if(re.matrixWorld.decompose(Y.position,Y.quaternion,Y.scale),Y.translateX(Pt),Y.translateZ(bt),Y.matrixWorld.compose(Y.position,Y.quaternion,Y.scale),Y.matrixWorldInverse.copy(Y.matrixWorld).invert(),Me[10]===-1)Y.projectionMatrix.copy(re.projectionMatrix),Y.projectionMatrixInverse.copy(re.projectionMatrixInverse);else{const F=Ct+bt,zt=Ze+bt,lt=Ut-Pt,R=qt+(Ve-Pt),S=it*Ze/zt*F,z=_t*Ze/zt*F;Y.projectionMatrix.makePerspective(lt,R,S,z,F,zt),Y.projectionMatrixInverse.copy(Y.projectionMatrix).invert()}}function Fe(Y,re){re===null?Y.matrixWorld.copy(Y.matrix):Y.matrixWorld.multiplyMatrices(re.matrixWorld,Y.matrix),Y.matrixWorldInverse.copy(Y.matrixWorld).invert()}this.updateCamera=function(Y){if(s===null)return;let re=Y.near,Re=Y.far;m.texture!==null&&(m.depthNear>0&&(re=m.depthNear),m.depthFar>0&&(Re=m.depthFar)),$.near=N.near=I.near=re,$.far=N.far=I.far=Re,(U!==$.near||V!==$.far)&&(s.updateRenderState({depthNear:$.near,depthFar:$.far}),U=$.near,V=$.far),$.layers.mask=Y.layers.mask|6,I.layers.mask=$.layers.mask&-5,N.layers.mask=$.layers.mask&-3;const Ve=Y.parent,Me=$.cameras;Fe($,Ve);for(let $e=0;$e<Me.length;$e++)Fe(Me[$e],Ve);Me.length===2?oe($,I,N):$.projectionMatrix.copy(I.projectionMatrix),T===null&&Y.isPerspectiveCamera&&(T={camera:Y,fov:Y.fov,zoom:Y.zoom}),Le(Y,$,Ve)};function Le(Y,re,Re){Re===null?Y.matrix.copy(re.matrixWorld):(Y.matrix.copy(Re.matrixWorld),Y.matrix.invert(),Y.matrix.multiply(re.matrixWorld)),Y.matrix.decompose(Y.position,Y.quaternion,Y.scale),Y.updateMatrixWorld(!0),Y.projectionMatrix.copy(re.projectionMatrix),Y.projectionMatrixInverse.copy(re.projectionMatrixInverse),Y.isPerspectiveCamera&&(Y.fov=Qr*2*Math.atan(1/Y.projectionMatrix.elements[5]),Y.zoom=1)}this.getCamera=function(){return $},this.getFoveation=function(){if(!(d===null&&f===null))return c},this.setFoveation=function(Y){c=Y,d!==null&&(d.fixedFoveation=Y),f!==null&&f.fixedFoveation!==void 0&&(f.fixedFoveation=Y)},this.hasDepthSensing=function(){return m.texture!==null},this.getDepthSensingMesh=function(){return m.getMesh($)},this.getCameraTexture=function(Y){return p[Y]};let ft=null;function et(Y,re){if(u=re.getViewerPose(l||o),_=re,u!==null){const Re=u.views;f!==null&&(e.setRenderTargetFramebuffer(b,f.framebuffer),e.setRenderTarget(b));let Ve=!1;Re.length!==$.cameras.length&&($.cameras.length=0,Ve=!0);for(let Ze=0;Ze<Re.length;Ze++){const it=Re[Ze];let _t=null;if(f!==null)_t=f.getViewport(it);else{const vt=h.getViewSubImage(d,it);_t=vt.viewport,Ze===0&&(e.setRenderTargetTextures(b,vt.colorTexture,vt.depthStencilTexture),e.setRenderTarget(b))}let Je=k[Ze];Je===void 0&&(Je=new zn,Je.layers.enable(Ze),Je.viewport=new Ht,k[Ze]=Je),Je.matrix.fromArray(it.transform.matrix),Je.matrix.decompose(Je.position,Je.quaternion,Je.scale),Je.projectionMatrix.fromArray(it.projectionMatrix),Je.projectionMatrixInverse.copy(Je.projectionMatrix).invert(),Je.viewport.set(_t.x,_t.y,_t.width,_t.height),Ze===0&&($.matrix.copy(Je.matrix),$.matrix.decompose($.position,$.quaternion,$.scale)),Ve===!0&&$.cameras.push(Je)}const Me=s.enabledFeatures;if(Me&&Me.includes("depth-sensing")&&s.depthUsage=="gpu-optimized"&&x){h=i.getBinding();const Ze=h.getDepthInformation(Re[0]);Ze&&Ze.isValid&&Ze.texture&&m.init(Ze,s.renderState)}if(Me&&Me.includes("camera-access")&&x){e.state.unbindTexture(),h=i.getBinding();for(let Ze=0;Ze<Re.length;Ze++){const it=Re[Ze].camera;if(it){let _t=p[it];_t||(_t=new j_,p[it]=_t);const Je=h.getCameraImage(it);_t.sourceTexture=Je}}}}for(let Re=0;Re<w.length;Re++){const Ve=A[Re],Me=w[Re];Ve!==null&&Me!==void 0&&Me.update(Ve,re,l||o)}ft&&ft(Y,re),re.detectedPlanes&&i.dispatchEvent({type:"planesdetected",data:re}),_=null}const je=new tS;je.setAnimationLoop(et),this.setAnimationLoop=function(Y){ft=Y},this.dispose=function(){}}}const MI=new Gt,cS=new Ye;cS.set(-1,0,0,0,1,0,0,0,1);function EI(t,e){function n(m,p){m.matrixAutoUpdate===!0&&m.updateMatrix(),p.value.copy(m.matrix)}function i(m,p){p.color.getRGB(m.fogColor.value,J_(t)),p.isFog?(m.fogNear.value=p.near,m.fogFar.value=p.far):p.isFogExp2&&(m.fogDensity.value=p.density)}function s(m,p,E,L,b){p.isNodeMaterial?p.uniformsNeedUpdate=!1:p.isMeshBasicMaterial?r(m,p):p.isMeshLambertMaterial?(r(m,p),p.envMap&&(m.envMapIntensity.value=p.envMapIntensity)):p.isMeshToonMaterial?(r(m,p),h(m,p)):p.isMeshPhongMaterial?(r(m,p),u(m,p),p.envMap&&(m.envMapIntensity.value=p.envMapIntensity)):p.isMeshStandardMaterial?(r(m,p),d(m,p),p.isMeshPhysicalMaterial&&f(m,p,b)):p.isMeshMatcapMaterial?(r(m,p),_(m,p)):p.isMeshDepthMaterial?r(m,p):p.isMeshDistanceMaterial?(r(m,p),x(m,p)):p.isMeshNormalMaterial?r(m,p):p.isLineBasicMaterial?(o(m,p),p.isLineDashedMaterial&&a(m,p)):p.isPointsMaterial?c(m,p,E,L):p.isSpriteMaterial?l(m,p):p.isShadowMaterial?(m.color.value.copy(p.color),m.opacity.value=p.opacity):p.isShaderMaterial&&(p.uniformsNeedUpdate=!1)}function r(m,p){m.opacity.value=p.opacity,p.color&&m.diffuse.value.copy(p.color),p.emissive&&m.emissive.value.copy(p.emissive).multiplyScalar(p.emissiveIntensity),p.map&&(m.map.value=p.map,n(p.map,m.mapTransform)),p.alphaMap&&(m.alphaMap.value=p.alphaMap,n(p.alphaMap,m.alphaMapTransform)),p.bumpMap&&(m.bumpMap.value=p.bumpMap,n(p.bumpMap,m.bumpMapTransform),m.bumpScale.value=p.bumpScale,p.side===Rn&&(m.bumpScale.value*=-1)),p.normalMap&&(m.normalMap.value=p.normalMap,n(p.normalMap,m.normalMapTransform),m.normalScale.value.copy(p.normalScale),p.side===Rn&&m.normalScale.value.negate()),p.displacementMap&&(m.displacementMap.value=p.displacementMap,n(p.displacementMap,m.displacementMapTransform),m.displacementScale.value=p.displacementScale,m.displacementBias.value=p.displacementBias),p.emissiveMap&&(m.emissiveMap.value=p.emissiveMap,n(p.emissiveMap,m.emissiveMapTransform)),p.specularMap&&(m.specularMap.value=p.specularMap,n(p.specularMap,m.specularMapTransform)),p.alphaTest>0&&(m.alphaTest.value=p.alphaTest);const E=e.get(p),L=E.envMap,b=E.envMapRotation;L&&(m.envMap.value=L,m.envMapRotation.value.setFromMatrix4(MI.makeRotationFromEuler(b)).transpose(),L.isCubeTexture&&L.isRenderTargetTexture===!1&&m.envMapRotation.value.premultiply(cS),m.reflectivity.value=p.reflectivity,m.ior.value=p.ior,m.refractionRatio.value=p.refractionRatio),p.lightMap&&(m.lightMap.value=p.lightMap,m.lightMapIntensity.value=p.lightMapIntensity,n(p.lightMap,m.lightMapTransform)),p.aoMap&&(m.aoMap.value=p.aoMap,m.aoMapIntensity.value=p.aoMapIntensity,n(p.aoMap,m.aoMapTransform))}function o(m,p){m.diffuse.value.copy(p.color),m.opacity.value=p.opacity,p.map&&(m.map.value=p.map,n(p.map,m.mapTransform))}function a(m,p){m.dashSize.value=p.dashSize,m.totalSize.value=p.dashSize+p.gapSize,m.scale.value=p.scale}function c(m,p,E,L){m.diffuse.value.copy(p.color),m.opacity.value=p.opacity,m.size.value=p.size*E,m.scale.value=L*.5,p.map&&(m.map.value=p.map,n(p.map,m.uvTransform)),p.alphaMap&&(m.alphaMap.value=p.alphaMap,n(p.alphaMap,m.alphaMapTransform)),p.alphaTest>0&&(m.alphaTest.value=p.alphaTest)}function l(m,p){m.diffuse.value.copy(p.color),m.opacity.value=p.opacity,m.rotation.value=p.rotation,p.map&&(m.map.value=p.map,n(p.map,m.mapTransform)),p.alphaMap&&(m.alphaMap.value=p.alphaMap,n(p.alphaMap,m.alphaMapTransform)),p.alphaTest>0&&(m.alphaTest.value=p.alphaTest)}function u(m,p){m.specular.value.copy(p.specular),m.shininess.value=Math.max(p.shininess,1e-4)}function h(m,p){p.gradientMap&&(m.gradientMap.value=p.gradientMap)}function d(m,p){m.metalness.value=p.metalness,p.metalnessMap&&(m.metalnessMap.value=p.metalnessMap,n(p.metalnessMap,m.metalnessMapTransform)),m.roughness.value=p.roughness,p.roughnessMap&&(m.roughnessMap.value=p.roughnessMap,n(p.roughnessMap,m.roughnessMapTransform)),p.envMap&&(m.envMapIntensity.value=p.envMapIntensity)}function f(m,p,E){m.ior.value=p.ior,p.sheen>0&&(m.sheenColor.value.copy(p.sheenColor).multiplyScalar(p.sheen),m.sheenRoughness.value=p.sheenRoughness,p.sheenColorMap&&(m.sheenColorMap.value=p.sheenColorMap,n(p.sheenColorMap,m.sheenColorMapTransform)),p.sheenRoughnessMap&&(m.sheenRoughnessMap.value=p.sheenRoughnessMap,n(p.sheenRoughnessMap,m.sheenRoughnessMapTransform))),p.clearcoat>0&&(m.clearcoat.value=p.clearcoat,m.clearcoatRoughness.value=p.clearcoatRoughness,p.clearcoatMap&&(m.clearcoatMap.value=p.clearcoatMap,n(p.clearcoatMap,m.clearcoatMapTransform)),p.clearcoatRoughnessMap&&(m.clearcoatRoughnessMap.value=p.clearcoatRoughnessMap,n(p.clearcoatRoughnessMap,m.clearcoatRoughnessMapTransform)),p.clearcoatNormalMap&&(m.clearcoatNormalMap.value=p.clearcoatNormalMap,n(p.clearcoatNormalMap,m.clearcoatNormalMapTransform),m.clearcoatNormalScale.value.copy(p.clearcoatNormalScale),p.side===Rn&&m.clearcoatNormalScale.value.negate())),p.dispersion>0&&(m.dispersion.value=p.dispersion),p.retroreflectivity>0&&(m.retroreflectivity.value=p.retroreflectivity),p.iridescence>0&&(m.iridescence.value=p.iridescence,m.iridescenceIOR.value=p.iridescenceIOR,m.iridescenceThicknessMinimum.value=p.iridescenceThicknessRange[0],m.iridescenceThicknessMaximum.value=p.iridescenceThicknessRange[1],p.iridescenceMap&&(m.iridescenceMap.value=p.iridescenceMap,n(p.iridescenceMap,m.iridescenceMapTransform)),p.iridescenceThicknessMap&&(m.iridescenceThicknessMap.value=p.iridescenceThicknessMap,n(p.iridescenceThicknessMap,m.iridescenceThicknessMapTransform))),p.transmission>0&&(m.transmission.value=p.transmission,m.transmissionSamplerMap.value=E.texture,m.transmissionSamplerSize.value.set(E.width,E.height),p.transmissionMap&&(m.transmissionMap.value=p.transmissionMap,n(p.transmissionMap,m.transmissionMapTransform)),m.thickness.value=p.thickness,p.thicknessMap&&(m.thicknessMap.value=p.thicknessMap,n(p.thicknessMap,m.thicknessMapTransform)),m.attenuationDistance.value=p.attenuationDistance,m.attenuationColor.value.copy(p.attenuationColor)),p.anisotropy>0&&(m.anisotropyVector.value.set(p.anisotropy*Math.cos(p.anisotropyRotation),p.anisotropy*Math.sin(p.anisotropyRotation)),p.anisotropyMap&&(m.anisotropyMap.value=p.anisotropyMap,n(p.anisotropyMap,m.anisotropyMapTransform))),m.specularIntensity.value=p.specularIntensity,m.specularColor.value.copy(p.specularColor),p.specularColorMap&&(m.specularColorMap.value=p.specularColorMap,n(p.specularColorMap,m.specularColorMapTransform)),p.specularIntensityMap&&(m.specularIntensityMap.value=p.specularIntensityMap,n(p.specularIntensityMap,m.specularIntensityMapTransform))}function _(m,p){p.matcap&&(m.matcap.value=p.matcap)}function x(m,p){const E=e.get(p).light;m.referencePosition.value.setFromMatrixPosition(E.matrixWorld),m.nearDistance.value=E.shadow.camera.near,m.farDistance.value=E.shadow.camera.far}return{refreshFogUniforms:i,refreshMaterialUniforms:s}}function TI(t,e,n,i){let s={},r={},o=[];const a=t.getParameter(t.MAX_UNIFORM_BUFFER_BINDINGS);function c(b,w){const A=w.program;i.uniformBlockBinding(b,A)}function l(b,w){let A=s[b.id];A===void 0&&(m(b),A=u(b),s[b.id]=A,b.addEventListener("dispose",E));const P=w.program;i.updateUBOMapping(b,P);const v=e.render.frame;r[b.id]!==v&&(d(b),r[b.id]=v)}function u(b){const w=h();b.__bindingPointIndex=w;const A=t.createBuffer(),P=b.__size,v=b.usage;return t.bindBuffer(t.UNIFORM_BUFFER,A),t.bufferData(t.UNIFORM_BUFFER,P,v),t.bindBuffer(t.UNIFORM_BUFFER,null),t.bindBufferBase(t.UNIFORM_BUFFER,w,A),A}function h(){for(let b=0;b<a;b++)if(o.indexOf(b)===-1)return o.push(b),b;return St("WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}function d(b){const w=s[b.id],A=b.uniforms,P=b.__cache;t.bindBuffer(t.UNIFORM_BUFFER,w);for(let v=0,T=A.length;v<T;v++){const I=A[v];if(Array.isArray(I))for(let N=0,k=I.length;N<k;N++)f(I[N],v,N,P);else f(I,v,0,P)}t.bindBuffer(t.UNIFORM_BUFFER,null)}function f(b,w,A,P){if(x(b,w,A,P)===!0){const v=b.__offset,T=b.value;if(Array.isArray(T)){let I=0;for(let N=0;N<T.length;N++){const k=T[N],$=p(k);_(k,b.__data,I),typeof k!="number"&&typeof k!="boolean"&&!k.isMatrix3&&!ArrayBuffer.isView(k)&&(I+=$.storage/Float32Array.BYTES_PER_ELEMENT)}}else _(T,b.__data,0);t.bufferSubData(t.UNIFORM_BUFFER,v,b.__data)}}function _(b,w,A){typeof b=="number"||typeof b=="boolean"?w[0]=b:b.isMatrix3?(w[0]=b.elements[0],w[1]=b.elements[1],w[2]=b.elements[2],w[3]=0,w[4]=b.elements[3],w[5]=b.elements[4],w[6]=b.elements[5],w[7]=0,w[8]=b.elements[6],w[9]=b.elements[7],w[10]=b.elements[8],w[11]=0):ArrayBuffer.isView(b)?w.set(new b.constructor(b.buffer,b.byteOffset,w.length)):b.toArray(w,A)}function x(b,w,A,P){const v=b.value,T=w+"_"+A;if(P[T]===void 0)return typeof v=="number"||typeof v=="boolean"?P[T]=v:ArrayBuffer.isView(v)?P[T]=v.slice():P[T]=v.clone(),!0;{const I=P[T];if(typeof v=="number"||typeof v=="boolean"){if(I!==v)return P[T]=v,!0}else{if(ArrayBuffer.isView(v))return!0;if(I.equals(v)===!1)return I.copy(v),!0}}return!1}function m(b){const w=b.uniforms;let A=0;const P=16;for(let T=0,I=w.length;T<I;T++){const N=Array.isArray(w[T])?w[T]:[w[T]];for(let k=0,$=N.length;k<$;k++){const U=N[k],V=Array.isArray(U.value)?U.value:[U.value];for(let Q=0,X=V.length;Q<X;Q++){const ce=V[Q],j=p(ce),se=A%P,oe=se%j.boundary,Fe=se+oe;A+=oe,Fe!==0&&P-Fe<j.storage&&(A+=P-Fe),U.__data=new Float32Array(j.storage/Float32Array.BYTES_PER_ELEMENT),U.__offset=A,A+=j.storage}}}const v=A%P;return v>0&&(A+=P-v),b.__size=A,b.__cache={},this}function p(b){const w={boundary:0,storage:0};return typeof b=="number"||typeof b=="boolean"?(w.boundary=4,w.storage=4):b.isVector2?(w.boundary=8,w.storage=8):b.isVector3||b.isColor?(w.boundary=16,w.storage=12):b.isVector4?(w.boundary=16,w.storage=16):b.isMatrix3?(w.boundary=48,w.storage=48):b.isMatrix4?(w.boundary=64,w.storage=64):b.isTexture?Ge("WebGLRenderer: Texture samplers can not be part of an uniforms group."):ArrayBuffer.isView(b)?(w.boundary=16,w.storage=b.byteLength):Ge("WebGLRenderer: Unsupported uniform value type.",b),w}function E(b){const w=b.target;w.removeEventListener("dispose",E);const A=o.indexOf(w.__bindingPointIndex);o.splice(A,1),t.deleteBuffer(s[w.id]),delete s[w.id],delete r[w.id]}function L(){for(const b in s)t.deleteBuffer(s[b]);o=[],s={},r={}}return{bind:c,update:l,dispose:L}}const RI=new Uint16Array([12469,15057,12620,14925,13266,14620,13807,14376,14323,13990,14545,13625,14713,13328,14840,12882,14931,12528,14996,12233,15039,11829,15066,11525,15080,11295,15085,10976,15082,10705,15073,10495,13880,14564,13898,14542,13977,14430,14158,14124,14393,13732,14556,13410,14702,12996,14814,12596,14891,12291,14937,11834,14957,11489,14958,11194,14943,10803,14921,10506,14893,10278,14858,9960,14484,14039,14487,14025,14499,13941,14524,13740,14574,13468,14654,13106,14743,12678,14818,12344,14867,11893,14889,11509,14893,11180,14881,10751,14852,10428,14812,10128,14765,9754,14712,9466,14764,13480,14764,13475,14766,13440,14766,13347,14769,13070,14786,12713,14816,12387,14844,11957,14860,11549,14868,11215,14855,10751,14825,10403,14782,10044,14729,9651,14666,9352,14599,9029,14967,12835,14966,12831,14963,12804,14954,12723,14936,12564,14917,12347,14900,11958,14886,11569,14878,11247,14859,10765,14828,10401,14784,10011,14727,9600,14660,9289,14586,8893,14508,8533,15111,12234,15110,12234,15104,12216,15092,12156,15067,12010,15028,11776,14981,11500,14942,11205,14902,10752,14861,10393,14812,9991,14752,9570,14682,9252,14603,8808,14519,8445,14431,8145,15209,11449,15208,11451,15202,11451,15190,11438,15163,11384,15117,11274,15055,10979,14994,10648,14932,10343,14871,9936,14803,9532,14729,9218,14645,8742,14556,8381,14461,8020,14365,7603,15273,10603,15272,10607,15267,10619,15256,10631,15231,10614,15182,10535,15118,10389,15042,10167,14963,9787,14883,9447,14800,9115,14710,8665,14615,8318,14514,7911,14411,7507,14279,7198,15314,9675,15313,9683,15309,9712,15298,9759,15277,9797,15229,9773,15166,9668,15084,9487,14995,9274,14898,8910,14800,8539,14697,8234,14590,7790,14479,7409,14367,7067,14178,6621,15337,8619,15337,8631,15333,8677,15325,8769,15305,8871,15264,8940,15202,8909,15119,8775,15022,8565,14916,8328,14804,8009,14688,7614,14569,7287,14448,6888,14321,6483,14088,6171,15350,7402,15350,7419,15347,7480,15340,7613,15322,7804,15287,7973,15229,8057,15148,8012,15046,7846,14933,7611,14810,7357,14682,7069,14552,6656,14421,6316,14251,5948,14007,5528,15356,5942,15356,5977,15353,6119,15348,6294,15332,6551,15302,6824,15249,7044,15171,7122,15070,7050,14949,6861,14818,6611,14679,6349,14538,6067,14398,5651,14189,5311,13935,4958,15359,4123,15359,4153,15356,4296,15353,4646,15338,5160,15311,5508,15263,5829,15188,6042,15088,6094,14966,6001,14826,5796,14678,5543,14527,5287,14377,4985,14133,4586,13869,4257,15360,1563,15360,1642,15358,2076,15354,2636,15341,3350,15317,4019,15273,4429,15203,4732,15105,4911,14981,4932,14836,4818,14679,4621,14517,4386,14359,4156,14083,3795,13808,3437,15360,122,15360,137,15358,285,15355,636,15344,1274,15322,2177,15281,2765,15215,3223,15120,3451,14995,3569,14846,3567,14681,3466,14511,3305,14344,3121,14037,2800,13753,2467,15360,0,15360,1,15359,21,15355,89,15346,253,15325,479,15287,796,15225,1148,15133,1492,15008,1749,14856,1882,14685,1886,14506,1783,14324,1608,13996,1398,13702,1183]);let ai=null;function wI(){return ai===null&&(ai=new mw(RI,16,16,ys,pi),ai.name="DFG_LUT",ai.minFilter=pn,ai.magFilter=pn,ai.wrapS=Ci,ai.wrapT=Ci,ai.generateMipmaps=!1,ai.needsUpdate=!0),ai}class AI{constructor(e={}){const{canvas:n=CR(),context:i=null,depth:s=!0,stencil:r=!1,alpha:o=!1,antialias:a=!1,premultipliedAlpha:c=!0,preserveDrawingBuffer:l=!1,powerPreference:u="default",failIfMajorPerformanceCaveat:h=!1,reversedDepthBuffer:d=!1,outputBufferType:f=Hn}=e;this.isWebGLRenderer=!0;let _;if(i!==null){if(typeof WebGLRenderingContext<"u"&&i instanceof WebGLRenderingContext)throw new Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");_=i.getContextAttributes().alpha}else _=o;const x=f,m=new Set([pd,fd,hd]),p=new Set([Hn,fi,jr,Jr,ud,dd]),E=new Uint32Array(4),L=new Int32Array(4),b=new H;let w=null,A=null;const P=[],v=[];let T=null;this.domElement=n,this.debug={checkShaderErrors:!0,diagnostics:{keywords:!1},onShaderError:null},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.toneMapping=hi,this.toneMappingExposure=1,this.transmissionResolutionScale=1;const I=this;let N=!1,k=null,$=null,U=null,V=null;this._outputColorSpace=kn;let Q=0,X=0,ce=null,j=-1,se=null;const oe=new Ht,Fe=new Ht;let Le=null;const ft=new ot(0);let et=0,je=n.width,Y=n.height,re=1,Re=null,Ve=null;const Me=new Ht(0,0,je,Y),$e=new Ht(0,0,je,Y);let Ct=!1;const Ze=new Y_;let it=!1,_t=!1;const Je=new Gt,vt=new H,Ut=new Ht,qt={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};let bt=!1;function Pt(){return ce===null?re:1}let F=i;function zt(y,D){return n.getContext(y,D)}let lt,R,S,z,Z,K,le,de,J,ne,he,Ne,ue,me,Pe,ke,qe,O,fe,te,ge,ye,ie;try{const y={alpha:!0,depth:s,stencil:r,antialias:a,premultipliedAlpha:c,preserveDrawingBuffer:l,powerPreference:u,failIfMajorPerformanceCaveat:h};if("setAttribute"in n&&n.setAttribute("data-engine",`three.js r${cd}`),n.addEventListener("webglcontextlost",gt,!1),n.addEventListener("webglcontextrestored",at,!1),n.addEventListener("webglcontextcreationerror",nn,!1),F===null){const D="webgl2";if(F=zt(D,y),F===null)throw zt(D)?new Error("THREE.WebGLRenderer: Error creating WebGL context with your selected attributes."):new Error("THREE.WebGLRenderer: Error creating WebGL context.")}De()}catch(y){throw n.removeEventListener("webglcontextlost",gt,!1),n.removeEventListener("webglcontextrestored",at,!1),n.removeEventListener("webglcontextcreationerror",nn,!1),St("WebGLRenderer: "+y.message),y}function De(){lt=new wP(F),lt.init(),ge=new SI(F,lt),R=new _P(F,lt,e,ge),S=new gI(F,lt),R.reversedDepthBuffer&&d&&S.buffers.depth.setReversed(!0),$=F.createFramebuffer(),U=F.createFramebuffer(),V=F.createFramebuffer(),z=new PP(F),Z=new nI,K=new _I(F,lt,S,Z,R,ge,z),le=new RP(I),de=new Lw(F),ye=new mP(F,de),J=new AP(F,de,z,ye),ne=new LP(F,J,de,ye,z),O=new IP(F,R,K),Pe=new SP(Z),he=new tI(I,le,lt,R,ye,Pe),Ne=new EI(I,Z),ue=new sI,me=new uI(lt),qe=new pP(I,le,S,ne,_,c),ke=new mI(I,ne,R),ie=new TI(F,z,R,S),fe=new gP(F,lt,z),te=new CP(F,lt,z),z.programs=he.programs,I.capabilities=R,I.extensions=lt,I.properties=Z,I.renderLists=ue,I.shadowMap=ke,I.state=S,I.info=z}x!==Hn&&(T=new DP(x,n.width,n.height,a,s,r));const Ce=new bI(I,F);this.xr=Ce,this.getContext=function(){return F},this.getContextAttributes=function(){return F.getContextAttributes()},this.forceContextLoss=function(){const y=lt.get("WEBGL_lose_context");y&&y.loseContext()},this.forceContextRestore=function(){const y=lt.get("WEBGL_lose_context");y&&y.restoreContext()},this.getPixelRatio=function(){return re},this.setPixelRatio=function(y){y!==void 0&&(re=y,this.setSize(je,Y,!1))},this.getSize=function(y){return y.set(je,Y)},this.setSize=function(y,D,W=!0){if(Ce.isPresenting){Ge("WebGLRenderer: Can't change size while VR device is presenting.");return}je=y,Y=D,n.width=Math.floor(y*re),n.height=Math.floor(D*re),W===!0&&(n.style.width=y+"px",n.style.height=D+"px"),T!==null&&T.setSize(n.width,n.height),this.setViewport(0,0,y,D)},this.getDrawingBufferSize=function(y){return y.set(je*re,Y*re).floor()},this.setDrawingBufferSize=function(y,D,W){je=y,Y=D,re=W,n.width=Math.floor(y*W),n.height=Math.floor(D*W),this.setViewport(0,0,y,D)},this.setEffects=function(y){if(x===Hn){St("WebGLRenderer: setEffects() requires outputBufferType set to HalfFloatType or FloatType.");return}if(y){for(let D=0;D<y.length;D++)if(y[D].isOutputPass===!0){Ge("WebGLRenderer: OutputPass is not needed in setEffects(). Tone mapping and color space conversion are applied automatically.");break}}T.setEffects(y||[])},this.getCurrentViewport=function(y){return y.copy(oe)},this.getViewport=function(y){return y.copy(Me)},this.setViewport=function(y,D,W,B){y.isVector4?Me.set(y.x,y.y,y.z,y.w):Me.set(y,D,W,B),S.viewport(oe.copy(Me).multiplyScalar(re).round())},this.getScissor=function(y){return y.copy($e)},this.setScissor=function(y,D,W,B){y.isVector4?$e.set(y.x,y.y,y.z,y.w):$e.set(y,D,W,B),S.scissor(Fe.copy($e).multiplyScalar(re).round())},this.getScissorTest=function(){return Ct},this.setScissorTest=function(y){S.setScissorTest(Ct=y)},this.setOpaqueSort=function(y){Re=y},this.setTransparentSort=function(y){Ve=y},this.getClearColor=function(y){return y.copy(qe.getClearColor())},this.setClearColor=function(){qe.setClearColor(...arguments)},this.getClearAlpha=function(){return qe.getClearAlpha()},this.setClearAlpha=function(){qe.setClearAlpha(...arguments)},this.clear=function(y=!0,D=!0,W=!0){let B=0;if(y){let q=!1;if(ce!==null){const pe=ce.texture.format;q=m.has(pe)}if(q){const pe=ce.texture.type,Te=p.has(pe),ve=qe.getClearColor(),we=qe.getClearAlpha(),Ie=ve.r,Xe=ve.g,Qe=ve.b;Te?(E[0]=Ie,E[1]=Xe,E[2]=Qe,E[3]=we,F.clearBufferuiv(F.COLOR,0,E)):(L[0]=Ie,L[1]=Xe,L[2]=Qe,L[3]=we,F.clearBufferiv(F.COLOR,0,L))}else B|=F.COLOR_BUFFER_BIT}D&&(B|=F.DEPTH_BUFFER_BIT,this.state.buffers.depth.setMask(!0)),W&&(B|=F.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),B!==0&&F.clear(B)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.setNodesHandler=function(y){y.setRenderer(this),k=y},this.dispose=function(){n.removeEventListener("webglcontextlost",gt,!1),n.removeEventListener("webglcontextrestored",at,!1),n.removeEventListener("webglcontextcreationerror",nn,!1),qe.dispose(),ue.dispose(),me.dispose(),Z.dispose(),le.dispose(),ne.dispose(),ye.dispose(),ie.dispose(),he.dispose(),Ce.dispose(),Ce.removeEventListener("sessionstart",Ui),Ce.removeEventListener("sessionend",qn),Pn.stop()};function gt(y){y.preventDefault(),kh("WebGLRenderer: Context Lost."),N=!0}function at(){kh("WebGLRenderer: Context Restored."),N=!1;const y=z.autoReset,D=ke.enabled,W=ke.autoUpdate,B=ke.needsUpdate,q=ke.type;De(),z.autoReset=y,ke.enabled=D,ke.autoUpdate=W,ke.needsUpdate=B,ke.type=q}function nn(y){St("WebGLRenderer: A WebGL context could not be created. Reason: ",y.statusMessage)}function cn(y){const D=y.target;D.removeEventListener("dispose",cn),es(D)}function es(y){ts(y),Z.remove(y)}function ts(y){const D=Z.get(y).programs;D!==void 0&&(D.forEach(function(W){he.releaseProgram(W)}),y.isShaderMaterial&&he.releaseShaderCache(y))}this.renderBufferDirect=function(y,D,W,B,q,pe){D===null&&(D=qt);const Te=q.isMesh&&q.matrixWorld.determinantAffine()<0,ve=is(y,D,W,B,q);S.setMaterial(B,Te);let we=W.index,Ie=1;if(B.wireframe===!0){if(we=J.getWireframeAttribute(W),we===void 0)return;Ie=2}const Xe=W.drawRange,Qe=W.attributes.position;let Ae=Xe.start*Ie,ct=(Xe.start+Xe.count)*Ie;pe!==null&&(Ae=Math.max(Ae,pe.start*Ie),ct=Math.min(ct,(pe.start+pe.count)*Ie)),we!==null?(Ae=Math.max(Ae,0),ct=Math.min(ct,we.count)):Qe!=null&&(Ae=Math.max(Ae,0),ct=Math.min(ct,Qe.count));const Lt=ct-Ae;if(Lt<0||Lt===1/0)return;ye.setup(q,B,ve,W,we);let xt,pt=fe;if(we!==null&&(xt=de.get(we),pt=te,pt.setIndex(xt)),q.isMesh)B.wireframe===!0?(S.setLineWidth(B.wireframeLinewidth*Pt()),pt.setMode(F.LINES)):pt.setMode(F.TRIANGLES);else if(q.isLine){let Bt=B.linewidth;Bt===void 0&&(Bt=1),S.setLineWidth(Bt*Pt()),q.isLineSegments?pt.setMode(F.LINES):q.isLineLoop?pt.setMode(F.LINE_LOOP):pt.setMode(F.LINE_STRIP)}else q.isPoints?pt.setMode(F.POINTS):q.isSprite&&pt.setMode(F.TRIANGLES);if(q.isBatchedMesh)if(lt.get("WEBGL_multi_draw"))pt.renderMultiDraw(q._multiDrawStarts,q._multiDrawCounts,q._multiDrawCount);else{const Bt=q._multiDrawStarts,Ee=q._multiDrawCounts,$t=q._multiDrawCount,nt=we?de.get(we).bytesPerElement:1,Vt=Z.get(B).currentProgram.getUniforms();for(let Nt=0;Nt<$t;Nt++)Vt.setValue(F,"_gl_DrawID",Nt),pt.render(Bt[Nt]/nt,Ee[Nt])}else if(q.isInstancedMesh)pt.renderInstances(Ae,Lt,q.count);else if(W.isInstancedBufferGeometry){const Bt=W._maxInstanceCount!==void 0?W._maxInstanceCount:1/0,Ee=Math.min(W.instanceCount,Bt);pt.renderInstances(Ae,Lt,Ee)}else pt.render(Ae,Lt)};function Di(y,D,W,B){k!==null&&y.isNodeMaterial&&k.setObject(B,y),it===!0&&Pe.setState(y,W,!1),y.transparent===!0&&y.side===wi&&y.forceSinglePass===!1?(y.side=Rn,y.needsUpdate=!0,ni(y,D,B),y.side=vs,y.needsUpdate=!0,ni(y,D,B),y.side=wi):ni(y,D,B)}this.compile=function(y,D,W=null){W===null&&(W=y),k!==null&&k.renderStart(y,D,W),A=me.get(W),A.init(D),v.push(A),W.traverseVisible(function(q){q.isLight&&q.layers.test(D.layers)&&(A.pushLight(q),q.castShadow&&A.pushShadow(q))}),y!==W&&y.traverseVisible(function(q){q.isLight&&q.layers.test(D.layers)&&(A.pushLight(q),q.castShadow&&A.pushShadow(q))}),A.setupLights(),k!==null&&k.updateLights(A.state.lightsArray),_t=this.localClippingEnabled,it=Pe.init(this.clippingPlanes,_t),it===!0&&Pe.setGlobalState(this.clippingPlanes,D),k!==null&&ke.render(A.state.shadowsArray,W,D);const B=new Set;return y.traverse(function(q){if(!(q.isMesh||q.isPoints||q.isLine||q.isSprite))return;const pe=q.material;if(pe)if(Array.isArray(pe))for(let Te=0;Te<pe.length;Te++){const ve=pe[Te];Di(ve,W,D,q),B.add(ve)}else Di(pe,W,D,q),B.add(pe)}),A=v.pop(),k!==null&&k.renderEnd(),B},this.compileAsync=function(y,D,W=null){const B=this.compile(y,D,W);return new Promise(q=>{function pe(){if(B.forEach(function(Te){const we=Z.get(Te).currentProgram;(we===void 0||we.isReady())&&B.delete(Te)}),B.size===0){q(y);return}setTimeout(pe,10)}lt.get("KHR_parallel_shader_compile")!==null?pe():setTimeout(pe,10)})};let _i=null;function ws(y){_i&&_i(y)}function Ui(){Pn.stop()}function qn(){Pn.start()}const Pn=new tS;Pn.setAnimationLoop(ws),typeof self<"u"&&Pn.setContext(self),this.setAnimationLoop=function(y){_i=y,Ce.setAnimationLoop(y),y===null?Pn.stop():Pn.start()},Ce.addEventListener("sessionstart",Ui),Ce.addEventListener("sessionend",qn),this.render=function(y,D){if(D!==void 0&&D.isCamera!==!0){St("WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(N===!0)return;k!==null&&k.renderStart(y,D);const W=Ce.enabled===!0&&Ce.isPresenting===!0,B=T!==null&&(ce===null||W)&&T.begin(I,ce);if(y.matrixWorldAutoUpdate===!0&&y.updateMatrixWorld(),D.parent===null&&D.matrixWorldAutoUpdate===!0&&D.updateMatrixWorld(),Ce.enabled===!0&&Ce.isPresenting===!0&&(T===null||T.isCompositing()===!1)&&(Ce.cameraAutoUpdate===!0&&Ce.updateCamera(D),D=Ce.getCamera()),y.isScene===!0&&y.onBeforeRender(I,y,D,ce),A=me.get(y,v.length),A.init(D),A.state.textureUnits=K.getTextureUnits(),v.push(A),Je.multiplyMatrices(D.projectionMatrix,D.matrixWorldInverse),Ze.setFromProjectionMatrix(Je,di,D.reversedDepth),_t=this.localClippingEnabled,it=Pe.init(this.clippingPlanes,_t),w=ue.get(y,P.length),w.init(),P.push(w),Ce.enabled===!0&&Ce.isPresenting===!0){const Te=I.xr.getDepthSensingMesh();Te!==null&&Si(Te,D,-1/0,I.sortObjects)}Si(y,D,0,I.sortObjects),w.finish(),k!==null&&k.updateLights(A.state.lightsArray),I.sortObjects===!0&&w.sort(Re,Ve),bt=Ce.enabled===!1||Ce.isPresenting===!1||Ce.hasDepthSensing()===!1,bt&&qe.addToRenderList(w,y),this.info.render.frame++,this.info.autoReset===!0&&this.info.reset(),it===!0&&Pe.beginShadows();const q=A.state.shadowsArray;if(ke.render(q,y,D),it===!0&&Pe.endShadows(),(B&&T.hasRenderPass())===!1){const Te=w.opaque,ve=w.transmissive;if(A.setupLights(),D.isArrayCamera){const we=D.cameras;if(ve.length>0)for(let Ie=0,Xe=we.length;Ie<Xe;Ie++){const Qe=we[Ie];Fi(Te,ve,y,Qe)}bt&&qe.render(y);for(let Ie=0,Xe=we.length;Ie<Xe;Ie++){const Qe=we[Ie];Oi(w,y,Qe,Qe.viewport)}}else ve.length>0&&Fi(Te,ve,y,D),bt&&qe.render(y),Oi(w,y,D)}ce!==null&&X===0&&(K.updateMultisampleRenderTarget(ce),K.updateRenderTargetMipmap(ce)),B&&T.end(I),y.isScene===!0&&y.onAfterRender(I,y,D),ye.resetDefaultState(),j=-1,se=null,v.pop(),v.length>0?(A=v[v.length-1],K.setTextureUnits(A.state.textureUnits),it===!0&&Pe.setGlobalState(I.clippingPlanes,A.state.camera)):A=null,P.pop(),P.length>0?w=P[P.length-1]:w=null,k!==null&&k.renderEnd()};function Si(y,D,W,B){if(y.visible===!1)return;if(y.layers.test(D.layers)){if(y.isGroup)W=y.renderOrder;else if(y.isLOD)y.autoUpdate===!0&&y.update(D);else if(y.isLightProbeGrid)A.pushLightProbeGrid(y);else if(y.isLight)A.pushLight(y),y.castShadow&&A.pushShadow(y);else if(y.isSprite){if(!y.frustumCulled||y.intersectsFrustum(Ze)){B&&Ut.setFromMatrixPosition(y.matrixWorld).applyMatrix4(Je);const Te=ne.update(y),ve=y.material;ve.visible&&w.push(y,Te,ve,W,Ut.z,null,D)}}else if((y.isMesh||y.isLine||y.isPoints)&&(!y.frustumCulled||y.intersectsFrustum(Ze))){const Te=ne.update(y),ve=y.material;if(B&&(y.boundingSphere!==void 0?(y.boundingSphere===null&&y.computeBoundingSphere(),Ut.copy(y.boundingSphere.center)):(Te.boundingSphere===null&&Te.computeBoundingSphere(),Ut.copy(Te.boundingSphere.center)),Ut.applyMatrix4(y.matrixWorld).applyMatrix4(Je)),Array.isArray(ve)){const we=Te.groups;for(let Ie=0,Xe=we.length;Ie<Xe;Ie++){const Qe=we[Ie],Ae=ve[Qe.materialIndex];Ae&&Ae.visible&&w.push(y,Te,Ae,W,Ut.z,Qe,D)}}else ve.visible&&w.push(y,Te,ve,W,Ut.z,null,D)}}const pe=y.children;for(let Te=0,ve=pe.length;Te<ve;Te++)Si(pe[Te],D,W,B)}function Oi(y,D,W,B){const{opaque:q,transmissive:pe,transparent:Te}=y;A.setupLightsView(W),it===!0&&Pe.setGlobalState(I.clippingPlanes,W),B&&S.viewport(oe.copy(B)),q.length>0&&ti(q,D,W),pe.length>0&&ti(pe,D,W),Te.length>0&&ti(Te,D,W),S.buffers.depth.setTest(!0),S.buffers.depth.setMask(!0),S.buffers.color.setMask(!0),S.setPolygonOffset(!1)}function Fi(y,D,W,B){if((W.isScene===!0?W.overrideMaterial:null)!==null)return;if(A.state.transmissionRenderTarget[B.id]===void 0){const Ae=lt.has("EXT_color_buffer_half_float")||lt.has("EXT_color_buffer_float");A.state.transmissionRenderTarget[B.id]=new Kn(1,1,{generateMipmaps:!0,type:Ae?pi:Hn,minFilter:us,samples:Math.max(4,R.samples),stencilBuffer:r,resolveDepthBuffer:!1,resolveStencilBuffer:!1,storeMultisampledDepthBuffer:!1,storeMultisampledStencilBuffer:!1,colorSpace:dt.workingColorSpace})}const pe=A.state.transmissionRenderTarget[B.id],Te=B.viewport||oe;pe.setSize(Te.z*I.transmissionResolutionScale,Te.w*I.transmissionResolutionScale);const ve=I.getRenderTarget(),we=I.getActiveCubeFace(),Ie=I.getActiveMipmapLevel();I.setRenderTarget(pe),I.getClearColor(ft),et=I.getClearAlpha(),et<1&&I.setClearColor(16777215,.5),I.clear(),bt&&qe.render(W);const Xe=I.toneMapping;I.toneMapping=hi;const Qe=B.viewport;if(B.viewport!==void 0&&(B.viewport=void 0),A.setupLightsView(B),it===!0&&Pe.setGlobalState(I.clippingPlanes,B),ti(y,W,B),K.updateMultisampleRenderTarget(pe),K.updateRenderTargetMipmap(pe),lt.has("WEBGL_multisampled_render_to_texture")===!1){let Ae=!1;for(let ct=0,Lt=D.length;ct<Lt;ct++){const xt=D[ct],{object:pt,geometry:Bt,material:Ee,group:$t}=xt;if(Ee.side===wi&&pt.layers.test(B.layers)){const nt=Ee.side;Ee.side=Rn,Ee.needsUpdate=!0,ki(pt,W,B,Bt,Ee,$t),Ee.side=nt,Ee.needsUpdate=!0,Ae=!0}}Ae===!0&&(K.updateMultisampleRenderTarget(pe),K.updateRenderTargetMipmap(pe))}I.setRenderTarget(ve,we,Ie),I.setClearColor(ft,et),Qe!==void 0&&(B.viewport=Qe),I.toneMapping=Xe}function ti(y,D,W){const B=D.isScene===!0?D.overrideMaterial:null;for(let q=0,pe=y.length;q<pe;q++){const Te=y[q],{object:ve,geometry:we,group:Ie}=Te;let Xe=Te.material;Xe.allowOverride===!0&&B!==null&&(Xe=B),ve.layers.test(W.layers)&&ki(ve,D,W,we,Xe,Ie)}}function ki(y,D,W,B,q,pe){k!==null&&q.isNodeMaterial&&k.setObject(y,q),y.onBeforeRender(I,D,W,B,q,pe),y.modelViewMatrix.multiplyMatrices(W.matrixWorldInverse,y.matrixWorld),y.normalMatrix.getNormalMatrix(y.modelViewMatrix),q.onBeforeRender(I,D,W,B,y,pe),q.transparent===!0&&q.side===wi&&q.forceSinglePass===!1?(q.side=Rn,q.needsUpdate=!0,I.renderBufferDirect(W,D,B,q,y,pe),q.side=vs,q.needsUpdate=!0,I.renderBufferDirect(W,D,B,q,y,pe),q.side=wi):I.renderBufferDirect(W,D,B,q,y,pe),y.onAfterRender(I,D,W,B,q,pe)}function ni(y,D,W){D.isScene!==!0&&(D=qt);const B=Z.get(y),q=A.state.lights,pe=A.state.shadowsArray,Te=q.state.version,ve=he.getParameters(y,q.state,pe,D,W,A.state.lightProbeGridArray),we=he.getProgramCacheKey(ve);let Ie=B.programs;B.environment=y.isMeshStandardMaterial||y.isMeshLambertMaterial||y.isMeshPhongMaterial?D.environment:null,B.fog=D.fog;const Xe=y.isMeshStandardMaterial||y.isMeshLambertMaterial&&!y.envMap||y.isMeshPhongMaterial&&!y.envMap;B.envMap=le.get(y.envMap||B.environment,Xe),B.envMapRotation=B.environment!==null&&y.envMap===null?D.environmentRotation:y.envMapRotation,Ie===void 0&&(y.addEventListener("dispose",cn),Ie=new Map,B.programs=Ie);let Qe=Ie.get(we);if(Qe!==void 0){if(B.currentProgram===Qe&&B.lightsStateVersion===Te)return Bi(y,ve),Qe}else ve.uniforms=he.getUniforms(y),k!==null&&y.isNodeMaterial&&k.build(y,W,ve),y.onBeforeCompile(ve,I),Qe=he.acquireProgram(ve,we),Ie.set(we,Qe),B.uniforms=ve.uniforms;const Ae=B.uniforms;return(!y.isShaderMaterial&&!y.isRawShaderMaterial||y.clipping===!0)&&(Ae.clippingPlanes=Pe.uniform),Bi(y,ve),B.needsLights=vi(y),B.lightsStateVersion=Te,B.needsLights&&(Ae.ambientLightColor.value=q.state.ambient,Ae.lightProbe.value=q.state.probe,Ae.sunLights.value=q.state.sun,Ae.sunLightShadows.value=q.state.sunShadow,Ae.directionalLights.value=q.state.directional,Ae.directionalLightShadows.value=q.state.directionalShadow,Ae.spotLights.value=q.state.spot,Ae.spotLightShadows.value=q.state.spotShadow,Ae.rectAreaLights.value=q.state.rectArea,Ae.ltc_1.value=q.state.rectAreaLTC1,Ae.ltc_2.value=q.state.rectAreaLTC2,Ae.pointLights.value=q.state.point,Ae.pointLightShadows.value=q.state.pointShadow,Ae.hemisphereLights.value=q.state.hemi,Ae.sunShadowMatrix.value=q.state.sunShadowMatrix,Ae.sunShadowCascade.value=q.state.sunShadowCascade,Ae.directionalShadowMatrix.value=q.state.directionalShadowMatrix,Ae.spotLightMatrix.value=q.state.spotLightMatrix,Ae.spotLightMap.value=q.state.spotLightMap,Ae.pointShadowMatrix.value=q.state.pointShadowMatrix),B.lightProbeGrid=A.state.lightProbeGridArray.length>0,B.currentProgram=Qe,B.uniformsList=null,Qe}function zi(y){if(y.uniformsList===null){const D=y.currentProgram.getUniforms();y.uniformsList=ea.seqWithValue(D.seq,y.uniforms)}return y.uniformsList}function Bi(y,D){const W=Z.get(y);W.outputColorSpace=D.outputColorSpace,W.batching=D.batching,W.batchingColor=D.batchingColor,W.instancing=D.instancing,W.instancingColor=D.instancingColor,W.instancingMorph=D.instancingMorph,W.skinning=D.skinning,W.morphTargets=D.morphTargets,W.morphNormals=D.morphNormals,W.morphColors=D.morphColors,W.morphTargetsCount=D.morphTargetsCount,W.numClippingPlanes=D.numClippingPlanes,W.numIntersection=D.numClipIntersection,W.vertexAlphas=D.vertexAlphas,W.vertexTangents=D.vertexTangents,W.toneMapping=D.toneMapping}function ns(y,D){if(y.length===0)return null;if(y.length===1)return y[0].texture!==null?y[0]:null;b.setFromMatrixPosition(D.matrixWorld);for(let W=0,B=y.length;W<B;W++){const q=y[W];if(q.texture!==null&&q.boundingBox.containsPoint(b))return q}return null}function is(y,D,W,B,q){D.isScene!==!0&&(D=qt),K.resetTextureUnits();const pe=D.fog,Te=B.isMeshStandardMaterial||B.isMeshLambertMaterial||B.isMeshPhongMaterial?D.environment:null,ve=ce===null?I.outputColorSpace:ce.isXRRenderTarget===!0?ce.texture.colorSpace:dt.workingColorSpace,we=B.isMeshStandardMaterial||B.isMeshLambertMaterial&&!B.envMap||B.isMeshPhongMaterial&&!B.envMap,Ie=le.get(B.envMap||Te,we),Xe=B.vertexColors===!0&&!!W.attributes.color&&W.attributes.color.itemSize===4,Qe=!!W.attributes.tangent&&(!!B.normalMap||B.anisotropy>0),Ae=!!W.morphAttributes.position,ct=!!W.morphAttributes.normal,Lt=!!W.morphAttributes.color;let xt=hi;B.toneMapped&&(ce===null||ce.isXRRenderTarget===!0)&&(xt=I.toneMapping);const pt=W.morphAttributes.position||W.morphAttributes.normal||W.morphAttributes.color,Bt=pt!==void 0?pt.length:0,Ee=Z.get(B),$t=A.state.lights;if(it===!0&&(_t===!0||y!==se)){const yt=y===se&&B.id===j;Pe.setState(B,y,yt)}let nt=!1;B.version===Ee.__version?(Ee.needsLights&&Ee.lightsStateVersion!==$t.state.version||Ee.outputColorSpace!==ve||q.isBatchedMesh&&Ee.batching===!1||!q.isBatchedMesh&&Ee.batching===!0||q.isBatchedMesh&&Ee.batchingColor===!0&&q._colorsTexture===null||q.isBatchedMesh&&Ee.batchingColor===!1&&q._colorsTexture!==null||q.isInstancedMesh&&Ee.instancing===!1||!q.isInstancedMesh&&Ee.instancing===!0||q.isSkinnedMesh&&Ee.skinning===!1||!q.isSkinnedMesh&&Ee.skinning===!0||q.isInstancedMesh&&Ee.instancingColor===!0&&q.instanceColor===null||q.isInstancedMesh&&Ee.instancingColor===!1&&q.instanceColor!==null||q.isInstancedMesh&&Ee.instancingMorph===!0&&q.morphTexture===null||q.isInstancedMesh&&Ee.instancingMorph===!1&&q.morphTexture!==null||Ee.envMap!==Ie||B.fog===!0&&Ee.fog!==pe||Ee.numClippingPlanes!==void 0&&(Ee.numClippingPlanes!==Pe.numPlanes||Ee.numIntersection!==Pe.numIntersection)||Ee.vertexAlphas!==Xe||Ee.vertexTangents!==Qe||Ee.morphTargets!==Ae||Ee.morphNormals!==ct||Ee.morphColors!==Lt||Ee.toneMapping!==xt||Ee.morphTargetsCount!==Bt||!!Ee.lightProbeGrid!=A.state.lightProbeGridArray.length>0)&&(nt=!0):(nt=!0,Ee.__version=B.version);let Vt=Ee.currentProgram;nt===!0&&(Vt=ni(B,D,q),k&&B.isNodeMaterial&&k.onUpdateProgram(B,Vt,Ee));let Nt=!1,In=!1,En=!1;const ut=Vt.getUniforms(),Tt=Ee.uniforms;if(S.useProgram(Vt.program)&&(Nt=!0,In=!0,En=!0),B.id!==j&&(j=B.id,In=!0),Ee.needsLights){const yt=ns(A.state.lightProbeGridArray,q);Ee.lightProbeGrid!==yt&&(Ee.lightProbeGrid=yt,In=!0)}if(Nt||se!==y){S.buffers.depth.getReversed()&&y.reversedDepth!==!0&&(y._reversedDepth=!0,y.updateProjectionMatrix()),ut.setValue(F,"projectionMatrix",y.projectionMatrix),ut.setValue(F,"viewMatrix",y.matrixWorldInverse);const Ot=ut.map.cameraPosition;Ot!==void 0&&Ot.setValue(F,vt.setFromMatrixPosition(y.matrixWorld)),R.logarithmicDepthBuffer&&ut.setValue(F,"logDepthBufFC",2/(Math.log(y.far+1)/Math.LN2)),(B.isMeshPhongMaterial||B.isMeshToonMaterial||B.isMeshLambertMaterial||B.isMeshBasicMaterial||B.isMeshStandardMaterial||B.isShaderMaterial)&&ut.setValue(F,"isOrthographic",y.isOrthographicCamera===!0),se!==y&&(se=y,In=!0,En=!0)}if(Ee.needsLights&&($t.state.sunShadowMap.length>0&&ut.setValue(F,"sunShadowMap",$t.state.sunShadowMap,K),$t.state.directionalShadowMap.length>0&&ut.setValue(F,"directionalShadowMap",$t.state.directionalShadowMap,K),$t.state.spotShadowMap.length>0&&ut.setValue(F,"spotShadowMap",$t.state.spotShadowMap,K),$t.state.pointShadowMap.length>0&&ut.setValue(F,"pointShadowMap",$t.state.pointShadowMap,K)),q.isSkinnedMesh){ut.setOptional(F,q,"bindMatrix"),ut.setOptional(F,q,"bindMatrixInverse");const yt=q.skeleton;yt&&(yt.boneTexture===null&&yt.computeBoneTexture(),ut.setValue(F,"boneTexture",yt.boneTexture,K))}q.isBatchedMesh&&(ut.setOptional(F,q,"batchingTexture"),ut.setValue(F,"batchingTexture",q._matricesTexture,K),ut.setOptional(F,q,"batchingIdTexture"),ut.setValue(F,"batchingIdTexture",q._indirectTexture,K),ut.setOptional(F,q,"batchingColorTexture"),q._colorsTexture!==null&&ut.setValue(F,"batchingColorTexture",q._colorsTexture,K));const gn=W.morphAttributes;if((gn.position!==void 0||gn.normal!==void 0||gn.color!==void 0)&&O.update(q,W,Vt),(In||Ee.receiveShadow!==q.receiveShadow)&&(Ee.receiveShadow=q.receiveShadow,ut.setValue(F,"receiveShadow",q.receiveShadow)),(B.isMeshStandardMaterial||B.isMeshLambertMaterial||B.isMeshPhongMaterial)&&B.envMap===null&&D.environment!==null&&(Tt.envMapIntensity.value=D.environmentIntensity),Tt.dfgLUT!==void 0&&(Tt.dfgLUT.value=wI()),In){if(ut.setValue(F,"toneMappingExposure",I.toneMappingExposure),Ee.needsLights&&ss(Tt,En),pe&&B.fog===!0&&Ne.refreshFogUniforms(Tt,pe),Ne.refreshMaterialUniforms(Tt,B,re,Y,A.state.transmissionRenderTarget[y.id]),Ee.needsLights&&Ee.lightProbeGrid){const yt=Ee.lightProbeGrid;Tt.probesSH.value=yt.texture,Tt.probesMin.value.copy(yt.boundingBox.min),Tt.probesMax.value.copy(yt.boundingBox.max),Tt.probesResolution.value.copy(yt.resolution)}ea.upload(F,zi(Ee),Tt,K)}if(B.isShaderMaterial&&B.uniformsNeedUpdate===!0&&(ea.upload(F,zi(Ee),Tt,K),B.uniformsNeedUpdate=!1),B.isSpriteMaterial&&ut.setValue(F,"center",q.center),ut.setValue(F,"modelViewMatrix",q.modelViewMatrix),ut.setValue(F,"normalMatrix",q.normalMatrix),ut.setValue(F,"modelMatrix",q.matrixWorld),B.uniformsGroups!==void 0){const yt=B.uniformsGroups;for(let Ot=0,Rt=yt.length;Ot<Rt;Ot++){const si=yt[Ot];ie.update(si,Vt),ie.bind(si,Vt)}}return Vt}function ss(y,D){y.ambientLightColor.needsUpdate=D,y.lightProbe.needsUpdate=D,y.sunLights.needsUpdate=D,y.sunLightShadows.needsUpdate=D,y.directionalLights.needsUpdate=D,y.directionalLightShadows.needsUpdate=D,y.pointLights.needsUpdate=D,y.pointLightShadows.needsUpdate=D,y.spotLights.needsUpdate=D,y.spotLightShadows.needsUpdate=D,y.rectAreaLights.needsUpdate=D,y.hemisphereLights.needsUpdate=D}function vi(y){return y.isMeshLambertMaterial||y.isMeshToonMaterial||y.isMeshPhongMaterial||y.isMeshStandardMaterial||y.isShadowMaterial||y.isShaderMaterial&&y.lights===!0}this.getActiveCubeFace=function(){return Q},this.getActiveMipmapLevel=function(){return X},this.getRenderTarget=function(){return ce},this.setRenderTargetTextures=function(y,D,W){const B=Z.get(y);B.__autoAllocateDepthBuffer=y.resolveDepthBuffer===!1,B.__autoAllocateDepthBuffer===!1&&(B.__useRenderToTexture=!1),Z.get(y.texture).__webglTexture=D,Z.get(y.depthTexture).__webglTexture=B.__autoAllocateDepthBuffer?void 0:W,B.__hasExternalTextures=!0},this.setRenderTargetFramebuffer=function(y,D){const W=Z.get(y);W.__webglFramebuffer=D,W.__useDefaultFramebuffer=D===void 0},this.setRenderTarget=function(y,D=0,W=0){ce=y,Q=D,X=W;let B=null,q=!1,pe=!1;if(y){const ve=Z.get(y);if(ve.__useDefaultFramebuffer!==void 0){S.bindFramebuffer(F.FRAMEBUFFER,ve.__webglFramebuffer),oe.copy(y.viewport),Fe.copy(y.scissor),Le=y.scissorTest,S.viewport(oe),S.scissor(Fe),S.setScissorTest(Le),j=-1;return}else if(ve.__webglFramebuffer===void 0)K.setupRenderTarget(y);else if(ve.__hasExternalTextures)K.rebindTextures(y,Z.get(y.texture).__webglTexture,Z.get(y.depthTexture).__webglTexture);else if(y.depthBuffer){const Xe=y.depthTexture;if(ve.__boundDepthTexture!==Xe){if(Xe!==null&&Z.has(Xe)&&(y.width!==Xe.image.width||y.height!==Xe.image.height))throw new Error("THREE.WebGLRenderer: Attached DepthTexture is initialized to the incorrect size.");K.setupDepthRenderbuffer(y)}}const we=y.texture;(we.isData3DTexture||we.isDataArrayTexture||we.isCompressedArrayTexture)&&(pe=!0);const Ie=Z.get(y).__webglFramebuffer;y.isWebGLCubeRenderTarget?(Array.isArray(Ie[D])?B=Ie[D][W]:B=Ie[D],q=!0):y.samples>0&&K.useMultisampledRTT(y)===!1?B=Z.get(y).__webglMultisampledFramebuffer:Array.isArray(Ie)?B=Ie[W]:B=Ie,oe.copy(y.viewport),Fe.copy(y.scissor),Le=y.scissorTest}else oe.copy(Me).multiplyScalar(re).floor(),Fe.copy($e).multiplyScalar(re).floor(),Le=Ct;if(W!==0&&(B=$),S.bindFramebuffer(F.FRAMEBUFFER,B)&&S.drawBuffers(y,B),S.viewport(oe),S.scissor(Fe),S.setScissorTest(Le),q){const ve=Z.get(y.texture);F.framebufferTexture2D(F.FRAMEBUFFER,F.COLOR_ATTACHMENT0,F.TEXTURE_CUBE_MAP_POSITIVE_X+D,ve.__webglTexture,W)}else if(pe){const ve=D;for(let we=0;we<y.textures.length;we++){const Ie=Z.get(y.textures[we]);F.framebufferTextureLayer(F.FRAMEBUFFER,F.COLOR_ATTACHMENT0+we,Ie.__webglTexture,W,ve)}}else if(y!==null&&W!==0){const ve=Z.get(y.texture);F.framebufferTexture2D(F.FRAMEBUFFER,F.COLOR_ATTACHMENT0,F.TEXTURE_2D,ve.__webglTexture,W)}j=-1};function ii(y){const D=Z.get(y);return(D.__readFormat!==y.format||D.__readType!==y.type)&&(D.__readFormat=y.format,D.__readType=y.type,D.__formatReadable=R.textureFormatReadable(y.format),D.__typeReadable=R.textureTypeReadable(y.type)),D}this.readRenderTargetPixels=function(y,D,W,B,q,pe,Te,ve=0){if(!(y&&y.isWebGLRenderTarget)){St("WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let we=Z.get(y).__webglFramebuffer;if(y.isWebGLCubeRenderTarget&&Te!==void 0&&(we=we[Te]),we){S.bindFramebuffer(F.FRAMEBUFFER,we);try{const Ie=y.textures[ve],Xe=Ie.format,Qe=Ie.type;y.textures.length>1&&F.readBuffer(F.COLOR_ATTACHMENT0+ve);const Ae=ii(Ie);if(Ae.__formatReadable===!1){St("WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}if(Ae.__typeReadable===!1){St("WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}D>=0&&D<=y.width-B&&W>=0&&W<=y.height-q&&F.readPixels(D,W,B,q,ge.convert(Xe),ge.convert(Qe),pe)}finally{const Ie=ce!==null?Z.get(ce).__webglFramebuffer:null;S.bindFramebuffer(F.FRAMEBUFFER,Ie)}}},this.readRenderTargetPixelsAsync=async function(y,D,W,B,q,pe,Te,ve=0){if(!(y&&y.isWebGLRenderTarget))throw new Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let we=Z.get(y).__webglFramebuffer;if(y.isWebGLCubeRenderTarget&&Te!==void 0&&(we=we[Te]),we)if(D>=0&&D<=y.width-B&&W>=0&&W<=y.height-q){S.bindFramebuffer(F.FRAMEBUFFER,we);const Ie=y.textures[ve],Xe=Ie.format,Qe=Ie.type;y.textures.length>1&&F.readBuffer(F.COLOR_ATTACHMENT0+ve);const Ae=ii(Ie);if(Ae.__formatReadable===!1)throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(Ae.__typeReadable===!1)throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");const ct=F.createBuffer();F.bindBuffer(F.PIXEL_PACK_BUFFER,ct),F.bufferData(F.PIXEL_PACK_BUFFER,pe.byteLength,F.STREAM_READ),F.readPixels(D,W,B,q,ge.convert(Xe),ge.convert(Qe),0),F.bindBuffer(F.PIXEL_PACK_BUFFER,null);const Lt=ce!==null?Z.get(ce).__webglFramebuffer:null;S.bindFramebuffer(F.FRAMEBUFFER,Lt);const xt=F.fenceSync(F.SYNC_GPU_COMMANDS_COMPLETE,0);return F.flush(),await PR(F,xt,4),F.bindBuffer(F.PIXEL_PACK_BUFFER,ct),F.getBufferSubData(F.PIXEL_PACK_BUFFER,0,pe),F.bindBuffer(F.PIXEL_PACK_BUFFER,null),F.deleteBuffer(ct),F.deleteSync(xt),pe}else throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.")},this.copyFramebufferToTexture=function(y,D=null,W=0){const B=Math.pow(2,-W),q=Math.floor(y.image.width*B),pe=Math.floor(y.image.height*B),Te=D!==null?D.x:0,ve=D!==null?D.y:0;K.setTexture2D(y,0),F.copyTexSubImage2D(F.TEXTURE_2D,W,0,0,Te,ve,q,pe),S.unbindTexture()},this.copyTextureToTexture=function(y,D,W=null,B=null,q=0,pe=0){let Te,ve,we,Ie,Xe,Qe,Ae,ct,Lt;const xt=y.isCompressedTexture?y.mipmaps[pe]:y.image;if(W!==null)Te=W.max.x-W.min.x,ve=W.max.y-W.min.y,we=W.isBox3?W.max.z-W.min.z:1,Ie=W.min.x,Xe=W.min.y,Qe=W.isBox3?W.min.z:0;else{const Tt=Math.pow(2,-q);Te=Math.floor(xt.width*Tt),ve=Math.floor(xt.height*Tt),y.isDataArrayTexture?we=xt.depth:y.isData3DTexture?we=Math.floor(xt.depth*Tt):we=1,Ie=0,Xe=0,Qe=0}B!==null?(Ae=B.x,ct=B.y,Lt=B.z):(Ae=0,ct=0,Lt=0);const pt=ge.convert(D.format),Bt=ge.convert(D.type);let Ee;D.isData3DTexture?(K.setTexture3D(D,0),Ee=F.TEXTURE_3D):D.isDataArrayTexture||D.isCompressedArrayTexture?(K.setTexture2DArray(D,0),Ee=F.TEXTURE_2D_ARRAY):(K.setTexture2D(D,0),Ee=F.TEXTURE_2D),S.activeTexture(F.TEXTURE0),S.pixelStorei(F.UNPACK_FLIP_Y_WEBGL,D.flipY),S.pixelStorei(F.UNPACK_PREMULTIPLY_ALPHA_WEBGL,D.premultiplyAlpha),S.pixelStorei(F.UNPACK_ALIGNMENT,D.unpackAlignment);const $t=S.getParameter(F.UNPACK_ROW_LENGTH),nt=S.getParameter(F.UNPACK_IMAGE_HEIGHT),Vt=S.getParameter(F.UNPACK_SKIP_PIXELS),Nt=S.getParameter(F.UNPACK_SKIP_ROWS),In=S.getParameter(F.UNPACK_SKIP_IMAGES);S.pixelStorei(F.UNPACK_ROW_LENGTH,xt.width),S.pixelStorei(F.UNPACK_IMAGE_HEIGHT,xt.height),S.pixelStorei(F.UNPACK_SKIP_PIXELS,Ie),S.pixelStorei(F.UNPACK_SKIP_ROWS,Xe),S.pixelStorei(F.UNPACK_SKIP_IMAGES,Qe);const En=y.isDataArrayTexture||y.isData3DTexture,ut=D.isDataArrayTexture||D.isData3DTexture;if(y.isDepthTexture){const Tt=Z.get(y),gn=Z.get(D),yt=Z.get(Tt.__renderTarget),Ot=Z.get(gn.__renderTarget);S.bindFramebuffer(F.READ_FRAMEBUFFER,yt.__webglFramebuffer),S.bindFramebuffer(F.DRAW_FRAMEBUFFER,Ot.__webglFramebuffer);for(let Rt=0;Rt<we;Rt++)En&&(F.framebufferTextureLayer(F.READ_FRAMEBUFFER,F.COLOR_ATTACHMENT0,Z.get(y).__webglTexture,q,Qe+Rt),F.framebufferTextureLayer(F.DRAW_FRAMEBUFFER,F.COLOR_ATTACHMENT0,Z.get(D).__webglTexture,pe,Lt+Rt)),F.blitFramebuffer(Ie,Xe,Te,ve,Ae,ct,Te,ve,F.DEPTH_BUFFER_BIT,F.NEAREST);S.bindFramebuffer(F.READ_FRAMEBUFFER,null),S.bindFramebuffer(F.DRAW_FRAMEBUFFER,null)}else if(q!==0||y.isRenderTargetTexture||Z.has(y)){const Tt=Z.get(y),gn=Z.get(D);S.bindFramebuffer(F.READ_FRAMEBUFFER,U),S.bindFramebuffer(F.DRAW_FRAMEBUFFER,V);for(let yt=0;yt<we;yt++)En?F.framebufferTextureLayer(F.READ_FRAMEBUFFER,F.COLOR_ATTACHMENT0,Tt.__webglTexture,q,Qe+yt):F.framebufferTexture2D(F.READ_FRAMEBUFFER,F.COLOR_ATTACHMENT0,F.TEXTURE_2D,Tt.__webglTexture,q),ut?F.framebufferTextureLayer(F.DRAW_FRAMEBUFFER,F.COLOR_ATTACHMENT0,gn.__webglTexture,pe,Lt+yt):F.framebufferTexture2D(F.DRAW_FRAMEBUFFER,F.COLOR_ATTACHMENT0,F.TEXTURE_2D,gn.__webglTexture,pe),q!==0?F.blitFramebuffer(Ie,Xe,Te,ve,Ae,ct,Te,ve,F.COLOR_BUFFER_BIT,F.NEAREST):ut?F.copyTexSubImage3D(Ee,pe,Ae,ct,Lt+yt,Ie,Xe,Te,ve):F.copyTexSubImage2D(Ee,pe,Ae,ct,Ie,Xe,Te,ve);S.bindFramebuffer(F.READ_FRAMEBUFFER,null),S.bindFramebuffer(F.DRAW_FRAMEBUFFER,null)}else ut?y.isDataTexture||y.isData3DTexture?F.texSubImage3D(Ee,pe,Ae,ct,Lt,Te,ve,we,pt,Bt,xt.data):D.isCompressedArrayTexture?F.compressedTexSubImage3D(Ee,pe,Ae,ct,Lt,Te,ve,we,pt,xt.data):F.texSubImage3D(Ee,pe,Ae,ct,Lt,Te,ve,we,pt,Bt,xt):y.isDataTexture?F.texSubImage2D(F.TEXTURE_2D,pe,Ae,ct,Te,ve,pt,Bt,xt.data):y.isCompressedTexture?F.compressedTexSubImage2D(F.TEXTURE_2D,pe,Ae,ct,xt.width,xt.height,pt,xt.data):F.texSubImage2D(F.TEXTURE_2D,pe,Ae,ct,Te,ve,pt,Bt,xt);S.pixelStorei(F.UNPACK_ROW_LENGTH,$t),S.pixelStorei(F.UNPACK_IMAGE_HEIGHT,nt),S.pixelStorei(F.UNPACK_SKIP_PIXELS,Vt),S.pixelStorei(F.UNPACK_SKIP_ROWS,Nt),S.pixelStorei(F.UNPACK_SKIP_IMAGES,In),pe===0&&D.generateMipmaps&&F.generateMipmap(Ee),S.unbindTexture()},this.initRenderTarget=function(y){Z.get(y).__webglFramebuffer===void 0&&K.setupRenderTarget(y)},this.initTexture=function(y){y.isCubeTexture?K.setTextureCube(y,0):y.isData3DTexture?K.setTexture3D(y,0):y.isDataArrayTexture||y.isCompressedArrayTexture?K.setTexture2DArray(y,0):K.setTexture2D(y,0),S.unbindTexture()},this.resetState=function(){Q=0,X=0,ce=null,S.reset(),ye.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return di}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(e){this._outputColorSpace=e;const n=this.getContext();n.drawingBufferColorSpace=dt._getDrawingBufferColorSpace(e),n.unpackColorSpace=dt._getUnpackColorSpace()}}const Nf={type:"change"},yd={type:"start"},lS={type:"end"},Wo=new vd,Df=new Ri,CI=Math.cos(70*G_.DEG2RAD),Kt=new H,Tn=2*Math.PI,Et={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6},Kc=1e-6;class PI extends Pw{constructor(e,n=null){super(e,n),this.state=Et.NONE,this.target=new H,this.cursor=new H,this.minDistance=0,this.maxDistance=1/0,this.minZoom=0,this.maxZoom=1/0,this.minTargetRadius=0,this.maxTargetRadius=1/0,this.minPolarAngle=0,this.maxPolarAngle=Math.PI,this.minAzimuthAngle=-1/0,this.maxAzimuthAngle=1/0,this.enableDamping=!1,this.dampingFactor=.05,this.enableZoom=!0,this.zoomSpeed=1,this.enableRotate=!0,this.rotateSpeed=1,this.keyRotateSpeed=1,this.enablePan=!0,this.panSpeed=1,this.screenSpacePanning=!0,this.keyPanSpeed=7,this.zoomToCursor=!1,this.autoRotate=!1,this.autoRotateSpeed=2,this.keys={LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",BOTTOM:"ArrowDown"},this.mouseButtons={LEFT:Ws.ROTATE,MIDDLE:Ws.DOLLY,RIGHT:Ws.PAN},this.touches={ONE:qs.ROTATE,TWO:qs.DOLLY_PAN},this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object.zoom,this._cursorStyle="auto",this._domElementKeyEvents=null,this._lastPosition=new H,this._lastQuaternion=new ji,this._lastTargetPosition=new H,this._quat=new ji().setFromUnitVectors(e.up,new H(0,1,0)),this._quatInverse=this._quat.clone().invert(),this._spherical=new cf,this._sphericalDelta=new cf,this._scale=1,this._panOffset=new H,this._rotateStart=new Ke,this._rotateEnd=new Ke,this._rotateDelta=new Ke,this._panStart=new Ke,this._panEnd=new Ke,this._panDelta=new Ke,this._dollyStart=new Ke,this._dollyEnd=new Ke,this._dollyDelta=new Ke,this._dollyDirection=new H,this._mouse=new Ke,this._performCursorZoom=!1,this._pointers=[],this._pointerPositions={},this._controlActive=!1,this._onPointerMove=LI.bind(this),this._onPointerDown=II.bind(this),this._onPointerUp=NI.bind(this),this._onContextMenu=BI.bind(this),this._onMouseWheel=OI.bind(this),this._onKeyDown=FI.bind(this),this._onTouchStart=kI.bind(this),this._onTouchMove=zI.bind(this),this._onMouseDown=DI.bind(this),this._onMouseMove=UI.bind(this),this._interceptControlDown=HI.bind(this),this._interceptControlUp=VI.bind(this),this.domElement!==null&&this.connect(this.domElement),this.update()}set cursorStyle(e){this._cursorStyle=e,e==="grab"?this.domElement.style.cursor="grab":this.domElement.style.cursor="auto"}get cursorStyle(){return this._cursorStyle}connect(e){super.connect(e),this.domElement.addEventListener("pointerdown",this._onPointerDown),this.domElement.addEventListener("pointercancel",this._onPointerUp),this.domElement.addEventListener("contextmenu",this._onContextMenu),this.domElement.addEventListener("wheel",this._onMouseWheel,{passive:!1}),this.domElement.getRootNode().addEventListener("keydown",this._interceptControlDown,{passive:!0,capture:!0}),this.domElement.style.touchAction="none"}disconnect(){this.state=Et.NONE,this.domElement.removeEventListener("pointerdown",this._onPointerDown),this.domElement.ownerDocument.removeEventListener("pointermove",this._onPointerMove),this.domElement.ownerDocument.removeEventListener("pointerup",this._onPointerUp),this.domElement.removeEventListener("pointercancel",this._onPointerUp),this.domElement.removeEventListener("wheel",this._onMouseWheel),this.domElement.removeEventListener("contextmenu",this._onContextMenu),this.stopListenToKeyEvents();const e=this.domElement.getRootNode();e.removeEventListener("keydown",this._interceptControlDown,{capture:!0}),e.removeEventListener("keyup",this._interceptControlUp,{capture:!0}),this._controlActive=!1,this._pointers.length=0,this._pointerPositions={},this.domElement.style.touchAction="",this.domElement.style.cursor="auto"}dispose(){this.disconnect()}getPolarAngle(){return this._spherical.phi}getAzimuthalAngle(){return this._spherical.theta}getDistance(){return this.object.position.distanceTo(this.target)}listenToKeyEvents(e){e.addEventListener("keydown",this._onKeyDown),this._domElementKeyEvents=e}stopListenToKeyEvents(){this._domElementKeyEvents!==null&&(this._domElementKeyEvents.removeEventListener("keydown",this._onKeyDown),this._domElementKeyEvents=null)}saveState(){this.target0.copy(this.target),this.position0.copy(this.object.position),this.zoom0=this.object.zoom}reset(){this.target.copy(this.target0),this.object.position.copy(this.position0),this.object.zoom=this.zoom0,this.object.updateProjectionMatrix(),this.dispatchEvent(Nf),this.update(),this.state=Et.NONE}pan(e,n){this._pan(e,n),this.update()}dollyIn(e){this._dollyIn(e),this.update()}dollyOut(e){this._dollyOut(e),this.update()}rotateLeft(e){this._rotateLeft(e),this.update()}rotateUp(e){this._rotateUp(e),this.update()}update(e=null){const n=this.object.position;Kt.copy(n).sub(this.target),Kt.applyQuaternion(this._quat),this._spherical.setFromVector3(Kt),this.autoRotate&&this.state===Et.NONE&&this._rotateLeft(this._getAutoRotationAngle(e)),this.enableDamping?(this._spherical.theta+=this._sphericalDelta.theta*this.dampingFactor,this._spherical.phi+=this._sphericalDelta.phi*this.dampingFactor):(this._spherical.theta+=this._sphericalDelta.theta,this._spherical.phi+=this._sphericalDelta.phi);let i=this.minAzimuthAngle,s=this.maxAzimuthAngle;isFinite(i)&&isFinite(s)&&(i<-Math.PI?i+=Tn:i>Math.PI&&(i-=Tn),s<-Math.PI?s+=Tn:s>Math.PI&&(s-=Tn),i<=s?this._spherical.theta=Math.max(i,Math.min(s,this._spherical.theta)):this._spherical.theta=this._spherical.theta>(i+s)/2?Math.max(i,this._spherical.theta):Math.min(s,this._spherical.theta)),this._spherical.phi=Math.max(this.minPolarAngle,Math.min(this.maxPolarAngle,this._spherical.phi)),this._spherical.makeSafe(),this.enableDamping===!0?this.target.addScaledVector(this._panOffset,this.dampingFactor):this.target.add(this._panOffset),this.target.sub(this.cursor),this.target.clampLength(this.minTargetRadius,this.maxTargetRadius),this.target.add(this.cursor);let r=!1;if(this.zoomToCursor&&this._performCursorZoom||this.object.isOrthographicCamera)this._spherical.radius=this._clampDistance(this._spherical.radius);else{const o=this._spherical.radius;this._spherical.radius=this._clampDistance(this._spherical.radius*this._scale),r=o!=this._spherical.radius}if(Kt.setFromSpherical(this._spherical),Kt.applyQuaternion(this._quatInverse),n.copy(this.target).add(Kt),this.object.lookAt(this.target),this.enableDamping===!0?(this._sphericalDelta.theta*=1-this.dampingFactor,this._sphericalDelta.phi*=1-this.dampingFactor,this._panOffset.multiplyScalar(1-this.dampingFactor)):(this._sphericalDelta.set(0,0,0),this._panOffset.set(0,0,0)),this.zoomToCursor&&this._performCursorZoom){let o=null;if(this.object.isPerspectiveCamera){const a=Kt.length();o=this._clampDistance(a*this._scale);const c=a-o;this.object.position.addScaledVector(this._dollyDirection,c),this.object.updateMatrixWorld(),r=!!c}else if(this.object.isOrthographicCamera){const a=new H(this._mouse.x,this._mouse.y,0);a.unproject(this.object);const c=this.object.zoom;this.object.zoom=Math.max(this.minZoom,Math.min(this.maxZoom,this.object.zoom/this._scale)),this.object.updateProjectionMatrix(),r=c!==this.object.zoom;const l=new H(this._mouse.x,this._mouse.y,0);l.unproject(this.object),this.object.position.sub(l).add(a),this.object.updateMatrixWorld(),o=Kt.length()}else console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."),this.zoomToCursor=!1;o!==null&&(this.screenSpacePanning?this.target.set(0,0,-1).transformDirection(this.object.matrix).multiplyScalar(o).add(this.object.position):(Wo.origin.copy(this.object.position),Wo.direction.set(0,0,-1).transformDirection(this.object.matrix),Math.abs(this.object.up.dot(Wo.direction))<CI?this.object.lookAt(this.target):(Df.setFromNormalAndCoplanarPoint(this.object.up,this.target),Wo.intersectPlane(Df,this.target))))}else if(this.object.isOrthographicCamera){const o=this.object.zoom;this.object.zoom=Math.max(this.minZoom,Math.min(this.maxZoom,this.object.zoom/this._scale)),o!==this.object.zoom&&(this.object.updateProjectionMatrix(),r=!0)}return this._scale=1,this._performCursorZoom=!1,r||this._lastPosition.distanceToSquared(this.object.position)>Kc||8*(1-this._lastQuaternion.dot(this.object.quaternion))>Kc||this._lastTargetPosition.distanceToSquared(this.target)>Kc?(this.dispatchEvent(Nf),this._lastPosition.copy(this.object.position),this._lastQuaternion.copy(this.object.quaternion),this._lastTargetPosition.copy(this.target),!0):!1}_getAutoRotationAngle(e){return e!==null?Tn/60*this.autoRotateSpeed*e:Tn/60/60*this.autoRotateSpeed}_getZoomScale(e){const n=Math.abs(e*.01);return Math.pow(.95,this.zoomSpeed*n)}_rotateLeft(e){this._sphericalDelta.theta-=e}_rotateUp(e){this._sphericalDelta.phi-=e}_panLeft(e,n){Kt.setFromMatrixColumn(n,0),Kt.multiplyScalar(-e),this._panOffset.add(Kt)}_panUp(e,n){this.screenSpacePanning===!0?Kt.setFromMatrixColumn(n,1):(Kt.setFromMatrixColumn(n,0),Kt.crossVectors(this.object.up,Kt)),Kt.multiplyScalar(e),this._panOffset.add(Kt)}_pan(e,n){const i=this.domElement;if(this.object.isPerspectiveCamera){const s=this.object.position;Kt.copy(s).sub(this.target);let r=Kt.length();r*=Math.tan(this.object.fov/2*Math.PI/180),this._panLeft(2*e*r/i.clientHeight,this.object.matrix),this._panUp(2*n*r/i.clientHeight,this.object.matrix)}else this.object.isOrthographicCamera?(this._panLeft(e*(this.object.right-this.object.left)/this.object.zoom/i.clientWidth,this.object.matrix),this._panUp(n*(this.object.top-this.object.bottom)/this.object.zoom/i.clientHeight,this.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),this.enablePan=!1)}_dollyOut(e){this.object.isPerspectiveCamera||this.object.isOrthographicCamera?this._scale/=e:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),this.enableZoom=!1)}_dollyIn(e){this.object.isPerspectiveCamera||this.object.isOrthographicCamera?this._scale*=e:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),this.enableZoom=!1)}_updateZoomParameters(e,n){if(!this.zoomToCursor)return;this._performCursorZoom=!0;const i=this.domElement.getBoundingClientRect(),s=e-i.left,r=n-i.top,o=i.width,a=i.height;this._mouse.x=s/o*2-1,this._mouse.y=-(r/a)*2+1,this._dollyDirection.set(this._mouse.x,this._mouse.y,1).unproject(this.object).sub(this.object.position).normalize()}_clampDistance(e){return Math.max(this.minDistance,Math.min(this.maxDistance,e))}_handleMouseDownRotate(e){this._rotateStart.set(e.clientX,e.clientY)}_handleMouseDownDolly(e){this._updateZoomParameters(e.clientX,e.clientX),this._dollyStart.set(e.clientX,e.clientY)}_handleMouseDownPan(e){this._panStart.set(e.clientX,e.clientY)}_handleMouseMoveRotate(e){this._rotateEnd.set(e.clientX,e.clientY),this._rotateDelta.subVectors(this._rotateEnd,this._rotateStart).multiplyScalar(this.rotateSpeed);const n=this.domElement;this._rotateLeft(Tn*this._rotateDelta.x/n.clientHeight),this._rotateUp(Tn*this._rotateDelta.y/n.clientHeight),this._rotateStart.copy(this._rotateEnd),this.update()}_handleMouseMoveDolly(e){this._dollyEnd.set(e.clientX,e.clientY),this._dollyDelta.subVectors(this._dollyEnd,this._dollyStart),this._dollyDelta.y>0?this._dollyOut(this._getZoomScale(this._dollyDelta.y)):this._dollyDelta.y<0&&this._dollyIn(this._getZoomScale(this._dollyDelta.y)),this._dollyStart.copy(this._dollyEnd),this.update()}_handleMouseMovePan(e){this._panEnd.set(e.clientX,e.clientY),this._panDelta.subVectors(this._panEnd,this._panStart).multiplyScalar(this.panSpeed),this._pan(this._panDelta.x,this._panDelta.y),this._panStart.copy(this._panEnd),this.update()}_handleMouseWheel(e){this._updateZoomParameters(e.clientX,e.clientY),e.deltaY<0?this._dollyIn(this._getZoomScale(e.deltaY)):e.deltaY>0&&this._dollyOut(this._getZoomScale(e.deltaY)),this.update()}_handleKeyDown(e){let n=!1;switch(e.code){case this.keys.UP:e.ctrlKey||e.metaKey||e.shiftKey?this.enableRotate&&this._rotateUp(Tn*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(0,this.keyPanSpeed),n=!0;break;case this.keys.BOTTOM:e.ctrlKey||e.metaKey||e.shiftKey?this.enableRotate&&this._rotateUp(-Tn*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(0,-this.keyPanSpeed),n=!0;break;case this.keys.LEFT:e.ctrlKey||e.metaKey||e.shiftKey?this.enableRotate&&this._rotateLeft(Tn*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(this.keyPanSpeed,0),n=!0;break;case this.keys.RIGHT:e.ctrlKey||e.metaKey||e.shiftKey?this.enableRotate&&this._rotateLeft(-Tn*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(-this.keyPanSpeed,0),n=!0;break}n&&(e.preventDefault(),this.update())}_handleTouchStartRotate(e){if(this._pointers.length===1)this._rotateStart.set(e.pageX,e.pageY);else{const n=this._getSecondPointerPosition(e),i=.5*(e.pageX+n.x),s=.5*(e.pageY+n.y);this._rotateStart.set(i,s)}}_handleTouchStartPan(e){if(this._pointers.length===1)this._panStart.set(e.pageX,e.pageY);else{const n=this._getSecondPointerPosition(e),i=.5*(e.pageX+n.x),s=.5*(e.pageY+n.y);this._panStart.set(i,s)}}_handleTouchStartDolly(e){const n=this._getSecondPointerPosition(e),i=e.pageX-n.x,s=e.pageY-n.y,r=Math.sqrt(i*i+s*s);this._dollyStart.set(0,r)}_handleTouchStartDollyPan(e){this.enableZoom&&this._handleTouchStartDolly(e),this.enablePan&&this._handleTouchStartPan(e)}_handleTouchStartDollyRotate(e){this.enableZoom&&this._handleTouchStartDolly(e),this.enableRotate&&this._handleTouchStartRotate(e)}_handleTouchMoveRotate(e){if(this._pointers.length==1)this._rotateEnd.set(e.pageX,e.pageY);else{const i=this._getSecondPointerPosition(e),s=.5*(e.pageX+i.x),r=.5*(e.pageY+i.y);this._rotateEnd.set(s,r)}this._rotateDelta.subVectors(this._rotateEnd,this._rotateStart).multiplyScalar(this.rotateSpeed);const n=this.domElement;this._rotateLeft(Tn*this._rotateDelta.x/n.clientHeight),this._rotateUp(Tn*this._rotateDelta.y/n.clientHeight),this._rotateStart.copy(this._rotateEnd)}_handleTouchMovePan(e){if(this._pointers.length===1)this._panEnd.set(e.pageX,e.pageY);else{const n=this._getSecondPointerPosition(e),i=.5*(e.pageX+n.x),s=.5*(e.pageY+n.y);this._panEnd.set(i,s)}this._panDelta.subVectors(this._panEnd,this._panStart).multiplyScalar(this.panSpeed),this._pan(this._panDelta.x,this._panDelta.y),this._panStart.copy(this._panEnd)}_handleTouchMoveDolly(e){const n=this._getSecondPointerPosition(e),i=e.pageX-n.x,s=e.pageY-n.y,r=Math.sqrt(i*i+s*s);this._dollyEnd.set(0,r),this._dollyDelta.set(0,Math.pow(this._dollyEnd.y/this._dollyStart.y,this.zoomSpeed)),this._dollyOut(this._dollyDelta.y),this._dollyStart.copy(this._dollyEnd);const o=(e.pageX+n.x)*.5,a=(e.pageY+n.y)*.5;this._updateZoomParameters(o,a)}_handleTouchMoveDollyPan(e){this.enableZoom&&this._handleTouchMoveDolly(e),this.enablePan&&this._handleTouchMovePan(e)}_handleTouchMoveDollyRotate(e){this.enableZoom&&this._handleTouchMoveDolly(e),this.enableRotate&&this._handleTouchMoveRotate(e)}_addPointer(e){this._pointers.push(e.pointerId)}_removePointer(e){delete this._pointerPositions[e.pointerId];for(let n=0;n<this._pointers.length;n++)if(this._pointers[n]==e.pointerId){this._pointers.splice(n,1);return}}_isTrackingPointer(e){for(let n=0;n<this._pointers.length;n++)if(this._pointers[n]==e.pointerId)return!0;return!1}_trackPointer(e){let n=this._pointerPositions[e.pointerId];n===void 0&&(n=new Ke,this._pointerPositions[e.pointerId]=n),n.set(e.pageX,e.pageY)}_getSecondPointerPosition(e){const n=e.pointerId===this._pointers[0]?this._pointers[1]:this._pointers[0];return this._pointerPositions[n]}_customWheelEvent(e){const n=e.deltaMode,i={clientX:e.clientX,clientY:e.clientY,deltaY:e.deltaY};switch(n){case 1:i.deltaY*=16;break;case 2:i.deltaY*=100;break}return e.ctrlKey&&!this._controlActive&&(i.deltaY*=10),i}}function II(t){this.enabled!==!1&&(this._pointers.length===0&&(this.domElement.setPointerCapture(t.pointerId),this.domElement.ownerDocument.addEventListener("pointermove",this._onPointerMove),this.domElement.ownerDocument.addEventListener("pointerup",this._onPointerUp)),!this._isTrackingPointer(t)&&(this._addPointer(t),t.pointerType==="touch"?this._onTouchStart(t):this._onMouseDown(t),this._cursorStyle==="grab"&&(this.domElement.style.cursor="grabbing")))}function LI(t){this.enabled!==!1&&(t.pointerType==="touch"?this._onTouchMove(t):this._onMouseMove(t))}function NI(t){switch(this._removePointer(t),this._pointers.length){case 0:this.domElement.releasePointerCapture(t.pointerId),this.domElement.ownerDocument.removeEventListener("pointermove",this._onPointerMove),this.domElement.ownerDocument.removeEventListener("pointerup",this._onPointerUp),this.dispatchEvent(lS),this.state=Et.NONE,this._cursorStyle==="grab"&&(this.domElement.style.cursor="grab");break;case 1:const e=this._pointers[0],n=this._pointerPositions[e];this._onTouchStart({pointerId:e,pageX:n.x,pageY:n.y});break}}function DI(t){let e;switch(t.button){case 0:e=this.mouseButtons.LEFT;break;case 1:e=this.mouseButtons.MIDDLE;break;case 2:e=this.mouseButtons.RIGHT;break;default:e=-1}switch(e){case Ws.DOLLY:if(this.enableZoom===!1)return;this._handleMouseDownDolly(t),this.state=Et.DOLLY;break;case Ws.ROTATE:if(t.ctrlKey||t.metaKey||t.shiftKey){if(this.enablePan===!1)return;this._handleMouseDownPan(t),this.state=Et.PAN}else{if(this.enableRotate===!1)return;this._handleMouseDownRotate(t),this.state=Et.ROTATE}break;case Ws.PAN:if(t.ctrlKey||t.metaKey||t.shiftKey){if(this.enableRotate===!1)return;this._handleMouseDownRotate(t),this.state=Et.ROTATE}else{if(this.enablePan===!1)return;this._handleMouseDownPan(t),this.state=Et.PAN}break;default:this.state=Et.NONE}this.state!==Et.NONE&&this.dispatchEvent(yd)}function UI(t){switch(this.state){case Et.ROTATE:if(this.enableRotate===!1)return;this._handleMouseMoveRotate(t);break;case Et.DOLLY:if(this.enableZoom===!1)return;this._handleMouseMoveDolly(t);break;case Et.PAN:if(this.enablePan===!1)return;this._handleMouseMovePan(t);break}}function OI(t){this.enabled===!1||this.enableZoom===!1||this.state!==Et.NONE||(t.preventDefault(),this.dispatchEvent(yd),this._handleMouseWheel(this._customWheelEvent(t)),this.dispatchEvent(lS))}function FI(t){this.enabled!==!1&&this._handleKeyDown(t)}function kI(t){switch(this._trackPointer(t),this._pointers.length){case 1:switch(this.touches.ONE){case qs.ROTATE:if(this.enableRotate===!1)return;this._handleTouchStartRotate(t),this.state=Et.TOUCH_ROTATE;break;case qs.PAN:if(this.enablePan===!1)return;this._handleTouchStartPan(t),this.state=Et.TOUCH_PAN;break;default:this.state=Et.NONE}break;case 2:switch(this.touches.TWO){case qs.DOLLY_PAN:if(this.enableZoom===!1&&this.enablePan===!1)return;this._handleTouchStartDollyPan(t),this.state=Et.TOUCH_DOLLY_PAN;break;case qs.DOLLY_ROTATE:if(this.enableZoom===!1&&this.enableRotate===!1)return;this._handleTouchStartDollyRotate(t),this.state=Et.TOUCH_DOLLY_ROTATE;break;default:this.state=Et.NONE}break;default:this.state=Et.NONE}this.state!==Et.NONE&&this.dispatchEvent(yd)}function zI(t){switch(this._trackPointer(t),this.state){case Et.TOUCH_ROTATE:if(this.enableRotate===!1)return;this._handleTouchMoveRotate(t),this.update();break;case Et.TOUCH_PAN:if(this.enablePan===!1)return;this._handleTouchMovePan(t),this.update();break;case Et.TOUCH_DOLLY_PAN:if(this.enableZoom===!1&&this.enablePan===!1)return;this._handleTouchMoveDollyPan(t),this.update();break;case Et.TOUCH_DOLLY_ROTATE:if(this.enableZoom===!1&&this.enableRotate===!1)return;this._handleTouchMoveDollyRotate(t),this.update();break;default:this.state=Et.NONE}}function BI(t){this.enabled!==!1&&t.preventDefault()}function HI(t){t.key==="Control"&&(this._controlActive=!0,this.domElement.getRootNode().addEventListener("keyup",this._interceptControlUp,{passive:!0,capture:!0}))}function VI(t){t.key==="Control"&&(this._controlActive=!1,this.domElement.getRootNode().removeEventListener("keyup",this._interceptControlUp,{passive:!0,capture:!0}))}const mt=t=>document.getElementById(t),ru=mt("root"),ic=mt("view"),GI=mt("job-name"),qI=mt("job-meta"),uS=mt("link"),dS=mt("link-text"),to=mt("scrub"),$I=mt("line-label"),WI=mt("line-text"),ta=mt("details"),ZI=mt("details-list"),Uf=mt("empty"),hS=mt("fullscreen"),XI=mt("mode"),na=mt("machine"),YI=mt("machine-list"),KI=mt("legend-live"),fS=mt("return-live"),jc=mt("progress"),jI=mt("progress-fill"),JI=mt("progress-text"),Ea=mt("run-note"),Dt={load:mt("btn-load"),start:mt("btn-start"),pause:mt("btn-pause"),resume:mt("btn-resume"),stop:mt("btn-stop"),unlock:mt("btn-unlock")},Of=[new ot(4173402),new ot(3108830),new ot(2274792)],sc=new AI({canvas:ic,antialias:!0,alpha:!0});sc.setPixelRatio(Math.min(window.devicePixelRatio,2));sc.setClearColor(0,0);const Es=new aw;bn.DEFAULT_UP.set(0,0,1);const li=new zn(45,1,.1,1e5);li.up.set(0,0,1);const Ta=new PI(li,ic);Ta.enableDamping=!1;Ta.addEventListener("change",()=>Sr());const rc=new Aw(200,20);rc.rotation.x=Math.PI/2;Es.add(rc);const pS=new Cw(20);Es.add(pS);const QI=new oo({vertexColors:!0}),eL=new oo({color:10132116,transparent:!0,opacity:.35});let hs=null,fs=null;const no=new ei(new Qa(1.5,6,20).rotateX(-Math.PI/2).translate(0,0,3),new Ja({color:14701370}));no.visible=!1;Es.add(no);const io=new ei(new Qa(1.5,6,20).rotateX(-Math.PI/2).translate(0,0,3),new Ja({color:3055195}));io.visible=!1;Es.add(io);let Jc=!1;function Sr(){Jc||(Jc=!0,requestAnimationFrame(()=>{Jc=!1,sc.render(Es,li)}))}function bd(){const{clientWidth:t,clientHeight:e}=ic;!t||!e||(sc.setSize(t,e,!1),li.aspect=t/e,li.updateProjectionMatrix(),Sr())}new ResizeObserver(bd).observe(ic);function mS(t){const e=t?t==="dark":matchMedia("(prefers-color-scheme: dark)").matches;document.documentElement.dataset.theme=e?"dark":"light";const n=e?3816512:13224386;rc.material.color.set(n),Sr()}let rn=null,Bn=new Float32Array(0),Ys=new Uint32Array(0);function tL(t,e,n){Bn=new Float32Array(t,0,e*6),Ys=new Uint32Array(t,e*24,n);const i=new Uint8Array(t,e*24+n*4,e),s=new Float32Array(e*6);for(let c=0;c<e;c++){const l=Of[i[c]]??Of[1];s.set([l.r,l.g,l.b,l.r,l.g,l.b],c*6)}for(const c of[hs,fs])c&&(Es.remove(c),c.geometry.dispose());const r=new jn(Bn,3),o=new Mn;o.setAttribute("position",r),o.setAttribute("color",new jn(s,3));const a=new Mn;a.setAttribute("position",r),hs=new Ma(o,QI),fs=new Ma(a,eL),hs.frustumCulled=fs.frustumCulled=!1,Es.add(hs,fs),to.max=String(n),Md(n)}function Md(t){to.value=String(t);const e=Ys.length,n=t>0?Ys[t-1]:0,i=Bn.length/6;if(hs==null||hs.geometry.setDrawRange(0,n*2),fs==null||fs.geometry.setDrawRange(n*2,(i-n)*2),i>0){const s=n>0?n*6-3:0;no.position.set(Bn[s],Bn[s+1],Bn[s+2]),no.visible=!0}$I.textContent=`Line ${t.toLocaleString()} / ${e.toLocaleString()}`,gS(t),Sr()}function nL(){const t=rn==null?void 0:rn.bounds;return t?new Ms(new H(t.min.x,t.min.y,t.min.z),new H(t.max.x,t.max.y,t.max.z)):new Ms(new H(-50,-50,-10),new H(50,50,10))}function co(t){const e=nL(),n=e.getCenter(new H),i=e.getSize(new H),r=Math.max(i.length()/2,10)/Math.sin(G_.degToRad(li.fov/2))*1.1,o=t==="top"?new H(0,-.001,1):new H(.6,-1,.8);li.position.copy(n).addScaledVector(o.normalize(),r),li.near=r/1e3,li.far=r*20,li.updateProjectionMatrix(),Ta.target.copy(n),Ta.update();const a=Math.max(i.x,i.y,20),c=Math.pow(10,Math.floor(Math.log10(a/2))),l=Math.ceil(a*1.6/c)*c;rc.scale.setScalar(l/200),pS.scale.setScalar(Math.max(a/6,5)/20),no.scale.setScalar(Math.max(a/60,.5)),io.scale.setScalar(Math.max(a/60,.5)),Sr()}const Ff=200;let Ti=null,Qc=null;async function gS(t){if(!rn)return;const e=Math.max(0,t-1),n=rn.revision;if(Ti&&Ti.revision===n&&e>=Ti.start&&e<Ti.start+Ti.lines.length){WI.textContent=t===0?"(start)":Ti.lines[e-Ti.start];return}const i=Math.max(0,e-Ff/2);if(Qc===i)return;Qc=i;const s=await Ed("anc_get_lines",{revision:n,start:i,count:Ff});Qc=null,s&&(rn==null?void 0:rn.revision)===n&&(Ti={revision:n,start:s.start,lines:s.lines},gS(Number(to.value)))}const Vn=new _l({name:"Agentic Numerical Control",version:"0.1.0"});let ou="";async function Ed(t,e){var s,r;const n=await Vn.callServerTool({name:t,arguments:e}),i=((r=(s=n.content)==null?void 0:s.find(o=>o.type==="text"))==null?void 0:r.text)??"";return n.isError?(console.error(`${t}: ${i}`),null):JSON.parse(i)}function Ra(t){Uf.hidden=t===null,Uf.textContent=t??""}function iL(t){const e=t.units,n=t.bounds,i=r=>r.toFixed(2),s=[["Source",t.source==="file"?"File":"Supplied by Claude"],["Lines",t.lineCount.toLocaleString()],["Segments",t.segmentCount.toLocaleString()],["Units",e],...n?[["X",`${i(n.min.x)} → ${i(n.max.x)}`],["Y",`${i(n.min.y)} → ${i(n.max.y)}`],["Z",`${i(n.min.z)} → ${i(n.max.z)}`]]:[],["Cut length",`${t.cutLength.toLocaleString()} ${e}`],["Rapid length",`${t.rapidLength.toLocaleString()} ${e}`],["Feed rates",t.feedRates.join(", ")||"–"],["Spindle",t.spindleSpeeds.join(", ")||"–"]];ZI.replaceChildren(...s.flatMap(([r,o])=>{const a=document.createElement("dt");a.textContent=r;const c=document.createElement("dd");return c.textContent=o,[a,c]}))}async function sL(t){rn=t,Ti=null,GI.textContent=t.name;const e=t.bounds;qI.textContent=e?`${(e.max.x-e.min.x).toFixed(1)} × ${(e.max.y-e.min.y).toFixed(1)} × ${(e.max.z-e.min.z).toFixed(1)} ${t.units} · ${t.lineCount.toLocaleString()} lines`:`${t.lineCount.toLocaleString()} lines, no motion`,iL(t),Ra("Loading toolpath…");const n=[];let i=null;for(let o=0;;o++){const a=await Ed("anc_get_toolpath",{revision:t.revision,chunk:o});if(!a||rn!==t)return;if(i??(i=a),n.push(Uint8Array.from(atob(a.data),c=>c.charCodeAt(0))),o+1>=a.chunkCount)break}const s=new Uint8Array(i.totalBytes);let r=0;for(const o of n)s.set(o,r),r+=o.byteLength;tL(s.buffer,i.segmentCount,i.lineCount),Ra(i.segmentCount?null:"This program has no motion to draw."),co("3d")}let xn=null,Fn=null,Br=!1;const rL=t=>{const e=Math.max(0,Math.round(t/1e3));return`${Math.floor(e/60)}:${String(e%60).padStart(2,"0")}`},kf=t=>t?`${t.x.toFixed(3)}, ${t.y.toFixed(3)}, ${t.z.toFixed(3)}`:"–";function oL(t){const e=t.telemetryAt?Math.round((Date.now()-Date.parse(t.telemetryAt))/1e3):null,n=[["State",t.state],["Work pos",kf(t.wpos)],["Machine pos",kf(t.mpos)],["Work offset",t.wcs??"–"],["Port",t.port?`${t.port} (${t.controller??"?"})`:"none open"],["In CNCjs",t.loadedFile??"no program"],["Workflow",t.workflow],["Alarm",t.alarm??"none"],["Last status",e===null?"never":`${e} s ago`],["CNCjs",`${t.cncjs.url}${t.cncjs.managed?" (started by Agentic Numerical Control)":""}`]];YI.replaceChildren(...n.flatMap(([i,s])=>{const r=document.createElement("dt");r.textContent=i;const o=document.createElement("dd");return o.textContent=s,[r,o]}))}function zf(){const t=xn;for(const o of Object.values(Dt))o.hidden=!0;if(!t||!rn){Ea.textContent=t&&!t.cncjs.connected?t.state:"",jc.hidden=!0;return}const e=t.workflow==="running",n=t.workflow==="paused",i=t.link==="live",s=t.loadedFile===rn.name;if(XI.textContent=e?"Running":n?"Paused":s?"Ready":"Preview",jc.hidden=!(Fn&&(e||n||Fn.received>0)),Fn&&!jc.hidden){const o=Fn.total?Fn.received/Fn.total*100:0;jI.style.width=`${o.toFixed(1)}%`,JI.textContent=`${Fn.received.toLocaleString()} / ${Fn.total.toLocaleString()} lines sent · ${rL(Fn.elapsedMs)} elapsed`}let r="";t.cncjs.connected?t.port?t.alarm||t.activeState==="Alarm"?(r=t.alarm??"Machine is in alarm.",Dt.unlock.hidden=!1):e||n?(Dt.pause.hidden=!e,Dt.resume.hidden=!n,Dt.stop.hidden=!1):s?(Dt.start.hidden=!1,Dt.start.disabled=!i||t.activeState!=="Idle",r=i?t.activeState!=="Idle"?`Machine is ${t.activeState}.`:"":t.state):(r=t.loadedFile?`CNCjs has "${t.loadedFile}" loaded.`:"",Dt.load.hidden=!1):r="No machine connected in CNCjs.":r=t.state,Ea.textContent=r}function Td(){const t=xn,e=!!t&&t.link==="live"&&!!t.wpos&&!!rn&&t.loadedFile===rn.name;io.visible=e,KI.hidden=!e,e&&io.position.set(t.wpos.x,t.wpos.y,t.wpos.z);const n=!!Fn&&((t==null?void 0:t.workflow)==="running"||(t==null?void 0:t.workflow)==="paused");n&&!Br&&Md(e?aL(t.wpos,Fn.line):Hr),fS.hidden=!(n&&Br),n||(Br=!1,Hr=0),Sr()}let Hr=0;function aL(t,e){let n=Hr,i=1/0;const s=Math.min(e,Ys.length),r=.02**2;e:for(let o=Math.max(Hr,1);o<=s;o++){const a=o>1?Ys[o-2]:0;for(let c=a;c<Ys[o-1];c++){const l=cL(t,c);if(l<i-1e-9&&(i=l,n=o),l<=r)break e}}return Hr=n,n}function cL(t,e){const n=e*6,i=Bn[n],s=Bn[n+1],r=Bn[n+2],o=Bn[n+3]-i,a=Bn[n+4]-s,c=Bn[n+5]-r,l=o*o+a*a+c*c,u=l?Math.max(0,Math.min(1,((t.x-i)*o+(t.y-s)*a+(t.z-r)*c)/l)):0;return(i+u*o-t.x)**2+(s+u*a-t.y)**2+(r+u*c-t.z)**2}function lL(t){if(ou=t.cncjsUrl,xn=t.machine,Fn=t.progress,uS.className=`link ${t.machine.link==="none"?"":t.machine.link}`,dS.textContent=t.machine.link==="live"?t.machine.activeState??"Live":t.machine.state,oL(t.machine),!t.job){rn||Ra("No job loaded. Ask Claude to show a G-code file."),zf();return}(!rn||t.job.revision!==rn.revision)&&sL(t.job),zf(),Td()}const uL=2e3,dL=500;let au;async function lo(){clearTimeout(au);try{const e=await Ed("anc_snapshot",{});e&&lL(e)}catch(e){uS.className="link stale",dS.textContent="Agentic Numerical Control server unreachable",console.error(e)}const t=(xn==null?void 0:xn.workflow)==="running"||(xn==null?void 0:xn.workflow)==="paused";au=window.setTimeout(lo,t?dL:uL)}async function uo(t,e){var n,i;e.disabled=!0;try{const s=await Vn.callServerTool({name:"anc_job_control",arguments:{action:t}});s.isError&&(Ea.textContent=((i=(n=s.content)==null?void 0:n.find(r=>r.type==="text"))==null?void 0:i.text)??"Command failed.")}finally{e.disabled=!1,lo()}}let wa;function Bf(){clearTimeout(wa),wa=void 0,Dt.start.textContent="Start",Dt.start.classList.remove("confirm")}function _S(t){var e;if(mS(t.theme),t.safeAreaInsets){const n=t.safeAreaInsets;ru.style.padding=`${n.top}px ${n.right}px ${n.bottom}px ${n.left}px`}hS.hidden=!((e=t.availableDisplayModes)!=null&&e.includes("fullscreen")),ru.classList.toggle("fullscreen",t.displayMode==="fullscreen"),bd()}Vn.onerror=console.error;Vn.onhostcontextchanged=_S;Vn.ontoolresult=t=>{var e,n;if(t.isError){const i=(n=(e=t.content)==null?void 0:e.find(s=>s.type==="text"))==null?void 0:n.text;Ra(i??"The job could not be opened.");return}lo()};Vn.onteardown=async()=>(clearTimeout(au),{});to.addEventListener("input",()=>{((xn==null?void 0:xn.workflow)==="running"||(xn==null?void 0:xn.workflow)==="paused")&&(Br=!0),Md(Number(to.value)),Td()});fS.addEventListener("click",()=>{Br=!1,Td()});Dt.load.addEventListener("click",async()=>{var t,e;Dt.load.disabled=!0;try{const n=await Vn.callServerTool({name:"anc_send_to_cncjs",arguments:{}});n.isError&&(Ea.textContent=((e=(t=n.content)==null?void 0:t.find(i=>i.type==="text"))==null?void 0:e.text)??"Load failed.")}finally{Dt.load.disabled=!1,lo()}});Dt.start.addEventListener("click",()=>{if(wa===void 0){Dt.start.textContent="Confirm start",Dt.start.classList.add("confirm"),wa=window.setTimeout(Bf,4e3);return}Bf(),uo("start",Dt.start)});Dt.pause.addEventListener("click",()=>uo("pause",Dt.pause));Dt.resume.addEventListener("click",()=>uo("resume",Dt.resume));Dt.stop.addEventListener("click",()=>uo("stop",Dt.stop));Dt.unlock.addEventListener("click",()=>uo("unlock",Dt.unlock));mt("fit").addEventListener("click",()=>co("3d"));mt("view-3d").addEventListener("click",()=>co("3d"));mt("view-top").addEventListener("click",()=>co("top"));mt("details-btn").addEventListener("click",()=>{ta.hidden=!ta.hidden,ta.hidden||(na.hidden=!0)});mt("machine-btn").addEventListener("click",()=>{na.hidden=!na.hidden,na.hidden||(ta.hidden=!0)});mt("open-cncjs").addEventListener("click",()=>{ou&&Vn.openLink({url:ou})});hS.addEventListener("click",async()=>{var n;const t=((n=Vn.getHostContext())==null?void 0:n.displayMode)==="fullscreen"?"inline":"fullscreen",e=await Vn.requestDisplayMode({mode:t});ru.classList.toggle("fullscreen",e.mode==="fullscreen"),bd()});mS(void 0);co("3d");Vn.connect().then(()=>{const t=Vn.getHostContext();t&&_S(t),lo()});</script>
|
|
4334
|
-
<style rel="stylesheet" crossorigin>:root{--bg: #f7f7f5;--panel: #ffffffee;--text: #1d1d1b;--muted: #6b6b66;--border: #dcdcd6;--accent: #2f6fde;--grid: #c9c9c2;--ok: #2e9e5b;--warn: #c98a12;--off: #9a9a94}:root[data-theme=dark]{--bg: #1b1c1e;--panel: #26282bee;--text: #ecebe6;--muted: #9b9a94;--border: #3a3c40;--accent: #6b9cff;--grid: #3a3c40;--off: #6e6e69}*{box-sizing:border-box}[hidden]{display:none!important}html,body{margin:0;background:var(--bg);color:var(--text)}body{font:13px/1.4 system-ui,-apple-system,Segoe UI,sans-serif}.anc{display:flex;flex-direction:column;height:520px}.anc.fullscreen{height:100vh}.bar{display:flex;align-items:center;gap:10px;padding:8px 12px;border-bottom:1px solid var(--border);min-width:0}.bar.scrub{border-bottom:0;border-top:1px solid var(--border)}.job{display:flex;flex-direction:column;min-width:0;flex:1}.job-name{font-weight:600;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.job-meta{color:var(--muted);font-size:12px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.badge{font-size:11px;font-weight:600;letter-spacing:.04em;text-transform:uppercase;padding:2px 8px;border-radius:999px;background:color-mix(in srgb,var(--accent) 15%,transparent);color:var(--accent)}.link{display:inline-flex;align-items:center;gap:6px;color:var(--muted);font-size:12px;white-space:nowrap}.link i{width:8px;height:8px;border-radius:50%;background:var(--off)}.link.live i{background:var(--ok)}.link.stale i{background:var(--warn)}button{font:inherit;color:var(--text);background:var(--panel);border:1px solid var(--border);border-radius:6px;padding:4px 10px;cursor:pointer}button:hover{border-color:var(--accent)}button.ghost{background:transparent}.stage{position:relative;flex:1;min-height:0}#view{position:absolute;top:0;right:0;bottom:0;left:0;width:100%;height:100%;display:block;touch-action:none}.view-tools{position:absolute;top:10px;right:10px;display:flex;gap:6px}.legend{position:absolute;left:10px;bottom:8px;display:flex;gap:12px;color:var(--muted);font-size:11px;pointer-events:none}.legend span{display:inline-flex;align-items:center;gap:4px}.sw{width:12px;height:3px;border-radius:2px;display:inline-block}.sw.rapid{background:#3fae5a}.sw.feed{background:#2f6fde}.sw.arc{background:#22b5e8}.sw.done{background:var(--off);opacity:.5}.details{position:absolute;top:10px;left:10px;width:260px;max-height:calc(100% - 50px);overflow:auto;background:var(--panel);border:1px solid var(--border);border-radius:8px;padding:10px 12px;-webkit-backdrop-filter:blur(6px);backdrop-filter:blur(6px)}.details h2{font-size:13px;margin:0 0 6px}.details dl{display:grid;grid-template-columns:auto 1fr;gap:3px 10px;margin:0;font-size:12px}.details dt{color:var(--muted)}.details dd{margin:0;font-variant-numeric:tabular-nums}.details .note{color:var(--muted);font-size:11px;margin:8px 0 0}.empty{position:absolute;top:0;right:0;bottom:0;left:0;display:grid;place-items:center;color:var(--muted);padding:24px;text-align:center}#scrub{flex:1;min-width:80px;accent-color:var(--accent)}.line-label{color:var(--muted);font-variant-numeric:tabular-nums;white-space:nowrap;font-size:12px}.line-text{flex:0 1 220px;min-width:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;font:12px ui-monospace,Consolas,monospace;color:var(--text)}@media(max-width:520px){.line-text,.legend span:last-child,.job-meta{display:none}.bar{gap:6px;padding:6px 8px}}.anc{height:560px}.sw.live{background:#2e9e5b}.bar.run{border-bottom:0;border-top:1px solid var(--border);min-height:42px}.progress{display:flex;align-items:center;gap:8px;flex:1;min-width:0}.progress-track{flex:1;height:6px;border-radius:3px;background:var(--border);overflow:hidden;min-width:60px}.progress-fill{height:100%;width:0;background:var(--ok);transition:width .3s}.progress-text{color:var(--muted);font-size:12px;white-space:nowrap;font-variant-numeric:tabular-nums}.run-note{color:var(--muted);font-size:12px;flex:1;min-width:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.progress:not([hidden])+.run-note{flex:0 1 auto}.run-buttons{display:flex;gap:6px;margin-left:auto}button.primary{background:var(--accent);border-color:var(--accent);color:#fff}button.danger{border-color:#d0453a;color:#d0453a}button.confirm{background:#d0453a;border-color:#d0453a;color:#fff}button:disabled{opacity:.45;cursor:default}.return-live{position:absolute;top:10px;left:50%;transform:translate(-50%);background:var(--ok);border-color:var(--ok);color:#fff}.details+.details{top:10px}@media(max-width:520px){header.bar{flex-wrap:wrap}header.bar .job{flex:1 0 100%}header.bar #open-cncjs{margin-left:auto}}</style>
|
|
4335
|
-
</head>
|
|
4336
|
-
<body>
|
|
4337
|
-
<main class="anc" id="root">
|
|
4338
|
-
<header class="
|
|
4339
|
-
<div class="
|
|
4340
|
-
<span class="
|
|
4341
|
-
<span class="
|
|
4342
|
-
</div>
|
|
4343
|
-
<span class="
|
|
4344
|
-
|
|
4345
|
-
|
|
4346
|
-
|
|
4347
|
-
|
|
4348
|
-
|
|
4349
|
-
|
|
4350
|
-
|
|
4351
|
-
|
|
4352
|
-
|
|
4353
|
-
|
|
4354
|
-
|
|
4355
|
-
|
|
4356
|
-
|
|
4357
|
-
|
|
4358
|
-
|
|
4359
|
-
|
|
4360
|
-
<
|
|
4361
|
-
|
|
4362
|
-
|
|
4363
|
-
|
|
4364
|
-
<
|
|
4365
|
-
|
|
4366
|
-
|
|
4367
|
-
|
|
4368
|
-
|
|
4369
|
-
|
|
4370
|
-
|
|
4371
|
-
|
|
4372
|
-
|
|
4373
|
-
|
|
4374
|
-
|
|
4375
|
-
|
|
4376
|
-
|
|
4377
|
-
|
|
4378
|
-
<div class="
|
|
4379
|
-
<
|
|
4380
|
-
<span class="
|
|
4381
|
-
</div>
|
|
4382
|
-
<
|
|
4383
|
-
<div class="
|
|
4384
|
-
|
|
4385
|
-
<
|
|
4386
|
-
<
|
|
4387
|
-
<
|
|
4388
|
-
|
|
4389
|
-
|
|
4390
|
-
|
|
4391
|
-
|
|
4392
|
-
|
|
4393
|
-
|
|
4394
|
-
|
|
4395
|
-
|
|
4396
|
-
|
|
4397
|
-
|
|
4398
|
-
<
|
|
4399
|
-
|
|
4400
|
-
|
|
4401
|
-
|
|
4402
|
-
</
|
|
4333
|
+
}`;class EI{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(e,n){if(this.texture===null){const i=new FS(e.texture);(e.depthNear!==n.depthNear||e.depthFar!==n.depthFar)&&(this.depthNear=e.depthNear,this.depthFar=e.depthFar),this.texture=i}}getMesh(e){if(this.texture!==null&&this.mesh===null){const n=e.cameras[0].viewport,i=new yi({vertexShader:bI,fragmentShader:MI,uniforms:{depthColor:{value:this.texture},depthWidth:{value:n.z},depthHeight:{value:n.w}}});this.mesh=new si(new fc(20,20),i)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}}class TI extends us{constructor(e,n){super();const i=this;let s=null,r=1,o=null,a="local-floor",c=1,l=null,u=null,h=null,d=null,f=null,_=null;const x=typeof XRWebGLBinding<"u",m=new EI,p={},E=n.getContextAttributes();let I=null,b=null;const w=[],A=[],P=new je;let v=null,T=null;const L=new Gn;L.viewport=new Vt;const N=new Gn;N.viewport=new Vt;const k=[L,N],q=new PA;let U=null,V=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(Y){let re=w[Y];return re===void 0&&(re=new Xc,w[Y]=re),re.getTargetRaySpace()},this.getControllerGrip=function(Y){let re=w[Y];return re===void 0&&(re=new Xc,w[Y]=re),re.getGripSpace()},this.getHand=function(Y){let re=w[Y];return re===void 0&&(re=new Xc,w[Y]=re),re.getHandSpace()};function Q(Y){const re=A.indexOf(Y.inputSource);if(re===-1)return;const Re=w[re];Re!==void 0&&(Re.update(Y.inputSource,Y.frame,l||o),Re.dispatchEvent({type:Y.type,data:Y.inputSource}))}function X(){s.removeEventListener("select",Q),s.removeEventListener("selectstart",Q),s.removeEventListener("selectend",Q),s.removeEventListener("squeeze",Q),s.removeEventListener("squeezestart",Q),s.removeEventListener("squeezeend",Q),s.removeEventListener("end",X),s.removeEventListener("inputsourceschange",ce);for(let Y=0;Y<w.length;Y++){const re=A[Y];re!==null&&(A[Y]=null,w[Y].disconnect(re))}U=null,V=null,m.reset();for(const Y in p)delete p[Y];if(e.setRenderTarget(I),f=null,d=null,h=null,s=null,b=null,Je.stop(),i.isPresenting=!1,e.setPixelRatio(v),e.setSize(P.width,P.height,!1),T!==null){const Y=T.camera;Y.fov=T.fov,Y.zoom=T.zoom,Y.updateProjectionMatrix(),T=null}i.dispatchEvent({type:"sessionend"})}this.setFramebufferScaleFactor=function(Y){r=Y,i.isPresenting===!0&&$e("WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(Y){a=Y,i.isPresenting===!0&&$e("WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return l||o},this.setReferenceSpace=function(Y){l=Y},this.getBaseLayer=function(){return d!==null?d:f},this.getBinding=function(){return h===null&&x&&(h=new XRWebGLBinding(s,n)),h},this.getFrame=function(){return _},this.getSession=function(){return s},this.setSession=async function(Y){if(s=Y,s!==null){if(I=e.getRenderTarget(),s.addEventListener("select",Q),s.addEventListener("selectstart",Q),s.addEventListener("selectend",Q),s.addEventListener("squeeze",Q),s.addEventListener("squeezestart",Q),s.addEventListener("squeezeend",Q),s.addEventListener("end",X),s.addEventListener("inputsourceschange",ce),E.xrCompatible!==!0&&await n.makeXRCompatible(),v=e.getPixelRatio(),e.getSize(P),x&&"createProjectionLayer"in XRWebGLBinding.prototype){let Re=null,Ge=null,Me=null;E.depth&&(Me=E.stencil?n.DEPTH24_STENCIL8:n.DEPTH_COMPONENT24,Re=E.stencil?bs:zi,Ge=E.stencil?uo:vi);const We={colorFormat:n.RGBA8,depthFormat:Me,scaleFactor:r};h=this.getBinding(),d=h.createProjectionLayer(We),s.updateRenderState({layers:[d]}),e.setPixelRatio(1),e.setSize(d.textureWidth,d.textureHeight,!1),b=new ei(d.textureWidth,d.textureHeight,{format:Qn,type:$n,depthTexture:new fo(d.textureWidth,d.textureHeight,Ge,void 0,void 0,void 0,void 0,void 0,void 0,Re),stencilBuffer:E.stencil,colorSpace:e.outputColorSpace,samples:E.antialias?4:0,resolveDepthBuffer:d.ignoreDepthValues===!1,resolveStencilBuffer:d.ignoreDepthValues===!1,storeMultisampledDepthBuffer:d.ignoreDepthValues===!1,storeMultisampledStencilBuffer:d.ignoreDepthValues===!1})}else{const Re={antialias:E.antialias,alpha:!0,depth:E.depth,stencil:E.stencil,framebufferScaleFactor:r};f=new XRWebGLLayer(s,n,Re),s.updateRenderState({baseLayer:f}),e.setPixelRatio(1),e.setSize(f.framebufferWidth,f.framebufferHeight,!1),b=new ei(f.framebufferWidth,f.framebufferHeight,{format:Qn,type:$n,colorSpace:e.outputColorSpace,stencilBuffer:E.stencil,resolveDepthBuffer:f.ignoreDepthValues===!1,resolveStencilBuffer:f.ignoreDepthValues===!1,storeMultisampledDepthBuffer:f.ignoreDepthValues===!1,storeMultisampledStencilBuffer:f.ignoreDepthValues===!1})}b.isXRRenderTarget=!0,this.setFoveation(c),l=null,o=await s.requestReferenceSpace(a),Je.setContext(s),Je.start(),i.isPresenting=!0,i.dispatchEvent({type:"sessionstart"})}},this.getEnvironmentBlendMode=function(){if(s!==null)return s.environmentBlendMode},this.getDepthTexture=function(){return m.getDepthTexture()};function ce(Y){for(let re=0;re<Y.removed.length;re++){const Re=Y.removed[re],Ge=A.indexOf(Re);Ge>=0&&(A[Ge]=null,w[Ge].disconnect(Re))}for(let re=0;re<Y.added.length;re++){const Re=Y.added[re];let Ge=A.indexOf(Re);if(Ge===-1){for(let We=0;We<w.length;We++)if(We>=A.length){A.push(Re),Ge=We;break}else if(A[We]===null){A[We]=Re,Ge=We;break}if(Ge===-1)break}const Me=w[Ge];Me&&Me.connect(Re)}}const j=new H,se=new H;function oe(Y,re,Re){j.setFromMatrixPosition(re.matrixWorld),se.setFromMatrixPosition(Re.matrixWorld);const Ge=j.distanceTo(se),Me=re.projectionMatrix.elements,We=Re.projectionMatrix.elements,Lt=Me[14]/(Me[10]-1),Xe=Me[14]/(Me[10]+1),st=(Me[9]+1)/Me[5],St=(Me[9]-1)/Me[5],Qe=(Me[8]-1)/Me[0],xt=(We[8]+1)/We[0],Ot=Lt*Qe,qt=Lt*xt,Mt=Ge/(-Qe+xt),It=Mt*-Qe;if(re.matrixWorld.decompose(Y.position,Y.quaternion,Y.scale),Y.translateX(It),Y.translateZ(Mt),Y.matrixWorld.compose(Y.position,Y.quaternion,Y.scale),Y.matrixWorldInverse.copy(Y.matrixWorld).invert(),Me[10]===-1)Y.projectionMatrix.copy(re.projectionMatrix),Y.projectionMatrixInverse.copy(re.projectionMatrixInverse);else{const F=Lt+Mt,Bt=Xe+Mt,dt=Ot-It,R=qt+(Ge-It),S=st*Xe/Bt*F,z=St*Xe/Bt*F;Y.projectionMatrix.makePerspective(dt,R,S,z,F,Bt),Y.projectionMatrixInverse.copy(Y.projectionMatrix).invert()}}function Fe(Y,re){re===null?Y.matrixWorld.copy(Y.matrix):Y.matrixWorld.multiplyMatrices(re.matrixWorld,Y.matrix),Y.matrixWorldInverse.copy(Y.matrixWorld).invert()}this.updateCamera=function(Y){if(s===null)return;let re=Y.near,Re=Y.far;m.texture!==null&&(m.depthNear>0&&(re=m.depthNear),m.depthFar>0&&(Re=m.depthFar)),q.near=N.near=L.near=re,q.far=N.far=L.far=Re,(U!==q.near||V!==q.far)&&(s.updateRenderState({depthNear:q.near,depthFar:q.far}),U=q.near,V=q.far),q.layers.mask=Y.layers.mask|6,L.layers.mask=q.layers.mask&-5,N.layers.mask=q.layers.mask&-3;const Ge=Y.parent,Me=q.cameras;Fe(q,Ge);for(let We=0;We<Me.length;We++)Fe(Me[We],Ge);Me.length===2?oe(q,L,N):q.projectionMatrix.copy(L.projectionMatrix),T===null&&Y.isPerspectiveCamera&&(T={camera:Y,fov:Y.fov,zoom:Y.zoom}),Ie(Y,q,Ge)};function Ie(Y,re,Re){Re===null?Y.matrix.copy(re.matrixWorld):(Y.matrix.copy(Re.matrixWorld),Y.matrix.invert(),Y.matrix.multiply(re.matrixWorld)),Y.matrix.decompose(Y.position,Y.quaternion,Y.scale),Y.updateMatrixWorld(!0),Y.projectionMatrix.copy(re.projectionMatrix),Y.projectionMatrixInverse.copy(re.projectionMatrixInverse),Y.isPerspectiveCamera&&(Y.fov=ho*2*Math.atan(1/Y.projectionMatrix.elements[5]),Y.zoom=1)}this.getCamera=function(){return q},this.getFoveation=function(){if(!(d===null&&f===null))return c},this.setFoveation=function(Y){c=Y,d!==null&&(d.fixedFoveation=Y),f!==null&&f.fixedFoveation!==void 0&&(f.fixedFoveation=Y)},this.hasDepthSensing=function(){return m.texture!==null},this.getDepthSensingMesh=function(){return m.getMesh(q)},this.getCameraTexture=function(Y){return p[Y]};let mt=null;function tt(Y,re){if(u=re.getViewerPose(l||o),_=re,u!==null){const Re=u.views;f!==null&&(e.setRenderTargetFramebuffer(b,f.framebuffer),e.setRenderTarget(b));let Ge=!1;Re.length!==q.cameras.length&&(q.cameras.length=0,Ge=!0);for(let Xe=0;Xe<Re.length;Xe++){const st=Re[Xe];let St=null;if(f!==null)St=f.getViewport(st);else{const xt=h.getViewSubImage(d,st);St=xt.viewport,Xe===0&&(e.setRenderTargetTextures(b,xt.colorTexture,xt.depthStencilTexture),e.setRenderTarget(b))}let Qe=k[Xe];Qe===void 0&&(Qe=new Gn,Qe.layers.enable(Xe),Qe.viewport=new Vt,k[Xe]=Qe),Qe.matrix.fromArray(st.transform.matrix),Qe.matrix.decompose(Qe.position,Qe.quaternion,Qe.scale),Qe.projectionMatrix.fromArray(st.projectionMatrix),Qe.projectionMatrixInverse.copy(Qe.projectionMatrix).invert(),Qe.viewport.set(St.x,St.y,St.width,St.height),Xe===0&&(q.matrix.copy(Qe.matrix),q.matrix.decompose(q.position,q.quaternion,q.scale)),Ge===!0&&q.cameras.push(Qe)}const Me=s.enabledFeatures;if(Me&&Me.includes("depth-sensing")&&s.depthUsage=="gpu-optimized"&&x){h=i.getBinding();const Xe=h.getDepthInformation(Re[0]);Xe&&Xe.isValid&&Xe.texture&&m.init(Xe,s.renderState)}if(Me&&Me.includes("camera-access")&&x){e.state.unbindTexture(),h=i.getBinding();for(let Xe=0;Xe<Re.length;Xe++){const st=Re[Xe].camera;if(st){let St=p[st];St||(St=new FS,p[st]=St);const Qe=h.getCameraImage(st);St.sourceTexture=Qe}}}}for(let Re=0;Re<w.length;Re++){const Ge=A[Re],Me=w[Re];Ge!==null&&Me!==void 0&&Me.update(Ge,re,l||o)}mt&&mt(Y,re),re.detectedPlanes&&i.dispatchEvent({type:"planesdetected",data:re}),_=null}const Je=new VS;Je.setAnimationLoop(tt),this.setAnimationLoop=function(Y){mt=Y},this.dispose=function(){}}}const RI=new $t,YS=new Ke;YS.set(-1,0,0,0,1,0,0,0,1);function wI(t,e){function n(m,p){m.matrixAutoUpdate===!0&&m.updateMatrix(),p.value.copy(m.matrix)}function i(m,p){p.color.getRGB(m.fogColor.value,kS(t)),p.isFog?(m.fogNear.value=p.near,m.fogFar.value=p.far):p.isFogExp2&&(m.fogDensity.value=p.density)}function s(m,p,E,I,b){p.isNodeMaterial?p.uniformsNeedUpdate=!1:p.isMeshBasicMaterial?r(m,p):p.isMeshLambertMaterial?(r(m,p),p.envMap&&(m.envMapIntensity.value=p.envMapIntensity)):p.isMeshToonMaterial?(r(m,p),h(m,p)):p.isMeshPhongMaterial?(r(m,p),u(m,p),p.envMap&&(m.envMapIntensity.value=p.envMapIntensity)):p.isMeshStandardMaterial?(r(m,p),d(m,p),p.isMeshPhysicalMaterial&&f(m,p,b)):p.isMeshMatcapMaterial?(r(m,p),_(m,p)):p.isMeshDepthMaterial?r(m,p):p.isMeshDistanceMaterial?(r(m,p),x(m,p)):p.isMeshNormalMaterial?r(m,p):p.isLineBasicMaterial?(o(m,p),p.isLineDashedMaterial&&a(m,p)):p.isPointsMaterial?c(m,p,E,I):p.isSpriteMaterial?l(m,p):p.isShadowMaterial?(m.color.value.copy(p.color),m.opacity.value=p.opacity):p.isShaderMaterial&&(p.uniformsNeedUpdate=!1)}function r(m,p){m.opacity.value=p.opacity,p.color&&m.diffuse.value.copy(p.color),p.emissive&&m.emissive.value.copy(p.emissive).multiplyScalar(p.emissiveIntensity),p.map&&(m.map.value=p.map,n(p.map,m.mapTransform)),p.alphaMap&&(m.alphaMap.value=p.alphaMap,n(p.alphaMap,m.alphaMapTransform)),p.bumpMap&&(m.bumpMap.value=p.bumpMap,n(p.bumpMap,m.bumpMapTransform),m.bumpScale.value=p.bumpScale,p.side===Cn&&(m.bumpScale.value*=-1)),p.normalMap&&(m.normalMap.value=p.normalMap,n(p.normalMap,m.normalMapTransform),m.normalScale.value.copy(p.normalScale),p.side===Cn&&m.normalScale.value.negate()),p.displacementMap&&(m.displacementMap.value=p.displacementMap,n(p.displacementMap,m.displacementMapTransform),m.displacementScale.value=p.displacementScale,m.displacementBias.value=p.displacementBias),p.emissiveMap&&(m.emissiveMap.value=p.emissiveMap,n(p.emissiveMap,m.emissiveMapTransform)),p.specularMap&&(m.specularMap.value=p.specularMap,n(p.specularMap,m.specularMapTransform)),p.alphaTest>0&&(m.alphaTest.value=p.alphaTest);const E=e.get(p),I=E.envMap,b=E.envMapRotation;I&&(m.envMap.value=I,m.envMapRotation.value.setFromMatrix4(RI.makeRotationFromEuler(b)).transpose(),I.isCubeTexture&&I.isRenderTargetTexture===!1&&m.envMapRotation.value.premultiply(YS),m.reflectivity.value=p.reflectivity,m.ior.value=p.ior,m.refractionRatio.value=p.refractionRatio),p.lightMap&&(m.lightMap.value=p.lightMap,m.lightMapIntensity.value=p.lightMapIntensity,n(p.lightMap,m.lightMapTransform)),p.aoMap&&(m.aoMap.value=p.aoMap,m.aoMapIntensity.value=p.aoMapIntensity,n(p.aoMap,m.aoMapTransform))}function o(m,p){m.diffuse.value.copy(p.color),m.opacity.value=p.opacity,p.map&&(m.map.value=p.map,n(p.map,m.mapTransform))}function a(m,p){m.dashSize.value=p.dashSize,m.totalSize.value=p.dashSize+p.gapSize,m.scale.value=p.scale}function c(m,p,E,I){m.diffuse.value.copy(p.color),m.opacity.value=p.opacity,m.size.value=p.size*E,m.scale.value=I*.5,p.map&&(m.map.value=p.map,n(p.map,m.uvTransform)),p.alphaMap&&(m.alphaMap.value=p.alphaMap,n(p.alphaMap,m.alphaMapTransform)),p.alphaTest>0&&(m.alphaTest.value=p.alphaTest)}function l(m,p){m.diffuse.value.copy(p.color),m.opacity.value=p.opacity,m.rotation.value=p.rotation,p.map&&(m.map.value=p.map,n(p.map,m.mapTransform)),p.alphaMap&&(m.alphaMap.value=p.alphaMap,n(p.alphaMap,m.alphaMapTransform)),p.alphaTest>0&&(m.alphaTest.value=p.alphaTest)}function u(m,p){m.specular.value.copy(p.specular),m.shininess.value=Math.max(p.shininess,1e-4)}function h(m,p){p.gradientMap&&(m.gradientMap.value=p.gradientMap)}function d(m,p){m.metalness.value=p.metalness,p.metalnessMap&&(m.metalnessMap.value=p.metalnessMap,n(p.metalnessMap,m.metalnessMapTransform)),m.roughness.value=p.roughness,p.roughnessMap&&(m.roughnessMap.value=p.roughnessMap,n(p.roughnessMap,m.roughnessMapTransform)),p.envMap&&(m.envMapIntensity.value=p.envMapIntensity)}function f(m,p,E){m.ior.value=p.ior,p.sheen>0&&(m.sheenColor.value.copy(p.sheenColor).multiplyScalar(p.sheen),m.sheenRoughness.value=p.sheenRoughness,p.sheenColorMap&&(m.sheenColorMap.value=p.sheenColorMap,n(p.sheenColorMap,m.sheenColorMapTransform)),p.sheenRoughnessMap&&(m.sheenRoughnessMap.value=p.sheenRoughnessMap,n(p.sheenRoughnessMap,m.sheenRoughnessMapTransform))),p.clearcoat>0&&(m.clearcoat.value=p.clearcoat,m.clearcoatRoughness.value=p.clearcoatRoughness,p.clearcoatMap&&(m.clearcoatMap.value=p.clearcoatMap,n(p.clearcoatMap,m.clearcoatMapTransform)),p.clearcoatRoughnessMap&&(m.clearcoatRoughnessMap.value=p.clearcoatRoughnessMap,n(p.clearcoatRoughnessMap,m.clearcoatRoughnessMapTransform)),p.clearcoatNormalMap&&(m.clearcoatNormalMap.value=p.clearcoatNormalMap,n(p.clearcoatNormalMap,m.clearcoatNormalMapTransform),m.clearcoatNormalScale.value.copy(p.clearcoatNormalScale),p.side===Cn&&m.clearcoatNormalScale.value.negate())),p.dispersion>0&&(m.dispersion.value=p.dispersion),p.retroreflectivity>0&&(m.retroreflectivity.value=p.retroreflectivity),p.iridescence>0&&(m.iridescence.value=p.iridescence,m.iridescenceIOR.value=p.iridescenceIOR,m.iridescenceThicknessMinimum.value=p.iridescenceThicknessRange[0],m.iridescenceThicknessMaximum.value=p.iridescenceThicknessRange[1],p.iridescenceMap&&(m.iridescenceMap.value=p.iridescenceMap,n(p.iridescenceMap,m.iridescenceMapTransform)),p.iridescenceThicknessMap&&(m.iridescenceThicknessMap.value=p.iridescenceThicknessMap,n(p.iridescenceThicknessMap,m.iridescenceThicknessMapTransform))),p.transmission>0&&(m.transmission.value=p.transmission,m.transmissionSamplerMap.value=E.texture,m.transmissionSamplerSize.value.set(E.width,E.height),p.transmissionMap&&(m.transmissionMap.value=p.transmissionMap,n(p.transmissionMap,m.transmissionMapTransform)),m.thickness.value=p.thickness,p.thicknessMap&&(m.thicknessMap.value=p.thicknessMap,n(p.thicknessMap,m.thicknessMapTransform)),m.attenuationDistance.value=p.attenuationDistance,m.attenuationColor.value.copy(p.attenuationColor)),p.anisotropy>0&&(m.anisotropyVector.value.set(p.anisotropy*Math.cos(p.anisotropyRotation),p.anisotropy*Math.sin(p.anisotropyRotation)),p.anisotropyMap&&(m.anisotropyMap.value=p.anisotropyMap,n(p.anisotropyMap,m.anisotropyMapTransform))),m.specularIntensity.value=p.specularIntensity,m.specularColor.value.copy(p.specularColor),p.specularColorMap&&(m.specularColorMap.value=p.specularColorMap,n(p.specularColorMap,m.specularColorMapTransform)),p.specularIntensityMap&&(m.specularIntensityMap.value=p.specularIntensityMap,n(p.specularIntensityMap,m.specularIntensityMapTransform))}function _(m,p){p.matcap&&(m.matcap.value=p.matcap)}function x(m,p){const E=e.get(p).light;m.referencePosition.value.setFromMatrixPosition(E.matrixWorld),m.nearDistance.value=E.shadow.camera.near,m.farDistance.value=E.shadow.camera.far}return{refreshFogUniforms:i,refreshMaterialUniforms:s}}function AI(t,e,n,i){let s={},r={},o=[];const a=t.getParameter(t.MAX_UNIFORM_BUFFER_BINDINGS);function c(b,w){const A=w.program;i.uniformBlockBinding(b,A)}function l(b,w){let A=s[b.id];A===void 0&&(m(b),A=u(b),s[b.id]=A,b.addEventListener("dispose",E));const P=w.program;i.updateUBOMapping(b,P);const v=e.render.frame;r[b.id]!==v&&(d(b),r[b.id]=v)}function u(b){const w=h();b.__bindingPointIndex=w;const A=t.createBuffer(),P=b.__size,v=b.usage;return t.bindBuffer(t.UNIFORM_BUFFER,A),t.bufferData(t.UNIFORM_BUFFER,P,v),t.bindBuffer(t.UNIFORM_BUFFER,null),t.bindBufferBase(t.UNIFORM_BUFFER,w,A),A}function h(){for(let b=0;b<a;b++)if(o.indexOf(b)===-1)return o.push(b),b;return vt("WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}function d(b){const w=s[b.id],A=b.uniforms,P=b.__cache;t.bindBuffer(t.UNIFORM_BUFFER,w);for(let v=0,T=A.length;v<T;v++){const L=A[v];if(Array.isArray(L))for(let N=0,k=L.length;N<k;N++)f(L[N],v,N,P);else f(L,v,0,P)}t.bindBuffer(t.UNIFORM_BUFFER,null)}function f(b,w,A,P){if(x(b,w,A,P)===!0){const v=b.__offset,T=b.value;if(Array.isArray(T)){let L=0;for(let N=0;N<T.length;N++){const k=T[N],q=p(k);_(k,b.__data,L),typeof k!="number"&&typeof k!="boolean"&&!k.isMatrix3&&!ArrayBuffer.isView(k)&&(L+=q.storage/Float32Array.BYTES_PER_ELEMENT)}}else _(T,b.__data,0);t.bufferSubData(t.UNIFORM_BUFFER,v,b.__data)}}function _(b,w,A){typeof b=="number"||typeof b=="boolean"?w[0]=b:b.isMatrix3?(w[0]=b.elements[0],w[1]=b.elements[1],w[2]=b.elements[2],w[3]=0,w[4]=b.elements[3],w[5]=b.elements[4],w[6]=b.elements[5],w[7]=0,w[8]=b.elements[6],w[9]=b.elements[7],w[10]=b.elements[8],w[11]=0):ArrayBuffer.isView(b)?w.set(new b.constructor(b.buffer,b.byteOffset,w.length)):b.toArray(w,A)}function x(b,w,A,P){const v=b.value,T=w+"_"+A;if(P[T]===void 0)return typeof v=="number"||typeof v=="boolean"?P[T]=v:ArrayBuffer.isView(v)?P[T]=v.slice():P[T]=v.clone(),!0;{const L=P[T];if(typeof v=="number"||typeof v=="boolean"){if(L!==v)return P[T]=v,!0}else{if(ArrayBuffer.isView(v))return!0;if(L.equals(v)===!1)return L.copy(v),!0}}return!1}function m(b){const w=b.uniforms;let A=0;const P=16;for(let T=0,L=w.length;T<L;T++){const N=Array.isArray(w[T])?w[T]:[w[T]];for(let k=0,q=N.length;k<q;k++){const U=N[k],V=Array.isArray(U.value)?U.value:[U.value];for(let Q=0,X=V.length;Q<X;Q++){const ce=V[Q],j=p(ce),se=A%P,oe=se%j.boundary,Fe=se+oe;A+=oe,Fe!==0&&P-Fe<j.storage&&(A+=P-Fe),U.__data=new Float32Array(j.storage/Float32Array.BYTES_PER_ELEMENT),U.__offset=A,A+=j.storage}}}const v=A%P;return v>0&&(A+=P-v),b.__size=A,b.__cache={},this}function p(b){const w={boundary:0,storage:0};return typeof b=="number"||typeof b=="boolean"?(w.boundary=4,w.storage=4):b.isVector2?(w.boundary=8,w.storage=8):b.isVector3||b.isColor?(w.boundary=16,w.storage=12):b.isVector4?(w.boundary=16,w.storage=16):b.isMatrix3?(w.boundary=48,w.storage=48):b.isMatrix4?(w.boundary=64,w.storage=64):b.isTexture?$e("WebGLRenderer: Texture samplers can not be part of an uniforms group."):ArrayBuffer.isView(b)?(w.boundary=16,w.storage=b.byteLength):$e("WebGLRenderer: Unsupported uniform value type.",b),w}function E(b){const w=b.target;w.removeEventListener("dispose",E);const A=o.indexOf(w.__bindingPointIndex);o.splice(A,1),t.deleteBuffer(s[w.id]),delete s[w.id],delete r[w.id]}function I(){for(const b in s)t.deleteBuffer(s[b]);o=[],s={},r={}}return{bind:c,update:l,dispose:I}}const CI=new Uint16Array([12469,15057,12620,14925,13266,14620,13807,14376,14323,13990,14545,13625,14713,13328,14840,12882,14931,12528,14996,12233,15039,11829,15066,11525,15080,11295,15085,10976,15082,10705,15073,10495,13880,14564,13898,14542,13977,14430,14158,14124,14393,13732,14556,13410,14702,12996,14814,12596,14891,12291,14937,11834,14957,11489,14958,11194,14943,10803,14921,10506,14893,10278,14858,9960,14484,14039,14487,14025,14499,13941,14524,13740,14574,13468,14654,13106,14743,12678,14818,12344,14867,11893,14889,11509,14893,11180,14881,10751,14852,10428,14812,10128,14765,9754,14712,9466,14764,13480,14764,13475,14766,13440,14766,13347,14769,13070,14786,12713,14816,12387,14844,11957,14860,11549,14868,11215,14855,10751,14825,10403,14782,10044,14729,9651,14666,9352,14599,9029,14967,12835,14966,12831,14963,12804,14954,12723,14936,12564,14917,12347,14900,11958,14886,11569,14878,11247,14859,10765,14828,10401,14784,10011,14727,9600,14660,9289,14586,8893,14508,8533,15111,12234,15110,12234,15104,12216,15092,12156,15067,12010,15028,11776,14981,11500,14942,11205,14902,10752,14861,10393,14812,9991,14752,9570,14682,9252,14603,8808,14519,8445,14431,8145,15209,11449,15208,11451,15202,11451,15190,11438,15163,11384,15117,11274,15055,10979,14994,10648,14932,10343,14871,9936,14803,9532,14729,9218,14645,8742,14556,8381,14461,8020,14365,7603,15273,10603,15272,10607,15267,10619,15256,10631,15231,10614,15182,10535,15118,10389,15042,10167,14963,9787,14883,9447,14800,9115,14710,8665,14615,8318,14514,7911,14411,7507,14279,7198,15314,9675,15313,9683,15309,9712,15298,9759,15277,9797,15229,9773,15166,9668,15084,9487,14995,9274,14898,8910,14800,8539,14697,8234,14590,7790,14479,7409,14367,7067,14178,6621,15337,8619,15337,8631,15333,8677,15325,8769,15305,8871,15264,8940,15202,8909,15119,8775,15022,8565,14916,8328,14804,8009,14688,7614,14569,7287,14448,6888,14321,6483,14088,6171,15350,7402,15350,7419,15347,7480,15340,7613,15322,7804,15287,7973,15229,8057,15148,8012,15046,7846,14933,7611,14810,7357,14682,7069,14552,6656,14421,6316,14251,5948,14007,5528,15356,5942,15356,5977,15353,6119,15348,6294,15332,6551,15302,6824,15249,7044,15171,7122,15070,7050,14949,6861,14818,6611,14679,6349,14538,6067,14398,5651,14189,5311,13935,4958,15359,4123,15359,4153,15356,4296,15353,4646,15338,5160,15311,5508,15263,5829,15188,6042,15088,6094,14966,6001,14826,5796,14678,5543,14527,5287,14377,4985,14133,4586,13869,4257,15360,1563,15360,1642,15358,2076,15354,2636,15341,3350,15317,4019,15273,4429,15203,4732,15105,4911,14981,4932,14836,4818,14679,4621,14517,4386,14359,4156,14083,3795,13808,3437,15360,122,15360,137,15358,285,15355,636,15344,1274,15322,2177,15281,2765,15215,3223,15120,3451,14995,3569,14846,3567,14681,3466,14511,3305,14344,3121,14037,2800,13753,2467,15360,0,15360,1,15359,21,15355,89,15346,253,15325,479,15287,796,15225,1148,15133,1492,15008,1749,14856,1882,14685,1886,14506,1783,14324,1608,13996,1398,13702,1183]);let hi=null;function PI(){return hi===null&&(hi=new SA(CI,16,16,Ps,xi),hi.name="DFG_LUT",hi.minFilter=_n,hi.magFilter=_n,hi.wrapS=Ui,hi.wrapT=Ui,hi.generateMipmaps=!1,hi.needsUpdate=!0),hi}class LI{constructor(e={}){const{canvas:n=Iw(),context:i=null,depth:s=!0,stencil:r=!1,alpha:o=!1,antialias:a=!1,premultipliedAlpha:c=!0,preserveDrawingBuffer:l=!1,powerPreference:u="default",failIfMajorPerformanceCaveat:h=!1,reversedDepthBuffer:d=!1,outputBufferType:f=$n}=e;this.isWebGLRenderer=!0;let _;if(i!==null){if(typeof WebGLRenderingContext<"u"&&i instanceof WebGLRenderingContext)throw new Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");_=i.getContextAttributes().alpha}else _=o;const x=f,m=new Set([zd,kd,Fd]),p=new Set([$n,vi,lo,uo,Ud,Od]),E=new Uint32Array(4),I=new Int32Array(4),b=new H;let w=null,A=null;const P=[],v=[];let T=null;this.domElement=n,this.debug={checkShaderErrors:!0,diagnostics:{keywords:!1},onShaderError:null},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.toneMapping=_i,this.toneMappingExposure=1,this.transmissionResolutionScale=1;const L=this;let N=!1,k=null,q=null,U=null,V=null;this._outputColorSpace=Vn;let Q=0,X=0,ce=null,j=-1,se=null;const oe=new Vt,Fe=new Vt;let Ie=null;const mt=new at(0);let tt=0,Je=n.width,Y=n.height,re=1,Re=null,Ge=null;const Me=new Vt(0,0,Je,Y),We=new Vt(0,0,Je,Y);let Lt=!1;const Xe=new US;let st=!1,St=!1;const Qe=new $t,xt=new H,Ot=new Vt,qt={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};let Mt=!1;function It(){return ce===null?re:1}let F=i;function Bt(y,D){return n.getContext(y,D)}let dt,R,S,z,Z,K,le,de,J,ne,he,Ne,ue,me,Pe,ze,qe,O,fe,te,ge,ye,ie;try{const y={alpha:!0,depth:s,stencil:r,antialias:a,premultipliedAlpha:c,preserveDrawingBuffer:l,powerPreference:u,failIfMajorPerformanceCaveat:h};if("setAttribute"in n&&n.setAttribute("data-engine",`three.js r${Nd}`),n.addEventListener("webglcontextlost",_t,!1),n.addEventListener("webglcontextrestored",lt,!1),n.addEventListener("webglcontextcreationerror",an,!1),F===null){const D="webgl2";if(F=Bt(D,y),F===null)throw Bt(D)?new Error("THREE.WebGLRenderer: Error creating WebGL context with your selected attributes."):new Error("THREE.WebGLRenderer: Error creating WebGL context.")}De()}catch(y){throw n.removeEventListener("webglcontextlost",_t,!1),n.removeEventListener("webglcontextrestored",lt,!1),n.removeEventListener("webglcontextcreationerror",an,!1),vt("WebGLRenderer: "+y.message),y}function De(){dt=new P1(F),dt.init(),ge=new yI(F,dt),R=new x1(F,dt,e,ge),S=new vI(F,dt),R.reversedDepthBuffer&&d&&S.buffers.depth.setReversed(!0),q=F.createFramebuffer(),U=F.createFramebuffer(),V=F.createFramebuffer(),z=new N1(F),Z=new rI,K=new xI(F,dt,S,Z,R,ge,z),le=new C1(L),de=new UA(F),ye=new S1(F,de),J=new L1(F,de,z,ye),ne=new U1(F,J,de,ye,z),O=new D1(F,R,K),Pe=new y1(Z),he=new sI(L,le,dt,R,ye,Pe),Ne=new wI(L,Z),ue=new aI,me=new fI(dt),qe=new _1(L,le,S,ne,_,c),ze=new SI(L,ne,R),ie=new AI(F,z,R,S),fe=new v1(F,dt,z),te=new I1(F,dt,z),z.programs=he.programs,L.capabilities=R,L.extensions=dt,L.properties=Z,L.renderLists=ue,L.shadowMap=ze,L.state=S,L.info=z}x!==$n&&(T=new F1(x,n.width,n.height,a,s,r));const Ce=new TI(L,F);this.xr=Ce,this.getContext=function(){return F},this.getContextAttributes=function(){return F.getContextAttributes()},this.forceContextLoss=function(){const y=dt.get("WEBGL_lose_context");y&&y.loseContext()},this.forceContextRestore=function(){const y=dt.get("WEBGL_lose_context");y&&y.restoreContext()},this.getPixelRatio=function(){return re},this.setPixelRatio=function(y){y!==void 0&&(re=y,this.setSize(Je,Y,!1))},this.getSize=function(y){return y.set(Je,Y)},this.setSize=function(y,D,W=!0){if(Ce.isPresenting){$e("WebGLRenderer: Can't change size while VR device is presenting.");return}Je=y,Y=D,n.width=Math.floor(y*re),n.height=Math.floor(D*re),W===!0&&(n.style.width=y+"px",n.style.height=D+"px"),T!==null&&T.setSize(n.width,n.height),this.setViewport(0,0,y,D)},this.getDrawingBufferSize=function(y){return y.set(Je*re,Y*re).floor()},this.setDrawingBufferSize=function(y,D,W){Je=y,Y=D,re=W,n.width=Math.floor(y*W),n.height=Math.floor(D*W),this.setViewport(0,0,y,D)},this.setEffects=function(y){if(x===$n){vt("WebGLRenderer: setEffects() requires outputBufferType set to HalfFloatType or FloatType.");return}if(y){for(let D=0;D<y.length;D++)if(y[D].isOutputPass===!0){$e("WebGLRenderer: OutputPass is not needed in setEffects(). Tone mapping and color space conversion are applied automatically.");break}}T.setEffects(y||[])},this.getCurrentViewport=function(y){return y.copy(oe)},this.getViewport=function(y){return y.copy(Me)},this.setViewport=function(y,D,W,B){y.isVector4?Me.set(y.x,y.y,y.z,y.w):Me.set(y,D,W,B),S.viewport(oe.copy(Me).multiplyScalar(re).round())},this.getScissor=function(y){return y.copy(We)},this.setScissor=function(y,D,W,B){y.isVector4?We.set(y.x,y.y,y.z,y.w):We.set(y,D,W,B),S.scissor(Fe.copy(We).multiplyScalar(re).round())},this.getScissorTest=function(){return Lt},this.setScissorTest=function(y){S.setScissorTest(Lt=y)},this.setOpaqueSort=function(y){Re=y},this.setTransparentSort=function(y){Ge=y},this.getClearColor=function(y){return y.copy(qe.getClearColor())},this.setClearColor=function(){qe.setClearColor(...arguments)},this.getClearAlpha=function(){return qe.getClearAlpha()},this.setClearAlpha=function(){qe.setClearAlpha(...arguments)},this.clear=function(y=!0,D=!0,W=!0){let B=0;if(y){let $=!1;if(ce!==null){const pe=ce.texture.format;$=m.has(pe)}if($){const pe=ce.texture.type,Te=p.has(pe),ve=qe.getClearColor(),we=qe.getClearAlpha(),Le=ve.r,Ye=ve.g,et=ve.b;Te?(E[0]=Le,E[1]=Ye,E[2]=et,E[3]=we,F.clearBufferuiv(F.COLOR,0,E)):(I[0]=Le,I[1]=Ye,I[2]=et,I[3]=we,F.clearBufferiv(F.COLOR,0,I))}else B|=F.COLOR_BUFFER_BIT}D&&(B|=F.DEPTH_BUFFER_BIT,this.state.buffers.depth.setMask(!0)),W&&(B|=F.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),B!==0&&F.clear(B)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.setNodesHandler=function(y){y.setRenderer(this),k=y},this.dispose=function(){n.removeEventListener("webglcontextlost",_t,!1),n.removeEventListener("webglcontextrestored",lt,!1),n.removeEventListener("webglcontextcreationerror",an,!1),qe.dispose(),ue.dispose(),me.dispose(),Z.dispose(),le.dispose(),ne.dispose(),ye.dispose(),ie.dispose(),he.dispose(),Ce.dispose(),Ce.removeEventListener("sessionstart",Gi),Ce.removeEventListener("sessionend",Zn),Dn.stop()};function _t(y){y.preventDefault(),xf("WebGLRenderer: Context Lost."),N=!0}function lt(){xf("WebGLRenderer: Context Restored."),N=!1;const y=z.autoReset,D=ze.enabled,W=ze.autoUpdate,B=ze.needsUpdate,$=ze.type;De(),z.autoReset=y,ze.enabled=D,ze.autoUpdate=W,ze.needsUpdate=B,ze.type=$}function an(y){vt("WebGLRenderer: A WebGL context could not be created. Reason: ",y.statusMessage)}function dn(y){const D=y.target;D.removeEventListener("dispose",dn),ds(D)}function ds(y){hs(y),Z.remove(y)}function hs(y){const D=Z.get(y).programs;D!==void 0&&(D.forEach(function(W){he.releaseProgram(W)}),y.isShaderMaterial&&he.releaseShaderCache(y))}this.renderBufferDirect=function(y,D,W,B,$,pe){D===null&&(D=qt);const Te=$.isMesh&&$.matrixWorld.determinantAffine()<0,ve=ps(y,D,W,B,$);S.setMaterial(B,Te);let we=W.index,Le=1;if(B.wireframe===!0){if(we=J.getWireframeAttribute(W),we===void 0)return;Le=2}const Ye=W.drawRange,et=W.attributes.position;let Ae=Ye.start*Le,ut=(Ye.start+Ye.count)*Le;pe!==null&&(Ae=Math.max(Ae,pe.start*Le),ut=Math.min(ut,(pe.start+pe.count)*Le)),we!==null?(Ae=Math.max(Ae,0),ut=Math.min(ut,we.count)):et!=null&&(Ae=Math.max(Ae,0),ut=Math.min(ut,et.count));const Dt=ut-Ae;if(Dt<0||Dt===1/0)return;ye.setup($,B,ve,W,we);let yt,gt=fe;if(we!==null&&(yt=de.get(we),gt=te,gt.setIndex(yt)),$.isMesh)B.wireframe===!0?(S.setLineWidth(B.wireframeLinewidth*It()),gt.setMode(F.LINES)):gt.setMode(F.TRIANGLES);else if($.isLine){let Ht=B.linewidth;Ht===void 0&&(Ht=1),S.setLineWidth(Ht*It()),$.isLineSegments?gt.setMode(F.LINES):$.isLineLoop?gt.setMode(F.LINE_LOOP):gt.setMode(F.LINE_STRIP)}else $.isPoints?gt.setMode(F.POINTS):$.isSprite&>.setMode(F.TRIANGLES);if($.isBatchedMesh)if(dt.get("WEBGL_multi_draw"))gt.renderMultiDraw($._multiDrawStarts,$._multiDrawCounts,$._multiDrawCount);else{const Ht=$._multiDrawStarts,Ee=$._multiDrawCounts,Wt=$._multiDrawCount,it=we?de.get(we).bytesPerElement:1,Gt=Z.get(B).currentProgram.getUniforms();for(let Ut=0;Ut<Wt;Ut++)Gt.setValue(F,"_gl_DrawID",Ut),gt.render(Ht[Ut]/it,Ee[Ut])}else if($.isInstancedMesh)gt.renderInstances(Ae,Dt,$.count);else if(W.isInstancedBufferGeometry){const Ht=W._maxInstanceCount!==void 0?W._maxInstanceCount:1/0,Ee=Math.min(W.instanceCount,Ht);gt.renderInstances(Ae,Dt,Ee)}else gt.render(Ae,Dt)};function Vi(y,D,W,B){k!==null&&y.isNodeMaterial&&k.setObject(B,y),st===!0&&Pe.setState(y,W,!1),y.transparent===!0&&y.side===Ni&&y.forceSinglePass===!1?(y.side=Cn,y.needsUpdate=!0,ai(y,D,B),y.side=As,y.needsUpdate=!0,ai(y,D,B),y.side=Ni):ai(y,D,B)}this.compile=function(y,D,W=null){W===null&&(W=y),k!==null&&k.renderStart(y,D,W),A=me.get(W),A.init(D),v.push(A),W.traverseVisible(function($){$.isLight&&$.layers.test(D.layers)&&(A.pushLight($),$.castShadow&&A.pushShadow($))}),y!==W&&y.traverseVisible(function($){$.isLight&&$.layers.test(D.layers)&&(A.pushLight($),$.castShadow&&A.pushShadow($))}),A.setupLights(),k!==null&&k.updateLights(A.state.lightsArray),St=this.localClippingEnabled,st=Pe.init(this.clippingPlanes,St),st===!0&&Pe.setGlobalState(this.clippingPlanes,D),k!==null&&ze.render(A.state.shadowsArray,W,D);const B=new Set;return y.traverse(function($){if(!($.isMesh||$.isPoints||$.isLine||$.isSprite))return;const pe=$.material;if(pe)if(Array.isArray(pe))for(let Te=0;Te<pe.length;Te++){const ve=pe[Te];Vi(ve,W,D,$),B.add(ve)}else Vi(pe,W,D,$),B.add(pe)}),A=v.pop(),k!==null&&k.renderEnd(),B},this.compileAsync=function(y,D,W=null){const B=this.compile(y,D,W);return new Promise($=>{function pe(){if(B.forEach(function(Te){const we=Z.get(Te).currentProgram;(we===void 0||we.isReady())&&B.delete(Te)}),B.size===0){$(y);return}setTimeout(pe,10)}dt.get("KHR_parallel_shader_compile")!==null?pe():setTimeout(pe,10)})};let Mi=null;function zs(y){Mi&&Mi(y)}function Gi(){Dn.stop()}function Zn(){Dn.start()}const Dn=new VS;Dn.setAnimationLoop(zs),typeof self<"u"&&Dn.setContext(self),this.setAnimationLoop=function(y){Mi=y,Ce.setAnimationLoop(y),y===null?Dn.stop():Dn.start()},Ce.addEventListener("sessionstart",Gi),Ce.addEventListener("sessionend",Zn),this.render=function(y,D){if(D!==void 0&&D.isCamera!==!0){vt("WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(N===!0)return;k!==null&&k.renderStart(y,D);const W=Ce.enabled===!0&&Ce.isPresenting===!0,B=T!==null&&(ce===null||W)&&T.begin(L,ce);if(y.matrixWorldAutoUpdate===!0&&y.updateMatrixWorld(),D.parent===null&&D.matrixWorldAutoUpdate===!0&&D.updateMatrixWorld(),Ce.enabled===!0&&Ce.isPresenting===!0&&(T===null||T.isCompositing()===!1)&&(Ce.cameraAutoUpdate===!0&&Ce.updateCamera(D),D=Ce.getCamera()),y.isScene===!0&&y.onBeforeRender(L,y,D,ce),A=me.get(y,v.length),A.init(D),A.state.textureUnits=K.getTextureUnits(),v.push(A),Qe.multiplyMatrices(D.projectionMatrix,D.matrixWorldInverse),Xe.setFromProjectionMatrix(Qe,gi,D.reversedDepth),St=this.localClippingEnabled,st=Pe.init(this.clippingPlanes,St),w=ue.get(y,P.length),w.init(),P.push(w),Ce.enabled===!0&&Ce.isPresenting===!0){const Te=L.xr.getDepthSensingMesh();Te!==null&&Ei(Te,D,-1/0,L.sortObjects)}Ei(y,D,0,L.sortObjects),w.finish(),k!==null&&k.updateLights(A.state.lightsArray),L.sortObjects===!0&&w.sort(Re,Ge),Mt=Ce.enabled===!1||Ce.isPresenting===!1||Ce.hasDepthSensing()===!1,Mt&&qe.addToRenderList(w,y),this.info.render.frame++,this.info.autoReset===!0&&this.info.reset(),st===!0&&Pe.beginShadows();const $=A.state.shadowsArray;if(ze.render($,y,D),st===!0&&Pe.endShadows(),(B&&T.hasRenderPass())===!1){const Te=w.opaque,ve=w.transmissive;if(A.setupLights(),D.isArrayCamera){const we=D.cameras;if(ve.length>0)for(let Le=0,Ye=we.length;Le<Ye;Le++){const et=we[Le];qi(Te,ve,y,et)}Mt&&qe.render(y);for(let Le=0,Ye=we.length;Le<Ye;Le++){const et=we[Le];$i(w,y,et,et.viewport)}}else ve.length>0&&qi(Te,ve,y,D),Mt&&qe.render(y),$i(w,y,D)}ce!==null&&X===0&&(K.updateMultisampleRenderTarget(ce),K.updateRenderTargetMipmap(ce)),B&&T.end(L),y.isScene===!0&&y.onAfterRender(L,y,D),ye.resetDefaultState(),j=-1,se=null,v.pop(),v.length>0?(A=v[v.length-1],K.setTextureUnits(A.state.textureUnits),st===!0&&Pe.setGlobalState(L.clippingPlanes,A.state.camera)):A=null,P.pop(),P.length>0?w=P[P.length-1]:w=null,k!==null&&k.renderEnd()};function Ei(y,D,W,B){if(y.visible===!1)return;if(y.layers.test(D.layers)){if(y.isGroup)W=y.renderOrder;else if(y.isLOD)y.autoUpdate===!0&&y.update(D);else if(y.isLightProbeGrid)A.pushLightProbeGrid(y);else if(y.isLight)A.pushLight(y),y.castShadow&&A.pushShadow(y);else if(y.isSprite){if(!y.frustumCulled||y.intersectsFrustum(Xe)){B&&Ot.setFromMatrixPosition(y.matrixWorld).applyMatrix4(Qe);const Te=ne.update(y),ve=y.material;ve.visible&&w.push(y,Te,ve,W,Ot.z,null,D)}}else if((y.isMesh||y.isLine||y.isPoints)&&(!y.frustumCulled||y.intersectsFrustum(Xe))){const Te=ne.update(y),ve=y.material;if(B&&(y.boundingSphere!==void 0?(y.boundingSphere===null&&y.computeBoundingSphere(),Ot.copy(y.boundingSphere.center)):(Te.boundingSphere===null&&Te.computeBoundingSphere(),Ot.copy(Te.boundingSphere.center)),Ot.applyMatrix4(y.matrixWorld).applyMatrix4(Qe)),Array.isArray(ve)){const we=Te.groups;for(let Le=0,Ye=we.length;Le<Ye;Le++){const et=we[Le],Ae=ve[et.materialIndex];Ae&&Ae.visible&&w.push(y,Te,Ae,W,Ot.z,et,D)}}else ve.visible&&w.push(y,Te,ve,W,Ot.z,null,D)}}const pe=y.children;for(let Te=0,ve=pe.length;Te<ve;Te++)Ei(pe[Te],D,W,B)}function $i(y,D,W,B){const{opaque:$,transmissive:pe,transparent:Te}=y;A.setupLightsView(W),st===!0&&Pe.setGlobalState(L.clippingPlanes,W),B&&S.viewport(oe.copy(B)),$.length>0&&oi($,D,W),pe.length>0&&oi(pe,D,W),Te.length>0&&oi(Te,D,W),S.buffers.depth.setTest(!0),S.buffers.depth.setMask(!0),S.buffers.color.setMask(!0),S.setPolygonOffset(!1)}function qi(y,D,W,B){if((W.isScene===!0?W.overrideMaterial:null)!==null)return;if(A.state.transmissionRenderTarget[B.id]===void 0){const Ae=dt.has("EXT_color_buffer_half_float")||dt.has("EXT_color_buffer_float");A.state.transmissionRenderTarget[B.id]=new ei(1,1,{generateMipmaps:!0,type:Ae?xi:$n,minFilter:ys,samples:Math.max(4,R.samples),stencilBuffer:r,resolveDepthBuffer:!1,resolveStencilBuffer:!1,storeMultisampledDepthBuffer:!1,storeMultisampledStencilBuffer:!1,colorSpace:ft.workingColorSpace})}const pe=A.state.transmissionRenderTarget[B.id],Te=B.viewport||oe;pe.setSize(Te.z*L.transmissionResolutionScale,Te.w*L.transmissionResolutionScale);const ve=L.getRenderTarget(),we=L.getActiveCubeFace(),Le=L.getActiveMipmapLevel();L.setRenderTarget(pe),L.getClearColor(mt),tt=L.getClearAlpha(),tt<1&&L.setClearColor(16777215,.5),L.clear(),Mt&&qe.render(W);const Ye=L.toneMapping;L.toneMapping=_i;const et=B.viewport;if(B.viewport!==void 0&&(B.viewport=void 0),A.setupLightsView(B),st===!0&&Pe.setGlobalState(L.clippingPlanes,B),oi(y,W,B),K.updateMultisampleRenderTarget(pe),K.updateRenderTargetMipmap(pe),dt.has("WEBGL_multisampled_render_to_texture")===!1){let Ae=!1;for(let ut=0,Dt=D.length;ut<Dt;ut++){const yt=D[ut],{object:gt,geometry:Ht,material:Ee,group:Wt}=yt;if(Ee.side===Ni&>.layers.test(B.layers)){const it=Ee.side;Ee.side=Cn,Ee.needsUpdate=!0,Wi(gt,W,B,Ht,Ee,Wt),Ee.side=it,Ee.needsUpdate=!0,Ae=!0}}Ae===!0&&(K.updateMultisampleRenderTarget(pe),K.updateRenderTargetMipmap(pe))}L.setRenderTarget(ve,we,Le),L.setClearColor(mt,tt),et!==void 0&&(B.viewport=et),L.toneMapping=Ye}function oi(y,D,W){const B=D.isScene===!0?D.overrideMaterial:null;for(let $=0,pe=y.length;$<pe;$++){const Te=y[$],{object:ve,geometry:we,group:Le}=Te;let Ye=Te.material;Ye.allowOverride===!0&&B!==null&&(Ye=B),ve.layers.test(W.layers)&&Wi(ve,D,W,we,Ye,Le)}}function Wi(y,D,W,B,$,pe){k!==null&&$.isNodeMaterial&&k.setObject(y,$),y.onBeforeRender(L,D,W,B,$,pe),y.modelViewMatrix.multiplyMatrices(W.matrixWorldInverse,y.matrixWorld),y.normalMatrix.getNormalMatrix(y.modelViewMatrix),$.onBeforeRender(L,D,W,B,y,pe),$.transparent===!0&&$.side===Ni&&$.forceSinglePass===!1?($.side=Cn,$.needsUpdate=!0,L.renderBufferDirect(W,D,B,$,y,pe),$.side=As,$.needsUpdate=!0,L.renderBufferDirect(W,D,B,$,y,pe),$.side=Ni):L.renderBufferDirect(W,D,B,$,y,pe),y.onAfterRender(L,D,W,B,$,pe)}function ai(y,D,W){D.isScene!==!0&&(D=qt);const B=Z.get(y),$=A.state.lights,pe=A.state.shadowsArray,Te=$.state.version,ve=he.getParameters(y,$.state,pe,D,W,A.state.lightProbeGridArray),we=he.getProgramCacheKey(ve);let Le=B.programs;B.environment=y.isMeshStandardMaterial||y.isMeshLambertMaterial||y.isMeshPhongMaterial?D.environment:null,B.fog=D.fog;const Ye=y.isMeshStandardMaterial||y.isMeshLambertMaterial&&!y.envMap||y.isMeshPhongMaterial&&!y.envMap;B.envMap=le.get(y.envMap||B.environment,Ye),B.envMapRotation=B.environment!==null&&y.envMap===null?D.environmentRotation:y.envMapRotation,Le===void 0&&(y.addEventListener("dispose",dn),Le=new Map,B.programs=Le);let et=Le.get(we);if(et!==void 0){if(B.currentProgram===et&&B.lightsStateVersion===Te)return Xi(y,ve),et}else ve.uniforms=he.getUniforms(y),k!==null&&y.isNodeMaterial&&k.build(y,W,ve),y.onBeforeCompile(ve,L),et=he.acquireProgram(ve,we),Le.set(we,et),B.uniforms=ve.uniforms;const Ae=B.uniforms;return(!y.isShaderMaterial&&!y.isRawShaderMaterial||y.clipping===!0)&&(Ae.clippingPlanes=Pe.uniform),Xi(y,ve),B.needsLights=Ti(y),B.lightsStateVersion=Te,B.needsLights&&(Ae.ambientLightColor.value=$.state.ambient,Ae.lightProbe.value=$.state.probe,Ae.sunLights.value=$.state.sun,Ae.sunLightShadows.value=$.state.sunShadow,Ae.directionalLights.value=$.state.directional,Ae.directionalLightShadows.value=$.state.directionalShadow,Ae.spotLights.value=$.state.spot,Ae.spotLightShadows.value=$.state.spotShadow,Ae.rectAreaLights.value=$.state.rectArea,Ae.ltc_1.value=$.state.rectAreaLTC1,Ae.ltc_2.value=$.state.rectAreaLTC2,Ae.pointLights.value=$.state.point,Ae.pointLightShadows.value=$.state.pointShadow,Ae.hemisphereLights.value=$.state.hemi,Ae.sunShadowMatrix.value=$.state.sunShadowMatrix,Ae.sunShadowCascade.value=$.state.sunShadowCascade,Ae.directionalShadowMatrix.value=$.state.directionalShadowMatrix,Ae.spotLightMatrix.value=$.state.spotLightMatrix,Ae.spotLightMap.value=$.state.spotLightMap,Ae.pointShadowMatrix.value=$.state.pointShadowMatrix),B.lightProbeGrid=A.state.lightProbeGridArray.length>0,B.currentProgram=et,B.uniformsList=null,et}function Zi(y){if(y.uniformsList===null){const D=y.currentProgram.getUniforms();y.uniformsList=da.seqWithValue(D.seq,y.uniforms)}return y.uniformsList}function Xi(y,D){const W=Z.get(y);W.outputColorSpace=D.outputColorSpace,W.batching=D.batching,W.batchingColor=D.batchingColor,W.instancing=D.instancing,W.instancingColor=D.instancingColor,W.instancingMorph=D.instancingMorph,W.skinning=D.skinning,W.morphTargets=D.morphTargets,W.morphNormals=D.morphNormals,W.morphColors=D.morphColors,W.morphTargetsCount=D.morphTargetsCount,W.numClippingPlanes=D.numClippingPlanes,W.numIntersection=D.numClipIntersection,W.vertexAlphas=D.vertexAlphas,W.vertexTangents=D.vertexTangents,W.toneMapping=D.toneMapping}function fs(y,D){if(y.length===0)return null;if(y.length===1)return y[0].texture!==null?y[0]:null;b.setFromMatrixPosition(D.matrixWorld);for(let W=0,B=y.length;W<B;W++){const $=y[W];if($.texture!==null&&$.boundingBox.containsPoint(b))return $}return null}function ps(y,D,W,B,$){D.isScene!==!0&&(D=qt),K.resetTextureUnits();const pe=D.fog,Te=B.isMeshStandardMaterial||B.isMeshLambertMaterial||B.isMeshPhongMaterial?D.environment:null,ve=ce===null?L.outputColorSpace:ce.isXRRenderTarget===!0?ce.texture.colorSpace:ft.workingColorSpace,we=B.isMeshStandardMaterial||B.isMeshLambertMaterial&&!B.envMap||B.isMeshPhongMaterial&&!B.envMap,Le=le.get(B.envMap||Te,we),Ye=B.vertexColors===!0&&!!W.attributes.color&&W.attributes.color.itemSize===4,et=!!W.attributes.tangent&&(!!B.normalMap||B.anisotropy>0),Ae=!!W.morphAttributes.position,ut=!!W.morphAttributes.normal,Dt=!!W.morphAttributes.color;let yt=_i;B.toneMapped&&(ce===null||ce.isXRRenderTarget===!0)&&(yt=L.toneMapping);const gt=W.morphAttributes.position||W.morphAttributes.normal||W.morphAttributes.color,Ht=gt!==void 0?gt.length:0,Ee=Z.get(B),Wt=A.state.lights;if(st===!0&&(St===!0||y!==se)){const bt=y===se&&B.id===j;Pe.setState(B,y,bt)}let it=!1;B.version===Ee.__version?(Ee.needsLights&&Ee.lightsStateVersion!==Wt.state.version||Ee.outputColorSpace!==ve||$.isBatchedMesh&&Ee.batching===!1||!$.isBatchedMesh&&Ee.batching===!0||$.isBatchedMesh&&Ee.batchingColor===!0&&$._colorsTexture===null||$.isBatchedMesh&&Ee.batchingColor===!1&&$._colorsTexture!==null||$.isInstancedMesh&&Ee.instancing===!1||!$.isInstancedMesh&&Ee.instancing===!0||$.isSkinnedMesh&&Ee.skinning===!1||!$.isSkinnedMesh&&Ee.skinning===!0||$.isInstancedMesh&&Ee.instancingColor===!0&&$.instanceColor===null||$.isInstancedMesh&&Ee.instancingColor===!1&&$.instanceColor!==null||$.isInstancedMesh&&Ee.instancingMorph===!0&&$.morphTexture===null||$.isInstancedMesh&&Ee.instancingMorph===!1&&$.morphTexture!==null||Ee.envMap!==Le||B.fog===!0&&Ee.fog!==pe||Ee.numClippingPlanes!==void 0&&(Ee.numClippingPlanes!==Pe.numPlanes||Ee.numIntersection!==Pe.numIntersection)||Ee.vertexAlphas!==Ye||Ee.vertexTangents!==et||Ee.morphTargets!==Ae||Ee.morphNormals!==ut||Ee.morphColors!==Dt||Ee.toneMapping!==yt||Ee.morphTargetsCount!==Ht||!!Ee.lightProbeGrid!=A.state.lightProbeGridArray.length>0)&&(it=!0):(it=!0,Ee.__version=B.version);let Gt=Ee.currentProgram;it===!0&&(Gt=ai(B,D,$),k&&B.isNodeMaterial&&k.onUpdateProgram(B,Gt,Ee));let Ut=!1,Un=!1,Rn=!1;const ht=Gt.getUniforms(),Rt=Ee.uniforms;if(S.useProgram(Gt.program)&&(Ut=!0,Un=!0,Rn=!0),B.id!==j&&(j=B.id,Un=!0),Ee.needsLights){const bt=fs(A.state.lightProbeGridArray,$);Ee.lightProbeGrid!==bt&&(Ee.lightProbeGrid=bt,Un=!0)}if(Ut||se!==y){S.buffers.depth.getReversed()&&y.reversedDepth!==!0&&(y._reversedDepth=!0,y.updateProjectionMatrix()),ht.setValue(F,"projectionMatrix",y.projectionMatrix),ht.setValue(F,"viewMatrix",y.matrixWorldInverse);const Ft=ht.map.cameraPosition;Ft!==void 0&&Ft.setValue(F,xt.setFromMatrixPosition(y.matrixWorld)),R.logarithmicDepthBuffer&&ht.setValue(F,"logDepthBufFC",2/(Math.log(y.far+1)/Math.LN2)),(B.isMeshPhongMaterial||B.isMeshToonMaterial||B.isMeshLambertMaterial||B.isMeshBasicMaterial||B.isMeshStandardMaterial||B.isShaderMaterial)&&ht.setValue(F,"isOrthographic",y.isOrthographicCamera===!0),se!==y&&(se=y,Un=!0,Rn=!0)}if(Ee.needsLights&&(Wt.state.sunShadowMap.length>0&&ht.setValue(F,"sunShadowMap",Wt.state.sunShadowMap,K),Wt.state.directionalShadowMap.length>0&&ht.setValue(F,"directionalShadowMap",Wt.state.directionalShadowMap,K),Wt.state.spotShadowMap.length>0&&ht.setValue(F,"spotShadowMap",Wt.state.spotShadowMap,K),Wt.state.pointShadowMap.length>0&&ht.setValue(F,"pointShadowMap",Wt.state.pointShadowMap,K)),$.isSkinnedMesh){ht.setOptional(F,$,"bindMatrix"),ht.setOptional(F,$,"bindMatrixInverse");const bt=$.skeleton;bt&&(bt.boneTexture===null&&bt.computeBoneTexture(),ht.setValue(F,"boneTexture",bt.boneTexture,K))}$.isBatchedMesh&&(ht.setOptional(F,$,"batchingTexture"),ht.setValue(F,"batchingTexture",$._matricesTexture,K),ht.setOptional(F,$,"batchingIdTexture"),ht.setValue(F,"batchingIdTexture",$._indirectTexture,K),ht.setOptional(F,$,"batchingColorTexture"),$._colorsTexture!==null&&ht.setValue(F,"batchingColorTexture",$._colorsTexture,K));const vn=W.morphAttributes;if((vn.position!==void 0||vn.normal!==void 0||vn.color!==void 0)&&O.update($,W,Gt),(Un||Ee.receiveShadow!==$.receiveShadow)&&(Ee.receiveShadow=$.receiveShadow,ht.setValue(F,"receiveShadow",$.receiveShadow)),(B.isMeshStandardMaterial||B.isMeshLambertMaterial||B.isMeshPhongMaterial)&&B.envMap===null&&D.environment!==null&&(Rt.envMapIntensity.value=D.environmentIntensity),Rt.dfgLUT!==void 0&&(Rt.dfgLUT.value=PI()),Un){if(ht.setValue(F,"toneMappingExposure",L.toneMappingExposure),Ee.needsLights&&ms(Rt,Rn),pe&&B.fog===!0&&Ne.refreshFogUniforms(Rt,pe),Ne.refreshMaterialUniforms(Rt,B,re,Y,A.state.transmissionRenderTarget[y.id]),Ee.needsLights&&Ee.lightProbeGrid){const bt=Ee.lightProbeGrid;Rt.probesSH.value=bt.texture,Rt.probesMin.value.copy(bt.boundingBox.min),Rt.probesMax.value.copy(bt.boundingBox.max),Rt.probesResolution.value.copy(bt.resolution)}da.upload(F,Zi(Ee),Rt,K)}if(B.isShaderMaterial&&B.uniformsNeedUpdate===!0&&(da.upload(F,Zi(Ee),Rt,K),B.uniformsNeedUpdate=!1),B.isSpriteMaterial&&ht.setValue(F,"center",$.center),ht.setValue(F,"modelViewMatrix",$.modelViewMatrix),ht.setValue(F,"normalMatrix",$.normalMatrix),ht.setValue(F,"modelMatrix",$.matrixWorld),B.uniformsGroups!==void 0){const bt=B.uniformsGroups;for(let Ft=0,wt=bt.length;Ft<wt;Ft++){const li=bt[Ft];ie.update(li,Gt),ie.bind(li,Gt)}}return Gt}function ms(y,D){y.ambientLightColor.needsUpdate=D,y.lightProbe.needsUpdate=D,y.sunLights.needsUpdate=D,y.sunLightShadows.needsUpdate=D,y.directionalLights.needsUpdate=D,y.directionalLightShadows.needsUpdate=D,y.pointLights.needsUpdate=D,y.pointLightShadows.needsUpdate=D,y.spotLights.needsUpdate=D,y.spotLightShadows.needsUpdate=D,y.rectAreaLights.needsUpdate=D,y.hemisphereLights.needsUpdate=D}function Ti(y){return y.isMeshLambertMaterial||y.isMeshToonMaterial||y.isMeshPhongMaterial||y.isMeshStandardMaterial||y.isShadowMaterial||y.isShaderMaterial&&y.lights===!0}this.getActiveCubeFace=function(){return Q},this.getActiveMipmapLevel=function(){return X},this.getRenderTarget=function(){return ce},this.setRenderTargetTextures=function(y,D,W){const B=Z.get(y);B.__autoAllocateDepthBuffer=y.resolveDepthBuffer===!1,B.__autoAllocateDepthBuffer===!1&&(B.__useRenderToTexture=!1),Z.get(y.texture).__webglTexture=D,Z.get(y.depthTexture).__webglTexture=B.__autoAllocateDepthBuffer?void 0:W,B.__hasExternalTextures=!0},this.setRenderTargetFramebuffer=function(y,D){const W=Z.get(y);W.__webglFramebuffer=D,W.__useDefaultFramebuffer=D===void 0},this.setRenderTarget=function(y,D=0,W=0){ce=y,Q=D,X=W;let B=null,$=!1,pe=!1;if(y){const ve=Z.get(y);if(ve.__useDefaultFramebuffer!==void 0){S.bindFramebuffer(F.FRAMEBUFFER,ve.__webglFramebuffer),oe.copy(y.viewport),Fe.copy(y.scissor),Ie=y.scissorTest,S.viewport(oe),S.scissor(Fe),S.setScissorTest(Ie),j=-1;return}else if(ve.__webglFramebuffer===void 0)K.setupRenderTarget(y);else if(ve.__hasExternalTextures)K.rebindTextures(y,Z.get(y.texture).__webglTexture,Z.get(y.depthTexture).__webglTexture);else if(y.depthBuffer){const Ye=y.depthTexture;if(ve.__boundDepthTexture!==Ye){if(Ye!==null&&Z.has(Ye)&&(y.width!==Ye.image.width||y.height!==Ye.image.height))throw new Error("THREE.WebGLRenderer: Attached DepthTexture is initialized to the incorrect size.");K.setupDepthRenderbuffer(y)}}const we=y.texture;(we.isData3DTexture||we.isDataArrayTexture||we.isCompressedArrayTexture)&&(pe=!0);const Le=Z.get(y).__webglFramebuffer;y.isWebGLCubeRenderTarget?(Array.isArray(Le[D])?B=Le[D][W]:B=Le[D],$=!0):y.samples>0&&K.useMultisampledRTT(y)===!1?B=Z.get(y).__webglMultisampledFramebuffer:Array.isArray(Le)?B=Le[W]:B=Le,oe.copy(y.viewport),Fe.copy(y.scissor),Ie=y.scissorTest}else oe.copy(Me).multiplyScalar(re).floor(),Fe.copy(We).multiplyScalar(re).floor(),Ie=Lt;if(W!==0&&(B=q),S.bindFramebuffer(F.FRAMEBUFFER,B)&&S.drawBuffers(y,B),S.viewport(oe),S.scissor(Fe),S.setScissorTest(Ie),$){const ve=Z.get(y.texture);F.framebufferTexture2D(F.FRAMEBUFFER,F.COLOR_ATTACHMENT0,F.TEXTURE_CUBE_MAP_POSITIVE_X+D,ve.__webglTexture,W)}else if(pe){const ve=D;for(let we=0;we<y.textures.length;we++){const Le=Z.get(y.textures[we]);F.framebufferTextureLayer(F.FRAMEBUFFER,F.COLOR_ATTACHMENT0+we,Le.__webglTexture,W,ve)}}else if(y!==null&&W!==0){const ve=Z.get(y.texture);F.framebufferTexture2D(F.FRAMEBUFFER,F.COLOR_ATTACHMENT0,F.TEXTURE_2D,ve.__webglTexture,W)}j=-1};function ci(y){const D=Z.get(y);return(D.__readFormat!==y.format||D.__readType!==y.type)&&(D.__readFormat=y.format,D.__readType=y.type,D.__formatReadable=R.textureFormatReadable(y.format),D.__typeReadable=R.textureTypeReadable(y.type)),D}this.readRenderTargetPixels=function(y,D,W,B,$,pe,Te,ve=0){if(!(y&&y.isWebGLRenderTarget)){vt("WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let we=Z.get(y).__webglFramebuffer;if(y.isWebGLCubeRenderTarget&&Te!==void 0&&(we=we[Te]),we){S.bindFramebuffer(F.FRAMEBUFFER,we);try{const Le=y.textures[ve],Ye=Le.format,et=Le.type;y.textures.length>1&&F.readBuffer(F.COLOR_ATTACHMENT0+ve);const Ae=ci(Le);if(Ae.__formatReadable===!1){vt("WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}if(Ae.__typeReadable===!1){vt("WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}D>=0&&D<=y.width-B&&W>=0&&W<=y.height-$&&F.readPixels(D,W,B,$,ge.convert(Ye),ge.convert(et),pe)}finally{const Le=ce!==null?Z.get(ce).__webglFramebuffer:null;S.bindFramebuffer(F.FRAMEBUFFER,Le)}}},this.readRenderTargetPixelsAsync=async function(y,D,W,B,$,pe,Te,ve=0){if(!(y&&y.isWebGLRenderTarget))throw new Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let we=Z.get(y).__webglFramebuffer;if(y.isWebGLCubeRenderTarget&&Te!==void 0&&(we=we[Te]),we)if(D>=0&&D<=y.width-B&&W>=0&&W<=y.height-$){S.bindFramebuffer(F.FRAMEBUFFER,we);const Le=y.textures[ve],Ye=Le.format,et=Le.type;y.textures.length>1&&F.readBuffer(F.COLOR_ATTACHMENT0+ve);const Ae=ci(Le);if(Ae.__formatReadable===!1)throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(Ae.__typeReadable===!1)throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");const ut=F.createBuffer();F.bindBuffer(F.PIXEL_PACK_BUFFER,ut),F.bufferData(F.PIXEL_PACK_BUFFER,pe.byteLength,F.STREAM_READ),F.readPixels(D,W,B,$,ge.convert(Ye),ge.convert(et),0),F.bindBuffer(F.PIXEL_PACK_BUFFER,null);const Dt=ce!==null?Z.get(ce).__webglFramebuffer:null;S.bindFramebuffer(F.FRAMEBUFFER,Dt);const yt=F.fenceSync(F.SYNC_GPU_COMMANDS_COMPLETE,0);return F.flush(),await Nw(F,yt,4),F.bindBuffer(F.PIXEL_PACK_BUFFER,ut),F.getBufferSubData(F.PIXEL_PACK_BUFFER,0,pe),F.bindBuffer(F.PIXEL_PACK_BUFFER,null),F.deleteBuffer(ut),F.deleteSync(yt),pe}else throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.")},this.copyFramebufferToTexture=function(y,D=null,W=0){const B=Math.pow(2,-W),$=Math.floor(y.image.width*B),pe=Math.floor(y.image.height*B),Te=D!==null?D.x:0,ve=D!==null?D.y:0;K.setTexture2D(y,0),F.copyTexSubImage2D(F.TEXTURE_2D,W,0,0,Te,ve,$,pe),S.unbindTexture()},this.copyTextureToTexture=function(y,D,W=null,B=null,$=0,pe=0){let Te,ve,we,Le,Ye,et,Ae,ut,Dt;const yt=y.isCompressedTexture?y.mipmaps[pe]:y.image;if(W!==null)Te=W.max.x-W.min.x,ve=W.max.y-W.min.y,we=W.isBox3?W.max.z-W.min.z:1,Le=W.min.x,Ye=W.min.y,et=W.isBox3?W.min.z:0;else{const Rt=Math.pow(2,-$);Te=Math.floor(yt.width*Rt),ve=Math.floor(yt.height*Rt),y.isDataArrayTexture?we=yt.depth:y.isData3DTexture?we=Math.floor(yt.depth*Rt):we=1,Le=0,Ye=0,et=0}B!==null?(Ae=B.x,ut=B.y,Dt=B.z):(Ae=0,ut=0,Dt=0);const gt=ge.convert(D.format),Ht=ge.convert(D.type);let Ee;D.isData3DTexture?(K.setTexture3D(D,0),Ee=F.TEXTURE_3D):D.isDataArrayTexture||D.isCompressedArrayTexture?(K.setTexture2DArray(D,0),Ee=F.TEXTURE_2D_ARRAY):(K.setTexture2D(D,0),Ee=F.TEXTURE_2D),S.activeTexture(F.TEXTURE0),S.pixelStorei(F.UNPACK_FLIP_Y_WEBGL,D.flipY),S.pixelStorei(F.UNPACK_PREMULTIPLY_ALPHA_WEBGL,D.premultiplyAlpha),S.pixelStorei(F.UNPACK_ALIGNMENT,D.unpackAlignment);const Wt=S.getParameter(F.UNPACK_ROW_LENGTH),it=S.getParameter(F.UNPACK_IMAGE_HEIGHT),Gt=S.getParameter(F.UNPACK_SKIP_PIXELS),Ut=S.getParameter(F.UNPACK_SKIP_ROWS),Un=S.getParameter(F.UNPACK_SKIP_IMAGES);S.pixelStorei(F.UNPACK_ROW_LENGTH,yt.width),S.pixelStorei(F.UNPACK_IMAGE_HEIGHT,yt.height),S.pixelStorei(F.UNPACK_SKIP_PIXELS,Le),S.pixelStorei(F.UNPACK_SKIP_ROWS,Ye),S.pixelStorei(F.UNPACK_SKIP_IMAGES,et);const Rn=y.isDataArrayTexture||y.isData3DTexture,ht=D.isDataArrayTexture||D.isData3DTexture;if(y.isDepthTexture){const Rt=Z.get(y),vn=Z.get(D),bt=Z.get(Rt.__renderTarget),Ft=Z.get(vn.__renderTarget);S.bindFramebuffer(F.READ_FRAMEBUFFER,bt.__webglFramebuffer),S.bindFramebuffer(F.DRAW_FRAMEBUFFER,Ft.__webglFramebuffer);for(let wt=0;wt<we;wt++)Rn&&(F.framebufferTextureLayer(F.READ_FRAMEBUFFER,F.COLOR_ATTACHMENT0,Z.get(y).__webglTexture,$,et+wt),F.framebufferTextureLayer(F.DRAW_FRAMEBUFFER,F.COLOR_ATTACHMENT0,Z.get(D).__webglTexture,pe,Dt+wt)),F.blitFramebuffer(Le,Ye,Te,ve,Ae,ut,Te,ve,F.DEPTH_BUFFER_BIT,F.NEAREST);S.bindFramebuffer(F.READ_FRAMEBUFFER,null),S.bindFramebuffer(F.DRAW_FRAMEBUFFER,null)}else if($!==0||y.isRenderTargetTexture||Z.has(y)){const Rt=Z.get(y),vn=Z.get(D);S.bindFramebuffer(F.READ_FRAMEBUFFER,U),S.bindFramebuffer(F.DRAW_FRAMEBUFFER,V);for(let bt=0;bt<we;bt++)Rn?F.framebufferTextureLayer(F.READ_FRAMEBUFFER,F.COLOR_ATTACHMENT0,Rt.__webglTexture,$,et+bt):F.framebufferTexture2D(F.READ_FRAMEBUFFER,F.COLOR_ATTACHMENT0,F.TEXTURE_2D,Rt.__webglTexture,$),ht?F.framebufferTextureLayer(F.DRAW_FRAMEBUFFER,F.COLOR_ATTACHMENT0,vn.__webglTexture,pe,Dt+bt):F.framebufferTexture2D(F.DRAW_FRAMEBUFFER,F.COLOR_ATTACHMENT0,F.TEXTURE_2D,vn.__webglTexture,pe),$!==0?F.blitFramebuffer(Le,Ye,Te,ve,Ae,ut,Te,ve,F.COLOR_BUFFER_BIT,F.NEAREST):ht?F.copyTexSubImage3D(Ee,pe,Ae,ut,Dt+bt,Le,Ye,Te,ve):F.copyTexSubImage2D(Ee,pe,Ae,ut,Le,Ye,Te,ve);S.bindFramebuffer(F.READ_FRAMEBUFFER,null),S.bindFramebuffer(F.DRAW_FRAMEBUFFER,null)}else ht?y.isDataTexture||y.isData3DTexture?F.texSubImage3D(Ee,pe,Ae,ut,Dt,Te,ve,we,gt,Ht,yt.data):D.isCompressedArrayTexture?F.compressedTexSubImage3D(Ee,pe,Ae,ut,Dt,Te,ve,we,gt,yt.data):F.texSubImage3D(Ee,pe,Ae,ut,Dt,Te,ve,we,gt,Ht,yt):y.isDataTexture?F.texSubImage2D(F.TEXTURE_2D,pe,Ae,ut,Te,ve,gt,Ht,yt.data):y.isCompressedTexture?F.compressedTexSubImage2D(F.TEXTURE_2D,pe,Ae,ut,yt.width,yt.height,gt,yt.data):F.texSubImage2D(F.TEXTURE_2D,pe,Ae,ut,Te,ve,gt,Ht,yt);S.pixelStorei(F.UNPACK_ROW_LENGTH,Wt),S.pixelStorei(F.UNPACK_IMAGE_HEIGHT,it),S.pixelStorei(F.UNPACK_SKIP_PIXELS,Gt),S.pixelStorei(F.UNPACK_SKIP_ROWS,Ut),S.pixelStorei(F.UNPACK_SKIP_IMAGES,Un),pe===0&&D.generateMipmaps&&F.generateMipmap(Ee),S.unbindTexture()},this.initRenderTarget=function(y){Z.get(y).__webglFramebuffer===void 0&&K.setupRenderTarget(y)},this.initTexture=function(y){y.isCubeTexture?K.setTextureCube(y,0):y.isData3DTexture?K.setTexture3D(y,0):y.isDataArrayTexture||y.isCompressedArrayTexture?K.setTexture2DArray(y,0):K.setTexture2D(y,0),S.unbindTexture()},this.resetState=function(){Q=0,X=0,ce=null,S.reset(),ye.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return gi}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(e){this._outputColorSpace=e;const n=this.getContext();n.drawingBufferColorSpace=ft._getDrawingBufferColorSpace(e),n.unpackColorSpace=ft._getUnpackColorSpace()}}const pp={type:"change"},Wd={type:"start"},KS={type:"end"},na=new $d,mp=new Ii,II=Math.cos(70*CS.DEG2RAD),Jt=new H,wn=2*Math.PI,Tt={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6},gl=1e-6;class NI extends NA{constructor(e,n=null){super(e,n),this.state=Tt.NONE,this.target=new H,this.cursor=new H,this.minDistance=0,this.maxDistance=1/0,this.minZoom=0,this.maxZoom=1/0,this.minTargetRadius=0,this.maxTargetRadius=1/0,this.minPolarAngle=0,this.maxPolarAngle=Math.PI,this.minAzimuthAngle=-1/0,this.maxAzimuthAngle=1/0,this.enableDamping=!1,this.dampingFactor=.05,this.enableZoom=!0,this.zoomSpeed=1,this.enableRotate=!0,this.rotateSpeed=1,this.keyRotateSpeed=1,this.enablePan=!0,this.panSpeed=1,this.screenSpacePanning=!0,this.keyPanSpeed=7,this.zoomToCursor=!1,this.autoRotate=!1,this.autoRotateSpeed=2,this.keys={LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",BOTTOM:"ArrowDown"},this.mouseButtons={LEFT:rr.ROTATE,MIDDLE:rr.DOLLY,RIGHT:rr.PAN},this.touches={ONE:nr.ROTATE,TWO:nr.DOLLY_PAN},this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object.zoom,this._cursorStyle="auto",this._domElementKeyEvents=null,this._lastPosition=new H,this._lastQuaternion=new cs,this._lastTargetPosition=new H,this._quat=new cs().setFromUnitVectors(e.up,new H(0,1,0)),this._quatInverse=this._quat.clone().invert(),this._spherical=new Gf,this._sphericalDelta=new Gf,this._scale=1,this._panOffset=new H,this._rotateStart=new je,this._rotateEnd=new je,this._rotateDelta=new je,this._panStart=new je,this._panEnd=new je,this._panDelta=new je,this._dollyStart=new je,this._dollyEnd=new je,this._dollyDelta=new je,this._dollyDirection=new H,this._mouse=new je,this._performCursorZoom=!1,this._pointers=[],this._pointerPositions={},this._controlActive=!1,this._onPointerMove=UI.bind(this),this._onPointerDown=DI.bind(this),this._onPointerUp=OI.bind(this),this._onContextMenu=GI.bind(this),this._onMouseWheel=zI.bind(this),this._onKeyDown=BI.bind(this),this._onTouchStart=HI.bind(this),this._onTouchMove=VI.bind(this),this._onMouseDown=FI.bind(this),this._onMouseMove=kI.bind(this),this._interceptControlDown=$I.bind(this),this._interceptControlUp=qI.bind(this),this.domElement!==null&&this.connect(this.domElement),this.update()}set cursorStyle(e){this._cursorStyle=e,e==="grab"?this.domElement.style.cursor="grab":this.domElement.style.cursor="auto"}get cursorStyle(){return this._cursorStyle}connect(e){super.connect(e),this.domElement.addEventListener("pointerdown",this._onPointerDown),this.domElement.addEventListener("pointercancel",this._onPointerUp),this.domElement.addEventListener("contextmenu",this._onContextMenu),this.domElement.addEventListener("wheel",this._onMouseWheel,{passive:!1}),this.domElement.getRootNode().addEventListener("keydown",this._interceptControlDown,{passive:!0,capture:!0}),this.domElement.style.touchAction="none"}disconnect(){this.state=Tt.NONE,this.domElement.removeEventListener("pointerdown",this._onPointerDown),this.domElement.ownerDocument.removeEventListener("pointermove",this._onPointerMove),this.domElement.ownerDocument.removeEventListener("pointerup",this._onPointerUp),this.domElement.removeEventListener("pointercancel",this._onPointerUp),this.domElement.removeEventListener("wheel",this._onMouseWheel),this.domElement.removeEventListener("contextmenu",this._onContextMenu),this.stopListenToKeyEvents();const e=this.domElement.getRootNode();e.removeEventListener("keydown",this._interceptControlDown,{capture:!0}),e.removeEventListener("keyup",this._interceptControlUp,{capture:!0}),this._controlActive=!1,this._pointers.length=0,this._pointerPositions={},this.domElement.style.touchAction="",this.domElement.style.cursor="auto"}dispose(){this.disconnect()}getPolarAngle(){return this._spherical.phi}getAzimuthalAngle(){return this._spherical.theta}getDistance(){return this.object.position.distanceTo(this.target)}listenToKeyEvents(e){e.addEventListener("keydown",this._onKeyDown),this._domElementKeyEvents=e}stopListenToKeyEvents(){this._domElementKeyEvents!==null&&(this._domElementKeyEvents.removeEventListener("keydown",this._onKeyDown),this._domElementKeyEvents=null)}saveState(){this.target0.copy(this.target),this.position0.copy(this.object.position),this.zoom0=this.object.zoom}reset(){this.target.copy(this.target0),this.object.position.copy(this.position0),this.object.zoom=this.zoom0,this.object.updateProjectionMatrix(),this.dispatchEvent(pp),this.update(),this.state=Tt.NONE}pan(e,n){this._pan(e,n),this.update()}dollyIn(e){this._dollyIn(e),this.update()}dollyOut(e){this._dollyOut(e),this.update()}rotateLeft(e){this._rotateLeft(e),this.update()}rotateUp(e){this._rotateUp(e),this.update()}update(e=null){const n=this.object.position;Jt.copy(n).sub(this.target),Jt.applyQuaternion(this._quat),this._spherical.setFromVector3(Jt),this.autoRotate&&this.state===Tt.NONE&&this._rotateLeft(this._getAutoRotationAngle(e)),this.enableDamping?(this._spherical.theta+=this._sphericalDelta.theta*this.dampingFactor,this._spherical.phi+=this._sphericalDelta.phi*this.dampingFactor):(this._spherical.theta+=this._sphericalDelta.theta,this._spherical.phi+=this._sphericalDelta.phi);let i=this.minAzimuthAngle,s=this.maxAzimuthAngle;isFinite(i)&&isFinite(s)&&(i<-Math.PI?i+=wn:i>Math.PI&&(i-=wn),s<-Math.PI?s+=wn:s>Math.PI&&(s-=wn),i<=s?this._spherical.theta=Math.max(i,Math.min(s,this._spherical.theta)):this._spherical.theta=this._spherical.theta>(i+s)/2?Math.max(i,this._spherical.theta):Math.min(s,this._spherical.theta)),this._spherical.phi=Math.max(this.minPolarAngle,Math.min(this.maxPolarAngle,this._spherical.phi)),this._spherical.makeSafe(),this.enableDamping===!0?this.target.addScaledVector(this._panOffset,this.dampingFactor):this.target.add(this._panOffset),this.target.sub(this.cursor),this.target.clampLength(this.minTargetRadius,this.maxTargetRadius),this.target.add(this.cursor);let r=!1;if(this.zoomToCursor&&this._performCursorZoom||this.object.isOrthographicCamera)this._spherical.radius=this._clampDistance(this._spherical.radius);else{const o=this._spherical.radius;this._spherical.radius=this._clampDistance(this._spherical.radius*this._scale),r=o!=this._spherical.radius}if(Jt.setFromSpherical(this._spherical),Jt.applyQuaternion(this._quatInverse),n.copy(this.target).add(Jt),this.object.lookAt(this.target),this.enableDamping===!0?(this._sphericalDelta.theta*=1-this.dampingFactor,this._sphericalDelta.phi*=1-this.dampingFactor,this._panOffset.multiplyScalar(1-this.dampingFactor)):(this._sphericalDelta.set(0,0,0),this._panOffset.set(0,0,0)),this.zoomToCursor&&this._performCursorZoom){let o=null;if(this.object.isPerspectiveCamera){const a=Jt.length();o=this._clampDistance(a*this._scale);const c=a-o;this.object.position.addScaledVector(this._dollyDirection,c),this.object.updateMatrixWorld(),r=!!c}else if(this.object.isOrthographicCamera){const a=new H(this._mouse.x,this._mouse.y,0);a.unproject(this.object);const c=this.object.zoom;this.object.zoom=Math.max(this.minZoom,Math.min(this.maxZoom,this.object.zoom/this._scale)),this.object.updateProjectionMatrix(),r=c!==this.object.zoom;const l=new H(this._mouse.x,this._mouse.y,0);l.unproject(this.object),this.object.position.sub(l).add(a),this.object.updateMatrixWorld(),o=Jt.length()}else console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."),this.zoomToCursor=!1;o!==null&&(this.screenSpacePanning?this.target.set(0,0,-1).transformDirection(this.object.matrix).multiplyScalar(o).add(this.object.position):(na.origin.copy(this.object.position),na.direction.set(0,0,-1).transformDirection(this.object.matrix),Math.abs(this.object.up.dot(na.direction))<II?this.object.lookAt(this.target):(mp.setFromNormalAndCoplanarPoint(this.object.up,this.target),na.intersectPlane(mp,this.target))))}else if(this.object.isOrthographicCamera){const o=this.object.zoom;this.object.zoom=Math.max(this.minZoom,Math.min(this.maxZoom,this.object.zoom/this._scale)),o!==this.object.zoom&&(this.object.updateProjectionMatrix(),r=!0)}return this._scale=1,this._performCursorZoom=!1,r||this._lastPosition.distanceToSquared(this.object.position)>gl||8*(1-this._lastQuaternion.dot(this.object.quaternion))>gl||this._lastTargetPosition.distanceToSquared(this.target)>gl?(this.dispatchEvent(pp),this._lastPosition.copy(this.object.position),this._lastQuaternion.copy(this.object.quaternion),this._lastTargetPosition.copy(this.target),!0):!1}_getAutoRotationAngle(e){return e!==null?wn/60*this.autoRotateSpeed*e:wn/60/60*this.autoRotateSpeed}_getZoomScale(e){const n=Math.abs(e*.01);return Math.pow(.95,this.zoomSpeed*n)}_rotateLeft(e){this._sphericalDelta.theta-=e}_rotateUp(e){this._sphericalDelta.phi-=e}_panLeft(e,n){Jt.setFromMatrixColumn(n,0),Jt.multiplyScalar(-e),this._panOffset.add(Jt)}_panUp(e,n){this.screenSpacePanning===!0?Jt.setFromMatrixColumn(n,1):(Jt.setFromMatrixColumn(n,0),Jt.crossVectors(this.object.up,Jt)),Jt.multiplyScalar(e),this._panOffset.add(Jt)}_pan(e,n){const i=this.domElement;if(this.object.isPerspectiveCamera){const s=this.object.position;Jt.copy(s).sub(this.target);let r=Jt.length();r*=Math.tan(this.object.fov/2*Math.PI/180),this._panLeft(2*e*r/i.clientHeight,this.object.matrix),this._panUp(2*n*r/i.clientHeight,this.object.matrix)}else this.object.isOrthographicCamera?(this._panLeft(e*(this.object.right-this.object.left)/this.object.zoom/i.clientWidth,this.object.matrix),this._panUp(n*(this.object.top-this.object.bottom)/this.object.zoom/i.clientHeight,this.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),this.enablePan=!1)}_dollyOut(e){this.object.isPerspectiveCamera||this.object.isOrthographicCamera?this._scale/=e:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),this.enableZoom=!1)}_dollyIn(e){this.object.isPerspectiveCamera||this.object.isOrthographicCamera?this._scale*=e:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),this.enableZoom=!1)}_updateZoomParameters(e,n){if(!this.zoomToCursor)return;this._performCursorZoom=!0;const i=this.domElement.getBoundingClientRect(),s=e-i.left,r=n-i.top,o=i.width,a=i.height;this._mouse.x=s/o*2-1,this._mouse.y=-(r/a)*2+1,this._dollyDirection.set(this._mouse.x,this._mouse.y,1).unproject(this.object).sub(this.object.position).normalize()}_clampDistance(e){return Math.max(this.minDistance,Math.min(this.maxDistance,e))}_handleMouseDownRotate(e){this._rotateStart.set(e.clientX,e.clientY)}_handleMouseDownDolly(e){this._updateZoomParameters(e.clientX,e.clientX),this._dollyStart.set(e.clientX,e.clientY)}_handleMouseDownPan(e){this._panStart.set(e.clientX,e.clientY)}_handleMouseMoveRotate(e){this._rotateEnd.set(e.clientX,e.clientY),this._rotateDelta.subVectors(this._rotateEnd,this._rotateStart).multiplyScalar(this.rotateSpeed);const n=this.domElement;this._rotateLeft(wn*this._rotateDelta.x/n.clientHeight),this._rotateUp(wn*this._rotateDelta.y/n.clientHeight),this._rotateStart.copy(this._rotateEnd),this.update()}_handleMouseMoveDolly(e){this._dollyEnd.set(e.clientX,e.clientY),this._dollyDelta.subVectors(this._dollyEnd,this._dollyStart),this._dollyDelta.y>0?this._dollyOut(this._getZoomScale(this._dollyDelta.y)):this._dollyDelta.y<0&&this._dollyIn(this._getZoomScale(this._dollyDelta.y)),this._dollyStart.copy(this._dollyEnd),this.update()}_handleMouseMovePan(e){this._panEnd.set(e.clientX,e.clientY),this._panDelta.subVectors(this._panEnd,this._panStart).multiplyScalar(this.panSpeed),this._pan(this._panDelta.x,this._panDelta.y),this._panStart.copy(this._panEnd),this.update()}_handleMouseWheel(e){this._updateZoomParameters(e.clientX,e.clientY),e.deltaY<0?this._dollyIn(this._getZoomScale(e.deltaY)):e.deltaY>0&&this._dollyOut(this._getZoomScale(e.deltaY)),this.update()}_handleKeyDown(e){let n=!1;switch(e.code){case this.keys.UP:e.ctrlKey||e.metaKey||e.shiftKey?this.enableRotate&&this._rotateUp(wn*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(0,this.keyPanSpeed),n=!0;break;case this.keys.BOTTOM:e.ctrlKey||e.metaKey||e.shiftKey?this.enableRotate&&this._rotateUp(-wn*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(0,-this.keyPanSpeed),n=!0;break;case this.keys.LEFT:e.ctrlKey||e.metaKey||e.shiftKey?this.enableRotate&&this._rotateLeft(wn*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(this.keyPanSpeed,0),n=!0;break;case this.keys.RIGHT:e.ctrlKey||e.metaKey||e.shiftKey?this.enableRotate&&this._rotateLeft(-wn*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(-this.keyPanSpeed,0),n=!0;break}n&&(e.preventDefault(),this.update())}_handleTouchStartRotate(e){if(this._pointers.length===1)this._rotateStart.set(e.pageX,e.pageY);else{const n=this._getSecondPointerPosition(e),i=.5*(e.pageX+n.x),s=.5*(e.pageY+n.y);this._rotateStart.set(i,s)}}_handleTouchStartPan(e){if(this._pointers.length===1)this._panStart.set(e.pageX,e.pageY);else{const n=this._getSecondPointerPosition(e),i=.5*(e.pageX+n.x),s=.5*(e.pageY+n.y);this._panStart.set(i,s)}}_handleTouchStartDolly(e){const n=this._getSecondPointerPosition(e),i=e.pageX-n.x,s=e.pageY-n.y,r=Math.sqrt(i*i+s*s);this._dollyStart.set(0,r)}_handleTouchStartDollyPan(e){this.enableZoom&&this._handleTouchStartDolly(e),this.enablePan&&this._handleTouchStartPan(e)}_handleTouchStartDollyRotate(e){this.enableZoom&&this._handleTouchStartDolly(e),this.enableRotate&&this._handleTouchStartRotate(e)}_handleTouchMoveRotate(e){if(this._pointers.length==1)this._rotateEnd.set(e.pageX,e.pageY);else{const i=this._getSecondPointerPosition(e),s=.5*(e.pageX+i.x),r=.5*(e.pageY+i.y);this._rotateEnd.set(s,r)}this._rotateDelta.subVectors(this._rotateEnd,this._rotateStart).multiplyScalar(this.rotateSpeed);const n=this.domElement;this._rotateLeft(wn*this._rotateDelta.x/n.clientHeight),this._rotateUp(wn*this._rotateDelta.y/n.clientHeight),this._rotateStart.copy(this._rotateEnd)}_handleTouchMovePan(e){if(this._pointers.length===1)this._panEnd.set(e.pageX,e.pageY);else{const n=this._getSecondPointerPosition(e),i=.5*(e.pageX+n.x),s=.5*(e.pageY+n.y);this._panEnd.set(i,s)}this._panDelta.subVectors(this._panEnd,this._panStart).multiplyScalar(this.panSpeed),this._pan(this._panDelta.x,this._panDelta.y),this._panStart.copy(this._panEnd)}_handleTouchMoveDolly(e){const n=this._getSecondPointerPosition(e),i=e.pageX-n.x,s=e.pageY-n.y,r=Math.sqrt(i*i+s*s);this._dollyEnd.set(0,r),this._dollyDelta.set(0,Math.pow(this._dollyEnd.y/this._dollyStart.y,this.zoomSpeed)),this._dollyOut(this._dollyDelta.y),this._dollyStart.copy(this._dollyEnd);const o=(e.pageX+n.x)*.5,a=(e.pageY+n.y)*.5;this._updateZoomParameters(o,a)}_handleTouchMoveDollyPan(e){this.enableZoom&&this._handleTouchMoveDolly(e),this.enablePan&&this._handleTouchMovePan(e)}_handleTouchMoveDollyRotate(e){this.enableZoom&&this._handleTouchMoveDolly(e),this.enableRotate&&this._handleTouchMoveRotate(e)}_addPointer(e){this._pointers.push(e.pointerId)}_removePointer(e){delete this._pointerPositions[e.pointerId];for(let n=0;n<this._pointers.length;n++)if(this._pointers[n]==e.pointerId){this._pointers.splice(n,1);return}}_isTrackingPointer(e){for(let n=0;n<this._pointers.length;n++)if(this._pointers[n]==e.pointerId)return!0;return!1}_trackPointer(e){let n=this._pointerPositions[e.pointerId];n===void 0&&(n=new je,this._pointerPositions[e.pointerId]=n),n.set(e.pageX,e.pageY)}_getSecondPointerPosition(e){const n=e.pointerId===this._pointers[0]?this._pointers[1]:this._pointers[0];return this._pointerPositions[n]}_customWheelEvent(e){const n=e.deltaMode,i={clientX:e.clientX,clientY:e.clientY,deltaY:e.deltaY};switch(n){case 1:i.deltaY*=16;break;case 2:i.deltaY*=100;break}return e.ctrlKey&&!this._controlActive&&(i.deltaY*=10),i}}function DI(t){this.enabled!==!1&&(this._pointers.length===0&&(this.domElement.setPointerCapture(t.pointerId),this.domElement.ownerDocument.addEventListener("pointermove",this._onPointerMove),this.domElement.ownerDocument.addEventListener("pointerup",this._onPointerUp)),!this._isTrackingPointer(t)&&(this._addPointer(t),t.pointerType==="touch"?this._onTouchStart(t):this._onMouseDown(t),this._cursorStyle==="grab"&&(this.domElement.style.cursor="grabbing")))}function UI(t){this.enabled!==!1&&(t.pointerType==="touch"?this._onTouchMove(t):this._onMouseMove(t))}function OI(t){switch(this._removePointer(t),this._pointers.length){case 0:this.domElement.releasePointerCapture(t.pointerId),this.domElement.ownerDocument.removeEventListener("pointermove",this._onPointerMove),this.domElement.ownerDocument.removeEventListener("pointerup",this._onPointerUp),this.dispatchEvent(KS),this.state=Tt.NONE,this._cursorStyle==="grab"&&(this.domElement.style.cursor="grab");break;case 1:const e=this._pointers[0],n=this._pointerPositions[e];this._onTouchStart({pointerId:e,pageX:n.x,pageY:n.y});break}}function FI(t){let e;switch(t.button){case 0:e=this.mouseButtons.LEFT;break;case 1:e=this.mouseButtons.MIDDLE;break;case 2:e=this.mouseButtons.RIGHT;break;default:e=-1}switch(e){case rr.DOLLY:if(this.enableZoom===!1)return;this._handleMouseDownDolly(t),this.state=Tt.DOLLY;break;case rr.ROTATE:if(t.ctrlKey||t.metaKey||t.shiftKey){if(this.enablePan===!1)return;this._handleMouseDownPan(t),this.state=Tt.PAN}else{if(this.enableRotate===!1)return;this._handleMouseDownRotate(t),this.state=Tt.ROTATE}break;case rr.PAN:if(t.ctrlKey||t.metaKey||t.shiftKey){if(this.enableRotate===!1)return;this._handleMouseDownRotate(t),this.state=Tt.ROTATE}else{if(this.enablePan===!1)return;this._handleMouseDownPan(t),this.state=Tt.PAN}break;default:this.state=Tt.NONE}this.state!==Tt.NONE&&this.dispatchEvent(Wd)}function kI(t){switch(this.state){case Tt.ROTATE:if(this.enableRotate===!1)return;this._handleMouseMoveRotate(t);break;case Tt.DOLLY:if(this.enableZoom===!1)return;this._handleMouseMoveDolly(t);break;case Tt.PAN:if(this.enablePan===!1)return;this._handleMouseMovePan(t);break}}function zI(t){this.enabled===!1||this.enableZoom===!1||this.state!==Tt.NONE||(t.preventDefault(),this.dispatchEvent(Wd),this._handleMouseWheel(this._customWheelEvent(t)),this.dispatchEvent(KS))}function BI(t){this.enabled!==!1&&this._handleKeyDown(t)}function HI(t){switch(this._trackPointer(t),this._pointers.length){case 1:switch(this.touches.ONE){case nr.ROTATE:if(this.enableRotate===!1)return;this._handleTouchStartRotate(t),this.state=Tt.TOUCH_ROTATE;break;case nr.PAN:if(this.enablePan===!1)return;this._handleTouchStartPan(t),this.state=Tt.TOUCH_PAN;break;default:this.state=Tt.NONE}break;case 2:switch(this.touches.TWO){case nr.DOLLY_PAN:if(this.enableZoom===!1&&this.enablePan===!1)return;this._handleTouchStartDollyPan(t),this.state=Tt.TOUCH_DOLLY_PAN;break;case nr.DOLLY_ROTATE:if(this.enableZoom===!1&&this.enableRotate===!1)return;this._handleTouchStartDollyRotate(t),this.state=Tt.TOUCH_DOLLY_ROTATE;break;default:this.state=Tt.NONE}break;default:this.state=Tt.NONE}this.state!==Tt.NONE&&this.dispatchEvent(Wd)}function VI(t){switch(this._trackPointer(t),this.state){case Tt.TOUCH_ROTATE:if(this.enableRotate===!1)return;this._handleTouchMoveRotate(t),this.update();break;case Tt.TOUCH_PAN:if(this.enablePan===!1)return;this._handleTouchMovePan(t),this.update();break;case Tt.TOUCH_DOLLY_PAN:if(this.enableZoom===!1&&this.enablePan===!1)return;this._handleTouchMoveDollyPan(t),this.update();break;case Tt.TOUCH_DOLLY_ROTATE:if(this.enableZoom===!1&&this.enableRotate===!1)return;this._handleTouchMoveDollyRotate(t),this.update();break;default:this.state=Tt.NONE}}function GI(t){this.enabled!==!1&&t.preventDefault()}function $I(t){t.key==="Control"&&(this._controlActive=!0,this.domElement.getRootNode().addEventListener("keyup",this._interceptControlUp,{passive:!0,capture:!0}))}function qI(t){t.key==="Control"&&(this._controlActive=!1,this.domElement.getRootNode().removeEventListener("keyup",this._interceptControlUp,{passive:!0,capture:!0}))}const ke=t=>document.getElementById(t),Ru=ke("root"),gc=ke("view"),jS=ke("job-name"),Zd=ke("job-meta"),WI=ke("status"),ZI=ke("status-text"),qn=ke("scrub"),JS=ke("line-label"),QS=ke("line-text"),_l=ke("time"),ev=ke("details"),tv=ke("details-list"),nv=ke("details-btn"),iv=ke("machine-btn"),Da=ke("message"),XI=ke("message-title"),YI=ke("message-body"),KI=ke("loading-bar"),jI=ke("view-tools"),Xd=ke("view-top"),sv=ke("view-3d"),rv=ke("legend"),ov=ke("fullscreen"),av=ke("machine"),JI=ke("machine-list"),QI=ke("legend-live"),cv=ke("return-live"),ns=ke("run-note"),lv=ke("colour"),uv=ke("colour-btn"),_c=ke("colour-menu"),eN=ke("colour-label"),tN=ke("legend-ramp"),gp=ke("legend-tools"),ha=ke("fit-chip"),dv=ke("checks"),Yd=ke("checks-btn"),_p=ke("steps-box"),nN=ke("details-note"),At={load:ke("btn-load"),start:ke("btn-start"),pause:ke("btn-pause"),resume:ke("btn-resume"),stop:ke("btn-stop"),unlock:ke("btn-unlock")},Sl=0,Sc=new LI({canvas:gc,antialias:!0,alpha:!0});Sc.setPixelRatio(Math.min(window.devicePixelRatio,2));Sc.setClearColor(0,0);const Ns=new uA;Tn.DEFAULT_UP.set(0,0,1);const pi=new Gn(45,1,.1,1e5);pi.up.set(0,0,1);const Ua=new NI(pi,gc);Ua.enableDamping=!1;Ua.addEventListener("change",()=>ks());const po=new LA(200,20);po.rotation.x=Math.PI/2;Ns.add(po);const Kd=new IA(20);Ns.add(Kd);const jd=new Fs,hv=new Fs,Jd=new zS({dashSize:1,gapSize:2}),Qd=new zS({dashSize:1,gapSize:2});let rn=null;const iN=new Fs({vertexColors:!0}),Ds=new si(new hc(1.5,6,20).rotateX(-Math.PI/2).translate(0,0,3),new dc);Ds.visible=!1;Ns.add(Ds);const yr=new si(new hc(1.5,6,20).rotateX(-Math.PI/2).translate(0,0,3),new dc);yr.visible=!1;Ns.add(yr);let vl=!1;function ks(){vl||(vl=!0,requestAnimationFrame(()=>{vl=!1,Sc.render(Ns,pi)}))}function eh(){const{clientWidth:t,clientHeight:e}=gc;!t||!e||(Sc.setSize(t,e,!1),pi.aspect=t/e,pi.updateProjectionMatrix(),ks())}new ResizeObserver(eh).observe(gc);function fv(t){const e=t?t==="dark":matchMedia("(prefers-color-scheme: dark)").matches;document.documentElement.dataset.theme=e?"dark":"light";const n=getComputedStyle(document.documentElement),i=a=>new at(n.getPropertyValue(a).trim()),s=i("--text"),r=i("--faint"),o=i("--todo");jd.color.copy(s),Jd.color.copy(r),hv.color.copy(o),Qd.color.copy(o),po.material.color.copy(i("--grid")),po.material.vertexColors=!1,Kd.setColors(r,r,r),Ds.material.color.copy(s),yr.material.color.copy(i("--online")),yc(),ks()}let ct=null,An=new Float32Array(0),Si=new Uint32Array(0),Oa=new Uint32Array(1),Fa=new Uint32Array(1),ka=new Uint32Array(0),wu=new Uint32Array(0),cr=new Float64Array(1);function sN(t,e,n){An=new Float32Array(t,0,e*6),Si=new Uint32Array(t,e*24,n);const i=new Uint8Array(t,e*24+n*4,e);let s=0;for(let f=0;f<e;f++)i[f]===Sl&&s++;const r=new Float32Array((e-s)*6),o=new Float32Array(s*6);Oa=new Uint32Array(e+1),Fa=new Uint32Array(e+1),ka=new Uint32Array(e-s),wu=new Uint32Array(e),cr=new Float64Array(e+1);let a=0,c=0,l=0;for(let f=0;f<e;f++){for(;l<n-1&&Si[l]<=f;)l++;wu[f]=l;const _=An.subarray(f*6,f*6+6);i[f]===Sl?o.set(_,6*c++):(ka[a]=f,r.set(_,6*a++)),Oa[f+1]=a,Fa[f+1]=c;const x=i[f]===Sl?0:Math.hypot(_[3]-_[0],_[4]-_[1],_[5]-_[2]);cr[f+1]=cr[f]+x}if(rn){for(const f of Object.values(rn))Ns.remove(f);rn.cut.geometry.dispose(),rn.rapid.geometry.dispose()}const u=f=>{const _=new Nn;return _.setAttribute("position",new ti(f,3)),_},h=u(r),d=u(o);rn={cut:new ir(h,jd),cutTodo:new ir(h.clone(),hv),rapid:new ir(d,Jd),rapidTodo:new ir(d.clone(),Qd)},rn.rapid.computeLineDistances(),rn.rapidTodo.computeLineDistances();for(const f of Object.values(rn))f.frustumCulled=!1,Ns.add(f);qn.max=String(n),yc(),vc(n)}function vc(t){qn.value=String(t);const e=Si.length,n=t>0?Si[t-1]:0,i=An.length/6;if(rn){const s=Oa[n],r=Fa[n];rn.cut.geometry.setDrawRange(0,s*2),rn.cutTodo.geometry.setDrawRange(s*2,(Oa[i]-s)*2),rn.rapid.geometry.setDrawRange(0,r*2),rn.rapidTodo.geometry.setDrawRange(r*2,(Fa[i]-r)*2)}if(i>0){const s=n>0?n*6-3:0;Ds.position.set(An[s],An[s+1],An[s+2]),Ds.visible=!0}JS.textContent=`Line ${t.toLocaleString()} / ${e.toLocaleString()}`,pv(t),vv(),ks()}function rN(){const t=ct==null?void 0:ct.bounds;return t?new Is(new H(t.min.x,t.min.y,t.min.z),new H(t.max.x,t.max.y,t.max.z)):new Is(new H(-50,-50,-10),new H(50,50,10))}function vo(t){const e=rN(),n=e.getCenter(new H),i=e.getSize(new H),r=Math.max(i.length()/2,10)/Math.sin(CS.degToRad(pi.fov/2))*1.1,o=t==="top"?new H(0,-.001,1):new H(.6,-1,.8);pi.position.copy(n).addScaledVector(o.normalize(),r),pi.near=r/1e3,pi.far=r*20,pi.updateProjectionMatrix(),Ua.target.copy(n),Ua.update(),Xd.setAttribute("aria-pressed",String(t==="top")),sv.setAttribute("aria-pressed",String(t==="3d"));const a=Math.max(i.x,i.y,20),c=Math.pow(10,Math.floor(Math.log10(a/2))),l=Math.ceil(a*1.6/c)*c;po.scale.setScalar(l/200),Kd.scale.setScalar(Math.max(a/6,5)/20),Ds.scale.setScalar(Math.max(a/60,.5)),yr.scale.setScalar(Math.max(a/60,.5));for(const u of[Jd,Qd])u.dashSize=a/150,u.gapSize=a/75;ks()}const Sp=200;let Li=null,xl=null;async function pv(t){if(!ct)return;const e=Math.max(0,t-1),n=ct.revision;if(Li&&Li.revision===n&&e>=Li.start&&e<Li.start+Li.lines.length){QS.textContent=t===0?"(start)":Li.lines[e-Li.start];return}const i=Math.max(0,e-Sp/2);if(xl===i)return;xl=i;const s=await xc("anc_get_lines",{revision:n,start:i,count:Sp});xl=null,s&&(ct==null?void 0:ct.revision)===n&&(Li={revision:n,start:s.start,lines:s.lines},pv(Number(qn.value)))}const ri=new kl({name:"Agentic Numerical Control",version:"0.1.0"});async function xc(t,e){var s,r;const n=await ri.callServerTool({name:t,arguments:e}),i=((r=(s=n.content)==null?void 0:s.find(o=>o.type==="text"))==null?void 0:r.text)??"";return n.isError?(console.error(`${t}: ${i}`),null):JSON.parse(i)}function fa(t,e="",n=!1){Da.hidden=t===null,XI.textContent=t??"",YI.textContent=e,KI.hidden=!n;const i=t===null;jI.hidden=!i,rv.hidden=!i,ha.hidden=!i||!Yt||Yt.fit.status==="unknown",rh()}function th(t,e){jS.textContent=t,Zd.textContent="Toolpath viewer",fa(t,e),qn.disabled=!0,JS.textContent="Line – / –",QS.textContent=""}function nh(t,e){t.replaceChildren(...e.flatMap(([n,i])=>{const s=document.createElement("dt");s.textContent=n;const r=document.createElement("dd");return r.textContent=i,[s,r]}))}function oN(t){const e=t.units,n=t.bounds,i=s=>s.toFixed(2);nh(tv,[["Source",t.source==="file"?"Jobs folder":t.source==="cncjs"?"CNCjs":"From the chat"],...n?[["Size",`${(n.max.x-n.min.x).toFixed(1)} × ${(n.max.y-n.min.y).toFixed(1)} × ${(n.max.z-n.min.z).toFixed(1)} ${e}`],["X",`${i(n.min.x)} → ${i(n.max.x)}`],["Y",`${i(n.min.y)} → ${i(n.max.y)}`],["Z",`${i(n.min.z)} → ${i(n.max.z)}`]]:[],["Lines",t.lineCount.toLocaleString()],["Segments",t.segmentCount.toLocaleString()],["Cut length",`${t.cutLength.toLocaleString()} ${e}`],["Rapids",`${t.rapidLength.toLocaleString()} ${e}`],["Feed rates",t.feedRates.join(", ")||"–"],["Spindle",t.spindleSpeeds.join(", ")||"–"]])}async function aN(t){ct=t,Li=null,Yt=null,Cu="",gv(),jS.textContent=t.name;const e=t.bounds;Zd.textContent=e?`${(e.max.x-e.min.x).toFixed(1)} × ${(e.max.y-e.min.y).toFixed(1)} × ${(e.max.z-e.min.z).toFixed(1)} ${t.units} · ${t.lineCount.toLocaleString()} lines`:`${t.lineCount.toLocaleString()} lines, no moves`,oN(t),fa("Loading toolpath","",!0);const n=[];let i=null;for(let o=0;;o++){const a=await xc("anc_get_toolpath",{revision:t.revision,chunk:o});if(!a||ct!==t)return;if(i??(i=a),n.push(Uint8Array.from(atob(a.data),c=>c.charCodeAt(0))),o+1>=a.chunkCount)break}const s=new Uint8Array(i.totalBytes);let r=0;for(const o of n)s.set(o,r),r+=o.byteLength;qn.disabled=!1,sN(s.buffer,i.segmentCount,i.lineCount),i.segmentCount?fa(null):fa("Nothing to draw","This program has no moves. It only sets things like spindle speed."),vo("3d"),_v(!0)}let Yt=null,ih="plain";const za={light:["#86b6ef","#2a78d6","#104281"],dark:["#256abf","#5598e7","#9ec5f4"]},vp={light:["#2a78d6","#eb6834","#1baf7a","#eda100","#e87ba4","#008300","#6250d6","#e34948"],dark:["#3987e5","#d95926","#199e70","#c98500","#d55181","#008300","#9085e9","#e66767"]},sh=()=>document.documentElement.dataset.theme==="dark";function xp(t,e){const[n,i,s]=(sh()?za.dark:za.light).map(o=>new at(o)),r=Math.min(1,Math.max(0,t));return r<.5?e.copy(n).lerp(i,r*2):e.copy(i).lerp(s,(r-.5)*2)}function mv(t){const e=sh()?vp.dark:vp.light,n=Yt&&t!==null?Yt.tools.indexOf(t):0;return e[Math.max(0,n)%e.length]}function cN(t){const e=new Float32Array(t).fill(NaN),n=new Int32Array(t).fill(-1),i=(Yt==null?void 0:Yt.runs)??[];for(let s=0;s<i.length;s++){const r=Math.max(0,i[s].at-1),o=s+1<i.length?Math.max(0,i[s+1].at-1):t;for(let a=r;a<Math.min(o,t);a++)e[a]=i[s].feed??NaN,n[a]=i[s].tool??-1}return{feed:e,tool:n}}function yc(){if(!rn)return;const t=Yt?ih:"plain";if(t==="plain")rn.cut.material=jd;else{const e=ka.length,n=new Float32Array(e*6),{feed:i,tool:s}=cN(Si.length),r=Math.min(Yt.deepestZ??0,-1e-6),[o,a]=Yt.feedRange??[0,0],c=new at;for(let l=0;l<e;l++){const u=ka[l],h=wu[u];if(t==="depth"){const d=Math.min(An[u*6+2],An[u*6+5]);xp(Math.min(d,0)/r,c)}else if(t==="feed"){const d=i[h];xp(a>o&&Number.isFinite(d)?(d-o)/(a-o):.5,c)}else c.set(mv(s[h]<0?null:s[h]));c.toArray(n,l*6),c.toArray(n,l*6+3)}rn.cut.geometry.setAttribute("color",new ti(n,3)),rn.cut.material=iN}rh(),ks()}const yp=t=>`about ${Math.max(1,Math.round(t/60))} min`,bp=t=>Pu(t*1e3),jn=t=>t.toLocaleString(void 0,{maximumFractionDigits:1}),Au=t=>t<0?`−${Math.abs(t).toFixed(2)}`:t.toFixed(2),lN=t=>{var n;const e=(n=Yt==null?void 0:Yt.steps.find(i=>i.tool===t&&i.label))==null?void 0:n.label;return e?`T${t} · ${e}`:`T${t}`},ia={problem:'<svg viewBox="0 0 16 16" aria-hidden="true"><circle cx="8" cy="8" r="7" fill="var(--error)"/><path d="M5.7 5.7l4.6 4.6M10.3 5.7l-4.6 4.6" fill="none" stroke="var(--error-text)" stroke-width="1.6" stroke-linecap="round"/></svg>',check:'<svg viewBox="0 0 16 16" aria-hidden="true"><path d="M8 1.6 15 14H1z" fill="var(--warn)" stroke="var(--warn)" stroke-width="1.2" stroke-linejoin="round"/><path d="M8 6v3.6" stroke="var(--warn-ink)" stroke-width="1.6" stroke-linecap="round"/><circle cx="8" cy="11.8" r="0.9" fill="var(--warn-ink)"/></svg>',ok:'<svg viewBox="0 0 16 16" aria-hidden="true"><circle cx="8" cy="8" r="7" fill="var(--online)"/><path d="M4.8 8.2 7 10.3l4.2-4.4" fill="none" stroke="#fff" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round"/></svg>'};function nn(t,e,n){const i=document.createElement(t);return e&&(i.className=e),n!==void 0&&(i.textContent=n),i}function Mp(t){(Bi()||Hi())&&(is=!0),vc(Math.min(t,Si.length)),Tc()}function rh(){var o,a;const t=Yt,e=t?ih:"plain";if(rv.classList.toggle("off",e!=="plain"),tN.hidden=!(e==="depth"||e==="feed")||!Da.hidden,gp.hidden=e!=="tool"||!Da.hidden,!t)return;const[n,i,s]=sh()?za.dark:za.light;ke("ramp-bar").style.background=`linear-gradient(to right, ${n}, ${i}, ${s})`,e==="depth"?(ke("ramp-name").textContent="Depth",ke("ramp-lo").textContent="0",ke("ramp-hi").textContent=`${Au(t.deepestZ??0)} mm`):e==="feed"&&(ke("ramp-name").textContent="Feed",ke("ramp-lo").textContent=jn(((o=t.feedRange)==null?void 0:o[0])??0),ke("ramp-hi").textContent=`${jn(((a=t.feedRange)==null?void 0:a[1])??0)} mm/min`);const r=t.tools.length?t.tools:[null];gp.replaceChildren(...r.map(c=>{const l=nn("span"),u=nn("i","tool-sw");return u.style.background=mv(c),l.append(u,c===null?"One tool":lN(c)),l}))}function gv(){const t=Yt;if(lv.hidden=!t,Yd.hidden=!t,_p.hidden=!0,!t||!ct){ha.hidden=!0,rh();return}const e=t.size;Zd.textContent=[e?`${jn(e.x)} × ${jn(e.y)} × ${jn(e.z)} mm`:"no moves",t.time.totalSeconds?yp(t.time.totalSeconds):null,t.tools.length?`${t.tools.length} tool${t.tools.length===1?"":"s"}`:null].filter(Boolean).join(" · "),nh(tv,[...e?[["Size",`${jn(e.x)} × ${jn(e.y)} × ${jn(e.z)} mm`]]:[],["Run time",yp(t.time.totalSeconds)],["Cutting",bp(t.time.cuttingSeconds)],["Tool changes",String(t.toolChanges)],["Deepest cut",t.deepestZ===null?"–":`${Au(t.deepestZ)} mm`],["Feed",t.feedRange?`${jn(t.feedRange[0])}–${jn(t.feedRange[1])} mm/min`:"–"],["Lines",ct.lineCount.toLocaleString()],["Spindle",ct.spindleSpeeds.join(", ")||"–"]]),t.steps.length>1&&(_p.hidden=!1,ke("steps").replaceChildren(...t.steps.map((a,c)=>{const l=nn("li"),u=nn("button"),h=nn("span","name");h.append(a.label??(a.tool!==null?`Tool ${a.tool}`:`Step ${c+1}`));const d=[a.tool!==null?`T${a.tool}`:null,a.minZ!==null&&a.minZ<0?`down to ${Au(a.minZ)} mm`:null,`from line ${a.firstLine.toLocaleString()}`].filter(Boolean);return h.append(nn("small",void 0,d.join(" · "))),u.append(h,nn("span","t",bp(a.seconds))),u.addEventListener("click",()=>Mp(a.at)),l.append(u),l}))),nN.textContent=t.time.rapidRate==="machine"?"Times are estimates from your machine's speed settings. Press a step to jump to it.":"Times are estimates. Connect the machine to use its own speeds.";const n=t.checks.filter(a=>a.severity==="problem").length,i=t.checks.length-n;ke("checks-summary").textContent=t.checks.length?[n?`${n} problem${n===1?"":"s"}`:null,i?`${i} to check`:null].filter(Boolean).join(" · "):"All clear";const s=ke("checks-dot");s.className=n?"problem":i?"check":"",ke("checks-count").textContent=t.checks.length?String(t.checks.length):"";const r=t.checks.map(a=>{const c=nn("li"),l=nn("span","mark");l.innerHTML=ia[a.severity];const u=nn("div","body"),[,h,d]=a.message.match(/^(.*?[.!?])(?:\s+(.*))?$/)??[null,a.message,""];if(u.append(nn("span","check-title",h.replace(/\.$/,""))),d&&u.append(nn("small",void 0,d)),a.at.length){const f=nn("small",void 0,`${a.severity==="problem"?"Problem":"Check"} · `);a.at.slice(0,3).forEach((_,x)=>{x&&f.append(", ");const m=nn("button","jump",`${x?"":a.lines.length>1?"Lines ":"Line "}${a.lines[x].toLocaleString()}`);m.addEventListener("click",()=>Mp(_)),f.append(m)}),u.append(f)}return c.append(l,u),c});if(!t.checks.length){const a=["Feed rate set before the first cut","Spindle on before cutting","No fast moves into the stock","Nothing the controller can't run",...t.fit.status==="fits"?["Fits the machine from this zero"]:[]];for(const c of a){const l=nn("li"),u=nn("span","mark");u.innerHTML=ia.ok;const h=nn("div","body");h.append(nn("span","check-title",c)),l.append(u,h),r.push(l)}}ke("check-list").replaceChildren(...r),ha.hidden=t.fit.status==="unknown"||!Da.hidden,ha.classList.toggle("over",t.fit.status==="over"),ke("fit-mark").innerHTML=t.fit.status==="over"?ia.problem:ia.ok;const o=t.fit.axes[0];ke("fit-text").textContent=t.fit.status==="over"&&o?`Goes ${jn(o.over)} mm past the ${o.axis.toUpperCase()} travel`:"Fits the machine from this zero",yc()}let Cu="";async function _v(t=!1){if(!ct)return;const e=Bn,n=e!=null&&e.mpos&&e.wpos?["x","y","z"].map(o=>(e.mpos[o]-e.wpos[o]).toFixed(2)).join(","):"",i=`${ct.revision}|${(e==null?void 0:e.port)??""}|${(e==null?void 0:e.controller)??""}|${n}`;if(!t&&i===Cu)return;Cu=i;const s=ct.revision,r=await xc("anc_get_analysis",{revision:s});!r||(ct==null?void 0:ct.revision)!==s||(Yt=r.analysis,gv())}function uN(t){ih=t,eN.textContent=t==="plain"?"Colour":{depth:"Depth",feed:"Feed rate",tool:"Tool"}[t];for(const e of _c.querySelectorAll("[data-colour]"))e.setAttribute("aria-checked",String(e.dataset.colour===t));yc()}function bc(t){_c.hidden=!t,uv.setAttribute("aria-expanded",String(t))}uv.addEventListener("click",t=>{t.stopPropagation(),bc(_c.hidden)});_c.addEventListener("click",t=>{const e=t.target.closest("[data-colour]");e&&(uN(e.dataset.colour),bc(!1))});document.addEventListener("click",t=>{lv.contains(t.target)||bc(!1)});document.addEventListener("keydown",t=>{t.key==="Escape"&&bc(!1)});let Bn=null,Mn=null,Mc=!1,is=!1;const Pu=t=>{const e=Math.max(0,Math.round(t/1e3));return`${Math.floor(e/60)}:${String(e%60).padStart(2,"0")}`},Ep=t=>t?`${t.x.toFixed(3)}, ${t.y.toFixed(3)}, ${t.z.toFixed(3)}`:"–";function dN(t){const e=t.telemetryAt?Math.round((Date.now()-Date.parse(t.telemetryAt))/1e3):null;nh(JI,[["State",t.activeState??t.state],["Work pos",Ep(t.wpos)],["Machine pos",Ep(t.mpos)],["Work offset",t.wcs??"–"],["Port",t.port?`${t.port} · ${t.controller??"?"}`:"none open"],["In CNCjs",t.loadedFile??"no program"],["Alarm",t.alarm??"none"],["Last update",e===null?"never":`${e} s ago`],["CNCjs",t.cncjs.version?`Built-in ${t.cncjs.version}`:"–"]])}const Bi=()=>(Bn==null?void 0:Bn.workflow)==="running",Hi=()=>(Bn==null?void 0:Bn.workflow)==="paused",Ba=()=>!!Mn&&(Bi()||Hi());function Sv(){return!Bn||!ct||!Mn||Bi()||Hi()||!Ec(Bn,ct)?null:Mn.total>0&&Mn.received>=Mn.total?"Complete":Mn.received>0?"Stopped":null}function hN(){const t=Bn;let e="Connecting",n="";if(Mc)e="Offline";else if(t)if((!!t.alarm||t.activeState==="Alarm")&&t.port)e="Alarm",n="alarm";else if(t.link==="stale")e="Not responding";else if(Bi())e="Running",n="live active";else if(Hi())e="Paused",n="live";else{const s=!!ct&&Ec(t,ct);e=Sv()??(s?"Ready":ct?"Preview":"Idle"),t.link==="live"&&(n="live")}WI.className=`status ${n}`,ZI.textContent=e}function Ec(t,e){return t.loadedHash&&e.hash?t.loadedHash===e.hash:t.loadedFile===e.name}function fN(){const t=cr[cr.length-1],e=Number(qn.value),n=e>0?Si[e-1]:0;if(!t||!Yt)return"";const i=Yt.time.totalSeconds*(1-cr[n]/t);return i<60?" · under a minute left":` · ${Math.round(i/60)} min left`}function mo(){const t=Bn;for(const r of Object.values(At))r.hidden=!0;if(ns.className="foot-note run-note",hN(),Mc){ns.textContent="Your computer is offline";return}if(!t||!ct){ns.textContent=t&&!t.cncjs.connected?t.state:"",_l.textContent="";return}const e=t.link==="live",n=Ec(t,ct),i=Sv();_l.textContent=Mn&&(Ba()||i)?Pu(Mn.elapsedMs):"",Mn&&Ba()&&Yt&&!is&&(_l.textContent+=fN());let s="";t.cncjs.connected?t.port?t.alarm||t.activeState==="Alarm"?(s=`${t.alarm??"Machine is in alarm"}. Check the machine, then unlock.`,ns.classList.add("alarm"),At.unlock.hidden=!1):Bi()||Hi()?(At.pause.hidden=!Bi(),At.resume.hidden=!Hi(),At.stop.hidden=!1):n?(At.start.hidden=!1,At.start.disabled=!e||t.activeState!=="Idle",ss===void 0&&(At.start.textContent=i?"Start again":"Start"),At.start.classList.toggle("secondary",!!i&&ss===void 0),At.start.classList.toggle("primary",!i||ss!==void 0),s=e?t.activeState!=="Idle"?`Machine is ${t.activeState}`:ss!==void 0?"Press again to start the machine":i==="Complete"&&Mn?`Finished in ${Pu(Mn.elapsedMs)}`:"Loaded in CNCjs":t.link==="stale"?`No update for ${pN(t)} s`:t.state):(s=t.loadedFile?t.loadedFile===ct.name?`CNCjs has a different version of ${t.loadedFile} loaded`:`CNCjs has ${t.loadedFile} loaded`:"",At.load.hidden=!1):s="No machine connected":s=t.state,ns.textContent=s}const pN=t=>t.telemetryAt?Math.round((Date.now()-Date.parse(t.telemetryAt))/1e3):0;function vv(){const t=Number(qn.max)||0,e=Ba()&&Mn?Math.min(Mn.line,t):Number(qn.value);qn.style.setProperty("--fill",`${t?e/t*100:0}%`)}function Tc(){const t=Bn,e=!!t&&t.link==="live"&&!!t.wpos&&!!ct&&Ec(t,ct);yr.visible=e,QI.hidden=!e,Ds.visible=!e||is,e&&yr.position.set(t.wpos.x,t.wpos.y,t.wpos.z);const n=Ba();n&&!is&&vc(e?mN(t.wpos,Mn.line):Qr),cv.hidden=!(n&&is),n||(is=!1,Qr=0),vv(),ks()}let Qr=0;function mN(t,e){let n=Qr,i=1/0;const s=Math.min(e,Si.length),r=.02**2;e:for(let o=Math.max(Qr,1);o<=s;o++){const a=o>1?Si[o-2]:0;for(let c=a;c<Si[o-1];c++){const l=gN(t,c);if(l<i-1e-9&&(i=l,n=o),l<=r)break e}}return Qr=n,n}function gN(t,e){const n=e*6,i=An[n],s=An[n+1],r=An[n+2],o=An[n+3]-i,a=An[n+4]-s,c=An[n+5]-r,l=o*o+a*a+c*c,u=l?Math.max(0,Math.min(1,((t.x-i)*o+(t.y-s)*a+(t.z-r)*c)/l)):0;return(i+u*o-t.x)**2+(s+u*a-t.y)**2+(r+u*c-t.z)**2}function _N(t){if(Mc=!1,Bn=t.machine,Mn=t.progress,dN(t.machine),!t.job){!ct&&!Iu&&th("No job open","Ask to open a G-code file from your jobs folder, or paste one in."),mo();return}Iu=!1,!ct||t.job.revision!==ct.revision?aN(t.job):rn&&!Bi()&&!Hi()&&_v(),mo(),Tc()}function Tp(){Mc=!0,ct||th("Your computer is offline","It reconnects when it's on and you're signed in to it."),mo()}const SN=2e3,vN=500;let Lu;async function xo(){clearTimeout(Lu);try{const e=await xc("anc_snapshot",{});e?_N(e):Tp()}catch(e){Tp(),console.error(e)}const t=Bi()||Hi();Lu=window.setTimeout(xo,t?vN:SN)}const xN=new Set(["start","resume","cyclestart","unlock","home"]);async function yo(t,e){var n,i;e.disabled=!0;try{const s=xN.has(t),r={action:t};t==="start"&&(r.hash=ct==null?void 0:ct.hash);const o=await ri.callServerTool({name:s?"anc_run_control":"anc_job_control",arguments:r});o.isError&&(ns.textContent=((i=(n=o.content)==null?void 0:n.find(a=>a.type==="text"))==null?void 0:i.text)??"Command failed.")}finally{e.disabled=!1,xo()}}let ss;function Rp(){clearTimeout(ss),ss=void 0,At.start.classList.remove("confirm"),mo()}function xv(t){var e;if(fv(t.theme),t.safeAreaInsets){const n=t.safeAreaInsets;Ru.style.padding=`${n.top}px ${n.right}px ${n.bottom}px ${n.left}px`}ov.hidden=!((e=t.availableDisplayModes)!=null&&e.includes("fullscreen")),Ru.classList.toggle("fullscreen",t.displayMode==="fullscreen"),eh()}let Iu=!1;ri.onerror=console.error;ri.onhostcontextchanged=xv;ri.ontoolresult=t=>{var e,n;if(t.isError){const i=(n=(e=t.content)==null?void 0:e.find(s=>s.type==="text"))==null?void 0:n.text;ct?ns.textContent=i??"The job could not be opened.":(Iu=!0,th("Couldn't open the job",i??""));return}xo()};ri.onteardown=async()=>(clearTimeout(Lu),{});qn.addEventListener("input",()=>{(Bi()||Hi())&&(is=!0),vc(Number(qn.value)),Tc()});cv.addEventListener("click",()=>{is=!1,Tc()});At.load.addEventListener("click",async()=>{var t,e;At.load.disabled=!0;try{const n=await ri.callServerTool({name:"anc_send_to_cncjs",arguments:{}});n.isError&&(ns.textContent=((e=(t=n.content)==null?void 0:t.find(i=>i.type==="text"))==null?void 0:e.text)??"Load failed.")}finally{At.load.disabled=!1,xo()}});At.start.addEventListener("click",()=>{if(ss===void 0){ss=window.setTimeout(Rp,4e3),At.start.textContent="Confirm start",At.start.classList.add("confirm"),mo();return}Rp(),yo("start",At.start)});At.pause.addEventListener("click",()=>yo("pause",At.pause));At.resume.addEventListener("click",()=>yo("resume",At.resume));At.stop.addEventListener("click",()=>yo("stop",At.stop));At.unlock.addEventListener("click",()=>yo("unlock",At.unlock));ke("fit").addEventListener("click",()=>vo(Xd.getAttribute("aria-pressed")==="true"?"top":"3d"));sv.addEventListener("click",()=>vo("3d"));Xd.addEventListener("click",()=>vo("top"));function oh(t){ev.hidden=t!=="job",dv.hidden=t!=="checks",av.hidden=t!=="machine",nv.setAttribute("aria-pressed",String(t==="job")),Yd.setAttribute("aria-pressed",String(t==="checks")),iv.setAttribute("aria-pressed",String(t==="machine"))}nv.addEventListener("click",()=>oh(ev.hidden?"job":null));Yd.addEventListener("click",()=>oh(dv.hidden?"checks":null));iv.addEventListener("click",()=>oh(av.hidden?"machine":null));ov.addEventListener("click",async()=>{var n;const t=((n=ri.getHostContext())==null?void 0:n.displayMode)==="fullscreen"?"inline":"fullscreen",e=await ri.requestDisplayMode({mode:t});Ru.classList.toggle("fullscreen",e.mode==="fullscreen"),eh()});fv(void 0);vo("3d");qn.disabled=!0;ri.connect().then(()=>{const t=ri.getHostContext();t&&xv(t),xo()});</script>
|
|
4334
|
+
<style rel="stylesheet" crossorigin>@font-face{font-family:Geist;src:url(data:font/woff2;base64,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) format("woff2");font-weight:100 900;font-display:swap}@font-face{font-family:Geist Mono;src:url(data:font/woff2;base64,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) format("woff2");font-weight:100 900;font-display:swap}:root{--bg: #ffffff;--stage: #fbfbfc;--text: #111827;--muted: #6b7280;--faint: #9ca3af;--track: #f3f4f6;--line: #e5e7eb;--chip: #ffffff;--chip-shadow: 0 1px 2px rgba(0, 0, 0, .1);--ring: rgba(0, 0, 0, .1);--primary: #111827;--primary-text: #ffffff;--online: #22c55e;--online-ring: rgba(34, 197, 94, .22);--offline: #d1d5db;--error: #dc2626;--error-text: #ffffff;--error-ring: rgba(220, 38, 38, .16);--warn: #fab219;--warn-ink: #111827;--todo: #d1d5db;--grid: #eef0f2;--panel: #ffffff;--panel-shadow: 0 12px 32px -12px rgba(0, 0, 0, .18), 0 0 0 1px rgba(0, 0, 0, .05);--thumb-edge: rgba(0, 0, 0, .12);--sans: "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;--mono: "Geist Mono", ui-monospace, "Cascadia Code", Menlo, Consolas, monospace;color-scheme:light}:root[data-theme=dark]{--bg: #111214;--stage: #16171a;--text: #ececec;--muted: #9ca3af;--faint: #6b7280;--track: #1d1f23;--line: #26282d;--chip: #2c2e33;--chip-shadow: 0 1px 2px rgba(0, 0, 0, .4);--ring: rgba(255, 255, 255, .14);--primary: #ececec;--primary-text: #111214;--offline: #4b5563;--error: #f87171;--error-text: #111214;--error-ring: rgba(248, 113, 113, .22);--todo: #3a3d43;--grid: #1f2125;--panel: #1d1f23;--panel-shadow: 0 12px 32px -12px rgba(0, 0, 0, .7), 0 0 0 1px rgba(255, 255, 255, .06);--thumb-edge: rgba(255, 255, 255, .12);color-scheme:dark}*{box-sizing:border-box}[hidden]{display:none!important}html,body{margin:0;background:var(--bg);color:var(--text)}body{font:13px/1.5 var(--sans);-webkit-font-smoothing:antialiased}:focus-visible{outline:2px solid var(--muted);outline-offset:2px}code{font-family:var(--mono)}.anc{display:flex;flex-direction:column;height:440px}.anc.fullscreen{height:100vh}button,select{font:inherit;font-weight:500;color:var(--text);border:0;cursor:pointer}button:disabled,select:disabled{opacity:.4;cursor:default}.actions>.primary,.actions>.secondary{flex:none;height:34px;padding:0 14px;border-radius:10px}.primary{background:var(--primary);color:var(--primary-text)}.secondary{background:var(--track)}.primary.confirm,.secondary.confirm{background:var(--error);color:var(--error-text)}.small{flex:none;height:30px;padding:0 12px;border-radius:8px}.toggle{height:30px;padding:0 10px;border-radius:8px;background:none;color:var(--muted)}.toggle[aria-pressed=true]{background:var(--track);color:var(--text)}.icon{flex:none;display:flex;align-items:center;justify-content:center;padding:0}.icon svg{fill:none;stroke:currentColor;stroke-width:1.4;stroke-linecap:round;stroke-linejoin:round}.icon.quiet{width:32px;height:32px;border-radius:8px;background:none;color:var(--muted)}.icon.quiet svg{stroke-width:1.5}.icon.quiet:hover{background:var(--track);color:var(--text)}.chip{width:30px;height:30px;border-radius:8px;background:var(--chip);box-shadow:var(--chip-shadow)}.dot{display:inline-block;flex:none;width:7px;height:7px;border-radius:50%;background:var(--offline)}.dot.live{background:var(--online)}.dot.faint{background:var(--faint)}select{height:30px;padding:0 8px;border-radius:8px;background:var(--track)}.segmented{display:inline-flex;gap:2px;padding:2px;border-radius:9px;background:var(--track)}.segmented button{height:26px;padding:0 10px;border-radius:7px;background:none;color:var(--muted)}.segmented button[aria-pressed=true]{background:var(--chip);color:var(--text);box-shadow:var(--chip-shadow)}.head{flex:none;display:flex;align-items:center;gap:12px;padding:12px 12px 12px 16px;min-width:0}.titles{flex:1;min-width:0;display:flex;flex-direction:column}.title{font-size:15px;font-weight:600;line-height:1.35;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.meta{color:var(--muted);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.status{flex:none;display:inline-flex;align-items:center;gap:7px;height:28px;padding:0 11px 0 10px;border-radius:999px;background:var(--track);font-weight:500;white-space:nowrap}.status i{width:7px;height:7px;border-radius:50%;background:var(--offline)}.status.live i{background:var(--online)}.status.active i{box-shadow:0 0 0 3px var(--online-ring)}.status.alarm i{background:var(--error);box-shadow:0 0 0 3px var(--error-ring)}.stage{position:relative;flex:1;min-height:0;background:var(--stage);border-top:1px solid var(--line);border-bottom:1px solid var(--line)}.stage.scroll{overflow:auto}.facts{display:grid;grid-template-columns:auto 1fr;gap:5px 16px;margin:0;font-size:12px}.facts dt{color:var(--muted)}.facts dd{margin:0;font-family:var(--mono);text-align:right;overflow-wrap:anywhere}.card{padding:12px 14px;border-radius:10px;background:var(--bg);box-shadow:inset 0 0 0 1px var(--line)}.message{position:absolute;top:0;right:0;bottom:0;left:0;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:4px;padding:24px;text-align:center;background:var(--stage)}.message-title{font-size:15px;font-weight:600}.message-body{max-width:360px;color:var(--muted)}.message-body:empty{display:none}.loading-bar{position:relative;width:120px;height:3px;margin-bottom:14px;border-radius:2px;background:var(--track);overflow:hidden}.loading-bar div{position:absolute;top:0;bottom:0;width:40%;border-radius:2px;background:var(--faint);animation:slide 1.2s ease-in-out infinite}@keyframes slide{0%{left:-40%}to{left:100%}}@media(prefers-reduced-motion:reduce){.loading-bar div{animation:none;left:30%}}.foot{flex:none;display:flex;flex-direction:column;gap:8px;padding:12px 16px}.actions{display:flex;align-items:center;gap:6px;min-height:34px}.foot-note{flex:1;min-width:0;color:var(--muted);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.foot-note.alarm{color:var(--error)}.foot-link{color:var(--muted);text-decoration:underline;text-underline-offset:3px;cursor:pointer}.foot-link:hover{color:var(--text)}@media(max-width:520px){.head{padding-left:14px}.foot{padding:12px 14px}}.anc{height:560px}#view{position:absolute;top:0;right:0;bottom:0;left:0;width:100%;height:100%;display:block;touch-action:none}.view-tools{position:absolute;top:10px;right:10px;display:flex;gap:6px;font-size:12px}#fullscreen .exit,.fullscreen #fullscreen .enter{display:none}.fullscreen #fullscreen .exit{display:block}.legend{position:absolute;left:14px;bottom:10px;display:flex;gap:14px;color:var(--muted);font-size:12px;pointer-events:none}.stage:has(.panel:not([hidden])) .legend{display:none}.legend span{display:inline-flex;align-items:center;gap:6px}.sw{display:inline-block;width:16px;height:0;border-top:1.6px solid var(--text)}.sw.rapid{border-top:1px dashed var(--faint)}.sw.todo{border-top-color:var(--todo)}.panel{position:absolute;top:10px;left:10px;width:280px;max-width:calc(100% - 20px);max-height:calc(100% - 20px);overflow:auto;padding:14px 16px;border-radius:12px;background:var(--panel);box-shadow:var(--panel-shadow)}.panel h2{margin:0 0 10px;font-size:13px;font-weight:600}.panel .note{margin:12px 0 0;font-size:12px;color:var(--muted)}.return-live{position:absolute;top:10px;left:50%;transform:translate(-50%);display:inline-flex;align-items:center;gap:7px;height:30px;padding:0 12px 0 10px;border-radius:999px;font-size:12px;background:var(--primary);color:var(--primary-text)}.colour{position:relative}.colour-btn{height:30px;padding:0 8px 0 9px;display:inline-flex;align-items:center;gap:6px;border-radius:8px;background:var(--chip);box-shadow:var(--chip-shadow);font-size:12px;white-space:nowrap}.colour-btn svg{fill:none;stroke:currentColor;stroke-width:1.4;stroke-linecap:round;stroke-linejoin:round}.colour-btn svg .fill{fill:currentColor;stroke:none}.menu{position:absolute;top:36px;right:0;z-index:2;width:220px;padding:6px;border-radius:12px;background:var(--panel);box-shadow:var(--panel-shadow);display:flex;flex-direction:column;gap:2px}.menu button{width:100%;display:flex;align-items:flex-start;gap:8px;padding:7px 8px;border-radius:8px;background:none;text-align:left;font-size:12px}.menu button[aria-checked=true]{background:var(--track)}.menu button svg{flex:none;margin-top:2px;fill:none;stroke:transparent;stroke-width:1.6;stroke-linecap:round;stroke-linejoin:round}.menu button[aria-checked=true] svg{stroke:currentColor}.menu b{display:block;font-weight:500}.menu small{display:block;font-size:12px;font-weight:400;color:var(--muted)}.legend code{font:12px var(--mono)}.legend.ramp>span:first-child{gap:8px}.ramp-bar{width:80px;height:6px;border-radius:3px}.legend.tools{flex-wrap:wrap;gap:4px 14px;right:14px}.legend .tool-sw{width:16px;height:3px;border-radius:2px}.legend.off{display:none}.fit-chip{position:absolute;top:10px;left:10px;display:inline-flex;align-items:center;gap:7px;height:30px;padding:0 12px 0 9px;border-radius:999px;background:var(--chip);box-shadow:var(--chip-shadow);font-size:12px;font-weight:500}.fit-chip.over{color:var(--error)}.stage:has(.panel:not([hidden])) .fit-chip{display:none}.mark{flex:none;width:16px;height:16px;display:inline-flex}.fit-chip .mark{width:14px;height:14px}.mark svg{width:100%;height:100%}.panel .split{display:flex;align-items:baseline;justify-content:space-between;gap:12px}.panel .split span{font-size:12px;font-weight:400;color:var(--muted)}.panel h3{margin:16px 0 4px;font-size:12px;font-weight:600}.steps{list-style:none;margin:0 -8px;padding:0}.steps button{width:100%;display:flex;align-items:center;gap:10px;padding:6px 8px;border-radius:8px;background:none;text-align:left}.steps button:hover{background:var(--track)}.steps .name{flex:1;min-width:0;display:flex;flex-direction:column}.steps .name small{font-size:12px;font-weight:400;color:var(--muted);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.steps .t{flex:none;font:12px var(--mono);color:var(--muted)}.check-list{list-style:none;margin:0;padding:0;display:flex;flex-direction:column;gap:14px}.check-list li{display:flex;gap:10px}.check-list .mark{height:19px;align-items:center}.check-list .body{flex:1;min-width:0;display:flex;flex-direction:column;gap:2px}.check-list .check-title{font-weight:500}.check-list small{font-size:12px;color:var(--muted)}.check-list .jump{padding:0;background:none;font-size:12px;font-weight:400;text-decoration:underline;text-underline-offset:3px}.checks-btn{display:inline-flex;align-items:center;gap:7px}.checks-btn>span{display:inline-flex;align-items:center;gap:5px;font-size:12px;font-weight:400;color:var(--muted)}.checks-btn i{width:7px;height:7px;border-radius:50%;background:var(--online)}.checks-btn i.problem{background:var(--error)}.checks-btn i.check{background:var(--warn)}#scrub{-webkit-appearance:none;-moz-appearance:none;appearance:none;width:100%;height:16px;margin:0;background:none;cursor:pointer;--fill: 0%}#scrub:disabled{opacity:.4;cursor:default}#scrub::-webkit-slider-runnable-track{height:4px;border-radius:2px;background:linear-gradient(to right,var(--text) var(--fill),var(--track) var(--fill))}#scrub::-moz-range-track{height:4px;border-radius:2px;background:linear-gradient(to right,var(--text) var(--fill),var(--track) var(--fill))}#scrub::-webkit-slider-thumb{-webkit-appearance:none;width:14px;height:14px;margin-top:-5px;border-radius:50%;background:var(--chip);box-shadow:0 0 0 1px var(--thumb-edge),0 1px 3px #0003}#scrub::-moz-range-thumb{width:14px;height:14px;border:0;border-radius:50%;background:var(--chip);box-shadow:0 0 0 1px var(--thumb-edge),0 1px 3px #0003}.caption{display:flex;align-items:baseline;gap:10px;min-width:0;font:12px/1.5 var(--mono)}.line-label,.time{flex:none;color:var(--muted);font-variant-numeric:tabular-nums}.line-text{flex:1;min-width:0;font:inherit;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.time{margin-left:auto}.foot>.actions{margin-top:2px}.run-note{padding-left:6px;text-align:right}@media(max-width:520px){.legend,.line-text{display:none}.legend.tools,.legend.ramp{display:flex}}</style>
|
|
4335
|
+
</head>
|
|
4336
|
+
<body>
|
|
4337
|
+
<main class="anc" id="root">
|
|
4338
|
+
<header class="head">
|
|
4339
|
+
<div class="titles">
|
|
4340
|
+
<span class="title" id="job-name">Opening job…</span>
|
|
4341
|
+
<span class="meta" id="job-meta">Toolpath viewer</span>
|
|
4342
|
+
</div>
|
|
4343
|
+
<span class="status" id="status"><i></i><span id="status-text">Connecting</span></span>
|
|
4344
|
+
</header>
|
|
4345
|
+
|
|
4346
|
+
<div class="stage">
|
|
4347
|
+
<canvas id="view"></canvas>
|
|
4348
|
+
<div class="view-tools" id="view-tools">
|
|
4349
|
+
<div class="colour" id="colour" hidden>
|
|
4350
|
+
<button class="colour-btn" id="colour-btn" aria-haspopup="menu" aria-expanded="false">
|
|
4351
|
+
<svg width="14" height="14" viewBox="0 0 14 14" aria-hidden="true"><circle cx="7" cy="7" r="5.5"/><path class="fill" d="M7 1.5a5.5 5.5 0 0 1 0 11z"/></svg><span id="colour-label">Colour</span><svg width="10" height="10" viewBox="0 0 10 10" aria-hidden="true"><path d="M2.5 4 5 6.5 7.5 4"/></svg>
|
|
4352
|
+
</button>
|
|
4353
|
+
<div class="menu" id="colour-menu" role="menu" aria-label="Colour the toolpath by" hidden>
|
|
4354
|
+
<button role="menuitemradio" data-colour="plain" aria-checked="true"><svg width="14" height="14" viewBox="0 0 14 14" aria-hidden="true"><path d="M3 7.2 5.8 10 11 4"/></svg><span><b>Plain</b><small>Cuts and rapids</small></span></button>
|
|
4355
|
+
<button role="menuitemradio" data-colour="depth" aria-checked="false"><svg width="14" height="14" viewBox="0 0 14 14" aria-hidden="true"><path d="M3 7.2 5.8 10 11 4"/></svg><span><b>Depth</b><small>How deep each move cuts</small></span></button>
|
|
4356
|
+
<button role="menuitemradio" data-colour="feed" aria-checked="false"><svg width="14" height="14" viewBox="0 0 14 14" aria-hidden="true"><path d="M3 7.2 5.8 10 11 4"/></svg><span><b>Feed rate</b><small>How fast each move cuts</small></span></button>
|
|
4357
|
+
<button role="menuitemradio" data-colour="tool" aria-checked="false"><svg width="14" height="14" viewBox="0 0 14 14" aria-hidden="true"><path d="M3 7.2 5.8 10 11 4"/></svg><span><b>Tool</b><small>Which tool makes each move</small></span></button>
|
|
4358
|
+
</div>
|
|
4359
|
+
</div>
|
|
4360
|
+
<div class="segmented" role="group" aria-label="View">
|
|
4361
|
+
<button id="view-top" aria-pressed="false">Top</button>
|
|
4362
|
+
<button id="view-3d" aria-pressed="true">3D</button>
|
|
4363
|
+
</div>
|
|
4364
|
+
<button class="icon chip" id="fit" aria-label="Fit job to view" title="Fit">
|
|
4365
|
+
<svg width="14" height="14" viewBox="0 0 14 14" aria-hidden="true"><path d="M1.5 4.5v-3h3M9.5 1.5h3v3M12.5 9.5v3h-3M4.5 12.5h-3v-3"/></svg>
|
|
4366
|
+
</button>
|
|
4367
|
+
<button class="icon chip" id="fullscreen" aria-label="Fullscreen" title="Fullscreen" hidden>
|
|
4368
|
+
<svg class="enter" width="14" height="14" viewBox="0 0 14 14" aria-hidden="true"><path d="M8.5 1.5h4v4M12.5 1.5 8 6M5.5 12.5h-4v-4M1.5 12.5 6 8"/></svg>
|
|
4369
|
+
<svg class="exit" width="14" height="14" viewBox="0 0 14 14" aria-hidden="true"><path d="M12.5 5.5h-4v-4M8.5 5.5 13 1M1.5 8.5h4v4M5.5 8.5 1 13"/></svg>
|
|
4370
|
+
</button>
|
|
4371
|
+
</div>
|
|
4372
|
+
<div class="legend" id="legend">
|
|
4373
|
+
<span><i class="sw cut"></i>Cut</span>
|
|
4374
|
+
<span><i class="sw rapid"></i>Rapid</span>
|
|
4375
|
+
<span><i class="sw todo"></i>To come</span>
|
|
4376
|
+
<span id="legend-live" hidden><i class="dot live"></i>Machine</span>
|
|
4377
|
+
</div>
|
|
4378
|
+
<div class="legend ramp" id="legend-ramp" hidden>
|
|
4379
|
+
<span><span id="ramp-name"></span><code id="ramp-lo"></code><i class="ramp-bar" id="ramp-bar"></i><code id="ramp-hi"></code></span>
|
|
4380
|
+
<span><i class="sw rapid"></i>Rapid</span>
|
|
4381
|
+
</div>
|
|
4382
|
+
<div class="legend tools" id="legend-tools" hidden></div>
|
|
4383
|
+
<div class="fit-chip" id="fit-chip" hidden><span class="mark" id="fit-mark"></span><span id="fit-text"></span></div>
|
|
4384
|
+
<aside class="panel" id="details" aria-label="Job details" hidden>
|
|
4385
|
+
<h2>Job</h2>
|
|
4386
|
+
<dl class="facts" id="details-list"></dl>
|
|
4387
|
+
<div id="steps-box" hidden>
|
|
4388
|
+
<h3>Steps</h3>
|
|
4389
|
+
<ol class="steps" id="steps"></ol>
|
|
4390
|
+
</div>
|
|
4391
|
+
<p class="note" id="details-note">Toolpath preview only. It doesn't simulate material or collisions.</p>
|
|
4392
|
+
</aside>
|
|
4393
|
+
<aside class="panel" id="checks" aria-label="Checks" hidden>
|
|
4394
|
+
<h2 class="split">Checks<span id="checks-summary"></span></h2>
|
|
4395
|
+
<ul class="check-list" id="check-list"></ul>
|
|
4396
|
+
<p class="note">Checks read the G-code and your machine's settings. They can't see your stock or clamps.</p>
|
|
4397
|
+
</aside>
|
|
4398
|
+
<aside class="panel" id="machine" aria-label="Machine details" hidden>
|
|
4399
|
+
<h2>Machine</h2>
|
|
4400
|
+
<dl class="facts" id="machine-list"></dl>
|
|
4401
|
+
<p class="note">Work position is in the job's coordinates. Machine position is from home.</p>
|
|
4402
|
+
</aside>
|
|
4403
|
+
<button class="return-live" id="return-live" hidden><i class="dot live"></i>Back to live</button>
|
|
4404
|
+
<div class="message" id="message" hidden>
|
|
4405
|
+
<div class="loading-bar" id="loading-bar" hidden><div></div></div>
|
|
4406
|
+
<span class="message-title" id="message-title"></span>
|
|
4407
|
+
<span class="message-body" id="message-body"></span>
|
|
4408
|
+
</div>
|
|
4409
|
+
</div>
|
|
4410
|
+
|
|
4411
|
+
<footer class="foot">
|
|
4412
|
+
<input type="range" id="scrub" min="0" max="0" value="0" step="1" aria-label="Preview position">
|
|
4413
|
+
<div class="caption">
|
|
4414
|
+
<span class="line-label" id="line-label">Line – / –</span>
|
|
4415
|
+
<code class="line-text" id="line-text"></code>
|
|
4416
|
+
<span class="time" id="time"></span>
|
|
4417
|
+
</div>
|
|
4418
|
+
<div class="actions">
|
|
4419
|
+
<button class="toggle" id="details-btn" aria-pressed="false">Job</button>
|
|
4420
|
+
<button class="toggle checks-btn" id="checks-btn" aria-pressed="false" hidden>Checks<span><i id="checks-dot"></i><span id="checks-count"></span></span></button>
|
|
4421
|
+
<button class="toggle" id="machine-btn" aria-pressed="false">Machine</button>
|
|
4422
|
+
<span class="foot-note run-note" id="run-note"></span>
|
|
4423
|
+
<button class="secondary" id="btn-load" hidden>Load into CNCjs</button>
|
|
4424
|
+
<button class="primary" id="btn-start" hidden>Start</button>
|
|
4425
|
+
<button class="secondary" id="btn-pause" hidden>Pause</button>
|
|
4426
|
+
<button class="secondary" id="btn-resume" hidden>Resume</button>
|
|
4427
|
+
<button class="primary" id="btn-stop" hidden>Stop</button>
|
|
4428
|
+
<button class="secondary" id="btn-unlock" hidden>Unlock</button>
|
|
4429
|
+
</div>
|
|
4430
|
+
</footer>
|
|
4431
|
+
</main>
|
|
4432
|
+
</body>
|
|
4433
|
+
</html>
|