@fnndsc/argus 0.18.0 → 0.18.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,9 +1,9 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./cornerstoneEngine-BIu8DPDK.js","./_commonjsHelpers-CE1G-McA.js"])))=>i.map(i=>d[i]);
2
- (function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))s(i);new MutationObserver(i=>{for(const r of i)if(r.type==="childList")for(const a of r.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&s(a)}).observe(document,{childList:!0,subtree:!0});function t(i){const r={};return i.integrity&&(r.integrity=i.integrity),i.referrerPolicy&&(r.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?r.credentials="include":i.crossOrigin==="anonymous"?r.credentials="omit":r.credentials="same-origin",r}function s(i){if(i.ep)return;i.ep=!0;const r=t(i);fetch(i.href,r)}})();const _M=["cold","cached","failed"];function wM(n){return n.state??(n.restored===!0?"cached":"cold")}const yM=["upload","download","pull","workflow","pipeline","group","task"],vM=["transfer","retrieve","workflow","inspection"],OM=["scanning","transferring","watching","retrying","reading","working","complete","failed"],xM=["files","bytes","series","jobs","nodes"],SM=["running","done","unconfirmed","stalled","timeout","error","unknown"],Vc=1;var Dt;(function(n){n.assertEqual=i=>{};function e(i){}n.assertIs=e;function t(i){throw new Error}n.assertNever=t,n.arrayToEnum=i=>{const r={};for(const a of i)r[a]=a;return r},n.getValidEnumValues=i=>{const r=n.objectKeys(i).filter(o=>typeof i[i[o]]!="number"),a={};for(const o of r)a[o]=i[o];return n.objectValues(a)},n.objectValues=i=>n.objectKeys(i).map(function(r){return i[r]}),n.objectKeys=typeof Object.keys=="function"?i=>Object.keys(i):i=>{const r=[];for(const a in i)Object.prototype.hasOwnProperty.call(i,a)&&r.push(a);return r},n.find=(i,r)=>{for(const a of i)if(r(a))return a},n.isInteger=typeof Number.isInteger=="function"?i=>Number.isInteger(i):i=>typeof i=="number"&&Number.isFinite(i)&&Math.floor(i)===i;function s(i,r=" | "){return i.map(a=>typeof a=="string"?`'${a}'`:a).join(r)}n.joinValues=s,n.jsonStringifyReplacer=(i,r)=>typeof r=="bigint"?r.toString():r})(Dt||(Dt={}));var eh;(function(n){n.mergeShapes=(e,t)=>({...e,...t})})(eh||(eh={}));const ke=Dt.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),mi=n=>{switch(typeof n){case"undefined":return ke.undefined;case"string":return ke.string;case"number":return Number.isNaN(n)?ke.nan:ke.number;case"boolean":return ke.boolean;case"function":return ke.function;case"bigint":return ke.bigint;case"symbol":return ke.symbol;case"object":return Array.isArray(n)?ke.array:n===null?ke.null:n.then&&typeof n.then=="function"&&n.catch&&typeof n.catch=="function"?ke.promise:typeof Map<"u"&&n instanceof Map?ke.map:typeof Set<"u"&&n instanceof Set?ke.set:typeof Date<"u"&&n instanceof Date?ke.date:ke.object;default:return ke.unknown}},ye=Dt.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class ei extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=s=>{this.issues=[...this.issues,s]},this.addIssues=(s=[])=>{this.issues=[...this.issues,...s]};const t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}format(e){const t=e||function(r){return r.message},s={_errors:[]},i=r=>{for(const a of r.issues)if(a.code==="invalid_union")a.unionErrors.map(i);else if(a.code==="invalid_return_type")i(a.returnTypeError);else if(a.code==="invalid_arguments")i(a.argumentsError);else if(a.path.length===0)s._errors.push(t(a));else{let o=s,l=0;for(;l<a.path.length;){const c=a.path[l];l===a.path.length-1?(o[c]=o[c]||{_errors:[]},o[c]._errors.push(t(a))):o[c]=o[c]||{_errors:[]},o=o[c],l++}}};return i(this),s}static assert(e){if(!(e instanceof ei))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,Dt.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=t=>t.message){const t={},s=[];for(const i of this.issues)if(i.path.length>0){const r=i.path[0];t[r]=t[r]||[],t[r].push(e(i))}else s.push(e(i));return{formErrors:s,fieldErrors:t}}get formErrors(){return this.flatten()}}ei.create=n=>new ei(n);const Hc=(n,e)=>{let t;switch(n.code){case ye.invalid_type:n.received===ke.undefined?t="Required":t=`Expected ${n.expected}, received ${n.received}`;break;case ye.invalid_literal:t=`Invalid literal value, expected ${JSON.stringify(n.expected,Dt.jsonStringifyReplacer)}`;break;case ye.unrecognized_keys:t=`Unrecognized key(s) in object: ${Dt.joinValues(n.keys,", ")}`;break;case ye.invalid_union:t="Invalid input";break;case ye.invalid_union_discriminator:t=`Invalid discriminator value. Expected ${Dt.joinValues(n.options)}`;break;case ye.invalid_enum_value:t=`Invalid enum value. Expected ${Dt.joinValues(n.options)}, received '${n.received}'`;break;case ye.invalid_arguments:t="Invalid function arguments";break;case ye.invalid_return_type:t="Invalid function return type";break;case ye.invalid_date:t="Invalid date";break;case ye.invalid_string:typeof n.validation=="object"?"includes"in n.validation?(t=`Invalid input: must include "${n.validation.includes}"`,typeof n.validation.position=="number"&&(t=`${t} at one or more positions greater than or equal to ${n.validation.position}`)):"startsWith"in n.validation?t=`Invalid input: must start with "${n.validation.startsWith}"`:"endsWith"in n.validation?t=`Invalid input: must end with "${n.validation.endsWith}"`:Dt.assertNever(n.validation):n.validation!=="regex"?t=`Invalid ${n.validation}`:t="Invalid";break;case ye.too_small:n.type==="array"?t=`Array must contain ${n.exact?"exactly":n.inclusive?"at least":"more than"} ${n.minimum} element(s)`:n.type==="string"?t=`String must contain ${n.exact?"exactly":n.inclusive?"at least":"over"} ${n.minimum} character(s)`:n.type==="number"?t=`Number must be ${n.exact?"exactly equal to ":n.inclusive?"greater than or equal to ":"greater than "}${n.minimum}`:n.type==="bigint"?t=`Number must be ${n.exact?"exactly equal to ":n.inclusive?"greater than or equal to ":"greater than "}${n.minimum}`:n.type==="date"?t=`Date must be ${n.exact?"exactly equal to ":n.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(n.minimum))}`:t="Invalid input";break;case ye.too_big:n.type==="array"?t=`Array must contain ${n.exact?"exactly":n.inclusive?"at most":"less than"} ${n.maximum} element(s)`:n.type==="string"?t=`String must contain ${n.exact?"exactly":n.inclusive?"at most":"under"} ${n.maximum} character(s)`:n.type==="number"?t=`Number must be ${n.exact?"exactly":n.inclusive?"less than or equal to":"less than"} ${n.maximum}`:n.type==="bigint"?t=`BigInt must be ${n.exact?"exactly":n.inclusive?"less than or equal to":"less than"} ${n.maximum}`:n.type==="date"?t=`Date must be ${n.exact?"exactly":n.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(n.maximum))}`:t="Invalid input";break;case ye.custom:t="Invalid input";break;case ye.invalid_intersection_types:t="Intersection results could not be merged";break;case ye.not_multiple_of:t=`Number must be a multiple of ${n.multipleOf}`;break;case ye.not_finite:t="Number must be finite";break;default:t=e.defaultError,Dt.assertNever(n)}return{message:t}};let AM=Hc;function EM(){return AM}const DM=n=>{const{data:e,path:t,errorMaps:s,issueData:i}=n,r=[...t,...i.path||[]],a={...i,path:r};if(i.message!==void 0)return{...i,path:r,message:i.message};let o="";const l=s.filter(c=>!!c).slice().reverse();for(const c of l)o=c(a,{data:e,defaultError:o}).message;return{...i,path:r,message:o}};function Ce(n,e){const t=EM(),s=DM({issueData:e,data:n.data,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,t,t===Hc?void 0:Hc].filter(i=>!!i)});n.common.issues.push(s)}class Cs{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,t){const s=[];for(const i of t){if(i.status==="aborted")return at;i.status==="dirty"&&e.dirty(),s.push(i.value)}return{status:e.value,value:s}}static async mergeObjectAsync(e,t){const s=[];for(const i of t){const r=await i.key,a=await i.value;s.push({key:r,value:a})}return Cs.mergeObjectSync(e,s)}static mergeObjectSync(e,t){const s={};for(const i of t){const{key:r,value:a}=i;if(r.status==="aborted"||a.status==="aborted")return at;r.status==="dirty"&&e.dirty(),a.status==="dirty"&&e.dirty(),r.value!=="__proto__"&&(typeof a.value<"u"||i.alwaysSet)&&(s[r.value]=a.value)}return{status:e.value,value:s}}}const at=Object.freeze({status:"aborted"}),Aa=n=>({status:"dirty",value:n}),on=n=>({status:"valid",value:n}),th=n=>n.status==="aborted",sh=n=>n.status==="dirty",Ur=n=>n.status==="valid",Zo=n=>typeof Promise<"u"&&n instanceof Promise;var qe;(function(n){n.errToObj=e=>typeof e=="string"?{message:e}:e||{},n.toString=e=>typeof e=="string"?e:e?.message})(qe||(qe={}));class Tn{constructor(e,t,s,i){this._cachedPath=[],this.parent=e,this.data=t,this._path=s,this._key=i}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const nh=(n,e)=>{if(Ur(e))return{success:!0,data:e.value};if(!n.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const t=new ei(n.common.issues);return this._error=t,this._error}}};function mt(n){if(!n)return{};const{errorMap:e,invalid_type_error:t,required_error:s,description:i}=n;if(e&&(t||s))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:i}:{errorMap:(a,o)=>{const{message:l}=n;return a.code==="invalid_enum_value"?{message:l??o.defaultError}:typeof o.data>"u"?{message:l??s??o.defaultError}:a.code!=="invalid_type"?{message:o.defaultError}:{message:l??t??o.defaultError}},description:i}}class vt{get description(){return this._def.description}_getType(e){return mi(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:mi(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new Cs,ctx:{common:e.parent.common,data:e.data,parsedType:mi(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if(Zo(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){const t=this._parse(e);return Promise.resolve(t)}parse(e,t){const s=this.safeParse(e,t);if(s.success)return s.data;throw s.error}safeParse(e,t){const s={common:{issues:[],async:t?.async??!1,contextualErrorMap:t?.errorMap},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:mi(e)},i=this._parseSync({data:e,path:s.path,parent:s});return nh(s,i)}"~validate"(e){const t={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:mi(e)};if(!this["~standard"].async)try{const s=this._parseSync({data:e,path:[],parent:t});return Ur(s)?{value:s.value}:{issues:t.common.issues}}catch(s){s?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),t.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:t}).then(s=>Ur(s)?{value:s.value}:{issues:t.common.issues})}async parseAsync(e,t){const s=await this.safeParseAsync(e,t);if(s.success)return s.data;throw s.error}async safeParseAsync(e,t){const s={common:{issues:[],contextualErrorMap:t?.errorMap,async:!0},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:mi(e)},i=this._parse({data:e,path:s.path,parent:s}),r=await(Zo(i)?i:Promise.resolve(i));return nh(s,r)}refine(e,t){const s=i=>typeof t=="string"||typeof t>"u"?{message:t}:typeof t=="function"?t(i):t;return this._refinement((i,r)=>{const a=e(i),o=()=>r.addIssue({code:ye.custom,...s(i)});return typeof Promise<"u"&&a instanceof Promise?a.then(l=>l?!0:(o(),!1)):a?!0:(o(),!1)})}refinement(e,t){return this._refinement((s,i)=>e(s)?!0:(i.addIssue(typeof t=="function"?t(s,i):t),!1))}_refinement(e){return new Ki({schema:this,typeName:ot.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:t=>this["~validate"](t)}}optional(){return Kn.create(this,this._def)}nullable(){return Zi.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return En.create(this)}promise(){return il.create(this,this._def)}or(e){return Jo.create([this,e],this._def)}and(e){return el.create(this,e,this._def)}transform(e){return new Ki({...mt(this._def),schema:this,typeName:ot.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t=typeof e=="function"?e:()=>e;return new rl({...mt(this._def),innerType:this,defaultValue:t,typeName:ot.ZodDefault})}brand(){return new om({typeName:ot.ZodBranded,type:this,...mt(this._def)})}catch(e){const t=typeof e=="function"?e:()=>e;return new al({...mt(this._def),innerType:this,catchValue:t,typeName:ot.ZodCatch})}describe(e){const t=this.constructor;return new t({...this._def,description:e})}pipe(e){return cu.create(this,e)}readonly(){return ol.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.saf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9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,jM=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,$M=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,im="((\\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])))",VM=new RegExp(`^${im}$`);function rm(n){let e="[0-5]\\d";n.precision?e=`${e}\\.\\d{${n.precision}}`:n.precision==null&&(e=`${e}(\\.\\d+)?`);const t=n.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${t}`}function HM(n){return new RegExp(`^${rm(n)}$`)}function qM(n){let e=`${im}T${rm(n)}`;const t=[];return t.push(n.local?"Z?":"Z"),n.offset&&t.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${t.join("|")})`,new RegExp(`^${e}$`)}function XM(n,e){return!!((e==="v4"||!e)&&WM.test(n)||(e==="v6"||!e)&&UM.test(n))}function YM(n,e){if(!NM.test(n))return!1;try{const[t]=n.split(".");if(!t)return!1;const s=t.replace(/-/g,"+").replace(/_/g,"/").padEnd(t.length+(4-t.length%4)%4,"="),i=JSON.parse(atob(s));return!(typeof i!="object"||i===null||"typ"in i&&i?.typ!=="JWT"||!i.alg||e&&i.alg!==e)}catch{return!1}}function KM(n,e){return!!((e==="v4"||!e)&&kM.test(n)||(e==="v6"||!e)&&FM.test(n))}class Xn extends vt{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==ke.string){const r=this._getOrReturnCtx(e);return Ce(r,{code:ye.invalid_type,expected:ke.string,received:r.parsedType}),at}const s=new Cs;let i;for(const r of this._def.checks)if(r.kind==="min")e.data.length<r.value&&(i=this._getOrReturnCtx(e,i),Ce(i,{code:ye.too_small,minimum:r.value,type:"string",inclusive:!0,exact:!1,message:r.message}),s.dirty());else if(r.kind==="max")e.data.length>r.value&&(i=this._getOrReturnCtx(e,i),Ce(i,{code:ye.too_big,maximum:r.value,type:"string",inclusive:!0,exact:!1,message:r.message}),s.dirty());else if(r.kind==="length"){const a=e.data.length>r.value,o=e.data.length<r.value;(a||o)&&(i=this._getOrReturnCtx(e,i),a?Ce(i,{code:ye.too_big,maximum:r.value,type:"string",inclusive:!0,exact:!0,message:r.message}):o&&Ce(i,{code:ye.too_small,minimum:r.value,type:"string",inclusive:!0,exact:!0,message:r.message}),s.dirty())}else if(r.kind==="email")PM.test(e.data)||(i=this._getOrReturnCtx(e,i),Ce(i,{validation:"email",code:ye.invalid_string,message:r.message}),s.dirty());else if(r.kind==="emoji")Ul||(Ul=new RegExp(LM,"u")),Ul.test(e.data)||(i=this._getOrReturnCtx(e,i),Ce(i,{validation:"emoji",code:ye.invalid_string,message:r.message}),s.dirty());else if(r.kind==="uuid")RM.test(e.data)||(i=this._getOrReturnCtx(e,i),Ce(i,{validation:"uuid",code:ye.invalid_string,message:r.message}),s.dirty());else if(r.kind==="nanoid")BM.test(e.data)||(i=this._getOrReturnCtx(e,i),Ce(i,{validation:"nanoid",code:ye.invalid_string,message:r.message}),s.dirty());else if(r.kind==="cuid")IM.test(e.data)||(i=this._getOrReturnCtx(e,i),Ce(i,{validation:"cuid",code:ye.invalid_string,message:r.message}),s.dirty());else if(r.kind==="cuid2")TM.test(e.data)||(i=this._getOrReturnCtx(e,i),Ce(i,{validation:"cuid2",code:ye.invalid_string,message:r.message}),s.dirty());else if(r.kind==="ulid")GM.test(e.data)||(i=this._getOrReturnCtx(e,i),Ce(i,{validation:"ulid",code:ye.invalid_string,message:r.message}),s.dirty());else if(r.kind==="url")try{new URL(e.data)}catch{i=this._getOrReturnCtx(e,i),Ce(i,{validation:"url",code:ye.invalid_string,message:r.message}),s.dirty()}else r.kind==="regex"?(r.regex.lastIndex=0,r.regex.test(e.data)||(i=this._getOrReturnCtx(e,i),Ce(i,{validation:"regex",code:ye.invalid_string,message:r.message}),s.dirty())):r.kind==="trim"?e.data=e.data.trim():r.kind==="includes"?e.data.includes(r.value,r.position)||(i=this._getOrReturnCtx(e,i),Ce(i,{code:ye.invalid_string,validation:{includes:r.value,position:r.position},message:r.message}),s.dirty()):r.kind==="toLowerCase"?e.data=e.data.toLowerCase():r.kind==="toUpperCase"?e.data=e.data.toUpperCase():r.kind==="startsWith"?e.data.startsWith(r.value)||(i=this._getOrReturnCtx(e,i),Ce(i,{code:ye.invalid_string,validation:{startsWith:r.value},message:r.message}),s.dirty()):r.kind==="endsWith"?e.data.endsWith(r.value)||(i=this._getOrReturnCtx(e,i),Ce(i,{code:ye.invalid_string,validation:{endsWith:r.value},message:r.message}),s.dirty()):r.kind==="datetime"?qM(r).test(e.data)||(i=this._getOrReturnCtx(e,i),Ce(i,{code:ye.invalid_string,validation:"datetime",message:r.message}),s.dirty()):r.kind==="date"?VM.test(e.data)||(i=this._getOrReturnCtx(e,i),Ce(i,{code:ye.invalid_string,validation:"date",message:r.message}),s.dirty()):r.kind==="time"?HM(r).test(e.data)||(i=this._getOrReturnCtx(e,i),Ce(i,{code:ye.invalid_string,validation:"time",message:r.message}),s.dirty()):r.kind==="duration"?CM.test(e.data)||(i=this._getOrReturnCtx(e,i),Ce(i,{validation:"duration",code:ye.invalid_string,message:r.message}),s.dirty()):r.kind==="ip"?XM(e.data,r.version)||(i=this._getOrReturnCtx(e,i),Ce(i,{validation:"ip",code:ye.invalid_string,message:r.message}),s.dirty()):r.kind==="jwt"?YM(e.data,r.alg)||(i=this._getOrReturnCtx(e,i),Ce(i,{validation:"jwt",code:ye.invalid_string,message:r.message}),s.dirty()):r.kind==="cidr"?KM(e.data,r.version)||(i=this._getOrReturnCtx(e,i),Ce(i,{validation:"cidr",code:ye.invalid_string,message:r.message}),s.dirty()):r.kind==="base64"?jM.test(e.data)||(i=this._getOrReturnCtx(e,i),Ce(i,{validation:"base64",code:ye.invalid_string,message:r.message}),s.dirty()):r.kind==="base64url"?$M.test(e.data)||(i=this._getOrReturnCtx(e,i),Ce(i,{validation:"base64url",code:ye.invalid_string,message:r.message}),s.dirty()):Dt.assertNever(r);return{status:s.value,value:e.data}}_regex(e,t,s){return this.refinement(i=>e.test(i),{validation:t,code:ye.invalid_string,...qe.errToObj(s)})}_addCheck(e){return new Xn({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...qe.errToObj(e)})}url(e){return this._addCheck({kind:"url",...qe.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...qe.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...qe.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...qe.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...qe.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...qe.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...qe.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...qe.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...qe.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...qe.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...qe.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...qe.errToObj(e)})}datetime(e){return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...qe.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof e?.precision>"u"?null:e?.precision,...qe.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...qe.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...qe.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t?.position,...qe.errToObj(t?.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...qe.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...qe.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...qe.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...qe.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...qe.errToObj(t)})}nonempty(e){return this.min(1,qe.errToObj(e))}trim(){return new Xn({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new Xn({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new Xn({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}}Xn.create=n=>new Xn({checks:[],typeName:ot.ZodString,coerce:n?.coerce??!1,...mt(n)});function ZM(n,e){const t=(n.toString().split(".")[1]||"").length,s=(e.toString().split(".")[1]||"").length,i=t>s?t:s,r=Number.parseInt(n.toFixed(i).replace(".","")),a=Number.parseInt(e.toFixed(i).replace(".",""));return r%a/10**i}class Fr extends vt{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==ke.number){const r=this._getOrReturnCtx(e);return Ce(r,{code:ye.invalid_type,expected:ke.number,received:r.parsedType}),at}let s;const i=new Cs;for(const r of this._def.checks)r.kind==="int"?Dt.isInteger(e.data)||(s=this._getOrReturnCtx(e,s),Ce(s,{code:ye.invalid_type,expected:"integer",received:"float",message:r.message}),i.dirty()):r.kind==="min"?(r.inclusive?e.data<r.value:e.data<=r.value)&&(s=this._getOrReturnCtx(e,s),Ce(s,{code:ye.too_small,minimum:r.value,type:"number",inclusive:r.inclusive,exact:!1,message:r.message}),i.dirty()):r.kind==="max"?(r.inclusive?e.data>r.value:e.data>=r.value)&&(s=this._getOrReturnCtx(e,s),Ce(s,{code:ye.too_big,maximum:r.value,type:"number",inclusive:r.inclusive,exact:!1,message:r.message}),i.dirty()):r.kind==="multipleOf"?ZM(e.data,r.value)!==0&&(s=this._getOrReturnCtx(e,s),Ce(s,{code:ye.not_multiple_of,multipleOf:r.value,message:r.message}),i.dirty()):r.kind==="finite"?Number.isFinite(e.data)||(s=this._getOrReturnCtx(e,s),Ce(s,{code:ye.not_finite,message:r.message}),i.dirty()):Dt.assertNever(r);return{status:i.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,qe.toString(t))}gt(e,t){return this.setLimit("min",e,!1,qe.toString(t))}lte(e,t){return this.setLimit("max",e,!0,qe.toString(t))}lt(e,t){return this.setLimit("max",e,!1,qe.toString(t))}setLimit(e,t,s,i){return new Fr({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:s,message:qe.toString(i)}]})}_addCheck(e){return new Fr({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:qe.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:qe.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:qe.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:qe.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:qe.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:qe.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:qe.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:qe.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:qe.toString(e)})}get minValue(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&Dt.isInteger(e.value))}get isFinite(){let e=null,t=null;for(const s of this._def.checks){if(s.kind==="finite"||s.kind==="int"||s.kind==="multipleOf")return!0;s.kind==="min"?(t===null||s.value>t)&&(t=s.value):s.kind==="max"&&(e===null||s.value<e)&&(e=s.value)}return Number.isFinite(t)&&Number.isFinite(e)}}Fr.create=n=>new Fr({checks:[],typeName:ot.ZodNumber,coerce:n?.coerce||!1,...mt(n)});class Ca extends vt{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==ke.bigint)return this._getInvalidInput(e);let s;const i=new Cs;for(const r of this._def.checks)r.kind==="min"?(r.inclusive?e.data<r.value:e.data<=r.value)&&(s=this._getOrReturnCtx(e,s),Ce(s,{code:ye.too_small,type:"bigint",minimum:r.value,inclusive:r.inclusive,message:r.message}),i.dirty()):r.kind==="max"?(r.inclusive?e.data>r.value:e.data>=r.value)&&(s=this._getOrReturnCtx(e,s),Ce(s,{code:ye.too_big,type:"bigint",maximum:r.value,inclusive:r.inclusive,message:r.message}),i.dirty()):r.kind==="multipleOf"?e.data%r.value!==BigInt(0)&&(s=this._getOrReturnCtx(e,s),Ce(s,{code:ye.not_multiple_of,multipleOf:r.value,message:r.message}),i.dirty()):Dt.assertNever(r);return{status:i.value,value:e.data}}_getInvalidInput(e){const t=this._getOrReturnCtx(e);return Ce(t,{code:ye.invalid_type,expected:ke.bigint,received:t.parsedType}),at}gte(e,t){return this.setLimit("min",e,!0,qe.toString(t))}gt(e,t){return this.setLimit("min",e,!1,qe.toString(t))}lte(e,t){return this.setLimit("max",e,!0,qe.toString(t))}lt(e,t){return this.setLimit("max",e,!1,qe.toString(t))}setLimit(e,t,s,i){return new Ca({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:s,message:qe.toString(i)}]})}_addCheck(e){return new Ca({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:qe.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:qe.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:qe.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:qe.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:qe.toString(t)})}get minValue(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}}Ca.create=n=>new Ca({checks:[],typeName:ot.ZodBigInt,coerce:n?.coerce??!1,...mt(n)});class qc extends vt{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==ke.boolean){const s=this._getOrReturnCtx(e);return Ce(s,{code:ye.invalid_type,expected:ke.boolean,received:s.parsedType}),at}return on(e.data)}}qc.create=n=>new qc({typeName:ot.ZodBoolean,coerce:n?.coerce||!1,...mt(n)});class Qo extends vt{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==ke.date){const r=this._getOrReturnCtx(e);return Ce(r,{code:ye.invalid_type,expected:ke.date,received:r.parsedType}),at}if(Number.isNaN(e.data.getTime())){const r=this._getOrReturnCtx(e);return Ce(r,{code:ye.invalid_date}),at}const s=new Cs;let i;for(const r of this._def.checks)r.kind==="min"?e.data.getTime()<r.value&&(i=this._getOrReturnCtx(e,i),Ce(i,{code:ye.too_small,message:r.message,inclusive:!0,exact:!1,minimum:r.value,type:"date"}),s.dirty()):r.kind==="max"?e.data.getTime()>r.value&&(i=this._getOrReturnCtx(e,i),Ce(i,{code:ye.too_big,message:r.message,inclusive:!0,exact:!1,maximum:r.value,type:"date"}),s.dirty()):Dt.assertNever(r);return{status:s.value,value:new Date(e.data.getTime())}}_addCheck(e){return new Qo({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:qe.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:qe.toString(t)})}get minDate(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e!=null?new Date(e):null}}Qo.create=n=>new Qo({checks:[],coerce:n?.coerce||!1,typeName:ot.ZodDate,...mt(n)});class ih extends vt{_parse(e){if(this._getType(e)!==ke.symbol){const s=this._getOrReturnCtx(e);return Ce(s,{code:ye.invalid_type,expected:ke.symbol,received:s.parsedType}),at}return on(e.data)}}ih.create=n=>new ih({typeName:ot.ZodSymbol,...mt(n)});class Xc extends vt{_parse(e){if(this._getType(e)!==ke.undefined){const s=this._getOrReturnCtx(e);return Ce(s,{code:ye.invalid_type,expected:ke.undefined,received:s.parsedType}),at}return on(e.data)}}Xc.create=n=>new Xc({typeName:ot.ZodUndefined,...mt(n)});class Yc extends vt{_parse(e){if(this._getType(e)!==ke.null){const s=this._getOrReturnCtx(e);return Ce(s,{code:ye.invalid_type,expected:ke.null,received:s.parsedType}),at}return on(e.data)}}Yc.create=n=>new Yc({typeName:ot.ZodNull,...mt(n)});class rh extends vt{constructor(){super(...arguments),this._any=!0}_parse(e){return on(e.data)}}rh.create=n=>new rh({typeName:ot.ZodAny,...mt(n)});class Kc extends vt{constructor(){super(...arguments),this._unknown=!0}_parse(e){return on(e.data)}}Kc.create=n=>new Kc({typeName:ot.ZodUnknown,...mt(n)});class Ai extends vt{_parse(e){const t=this._getOrReturnCtx(e);return Ce(t,{code:ye.invalid_type,expected:ke.never,received:t.parsedType}),at}}Ai.create=n=>new Ai({typeName:ot.ZodNever,...mt(n)});class ah extends vt{_parse(e){if(this._getType(e)!==ke.undefined){const s=this._getOrReturnCtx(e);return Ce(s,{code:ye.invalid_type,expected:ke.void,received:s.parsedType}),at}return on(e.data)}}ah.create=n=>new ah({typeName:ot.ZodVoid,...mt(n)});class En extends vt{_parse(e){const{ctx:t,status:s}=this._processInputParams(e),i=this._def;if(t.parsedType!==ke.array)return Ce(t,{code:ye.invalid_type,expected:ke.array,received:t.parsedType}),at;if(i.exactLength!==null){const a=t.data.length>i.exactLength.value,o=t.data.length<i.exactLength.value;(a||o)&&(Ce(t,{code:a?ye.too_big:ye.too_small,minimum:o?i.exactLength.value:void 0,maximum:a?i.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:i.exactLength.message}),s.dirty())}if(i.minLength!==null&&t.data.length<i.minLength.value&&(Ce(t,{code:ye.too_small,minimum:i.minLength.value,type:"array",inclusive:!0,exact:!1,message:i.minLength.message}),s.dirty()),i.maxLength!==null&&t.data.length>i.maxLength.value&&(Ce(t,{code:ye.too_big,maximum:i.maxLength.value,type:"array",inclusive:!0,exact:!1,message:i.maxLength.message}),s.dirty()),t.common.async)return Promise.all([...t.data].map((a,o)=>i.type._parseAsync(new Tn(t,a,t.path,o)))).then(a=>Cs.mergeArray(s,a));const r=[...t.data].map((a,o)=>i.type._parseSync(new Tn(t,a,t.path,o)));return Cs.mergeArray(s,r)}get element(){return this._def.type}min(e,t){return new En({...this._def,minLength:{value:e,message:qe.toString(t)}})}max(e,t){return new En({...this._def,maxLength:{value:e,message:qe.toString(t)}})}length(e,t){return new En({...this._def,exactLength:{value:e,message:qe.toString(t)}})}nonempty(e){return this.min(1,e)}}En.create=(n,e)=>new En({type:n,minLength:null,maxLength:null,exactLength:null,typeName:ot.ZodArray,...mt(e)});function Nr(n){if(n instanceof ls){const e={};for(const t in n.shape){const s=n.shape[t];e[t]=Kn.create(Nr(s))}return new ls({...n._def,shape:()=>e})}else return n instanceof En?new En({...n._def,type:Nr(n.element)}):n instanceof Kn?Kn.create(Nr(n.unwrap())):n instanceof Zi?Zi.create(Nr(n.unwrap())):n instanceof Xi?Xi.create(n.items.map(e=>Nr(e))):n}class ls extends vt{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const e=this._def.shape(),t=Dt.objectKeys(e);return this._cached={shape:e,keys:t},this._cached}_parse(e){if(this._getType(e)!==ke.object){const c=this._getOrReturnCtx(e);return Ce(c,{code:ye.invalid_type,expected:ke.object,received:c.parsedType}),at}const{status:s,ctx:i}=this._processInputParams(e),{shape:r,keys:a}=this._getCached(),o=[];if(!(this._def.catchall instanceof Ai&&this._def.unknownKeys==="strip"))for(const c in i.data)a.includes(c)||o.push(c);const l=[];for(const c of a){const d=r[c],u=i.data[c];l.push({key:{status:"valid",value:c},value:d._parse(new Tn(i,u,i.path,c)),alwaysSet:c in i.data})}if(this._def.catchall instanceof Ai){const c=this._def.unknownKeys;if(c==="passthrough")for(const d of o)l.push({key:{status:"valid",value:d},value:{status:"valid",value:i.data[d]}});else if(c==="strict")o.length>0&&(Ce(i,{code:ye.unrecognized_keys,keys:o}),s.dirty());else if(c!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const c=this._def.catchall;for(const d of o){const u=i.data[d];l.push({key:{status:"valid",value:d},value:c._parse(new Tn(i,u,i.path,d)),alwaysSet:d in i.data})}}return i.common.async?Promise.resolve().then(async()=>{const c=[];for(const d of l){const u=await d.key,h=await d.value;c.push({key:u,value:h,alwaysSet:d.alwaysSet})}return c}).then(c=>Cs.mergeObjectSync(s,c)):Cs.mergeObjectSync(s,l)}get shape(){return this._def.shape()}strict(e){return qe.errToObj,new ls({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(t,s)=>{const i=this._def.errorMap?.(t,s).message??s.defaultError;return t.code==="unrecognized_keys"?{message:qe.errToObj(e).message??i}:{message:i}}}:{}})}strip(){return new ls({...this._def,unknownKeys:"strip"})}passthrough(){return new ls({...this._def,unknownKeys:"passthrough"})}extend(e){return new ls({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new ls({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:ot.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new ls({...this._def,catchall:e})}pick(e){const t={};for(const s of Dt.objectKeys(e))e[s]&&this.shape[s]&&(t[s]=this.shape[s]);return new ls({...this._def,shape:()=>t})}omit(e){const t={};for(const s of Dt.objectKeys(this.shape))e[s]||(t[s]=this.shape[s]);return new ls({...this._def,shape:()=>t})}deepPartial(){return Nr(this)}partial(e){const t={};for(const s of Dt.objectKeys(this.shape)){const i=this.shape[s];e&&!e[s]?t[s]=i:t[s]=i.optional()}return new ls({...this._def,shape:()=>t})}required(e){const t={};for(const s of Dt.objectKeys(this.shape))if(e&&!e[s])t[s]=this.shape[s];else{let r=this.shape[s];for(;r instanceof Kn;)r=r._def.innerType;t[s]=r}return new ls({...this._def,shape:()=>t})}keyof(){return am(Dt.objectKeys(this.shape))}}ls.create=(n,e)=>new ls({shape:()=>n,unknownKeys:"strip",catchall:Ai.create(),typeName:ot.ZodObject,...mt(e)});ls.strictCreate=(n,e)=>new ls({shape:()=>n,unknownKeys:"strict",catchall:Ai.create(),typeName:ot.ZodObject,...mt(e)});ls.lazycreate=(n,e)=>new ls({shape:n,unknownKeys:"strip",catchall:Ai.create(),typeName:ot.ZodObject,...mt(e)});class Jo extends vt{_parse(e){const{ctx:t}=this._processInputParams(e),s=this._def.options;function i(r){for(const o of r)if(o.result.status==="valid")return o.result;for(const o of r)if(o.result.status==="dirty")return t.common.issues.push(...o.ctx.common.issues),o.result;const a=r.map(o=>new ei(o.ctx.common.issues));return Ce(t,{code:ye.invalid_union,unionErrors:a}),at}if(t.common.async)return Promise.all(s.map(async r=>{const a={...t,common:{...t.common,issues:[]},parent:null};return{result:await r._parseAsync({data:t.data,path:t.path,parent:a}),ctx:a}})).then(i);{let r;const a=[];for(const l of s){const c={...t,common:{...t.common,issues:[]},parent:null},d=l._parseSync({data:t.data,path:t.path,parent:c});if(d.status==="valid")return d;d.status==="dirty"&&!r&&(r={result:d,ctx:c}),c.common.issues.length&&a.push(c.common.issues)}if(r)return t.common.issues.push(...r.ctx.common.issues),r.result;const o=a.map(l=>new ei(l));return Ce(t,{code:ye.invalid_union,unionErrors:o}),at}}get options(){return this._def.options}}Jo.create=(n,e)=>new Jo({options:n,typeName:ot.ZodUnion,...mt(e)});const Fn=n=>n instanceof sl?Fn(n.schema):n instanceof Ki?Fn(n.innerType()):n instanceof nl?[n.value]:n instanceof Yi?n.options:n instanceof Qc?Dt.objectValues(n.enum):n instanceof rl?Fn(n._def.innerType):n instanceof Xc?[void 0]:n instanceof Yc?[null]:n instanceof Kn?[void 0,...Fn(n.unwrap())]:n instanceof Zi?[null,...Fn(n.unwrap())]:n instanceof om||n instanceof ol?Fn(n.unwrap()):n instanceof al?Fn(n._def.innerType):[];class lu extends vt{_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==ke.object)return Ce(t,{code:ye.invalid_type,expected:ke.object,received:t.parsedType}),at;const s=this.discriminator,i=t.data[s],r=this.optionsMap.get(i);return r?t.common.async?r._parseAsync({data:t.data,path:t.path,parent:t}):r._parseSync({data:t.data,path:t.path,parent:t}):(Ce(t,{code:ye.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[s]}),at)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,s){const i=new Map;for(const r of t){const a=Fn(r.shape[e]);if(!a.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(const o of a){if(i.has(o))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(o)}`);i.set(o,r)}}return new lu({typeName:ot.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:i,...mt(s)})}}function Zc(n,e){const t=mi(n),s=mi(e);if(n===e)return{valid:!0,data:n};if(t===ke.object&&s===ke.object){const i=Dt.objectKeys(e),r=Dt.objectKeys(n).filter(o=>i.indexOf(o)!==-1),a={...n,...e};for(const o of r){const l=Zc(n[o],e[o]);if(!l.valid)return{valid:!1};a[o]=l.data}return{valid:!0,data:a}}else if(t===ke.array&&s===ke.array){if(n.length!==e.length)return{valid:!1};const i=[];for(let r=0;r<n.length;r++){const a=n[r],o=e[r],l=Zc(a,o);if(!l.valid)return{valid:!1};i.push(l.data)}return{valid:!0,data:i}}else return t===ke.date&&s===ke.date&&+n==+e?{valid:!0,data:n}:{valid:!1}}class el extends vt{_parse(e){const{status:t,ctx:s}=this._processInputParams(e),i=(r,a)=>{if(th(r)||th(a))return at;const o=Zc(r.value,a.value);return o.valid?((sh(r)||sh(a))&&t.dirty(),{status:t.value,value:o.data}):(Ce(s,{code:ye.invalid_intersection_types}),at)};return s.common.async?Promise.all([this._def.left._parseAsync({data:s.data,path:s.path,parent:s}),this._def.right._parseAsync({data:s.data,path:s.path,parent:s})]).then(([r,a])=>i(r,a)):i(this._def.left._parseSync({data:s.data,path:s.path,parent:s}),this._def.right._parseSync({data:s.data,path:s.path,parent:s}))}}el.create=(n,e,t)=>new el({left:n,right:e,typeName:ot.ZodIntersection,...mt(t)});class Xi extends vt{_parse(e){const{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==ke.array)return Ce(s,{code:ye.invalid_type,expected:ke.array,received:s.parsedType}),at;if(s.data.length<this._def.items.length)return Ce(s,{code:ye.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),at;!this._def.rest&&s.data.length>this._def.items.length&&(Ce(s,{code:ye.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());const r=[...s.data].map((a,o)=>{const l=this._def.items[o]||this._def.rest;return l?l._parse(new Tn(s,a,s.path,o)):null}).filter(a=>!!a);return s.common.async?Promise.all(r).then(a=>Cs.mergeArray(t,a)):Cs.mergeArray(t,r)}get items(){return this._def.items}rest(e){return new Xi({...this._def,rest:e})}}Xi.create=(n,e)=>{if(!Array.isArray(n))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Xi({items:n,typeName:ot.ZodTuple,rest:null,...mt(e)})};class tl extends vt{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==ke.object)return Ce(s,{code:ye.invalid_type,expected:ke.object,received:s.parsedType}),at;const i=[],r=this._def.keyType,a=this._def.valueType;for(const o in s.data)i.push({key:r._parse(new Tn(s,o,s.path,o)),value:a._parse(new Tn(s,s.data[o],s.path,o)),alwaysSet:o in s.data});return s.common.async?Cs.mergeObjectAsync(t,i):Cs.mergeObjectSync(t,i)}get element(){return this._def.valueType}static create(e,t,s){return t instanceof vt?new tl({keyType:e,valueType:t,typeName:ot.ZodRecord,...mt(s)}):new tl({keyType:Xn.create(),valueType:e,typeName:ot.ZodRecord,...mt(t)})}}class oh extends vt{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==ke.map)return Ce(s,{code:ye.invalid_type,expected:ke.map,received:s.parsedType}),at;const i=this._def.keyType,r=this._def.valueType,a=[...s.data.entries()].map(([o,l],c)=>({key:i._parse(new Tn(s,o,s.path,[c,"key"])),value:r._parse(new Tn(s,l,s.path,[c,"value"]))}));if(s.common.async){const o=new Map;return Promise.resolve().then(async()=>{for(const l of a){const c=await l.key,d=await l.value;if(c.status==="aborted"||d.status==="aborted")return at;(c.status==="dirty"||d.status==="dirty")&&t.dirty(),o.set(c.value,d.value)}return{status:t.value,value:o}})}else{const o=new Map;for(const l of a){const c=l.key,d=l.value;if(c.status==="aborted"||d.status==="aborted")return at;(c.status==="dirty"||d.status==="dirty")&&t.dirty(),o.set(c.value,d.value)}return{status:t.value,value:o}}}}oh.create=(n,e,t)=>new oh({valueType:e,keyType:n,typeName:ot.ZodMap,...mt(t)});class Pa extends vt{_parse(e){const{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==ke.set)return Ce(s,{code:ye.invalid_type,expected:ke.set,received:s.parsedType}),at;const i=this._def;i.minSize!==null&&s.data.size<i.minSize.value&&(Ce(s,{code:ye.too_small,minimum:i.minSize.value,type:"set",inclusive:!0,exact:!1,message:i.minSize.message}),t.dirty()),i.maxSize!==null&&s.data.size>i.maxSize.value&&(Ce(s,{code:ye.too_big,maximum:i.maxSize.value,type:"set",inclusive:!0,exact:!1,message:i.maxSize.message}),t.dirty());const r=this._def.valueType;function a(l){const c=new Set;for(const d of l){if(d.status==="aborted")return at;d.status==="dirty"&&t.dirty(),c.add(d.value)}return{status:t.value,value:c}}const o=[...s.data.values()].map((l,c)=>r._parse(new Tn(s,l,s.path,c)));return s.common.async?Promise.all(o).then(l=>a(l)):a(o)}min(e,t){return new Pa({...this._def,minSize:{value:e,message:qe.toString(t)}})}max(e,t){return new Pa({...this._def,maxSize:{value:e,message:qe.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}Pa.create=(n,e)=>new Pa({valueType:n,minSize:null,maxSize:null,typeName:ot.ZodSet,...mt(e)});class sl extends vt{get schema(){return this._def.getter()}_parse(e){const{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}}sl.create=(n,e)=>new sl({getter:n,typeName:ot.ZodLazy,...mt(e)});class nl extends vt{_parse(e){if(e.data!==this._def.value){const t=this._getOrReturnCtx(e);return Ce(t,{received:t.data,code:ye.invalid_literal,expected:this._def.value}),at}return{status:"valid",value:e.data}}get value(){return this._def.value}}nl.create=(n,e)=>new nl({value:n,typeName:ot.ZodLiteral,...mt(e)});function am(n,e){return new Yi({values:n,typeName:ot.ZodEnum,...mt(e)})}class Yi extends vt{_parse(e){if(typeof e.data!="string"){const t=this._getOrReturnCtx(e),s=this._def.values;return Ce(t,{expected:Dt.joinValues(s),received:t.parsedType,code:ye.invalid_type}),at}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){const t=this._getOrReturnCtx(e),s=this._def.values;return Ce(t,{received:t.data,code:ye.invalid_enum_value,options:s}),at}return on(e.data)}get options(){return this._def.values}get enum(){const e={};for(const t of this._def.values)e[t]=t;return e}get Values(){const e={};for(const t of this._def.values)e[t]=t;return e}get Enum(){const e={};for(const t of this._def.values)e[t]=t;return e}extract(e,t=this._def){return Yi.create(e,{...this._def,...t})}exclude(e,t=this._def){return Yi.create(this.options.filter(s=>!e.includes(s)),{...this._def,...t})}}Yi.create=am;class Qc extends vt{_parse(e){const t=Dt.getValidEnumValues(this._def.values),s=this._getOrReturnCtx(e);if(s.parsedType!==ke.string&&s.parsedType!==ke.number){const i=Dt.objectValues(t);return Ce(s,{expected:Dt.joinValues(i),received:s.parsedType,code:ye.invalid_type}),at}if(this._cache||(this._cache=new Set(Dt.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){const i=Dt.objectValues(t);return Ce(s,{received:s.data,code:ye.invalid_enum_value,options:i}),at}return on(e.data)}get enum(){return this._def.values}}Qc.create=(n,e)=>new Qc({values:n,typeName:ot.ZodNativeEnum,...mt(e)});class il extends vt{unwrap(){return this._def.type}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==ke.promise&&t.common.async===!1)return Ce(t,{code:ye.invalid_type,expected:ke.promise,received:t.parsedType}),at;const s=t.parsedType===ke.promise?t.data:Promise.resolve(t.data);return on(s.then(i=>this._def.type.parseAsync(i,{path:t.path,errorMap:t.common.contextualErrorMap})))}}il.create=(n,e)=>new il({type:n,typeName:ot.ZodPromise,...mt(e)});class Ki extends vt{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===ot.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:t,ctx:s}=this._processInputParams(e),i=this._def.effect||null,r={addIssue:a=>{Ce(s,a),a.fatal?t.abort():t.dirty()},get path(){return s.path}};if(r.addIssue=r.addIssue.bind(r),i.type==="preprocess"){const a=i.transform(s.data,r);if(s.common.async)return Promise.resolve(a).then(async o=>{if(t.value==="aborted")return at;const l=await this._def.schema._parseAsync({data:o,path:s.path,parent:s});return l.status==="aborted"?at:l.status==="dirty"||t.value==="dirty"?Aa(l.value):l});{if(t.value==="aborted")return at;const o=this._def.schema._parseSync({data:a,path:s.path,parent:s});return o.status==="aborted"?at:o.status==="dirty"||t.value==="dirty"?Aa(o.value):o}}if(i.type==="refinement"){const a=o=>{const l=i.refinement(o,r);if(s.common.async)return Promise.resolve(l);if(l instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return o};if(s.common.async===!1){const o=this._def.schema._parseSync({data:s.data,path:s.path,parent:s});return o.status==="aborted"?at:(o.status==="dirty"&&t.dirty(),a(o.value),{status:t.value,value:o.value})}else return this._def.schema._parseAsync({data:s.data,path:s.path,parent:s}).then(o=>o.status==="aborted"?at:(o.status==="dirty"&&t.dirty(),a(o.value).then(()=>({status:t.value,value:o.value}))))}if(i.type==="transform")if(s.common.async===!1){const a=this._def.schema._parseSync({data:s.data,path:s.path,parent:s});if(!Ur(a))return at;const o=i.transform(a.value,r);if(o instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:o}}else return this._def.schema._parseAsync({data:s.data,path:s.path,parent:s}).then(a=>Ur(a)?Promise.resolve(i.transform(a.value,r)).then(o=>({status:t.value,value:o})):at);Dt.assertNever(i)}}Ki.create=(n,e,t)=>new Ki({schema:n,typeName:ot.ZodEffects,effect:e,...mt(t)});Ki.createWithPreprocess=(n,e,t)=>new Ki({schema:e,effect:{type:"preprocess",transform:n},typeName:ot.ZodEffects,...mt(t)});class Kn extends vt{_parse(e){return this._getType(e)===ke.undefined?on(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}Kn.create=(n,e)=>new Kn({innerType:n,typeName:ot.ZodOptional,...mt(e)});class Zi extends vt{_parse(e){return this._getType(e)===ke.null?on(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}Zi.create=(n,e)=>new Zi({innerType:n,typeName:ot.ZodNullable,...mt(e)});class rl extends vt{_parse(e){const{ctx:t}=this._processInputParams(e);let s=t.data;return t.parsedType===ke.undefined&&(s=this._def.defaultValue()),this._def.innerType._parse({data:s,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}rl.create=(n,e)=>new rl({innerType:n,typeName:ot.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...mt(e)});class al extends vt{_parse(e){const{ctx:t}=this._processInputParams(e),s={...t,common:{...t.common,issues:[]}},i=this._def.innerType._parse({data:s.data,path:s.path,parent:{...s}});return Zo(i)?i.then(r=>({status:"valid",value:r.status==="valid"?r.value:this._def.catchValue({get error(){return new ei(s.common.issues)},input:s.data})})):{status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new ei(s.common.issues)},input:s.data})}}removeCatch(){return this._def.innerType}}al.create=(n,e)=>new al({innerType:n,typeName:ot.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...mt(e)});class lh extends vt{_parse(e){if(this._getType(e)!==ke.nan){const s=this._getOrReturnCtx(e);return Ce(s,{code:ye.invalid_type,expected:ke.nan,received:s.parsedType}),at}return{status:"valid",value:e.data}}}lh.create=n=>new lh({typeName:ot.ZodNaN,...mt(n)});class om extends vt{_parse(e){const{ctx:t}=this._processInputParams(e),s=t.data;return this._def.type._parse({data:s,path:t.path,parent:t})}unwrap(){return this._def.type}}class cu extends vt{_parse(e){const{status:t,ctx:s}=this._processInputParams(e);if(s.common.async)return(async()=>{const r=await this._def.in._parseAsync({data:s.data,path:s.path,parent:s});return r.status==="aborted"?at:r.status==="dirty"?(t.dirty(),Aa(r.value)):this._def.out._parseAsync({data:r.value,path:s.path,parent:s})})();{const i=this._def.in._parseSync({data:s.data,path:s.path,parent:s});return i.status==="aborted"?at:i.status==="dirty"?(t.dirty(),{status:"dirty",value:i.value}):this._def.out._parseSync({data:i.value,path:s.path,parent:s})}}static create(e,t){return new cu({in:e,out:t,typeName:ot.ZodPipeline})}}class ol extends vt{_parse(e){const t=this._def.innerType._parse(e),s=i=>(Ur(i)&&(i.value=Object.freeze(i.value)),i);return Zo(t)?t.then(i=>s(i)):s(t)}unwrap(){return this._def.innerType}}ol.create=(n,e)=>new ol({innerType:n,typeName:ot.ZodReadonly,...mt(e)});var ot;(function(n){n.ZodString="ZodString",n.ZodNumber="ZodNumber",n.ZodNaN="ZodNaN",n.ZodBigInt="ZodBigInt",n.ZodBoolean="ZodBoolean",n.ZodDate="ZodDate",n.ZodSymbol="ZodSymbol",n.ZodUndefined="ZodUndefined",n.ZodNull="ZodNull",n.ZodAny="ZodAny",n.ZodUnknown="ZodUnknown",n.ZodNever="ZodNever",n.ZodVoid="ZodVoid",n.ZodArray="ZodArray",n.ZodObject="ZodObject",n.ZodUnion="ZodUnion",n.ZodDiscriminatedUnion="ZodDiscriminatedUnion",n.ZodIntersection="ZodIntersection",n.ZodTuple="ZodTuple",n.ZodRecord="ZodRecord",n.ZodMap="ZodMap",n.ZodSet="ZodSet",n.ZodFunction="ZodFunction",n.ZodLazy="ZodLazy",n.ZodLiteral="ZodLiteral",n.ZodEnum="ZodEnum",n.ZodEffects="ZodEffects",n.ZodNativeEnum="ZodNativeEnum",n.ZodOptional="ZodOptional",n.ZodNullable="ZodNullable",n.ZodDefault="ZodDefault",n.ZodCatch="ZodCatch",n.ZodPromise="ZodPromise",n.ZodBranded="ZodBranded",n.ZodPipeline="ZodPipeline",n.ZodReadonly="ZodReadonly"})(ot||(ot={}));const H=Xn.create,Me=Fr.create,is=qc.create,du=Kc.create;Ai.create;const At=En.create,we=ls.create;Jo.create;const lm=lu.create;el.create;const cm=Xi.create,QM=tl.create,JM=sl.create,It=nl.create,cs=Yi.create;il.create;Kn.create;Zi.create;const eb=cs(["ok","error"]),tb=we({type:cs(["error","warning"]),message:H()}),sb=we({kind:H(),data:du()}),nb=we({input:H(),proposed:H(),validated:is(),executed:H().optional()}),dm=we({status:eb,rendered:H(),renderedErr:H().optional(),model:sb.optional(),errors:At(tb).optional(),trace:nb.optional()}),ib=cs(["data","err","status"]),rb=we({shellCommands:is(),hiddenInput:is().optional(),color:is().optional(),fileDelivery:is().optional(),localFilesystem:is().optional()}),ab=we({type:It("attach"),protocolVersion:Me().int(),token:H(),session:H().optional(),capabilities:rb.optional()}),ob=we({type:It("execute"),id:H(),line:H(),instrument:is().optional()}),lb=we({type:It("cancel"),id:H()}),cb=we({type:It("complete"),id:H(),prefix:H()}),db=we({type:It("promptAnswer"),promptId:H(),answer:H()}),ub=we({type:It("promptError"),promptId:H(),reason:H()}),hb=we({type:It("pipeResult"),pipeId:H(),output:H()}),fb=we({type:It("pipeError"),pipeId:H(),reason:H()}),pb=we({type:It("shellResult"),shellId:H(),exitCode:Me().int()}),mb=we({type:It("shellError"),shellId:H(),reason:H()}),gb=we({type:It("editResult"),editId:H(),content:H(),changed:is()}),Mb=we({type:It("editError"),editId:H(),reason:H()}),bb=we({type:It("deliverResult"),deliverId:H(),location:H(),bytes:Me().nonnegative()}),zb=we({type:It("deliverError"),deliverId:H(),reason:H()}),_b=we({address:H(),modelKind:H().optional(),groupId:H(),paneId:H()}),um=we({type:It("regard"),regard:_b}),wb=we({type:It("watch"),subject:H()}),yb=we({type:It("unwatch"),subject:H()}),vb=["live","settled","stale"],Ob=cs(vb),xb=we({type:It("watched"),subject:H(),state:Ob}),Sb=we({type:It("numbered"),id:Me(),source:H(),rows:Me(),handles:At(we({kind:H(),ordinal:Me(),address:H()}))});lm("type",[ab,ob,lb,cb,db,ub,hb,fb,pb,mb,gb,Mb,bb,zb,um,wb,yb]);const Ab=we({type:It("attached"),session:H(),protocolVersion:Me().int(),stack:we({chell:H(),calypso:H(),build:H(),brasa:H().optional(),chili:H().optional(),salsa:H().optional(),cumin:H().optional()}).optional(),hostControl:At(H()).optional()}),Eb=we({type:It("result"),id:H(),envelopes:At(dm)}),Db=we({type:It("complete"),id:H(),prefix:H(),candidates:At(H())}),Ib=we({type:It("output"),id:H(),channel:ib,chunk:H()}),Tb=cs(yM).catch("task"),Gb=cs(vM).catch(void 0),Rb=cs(OM).catch("working"),Bb=cs(xM).catch(void 0),Nb=cs(SM).catch("unknown"),Cb=we({type:It("progress"),id:H(),operation:Tb,kind:Gb.optional(),phase:Rb,label:H().optional(),itemId:H().optional(),current:Me().nonnegative().optional(),total:Me().nonnegative().optional(),percent:Me().min(0).max(100).optional(),unit:Bb.optional(),status:Nb.optional(),path:H().optional()}),Pb=we({type:It("session"),surface:H(),envelope:dm}),Lb=we({type:It("error"),id:H().optional(),reason:H()}),Wb=["text","secret","confirm","path"],kb=cs(Wb).catch("text"),Ub=we({anchor:H().optional(),wantsDirectory:is(),suggest:H().optional()}),Fb=we({type:It("prompt"),promptId:H(),message:H(),hidden:is(),wants:kb.optional(),path:Ub.optional(),commit:H().optional()});function jb(n){return n.wants!==void 0?n.wants:n.hidden===!0?"secret":"text"}const $b=we({user:H(),uri:H(),cwd:H(),pacsserver:H().nullable(),physicalMode:is(),lastExitCode:Me(),lastCommandDurationMs:Me(),procWarmup:we({loaded:Me(),total:Me().optional(),restored:is().optional(),state:cs(_M).optional(),sweeping:is().optional(),feed:we({id:Me(),loaded:Me(),total:Me(),failed:H().optional()}).optional(),feeds:At(we({id:Me(),loaded:Me(),total:Me(),failed:H().optional()})).optional(),arrived:At(Me()).optional(),landed:At(we({id:Me(),title:H().default(""),jobs:Me(),status:H(),chain:At(H()),groups:At(we({plugin:H(),count:Me(),errored:Me().default(0),status:H(),parent:Me().nullable()})).default([])})).optional(),roster:cs(["delta","full"]).optional()}).optional(),procIndex:we({jobs:Me(),feeds:Me()}).optional(),warmupFailures:At(we({label:H(),message:H()})).optional()}),Vb=we({type:It("promptline"),context:$b}),Hb=we({type:It("pipe"),pipeId:H(),command:H(),input:H()}),qb=we({type:It("shell"),shellId:H(),command:H()}),Xb=we({type:It("edit"),editId:H(),content:H(),extension:H().optional()}),Yb=we({type:It("deliver"),deliverId:H(),path:H(),filename:H(),destination:H().optional(),size:Me().nonnegative().optional(),contentType:H().optional()}),Kb=we({type:It("telemetry"),index:we({jobs:Me(),feeds:Me()}),lane:we({running:we({line:H(),sinceMs:Me(),surface:H()}).nullable(),waiting:Me()}).optional(),cube:we({msPerPage:Me(),samples:Me()}).optional(),state:we({running:Me(),runningFeeds:Me(),scheduled:Me(),errored:Me(),erroredFeeds:Me()}).optional()}),hm=lm("type",[Ab,Eb,Db,Ib,Cb,Pb,Lb,Fb,Vb,Kb,Hb,qb,Xb,Yb,um,xb,Sb]);new Set(hm.options.map(n=>n.shape.type.value));function Zb(n){return n.issues.map(e=>{const t=e.path.join(".");return t?`${t}: ${e.message}`:e.message}).join("; ")}function Qb(n,e){const t=n.safeParse(e);return t.success?{ok:!0,value:t.data}:{ok:!1,error:Zb(t.error)}}function Jb(n){return Qb(hm,n)}const fm=we({id:H(),label:H(),parentIds:At(H()),joinParentIds:At(H())}),e0=we({name:H(),value:du()}),t0=fm.extend({pluginName:H(),pluginVersion:H().optional(),arguments:At(e0).optional()}),Jc=we({name:H(),pipelineId:Me().optional(),nodes:At(t0)}),s0=["created","waiting","scheduled","started","registeringFiles","finishedSuccessfully","finishedWithError","cancelled","unknown"],pm=cs(s0).catch("unknown"),n0=we({count:Me(),done:Me(),error:Me(),running:Me(),other:Me(),anomalies:At(we({id:H(),status:pm})).optional()}),i0=we({computeSeconds:Me().optional(),dataBytes:Me().optional()}),r0=fm.extend({instanceId:Me(),pluginName:H(),pluginVersion:H().optional(),status:pm,vfsPath:H(),metrics:i0.optional(),tally:n0.optional(),computeResource:H().optional()}),ed=we({feedId:Me(),feedName:H(),nodes:At(r0)}),a0=we({feedId:Me(),loaded:Me(),total:Me(),failed:H().optional()}),zi={pipelineDiagram:"pipeline.diagram",feedDag:"feed.dag",feedIndexing:"feed.indexing"},o0=we({id:Me(),title:H(),owner:H(),status:H(),createdAt:H(),sizeBytes:Me().optional(),wallSeconds:Me().optional(),jobsDone:Me().optional(),jobsTotal:Me().optional(),jobsErrored:Me().optional()}),mm=we({feeds:At(o0)}),gm="feed.list",l0=we({plugin:H(),count:Me(),errored:Me().default(0),status:H(),parent:Me().nullable()}),c0=we({format:cs(["dicom","nifti","mgz","jpeg","png","other","unknown"]),modality:H().optional(),seriesDescription:H().optional(),reason:H().optional(),sourceFeed:Me().optional()}),d0=we({id:Me(),title:H().default(""),jobs:Me(),status:H(),chain:At(H()),groups:At(l0).default([]),createdAt:H().default(""),data:c0.optional()}),Mm=we({feeds:At(d0),whole:is()}),bm="proc.universe",u0=we({name:H(),positions:QM(H(),cm([Me(),Me(),Me()])).nullable(),writtenAt:H().nullable(),laying:we({nodes:Me(),fraction:Me()}).nullable().optional()}),h0="proc.layout",f0=we({name:H(),type:H(),optional:is(),default:du().optional(),help:H().optional(),flag:H()}),p0=we({id:Me().optional(),name:H(),version:H(),type:H(),title:H().optional(),description:H().optional(),authors:H().optional(),documentation:H().optional(),category:H().optional(),parameters:At(f0),command:H().optional()}),m0="plugin.info",g0=we({seriesUID:H(),description:H(),modality:H(),fileCount:Me().optional(),vfsPath:H().optional(),pulled:is().optional(),pulledFiles:Me().optional(),folderPath:H().optional()}),M0=we({studyUID:H().optional(),server:H().optional(),vfsPath:H().optional(),description:H(),patientName:H(),patientId:H(),date:H(),modalities:H(),accession:H(),series:At(g0)}),zm=we({replayed:is(),answeredAt:H()}),b0=["found","none","unasked"],z0=cs(b0).catch("unasked"),_0=we({patientId:H(),server:H().optional(),patientName:H().optional(),status:z0,studyCount:Me(),seriesCount:Me(),queryId:Me().optional(),provenance:zm.optional(),error:H().optional()}),w0=we({queryId:Me(),vfsPath:H(),pacsName:H(),expression:H(),studies:At(M0),provenance:zm.optional(),patients:At(_0).optional()}),y0=we({id:Me(),identifier:H(),active:is()}),v0=we({servers:At(y0)}),O0="pacs.servers",x0="pacs.query";function S0(n){return`pacs:patient:${n.server??"-"}:${n.patientId}`}const A0=["patient","study","series","image","equipment","meta","private","other"],_m=cs(A0).catch("other"),wm=JM(()=>we({tag:H(),name:H(),vr:H(),value:H(),group:_m,phi:is(),decoded:H().optional(),items:At(At(wm)).optional()})),E0=we({tag:H(),name:H(),vr:H(),group:_m,phi:is(),distinct:Me(),first:H(),last:H(),values:At(we({path:H(),value:H().nullable()}))}),ch=we({path:H(),subject:cs(["file","folder"]),read:Me(),of:Me(),refused:At(H()),constant:At(wm),varying:At(E0)}),D0=we({rows:Me(),columns:Me(),pixelSpacing:cm([Me(),Me()]).optional(),sliceThickness:Me().optional(),spacingBetweenSlices:Me().optional()}),dh=we({path:H(),seriesInstanceUID:H().optional(),studyInstanceUID:H().optional(),modality:H(),seriesDescription:H(),seriesNumber:Me().optional(),instances:Me(),frames:Me(),order:cs(["filename","unknown"]),geometry:D0.optional(),transferSyntax:we({uid:H(),name:H().optional()}).optional(),bytes:Me(),header:H(),files:At(H()),annotations:At(H())}),Ha={tags:"dicom.tags",series:"dicom.series"},I0=we({path:H(),target:cs(["series","volume"]),force:is().optional(),startAt:Me().int().positive().optional()}),T0={view:"image.view"},G0=we({state:cs(["cold","warming","current"]),loaded:Me(),total:Me()});we({user:H(),surface:H(),feeds:we({total:Me(),own:Me(),shared:Me(),public:Me()}),jobs:we({total:Me(),finished:Me(),errored:Me(),cancelled:Me(),running:Me(),scheduled:Me()}),failureRate:Me().nullable(),index:G0,fortune:H()});function Es(n){return n.groups.map(e=>`${e.parent??"r"}:${e.plugin}`).join(">")}function wi(n,e){return`feed:${n}:${e}`}function ym(n){return`shape:${n}`}function jr(n){return Math.log2(Math.max(1,n)+1)}function uu(n){if(!(n.errored<=0||n.count<=0))return Math.min(1,n.errored/n.count)}function Fa(n,e="jobs"){const t=[],s=new Set,i=[...n].sort((a,o)=>a.id-o.id),r=new Map;for(const a of i){if(a.groups.length===0)continue;const o=Es(a);r.set(o,(r.get(o)??0)+1)}for(const a of i){if(a.groups.length===0)continue;const o=Es(a),l=ym(o);s.has(o)||(s.add(o),t.push({id:l,label:vl(o),parentIds:[],joinParentIds:[],ghost:!0,halo:!0,metric:1,count:r.get(o)??1})),a.groups.forEach((c,d)=>{const u=uu(c);t.push({id:wi(a.id,d),label:c.plugin,parentIds:[c.parent===null?l:wi(a.id,c.parent)],joinParentIds:[],status:c.status,metric:e==="jobs"?jr(c.count):1,...c.count>1?{count:c.count}:{},...u!==void 0?{share:u}:{}})})}return{nodes:t}}const td="plugin:";function R0(n){return`${td}${n}`}function sd(n){return n.startsWith(td)?n.slice(td.length):null}function hu(n,e="jobs"){const t=[],s=new Map,i=[...n].sort((r,a)=>r.id-a.id);for(const r of i)if(r.groups.length!==0){for(const a of new Set(r.groups.map(o=>o.plugin)))s.set(a,(s.get(a)??0)+1);r.groups.forEach((a,o)=>{const l=uu(a);t.push({id:wi(r.id,o),label:a.plugin,parentIds:a.parent===null?[]:[wi(r.id,a.parent)],joinParentIds:[],status:a.status,metric:e==="jobs"?jr(a.count):1,attrs:{plugin:a.plugin},...a.count>1?{count:a.count}:{},...l!==void 0?{share:l}:{}})})}for(const[r,a]of[...s].sort((o,l)=>o[0]<l[0]?-1:1))t.push({id:R0(r),label:r,parentIds:[],joinParentIds:[],metric:1+Math.log(a),hue:"#e8f4ff",ring:!0,attrs:{kind:"star",plugin:r}});return{nodes:t}}function uh(n,e="jobs"){const t=new Map;for(const i of n){const r=i.createdAt===void 0?Number.NaN:Date.parse(i.createdAt);Number.isFinite(r)&&t.set(i.id,r)}return{nodes:hu(n,e).nodes.filter(i=>i.attrs?.kind!=="star").map(i=>{const r=t.get(Number(i.id.split(":")[1]));return r===void 0?i:{...i,attrs:{...i.attrs,createdAt:r}}})}}function vl(n){const e=[];for(const t of n.split(">")){const s=t.slice(t.indexOf(":")+1);s.length>0&&!e.includes(s)&&e.push(s)}return e.join(" > ")}const B0=.5,N0=5,C0=.02,nd="data:",P0={dicom:"DICOM",nifti:"NIfTI",mgz:"MGZ",jpeg:"JPEG",png:"PNG",other:"OTHER",unknown:"UNREADABLE",unread:"NOT YET READ"};function L0(n){const e=n.toUpperCase().replace(/[_\-.,/\\()[\]:;+]+/g," ").split(/\s+/).filter(t=>t.length>0).filter(t=>!/^\d+$/.test(t)).filter(t=>!/^\d+X\d+$/.test(t)).filter(t=>!/^FOV\d*$/.test(t)).filter(t=>!/^\d+(\.\d+)?(MM|CM)$/.test(t));return[...new Set(e)]}function W0(n,e){if(n.length===0||e.length===0)return 0;const t=new Set(n);return e.filter(i=>t.has(i)).length/Math.min(n.length,e.length)}function vm(n){const e=new Map;for(const r of n)e.set(r,(e.get(r)??0)+1);const t=[...e.keys()].sort((r,a)=>(e.get(a)??0)-(e.get(r)??0)||(r<a?-1:1)),s=[],i=new Map;for(const r of t){const a=L0(r),o=a.length===0?void 0:s.find(l=>W0(l.words,a)>=B0);if(o!==void 0){i.set(r,o.name);continue}s.push({name:r,words:a}),i.set(r,r)}return i}function Om(n,e){const t=n.data?.format??"unread",s=[{key:t,label:P0[t]??t.toUpperCase()}];if(t!=="dicom")return s;const i=n.data?.modality??"NO MODALITY";s.push({key:`${t}/${i}`,label:i});const r=n.data?.seriesDescription,a=r===void 0?"NO DESCRIPTION":e.get(r)??r;return s.push({key:`${t}/${i}/${a}`,label:a}),s}function Fl(n){return`${nd}${n}`}function id(n){return n.startsWith(nd)?n.slice(nd.length):null}function hh(n,e="jobs"){const t=[...n].filter(d=>d.groups.length>0).sort((d,u)=>d.id-u.id),s=vm(t.map(d=>d.data?.seriesDescription).filter(d=>d!==void 0)),i=new Map,r=[];for(const d of t){const u=Om(d,s);let h=null;for(const p of u){const z=i.get(p.key);z===void 0?i.set(p.key,{label:p.label,feeds:1,parent:h}):z.feeds+=1,h=p.key}const g=Fl(h);d.groups.forEach((p,z)=>{const m=uu(p);r.push({id:wi(d.id,z),label:p.plugin,parentIds:[p.parent===null?g:wi(d.id,p.parent)],joinParentIds:[],status:p.status,metric:e==="jobs"?jr(p.count):1,...p.count>1?{count:p.count}:{},...m!==void 0?{share:m}:{}})})}const a=new Map;for(const d of t){const u=d.groups.findIndex(h=>h.parent===null);u>=0&&a.set(d.id,wi(d.id,u))}const o=new Map(r.map(d=>[d.id,d]));for(const d of t){const u=d.data?.sourceFeed,h=u===void 0||u===d.id?void 0:a.get(u),g=a.get(d.id);if(h===void 0||g===void 0)continue;const p=o.get(g);p!==void 0&&(p.joinParentIds=[...p.joinParentIds,h],p.joinFaint=!0)}const l=(d,u)=>d.split("/").length<3||u>=Math.max(N0,C0*t.length);return{graph:{nodes:[...[...i].map(([d,u])=>({id:Fl(d),label:u.label,parentIds:u.parent===null?[]:[Fl(u.parent)],joinParentIds:[],ghost:!0,halo:!0,metric:1,count:u.feeds,...l(d,u.feeds)?{caption:`${u.label} · ${u.feeds.toLocaleString("en-US")}`}:{}})),...r]},hubs:new Map([...i].map(([d,u])=>[d,{label:u.label,feeds:u.feeds}]))}}function k0(n,e){const t=id(n);if(t===null)return null;const s=t.split("/"),i=s.map((a,o)=>e.get(s.slice(0,o+1).join("/"))?.label??s[o]??""),r=e.get(t)?.feeds??0;return`${i.join(" · ")} · ${r.toLocaleString("en-US")} feed${r===1?"":"s"}`}const rd=12,U0=240;function F0(n){return n<=U0?rd:void 0}function ad(n,e){return`fold:${n}:${e}`}function xm(n){const e=n.match(/^fold:(.+):\d+$/);return e===null?null:e[1]}function j0(n){const e=n.match(/^feed:(\d+):/);if(e!==null)return`feed:${e[1]}`;const t=xm(n);return t===null?null:`fold:${t}`}const fu="185",$0=0,fh=1,V0=2,Po=1,H0=2,Ea=3,Ei=0,ks=1,Hn=2,Zn=0,$i=1,Qi=2,ph=3,mh=4,q0=5,Wi=100,X0=101,Y0=102,K0=103,Z0=104,Q0=200,J0=201,ez=202,tz=203,od=204,ld=205,sz=206,nz=207,iz=208,rz=209,az=210,oz=211,lz=212,cz=213,dz=214,cd=0,dd=1,ud=2,$r=3,hd=4,fd=5,pd=6,md=7,Sm=0,uz=1,hz=2,Dn=0,Am=1,Em=2,Dm=3,Im=4,Tm=5,Gm=6,Rm=7,Bm=300,Ji=301,Vr=302,jl=303,$l=304,Ol=306,gd=1e3,Yn=1001,Md=1002,ys=1003,fz=1004,qa=1005,Ds=1006,Vl=1007,Fi=1008,Zs=1009,Nm=1010,Cm=1011,La=1012,pu=1013,Gn=1014,Mn=1015,ti=1016,mu=1017,gu=1018,Wa=1020,Pm=35902,Lm=35899,Wm=1021,km=1022,bn=1023,si=1026,ji=1027,Mu=1028,bu=1029,er=1030,zu=1031,_u=1033,Lo=33776,Wo=33777,ko=33778,Uo=33779,bd=35840,zd=35841,_d=35842,wd=35843,yd=36196,vd=37492,Od=37496,xd=37488,Sd=37489,ll=37490,Ad=37491,Ed=37808,Dd=37809,Id=37810,Td=37811,Gd=37812,Rd=37813,Bd=37814,Nd=37815,Cd=37816,Pd=37817,Ld=37818,Wd=37819,kd=37820,Ud=37821,Fd=36492,jd=36494,$d=36495,Vd=36283,Hd=36284,cl=36285,qd=36286,pz=3200,Xd=0,mz=1,bi="",sn="srgb",dl="srgb-linear",ul="linear",kt="srgb",dr=7680,gh=519,gz=512,Mz=513,bz=514,wu=515,zz=516,_z=517,yu=518,wz=519,Yd=35044,Mh="300 es",An=2e3,ka=2001;function yz(n){for(let e=n.length-1;e>=0;--e)if(n[e]>=65535)return!0;return!1}function hl(n){return document.createElementNS("http://www.w3.org/1999/xhtml",n)}function vz(){const n=hl("canvas");return n.style.display="block",n}const bh={};function fl(...n){const e="THREE."+n.shift();console.log(e,...n)}function Um(n){const e=n[0];if(typeof e=="string"&&e.startsWith("TSL:")){const t=n[1];t&&t.isStackTrace?n[0]+=" "+t.getLocation():n[1]='Stack trace not available. Enable "THREE.Node.captureStackTrace" to capture stack traces.'}return n}function st(...n){n=Um(n);const e="THREE."+n.shift();{const t=n[0];t&&t.isStackTrace?console.warn(t.getError(e)):console.warn(e,...n)}}function Ot(...n){n=Um(n);const e="THREE."+n.shift();{const t=n[0];t&&t.isStackTrace?console.error(t.getError(e)):console.error(e,...n)}}function Pr(...n){const e=n.join(" ");e in bh||(bh[e]=!0,st(...n))}function Oz(n,e,t){return new Promise(function(s,i){function r(){switch(n.clientWaitSync(e,n.SYNC_FLUSH_COMMANDS_BIT,0)){case n.WAIT_FAILED:i();break;case n.TIMEOUT_EXPIRED:setTimeout(r,t);break;default:s()}}setTimeout(r,t)})}const xz={[cd]:dd,[ud]:pd,[hd]:md,[$r]:fd,[dd]:cd,[pd]:ud,[md]:hd,[fd]:$r};class ir{addEventListener(e,t){this._listeners===void 0&&(this._listeners={});const s=this._listeners;s[e]===void 0&&(s[e]=[]),s[e].indexOf(t)===-1&&s[e].push(t)}hasEventListener(e,t){const s=this._listeners;return s===void 0?!1:s[e]!==void 0&&s[e].indexOf(t)!==-1}removeEventListener(e,t){const s=this._listeners;if(s===void 0)return;const i=s[e];if(i!==void 0){const r=i.indexOf(t);r!==-1&&i.splice(r,1)}}dispatchEvent(e){const t=this._listeners;if(t===void 0)return;const s=t[e.type];if(s!==void 0){e.target=this;const i=s.slice(0);for(let r=0,a=i.length;r<a;r++)i[r].call(this,e);e.target=null}}}const Ss=["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"],Hl=Math.PI/180,Kd=180/Math.PI;function yi(){const n=Math.random()*4294967295|0,e=Math.random()*4294967295|0,t=Math.random()*4294967295|0,s=Math.random()*4294967295|0;return(Ss[n&255]+Ss[n>>8&255]+Ss[n>>16&255]+Ss[n>>24&255]+"-"+Ss[e&255]+Ss[e>>8&255]+"-"+Ss[e>>16&15|64]+Ss[e>>24&255]+"-"+Ss[t&63|128]+Ss[t>>8&255]+"-"+Ss[t>>16&255]+Ss[t>>24&255]+Ss[s&255]+Ss[s>>8&255]+Ss[s>>16&255]+Ss[s>>24&255]).toLowerCase()}function St(n,e,t){return Math.max(e,Math.min(t,n))}function Sz(n,e){return(n%e+e)%e}function ql(n,e,t){return(1-t)*n+t*e}function xn(n,e){switch(e.constructor){case Float32Array:return n;case Uint32Array:return n/4294967295;case Uint16Array:return n/65535;case Uint8Array:return n/255;case Int32Array:return Math.max(n/2147483647,-1);case Int16Array:return Math.max(n/32767,-1);case Int8Array:return Math.max(n/127,-1);default:throw new Error("THREE.MathUtils: Invalid component type.")}}function Ft(n,e){switch(e.constructor){case Float32Array:return n;case Uint32Array:return Math.round(n*4294967295);case Uint16Array:return Math.round(n*65535);case Uint8Array:return Math.round(n*255);case Int32Array:return Math.round(n*2147483647);case Int16Array:return Math.round(n*32767);case Int8Array:return Math.round(n*127);default:throw new Error("THREE.MathUtils: Invalid component type.")}}const qu=class qu{constructor(e=0,t=0){this.x=e,this.y=t}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,t){return this.x=e,this.y=t,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,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;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,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,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,t){return this.x=e.x-t.x,this.y=e.y-t.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 t=this.x,s=this.y,i=e.elements;return this.x=i[0]*t+i[3]*s+i[6],this.y=i[1]*t+i[4]*s+i[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,t){return this.x=St(this.x,e.x,t.x),this.y=St(this.y,e.y,t.y),this}clampScalar(e,t){return this.x=St(this.x,e,t),this.y=St(this.y,e,t),this}clampLength(e,t){const s=this.length();return this.divideScalar(s||1).multiplyScalar(St(s,e,t))}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 t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;const s=this.dot(e)/t;return Math.acos(St(s,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,s=this.y-e.y;return t*t+s*s}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this}lerpVectors(e,t,s){return this.x=e.x+(t.x-e.x)*s,this.y=e.y+(t.y-e.y)*s,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this}rotateAround(e,t){const s=Math.cos(t),i=Math.sin(t),r=this.x-e.x,a=this.y-e.y;return this.x=r*s-a*i+e.x,this.y=r*i+a*s+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}};qu.prototype.isVector2=!0;let lt=qu;class rr{constructor(e=0,t=0,s=0,i=1){this.isQuaternion=!0,this._x=e,this._y=t,this._z=s,this._w=i}static slerpFlat(e,t,s,i,r,a,o){let l=s[i+0],c=s[i+1],d=s[i+2],u=s[i+3],h=r[a+0],g=r[a+1],p=r[a+2],z=r[a+3];if(u!==z||l!==h||c!==g||d!==p){let m=l*h+c*g+d*p+u*z;m<0&&(h=-h,g=-g,p=-p,z=-z,m=-m);let f=1-o;if(m<.9995){const _=Math.acos(m),O=Math.sin(_);f=Math.sin(f*_)/O,o=Math.sin(o*_)/O,l=l*f+h*o,c=c*f+g*o,d=d*f+p*o,u=u*f+z*o}else{l=l*f+h*o,c=c*f+g*o,d=d*f+p*o,u=u*f+z*o;const _=1/Math.sqrt(l*l+c*c+d*d+u*u);l*=_,c*=_,d*=_,u*=_}}e[t]=l,e[t+1]=c,e[t+2]=d,e[t+3]=u}static multiplyQuaternionsFlat(e,t,s,i,r,a){const o=s[i],l=s[i+1],c=s[i+2],d=s[i+3],u=r[a],h=r[a+1],g=r[a+2],p=r[a+3];return e[t]=o*p+d*u+l*g-c*h,e[t+1]=l*p+d*h+c*u-o*g,e[t+2]=c*p+d*g+o*h-l*u,e[t+3]=d*p-o*u-l*h-c*g,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,t,s,i){return this._x=e,this._y=t,this._z=s,this._w=i,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,t=!0){const s=e._x,i=e._y,r=e._z,a=e._order,o=Math.cos,l=Math.sin,c=o(s/2),d=o(i/2),u=o(r/2),h=l(s/2),g=l(i/2),p=l(r/2);switch(a){case"XYZ":this._x=h*d*u+c*g*p,this._y=c*g*u-h*d*p,this._z=c*d*p+h*g*u,this._w=c*d*u-h*g*p;break;case"YXZ":this._x=h*d*u+c*g*p,this._y=c*g*u-h*d*p,this._z=c*d*p-h*g*u,this._w=c*d*u+h*g*p;break;case"ZXY":this._x=h*d*u-c*g*p,this._y=c*g*u+h*d*p,this._z=c*d*p+h*g*u,this._w=c*d*u-h*g*p;break;case"ZYX":this._x=h*d*u-c*g*p,this._y=c*g*u+h*d*p,this._z=c*d*p-h*g*u,this._w=c*d*u+h*g*p;break;case"YZX":this._x=h*d*u+c*g*p,this._y=c*g*u+h*d*p,this._z=c*d*p-h*g*u,this._w=c*d*u-h*g*p;break;case"XZY":this._x=h*d*u-c*g*p,this._y=c*g*u-h*d*p,this._z=c*d*p+h*g*u,this._w=c*d*u+h*g*p;break;default:st("Quaternion: .setFromEuler() encountered an unknown order: "+a)}return t===!0&&this._onChangeCallback(),this}setFromAxisAngle(e,t){const s=t/2,i=Math.sin(s);return this._x=e.x*i,this._y=e.y*i,this._z=e.z*i,this._w=Math.cos(s),this._onChangeCallback(),this}setFromRotationMatrix(e){const t=e.elements,s=t[0],i=t[4],r=t[8],a=t[1],o=t[5],l=t[9],c=t[2],d=t[6],u=t[10],h=s+o+u;if(h>0){const g=.5/Math.sqrt(h+1);this._w=.25/g,this._x=(d-l)*g,this._y=(r-c)*g,this._z=(a-i)*g}else if(s>o&&s>u){const g=2*Math.sqrt(1+s-o-u);this._w=(d-l)/g,this._x=.25*g,this._y=(i+a)/g,this._z=(r+c)/g}else if(o>u){const g=2*Math.sqrt(1+o-s-u);this._w=(r-c)/g,this._x=(i+a)/g,this._y=.25*g,this._z=(l+d)/g}else{const g=2*Math.sqrt(1+u-s-o);this._w=(a-i)/g,this._x=(r+c)/g,this._y=(l+d)/g,this._z=.25*g}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let s=e.dot(t)+1;return s<1e-8?(s=0,Math.abs(e.x)>Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=s):(this._x=0,this._y=-e.z,this._z=e.y,this._w=s)):(this._x=e.y*t.z-e.z*t.y,this._y=e.z*t.x-e.x*t.z,this._z=e.x*t.y-e.y*t.x,this._w=s),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(St(this.dot(e),-1,1)))}rotateTowards(e,t){const s=this.angleTo(e);if(s===0)return this;const i=Math.min(1,t/s);return this.slerp(e,i),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,t){const s=e._x,i=e._y,r=e._z,a=e._w,o=t._x,l=t._y,c=t._z,d=t._w;return this._x=s*d+a*o+i*c-r*l,this._y=i*d+a*l+r*o-s*c,this._z=r*d+a*c+s*l-i*o,this._w=a*d-s*o-i*l-r*c,this._onChangeCallback(),this}slerp(e,t){let s=e._x,i=e._y,r=e._z,a=e._w,o=this.dot(e);o<0&&(s=-s,i=-i,r=-r,a=-a,o=-o);let l=1-t;if(o<.9995){const c=Math.acos(o),d=Math.sin(c);l=Math.sin(l*c)/d,t=Math.sin(t*c)/d,this._x=this._x*l+s*t,this._y=this._y*l+i*t,this._z=this._z*l+r*t,this._w=this._w*l+a*t,this._onChangeCallback()}else this._x=this._x*l+s*t,this._y=this._y*l+i*t,this._z=this._z*l+r*t,this._w=this._w*l+a*t,this.normalize();return this}slerpQuaternions(e,t,s){return this.copy(e).slerp(t,s)}random(){const e=2*Math.PI*Math.random(),t=2*Math.PI*Math.random(),s=Math.random(),i=Math.sqrt(1-s),r=Math.sqrt(s);return this.set(i*Math.sin(e),i*Math.cos(e),r*Math.sin(t),r*Math.cos(t))}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e,t=0){return this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e}fromBufferAttribute(e,t){return this._x=e.getX(t),this._y=e.getY(t),this._z=e.getZ(t),this._w=e.getW(t),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 Xu=class Xu{constructor(e=0,t=0,s=0){this.x=e,this.y=t,this.z=s}set(e,t,s){return s===void 0&&(s=this.z),this.x=e,this.y=t,this.z=s,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,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;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,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,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,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.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,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this}applyEuler(e){return this.applyQuaternion(zh.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(zh.setFromAxisAngle(e,t))}applyMatrix3(e){const t=this.x,s=this.y,i=this.z,r=e.elements;return this.x=r[0]*t+r[3]*s+r[6]*i,this.y=r[1]*t+r[4]*s+r[7]*i,this.z=r[2]*t+r[5]*s+r[8]*i,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){const t=this.x,s=this.y,i=this.z,r=e.elements,a=1/(r[3]*t+r[7]*s+r[11]*i+r[15]);return this.x=(r[0]*t+r[4]*s+r[8]*i+r[12])*a,this.y=(r[1]*t+r[5]*s+r[9]*i+r[13])*a,this.z=(r[2]*t+r[6]*s+r[10]*i+r[14])*a,this}applyQuaternion(e){const t=this.x,s=this.y,i=this.z,r=e.x,a=e.y,o=e.z,l=e.w,c=2*(a*i-o*s),d=2*(o*t-r*i),u=2*(r*s-a*t);return this.x=t+l*c+a*u-o*d,this.y=s+l*d+o*c-r*u,this.z=i+l*u+r*d-a*c,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){const t=this.x,s=this.y,i=this.z,r=e.elements;return this.x=r[0]*t+r[4]*s+r[8]*i,this.y=r[1]*t+r[5]*s+r[9]*i,this.z=r[2]*t+r[6]*s+r[10]*i,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,t){return this.x=St(this.x,e.x,t.x),this.y=St(this.y,e.y,t.y),this.z=St(this.z,e.z,t.z),this}clampScalar(e,t){return this.x=St(this.x,e,t),this.y=St(this.y,e,t),this.z=St(this.z,e,t),this}clampLength(e,t){const s=this.length();return this.divideScalar(s||1).multiplyScalar(St(s,e,t))}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,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this}lerpVectors(e,t,s){return this.x=e.x+(t.x-e.x)*s,this.y=e.y+(t.y-e.y)*s,this.z=e.z+(t.z-e.z)*s,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,t){const s=e.x,i=e.y,r=e.z,a=t.x,o=t.y,l=t.z;return this.x=i*l-r*o,this.y=r*a-s*l,this.z=s*o-i*a,this}projectOnVector(e){const t=e.lengthSq();if(t===0)return this.set(0,0,0);const s=e.dot(this)/t;return this.copy(e).multiplyScalar(s)}projectOnPlane(e){return Xl.copy(this).projectOnVector(e),this.sub(Xl)}reflect(e){return this.sub(Xl.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;const s=this.dot(e)/t;return Math.acos(St(s,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,s=this.y-e.y,i=this.z-e.z;return t*t+s*s+i*i}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,t,s){const i=Math.sin(t)*e;return this.x=i*Math.sin(s),this.y=Math.cos(t)*e,this.z=i*Math.cos(s),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,t,s){return this.x=e*Math.sin(t),this.y=s,this.z=e*Math.cos(t),this}setFromMatrixPosition(e){const t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}setFromMatrixScale(e){const t=this.setFromMatrixColumn(e,0).length(),s=this.setFromMatrixColumn(e,1).length(),i=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=s,this.z=i,this}setFromMatrixColumn(e,t){return this.fromArray(e.elements,t*4)}setFromMatrix3Column(e,t){return this.fromArray(e.elements,t*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,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){const e=Math.random()*Math.PI*2,t=Math.random()*2-1,s=Math.sqrt(1-t*t);return this.x=s*Math.cos(e),this.y=t,this.z=s*Math.sin(e),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}};Xu.prototype.isVector3=!0;let U=Xu;const Xl=new U,zh=new rr,Yu=class Yu{constructor(e,t,s,i,r,a,o,l,c){this.elements=[1,0,0,0,1,0,0,0,1],e!==void 0&&this.set(e,t,s,i,r,a,o,l,c)}set(e,t,s,i,r,a,o,l,c){const d=this.elements;return d[0]=e,d[1]=i,d[2]=o,d[3]=t,d[4]=r,d[5]=l,d[6]=s,d[7]=a,d[8]=c,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){const t=this.elements,s=e.elements;return t[0]=s[0],t[1]=s[1],t[2]=s[2],t[3]=s[3],t[4]=s[4],t[5]=s[5],t[6]=s[6],t[7]=s[7],t[8]=s[8],this}extractBasis(e,t,s){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),s.setFromMatrix3Column(this,2),this}setFromMatrix4(e){const t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const s=e.elements,i=t.elements,r=this.elements,a=s[0],o=s[3],l=s[6],c=s[1],d=s[4],u=s[7],h=s[2],g=s[5],p=s[8],z=i[0],m=i[3],f=i[6],_=i[1],O=i[4],w=i[7],x=i[2],S=i[5],I=i[8];return r[0]=a*z+o*_+l*x,r[3]=a*m+o*O+l*S,r[6]=a*f+o*w+l*I,r[1]=c*z+d*_+u*x,r[4]=c*m+d*O+u*S,r[7]=c*f+d*w+u*I,r[2]=h*z+g*_+p*x,r[5]=h*m+g*O+p*S,r[8]=h*f+g*w+p*I,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this}determinant(){const e=this.elements,t=e[0],s=e[1],i=e[2],r=e[3],a=e[4],o=e[5],l=e[6],c=e[7],d=e[8];return t*a*d-t*o*c-s*r*d+s*o*l+i*r*c-i*a*l}invert(){const e=this.elements,t=e[0],s=e[1],i=e[2],r=e[3],a=e[4],o=e[5],l=e[6],c=e[7],d=e[8],u=d*a-o*c,h=o*l-d*r,g=c*r-a*l,p=t*u+s*h+i*g;if(p===0)return this.set(0,0,0,0,0,0,0,0,0);const z=1/p;return e[0]=u*z,e[1]=(i*c-d*s)*z,e[2]=(o*s-i*a)*z,e[3]=h*z,e[4]=(d*t-i*l)*z,e[5]=(i*r-o*t)*z,e[6]=g*z,e[7]=(s*l-c*t)*z,e[8]=(a*t-s*r)*z,this}transpose(){let e;const t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){const t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this}setUvTransform(e,t,s,i,r,a,o){const l=Math.cos(r),c=Math.sin(r);return this.set(s*l,s*c,-s*(l*a+c*o)+a+e,-i*c,i*l,-i*(-c*a+l*o)+o+t,0,0,1),this}scale(e,t){return Pr("Matrix3: .scale() is deprecated. Use .makeScale() instead."),this.premultiply(Yl.makeScale(e,t)),this}rotate(e){return Pr("Matrix3: .rotate() is deprecated. Use .makeRotation() instead."),this.premultiply(Yl.makeRotation(-e)),this}translate(e,t){return Pr("Matrix3: .translate() is deprecated. Use .makeTranslation() instead."),this.premultiply(Yl.makeTranslation(e,t)),this}makeTranslation(e,t){return e.isVector2?this.set(1,0,e.x,0,1,e.y,0,0,1):this.set(1,0,e,0,1,t,0,0,1),this}makeRotation(e){const t=Math.cos(e),s=Math.sin(e);return this.set(t,-s,0,s,t,0,0,0,1),this}makeScale(e,t){return this.set(e,0,0,0,t,0,0,0,1),this}equals(e){const t=this.elements,s=e.elements;for(let i=0;i<9;i++)if(t[i]!==s[i])return!1;return!0}fromArray(e,t=0){for(let s=0;s<9;s++)this.elements[s]=e[s+t];return this}toArray(e=[],t=0){const s=this.elements;return e[t]=s[0],e[t+1]=s[1],e[t+2]=s[2],e[t+3]=s[3],e[t+4]=s[4],e[t+5]=s[5],e[t+6]=s[6],e[t+7]=s[7],e[t+8]=s[8],e}clone(){return new this.constructor().fromArray(this.elements)}};Yu.prototype.isMatrix3=!0;let ut=Yu;const Yl=new ut,_h=new ut().set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),wh=new ut().set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715);function Az(){const n={enabled:!0,workingColorSpace:dl,spaces:{},convert:function(i,r,a){return this.enabled===!1||r===a||!r||!a||(this.spaces[r].transfer===kt&&(i.r=Qn(i.r),i.g=Qn(i.g),i.b=Qn(i.b)),this.spaces[r].primaries!==this.spaces[a].primaries&&(i.applyMatrix3(this.spaces[r].toXYZ),i.applyMatrix3(this.spaces[a].fromXYZ)),this.spaces[a].transfer===kt&&(i.r=Lr(i.r),i.g=Lr(i.g),i.b=Lr(i.b))),i},workingToColorSpace:function(i,r){return this.convert(i,this.workingColorSpace,r)},colorSpaceToWorking:function(i,r){return this.convert(i,r,this.workingColorSpace)},getPrimaries:function(i){return this.spaces[i].primaries},getTransfer:function(i){return i===bi?ul:this.spaces[i].transfer},getToneMappingMode:function(i){return this.spaces[i].outputColorSpaceConfig.toneMappingMode||"standard"},getLuminanceCoefficients:function(i,r=this.workingColorSpace){return i.fromArray(this.spaces[r].luminanceCoefficients)},define:function(i){Object.assign(this.spaces,i)},_getMatrix:function(i,r,a){return i.copy(this.spaces[r].toXYZ).multiply(this.spaces[a].fromXYZ)},_getDrawingBufferColorSpace:function(i){return this.spaces[i].outputColorSpaceConfig.drawingBufferColorSpace},_getUnpackColorSpace:function(i=this.workingColorSpace){return this.spaces[i].workingColorSpaceConfig.unpackColorSpace},fromWorkingColorSpace:function(i,r){return Pr("ColorManagement: .fromWorkingColorSpace() has been renamed to .workingToColorSpace()."),n.workingToColorSpace(i,r)},toWorkingColorSpace:function(i,r){return Pr("ColorManagement: .toWorkingColorSpace() has been renamed to .colorSpaceToWorking()."),n.colorSpaceToWorking(i,r)}},e=[.64,.33,.3,.6,.15,.06],t=[.2126,.7152,.0722],s=[.3127,.329];return n.define({[dl]:{primaries:e,whitePoint:s,transfer:ul,toXYZ:_h,fromXYZ:wh,luminanceCoefficients:t,workingColorSpaceConfig:{unpackColorSpace:sn},outputColorSpaceConfig:{drawingBufferColorSpace:sn}},[sn]:{primaries:e,whitePoint:s,transfer:kt,toXYZ:_h,fromXYZ:wh,luminanceCoefficients:t,outputColorSpaceConfig:{drawingBufferColorSpace:sn}}}),n}const xt=Az();function Qn(n){return n<.04045?n*.0773993808:Math.pow(n*.9478672986+.0521327014,2.4)}function Lr(n){return n<.0031308?n*12.92:1.055*Math.pow(n,.41666)-.055}let ur;class Ez{static getDataURL(e,t="image/png"){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement>"u")return e.src;let s;if(e instanceof HTMLCanvasElement)s=e;else{ur===void 0&&(ur=hl("canvas")),ur.width=e.width,ur.height=e.height;const i=ur.getContext("2d");e instanceof ImageData?i.putImageData(e,0,0):i.drawImage(e,0,0,e.width,e.height),s=ur}return s.toDataURL(t)}static sRGBToLinear(e){if(typeof HTMLImageElement<"u"&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&e instanceof ImageBitmap){const t=hl("canvas");t.width=e.width,t.height=e.height;const s=t.getContext("2d");s.drawImage(e,0,0,e.width,e.height);const i=s.getImageData(0,0,e.width,e.height),r=i.data;for(let a=0;a<r.length;a++)r[a]=Qn(r[a]/255)*255;return s.putImageData(i,0,0),t}else if(e.data){const t=e.data.slice(0);for(let s=0;s<t.length;s++)t instanceof Uint8Array||t instanceof Uint8ClampedArray?t[s]=Math.floor(Qn(t[s]/255)*255):t[s]=Qn(t[s]);return{data:t,width:e.width,height:e.height}}else return st("ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),e}}let Dz=0;class vu{constructor(e=null){this.isSource=!0,Object.defineProperty(this,"id",{value:Dz++}),this.uuid=yi(),this.data=e,this.dataReady=!0,this.version=0}getSize(e){const t=this.data;return typeof HTMLVideoElement<"u"&&t instanceof HTMLVideoElement?e.set(t.videoWidth,t.videoHeight,0):typeof VideoFrame<"u"&&t instanceof VideoFrame?e.set(t.displayWidth,t.displayHeight,0):t!==null?e.set(t.width,t.height,t.depth||0):e.set(0,0,0),e}set needsUpdate(e){e===!0&&this.version++}toJSON(e){const t=e===void 0||typeof e=="string";if(!t&&e.images[this.uuid]!==void 0)return e.images[this.uuid];const s={uuid:this.uuid,url:""},i=this.data;if(i!==null){let r;if(Array.isArray(i)){r=[];for(let a=0,o=i.length;a<o;a++)i[a].isDataTexture?r.push(Kl(i[a].image)):r.push(Kl(i[a]))}else r=Kl(i);s.url=r}return t||(e.images[this.uuid]=s),s}}function Kl(n){return typeof HTMLImageElement<"u"&&n instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&n instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&n instanceof ImageBitmap?Ez.getDataURL(n):n.data?{data:Array.from(n.data),width:n.width,height:n.height,type:n.data.constructor.name}:(st("Texture: Unable to serialize Texture."),{})}let Iz=0;const Zl=new U;class Is extends ir{constructor(e=Is.DEFAULT_IMAGE,t=Is.DEFAULT_MAPPING,s=Yn,i=Yn,r=Ds,a=Fi,o=bn,l=Zs,c=Is.DEFAULT_ANISOTROPY,d=bi){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:Iz++}),this.uuid=yi(),this.name="",this.source=new vu(e),this.mipmaps=[],this.mapping=t,this.channel=0,this.wrapS=s,this.wrapT=i,this.magFilter=r,this.minFilter=a,this.anisotropy=c,this.format=o,this.internalFormat=null,this.type=l,this.offset=new lt(0,0),this.repeat=new lt(1,1),this.center=new lt(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new ut,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.colorSpace=d,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(Zl).x}get height(){return this.source.getSize(Zl).y}get depth(){return this.source.getSize(Zl).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,t){this.updateRanges.push({start:e,count:t})}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 t in e){const s=e[t];if(s===void 0){st(`Texture.setValues(): parameter '${t}' has value of undefined.`);continue}const i=this[t];if(i===void 0){st(`Texture.setValues(): property '${t}' does not exist.`);continue}i&&s&&i.isVector2&&s.isVector2||i&&s&&i.isVector3&&s.isVector3||i&&s&&i.isMatrix3&&s.isMatrix3?i.copy(s):this[t]=s}}toJSON(e){const t=e===void 0||typeof e=="string";if(!t&&e.textures[this.uuid]!==void 0)return e.textures[this.uuid];const s={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&&(s.userData=this.userData),t||(e.textures[this.uuid]=s),s}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(this.mapping!==Bm)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case gd:e.x=e.x-Math.floor(e.x);break;case Yn:e.x=e.x<0?0:1;break;case Md: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 gd:e.y=e.y-Math.floor(e.y);break;case Yn:e.y=e.y<0?0:1;break;case Md: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++}}Is.DEFAULT_IMAGE=null;Is.DEFAULT_MAPPING=Bm;Is.DEFAULT_ANISOTROPY=1;const Ku=class Ku{constructor(e=0,t=0,s=0,i=1){this.x=e,this.y=t,this.z=s,this.w=i}get width(){return this.z}set width(e){this.z=e}get height(){return this.w}set height(e){this.w=e}set(e,t,s,i){return this.x=e,this.y=t,this.z=s,this.w=i,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,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;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,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,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,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.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 t=this.x,s=this.y,i=this.z,r=this.w,a=e.elements;return this.x=a[0]*t+a[4]*s+a[8]*i+a[12]*r,this.y=a[1]*t+a[5]*s+a[9]*i+a[13]*r,this.z=a[2]*t+a[6]*s+a[10]*i+a[14]*r,this.w=a[3]*t+a[7]*s+a[11]*i+a[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 t=Math.sqrt(1-e.w*e.w);return t<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this}setAxisAngleFromRotationMatrix(e){let t,s,i,r;const l=e.elements,c=l[0],d=l[4],u=l[8],h=l[1],g=l[5],p=l[9],z=l[2],m=l[6],f=l[10];if(Math.abs(d-h)<.01&&Math.abs(u-z)<.01&&Math.abs(p-m)<.01){if(Math.abs(d+h)<.1&&Math.abs(u+z)<.1&&Math.abs(p+m)<.1&&Math.abs(c+g+f-3)<.1)return this.set(1,0,0,0),this;t=Math.PI;const O=(c+1)/2,w=(g+1)/2,x=(f+1)/2,S=(d+h)/4,I=(u+z)/4,b=(p+m)/4;return O>w&&O>x?O<.01?(s=0,i=.707106781,r=.707106781):(s=Math.sqrt(O),i=S/s,r=I/s):w>x?w<.01?(s=.707106781,i=0,r=.707106781):(i=Math.sqrt(w),s=S/i,r=b/i):x<.01?(s=.707106781,i=.707106781,r=0):(r=Math.sqrt(x),s=I/r,i=b/r),this.set(s,i,r,t),this}let _=Math.sqrt((m-p)*(m-p)+(u-z)*(u-z)+(h-d)*(h-d));return Math.abs(_)<.001&&(_=1),this.x=(m-p)/_,this.y=(u-z)/_,this.z=(h-d)/_,this.w=Math.acos((c+g+f-1)/2),this}setFromMatrixPosition(e){const t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this.w=t[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,t){return this.x=St(this.x,e.x,t.x),this.y=St(this.y,e.y,t.y),this.z=St(this.z,e.z,t.z),this.w=St(this.w,e.w,t.w),this}clampScalar(e,t){return this.x=St(this.x,e,t),this.y=St(this.y,e,t),this.z=St(this.z,e,t),this.w=St(this.w,e,t),this}clampLength(e,t){const s=this.length();return this.divideScalar(s||1).multiplyScalar(St(s,e,t))}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,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this.w+=(e.w-this.w)*t,this}lerpVectors(e,t,s){return this.x=e.x+(t.x-e.x)*s,this.y=e.y+(t.y-e.y)*s,this.z=e.z+(t.z-e.z)*s,this.w=e.w+(t.w-e.w)*s,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this.w=e[t+3],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this.w=e.getW(t),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}};Ku.prototype.isVector4=!0;let ts=Ku;class Tz extends ir{constructor(e=1,t=1,s={}){super(),s=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:Ds,depthBuffer:!0,stencilBuffer:!1,resolveDepthBuffer:!0,resolveStencilBuffer:!0,depthTexture:null,samples:0,count:1,depth:1,multiview:!1,useArrayDepthTexture:!1},s),this.isRenderTarget=!0,this.width=e,this.height=t,this.depth=s.depth,this.scissor=new ts(0,0,e,t),this.scissorTest=!1,this.viewport=new ts(0,0,e,t),this.textures=[];const i={width:e,height:t,depth:s.depth},r=new Is(i),a=s.count;for(let o=0;o<a;o++)this.textures[o]=r.clone(),this.textures[o].isRenderTargetTexture=!0,this.textures[o].renderTarget=this;this._setTextureOptions(s),this.depthBuffer=s.depthBuffer,this.stencilBuffer=s.stencilBuffer,this.resolveDepthBuffer=s.resolveDepthBuffer,this.resolveStencilBuffer=s.resolveStencilBuffer,this._depthTexture=null,this.depthTexture=s.depthTexture,this.samples=s.samples,this.multiview=s.multiview,this.useArrayDepthTexture=s.useArrayDepthTexture}_setTextureOptions(e={}){const t={minFilter:Ds,generateMipmaps:!1,flipY:!1,internalFormat:null};e.mapping!==void 0&&(t.mapping=e.mapping),e.wrapS!==void 0&&(t.wrapS=e.wrapS),e.wrapT!==void 0&&(t.wrapT=e.wrapT),e.wrapR!==void 0&&(t.wrapR=e.wrapR),e.magFilter!==void 0&&(t.magFilter=e.magFilter),e.minFilter!==void 0&&(t.minFilter=e.minFilter),e.format!==void 0&&(t.format=e.format),e.type!==void 0&&(t.type=e.type),e.anisotropy!==void 0&&(t.anisotropy=e.anisotropy),e.colorSpace!==void 0&&(t.colorSpace=e.colorSpace),e.flipY!==void 0&&(t.flipY=e.flipY),e.generateMipmaps!==void 0&&(t.generateMipmaps=e.generateMipmaps),e.internalFormat!==void 0&&(t.internalFormat=e.internalFormat);for(let s=0;s<this.textures.length;s++)this.textures[s].setValues(t)}get texture(){return this.textures[0]}set texture(e){this.textures[0]=e}set depthTexture(e){this._depthTexture!==null&&(this._depthTexture.renderTarget=null),e!==null&&(e.renderTarget=this),this._depthTexture=e}get depthTexture(){return this._depthTexture}setSize(e,t,s=1){if(this.width!==e||this.height!==t||this.depth!==s){this.width=e,this.height=t,this.depth=s;for(let i=0,r=this.textures.length;i<r;i++)this.textures[i].image.width=e,this.textures[i].image.height=t,this.textures[i].image.depth=s,this.textures[i].isData3DTexture!==!0&&(this.textures[i].isArrayTexture=this.textures[i].image.depth>1);this.dispose()}this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)}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 t=0,s=e.textures.length;t<s;t++){this.textures[t]=e.textures[t].clone(),this.textures[t].isRenderTargetTexture=!0,this.textures[t].renderTarget=this;const i=Object.assign({},e.textures[t].image);this.textures[t].source=new vu(i)}return this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,this.resolveDepthBuffer=e.resolveDepthBuffer,this.resolveStencilBuffer=e.resolveStencilBuffer,e.depthTexture!==null&&(this.depthTexture=e.depthTexture.clone()),this.samples=e.samples,this.multiview=e.multiview,this.useArrayDepthTexture=e.useArrayDepthTexture,this}dispose(){this.dispatchEvent({type:"dispose"})}}class In extends Tz{constructor(e=1,t=1,s={}){super(e,t,s),this.isWebGLRenderTarget=!0}}class Fm extends Is{constructor(e=null,t=1,s=1,i=1){super(null),this.isDataArrayTexture=!0,this.image={data:e,width:t,height:s,depth:i},this.magFilter=ys,this.minFilter=ys,this.wrapR=Yn,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.layerUpdates=new Set}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}}class Gz extends Is{constructor(e=null,t=1,s=1,i=1){super(null),this.isData3DTexture=!0,this.image={data:e,width:t,height:s,depth:i},this.magFilter=ys,this.minFilter=ys,this.wrapR=Yn,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}const yl=class yl{constructor(e,t,s,i,r,a,o,l,c,d,u,h,g,p,z,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,t,s,i,r,a,o,l,c,d,u,h,g,p,z,m)}set(e,t,s,i,r,a,o,l,c,d,u,h,g,p,z,m){const f=this.elements;return f[0]=e,f[4]=t,f[8]=s,f[12]=i,f[1]=r,f[5]=a,f[9]=o,f[13]=l,f[2]=c,f[6]=d,f[10]=u,f[14]=h,f[3]=g,f[7]=p,f[11]=z,f[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 yl().fromArray(this.elements)}copy(e){const t=this.elements,s=e.elements;return t[0]=s[0],t[1]=s[1],t[2]=s[2],t[3]=s[3],t[4]=s[4],t[5]=s[5],t[6]=s[6],t[7]=s[7],t[8]=s[8],t[9]=s[9],t[10]=s[10],t[11]=s[11],t[12]=s[12],t[13]=s[13],t[14]=s[14],t[15]=s[15],this}copyPosition(e){const t=this.elements,s=e.elements;return t[12]=s[12],t[13]=s[13],t[14]=s[14],this}setFromMatrix3(e){const t=e.elements;return this.set(t[0],t[3],t[6],0,t[1],t[4],t[7],0,t[2],t[5],t[8],0,0,0,0,1),this}extractBasis(e,t,s){return this.determinantAffine()===0?(e.set(1,0,0),t.set(0,1,0),s.set(0,0,1),this):(e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),s.setFromMatrixColumn(this,2),this)}makeBasis(e,t,s){return this.set(e.x,t.x,s.x,0,e.y,t.y,s.y,0,e.z,t.z,s.z,0,0,0,0,1),this}extractRotation(e){if(e.determinantAffine()===0)return this.identity();const t=this.elements,s=e.elements,i=1/hr.setFromMatrixColumn(e,0).length(),r=1/hr.setFromMatrixColumn(e,1).length(),a=1/hr.setFromMatrixColumn(e,2).length();return t[0]=s[0]*i,t[1]=s[1]*i,t[2]=s[2]*i,t[3]=0,t[4]=s[4]*r,t[5]=s[5]*r,t[6]=s[6]*r,t[7]=0,t[8]=s[8]*a,t[9]=s[9]*a,t[10]=s[10]*a,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromEuler(e){const t=this.elements,s=e.x,i=e.y,r=e.z,a=Math.cos(s),o=Math.sin(s),l=Math.cos(i),c=Math.sin(i),d=Math.cos(r),u=Math.sin(r);if(e.order==="XYZ"){const h=a*d,g=a*u,p=o*d,z=o*u;t[0]=l*d,t[4]=-l*u,t[8]=c,t[1]=g+p*c,t[5]=h-z*c,t[9]=-o*l,t[2]=z-h*c,t[6]=p+g*c,t[10]=a*l}else if(e.order==="YXZ"){const h=l*d,g=l*u,p=c*d,z=c*u;t[0]=h+z*o,t[4]=p*o-g,t[8]=a*c,t[1]=a*u,t[5]=a*d,t[9]=-o,t[2]=g*o-p,t[6]=z+h*o,t[10]=a*l}else if(e.order==="ZXY"){const h=l*d,g=l*u,p=c*d,z=c*u;t[0]=h-z*o,t[4]=-a*u,t[8]=p+g*o,t[1]=g+p*o,t[5]=a*d,t[9]=z-h*o,t[2]=-a*c,t[6]=o,t[10]=a*l}else if(e.order==="ZYX"){const h=a*d,g=a*u,p=o*d,z=o*u;t[0]=l*d,t[4]=p*c-g,t[8]=h*c+z,t[1]=l*u,t[5]=z*c+h,t[9]=g*c-p,t[2]=-c,t[6]=o*l,t[10]=a*l}else if(e.order==="YZX"){const h=a*l,g=a*c,p=o*l,z=o*c;t[0]=l*d,t[4]=z-h*u,t[8]=p*u+g,t[1]=u,t[5]=a*d,t[9]=-o*d,t[2]=-c*d,t[6]=g*u+p,t[10]=h-z*u}else if(e.order==="XZY"){const h=a*l,g=a*c,p=o*l,z=o*c;t[0]=l*d,t[4]=-u,t[8]=c*d,t[1]=h*u+z,t[5]=a*d,t[9]=g*u-p,t[2]=p*u-g,t[6]=o*d,t[10]=z*u+h}return t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromQuaternion(e){return this.compose(Rz,e,Bz)}lookAt(e,t,s){const i=this.elements;return Hs.subVectors(e,t),Hs.lengthSq()===0&&(Hs.z=1),Hs.normalize(),ci.crossVectors(s,Hs),ci.lengthSq()===0&&(Math.abs(s.z)===1?Hs.x+=1e-4:Hs.z+=1e-4,Hs.normalize(),ci.crossVectors(s,Hs)),ci.normalize(),Xa.crossVectors(Hs,ci),i[0]=ci.x,i[4]=Xa.x,i[8]=Hs.x,i[1]=ci.y,i[5]=Xa.y,i[9]=Hs.y,i[2]=ci.z,i[6]=Xa.z,i[10]=Hs.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const s=e.elements,i=t.elements,r=this.elements,a=s[0],o=s[4],l=s[8],c=s[12],d=s[1],u=s[5],h=s[9],g=s[13],p=s[2],z=s[6],m=s[10],f=s[14],_=s[3],O=s[7],w=s[11],x=s[15],S=i[0],I=i[4],b=i[8],A=i[12],B=i[1],N=i[5],k=i[9],L=i[13],F=i[2],P=i[6],W=i[10],X=i[14],Q=i[3],ie=i[7],be=i[11],ae=i[15];return r[0]=a*S+o*B+l*F+c*Q,r[4]=a*I+o*N+l*P+c*ie,r[8]=a*b+o*k+l*W+c*be,r[12]=a*A+o*L+l*X+c*ae,r[1]=d*S+u*B+h*F+g*Q,r[5]=d*I+u*N+h*P+g*ie,r[9]=d*b+u*k+h*W+g*be,r[13]=d*A+u*L+h*X+g*ae,r[2]=p*S+z*B+m*F+f*Q,r[6]=p*I+z*N+m*P+f*ie,r[10]=p*b+z*k+m*W+f*be,r[14]=p*A+z*L+m*X+f*ae,r[3]=_*S+O*B+w*F+x*Q,r[7]=_*I+O*N+w*P+x*ie,r[11]=_*b+O*k+w*W+x*be,r[15]=_*A+O*L+w*X+x*ae,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this}determinant(){const e=this.elements,t=e[0],s=e[4],i=e[8],r=e[12],a=e[1],o=e[5],l=e[9],c=e[13],d=e[2],u=e[6],h=e[10],g=e[14],p=e[3],z=e[7],m=e[11],f=e[15],_=l*g-c*h,O=o*g-c*u,w=o*h-l*u,x=a*g-c*d,S=a*h-l*d,I=a*u-o*d;return t*(z*_-m*O+f*w)-s*(p*_-m*x+f*S)+i*(p*O-z*x+f*I)-r*(p*w-z*S+m*I)}determinantAffine(){const e=this.elements,t=e[0],s=e[4],i=e[8],r=e[1],a=e[5],o=e[9],l=e[2],c=e[6],d=e[10];return t*(a*d-o*c)-s*(r*d-o*l)+i*(r*c-a*l)}transpose(){const e=this.elements;let t;return t=e[1],e[1]=e[4],e[4]=t,t=e[2],e[2]=e[8],e[8]=t,t=e[6],e[6]=e[9],e[9]=t,t=e[3],e[3]=e[12],e[12]=t,t=e[7],e[7]=e[13],e[13]=t,t=e[11],e[11]=e[14],e[14]=t,this}setPosition(e,t,s){const i=this.elements;return e.isVector3?(i[12]=e.x,i[13]=e.y,i[14]=e.z):(i[12]=e,i[13]=t,i[14]=s),this}invert(){const e=this.elements,t=e[0],s=e[1],i=e[2],r=e[3],a=e[4],o=e[5],l=e[6],c=e[7],d=e[8],u=e[9],h=e[10],g=e[11],p=e[12],z=e[13],m=e[14],f=e[15],_=t*o-s*a,O=t*l-i*a,w=t*c-r*a,x=s*l-i*o,S=s*c-r*o,I=i*c-r*l,b=d*z-u*p,A=d*m-h*p,B=d*f-g*p,N=u*m-h*z,k=u*f-g*z,L=h*f-g*m,F=_*L-O*k+w*N+x*B-S*A+I*b;if(F===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const P=1/F;return e[0]=(o*L-l*k+c*N)*P,e[1]=(i*k-s*L-r*N)*P,e[2]=(z*I-m*S+f*x)*P,e[3]=(h*S-u*I-g*x)*P,e[4]=(l*B-a*L-c*A)*P,e[5]=(t*L-i*B+r*A)*P,e[6]=(m*w-p*I-f*O)*P,e[7]=(d*I-h*w+g*O)*P,e[8]=(a*k-o*B+c*b)*P,e[9]=(s*B-t*k-r*b)*P,e[10]=(p*S-z*w+f*_)*P,e[11]=(u*w-d*S-g*_)*P,e[12]=(o*A-a*N-l*b)*P,e[13]=(t*N-s*A+i*b)*P,e[14]=(z*O-p*x-m*_)*P,e[15]=(d*x-u*O+h*_)*P,this}scale(e){const t=this.elements,s=e.x,i=e.y,r=e.z;return t[0]*=s,t[4]*=i,t[8]*=r,t[1]*=s,t[5]*=i,t[9]*=r,t[2]*=s,t[6]*=i,t[10]*=r,t[3]*=s,t[7]*=i,t[11]*=r,this}getMaxScaleOnAxis(){const e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],s=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],i=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,s,i))}makeTranslation(e,t,s){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,t,0,0,1,s,0,0,0,1),this}makeRotationX(e){const t=Math.cos(e),s=Math.sin(e);return this.set(1,0,0,0,0,t,-s,0,0,s,t,0,0,0,0,1),this}makeRotationY(e){const t=Math.cos(e),s=Math.sin(e);return this.set(t,0,s,0,0,1,0,0,-s,0,t,0,0,0,0,1),this}makeRotationZ(e){const t=Math.cos(e),s=Math.sin(e);return this.set(t,-s,0,0,s,t,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,t){const s=Math.cos(t),i=Math.sin(t),r=1-s,a=e.x,o=e.y,l=e.z,c=r*a,d=r*o;return this.set(c*a+s,c*o-i*l,c*l+i*o,0,c*o+i*l,d*o+s,d*l-i*a,0,c*l-i*o,d*l+i*a,r*l*l+s,0,0,0,0,1),this}makeScale(e,t,s){return this.set(e,0,0,0,0,t,0,0,0,0,s,0,0,0,0,1),this}makeShear(e,t,s,i,r,a){return this.set(1,s,r,0,e,1,a,0,t,i,1,0,0,0,0,1),this}compose(e,t,s){const i=this.elements,r=t._x,a=t._y,o=t._z,l=t._w,c=r+r,d=a+a,u=o+o,h=r*c,g=r*d,p=r*u,z=a*d,m=a*u,f=o*u,_=l*c,O=l*d,w=l*u,x=s.x,S=s.y,I=s.z;return i[0]=(1-(z+f))*x,i[1]=(g+w)*x,i[2]=(p-O)*x,i[3]=0,i[4]=(g-w)*S,i[5]=(1-(h+f))*S,i[6]=(m+_)*S,i[7]=0,i[8]=(p+O)*I,i[9]=(m-_)*I,i[10]=(1-(h+z))*I,i[11]=0,i[12]=e.x,i[13]=e.y,i[14]=e.z,i[15]=1,this}decompose(e,t,s){const i=this.elements;e.x=i[12],e.y=i[13],e.z=i[14];const r=this.determinantAffine();if(r===0)return s.set(1,1,1),t.identity(),this;let a=hr.set(i[0],i[1],i[2]).length();const o=hr.set(i[4],i[5],i[6]).length(),l=hr.set(i[8],i[9],i[10]).length();r<0&&(a=-a),dn.copy(this);const c=1/a,d=1/o,u=1/l;return dn.elements[0]*=c,dn.elements[1]*=c,dn.elements[2]*=c,dn.elements[4]*=d,dn.elements[5]*=d,dn.elements[6]*=d,dn.elements[8]*=u,dn.elements[9]*=u,dn.elements[10]*=u,t.setFromRotationMatrix(dn),s.x=a,s.y=o,s.z=l,this}makePerspective(e,t,s,i,r,a,o=An,l=!1){const c=this.elements,d=2*r/(t-e),u=2*r/(s-i),h=(t+e)/(t-e),g=(s+i)/(s-i);let p,z;if(l)p=r/(a-r),z=a*r/(a-r);else if(o===An)p=-(a+r)/(a-r),z=-2*a*r/(a-r);else if(o===ka)p=-a/(a-r),z=-a*r/(a-r);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+o);return c[0]=d,c[4]=0,c[8]=h,c[12]=0,c[1]=0,c[5]=u,c[9]=g,c[13]=0,c[2]=0,c[6]=0,c[10]=p,c[14]=z,c[3]=0,c[7]=0,c[11]=-1,c[15]=0,this}makeOrthographic(e,t,s,i,r,a,o=An,l=!1){const c=this.elements,d=2/(t-e),u=2/(s-i),h=-(t+e)/(t-e),g=-(s+i)/(s-i);let p,z;if(l)p=1/(a-r),z=a/(a-r);else if(o===An)p=-2/(a-r),z=-(a+r)/(a-r);else if(o===ka)p=-1/(a-r),z=-r/(a-r);else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+o);return c[0]=d,c[4]=0,c[8]=0,c[12]=h,c[1]=0,c[5]=u,c[9]=0,c[13]=g,c[2]=0,c[6]=0,c[10]=p,c[14]=z,c[3]=0,c[7]=0,c[11]=0,c[15]=1,this}equals(e){const t=this.elements,s=e.elements;for(let i=0;i<16;i++)if(t[i]!==s[i])return!1;return!0}fromArray(e,t=0){for(let s=0;s<16;s++)this.elements[s]=e[s+t];return this}toArray(e=[],t=0){const s=this.elements;return e[t]=s[0],e[t+1]=s[1],e[t+2]=s[2],e[t+3]=s[3],e[t+4]=s[4],e[t+5]=s[5],e[t+6]=s[6],e[t+7]=s[7],e[t+8]=s[8],e[t+9]=s[9],e[t+10]=s[10],e[t+11]=s[11],e[t+12]=s[12],e[t+13]=s[13],e[t+14]=s[14],e[t+15]=s[15],e}};yl.prototype.isMatrix4=!0;let Gt=yl;const hr=new U,dn=new Gt,Rz=new U(0,0,0),Bz=new U(1,1,1),ci=new U,Xa=new U,Hs=new U,yh=new Gt,vh=new rr;class Di{constructor(e=0,t=0,s=0,i=Di.DEFAULT_ORDER){this.isEuler=!0,this._x=e,this._y=t,this._z=s,this._order=i}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,t,s,i=this._order){return this._x=e,this._y=t,this._z=s,this._order=i,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,t=this._order,s=!0){const i=e.elements,r=i[0],a=i[4],o=i[8],l=i[1],c=i[5],d=i[9],u=i[2],h=i[6],g=i[10];switch(t){case"XYZ":this._y=Math.asin(St(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(-d,g),this._z=Math.atan2(-a,r)):(this._x=Math.atan2(h,c),this._z=0);break;case"YXZ":this._x=Math.asin(-St(d,-1,1)),Math.abs(d)<.9999999?(this._y=Math.atan2(o,g),this._z=Math.atan2(l,c)):(this._y=Math.atan2(-u,r),this._z=0);break;case"ZXY":this._x=Math.asin(St(h,-1,1)),Math.abs(h)<.9999999?(this._y=Math.atan2(-u,g),this._z=Math.atan2(-a,c)):(this._y=0,this._z=Math.atan2(l,r));break;case"ZYX":this._y=Math.asin(-St(u,-1,1)),Math.abs(u)<.9999999?(this._x=Math.atan2(h,g),this._z=Math.atan2(l,r)):(this._x=0,this._z=Math.atan2(-a,c));break;case"YZX":this._z=Math.asin(St(l,-1,1)),Math.abs(l)<.9999999?(this._x=Math.atan2(-d,c),this._y=Math.atan2(-u,r)):(this._x=0,this._y=Math.atan2(o,g));break;case"XZY":this._z=Math.asin(-St(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(h,c),this._y=Math.atan2(o,r)):(this._x=Math.atan2(-d,g),this._y=0);break;default:st("Euler: .setFromRotationMatrix() encountered an unknown order: "+t)}return this._order=t,s===!0&&this._onChangeCallback(),this}setFromQuaternion(e,t,s){return yh.makeRotationFromQuaternion(e),this.setFromRotationMatrix(yh,t,s)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return vh.setFromEuler(this),this.setFromQuaternion(vh,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=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+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}}Di.DEFAULT_ORDER="XYZ";class Ou{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 Nz=0;const Oh=new U,fr=new rr,Bn=new Gt,Ya=new U,ca=new U,Cz=new U,Pz=new rr,xh=new U(1,0,0),Sh=new U(0,1,0),Ah=new U(0,0,1),Eh={type:"added"},Lz={type:"removed"},pr={type:"childadded",child:null},Ql={type:"childremoved",child:null};class ss extends ir{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:Nz++}),this.uuid=yi(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=ss.DEFAULT_UP.clone();const e=new U,t=new Di,s=new rr,i=new U(1,1,1);function r(){s.setFromEuler(t,!1)}function a(){t.setFromQuaternion(s,void 0,!1)}t._onChange(r),s._onChange(a),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:e},rotation:{configurable:!0,enumerable:!0,value:t},quaternion:{configurable:!0,enumerable:!0,value:s},scale:{configurable:!0,enumerable:!0,value:i},modelViewMatrix:{value:new Gt},normalMatrix:{value:new ut}}),this.matrix=new Gt,this.matrixWorld=new Gt,this.matrixAutoUpdate=ss.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=ss.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new Ou,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,t){this.quaternion.setFromAxisAngle(e,t)}setRotationFromEuler(e){this.quaternion.setFromEuler(e,!0)}setRotationFromMatrix(e){this.quaternion.setFromRotationMatrix(e)}setRotationFromQuaternion(e){this.quaternion.copy(e)}rotateOnAxis(e,t){return fr.setFromAxisAngle(e,t),this.quaternion.multiply(fr),this}rotateOnWorldAxis(e,t){return fr.setFromAxisAngle(e,t),this.quaternion.premultiply(fr),this}rotateX(e){return this.rotateOnAxis(xh,e)}rotateY(e){return this.rotateOnAxis(Sh,e)}rotateZ(e){return this.rotateOnAxis(Ah,e)}translateOnAxis(e,t){return Oh.copy(e).applyQuaternion(this.quaternion),this.position.add(Oh.multiplyScalar(t)),this}translateX(e){return this.translateOnAxis(xh,e)}translateY(e){return this.translateOnAxis(Sh,e)}translateZ(e){return this.translateOnAxis(Ah,e)}localToWorld(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(this.matrixWorld)}worldToLocal(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(Bn.copy(this.matrixWorld).invert())}lookAt(e,t,s){e.isVector3?Ya.copy(e):Ya.set(e,t,s);const i=this.parent;this.updateWorldMatrix(!0,!1),ca.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?Bn.lookAt(ca,Ya,this.up):Bn.lookAt(Ya,ca,this.up),this.quaternion.setFromRotationMatrix(Bn),i&&(Bn.extractRotation(i.matrixWorld),fr.setFromRotationMatrix(Bn),this.quaternion.premultiply(fr.invert()))}add(e){if(arguments.length>1){for(let t=0;t<arguments.length;t++)this.add(arguments[t]);return this}return e===this?(Ot("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(Eh),pr.child=e,this.dispatchEvent(pr),pr.child=null):Ot("Object3D.add: object not an instance of THREE.Object3D.",e),this)}remove(e){if(arguments.length>1){for(let s=0;s<arguments.length;s++)this.remove(arguments[s]);return this}const t=this.children.indexOf(e);return t!==-1&&(e.parent=null,this.children.splice(t,1),e.dispatchEvent(Lz),Ql.child=e,this.dispatchEvent(Ql),Ql.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),Bn.copy(this.matrixWorld).invert(),e.parent!==null&&(e.parent.updateWorldMatrix(!0,!1),Bn.multiply(e.parent.matrixWorld)),e.applyMatrix4(Bn),e.removeFromParent(),e.parent=this,this.children.push(e),e.updateWorldMatrix(!1,!0),e.dispatchEvent(Eh),pr.child=e,this.dispatchEvent(pr),pr.child=null,this}getObjectById(e){return this.getObjectByProperty("id",e)}getObjectByName(e){return this.getObjectByProperty("name",e)}getObjectByProperty(e,t){if(this[e]===t)return this;for(let s=0,i=this.children.length;s<i;s++){const a=this.children[s].getObjectByProperty(e,t);if(a!==void 0)return a}}getObjectsByProperty(e,t,s=[]){this[e]===t&&s.push(this);const i=this.children;for(let r=0,a=i.length;r<a;r++)i[r].getObjectsByProperty(e,t,s);return s}getWorldPosition(e){return this.updateWorldMatrix(!0,!1),e.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(ca,e,Cz),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(ca,Pz,e),e}getWorldDirection(e){this.updateWorldMatrix(!0,!1);const t=this.matrixWorld.elements;return e.set(t[8],t[9],t[10]).normalize()}raycast(){}traverse(e){e(this);const t=this.children;for(let s=0,i=t.length;s<i;s++)t[s].traverse(e)}traverseVisible(e){if(this.visible===!1)return;e(this);const t=this.children;for(let s=0,i=t.length;s<i;s++)t[s].traverseVisible(e)}traverseAncestors(e){const t=this.parent;t!==null&&(e(t),t.traverseAncestors(e))}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale);const e=this.pivot;if(e!==null){const t=e.x,s=e.y,i=e.z,r=this.matrix.elements;r[12]+=t-r[0]*t-r[4]*s-r[8]*i,r[13]+=s-r[1]*t-r[5]*s-r[9]*i,r[14]+=i-r[2]*t-r[6]*s-r[10]*i}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 t=this.children;for(let s=0,i=t.length;s<i;s++)t[s].updateMatrixWorld(e)}updateWorldMatrix(e,t,s=!1){const i=this.parent;if(e===!0&&i!==null&&i.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||s)&&(this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),this.matrixWorldNeedsUpdate=!1,s=!0),t===!0){const r=this.children;for(let a=0,o=r.length;a<o;a++)r[a].updateWorldMatrix(!1,!0,s)}}toJSON(e){const t=e===void 0||typeof e=="string",s={};t&&(e={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},s.metadata={version:4.7,type:"Object",generator:"Object3D.toJSON"});const i={};i.uuid=this.uuid,i.type=this.type,this.name!==""&&(i.name=this.name),this.castShadow===!0&&(i.castShadow=!0),this.receiveShadow===!0&&(i.receiveShadow=!0),this.visible===!1&&(i.visible=!1),this.frustumCulled===!1&&(i.frustumCulled=!1),this.renderOrder!==0&&(i.renderOrder=this.renderOrder),this.static!==!1&&(i.static=this.static),Object.keys(this.userData).length>0&&(i.userData=this.userData),i.layers=this.layers.mask,i.matrix=this.matrix.toArray(),i.up=this.up.toArray(),this.pivot!==null&&(i.pivot=this.pivot.toArray()),this.matrixAutoUpdate===!1&&(i.matrixAutoUpdate=!1),this.morphTargetDictionary!==void 0&&(i.morphTargetDictionary=Object.assign({},this.morphTargetDictionary)),this.morphTargetInfluences!==void 0&&(i.morphTargetInfluences=this.morphTargetInfluences.slice()),this.isInstancedMesh&&(i.type="InstancedMesh",i.count=this.count,i.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(i.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(i.type="BatchedMesh",i.perObjectFrustumCulled=this.perObjectFrustumCulled,i.sortObjects=this.sortObjects,i.drawRanges=this._drawRanges,i.reservedRanges=this._reservedRanges,i.geometryInfo=this._geometryInfo.map(o=>({...o,boundingBox:o.boundingBox?o.boundingBox.toJSON():void 0,boundingSphere:o.boundingSphere?o.boundingSphere.toJSON():void 0})),i.instanceInfo=this._instanceInfo.map(o=>({...o})),i.availableInstanceIds=this._availableInstanceIds.slice(),i.availableGeometryIds=this._availableGeometryIds.slice(),i.nextIndexStart=this._nextIndexStart,i.nextVertexStart=this._nextVertexStart,i.geometryCount=this._geometryCount,i.maxInstanceCount=this._maxInstanceCount,i.maxVertexCount=this._maxVertexCount,i.maxIndexCount=this._maxIndexCount,i.geometryInitialized=this._geometryInitialized,i.matricesTexture=this._matricesTexture.toJSON(e),i.indirectTexture=this._indirectTexture.toJSON(e),this._colorsTexture!==null&&(i.colorsTexture=this._colorsTexture.toJSON(e)),this.boundingSphere!==null&&(i.boundingSphere=this.boundingSphere.toJSON()),this.boundingBox!==null&&(i.boundingBox=this.boundingBox.toJSON()));function r(o,l){return o[l.uuid]===void 0&&(o[l.uuid]=l.toJSON(e)),l.uuid}if(this.isScene)this.background&&(this.background.isColor?i.background=this.background.toJSON():this.background.isTexture&&(i.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(i.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){i.geometry=r(e.geometries,this.geometry);const o=this.geometry.parameters;if(o!==void 0&&o.shapes!==void 0){const l=o.shapes;if(Array.isArray(l))for(let c=0,d=l.length;c<d;c++){const u=l[c];r(e.shapes,u)}else r(e.shapes,l)}}if(this.isSkinnedMesh&&(i.bindMode=this.bindMode,i.bindMatrix=this.bindMatrix.toArray(),this.skeleton!==void 0&&(r(e.skeletons,this.skeleton),i.skeleton=this.skeleton.uuid)),this.material!==void 0)if(Array.isArray(this.material)){const o=[];for(let l=0,c=this.material.length;l<c;l++)o.push(r(e.materials,this.material[l]));i.material=o}else i.material=r(e.materials,this.material);if(this.children.length>0){i.children=[];for(let o=0;o<this.children.length;o++)i.children.push(this.children[o].toJSON(e).object)}if(this.animations.length>0){i.animations=[];for(let o=0;o<this.animations.length;o++){const l=this.animations[o];i.animations.push(r(e.animations,l))}}if(t){const o=a(e.geometries),l=a(e.materials),c=a(e.textures),d=a(e.images),u=a(e.shapes),h=a(e.skeletons),g=a(e.animations),p=a(e.nodes);o.length>0&&(s.geometries=o),l.length>0&&(s.materials=l),c.length>0&&(s.textures=c),d.length>0&&(s.images=d),u.length>0&&(s.shapes=u),h.length>0&&(s.skeletons=h),g.length>0&&(s.animations=g),p.length>0&&(s.nodes=p)}return s.object=i,s;function a(o){const l=[];for(const c in o){const d=o[c];delete d.metadata,l.push(d)}return l}}clone(e){return new this.constructor().copy(this,e)}copy(e,t=!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)),t===!0)for(let s=0;s<e.children.length;s++){const i=e.children[s];this.add(i.clone())}return this}}ss.DEFAULT_UP=new U(0,1,0);ss.DEFAULT_MATRIX_AUTO_UPDATE=!0;ss.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;class Da extends ss{constructor(){super(),this.isGroup=!0,this.type="Group"}}const Wz={type:"move"};class Jl{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new Da,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 Da,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new U,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new U),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new Da,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new U,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new U,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 t=this._hand;if(t)for(const s of e.hand.values())this._getHandJoint(t,s)}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,t,s){let i=null,r=null,a=null;const o=this._targetRay,l=this._grip,c=this._hand;if(e&&t.session.visibilityState!=="visible-blurred"){if(c&&e.hand){a=!0;for(const z of e.hand.values()){const m=t.getJointPose(z,s),f=this._getHandJoint(c,z);m!==null&&(f.matrix.fromArray(m.transform.matrix),f.matrix.decompose(f.position,f.rotation,f.scale),f.matrixWorldNeedsUpdate=!0,f.jointRadius=m.radius),f.visible=m!==null}const d=c.joints["index-finger-tip"],u=c.joints["thumb-tip"],h=d.position.distanceTo(u.position),g=.02,p=.005;c.inputState.pinching&&h>g+p?(c.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!c.inputState.pinching&&h<=g-p&&(c.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else l!==null&&e.gripSpace&&(r=t.getPose(e.gripSpace,s),r!==null&&(l.matrix.fromArray(r.transform.matrix),l.matrix.decompose(l.position,l.rotation,l.scale),l.matrixWorldNeedsUpdate=!0,r.linearVelocity?(l.hasLinearVelocity=!0,l.linearVelocity.copy(r.linearVelocity)):l.hasLinearVelocity=!1,r.angularVelocity?(l.hasAngularVelocity=!0,l.angularVelocity.copy(r.angularVelocity)):l.hasAngularVelocity=!1,l.eventsEnabled&&l.dispatchEvent({type:"gripUpdated",data:e,target:this})));o!==null&&(i=t.getPose(e.targetRaySpace,s),i===null&&r!==null&&(i=r),i!==null&&(o.matrix.fromArray(i.transform.matrix),o.matrix.decompose(o.position,o.rotation,o.scale),o.matrixWorldNeedsUpdate=!0,i.linearVelocity?(o.hasLinearVelocity=!0,o.linearVelocity.copy(i.linearVelocity)):o.hasLinearVelocity=!1,i.angularVelocity?(o.hasAngularVelocity=!0,o.angularVelocity.copy(i.angularVelocity)):o.hasAngularVelocity=!1,this.dispatchEvent(Wz)))}return o!==null&&(o.visible=i!==null),l!==null&&(l.visible=r!==null),c!==null&&(c.visible=a!==null),this}_getHandJoint(e,t){if(e.joints[t.jointName]===void 0){const s=new Da;s.matrixAutoUpdate=!1,s.visible=!1,e.joints[t.jointName]=s,e.add(s)}return e.joints[t.jointName]}}const jm={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},di={h:0,s:0,l:0},Ka={h:0,s:0,l:0};function ec(n,e,t){return t<0&&(t+=1),t>1&&(t-=1),t<1/6?n+(e-n)*6*t:t<1/2?e:t<2/3?n+(e-n)*6*(2/3-t):n}class Ke{constructor(e,t,s){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(e,t,s)}set(e,t,s){if(t===void 0&&s===void 0){const i=e;i&&i.isColor?this.copy(i):typeof i=="number"?this.setHex(i):typeof i=="string"&&this.setStyle(i)}else this.setRGB(e,t,s);return this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,t=sn){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,xt.colorSpaceToWorking(this,t),this}setRGB(e,t,s,i=xt.workingColorSpace){return this.r=e,this.g=t,this.b=s,xt.colorSpaceToWorking(this,i),this}setHSL(e,t,s,i=xt.workingColorSpace){if(e=Sz(e,1),t=St(t,0,1),s=St(s,0,1),t===0)this.r=this.g=this.b=s;else{const r=s<=.5?s*(1+t):s+t-s*t,a=2*s-r;this.r=ec(a,r,e+1/3),this.g=ec(a,r,e),this.b=ec(a,r,e-1/3)}return xt.colorSpaceToWorking(this,i),this}setStyle(e,t=sn){function s(r){r!==void 0&&parseFloat(r)<1&&st("Color: Alpha component of "+e+" will be ignored.")}let i;if(i=/^(\w+)\(([^\)]*)\)/.exec(e)){let r;const a=i[1],o=i[2];switch(a){case"rgb":case"rgba":if(r=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return s(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,t);if(r=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return s(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,t);break;case"hsl":case"hsla":if(r=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return s(r[4]),this.setHSL(parseFloat(r[1])/360,parseFloat(r[2])/100,parseFloat(r[3])/100,t);break;default:st("Color: Unknown color model "+e)}}else if(i=/^\#([A-Fa-f\d]+)$/.exec(e)){const r=i[1],a=r.length;if(a===3)return this.setRGB(parseInt(r.charAt(0),16)/15,parseInt(r.charAt(1),16)/15,parseInt(r.charAt(2),16)/15,t);if(a===6)return this.setHex(parseInt(r,16),t);st("Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,t);return this}setColorName(e,t=sn){const s=jm[e.toLowerCase()];return s!==void 0?this.setHex(s,t):st("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=Qn(e.r),this.g=Qn(e.g),this.b=Qn(e.b),this}copyLinearToSRGB(e){return this.r=Lr(e.r),this.g=Lr(e.g),this.b=Lr(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=sn){return xt.workingToColorSpace(As.copy(this),e),Math.round(St(As.r*255,0,255))*65536+Math.round(St(As.g*255,0,255))*256+Math.round(St(As.b*255,0,255))}getHexString(e=sn){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=xt.workingColorSpace){xt.workingToColorSpace(As.copy(this),t);const s=As.r,i=As.g,r=As.b,a=Math.max(s,i,r),o=Math.min(s,i,r);let l,c;const d=(o+a)/2;if(o===a)l=0,c=0;else{const u=a-o;switch(c=d<=.5?u/(a+o):u/(2-a-o),a){case s:l=(i-r)/u+(i<r?6:0);break;case i:l=(r-s)/u+2;break;case r:l=(s-i)/u+4;break}l/=6}return e.h=l,e.s=c,e.l=d,e}getRGB(e,t=xt.workingColorSpace){return xt.workingToColorSpace(As.copy(this),t),e.r=As.r,e.g=As.g,e.b=As.b,e}getStyle(e=sn){xt.workingToColorSpace(As.copy(this),e);const t=As.r,s=As.g,i=As.b;return e!==sn?`color(${e} ${t.toFixed(3)} ${s.toFixed(3)} ${i.toFixed(3)})`:`rgb(${Math.round(t*255)},${Math.round(s*255)},${Math.round(i*255)})`}offsetHSL(e,t,s){return this.getHSL(di),this.setHSL(di.h+e,di.s+t,di.l+s)}add(e){return this.r+=e.r,this.g+=e.g,this.b+=e.b,this}addColors(e,t){return this.r=e.r+t.r,this.g=e.g+t.g,this.b=e.b+t.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,t){return this.r+=(e.r-this.r)*t,this.g+=(e.g-this.g)*t,this.b+=(e.b-this.b)*t,this}lerpColors(e,t,s){return this.r=e.r+(t.r-e.r)*s,this.g=e.g+(t.g-e.g)*s,this.b=e.b+(t.b-e.b)*s,this}lerpHSL(e,t){this.getHSL(di),e.getHSL(Ka);const s=ql(di.h,Ka.h,t),i=ql(di.s,Ka.s,t),r=ql(di.l,Ka.l,t);return this.setHSL(s,i,r),this}setFromVector3(e){return this.r=e.x,this.g=e.y,this.b=e.z,this}applyMatrix3(e){const t=this.r,s=this.g,i=this.b,r=e.elements;return this.r=r[0]*t+r[3]*s+r[6]*i,this.g=r[1]*t+r[4]*s+r[7]*i,this.b=r[2]*t+r[5]*s+r[8]*i,this}equals(e){return e.r===this.r&&e.g===this.g&&e.b===this.b}fromArray(e,t=0){return this.r=e[t],this.g=e[t+1],this.b=e[t+2],this}toArray(e=[],t=0){return e[t]=this.r,e[t+1]=this.g,e[t+2]=this.b,e}fromBufferAttribute(e,t){return this.r=e.getX(t),this.g=e.getY(t),this.b=e.getZ(t),this}toJSON(){return this.getHex()}*[Symbol.iterator](){yield this.r,yield this.g,yield this.b}}const As=new Ke;Ke.NAMES=jm;class kz extends ss{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 Di,this.environmentIntensity=1,this.environmentRotation=new Di,this.overrideMaterial=null,typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(e,t){return super.copy(e,t),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 t=super.toJSON(e);return this.fog!==null&&(t.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(t.object.backgroundBlurriness=this.backgroundBlurriness),this.backgroundIntensity!==1&&(t.object.backgroundIntensity=this.backgroundIntensity),t.object.backgroundRotation=this.backgroundRotation.toArray(),this.environmentIntensity!==1&&(t.object.environmentIntensity=this.environmentIntensity),t.object.environmentRotation=this.environmentRotation.toArray(),t}}const un=new U,Nn=new U,tc=new U,Cn=new U,mr=new U,gr=new U,Dh=new U,sc=new U,nc=new U,ic=new U,rc=new ts,ac=new ts,oc=new ts;class an{constructor(e=new U,t=new U,s=new U){this.a=e,this.b=t,this.c=s}static getNormal(e,t,s,i){i.subVectors(s,t),un.subVectors(e,t),i.cross(un);const r=i.lengthSq();return r>0?i.multiplyScalar(1/Math.sqrt(r)):i.set(0,0,0)}static getBarycoord(e,t,s,i,r){un.subVectors(i,t),Nn.subVectors(s,t),tc.subVectors(e,t);const a=un.dot(un),o=un.dot(Nn),l=un.dot(tc),c=Nn.dot(Nn),d=Nn.dot(tc),u=a*c-o*o;if(u===0)return r.set(0,0,0),null;const h=1/u,g=(c*l-o*d)*h,p=(a*d-o*l)*h;return r.set(1-g-p,p,g)}static containsPoint(e,t,s,i){return this.getBarycoord(e,t,s,i,Cn)===null?!1:Cn.x>=0&&Cn.y>=0&&Cn.x+Cn.y<=1}static getInterpolation(e,t,s,i,r,a,o,l){return this.getBarycoord(e,t,s,i,Cn)===null?(l.x=0,l.y=0,"z"in l&&(l.z=0),"w"in l&&(l.w=0),null):(l.setScalar(0),l.addScaledVector(r,Cn.x),l.addScaledVector(a,Cn.y),l.addScaledVector(o,Cn.z),l)}static getInterpolatedAttribute(e,t,s,i,r,a){return rc.setScalar(0),ac.setScalar(0),oc.setScalar(0),rc.fromBufferAttribute(e,t),ac.fromBufferAttribute(e,s),oc.fromBufferAttribute(e,i),a.setScalar(0),a.addScaledVector(rc,r.x),a.addScaledVector(ac,r.y),a.addScaledVector(oc,r.z),a}static isFrontFacing(e,t,s,i){return un.subVectors(s,t),Nn.subVectors(e,t),un.cross(Nn).dot(i)<0}set(e,t,s){return this.a.copy(e),this.b.copy(t),this.c.copy(s),this}setFromPointsAndIndices(e,t,s,i){return this.a.copy(e[t]),this.b.copy(e[s]),this.c.copy(e[i]),this}setFromAttributeAndIndices(e,t,s,i){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,s),this.c.fromBufferAttribute(e,i),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 un.subVectors(this.c,this.b),Nn.subVectors(this.a,this.b),un.cross(Nn).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return an.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return an.getBarycoord(e,this.a,this.b,this.c,t)}getInterpolation(e,t,s,i,r){return an.getInterpolation(e,this.a,this.b,this.c,t,s,i,r)}containsPoint(e){return an.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return an.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){const s=this.a,i=this.b,r=this.c;let a,o;mr.subVectors(i,s),gr.subVectors(r,s),sc.subVectors(e,s);const l=mr.dot(sc),c=gr.dot(sc);if(l<=0&&c<=0)return t.copy(s);nc.subVectors(e,i);const d=mr.dot(nc),u=gr.dot(nc);if(d>=0&&u<=d)return t.copy(i);const h=l*u-d*c;if(h<=0&&l>=0&&d<=0)return a=l/(l-d),t.copy(s).addScaledVector(mr,a);ic.subVectors(e,r);const g=mr.dot(ic),p=gr.dot(ic);if(p>=0&&g<=p)return t.copy(r);const z=g*c-l*p;if(z<=0&&c>=0&&p<=0)return o=c/(c-p),t.copy(s).addScaledVector(gr,o);const m=d*p-g*u;if(m<=0&&u-d>=0&&g-p>=0)return Dh.subVectors(r,i),o=(u-d)/(u-d+(g-p)),t.copy(i).addScaledVector(Dh,o);const f=1/(m+z+h);return a=z*f,o=h*f,t.copy(s).addScaledVector(mr,a).addScaledVector(gr,o)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}class ar{constructor(e=new U(1/0,1/0,1/0),t=new U(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromArray(e){this.makeEmpty();for(let t=0,s=e.length;t<s;t+=3)this.expandByPoint(hn.fromArray(e,t));return this}setFromBufferAttribute(e){this.makeEmpty();for(let t=0,s=e.count;t<s;t++)this.expandByPoint(hn.fromBufferAttribute(e,t));return this}setFromPoints(e){this.makeEmpty();for(let t=0,s=e.length;t<s;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){const s=hn.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(s),this.max.copy(e).add(s),this}setFromObject(e,t=!1){return this.makeEmpty(),this.expandByObject(e,t)}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,t=!1){e.updateWorldMatrix(!1,!1);const s=e.geometry;if(s!==void 0){const r=s.getAttribute("position");if(t===!0&&r!==void 0&&e.isInstancedMesh!==!0)for(let a=0,o=r.count;a<o;a++)e.isMesh===!0?e.getVertexPosition(a,hn):hn.fromBufferAttribute(r,a),hn.applyMatrix4(e.matrixWorld),this.expandByPoint(hn);else e.boundingBox!==void 0?(e.boundingBox===null&&e.computeBoundingBox(),Za.copy(e.boundingBox)):(s.boundingBox===null&&s.computeBoundingBox(),Za.copy(s.boundingBox)),Za.applyMatrix4(e.matrixWorld),this.union(Za)}const i=e.children;for(let r=0,a=i.length;r<a;r++)this.expandByObject(i[r],t);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,t){return t.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,hn),hn.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let t,s;return e.normal.x>0?(t=e.normal.x*this.min.x,s=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,s=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,s+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,s+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,s+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,s+=e.normal.z*this.min.z),t<=-e.constant&&s>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(da),Qa.subVectors(this.max,da),Mr.subVectors(e.a,da),br.subVectors(e.b,da),zr.subVectors(e.c,da),ui.subVectors(br,Mr),hi.subVectors(zr,br),Ti.subVectors(Mr,zr);let t=[0,-ui.z,ui.y,0,-hi.z,hi.y,0,-Ti.z,Ti.y,ui.z,0,-ui.x,hi.z,0,-hi.x,Ti.z,0,-Ti.x,-ui.y,ui.x,0,-hi.y,hi.x,0,-Ti.y,Ti.x,0];return!lc(t,Mr,br,zr,Qa)||(t=[1,0,0,0,1,0,0,0,1],!lc(t,Mr,br,zr,Qa))?!1:(Ja.crossVectors(ui,hi),t=[Ja.x,Ja.y,Ja.z],lc(t,Mr,br,zr,Qa))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,hn).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(hn).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:(Pn[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),Pn[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),Pn[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),Pn[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),Pn[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),Pn[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),Pn[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),Pn[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(Pn),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 Pn=[new U,new U,new U,new U,new U,new U,new U,new U],hn=new U,Za=new ar,Mr=new U,br=new U,zr=new U,ui=new U,hi=new U,Ti=new U,da=new U,Qa=new U,Ja=new U,Gi=new U;function lc(n,e,t,s,i){for(let r=0,a=n.length-3;r<=a;r+=3){Gi.fromArray(n,r);const o=i.x*Math.abs(Gi.x)+i.y*Math.abs(Gi.y)+i.z*Math.abs(Gi.z),l=e.dot(Gi),c=t.dot(Gi),d=s.dot(Gi);if(Math.max(-Math.max(l,c,d),Math.min(l,c,d))>o)return!1}return!0}const os=new U,eo=new lt;let Uz=0;class ws extends ir{constructor(e,t,s=!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:Uz++}),this.name="",this.array=e,this.itemSize=t,this.count=e!==void 0?e.length/t:0,this.normalized=s,this.usage=Yd,this.updateRanges=[],this.gpuType=Mn,this.version=0}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}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,t,s){e*=this.itemSize,s*=t.itemSize;for(let i=0,r=this.itemSize;i<r;i++)this.array[e+i]=t.array[s+i];return this}copyArray(e){return this.array.set(e),this}applyMatrix3(e){if(this.itemSize===2)for(let t=0,s=this.count;t<s;t++)eo.fromBufferAttribute(this,t),eo.applyMatrix3(e),this.setXY(t,eo.x,eo.y);else if(this.itemSize===3)for(let t=0,s=this.count;t<s;t++)os.fromBufferAttribute(this,t),os.applyMatrix3(e),this.setXYZ(t,os.x,os.y,os.z);return this}applyMatrix4(e){for(let t=0,s=this.count;t<s;t++)os.fromBufferAttribute(this,t),os.applyMatrix4(e),this.setXYZ(t,os.x,os.y,os.z);return this}applyNormalMatrix(e){for(let t=0,s=this.count;t<s;t++)os.fromBufferAttribute(this,t),os.applyNormalMatrix(e),this.setXYZ(t,os.x,os.y,os.z);return this}transformDirection(e){for(let t=0,s=this.count;t<s;t++)os.fromBufferAttribute(this,t),os.transformDirection(e),this.setXYZ(t,os.x,os.y,os.z);return this}set(e,t=0){return this.array.set(e,t),this}getComponent(e,t){let s=this.array[e*this.itemSize+t];return this.normalized&&(s=xn(s,this.array)),s}setComponent(e,t,s){return this.normalized&&(s=Ft(s,this.array)),this.array[e*this.itemSize+t]=s,this}getX(e){let t=this.array[e*this.itemSize];return this.normalized&&(t=xn(t,this.array)),t}setX(e,t){return this.normalized&&(t=Ft(t,this.array)),this.array[e*this.itemSize]=t,this}getY(e){let t=this.array[e*this.itemSize+1];return this.normalized&&(t=xn(t,this.array)),t}setY(e,t){return this.normalized&&(t=Ft(t,this.array)),this.array[e*this.itemSize+1]=t,this}getZ(e){let t=this.array[e*this.itemSize+2];return this.normalized&&(t=xn(t,this.array)),t}setZ(e,t){return this.normalized&&(t=Ft(t,this.array)),this.array[e*this.itemSize+2]=t,this}getW(e){let t=this.array[e*this.itemSize+3];return this.normalized&&(t=xn(t,this.array)),t}setW(e,t){return this.normalized&&(t=Ft(t,this.array)),this.array[e*this.itemSize+3]=t,this}setXY(e,t,s){return e*=this.itemSize,this.normalized&&(t=Ft(t,this.array),s=Ft(s,this.array)),this.array[e+0]=t,this.array[e+1]=s,this}setXYZ(e,t,s,i){return e*=this.itemSize,this.normalized&&(t=Ft(t,this.array),s=Ft(s,this.array),i=Ft(i,this.array)),this.array[e+0]=t,this.array[e+1]=s,this.array[e+2]=i,this}setXYZW(e,t,s,i,r){return e*=this.itemSize,this.normalized&&(t=Ft(t,this.array),s=Ft(s,this.array),i=Ft(i,this.array),r=Ft(r,this.array)),this.array[e+0]=t,this.array[e+1]=s,this.array[e+2]=i,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 this.name!==""&&(e.name=this.name),this.usage!==Yd&&(e.usage=this.usage),e}dispose(){this.dispatchEvent({type:"dispose"})}}class $m extends ws{constructor(e,t,s){super(new Uint16Array(e),t,s)}}class Vm extends ws{constructor(e,t,s){super(new Uint32Array(e),t,s)}}class Xt extends ws{constructor(e,t,s){super(new Float32Array(e),t,s)}}const Fz=new ar,ua=new U,cc=new U;class or{constructor(e=new U,t=-1){this.isSphere=!0,this.center=e,this.radius=t}set(e,t){return this.center.copy(e),this.radius=t,this}setFromPoints(e,t){const s=this.center;t!==void 0?s.copy(t):Fz.setFromPoints(e).getCenter(s);let i=0;for(let r=0,a=e.length;r<a;r++)i=Math.max(i,s.distanceToSquared(e[r]));return this.radius=Math.sqrt(i),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 t=this.radius+e.radius;return e.center.distanceToSquared(this.center)<=t*t}intersectsBox(e){return e.intersectsSphere(this)}intersectsPlane(e){return Math.abs(e.distanceToPoint(this.center))<=this.radius}clampPoint(e,t){const s=this.center.distanceToSquared(e);return t.copy(e),s>this.radius*this.radius&&(t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center)),t}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;ua.subVectors(e,this.center);const t=ua.lengthSq();if(t>this.radius*this.radius){const s=Math.sqrt(t),i=(s-this.radius)*.5;this.center.addScaledVector(ua,i/s),this.radius+=i}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):(cc.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(ua.copy(e.center).add(cc)),this.expandByPoint(ua.copy(e.center).sub(cc))),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 jz=0;const en=new Gt,dc=new ss,_r=new U,qs=new ar,ha=new ar,bs=new U;class ds extends ir{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:jz++}),this.uuid=yi(),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(yz(e)?Vm:$m)(e,1):this.index=e,this}setIndirect(e,t=0){return this.indirect=e,this.indirectOffset=t,this}getIndirect(){return this.indirect}getAttribute(e){return this.attributes[e]}setAttribute(e,t){return this.attributes[e]=t,this}deleteAttribute(e){return delete this.attributes[e],this}hasAttribute(e){return this.attributes[e]!==void 0}addGroup(e,t,s=0){this.groups.push({start:e,count:t,materialIndex:s})}clearGroups(){this.groups=[]}setDrawRange(e,t){this.drawRange.start=e,this.drawRange.count=t}applyMatrix4(e){const t=this.attributes.position;t!==void 0&&(t.applyMatrix4(e),t.needsUpdate=!0);const s=this.attributes.normal;if(s!==void 0){const r=new ut().getNormalMatrix(e);s.applyNormalMatrix(r),s.needsUpdate=!0}const i=this.attributes.tangent;return i!==void 0&&(i.transformDirection(e),i.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this._transformed=!0,this}applyQuaternion(e){return en.makeRotationFromQuaternion(e),this.applyMatrix4(en),this}rotateX(e){return en.makeRotationX(e),this.applyMatrix4(en),this}rotateY(e){return en.makeRotationY(e),this.applyMatrix4(en),this}rotateZ(e){return en.makeRotationZ(e),this.applyMatrix4(en),this}translate(e,t,s){return en.makeTranslation(e,t,s),this.applyMatrix4(en),this}scale(e,t,s){return en.makeScale(e,t,s),this.applyMatrix4(en),this}lookAt(e){return dc.lookAt(e),dc.updateMatrix(),this.applyMatrix4(dc.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(_r).negate(),this.translate(_r.x,_r.y,_r.z),this}setFromPoints(e){const t=this.getAttribute("position");if(t===void 0){const s=[];for(let i=0,r=e.length;i<r;i++){const a=e[i];s.push(a.x,a.y,a.z||0)}this.setAttribute("position",new Xt(s,3))}else{const s=Math.min(e.length,t.count);for(let i=0;i<s;i++){const r=e[i];t.setXYZ(i,r.x,r.y,r.z||0)}e.length>t.count&&st("BufferGeometry: Buffer size too small for points data. Use .dispose() and create a new geometry."),t.needsUpdate=!0}return this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new ar);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){Ot("BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),this.boundingBox.set(new U(-1/0,-1/0,-1/0),new U(1/0,1/0,1/0));return}if(e!==void 0){if(this.boundingBox.setFromBufferAttribute(e),t)for(let s=0,i=t.length;s<i;s++){const r=t[s];qs.setFromBufferAttribute(r),this.morphTargetsRelative?(bs.addVectors(this.boundingBox.min,qs.min),this.boundingBox.expandByPoint(bs),bs.addVectors(this.boundingBox.max,qs.max),this.boundingBox.expandByPoint(bs)):(this.boundingBox.expandByPoint(qs.min),this.boundingBox.expandByPoint(qs.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&Ot('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 or);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){Ot("BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere.",this),this.boundingSphere.set(new U,1/0);return}if(e){const s=this.boundingSphere.center;if(qs.setFromBufferAttribute(e),t)for(let r=0,a=t.length;r<a;r++){const o=t[r];ha.setFromBufferAttribute(o),this.morphTargetsRelative?(bs.addVectors(qs.min,ha.min),qs.expandByPoint(bs),bs.addVectors(qs.max,ha.max),qs.expandByPoint(bs)):(qs.expandByPoint(ha.min),qs.expandByPoint(ha.max))}qs.getCenter(s);let i=0;for(let r=0,a=e.count;r<a;r++)bs.fromBufferAttribute(e,r),i=Math.max(i,s.distanceToSquared(bs));if(t)for(let r=0,a=t.length;r<a;r++){const o=t[r],l=this.morphTargetsRelative;for(let c=0,d=o.count;c<d;c++)bs.fromBufferAttribute(o,c),l&&(_r.fromBufferAttribute(e,c),bs.add(_r)),i=Math.max(i,s.distanceToSquared(bs))}this.boundingSphere.radius=Math.sqrt(i),isNaN(this.boundingSphere.radius)&&Ot('BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}computeTangents(){const e=this.index,t=this.attributes;if(e===null||t.position===void 0||t.normal===void 0||t.uv===void 0){Ot("BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");return}const s=t.position,i=t.normal,r=t.uv;let a=this.getAttribute("tangent");(a===void 0||a.count!==s.count)&&(a=new ws(new Float32Array(4*s.count),4),this.setAttribute("tangent",a));const o=[],l=[];for(let b=0;b<s.count;b++)o[b]=new U,l[b]=new U;const c=new U,d=new U,u=new U,h=new lt,g=new lt,p=new lt,z=new U,m=new U;function f(b,A,B){c.fromBufferAttribute(s,b),d.fromBufferAttribute(s,A),u.fromBufferAttribute(s,B),h.fromBufferAttribute(r,b),g.fromBufferAttribute(r,A),p.fromBufferAttribute(r,B),d.sub(c),u.sub(c),g.sub(h),p.sub(h);const N=1/(g.x*p.y-p.x*g.y);isFinite(N)&&(z.copy(d).multiplyScalar(p.y).addScaledVector(u,-g.y).multiplyScalar(N),m.copy(u).multiplyScalar(g.x).addScaledVector(d,-p.x).multiplyScalar(N),o[b].add(z),o[A].add(z),o[B].add(z),l[b].add(m),l[A].add(m),l[B].add(m))}let _=this.groups;_.length===0&&(_=[{start:0,count:e.count}]);for(let b=0,A=_.length;b<A;++b){const B=_[b],N=B.start,k=B.count;for(let L=N,F=N+k;L<F;L+=3)f(e.getX(L+0),e.getX(L+1),e.getX(L+2))}const O=new U,w=new U,x=new U,S=new U;function I(b){x.fromBufferAttribute(i,b),S.copy(x);const A=o[b];O.copy(A),O.sub(x.multiplyScalar(x.dot(A))).normalize(),w.crossVectors(S,A);const N=w.dot(l[b])<0?-1:1;a.setXYZW(b,O.x,O.y,O.z,N)}for(let b=0,A=_.length;b<A;++b){const B=_[b],N=B.start,k=B.count;for(let L=N,F=N+k;L<F;L+=3)I(e.getX(L+0)),I(e.getX(L+1)),I(e.getX(L+2))}this._transformed=!0}computeVertexNormals(){const e=this.index,t=this.getAttribute("position");if(t!==void 0){let s=this.getAttribute("normal");if(s===void 0||s.count!==t.count)s=new ws(new Float32Array(t.count*3),3),this.setAttribute("normal",s);else for(let h=0,g=s.count;h<g;h++)s.setXYZ(h,0,0,0);const i=new U,r=new U,a=new U,o=new U,l=new U,c=new U,d=new U,u=new U;if(e)for(let h=0,g=e.count;h<g;h+=3){const p=e.getX(h+0),z=e.getX(h+1),m=e.getX(h+2);i.fromBufferAttribute(t,p),r.fromBufferAttribute(t,z),a.fromBufferAttribute(t,m),d.subVectors(a,r),u.subVectors(i,r),d.cross(u),o.fromBufferAttribute(s,p),l.fromBufferAttribute(s,z),c.fromBufferAttribute(s,m),o.add(d),l.add(d),c.add(d),s.setXYZ(p,o.x,o.y,o.z),s.setXYZ(z,l.x,l.y,l.z),s.setXYZ(m,c.x,c.y,c.z)}else for(let h=0,g=t.count;h<g;h+=3)i.fromBufferAttribute(t,h+0),r.fromBufferAttribute(t,h+1),a.fromBufferAttribute(t,h+2),d.subVectors(a,r),u.subVectors(i,r),d.cross(u),s.setXYZ(h+0,d.x,d.y,d.z),s.setXYZ(h+1,d.x,d.y,d.z),s.setXYZ(h+2,d.x,d.y,d.z);this.normalizeNormals(),s.needsUpdate=!0}}normalizeNormals(){const e=this.attributes.normal;for(let t=0,s=e.count;t<s;t++)bs.fromBufferAttribute(e,t),bs.normalize(),e.setXYZ(t,bs.x,bs.y,bs.z)}toNonIndexed(){function e(o,l){const c=o.array,d=o.itemSize,u=o.normalized,h=new c.constructor(l.length*d);let g=0,p=0;for(let z=0,m=l.length;z<m;z++){o.isInterleavedBufferAttribute?g=l[z]*o.data.stride+o.offset:g=l[z]*d;for(let f=0;f<d;f++)h[p++]=c[g++]}return new ws(h,d,u)}if(this.index===null)return st("BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;const t=new ds,s=this.index.array,i=this.attributes;for(const o in i){const l=i[o],c=e(l,s);t.setAttribute(o,c)}const r=this.morphAttributes;for(const o in r){const l=[],c=r[o];for(let d=0,u=c.length;d<u;d++){const h=c[d],g=e(h,s);l.push(g)}t.morphAttributes[o]=l}t.morphTargetsRelative=this.morphTargetsRelative;const a=this.groups;for(let o=0,l=a.length;o<l;o++){const c=a[o];t.addGroup(c.start,c.count,c.materialIndex)}return t}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,this.name!==""&&(e.name=this.name),Object.keys(this.userData).length>0&&(e.userData=this.userData),this.parameters!==void 0&&this._transformed!==!0){const l=this.parameters;for(const c in l)l[c]!==void 0&&(e[c]=l[c]);return e}e.data={attributes:{}};const t=this.index;t!==null&&(e.data.index={type:t.array.constructor.name,array:Array.prototype.slice.call(t.array)});const s=this.attributes;for(const l in s){const c=s[l];e.data.attributes[l]=c.toJSON(e.data)}const i={};let r=!1;for(const l in this.morphAttributes){const c=this.morphAttributes[l],d=[];for(let u=0,h=c.length;u<h;u++){const g=c[u];d.push(g.toJSON(e.data))}d.length>0&&(i[l]=d,r=!0)}r&&(e.data.morphAttributes=i,e.data.morphTargetsRelative=this.morphTargetsRelative);const a=this.groups;a.length>0&&(e.data.groups=JSON.parse(JSON.stringify(a)));const o=this.boundingSphere;return o!==null&&(e.data.boundingSphere=o.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 t={};this.name=e.name;const s=e.index;s!==null&&this.setIndex(s.clone());const i=e.attributes;for(const c in i){const d=i[c];this.setAttribute(c,d.clone(t))}const r=e.morphAttributes;for(const c in r){const d=[],u=r[c];for(let h=0,g=u.length;h<g;h++)d.push(u[h].clone(t));this.morphAttributes[c]=d}this.morphTargetsRelative=e.morphTargetsRelative;const a=e.groups;for(let c=0,d=a.length;c<d;c++){const u=a[c];this.addGroup(u.start,u.count,u.materialIndex)}const o=e.boundingBox;o!==null&&(this.boundingBox=o.clone());const l=e.boundingSphere;return l!==null&&(this.boundingSphere=l.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"})}}class $z{constructor(e,t){this.isInterleavedBuffer=!0,this.array=e,this.stride=t,this.count=e!==void 0?e.length/t:0,this.usage=Yd,this.updateRanges=[],this.version=0,this.uuid=yi()}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.array=new e.array.constructor(e.array),this.count=e.count,this.stride=e.stride,this.usage=e.usage,this}copyAt(e,t,s){e*=this.stride,s*=t.stride;for(let i=0,r=this.stride;i<r;i++)this.array[e+i]=t.array[s+i];return this}set(e,t=0){return this.array.set(e,t),this}clone(e){e.arrayBuffers===void 0&&(e.arrayBuffers={}),this.array.buffer._uuid===void 0&&(this.array.buffer._uuid=yi()),e.arrayBuffers[this.array.buffer._uuid]===void 0&&(e.arrayBuffers[this.array.buffer._uuid]=this.array.slice(0).buffer);const t=new this.array.constructor(e.arrayBuffers[this.array.buffer._uuid]),s=new this.constructor(t,this.stride);return s.setUsage(this.usage),s}onUpload(e){return this.onUploadCallback=e,this}toJSON(e){return e.arrayBuffers===void 0&&(e.arrayBuffers={}),this.array.buffer._uuid===void 0&&(this.array.buffer._uuid=yi()),e.arrayBuffers[this.array.buffer._uuid]===void 0&&(e.arrayBuffers[this.array.buffer._uuid]=Array.from(new Uint32Array(this.array.buffer))),{uuid:this.uuid,buffer:this.array.buffer._uuid,type:this.array.constructor.name,stride:this.stride}}}const Gs=new U;class pl{constructor(e,t,s,i=!1){this.isInterleavedBufferAttribute=!0,this.name="",this.data=e,this.itemSize=t,this.offset=s,this.normalized=i}get count(){return this.data.count}get array(){return this.data.array}set needsUpdate(e){this.data.needsUpdate=e}applyMatrix4(e){for(let t=0,s=this.data.count;t<s;t++)Gs.fromBufferAttribute(this,t),Gs.applyMatrix4(e),this.setXYZ(t,Gs.x,Gs.y,Gs.z);return this}applyNormalMatrix(e){for(let t=0,s=this.count;t<s;t++)Gs.fromBufferAttribute(this,t),Gs.applyNormalMatrix(e),this.setXYZ(t,Gs.x,Gs.y,Gs.z);return this}transformDirection(e){for(let t=0,s=this.count;t<s;t++)Gs.fromBufferAttribute(this,t),Gs.transformDirection(e),this.setXYZ(t,Gs.x,Gs.y,Gs.z);return this}getComponent(e,t){let s=this.array[e*this.data.stride+this.offset+t];return this.normalized&&(s=xn(s,this.array)),s}setComponent(e,t,s){return this.normalized&&(s=Ft(s,this.array)),this.data.array[e*this.data.stride+this.offset+t]=s,this}setX(e,t){return this.normalized&&(t=Ft(t,this.array)),this.data.array[e*this.data.stride+this.offset]=t,this}setY(e,t){return this.normalized&&(t=Ft(t,this.array)),this.data.array[e*this.data.stride+this.offset+1]=t,this}setZ(e,t){return this.normalized&&(t=Ft(t,this.array)),this.data.array[e*this.data.stride+this.offset+2]=t,this}setW(e,t){return this.normalized&&(t=Ft(t,this.array)),this.data.array[e*this.data.stride+this.offset+3]=t,this}getX(e){let t=this.data.array[e*this.data.stride+this.offset];return this.normalized&&(t=xn(t,this.array)),t}getY(e){let t=this.data.array[e*this.data.stride+this.offset+1];return this.normalized&&(t=xn(t,this.array)),t}getZ(e){let t=this.data.array[e*this.data.stride+this.offset+2];return this.normalized&&(t=xn(t,this.array)),t}getW(e){let t=this.data.array[e*this.data.stride+this.offset+3];return this.normalized&&(t=xn(t,this.array)),t}setXY(e,t,s){return e=e*this.data.stride+this.offset,this.normalized&&(t=Ft(t,this.array),s=Ft(s,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=s,this}setXYZ(e,t,s,i){return e=e*this.data.stride+this.offset,this.normalized&&(t=Ft(t,this.array),s=Ft(s,this.array),i=Ft(i,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=s,this.data.array[e+2]=i,this}setXYZW(e,t,s,i,r){return e=e*this.data.stride+this.offset,this.normalized&&(t=Ft(t,this.array),s=Ft(s,this.array),i=Ft(i,this.array),r=Ft(r,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=s,this.data.array[e+2]=i,this.data.array[e+3]=r,this}clone(e){if(e===void 0){fl("InterleavedBufferAttribute.clone(): Cloning an interleaved buffer attribute will de-interleave buffer data.");const t=[];for(let s=0;s<this.count;s++){const i=s*this.data.stride+this.offset;for(let r=0;r<this.itemSize;r++)t.push(this.data.array[i+r])}return new ws(new this.array.constructor(t),this.itemSize,this.normalized)}else return e.interleavedBuffers===void 0&&(e.interleavedBuffers={}),e.interleavedBuffers[this.data.uuid]===void 0&&(e.interleavedBuffers[this.data.uuid]=this.data.clone(e)),new pl(e.interleavedBuffers[this.data.uuid],this.itemSize,this.offset,this.normalized)}toJSON(e){if(e===void 0){fl("InterleavedBufferAttribute.toJSON(): Serializing an interleaved buffer attribute will de-interleave buffer data.");const t=[];for(let s=0;s<this.count;s++){const i=s*this.data.stride+this.offset;for(let r=0;r<this.itemSize;r++)t.push(this.data.array[i+r])}return{itemSize:this.itemSize,type:this.array.constructor.name,array:t,normalized:this.normalized}}else return e.interleavedBuffers===void 0&&(e.interleavedBuffers={}),e.interleavedBuffers[this.data.uuid]===void 0&&(e.interleavedBuffers[this.data.uuid]=this.data.toJSON(e)),{isInterleavedBufferAttribute:!0,itemSize:this.itemSize,data:this.data.uuid,offset:this.offset,normalized:this.normalized}}}let Vz=0;class ni extends ir{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:Vz++}),this.uuid=yi(),this.name="",this.type="Material",this.blending=$i,this.side=Ei,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=od,this.blendDst=ld,this.blendEquation=Wi,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new Ke(0,0,0),this.blendAlpha=0,this.depthFunc=$r,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=gh,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=dr,this.stencilZFail=dr,this.stencilZPass=dr,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 t in e){const s=e[t];if(s===void 0){st(`Material: parameter '${t}' has value of undefined.`);continue}const i=this[t];if(i===void 0){st(`Material: '${t}' is not a property of THREE.${this.type}.`);continue}i&&i.isColor?i.set(s):i&&i.isVector2&&s&&s.isVector2||i&&i.isEuler&&s&&s.isEuler||i&&i.isVector3&&s&&s.isVector3?i.copy(s):this[t]=s}}toJSON(e){const t=e===void 0||typeof e=="string";t&&(e={textures:{},images:{}});const s={metadata:{version:4.7,type:"Material",generator:"Material.toJSON"}};s.uuid=this.uuid,s.type=this.type,this.name!==""&&(s.name=this.name),this.color&&this.color.isColor&&(s.color=this.color.getHex()),this.roughness!==void 0&&(s.roughness=this.roughness),this.metalness!==void 0&&(s.metalness=this.metalness),this.sheen!==void 0&&(s.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(s.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(s.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(s.emissive=this.emissive.getHex()),this.emissiveIntensity!==void 0&&this.emissiveIntensity!==1&&(s.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(s.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(s.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(s.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(s.shininess=this.shininess),this.clearcoat!==void 0&&(s.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(s.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(s.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(s.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(s.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,s.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.sheenColorMap&&this.sheenColorMap.isTexture&&(s.sheenColorMap=this.sheenColorMap.toJSON(e).uuid),this.sheenRoughnessMap&&this.sheenRoughnessMap.isTexture&&(s.sheenRoughnessMap=this.sheenRoughnessMap.toJSON(e).uuid),this.dispersion!==void 0&&(s.dispersion=this.dispersion),this.iridescence!==void 0&&(s.iridescence=this.iridescence),this.iridescenceIOR!==void 0&&(s.iridescenceIOR=this.iridescenceIOR),this.iridescenceThicknessRange!==void 0&&(s.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(s.iridescenceMap=this.iridescenceMap.toJSON(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(s.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid),this.anisotropy!==void 0&&(s.anisotropy=this.anisotropy),this.anisotropyRotation!==void 0&&(s.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(s.anisotropyMap=this.anisotropyMap.toJSON(e).uuid),this.map&&this.map.isTexture&&(s.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(s.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(s.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(s.lightMap=this.lightMap.toJSON(e).uuid,s.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(s.aoMap=this.aoMap.toJSON(e).uuid,s.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(s.bumpMap=this.bumpMap.toJSON(e).uuid,s.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(s.normalMap=this.normalMap.toJSON(e).uuid,s.normalMapType=this.normalMapType,s.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(s.displacementMap=this.displacementMap.toJSON(e).uuid,s.displacementScale=this.displacementScale,s.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(s.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(s.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(s.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(s.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(s.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(s.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(s.envMap=this.envMap.toJSON(e).uuid,this.combine!==void 0&&(s.combine=this.combine)),this.envMapRotation!==void 0&&(s.envMapRotation=this.envMapRotation.toArray()),this.envMapIntensity!==void 0&&(s.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(s.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(s.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(s.gradientMap=this.gradientMap.toJSON(e).uuid),this.transmission!==void 0&&(s.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(s.transmissionMap=this.transmissionMap.toJSON(e).uuid),this.thickness!==void 0&&(s.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(s.thicknessMap=this.thicknessMap.toJSON(e).uuid),this.attenuationDistance!==void 0&&this.attenuationDistance!==1/0&&(s.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(s.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(s.size=this.size),this.shadowSide!==null&&(s.shadowSide=this.shadowSide),this.sizeAttenuation!==void 0&&(s.sizeAttenuation=this.sizeAttenuation),this.blending!==$i&&(s.blending=this.blending),this.side!==Ei&&(s.side=this.side),this.vertexColors===!0&&(s.vertexColors=!0),this.opacity<1&&(s.opacity=this.opacity),this.transparent===!0&&(s.transparent=!0),this.blendSrc!==od&&(s.blendSrc=this.blendSrc),this.blendDst!==ld&&(s.blendDst=this.blendDst),this.blendEquation!==Wi&&(s.blendEquation=this.blendEquation),this.blendSrcAlpha!==null&&(s.blendSrcAlpha=this.blendSrcAlpha),this.blendDstAlpha!==null&&(s.blendDstAlpha=this.blendDstAlpha),this.blendEquationAlpha!==null&&(s.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&&this.blendColor.isColor&&(s.blendColor=this.blendColor.getHex()),this.blendAlpha!==0&&(s.blendAlpha=this.blendAlpha),this.depthFunc!==$r&&(s.depthFunc=this.depthFunc),this.depthTest===!1&&(s.depthTest=this.depthTest),this.depthWrite===!1&&(s.depthWrite=this.depthWrite),this.colorWrite===!1&&(s.colorWrite=this.colorWrite),this.stencilWriteMask!==255&&(s.stencilWriteMask=this.stencilWriteMask),this.stencilFunc!==gh&&(s.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(s.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(s.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==dr&&(s.stencilFail=this.stencilFail),this.stencilZFail!==dr&&(s.stencilZFail=this.stencilZFail),this.stencilZPass!==dr&&(s.stencilZPass=this.stencilZPass),this.stencilWrite===!0&&(s.stencilWrite=this.stencilWrite),this.rotation!==void 0&&this.rotation!==0&&(s.rotation=this.rotation),this.polygonOffset===!0&&(s.polygonOffset=!0),this.polygonOffsetFactor!==0&&(s.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(s.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth!==void 0&&this.linewidth!==1&&(s.linewidth=this.linewidth),this.dashSize!==void 0&&(s.dashSize=this.dashSize),this.gapSize!==void 0&&(s.gapSize=this.gapSize),this.scale!==void 0&&(s.scale=this.scale),this.dithering===!0&&(s.dithering=!0),this.alphaTest>0&&(s.alphaTest=this.alphaTest),this.alphaHash===!0&&(s.alphaHash=!0),this.alphaToCoverage===!0&&(s.alphaToCoverage=!0),this.premultipliedAlpha===!0&&(s.premultipliedAlpha=!0),this.forceSinglePass===!0&&(s.forceSinglePass=!0),this.allowOverride===!1&&(s.allowOverride=!1),this.wireframe===!0&&(s.wireframe=!0),this.wireframeLinewidth>1&&(s.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!=="round"&&(s.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!=="round"&&(s.wireframeLinejoin=this.wireframeLinejoin),this.flatShading===!0&&(s.flatShading=!0),this.visible===!1&&(s.visible=!1),this.toneMapped===!1&&(s.toneMapped=!1),this.fog===!1&&(s.fog=!1),Object.keys(this.userData).length>0&&(s.userData=this.userData);function i(r){const a=[];for(const o in r){const l=r[o];delete l.metadata,a.push(l)}return a}if(t){const r=i(e.textures),a=i(e.images);r.length>0&&(s.textures=r),a.length>0&&(s.images=a)}return s}fromJSON(e,t){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 Ke().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.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.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.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=t[e.map]||null),e.matcap!==void 0&&(this.matcap=t[e.matcap]||null),e.alphaMap!==void 0&&(this.alphaMap=t[e.alphaMap]||null),e.bumpMap!==void 0&&(this.bumpMap=t[e.bumpMap]||null),e.bumpScale!==void 0&&(this.bumpScale=e.bumpScale),e.normalMap!==void 0&&(this.normalMap=t[e.normalMap]||null),e.normalMapType!==void 0&&(this.normalMapType=e.normalMapType),e.normalScale!==void 0){let s=e.normalScale;Array.isArray(s)===!1&&(s=[s,s]),this.normalScale=new lt().fromArray(s)}return e.displacementMap!==void 0&&(this.displacementMap=t[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=t[e.roughnessMap]||null),e.metalnessMap!==void 0&&(this.metalnessMap=t[e.metalnessMap]||null),e.emissiveMap!==void 0&&(this.emissiveMap=t[e.emissiveMap]||null),e.emissiveIntensity!==void 0&&(this.emissiveIntensity=e.emissiveIntensity),e.specularMap!==void 0&&(this.specularMap=t[e.specularMap]||null),e.specularIntensityMap!==void 0&&(this.specularIntensityMap=t[e.specularIntensityMap]||null),e.specularColorMap!==void 0&&(this.specularColorMap=t[e.specularColorMap]||null),e.envMap!==void 0&&(this.envMap=t[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=t[e.lightMap]||null),e.lightMapIntensity!==void 0&&(this.lightMapIntensity=e.lightMapIntensity),e.aoMap!==void 0&&(this.aoMap=t[e.aoMap]||null),e.aoMapIntensity!==void 0&&(this.aoMapIntensity=e.aoMapIntensity),e.gradientMap!==void 0&&(this.gradientMap=t[e.gradientMap]||null),e.clearcoatMap!==void 0&&(this.clearcoatMap=t[e.clearcoatMap]||null),e.clearcoatRoughnessMap!==void 0&&(this.clearcoatRoughnessMap=t[e.clearcoatRoughnessMap]||null),e.clearcoatNormalMap!==void 0&&(this.clearcoatNormalMap=t[e.clearcoatNormalMap]||null),e.clearcoatNormalScale!==void 0&&(this.clearcoatNormalScale=new lt().fromArray(e.clearcoatNormalScale)),e.iridescenceMap!==void 0&&(this.iridescenceMap=t[e.iridescenceMap]||null),e.iridescenceThicknessMap!==void 0&&(this.iridescenceThicknessMap=t[e.iridescenceThicknessMap]||null),e.transmissionMap!==void 0&&(this.transmissionMap=t[e.transmissionMap]||null),e.thicknessMap!==void 0&&(this.thicknessMap=t[e.thicknessMap]||null),e.anisotropyMap!==void 0&&(this.anisotropyMap=t[e.anisotropyMap]||null),e.sheenColorMap!==void 0&&(this.sheenColorMap=t[e.sheenColorMap]||null),e.sheenRoughnessMap!==void 0&&(this.sheenRoughnessMap=t[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 t=e.clippingPlanes;let s=null;if(t!==null){const i=t.length;s=new Array(i);for(let r=0;r!==i;++r)s[r]=t[r].clone()}return this.clippingPlanes=s,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++}}class xl extends ni{constructor(e){super(),this.isSpriteMaterial=!0,this.type="SpriteMaterial",this.color=new Ke(16777215),this.map=null,this.alphaMap=null,this.rotation=0,this.sizeAttenuation=!0,this.transparent=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.rotation=e.rotation,this.sizeAttenuation=e.sizeAttenuation,this.fog=e.fog,this}}let wr;const fa=new U,yr=new U,vr=new U,Or=new lt,pa=new lt,Hm=new Gt,to=new U,ma=new U,so=new U,Ih=new lt,uc=new lt,Th=new lt;class xu extends ss{constructor(e=new xl){if(super(),this.isSprite=!0,this.type="Sprite",wr===void 0){wr=new ds;const t=new Float32Array([-.5,-.5,0,0,0,.5,-.5,0,1,0,.5,.5,0,1,1,-.5,.5,0,0,1]),s=new $z(t,5);wr.setIndex([0,1,2,0,2,3]),wr.setAttribute("position",new pl(s,3,0,!1)),wr.setAttribute("uv",new pl(s,2,3,!1))}this.geometry=wr,this.material=e,this.center=new lt(.5,.5),this.count=1}raycast(e,t){e.camera===null&&Ot('Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.'),yr.setFromMatrixScale(this.matrixWorld),Hm.copy(e.camera.matrixWorld),this.modelViewMatrix.multiplyMatrices(e.camera.matrixWorldInverse,this.matrixWorld),vr.setFromMatrixPosition(this.modelViewMatrix),e.camera.isPerspectiveCamera&&this.material.sizeAttenuation===!1&&yr.multiplyScalar(-vr.z);const s=this.material.rotation;let i,r;s!==0&&(r=Math.cos(s),i=Math.sin(s));const a=this.center;no(to.set(-.5,-.5,0),vr,a,yr,i,r),no(ma.set(.5,-.5,0),vr,a,yr,i,r),no(so.set(.5,.5,0),vr,a,yr,i,r),Ih.set(0,0),uc.set(1,0),Th.set(1,1);let o=e.ray.intersectTriangle(to,ma,so,!1,fa);if(o===null&&(no(ma.set(-.5,.5,0),vr,a,yr,i,r),uc.set(0,1),o=e.ray.intersectTriangle(to,so,ma,!1,fa),o===null))return;const l=e.ray.origin.distanceTo(fa);l<e.near||l>e.far||t.push({distance:l,point:fa.clone(),uv:an.getInterpolation(fa,to,ma,so,Ih,uc,Th,new lt),face:null,object:this})}copy(e,t){return super.copy(e,t),e.center!==void 0&&this.center.copy(e.center),this.material=e.material,this}}function no(n,e,t,s,i,r){Or.subVectors(n,t).addScalar(.5).multiply(s),i!==void 0?(pa.x=r*Or.x-i*Or.y,pa.y=i*Or.x+r*Or.y):pa.copy(Or),n.copy(e),n.x+=pa.x,n.y+=pa.y,n.applyMatrix4(Hm)}const Ln=new U,hc=new U,io=new U,fi=new U,fc=new U,ro=new U,pc=new U;class Sl{constructor(e=new U,t=new U(0,0,-1)){this.origin=e,this.direction=t}set(e,t){return this.origin.copy(e),this.direction.copy(t),this}copy(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this}at(e,t){return t.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,Ln)),this}closestPointToPoint(e,t){t.subVectors(e,this.origin);const s=t.dot(this.direction);return s<0?t.copy(this.origin):t.copy(this.origin).addScaledVector(this.direction,s)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){const t=Ln.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(Ln.copy(this.origin).addScaledVector(this.direction,t),Ln.distanceToSquared(e))}distanceSqToSegment(e,t,s,i){hc.copy(e).add(t).multiplyScalar(.5),io.copy(t).sub(e).normalize(),fi.copy(this.origin).sub(hc);const r=e.distanceTo(t)*.5,a=-this.direction.dot(io),o=fi.dot(this.direction),l=-fi.dot(io),c=fi.lengthSq(),d=Math.abs(1-a*a);let u,h,g,p;if(d>0)if(u=a*l-o,h=a*o-l,p=r*d,u>=0)if(h>=-p)if(h<=p){const z=1/d;u*=z,h*=z,g=u*(u+a*h+2*o)+h*(a*u+h+2*l)+c}else h=r,u=Math.max(0,-(a*h+o)),g=-u*u+h*(h+2*l)+c;else h=-r,u=Math.max(0,-(a*h+o)),g=-u*u+h*(h+2*l)+c;else h<=-p?(u=Math.max(0,-(-a*r+o)),h=u>0?-r:Math.min(Math.max(-r,-l),r),g=-u*u+h*(h+2*l)+c):h<=p?(u=0,h=Math.min(Math.max(-r,-l),r),g=h*(h+2*l)+c):(u=Math.max(0,-(a*r+o)),h=u>0?r:Math.min(Math.max(-r,-l),r),g=-u*u+h*(h+2*l)+c);else h=a>0?-r:r,u=Math.max(0,-(a*h+o)),g=-u*u+h*(h+2*l)+c;return s&&s.copy(this.origin).addScaledVector(this.direction,u),i&&i.copy(hc).addScaledVector(io,h),g}intersectSphere(e,t){Ln.subVectors(e.center,this.origin);const s=Ln.dot(this.direction),i=Ln.dot(Ln)-s*s,r=e.radius*e.radius;if(i>r)return null;const a=Math.sqrt(r-i),o=s-a,l=s+a;return l<0?null:o<0?this.at(l,t):this.at(o,t)}intersectsSphere(e){return e.radius<0?!1:this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){const t=e.normal.dot(this.direction);if(t===0)return e.distanceToPoint(this.origin)===0?0:null;const s=-(this.origin.dot(e.normal)+e.constant)/t;return s>=0?s:null}intersectPlane(e,t){const s=this.distanceToPlane(e);return s===null?null:this.at(s,t)}intersectsPlane(e){const t=e.distanceToPoint(this.origin);return t===0||e.normal.dot(this.direction)*t<0}intersectBox(e,t){let s,i,r,a,o,l;const c=1/this.direction.x,d=1/this.direction.y,u=1/this.direction.z,h=this.origin;return c>=0?(s=(e.min.x-h.x)*c,i=(e.max.x-h.x)*c):(s=(e.max.x-h.x)*c,i=(e.min.x-h.x)*c),d>=0?(r=(e.min.y-h.y)*d,a=(e.max.y-h.y)*d):(r=(e.max.y-h.y)*d,a=(e.min.y-h.y)*d),s>a||r>i||((r>s||isNaN(s))&&(s=r),(a<i||isNaN(i))&&(i=a),u>=0?(o=(e.min.z-h.z)*u,l=(e.max.z-h.z)*u):(o=(e.max.z-h.z)*u,l=(e.min.z-h.z)*u),s>l||o>i)||((o>s||s!==s)&&(s=o),(l<i||i!==i)&&(i=l),i<0)?null:this.at(s>=0?s:i,t)}intersectsBox(e){return this.intersectBox(e,Ln)!==null}intersectTriangle(e,t,s,i,r){fc.subVectors(t,e),ro.subVectors(s,e),pc.crossVectors(fc,ro);let a=this.direction.dot(pc),o;if(a>0){if(i)return null;o=1}else if(a<0)o=-1,a=-a;else return null;fi.subVectors(this.origin,e);const l=o*this.direction.dot(ro.crossVectors(fi,ro));if(l<0)return null;const c=o*this.direction.dot(fc.cross(fi));if(c<0||l+c>a)return null;const d=-o*fi.dot(pc);return d<0?null:this.at(d/a,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 Su extends ni{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new Ke(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 Di,this.combine=Sm,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 Gh=new Gt,Ri=new Sl,ao=new or,Rh=new U,oo=new U,lo=new U,co=new U,mc=new U,uo=new U,Bh=new U,ho=new U;class Us extends ss{constructor(e=new ds,t=new Su){super(),this.isMesh=!0,this.type="Mesh",this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.count=1,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),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 t=this.geometry.morphAttributes,s=Object.keys(t);if(s.length>0){const i=t[s[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let r=0,a=i.length;r<a;r++){const o=i[r].name||String(r);this.morphTargetInfluences.push(0),this.morphTargetDictionary[o]=r}}}}getVertexPosition(e,t){const s=this.geometry,i=s.attributes.position,r=s.morphAttributes.position,a=s.morphTargetsRelative;t.fromBufferAttribute(i,e);const o=this.morphTargetInfluences;if(r&&o){uo.set(0,0,0);for(let l=0,c=r.length;l<c;l++){const d=o[l],u=r[l];d!==0&&(mc.fromBufferAttribute(u,e),a?uo.addScaledVector(mc,d):uo.addScaledVector(mc.sub(t),d))}t.add(uo)}return t}raycast(e,t){const s=this.geometry,i=this.material,r=this.matrixWorld;i!==void 0&&(s.boundingSphere===null&&s.computeBoundingSphere(),ao.copy(s.boundingSphere),ao.applyMatrix4(r),Ri.copy(e.ray).recast(e.near),!(ao.containsPoint(Ri.origin)===!1&&(Ri.intersectSphere(ao,Rh)===null||Ri.origin.distanceToSquared(Rh)>(e.far-e.near)**2))&&(Gh.copy(r).invert(),Ri.copy(e.ray).applyMatrix4(Gh),!(s.boundingBox!==null&&Ri.intersectsBox(s.boundingBox)===!1)&&this._computeIntersections(e,t,Ri)))}_computeIntersections(e,t,s){let i;const r=this.geometry,a=this.material,o=r.index,l=r.attributes.position,c=r.attributes.uv,d=r.attributes.uv1,u=r.attributes.normal,h=r.groups,g=r.drawRange;if(o!==null)if(Array.isArray(a))for(let p=0,z=h.length;p<z;p++){const m=h[p],f=a[m.materialIndex],_=Math.max(m.start,g.start),O=Math.min(o.count,Math.min(m.start+m.count,g.start+g.count));for(let w=_,x=O;w<x;w+=3){const S=o.getX(w),I=o.getX(w+1),b=o.getX(w+2);i=fo(this,f,e,s,c,d,u,S,I,b),i&&(i.faceIndex=Math.floor(w/3),i.face.materialIndex=m.materialIndex,t.push(i))}}else{const p=Math.max(0,g.start),z=Math.min(o.count,g.start+g.count);for(let m=p,f=z;m<f;m+=3){const _=o.getX(m),O=o.getX(m+1),w=o.getX(m+2);i=fo(this,a,e,s,c,d,u,_,O,w),i&&(i.faceIndex=Math.floor(m/3),t.push(i))}}else if(l!==void 0)if(Array.isArray(a))for(let p=0,z=h.length;p<z;p++){const m=h[p],f=a[m.materialIndex],_=Math.max(m.start,g.start),O=Math.min(l.count,Math.min(m.start+m.count,g.start+g.count));for(let w=_,x=O;w<x;w+=3){const S=w,I=w+1,b=w+2;i=fo(this,f,e,s,c,d,u,S,I,b),i&&(i.faceIndex=Math.floor(w/3),i.face.materialIndex=m.materialIndex,t.push(i))}}else{const p=Math.max(0,g.start),z=Math.min(l.count,g.start+g.count);for(let m=p,f=z;m<f;m+=3){const _=m,O=m+1,w=m+2;i=fo(this,a,e,s,c,d,u,_,O,w),i&&(i.faceIndex=Math.floor(m/3),t.push(i))}}}}function Hz(n,e,t,s,i,r,a,o){let l;if(e.side===ks?l=s.intersectTriangle(a,r,i,!0,o):l=s.intersectTriangle(i,r,a,e.side===Ei,o),l===null)return null;ho.copy(o),ho.applyMatrix4(n.matrixWorld);const c=t.ray.origin.distanceTo(ho);return c<t.near||c>t.far?null:{distance:c,point:ho.clone(),object:n}}function fo(n,e,t,s,i,r,a,o,l,c){n.getVertexPosition(o,oo),n.getVertexPosition(l,lo),n.getVertexPosition(c,co);const d=Hz(n,e,t,s,oo,lo,co,Bh);if(d){const u=new U;an.getBarycoord(Bh,oo,lo,co,u),i&&(d.uv=an.getInterpolatedAttribute(i,o,l,c,u,new lt)),r&&(d.uv1=an.getInterpolatedAttribute(r,o,l,c,u,new lt)),a&&(d.normal=an.getInterpolatedAttribute(a,o,l,c,u,new U),d.normal.dot(s.direction)>0&&d.normal.multiplyScalar(-1));const h={a:o,b:l,c,normal:new U,materialIndex:0};an.getNormal(oo,lo,co,h.normal),d.face=h,d.barycoord=u}return d}class qm extends Is{constructor(e=null,t=1,s=1,i,r,a,o,l,c=ys,d=ys,u,h){super(null,a,o,l,c,d,i,r,u,h),this.isDataTexture=!0,this.image={data:e,width:t,height:s},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class vi extends ws{constructor(e,t,s,i=1){super(e,t,s),this.isInstancedBufferAttribute=!0,this.meshPerAttribute=i}copy(e){return super.copy(e),this.meshPerAttribute=e.meshPerAttribute,this}toJSON(){const e=super.toJSON();return e.meshPerAttribute=this.meshPerAttribute,e.isInstancedBufferAttribute=!0,e}}const xr=new Gt,Nh=new Gt,po=[],Ch=new ar,qz=new Gt,ga=new Us,Ma=new or;class Au extends Us{constructor(e,t,s){super(e,t),this.isInstancedMesh=!0,this.instanceMatrix=new vi(new Float32Array(s*16),16),this.instanceColor=null,this.morphTexture=null,this.count=s,this.boundingBox=null,this.boundingSphere=null;for(let i=0;i<s;i++)this.setMatrixAt(i,qz)}computeBoundingBox(){const e=this.geometry,t=this.count;this.boundingBox===null&&(this.boundingBox=new ar),e.boundingBox===null&&e.computeBoundingBox(),this.boundingBox.makeEmpty();for(let s=0;s<t;s++)this.getMatrixAt(s,xr),Ch.copy(e.boundingBox).applyMatrix4(xr),this.boundingBox.union(Ch)}computeBoundingSphere(){const e=this.geometry,t=this.count;this.boundingSphere===null&&(this.boundingSphere=new or),e.boundingSphere===null&&e.computeBoundingSphere(),this.boundingSphere.makeEmpty();for(let s=0;s<t;s++)this.getMatrixAt(s,xr),Ma.copy(e.boundingSphere).applyMatrix4(xr),this.boundingSphere.union(Ma)}copy(e,t){return super.copy(e,t),this.instanceMatrix.copy(e.instanceMatrix),e.morphTexture!==null&&(this.morphTexture=e.morphTexture.clone()),e.instanceColor!==null&&(this.instanceColor=e.instanceColor.clone()),this.count=e.count,e.boundingBox!==null&&(this.boundingBox=e.boundingBox.clone()),e.boundingSphere!==null&&(this.boundingSphere=e.boundingSphere.clone()),this}getColorAt(e,t){return this.instanceColor===null?t.setRGB(1,1,1):t.fromArray(this.instanceColor.array,e*3)}getMatrixAt(e,t){return t.fromArray(this.instanceMatrix.array,e*16)}getMorphAt(e,t){const s=t.morphTargetInfluences,i=this.morphTexture.source.data.data,r=s.length+1,a=e*r+1;for(let o=0;o<s.length;o++)s[o]=i[a+o]}raycast(e,t){const s=this.matrixWorld,i=this.count;if(ga.geometry=this.geometry,ga.material=this.material,ga.material!==void 0&&(this.boundingSphere===null&&this.computeBoundingSphere(),Ma.copy(this.boundingSphere),Ma.applyMatrix4(s),e.ray.intersectsSphere(Ma)!==!1))for(let r=0;r<i;r++){this.getMatrixAt(r,xr),Nh.multiplyMatrices(s,xr),ga.matrixWorld=Nh,ga.raycast(e,po);for(let a=0,o=po.length;a<o;a++){const l=po[a];l.instanceId=r,l.object=this,t.push(l)}po.length=0}}setColorAt(e,t){return this.instanceColor===null&&(this.instanceColor=new vi(new Float32Array(this.instanceMatrix.count*3).fill(1),3)),t.toArray(this.instanceColor.array,e*3),this}setMatrixAt(e,t){return t.toArray(this.instanceMatrix.array,e*16),this}setMorphAt(e,t){const s=t.morphTargetInfluences,i=s.length+1;this.morphTexture===null&&(this.morphTexture=new qm(new Float32Array(i*this.count),i,this.count,Mu,Mn));const r=this.morphTexture.source.data.data;let a=0;for(let c=0;c<s.length;c++)a+=s[c];const o=this.geometry.morphTargetsRelative?1:1-a,l=i*e;return r[l]=o,r.set(s,l+1),this}updateMorphTargets(){}dispose(){this.dispatchEvent({type:"dispose"}),this.morphTexture!==null&&(this.morphTexture.dispose(),this.morphTexture=null)}}const gc=new U,Xz=new U,Yz=new ut;class gi{constructor(e=new U(1,0,0),t=0){this.isPlane=!0,this.normal=e,this.constant=t}set(e,t){return this.normal.copy(e),this.constant=t,this}setComponents(e,t,s,i){return this.normal.set(e,t,s),this.constant=i,this}setFromNormalAndCoplanarPoint(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this}setFromCoplanarPoints(e,t,s){const i=gc.subVectors(s,t).cross(Xz.subVectors(e,t)).normalize();return this.setFromNormalAndCoplanarPoint(i,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,t){return t.copy(e).addScaledVector(this.normal,-this.distanceToPoint(e))}intersectLine(e,t,s=!0){const i=e.delta(gc),r=this.normal.dot(i);if(r===0)return this.distanceToPoint(e.start)===0?t.copy(e.start):null;const a=-(e.start.dot(this.normal)+this.constant)/r;return s===!0&&(a<0||a>1)?null:t.copy(e.start).addScaledVector(i,a)}intersectsLine(e){const t=this.distanceToPoint(e.start),s=this.distanceToPoint(e.end);return t<0&&s>0||s<0&&t>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,t){const s=t||Yz.getNormalMatrix(e),i=this.coplanarPoint(gc).applyMatrix4(e),r=this.normal.applyMatrix3(s).normalize();return this.constant=-i.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)}}const Bi=new or,Kz=new lt(.5,.5),mo=new U;class Eu{constructor(e=new gi,t=new gi,s=new gi,i=new gi,r=new gi,a=new gi){this.planes=[e,t,s,i,r,a]}set(e,t,s,i,r,a){const o=this.planes;return o[0].copy(e),o[1].copy(t),o[2].copy(s),o[3].copy(i),o[4].copy(r),o[5].copy(a),this}copy(e){const t=this.planes;for(let s=0;s<6;s++)t[s].copy(e.planes[s]);return this}setFromProjectionMatrix(e,t=An,s=!1){const i=this.planes,r=e.elements,a=r[0],o=r[1],l=r[2],c=r[3],d=r[4],u=r[5],h=r[6],g=r[7],p=r[8],z=r[9],m=r[10],f=r[11],_=r[12],O=r[13],w=r[14],x=r[15];if(i[0].setComponents(c-a,g-d,f-p,x-_).normalize(),i[1].setComponents(c+a,g+d,f+p,x+_).normalize(),i[2].setComponents(c+o,g+u,f+z,x+O).normalize(),i[3].setComponents(c-o,g-u,f-z,x-O).normalize(),s)i[4].setComponents(l,h,m,w).normalize(),i[5].setComponents(c-l,g-h,f-m,x-w).normalize();else if(i[4].setComponents(c-l,g-h,f-m,x-w).normalize(),t===An)i[5].setComponents(c+l,g+h,f+m,x+w).normalize();else if(t===ka)i[5].setComponents(l,h,m,w).normalize();else throw new Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+t);return this}intersectsObject(e){if(e.boundingSphere!==void 0)e.boundingSphere===null&&e.computeBoundingSphere(),Bi.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{const t=e.geometry;t.boundingSphere===null&&t.computeBoundingSphere(),Bi.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(Bi)}intersectsSprite(e){Bi.center.set(0,0,0);const t=Kz.distanceTo(e.center);return Bi.radius=.7071067811865476+t,Bi.applyMatrix4(e.matrixWorld),this.intersectsSphere(Bi)}intersectsSphere(e){const t=this.planes,s=e.center,i=-e.radius;for(let r=0;r<6;r++)if(t[r].distanceToPoint(s)<i)return!1;return!0}intersectsBox(e){const t=this.planes;for(let s=0;s<6;s++){const i=t[s];if(mo.x=i.normal.x>0?e.max.x:e.min.x,mo.y=i.normal.y>0?e.max.y:e.min.y,mo.z=i.normal.z>0?e.max.z:e.min.z,i.distanceToPoint(mo)<0)return!1}return!0}containsPoint(e){const t=this.planes;for(let s=0;s<6;s++)if(t[s].distanceToPoint(e)<0)return!1;return!0}clone(){return new this.constructor().copy(this)}}class Hr extends ni{constructor(e){super(),this.isLineBasicMaterial=!0,this.type="LineBasicMaterial",this.color=new Ke(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 ml=new U,gl=new U,Ph=new Gt,ba=new Sl,go=new or,Mc=new U,Lh=new U;class Zd extends ss{constructor(e=new ds,t=new Hr){super(),this.isLine=!0,this.type="Line",this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),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 t=e.attributes.position,s=[0];for(let i=1,r=t.count;i<r;i++)ml.fromBufferAttribute(t,i-1),gl.fromBufferAttribute(t,i),s[i]=s[i-1],s[i]+=ml.distanceTo(gl);e.setAttribute("lineDistance",new Xt(s,1))}else st("Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}raycast(e,t){const s=this.geometry,i=this.matrixWorld,r=e.params.Line.threshold,a=s.drawRange;if(s.boundingSphere===null&&s.computeBoundingSphere(),go.copy(s.boundingSphere),go.applyMatrix4(i),go.radius+=r,e.ray.intersectsSphere(go)===!1)return;Ph.copy(i).invert(),ba.copy(e.ray).applyMatrix4(Ph);const o=r/((this.scale.x+this.scale.y+this.scale.z)/3),l=o*o,c=this.isLineSegments?2:1,d=s.index,h=s.attributes.position;if(d!==null){const g=Math.max(0,a.start),p=Math.min(d.count,a.start+a.count);for(let z=g,m=p-1;z<m;z+=c){const f=d.getX(z),_=d.getX(z+1),O=Mo(this,e,ba,l,f,_,z);O&&t.push(O)}if(this.isLineLoop){const z=d.getX(p-1),m=d.getX(g),f=Mo(this,e,ba,l,z,m,p-1);f&&t.push(f)}}else{const g=Math.max(0,a.start),p=Math.min(h.count,a.start+a.count);for(let z=g,m=p-1;z<m;z+=c){const f=Mo(this,e,ba,l,z,z+1,z);f&&t.push(f)}if(this.isLineLoop){const z=Mo(this,e,ba,l,p-1,g,p-1);z&&t.push(z)}}}updateMorphTargets(){const t=this.geometry.morphAttributes,s=Object.keys(t);if(s.length>0){const i=t[s[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let r=0,a=i.length;r<a;r++){const o=i[r].name||String(r);this.morphTargetInfluences.push(0),this.morphTargetDictionary[o]=r}}}}}function Mo(n,e,t,s,i,r,a){const o=n.geometry.attributes.position;if(ml.fromBufferAttribute(o,i),gl.fromBufferAttribute(o,r),t.distanceSqToSegment(ml,gl,Mc,Lh)>s)return;Mc.applyMatrix4(n.matrixWorld);const c=e.ray.origin.distanceTo(Mc);if(!(c<e.near||c>e.far))return{distance:c,point:Lh.clone().applyMatrix4(n.matrixWorld),index:a,face:null,faceIndex:null,barycoord:null,object:n}}const Wh=new U,kh=new U;class Xm extends Zd{constructor(e,t){super(e,t),this.isLineSegments=!0,this.type="LineSegments"}computeLineDistances(){const e=this.geometry;if(e.index===null){const t=e.attributes.position,s=[];for(let i=0,r=t.count;i<r;i+=2)Wh.fromBufferAttribute(t,i),kh.fromBufferAttribute(t,i+1),s[i]=i===0?0:s[i-1],s[i+1]=s[i]+Wh.distanceTo(kh);e.setAttribute("lineDistance",new Xt(s,1))}else st("LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}}class Zz extends ni{constructor(e){super(),this.isPointsMaterial=!0,this.type="PointsMaterial",this.color=new Ke(16777215),this.map=null,this.alphaMap=null,this.size=1,this.sizeAttenuation=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.size=e.size,this.sizeAttenuation=e.sizeAttenuation,this.fog=e.fog,this}}const Uh=new Gt,Qd=new Sl,bo=new or,zo=new U;class Qz extends ss{constructor(e=new ds,t=new Zz){super(),this.isPoints=!0,this.type="Points",this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}raycast(e,t){const s=this.geometry,i=this.matrixWorld,r=e.params.Points.threshold,a=s.drawRange;if(s.boundingSphere===null&&s.computeBoundingSphere(),bo.copy(s.boundingSphere),bo.applyMatrix4(i),bo.radius+=r,e.ray.intersectsSphere(bo)===!1)return;Uh.copy(i).invert(),Qd.copy(e.ray).applyMatrix4(Uh);const o=r/((this.scale.x+this.scale.y+this.scale.z)/3),l=o*o,c=s.index,u=s.attributes.position;if(c!==null){const h=Math.max(0,a.start),g=Math.min(c.count,a.start+a.count);for(let p=h,z=g;p<z;p++){const m=c.getX(p);zo.fromBufferAttribute(u,m),Fh(zo,m,l,i,e,t,this)}}else{const h=Math.max(0,a.start),g=Math.min(u.count,a.start+a.count);for(let p=h,z=g;p<z;p++)zo.fromBufferAttribute(u,p),Fh(zo,p,l,i,e,t,this)}}updateMorphTargets(){const t=this.geometry.morphAttributes,s=Object.keys(t);if(s.length>0){const i=t[s[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let r=0,a=i.length;r<a;r++){const o=i[r].name||String(r);this.morphTargetInfluences.push(0),this.morphTargetDictionary[o]=r}}}}}function Fh(n,e,t,s,i,r,a){const o=Qd.distanceSqToPoint(n);if(o<t){const l=new U;Qd.closestPointToPoint(n,l),l.applyMatrix4(s);const c=i.ray.origin.distanceTo(l);if(c<i.near||c>i.far)return;r.push({distance:c,distanceToRay:Math.sqrt(o),point:l,index:e,face:null,faceIndex:null,barycoord:null,object:a})}}class Ym extends Is{constructor(e=[],t=Ji,s,i,r,a,o,l,c,d){super(e,t,s,i,r,a,o,l,c,d),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}}class Km extends Is{constructor(e,t,s,i,r,a,o,l,c){super(e,t,s,i,r,a,o,l,c),this.isCanvasTexture=!0,this.needsUpdate=!0}}class qr extends Is{constructor(e,t,s=Gn,i,r,a,o=ys,l=ys,c,d=si,u=1){if(d!==si&&d!==ji)throw new Error("THREE.DepthTexture: format must be either THREE.DepthFormat or THREE.DepthStencilFormat");const h={width:e,height:t,depth:u};super(h,i,r,a,o,l,d,s,c),this.isDepthTexture=!0,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(e){return super.copy(e),this.source=new vu(Object.assign({},e.image)),this.compareFunction=e.compareFunction,this}toJSON(e){const t=super.toJSON(e);return this.compareFunction!==null&&(t.compareFunction=this.compareFunction),t}}class Jz extends qr{constructor(e,t=Gn,s=Ji,i,r,a=ys,o=ys,l,c=si){const d={width:e,height:e,depth:1},u=[d,d,d,d,d,d];super(e,e,t,s,i,r,a,o,l,c),this.image=u,this.isCubeDepthTexture=!0,this.isCubeTexture=!0}get images(){return this.image}set images(e){this.image=e}}class Zm extends Is{constructor(e=null){super(),this.sourceTexture=e,this.isExternalTexture=!0}copy(e){return super.copy(e),this.sourceTexture=e.sourceTexture,this}}class ja extends ds{constructor(e=1,t=1,s=1,i=1,r=1,a=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:s,widthSegments:i,heightSegments:r,depthSegments:a};const o=this;i=Math.floor(i),r=Math.floor(r),a=Math.floor(a);const l=[],c=[],d=[],u=[];let h=0,g=0;p("z","y","x",-1,-1,s,t,e,a,r,0),p("z","y","x",1,-1,s,t,-e,a,r,1),p("x","z","y",1,1,e,s,t,i,a,2),p("x","z","y",1,-1,e,s,-t,i,a,3),p("x","y","z",1,-1,e,t,s,i,r,4),p("x","y","z",-1,-1,e,t,-s,i,r,5),this.setIndex(l),this.setAttribute("position",new Xt(c,3)),this.setAttribute("normal",new Xt(d,3)),this.setAttribute("uv",new Xt(u,2));function p(z,m,f,_,O,w,x,S,I,b,A){const B=w/I,N=x/b,k=w/2,L=x/2,F=S/2,P=I+1,W=b+1;let X=0,Q=0;const ie=new U;for(let be=0;be<W;be++){const ae=be*N-L;for(let xe=0;xe<P;xe++){const Ze=xe*B-k;ie[z]=Ze*_,ie[m]=ae*O,ie[f]=F,c.push(ie.x,ie.y,ie.z),ie[z]=0,ie[m]=0,ie[f]=S>0?1:-1,d.push(ie.x,ie.y,ie.z),u.push(xe/I),u.push(1-be/b),X+=1}}for(let be=0;be<b;be++)for(let ae=0;ae<I;ae++){const xe=h+ae+P*be,Ze=h+ae+P*(be+1),nt=h+(ae+1)+P*(be+1),Ve=h+(ae+1)+P*be;l.push(xe,Ze,Ve),l.push(Ze,nt,Ve),Q+=6}o.addGroup(g,Q,A),g+=Q,h+=X}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new ja(e.width,e.height,e.depth,e.widthSegments,e.heightSegments,e.depthSegments)}}class Du extends ds{constructor(e=1,t=32,s=0,i=Math.PI*2){super(),this.type="CircleGeometry",this.parameters={radius:e,segments:t,thetaStart:s,thetaLength:i},t=Math.max(3,t);const r=[],a=[],o=[],l=[],c=new U,d=new lt;a.push(0,0,0),o.push(0,0,1),l.push(.5,.5);for(let u=0,h=3;u<=t;u++,h+=3){const g=s+u/t*i;c.x=e*Math.cos(g),c.y=e*Math.sin(g),a.push(c.x,c.y,c.z),o.push(0,0,1),d.x=(a[h]/e+1)/2,d.y=(a[h+1]/e+1)/2,l.push(d.x,d.y)}for(let u=1;u<=t;u++)r.push(u,u+1,0);this.setIndex(r),this.setAttribute("position",new Xt(a,3)),this.setAttribute("normal",new Xt(o,3)),this.setAttribute("uv",new Xt(l,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Du(e.radius,e.segments,e.thetaStart,e.thetaLength)}}class Iu extends ds{constructor(e=1,t=1,s=1,i=32,r=1,a=!1,o=0,l=Math.PI*2){super(),this.type="CylinderGeometry",this.parameters={radiusTop:e,radiusBottom:t,height:s,radialSegments:i,heightSegments:r,openEnded:a,thetaStart:o,thetaLength:l};const c=this;i=Math.floor(i),r=Math.floor(r);const d=[],u=[],h=[],g=[];let p=0;const z=[],m=s/2;let f=0;_(),a===!1&&(e>0&&O(!0),t>0&&O(!1)),this.setIndex(d),this.setAttribute("position",new Xt(u,3)),this.setAttribute("normal",new Xt(h,3)),this.setAttribute("uv",new Xt(g,2));function _(){const w=new U,x=new U;let S=0;const I=(t-e)/s;for(let b=0;b<=r;b++){const A=[],B=b/r,N=B*(t-e)+e;for(let k=0;k<=i;k++){const L=k/i,F=L*l+o,P=Math.sin(F),W=Math.cos(F);x.x=N*P,x.y=-B*s+m,x.z=N*W,u.push(x.x,x.y,x.z),w.set(P,I,W).normalize(),h.push(w.x,w.y,w.z),g.push(L,1-B),A.push(p++)}z.push(A)}for(let b=0;b<i;b++)for(let A=0;A<r;A++){const B=z[A][b],N=z[A+1][b],k=z[A+1][b+1],L=z[A][b+1];(e>0||A!==0)&&(d.push(B,N,L),S+=3),(t>0||A!==r-1)&&(d.push(N,k,L),S+=3)}c.addGroup(f,S,0),f+=S}function O(w){const x=p,S=new lt,I=new U;let b=0;const A=w===!0?e:t,B=w===!0?1:-1;for(let k=1;k<=i;k++)u.push(0,m*B,0),h.push(0,B,0),g.push(.5,.5),p++;const N=p;for(let k=0;k<=i;k++){const F=k/i*l+o,P=Math.cos(F),W=Math.sin(F);I.x=A*W,I.y=m*B,I.z=A*P,u.push(I.x,I.y,I.z),h.push(0,B,0),S.x=P*.5+.5,S.y=W*.5*B+.5,g.push(S.x,S.y),p++}for(let k=0;k<i;k++){const L=x+k,F=N+k;w===!0?d.push(F,F+1,L):d.push(F+1,F,L),b+=3}c.addGroup(f,b,w===!0?1:2),f+=b}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Iu(e.radiusTop,e.radiusBottom,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}}class Tu extends ds{constructor(e=[],t=[],s=1,i=0){super(),this.type="PolyhedronGeometry",this.parameters={vertices:e,indices:t,radius:s,detail:i};const r=[],a=[];o(i),c(s),d(),this.setAttribute("position",new Xt(r,3)),this.setAttribute("normal",new Xt(r.slice(),3)),this.setAttribute("uv",new Xt(a,2)),i===0?this.computeVertexNormals():this.normalizeNormals();function o(_){const O=new U,w=new U,x=new U;for(let S=0;S<t.length;S+=3)g(t[S+0],O),g(t[S+1],w),g(t[S+2],x),l(O,w,x,_)}function l(_,O,w,x){const S=x+1,I=[];for(let b=0;b<=S;b++){I[b]=[];const A=_.clone().lerp(w,b/S),B=O.clone().lerp(w,b/S),N=S-b;for(let k=0;k<=N;k++)k===0&&b===S?I[b][k]=A:I[b][k]=A.clone().lerp(B,k/N)}for(let b=0;b<S;b++)for(let A=0;A<2*(S-b)-1;A++){const B=Math.floor(A/2);A%2===0?(h(I[b][B+1]),h(I[b+1][B]),h(I[b][B])):(h(I[b][B+1]),h(I[b+1][B+1]),h(I[b+1][B]))}}function c(_){const O=new U;for(let w=0;w<r.length;w+=3)O.x=r[w+0],O.y=r[w+1],O.z=r[w+2],O.normalize().multiplyScalar(_),r[w+0]=O.x,r[w+1]=O.y,r[w+2]=O.z}function d(){const _=new U;for(let O=0;O<r.length;O+=3){_.x=r[O+0],_.y=r[O+1],_.z=r[O+2];const w=m(_)/2/Math.PI+.5,x=f(_)/Math.PI+.5;a.push(w,1-x)}p(),u()}function u(){for(let _=0;_<a.length;_+=6){const O=a[_+0],w=a[_+2],x=a[_+4],S=Math.max(O,w,x),I=Math.min(O,w,x);S>.9&&I<.1&&(O<.2&&(a[_+0]+=1),w<.2&&(a[_+2]+=1),x<.2&&(a[_+4]+=1))}}function h(_){r.push(_.x,_.y,_.z)}function g(_,O){const w=_*3;O.x=e[w+0],O.y=e[w+1],O.z=e[w+2]}function p(){const _=new U,O=new U,w=new U,x=new U,S=new lt,I=new lt,b=new lt;for(let A=0,B=0;A<r.length;A+=9,B+=6){_.set(r[A+0],r[A+1],r[A+2]),O.set(r[A+3],r[A+4],r[A+5]),w.set(r[A+6],r[A+7],r[A+8]),S.set(a[B+0],a[B+1]),I.set(a[B+2],a[B+3]),b.set(a[B+4],a[B+5]),x.copy(_).add(O).add(w).divideScalar(3);const N=m(x);z(S,B+0,_,N),z(I,B+2,O,N),z(b,B+4,w,N)}}function z(_,O,w,x){x<0&&_.x===1&&(a[O]=_.x-1),w.x===0&&w.z===0&&(a[O]=x/2/Math.PI+.5)}function m(_){return Math.atan2(_.z,-_.x)}function f(_){return Math.atan2(-_.y,Math.sqrt(_.x*_.x+_.z*_.z))}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Tu(e.vertices,e.indices,e.radius,e.detail)}}class Gu extends Tu{constructor(e=1,t=0){const s=(1+Math.sqrt(5))/2,i=[-1,s,0,1,s,0,-1,-s,0,1,-s,0,0,-1,s,0,1,s,0,-1,-s,0,1,-s,s,0,-1,s,0,1,-s,0,-1,-s,0,1],r=[0,11,5,0,5,1,0,1,7,0,7,10,0,10,11,1,5,9,5,11,4,11,10,2,10,7,6,7,1,8,3,9,4,3,4,2,3,2,6,3,6,8,3,8,9,4,9,5,2,4,11,6,2,10,8,6,7,9,8,1];super(i,r,e,t),this.type="IcosahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new Gu(e.radius,e.detail)}}class Al extends ds{constructor(e=1,t=1,s=1,i=1){super(),this.type="PlaneGeometry",this.parameters={width:e,height:t,widthSegments:s,heightSegments:i};const r=e/2,a=t/2,o=Math.floor(s),l=Math.floor(i),c=o+1,d=l+1,u=e/o,h=t/l,g=[],p=[],z=[],m=[];for(let f=0;f<d;f++){const _=f*h-a;for(let O=0;O<c;O++){const w=O*u-r;p.push(w,-_,0),z.push(0,0,1),m.push(O/o),m.push(1-f/l)}}for(let f=0;f<l;f++)for(let _=0;_<o;_++){const O=_+c*f,w=_+c*(f+1),x=_+1+c*(f+1),S=_+1+c*f;g.push(O,w,S),g.push(w,x,S)}this.setIndex(g),this.setAttribute("position",new Xt(p,3)),this.setAttribute("normal",new Xt(z,3)),this.setAttribute("uv",new Xt(m,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Al(e.width,e.height,e.widthSegments,e.heightSegments)}}class El extends ds{constructor(e=1,t=32,s=16,i=0,r=Math.PI*2,a=0,o=Math.PI){super(),this.type="SphereGeometry",this.parameters={radius:e,widthSegments:t,heightSegments:s,phiStart:i,phiLength:r,thetaStart:a,thetaLength:o},t=Math.max(3,Math.floor(t)),s=Math.max(2,Math.floor(s));const l=Math.min(a+o,Math.PI);let c=0;const d=[],u=new U,h=new U,g=[],p=[],z=[],m=[];for(let f=0;f<=s;f++){const _=[],O=f/s,w=a+O*o,x=e*Math.cos(w),S=Math.sqrt(e*e-x*x);let I=0;f===0&&a===0?I=.5/t:f===s&&l===Math.PI&&(I=-.5/t);for(let b=0;b<=t;b++){const A=b/t,B=i+A*r;u.x=-S*Math.cos(B),u.y=x,u.z=S*Math.sin(B),p.push(u.x,u.y,u.z),h.copy(u).normalize(),z.push(h.x,h.y,h.z),m.push(A+I,1-O),_.push(c++)}d.push(_)}for(let f=0;f<s;f++)for(let _=0;_<t;_++){const O=d[f][_+1],w=d[f][_],x=d[f+1][_],S=d[f+1][_+1];(f!==0||a>0)&&g.push(O,w,S),(f!==s-1||l<Math.PI)&&g.push(w,x,S)}this.setIndex(g),this.setAttribute("position",new Xt(p,3)),this.setAttribute("normal",new Xt(z,3)),this.setAttribute("uv",new Xt(m,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new El(e.radius,e.widthSegments,e.heightSegments,e.phiStart,e.phiLength,e.thetaStart,e.thetaLength)}}function Xr(n){const e={};for(const t in n){e[t]={};for(const s in n[t]){const i=n[t][s];if(jh(i))i.isRenderTargetTexture?(st("UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms()."),e[t][s]=null):e[t][s]=i.clone();else if(Array.isArray(i))if(jh(i[0])){const r=[];for(let a=0,o=i.length;a<o;a++)r[a]=i[a].clone();e[t][s]=r}else e[t][s]=i.slice();else e[t][s]=i}}return e}function Bs(n){const e={};for(let t=0;t<n.length;t++){const s=Xr(n[t]);for(const i in s)e[i]=s[i]}return e}function jh(n){return n&&(n.isColor||n.isMatrix3||n.isMatrix4||n.isVector2||n.isVector3||n.isVector4||n.isTexture||n.isQuaternion)}function e_(n){const e=[];for(let t=0;t<n.length;t++)e.push(n[t].clone());return e}function Qm(n){const e=n.getRenderTarget();return e===null?n.outputColorSpace:e.isXRRenderTarget===!0?e.texture.colorSpace:xt.workingColorSpace}const t_={clone:Xr,merge:Bs};var s_=`void main() {
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./cornerstoneEngine-CS_xx5cA.js","./_commonjsHelpers-CE1G-McA.js"])))=>i.map(i=>d[i]);
2
+ (function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))s(i);new MutationObserver(i=>{for(const r of i)if(r.type==="childList")for(const a of r.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&s(a)}).observe(document,{childList:!0,subtree:!0});function t(i){const r={};return i.integrity&&(r.integrity=i.integrity),i.referrerPolicy&&(r.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?r.credentials="include":i.crossOrigin==="anonymous"?r.credentials="omit":r.credentials="same-origin",r}function s(i){if(i.ep)return;i.ep=!0;const r=t(i);fetch(i.href,r)}})();const _M=["cold","cached","failed"];function wM(n){return n.state??(n.restored===!0?"cached":"cold")}const yM=["upload","download","pull","workflow","pipeline","group","task"],vM=["transfer","retrieve","workflow","inspection"],OM=["scanning","transferring","watching","retrying","reading","working","complete","failed"],xM=["files","bytes","series","jobs","nodes"],SM=["running","done","unconfirmed","stalled","timeout","error","unknown"],Vc=1;var Dt;(function(n){n.assertEqual=i=>{};function e(i){}n.assertIs=e;function t(i){throw new Error}n.assertNever=t,n.arrayToEnum=i=>{const r={};for(const a of i)r[a]=a;return r},n.getValidEnumValues=i=>{const r=n.objectKeys(i).filter(o=>typeof i[i[o]]!="number"),a={};for(const o of r)a[o]=i[o];return n.objectValues(a)},n.objectValues=i=>n.objectKeys(i).map(function(r){return i[r]}),n.objectKeys=typeof Object.keys=="function"?i=>Object.keys(i):i=>{const r=[];for(const a in i)Object.prototype.hasOwnProperty.call(i,a)&&r.push(a);return r},n.find=(i,r)=>{for(const a of i)if(r(a))return a},n.isInteger=typeof Number.isInteger=="function"?i=>Number.isInteger(i):i=>typeof i=="number"&&Number.isFinite(i)&&Math.floor(i)===i;function s(i,r=" | "){return i.map(a=>typeof a=="string"?`'${a}'`:a).join(r)}n.joinValues=s,n.jsonStringifyReplacer=(i,r)=>typeof r=="bigint"?r.toString():r})(Dt||(Dt={}));var eh;(function(n){n.mergeShapes=(e,t)=>({...e,...t})})(eh||(eh={}));const ke=Dt.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),mi=n=>{switch(typeof n){case"undefined":return ke.undefined;case"string":return ke.string;case"number":return Number.isNaN(n)?ke.nan:ke.number;case"boolean":return ke.boolean;case"function":return ke.function;case"bigint":return ke.bigint;case"symbol":return ke.symbol;case"object":return Array.isArray(n)?ke.array:n===null?ke.null:n.then&&typeof n.then=="function"&&n.catch&&typeof n.catch=="function"?ke.promise:typeof Map<"u"&&n instanceof Map?ke.map:typeof Set<"u"&&n instanceof Set?ke.set:typeof Date<"u"&&n instanceof Date?ke.date:ke.object;default:return ke.unknown}},we=Dt.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class ei extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=s=>{this.issues=[...this.issues,s]},this.addIssues=(s=[])=>{this.issues=[...this.issues,...s]};const t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}format(e){const t=e||function(r){return r.message},s={_errors:[]},i=r=>{for(const a of r.issues)if(a.code==="invalid_union")a.unionErrors.map(i);else if(a.code==="invalid_return_type")i(a.returnTypeError);else if(a.code==="invalid_arguments")i(a.argumentsError);else if(a.path.length===0)s._errors.push(t(a));else{let o=s,l=0;for(;l<a.path.length;){const c=a.path[l];l===a.path.length-1?(o[c]=o[c]||{_errors:[]},o[c]._errors.push(t(a))):o[c]=o[c]||{_errors:[]},o=o[c],l++}}};return i(this),s}static assert(e){if(!(e instanceof ei))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,Dt.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=t=>t.message){const t={},s=[];for(const i of this.issues)if(i.path.length>0){const r=i.path[0];t[r]=t[r]||[],t[r].push(e(i))}else s.push(e(i));return{formErrors:s,fieldErrors:t}}get formErrors(){return this.flatten()}}ei.create=n=>new ei(n);const Hc=(n,e)=>{let t;switch(n.code){case we.invalid_type:n.received===ke.undefined?t="Required":t=`Expected ${n.expected}, received ${n.received}`;break;case we.invalid_literal:t=`Invalid literal value, expected ${JSON.stringify(n.expected,Dt.jsonStringifyReplacer)}`;break;case we.unrecognized_keys:t=`Unrecognized key(s) in object: ${Dt.joinValues(n.keys,", ")}`;break;case we.invalid_union:t="Invalid input";break;case we.invalid_union_discriminator:t=`Invalid discriminator value. Expected ${Dt.joinValues(n.options)}`;break;case we.invalid_enum_value:t=`Invalid enum value. Expected ${Dt.joinValues(n.options)}, received '${n.received}'`;break;case we.invalid_arguments:t="Invalid function arguments";break;case we.invalid_return_type:t="Invalid function return type";break;case we.invalid_date:t="Invalid date";break;case we.invalid_string:typeof n.validation=="object"?"includes"in n.validation?(t=`Invalid input: must include "${n.validation.includes}"`,typeof n.validation.position=="number"&&(t=`${t} at one or more positions greater than or equal to ${n.validation.position}`)):"startsWith"in n.validation?t=`Invalid input: must start with "${n.validation.startsWith}"`:"endsWith"in n.validation?t=`Invalid input: must end with "${n.validation.endsWith}"`:Dt.assertNever(n.validation):n.validation!=="regex"?t=`Invalid ${n.validation}`:t="Invalid";break;case we.too_small:n.type==="array"?t=`Array must contain ${n.exact?"exactly":n.inclusive?"at least":"more than"} ${n.minimum} element(s)`:n.type==="string"?t=`String must contain ${n.exact?"exactly":n.inclusive?"at least":"over"} ${n.minimum} character(s)`:n.type==="number"?t=`Number must be ${n.exact?"exactly equal to ":n.inclusive?"greater than or equal to ":"greater than "}${n.minimum}`:n.type==="bigint"?t=`Number must be ${n.exact?"exactly equal to ":n.inclusive?"greater than or equal to ":"greater than "}${n.minimum}`:n.type==="date"?t=`Date must be ${n.exact?"exactly equal to ":n.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(n.minimum))}`:t="Invalid input";break;case we.too_big:n.type==="array"?t=`Array must contain ${n.exact?"exactly":n.inclusive?"at most":"less than"} ${n.maximum} element(s)`:n.type==="string"?t=`String must contain ${n.exact?"exactly":n.inclusive?"at most":"under"} ${n.maximum} character(s)`:n.type==="number"?t=`Number must be ${n.exact?"exactly":n.inclusive?"less than or equal to":"less than"} ${n.maximum}`:n.type==="bigint"?t=`BigInt must be ${n.exact?"exactly":n.inclusive?"less than or equal to":"less than"} ${n.maximum}`:n.type==="date"?t=`Date must be ${n.exact?"exactly":n.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(n.maximum))}`:t="Invalid input";break;case we.custom:t="Invalid input";break;case we.invalid_intersection_types:t="Intersection results could not be merged";break;case we.not_multiple_of:t=`Number must be a multiple of ${n.multipleOf}`;break;case we.not_finite:t="Number must be finite";break;default:t=e.defaultError,Dt.assertNever(n)}return{message:t}};let AM=Hc;function EM(){return AM}const DM=n=>{const{data:e,path:t,errorMaps:s,issueData:i}=n,r=[...t,...i.path||[]],a={...i,path:r};if(i.message!==void 0)return{...i,path:r,message:i.message};let o="";const l=s.filter(c=>!!c).slice().reverse();for(const c of l)o=c(a,{data:e,defaultError:o}).message;return{...i,path:r,message:o}};function Ce(n,e){const t=EM(),s=DM({issueData:e,data:n.data,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,t,t===Hc?void 0:Hc].filter(i=>!!i)});n.common.issues.push(s)}class Cs{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,t){const s=[];for(const i of t){if(i.status==="aborted")return at;i.status==="dirty"&&e.dirty(),s.push(i.value)}return{status:e.value,value:s}}static async mergeObjectAsync(e,t){const s=[];for(const i of t){const r=await i.key,a=await i.value;s.push({key:r,value:a})}return Cs.mergeObjectSync(e,s)}static mergeObjectSync(e,t){const s={};for(const i of t){const{key:r,value:a}=i;if(r.status==="aborted"||a.status==="aborted")return at;r.status==="dirty"&&e.dirty(),a.status==="dirty"&&e.dirty(),r.value!=="__proto__"&&(typeof a.value<"u"||i.alwaysSet)&&(s[r.value]=a.value)}return{status:e.value,value:s}}}const at=Object.freeze({status:"aborted"}),Aa=n=>({status:"dirty",value:n}),on=n=>({status:"valid",value:n}),th=n=>n.status==="aborted",sh=n=>n.status==="dirty",Ur=n=>n.status==="valid",Zo=n=>typeof Promise<"u"&&n instanceof Promise;var He;(function(n){n.errToObj=e=>typeof e=="string"?{message:e}:e||{},n.toString=e=>typeof e=="string"?e:e?.message})(He||(He={}));class Tn{constructor(e,t,s,i){this._cachedPath=[],this.parent=e,this.data=t,this._path=s,this._key=i}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const nh=(n,e)=>{if(Ur(e))return{success:!0,data:e.value};if(!n.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const t=new ei(n.common.issues);return this._error=t,this._error}}};function mt(n){if(!n)return{};const{errorMap:e,invalid_type_error:t,required_error:s,description:i}=n;if(e&&(t||s))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:i}:{errorMap:(a,o)=>{const{message:l}=n;return a.code==="invalid_enum_value"?{message:l??o.defaultError}:typeof o.data>"u"?{message:l??s??o.defaultError}:a.code!=="invalid_type"?{message:o.defaultError}:{message:l??t??o.defaultError}},description:i}}class vt{get description(){return this._def.description}_getType(e){return mi(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:mi(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new Cs,ctx:{common:e.parent.common,data:e.data,parsedType:mi(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if(Zo(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){const t=this._parse(e);return Promise.resolve(t)}parse(e,t){const s=this.safeParse(e,t);if(s.success)return s.data;throw s.error}safeParse(e,t){const s={common:{issues:[],async:t?.async??!1,contextualErrorMap:t?.errorMap},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:mi(e)},i=this._parseSync({data:e,path:s.path,parent:s});return nh(s,i)}"~validate"(e){const t={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:mi(e)};if(!this["~standard"].async)try{const s=this._parseSync({data:e,path:[],parent:t});return Ur(s)?{value:s.value}:{issues:t.common.issues}}catch(s){s?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),t.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:t}).then(s=>Ur(s)?{value:s.value}:{issues:t.common.issues})}async parseAsync(e,t){const s=await this.safeParseAsync(e,t);if(s.success)return s.data;throw s.error}async safeParseAsync(e,t){const s={common:{issues:[],contextualErrorMap:t?.errorMap,async:!0},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:mi(e)},i=this._parse({data:e,path:s.path,parent:s}),r=await(Zo(i)?i:Promise.resolve(i));return nh(s,r)}refine(e,t){const s=i=>typeof t=="string"||typeof t>"u"?{message:t}:typeof t=="function"?t(i):t;return this._refinement((i,r)=>{const a=e(i),o=()=>r.addIssue({code:we.custom,...s(i)});return typeof Promise<"u"&&a instanceof Promise?a.then(l=>l?!0:(o(),!1)):a?!0:(o(),!1)})}refinement(e,t){return this._refinement((s,i)=>e(s)?!0:(i.addIssue(typeof t=="function"?t(s,i):t),!1))}_refinement(e){return new Ki({schema:this,typeName:ot.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:t=>this["~validate"](t)}}optional(){return Kn.create(this,this._def)}nullable(){return Zi.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return En.create(this)}promise(){return il.create(this,this._def)}or(e){return Jo.create([this,e],this._def)}and(e){return el.create(this,e,this._def)}transform(e){return new Ki({...mt(this._def),schema:this,typeName:ot.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t=typeof e=="function"?e:()=>e;return new rl({...mt(this._def),innerType:this,defaultValue:t,typeName:ot.ZodDefault})}brand(){return new om({typeName:ot.ZodBranded,type:this,...mt(this._def)})}catch(e){const t=typeof e=="function"?e:()=>e;return new al({...mt(this._def),innerType:this,catchValue:t,typeName:ot.ZodCatch})}describe(e){const t=this.constructor;return new t({...this._def,description:e})}pipe(e){return cu.create(this,e)}readonly(){return ol.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const IM=/^c[^\s-]{8,}$/i,TM=/^[0-9a-z]+$/,GM=/^[0-9A-HJKMNP-TV-Z]{26}$/i,RM=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a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^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,$M=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,im="((\\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])))",VM=new RegExp(`^${im}$`);function rm(n){let e="[0-5]\\d";n.precision?e=`${e}\\.\\d{${n.precision}}`:n.precision==null&&(e=`${e}(\\.\\d+)?`);const t=n.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${t}`}function HM(n){return new RegExp(`^${rm(n)}$`)}function qM(n){let e=`${im}T${rm(n)}`;const t=[];return t.push(n.local?"Z?":"Z"),n.offset&&t.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${t.join("|")})`,new RegExp(`^${e}$`)}function XM(n,e){return!!((e==="v4"||!e)&&WM.test(n)||(e==="v6"||!e)&&UM.test(n))}function YM(n,e){if(!NM.test(n))return!1;try{const[t]=n.split(".");if(!t)return!1;const s=t.replace(/-/g,"+").replace(/_/g,"/").padEnd(t.length+(4-t.length%4)%4,"="),i=JSON.parse(atob(s));return!(typeof i!="object"||i===null||"typ"in i&&i?.typ!=="JWT"||!i.alg||e&&i.alg!==e)}catch{return!1}}function KM(n,e){return!!((e==="v4"||!e)&&kM.test(n)||(e==="v6"||!e)&&FM.test(n))}class Xn extends vt{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==ke.string){const r=this._getOrReturnCtx(e);return Ce(r,{code:we.invalid_type,expected:ke.string,received:r.parsedType}),at}const s=new Cs;let i;for(const r of this._def.checks)if(r.kind==="min")e.data.length<r.value&&(i=this._getOrReturnCtx(e,i),Ce(i,{code:we.too_small,minimum:r.value,type:"string",inclusive:!0,exact:!1,message:r.message}),s.dirty());else if(r.kind==="max")e.data.length>r.value&&(i=this._getOrReturnCtx(e,i),Ce(i,{code:we.too_big,maximum:r.value,type:"string",inclusive:!0,exact:!1,message:r.message}),s.dirty());else if(r.kind==="length"){const a=e.data.length>r.value,o=e.data.length<r.value;(a||o)&&(i=this._getOrReturnCtx(e,i),a?Ce(i,{code:we.too_big,maximum:r.value,type:"string",inclusive:!0,exact:!0,message:r.message}):o&&Ce(i,{code:we.too_small,minimum:r.value,type:"string",inclusive:!0,exact:!0,message:r.message}),s.dirty())}else if(r.kind==="email")PM.test(e.data)||(i=this._getOrReturnCtx(e,i),Ce(i,{validation:"email",code:we.invalid_string,message:r.message}),s.dirty());else if(r.kind==="emoji")Ul||(Ul=new RegExp(LM,"u")),Ul.test(e.data)||(i=this._getOrReturnCtx(e,i),Ce(i,{validation:"emoji",code:we.invalid_string,message:r.message}),s.dirty());else if(r.kind==="uuid")RM.test(e.data)||(i=this._getOrReturnCtx(e,i),Ce(i,{validation:"uuid",code:we.invalid_string,message:r.message}),s.dirty());else if(r.kind==="nanoid")BM.test(e.data)||(i=this._getOrReturnCtx(e,i),Ce(i,{validation:"nanoid",code:we.invalid_string,message:r.message}),s.dirty());else if(r.kind==="cuid")IM.test(e.data)||(i=this._getOrReturnCtx(e,i),Ce(i,{validation:"cuid",code:we.invalid_string,message:r.message}),s.dirty());else if(r.kind==="cuid2")TM.test(e.data)||(i=this._getOrReturnCtx(e,i),Ce(i,{validation:"cuid2",code:we.invalid_string,message:r.message}),s.dirty());else if(r.kind==="ulid")GM.test(e.data)||(i=this._getOrReturnCtx(e,i),Ce(i,{validation:"ulid",code:we.invalid_string,message:r.message}),s.dirty());else if(r.kind==="url")try{new URL(e.data)}catch{i=this._getOrReturnCtx(e,i),Ce(i,{validation:"url",code:we.invalid_string,message:r.message}),s.dirty()}else r.kind==="regex"?(r.regex.lastIndex=0,r.regex.test(e.data)||(i=this._getOrReturnCtx(e,i),Ce(i,{validation:"regex",code:we.invalid_string,message:r.message}),s.dirty())):r.kind==="trim"?e.data=e.data.trim():r.kind==="includes"?e.data.includes(r.value,r.position)||(i=this._getOrReturnCtx(e,i),Ce(i,{code:we.invalid_string,validation:{includes:r.value,position:r.position},message:r.message}),s.dirty()):r.kind==="toLowerCase"?e.data=e.data.toLowerCase():r.kind==="toUpperCase"?e.data=e.data.toUpperCase():r.kind==="startsWith"?e.data.startsWith(r.value)||(i=this._getOrReturnCtx(e,i),Ce(i,{code:we.invalid_string,validation:{startsWith:r.value},message:r.message}),s.dirty()):r.kind==="endsWith"?e.data.endsWith(r.value)||(i=this._getOrReturnCtx(e,i),Ce(i,{code:we.invalid_string,validation:{endsWith:r.value},message:r.message}),s.dirty()):r.kind==="datetime"?qM(r).test(e.data)||(i=this._getOrReturnCtx(e,i),Ce(i,{code:we.invalid_string,validation:"datetime",message:r.message}),s.dirty()):r.kind==="date"?VM.test(e.data)||(i=this._getOrReturnCtx(e,i),Ce(i,{code:we.invalid_string,validation:"date",message:r.message}),s.dirty()):r.kind==="time"?HM(r).test(e.data)||(i=this._getOrReturnCtx(e,i),Ce(i,{code:we.invalid_string,validation:"time",message:r.message}),s.dirty()):r.kind==="duration"?CM.test(e.data)||(i=this._getOrReturnCtx(e,i),Ce(i,{validation:"duration",code:we.invalid_string,message:r.message}),s.dirty()):r.kind==="ip"?XM(e.data,r.version)||(i=this._getOrReturnCtx(e,i),Ce(i,{validation:"ip",code:we.invalid_string,message:r.message}),s.dirty()):r.kind==="jwt"?YM(e.data,r.alg)||(i=this._getOrReturnCtx(e,i),Ce(i,{validation:"jwt",code:we.invalid_string,message:r.message}),s.dirty()):r.kind==="cidr"?KM(e.data,r.version)||(i=this._getOrReturnCtx(e,i),Ce(i,{validation:"cidr",code:we.invalid_string,message:r.message}),s.dirty()):r.kind==="base64"?jM.test(e.data)||(i=this._getOrReturnCtx(e,i),Ce(i,{validation:"base64",code:we.invalid_string,message:r.message}),s.dirty()):r.kind==="base64url"?$M.test(e.data)||(i=this._getOrReturnCtx(e,i),Ce(i,{validation:"base64url",code:we.invalid_string,message:r.message}),s.dirty()):Dt.assertNever(r);return{status:s.value,value:e.data}}_regex(e,t,s){return this.refinement(i=>e.test(i),{validation:t,code:we.invalid_string,...He.errToObj(s)})}_addCheck(e){return new Xn({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...He.errToObj(e)})}url(e){return this._addCheck({kind:"url",...He.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...He.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...He.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...He.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...He.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...He.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...He.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...He.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...He.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...He.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...He.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...He.errToObj(e)})}datetime(e){return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...He.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof e?.precision>"u"?null:e?.precision,...He.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...He.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...He.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t?.position,...He.errToObj(t?.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...He.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...He.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...He.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...He.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...He.errToObj(t)})}nonempty(e){return this.min(1,He.errToObj(e))}trim(){return new Xn({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new Xn({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new Xn({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}}Xn.create=n=>new Xn({checks:[],typeName:ot.ZodString,coerce:n?.coerce??!1,...mt(n)});function ZM(n,e){const t=(n.toString().split(".")[1]||"").length,s=(e.toString().split(".")[1]||"").length,i=t>s?t:s,r=Number.parseInt(n.toFixed(i).replace(".","")),a=Number.parseInt(e.toFixed(i).replace(".",""));return r%a/10**i}class Fr extends vt{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==ke.number){const r=this._getOrReturnCtx(e);return Ce(r,{code:we.invalid_type,expected:ke.number,received:r.parsedType}),at}let s;const i=new Cs;for(const r of this._def.checks)r.kind==="int"?Dt.isInteger(e.data)||(s=this._getOrReturnCtx(e,s),Ce(s,{code:we.invalid_type,expected:"integer",received:"float",message:r.message}),i.dirty()):r.kind==="min"?(r.inclusive?e.data<r.value:e.data<=r.value)&&(s=this._getOrReturnCtx(e,s),Ce(s,{code:we.too_small,minimum:r.value,type:"number",inclusive:r.inclusive,exact:!1,message:r.message}),i.dirty()):r.kind==="max"?(r.inclusive?e.data>r.value:e.data>=r.value)&&(s=this._getOrReturnCtx(e,s),Ce(s,{code:we.too_big,maximum:r.value,type:"number",inclusive:r.inclusive,exact:!1,message:r.message}),i.dirty()):r.kind==="multipleOf"?ZM(e.data,r.value)!==0&&(s=this._getOrReturnCtx(e,s),Ce(s,{code:we.not_multiple_of,multipleOf:r.value,message:r.message}),i.dirty()):r.kind==="finite"?Number.isFinite(e.data)||(s=this._getOrReturnCtx(e,s),Ce(s,{code:we.not_finite,message:r.message}),i.dirty()):Dt.assertNever(r);return{status:i.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,He.toString(t))}gt(e,t){return this.setLimit("min",e,!1,He.toString(t))}lte(e,t){return this.setLimit("max",e,!0,He.toString(t))}lt(e,t){return this.setLimit("max",e,!1,He.toString(t))}setLimit(e,t,s,i){return new Fr({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:s,message:He.toString(i)}]})}_addCheck(e){return new Fr({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:He.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:He.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:He.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:He.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:He.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:He.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:He.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:He.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:He.toString(e)})}get minValue(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&Dt.isInteger(e.value))}get isFinite(){let e=null,t=null;for(const s of this._def.checks){if(s.kind==="finite"||s.kind==="int"||s.kind==="multipleOf")return!0;s.kind==="min"?(t===null||s.value>t)&&(t=s.value):s.kind==="max"&&(e===null||s.value<e)&&(e=s.value)}return Number.isFinite(t)&&Number.isFinite(e)}}Fr.create=n=>new Fr({checks:[],typeName:ot.ZodNumber,coerce:n?.coerce||!1,...mt(n)});class Ca extends vt{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==ke.bigint)return this._getInvalidInput(e);let s;const i=new Cs;for(const r of this._def.checks)r.kind==="min"?(r.inclusive?e.data<r.value:e.data<=r.value)&&(s=this._getOrReturnCtx(e,s),Ce(s,{code:we.too_small,type:"bigint",minimum:r.value,inclusive:r.inclusive,message:r.message}),i.dirty()):r.kind==="max"?(r.inclusive?e.data>r.value:e.data>=r.value)&&(s=this._getOrReturnCtx(e,s),Ce(s,{code:we.too_big,type:"bigint",maximum:r.value,inclusive:r.inclusive,message:r.message}),i.dirty()):r.kind==="multipleOf"?e.data%r.value!==BigInt(0)&&(s=this._getOrReturnCtx(e,s),Ce(s,{code:we.not_multiple_of,multipleOf:r.value,message:r.message}),i.dirty()):Dt.assertNever(r);return{status:i.value,value:e.data}}_getInvalidInput(e){const t=this._getOrReturnCtx(e);return Ce(t,{code:we.invalid_type,expected:ke.bigint,received:t.parsedType}),at}gte(e,t){return this.setLimit("min",e,!0,He.toString(t))}gt(e,t){return this.setLimit("min",e,!1,He.toString(t))}lte(e,t){return this.setLimit("max",e,!0,He.toString(t))}lt(e,t){return this.setLimit("max",e,!1,He.toString(t))}setLimit(e,t,s,i){return new Ca({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:s,message:He.toString(i)}]})}_addCheck(e){return new Ca({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:He.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:He.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:He.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:He.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:He.toString(t)})}get minValue(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}}Ca.create=n=>new Ca({checks:[],typeName:ot.ZodBigInt,coerce:n?.coerce??!1,...mt(n)});class qc extends vt{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==ke.boolean){const s=this._getOrReturnCtx(e);return Ce(s,{code:we.invalid_type,expected:ke.boolean,received:s.parsedType}),at}return on(e.data)}}qc.create=n=>new qc({typeName:ot.ZodBoolean,coerce:n?.coerce||!1,...mt(n)});class Qo extends vt{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==ke.date){const r=this._getOrReturnCtx(e);return Ce(r,{code:we.invalid_type,expected:ke.date,received:r.parsedType}),at}if(Number.isNaN(e.data.getTime())){const r=this._getOrReturnCtx(e);return Ce(r,{code:we.invalid_date}),at}const s=new Cs;let i;for(const r of this._def.checks)r.kind==="min"?e.data.getTime()<r.value&&(i=this._getOrReturnCtx(e,i),Ce(i,{code:we.too_small,message:r.message,inclusive:!0,exact:!1,minimum:r.value,type:"date"}),s.dirty()):r.kind==="max"?e.data.getTime()>r.value&&(i=this._getOrReturnCtx(e,i),Ce(i,{code:we.too_big,message:r.message,inclusive:!0,exact:!1,maximum:r.value,type:"date"}),s.dirty()):Dt.assertNever(r);return{status:s.value,value:new Date(e.data.getTime())}}_addCheck(e){return new Qo({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:He.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:He.toString(t)})}get minDate(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e!=null?new Date(e):null}}Qo.create=n=>new Qo({checks:[],coerce:n?.coerce||!1,typeName:ot.ZodDate,...mt(n)});class ih extends vt{_parse(e){if(this._getType(e)!==ke.symbol){const s=this._getOrReturnCtx(e);return Ce(s,{code:we.invalid_type,expected:ke.symbol,received:s.parsedType}),at}return on(e.data)}}ih.create=n=>new ih({typeName:ot.ZodSymbol,...mt(n)});class Xc extends vt{_parse(e){if(this._getType(e)!==ke.undefined){const s=this._getOrReturnCtx(e);return Ce(s,{code:we.invalid_type,expected:ke.undefined,received:s.parsedType}),at}return on(e.data)}}Xc.create=n=>new Xc({typeName:ot.ZodUndefined,...mt(n)});class Yc extends vt{_parse(e){if(this._getType(e)!==ke.null){const s=this._getOrReturnCtx(e);return Ce(s,{code:we.invalid_type,expected:ke.null,received:s.parsedType}),at}return on(e.data)}}Yc.create=n=>new Yc({typeName:ot.ZodNull,...mt(n)});class rh extends vt{constructor(){super(...arguments),this._any=!0}_parse(e){return on(e.data)}}rh.create=n=>new rh({typeName:ot.ZodAny,...mt(n)});class Kc extends vt{constructor(){super(...arguments),this._unknown=!0}_parse(e){return on(e.data)}}Kc.create=n=>new Kc({typeName:ot.ZodUnknown,...mt(n)});class Ai extends vt{_parse(e){const t=this._getOrReturnCtx(e);return Ce(t,{code:we.invalid_type,expected:ke.never,received:t.parsedType}),at}}Ai.create=n=>new Ai({typeName:ot.ZodNever,...mt(n)});class ah extends vt{_parse(e){if(this._getType(e)!==ke.undefined){const s=this._getOrReturnCtx(e);return Ce(s,{code:we.invalid_type,expected:ke.void,received:s.parsedType}),at}return on(e.data)}}ah.create=n=>new ah({typeName:ot.ZodVoid,...mt(n)});class En extends vt{_parse(e){const{ctx:t,status:s}=this._processInputParams(e),i=this._def;if(t.parsedType!==ke.array)return Ce(t,{code:we.invalid_type,expected:ke.array,received:t.parsedType}),at;if(i.exactLength!==null){const a=t.data.length>i.exactLength.value,o=t.data.length<i.exactLength.value;(a||o)&&(Ce(t,{code:a?we.too_big:we.too_small,minimum:o?i.exactLength.value:void 0,maximum:a?i.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:i.exactLength.message}),s.dirty())}if(i.minLength!==null&&t.data.length<i.minLength.value&&(Ce(t,{code:we.too_small,minimum:i.minLength.value,type:"array",inclusive:!0,exact:!1,message:i.minLength.message}),s.dirty()),i.maxLength!==null&&t.data.length>i.maxLength.value&&(Ce(t,{code:we.too_big,maximum:i.maxLength.value,type:"array",inclusive:!0,exact:!1,message:i.maxLength.message}),s.dirty()),t.common.async)return Promise.all([...t.data].map((a,o)=>i.type._parseAsync(new Tn(t,a,t.path,o)))).then(a=>Cs.mergeArray(s,a));const r=[...t.data].map((a,o)=>i.type._parseSync(new Tn(t,a,t.path,o)));return Cs.mergeArray(s,r)}get element(){return this._def.type}min(e,t){return new En({...this._def,minLength:{value:e,message:He.toString(t)}})}max(e,t){return new En({...this._def,maxLength:{value:e,message:He.toString(t)}})}length(e,t){return new En({...this._def,exactLength:{value:e,message:He.toString(t)}})}nonempty(e){return this.min(1,e)}}En.create=(n,e)=>new En({type:n,minLength:null,maxLength:null,exactLength:null,typeName:ot.ZodArray,...mt(e)});function Nr(n){if(n instanceof ls){const e={};for(const t in n.shape){const s=n.shape[t];e[t]=Kn.create(Nr(s))}return new ls({...n._def,shape:()=>e})}else return n instanceof En?new En({...n._def,type:Nr(n.element)}):n instanceof Kn?Kn.create(Nr(n.unwrap())):n instanceof Zi?Zi.create(Nr(n.unwrap())):n instanceof Xi?Xi.create(n.items.map(e=>Nr(e))):n}class ls extends vt{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const e=this._def.shape(),t=Dt.objectKeys(e);return this._cached={shape:e,keys:t},this._cached}_parse(e){if(this._getType(e)!==ke.object){const c=this._getOrReturnCtx(e);return Ce(c,{code:we.invalid_type,expected:ke.object,received:c.parsedType}),at}const{status:s,ctx:i}=this._processInputParams(e),{shape:r,keys:a}=this._getCached(),o=[];if(!(this._def.catchall instanceof Ai&&this._def.unknownKeys==="strip"))for(const c in i.data)a.includes(c)||o.push(c);const l=[];for(const c of a){const d=r[c],u=i.data[c];l.push({key:{status:"valid",value:c},value:d._parse(new Tn(i,u,i.path,c)),alwaysSet:c in i.data})}if(this._def.catchall instanceof Ai){const c=this._def.unknownKeys;if(c==="passthrough")for(const d of o)l.push({key:{status:"valid",value:d},value:{status:"valid",value:i.data[d]}});else if(c==="strict")o.length>0&&(Ce(i,{code:we.unrecognized_keys,keys:o}),s.dirty());else if(c!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const c=this._def.catchall;for(const d of o){const u=i.data[d];l.push({key:{status:"valid",value:d},value:c._parse(new Tn(i,u,i.path,d)),alwaysSet:d in i.data})}}return i.common.async?Promise.resolve().then(async()=>{const c=[];for(const d of l){const u=await d.key,h=await d.value;c.push({key:u,value:h,alwaysSet:d.alwaysSet})}return c}).then(c=>Cs.mergeObjectSync(s,c)):Cs.mergeObjectSync(s,l)}get shape(){return this._def.shape()}strict(e){return He.errToObj,new ls({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(t,s)=>{const i=this._def.errorMap?.(t,s).message??s.defaultError;return t.code==="unrecognized_keys"?{message:He.errToObj(e).message??i}:{message:i}}}:{}})}strip(){return new ls({...this._def,unknownKeys:"strip"})}passthrough(){return new ls({...this._def,unknownKeys:"passthrough"})}extend(e){return new ls({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new ls({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:ot.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new ls({...this._def,catchall:e})}pick(e){const t={};for(const s of Dt.objectKeys(e))e[s]&&this.shape[s]&&(t[s]=this.shape[s]);return new ls({...this._def,shape:()=>t})}omit(e){const t={};for(const s of Dt.objectKeys(this.shape))e[s]||(t[s]=this.shape[s]);return new ls({...this._def,shape:()=>t})}deepPartial(){return Nr(this)}partial(e){const t={};for(const s of Dt.objectKeys(this.shape)){const i=this.shape[s];e&&!e[s]?t[s]=i:t[s]=i.optional()}return new ls({...this._def,shape:()=>t})}required(e){const t={};for(const s of Dt.objectKeys(this.shape))if(e&&!e[s])t[s]=this.shape[s];else{let r=this.shape[s];for(;r instanceof Kn;)r=r._def.innerType;t[s]=r}return new ls({...this._def,shape:()=>t})}keyof(){return am(Dt.objectKeys(this.shape))}}ls.create=(n,e)=>new ls({shape:()=>n,unknownKeys:"strip",catchall:Ai.create(),typeName:ot.ZodObject,...mt(e)});ls.strictCreate=(n,e)=>new ls({shape:()=>n,unknownKeys:"strict",catchall:Ai.create(),typeName:ot.ZodObject,...mt(e)});ls.lazycreate=(n,e)=>new ls({shape:n,unknownKeys:"strip",catchall:Ai.create(),typeName:ot.ZodObject,...mt(e)});class Jo extends vt{_parse(e){const{ctx:t}=this._processInputParams(e),s=this._def.options;function i(r){for(const o of r)if(o.result.status==="valid")return o.result;for(const o of r)if(o.result.status==="dirty")return t.common.issues.push(...o.ctx.common.issues),o.result;const a=r.map(o=>new ei(o.ctx.common.issues));return Ce(t,{code:we.invalid_union,unionErrors:a}),at}if(t.common.async)return Promise.all(s.map(async r=>{const a={...t,common:{...t.common,issues:[]},parent:null};return{result:await r._parseAsync({data:t.data,path:t.path,parent:a}),ctx:a}})).then(i);{let r;const a=[];for(const l of s){const c={...t,common:{...t.common,issues:[]},parent:null},d=l._parseSync({data:t.data,path:t.path,parent:c});if(d.status==="valid")return d;d.status==="dirty"&&!r&&(r={result:d,ctx:c}),c.common.issues.length&&a.push(c.common.issues)}if(r)return t.common.issues.push(...r.ctx.common.issues),r.result;const o=a.map(l=>new ei(l));return Ce(t,{code:we.invalid_union,unionErrors:o}),at}}get options(){return this._def.options}}Jo.create=(n,e)=>new Jo({options:n,typeName:ot.ZodUnion,...mt(e)});const Fn=n=>n instanceof sl?Fn(n.schema):n instanceof Ki?Fn(n.innerType()):n instanceof nl?[n.value]:n instanceof Yi?n.options:n instanceof Qc?Dt.objectValues(n.enum):n instanceof rl?Fn(n._def.innerType):n instanceof Xc?[void 0]:n instanceof Yc?[null]:n instanceof Kn?[void 0,...Fn(n.unwrap())]:n instanceof Zi?[null,...Fn(n.unwrap())]:n instanceof om||n instanceof ol?Fn(n.unwrap()):n instanceof al?Fn(n._def.innerType):[];class lu extends vt{_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==ke.object)return Ce(t,{code:we.invalid_type,expected:ke.object,received:t.parsedType}),at;const s=this.discriminator,i=t.data[s],r=this.optionsMap.get(i);return r?t.common.async?r._parseAsync({data:t.data,path:t.path,parent:t}):r._parseSync({data:t.data,path:t.path,parent:t}):(Ce(t,{code:we.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[s]}),at)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,s){const i=new Map;for(const r of t){const a=Fn(r.shape[e]);if(!a.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(const o of a){if(i.has(o))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(o)}`);i.set(o,r)}}return new lu({typeName:ot.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:i,...mt(s)})}}function Zc(n,e){const t=mi(n),s=mi(e);if(n===e)return{valid:!0,data:n};if(t===ke.object&&s===ke.object){const i=Dt.objectKeys(e),r=Dt.objectKeys(n).filter(o=>i.indexOf(o)!==-1),a={...n,...e};for(const o of r){const l=Zc(n[o],e[o]);if(!l.valid)return{valid:!1};a[o]=l.data}return{valid:!0,data:a}}else if(t===ke.array&&s===ke.array){if(n.length!==e.length)return{valid:!1};const i=[];for(let r=0;r<n.length;r++){const a=n[r],o=e[r],l=Zc(a,o);if(!l.valid)return{valid:!1};i.push(l.data)}return{valid:!0,data:i}}else return t===ke.date&&s===ke.date&&+n==+e?{valid:!0,data:n}:{valid:!1}}class el extends vt{_parse(e){const{status:t,ctx:s}=this._processInputParams(e),i=(r,a)=>{if(th(r)||th(a))return at;const o=Zc(r.value,a.value);return o.valid?((sh(r)||sh(a))&&t.dirty(),{status:t.value,value:o.data}):(Ce(s,{code:we.invalid_intersection_types}),at)};return s.common.async?Promise.all([this._def.left._parseAsync({data:s.data,path:s.path,parent:s}),this._def.right._parseAsync({data:s.data,path:s.path,parent:s})]).then(([r,a])=>i(r,a)):i(this._def.left._parseSync({data:s.data,path:s.path,parent:s}),this._def.right._parseSync({data:s.data,path:s.path,parent:s}))}}el.create=(n,e,t)=>new el({left:n,right:e,typeName:ot.ZodIntersection,...mt(t)});class Xi extends vt{_parse(e){const{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==ke.array)return Ce(s,{code:we.invalid_type,expected:ke.array,received:s.parsedType}),at;if(s.data.length<this._def.items.length)return Ce(s,{code:we.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),at;!this._def.rest&&s.data.length>this._def.items.length&&(Ce(s,{code:we.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());const r=[...s.data].map((a,o)=>{const l=this._def.items[o]||this._def.rest;return l?l._parse(new Tn(s,a,s.path,o)):null}).filter(a=>!!a);return s.common.async?Promise.all(r).then(a=>Cs.mergeArray(t,a)):Cs.mergeArray(t,r)}get items(){return this._def.items}rest(e){return new Xi({...this._def,rest:e})}}Xi.create=(n,e)=>{if(!Array.isArray(n))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Xi({items:n,typeName:ot.ZodTuple,rest:null,...mt(e)})};class tl extends vt{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==ke.object)return Ce(s,{code:we.invalid_type,expected:ke.object,received:s.parsedType}),at;const i=[],r=this._def.keyType,a=this._def.valueType;for(const o in s.data)i.push({key:r._parse(new Tn(s,o,s.path,o)),value:a._parse(new Tn(s,s.data[o],s.path,o)),alwaysSet:o in s.data});return s.common.async?Cs.mergeObjectAsync(t,i):Cs.mergeObjectSync(t,i)}get element(){return this._def.valueType}static create(e,t,s){return t instanceof vt?new tl({keyType:e,valueType:t,typeName:ot.ZodRecord,...mt(s)}):new tl({keyType:Xn.create(),valueType:e,typeName:ot.ZodRecord,...mt(t)})}}class oh extends vt{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==ke.map)return Ce(s,{code:we.invalid_type,expected:ke.map,received:s.parsedType}),at;const i=this._def.keyType,r=this._def.valueType,a=[...s.data.entries()].map(([o,l],c)=>({key:i._parse(new Tn(s,o,s.path,[c,"key"])),value:r._parse(new Tn(s,l,s.path,[c,"value"]))}));if(s.common.async){const o=new Map;return Promise.resolve().then(async()=>{for(const l of a){const c=await l.key,d=await l.value;if(c.status==="aborted"||d.status==="aborted")return at;(c.status==="dirty"||d.status==="dirty")&&t.dirty(),o.set(c.value,d.value)}return{status:t.value,value:o}})}else{const o=new Map;for(const l of a){const c=l.key,d=l.value;if(c.status==="aborted"||d.status==="aborted")return at;(c.status==="dirty"||d.status==="dirty")&&t.dirty(),o.set(c.value,d.value)}return{status:t.value,value:o}}}}oh.create=(n,e,t)=>new oh({valueType:e,keyType:n,typeName:ot.ZodMap,...mt(t)});class Pa extends vt{_parse(e){const{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==ke.set)return Ce(s,{code:we.invalid_type,expected:ke.set,received:s.parsedType}),at;const i=this._def;i.minSize!==null&&s.data.size<i.minSize.value&&(Ce(s,{code:we.too_small,minimum:i.minSize.value,type:"set",inclusive:!0,exact:!1,message:i.minSize.message}),t.dirty()),i.maxSize!==null&&s.data.size>i.maxSize.value&&(Ce(s,{code:we.too_big,maximum:i.maxSize.value,type:"set",inclusive:!0,exact:!1,message:i.maxSize.message}),t.dirty());const r=this._def.valueType;function a(l){const c=new Set;for(const d of l){if(d.status==="aborted")return at;d.status==="dirty"&&t.dirty(),c.add(d.value)}return{status:t.value,value:c}}const o=[...s.data.values()].map((l,c)=>r._parse(new Tn(s,l,s.path,c)));return s.common.async?Promise.all(o).then(l=>a(l)):a(o)}min(e,t){return new Pa({...this._def,minSize:{value:e,message:He.toString(t)}})}max(e,t){return new Pa({...this._def,maxSize:{value:e,message:He.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}Pa.create=(n,e)=>new Pa({valueType:n,minSize:null,maxSize:null,typeName:ot.ZodSet,...mt(e)});class sl extends vt{get schema(){return this._def.getter()}_parse(e){const{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}}sl.create=(n,e)=>new sl({getter:n,typeName:ot.ZodLazy,...mt(e)});class nl extends vt{_parse(e){if(e.data!==this._def.value){const t=this._getOrReturnCtx(e);return Ce(t,{received:t.data,code:we.invalid_literal,expected:this._def.value}),at}return{status:"valid",value:e.data}}get value(){return this._def.value}}nl.create=(n,e)=>new nl({value:n,typeName:ot.ZodLiteral,...mt(e)});function am(n,e){return new Yi({values:n,typeName:ot.ZodEnum,...mt(e)})}class Yi extends vt{_parse(e){if(typeof e.data!="string"){const t=this._getOrReturnCtx(e),s=this._def.values;return Ce(t,{expected:Dt.joinValues(s),received:t.parsedType,code:we.invalid_type}),at}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){const t=this._getOrReturnCtx(e),s=this._def.values;return Ce(t,{received:t.data,code:we.invalid_enum_value,options:s}),at}return on(e.data)}get options(){return this._def.values}get enum(){const e={};for(const t of this._def.values)e[t]=t;return e}get Values(){const e={};for(const t of this._def.values)e[t]=t;return e}get Enum(){const e={};for(const t of this._def.values)e[t]=t;return e}extract(e,t=this._def){return Yi.create(e,{...this._def,...t})}exclude(e,t=this._def){return Yi.create(this.options.filter(s=>!e.includes(s)),{...this._def,...t})}}Yi.create=am;class Qc extends vt{_parse(e){const t=Dt.getValidEnumValues(this._def.values),s=this._getOrReturnCtx(e);if(s.parsedType!==ke.string&&s.parsedType!==ke.number){const i=Dt.objectValues(t);return Ce(s,{expected:Dt.joinValues(i),received:s.parsedType,code:we.invalid_type}),at}if(this._cache||(this._cache=new Set(Dt.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){const i=Dt.objectValues(t);return Ce(s,{received:s.data,code:we.invalid_enum_value,options:i}),at}return on(e.data)}get enum(){return this._def.values}}Qc.create=(n,e)=>new Qc({values:n,typeName:ot.ZodNativeEnum,...mt(e)});class il extends vt{unwrap(){return this._def.type}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==ke.promise&&t.common.async===!1)return Ce(t,{code:we.invalid_type,expected:ke.promise,received:t.parsedType}),at;const s=t.parsedType===ke.promise?t.data:Promise.resolve(t.data);return on(s.then(i=>this._def.type.parseAsync(i,{path:t.path,errorMap:t.common.contextualErrorMap})))}}il.create=(n,e)=>new il({type:n,typeName:ot.ZodPromise,...mt(e)});class Ki extends vt{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===ot.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:t,ctx:s}=this._processInputParams(e),i=this._def.effect||null,r={addIssue:a=>{Ce(s,a),a.fatal?t.abort():t.dirty()},get path(){return s.path}};if(r.addIssue=r.addIssue.bind(r),i.type==="preprocess"){const a=i.transform(s.data,r);if(s.common.async)return Promise.resolve(a).then(async o=>{if(t.value==="aborted")return at;const l=await this._def.schema._parseAsync({data:o,path:s.path,parent:s});return l.status==="aborted"?at:l.status==="dirty"||t.value==="dirty"?Aa(l.value):l});{if(t.value==="aborted")return at;const o=this._def.schema._parseSync({data:a,path:s.path,parent:s});return o.status==="aborted"?at:o.status==="dirty"||t.value==="dirty"?Aa(o.value):o}}if(i.type==="refinement"){const a=o=>{const l=i.refinement(o,r);if(s.common.async)return Promise.resolve(l);if(l instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return o};if(s.common.async===!1){const o=this._def.schema._parseSync({data:s.data,path:s.path,parent:s});return o.status==="aborted"?at:(o.status==="dirty"&&t.dirty(),a(o.value),{status:t.value,value:o.value})}else return this._def.schema._parseAsync({data:s.data,path:s.path,parent:s}).then(o=>o.status==="aborted"?at:(o.status==="dirty"&&t.dirty(),a(o.value).then(()=>({status:t.value,value:o.value}))))}if(i.type==="transform")if(s.common.async===!1){const a=this._def.schema._parseSync({data:s.data,path:s.path,parent:s});if(!Ur(a))return at;const o=i.transform(a.value,r);if(o instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:o}}else return this._def.schema._parseAsync({data:s.data,path:s.path,parent:s}).then(a=>Ur(a)?Promise.resolve(i.transform(a.value,r)).then(o=>({status:t.value,value:o})):at);Dt.assertNever(i)}}Ki.create=(n,e,t)=>new Ki({schema:n,typeName:ot.ZodEffects,effect:e,...mt(t)});Ki.createWithPreprocess=(n,e,t)=>new Ki({schema:e,effect:{type:"preprocess",transform:n},typeName:ot.ZodEffects,...mt(t)});class Kn extends vt{_parse(e){return this._getType(e)===ke.undefined?on(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}Kn.create=(n,e)=>new Kn({innerType:n,typeName:ot.ZodOptional,...mt(e)});class Zi extends vt{_parse(e){return this._getType(e)===ke.null?on(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}Zi.create=(n,e)=>new Zi({innerType:n,typeName:ot.ZodNullable,...mt(e)});class rl extends vt{_parse(e){const{ctx:t}=this._processInputParams(e);let s=t.data;return t.parsedType===ke.undefined&&(s=this._def.defaultValue()),this._def.innerType._parse({data:s,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}rl.create=(n,e)=>new rl({innerType:n,typeName:ot.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...mt(e)});class al extends vt{_parse(e){const{ctx:t}=this._processInputParams(e),s={...t,common:{...t.common,issues:[]}},i=this._def.innerType._parse({data:s.data,path:s.path,parent:{...s}});return Zo(i)?i.then(r=>({status:"valid",value:r.status==="valid"?r.value:this._def.catchValue({get error(){return new ei(s.common.issues)},input:s.data})})):{status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new ei(s.common.issues)},input:s.data})}}removeCatch(){return this._def.innerType}}al.create=(n,e)=>new al({innerType:n,typeName:ot.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...mt(e)});class lh extends vt{_parse(e){if(this._getType(e)!==ke.nan){const s=this._getOrReturnCtx(e);return Ce(s,{code:we.invalid_type,expected:ke.nan,received:s.parsedType}),at}return{status:"valid",value:e.data}}}lh.create=n=>new lh({typeName:ot.ZodNaN,...mt(n)});class om extends vt{_parse(e){const{ctx:t}=this._processInputParams(e),s=t.data;return this._def.type._parse({data:s,path:t.path,parent:t})}unwrap(){return this._def.type}}class cu extends vt{_parse(e){const{status:t,ctx:s}=this._processInputParams(e);if(s.common.async)return(async()=>{const r=await this._def.in._parseAsync({data:s.data,path:s.path,parent:s});return r.status==="aborted"?at:r.status==="dirty"?(t.dirty(),Aa(r.value)):this._def.out._parseAsync({data:r.value,path:s.path,parent:s})})();{const i=this._def.in._parseSync({data:s.data,path:s.path,parent:s});return i.status==="aborted"?at:i.status==="dirty"?(t.dirty(),{status:"dirty",value:i.value}):this._def.out._parseSync({data:i.value,path:s.path,parent:s})}}static create(e,t){return new cu({in:e,out:t,typeName:ot.ZodPipeline})}}class ol extends vt{_parse(e){const t=this._def.innerType._parse(e),s=i=>(Ur(i)&&(i.value=Object.freeze(i.value)),i);return Zo(t)?t.then(i=>s(i)):s(t)}unwrap(){return this._def.innerType}}ol.create=(n,e)=>new ol({innerType:n,typeName:ot.ZodReadonly,...mt(e)});var ot;(function(n){n.ZodString="ZodString",n.ZodNumber="ZodNumber",n.ZodNaN="ZodNaN",n.ZodBigInt="ZodBigInt",n.ZodBoolean="ZodBoolean",n.ZodDate="ZodDate",n.ZodSymbol="ZodSymbol",n.ZodUndefined="ZodUndefined",n.ZodNull="ZodNull",n.ZodAny="ZodAny",n.ZodUnknown="ZodUnknown",n.ZodNever="ZodNever",n.ZodVoid="ZodVoid",n.ZodArray="ZodArray",n.ZodObject="ZodObject",n.ZodUnion="ZodUnion",n.ZodDiscriminatedUnion="ZodDiscriminatedUnion",n.ZodIntersection="ZodIntersection",n.ZodTuple="ZodTuple",n.ZodRecord="ZodRecord",n.ZodMap="ZodMap",n.ZodSet="ZodSet",n.ZodFunction="ZodFunction",n.ZodLazy="ZodLazy",n.ZodLiteral="ZodLiteral",n.ZodEnum="ZodEnum",n.ZodEffects="ZodEffects",n.ZodNativeEnum="ZodNativeEnum",n.ZodOptional="ZodOptional",n.ZodNullable="ZodNullable",n.ZodDefault="ZodDefault",n.ZodCatch="ZodCatch",n.ZodPromise="ZodPromise",n.ZodBranded="ZodBranded",n.ZodPipeline="ZodPipeline",n.ZodReadonly="ZodReadonly"})(ot||(ot={}));const H=Xn.create,ge=Fr.create,is=qc.create,du=Kc.create;Ai.create;const At=En.create,_e=ls.create;Jo.create;const lm=lu.create;el.create;const cm=Xi.create,QM=tl.create,JM=sl.create,It=nl.create,cs=Yi.create;il.create;Kn.create;Zi.create;const eb=cs(["ok","error"]),tb=_e({type:cs(["error","warning"]),message:H()}),sb=_e({kind:H(),data:du()}),nb=_e({input:H(),proposed:H(),validated:is(),executed:H().optional()}),dm=_e({status:eb,rendered:H(),renderedErr:H().optional(),model:sb.optional(),errors:At(tb).optional(),trace:nb.optional()}),ib=cs(["data","err","status"]),rb=_e({shellCommands:is(),hiddenInput:is().optional(),color:is().optional(),fileDelivery:is().optional(),localFilesystem:is().optional()}),ab=_e({type:It("attach"),protocolVersion:ge().int(),token:H(),session:H().optional(),capabilities:rb.optional()}),ob=_e({type:It("execute"),id:H(),line:H(),instrument:is().optional()}),lb=_e({type:It("cancel"),id:H()}),cb=_e({type:It("complete"),id:H(),prefix:H()}),db=_e({type:It("promptAnswer"),promptId:H(),answer:H()}),ub=_e({type:It("promptError"),promptId:H(),reason:H()}),hb=_e({type:It("pipeResult"),pipeId:H(),output:H()}),fb=_e({type:It("pipeError"),pipeId:H(),reason:H()}),pb=_e({type:It("shellResult"),shellId:H(),exitCode:ge().int()}),mb=_e({type:It("shellError"),shellId:H(),reason:H()}),gb=_e({type:It("editResult"),editId:H(),content:H(),changed:is()}),Mb=_e({type:It("editError"),editId:H(),reason:H()}),bb=_e({type:It("deliverResult"),deliverId:H(),location:H(),bytes:ge().nonnegative()}),zb=_e({type:It("deliverError"),deliverId:H(),reason:H()}),_b=_e({address:H(),modelKind:H().optional(),groupId:H(),paneId:H()}),um=_e({type:It("regard"),regard:_b}),wb=_e({type:It("watch"),subject:H()}),yb=_e({type:It("unwatch"),subject:H()}),vb=["live","settled","stale"],Ob=cs(vb),xb=_e({type:It("watched"),subject:H(),state:Ob}),Sb=_e({type:It("numbered"),id:ge(),source:H(),rows:ge(),handles:At(_e({kind:H(),ordinal:ge(),address:H()}))});lm("type",[ab,ob,lb,cb,db,ub,hb,fb,pb,mb,gb,Mb,bb,zb,um,wb,yb]);const Ab=_e({type:It("attached"),session:H(),protocolVersion:ge().int(),stack:_e({chell:H(),calypso:H(),build:H(),brasa:H().optional(),chili:H().optional(),salsa:H().optional(),cumin:H().optional()}).optional(),hostControl:At(H()).optional()}),Eb=_e({type:It("result"),id:H(),envelopes:At(dm)}),Db=_e({type:It("complete"),id:H(),prefix:H(),candidates:At(H())}),Ib=_e({type:It("output"),id:H(),channel:ib,chunk:H()}),Tb=cs(yM).catch("task"),Gb=cs(vM).catch(void 0),Rb=cs(OM).catch("working"),Bb=cs(xM).catch(void 0),Nb=cs(SM).catch("unknown"),Cb=_e({type:It("progress"),id:H(),operation:Tb,kind:Gb.optional(),phase:Rb,label:H().optional(),itemId:H().optional(),current:ge().nonnegative().optional(),total:ge().nonnegative().optional(),percent:ge().min(0).max(100).optional(),unit:Bb.optional(),status:Nb.optional(),path:H().optional()}),Pb=_e({type:It("session"),surface:H(),envelope:dm}),Lb=_e({type:It("error"),id:H().optional(),reason:H()}),Wb=["text","secret","confirm","path"],kb=cs(Wb).catch("text"),Ub=_e({anchor:H().optional(),wantsDirectory:is(),suggest:H().optional()}),Fb=_e({type:It("prompt"),promptId:H(),message:H(),hidden:is(),wants:kb.optional(),path:Ub.optional(),commit:H().optional()});function jb(n){return n.wants!==void 0?n.wants:n.hidden===!0?"secret":"text"}const $b=_e({user:H(),uri:H(),cwd:H(),pacsserver:H().nullable(),physicalMode:is(),lastExitCode:ge(),lastCommandDurationMs:ge(),procWarmup:_e({loaded:ge(),total:ge().optional(),restored:is().optional(),state:cs(_M).optional(),sweeping:is().optional(),feed:_e({id:ge(),loaded:ge(),total:ge(),failed:H().optional()}).optional(),feeds:At(_e({id:ge(),loaded:ge(),total:ge(),failed:H().optional()})).optional(),arrived:At(ge()).optional(),landed:At(_e({id:ge(),title:H().default(""),jobs:ge(),status:H(),chain:At(H()),groups:At(_e({plugin:H(),count:ge(),errored:ge().default(0),status:H(),parent:ge().nullable()})).default([])})).optional(),roster:cs(["delta","full"]).optional()}).optional(),procIndex:_e({jobs:ge(),feeds:ge()}).optional(),warmupFailures:At(_e({label:H(),message:H()})).optional()}),Vb=_e({type:It("promptline"),context:$b}),Hb=_e({type:It("pipe"),pipeId:H(),command:H(),input:H()}),qb=_e({type:It("shell"),shellId:H(),command:H()}),Xb=_e({type:It("edit"),editId:H(),content:H(),extension:H().optional()}),Yb=_e({type:It("deliver"),deliverId:H(),path:H(),filename:H(),destination:H().optional(),size:ge().nonnegative().optional(),contentType:H().optional()}),Kb=_e({type:It("telemetry"),index:_e({jobs:ge(),feeds:ge()}),lane:_e({running:_e({line:H(),sinceMs:ge(),surface:H()}).nullable(),waiting:ge()}).optional(),cube:_e({msPerPage:ge(),samples:ge()}).optional(),state:_e({running:ge(),runningFeeds:ge(),scheduled:ge(),errored:ge(),erroredFeeds:ge()}).optional()}),hm=lm("type",[Ab,Eb,Db,Ib,Cb,Pb,Lb,Fb,Vb,Kb,Hb,qb,Xb,Yb,um,xb,Sb]);new Set(hm.options.map(n=>n.shape.type.value));function Zb(n){return n.issues.map(e=>{const t=e.path.join(".");return t?`${t}: ${e.message}`:e.message}).join("; ")}function Qb(n,e){const t=n.safeParse(e);return t.success?{ok:!0,value:t.data}:{ok:!1,error:Zb(t.error)}}function Jb(n){return Qb(hm,n)}const fm=_e({id:H(),label:H(),parentIds:At(H()),joinParentIds:At(H())}),e0=_e({name:H(),value:du()}),t0=fm.extend({pluginName:H(),pluginVersion:H().optional(),arguments:At(e0).optional()}),Jc=_e({name:H(),pipelineId:ge().optional(),nodes:At(t0)}),s0=["created","waiting","scheduled","started","registeringFiles","finishedSuccessfully","finishedWithError","cancelled","unknown"],pm=cs(s0).catch("unknown"),n0=_e({count:ge(),done:ge(),error:ge(),running:ge(),other:ge(),anomalies:At(_e({id:H(),status:pm})).optional()}),i0=_e({computeSeconds:ge().optional(),dataBytes:ge().optional()}),r0=fm.extend({instanceId:ge(),pluginName:H(),pluginVersion:H().optional(),status:pm,vfsPath:H(),metrics:i0.optional(),tally:n0.optional(),computeResource:H().optional()}),ed=_e({feedId:ge(),feedName:H(),nodes:At(r0)}),a0=_e({feedId:ge(),loaded:ge(),total:ge(),failed:H().optional()}),zi={pipelineDiagram:"pipeline.diagram",feedDag:"feed.dag",feedIndexing:"feed.indexing"},o0=_e({id:ge(),title:H(),owner:H(),status:H(),createdAt:H(),sizeBytes:ge().optional(),wallSeconds:ge().optional(),jobsDone:ge().optional(),jobsTotal:ge().optional(),jobsErrored:ge().optional()}),mm=_e({feeds:At(o0)}),gm="feed.list",l0=_e({plugin:H(),count:ge(),errored:ge().default(0),status:H(),parent:ge().nullable()}),c0=_e({format:cs(["dicom","nifti","mgz","jpeg","png","other","unknown"]),modality:H().optional(),seriesDescription:H().optional(),reason:H().optional(),sourceFeed:ge().optional()}),d0=_e({id:ge(),title:H().default(""),jobs:ge(),status:H(),chain:At(H()),groups:At(l0).default([]),createdAt:H().default(""),data:c0.optional()}),Mm=_e({feeds:At(d0),whole:is()}),bm="proc.universe",u0=_e({name:H(),positions:QM(H(),cm([ge(),ge(),ge()])).nullable(),writtenAt:H().nullable(),laying:_e({nodes:ge(),fraction:ge()}).nullable().optional()}),h0="proc.layout",f0=_e({name:H(),type:H(),optional:is(),default:du().optional(),help:H().optional(),flag:H()}),p0=_e({id:ge().optional(),name:H(),version:H(),type:H(),title:H().optional(),description:H().optional(),authors:H().optional(),documentation:H().optional(),category:H().optional(),parameters:At(f0),command:H().optional()}),m0="plugin.info",g0=_e({seriesUID:H(),description:H(),modality:H(),fileCount:ge().optional(),vfsPath:H().optional(),pulled:is().optional(),pulledFiles:ge().optional(),folderPath:H().optional()}),M0=_e({studyUID:H().optional(),server:H().optional(),vfsPath:H().optional(),description:H(),patientName:H(),patientId:H(),date:H(),modalities:H(),accession:H(),series:At(g0)}),zm=_e({replayed:is(),answeredAt:H()}),b0=["found","none","unasked"],z0=cs(b0).catch("unasked"),_0=_e({patientId:H(),server:H().optional(),patientName:H().optional(),status:z0,studyCount:ge(),seriesCount:ge(),queryId:ge().optional(),provenance:zm.optional(),error:H().optional()}),w0=_e({queryId:ge(),vfsPath:H(),pacsName:H(),expression:H(),studies:At(M0),provenance:zm.optional(),patients:At(_0).optional()}),y0=_e({id:ge(),identifier:H(),active:is()}),v0=_e({servers:At(y0)}),O0="pacs.servers",x0="pacs.query";function S0(n){return`pacs:patient:${n.server??"-"}:${n.patientId}`}const A0=["patient","study","series","image","equipment","meta","private","other"],_m=cs(A0).catch("other"),wm=JM(()=>_e({tag:H(),name:H(),vr:H(),value:H(),group:_m,phi:is(),decoded:H().optional(),items:At(At(wm)).optional()})),E0=_e({tag:H(),name:H(),vr:H(),group:_m,phi:is(),distinct:ge(),first:H(),last:H(),values:At(_e({path:H(),value:H().nullable()}))}),ch=_e({path:H(),subject:cs(["file","folder"]),read:ge(),of:ge(),refused:At(H()),constant:At(wm),varying:At(E0)}),D0=_e({rows:ge(),columns:ge(),pixelSpacing:cm([ge(),ge()]).optional(),sliceThickness:ge().optional(),spacingBetweenSlices:ge().optional()}),dh=_e({path:H(),seriesInstanceUID:H().optional(),studyInstanceUID:H().optional(),modality:H(),seriesDescription:H(),seriesNumber:ge().optional(),instances:ge(),frames:ge(),order:cs(["filename","unknown"]),geometry:D0.optional(),transferSyntax:_e({uid:H(),name:H().optional()}).optional(),bytes:ge(),header:H(),files:At(H()),annotations:At(H())}),Ha={tags:"dicom.tags",series:"dicom.series"},I0=_e({path:H(),target:cs(["series","volume"]),force:is().optional(),startAt:ge().int().positive().optional()}),T0={view:"image.view"},G0=_e({state:cs(["cold","warming","current"]),loaded:ge(),total:ge()});_e({user:H(),surface:H(),feeds:_e({total:ge(),own:ge(),shared:ge(),public:ge()}),jobs:_e({total:ge(),finished:ge(),errored:ge(),cancelled:ge(),running:ge(),scheduled:ge()}),failureRate:ge().nullable(),index:G0,fortune:H()});function Es(n){return n.groups.map(e=>`${e.parent??"r"}:${e.plugin}`).join(">")}function wi(n,e){return`feed:${n}:${e}`}function ym(n){return`shape:${n}`}function jr(n){return Math.log2(Math.max(1,n)+1)}function uu(n){if(!(n.errored<=0||n.count<=0))return Math.min(1,n.errored/n.count)}function Fa(n,e="jobs"){const t=[],s=new Set,i=[...n].sort((a,o)=>a.id-o.id),r=new Map;for(const a of i){if(a.groups.length===0)continue;const o=Es(a);r.set(o,(r.get(o)??0)+1)}for(const a of i){if(a.groups.length===0)continue;const o=Es(a),l=ym(o);s.has(o)||(s.add(o),t.push({id:l,label:vl(o),parentIds:[],joinParentIds:[],ghost:!0,halo:!0,metric:1,count:r.get(o)??1})),a.groups.forEach((c,d)=>{const u=uu(c);t.push({id:wi(a.id,d),label:c.plugin,parentIds:[c.parent===null?l:wi(a.id,c.parent)],joinParentIds:[],status:c.status,metric:e==="jobs"?jr(c.count):1,...c.count>1?{count:c.count}:{},...u!==void 0?{share:u}:{}})})}return{nodes:t}}const td="plugin:";function R0(n){return`${td}${n}`}function sd(n){return n.startsWith(td)?n.slice(td.length):null}function hu(n,e="jobs"){const t=[],s=new Map,i=[...n].sort((r,a)=>r.id-a.id);for(const r of i)if(r.groups.length!==0){for(const a of new Set(r.groups.map(o=>o.plugin)))s.set(a,(s.get(a)??0)+1);r.groups.forEach((a,o)=>{const l=uu(a);t.push({id:wi(r.id,o),label:a.plugin,parentIds:a.parent===null?[]:[wi(r.id,a.parent)],joinParentIds:[],status:a.status,metric:e==="jobs"?jr(a.count):1,attrs:{plugin:a.plugin},...a.count>1?{count:a.count}:{},...l!==void 0?{share:l}:{}})})}for(const[r,a]of[...s].sort((o,l)=>o[0]<l[0]?-1:1))t.push({id:R0(r),label:r,parentIds:[],joinParentIds:[],metric:1+Math.log(a),hue:"#e8f4ff",ring:!0,attrs:{kind:"star",plugin:r}});return{nodes:t}}function uh(n,e="jobs"){const t=new Map;for(const i of n){const r=i.createdAt===void 0?Number.NaN:Date.parse(i.createdAt);Number.isFinite(r)&&t.set(i.id,r)}return{nodes:hu(n,e).nodes.filter(i=>i.attrs?.kind!=="star").map(i=>{const r=t.get(Number(i.id.split(":")[1]));return r===void 0?i:{...i,attrs:{...i.attrs,createdAt:r}}})}}function vl(n){const e=[];for(const t of n.split(">")){const s=t.slice(t.indexOf(":")+1);s.length>0&&!e.includes(s)&&e.push(s)}return e.join(" > ")}const B0=.5,N0=5,C0=.02,nd="data:",P0={dicom:"DICOM",nifti:"NIfTI",mgz:"MGZ",jpeg:"JPEG",png:"PNG",other:"OTHER",unknown:"UNREADABLE",unread:"NOT YET READ"};function L0(n){const e=n.toUpperCase().replace(/[_\-.,/\\()[\]:;+]+/g," ").split(/\s+/).filter(t=>t.length>0).filter(t=>!/^\d+$/.test(t)).filter(t=>!/^\d+X\d+$/.test(t)).filter(t=>!/^FOV\d*$/.test(t)).filter(t=>!/^\d+(\.\d+)?(MM|CM)$/.test(t));return[...new Set(e)]}function W0(n,e){if(n.length===0||e.length===0)return 0;const t=new Set(n);return e.filter(i=>t.has(i)).length/Math.min(n.length,e.length)}function vm(n){const e=new Map;for(const r of n)e.set(r,(e.get(r)??0)+1);const t=[...e.keys()].sort((r,a)=>(e.get(a)??0)-(e.get(r)??0)||(r<a?-1:1)),s=[],i=new Map;for(const r of t){const a=L0(r),o=a.length===0?void 0:s.find(l=>W0(l.words,a)>=B0);if(o!==void 0){i.set(r,o.name);continue}s.push({name:r,words:a}),i.set(r,r)}return i}function Om(n,e){const t=n.data?.format??"unread",s=[{key:t,label:P0[t]??t.toUpperCase()}];if(t!=="dicom")return s;const i=n.data?.modality??"NO MODALITY";s.push({key:`${t}/${i}`,label:i});const r=n.data?.seriesDescription,a=r===void 0?"NO DESCRIPTION":e.get(r)??r;return s.push({key:`${t}/${i}/${a}`,label:a}),s}function Fl(n){return`${nd}${n}`}function id(n){return n.startsWith(nd)?n.slice(nd.length):null}function hh(n,e="jobs"){const t=[...n].filter(d=>d.groups.length>0).sort((d,u)=>d.id-u.id),s=vm(t.map(d=>d.data?.seriesDescription).filter(d=>d!==void 0)),i=new Map,r=[];for(const d of t){const u=Om(d,s);let h=null;for(const p of u){const z=i.get(p.key);z===void 0?i.set(p.key,{label:p.label,feeds:1,parent:h}):z.feeds+=1,h=p.key}const g=Fl(h);d.groups.forEach((p,z)=>{const m=uu(p);r.push({id:wi(d.id,z),label:p.plugin,parentIds:[p.parent===null?g:wi(d.id,p.parent)],joinParentIds:[],status:p.status,metric:e==="jobs"?jr(p.count):1,...p.count>1?{count:p.count}:{},...m!==void 0?{share:m}:{}})})}const a=new Map;for(const d of t){const u=d.groups.findIndex(h=>h.parent===null);u>=0&&a.set(d.id,wi(d.id,u))}const o=new Map(r.map(d=>[d.id,d]));for(const d of t){const u=d.data?.sourceFeed,h=u===void 0||u===d.id?void 0:a.get(u),g=a.get(d.id);if(h===void 0||g===void 0)continue;const p=o.get(g);p!==void 0&&(p.joinParentIds=[...p.joinParentIds,h],p.joinFaint=!0)}const l=(d,u)=>d.split("/").length<3||u>=Math.max(N0,C0*t.length);return{graph:{nodes:[...[...i].map(([d,u])=>({id:Fl(d),label:u.label,parentIds:u.parent===null?[]:[Fl(u.parent)],joinParentIds:[],ghost:!0,halo:!0,metric:1,count:u.feeds,...l(d,u.feeds)?{caption:`${u.label} · ${u.feeds.toLocaleString("en-US")}`}:{}})),...r]},hubs:new Map([...i].map(([d,u])=>[d,{label:u.label,feeds:u.feeds}]))}}function k0(n,e){const t=id(n);if(t===null)return null;const s=t.split("/"),i=s.map((a,o)=>e.get(s.slice(0,o+1).join("/"))?.label??s[o]??""),r=e.get(t)?.feeds??0;return`${i.join(" · ")} · ${r.toLocaleString("en-US")} feed${r===1?"":"s"}`}const rd=12,U0=240;function F0(n){return n<=U0?rd:void 0}function ad(n,e){return`fold:${n}:${e}`}function xm(n){const e=n.match(/^fold:(.+):\d+$/);return e===null?null:e[1]}function j0(n){const e=n.match(/^feed:(\d+):/);if(e!==null)return`feed:${e[1]}`;const t=xm(n);return t===null?null:`fold:${t}`}const fu="185",$0=0,fh=1,V0=2,Po=1,H0=2,Ea=3,Ei=0,ks=1,Hn=2,Zn=0,$i=1,Qi=2,ph=3,mh=4,q0=5,Wi=100,X0=101,Y0=102,K0=103,Z0=104,Q0=200,J0=201,ez=202,tz=203,od=204,ld=205,sz=206,nz=207,iz=208,rz=209,az=210,oz=211,lz=212,cz=213,dz=214,cd=0,dd=1,ud=2,$r=3,hd=4,fd=5,pd=6,md=7,Sm=0,uz=1,hz=2,Dn=0,Am=1,Em=2,Dm=3,Im=4,Tm=5,Gm=6,Rm=7,Bm=300,Ji=301,Vr=302,jl=303,$l=304,Ol=306,gd=1e3,Yn=1001,Md=1002,ys=1003,fz=1004,qa=1005,Ds=1006,Vl=1007,Fi=1008,Zs=1009,Nm=1010,Cm=1011,La=1012,pu=1013,Gn=1014,Mn=1015,ti=1016,mu=1017,gu=1018,Wa=1020,Pm=35902,Lm=35899,Wm=1021,km=1022,bn=1023,si=1026,ji=1027,Mu=1028,bu=1029,er=1030,zu=1031,_u=1033,Lo=33776,Wo=33777,ko=33778,Uo=33779,bd=35840,zd=35841,_d=35842,wd=35843,yd=36196,vd=37492,Od=37496,xd=37488,Sd=37489,ll=37490,Ad=37491,Ed=37808,Dd=37809,Id=37810,Td=37811,Gd=37812,Rd=37813,Bd=37814,Nd=37815,Cd=37816,Pd=37817,Ld=37818,Wd=37819,kd=37820,Ud=37821,Fd=36492,jd=36494,$d=36495,Vd=36283,Hd=36284,cl=36285,qd=36286,pz=3200,Xd=0,mz=1,bi="",sn="srgb",dl="srgb-linear",ul="linear",kt="srgb",dr=7680,gh=519,gz=512,Mz=513,bz=514,wu=515,zz=516,_z=517,yu=518,wz=519,Yd=35044,Mh="300 es",An=2e3,ka=2001;function yz(n){for(let e=n.length-1;e>=0;--e)if(n[e]>=65535)return!0;return!1}function hl(n){return document.createElementNS("http://www.w3.org/1999/xhtml",n)}function vz(){const n=hl("canvas");return n.style.display="block",n}const bh={};function fl(...n){const e="THREE."+n.shift();console.log(e,...n)}function Um(n){const e=n[0];if(typeof e=="string"&&e.startsWith("TSL:")){const t=n[1];t&&t.isStackTrace?n[0]+=" "+t.getLocation():n[1]='Stack trace not available. Enable "THREE.Node.captureStackTrace" to capture stack traces.'}return n}function st(...n){n=Um(n);const e="THREE."+n.shift();{const t=n[0];t&&t.isStackTrace?console.warn(t.getError(e)):console.warn(e,...n)}}function Ot(...n){n=Um(n);const e="THREE."+n.shift();{const t=n[0];t&&t.isStackTrace?console.error(t.getError(e)):console.error(e,...n)}}function Pr(...n){const e=n.join(" ");e in bh||(bh[e]=!0,st(...n))}function Oz(n,e,t){return new Promise(function(s,i){function r(){switch(n.clientWaitSync(e,n.SYNC_FLUSH_COMMANDS_BIT,0)){case n.WAIT_FAILED:i();break;case n.TIMEOUT_EXPIRED:setTimeout(r,t);break;default:s()}}setTimeout(r,t)})}const xz={[cd]:dd,[ud]:pd,[hd]:md,[$r]:fd,[dd]:cd,[pd]:ud,[md]:hd,[fd]:$r};class ir{addEventListener(e,t){this._listeners===void 0&&(this._listeners={});const s=this._listeners;s[e]===void 0&&(s[e]=[]),s[e].indexOf(t)===-1&&s[e].push(t)}hasEventListener(e,t){const s=this._listeners;return s===void 0?!1:s[e]!==void 0&&s[e].indexOf(t)!==-1}removeEventListener(e,t){const s=this._listeners;if(s===void 0)return;const i=s[e];if(i!==void 0){const r=i.indexOf(t);r!==-1&&i.splice(r,1)}}dispatchEvent(e){const t=this._listeners;if(t===void 0)return;const s=t[e.type];if(s!==void 0){e.target=this;const i=s.slice(0);for(let r=0,a=i.length;r<a;r++)i[r].call(this,e);e.target=null}}}const Ss=["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"],Hl=Math.PI/180,Kd=180/Math.PI;function yi(){const n=Math.random()*4294967295|0,e=Math.random()*4294967295|0,t=Math.random()*4294967295|0,s=Math.random()*4294967295|0;return(Ss[n&255]+Ss[n>>8&255]+Ss[n>>16&255]+Ss[n>>24&255]+"-"+Ss[e&255]+Ss[e>>8&255]+"-"+Ss[e>>16&15|64]+Ss[e>>24&255]+"-"+Ss[t&63|128]+Ss[t>>8&255]+"-"+Ss[t>>16&255]+Ss[t>>24&255]+Ss[s&255]+Ss[s>>8&255]+Ss[s>>16&255]+Ss[s>>24&255]).toLowerCase()}function St(n,e,t){return Math.max(e,Math.min(t,n))}function Sz(n,e){return(n%e+e)%e}function ql(n,e,t){return(1-t)*n+t*e}function xn(n,e){switch(e.constructor){case Float32Array:return n;case Uint32Array:return n/4294967295;case Uint16Array:return n/65535;case Uint8Array:return n/255;case Int32Array:return Math.max(n/2147483647,-1);case Int16Array:return Math.max(n/32767,-1);case Int8Array:return Math.max(n/127,-1);default:throw new Error("THREE.MathUtils: Invalid component type.")}}function Ft(n,e){switch(e.constructor){case Float32Array:return n;case Uint32Array:return Math.round(n*4294967295);case Uint16Array:return Math.round(n*65535);case Uint8Array:return Math.round(n*255);case Int32Array:return Math.round(n*2147483647);case Int16Array:return Math.round(n*32767);case Int8Array:return Math.round(n*127);default:throw new Error("THREE.MathUtils: Invalid component type.")}}const qu=class qu{constructor(e=0,t=0){this.x=e,this.y=t}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,t){return this.x=e,this.y=t,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,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;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,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,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,t){return this.x=e.x-t.x,this.y=e.y-t.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 t=this.x,s=this.y,i=e.elements;return this.x=i[0]*t+i[3]*s+i[6],this.y=i[1]*t+i[4]*s+i[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,t){return this.x=St(this.x,e.x,t.x),this.y=St(this.y,e.y,t.y),this}clampScalar(e,t){return this.x=St(this.x,e,t),this.y=St(this.y,e,t),this}clampLength(e,t){const s=this.length();return this.divideScalar(s||1).multiplyScalar(St(s,e,t))}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 t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;const s=this.dot(e)/t;return Math.acos(St(s,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,s=this.y-e.y;return t*t+s*s}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this}lerpVectors(e,t,s){return this.x=e.x+(t.x-e.x)*s,this.y=e.y+(t.y-e.y)*s,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this}rotateAround(e,t){const s=Math.cos(t),i=Math.sin(t),r=this.x-e.x,a=this.y-e.y;return this.x=r*s-a*i+e.x,this.y=r*i+a*s+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}};qu.prototype.isVector2=!0;let lt=qu;class rr{constructor(e=0,t=0,s=0,i=1){this.isQuaternion=!0,this._x=e,this._y=t,this._z=s,this._w=i}static slerpFlat(e,t,s,i,r,a,o){let l=s[i+0],c=s[i+1],d=s[i+2],u=s[i+3],h=r[a+0],g=r[a+1],p=r[a+2],z=r[a+3];if(u!==z||l!==h||c!==g||d!==p){let m=l*h+c*g+d*p+u*z;m<0&&(h=-h,g=-g,p=-p,z=-z,m=-m);let f=1-o;if(m<.9995){const _=Math.acos(m),O=Math.sin(_);f=Math.sin(f*_)/O,o=Math.sin(o*_)/O,l=l*f+h*o,c=c*f+g*o,d=d*f+p*o,u=u*f+z*o}else{l=l*f+h*o,c=c*f+g*o,d=d*f+p*o,u=u*f+z*o;const _=1/Math.sqrt(l*l+c*c+d*d+u*u);l*=_,c*=_,d*=_,u*=_}}e[t]=l,e[t+1]=c,e[t+2]=d,e[t+3]=u}static multiplyQuaternionsFlat(e,t,s,i,r,a){const o=s[i],l=s[i+1],c=s[i+2],d=s[i+3],u=r[a],h=r[a+1],g=r[a+2],p=r[a+3];return e[t]=o*p+d*u+l*g-c*h,e[t+1]=l*p+d*h+c*u-o*g,e[t+2]=c*p+d*g+o*h-l*u,e[t+3]=d*p-o*u-l*h-c*g,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,t,s,i){return this._x=e,this._y=t,this._z=s,this._w=i,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,t=!0){const s=e._x,i=e._y,r=e._z,a=e._order,o=Math.cos,l=Math.sin,c=o(s/2),d=o(i/2),u=o(r/2),h=l(s/2),g=l(i/2),p=l(r/2);switch(a){case"XYZ":this._x=h*d*u+c*g*p,this._y=c*g*u-h*d*p,this._z=c*d*p+h*g*u,this._w=c*d*u-h*g*p;break;case"YXZ":this._x=h*d*u+c*g*p,this._y=c*g*u-h*d*p,this._z=c*d*p-h*g*u,this._w=c*d*u+h*g*p;break;case"ZXY":this._x=h*d*u-c*g*p,this._y=c*g*u+h*d*p,this._z=c*d*p+h*g*u,this._w=c*d*u-h*g*p;break;case"ZYX":this._x=h*d*u-c*g*p,this._y=c*g*u+h*d*p,this._z=c*d*p-h*g*u,this._w=c*d*u+h*g*p;break;case"YZX":this._x=h*d*u+c*g*p,this._y=c*g*u+h*d*p,this._z=c*d*p-h*g*u,this._w=c*d*u-h*g*p;break;case"XZY":this._x=h*d*u-c*g*p,this._y=c*g*u-h*d*p,this._z=c*d*p+h*g*u,this._w=c*d*u+h*g*p;break;default:st("Quaternion: .setFromEuler() encountered an unknown order: "+a)}return t===!0&&this._onChangeCallback(),this}setFromAxisAngle(e,t){const s=t/2,i=Math.sin(s);return this._x=e.x*i,this._y=e.y*i,this._z=e.z*i,this._w=Math.cos(s),this._onChangeCallback(),this}setFromRotationMatrix(e){const t=e.elements,s=t[0],i=t[4],r=t[8],a=t[1],o=t[5],l=t[9],c=t[2],d=t[6],u=t[10],h=s+o+u;if(h>0){const g=.5/Math.sqrt(h+1);this._w=.25/g,this._x=(d-l)*g,this._y=(r-c)*g,this._z=(a-i)*g}else if(s>o&&s>u){const g=2*Math.sqrt(1+s-o-u);this._w=(d-l)/g,this._x=.25*g,this._y=(i+a)/g,this._z=(r+c)/g}else if(o>u){const g=2*Math.sqrt(1+o-s-u);this._w=(r-c)/g,this._x=(i+a)/g,this._y=.25*g,this._z=(l+d)/g}else{const g=2*Math.sqrt(1+u-s-o);this._w=(a-i)/g,this._x=(r+c)/g,this._y=(l+d)/g,this._z=.25*g}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let s=e.dot(t)+1;return s<1e-8?(s=0,Math.abs(e.x)>Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=s):(this._x=0,this._y=-e.z,this._z=e.y,this._w=s)):(this._x=e.y*t.z-e.z*t.y,this._y=e.z*t.x-e.x*t.z,this._z=e.x*t.y-e.y*t.x,this._w=s),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(St(this.dot(e),-1,1)))}rotateTowards(e,t){const s=this.angleTo(e);if(s===0)return this;const i=Math.min(1,t/s);return this.slerp(e,i),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,t){const s=e._x,i=e._y,r=e._z,a=e._w,o=t._x,l=t._y,c=t._z,d=t._w;return this._x=s*d+a*o+i*c-r*l,this._y=i*d+a*l+r*o-s*c,this._z=r*d+a*c+s*l-i*o,this._w=a*d-s*o-i*l-r*c,this._onChangeCallback(),this}slerp(e,t){let s=e._x,i=e._y,r=e._z,a=e._w,o=this.dot(e);o<0&&(s=-s,i=-i,r=-r,a=-a,o=-o);let l=1-t;if(o<.9995){const c=Math.acos(o),d=Math.sin(c);l=Math.sin(l*c)/d,t=Math.sin(t*c)/d,this._x=this._x*l+s*t,this._y=this._y*l+i*t,this._z=this._z*l+r*t,this._w=this._w*l+a*t,this._onChangeCallback()}else this._x=this._x*l+s*t,this._y=this._y*l+i*t,this._z=this._z*l+r*t,this._w=this._w*l+a*t,this.normalize();return this}slerpQuaternions(e,t,s){return this.copy(e).slerp(t,s)}random(){const e=2*Math.PI*Math.random(),t=2*Math.PI*Math.random(),s=Math.random(),i=Math.sqrt(1-s),r=Math.sqrt(s);return this.set(i*Math.sin(e),i*Math.cos(e),r*Math.sin(t),r*Math.cos(t))}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e,t=0){return this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e}fromBufferAttribute(e,t){return this._x=e.getX(t),this._y=e.getY(t),this._z=e.getZ(t),this._w=e.getW(t),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 Xu=class Xu{constructor(e=0,t=0,s=0){this.x=e,this.y=t,this.z=s}set(e,t,s){return s===void 0&&(s=this.z),this.x=e,this.y=t,this.z=s,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,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;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,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,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,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.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,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this}applyEuler(e){return this.applyQuaternion(zh.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(zh.setFromAxisAngle(e,t))}applyMatrix3(e){const t=this.x,s=this.y,i=this.z,r=e.elements;return this.x=r[0]*t+r[3]*s+r[6]*i,this.y=r[1]*t+r[4]*s+r[7]*i,this.z=r[2]*t+r[5]*s+r[8]*i,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){const t=this.x,s=this.y,i=this.z,r=e.elements,a=1/(r[3]*t+r[7]*s+r[11]*i+r[15]);return this.x=(r[0]*t+r[4]*s+r[8]*i+r[12])*a,this.y=(r[1]*t+r[5]*s+r[9]*i+r[13])*a,this.z=(r[2]*t+r[6]*s+r[10]*i+r[14])*a,this}applyQuaternion(e){const t=this.x,s=this.y,i=this.z,r=e.x,a=e.y,o=e.z,l=e.w,c=2*(a*i-o*s),d=2*(o*t-r*i),u=2*(r*s-a*t);return this.x=t+l*c+a*u-o*d,this.y=s+l*d+o*c-r*u,this.z=i+l*u+r*d-a*c,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){const t=this.x,s=this.y,i=this.z,r=e.elements;return this.x=r[0]*t+r[4]*s+r[8]*i,this.y=r[1]*t+r[5]*s+r[9]*i,this.z=r[2]*t+r[6]*s+r[10]*i,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,t){return this.x=St(this.x,e.x,t.x),this.y=St(this.y,e.y,t.y),this.z=St(this.z,e.z,t.z),this}clampScalar(e,t){return this.x=St(this.x,e,t),this.y=St(this.y,e,t),this.z=St(this.z,e,t),this}clampLength(e,t){const s=this.length();return this.divideScalar(s||1).multiplyScalar(St(s,e,t))}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,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this}lerpVectors(e,t,s){return this.x=e.x+(t.x-e.x)*s,this.y=e.y+(t.y-e.y)*s,this.z=e.z+(t.z-e.z)*s,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,t){const s=e.x,i=e.y,r=e.z,a=t.x,o=t.y,l=t.z;return this.x=i*l-r*o,this.y=r*a-s*l,this.z=s*o-i*a,this}projectOnVector(e){const t=e.lengthSq();if(t===0)return this.set(0,0,0);const s=e.dot(this)/t;return this.copy(e).multiplyScalar(s)}projectOnPlane(e){return Xl.copy(this).projectOnVector(e),this.sub(Xl)}reflect(e){return this.sub(Xl.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;const s=this.dot(e)/t;return Math.acos(St(s,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,s=this.y-e.y,i=this.z-e.z;return t*t+s*s+i*i}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,t,s){const i=Math.sin(t)*e;return this.x=i*Math.sin(s),this.y=Math.cos(t)*e,this.z=i*Math.cos(s),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,t,s){return this.x=e*Math.sin(t),this.y=s,this.z=e*Math.cos(t),this}setFromMatrixPosition(e){const t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}setFromMatrixScale(e){const t=this.setFromMatrixColumn(e,0).length(),s=this.setFromMatrixColumn(e,1).length(),i=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=s,this.z=i,this}setFromMatrixColumn(e,t){return this.fromArray(e.elements,t*4)}setFromMatrix3Column(e,t){return this.fromArray(e.elements,t*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,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){const e=Math.random()*Math.PI*2,t=Math.random()*2-1,s=Math.sqrt(1-t*t);return this.x=s*Math.cos(e),this.y=t,this.z=s*Math.sin(e),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}};Xu.prototype.isVector3=!0;let F=Xu;const Xl=new F,zh=new rr,Yu=class Yu{constructor(e,t,s,i,r,a,o,l,c){this.elements=[1,0,0,0,1,0,0,0,1],e!==void 0&&this.set(e,t,s,i,r,a,o,l,c)}set(e,t,s,i,r,a,o,l,c){const d=this.elements;return d[0]=e,d[1]=i,d[2]=o,d[3]=t,d[4]=r,d[5]=l,d[6]=s,d[7]=a,d[8]=c,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){const t=this.elements,s=e.elements;return t[0]=s[0],t[1]=s[1],t[2]=s[2],t[3]=s[3],t[4]=s[4],t[5]=s[5],t[6]=s[6],t[7]=s[7],t[8]=s[8],this}extractBasis(e,t,s){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),s.setFromMatrix3Column(this,2),this}setFromMatrix4(e){const t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const s=e.elements,i=t.elements,r=this.elements,a=s[0],o=s[3],l=s[6],c=s[1],d=s[4],u=s[7],h=s[2],g=s[5],p=s[8],z=i[0],m=i[3],f=i[6],_=i[1],O=i[4],w=i[7],x=i[2],S=i[5],I=i[8];return r[0]=a*z+o*_+l*x,r[3]=a*m+o*O+l*S,r[6]=a*f+o*w+l*I,r[1]=c*z+d*_+u*x,r[4]=c*m+d*O+u*S,r[7]=c*f+d*w+u*I,r[2]=h*z+g*_+p*x,r[5]=h*m+g*O+p*S,r[8]=h*f+g*w+p*I,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this}determinant(){const e=this.elements,t=e[0],s=e[1],i=e[2],r=e[3],a=e[4],o=e[5],l=e[6],c=e[7],d=e[8];return t*a*d-t*o*c-s*r*d+s*o*l+i*r*c-i*a*l}invert(){const e=this.elements,t=e[0],s=e[1],i=e[2],r=e[3],a=e[4],o=e[5],l=e[6],c=e[7],d=e[8],u=d*a-o*c,h=o*l-d*r,g=c*r-a*l,p=t*u+s*h+i*g;if(p===0)return this.set(0,0,0,0,0,0,0,0,0);const z=1/p;return e[0]=u*z,e[1]=(i*c-d*s)*z,e[2]=(o*s-i*a)*z,e[3]=h*z,e[4]=(d*t-i*l)*z,e[5]=(i*r-o*t)*z,e[6]=g*z,e[7]=(s*l-c*t)*z,e[8]=(a*t-s*r)*z,this}transpose(){let e;const t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){const t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this}setUvTransform(e,t,s,i,r,a,o){const l=Math.cos(r),c=Math.sin(r);return this.set(s*l,s*c,-s*(l*a+c*o)+a+e,-i*c,i*l,-i*(-c*a+l*o)+o+t,0,0,1),this}scale(e,t){return Pr("Matrix3: .scale() is deprecated. Use .makeScale() instead."),this.premultiply(Yl.makeScale(e,t)),this}rotate(e){return Pr("Matrix3: .rotate() is deprecated. Use .makeRotation() instead."),this.premultiply(Yl.makeRotation(-e)),this}translate(e,t){return Pr("Matrix3: .translate() is deprecated. Use .makeTranslation() instead."),this.premultiply(Yl.makeTranslation(e,t)),this}makeTranslation(e,t){return e.isVector2?this.set(1,0,e.x,0,1,e.y,0,0,1):this.set(1,0,e,0,1,t,0,0,1),this}makeRotation(e){const t=Math.cos(e),s=Math.sin(e);return this.set(t,-s,0,s,t,0,0,0,1),this}makeScale(e,t){return this.set(e,0,0,0,t,0,0,0,1),this}equals(e){const t=this.elements,s=e.elements;for(let i=0;i<9;i++)if(t[i]!==s[i])return!1;return!0}fromArray(e,t=0){for(let s=0;s<9;s++)this.elements[s]=e[s+t];return this}toArray(e=[],t=0){const s=this.elements;return e[t]=s[0],e[t+1]=s[1],e[t+2]=s[2],e[t+3]=s[3],e[t+4]=s[4],e[t+5]=s[5],e[t+6]=s[6],e[t+7]=s[7],e[t+8]=s[8],e}clone(){return new this.constructor().fromArray(this.elements)}};Yu.prototype.isMatrix3=!0;let ut=Yu;const Yl=new ut,_h=new ut().set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),wh=new ut().set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715);function Az(){const n={enabled:!0,workingColorSpace:dl,spaces:{},convert:function(i,r,a){return this.enabled===!1||r===a||!r||!a||(this.spaces[r].transfer===kt&&(i.r=Qn(i.r),i.g=Qn(i.g),i.b=Qn(i.b)),this.spaces[r].primaries!==this.spaces[a].primaries&&(i.applyMatrix3(this.spaces[r].toXYZ),i.applyMatrix3(this.spaces[a].fromXYZ)),this.spaces[a].transfer===kt&&(i.r=Lr(i.r),i.g=Lr(i.g),i.b=Lr(i.b))),i},workingToColorSpace:function(i,r){return this.convert(i,this.workingColorSpace,r)},colorSpaceToWorking:function(i,r){return this.convert(i,r,this.workingColorSpace)},getPrimaries:function(i){return this.spaces[i].primaries},getTransfer:function(i){return i===bi?ul:this.spaces[i].transfer},getToneMappingMode:function(i){return this.spaces[i].outputColorSpaceConfig.toneMappingMode||"standard"},getLuminanceCoefficients:function(i,r=this.workingColorSpace){return i.fromArray(this.spaces[r].luminanceCoefficients)},define:function(i){Object.assign(this.spaces,i)},_getMatrix:function(i,r,a){return i.copy(this.spaces[r].toXYZ).multiply(this.spaces[a].fromXYZ)},_getDrawingBufferColorSpace:function(i){return this.spaces[i].outputColorSpaceConfig.drawingBufferColorSpace},_getUnpackColorSpace:function(i=this.workingColorSpace){return this.spaces[i].workingColorSpaceConfig.unpackColorSpace},fromWorkingColorSpace:function(i,r){return Pr("ColorManagement: .fromWorkingColorSpace() has been renamed to .workingToColorSpace()."),n.workingToColorSpace(i,r)},toWorkingColorSpace:function(i,r){return Pr("ColorManagement: .toWorkingColorSpace() has been renamed to .colorSpaceToWorking()."),n.colorSpaceToWorking(i,r)}},e=[.64,.33,.3,.6,.15,.06],t=[.2126,.7152,.0722],s=[.3127,.329];return n.define({[dl]:{primaries:e,whitePoint:s,transfer:ul,toXYZ:_h,fromXYZ:wh,luminanceCoefficients:t,workingColorSpaceConfig:{unpackColorSpace:sn},outputColorSpaceConfig:{drawingBufferColorSpace:sn}},[sn]:{primaries:e,whitePoint:s,transfer:kt,toXYZ:_h,fromXYZ:wh,luminanceCoefficients:t,outputColorSpaceConfig:{drawingBufferColorSpace:sn}}}),n}const xt=Az();function Qn(n){return n<.04045?n*.0773993808:Math.pow(n*.9478672986+.0521327014,2.4)}function Lr(n){return n<.0031308?n*12.92:1.055*Math.pow(n,.41666)-.055}let ur;class Ez{static getDataURL(e,t="image/png"){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement>"u")return e.src;let s;if(e instanceof HTMLCanvasElement)s=e;else{ur===void 0&&(ur=hl("canvas")),ur.width=e.width,ur.height=e.height;const i=ur.getContext("2d");e instanceof ImageData?i.putImageData(e,0,0):i.drawImage(e,0,0,e.width,e.height),s=ur}return s.toDataURL(t)}static sRGBToLinear(e){if(typeof HTMLImageElement<"u"&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&e instanceof ImageBitmap){const t=hl("canvas");t.width=e.width,t.height=e.height;const s=t.getContext("2d");s.drawImage(e,0,0,e.width,e.height);const i=s.getImageData(0,0,e.width,e.height),r=i.data;for(let a=0;a<r.length;a++)r[a]=Qn(r[a]/255)*255;return s.putImageData(i,0,0),t}else if(e.data){const t=e.data.slice(0);for(let s=0;s<t.length;s++)t instanceof Uint8Array||t instanceof Uint8ClampedArray?t[s]=Math.floor(Qn(t[s]/255)*255):t[s]=Qn(t[s]);return{data:t,width:e.width,height:e.height}}else return st("ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),e}}let Dz=0;class vu{constructor(e=null){this.isSource=!0,Object.defineProperty(this,"id",{value:Dz++}),this.uuid=yi(),this.data=e,this.dataReady=!0,this.version=0}getSize(e){const t=this.data;return typeof HTMLVideoElement<"u"&&t instanceof HTMLVideoElement?e.set(t.videoWidth,t.videoHeight,0):typeof VideoFrame<"u"&&t instanceof VideoFrame?e.set(t.displayWidth,t.displayHeight,0):t!==null?e.set(t.width,t.height,t.depth||0):e.set(0,0,0),e}set needsUpdate(e){e===!0&&this.version++}toJSON(e){const t=e===void 0||typeof e=="string";if(!t&&e.images[this.uuid]!==void 0)return e.images[this.uuid];const s={uuid:this.uuid,url:""},i=this.data;if(i!==null){let r;if(Array.isArray(i)){r=[];for(let a=0,o=i.length;a<o;a++)i[a].isDataTexture?r.push(Kl(i[a].image)):r.push(Kl(i[a]))}else r=Kl(i);s.url=r}return t||(e.images[this.uuid]=s),s}}function Kl(n){return typeof HTMLImageElement<"u"&&n instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&n instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&n instanceof ImageBitmap?Ez.getDataURL(n):n.data?{data:Array.from(n.data),width:n.width,height:n.height,type:n.data.constructor.name}:(st("Texture: Unable to serialize Texture."),{})}let Iz=0;const Zl=new F;class Is extends ir{constructor(e=Is.DEFAULT_IMAGE,t=Is.DEFAULT_MAPPING,s=Yn,i=Yn,r=Ds,a=Fi,o=bn,l=Zs,c=Is.DEFAULT_ANISOTROPY,d=bi){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:Iz++}),this.uuid=yi(),this.name="",this.source=new vu(e),this.mipmaps=[],this.mapping=t,this.channel=0,this.wrapS=s,this.wrapT=i,this.magFilter=r,this.minFilter=a,this.anisotropy=c,this.format=o,this.internalFormat=null,this.type=l,this.offset=new lt(0,0),this.repeat=new lt(1,1),this.center=new lt(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new ut,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.colorSpace=d,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(Zl).x}get height(){return this.source.getSize(Zl).y}get depth(){return this.source.getSize(Zl).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,t){this.updateRanges.push({start:e,count:t})}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 t in e){const s=e[t];if(s===void 0){st(`Texture.setValues(): parameter '${t}' has value of undefined.`);continue}const i=this[t];if(i===void 0){st(`Texture.setValues(): property '${t}' does not exist.`);continue}i&&s&&i.isVector2&&s.isVector2||i&&s&&i.isVector3&&s.isVector3||i&&s&&i.isMatrix3&&s.isMatrix3?i.copy(s):this[t]=s}}toJSON(e){const t=e===void 0||typeof e=="string";if(!t&&e.textures[this.uuid]!==void 0)return e.textures[this.uuid];const s={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&&(s.userData=this.userData),t||(e.textures[this.uuid]=s),s}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(this.mapping!==Bm)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case gd:e.x=e.x-Math.floor(e.x);break;case Yn:e.x=e.x<0?0:1;break;case Md: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 gd:e.y=e.y-Math.floor(e.y);break;case Yn:e.y=e.y<0?0:1;break;case Md: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++}}Is.DEFAULT_IMAGE=null;Is.DEFAULT_MAPPING=Bm;Is.DEFAULT_ANISOTROPY=1;const Ku=class Ku{constructor(e=0,t=0,s=0,i=1){this.x=e,this.y=t,this.z=s,this.w=i}get width(){return this.z}set width(e){this.z=e}get height(){return this.w}set height(e){this.w=e}set(e,t,s,i){return this.x=e,this.y=t,this.z=s,this.w=i,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,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;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,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,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,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.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 t=this.x,s=this.y,i=this.z,r=this.w,a=e.elements;return this.x=a[0]*t+a[4]*s+a[8]*i+a[12]*r,this.y=a[1]*t+a[5]*s+a[9]*i+a[13]*r,this.z=a[2]*t+a[6]*s+a[10]*i+a[14]*r,this.w=a[3]*t+a[7]*s+a[11]*i+a[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 t=Math.sqrt(1-e.w*e.w);return t<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this}setAxisAngleFromRotationMatrix(e){let t,s,i,r;const l=e.elements,c=l[0],d=l[4],u=l[8],h=l[1],g=l[5],p=l[9],z=l[2],m=l[6],f=l[10];if(Math.abs(d-h)<.01&&Math.abs(u-z)<.01&&Math.abs(p-m)<.01){if(Math.abs(d+h)<.1&&Math.abs(u+z)<.1&&Math.abs(p+m)<.1&&Math.abs(c+g+f-3)<.1)return this.set(1,0,0,0),this;t=Math.PI;const O=(c+1)/2,w=(g+1)/2,x=(f+1)/2,S=(d+h)/4,I=(u+z)/4,b=(p+m)/4;return O>w&&O>x?O<.01?(s=0,i=.707106781,r=.707106781):(s=Math.sqrt(O),i=S/s,r=I/s):w>x?w<.01?(s=.707106781,i=0,r=.707106781):(i=Math.sqrt(w),s=S/i,r=b/i):x<.01?(s=.707106781,i=.707106781,r=0):(r=Math.sqrt(x),s=I/r,i=b/r),this.set(s,i,r,t),this}let _=Math.sqrt((m-p)*(m-p)+(u-z)*(u-z)+(h-d)*(h-d));return Math.abs(_)<.001&&(_=1),this.x=(m-p)/_,this.y=(u-z)/_,this.z=(h-d)/_,this.w=Math.acos((c+g+f-1)/2),this}setFromMatrixPosition(e){const t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this.w=t[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,t){return this.x=St(this.x,e.x,t.x),this.y=St(this.y,e.y,t.y),this.z=St(this.z,e.z,t.z),this.w=St(this.w,e.w,t.w),this}clampScalar(e,t){return this.x=St(this.x,e,t),this.y=St(this.y,e,t),this.z=St(this.z,e,t),this.w=St(this.w,e,t),this}clampLength(e,t){const s=this.length();return this.divideScalar(s||1).multiplyScalar(St(s,e,t))}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,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this.w+=(e.w-this.w)*t,this}lerpVectors(e,t,s){return this.x=e.x+(t.x-e.x)*s,this.y=e.y+(t.y-e.y)*s,this.z=e.z+(t.z-e.z)*s,this.w=e.w+(t.w-e.w)*s,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this.w=e[t+3],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this.w=e.getW(t),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}};Ku.prototype.isVector4=!0;let ts=Ku;class Tz extends ir{constructor(e=1,t=1,s={}){super(),s=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:Ds,depthBuffer:!0,stencilBuffer:!1,resolveDepthBuffer:!0,resolveStencilBuffer:!0,depthTexture:null,samples:0,count:1,depth:1,multiview:!1,useArrayDepthTexture:!1},s),this.isRenderTarget=!0,this.width=e,this.height=t,this.depth=s.depth,this.scissor=new ts(0,0,e,t),this.scissorTest=!1,this.viewport=new ts(0,0,e,t),this.textures=[];const i={width:e,height:t,depth:s.depth},r=new Is(i),a=s.count;for(let o=0;o<a;o++)this.textures[o]=r.clone(),this.textures[o].isRenderTargetTexture=!0,this.textures[o].renderTarget=this;this._setTextureOptions(s),this.depthBuffer=s.depthBuffer,this.stencilBuffer=s.stencilBuffer,this.resolveDepthBuffer=s.resolveDepthBuffer,this.resolveStencilBuffer=s.resolveStencilBuffer,this._depthTexture=null,this.depthTexture=s.depthTexture,this.samples=s.samples,this.multiview=s.multiview,this.useArrayDepthTexture=s.useArrayDepthTexture}_setTextureOptions(e={}){const t={minFilter:Ds,generateMipmaps:!1,flipY:!1,internalFormat:null};e.mapping!==void 0&&(t.mapping=e.mapping),e.wrapS!==void 0&&(t.wrapS=e.wrapS),e.wrapT!==void 0&&(t.wrapT=e.wrapT),e.wrapR!==void 0&&(t.wrapR=e.wrapR),e.magFilter!==void 0&&(t.magFilter=e.magFilter),e.minFilter!==void 0&&(t.minFilter=e.minFilter),e.format!==void 0&&(t.format=e.format),e.type!==void 0&&(t.type=e.type),e.anisotropy!==void 0&&(t.anisotropy=e.anisotropy),e.colorSpace!==void 0&&(t.colorSpace=e.colorSpace),e.flipY!==void 0&&(t.flipY=e.flipY),e.generateMipmaps!==void 0&&(t.generateMipmaps=e.generateMipmaps),e.internalFormat!==void 0&&(t.internalFormat=e.internalFormat);for(let s=0;s<this.textures.length;s++)this.textures[s].setValues(t)}get texture(){return this.textures[0]}set texture(e){this.textures[0]=e}set depthTexture(e){this._depthTexture!==null&&(this._depthTexture.renderTarget=null),e!==null&&(e.renderTarget=this),this._depthTexture=e}get depthTexture(){return this._depthTexture}setSize(e,t,s=1){if(this.width!==e||this.height!==t||this.depth!==s){this.width=e,this.height=t,this.depth=s;for(let i=0,r=this.textures.length;i<r;i++)this.textures[i].image.width=e,this.textures[i].image.height=t,this.textures[i].image.depth=s,this.textures[i].isData3DTexture!==!0&&(this.textures[i].isArrayTexture=this.textures[i].image.depth>1);this.dispose()}this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)}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 t=0,s=e.textures.length;t<s;t++){this.textures[t]=e.textures[t].clone(),this.textures[t].isRenderTargetTexture=!0,this.textures[t].renderTarget=this;const i=Object.assign({},e.textures[t].image);this.textures[t].source=new vu(i)}return this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,this.resolveDepthBuffer=e.resolveDepthBuffer,this.resolveStencilBuffer=e.resolveStencilBuffer,e.depthTexture!==null&&(this.depthTexture=e.depthTexture.clone()),this.samples=e.samples,this.multiview=e.multiview,this.useArrayDepthTexture=e.useArrayDepthTexture,this}dispose(){this.dispatchEvent({type:"dispose"})}}class In extends Tz{constructor(e=1,t=1,s={}){super(e,t,s),this.isWebGLRenderTarget=!0}}class Fm extends Is{constructor(e=null,t=1,s=1,i=1){super(null),this.isDataArrayTexture=!0,this.image={data:e,width:t,height:s,depth:i},this.magFilter=ys,this.minFilter=ys,this.wrapR=Yn,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.layerUpdates=new Set}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}}class Gz extends Is{constructor(e=null,t=1,s=1,i=1){super(null),this.isData3DTexture=!0,this.image={data:e,width:t,height:s,depth:i},this.magFilter=ys,this.minFilter=ys,this.wrapR=Yn,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}const yl=class yl{constructor(e,t,s,i,r,a,o,l,c,d,u,h,g,p,z,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,t,s,i,r,a,o,l,c,d,u,h,g,p,z,m)}set(e,t,s,i,r,a,o,l,c,d,u,h,g,p,z,m){const f=this.elements;return f[0]=e,f[4]=t,f[8]=s,f[12]=i,f[1]=r,f[5]=a,f[9]=o,f[13]=l,f[2]=c,f[6]=d,f[10]=u,f[14]=h,f[3]=g,f[7]=p,f[11]=z,f[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 yl().fromArray(this.elements)}copy(e){const t=this.elements,s=e.elements;return t[0]=s[0],t[1]=s[1],t[2]=s[2],t[3]=s[3],t[4]=s[4],t[5]=s[5],t[6]=s[6],t[7]=s[7],t[8]=s[8],t[9]=s[9],t[10]=s[10],t[11]=s[11],t[12]=s[12],t[13]=s[13],t[14]=s[14],t[15]=s[15],this}copyPosition(e){const t=this.elements,s=e.elements;return t[12]=s[12],t[13]=s[13],t[14]=s[14],this}setFromMatrix3(e){const t=e.elements;return this.set(t[0],t[3],t[6],0,t[1],t[4],t[7],0,t[2],t[5],t[8],0,0,0,0,1),this}extractBasis(e,t,s){return this.determinantAffine()===0?(e.set(1,0,0),t.set(0,1,0),s.set(0,0,1),this):(e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),s.setFromMatrixColumn(this,2),this)}makeBasis(e,t,s){return this.set(e.x,t.x,s.x,0,e.y,t.y,s.y,0,e.z,t.z,s.z,0,0,0,0,1),this}extractRotation(e){if(e.determinantAffine()===0)return this.identity();const t=this.elements,s=e.elements,i=1/hr.setFromMatrixColumn(e,0).length(),r=1/hr.setFromMatrixColumn(e,1).length(),a=1/hr.setFromMatrixColumn(e,2).length();return t[0]=s[0]*i,t[1]=s[1]*i,t[2]=s[2]*i,t[3]=0,t[4]=s[4]*r,t[5]=s[5]*r,t[6]=s[6]*r,t[7]=0,t[8]=s[8]*a,t[9]=s[9]*a,t[10]=s[10]*a,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromEuler(e){const t=this.elements,s=e.x,i=e.y,r=e.z,a=Math.cos(s),o=Math.sin(s),l=Math.cos(i),c=Math.sin(i),d=Math.cos(r),u=Math.sin(r);if(e.order==="XYZ"){const h=a*d,g=a*u,p=o*d,z=o*u;t[0]=l*d,t[4]=-l*u,t[8]=c,t[1]=g+p*c,t[5]=h-z*c,t[9]=-o*l,t[2]=z-h*c,t[6]=p+g*c,t[10]=a*l}else if(e.order==="YXZ"){const h=l*d,g=l*u,p=c*d,z=c*u;t[0]=h+z*o,t[4]=p*o-g,t[8]=a*c,t[1]=a*u,t[5]=a*d,t[9]=-o,t[2]=g*o-p,t[6]=z+h*o,t[10]=a*l}else if(e.order==="ZXY"){const h=l*d,g=l*u,p=c*d,z=c*u;t[0]=h-z*o,t[4]=-a*u,t[8]=p+g*o,t[1]=g+p*o,t[5]=a*d,t[9]=z-h*o,t[2]=-a*c,t[6]=o,t[10]=a*l}else if(e.order==="ZYX"){const h=a*d,g=a*u,p=o*d,z=o*u;t[0]=l*d,t[4]=p*c-g,t[8]=h*c+z,t[1]=l*u,t[5]=z*c+h,t[9]=g*c-p,t[2]=-c,t[6]=o*l,t[10]=a*l}else if(e.order==="YZX"){const h=a*l,g=a*c,p=o*l,z=o*c;t[0]=l*d,t[4]=z-h*u,t[8]=p*u+g,t[1]=u,t[5]=a*d,t[9]=-o*d,t[2]=-c*d,t[6]=g*u+p,t[10]=h-z*u}else if(e.order==="XZY"){const h=a*l,g=a*c,p=o*l,z=o*c;t[0]=l*d,t[4]=-u,t[8]=c*d,t[1]=h*u+z,t[5]=a*d,t[9]=g*u-p,t[2]=p*u-g,t[6]=o*d,t[10]=z*u+h}return t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromQuaternion(e){return this.compose(Rz,e,Bz)}lookAt(e,t,s){const i=this.elements;return Hs.subVectors(e,t),Hs.lengthSq()===0&&(Hs.z=1),Hs.normalize(),ci.crossVectors(s,Hs),ci.lengthSq()===0&&(Math.abs(s.z)===1?Hs.x+=1e-4:Hs.z+=1e-4,Hs.normalize(),ci.crossVectors(s,Hs)),ci.normalize(),Xa.crossVectors(Hs,ci),i[0]=ci.x,i[4]=Xa.x,i[8]=Hs.x,i[1]=ci.y,i[5]=Xa.y,i[9]=Hs.y,i[2]=ci.z,i[6]=Xa.z,i[10]=Hs.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const s=e.elements,i=t.elements,r=this.elements,a=s[0],o=s[4],l=s[8],c=s[12],d=s[1],u=s[5],h=s[9],g=s[13],p=s[2],z=s[6],m=s[10],f=s[14],_=s[3],O=s[7],w=s[11],x=s[15],S=i[0],I=i[4],b=i[8],A=i[12],B=i[1],N=i[5],k=i[9],L=i[13],j=i[2],P=i[6],W=i[10],X=i[14],Q=i[3],re=i[7],Me=i[11],oe=i[15];return r[0]=a*S+o*B+l*j+c*Q,r[4]=a*I+o*N+l*P+c*re,r[8]=a*b+o*k+l*W+c*Me,r[12]=a*A+o*L+l*X+c*oe,r[1]=d*S+u*B+h*j+g*Q,r[5]=d*I+u*N+h*P+g*re,r[9]=d*b+u*k+h*W+g*Me,r[13]=d*A+u*L+h*X+g*oe,r[2]=p*S+z*B+m*j+f*Q,r[6]=p*I+z*N+m*P+f*re,r[10]=p*b+z*k+m*W+f*Me,r[14]=p*A+z*L+m*X+f*oe,r[3]=_*S+O*B+w*j+x*Q,r[7]=_*I+O*N+w*P+x*re,r[11]=_*b+O*k+w*W+x*Me,r[15]=_*A+O*L+w*X+x*oe,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this}determinant(){const e=this.elements,t=e[0],s=e[4],i=e[8],r=e[12],a=e[1],o=e[5],l=e[9],c=e[13],d=e[2],u=e[6],h=e[10],g=e[14],p=e[3],z=e[7],m=e[11],f=e[15],_=l*g-c*h,O=o*g-c*u,w=o*h-l*u,x=a*g-c*d,S=a*h-l*d,I=a*u-o*d;return t*(z*_-m*O+f*w)-s*(p*_-m*x+f*S)+i*(p*O-z*x+f*I)-r*(p*w-z*S+m*I)}determinantAffine(){const e=this.elements,t=e[0],s=e[4],i=e[8],r=e[1],a=e[5],o=e[9],l=e[2],c=e[6],d=e[10];return t*(a*d-o*c)-s*(r*d-o*l)+i*(r*c-a*l)}transpose(){const e=this.elements;let t;return t=e[1],e[1]=e[4],e[4]=t,t=e[2],e[2]=e[8],e[8]=t,t=e[6],e[6]=e[9],e[9]=t,t=e[3],e[3]=e[12],e[12]=t,t=e[7],e[7]=e[13],e[13]=t,t=e[11],e[11]=e[14],e[14]=t,this}setPosition(e,t,s){const i=this.elements;return e.isVector3?(i[12]=e.x,i[13]=e.y,i[14]=e.z):(i[12]=e,i[13]=t,i[14]=s),this}invert(){const e=this.elements,t=e[0],s=e[1],i=e[2],r=e[3],a=e[4],o=e[5],l=e[6],c=e[7],d=e[8],u=e[9],h=e[10],g=e[11],p=e[12],z=e[13],m=e[14],f=e[15],_=t*o-s*a,O=t*l-i*a,w=t*c-r*a,x=s*l-i*o,S=s*c-r*o,I=i*c-r*l,b=d*z-u*p,A=d*m-h*p,B=d*f-g*p,N=u*m-h*z,k=u*f-g*z,L=h*f-g*m,j=_*L-O*k+w*N+x*B-S*A+I*b;if(j===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const P=1/j;return e[0]=(o*L-l*k+c*N)*P,e[1]=(i*k-s*L-r*N)*P,e[2]=(z*I-m*S+f*x)*P,e[3]=(h*S-u*I-g*x)*P,e[4]=(l*B-a*L-c*A)*P,e[5]=(t*L-i*B+r*A)*P,e[6]=(m*w-p*I-f*O)*P,e[7]=(d*I-h*w+g*O)*P,e[8]=(a*k-o*B+c*b)*P,e[9]=(s*B-t*k-r*b)*P,e[10]=(p*S-z*w+f*_)*P,e[11]=(u*w-d*S-g*_)*P,e[12]=(o*A-a*N-l*b)*P,e[13]=(t*N-s*A+i*b)*P,e[14]=(z*O-p*x-m*_)*P,e[15]=(d*x-u*O+h*_)*P,this}scale(e){const t=this.elements,s=e.x,i=e.y,r=e.z;return t[0]*=s,t[4]*=i,t[8]*=r,t[1]*=s,t[5]*=i,t[9]*=r,t[2]*=s,t[6]*=i,t[10]*=r,t[3]*=s,t[7]*=i,t[11]*=r,this}getMaxScaleOnAxis(){const e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],s=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],i=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,s,i))}makeTranslation(e,t,s){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,t,0,0,1,s,0,0,0,1),this}makeRotationX(e){const t=Math.cos(e),s=Math.sin(e);return this.set(1,0,0,0,0,t,-s,0,0,s,t,0,0,0,0,1),this}makeRotationY(e){const t=Math.cos(e),s=Math.sin(e);return this.set(t,0,s,0,0,1,0,0,-s,0,t,0,0,0,0,1),this}makeRotationZ(e){const t=Math.cos(e),s=Math.sin(e);return this.set(t,-s,0,0,s,t,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,t){const s=Math.cos(t),i=Math.sin(t),r=1-s,a=e.x,o=e.y,l=e.z,c=r*a,d=r*o;return this.set(c*a+s,c*o-i*l,c*l+i*o,0,c*o+i*l,d*o+s,d*l-i*a,0,c*l-i*o,d*l+i*a,r*l*l+s,0,0,0,0,1),this}makeScale(e,t,s){return this.set(e,0,0,0,0,t,0,0,0,0,s,0,0,0,0,1),this}makeShear(e,t,s,i,r,a){return this.set(1,s,r,0,e,1,a,0,t,i,1,0,0,0,0,1),this}compose(e,t,s){const i=this.elements,r=t._x,a=t._y,o=t._z,l=t._w,c=r+r,d=a+a,u=o+o,h=r*c,g=r*d,p=r*u,z=a*d,m=a*u,f=o*u,_=l*c,O=l*d,w=l*u,x=s.x,S=s.y,I=s.z;return i[0]=(1-(z+f))*x,i[1]=(g+w)*x,i[2]=(p-O)*x,i[3]=0,i[4]=(g-w)*S,i[5]=(1-(h+f))*S,i[6]=(m+_)*S,i[7]=0,i[8]=(p+O)*I,i[9]=(m-_)*I,i[10]=(1-(h+z))*I,i[11]=0,i[12]=e.x,i[13]=e.y,i[14]=e.z,i[15]=1,this}decompose(e,t,s){const i=this.elements;e.x=i[12],e.y=i[13],e.z=i[14];const r=this.determinantAffine();if(r===0)return s.set(1,1,1),t.identity(),this;let a=hr.set(i[0],i[1],i[2]).length();const o=hr.set(i[4],i[5],i[6]).length(),l=hr.set(i[8],i[9],i[10]).length();r<0&&(a=-a),dn.copy(this);const c=1/a,d=1/o,u=1/l;return dn.elements[0]*=c,dn.elements[1]*=c,dn.elements[2]*=c,dn.elements[4]*=d,dn.elements[5]*=d,dn.elements[6]*=d,dn.elements[8]*=u,dn.elements[9]*=u,dn.elements[10]*=u,t.setFromRotationMatrix(dn),s.x=a,s.y=o,s.z=l,this}makePerspective(e,t,s,i,r,a,o=An,l=!1){const c=this.elements,d=2*r/(t-e),u=2*r/(s-i),h=(t+e)/(t-e),g=(s+i)/(s-i);let p,z;if(l)p=r/(a-r),z=a*r/(a-r);else if(o===An)p=-(a+r)/(a-r),z=-2*a*r/(a-r);else if(o===ka)p=-a/(a-r),z=-a*r/(a-r);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+o);return c[0]=d,c[4]=0,c[8]=h,c[12]=0,c[1]=0,c[5]=u,c[9]=g,c[13]=0,c[2]=0,c[6]=0,c[10]=p,c[14]=z,c[3]=0,c[7]=0,c[11]=-1,c[15]=0,this}makeOrthographic(e,t,s,i,r,a,o=An,l=!1){const c=this.elements,d=2/(t-e),u=2/(s-i),h=-(t+e)/(t-e),g=-(s+i)/(s-i);let p,z;if(l)p=1/(a-r),z=a/(a-r);else if(o===An)p=-2/(a-r),z=-(a+r)/(a-r);else if(o===ka)p=-1/(a-r),z=-r/(a-r);else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+o);return c[0]=d,c[4]=0,c[8]=0,c[12]=h,c[1]=0,c[5]=u,c[9]=0,c[13]=g,c[2]=0,c[6]=0,c[10]=p,c[14]=z,c[3]=0,c[7]=0,c[11]=0,c[15]=1,this}equals(e){const t=this.elements,s=e.elements;for(let i=0;i<16;i++)if(t[i]!==s[i])return!1;return!0}fromArray(e,t=0){for(let s=0;s<16;s++)this.elements[s]=e[s+t];return this}toArray(e=[],t=0){const s=this.elements;return e[t]=s[0],e[t+1]=s[1],e[t+2]=s[2],e[t+3]=s[3],e[t+4]=s[4],e[t+5]=s[5],e[t+6]=s[6],e[t+7]=s[7],e[t+8]=s[8],e[t+9]=s[9],e[t+10]=s[10],e[t+11]=s[11],e[t+12]=s[12],e[t+13]=s[13],e[t+14]=s[14],e[t+15]=s[15],e}};yl.prototype.isMatrix4=!0;let Gt=yl;const hr=new F,dn=new Gt,Rz=new F(0,0,0),Bz=new F(1,1,1),ci=new F,Xa=new F,Hs=new F,yh=new Gt,vh=new rr;class Di{constructor(e=0,t=0,s=0,i=Di.DEFAULT_ORDER){this.isEuler=!0,this._x=e,this._y=t,this._z=s,this._order=i}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,t,s,i=this._order){return this._x=e,this._y=t,this._z=s,this._order=i,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,t=this._order,s=!0){const i=e.elements,r=i[0],a=i[4],o=i[8],l=i[1],c=i[5],d=i[9],u=i[2],h=i[6],g=i[10];switch(t){case"XYZ":this._y=Math.asin(St(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(-d,g),this._z=Math.atan2(-a,r)):(this._x=Math.atan2(h,c),this._z=0);break;case"YXZ":this._x=Math.asin(-St(d,-1,1)),Math.abs(d)<.9999999?(this._y=Math.atan2(o,g),this._z=Math.atan2(l,c)):(this._y=Math.atan2(-u,r),this._z=0);break;case"ZXY":this._x=Math.asin(St(h,-1,1)),Math.abs(h)<.9999999?(this._y=Math.atan2(-u,g),this._z=Math.atan2(-a,c)):(this._y=0,this._z=Math.atan2(l,r));break;case"ZYX":this._y=Math.asin(-St(u,-1,1)),Math.abs(u)<.9999999?(this._x=Math.atan2(h,g),this._z=Math.atan2(l,r)):(this._x=0,this._z=Math.atan2(-a,c));break;case"YZX":this._z=Math.asin(St(l,-1,1)),Math.abs(l)<.9999999?(this._x=Math.atan2(-d,c),this._y=Math.atan2(-u,r)):(this._x=0,this._y=Math.atan2(o,g));break;case"XZY":this._z=Math.asin(-St(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(h,c),this._y=Math.atan2(o,r)):(this._x=Math.atan2(-d,g),this._y=0);break;default:st("Euler: .setFromRotationMatrix() encountered an unknown order: "+t)}return this._order=t,s===!0&&this._onChangeCallback(),this}setFromQuaternion(e,t,s){return yh.makeRotationFromQuaternion(e),this.setFromRotationMatrix(yh,t,s)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return vh.setFromEuler(this),this.setFromQuaternion(vh,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=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+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}}Di.DEFAULT_ORDER="XYZ";class Ou{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 Nz=0;const Oh=new F,fr=new rr,Bn=new Gt,Ya=new F,ca=new F,Cz=new F,Pz=new rr,xh=new F(1,0,0),Sh=new F(0,1,0),Ah=new F(0,0,1),Eh={type:"added"},Lz={type:"removed"},pr={type:"childadded",child:null},Ql={type:"childremoved",child:null};class ss extends ir{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:Nz++}),this.uuid=yi(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=ss.DEFAULT_UP.clone();const e=new F,t=new Di,s=new rr,i=new F(1,1,1);function r(){s.setFromEuler(t,!1)}function a(){t.setFromQuaternion(s,void 0,!1)}t._onChange(r),s._onChange(a),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:e},rotation:{configurable:!0,enumerable:!0,value:t},quaternion:{configurable:!0,enumerable:!0,value:s},scale:{configurable:!0,enumerable:!0,value:i},modelViewMatrix:{value:new Gt},normalMatrix:{value:new ut}}),this.matrix=new Gt,this.matrixWorld=new Gt,this.matrixAutoUpdate=ss.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=ss.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new Ou,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,t){this.quaternion.setFromAxisAngle(e,t)}setRotationFromEuler(e){this.quaternion.setFromEuler(e,!0)}setRotationFromMatrix(e){this.quaternion.setFromRotationMatrix(e)}setRotationFromQuaternion(e){this.quaternion.copy(e)}rotateOnAxis(e,t){return fr.setFromAxisAngle(e,t),this.quaternion.multiply(fr),this}rotateOnWorldAxis(e,t){return fr.setFromAxisAngle(e,t),this.quaternion.premultiply(fr),this}rotateX(e){return this.rotateOnAxis(xh,e)}rotateY(e){return this.rotateOnAxis(Sh,e)}rotateZ(e){return this.rotateOnAxis(Ah,e)}translateOnAxis(e,t){return Oh.copy(e).applyQuaternion(this.quaternion),this.position.add(Oh.multiplyScalar(t)),this}translateX(e){return this.translateOnAxis(xh,e)}translateY(e){return this.translateOnAxis(Sh,e)}translateZ(e){return this.translateOnAxis(Ah,e)}localToWorld(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(this.matrixWorld)}worldToLocal(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(Bn.copy(this.matrixWorld).invert())}lookAt(e,t,s){e.isVector3?Ya.copy(e):Ya.set(e,t,s);const i=this.parent;this.updateWorldMatrix(!0,!1),ca.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?Bn.lookAt(ca,Ya,this.up):Bn.lookAt(Ya,ca,this.up),this.quaternion.setFromRotationMatrix(Bn),i&&(Bn.extractRotation(i.matrixWorld),fr.setFromRotationMatrix(Bn),this.quaternion.premultiply(fr.invert()))}add(e){if(arguments.length>1){for(let t=0;t<arguments.length;t++)this.add(arguments[t]);return this}return e===this?(Ot("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(Eh),pr.child=e,this.dispatchEvent(pr),pr.child=null):Ot("Object3D.add: object not an instance of THREE.Object3D.",e),this)}remove(e){if(arguments.length>1){for(let s=0;s<arguments.length;s++)this.remove(arguments[s]);return this}const t=this.children.indexOf(e);return t!==-1&&(e.parent=null,this.children.splice(t,1),e.dispatchEvent(Lz),Ql.child=e,this.dispatchEvent(Ql),Ql.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),Bn.copy(this.matrixWorld).invert(),e.parent!==null&&(e.parent.updateWorldMatrix(!0,!1),Bn.multiply(e.parent.matrixWorld)),e.applyMatrix4(Bn),e.removeFromParent(),e.parent=this,this.children.push(e),e.updateWorldMatrix(!1,!0),e.dispatchEvent(Eh),pr.child=e,this.dispatchEvent(pr),pr.child=null,this}getObjectById(e){return this.getObjectByProperty("id",e)}getObjectByName(e){return this.getObjectByProperty("name",e)}getObjectByProperty(e,t){if(this[e]===t)return this;for(let s=0,i=this.children.length;s<i;s++){const a=this.children[s].getObjectByProperty(e,t);if(a!==void 0)return a}}getObjectsByProperty(e,t,s=[]){this[e]===t&&s.push(this);const i=this.children;for(let r=0,a=i.length;r<a;r++)i[r].getObjectsByProperty(e,t,s);return s}getWorldPosition(e){return this.updateWorldMatrix(!0,!1),e.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(ca,e,Cz),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(ca,Pz,e),e}getWorldDirection(e){this.updateWorldMatrix(!0,!1);const t=this.matrixWorld.elements;return e.set(t[8],t[9],t[10]).normalize()}raycast(){}traverse(e){e(this);const t=this.children;for(let s=0,i=t.length;s<i;s++)t[s].traverse(e)}traverseVisible(e){if(this.visible===!1)return;e(this);const t=this.children;for(let s=0,i=t.length;s<i;s++)t[s].traverseVisible(e)}traverseAncestors(e){const t=this.parent;t!==null&&(e(t),t.traverseAncestors(e))}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale);const e=this.pivot;if(e!==null){const t=e.x,s=e.y,i=e.z,r=this.matrix.elements;r[12]+=t-r[0]*t-r[4]*s-r[8]*i,r[13]+=s-r[1]*t-r[5]*s-r[9]*i,r[14]+=i-r[2]*t-r[6]*s-r[10]*i}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 t=this.children;for(let s=0,i=t.length;s<i;s++)t[s].updateMatrixWorld(e)}updateWorldMatrix(e,t,s=!1){const i=this.parent;if(e===!0&&i!==null&&i.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||s)&&(this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),this.matrixWorldNeedsUpdate=!1,s=!0),t===!0){const r=this.children;for(let a=0,o=r.length;a<o;a++)r[a].updateWorldMatrix(!1,!0,s)}}toJSON(e){const t=e===void 0||typeof e=="string",s={};t&&(e={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},s.metadata={version:4.7,type:"Object",generator:"Object3D.toJSON"});const i={};i.uuid=this.uuid,i.type=this.type,this.name!==""&&(i.name=this.name),this.castShadow===!0&&(i.castShadow=!0),this.receiveShadow===!0&&(i.receiveShadow=!0),this.visible===!1&&(i.visible=!1),this.frustumCulled===!1&&(i.frustumCulled=!1),this.renderOrder!==0&&(i.renderOrder=this.renderOrder),this.static!==!1&&(i.static=this.static),Object.keys(this.userData).length>0&&(i.userData=this.userData),i.layers=this.layers.mask,i.matrix=this.matrix.toArray(),i.up=this.up.toArray(),this.pivot!==null&&(i.pivot=this.pivot.toArray()),this.matrixAutoUpdate===!1&&(i.matrixAutoUpdate=!1),this.morphTargetDictionary!==void 0&&(i.morphTargetDictionary=Object.assign({},this.morphTargetDictionary)),this.morphTargetInfluences!==void 0&&(i.morphTargetInfluences=this.morphTargetInfluences.slice()),this.isInstancedMesh&&(i.type="InstancedMesh",i.count=this.count,i.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(i.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(i.type="BatchedMesh",i.perObjectFrustumCulled=this.perObjectFrustumCulled,i.sortObjects=this.sortObjects,i.drawRanges=this._drawRanges,i.reservedRanges=this._reservedRanges,i.geometryInfo=this._geometryInfo.map(o=>({...o,boundingBox:o.boundingBox?o.boundingBox.toJSON():void 0,boundingSphere:o.boundingSphere?o.boundingSphere.toJSON():void 0})),i.instanceInfo=this._instanceInfo.map(o=>({...o})),i.availableInstanceIds=this._availableInstanceIds.slice(),i.availableGeometryIds=this._availableGeometryIds.slice(),i.nextIndexStart=this._nextIndexStart,i.nextVertexStart=this._nextVertexStart,i.geometryCount=this._geometryCount,i.maxInstanceCount=this._maxInstanceCount,i.maxVertexCount=this._maxVertexCount,i.maxIndexCount=this._maxIndexCount,i.geometryInitialized=this._geometryInitialized,i.matricesTexture=this._matricesTexture.toJSON(e),i.indirectTexture=this._indirectTexture.toJSON(e),this._colorsTexture!==null&&(i.colorsTexture=this._colorsTexture.toJSON(e)),this.boundingSphere!==null&&(i.boundingSphere=this.boundingSphere.toJSON()),this.boundingBox!==null&&(i.boundingBox=this.boundingBox.toJSON()));function r(o,l){return o[l.uuid]===void 0&&(o[l.uuid]=l.toJSON(e)),l.uuid}if(this.isScene)this.background&&(this.background.isColor?i.background=this.background.toJSON():this.background.isTexture&&(i.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(i.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){i.geometry=r(e.geometries,this.geometry);const o=this.geometry.parameters;if(o!==void 0&&o.shapes!==void 0){const l=o.shapes;if(Array.isArray(l))for(let c=0,d=l.length;c<d;c++){const u=l[c];r(e.shapes,u)}else r(e.shapes,l)}}if(this.isSkinnedMesh&&(i.bindMode=this.bindMode,i.bindMatrix=this.bindMatrix.toArray(),this.skeleton!==void 0&&(r(e.skeletons,this.skeleton),i.skeleton=this.skeleton.uuid)),this.material!==void 0)if(Array.isArray(this.material)){const o=[];for(let l=0,c=this.material.length;l<c;l++)o.push(r(e.materials,this.material[l]));i.material=o}else i.material=r(e.materials,this.material);if(this.children.length>0){i.children=[];for(let o=0;o<this.children.length;o++)i.children.push(this.children[o].toJSON(e).object)}if(this.animations.length>0){i.animations=[];for(let o=0;o<this.animations.length;o++){const l=this.animations[o];i.animations.push(r(e.animations,l))}}if(t){const o=a(e.geometries),l=a(e.materials),c=a(e.textures),d=a(e.images),u=a(e.shapes),h=a(e.skeletons),g=a(e.animations),p=a(e.nodes);o.length>0&&(s.geometries=o),l.length>0&&(s.materials=l),c.length>0&&(s.textures=c),d.length>0&&(s.images=d),u.length>0&&(s.shapes=u),h.length>0&&(s.skeletons=h),g.length>0&&(s.animations=g),p.length>0&&(s.nodes=p)}return s.object=i,s;function a(o){const l=[];for(const c in o){const d=o[c];delete d.metadata,l.push(d)}return l}}clone(e){return new this.constructor().copy(this,e)}copy(e,t=!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)),t===!0)for(let s=0;s<e.children.length;s++){const i=e.children[s];this.add(i.clone())}return this}}ss.DEFAULT_UP=new F(0,1,0);ss.DEFAULT_MATRIX_AUTO_UPDATE=!0;ss.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;class Da extends ss{constructor(){super(),this.isGroup=!0,this.type="Group"}}const Wz={type:"move"};class Jl{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new Da,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 Da,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new F,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new F),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new Da,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new F,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new F,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 t=this._hand;if(t)for(const s of e.hand.values())this._getHandJoint(t,s)}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,t,s){let i=null,r=null,a=null;const o=this._targetRay,l=this._grip,c=this._hand;if(e&&t.session.visibilityState!=="visible-blurred"){if(c&&e.hand){a=!0;for(const z of e.hand.values()){const m=t.getJointPose(z,s),f=this._getHandJoint(c,z);m!==null&&(f.matrix.fromArray(m.transform.matrix),f.matrix.decompose(f.position,f.rotation,f.scale),f.matrixWorldNeedsUpdate=!0,f.jointRadius=m.radius),f.visible=m!==null}const d=c.joints["index-finger-tip"],u=c.joints["thumb-tip"],h=d.position.distanceTo(u.position),g=.02,p=.005;c.inputState.pinching&&h>g+p?(c.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!c.inputState.pinching&&h<=g-p&&(c.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else l!==null&&e.gripSpace&&(r=t.getPose(e.gripSpace,s),r!==null&&(l.matrix.fromArray(r.transform.matrix),l.matrix.decompose(l.position,l.rotation,l.scale),l.matrixWorldNeedsUpdate=!0,r.linearVelocity?(l.hasLinearVelocity=!0,l.linearVelocity.copy(r.linearVelocity)):l.hasLinearVelocity=!1,r.angularVelocity?(l.hasAngularVelocity=!0,l.angularVelocity.copy(r.angularVelocity)):l.hasAngularVelocity=!1,l.eventsEnabled&&l.dispatchEvent({type:"gripUpdated",data:e,target:this})));o!==null&&(i=t.getPose(e.targetRaySpace,s),i===null&&r!==null&&(i=r),i!==null&&(o.matrix.fromArray(i.transform.matrix),o.matrix.decompose(o.position,o.rotation,o.scale),o.matrixWorldNeedsUpdate=!0,i.linearVelocity?(o.hasLinearVelocity=!0,o.linearVelocity.copy(i.linearVelocity)):o.hasLinearVelocity=!1,i.angularVelocity?(o.hasAngularVelocity=!0,o.angularVelocity.copy(i.angularVelocity)):o.hasAngularVelocity=!1,this.dispatchEvent(Wz)))}return o!==null&&(o.visible=i!==null),l!==null&&(l.visible=r!==null),c!==null&&(c.visible=a!==null),this}_getHandJoint(e,t){if(e.joints[t.jointName]===void 0){const s=new Da;s.matrixAutoUpdate=!1,s.visible=!1,e.joints[t.jointName]=s,e.add(s)}return e.joints[t.jointName]}}const jm={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},di={h:0,s:0,l:0},Ka={h:0,s:0,l:0};function ec(n,e,t){return t<0&&(t+=1),t>1&&(t-=1),t<1/6?n+(e-n)*6*t:t<1/2?e:t<2/3?n+(e-n)*6*(2/3-t):n}class Ye{constructor(e,t,s){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(e,t,s)}set(e,t,s){if(t===void 0&&s===void 0){const i=e;i&&i.isColor?this.copy(i):typeof i=="number"?this.setHex(i):typeof i=="string"&&this.setStyle(i)}else this.setRGB(e,t,s);return this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,t=sn){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,xt.colorSpaceToWorking(this,t),this}setRGB(e,t,s,i=xt.workingColorSpace){return this.r=e,this.g=t,this.b=s,xt.colorSpaceToWorking(this,i),this}setHSL(e,t,s,i=xt.workingColorSpace){if(e=Sz(e,1),t=St(t,0,1),s=St(s,0,1),t===0)this.r=this.g=this.b=s;else{const r=s<=.5?s*(1+t):s+t-s*t,a=2*s-r;this.r=ec(a,r,e+1/3),this.g=ec(a,r,e),this.b=ec(a,r,e-1/3)}return xt.colorSpaceToWorking(this,i),this}setStyle(e,t=sn){function s(r){r!==void 0&&parseFloat(r)<1&&st("Color: Alpha component of "+e+" will be ignored.")}let i;if(i=/^(\w+)\(([^\)]*)\)/.exec(e)){let r;const a=i[1],o=i[2];switch(a){case"rgb":case"rgba":if(r=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return s(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,t);if(r=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return s(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,t);break;case"hsl":case"hsla":if(r=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return s(r[4]),this.setHSL(parseFloat(r[1])/360,parseFloat(r[2])/100,parseFloat(r[3])/100,t);break;default:st("Color: Unknown color model "+e)}}else if(i=/^\#([A-Fa-f\d]+)$/.exec(e)){const r=i[1],a=r.length;if(a===3)return this.setRGB(parseInt(r.charAt(0),16)/15,parseInt(r.charAt(1),16)/15,parseInt(r.charAt(2),16)/15,t);if(a===6)return this.setHex(parseInt(r,16),t);st("Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,t);return this}setColorName(e,t=sn){const s=jm[e.toLowerCase()];return s!==void 0?this.setHex(s,t):st("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=Qn(e.r),this.g=Qn(e.g),this.b=Qn(e.b),this}copyLinearToSRGB(e){return this.r=Lr(e.r),this.g=Lr(e.g),this.b=Lr(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=sn){return xt.workingToColorSpace(As.copy(this),e),Math.round(St(As.r*255,0,255))*65536+Math.round(St(As.g*255,0,255))*256+Math.round(St(As.b*255,0,255))}getHexString(e=sn){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=xt.workingColorSpace){xt.workingToColorSpace(As.copy(this),t);const s=As.r,i=As.g,r=As.b,a=Math.max(s,i,r),o=Math.min(s,i,r);let l,c;const d=(o+a)/2;if(o===a)l=0,c=0;else{const u=a-o;switch(c=d<=.5?u/(a+o):u/(2-a-o),a){case s:l=(i-r)/u+(i<r?6:0);break;case i:l=(r-s)/u+2;break;case r:l=(s-i)/u+4;break}l/=6}return e.h=l,e.s=c,e.l=d,e}getRGB(e,t=xt.workingColorSpace){return xt.workingToColorSpace(As.copy(this),t),e.r=As.r,e.g=As.g,e.b=As.b,e}getStyle(e=sn){xt.workingToColorSpace(As.copy(this),e);const t=As.r,s=As.g,i=As.b;return e!==sn?`color(${e} ${t.toFixed(3)} ${s.toFixed(3)} ${i.toFixed(3)})`:`rgb(${Math.round(t*255)},${Math.round(s*255)},${Math.round(i*255)})`}offsetHSL(e,t,s){return this.getHSL(di),this.setHSL(di.h+e,di.s+t,di.l+s)}add(e){return this.r+=e.r,this.g+=e.g,this.b+=e.b,this}addColors(e,t){return this.r=e.r+t.r,this.g=e.g+t.g,this.b=e.b+t.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,t){return this.r+=(e.r-this.r)*t,this.g+=(e.g-this.g)*t,this.b+=(e.b-this.b)*t,this}lerpColors(e,t,s){return this.r=e.r+(t.r-e.r)*s,this.g=e.g+(t.g-e.g)*s,this.b=e.b+(t.b-e.b)*s,this}lerpHSL(e,t){this.getHSL(di),e.getHSL(Ka);const s=ql(di.h,Ka.h,t),i=ql(di.s,Ka.s,t),r=ql(di.l,Ka.l,t);return this.setHSL(s,i,r),this}setFromVector3(e){return this.r=e.x,this.g=e.y,this.b=e.z,this}applyMatrix3(e){const t=this.r,s=this.g,i=this.b,r=e.elements;return this.r=r[0]*t+r[3]*s+r[6]*i,this.g=r[1]*t+r[4]*s+r[7]*i,this.b=r[2]*t+r[5]*s+r[8]*i,this}equals(e){return e.r===this.r&&e.g===this.g&&e.b===this.b}fromArray(e,t=0){return this.r=e[t],this.g=e[t+1],this.b=e[t+2],this}toArray(e=[],t=0){return e[t]=this.r,e[t+1]=this.g,e[t+2]=this.b,e}fromBufferAttribute(e,t){return this.r=e.getX(t),this.g=e.getY(t),this.b=e.getZ(t),this}toJSON(){return this.getHex()}*[Symbol.iterator](){yield this.r,yield this.g,yield this.b}}const As=new Ye;Ye.NAMES=jm;class kz extends ss{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 Di,this.environmentIntensity=1,this.environmentRotation=new Di,this.overrideMaterial=null,typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(e,t){return super.copy(e,t),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 t=super.toJSON(e);return this.fog!==null&&(t.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(t.object.backgroundBlurriness=this.backgroundBlurriness),this.backgroundIntensity!==1&&(t.object.backgroundIntensity=this.backgroundIntensity),t.object.backgroundRotation=this.backgroundRotation.toArray(),this.environmentIntensity!==1&&(t.object.environmentIntensity=this.environmentIntensity),t.object.environmentRotation=this.environmentRotation.toArray(),t}}const un=new F,Nn=new F,tc=new F,Cn=new F,mr=new F,gr=new F,Dh=new F,sc=new F,nc=new F,ic=new F,rc=new ts,ac=new ts,oc=new ts;class an{constructor(e=new F,t=new F,s=new F){this.a=e,this.b=t,this.c=s}static getNormal(e,t,s,i){i.subVectors(s,t),un.subVectors(e,t),i.cross(un);const r=i.lengthSq();return r>0?i.multiplyScalar(1/Math.sqrt(r)):i.set(0,0,0)}static getBarycoord(e,t,s,i,r){un.subVectors(i,t),Nn.subVectors(s,t),tc.subVectors(e,t);const a=un.dot(un),o=un.dot(Nn),l=un.dot(tc),c=Nn.dot(Nn),d=Nn.dot(tc),u=a*c-o*o;if(u===0)return r.set(0,0,0),null;const h=1/u,g=(c*l-o*d)*h,p=(a*d-o*l)*h;return r.set(1-g-p,p,g)}static containsPoint(e,t,s,i){return this.getBarycoord(e,t,s,i,Cn)===null?!1:Cn.x>=0&&Cn.y>=0&&Cn.x+Cn.y<=1}static getInterpolation(e,t,s,i,r,a,o,l){return this.getBarycoord(e,t,s,i,Cn)===null?(l.x=0,l.y=0,"z"in l&&(l.z=0),"w"in l&&(l.w=0),null):(l.setScalar(0),l.addScaledVector(r,Cn.x),l.addScaledVector(a,Cn.y),l.addScaledVector(o,Cn.z),l)}static getInterpolatedAttribute(e,t,s,i,r,a){return rc.setScalar(0),ac.setScalar(0),oc.setScalar(0),rc.fromBufferAttribute(e,t),ac.fromBufferAttribute(e,s),oc.fromBufferAttribute(e,i),a.setScalar(0),a.addScaledVector(rc,r.x),a.addScaledVector(ac,r.y),a.addScaledVector(oc,r.z),a}static isFrontFacing(e,t,s,i){return un.subVectors(s,t),Nn.subVectors(e,t),un.cross(Nn).dot(i)<0}set(e,t,s){return this.a.copy(e),this.b.copy(t),this.c.copy(s),this}setFromPointsAndIndices(e,t,s,i){return this.a.copy(e[t]),this.b.copy(e[s]),this.c.copy(e[i]),this}setFromAttributeAndIndices(e,t,s,i){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,s),this.c.fromBufferAttribute(e,i),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 un.subVectors(this.c,this.b),Nn.subVectors(this.a,this.b),un.cross(Nn).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return an.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return an.getBarycoord(e,this.a,this.b,this.c,t)}getInterpolation(e,t,s,i,r){return an.getInterpolation(e,this.a,this.b,this.c,t,s,i,r)}containsPoint(e){return an.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return an.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){const s=this.a,i=this.b,r=this.c;let a,o;mr.subVectors(i,s),gr.subVectors(r,s),sc.subVectors(e,s);const l=mr.dot(sc),c=gr.dot(sc);if(l<=0&&c<=0)return t.copy(s);nc.subVectors(e,i);const d=mr.dot(nc),u=gr.dot(nc);if(d>=0&&u<=d)return t.copy(i);const h=l*u-d*c;if(h<=0&&l>=0&&d<=0)return a=l/(l-d),t.copy(s).addScaledVector(mr,a);ic.subVectors(e,r);const g=mr.dot(ic),p=gr.dot(ic);if(p>=0&&g<=p)return t.copy(r);const z=g*c-l*p;if(z<=0&&c>=0&&p<=0)return o=c/(c-p),t.copy(s).addScaledVector(gr,o);const m=d*p-g*u;if(m<=0&&u-d>=0&&g-p>=0)return Dh.subVectors(r,i),o=(u-d)/(u-d+(g-p)),t.copy(i).addScaledVector(Dh,o);const f=1/(m+z+h);return a=z*f,o=h*f,t.copy(s).addScaledVector(mr,a).addScaledVector(gr,o)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}class ar{constructor(e=new F(1/0,1/0,1/0),t=new F(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromArray(e){this.makeEmpty();for(let t=0,s=e.length;t<s;t+=3)this.expandByPoint(hn.fromArray(e,t));return this}setFromBufferAttribute(e){this.makeEmpty();for(let t=0,s=e.count;t<s;t++)this.expandByPoint(hn.fromBufferAttribute(e,t));return this}setFromPoints(e){this.makeEmpty();for(let t=0,s=e.length;t<s;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){const s=hn.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(s),this.max.copy(e).add(s),this}setFromObject(e,t=!1){return this.makeEmpty(),this.expandByObject(e,t)}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,t=!1){e.updateWorldMatrix(!1,!1);const s=e.geometry;if(s!==void 0){const r=s.getAttribute("position");if(t===!0&&r!==void 0&&e.isInstancedMesh!==!0)for(let a=0,o=r.count;a<o;a++)e.isMesh===!0?e.getVertexPosition(a,hn):hn.fromBufferAttribute(r,a),hn.applyMatrix4(e.matrixWorld),this.expandByPoint(hn);else e.boundingBox!==void 0?(e.boundingBox===null&&e.computeBoundingBox(),Za.copy(e.boundingBox)):(s.boundingBox===null&&s.computeBoundingBox(),Za.copy(s.boundingBox)),Za.applyMatrix4(e.matrixWorld),this.union(Za)}const i=e.children;for(let r=0,a=i.length;r<a;r++)this.expandByObject(i[r],t);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,t){return t.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,hn),hn.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let t,s;return e.normal.x>0?(t=e.normal.x*this.min.x,s=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,s=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,s+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,s+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,s+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,s+=e.normal.z*this.min.z),t<=-e.constant&&s>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(da),Qa.subVectors(this.max,da),Mr.subVectors(e.a,da),br.subVectors(e.b,da),zr.subVectors(e.c,da),ui.subVectors(br,Mr),hi.subVectors(zr,br),Ti.subVectors(Mr,zr);let t=[0,-ui.z,ui.y,0,-hi.z,hi.y,0,-Ti.z,Ti.y,ui.z,0,-ui.x,hi.z,0,-hi.x,Ti.z,0,-Ti.x,-ui.y,ui.x,0,-hi.y,hi.x,0,-Ti.y,Ti.x,0];return!lc(t,Mr,br,zr,Qa)||(t=[1,0,0,0,1,0,0,0,1],!lc(t,Mr,br,zr,Qa))?!1:(Ja.crossVectors(ui,hi),t=[Ja.x,Ja.y,Ja.z],lc(t,Mr,br,zr,Qa))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,hn).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(hn).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:(Pn[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),Pn[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),Pn[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),Pn[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),Pn[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),Pn[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),Pn[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),Pn[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(Pn),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 Pn=[new F,new F,new F,new F,new F,new F,new F,new F],hn=new F,Za=new ar,Mr=new F,br=new F,zr=new F,ui=new F,hi=new F,Ti=new F,da=new F,Qa=new F,Ja=new F,Gi=new F;function lc(n,e,t,s,i){for(let r=0,a=n.length-3;r<=a;r+=3){Gi.fromArray(n,r);const o=i.x*Math.abs(Gi.x)+i.y*Math.abs(Gi.y)+i.z*Math.abs(Gi.z),l=e.dot(Gi),c=t.dot(Gi),d=s.dot(Gi);if(Math.max(-Math.max(l,c,d),Math.min(l,c,d))>o)return!1}return!0}const os=new F,eo=new lt;let Uz=0;class ws extends ir{constructor(e,t,s=!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:Uz++}),this.name="",this.array=e,this.itemSize=t,this.count=e!==void 0?e.length/t:0,this.normalized=s,this.usage=Yd,this.updateRanges=[],this.gpuType=Mn,this.version=0}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}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,t,s){e*=this.itemSize,s*=t.itemSize;for(let i=0,r=this.itemSize;i<r;i++)this.array[e+i]=t.array[s+i];return this}copyArray(e){return this.array.set(e),this}applyMatrix3(e){if(this.itemSize===2)for(let t=0,s=this.count;t<s;t++)eo.fromBufferAttribute(this,t),eo.applyMatrix3(e),this.setXY(t,eo.x,eo.y);else if(this.itemSize===3)for(let t=0,s=this.count;t<s;t++)os.fromBufferAttribute(this,t),os.applyMatrix3(e),this.setXYZ(t,os.x,os.y,os.z);return this}applyMatrix4(e){for(let t=0,s=this.count;t<s;t++)os.fromBufferAttribute(this,t),os.applyMatrix4(e),this.setXYZ(t,os.x,os.y,os.z);return this}applyNormalMatrix(e){for(let t=0,s=this.count;t<s;t++)os.fromBufferAttribute(this,t),os.applyNormalMatrix(e),this.setXYZ(t,os.x,os.y,os.z);return this}transformDirection(e){for(let t=0,s=this.count;t<s;t++)os.fromBufferAttribute(this,t),os.transformDirection(e),this.setXYZ(t,os.x,os.y,os.z);return this}set(e,t=0){return this.array.set(e,t),this}getComponent(e,t){let s=this.array[e*this.itemSize+t];return this.normalized&&(s=xn(s,this.array)),s}setComponent(e,t,s){return this.normalized&&(s=Ft(s,this.array)),this.array[e*this.itemSize+t]=s,this}getX(e){let t=this.array[e*this.itemSize];return this.normalized&&(t=xn(t,this.array)),t}setX(e,t){return this.normalized&&(t=Ft(t,this.array)),this.array[e*this.itemSize]=t,this}getY(e){let t=this.array[e*this.itemSize+1];return this.normalized&&(t=xn(t,this.array)),t}setY(e,t){return this.normalized&&(t=Ft(t,this.array)),this.array[e*this.itemSize+1]=t,this}getZ(e){let t=this.array[e*this.itemSize+2];return this.normalized&&(t=xn(t,this.array)),t}setZ(e,t){return this.normalized&&(t=Ft(t,this.array)),this.array[e*this.itemSize+2]=t,this}getW(e){let t=this.array[e*this.itemSize+3];return this.normalized&&(t=xn(t,this.array)),t}setW(e,t){return this.normalized&&(t=Ft(t,this.array)),this.array[e*this.itemSize+3]=t,this}setXY(e,t,s){return e*=this.itemSize,this.normalized&&(t=Ft(t,this.array),s=Ft(s,this.array)),this.array[e+0]=t,this.array[e+1]=s,this}setXYZ(e,t,s,i){return e*=this.itemSize,this.normalized&&(t=Ft(t,this.array),s=Ft(s,this.array),i=Ft(i,this.array)),this.array[e+0]=t,this.array[e+1]=s,this.array[e+2]=i,this}setXYZW(e,t,s,i,r){return e*=this.itemSize,this.normalized&&(t=Ft(t,this.array),s=Ft(s,this.array),i=Ft(i,this.array),r=Ft(r,this.array)),this.array[e+0]=t,this.array[e+1]=s,this.array[e+2]=i,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 this.name!==""&&(e.name=this.name),this.usage!==Yd&&(e.usage=this.usage),e}dispose(){this.dispatchEvent({type:"dispose"})}}class $m extends ws{constructor(e,t,s){super(new Uint16Array(e),t,s)}}class Vm extends ws{constructor(e,t,s){super(new Uint32Array(e),t,s)}}class Xt extends ws{constructor(e,t,s){super(new Float32Array(e),t,s)}}const Fz=new ar,ua=new F,cc=new F;class or{constructor(e=new F,t=-1){this.isSphere=!0,this.center=e,this.radius=t}set(e,t){return this.center.copy(e),this.radius=t,this}setFromPoints(e,t){const s=this.center;t!==void 0?s.copy(t):Fz.setFromPoints(e).getCenter(s);let i=0;for(let r=0,a=e.length;r<a;r++)i=Math.max(i,s.distanceToSquared(e[r]));return this.radius=Math.sqrt(i),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 t=this.radius+e.radius;return e.center.distanceToSquared(this.center)<=t*t}intersectsBox(e){return e.intersectsSphere(this)}intersectsPlane(e){return Math.abs(e.distanceToPoint(this.center))<=this.radius}clampPoint(e,t){const s=this.center.distanceToSquared(e);return t.copy(e),s>this.radius*this.radius&&(t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center)),t}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;ua.subVectors(e,this.center);const t=ua.lengthSq();if(t>this.radius*this.radius){const s=Math.sqrt(t),i=(s-this.radius)*.5;this.center.addScaledVector(ua,i/s),this.radius+=i}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):(cc.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(ua.copy(e.center).add(cc)),this.expandByPoint(ua.copy(e.center).sub(cc))),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 jz=0;const en=new Gt,dc=new ss,_r=new F,qs=new ar,ha=new ar,bs=new F;class ds extends ir{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:jz++}),this.uuid=yi(),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(yz(e)?Vm:$m)(e,1):this.index=e,this}setIndirect(e,t=0){return this.indirect=e,this.indirectOffset=t,this}getIndirect(){return this.indirect}getAttribute(e){return this.attributes[e]}setAttribute(e,t){return this.attributes[e]=t,this}deleteAttribute(e){return delete this.attributes[e],this}hasAttribute(e){return this.attributes[e]!==void 0}addGroup(e,t,s=0){this.groups.push({start:e,count:t,materialIndex:s})}clearGroups(){this.groups=[]}setDrawRange(e,t){this.drawRange.start=e,this.drawRange.count=t}applyMatrix4(e){const t=this.attributes.position;t!==void 0&&(t.applyMatrix4(e),t.needsUpdate=!0);const s=this.attributes.normal;if(s!==void 0){const r=new ut().getNormalMatrix(e);s.applyNormalMatrix(r),s.needsUpdate=!0}const i=this.attributes.tangent;return i!==void 0&&(i.transformDirection(e),i.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this._transformed=!0,this}applyQuaternion(e){return en.makeRotationFromQuaternion(e),this.applyMatrix4(en),this}rotateX(e){return en.makeRotationX(e),this.applyMatrix4(en),this}rotateY(e){return en.makeRotationY(e),this.applyMatrix4(en),this}rotateZ(e){return en.makeRotationZ(e),this.applyMatrix4(en),this}translate(e,t,s){return en.makeTranslation(e,t,s),this.applyMatrix4(en),this}scale(e,t,s){return en.makeScale(e,t,s),this.applyMatrix4(en),this}lookAt(e){return dc.lookAt(e),dc.updateMatrix(),this.applyMatrix4(dc.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(_r).negate(),this.translate(_r.x,_r.y,_r.z),this}setFromPoints(e){const t=this.getAttribute("position");if(t===void 0){const s=[];for(let i=0,r=e.length;i<r;i++){const a=e[i];s.push(a.x,a.y,a.z||0)}this.setAttribute("position",new Xt(s,3))}else{const s=Math.min(e.length,t.count);for(let i=0;i<s;i++){const r=e[i];t.setXYZ(i,r.x,r.y,r.z||0)}e.length>t.count&&st("BufferGeometry: Buffer size too small for points data. Use .dispose() and create a new geometry."),t.needsUpdate=!0}return this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new ar);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){Ot("BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),this.boundingBox.set(new F(-1/0,-1/0,-1/0),new F(1/0,1/0,1/0));return}if(e!==void 0){if(this.boundingBox.setFromBufferAttribute(e),t)for(let s=0,i=t.length;s<i;s++){const r=t[s];qs.setFromBufferAttribute(r),this.morphTargetsRelative?(bs.addVectors(this.boundingBox.min,qs.min),this.boundingBox.expandByPoint(bs),bs.addVectors(this.boundingBox.max,qs.max),this.boundingBox.expandByPoint(bs)):(this.boundingBox.expandByPoint(qs.min),this.boundingBox.expandByPoint(qs.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&Ot('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 or);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){Ot("BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere.",this),this.boundingSphere.set(new F,1/0);return}if(e){const s=this.boundingSphere.center;if(qs.setFromBufferAttribute(e),t)for(let r=0,a=t.length;r<a;r++){const o=t[r];ha.setFromBufferAttribute(o),this.morphTargetsRelative?(bs.addVectors(qs.min,ha.min),qs.expandByPoint(bs),bs.addVectors(qs.max,ha.max),qs.expandByPoint(bs)):(qs.expandByPoint(ha.min),qs.expandByPoint(ha.max))}qs.getCenter(s);let i=0;for(let r=0,a=e.count;r<a;r++)bs.fromBufferAttribute(e,r),i=Math.max(i,s.distanceToSquared(bs));if(t)for(let r=0,a=t.length;r<a;r++){const o=t[r],l=this.morphTargetsRelative;for(let c=0,d=o.count;c<d;c++)bs.fromBufferAttribute(o,c),l&&(_r.fromBufferAttribute(e,c),bs.add(_r)),i=Math.max(i,s.distanceToSquared(bs))}this.boundingSphere.radius=Math.sqrt(i),isNaN(this.boundingSphere.radius)&&Ot('BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}computeTangents(){const e=this.index,t=this.attributes;if(e===null||t.position===void 0||t.normal===void 0||t.uv===void 0){Ot("BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");return}const s=t.position,i=t.normal,r=t.uv;let a=this.getAttribute("tangent");(a===void 0||a.count!==s.count)&&(a=new ws(new Float32Array(4*s.count),4),this.setAttribute("tangent",a));const o=[],l=[];for(let b=0;b<s.count;b++)o[b]=new F,l[b]=new F;const c=new F,d=new F,u=new F,h=new lt,g=new lt,p=new lt,z=new F,m=new F;function f(b,A,B){c.fromBufferAttribute(s,b),d.fromBufferAttribute(s,A),u.fromBufferAttribute(s,B),h.fromBufferAttribute(r,b),g.fromBufferAttribute(r,A),p.fromBufferAttribute(r,B),d.sub(c),u.sub(c),g.sub(h),p.sub(h);const N=1/(g.x*p.y-p.x*g.y);isFinite(N)&&(z.copy(d).multiplyScalar(p.y).addScaledVector(u,-g.y).multiplyScalar(N),m.copy(u).multiplyScalar(g.x).addScaledVector(d,-p.x).multiplyScalar(N),o[b].add(z),o[A].add(z),o[B].add(z),l[b].add(m),l[A].add(m),l[B].add(m))}let _=this.groups;_.length===0&&(_=[{start:0,count:e.count}]);for(let b=0,A=_.length;b<A;++b){const B=_[b],N=B.start,k=B.count;for(let L=N,j=N+k;L<j;L+=3)f(e.getX(L+0),e.getX(L+1),e.getX(L+2))}const O=new F,w=new F,x=new F,S=new F;function I(b){x.fromBufferAttribute(i,b),S.copy(x);const A=o[b];O.copy(A),O.sub(x.multiplyScalar(x.dot(A))).normalize(),w.crossVectors(S,A);const N=w.dot(l[b])<0?-1:1;a.setXYZW(b,O.x,O.y,O.z,N)}for(let b=0,A=_.length;b<A;++b){const B=_[b],N=B.start,k=B.count;for(let L=N,j=N+k;L<j;L+=3)I(e.getX(L+0)),I(e.getX(L+1)),I(e.getX(L+2))}this._transformed=!0}computeVertexNormals(){const e=this.index,t=this.getAttribute("position");if(t!==void 0){let s=this.getAttribute("normal");if(s===void 0||s.count!==t.count)s=new ws(new Float32Array(t.count*3),3),this.setAttribute("normal",s);else for(let h=0,g=s.count;h<g;h++)s.setXYZ(h,0,0,0);const i=new F,r=new F,a=new F,o=new F,l=new F,c=new F,d=new F,u=new F;if(e)for(let h=0,g=e.count;h<g;h+=3){const p=e.getX(h+0),z=e.getX(h+1),m=e.getX(h+2);i.fromBufferAttribute(t,p),r.fromBufferAttribute(t,z),a.fromBufferAttribute(t,m),d.subVectors(a,r),u.subVectors(i,r),d.cross(u),o.fromBufferAttribute(s,p),l.fromBufferAttribute(s,z),c.fromBufferAttribute(s,m),o.add(d),l.add(d),c.add(d),s.setXYZ(p,o.x,o.y,o.z),s.setXYZ(z,l.x,l.y,l.z),s.setXYZ(m,c.x,c.y,c.z)}else for(let h=0,g=t.count;h<g;h+=3)i.fromBufferAttribute(t,h+0),r.fromBufferAttribute(t,h+1),a.fromBufferAttribute(t,h+2),d.subVectors(a,r),u.subVectors(i,r),d.cross(u),s.setXYZ(h+0,d.x,d.y,d.z),s.setXYZ(h+1,d.x,d.y,d.z),s.setXYZ(h+2,d.x,d.y,d.z);this.normalizeNormals(),s.needsUpdate=!0}}normalizeNormals(){const e=this.attributes.normal;for(let t=0,s=e.count;t<s;t++)bs.fromBufferAttribute(e,t),bs.normalize(),e.setXYZ(t,bs.x,bs.y,bs.z)}toNonIndexed(){function e(o,l){const c=o.array,d=o.itemSize,u=o.normalized,h=new c.constructor(l.length*d);let g=0,p=0;for(let z=0,m=l.length;z<m;z++){o.isInterleavedBufferAttribute?g=l[z]*o.data.stride+o.offset:g=l[z]*d;for(let f=0;f<d;f++)h[p++]=c[g++]}return new ws(h,d,u)}if(this.index===null)return st("BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;const t=new ds,s=this.index.array,i=this.attributes;for(const o in i){const l=i[o],c=e(l,s);t.setAttribute(o,c)}const r=this.morphAttributes;for(const o in r){const l=[],c=r[o];for(let d=0,u=c.length;d<u;d++){const h=c[d],g=e(h,s);l.push(g)}t.morphAttributes[o]=l}t.morphTargetsRelative=this.morphTargetsRelative;const a=this.groups;for(let o=0,l=a.length;o<l;o++){const c=a[o];t.addGroup(c.start,c.count,c.materialIndex)}return t}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,this.name!==""&&(e.name=this.name),Object.keys(this.userData).length>0&&(e.userData=this.userData),this.parameters!==void 0&&this._transformed!==!0){const l=this.parameters;for(const c in l)l[c]!==void 0&&(e[c]=l[c]);return e}e.data={attributes:{}};const t=this.index;t!==null&&(e.data.index={type:t.array.constructor.name,array:Array.prototype.slice.call(t.array)});const s=this.attributes;for(const l in s){const c=s[l];e.data.attributes[l]=c.toJSON(e.data)}const i={};let r=!1;for(const l in this.morphAttributes){const c=this.morphAttributes[l],d=[];for(let u=0,h=c.length;u<h;u++){const g=c[u];d.push(g.toJSON(e.data))}d.length>0&&(i[l]=d,r=!0)}r&&(e.data.morphAttributes=i,e.data.morphTargetsRelative=this.morphTargetsRelative);const a=this.groups;a.length>0&&(e.data.groups=JSON.parse(JSON.stringify(a)));const o=this.boundingSphere;return o!==null&&(e.data.boundingSphere=o.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 t={};this.name=e.name;const s=e.index;s!==null&&this.setIndex(s.clone());const i=e.attributes;for(const c in i){const d=i[c];this.setAttribute(c,d.clone(t))}const r=e.morphAttributes;for(const c in r){const d=[],u=r[c];for(let h=0,g=u.length;h<g;h++)d.push(u[h].clone(t));this.morphAttributes[c]=d}this.morphTargetsRelative=e.morphTargetsRelative;const a=e.groups;for(let c=0,d=a.length;c<d;c++){const u=a[c];this.addGroup(u.start,u.count,u.materialIndex)}const o=e.boundingBox;o!==null&&(this.boundingBox=o.clone());const l=e.boundingSphere;return l!==null&&(this.boundingSphere=l.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"})}}class $z{constructor(e,t){this.isInterleavedBuffer=!0,this.array=e,this.stride=t,this.count=e!==void 0?e.length/t:0,this.usage=Yd,this.updateRanges=[],this.version=0,this.uuid=yi()}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.array=new e.array.constructor(e.array),this.count=e.count,this.stride=e.stride,this.usage=e.usage,this}copyAt(e,t,s){e*=this.stride,s*=t.stride;for(let i=0,r=this.stride;i<r;i++)this.array[e+i]=t.array[s+i];return this}set(e,t=0){return this.array.set(e,t),this}clone(e){e.arrayBuffers===void 0&&(e.arrayBuffers={}),this.array.buffer._uuid===void 0&&(this.array.buffer._uuid=yi()),e.arrayBuffers[this.array.buffer._uuid]===void 0&&(e.arrayBuffers[this.array.buffer._uuid]=this.array.slice(0).buffer);const t=new this.array.constructor(e.arrayBuffers[this.array.buffer._uuid]),s=new this.constructor(t,this.stride);return s.setUsage(this.usage),s}onUpload(e){return this.onUploadCallback=e,this}toJSON(e){return e.arrayBuffers===void 0&&(e.arrayBuffers={}),this.array.buffer._uuid===void 0&&(this.array.buffer._uuid=yi()),e.arrayBuffers[this.array.buffer._uuid]===void 0&&(e.arrayBuffers[this.array.buffer._uuid]=Array.from(new Uint32Array(this.array.buffer))),{uuid:this.uuid,buffer:this.array.buffer._uuid,type:this.array.constructor.name,stride:this.stride}}}const Gs=new F;class pl{constructor(e,t,s,i=!1){this.isInterleavedBufferAttribute=!0,this.name="",this.data=e,this.itemSize=t,this.offset=s,this.normalized=i}get count(){return this.data.count}get array(){return this.data.array}set needsUpdate(e){this.data.needsUpdate=e}applyMatrix4(e){for(let t=0,s=this.data.count;t<s;t++)Gs.fromBufferAttribute(this,t),Gs.applyMatrix4(e),this.setXYZ(t,Gs.x,Gs.y,Gs.z);return this}applyNormalMatrix(e){for(let t=0,s=this.count;t<s;t++)Gs.fromBufferAttribute(this,t),Gs.applyNormalMatrix(e),this.setXYZ(t,Gs.x,Gs.y,Gs.z);return this}transformDirection(e){for(let t=0,s=this.count;t<s;t++)Gs.fromBufferAttribute(this,t),Gs.transformDirection(e),this.setXYZ(t,Gs.x,Gs.y,Gs.z);return this}getComponent(e,t){let s=this.array[e*this.data.stride+this.offset+t];return this.normalized&&(s=xn(s,this.array)),s}setComponent(e,t,s){return this.normalized&&(s=Ft(s,this.array)),this.data.array[e*this.data.stride+this.offset+t]=s,this}setX(e,t){return this.normalized&&(t=Ft(t,this.array)),this.data.array[e*this.data.stride+this.offset]=t,this}setY(e,t){return this.normalized&&(t=Ft(t,this.array)),this.data.array[e*this.data.stride+this.offset+1]=t,this}setZ(e,t){return this.normalized&&(t=Ft(t,this.array)),this.data.array[e*this.data.stride+this.offset+2]=t,this}setW(e,t){return this.normalized&&(t=Ft(t,this.array)),this.data.array[e*this.data.stride+this.offset+3]=t,this}getX(e){let t=this.data.array[e*this.data.stride+this.offset];return this.normalized&&(t=xn(t,this.array)),t}getY(e){let t=this.data.array[e*this.data.stride+this.offset+1];return this.normalized&&(t=xn(t,this.array)),t}getZ(e){let t=this.data.array[e*this.data.stride+this.offset+2];return this.normalized&&(t=xn(t,this.array)),t}getW(e){let t=this.data.array[e*this.data.stride+this.offset+3];return this.normalized&&(t=xn(t,this.array)),t}setXY(e,t,s){return e=e*this.data.stride+this.offset,this.normalized&&(t=Ft(t,this.array),s=Ft(s,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=s,this}setXYZ(e,t,s,i){return e=e*this.data.stride+this.offset,this.normalized&&(t=Ft(t,this.array),s=Ft(s,this.array),i=Ft(i,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=s,this.data.array[e+2]=i,this}setXYZW(e,t,s,i,r){return e=e*this.data.stride+this.offset,this.normalized&&(t=Ft(t,this.array),s=Ft(s,this.array),i=Ft(i,this.array),r=Ft(r,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=s,this.data.array[e+2]=i,this.data.array[e+3]=r,this}clone(e){if(e===void 0){fl("InterleavedBufferAttribute.clone(): Cloning an interleaved buffer attribute will de-interleave buffer data.");const t=[];for(let s=0;s<this.count;s++){const i=s*this.data.stride+this.offset;for(let r=0;r<this.itemSize;r++)t.push(this.data.array[i+r])}return new ws(new this.array.constructor(t),this.itemSize,this.normalized)}else return e.interleavedBuffers===void 0&&(e.interleavedBuffers={}),e.interleavedBuffers[this.data.uuid]===void 0&&(e.interleavedBuffers[this.data.uuid]=this.data.clone(e)),new pl(e.interleavedBuffers[this.data.uuid],this.itemSize,this.offset,this.normalized)}toJSON(e){if(e===void 0){fl("InterleavedBufferAttribute.toJSON(): Serializing an interleaved buffer attribute will de-interleave buffer data.");const t=[];for(let s=0;s<this.count;s++){const i=s*this.data.stride+this.offset;for(let r=0;r<this.itemSize;r++)t.push(this.data.array[i+r])}return{itemSize:this.itemSize,type:this.array.constructor.name,array:t,normalized:this.normalized}}else return e.interleavedBuffers===void 0&&(e.interleavedBuffers={}),e.interleavedBuffers[this.data.uuid]===void 0&&(e.interleavedBuffers[this.data.uuid]=this.data.toJSON(e)),{isInterleavedBufferAttribute:!0,itemSize:this.itemSize,data:this.data.uuid,offset:this.offset,normalized:this.normalized}}}let Vz=0;class ni extends ir{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:Vz++}),this.uuid=yi(),this.name="",this.type="Material",this.blending=$i,this.side=Ei,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=od,this.blendDst=ld,this.blendEquation=Wi,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new Ye(0,0,0),this.blendAlpha=0,this.depthFunc=$r,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=gh,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=dr,this.stencilZFail=dr,this.stencilZPass=dr,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 t in e){const s=e[t];if(s===void 0){st(`Material: parameter '${t}' has value of undefined.`);continue}const i=this[t];if(i===void 0){st(`Material: '${t}' is not a property of THREE.${this.type}.`);continue}i&&i.isColor?i.set(s):i&&i.isVector2&&s&&s.isVector2||i&&i.isEuler&&s&&s.isEuler||i&&i.isVector3&&s&&s.isVector3?i.copy(s):this[t]=s}}toJSON(e){const t=e===void 0||typeof e=="string";t&&(e={textures:{},images:{}});const s={metadata:{version:4.7,type:"Material",generator:"Material.toJSON"}};s.uuid=this.uuid,s.type=this.type,this.name!==""&&(s.name=this.name),this.color&&this.color.isColor&&(s.color=this.color.getHex()),this.roughness!==void 0&&(s.roughness=this.roughness),this.metalness!==void 0&&(s.metalness=this.metalness),this.sheen!==void 0&&(s.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(s.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(s.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(s.emissive=this.emissive.getHex()),this.emissiveIntensity!==void 0&&this.emissiveIntensity!==1&&(s.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(s.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(s.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(s.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(s.shininess=this.shininess),this.clearcoat!==void 0&&(s.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(s.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(s.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(s.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(s.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,s.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.sheenColorMap&&this.sheenColorMap.isTexture&&(s.sheenColorMap=this.sheenColorMap.toJSON(e).uuid),this.sheenRoughnessMap&&this.sheenRoughnessMap.isTexture&&(s.sheenRoughnessMap=this.sheenRoughnessMap.toJSON(e).uuid),this.dispersion!==void 0&&(s.dispersion=this.dispersion),this.iridescence!==void 0&&(s.iridescence=this.iridescence),this.iridescenceIOR!==void 0&&(s.iridescenceIOR=this.iridescenceIOR),this.iridescenceThicknessRange!==void 0&&(s.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(s.iridescenceMap=this.iridescenceMap.toJSON(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(s.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid),this.anisotropy!==void 0&&(s.anisotropy=this.anisotropy),this.anisotropyRotation!==void 0&&(s.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(s.anisotropyMap=this.anisotropyMap.toJSON(e).uuid),this.map&&this.map.isTexture&&(s.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(s.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(s.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(s.lightMap=this.lightMap.toJSON(e).uuid,s.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(s.aoMap=this.aoMap.toJSON(e).uuid,s.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(s.bumpMap=this.bumpMap.toJSON(e).uuid,s.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(s.normalMap=this.normalMap.toJSON(e).uuid,s.normalMapType=this.normalMapType,s.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(s.displacementMap=this.displacementMap.toJSON(e).uuid,s.displacementScale=this.displacementScale,s.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(s.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(s.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(s.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(s.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(s.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(s.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(s.envMap=this.envMap.toJSON(e).uuid,this.combine!==void 0&&(s.combine=this.combine)),this.envMapRotation!==void 0&&(s.envMapRotation=this.envMapRotation.toArray()),this.envMapIntensity!==void 0&&(s.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(s.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(s.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(s.gradientMap=this.gradientMap.toJSON(e).uuid),this.transmission!==void 0&&(s.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(s.transmissionMap=this.transmissionMap.toJSON(e).uuid),this.thickness!==void 0&&(s.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(s.thicknessMap=this.thicknessMap.toJSON(e).uuid),this.attenuationDistance!==void 0&&this.attenuationDistance!==1/0&&(s.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(s.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(s.size=this.size),this.shadowSide!==null&&(s.shadowSide=this.shadowSide),this.sizeAttenuation!==void 0&&(s.sizeAttenuation=this.sizeAttenuation),this.blending!==$i&&(s.blending=this.blending),this.side!==Ei&&(s.side=this.side),this.vertexColors===!0&&(s.vertexColors=!0),this.opacity<1&&(s.opacity=this.opacity),this.transparent===!0&&(s.transparent=!0),this.blendSrc!==od&&(s.blendSrc=this.blendSrc),this.blendDst!==ld&&(s.blendDst=this.blendDst),this.blendEquation!==Wi&&(s.blendEquation=this.blendEquation),this.blendSrcAlpha!==null&&(s.blendSrcAlpha=this.blendSrcAlpha),this.blendDstAlpha!==null&&(s.blendDstAlpha=this.blendDstAlpha),this.blendEquationAlpha!==null&&(s.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&&this.blendColor.isColor&&(s.blendColor=this.blendColor.getHex()),this.blendAlpha!==0&&(s.blendAlpha=this.blendAlpha),this.depthFunc!==$r&&(s.depthFunc=this.depthFunc),this.depthTest===!1&&(s.depthTest=this.depthTest),this.depthWrite===!1&&(s.depthWrite=this.depthWrite),this.colorWrite===!1&&(s.colorWrite=this.colorWrite),this.stencilWriteMask!==255&&(s.stencilWriteMask=this.stencilWriteMask),this.stencilFunc!==gh&&(s.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(s.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(s.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==dr&&(s.stencilFail=this.stencilFail),this.stencilZFail!==dr&&(s.stencilZFail=this.stencilZFail),this.stencilZPass!==dr&&(s.stencilZPass=this.stencilZPass),this.stencilWrite===!0&&(s.stencilWrite=this.stencilWrite),this.rotation!==void 0&&this.rotation!==0&&(s.rotation=this.rotation),this.polygonOffset===!0&&(s.polygonOffset=!0),this.polygonOffsetFactor!==0&&(s.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(s.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth!==void 0&&this.linewidth!==1&&(s.linewidth=this.linewidth),this.dashSize!==void 0&&(s.dashSize=this.dashSize),this.gapSize!==void 0&&(s.gapSize=this.gapSize),this.scale!==void 0&&(s.scale=this.scale),this.dithering===!0&&(s.dithering=!0),this.alphaTest>0&&(s.alphaTest=this.alphaTest),this.alphaHash===!0&&(s.alphaHash=!0),this.alphaToCoverage===!0&&(s.alphaToCoverage=!0),this.premultipliedAlpha===!0&&(s.premultipliedAlpha=!0),this.forceSinglePass===!0&&(s.forceSinglePass=!0),this.allowOverride===!1&&(s.allowOverride=!1),this.wireframe===!0&&(s.wireframe=!0),this.wireframeLinewidth>1&&(s.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!=="round"&&(s.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!=="round"&&(s.wireframeLinejoin=this.wireframeLinejoin),this.flatShading===!0&&(s.flatShading=!0),this.visible===!1&&(s.visible=!1),this.toneMapped===!1&&(s.toneMapped=!1),this.fog===!1&&(s.fog=!1),Object.keys(this.userData).length>0&&(s.userData=this.userData);function i(r){const a=[];for(const o in r){const l=r[o];delete l.metadata,a.push(l)}return a}if(t){const r=i(e.textures),a=i(e.images);r.length>0&&(s.textures=r),a.length>0&&(s.images=a)}return s}fromJSON(e,t){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 Ye().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.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.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.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=t[e.map]||null),e.matcap!==void 0&&(this.matcap=t[e.matcap]||null),e.alphaMap!==void 0&&(this.alphaMap=t[e.alphaMap]||null),e.bumpMap!==void 0&&(this.bumpMap=t[e.bumpMap]||null),e.bumpScale!==void 0&&(this.bumpScale=e.bumpScale),e.normalMap!==void 0&&(this.normalMap=t[e.normalMap]||null),e.normalMapType!==void 0&&(this.normalMapType=e.normalMapType),e.normalScale!==void 0){let s=e.normalScale;Array.isArray(s)===!1&&(s=[s,s]),this.normalScale=new lt().fromArray(s)}return e.displacementMap!==void 0&&(this.displacementMap=t[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=t[e.roughnessMap]||null),e.metalnessMap!==void 0&&(this.metalnessMap=t[e.metalnessMap]||null),e.emissiveMap!==void 0&&(this.emissiveMap=t[e.emissiveMap]||null),e.emissiveIntensity!==void 0&&(this.emissiveIntensity=e.emissiveIntensity),e.specularMap!==void 0&&(this.specularMap=t[e.specularMap]||null),e.specularIntensityMap!==void 0&&(this.specularIntensityMap=t[e.specularIntensityMap]||null),e.specularColorMap!==void 0&&(this.specularColorMap=t[e.specularColorMap]||null),e.envMap!==void 0&&(this.envMap=t[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=t[e.lightMap]||null),e.lightMapIntensity!==void 0&&(this.lightMapIntensity=e.lightMapIntensity),e.aoMap!==void 0&&(this.aoMap=t[e.aoMap]||null),e.aoMapIntensity!==void 0&&(this.aoMapIntensity=e.aoMapIntensity),e.gradientMap!==void 0&&(this.gradientMap=t[e.gradientMap]||null),e.clearcoatMap!==void 0&&(this.clearcoatMap=t[e.clearcoatMap]||null),e.clearcoatRoughnessMap!==void 0&&(this.clearcoatRoughnessMap=t[e.clearcoatRoughnessMap]||null),e.clearcoatNormalMap!==void 0&&(this.clearcoatNormalMap=t[e.clearcoatNormalMap]||null),e.clearcoatNormalScale!==void 0&&(this.clearcoatNormalScale=new lt().fromArray(e.clearcoatNormalScale)),e.iridescenceMap!==void 0&&(this.iridescenceMap=t[e.iridescenceMap]||null),e.iridescenceThicknessMap!==void 0&&(this.iridescenceThicknessMap=t[e.iridescenceThicknessMap]||null),e.transmissionMap!==void 0&&(this.transmissionMap=t[e.transmissionMap]||null),e.thicknessMap!==void 0&&(this.thicknessMap=t[e.thicknessMap]||null),e.anisotropyMap!==void 0&&(this.anisotropyMap=t[e.anisotropyMap]||null),e.sheenColorMap!==void 0&&(this.sheenColorMap=t[e.sheenColorMap]||null),e.sheenRoughnessMap!==void 0&&(this.sheenRoughnessMap=t[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 t=e.clippingPlanes;let s=null;if(t!==null){const i=t.length;s=new Array(i);for(let r=0;r!==i;++r)s[r]=t[r].clone()}return this.clippingPlanes=s,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++}}class xl extends ni{constructor(e){super(),this.isSpriteMaterial=!0,this.type="SpriteMaterial",this.color=new Ye(16777215),this.map=null,this.alphaMap=null,this.rotation=0,this.sizeAttenuation=!0,this.transparent=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.rotation=e.rotation,this.sizeAttenuation=e.sizeAttenuation,this.fog=e.fog,this}}let wr;const fa=new F,yr=new F,vr=new F,Or=new lt,pa=new lt,Hm=new Gt,to=new F,ma=new F,so=new F,Ih=new lt,uc=new lt,Th=new lt;class xu extends ss{constructor(e=new xl){if(super(),this.isSprite=!0,this.type="Sprite",wr===void 0){wr=new ds;const t=new Float32Array([-.5,-.5,0,0,0,.5,-.5,0,1,0,.5,.5,0,1,1,-.5,.5,0,0,1]),s=new $z(t,5);wr.setIndex([0,1,2,0,2,3]),wr.setAttribute("position",new pl(s,3,0,!1)),wr.setAttribute("uv",new pl(s,2,3,!1))}this.geometry=wr,this.material=e,this.center=new lt(.5,.5),this.count=1}raycast(e,t){e.camera===null&&Ot('Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.'),yr.setFromMatrixScale(this.matrixWorld),Hm.copy(e.camera.matrixWorld),this.modelViewMatrix.multiplyMatrices(e.camera.matrixWorldInverse,this.matrixWorld),vr.setFromMatrixPosition(this.modelViewMatrix),e.camera.isPerspectiveCamera&&this.material.sizeAttenuation===!1&&yr.multiplyScalar(-vr.z);const s=this.material.rotation;let i,r;s!==0&&(r=Math.cos(s),i=Math.sin(s));const a=this.center;no(to.set(-.5,-.5,0),vr,a,yr,i,r),no(ma.set(.5,-.5,0),vr,a,yr,i,r),no(so.set(.5,.5,0),vr,a,yr,i,r),Ih.set(0,0),uc.set(1,0),Th.set(1,1);let o=e.ray.intersectTriangle(to,ma,so,!1,fa);if(o===null&&(no(ma.set(-.5,.5,0),vr,a,yr,i,r),uc.set(0,1),o=e.ray.intersectTriangle(to,so,ma,!1,fa),o===null))return;const l=e.ray.origin.distanceTo(fa);l<e.near||l>e.far||t.push({distance:l,point:fa.clone(),uv:an.getInterpolation(fa,to,ma,so,Ih,uc,Th,new lt),face:null,object:this})}copy(e,t){return super.copy(e,t),e.center!==void 0&&this.center.copy(e.center),this.material=e.material,this}}function no(n,e,t,s,i,r){Or.subVectors(n,t).addScalar(.5).multiply(s),i!==void 0?(pa.x=r*Or.x-i*Or.y,pa.y=i*Or.x+r*Or.y):pa.copy(Or),n.copy(e),n.x+=pa.x,n.y+=pa.y,n.applyMatrix4(Hm)}const Ln=new F,hc=new F,io=new F,fi=new F,fc=new F,ro=new F,pc=new F;class Sl{constructor(e=new F,t=new F(0,0,-1)){this.origin=e,this.direction=t}set(e,t){return this.origin.copy(e),this.direction.copy(t),this}copy(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this}at(e,t){return t.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,Ln)),this}closestPointToPoint(e,t){t.subVectors(e,this.origin);const s=t.dot(this.direction);return s<0?t.copy(this.origin):t.copy(this.origin).addScaledVector(this.direction,s)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){const t=Ln.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(Ln.copy(this.origin).addScaledVector(this.direction,t),Ln.distanceToSquared(e))}distanceSqToSegment(e,t,s,i){hc.copy(e).add(t).multiplyScalar(.5),io.copy(t).sub(e).normalize(),fi.copy(this.origin).sub(hc);const r=e.distanceTo(t)*.5,a=-this.direction.dot(io),o=fi.dot(this.direction),l=-fi.dot(io),c=fi.lengthSq(),d=Math.abs(1-a*a);let u,h,g,p;if(d>0)if(u=a*l-o,h=a*o-l,p=r*d,u>=0)if(h>=-p)if(h<=p){const z=1/d;u*=z,h*=z,g=u*(u+a*h+2*o)+h*(a*u+h+2*l)+c}else h=r,u=Math.max(0,-(a*h+o)),g=-u*u+h*(h+2*l)+c;else h=-r,u=Math.max(0,-(a*h+o)),g=-u*u+h*(h+2*l)+c;else h<=-p?(u=Math.max(0,-(-a*r+o)),h=u>0?-r:Math.min(Math.max(-r,-l),r),g=-u*u+h*(h+2*l)+c):h<=p?(u=0,h=Math.min(Math.max(-r,-l),r),g=h*(h+2*l)+c):(u=Math.max(0,-(a*r+o)),h=u>0?r:Math.min(Math.max(-r,-l),r),g=-u*u+h*(h+2*l)+c);else h=a>0?-r:r,u=Math.max(0,-(a*h+o)),g=-u*u+h*(h+2*l)+c;return s&&s.copy(this.origin).addScaledVector(this.direction,u),i&&i.copy(hc).addScaledVector(io,h),g}intersectSphere(e,t){Ln.subVectors(e.center,this.origin);const s=Ln.dot(this.direction),i=Ln.dot(Ln)-s*s,r=e.radius*e.radius;if(i>r)return null;const a=Math.sqrt(r-i),o=s-a,l=s+a;return l<0?null:o<0?this.at(l,t):this.at(o,t)}intersectsSphere(e){return e.radius<0?!1:this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){const t=e.normal.dot(this.direction);if(t===0)return e.distanceToPoint(this.origin)===0?0:null;const s=-(this.origin.dot(e.normal)+e.constant)/t;return s>=0?s:null}intersectPlane(e,t){const s=this.distanceToPlane(e);return s===null?null:this.at(s,t)}intersectsPlane(e){const t=e.distanceToPoint(this.origin);return t===0||e.normal.dot(this.direction)*t<0}intersectBox(e,t){let s,i,r,a,o,l;const c=1/this.direction.x,d=1/this.direction.y,u=1/this.direction.z,h=this.origin;return c>=0?(s=(e.min.x-h.x)*c,i=(e.max.x-h.x)*c):(s=(e.max.x-h.x)*c,i=(e.min.x-h.x)*c),d>=0?(r=(e.min.y-h.y)*d,a=(e.max.y-h.y)*d):(r=(e.max.y-h.y)*d,a=(e.min.y-h.y)*d),s>a||r>i||((r>s||isNaN(s))&&(s=r),(a<i||isNaN(i))&&(i=a),u>=0?(o=(e.min.z-h.z)*u,l=(e.max.z-h.z)*u):(o=(e.max.z-h.z)*u,l=(e.min.z-h.z)*u),s>l||o>i)||((o>s||s!==s)&&(s=o),(l<i||i!==i)&&(i=l),i<0)?null:this.at(s>=0?s:i,t)}intersectsBox(e){return this.intersectBox(e,Ln)!==null}intersectTriangle(e,t,s,i,r){fc.subVectors(t,e),ro.subVectors(s,e),pc.crossVectors(fc,ro);let a=this.direction.dot(pc),o;if(a>0){if(i)return null;o=1}else if(a<0)o=-1,a=-a;else return null;fi.subVectors(this.origin,e);const l=o*this.direction.dot(ro.crossVectors(fi,ro));if(l<0)return null;const c=o*this.direction.dot(fc.cross(fi));if(c<0||l+c>a)return null;const d=-o*fi.dot(pc);return d<0?null:this.at(d/a,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 Su extends ni{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new Ye(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 Di,this.combine=Sm,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 Gh=new Gt,Ri=new Sl,ao=new or,Rh=new F,oo=new F,lo=new F,co=new F,mc=new F,uo=new F,Bh=new F,ho=new F;class Us extends ss{constructor(e=new ds,t=new Su){super(),this.isMesh=!0,this.type="Mesh",this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.count=1,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),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 t=this.geometry.morphAttributes,s=Object.keys(t);if(s.length>0){const i=t[s[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let r=0,a=i.length;r<a;r++){const o=i[r].name||String(r);this.morphTargetInfluences.push(0),this.morphTargetDictionary[o]=r}}}}getVertexPosition(e,t){const s=this.geometry,i=s.attributes.position,r=s.morphAttributes.position,a=s.morphTargetsRelative;t.fromBufferAttribute(i,e);const o=this.morphTargetInfluences;if(r&&o){uo.set(0,0,0);for(let l=0,c=r.length;l<c;l++){const d=o[l],u=r[l];d!==0&&(mc.fromBufferAttribute(u,e),a?uo.addScaledVector(mc,d):uo.addScaledVector(mc.sub(t),d))}t.add(uo)}return t}raycast(e,t){const s=this.geometry,i=this.material,r=this.matrixWorld;i!==void 0&&(s.boundingSphere===null&&s.computeBoundingSphere(),ao.copy(s.boundingSphere),ao.applyMatrix4(r),Ri.copy(e.ray).recast(e.near),!(ao.containsPoint(Ri.origin)===!1&&(Ri.intersectSphere(ao,Rh)===null||Ri.origin.distanceToSquared(Rh)>(e.far-e.near)**2))&&(Gh.copy(r).invert(),Ri.copy(e.ray).applyMatrix4(Gh),!(s.boundingBox!==null&&Ri.intersectsBox(s.boundingBox)===!1)&&this._computeIntersections(e,t,Ri)))}_computeIntersections(e,t,s){let i;const r=this.geometry,a=this.material,o=r.index,l=r.attributes.position,c=r.attributes.uv,d=r.attributes.uv1,u=r.attributes.normal,h=r.groups,g=r.drawRange;if(o!==null)if(Array.isArray(a))for(let p=0,z=h.length;p<z;p++){const m=h[p],f=a[m.materialIndex],_=Math.max(m.start,g.start),O=Math.min(o.count,Math.min(m.start+m.count,g.start+g.count));for(let w=_,x=O;w<x;w+=3){const S=o.getX(w),I=o.getX(w+1),b=o.getX(w+2);i=fo(this,f,e,s,c,d,u,S,I,b),i&&(i.faceIndex=Math.floor(w/3),i.face.materialIndex=m.materialIndex,t.push(i))}}else{const p=Math.max(0,g.start),z=Math.min(o.count,g.start+g.count);for(let m=p,f=z;m<f;m+=3){const _=o.getX(m),O=o.getX(m+1),w=o.getX(m+2);i=fo(this,a,e,s,c,d,u,_,O,w),i&&(i.faceIndex=Math.floor(m/3),t.push(i))}}else if(l!==void 0)if(Array.isArray(a))for(let p=0,z=h.length;p<z;p++){const m=h[p],f=a[m.materialIndex],_=Math.max(m.start,g.start),O=Math.min(l.count,Math.min(m.start+m.count,g.start+g.count));for(let w=_,x=O;w<x;w+=3){const S=w,I=w+1,b=w+2;i=fo(this,f,e,s,c,d,u,S,I,b),i&&(i.faceIndex=Math.floor(w/3),i.face.materialIndex=m.materialIndex,t.push(i))}}else{const p=Math.max(0,g.start),z=Math.min(l.count,g.start+g.count);for(let m=p,f=z;m<f;m+=3){const _=m,O=m+1,w=m+2;i=fo(this,a,e,s,c,d,u,_,O,w),i&&(i.faceIndex=Math.floor(m/3),t.push(i))}}}}function Hz(n,e,t,s,i,r,a,o){let l;if(e.side===ks?l=s.intersectTriangle(a,r,i,!0,o):l=s.intersectTriangle(i,r,a,e.side===Ei,o),l===null)return null;ho.copy(o),ho.applyMatrix4(n.matrixWorld);const c=t.ray.origin.distanceTo(ho);return c<t.near||c>t.far?null:{distance:c,point:ho.clone(),object:n}}function fo(n,e,t,s,i,r,a,o,l,c){n.getVertexPosition(o,oo),n.getVertexPosition(l,lo),n.getVertexPosition(c,co);const d=Hz(n,e,t,s,oo,lo,co,Bh);if(d){const u=new F;an.getBarycoord(Bh,oo,lo,co,u),i&&(d.uv=an.getInterpolatedAttribute(i,o,l,c,u,new lt)),r&&(d.uv1=an.getInterpolatedAttribute(r,o,l,c,u,new lt)),a&&(d.normal=an.getInterpolatedAttribute(a,o,l,c,u,new F),d.normal.dot(s.direction)>0&&d.normal.multiplyScalar(-1));const h={a:o,b:l,c,normal:new F,materialIndex:0};an.getNormal(oo,lo,co,h.normal),d.face=h,d.barycoord=u}return d}class qm extends Is{constructor(e=null,t=1,s=1,i,r,a,o,l,c=ys,d=ys,u,h){super(null,a,o,l,c,d,i,r,u,h),this.isDataTexture=!0,this.image={data:e,width:t,height:s},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class vi extends ws{constructor(e,t,s,i=1){super(e,t,s),this.isInstancedBufferAttribute=!0,this.meshPerAttribute=i}copy(e){return super.copy(e),this.meshPerAttribute=e.meshPerAttribute,this}toJSON(){const e=super.toJSON();return e.meshPerAttribute=this.meshPerAttribute,e.isInstancedBufferAttribute=!0,e}}const xr=new Gt,Nh=new Gt,po=[],Ch=new ar,qz=new Gt,ga=new Us,Ma=new or;class Au extends Us{constructor(e,t,s){super(e,t),this.isInstancedMesh=!0,this.instanceMatrix=new vi(new Float32Array(s*16),16),this.instanceColor=null,this.morphTexture=null,this.count=s,this.boundingBox=null,this.boundingSphere=null;for(let i=0;i<s;i++)this.setMatrixAt(i,qz)}computeBoundingBox(){const e=this.geometry,t=this.count;this.boundingBox===null&&(this.boundingBox=new ar),e.boundingBox===null&&e.computeBoundingBox(),this.boundingBox.makeEmpty();for(let s=0;s<t;s++)this.getMatrixAt(s,xr),Ch.copy(e.boundingBox).applyMatrix4(xr),this.boundingBox.union(Ch)}computeBoundingSphere(){const e=this.geometry,t=this.count;this.boundingSphere===null&&(this.boundingSphere=new or),e.boundingSphere===null&&e.computeBoundingSphere(),this.boundingSphere.makeEmpty();for(let s=0;s<t;s++)this.getMatrixAt(s,xr),Ma.copy(e.boundingSphere).applyMatrix4(xr),this.boundingSphere.union(Ma)}copy(e,t){return super.copy(e,t),this.instanceMatrix.copy(e.instanceMatrix),e.morphTexture!==null&&(this.morphTexture=e.morphTexture.clone()),e.instanceColor!==null&&(this.instanceColor=e.instanceColor.clone()),this.count=e.count,e.boundingBox!==null&&(this.boundingBox=e.boundingBox.clone()),e.boundingSphere!==null&&(this.boundingSphere=e.boundingSphere.clone()),this}getColorAt(e,t){return this.instanceColor===null?t.setRGB(1,1,1):t.fromArray(this.instanceColor.array,e*3)}getMatrixAt(e,t){return t.fromArray(this.instanceMatrix.array,e*16)}getMorphAt(e,t){const s=t.morphTargetInfluences,i=this.morphTexture.source.data.data,r=s.length+1,a=e*r+1;for(let o=0;o<s.length;o++)s[o]=i[a+o]}raycast(e,t){const s=this.matrixWorld,i=this.count;if(ga.geometry=this.geometry,ga.material=this.material,ga.material!==void 0&&(this.boundingSphere===null&&this.computeBoundingSphere(),Ma.copy(this.boundingSphere),Ma.applyMatrix4(s),e.ray.intersectsSphere(Ma)!==!1))for(let r=0;r<i;r++){this.getMatrixAt(r,xr),Nh.multiplyMatrices(s,xr),ga.matrixWorld=Nh,ga.raycast(e,po);for(let a=0,o=po.length;a<o;a++){const l=po[a];l.instanceId=r,l.object=this,t.push(l)}po.length=0}}setColorAt(e,t){return this.instanceColor===null&&(this.instanceColor=new vi(new Float32Array(this.instanceMatrix.count*3).fill(1),3)),t.toArray(this.instanceColor.array,e*3),this}setMatrixAt(e,t){return t.toArray(this.instanceMatrix.array,e*16),this}setMorphAt(e,t){const s=t.morphTargetInfluences,i=s.length+1;this.morphTexture===null&&(this.morphTexture=new qm(new Float32Array(i*this.count),i,this.count,Mu,Mn));const r=this.morphTexture.source.data.data;let a=0;for(let c=0;c<s.length;c++)a+=s[c];const o=this.geometry.morphTargetsRelative?1:1-a,l=i*e;return r[l]=o,r.set(s,l+1),this}updateMorphTargets(){}dispose(){this.dispatchEvent({type:"dispose"}),this.morphTexture!==null&&(this.morphTexture.dispose(),this.morphTexture=null)}}const gc=new F,Xz=new F,Yz=new ut;class gi{constructor(e=new F(1,0,0),t=0){this.isPlane=!0,this.normal=e,this.constant=t}set(e,t){return this.normal.copy(e),this.constant=t,this}setComponents(e,t,s,i){return this.normal.set(e,t,s),this.constant=i,this}setFromNormalAndCoplanarPoint(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this}setFromCoplanarPoints(e,t,s){const i=gc.subVectors(s,t).cross(Xz.subVectors(e,t)).normalize();return this.setFromNormalAndCoplanarPoint(i,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,t){return t.copy(e).addScaledVector(this.normal,-this.distanceToPoint(e))}intersectLine(e,t,s=!0){const i=e.delta(gc),r=this.normal.dot(i);if(r===0)return this.distanceToPoint(e.start)===0?t.copy(e.start):null;const a=-(e.start.dot(this.normal)+this.constant)/r;return s===!0&&(a<0||a>1)?null:t.copy(e.start).addScaledVector(i,a)}intersectsLine(e){const t=this.distanceToPoint(e.start),s=this.distanceToPoint(e.end);return t<0&&s>0||s<0&&t>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,t){const s=t||Yz.getNormalMatrix(e),i=this.coplanarPoint(gc).applyMatrix4(e),r=this.normal.applyMatrix3(s).normalize();return this.constant=-i.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)}}const Bi=new or,Kz=new lt(.5,.5),mo=new F;class Eu{constructor(e=new gi,t=new gi,s=new gi,i=new gi,r=new gi,a=new gi){this.planes=[e,t,s,i,r,a]}set(e,t,s,i,r,a){const o=this.planes;return o[0].copy(e),o[1].copy(t),o[2].copy(s),o[3].copy(i),o[4].copy(r),o[5].copy(a),this}copy(e){const t=this.planes;for(let s=0;s<6;s++)t[s].copy(e.planes[s]);return this}setFromProjectionMatrix(e,t=An,s=!1){const i=this.planes,r=e.elements,a=r[0],o=r[1],l=r[2],c=r[3],d=r[4],u=r[5],h=r[6],g=r[7],p=r[8],z=r[9],m=r[10],f=r[11],_=r[12],O=r[13],w=r[14],x=r[15];if(i[0].setComponents(c-a,g-d,f-p,x-_).normalize(),i[1].setComponents(c+a,g+d,f+p,x+_).normalize(),i[2].setComponents(c+o,g+u,f+z,x+O).normalize(),i[3].setComponents(c-o,g-u,f-z,x-O).normalize(),s)i[4].setComponents(l,h,m,w).normalize(),i[5].setComponents(c-l,g-h,f-m,x-w).normalize();else if(i[4].setComponents(c-l,g-h,f-m,x-w).normalize(),t===An)i[5].setComponents(c+l,g+h,f+m,x+w).normalize();else if(t===ka)i[5].setComponents(l,h,m,w).normalize();else throw new Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+t);return this}intersectsObject(e){if(e.boundingSphere!==void 0)e.boundingSphere===null&&e.computeBoundingSphere(),Bi.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{const t=e.geometry;t.boundingSphere===null&&t.computeBoundingSphere(),Bi.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(Bi)}intersectsSprite(e){Bi.center.set(0,0,0);const t=Kz.distanceTo(e.center);return Bi.radius=.7071067811865476+t,Bi.applyMatrix4(e.matrixWorld),this.intersectsSphere(Bi)}intersectsSphere(e){const t=this.planes,s=e.center,i=-e.radius;for(let r=0;r<6;r++)if(t[r].distanceToPoint(s)<i)return!1;return!0}intersectsBox(e){const t=this.planes;for(let s=0;s<6;s++){const i=t[s];if(mo.x=i.normal.x>0?e.max.x:e.min.x,mo.y=i.normal.y>0?e.max.y:e.min.y,mo.z=i.normal.z>0?e.max.z:e.min.z,i.distanceToPoint(mo)<0)return!1}return!0}containsPoint(e){const t=this.planes;for(let s=0;s<6;s++)if(t[s].distanceToPoint(e)<0)return!1;return!0}clone(){return new this.constructor().copy(this)}}class Hr extends ni{constructor(e){super(),this.isLineBasicMaterial=!0,this.type="LineBasicMaterial",this.color=new Ye(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 ml=new F,gl=new F,Ph=new Gt,ba=new Sl,go=new or,Mc=new F,Lh=new F;class Zd extends ss{constructor(e=new ds,t=new Hr){super(),this.isLine=!0,this.type="Line",this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),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 t=e.attributes.position,s=[0];for(let i=1,r=t.count;i<r;i++)ml.fromBufferAttribute(t,i-1),gl.fromBufferAttribute(t,i),s[i]=s[i-1],s[i]+=ml.distanceTo(gl);e.setAttribute("lineDistance",new Xt(s,1))}else st("Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}raycast(e,t){const s=this.geometry,i=this.matrixWorld,r=e.params.Line.threshold,a=s.drawRange;if(s.boundingSphere===null&&s.computeBoundingSphere(),go.copy(s.boundingSphere),go.applyMatrix4(i),go.radius+=r,e.ray.intersectsSphere(go)===!1)return;Ph.copy(i).invert(),ba.copy(e.ray).applyMatrix4(Ph);const o=r/((this.scale.x+this.scale.y+this.scale.z)/3),l=o*o,c=this.isLineSegments?2:1,d=s.index,h=s.attributes.position;if(d!==null){const g=Math.max(0,a.start),p=Math.min(d.count,a.start+a.count);for(let z=g,m=p-1;z<m;z+=c){const f=d.getX(z),_=d.getX(z+1),O=Mo(this,e,ba,l,f,_,z);O&&t.push(O)}if(this.isLineLoop){const z=d.getX(p-1),m=d.getX(g),f=Mo(this,e,ba,l,z,m,p-1);f&&t.push(f)}}else{const g=Math.max(0,a.start),p=Math.min(h.count,a.start+a.count);for(let z=g,m=p-1;z<m;z+=c){const f=Mo(this,e,ba,l,z,z+1,z);f&&t.push(f)}if(this.isLineLoop){const z=Mo(this,e,ba,l,p-1,g,p-1);z&&t.push(z)}}}updateMorphTargets(){const t=this.geometry.morphAttributes,s=Object.keys(t);if(s.length>0){const i=t[s[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let r=0,a=i.length;r<a;r++){const o=i[r].name||String(r);this.morphTargetInfluences.push(0),this.morphTargetDictionary[o]=r}}}}}function Mo(n,e,t,s,i,r,a){const o=n.geometry.attributes.position;if(ml.fromBufferAttribute(o,i),gl.fromBufferAttribute(o,r),t.distanceSqToSegment(ml,gl,Mc,Lh)>s)return;Mc.applyMatrix4(n.matrixWorld);const c=e.ray.origin.distanceTo(Mc);if(!(c<e.near||c>e.far))return{distance:c,point:Lh.clone().applyMatrix4(n.matrixWorld),index:a,face:null,faceIndex:null,barycoord:null,object:n}}const Wh=new F,kh=new F;class Xm extends Zd{constructor(e,t){super(e,t),this.isLineSegments=!0,this.type="LineSegments"}computeLineDistances(){const e=this.geometry;if(e.index===null){const t=e.attributes.position,s=[];for(let i=0,r=t.count;i<r;i+=2)Wh.fromBufferAttribute(t,i),kh.fromBufferAttribute(t,i+1),s[i]=i===0?0:s[i-1],s[i+1]=s[i]+Wh.distanceTo(kh);e.setAttribute("lineDistance",new Xt(s,1))}else st("LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}}class Zz extends ni{constructor(e){super(),this.isPointsMaterial=!0,this.type="PointsMaterial",this.color=new Ye(16777215),this.map=null,this.alphaMap=null,this.size=1,this.sizeAttenuation=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.size=e.size,this.sizeAttenuation=e.sizeAttenuation,this.fog=e.fog,this}}const Uh=new Gt,Qd=new Sl,bo=new or,zo=new F;class Qz extends ss{constructor(e=new ds,t=new Zz){super(),this.isPoints=!0,this.type="Points",this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}raycast(e,t){const s=this.geometry,i=this.matrixWorld,r=e.params.Points.threshold,a=s.drawRange;if(s.boundingSphere===null&&s.computeBoundingSphere(),bo.copy(s.boundingSphere),bo.applyMatrix4(i),bo.radius+=r,e.ray.intersectsSphere(bo)===!1)return;Uh.copy(i).invert(),Qd.copy(e.ray).applyMatrix4(Uh);const o=r/((this.scale.x+this.scale.y+this.scale.z)/3),l=o*o,c=s.index,u=s.attributes.position;if(c!==null){const h=Math.max(0,a.start),g=Math.min(c.count,a.start+a.count);for(let p=h,z=g;p<z;p++){const m=c.getX(p);zo.fromBufferAttribute(u,m),Fh(zo,m,l,i,e,t,this)}}else{const h=Math.max(0,a.start),g=Math.min(u.count,a.start+a.count);for(let p=h,z=g;p<z;p++)zo.fromBufferAttribute(u,p),Fh(zo,p,l,i,e,t,this)}}updateMorphTargets(){const t=this.geometry.morphAttributes,s=Object.keys(t);if(s.length>0){const i=t[s[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let r=0,a=i.length;r<a;r++){const o=i[r].name||String(r);this.morphTargetInfluences.push(0),this.morphTargetDictionary[o]=r}}}}}function Fh(n,e,t,s,i,r,a){const o=Qd.distanceSqToPoint(n);if(o<t){const l=new F;Qd.closestPointToPoint(n,l),l.applyMatrix4(s);const c=i.ray.origin.distanceTo(l);if(c<i.near||c>i.far)return;r.push({distance:c,distanceToRay:Math.sqrt(o),point:l,index:e,face:null,faceIndex:null,barycoord:null,object:a})}}class Ym extends Is{constructor(e=[],t=Ji,s,i,r,a,o,l,c,d){super(e,t,s,i,r,a,o,l,c,d),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}}class Km extends Is{constructor(e,t,s,i,r,a,o,l,c){super(e,t,s,i,r,a,o,l,c),this.isCanvasTexture=!0,this.needsUpdate=!0}}class qr extends Is{constructor(e,t,s=Gn,i,r,a,o=ys,l=ys,c,d=si,u=1){if(d!==si&&d!==ji)throw new Error("THREE.DepthTexture: format must be either THREE.DepthFormat or THREE.DepthStencilFormat");const h={width:e,height:t,depth:u};super(h,i,r,a,o,l,d,s,c),this.isDepthTexture=!0,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(e){return super.copy(e),this.source=new vu(Object.assign({},e.image)),this.compareFunction=e.compareFunction,this}toJSON(e){const t=super.toJSON(e);return this.compareFunction!==null&&(t.compareFunction=this.compareFunction),t}}class Jz extends qr{constructor(e,t=Gn,s=Ji,i,r,a=ys,o=ys,l,c=si){const d={width:e,height:e,depth:1},u=[d,d,d,d,d,d];super(e,e,t,s,i,r,a,o,l,c),this.image=u,this.isCubeDepthTexture=!0,this.isCubeTexture=!0}get images(){return this.image}set images(e){this.image=e}}class Zm extends Is{constructor(e=null){super(),this.sourceTexture=e,this.isExternalTexture=!0}copy(e){return super.copy(e),this.sourceTexture=e.sourceTexture,this}}class ja extends ds{constructor(e=1,t=1,s=1,i=1,r=1,a=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:s,widthSegments:i,heightSegments:r,depthSegments:a};const o=this;i=Math.floor(i),r=Math.floor(r),a=Math.floor(a);const l=[],c=[],d=[],u=[];let h=0,g=0;p("z","y","x",-1,-1,s,t,e,a,r,0),p("z","y","x",1,-1,s,t,-e,a,r,1),p("x","z","y",1,1,e,s,t,i,a,2),p("x","z","y",1,-1,e,s,-t,i,a,3),p("x","y","z",1,-1,e,t,s,i,r,4),p("x","y","z",-1,-1,e,t,-s,i,r,5),this.setIndex(l),this.setAttribute("position",new Xt(c,3)),this.setAttribute("normal",new Xt(d,3)),this.setAttribute("uv",new Xt(u,2));function p(z,m,f,_,O,w,x,S,I,b,A){const B=w/I,N=x/b,k=w/2,L=x/2,j=S/2,P=I+1,W=b+1;let X=0,Q=0;const re=new F;for(let Me=0;Me<W;Me++){const oe=Me*N-L;for(let Oe=0;Oe<P;Oe++){const Ke=Oe*B-k;re[z]=Ke*_,re[m]=oe*O,re[f]=j,c.push(re.x,re.y,re.z),re[z]=0,re[m]=0,re[f]=S>0?1:-1,d.push(re.x,re.y,re.z),u.push(Oe/I),u.push(1-Me/b),X+=1}}for(let Me=0;Me<b;Me++)for(let oe=0;oe<I;oe++){const Oe=h+oe+P*Me,Ke=h+oe+P*(Me+1),nt=h+(oe+1)+P*(Me+1),je=h+(oe+1)+P*Me;l.push(Oe,Ke,je),l.push(Ke,nt,je),Q+=6}o.addGroup(g,Q,A),g+=Q,h+=X}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new ja(e.width,e.height,e.depth,e.widthSegments,e.heightSegments,e.depthSegments)}}class Du extends ds{constructor(e=1,t=32,s=0,i=Math.PI*2){super(),this.type="CircleGeometry",this.parameters={radius:e,segments:t,thetaStart:s,thetaLength:i},t=Math.max(3,t);const r=[],a=[],o=[],l=[],c=new F,d=new lt;a.push(0,0,0),o.push(0,0,1),l.push(.5,.5);for(let u=0,h=3;u<=t;u++,h+=3){const g=s+u/t*i;c.x=e*Math.cos(g),c.y=e*Math.sin(g),a.push(c.x,c.y,c.z),o.push(0,0,1),d.x=(a[h]/e+1)/2,d.y=(a[h+1]/e+1)/2,l.push(d.x,d.y)}for(let u=1;u<=t;u++)r.push(u,u+1,0);this.setIndex(r),this.setAttribute("position",new Xt(a,3)),this.setAttribute("normal",new Xt(o,3)),this.setAttribute("uv",new Xt(l,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Du(e.radius,e.segments,e.thetaStart,e.thetaLength)}}class Iu extends ds{constructor(e=1,t=1,s=1,i=32,r=1,a=!1,o=0,l=Math.PI*2){super(),this.type="CylinderGeometry",this.parameters={radiusTop:e,radiusBottom:t,height:s,radialSegments:i,heightSegments:r,openEnded:a,thetaStart:o,thetaLength:l};const c=this;i=Math.floor(i),r=Math.floor(r);const d=[],u=[],h=[],g=[];let p=0;const z=[],m=s/2;let f=0;_(),a===!1&&(e>0&&O(!0),t>0&&O(!1)),this.setIndex(d),this.setAttribute("position",new Xt(u,3)),this.setAttribute("normal",new Xt(h,3)),this.setAttribute("uv",new Xt(g,2));function _(){const w=new F,x=new F;let S=0;const I=(t-e)/s;for(let b=0;b<=r;b++){const A=[],B=b/r,N=B*(t-e)+e;for(let k=0;k<=i;k++){const L=k/i,j=L*l+o,P=Math.sin(j),W=Math.cos(j);x.x=N*P,x.y=-B*s+m,x.z=N*W,u.push(x.x,x.y,x.z),w.set(P,I,W).normalize(),h.push(w.x,w.y,w.z),g.push(L,1-B),A.push(p++)}z.push(A)}for(let b=0;b<i;b++)for(let A=0;A<r;A++){const B=z[A][b],N=z[A+1][b],k=z[A+1][b+1],L=z[A][b+1];(e>0||A!==0)&&(d.push(B,N,L),S+=3),(t>0||A!==r-1)&&(d.push(N,k,L),S+=3)}c.addGroup(f,S,0),f+=S}function O(w){const x=p,S=new lt,I=new F;let b=0;const A=w===!0?e:t,B=w===!0?1:-1;for(let k=1;k<=i;k++)u.push(0,m*B,0),h.push(0,B,0),g.push(.5,.5),p++;const N=p;for(let k=0;k<=i;k++){const j=k/i*l+o,P=Math.cos(j),W=Math.sin(j);I.x=A*W,I.y=m*B,I.z=A*P,u.push(I.x,I.y,I.z),h.push(0,B,0),S.x=P*.5+.5,S.y=W*.5*B+.5,g.push(S.x,S.y),p++}for(let k=0;k<i;k++){const L=x+k,j=N+k;w===!0?d.push(j,j+1,L):d.push(j+1,j,L),b+=3}c.addGroup(f,b,w===!0?1:2),f+=b}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Iu(e.radiusTop,e.radiusBottom,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}}class Tu extends ds{constructor(e=[],t=[],s=1,i=0){super(),this.type="PolyhedronGeometry",this.parameters={vertices:e,indices:t,radius:s,detail:i};const r=[],a=[];o(i),c(s),d(),this.setAttribute("position",new Xt(r,3)),this.setAttribute("normal",new Xt(r.slice(),3)),this.setAttribute("uv",new Xt(a,2)),i===0?this.computeVertexNormals():this.normalizeNormals();function o(_){const O=new F,w=new F,x=new F;for(let S=0;S<t.length;S+=3)g(t[S+0],O),g(t[S+1],w),g(t[S+2],x),l(O,w,x,_)}function l(_,O,w,x){const S=x+1,I=[];for(let b=0;b<=S;b++){I[b]=[];const A=_.clone().lerp(w,b/S),B=O.clone().lerp(w,b/S),N=S-b;for(let k=0;k<=N;k++)k===0&&b===S?I[b][k]=A:I[b][k]=A.clone().lerp(B,k/N)}for(let b=0;b<S;b++)for(let A=0;A<2*(S-b)-1;A++){const B=Math.floor(A/2);A%2===0?(h(I[b][B+1]),h(I[b+1][B]),h(I[b][B])):(h(I[b][B+1]),h(I[b+1][B+1]),h(I[b+1][B]))}}function c(_){const O=new F;for(let w=0;w<r.length;w+=3)O.x=r[w+0],O.y=r[w+1],O.z=r[w+2],O.normalize().multiplyScalar(_),r[w+0]=O.x,r[w+1]=O.y,r[w+2]=O.z}function d(){const _=new F;for(let O=0;O<r.length;O+=3){_.x=r[O+0],_.y=r[O+1],_.z=r[O+2];const w=m(_)/2/Math.PI+.5,x=f(_)/Math.PI+.5;a.push(w,1-x)}p(),u()}function u(){for(let _=0;_<a.length;_+=6){const O=a[_+0],w=a[_+2],x=a[_+4],S=Math.max(O,w,x),I=Math.min(O,w,x);S>.9&&I<.1&&(O<.2&&(a[_+0]+=1),w<.2&&(a[_+2]+=1),x<.2&&(a[_+4]+=1))}}function h(_){r.push(_.x,_.y,_.z)}function g(_,O){const w=_*3;O.x=e[w+0],O.y=e[w+1],O.z=e[w+2]}function p(){const _=new F,O=new F,w=new F,x=new F,S=new lt,I=new lt,b=new lt;for(let A=0,B=0;A<r.length;A+=9,B+=6){_.set(r[A+0],r[A+1],r[A+2]),O.set(r[A+3],r[A+4],r[A+5]),w.set(r[A+6],r[A+7],r[A+8]),S.set(a[B+0],a[B+1]),I.set(a[B+2],a[B+3]),b.set(a[B+4],a[B+5]),x.copy(_).add(O).add(w).divideScalar(3);const N=m(x);z(S,B+0,_,N),z(I,B+2,O,N),z(b,B+4,w,N)}}function z(_,O,w,x){x<0&&_.x===1&&(a[O]=_.x-1),w.x===0&&w.z===0&&(a[O]=x/2/Math.PI+.5)}function m(_){return Math.atan2(_.z,-_.x)}function f(_){return Math.atan2(-_.y,Math.sqrt(_.x*_.x+_.z*_.z))}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Tu(e.vertices,e.indices,e.radius,e.detail)}}class Gu extends Tu{constructor(e=1,t=0){const s=(1+Math.sqrt(5))/2,i=[-1,s,0,1,s,0,-1,-s,0,1,-s,0,0,-1,s,0,1,s,0,-1,-s,0,1,-s,s,0,-1,s,0,1,-s,0,-1,-s,0,1],r=[0,11,5,0,5,1,0,1,7,0,7,10,0,10,11,1,5,9,5,11,4,11,10,2,10,7,6,7,1,8,3,9,4,3,4,2,3,2,6,3,6,8,3,8,9,4,9,5,2,4,11,6,2,10,8,6,7,9,8,1];super(i,r,e,t),this.type="IcosahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new Gu(e.radius,e.detail)}}class Al extends ds{constructor(e=1,t=1,s=1,i=1){super(),this.type="PlaneGeometry",this.parameters={width:e,height:t,widthSegments:s,heightSegments:i};const r=e/2,a=t/2,o=Math.floor(s),l=Math.floor(i),c=o+1,d=l+1,u=e/o,h=t/l,g=[],p=[],z=[],m=[];for(let f=0;f<d;f++){const _=f*h-a;for(let O=0;O<c;O++){const w=O*u-r;p.push(w,-_,0),z.push(0,0,1),m.push(O/o),m.push(1-f/l)}}for(let f=0;f<l;f++)for(let _=0;_<o;_++){const O=_+c*f,w=_+c*(f+1),x=_+1+c*(f+1),S=_+1+c*f;g.push(O,w,S),g.push(w,x,S)}this.setIndex(g),this.setAttribute("position",new Xt(p,3)),this.setAttribute("normal",new Xt(z,3)),this.setAttribute("uv",new Xt(m,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Al(e.width,e.height,e.widthSegments,e.heightSegments)}}class El extends ds{constructor(e=1,t=32,s=16,i=0,r=Math.PI*2,a=0,o=Math.PI){super(),this.type="SphereGeometry",this.parameters={radius:e,widthSegments:t,heightSegments:s,phiStart:i,phiLength:r,thetaStart:a,thetaLength:o},t=Math.max(3,Math.floor(t)),s=Math.max(2,Math.floor(s));const l=Math.min(a+o,Math.PI);let c=0;const d=[],u=new F,h=new F,g=[],p=[],z=[],m=[];for(let f=0;f<=s;f++){const _=[],O=f/s,w=a+O*o,x=e*Math.cos(w),S=Math.sqrt(e*e-x*x);let I=0;f===0&&a===0?I=.5/t:f===s&&l===Math.PI&&(I=-.5/t);for(let b=0;b<=t;b++){const A=b/t,B=i+A*r;u.x=-S*Math.cos(B),u.y=x,u.z=S*Math.sin(B),p.push(u.x,u.y,u.z),h.copy(u).normalize(),z.push(h.x,h.y,h.z),m.push(A+I,1-O),_.push(c++)}d.push(_)}for(let f=0;f<s;f++)for(let _=0;_<t;_++){const O=d[f][_+1],w=d[f][_],x=d[f+1][_],S=d[f+1][_+1];(f!==0||a>0)&&g.push(O,w,S),(f!==s-1||l<Math.PI)&&g.push(w,x,S)}this.setIndex(g),this.setAttribute("position",new Xt(p,3)),this.setAttribute("normal",new Xt(z,3)),this.setAttribute("uv",new Xt(m,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new El(e.radius,e.widthSegments,e.heightSegments,e.phiStart,e.phiLength,e.thetaStart,e.thetaLength)}}function Xr(n){const e={};for(const t in n){e[t]={};for(const s in n[t]){const i=n[t][s];if(jh(i))i.isRenderTargetTexture?(st("UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms()."),e[t][s]=null):e[t][s]=i.clone();else if(Array.isArray(i))if(jh(i[0])){const r=[];for(let a=0,o=i.length;a<o;a++)r[a]=i[a].clone();e[t][s]=r}else e[t][s]=i.slice();else e[t][s]=i}}return e}function Bs(n){const e={};for(let t=0;t<n.length;t++){const s=Xr(n[t]);for(const i in s)e[i]=s[i]}return e}function jh(n){return n&&(n.isColor||n.isMatrix3||n.isMatrix4||n.isVector2||n.isVector3||n.isVector4||n.isTexture||n.isQuaternion)}function e_(n){const e=[];for(let t=0;t<n.length;t++)e.push(n[t].clone());return e}function Qm(n){const e=n.getRenderTarget();return e===null?n.outputColorSpace:e.isXRRenderTarget===!0?e.texture.colorSpace:xt.workingColorSpace}const t_={clone:Xr,merge:Bs};var s_=`void main() {
3
3
  gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
4
4
  }`,n_=`void main() {
5
5
  gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );
6
- }`;class hs extends ni{constructor(e){super(),this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader=s_,this.fragmentShader=n_,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=e_(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 t=super.toJSON(e);t.glslVersion=this.glslVersion,t.uniforms={};for(const i in this.uniforms){const a=this.uniforms[i].value;a&&a.isTexture?t.uniforms[i]={type:"t",value:a.toJSON(e).uuid}:a&&a.isColor?t.uniforms[i]={type:"c",value:a.getHex()}:a&&a.isVector2?t.uniforms[i]={type:"v2",value:a.toArray()}:a&&a.isVector3?t.uniforms[i]={type:"v3",value:a.toArray()}:a&&a.isVector4?t.uniforms[i]={type:"v4",value:a.toArray()}:a&&a.isMatrix3?t.uniforms[i]={type:"m3",value:a.toArray()}:a&&a.isMatrix4?t.uniforms[i]={type:"m4",value:a.toArray()}:t.uniforms[i]={value:a}}Object.keys(this.defines).length>0&&(t.defines=this.defines),t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader,t.lights=this.lights,t.clipping=this.clipping;const s={};for(const i in this.extensions)this.extensions[i]===!0&&(s[i]=!0);return Object.keys(s).length>0&&(t.extensions=s),t}fromJSON(e,t){if(super.fromJSON(e,t),e.uniforms!==void 0)for(const s in e.uniforms){const i=e.uniforms[s];switch(this.uniforms[s]={},i.type){case"t":this.uniforms[s].value=t[i.value]||null;break;case"c":this.uniforms[s].value=new Ke().setHex(i.value);break;case"v2":this.uniforms[s].value=new lt().fromArray(i.value);break;case"v3":this.uniforms[s].value=new U().fromArray(i.value);break;case"v4":this.uniforms[s].value=new ts().fromArray(i.value);break;case"m3":this.uniforms[s].value=new ut().fromArray(i.value);break;case"m4":this.uniforms[s].value=new Gt().fromArray(i.value);break;default:this.uniforms[s].value=i.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 s in e.extensions)this.extensions[s]=e.extensions[s];return e.lights!==void 0&&(this.lights=e.lights),e.clipping!==void 0&&(this.clipping=e.clipping),this}}class i_ extends hs{constructor(e){super(e),this.isRawShaderMaterial=!0,this.type="RawShaderMaterial"}}class Vi extends ni{constructor(e){super(),this.isMeshStandardMaterial=!0,this.type="MeshStandardMaterial",this.defines={STANDARD:""},this.color=new Ke(16777215),this.roughness=1,this.metalness=0,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Ke(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Xd,this.normalScale=new lt(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.roughnessMap=null,this.metalnessMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Di,this.envMapIntensity=1,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.defines={STANDARD:""},this.color.copy(e.color),this.roughness=e.roughness,this.metalness=e.metalness,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.roughnessMap=e.roughnessMap,this.metalnessMap=e.metalnessMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.envMapIntensity=e.envMapIntensity,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}class r_ extends ni{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=pz,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 a_ extends ni{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 o_ extends Hr{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}}class Jm extends ss{constructor(e,t=1){super(),this.isLight=!0,this.type="Light",this.color=new Ke(e),this.intensity=t}dispose(){this.dispatchEvent({type:"dispose"})}copy(e,t){return super.copy(e,t),this.color.copy(e.color),this.intensity=e.intensity,this}toJSON(e){const t=super.toJSON(e);return t.object.color=this.color.getHex(),t.object.intensity=this.intensity,t}}const bc=new Gt,$h=new U,Vh=new U;class l_{constructor(e){this.camera=e,this.intensity=1,this.bias=0,this.biasNode=null,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new lt(512,512),this.mapType=Zs,this.map=null,this.mapPass=null,this.matrix=new Gt,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new Eu,this._frameExtents=new lt(1,1),this._viewportCount=1,this._viewports=[new ts(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(e){const t=this.camera,s=this.matrix;$h.setFromMatrixPosition(e.matrixWorld),t.position.copy($h),Vh.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(Vh),t.updateMatrixWorld(),bc.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this._frustum.setFromProjectionMatrix(bc,t.coordinateSystem,t.reversedDepth),t.coordinateSystem===ka||t.reversedDepth?s.set(.5,0,0,.5,0,.5,0,.5,0,0,1,0,0,0,0,1):s.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),s.multiply(bc)}getViewport(e){return this._viewports[e]}getFrameExtents(){return this._frameExtents}dispose(){this.map&&this.map.dispose(),this.mapPass&&this.mapPass.dispose()}copy(e){return this.camera=e.camera.clone(),this.intensity=e.intensity,this.bias=e.bias,this.radius=e.radius,this.autoUpdate=e.autoUpdate,this.needsUpdate=e.needsUpdate,this.normalBias=e.normalBias,this.blurSamples=e.blurSamples,this.mapSize.copy(e.mapSize),this.biasNode=e.biasNode,this}clone(){return new this.constructor().copy(this)}toJSON(){const e={};return this.intensity!==1&&(e.intensity=this.intensity),this.bias!==0&&(e.bias=this.bias),this.normalBias!==0&&(e.normalBias=this.normalBias),this.radius!==1&&(e.radius=this.radius),(this.mapSize.x!==512||this.mapSize.y!==512)&&(e.mapSize=this.mapSize.toArray()),e.camera=this.camera.toJSON(!1).object,delete e.camera.matrix,e}}const _o=new U,wo=new rr,wn=new U;class eg extends ss{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new Gt,this.projectionMatrix=new Gt,this.projectionMatrixInverse=new Gt,this.coordinateSystem=An,this._reversedDepth=!1}get reversedDepth(){return this._reversedDepth}copy(e,t){return super.copy(e,t),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(_o,wo,wn),wn.x===1&&wn.y===1&&wn.z===1?this.matrixWorldInverse.copy(this.matrixWorld).invert():this.matrixWorldInverse.compose(_o,wo,wn.set(1,1,1)).invert()}updateWorldMatrix(e,t,s=!1){super.updateWorldMatrix(e,t,s),this.matrixWorld.decompose(_o,wo,wn),wn.x===1&&wn.y===1&&wn.z===1?this.matrixWorldInverse.copy(this.matrixWorld).invert():this.matrixWorldInverse.compose(_o,wo,wn.set(1,1,1)).invert()}clone(){return new this.constructor().copy(this)}}const pi=new U,Hh=new lt,qh=new lt;class nn extends eg{constructor(e=50,t=1,s=.1,i=2e3){super(),this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=e,this.zoom=1,this.near=s,this.far=i,this.focus=10,this.aspect=t,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),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 t=.5*this.getFilmHeight()/e;this.fov=Kd*2*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){const e=Math.tan(Hl*.5*this.fov);return .5*this.getFilmHeight()/e}getEffectiveFOV(){return Kd*2*Math.atan(Math.tan(Hl*.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,t,s){pi.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),t.set(pi.x,pi.y).multiplyScalar(-e/pi.z),pi.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),s.set(pi.x,pi.y).multiplyScalar(-e/pi.z)}getViewSize(e,t){return this.getViewBounds(e,Hh,qh),t.subVectors(qh,Hh)}setViewOffset(e,t,s,i,r,a){this.aspect=e/t,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=t,this.view.offsetX=s,this.view.offsetY=i,this.view.width=r,this.view.height=a,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=this.near;let t=e*Math.tan(Hl*.5*this.fov)/this.zoom,s=2*t,i=this.aspect*s,r=-.5*i;const a=this.view;if(this.view!==null&&this.view.enabled){const l=a.fullWidth,c=a.fullHeight;r+=a.offsetX*i/l,t-=a.offsetY*s/c,i*=a.width/l,s*=a.height/c}const o=this.filmOffset;o!==0&&(r+=e*o/this.getFilmWidth()),this.projectionMatrix.makePerspective(r,r+i,t,t-s,e,this.far,this.coordinateSystem,this.reversedDepth),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const t=super.toJSON(e);return t.object.fov=this.fov,t.object.zoom=this.zoom,t.object.near=this.near,t.object.far=this.far,t.object.focus=this.focus,t.object.aspect=this.aspect,this.view!==null&&(t.object.view=Object.assign({},this.view)),t.object.filmGauge=this.filmGauge,t.object.filmOffset=this.filmOffset,t}}class Ru extends eg{constructor(e=-1,t=1,s=1,i=-1,r=.1,a=2e3){super(),this.isOrthographicCamera=!0,this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=e,this.right=t,this.top=s,this.bottom=i,this.near=r,this.far=a,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),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,t,s,i,r,a){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=t,this.view.offsetX=s,this.view.offsetY=i,this.view.width=r,this.view.height=a,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=(this.right-this.left)/(2*this.zoom),t=(this.top-this.bottom)/(2*this.zoom),s=(this.right+this.left)/2,i=(this.top+this.bottom)/2;let r=s-e,a=s+e,o=i+t,l=i-t;if(this.view!==null&&this.view.enabled){const c=(this.right-this.left)/this.view.fullWidth/this.zoom,d=(this.top-this.bottom)/this.view.fullHeight/this.zoom;r+=c*this.view.offsetX,a=r+c*this.view.width,o-=d*this.view.offsetY,l=o-d*this.view.height}this.projectionMatrix.makeOrthographic(r,a,o,l,this.near,this.far,this.coordinateSystem,this.reversedDepth),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const t=super.toJSON(e);return t.object.zoom=this.zoom,t.object.left=this.left,t.object.right=this.right,t.object.top=this.top,t.object.bottom=this.bottom,t.object.near=this.near,t.object.far=this.far,this.view!==null&&(t.object.view=Object.assign({},this.view)),t}}class c_ extends l_{constructor(){super(new Ru(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}}class d_ extends Jm{constructor(e,t){super(e,t),this.isDirectionalLight=!0,this.type="DirectionalLight",this.position.copy(ss.DEFAULT_UP),this.updateMatrix(),this.target=new ss,this.shadow=new c_}dispose(){super.dispose(),this.shadow.dispose()}copy(e){return super.copy(e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}toJSON(e){const t=super.toJSON(e);return t.object.shadow=this.shadow.toJSON(),t.object.target=this.target.uuid,t}}class u_ extends Jm{constructor(e,t){super(e,t),this.isAmbientLight=!0,this.type="AmbientLight"}}const Sr=-90,Ar=1;class h_ extends ss{constructor(e,t,s){super(),this.type="CubeCamera",this.renderTarget=s,this.coordinateSystem=null,this.activeMipmapLevel=0;const i=new nn(Sr,Ar,e,t);i.layers=this.layers,this.add(i);const r=new nn(Sr,Ar,e,t);r.layers=this.layers,this.add(r);const a=new nn(Sr,Ar,e,t);a.layers=this.layers,this.add(a);const o=new nn(Sr,Ar,e,t);o.layers=this.layers,this.add(o);const l=new nn(Sr,Ar,e,t);l.layers=this.layers,this.add(l);const c=new nn(Sr,Ar,e,t);c.layers=this.layers,this.add(c)}updateCoordinateSystem(){const e=this.coordinateSystem,t=this.children.concat(),[s,i,r,a,o,l]=t;for(const c of t)this.remove(c);if(e===An)s.up.set(0,1,0),s.lookAt(1,0,0),i.up.set(0,1,0),i.lookAt(-1,0,0),r.up.set(0,0,-1),r.lookAt(0,1,0),a.up.set(0,0,1),a.lookAt(0,-1,0),o.up.set(0,1,0),o.lookAt(0,0,1),l.up.set(0,1,0),l.lookAt(0,0,-1);else if(e===ka)s.up.set(0,-1,0),s.lookAt(-1,0,0),i.up.set(0,-1,0),i.lookAt(1,0,0),r.up.set(0,0,1),r.lookAt(0,1,0),a.up.set(0,0,-1),a.lookAt(0,-1,0),o.up.set(0,-1,0),o.lookAt(0,0,1),l.up.set(0,-1,0),l.lookAt(0,0,-1);else throw new Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: "+e);for(const c of t)this.add(c),c.updateMatrixWorld()}update(e,t){this.parent===null&&this.updateMatrixWorld();const{renderTarget:s,activeMipmapLevel:i}=this;this.coordinateSystem!==e.coordinateSystem&&(this.coordinateSystem=e.coordinateSystem,this.updateCoordinateSystem());const[r,a,o,l,c,d]=this.children,u=e.getRenderTarget(),h=e.getActiveCubeFace(),g=e.getActiveMipmapLevel(),p=e.xr.enabled;e.xr.enabled=!1;const z=s.texture.generateMipmaps;s.texture.generateMipmaps=!1;let m=!1;e.isWebGLRenderer===!0?m=e.state.buffers.depth.getReversed():m=e.reversedDepthBuffer,e.setRenderTarget(s,0,i),m&&e.autoClear===!1&&e.clearDepth(),e.render(t,r),e.setRenderTarget(s,1,i),m&&e.autoClear===!1&&e.clearDepth(),e.render(t,a),e.setRenderTarget(s,2,i),m&&e.autoClear===!1&&e.clearDepth(),e.render(t,o),e.setRenderTarget(s,3,i),m&&e.autoClear===!1&&e.clearDepth(),e.render(t,l),e.setRenderTarget(s,4,i),m&&e.autoClear===!1&&e.clearDepth(),e.render(t,c),s.texture.generateMipmaps=z,e.setRenderTarget(s,5,i),m&&e.autoClear===!1&&e.clearDepth(),e.render(t,d),e.setRenderTarget(u,h,g),e.xr.enabled=p,s.texture.needsPMREMUpdate=!0}}class f_ extends nn{constructor(e=[]){super(),this.isArrayCamera=!0,this.isMultiViewCamera=!1,this.cameras=e}}const Xh=new Gt;class p_{constructor(e,t,s=0,i=1/0){this.ray=new Sl(e,t),this.near=s,this.far=i,this.camera=null,this.layers=new Ou,this.params={Mesh:{},Line:{threshold:1},LOD:{},Points:{threshold:1},Sprite:{}}}set(e,t){this.ray.set(e,t)}setFromCamera(e,t){t.isPerspectiveCamera?(this.ray.origin.setFromMatrixPosition(t.matrixWorld),this.ray.direction.set(e.x,e.y,.5).unproject(t).sub(this.ray.origin).normalize(),this.camera=t):t.isOrthographicCamera?(this.ray.origin.set(e.x,e.y,t.projectionMatrix.elements[14]).unproject(t),this.ray.direction.set(0,0,-1).transformDirection(t.matrixWorld),this.camera=t):Ot("Raycaster: Unsupported camera type: "+t.type)}setFromXRController(e){return Xh.identity().extractRotation(e.matrixWorld),this.ray.origin.setFromMatrixPosition(e.matrixWorld),this.ray.direction.set(0,0,-1).applyMatrix4(Xh),this}intersectObject(e,t=!0,s=[]){return Jd(e,this,s,t),s.sort(Yh),s}intersectObjects(e,t=!0,s=[]){for(let i=0,r=e.length;i<r;i++)Jd(e[i],this,s,t);return s.sort(Yh),s}}function Yh(n,e){return n.distance-e.distance}function Jd(n,e,t,s){let i=!0;if(n.layers.test(e.layers)&&n.raycast(e,t)===!1&&(i=!1),i===!0&&s===!0){const r=n.children;for(let a=0,o=r.length;a<o;a++)Jd(r[a],e,t,!0)}}const Zu=class Zu{constructor(e,t,s,i){this.elements=[1,0,0,1],e!==void 0&&this.set(e,t,s,i)}identity(){return this.set(1,0,0,1),this}fromArray(e,t=0){for(let s=0;s<4;s++)this.elements[s]=e[s+t];return this}set(e,t,s,i){const r=this.elements;return r[0]=e,r[2]=t,r[1]=s,r[3]=i,this}};Zu.prototype.isMatrix2=!0;let Kh=Zu;function Zh(n,e,t,s){const i=m_(s);switch(t){case Wm:return n*e;case Mu:return n*e/i.components*i.byteLength;case bu:return n*e/i.components*i.byteLength;case er:return n*e*2/i.components*i.byteLength;case zu:return n*e*2/i.components*i.byteLength;case km:return n*e*3/i.components*i.byteLength;case bn:return n*e*4/i.components*i.byteLength;case _u:return n*e*4/i.components*i.byteLength;case Lo:case Wo:return Math.floor((n+3)/4)*Math.floor((e+3)/4)*8;case ko:case Uo:return Math.floor((n+3)/4)*Math.floor((e+3)/4)*16;case zd:case wd:return Math.max(n,16)*Math.max(e,8)/4;case bd:case _d:return Math.max(n,8)*Math.max(e,8)/2;case yd:case vd:case xd:case Sd:return Math.floor((n+3)/4)*Math.floor((e+3)/4)*8;case Od:case ll:case Ad:return Math.floor((n+3)/4)*Math.floor((e+3)/4)*16;case Ed:return Math.floor((n+3)/4)*Math.floor((e+3)/4)*16;case Dd:return Math.floor((n+4)/5)*Math.floor((e+3)/4)*16;case Id:return Math.floor((n+4)/5)*Math.floor((e+4)/5)*16;case Td:return Math.floor((n+5)/6)*Math.floor((e+4)/5)*16;case Gd:return Math.floor((n+5)/6)*Math.floor((e+5)/6)*16;case Rd:return Math.floor((n+7)/8)*Math.floor((e+4)/5)*16;case Bd:return Math.floor((n+7)/8)*Math.floor((e+5)/6)*16;case Nd:return Math.floor((n+7)/8)*Math.floor((e+7)/8)*16;case Cd:return Math.floor((n+9)/10)*Math.floor((e+4)/5)*16;case Pd:return Math.floor((n+9)/10)*Math.floor((e+5)/6)*16;case Ld:return Math.floor((n+9)/10)*Math.floor((e+7)/8)*16;case Wd:return Math.floor((n+9)/10)*Math.floor((e+9)/10)*16;case kd:return Math.floor((n+11)/12)*Math.floor((e+9)/10)*16;case Ud:return Math.floor((n+11)/12)*Math.floor((e+11)/12)*16;case Fd:case jd:case $d:return Math.ceil(n/4)*Math.ceil(e/4)*16;case Vd:case Hd:return Math.ceil(n/4)*Math.ceil(e/4)*8;case cl:case qd:return Math.ceil(n/4)*Math.ceil(e/4)*16}throw new Error(`Unable to determine texture byte length for ${t} format.`)}function m_(n){switch(n){case Zs:case Nm:return{byteLength:1,components:1};case La:case Cm:case ti:return{byteLength:2,components:1};case mu:case gu:return{byteLength:2,components:4};case Gn:case pu:case Mn:return{byteLength:4,components:1};case Pm:case Lm:return{byteLength:4,components:3}}throw new Error(`THREE.TextureUtils: Unknown texture type ${n}.`)}typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:fu}}));typeof window<"u"&&(window.__THREE__?st("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=fu);function tg(){let n=null,e=!1,t=null,s=null;function i(r,a){t(r,a),s=n.requestAnimationFrame(i)}return{start:function(){e!==!0&&t!==null&&n!==null&&(s=n.requestAnimationFrame(i),e=!0)},stop:function(){n!==null&&n.cancelAnimationFrame(s),e=!1},setAnimationLoop:function(r){t=r},setContext:function(r){n=r}}}function g_(n){const e=new WeakMap;function t(o,l){const c=o.array,d=o.usage,u=c.byteLength,h=n.createBuffer();n.bindBuffer(l,h),n.bufferData(l,c,d),o.onUploadCallback();let g;if(c instanceof Float32Array)g=n.FLOAT;else if(typeof Float16Array<"u"&&c instanceof Float16Array)g=n.HALF_FLOAT;else if(c instanceof Uint16Array)o.isFloat16BufferAttribute?g=n.HALF_FLOAT:g=n.UNSIGNED_SHORT;else if(c instanceof Int16Array)g=n.SHORT;else if(c instanceof Uint32Array)g=n.UNSIGNED_INT;else if(c instanceof Int32Array)g=n.INT;else if(c instanceof Int8Array)g=n.BYTE;else if(c instanceof Uint8Array)g=n.UNSIGNED_BYTE;else if(c instanceof Uint8ClampedArray)g=n.UNSIGNED_BYTE;else throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+c);return{buffer:h,type:g,bytesPerElement:c.BYTES_PER_ELEMENT,version:o.version,size:u}}function s(o,l,c){const d=l.array,u=l.updateRanges;if(n.bindBuffer(c,o),u.length===0)n.bufferSubData(c,0,d);else{u.sort((g,p)=>g.start-p.start);let h=0;for(let g=1;g<u.length;g++){const p=u[h],z=u[g];z.start<=p.start+p.count+1?p.count=Math.max(p.count,z.start+z.count-p.start):(++h,u[h]=z)}u.length=h+1;for(let g=0,p=u.length;g<p;g++){const z=u[g];n.bufferSubData(c,z.start*d.BYTES_PER_ELEMENT,d,z.start,z.count)}l.clearUpdateRanges()}l.onUploadCallback()}function i(o){return o.isInterleavedBufferAttribute&&(o=o.data),e.get(o)}function r(o){o.isInterleavedBufferAttribute&&(o=o.data);const l=e.get(o);l&&(n.deleteBuffer(l.buffer),e.delete(o))}function a(o,l){if(o.isInterleavedBufferAttribute&&(o=o.data),o.isGLBufferAttribute){const d=e.get(o);(!d||d.version<o.version)&&e.set(o,{buffer:o.buffer,type:o.type,bytesPerElement:o.elementSize,version:o.version});return}const c=e.get(o);if(c===void 0)e.set(o,t(o,l));else if(c.version<o.version){if(c.size!==o.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.");s(c.buffer,o,l),c.version=o.version}}return{get:i,remove:r,update:a}}var M_=`#ifdef USE_ALPHAHASH
6
+ }`;class hs extends ni{constructor(e){super(),this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader=s_,this.fragmentShader=n_,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=e_(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 t=super.toJSON(e);t.glslVersion=this.glslVersion,t.uniforms={};for(const i in this.uniforms){const a=this.uniforms[i].value;a&&a.isTexture?t.uniforms[i]={type:"t",value:a.toJSON(e).uuid}:a&&a.isColor?t.uniforms[i]={type:"c",value:a.getHex()}:a&&a.isVector2?t.uniforms[i]={type:"v2",value:a.toArray()}:a&&a.isVector3?t.uniforms[i]={type:"v3",value:a.toArray()}:a&&a.isVector4?t.uniforms[i]={type:"v4",value:a.toArray()}:a&&a.isMatrix3?t.uniforms[i]={type:"m3",value:a.toArray()}:a&&a.isMatrix4?t.uniforms[i]={type:"m4",value:a.toArray()}:t.uniforms[i]={value:a}}Object.keys(this.defines).length>0&&(t.defines=this.defines),t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader,t.lights=this.lights,t.clipping=this.clipping;const s={};for(const i in this.extensions)this.extensions[i]===!0&&(s[i]=!0);return Object.keys(s).length>0&&(t.extensions=s),t}fromJSON(e,t){if(super.fromJSON(e,t),e.uniforms!==void 0)for(const s in e.uniforms){const i=e.uniforms[s];switch(this.uniforms[s]={},i.type){case"t":this.uniforms[s].value=t[i.value]||null;break;case"c":this.uniforms[s].value=new Ye().setHex(i.value);break;case"v2":this.uniforms[s].value=new lt().fromArray(i.value);break;case"v3":this.uniforms[s].value=new F().fromArray(i.value);break;case"v4":this.uniforms[s].value=new ts().fromArray(i.value);break;case"m3":this.uniforms[s].value=new ut().fromArray(i.value);break;case"m4":this.uniforms[s].value=new Gt().fromArray(i.value);break;default:this.uniforms[s].value=i.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 s in e.extensions)this.extensions[s]=e.extensions[s];return e.lights!==void 0&&(this.lights=e.lights),e.clipping!==void 0&&(this.clipping=e.clipping),this}}class i_ extends hs{constructor(e){super(e),this.isRawShaderMaterial=!0,this.type="RawShaderMaterial"}}class Vi extends ni{constructor(e){super(),this.isMeshStandardMaterial=!0,this.type="MeshStandardMaterial",this.defines={STANDARD:""},this.color=new Ye(16777215),this.roughness=1,this.metalness=0,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Ye(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Xd,this.normalScale=new lt(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.roughnessMap=null,this.metalnessMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Di,this.envMapIntensity=1,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.defines={STANDARD:""},this.color.copy(e.color),this.roughness=e.roughness,this.metalness=e.metalness,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.roughnessMap=e.roughnessMap,this.metalnessMap=e.metalnessMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.envMapIntensity=e.envMapIntensity,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}class r_ extends ni{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=pz,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 a_ extends ni{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 o_ extends Hr{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}}class Jm extends ss{constructor(e,t=1){super(),this.isLight=!0,this.type="Light",this.color=new Ye(e),this.intensity=t}dispose(){this.dispatchEvent({type:"dispose"})}copy(e,t){return super.copy(e,t),this.color.copy(e.color),this.intensity=e.intensity,this}toJSON(e){const t=super.toJSON(e);return t.object.color=this.color.getHex(),t.object.intensity=this.intensity,t}}const bc=new Gt,$h=new F,Vh=new F;class l_{constructor(e){this.camera=e,this.intensity=1,this.bias=0,this.biasNode=null,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new lt(512,512),this.mapType=Zs,this.map=null,this.mapPass=null,this.matrix=new Gt,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new Eu,this._frameExtents=new lt(1,1),this._viewportCount=1,this._viewports=[new ts(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(e){const t=this.camera,s=this.matrix;$h.setFromMatrixPosition(e.matrixWorld),t.position.copy($h),Vh.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(Vh),t.updateMatrixWorld(),bc.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this._frustum.setFromProjectionMatrix(bc,t.coordinateSystem,t.reversedDepth),t.coordinateSystem===ka||t.reversedDepth?s.set(.5,0,0,.5,0,.5,0,.5,0,0,1,0,0,0,0,1):s.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),s.multiply(bc)}getViewport(e){return this._viewports[e]}getFrameExtents(){return this._frameExtents}dispose(){this.map&&this.map.dispose(),this.mapPass&&this.mapPass.dispose()}copy(e){return this.camera=e.camera.clone(),this.intensity=e.intensity,this.bias=e.bias,this.radius=e.radius,this.autoUpdate=e.autoUpdate,this.needsUpdate=e.needsUpdate,this.normalBias=e.normalBias,this.blurSamples=e.blurSamples,this.mapSize.copy(e.mapSize),this.biasNode=e.biasNode,this}clone(){return new this.constructor().copy(this)}toJSON(){const e={};return this.intensity!==1&&(e.intensity=this.intensity),this.bias!==0&&(e.bias=this.bias),this.normalBias!==0&&(e.normalBias=this.normalBias),this.radius!==1&&(e.radius=this.radius),(this.mapSize.x!==512||this.mapSize.y!==512)&&(e.mapSize=this.mapSize.toArray()),e.camera=this.camera.toJSON(!1).object,delete e.camera.matrix,e}}const _o=new F,wo=new rr,wn=new F;class eg extends ss{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new Gt,this.projectionMatrix=new Gt,this.projectionMatrixInverse=new Gt,this.coordinateSystem=An,this._reversedDepth=!1}get reversedDepth(){return this._reversedDepth}copy(e,t){return super.copy(e,t),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(_o,wo,wn),wn.x===1&&wn.y===1&&wn.z===1?this.matrixWorldInverse.copy(this.matrixWorld).invert():this.matrixWorldInverse.compose(_o,wo,wn.set(1,1,1)).invert()}updateWorldMatrix(e,t,s=!1){super.updateWorldMatrix(e,t,s),this.matrixWorld.decompose(_o,wo,wn),wn.x===1&&wn.y===1&&wn.z===1?this.matrixWorldInverse.copy(this.matrixWorld).invert():this.matrixWorldInverse.compose(_o,wo,wn.set(1,1,1)).invert()}clone(){return new this.constructor().copy(this)}}const pi=new F,Hh=new lt,qh=new lt;class nn extends eg{constructor(e=50,t=1,s=.1,i=2e3){super(),this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=e,this.zoom=1,this.near=s,this.far=i,this.focus=10,this.aspect=t,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),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 t=.5*this.getFilmHeight()/e;this.fov=Kd*2*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){const e=Math.tan(Hl*.5*this.fov);return .5*this.getFilmHeight()/e}getEffectiveFOV(){return Kd*2*Math.atan(Math.tan(Hl*.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,t,s){pi.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),t.set(pi.x,pi.y).multiplyScalar(-e/pi.z),pi.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),s.set(pi.x,pi.y).multiplyScalar(-e/pi.z)}getViewSize(e,t){return this.getViewBounds(e,Hh,qh),t.subVectors(qh,Hh)}setViewOffset(e,t,s,i,r,a){this.aspect=e/t,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=t,this.view.offsetX=s,this.view.offsetY=i,this.view.width=r,this.view.height=a,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=this.near;let t=e*Math.tan(Hl*.5*this.fov)/this.zoom,s=2*t,i=this.aspect*s,r=-.5*i;const a=this.view;if(this.view!==null&&this.view.enabled){const l=a.fullWidth,c=a.fullHeight;r+=a.offsetX*i/l,t-=a.offsetY*s/c,i*=a.width/l,s*=a.height/c}const o=this.filmOffset;o!==0&&(r+=e*o/this.getFilmWidth()),this.projectionMatrix.makePerspective(r,r+i,t,t-s,e,this.far,this.coordinateSystem,this.reversedDepth),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const t=super.toJSON(e);return t.object.fov=this.fov,t.object.zoom=this.zoom,t.object.near=this.near,t.object.far=this.far,t.object.focus=this.focus,t.object.aspect=this.aspect,this.view!==null&&(t.object.view=Object.assign({},this.view)),t.object.filmGauge=this.filmGauge,t.object.filmOffset=this.filmOffset,t}}class Ru extends eg{constructor(e=-1,t=1,s=1,i=-1,r=.1,a=2e3){super(),this.isOrthographicCamera=!0,this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=e,this.right=t,this.top=s,this.bottom=i,this.near=r,this.far=a,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),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,t,s,i,r,a){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=t,this.view.offsetX=s,this.view.offsetY=i,this.view.width=r,this.view.height=a,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=(this.right-this.left)/(2*this.zoom),t=(this.top-this.bottom)/(2*this.zoom),s=(this.right+this.left)/2,i=(this.top+this.bottom)/2;let r=s-e,a=s+e,o=i+t,l=i-t;if(this.view!==null&&this.view.enabled){const c=(this.right-this.left)/this.view.fullWidth/this.zoom,d=(this.top-this.bottom)/this.view.fullHeight/this.zoom;r+=c*this.view.offsetX,a=r+c*this.view.width,o-=d*this.view.offsetY,l=o-d*this.view.height}this.projectionMatrix.makeOrthographic(r,a,o,l,this.near,this.far,this.coordinateSystem,this.reversedDepth),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const t=super.toJSON(e);return t.object.zoom=this.zoom,t.object.left=this.left,t.object.right=this.right,t.object.top=this.top,t.object.bottom=this.bottom,t.object.near=this.near,t.object.far=this.far,this.view!==null&&(t.object.view=Object.assign({},this.view)),t}}class c_ extends l_{constructor(){super(new Ru(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}}class d_ extends Jm{constructor(e,t){super(e,t),this.isDirectionalLight=!0,this.type="DirectionalLight",this.position.copy(ss.DEFAULT_UP),this.updateMatrix(),this.target=new ss,this.shadow=new c_}dispose(){super.dispose(),this.shadow.dispose()}copy(e){return super.copy(e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}toJSON(e){const t=super.toJSON(e);return t.object.shadow=this.shadow.toJSON(),t.object.target=this.target.uuid,t}}class u_ extends Jm{constructor(e,t){super(e,t),this.isAmbientLight=!0,this.type="AmbientLight"}}const Sr=-90,Ar=1;class h_ extends ss{constructor(e,t,s){super(),this.type="CubeCamera",this.renderTarget=s,this.coordinateSystem=null,this.activeMipmapLevel=0;const i=new nn(Sr,Ar,e,t);i.layers=this.layers,this.add(i);const r=new nn(Sr,Ar,e,t);r.layers=this.layers,this.add(r);const a=new nn(Sr,Ar,e,t);a.layers=this.layers,this.add(a);const o=new nn(Sr,Ar,e,t);o.layers=this.layers,this.add(o);const l=new nn(Sr,Ar,e,t);l.layers=this.layers,this.add(l);const c=new nn(Sr,Ar,e,t);c.layers=this.layers,this.add(c)}updateCoordinateSystem(){const e=this.coordinateSystem,t=this.children.concat(),[s,i,r,a,o,l]=t;for(const c of t)this.remove(c);if(e===An)s.up.set(0,1,0),s.lookAt(1,0,0),i.up.set(0,1,0),i.lookAt(-1,0,0),r.up.set(0,0,-1),r.lookAt(0,1,0),a.up.set(0,0,1),a.lookAt(0,-1,0),o.up.set(0,1,0),o.lookAt(0,0,1),l.up.set(0,1,0),l.lookAt(0,0,-1);else if(e===ka)s.up.set(0,-1,0),s.lookAt(-1,0,0),i.up.set(0,-1,0),i.lookAt(1,0,0),r.up.set(0,0,1),r.lookAt(0,1,0),a.up.set(0,0,-1),a.lookAt(0,-1,0),o.up.set(0,-1,0),o.lookAt(0,0,1),l.up.set(0,-1,0),l.lookAt(0,0,-1);else throw new Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: "+e);for(const c of t)this.add(c),c.updateMatrixWorld()}update(e,t){this.parent===null&&this.updateMatrixWorld();const{renderTarget:s,activeMipmapLevel:i}=this;this.coordinateSystem!==e.coordinateSystem&&(this.coordinateSystem=e.coordinateSystem,this.updateCoordinateSystem());const[r,a,o,l,c,d]=this.children,u=e.getRenderTarget(),h=e.getActiveCubeFace(),g=e.getActiveMipmapLevel(),p=e.xr.enabled;e.xr.enabled=!1;const z=s.texture.generateMipmaps;s.texture.generateMipmaps=!1;let m=!1;e.isWebGLRenderer===!0?m=e.state.buffers.depth.getReversed():m=e.reversedDepthBuffer,e.setRenderTarget(s,0,i),m&&e.autoClear===!1&&e.clearDepth(),e.render(t,r),e.setRenderTarget(s,1,i),m&&e.autoClear===!1&&e.clearDepth(),e.render(t,a),e.setRenderTarget(s,2,i),m&&e.autoClear===!1&&e.clearDepth(),e.render(t,o),e.setRenderTarget(s,3,i),m&&e.autoClear===!1&&e.clearDepth(),e.render(t,l),e.setRenderTarget(s,4,i),m&&e.autoClear===!1&&e.clearDepth(),e.render(t,c),s.texture.generateMipmaps=z,e.setRenderTarget(s,5,i),m&&e.autoClear===!1&&e.clearDepth(),e.render(t,d),e.setRenderTarget(u,h,g),e.xr.enabled=p,s.texture.needsPMREMUpdate=!0}}class f_ extends nn{constructor(e=[]){super(),this.isArrayCamera=!0,this.isMultiViewCamera=!1,this.cameras=e}}const Xh=new Gt;class p_{constructor(e,t,s=0,i=1/0){this.ray=new Sl(e,t),this.near=s,this.far=i,this.camera=null,this.layers=new Ou,this.params={Mesh:{},Line:{threshold:1},LOD:{},Points:{threshold:1},Sprite:{}}}set(e,t){this.ray.set(e,t)}setFromCamera(e,t){t.isPerspectiveCamera?(this.ray.origin.setFromMatrixPosition(t.matrixWorld),this.ray.direction.set(e.x,e.y,.5).unproject(t).sub(this.ray.origin).normalize(),this.camera=t):t.isOrthographicCamera?(this.ray.origin.set(e.x,e.y,t.projectionMatrix.elements[14]).unproject(t),this.ray.direction.set(0,0,-1).transformDirection(t.matrixWorld),this.camera=t):Ot("Raycaster: Unsupported camera type: "+t.type)}setFromXRController(e){return Xh.identity().extractRotation(e.matrixWorld),this.ray.origin.setFromMatrixPosition(e.matrixWorld),this.ray.direction.set(0,0,-1).applyMatrix4(Xh),this}intersectObject(e,t=!0,s=[]){return Jd(e,this,s,t),s.sort(Yh),s}intersectObjects(e,t=!0,s=[]){for(let i=0,r=e.length;i<r;i++)Jd(e[i],this,s,t);return s.sort(Yh),s}}function Yh(n,e){return n.distance-e.distance}function Jd(n,e,t,s){let i=!0;if(n.layers.test(e.layers)&&n.raycast(e,t)===!1&&(i=!1),i===!0&&s===!0){const r=n.children;for(let a=0,o=r.length;a<o;a++)Jd(r[a],e,t,!0)}}const Zu=class Zu{constructor(e,t,s,i){this.elements=[1,0,0,1],e!==void 0&&this.set(e,t,s,i)}identity(){return this.set(1,0,0,1),this}fromArray(e,t=0){for(let s=0;s<4;s++)this.elements[s]=e[s+t];return this}set(e,t,s,i){const r=this.elements;return r[0]=e,r[2]=t,r[1]=s,r[3]=i,this}};Zu.prototype.isMatrix2=!0;let Kh=Zu;function Zh(n,e,t,s){const i=m_(s);switch(t){case Wm:return n*e;case Mu:return n*e/i.components*i.byteLength;case bu:return n*e/i.components*i.byteLength;case er:return n*e*2/i.components*i.byteLength;case zu:return n*e*2/i.components*i.byteLength;case km:return n*e*3/i.components*i.byteLength;case bn:return n*e*4/i.components*i.byteLength;case _u:return n*e*4/i.components*i.byteLength;case Lo:case Wo:return Math.floor((n+3)/4)*Math.floor((e+3)/4)*8;case ko:case Uo:return Math.floor((n+3)/4)*Math.floor((e+3)/4)*16;case zd:case wd:return Math.max(n,16)*Math.max(e,8)/4;case bd:case _d:return Math.max(n,8)*Math.max(e,8)/2;case yd:case vd:case xd:case Sd:return Math.floor((n+3)/4)*Math.floor((e+3)/4)*8;case Od:case ll:case Ad:return Math.floor((n+3)/4)*Math.floor((e+3)/4)*16;case Ed:return Math.floor((n+3)/4)*Math.floor((e+3)/4)*16;case Dd:return Math.floor((n+4)/5)*Math.floor((e+3)/4)*16;case Id:return Math.floor((n+4)/5)*Math.floor((e+4)/5)*16;case Td:return Math.floor((n+5)/6)*Math.floor((e+4)/5)*16;case Gd:return Math.floor((n+5)/6)*Math.floor((e+5)/6)*16;case Rd:return Math.floor((n+7)/8)*Math.floor((e+4)/5)*16;case Bd:return Math.floor((n+7)/8)*Math.floor((e+5)/6)*16;case Nd:return Math.floor((n+7)/8)*Math.floor((e+7)/8)*16;case Cd:return Math.floor((n+9)/10)*Math.floor((e+4)/5)*16;case Pd:return Math.floor((n+9)/10)*Math.floor((e+5)/6)*16;case Ld:return Math.floor((n+9)/10)*Math.floor((e+7)/8)*16;case Wd:return Math.floor((n+9)/10)*Math.floor((e+9)/10)*16;case kd:return Math.floor((n+11)/12)*Math.floor((e+9)/10)*16;case Ud:return Math.floor((n+11)/12)*Math.floor((e+11)/12)*16;case Fd:case jd:case $d:return Math.ceil(n/4)*Math.ceil(e/4)*16;case Vd:case Hd:return Math.ceil(n/4)*Math.ceil(e/4)*8;case cl:case qd:return Math.ceil(n/4)*Math.ceil(e/4)*16}throw new Error(`Unable to determine texture byte length for ${t} format.`)}function m_(n){switch(n){case Zs:case Nm:return{byteLength:1,components:1};case La:case Cm:case ti:return{byteLength:2,components:1};case mu:case gu:return{byteLength:2,components:4};case Gn:case pu:case Mn:return{byteLength:4,components:1};case Pm:case Lm:return{byteLength:4,components:3}}throw new Error(`THREE.TextureUtils: Unknown texture type ${n}.`)}typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:fu}}));typeof window<"u"&&(window.__THREE__?st("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=fu);function tg(){let n=null,e=!1,t=null,s=null;function i(r,a){t(r,a),s=n.requestAnimationFrame(i)}return{start:function(){e!==!0&&t!==null&&n!==null&&(s=n.requestAnimationFrame(i),e=!0)},stop:function(){n!==null&&n.cancelAnimationFrame(s),e=!1},setAnimationLoop:function(r){t=r},setContext:function(r){n=r}}}function g_(n){const e=new WeakMap;function t(o,l){const c=o.array,d=o.usage,u=c.byteLength,h=n.createBuffer();n.bindBuffer(l,h),n.bufferData(l,c,d),o.onUploadCallback();let g;if(c instanceof Float32Array)g=n.FLOAT;else if(typeof Float16Array<"u"&&c instanceof Float16Array)g=n.HALF_FLOAT;else if(c instanceof Uint16Array)o.isFloat16BufferAttribute?g=n.HALF_FLOAT:g=n.UNSIGNED_SHORT;else if(c instanceof Int16Array)g=n.SHORT;else if(c instanceof Uint32Array)g=n.UNSIGNED_INT;else if(c instanceof Int32Array)g=n.INT;else if(c instanceof Int8Array)g=n.BYTE;else if(c instanceof Uint8Array)g=n.UNSIGNED_BYTE;else if(c instanceof Uint8ClampedArray)g=n.UNSIGNED_BYTE;else throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+c);return{buffer:h,type:g,bytesPerElement:c.BYTES_PER_ELEMENT,version:o.version,size:u}}function s(o,l,c){const d=l.array,u=l.updateRanges;if(n.bindBuffer(c,o),u.length===0)n.bufferSubData(c,0,d);else{u.sort((g,p)=>g.start-p.start);let h=0;for(let g=1;g<u.length;g++){const p=u[h],z=u[g];z.start<=p.start+p.count+1?p.count=Math.max(p.count,z.start+z.count-p.start):(++h,u[h]=z)}u.length=h+1;for(let g=0,p=u.length;g<p;g++){const z=u[g];n.bufferSubData(c,z.start*d.BYTES_PER_ELEMENT,d,z.start,z.count)}l.clearUpdateRanges()}l.onUploadCallback()}function i(o){return o.isInterleavedBufferAttribute&&(o=o.data),e.get(o)}function r(o){o.isInterleavedBufferAttribute&&(o=o.data);const l=e.get(o);l&&(n.deleteBuffer(l.buffer),e.delete(o))}function a(o,l){if(o.isInterleavedBufferAttribute&&(o=o.data),o.isGLBufferAttribute){const d=e.get(o);(!d||d.version<o.version)&&e.set(o,{buffer:o.buffer,type:o.type,bytesPerElement:o.elementSize,version:o.version});return}const c=e.get(o);if(c===void 0)e.set(o,t(o,l));else if(c.version<o.version){if(c.size!==o.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.");s(c.buffer,o,l),c.version=o.version}}return{get:i,remove:r,update:a}}var M_=`#ifdef USE_ALPHAHASH
7
7
  if ( diffuseColor.a < getAlphaHashThreshold( vPosition ) ) discard;
8
8
  #endif`,b_=`#ifdef USE_ALPHAHASH
9
9
  const float ALPHA_HASH_SCALE = 0.05;
@@ -3669,7 +3669,7 @@ void main() {
3669
3669
  #include <tonemapping_fragment>
3670
3670
  #include <colorspace_fragment>
3671
3671
  #include <fog_fragment>
3672
- }`,zt={alphahash_fragment:M_,alphahash_pars_fragment:b_,alphamap_fragment:z_,alphamap_pars_fragment:__,alphatest_fragment:w_,alphatest_pars_fragment:y_,aomap_fragment:v_,aomap_pars_fragment:O_,batching_pars_vertex:x_,batching_vertex:S_,begin_vertex:A_,beginnormal_vertex:E_,bsdfs:D_,iridescence_fragment:I_,bumpmap_pars_fragment:T_,clipping_planes_fragment:G_,clipping_planes_pars_fragment:R_,clipping_planes_pars_vertex:B_,clipping_planes_vertex:N_,color_fragment:C_,color_pars_fragment:P_,color_pars_vertex:L_,color_vertex:W_,common:k_,cube_uv_reflection_fragment:U_,defaultnormal_vertex:F_,displacementmap_pars_vertex:j_,displacementmap_vertex:$_,emissivemap_fragment:V_,emissivemap_pars_fragment:H_,colorspace_fragment:q_,colorspace_pars_fragment:X_,envmap_fragment:Y_,envmap_common_pars_fragment:K_,envmap_pars_fragment:Z_,envmap_pars_vertex:Q_,envmap_physical_pars_fragment:cw,envmap_vertex:J_,fog_vertex:ew,fog_pars_vertex:tw,fog_fragment:sw,fog_pars_fragment:nw,gradientmap_pars_fragment:iw,lightmap_pars_fragment:rw,lights_lambert_fragment:aw,lights_lambert_pars_fragment:ow,lights_pars_begin:lw,lights_toon_fragment:dw,lights_toon_pars_fragment:uw,lights_phong_fragment:hw,lights_phong_pars_fragment:fw,lights_physical_fragment:pw,lights_physical_pars_fragment:mw,lights_fragment_begin:gw,lights_fragment_maps:Mw,lights_fragment_end:bw,lightprobes_pars_fragment:zw,logdepthbuf_fragment:_w,logdepthbuf_pars_fragment:ww,logdepthbuf_pars_vertex:yw,logdepthbuf_vertex:vw,map_fragment:Ow,map_pars_fragment:xw,map_particle_fragment:Sw,map_particle_pars_fragment:Aw,metalnessmap_fragment:Ew,metalnessmap_pars_fragment:Dw,morphinstance_vertex:Iw,morphcolor_vertex:Tw,morphnormal_vertex:Gw,morphtarget_pars_vertex:Rw,morphtarget_vertex:Bw,normal_fragment_begin:Nw,normal_fragment_maps:Cw,normal_pars_fragment:Pw,normal_pars_vertex:Lw,normal_vertex:Ww,normalmap_pars_fragment:kw,clearcoat_normal_fragment_begin:Uw,clearcoat_normal_fragment_maps:Fw,clearcoat_pars_fragment:jw,iridescence_pars_fragment:$w,opaque_fragment:Vw,packing:Hw,premultiplied_alpha_fragment:qw,project_vertex:Xw,dithering_fragment:Yw,dithering_pars_fragment:Kw,roughnessmap_fragment:Zw,roughnessmap_pars_fragment:Qw,shadowmap_pars_fragment:Jw,shadowmap_pars_vertex:ey,shadowmap_vertex:ty,shadowmask_pars_fragment:sy,skinbase_vertex:ny,skinning_pars_vertex:iy,skinning_vertex:ry,skinnormal_vertex:ay,specularmap_fragment:oy,specularmap_pars_fragment:ly,tonemapping_fragment:cy,tonemapping_pars_fragment:dy,transmission_fragment:uy,transmission_pars_fragment:hy,uv_pars_fragment:fy,uv_pars_vertex:py,uv_vertex:my,worldpos_vertex:gy,background_vert:My,background_frag:by,backgroundCube_vert:zy,backgroundCube_frag:_y,cube_vert:wy,cube_frag:yy,depth_vert:vy,depth_frag:Oy,distance_vert:xy,distance_frag:Sy,equirect_vert:Ay,equirect_frag:Ey,linedashed_vert:Dy,linedashed_frag:Iy,meshbasic_vert:Ty,meshbasic_frag:Gy,meshlambert_vert:Ry,meshlambert_frag:By,meshmatcap_vert:Ny,meshmatcap_frag:Cy,meshnormal_vert:Py,meshnormal_frag:Ly,meshphong_vert:Wy,meshphong_frag:ky,meshphysical_vert:Uy,meshphysical_frag:Fy,meshtoon_vert:jy,meshtoon_frag:$y,points_vert:Vy,points_frag:Hy,shadow_vert:qy,shadow_frag:Xy,sprite_vert:Yy,sprite_frag:Ky},Be={common:{diffuse:{value:new Ke(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new ut},alphaMap:{value:null},alphaMapTransform:{value:new ut},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new ut}},envmap:{envMap:{value:null},envMapRotation:{value:new ut},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98},dfgLUT:{value:null}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new ut}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new ut}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new ut},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new ut},normalScale:{value:new lt(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new ut},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new ut}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new ut}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new ut}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new Ke(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{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 U},probesMax:{value:new U},probesResolution:{value:new U}},points:{diffuse:{value:new Ke(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new ut},alphaTest:{value:0},uvTransform:{value:new ut}},sprite:{diffuse:{value:new Ke(16777215)},opacity:{value:1},center:{value:new lt(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new ut},alphaMap:{value:null},alphaMapTransform:{value:new ut},alphaTest:{value:0}}},On={basic:{uniforms:Bs([Be.common,Be.specularmap,Be.envmap,Be.aomap,Be.lightmap,Be.fog]),vertexShader:zt.meshbasic_vert,fragmentShader:zt.meshbasic_frag},lambert:{uniforms:Bs([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 Ke(0)},envMapIntensity:{value:1}}]),vertexShader:zt.meshlambert_vert,fragmentShader:zt.meshlambert_frag},phong:{uniforms:Bs([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 Ke(0)},specular:{value:new Ke(1118481)},shininess:{value:30},envMapIntensity:{value:1}}]),vertexShader:zt.meshphong_vert,fragmentShader:zt.meshphong_frag},standard:{uniforms:Bs([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 Ke(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:zt.meshphysical_vert,fragmentShader:zt.meshphysical_frag},toon:{uniforms:Bs([Be.common,Be.aomap,Be.lightmap,Be.emissivemap,Be.bumpmap,Be.normalmap,Be.displacementmap,Be.gradientmap,Be.fog,Be.lights,{emissive:{value:new Ke(0)}}]),vertexShader:zt.meshtoon_vert,fragmentShader:zt.meshtoon_frag},matcap:{uniforms:Bs([Be.common,Be.bumpmap,Be.normalmap,Be.displacementmap,Be.fog,{matcap:{value:null}}]),vertexShader:zt.meshmatcap_vert,fragmentShader:zt.meshmatcap_frag},points:{uniforms:Bs([Be.points,Be.fog]),vertexShader:zt.points_vert,fragmentShader:zt.points_frag},dashed:{uniforms:Bs([Be.common,Be.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:zt.linedashed_vert,fragmentShader:zt.linedashed_frag},depth:{uniforms:Bs([Be.common,Be.displacementmap]),vertexShader:zt.depth_vert,fragmentShader:zt.depth_frag},normal:{uniforms:Bs([Be.common,Be.bumpmap,Be.normalmap,Be.displacementmap,{opacity:{value:1}}]),vertexShader:zt.meshnormal_vert,fragmentShader:zt.meshnormal_frag},sprite:{uniforms:Bs([Be.sprite,Be.fog]),vertexShader:zt.sprite_vert,fragmentShader:zt.sprite_frag},background:{uniforms:{uvTransform:{value:new ut},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:zt.background_vert,fragmentShader:zt.background_frag},backgroundCube:{uniforms:{envMap:{value:null},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new ut}},vertexShader:zt.backgroundCube_vert,fragmentShader:zt.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:zt.cube_vert,fragmentShader:zt.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:zt.equirect_vert,fragmentShader:zt.equirect_frag},distance:{uniforms:Bs([Be.common,Be.displacementmap,{referencePosition:{value:new U},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:zt.distance_vert,fragmentShader:zt.distance_frag},shadow:{uniforms:Bs([Be.lights,Be.fog,{color:{value:new Ke(0)},opacity:{value:1}}]),vertexShader:zt.shadow_vert,fragmentShader:zt.shadow_frag}};On.physical={uniforms:Bs([On.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new ut},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new ut},clearcoatNormalScale:{value:new lt(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new ut},dispersion:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new ut},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new ut},sheen:{value:0},sheenColor:{value:new Ke(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new ut},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new ut},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new ut},transmissionSamplerSize:{value:new lt},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new ut},attenuationDistance:{value:0},attenuationColor:{value:new Ke(0)},specularColor:{value:new Ke(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new ut},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new ut},anisotropyVector:{value:new lt},anisotropyMap:{value:null},anisotropyMapTransform:{value:new ut}}]),vertexShader:zt.meshphysical_vert,fragmentShader:zt.meshphysical_frag};const yo={r:0,b:0,g:0},Zy=new Gt,sg=new ut;sg.set(-1,0,0,0,1,0,0,0,1);function Qy(n,e,t,s,i,r){const a=new Ke(0);let o=i===!0?0:1,l,c,d=null,u=0,h=null;function g(_){let O=_.isScene===!0?_.background:null;if(O&&O.isTexture){const w=_.backgroundBlurriness>0;O=e.get(O,w)}return O}function p(_){let O=!1;const w=g(_);w===null?m(a,o):w&&w.isColor&&(m(w,1),O=!0);const x=n.xr.getEnvironmentBlendMode();x==="additive"?t.buffers.color.setClear(0,0,0,1,r):x==="alpha-blend"&&t.buffers.color.setClear(0,0,0,0,r),(n.autoClear||O)&&(t.buffers.depth.setTest(!0),t.buffers.depth.setMask(!0),t.buffers.color.setMask(!0),n.clear(n.autoClearColor,n.autoClearDepth,n.autoClearStencil))}function z(_,O){const w=g(O);w&&(w.isCubeTexture||w.mapping===Ol)?(c===void 0&&(c=new Us(new ja(1,1,1),new hs({name:"BackgroundCubeMaterial",uniforms:Xr(On.backgroundCube.uniforms),vertexShader:On.backgroundCube.vertexShader,fragmentShader:On.backgroundCube.fragmentShader,side:ks,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),c.geometry.deleteAttribute("normal"),c.geometry.deleteAttribute("uv"),c.onBeforeRender=function(x,S,I){this.matrixWorld.copyPosition(I.matrixWorld)},Object.defineProperty(c.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),s.update(c)),c.material.uniforms.envMap.value=w,c.material.uniforms.backgroundBlurriness.value=O.backgroundBlurriness,c.material.uniforms.backgroundIntensity.value=O.backgroundIntensity,c.material.uniforms.backgroundRotation.value.setFromMatrix4(Zy.makeRotationFromEuler(O.backgroundRotation)).transpose(),w.isCubeTexture&&w.isRenderTargetTexture===!1&&c.material.uniforms.backgroundRotation.value.premultiply(sg),c.material.toneMapped=xt.getTransfer(w.colorSpace)!==kt,(d!==w||u!==w.version||h!==n.toneMapping)&&(c.material.needsUpdate=!0,d=w,u=w.version,h=n.toneMapping),c.layers.enableAll(),_.unshift(c,c.geometry,c.material,0,0,null)):w&&w.isTexture&&(l===void 0&&(l=new Us(new Al(2,2),new hs({name:"BackgroundMaterial",uniforms:Xr(On.background.uniforms),vertexShader:On.background.vertexShader,fragmentShader:On.background.fragmentShader,side:Ei,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),l.geometry.deleteAttribute("normal"),Object.defineProperty(l.material,"map",{get:function(){return this.uniforms.t2D.value}}),s.update(l)),l.material.uniforms.t2D.value=w,l.material.uniforms.backgroundIntensity.value=O.backgroundIntensity,l.material.toneMapped=xt.getTransfer(w.colorSpace)!==kt,w.matrixAutoUpdate===!0&&w.updateMatrix(),l.material.uniforms.uvTransform.value.copy(w.matrix),(d!==w||u!==w.version||h!==n.toneMapping)&&(l.material.needsUpdate=!0,d=w,u=w.version,h=n.toneMapping),l.layers.enableAll(),_.unshift(l,l.geometry,l.material,0,0,null))}function m(_,O){_.getRGB(yo,Qm(n)),t.buffers.color.setClear(yo.r,yo.g,yo.b,O,r)}function f(){c!==void 0&&(c.geometry.dispose(),c.material.dispose(),c=void 0),l!==void 0&&(l.geometry.dispose(),l.material.dispose(),l=void 0)}return{getClearColor:function(){return a},setClearColor:function(_,O=1){a.set(_),o=O,m(a,o)},getClearAlpha:function(){return o},setClearAlpha:function(_){o=_,m(a,o)},render:p,addToRenderList:z,dispose:f}}function Jy(n,e){const t=n.getParameter(n.MAX_VERTEX_ATTRIBS),s={},i=h(null);let r=i,a=!1;function o(N,k,L,F,P){let W=!1;const X=u(N,F,L,k);r!==X&&(r=X,c(r.object)),W=g(N,F,L,P),W&&p(N,F,L,P),P!==null&&e.update(P,n.ELEMENT_ARRAY_BUFFER),(W||a)&&(a=!1,w(N,k,L,F),P!==null&&n.bindBuffer(n.ELEMENT_ARRAY_BUFFER,e.get(P).buffer))}function l(){return n.createVertexArray()}function c(N){return n.bindVertexArray(N)}function d(N){return n.deleteVertexArray(N)}function u(N,k,L,F){const P=F.wireframe===!0;let W=s[k.id];W===void 0&&(W={},s[k.id]=W);const X=N.isInstancedMesh===!0?N.id:0;let Q=W[X];Q===void 0&&(Q={},W[X]=Q);let ie=Q[L.id];ie===void 0&&(ie={},Q[L.id]=ie);let be=ie[P];return be===void 0&&(be=h(l()),ie[P]=be),be}function h(N){const k=[],L=[],F=[];for(let P=0;P<t;P++)k[P]=0,L[P]=0,F[P]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:k,enabledAttributes:L,attributeDivisors:F,object:N,attributes:{},index:null}}function g(N,k,L,F){const P=r.attributes,W=k.attributes;let X=0;const Q=L.getAttributes();for(const ie in Q)if(Q[ie].location>=0){const ae=P[ie];let xe=W[ie];if(xe===void 0&&(ie==="instanceMatrix"&&N.instanceMatrix&&(xe=N.instanceMatrix),ie==="instanceColor"&&N.instanceColor&&(xe=N.instanceColor)),ae===void 0||ae.attribute!==xe||xe&&ae.data!==xe.data)return!0;X++}return r.attributesNum!==X||r.index!==F}function p(N,k,L,F){const P={},W=k.attributes;let X=0;const Q=L.getAttributes();for(const ie in Q)if(Q[ie].location>=0){let ae=W[ie];ae===void 0&&(ie==="instanceMatrix"&&N.instanceMatrix&&(ae=N.instanceMatrix),ie==="instanceColor"&&N.instanceColor&&(ae=N.instanceColor));const xe={};xe.attribute=ae,ae&&ae.data&&(xe.data=ae.data),P[ie]=xe,X++}r.attributes=P,r.attributesNum=X,r.index=F}function z(){const N=r.newAttributes;for(let k=0,L=N.length;k<L;k++)N[k]=0}function m(N){f(N,0)}function f(N,k){const L=r.newAttributes,F=r.enabledAttributes,P=r.attributeDivisors;L[N]=1,F[N]===0&&(n.enableVertexAttribArray(N),F[N]=1),P[N]!==k&&(n.vertexAttribDivisor(N,k),P[N]=k)}function _(){const N=r.newAttributes,k=r.enabledAttributes;for(let L=0,F=k.length;L<F;L++)k[L]!==N[L]&&(n.disableVertexAttribArray(L),k[L]=0)}function O(N,k,L,F,P,W,X){X===!0?n.vertexAttribIPointer(N,k,L,P,W):n.vertexAttribPointer(N,k,L,F,P,W)}function w(N,k,L,F){z();const P=F.attributes,W=L.getAttributes(),X=k.defaultAttributeValues;for(const Q in W){const ie=W[Q];if(ie.location>=0){let be=P[Q];if(be===void 0&&(Q==="instanceMatrix"&&N.instanceMatrix&&(be=N.instanceMatrix),Q==="instanceColor"&&N.instanceColor&&(be=N.instanceColor)),be!==void 0){const ae=be.normalized,xe=be.itemSize,Ze=e.get(be);if(Ze===void 0)continue;const nt=Ze.buffer,Ve=Ze.type,le=Ze.bytesPerElement,ue=Ve===n.INT||Ve===n.UNSIGNED_INT||be.gpuType===pu;if(be.isInterleavedBufferAttribute){const fe=be.data,et=fe.stride,ct=be.offset;if(fe.isInstancedInterleavedBuffer){for(let Qe=0;Qe<ie.locationSize;Qe++)f(ie.location+Qe,fe.meshPerAttribute);N.isInstancedMesh!==!0&&F._maxInstanceCount===void 0&&(F._maxInstanceCount=fe.meshPerAttribute*fe.count)}else for(let Qe=0;Qe<ie.locationSize;Qe++)m(ie.location+Qe);n.bindBuffer(n.ARRAY_BUFFER,nt);for(let Qe=0;Qe<ie.locationSize;Qe++)O(ie.location+Qe,xe/ie.locationSize,Ve,ae,et*le,(ct+xe/ie.locationSize*Qe)*le,ue)}else{if(be.isInstancedBufferAttribute){for(let fe=0;fe<ie.locationSize;fe++)f(ie.location+fe,be.meshPerAttribute);N.isInstancedMesh!==!0&&F._maxInstanceCount===void 0&&(F._maxInstanceCount=be.meshPerAttribute*be.count)}else for(let fe=0;fe<ie.locationSize;fe++)m(ie.location+fe);n.bindBuffer(n.ARRAY_BUFFER,nt);for(let fe=0;fe<ie.locationSize;fe++)O(ie.location+fe,xe/ie.locationSize,Ve,ae,xe*le,xe/ie.locationSize*fe*le,ue)}}else if(X!==void 0){const ae=X[Q];if(ae!==void 0)switch(ae.length){case 2:n.vertexAttrib2fv(ie.location,ae);break;case 3:n.vertexAttrib3fv(ie.location,ae);break;case 4:n.vertexAttrib4fv(ie.location,ae);break;default:n.vertexAttrib1fv(ie.location,ae)}}}}_()}function x(){A();for(const N in s){const k=s[N];for(const L in k){const F=k[L];for(const P in F){const W=F[P];for(const X in W)d(W[X].object),delete W[X];delete F[P]}}delete s[N]}}function S(N){if(s[N.id]===void 0)return;const k=s[N.id];for(const L in k){const F=k[L];for(const P in F){const W=F[P];for(const X in W)d(W[X].object),delete W[X];delete F[P]}}delete s[N.id]}function I(N){for(const k in s){const L=s[k];for(const F in L){const P=L[F];if(P[N.id]===void 0)continue;const W=P[N.id];for(const X in W)d(W[X].object),delete W[X];delete P[N.id]}}}function b(N){for(const k in s){const L=s[k],F=N.isInstancedMesh===!0?N.id:0,P=L[F];if(P!==void 0){for(const W in P){const X=P[W];for(const Q in X)d(X[Q].object),delete X[Q];delete P[W]}delete L[F],Object.keys(L).length===0&&delete s[k]}}}function A(){B(),a=!0,r!==i&&(r=i,c(r.object))}function B(){i.geometry=null,i.program=null,i.wireframe=!1}return{setup:o,reset:A,resetDefaultState:B,dispose:x,releaseStatesOfGeometry:S,releaseStatesOfObject:b,releaseStatesOfProgram:I,initAttributes:z,enableAttribute:m,disableUnusedAttributes:_}}function ev(n,e,t){let s;function i(l){s=l}function r(l,c){n.drawArrays(s,l,c),t.update(c,s,1)}function a(l,c,d){d!==0&&(n.drawArraysInstanced(s,l,c,d),t.update(c,s,d))}function o(l,c,d){if(d===0)return;e.get("WEBGL_multi_draw").multiDrawArraysWEBGL(s,l,0,c,0,d);let h=0;for(let g=0;g<d;g++)h+=c[g];t.update(h,s,1)}this.setMode=i,this.render=r,this.renderInstances=a,this.renderMultiDraw=o}function tv(n,e,t,s){let i;function r(){if(i!==void 0)return i;if(e.has("EXT_texture_filter_anisotropic")===!0){const I=e.get("EXT_texture_filter_anisotropic");i=n.getParameter(I.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else i=0;return i}function a(I){return!(I!==bn&&s.convert(I)!==n.getParameter(n.IMPLEMENTATION_COLOR_READ_FORMAT))}function o(I){const b=I===ti&&(e.has("EXT_color_buffer_half_float")||e.has("EXT_color_buffer_float"));return!(I!==Zs&&s.convert(I)!==n.getParameter(n.IMPLEMENTATION_COLOR_READ_TYPE)&&I!==Mn&&!b)}function l(I){if(I==="highp"){if(n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.HIGH_FLOAT).precision>0&&n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.HIGH_FLOAT).precision>0)return"highp";I="mediump"}return I==="mediump"&&n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.MEDIUM_FLOAT).precision>0&&n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}let c=t.precision!==void 0?t.precision:"highp";const d=l(c);d!==c&&(st("WebGLRenderer:",c,"not supported, using",d,"instead."),c=d);const u=t.logarithmicDepthBuffer===!0,h=t.reversedDepthBuffer===!0&&e.has("EXT_clip_control");t.reversedDepthBuffer===!0&&h===!1&&st("WebGLRenderer: Unable to use reversed depth buffer due to missing EXT_clip_control extension. Fallback to default depth buffer.");const g=n.getParameter(n.MAX_TEXTURE_IMAGE_UNITS),p=n.getParameter(n.MAX_VERTEX_TEXTURE_IMAGE_UNITS),z=n.getParameter(n.MAX_TEXTURE_SIZE),m=n.getParameter(n.MAX_CUBE_MAP_TEXTURE_SIZE),f=n.getParameter(n.MAX_VERTEX_ATTRIBS),_=n.getParameter(n.MAX_VERTEX_UNIFORM_VECTORS),O=n.getParameter(n.MAX_VARYING_VECTORS),w=n.getParameter(n.MAX_FRAGMENT_UNIFORM_VECTORS),x=n.getParameter(n.MAX_SAMPLES),S=n.getParameter(n.SAMPLES);return{isWebGL2:!0,getMaxAnisotropy:r,getMaxPrecision:l,textureFormatReadable:a,textureTypeReadable:o,precision:c,logarithmicDepthBuffer:u,reversedDepthBuffer:h,maxTextures:g,maxVertexTextures:p,maxTextureSize:z,maxCubemapSize:m,maxAttributes:f,maxVertexUniforms:_,maxVaryings:O,maxFragmentUniforms:w,maxSamples:x,samples:S}}function sv(n){const e=this;let t=null,s=0,i=!1,r=!1;const a=new gi,o=new ut,l={value:null,needsUpdate:!1};this.uniform=l,this.numPlanes=0,this.numIntersection=0,this.init=function(u,h){const g=u.length!==0||h||s!==0||i;return i=h,s=u.length,g},this.beginShadows=function(){r=!0,d(null)},this.endShadows=function(){r=!1},this.setGlobalState=function(u,h){t=d(u,h,0)},this.setState=function(u,h,g){const p=u.clippingPlanes,z=u.clipIntersection,m=u.clipShadows,f=n.get(u);if(!i||p===null||p.length===0||r&&!m)r?d(null):c();else{const _=r?0:s,O=_*4;let w=f.clippingState||null;l.value=w,w=d(p,h,O,g);for(let x=0;x!==O;++x)w[x]=t[x];f.clippingState=w,this.numIntersection=z?this.numPlanes:0,this.numPlanes+=_}};function c(){l.value!==t&&(l.value=t,l.needsUpdate=s>0),e.numPlanes=s,e.numIntersection=0}function d(u,h,g,p){const z=u!==null?u.length:0;let m=null;if(z!==0){if(m=l.value,p!==!0||m===null){const f=g+z*4,_=h.matrixWorldInverse;o.getNormalMatrix(_),(m===null||m.length<f)&&(m=new Float32Array(f));for(let O=0,w=g;O!==z;++O,w+=4)a.copy(u[O]).applyMatrix4(_,o),a.normal.toArray(m,w),m[w+3]=a.constant}l.value=m,l.needsUpdate=!0}return e.numPlanes=z,e.numIntersection=0,m}}const _i=4,Qh=[.125,.215,.35,.446,.526,.582],ki=20,nv=256,za=new Ru,Jh=new Ke;let zc=null,_c=0,wc=0,yc=!1;const iv=new U;class ef{constructor(e){this._renderer=e,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._sizeLods=[],this._sigmas=[],this._lodMeshes=[],this._backgroundBox=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._blurMaterial=null,this._ggxMaterial=null}fromScene(e,t=0,s=.1,i=100,r={}){const{size:a=256,position:o=iv}=r;zc=this._renderer.getRenderTarget(),_c=this._renderer.getActiveCubeFace(),wc=this._renderer.getActiveMipmapLevel(),yc=this._renderer.xr.enabled,this._renderer.xr.enabled=!1,this._setSize(a);const l=this._allocateTargets();return l.depthBuffer=!0,this._sceneToCubeUV(e,s,i,l,o),t>0&&this._blur(l,0,0,t),this._applyPMREM(l),this._cleanup(l),l}fromEquirectangular(e,t=null){return this._fromTexture(e,t)}fromCubemap(e,t=null){return this._fromTexture(e,t)}compileCubemapShader(){this._cubemapMaterial===null&&(this._cubemapMaterial=nf(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=sf(),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(zc,_c,wc),this._renderer.xr.enabled=yc,e.scissorTest=!1,Er(e,0,0,e.width,e.height)}_fromTexture(e,t){e.mapping===Ji||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),zc=this._renderer.getRenderTarget(),_c=this._renderer.getActiveCubeFace(),wc=this._renderer.getActiveMipmapLevel(),yc=this._renderer.xr.enabled,this._renderer.xr.enabled=!1;const s=t||this._allocateTargets();return this._textureToCubeUV(e,s),this._applyPMREM(s),this._cleanup(s),s}_allocateTargets(){const e=3*Math.max(this._cubeSize,112),t=4*this._cubeSize,s={magFilter:Ds,minFilter:Ds,generateMipmaps:!1,type:ti,format:bn,colorSpace:dl,depthBuffer:!1},i=tf(e,t,s);if(this._pingPongRenderTarget===null||this._pingPongRenderTarget.width!==e||this._pingPongRenderTarget.height!==t){this._pingPongRenderTarget!==null&&this._dispose(),this._pingPongRenderTarget=tf(e,t,s);const{_lodMax:r}=this;({lodMeshes:this._lodMeshes,sizeLods:this._sizeLods,sigmas:this._sigmas}=rv(r)),this._blurMaterial=ov(r,e,t),this._ggxMaterial=av(r,e,t)}return i}_compileMaterial(e){const t=new Us(new ds,e);this._renderer.compile(t,za)}_sceneToCubeUV(e,t,s,i,r){const l=new nn(90,1,t,s),c=[1,-1,1,1,1,1],d=[1,1,1,-1,-1,-1],u=this._renderer,h=u.autoClear,g=u.toneMapping;u.getClearColor(Jh),u.toneMapping=Dn,u.autoClear=!1,u.state.buffers.depth.getReversed()&&(u.setRenderTarget(i),u.clearDepth(),u.setRenderTarget(null)),this._backgroundBox===null&&(this._backgroundBox=new Us(new ja,new Su({name:"PMREM.Background",side:ks,depthWrite:!1,depthTest:!1})));const z=this._backgroundBox,m=z.material;let f=!1;const _=e.background;_?_.isColor&&(m.color.copy(_),e.background=null,f=!0):(m.color.copy(Jh),f=!0);for(let O=0;O<6;O++){const w=O%3;w===0?(l.up.set(0,c[O],0),l.position.set(r.x,r.y,r.z),l.lookAt(r.x+d[O],r.y,r.z)):w===1?(l.up.set(0,0,c[O]),l.position.set(r.x,r.y,r.z),l.lookAt(r.x,r.y+d[O],r.z)):(l.up.set(0,c[O],0),l.position.set(r.x,r.y,r.z),l.lookAt(r.x,r.y,r.z+d[O]));const x=this._cubeSize;Er(i,w*x,O>2?x:0,x,x),u.setRenderTarget(i),f&&u.render(z,l),u.render(e,l)}u.toneMapping=g,u.autoClear=h,e.background=_}_textureToCubeUV(e,t){const s=this._renderer,i=e.mapping===Ji||e.mapping===Vr;i?(this._cubemapMaterial===null&&(this._cubemapMaterial=nf()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=sf());const r=i?this._cubemapMaterial:this._equirectMaterial,a=this._lodMeshes[0];a.material=r;const o=r.uniforms;o.envMap.value=e;const l=this._cubeSize;Er(t,0,0,3*l,2*l),s.setRenderTarget(t),s.render(a,za)}_applyPMREM(e){const t=this._renderer,s=t.autoClear;t.autoClear=!1;const i=this._lodMeshes.length;for(let r=1;r<i;r++)this._applyGGXFilter(e,r-1,r);t.autoClear=s}_applyGGXFilter(e,t,s){const i=this._renderer,r=this._pingPongRenderTarget,a=this._ggxMaterial,o=this._lodMeshes[s];o.material=a;const l=a.uniforms,c=s/(this._lodMeshes.length-1),d=t/(this._lodMeshes.length-1),u=Math.sqrt(c*c-d*d),h=0+c*1.25,g=u*h,{_lodMax:p}=this,z=this._sizeLods[s],m=3*z*(s>p-_i?s-p+_i:0),f=4*(this._cubeSize-z);l.envMap.value=e.texture,l.roughness.value=g,l.mipInt.value=p-t,Er(r,m,f,3*z,2*z),i.setRenderTarget(r),i.render(o,za),l.envMap.value=r.texture,l.roughness.value=0,l.mipInt.value=p-s,Er(e,m,f,3*z,2*z),i.setRenderTarget(e),i.render(o,za)}_blur(e,t,s,i,r){const a=this._pingPongRenderTarget;this._halfBlur(e,a,t,s,i,"latitudinal",r),this._halfBlur(a,e,s,s,i,"longitudinal",r)}_halfBlur(e,t,s,i,r,a,o){const l=this._renderer,c=this._blurMaterial;a!=="latitudinal"&&a!=="longitudinal"&&Ot("blur direction must be either latitudinal or longitudinal!");const d=3,u=this._lodMeshes[i];u.material=c;const h=c.uniforms,g=this._sizeLods[s]-1,p=isFinite(r)?Math.PI/(2*g):2*Math.PI/(2*ki-1),z=r/p,m=isFinite(r)?1+Math.floor(d*z):ki;m>ki&&st(`sigmaRadians, ${r}, is too large and will clip, as it requested ${m} samples when the maximum is set to ${ki}`);const f=[];let _=0;for(let I=0;I<ki;++I){const b=I/z,A=Math.exp(-b*b/2);f.push(A),I===0?_+=A:I<m&&(_+=2*A)}for(let I=0;I<f.length;I++)f[I]=f[I]/_;h.envMap.value=e.texture,h.samples.value=m,h.weights.value=f,h.latitudinal.value=a==="latitudinal",o&&(h.poleAxis.value=o);const{_lodMax:O}=this;h.dTheta.value=p,h.mipInt.value=O-s;const w=this._sizeLods[i],x=3*w*(i>O-_i?i-O+_i:0),S=4*(this._cubeSize-w);Er(t,x,S,3*w,2*w),l.setRenderTarget(t),l.render(u,za)}}function rv(n){const e=[],t=[],s=[];let i=n;const r=n-_i+1+Qh.length;for(let a=0;a<r;a++){const o=Math.pow(2,i);e.push(o);let l=1/o;a>n-_i?l=Qh[a-n+_i-1]:a===0&&(l=0),t.push(l);const c=1/(o-2),d=-c,u=1+c,h=[d,d,u,d,u,u,d,d,u,u,d,u],g=6,p=6,z=3,m=2,f=1,_=new Float32Array(z*p*g),O=new Float32Array(m*p*g),w=new Float32Array(f*p*g);for(let S=0;S<g;S++){const I=S%3*2/3-1,b=S>2?0:-1,A=[I,b,0,I+2/3,b,0,I+2/3,b+1,0,I,b,0,I+2/3,b+1,0,I,b+1,0];_.set(A,z*p*S),O.set(h,m*p*S);const B=[S,S,S,S,S,S];w.set(B,f*p*S)}const x=new ds;x.setAttribute("position",new ws(_,z)),x.setAttribute("uv",new ws(O,m)),x.setAttribute("faceIndex",new ws(w,f)),s.push(new Us(x,null)),i>_i&&i--}return{lodMeshes:s,sizeLods:e,sigmas:t}}function tf(n,e,t){const s=new In(n,e,t);return s.texture.mapping=Ol,s.texture.name="PMREM.cubeUv",s.scissorTest=!0,s}function Er(n,e,t,s,i){n.viewport.set(e,t,s,i),n.scissor.set(e,t,s,i)}function av(n,e,t){return new hs({name:"PMREMGGXConvolution",defines:{GGX_SAMPLES:nv,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/t,CUBEUV_MAX_MIP:`${n}.0`},uniforms:{envMap:{value:null},roughness:{value:0},mipInt:{value:0}},vertexShader:Dl(),fragmentShader:`
3672
+ }`,zt={alphahash_fragment:M_,alphahash_pars_fragment:b_,alphamap_fragment:z_,alphamap_pars_fragment:__,alphatest_fragment:w_,alphatest_pars_fragment:y_,aomap_fragment:v_,aomap_pars_fragment:O_,batching_pars_vertex:x_,batching_vertex:S_,begin_vertex:A_,beginnormal_vertex:E_,bsdfs:D_,iridescence_fragment:I_,bumpmap_pars_fragment:T_,clipping_planes_fragment:G_,clipping_planes_pars_fragment:R_,clipping_planes_pars_vertex:B_,clipping_planes_vertex:N_,color_fragment:C_,color_pars_fragment:P_,color_pars_vertex:L_,color_vertex:W_,common:k_,cube_uv_reflection_fragment:U_,defaultnormal_vertex:F_,displacementmap_pars_vertex:j_,displacementmap_vertex:$_,emissivemap_fragment:V_,emissivemap_pars_fragment:H_,colorspace_fragment:q_,colorspace_pars_fragment:X_,envmap_fragment:Y_,envmap_common_pars_fragment:K_,envmap_pars_fragment:Z_,envmap_pars_vertex:Q_,envmap_physical_pars_fragment:cw,envmap_vertex:J_,fog_vertex:ew,fog_pars_vertex:tw,fog_fragment:sw,fog_pars_fragment:nw,gradientmap_pars_fragment:iw,lightmap_pars_fragment:rw,lights_lambert_fragment:aw,lights_lambert_pars_fragment:ow,lights_pars_begin:lw,lights_toon_fragment:dw,lights_toon_pars_fragment:uw,lights_phong_fragment:hw,lights_phong_pars_fragment:fw,lights_physical_fragment:pw,lights_physical_pars_fragment:mw,lights_fragment_begin:gw,lights_fragment_maps:Mw,lights_fragment_end:bw,lightprobes_pars_fragment:zw,logdepthbuf_fragment:_w,logdepthbuf_pars_fragment:ww,logdepthbuf_pars_vertex:yw,logdepthbuf_vertex:vw,map_fragment:Ow,map_pars_fragment:xw,map_particle_fragment:Sw,map_particle_pars_fragment:Aw,metalnessmap_fragment:Ew,metalnessmap_pars_fragment:Dw,morphinstance_vertex:Iw,morphcolor_vertex:Tw,morphnormal_vertex:Gw,morphtarget_pars_vertex:Rw,morphtarget_vertex:Bw,normal_fragment_begin:Nw,normal_fragment_maps:Cw,normal_pars_fragment:Pw,normal_pars_vertex:Lw,normal_vertex:Ww,normalmap_pars_fragment:kw,clearcoat_normal_fragment_begin:Uw,clearcoat_normal_fragment_maps:Fw,clearcoat_pars_fragment:jw,iridescence_pars_fragment:$w,opaque_fragment:Vw,packing:Hw,premultiplied_alpha_fragment:qw,project_vertex:Xw,dithering_fragment:Yw,dithering_pars_fragment:Kw,roughnessmap_fragment:Zw,roughnessmap_pars_fragment:Qw,shadowmap_pars_fragment:Jw,shadowmap_pars_vertex:ey,shadowmap_vertex:ty,shadowmask_pars_fragment:sy,skinbase_vertex:ny,skinning_pars_vertex:iy,skinning_vertex:ry,skinnormal_vertex:ay,specularmap_fragment:oy,specularmap_pars_fragment:ly,tonemapping_fragment:cy,tonemapping_pars_fragment:dy,transmission_fragment:uy,transmission_pars_fragment:hy,uv_pars_fragment:fy,uv_pars_vertex:py,uv_vertex:my,worldpos_vertex:gy,background_vert:My,background_frag:by,backgroundCube_vert:zy,backgroundCube_frag:_y,cube_vert:wy,cube_frag:yy,depth_vert:vy,depth_frag:Oy,distance_vert:xy,distance_frag:Sy,equirect_vert:Ay,equirect_frag:Ey,linedashed_vert:Dy,linedashed_frag:Iy,meshbasic_vert:Ty,meshbasic_frag:Gy,meshlambert_vert:Ry,meshlambert_frag:By,meshmatcap_vert:Ny,meshmatcap_frag:Cy,meshnormal_vert:Py,meshnormal_frag:Ly,meshphong_vert:Wy,meshphong_frag:ky,meshphysical_vert:Uy,meshphysical_frag:Fy,meshtoon_vert:jy,meshtoon_frag:$y,points_vert:Vy,points_frag:Hy,shadow_vert:qy,shadow_frag:Xy,sprite_vert:Yy,sprite_frag:Ky},Be={common:{diffuse:{value:new Ye(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new ut},alphaMap:{value:null},alphaMapTransform:{value:new ut},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new ut}},envmap:{envMap:{value:null},envMapRotation:{value:new ut},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98},dfgLUT:{value:null}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new ut}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new ut}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new ut},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new ut},normalScale:{value:new lt(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new ut},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new ut}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new ut}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new ut}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new Ye(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{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 F},probesMax:{value:new F},probesResolution:{value:new F}},points:{diffuse:{value:new Ye(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new ut},alphaTest:{value:0},uvTransform:{value:new ut}},sprite:{diffuse:{value:new Ye(16777215)},opacity:{value:1},center:{value:new lt(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new ut},alphaMap:{value:null},alphaMapTransform:{value:new ut},alphaTest:{value:0}}},On={basic:{uniforms:Bs([Be.common,Be.specularmap,Be.envmap,Be.aomap,Be.lightmap,Be.fog]),vertexShader:zt.meshbasic_vert,fragmentShader:zt.meshbasic_frag},lambert:{uniforms:Bs([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 Ye(0)},envMapIntensity:{value:1}}]),vertexShader:zt.meshlambert_vert,fragmentShader:zt.meshlambert_frag},phong:{uniforms:Bs([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 Ye(0)},specular:{value:new Ye(1118481)},shininess:{value:30},envMapIntensity:{value:1}}]),vertexShader:zt.meshphong_vert,fragmentShader:zt.meshphong_frag},standard:{uniforms:Bs([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 Ye(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:zt.meshphysical_vert,fragmentShader:zt.meshphysical_frag},toon:{uniforms:Bs([Be.common,Be.aomap,Be.lightmap,Be.emissivemap,Be.bumpmap,Be.normalmap,Be.displacementmap,Be.gradientmap,Be.fog,Be.lights,{emissive:{value:new Ye(0)}}]),vertexShader:zt.meshtoon_vert,fragmentShader:zt.meshtoon_frag},matcap:{uniforms:Bs([Be.common,Be.bumpmap,Be.normalmap,Be.displacementmap,Be.fog,{matcap:{value:null}}]),vertexShader:zt.meshmatcap_vert,fragmentShader:zt.meshmatcap_frag},points:{uniforms:Bs([Be.points,Be.fog]),vertexShader:zt.points_vert,fragmentShader:zt.points_frag},dashed:{uniforms:Bs([Be.common,Be.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:zt.linedashed_vert,fragmentShader:zt.linedashed_frag},depth:{uniforms:Bs([Be.common,Be.displacementmap]),vertexShader:zt.depth_vert,fragmentShader:zt.depth_frag},normal:{uniforms:Bs([Be.common,Be.bumpmap,Be.normalmap,Be.displacementmap,{opacity:{value:1}}]),vertexShader:zt.meshnormal_vert,fragmentShader:zt.meshnormal_frag},sprite:{uniforms:Bs([Be.sprite,Be.fog]),vertexShader:zt.sprite_vert,fragmentShader:zt.sprite_frag},background:{uniforms:{uvTransform:{value:new ut},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:zt.background_vert,fragmentShader:zt.background_frag},backgroundCube:{uniforms:{envMap:{value:null},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new ut}},vertexShader:zt.backgroundCube_vert,fragmentShader:zt.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:zt.cube_vert,fragmentShader:zt.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:zt.equirect_vert,fragmentShader:zt.equirect_frag},distance:{uniforms:Bs([Be.common,Be.displacementmap,{referencePosition:{value:new F},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:zt.distance_vert,fragmentShader:zt.distance_frag},shadow:{uniforms:Bs([Be.lights,Be.fog,{color:{value:new Ye(0)},opacity:{value:1}}]),vertexShader:zt.shadow_vert,fragmentShader:zt.shadow_frag}};On.physical={uniforms:Bs([On.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new ut},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new ut},clearcoatNormalScale:{value:new lt(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new ut},dispersion:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new ut},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new ut},sheen:{value:0},sheenColor:{value:new Ye(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new ut},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new ut},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new ut},transmissionSamplerSize:{value:new lt},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new ut},attenuationDistance:{value:0},attenuationColor:{value:new Ye(0)},specularColor:{value:new Ye(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new ut},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new ut},anisotropyVector:{value:new lt},anisotropyMap:{value:null},anisotropyMapTransform:{value:new ut}}]),vertexShader:zt.meshphysical_vert,fragmentShader:zt.meshphysical_frag};const yo={r:0,b:0,g:0},Zy=new Gt,sg=new ut;sg.set(-1,0,0,0,1,0,0,0,1);function Qy(n,e,t,s,i,r){const a=new Ye(0);let o=i===!0?0:1,l,c,d=null,u=0,h=null;function g(_){let O=_.isScene===!0?_.background:null;if(O&&O.isTexture){const w=_.backgroundBlurriness>0;O=e.get(O,w)}return O}function p(_){let O=!1;const w=g(_);w===null?m(a,o):w&&w.isColor&&(m(w,1),O=!0);const x=n.xr.getEnvironmentBlendMode();x==="additive"?t.buffers.color.setClear(0,0,0,1,r):x==="alpha-blend"&&t.buffers.color.setClear(0,0,0,0,r),(n.autoClear||O)&&(t.buffers.depth.setTest(!0),t.buffers.depth.setMask(!0),t.buffers.color.setMask(!0),n.clear(n.autoClearColor,n.autoClearDepth,n.autoClearStencil))}function z(_,O){const w=g(O);w&&(w.isCubeTexture||w.mapping===Ol)?(c===void 0&&(c=new Us(new ja(1,1,1),new hs({name:"BackgroundCubeMaterial",uniforms:Xr(On.backgroundCube.uniforms),vertexShader:On.backgroundCube.vertexShader,fragmentShader:On.backgroundCube.fragmentShader,side:ks,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),c.geometry.deleteAttribute("normal"),c.geometry.deleteAttribute("uv"),c.onBeforeRender=function(x,S,I){this.matrixWorld.copyPosition(I.matrixWorld)},Object.defineProperty(c.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),s.update(c)),c.material.uniforms.envMap.value=w,c.material.uniforms.backgroundBlurriness.value=O.backgroundBlurriness,c.material.uniforms.backgroundIntensity.value=O.backgroundIntensity,c.material.uniforms.backgroundRotation.value.setFromMatrix4(Zy.makeRotationFromEuler(O.backgroundRotation)).transpose(),w.isCubeTexture&&w.isRenderTargetTexture===!1&&c.material.uniforms.backgroundRotation.value.premultiply(sg),c.material.toneMapped=xt.getTransfer(w.colorSpace)!==kt,(d!==w||u!==w.version||h!==n.toneMapping)&&(c.material.needsUpdate=!0,d=w,u=w.version,h=n.toneMapping),c.layers.enableAll(),_.unshift(c,c.geometry,c.material,0,0,null)):w&&w.isTexture&&(l===void 0&&(l=new Us(new Al(2,2),new hs({name:"BackgroundMaterial",uniforms:Xr(On.background.uniforms),vertexShader:On.background.vertexShader,fragmentShader:On.background.fragmentShader,side:Ei,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),l.geometry.deleteAttribute("normal"),Object.defineProperty(l.material,"map",{get:function(){return this.uniforms.t2D.value}}),s.update(l)),l.material.uniforms.t2D.value=w,l.material.uniforms.backgroundIntensity.value=O.backgroundIntensity,l.material.toneMapped=xt.getTransfer(w.colorSpace)!==kt,w.matrixAutoUpdate===!0&&w.updateMatrix(),l.material.uniforms.uvTransform.value.copy(w.matrix),(d!==w||u!==w.version||h!==n.toneMapping)&&(l.material.needsUpdate=!0,d=w,u=w.version,h=n.toneMapping),l.layers.enableAll(),_.unshift(l,l.geometry,l.material,0,0,null))}function m(_,O){_.getRGB(yo,Qm(n)),t.buffers.color.setClear(yo.r,yo.g,yo.b,O,r)}function f(){c!==void 0&&(c.geometry.dispose(),c.material.dispose(),c=void 0),l!==void 0&&(l.geometry.dispose(),l.material.dispose(),l=void 0)}return{getClearColor:function(){return a},setClearColor:function(_,O=1){a.set(_),o=O,m(a,o)},getClearAlpha:function(){return o},setClearAlpha:function(_){o=_,m(a,o)},render:p,addToRenderList:z,dispose:f}}function Jy(n,e){const t=n.getParameter(n.MAX_VERTEX_ATTRIBS),s={},i=h(null);let r=i,a=!1;function o(N,k,L,j,P){let W=!1;const X=u(N,j,L,k);r!==X&&(r=X,c(r.object)),W=g(N,j,L,P),W&&p(N,j,L,P),P!==null&&e.update(P,n.ELEMENT_ARRAY_BUFFER),(W||a)&&(a=!1,w(N,k,L,j),P!==null&&n.bindBuffer(n.ELEMENT_ARRAY_BUFFER,e.get(P).buffer))}function l(){return n.createVertexArray()}function c(N){return n.bindVertexArray(N)}function d(N){return n.deleteVertexArray(N)}function u(N,k,L,j){const P=j.wireframe===!0;let W=s[k.id];W===void 0&&(W={},s[k.id]=W);const X=N.isInstancedMesh===!0?N.id:0;let Q=W[X];Q===void 0&&(Q={},W[X]=Q);let re=Q[L.id];re===void 0&&(re={},Q[L.id]=re);let Me=re[P];return Me===void 0&&(Me=h(l()),re[P]=Me),Me}function h(N){const k=[],L=[],j=[];for(let P=0;P<t;P++)k[P]=0,L[P]=0,j[P]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:k,enabledAttributes:L,attributeDivisors:j,object:N,attributes:{},index:null}}function g(N,k,L,j){const P=r.attributes,W=k.attributes;let X=0;const Q=L.getAttributes();for(const re in Q)if(Q[re].location>=0){const oe=P[re];let Oe=W[re];if(Oe===void 0&&(re==="instanceMatrix"&&N.instanceMatrix&&(Oe=N.instanceMatrix),re==="instanceColor"&&N.instanceColor&&(Oe=N.instanceColor)),oe===void 0||oe.attribute!==Oe||Oe&&oe.data!==Oe.data)return!0;X++}return r.attributesNum!==X||r.index!==j}function p(N,k,L,j){const P={},W=k.attributes;let X=0;const Q=L.getAttributes();for(const re in Q)if(Q[re].location>=0){let oe=W[re];oe===void 0&&(re==="instanceMatrix"&&N.instanceMatrix&&(oe=N.instanceMatrix),re==="instanceColor"&&N.instanceColor&&(oe=N.instanceColor));const Oe={};Oe.attribute=oe,oe&&oe.data&&(Oe.data=oe.data),P[re]=Oe,X++}r.attributes=P,r.attributesNum=X,r.index=j}function z(){const N=r.newAttributes;for(let k=0,L=N.length;k<L;k++)N[k]=0}function m(N){f(N,0)}function f(N,k){const L=r.newAttributes,j=r.enabledAttributes,P=r.attributeDivisors;L[N]=1,j[N]===0&&(n.enableVertexAttribArray(N),j[N]=1),P[N]!==k&&(n.vertexAttribDivisor(N,k),P[N]=k)}function _(){const N=r.newAttributes,k=r.enabledAttributes;for(let L=0,j=k.length;L<j;L++)k[L]!==N[L]&&(n.disableVertexAttribArray(L),k[L]=0)}function O(N,k,L,j,P,W,X){X===!0?n.vertexAttribIPointer(N,k,L,P,W):n.vertexAttribPointer(N,k,L,j,P,W)}function w(N,k,L,j){z();const P=j.attributes,W=L.getAttributes(),X=k.defaultAttributeValues;for(const Q in W){const re=W[Q];if(re.location>=0){let Me=P[Q];if(Me===void 0&&(Q==="instanceMatrix"&&N.instanceMatrix&&(Me=N.instanceMatrix),Q==="instanceColor"&&N.instanceColor&&(Me=N.instanceColor)),Me!==void 0){const oe=Me.normalized,Oe=Me.itemSize,Ke=e.get(Me);if(Ke===void 0)continue;const nt=Ke.buffer,je=Ke.type,ce=Ke.bytesPerElement,ue=je===n.INT||je===n.UNSIGNED_INT||Me.gpuType===pu;if(Me.isInterleavedBufferAttribute){const fe=Me.data,et=fe.stride,ct=Me.offset;if(fe.isInstancedInterleavedBuffer){for(let Qe=0;Qe<re.locationSize;Qe++)f(re.location+Qe,fe.meshPerAttribute);N.isInstancedMesh!==!0&&j._maxInstanceCount===void 0&&(j._maxInstanceCount=fe.meshPerAttribute*fe.count)}else for(let Qe=0;Qe<re.locationSize;Qe++)m(re.location+Qe);n.bindBuffer(n.ARRAY_BUFFER,nt);for(let Qe=0;Qe<re.locationSize;Qe++)O(re.location+Qe,Oe/re.locationSize,je,oe,et*ce,(ct+Oe/re.locationSize*Qe)*ce,ue)}else{if(Me.isInstancedBufferAttribute){for(let fe=0;fe<re.locationSize;fe++)f(re.location+fe,Me.meshPerAttribute);N.isInstancedMesh!==!0&&j._maxInstanceCount===void 0&&(j._maxInstanceCount=Me.meshPerAttribute*Me.count)}else for(let fe=0;fe<re.locationSize;fe++)m(re.location+fe);n.bindBuffer(n.ARRAY_BUFFER,nt);for(let fe=0;fe<re.locationSize;fe++)O(re.location+fe,Oe/re.locationSize,je,oe,Oe*ce,Oe/re.locationSize*fe*ce,ue)}}else if(X!==void 0){const oe=X[Q];if(oe!==void 0)switch(oe.length){case 2:n.vertexAttrib2fv(re.location,oe);break;case 3:n.vertexAttrib3fv(re.location,oe);break;case 4:n.vertexAttrib4fv(re.location,oe);break;default:n.vertexAttrib1fv(re.location,oe)}}}}_()}function x(){A();for(const N in s){const k=s[N];for(const L in k){const j=k[L];for(const P in j){const W=j[P];for(const X in W)d(W[X].object),delete W[X];delete j[P]}}delete s[N]}}function S(N){if(s[N.id]===void 0)return;const k=s[N.id];for(const L in k){const j=k[L];for(const P in j){const W=j[P];for(const X in W)d(W[X].object),delete W[X];delete j[P]}}delete s[N.id]}function I(N){for(const k in s){const L=s[k];for(const j in L){const P=L[j];if(P[N.id]===void 0)continue;const W=P[N.id];for(const X in W)d(W[X].object),delete W[X];delete P[N.id]}}}function b(N){for(const k in s){const L=s[k],j=N.isInstancedMesh===!0?N.id:0,P=L[j];if(P!==void 0){for(const W in P){const X=P[W];for(const Q in X)d(X[Q].object),delete X[Q];delete P[W]}delete L[j],Object.keys(L).length===0&&delete s[k]}}}function A(){B(),a=!0,r!==i&&(r=i,c(r.object))}function B(){i.geometry=null,i.program=null,i.wireframe=!1}return{setup:o,reset:A,resetDefaultState:B,dispose:x,releaseStatesOfGeometry:S,releaseStatesOfObject:b,releaseStatesOfProgram:I,initAttributes:z,enableAttribute:m,disableUnusedAttributes:_}}function ev(n,e,t){let s;function i(l){s=l}function r(l,c){n.drawArrays(s,l,c),t.update(c,s,1)}function a(l,c,d){d!==0&&(n.drawArraysInstanced(s,l,c,d),t.update(c,s,d))}function o(l,c,d){if(d===0)return;e.get("WEBGL_multi_draw").multiDrawArraysWEBGL(s,l,0,c,0,d);let h=0;for(let g=0;g<d;g++)h+=c[g];t.update(h,s,1)}this.setMode=i,this.render=r,this.renderInstances=a,this.renderMultiDraw=o}function tv(n,e,t,s){let i;function r(){if(i!==void 0)return i;if(e.has("EXT_texture_filter_anisotropic")===!0){const I=e.get("EXT_texture_filter_anisotropic");i=n.getParameter(I.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else i=0;return i}function a(I){return!(I!==bn&&s.convert(I)!==n.getParameter(n.IMPLEMENTATION_COLOR_READ_FORMAT))}function o(I){const b=I===ti&&(e.has("EXT_color_buffer_half_float")||e.has("EXT_color_buffer_float"));return!(I!==Zs&&s.convert(I)!==n.getParameter(n.IMPLEMENTATION_COLOR_READ_TYPE)&&I!==Mn&&!b)}function l(I){if(I==="highp"){if(n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.HIGH_FLOAT).precision>0&&n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.HIGH_FLOAT).precision>0)return"highp";I="mediump"}return I==="mediump"&&n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.MEDIUM_FLOAT).precision>0&&n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}let c=t.precision!==void 0?t.precision:"highp";const d=l(c);d!==c&&(st("WebGLRenderer:",c,"not supported, using",d,"instead."),c=d);const u=t.logarithmicDepthBuffer===!0,h=t.reversedDepthBuffer===!0&&e.has("EXT_clip_control");t.reversedDepthBuffer===!0&&h===!1&&st("WebGLRenderer: Unable to use reversed depth buffer due to missing EXT_clip_control extension. Fallback to default depth buffer.");const g=n.getParameter(n.MAX_TEXTURE_IMAGE_UNITS),p=n.getParameter(n.MAX_VERTEX_TEXTURE_IMAGE_UNITS),z=n.getParameter(n.MAX_TEXTURE_SIZE),m=n.getParameter(n.MAX_CUBE_MAP_TEXTURE_SIZE),f=n.getParameter(n.MAX_VERTEX_ATTRIBS),_=n.getParameter(n.MAX_VERTEX_UNIFORM_VECTORS),O=n.getParameter(n.MAX_VARYING_VECTORS),w=n.getParameter(n.MAX_FRAGMENT_UNIFORM_VECTORS),x=n.getParameter(n.MAX_SAMPLES),S=n.getParameter(n.SAMPLES);return{isWebGL2:!0,getMaxAnisotropy:r,getMaxPrecision:l,textureFormatReadable:a,textureTypeReadable:o,precision:c,logarithmicDepthBuffer:u,reversedDepthBuffer:h,maxTextures:g,maxVertexTextures:p,maxTextureSize:z,maxCubemapSize:m,maxAttributes:f,maxVertexUniforms:_,maxVaryings:O,maxFragmentUniforms:w,maxSamples:x,samples:S}}function sv(n){const e=this;let t=null,s=0,i=!1,r=!1;const a=new gi,o=new ut,l={value:null,needsUpdate:!1};this.uniform=l,this.numPlanes=0,this.numIntersection=0,this.init=function(u,h){const g=u.length!==0||h||s!==0||i;return i=h,s=u.length,g},this.beginShadows=function(){r=!0,d(null)},this.endShadows=function(){r=!1},this.setGlobalState=function(u,h){t=d(u,h,0)},this.setState=function(u,h,g){const p=u.clippingPlanes,z=u.clipIntersection,m=u.clipShadows,f=n.get(u);if(!i||p===null||p.length===0||r&&!m)r?d(null):c();else{const _=r?0:s,O=_*4;let w=f.clippingState||null;l.value=w,w=d(p,h,O,g);for(let x=0;x!==O;++x)w[x]=t[x];f.clippingState=w,this.numIntersection=z?this.numPlanes:0,this.numPlanes+=_}};function c(){l.value!==t&&(l.value=t,l.needsUpdate=s>0),e.numPlanes=s,e.numIntersection=0}function d(u,h,g,p){const z=u!==null?u.length:0;let m=null;if(z!==0){if(m=l.value,p!==!0||m===null){const f=g+z*4,_=h.matrixWorldInverse;o.getNormalMatrix(_),(m===null||m.length<f)&&(m=new Float32Array(f));for(let O=0,w=g;O!==z;++O,w+=4)a.copy(u[O]).applyMatrix4(_,o),a.normal.toArray(m,w),m[w+3]=a.constant}l.value=m,l.needsUpdate=!0}return e.numPlanes=z,e.numIntersection=0,m}}const _i=4,Qh=[.125,.215,.35,.446,.526,.582],ki=20,nv=256,za=new Ru,Jh=new Ye;let zc=null,_c=0,wc=0,yc=!1;const iv=new F;class ef{constructor(e){this._renderer=e,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._sizeLods=[],this._sigmas=[],this._lodMeshes=[],this._backgroundBox=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._blurMaterial=null,this._ggxMaterial=null}fromScene(e,t=0,s=.1,i=100,r={}){const{size:a=256,position:o=iv}=r;zc=this._renderer.getRenderTarget(),_c=this._renderer.getActiveCubeFace(),wc=this._renderer.getActiveMipmapLevel(),yc=this._renderer.xr.enabled,this._renderer.xr.enabled=!1,this._setSize(a);const l=this._allocateTargets();return l.depthBuffer=!0,this._sceneToCubeUV(e,s,i,l,o),t>0&&this._blur(l,0,0,t),this._applyPMREM(l),this._cleanup(l),l}fromEquirectangular(e,t=null){return this._fromTexture(e,t)}fromCubemap(e,t=null){return this._fromTexture(e,t)}compileCubemapShader(){this._cubemapMaterial===null&&(this._cubemapMaterial=nf(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=sf(),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(zc,_c,wc),this._renderer.xr.enabled=yc,e.scissorTest=!1,Er(e,0,0,e.width,e.height)}_fromTexture(e,t){e.mapping===Ji||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),zc=this._renderer.getRenderTarget(),_c=this._renderer.getActiveCubeFace(),wc=this._renderer.getActiveMipmapLevel(),yc=this._renderer.xr.enabled,this._renderer.xr.enabled=!1;const s=t||this._allocateTargets();return this._textureToCubeUV(e,s),this._applyPMREM(s),this._cleanup(s),s}_allocateTargets(){const e=3*Math.max(this._cubeSize,112),t=4*this._cubeSize,s={magFilter:Ds,minFilter:Ds,generateMipmaps:!1,type:ti,format:bn,colorSpace:dl,depthBuffer:!1},i=tf(e,t,s);if(this._pingPongRenderTarget===null||this._pingPongRenderTarget.width!==e||this._pingPongRenderTarget.height!==t){this._pingPongRenderTarget!==null&&this._dispose(),this._pingPongRenderTarget=tf(e,t,s);const{_lodMax:r}=this;({lodMeshes:this._lodMeshes,sizeLods:this._sizeLods,sigmas:this._sigmas}=rv(r)),this._blurMaterial=ov(r,e,t),this._ggxMaterial=av(r,e,t)}return i}_compileMaterial(e){const t=new Us(new ds,e);this._renderer.compile(t,za)}_sceneToCubeUV(e,t,s,i,r){const l=new nn(90,1,t,s),c=[1,-1,1,1,1,1],d=[1,1,1,-1,-1,-1],u=this._renderer,h=u.autoClear,g=u.toneMapping;u.getClearColor(Jh),u.toneMapping=Dn,u.autoClear=!1,u.state.buffers.depth.getReversed()&&(u.setRenderTarget(i),u.clearDepth(),u.setRenderTarget(null)),this._backgroundBox===null&&(this._backgroundBox=new Us(new ja,new Su({name:"PMREM.Background",side:ks,depthWrite:!1,depthTest:!1})));const z=this._backgroundBox,m=z.material;let f=!1;const _=e.background;_?_.isColor&&(m.color.copy(_),e.background=null,f=!0):(m.color.copy(Jh),f=!0);for(let O=0;O<6;O++){const w=O%3;w===0?(l.up.set(0,c[O],0),l.position.set(r.x,r.y,r.z),l.lookAt(r.x+d[O],r.y,r.z)):w===1?(l.up.set(0,0,c[O]),l.position.set(r.x,r.y,r.z),l.lookAt(r.x,r.y+d[O],r.z)):(l.up.set(0,c[O],0),l.position.set(r.x,r.y,r.z),l.lookAt(r.x,r.y,r.z+d[O]));const x=this._cubeSize;Er(i,w*x,O>2?x:0,x,x),u.setRenderTarget(i),f&&u.render(z,l),u.render(e,l)}u.toneMapping=g,u.autoClear=h,e.background=_}_textureToCubeUV(e,t){const s=this._renderer,i=e.mapping===Ji||e.mapping===Vr;i?(this._cubemapMaterial===null&&(this._cubemapMaterial=nf()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=sf());const r=i?this._cubemapMaterial:this._equirectMaterial,a=this._lodMeshes[0];a.material=r;const o=r.uniforms;o.envMap.value=e;const l=this._cubeSize;Er(t,0,0,3*l,2*l),s.setRenderTarget(t),s.render(a,za)}_applyPMREM(e){const t=this._renderer,s=t.autoClear;t.autoClear=!1;const i=this._lodMeshes.length;for(let r=1;r<i;r++)this._applyGGXFilter(e,r-1,r);t.autoClear=s}_applyGGXFilter(e,t,s){const i=this._renderer,r=this._pingPongRenderTarget,a=this._ggxMaterial,o=this._lodMeshes[s];o.material=a;const l=a.uniforms,c=s/(this._lodMeshes.length-1),d=t/(this._lodMeshes.length-1),u=Math.sqrt(c*c-d*d),h=0+c*1.25,g=u*h,{_lodMax:p}=this,z=this._sizeLods[s],m=3*z*(s>p-_i?s-p+_i:0),f=4*(this._cubeSize-z);l.envMap.value=e.texture,l.roughness.value=g,l.mipInt.value=p-t,Er(r,m,f,3*z,2*z),i.setRenderTarget(r),i.render(o,za),l.envMap.value=r.texture,l.roughness.value=0,l.mipInt.value=p-s,Er(e,m,f,3*z,2*z),i.setRenderTarget(e),i.render(o,za)}_blur(e,t,s,i,r){const a=this._pingPongRenderTarget;this._halfBlur(e,a,t,s,i,"latitudinal",r),this._halfBlur(a,e,s,s,i,"longitudinal",r)}_halfBlur(e,t,s,i,r,a,o){const l=this._renderer,c=this._blurMaterial;a!=="latitudinal"&&a!=="longitudinal"&&Ot("blur direction must be either latitudinal or longitudinal!");const d=3,u=this._lodMeshes[i];u.material=c;const h=c.uniforms,g=this._sizeLods[s]-1,p=isFinite(r)?Math.PI/(2*g):2*Math.PI/(2*ki-1),z=r/p,m=isFinite(r)?1+Math.floor(d*z):ki;m>ki&&st(`sigmaRadians, ${r}, is too large and will clip, as it requested ${m} samples when the maximum is set to ${ki}`);const f=[];let _=0;for(let I=0;I<ki;++I){const b=I/z,A=Math.exp(-b*b/2);f.push(A),I===0?_+=A:I<m&&(_+=2*A)}for(let I=0;I<f.length;I++)f[I]=f[I]/_;h.envMap.value=e.texture,h.samples.value=m,h.weights.value=f,h.latitudinal.value=a==="latitudinal",o&&(h.poleAxis.value=o);const{_lodMax:O}=this;h.dTheta.value=p,h.mipInt.value=O-s;const w=this._sizeLods[i],x=3*w*(i>O-_i?i-O+_i:0),S=4*(this._cubeSize-w);Er(t,x,S,3*w,2*w),l.setRenderTarget(t),l.render(u,za)}}function rv(n){const e=[],t=[],s=[];let i=n;const r=n-_i+1+Qh.length;for(let a=0;a<r;a++){const o=Math.pow(2,i);e.push(o);let l=1/o;a>n-_i?l=Qh[a-n+_i-1]:a===0&&(l=0),t.push(l);const c=1/(o-2),d=-c,u=1+c,h=[d,d,u,d,u,u,d,d,u,u,d,u],g=6,p=6,z=3,m=2,f=1,_=new Float32Array(z*p*g),O=new Float32Array(m*p*g),w=new Float32Array(f*p*g);for(let S=0;S<g;S++){const I=S%3*2/3-1,b=S>2?0:-1,A=[I,b,0,I+2/3,b,0,I+2/3,b+1,0,I,b,0,I+2/3,b+1,0,I,b+1,0];_.set(A,z*p*S),O.set(h,m*p*S);const B=[S,S,S,S,S,S];w.set(B,f*p*S)}const x=new ds;x.setAttribute("position",new ws(_,z)),x.setAttribute("uv",new ws(O,m)),x.setAttribute("faceIndex",new ws(w,f)),s.push(new Us(x,null)),i>_i&&i--}return{lodMeshes:s,sizeLods:e,sigmas:t}}function tf(n,e,t){const s=new In(n,e,t);return s.texture.mapping=Ol,s.texture.name="PMREM.cubeUv",s.scissorTest=!0,s}function Er(n,e,t,s,i){n.viewport.set(e,t,s,i),n.scissor.set(e,t,s,i)}function av(n,e,t){return new hs({name:"PMREMGGXConvolution",defines:{GGX_SAMPLES:nv,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/t,CUBEUV_MAX_MIP:`${n}.0`},uniforms:{envMap:{value:null},roughness:{value:0},mipInt:{value:0}},vertexShader:Dl(),fragmentShader:`
3673
3673
 
3674
3674
  precision highp float;
3675
3675
  precision highp int;
@@ -3773,7 +3773,7 @@ void main() {
3773
3773
 
3774
3774
  gl_FragColor = vec4(prefilteredColor, 1.0);
3775
3775
  }
3776
- `,blending:Zn,depthTest:!1,depthWrite:!1})}function ov(n,e,t){const s=new Float32Array(ki),i=new U(0,1,0);return new hs({name:"SphericalGaussianBlur",defines:{n:ki,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/t,CUBEUV_MAX_MIP:`${n}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:s},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:i}},vertexShader:Dl(),fragmentShader:`
3776
+ `,blending:Zn,depthTest:!1,depthWrite:!1})}function ov(n,e,t){const s=new Float32Array(ki),i=new F(0,1,0);return new hs({name:"SphericalGaussianBlur",defines:{n:ki,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/t,CUBEUV_MAX_MIP:`${n}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:s},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:i}},vertexShader:Dl(),fragmentShader:`
3777
3777
 
3778
3778
  precision mediump float;
3779
3779
  precision mediump int;
@@ -3958,7 +3958,7 @@ void main() {
3958
3958
  gl_FragColor = texture2D( tEquirect, sampleUV );
3959
3959
 
3960
3960
  }
3961
- `},i=new ja(5,5,5),r=new hs({name:"CubemapFromEquirect",uniforms:Xr(s.uniforms),vertexShader:s.vertexShader,fragmentShader:s.fragmentShader,side:ks,blending:Zn});r.uniforms.tEquirect.value=t;const a=new Us(i,r),o=t.minFilter;return t.minFilter===Fi&&(t.minFilter=Ds),new h_(1,10,this).update(e,a),t.minFilter=o,a.geometry.dispose(),a.material.dispose(),this}clear(e,t=!0,s=!0,i=!0){const r=e.getRenderTarget();for(let a=0;a<6;a++)e.setRenderTarget(this,a),e.clear(t,s,i);e.setRenderTarget(r)}}function lv(n){let e=new WeakMap,t=new WeakMap,s=null;function i(h,g=!1){return h==null?null:g?a(h):r(h)}function r(h){if(h&&h.isTexture){const g=h.mapping;if(g===jl||g===$l)if(e.has(h)){const p=e.get(h).texture;return o(p,h.mapping)}else{const p=h.image;if(p&&p.height>0){const z=new ng(p.height);return z.fromEquirectangularTexture(n,h),e.set(h,z),h.addEventListener("dispose",c),o(z.texture,h.mapping)}else return null}}return h}function a(h){if(h&&h.isTexture){const g=h.mapping,p=g===jl||g===$l,z=g===Ji||g===Vr;if(p||z){let m=t.get(h);const f=m!==void 0?m.texture.pmremVersion:0;if(h.isRenderTargetTexture&&h.pmremVersion!==f)return s===null&&(s=new ef(n)),m=p?s.fromEquirectangular(h,m):s.fromCubemap(h,m),m.texture.pmremVersion=h.pmremVersion,t.set(h,m),m.texture;if(m!==void 0)return m.texture;{const _=h.image;return p&&_&&_.height>0||z&&_&&l(_)?(s===null&&(s=new ef(n)),m=p?s.fromEquirectangular(h):s.fromCubemap(h),m.texture.pmremVersion=h.pmremVersion,t.set(h,m),h.addEventListener("dispose",d),m.texture):null}}}return h}function o(h,g){return g===jl?h.mapping=Ji:g===$l&&(h.mapping=Vr),h}function l(h){let g=0;const p=6;for(let z=0;z<p;z++)h[z]!==void 0&&g++;return g===p}function c(h){const g=h.target;g.removeEventListener("dispose",c);const p=e.get(g);p!==void 0&&(e.delete(g),p.dispose())}function d(h){const g=h.target;g.removeEventListener("dispose",d);const p=t.get(g);p!==void 0&&(t.delete(g),p.dispose())}function u(){e=new WeakMap,t=new WeakMap,s!==null&&(s.dispose(),s=null)}return{get:i,dispose:u}}function cv(n){const e={};function t(s){if(e[s]!==void 0)return e[s];const i=n.getExtension(s);return e[s]=i,i}return{has:function(s){return t(s)!==null},init:function(){t("EXT_color_buffer_float"),t("WEBGL_clip_cull_distance"),t("OES_texture_float_linear"),t("EXT_color_buffer_half_float"),t("WEBGL_multisampled_render_to_texture"),t("WEBGL_render_shared_exponent")},get:function(s){const i=t(s);return i===null&&Pr("WebGLRenderer: "+s+" extension not supported."),i}}}function dv(n,e,t,s){const i={},r=new WeakMap;function a(u){const h=u.target;h.index!==null&&e.remove(h.index);for(const p in h.attributes)e.remove(h.attributes[p]);h.removeEventListener("dispose",a),delete i[h.id];const g=r.get(h);g&&(e.remove(g),r.delete(h)),s.releaseStatesOfGeometry(h),h.isInstancedBufferGeometry===!0&&delete h._maxInstanceCount,t.memory.geometries--}function o(u,h){return i[h.id]===!0||(h.addEventListener("dispose",a),i[h.id]=!0,t.memory.geometries++),h}function l(u){const h=u.attributes;for(const g in h)e.update(h[g],n.ARRAY_BUFFER)}function c(u){const h=[],g=u.index,p=u.attributes.position;let z=0;if(p===void 0)return;if(g!==null){const _=g.array;z=g.version;for(let O=0,w=_.length;O<w;O+=3){const x=_[O+0],S=_[O+1],I=_[O+2];h.push(x,S,S,I,I,x)}}else{const _=p.array;z=p.version;for(let O=0,w=_.length/3-1;O<w;O+=3){const x=O+0,S=O+1,I=O+2;h.push(x,S,S,I,I,x)}}const m=new(p.count>=65535?Vm:$m)(h,1);m.version=z;const f=r.get(u);f&&e.remove(f),r.set(u,m)}function d(u){const h=r.get(u);if(h){const g=u.index;g!==null&&h.version<g.version&&c(u)}else c(u);return r.get(u)}return{get:o,update:l,getWireframeAttribute:d}}function uv(n,e,t){let s;function i(u){s=u}let r,a;function o(u){r=u.type,a=u.bytesPerElement}function l(u,h){n.drawElements(s,h,r,u*a),t.update(h,s,1)}function c(u,h,g){g!==0&&(n.drawElementsInstanced(s,h,r,u*a,g),t.update(h,s,g))}function d(u,h,g){if(g===0)return;e.get("WEBGL_multi_draw").multiDrawElementsWEBGL(s,h,0,r,u,0,g);let z=0;for(let m=0;m<g;m++)z+=h[m];t.update(z,s,1)}this.setMode=i,this.setIndex=o,this.render=l,this.renderInstances=c,this.renderMultiDraw=d}function hv(n){const e={geometries:0,textures:0},t={frame:0,calls:0,triangles:0,points:0,lines:0};function s(r,a,o){switch(t.calls++,a){case n.TRIANGLES:t.triangles+=o*(r/3);break;case n.LINES:t.lines+=o*(r/2);break;case n.LINE_STRIP:t.lines+=o*(r-1);break;case n.LINE_LOOP:t.lines+=o*r;break;case n.POINTS:t.points+=o*r;break;default:Ot("WebGLInfo: Unknown draw mode:",a);break}}function i(){t.calls=0,t.triangles=0,t.points=0,t.lines=0}return{memory:e,render:t,programs:null,autoReset:!0,reset:i,update:s}}function fv(n,e,t){const s=new WeakMap,i=new ts;function r(a,o,l){const c=a.morphTargetInfluences,d=o.morphAttributes.position||o.morphAttributes.normal||o.morphAttributes.color,u=d!==void 0?d.length:0;let h=s.get(o);if(h===void 0||h.count!==u){let A=function(){I.dispose(),s.delete(o),o.removeEventListener("dispose",A)};h!==void 0&&h.texture.dispose();const g=o.morphAttributes.position!==void 0,p=o.morphAttributes.normal!==void 0,z=o.morphAttributes.color!==void 0,m=o.morphAttributes.position||[],f=o.morphAttributes.normal||[],_=o.morphAttributes.color||[];let O=0;g===!0&&(O=1),p===!0&&(O=2),z===!0&&(O=3);let w=o.attributes.position.count*O,x=1;w>e.maxTextureSize&&(x=Math.ceil(w/e.maxTextureSize),w=e.maxTextureSize);const S=new Float32Array(w*x*4*u),I=new Fm(S,w,x,u);I.type=Mn,I.needsUpdate=!0;const b=O*4;for(let B=0;B<u;B++){const N=m[B],k=f[B],L=_[B],F=w*x*4*B;for(let P=0;P<N.count;P++){const W=P*b;g===!0&&(i.fromBufferAttribute(N,P),S[F+W+0]=i.x,S[F+W+1]=i.y,S[F+W+2]=i.z,S[F+W+3]=0),p===!0&&(i.fromBufferAttribute(k,P),S[F+W+4]=i.x,S[F+W+5]=i.y,S[F+W+6]=i.z,S[F+W+7]=0),z===!0&&(i.fromBufferAttribute(L,P),S[F+W+8]=i.x,S[F+W+9]=i.y,S[F+W+10]=i.z,S[F+W+11]=L.itemSize===4?i.w:1)}}h={count:u,texture:I,size:new lt(w,x)},s.set(o,h),o.addEventListener("dispose",A)}if(a.isInstancedMesh===!0&&a.morphTexture!==null)l.getUniforms().setValue(n,"morphTexture",a.morphTexture,t);else{let g=0;for(let z=0;z<c.length;z++)g+=c[z];const p=o.morphTargetsRelative?1:1-g;l.getUniforms().setValue(n,"morphTargetBaseInfluence",p),l.getUniforms().setValue(n,"morphTargetInfluences",c)}l.getUniforms().setValue(n,"morphTargetsTexture",h.texture,t),l.getUniforms().setValue(n,"morphTargetsTextureSize",h.size)}return{update:r}}function pv(n,e,t,s,i){let r=new WeakMap;function a(c){const d=i.render.frame,u=c.geometry,h=e.get(c,u);if(r.get(h)!==d&&(e.update(h),r.set(h,d)),c.isInstancedMesh&&(c.hasEventListener("dispose",l)===!1&&c.addEventListener("dispose",l),r.get(c)!==d&&(t.update(c.instanceMatrix,n.ARRAY_BUFFER),c.instanceColor!==null&&t.update(c.instanceColor,n.ARRAY_BUFFER),r.set(c,d))),c.isSkinnedMesh){const g=c.skeleton;r.get(g)!==d&&(g.update(),r.set(g,d))}return h}function o(){r=new WeakMap}function l(c){const d=c.target;d.removeEventListener("dispose",l),s.releaseStatesOfObject(d),t.remove(d.instanceMatrix),d.instanceColor!==null&&t.remove(d.instanceColor)}return{update:a,dispose:o}}const mv={[Am]:"LINEAR_TONE_MAPPING",[Em]:"REINHARD_TONE_MAPPING",[Dm]:"CINEON_TONE_MAPPING",[Im]:"ACES_FILMIC_TONE_MAPPING",[Gm]:"AGX_TONE_MAPPING",[Rm]:"NEUTRAL_TONE_MAPPING",[Tm]:"CUSTOM_TONE_MAPPING"};function gv(n,e,t,s,i,r){const a=new In(e,t,{type:n,depthBuffer:i,stencilBuffer:r,samples:s?4:0,depthTexture:i?new qr(e,t):void 0}),o=new In(e,t,{type:ti,depthBuffer:!1,stencilBuffer:!1}),l=new ds;l.setAttribute("position",new Xt([-1,3,0,-1,-1,0,3,-1,0],3)),l.setAttribute("uv",new Xt([0,2,0,0,2,0],2));const c=new i_({uniforms:{tDiffuse:{value:null}},vertexShader:`
3961
+ `},i=new ja(5,5,5),r=new hs({name:"CubemapFromEquirect",uniforms:Xr(s.uniforms),vertexShader:s.vertexShader,fragmentShader:s.fragmentShader,side:ks,blending:Zn});r.uniforms.tEquirect.value=t;const a=new Us(i,r),o=t.minFilter;return t.minFilter===Fi&&(t.minFilter=Ds),new h_(1,10,this).update(e,a),t.minFilter=o,a.geometry.dispose(),a.material.dispose(),this}clear(e,t=!0,s=!0,i=!0){const r=e.getRenderTarget();for(let a=0;a<6;a++)e.setRenderTarget(this,a),e.clear(t,s,i);e.setRenderTarget(r)}}function lv(n){let e=new WeakMap,t=new WeakMap,s=null;function i(h,g=!1){return h==null?null:g?a(h):r(h)}function r(h){if(h&&h.isTexture){const g=h.mapping;if(g===jl||g===$l)if(e.has(h)){const p=e.get(h).texture;return o(p,h.mapping)}else{const p=h.image;if(p&&p.height>0){const z=new ng(p.height);return z.fromEquirectangularTexture(n,h),e.set(h,z),h.addEventListener("dispose",c),o(z.texture,h.mapping)}else return null}}return h}function a(h){if(h&&h.isTexture){const g=h.mapping,p=g===jl||g===$l,z=g===Ji||g===Vr;if(p||z){let m=t.get(h);const f=m!==void 0?m.texture.pmremVersion:0;if(h.isRenderTargetTexture&&h.pmremVersion!==f)return s===null&&(s=new ef(n)),m=p?s.fromEquirectangular(h,m):s.fromCubemap(h,m),m.texture.pmremVersion=h.pmremVersion,t.set(h,m),m.texture;if(m!==void 0)return m.texture;{const _=h.image;return p&&_&&_.height>0||z&&_&&l(_)?(s===null&&(s=new ef(n)),m=p?s.fromEquirectangular(h):s.fromCubemap(h),m.texture.pmremVersion=h.pmremVersion,t.set(h,m),h.addEventListener("dispose",d),m.texture):null}}}return h}function o(h,g){return g===jl?h.mapping=Ji:g===$l&&(h.mapping=Vr),h}function l(h){let g=0;const p=6;for(let z=0;z<p;z++)h[z]!==void 0&&g++;return g===p}function c(h){const g=h.target;g.removeEventListener("dispose",c);const p=e.get(g);p!==void 0&&(e.delete(g),p.dispose())}function d(h){const g=h.target;g.removeEventListener("dispose",d);const p=t.get(g);p!==void 0&&(t.delete(g),p.dispose())}function u(){e=new WeakMap,t=new WeakMap,s!==null&&(s.dispose(),s=null)}return{get:i,dispose:u}}function cv(n){const e={};function t(s){if(e[s]!==void 0)return e[s];const i=n.getExtension(s);return e[s]=i,i}return{has:function(s){return t(s)!==null},init:function(){t("EXT_color_buffer_float"),t("WEBGL_clip_cull_distance"),t("OES_texture_float_linear"),t("EXT_color_buffer_half_float"),t("WEBGL_multisampled_render_to_texture"),t("WEBGL_render_shared_exponent")},get:function(s){const i=t(s);return i===null&&Pr("WebGLRenderer: "+s+" extension not supported."),i}}}function dv(n,e,t,s){const i={},r=new WeakMap;function a(u){const h=u.target;h.index!==null&&e.remove(h.index);for(const p in h.attributes)e.remove(h.attributes[p]);h.removeEventListener("dispose",a),delete i[h.id];const g=r.get(h);g&&(e.remove(g),r.delete(h)),s.releaseStatesOfGeometry(h),h.isInstancedBufferGeometry===!0&&delete h._maxInstanceCount,t.memory.geometries--}function o(u,h){return i[h.id]===!0||(h.addEventListener("dispose",a),i[h.id]=!0,t.memory.geometries++),h}function l(u){const h=u.attributes;for(const g in h)e.update(h[g],n.ARRAY_BUFFER)}function c(u){const h=[],g=u.index,p=u.attributes.position;let z=0;if(p===void 0)return;if(g!==null){const _=g.array;z=g.version;for(let O=0,w=_.length;O<w;O+=3){const x=_[O+0],S=_[O+1],I=_[O+2];h.push(x,S,S,I,I,x)}}else{const _=p.array;z=p.version;for(let O=0,w=_.length/3-1;O<w;O+=3){const x=O+0,S=O+1,I=O+2;h.push(x,S,S,I,I,x)}}const m=new(p.count>=65535?Vm:$m)(h,1);m.version=z;const f=r.get(u);f&&e.remove(f),r.set(u,m)}function d(u){const h=r.get(u);if(h){const g=u.index;g!==null&&h.version<g.version&&c(u)}else c(u);return r.get(u)}return{get:o,update:l,getWireframeAttribute:d}}function uv(n,e,t){let s;function i(u){s=u}let r,a;function o(u){r=u.type,a=u.bytesPerElement}function l(u,h){n.drawElements(s,h,r,u*a),t.update(h,s,1)}function c(u,h,g){g!==0&&(n.drawElementsInstanced(s,h,r,u*a,g),t.update(h,s,g))}function d(u,h,g){if(g===0)return;e.get("WEBGL_multi_draw").multiDrawElementsWEBGL(s,h,0,r,u,0,g);let z=0;for(let m=0;m<g;m++)z+=h[m];t.update(z,s,1)}this.setMode=i,this.setIndex=o,this.render=l,this.renderInstances=c,this.renderMultiDraw=d}function hv(n){const e={geometries:0,textures:0},t={frame:0,calls:0,triangles:0,points:0,lines:0};function s(r,a,o){switch(t.calls++,a){case n.TRIANGLES:t.triangles+=o*(r/3);break;case n.LINES:t.lines+=o*(r/2);break;case n.LINE_STRIP:t.lines+=o*(r-1);break;case n.LINE_LOOP:t.lines+=o*r;break;case n.POINTS:t.points+=o*r;break;default:Ot("WebGLInfo: Unknown draw mode:",a);break}}function i(){t.calls=0,t.triangles=0,t.points=0,t.lines=0}return{memory:e,render:t,programs:null,autoReset:!0,reset:i,update:s}}function fv(n,e,t){const s=new WeakMap,i=new ts;function r(a,o,l){const c=a.morphTargetInfluences,d=o.morphAttributes.position||o.morphAttributes.normal||o.morphAttributes.color,u=d!==void 0?d.length:0;let h=s.get(o);if(h===void 0||h.count!==u){let A=function(){I.dispose(),s.delete(o),o.removeEventListener("dispose",A)};h!==void 0&&h.texture.dispose();const g=o.morphAttributes.position!==void 0,p=o.morphAttributes.normal!==void 0,z=o.morphAttributes.color!==void 0,m=o.morphAttributes.position||[],f=o.morphAttributes.normal||[],_=o.morphAttributes.color||[];let O=0;g===!0&&(O=1),p===!0&&(O=2),z===!0&&(O=3);let w=o.attributes.position.count*O,x=1;w>e.maxTextureSize&&(x=Math.ceil(w/e.maxTextureSize),w=e.maxTextureSize);const S=new Float32Array(w*x*4*u),I=new Fm(S,w,x,u);I.type=Mn,I.needsUpdate=!0;const b=O*4;for(let B=0;B<u;B++){const N=m[B],k=f[B],L=_[B],j=w*x*4*B;for(let P=0;P<N.count;P++){const W=P*b;g===!0&&(i.fromBufferAttribute(N,P),S[j+W+0]=i.x,S[j+W+1]=i.y,S[j+W+2]=i.z,S[j+W+3]=0),p===!0&&(i.fromBufferAttribute(k,P),S[j+W+4]=i.x,S[j+W+5]=i.y,S[j+W+6]=i.z,S[j+W+7]=0),z===!0&&(i.fromBufferAttribute(L,P),S[j+W+8]=i.x,S[j+W+9]=i.y,S[j+W+10]=i.z,S[j+W+11]=L.itemSize===4?i.w:1)}}h={count:u,texture:I,size:new lt(w,x)},s.set(o,h),o.addEventListener("dispose",A)}if(a.isInstancedMesh===!0&&a.morphTexture!==null)l.getUniforms().setValue(n,"morphTexture",a.morphTexture,t);else{let g=0;for(let z=0;z<c.length;z++)g+=c[z];const p=o.morphTargetsRelative?1:1-g;l.getUniforms().setValue(n,"morphTargetBaseInfluence",p),l.getUniforms().setValue(n,"morphTargetInfluences",c)}l.getUniforms().setValue(n,"morphTargetsTexture",h.texture,t),l.getUniforms().setValue(n,"morphTargetsTextureSize",h.size)}return{update:r}}function pv(n,e,t,s,i){let r=new WeakMap;function a(c){const d=i.render.frame,u=c.geometry,h=e.get(c,u);if(r.get(h)!==d&&(e.update(h),r.set(h,d)),c.isInstancedMesh&&(c.hasEventListener("dispose",l)===!1&&c.addEventListener("dispose",l),r.get(c)!==d&&(t.update(c.instanceMatrix,n.ARRAY_BUFFER),c.instanceColor!==null&&t.update(c.instanceColor,n.ARRAY_BUFFER),r.set(c,d))),c.isSkinnedMesh){const g=c.skeleton;r.get(g)!==d&&(g.update(),r.set(g,d))}return h}function o(){r=new WeakMap}function l(c){const d=c.target;d.removeEventListener("dispose",l),s.releaseStatesOfObject(d),t.remove(d.instanceMatrix),d.instanceColor!==null&&t.remove(d.instanceColor)}return{update:a,dispose:o}}const mv={[Am]:"LINEAR_TONE_MAPPING",[Em]:"REINHARD_TONE_MAPPING",[Dm]:"CINEON_TONE_MAPPING",[Im]:"ACES_FILMIC_TONE_MAPPING",[Gm]:"AGX_TONE_MAPPING",[Rm]:"NEUTRAL_TONE_MAPPING",[Tm]:"CUSTOM_TONE_MAPPING"};function gv(n,e,t,s,i,r){const a=new In(e,t,{type:n,depthBuffer:i,stencilBuffer:r,samples:s?4:0,depthTexture:i?new qr(e,t):void 0}),o=new In(e,t,{type:ti,depthBuffer:!1,stencilBuffer:!1}),l=new ds;l.setAttribute("position",new Xt([-1,3,0,-1,-1,0,3,-1,0],3)),l.setAttribute("uv",new Xt([0,2,0,0,2,0],2));const c=new i_({uniforms:{tDiffuse:{value:null}},vertexShader:`
3962
3962
  precision highp float;
3963
3963
 
3964
3964
  uniform mat4 modelViewMatrix;
@@ -4011,7 +4011,7 @@ void main() {
4011
4011
  `+r+`
4012
4012
 
4013
4013
  `+cO(n.getShaderSource(e),o)}else return r}function uO(n,e){const t=dO(e);return[`vec4 ${n}( vec4 value ) {`,` return ${t[1]}( vec4( value.rgb * ${t[0]}, value.a ) );`,"}"].join(`
4014
- `)}const hO={[Am]:"Linear",[Em]:"Reinhard",[Dm]:"Cineon",[Im]:"ACESFilmic",[Gm]:"AgX",[Rm]:"Neutral",[Tm]:"Custom"};function fO(n,e){const t=hO[e];return t===void 0?(st("WebGLProgram: Unsupported toneMapping:",e),"vec3 "+n+"( vec3 color ) { return LinearToneMapping( color ); }"):"vec3 "+n+"( vec3 color ) { return "+t+"ToneMapping( color ); }"}const vo=new U;function pO(){xt.getLuminanceCoefficients(vo);const n=vo.x.toFixed(4),e=vo.y.toFixed(4),t=vo.z.toFixed(4);return["float luminance( const in vec3 rgb ) {",` const vec3 weights = vec3( ${n}, ${e}, ${t} );`," return dot( weights, rgb );","}"].join(`
4014
+ `)}const hO={[Am]:"Linear",[Em]:"Reinhard",[Dm]:"Cineon",[Im]:"ACESFilmic",[Gm]:"AgX",[Rm]:"Neutral",[Tm]:"Custom"};function fO(n,e){const t=hO[e];return t===void 0?(st("WebGLProgram: Unsupported toneMapping:",e),"vec3 "+n+"( vec3 color ) { return LinearToneMapping( color ); }"):"vec3 "+n+"( vec3 color ) { return "+t+"ToneMapping( color ); }"}const vo=new F;function pO(){xt.getLuminanceCoefficients(vo);const n=vo.x.toFixed(4),e=vo.y.toFixed(4),t=vo.z.toFixed(4);return["float luminance( const in vec3 rgb ) {",` const vec3 weights = vec3( ${n}, ${e}, ${t} );`," return dot( weights, rgb );","}"].join(`
4015
4015
  `)}function mO(n){return[n.extensionClipCullDistance?"#extension GL_ANGLE_clip_cull_distance : require":"",n.extensionMultiDraw?"#extension GL_ANGLE_multi_draw : require":""].filter(Ia).join(`
4016
4016
  `)}function gO(n){const e=[];for(const t in n){const s=n[t];s!==!1&&e.push("#define "+t+" "+s)}return e.join(`
4017
4017
  `)}function MO(n,e){const t={},s=n.getProgramParameter(e,n.ACTIVE_ATTRIBUTES);for(let i=0;i<s;i++){const r=n.getActiveAttrib(e,i),a=r.name;let o=1;r.type===n.FLOAT_MAT2&&(o=2),r.type===n.FLOAT_MAT3&&(o=3),r.type===n.FLOAT_MAT4&&(o=4),t[a]={type:r.type,location:n.getAttribLocation(e,a),locationSize:o}}return t}function Ia(n){return n!==""}function pf(n,e){const t=e.numSpotLightShadows+e.numSpotLightMaps-e.numSpotLightShadowsWithMaps;return n.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,t).replace(/NUM_RECT_AREA_LIGHTS/g,e.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g,e.numPointLights).replace(/NUM_HEMI_LIGHTS/g,e.numHemiLights).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 mf(n,e){return n.replace(/NUM_CLIPPING_PLANES/g,e.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,e.numClippingPlanes-e.numClipIntersection)}const bO=/^[ \t]*#include +<([\w\d./]+)>/gm;function tu(n){return n.replace(bO,_O)}const zO=new Map;function _O(n,e){let t=zt[e];if(t===void 0){const s=zO.get(e);if(s!==void 0)t=zt[s],st('WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',e,s);else throw new Error("THREE.WebGLProgram: Can not resolve #include <"+e+">")}return tu(t)}const wO=/#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 gf(n){return n.replace(wO,yO)}function yO(n,e,t,s){let i="";for(let r=parseInt(e);r<parseInt(t);r++)i+=s.replace(/\[\s*i\s*\]/g,"[ "+r+" ]").replace(/UNROLLED_LOOP_INDEX/g,r);return i}function Mf(n){let e=`precision ${n.precision} float;
@@ -4048,14 +4048,14 @@ void main() {
4048
4048
  `)+`
4049
4049
  `+m,f=["#define varying in",t.glslVersion===Mh?"":"layout(location = 0) out highp vec4 pc_fragColor;",t.glslVersion===Mh?"":"#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(`
4050
4050
  `)+`
4051
- `+f);const O=_+m+a,w=_+f+o,x=uf(i,i.VERTEX_SHADER,O),S=uf(i,i.FRAGMENT_SHADER,w);i.attachShader(z,x),i.attachShader(z,S),t.index0AttributeName!==void 0?i.bindAttribLocation(z,0,t.index0AttributeName):t.hasPositionAttribute===!0&&i.bindAttribLocation(z,0,"position"),i.linkProgram(z);function I(N){if(n.debug.checkShaderErrors){const k=i.getProgramInfoLog(z)||"",L=i.getShaderInfoLog(x)||"",F=i.getShaderInfoLog(S)||"",P=k.trim(),W=L.trim(),X=F.trim();let Q=!0,ie=!0;if(i.getProgramParameter(z,i.LINK_STATUS)===!1)if(Q=!1,typeof n.debug.onShaderError=="function")n.debug.onShaderError(i,z,x,S);else{const be=ff(i,x,"vertex"),ae=ff(i,S,"fragment");Ot("WebGLProgram: Shader Error "+i.getError()+" - VALIDATE_STATUS "+i.getProgramParameter(z,i.VALIDATE_STATUS)+`
4051
+ `+f);const O=_+m+a,w=_+f+o,x=uf(i,i.VERTEX_SHADER,O),S=uf(i,i.FRAGMENT_SHADER,w);i.attachShader(z,x),i.attachShader(z,S),t.index0AttributeName!==void 0?i.bindAttribLocation(z,0,t.index0AttributeName):t.hasPositionAttribute===!0&&i.bindAttribLocation(z,0,"position"),i.linkProgram(z);function I(N){if(n.debug.checkShaderErrors){const k=i.getProgramInfoLog(z)||"",L=i.getShaderInfoLog(x)||"",j=i.getShaderInfoLog(S)||"",P=k.trim(),W=L.trim(),X=j.trim();let Q=!0,re=!0;if(i.getProgramParameter(z,i.LINK_STATUS)===!1)if(Q=!1,typeof n.debug.onShaderError=="function")n.debug.onShaderError(i,z,x,S);else{const Me=ff(i,x,"vertex"),oe=ff(i,S,"fragment");Ot("WebGLProgram: Shader Error "+i.getError()+" - VALIDATE_STATUS "+i.getProgramParameter(z,i.VALIDATE_STATUS)+`
4052
4052
 
4053
4053
  Material Name: `+N.name+`
4054
4054
  Material Type: `+N.type+`
4055
4055
 
4056
4056
  Program Info Log: `+P+`
4057
- `+be+`
4058
- `+ae)}else P!==""?st("WebGLProgram: Program Info Log:",P):(W===""||X==="")&&(ie=!1);ie&&(N.diagnostics={runnable:Q,programLog:P,vertexShader:{log:W,prefix:m},fragmentShader:{log:X,prefix:f}})}i.deleteShader(x),i.deleteShader(S),b=new Fo(i,z),A=MO(i,z)}let b;this.getUniforms=function(){return b===void 0&&I(this),b};let A;this.getAttributes=function(){return A===void 0&&I(this),A};let B=t.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return B===!1&&(B=i.getProgramParameter(z,oO)),B},this.destroy=function(){s.releaseStatesOfProgram(this),i.deleteProgram(z),this.program=void 0},this.type=t.shaderType,this.name=t.shaderName,this.id=lO++,this.cacheKey=e,this.usedTimes=1,this.program=z,this.vertexShader=x,this.fragmentShader=S,this}let RO=0;class BO{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e,t,s){const i=this._getShaderCacheForMaterial(e);return i.has(t)===!1&&(i.add(t),t.usedTimes++),i.has(s)===!1&&(i.add(s),s.usedTimes++),this}remove(e){const t=this.materialCache.get(e);for(const s of t)s.usedTimes--,s.usedTimes===0&&this.shaderCache.delete(s.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 t=this.materialCache;let s=t.get(e);return s===void 0&&(s=new Set,t.set(e,s)),s}_getShaderStage(e){const t=this.shaderCache;let s=t.get(e);return s===void 0&&(s=new NO(e),t.set(e,s)),s}}class NO{constructor(e){this.id=RO++,this.code=e,this.usedTimes=0}}function CO(n){return n===er||n===ll||n===cl}function PO(n,e,t,s,i,r){const a=new Ou,o=new BO,l=new Set,c=[],d=new Map,u=s.logarithmicDepthBuffer;let h=s.precision;const g={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 p(b){return l.add(b),b===0?"uv":`uv${b}`}function z(b,A,B,N,k,L){const F=N.fog,P=k.geometry,W=b.isMeshStandardMaterial||b.isMeshLambertMaterial||b.isMeshPhongMaterial?N.environment:null,X=b.isMeshStandardMaterial||b.isMeshLambertMaterial&&!b.envMap||b.isMeshPhongMaterial&&!b.envMap,Q=e.get(b.envMap||W,X),ie=Q&&Q.mapping===Ol?Q.image.height:null,be=g[b.type];b.precision!==null&&(h=s.getMaxPrecision(b.precision),h!==b.precision&&st("WebGLProgram.getParameters:",b.precision,"not supported, using",h,"instead."));const ae=P.morphAttributes.position||P.morphAttributes.normal||P.morphAttributes.color,xe=ae!==void 0?ae.length:0;let Ze=0;P.morphAttributes.position!==void 0&&(Ze=1),P.morphAttributes.normal!==void 0&&(Ze=2),P.morphAttributes.color!==void 0&&(Ze=3);let nt,Ve,le,ue;if(be){const Ue=On[be];nt=Ue.vertexShader,Ve=Ue.fragmentShader}else{nt=b.vertexShader,Ve=b.fragmentShader;const Ue=o.getVertexShaderStage(b),Vt=o.getFragmentShaderStage(b);o.update(b,Ue,Vt),le=Ue.id,ue=Vt.id}const fe=n.getRenderTarget(),et=n.state.buffers.depth.getReversed(),ct=k.isInstancedMesh===!0,Qe=k.isBatchedMesh===!0,Zt=!!b.map,gt=!!b.matcap,Rt=!!Q,it=!!b.aoMap,yt=!!b.lightMap,ns=!!b.bumpMap&&b.wireframe===!1,Ut=!!b.normalMap,rs=!!b.displacementMap,as=!!b.emissiveMap,Qt=!!b.metalnessMap,es=!!b.roughnessMap,q=b.anisotropy>0,Os=b.clearcoat>0,Bt=b.dispersion>0,R=b.iridescence>0,y=b.sheen>0,K=b.transmission>0,se=q&&!!b.anisotropyMap,re=Os&&!!b.clearcoatMap,ve=Os&&!!b.clearcoatNormalMap,Ae=Os&&!!b.clearcoatRoughnessMap,oe=R&&!!b.iridescenceMap,he=R&&!!b.iridescenceThicknessMap,Se=y&&!!b.sheenColorMap,He=y&&!!b.sheenRoughnessMap,De=!!b.specularMap,Ie=!!b.specularColorMap,Xe=!!b.specularIntensityMap,Je=K&&!!b.transmissionMap,dt=K&&!!b.thicknessMap,V=!!b.gradientMap,Ee=!!b.alphaMap,ce=b.alphaTest>0,Te=!!b.alphaHash,Ne=!!b.extensions;let pe=Dn;b.toneMapped&&(fe===null||fe.isXRRenderTarget===!0)&&(pe=n.toneMapping);const Pe={shaderID:be,shaderType:b.type,shaderName:b.name,vertexShader:nt,fragmentShader:Ve,defines:b.defines,customVertexShaderID:le,customFragmentShaderID:ue,isRawShaderMaterial:b.isRawShaderMaterial===!0,glslVersion:b.glslVersion,precision:h,batching:Qe,batchingColor:Qe&&k._colorsTexture!==null,instancing:ct,instancingColor:ct&&k.instanceColor!==null,instancingMorph:ct&&k.morphTexture!==null,outputColorSpace:fe===null?n.outputColorSpace:fe.isXRRenderTarget===!0?fe.texture.colorSpace:xt.workingColorSpace,alphaToCoverage:!!b.alphaToCoverage,map:Zt,matcap:gt,envMap:Rt,envMapMode:Rt&&Q.mapping,envMapCubeUVHeight:ie,aoMap:it,lightMap:yt,bumpMap:ns,normalMap:Ut,displacementMap:rs,emissiveMap:as,normalMapObjectSpace:Ut&&b.normalMapType===mz,normalMapTangentSpace:Ut&&b.normalMapType===Xd,packedNormalMap:Ut&&b.normalMapType===Xd&&CO(b.normalMap.format),metalnessMap:Qt,roughnessMap:es,anisotropy:q,anisotropyMap:se,clearcoat:Os,clearcoatMap:re,clearcoatNormalMap:ve,clearcoatRoughnessMap:Ae,dispersion:Bt,iridescence:R,iridescenceMap:oe,iridescenceThicknessMap:he,sheen:y,sheenColorMap:Se,sheenRoughnessMap:He,specularMap:De,specularColorMap:Ie,specularIntensityMap:Xe,transmission:K,transmissionMap:Je,thicknessMap:dt,gradientMap:V,opaque:b.transparent===!1&&b.blending===$i&&b.alphaToCoverage===!1,alphaMap:Ee,alphaTest:ce,alphaHash:Te,combine:b.combine,mapUv:Zt&&p(b.map.channel),aoMapUv:it&&p(b.aoMap.channel),lightMapUv:yt&&p(b.lightMap.channel),bumpMapUv:ns&&p(b.bumpMap.channel),normalMapUv:Ut&&p(b.normalMap.channel),displacementMapUv:rs&&p(b.displacementMap.channel),emissiveMapUv:as&&p(b.emissiveMap.channel),metalnessMapUv:Qt&&p(b.metalnessMap.channel),roughnessMapUv:es&&p(b.roughnessMap.channel),anisotropyMapUv:se&&p(b.anisotropyMap.channel),clearcoatMapUv:re&&p(b.clearcoatMap.channel),clearcoatNormalMapUv:ve&&p(b.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:Ae&&p(b.clearcoatRoughnessMap.channel),iridescenceMapUv:oe&&p(b.iridescenceMap.channel),iridescenceThicknessMapUv:he&&p(b.iridescenceThicknessMap.channel),sheenColorMapUv:Se&&p(b.sheenColorMap.channel),sheenRoughnessMapUv:He&&p(b.sheenRoughnessMap.channel),specularMapUv:De&&p(b.specularMap.channel),specularColorMapUv:Ie&&p(b.specularColorMap.channel),specularIntensityMapUv:Xe&&p(b.specularIntensityMap.channel),transmissionMapUv:Je&&p(b.transmissionMap.channel),thicknessMapUv:dt&&p(b.thicknessMap.channel),alphaMapUv:Ee&&p(b.alphaMap.channel),vertexTangents:!!P.attributes.tangent&&(Ut||q),vertexNormals:!!P.attributes.normal,vertexColors:b.vertexColors,vertexAlphas:b.vertexColors===!0&&!!P.attributes.color&&P.attributes.color.itemSize===4,pointsUvs:k.isPoints===!0&&!!P.attributes.uv&&(Zt||Ee),fog:!!F,useFog:b.fog===!0,fogExp2:!!F&&F.isFogExp2,flatShading:b.wireframe===!1&&(b.flatShading===!0||P.attributes.normal===void 0&&Ut===!1&&(b.isMeshLambertMaterial||b.isMeshPhongMaterial||b.isMeshStandardMaterial||b.isMeshPhysicalMaterial)),sizeAttenuation:b.sizeAttenuation===!0,logarithmicDepthBuffer:u,reversedDepthBuffer:et,skinning:k.isSkinnedMesh===!0,hasPositionAttribute:P.attributes.position!==void 0,morphTargets:P.morphAttributes.position!==void 0,morphNormals:P.morphAttributes.normal!==void 0,morphColors:P.morphAttributes.color!==void 0,morphTargetsCount:xe,morphTextureStride:Ze,numDirLights:A.directional.length,numPointLights:A.point.length,numSpotLights:A.spot.length,numSpotLightMaps:A.spotLightMap.length,numRectAreaLights:A.rectArea.length,numHemiLights:A.hemi.length,numDirLightShadows:A.directionalShadowMap.length,numPointLightShadows:A.pointShadowMap.length,numSpotLightShadows:A.spotShadowMap.length,numSpotLightShadowsWithMaps:A.numSpotLightShadowsWithMaps,numLightProbes:A.numLightProbes,numLightProbeGrids:L.length,numClippingPlanes:r.numPlanes,numClipIntersection:r.numIntersection,dithering:b.dithering,shadowMapEnabled:n.shadowMap.enabled&&B.length>0,shadowMapType:n.shadowMap.type,toneMapping:pe,decodeVideoTexture:Zt&&b.map.isVideoTexture===!0&&xt.getTransfer(b.map.colorSpace)===kt,decodeVideoTextureEmissive:as&&b.emissiveMap.isVideoTexture===!0&&xt.getTransfer(b.emissiveMap.colorSpace)===kt,premultipliedAlpha:b.premultipliedAlpha,doubleSided:b.side===Hn,flipSided:b.side===ks,useDepthPacking:b.depthPacking>=0,depthPacking:b.depthPacking||0,index0AttributeName:b.index0AttributeName,extensionClipCullDistance:Ne&&b.extensions.clipCullDistance===!0&&t.has("WEBGL_clip_cull_distance"),extensionMultiDraw:(Ne&&b.extensions.multiDraw===!0||Qe)&&t.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:t.has("KHR_parallel_shader_compile"),customProgramCacheKey:b.customProgramCacheKey()};return Pe.vertexUv1s=l.has(1),Pe.vertexUv2s=l.has(2),Pe.vertexUv3s=l.has(3),l.clear(),Pe}function m(b){const A=[];if(b.shaderID?A.push(b.shaderID):(A.push(b.customVertexShaderID),A.push(b.customFragmentShaderID)),b.defines!==void 0)for(const B in b.defines)A.push(B),A.push(b.defines[B]);return b.isRawShaderMaterial===!1&&(f(A,b),_(A,b),A.push(n.outputColorSpace)),A.push(b.customProgramCacheKey),A.join()}function f(b,A){b.push(A.precision),b.push(A.outputColorSpace),b.push(A.envMapMode),b.push(A.envMapCubeUVHeight),b.push(A.mapUv),b.push(A.alphaMapUv),b.push(A.lightMapUv),b.push(A.aoMapUv),b.push(A.bumpMapUv),b.push(A.normalMapUv),b.push(A.displacementMapUv),b.push(A.emissiveMapUv),b.push(A.metalnessMapUv),b.push(A.roughnessMapUv),b.push(A.anisotropyMapUv),b.push(A.clearcoatMapUv),b.push(A.clearcoatNormalMapUv),b.push(A.clearcoatRoughnessMapUv),b.push(A.iridescenceMapUv),b.push(A.iridescenceThicknessMapUv),b.push(A.sheenColorMapUv),b.push(A.sheenRoughnessMapUv),b.push(A.specularMapUv),b.push(A.specularColorMapUv),b.push(A.specularIntensityMapUv),b.push(A.transmissionMapUv),b.push(A.thicknessMapUv),b.push(A.combine),b.push(A.fogExp2),b.push(A.sizeAttenuation),b.push(A.morphTargetsCount),b.push(A.morphAttributeCount),b.push(A.numDirLights),b.push(A.numPointLights),b.push(A.numSpotLights),b.push(A.numSpotLightMaps),b.push(A.numHemiLights),b.push(A.numRectAreaLights),b.push(A.numDirLightShadows),b.push(A.numPointLightShadows),b.push(A.numSpotLightShadows),b.push(A.numSpotLightShadowsWithMaps),b.push(A.numLightProbes),b.push(A.shadowMapType),b.push(A.toneMapping),b.push(A.numClippingPlanes),b.push(A.numClipIntersection),b.push(A.depthPacking)}function _(b,A){a.disableAll(),A.instancing&&a.enable(0),A.instancingColor&&a.enable(1),A.instancingMorph&&a.enable(2),A.matcap&&a.enable(3),A.envMap&&a.enable(4),A.normalMapObjectSpace&&a.enable(5),A.normalMapTangentSpace&&a.enable(6),A.clearcoat&&a.enable(7),A.iridescence&&a.enable(8),A.alphaTest&&a.enable(9),A.vertexColors&&a.enable(10),A.vertexAlphas&&a.enable(11),A.vertexUv1s&&a.enable(12),A.vertexUv2s&&a.enable(13),A.vertexUv3s&&a.enable(14),A.vertexTangents&&a.enable(15),A.anisotropy&&a.enable(16),A.alphaHash&&a.enable(17),A.batching&&a.enable(18),A.dispersion&&a.enable(19),A.batchingColor&&a.enable(20),A.gradientMap&&a.enable(21),A.packedNormalMap&&a.enable(22),A.vertexNormals&&a.enable(23),b.push(a.mask),a.disableAll(),A.fog&&a.enable(0),A.useFog&&a.enable(1),A.flatShading&&a.enable(2),A.logarithmicDepthBuffer&&a.enable(3),A.reversedDepthBuffer&&a.enable(4),A.skinning&&a.enable(5),A.morphTargets&&a.enable(6),A.morphNormals&&a.enable(7),A.morphColors&&a.enable(8),A.premultipliedAlpha&&a.enable(9),A.shadowMapEnabled&&a.enable(10),A.doubleSided&&a.enable(11),A.flipSided&&a.enable(12),A.useDepthPacking&&a.enable(13),A.dithering&&a.enable(14),A.transmission&&a.enable(15),A.sheen&&a.enable(16),A.opaque&&a.enable(17),A.pointsUvs&&a.enable(18),A.decodeVideoTexture&&a.enable(19),A.decodeVideoTextureEmissive&&a.enable(20),A.alphaToCoverage&&a.enable(21),A.numLightProbeGrids>0&&a.enable(22),A.hasPositionAttribute&&a.enable(23),b.push(a.mask)}function O(b){const A=g[b.type];let B;if(A){const N=On[A];B=t_.clone(N.uniforms)}else B=b.uniforms;return B}function w(b,A){let B=d.get(A);return B!==void 0?++B.usedTimes:(B=new GO(n,A,b,i),c.push(B),d.set(A,B)),B}function x(b){if(--b.usedTimes===0){const A=c.indexOf(b);c[A]=c[c.length-1],c.pop(),d.delete(b.cacheKey),b.destroy()}}function S(b){o.remove(b)}function I(){o.dispose()}return{getParameters:z,getProgramCacheKey:m,getUniforms:O,acquireProgram:w,releaseProgram:x,releaseShaderCache:S,programs:c,dispose:I}}function LO(){let n=new WeakMap;function e(a){return n.has(a)}function t(a){let o=n.get(a);return o===void 0&&(o={},n.set(a,o)),o}function s(a){n.delete(a)}function i(a,o,l){n.get(a)[o]=l}function r(){n=new WeakMap}return{has:e,get:t,remove:s,update:i,dispose:r}}function WO(n,e){return n.groupOrder!==e.groupOrder?n.groupOrder-e.groupOrder:n.renderOrder!==e.renderOrder?n.renderOrder-e.renderOrder:n.material.id!==e.material.id?n.material.id-e.material.id:n.materialVariant!==e.materialVariant?n.materialVariant-e.materialVariant:n.z!==e.z?n.z-e.z:n.id-e.id}function bf(n,e){return n.groupOrder!==e.groupOrder?n.groupOrder-e.groupOrder:n.renderOrder!==e.renderOrder?n.renderOrder-e.renderOrder:n.z!==e.z?e.z-n.z:n.id-e.id}function zf(){const n=[];let e=0;const t=[],s=[],i=[];function r(){e=0,t.length=0,s.length=0,i.length=0}function a(h){let g=0;return h.isInstancedMesh&&(g+=2),h.isSkinnedMesh&&(g+=1),g}function o(h,g,p,z,m,f){let _=n[e];return _===void 0?(_={id:h.id,object:h,geometry:g,material:p,materialVariant:a(h),groupOrder:z,renderOrder:h.renderOrder,z:m,group:f},n[e]=_):(_.id=h.id,_.object=h,_.geometry=g,_.material=p,_.materialVariant=a(h),_.groupOrder=z,_.renderOrder=h.renderOrder,_.z=m,_.group=f),e++,_}function l(h,g,p,z,m,f){const _=o(h,g,p,z,m,f);p.transmission>0?s.push(_):p.transparent===!0?i.push(_):t.push(_)}function c(h,g,p,z,m,f){const _=o(h,g,p,z,m,f);p.transmission>0?s.unshift(_):p.transparent===!0?i.unshift(_):t.unshift(_)}function d(h,g,p){t.length>1&&t.sort(h||WO),s.length>1&&s.sort(g||bf),i.length>1&&i.sort(g||bf),p&&(t.reverse(),s.reverse(),i.reverse())}function u(){for(let h=e,g=n.length;h<g;h++){const p=n[h];if(p.id===null)break;p.id=null,p.object=null,p.geometry=null,p.material=null,p.group=null}}return{opaque:t,transmissive:s,transparent:i,init:r,push:l,unshift:c,finish:u,sort:d}}function kO(){let n=new WeakMap;function e(s,i){const r=n.get(s);let a;return r===void 0?(a=new zf,n.set(s,[a])):i>=r.length?(a=new zf,r.push(a)):a=r[i],a}function t(){n=new WeakMap}return{get:e,dispose:t}}function UO(){const n={};return{get:function(e){if(n[e.id]!==void 0)return n[e.id];let t;switch(e.type){case"DirectionalLight":t={direction:new U,color:new Ke};break;case"SpotLight":t={position:new U,direction:new U,color:new Ke,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":t={position:new U,color:new Ke,distance:0,decay:0};break;case"HemisphereLight":t={direction:new U,skyColor:new Ke,groundColor:new Ke};break;case"RectAreaLight":t={color:new Ke,position:new U,halfWidth:new U,halfHeight:new U};break}return n[e.id]=t,t}}}function FO(){const n={};return{get:function(e){if(n[e.id]!==void 0)return n[e.id];let t;switch(e.type){case"DirectionalLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new lt};break;case"SpotLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new lt};break;case"PointLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new lt,shadowCameraNear:1,shadowCameraFar:1e3};break}return n[e.id]=t,t}}}let jO=0;function $O(n,e){return(e.castShadow?2:0)-(n.castShadow?2:0)+(e.map?1:0)-(n.map?1:0)}function VO(n){const e=new UO,t=FO(),s={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-1,numLightProbes:-1},ambient:[0,0,0],probe:[],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 c=0;c<9;c++)s.probe.push(new U);const i=new U,r=new Gt,a=new Gt;function o(c){let d=0,u=0,h=0;for(let A=0;A<9;A++)s.probe[A].set(0,0,0);let g=0,p=0,z=0,m=0,f=0,_=0,O=0,w=0,x=0,S=0,I=0;c.sort($O);for(let A=0,B=c.length;A<B;A++){const N=c[A],k=N.color,L=N.intensity,F=N.distance;let P=null;if(N.shadow&&N.shadow.map&&(N.shadow.map.texture.format===er?P=N.shadow.map.texture:P=N.shadow.map.depthTexture||N.shadow.map.texture),N.isAmbientLight)d+=k.r*L,u+=k.g*L,h+=k.b*L;else if(N.isLightProbe){for(let W=0;W<9;W++)s.probe[W].addScaledVector(N.sh.coefficients[W],L);I++}else if(N.isDirectionalLight){const W=e.get(N);if(W.color.copy(N.color).multiplyScalar(N.intensity),N.castShadow){const X=N.shadow,Q=t.get(N);Q.shadowIntensity=X.intensity,Q.shadowBias=X.bias,Q.shadowNormalBias=X.normalBias,Q.shadowRadius=X.radius,Q.shadowMapSize=X.mapSize,s.directionalShadow[g]=Q,s.directionalShadowMap[g]=P,s.directionalShadowMatrix[g]=N.shadow.matrix,_++}s.directional[g]=W,g++}else if(N.isSpotLight){const W=e.get(N);W.position.setFromMatrixPosition(N.matrixWorld),W.color.copy(k).multiplyScalar(L),W.distance=F,W.coneCos=Math.cos(N.angle),W.penumbraCos=Math.cos(N.angle*(1-N.penumbra)),W.decay=N.decay,s.spot[z]=W;const X=N.shadow;if(N.map&&(s.spotLightMap[x]=N.map,x++,X.updateMatrices(N),N.castShadow&&S++),s.spotLightMatrix[z]=X.matrix,N.castShadow){const Q=t.get(N);Q.shadowIntensity=X.intensity,Q.shadowBias=X.bias,Q.shadowNormalBias=X.normalBias,Q.shadowRadius=X.radius,Q.shadowMapSize=X.mapSize,s.spotShadow[z]=Q,s.spotShadowMap[z]=P,w++}z++}else if(N.isRectAreaLight){const W=e.get(N);W.color.copy(k).multiplyScalar(L),W.halfWidth.set(N.width*.5,0,0),W.halfHeight.set(0,N.height*.5,0),s.rectArea[m]=W,m++}else if(N.isPointLight){const W=e.get(N);if(W.color.copy(N.color).multiplyScalar(N.intensity),W.distance=N.distance,W.decay=N.decay,N.castShadow){const X=N.shadow,Q=t.get(N);Q.shadowIntensity=X.intensity,Q.shadowBias=X.bias,Q.shadowNormalBias=X.normalBias,Q.shadowRadius=X.radius,Q.shadowMapSize=X.mapSize,Q.shadowCameraNear=X.camera.near,Q.shadowCameraFar=X.camera.far,s.pointShadow[p]=Q,s.pointShadowMap[p]=P,s.pointShadowMatrix[p]=N.shadow.matrix,O++}s.point[p]=W,p++}else if(N.isHemisphereLight){const W=e.get(N);W.skyColor.copy(N.color).multiplyScalar(L),W.groundColor.copy(N.groundColor).multiplyScalar(L),s.hemi[f]=W,f++}}m>0&&(n.has("OES_texture_float_linear")===!0?(s.rectAreaLTC1=Be.LTC_FLOAT_1,s.rectAreaLTC2=Be.LTC_FLOAT_2):(s.rectAreaLTC1=Be.LTC_HALF_1,s.rectAreaLTC2=Be.LTC_HALF_2)),s.ambient[0]=d,s.ambient[1]=u,s.ambient[2]=h;const b=s.hash;(b.directionalLength!==g||b.pointLength!==p||b.spotLength!==z||b.rectAreaLength!==m||b.hemiLength!==f||b.numDirectionalShadows!==_||b.numPointShadows!==O||b.numSpotShadows!==w||b.numSpotMaps!==x||b.numLightProbes!==I)&&(s.directional.length=g,s.spot.length=z,s.rectArea.length=m,s.point.length=p,s.hemi.length=f,s.directionalShadow.length=_,s.directionalShadowMap.length=_,s.pointShadow.length=O,s.pointShadowMap.length=O,s.spotShadow.length=w,s.spotShadowMap.length=w,s.directionalShadowMatrix.length=_,s.pointShadowMatrix.length=O,s.spotLightMatrix.length=w+x-S,s.spotLightMap.length=x,s.numSpotLightShadowsWithMaps=S,s.numLightProbes=I,b.directionalLength=g,b.pointLength=p,b.spotLength=z,b.rectAreaLength=m,b.hemiLength=f,b.numDirectionalShadows=_,b.numPointShadows=O,b.numSpotShadows=w,b.numSpotMaps=x,b.numLightProbes=I,s.version=jO++)}function l(c,d){let u=0,h=0,g=0,p=0,z=0;const m=d.matrixWorldInverse;for(let f=0,_=c.length;f<_;f++){const O=c[f];if(O.isDirectionalLight){const w=s.directional[u];w.direction.setFromMatrixPosition(O.matrixWorld),i.setFromMatrixPosition(O.target.matrixWorld),w.direction.sub(i),w.direction.transformDirection(m),u++}else if(O.isSpotLight){const w=s.spot[g];w.position.setFromMatrixPosition(O.matrixWorld),w.position.applyMatrix4(m),w.direction.setFromMatrixPosition(O.matrixWorld),i.setFromMatrixPosition(O.target.matrixWorld),w.direction.sub(i),w.direction.transformDirection(m),g++}else if(O.isRectAreaLight){const w=s.rectArea[p];w.position.setFromMatrixPosition(O.matrixWorld),w.position.applyMatrix4(m),a.identity(),r.copy(O.matrixWorld),r.premultiply(m),a.extractRotation(r),w.halfWidth.set(O.width*.5,0,0),w.halfHeight.set(0,O.height*.5,0),w.halfWidth.applyMatrix4(a),w.halfHeight.applyMatrix4(a),p++}else if(O.isPointLight){const w=s.point[h];w.position.setFromMatrixPosition(O.matrixWorld),w.position.applyMatrix4(m),h++}else if(O.isHemisphereLight){const w=s.hemi[z];w.direction.setFromMatrixPosition(O.matrixWorld),w.direction.transformDirection(m),z++}}}return{setup:o,setupView:l,state:s}}function _f(n){const e=new VO(n),t=[],s=[],i=[];function r(h){u.camera=h,t.length=0,s.length=0,i.length=0}function a(h){t.push(h)}function o(h){s.push(h)}function l(h){i.push(h)}function c(){e.setup(t)}function d(h){e.setupView(t,h)}const u={lightsArray:t,shadowsArray:s,lightProbeGridArray:i,camera:null,lights:e,transmissionRenderTarget:{},textureUnits:0};return{init:r,state:u,setupLights:c,setupLightsView:d,pushLight:a,pushShadow:o,pushLightProbeGrid:l}}function HO(n){let e=new WeakMap;function t(i,r=0){const a=e.get(i);let o;return a===void 0?(o=new _f(n),e.set(i,[o])):r>=a.length?(o=new _f(n),a.push(o)):o=a[r],o}function s(){e=new WeakMap}return{get:t,dispose:s}}const qO=`void main() {
4057
+ `+Me+`
4058
+ `+oe)}else P!==""?st("WebGLProgram: Program Info Log:",P):(W===""||X==="")&&(re=!1);re&&(N.diagnostics={runnable:Q,programLog:P,vertexShader:{log:W,prefix:m},fragmentShader:{log:X,prefix:f}})}i.deleteShader(x),i.deleteShader(S),b=new Fo(i,z),A=MO(i,z)}let b;this.getUniforms=function(){return b===void 0&&I(this),b};let A;this.getAttributes=function(){return A===void 0&&I(this),A};let B=t.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return B===!1&&(B=i.getProgramParameter(z,oO)),B},this.destroy=function(){s.releaseStatesOfProgram(this),i.deleteProgram(z),this.program=void 0},this.type=t.shaderType,this.name=t.shaderName,this.id=lO++,this.cacheKey=e,this.usedTimes=1,this.program=z,this.vertexShader=x,this.fragmentShader=S,this}let RO=0;class BO{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e,t,s){const i=this._getShaderCacheForMaterial(e);return i.has(t)===!1&&(i.add(t),t.usedTimes++),i.has(s)===!1&&(i.add(s),s.usedTimes++),this}remove(e){const t=this.materialCache.get(e);for(const s of t)s.usedTimes--,s.usedTimes===0&&this.shaderCache.delete(s.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 t=this.materialCache;let s=t.get(e);return s===void 0&&(s=new Set,t.set(e,s)),s}_getShaderStage(e){const t=this.shaderCache;let s=t.get(e);return s===void 0&&(s=new NO(e),t.set(e,s)),s}}class NO{constructor(e){this.id=RO++,this.code=e,this.usedTimes=0}}function CO(n){return n===er||n===ll||n===cl}function PO(n,e,t,s,i,r){const a=new Ou,o=new BO,l=new Set,c=[],d=new Map,u=s.logarithmicDepthBuffer;let h=s.precision;const g={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 p(b){return l.add(b),b===0?"uv":`uv${b}`}function z(b,A,B,N,k,L){const j=N.fog,P=k.geometry,W=b.isMeshStandardMaterial||b.isMeshLambertMaterial||b.isMeshPhongMaterial?N.environment:null,X=b.isMeshStandardMaterial||b.isMeshLambertMaterial&&!b.envMap||b.isMeshPhongMaterial&&!b.envMap,Q=e.get(b.envMap||W,X),re=Q&&Q.mapping===Ol?Q.image.height:null,Me=g[b.type];b.precision!==null&&(h=s.getMaxPrecision(b.precision),h!==b.precision&&st("WebGLProgram.getParameters:",b.precision,"not supported, using",h,"instead."));const oe=P.morphAttributes.position||P.morphAttributes.normal||P.morphAttributes.color,Oe=oe!==void 0?oe.length:0;let Ke=0;P.morphAttributes.position!==void 0&&(Ke=1),P.morphAttributes.normal!==void 0&&(Ke=2),P.morphAttributes.color!==void 0&&(Ke=3);let nt,je,ce,ue;if(Me){const Ue=On[Me];nt=Ue.vertexShader,je=Ue.fragmentShader}else{nt=b.vertexShader,je=b.fragmentShader;const Ue=o.getVertexShaderStage(b),Vt=o.getFragmentShaderStage(b);o.update(b,Ue,Vt),ce=Ue.id,ue=Vt.id}const fe=n.getRenderTarget(),et=n.state.buffers.depth.getReversed(),ct=k.isInstancedMesh===!0,Qe=k.isBatchedMesh===!0,Zt=!!b.map,gt=!!b.matcap,Rt=!!Q,it=!!b.aoMap,wt=!!b.lightMap,ns=!!b.bumpMap&&b.wireframe===!1,Ut=!!b.normalMap,rs=!!b.displacementMap,as=!!b.emissiveMap,Qt=!!b.metalnessMap,es=!!b.roughnessMap,q=b.anisotropy>0,Os=b.clearcoat>0,Bt=b.dispersion>0,R=b.iridescence>0,y=b.sheen>0,K=b.transmission>0,se=q&&!!b.anisotropyMap,ae=Os&&!!b.clearcoatMap,ye=Os&&!!b.clearcoatNormalMap,Ae=Os&&!!b.clearcoatRoughnessMap,le=R&&!!b.iridescenceMap,he=R&&!!b.iridescenceThicknessMap,xe=y&&!!b.sheenColorMap,Ve=y&&!!b.sheenRoughnessMap,De=!!b.specularMap,Ie=!!b.specularColorMap,qe=!!b.specularIntensityMap,Je=K&&!!b.transmissionMap,dt=K&&!!b.thicknessMap,V=!!b.gradientMap,Ee=!!b.alphaMap,de=b.alphaTest>0,Te=!!b.alphaHash,Ne=!!b.extensions;let pe=Dn;b.toneMapped&&(fe===null||fe.isXRRenderTarget===!0)&&(pe=n.toneMapping);const Pe={shaderID:Me,shaderType:b.type,shaderName:b.name,vertexShader:nt,fragmentShader:je,defines:b.defines,customVertexShaderID:ce,customFragmentShaderID:ue,isRawShaderMaterial:b.isRawShaderMaterial===!0,glslVersion:b.glslVersion,precision:h,batching:Qe,batchingColor:Qe&&k._colorsTexture!==null,instancing:ct,instancingColor:ct&&k.instanceColor!==null,instancingMorph:ct&&k.morphTexture!==null,outputColorSpace:fe===null?n.outputColorSpace:fe.isXRRenderTarget===!0?fe.texture.colorSpace:xt.workingColorSpace,alphaToCoverage:!!b.alphaToCoverage,map:Zt,matcap:gt,envMap:Rt,envMapMode:Rt&&Q.mapping,envMapCubeUVHeight:re,aoMap:it,lightMap:wt,bumpMap:ns,normalMap:Ut,displacementMap:rs,emissiveMap:as,normalMapObjectSpace:Ut&&b.normalMapType===mz,normalMapTangentSpace:Ut&&b.normalMapType===Xd,packedNormalMap:Ut&&b.normalMapType===Xd&&CO(b.normalMap.format),metalnessMap:Qt,roughnessMap:es,anisotropy:q,anisotropyMap:se,clearcoat:Os,clearcoatMap:ae,clearcoatNormalMap:ye,clearcoatRoughnessMap:Ae,dispersion:Bt,iridescence:R,iridescenceMap:le,iridescenceThicknessMap:he,sheen:y,sheenColorMap:xe,sheenRoughnessMap:Ve,specularMap:De,specularColorMap:Ie,specularIntensityMap:qe,transmission:K,transmissionMap:Je,thicknessMap:dt,gradientMap:V,opaque:b.transparent===!1&&b.blending===$i&&b.alphaToCoverage===!1,alphaMap:Ee,alphaTest:de,alphaHash:Te,combine:b.combine,mapUv:Zt&&p(b.map.channel),aoMapUv:it&&p(b.aoMap.channel),lightMapUv:wt&&p(b.lightMap.channel),bumpMapUv:ns&&p(b.bumpMap.channel),normalMapUv:Ut&&p(b.normalMap.channel),displacementMapUv:rs&&p(b.displacementMap.channel),emissiveMapUv:as&&p(b.emissiveMap.channel),metalnessMapUv:Qt&&p(b.metalnessMap.channel),roughnessMapUv:es&&p(b.roughnessMap.channel),anisotropyMapUv:se&&p(b.anisotropyMap.channel),clearcoatMapUv:ae&&p(b.clearcoatMap.channel),clearcoatNormalMapUv:ye&&p(b.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:Ae&&p(b.clearcoatRoughnessMap.channel),iridescenceMapUv:le&&p(b.iridescenceMap.channel),iridescenceThicknessMapUv:he&&p(b.iridescenceThicknessMap.channel),sheenColorMapUv:xe&&p(b.sheenColorMap.channel),sheenRoughnessMapUv:Ve&&p(b.sheenRoughnessMap.channel),specularMapUv:De&&p(b.specularMap.channel),specularColorMapUv:Ie&&p(b.specularColorMap.channel),specularIntensityMapUv:qe&&p(b.specularIntensityMap.channel),transmissionMapUv:Je&&p(b.transmissionMap.channel),thicknessMapUv:dt&&p(b.thicknessMap.channel),alphaMapUv:Ee&&p(b.alphaMap.channel),vertexTangents:!!P.attributes.tangent&&(Ut||q),vertexNormals:!!P.attributes.normal,vertexColors:b.vertexColors,vertexAlphas:b.vertexColors===!0&&!!P.attributes.color&&P.attributes.color.itemSize===4,pointsUvs:k.isPoints===!0&&!!P.attributes.uv&&(Zt||Ee),fog:!!j,useFog:b.fog===!0,fogExp2:!!j&&j.isFogExp2,flatShading:b.wireframe===!1&&(b.flatShading===!0||P.attributes.normal===void 0&&Ut===!1&&(b.isMeshLambertMaterial||b.isMeshPhongMaterial||b.isMeshStandardMaterial||b.isMeshPhysicalMaterial)),sizeAttenuation:b.sizeAttenuation===!0,logarithmicDepthBuffer:u,reversedDepthBuffer:et,skinning:k.isSkinnedMesh===!0,hasPositionAttribute:P.attributes.position!==void 0,morphTargets:P.morphAttributes.position!==void 0,morphNormals:P.morphAttributes.normal!==void 0,morphColors:P.morphAttributes.color!==void 0,morphTargetsCount:Oe,morphTextureStride:Ke,numDirLights:A.directional.length,numPointLights:A.point.length,numSpotLights:A.spot.length,numSpotLightMaps:A.spotLightMap.length,numRectAreaLights:A.rectArea.length,numHemiLights:A.hemi.length,numDirLightShadows:A.directionalShadowMap.length,numPointLightShadows:A.pointShadowMap.length,numSpotLightShadows:A.spotShadowMap.length,numSpotLightShadowsWithMaps:A.numSpotLightShadowsWithMaps,numLightProbes:A.numLightProbes,numLightProbeGrids:L.length,numClippingPlanes:r.numPlanes,numClipIntersection:r.numIntersection,dithering:b.dithering,shadowMapEnabled:n.shadowMap.enabled&&B.length>0,shadowMapType:n.shadowMap.type,toneMapping:pe,decodeVideoTexture:Zt&&b.map.isVideoTexture===!0&&xt.getTransfer(b.map.colorSpace)===kt,decodeVideoTextureEmissive:as&&b.emissiveMap.isVideoTexture===!0&&xt.getTransfer(b.emissiveMap.colorSpace)===kt,premultipliedAlpha:b.premultipliedAlpha,doubleSided:b.side===Hn,flipSided:b.side===ks,useDepthPacking:b.depthPacking>=0,depthPacking:b.depthPacking||0,index0AttributeName:b.index0AttributeName,extensionClipCullDistance:Ne&&b.extensions.clipCullDistance===!0&&t.has("WEBGL_clip_cull_distance"),extensionMultiDraw:(Ne&&b.extensions.multiDraw===!0||Qe)&&t.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:t.has("KHR_parallel_shader_compile"),customProgramCacheKey:b.customProgramCacheKey()};return Pe.vertexUv1s=l.has(1),Pe.vertexUv2s=l.has(2),Pe.vertexUv3s=l.has(3),l.clear(),Pe}function m(b){const A=[];if(b.shaderID?A.push(b.shaderID):(A.push(b.customVertexShaderID),A.push(b.customFragmentShaderID)),b.defines!==void 0)for(const B in b.defines)A.push(B),A.push(b.defines[B]);return b.isRawShaderMaterial===!1&&(f(A,b),_(A,b),A.push(n.outputColorSpace)),A.push(b.customProgramCacheKey),A.join()}function f(b,A){b.push(A.precision),b.push(A.outputColorSpace),b.push(A.envMapMode),b.push(A.envMapCubeUVHeight),b.push(A.mapUv),b.push(A.alphaMapUv),b.push(A.lightMapUv),b.push(A.aoMapUv),b.push(A.bumpMapUv),b.push(A.normalMapUv),b.push(A.displacementMapUv),b.push(A.emissiveMapUv),b.push(A.metalnessMapUv),b.push(A.roughnessMapUv),b.push(A.anisotropyMapUv),b.push(A.clearcoatMapUv),b.push(A.clearcoatNormalMapUv),b.push(A.clearcoatRoughnessMapUv),b.push(A.iridescenceMapUv),b.push(A.iridescenceThicknessMapUv),b.push(A.sheenColorMapUv),b.push(A.sheenRoughnessMapUv),b.push(A.specularMapUv),b.push(A.specularColorMapUv),b.push(A.specularIntensityMapUv),b.push(A.transmissionMapUv),b.push(A.thicknessMapUv),b.push(A.combine),b.push(A.fogExp2),b.push(A.sizeAttenuation),b.push(A.morphTargetsCount),b.push(A.morphAttributeCount),b.push(A.numDirLights),b.push(A.numPointLights),b.push(A.numSpotLights),b.push(A.numSpotLightMaps),b.push(A.numHemiLights),b.push(A.numRectAreaLights),b.push(A.numDirLightShadows),b.push(A.numPointLightShadows),b.push(A.numSpotLightShadows),b.push(A.numSpotLightShadowsWithMaps),b.push(A.numLightProbes),b.push(A.shadowMapType),b.push(A.toneMapping),b.push(A.numClippingPlanes),b.push(A.numClipIntersection),b.push(A.depthPacking)}function _(b,A){a.disableAll(),A.instancing&&a.enable(0),A.instancingColor&&a.enable(1),A.instancingMorph&&a.enable(2),A.matcap&&a.enable(3),A.envMap&&a.enable(4),A.normalMapObjectSpace&&a.enable(5),A.normalMapTangentSpace&&a.enable(6),A.clearcoat&&a.enable(7),A.iridescence&&a.enable(8),A.alphaTest&&a.enable(9),A.vertexColors&&a.enable(10),A.vertexAlphas&&a.enable(11),A.vertexUv1s&&a.enable(12),A.vertexUv2s&&a.enable(13),A.vertexUv3s&&a.enable(14),A.vertexTangents&&a.enable(15),A.anisotropy&&a.enable(16),A.alphaHash&&a.enable(17),A.batching&&a.enable(18),A.dispersion&&a.enable(19),A.batchingColor&&a.enable(20),A.gradientMap&&a.enable(21),A.packedNormalMap&&a.enable(22),A.vertexNormals&&a.enable(23),b.push(a.mask),a.disableAll(),A.fog&&a.enable(0),A.useFog&&a.enable(1),A.flatShading&&a.enable(2),A.logarithmicDepthBuffer&&a.enable(3),A.reversedDepthBuffer&&a.enable(4),A.skinning&&a.enable(5),A.morphTargets&&a.enable(6),A.morphNormals&&a.enable(7),A.morphColors&&a.enable(8),A.premultipliedAlpha&&a.enable(9),A.shadowMapEnabled&&a.enable(10),A.doubleSided&&a.enable(11),A.flipSided&&a.enable(12),A.useDepthPacking&&a.enable(13),A.dithering&&a.enable(14),A.transmission&&a.enable(15),A.sheen&&a.enable(16),A.opaque&&a.enable(17),A.pointsUvs&&a.enable(18),A.decodeVideoTexture&&a.enable(19),A.decodeVideoTextureEmissive&&a.enable(20),A.alphaToCoverage&&a.enable(21),A.numLightProbeGrids>0&&a.enable(22),A.hasPositionAttribute&&a.enable(23),b.push(a.mask)}function O(b){const A=g[b.type];let B;if(A){const N=On[A];B=t_.clone(N.uniforms)}else B=b.uniforms;return B}function w(b,A){let B=d.get(A);return B!==void 0?++B.usedTimes:(B=new GO(n,A,b,i),c.push(B),d.set(A,B)),B}function x(b){if(--b.usedTimes===0){const A=c.indexOf(b);c[A]=c[c.length-1],c.pop(),d.delete(b.cacheKey),b.destroy()}}function S(b){o.remove(b)}function I(){o.dispose()}return{getParameters:z,getProgramCacheKey:m,getUniforms:O,acquireProgram:w,releaseProgram:x,releaseShaderCache:S,programs:c,dispose:I}}function LO(){let n=new WeakMap;function e(a){return n.has(a)}function t(a){let o=n.get(a);return o===void 0&&(o={},n.set(a,o)),o}function s(a){n.delete(a)}function i(a,o,l){n.get(a)[o]=l}function r(){n=new WeakMap}return{has:e,get:t,remove:s,update:i,dispose:r}}function WO(n,e){return n.groupOrder!==e.groupOrder?n.groupOrder-e.groupOrder:n.renderOrder!==e.renderOrder?n.renderOrder-e.renderOrder:n.material.id!==e.material.id?n.material.id-e.material.id:n.materialVariant!==e.materialVariant?n.materialVariant-e.materialVariant:n.z!==e.z?n.z-e.z:n.id-e.id}function bf(n,e){return n.groupOrder!==e.groupOrder?n.groupOrder-e.groupOrder:n.renderOrder!==e.renderOrder?n.renderOrder-e.renderOrder:n.z!==e.z?e.z-n.z:n.id-e.id}function zf(){const n=[];let e=0;const t=[],s=[],i=[];function r(){e=0,t.length=0,s.length=0,i.length=0}function a(h){let g=0;return h.isInstancedMesh&&(g+=2),h.isSkinnedMesh&&(g+=1),g}function o(h,g,p,z,m,f){let _=n[e];return _===void 0?(_={id:h.id,object:h,geometry:g,material:p,materialVariant:a(h),groupOrder:z,renderOrder:h.renderOrder,z:m,group:f},n[e]=_):(_.id=h.id,_.object=h,_.geometry=g,_.material=p,_.materialVariant=a(h),_.groupOrder=z,_.renderOrder=h.renderOrder,_.z=m,_.group=f),e++,_}function l(h,g,p,z,m,f){const _=o(h,g,p,z,m,f);p.transmission>0?s.push(_):p.transparent===!0?i.push(_):t.push(_)}function c(h,g,p,z,m,f){const _=o(h,g,p,z,m,f);p.transmission>0?s.unshift(_):p.transparent===!0?i.unshift(_):t.unshift(_)}function d(h,g,p){t.length>1&&t.sort(h||WO),s.length>1&&s.sort(g||bf),i.length>1&&i.sort(g||bf),p&&(t.reverse(),s.reverse(),i.reverse())}function u(){for(let h=e,g=n.length;h<g;h++){const p=n[h];if(p.id===null)break;p.id=null,p.object=null,p.geometry=null,p.material=null,p.group=null}}return{opaque:t,transmissive:s,transparent:i,init:r,push:l,unshift:c,finish:u,sort:d}}function kO(){let n=new WeakMap;function e(s,i){const r=n.get(s);let a;return r===void 0?(a=new zf,n.set(s,[a])):i>=r.length?(a=new zf,r.push(a)):a=r[i],a}function t(){n=new WeakMap}return{get:e,dispose:t}}function UO(){const n={};return{get:function(e){if(n[e.id]!==void 0)return n[e.id];let t;switch(e.type){case"DirectionalLight":t={direction:new F,color:new Ye};break;case"SpotLight":t={position:new F,direction:new F,color:new Ye,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":t={position:new F,color:new Ye,distance:0,decay:0};break;case"HemisphereLight":t={direction:new F,skyColor:new Ye,groundColor:new Ye};break;case"RectAreaLight":t={color:new Ye,position:new F,halfWidth:new F,halfHeight:new F};break}return n[e.id]=t,t}}}function FO(){const n={};return{get:function(e){if(n[e.id]!==void 0)return n[e.id];let t;switch(e.type){case"DirectionalLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new lt};break;case"SpotLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new lt};break;case"PointLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new lt,shadowCameraNear:1,shadowCameraFar:1e3};break}return n[e.id]=t,t}}}let jO=0;function $O(n,e){return(e.castShadow?2:0)-(n.castShadow?2:0)+(e.map?1:0)-(n.map?1:0)}function VO(n){const e=new UO,t=FO(),s={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-1,numLightProbes:-1},ambient:[0,0,0],probe:[],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 c=0;c<9;c++)s.probe.push(new F);const i=new F,r=new Gt,a=new Gt;function o(c){let d=0,u=0,h=0;for(let A=0;A<9;A++)s.probe[A].set(0,0,0);let g=0,p=0,z=0,m=0,f=0,_=0,O=0,w=0,x=0,S=0,I=0;c.sort($O);for(let A=0,B=c.length;A<B;A++){const N=c[A],k=N.color,L=N.intensity,j=N.distance;let P=null;if(N.shadow&&N.shadow.map&&(N.shadow.map.texture.format===er?P=N.shadow.map.texture:P=N.shadow.map.depthTexture||N.shadow.map.texture),N.isAmbientLight)d+=k.r*L,u+=k.g*L,h+=k.b*L;else if(N.isLightProbe){for(let W=0;W<9;W++)s.probe[W].addScaledVector(N.sh.coefficients[W],L);I++}else if(N.isDirectionalLight){const W=e.get(N);if(W.color.copy(N.color).multiplyScalar(N.intensity),N.castShadow){const X=N.shadow,Q=t.get(N);Q.shadowIntensity=X.intensity,Q.shadowBias=X.bias,Q.shadowNormalBias=X.normalBias,Q.shadowRadius=X.radius,Q.shadowMapSize=X.mapSize,s.directionalShadow[g]=Q,s.directionalShadowMap[g]=P,s.directionalShadowMatrix[g]=N.shadow.matrix,_++}s.directional[g]=W,g++}else if(N.isSpotLight){const W=e.get(N);W.position.setFromMatrixPosition(N.matrixWorld),W.color.copy(k).multiplyScalar(L),W.distance=j,W.coneCos=Math.cos(N.angle),W.penumbraCos=Math.cos(N.angle*(1-N.penumbra)),W.decay=N.decay,s.spot[z]=W;const X=N.shadow;if(N.map&&(s.spotLightMap[x]=N.map,x++,X.updateMatrices(N),N.castShadow&&S++),s.spotLightMatrix[z]=X.matrix,N.castShadow){const Q=t.get(N);Q.shadowIntensity=X.intensity,Q.shadowBias=X.bias,Q.shadowNormalBias=X.normalBias,Q.shadowRadius=X.radius,Q.shadowMapSize=X.mapSize,s.spotShadow[z]=Q,s.spotShadowMap[z]=P,w++}z++}else if(N.isRectAreaLight){const W=e.get(N);W.color.copy(k).multiplyScalar(L),W.halfWidth.set(N.width*.5,0,0),W.halfHeight.set(0,N.height*.5,0),s.rectArea[m]=W,m++}else if(N.isPointLight){const W=e.get(N);if(W.color.copy(N.color).multiplyScalar(N.intensity),W.distance=N.distance,W.decay=N.decay,N.castShadow){const X=N.shadow,Q=t.get(N);Q.shadowIntensity=X.intensity,Q.shadowBias=X.bias,Q.shadowNormalBias=X.normalBias,Q.shadowRadius=X.radius,Q.shadowMapSize=X.mapSize,Q.shadowCameraNear=X.camera.near,Q.shadowCameraFar=X.camera.far,s.pointShadow[p]=Q,s.pointShadowMap[p]=P,s.pointShadowMatrix[p]=N.shadow.matrix,O++}s.point[p]=W,p++}else if(N.isHemisphereLight){const W=e.get(N);W.skyColor.copy(N.color).multiplyScalar(L),W.groundColor.copy(N.groundColor).multiplyScalar(L),s.hemi[f]=W,f++}}m>0&&(n.has("OES_texture_float_linear")===!0?(s.rectAreaLTC1=Be.LTC_FLOAT_1,s.rectAreaLTC2=Be.LTC_FLOAT_2):(s.rectAreaLTC1=Be.LTC_HALF_1,s.rectAreaLTC2=Be.LTC_HALF_2)),s.ambient[0]=d,s.ambient[1]=u,s.ambient[2]=h;const b=s.hash;(b.directionalLength!==g||b.pointLength!==p||b.spotLength!==z||b.rectAreaLength!==m||b.hemiLength!==f||b.numDirectionalShadows!==_||b.numPointShadows!==O||b.numSpotShadows!==w||b.numSpotMaps!==x||b.numLightProbes!==I)&&(s.directional.length=g,s.spot.length=z,s.rectArea.length=m,s.point.length=p,s.hemi.length=f,s.directionalShadow.length=_,s.directionalShadowMap.length=_,s.pointShadow.length=O,s.pointShadowMap.length=O,s.spotShadow.length=w,s.spotShadowMap.length=w,s.directionalShadowMatrix.length=_,s.pointShadowMatrix.length=O,s.spotLightMatrix.length=w+x-S,s.spotLightMap.length=x,s.numSpotLightShadowsWithMaps=S,s.numLightProbes=I,b.directionalLength=g,b.pointLength=p,b.spotLength=z,b.rectAreaLength=m,b.hemiLength=f,b.numDirectionalShadows=_,b.numPointShadows=O,b.numSpotShadows=w,b.numSpotMaps=x,b.numLightProbes=I,s.version=jO++)}function l(c,d){let u=0,h=0,g=0,p=0,z=0;const m=d.matrixWorldInverse;for(let f=0,_=c.length;f<_;f++){const O=c[f];if(O.isDirectionalLight){const w=s.directional[u];w.direction.setFromMatrixPosition(O.matrixWorld),i.setFromMatrixPosition(O.target.matrixWorld),w.direction.sub(i),w.direction.transformDirection(m),u++}else if(O.isSpotLight){const w=s.spot[g];w.position.setFromMatrixPosition(O.matrixWorld),w.position.applyMatrix4(m),w.direction.setFromMatrixPosition(O.matrixWorld),i.setFromMatrixPosition(O.target.matrixWorld),w.direction.sub(i),w.direction.transformDirection(m),g++}else if(O.isRectAreaLight){const w=s.rectArea[p];w.position.setFromMatrixPosition(O.matrixWorld),w.position.applyMatrix4(m),a.identity(),r.copy(O.matrixWorld),r.premultiply(m),a.extractRotation(r),w.halfWidth.set(O.width*.5,0,0),w.halfHeight.set(0,O.height*.5,0),w.halfWidth.applyMatrix4(a),w.halfHeight.applyMatrix4(a),p++}else if(O.isPointLight){const w=s.point[h];w.position.setFromMatrixPosition(O.matrixWorld),w.position.applyMatrix4(m),h++}else if(O.isHemisphereLight){const w=s.hemi[z];w.direction.setFromMatrixPosition(O.matrixWorld),w.direction.transformDirection(m),z++}}}return{setup:o,setupView:l,state:s}}function _f(n){const e=new VO(n),t=[],s=[],i=[];function r(h){u.camera=h,t.length=0,s.length=0,i.length=0}function a(h){t.push(h)}function o(h){s.push(h)}function l(h){i.push(h)}function c(){e.setup(t)}function d(h){e.setupView(t,h)}const u={lightsArray:t,shadowsArray:s,lightProbeGridArray:i,camera:null,lights:e,transmissionRenderTarget:{},textureUnits:0};return{init:r,state:u,setupLights:c,setupLightsView:d,pushLight:a,pushShadow:o,pushLightProbeGrid:l}}function HO(n){let e=new WeakMap;function t(i,r=0){const a=e.get(i);let o;return a===void 0?(o=new _f(n),e.set(i,[o])):r>=a.length?(o=new _f(n),a.push(o)):o=a[r],o}function s(){e=new WeakMap}return{get:t,dispose:s}}const qO=`void main() {
4059
4059
  gl_Position = vec4( position, 1.0 );
4060
4060
  }`,XO=`uniform sampler2D shadow_pass;
4061
4061
  uniform vec2 resolution;
@@ -4082,7 +4082,7 @@ void main() {
4082
4082
  squared_mean = squared_mean / samples;
4083
4083
  float std_dev = sqrt( max( 0.0, squared_mean - mean * mean ) );
4084
4084
  gl_FragColor = vec4( mean, std_dev, 0.0, 1.0 );
4085
- }`,YO=[new U(1,0,0),new U(-1,0,0),new U(0,1,0),new U(0,-1,0),new U(0,0,1),new U(0,0,-1)],KO=[new U(0,-1,0),new U(0,-1,0),new U(0,0,1),new U(0,0,-1),new U(0,-1,0),new U(0,-1,0)],wf=new Gt,_a=new U,Oc=new U;function ZO(n,e,t){let s=new Eu;const i=new lt,r=new lt,a=new ts,o=new r_,l=new a_,c={},d=t.maxTextureSize,u={[Ei]:ks,[ks]:Ei,[Hn]:Hn},h=new hs({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new lt},radius:{value:4}},vertexShader:qO,fragmentShader:XO}),g=h.clone();g.defines.HORIZONTAL_PASS=1;const p=new ds;p.setAttribute("position",new ws(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const z=new Us(p,h),m=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=Po;let f=this.type;this.render=function(S,I,b){if(m.enabled===!1||m.autoUpdate===!1&&m.needsUpdate===!1||S.length===0)return;this.type===H0&&(st("WebGLShadowMap: PCFSoftShadowMap has been deprecated. Using PCFShadowMap instead."),this.type=Po);const A=n.getRenderTarget(),B=n.getActiveCubeFace(),N=n.getActiveMipmapLevel(),k=n.state;k.setBlending(Zn),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 L=f!==this.type;L&&I.traverse(function(F){F.material&&(Array.isArray(F.material)?F.material.forEach(P=>P.needsUpdate=!0):F.material.needsUpdate=!0)});for(let F=0,P=S.length;F<P;F++){const W=S[F],X=W.shadow;if(X===void 0){st("WebGLShadowMap:",W,"has no shadow.");continue}if(X.autoUpdate===!1&&X.needsUpdate===!1)continue;i.copy(X.mapSize);const Q=X.getFrameExtents();i.multiply(Q),r.copy(X.mapSize),(i.x>d||i.y>d)&&(i.x>d&&(r.x=Math.floor(d/Q.x),i.x=r.x*Q.x,X.mapSize.x=r.x),i.y>d&&(r.y=Math.floor(d/Q.y),i.y=r.y*Q.y,X.mapSize.y=r.y));const ie=n.state.buffers.depth.getReversed();if(X.camera._reversedDepth=ie,X.map===null||L===!0){if(X.map!==null&&(X.map.depthTexture!==null&&(X.map.depthTexture.dispose(),X.map.depthTexture=null),X.map.dispose()),this.type===Ea){if(W.isPointLight){st("WebGLShadowMap: VSM shadow maps are not supported for PointLights. Use PCF or BasicShadowMap instead.");continue}X.map=new In(i.x,i.y,{format:er,type:ti,minFilter:Ds,magFilter:Ds,generateMipmaps:!1}),X.map.texture.name=W.name+".shadowMap",X.map.depthTexture=new qr(i.x,i.y,Mn),X.map.depthTexture.name=W.name+".shadowMapDepth",X.map.depthTexture.format=si,X.map.depthTexture.compareFunction=null,X.map.depthTexture.minFilter=ys,X.map.depthTexture.magFilter=ys}else W.isPointLight?(X.map=new ng(i.x),X.map.depthTexture=new Jz(i.x,Gn)):(X.map=new In(i.x,i.y),X.map.depthTexture=new qr(i.x,i.y,Gn)),X.map.depthTexture.name=W.name+".shadowMap",X.map.depthTexture.format=si,this.type===Po?(X.map.depthTexture.compareFunction=ie?yu:wu,X.map.depthTexture.minFilter=Ds,X.map.depthTexture.magFilter=Ds):(X.map.depthTexture.compareFunction=null,X.map.depthTexture.minFilter=ys,X.map.depthTexture.magFilter=ys);X.camera.updateProjectionMatrix()}const be=X.map.isWebGLCubeRenderTarget?6:1;for(let ae=0;ae<be;ae++){if(X.map.isWebGLCubeRenderTarget)n.setRenderTarget(X.map,ae),n.clear();else{ae===0&&(n.setRenderTarget(X.map),n.clear());const xe=X.getViewport(ae);a.set(r.x*xe.x,r.y*xe.y,r.x*xe.z,r.y*xe.w),k.viewport(a)}if(W.isPointLight){const xe=X.camera,Ze=X.matrix,nt=W.distance||xe.far;nt!==xe.far&&(xe.far=nt,xe.updateProjectionMatrix()),_a.setFromMatrixPosition(W.matrixWorld),xe.position.copy(_a),Oc.copy(xe.position),Oc.add(YO[ae]),xe.up.copy(KO[ae]),xe.lookAt(Oc),xe.updateMatrixWorld(),Ze.makeTranslation(-_a.x,-_a.y,-_a.z),wf.multiplyMatrices(xe.projectionMatrix,xe.matrixWorldInverse),X._frustum.setFromProjectionMatrix(wf,xe.coordinateSystem,xe.reversedDepth)}else X.updateMatrices(W);s=X.getFrustum(),w(I,b,X.camera,W,this.type)}X.isPointLightShadow!==!0&&this.type===Ea&&_(X,b),X.needsUpdate=!1}f=this.type,m.needsUpdate=!1,n.setRenderTarget(A,B,N)};function _(S,I){const b=e.update(z);h.defines.VSM_SAMPLES!==S.blurSamples&&(h.defines.VSM_SAMPLES=S.blurSamples,g.defines.VSM_SAMPLES=S.blurSamples,h.needsUpdate=!0,g.needsUpdate=!0),S.mapPass===null&&(S.mapPass=new In(i.x,i.y,{format:er,type:ti})),h.uniforms.shadow_pass.value=S.map.depthTexture,h.uniforms.resolution.value=S.mapSize,h.uniforms.radius.value=S.radius,n.setRenderTarget(S.mapPass),n.clear(),n.renderBufferDirect(I,null,b,h,z,null),g.uniforms.shadow_pass.value=S.mapPass.texture,g.uniforms.resolution.value=S.mapSize,g.uniforms.radius.value=S.radius,n.setRenderTarget(S.map),n.clear(),n.renderBufferDirect(I,null,b,g,z,null)}function O(S,I,b,A){let B=null;const N=b.isPointLight===!0?S.customDistanceMaterial:S.customDepthMaterial;if(N!==void 0)B=N;else if(B=b.isPointLight===!0?l:o,n.localClippingEnabled&&I.clipShadows===!0&&Array.isArray(I.clippingPlanes)&&I.clippingPlanes.length!==0||I.displacementMap&&I.displacementScale!==0||I.alphaMap&&I.alphaTest>0||I.map&&I.alphaTest>0||I.alphaToCoverage===!0){const k=B.uuid,L=I.uuid;let F=c[k];F===void 0&&(F={},c[k]=F);let P=F[L];P===void 0&&(P=B.clone(),F[L]=P,I.addEventListener("dispose",x)),B=P}if(B.visible=I.visible,B.wireframe=I.wireframe,A===Ea?B.side=I.shadowSide!==null?I.shadowSide:I.side:B.side=I.shadowSide!==null?I.shadowSide:u[I.side],B.alphaMap=I.alphaMap,B.alphaTest=I.alphaToCoverage===!0?.5:I.alphaTest,B.map=I.map,B.clipShadows=I.clipShadows,B.clippingPlanes=I.clippingPlanes,B.clipIntersection=I.clipIntersection,B.displacementMap=I.displacementMap,B.displacementScale=I.displacementScale,B.displacementBias=I.displacementBias,B.wireframeLinewidth=I.wireframeLinewidth,B.linewidth=I.linewidth,b.isPointLight===!0&&B.isMeshDistanceMaterial===!0){const k=n.properties.get(B);k.light=b}return B}function w(S,I,b,A,B){if(S.visible===!1)return;if(S.layers.test(I.layers)&&(S.isMesh||S.isLine||S.isPoints)&&(S.castShadow||S.receiveShadow&&B===Ea)&&(!S.frustumCulled||s.intersectsObject(S))){S.modelViewMatrix.multiplyMatrices(b.matrixWorldInverse,S.matrixWorld);const L=e.update(S),F=S.material;if(Array.isArray(F)){const P=L.groups;for(let W=0,X=P.length;W<X;W++){const Q=P[W],ie=F[Q.materialIndex];if(ie&&ie.visible){const be=O(S,ie,A,B);S.onBeforeShadow(n,S,I,b,L,be,Q),n.renderBufferDirect(b,null,L,be,S,Q),S.onAfterShadow(n,S,I,b,L,be,Q)}}}else if(F.visible){const P=O(S,F,A,B);S.onBeforeShadow(n,S,I,b,L,P,null),n.renderBufferDirect(b,null,L,P,S,null),S.onAfterShadow(n,S,I,b,L,P,null)}}const k=S.children;for(let L=0,F=k.length;L<F;L++)w(k[L],I,b,A,B)}function x(S){S.target.removeEventListener("dispose",x);for(const b in c){const A=c[b],B=S.target.uuid;B in A&&(A[B].dispose(),delete A[B])}}}function QO(n,e){function t(){let V=!1;const Ee=new ts;let ce=null;const Te=new ts(0,0,0,0);return{setMask:function(Ne){ce!==Ne&&!V&&(n.colorMask(Ne,Ne,Ne,Ne),ce=Ne)},setLocked:function(Ne){V=Ne},setClear:function(Ne,pe,Pe,Ue,Vt){Vt===!0&&(Ne*=Ue,pe*=Ue,Pe*=Ue),Ee.set(Ne,pe,Pe,Ue),Te.equals(Ee)===!1&&(n.clearColor(Ne,pe,Pe,Ue),Te.copy(Ee))},reset:function(){V=!1,ce=null,Te.set(-1,0,0,0)}}}function s(){let V=!1,Ee=!1,ce=null,Te=null,Ne=null;return{setReversed:function(pe){if(Ee!==pe){const Pe=e.get("EXT_clip_control");pe?Pe.clipControlEXT(Pe.LOWER_LEFT_EXT,Pe.ZERO_TO_ONE_EXT):Pe.clipControlEXT(Pe.LOWER_LEFT_EXT,Pe.NEGATIVE_ONE_TO_ONE_EXT),Ee=pe;const Ue=Ne;Ne=null,this.setClear(Ue)}},getReversed:function(){return Ee},setTest:function(pe){pe?fe(n.DEPTH_TEST):et(n.DEPTH_TEST)},setMask:function(pe){ce!==pe&&!V&&(n.depthMask(pe),ce=pe)},setFunc:function(pe){if(Ee&&(pe=xz[pe]),Te!==pe){switch(pe){case cd:n.depthFunc(n.NEVER);break;case dd:n.depthFunc(n.ALWAYS);break;case ud:n.depthFunc(n.LESS);break;case $r:n.depthFunc(n.LEQUAL);break;case hd:n.depthFunc(n.EQUAL);break;case fd:n.depthFunc(n.GEQUAL);break;case pd:n.depthFunc(n.GREATER);break;case md:n.depthFunc(n.NOTEQUAL);break;default:n.depthFunc(n.LEQUAL)}Te=pe}},setLocked:function(pe){V=pe},setClear:function(pe){Ne!==pe&&(Ne=pe,Ee&&(pe=1-pe),n.clearDepth(pe))},reset:function(){V=!1,ce=null,Te=null,Ne=null,Ee=!1}}}function i(){let V=!1,Ee=null,ce=null,Te=null,Ne=null,pe=null,Pe=null,Ue=null,Vt=null;return{setTest:function(Pt){V||(Pt?fe(n.STENCIL_TEST):et(n.STENCIL_TEST))},setMask:function(Pt){Ee!==Pt&&!V&&(n.stencilMask(Pt),Ee=Pt)},setFunc:function(Pt,js,Ls){(ce!==Pt||Te!==js||Ne!==Ls)&&(n.stencilFunc(Pt,js,Ls),ce=Pt,Te=js,Ne=Ls)},setOp:function(Pt,js,Ls){(pe!==Pt||Pe!==js||Ue!==Ls)&&(n.stencilOp(Pt,js,Ls),pe=Pt,Pe=js,Ue=Ls)},setLocked:function(Pt){V=Pt},setClear:function(Pt){Vt!==Pt&&(n.clearStencil(Pt),Vt=Pt)},reset:function(){V=!1,Ee=null,ce=null,Te=null,Ne=null,pe=null,Pe=null,Ue=null,Vt=null}}}const r=new t,a=new s,o=new i,l=new WeakMap,c=new WeakMap;let d={},u={},h={},g=new WeakMap,p=[],z=null,m=!1,f=null,_=null,O=null,w=null,x=null,S=null,I=null,b=new Ke(0,0,0),A=0,B=!1,N=null,k=null,L=null,F=null,P=null;const W=n.getParameter(n.MAX_COMBINED_TEXTURE_IMAGE_UNITS);let X=!1,Q=0;const ie=n.getParameter(n.VERSION);ie.indexOf("WebGL")!==-1?(Q=parseFloat(/^WebGL (\d)/.exec(ie)[1]),X=Q>=1):ie.indexOf("OpenGL ES")!==-1&&(Q=parseFloat(/^OpenGL ES (\d)/.exec(ie)[1]),X=Q>=2);let be=null,ae={};const xe=n.getParameter(n.SCISSOR_BOX),Ze=n.getParameter(n.VIEWPORT),nt=new ts().fromArray(xe),Ve=new ts().fromArray(Ze);function le(V,Ee,ce,Te){const Ne=new Uint8Array(4),pe=n.createTexture();n.bindTexture(V,pe),n.texParameteri(V,n.TEXTURE_MIN_FILTER,n.NEAREST),n.texParameteri(V,n.TEXTURE_MAG_FILTER,n.NEAREST);for(let Pe=0;Pe<ce;Pe++)V===n.TEXTURE_3D||V===n.TEXTURE_2D_ARRAY?n.texImage3D(Ee,0,n.RGBA,1,1,Te,0,n.RGBA,n.UNSIGNED_BYTE,Ne):n.texImage2D(Ee+Pe,0,n.RGBA,1,1,0,n.RGBA,n.UNSIGNED_BYTE,Ne);return pe}const ue={};ue[n.TEXTURE_2D]=le(n.TEXTURE_2D,n.TEXTURE_2D,1),ue[n.TEXTURE_CUBE_MAP]=le(n.TEXTURE_CUBE_MAP,n.TEXTURE_CUBE_MAP_POSITIVE_X,6),ue[n.TEXTURE_2D_ARRAY]=le(n.TEXTURE_2D_ARRAY,n.TEXTURE_2D_ARRAY,1,1),ue[n.TEXTURE_3D]=le(n.TEXTURE_3D,n.TEXTURE_3D,1,1),r.setClear(0,0,0,1),a.setClear(1),o.setClear(0),fe(n.DEPTH_TEST),a.setFunc($r),ns(!1),Ut(fh),fe(n.CULL_FACE),it(Zn);function fe(V){d[V]!==!0&&(n.enable(V),d[V]=!0)}function et(V){d[V]!==!1&&(n.disable(V),d[V]=!1)}function ct(V,Ee){return h[V]!==Ee?(n.bindFramebuffer(V,Ee),h[V]=Ee,V===n.DRAW_FRAMEBUFFER&&(h[n.FRAMEBUFFER]=Ee),V===n.FRAMEBUFFER&&(h[n.DRAW_FRAMEBUFFER]=Ee),!0):!1}function Qe(V,Ee){let ce=p,Te=!1;if(V){ce=g.get(Ee),ce===void 0&&(ce=[],g.set(Ee,ce));const Ne=V.textures;if(ce.length!==Ne.length||ce[0]!==n.COLOR_ATTACHMENT0){for(let pe=0,Pe=Ne.length;pe<Pe;pe++)ce[pe]=n.COLOR_ATTACHMENT0+pe;ce.length=Ne.length,Te=!0}}else ce[0]!==n.BACK&&(ce[0]=n.BACK,Te=!0);Te&&n.drawBuffers(ce)}function Zt(V){return z!==V?(n.useProgram(V),z=V,!0):!1}const gt={[Wi]:n.FUNC_ADD,[X0]:n.FUNC_SUBTRACT,[Y0]:n.FUNC_REVERSE_SUBTRACT};gt[K0]=n.MIN,gt[Z0]=n.MAX;const Rt={[Q0]:n.ZERO,[J0]:n.ONE,[ez]:n.SRC_COLOR,[od]:n.SRC_ALPHA,[az]:n.SRC_ALPHA_SATURATE,[iz]:n.DST_COLOR,[sz]:n.DST_ALPHA,[tz]:n.ONE_MINUS_SRC_COLOR,[ld]:n.ONE_MINUS_SRC_ALPHA,[rz]:n.ONE_MINUS_DST_COLOR,[nz]:n.ONE_MINUS_DST_ALPHA,[oz]:n.CONSTANT_COLOR,[lz]:n.ONE_MINUS_CONSTANT_COLOR,[cz]:n.CONSTANT_ALPHA,[dz]:n.ONE_MINUS_CONSTANT_ALPHA};function it(V,Ee,ce,Te,Ne,pe,Pe,Ue,Vt,Pt){if(V===Zn){m===!0&&(et(n.BLEND),m=!1);return}if(m===!1&&(fe(n.BLEND),m=!0),V!==q0){if(V!==f||Pt!==B){if((_!==Wi||x!==Wi)&&(n.blendEquation(n.FUNC_ADD),_=Wi,x=Wi),Pt)switch(V){case $i:n.blendFuncSeparate(n.ONE,n.ONE_MINUS_SRC_ALPHA,n.ONE,n.ONE_MINUS_SRC_ALPHA);break;case Qi:n.blendFunc(n.ONE,n.ONE);break;case ph:n.blendFuncSeparate(n.ZERO,n.ONE_MINUS_SRC_COLOR,n.ZERO,n.ONE);break;case mh:n.blendFuncSeparate(n.DST_COLOR,n.ONE_MINUS_SRC_ALPHA,n.ZERO,n.ONE);break;default:Ot("WebGLState: Invalid blending: ",V);break}else switch(V){case $i:n.blendFuncSeparate(n.SRC_ALPHA,n.ONE_MINUS_SRC_ALPHA,n.ONE,n.ONE_MINUS_SRC_ALPHA);break;case Qi:n.blendFuncSeparate(n.SRC_ALPHA,n.ONE,n.ONE,n.ONE);break;case ph:Ot("WebGLState: SubtractiveBlending requires material.premultipliedAlpha = true");break;case mh:Ot("WebGLState: MultiplyBlending requires material.premultipliedAlpha = true");break;default:Ot("WebGLState: Invalid blending: ",V);break}O=null,w=null,S=null,I=null,b.set(0,0,0),A=0,f=V,B=Pt}return}Ne=Ne||Ee,pe=pe||ce,Pe=Pe||Te,(Ee!==_||Ne!==x)&&(n.blendEquationSeparate(gt[Ee],gt[Ne]),_=Ee,x=Ne),(ce!==O||Te!==w||pe!==S||Pe!==I)&&(n.blendFuncSeparate(Rt[ce],Rt[Te],Rt[pe],Rt[Pe]),O=ce,w=Te,S=pe,I=Pe),(Ue.equals(b)===!1||Vt!==A)&&(n.blendColor(Ue.r,Ue.g,Ue.b,Vt),b.copy(Ue),A=Vt),f=V,B=!1}function yt(V,Ee){V.side===Hn?et(n.CULL_FACE):fe(n.CULL_FACE);let ce=V.side===ks;Ee&&(ce=!ce),ns(ce),V.blending===$i&&V.transparent===!1?it(Zn):it(V.blending,V.blendEquation,V.blendSrc,V.blendDst,V.blendEquationAlpha,V.blendSrcAlpha,V.blendDstAlpha,V.blendColor,V.blendAlpha,V.premultipliedAlpha),a.setFunc(V.depthFunc),a.setTest(V.depthTest),a.setMask(V.depthWrite),r.setMask(V.colorWrite);const Te=V.stencilWrite;o.setTest(Te),Te&&(o.setMask(V.stencilWriteMask),o.setFunc(V.stencilFunc,V.stencilRef,V.stencilFuncMask),o.setOp(V.stencilFail,V.stencilZFail,V.stencilZPass)),as(V.polygonOffset,V.polygonOffsetFactor,V.polygonOffsetUnits),V.alphaToCoverage===!0?fe(n.SAMPLE_ALPHA_TO_COVERAGE):et(n.SAMPLE_ALPHA_TO_COVERAGE)}function ns(V){N!==V&&(V?n.frontFace(n.CW):n.frontFace(n.CCW),N=V)}function Ut(V){V!==$0?(fe(n.CULL_FACE),V!==k&&(V===fh?n.cullFace(n.BACK):V===V0?n.cullFace(n.FRONT):n.cullFace(n.FRONT_AND_BACK))):et(n.CULL_FACE),k=V}function rs(V){V!==L&&(X&&n.lineWidth(V),L=V)}function as(V,Ee,ce){V?(fe(n.POLYGON_OFFSET_FILL),(F!==Ee||P!==ce)&&(F=Ee,P=ce,a.getReversed()&&(Ee=-Ee),n.polygonOffset(Ee,ce))):et(n.POLYGON_OFFSET_FILL)}function Qt(V){V?fe(n.SCISSOR_TEST):et(n.SCISSOR_TEST)}function es(V){V===void 0&&(V=n.TEXTURE0+W-1),be!==V&&(n.activeTexture(V),be=V)}function q(V,Ee,ce){ce===void 0&&(be===null?ce=n.TEXTURE0+W-1:ce=be);let Te=ae[ce];Te===void 0&&(Te={type:void 0,texture:void 0},ae[ce]=Te),(Te.type!==V||Te.texture!==Ee)&&(be!==ce&&(n.activeTexture(ce),be=ce),n.bindTexture(V,Ee||ue[V]),Te.type=V,Te.texture=Ee)}function Os(){const V=ae[be];V!==void 0&&V.type!==void 0&&(n.bindTexture(V.type,null),V.type=void 0,V.texture=void 0)}function Bt(){try{n.compressedTexImage2D(...arguments)}catch(V){Ot("WebGLState:",V)}}function R(){try{n.compressedTexImage3D(...arguments)}catch(V){Ot("WebGLState:",V)}}function y(){try{n.texSubImage2D(...arguments)}catch(V){Ot("WebGLState:",V)}}function K(){try{n.texSubImage3D(...arguments)}catch(V){Ot("WebGLState:",V)}}function se(){try{n.compressedTexSubImage2D(...arguments)}catch(V){Ot("WebGLState:",V)}}function re(){try{n.compressedTexSubImage3D(...arguments)}catch(V){Ot("WebGLState:",V)}}function ve(){try{n.texStorage2D(...arguments)}catch(V){Ot("WebGLState:",V)}}function Ae(){try{n.texStorage3D(...arguments)}catch(V){Ot("WebGLState:",V)}}function oe(){try{n.texImage2D(...arguments)}catch(V){Ot("WebGLState:",V)}}function he(){try{n.texImage3D(...arguments)}catch(V){Ot("WebGLState:",V)}}function Se(V){return u[V]!==void 0?u[V]:n.getParameter(V)}function He(V,Ee){u[V]!==Ee&&(n.pixelStorei(V,Ee),u[V]=Ee)}function De(V){nt.equals(V)===!1&&(n.scissor(V.x,V.y,V.z,V.w),nt.copy(V))}function Ie(V){Ve.equals(V)===!1&&(n.viewport(V.x,V.y,V.z,V.w),Ve.copy(V))}function Xe(V,Ee){let ce=c.get(Ee);ce===void 0&&(ce=new WeakMap,c.set(Ee,ce));let Te=ce.get(V);Te===void 0&&(Te=n.getUniformBlockIndex(Ee,V.name),ce.set(V,Te))}function Je(V,Ee){const Te=c.get(Ee).get(V);l.get(Ee)!==Te&&(n.uniformBlockBinding(Ee,Te,V.__bindingPointIndex),l.set(Ee,Te))}function dt(){n.disable(n.BLEND),n.disable(n.CULL_FACE),n.disable(n.DEPTH_TEST),n.disable(n.POLYGON_OFFSET_FILL),n.disable(n.SCISSOR_TEST),n.disable(n.STENCIL_TEST),n.disable(n.SAMPLE_ALPHA_TO_COVERAGE),n.blendEquation(n.FUNC_ADD),n.blendFunc(n.ONE,n.ZERO),n.blendFuncSeparate(n.ONE,n.ZERO,n.ONE,n.ZERO),n.blendColor(0,0,0,0),n.colorMask(!0,!0,!0,!0),n.clearColor(0,0,0,0),n.depthMask(!0),n.depthFunc(n.LESS),a.setReversed(!1),n.clearDepth(1),n.stencilMask(4294967295),n.stencilFunc(n.ALWAYS,0,4294967295),n.stencilOp(n.KEEP,n.KEEP,n.KEEP),n.clearStencil(0),n.cullFace(n.BACK),n.frontFace(n.CCW),n.polygonOffset(0,0),n.activeTexture(n.TEXTURE0),n.bindFramebuffer(n.FRAMEBUFFER,null),n.bindFramebuffer(n.DRAW_FRAMEBUFFER,null),n.bindFramebuffer(n.READ_FRAMEBUFFER,null),n.useProgram(null),n.lineWidth(1),n.scissor(0,0,n.canvas.width,n.canvas.height),n.viewport(0,0,n.canvas.width,n.canvas.height),n.pixelStorei(n.PACK_ALIGNMENT,4),n.pixelStorei(n.UNPACK_ALIGNMENT,4),n.pixelStorei(n.UNPACK_FLIP_Y_WEBGL,!1),n.pixelStorei(n.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),n.pixelStorei(n.UNPACK_COLORSPACE_CONVERSION_WEBGL,n.BROWSER_DEFAULT_WEBGL),n.pixelStorei(n.PACK_ROW_LENGTH,0),n.pixelStorei(n.PACK_SKIP_PIXELS,0),n.pixelStorei(n.PACK_SKIP_ROWS,0),n.pixelStorei(n.UNPACK_ROW_LENGTH,0),n.pixelStorei(n.UNPACK_IMAGE_HEIGHT,0),n.pixelStorei(n.UNPACK_SKIP_PIXELS,0),n.pixelStorei(n.UNPACK_SKIP_ROWS,0),n.pixelStorei(n.UNPACK_SKIP_IMAGES,0),d={},u={},be=null,ae={},h={},g=new WeakMap,p=[],z=null,m=!1,f=null,_=null,O=null,w=null,x=null,S=null,I=null,b=new Ke(0,0,0),A=0,B=!1,N=null,k=null,L=null,F=null,P=null,nt.set(0,0,n.canvas.width,n.canvas.height),Ve.set(0,0,n.canvas.width,n.canvas.height),r.reset(),a.reset(),o.reset()}return{buffers:{color:r,depth:a,stencil:o},enable:fe,disable:et,bindFramebuffer:ct,drawBuffers:Qe,useProgram:Zt,setBlending:it,setMaterial:yt,setFlipSided:ns,setCullFace:Ut,setLineWidth:rs,setPolygonOffset:as,setScissorTest:Qt,activeTexture:es,bindTexture:q,unbindTexture:Os,compressedTexImage2D:Bt,compressedTexImage3D:R,texImage2D:oe,texImage3D:he,pixelStorei:He,getParameter:Se,updateUBOMapping:Xe,uniformBlockBinding:Je,texStorage2D:ve,texStorage3D:Ae,texSubImage2D:y,texSubImage3D:K,compressedTexSubImage2D:se,compressedTexSubImage3D:re,scissor:De,viewport:Ie,reset:dt}}function JO(n,e,t,s,i,r,a){const o=e.has("WEBGL_multisampled_render_to_texture")?e.get("WEBGL_multisampled_render_to_texture"):null,l=typeof navigator>"u"?!1:/OculusBrowser/g.test(navigator.userAgent),c=new lt,d=new WeakMap,u=new Set;let h;const g=new WeakMap;let p=!1;try{p=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function z(R,y){return p?new OffscreenCanvas(R,y):hl("canvas")}function m(R,y,K){let se=1;const re=Bt(R);if((re.width>K||re.height>K)&&(se=K/Math.max(re.width,re.height)),se<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 ve=Math.floor(se*re.width),Ae=Math.floor(se*re.height);h===void 0&&(h=z(ve,Ae));const oe=y?z(ve,Ae):h;return oe.width=ve,oe.height=Ae,oe.getContext("2d").drawImage(R,0,0,ve,Ae),st("WebGLRenderer: Texture has been resized from ("+re.width+"x"+re.height+") to ("+ve+"x"+Ae+")."),oe}else return"data"in R&&st("WebGLRenderer: Image in DataTexture is too big ("+re.width+"x"+re.height+")."),R;return R}function f(R){return R.generateMipmaps}function _(R){n.generateMipmap(R)}function O(R){return R.isWebGLCubeRenderTarget?n.TEXTURE_CUBE_MAP:R.isWebGL3DRenderTarget?n.TEXTURE_3D:R.isWebGLArrayRenderTarget||R.isCompressedArrayTexture?n.TEXTURE_2D_ARRAY:n.TEXTURE_2D}function w(R,y,K,se,re,ve=!1){if(R!==null){if(n[R]!==void 0)return n[R];st("WebGLRenderer: Attempt to use non-existing WebGL internal format '"+R+"'")}let Ae;se&&(Ae=e.get("EXT_texture_norm16"),Ae||st("WebGLRenderer: Unable to use normalized textures without EXT_texture_norm16 extension"));let oe=y;if(y===n.RED&&(K===n.FLOAT&&(oe=n.R32F),K===n.HALF_FLOAT&&(oe=n.R16F),K===n.UNSIGNED_BYTE&&(oe=n.R8),K===n.UNSIGNED_SHORT&&Ae&&(oe=Ae.R16_EXT),K===n.SHORT&&Ae&&(oe=Ae.R16_SNORM_EXT)),y===n.RED_INTEGER&&(K===n.UNSIGNED_BYTE&&(oe=n.R8UI),K===n.UNSIGNED_SHORT&&(oe=n.R16UI),K===n.UNSIGNED_INT&&(oe=n.R32UI),K===n.BYTE&&(oe=n.R8I),K===n.SHORT&&(oe=n.R16I),K===n.INT&&(oe=n.R32I)),y===n.RG&&(K===n.FLOAT&&(oe=n.RG32F),K===n.HALF_FLOAT&&(oe=n.RG16F),K===n.UNSIGNED_BYTE&&(oe=n.RG8),K===n.UNSIGNED_SHORT&&Ae&&(oe=Ae.RG16_EXT),K===n.SHORT&&Ae&&(oe=Ae.RG16_SNORM_EXT)),y===n.RG_INTEGER&&(K===n.UNSIGNED_BYTE&&(oe=n.RG8UI),K===n.UNSIGNED_SHORT&&(oe=n.RG16UI),K===n.UNSIGNED_INT&&(oe=n.RG32UI),K===n.BYTE&&(oe=n.RG8I),K===n.SHORT&&(oe=n.RG16I),K===n.INT&&(oe=n.RG32I)),y===n.RGB_INTEGER&&(K===n.UNSIGNED_BYTE&&(oe=n.RGB8UI),K===n.UNSIGNED_SHORT&&(oe=n.RGB16UI),K===n.UNSIGNED_INT&&(oe=n.RGB32UI),K===n.BYTE&&(oe=n.RGB8I),K===n.SHORT&&(oe=n.RGB16I),K===n.INT&&(oe=n.RGB32I)),y===n.RGBA_INTEGER&&(K===n.UNSIGNED_BYTE&&(oe=n.RGBA8UI),K===n.UNSIGNED_SHORT&&(oe=n.RGBA16UI),K===n.UNSIGNED_INT&&(oe=n.RGBA32UI),K===n.BYTE&&(oe=n.RGBA8I),K===n.SHORT&&(oe=n.RGBA16I),K===n.INT&&(oe=n.RGBA32I)),y===n.RGB&&(K===n.UNSIGNED_SHORT&&Ae&&(oe=Ae.RGB16_EXT),K===n.SHORT&&Ae&&(oe=Ae.RGB16_SNORM_EXT),K===n.UNSIGNED_INT_5_9_9_9_REV&&(oe=n.RGB9_E5),K===n.UNSIGNED_INT_10F_11F_11F_REV&&(oe=n.R11F_G11F_B10F)),y===n.RGBA){const he=ve?ul:xt.getTransfer(re);K===n.FLOAT&&(oe=n.RGBA32F),K===n.HALF_FLOAT&&(oe=n.RGBA16F),K===n.UNSIGNED_BYTE&&(oe=he===kt?n.SRGB8_ALPHA8:n.RGBA8),K===n.UNSIGNED_SHORT&&Ae&&(oe=Ae.RGBA16_EXT),K===n.SHORT&&Ae&&(oe=Ae.RGBA16_SNORM_EXT),K===n.UNSIGNED_SHORT_4_4_4_4&&(oe=n.RGBA4),K===n.UNSIGNED_SHORT_5_5_5_1&&(oe=n.RGB5_A1)}return(oe===n.R16F||oe===n.R32F||oe===n.RG16F||oe===n.RG32F||oe===n.RGBA16F||oe===n.RGBA32F)&&e.get("EXT_color_buffer_float"),oe}function x(R,y){let K;return R?y===null||y===Gn||y===Wa?K=n.DEPTH24_STENCIL8:y===Mn?K=n.DEPTH32F_STENCIL8:y===La&&(K=n.DEPTH24_STENCIL8,st("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.")):y===null||y===Gn||y===Wa?K=n.DEPTH_COMPONENT24:y===Mn?K=n.DEPTH_COMPONENT32F:y===La&&(K=n.DEPTH_COMPONENT16),K}function S(R,y){return f(R)===!0||R.isFramebufferTexture&&R.minFilter!==ys&&R.minFilter!==Ds?Math.log2(Math.max(y.width,y.height))+1:R.mipmaps!==void 0&&R.mipmaps.length>0?R.mipmaps.length:R.isCompressedTexture&&Array.isArray(R.image)?y.mipmaps.length:1}function I(R){const y=R.target;y.removeEventListener("dispose",I),A(y),y.isVideoTexture&&d.delete(y),y.isHTMLTexture&&u.delete(y)}function b(R){const y=R.target;y.removeEventListener("dispose",b),N(y)}function A(R){const y=s.get(R);if(y.__webglInit===void 0)return;const K=R.source,se=g.get(K);if(se){const re=se[y.__cacheKey];re.usedTimes--,re.usedTimes===0&&B(R),Object.keys(se).length===0&&g.delete(K)}s.remove(R)}function B(R){const y=s.get(R);n.deleteTexture(y.__webglTexture);const K=R.source,se=g.get(K);delete se[y.__cacheKey],a.memory.textures--}function N(R){const y=s.get(R);if(R.depthTexture&&(R.depthTexture.dispose(),s.remove(R.depthTexture)),R.isWebGLCubeRenderTarget)for(let se=0;se<6;se++){if(Array.isArray(y.__webglFramebuffer[se]))for(let re=0;re<y.__webglFramebuffer[se].length;re++)n.deleteFramebuffer(y.__webglFramebuffer[se][re]);else n.deleteFramebuffer(y.__webglFramebuffer[se]);y.__webglDepthbuffer&&n.deleteRenderbuffer(y.__webglDepthbuffer[se])}else{if(Array.isArray(y.__webglFramebuffer))for(let se=0;se<y.__webglFramebuffer.length;se++)n.deleteFramebuffer(y.__webglFramebuffer[se]);else n.deleteFramebuffer(y.__webglFramebuffer);if(y.__webglDepthbuffer&&n.deleteRenderbuffer(y.__webglDepthbuffer),y.__webglMultisampledFramebuffer&&n.deleteFramebuffer(y.__webglMultisampledFramebuffer),y.__webglColorRenderbuffer)for(let se=0;se<y.__webglColorRenderbuffer.length;se++)y.__webglColorRenderbuffer[se]&&n.deleteRenderbuffer(y.__webglColorRenderbuffer[se]);y.__webglDepthRenderbuffer&&n.deleteRenderbuffer(y.__webglDepthRenderbuffer)}const K=R.textures;for(let se=0,re=K.length;se<re;se++){const ve=s.get(K[se]);ve.__webglTexture&&(n.deleteTexture(ve.__webglTexture),a.memory.textures--),s.remove(K[se])}s.remove(R)}let k=0;function L(){k=0}function F(){return k}function P(R){k=R}function W(){const R=k;return R>=i.maxTextures&&st("WebGLTextures: Trying to use "+R+" texture units while this GPU supports only "+i.maxTextures),k+=1,R}function X(R){const y=[];return y.push(R.wrapS),y.push(R.wrapT),y.push(R.wrapR||0),y.push(R.magFilter),y.push(R.minFilter),y.push(R.anisotropy),y.push(R.internalFormat),y.push(R.format),y.push(R.type),y.push(R.generateMipmaps),y.push(R.premultiplyAlpha),y.push(R.flipY),y.push(R.unpackAlignment),y.push(R.colorSpace),y.join()}function Q(R,y){const K=s.get(R);if(R.isVideoTexture&&q(R),R.isRenderTargetTexture===!1&&R.isExternalTexture!==!0&&R.version>0&&K.__version!==R.version){const se=R.image;if(se===null)st("WebGLRenderer: Texture marked for update but no image data found.");else if(se.complete===!1)st("WebGLRenderer: Texture marked for update but image is incomplete");else{et(K,R,y);return}}else R.isExternalTexture&&(K.__webglTexture=R.sourceTexture?R.sourceTexture:null);t.bindTexture(n.TEXTURE_2D,K.__webglTexture,n.TEXTURE0+y)}function ie(R,y){const K=s.get(R);if(R.isRenderTargetTexture===!1&&R.version>0&&K.__version!==R.version){et(K,R,y);return}else R.isExternalTexture&&(K.__webglTexture=R.sourceTexture?R.sourceTexture:null);t.bindTexture(n.TEXTURE_2D_ARRAY,K.__webglTexture,n.TEXTURE0+y)}function be(R,y){const K=s.get(R);if(R.isRenderTargetTexture===!1&&R.version>0&&K.__version!==R.version){et(K,R,y);return}t.bindTexture(n.TEXTURE_3D,K.__webglTexture,n.TEXTURE0+y)}function ae(R,y){const K=s.get(R);if(R.isCubeDepthTexture!==!0&&R.version>0&&K.__version!==R.version){ct(K,R,y);return}t.bindTexture(n.TEXTURE_CUBE_MAP,K.__webglTexture,n.TEXTURE0+y)}const xe={[gd]:n.REPEAT,[Yn]:n.CLAMP_TO_EDGE,[Md]:n.MIRRORED_REPEAT},Ze={[ys]:n.NEAREST,[fz]:n.NEAREST_MIPMAP_NEAREST,[qa]:n.NEAREST_MIPMAP_LINEAR,[Ds]:n.LINEAR,[Vl]:n.LINEAR_MIPMAP_NEAREST,[Fi]:n.LINEAR_MIPMAP_LINEAR},nt={[gz]:n.NEVER,[wz]:n.ALWAYS,[Mz]:n.LESS,[wu]:n.LEQUAL,[bz]:n.EQUAL,[yu]:n.GEQUAL,[zz]:n.GREATER,[_z]:n.NOTEQUAL};function Ve(R,y){if(y.type===Mn&&e.has("OES_texture_float_linear")===!1&&(y.magFilter===Ds||y.magFilter===Vl||y.magFilter===qa||y.magFilter===Fi||y.minFilter===Ds||y.minFilter===Vl||y.minFilter===qa||y.minFilter===Fi)&&st("WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."),n.texParameteri(R,n.TEXTURE_WRAP_S,xe[y.wrapS]),n.texParameteri(R,n.TEXTURE_WRAP_T,xe[y.wrapT]),(R===n.TEXTURE_3D||R===n.TEXTURE_2D_ARRAY)&&n.texParameteri(R,n.TEXTURE_WRAP_R,xe[y.wrapR]),n.texParameteri(R,n.TEXTURE_MAG_FILTER,Ze[y.magFilter]),n.texParameteri(R,n.TEXTURE_MIN_FILTER,Ze[y.minFilter]),y.compareFunction&&(n.texParameteri(R,n.TEXTURE_COMPARE_MODE,n.COMPARE_REF_TO_TEXTURE),n.texParameteri(R,n.TEXTURE_COMPARE_FUNC,nt[y.compareFunction])),e.has("EXT_texture_filter_anisotropic")===!0){if(y.magFilter===ys||y.minFilter!==qa&&y.minFilter!==Fi||y.type===Mn&&e.has("OES_texture_float_linear")===!1)return;if(y.anisotropy>1||s.get(y).__currentAnisotropy){const K=e.get("EXT_texture_filter_anisotropic");n.texParameterf(R,K.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(y.anisotropy,i.getMaxAnisotropy())),s.get(y).__currentAnisotropy=y.anisotropy}}}function le(R,y){let K=!1;R.__webglInit===void 0&&(R.__webglInit=!0,y.addEventListener("dispose",I));const se=y.source;let re=g.get(se);re===void 0&&(re={},g.set(se,re));const ve=X(y);if(ve!==R.__cacheKey){re[ve]===void 0&&(re[ve]={texture:n.createTexture(),usedTimes:0},a.memory.textures++,K=!0),re[ve].usedTimes++;const Ae=re[R.__cacheKey];Ae!==void 0&&(re[R.__cacheKey].usedTimes--,Ae.usedTimes===0&&B(y)),R.__cacheKey=ve,R.__webglTexture=re[ve].texture}return K}function ue(R,y,K){return Math.floor(Math.floor(R/K)/y)}function fe(R,y,K,se){const ve=R.updateRanges;if(ve.length===0)t.texSubImage2D(n.TEXTURE_2D,0,0,0,y.width,y.height,K,se,y.data);else{ve.sort((He,De)=>He.start-De.start);let Ae=0;for(let He=1;He<ve.length;He++){const De=ve[Ae],Ie=ve[He],Xe=De.start+De.count,Je=ue(Ie.start,y.width,4),dt=ue(De.start,y.width,4);Ie.start<=Xe+1&&Je===dt&&ue(Ie.start+Ie.count-1,y.width,4)===Je?De.count=Math.max(De.count,Ie.start+Ie.count-De.start):(++Ae,ve[Ae]=Ie)}ve.length=Ae+1;const oe=t.getParameter(n.UNPACK_ROW_LENGTH),he=t.getParameter(n.UNPACK_SKIP_PIXELS),Se=t.getParameter(n.UNPACK_SKIP_ROWS);t.pixelStorei(n.UNPACK_ROW_LENGTH,y.width);for(let He=0,De=ve.length;He<De;He++){const Ie=ve[He],Xe=Math.floor(Ie.start/4),Je=Math.ceil(Ie.count/4),dt=Xe%y.width,V=Math.floor(Xe/y.width),Ee=Je,ce=1;t.pixelStorei(n.UNPACK_SKIP_PIXELS,dt),t.pixelStorei(n.UNPACK_SKIP_ROWS,V),t.texSubImage2D(n.TEXTURE_2D,0,dt,V,Ee,ce,K,se,y.data)}R.clearUpdateRanges(),t.pixelStorei(n.UNPACK_ROW_LENGTH,oe),t.pixelStorei(n.UNPACK_SKIP_PIXELS,he),t.pixelStorei(n.UNPACK_SKIP_ROWS,Se)}}function et(R,y,K){let se=n.TEXTURE_2D;(y.isDataArrayTexture||y.isCompressedArrayTexture)&&(se=n.TEXTURE_2D_ARRAY),y.isData3DTexture&&(se=n.TEXTURE_3D);const re=le(R,y),ve=y.source;t.bindTexture(se,R.__webglTexture,n.TEXTURE0+K);const Ae=s.get(ve);if(ve.version!==Ae.__version||re===!0){if(t.activeTexture(n.TEXTURE0+K),(typeof ImageBitmap<"u"&&y.image instanceof ImageBitmap)===!1){const ce=xt.getPrimaries(xt.workingColorSpace),Te=y.colorSpace===bi?null:xt.getPrimaries(y.colorSpace),Ne=y.colorSpace===bi||ce===Te?n.NONE:n.BROWSER_DEFAULT_WEBGL;t.pixelStorei(n.UNPACK_FLIP_Y_WEBGL,y.flipY),t.pixelStorei(n.UNPACK_PREMULTIPLY_ALPHA_WEBGL,y.premultiplyAlpha),t.pixelStorei(n.UNPACK_COLORSPACE_CONVERSION_WEBGL,Ne)}t.pixelStorei(n.UNPACK_ALIGNMENT,y.unpackAlignment);let he=m(y.image,!1,i.maxTextureSize);he=Os(y,he);const Se=r.convert(y.format,y.colorSpace),He=r.convert(y.type);let De=w(y.internalFormat,Se,He,y.normalized,y.colorSpace,y.isVideoTexture);Ve(se,y);let Ie;const Xe=y.mipmaps,Je=y.isVideoTexture!==!0,dt=Ae.__version===void 0||re===!0,V=ve.dataReady,Ee=S(y,he);if(y.isDepthTexture)De=x(y.format===ji,y.type),dt&&(Je?t.texStorage2D(n.TEXTURE_2D,1,De,he.width,he.height):t.texImage2D(n.TEXTURE_2D,0,De,he.width,he.height,0,Se,He,null));else if(y.isDataTexture)if(Xe.length>0){Je&&dt&&t.texStorage2D(n.TEXTURE_2D,Ee,De,Xe[0].width,Xe[0].height);for(let ce=0,Te=Xe.length;ce<Te;ce++)Ie=Xe[ce],Je?V&&t.texSubImage2D(n.TEXTURE_2D,ce,0,0,Ie.width,Ie.height,Se,He,Ie.data):t.texImage2D(n.TEXTURE_2D,ce,De,Ie.width,Ie.height,0,Se,He,Ie.data);y.generateMipmaps=!1}else Je?(dt&&t.texStorage2D(n.TEXTURE_2D,Ee,De,he.width,he.height),V&&fe(y,he,Se,He)):t.texImage2D(n.TEXTURE_2D,0,De,he.width,he.height,0,Se,He,he.data);else if(y.isCompressedTexture)if(y.isCompressedArrayTexture){Je&&dt&&t.texStorage3D(n.TEXTURE_2D_ARRAY,Ee,De,Xe[0].width,Xe[0].height,he.depth);for(let ce=0,Te=Xe.length;ce<Te;ce++)if(Ie=Xe[ce],y.format!==bn)if(Se!==null)if(Je){if(V)if(y.layerUpdates.size>0){const Ne=Zh(Ie.width,Ie.height,y.format,y.type);for(const pe of y.layerUpdates){const Pe=Ie.data.subarray(pe*Ne/Ie.data.BYTES_PER_ELEMENT,(pe+1)*Ne/Ie.data.BYTES_PER_ELEMENT);t.compressedTexSubImage3D(n.TEXTURE_2D_ARRAY,ce,0,0,pe,Ie.width,Ie.height,1,Se,Pe)}y.clearLayerUpdates()}else t.compressedTexSubImage3D(n.TEXTURE_2D_ARRAY,ce,0,0,0,Ie.width,Ie.height,he.depth,Se,Ie.data)}else t.compressedTexImage3D(n.TEXTURE_2D_ARRAY,ce,De,Ie.width,Ie.height,he.depth,0,Ie.data,0,0);else st("WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");else Je?V&&t.texSubImage3D(n.TEXTURE_2D_ARRAY,ce,0,0,0,Ie.width,Ie.height,he.depth,Se,He,Ie.data):t.texImage3D(n.TEXTURE_2D_ARRAY,ce,De,Ie.width,Ie.height,he.depth,0,Se,He,Ie.data)}else{Je&&dt&&t.texStorage2D(n.TEXTURE_2D,Ee,De,Xe[0].width,Xe[0].height);for(let ce=0,Te=Xe.length;ce<Te;ce++)Ie=Xe[ce],y.format!==bn?Se!==null?Je?V&&t.compressedTexSubImage2D(n.TEXTURE_2D,ce,0,0,Ie.width,Ie.height,Se,Ie.data):t.compressedTexImage2D(n.TEXTURE_2D,ce,De,Ie.width,Ie.height,0,Ie.data):st("WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):Je?V&&t.texSubImage2D(n.TEXTURE_2D,ce,0,0,Ie.width,Ie.height,Se,He,Ie.data):t.texImage2D(n.TEXTURE_2D,ce,De,Ie.width,Ie.height,0,Se,He,Ie.data)}else if(y.isDataArrayTexture)if(Je){if(dt&&t.texStorage3D(n.TEXTURE_2D_ARRAY,Ee,De,he.width,he.height,he.depth),V)if(y.layerUpdates.size>0){const ce=Zh(he.width,he.height,y.format,y.type);for(const Te of y.layerUpdates){const Ne=he.data.subarray(Te*ce/he.data.BYTES_PER_ELEMENT,(Te+1)*ce/he.data.BYTES_PER_ELEMENT);t.texSubImage3D(n.TEXTURE_2D_ARRAY,0,0,0,Te,he.width,he.height,1,Se,He,Ne)}y.clearLayerUpdates()}else t.texSubImage3D(n.TEXTURE_2D_ARRAY,0,0,0,0,he.width,he.height,he.depth,Se,He,he.data)}else t.texImage3D(n.TEXTURE_2D_ARRAY,0,De,he.width,he.height,he.depth,0,Se,He,he.data);else if(y.isData3DTexture)Je?(dt&&t.texStorage3D(n.TEXTURE_3D,Ee,De,he.width,he.height,he.depth),V&&t.texSubImage3D(n.TEXTURE_3D,0,0,0,0,he.width,he.height,he.depth,Se,He,he.data)):t.texImage3D(n.TEXTURE_3D,0,De,he.width,he.height,he.depth,0,Se,He,he.data);else if(y.isFramebufferTexture){if(dt)if(Je)t.texStorage2D(n.TEXTURE_2D,Ee,De,he.width,he.height);else{let ce=he.width,Te=he.height;for(let Ne=0;Ne<Ee;Ne++)t.texImage2D(n.TEXTURE_2D,Ne,De,ce,Te,0,Se,He,null),ce>>=1,Te>>=1}}else if(y.isHTMLTexture){if("texElementImage2D"in n){const ce=n.canvas;if(ce.hasAttribute("layoutsubtree")||ce.setAttribute("layoutsubtree","true"),he.parentNode!==ce){ce.appendChild(he),u.add(y),ce.onpaint=Te=>{const Ne=Te.changedElements;for(const pe of u)Ne.includes(pe.image)&&(pe.needsUpdate=!0)},ce.requestPaint();return}if(n.texElementImage2D.length===3)n.texElementImage2D(n.TEXTURE_2D,n.RGBA8,he);else{const Ne=n.RGBA,pe=n.RGBA,Pe=n.UNSIGNED_BYTE;n.texElementImage2D(n.TEXTURE_2D,0,Ne,pe,Pe,he)}n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MIN_FILTER,n.LINEAR),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_S,n.CLAMP_TO_EDGE),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_T,n.CLAMP_TO_EDGE)}}else if(Xe.length>0){if(Je&&dt){const ce=Bt(Xe[0]);t.texStorage2D(n.TEXTURE_2D,Ee,De,ce.width,ce.height)}for(let ce=0,Te=Xe.length;ce<Te;ce++)Ie=Xe[ce],Je?V&&t.texSubImage2D(n.TEXTURE_2D,ce,0,0,Se,He,Ie):t.texImage2D(n.TEXTURE_2D,ce,De,Se,He,Ie);y.generateMipmaps=!1}else if(Je){if(dt){const ce=Bt(he);t.texStorage2D(n.TEXTURE_2D,Ee,De,ce.width,ce.height)}V&&t.texSubImage2D(n.TEXTURE_2D,0,0,0,Se,He,he)}else t.texImage2D(n.TEXTURE_2D,0,De,Se,He,he);f(y)&&_(se),Ae.__version=ve.version,y.onUpdate&&y.onUpdate(y)}R.__version=y.version}function ct(R,y,K){if(y.image.length!==6)return;const se=le(R,y),re=y.source;t.bindTexture(n.TEXTURE_CUBE_MAP,R.__webglTexture,n.TEXTURE0+K);const ve=s.get(re);if(re.version!==ve.__version||se===!0){t.activeTexture(n.TEXTURE0+K);const Ae=xt.getPrimaries(xt.workingColorSpace),oe=y.colorSpace===bi?null:xt.getPrimaries(y.colorSpace),he=y.colorSpace===bi||Ae===oe?n.NONE:n.BROWSER_DEFAULT_WEBGL;t.pixelStorei(n.UNPACK_FLIP_Y_WEBGL,y.flipY),t.pixelStorei(n.UNPACK_PREMULTIPLY_ALPHA_WEBGL,y.premultiplyAlpha),t.pixelStorei(n.UNPACK_ALIGNMENT,y.unpackAlignment),t.pixelStorei(n.UNPACK_COLORSPACE_CONVERSION_WEBGL,he);const Se=y.isCompressedTexture||y.image[0].isCompressedTexture,He=y.image[0]&&y.image[0].isDataTexture,De=[];for(let pe=0;pe<6;pe++)!Se&&!He?De[pe]=m(y.image[pe],!0,i.maxCubemapSize):De[pe]=He?y.image[pe].image:y.image[pe],De[pe]=Os(y,De[pe]);const Ie=De[0],Xe=r.convert(y.format,y.colorSpace),Je=r.convert(y.type),dt=w(y.internalFormat,Xe,Je,y.normalized,y.colorSpace),V=y.isVideoTexture!==!0,Ee=ve.__version===void 0||se===!0,ce=re.dataReady;let Te=S(y,Ie);Ve(n.TEXTURE_CUBE_MAP,y);let Ne;if(Se){V&&Ee&&t.texStorage2D(n.TEXTURE_CUBE_MAP,Te,dt,Ie.width,Ie.height);for(let pe=0;pe<6;pe++){Ne=De[pe].mipmaps;for(let Pe=0;Pe<Ne.length;Pe++){const Ue=Ne[Pe];y.format!==bn?Xe!==null?V?ce&&t.compressedTexSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+pe,Pe,0,0,Ue.width,Ue.height,Xe,Ue.data):t.compressedTexImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+pe,Pe,dt,Ue.width,Ue.height,0,Ue.data):st("WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):V?ce&&t.texSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+pe,Pe,0,0,Ue.width,Ue.height,Xe,Je,Ue.data):t.texImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+pe,Pe,dt,Ue.width,Ue.height,0,Xe,Je,Ue.data)}}}else{if(Ne=y.mipmaps,V&&Ee){Ne.length>0&&Te++;const pe=Bt(De[0]);t.texStorage2D(n.TEXTURE_CUBE_MAP,Te,dt,pe.width,pe.height)}for(let pe=0;pe<6;pe++)if(He){V?ce&&t.texSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+pe,0,0,0,De[pe].width,De[pe].height,Xe,Je,De[pe].data):t.texImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+pe,0,dt,De[pe].width,De[pe].height,0,Xe,Je,De[pe].data);for(let Pe=0;Pe<Ne.length;Pe++){const Vt=Ne[Pe].image[pe].image;V?ce&&t.texSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+pe,Pe+1,0,0,Vt.width,Vt.height,Xe,Je,Vt.data):t.texImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+pe,Pe+1,dt,Vt.width,Vt.height,0,Xe,Je,Vt.data)}}else{V?ce&&t.texSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+pe,0,0,0,Xe,Je,De[pe]):t.texImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+pe,0,dt,Xe,Je,De[pe]);for(let Pe=0;Pe<Ne.length;Pe++){const Ue=Ne[Pe];V?ce&&t.texSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+pe,Pe+1,0,0,Xe,Je,Ue.image[pe]):t.texImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+pe,Pe+1,dt,Xe,Je,Ue.image[pe])}}}f(y)&&_(n.TEXTURE_CUBE_MAP),ve.__version=re.version,y.onUpdate&&y.onUpdate(y)}R.__version=y.version}function Qe(R,y,K,se,re,ve){const Ae=r.convert(K.format,K.colorSpace),oe=r.convert(K.type),he=w(K.internalFormat,Ae,oe,K.normalized,K.colorSpace),Se=s.get(y),He=s.get(K);if(He.__renderTarget=y,!Se.__hasExternalTextures){const De=Math.max(1,y.width>>ve),Ie=Math.max(1,y.height>>ve);re===n.TEXTURE_3D||re===n.TEXTURE_2D_ARRAY?t.texImage3D(re,ve,he,De,Ie,y.depth,0,Ae,oe,null):t.texImage2D(re,ve,he,De,Ie,0,Ae,oe,null)}t.bindFramebuffer(n.FRAMEBUFFER,R),es(y)?o.framebufferTexture2DMultisampleEXT(n.FRAMEBUFFER,se,re,He.__webglTexture,0,Qt(y)):(re===n.TEXTURE_2D||re>=n.TEXTURE_CUBE_MAP_POSITIVE_X&&re<=n.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&n.framebufferTexture2D(n.FRAMEBUFFER,se,re,He.__webglTexture,ve),t.bindFramebuffer(n.FRAMEBUFFER,null)}function Zt(R,y,K){if(n.bindRenderbuffer(n.RENDERBUFFER,R),y.depthBuffer){const se=y.depthTexture,re=se&&se.isDepthTexture?se.type:null,ve=x(y.stencilBuffer,re),Ae=y.stencilBuffer?n.DEPTH_STENCIL_ATTACHMENT:n.DEPTH_ATTACHMENT;es(y)?o.renderbufferStorageMultisampleEXT(n.RENDERBUFFER,Qt(y),ve,y.width,y.height):K?n.renderbufferStorageMultisample(n.RENDERBUFFER,Qt(y),ve,y.width,y.height):n.renderbufferStorage(n.RENDERBUFFER,ve,y.width,y.height),n.framebufferRenderbuffer(n.FRAMEBUFFER,Ae,n.RENDERBUFFER,R)}else{const se=y.textures;for(let re=0;re<se.length;re++){const ve=se[re],Ae=r.convert(ve.format,ve.colorSpace),oe=r.convert(ve.type),he=w(ve.internalFormat,Ae,oe,ve.normalized,ve.colorSpace);es(y)?o.renderbufferStorageMultisampleEXT(n.RENDERBUFFER,Qt(y),he,y.width,y.height):K?n.renderbufferStorageMultisample(n.RENDERBUFFER,Qt(y),he,y.width,y.height):n.renderbufferStorage(n.RENDERBUFFER,he,y.width,y.height)}}n.bindRenderbuffer(n.RENDERBUFFER,null)}function gt(R,y,K){const se=y.isWebGLCubeRenderTarget===!0;if(t.bindFramebuffer(n.FRAMEBUFFER,R),!(y.depthTexture&&y.depthTexture.isDepthTexture))throw new Error("THREE.WebGLTextures: renderTarget.depthTexture must be an instance of THREE.DepthTexture.");const re=s.get(y.depthTexture);if(re.__renderTarget=y,(!re.__webglTexture||y.depthTexture.image.width!==y.width||y.depthTexture.image.height!==y.height)&&(y.depthTexture.image.width=y.width,y.depthTexture.image.height=y.height,y.depthTexture.needsUpdate=!0),se){if(re.__webglInit===void 0&&(re.__webglInit=!0,y.depthTexture.addEventListener("dispose",I)),re.__webglTexture===void 0){re.__webglTexture=n.createTexture(),t.bindTexture(n.TEXTURE_CUBE_MAP,re.__webglTexture),Ve(n.TEXTURE_CUBE_MAP,y.depthTexture);const Se=r.convert(y.depthTexture.format),He=r.convert(y.depthTexture.type);let De;y.depthTexture.format===si?De=n.DEPTH_COMPONENT24:y.depthTexture.format===ji&&(De=n.DEPTH24_STENCIL8);for(let Ie=0;Ie<6;Ie++)n.texImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+Ie,0,De,y.width,y.height,0,Se,He,null)}}else Q(y.depthTexture,0);const ve=re.__webglTexture,Ae=Qt(y),oe=se?n.TEXTURE_CUBE_MAP_POSITIVE_X+K:n.TEXTURE_2D,he=y.depthTexture.format===ji?n.DEPTH_STENCIL_ATTACHMENT:n.DEPTH_ATTACHMENT;if(y.depthTexture.format===si)es(y)?o.framebufferTexture2DMultisampleEXT(n.FRAMEBUFFER,he,oe,ve,0,Ae):n.framebufferTexture2D(n.FRAMEBUFFER,he,oe,ve,0);else if(y.depthTexture.format===ji)es(y)?o.framebufferTexture2DMultisampleEXT(n.FRAMEBUFFER,he,oe,ve,0,Ae):n.framebufferTexture2D(n.FRAMEBUFFER,he,oe,ve,0);else throw new Error("THREE.WebGLTextures: Unknown depthTexture format.")}function Rt(R){const y=s.get(R),K=R.isWebGLCubeRenderTarget===!0;if(y.__boundDepthTexture!==R.depthTexture){const se=R.depthTexture;if(y.__depthDisposeCallback&&y.__depthDisposeCallback(),se){const re=()=>{delete y.__boundDepthTexture,delete y.__depthDisposeCallback,se.removeEventListener("dispose",re)};se.addEventListener("dispose",re),y.__depthDisposeCallback=re}y.__boundDepthTexture=se}if(R.depthTexture&&!y.__autoAllocateDepthBuffer)if(K)for(let se=0;se<6;se++)gt(y.__webglFramebuffer[se],R,se);else{const se=R.texture.mipmaps;se&&se.length>0?gt(y.__webglFramebuffer[0],R,0):gt(y.__webglFramebuffer,R,0)}else if(K){y.__webglDepthbuffer=[];for(let se=0;se<6;se++)if(t.bindFramebuffer(n.FRAMEBUFFER,y.__webglFramebuffer[se]),y.__webglDepthbuffer[se]===void 0)y.__webglDepthbuffer[se]=n.createRenderbuffer(),Zt(y.__webglDepthbuffer[se],R,!1);else{const re=R.stencilBuffer?n.DEPTH_STENCIL_ATTACHMENT:n.DEPTH_ATTACHMENT,ve=y.__webglDepthbuffer[se];n.bindRenderbuffer(n.RENDERBUFFER,ve),n.framebufferRenderbuffer(n.FRAMEBUFFER,re,n.RENDERBUFFER,ve)}}else{const se=R.texture.mipmaps;if(se&&se.length>0?t.bindFramebuffer(n.FRAMEBUFFER,y.__webglFramebuffer[0]):t.bindFramebuffer(n.FRAMEBUFFER,y.__webglFramebuffer),y.__webglDepthbuffer===void 0)y.__webglDepthbuffer=n.createRenderbuffer(),Zt(y.__webglDepthbuffer,R,!1);else{const re=R.stencilBuffer?n.DEPTH_STENCIL_ATTACHMENT:n.DEPTH_ATTACHMENT,ve=y.__webglDepthbuffer;n.bindRenderbuffer(n.RENDERBUFFER,ve),n.framebufferRenderbuffer(n.FRAMEBUFFER,re,n.RENDERBUFFER,ve)}}t.bindFramebuffer(n.FRAMEBUFFER,null)}function it(R,y,K){const se=s.get(R);y!==void 0&&Qe(se.__webglFramebuffer,R,R.texture,n.COLOR_ATTACHMENT0,n.TEXTURE_2D,0),K!==void 0&&Rt(R)}function yt(R){const y=R.texture,K=s.get(R),se=s.get(y);R.addEventListener("dispose",b);const re=R.textures,ve=R.isWebGLCubeRenderTarget===!0,Ae=re.length>1;if(Ae||(se.__webglTexture===void 0&&(se.__webglTexture=n.createTexture()),se.__version=y.version,a.memory.textures++),ve){K.__webglFramebuffer=[];for(let oe=0;oe<6;oe++)if(y.mipmaps&&y.mipmaps.length>0){K.__webglFramebuffer[oe]=[];for(let he=0;he<y.mipmaps.length;he++)K.__webglFramebuffer[oe][he]=n.createFramebuffer()}else K.__webglFramebuffer[oe]=n.createFramebuffer()}else{if(y.mipmaps&&y.mipmaps.length>0){K.__webglFramebuffer=[];for(let oe=0;oe<y.mipmaps.length;oe++)K.__webglFramebuffer[oe]=n.createFramebuffer()}else K.__webglFramebuffer=n.createFramebuffer();if(Ae)for(let oe=0,he=re.length;oe<he;oe++){const Se=s.get(re[oe]);Se.__webglTexture===void 0&&(Se.__webglTexture=n.createTexture(),a.memory.textures++)}if(R.samples>0&&es(R)===!1){K.__webglMultisampledFramebuffer=n.createFramebuffer(),K.__webglColorRenderbuffer=[],t.bindFramebuffer(n.FRAMEBUFFER,K.__webglMultisampledFramebuffer);for(let oe=0;oe<re.length;oe++){const he=re[oe];K.__webglColorRenderbuffer[oe]=n.createRenderbuffer(),n.bindRenderbuffer(n.RENDERBUFFER,K.__webglColorRenderbuffer[oe]);const Se=r.convert(he.format,he.colorSpace),He=r.convert(he.type),De=w(he.internalFormat,Se,He,he.normalized,he.colorSpace,R.isXRRenderTarget===!0),Ie=Qt(R);n.renderbufferStorageMultisample(n.RENDERBUFFER,Ie,De,R.width,R.height),n.framebufferRenderbuffer(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0+oe,n.RENDERBUFFER,K.__webglColorRenderbuffer[oe])}n.bindRenderbuffer(n.RENDERBUFFER,null),R.depthBuffer&&(K.__webglDepthRenderbuffer=n.createRenderbuffer(),Zt(K.__webglDepthRenderbuffer,R,!0)),t.bindFramebuffer(n.FRAMEBUFFER,null)}}if(ve){t.bindTexture(n.TEXTURE_CUBE_MAP,se.__webglTexture),Ve(n.TEXTURE_CUBE_MAP,y);for(let oe=0;oe<6;oe++)if(y.mipmaps&&y.mipmaps.length>0)for(let he=0;he<y.mipmaps.length;he++)Qe(K.__webglFramebuffer[oe][he],R,y,n.COLOR_ATTACHMENT0,n.TEXTURE_CUBE_MAP_POSITIVE_X+oe,he);else Qe(K.__webglFramebuffer[oe],R,y,n.COLOR_ATTACHMENT0,n.TEXTURE_CUBE_MAP_POSITIVE_X+oe,0);f(y)&&_(n.TEXTURE_CUBE_MAP),t.unbindTexture()}else if(Ae){for(let oe=0,he=re.length;oe<he;oe++){const Se=re[oe],He=s.get(Se);let De=n.TEXTURE_2D;(R.isWebGL3DRenderTarget||R.isWebGLArrayRenderTarget)&&(De=R.isWebGL3DRenderTarget?n.TEXTURE_3D:n.TEXTURE_2D_ARRAY),t.bindTexture(De,He.__webglTexture),Ve(De,Se),Qe(K.__webglFramebuffer,R,Se,n.COLOR_ATTACHMENT0+oe,De,0),f(Se)&&_(De)}t.unbindTexture()}else{let oe=n.TEXTURE_2D;if((R.isWebGL3DRenderTarget||R.isWebGLArrayRenderTarget)&&(oe=R.isWebGL3DRenderTarget?n.TEXTURE_3D:n.TEXTURE_2D_ARRAY),t.bindTexture(oe,se.__webglTexture),Ve(oe,y),y.mipmaps&&y.mipmaps.length>0)for(let he=0;he<y.mipmaps.length;he++)Qe(K.__webglFramebuffer[he],R,y,n.COLOR_ATTACHMENT0,oe,he);else Qe(K.__webglFramebuffer,R,y,n.COLOR_ATTACHMENT0,oe,0);f(y)&&_(oe),t.unbindTexture()}R.depthBuffer&&Rt(R)}function ns(R){const y=R.textures;for(let K=0,se=y.length;K<se;K++){const re=y[K];if(f(re)){const ve=O(R),Ae=s.get(re).__webglTexture;t.bindTexture(ve,Ae),_(ve),t.unbindTexture()}}}const Ut=[],rs=[];function as(R){if(R.samples>0){if(es(R)===!1){const y=R.textures,K=R.width,se=R.height;let re=n.COLOR_BUFFER_BIT;const ve=R.stencilBuffer?n.DEPTH_STENCIL_ATTACHMENT:n.DEPTH_ATTACHMENT,Ae=s.get(R),oe=y.length>1;if(oe)for(let Se=0;Se<y.length;Se++)t.bindFramebuffer(n.FRAMEBUFFER,Ae.__webglMultisampledFramebuffer),n.framebufferRenderbuffer(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0+Se,n.RENDERBUFFER,null),t.bindFramebuffer(n.FRAMEBUFFER,Ae.__webglFramebuffer),n.framebufferTexture2D(n.DRAW_FRAMEBUFFER,n.COLOR_ATTACHMENT0+Se,n.TEXTURE_2D,null,0);t.bindFramebuffer(n.READ_FRAMEBUFFER,Ae.__webglMultisampledFramebuffer);const he=R.texture.mipmaps;he&&he.length>0?t.bindFramebuffer(n.DRAW_FRAMEBUFFER,Ae.__webglFramebuffer[0]):t.bindFramebuffer(n.DRAW_FRAMEBUFFER,Ae.__webglFramebuffer);for(let Se=0;Se<y.length;Se++){if(R.resolveDepthBuffer&&(R.depthBuffer&&(re|=n.DEPTH_BUFFER_BIT),R.stencilBuffer&&R.resolveStencilBuffer&&(re|=n.STENCIL_BUFFER_BIT)),oe){n.framebufferRenderbuffer(n.READ_FRAMEBUFFER,n.COLOR_ATTACHMENT0,n.RENDERBUFFER,Ae.__webglColorRenderbuffer[Se]);const He=s.get(y[Se]).__webglTexture;n.framebufferTexture2D(n.DRAW_FRAMEBUFFER,n.COLOR_ATTACHMENT0,n.TEXTURE_2D,He,0)}n.blitFramebuffer(0,0,K,se,0,0,K,se,re,n.NEAREST),l===!0&&(Ut.length=0,rs.length=0,Ut.push(n.COLOR_ATTACHMENT0+Se),R.depthBuffer&&R.resolveDepthBuffer===!1&&(Ut.push(ve),rs.push(ve),n.invalidateFramebuffer(n.DRAW_FRAMEBUFFER,rs)),n.invalidateFramebuffer(n.READ_FRAMEBUFFER,Ut))}if(t.bindFramebuffer(n.READ_FRAMEBUFFER,null),t.bindFramebuffer(n.DRAW_FRAMEBUFFER,null),oe)for(let Se=0;Se<y.length;Se++){t.bindFramebuffer(n.FRAMEBUFFER,Ae.__webglMultisampledFramebuffer),n.framebufferRenderbuffer(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0+Se,n.RENDERBUFFER,Ae.__webglColorRenderbuffer[Se]);const He=s.get(y[Se]).__webglTexture;t.bindFramebuffer(n.FRAMEBUFFER,Ae.__webglFramebuffer),n.framebufferTexture2D(n.DRAW_FRAMEBUFFER,n.COLOR_ATTACHMENT0+Se,n.TEXTURE_2D,He,0)}t.bindFramebuffer(n.DRAW_FRAMEBUFFER,Ae.__webglMultisampledFramebuffer)}else if(R.depthBuffer&&R.resolveDepthBuffer===!1&&l){const y=R.stencilBuffer?n.DEPTH_STENCIL_ATTACHMENT:n.DEPTH_ATTACHMENT;n.invalidateFramebuffer(n.DRAW_FRAMEBUFFER,[y])}}}function Qt(R){return Math.min(i.maxSamples,R.samples)}function es(R){const y=s.get(R);return R.samples>0&&e.has("WEBGL_multisampled_render_to_texture")===!0&&y.__useRenderToTexture!==!1}function q(R){const y=a.render.frame;d.get(R)!==y&&(d.set(R,y),R.update())}function Os(R,y){const K=R.colorSpace,se=R.format,re=R.type;return R.isCompressedTexture===!0||R.isVideoTexture===!0||K!==dl&&K!==bi&&(xt.getTransfer(K)===kt?(se!==bn||re!==Zs)&&st("WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):Ot("WebGLTextures: Unsupported texture color space:",K)),y}function Bt(R){return typeof HTMLImageElement<"u"&&R instanceof HTMLImageElement?(c.width=R.naturalWidth||R.width,c.height=R.naturalHeight||R.height):typeof VideoFrame<"u"&&R instanceof VideoFrame?(c.width=R.displayWidth,c.height=R.displayHeight):(c.width=R.width,c.height=R.height),c}this.allocateTextureUnit=W,this.resetTextureUnits=L,this.getTextureUnits=F,this.setTextureUnits=P,this.setTexture2D=Q,this.setTexture2DArray=ie,this.setTexture3D=be,this.setTextureCube=ae,this.rebindTextures=it,this.setupRenderTarget=yt,this.updateRenderTargetMipmap=ns,this.updateMultisampleRenderTarget=as,this.setupDepthRenderbuffer=Rt,this.setupFrameBufferTexture=Qe,this.useMultisampledRTT=es,this.isReversedDepthBuffer=function(){return t.buffers.depth.getReversed()}}function ex(n,e){function t(s,i=bi){let r;const a=xt.getTransfer(i);if(s===Zs)return n.UNSIGNED_BYTE;if(s===mu)return n.UNSIGNED_SHORT_4_4_4_4;if(s===gu)return n.UNSIGNED_SHORT_5_5_5_1;if(s===Pm)return n.UNSIGNED_INT_5_9_9_9_REV;if(s===Lm)return n.UNSIGNED_INT_10F_11F_11F_REV;if(s===Nm)return n.BYTE;if(s===Cm)return n.SHORT;if(s===La)return n.UNSIGNED_SHORT;if(s===pu)return n.INT;if(s===Gn)return n.UNSIGNED_INT;if(s===Mn)return n.FLOAT;if(s===ti)return n.HALF_FLOAT;if(s===Wm)return n.ALPHA;if(s===km)return n.RGB;if(s===bn)return n.RGBA;if(s===si)return n.DEPTH_COMPONENT;if(s===ji)return n.DEPTH_STENCIL;if(s===Mu)return n.RED;if(s===bu)return n.RED_INTEGER;if(s===er)return n.RG;if(s===zu)return n.RG_INTEGER;if(s===_u)return n.RGBA_INTEGER;if(s===Lo||s===Wo||s===ko||s===Uo)if(a===kt)if(r=e.get("WEBGL_compressed_texture_s3tc_srgb"),r!==null){if(s===Lo)return r.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(s===Wo)return r.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(s===ko)return r.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(s===Uo)return r.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(r=e.get("WEBGL_compressed_texture_s3tc"),r!==null){if(s===Lo)return r.COMPRESSED_RGB_S3TC_DXT1_EXT;if(s===Wo)return r.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(s===ko)return r.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(s===Uo)return r.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(s===bd||s===zd||s===_d||s===wd)if(r=e.get("WEBGL_compressed_texture_pvrtc"),r!==null){if(s===bd)return r.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(s===zd)return r.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(s===_d)return r.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(s===wd)return r.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(s===yd||s===vd||s===Od||s===xd||s===Sd||s===ll||s===Ad)if(r=e.get("WEBGL_compressed_texture_etc"),r!==null){if(s===yd||s===vd)return a===kt?r.COMPRESSED_SRGB8_ETC2:r.COMPRESSED_RGB8_ETC2;if(s===Od)return a===kt?r.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:r.COMPRESSED_RGBA8_ETC2_EAC;if(s===xd)return r.COMPRESSED_R11_EAC;if(s===Sd)return r.COMPRESSED_SIGNED_R11_EAC;if(s===ll)return r.COMPRESSED_RG11_EAC;if(s===Ad)return r.COMPRESSED_SIGNED_RG11_EAC}else return null;if(s===Ed||s===Dd||s===Id||s===Td||s===Gd||s===Rd||s===Bd||s===Nd||s===Cd||s===Pd||s===Ld||s===Wd||s===kd||s===Ud)if(r=e.get("WEBGL_compressed_texture_astc"),r!==null){if(s===Ed)return a===kt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:r.COMPRESSED_RGBA_ASTC_4x4_KHR;if(s===Dd)return a===kt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:r.COMPRESSED_RGBA_ASTC_5x4_KHR;if(s===Id)return a===kt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:r.COMPRESSED_RGBA_ASTC_5x5_KHR;if(s===Td)return a===kt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:r.COMPRESSED_RGBA_ASTC_6x5_KHR;if(s===Gd)return a===kt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:r.COMPRESSED_RGBA_ASTC_6x6_KHR;if(s===Rd)return a===kt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:r.COMPRESSED_RGBA_ASTC_8x5_KHR;if(s===Bd)return a===kt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:r.COMPRESSED_RGBA_ASTC_8x6_KHR;if(s===Nd)return a===kt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:r.COMPRESSED_RGBA_ASTC_8x8_KHR;if(s===Cd)return a===kt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:r.COMPRESSED_RGBA_ASTC_10x5_KHR;if(s===Pd)return a===kt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:r.COMPRESSED_RGBA_ASTC_10x6_KHR;if(s===Ld)return a===kt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:r.COMPRESSED_RGBA_ASTC_10x8_KHR;if(s===Wd)return a===kt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:r.COMPRESSED_RGBA_ASTC_10x10_KHR;if(s===kd)return a===kt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:r.COMPRESSED_RGBA_ASTC_12x10_KHR;if(s===Ud)return a===kt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:r.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(s===Fd||s===jd||s===$d)if(r=e.get("EXT_texture_compression_bptc"),r!==null){if(s===Fd)return a===kt?r.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:r.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(s===jd)return r.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(s===$d)return r.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(s===Vd||s===Hd||s===cl||s===qd)if(r=e.get("EXT_texture_compression_rgtc"),r!==null){if(s===Vd)return r.COMPRESSED_RED_RGTC1_EXT;if(s===Hd)return r.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(s===cl)return r.COMPRESSED_RED_GREEN_RGTC2_EXT;if(s===qd)return r.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return s===Wa?n.UNSIGNED_INT_24_8:n[s]!==void 0?n[s]:null}return{convert:t}}const tx=`
4085
+ }`,YO=[new F(1,0,0),new F(-1,0,0),new F(0,1,0),new F(0,-1,0),new F(0,0,1),new F(0,0,-1)],KO=[new F(0,-1,0),new F(0,-1,0),new F(0,0,1),new F(0,0,-1),new F(0,-1,0),new F(0,-1,0)],wf=new Gt,_a=new F,Oc=new F;function ZO(n,e,t){let s=new Eu;const i=new lt,r=new lt,a=new ts,o=new r_,l=new a_,c={},d=t.maxTextureSize,u={[Ei]:ks,[ks]:Ei,[Hn]:Hn},h=new hs({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new lt},radius:{value:4}},vertexShader:qO,fragmentShader:XO}),g=h.clone();g.defines.HORIZONTAL_PASS=1;const p=new ds;p.setAttribute("position",new ws(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const z=new Us(p,h),m=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=Po;let f=this.type;this.render=function(S,I,b){if(m.enabled===!1||m.autoUpdate===!1&&m.needsUpdate===!1||S.length===0)return;this.type===H0&&(st("WebGLShadowMap: PCFSoftShadowMap has been deprecated. Using PCFShadowMap instead."),this.type=Po);const A=n.getRenderTarget(),B=n.getActiveCubeFace(),N=n.getActiveMipmapLevel(),k=n.state;k.setBlending(Zn),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 L=f!==this.type;L&&I.traverse(function(j){j.material&&(Array.isArray(j.material)?j.material.forEach(P=>P.needsUpdate=!0):j.material.needsUpdate=!0)});for(let j=0,P=S.length;j<P;j++){const W=S[j],X=W.shadow;if(X===void 0){st("WebGLShadowMap:",W,"has no shadow.");continue}if(X.autoUpdate===!1&&X.needsUpdate===!1)continue;i.copy(X.mapSize);const Q=X.getFrameExtents();i.multiply(Q),r.copy(X.mapSize),(i.x>d||i.y>d)&&(i.x>d&&(r.x=Math.floor(d/Q.x),i.x=r.x*Q.x,X.mapSize.x=r.x),i.y>d&&(r.y=Math.floor(d/Q.y),i.y=r.y*Q.y,X.mapSize.y=r.y));const re=n.state.buffers.depth.getReversed();if(X.camera._reversedDepth=re,X.map===null||L===!0){if(X.map!==null&&(X.map.depthTexture!==null&&(X.map.depthTexture.dispose(),X.map.depthTexture=null),X.map.dispose()),this.type===Ea){if(W.isPointLight){st("WebGLShadowMap: VSM shadow maps are not supported for PointLights. Use PCF or BasicShadowMap instead.");continue}X.map=new In(i.x,i.y,{format:er,type:ti,minFilter:Ds,magFilter:Ds,generateMipmaps:!1}),X.map.texture.name=W.name+".shadowMap",X.map.depthTexture=new qr(i.x,i.y,Mn),X.map.depthTexture.name=W.name+".shadowMapDepth",X.map.depthTexture.format=si,X.map.depthTexture.compareFunction=null,X.map.depthTexture.minFilter=ys,X.map.depthTexture.magFilter=ys}else W.isPointLight?(X.map=new ng(i.x),X.map.depthTexture=new Jz(i.x,Gn)):(X.map=new In(i.x,i.y),X.map.depthTexture=new qr(i.x,i.y,Gn)),X.map.depthTexture.name=W.name+".shadowMap",X.map.depthTexture.format=si,this.type===Po?(X.map.depthTexture.compareFunction=re?yu:wu,X.map.depthTexture.minFilter=Ds,X.map.depthTexture.magFilter=Ds):(X.map.depthTexture.compareFunction=null,X.map.depthTexture.minFilter=ys,X.map.depthTexture.magFilter=ys);X.camera.updateProjectionMatrix()}const Me=X.map.isWebGLCubeRenderTarget?6:1;for(let oe=0;oe<Me;oe++){if(X.map.isWebGLCubeRenderTarget)n.setRenderTarget(X.map,oe),n.clear();else{oe===0&&(n.setRenderTarget(X.map),n.clear());const Oe=X.getViewport(oe);a.set(r.x*Oe.x,r.y*Oe.y,r.x*Oe.z,r.y*Oe.w),k.viewport(a)}if(W.isPointLight){const Oe=X.camera,Ke=X.matrix,nt=W.distance||Oe.far;nt!==Oe.far&&(Oe.far=nt,Oe.updateProjectionMatrix()),_a.setFromMatrixPosition(W.matrixWorld),Oe.position.copy(_a),Oc.copy(Oe.position),Oc.add(YO[oe]),Oe.up.copy(KO[oe]),Oe.lookAt(Oc),Oe.updateMatrixWorld(),Ke.makeTranslation(-_a.x,-_a.y,-_a.z),wf.multiplyMatrices(Oe.projectionMatrix,Oe.matrixWorldInverse),X._frustum.setFromProjectionMatrix(wf,Oe.coordinateSystem,Oe.reversedDepth)}else X.updateMatrices(W);s=X.getFrustum(),w(I,b,X.camera,W,this.type)}X.isPointLightShadow!==!0&&this.type===Ea&&_(X,b),X.needsUpdate=!1}f=this.type,m.needsUpdate=!1,n.setRenderTarget(A,B,N)};function _(S,I){const b=e.update(z);h.defines.VSM_SAMPLES!==S.blurSamples&&(h.defines.VSM_SAMPLES=S.blurSamples,g.defines.VSM_SAMPLES=S.blurSamples,h.needsUpdate=!0,g.needsUpdate=!0),S.mapPass===null&&(S.mapPass=new In(i.x,i.y,{format:er,type:ti})),h.uniforms.shadow_pass.value=S.map.depthTexture,h.uniforms.resolution.value=S.mapSize,h.uniforms.radius.value=S.radius,n.setRenderTarget(S.mapPass),n.clear(),n.renderBufferDirect(I,null,b,h,z,null),g.uniforms.shadow_pass.value=S.mapPass.texture,g.uniforms.resolution.value=S.mapSize,g.uniforms.radius.value=S.radius,n.setRenderTarget(S.map),n.clear(),n.renderBufferDirect(I,null,b,g,z,null)}function O(S,I,b,A){let B=null;const N=b.isPointLight===!0?S.customDistanceMaterial:S.customDepthMaterial;if(N!==void 0)B=N;else if(B=b.isPointLight===!0?l:o,n.localClippingEnabled&&I.clipShadows===!0&&Array.isArray(I.clippingPlanes)&&I.clippingPlanes.length!==0||I.displacementMap&&I.displacementScale!==0||I.alphaMap&&I.alphaTest>0||I.map&&I.alphaTest>0||I.alphaToCoverage===!0){const k=B.uuid,L=I.uuid;let j=c[k];j===void 0&&(j={},c[k]=j);let P=j[L];P===void 0&&(P=B.clone(),j[L]=P,I.addEventListener("dispose",x)),B=P}if(B.visible=I.visible,B.wireframe=I.wireframe,A===Ea?B.side=I.shadowSide!==null?I.shadowSide:I.side:B.side=I.shadowSide!==null?I.shadowSide:u[I.side],B.alphaMap=I.alphaMap,B.alphaTest=I.alphaToCoverage===!0?.5:I.alphaTest,B.map=I.map,B.clipShadows=I.clipShadows,B.clippingPlanes=I.clippingPlanes,B.clipIntersection=I.clipIntersection,B.displacementMap=I.displacementMap,B.displacementScale=I.displacementScale,B.displacementBias=I.displacementBias,B.wireframeLinewidth=I.wireframeLinewidth,B.linewidth=I.linewidth,b.isPointLight===!0&&B.isMeshDistanceMaterial===!0){const k=n.properties.get(B);k.light=b}return B}function w(S,I,b,A,B){if(S.visible===!1)return;if(S.layers.test(I.layers)&&(S.isMesh||S.isLine||S.isPoints)&&(S.castShadow||S.receiveShadow&&B===Ea)&&(!S.frustumCulled||s.intersectsObject(S))){S.modelViewMatrix.multiplyMatrices(b.matrixWorldInverse,S.matrixWorld);const L=e.update(S),j=S.material;if(Array.isArray(j)){const P=L.groups;for(let W=0,X=P.length;W<X;W++){const Q=P[W],re=j[Q.materialIndex];if(re&&re.visible){const Me=O(S,re,A,B);S.onBeforeShadow(n,S,I,b,L,Me,Q),n.renderBufferDirect(b,null,L,Me,S,Q),S.onAfterShadow(n,S,I,b,L,Me,Q)}}}else if(j.visible){const P=O(S,j,A,B);S.onBeforeShadow(n,S,I,b,L,P,null),n.renderBufferDirect(b,null,L,P,S,null),S.onAfterShadow(n,S,I,b,L,P,null)}}const k=S.children;for(let L=0,j=k.length;L<j;L++)w(k[L],I,b,A,B)}function x(S){S.target.removeEventListener("dispose",x);for(const b in c){const A=c[b],B=S.target.uuid;B in A&&(A[B].dispose(),delete A[B])}}}function QO(n,e){function t(){let V=!1;const Ee=new ts;let de=null;const Te=new ts(0,0,0,0);return{setMask:function(Ne){de!==Ne&&!V&&(n.colorMask(Ne,Ne,Ne,Ne),de=Ne)},setLocked:function(Ne){V=Ne},setClear:function(Ne,pe,Pe,Ue,Vt){Vt===!0&&(Ne*=Ue,pe*=Ue,Pe*=Ue),Ee.set(Ne,pe,Pe,Ue),Te.equals(Ee)===!1&&(n.clearColor(Ne,pe,Pe,Ue),Te.copy(Ee))},reset:function(){V=!1,de=null,Te.set(-1,0,0,0)}}}function s(){let V=!1,Ee=!1,de=null,Te=null,Ne=null;return{setReversed:function(pe){if(Ee!==pe){const Pe=e.get("EXT_clip_control");pe?Pe.clipControlEXT(Pe.LOWER_LEFT_EXT,Pe.ZERO_TO_ONE_EXT):Pe.clipControlEXT(Pe.LOWER_LEFT_EXT,Pe.NEGATIVE_ONE_TO_ONE_EXT),Ee=pe;const Ue=Ne;Ne=null,this.setClear(Ue)}},getReversed:function(){return Ee},setTest:function(pe){pe?fe(n.DEPTH_TEST):et(n.DEPTH_TEST)},setMask:function(pe){de!==pe&&!V&&(n.depthMask(pe),de=pe)},setFunc:function(pe){if(Ee&&(pe=xz[pe]),Te!==pe){switch(pe){case cd:n.depthFunc(n.NEVER);break;case dd:n.depthFunc(n.ALWAYS);break;case ud:n.depthFunc(n.LESS);break;case $r:n.depthFunc(n.LEQUAL);break;case hd:n.depthFunc(n.EQUAL);break;case fd:n.depthFunc(n.GEQUAL);break;case pd:n.depthFunc(n.GREATER);break;case md:n.depthFunc(n.NOTEQUAL);break;default:n.depthFunc(n.LEQUAL)}Te=pe}},setLocked:function(pe){V=pe},setClear:function(pe){Ne!==pe&&(Ne=pe,Ee&&(pe=1-pe),n.clearDepth(pe))},reset:function(){V=!1,de=null,Te=null,Ne=null,Ee=!1}}}function i(){let V=!1,Ee=null,de=null,Te=null,Ne=null,pe=null,Pe=null,Ue=null,Vt=null;return{setTest:function(Nt){V||(Nt?fe(n.STENCIL_TEST):et(n.STENCIL_TEST))},setMask:function(Nt){Ee!==Nt&&!V&&(n.stencilMask(Nt),Ee=Nt)},setFunc:function(Nt,js,Ls){(de!==Nt||Te!==js||Ne!==Ls)&&(n.stencilFunc(Nt,js,Ls),de=Nt,Te=js,Ne=Ls)},setOp:function(Nt,js,Ls){(pe!==Nt||Pe!==js||Ue!==Ls)&&(n.stencilOp(Nt,js,Ls),pe=Nt,Pe=js,Ue=Ls)},setLocked:function(Nt){V=Nt},setClear:function(Nt){Vt!==Nt&&(n.clearStencil(Nt),Vt=Nt)},reset:function(){V=!1,Ee=null,de=null,Te=null,Ne=null,pe=null,Pe=null,Ue=null,Vt=null}}}const r=new t,a=new s,o=new i,l=new WeakMap,c=new WeakMap;let d={},u={},h={},g=new WeakMap,p=[],z=null,m=!1,f=null,_=null,O=null,w=null,x=null,S=null,I=null,b=new Ye(0,0,0),A=0,B=!1,N=null,k=null,L=null,j=null,P=null;const W=n.getParameter(n.MAX_COMBINED_TEXTURE_IMAGE_UNITS);let X=!1,Q=0;const re=n.getParameter(n.VERSION);re.indexOf("WebGL")!==-1?(Q=parseFloat(/^WebGL (\d)/.exec(re)[1]),X=Q>=1):re.indexOf("OpenGL ES")!==-1&&(Q=parseFloat(/^OpenGL ES (\d)/.exec(re)[1]),X=Q>=2);let Me=null,oe={};const Oe=n.getParameter(n.SCISSOR_BOX),Ke=n.getParameter(n.VIEWPORT),nt=new ts().fromArray(Oe),je=new ts().fromArray(Ke);function ce(V,Ee,de,Te){const Ne=new Uint8Array(4),pe=n.createTexture();n.bindTexture(V,pe),n.texParameteri(V,n.TEXTURE_MIN_FILTER,n.NEAREST),n.texParameteri(V,n.TEXTURE_MAG_FILTER,n.NEAREST);for(let Pe=0;Pe<de;Pe++)V===n.TEXTURE_3D||V===n.TEXTURE_2D_ARRAY?n.texImage3D(Ee,0,n.RGBA,1,1,Te,0,n.RGBA,n.UNSIGNED_BYTE,Ne):n.texImage2D(Ee+Pe,0,n.RGBA,1,1,0,n.RGBA,n.UNSIGNED_BYTE,Ne);return pe}const ue={};ue[n.TEXTURE_2D]=ce(n.TEXTURE_2D,n.TEXTURE_2D,1),ue[n.TEXTURE_CUBE_MAP]=ce(n.TEXTURE_CUBE_MAP,n.TEXTURE_CUBE_MAP_POSITIVE_X,6),ue[n.TEXTURE_2D_ARRAY]=ce(n.TEXTURE_2D_ARRAY,n.TEXTURE_2D_ARRAY,1,1),ue[n.TEXTURE_3D]=ce(n.TEXTURE_3D,n.TEXTURE_3D,1,1),r.setClear(0,0,0,1),a.setClear(1),o.setClear(0),fe(n.DEPTH_TEST),a.setFunc($r),ns(!1),Ut(fh),fe(n.CULL_FACE),it(Zn);function fe(V){d[V]!==!0&&(n.enable(V),d[V]=!0)}function et(V){d[V]!==!1&&(n.disable(V),d[V]=!1)}function ct(V,Ee){return h[V]!==Ee?(n.bindFramebuffer(V,Ee),h[V]=Ee,V===n.DRAW_FRAMEBUFFER&&(h[n.FRAMEBUFFER]=Ee),V===n.FRAMEBUFFER&&(h[n.DRAW_FRAMEBUFFER]=Ee),!0):!1}function Qe(V,Ee){let de=p,Te=!1;if(V){de=g.get(Ee),de===void 0&&(de=[],g.set(Ee,de));const Ne=V.textures;if(de.length!==Ne.length||de[0]!==n.COLOR_ATTACHMENT0){for(let pe=0,Pe=Ne.length;pe<Pe;pe++)de[pe]=n.COLOR_ATTACHMENT0+pe;de.length=Ne.length,Te=!0}}else de[0]!==n.BACK&&(de[0]=n.BACK,Te=!0);Te&&n.drawBuffers(de)}function Zt(V){return z!==V?(n.useProgram(V),z=V,!0):!1}const gt={[Wi]:n.FUNC_ADD,[X0]:n.FUNC_SUBTRACT,[Y0]:n.FUNC_REVERSE_SUBTRACT};gt[K0]=n.MIN,gt[Z0]=n.MAX;const Rt={[Q0]:n.ZERO,[J0]:n.ONE,[ez]:n.SRC_COLOR,[od]:n.SRC_ALPHA,[az]:n.SRC_ALPHA_SATURATE,[iz]:n.DST_COLOR,[sz]:n.DST_ALPHA,[tz]:n.ONE_MINUS_SRC_COLOR,[ld]:n.ONE_MINUS_SRC_ALPHA,[rz]:n.ONE_MINUS_DST_COLOR,[nz]:n.ONE_MINUS_DST_ALPHA,[oz]:n.CONSTANT_COLOR,[lz]:n.ONE_MINUS_CONSTANT_COLOR,[cz]:n.CONSTANT_ALPHA,[dz]:n.ONE_MINUS_CONSTANT_ALPHA};function it(V,Ee,de,Te,Ne,pe,Pe,Ue,Vt,Nt){if(V===Zn){m===!0&&(et(n.BLEND),m=!1);return}if(m===!1&&(fe(n.BLEND),m=!0),V!==q0){if(V!==f||Nt!==B){if((_!==Wi||x!==Wi)&&(n.blendEquation(n.FUNC_ADD),_=Wi,x=Wi),Nt)switch(V){case $i:n.blendFuncSeparate(n.ONE,n.ONE_MINUS_SRC_ALPHA,n.ONE,n.ONE_MINUS_SRC_ALPHA);break;case Qi:n.blendFunc(n.ONE,n.ONE);break;case ph:n.blendFuncSeparate(n.ZERO,n.ONE_MINUS_SRC_COLOR,n.ZERO,n.ONE);break;case mh:n.blendFuncSeparate(n.DST_COLOR,n.ONE_MINUS_SRC_ALPHA,n.ZERO,n.ONE);break;default:Ot("WebGLState: Invalid blending: ",V);break}else switch(V){case $i:n.blendFuncSeparate(n.SRC_ALPHA,n.ONE_MINUS_SRC_ALPHA,n.ONE,n.ONE_MINUS_SRC_ALPHA);break;case Qi:n.blendFuncSeparate(n.SRC_ALPHA,n.ONE,n.ONE,n.ONE);break;case ph:Ot("WebGLState: SubtractiveBlending requires material.premultipliedAlpha = true");break;case mh:Ot("WebGLState: MultiplyBlending requires material.premultipliedAlpha = true");break;default:Ot("WebGLState: Invalid blending: ",V);break}O=null,w=null,S=null,I=null,b.set(0,0,0),A=0,f=V,B=Nt}return}Ne=Ne||Ee,pe=pe||de,Pe=Pe||Te,(Ee!==_||Ne!==x)&&(n.blendEquationSeparate(gt[Ee],gt[Ne]),_=Ee,x=Ne),(de!==O||Te!==w||pe!==S||Pe!==I)&&(n.blendFuncSeparate(Rt[de],Rt[Te],Rt[pe],Rt[Pe]),O=de,w=Te,S=pe,I=Pe),(Ue.equals(b)===!1||Vt!==A)&&(n.blendColor(Ue.r,Ue.g,Ue.b,Vt),b.copy(Ue),A=Vt),f=V,B=!1}function wt(V,Ee){V.side===Hn?et(n.CULL_FACE):fe(n.CULL_FACE);let de=V.side===ks;Ee&&(de=!de),ns(de),V.blending===$i&&V.transparent===!1?it(Zn):it(V.blending,V.blendEquation,V.blendSrc,V.blendDst,V.blendEquationAlpha,V.blendSrcAlpha,V.blendDstAlpha,V.blendColor,V.blendAlpha,V.premultipliedAlpha),a.setFunc(V.depthFunc),a.setTest(V.depthTest),a.setMask(V.depthWrite),r.setMask(V.colorWrite);const Te=V.stencilWrite;o.setTest(Te),Te&&(o.setMask(V.stencilWriteMask),o.setFunc(V.stencilFunc,V.stencilRef,V.stencilFuncMask),o.setOp(V.stencilFail,V.stencilZFail,V.stencilZPass)),as(V.polygonOffset,V.polygonOffsetFactor,V.polygonOffsetUnits),V.alphaToCoverage===!0?fe(n.SAMPLE_ALPHA_TO_COVERAGE):et(n.SAMPLE_ALPHA_TO_COVERAGE)}function ns(V){N!==V&&(V?n.frontFace(n.CW):n.frontFace(n.CCW),N=V)}function Ut(V){V!==$0?(fe(n.CULL_FACE),V!==k&&(V===fh?n.cullFace(n.BACK):V===V0?n.cullFace(n.FRONT):n.cullFace(n.FRONT_AND_BACK))):et(n.CULL_FACE),k=V}function rs(V){V!==L&&(X&&n.lineWidth(V),L=V)}function as(V,Ee,de){V?(fe(n.POLYGON_OFFSET_FILL),(j!==Ee||P!==de)&&(j=Ee,P=de,a.getReversed()&&(Ee=-Ee),n.polygonOffset(Ee,de))):et(n.POLYGON_OFFSET_FILL)}function Qt(V){V?fe(n.SCISSOR_TEST):et(n.SCISSOR_TEST)}function es(V){V===void 0&&(V=n.TEXTURE0+W-1),Me!==V&&(n.activeTexture(V),Me=V)}function q(V,Ee,de){de===void 0&&(Me===null?de=n.TEXTURE0+W-1:de=Me);let Te=oe[de];Te===void 0&&(Te={type:void 0,texture:void 0},oe[de]=Te),(Te.type!==V||Te.texture!==Ee)&&(Me!==de&&(n.activeTexture(de),Me=de),n.bindTexture(V,Ee||ue[V]),Te.type=V,Te.texture=Ee)}function Os(){const V=oe[Me];V!==void 0&&V.type!==void 0&&(n.bindTexture(V.type,null),V.type=void 0,V.texture=void 0)}function Bt(){try{n.compressedTexImage2D(...arguments)}catch(V){Ot("WebGLState:",V)}}function R(){try{n.compressedTexImage3D(...arguments)}catch(V){Ot("WebGLState:",V)}}function y(){try{n.texSubImage2D(...arguments)}catch(V){Ot("WebGLState:",V)}}function K(){try{n.texSubImage3D(...arguments)}catch(V){Ot("WebGLState:",V)}}function se(){try{n.compressedTexSubImage2D(...arguments)}catch(V){Ot("WebGLState:",V)}}function ae(){try{n.compressedTexSubImage3D(...arguments)}catch(V){Ot("WebGLState:",V)}}function ye(){try{n.texStorage2D(...arguments)}catch(V){Ot("WebGLState:",V)}}function Ae(){try{n.texStorage3D(...arguments)}catch(V){Ot("WebGLState:",V)}}function le(){try{n.texImage2D(...arguments)}catch(V){Ot("WebGLState:",V)}}function he(){try{n.texImage3D(...arguments)}catch(V){Ot("WebGLState:",V)}}function xe(V){return u[V]!==void 0?u[V]:n.getParameter(V)}function Ve(V,Ee){u[V]!==Ee&&(n.pixelStorei(V,Ee),u[V]=Ee)}function De(V){nt.equals(V)===!1&&(n.scissor(V.x,V.y,V.z,V.w),nt.copy(V))}function Ie(V){je.equals(V)===!1&&(n.viewport(V.x,V.y,V.z,V.w),je.copy(V))}function qe(V,Ee){let de=c.get(Ee);de===void 0&&(de=new WeakMap,c.set(Ee,de));let Te=de.get(V);Te===void 0&&(Te=n.getUniformBlockIndex(Ee,V.name),de.set(V,Te))}function Je(V,Ee){const Te=c.get(Ee).get(V);l.get(Ee)!==Te&&(n.uniformBlockBinding(Ee,Te,V.__bindingPointIndex),l.set(Ee,Te))}function dt(){n.disable(n.BLEND),n.disable(n.CULL_FACE),n.disable(n.DEPTH_TEST),n.disable(n.POLYGON_OFFSET_FILL),n.disable(n.SCISSOR_TEST),n.disable(n.STENCIL_TEST),n.disable(n.SAMPLE_ALPHA_TO_COVERAGE),n.blendEquation(n.FUNC_ADD),n.blendFunc(n.ONE,n.ZERO),n.blendFuncSeparate(n.ONE,n.ZERO,n.ONE,n.ZERO),n.blendColor(0,0,0,0),n.colorMask(!0,!0,!0,!0),n.clearColor(0,0,0,0),n.depthMask(!0),n.depthFunc(n.LESS),a.setReversed(!1),n.clearDepth(1),n.stencilMask(4294967295),n.stencilFunc(n.ALWAYS,0,4294967295),n.stencilOp(n.KEEP,n.KEEP,n.KEEP),n.clearStencil(0),n.cullFace(n.BACK),n.frontFace(n.CCW),n.polygonOffset(0,0),n.activeTexture(n.TEXTURE0),n.bindFramebuffer(n.FRAMEBUFFER,null),n.bindFramebuffer(n.DRAW_FRAMEBUFFER,null),n.bindFramebuffer(n.READ_FRAMEBUFFER,null),n.useProgram(null),n.lineWidth(1),n.scissor(0,0,n.canvas.width,n.canvas.height),n.viewport(0,0,n.canvas.width,n.canvas.height),n.pixelStorei(n.PACK_ALIGNMENT,4),n.pixelStorei(n.UNPACK_ALIGNMENT,4),n.pixelStorei(n.UNPACK_FLIP_Y_WEBGL,!1),n.pixelStorei(n.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),n.pixelStorei(n.UNPACK_COLORSPACE_CONVERSION_WEBGL,n.BROWSER_DEFAULT_WEBGL),n.pixelStorei(n.PACK_ROW_LENGTH,0),n.pixelStorei(n.PACK_SKIP_PIXELS,0),n.pixelStorei(n.PACK_SKIP_ROWS,0),n.pixelStorei(n.UNPACK_ROW_LENGTH,0),n.pixelStorei(n.UNPACK_IMAGE_HEIGHT,0),n.pixelStorei(n.UNPACK_SKIP_PIXELS,0),n.pixelStorei(n.UNPACK_SKIP_ROWS,0),n.pixelStorei(n.UNPACK_SKIP_IMAGES,0),d={},u={},Me=null,oe={},h={},g=new WeakMap,p=[],z=null,m=!1,f=null,_=null,O=null,w=null,x=null,S=null,I=null,b=new Ye(0,0,0),A=0,B=!1,N=null,k=null,L=null,j=null,P=null,nt.set(0,0,n.canvas.width,n.canvas.height),je.set(0,0,n.canvas.width,n.canvas.height),r.reset(),a.reset(),o.reset()}return{buffers:{color:r,depth:a,stencil:o},enable:fe,disable:et,bindFramebuffer:ct,drawBuffers:Qe,useProgram:Zt,setBlending:it,setMaterial:wt,setFlipSided:ns,setCullFace:Ut,setLineWidth:rs,setPolygonOffset:as,setScissorTest:Qt,activeTexture:es,bindTexture:q,unbindTexture:Os,compressedTexImage2D:Bt,compressedTexImage3D:R,texImage2D:le,texImage3D:he,pixelStorei:Ve,getParameter:xe,updateUBOMapping:qe,uniformBlockBinding:Je,texStorage2D:ye,texStorage3D:Ae,texSubImage2D:y,texSubImage3D:K,compressedTexSubImage2D:se,compressedTexSubImage3D:ae,scissor:De,viewport:Ie,reset:dt}}function JO(n,e,t,s,i,r,a){const o=e.has("WEBGL_multisampled_render_to_texture")?e.get("WEBGL_multisampled_render_to_texture"):null,l=typeof navigator>"u"?!1:/OculusBrowser/g.test(navigator.userAgent),c=new lt,d=new WeakMap,u=new Set;let h;const g=new WeakMap;let p=!1;try{p=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function z(R,y){return p?new OffscreenCanvas(R,y):hl("canvas")}function m(R,y,K){let se=1;const ae=Bt(R);if((ae.width>K||ae.height>K)&&(se=K/Math.max(ae.width,ae.height)),se<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 ye=Math.floor(se*ae.width),Ae=Math.floor(se*ae.height);h===void 0&&(h=z(ye,Ae));const le=y?z(ye,Ae):h;return le.width=ye,le.height=Ae,le.getContext("2d").drawImage(R,0,0,ye,Ae),st("WebGLRenderer: Texture has been resized from ("+ae.width+"x"+ae.height+") to ("+ye+"x"+Ae+")."),le}else return"data"in R&&st("WebGLRenderer: Image in DataTexture is too big ("+ae.width+"x"+ae.height+")."),R;return R}function f(R){return R.generateMipmaps}function _(R){n.generateMipmap(R)}function O(R){return R.isWebGLCubeRenderTarget?n.TEXTURE_CUBE_MAP:R.isWebGL3DRenderTarget?n.TEXTURE_3D:R.isWebGLArrayRenderTarget||R.isCompressedArrayTexture?n.TEXTURE_2D_ARRAY:n.TEXTURE_2D}function w(R,y,K,se,ae,ye=!1){if(R!==null){if(n[R]!==void 0)return n[R];st("WebGLRenderer: Attempt to use non-existing WebGL internal format '"+R+"'")}let Ae;se&&(Ae=e.get("EXT_texture_norm16"),Ae||st("WebGLRenderer: Unable to use normalized textures without EXT_texture_norm16 extension"));let le=y;if(y===n.RED&&(K===n.FLOAT&&(le=n.R32F),K===n.HALF_FLOAT&&(le=n.R16F),K===n.UNSIGNED_BYTE&&(le=n.R8),K===n.UNSIGNED_SHORT&&Ae&&(le=Ae.R16_EXT),K===n.SHORT&&Ae&&(le=Ae.R16_SNORM_EXT)),y===n.RED_INTEGER&&(K===n.UNSIGNED_BYTE&&(le=n.R8UI),K===n.UNSIGNED_SHORT&&(le=n.R16UI),K===n.UNSIGNED_INT&&(le=n.R32UI),K===n.BYTE&&(le=n.R8I),K===n.SHORT&&(le=n.R16I),K===n.INT&&(le=n.R32I)),y===n.RG&&(K===n.FLOAT&&(le=n.RG32F),K===n.HALF_FLOAT&&(le=n.RG16F),K===n.UNSIGNED_BYTE&&(le=n.RG8),K===n.UNSIGNED_SHORT&&Ae&&(le=Ae.RG16_EXT),K===n.SHORT&&Ae&&(le=Ae.RG16_SNORM_EXT)),y===n.RG_INTEGER&&(K===n.UNSIGNED_BYTE&&(le=n.RG8UI),K===n.UNSIGNED_SHORT&&(le=n.RG16UI),K===n.UNSIGNED_INT&&(le=n.RG32UI),K===n.BYTE&&(le=n.RG8I),K===n.SHORT&&(le=n.RG16I),K===n.INT&&(le=n.RG32I)),y===n.RGB_INTEGER&&(K===n.UNSIGNED_BYTE&&(le=n.RGB8UI),K===n.UNSIGNED_SHORT&&(le=n.RGB16UI),K===n.UNSIGNED_INT&&(le=n.RGB32UI),K===n.BYTE&&(le=n.RGB8I),K===n.SHORT&&(le=n.RGB16I),K===n.INT&&(le=n.RGB32I)),y===n.RGBA_INTEGER&&(K===n.UNSIGNED_BYTE&&(le=n.RGBA8UI),K===n.UNSIGNED_SHORT&&(le=n.RGBA16UI),K===n.UNSIGNED_INT&&(le=n.RGBA32UI),K===n.BYTE&&(le=n.RGBA8I),K===n.SHORT&&(le=n.RGBA16I),K===n.INT&&(le=n.RGBA32I)),y===n.RGB&&(K===n.UNSIGNED_SHORT&&Ae&&(le=Ae.RGB16_EXT),K===n.SHORT&&Ae&&(le=Ae.RGB16_SNORM_EXT),K===n.UNSIGNED_INT_5_9_9_9_REV&&(le=n.RGB9_E5),K===n.UNSIGNED_INT_10F_11F_11F_REV&&(le=n.R11F_G11F_B10F)),y===n.RGBA){const he=ye?ul:xt.getTransfer(ae);K===n.FLOAT&&(le=n.RGBA32F),K===n.HALF_FLOAT&&(le=n.RGBA16F),K===n.UNSIGNED_BYTE&&(le=he===kt?n.SRGB8_ALPHA8:n.RGBA8),K===n.UNSIGNED_SHORT&&Ae&&(le=Ae.RGBA16_EXT),K===n.SHORT&&Ae&&(le=Ae.RGBA16_SNORM_EXT),K===n.UNSIGNED_SHORT_4_4_4_4&&(le=n.RGBA4),K===n.UNSIGNED_SHORT_5_5_5_1&&(le=n.RGB5_A1)}return(le===n.R16F||le===n.R32F||le===n.RG16F||le===n.RG32F||le===n.RGBA16F||le===n.RGBA32F)&&e.get("EXT_color_buffer_float"),le}function x(R,y){let K;return R?y===null||y===Gn||y===Wa?K=n.DEPTH24_STENCIL8:y===Mn?K=n.DEPTH32F_STENCIL8:y===La&&(K=n.DEPTH24_STENCIL8,st("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.")):y===null||y===Gn||y===Wa?K=n.DEPTH_COMPONENT24:y===Mn?K=n.DEPTH_COMPONENT32F:y===La&&(K=n.DEPTH_COMPONENT16),K}function S(R,y){return f(R)===!0||R.isFramebufferTexture&&R.minFilter!==ys&&R.minFilter!==Ds?Math.log2(Math.max(y.width,y.height))+1:R.mipmaps!==void 0&&R.mipmaps.length>0?R.mipmaps.length:R.isCompressedTexture&&Array.isArray(R.image)?y.mipmaps.length:1}function I(R){const y=R.target;y.removeEventListener("dispose",I),A(y),y.isVideoTexture&&d.delete(y),y.isHTMLTexture&&u.delete(y)}function b(R){const y=R.target;y.removeEventListener("dispose",b),N(y)}function A(R){const y=s.get(R);if(y.__webglInit===void 0)return;const K=R.source,se=g.get(K);if(se){const ae=se[y.__cacheKey];ae.usedTimes--,ae.usedTimes===0&&B(R),Object.keys(se).length===0&&g.delete(K)}s.remove(R)}function B(R){const y=s.get(R);n.deleteTexture(y.__webglTexture);const K=R.source,se=g.get(K);delete se[y.__cacheKey],a.memory.textures--}function N(R){const y=s.get(R);if(R.depthTexture&&(R.depthTexture.dispose(),s.remove(R.depthTexture)),R.isWebGLCubeRenderTarget)for(let se=0;se<6;se++){if(Array.isArray(y.__webglFramebuffer[se]))for(let ae=0;ae<y.__webglFramebuffer[se].length;ae++)n.deleteFramebuffer(y.__webglFramebuffer[se][ae]);else n.deleteFramebuffer(y.__webglFramebuffer[se]);y.__webglDepthbuffer&&n.deleteRenderbuffer(y.__webglDepthbuffer[se])}else{if(Array.isArray(y.__webglFramebuffer))for(let se=0;se<y.__webglFramebuffer.length;se++)n.deleteFramebuffer(y.__webglFramebuffer[se]);else n.deleteFramebuffer(y.__webglFramebuffer);if(y.__webglDepthbuffer&&n.deleteRenderbuffer(y.__webglDepthbuffer),y.__webglMultisampledFramebuffer&&n.deleteFramebuffer(y.__webglMultisampledFramebuffer),y.__webglColorRenderbuffer)for(let se=0;se<y.__webglColorRenderbuffer.length;se++)y.__webglColorRenderbuffer[se]&&n.deleteRenderbuffer(y.__webglColorRenderbuffer[se]);y.__webglDepthRenderbuffer&&n.deleteRenderbuffer(y.__webglDepthRenderbuffer)}const K=R.textures;for(let se=0,ae=K.length;se<ae;se++){const ye=s.get(K[se]);ye.__webglTexture&&(n.deleteTexture(ye.__webglTexture),a.memory.textures--),s.remove(K[se])}s.remove(R)}let k=0;function L(){k=0}function j(){return k}function P(R){k=R}function W(){const R=k;return R>=i.maxTextures&&st("WebGLTextures: Trying to use "+R+" texture units while this GPU supports only "+i.maxTextures),k+=1,R}function X(R){const y=[];return y.push(R.wrapS),y.push(R.wrapT),y.push(R.wrapR||0),y.push(R.magFilter),y.push(R.minFilter),y.push(R.anisotropy),y.push(R.internalFormat),y.push(R.format),y.push(R.type),y.push(R.generateMipmaps),y.push(R.premultiplyAlpha),y.push(R.flipY),y.push(R.unpackAlignment),y.push(R.colorSpace),y.join()}function Q(R,y){const K=s.get(R);if(R.isVideoTexture&&q(R),R.isRenderTargetTexture===!1&&R.isExternalTexture!==!0&&R.version>0&&K.__version!==R.version){const se=R.image;if(se===null)st("WebGLRenderer: Texture marked for update but no image data found.");else if(se.complete===!1)st("WebGLRenderer: Texture marked for update but image is incomplete");else{et(K,R,y);return}}else R.isExternalTexture&&(K.__webglTexture=R.sourceTexture?R.sourceTexture:null);t.bindTexture(n.TEXTURE_2D,K.__webglTexture,n.TEXTURE0+y)}function re(R,y){const K=s.get(R);if(R.isRenderTargetTexture===!1&&R.version>0&&K.__version!==R.version){et(K,R,y);return}else R.isExternalTexture&&(K.__webglTexture=R.sourceTexture?R.sourceTexture:null);t.bindTexture(n.TEXTURE_2D_ARRAY,K.__webglTexture,n.TEXTURE0+y)}function Me(R,y){const K=s.get(R);if(R.isRenderTargetTexture===!1&&R.version>0&&K.__version!==R.version){et(K,R,y);return}t.bindTexture(n.TEXTURE_3D,K.__webglTexture,n.TEXTURE0+y)}function oe(R,y){const K=s.get(R);if(R.isCubeDepthTexture!==!0&&R.version>0&&K.__version!==R.version){ct(K,R,y);return}t.bindTexture(n.TEXTURE_CUBE_MAP,K.__webglTexture,n.TEXTURE0+y)}const Oe={[gd]:n.REPEAT,[Yn]:n.CLAMP_TO_EDGE,[Md]:n.MIRRORED_REPEAT},Ke={[ys]:n.NEAREST,[fz]:n.NEAREST_MIPMAP_NEAREST,[qa]:n.NEAREST_MIPMAP_LINEAR,[Ds]:n.LINEAR,[Vl]:n.LINEAR_MIPMAP_NEAREST,[Fi]:n.LINEAR_MIPMAP_LINEAR},nt={[gz]:n.NEVER,[wz]:n.ALWAYS,[Mz]:n.LESS,[wu]:n.LEQUAL,[bz]:n.EQUAL,[yu]:n.GEQUAL,[zz]:n.GREATER,[_z]:n.NOTEQUAL};function je(R,y){if(y.type===Mn&&e.has("OES_texture_float_linear")===!1&&(y.magFilter===Ds||y.magFilter===Vl||y.magFilter===qa||y.magFilter===Fi||y.minFilter===Ds||y.minFilter===Vl||y.minFilter===qa||y.minFilter===Fi)&&st("WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."),n.texParameteri(R,n.TEXTURE_WRAP_S,Oe[y.wrapS]),n.texParameteri(R,n.TEXTURE_WRAP_T,Oe[y.wrapT]),(R===n.TEXTURE_3D||R===n.TEXTURE_2D_ARRAY)&&n.texParameteri(R,n.TEXTURE_WRAP_R,Oe[y.wrapR]),n.texParameteri(R,n.TEXTURE_MAG_FILTER,Ke[y.magFilter]),n.texParameteri(R,n.TEXTURE_MIN_FILTER,Ke[y.minFilter]),y.compareFunction&&(n.texParameteri(R,n.TEXTURE_COMPARE_MODE,n.COMPARE_REF_TO_TEXTURE),n.texParameteri(R,n.TEXTURE_COMPARE_FUNC,nt[y.compareFunction])),e.has("EXT_texture_filter_anisotropic")===!0){if(y.magFilter===ys||y.minFilter!==qa&&y.minFilter!==Fi||y.type===Mn&&e.has("OES_texture_float_linear")===!1)return;if(y.anisotropy>1||s.get(y).__currentAnisotropy){const K=e.get("EXT_texture_filter_anisotropic");n.texParameterf(R,K.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(y.anisotropy,i.getMaxAnisotropy())),s.get(y).__currentAnisotropy=y.anisotropy}}}function ce(R,y){let K=!1;R.__webglInit===void 0&&(R.__webglInit=!0,y.addEventListener("dispose",I));const se=y.source;let ae=g.get(se);ae===void 0&&(ae={},g.set(se,ae));const ye=X(y);if(ye!==R.__cacheKey){ae[ye]===void 0&&(ae[ye]={texture:n.createTexture(),usedTimes:0},a.memory.textures++,K=!0),ae[ye].usedTimes++;const Ae=ae[R.__cacheKey];Ae!==void 0&&(ae[R.__cacheKey].usedTimes--,Ae.usedTimes===0&&B(y)),R.__cacheKey=ye,R.__webglTexture=ae[ye].texture}return K}function ue(R,y,K){return Math.floor(Math.floor(R/K)/y)}function fe(R,y,K,se){const ye=R.updateRanges;if(ye.length===0)t.texSubImage2D(n.TEXTURE_2D,0,0,0,y.width,y.height,K,se,y.data);else{ye.sort((Ve,De)=>Ve.start-De.start);let Ae=0;for(let Ve=1;Ve<ye.length;Ve++){const De=ye[Ae],Ie=ye[Ve],qe=De.start+De.count,Je=ue(Ie.start,y.width,4),dt=ue(De.start,y.width,4);Ie.start<=qe+1&&Je===dt&&ue(Ie.start+Ie.count-1,y.width,4)===Je?De.count=Math.max(De.count,Ie.start+Ie.count-De.start):(++Ae,ye[Ae]=Ie)}ye.length=Ae+1;const le=t.getParameter(n.UNPACK_ROW_LENGTH),he=t.getParameter(n.UNPACK_SKIP_PIXELS),xe=t.getParameter(n.UNPACK_SKIP_ROWS);t.pixelStorei(n.UNPACK_ROW_LENGTH,y.width);for(let Ve=0,De=ye.length;Ve<De;Ve++){const Ie=ye[Ve],qe=Math.floor(Ie.start/4),Je=Math.ceil(Ie.count/4),dt=qe%y.width,V=Math.floor(qe/y.width),Ee=Je,de=1;t.pixelStorei(n.UNPACK_SKIP_PIXELS,dt),t.pixelStorei(n.UNPACK_SKIP_ROWS,V),t.texSubImage2D(n.TEXTURE_2D,0,dt,V,Ee,de,K,se,y.data)}R.clearUpdateRanges(),t.pixelStorei(n.UNPACK_ROW_LENGTH,le),t.pixelStorei(n.UNPACK_SKIP_PIXELS,he),t.pixelStorei(n.UNPACK_SKIP_ROWS,xe)}}function et(R,y,K){let se=n.TEXTURE_2D;(y.isDataArrayTexture||y.isCompressedArrayTexture)&&(se=n.TEXTURE_2D_ARRAY),y.isData3DTexture&&(se=n.TEXTURE_3D);const ae=ce(R,y),ye=y.source;t.bindTexture(se,R.__webglTexture,n.TEXTURE0+K);const Ae=s.get(ye);if(ye.version!==Ae.__version||ae===!0){if(t.activeTexture(n.TEXTURE0+K),(typeof ImageBitmap<"u"&&y.image instanceof ImageBitmap)===!1){const de=xt.getPrimaries(xt.workingColorSpace),Te=y.colorSpace===bi?null:xt.getPrimaries(y.colorSpace),Ne=y.colorSpace===bi||de===Te?n.NONE:n.BROWSER_DEFAULT_WEBGL;t.pixelStorei(n.UNPACK_FLIP_Y_WEBGL,y.flipY),t.pixelStorei(n.UNPACK_PREMULTIPLY_ALPHA_WEBGL,y.premultiplyAlpha),t.pixelStorei(n.UNPACK_COLORSPACE_CONVERSION_WEBGL,Ne)}t.pixelStorei(n.UNPACK_ALIGNMENT,y.unpackAlignment);let he=m(y.image,!1,i.maxTextureSize);he=Os(y,he);const xe=r.convert(y.format,y.colorSpace),Ve=r.convert(y.type);let De=w(y.internalFormat,xe,Ve,y.normalized,y.colorSpace,y.isVideoTexture);je(se,y);let Ie;const qe=y.mipmaps,Je=y.isVideoTexture!==!0,dt=Ae.__version===void 0||ae===!0,V=ye.dataReady,Ee=S(y,he);if(y.isDepthTexture)De=x(y.format===ji,y.type),dt&&(Je?t.texStorage2D(n.TEXTURE_2D,1,De,he.width,he.height):t.texImage2D(n.TEXTURE_2D,0,De,he.width,he.height,0,xe,Ve,null));else if(y.isDataTexture)if(qe.length>0){Je&&dt&&t.texStorage2D(n.TEXTURE_2D,Ee,De,qe[0].width,qe[0].height);for(let de=0,Te=qe.length;de<Te;de++)Ie=qe[de],Je?V&&t.texSubImage2D(n.TEXTURE_2D,de,0,0,Ie.width,Ie.height,xe,Ve,Ie.data):t.texImage2D(n.TEXTURE_2D,de,De,Ie.width,Ie.height,0,xe,Ve,Ie.data);y.generateMipmaps=!1}else Je?(dt&&t.texStorage2D(n.TEXTURE_2D,Ee,De,he.width,he.height),V&&fe(y,he,xe,Ve)):t.texImage2D(n.TEXTURE_2D,0,De,he.width,he.height,0,xe,Ve,he.data);else if(y.isCompressedTexture)if(y.isCompressedArrayTexture){Je&&dt&&t.texStorage3D(n.TEXTURE_2D_ARRAY,Ee,De,qe[0].width,qe[0].height,he.depth);for(let de=0,Te=qe.length;de<Te;de++)if(Ie=qe[de],y.format!==bn)if(xe!==null)if(Je){if(V)if(y.layerUpdates.size>0){const Ne=Zh(Ie.width,Ie.height,y.format,y.type);for(const pe of y.layerUpdates){const Pe=Ie.data.subarray(pe*Ne/Ie.data.BYTES_PER_ELEMENT,(pe+1)*Ne/Ie.data.BYTES_PER_ELEMENT);t.compressedTexSubImage3D(n.TEXTURE_2D_ARRAY,de,0,0,pe,Ie.width,Ie.height,1,xe,Pe)}y.clearLayerUpdates()}else t.compressedTexSubImage3D(n.TEXTURE_2D_ARRAY,de,0,0,0,Ie.width,Ie.height,he.depth,xe,Ie.data)}else t.compressedTexImage3D(n.TEXTURE_2D_ARRAY,de,De,Ie.width,Ie.height,he.depth,0,Ie.data,0,0);else st("WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");else Je?V&&t.texSubImage3D(n.TEXTURE_2D_ARRAY,de,0,0,0,Ie.width,Ie.height,he.depth,xe,Ve,Ie.data):t.texImage3D(n.TEXTURE_2D_ARRAY,de,De,Ie.width,Ie.height,he.depth,0,xe,Ve,Ie.data)}else{Je&&dt&&t.texStorage2D(n.TEXTURE_2D,Ee,De,qe[0].width,qe[0].height);for(let de=0,Te=qe.length;de<Te;de++)Ie=qe[de],y.format!==bn?xe!==null?Je?V&&t.compressedTexSubImage2D(n.TEXTURE_2D,de,0,0,Ie.width,Ie.height,xe,Ie.data):t.compressedTexImage2D(n.TEXTURE_2D,de,De,Ie.width,Ie.height,0,Ie.data):st("WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):Je?V&&t.texSubImage2D(n.TEXTURE_2D,de,0,0,Ie.width,Ie.height,xe,Ve,Ie.data):t.texImage2D(n.TEXTURE_2D,de,De,Ie.width,Ie.height,0,xe,Ve,Ie.data)}else if(y.isDataArrayTexture)if(Je){if(dt&&t.texStorage3D(n.TEXTURE_2D_ARRAY,Ee,De,he.width,he.height,he.depth),V)if(y.layerUpdates.size>0){const de=Zh(he.width,he.height,y.format,y.type);for(const Te of y.layerUpdates){const Ne=he.data.subarray(Te*de/he.data.BYTES_PER_ELEMENT,(Te+1)*de/he.data.BYTES_PER_ELEMENT);t.texSubImage3D(n.TEXTURE_2D_ARRAY,0,0,0,Te,he.width,he.height,1,xe,Ve,Ne)}y.clearLayerUpdates()}else t.texSubImage3D(n.TEXTURE_2D_ARRAY,0,0,0,0,he.width,he.height,he.depth,xe,Ve,he.data)}else t.texImage3D(n.TEXTURE_2D_ARRAY,0,De,he.width,he.height,he.depth,0,xe,Ve,he.data);else if(y.isData3DTexture)Je?(dt&&t.texStorage3D(n.TEXTURE_3D,Ee,De,he.width,he.height,he.depth),V&&t.texSubImage3D(n.TEXTURE_3D,0,0,0,0,he.width,he.height,he.depth,xe,Ve,he.data)):t.texImage3D(n.TEXTURE_3D,0,De,he.width,he.height,he.depth,0,xe,Ve,he.data);else if(y.isFramebufferTexture){if(dt)if(Je)t.texStorage2D(n.TEXTURE_2D,Ee,De,he.width,he.height);else{let de=he.width,Te=he.height;for(let Ne=0;Ne<Ee;Ne++)t.texImage2D(n.TEXTURE_2D,Ne,De,de,Te,0,xe,Ve,null),de>>=1,Te>>=1}}else if(y.isHTMLTexture){if("texElementImage2D"in n){const de=n.canvas;if(de.hasAttribute("layoutsubtree")||de.setAttribute("layoutsubtree","true"),he.parentNode!==de){de.appendChild(he),u.add(y),de.onpaint=Te=>{const Ne=Te.changedElements;for(const pe of u)Ne.includes(pe.image)&&(pe.needsUpdate=!0)},de.requestPaint();return}if(n.texElementImage2D.length===3)n.texElementImage2D(n.TEXTURE_2D,n.RGBA8,he);else{const Ne=n.RGBA,pe=n.RGBA,Pe=n.UNSIGNED_BYTE;n.texElementImage2D(n.TEXTURE_2D,0,Ne,pe,Pe,he)}n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MIN_FILTER,n.LINEAR),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_S,n.CLAMP_TO_EDGE),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_T,n.CLAMP_TO_EDGE)}}else if(qe.length>0){if(Je&&dt){const de=Bt(qe[0]);t.texStorage2D(n.TEXTURE_2D,Ee,De,de.width,de.height)}for(let de=0,Te=qe.length;de<Te;de++)Ie=qe[de],Je?V&&t.texSubImage2D(n.TEXTURE_2D,de,0,0,xe,Ve,Ie):t.texImage2D(n.TEXTURE_2D,de,De,xe,Ve,Ie);y.generateMipmaps=!1}else if(Je){if(dt){const de=Bt(he);t.texStorage2D(n.TEXTURE_2D,Ee,De,de.width,de.height)}V&&t.texSubImage2D(n.TEXTURE_2D,0,0,0,xe,Ve,he)}else t.texImage2D(n.TEXTURE_2D,0,De,xe,Ve,he);f(y)&&_(se),Ae.__version=ye.version,y.onUpdate&&y.onUpdate(y)}R.__version=y.version}function ct(R,y,K){if(y.image.length!==6)return;const se=ce(R,y),ae=y.source;t.bindTexture(n.TEXTURE_CUBE_MAP,R.__webglTexture,n.TEXTURE0+K);const ye=s.get(ae);if(ae.version!==ye.__version||se===!0){t.activeTexture(n.TEXTURE0+K);const Ae=xt.getPrimaries(xt.workingColorSpace),le=y.colorSpace===bi?null:xt.getPrimaries(y.colorSpace),he=y.colorSpace===bi||Ae===le?n.NONE:n.BROWSER_DEFAULT_WEBGL;t.pixelStorei(n.UNPACK_FLIP_Y_WEBGL,y.flipY),t.pixelStorei(n.UNPACK_PREMULTIPLY_ALPHA_WEBGL,y.premultiplyAlpha),t.pixelStorei(n.UNPACK_ALIGNMENT,y.unpackAlignment),t.pixelStorei(n.UNPACK_COLORSPACE_CONVERSION_WEBGL,he);const xe=y.isCompressedTexture||y.image[0].isCompressedTexture,Ve=y.image[0]&&y.image[0].isDataTexture,De=[];for(let pe=0;pe<6;pe++)!xe&&!Ve?De[pe]=m(y.image[pe],!0,i.maxCubemapSize):De[pe]=Ve?y.image[pe].image:y.image[pe],De[pe]=Os(y,De[pe]);const Ie=De[0],qe=r.convert(y.format,y.colorSpace),Je=r.convert(y.type),dt=w(y.internalFormat,qe,Je,y.normalized,y.colorSpace),V=y.isVideoTexture!==!0,Ee=ye.__version===void 0||se===!0,de=ae.dataReady;let Te=S(y,Ie);je(n.TEXTURE_CUBE_MAP,y);let Ne;if(xe){V&&Ee&&t.texStorage2D(n.TEXTURE_CUBE_MAP,Te,dt,Ie.width,Ie.height);for(let pe=0;pe<6;pe++){Ne=De[pe].mipmaps;for(let Pe=0;Pe<Ne.length;Pe++){const Ue=Ne[Pe];y.format!==bn?qe!==null?V?de&&t.compressedTexSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+pe,Pe,0,0,Ue.width,Ue.height,qe,Ue.data):t.compressedTexImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+pe,Pe,dt,Ue.width,Ue.height,0,Ue.data):st("WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):V?de&&t.texSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+pe,Pe,0,0,Ue.width,Ue.height,qe,Je,Ue.data):t.texImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+pe,Pe,dt,Ue.width,Ue.height,0,qe,Je,Ue.data)}}}else{if(Ne=y.mipmaps,V&&Ee){Ne.length>0&&Te++;const pe=Bt(De[0]);t.texStorage2D(n.TEXTURE_CUBE_MAP,Te,dt,pe.width,pe.height)}for(let pe=0;pe<6;pe++)if(Ve){V?de&&t.texSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+pe,0,0,0,De[pe].width,De[pe].height,qe,Je,De[pe].data):t.texImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+pe,0,dt,De[pe].width,De[pe].height,0,qe,Je,De[pe].data);for(let Pe=0;Pe<Ne.length;Pe++){const Vt=Ne[Pe].image[pe].image;V?de&&t.texSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+pe,Pe+1,0,0,Vt.width,Vt.height,qe,Je,Vt.data):t.texImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+pe,Pe+1,dt,Vt.width,Vt.height,0,qe,Je,Vt.data)}}else{V?de&&t.texSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+pe,0,0,0,qe,Je,De[pe]):t.texImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+pe,0,dt,qe,Je,De[pe]);for(let Pe=0;Pe<Ne.length;Pe++){const Ue=Ne[Pe];V?de&&t.texSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+pe,Pe+1,0,0,qe,Je,Ue.image[pe]):t.texImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+pe,Pe+1,dt,qe,Je,Ue.image[pe])}}}f(y)&&_(n.TEXTURE_CUBE_MAP),ye.__version=ae.version,y.onUpdate&&y.onUpdate(y)}R.__version=y.version}function Qe(R,y,K,se,ae,ye){const Ae=r.convert(K.format,K.colorSpace),le=r.convert(K.type),he=w(K.internalFormat,Ae,le,K.normalized,K.colorSpace),xe=s.get(y),Ve=s.get(K);if(Ve.__renderTarget=y,!xe.__hasExternalTextures){const De=Math.max(1,y.width>>ye),Ie=Math.max(1,y.height>>ye);ae===n.TEXTURE_3D||ae===n.TEXTURE_2D_ARRAY?t.texImage3D(ae,ye,he,De,Ie,y.depth,0,Ae,le,null):t.texImage2D(ae,ye,he,De,Ie,0,Ae,le,null)}t.bindFramebuffer(n.FRAMEBUFFER,R),es(y)?o.framebufferTexture2DMultisampleEXT(n.FRAMEBUFFER,se,ae,Ve.__webglTexture,0,Qt(y)):(ae===n.TEXTURE_2D||ae>=n.TEXTURE_CUBE_MAP_POSITIVE_X&&ae<=n.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&n.framebufferTexture2D(n.FRAMEBUFFER,se,ae,Ve.__webglTexture,ye),t.bindFramebuffer(n.FRAMEBUFFER,null)}function Zt(R,y,K){if(n.bindRenderbuffer(n.RENDERBUFFER,R),y.depthBuffer){const se=y.depthTexture,ae=se&&se.isDepthTexture?se.type:null,ye=x(y.stencilBuffer,ae),Ae=y.stencilBuffer?n.DEPTH_STENCIL_ATTACHMENT:n.DEPTH_ATTACHMENT;es(y)?o.renderbufferStorageMultisampleEXT(n.RENDERBUFFER,Qt(y),ye,y.width,y.height):K?n.renderbufferStorageMultisample(n.RENDERBUFFER,Qt(y),ye,y.width,y.height):n.renderbufferStorage(n.RENDERBUFFER,ye,y.width,y.height),n.framebufferRenderbuffer(n.FRAMEBUFFER,Ae,n.RENDERBUFFER,R)}else{const se=y.textures;for(let ae=0;ae<se.length;ae++){const ye=se[ae],Ae=r.convert(ye.format,ye.colorSpace),le=r.convert(ye.type),he=w(ye.internalFormat,Ae,le,ye.normalized,ye.colorSpace);es(y)?o.renderbufferStorageMultisampleEXT(n.RENDERBUFFER,Qt(y),he,y.width,y.height):K?n.renderbufferStorageMultisample(n.RENDERBUFFER,Qt(y),he,y.width,y.height):n.renderbufferStorage(n.RENDERBUFFER,he,y.width,y.height)}}n.bindRenderbuffer(n.RENDERBUFFER,null)}function gt(R,y,K){const se=y.isWebGLCubeRenderTarget===!0;if(t.bindFramebuffer(n.FRAMEBUFFER,R),!(y.depthTexture&&y.depthTexture.isDepthTexture))throw new Error("THREE.WebGLTextures: renderTarget.depthTexture must be an instance of THREE.DepthTexture.");const ae=s.get(y.depthTexture);if(ae.__renderTarget=y,(!ae.__webglTexture||y.depthTexture.image.width!==y.width||y.depthTexture.image.height!==y.height)&&(y.depthTexture.image.width=y.width,y.depthTexture.image.height=y.height,y.depthTexture.needsUpdate=!0),se){if(ae.__webglInit===void 0&&(ae.__webglInit=!0,y.depthTexture.addEventListener("dispose",I)),ae.__webglTexture===void 0){ae.__webglTexture=n.createTexture(),t.bindTexture(n.TEXTURE_CUBE_MAP,ae.__webglTexture),je(n.TEXTURE_CUBE_MAP,y.depthTexture);const xe=r.convert(y.depthTexture.format),Ve=r.convert(y.depthTexture.type);let De;y.depthTexture.format===si?De=n.DEPTH_COMPONENT24:y.depthTexture.format===ji&&(De=n.DEPTH24_STENCIL8);for(let Ie=0;Ie<6;Ie++)n.texImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+Ie,0,De,y.width,y.height,0,xe,Ve,null)}}else Q(y.depthTexture,0);const ye=ae.__webglTexture,Ae=Qt(y),le=se?n.TEXTURE_CUBE_MAP_POSITIVE_X+K:n.TEXTURE_2D,he=y.depthTexture.format===ji?n.DEPTH_STENCIL_ATTACHMENT:n.DEPTH_ATTACHMENT;if(y.depthTexture.format===si)es(y)?o.framebufferTexture2DMultisampleEXT(n.FRAMEBUFFER,he,le,ye,0,Ae):n.framebufferTexture2D(n.FRAMEBUFFER,he,le,ye,0);else if(y.depthTexture.format===ji)es(y)?o.framebufferTexture2DMultisampleEXT(n.FRAMEBUFFER,he,le,ye,0,Ae):n.framebufferTexture2D(n.FRAMEBUFFER,he,le,ye,0);else throw new Error("THREE.WebGLTextures: Unknown depthTexture format.")}function Rt(R){const y=s.get(R),K=R.isWebGLCubeRenderTarget===!0;if(y.__boundDepthTexture!==R.depthTexture){const se=R.depthTexture;if(y.__depthDisposeCallback&&y.__depthDisposeCallback(),se){const ae=()=>{delete y.__boundDepthTexture,delete y.__depthDisposeCallback,se.removeEventListener("dispose",ae)};se.addEventListener("dispose",ae),y.__depthDisposeCallback=ae}y.__boundDepthTexture=se}if(R.depthTexture&&!y.__autoAllocateDepthBuffer)if(K)for(let se=0;se<6;se++)gt(y.__webglFramebuffer[se],R,se);else{const se=R.texture.mipmaps;se&&se.length>0?gt(y.__webglFramebuffer[0],R,0):gt(y.__webglFramebuffer,R,0)}else if(K){y.__webglDepthbuffer=[];for(let se=0;se<6;se++)if(t.bindFramebuffer(n.FRAMEBUFFER,y.__webglFramebuffer[se]),y.__webglDepthbuffer[se]===void 0)y.__webglDepthbuffer[se]=n.createRenderbuffer(),Zt(y.__webglDepthbuffer[se],R,!1);else{const ae=R.stencilBuffer?n.DEPTH_STENCIL_ATTACHMENT:n.DEPTH_ATTACHMENT,ye=y.__webglDepthbuffer[se];n.bindRenderbuffer(n.RENDERBUFFER,ye),n.framebufferRenderbuffer(n.FRAMEBUFFER,ae,n.RENDERBUFFER,ye)}}else{const se=R.texture.mipmaps;if(se&&se.length>0?t.bindFramebuffer(n.FRAMEBUFFER,y.__webglFramebuffer[0]):t.bindFramebuffer(n.FRAMEBUFFER,y.__webglFramebuffer),y.__webglDepthbuffer===void 0)y.__webglDepthbuffer=n.createRenderbuffer(),Zt(y.__webglDepthbuffer,R,!1);else{const ae=R.stencilBuffer?n.DEPTH_STENCIL_ATTACHMENT:n.DEPTH_ATTACHMENT,ye=y.__webglDepthbuffer;n.bindRenderbuffer(n.RENDERBUFFER,ye),n.framebufferRenderbuffer(n.FRAMEBUFFER,ae,n.RENDERBUFFER,ye)}}t.bindFramebuffer(n.FRAMEBUFFER,null)}function it(R,y,K){const se=s.get(R);y!==void 0&&Qe(se.__webglFramebuffer,R,R.texture,n.COLOR_ATTACHMENT0,n.TEXTURE_2D,0),K!==void 0&&Rt(R)}function wt(R){const y=R.texture,K=s.get(R),se=s.get(y);R.addEventListener("dispose",b);const ae=R.textures,ye=R.isWebGLCubeRenderTarget===!0,Ae=ae.length>1;if(Ae||(se.__webglTexture===void 0&&(se.__webglTexture=n.createTexture()),se.__version=y.version,a.memory.textures++),ye){K.__webglFramebuffer=[];for(let le=0;le<6;le++)if(y.mipmaps&&y.mipmaps.length>0){K.__webglFramebuffer[le]=[];for(let he=0;he<y.mipmaps.length;he++)K.__webglFramebuffer[le][he]=n.createFramebuffer()}else K.__webglFramebuffer[le]=n.createFramebuffer()}else{if(y.mipmaps&&y.mipmaps.length>0){K.__webglFramebuffer=[];for(let le=0;le<y.mipmaps.length;le++)K.__webglFramebuffer[le]=n.createFramebuffer()}else K.__webglFramebuffer=n.createFramebuffer();if(Ae)for(let le=0,he=ae.length;le<he;le++){const xe=s.get(ae[le]);xe.__webglTexture===void 0&&(xe.__webglTexture=n.createTexture(),a.memory.textures++)}if(R.samples>0&&es(R)===!1){K.__webglMultisampledFramebuffer=n.createFramebuffer(),K.__webglColorRenderbuffer=[],t.bindFramebuffer(n.FRAMEBUFFER,K.__webglMultisampledFramebuffer);for(let le=0;le<ae.length;le++){const he=ae[le];K.__webglColorRenderbuffer[le]=n.createRenderbuffer(),n.bindRenderbuffer(n.RENDERBUFFER,K.__webglColorRenderbuffer[le]);const xe=r.convert(he.format,he.colorSpace),Ve=r.convert(he.type),De=w(he.internalFormat,xe,Ve,he.normalized,he.colorSpace,R.isXRRenderTarget===!0),Ie=Qt(R);n.renderbufferStorageMultisample(n.RENDERBUFFER,Ie,De,R.width,R.height),n.framebufferRenderbuffer(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0+le,n.RENDERBUFFER,K.__webglColorRenderbuffer[le])}n.bindRenderbuffer(n.RENDERBUFFER,null),R.depthBuffer&&(K.__webglDepthRenderbuffer=n.createRenderbuffer(),Zt(K.__webglDepthRenderbuffer,R,!0)),t.bindFramebuffer(n.FRAMEBUFFER,null)}}if(ye){t.bindTexture(n.TEXTURE_CUBE_MAP,se.__webglTexture),je(n.TEXTURE_CUBE_MAP,y);for(let le=0;le<6;le++)if(y.mipmaps&&y.mipmaps.length>0)for(let he=0;he<y.mipmaps.length;he++)Qe(K.__webglFramebuffer[le][he],R,y,n.COLOR_ATTACHMENT0,n.TEXTURE_CUBE_MAP_POSITIVE_X+le,he);else Qe(K.__webglFramebuffer[le],R,y,n.COLOR_ATTACHMENT0,n.TEXTURE_CUBE_MAP_POSITIVE_X+le,0);f(y)&&_(n.TEXTURE_CUBE_MAP),t.unbindTexture()}else if(Ae){for(let le=0,he=ae.length;le<he;le++){const xe=ae[le],Ve=s.get(xe);let De=n.TEXTURE_2D;(R.isWebGL3DRenderTarget||R.isWebGLArrayRenderTarget)&&(De=R.isWebGL3DRenderTarget?n.TEXTURE_3D:n.TEXTURE_2D_ARRAY),t.bindTexture(De,Ve.__webglTexture),je(De,xe),Qe(K.__webglFramebuffer,R,xe,n.COLOR_ATTACHMENT0+le,De,0),f(xe)&&_(De)}t.unbindTexture()}else{let le=n.TEXTURE_2D;if((R.isWebGL3DRenderTarget||R.isWebGLArrayRenderTarget)&&(le=R.isWebGL3DRenderTarget?n.TEXTURE_3D:n.TEXTURE_2D_ARRAY),t.bindTexture(le,se.__webglTexture),je(le,y),y.mipmaps&&y.mipmaps.length>0)for(let he=0;he<y.mipmaps.length;he++)Qe(K.__webglFramebuffer[he],R,y,n.COLOR_ATTACHMENT0,le,he);else Qe(K.__webglFramebuffer,R,y,n.COLOR_ATTACHMENT0,le,0);f(y)&&_(le),t.unbindTexture()}R.depthBuffer&&Rt(R)}function ns(R){const y=R.textures;for(let K=0,se=y.length;K<se;K++){const ae=y[K];if(f(ae)){const ye=O(R),Ae=s.get(ae).__webglTexture;t.bindTexture(ye,Ae),_(ye),t.unbindTexture()}}}const Ut=[],rs=[];function as(R){if(R.samples>0){if(es(R)===!1){const y=R.textures,K=R.width,se=R.height;let ae=n.COLOR_BUFFER_BIT;const ye=R.stencilBuffer?n.DEPTH_STENCIL_ATTACHMENT:n.DEPTH_ATTACHMENT,Ae=s.get(R),le=y.length>1;if(le)for(let xe=0;xe<y.length;xe++)t.bindFramebuffer(n.FRAMEBUFFER,Ae.__webglMultisampledFramebuffer),n.framebufferRenderbuffer(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0+xe,n.RENDERBUFFER,null),t.bindFramebuffer(n.FRAMEBUFFER,Ae.__webglFramebuffer),n.framebufferTexture2D(n.DRAW_FRAMEBUFFER,n.COLOR_ATTACHMENT0+xe,n.TEXTURE_2D,null,0);t.bindFramebuffer(n.READ_FRAMEBUFFER,Ae.__webglMultisampledFramebuffer);const he=R.texture.mipmaps;he&&he.length>0?t.bindFramebuffer(n.DRAW_FRAMEBUFFER,Ae.__webglFramebuffer[0]):t.bindFramebuffer(n.DRAW_FRAMEBUFFER,Ae.__webglFramebuffer);for(let xe=0;xe<y.length;xe++){if(R.resolveDepthBuffer&&(R.depthBuffer&&(ae|=n.DEPTH_BUFFER_BIT),R.stencilBuffer&&R.resolveStencilBuffer&&(ae|=n.STENCIL_BUFFER_BIT)),le){n.framebufferRenderbuffer(n.READ_FRAMEBUFFER,n.COLOR_ATTACHMENT0,n.RENDERBUFFER,Ae.__webglColorRenderbuffer[xe]);const Ve=s.get(y[xe]).__webglTexture;n.framebufferTexture2D(n.DRAW_FRAMEBUFFER,n.COLOR_ATTACHMENT0,n.TEXTURE_2D,Ve,0)}n.blitFramebuffer(0,0,K,se,0,0,K,se,ae,n.NEAREST),l===!0&&(Ut.length=0,rs.length=0,Ut.push(n.COLOR_ATTACHMENT0+xe),R.depthBuffer&&R.resolveDepthBuffer===!1&&(Ut.push(ye),rs.push(ye),n.invalidateFramebuffer(n.DRAW_FRAMEBUFFER,rs)),n.invalidateFramebuffer(n.READ_FRAMEBUFFER,Ut))}if(t.bindFramebuffer(n.READ_FRAMEBUFFER,null),t.bindFramebuffer(n.DRAW_FRAMEBUFFER,null),le)for(let xe=0;xe<y.length;xe++){t.bindFramebuffer(n.FRAMEBUFFER,Ae.__webglMultisampledFramebuffer),n.framebufferRenderbuffer(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0+xe,n.RENDERBUFFER,Ae.__webglColorRenderbuffer[xe]);const Ve=s.get(y[xe]).__webglTexture;t.bindFramebuffer(n.FRAMEBUFFER,Ae.__webglFramebuffer),n.framebufferTexture2D(n.DRAW_FRAMEBUFFER,n.COLOR_ATTACHMENT0+xe,n.TEXTURE_2D,Ve,0)}t.bindFramebuffer(n.DRAW_FRAMEBUFFER,Ae.__webglMultisampledFramebuffer)}else if(R.depthBuffer&&R.resolveDepthBuffer===!1&&l){const y=R.stencilBuffer?n.DEPTH_STENCIL_ATTACHMENT:n.DEPTH_ATTACHMENT;n.invalidateFramebuffer(n.DRAW_FRAMEBUFFER,[y])}}}function Qt(R){return Math.min(i.maxSamples,R.samples)}function es(R){const y=s.get(R);return R.samples>0&&e.has("WEBGL_multisampled_render_to_texture")===!0&&y.__useRenderToTexture!==!1}function q(R){const y=a.render.frame;d.get(R)!==y&&(d.set(R,y),R.update())}function Os(R,y){const K=R.colorSpace,se=R.format,ae=R.type;return R.isCompressedTexture===!0||R.isVideoTexture===!0||K!==dl&&K!==bi&&(xt.getTransfer(K)===kt?(se!==bn||ae!==Zs)&&st("WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):Ot("WebGLTextures: Unsupported texture color space:",K)),y}function Bt(R){return typeof HTMLImageElement<"u"&&R instanceof HTMLImageElement?(c.width=R.naturalWidth||R.width,c.height=R.naturalHeight||R.height):typeof VideoFrame<"u"&&R instanceof VideoFrame?(c.width=R.displayWidth,c.height=R.displayHeight):(c.width=R.width,c.height=R.height),c}this.allocateTextureUnit=W,this.resetTextureUnits=L,this.getTextureUnits=j,this.setTextureUnits=P,this.setTexture2D=Q,this.setTexture2DArray=re,this.setTexture3D=Me,this.setTextureCube=oe,this.rebindTextures=it,this.setupRenderTarget=wt,this.updateRenderTargetMipmap=ns,this.updateMultisampleRenderTarget=as,this.setupDepthRenderbuffer=Rt,this.setupFrameBufferTexture=Qe,this.useMultisampledRTT=es,this.isReversedDepthBuffer=function(){return t.buffers.depth.getReversed()}}function ex(n,e){function t(s,i=bi){let r;const a=xt.getTransfer(i);if(s===Zs)return n.UNSIGNED_BYTE;if(s===mu)return n.UNSIGNED_SHORT_4_4_4_4;if(s===gu)return n.UNSIGNED_SHORT_5_5_5_1;if(s===Pm)return n.UNSIGNED_INT_5_9_9_9_REV;if(s===Lm)return n.UNSIGNED_INT_10F_11F_11F_REV;if(s===Nm)return n.BYTE;if(s===Cm)return n.SHORT;if(s===La)return n.UNSIGNED_SHORT;if(s===pu)return n.INT;if(s===Gn)return n.UNSIGNED_INT;if(s===Mn)return n.FLOAT;if(s===ti)return n.HALF_FLOAT;if(s===Wm)return n.ALPHA;if(s===km)return n.RGB;if(s===bn)return n.RGBA;if(s===si)return n.DEPTH_COMPONENT;if(s===ji)return n.DEPTH_STENCIL;if(s===Mu)return n.RED;if(s===bu)return n.RED_INTEGER;if(s===er)return n.RG;if(s===zu)return n.RG_INTEGER;if(s===_u)return n.RGBA_INTEGER;if(s===Lo||s===Wo||s===ko||s===Uo)if(a===kt)if(r=e.get("WEBGL_compressed_texture_s3tc_srgb"),r!==null){if(s===Lo)return r.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(s===Wo)return r.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(s===ko)return r.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(s===Uo)return r.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(r=e.get("WEBGL_compressed_texture_s3tc"),r!==null){if(s===Lo)return r.COMPRESSED_RGB_S3TC_DXT1_EXT;if(s===Wo)return r.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(s===ko)return r.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(s===Uo)return r.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(s===bd||s===zd||s===_d||s===wd)if(r=e.get("WEBGL_compressed_texture_pvrtc"),r!==null){if(s===bd)return r.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(s===zd)return r.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(s===_d)return r.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(s===wd)return r.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(s===yd||s===vd||s===Od||s===xd||s===Sd||s===ll||s===Ad)if(r=e.get("WEBGL_compressed_texture_etc"),r!==null){if(s===yd||s===vd)return a===kt?r.COMPRESSED_SRGB8_ETC2:r.COMPRESSED_RGB8_ETC2;if(s===Od)return a===kt?r.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:r.COMPRESSED_RGBA8_ETC2_EAC;if(s===xd)return r.COMPRESSED_R11_EAC;if(s===Sd)return r.COMPRESSED_SIGNED_R11_EAC;if(s===ll)return r.COMPRESSED_RG11_EAC;if(s===Ad)return r.COMPRESSED_SIGNED_RG11_EAC}else return null;if(s===Ed||s===Dd||s===Id||s===Td||s===Gd||s===Rd||s===Bd||s===Nd||s===Cd||s===Pd||s===Ld||s===Wd||s===kd||s===Ud)if(r=e.get("WEBGL_compressed_texture_astc"),r!==null){if(s===Ed)return a===kt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:r.COMPRESSED_RGBA_ASTC_4x4_KHR;if(s===Dd)return a===kt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:r.COMPRESSED_RGBA_ASTC_5x4_KHR;if(s===Id)return a===kt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:r.COMPRESSED_RGBA_ASTC_5x5_KHR;if(s===Td)return a===kt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:r.COMPRESSED_RGBA_ASTC_6x5_KHR;if(s===Gd)return a===kt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:r.COMPRESSED_RGBA_ASTC_6x6_KHR;if(s===Rd)return a===kt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:r.COMPRESSED_RGBA_ASTC_8x5_KHR;if(s===Bd)return a===kt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:r.COMPRESSED_RGBA_ASTC_8x6_KHR;if(s===Nd)return a===kt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:r.COMPRESSED_RGBA_ASTC_8x8_KHR;if(s===Cd)return a===kt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:r.COMPRESSED_RGBA_ASTC_10x5_KHR;if(s===Pd)return a===kt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:r.COMPRESSED_RGBA_ASTC_10x6_KHR;if(s===Ld)return a===kt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:r.COMPRESSED_RGBA_ASTC_10x8_KHR;if(s===Wd)return a===kt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:r.COMPRESSED_RGBA_ASTC_10x10_KHR;if(s===kd)return a===kt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:r.COMPRESSED_RGBA_ASTC_12x10_KHR;if(s===Ud)return a===kt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:r.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(s===Fd||s===jd||s===$d)if(r=e.get("EXT_texture_compression_bptc"),r!==null){if(s===Fd)return a===kt?r.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:r.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(s===jd)return r.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(s===$d)return r.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(s===Vd||s===Hd||s===cl||s===qd)if(r=e.get("EXT_texture_compression_rgtc"),r!==null){if(s===Vd)return r.COMPRESSED_RED_RGTC1_EXT;if(s===Hd)return r.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(s===cl)return r.COMPRESSED_RED_GREEN_RGTC2_EXT;if(s===qd)return r.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return s===Wa?n.UNSIGNED_INT_24_8:n[s]!==void 0?n[s]:null}return{convert:t}}const tx=`
4086
4086
  void main() {
4087
4087
 
4088
4088
  gl_Position = vec4( position, 1.0 );
@@ -4106,7 +4106,7 @@ void main() {
4106
4106
 
4107
4107
  }
4108
4108
 
4109
- }`;class nx{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(e,t){if(this.texture===null){const s=new Zm(e.texture);(e.depthNear!==t.depthNear||e.depthFar!==t.depthFar)&&(this.depthNear=e.depthNear,this.depthFar=e.depthFar),this.texture=s}}getMesh(e){if(this.texture!==null&&this.mesh===null){const t=e.cameras[0].viewport,s=new hs({vertexShader:tx,fragmentShader:sx,uniforms:{depthColor:{value:this.texture},depthWidth:{value:t.z},depthHeight:{value:t.w}}});this.mesh=new Us(new Al(20,20),s)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}}class ix extends ir{constructor(e,t){super();const s=this;let i=null,r=1,a=null,o="local-floor",l=1,c=null,d=null,u=null,h=null,g=null,p=null;const z=typeof XRWebGLBinding<"u",m=new nx,f={},_=t.getContextAttributes();let O=null,w=null;const x=[],S=[],I=new lt;let b=null;const A=new nn;A.viewport=new ts;const B=new nn;B.viewport=new ts;const N=[A,B],k=new f_;let L=null,F=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(le){let ue=x[le];return ue===void 0&&(ue=new Jl,x[le]=ue),ue.getTargetRaySpace()},this.getControllerGrip=function(le){let ue=x[le];return ue===void 0&&(ue=new Jl,x[le]=ue),ue.getGripSpace()},this.getHand=function(le){let ue=x[le];return ue===void 0&&(ue=new Jl,x[le]=ue),ue.getHandSpace()};function P(le){const ue=S.indexOf(le.inputSource);if(ue===-1)return;const fe=x[ue];fe!==void 0&&(fe.update(le.inputSource,le.frame,c||a),fe.dispatchEvent({type:le.type,data:le.inputSource}))}function W(){i.removeEventListener("select",P),i.removeEventListener("selectstart",P),i.removeEventListener("selectend",P),i.removeEventListener("squeeze",P),i.removeEventListener("squeezestart",P),i.removeEventListener("squeezeend",P),i.removeEventListener("end",W),i.removeEventListener("inputsourceschange",X);for(let le=0;le<x.length;le++){const ue=S[le];ue!==null&&(S[le]=null,x[le].disconnect(ue))}L=null,F=null,m.reset();for(const le in f)delete f[le];e.setRenderTarget(O),g=null,h=null,u=null,i=null,w=null,Ve.stop(),s.isPresenting=!1,e.setPixelRatio(b),e.setSize(I.width,I.height,!1),s.dispatchEvent({type:"sessionend"})}this.setFramebufferScaleFactor=function(le){r=le,s.isPresenting===!0&&st("WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(le){o=le,s.isPresenting===!0&&st("WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return c||a},this.setReferenceSpace=function(le){c=le},this.getBaseLayer=function(){return h!==null?h:g},this.getBinding=function(){return u===null&&z&&(u=new XRWebGLBinding(i,t)),u},this.getFrame=function(){return p},this.getSession=function(){return i},this.setSession=async function(le){if(i=le,i!==null){if(O=e.getRenderTarget(),i.addEventListener("select",P),i.addEventListener("selectstart",P),i.addEventListener("selectend",P),i.addEventListener("squeeze",P),i.addEventListener("squeezestart",P),i.addEventListener("squeezeend",P),i.addEventListener("end",W),i.addEventListener("inputsourceschange",X),_.xrCompatible!==!0&&await t.makeXRCompatible(),b=e.getPixelRatio(),e.getSize(I),z&&"createProjectionLayer"in XRWebGLBinding.prototype){let fe=null,et=null,ct=null;_.depth&&(ct=_.stencil?t.DEPTH24_STENCIL8:t.DEPTH_COMPONENT24,fe=_.stencil?ji:si,et=_.stencil?Wa:Gn);const Qe={colorFormat:t.RGBA8,depthFormat:ct,scaleFactor:r};u=this.getBinding(),h=u.createProjectionLayer(Qe),i.updateRenderState({layers:[h]}),e.setPixelRatio(1),e.setSize(h.textureWidth,h.textureHeight,!1),w=new In(h.textureWidth,h.textureHeight,{format:bn,type:Zs,depthTexture:new qr(h.textureWidth,h.textureHeight,et,void 0,void 0,void 0,void 0,void 0,void 0,fe),stencilBuffer:_.stencil,colorSpace:e.outputColorSpace,samples:_.antialias?4:0,resolveDepthBuffer:h.ignoreDepthValues===!1,resolveStencilBuffer:h.ignoreDepthValues===!1})}else{const fe={antialias:_.antialias,alpha:!0,depth:_.depth,stencil:_.stencil,framebufferScaleFactor:r};g=new XRWebGLLayer(i,t,fe),i.updateRenderState({baseLayer:g}),e.setPixelRatio(1),e.setSize(g.framebufferWidth,g.framebufferHeight,!1),w=new In(g.framebufferWidth,g.framebufferHeight,{format:bn,type:Zs,colorSpace:e.outputColorSpace,stencilBuffer:_.stencil,resolveDepthBuffer:g.ignoreDepthValues===!1,resolveStencilBuffer:g.ignoreDepthValues===!1})}w.isXRRenderTarget=!0,this.setFoveation(l),c=null,a=await i.requestReferenceSpace(o),Ve.setContext(i),Ve.start(),s.isPresenting=!0,s.dispatchEvent({type:"sessionstart"})}},this.getEnvironmentBlendMode=function(){if(i!==null)return i.environmentBlendMode},this.getDepthTexture=function(){return m.getDepthTexture()};function X(le){for(let ue=0;ue<le.removed.length;ue++){const fe=le.removed[ue],et=S.indexOf(fe);et>=0&&(S[et]=null,x[et].disconnect(fe))}for(let ue=0;ue<le.added.length;ue++){const fe=le.added[ue];let et=S.indexOf(fe);if(et===-1){for(let Qe=0;Qe<x.length;Qe++)if(Qe>=S.length){S.push(fe),et=Qe;break}else if(S[Qe]===null){S[Qe]=fe,et=Qe;break}if(et===-1)break}const ct=x[et];ct&&ct.connect(fe)}}const Q=new U,ie=new U;function be(le,ue,fe){Q.setFromMatrixPosition(ue.matrixWorld),ie.setFromMatrixPosition(fe.matrixWorld);const et=Q.distanceTo(ie),ct=ue.projectionMatrix.elements,Qe=fe.projectionMatrix.elements,Zt=ct[14]/(ct[10]-1),gt=ct[14]/(ct[10]+1),Rt=(ct[9]+1)/ct[5],it=(ct[9]-1)/ct[5],yt=(ct[8]-1)/ct[0],ns=(Qe[8]+1)/Qe[0],Ut=Zt*yt,rs=Zt*ns,as=et/(-yt+ns),Qt=as*-yt;if(ue.matrixWorld.decompose(le.position,le.quaternion,le.scale),le.translateX(Qt),le.translateZ(as),le.matrixWorld.compose(le.position,le.quaternion,le.scale),le.matrixWorldInverse.copy(le.matrixWorld).invert(),ct[10]===-1)le.projectionMatrix.copy(ue.projectionMatrix),le.projectionMatrixInverse.copy(ue.projectionMatrixInverse);else{const es=Zt+as,q=gt+as,Os=Ut-Qt,Bt=rs+(et-Qt),R=Rt*gt/q*es,y=it*gt/q*es;le.projectionMatrix.makePerspective(Os,Bt,R,y,es,q),le.projectionMatrixInverse.copy(le.projectionMatrix).invert()}}function ae(le,ue){ue===null?le.matrixWorld.copy(le.matrix):le.matrixWorld.multiplyMatrices(ue.matrixWorld,le.matrix),le.matrixWorldInverse.copy(le.matrixWorld).invert()}this.updateCamera=function(le){if(i===null)return;let ue=le.near,fe=le.far;m.texture!==null&&(m.depthNear>0&&(ue=m.depthNear),m.depthFar>0&&(fe=m.depthFar)),k.near=B.near=A.near=ue,k.far=B.far=A.far=fe,(L!==k.near||F!==k.far)&&(i.updateRenderState({depthNear:k.near,depthFar:k.far}),L=k.near,F=k.far),k.layers.mask=le.layers.mask|6,A.layers.mask=k.layers.mask&-5,B.layers.mask=k.layers.mask&-3;const et=le.parent,ct=k.cameras;ae(k,et);for(let Qe=0;Qe<ct.length;Qe++)ae(ct[Qe],et);ct.length===2?be(k,A,B):k.projectionMatrix.copy(A.projectionMatrix),xe(le,k,et)};function xe(le,ue,fe){fe===null?le.matrix.copy(ue.matrixWorld):(le.matrix.copy(fe.matrixWorld),le.matrix.invert(),le.matrix.multiply(ue.matrixWorld)),le.matrix.decompose(le.position,le.quaternion,le.scale),le.updateMatrixWorld(!0),le.projectionMatrix.copy(ue.projectionMatrix),le.projectionMatrixInverse.copy(ue.projectionMatrixInverse),le.isPerspectiveCamera&&(le.fov=Kd*2*Math.atan(1/le.projectionMatrix.elements[5]),le.zoom=1)}this.getCamera=function(){return k},this.getFoveation=function(){if(!(h===null&&g===null))return l},this.setFoveation=function(le){l=le,h!==null&&(h.fixedFoveation=le),g!==null&&g.fixedFoveation!==void 0&&(g.fixedFoveation=le)},this.hasDepthSensing=function(){return m.texture!==null},this.getDepthSensingMesh=function(){return m.getMesh(k)},this.getCameraTexture=function(le){return f[le]};let Ze=null;function nt(le,ue){if(d=ue.getViewerPose(c||a),p=ue,d!==null){const fe=d.views;g!==null&&(e.setRenderTargetFramebuffer(w,g.framebuffer),e.setRenderTarget(w));let et=!1;fe.length!==k.cameras.length&&(k.cameras.length=0,et=!0);for(let gt=0;gt<fe.length;gt++){const Rt=fe[gt];let it=null;if(g!==null)it=g.getViewport(Rt);else{const ns=u.getViewSubImage(h,Rt);it=ns.viewport,gt===0&&(e.setRenderTargetTextures(w,ns.colorTexture,ns.depthStencilTexture),e.setRenderTarget(w))}let yt=N[gt];yt===void 0&&(yt=new nn,yt.layers.enable(gt),yt.viewport=new ts,N[gt]=yt),yt.matrix.fromArray(Rt.transform.matrix),yt.matrix.decompose(yt.position,yt.quaternion,yt.scale),yt.projectionMatrix.fromArray(Rt.projectionMatrix),yt.projectionMatrixInverse.copy(yt.projectionMatrix).invert(),yt.viewport.set(it.x,it.y,it.width,it.height),gt===0&&(k.matrix.copy(yt.matrix),k.matrix.decompose(k.position,k.quaternion,k.scale)),et===!0&&k.cameras.push(yt)}const ct=i.enabledFeatures;if(ct&&ct.includes("depth-sensing")&&i.depthUsage=="gpu-optimized"&&z){u=s.getBinding();const gt=u.getDepthInformation(fe[0]);gt&&gt.isValid&&gt.texture&&m.init(gt,i.renderState)}if(ct&&ct.includes("camera-access")&&z){e.state.unbindTexture(),u=s.getBinding();for(let gt=0;gt<fe.length;gt++){const Rt=fe[gt].camera;if(Rt){let it=f[Rt];it||(it=new Zm,f[Rt]=it);const yt=u.getCameraImage(Rt);it.sourceTexture=yt}}}}for(let fe=0;fe<x.length;fe++){const et=S[fe],ct=x[fe];et!==null&&ct!==void 0&&ct.update(et,ue,c||a)}Ze&&Ze(le,ue),ue.detectedPlanes&&s.dispatchEvent({type:"planesdetected",data:ue}),p=null}const Ve=new tg;Ve.setAnimationLoop(nt),this.setAnimationLoop=function(le){Ze=le},this.dispose=function(){}}}const rx=new Gt,lg=new ut;lg.set(-1,0,0,0,1,0,0,0,1);function ax(n,e){function t(m,f){m.matrixAutoUpdate===!0&&m.updateMatrix(),f.value.copy(m.matrix)}function s(m,f){f.color.getRGB(m.fogColor.value,Qm(n)),f.isFog?(m.fogNear.value=f.near,m.fogFar.value=f.far):f.isFogExp2&&(m.fogDensity.value=f.density)}function i(m,f,_,O,w){f.isNodeMaterial?f.uniformsNeedUpdate=!1:f.isMeshBasicMaterial?r(m,f):f.isMeshLambertMaterial?(r(m,f),f.envMap&&(m.envMapIntensity.value=f.envMapIntensity)):f.isMeshToonMaterial?(r(m,f),u(m,f)):f.isMeshPhongMaterial?(r(m,f),d(m,f),f.envMap&&(m.envMapIntensity.value=f.envMapIntensity)):f.isMeshStandardMaterial?(r(m,f),h(m,f),f.isMeshPhysicalMaterial&&g(m,f,w)):f.isMeshMatcapMaterial?(r(m,f),p(m,f)):f.isMeshDepthMaterial?r(m,f):f.isMeshDistanceMaterial?(r(m,f),z(m,f)):f.isMeshNormalMaterial?r(m,f):f.isLineBasicMaterial?(a(m,f),f.isLineDashedMaterial&&o(m,f)):f.isPointsMaterial?l(m,f,_,O):f.isSpriteMaterial?c(m,f):f.isShadowMaterial?(m.color.value.copy(f.color),m.opacity.value=f.opacity):f.isShaderMaterial&&(f.uniformsNeedUpdate=!1)}function r(m,f){m.opacity.value=f.opacity,f.color&&m.diffuse.value.copy(f.color),f.emissive&&m.emissive.value.copy(f.emissive).multiplyScalar(f.emissiveIntensity),f.map&&(m.map.value=f.map,t(f.map,m.mapTransform)),f.alphaMap&&(m.alphaMap.value=f.alphaMap,t(f.alphaMap,m.alphaMapTransform)),f.bumpMap&&(m.bumpMap.value=f.bumpMap,t(f.bumpMap,m.bumpMapTransform),m.bumpScale.value=f.bumpScale,f.side===ks&&(m.bumpScale.value*=-1)),f.normalMap&&(m.normalMap.value=f.normalMap,t(f.normalMap,m.normalMapTransform),m.normalScale.value.copy(f.normalScale),f.side===ks&&m.normalScale.value.negate()),f.displacementMap&&(m.displacementMap.value=f.displacementMap,t(f.displacementMap,m.displacementMapTransform),m.displacementScale.value=f.displacementScale,m.displacementBias.value=f.displacementBias),f.emissiveMap&&(m.emissiveMap.value=f.emissiveMap,t(f.emissiveMap,m.emissiveMapTransform)),f.specularMap&&(m.specularMap.value=f.specularMap,t(f.specularMap,m.specularMapTransform)),f.alphaTest>0&&(m.alphaTest.value=f.alphaTest);const _=e.get(f),O=_.envMap,w=_.envMapRotation;O&&(m.envMap.value=O,m.envMapRotation.value.setFromMatrix4(rx.makeRotationFromEuler(w)).transpose(),O.isCubeTexture&&O.isRenderTargetTexture===!1&&m.envMapRotation.value.premultiply(lg),m.reflectivity.value=f.reflectivity,m.ior.value=f.ior,m.refractionRatio.value=f.refractionRatio),f.lightMap&&(m.lightMap.value=f.lightMap,m.lightMapIntensity.value=f.lightMapIntensity,t(f.lightMap,m.lightMapTransform)),f.aoMap&&(m.aoMap.value=f.aoMap,m.aoMapIntensity.value=f.aoMapIntensity,t(f.aoMap,m.aoMapTransform))}function a(m,f){m.diffuse.value.copy(f.color),m.opacity.value=f.opacity,f.map&&(m.map.value=f.map,t(f.map,m.mapTransform))}function o(m,f){m.dashSize.value=f.dashSize,m.totalSize.value=f.dashSize+f.gapSize,m.scale.value=f.scale}function l(m,f,_,O){m.diffuse.value.copy(f.color),m.opacity.value=f.opacity,m.size.value=f.size*_,m.scale.value=O*.5,f.map&&(m.map.value=f.map,t(f.map,m.uvTransform)),f.alphaMap&&(m.alphaMap.value=f.alphaMap,t(f.alphaMap,m.alphaMapTransform)),f.alphaTest>0&&(m.alphaTest.value=f.alphaTest)}function c(m,f){m.diffuse.value.copy(f.color),m.opacity.value=f.opacity,m.rotation.value=f.rotation,f.map&&(m.map.value=f.map,t(f.map,m.mapTransform)),f.alphaMap&&(m.alphaMap.value=f.alphaMap,t(f.alphaMap,m.alphaMapTransform)),f.alphaTest>0&&(m.alphaTest.value=f.alphaTest)}function d(m,f){m.specular.value.copy(f.specular),m.shininess.value=Math.max(f.shininess,1e-4)}function u(m,f){f.gradientMap&&(m.gradientMap.value=f.gradientMap)}function h(m,f){m.metalness.value=f.metalness,f.metalnessMap&&(m.metalnessMap.value=f.metalnessMap,t(f.metalnessMap,m.metalnessMapTransform)),m.roughness.value=f.roughness,f.roughnessMap&&(m.roughnessMap.value=f.roughnessMap,t(f.roughnessMap,m.roughnessMapTransform)),f.envMap&&(m.envMapIntensity.value=f.envMapIntensity)}function g(m,f,_){m.ior.value=f.ior,f.sheen>0&&(m.sheenColor.value.copy(f.sheenColor).multiplyScalar(f.sheen),m.sheenRoughness.value=f.sheenRoughness,f.sheenColorMap&&(m.sheenColorMap.value=f.sheenColorMap,t(f.sheenColorMap,m.sheenColorMapTransform)),f.sheenRoughnessMap&&(m.sheenRoughnessMap.value=f.sheenRoughnessMap,t(f.sheenRoughnessMap,m.sheenRoughnessMapTransform))),f.clearcoat>0&&(m.clearcoat.value=f.clearcoat,m.clearcoatRoughness.value=f.clearcoatRoughness,f.clearcoatMap&&(m.clearcoatMap.value=f.clearcoatMap,t(f.clearcoatMap,m.clearcoatMapTransform)),f.clearcoatRoughnessMap&&(m.clearcoatRoughnessMap.value=f.clearcoatRoughnessMap,t(f.clearcoatRoughnessMap,m.clearcoatRoughnessMapTransform)),f.clearcoatNormalMap&&(m.clearcoatNormalMap.value=f.clearcoatNormalMap,t(f.clearcoatNormalMap,m.clearcoatNormalMapTransform),m.clearcoatNormalScale.value.copy(f.clearcoatNormalScale),f.side===ks&&m.clearcoatNormalScale.value.negate())),f.dispersion>0&&(m.dispersion.value=f.dispersion),f.iridescence>0&&(m.iridescence.value=f.iridescence,m.iridescenceIOR.value=f.iridescenceIOR,m.iridescenceThicknessMinimum.value=f.iridescenceThicknessRange[0],m.iridescenceThicknessMaximum.value=f.iridescenceThicknessRange[1],f.iridescenceMap&&(m.iridescenceMap.value=f.iridescenceMap,t(f.iridescenceMap,m.iridescenceMapTransform)),f.iridescenceThicknessMap&&(m.iridescenceThicknessMap.value=f.iridescenceThicknessMap,t(f.iridescenceThicknessMap,m.iridescenceThicknessMapTransform))),f.transmission>0&&(m.transmission.value=f.transmission,m.transmissionSamplerMap.value=_.texture,m.transmissionSamplerSize.value.set(_.width,_.height),f.transmissionMap&&(m.transmissionMap.value=f.transmissionMap,t(f.transmissionMap,m.transmissionMapTransform)),m.thickness.value=f.thickness,f.thicknessMap&&(m.thicknessMap.value=f.thicknessMap,t(f.thicknessMap,m.thicknessMapTransform)),m.attenuationDistance.value=f.attenuationDistance,m.attenuationColor.value.copy(f.attenuationColor)),f.anisotropy>0&&(m.anisotropyVector.value.set(f.anisotropy*Math.cos(f.anisotropyRotation),f.anisotropy*Math.sin(f.anisotropyRotation)),f.anisotropyMap&&(m.anisotropyMap.value=f.anisotropyMap,t(f.anisotropyMap,m.anisotropyMapTransform))),m.specularIntensity.value=f.specularIntensity,m.specularColor.value.copy(f.specularColor),f.specularColorMap&&(m.specularColorMap.value=f.specularColorMap,t(f.specularColorMap,m.specularColorMapTransform)),f.specularIntensityMap&&(m.specularIntensityMap.value=f.specularIntensityMap,t(f.specularIntensityMap,m.specularIntensityMapTransform))}function p(m,f){f.matcap&&(m.matcap.value=f.matcap)}function z(m,f){const _=e.get(f).light;m.referencePosition.value.setFromMatrixPosition(_.matrixWorld),m.nearDistance.value=_.shadow.camera.near,m.farDistance.value=_.shadow.camera.far}return{refreshFogUniforms:s,refreshMaterialUniforms:i}}function ox(n,e,t,s){let i={},r={},a=[];const o=n.getParameter(n.MAX_UNIFORM_BUFFER_BINDINGS);function l(w,x){const S=x.program;s.uniformBlockBinding(w,S)}function c(w,x){let S=i[w.id];S===void 0&&(m(w),S=d(w),i[w.id]=S,w.addEventListener("dispose",_));const I=x.program;s.updateUBOMapping(w,I);const b=e.render.frame;r[w.id]!==b&&(h(w),r[w.id]=b)}function d(w){const x=u();w.__bindingPointIndex=x;const S=n.createBuffer(),I=w.__size,b=w.usage;return n.bindBuffer(n.UNIFORM_BUFFER,S),n.bufferData(n.UNIFORM_BUFFER,I,b),n.bindBuffer(n.UNIFORM_BUFFER,null),n.bindBufferBase(n.UNIFORM_BUFFER,x,S),S}function u(){for(let w=0;w<o;w++)if(a.indexOf(w)===-1)return a.push(w),w;return Ot("WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}function h(w){const x=i[w.id],S=w.uniforms,I=w.__cache;n.bindBuffer(n.UNIFORM_BUFFER,x);for(let b=0,A=S.length;b<A;b++){const B=S[b];if(Array.isArray(B))for(let N=0,k=B.length;N<k;N++)g(B[N],b,N,I);else g(B,b,0,I)}n.bindBuffer(n.UNIFORM_BUFFER,null)}function g(w,x,S,I){if(z(w,x,S,I)===!0){const b=w.__offset,A=w.value;if(Array.isArray(A)){let B=0;for(let N=0;N<A.length;N++){const k=A[N],L=f(k);p(k,w.__data,B),typeof k!="number"&&typeof k!="boolean"&&!k.isMatrix3&&!ArrayBuffer.isView(k)&&(B+=L.storage/Float32Array.BYTES_PER_ELEMENT)}}else p(A,w.__data,0);n.bufferSubData(n.UNIFORM_BUFFER,b,w.__data)}}function p(w,x,S){typeof w=="number"||typeof w=="boolean"?x[0]=w:w.isMatrix3?(x[0]=w.elements[0],x[1]=w.elements[1],x[2]=w.elements[2],x[3]=0,x[4]=w.elements[3],x[5]=w.elements[4],x[6]=w.elements[5],x[7]=0,x[8]=w.elements[6],x[9]=w.elements[7],x[10]=w.elements[8],x[11]=0):ArrayBuffer.isView(w)?x.set(new w.constructor(w.buffer,w.byteOffset,x.length)):w.toArray(x,S)}function z(w,x,S,I){const b=w.value,A=x+"_"+S;if(I[A]===void 0)return typeof b=="number"||typeof b=="boolean"?I[A]=b:ArrayBuffer.isView(b)?I[A]=b.slice():I[A]=b.clone(),!0;{const B=I[A];if(typeof b=="number"||typeof b=="boolean"){if(B!==b)return I[A]=b,!0}else{if(ArrayBuffer.isView(b))return!0;if(B.equals(b)===!1)return B.copy(b),!0}}return!1}function m(w){const x=w.uniforms;let S=0;const I=16;for(let A=0,B=x.length;A<B;A++){const N=Array.isArray(x[A])?x[A]:[x[A]];for(let k=0,L=N.length;k<L;k++){const F=N[k],P=Array.isArray(F.value)?F.value:[F.value];for(let W=0,X=P.length;W<X;W++){const Q=P[W],ie=f(Q),be=S%I,ae=be%ie.boundary,xe=be+ae;S+=ae,xe!==0&&I-xe<ie.storage&&(S+=I-xe),F.__data=new Float32Array(ie.storage/Float32Array.BYTES_PER_ELEMENT),F.__offset=S,S+=ie.storage}}}const b=S%I;return b>0&&(S+=I-b),w.__size=S,w.__cache={},this}function f(w){const x={boundary:0,storage:0};return typeof w=="number"||typeof w=="boolean"?(x.boundary=4,x.storage=4):w.isVector2?(x.boundary=8,x.storage=8):w.isVector3||w.isColor?(x.boundary=16,x.storage=12):w.isVector4?(x.boundary=16,x.storage=16):w.isMatrix3?(x.boundary=48,x.storage=48):w.isMatrix4?(x.boundary=64,x.storage=64):w.isTexture?st("WebGLRenderer: Texture samplers can not be part of an uniforms group."):ArrayBuffer.isView(w)?(x.boundary=16,x.storage=w.byteLength):st("WebGLRenderer: Unsupported uniform value type.",w),x}function _(w){const x=w.target;x.removeEventListener("dispose",_);const S=a.indexOf(x.__bindingPointIndex);a.splice(S,1),n.deleteBuffer(i[x.id]),delete i[x.id],delete r[x.id]}function O(){for(const w in i)n.deleteBuffer(i[w]);a=[],i={},r={}}return{bind:l,update:c,dispose:O}}const lx=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 yn=null;function cx(){return yn===null&&(yn=new qm(lx,16,16,er,ti),yn.name="DFG_LUT",yn.minFilter=Ds,yn.magFilter=Ds,yn.wrapS=Yn,yn.wrapT=Yn,yn.generateMipmaps=!1,yn.needsUpdate=!0),yn}class dx{constructor(e={}){const{canvas:t=vz(),context:s=null,depth:i=!0,stencil:r=!1,alpha:a=!1,antialias:o=!1,premultipliedAlpha:l=!0,preserveDrawingBuffer:c=!1,powerPreference:d="default",failIfMajorPerformanceCaveat:u=!1,reversedDepthBuffer:h=!1,outputBufferType:g=Zs}=e;this.isWebGLRenderer=!0;let p;if(s!==null){if(typeof WebGLRenderingContext<"u"&&s instanceof WebGLRenderingContext)throw new Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");p=s.getContextAttributes().alpha}else p=a;const z=g,m=new Set([_u,zu,bu]),f=new Set([Zs,Gn,La,Wa,mu,gu]),_=new Uint32Array(4),O=new Int32Array(4),w=new U;let x=null,S=null;const I=[],b=[];let A=null;this.domElement=t,this.debug={checkShaderErrors:!0,onShaderError:null},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.toneMapping=Dn,this.toneMappingExposure=1,this.transmissionResolutionScale=1;const B=this;let N=!1,k=null,L=null,F=null,P=null;this._outputColorSpace=sn;let W=0,X=0,Q=null,ie=-1,be=null;const ae=new ts,xe=new ts;let Ze=null;const nt=new Ke(0);let Ve=0,le=t.width,ue=t.height,fe=1,et=null,ct=null;const Qe=new ts(0,0,le,ue),Zt=new ts(0,0,le,ue);let gt=!1;const Rt=new Eu;let it=!1,yt=!1;const ns=new Gt,Ut=new U,rs=new ts,as={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};let Qt=!1;function es(){return Q===null?fe:1}let q=s;function Os(E,Y){return t.getContext(E,Y)}try{const E={alpha:!0,depth:i,stencil:r,antialias:o,premultipliedAlpha:l,preserveDrawingBuffer:c,powerPreference:d,failIfMajorPerformanceCaveat:u};if("setAttribute"in t&&t.setAttribute("data-engine",`three.js r${fu}`),t.addEventListener("webglcontextlost",Vt,!1),t.addEventListener("webglcontextrestored",Pt,!1),t.addEventListener("webglcontextcreationerror",js,!1),q===null){const Y="webgl2";if(q=Os(Y,E),q===null)throw Os(Y)?new Error("THREE.WebGLRenderer: Error creating WebGL context with your selected attributes."):new Error("THREE.WebGLRenderer: Error creating WebGL context.")}}catch(E){throw Ot("WebGLRenderer: "+E.message),E}let Bt,R,y,K,se,re,ve,Ae,oe,he,Se,He,De,Ie,Xe,Je,dt,V,Ee,ce,Te,Ne,pe;function Pe(){Bt=new cv(q),Bt.init(),Te=new ex(q,Bt),R=new tv(q,Bt,e,Te),y=new QO(q,Bt),R.reversedDepthBuffer&&h&&y.buffers.depth.setReversed(!0),L=q.createFramebuffer(),F=q.createFramebuffer(),P=q.createFramebuffer(),K=new hv(q),se=new LO,re=new JO(q,Bt,y,se,R,Te,K),ve=new lv(B),Ae=new g_(q),Ne=new Jy(q,Ae),oe=new dv(q,Ae,K,Ne),he=new pv(q,oe,Ae,Ne,K),V=new fv(q,R,re),Xe=new sv(se),Se=new PO(B,ve,Bt,R,Ne,Xe),He=new ax(B,se),De=new kO,Ie=new HO(Bt),dt=new Qy(B,ve,y,he,p,l),Je=new ZO(B,he,R),pe=new ox(q,K,R,y),Ee=new ev(q,Bt,K),ce=new uv(q,Bt,K),K.programs=Se.programs,B.capabilities=R,B.extensions=Bt,B.properties=se,B.renderLists=De,B.shadowMap=Je,B.state=y,B.info=K}Pe(),z!==Zs&&(A=new gv(z,t.width,t.height,o,i,r));const Ue=new ix(B,q);this.xr=Ue,this.getContext=function(){return q},this.getContextAttributes=function(){return q.getContextAttributes()},this.forceContextLoss=function(){const E=Bt.get("WEBGL_lose_context");E&&E.loseContext()},this.forceContextRestore=function(){const E=Bt.get("WEBGL_lose_context");E&&E.restoreContext()},this.getPixelRatio=function(){return fe},this.setPixelRatio=function(E){E!==void 0&&(fe=E,this.setSize(le,ue,!1))},this.getSize=function(E){return E.set(le,ue)},this.setSize=function(E,Y,te=!0){if(Ue.isPresenting){st("WebGLRenderer: Can't change size while VR device is presenting.");return}le=E,ue=Y,t.width=Math.floor(E*fe),t.height=Math.floor(Y*fe),te===!0&&(t.style.width=E+"px",t.style.height=Y+"px"),A!==null&&A.setSize(t.width,t.height),this.setViewport(0,0,E,Y)},this.getDrawingBufferSize=function(E){return E.set(le*fe,ue*fe).floor()},this.setDrawingBufferSize=function(E,Y,te){le=E,ue=Y,fe=te,t.width=Math.floor(E*te),t.height=Math.floor(Y*te),this.setViewport(0,0,E,Y)},this.setEffects=function(E){if(z===Zs){Ot("WebGLRenderer: setEffects() requires outputBufferType set to HalfFloatType or FloatType.");return}if(E){for(let Y=0;Y<E.length;Y++)if(E[Y].isOutputPass===!0){st("WebGLRenderer: OutputPass is not needed in setEffects(). Tone mapping and color space conversion are applied automatically.");break}}A.setEffects(E||[])},this.getCurrentViewport=function(E){return E.copy(ae)},this.getViewport=function(E){return E.copy(Qe)},this.setViewport=function(E,Y,te,J){E.isVector4?Qe.set(E.x,E.y,E.z,E.w):Qe.set(E,Y,te,J),y.viewport(ae.copy(Qe).multiplyScalar(fe).round())},this.getScissor=function(E){return E.copy(Zt)},this.setScissor=function(E,Y,te,J){E.isVector4?Zt.set(E.x,E.y,E.z,E.w):Zt.set(E,Y,te,J),y.scissor(xe.copy(Zt).multiplyScalar(fe).round())},this.getScissorTest=function(){return gt},this.setScissorTest=function(E){y.setScissorTest(gt=E)},this.setOpaqueSort=function(E){et=E},this.setTransparentSort=function(E){ct=E},this.getClearColor=function(E){return E.copy(dt.getClearColor())},this.setClearColor=function(){dt.setClearColor(...arguments)},this.getClearAlpha=function(){return dt.getClearAlpha()},this.setClearAlpha=function(){dt.setClearAlpha(...arguments)},this.clear=function(E=!0,Y=!0,te=!0){let J=0;if(E){let ee=!1;if(Q!==null){const Ge=Q.texture.format;ee=m.has(Ge)}if(ee){const Ge=Q.texture.type,me=f.has(Ge),Re=dt.getClearColor(),Fe=dt.getClearAlpha(),We=Re.r,tt=Re.g,ft=Re.b;me?(_[0]=We,_[1]=tt,_[2]=ft,_[3]=Fe,q.clearBufferuiv(q.COLOR,0,_)):(O[0]=We,O[1]=tt,O[2]=ft,O[3]=Fe,q.clearBufferiv(q.COLOR,0,O))}else J|=q.COLOR_BUFFER_BIT}Y&&(J|=q.DEPTH_BUFFER_BIT,this.state.buffers.depth.setMask(!0)),te&&(J|=q.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),J!==0&&q.clear(J)},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(E){E.setRenderer(this),k=E},this.dispose=function(){t.removeEventListener("webglcontextlost",Vt,!1),t.removeEventListener("webglcontextrestored",Pt,!1),t.removeEventListener("webglcontextcreationerror",js,!1),dt.dispose(),De.dispose(),Ie.dispose(),se.dispose(),ve.dispose(),he.dispose(),Ne.dispose(),pe.dispose(),Se.dispose(),Ue.dispose(),Ue.removeEventListener("sessionstart",$s),Ue.removeEventListener("sessionend",na),xs.stop()};function Vt(E){E.preventDefault(),fl("WebGLRenderer: Context Lost."),N=!0}function Pt(){fl("WebGLRenderer: Context Restored."),N=!1;const E=K.autoReset,Y=Je.enabled,te=Je.autoUpdate,J=Je.needsUpdate,ee=Je.type;Pe(),K.autoReset=E,Je.enabled=Y,Je.autoUpdate=te,Je.needsUpdate=J,Je.type=ee}function js(E){Ot("WebGLRenderer: A WebGL context could not be created. Reason: ",E.statusMessage)}function Ls(E){const Y=E.target;Y.removeEventListener("dispose",Ls),ta(Y)}function ta(E){sa(E),se.remove(E)}function sa(E){const Y=se.get(E).programs;Y!==void 0&&(Y.forEach(function(te){Se.releaseProgram(te)}),E.isShaderMaterial&&Se.releaseShaderCache(E))}this.renderBufferDirect=function(E,Y,te,J,ee,Ge){Y===null&&(Y=as);const me=ee.isMesh&&ee.matrixWorld.determinantAffine()<0,Re=ln(E,Y,te,J,ee);y.setMaterial(J,me);let Fe=te.index,We=1;if(J.wireframe===!0){if(Fe=oe.getWireframeAttribute(te),Fe===void 0)return;We=2}const tt=te.drawRange,ft=te.attributes.position;let Ye=tt.start*We,Nt=(tt.start+tt.count)*We;Ge!==null&&(Ye=Math.max(Ye,Ge.start*We),Nt=Math.min(Nt,(Ge.start+Ge.count)*We)),Fe!==null?(Ye=Math.max(Ye,0),Nt=Math.min(Nt,Fe.count)):ft!=null&&(Ye=Math.max(Ye,0),Nt=Math.min(Nt,ft.count));const Ht=Nt-Ye;if(Ht<0||Ht===1/0)return;Ne.setup(ee,J,Re,te,Fe);let Jt,Tt=Ee;if(Fe!==null&&(Jt=Ae.get(Fe),Tt=ce,Tt.setIndex(Jt)),ee.isMesh)J.wireframe===!0?(y.setLineWidth(J.wireframeLinewidth*es()),Tt.setMode(q.LINES)):Tt.setMode(q.TRIANGLES);else if(ee.isLine){let us=J.linewidth;us===void 0&&(us=1),y.setLineWidth(us*es()),ee.isLineSegments?Tt.setMode(q.LINES):ee.isLineLoop?Tt.setMode(q.LINE_LOOP):Tt.setMode(q.LINE_STRIP)}else ee.isPoints?Tt.setMode(q.POINTS):ee.isSprite&&Tt.setMode(q.TRIANGLES);if(ee.isBatchedMesh)if(Bt.get("WEBGL_multi_draw"))Tt.renderMultiDraw(ee._multiDrawStarts,ee._multiDrawCounts,ee._multiDrawCount);else{const us=ee._multiDrawStarts,Le=ee._multiDrawCounts,qt=ee._multiDrawCount,pt=Fe?Ae.get(Fe).bytesPerElement:1,zs=se.get(J).currentProgram.getUniforms();for(let _s=0;_s<qt;_s++)zs.setValue(q,"_gl_DrawID",_s),Tt.render(us[_s]/pt,Le[_s])}else if(ee.isInstancedMesh)Tt.renderInstances(Ye,Ht,ee.count);else if(te.isInstancedBufferGeometry){const us=te._maxInstanceCount!==void 0?te._maxInstanceCount:1/0,Le=Math.min(te.instanceCount,us);Tt.renderInstances(Ye,Ht,Le)}else Tt.render(Ye,Ht)};function ii(E,Y,te){E.transparent===!0&&E.side===Hn&&E.forceSinglePass===!1?(E.side=ks,E.needsUpdate=!0,zn(E,Y,te),E.side=Ei,E.needsUpdate=!0,zn(E,Y,te),E.side=Hn):zn(E,Y,te)}this.compile=function(E,Y,te=null){te===null&&(te=E),S=Ie.get(te),S.init(Y),b.push(S),te.traverseVisible(function(ee){ee.isLight&&ee.layers.test(Y.layers)&&(S.pushLight(ee),ee.castShadow&&S.pushShadow(ee))}),E!==te&&E.traverseVisible(function(ee){ee.isLight&&ee.layers.test(Y.layers)&&(S.pushLight(ee),ee.castShadow&&S.pushShadow(ee))}),S.setupLights();const J=new Set;return E.traverse(function(ee){if(!(ee.isMesh||ee.isPoints||ee.isLine||ee.isSprite))return;const Ge=ee.material;if(Ge)if(Array.isArray(Ge))for(let me=0;me<Ge.length;me++){const Re=Ge[me];ii(Re,te,ee),J.add(Re)}else ii(Ge,te,ee),J.add(Ge)}),S=b.pop(),J},this.compileAsync=function(E,Y,te=null){const J=this.compile(E,Y,te);return new Promise(ee=>{function Ge(){if(J.forEach(function(me){se.get(me).currentProgram.isReady()&&J.delete(me)}),J.size===0){ee(E);return}setTimeout(Ge,10)}Bt.get("KHR_parallel_shader_compile")!==null?Ge():setTimeout(Ge,10)})};let ri=null;function Nl(E){ri&&ri(E)}function $s(){xs.stop()}function na(){xs.start()}const xs=new tg;xs.setAnimationLoop(Nl),typeof self<"u"&&xs.setContext(self),this.setAnimationLoop=function(E){ri=E,Ue.setAnimationLoop(E),E===null?xs.stop():xs.start()},Ue.addEventListener("sessionstart",$s),Ue.addEventListener("sessionend",na),this.render=function(E,Y){if(Y!==void 0&&Y.isCamera!==!0){Ot("WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(N===!0)return;k!==null&&k.renderStart(E,Y);const te=Ue.enabled===!0&&Ue.isPresenting===!0,J=A!==null&&(Q===null||te)&&A.begin(B,Q);if(E.matrixWorldAutoUpdate===!0&&E.updateMatrixWorld(),Y.parent===null&&Y.matrixWorldAutoUpdate===!0&&Y.updateMatrixWorld(),Ue.enabled===!0&&Ue.isPresenting===!0&&(A===null||A.isCompositing()===!1)&&(Ue.cameraAutoUpdate===!0&&Ue.updateCamera(Y),Y=Ue.getCamera()),E.isScene===!0&&E.onBeforeRender(B,E,Y,Q),S=Ie.get(E,b.length),S.init(Y),S.state.textureUnits=re.getTextureUnits(),b.push(S),ns.multiplyMatrices(Y.projectionMatrix,Y.matrixWorldInverse),Rt.setFromProjectionMatrix(ns,An,Y.reversedDepth),yt=this.localClippingEnabled,it=Xe.init(this.clippingPlanes,yt),x=De.get(E,I.length),x.init(),I.push(x),Ue.enabled===!0&&Ue.isPresenting===!0){const me=B.xr.getDepthSensingMesh();me!==null&&ia(me,Y,-1/0,B.sortObjects)}ia(E,Y,0,B.sortObjects),x.finish(),B.sortObjects===!0&&x.sort(et,ct,Y.reversedDepth),Qt=Ue.enabled===!1||Ue.isPresenting===!1||Ue.hasDepthSensing()===!1,Qt&&dt.addToRenderList(x,E),this.info.render.frame++,this.info.autoReset===!0&&this.info.reset(),it===!0&&Xe.beginShadows();const ee=S.state.shadowsArray;if(Je.render(ee,E,Y),it===!0&&Xe.endShadows(),(J&&A.hasRenderPass())===!1){const me=x.opaque,Re=x.transmissive;if(S.setupLights(),Y.isArrayCamera){const Fe=Y.cameras;if(Re.length>0)for(let We=0,tt=Fe.length;We<tt;We++){const ft=Fe[We];lr(me,Re,E,ft)}Qt&&dt.render(E);for(let We=0,tt=Fe.length;We<tt;We++){const ft=Fe[We];Ii(x,E,ft,ft.viewport)}}else Re.length>0&&lr(me,Re,E,Y),Qt&&dt.render(E),Ii(x,E,Y)}Q!==null&&X===0&&(re.updateMultisampleRenderTarget(Q),re.updateRenderTargetMipmap(Q)),J&&A.end(B),E.isScene===!0&&E.onAfterRender(B,E,Y),Ne.resetDefaultState(),ie=-1,be=null,b.pop(),b.length>0?(S=b[b.length-1],re.setTextureUnits(S.state.textureUnits),it===!0&&Xe.setGlobalState(B.clippingPlanes,S.state.camera)):S=null,I.pop(),I.length>0?x=I[I.length-1]:x=null,k!==null&&k.renderEnd()};function ia(E,Y,te,J){if(E.visible===!1)return;if(E.layers.test(Y.layers)){if(E.isGroup)te=E.renderOrder;else if(E.isLOD)E.autoUpdate===!0&&E.update(Y);else if(E.isLightProbeGrid)S.pushLightProbeGrid(E);else if(E.isLight)S.pushLight(E),E.castShadow&&S.pushShadow(E);else if(E.isSprite){if(!E.frustumCulled||Rt.intersectsSprite(E)){J&&rs.setFromMatrixPosition(E.matrixWorld).applyMatrix4(ns);const me=he.update(E),Re=E.material;Re.visible&&x.push(E,me,Re,te,rs.z,null)}}else if((E.isMesh||E.isLine||E.isPoints)&&(!E.frustumCulled||Rt.intersectsObject(E))){const me=he.update(E),Re=E.material;if(J&&(E.boundingSphere!==void 0?(E.boundingSphere===null&&E.computeBoundingSphere(),rs.copy(E.boundingSphere.center)):(me.boundingSphere===null&&me.computeBoundingSphere(),rs.copy(me.boundingSphere.center)),rs.applyMatrix4(E.matrixWorld).applyMatrix4(ns)),Array.isArray(Re)){const Fe=me.groups;for(let We=0,tt=Fe.length;We<tt;We++){const ft=Fe[We],Ye=Re[ft.materialIndex];Ye&&Ye.visible&&x.push(E,me,Ye,te,rs.z,ft)}}else Re.visible&&x.push(E,me,Re,te,rs.z,null)}}const Ge=E.children;for(let me=0,Re=Ge.length;me<Re;me++)ia(Ge[me],Y,te,J)}function Ii(E,Y,te,J){const{opaque:ee,transmissive:Ge,transparent:me}=E;S.setupLightsView(te),it===!0&&Xe.setGlobalState(B.clippingPlanes,te),J&&y.viewport(ae.copy(J)),ee.length>0&&ai(ee,Y,te),Ge.length>0&&ai(Ge,Y,te),me.length>0&&ai(me,Y,te),y.buffers.depth.setTest(!0),y.buffers.depth.setMask(!0),y.buffers.color.setMask(!0),y.setPolygonOffset(!1)}function lr(E,Y,te,J){if((te.isScene===!0?te.overrideMaterial:null)!==null)return;if(S.state.transmissionRenderTarget[J.id]===void 0){const Ye=Bt.has("EXT_color_buffer_half_float")||Bt.has("EXT_color_buffer_float");S.state.transmissionRenderTarget[J.id]=new In(1,1,{generateMipmaps:!0,type:Ye?ti:Zs,minFilter:Fi,samples:Math.max(4,R.samples),stencilBuffer:r,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:xt.workingColorSpace})}const Ge=S.state.transmissionRenderTarget[J.id],me=J.viewport||ae;Ge.setSize(me.z*B.transmissionResolutionScale,me.w*B.transmissionResolutionScale);const Re=B.getRenderTarget(),Fe=B.getActiveCubeFace(),We=B.getActiveMipmapLevel();B.setRenderTarget(Ge),B.getClearColor(nt),Ve=B.getClearAlpha(),Ve<1&&B.setClearColor(16777215,.5),B.clear(),Qt&&dt.render(te);const tt=B.toneMapping;B.toneMapping=Dn;const ft=J.viewport;if(J.viewport!==void 0&&(J.viewport=void 0),S.setupLightsView(J),it===!0&&Xe.setGlobalState(B.clippingPlanes,J),ai(E,te,J),re.updateMultisampleRenderTarget(Ge),re.updateRenderTargetMipmap(Ge),Bt.has("WEBGL_multisampled_render_to_texture")===!1){let Ye=!1;for(let Nt=0,Ht=Y.length;Nt<Ht;Nt++){const Jt=Y[Nt],{object:Tt,geometry:us,material:Le,group:qt}=Jt;if(Le.side===Hn&&Tt.layers.test(J.layers)){const pt=Le.side;Le.side=ks,Le.needsUpdate=!0,oi(Tt,te,J,us,Le,qt),Le.side=pt,Le.needsUpdate=!0,Ye=!0}}Ye===!0&&(re.updateMultisampleRenderTarget(Ge),re.updateRenderTargetMipmap(Ge))}B.setRenderTarget(Re,Fe,We),B.setClearColor(nt,Ve),ft!==void 0&&(J.viewport=ft),B.toneMapping=tt}function ai(E,Y,te){const J=Y.isScene===!0?Y.overrideMaterial:null;for(let ee=0,Ge=E.length;ee<Ge;ee++){const me=E[ee],{object:Re,geometry:Fe,group:We}=me;let tt=me.material;tt.allowOverride===!0&&J!==null&&(tt=J),Re.layers.test(te.layers)&&oi(Re,Y,te,Fe,tt,We)}}function oi(E,Y,te,J,ee,Ge){E.onBeforeRender(B,Y,te,J,ee,Ge),E.modelViewMatrix.multiplyMatrices(te.matrixWorldInverse,E.matrixWorld),E.normalMatrix.getNormalMatrix(E.modelViewMatrix),ee.onBeforeRender(B,Y,te,J,E,Ge),ee.transparent===!0&&ee.side===Hn&&ee.forceSinglePass===!1?(ee.side=ks,ee.needsUpdate=!0,B.renderBufferDirect(te,Y,J,ee,E,Ge),ee.side=Ei,ee.needsUpdate=!0,B.renderBufferDirect(te,Y,J,ee,E,Ge),ee.side=Hn):B.renderBufferDirect(te,Y,J,ee,E,Ge),E.onAfterRender(B,Y,te,J,ee,Ge)}function zn(E,Y,te){Y.isScene!==!0&&(Y=as);const J=se.get(E),ee=S.state.lights,Ge=S.state.shadowsArray,me=ee.state.version,Re=Se.getParameters(E,ee.state,Ge,Y,te,S.state.lightProbeGridArray),Fe=Se.getProgramCacheKey(Re);let We=J.programs;J.environment=E.isMeshStandardMaterial||E.isMeshLambertMaterial||E.isMeshPhongMaterial?Y.environment:null,J.fog=Y.fog;const tt=E.isMeshStandardMaterial||E.isMeshLambertMaterial&&!E.envMap||E.isMeshPhongMaterial&&!E.envMap;J.envMap=ve.get(E.envMap||J.environment,tt),J.envMapRotation=J.environment!==null&&E.envMap===null?Y.environmentRotation:E.envMapRotation,We===void 0&&(E.addEventListener("dispose",Ls),We=new Map,J.programs=We);let ft=We.get(Fe);if(ft!==void 0){if(J.currentProgram===ft&&J.lightsStateVersion===me)return _n(E,Re),ft}else Re.uniforms=Se.getUniforms(E),k!==null&&E.isNodeMaterial&&k.build(E,te,Re),E.onBeforeCompile(Re,B),ft=Se.acquireProgram(Re,Fe),We.set(Fe,ft),J.uniforms=Re.uniforms;const Ye=J.uniforms;return(!E.isShaderMaterial&&!E.isRawShaderMaterial||E.clipping===!0)&&(Ye.clippingPlanes=Xe.uniform),_n(E,Re),J.needsLights=$a(E),J.lightsStateVersion=me,J.needsLights&&(Ye.ambientLightColor.value=ee.state.ambient,Ye.lightProbe.value=ee.state.probe,Ye.directionalLights.value=ee.state.directional,Ye.directionalLightShadows.value=ee.state.directionalShadow,Ye.spotLights.value=ee.state.spot,Ye.spotLightShadows.value=ee.state.spotShadow,Ye.rectAreaLights.value=ee.state.rectArea,Ye.ltc_1.value=ee.state.rectAreaLTC1,Ye.ltc_2.value=ee.state.rectAreaLTC2,Ye.pointLights.value=ee.state.point,Ye.pointLightShadows.value=ee.state.pointShadow,Ye.hemisphereLights.value=ee.state.hemi,Ye.directionalShadowMatrix.value=ee.state.directionalShadowMatrix,Ye.spotLightMatrix.value=ee.state.spotLightMatrix,Ye.spotLightMap.value=ee.state.spotLightMap,Ye.pointShadowMatrix.value=ee.state.pointShadowMatrix),J.lightProbeGrid=S.state.lightProbeGridArray.length>0,J.currentProgram=ft,J.uniformsList=null,ft}function Qs(E){if(E.uniformsList===null){const Y=E.currentProgram.getUniforms();E.uniformsList=Fo.seqWithValue(Y.seq,E.uniforms)}return E.uniformsList}function _n(E,Y){const te=se.get(E);te.outputColorSpace=Y.outputColorSpace,te.batching=Y.batching,te.batchingColor=Y.batchingColor,te.instancing=Y.instancing,te.instancingColor=Y.instancingColor,te.instancingMorph=Y.instancingMorph,te.skinning=Y.skinning,te.morphTargets=Y.morphTargets,te.morphNormals=Y.morphNormals,te.morphColors=Y.morphColors,te.morphTargetsCount=Y.morphTargetsCount,te.numClippingPlanes=Y.numClippingPlanes,te.numIntersection=Y.numClipIntersection,te.vertexAlphas=Y.vertexAlphas,te.vertexTangents=Y.vertexTangents,te.toneMapping=Y.toneMapping}function _e(E,Y){if(E.length===0)return null;if(E.length===1)return E[0].texture!==null?E[0]:null;w.setFromMatrixPosition(Y.matrixWorld);for(let te=0,J=E.length;te<J;te++){const ee=E[te];if(ee.texture!==null&&ee.boundingBox.containsPoint(w))return ee}return null}function ln(E,Y,te,J,ee){Y.isScene!==!0&&(Y=as),re.resetTextureUnits();const Ge=Y.fog,me=J.isMeshStandardMaterial||J.isMeshLambertMaterial||J.isMeshPhongMaterial?Y.environment:null,Re=Q===null?B.outputColorSpace:Q.isXRRenderTarget===!0?Q.texture.colorSpace:xt.workingColorSpace,Fe=J.isMeshStandardMaterial||J.isMeshLambertMaterial&&!J.envMap||J.isMeshPhongMaterial&&!J.envMap,We=ve.get(J.envMap||me,Fe),tt=J.vertexColors===!0&&!!te.attributes.color&&te.attributes.color.itemSize===4,ft=!!te.attributes.tangent&&(!!J.normalMap||J.anisotropy>0),Ye=!!te.morphAttributes.position,Nt=!!te.morphAttributes.normal,Ht=!!te.morphAttributes.color;let Jt=Dn;J.toneMapped&&(Q===null||Q.isXRRenderTarget===!0)&&(Jt=B.toneMapping);const Tt=te.morphAttributes.position||te.morphAttributes.normal||te.morphAttributes.color,us=Tt!==void 0?Tt.length:0,Le=se.get(J),qt=S.state.lights;if(it===!0&&(yt===!0||E!==be)){const Et=E===be&&J.id===ie;Xe.setState(J,E,Et)}let pt=!1;J.version===Le.__version?(Le.needsLights&&Le.lightsStateVersion!==qt.state.version||Le.outputColorSpace!==Re||ee.isBatchedMesh&&Le.batching===!1||!ee.isBatchedMesh&&Le.batching===!0||ee.isBatchedMesh&&Le.batchingColor===!0&&ee.colorTexture===null||ee.isBatchedMesh&&Le.batchingColor===!1&&ee.colorTexture!==null||ee.isInstancedMesh&&Le.instancing===!1||!ee.isInstancedMesh&&Le.instancing===!0||ee.isSkinnedMesh&&Le.skinning===!1||!ee.isSkinnedMesh&&Le.skinning===!0||ee.isInstancedMesh&&Le.instancingColor===!0&&ee.instanceColor===null||ee.isInstancedMesh&&Le.instancingColor===!1&&ee.instanceColor!==null||ee.isInstancedMesh&&Le.instancingMorph===!0&&ee.morphTexture===null||ee.isInstancedMesh&&Le.instancingMorph===!1&&ee.morphTexture!==null||Le.envMap!==We||J.fog===!0&&Le.fog!==Ge||Le.numClippingPlanes!==void 0&&(Le.numClippingPlanes!==Xe.numPlanes||Le.numIntersection!==Xe.numIntersection)||Le.vertexAlphas!==tt||Le.vertexTangents!==ft||Le.morphTargets!==Ye||Le.morphNormals!==Nt||Le.morphColors!==Ht||Le.toneMapping!==Jt||Le.morphTargetsCount!==us||!!Le.lightProbeGrid!=S.state.lightProbeGridArray.length>0)&&(pt=!0):(pt=!0,Le.__version=J.version);let zs=Le.currentProgram;pt===!0&&(zs=zn(J,Y,ee),k&&J.isNodeMaterial&&k.onUpdateProgram(J,zs,Le));let _s=!1,Vs=!1,Rn=!1;const Lt=zs.getUniforms(),Yt=Le.uniforms;if(y.useProgram(zs.program)&&(_s=!0,Vs=!0,Rn=!0),J.id!==ie&&(ie=J.id,Vs=!0),Le.needsLights){const Et=_e(S.state.lightProbeGridArray,ee);Le.lightProbeGrid!==Et&&(Le.lightProbeGrid=Et,Vs=!0)}if(_s||be!==E){y.buffers.depth.getReversed()&&E.reversedDepth!==!0&&(E._reversedDepth=!0,E.updateProjectionMatrix()),Lt.setValue(q,"projectionMatrix",E.projectionMatrix),Lt.setValue(q,"viewMatrix",E.matrixWorldInverse);const cn=Lt.map.cameraPosition;cn!==void 0&&cn.setValue(q,Ut.setFromMatrixPosition(E.matrixWorld)),R.logarithmicDepthBuffer&&Lt.setValue(q,"logDepthBufFC",2/(Math.log(E.far+1)/Math.LN2)),(J.isMeshPhongMaterial||J.isMeshToonMaterial||J.isMeshLambertMaterial||J.isMeshBasicMaterial||J.isMeshStandardMaterial||J.isShaderMaterial)&&Lt.setValue(q,"isOrthographic",E.isOrthographicCamera===!0),be!==E&&(be=E,Vs=!0,Rn=!0)}if(Le.needsLights&&(qt.state.directionalShadowMap.length>0&&Lt.setValue(q,"directionalShadowMap",qt.state.directionalShadowMap,re),qt.state.spotShadowMap.length>0&&Lt.setValue(q,"spotShadowMap",qt.state.spotShadowMap,re),qt.state.pointShadowMap.length>0&&Lt.setValue(q,"pointShadowMap",qt.state.pointShadowMap,re)),ee.isSkinnedMesh){Lt.setOptional(q,ee,"bindMatrix"),Lt.setOptional(q,ee,"bindMatrixInverse");const Et=ee.skeleton;Et&&(Et.boneTexture===null&&Et.computeBoneTexture(),Lt.setValue(q,"boneTexture",Et.boneTexture,re))}ee.isBatchedMesh&&(Lt.setOptional(q,ee,"batchingTexture"),Lt.setValue(q,"batchingTexture",ee._matricesTexture,re),Lt.setOptional(q,ee,"batchingIdTexture"),Lt.setValue(q,"batchingIdTexture",ee._indirectTexture,re),Lt.setOptional(q,ee,"batchingColorTexture"),ee._colorsTexture!==null&&Lt.setValue(q,"batchingColorTexture",ee._colorsTexture,re));const Ws=te.morphAttributes;if((Ws.position!==void 0||Ws.normal!==void 0||Ws.color!==void 0)&&V.update(ee,te,zs),(Vs||Le.receiveShadow!==ee.receiveShadow)&&(Le.receiveShadow=ee.receiveShadow,Lt.setValue(q,"receiveShadow",ee.receiveShadow)),(J.isMeshStandardMaterial||J.isMeshLambertMaterial||J.isMeshPhongMaterial)&&J.envMap===null&&Y.environment!==null&&(Yt.envMapIntensity.value=Y.environmentIntensity),Yt.dfgLUT!==void 0&&(Yt.dfgLUT.value=cx()),Vs){if(Lt.setValue(q,"toneMappingExposure",B.toneMappingExposure),Le.needsLights&&Cl(Yt,Rn),Ge&&J.fog===!0&&He.refreshFogUniforms(Yt,Ge),He.refreshMaterialUniforms(Yt,J,fe,ue,S.state.transmissionRenderTarget[E.id]),Le.needsLights&&Le.lightProbeGrid){const Et=Le.lightProbeGrid;Yt.probesSH.value=Et.texture,Yt.probesMin.value.copy(Et.boundingBox.min),Yt.probesMax.value.copy(Et.boundingBox.max),Yt.probesResolution.value.copy(Et.resolution)}Fo.upload(q,Qs(Le),Yt,re)}if(J.isShaderMaterial&&J.uniformsNeedUpdate===!0&&(Fo.upload(q,Qs(Le),Yt,re),J.uniformsNeedUpdate=!1),J.isSpriteMaterial&&Lt.setValue(q,"center",ee.center),Lt.setValue(q,"modelViewMatrix",ee.modelViewMatrix),Lt.setValue(q,"normalMatrix",ee.normalMatrix),Lt.setValue(q,"modelMatrix",ee.matrixWorld),J.uniformsGroups!==void 0){const Et=J.uniformsGroups;for(let cn=0,Ts=Et.length;cn<Ts;cn++){const ra=Et[cn];pe.update(ra,zs),pe.bind(ra,zs)}}return zs}function Cl(E,Y){E.ambientLightColor.needsUpdate=Y,E.lightProbe.needsUpdate=Y,E.directionalLights.needsUpdate=Y,E.directionalLightShadows.needsUpdate=Y,E.pointLights.needsUpdate=Y,E.pointLightShadows.needsUpdate=Y,E.spotLights.needsUpdate=Y,E.spotLightShadows.needsUpdate=Y,E.rectAreaLights.needsUpdate=Y,E.hemisphereLights.needsUpdate=Y}function $a(E){return E.isMeshLambertMaterial||E.isMeshToonMaterial||E.isMeshPhongMaterial||E.isMeshStandardMaterial||E.isShadowMaterial||E.isShaderMaterial&&E.lights===!0}this.getActiveCubeFace=function(){return W},this.getActiveMipmapLevel=function(){return X},this.getRenderTarget=function(){return Q},this.setRenderTargetTextures=function(E,Y,te){const J=se.get(E);J.__autoAllocateDepthBuffer=E.resolveDepthBuffer===!1,J.__autoAllocateDepthBuffer===!1&&(J.__useRenderToTexture=!1),se.get(E.texture).__webglTexture=Y,se.get(E.depthTexture).__webglTexture=J.__autoAllocateDepthBuffer?void 0:te,J.__hasExternalTextures=!0},this.setRenderTargetFramebuffer=function(E,Y){const te=se.get(E);te.__webglFramebuffer=Y,te.__useDefaultFramebuffer=Y===void 0},this.setRenderTarget=function(E,Y=0,te=0){Q=E,W=Y,X=te;let J=null,ee=!1,Ge=!1;if(E){const Re=se.get(E);if(Re.__useDefaultFramebuffer!==void 0){y.bindFramebuffer(q.FRAMEBUFFER,Re.__webglFramebuffer),ae.copy(E.viewport),xe.copy(E.scissor),Ze=E.scissorTest,y.viewport(ae),y.scissor(xe),y.setScissorTest(Ze),ie=-1;return}else if(Re.__webglFramebuffer===void 0)re.setupRenderTarget(E);else if(Re.__hasExternalTextures)re.rebindTextures(E,se.get(E.texture).__webglTexture,se.get(E.depthTexture).__webglTexture);else if(E.depthBuffer){const tt=E.depthTexture;if(Re.__boundDepthTexture!==tt){if(tt!==null&&se.has(tt)&&(E.width!==tt.image.width||E.height!==tt.image.height))throw new Error("THREE.WebGLRenderer: Attached DepthTexture is initialized to the incorrect size.");re.setupDepthRenderbuffer(E)}}const Fe=E.texture;(Fe.isData3DTexture||Fe.isDataArrayTexture||Fe.isCompressedArrayTexture)&&(Ge=!0);const We=se.get(E).__webglFramebuffer;E.isWebGLCubeRenderTarget?(Array.isArray(We[Y])?J=We[Y][te]:J=We[Y],ee=!0):E.samples>0&&re.useMultisampledRTT(E)===!1?J=se.get(E).__webglMultisampledFramebuffer:Array.isArray(We)?J=We[te]:J=We,ae.copy(E.viewport),xe.copy(E.scissor),Ze=E.scissorTest}else ae.copy(Qe).multiplyScalar(fe).floor(),xe.copy(Zt).multiplyScalar(fe).floor(),Ze=gt;if(te!==0&&(J=L),y.bindFramebuffer(q.FRAMEBUFFER,J)&&y.drawBuffers(E,J),y.viewport(ae),y.scissor(xe),y.setScissorTest(Ze),ee){const Re=se.get(E.texture);q.framebufferTexture2D(q.FRAMEBUFFER,q.COLOR_ATTACHMENT0,q.TEXTURE_CUBE_MAP_POSITIVE_X+Y,Re.__webglTexture,te)}else if(Ge){const Re=Y;for(let Fe=0;Fe<E.textures.length;Fe++){const We=se.get(E.textures[Fe]);q.framebufferTextureLayer(q.FRAMEBUFFER,q.COLOR_ATTACHMENT0+Fe,We.__webglTexture,te,Re)}}else if(E!==null&&te!==0){const Re=se.get(E.texture);q.framebufferTexture2D(q.FRAMEBUFFER,q.COLOR_ATTACHMENT0,q.TEXTURE_2D,Re.__webglTexture,te)}ie=-1},this.readRenderTargetPixels=function(E,Y,te,J,ee,Ge,me,Re=0){if(!(E&&E.isWebGLRenderTarget)){Ot("WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let Fe=se.get(E).__webglFramebuffer;if(E.isWebGLCubeRenderTarget&&me!==void 0&&(Fe=Fe[me]),Fe){y.bindFramebuffer(q.FRAMEBUFFER,Fe);try{const We=E.textures[Re],tt=We.format,ft=We.type;if(E.textures.length>1&&q.readBuffer(q.COLOR_ATTACHMENT0+Re),!R.textureFormatReadable(tt)){Ot("WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}if(!R.textureTypeReadable(ft)){Ot("WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}Y>=0&&Y<=E.width-J&&te>=0&&te<=E.height-ee&&q.readPixels(Y,te,J,ee,Te.convert(tt),Te.convert(ft),Ge)}finally{const We=Q!==null?se.get(Q).__webglFramebuffer:null;y.bindFramebuffer(q.FRAMEBUFFER,We)}}},this.readRenderTargetPixelsAsync=async function(E,Y,te,J,ee,Ge,me,Re=0){if(!(E&&E.isWebGLRenderTarget))throw new Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let Fe=se.get(E).__webglFramebuffer;if(E.isWebGLCubeRenderTarget&&me!==void 0&&(Fe=Fe[me]),Fe)if(Y>=0&&Y<=E.width-J&&te>=0&&te<=E.height-ee){y.bindFramebuffer(q.FRAMEBUFFER,Fe);const We=E.textures[Re],tt=We.format,ft=We.type;if(E.textures.length>1&&q.readBuffer(q.COLOR_ATTACHMENT0+Re),!R.textureFormatReadable(tt))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(!R.textureTypeReadable(ft))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");const Ye=q.createBuffer();q.bindBuffer(q.PIXEL_PACK_BUFFER,Ye),q.bufferData(q.PIXEL_PACK_BUFFER,Ge.byteLength,q.STREAM_READ),q.readPixels(Y,te,J,ee,Te.convert(tt),Te.convert(ft),0);const Nt=Q!==null?se.get(Q).__webglFramebuffer:null;y.bindFramebuffer(q.FRAMEBUFFER,Nt);const Ht=q.fenceSync(q.SYNC_GPU_COMMANDS_COMPLETE,0);return q.flush(),await Oz(q,Ht,4),q.bindBuffer(q.PIXEL_PACK_BUFFER,Ye),q.getBufferSubData(q.PIXEL_PACK_BUFFER,0,Ge),q.deleteBuffer(Ye),q.deleteSync(Ht),Ge}else throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.")},this.copyFramebufferToTexture=function(E,Y=null,te=0){const J=Math.pow(2,-te),ee=Math.floor(E.image.width*J),Ge=Math.floor(E.image.height*J),me=Y!==null?Y.x:0,Re=Y!==null?Y.y:0;re.setTexture2D(E,0),q.copyTexSubImage2D(q.TEXTURE_2D,te,0,0,me,Re,ee,Ge),y.unbindTexture()},this.copyTextureToTexture=function(E,Y,te=null,J=null,ee=0,Ge=0){let me,Re,Fe,We,tt,ft,Ye,Nt,Ht;const Jt=E.isCompressedTexture?E.mipmaps[Ge]:E.image;if(te!==null)me=te.max.x-te.min.x,Re=te.max.y-te.min.y,Fe=te.isBox3?te.max.z-te.min.z:1,We=te.min.x,tt=te.min.y,ft=te.isBox3?te.min.z:0;else{const Yt=Math.pow(2,-ee);me=Math.floor(Jt.width*Yt),Re=Math.floor(Jt.height*Yt),E.isDataArrayTexture?Fe=Jt.depth:E.isData3DTexture?Fe=Math.floor(Jt.depth*Yt):Fe=1,We=0,tt=0,ft=0}J!==null?(Ye=J.x,Nt=J.y,Ht=J.z):(Ye=0,Nt=0,Ht=0);const Tt=Te.convert(Y.format),us=Te.convert(Y.type);let Le;Y.isData3DTexture?(re.setTexture3D(Y,0),Le=q.TEXTURE_3D):Y.isDataArrayTexture||Y.isCompressedArrayTexture?(re.setTexture2DArray(Y,0),Le=q.TEXTURE_2D_ARRAY):(re.setTexture2D(Y,0),Le=q.TEXTURE_2D),y.activeTexture(q.TEXTURE0),y.pixelStorei(q.UNPACK_FLIP_Y_WEBGL,Y.flipY),y.pixelStorei(q.UNPACK_PREMULTIPLY_ALPHA_WEBGL,Y.premultiplyAlpha),y.pixelStorei(q.UNPACK_ALIGNMENT,Y.unpackAlignment);const qt=y.getParameter(q.UNPACK_ROW_LENGTH),pt=y.getParameter(q.UNPACK_IMAGE_HEIGHT),zs=y.getParameter(q.UNPACK_SKIP_PIXELS),_s=y.getParameter(q.UNPACK_SKIP_ROWS),Vs=y.getParameter(q.UNPACK_SKIP_IMAGES);y.pixelStorei(q.UNPACK_ROW_LENGTH,Jt.width),y.pixelStorei(q.UNPACK_IMAGE_HEIGHT,Jt.height),y.pixelStorei(q.UNPACK_SKIP_PIXELS,We),y.pixelStorei(q.UNPACK_SKIP_ROWS,tt),y.pixelStorei(q.UNPACK_SKIP_IMAGES,ft);const Rn=E.isDataArrayTexture||E.isData3DTexture,Lt=Y.isDataArrayTexture||Y.isData3DTexture;if(E.isDepthTexture){const Yt=se.get(E),Ws=se.get(Y),Et=se.get(Yt.__renderTarget),cn=se.get(Ws.__renderTarget);y.bindFramebuffer(q.READ_FRAMEBUFFER,Et.__webglFramebuffer),y.bindFramebuffer(q.DRAW_FRAMEBUFFER,cn.__webglFramebuffer);for(let Ts=0;Ts<Fe;Ts++)Rn&&(q.framebufferTextureLayer(q.READ_FRAMEBUFFER,q.COLOR_ATTACHMENT0,se.get(E).__webglTexture,ee,ft+Ts),q.framebufferTextureLayer(q.DRAW_FRAMEBUFFER,q.COLOR_ATTACHMENT0,se.get(Y).__webglTexture,Ge,Ht+Ts)),q.blitFramebuffer(We,tt,me,Re,Ye,Nt,me,Re,q.DEPTH_BUFFER_BIT,q.NEAREST);y.bindFramebuffer(q.READ_FRAMEBUFFER,null),y.bindFramebuffer(q.DRAW_FRAMEBUFFER,null)}else if(ee!==0||E.isRenderTargetTexture||se.has(E)){const Yt=se.get(E),Ws=se.get(Y);y.bindFramebuffer(q.READ_FRAMEBUFFER,F),y.bindFramebuffer(q.DRAW_FRAMEBUFFER,P);for(let Et=0;Et<Fe;Et++)Rn?q.framebufferTextureLayer(q.READ_FRAMEBUFFER,q.COLOR_ATTACHMENT0,Yt.__webglTexture,ee,ft+Et):q.framebufferTexture2D(q.READ_FRAMEBUFFER,q.COLOR_ATTACHMENT0,q.TEXTURE_2D,Yt.__webglTexture,ee),Lt?q.framebufferTextureLayer(q.DRAW_FRAMEBUFFER,q.COLOR_ATTACHMENT0,Ws.__webglTexture,Ge,Ht+Et):q.framebufferTexture2D(q.DRAW_FRAMEBUFFER,q.COLOR_ATTACHMENT0,q.TEXTURE_2D,Ws.__webglTexture,Ge),ee!==0?q.blitFramebuffer(We,tt,me,Re,Ye,Nt,me,Re,q.COLOR_BUFFER_BIT,q.NEAREST):Lt?q.copyTexSubImage3D(Le,Ge,Ye,Nt,Ht+Et,We,tt,me,Re):q.copyTexSubImage2D(Le,Ge,Ye,Nt,We,tt,me,Re);y.bindFramebuffer(q.READ_FRAMEBUFFER,null),y.bindFramebuffer(q.DRAW_FRAMEBUFFER,null)}else Lt?E.isDataTexture||E.isData3DTexture?q.texSubImage3D(Le,Ge,Ye,Nt,Ht,me,Re,Fe,Tt,us,Jt.data):Y.isCompressedArrayTexture?q.compressedTexSubImage3D(Le,Ge,Ye,Nt,Ht,me,Re,Fe,Tt,Jt.data):q.texSubImage3D(Le,Ge,Ye,Nt,Ht,me,Re,Fe,Tt,us,Jt):E.isDataTexture?q.texSubImage2D(q.TEXTURE_2D,Ge,Ye,Nt,me,Re,Tt,us,Jt.data):E.isCompressedTexture?q.compressedTexSubImage2D(q.TEXTURE_2D,Ge,Ye,Nt,Jt.width,Jt.height,Tt,Jt.data):q.texSubImage2D(q.TEXTURE_2D,Ge,Ye,Nt,me,Re,Tt,us,Jt);y.pixelStorei(q.UNPACK_ROW_LENGTH,qt),y.pixelStorei(q.UNPACK_IMAGE_HEIGHT,pt),y.pixelStorei(q.UNPACK_SKIP_PIXELS,zs),y.pixelStorei(q.UNPACK_SKIP_ROWS,_s),y.pixelStorei(q.UNPACK_SKIP_IMAGES,Vs),Ge===0&&Y.generateMipmaps&&q.generateMipmap(Le),y.unbindTexture()},this.initRenderTarget=function(E){se.get(E).__webglFramebuffer===void 0&&re.setupRenderTarget(E)},this.initTexture=function(E){E.isCubeTexture?re.setTextureCube(E,0):E.isData3DTexture?re.setTexture3D(E,0):E.isDataArrayTexture||E.isCompressedArrayTexture?re.setTexture2DArray(E,0):re.setTexture2D(E,0),y.unbindTexture()},this.resetState=function(){W=0,X=0,Q=null,y.reset(),Ne.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return An}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(e){this._outputColorSpace=e;const t=this.getContext();t.drawingBufferColorSpace=xt._getDrawingBufferColorSpace(e),t.unpackColorSpace=xt._getUnpackColorSpace()}}const tr={charge:!0,link:!0,collide:!0,gravity:!1},jt=.55;function Hi(n,e,t){var s,i=1;n==null&&(n=0),e==null&&(e=0),t==null&&(t=0);function r(){var a,o=s.length,l,c=0,d=0,u=0;for(a=0;a<o;++a)l=s[a],c+=l.x||0,d+=l.y||0,u+=l.z||0;for(c=(c/o-n)*i,d=(d/o-e)*i,u=(u/o-t)*i,a=0;a<o;++a)l=s[a],c&&(l.x-=c),d&&(l.y-=d),u&&(l.z-=u)}return r.initialize=function(a){s=a},r.x=function(a){return arguments.length?(n=+a,r):n},r.y=function(a){return arguments.length?(e=+a,r):e},r.z=function(a){return arguments.length?(t=+a,r):t},r.strength=function(a){return arguments.length?(i=+a,r):i},r}function ux(n){const e=+this._x.call(null,n);return cg(this.cover(e),e,n)}function cg(n,e,t){if(isNaN(e))return n;var s,i=n._root,r={data:t},a=n._x0,o=n._x1,l,c,d,u,h;if(!i)return n._root=r,n;for(;i.length;)if((d=e>=(l=(a+o)/2))?a=l:o=l,s=i,!(i=i[u=+d]))return s[u]=r,n;if(c=+n._x.call(null,i.data),e===c)return r.next=i,s?s[u]=r:n._root=r,n;do s=s?s[u]=new Array(2):n._root=new Array(2),(d=e>=(l=(a+o)/2))?a=l:o=l;while((u=+d)==(h=+(c>=l)));return s[h]=i,s[u]=r,n}function hx(n){Array.isArray(n)||(n=Array.from(n));const e=n.length,t=new Float64Array(e);let s=1/0,i=-1/0;for(let r=0,a;r<e;++r)isNaN(a=+this._x.call(null,n[r]))||(t[r]=a,a<s&&(s=a),a>i&&(i=a));if(s>i)return this;this.cover(s).cover(i);for(let r=0;r<e;++r)cg(this,t[r],n[r]);return this}function fx(n){if(isNaN(n=+n))return this;var e=this._x0,t=this._x1;if(isNaN(e))t=(e=Math.floor(n))+1;else{for(var s=t-e||1,i=this._root,r,a;e>n||n>=t;)switch(a=+(n<e),r=new Array(2),r[a]=i,i=r,s*=2,a){case 0:t=e+s;break;case 1:e=t-s;break}this._root&&this._root.length&&(this._root=i)}return this._x0=e,this._x1=t,this}function px(){var n=[];return this.visit(function(e){if(!e.length)do n.push(e.data);while(e=e.next)}),n}function mx(n){return arguments.length?this.cover(+n[0][0]).cover(+n[1][0]):isNaN(this._x0)?void 0:[[this._x0],[this._x1]]}function Jn(n,e,t){this.node=n,this.x0=e,this.x1=t}function gx(n,e){var t,s=this._x0,i,r,a=this._x1,o=[],l=this._root,c,d;for(l&&o.push(new Jn(l,s,a)),e==null?e=1/0:(s=n-e,a=n+e);c=o.pop();)if(!(!(l=c.node)||(i=c.x0)>a||(r=c.x1)<s))if(l.length){var u=(i+r)/2;o.push(new Jn(l[1],u,r),new Jn(l[0],i,u)),(d=+(n>=u))&&(c=o[o.length-1],o[o.length-1]=o[o.length-1-d],o[o.length-1-d]=c)}else{var h=Math.abs(n-+this._x.call(null,l.data));h<e&&(e=h,s=n-h,a=n+h,t=l.data)}return t}function Mx(n){if(isNaN(l=+this._x.call(null,n)))return this;var e,t=this._root,s,i,r,a=this._x0,o=this._x1,l,c,d,u,h;if(!t)return this;if(t.length)for(;;){if((d=l>=(c=(a+o)/2))?a=c:o=c,e=t,!(t=t[u=+d]))return this;if(!t.length)break;e[u+1&1]&&(s=e,h=u)}for(;t.data!==n;)if(i=t,!(t=t.next))return this;return(r=t.next)&&delete t.next,i?(r?i.next=r:delete i.next,this):e?(r?e[u]=r:delete e[u],(t=e[0]||e[1])&&t===(e[1]||e[0])&&!t.length&&(s?s[h]=t:this._root=t),this):(this._root=r,this)}function bx(n){for(var e=0,t=n.length;e<t;++e)this.remove(n[e]);return this}function zx(){return this._root}function _x(){var n=0;return this.visit(function(e){if(!e.length)do++n;while(e=e.next)}),n}function wx(n){var e=[],t,s=this._root,i,r,a;for(s&&e.push(new Jn(s,this._x0,this._x1));t=e.pop();)if(!n(s=t.node,r=t.x0,a=t.x1)&&s.length){var o=(r+a)/2;(i=s[1])&&e.push(new Jn(i,o,a)),(i=s[0])&&e.push(new Jn(i,r,o))}return this}function yx(n){var e=[],t=[],s;for(this._root&&e.push(new Jn(this._root,this._x0,this._x1));s=e.pop();){var i=s.node;if(i.length){var r,a=s.x0,o=s.x1,l=(a+o)/2;(r=i[0])&&e.push(new Jn(r,a,l)),(r=i[1])&&e.push(new Jn(r,l,o))}t.push(s)}for(;s=t.pop();)n(s.node,s.x0,s.x1);return this}function vx(n){return n[0]}function Ox(n){return arguments.length?(this._x=n,this):this._x}function Bu(n,e){var t=new Nu(e??vx,NaN,NaN);return n==null?t:t.addAll(n)}function Nu(n,e,t){this._x=n,this._x0=e,this._x1=t,this._root=void 0}function yf(n){for(var e={data:n.data},t=e;n=n.next;)t=t.next={data:n.data};return e}var Fs=Bu.prototype=Nu.prototype;Fs.copy=function(){var n=new Nu(this._x,this._x0,this._x1),e=this._root,t,s;if(!e)return n;if(!e.length)return n._root=yf(e),n;for(t=[{source:e,target:n._root=new Array(2)}];e=t.pop();)for(var i=0;i<2;++i)(s=e.source[i])&&(s.length?t.push({source:s,target:e.target[i]=new Array(2)}):e.target[i]=yf(s));return n};Fs.add=ux;Fs.addAll=hx;Fs.cover=fx;Fs.data=px;Fs.extent=mx;Fs.find=gx;Fs.remove=Mx;Fs.removeAll=bx;Fs.root=zx;Fs.size=_x;Fs.visit=wx;Fs.visitAfter=yx;Fs.x=Ox;function xx(n){const e=+this._x.call(null,n),t=+this._y.call(null,n);return dg(this.cover(e,t),e,t,n)}function dg(n,e,t,s){if(isNaN(e)||isNaN(t))return n;var i,r=n._root,a={data:s},o=n._x0,l=n._y0,c=n._x1,d=n._y1,u,h,g,p,z,m,f,_;if(!r)return n._root=a,n;for(;r.length;)if((z=e>=(u=(o+c)/2))?o=u:c=u,(m=t>=(h=(l+d)/2))?l=h:d=h,i=r,!(r=r[f=m<<1|z]))return i[f]=a,n;if(g=+n._x.call(null,r.data),p=+n._y.call(null,r.data),e===g&&t===p)return a.next=r,i?i[f]=a:n._root=a,n;do i=i?i[f]=new Array(4):n._root=new Array(4),(z=e>=(u=(o+c)/2))?o=u:c=u,(m=t>=(h=(l+d)/2))?l=h:d=h;while((f=m<<1|z)===(_=(p>=h)<<1|g>=u));return i[_]=r,i[f]=a,n}function Sx(n){var e,t,s=n.length,i,r,a=new Array(s),o=new Array(s),l=1/0,c=1/0,d=-1/0,u=-1/0;for(t=0;t<s;++t)isNaN(i=+this._x.call(null,e=n[t]))||isNaN(r=+this._y.call(null,e))||(a[t]=i,o[t]=r,i<l&&(l=i),i>d&&(d=i),r<c&&(c=r),r>u&&(u=r));if(l>d||c>u)return this;for(this.cover(l,c).cover(d,u),t=0;t<s;++t)dg(this,a[t],o[t],n[t]);return this}function Ax(n,e){if(isNaN(n=+n)||isNaN(e=+e))return this;var t=this._x0,s=this._y0,i=this._x1,r=this._y1;if(isNaN(t))i=(t=Math.floor(n))+1,r=(s=Math.floor(e))+1;else{for(var a=i-t||1,o=this._root,l,c;t>n||n>=i||s>e||e>=r;)switch(c=(e<s)<<1|n<t,l=new Array(4),l[c]=o,o=l,a*=2,c){case 0:i=t+a,r=s+a;break;case 1:t=i-a,r=s+a;break;case 2:i=t+a,s=r-a;break;case 3:t=i-a,s=r-a;break}this._root&&this._root.length&&(this._root=o)}return this._x0=t,this._y0=s,this._x1=i,this._y1=r,this}function Ex(){var n=[];return this.visit(function(e){if(!e.length)do n.push(e.data);while(e=e.next)}),n}function Dx(n){return arguments.length?this.cover(+n[0][0],+n[0][1]).cover(+n[1][0],+n[1][1]):isNaN(this._x0)?void 0:[[this._x0,this._y0],[this._x1,this._y1]]}function Ns(n,e,t,s,i){this.node=n,this.x0=e,this.y0=t,this.x1=s,this.y1=i}function Ix(n,e,t){var s,i=this._x0,r=this._y0,a,o,l,c,d=this._x1,u=this._y1,h=[],g=this._root,p,z;for(g&&h.push(new Ns(g,i,r,d,u)),t==null?t=1/0:(i=n-t,r=e-t,d=n+t,u=e+t,t*=t);p=h.pop();)if(!(!(g=p.node)||(a=p.x0)>d||(o=p.y0)>u||(l=p.x1)<i||(c=p.y1)<r))if(g.length){var m=(a+l)/2,f=(o+c)/2;h.push(new Ns(g[3],m,f,l,c),new Ns(g[2],a,f,m,c),new Ns(g[1],m,o,l,f),new Ns(g[0],a,o,m,f)),(z=(e>=f)<<1|n>=m)&&(p=h[h.length-1],h[h.length-1]=h[h.length-1-z],h[h.length-1-z]=p)}else{var _=n-+this._x.call(null,g.data),O=e-+this._y.call(null,g.data),w=_*_+O*O;if(w<t){var x=Math.sqrt(t=w);i=n-x,r=e-x,d=n+x,u=e+x,s=g.data}}return s}function Tx(n){if(isNaN(d=+this._x.call(null,n))||isNaN(u=+this._y.call(null,n)))return this;var e,t=this._root,s,i,r,a=this._x0,o=this._y0,l=this._x1,c=this._y1,d,u,h,g,p,z,m,f;if(!t)return this;if(t.length)for(;;){if((p=d>=(h=(a+l)/2))?a=h:l=h,(z=u>=(g=(o+c)/2))?o=g:c=g,e=t,!(t=t[m=z<<1|p]))return this;if(!t.length)break;(e[m+1&3]||e[m+2&3]||e[m+3&3])&&(s=e,f=m)}for(;t.data!==n;)if(i=t,!(t=t.next))return this;return(r=t.next)&&delete t.next,i?(r?i.next=r:delete i.next,this):e?(r?e[m]=r:delete e[m],(t=e[0]||e[1]||e[2]||e[3])&&t===(e[3]||e[2]||e[1]||e[0])&&!t.length&&(s?s[f]=t:this._root=t),this):(this._root=r,this)}function Gx(n){for(var e=0,t=n.length;e<t;++e)this.remove(n[e]);return this}function Rx(){return this._root}function Bx(){var n=0;return this.visit(function(e){if(!e.length)do++n;while(e=e.next)}),n}function Nx(n){var e=[],t,s=this._root,i,r,a,o,l;for(s&&e.push(new Ns(s,this._x0,this._y0,this._x1,this._y1));t=e.pop();)if(!n(s=t.node,r=t.x0,a=t.y0,o=t.x1,l=t.y1)&&s.length){var c=(r+o)/2,d=(a+l)/2;(i=s[3])&&e.push(new Ns(i,c,d,o,l)),(i=s[2])&&e.push(new Ns(i,r,d,c,l)),(i=s[1])&&e.push(new Ns(i,c,a,o,d)),(i=s[0])&&e.push(new Ns(i,r,a,c,d))}return this}function Cx(n){var e=[],t=[],s;for(this._root&&e.push(new Ns(this._root,this._x0,this._y0,this._x1,this._y1));s=e.pop();){var i=s.node;if(i.length){var r,a=s.x0,o=s.y0,l=s.x1,c=s.y1,d=(a+l)/2,u=(o+c)/2;(r=i[0])&&e.push(new Ns(r,a,o,d,u)),(r=i[1])&&e.push(new Ns(r,d,o,l,u)),(r=i[2])&&e.push(new Ns(r,a,u,d,c)),(r=i[3])&&e.push(new Ns(r,d,u,l,c))}t.push(s)}for(;s=t.pop();)n(s.node,s.x0,s.y0,s.x1,s.y1);return this}function Px(n){return n[0]}function Lx(n){return arguments.length?(this._x=n,this):this._x}function Wx(n){return n[1]}function kx(n){return arguments.length?(this._y=n,this):this._y}function Cu(n,e,t){var s=new Pu(e??Px,t??Wx,NaN,NaN,NaN,NaN);return n==null?s:s.addAll(n)}function Pu(n,e,t,s,i,r){this._x=n,this._y=e,this._x0=t,this._y0=s,this._x1=i,this._y1=r,this._root=void 0}function vf(n){for(var e={data:n.data},t=e;n=n.next;)t=t.next={data:n.data};return e}var Ps=Cu.prototype=Pu.prototype;Ps.copy=function(){var n=new Pu(this._x,this._y,this._x0,this._y0,this._x1,this._y1),e=this._root,t,s;if(!e)return n;if(!e.length)return n._root=vf(e),n;for(t=[{source:e,target:n._root=new Array(4)}];e=t.pop();)for(var i=0;i<4;++i)(s=e.source[i])&&(s.length?t.push({source:s,target:e.target[i]=new Array(4)}):e.target[i]=vf(s));return n};Ps.add=xx;Ps.addAll=Sx;Ps.cover=Ax;Ps.data=Ex;Ps.extent=Dx;Ps.find=Ix;Ps.remove=Tx;Ps.removeAll=Gx;Ps.root=Rx;Ps.size=Bx;Ps.visit=Nx;Ps.visitAfter=Cx;Ps.x=Lx;Ps.y=kx;function Ux(n){const e=+this._x.call(null,n),t=+this._y.call(null,n),s=+this._z.call(null,n);return ug(this.cover(e,t,s),e,t,s,n)}function ug(n,e,t,s,i){if(isNaN(e)||isNaN(t)||isNaN(s))return n;var r,a=n._root,o={data:i},l=n._x0,c=n._y0,d=n._z0,u=n._x1,h=n._y1,g=n._z1,p,z,m,f,_,O,w,x,S,I,b;if(!a)return n._root=o,n;for(;a.length;)if((w=e>=(p=(l+u)/2))?l=p:u=p,(x=t>=(z=(c+h)/2))?c=z:h=z,(S=s>=(m=(d+g)/2))?d=m:g=m,r=a,!(a=a[I=S<<2|x<<1|w]))return r[I]=o,n;if(f=+n._x.call(null,a.data),_=+n._y.call(null,a.data),O=+n._z.call(null,a.data),e===f&&t===_&&s===O)return o.next=a,r?r[I]=o:n._root=o,n;do r=r?r[I]=new Array(8):n._root=new Array(8),(w=e>=(p=(l+u)/2))?l=p:u=p,(x=t>=(z=(c+h)/2))?c=z:h=z,(S=s>=(m=(d+g)/2))?d=m:g=m;while((I=S<<2|x<<1|w)===(b=(O>=m)<<2|(_>=z)<<1|f>=p));return r[b]=a,r[I]=o,n}function Fx(n){Array.isArray(n)||(n=Array.from(n));const e=n.length,t=new Float64Array(e),s=new Float64Array(e),i=new Float64Array(e);let r=1/0,a=1/0,o=1/0,l=-1/0,c=-1/0,d=-1/0;for(let u=0,h,g,p,z;u<e;++u)isNaN(g=+this._x.call(null,h=n[u]))||isNaN(p=+this._y.call(null,h))||isNaN(z=+this._z.call(null,h))||(t[u]=g,s[u]=p,i[u]=z,g<r&&(r=g),g>l&&(l=g),p<a&&(a=p),p>c&&(c=p),z<o&&(o=z),z>d&&(d=z));if(r>l||a>c||o>d)return this;this.cover(r,a,o).cover(l,c,d);for(let u=0;u<e;++u)ug(this,t[u],s[u],i[u],n[u]);return this}function jx(n,e,t){if(isNaN(n=+n)||isNaN(e=+e)||isNaN(t=+t))return this;var s=this._x0,i=this._y0,r=this._z0,a=this._x1,o=this._y1,l=this._z1;if(isNaN(s))a=(s=Math.floor(n))+1,o=(i=Math.floor(e))+1,l=(r=Math.floor(t))+1;else{for(var c=a-s||1,d=this._root,u,h;s>n||n>=a||i>e||e>=o||r>t||t>=l;)switch(h=(t<r)<<2|(e<i)<<1|n<s,u=new Array(8),u[h]=d,d=u,c*=2,h){case 0:a=s+c,o=i+c,l=r+c;break;case 1:s=a-c,o=i+c,l=r+c;break;case 2:a=s+c,i=o-c,l=r+c;break;case 3:s=a-c,i=o-c,l=r+c;break;case 4:a=s+c,o=i+c,r=l-c;break;case 5:s=a-c,o=i+c,r=l-c;break;case 6:a=s+c,i=o-c,r=l-c;break;case 7:s=a-c,i=o-c,r=l-c;break}this._root&&this._root.length&&(this._root=d)}return this._x0=s,this._y0=i,this._z0=r,this._x1=a,this._y1=o,this._z1=l,this}function $x(){var n=[];return this.visit(function(e){if(!e.length)do n.push(e.data);while(e=e.next)}),n}function Vx(n){return arguments.length?this.cover(+n[0][0],+n[0][1],+n[0][2]).cover(+n[1][0],+n[1][1],+n[1][2]):isNaN(this._x0)?void 0:[[this._x0,this._y0,this._z0],[this._x1,this._y1,this._z1]]}function $t(n,e,t,s,i,r,a){this.node=n,this.x0=e,this.y0=t,this.z0=s,this.x1=i,this.y1=r,this.z1=a}function Hx(n,e,t,s){var i,r=this._x0,a=this._y0,o=this._z0,l,c,d,u,h,g,p=this._x1,z=this._y1,m=this._z1,f=[],_=this._root,O,w;for(_&&f.push(new $t(_,r,a,o,p,z,m)),s==null?s=1/0:(r=n-s,a=e-s,o=t-s,p=n+s,z=e+s,m=t+s,s*=s);O=f.pop();)if(!(!(_=O.node)||(l=O.x0)>p||(c=O.y0)>z||(d=O.z0)>m||(u=O.x1)<r||(h=O.y1)<a||(g=O.z1)<o))if(_.length){var x=(l+u)/2,S=(c+h)/2,I=(d+g)/2;f.push(new $t(_[7],x,S,I,u,h,g),new $t(_[6],l,S,I,x,h,g),new $t(_[5],x,c,I,u,S,g),new $t(_[4],l,c,I,x,S,g),new $t(_[3],x,S,d,u,h,I),new $t(_[2],l,S,d,x,h,I),new $t(_[1],x,c,d,u,S,I),new $t(_[0],l,c,d,x,S,I)),(w=(t>=I)<<2|(e>=S)<<1|n>=x)&&(O=f[f.length-1],f[f.length-1]=f[f.length-1-w],f[f.length-1-w]=O)}else{var b=n-+this._x.call(null,_.data),A=e-+this._y.call(null,_.data),B=t-+this._z.call(null,_.data),N=b*b+A*A+B*B;if(N<s){var k=Math.sqrt(s=N);r=n-k,a=e-k,o=t-k,p=n+k,z=e+k,m=t+k,i=_.data}}return i}const qx=(n,e,t,s,i,r)=>Math.sqrt((n-s)**2+(e-i)**2+(t-r)**2);function Xx(n,e,t,s){const i=[],r=n-s,a=e-s,o=t-s,l=n+s,c=e+s,d=t+s;return this.visit((u,h,g,p,z,m,f)=>{if(!u.length)do{const _=u.data;qx(n,e,t,this._x(_),this._y(_),this._z(_))<=s&&i.push(_)}while(u=u.next);return h>l||g>c||p>d||z<r||m<a||f<o}),i}function Yx(n){if(isNaN(h=+this._x.call(null,n))||isNaN(g=+this._y.call(null,n))||isNaN(p=+this._z.call(null,n)))return this;var e,t=this._root,s,i,r,a=this._x0,o=this._y0,l=this._z0,c=this._x1,d=this._y1,u=this._z1,h,g,p,z,m,f,_,O,w,x,S;if(!t)return this;if(t.length)for(;;){if((_=h>=(z=(a+c)/2))?a=z:c=z,(O=g>=(m=(o+d)/2))?o=m:d=m,(w=p>=(f=(l+u)/2))?l=f:u=f,e=t,!(t=t[x=w<<2|O<<1|_]))return this;if(!t.length)break;(e[x+1&7]||e[x+2&7]||e[x+3&7]||e[x+4&7]||e[x+5&7]||e[x+6&7]||e[x+7&7])&&(s=e,S=x)}for(;t.data!==n;)if(i=t,!(t=t.next))return this;return(r=t.next)&&delete t.next,i?(r?i.next=r:delete i.next,this):e?(r?e[x]=r:delete e[x],(t=e[0]||e[1]||e[2]||e[3]||e[4]||e[5]||e[6]||e[7])&&t===(e[7]||e[6]||e[5]||e[4]||e[3]||e[2]||e[1]||e[0])&&!t.length&&(s?s[S]=t:this._root=t),this):(this._root=r,this)}function Kx(n){for(var e=0,t=n.length;e<t;++e)this.remove(n[e]);return this}function Zx(){return this._root}function Qx(){var n=0;return this.visit(function(e){if(!e.length)do++n;while(e=e.next)}),n}function Jx(n){var e=[],t,s=this._root,i,r,a,o,l,c,d;for(s&&e.push(new $t(s,this._x0,this._y0,this._z0,this._x1,this._y1,this._z1));t=e.pop();)if(!n(s=t.node,r=t.x0,a=t.y0,o=t.z0,l=t.x1,c=t.y1,d=t.z1)&&s.length){var u=(r+l)/2,h=(a+c)/2,g=(o+d)/2;(i=s[7])&&e.push(new $t(i,u,h,g,l,c,d)),(i=s[6])&&e.push(new $t(i,r,h,g,u,c,d)),(i=s[5])&&e.push(new $t(i,u,a,g,l,h,d)),(i=s[4])&&e.push(new $t(i,r,a,g,u,h,d)),(i=s[3])&&e.push(new $t(i,u,h,o,l,c,g)),(i=s[2])&&e.push(new $t(i,r,h,o,u,c,g)),(i=s[1])&&e.push(new $t(i,u,a,o,l,h,g)),(i=s[0])&&e.push(new $t(i,r,a,o,u,h,g))}return this}function eS(n){var e=[],t=[],s;for(this._root&&e.push(new $t(this._root,this._x0,this._y0,this._z0,this._x1,this._y1,this._z1));s=e.pop();){var i=s.node;if(i.length){var r,a=s.x0,o=s.y0,l=s.z0,c=s.x1,d=s.y1,u=s.z1,h=(a+c)/2,g=(o+d)/2,p=(l+u)/2;(r=i[0])&&e.push(new $t(r,a,o,l,h,g,p)),(r=i[1])&&e.push(new $t(r,h,o,l,c,g,p)),(r=i[2])&&e.push(new $t(r,a,g,l,h,d,p)),(r=i[3])&&e.push(new $t(r,h,g,l,c,d,p)),(r=i[4])&&e.push(new $t(r,a,o,p,h,g,u)),(r=i[5])&&e.push(new $t(r,h,o,p,c,g,u)),(r=i[6])&&e.push(new $t(r,a,g,p,h,d,u)),(r=i[7])&&e.push(new $t(r,h,g,p,c,d,u))}t.push(s)}for(;s=t.pop();)n(s.node,s.x0,s.y0,s.z0,s.x1,s.y1,s.z1);return this}function tS(n){return n[0]}function sS(n){return arguments.length?(this._x=n,this):this._x}function nS(n){return n[1]}function iS(n){return arguments.length?(this._y=n,this):this._y}function rS(n){return n[2]}function aS(n){return arguments.length?(this._z=n,this):this._z}function Lu(n,e,t,s){var i=new Wu(e??tS,t??nS,s??rS,NaN,NaN,NaN,NaN,NaN,NaN);return n==null?i:i.addAll(n)}function Wu(n,e,t,s,i,r,a,o,l){this._x=n,this._y=e,this._z=t,this._x0=s,this._y0=i,this._z0=r,this._x1=a,this._y1=o,this._z1=l,this._root=void 0}function Of(n){for(var e={data:n.data},t=e;n=n.next;)t=t.next={data:n.data};return e}var vs=Lu.prototype=Wu.prototype;vs.copy=function(){var n=new Wu(this._x,this._y,this._z,this._x0,this._y0,this._z0,this._x1,this._y1,this._z1),e=this._root,t,s;if(!e)return n;if(!e.length)return n._root=Of(e),n;for(t=[{source:e,target:n._root=new Array(8)}];e=t.pop();)for(var i=0;i<8;++i)(s=e.source[i])&&(s.length?t.push({source:s,target:e.target[i]=new Array(8)}):e.target[i]=Of(s));return n};vs.add=Ux;vs.addAll=Fx;vs.cover=jx;vs.data=$x;vs.extent=Vx;vs.find=Hx;vs.findAllWithinRadius=Xx;vs.remove=Yx;vs.removeAll=Kx;vs.root=Zx;vs.size=Qx;vs.visit=Jx;vs.visitAfter=eS;vs.x=sS;vs.y=iS;vs.z=aS;function fs(n){return function(){return n}}function rn(n){return(n()-.5)*1e-6}function xc(n){return n.x+n.vx}function xf(n){return n.y+n.vy}function oS(n){return n.z+n.vz}function Oi(n){var e,t,s,i,r=1,a=1;typeof n!="function"&&(n=fs(n==null?1:+n));function o(){for(var d,u=e.length,h,g,p,z,m,f,_,O=0;O<a;++O)for(h=(t===1?Bu(e,xc):t===2?Cu(e,xc,xf):t===3?Lu(e,xc,xf,oS):null).visitAfter(l),d=0;d<u;++d)g=e[d],f=s[g.index],_=f*f,p=g.x+g.vx,t>1&&(z=g.y+g.vy),t>2&&(m=g.z+g.vz),h.visit(w);function w(x,S,I,b,A,B,N){var k=[S,I,b,A,B,N],L=k[0],F=k[1],P=k[2],W=k[t],X=k[t+1],Q=k[t+2],ie=x.data,be=x.r,ae=f+be;if(ie){if(ie.index>g.index){var xe=p-ie.x-ie.vx,Ze=t>1?z-ie.y-ie.vy:0,nt=t>2?m-ie.z-ie.vz:0,Ve=xe*xe+Ze*Ze+nt*nt;Ve<ae*ae&&(xe===0&&(xe=rn(i),Ve+=xe*xe),t>1&&Ze===0&&(Ze=rn(i),Ve+=Ze*Ze),t>2&&nt===0&&(nt=rn(i),Ve+=nt*nt),Ve=(ae-(Ve=Math.sqrt(Ve)))/Ve*r,g.vx+=(xe*=Ve)*(ae=(be*=be)/(_+be)),t>1&&(g.vy+=(Ze*=Ve)*ae),t>2&&(g.vz+=(nt*=Ve)*ae),ie.vx-=xe*(ae=1-ae),t>1&&(ie.vy-=Ze*ae),t>2&&(ie.vz-=nt*ae))}return}return L>p+ae||W<p-ae||t>1&&(F>z+ae||X<z-ae)||t>2&&(P>m+ae||Q<m-ae)}}function l(d){if(d.data)return d.r=s[d.data.index];for(var u=d.r=0;u<Math.pow(2,t);++u)d[u]&&d[u].r>d.r&&(d.r=d[u].r)}function c(){if(e){var d,u=e.length,h;for(s=new Array(u),d=0;d<u;++d)h=e[d],s[h.index]=+n(h,d,e)}}return o.initialize=function(d,...u){e=d,i=u.find(h=>typeof h=="function")||Math.random,t=u.find(h=>[1,2,3].includes(h))||2,c()},o.iterations=function(d){return arguments.length?(a=+d,o):a},o.strength=function(d){return arguments.length?(r=+d,o):r},o.radius=function(d){return arguments.length?(n=typeof d=="function"?d:fs(+d),c(),o):n},o}function lS(n){return n.index}function Sf(n,e){var t=n.get(e);if(!t)throw new Error("node not found: "+e);return t}function sr(n){var e=lS,t=h,s,i=fs(30),r,a,o,l,c,d,u=1;n==null&&(n=[]);function h(f){return 1/Math.min(l[f.source.index],l[f.target.index])}function g(f){for(var _=0,O=n.length;_<u;++_)for(var w=0,x,S,I,b=0,A=0,B=0,N,k;w<O;++w)x=n[w],S=x.source,I=x.target,b=I.x+I.vx-S.x-S.vx||rn(d),o>1&&(A=I.y+I.vy-S.y-S.vy||rn(d)),o>2&&(B=I.z+I.vz-S.z-S.vz||rn(d)),N=Math.sqrt(b*b+A*A+B*B),N=(N-r[w])/N*f*s[w],b*=N,A*=N,B*=N,I.vx-=b*(k=c[w]),o>1&&(I.vy-=A*k),o>2&&(I.vz-=B*k),S.vx+=b*(k=1-k),o>1&&(S.vy+=A*k),o>2&&(S.vz+=B*k)}function p(){if(a){var f,_=a.length,O=n.length,w=new Map(a.map((S,I)=>[e(S,I,a),S])),x;for(f=0,l=new Array(_);f<O;++f)x=n[f],x.index=f,typeof x.source!="object"&&(x.source=Sf(w,x.source)),typeof x.target!="object"&&(x.target=Sf(w,x.target)),l[x.source.index]=(l[x.source.index]||0)+1,l[x.target.index]=(l[x.target.index]||0)+1;for(f=0,c=new Array(O);f<O;++f)x=n[f],c[f]=l[x.source.index]/(l[x.source.index]+l[x.target.index]);s=new Array(O),z(),r=new Array(O),m()}}function z(){if(a)for(var f=0,_=n.length;f<_;++f)s[f]=+t(n[f],f,n)}function m(){if(a)for(var f=0,_=n.length;f<_;++f)r[f]=+i(n[f],f,n)}return g.initialize=function(f,..._){a=f,d=_.find(O=>typeof O=="function")||Math.random,o=_.find(O=>[1,2,3].includes(O))||2,p()},g.links=function(f){return arguments.length?(n=f,p(),g):n},g.id=function(f){return arguments.length?(e=f,g):e},g.iterations=function(f){return arguments.length?(u=+f,g):u},g.strength=function(f){return arguments.length?(t=typeof f=="function"?f:fs(+f),z(),g):t},g.distance=function(f){return arguments.length?(i=typeof f=="function"?f:fs(+f),m(),g):i},g}var cS={value:()=>{}};function hg(){for(var n=0,e=arguments.length,t={},s;n<e;++n){if(!(s=arguments[n]+"")||s in t||/[\s.]/.test(s))throw new Error("illegal type: "+s);t[s]=[]}return new jo(t)}function jo(n){this._=n}function dS(n,e){return n.trim().split(/^|\s+/).map(function(t){var s="",i=t.indexOf(".");if(i>=0&&(s=t.slice(i+1),t=t.slice(0,i)),t&&!e.hasOwnProperty(t))throw new Error("unknown type: "+t);return{type:t,name:s}})}jo.prototype=hg.prototype={constructor:jo,on:function(n,e){var t=this._,s=dS(n+"",t),i,r=-1,a=s.length;if(arguments.length<2){for(;++r<a;)if((i=(n=s[r]).type)&&(i=uS(t[i],n.name)))return i;return}if(e!=null&&typeof e!="function")throw new Error("invalid callback: "+e);for(;++r<a;)if(i=(n=s[r]).type)t[i]=Af(t[i],n.name,e);else if(e==null)for(i in t)t[i]=Af(t[i],n.name,null);return this},copy:function(){var n={},e=this._;for(var t in e)n[t]=e[t].slice();return new jo(n)},call:function(n,e){if((i=arguments.length-2)>0)for(var t=new Array(i),s=0,i,r;s<i;++s)t[s]=arguments[s+2];if(!this._.hasOwnProperty(n))throw new Error("unknown type: "+n);for(r=this._[n],s=0,i=r.length;s<i;++s)r[s].value.apply(e,t)},apply:function(n,e,t){if(!this._.hasOwnProperty(n))throw new Error("unknown type: "+n);for(var s=this._[n],i=0,r=s.length;i<r;++i)s[i].value.apply(e,t)}};function uS(n,e){for(var t=0,s=n.length,i;t<s;++t)if((i=n[t]).name===e)return i.value}function Af(n,e,t){for(var s=0,i=n.length;s<i;++s)if(n[s].name===e){n[s]=cS,n=n.slice(0,s).concat(n.slice(s+1));break}return t!=null&&n.push({name:e,value:t}),n}var Yr=0,Ta=0,wa=0,fg=1e3,Ml,Ga,bl=0,nr=0,Tl=0,Ua=typeof performance=="object"&&performance.now?performance:Date,pg=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(n){setTimeout(n,17)};function mg(){return nr||(pg(hS),nr=Ua.now()+Tl)}function hS(){nr=0}function su(){this._call=this._time=this._next=null}su.prototype=gg.prototype={constructor:su,restart:function(n,e,t){if(typeof n!="function")throw new TypeError("callback is not a function");t=(t==null?mg():+t)+(e==null?0:+e),!this._next&&Ga!==this&&(Ga?Ga._next=this:Ml=this,Ga=this),this._call=n,this._time=t,nu()},stop:function(){this._call&&(this._call=null,this._time=1/0,nu())}};function gg(n,e,t){var s=new su;return s.restart(n,e,t),s}function fS(){mg(),++Yr;for(var n=Ml,e;n;)(e=nr-n._time)>=0&&n._call.call(void 0,e),n=n._next;--Yr}function Ef(){nr=(bl=Ua.now())+Tl,Yr=Ta=0;try{fS()}finally{Yr=0,mS(),nr=0}}function pS(){var n=Ua.now(),e=n-bl;e>fg&&(Tl-=e,bl=n)}function mS(){for(var n,e=Ml,t,s=1/0;e;)e._call?(s>e._time&&(s=e._time),n=e,e=e._next):(t=e._next,e._next=null,e=n?n._next=t:Ml=t);Ga=n,nu(s)}function nu(n){if(!Yr){Ta&&(Ta=clearTimeout(Ta));var e=n-nr;e>24?(n<1/0&&(Ta=setTimeout(Ef,n-Ua.now()-Tl)),wa&&(wa=clearInterval(wa))):(wa||(bl=Ua.now(),wa=setInterval(pS,fg)),Yr=1,pg(Ef))}}const gS=1664525,MS=1013904223,Df=4294967296;function bS(){let n=1;return()=>(n=(gS*n+MS)%Df)/Df}var If=3;function Sc(n){return n.x}function Tf(n){return n.y}function zS(n){return n.z}var _S=10,wS=Math.PI*(3-Math.sqrt(5)),yS=Math.PI*20/(9+Math.sqrt(221));function xi(n,e){e=e||2;var t=Math.min(If,Math.max(1,Math.round(e))),s,i=1,r=.001,a=1-Math.pow(r,1/300),o=0,l=.6,c=new Map,d=gg(g),u=hg("tick","end"),h=bS();n==null&&(n=[]);function g(){p(),u.call("tick",s),i<r&&(d.stop(),u.call("end",s))}function p(f){var _,O=n.length,w;f===void 0&&(f=1);for(var x=0;x<f;++x)for(i+=(o-i)*a,c.forEach(function(S){S(i)}),_=0;_<O;++_)w=n[_],w.fx==null?w.x+=w.vx*=l:(w.x=w.fx,w.vx=0),t>1&&(w.fy==null?w.y+=w.vy*=l:(w.y=w.fy,w.vy=0)),t>2&&(w.fz==null?w.z+=w.vz*=l:(w.z=w.fz,w.vz=0));return s}function z(){for(var f=0,_=n.length,O;f<_;++f){if(O=n[f],O.index=f,O.fx!=null&&(O.x=O.fx),O.fy!=null&&(O.y=O.fy),O.fz!=null&&(O.z=O.fz),isNaN(O.x)||t>1&&isNaN(O.y)||t>2&&isNaN(O.z)){var w=_S*(t>2?Math.cbrt(.5+f):t>1?Math.sqrt(.5+f):f),x=f*wS,S=f*yS;t===1?O.x=w:t===2?(O.x=w*Math.cos(x),O.y=w*Math.sin(x)):(O.x=w*Math.sin(x)*Math.cos(S),O.y=w*Math.cos(x),O.z=w*Math.sin(x)*Math.sin(S))}(isNaN(O.vx)||t>1&&isNaN(O.vy)||t>2&&isNaN(O.vz))&&(O.vx=0,t>1&&(O.vy=0),t>2&&(O.vz=0))}}function m(f){return f.initialize&&f.initialize(n,h,t),f}return z(),s={tick:p,restart:function(){return d.restart(g),s},stop:function(){return d.stop(),s},numDimensions:function(f){return arguments.length?(t=Math.min(If,Math.max(1,Math.round(f))),c.forEach(m),s):t},nodes:function(f){return arguments.length?(n=f,z(),c.forEach(m),s):n},alpha:function(f){return arguments.length?(i=+f,s):i},alphaMin:function(f){return arguments.length?(r=+f,s):r},alphaDecay:function(f){return arguments.length?(a=+f,s):+a},alphaTarget:function(f){return arguments.length?(o=+f,s):o},velocityDecay:function(f){return arguments.length?(l=1-f,s):1-l},randomSource:function(f){return arguments.length?(h=f,c.forEach(m),s):h},force:function(f,_){return arguments.length>1?(_==null?c.delete(f):c.set(f,m(_)),s):c.get(f)},find:function(){var f=Array.prototype.slice.call(arguments),_=f.shift()||0,O=(t>1?f.shift():null)||0,w=(t>2?f.shift():null)||0,x=f.shift()||1/0,S=0,I=n.length,b,A,B,N,k,L;for(x*=x,S=0;S<I;++S)k=n[S],b=_-k.x,A=O-(k.y||0),B=w-(k.z||0),N=b*b+A*A+B*B,N<x&&(L=k,x=N);return L},on:function(f,_){return arguments.length>1?(u.on(f,_),s):u.on(f)}}}function Si(){var n,e,t,s,i,r=fs(-30),a,o=1,l=1/0,c=.81;function d(p){var z,m=n.length,f=(e===1?Bu(n,Sc):e===2?Cu(n,Sc,Tf):e===3?Lu(n,Sc,Tf,zS):null).visitAfter(h);for(i=p,z=0;z<m;++z)t=n[z],f.visit(g)}function u(){if(n){var p,z=n.length,m;for(a=new Array(z),p=0;p<z;++p)m=n[p],a[m.index]=+r(m,p,n)}}function h(p){var z=0,m,f,_=0,O,w,x,S,I=p.length;if(I){for(O=w=x=S=0;S<I;++S)(m=p[S])&&(f=Math.abs(m.value))&&(z+=m.value,_+=f,O+=f*(m.x||0),w+=f*(m.y||0),x+=f*(m.z||0));z*=Math.sqrt(4/I),p.x=O/_,e>1&&(p.y=w/_),e>2&&(p.z=x/_)}else{m=p,m.x=m.data.x,e>1&&(m.y=m.data.y),e>2&&(m.z=m.data.z);do z+=a[m.data.index];while(m=m.next)}p.value=z}function g(p,z,m,f,_){if(!p.value)return!0;var O=[m,f,_][e-1],w=p.x-t.x,x=e>1?p.y-t.y:0,S=e>2?p.z-t.z:0,I=O-z,b=w*w+x*x+S*S;if(I*I/c<b)return b<l&&(w===0&&(w=rn(s),b+=w*w),e>1&&x===0&&(x=rn(s),b+=x*x),e>2&&S===0&&(S=rn(s),b+=S*S),b<o&&(b=Math.sqrt(o*b)),t.vx+=w*p.value*i/b,e>1&&(t.vy+=x*p.value*i/b),e>2&&(t.vz+=S*p.value*i/b)),!0;if(p.length||b>=l)return;(p.data!==t||p.next)&&(w===0&&(w=rn(s),b+=w*w),e>1&&x===0&&(x=rn(s),b+=x*x),e>2&&S===0&&(S=rn(s),b+=S*S),b<o&&(b=Math.sqrt(o*b)));do p.data!==t&&(I=a[p.data.index]*i/b,t.vx+=w*I,e>1&&(t.vy+=x*I),e>2&&(t.vz+=S*I));while(p=p.next)}return d.initialize=function(p,...z){n=p,s=z.find(m=>typeof m=="function")||Math.random,e=z.find(m=>[1,2,3].includes(m))||2,u()},d.strength=function(p){return arguments.length?(r=typeof p=="function"?p:fs(+p),u(),d):r},d.distanceMin=function(p){return arguments.length?(o=p*p,d):Math.sqrt(o)},d.distanceMax=function(p){return arguments.length?(l=p*p,d):Math.sqrt(l)},d.theta=function(p){return arguments.length?(c=p*p,d):Math.sqrt(c)},d}function ku(n){var e=fs(.1),t,s,i;typeof n!="function"&&(n=fs(n==null?0:+n));function r(o){for(var l=0,c=t.length,d;l<c;++l)d=t[l],d.vx+=(i[l]-d.x)*s[l]*o}function a(){if(t){var o,l=t.length;for(s=new Array(l),i=new Array(l),o=0;o<l;++o)s[o]=isNaN(i[o]=+n(t[o],o,t))?0:+e(t[o],o,t)}}return r.initialize=function(o){t=o,a()},r.strength=function(o){return arguments.length?(e=typeof o=="function"?o:fs(+o),a(),r):e},r.x=function(o){return arguments.length?(n=typeof o=="function"?o:fs(+o),a(),r):n},r}function Uu(n){var e=fs(.1),t,s,i;typeof n!="function"&&(n=fs(n==null?0:+n));function r(o){for(var l=0,c=t.length,d;l<c;++l)d=t[l],d.vy+=(i[l]-d.y)*s[l]*o}function a(){if(t){var o,l=t.length;for(s=new Array(l),i=new Array(l),o=0;o<l;++o)s[o]=isNaN(i[o]=+n(t[o],o,t))?0:+e(t[o],o,t)}}return r.initialize=function(o){t=o,a()},r.strength=function(o){return arguments.length?(e=typeof o=="function"?o:fs(+o),a(),r):e},r.y=function(o){return arguments.length?(n=typeof o=="function"?o:fs(+o),a(),r):n},r}function Fu(n){var e=fs(.1),t,s,i;typeof n!="function"&&(n=fs(n==null?0:+n));function r(o){for(var l=0,c=t.length,d;l<c;++l)d=t[l],d.vz+=(i[l]-d.z)*s[l]*o}function a(){if(t){var o,l=t.length;for(s=new Array(l),i=new Array(l),o=0;o<l;++o)s[o]=isNaN(i[o]=+n(t[o],o,t))?0:+e(t[o],o,t)}}return r.initialize=function(o){t=o,a()},r.strength=function(o){return arguments.length?(e=typeof o=="function"?o:fs(+o),a(),r):e},r.z=function(o){return arguments.length?(n=typeof o=="function"?o:fs(+o),a(),r):n},r}function vS(n){let e=2166136261;for(let t=0;t<n.length;t++)e^=n.charCodeAt(t),e=Math.imul(e,16777619);return e>>>0}function OS(n){let e=n>>>0;return()=>(e=Math.imul(e,1664525)+1013904223>>>0,e/4294967296)}function Kr(n){return OS(vS(n))}const pn=.55,xS=12,SS=60,Ac=60;function AS(n){const e=new Map(n.map((t,s)=>[t.id,s]));return n.map(t=>`${t.parents.map(i=>e.get(i)??-1).join(".")}:${t.radius.toFixed(2)}`).join("|")}function ES(n,e,t){const[s,i,r]=n,a=s*Math.cos(e)+r*Math.sin(e),o=-s*Math.sin(e)+r*Math.cos(e),l=i*Math.cos(t)-o*Math.sin(t),c=i*Math.sin(t)+o*Math.cos(t);return[a,l,c]}function DS(n,e,t){const s=p=>Math.hypot(p[0],p[1],p[2]),i=s(e),r=s(t);if(i<1e-9||r<1e-9)return n;const a=[e[0]/i,e[1]/i,e[2]/i],o=[t[0]/r,t[1]/r,t[2]/r],l=[a[1]*o[2]-a[2]*o[1],a[2]*o[0]-a[0]*o[2],a[0]*o[1]-a[1]*o[0]],c=s(l),d=a[0]*o[0]+a[1]*o[1]+a[2]*o[2];if(c<1e-9)return d>0?n:[-n[0],-n[1],-n[2]];const u=[l[0]/c,l[1]/c,l[2]/c],h=u[0]*n[0]+u[1]*n[1]+u[2]*n[2],g=[u[1]*n[2]-u[2]*n[1],u[2]*n[0]-u[0]*n[2],u[0]*n[1]-u[1]*n[0]];return[n[0]*d+g[0]*c+u[0]*h*(1-d),n[1]*d+g[1]*c+u[1]*h*(1-d),n[2]*d+g[2]*c+u[2]*h*(1-d)]}function Gf(n,e,t){if(e.length===0)return n;let s=0;for(const i of e)s+=t.get(i.id.slice(6))??pn;return s/=e.length,Math.max(n+2,Math.sqrt(e.length)*s*1.6)}function Ec(n,e,t){const s=e<=1?0:1-2*(n+.5)/e,i=Math.sqrt(Math.max(0,1-s*s)),r=n*Math.PI*(3-Math.sqrt(5));return[Math.cos(r)*i*t,s*t,Math.sin(r)*i*t]}function ju(n,e,t=()=>{},s="clumps",i=Kr){const r=new Map(n.map(L=>[L.id,L])),a=new Map,o=[];for(const L of n)L.group===null?o.push(L):a.set(L.group,[...a.get(L.group)??[],L]);const l=new Map,c=new Map,d=new Map,u=new Set;let h=0;const g=Math.max(1,a.size),p=new Map;for(const[L,F]of a){const P=F.filter(ae=>ae.seed!==void 0),W=[0,0,0];for(const ae of P)W[0]+=ae.seed[0],W[1]+=ae.seed[1],W[2]+=ae.seed[2];P.length>0&&(W[0]/=P.length,W[1]/=P.length,W[2]/=P.length,d.set(L,W)),F.every(ae=>ae.frozen===!0&&ae.seed!==void 0)&&u.add(L);const X=new Map,Q=P.length===0?AS(F):null,ie=Q===null?void 0:p.get(Q);if(P.length===F.length)for(const ae of F)X.set(ae.id,[ae.seed[0]-W[0],ae.seed[1]-W[1],ae.seed[2]-W[2]]);else if(ie!==void 0){const ae=i(L),xe=ae()*Math.PI*2,Ze=(ae()-.5)*Math.PI;F.forEach((nt,Ve)=>{X.set(nt.id,ES(ie[Ve]??[0,0,0],xe,Ze))})}else{const ae=F.map(ue=>{const fe={id:ue.id,r:ue.radius};return ue.seed!==void 0&&(fe.x=ue.seed[0]-W[0],fe.y=ue.seed[1]-W[1],fe.z=ue.seed[2]-W[2],ue.frozen===!0&&(fe.fx=fe.x,fe.fy=fe.y,fe.fz=fe.z)),fe}),xe=new Set(F.map(ue=>ue.id)),Ze=[];for(const ue of F)for(const fe of ue.parents)xe.has(fe)&&Ze.push({source:fe,target:ue.id});const nt=new Map(F.map(ue=>[ue.id,ue.radius])),Ve=xi(ae,3).force("link",sr(Ze).id(ue=>ue.id).distance(e.link?ue=>(nt.get(ue.source.id)??pn)+(nt.get(ue.target.id)??pn)+1.4:2.2)).force("charge",Si().strength(ue=>e.charge?-6*(ue.r/pn)**2:-6).distanceMax(xS)).force("center",Hi(0,0,0)).stop();e.collide&&Ve.force("collide",Oi().radius(ue=>ue.r*1.2));for(let ue=0;ue<SS;ue++)Ve.tick();const le=[0,0,0];for(const ue of ae)le[0]+=ue.x??0,le[1]+=ue.y??0,le[2]+=ue.z??0;le[0]/=ae.length,le[1]/=ae.length,le[2]/=ae.length;for(const ue of ae)X.set(ue.id,[(ue.x??0)-le[0],(ue.y??0)-le[1],(ue.z??0)-le[2]]);Q!==null&&p.set(Q,F.map(ue=>X.get(ue.id)??[0,0,0]))}let be=pn;for(const ae of F){const xe=X.get(ae.id)??[0,0,0];l.set(ae.id,xe),be=Math.max(be,Math.hypot(xe[0],xe[1],xe[2])+ae.radius)}c.set(L,be),h+=1,h%50===0&&t(.3*(h/g))}t(.3);const z=L=>{const F=r.get(L);return F!==void 0&&F.group!==null?`group:${F.group}`:L},m=[],f=new Map;let _=!1;for(const[L]of a){const F=`group:${L}`,P=c.get(L)??pn,W={id:F,r:P},X=d.get(L);X!==void 0&&(W.x=X[0],W.y=X[1],W.z=X[2],u.has(L)&&(W.fx=X[0],W.fy=X[1],W.fz=X[2],_=!0)),f.set(F,P),m.push(W)}for(const L of o){const F={id:L.id,r:L.radius};L.seed!==void 0&&(F.x=L.seed[0],F.y=L.seed[1],F.z=L.seed[2],L.frozen===!0&&(F.fx=L.seed[0],F.fy=L.seed[1],F.fz=L.seed[2],_=!0)),f.set(L.id,L.radius),m.push(F)}const O=new Set,w=[];for(const L of n)for(const F of L.parents){if(!r.has(F))continue;const P=z(F),W=z(L.id);if(P===W)continue;const X=`${P}\0${W}`;O.has(X)||(O.add(X),w.push({source:P,target:W}))}const x=new Map;for(const L of w)if(L.source.startsWith("group:")!==L.target.startsWith("group:")){const F=L.source.startsWith("group:")?L.source:L.target,P=L.source.startsWith("group:")?L.target:L.source;x.has(F)||x.set(F,P)}const S=new Map;for(const L of m){const F=x.get(L.id);F!==void 0&&S.set(F,[...S.get(F)??[],L])}const I=m.reduce((L,F)=>L+F.r*F.r,0),b=m.filter(L=>!L.id.startsWith("group:"));b.forEach((L,F)=>{if(L.x!==void 0)return;const[P,W,X]=Ec(F,b.length,Math.sqrt(I)*1.2+10);L.x=P,L.y=W,L.z=X});for(const[L,F]of S){const P=m.find(X=>X.id===L),W=Math.sqrt(F.reduce((X,Q)=>X+Q.r*Q.r,0))*1.4+2;F.forEach((X,Q)=>{if(X.x!==void 0)return;const[ie,be,ae]=Ec(Q,F.length,W);X.x=(P?.x??0)+ie,X.y=(P?.y??0)+be,X.z=(P?.z??0)+ae})}const A=new Set;if(s==="spokes"){const L=P=>{const W=a.get(P)??[],X=new Set(W.map(ie=>ie.id)),Q=W.find(ie=>ie.parents.some(be=>!X.has(be)))??W[0];return Q===void 0?[0,0,0]:l.get(Q.id)??[0,0,0]},F=[];for(const P of m){if(P.id.startsWith("group:")&&x.has(P.id)){A.add(P.id);continue}if(P.id.startsWith("group:"))F.push(P);else{const W=S.get(P.id)??[];let X=P.r;const Q=Gf(P.r,W,c);for(const ie of W){const be=ie.id.slice(6),ae=L(be);X=Math.max(X,Q+Math.hypot(ae[0],ae[1],ae[2])+2*(c.get(be)??pn))}F.push({id:P.id,r:X,x:P.x,y:P.y,z:P.z,...P.fx!==void 0?{fx:P.fx,fy:P.fy,fz:P.fz}:{}})}}if(!F.every(P=>P.fx!==void 0)){const P=xi(F,3).force("charge",Si().strength(W=>-1.5*W.r)).force("collide",Oi().radius(W=>W.r*.9)).stop();_||P.force("center",Hi(0,0,0));for(let W=0;W<Ac;W++)P.tick(),W%5===0&&t(.3+.7*(W/Ac))}for(const P of F){const W=m.find(X=>X.id===P.id);W!==void 0&&W!==P&&(W.x=P.x,W.y=P.y,W.z=P.z)}for(const P of m){if(P.id.startsWith("group:")||!S.has(P.id))continue;const W=S.get(P.id)??[],X=Gf(P.r,W,c);W.forEach((Q,ie)=>{if(Q.fx!==void 0||d.has(Q.id.slice(6)))return;const be=L(Q.id.slice(6)),ae=Ec(ie,W.length,1),xe=.35+.65*(ie*.6180339887%1),Ze=P.r+1.4+X*xe+Math.hypot(be[0],be[1],be[2]);Q.x=(P.x??0)+ae[0]*Ze,Q.y=(P.y??0)+ae[1]*Ze,Q.z=(P.z??0)+ae[2]*Ze})}}if(!m.every(L=>L.fx!==void 0)&&s!=="spokes"){const L=xi(m,3).force("link",sr(w).id(W=>W.id).distance(e.link?W=>(f.get(W.source.id)??pn)+(f.get(W.target.id)??pn)+1.4:2.2)).stop(),F=Si().strength(W=>e.charge?-6*(W.r/pn)**2:-6);if(e.reach!==void 0&&F.distanceMax(e.reach),L.force("charge",F),_||L.force("center",Hi(0,0,0)),e.collide&&L.force("collide",Oi().radius(W=>W.r*1.05)),e.gravity){const W=X=>Math.min(1,(X.r/pn)**2*.08);L.force("gx",ku(0).strength(W)).force("gy",Uu(0).strength(W)).force("gz",Fu(0).strength(W))}const P=Ac;for(let W=0;W<P;W++)L.tick(),W%5===0&&t(.3+.7*(W/P))}const N=new Map(m.map(L=>[L.id,L]));if(s==="spokes")for(const[L,F]of a){if(F.some(nt=>nt.seed!==void 0))continue;const P=`group:${L}`,W=N.get(P),X=x.get(P),Q=X===void 0?void 0:N.get(X);if(W===void 0||Q===void 0)continue;const ie=[(W.x??0)-(Q.x??0),(W.y??0)-(Q.y??0),(W.z??0)-(Q.z??0)],be=new Set(F.map(nt=>nt.id)),ae=F.find(nt=>nt.parents.some(Ve=>!be.has(Ve)))??F[0],xe=l.get(ae.id)??[0,0,0],Ze=[-xe[0],-xe[1],-xe[2]];for(const nt of F){const Ve=l.get(nt.id)??[0,0,0];l.set(nt.id,DS(Ve,Ze,ie))}}const k={};for(const L of n){const F=N.get(z(L.id)),P=[F?.x??0,F?.y??0,F?.z??0],W=L.group===null?[0,0,0]:l.get(L.id)??[0,0,0];k[L.id]=[P[0]+W[0],P[1]+W[1],P[2]+W[2]]}return t(1),k}const Rf=80;function Mg(n,e,t=()=>{},s=Kr){const i=n.some(h=>h.seed===void 0),r=i?ju(n,e,h=>t(.05*h),"spokes",s):{};t(.05);const a=n.map(h=>{const g=h.seed??r[h.id],p={id:h.id,r:h.radius};return g!==void 0&&(p.x=g[0],p.y=g[1],p.z=g[2],h.frozen===!0&&h.seed!==void 0&&(p.fx=g[0],p.fy=g[1],p.fz=g[2])),p}),o=new Set(n.map(h=>h.id)),l=[];for(const h of n)for(const g of h.parents)o.has(g)&&l.push({source:g,target:h.id});const c=new Map(n.map(h=>[h.id,h.radius])),d=a.some(h=>h.fx!==void 0);if(!a.every(h=>h.fx!==void 0)){const h=xi(a,3).force("link",sr(l).id(p=>p.id).distance(e.link?p=>(c.get(p.source.id)??jt)+(c.get(p.target.id)??jt)+1.4:2.2)).stop(),g=Si().strength(p=>e.charge?-6*(p.r/jt)**2:-6);if(e.reach!==void 0&&g.distanceMax(e.reach),h.force("charge",g),d||h.force("center",Hi(0,0,0)),e.collide&&h.force("collide",Oi().radius(p=>p.r*1.2)),e.gravity){const p=z=>(z.r/jt)**2*.08;h.force("gx",ku(0).strength(p)).force("gy",Uu(0).strength(p)).force("gz",Fu(0).strength(p))}i&&h.alpha(.6);for(let p=0;p<Rf;p++)h.tick(),p%2===0&&t(.05+.95*(p/Rf))}const u={};for(const h of a)u[h.id]=[h.x??0,h.y??0,h.z??0];return t(1),u}function bg(n){const e=new Map;for(const t of n)for(const s of t.parents)e.set(s,(e.get(s)??0)+1),e.set(t.id,(e.get(t.id)??0)+1);return n.map(t=>t.metric??e.get(t.id)??1)}function zg(n){const e=bg(n),t=Math.max(...e,1);return new Map(n.map((s,i)=>[s.id,jt*(.5+(e[i]??1)/t*1.2)]))}function _g(n,e=3,t=new Map,s=tr,i=new Set){const r=[];for(const _ of n)for(const O of _.parents)r.push({source:O,target:_.id});const a=bg(n),o=Math.max(...a,1),l=a.map(_=>jt*(.5+_/o*1.2)),c=new Map(n.map((_,O)=>[_.id,l[O]??jt])),d=n.map(_=>{const O=t.get(_.id);return O===void 0?{id:_.id}:i.has(_.id)?{id:_.id,x:O[0],y:O[1],z:O[2],fx:O[0],fy:O[1],fz:O[2]}:{id:_.id,x:O[0],y:O[1],z:O[2]}}),u=_=>i.has(_.id)&&_.fx!==void 0;let h=d,g=r;if(i.size>0){const _=new Set(d.filter(x=>!u(x)).map(x=>x.id));g=r.filter(x=>_.has(x.source)||_.has(x.target));const O=new Set(_);for(const x of g)O.add(x.source),O.add(x.target);h=d.filter(x=>O.has(x.id));const w=new Set(h.map(x=>x.id));g=g.filter(x=>w.has(x.source)&&w.has(x.target))}const p=Si().strength(s.charge?_=>i.has(_.id)?0:-6*((c.get(_.id)??jt)/jt)**2:_=>i.has(_.id)?0:-6);s.reach!==void 0&&p.distanceMax(s.reach);const z=xi(h,e).force("link",sr(g).id(_=>_.id).distance(s.link?_=>(c.get(_.source.id)??jt)+(c.get(_.target.id)??jt)+1.4:2.2)).force("charge",p).stop();if(i.size===0&&z.force("center",e===2?Hi(0,0):Hi(0,0,0)),s.collide&&z.force("collide",Oi().radius(_=>(c.get(_.id)??jt)*1.2)),s.gravity){const _=O=>((c.get(O.id)??jt)/jt)**2*.08;z.force("gx",ku(0).strength(_)).force("gy",Uu(0).strength(_)),e===3&&z.force("gz",Fu(0).strength(_))}const m=h.length===0?0:t.size>0?90:150;let f=0;return{total:m,moving:h.length,step:_=>{for(let O=0;O<_&&f<m;O++,f++)z.tick()},place:()=>n.map((_,O)=>{const w=d[O];return{id:_.id,position:[w?.x??0,w?.y??0,w?.z??0],radius:l[O]??jt}})}}function IS(n,e=3,t=new Map,s=tr,i=new Set){const r=_g(n,e,t,s,i);return r.step(r.total),r.place()}function TS(n,e,t=new Map,s=new Set){const i=zg(n.map(r=>{const a={id:r.id,parents:[...r.parentIds,...r.joinParentIds]};return r.metric!==void 0&&(a.metric=r.metric),a}));return n.map(r=>{const a=t.get(r.id);return{id:r.id,parents:[...r.parentIds,...r.joinParentIds],radius:i.get(r.id)??jt,group:r.ghost===!0?null:e(r),...r.attrs===void 0?{}:{attrs:r.attrs},...a===void 0?{}:{seed:a},...s.has(r.id)?{frozen:!0}:{}}})}const Bf=160,Nf=120,Cf=5,GS=.9,Pf=.3,RS=.9;function wg(n,e){const t=new Map;for(const[s,i]of n)t.set(s,e===0||i/e>RS?0:Math.log(e/Math.max(1,i)));return t}function BS(n,e,t=()=>{}){const s=b=>typeof b.attrs?.plugin=="string"?b.attrs.plugin:null,i=b=>b.attrs?.kind==="star"&&s(b)!==null,r=n.filter(i),a=new Map(r.map(b=>[s(b),b])),o=n.filter(b=>!i(b)),l=new Map;for(const b of o){const A=s(b);b.group===null||A===null||!a.has(A)||l.set(b.group,(l.get(b.group)??new Set).add(A))}const c=new Map;for(const b of l.values())for(const A of b)c.set(A,(c.get(A)??0)+1);const d=wg(c,l.size),u=Math.max(1e-9,...d.values()),h=new Map;for(const b of l.values()){const A=[...b].sort();for(let B=0;B<A.length;B++)for(let N=B+1;N<A.length;N++){const k=`${A[B]}\0${A[N]}`;h.set(k,(h.get(k)??0)+1)}}const g=Math.max(6,Math.sqrt(r.length)*4,Math.sqrt(o.length)*1.6),p=r.map(b=>Lf(b,g,Kr(`star:${b.id}`))),z=[];for(const[b,A]of h){const[B,N]=b.split("\0"),k=Math.min(c.get(B)??1,c.get(N)??1);z.push({source:a.get(B).id,target:a.get(N).id,share:A/Math.max(1,k)})}if(p.length>0&&p.some(b=>b.fx===void 0)){const b=xi(p,3).force("link",sr(z).id(A=>A.id).distance(A=>g*(1.1-Number(A.share))).strength(A=>.05+.6*Number(A.share))).force("charge",Si().strength(-30).distanceMax(g*3)).force("collide",Oi().radius(A=>A.r*3)).force("center",Hi(0,0,0)).stop();for(let A=0;A<Bf;A++)b.tick(),A%4===0&&t(.4*(A/Bf))}const m=new Map(p.map(b=>[b.id,[b.x??0,b.y??0,b.z??0]]));t(.4);const f=[...p.map(b=>({...b,fx:b.x??0,fy:b.y??0,fz:b.z??0})),...o.map(b=>{const A=s(b),B=A===null?void 0:a.get(A),N=B===void 0?void 0:m.get(B.id);return Lf(b,2,Kr(`stage:${b.id}`),N)})],_=new Set(n.map(b=>b.id)),O=new Map(n.map(b=>[b.id,b.radius])),w=[];for(const b of o){for(const L of b.parents)_.has(L)&&w.push({source:L,target:b.id,strength:1,length:(O.get(L)??jt)+b.radius+1.4});const A=s(b),B=A===null?void 0:a.get(A),N=A===null?0:d.get(A)??0,k=b.group===null?1:Math.max(1,l.get(b.group)?.size??1);if(B!==void 0&&N>0){const L=N/u,F=(Pf+(GS-Pf)*L)/Math.sqrt(k);w.push({source:B.id,target:b.id,strength:F,length:B.radius+b.radius+1})}}const x=xi(f,3).force("link",sr(w).id(b=>b.id).distance(b=>Number(b.length)).strength(b=>Number(b.strength))).stop();if(e.charge){const b=Si().strength(A=>-6*(A.r/jt)**2);b.distanceMax(Math.min(e.reach??Cf,Cf)),x.force("charge",b)}e.collide&&x.force("collide",Oi().radius(b=>b.r*1.2));const S=f.some(b=>b.fx===void 0);for(let b=0;S&&b<Nf;b++)x.tick(),b%4===0&&t(.4+.6*(b/Nf));const I={};for(const b of f)I[b.id]=[b.x??0,b.y??0,b.z??0];return t(1),I}function Lf(n,e,t,s=[0,0,0]){const i={id:n.id,r:n.radius},r=n.seed??[s[0]+(t()-.5)*2*e,s[1]+(t()-.5)*2*e,s[2]+(t()-.5)*2*e];return i.x=r[0],i.y=r[1],i.z=r[2],n.frozen===!0&&n.seed!==void 0&&(i.fx=r[0],i.fy=r[1],i.fz=r[2]),i}const Zr=.4,NS=400,Dr=.35,CS=.01,PS=3;function Wf(n,e,t){let s=0,i=0;for(const r of new Set([...n,...e])){const a=t.get(r)??0;i+=a,n.has(r)&&e.has(r)&&(s+=a)}return i===0?0:s/i}const kf=1.4,LS=Math.PI/3;function WS(n,e){const t=new Map,s=new Map(n.map(d=>[d.id,d])),i=new Map,r=[];for(const d of n){const u=d.parents.find(h=>s.has(h));u===void 0?r.push(d):i.set(u,[...i.get(u)??[],d])}const a=new Map,o=[];r.forEach((d,u)=>{const h=qi(e),g=u===0?0:d.radius*2+kf;t.set(d.id,[h[0]*g,h[1]*g,h[2]*g]),a.set(d.id,h),o.push(d)});for(let d=o.shift();d!==void 0;d=o.shift()){const u=t.get(d.id),h=a.get(d.id);for(const g of i.get(d.id)??[]){if(t.has(g.id))continue;const p=e()*LS,z=kS(h,e),m=yg([h[0]*Math.cos(p)+z[0]*Math.sin(p),h[1]*Math.cos(p)+z[1]*Math.sin(p),h[2]*Math.cos(p)+z[2]*Math.sin(p)]),f=d.radius+g.radius+kf;t.set(g.id,[u[0]+m[0]*f,u[1]+m[1]*f,u[2]+m[2]*f]),a.set(g.id,m),o.push(g)}}for(const d of n)t.has(d.id)||t.set(d.id,[0,0,0]);const l=[0,0,0];for(const d of t.values())l[0]+=d[0]/t.size,l[1]+=d[1]/t.size,l[2]+=d[2]/t.size;let c=jt;for(const d of n){const u=t.get(d.id),h=[u[0]-l[0],u[1]-l[1],u[2]-l[2]];t.set(d.id,h),c=Math.max(c,Math.hypot(h[0],h[1],h[2])+d.radius)}return{local:t,radius:c}}function yg(n){const e=Math.max(1e-9,Math.hypot(n[0],n[1],n[2]));return[n[0]/e,n[1]/e,n[2]/e]}function kS(n,e){const t=Math.abs(n[0])<.9?[1,0,0]:[0,1,0],s=yg([n[1]*t[2]-n[2]*t[1],n[2]*t[0]-n[0]*t[2],n[0]*t[1]-n[1]*t[0]]),i=[n[1]*s[2]-n[2]*s[1],n[2]*s[0]-n[0]*s[2],n[0]*s[1]-n[1]*s[0]],r=e()*Math.PI*2;return[s[0]*Math.cos(r)+i[0]*Math.sin(r),s[1]*Math.cos(r)+i[1]*Math.sin(r),s[2]*Math.cos(r)+i[2]*Math.sin(r)]}function qi(n){const e=n()*2-1,t=n()*Math.PI*2,s=Math.sqrt(1-e*e);return[s*Math.cos(t),s*Math.sin(t),e]}class US{size;cells=new Map;constructor(e){this.size=e}key(e){return`${Math.floor(e[0]/this.size)},${Math.floor(e[1]/this.size)},${Math.floor(e[2]/this.size)}`}add(e){const t=this.key(e.centre);this.cells.set(t,[...this.cells.get(t)??[],e])}touching(e,t){const s=[],[i,r,a]=[Math.floor(e[0]/this.size),Math.floor(e[1]/this.size),Math.floor(e[2]/this.size)];for(let o=-1;o<=1;o++)for(let l=-1;l<=1;l++)for(let c=-1;c<=1;c++)for(const d of this.cells.get(`${i+o},${r+l},${a+c}`)??[]){const u=t+d.particle.radius+Zr;Math.hypot(e[0]-d.centre[0],e[1]-d.centre[1],e[2]-d.centre[2])<u&&s.push(d)}return s}}function Uf(n,e,t,s){let i=[e[0]-n.centre[0],e[1]-n.centre[1],e[2]-n.centre[2]];const r=Math.hypot(i[0],i[1],i[2]);i=r<1e-9?qi(s):[i[0]/r,i[1]/r,i[2]/r];const a=t+n.particle.radius+Zr;return[n.centre[0]+i[0]*a,n.centre[1]+i[1]*a,n.centre[2]+i[2]*a]}function FS(n,e,t=()=>{}){const s={},i={};if(n.length>0&&n.every(p=>p.frozen===!0&&p.seed!==void 0)){for(const p of n)s[p.id]=p.seed;return t(1),{positions:s,arrival:i}}const r=new Map;for(const p of n){if(p.group===null){s[p.id]=[0,0,0];continue}r.set(p.group,[...r.get(p.group)??[],p])}const a=[...r].map(([p,z])=>{const m=new Set;let f=Number.POSITIVE_INFINITY;for(const w of z){const x=w.attrs?.plugin;typeof x=="string"&&m.add(x);const S=w.attrs?.createdAt;typeof S=="number"&&S<f&&(f=S)}if(z.every(w=>w.frozen===!0&&w.seed!==void 0)){const w=z.map(b=>b.seed),x=[0,1,2].map(b=>w.reduce((A,B)=>A+B[b],0)/w.length),S=new Map;let I=jt;for(const b of z){const A=b.seed,B=[A[0]-x[0],A[1]-x[1],A[2]-x[2]];S.set(b.id,B),I=Math.max(I,Math.hypot(B[0],B[1],B[2])+b.radius)}return{key:p,nodes:z,plugins:m,created:f,local:S,radius:I,held:!0,centre:x}}const{local:_,radius:O}=WS(z,Kr(`turn:${p}`));return{key:p,nodes:z,plugins:m,created:f,local:_,radius:O,held:!1}});a.sort((p,z)=>p.created-z.created||(p.key<z.key?-1:p.key>z.key?1:0));const o=new Map;for(const p of a)for(const z of p.plugins)o.set(z,(o.get(z)??0)+1);const l=wg(o,a.length),c=Math.max(jt,...a.map(p=>p.radius)),d=new US(2*c+Zr),u=[];let h=0;const g=(p,z,m)=>{const f={particle:p,centre:m};u.push(f),d.add(f),h=Math.max(h,Math.hypot(m[0],m[1],m[2])+p.radius);for(const _ of p.nodes){const O=p.local.get(_.id)??[0,0,0];s[_.id]=p.held&&_.seed!==void 0?_.seed:[m[0]+O[0],m[1]+O[1],m[2]+O[2]],i[_.id]=z}};return a.forEach((p,z)=>{p.held&&p.centre!==void 0&&g(p,z,p.centre)}),a.forEach((p,z)=>{if(p.held)return;const m=Kr(`accrete:${p.key}`);let f;if(u.length===0)f=[0,0,0];else{let _=u[u.length-1],O=-1;for(const A of u){const B=Wf(p.plugins,A.particle.plugins,l);B>=O&&(_=A,O=B)}const w=h+PS*p.radius+c,x=Math.max(.5,p.radius*.5),S=qi(m);let I=[S[0]*w,S[1]*w,S[2]*w],b=null;for(let A=0;A<NS&&b===null;A++){const B=qi(m),N=[_.centre[0]-I[0],_.centre[1]-I[1],_.centre[2]-I[2]],k=Math.max(1e-9,Math.hypot(N[0],N[1],N[2])),L=[B[0]*(1-Dr)+N[0]/k*Dr,B[1]*(1-Dr)+N[1]/k*Dr,B[2]*(1-Dr)+N[2]/k*Dr],F=[I[0]+L[0]*x,I[1]+L[1]*x,I[2]+L[2]*x],P=d.touching(F,p.radius);if(P.length===0){if(Math.hypot(F[0],F[1],F[2])>w*2){const Q=qi(m);I=[Q[0]*w,Q[1]*w,Q[2]*w]}else I=F;continue}let W=P[0],X=-1;for(const Q of P){const ie=Wf(p.plugins,Q.particle.plugins,l);ie>X&&(W=Q,X=ie)}if(m()<Math.max(CS,X)&&(b=Uf(W,I,p.radius,m),d.touching(b,p.radius-1e-6).some(Q=>Q!==W&&vg(b,p.radius,Q))&&(b=null)),b===null){const Q=Uf(W,I,p.radius,m),ie=[Q[0]-W.centre[0],Q[1]-W.centre[1],Q[2]-W.centre[2]],be=Math.max(1e-9,Math.hypot(ie[0],ie[1],ie[2]));I=[Q[0]+ie[0]/be*x,Q[1]+ie[1]/be*x,Q[2]+ie[2]/be*x]}}f=b??jS(_,p.radius,d,m)}g(p,z,f),z%8===0&&t(z/Math.max(1,a.length))}),t(1),{positions:s,arrival:i}}function vg(n,e,t){return Math.hypot(n[0]-t.centre[0],n[1]-t.centre[1],n[2]-t.centre[2])<e+t.particle.radius+Zr*.5}function jS(n,e,t,s){for(let a=0;a<8;a++)for(let o=0;o<24;o++){const l=qi(s),c=e+n.particle.radius+Zr+a*e,d=[n.centre[0]+l[0]*c,n.centre[1]+l[1]*c,n.centre[2]+l[2]*c];if(!t.touching(d,e).some(u=>vg(d,e,u)))return d}const i=qi(s),r=e+n.particle.radius+Zr+8*e;return[n.centre[0]+i[0]*r,n.centre[1]+i[1]*r,n.centre[2]+i[2]*r]}function Og(n){const e=new Map(n.map(p=>[p.id,p])),t=new Map,s=(p,z)=>{const m=t.get(p.id);if(m!==void 0)return m;if(z.has(p.id)||p.parentIds.length===0)return t.set(p.id,0),0;z.add(p.id);let f=0;for(const _ of p.parentIds){const O=e.get(_);O&&(f=Math.max(f,s(O,z)+1))}return t.set(p.id,f),f};for(const p of n)s(p,new Set);const i=new Map,r=[],a=(p,z)=>p.id.localeCompare(z.id,void 0,{numeric:!0});for(const p of n){const z=p.parentIds.find(f=>e.has(f));if(z===void 0){r.push(p);continue}const m=i.get(z)??[];m.push(p),i.set(z,m)}r.sort(a);for(const p of i.values())p.sort(a);const o=new Map;let l=0;const c=new Set,d=p=>{c.add(p.id);const z=(i.get(p.id)??[]).filter(O=>!c.has(O.id));if(z.length===0){const O=l++;return o.set(p.id,O),[O,O]}let m=Number.POSITIVE_INFINITY,f=Number.NEGATIVE_INFINITY;for(const O of z){const[w,x]=d(O);m=Math.min(m,w),f=Math.max(f,x)}const _=(m+f)/2;return o.set(p.id,_),[m,f]};for(const p of r)d(p);for(const p of n)o.has(p.id)||d(p);const u=Math.max(...Array.from(t.values()),0)+1,h=Math.max(l-1,0);return{placements:n.map(p=>({id:p.id,x:o.get(p.id)??0,tier:t.get(p.id)??0})),width:h,tierCount:u}}const $S=2.6,VS=2;function xg(n){const e=n.map(r=>r.metric??0),t=Math.max(...e,0),s=Og(n),i=new Map(s.placements.map(r=>[r.id,r]));return n.map(r=>{const a=i.get(r.id),o=((a?.x??0)-s.width/2)*VS,l=((s.tierCount-1)/2-(a?.tier??0))*$S,c=r.metric??0,d=t>0?.55+c/t*1:1,u=[o,l,0];return{id:r.id,position:u,radius:jt*d}})}const HS=.02;function qS(n){const e=new Map(n.nodes.map(o=>[o.id,o])),t=[],s=new Map;for(const o of n.edges){const l=e.get(o.from),c=e.get(o.to);l===void 0||c===void 0||l.halo||c.halo||(t.push({source:o.from,target:o.to}),s.set(o.from,[...s.get(o.from)??[],o.to]),s.set(o.to,[...s.get(o.to)??[],o.from]))}const i=new Set([n.grabbed]),r=[n.grabbed];for(;r.length>0;){const o=r.pop();for(const l of s.get(o)??[])i.has(l)||e.get(l)?.dim===!0||(i.add(l),r.push(l))}const a=t.filter(o=>i.has(o.source)&&i.has(o.target));return{ids:i,links:a}}class XS{nodes;grabbed;sim;constructor(e){const{ids:t,links:s}=qS(e),i=new Map(e.nodes.map(o=>[o.id,o.radius])),r=o=>i.get(o)??e.baseRadius,a=new Map(e.nodes.map(o=>[o.id,o.position]));this.nodes=[...t].filter(o=>a.has(o)).map(o=>{const[l,c,d]=a.get(o);return{id:o,x:l,y:c,z:d}}),this.sim=xi(this.nodes,e.dimensions).force("link",sr(s).id(o=>o.id).distance(o=>r(o.source.id)+r(o.target.id)+1.4)).force("charge",Si().strength(o=>-6*(r(o.id)/e.baseRadius)**2).distanceMax(12)).force("collide",Oi().radius(o=>r(o.id)*1.2)).alpha(.25).alphaTarget(.08).stop(),this.grabbed=this.nodes.find(o=>o.id===e.grabbed),this.grabbed!==void 0&&(this.grabbed.fx=this.grabbed.x,this.grabbed.fy=this.grabbed.y,this.grabbed.fz=this.grabbed.z)}pin(e){this.grabbed!==void 0&&([this.grabbed.fx,this.grabbed.fy,this.grabbed.fz]=e)}release(){this.grabbed!==void 0&&(this.grabbed.fx=null,this.grabbed.fy=null,this.grabbed.fz=null),this.sim.alphaTarget(0)}step(e){return!e&&this.sim.alpha()<=HS?!1:(this.sim.tick(),!0)}positions(){return this.nodes.map(e=>({id:e.id,position:[e.x,e.y,e.z]}))}}function Gl(n){const e={id:n.id,parents:n.parents,radius:n.radius,group:n.group};return n.seed!==void 0&&(e.seed=n.seed),n.frozen!==void 0&&(e.frozen=n.frozen),e}function Sg(n){const e=n.attrs?.metric;return typeof e=="number"?e:void 0}function Ag(n){const e={};for(const t of n)e[t.id]=t.position;return e}const YS={id:"galaxy",label:"GALAXY",needs:[],run:(n,e)=>({positions:Mg(n.nodes.map(Gl),n.physics,e)})},KS={id:"spokes",label:"SPOKES",needs:[],run:(n,e)=>({positions:ju(n.nodes.map(Gl),n.physics,e,"spokes")})},ZS={id:"clumps",label:"CLUMPS",needs:[],run:(n,e)=>({positions:ju(n.nodes.map(Gl),n.physics,e,"clumps")})},QS={id:"ranked",label:"RANKED",needs:[],run:(n,e)=>{const t=n.nodes.map(i=>{const r={id:i.id,parentIds:i.parents},a=Sg(i);return a!==void 0&&(r.metric=a),r}),s=Ag(xg(t));return e(1),{positions:s}}},JS={id:"molecule",label:"MOLECULE",needs:[],run:(n,e)=>{const t=n.nodes.map(a=>{const o={id:a.id,parents:a.parents},l=Sg(a);return l!==void 0&&(o.metric=l),o}),s=new Map,i=new Set;for(const a of n.nodes)a.seed!==void 0&&s.set(a.id,a.seed),a.frozen===!0&&i.add(a.id);const r=Ag(IS(t,3,s,n.physics,i));return e(1),{positions:r}}},e1={id:"constellations",label:"CONSTELLATIONS",needs:["plugin"],run:(n,e)=>({positions:BS(n.nodes,n.physics,e)})},t1={id:"hubs",label:"HUBS",needs:[],run:(n,e)=>({positions:Mg(n.nodes.map(Gl),n.physics,e)})},s1={id:"accretion",label:"ACCRETION",needs:["plugin"],run:(n,e)=>FS(n.nodes,n.physics,e)},n1=[YS,KS,ZS,e1,t1,s1,QS,JS];function i1(n){return n1.find(e=>e.id===n)}const $o=.16,Ff=.09,Eg=.1,jf=.2,Wr=450,Vn=1200,$f=1800,r1=7,a1=5,o1=300,Vf=.18,Oo=1e3,l1=9,c1=500,Hf=new Ke("#ffffff"),qf=new Map;function Ir(n,e){if("token"in n)return e[n.token];if("hue"in n){let i=qf.get(n.hue);return i===void 0&&(i=new Ke(n.hue),qf.set(n.hue,i)),i}const[t,s]=n.blend;return e[t].clone().lerp(e[s],Math.max(0,Math.min(1,n.share)))}function Dc(n){return 1.6+.45*Math.sqrt(Math.max(1,n))}function d1(n,e,t){const s=Math.PI*(3-Math.sqrt(5)),i=e===1?0:1-2*n/(e-1),r=Math.sqrt(Math.max(0,1-i*i)),a=s*n;return new U(Math.cos(a)*r*t,i*t,Math.sin(a)*r*t)}class u1{byKey=new Map;of(e){const t=Math.round(e*1e3);let s=this.byKey.get(t);return s===void 0&&(s=new El(t/1e3,24,18),s.computeBoundingSphere(),this.byKey.set(t,s)),s}dispose(){for(const e of this.byKey.values())e.dispose();this.byKey.clear()}}const h1=2,f1=28,Dg=1.8,p1=`
4109
+ }`;class nx{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(e,t){if(this.texture===null){const s=new Zm(e.texture);(e.depthNear!==t.depthNear||e.depthFar!==t.depthFar)&&(this.depthNear=e.depthNear,this.depthFar=e.depthFar),this.texture=s}}getMesh(e){if(this.texture!==null&&this.mesh===null){const t=e.cameras[0].viewport,s=new hs({vertexShader:tx,fragmentShader:sx,uniforms:{depthColor:{value:this.texture},depthWidth:{value:t.z},depthHeight:{value:t.w}}});this.mesh=new Us(new Al(20,20),s)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}}class ix extends ir{constructor(e,t){super();const s=this;let i=null,r=1,a=null,o="local-floor",l=1,c=null,d=null,u=null,h=null,g=null,p=null;const z=typeof XRWebGLBinding<"u",m=new nx,f={},_=t.getContextAttributes();let O=null,w=null;const x=[],S=[],I=new lt;let b=null;const A=new nn;A.viewport=new ts;const B=new nn;B.viewport=new ts;const N=[A,B],k=new f_;let L=null,j=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(ce){let ue=x[ce];return ue===void 0&&(ue=new Jl,x[ce]=ue),ue.getTargetRaySpace()},this.getControllerGrip=function(ce){let ue=x[ce];return ue===void 0&&(ue=new Jl,x[ce]=ue),ue.getGripSpace()},this.getHand=function(ce){let ue=x[ce];return ue===void 0&&(ue=new Jl,x[ce]=ue),ue.getHandSpace()};function P(ce){const ue=S.indexOf(ce.inputSource);if(ue===-1)return;const fe=x[ue];fe!==void 0&&(fe.update(ce.inputSource,ce.frame,c||a),fe.dispatchEvent({type:ce.type,data:ce.inputSource}))}function W(){i.removeEventListener("select",P),i.removeEventListener("selectstart",P),i.removeEventListener("selectend",P),i.removeEventListener("squeeze",P),i.removeEventListener("squeezestart",P),i.removeEventListener("squeezeend",P),i.removeEventListener("end",W),i.removeEventListener("inputsourceschange",X);for(let ce=0;ce<x.length;ce++){const ue=S[ce];ue!==null&&(S[ce]=null,x[ce].disconnect(ue))}L=null,j=null,m.reset();for(const ce in f)delete f[ce];e.setRenderTarget(O),g=null,h=null,u=null,i=null,w=null,je.stop(),s.isPresenting=!1,e.setPixelRatio(b),e.setSize(I.width,I.height,!1),s.dispatchEvent({type:"sessionend"})}this.setFramebufferScaleFactor=function(ce){r=ce,s.isPresenting===!0&&st("WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(ce){o=ce,s.isPresenting===!0&&st("WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return c||a},this.setReferenceSpace=function(ce){c=ce},this.getBaseLayer=function(){return h!==null?h:g},this.getBinding=function(){return u===null&&z&&(u=new XRWebGLBinding(i,t)),u},this.getFrame=function(){return p},this.getSession=function(){return i},this.setSession=async function(ce){if(i=ce,i!==null){if(O=e.getRenderTarget(),i.addEventListener("select",P),i.addEventListener("selectstart",P),i.addEventListener("selectend",P),i.addEventListener("squeeze",P),i.addEventListener("squeezestart",P),i.addEventListener("squeezeend",P),i.addEventListener("end",W),i.addEventListener("inputsourceschange",X),_.xrCompatible!==!0&&await t.makeXRCompatible(),b=e.getPixelRatio(),e.getSize(I),z&&"createProjectionLayer"in XRWebGLBinding.prototype){let fe=null,et=null,ct=null;_.depth&&(ct=_.stencil?t.DEPTH24_STENCIL8:t.DEPTH_COMPONENT24,fe=_.stencil?ji:si,et=_.stencil?Wa:Gn);const Qe={colorFormat:t.RGBA8,depthFormat:ct,scaleFactor:r};u=this.getBinding(),h=u.createProjectionLayer(Qe),i.updateRenderState({layers:[h]}),e.setPixelRatio(1),e.setSize(h.textureWidth,h.textureHeight,!1),w=new In(h.textureWidth,h.textureHeight,{format:bn,type:Zs,depthTexture:new qr(h.textureWidth,h.textureHeight,et,void 0,void 0,void 0,void 0,void 0,void 0,fe),stencilBuffer:_.stencil,colorSpace:e.outputColorSpace,samples:_.antialias?4:0,resolveDepthBuffer:h.ignoreDepthValues===!1,resolveStencilBuffer:h.ignoreDepthValues===!1})}else{const fe={antialias:_.antialias,alpha:!0,depth:_.depth,stencil:_.stencil,framebufferScaleFactor:r};g=new XRWebGLLayer(i,t,fe),i.updateRenderState({baseLayer:g}),e.setPixelRatio(1),e.setSize(g.framebufferWidth,g.framebufferHeight,!1),w=new In(g.framebufferWidth,g.framebufferHeight,{format:bn,type:Zs,colorSpace:e.outputColorSpace,stencilBuffer:_.stencil,resolveDepthBuffer:g.ignoreDepthValues===!1,resolveStencilBuffer:g.ignoreDepthValues===!1})}w.isXRRenderTarget=!0,this.setFoveation(l),c=null,a=await i.requestReferenceSpace(o),je.setContext(i),je.start(),s.isPresenting=!0,s.dispatchEvent({type:"sessionstart"})}},this.getEnvironmentBlendMode=function(){if(i!==null)return i.environmentBlendMode},this.getDepthTexture=function(){return m.getDepthTexture()};function X(ce){for(let ue=0;ue<ce.removed.length;ue++){const fe=ce.removed[ue],et=S.indexOf(fe);et>=0&&(S[et]=null,x[et].disconnect(fe))}for(let ue=0;ue<ce.added.length;ue++){const fe=ce.added[ue];let et=S.indexOf(fe);if(et===-1){for(let Qe=0;Qe<x.length;Qe++)if(Qe>=S.length){S.push(fe),et=Qe;break}else if(S[Qe]===null){S[Qe]=fe,et=Qe;break}if(et===-1)break}const ct=x[et];ct&&ct.connect(fe)}}const Q=new F,re=new F;function Me(ce,ue,fe){Q.setFromMatrixPosition(ue.matrixWorld),re.setFromMatrixPosition(fe.matrixWorld);const et=Q.distanceTo(re),ct=ue.projectionMatrix.elements,Qe=fe.projectionMatrix.elements,Zt=ct[14]/(ct[10]-1),gt=ct[14]/(ct[10]+1),Rt=(ct[9]+1)/ct[5],it=(ct[9]-1)/ct[5],wt=(ct[8]-1)/ct[0],ns=(Qe[8]+1)/Qe[0],Ut=Zt*wt,rs=Zt*ns,as=et/(-wt+ns),Qt=as*-wt;if(ue.matrixWorld.decompose(ce.position,ce.quaternion,ce.scale),ce.translateX(Qt),ce.translateZ(as),ce.matrixWorld.compose(ce.position,ce.quaternion,ce.scale),ce.matrixWorldInverse.copy(ce.matrixWorld).invert(),ct[10]===-1)ce.projectionMatrix.copy(ue.projectionMatrix),ce.projectionMatrixInverse.copy(ue.projectionMatrixInverse);else{const es=Zt+as,q=gt+as,Os=Ut-Qt,Bt=rs+(et-Qt),R=Rt*gt/q*es,y=it*gt/q*es;ce.projectionMatrix.makePerspective(Os,Bt,R,y,es,q),ce.projectionMatrixInverse.copy(ce.projectionMatrix).invert()}}function oe(ce,ue){ue===null?ce.matrixWorld.copy(ce.matrix):ce.matrixWorld.multiplyMatrices(ue.matrixWorld,ce.matrix),ce.matrixWorldInverse.copy(ce.matrixWorld).invert()}this.updateCamera=function(ce){if(i===null)return;let ue=ce.near,fe=ce.far;m.texture!==null&&(m.depthNear>0&&(ue=m.depthNear),m.depthFar>0&&(fe=m.depthFar)),k.near=B.near=A.near=ue,k.far=B.far=A.far=fe,(L!==k.near||j!==k.far)&&(i.updateRenderState({depthNear:k.near,depthFar:k.far}),L=k.near,j=k.far),k.layers.mask=ce.layers.mask|6,A.layers.mask=k.layers.mask&-5,B.layers.mask=k.layers.mask&-3;const et=ce.parent,ct=k.cameras;oe(k,et);for(let Qe=0;Qe<ct.length;Qe++)oe(ct[Qe],et);ct.length===2?Me(k,A,B):k.projectionMatrix.copy(A.projectionMatrix),Oe(ce,k,et)};function Oe(ce,ue,fe){fe===null?ce.matrix.copy(ue.matrixWorld):(ce.matrix.copy(fe.matrixWorld),ce.matrix.invert(),ce.matrix.multiply(ue.matrixWorld)),ce.matrix.decompose(ce.position,ce.quaternion,ce.scale),ce.updateMatrixWorld(!0),ce.projectionMatrix.copy(ue.projectionMatrix),ce.projectionMatrixInverse.copy(ue.projectionMatrixInverse),ce.isPerspectiveCamera&&(ce.fov=Kd*2*Math.atan(1/ce.projectionMatrix.elements[5]),ce.zoom=1)}this.getCamera=function(){return k},this.getFoveation=function(){if(!(h===null&&g===null))return l},this.setFoveation=function(ce){l=ce,h!==null&&(h.fixedFoveation=ce),g!==null&&g.fixedFoveation!==void 0&&(g.fixedFoveation=ce)},this.hasDepthSensing=function(){return m.texture!==null},this.getDepthSensingMesh=function(){return m.getMesh(k)},this.getCameraTexture=function(ce){return f[ce]};let Ke=null;function nt(ce,ue){if(d=ue.getViewerPose(c||a),p=ue,d!==null){const fe=d.views;g!==null&&(e.setRenderTargetFramebuffer(w,g.framebuffer),e.setRenderTarget(w));let et=!1;fe.length!==k.cameras.length&&(k.cameras.length=0,et=!0);for(let gt=0;gt<fe.length;gt++){const Rt=fe[gt];let it=null;if(g!==null)it=g.getViewport(Rt);else{const ns=u.getViewSubImage(h,Rt);it=ns.viewport,gt===0&&(e.setRenderTargetTextures(w,ns.colorTexture,ns.depthStencilTexture),e.setRenderTarget(w))}let wt=N[gt];wt===void 0&&(wt=new nn,wt.layers.enable(gt),wt.viewport=new ts,N[gt]=wt),wt.matrix.fromArray(Rt.transform.matrix),wt.matrix.decompose(wt.position,wt.quaternion,wt.scale),wt.projectionMatrix.fromArray(Rt.projectionMatrix),wt.projectionMatrixInverse.copy(wt.projectionMatrix).invert(),wt.viewport.set(it.x,it.y,it.width,it.height),gt===0&&(k.matrix.copy(wt.matrix),k.matrix.decompose(k.position,k.quaternion,k.scale)),et===!0&&k.cameras.push(wt)}const ct=i.enabledFeatures;if(ct&&ct.includes("depth-sensing")&&i.depthUsage=="gpu-optimized"&&z){u=s.getBinding();const gt=u.getDepthInformation(fe[0]);gt&&gt.isValid&&gt.texture&&m.init(gt,i.renderState)}if(ct&&ct.includes("camera-access")&&z){e.state.unbindTexture(),u=s.getBinding();for(let gt=0;gt<fe.length;gt++){const Rt=fe[gt].camera;if(Rt){let it=f[Rt];it||(it=new Zm,f[Rt]=it);const wt=u.getCameraImage(Rt);it.sourceTexture=wt}}}}for(let fe=0;fe<x.length;fe++){const et=S[fe],ct=x[fe];et!==null&&ct!==void 0&&ct.update(et,ue,c||a)}Ke&&Ke(ce,ue),ue.detectedPlanes&&s.dispatchEvent({type:"planesdetected",data:ue}),p=null}const je=new tg;je.setAnimationLoop(nt),this.setAnimationLoop=function(ce){Ke=ce},this.dispose=function(){}}}const rx=new Gt,lg=new ut;lg.set(-1,0,0,0,1,0,0,0,1);function ax(n,e){function t(m,f){m.matrixAutoUpdate===!0&&m.updateMatrix(),f.value.copy(m.matrix)}function s(m,f){f.color.getRGB(m.fogColor.value,Qm(n)),f.isFog?(m.fogNear.value=f.near,m.fogFar.value=f.far):f.isFogExp2&&(m.fogDensity.value=f.density)}function i(m,f,_,O,w){f.isNodeMaterial?f.uniformsNeedUpdate=!1:f.isMeshBasicMaterial?r(m,f):f.isMeshLambertMaterial?(r(m,f),f.envMap&&(m.envMapIntensity.value=f.envMapIntensity)):f.isMeshToonMaterial?(r(m,f),u(m,f)):f.isMeshPhongMaterial?(r(m,f),d(m,f),f.envMap&&(m.envMapIntensity.value=f.envMapIntensity)):f.isMeshStandardMaterial?(r(m,f),h(m,f),f.isMeshPhysicalMaterial&&g(m,f,w)):f.isMeshMatcapMaterial?(r(m,f),p(m,f)):f.isMeshDepthMaterial?r(m,f):f.isMeshDistanceMaterial?(r(m,f),z(m,f)):f.isMeshNormalMaterial?r(m,f):f.isLineBasicMaterial?(a(m,f),f.isLineDashedMaterial&&o(m,f)):f.isPointsMaterial?l(m,f,_,O):f.isSpriteMaterial?c(m,f):f.isShadowMaterial?(m.color.value.copy(f.color),m.opacity.value=f.opacity):f.isShaderMaterial&&(f.uniformsNeedUpdate=!1)}function r(m,f){m.opacity.value=f.opacity,f.color&&m.diffuse.value.copy(f.color),f.emissive&&m.emissive.value.copy(f.emissive).multiplyScalar(f.emissiveIntensity),f.map&&(m.map.value=f.map,t(f.map,m.mapTransform)),f.alphaMap&&(m.alphaMap.value=f.alphaMap,t(f.alphaMap,m.alphaMapTransform)),f.bumpMap&&(m.bumpMap.value=f.bumpMap,t(f.bumpMap,m.bumpMapTransform),m.bumpScale.value=f.bumpScale,f.side===ks&&(m.bumpScale.value*=-1)),f.normalMap&&(m.normalMap.value=f.normalMap,t(f.normalMap,m.normalMapTransform),m.normalScale.value.copy(f.normalScale),f.side===ks&&m.normalScale.value.negate()),f.displacementMap&&(m.displacementMap.value=f.displacementMap,t(f.displacementMap,m.displacementMapTransform),m.displacementScale.value=f.displacementScale,m.displacementBias.value=f.displacementBias),f.emissiveMap&&(m.emissiveMap.value=f.emissiveMap,t(f.emissiveMap,m.emissiveMapTransform)),f.specularMap&&(m.specularMap.value=f.specularMap,t(f.specularMap,m.specularMapTransform)),f.alphaTest>0&&(m.alphaTest.value=f.alphaTest);const _=e.get(f),O=_.envMap,w=_.envMapRotation;O&&(m.envMap.value=O,m.envMapRotation.value.setFromMatrix4(rx.makeRotationFromEuler(w)).transpose(),O.isCubeTexture&&O.isRenderTargetTexture===!1&&m.envMapRotation.value.premultiply(lg),m.reflectivity.value=f.reflectivity,m.ior.value=f.ior,m.refractionRatio.value=f.refractionRatio),f.lightMap&&(m.lightMap.value=f.lightMap,m.lightMapIntensity.value=f.lightMapIntensity,t(f.lightMap,m.lightMapTransform)),f.aoMap&&(m.aoMap.value=f.aoMap,m.aoMapIntensity.value=f.aoMapIntensity,t(f.aoMap,m.aoMapTransform))}function a(m,f){m.diffuse.value.copy(f.color),m.opacity.value=f.opacity,f.map&&(m.map.value=f.map,t(f.map,m.mapTransform))}function o(m,f){m.dashSize.value=f.dashSize,m.totalSize.value=f.dashSize+f.gapSize,m.scale.value=f.scale}function l(m,f,_,O){m.diffuse.value.copy(f.color),m.opacity.value=f.opacity,m.size.value=f.size*_,m.scale.value=O*.5,f.map&&(m.map.value=f.map,t(f.map,m.uvTransform)),f.alphaMap&&(m.alphaMap.value=f.alphaMap,t(f.alphaMap,m.alphaMapTransform)),f.alphaTest>0&&(m.alphaTest.value=f.alphaTest)}function c(m,f){m.diffuse.value.copy(f.color),m.opacity.value=f.opacity,m.rotation.value=f.rotation,f.map&&(m.map.value=f.map,t(f.map,m.mapTransform)),f.alphaMap&&(m.alphaMap.value=f.alphaMap,t(f.alphaMap,m.alphaMapTransform)),f.alphaTest>0&&(m.alphaTest.value=f.alphaTest)}function d(m,f){m.specular.value.copy(f.specular),m.shininess.value=Math.max(f.shininess,1e-4)}function u(m,f){f.gradientMap&&(m.gradientMap.value=f.gradientMap)}function h(m,f){m.metalness.value=f.metalness,f.metalnessMap&&(m.metalnessMap.value=f.metalnessMap,t(f.metalnessMap,m.metalnessMapTransform)),m.roughness.value=f.roughness,f.roughnessMap&&(m.roughnessMap.value=f.roughnessMap,t(f.roughnessMap,m.roughnessMapTransform)),f.envMap&&(m.envMapIntensity.value=f.envMapIntensity)}function g(m,f,_){m.ior.value=f.ior,f.sheen>0&&(m.sheenColor.value.copy(f.sheenColor).multiplyScalar(f.sheen),m.sheenRoughness.value=f.sheenRoughness,f.sheenColorMap&&(m.sheenColorMap.value=f.sheenColorMap,t(f.sheenColorMap,m.sheenColorMapTransform)),f.sheenRoughnessMap&&(m.sheenRoughnessMap.value=f.sheenRoughnessMap,t(f.sheenRoughnessMap,m.sheenRoughnessMapTransform))),f.clearcoat>0&&(m.clearcoat.value=f.clearcoat,m.clearcoatRoughness.value=f.clearcoatRoughness,f.clearcoatMap&&(m.clearcoatMap.value=f.clearcoatMap,t(f.clearcoatMap,m.clearcoatMapTransform)),f.clearcoatRoughnessMap&&(m.clearcoatRoughnessMap.value=f.clearcoatRoughnessMap,t(f.clearcoatRoughnessMap,m.clearcoatRoughnessMapTransform)),f.clearcoatNormalMap&&(m.clearcoatNormalMap.value=f.clearcoatNormalMap,t(f.clearcoatNormalMap,m.clearcoatNormalMapTransform),m.clearcoatNormalScale.value.copy(f.clearcoatNormalScale),f.side===ks&&m.clearcoatNormalScale.value.negate())),f.dispersion>0&&(m.dispersion.value=f.dispersion),f.iridescence>0&&(m.iridescence.value=f.iridescence,m.iridescenceIOR.value=f.iridescenceIOR,m.iridescenceThicknessMinimum.value=f.iridescenceThicknessRange[0],m.iridescenceThicknessMaximum.value=f.iridescenceThicknessRange[1],f.iridescenceMap&&(m.iridescenceMap.value=f.iridescenceMap,t(f.iridescenceMap,m.iridescenceMapTransform)),f.iridescenceThicknessMap&&(m.iridescenceThicknessMap.value=f.iridescenceThicknessMap,t(f.iridescenceThicknessMap,m.iridescenceThicknessMapTransform))),f.transmission>0&&(m.transmission.value=f.transmission,m.transmissionSamplerMap.value=_.texture,m.transmissionSamplerSize.value.set(_.width,_.height),f.transmissionMap&&(m.transmissionMap.value=f.transmissionMap,t(f.transmissionMap,m.transmissionMapTransform)),m.thickness.value=f.thickness,f.thicknessMap&&(m.thicknessMap.value=f.thicknessMap,t(f.thicknessMap,m.thicknessMapTransform)),m.attenuationDistance.value=f.attenuationDistance,m.attenuationColor.value.copy(f.attenuationColor)),f.anisotropy>0&&(m.anisotropyVector.value.set(f.anisotropy*Math.cos(f.anisotropyRotation),f.anisotropy*Math.sin(f.anisotropyRotation)),f.anisotropyMap&&(m.anisotropyMap.value=f.anisotropyMap,t(f.anisotropyMap,m.anisotropyMapTransform))),m.specularIntensity.value=f.specularIntensity,m.specularColor.value.copy(f.specularColor),f.specularColorMap&&(m.specularColorMap.value=f.specularColorMap,t(f.specularColorMap,m.specularColorMapTransform)),f.specularIntensityMap&&(m.specularIntensityMap.value=f.specularIntensityMap,t(f.specularIntensityMap,m.specularIntensityMapTransform))}function p(m,f){f.matcap&&(m.matcap.value=f.matcap)}function z(m,f){const _=e.get(f).light;m.referencePosition.value.setFromMatrixPosition(_.matrixWorld),m.nearDistance.value=_.shadow.camera.near,m.farDistance.value=_.shadow.camera.far}return{refreshFogUniforms:s,refreshMaterialUniforms:i}}function ox(n,e,t,s){let i={},r={},a=[];const o=n.getParameter(n.MAX_UNIFORM_BUFFER_BINDINGS);function l(w,x){const S=x.program;s.uniformBlockBinding(w,S)}function c(w,x){let S=i[w.id];S===void 0&&(m(w),S=d(w),i[w.id]=S,w.addEventListener("dispose",_));const I=x.program;s.updateUBOMapping(w,I);const b=e.render.frame;r[w.id]!==b&&(h(w),r[w.id]=b)}function d(w){const x=u();w.__bindingPointIndex=x;const S=n.createBuffer(),I=w.__size,b=w.usage;return n.bindBuffer(n.UNIFORM_BUFFER,S),n.bufferData(n.UNIFORM_BUFFER,I,b),n.bindBuffer(n.UNIFORM_BUFFER,null),n.bindBufferBase(n.UNIFORM_BUFFER,x,S),S}function u(){for(let w=0;w<o;w++)if(a.indexOf(w)===-1)return a.push(w),w;return Ot("WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}function h(w){const x=i[w.id],S=w.uniforms,I=w.__cache;n.bindBuffer(n.UNIFORM_BUFFER,x);for(let b=0,A=S.length;b<A;b++){const B=S[b];if(Array.isArray(B))for(let N=0,k=B.length;N<k;N++)g(B[N],b,N,I);else g(B,b,0,I)}n.bindBuffer(n.UNIFORM_BUFFER,null)}function g(w,x,S,I){if(z(w,x,S,I)===!0){const b=w.__offset,A=w.value;if(Array.isArray(A)){let B=0;for(let N=0;N<A.length;N++){const k=A[N],L=f(k);p(k,w.__data,B),typeof k!="number"&&typeof k!="boolean"&&!k.isMatrix3&&!ArrayBuffer.isView(k)&&(B+=L.storage/Float32Array.BYTES_PER_ELEMENT)}}else p(A,w.__data,0);n.bufferSubData(n.UNIFORM_BUFFER,b,w.__data)}}function p(w,x,S){typeof w=="number"||typeof w=="boolean"?x[0]=w:w.isMatrix3?(x[0]=w.elements[0],x[1]=w.elements[1],x[2]=w.elements[2],x[3]=0,x[4]=w.elements[3],x[5]=w.elements[4],x[6]=w.elements[5],x[7]=0,x[8]=w.elements[6],x[9]=w.elements[7],x[10]=w.elements[8],x[11]=0):ArrayBuffer.isView(w)?x.set(new w.constructor(w.buffer,w.byteOffset,x.length)):w.toArray(x,S)}function z(w,x,S,I){const b=w.value,A=x+"_"+S;if(I[A]===void 0)return typeof b=="number"||typeof b=="boolean"?I[A]=b:ArrayBuffer.isView(b)?I[A]=b.slice():I[A]=b.clone(),!0;{const B=I[A];if(typeof b=="number"||typeof b=="boolean"){if(B!==b)return I[A]=b,!0}else{if(ArrayBuffer.isView(b))return!0;if(B.equals(b)===!1)return B.copy(b),!0}}return!1}function m(w){const x=w.uniforms;let S=0;const I=16;for(let A=0,B=x.length;A<B;A++){const N=Array.isArray(x[A])?x[A]:[x[A]];for(let k=0,L=N.length;k<L;k++){const j=N[k],P=Array.isArray(j.value)?j.value:[j.value];for(let W=0,X=P.length;W<X;W++){const Q=P[W],re=f(Q),Me=S%I,oe=Me%re.boundary,Oe=Me+oe;S+=oe,Oe!==0&&I-Oe<re.storage&&(S+=I-Oe),j.__data=new Float32Array(re.storage/Float32Array.BYTES_PER_ELEMENT),j.__offset=S,S+=re.storage}}}const b=S%I;return b>0&&(S+=I-b),w.__size=S,w.__cache={},this}function f(w){const x={boundary:0,storage:0};return typeof w=="number"||typeof w=="boolean"?(x.boundary=4,x.storage=4):w.isVector2?(x.boundary=8,x.storage=8):w.isVector3||w.isColor?(x.boundary=16,x.storage=12):w.isVector4?(x.boundary=16,x.storage=16):w.isMatrix3?(x.boundary=48,x.storage=48):w.isMatrix4?(x.boundary=64,x.storage=64):w.isTexture?st("WebGLRenderer: Texture samplers can not be part of an uniforms group."):ArrayBuffer.isView(w)?(x.boundary=16,x.storage=w.byteLength):st("WebGLRenderer: Unsupported uniform value type.",w),x}function _(w){const x=w.target;x.removeEventListener("dispose",_);const S=a.indexOf(x.__bindingPointIndex);a.splice(S,1),n.deleteBuffer(i[x.id]),delete i[x.id],delete r[x.id]}function O(){for(const w in i)n.deleteBuffer(i[w]);a=[],i={},r={}}return{bind:l,update:c,dispose:O}}const lx=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 yn=null;function cx(){return yn===null&&(yn=new qm(lx,16,16,er,ti),yn.name="DFG_LUT",yn.minFilter=Ds,yn.magFilter=Ds,yn.wrapS=Yn,yn.wrapT=Yn,yn.generateMipmaps=!1,yn.needsUpdate=!0),yn}class dx{constructor(e={}){const{canvas:t=vz(),context:s=null,depth:i=!0,stencil:r=!1,alpha:a=!1,antialias:o=!1,premultipliedAlpha:l=!0,preserveDrawingBuffer:c=!1,powerPreference:d="default",failIfMajorPerformanceCaveat:u=!1,reversedDepthBuffer:h=!1,outputBufferType:g=Zs}=e;this.isWebGLRenderer=!0;let p;if(s!==null){if(typeof WebGLRenderingContext<"u"&&s instanceof WebGLRenderingContext)throw new Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");p=s.getContextAttributes().alpha}else p=a;const z=g,m=new Set([_u,zu,bu]),f=new Set([Zs,Gn,La,Wa,mu,gu]),_=new Uint32Array(4),O=new Int32Array(4),w=new F;let x=null,S=null;const I=[],b=[];let A=null;this.domElement=t,this.debug={checkShaderErrors:!0,onShaderError:null},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.toneMapping=Dn,this.toneMappingExposure=1,this.transmissionResolutionScale=1;const B=this;let N=!1,k=null,L=null,j=null,P=null;this._outputColorSpace=sn;let W=0,X=0,Q=null,re=-1,Me=null;const oe=new ts,Oe=new ts;let Ke=null;const nt=new Ye(0);let je=0,ce=t.width,ue=t.height,fe=1,et=null,ct=null;const Qe=new ts(0,0,ce,ue),Zt=new ts(0,0,ce,ue);let gt=!1;const Rt=new Eu;let it=!1,wt=!1;const ns=new Gt,Ut=new F,rs=new ts,as={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};let Qt=!1;function es(){return Q===null?fe:1}let q=s;function Os(E,Y){return t.getContext(E,Y)}try{const E={alpha:!0,depth:i,stencil:r,antialias:o,premultipliedAlpha:l,preserveDrawingBuffer:c,powerPreference:d,failIfMajorPerformanceCaveat:u};if("setAttribute"in t&&t.setAttribute("data-engine",`three.js r${fu}`),t.addEventListener("webglcontextlost",Vt,!1),t.addEventListener("webglcontextrestored",Nt,!1),t.addEventListener("webglcontextcreationerror",js,!1),q===null){const Y="webgl2";if(q=Os(Y,E),q===null)throw Os(Y)?new Error("THREE.WebGLRenderer: Error creating WebGL context with your selected attributes."):new Error("THREE.WebGLRenderer: Error creating WebGL context.")}}catch(E){throw Ot("WebGLRenderer: "+E.message),E}let Bt,R,y,K,se,ae,ye,Ae,le,he,xe,Ve,De,Ie,qe,Je,dt,V,Ee,de,Te,Ne,pe;function Pe(){Bt=new cv(q),Bt.init(),Te=new ex(q,Bt),R=new tv(q,Bt,e,Te),y=new QO(q,Bt),R.reversedDepthBuffer&&h&&y.buffers.depth.setReversed(!0),L=q.createFramebuffer(),j=q.createFramebuffer(),P=q.createFramebuffer(),K=new hv(q),se=new LO,ae=new JO(q,Bt,y,se,R,Te,K),ye=new lv(B),Ae=new g_(q),Ne=new Jy(q,Ae),le=new dv(q,Ae,K,Ne),he=new pv(q,le,Ae,Ne,K),V=new fv(q,R,ae),qe=new sv(se),xe=new PO(B,ye,Bt,R,Ne,qe),Ve=new ax(B,se),De=new kO,Ie=new HO(Bt),dt=new Qy(B,ye,y,he,p,l),Je=new ZO(B,he,R),pe=new ox(q,K,R,y),Ee=new ev(q,Bt,K),de=new uv(q,Bt,K),K.programs=xe.programs,B.capabilities=R,B.extensions=Bt,B.properties=se,B.renderLists=De,B.shadowMap=Je,B.state=y,B.info=K}Pe(),z!==Zs&&(A=new gv(z,t.width,t.height,o,i,r));const Ue=new ix(B,q);this.xr=Ue,this.getContext=function(){return q},this.getContextAttributes=function(){return q.getContextAttributes()},this.forceContextLoss=function(){const E=Bt.get("WEBGL_lose_context");E&&E.loseContext()},this.forceContextRestore=function(){const E=Bt.get("WEBGL_lose_context");E&&E.restoreContext()},this.getPixelRatio=function(){return fe},this.setPixelRatio=function(E){E!==void 0&&(fe=E,this.setSize(ce,ue,!1))},this.getSize=function(E){return E.set(ce,ue)},this.setSize=function(E,Y,te=!0){if(Ue.isPresenting){st("WebGLRenderer: Can't change size while VR device is presenting.");return}ce=E,ue=Y,t.width=Math.floor(E*fe),t.height=Math.floor(Y*fe),te===!0&&(t.style.width=E+"px",t.style.height=Y+"px"),A!==null&&A.setSize(t.width,t.height),this.setViewport(0,0,E,Y)},this.getDrawingBufferSize=function(E){return E.set(ce*fe,ue*fe).floor()},this.setDrawingBufferSize=function(E,Y,te){ce=E,ue=Y,fe=te,t.width=Math.floor(E*te),t.height=Math.floor(Y*te),this.setViewport(0,0,E,Y)},this.setEffects=function(E){if(z===Zs){Ot("WebGLRenderer: setEffects() requires outputBufferType set to HalfFloatType or FloatType.");return}if(E){for(let Y=0;Y<E.length;Y++)if(E[Y].isOutputPass===!0){st("WebGLRenderer: OutputPass is not needed in setEffects(). Tone mapping and color space conversion are applied automatically.");break}}A.setEffects(E||[])},this.getCurrentViewport=function(E){return E.copy(oe)},this.getViewport=function(E){return E.copy(Qe)},this.setViewport=function(E,Y,te,J){E.isVector4?Qe.set(E.x,E.y,E.z,E.w):Qe.set(E,Y,te,J),y.viewport(oe.copy(Qe).multiplyScalar(fe).round())},this.getScissor=function(E){return E.copy(Zt)},this.setScissor=function(E,Y,te,J){E.isVector4?Zt.set(E.x,E.y,E.z,E.w):Zt.set(E,Y,te,J),y.scissor(Oe.copy(Zt).multiplyScalar(fe).round())},this.getScissorTest=function(){return gt},this.setScissorTest=function(E){y.setScissorTest(gt=E)},this.setOpaqueSort=function(E){et=E},this.setTransparentSort=function(E){ct=E},this.getClearColor=function(E){return E.copy(dt.getClearColor())},this.setClearColor=function(){dt.setClearColor(...arguments)},this.getClearAlpha=function(){return dt.getClearAlpha()},this.setClearAlpha=function(){dt.setClearAlpha(...arguments)},this.clear=function(E=!0,Y=!0,te=!0){let J=0;if(E){let ee=!1;if(Q!==null){const Ge=Q.texture.format;ee=m.has(Ge)}if(ee){const Ge=Q.texture.type,me=f.has(Ge),Re=dt.getClearColor(),Fe=dt.getClearAlpha(),We=Re.r,tt=Re.g,ft=Re.b;me?(_[0]=We,_[1]=tt,_[2]=ft,_[3]=Fe,q.clearBufferuiv(q.COLOR,0,_)):(O[0]=We,O[1]=tt,O[2]=ft,O[3]=Fe,q.clearBufferiv(q.COLOR,0,O))}else J|=q.COLOR_BUFFER_BIT}Y&&(J|=q.DEPTH_BUFFER_BIT,this.state.buffers.depth.setMask(!0)),te&&(J|=q.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),J!==0&&q.clear(J)},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(E){E.setRenderer(this),k=E},this.dispose=function(){t.removeEventListener("webglcontextlost",Vt,!1),t.removeEventListener("webglcontextrestored",Nt,!1),t.removeEventListener("webglcontextcreationerror",js,!1),dt.dispose(),De.dispose(),Ie.dispose(),se.dispose(),ye.dispose(),he.dispose(),Ne.dispose(),pe.dispose(),xe.dispose(),Ue.dispose(),Ue.removeEventListener("sessionstart",$s),Ue.removeEventListener("sessionend",na),xs.stop()};function Vt(E){E.preventDefault(),fl("WebGLRenderer: Context Lost."),N=!0}function Nt(){fl("WebGLRenderer: Context Restored."),N=!1;const E=K.autoReset,Y=Je.enabled,te=Je.autoUpdate,J=Je.needsUpdate,ee=Je.type;Pe(),K.autoReset=E,Je.enabled=Y,Je.autoUpdate=te,Je.needsUpdate=J,Je.type=ee}function js(E){Ot("WebGLRenderer: A WebGL context could not be created. Reason: ",E.statusMessage)}function Ls(E){const Y=E.target;Y.removeEventListener("dispose",Ls),ta(Y)}function ta(E){sa(E),se.remove(E)}function sa(E){const Y=se.get(E).programs;Y!==void 0&&(Y.forEach(function(te){xe.releaseProgram(te)}),E.isShaderMaterial&&xe.releaseShaderCache(E))}this.renderBufferDirect=function(E,Y,te,J,ee,Ge){Y===null&&(Y=as);const me=ee.isMesh&&ee.matrixWorld.determinantAffine()<0,Re=ln(E,Y,te,J,ee);y.setMaterial(J,me);let Fe=te.index,We=1;if(J.wireframe===!0){if(Fe=le.getWireframeAttribute(te),Fe===void 0)return;We=2}const tt=te.drawRange,ft=te.attributes.position;let Xe=tt.start*We,Ct=(tt.start+tt.count)*We;Ge!==null&&(Xe=Math.max(Xe,Ge.start*We),Ct=Math.min(Ct,(Ge.start+Ge.count)*We)),Fe!==null?(Xe=Math.max(Xe,0),Ct=Math.min(Ct,Fe.count)):ft!=null&&(Xe=Math.max(Xe,0),Ct=Math.min(Ct,ft.count));const Ht=Ct-Xe;if(Ht<0||Ht===1/0)return;Ne.setup(ee,J,Re,te,Fe);let Jt,Tt=Ee;if(Fe!==null&&(Jt=Ae.get(Fe),Tt=de,Tt.setIndex(Jt)),ee.isMesh)J.wireframe===!0?(y.setLineWidth(J.wireframeLinewidth*es()),Tt.setMode(q.LINES)):Tt.setMode(q.TRIANGLES);else if(ee.isLine){let us=J.linewidth;us===void 0&&(us=1),y.setLineWidth(us*es()),ee.isLineSegments?Tt.setMode(q.LINES):ee.isLineLoop?Tt.setMode(q.LINE_LOOP):Tt.setMode(q.LINE_STRIP)}else ee.isPoints?Tt.setMode(q.POINTS):ee.isSprite&&Tt.setMode(q.TRIANGLES);if(ee.isBatchedMesh)if(Bt.get("WEBGL_multi_draw"))Tt.renderMultiDraw(ee._multiDrawStarts,ee._multiDrawCounts,ee._multiDrawCount);else{const us=ee._multiDrawStarts,Le=ee._multiDrawCounts,qt=ee._multiDrawCount,pt=Fe?Ae.get(Fe).bytesPerElement:1,zs=se.get(J).currentProgram.getUniforms();for(let _s=0;_s<qt;_s++)zs.setValue(q,"_gl_DrawID",_s),Tt.render(us[_s]/pt,Le[_s])}else if(ee.isInstancedMesh)Tt.renderInstances(Xe,Ht,ee.count);else if(te.isInstancedBufferGeometry){const us=te._maxInstanceCount!==void 0?te._maxInstanceCount:1/0,Le=Math.min(te.instanceCount,us);Tt.renderInstances(Xe,Ht,Le)}else Tt.render(Xe,Ht)};function ii(E,Y,te){E.transparent===!0&&E.side===Hn&&E.forceSinglePass===!1?(E.side=ks,E.needsUpdate=!0,zn(E,Y,te),E.side=Ei,E.needsUpdate=!0,zn(E,Y,te),E.side=Hn):zn(E,Y,te)}this.compile=function(E,Y,te=null){te===null&&(te=E),S=Ie.get(te),S.init(Y),b.push(S),te.traverseVisible(function(ee){ee.isLight&&ee.layers.test(Y.layers)&&(S.pushLight(ee),ee.castShadow&&S.pushShadow(ee))}),E!==te&&E.traverseVisible(function(ee){ee.isLight&&ee.layers.test(Y.layers)&&(S.pushLight(ee),ee.castShadow&&S.pushShadow(ee))}),S.setupLights();const J=new Set;return E.traverse(function(ee){if(!(ee.isMesh||ee.isPoints||ee.isLine||ee.isSprite))return;const Ge=ee.material;if(Ge)if(Array.isArray(Ge))for(let me=0;me<Ge.length;me++){const Re=Ge[me];ii(Re,te,ee),J.add(Re)}else ii(Ge,te,ee),J.add(Ge)}),S=b.pop(),J},this.compileAsync=function(E,Y,te=null){const J=this.compile(E,Y,te);return new Promise(ee=>{function Ge(){if(J.forEach(function(me){se.get(me).currentProgram.isReady()&&J.delete(me)}),J.size===0){ee(E);return}setTimeout(Ge,10)}Bt.get("KHR_parallel_shader_compile")!==null?Ge():setTimeout(Ge,10)})};let ri=null;function Nl(E){ri&&ri(E)}function $s(){xs.stop()}function na(){xs.start()}const xs=new tg;xs.setAnimationLoop(Nl),typeof self<"u"&&xs.setContext(self),this.setAnimationLoop=function(E){ri=E,Ue.setAnimationLoop(E),E===null?xs.stop():xs.start()},Ue.addEventListener("sessionstart",$s),Ue.addEventListener("sessionend",na),this.render=function(E,Y){if(Y!==void 0&&Y.isCamera!==!0){Ot("WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(N===!0)return;k!==null&&k.renderStart(E,Y);const te=Ue.enabled===!0&&Ue.isPresenting===!0,J=A!==null&&(Q===null||te)&&A.begin(B,Q);if(E.matrixWorldAutoUpdate===!0&&E.updateMatrixWorld(),Y.parent===null&&Y.matrixWorldAutoUpdate===!0&&Y.updateMatrixWorld(),Ue.enabled===!0&&Ue.isPresenting===!0&&(A===null||A.isCompositing()===!1)&&(Ue.cameraAutoUpdate===!0&&Ue.updateCamera(Y),Y=Ue.getCamera()),E.isScene===!0&&E.onBeforeRender(B,E,Y,Q),S=Ie.get(E,b.length),S.init(Y),S.state.textureUnits=ae.getTextureUnits(),b.push(S),ns.multiplyMatrices(Y.projectionMatrix,Y.matrixWorldInverse),Rt.setFromProjectionMatrix(ns,An,Y.reversedDepth),wt=this.localClippingEnabled,it=qe.init(this.clippingPlanes,wt),x=De.get(E,I.length),x.init(),I.push(x),Ue.enabled===!0&&Ue.isPresenting===!0){const me=B.xr.getDepthSensingMesh();me!==null&&ia(me,Y,-1/0,B.sortObjects)}ia(E,Y,0,B.sortObjects),x.finish(),B.sortObjects===!0&&x.sort(et,ct,Y.reversedDepth),Qt=Ue.enabled===!1||Ue.isPresenting===!1||Ue.hasDepthSensing()===!1,Qt&&dt.addToRenderList(x,E),this.info.render.frame++,this.info.autoReset===!0&&this.info.reset(),it===!0&&qe.beginShadows();const ee=S.state.shadowsArray;if(Je.render(ee,E,Y),it===!0&&qe.endShadows(),(J&&A.hasRenderPass())===!1){const me=x.opaque,Re=x.transmissive;if(S.setupLights(),Y.isArrayCamera){const Fe=Y.cameras;if(Re.length>0)for(let We=0,tt=Fe.length;We<tt;We++){const ft=Fe[We];lr(me,Re,E,ft)}Qt&&dt.render(E);for(let We=0,tt=Fe.length;We<tt;We++){const ft=Fe[We];Ii(x,E,ft,ft.viewport)}}else Re.length>0&&lr(me,Re,E,Y),Qt&&dt.render(E),Ii(x,E,Y)}Q!==null&&X===0&&(ae.updateMultisampleRenderTarget(Q),ae.updateRenderTargetMipmap(Q)),J&&A.end(B),E.isScene===!0&&E.onAfterRender(B,E,Y),Ne.resetDefaultState(),re=-1,Me=null,b.pop(),b.length>0?(S=b[b.length-1],ae.setTextureUnits(S.state.textureUnits),it===!0&&qe.setGlobalState(B.clippingPlanes,S.state.camera)):S=null,I.pop(),I.length>0?x=I[I.length-1]:x=null,k!==null&&k.renderEnd()};function ia(E,Y,te,J){if(E.visible===!1)return;if(E.layers.test(Y.layers)){if(E.isGroup)te=E.renderOrder;else if(E.isLOD)E.autoUpdate===!0&&E.update(Y);else if(E.isLightProbeGrid)S.pushLightProbeGrid(E);else if(E.isLight)S.pushLight(E),E.castShadow&&S.pushShadow(E);else if(E.isSprite){if(!E.frustumCulled||Rt.intersectsSprite(E)){J&&rs.setFromMatrixPosition(E.matrixWorld).applyMatrix4(ns);const me=he.update(E),Re=E.material;Re.visible&&x.push(E,me,Re,te,rs.z,null)}}else if((E.isMesh||E.isLine||E.isPoints)&&(!E.frustumCulled||Rt.intersectsObject(E))){const me=he.update(E),Re=E.material;if(J&&(E.boundingSphere!==void 0?(E.boundingSphere===null&&E.computeBoundingSphere(),rs.copy(E.boundingSphere.center)):(me.boundingSphere===null&&me.computeBoundingSphere(),rs.copy(me.boundingSphere.center)),rs.applyMatrix4(E.matrixWorld).applyMatrix4(ns)),Array.isArray(Re)){const Fe=me.groups;for(let We=0,tt=Fe.length;We<tt;We++){const ft=Fe[We],Xe=Re[ft.materialIndex];Xe&&Xe.visible&&x.push(E,me,Xe,te,rs.z,ft)}}else Re.visible&&x.push(E,me,Re,te,rs.z,null)}}const Ge=E.children;for(let me=0,Re=Ge.length;me<Re;me++)ia(Ge[me],Y,te,J)}function Ii(E,Y,te,J){const{opaque:ee,transmissive:Ge,transparent:me}=E;S.setupLightsView(te),it===!0&&qe.setGlobalState(B.clippingPlanes,te),J&&y.viewport(oe.copy(J)),ee.length>0&&ai(ee,Y,te),Ge.length>0&&ai(Ge,Y,te),me.length>0&&ai(me,Y,te),y.buffers.depth.setTest(!0),y.buffers.depth.setMask(!0),y.buffers.color.setMask(!0),y.setPolygonOffset(!1)}function lr(E,Y,te,J){if((te.isScene===!0?te.overrideMaterial:null)!==null)return;if(S.state.transmissionRenderTarget[J.id]===void 0){const Xe=Bt.has("EXT_color_buffer_half_float")||Bt.has("EXT_color_buffer_float");S.state.transmissionRenderTarget[J.id]=new In(1,1,{generateMipmaps:!0,type:Xe?ti:Zs,minFilter:Fi,samples:Math.max(4,R.samples),stencilBuffer:r,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:xt.workingColorSpace})}const Ge=S.state.transmissionRenderTarget[J.id],me=J.viewport||oe;Ge.setSize(me.z*B.transmissionResolutionScale,me.w*B.transmissionResolutionScale);const Re=B.getRenderTarget(),Fe=B.getActiveCubeFace(),We=B.getActiveMipmapLevel();B.setRenderTarget(Ge),B.getClearColor(nt),je=B.getClearAlpha(),je<1&&B.setClearColor(16777215,.5),B.clear(),Qt&&dt.render(te);const tt=B.toneMapping;B.toneMapping=Dn;const ft=J.viewport;if(J.viewport!==void 0&&(J.viewport=void 0),S.setupLightsView(J),it===!0&&qe.setGlobalState(B.clippingPlanes,J),ai(E,te,J),ae.updateMultisampleRenderTarget(Ge),ae.updateRenderTargetMipmap(Ge),Bt.has("WEBGL_multisampled_render_to_texture")===!1){let Xe=!1;for(let Ct=0,Ht=Y.length;Ct<Ht;Ct++){const Jt=Y[Ct],{object:Tt,geometry:us,material:Le,group:qt}=Jt;if(Le.side===Hn&&Tt.layers.test(J.layers)){const pt=Le.side;Le.side=ks,Le.needsUpdate=!0,oi(Tt,te,J,us,Le,qt),Le.side=pt,Le.needsUpdate=!0,Xe=!0}}Xe===!0&&(ae.updateMultisampleRenderTarget(Ge),ae.updateRenderTargetMipmap(Ge))}B.setRenderTarget(Re,Fe,We),B.setClearColor(nt,je),ft!==void 0&&(J.viewport=ft),B.toneMapping=tt}function ai(E,Y,te){const J=Y.isScene===!0?Y.overrideMaterial:null;for(let ee=0,Ge=E.length;ee<Ge;ee++){const me=E[ee],{object:Re,geometry:Fe,group:We}=me;let tt=me.material;tt.allowOverride===!0&&J!==null&&(tt=J),Re.layers.test(te.layers)&&oi(Re,Y,te,Fe,tt,We)}}function oi(E,Y,te,J,ee,Ge){E.onBeforeRender(B,Y,te,J,ee,Ge),E.modelViewMatrix.multiplyMatrices(te.matrixWorldInverse,E.matrixWorld),E.normalMatrix.getNormalMatrix(E.modelViewMatrix),ee.onBeforeRender(B,Y,te,J,E,Ge),ee.transparent===!0&&ee.side===Hn&&ee.forceSinglePass===!1?(ee.side=ks,ee.needsUpdate=!0,B.renderBufferDirect(te,Y,J,ee,E,Ge),ee.side=Ei,ee.needsUpdate=!0,B.renderBufferDirect(te,Y,J,ee,E,Ge),ee.side=Hn):B.renderBufferDirect(te,Y,J,ee,E,Ge),E.onAfterRender(B,Y,te,J,ee,Ge)}function zn(E,Y,te){Y.isScene!==!0&&(Y=as);const J=se.get(E),ee=S.state.lights,Ge=S.state.shadowsArray,me=ee.state.version,Re=xe.getParameters(E,ee.state,Ge,Y,te,S.state.lightProbeGridArray),Fe=xe.getProgramCacheKey(Re);let We=J.programs;J.environment=E.isMeshStandardMaterial||E.isMeshLambertMaterial||E.isMeshPhongMaterial?Y.environment:null,J.fog=Y.fog;const tt=E.isMeshStandardMaterial||E.isMeshLambertMaterial&&!E.envMap||E.isMeshPhongMaterial&&!E.envMap;J.envMap=ye.get(E.envMap||J.environment,tt),J.envMapRotation=J.environment!==null&&E.envMap===null?Y.environmentRotation:E.envMapRotation,We===void 0&&(E.addEventListener("dispose",Ls),We=new Map,J.programs=We);let ft=We.get(Fe);if(ft!==void 0){if(J.currentProgram===ft&&J.lightsStateVersion===me)return _n(E,Re),ft}else Re.uniforms=xe.getUniforms(E),k!==null&&E.isNodeMaterial&&k.build(E,te,Re),E.onBeforeCompile(Re,B),ft=xe.acquireProgram(Re,Fe),We.set(Fe,ft),J.uniforms=Re.uniforms;const Xe=J.uniforms;return(!E.isShaderMaterial&&!E.isRawShaderMaterial||E.clipping===!0)&&(Xe.clippingPlanes=qe.uniform),_n(E,Re),J.needsLights=$a(E),J.lightsStateVersion=me,J.needsLights&&(Xe.ambientLightColor.value=ee.state.ambient,Xe.lightProbe.value=ee.state.probe,Xe.directionalLights.value=ee.state.directional,Xe.directionalLightShadows.value=ee.state.directionalShadow,Xe.spotLights.value=ee.state.spot,Xe.spotLightShadows.value=ee.state.spotShadow,Xe.rectAreaLights.value=ee.state.rectArea,Xe.ltc_1.value=ee.state.rectAreaLTC1,Xe.ltc_2.value=ee.state.rectAreaLTC2,Xe.pointLights.value=ee.state.point,Xe.pointLightShadows.value=ee.state.pointShadow,Xe.hemisphereLights.value=ee.state.hemi,Xe.directionalShadowMatrix.value=ee.state.directionalShadowMatrix,Xe.spotLightMatrix.value=ee.state.spotLightMatrix,Xe.spotLightMap.value=ee.state.spotLightMap,Xe.pointShadowMatrix.value=ee.state.pointShadowMatrix),J.lightProbeGrid=S.state.lightProbeGridArray.length>0,J.currentProgram=ft,J.uniformsList=null,ft}function Qs(E){if(E.uniformsList===null){const Y=E.currentProgram.getUniforms();E.uniformsList=Fo.seqWithValue(Y.seq,E.uniforms)}return E.uniformsList}function _n(E,Y){const te=se.get(E);te.outputColorSpace=Y.outputColorSpace,te.batching=Y.batching,te.batchingColor=Y.batchingColor,te.instancing=Y.instancing,te.instancingColor=Y.instancingColor,te.instancingMorph=Y.instancingMorph,te.skinning=Y.skinning,te.morphTargets=Y.morphTargets,te.morphNormals=Y.morphNormals,te.morphColors=Y.morphColors,te.morphTargetsCount=Y.morphTargetsCount,te.numClippingPlanes=Y.numClippingPlanes,te.numIntersection=Y.numClipIntersection,te.vertexAlphas=Y.vertexAlphas,te.vertexTangents=Y.vertexTangents,te.toneMapping=Y.toneMapping}function ze(E,Y){if(E.length===0)return null;if(E.length===1)return E[0].texture!==null?E[0]:null;w.setFromMatrixPosition(Y.matrixWorld);for(let te=0,J=E.length;te<J;te++){const ee=E[te];if(ee.texture!==null&&ee.boundingBox.containsPoint(w))return ee}return null}function ln(E,Y,te,J,ee){Y.isScene!==!0&&(Y=as),ae.resetTextureUnits();const Ge=Y.fog,me=J.isMeshStandardMaterial||J.isMeshLambertMaterial||J.isMeshPhongMaterial?Y.environment:null,Re=Q===null?B.outputColorSpace:Q.isXRRenderTarget===!0?Q.texture.colorSpace:xt.workingColorSpace,Fe=J.isMeshStandardMaterial||J.isMeshLambertMaterial&&!J.envMap||J.isMeshPhongMaterial&&!J.envMap,We=ye.get(J.envMap||me,Fe),tt=J.vertexColors===!0&&!!te.attributes.color&&te.attributes.color.itemSize===4,ft=!!te.attributes.tangent&&(!!J.normalMap||J.anisotropy>0),Xe=!!te.morphAttributes.position,Ct=!!te.morphAttributes.normal,Ht=!!te.morphAttributes.color;let Jt=Dn;J.toneMapped&&(Q===null||Q.isXRRenderTarget===!0)&&(Jt=B.toneMapping);const Tt=te.morphAttributes.position||te.morphAttributes.normal||te.morphAttributes.color,us=Tt!==void 0?Tt.length:0,Le=se.get(J),qt=S.state.lights;if(it===!0&&(wt===!0||E!==Me)){const Et=E===Me&&J.id===re;qe.setState(J,E,Et)}let pt=!1;J.version===Le.__version?(Le.needsLights&&Le.lightsStateVersion!==qt.state.version||Le.outputColorSpace!==Re||ee.isBatchedMesh&&Le.batching===!1||!ee.isBatchedMesh&&Le.batching===!0||ee.isBatchedMesh&&Le.batchingColor===!0&&ee.colorTexture===null||ee.isBatchedMesh&&Le.batchingColor===!1&&ee.colorTexture!==null||ee.isInstancedMesh&&Le.instancing===!1||!ee.isInstancedMesh&&Le.instancing===!0||ee.isSkinnedMesh&&Le.skinning===!1||!ee.isSkinnedMesh&&Le.skinning===!0||ee.isInstancedMesh&&Le.instancingColor===!0&&ee.instanceColor===null||ee.isInstancedMesh&&Le.instancingColor===!1&&ee.instanceColor!==null||ee.isInstancedMesh&&Le.instancingMorph===!0&&ee.morphTexture===null||ee.isInstancedMesh&&Le.instancingMorph===!1&&ee.morphTexture!==null||Le.envMap!==We||J.fog===!0&&Le.fog!==Ge||Le.numClippingPlanes!==void 0&&(Le.numClippingPlanes!==qe.numPlanes||Le.numIntersection!==qe.numIntersection)||Le.vertexAlphas!==tt||Le.vertexTangents!==ft||Le.morphTargets!==Xe||Le.morphNormals!==Ct||Le.morphColors!==Ht||Le.toneMapping!==Jt||Le.morphTargetsCount!==us||!!Le.lightProbeGrid!=S.state.lightProbeGridArray.length>0)&&(pt=!0):(pt=!0,Le.__version=J.version);let zs=Le.currentProgram;pt===!0&&(zs=zn(J,Y,ee),k&&J.isNodeMaterial&&k.onUpdateProgram(J,zs,Le));let _s=!1,Vs=!1,Rn=!1;const Wt=zs.getUniforms(),Yt=Le.uniforms;if(y.useProgram(zs.program)&&(_s=!0,Vs=!0,Rn=!0),J.id!==re&&(re=J.id,Vs=!0),Le.needsLights){const Et=ze(S.state.lightProbeGridArray,ee);Le.lightProbeGrid!==Et&&(Le.lightProbeGrid=Et,Vs=!0)}if(_s||Me!==E){y.buffers.depth.getReversed()&&E.reversedDepth!==!0&&(E._reversedDepth=!0,E.updateProjectionMatrix()),Wt.setValue(q,"projectionMatrix",E.projectionMatrix),Wt.setValue(q,"viewMatrix",E.matrixWorldInverse);const cn=Wt.map.cameraPosition;cn!==void 0&&cn.setValue(q,Ut.setFromMatrixPosition(E.matrixWorld)),R.logarithmicDepthBuffer&&Wt.setValue(q,"logDepthBufFC",2/(Math.log(E.far+1)/Math.LN2)),(J.isMeshPhongMaterial||J.isMeshToonMaterial||J.isMeshLambertMaterial||J.isMeshBasicMaterial||J.isMeshStandardMaterial||J.isShaderMaterial)&&Wt.setValue(q,"isOrthographic",E.isOrthographicCamera===!0),Me!==E&&(Me=E,Vs=!0,Rn=!0)}if(Le.needsLights&&(qt.state.directionalShadowMap.length>0&&Wt.setValue(q,"directionalShadowMap",qt.state.directionalShadowMap,ae),qt.state.spotShadowMap.length>0&&Wt.setValue(q,"spotShadowMap",qt.state.spotShadowMap,ae),qt.state.pointShadowMap.length>0&&Wt.setValue(q,"pointShadowMap",qt.state.pointShadowMap,ae)),ee.isSkinnedMesh){Wt.setOptional(q,ee,"bindMatrix"),Wt.setOptional(q,ee,"bindMatrixInverse");const Et=ee.skeleton;Et&&(Et.boneTexture===null&&Et.computeBoneTexture(),Wt.setValue(q,"boneTexture",Et.boneTexture,ae))}ee.isBatchedMesh&&(Wt.setOptional(q,ee,"batchingTexture"),Wt.setValue(q,"batchingTexture",ee._matricesTexture,ae),Wt.setOptional(q,ee,"batchingIdTexture"),Wt.setValue(q,"batchingIdTexture",ee._indirectTexture,ae),Wt.setOptional(q,ee,"batchingColorTexture"),ee._colorsTexture!==null&&Wt.setValue(q,"batchingColorTexture",ee._colorsTexture,ae));const Ws=te.morphAttributes;if((Ws.position!==void 0||Ws.normal!==void 0||Ws.color!==void 0)&&V.update(ee,te,zs),(Vs||Le.receiveShadow!==ee.receiveShadow)&&(Le.receiveShadow=ee.receiveShadow,Wt.setValue(q,"receiveShadow",ee.receiveShadow)),(J.isMeshStandardMaterial||J.isMeshLambertMaterial||J.isMeshPhongMaterial)&&J.envMap===null&&Y.environment!==null&&(Yt.envMapIntensity.value=Y.environmentIntensity),Yt.dfgLUT!==void 0&&(Yt.dfgLUT.value=cx()),Vs){if(Wt.setValue(q,"toneMappingExposure",B.toneMappingExposure),Le.needsLights&&Cl(Yt,Rn),Ge&&J.fog===!0&&Ve.refreshFogUniforms(Yt,Ge),Ve.refreshMaterialUniforms(Yt,J,fe,ue,S.state.transmissionRenderTarget[E.id]),Le.needsLights&&Le.lightProbeGrid){const Et=Le.lightProbeGrid;Yt.probesSH.value=Et.texture,Yt.probesMin.value.copy(Et.boundingBox.min),Yt.probesMax.value.copy(Et.boundingBox.max),Yt.probesResolution.value.copy(Et.resolution)}Fo.upload(q,Qs(Le),Yt,ae)}if(J.isShaderMaterial&&J.uniformsNeedUpdate===!0&&(Fo.upload(q,Qs(Le),Yt,ae),J.uniformsNeedUpdate=!1),J.isSpriteMaterial&&Wt.setValue(q,"center",ee.center),Wt.setValue(q,"modelViewMatrix",ee.modelViewMatrix),Wt.setValue(q,"normalMatrix",ee.normalMatrix),Wt.setValue(q,"modelMatrix",ee.matrixWorld),J.uniformsGroups!==void 0){const Et=J.uniformsGroups;for(let cn=0,Ts=Et.length;cn<Ts;cn++){const ra=Et[cn];pe.update(ra,zs),pe.bind(ra,zs)}}return zs}function Cl(E,Y){E.ambientLightColor.needsUpdate=Y,E.lightProbe.needsUpdate=Y,E.directionalLights.needsUpdate=Y,E.directionalLightShadows.needsUpdate=Y,E.pointLights.needsUpdate=Y,E.pointLightShadows.needsUpdate=Y,E.spotLights.needsUpdate=Y,E.spotLightShadows.needsUpdate=Y,E.rectAreaLights.needsUpdate=Y,E.hemisphereLights.needsUpdate=Y}function $a(E){return E.isMeshLambertMaterial||E.isMeshToonMaterial||E.isMeshPhongMaterial||E.isMeshStandardMaterial||E.isShadowMaterial||E.isShaderMaterial&&E.lights===!0}this.getActiveCubeFace=function(){return W},this.getActiveMipmapLevel=function(){return X},this.getRenderTarget=function(){return Q},this.setRenderTargetTextures=function(E,Y,te){const J=se.get(E);J.__autoAllocateDepthBuffer=E.resolveDepthBuffer===!1,J.__autoAllocateDepthBuffer===!1&&(J.__useRenderToTexture=!1),se.get(E.texture).__webglTexture=Y,se.get(E.depthTexture).__webglTexture=J.__autoAllocateDepthBuffer?void 0:te,J.__hasExternalTextures=!0},this.setRenderTargetFramebuffer=function(E,Y){const te=se.get(E);te.__webglFramebuffer=Y,te.__useDefaultFramebuffer=Y===void 0},this.setRenderTarget=function(E,Y=0,te=0){Q=E,W=Y,X=te;let J=null,ee=!1,Ge=!1;if(E){const Re=se.get(E);if(Re.__useDefaultFramebuffer!==void 0){y.bindFramebuffer(q.FRAMEBUFFER,Re.__webglFramebuffer),oe.copy(E.viewport),Oe.copy(E.scissor),Ke=E.scissorTest,y.viewport(oe),y.scissor(Oe),y.setScissorTest(Ke),re=-1;return}else if(Re.__webglFramebuffer===void 0)ae.setupRenderTarget(E);else if(Re.__hasExternalTextures)ae.rebindTextures(E,se.get(E.texture).__webglTexture,se.get(E.depthTexture).__webglTexture);else if(E.depthBuffer){const tt=E.depthTexture;if(Re.__boundDepthTexture!==tt){if(tt!==null&&se.has(tt)&&(E.width!==tt.image.width||E.height!==tt.image.height))throw new Error("THREE.WebGLRenderer: Attached DepthTexture is initialized to the incorrect size.");ae.setupDepthRenderbuffer(E)}}const Fe=E.texture;(Fe.isData3DTexture||Fe.isDataArrayTexture||Fe.isCompressedArrayTexture)&&(Ge=!0);const We=se.get(E).__webglFramebuffer;E.isWebGLCubeRenderTarget?(Array.isArray(We[Y])?J=We[Y][te]:J=We[Y],ee=!0):E.samples>0&&ae.useMultisampledRTT(E)===!1?J=se.get(E).__webglMultisampledFramebuffer:Array.isArray(We)?J=We[te]:J=We,oe.copy(E.viewport),Oe.copy(E.scissor),Ke=E.scissorTest}else oe.copy(Qe).multiplyScalar(fe).floor(),Oe.copy(Zt).multiplyScalar(fe).floor(),Ke=gt;if(te!==0&&(J=L),y.bindFramebuffer(q.FRAMEBUFFER,J)&&y.drawBuffers(E,J),y.viewport(oe),y.scissor(Oe),y.setScissorTest(Ke),ee){const Re=se.get(E.texture);q.framebufferTexture2D(q.FRAMEBUFFER,q.COLOR_ATTACHMENT0,q.TEXTURE_CUBE_MAP_POSITIVE_X+Y,Re.__webglTexture,te)}else if(Ge){const Re=Y;for(let Fe=0;Fe<E.textures.length;Fe++){const We=se.get(E.textures[Fe]);q.framebufferTextureLayer(q.FRAMEBUFFER,q.COLOR_ATTACHMENT0+Fe,We.__webglTexture,te,Re)}}else if(E!==null&&te!==0){const Re=se.get(E.texture);q.framebufferTexture2D(q.FRAMEBUFFER,q.COLOR_ATTACHMENT0,q.TEXTURE_2D,Re.__webglTexture,te)}re=-1},this.readRenderTargetPixels=function(E,Y,te,J,ee,Ge,me,Re=0){if(!(E&&E.isWebGLRenderTarget)){Ot("WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let Fe=se.get(E).__webglFramebuffer;if(E.isWebGLCubeRenderTarget&&me!==void 0&&(Fe=Fe[me]),Fe){y.bindFramebuffer(q.FRAMEBUFFER,Fe);try{const We=E.textures[Re],tt=We.format,ft=We.type;if(E.textures.length>1&&q.readBuffer(q.COLOR_ATTACHMENT0+Re),!R.textureFormatReadable(tt)){Ot("WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}if(!R.textureTypeReadable(ft)){Ot("WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}Y>=0&&Y<=E.width-J&&te>=0&&te<=E.height-ee&&q.readPixels(Y,te,J,ee,Te.convert(tt),Te.convert(ft),Ge)}finally{const We=Q!==null?se.get(Q).__webglFramebuffer:null;y.bindFramebuffer(q.FRAMEBUFFER,We)}}},this.readRenderTargetPixelsAsync=async function(E,Y,te,J,ee,Ge,me,Re=0){if(!(E&&E.isWebGLRenderTarget))throw new Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let Fe=se.get(E).__webglFramebuffer;if(E.isWebGLCubeRenderTarget&&me!==void 0&&(Fe=Fe[me]),Fe)if(Y>=0&&Y<=E.width-J&&te>=0&&te<=E.height-ee){y.bindFramebuffer(q.FRAMEBUFFER,Fe);const We=E.textures[Re],tt=We.format,ft=We.type;if(E.textures.length>1&&q.readBuffer(q.COLOR_ATTACHMENT0+Re),!R.textureFormatReadable(tt))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(!R.textureTypeReadable(ft))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");const Xe=q.createBuffer();q.bindBuffer(q.PIXEL_PACK_BUFFER,Xe),q.bufferData(q.PIXEL_PACK_BUFFER,Ge.byteLength,q.STREAM_READ),q.readPixels(Y,te,J,ee,Te.convert(tt),Te.convert(ft),0);const Ct=Q!==null?se.get(Q).__webglFramebuffer:null;y.bindFramebuffer(q.FRAMEBUFFER,Ct);const Ht=q.fenceSync(q.SYNC_GPU_COMMANDS_COMPLETE,0);return q.flush(),await Oz(q,Ht,4),q.bindBuffer(q.PIXEL_PACK_BUFFER,Xe),q.getBufferSubData(q.PIXEL_PACK_BUFFER,0,Ge),q.deleteBuffer(Xe),q.deleteSync(Ht),Ge}else throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.")},this.copyFramebufferToTexture=function(E,Y=null,te=0){const J=Math.pow(2,-te),ee=Math.floor(E.image.width*J),Ge=Math.floor(E.image.height*J),me=Y!==null?Y.x:0,Re=Y!==null?Y.y:0;ae.setTexture2D(E,0),q.copyTexSubImage2D(q.TEXTURE_2D,te,0,0,me,Re,ee,Ge),y.unbindTexture()},this.copyTextureToTexture=function(E,Y,te=null,J=null,ee=0,Ge=0){let me,Re,Fe,We,tt,ft,Xe,Ct,Ht;const Jt=E.isCompressedTexture?E.mipmaps[Ge]:E.image;if(te!==null)me=te.max.x-te.min.x,Re=te.max.y-te.min.y,Fe=te.isBox3?te.max.z-te.min.z:1,We=te.min.x,tt=te.min.y,ft=te.isBox3?te.min.z:0;else{const Yt=Math.pow(2,-ee);me=Math.floor(Jt.width*Yt),Re=Math.floor(Jt.height*Yt),E.isDataArrayTexture?Fe=Jt.depth:E.isData3DTexture?Fe=Math.floor(Jt.depth*Yt):Fe=1,We=0,tt=0,ft=0}J!==null?(Xe=J.x,Ct=J.y,Ht=J.z):(Xe=0,Ct=0,Ht=0);const Tt=Te.convert(Y.format),us=Te.convert(Y.type);let Le;Y.isData3DTexture?(ae.setTexture3D(Y,0),Le=q.TEXTURE_3D):Y.isDataArrayTexture||Y.isCompressedArrayTexture?(ae.setTexture2DArray(Y,0),Le=q.TEXTURE_2D_ARRAY):(ae.setTexture2D(Y,0),Le=q.TEXTURE_2D),y.activeTexture(q.TEXTURE0),y.pixelStorei(q.UNPACK_FLIP_Y_WEBGL,Y.flipY),y.pixelStorei(q.UNPACK_PREMULTIPLY_ALPHA_WEBGL,Y.premultiplyAlpha),y.pixelStorei(q.UNPACK_ALIGNMENT,Y.unpackAlignment);const qt=y.getParameter(q.UNPACK_ROW_LENGTH),pt=y.getParameter(q.UNPACK_IMAGE_HEIGHT),zs=y.getParameter(q.UNPACK_SKIP_PIXELS),_s=y.getParameter(q.UNPACK_SKIP_ROWS),Vs=y.getParameter(q.UNPACK_SKIP_IMAGES);y.pixelStorei(q.UNPACK_ROW_LENGTH,Jt.width),y.pixelStorei(q.UNPACK_IMAGE_HEIGHT,Jt.height),y.pixelStorei(q.UNPACK_SKIP_PIXELS,We),y.pixelStorei(q.UNPACK_SKIP_ROWS,tt),y.pixelStorei(q.UNPACK_SKIP_IMAGES,ft);const Rn=E.isDataArrayTexture||E.isData3DTexture,Wt=Y.isDataArrayTexture||Y.isData3DTexture;if(E.isDepthTexture){const Yt=se.get(E),Ws=se.get(Y),Et=se.get(Yt.__renderTarget),cn=se.get(Ws.__renderTarget);y.bindFramebuffer(q.READ_FRAMEBUFFER,Et.__webglFramebuffer),y.bindFramebuffer(q.DRAW_FRAMEBUFFER,cn.__webglFramebuffer);for(let Ts=0;Ts<Fe;Ts++)Rn&&(q.framebufferTextureLayer(q.READ_FRAMEBUFFER,q.COLOR_ATTACHMENT0,se.get(E).__webglTexture,ee,ft+Ts),q.framebufferTextureLayer(q.DRAW_FRAMEBUFFER,q.COLOR_ATTACHMENT0,se.get(Y).__webglTexture,Ge,Ht+Ts)),q.blitFramebuffer(We,tt,me,Re,Xe,Ct,me,Re,q.DEPTH_BUFFER_BIT,q.NEAREST);y.bindFramebuffer(q.READ_FRAMEBUFFER,null),y.bindFramebuffer(q.DRAW_FRAMEBUFFER,null)}else if(ee!==0||E.isRenderTargetTexture||se.has(E)){const Yt=se.get(E),Ws=se.get(Y);y.bindFramebuffer(q.READ_FRAMEBUFFER,j),y.bindFramebuffer(q.DRAW_FRAMEBUFFER,P);for(let Et=0;Et<Fe;Et++)Rn?q.framebufferTextureLayer(q.READ_FRAMEBUFFER,q.COLOR_ATTACHMENT0,Yt.__webglTexture,ee,ft+Et):q.framebufferTexture2D(q.READ_FRAMEBUFFER,q.COLOR_ATTACHMENT0,q.TEXTURE_2D,Yt.__webglTexture,ee),Wt?q.framebufferTextureLayer(q.DRAW_FRAMEBUFFER,q.COLOR_ATTACHMENT0,Ws.__webglTexture,Ge,Ht+Et):q.framebufferTexture2D(q.DRAW_FRAMEBUFFER,q.COLOR_ATTACHMENT0,q.TEXTURE_2D,Ws.__webglTexture,Ge),ee!==0?q.blitFramebuffer(We,tt,me,Re,Xe,Ct,me,Re,q.COLOR_BUFFER_BIT,q.NEAREST):Wt?q.copyTexSubImage3D(Le,Ge,Xe,Ct,Ht+Et,We,tt,me,Re):q.copyTexSubImage2D(Le,Ge,Xe,Ct,We,tt,me,Re);y.bindFramebuffer(q.READ_FRAMEBUFFER,null),y.bindFramebuffer(q.DRAW_FRAMEBUFFER,null)}else Wt?E.isDataTexture||E.isData3DTexture?q.texSubImage3D(Le,Ge,Xe,Ct,Ht,me,Re,Fe,Tt,us,Jt.data):Y.isCompressedArrayTexture?q.compressedTexSubImage3D(Le,Ge,Xe,Ct,Ht,me,Re,Fe,Tt,Jt.data):q.texSubImage3D(Le,Ge,Xe,Ct,Ht,me,Re,Fe,Tt,us,Jt):E.isDataTexture?q.texSubImage2D(q.TEXTURE_2D,Ge,Xe,Ct,me,Re,Tt,us,Jt.data):E.isCompressedTexture?q.compressedTexSubImage2D(q.TEXTURE_2D,Ge,Xe,Ct,Jt.width,Jt.height,Tt,Jt.data):q.texSubImage2D(q.TEXTURE_2D,Ge,Xe,Ct,me,Re,Tt,us,Jt);y.pixelStorei(q.UNPACK_ROW_LENGTH,qt),y.pixelStorei(q.UNPACK_IMAGE_HEIGHT,pt),y.pixelStorei(q.UNPACK_SKIP_PIXELS,zs),y.pixelStorei(q.UNPACK_SKIP_ROWS,_s),y.pixelStorei(q.UNPACK_SKIP_IMAGES,Vs),Ge===0&&Y.generateMipmaps&&q.generateMipmap(Le),y.unbindTexture()},this.initRenderTarget=function(E){se.get(E).__webglFramebuffer===void 0&&ae.setupRenderTarget(E)},this.initTexture=function(E){E.isCubeTexture?ae.setTextureCube(E,0):E.isData3DTexture?ae.setTexture3D(E,0):E.isDataArrayTexture||E.isCompressedArrayTexture?ae.setTexture2DArray(E,0):ae.setTexture2D(E,0),y.unbindTexture()},this.resetState=function(){W=0,X=0,Q=null,y.reset(),Ne.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return An}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(e){this._outputColorSpace=e;const t=this.getContext();t.drawingBufferColorSpace=xt._getDrawingBufferColorSpace(e),t.unpackColorSpace=xt._getUnpackColorSpace()}}const tr={charge:!0,link:!0,collide:!0,gravity:!1},jt=.55;function Hi(n,e,t){var s,i=1;n==null&&(n=0),e==null&&(e=0),t==null&&(t=0);function r(){var a,o=s.length,l,c=0,d=0,u=0;for(a=0;a<o;++a)l=s[a],c+=l.x||0,d+=l.y||0,u+=l.z||0;for(c=(c/o-n)*i,d=(d/o-e)*i,u=(u/o-t)*i,a=0;a<o;++a)l=s[a],c&&(l.x-=c),d&&(l.y-=d),u&&(l.z-=u)}return r.initialize=function(a){s=a},r.x=function(a){return arguments.length?(n=+a,r):n},r.y=function(a){return arguments.length?(e=+a,r):e},r.z=function(a){return arguments.length?(t=+a,r):t},r.strength=function(a){return arguments.length?(i=+a,r):i},r}function ux(n){const e=+this._x.call(null,n);return cg(this.cover(e),e,n)}function cg(n,e,t){if(isNaN(e))return n;var s,i=n._root,r={data:t},a=n._x0,o=n._x1,l,c,d,u,h;if(!i)return n._root=r,n;for(;i.length;)if((d=e>=(l=(a+o)/2))?a=l:o=l,s=i,!(i=i[u=+d]))return s[u]=r,n;if(c=+n._x.call(null,i.data),e===c)return r.next=i,s?s[u]=r:n._root=r,n;do s=s?s[u]=new Array(2):n._root=new Array(2),(d=e>=(l=(a+o)/2))?a=l:o=l;while((u=+d)==(h=+(c>=l)));return s[h]=i,s[u]=r,n}function hx(n){Array.isArray(n)||(n=Array.from(n));const e=n.length,t=new Float64Array(e);let s=1/0,i=-1/0;for(let r=0,a;r<e;++r)isNaN(a=+this._x.call(null,n[r]))||(t[r]=a,a<s&&(s=a),a>i&&(i=a));if(s>i)return this;this.cover(s).cover(i);for(let r=0;r<e;++r)cg(this,t[r],n[r]);return this}function fx(n){if(isNaN(n=+n))return this;var e=this._x0,t=this._x1;if(isNaN(e))t=(e=Math.floor(n))+1;else{for(var s=t-e||1,i=this._root,r,a;e>n||n>=t;)switch(a=+(n<e),r=new Array(2),r[a]=i,i=r,s*=2,a){case 0:t=e+s;break;case 1:e=t-s;break}this._root&&this._root.length&&(this._root=i)}return this._x0=e,this._x1=t,this}function px(){var n=[];return this.visit(function(e){if(!e.length)do n.push(e.data);while(e=e.next)}),n}function mx(n){return arguments.length?this.cover(+n[0][0]).cover(+n[1][0]):isNaN(this._x0)?void 0:[[this._x0],[this._x1]]}function Jn(n,e,t){this.node=n,this.x0=e,this.x1=t}function gx(n,e){var t,s=this._x0,i,r,a=this._x1,o=[],l=this._root,c,d;for(l&&o.push(new Jn(l,s,a)),e==null?e=1/0:(s=n-e,a=n+e);c=o.pop();)if(!(!(l=c.node)||(i=c.x0)>a||(r=c.x1)<s))if(l.length){var u=(i+r)/2;o.push(new Jn(l[1],u,r),new Jn(l[0],i,u)),(d=+(n>=u))&&(c=o[o.length-1],o[o.length-1]=o[o.length-1-d],o[o.length-1-d]=c)}else{var h=Math.abs(n-+this._x.call(null,l.data));h<e&&(e=h,s=n-h,a=n+h,t=l.data)}return t}function Mx(n){if(isNaN(l=+this._x.call(null,n)))return this;var e,t=this._root,s,i,r,a=this._x0,o=this._x1,l,c,d,u,h;if(!t)return this;if(t.length)for(;;){if((d=l>=(c=(a+o)/2))?a=c:o=c,e=t,!(t=t[u=+d]))return this;if(!t.length)break;e[u+1&1]&&(s=e,h=u)}for(;t.data!==n;)if(i=t,!(t=t.next))return this;return(r=t.next)&&delete t.next,i?(r?i.next=r:delete i.next,this):e?(r?e[u]=r:delete e[u],(t=e[0]||e[1])&&t===(e[1]||e[0])&&!t.length&&(s?s[h]=t:this._root=t),this):(this._root=r,this)}function bx(n){for(var e=0,t=n.length;e<t;++e)this.remove(n[e]);return this}function zx(){return this._root}function _x(){var n=0;return this.visit(function(e){if(!e.length)do++n;while(e=e.next)}),n}function wx(n){var e=[],t,s=this._root,i,r,a;for(s&&e.push(new Jn(s,this._x0,this._x1));t=e.pop();)if(!n(s=t.node,r=t.x0,a=t.x1)&&s.length){var o=(r+a)/2;(i=s[1])&&e.push(new Jn(i,o,a)),(i=s[0])&&e.push(new Jn(i,r,o))}return this}function yx(n){var e=[],t=[],s;for(this._root&&e.push(new Jn(this._root,this._x0,this._x1));s=e.pop();){var i=s.node;if(i.length){var r,a=s.x0,o=s.x1,l=(a+o)/2;(r=i[0])&&e.push(new Jn(r,a,l)),(r=i[1])&&e.push(new Jn(r,l,o))}t.push(s)}for(;s=t.pop();)n(s.node,s.x0,s.x1);return this}function vx(n){return n[0]}function Ox(n){return arguments.length?(this._x=n,this):this._x}function Bu(n,e){var t=new Nu(e??vx,NaN,NaN);return n==null?t:t.addAll(n)}function Nu(n,e,t){this._x=n,this._x0=e,this._x1=t,this._root=void 0}function yf(n){for(var e={data:n.data},t=e;n=n.next;)t=t.next={data:n.data};return e}var Fs=Bu.prototype=Nu.prototype;Fs.copy=function(){var n=new Nu(this._x,this._x0,this._x1),e=this._root,t,s;if(!e)return n;if(!e.length)return n._root=yf(e),n;for(t=[{source:e,target:n._root=new Array(2)}];e=t.pop();)for(var i=0;i<2;++i)(s=e.source[i])&&(s.length?t.push({source:s,target:e.target[i]=new Array(2)}):e.target[i]=yf(s));return n};Fs.add=ux;Fs.addAll=hx;Fs.cover=fx;Fs.data=px;Fs.extent=mx;Fs.find=gx;Fs.remove=Mx;Fs.removeAll=bx;Fs.root=zx;Fs.size=_x;Fs.visit=wx;Fs.visitAfter=yx;Fs.x=Ox;function xx(n){const e=+this._x.call(null,n),t=+this._y.call(null,n);return dg(this.cover(e,t),e,t,n)}function dg(n,e,t,s){if(isNaN(e)||isNaN(t))return n;var i,r=n._root,a={data:s},o=n._x0,l=n._y0,c=n._x1,d=n._y1,u,h,g,p,z,m,f,_;if(!r)return n._root=a,n;for(;r.length;)if((z=e>=(u=(o+c)/2))?o=u:c=u,(m=t>=(h=(l+d)/2))?l=h:d=h,i=r,!(r=r[f=m<<1|z]))return i[f]=a,n;if(g=+n._x.call(null,r.data),p=+n._y.call(null,r.data),e===g&&t===p)return a.next=r,i?i[f]=a:n._root=a,n;do i=i?i[f]=new Array(4):n._root=new Array(4),(z=e>=(u=(o+c)/2))?o=u:c=u,(m=t>=(h=(l+d)/2))?l=h:d=h;while((f=m<<1|z)===(_=(p>=h)<<1|g>=u));return i[_]=r,i[f]=a,n}function Sx(n){var e,t,s=n.length,i,r,a=new Array(s),o=new Array(s),l=1/0,c=1/0,d=-1/0,u=-1/0;for(t=0;t<s;++t)isNaN(i=+this._x.call(null,e=n[t]))||isNaN(r=+this._y.call(null,e))||(a[t]=i,o[t]=r,i<l&&(l=i),i>d&&(d=i),r<c&&(c=r),r>u&&(u=r));if(l>d||c>u)return this;for(this.cover(l,c).cover(d,u),t=0;t<s;++t)dg(this,a[t],o[t],n[t]);return this}function Ax(n,e){if(isNaN(n=+n)||isNaN(e=+e))return this;var t=this._x0,s=this._y0,i=this._x1,r=this._y1;if(isNaN(t))i=(t=Math.floor(n))+1,r=(s=Math.floor(e))+1;else{for(var a=i-t||1,o=this._root,l,c;t>n||n>=i||s>e||e>=r;)switch(c=(e<s)<<1|n<t,l=new Array(4),l[c]=o,o=l,a*=2,c){case 0:i=t+a,r=s+a;break;case 1:t=i-a,r=s+a;break;case 2:i=t+a,s=r-a;break;case 3:t=i-a,s=r-a;break}this._root&&this._root.length&&(this._root=o)}return this._x0=t,this._y0=s,this._x1=i,this._y1=r,this}function Ex(){var n=[];return this.visit(function(e){if(!e.length)do n.push(e.data);while(e=e.next)}),n}function Dx(n){return arguments.length?this.cover(+n[0][0],+n[0][1]).cover(+n[1][0],+n[1][1]):isNaN(this._x0)?void 0:[[this._x0,this._y0],[this._x1,this._y1]]}function Ns(n,e,t,s,i){this.node=n,this.x0=e,this.y0=t,this.x1=s,this.y1=i}function Ix(n,e,t){var s,i=this._x0,r=this._y0,a,o,l,c,d=this._x1,u=this._y1,h=[],g=this._root,p,z;for(g&&h.push(new Ns(g,i,r,d,u)),t==null?t=1/0:(i=n-t,r=e-t,d=n+t,u=e+t,t*=t);p=h.pop();)if(!(!(g=p.node)||(a=p.x0)>d||(o=p.y0)>u||(l=p.x1)<i||(c=p.y1)<r))if(g.length){var m=(a+l)/2,f=(o+c)/2;h.push(new Ns(g[3],m,f,l,c),new Ns(g[2],a,f,m,c),new Ns(g[1],m,o,l,f),new Ns(g[0],a,o,m,f)),(z=(e>=f)<<1|n>=m)&&(p=h[h.length-1],h[h.length-1]=h[h.length-1-z],h[h.length-1-z]=p)}else{var _=n-+this._x.call(null,g.data),O=e-+this._y.call(null,g.data),w=_*_+O*O;if(w<t){var x=Math.sqrt(t=w);i=n-x,r=e-x,d=n+x,u=e+x,s=g.data}}return s}function Tx(n){if(isNaN(d=+this._x.call(null,n))||isNaN(u=+this._y.call(null,n)))return this;var e,t=this._root,s,i,r,a=this._x0,o=this._y0,l=this._x1,c=this._y1,d,u,h,g,p,z,m,f;if(!t)return this;if(t.length)for(;;){if((p=d>=(h=(a+l)/2))?a=h:l=h,(z=u>=(g=(o+c)/2))?o=g:c=g,e=t,!(t=t[m=z<<1|p]))return this;if(!t.length)break;(e[m+1&3]||e[m+2&3]||e[m+3&3])&&(s=e,f=m)}for(;t.data!==n;)if(i=t,!(t=t.next))return this;return(r=t.next)&&delete t.next,i?(r?i.next=r:delete i.next,this):e?(r?e[m]=r:delete e[m],(t=e[0]||e[1]||e[2]||e[3])&&t===(e[3]||e[2]||e[1]||e[0])&&!t.length&&(s?s[f]=t:this._root=t),this):(this._root=r,this)}function Gx(n){for(var e=0,t=n.length;e<t;++e)this.remove(n[e]);return this}function Rx(){return this._root}function Bx(){var n=0;return this.visit(function(e){if(!e.length)do++n;while(e=e.next)}),n}function Nx(n){var e=[],t,s=this._root,i,r,a,o,l;for(s&&e.push(new Ns(s,this._x0,this._y0,this._x1,this._y1));t=e.pop();)if(!n(s=t.node,r=t.x0,a=t.y0,o=t.x1,l=t.y1)&&s.length){var c=(r+o)/2,d=(a+l)/2;(i=s[3])&&e.push(new Ns(i,c,d,o,l)),(i=s[2])&&e.push(new Ns(i,r,d,c,l)),(i=s[1])&&e.push(new Ns(i,c,a,o,d)),(i=s[0])&&e.push(new Ns(i,r,a,c,d))}return this}function Cx(n){var e=[],t=[],s;for(this._root&&e.push(new Ns(this._root,this._x0,this._y0,this._x1,this._y1));s=e.pop();){var i=s.node;if(i.length){var r,a=s.x0,o=s.y0,l=s.x1,c=s.y1,d=(a+l)/2,u=(o+c)/2;(r=i[0])&&e.push(new Ns(r,a,o,d,u)),(r=i[1])&&e.push(new Ns(r,d,o,l,u)),(r=i[2])&&e.push(new Ns(r,a,u,d,c)),(r=i[3])&&e.push(new Ns(r,d,u,l,c))}t.push(s)}for(;s=t.pop();)n(s.node,s.x0,s.y0,s.x1,s.y1);return this}function Px(n){return n[0]}function Lx(n){return arguments.length?(this._x=n,this):this._x}function Wx(n){return n[1]}function kx(n){return arguments.length?(this._y=n,this):this._y}function Cu(n,e,t){var s=new Pu(e??Px,t??Wx,NaN,NaN,NaN,NaN);return n==null?s:s.addAll(n)}function Pu(n,e,t,s,i,r){this._x=n,this._y=e,this._x0=t,this._y0=s,this._x1=i,this._y1=r,this._root=void 0}function vf(n){for(var e={data:n.data},t=e;n=n.next;)t=t.next={data:n.data};return e}var Ps=Cu.prototype=Pu.prototype;Ps.copy=function(){var n=new Pu(this._x,this._y,this._x0,this._y0,this._x1,this._y1),e=this._root,t,s;if(!e)return n;if(!e.length)return n._root=vf(e),n;for(t=[{source:e,target:n._root=new Array(4)}];e=t.pop();)for(var i=0;i<4;++i)(s=e.source[i])&&(s.length?t.push({source:s,target:e.target[i]=new Array(4)}):e.target[i]=vf(s));return n};Ps.add=xx;Ps.addAll=Sx;Ps.cover=Ax;Ps.data=Ex;Ps.extent=Dx;Ps.find=Ix;Ps.remove=Tx;Ps.removeAll=Gx;Ps.root=Rx;Ps.size=Bx;Ps.visit=Nx;Ps.visitAfter=Cx;Ps.x=Lx;Ps.y=kx;function Ux(n){const e=+this._x.call(null,n),t=+this._y.call(null,n),s=+this._z.call(null,n);return ug(this.cover(e,t,s),e,t,s,n)}function ug(n,e,t,s,i){if(isNaN(e)||isNaN(t)||isNaN(s))return n;var r,a=n._root,o={data:i},l=n._x0,c=n._y0,d=n._z0,u=n._x1,h=n._y1,g=n._z1,p,z,m,f,_,O,w,x,S,I,b;if(!a)return n._root=o,n;for(;a.length;)if((w=e>=(p=(l+u)/2))?l=p:u=p,(x=t>=(z=(c+h)/2))?c=z:h=z,(S=s>=(m=(d+g)/2))?d=m:g=m,r=a,!(a=a[I=S<<2|x<<1|w]))return r[I]=o,n;if(f=+n._x.call(null,a.data),_=+n._y.call(null,a.data),O=+n._z.call(null,a.data),e===f&&t===_&&s===O)return o.next=a,r?r[I]=o:n._root=o,n;do r=r?r[I]=new Array(8):n._root=new Array(8),(w=e>=(p=(l+u)/2))?l=p:u=p,(x=t>=(z=(c+h)/2))?c=z:h=z,(S=s>=(m=(d+g)/2))?d=m:g=m;while((I=S<<2|x<<1|w)===(b=(O>=m)<<2|(_>=z)<<1|f>=p));return r[b]=a,r[I]=o,n}function Fx(n){Array.isArray(n)||(n=Array.from(n));const e=n.length,t=new Float64Array(e),s=new Float64Array(e),i=new Float64Array(e);let r=1/0,a=1/0,o=1/0,l=-1/0,c=-1/0,d=-1/0;for(let u=0,h,g,p,z;u<e;++u)isNaN(g=+this._x.call(null,h=n[u]))||isNaN(p=+this._y.call(null,h))||isNaN(z=+this._z.call(null,h))||(t[u]=g,s[u]=p,i[u]=z,g<r&&(r=g),g>l&&(l=g),p<a&&(a=p),p>c&&(c=p),z<o&&(o=z),z>d&&(d=z));if(r>l||a>c||o>d)return this;this.cover(r,a,o).cover(l,c,d);for(let u=0;u<e;++u)ug(this,t[u],s[u],i[u],n[u]);return this}function jx(n,e,t){if(isNaN(n=+n)||isNaN(e=+e)||isNaN(t=+t))return this;var s=this._x0,i=this._y0,r=this._z0,a=this._x1,o=this._y1,l=this._z1;if(isNaN(s))a=(s=Math.floor(n))+1,o=(i=Math.floor(e))+1,l=(r=Math.floor(t))+1;else{for(var c=a-s||1,d=this._root,u,h;s>n||n>=a||i>e||e>=o||r>t||t>=l;)switch(h=(t<r)<<2|(e<i)<<1|n<s,u=new Array(8),u[h]=d,d=u,c*=2,h){case 0:a=s+c,o=i+c,l=r+c;break;case 1:s=a-c,o=i+c,l=r+c;break;case 2:a=s+c,i=o-c,l=r+c;break;case 3:s=a-c,i=o-c,l=r+c;break;case 4:a=s+c,o=i+c,r=l-c;break;case 5:s=a-c,o=i+c,r=l-c;break;case 6:a=s+c,i=o-c,r=l-c;break;case 7:s=a-c,i=o-c,r=l-c;break}this._root&&this._root.length&&(this._root=d)}return this._x0=s,this._y0=i,this._z0=r,this._x1=a,this._y1=o,this._z1=l,this}function $x(){var n=[];return this.visit(function(e){if(!e.length)do n.push(e.data);while(e=e.next)}),n}function Vx(n){return arguments.length?this.cover(+n[0][0],+n[0][1],+n[0][2]).cover(+n[1][0],+n[1][1],+n[1][2]):isNaN(this._x0)?void 0:[[this._x0,this._y0,this._z0],[this._x1,this._y1,this._z1]]}function $t(n,e,t,s,i,r,a){this.node=n,this.x0=e,this.y0=t,this.z0=s,this.x1=i,this.y1=r,this.z1=a}function Hx(n,e,t,s){var i,r=this._x0,a=this._y0,o=this._z0,l,c,d,u,h,g,p=this._x1,z=this._y1,m=this._z1,f=[],_=this._root,O,w;for(_&&f.push(new $t(_,r,a,o,p,z,m)),s==null?s=1/0:(r=n-s,a=e-s,o=t-s,p=n+s,z=e+s,m=t+s,s*=s);O=f.pop();)if(!(!(_=O.node)||(l=O.x0)>p||(c=O.y0)>z||(d=O.z0)>m||(u=O.x1)<r||(h=O.y1)<a||(g=O.z1)<o))if(_.length){var x=(l+u)/2,S=(c+h)/2,I=(d+g)/2;f.push(new $t(_[7],x,S,I,u,h,g),new $t(_[6],l,S,I,x,h,g),new $t(_[5],x,c,I,u,S,g),new $t(_[4],l,c,I,x,S,g),new $t(_[3],x,S,d,u,h,I),new $t(_[2],l,S,d,x,h,I),new $t(_[1],x,c,d,u,S,I),new $t(_[0],l,c,d,x,S,I)),(w=(t>=I)<<2|(e>=S)<<1|n>=x)&&(O=f[f.length-1],f[f.length-1]=f[f.length-1-w],f[f.length-1-w]=O)}else{var b=n-+this._x.call(null,_.data),A=e-+this._y.call(null,_.data),B=t-+this._z.call(null,_.data),N=b*b+A*A+B*B;if(N<s){var k=Math.sqrt(s=N);r=n-k,a=e-k,o=t-k,p=n+k,z=e+k,m=t+k,i=_.data}}return i}const qx=(n,e,t,s,i,r)=>Math.sqrt((n-s)**2+(e-i)**2+(t-r)**2);function Xx(n,e,t,s){const i=[],r=n-s,a=e-s,o=t-s,l=n+s,c=e+s,d=t+s;return this.visit((u,h,g,p,z,m,f)=>{if(!u.length)do{const _=u.data;qx(n,e,t,this._x(_),this._y(_),this._z(_))<=s&&i.push(_)}while(u=u.next);return h>l||g>c||p>d||z<r||m<a||f<o}),i}function Yx(n){if(isNaN(h=+this._x.call(null,n))||isNaN(g=+this._y.call(null,n))||isNaN(p=+this._z.call(null,n)))return this;var e,t=this._root,s,i,r,a=this._x0,o=this._y0,l=this._z0,c=this._x1,d=this._y1,u=this._z1,h,g,p,z,m,f,_,O,w,x,S;if(!t)return this;if(t.length)for(;;){if((_=h>=(z=(a+c)/2))?a=z:c=z,(O=g>=(m=(o+d)/2))?o=m:d=m,(w=p>=(f=(l+u)/2))?l=f:u=f,e=t,!(t=t[x=w<<2|O<<1|_]))return this;if(!t.length)break;(e[x+1&7]||e[x+2&7]||e[x+3&7]||e[x+4&7]||e[x+5&7]||e[x+6&7]||e[x+7&7])&&(s=e,S=x)}for(;t.data!==n;)if(i=t,!(t=t.next))return this;return(r=t.next)&&delete t.next,i?(r?i.next=r:delete i.next,this):e?(r?e[x]=r:delete e[x],(t=e[0]||e[1]||e[2]||e[3]||e[4]||e[5]||e[6]||e[7])&&t===(e[7]||e[6]||e[5]||e[4]||e[3]||e[2]||e[1]||e[0])&&!t.length&&(s?s[S]=t:this._root=t),this):(this._root=r,this)}function Kx(n){for(var e=0,t=n.length;e<t;++e)this.remove(n[e]);return this}function Zx(){return this._root}function Qx(){var n=0;return this.visit(function(e){if(!e.length)do++n;while(e=e.next)}),n}function Jx(n){var e=[],t,s=this._root,i,r,a,o,l,c,d;for(s&&e.push(new $t(s,this._x0,this._y0,this._z0,this._x1,this._y1,this._z1));t=e.pop();)if(!n(s=t.node,r=t.x0,a=t.y0,o=t.z0,l=t.x1,c=t.y1,d=t.z1)&&s.length){var u=(r+l)/2,h=(a+c)/2,g=(o+d)/2;(i=s[7])&&e.push(new $t(i,u,h,g,l,c,d)),(i=s[6])&&e.push(new $t(i,r,h,g,u,c,d)),(i=s[5])&&e.push(new $t(i,u,a,g,l,h,d)),(i=s[4])&&e.push(new $t(i,r,a,g,u,h,d)),(i=s[3])&&e.push(new $t(i,u,h,o,l,c,g)),(i=s[2])&&e.push(new $t(i,r,h,o,u,c,g)),(i=s[1])&&e.push(new $t(i,u,a,o,l,h,g)),(i=s[0])&&e.push(new $t(i,r,a,o,u,h,g))}return this}function eS(n){var e=[],t=[],s;for(this._root&&e.push(new $t(this._root,this._x0,this._y0,this._z0,this._x1,this._y1,this._z1));s=e.pop();){var i=s.node;if(i.length){var r,a=s.x0,o=s.y0,l=s.z0,c=s.x1,d=s.y1,u=s.z1,h=(a+c)/2,g=(o+d)/2,p=(l+u)/2;(r=i[0])&&e.push(new $t(r,a,o,l,h,g,p)),(r=i[1])&&e.push(new $t(r,h,o,l,c,g,p)),(r=i[2])&&e.push(new $t(r,a,g,l,h,d,p)),(r=i[3])&&e.push(new $t(r,h,g,l,c,d,p)),(r=i[4])&&e.push(new $t(r,a,o,p,h,g,u)),(r=i[5])&&e.push(new $t(r,h,o,p,c,g,u)),(r=i[6])&&e.push(new $t(r,a,g,p,h,d,u)),(r=i[7])&&e.push(new $t(r,h,g,p,c,d,u))}t.push(s)}for(;s=t.pop();)n(s.node,s.x0,s.y0,s.z0,s.x1,s.y1,s.z1);return this}function tS(n){return n[0]}function sS(n){return arguments.length?(this._x=n,this):this._x}function nS(n){return n[1]}function iS(n){return arguments.length?(this._y=n,this):this._y}function rS(n){return n[2]}function aS(n){return arguments.length?(this._z=n,this):this._z}function Lu(n,e,t,s){var i=new Wu(e??tS,t??nS,s??rS,NaN,NaN,NaN,NaN,NaN,NaN);return n==null?i:i.addAll(n)}function Wu(n,e,t,s,i,r,a,o,l){this._x=n,this._y=e,this._z=t,this._x0=s,this._y0=i,this._z0=r,this._x1=a,this._y1=o,this._z1=l,this._root=void 0}function Of(n){for(var e={data:n.data},t=e;n=n.next;)t=t.next={data:n.data};return e}var vs=Lu.prototype=Wu.prototype;vs.copy=function(){var n=new Wu(this._x,this._y,this._z,this._x0,this._y0,this._z0,this._x1,this._y1,this._z1),e=this._root,t,s;if(!e)return n;if(!e.length)return n._root=Of(e),n;for(t=[{source:e,target:n._root=new Array(8)}];e=t.pop();)for(var i=0;i<8;++i)(s=e.source[i])&&(s.length?t.push({source:s,target:e.target[i]=new Array(8)}):e.target[i]=Of(s));return n};vs.add=Ux;vs.addAll=Fx;vs.cover=jx;vs.data=$x;vs.extent=Vx;vs.find=Hx;vs.findAllWithinRadius=Xx;vs.remove=Yx;vs.removeAll=Kx;vs.root=Zx;vs.size=Qx;vs.visit=Jx;vs.visitAfter=eS;vs.x=sS;vs.y=iS;vs.z=aS;function fs(n){return function(){return n}}function rn(n){return(n()-.5)*1e-6}function xc(n){return n.x+n.vx}function xf(n){return n.y+n.vy}function oS(n){return n.z+n.vz}function Oi(n){var e,t,s,i,r=1,a=1;typeof n!="function"&&(n=fs(n==null?1:+n));function o(){for(var d,u=e.length,h,g,p,z,m,f,_,O=0;O<a;++O)for(h=(t===1?Bu(e,xc):t===2?Cu(e,xc,xf):t===3?Lu(e,xc,xf,oS):null).visitAfter(l),d=0;d<u;++d)g=e[d],f=s[g.index],_=f*f,p=g.x+g.vx,t>1&&(z=g.y+g.vy),t>2&&(m=g.z+g.vz),h.visit(w);function w(x,S,I,b,A,B,N){var k=[S,I,b,A,B,N],L=k[0],j=k[1],P=k[2],W=k[t],X=k[t+1],Q=k[t+2],re=x.data,Me=x.r,oe=f+Me;if(re){if(re.index>g.index){var Oe=p-re.x-re.vx,Ke=t>1?z-re.y-re.vy:0,nt=t>2?m-re.z-re.vz:0,je=Oe*Oe+Ke*Ke+nt*nt;je<oe*oe&&(Oe===0&&(Oe=rn(i),je+=Oe*Oe),t>1&&Ke===0&&(Ke=rn(i),je+=Ke*Ke),t>2&&nt===0&&(nt=rn(i),je+=nt*nt),je=(oe-(je=Math.sqrt(je)))/je*r,g.vx+=(Oe*=je)*(oe=(Me*=Me)/(_+Me)),t>1&&(g.vy+=(Ke*=je)*oe),t>2&&(g.vz+=(nt*=je)*oe),re.vx-=Oe*(oe=1-oe),t>1&&(re.vy-=Ke*oe),t>2&&(re.vz-=nt*oe))}return}return L>p+oe||W<p-oe||t>1&&(j>z+oe||X<z-oe)||t>2&&(P>m+oe||Q<m-oe)}}function l(d){if(d.data)return d.r=s[d.data.index];for(var u=d.r=0;u<Math.pow(2,t);++u)d[u]&&d[u].r>d.r&&(d.r=d[u].r)}function c(){if(e){var d,u=e.length,h;for(s=new Array(u),d=0;d<u;++d)h=e[d],s[h.index]=+n(h,d,e)}}return o.initialize=function(d,...u){e=d,i=u.find(h=>typeof h=="function")||Math.random,t=u.find(h=>[1,2,3].includes(h))||2,c()},o.iterations=function(d){return arguments.length?(a=+d,o):a},o.strength=function(d){return arguments.length?(r=+d,o):r},o.radius=function(d){return arguments.length?(n=typeof d=="function"?d:fs(+d),c(),o):n},o}function lS(n){return n.index}function Sf(n,e){var t=n.get(e);if(!t)throw new Error("node not found: "+e);return t}function sr(n){var e=lS,t=h,s,i=fs(30),r,a,o,l,c,d,u=1;n==null&&(n=[]);function h(f){return 1/Math.min(l[f.source.index],l[f.target.index])}function g(f){for(var _=0,O=n.length;_<u;++_)for(var w=0,x,S,I,b=0,A=0,B=0,N,k;w<O;++w)x=n[w],S=x.source,I=x.target,b=I.x+I.vx-S.x-S.vx||rn(d),o>1&&(A=I.y+I.vy-S.y-S.vy||rn(d)),o>2&&(B=I.z+I.vz-S.z-S.vz||rn(d)),N=Math.sqrt(b*b+A*A+B*B),N=(N-r[w])/N*f*s[w],b*=N,A*=N,B*=N,I.vx-=b*(k=c[w]),o>1&&(I.vy-=A*k),o>2&&(I.vz-=B*k),S.vx+=b*(k=1-k),o>1&&(S.vy+=A*k),o>2&&(S.vz+=B*k)}function p(){if(a){var f,_=a.length,O=n.length,w=new Map(a.map((S,I)=>[e(S,I,a),S])),x;for(f=0,l=new Array(_);f<O;++f)x=n[f],x.index=f,typeof x.source!="object"&&(x.source=Sf(w,x.source)),typeof x.target!="object"&&(x.target=Sf(w,x.target)),l[x.source.index]=(l[x.source.index]||0)+1,l[x.target.index]=(l[x.target.index]||0)+1;for(f=0,c=new Array(O);f<O;++f)x=n[f],c[f]=l[x.source.index]/(l[x.source.index]+l[x.target.index]);s=new Array(O),z(),r=new Array(O),m()}}function z(){if(a)for(var f=0,_=n.length;f<_;++f)s[f]=+t(n[f],f,n)}function m(){if(a)for(var f=0,_=n.length;f<_;++f)r[f]=+i(n[f],f,n)}return g.initialize=function(f,..._){a=f,d=_.find(O=>typeof O=="function")||Math.random,o=_.find(O=>[1,2,3].includes(O))||2,p()},g.links=function(f){return arguments.length?(n=f,p(),g):n},g.id=function(f){return arguments.length?(e=f,g):e},g.iterations=function(f){return arguments.length?(u=+f,g):u},g.strength=function(f){return arguments.length?(t=typeof f=="function"?f:fs(+f),z(),g):t},g.distance=function(f){return arguments.length?(i=typeof f=="function"?f:fs(+f),m(),g):i},g}var cS={value:()=>{}};function hg(){for(var n=0,e=arguments.length,t={},s;n<e;++n){if(!(s=arguments[n]+"")||s in t||/[\s.]/.test(s))throw new Error("illegal type: "+s);t[s]=[]}return new jo(t)}function jo(n){this._=n}function dS(n,e){return n.trim().split(/^|\s+/).map(function(t){var s="",i=t.indexOf(".");if(i>=0&&(s=t.slice(i+1),t=t.slice(0,i)),t&&!e.hasOwnProperty(t))throw new Error("unknown type: "+t);return{type:t,name:s}})}jo.prototype=hg.prototype={constructor:jo,on:function(n,e){var t=this._,s=dS(n+"",t),i,r=-1,a=s.length;if(arguments.length<2){for(;++r<a;)if((i=(n=s[r]).type)&&(i=uS(t[i],n.name)))return i;return}if(e!=null&&typeof e!="function")throw new Error("invalid callback: "+e);for(;++r<a;)if(i=(n=s[r]).type)t[i]=Af(t[i],n.name,e);else if(e==null)for(i in t)t[i]=Af(t[i],n.name,null);return this},copy:function(){var n={},e=this._;for(var t in e)n[t]=e[t].slice();return new jo(n)},call:function(n,e){if((i=arguments.length-2)>0)for(var t=new Array(i),s=0,i,r;s<i;++s)t[s]=arguments[s+2];if(!this._.hasOwnProperty(n))throw new Error("unknown type: "+n);for(r=this._[n],s=0,i=r.length;s<i;++s)r[s].value.apply(e,t)},apply:function(n,e,t){if(!this._.hasOwnProperty(n))throw new Error("unknown type: "+n);for(var s=this._[n],i=0,r=s.length;i<r;++i)s[i].value.apply(e,t)}};function uS(n,e){for(var t=0,s=n.length,i;t<s;++t)if((i=n[t]).name===e)return i.value}function Af(n,e,t){for(var s=0,i=n.length;s<i;++s)if(n[s].name===e){n[s]=cS,n=n.slice(0,s).concat(n.slice(s+1));break}return t!=null&&n.push({name:e,value:t}),n}var Yr=0,Ta=0,wa=0,fg=1e3,Ml,Ga,bl=0,nr=0,Tl=0,Ua=typeof performance=="object"&&performance.now?performance:Date,pg=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(n){setTimeout(n,17)};function mg(){return nr||(pg(hS),nr=Ua.now()+Tl)}function hS(){nr=0}function su(){this._call=this._time=this._next=null}su.prototype=gg.prototype={constructor:su,restart:function(n,e,t){if(typeof n!="function")throw new TypeError("callback is not a function");t=(t==null?mg():+t)+(e==null?0:+e),!this._next&&Ga!==this&&(Ga?Ga._next=this:Ml=this,Ga=this),this._call=n,this._time=t,nu()},stop:function(){this._call&&(this._call=null,this._time=1/0,nu())}};function gg(n,e,t){var s=new su;return s.restart(n,e,t),s}function fS(){mg(),++Yr;for(var n=Ml,e;n;)(e=nr-n._time)>=0&&n._call.call(void 0,e),n=n._next;--Yr}function Ef(){nr=(bl=Ua.now())+Tl,Yr=Ta=0;try{fS()}finally{Yr=0,mS(),nr=0}}function pS(){var n=Ua.now(),e=n-bl;e>fg&&(Tl-=e,bl=n)}function mS(){for(var n,e=Ml,t,s=1/0;e;)e._call?(s>e._time&&(s=e._time),n=e,e=e._next):(t=e._next,e._next=null,e=n?n._next=t:Ml=t);Ga=n,nu(s)}function nu(n){if(!Yr){Ta&&(Ta=clearTimeout(Ta));var e=n-nr;e>24?(n<1/0&&(Ta=setTimeout(Ef,n-Ua.now()-Tl)),wa&&(wa=clearInterval(wa))):(wa||(bl=Ua.now(),wa=setInterval(pS,fg)),Yr=1,pg(Ef))}}const gS=1664525,MS=1013904223,Df=4294967296;function bS(){let n=1;return()=>(n=(gS*n+MS)%Df)/Df}var If=3;function Sc(n){return n.x}function Tf(n){return n.y}function zS(n){return n.z}var _S=10,wS=Math.PI*(3-Math.sqrt(5)),yS=Math.PI*20/(9+Math.sqrt(221));function xi(n,e){e=e||2;var t=Math.min(If,Math.max(1,Math.round(e))),s,i=1,r=.001,a=1-Math.pow(r,1/300),o=0,l=.6,c=new Map,d=gg(g),u=hg("tick","end"),h=bS();n==null&&(n=[]);function g(){p(),u.call("tick",s),i<r&&(d.stop(),u.call("end",s))}function p(f){var _,O=n.length,w;f===void 0&&(f=1);for(var x=0;x<f;++x)for(i+=(o-i)*a,c.forEach(function(S){S(i)}),_=0;_<O;++_)w=n[_],w.fx==null?w.x+=w.vx*=l:(w.x=w.fx,w.vx=0),t>1&&(w.fy==null?w.y+=w.vy*=l:(w.y=w.fy,w.vy=0)),t>2&&(w.fz==null?w.z+=w.vz*=l:(w.z=w.fz,w.vz=0));return s}function z(){for(var f=0,_=n.length,O;f<_;++f){if(O=n[f],O.index=f,O.fx!=null&&(O.x=O.fx),O.fy!=null&&(O.y=O.fy),O.fz!=null&&(O.z=O.fz),isNaN(O.x)||t>1&&isNaN(O.y)||t>2&&isNaN(O.z)){var w=_S*(t>2?Math.cbrt(.5+f):t>1?Math.sqrt(.5+f):f),x=f*wS,S=f*yS;t===1?O.x=w:t===2?(O.x=w*Math.cos(x),O.y=w*Math.sin(x)):(O.x=w*Math.sin(x)*Math.cos(S),O.y=w*Math.cos(x),O.z=w*Math.sin(x)*Math.sin(S))}(isNaN(O.vx)||t>1&&isNaN(O.vy)||t>2&&isNaN(O.vz))&&(O.vx=0,t>1&&(O.vy=0),t>2&&(O.vz=0))}}function m(f){return f.initialize&&f.initialize(n,h,t),f}return z(),s={tick:p,restart:function(){return d.restart(g),s},stop:function(){return d.stop(),s},numDimensions:function(f){return arguments.length?(t=Math.min(If,Math.max(1,Math.round(f))),c.forEach(m),s):t},nodes:function(f){return arguments.length?(n=f,z(),c.forEach(m),s):n},alpha:function(f){return arguments.length?(i=+f,s):i},alphaMin:function(f){return arguments.length?(r=+f,s):r},alphaDecay:function(f){return arguments.length?(a=+f,s):+a},alphaTarget:function(f){return arguments.length?(o=+f,s):o},velocityDecay:function(f){return arguments.length?(l=1-f,s):1-l},randomSource:function(f){return arguments.length?(h=f,c.forEach(m),s):h},force:function(f,_){return arguments.length>1?(_==null?c.delete(f):c.set(f,m(_)),s):c.get(f)},find:function(){var f=Array.prototype.slice.call(arguments),_=f.shift()||0,O=(t>1?f.shift():null)||0,w=(t>2?f.shift():null)||0,x=f.shift()||1/0,S=0,I=n.length,b,A,B,N,k,L;for(x*=x,S=0;S<I;++S)k=n[S],b=_-k.x,A=O-(k.y||0),B=w-(k.z||0),N=b*b+A*A+B*B,N<x&&(L=k,x=N);return L},on:function(f,_){return arguments.length>1?(u.on(f,_),s):u.on(f)}}}function Si(){var n,e,t,s,i,r=fs(-30),a,o=1,l=1/0,c=.81;function d(p){var z,m=n.length,f=(e===1?Bu(n,Sc):e===2?Cu(n,Sc,Tf):e===3?Lu(n,Sc,Tf,zS):null).visitAfter(h);for(i=p,z=0;z<m;++z)t=n[z],f.visit(g)}function u(){if(n){var p,z=n.length,m;for(a=new Array(z),p=0;p<z;++p)m=n[p],a[m.index]=+r(m,p,n)}}function h(p){var z=0,m,f,_=0,O,w,x,S,I=p.length;if(I){for(O=w=x=S=0;S<I;++S)(m=p[S])&&(f=Math.abs(m.value))&&(z+=m.value,_+=f,O+=f*(m.x||0),w+=f*(m.y||0),x+=f*(m.z||0));z*=Math.sqrt(4/I),p.x=O/_,e>1&&(p.y=w/_),e>2&&(p.z=x/_)}else{m=p,m.x=m.data.x,e>1&&(m.y=m.data.y),e>2&&(m.z=m.data.z);do z+=a[m.data.index];while(m=m.next)}p.value=z}function g(p,z,m,f,_){if(!p.value)return!0;var O=[m,f,_][e-1],w=p.x-t.x,x=e>1?p.y-t.y:0,S=e>2?p.z-t.z:0,I=O-z,b=w*w+x*x+S*S;if(I*I/c<b)return b<l&&(w===0&&(w=rn(s),b+=w*w),e>1&&x===0&&(x=rn(s),b+=x*x),e>2&&S===0&&(S=rn(s),b+=S*S),b<o&&(b=Math.sqrt(o*b)),t.vx+=w*p.value*i/b,e>1&&(t.vy+=x*p.value*i/b),e>2&&(t.vz+=S*p.value*i/b)),!0;if(p.length||b>=l)return;(p.data!==t||p.next)&&(w===0&&(w=rn(s),b+=w*w),e>1&&x===0&&(x=rn(s),b+=x*x),e>2&&S===0&&(S=rn(s),b+=S*S),b<o&&(b=Math.sqrt(o*b)));do p.data!==t&&(I=a[p.data.index]*i/b,t.vx+=w*I,e>1&&(t.vy+=x*I),e>2&&(t.vz+=S*I));while(p=p.next)}return d.initialize=function(p,...z){n=p,s=z.find(m=>typeof m=="function")||Math.random,e=z.find(m=>[1,2,3].includes(m))||2,u()},d.strength=function(p){return arguments.length?(r=typeof p=="function"?p:fs(+p),u(),d):r},d.distanceMin=function(p){return arguments.length?(o=p*p,d):Math.sqrt(o)},d.distanceMax=function(p){return arguments.length?(l=p*p,d):Math.sqrt(l)},d.theta=function(p){return arguments.length?(c=p*p,d):Math.sqrt(c)},d}function ku(n){var e=fs(.1),t,s,i;typeof n!="function"&&(n=fs(n==null?0:+n));function r(o){for(var l=0,c=t.length,d;l<c;++l)d=t[l],d.vx+=(i[l]-d.x)*s[l]*o}function a(){if(t){var o,l=t.length;for(s=new Array(l),i=new Array(l),o=0;o<l;++o)s[o]=isNaN(i[o]=+n(t[o],o,t))?0:+e(t[o],o,t)}}return r.initialize=function(o){t=o,a()},r.strength=function(o){return arguments.length?(e=typeof o=="function"?o:fs(+o),a(),r):e},r.x=function(o){return arguments.length?(n=typeof o=="function"?o:fs(+o),a(),r):n},r}function Uu(n){var e=fs(.1),t,s,i;typeof n!="function"&&(n=fs(n==null?0:+n));function r(o){for(var l=0,c=t.length,d;l<c;++l)d=t[l],d.vy+=(i[l]-d.y)*s[l]*o}function a(){if(t){var o,l=t.length;for(s=new Array(l),i=new Array(l),o=0;o<l;++o)s[o]=isNaN(i[o]=+n(t[o],o,t))?0:+e(t[o],o,t)}}return r.initialize=function(o){t=o,a()},r.strength=function(o){return arguments.length?(e=typeof o=="function"?o:fs(+o),a(),r):e},r.y=function(o){return arguments.length?(n=typeof o=="function"?o:fs(+o),a(),r):n},r}function Fu(n){var e=fs(.1),t,s,i;typeof n!="function"&&(n=fs(n==null?0:+n));function r(o){for(var l=0,c=t.length,d;l<c;++l)d=t[l],d.vz+=(i[l]-d.z)*s[l]*o}function a(){if(t){var o,l=t.length;for(s=new Array(l),i=new Array(l),o=0;o<l;++o)s[o]=isNaN(i[o]=+n(t[o],o,t))?0:+e(t[o],o,t)}}return r.initialize=function(o){t=o,a()},r.strength=function(o){return arguments.length?(e=typeof o=="function"?o:fs(+o),a(),r):e},r.z=function(o){return arguments.length?(n=typeof o=="function"?o:fs(+o),a(),r):n},r}function vS(n){let e=2166136261;for(let t=0;t<n.length;t++)e^=n.charCodeAt(t),e=Math.imul(e,16777619);return e>>>0}function OS(n){let e=n>>>0;return()=>(e=Math.imul(e,1664525)+1013904223>>>0,e/4294967296)}function Kr(n){return OS(vS(n))}const pn=.55,xS=12,SS=60,Ac=60;function AS(n){const e=new Map(n.map((t,s)=>[t.id,s]));return n.map(t=>`${t.parents.map(i=>e.get(i)??-1).join(".")}:${t.radius.toFixed(2)}`).join("|")}function ES(n,e,t){const[s,i,r]=n,a=s*Math.cos(e)+r*Math.sin(e),o=-s*Math.sin(e)+r*Math.cos(e),l=i*Math.cos(t)-o*Math.sin(t),c=i*Math.sin(t)+o*Math.cos(t);return[a,l,c]}function DS(n,e,t){const s=p=>Math.hypot(p[0],p[1],p[2]),i=s(e),r=s(t);if(i<1e-9||r<1e-9)return n;const a=[e[0]/i,e[1]/i,e[2]/i],o=[t[0]/r,t[1]/r,t[2]/r],l=[a[1]*o[2]-a[2]*o[1],a[2]*o[0]-a[0]*o[2],a[0]*o[1]-a[1]*o[0]],c=s(l),d=a[0]*o[0]+a[1]*o[1]+a[2]*o[2];if(c<1e-9)return d>0?n:[-n[0],-n[1],-n[2]];const u=[l[0]/c,l[1]/c,l[2]/c],h=u[0]*n[0]+u[1]*n[1]+u[2]*n[2],g=[u[1]*n[2]-u[2]*n[1],u[2]*n[0]-u[0]*n[2],u[0]*n[1]-u[1]*n[0]];return[n[0]*d+g[0]*c+u[0]*h*(1-d),n[1]*d+g[1]*c+u[1]*h*(1-d),n[2]*d+g[2]*c+u[2]*h*(1-d)]}function Gf(n,e,t){if(e.length===0)return n;let s=0;for(const i of e)s+=t.get(i.id.slice(6))??pn;return s/=e.length,Math.max(n+2,Math.sqrt(e.length)*s*1.6)}function Ec(n,e,t){const s=e<=1?0:1-2*(n+.5)/e,i=Math.sqrt(Math.max(0,1-s*s)),r=n*Math.PI*(3-Math.sqrt(5));return[Math.cos(r)*i*t,s*t,Math.sin(r)*i*t]}function ju(n,e,t=()=>{},s="clumps",i=Kr){const r=new Map(n.map(L=>[L.id,L])),a=new Map,o=[];for(const L of n)L.group===null?o.push(L):a.set(L.group,[...a.get(L.group)??[],L]);const l=new Map,c=new Map,d=new Map,u=new Set;let h=0;const g=Math.max(1,a.size),p=new Map;for(const[L,j]of a){const P=j.filter(oe=>oe.seed!==void 0),W=[0,0,0];for(const oe of P)W[0]+=oe.seed[0],W[1]+=oe.seed[1],W[2]+=oe.seed[2];P.length>0&&(W[0]/=P.length,W[1]/=P.length,W[2]/=P.length,d.set(L,W)),j.every(oe=>oe.frozen===!0&&oe.seed!==void 0)&&u.add(L);const X=new Map,Q=P.length===0?AS(j):null,re=Q===null?void 0:p.get(Q);if(P.length===j.length)for(const oe of j)X.set(oe.id,[oe.seed[0]-W[0],oe.seed[1]-W[1],oe.seed[2]-W[2]]);else if(re!==void 0){const oe=i(L),Oe=oe()*Math.PI*2,Ke=(oe()-.5)*Math.PI;j.forEach((nt,je)=>{X.set(nt.id,ES(re[je]??[0,0,0],Oe,Ke))})}else{const oe=j.map(ue=>{const fe={id:ue.id,r:ue.radius};return ue.seed!==void 0&&(fe.x=ue.seed[0]-W[0],fe.y=ue.seed[1]-W[1],fe.z=ue.seed[2]-W[2],ue.frozen===!0&&(fe.fx=fe.x,fe.fy=fe.y,fe.fz=fe.z)),fe}),Oe=new Set(j.map(ue=>ue.id)),Ke=[];for(const ue of j)for(const fe of ue.parents)Oe.has(fe)&&Ke.push({source:fe,target:ue.id});const nt=new Map(j.map(ue=>[ue.id,ue.radius])),je=xi(oe,3).force("link",sr(Ke).id(ue=>ue.id).distance(e.link?ue=>(nt.get(ue.source.id)??pn)+(nt.get(ue.target.id)??pn)+1.4:2.2)).force("charge",Si().strength(ue=>e.charge?-6*(ue.r/pn)**2:-6).distanceMax(xS)).force("center",Hi(0,0,0)).stop();e.collide&&je.force("collide",Oi().radius(ue=>ue.r*1.2));for(let ue=0;ue<SS;ue++)je.tick();const ce=[0,0,0];for(const ue of oe)ce[0]+=ue.x??0,ce[1]+=ue.y??0,ce[2]+=ue.z??0;ce[0]/=oe.length,ce[1]/=oe.length,ce[2]/=oe.length;for(const ue of oe)X.set(ue.id,[(ue.x??0)-ce[0],(ue.y??0)-ce[1],(ue.z??0)-ce[2]]);Q!==null&&p.set(Q,j.map(ue=>X.get(ue.id)??[0,0,0]))}let Me=pn;for(const oe of j){const Oe=X.get(oe.id)??[0,0,0];l.set(oe.id,Oe),Me=Math.max(Me,Math.hypot(Oe[0],Oe[1],Oe[2])+oe.radius)}c.set(L,Me),h+=1,h%50===0&&t(.3*(h/g))}t(.3);const z=L=>{const j=r.get(L);return j!==void 0&&j.group!==null?`group:${j.group}`:L},m=[],f=new Map;let _=!1;for(const[L]of a){const j=`group:${L}`,P=c.get(L)??pn,W={id:j,r:P},X=d.get(L);X!==void 0&&(W.x=X[0],W.y=X[1],W.z=X[2],u.has(L)&&(W.fx=X[0],W.fy=X[1],W.fz=X[2],_=!0)),f.set(j,P),m.push(W)}for(const L of o){const j={id:L.id,r:L.radius};L.seed!==void 0&&(j.x=L.seed[0],j.y=L.seed[1],j.z=L.seed[2],L.frozen===!0&&(j.fx=L.seed[0],j.fy=L.seed[1],j.fz=L.seed[2],_=!0)),f.set(L.id,L.radius),m.push(j)}const O=new Set,w=[];for(const L of n)for(const j of L.parents){if(!r.has(j))continue;const P=z(j),W=z(L.id);if(P===W)continue;const X=`${P}\0${W}`;O.has(X)||(O.add(X),w.push({source:P,target:W}))}const x=new Map;for(const L of w)if(L.source.startsWith("group:")!==L.target.startsWith("group:")){const j=L.source.startsWith("group:")?L.source:L.target,P=L.source.startsWith("group:")?L.target:L.source;x.has(j)||x.set(j,P)}const S=new Map;for(const L of m){const j=x.get(L.id);j!==void 0&&S.set(j,[...S.get(j)??[],L])}const I=m.reduce((L,j)=>L+j.r*j.r,0),b=m.filter(L=>!L.id.startsWith("group:"));b.forEach((L,j)=>{if(L.x!==void 0)return;const[P,W,X]=Ec(j,b.length,Math.sqrt(I)*1.2+10);L.x=P,L.y=W,L.z=X});for(const[L,j]of S){const P=m.find(X=>X.id===L),W=Math.sqrt(j.reduce((X,Q)=>X+Q.r*Q.r,0))*1.4+2;j.forEach((X,Q)=>{if(X.x!==void 0)return;const[re,Me,oe]=Ec(Q,j.length,W);X.x=(P?.x??0)+re,X.y=(P?.y??0)+Me,X.z=(P?.z??0)+oe})}const A=new Set;if(s==="spokes"){const L=P=>{const W=a.get(P)??[],X=new Set(W.map(re=>re.id)),Q=W.find(re=>re.parents.some(Me=>!X.has(Me)))??W[0];return Q===void 0?[0,0,0]:l.get(Q.id)??[0,0,0]},j=[];for(const P of m){if(P.id.startsWith("group:")&&x.has(P.id)){A.add(P.id);continue}if(P.id.startsWith("group:"))j.push(P);else{const W=S.get(P.id)??[];let X=P.r;const Q=Gf(P.r,W,c);for(const re of W){const Me=re.id.slice(6),oe=L(Me);X=Math.max(X,Q+Math.hypot(oe[0],oe[1],oe[2])+2*(c.get(Me)??pn))}j.push({id:P.id,r:X,x:P.x,y:P.y,z:P.z,...P.fx!==void 0?{fx:P.fx,fy:P.fy,fz:P.fz}:{}})}}if(!j.every(P=>P.fx!==void 0)){const P=xi(j,3).force("charge",Si().strength(W=>-1.5*W.r)).force("collide",Oi().radius(W=>W.r*.9)).stop();_||P.force("center",Hi(0,0,0));for(let W=0;W<Ac;W++)P.tick(),W%5===0&&t(.3+.7*(W/Ac))}for(const P of j){const W=m.find(X=>X.id===P.id);W!==void 0&&W!==P&&(W.x=P.x,W.y=P.y,W.z=P.z)}for(const P of m){if(P.id.startsWith("group:")||!S.has(P.id))continue;const W=S.get(P.id)??[],X=Gf(P.r,W,c);W.forEach((Q,re)=>{if(Q.fx!==void 0||d.has(Q.id.slice(6)))return;const Me=L(Q.id.slice(6)),oe=Ec(re,W.length,1),Oe=.35+.65*(re*.6180339887%1),Ke=P.r+1.4+X*Oe+Math.hypot(Me[0],Me[1],Me[2]);Q.x=(P.x??0)+oe[0]*Ke,Q.y=(P.y??0)+oe[1]*Ke,Q.z=(P.z??0)+oe[2]*Ke})}}if(!m.every(L=>L.fx!==void 0)&&s!=="spokes"){const L=xi(m,3).force("link",sr(w).id(W=>W.id).distance(e.link?W=>(f.get(W.source.id)??pn)+(f.get(W.target.id)??pn)+1.4:2.2)).stop(),j=Si().strength(W=>e.charge?-6*(W.r/pn)**2:-6);if(e.reach!==void 0&&j.distanceMax(e.reach),L.force("charge",j),_||L.force("center",Hi(0,0,0)),e.collide&&L.force("collide",Oi().radius(W=>W.r*1.05)),e.gravity){const W=X=>Math.min(1,(X.r/pn)**2*.08);L.force("gx",ku(0).strength(W)).force("gy",Uu(0).strength(W)).force("gz",Fu(0).strength(W))}const P=Ac;for(let W=0;W<P;W++)L.tick(),W%5===0&&t(.3+.7*(W/P))}const N=new Map(m.map(L=>[L.id,L]));if(s==="spokes")for(const[L,j]of a){if(j.some(nt=>nt.seed!==void 0))continue;const P=`group:${L}`,W=N.get(P),X=x.get(P),Q=X===void 0?void 0:N.get(X);if(W===void 0||Q===void 0)continue;const re=[(W.x??0)-(Q.x??0),(W.y??0)-(Q.y??0),(W.z??0)-(Q.z??0)],Me=new Set(j.map(nt=>nt.id)),oe=j.find(nt=>nt.parents.some(je=>!Me.has(je)))??j[0],Oe=l.get(oe.id)??[0,0,0],Ke=[-Oe[0],-Oe[1],-Oe[2]];for(const nt of j){const je=l.get(nt.id)??[0,0,0];l.set(nt.id,DS(je,Ke,re))}}const k={};for(const L of n){const j=N.get(z(L.id)),P=[j?.x??0,j?.y??0,j?.z??0],W=L.group===null?[0,0,0]:l.get(L.id)??[0,0,0];k[L.id]=[P[0]+W[0],P[1]+W[1],P[2]+W[2]]}return t(1),k}const Rf=80;function Mg(n,e,t=()=>{},s=Kr){const i=n.some(h=>h.seed===void 0),r=i?ju(n,e,h=>t(.05*h),"spokes",s):{};t(.05);const a=n.map(h=>{const g=h.seed??r[h.id],p={id:h.id,r:h.radius};return g!==void 0&&(p.x=g[0],p.y=g[1],p.z=g[2],h.frozen===!0&&h.seed!==void 0&&(p.fx=g[0],p.fy=g[1],p.fz=g[2])),p}),o=new Set(n.map(h=>h.id)),l=[];for(const h of n)for(const g of h.parents)o.has(g)&&l.push({source:g,target:h.id});const c=new Map(n.map(h=>[h.id,h.radius])),d=a.some(h=>h.fx!==void 0);if(!a.every(h=>h.fx!==void 0)){const h=xi(a,3).force("link",sr(l).id(p=>p.id).distance(e.link?p=>(c.get(p.source.id)??jt)+(c.get(p.target.id)??jt)+1.4:2.2)).stop(),g=Si().strength(p=>e.charge?-6*(p.r/jt)**2:-6);if(e.reach!==void 0&&g.distanceMax(e.reach),h.force("charge",g),d||h.force("center",Hi(0,0,0)),e.collide&&h.force("collide",Oi().radius(p=>p.r*1.2)),e.gravity){const p=z=>(z.r/jt)**2*.08;h.force("gx",ku(0).strength(p)).force("gy",Uu(0).strength(p)).force("gz",Fu(0).strength(p))}i&&h.alpha(.6);for(let p=0;p<Rf;p++)h.tick(),p%2===0&&t(.05+.95*(p/Rf))}const u={};for(const h of a)u[h.id]=[h.x??0,h.y??0,h.z??0];return t(1),u}function bg(n){const e=new Map;for(const t of n)for(const s of t.parents)e.set(s,(e.get(s)??0)+1),e.set(t.id,(e.get(t.id)??0)+1);return n.map(t=>t.metric??e.get(t.id)??1)}function zg(n){const e=bg(n),t=Math.max(...e,1);return new Map(n.map((s,i)=>[s.id,jt*(.5+(e[i]??1)/t*1.2)]))}function _g(n,e=3,t=new Map,s=tr,i=new Set){const r=[];for(const _ of n)for(const O of _.parents)r.push({source:O,target:_.id});const a=bg(n),o=Math.max(...a,1),l=a.map(_=>jt*(.5+_/o*1.2)),c=new Map(n.map((_,O)=>[_.id,l[O]??jt])),d=n.map(_=>{const O=t.get(_.id);return O===void 0?{id:_.id}:i.has(_.id)?{id:_.id,x:O[0],y:O[1],z:O[2],fx:O[0],fy:O[1],fz:O[2]}:{id:_.id,x:O[0],y:O[1],z:O[2]}}),u=_=>i.has(_.id)&&_.fx!==void 0;let h=d,g=r;if(i.size>0){const _=new Set(d.filter(x=>!u(x)).map(x=>x.id));g=r.filter(x=>_.has(x.source)||_.has(x.target));const O=new Set(_);for(const x of g)O.add(x.source),O.add(x.target);h=d.filter(x=>O.has(x.id));const w=new Set(h.map(x=>x.id));g=g.filter(x=>w.has(x.source)&&w.has(x.target))}const p=Si().strength(s.charge?_=>i.has(_.id)?0:-6*((c.get(_.id)??jt)/jt)**2:_=>i.has(_.id)?0:-6);s.reach!==void 0&&p.distanceMax(s.reach);const z=xi(h,e).force("link",sr(g).id(_=>_.id).distance(s.link?_=>(c.get(_.source.id)??jt)+(c.get(_.target.id)??jt)+1.4:2.2)).force("charge",p).stop();if(i.size===0&&z.force("center",e===2?Hi(0,0):Hi(0,0,0)),s.collide&&z.force("collide",Oi().radius(_=>(c.get(_.id)??jt)*1.2)),s.gravity){const _=O=>((c.get(O.id)??jt)/jt)**2*.08;z.force("gx",ku(0).strength(_)).force("gy",Uu(0).strength(_)),e===3&&z.force("gz",Fu(0).strength(_))}const m=h.length===0?0:t.size>0?90:150;let f=0;return{total:m,moving:h.length,step:_=>{for(let O=0;O<_&&f<m;O++,f++)z.tick()},place:()=>n.map((_,O)=>{const w=d[O];return{id:_.id,position:[w?.x??0,w?.y??0,w?.z??0],radius:l[O]??jt}})}}function IS(n,e=3,t=new Map,s=tr,i=new Set){const r=_g(n,e,t,s,i);return r.step(r.total),r.place()}function TS(n,e,t=new Map,s=new Set){const i=zg(n.map(r=>{const a={id:r.id,parents:[...r.parentIds,...r.joinParentIds]};return r.metric!==void 0&&(a.metric=r.metric),a}));return n.map(r=>{const a=t.get(r.id);return{id:r.id,parents:[...r.parentIds,...r.joinParentIds],radius:i.get(r.id)??jt,group:r.ghost===!0?null:e(r),...r.attrs===void 0?{}:{attrs:r.attrs},...a===void 0?{}:{seed:a},...s.has(r.id)?{frozen:!0}:{}}})}const Bf=160,Nf=120,Cf=5,GS=.9,Pf=.3,RS=.9;function wg(n,e){const t=new Map;for(const[s,i]of n)t.set(s,e===0||i/e>RS?0:Math.log(e/Math.max(1,i)));return t}function BS(n,e,t=()=>{}){const s=b=>typeof b.attrs?.plugin=="string"?b.attrs.plugin:null,i=b=>b.attrs?.kind==="star"&&s(b)!==null,r=n.filter(i),a=new Map(r.map(b=>[s(b),b])),o=n.filter(b=>!i(b)),l=new Map;for(const b of o){const A=s(b);b.group===null||A===null||!a.has(A)||l.set(b.group,(l.get(b.group)??new Set).add(A))}const c=new Map;for(const b of l.values())for(const A of b)c.set(A,(c.get(A)??0)+1);const d=wg(c,l.size),u=Math.max(1e-9,...d.values()),h=new Map;for(const b of l.values()){const A=[...b].sort();for(let B=0;B<A.length;B++)for(let N=B+1;N<A.length;N++){const k=`${A[B]}\0${A[N]}`;h.set(k,(h.get(k)??0)+1)}}const g=Math.max(6,Math.sqrt(r.length)*4,Math.sqrt(o.length)*1.6),p=r.map(b=>Lf(b,g,Kr(`star:${b.id}`))),z=[];for(const[b,A]of h){const[B,N]=b.split("\0"),k=Math.min(c.get(B)??1,c.get(N)??1);z.push({source:a.get(B).id,target:a.get(N).id,share:A/Math.max(1,k)})}if(p.length>0&&p.some(b=>b.fx===void 0)){const b=xi(p,3).force("link",sr(z).id(A=>A.id).distance(A=>g*(1.1-Number(A.share))).strength(A=>.05+.6*Number(A.share))).force("charge",Si().strength(-30).distanceMax(g*3)).force("collide",Oi().radius(A=>A.r*3)).force("center",Hi(0,0,0)).stop();for(let A=0;A<Bf;A++)b.tick(),A%4===0&&t(.4*(A/Bf))}const m=new Map(p.map(b=>[b.id,[b.x??0,b.y??0,b.z??0]]));t(.4);const f=[...p.map(b=>({...b,fx:b.x??0,fy:b.y??0,fz:b.z??0})),...o.map(b=>{const A=s(b),B=A===null?void 0:a.get(A),N=B===void 0?void 0:m.get(B.id);return Lf(b,2,Kr(`stage:${b.id}`),N)})],_=new Set(n.map(b=>b.id)),O=new Map(n.map(b=>[b.id,b.radius])),w=[];for(const b of o){for(const L of b.parents)_.has(L)&&w.push({source:L,target:b.id,strength:1,length:(O.get(L)??jt)+b.radius+1.4});const A=s(b),B=A===null?void 0:a.get(A),N=A===null?0:d.get(A)??0,k=b.group===null?1:Math.max(1,l.get(b.group)?.size??1);if(B!==void 0&&N>0){const L=N/u,j=(Pf+(GS-Pf)*L)/Math.sqrt(k);w.push({source:B.id,target:b.id,strength:j,length:B.radius+b.radius+1})}}const x=xi(f,3).force("link",sr(w).id(b=>b.id).distance(b=>Number(b.length)).strength(b=>Number(b.strength))).stop();if(e.charge){const b=Si().strength(A=>-6*(A.r/jt)**2);b.distanceMax(Math.min(e.reach??Cf,Cf)),x.force("charge",b)}e.collide&&x.force("collide",Oi().radius(b=>b.r*1.2));const S=f.some(b=>b.fx===void 0);for(let b=0;S&&b<Nf;b++)x.tick(),b%4===0&&t(.4+.6*(b/Nf));const I={};for(const b of f)I[b.id]=[b.x??0,b.y??0,b.z??0];return t(1),I}function Lf(n,e,t,s=[0,0,0]){const i={id:n.id,r:n.radius},r=n.seed??[s[0]+(t()-.5)*2*e,s[1]+(t()-.5)*2*e,s[2]+(t()-.5)*2*e];return i.x=r[0],i.y=r[1],i.z=r[2],n.frozen===!0&&n.seed!==void 0&&(i.fx=r[0],i.fy=r[1],i.fz=r[2]),i}const Zr=.4,NS=400,Dr=.35,CS=.01,PS=3;function Wf(n,e,t){let s=0,i=0;for(const r of new Set([...n,...e])){const a=t.get(r)??0;i+=a,n.has(r)&&e.has(r)&&(s+=a)}return i===0?0:s/i}const kf=1.4,LS=Math.PI/3;function WS(n,e){const t=new Map,s=new Map(n.map(d=>[d.id,d])),i=new Map,r=[];for(const d of n){const u=d.parents.find(h=>s.has(h));u===void 0?r.push(d):i.set(u,[...i.get(u)??[],d])}const a=new Map,o=[];r.forEach((d,u)=>{const h=qi(e),g=u===0?0:d.radius*2+kf;t.set(d.id,[h[0]*g,h[1]*g,h[2]*g]),a.set(d.id,h),o.push(d)});for(let d=o.shift();d!==void 0;d=o.shift()){const u=t.get(d.id),h=a.get(d.id);for(const g of i.get(d.id)??[]){if(t.has(g.id))continue;const p=e()*LS,z=kS(h,e),m=yg([h[0]*Math.cos(p)+z[0]*Math.sin(p),h[1]*Math.cos(p)+z[1]*Math.sin(p),h[2]*Math.cos(p)+z[2]*Math.sin(p)]),f=d.radius+g.radius+kf;t.set(g.id,[u[0]+m[0]*f,u[1]+m[1]*f,u[2]+m[2]*f]),a.set(g.id,m),o.push(g)}}for(const d of n)t.has(d.id)||t.set(d.id,[0,0,0]);const l=[0,0,0];for(const d of t.values())l[0]+=d[0]/t.size,l[1]+=d[1]/t.size,l[2]+=d[2]/t.size;let c=jt;for(const d of n){const u=t.get(d.id),h=[u[0]-l[0],u[1]-l[1],u[2]-l[2]];t.set(d.id,h),c=Math.max(c,Math.hypot(h[0],h[1],h[2])+d.radius)}return{local:t,radius:c}}function yg(n){const e=Math.max(1e-9,Math.hypot(n[0],n[1],n[2]));return[n[0]/e,n[1]/e,n[2]/e]}function kS(n,e){const t=Math.abs(n[0])<.9?[1,0,0]:[0,1,0],s=yg([n[1]*t[2]-n[2]*t[1],n[2]*t[0]-n[0]*t[2],n[0]*t[1]-n[1]*t[0]]),i=[n[1]*s[2]-n[2]*s[1],n[2]*s[0]-n[0]*s[2],n[0]*s[1]-n[1]*s[0]],r=e()*Math.PI*2;return[s[0]*Math.cos(r)+i[0]*Math.sin(r),s[1]*Math.cos(r)+i[1]*Math.sin(r),s[2]*Math.cos(r)+i[2]*Math.sin(r)]}function qi(n){const e=n()*2-1,t=n()*Math.PI*2,s=Math.sqrt(1-e*e);return[s*Math.cos(t),s*Math.sin(t),e]}class US{size;cells=new Map;constructor(e){this.size=e}key(e){return`${Math.floor(e[0]/this.size)},${Math.floor(e[1]/this.size)},${Math.floor(e[2]/this.size)}`}add(e){const t=this.key(e.centre);this.cells.set(t,[...this.cells.get(t)??[],e])}touching(e,t){const s=[],[i,r,a]=[Math.floor(e[0]/this.size),Math.floor(e[1]/this.size),Math.floor(e[2]/this.size)];for(let o=-1;o<=1;o++)for(let l=-1;l<=1;l++)for(let c=-1;c<=1;c++)for(const d of this.cells.get(`${i+o},${r+l},${a+c}`)??[]){const u=t+d.particle.radius+Zr;Math.hypot(e[0]-d.centre[0],e[1]-d.centre[1],e[2]-d.centre[2])<u&&s.push(d)}return s}}function Uf(n,e,t,s){let i=[e[0]-n.centre[0],e[1]-n.centre[1],e[2]-n.centre[2]];const r=Math.hypot(i[0],i[1],i[2]);i=r<1e-9?qi(s):[i[0]/r,i[1]/r,i[2]/r];const a=t+n.particle.radius+Zr;return[n.centre[0]+i[0]*a,n.centre[1]+i[1]*a,n.centre[2]+i[2]*a]}function FS(n,e,t=()=>{}){const s={},i={};if(n.length>0&&n.every(p=>p.frozen===!0&&p.seed!==void 0)){for(const p of n)s[p.id]=p.seed;return t(1),{positions:s,arrival:i}}const r=new Map;for(const p of n){if(p.group===null){s[p.id]=[0,0,0];continue}r.set(p.group,[...r.get(p.group)??[],p])}const a=[...r].map(([p,z])=>{const m=new Set;let f=Number.POSITIVE_INFINITY;for(const w of z){const x=w.attrs?.plugin;typeof x=="string"&&m.add(x);const S=w.attrs?.createdAt;typeof S=="number"&&S<f&&(f=S)}if(z.every(w=>w.frozen===!0&&w.seed!==void 0)){const w=z.map(b=>b.seed),x=[0,1,2].map(b=>w.reduce((A,B)=>A+B[b],0)/w.length),S=new Map;let I=jt;for(const b of z){const A=b.seed,B=[A[0]-x[0],A[1]-x[1],A[2]-x[2]];S.set(b.id,B),I=Math.max(I,Math.hypot(B[0],B[1],B[2])+b.radius)}return{key:p,nodes:z,plugins:m,created:f,local:S,radius:I,held:!0,centre:x}}const{local:_,radius:O}=WS(z,Kr(`turn:${p}`));return{key:p,nodes:z,plugins:m,created:f,local:_,radius:O,held:!1}});a.sort((p,z)=>p.created-z.created||(p.key<z.key?-1:p.key>z.key?1:0));const o=new Map;for(const p of a)for(const z of p.plugins)o.set(z,(o.get(z)??0)+1);const l=wg(o,a.length),c=Math.max(jt,...a.map(p=>p.radius)),d=new US(2*c+Zr),u=[];let h=0;const g=(p,z,m)=>{const f={particle:p,centre:m};u.push(f),d.add(f),h=Math.max(h,Math.hypot(m[0],m[1],m[2])+p.radius);for(const _ of p.nodes){const O=p.local.get(_.id)??[0,0,0];s[_.id]=p.held&&_.seed!==void 0?_.seed:[m[0]+O[0],m[1]+O[1],m[2]+O[2]],i[_.id]=z}};return a.forEach((p,z)=>{p.held&&p.centre!==void 0&&g(p,z,p.centre)}),a.forEach((p,z)=>{if(p.held)return;const m=Kr(`accrete:${p.key}`);let f;if(u.length===0)f=[0,0,0];else{let _=u[u.length-1],O=-1;for(const A of u){const B=Wf(p.plugins,A.particle.plugins,l);B>=O&&(_=A,O=B)}const w=h+PS*p.radius+c,x=Math.max(.5,p.radius*.5),S=qi(m);let I=[S[0]*w,S[1]*w,S[2]*w],b=null;for(let A=0;A<NS&&b===null;A++){const B=qi(m),N=[_.centre[0]-I[0],_.centre[1]-I[1],_.centre[2]-I[2]],k=Math.max(1e-9,Math.hypot(N[0],N[1],N[2])),L=[B[0]*(1-Dr)+N[0]/k*Dr,B[1]*(1-Dr)+N[1]/k*Dr,B[2]*(1-Dr)+N[2]/k*Dr],j=[I[0]+L[0]*x,I[1]+L[1]*x,I[2]+L[2]*x],P=d.touching(j,p.radius);if(P.length===0){if(Math.hypot(j[0],j[1],j[2])>w*2){const Q=qi(m);I=[Q[0]*w,Q[1]*w,Q[2]*w]}else I=j;continue}let W=P[0],X=-1;for(const Q of P){const re=Wf(p.plugins,Q.particle.plugins,l);re>X&&(W=Q,X=re)}if(m()<Math.max(CS,X)&&(b=Uf(W,I,p.radius,m),d.touching(b,p.radius-1e-6).some(Q=>Q!==W&&vg(b,p.radius,Q))&&(b=null)),b===null){const Q=Uf(W,I,p.radius,m),re=[Q[0]-W.centre[0],Q[1]-W.centre[1],Q[2]-W.centre[2]],Me=Math.max(1e-9,Math.hypot(re[0],re[1],re[2]));I=[Q[0]+re[0]/Me*x,Q[1]+re[1]/Me*x,Q[2]+re[2]/Me*x]}}f=b??jS(_,p.radius,d,m)}g(p,z,f),z%8===0&&t(z/Math.max(1,a.length))}),t(1),{positions:s,arrival:i}}function vg(n,e,t){return Math.hypot(n[0]-t.centre[0],n[1]-t.centre[1],n[2]-t.centre[2])<e+t.particle.radius+Zr*.5}function jS(n,e,t,s){for(let a=0;a<8;a++)for(let o=0;o<24;o++){const l=qi(s),c=e+n.particle.radius+Zr+a*e,d=[n.centre[0]+l[0]*c,n.centre[1]+l[1]*c,n.centre[2]+l[2]*c];if(!t.touching(d,e).some(u=>vg(d,e,u)))return d}const i=qi(s),r=e+n.particle.radius+Zr+8*e;return[n.centre[0]+i[0]*r,n.centre[1]+i[1]*r,n.centre[2]+i[2]*r]}function Og(n){const e=new Map(n.map(p=>[p.id,p])),t=new Map,s=(p,z)=>{const m=t.get(p.id);if(m!==void 0)return m;if(z.has(p.id)||p.parentIds.length===0)return t.set(p.id,0),0;z.add(p.id);let f=0;for(const _ of p.parentIds){const O=e.get(_);O&&(f=Math.max(f,s(O,z)+1))}return t.set(p.id,f),f};for(const p of n)s(p,new Set);const i=new Map,r=[],a=(p,z)=>p.id.localeCompare(z.id,void 0,{numeric:!0});for(const p of n){const z=p.parentIds.find(f=>e.has(f));if(z===void 0){r.push(p);continue}const m=i.get(z)??[];m.push(p),i.set(z,m)}r.sort(a);for(const p of i.values())p.sort(a);const o=new Map;let l=0;const c=new Set,d=p=>{c.add(p.id);const z=(i.get(p.id)??[]).filter(O=>!c.has(O.id));if(z.length===0){const O=l++;return o.set(p.id,O),[O,O]}let m=Number.POSITIVE_INFINITY,f=Number.NEGATIVE_INFINITY;for(const O of z){const[w,x]=d(O);m=Math.min(m,w),f=Math.max(f,x)}const _=(m+f)/2;return o.set(p.id,_),[m,f]};for(const p of r)d(p);for(const p of n)o.has(p.id)||d(p);const u=Math.max(...Array.from(t.values()),0)+1,h=Math.max(l-1,0);return{placements:n.map(p=>({id:p.id,x:o.get(p.id)??0,tier:t.get(p.id)??0})),width:h,tierCount:u}}const $S=2.6,VS=2;function xg(n){const e=n.map(r=>r.metric??0),t=Math.max(...e,0),s=Og(n),i=new Map(s.placements.map(r=>[r.id,r]));return n.map(r=>{const a=i.get(r.id),o=((a?.x??0)-s.width/2)*VS,l=((s.tierCount-1)/2-(a?.tier??0))*$S,c=r.metric??0,d=t>0?.55+c/t*1:1,u=[o,l,0];return{id:r.id,position:u,radius:jt*d}})}const HS=.02;function qS(n){const e=new Map(n.nodes.map(o=>[o.id,o])),t=[],s=new Map;for(const o of n.edges){const l=e.get(o.from),c=e.get(o.to);l===void 0||c===void 0||l.halo||c.halo||(t.push({source:o.from,target:o.to}),s.set(o.from,[...s.get(o.from)??[],o.to]),s.set(o.to,[...s.get(o.to)??[],o.from]))}const i=new Set([n.grabbed]),r=[n.grabbed];for(;r.length>0;){const o=r.pop();for(const l of s.get(o)??[])i.has(l)||e.get(l)?.dim===!0||(i.add(l),r.push(l))}const a=t.filter(o=>i.has(o.source)&&i.has(o.target));return{ids:i,links:a}}class XS{nodes;grabbed;sim;constructor(e){const{ids:t,links:s}=qS(e),i=new Map(e.nodes.map(o=>[o.id,o.radius])),r=o=>i.get(o)??e.baseRadius,a=new Map(e.nodes.map(o=>[o.id,o.position]));this.nodes=[...t].filter(o=>a.has(o)).map(o=>{const[l,c,d]=a.get(o);return{id:o,x:l,y:c,z:d}}),this.sim=xi(this.nodes,e.dimensions).force("link",sr(s).id(o=>o.id).distance(o=>r(o.source.id)+r(o.target.id)+1.4)).force("charge",Si().strength(o=>-6*(r(o.id)/e.baseRadius)**2).distanceMax(12)).force("collide",Oi().radius(o=>r(o.id)*1.2)).alpha(.25).alphaTarget(.08).stop(),this.grabbed=this.nodes.find(o=>o.id===e.grabbed),this.grabbed!==void 0&&(this.grabbed.fx=this.grabbed.x,this.grabbed.fy=this.grabbed.y,this.grabbed.fz=this.grabbed.z)}pin(e){this.grabbed!==void 0&&([this.grabbed.fx,this.grabbed.fy,this.grabbed.fz]=e)}release(){this.grabbed!==void 0&&(this.grabbed.fx=null,this.grabbed.fy=null,this.grabbed.fz=null),this.sim.alphaTarget(0)}step(e){return!e&&this.sim.alpha()<=HS?!1:(this.sim.tick(),!0)}positions(){return this.nodes.map(e=>({id:e.id,position:[e.x,e.y,e.z]}))}}function Gl(n){const e={id:n.id,parents:n.parents,radius:n.radius,group:n.group};return n.seed!==void 0&&(e.seed=n.seed),n.frozen!==void 0&&(e.frozen=n.frozen),e}function Sg(n){const e=n.attrs?.metric;return typeof e=="number"?e:void 0}function Ag(n){const e={};for(const t of n)e[t.id]=t.position;return e}const YS={id:"galaxy",label:"GALAXY",needs:[],run:(n,e)=>({positions:Mg(n.nodes.map(Gl),n.physics,e)})},KS={id:"spokes",label:"SPOKES",needs:[],run:(n,e)=>({positions:ju(n.nodes.map(Gl),n.physics,e,"spokes")})},ZS={id:"clumps",label:"CLUMPS",needs:[],run:(n,e)=>({positions:ju(n.nodes.map(Gl),n.physics,e,"clumps")})},QS={id:"ranked",label:"RANKED",needs:[],run:(n,e)=>{const t=n.nodes.map(i=>{const r={id:i.id,parentIds:i.parents},a=Sg(i);return a!==void 0&&(r.metric=a),r}),s=Ag(xg(t));return e(1),{positions:s}}},JS={id:"molecule",label:"MOLECULE",needs:[],run:(n,e)=>{const t=n.nodes.map(a=>{const o={id:a.id,parents:a.parents},l=Sg(a);return l!==void 0&&(o.metric=l),o}),s=new Map,i=new Set;for(const a of n.nodes)a.seed!==void 0&&s.set(a.id,a.seed),a.frozen===!0&&i.add(a.id);const r=Ag(IS(t,3,s,n.physics,i));return e(1),{positions:r}}},e1={id:"constellations",label:"CONSTELLATIONS",needs:["plugin"],run:(n,e)=>({positions:BS(n.nodes,n.physics,e)})},t1={id:"hubs",label:"HUBS",needs:[],run:(n,e)=>({positions:Mg(n.nodes.map(Gl),n.physics,e)})},s1={id:"accretion",label:"ACCRETION",needs:["plugin"],run:(n,e)=>FS(n.nodes,n.physics,e)},n1=[YS,KS,ZS,e1,t1,s1,QS,JS];function i1(n){return n1.find(e=>e.id===n)}const $o=.16,Ff=.09,Eg=.1,jf=.2,Wr=450,Vn=1200,$f=1800,r1=7,a1=5,o1=300,Vf=.18,Oo=1e3,l1=9,c1=500,Hf=new Ye("#ffffff"),qf=new Map;function Ir(n,e){if("token"in n)return e[n.token];if("hue"in n){let i=qf.get(n.hue);return i===void 0&&(i=new Ye(n.hue),qf.set(n.hue,i)),i}const[t,s]=n.blend;return e[t].clone().lerp(e[s],Math.max(0,Math.min(1,n.share)))}function Dc(n){return 1.6+.45*Math.sqrt(Math.max(1,n))}function d1(n,e,t){const s=Math.PI*(3-Math.sqrt(5)),i=e===1?0:1-2*n/(e-1),r=Math.sqrt(Math.max(0,1-i*i)),a=s*n;return new F(Math.cos(a)*r*t,i*t,Math.sin(a)*r*t)}class u1{byKey=new Map;of(e){const t=Math.round(e*1e3);let s=this.byKey.get(t);return s===void 0&&(s=new El(t/1e3,24,18),s.computeBoundingSphere(),this.byKey.set(t,s)),s}dispose(){for(const e of this.byKey.values())e.dispose();this.byKey.clear()}}const h1=2,f1=28,Dg=1.8,p1=`
4110
4110
  attribute float radius;
4111
4111
  attribute float alpha;
4112
4112
  attribute vec3 tint;
@@ -4158,7 +4158,7 @@ void main() {
4158
4158
  if (d > 1.0) discard;
4159
4159
  float a = smoothstep(1.0, 0.35, d) * vAlpha;
4160
4160
  gl_FragColor = vec4(mix(vTint, vec3(1.0), vFlash * 0.6), a);
4161
- }`;function b1(n,e,t,s,i=!1){const r=new Float32Array(n.length*3),a=new Float32Array(n.length*3),o=new Float32Array(n.length),l=new Float32Array(n.length);n.forEach((p,z)=>{p.layer=t,p.slot=z,r.set([p.position.x,p.position.y,p.position.z],z*3),a.set([p.color.r,p.color.g,p.color.b],z*3),o[z]=p.radius,l[z]=p.dim?$o*1.5:1});const c=new ds;c.setAttribute("position",new ws(r,3)),c.setAttribute("tint",new ws(a,3)),c.setAttribute("radius",new ws(o,1));const d=new ws(l,1);c.setAttribute("alpha",d);const u=new ws(new Float32Array(n.length),1);c.setAttribute("flash",u);const h=new hs({uniforms:{scale:{value:1},floorPx:{value:h1*s},capPx:{value:f1*s}},vertexShader:p1,fragmentShader:i?g1:e?M1:m1,transparent:!0,depthWrite:!1,blending:e||i?$i:Qi}),g=new Qz(c,h);return g.renderOrder=i?3:e?2:1,g.frustumCulled=!1,{points:g,material:h,alpha:d,base:Float32Array.from(l),flash:u}}function z1(n,e){return n/(2*Math.tan(e*Math.PI/360))}let xo=null;function Ig(){if(xo!==null)return xo;const n=document.createElement("canvas");n.width=128,n.height=128;const e=n.getContext("2d");if(e!==null){const t=e.createRadialGradient(64,64,0,64,64,64);t.addColorStop(0,"rgba(255,255,255,1)"),t.addColorStop(.35,"rgba(255,255,255,0.45)"),t.addColorStop(1,"rgba(255,255,255,0)"),e.fillStyle=t,e.fillRect(0,0,128,128)}return xo=new Km(n),xo}class _1{parent;stars=[];index=new Map;nebulaList=[];materials=[];layers=[];threads=null;nebulaSprites=new Map;starsById=null;starsTouched=!1;threadsTouched=!1;constructor(e){this.parent=e}count(){return this.stars.length}list(){return this.stars}entry(e){const t=this.index.get(e);return t===void 0?void 0:this.stars[t]}ids(){return this.index.keys()}nebulae(){return this.nebulaList}draw(e,t,s,i){for(const r of e)this.index.has(r.id)||this.index.set(r.id,this.stars.length),this.stars.push(r);this.starsById=null;for(const[r,a]of[[!1,!1],[!0,!1],[!1,!0]]){const o=e.filter(c=>c.ring===!0===a&&(a||c.ember===r));if(o.length===0)continue;const l=b1(o,r,this.layers.length,t,a);this.layers.push({alpha:l.alpha,base:l.base,flash:l.flash}),this.parent.add(l.points),this.materials.push(l.material)}this.scale_update(s,i)}scale_update(e,t){if(this.materials.length===0)return;const s=z1(e,t);for(const i of this.materials){const r=i.uniforms.scale;r!==void 0&&(r.value=s)}}threads_draw(e,t,s=[]){if(e.length===0)return;const i=new ds;i.setAttribute("position",new Xt(e,3));const r=new Xt(t,3);i.setAttribute("color",r),this.threads={attribute:r,base:Float32Array.from(t),ends:s},this.parent.add(new Xm(i,new Hr({vertexColors:!0,transparent:!0,opacity:Eg,blending:Qi,depthWrite:!1})))}nebula_add(e,t,s,i,r){const a=new xu(new xl({map:Ig(),color:i,transparent:!0,opacity:r?jf/3:jf,blending:Qi,depthWrite:!1}));a.position.copy(t),a.scale.setScalar(s*2),a.renderOrder=0,this.parent.add(a),this.nebulaList.push({id:e,position:t.clone(),radius:s}),this.nebulaSprites.set(e,{material:a.material,base:a.material.opacity})}stars_fade(e,t){for(const s of e){const i=s.layer===void 0?void 0:this.layers[s.layer];i===void 0||s.slot===void 0||(i.alpha.setX(s.slot,(i.base[s.slot]??1)*t),this.starsTouched=!0)}}threads_fade(e,t){if(this.threads===null||e.length===0)return;const s=this.threads.attribute.array,i=this.threads.base;for(const r of e)for(let a=r*6;a<r*6+6;a++)s[a]=(i[a]??0)*t;this.threadsTouched=!0}flush(){if(this.starsTouched)for(const e of this.layers)e.alpha.needsUpdate=!0;this.threadsTouched&&this.threads!==null&&(this.threads.attribute.needsUpdate=!0),this.starsTouched=!1,this.threadsTouched=!1}clear(){this.stars=[],this.index=new Map,this.nebulaList=[],this.materials=[],this.layers=[],this.threads=null,this.nebulaSprites=new Map,this.starsById=null,this.starsTouched=!1,this.threadsTouched=!1}presence_set(e,t){for(const s of e){for(const r of this.stars_of(s)){const a=r.layer===void 0?void 0:this.layers[r.layer];a===void 0||r.slot===void 0||(a.alpha.setX(r.slot,(a.base[r.slot]??1)*t),this.starsTouched=!0)}const i=this.nebulaSprites.get(s);i!==void 0&&(i.material.opacity=i.base*t)}}flash_set(e,t){for(const s of this.stars_of(e)){const i=s.layer===void 0?void 0:this.layers[s.layer];i===void 0||s.slot===void 0||(i.flash.setX(s.slot,t),i.flash.needsUpdate=!0)}}threads_present(e){const t=this.threads;if(t===null||t.ends.length===0)return;const s=t.attribute.array,i=t.ends.length/2;for(let r=0;r<i;r++){const a=e(t.ends[r*2]??"")&&e(t.ends[r*2+1]??"")?1:0;for(let o=r*6;o<r*6+6;o++)s[o]=(t.base[o]??0)*a}this.threadsTouched=!0}stars_of(e){if(this.starsById===null){this.starsById=new Map;for(const t of this.stars)this.starsById.set(t.id,[...this.starsById.get(t.id)??[],t])}return this.starsById.get(e)??[]}}class w1{parent;geometries=new u1;byId=new Map;edges=[];constructor(e){this.parent=e}get map(){return this.byId}sphere_add(e,t,s,i){const r=i.flat===!0?new Du(s,36):this.geometries.of(s),a=new Vi({color:i.color,roughness:.35,metalness:.15,emissive:i.selected===!0?new Ke("#ffffff"):new Ke("#000000"),emissiveIntensity:i.selected===!0?.35:0,...i.dim===!0?{transparent:!0,opacity:$o}:{},...i.fade!==void 0?{transparent:!0,opacity:i.fade}:{}}),o=new Us(r,a);return o.position.copy(t),o.userData.nodeId=e,o.userData.dim=i.dim===!0,this.parent.add(o),this.byId.set(e,o),o}halo_add(e,t,s,i,r){const a=new Us(new El(s,24,18),new Su({color:i,transparent:!0,opacity:r?Ff*.4:Ff,depthWrite:!1}));a.position.copy(t),a.renderOrder=1,a.userData.nodeId=e,a.userData.halo=!0,a.userData.dim=r,this.parent.add(a),this.byId.set(e,a)}edge_add(e,t,s,i,r,a,o=!1){const l=new ds().setFromPoints([s,i]);let c;a?(c=new Zd(l,new o_({color:r,dashSize:.25,gapSize:.18,transparent:!0,opacity:o?$o:.9})),c.computeLineDistances()):c=new Zd(l,new Hr({color:r,transparent:!0,opacity:o?$o:.75})),this.parent.add(c),this.edges.push({line:c,fromId:e,toId:t,dashed:a})}edges_follow(){for(const e of this.edges){const t=this.byId.get(e.fromId),s=this.byId.get(e.toId);t===void 0||s===void 0||(e.line.geometry.setFromPoints([t.position,s.position]),e.dashed&&e.line.computeLineDistances())}}recolor(e,t){const s=this.byId.get(e);s===void 0||!(s.material instanceof Vi)||(s.material.color=t,delete s.userData.lampBase)}select(e){for(const[t,s]of this.byId){if(!(s.material instanceof Vi))continue;const i=t===e;s.material.emissive.set(i?"#ffffff":"#000000"),s.material.emissiveIntensity=i?.35:0}}remove(e){this.parent.remove(e),e.material instanceof ni&&e.material.dispose();const t=e.userData.nodeId;typeof t=="string"&&this.byId.get(t)===e&&this.byId.delete(t)}clear(){this.byId=new Map,this.edges=[]}dispose(){this.geometries.dispose()}}const y1=2e4,Tg=`
4161
+ }`;function b1(n,e,t,s,i=!1){const r=new Float32Array(n.length*3),a=new Float32Array(n.length*3),o=new Float32Array(n.length),l=new Float32Array(n.length);n.forEach((p,z)=>{p.layer=t,p.slot=z,r.set([p.position.x,p.position.y,p.position.z],z*3),a.set([p.color.r,p.color.g,p.color.b],z*3),o[z]=p.radius,l[z]=p.dim?$o*1.5:1});const c=new ds;c.setAttribute("position",new ws(r,3)),c.setAttribute("tint",new ws(a,3)),c.setAttribute("radius",new ws(o,1));const d=new ws(l,1);c.setAttribute("alpha",d);const u=new ws(new Float32Array(n.length),1);c.setAttribute("flash",u);const h=new hs({uniforms:{scale:{value:1},floorPx:{value:h1*s},capPx:{value:f1*s}},vertexShader:p1,fragmentShader:i?g1:e?M1:m1,transparent:!0,depthWrite:!1,blending:e||i?$i:Qi}),g=new Qz(c,h);return g.renderOrder=i?3:e?2:1,g.frustumCulled=!1,{points:g,material:h,alpha:d,base:Float32Array.from(l),flash:u}}function z1(n,e){return n/(2*Math.tan(e*Math.PI/360))}let xo=null;function Ig(){if(xo!==null)return xo;const n=document.createElement("canvas");n.width=128,n.height=128;const e=n.getContext("2d");if(e!==null){const t=e.createRadialGradient(64,64,0,64,64,64);t.addColorStop(0,"rgba(255,255,255,1)"),t.addColorStop(.35,"rgba(255,255,255,0.45)"),t.addColorStop(1,"rgba(255,255,255,0)"),e.fillStyle=t,e.fillRect(0,0,128,128)}return xo=new Km(n),xo}class _1{parent;stars=[];index=new Map;nebulaList=[];materials=[];layers=[];threads=null;nebulaSprites=new Map;starsById=null;starsTouched=!1;threadsTouched=!1;constructor(e){this.parent=e}count(){return this.stars.length}list(){return this.stars}entry(e){const t=this.index.get(e);return t===void 0?void 0:this.stars[t]}ids(){return this.index.keys()}nebulae(){return this.nebulaList}draw(e,t,s,i){for(const r of e)this.index.has(r.id)||this.index.set(r.id,this.stars.length),this.stars.push(r);this.starsById=null;for(const[r,a]of[[!1,!1],[!0,!1],[!1,!0]]){const o=e.filter(c=>c.ring===!0===a&&(a||c.ember===r));if(o.length===0)continue;const l=b1(o,r,this.layers.length,t,a);this.layers.push({alpha:l.alpha,base:l.base,flash:l.flash}),this.parent.add(l.points),this.materials.push(l.material)}this.scale_update(s,i)}scale_update(e,t){if(this.materials.length===0)return;const s=z1(e,t);for(const i of this.materials){const r=i.uniforms.scale;r!==void 0&&(r.value=s)}}threads_draw(e,t,s=[]){if(e.length===0)return;const i=new ds;i.setAttribute("position",new Xt(e,3));const r=new Xt(t,3);i.setAttribute("color",r),this.threads={attribute:r,base:Float32Array.from(t),ends:s},this.parent.add(new Xm(i,new Hr({vertexColors:!0,transparent:!0,opacity:Eg,blending:Qi,depthWrite:!1})))}nebula_add(e,t,s,i,r){const a=new xu(new xl({map:Ig(),color:i,transparent:!0,opacity:r?jf/3:jf,blending:Qi,depthWrite:!1}));a.position.copy(t),a.scale.setScalar(s*2),a.renderOrder=0,this.parent.add(a),this.nebulaList.push({id:e,position:t.clone(),radius:s}),this.nebulaSprites.set(e,{material:a.material,base:a.material.opacity})}stars_fade(e,t){for(const s of e){const i=s.layer===void 0?void 0:this.layers[s.layer];i===void 0||s.slot===void 0||(i.alpha.setX(s.slot,(i.base[s.slot]??1)*t),this.starsTouched=!0)}}threads_fade(e,t){if(this.threads===null||e.length===0)return;const s=this.threads.attribute.array,i=this.threads.base;for(const r of e)for(let a=r*6;a<r*6+6;a++)s[a]=(i[a]??0)*t;this.threadsTouched=!0}flush(){if(this.starsTouched)for(const e of this.layers)e.alpha.needsUpdate=!0;this.threadsTouched&&this.threads!==null&&(this.threads.attribute.needsUpdate=!0),this.starsTouched=!1,this.threadsTouched=!1}clear(){this.stars=[],this.index=new Map,this.nebulaList=[],this.materials=[],this.layers=[],this.threads=null,this.nebulaSprites=new Map,this.starsById=null,this.starsTouched=!1,this.threadsTouched=!1}presence_set(e,t){for(const s of e){for(const r of this.stars_of(s)){const a=r.layer===void 0?void 0:this.layers[r.layer];a===void 0||r.slot===void 0||(a.alpha.setX(r.slot,(a.base[r.slot]??1)*t),this.starsTouched=!0)}const i=this.nebulaSprites.get(s);i!==void 0&&(i.material.opacity=i.base*t)}}flash_set(e,t){for(const s of this.stars_of(e)){const i=s.layer===void 0?void 0:this.layers[s.layer];i===void 0||s.slot===void 0||(i.flash.setX(s.slot,t),i.flash.needsUpdate=!0)}}threads_present(e){const t=this.threads;if(t===null||t.ends.length===0)return;const s=t.attribute.array,i=t.ends.length/2;for(let r=0;r<i;r++){const a=e(t.ends[r*2]??"")&&e(t.ends[r*2+1]??"")?1:0;for(let o=r*6;o<r*6+6;o++)s[o]=(t.base[o]??0)*a}this.threadsTouched=!0}stars_of(e){if(this.starsById===null){this.starsById=new Map;for(const t of this.stars)this.starsById.set(t.id,[...this.starsById.get(t.id)??[],t])}return this.starsById.get(e)??[]}}class w1{parent;geometries=new u1;byId=new Map;edges=[];constructor(e){this.parent=e}get map(){return this.byId}sphere_add(e,t,s,i){const r=i.flat===!0?new Du(s,36):this.geometries.of(s),a=new Vi({color:i.color,roughness:.35,metalness:.15,emissive:i.selected===!0?new Ye("#ffffff"):new Ye("#000000"),emissiveIntensity:i.selected===!0?.35:0,...i.dim===!0?{transparent:!0,opacity:$o}:{},...i.fade!==void 0?{transparent:!0,opacity:i.fade}:{}}),o=new Us(r,a);return o.position.copy(t),o.userData.nodeId=e,o.userData.dim=i.dim===!0,this.parent.add(o),this.byId.set(e,o),o}halo_add(e,t,s,i,r){const a=new Us(new El(s,24,18),new Su({color:i,transparent:!0,opacity:r?Ff*.4:Ff,depthWrite:!1}));a.position.copy(t),a.renderOrder=1,a.userData.nodeId=e,a.userData.halo=!0,a.userData.dim=r,this.parent.add(a),this.byId.set(e,a)}edge_add(e,t,s,i,r,a,o=!1){const l=new ds().setFromPoints([s,i]);let c;a?(c=new Zd(l,new o_({color:r,dashSize:.25,gapSize:.18,transparent:!0,opacity:o?$o:.9})),c.computeLineDistances()):c=new Zd(l,new Hr({color:r,transparent:!0,opacity:o?$o:.75})),this.parent.add(c),this.edges.push({line:c,fromId:e,toId:t,dashed:a})}edges_follow(){for(const e of this.edges){const t=this.byId.get(e.fromId),s=this.byId.get(e.toId);t===void 0||s===void 0||(e.line.geometry.setFromPoints([t.position,s.position]),e.dashed&&e.line.computeLineDistances())}}recolor(e,t){const s=this.byId.get(e);s===void 0||!(s.material instanceof Vi)||(s.material.color=t,delete s.userData.lampBase)}select(e){for(const[t,s]of this.byId){if(!(s.material instanceof Vi))continue;const i=t===e;s.material.emissive.set(i?"#ffffff":"#000000"),s.material.emissiveIntensity=i?.35:0}}remove(e){this.parent.remove(e),e.material instanceof ni&&e.material.dispose();const t=e.userData.nodeId;typeof t=="string"&&this.byId.get(t)===e&&this.byId.delete(t)}clear(){this.byId=new Map,this.edges=[]}dispose(){this.geometries.dispose()}}const y1=2e4,Tg=`
4162
4162
  attribute vec3 aColor;
4163
4163
  attribute float aMode;
4164
4164
  attribute float aStart;
@@ -4203,7 +4203,7 @@ void main() {
4203
4203
  if (head > -0.1 && head < 1.2) pulse = smoothstep(0.14, 0.0, abs(vAlong - head));
4204
4204
  }
4205
4205
  gl_FragColor = vec4(base + vec3(1.0, 0.95, 0.8) * pulse * 1.3, opacity);
4206
- }`;let Ic=null;function iu(){return Ic===null&&(Ic=new Iu(1,1,1,10,1,!0)),Ic}function v1(n,e){const t=performance.now(),s=new hs({uniforms:{time:{value:t},opacity:{value:1},born:{value:t},cycle:{value:e}},vertexShader:Tg,fragmentShader:Gg,transparent:!0}),i=iu().clone(),r=new Float32Array(n.length*3),a=new Float32Array(n.length),o=new Float32Array(n.length),l=new Au(i,s,n.length),c=new U(0,1,0),d=new ss;return n.forEach((u,h)=>{const g=u.to.clone().sub(u.from),p=g.length();d.position.copy(u.from).addScaledVector(g,.5),d.quaternion.setFromUnitVectors(c,p>0?g.divideScalar(p):c),d.scale.set(u.width,p,u.width),d.updateMatrix(),l.setMatrixAt(h,d.matrix),r.set([u.color.r,u.color.g,u.color.b],h*3),a[h]=u.mode,o[h]=u.start}),i.setAttribute("aColor",new vi(r,3)),i.setAttribute("aMode",new vi(a,1)),i.setAttribute("aStart",new vi(o,1)),l.instanceMatrix.needsUpdate=!0,l.frustumCulled=!1,l}function Rg(n){return n==="live"?1:n==="done"||n==="failed"?2:0}class O1{host;sets=[];materials=[];glows=new Map;stale=!1;census=0;constructor(e){this.host=e}materialCount(){return this.materials.length}censusCount(){return this.census}holds(e){return this.sets.some(t=>t.members.has(e))}stale_mark(){this.stale=!0}build(e,t,s){const i=e.mix,r=this.host.palette(),a=[];for(const S of t){const I=this.host.node(S);if(I!==void 0){for(const b of I.parents){const A=this.host.node(b);A!==void 0&&s.has(b)&&a.push({fromId:b,from:A,toId:S,to:I,join:!1})}for(const b of I.joins){const A=this.host.node(b);A!==void 0&&s.has(b)&&a.push({fromId:b,from:A,toId:S,to:I,join:!0})}}}if(a.length===0)return;const o=new Map,l=(S,I=new Set)=>{const b=o.get(S);if(b!==void 0)return b;if(I.has(S))return 0;I.add(S);const A=this.host.node(S),B=A===void 0?[]:[...A.parents,...A.joins].filter(k=>s.has(k)),N=B.length===0?0:1+Math.max(...B.map(k=>l(k,I)));return o.set(S,N),N},c=performance.now(),d=new Float32Array(a.length*3),u=new Float32Array(a.length),h=new Float32Array(a.length),g=r.edge.clone().lerp(new Ke("#ffffff"),.45),p=new Au(iu(),new hs({uniforms:{time:{value:c},opacity:{value:i},born:{value:c},cycle:{value:1}},vertexShader:Tg,fragmentShader:Gg,transparent:!0}),a.length),z=new U(0,1,0),m=new ss;let f=0;const _=[],O=new Map,w=new Set;a.forEach(({fromId:S,from:I,toId:b,to:A,join:B},N)=>{const k=A.position.clone().sub(I.position),L=k.length(),F=Math.max(.06,Math.min(I.radius,A.radius)*.34);m.position.copy(I.position).addScaledVector(k,.5),m.quaternion.setFromUnitVectors(z,L>0?k.clone().divideScalar(L):z),m.scale.set(F,L,F),m.updateMatrix(),p.setMatrixAt(N,m.matrix),_.push({from:S,to:b,width:F});const P=A.state==="failed"?r.error:B?r.join:g;d.set([P.r,P.g,P.b],N*3),u[N]=Rg(A.state);const W=l(S);if(f=Math.max(f,W),h[N]=W*Wr,u[N]===1&&w.add(b),u[N]===2){const X=h[N]+Vn/2;O.set(b,Math.min(O.get(b)??1/0,X)),W===0&&O.set(S,0)}}),p.instanceMatrix.needsUpdate=!0;const x=iu().clone();if(x.setAttribute("aColor",new vi(d,3)),x.setAttribute("aMode",new vi(u,1)),x.setAttribute("aStart",new vi(h,1)),p.geometry=x,p.frustumCulled=!1,this.host.parent.add(p),e.tubes=p,p.material instanceof hs){this.materials.push(p.material);const S=p.material.uniforms.cycle;S!==void 0&&(S.value=(f+1)*Wr+Vn/2+$f)}this.sets.push({mesh:p,edges:_,lamps:O,blinks:w,owner:e,entries:t,members:s})}census_build(e,t){if(e.length===0)return;const s=v1(e,(t+1)*Wr+Vn/2+$f);this.host.parent.add(s),s.material instanceof hs&&this.materials.push(s.material),this.census=e.length}frame(e){if(this.materials.length!==0){for(const t of this.materials){const s=t.uniforms.time;s!==void 0&&(s.value=e)}this.stale&&this.restatus(),this.lamps_animate(e)}}follow(){const e=new U(0,1,0),t=new ss;for(const{mesh:s,edges:i}of this.sets)i.forEach(({from:r,to:a,width:o},l)=>{const c=this.host.sphere(r),d=this.host.sphere(a);if(c===void 0||d===void 0)return;const u=d.position.clone().sub(c.position),h=u.length();t.position.copy(c.position).addScaledVector(u,.5),t.quaternion.setFromUnitVectors(e,h>0?u.clone().divideScalar(h):e),t.scale.set(o,h,o),t.updateMatrix(),s.setMatrixAt(l,t.matrix)}),s.instanceMatrix.needsUpdate=!0}release(e){if(this.host.parent.remove(e),this.sets=this.sets.filter(t=>t.mesh!==e),e.geometry.dispose(),e.material instanceof hs){const t=e.material;this.materials=this.materials.filter(s=>s!==t),t.dispose()}}clear(){this.materials=[],this.census=0,this.sets=[];for(const e of this.glows.values())e.material.dispose();this.glows=new Map}restatus(){this.stale=!1;const e=this.sets;this.sets=[];for(const t of e){if(this.host.parent.remove(t.mesh),t.mesh.geometry.dispose(),t.mesh.material instanceof hs){const s=t.mesh.material;this.materials=this.materials.filter(i=>i!==s),s.dispose()}t.owner.tubes=null,this.build(t.owner,t.entries,t.members)}this.follow()}lamps_animate(e){const t=new Set;for(const{mesh:s,lamps:i,blinks:r}of this.sets){if(i.size===0&&r.size===0||!(s.material instanceof hs))continue;const a=Number(s.material.uniforms.born?.value??e),o=Number(s.material.uniforms.cycle?.value??1),l=((e-a)%o+o)%o,c=Math.min(1,Math.max(0,(o-l)/c1));for(const[u,h]of i){const g=l-h;this.lamp_paint(u,g<0?0:c,g>=0&&g<Oo?g/Oo:-1,t)}const d=(e%Vn+Vn)%Vn;for(const u of r){if(i.has(u))continue;const h=Math.max(0,1-d/(Vn*.8));this.lamp_paint(u,h*h,d<Oo?d/Oo:-1,t)}}for(const[s,i]of this.glows)t.has(s)||(i.visible=!1,this.host.sphere(s)===void 0&&(this.host.parent.remove(i),i.material.dispose(),this.glows.delete(s)))}lamp_paint(e,t,s,i){const r=this.host.sphere(e);if(r===void 0||!(r.material instanceof Vi))return;let a=r.userData.lampBase;a instanceof Ke||(a=r.material.color.clone(),r.userData.lampBase=a);const o=s<0?0:(1-s)**2;if(r.material.color.copy(a).multiplyScalar(Vf+(1-Vf)*Math.max(t,o)).lerp(Hf,Math.min(1,.22*t+.7*o)),s<0)return;let l=this.glows.get(e);l===void 0&&(l=new xu(new xl({map:Ig(),color:a.clone().lerp(Hf,.35),transparent:!0,blending:Qi,depthWrite:!1})),this.glows.set(e,l),this.host.parent.add(l));const c=r.geometry.parameters?.radius??.55,d=1-(1-s)**3;l.position.copy(r.position),l.scale.setScalar(c*(2+l1*d)*r.scale.x),l.material.opacity=.9*(1-s)**1.5,l.visible=!0,i.add(e)}}class x1{host;groups=new Map;lastAt=0;constructor(e){this.host=e}size(){return this.groups.size}solidCount(){let e=0;for(const t of this.groups.values())t.mix>0&&(e+=1);return e}gather(e,t){for(const s of e){if(s.dim)continue;const i=t(s.id);if(i===null)continue;let r=this.groups.get(i);r===void 0&&(r={entries:[],center:new U,maxRadius:0,mix:0,target:0,meshes:[],tubes:null,threadSegments:[]},this.groups.set(i,r)),r.entries.push(s),r.maxRadius=Math.max(r.maxRadius,s.radius)}for(const s of this.groups.values()){for(const i of s.entries)s.center.add(i.position);s.center.divideScalar(Math.max(1,s.entries.length))}}thread_note(e,t){this.groups.get(e)?.threadSegments.push(t)}step(e,t,s){if(this.groups.size===0)return;const i=this.lastAt===0?0:Math.min(100,s-this.lastAt);this.lastAt=s;const r=e.elements;for(const a of this.groups.values()){let o=1/0;for(const d of a.entries){const u=d.position,h=-(r[2]*u.x+r[6]*u.y+r[10]*u.z+r[14]);h>0&&h<o&&(o=h)}const l=o===1/0?0:2*a.maxRadius*t/o;if(a.target===0&&l>r1?a.target=1:a.target===1&&l<a1&&(a.target=0),a.mix===a.target)continue;const c=i===0?1:i/o1;a.mix=a.target>a.mix?Math.min(1,a.mix+c):Math.max(0,a.mix-c),a.mix>0&&a.meshes.length===0&&this.solid_build(a);for(const d of a.meshes)d.material instanceof Vi&&(d.material.opacity=a.mix);if(a.tubes!==null&&a.tubes.material instanceof hs){const d=a.tubes.material.uniforms.opacity;d!==void 0&&(d.value=a.mix)}this.host.stars.stars_fade(a.entries,1-a.mix),this.host.stars.threads_fade(a.threadSegments,1-a.mix),a.mix===0&&this.solid_release(a)}this.host.stars.flush()}clear(){this.groups=new Map}solid_build(e){const t=new Set(e.entries.map(s=>s.id));for(const s of e.entries){const i=this.host.look(s.id);i!==void 0&&e.meshes.push(this.host.spheres.sphere_add(s.id,i.position,i.radius,{color:i.color,fade:e.mix}))}this.host.tubes.build(e,e.entries.map(s=>s.id),t)}solid_release(e){for(const t of e.meshes)this.host.spheres.remove(t);e.tubes!==null&&(this.host.tubes.release(e.tubes),e.tubes=null),e.meshes=[]}}class S1{host;mesh=null;base=null;memberIds=[];memberPositions=[];constructor(e){this.host=e}drawn(){return this.mesh!==null}ids(){return this.memberIds}positions(){return this.memberPositions}build(e,t,s){let i=0;for(const _ of e)_.ghost!==!0&&(i+=Math.max(1,_.count));const r=new Gu(1,1),a=new Vi({color:"#ffffff",roughness:.5,metalness:.1}),o=[],l=new Au(r,a,t?1:i),c=new Ke,d=new ss,u=new Map,h=new Map;let g=0,p=1;const z=new U;for(const _ of e)z.add(_.position);z.divideScalar(Math.max(1,e.length));for(const _ of e){if(_.ghost===!0)continue;const O=Math.max(1,_.count),w=O===1?0:_.radius*(1.6+.55*Math.cbrt(O)),x=O===1?_.radius:Math.max(.06,Math.min(_.radius*.5,2.2*w/Math.sqrt(O))),S=[];for(let I=0;I<O;I++){const b=O===1?_.position.clone():d1(I,O,w).add(_.position);S.push(b),c.set(_.color),t?o.push({id:_.id,position:b,radius:x,color:c.clone(),dim:_.dim,ember:_.ember}):(d.position.copy(b),d.scale.setScalar(x),d.updateMatrix(),l.setMatrixAt(g,d.matrix),l.setColorAt(g,c)),this.memberIds.push(_.id),this.memberPositions.push(b),g+=1,p=Math.max(p,z.distanceTo(b)+x)}u.set(_.id,S),h.set(_.id,x)}if(t){const _=this.host.starsView();this.host.stars.draw(o,_.pixelRatio,_.heightPx,_.fovDeg)}else l.instanceColor&&(l.instanceColor.needsUpdate=!0),this.host.parent.add(l),this.mesh=l,this.base=l.instanceColor?Float32Array.from(l.instanceColor.array):null;const m=[];for(const _ of e){const O=u.get(_.id)??[];for(const w of _.parents){const x=u.get(w);if(!(!x||x.length===0))for(let S=0;S<O.length;S++){const I=O[S],b=x.length===O.length?x[S]:x[S%x.length];I===void 0||b===void 0||m.push(I.x,I.y,I.z,b.x,b.y,b.z)}}}const f=m.length/6;if(!t&&f>0&&f<=y1)this.tubes_build(e,u,h,s);else if(m.length>0){const _=new ds;_.setAttribute("position",new Xt(m,3)),this.host.parent.add(new Xm(_,t?new Hr({color:s.edge,transparent:!0,opacity:Eg,blending:Qi,depthWrite:!1}):new Hr({color:s.edge,transparent:!0,opacity:.35})))}return{center:z,radius:p}}flare(e,t,s,i){let r=0;if(this.mesh===null||this.base===null||!this.mesh.instanceColor)return r;const a=this.mesh.instanceColor.array,o=this.base;for(let l=0;l<this.memberIds.length;l++){const c=e(this.memberIds[l]??"");if(c===void 0)continue;r=Math.max(r,c);const d=t-c,u=d>=0&&d<=i?Math.sin(d/i*Math.PI):0,h=l*3;a[h]=o[h]+(s.r-o[h])*u,a[h+1]=o[h+1]+(s.g-o[h+1])*u,a[h+2]=o[h+2]+(s.b-o[h+2])*u}return this.mesh.instanceColor.needsUpdate=!0,r}pick(e){if(this.mesh===null)return null;const t=e.intersectObject(this.mesh)[0];return t===void 0||t.instanceId===void 0?null:(this.mesh.setColorAt(t.instanceId,new Ke("#ffffff")),this.mesh.instanceColor&&(this.mesh.instanceColor.needsUpdate=!0),this.memberIds[t.instanceId]??null)}clear(){this.mesh=null,this.base=null,this.memberIds=[],this.memberPositions=[]}tubes_build(e,t,s,i){const r=new Map(e.map(u=>[u.id,u])),a=new Map,o=(u,h=new Set)=>{const g=a.get(u);if(g!==void 0)return g;if(h.has(u))return 0;h.add(u);const p=(r.get(u)?.parents??[]).filter(m=>r.has(m)),z=p.length===0?0:1+Math.max(...p.map(m=>o(m,h)));return a.set(u,z),z},l=i.edge.clone().lerp(new Ke("#ffffff"),.45),c=[];let d=0;for(const u of e){const h=t.get(u.id)??[];for(const g of u.parents){const p=t.get(g);if(!p||p.length===0)continue;const z=Math.max(.02,Math.min(s.get(u.id)??.1,s.get(g)??.1)*.34),m=o(g)*Wr;d=Math.max(d,o(g));for(let f=0;f<h.length;f++){const _=h[f],O=p.length===h.length?p[f]:p[f%p.length];O===void 0||_===void 0||c.push({from:O,to:_,width:z,color:u.state==="failed"?i.error:l,mode:Rg(u.state),start:m})}}}this.host.tubes.census_build(c,d)}}const Xf=.028,A1=.25,E1="rgba(0, 0, 0, 0.7)",ya=48;class D1{parent;captions=new Map;shown=!0;constructor(e){this.parent=e}count(){return this.captions.size}caption_add(e,t,s,i,r,a,o=0){const l=document.createElement("canvas"),c=l.getContext("2d"),d=`600 ${ya}px sans-serif`;let u=t.length*ya*.6;if(c!==null&&(c.font=d,u=Math.ceil(c.measureText(t).width)),l.width=Math.max(1,u+ya),l.height=Math.round(ya*1.5),c!==null){c.font=d,c.textBaseline="middle";const z=l.height/4;c.fillStyle=E1,c.beginPath(),c.roundRect(0,0,l.width,l.height,z),c.fill(),c.fillStyle=`#${r.getHexString()}`,c.fillText(t,ya/2,l.height/2)}const h=new Km(l),g=new xl({map:h,transparent:!0,depthWrite:!1,depthTest:!1,sizeAttenuation:!1,opacity:a?A1:.9}),p=new xu(g);p.scale.set(Xf*(l.width/l.height),Xf,1),p.center.set(.5,0),p.position.set(s.x,s.y+i,s.z),p.renderOrder=4,p.visible=this.shown,this.parent.add(p),this.captions.get(e)?.texture.dispose(),this.captions.set(e,{sprite:p,texture:h,rank:o})}declutter(e){if(!this.shown)return 0;const t=[...this.captions.values()].sort((o,l)=>l.rank-o.rank),s=[],i=new U,r=e.projectionMatrix.elements[0]??1,a=e.projectionMatrix.elements[5]??1;for(const o of t){if(o.sprite.getWorldPosition(i).project(e),i.z>1){o.sprite.visible=!1;continue}const l=o.sprite.scale.x*r/2,c={left:i.x-l,right:i.x+l,bottom:i.y,top:i.y+o.sprite.scale.y*a},d=s.some(u=>c.left<u.right&&u.left<c.right&&c.bottom<u.top&&u.bottom<c.top);o.sprite.visible=!d,d||s.push(c)}return s.length}shown_set(e){if(this.shown=e,!e)for(const t of this.captions.values())t.sprite.visible=!1}shown_get(){return this.shown}clear(){for(const e of this.captions.values())e.texture.dispose();this.captions=new Map}}const I1=.0022,T1=.006,G1=.0035,R1=1e4,Yf=700,Kf=new U(0,1,0),B1={minDistance:8,margin:1.15,stance:"axis",farFloor:200,farScale:2};function N1(n){return n*n*(3-2*n)}class C1{camera;world;clock;focus=new U;flight=null;home=null;holding=!1;touched=!1;spinIdleUntil=0;tumbleAxis=new U(0,1,0);tumblePhase;constructor(e,t,s=Date.now,i=Math.random()*Math.PI*2){this.camera=e,this.world=t,this.clock=s,this.tumblePhase=i}flying(){return this.flight!==null}holding_get(){return this.holding}touched_get(){return this.touched}touch_note(){this.touched=!0}spin_pause(){this.spinIdleUntil=this.clock()+R1}eyeDistance(){return this.camera.position.distanceTo(this.focus)}turn_about(e,t){const s=new rr().setFromAxisAngle(e,t);this.world.position.sub(this.focus).applyQuaternion(s).add(this.focus),this.world.quaternion.premultiply(s)}orbit(e,t){this.turn_about(Kf,e*.005),this.turn_about(new U().setFromMatrixColumn(this.camera.matrixWorld,0).normalize(),t*.005)}dolly(e,t=!1){if(this.spin_pause(),this.touched=!0,t){const a=this.camera.getWorldDirection(new U),o=Math.max(4,this.camera.position.length())*.0012;this.camera.position.addScaledVector(a,-e*o);return}const s=this.camera.position.clone().sub(this.focus),i=s.length(),r=Math.min(Math.max(i*Math.exp(e*.001),1.5),Math.max(40,this.camera.far*.45));this.camera.position.copy(this.focus).addScaledVector(s,r/Math.max(1e-4,i))}pan(e,t){const s=this.camera.position.distanceTo(this.focus)*.0016,i=new U().setFromMatrixColumn(this.camera.matrixWorld,0).multiplyScalar(-e*s).add(new U().setFromMatrixColumn(this.camera.matrixWorld,1).multiplyScalar(t*s));this.camera.position.add(i),this.focus.add(i)}frame(e,t,s={}){const i={...B1,...s},r=Math.max(i.minDistance,this.fitDistance(t)*i.margin);this.world.position.copy(e).applyQuaternion(this.world.quaternion).negate(),this.focus.set(0,0,0),i.stance==="threeQuarter"?this.camera.position.set(r*.5,r*.4,r*.85):this.camera.position.set(0,0,r),this.camera.far=Math.max(i.farFloor,(r+t)*i.farScale),this.camera.updateProjectionMatrix(),this.camera.lookAt(0,0,0)}touch_clear(){this.touched=!1}flyToFit(e,t,s,i=1,r=1.15){if(e.length===0){s();return}let a=0;const o=new U;for(const h of e)o.add(h.position),a=Math.max(a,h.radius);o.divideScalar(e.length);const l=e.map(h=>o.distanceTo(h.position)).sort((h,g)=>h-g),c=Math.max(1,Math.min(l.length,Math.ceil(l.length*Math.min(1,Math.max(.1,i))))),d=Math.max(1,(l[c-1]??1)+a),u=Math.max(3,this.fitDistance(d)*r);this.camera.far=Math.max(this.camera.far,(u+d)*2),this.camera.updateProjectionMatrix(),this.flyAlongLine(o,u,t,s)}flyToward(e,t,s,i){this.flyAlongLine(e.position,Math.max(t,e.radius*4),s,i)}flyInto(e,t){if(this.flight!==null||this.holding)return!1;this.holding=!0,this.home={position:this.camera.position.clone(),quaternion:this.camera.quaternion.clone()};const s=e.clone().add(this.camera.position.clone().sub(e).normalize().multiplyScalar(.4));return this.flight_begin(s,this.aim_from(this.camera.position,e),Yf,t),!0}flyBack(e){const t=this.home;if(t===null){this.holding=!1,e();return}this.flight_begin(t.position.clone(),t.quaternion.clone(),Yf,()=>{this.home=null,this.holding=!1,this.spin_pause(),e()})}flight_step(){const e=this.flight;if(e===null)return;const t=Math.min(1,(this.clock()-e.startedAt)/e.durationMs),s=N1(t);this.camera.position.lerpVectors(e.fromPos,e.toPos,s),this.camera.quaternion.slerpQuaternions(e.fromQuat,e.toQuat,s),t>=1&&(this.flight=null,e.onDone())}spin_step(e){!e||this.holding||this.flight!==null||this.clock()<this.spinIdleUntil||this.turn_about(Kf,I1)}tumble_step(){this.tumblePhase+=G1,this.tumbleAxis.set(Math.sin(this.tumblePhase*.7),Math.cos(this.tumblePhase*.4)+.6,Math.sin(this.tumblePhase*.3)*.8).normalize(),this.world.rotateOnWorldAxis(this.tumbleAxis,T1)}fitDistance(e){const t=this.camera.fov*Math.PI/180,s=e/Math.tan(t/2),i=e/(Math.tan(t/2)*Math.max(.1,this.camera.aspect));return Math.max(s,i)}aim_from(e,t){const s=this.camera.clone();return s.position.copy(e),s.lookAt(t),s.quaternion.clone()}flyAlongLine(e,t,s,i){const r=this.camera.position.clone().sub(e);r.lengthSq()<1e-4&&r.set(0,0,1),r.normalize();const a=e.clone().add(r.multiplyScalar(t));this.focus.copy(e),this.flight_begin(a,this.aim_from(a,e),s,i)}flight_begin(e,t,s,i){this.flight={fromPos:this.camera.position.clone(),toPos:e,fromQuat:this.camera.quaternion.clone(),toQuat:t,startedAt:this.clock(),durationMs:s,onDone:i}}}const Bg=4,P1=350,L1=30,W1=600,k1=400;class U1{element;rig;target;mode;clock;touches=new Map;pinch=null;gestureHeld=!1;lastTap=null;kind="mouse";tapActivatedAt=0;suppressClick=!1;viewDrag=null;grabbing=!1;over=!1;detachers=[];constructor(e,t,s,i,r=Date.now){this.element=e,this.rig=t,this.target=s,this.mode=i,this.clock=r,e.style.touchAction="none",this.listen("click",a=>this.click_handle(a)),this.listen("dblclick",a=>{this.clock()-this.tapActivatedAt<W1||this.target.tap(a,"activate")}),this.listen("pointerdown",a=>this.down_handle(a)),this.listen("pointerup",a=>this.up_handle(a)),this.listen("pointercancel",a=>this.up_handle(a)),this.listen("pointermove",a=>this.move_handle(a)),this.listen("pointerleave",a=>{this.over=!1,this.target.leave(a)}),this.listen("wheel",a=>{a.preventDefault(),this.rig.dolly(a.deltaY,this.mode.untethered())},{passive:!1}),this.listen("contextmenu",a=>a.preventDefault())}pointerOver(){return this.over}pressKind(){return this.kind}fingersDown(){return this.touches.size}detach(){for(const e of this.detachers.splice(0))e()}listen(e,t,s){this.element.addEventListener(e,t,s),this.detachers.push(()=>this.element.removeEventListener(e,t,s))}click_handle(e){if(this.suppressClick){this.suppressClick=!1;return}if(this.kind==="touch"){const t=this.clock(),s=this.lastTap;if(s!==null&&t-s.at<=P1&&Math.hypot(e.clientX-s.x,e.clientY-s.y)<=L1){this.lastTap=null,this.tapActivatedAt=t,this.target.tap(e,"activate");return}this.lastTap={at:t,x:e.clientX,y:e.clientY}}this.target.tap(e,"select")}down_handle(e){if(this.kind=e.pointerType,e.pointerType==="touch"){if(e.isPrimary&&(this.touches.clear(),this.pinch=null,this.gestureHeld=!1),this.touches.set(e.pointerId,{x:e.clientX,y:e.clientY}),this.touches.size===2){this.gesture_begin();return}if(this.touches.size>2||this.gestureHeld)return;this.press(e),this.hover(e);return}this.press(e)}up_handle(e){if(e.pointerType==="touch"&&(this.touches.delete(e.pointerId),this.touches.size<2&&(this.pinch=null),this.touches.size===0&&this.gestureHeld)){this.gestureHeld=!1,this.suppressClick=!0,setTimeout(()=>{this.suppressClick=!1},k1),this.release(),this.target.gesture_end?.();return}this.release()}move_handle(e){if(e.pointerType==="touch"&&this.touches.has(e.pointerId)){if(this.touches.set(e.pointerId,{x:e.clientX,y:e.clientY}),this.pinch!==null){this.gesture_move();return}if(this.gestureHeld)return}this.grabbing?this.target.grab_move(e):this.viewDrag!==null?this.view_move(e):this.hover(e)}hover(e){this.over=!0,this.target.hover(e)}press(e){if(!(this.rig.holding_get()||this.rig.flying())){this.rig.spin_pause(),this.target.grab_begin(e)?this.grabbing=!0:this.viewDrag={lastX:e.clientX,lastY:e.clientY,startX:e.clientX,startY:e.clientY,pan:e.shiftKey||e.button===2||e.button===1,moved:!1};try{this.element.setPointerCapture(e.pointerId)}catch{}this.target.tip_hide()}}release(){this.viewDrag!==null&&(this.viewDrag.moved&&(this.suppressClick=!0),this.viewDrag=null,this.rig.spin_pause()),this.grabbing&&(this.grabbing=!1,this.rig.spin_pause(),this.target.grab_end()&&(this.suppressClick=!0))}view_move(e){const t=this.viewDrag;if(t===null)return;this.rig.spin_pause();const s=e.clientX-t.lastX,i=e.clientY-t.lastY;t.lastX=e.clientX,t.lastY=e.clientY,!t.moved&&Math.abs(e.clientX-t.startX)+Math.abs(e.clientY-t.startY)>Bg&&(t.moved=!0,this.rig.touch_note()),t.moved&&(t.pan||this.mode.flat()?this.rig.pan(s,i):this.rig.orbit(s,i))}fingers_read(){const[e,t]=[...this.touches.values()];return e===void 0||t===void 0?null:{spread:Math.hypot(e.x-t.x,e.y-t.y),midX:(e.x+t.x)/2,midY:(e.y+t.y)/2}}gesture_begin(){this.release(),this.gestureHeld=!0,this.pinch=this.fingers_read(),this.rig.spin_pause(),this.target.tip_hide()}gesture_move(){const e=this.fingers_read();e===null||this.pinch===null||(e.spread>0&&this.pinch.spread>0&&this.rig.dolly(Math.log(this.pinch.spread/e.spread)/.001,this.mode.untethered()),(this.mode.flat()||!this.mode.untethered())&&this.rig.pan(e.midX-this.pinch.midX,e.midY-this.pinch.midY),this.pinch=e)}}const F1=14,j1=4;class $1{camera;world;element;sources;starGlow;raycaster=new p_;constructor(e,t,s,i,r){this.camera=e,this.world=t,this.element=s,this.sources=i,this.starGlow=r}ray_aim(e){const t=this.element.getBoundingClientRect(),s=new lt((e.clientX-t.left)/t.width*2-1,-((e.clientY-t.top)/t.height)*2+1);return this.world.updateMatrixWorld(!0),this.raycaster.setFromCamera(s,this.camera),this.raycaster}mesh_under(e){const t=this.ray_aim(e).intersectObjects([...this.sources.meshes()]).filter(r=>r.object.userData.dim!==!0),i=(t.find(r=>r.object.userData.halo!==!0)??t[0])?.object;return i instanceof Us?i:null}meshNode_under(e){const t=this.mesh_under(e)?.userData.nodeId;return typeof t=="string"?t:null}node_under(e,t){const s=this.meshNode_under(e);if(s!==null)return s;const i=this.sources.census();return i!==null?i.pick(this.ray_aim(e)):this.star_under(e,t)}star_under(e,t){const s=this.sources.stars(),i=this.sources.nebulae(),r=this.element.getBoundingClientRect(),a=e.clientX-r.left,o=e.clientY-r.top;this.world.updateMatrixWorld(!0),this.camera.updateMatrixWorld();const l=r.height/(2*Math.tan(this.camera.fov*Math.PI/360)),c=new Gt().multiplyMatrices(this.camera.matrixWorldInverse,this.world.matrixWorld),u=new Gt().multiplyMatrices(this.camera.projectionMatrix,c).elements,h=c.elements,g=f=>{const _=-(h[2]*f.x+h[6]*f.y+h[10]*f.z+h[14]);if(_<=0)return null;const O=u[3]*f.x+u[7]*f.y+u[11]*f.z+u[15],w=(u[0]*f.x+u[4]*f.y+u[8]*f.z+u[12])/O,x=(u[1]*f.x+u[5]*f.y+u[9]*f.z+u[13])/O;return{x:(w+1)/2*r.width,y:(1-x)/2*r.height,depth:_}},p=t?F1:j1;let z=null,m=1/0;for(const f of s){if(f.dim)continue;const _=g(f.position);if(_===null)continue;const O=Math.max(p,this.starGlow*f.radius*l/_.depth),w=Math.hypot(_.x-a,_.y-o);if(w>O)continue;const x=w/O;x<m&&(m=x,z=f.id)}if(z!==null)return z;for(const f of i){const _=g(f.position);if(_!==null&&Math.hypot(_.x-a,_.y-o)<=f.radius*l/_.depth)return f.id}return null}}const V1=3e4,H1=900;class q1{clock;order;first;last;shown=0;moment;speed=1;running=!1;lastWall;flashes=new Map;constructor(e,t=Date.now){this.clock=t,this.order=[...e].map(([s,i])=>({id:s,at:i})).sort((s,i)=>s.at-i.at||(s.id<i.id?-1:1)),this.first=this.order[0]?.at??0,this.last=this.order[this.order.length-1]?.at??0,this.moment=this.first,this.lastWall=t()}span(){return[this.first,this.last]}ids(){return this.order.map(e=>e.id)}playing(){return this.running}at(){return this.moment}play(e=this.speed){this.speed=Math.max(.05,e),this.moment>=this.last&&this.shown>=this.order.length&&this.seek(this.first),this.running=!0,this.lastWall=this.clock()}pause(){this.running=!1}seek(e){this.moment=Math.max(this.first,Math.min(this.last,e));const t=[],s=[];for(;this.shown<this.order.length&&this.order[this.shown].at<=this.moment;)t.push(this.order[this.shown].id),this.shown+=1;for(;this.shown>0&&this.order[this.shown-1].at>this.moment;){this.shown-=1;const i=this.order[this.shown].id;s.push(i),this.flashes.delete(i)}return{at:this.moment,arrived:t,departed:s,done:this.moment>=this.last}}step(){const e=this.clock(),t=e-this.lastWall;if(this.lastWall=e,!this.running)return{at:this.moment,arrived:[],departed:[],done:this.moment>=this.last};const s=(this.last-this.first)/V1*this.speed,i=this.seek(s>0?this.moment+t*s:this.last);for(const r of i.arrived)this.flashes.set(r,e);return i.done&&(this.running=!1),i}flashing(){const e=this.clock(),t=new Map;for(const[s,i]of this.flashes){const r=(e-i)/H1;r>=1?(this.flashes.delete(s),t.set(s,0)):t.set(s,1-r)}return t}}const va=700,Zf=2500,X1=1500;function Y1(){return{running:new Ke("#ff7700"),done:new Ke("#ffeecc"),error:new Ke("#ff2222"),template:new Ke("#ffaa44"),unknown:new Ke("#555555"),edge:new Ke("#cc5500"),join:new Ke("#ffcc99"),root:new Ke("#6fbfae"),pulse:new Ke("#48d8f0")}}function Ng(n){const e={id:n.id,parents:[...n.parentIds,...n.joinParentIds]};return n.metric!==void 0&&(e.metric=n.metric),e}function K1(n){const e=xg(n.map(t=>{const s={id:t.id,parentIds:t.parentIds};return t.metric!==void 0&&(s.metric=t.metric),s}));return n.map((t,s)=>{const i=e[s];return{node:t,position:new U(...i?.position??[0,0,0]),radius:i?.radius??jt}})}function Qf(n){return zg(n.map(Ng))}function Z1(n,e=3,t=new Map,s=tr,i=new Set){const r=new Map([...t].map(([o,l])=>[o,[l.x,l.y,l.z]])),a=_g(n.map(Ng),e,r,s,i);return{total:a.total,moving:a.moving,step:a.step,place:()=>a.place().map((o,l)=>({node:n[l],position:new U(...o.position),radius:o.radius}))}}const Q1=90*400,J1=12;class eA{container;handlers;paletteOf;replay=null;layoutWorkerOf;ambient;renderer;scene;camera;group=new Da;picker;spheres=new w1(this.group);get meshes(){return this.spheres.map}starField=new _1(this.group);labels=new D1(this.group);tubes=new O1({parent:this.group,node:e=>this.tubeNode_of(e),sphere:e=>this.meshes.get(e),palette:()=>this.palette_read()});handoffField=new x1({spheres:this.spheres,stars:this.starField,tubes:this.tubes,look:e=>this.handoffLook_of(e)});censusField=new S1({parent:this.group,stars:this.starField,tubes:this.tubes,starsView:()=>({pixelRatio:window.devicePixelRatio,heightPx:this.renderer.domElement.height,fovDeg:this.camera.fov})});lastPositions=new Map;frozen=new Set;physicsOnce=void 0;census=!1;physics={...tr};physics_set(e,t=!0){this.physics={...this.physics,...e},t&&this.rebuild()}physics_get(){return{...this.physics}}census_set(e){this.census!==e&&(this.census=e,this.rebuild(!0,"hold"))}census_get(){return this.census}graph={nodes:[]};drag=null;pull=null;waveTimes=new Map;waveStartAt=null;rig;drawMode="spheres";placedById=new Map;gestures=null;tapTipTimer=null;hovered=null;fits=0;strategy="ranked";selectedId=null;frameHandle=null;disposed=!1;tip=null;pulseColor=new Ke("#48d8f0");constructor(e,t={},s={}){this.container=e,this.handlers=t,this.paletteOf=s.palette??Y1,this.layoutWorkerOf=s.layoutWorker,this.ambient=s.ambient===!0,this.renderer=new dx({antialias:!0,alpha:!0}),this.renderer.setPixelRatio(window.devicePixelRatio),this.renderer.domElement.classList.add("dag-scene-canvas"),this.scene=new kz,this.camera=new nn(50,1,.1,200),this.camera.position.set(0,0,14),this.rig=new C1(this.camera,this.group),this.picker=new $1(this.camera,this.group,this.renderer.domElement,{meshes:()=>this.meshes.values(),stars:()=>this.starField.list(),nebulae:()=>this.starField.nebulae(),census:()=>this.census&&this.censusField.drawn()?this.censusField:null},Dg),this.scene.add(new u_(16777215,.9));const i=new d_(16777215,1.2);i.position.set(4,6,8),this.scene.add(i),this.scene.add(this.group),e.appendChild(this.renderer.domElement),this.size_fit(),this.ambient||(this.tip=document.createElement("div"),this.tip.className="dag-node-tip",this.tip.hidden=!0,e.appendChild(this.tip),this.gestures=new U1(this.renderer.domElement,this.rig,{grab_begin:a=>this.grab_begin(a),grab_move:a=>this.drag_move(a),grab_end:()=>this.grab_end(),hover:a=>this.hover_handle(a),leave:a=>this.leave_handle(a),tap:(a,o)=>this.pick_handle(a,o),tip_hide:()=>{this.tip&&(this.tip.hidden=!0)},gesture_end:()=>this.handlers.gesture_end?.()},{flat:()=>this.projection==="2d",untethered:()=>this.census})),new ResizeObserver(()=>this.size_fit()).observe(e);const r=()=>{if(!this.disposed){if(this.ambient)this.rig.tumble_step(),this.wave_animate();else{if(this.rig.spin_step(!(this.gestures?.pointerOver()??!1)&&this.projection==="3d"),this.pull!==null&&(this.pull.step(this.drag!==null)?this.positions_sync():this.pull=null),this.dragReturns.length>0){const a=Date.now();this.dragReturns=this.dragReturns.filter(o=>{const l=Math.min(1,(a-o.startedAt)/300),c=l*l*(3-2*l);return o.mesh.position.lerpVectors(o.from,o.to,c),l<1}),this.positions_sync()}this.wave_animate(),this.rig.flight_step()}this.starField.scale_update(this.renderer.domElement.height,this.camera.fov),this.handoff_step(),this.replay_step(),this.tubes.frame(performance.now()),this.labels.declutter(this.camera),this.renderer.render(this.scene,this.camera),this.frameHandle=window.requestAnimationFrame(r)}};r()}graph_set(e,t={}){this.graph=e,this.frozen=new Set(t.frozen??[]),this.physicsOnce=t.physics,this.rebuild(t.fit!==!1,t.settle??"full"),t.wave!==!1&&this.wave_start()}waveLooping=!1;waveLoop_set(e){this.waveLooping=e,e&&this.wave_start()}waveLoop_get(){return this.waveLooping}positions_get(){const e={};for(const[t,s]of this.lastPositions)e[t]=[Math.round(s.x*100)/100,Math.round(s.y*100)/100,Math.round(s.z*100)/100];return e}positions_seed(e){this.lastPositions=new Map(Object.entries(e).map(([t,[s,i,r]])=>[t,new U(s,i,r)]))}wave_start(){this.waveTimes=this.waveSchedule_compute(),this.waveStartAt=this.waveTimes.size>0?Date.now():null}flight_into(e,t){const s=this.meshes.get(e),i=s===void 0?this.censusField.ids().indexOf(e):-1;if(s===void 0&&i<0||this.rig.flying()||this.rig.holding_get())return;this.group.updateMatrixWorld(!0);const r=s!==void 0?s.getWorldPosition(new U):this.group.localToWorld((this.censusField.positions()[i]??new U).clone());this.rig.flyInto(r,t)}camera_flyToFit(e,t,s,i=1,r=1.15){const a=new Set(e),o=[];this.group.updateMatrixWorld(!0);for(const l of this.drawnIds()){if(a.size>0&&!a.has(l))continue;const c=this.nodeWorld_of(l);c!==null&&o.push(c)}this.rig.flyToFit(o,t,s,i,r)}camera_distance(){return this.rig.eyeDistance()}camera_touched(){return this.rig.touched_get()}draw_set(e){e!==this.drawMode&&(this.drawMode=e,this.rebuild(!1,"hold"))}captions_set(e){this.labels.shown_set(e)}draw_get(){return this.drawMode}state_get(){const e=this.graph.nodes.filter(s=>s.solid===!0).map(s=>s.id),t=e.filter(s=>this.meshes.has(s)).length;return{draw:this.drawMode,arrangement:this.arrangement,captions:this.labels.shown_get()?this.labels.count():"off",known:this.lastPositions.size,census:this.census,nodes:this.graph.nodes.length,meshes:this.meshes.size,stars:this.starField.count(),solidMarked:e.length,solidDrawn:t,tubes:this.tubes.materialCount(),censusTubes:this.tubes.censusCount(),handoffGroups:this.handoffField.size(),handoffSolid:this.handoffField.solidCount(),camera:this.rig.eyeDistance().toFixed(1),settling:this.slicing}}camera_flyToward(e,t,s,i){const r=this.nodeWorld_of(e);if(r===null){i();return}this.rig.flyToward(r,t,s,i)}holding_get(){return this.rig.holding_get()}flight_back(e){this.rig.flyBack(e)}waveSchedule_compute(){const e=new Map,t=new Set(this.graph.nodes.map(r=>r.id)),s=r=>r.look.waved;let i=!1;for(;!i;){i=!0;for(const r of this.graph.nodes){if(e.has(r.id)||!s(r))continue;const a=[...r.parentIds,...r.joinParentIds].filter(l=>t.has(l));if(!a.every(l=>e.has(l)))continue;const o=a.reduce((l,c)=>Math.max(l,e.get(c)??0),-Wr);e.set(r.id,o+Wr),i=!1}}return e}wave_animate(){if(this.waveStartAt===null)return;const e=Date.now()-this.waveStartAt;let t=0;if(this.census&&this.censusField.drawn()){t=this.censusField.flare(s=>this.waveTimes.get(s),e,this.pulseColor,va),e>t+va&&(this.waveStartAt=this.ambient||this.waveLooping?Date.now()+Zf:null);return}for(const[s,i]of this.waveTimes){t=Math.max(t,i);const r=this.meshes.get(s);if(r===void 0||!(r.material instanceof Vi))continue;const a=e-i,o=a>=0&&a<=va?Math.sin(a/va*Math.PI):0;r.scale.setScalar(1+o*.45),o>0?(r.material.emissive.copy(this.pulseColor),r.material.emissiveIntensity=o*1.2):(r.material.emissive.setScalar(s===this.selectedId?1:0),r.material.emissiveIntensity=s===this.selectedId?.35:0)}e>t+va&&(this.waveStartAt=this.ambient||this.waveLooping?Date.now()+Zf:null)}strategy_set(e){this.strategy=e,this.rebuild()}selection_clear(){this.selectedId=null,this.selection_paint()}selection_paint(){this.spheres.select(this.selectedId)}strategy_get(){return this.strategy}projection="3d";projection_set(e){this.projection=e,e==="2d"&&this.group.quaternion.identity(),this.rebuild()}projection_get(){return this.projection}look_update(e,t){const s=this.graph.nodes.find(i=>i.id===e);s&&(s.look=t,this.spheres.recolor(e,Ir(t.paint,this.palette_read())),this.tubes.holds(e)&&this.tubes.stale_mark())}palette_read(){return this.paletteOf()}palette_refresh(){this.rebuild(!0,"hold")}size_fit(){const e=Math.max(1,this.container.clientWidth),t=Math.max(1,this.container.clientHeight);this.renderer.setSize(e,t,!1),this.camera.aspect=e/t,this.camera.updateProjectionMatrix()}dispose(){this.disposed=!0,this.layoutWorker?.terminate(),this.layoutWorker=null,this.frameHandle!==null&&window.cancelAnimationFrame(this.frameHandle),this.gestures?.detach(),this.renderer.dispose(),this.renderer.domElement.remove(),this.spheres.dispose()}censusBuild(e,t,s=!0){const i=e.map(l=>{const c=l.node;return{id:c.id,position:l.position,radius:l.radius,count:Math.max(1,c.count??1),color:Ir(c.look.paint,t),dim:c.dim===!0,ember:c.look.ember,state:c.look.state,parents:c.parentIds,ghost:c.ghost===!0}}),r=this.censusField.build(i,this.drawMode==="stars",t),a=r.center,o=r.radius;!this.ambient&&s&&this.rig.frame(a,o,{stance:"threeQuarter",farScale:2.5})}camera_fit(e){if(e.length===0)return;this.rig.touch_clear(),this.fits+=1,this.renderer.domElement.dataset.fits=String(this.fits);const t=new U;for(const a of e)t.add(a.position);t.divideScalar(e.length);const s=e.map(a=>t.distanceTo(a.position)+a.radius).sort((a,o)=>a-o),i=this.handlers.handoffKey!==void 0?.95:1,r=Math.max(1,s[Math.max(0,Math.ceil(s.length*i)-1)]??1);this.rig.frame(t,r)}rebuildGen=0;slicing=!1;rebuild(e=!0,t="full"){const s=++this.rebuildGen;if(this.slicing&&(this.slicing=!1,this.handlers.progress?.(1,1,0)),this.strategy!=="molecule"){this.draw(K1(this.graph.nodes),e);return}let i=this.frozen;if(t!=="full"&&i.size===0){const u=this.graph.nodes.map(h=>h.id).filter(h=>this.lastPositions.has(h));u.length>0&&(i=new Set(u))}const r=Z1(this.graph.nodes,this.projection==="2d"?2:3,this.lastPositions,this.physicsOnce!==void 0?{...this.physics,...this.physicsOnce}:this.physics,i);if(r.moving===0){this.draw(r.place(),e);return}const a=this.graph.nodes.length,o=this.handlers.progress,l=r.total*r.moving<Q1;if((!l||this.arrangement!=="galaxy")&&o!==void 0&&this.handlers.handoffKey!==void 0&&this.frozen.size===0){this.hierarchy_run(s,e,i,o);return}if(o===void 0||l){r.step(r.total),this.draw(r.place(),e);return}let c=0;this.slicing=!0,o(0,r.total,a);const d=()=>{if(s!==this.rebuildGen||this.disposed)return;const u=performance.now();for(;c<r.total&&performance.now()-u<J1;)r.step(1),c+=1;if(c<r.total){o(c,r.total,a),window.requestAnimationFrame(d);return}this.slicing=!1,this.draw(r.place(),e),o(r.total,r.total,a)};window.requestAnimationFrame(d)}layoutWorker=null;arrangement="galaxy";arrangementMemory=new Map;arrangement_set(e,t,s=!0){if(e===this.arrangement)return;this.arrangementMemory.set(this.arrangement,new Map(this.lastPositions)),this.arrangement=e;let i=this.arrangementMemory.get(e);i===void 0&&t!==void 0&&Object.keys(t).length>0&&(i=new Map(Object.entries(t).map(([r,[a,o,l]])=>[r,new U(a,o,l)]))),this.lastPositions=i??new Map,s&&this.rebuild(!0,i===void 0?"full":"hold")}arrangement_get(){return this.arrangement}hierarchy_run(e,t,s,i){const r=this.handlers.handoffKey;if(r===void 0)return;const a=Qf(this.graph.nodes),o=new Map([...this.lastPositions].map(([p,z])=>[p,[z.x,z.y,z.z]])),l=TS(this.graph.nodes,r,o,s),c=1e3,d=l.length;this.slicing=!0,i(0,c,d);const u=this.physicsOnce!==void 0?{...this.physics,...this.physicsOnce}:this.physics,h=p=>{const z=this.graph.nodes.map(m=>{const f=p[m.id]??[0,0,0];return{node:m,position:new U(f[0],f[1],f[2]),radius:a.get(m.id)??jt}});this.slicing=!1,this.draw(z,t),i(c,c,d)};if(this.layoutWorker===null){const p=this.layoutWorkerOf;if(p===void 0){const z=i1(this.arrangement);if(z===void 0){console.error(`layout: no engine named ${this.arrangement}`),this.slicing=!1,i(c,c,d);return}h(z.run({nodes:l,physics:u},m=>i(Math.min(c-1,Math.floor(m*c)),c,d)).positions);return}this.layoutWorker=p()}const g=this.layoutWorker;g.onmessage=p=>{const z=p.data;if(!(z.generation!==this.rebuildGen||this.disposed)){if(z.type==="progress"){i(Math.min(c-1,Math.floor((z.fraction??0)*c)),c,d);return}if(z.type==="failed"){console.error(`layout: ${z.reason??"the engine failed"}`),this.slicing=!1,i(c,c,d);return}h(z.positions??{})}},g.postMessage({generation:e,nodes:l,physics:u,arrangement:this.arrangement})}draw(e,t){this.group.clear(),this.spheres.clear(),this.censusField.clear(),this.pull=null,this.drag=null,this.starField.clear(),this.labels.clear(),this.handoffField.clear(),this.placedById=new Map,this.tubes.clear();const s=this.palette_read();if(this.pulseColor=s.pulse,this.lastPositions=new Map(e.map(z=>[z.node.id,z.position.clone()])),this.projection==="2d")for(const z of e)z.position.z=0;if(this.census){const z=e.filter(m=>m.node.solid===!0&&m.node.ghost!==!0);this.censusBuild(e.filter(m=>m.node.solid!==!0),s,t),z.length>0&&this.solid_draw(z,s);return}!this.ambient&&t&&this.camera_fit(e);const i=new Map(e.map(z=>[z.node.id,z])),r=new Map;for(const z of e)for(const m of z.node.parentIds)r.set(m,[...r.get(m)??[],z]);const a=z=>{const m=r.get(z)??[];if(m.length===0)return null;const f=new U;for(const _ of m)f.add(_.position);return f.divideScalar(m.length)},o=this.drawMode==="stars",l=[],c=o&&this.replay===null?this.handlers.handoffKey:void 0;for(const{node:z,position:m,radius:f}of e){if(z.caption!==void 0){const _=z.ghost===!0?a(z.id):null,O=_!==null?0:z.halo===!0?Dc(z.count??1):f;this.labels.caption_add(z.id,z.caption,_??m,O,s.done,z.dim===!0,z.count??1)}if(!(z.ghost===!0&&z.halo!==!0)){if(o&&z.solid!==!0){if(z.halo===!0){this.nebula_add(z,m,s);continue}l.push({id:z.id,position:m.clone(),radius:f,color:Ir(z.look.paint,s).clone(),dim:z.dim===!0,ember:z.look.ember,...z.ring===!0?{ring:!0}:{}});continue}if(z.halo===!0){this.spheres.halo_add(z.id,m,Dc(z.count??1),s.edge,z.dim===!0);continue}this.spheres.sphere_add(z.id,m,f,{color:Ir(z.look.paint,s),dim:z.dim===!0,selected:z.id===this.selectedId,flat:this.projection==="2d"})}}l.length>0&&this.starField.draw(l,window.devicePixelRatio,this.renderer.domElement.height,this.camera.fov);for(const z of e)this.placedById.set(z.node.id,z);if(c!==void 0){const z=new Map(this.graph.nodes.map(m=>[m.id,m]));this.handoffField.gather(l,m=>{const f=z.get(m);return f===void 0?null:c(f)})}const d=[],u=[],h=z=>!o||z.node.solid===!0,g=[],p=(z,m,f,_,O,w)=>{const x=_?.35:1,S=d.length/6;d.push(z.x,z.y,z.z,m.x,m.y,m.z),g.push(w,O.id),u.push(f.r*x,f.g*x,f.b*x,f.r*x,f.g*x,f.b*x);const I=_||c===void 0?null:c(O);I!==null&&this.handoffField.thread_note(I,S)};for(const z of e){const{node:m,position:f}=z;if(m.ghost!==!0){for(const _ of m.parentIds){const O=i.get(_);if(!O||O.node.ghost===!0)continue;const w=m.dim===!0||O.node.dim===!0;h(z)&&h(O)?!o&&w&&this.spheres.edge_add(_,m.id,O.position,f,s.edge,!1,w):p(O.position,f,s.edge,w,m,_)}for(const _ of m.joinParentIds){const O=i.get(_);if(!O)continue;if(m.joinFaint===!0){p(O.position,f,s.join,!0,m,_);continue}const w=m.dim===!0||O.node.dim===!0;h(z)&&h(O)?!o&&w&&this.spheres.edge_add(_,m.id,O.position,f,s.join,!0,w):p(O.position,f,s.join,w,m,_)}}}{const z=e.filter(m=>m.node.ghost!==!0&&m.node.halo!==!0&&(o?m.node.solid===!0:m.node.dim!==!0)).map(m=>m.node.id);if(z.length>0){const m={tubes:null,mix:1};this.tubes.build(m,z,new Set(z))}}this.starField.threads_draw(d,u,g),this.replay!==null&&this.replay_paintAll()}replay_begin(e,t=1){const s=new q1(e);this.replay={clock:s,arrivals:e,shown:new Set},this.rebuild(!1,"hold"),this.replay_paintAll(),s.play(t)}replay_play(e){this.replay?.clock.play(e)}replay_pause(){this.replay?.clock.pause()}replay_seek(e){this.replay!==null&&this.replay_apply(this.replay.clock.seek(e))}replay_stop(){this.replay!==null&&(this.replay=null,this.rebuild(!1,"hold"))}replay_state(){return this.replay===null?null:{playing:this.replay.clock.playing(),at:this.replay.clock.at(),span:this.replay.clock.span()}}replay_step(){const e=this.replay;if(e===null)return;const t=e.clock.playing(),s=e.clock.step();this.replay_apply(s);for(const[i,r]of e.clock.flashing())this.starField.flash_set(i,r);this.starField.flush(),(t||s.arrived.length>0)&&this.handlers.replay?.(s.at,e.clock.playing())}replay_apply(e){const t=this.replay;if(!(t===null||e.arrived.length===0&&e.departed.length===0)){for(const s of e.arrived)t.shown.add(s);for(const s of e.departed)t.shown.delete(s),this.starField.flash_set(s,0);this.starField.presence_set(e.arrived,1),this.starField.presence_set(e.departed,0),this.starField.threads_present(s=>t.shown.has(s)||!t.arrivals.has(s)),this.starField.flush()}}replay_paintAll(){const e=this.replay;if(e===null)return;const t=[...e.arrivals.keys()].filter(s=>!e.shown.has(s));this.starField.presence_set(t,0),this.starField.presence_set(e.shown,1),this.starField.threads_present(s=>e.shown.has(s)||!e.arrivals.has(s)),this.starField.flush()}handoff_step(){if(this.handoffField.size()===0)return;const t=(this.renderer.domElement.clientHeight||1)/(2*Math.tan(this.camera.fov*Math.PI/360));this.group.updateMatrixWorld(!0),this.camera.updateMatrixWorld();const s=new Gt().multiplyMatrices(this.camera.matrixWorldInverse,this.group.matrixWorld);this.handoffField.step(s,t,performance.now())}handoffLook_of(e){const t=this.placedById.get(e);if(t!==void 0)return{position:t.position,radius:t.radius,color:Ir(t.node.look.paint,this.palette_read())}}tubeNode_of(e){const t=this.placedById.get(e);if(t!==void 0)return{position:t.position,radius:t.radius,parents:t.node.parentIds,joins:t.node.joinFaint===!0?[]:t.node.joinParentIds,state:t.node.look.state}}nebula_add(e,t,s){this.starField.nebula_add(e.id,t,Dc(e.count??1),s.edge,e.dim===!0)}nodeWorld_of(e){const t=this.meshes.get(e);if(t!==void 0){const i=t.geometry;return i.boundingSphere===null&&i.computeBoundingSphere(),{position:t.getWorldPosition(new U),radius:i.boundingSphere?.radius??jt}}const s=this.starField.entry(e);return s!==void 0?{position:this.group.localToWorld(s.position.clone()),radius:s.radius}:null}drawnIds(){return[...this.meshes.keys(),...this.starField.ids()]}positions_sync(){for(const{id:e,position:t}of this.pull?.positions()??[])this.meshes.get(e)?.position.set(...t),this.lastPositions.set(e,new U(...t));this.tubes.follow(),this.spheres.edges_follow()}grab_begin(e){const t=this.picker.mesh_under(e),s=t?.userData.nodeId;if(t===null||typeof s!="string")return!1;const i=this.camera.getWorldDirection(new U).negate();this.group.updateMatrixWorld(!0);const r=new gi().setFromNormalAndCoplanarPoint(i,t.getWorldPosition(new U));return this.drag={nodeId:s,plane:r,startX:e.clientX,startY:e.clientY,moved:!1,solo:this.strategy==="ranked",home:t.position.clone()},!0}dragSim_begin(e){const t=Qf(this.graph.nodes),s=[...this.meshes].map(([r,a])=>({id:r,position:[a.position.x,a.position.y,a.position.z],radius:t.get(r)??jt,dim:a.userData.dim===!0,halo:a.userData.halo===!0})),i=[];for(const r of this.graph.nodes)for(const a of[...r.parentIds,...r.joinParentIds])i.push({from:a,to:r.id});this.pull=new XS({grabbed:e,nodes:s,edges:i,dimensions:this.projection==="2d"?2:3,baseRadius:jt})}drag_move(e){if(this.drag===null||(this.rig.spin_pause(),!this.drag.moved&&Math.abs(e.clientX-this.drag.startX)+Math.abs(e.clientY-this.drag.startY)>Bg&&(this.drag.moved=!0,this.drag.solo||this.dragSim_begin(this.drag.nodeId)),!this.drag.moved))return;const t=new U;if(this.picker.ray_aim(e).ray.intersectPlane(this.drag.plane,t)!==null){if(this.group.worldToLocal(t),this.drag.solo){const s=this.meshes.get(this.drag.nodeId);s!==void 0&&(s.position.copy(t),this.positions_sync());return}this.pull?.pin([t.x,t.y,t.z])}}dragReturns=[];grab_end(){if(this.drag===null)return!1;const e=this.drag.moved;if(this.drag.solo&&this.drag.moved){const t=this.meshes.get(this.drag.nodeId);t!==void 0&&this.dragReturns.push({mesh:t,from:t.position.clone(),to:this.drag.home.clone(),startedAt:Date.now()})}return this.pull?.release(),this.drag=null,e}solid_draw(e,t){for(const r of e)this.placedById.set(r.node.id,r),this.spheres.sphere_add(r.node.id,r.position,r.radius,{color:Ir(r.node.look.paint,t)});const s=e.map(r=>r.node.id),i={tubes:null,mix:1};this.tubes.build(i,s,new Set(s))}leave_handle(e){if(this.hovered=null,e.pointerType==="touch"&&this.tip!==null&&!this.tip.hidden){this.tapTipTimer!==null&&window.clearTimeout(this.tapTipTimer),this.tapTipTimer=window.setTimeout(()=>{this.tapTipTimer=null,this.tip!==null&&(this.gestures?.fingersDown()??0)===0&&(this.tip.hidden=!0)},X1);return}this.tip&&(this.tip.hidden=!0)}hover_handle(e){if(this.tip===null)return;const t=this.picker.node_under(e,this.gestures?.pressKind()==="touch"),s=typeof t=="string"?this.graph.nodes.find(r=>r.id===t):void 0;if(s===void 0){this.tip.hidden=!0,this.renderer.domElement.style.cursor="",this.hovered=null;return}this.hovered={id:s.id,x:e.clientX,y:e.clientY};const i=this.renderer.domElement.getBoundingClientRect();this.tip.textContent=this.handlers.tip?.(s)??s.label,this.tip.style.left=`${e.clientX-i.left+14}px`,this.tip.style.top=`${e.clientY-i.top+10}px`,this.tip.hidden=!1,this.renderer.domElement.style.cursor="pointer"}pick_handle(e,t){const s=this.hovered,i=s!==null&&Math.hypot(e.clientX-s.x,e.clientY-s.y)<=6?s.id:this.picker.node_under(e,this.gestures?.pressKind()==="touch");if(i===null){t==="select"&&this.selectedId!==null&&(this.selection_clear(),this.handlers.deselect?.());return}const r=this.graph.nodes.find(a=>a.id===i);r&&(t==="select"?(this.selectedId=i,this.census||this.selection_paint(),this.handlers.select?.(r)):this.handlers.activate?.(r))}}const Cg=new Set(["created","waiting","scheduled","started","registeringFiles"]);function tA(n){return n.status!==void 0&&Cg.has(n.status)?"live":n.status==="finishedWithError"||n.share!==void 0&&n.share>=1?"failed":n.status==="finishedSuccessfully"||n.share!==void 0&&n.status!==void 0?"done":"rest"}function sA(n){return n.share!==void 0&&n.status!=="cancelled"?n.share>=1?{token:"error"}:{blend:["done","error"],share:Math.sqrt(Math.max(0,n.share))}:n.status==="finishedWithError"||n.status==="cancelled"?{token:"error"}:n.hue!==void 0?{hue:n.hue}:n.parentIds.length===0&&n.joinParentIds.length===0?{token:"root"}:n.status===void 0?{token:"template"}:n.status==="finishedSuccessfully"?{token:"done"}:Cg.has(n.status)?{token:"running"}:{token:"unknown"}}function Jf(n){return{state:tA(n),paint:sA(n),ember:n.share!==void 0&&n.share>0||n.status==="finishedWithError",waved:n.status===void 0||n.status==="finishedSuccessfully"||n.status==="finishedWithError"}}function nA(){const n=getComputedStyle(document.documentElement),e=(t,s)=>new Ke(n.getPropertyValue(t).trim()||s);return{running:e("--orange","#f70"),done:e("--butter","#fec"),error:new Ke("#f22"),template:e("--harvestgold","#fa4"),unknown:new Ke("#555"),edge:e("--pumpkin-pie","#c50"),join:e("--honey","#fc9"),root:e("--dag-root","#6fbfae"),pulse:e("--dag-pulse","#48d8f0")}}class Rl extends eA{byId=new Map;constructor(e,t={},s={}){const i={palette:nA,layoutWorker:()=>new Worker(new URL(""+new URL("layoutWorker-CfJVM55D.js",import.meta.url).href,import.meta.url),{type:"module"})};s.ambient!==void 0&&(i.ambient=s.ambient),super(e,t,i)}graph_set(e,t={}){const s=e.nodes.map(i=>Object.assign(i,{look:Jf(i)}));this.byId=new Map(s.map(i=>[i.id,i])),super.graph_set({nodes:s},t)}status_update(e,t){const s=this.byId.get(e);s===void 0||s.status===t||(s.status=t,this.look_update(e,Jf(s)))}}const Pg=24,ru="argus.dormant";class iA{constructor(e=Pg,t){this.cap=e,this.store=t,this.rehydrate()}cap;store;groups=new Map;add(e){for(this.groups.delete(e.id),this.groups.set(e.id,e);this.groups.size>this.cap;){const t=this.oldest_id();if(t===void 0)break;this.groups.delete(t)}this.persist()}list(){return[...this.groups.values()].sort((e,t)=>t.lastTouched-e.lastTouched)}get(e){return this.groups.get(e)}has(e){return this.groups.has(e)}dismiss(e){const t=this.groups.delete(e);return t&&this.persist(),t}oldest_id(){let e;for(const t of this.groups.values())(e===void 0||t.lastTouched<e.lastTouched)&&(e=t);return e?.id}persist(){if(this.store!==void 0)try{this.store.setItem(ru,JSON.stringify([...this.groups.values()]))}catch{}}rehydrate(){if(this.store!==void 0)try{const e=this.store.getItem(ru);if(e===null)return;const t=JSON.parse(e);if(!Array.isArray(t))return;for(const s of t)s!==null&&typeof s=="object"&&typeof s.id=="string"&&this.groups.set(s.id,s)}catch{}}}function ep(){try{const n=globalThis.localStorage;return n===void 0?void 0:(n.getItem(ru),n)}catch{return}}class rA{constructor(e,t){this.host=t,this.grid=e.querySelector(".panes-grid"),this.empty=e.querySelector(".panes-empty"),this.grid.addEventListener("click",this.click_handle)}host;grid;empty;render(){const e=this.host.list();this.empty.hidden=e.length>0,this.grid.replaceChildren(...e.map(t=>this.card_build(t)))}card_build(e){const t=document.createElement("button");t.className="panes-card",t.dataset.restore=e.id,t.title=`restore ${e.label}`;const s=document.createElement("span");if(s.className="panes-card-figure",e.thumbnail!==void 0){const o=document.createElement("img");o.src=e.thumbnail,o.alt="",s.appendChild(o)}else s.classList.add("panes-card-glyph"),s.textContent=e.members.includes("files")&&!e.members.includes("viewer")?"▤":"▣";t.appendChild(s);const i=document.createElement("span");i.className="panes-card-label",i.textContent=e.label,t.appendChild(i);const r=document.createElement("span");r.className="panes-card-badges";for(const o of aA(e.members)){const l=document.createElement("span");l.className="panes-card-badge",l.textContent=o.toUpperCase(),r.appendChild(l)}t.appendChild(r);const a=document.createElement("button");return a.className="panes-card-dismiss",a.dataset.dismiss=e.id,a.title=`forget ${e.label}`,a.textContent="DISMISS",t.appendChild(a),t}click_handle=e=>{const t=e.target,s=t.closest("[data-dismiss]");if(s!==null){e.stopPropagation();const r=s.dataset.dismiss??"";this.host.dismiss(r),this.render();return}const i=t.closest("[data-restore]");i!==null&&this.host.restore(i.dataset.restore??"")}}function aA(n){return[...new Set(n)]}const Sn=["#000000","#f24444","#33cc66","#ffaa44","#5599ff","#cc88ff","#44cccc","#ffeecc","#777777","#ff6666","#66ee99","#ffcc66","#77bbff","#dd99ff","#66dddd","#ffffff"],oA={yellow:Sn[3],white:Sn[7],cyan:Sn[6],green:Sn[2],magenta:Sn[5]};function Lg(){return{fg:null,bg:null,bold:!1,dim:!1,italic:!1,inverse:!1,underline:!1}}function lA(n){if(n<16)return Sn[n]??"#ffeecc";if(n<232){const t=n-16,s=[0,95,135,175,215,255],i=s[Math.floor(t/36)%6]??0,r=s[Math.floor(t/6)%6]??0,a=s[t%6]??0;return`#${(i<<16|r<<8|a).toString(16).padStart(6,"0")}`}const e=8+(n-232)*10;return`#${(e<<16|e<<8|e).toString(16).padStart(6,"0")}`}function cA(n,e){for(let t=0;t<e.length;t++){const s=e[t]??0;if(s===0)Object.assign(n,Lg());else if(s===1)n.bold=!0;else if(s===2)n.dim=!0;else if(s===3)n.italic=!0;else if(s===4)n.underline=!0;else if(s===7)n.inverse=!0;else if(s===27)n.inverse=!1;else if(s===22)n.bold=!1,n.dim=!1;else if(s===23)n.italic=!1;else if(s===24)n.underline=!1;else if(s>=30&&s<=37)n.fg=Sn[s-30]??null;else if(s>=90&&s<=97)n.fg=Sn[s-90+8]??null;else if(s===39)n.fg=null;else if(s>=40&&s<=47)n.bg=Sn[s-40]??null;else if(s>=100&&s<=107)n.bg=Sn[s-100+8]??null;else if(s===49)n.bg=null;else if(s===38||s===48){const i=e[t+1]??0;let r=null;if(i===5)r=lA(e[t+2]??0),t+=2;else if(i===2){const a=e[t+2]??0,o=e[t+3]??0,l=e[t+4]??0;r=`#${(a<<16|o<<8|l).toString(16).padStart(6,"0")}`,t+=4}s===38?n.fg=r:n.bg=r}}}function dA(n){const e=[],t=n.inverse?n.bg??"#000":n.fg,s=n.inverse?n.fg??"var(--daybreak)":n.bg;return t!==null&&e.push(`color:${t}`),s!==null&&e.push(`background-color:${s}`),n.bold&&e.push("font-weight:bold"),n.dim&&e.push("opacity:0.55"),n.italic&&e.push("font-style:italic"),n.underline&&e.push("text-decoration:underline"),e.join(";")}function Ks(n){return n.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}const Tc=/\x1b(?:\[([0-?]*)[ -/]*([@-~])|\][^\x07\x1b]*(?:\x07|\x1b\\)|[@-Z\\-_])/g;function jn(n){const e=Lg();let t="",s=0;const i=a=>{if(a.length===0)return;const o=dA(e),l=Ks(a.replace(/\r/g,""));t+=o.length>0?`<span style="${o}">${l}</span>`:l};Tc.lastIndex=0;let r=Tc.exec(n);for(;r!==null;){if(i(n.slice(s,r.index)),s=r.index+r[0].length,r[2]==="m"){const a=(r[1]??"").split(/[;:]/).map(o=>o.length>0?Number(o):0);cA(e,a)}r=Tc.exec(n)}return i(n.slice(s)),t}function uA(n){for(const[e,t]of Object.entries(oA))n.style.setProperty(`--console-${e}`,t)}const hA="G1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MTsxbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MTsxbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBt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1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MTsxbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzE7MjszbSAbWzBtG1szODsyOzE7MjszbSAbWzBtG1szODsyOzE7MjszbSAbWzBtG1szODsyOzE7MjszbSAbWzBtG1szODsyOzE7MjsybSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtChtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzE7MW0gG1swbRtbMzg7MjsxOzI7M20gG1swbRtbMzg7MjsxOzI7M20gG1swbRtbMzg7MjsxOzI7M20gG1swbRtbMzg7MjswOzE7Mm0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjsxOzI7M20gG1swbRtbMzg7MjswOzE7Mm0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjsxOzI7M20gG1swbRtbMzg7Mj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7MDswOzBtIBtbMG0bWzM4OzI7MDswOzBtIBtbMG0bWzM4OzI7MDswOzBtIBtbMG0KG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtCg==",fA=/\x1b\[[0-9;]*m/g,tp="\x1B[0m",sp="\x1B[7m",Wg=atob(hA).trimEnd().split(`
4206
+ }`;let Ic=null;function iu(){return Ic===null&&(Ic=new Iu(1,1,1,10,1,!0)),Ic}function v1(n,e){const t=performance.now(),s=new hs({uniforms:{time:{value:t},opacity:{value:1},born:{value:t},cycle:{value:e}},vertexShader:Tg,fragmentShader:Gg,transparent:!0}),i=iu().clone(),r=new Float32Array(n.length*3),a=new Float32Array(n.length),o=new Float32Array(n.length),l=new Au(i,s,n.length),c=new F(0,1,0),d=new ss;return n.forEach((u,h)=>{const g=u.to.clone().sub(u.from),p=g.length();d.position.copy(u.from).addScaledVector(g,.5),d.quaternion.setFromUnitVectors(c,p>0?g.divideScalar(p):c),d.scale.set(u.width,p,u.width),d.updateMatrix(),l.setMatrixAt(h,d.matrix),r.set([u.color.r,u.color.g,u.color.b],h*3),a[h]=u.mode,o[h]=u.start}),i.setAttribute("aColor",new vi(r,3)),i.setAttribute("aMode",new vi(a,1)),i.setAttribute("aStart",new vi(o,1)),l.instanceMatrix.needsUpdate=!0,l.frustumCulled=!1,l}function Rg(n){return n==="live"?1:n==="done"||n==="failed"?2:0}class O1{host;sets=[];materials=[];glows=new Map;stale=!1;census=0;constructor(e){this.host=e}materialCount(){return this.materials.length}censusCount(){return this.census}holds(e){return this.sets.some(t=>t.members.has(e))}stale_mark(){this.stale=!0}build(e,t,s){const i=e.mix,r=this.host.palette(),a=[];for(const S of t){const I=this.host.node(S);if(I!==void 0){for(const b of I.parents){const A=this.host.node(b);A!==void 0&&s.has(b)&&a.push({fromId:b,from:A,toId:S,to:I,join:!1})}for(const b of I.joins){const A=this.host.node(b);A!==void 0&&s.has(b)&&a.push({fromId:b,from:A,toId:S,to:I,join:!0})}}}if(a.length===0)return;const o=new Map,l=(S,I=new Set)=>{const b=o.get(S);if(b!==void 0)return b;if(I.has(S))return 0;I.add(S);const A=this.host.node(S),B=A===void 0?[]:[...A.parents,...A.joins].filter(k=>s.has(k)),N=B.length===0?0:1+Math.max(...B.map(k=>l(k,I)));return o.set(S,N),N},c=performance.now(),d=new Float32Array(a.length*3),u=new Float32Array(a.length),h=new Float32Array(a.length),g=r.edge.clone().lerp(new Ye("#ffffff"),.45),p=new Au(iu(),new hs({uniforms:{time:{value:c},opacity:{value:i},born:{value:c},cycle:{value:1}},vertexShader:Tg,fragmentShader:Gg,transparent:!0}),a.length),z=new F(0,1,0),m=new ss;let f=0;const _=[],O=new Map,w=new Set;a.forEach(({fromId:S,from:I,toId:b,to:A,join:B},N)=>{const k=A.position.clone().sub(I.position),L=k.length(),j=Math.max(.06,Math.min(I.radius,A.radius)*.34);m.position.copy(I.position).addScaledVector(k,.5),m.quaternion.setFromUnitVectors(z,L>0?k.clone().divideScalar(L):z),m.scale.set(j,L,j),m.updateMatrix(),p.setMatrixAt(N,m.matrix),_.push({from:S,to:b,width:j});const P=A.state==="failed"?r.error:B?r.join:g;d.set([P.r,P.g,P.b],N*3),u[N]=Rg(A.state);const W=l(S);if(f=Math.max(f,W),h[N]=W*Wr,u[N]===1&&w.add(b),u[N]===2){const X=h[N]+Vn/2;O.set(b,Math.min(O.get(b)??1/0,X)),W===0&&O.set(S,0)}}),p.instanceMatrix.needsUpdate=!0;const x=iu().clone();if(x.setAttribute("aColor",new vi(d,3)),x.setAttribute("aMode",new vi(u,1)),x.setAttribute("aStart",new vi(h,1)),p.geometry=x,p.frustumCulled=!1,this.host.parent.add(p),e.tubes=p,p.material instanceof hs){this.materials.push(p.material);const S=p.material.uniforms.cycle;S!==void 0&&(S.value=(f+1)*Wr+Vn/2+$f)}this.sets.push({mesh:p,edges:_,lamps:O,blinks:w,owner:e,entries:t,members:s})}census_build(e,t){if(e.length===0)return;const s=v1(e,(t+1)*Wr+Vn/2+$f);this.host.parent.add(s),s.material instanceof hs&&this.materials.push(s.material),this.census=e.length}frame(e){if(this.materials.length!==0){for(const t of this.materials){const s=t.uniforms.time;s!==void 0&&(s.value=e)}this.stale&&this.restatus(),this.lamps_animate(e)}}follow(){const e=new F(0,1,0),t=new ss;for(const{mesh:s,edges:i}of this.sets)i.forEach(({from:r,to:a,width:o},l)=>{const c=this.host.sphere(r),d=this.host.sphere(a);if(c===void 0||d===void 0)return;const u=d.position.clone().sub(c.position),h=u.length();t.position.copy(c.position).addScaledVector(u,.5),t.quaternion.setFromUnitVectors(e,h>0?u.clone().divideScalar(h):e),t.scale.set(o,h,o),t.updateMatrix(),s.setMatrixAt(l,t.matrix)}),s.instanceMatrix.needsUpdate=!0}release(e){if(this.host.parent.remove(e),this.sets=this.sets.filter(t=>t.mesh!==e),e.geometry.dispose(),e.material instanceof hs){const t=e.material;this.materials=this.materials.filter(s=>s!==t),t.dispose()}}clear(){this.materials=[],this.census=0,this.sets=[];for(const e of this.glows.values())e.material.dispose();this.glows=new Map}restatus(){this.stale=!1;const e=this.sets;this.sets=[];for(const t of e){if(this.host.parent.remove(t.mesh),t.mesh.geometry.dispose(),t.mesh.material instanceof hs){const s=t.mesh.material;this.materials=this.materials.filter(i=>i!==s),s.dispose()}t.owner.tubes=null,this.build(t.owner,t.entries,t.members)}this.follow()}lamps_animate(e){const t=new Set;for(const{mesh:s,lamps:i,blinks:r}of this.sets){if(i.size===0&&r.size===0||!(s.material instanceof hs))continue;const a=Number(s.material.uniforms.born?.value??e),o=Number(s.material.uniforms.cycle?.value??1),l=((e-a)%o+o)%o,c=Math.min(1,Math.max(0,(o-l)/c1));for(const[u,h]of i){const g=l-h;this.lamp_paint(u,g<0?0:c,g>=0&&g<Oo?g/Oo:-1,t)}const d=(e%Vn+Vn)%Vn;for(const u of r){if(i.has(u))continue;const h=Math.max(0,1-d/(Vn*.8));this.lamp_paint(u,h*h,d<Oo?d/Oo:-1,t)}}for(const[s,i]of this.glows)t.has(s)||(i.visible=!1,this.host.sphere(s)===void 0&&(this.host.parent.remove(i),i.material.dispose(),this.glows.delete(s)))}lamp_paint(e,t,s,i){const r=this.host.sphere(e);if(r===void 0||!(r.material instanceof Vi))return;let a=r.userData.lampBase;a instanceof Ye||(a=r.material.color.clone(),r.userData.lampBase=a);const o=s<0?0:(1-s)**2;if(r.material.color.copy(a).multiplyScalar(Vf+(1-Vf)*Math.max(t,o)).lerp(Hf,Math.min(1,.22*t+.7*o)),s<0)return;let l=this.glows.get(e);l===void 0&&(l=new xu(new xl({map:Ig(),color:a.clone().lerp(Hf,.35),transparent:!0,blending:Qi,depthWrite:!1})),this.glows.set(e,l),this.host.parent.add(l));const c=r.geometry.parameters?.radius??.55,d=1-(1-s)**3;l.position.copy(r.position),l.scale.setScalar(c*(2+l1*d)*r.scale.x),l.material.opacity=.9*(1-s)**1.5,l.visible=!0,i.add(e)}}class x1{host;groups=new Map;lastAt=0;constructor(e){this.host=e}size(){return this.groups.size}solidCount(){let e=0;for(const t of this.groups.values())t.mix>0&&(e+=1);return e}gather(e,t){for(const s of e){if(s.dim)continue;const i=t(s.id);if(i===null)continue;let r=this.groups.get(i);r===void 0&&(r={entries:[],center:new F,maxRadius:0,mix:0,target:0,meshes:[],tubes:null,threadSegments:[]},this.groups.set(i,r)),r.entries.push(s),r.maxRadius=Math.max(r.maxRadius,s.radius)}for(const s of this.groups.values()){for(const i of s.entries)s.center.add(i.position);s.center.divideScalar(Math.max(1,s.entries.length))}}thread_note(e,t){this.groups.get(e)?.threadSegments.push(t)}step(e,t,s){if(this.groups.size===0)return;const i=this.lastAt===0?0:Math.min(100,s-this.lastAt);this.lastAt=s;const r=e.elements;for(const a of this.groups.values()){let o=1/0;for(const d of a.entries){const u=d.position,h=-(r[2]*u.x+r[6]*u.y+r[10]*u.z+r[14]);h>0&&h<o&&(o=h)}const l=o===1/0?0:2*a.maxRadius*t/o;if(a.target===0&&l>r1?a.target=1:a.target===1&&l<a1&&(a.target=0),a.mix===a.target)continue;const c=i===0?1:i/o1;a.mix=a.target>a.mix?Math.min(1,a.mix+c):Math.max(0,a.mix-c),a.mix>0&&a.meshes.length===0&&this.solid_build(a);for(const d of a.meshes)d.material instanceof Vi&&(d.material.opacity=a.mix);if(a.tubes!==null&&a.tubes.material instanceof hs){const d=a.tubes.material.uniforms.opacity;d!==void 0&&(d.value=a.mix)}this.host.stars.stars_fade(a.entries,1-a.mix),this.host.stars.threads_fade(a.threadSegments,1-a.mix),a.mix===0&&this.solid_release(a)}this.host.stars.flush()}clear(){this.groups=new Map}solid_build(e){const t=new Set(e.entries.map(s=>s.id));for(const s of e.entries){const i=this.host.look(s.id);i!==void 0&&e.meshes.push(this.host.spheres.sphere_add(s.id,i.position,i.radius,{color:i.color,fade:e.mix}))}this.host.tubes.build(e,e.entries.map(s=>s.id),t)}solid_release(e){for(const t of e.meshes)this.host.spheres.remove(t);e.tubes!==null&&(this.host.tubes.release(e.tubes),e.tubes=null),e.meshes=[]}}class S1{host;mesh=null;base=null;memberIds=[];memberPositions=[];constructor(e){this.host=e}drawn(){return this.mesh!==null}ids(){return this.memberIds}positions(){return this.memberPositions}build(e,t,s){let i=0;for(const _ of e)_.ghost!==!0&&(i+=Math.max(1,_.count));const r=new Gu(1,1),a=new Vi({color:"#ffffff",roughness:.5,metalness:.1}),o=[],l=new Au(r,a,t?1:i),c=new Ye,d=new ss,u=new Map,h=new Map;let g=0,p=1;const z=new F;for(const _ of e)z.add(_.position);z.divideScalar(Math.max(1,e.length));for(const _ of e){if(_.ghost===!0)continue;const O=Math.max(1,_.count),w=O===1?0:_.radius*(1.6+.55*Math.cbrt(O)),x=O===1?_.radius:Math.max(.06,Math.min(_.radius*.5,2.2*w/Math.sqrt(O))),S=[];for(let I=0;I<O;I++){const b=O===1?_.position.clone():d1(I,O,w).add(_.position);S.push(b),c.set(_.color),t?o.push({id:_.id,position:b,radius:x,color:c.clone(),dim:_.dim,ember:_.ember}):(d.position.copy(b),d.scale.setScalar(x),d.updateMatrix(),l.setMatrixAt(g,d.matrix),l.setColorAt(g,c)),this.memberIds.push(_.id),this.memberPositions.push(b),g+=1,p=Math.max(p,z.distanceTo(b)+x)}u.set(_.id,S),h.set(_.id,x)}if(t){const _=this.host.starsView();this.host.stars.draw(o,_.pixelRatio,_.heightPx,_.fovDeg)}else l.instanceColor&&(l.instanceColor.needsUpdate=!0),this.host.parent.add(l),this.mesh=l,this.base=l.instanceColor?Float32Array.from(l.instanceColor.array):null;const m=[];for(const _ of e){const O=u.get(_.id)??[];for(const w of _.parents){const x=u.get(w);if(!(!x||x.length===0))for(let S=0;S<O.length;S++){const I=O[S],b=x.length===O.length?x[S]:x[S%x.length];I===void 0||b===void 0||m.push(I.x,I.y,I.z,b.x,b.y,b.z)}}}const f=m.length/6;if(!t&&f>0&&f<=y1)this.tubes_build(e,u,h,s);else if(m.length>0){const _=new ds;_.setAttribute("position",new Xt(m,3)),this.host.parent.add(new Xm(_,t?new Hr({color:s.edge,transparent:!0,opacity:Eg,blending:Qi,depthWrite:!1}):new Hr({color:s.edge,transparent:!0,opacity:.35})))}return{center:z,radius:p}}flare(e,t,s,i){let r=0;if(this.mesh===null||this.base===null||!this.mesh.instanceColor)return r;const a=this.mesh.instanceColor.array,o=this.base;for(let l=0;l<this.memberIds.length;l++){const c=e(this.memberIds[l]??"");if(c===void 0)continue;r=Math.max(r,c);const d=t-c,u=d>=0&&d<=i?Math.sin(d/i*Math.PI):0,h=l*3;a[h]=o[h]+(s.r-o[h])*u,a[h+1]=o[h+1]+(s.g-o[h+1])*u,a[h+2]=o[h+2]+(s.b-o[h+2])*u}return this.mesh.instanceColor.needsUpdate=!0,r}pick(e){if(this.mesh===null)return null;const t=e.intersectObject(this.mesh)[0];return t===void 0||t.instanceId===void 0?null:(this.mesh.setColorAt(t.instanceId,new Ye("#ffffff")),this.mesh.instanceColor&&(this.mesh.instanceColor.needsUpdate=!0),this.memberIds[t.instanceId]??null)}clear(){this.mesh=null,this.base=null,this.memberIds=[],this.memberPositions=[]}tubes_build(e,t,s,i){const r=new Map(e.map(u=>[u.id,u])),a=new Map,o=(u,h=new Set)=>{const g=a.get(u);if(g!==void 0)return g;if(h.has(u))return 0;h.add(u);const p=(r.get(u)?.parents??[]).filter(m=>r.has(m)),z=p.length===0?0:1+Math.max(...p.map(m=>o(m,h)));return a.set(u,z),z},l=i.edge.clone().lerp(new Ye("#ffffff"),.45),c=[];let d=0;for(const u of e){const h=t.get(u.id)??[];for(const g of u.parents){const p=t.get(g);if(!p||p.length===0)continue;const z=Math.max(.02,Math.min(s.get(u.id)??.1,s.get(g)??.1)*.34),m=o(g)*Wr;d=Math.max(d,o(g));for(let f=0;f<h.length;f++){const _=h[f],O=p.length===h.length?p[f]:p[f%p.length];O===void 0||_===void 0||c.push({from:O,to:_,width:z,color:u.state==="failed"?i.error:l,mode:Rg(u.state),start:m})}}}this.host.tubes.census_build(c,d)}}const Xf=.028,A1=.25,E1="rgba(0, 0, 0, 0.7)",ya=48;class D1{parent;captions=new Map;shown=!0;constructor(e){this.parent=e}count(){return this.captions.size}caption_add(e,t,s,i,r,a,o=0){const l=document.createElement("canvas"),c=l.getContext("2d"),d=`600 ${ya}px sans-serif`;let u=t.length*ya*.6;if(c!==null&&(c.font=d,u=Math.ceil(c.measureText(t).width)),l.width=Math.max(1,u+ya),l.height=Math.round(ya*1.5),c!==null){c.font=d,c.textBaseline="middle";const z=l.height/4;c.fillStyle=E1,c.beginPath(),c.roundRect(0,0,l.width,l.height,z),c.fill(),c.fillStyle=`#${r.getHexString()}`,c.fillText(t,ya/2,l.height/2)}const h=new Km(l),g=new xl({map:h,transparent:!0,depthWrite:!1,depthTest:!1,sizeAttenuation:!1,opacity:a?A1:.9}),p=new xu(g);p.scale.set(Xf*(l.width/l.height),Xf,1),p.center.set(.5,0),p.position.set(s.x,s.y+i,s.z),p.renderOrder=4,p.visible=this.shown,this.parent.add(p),this.captions.get(e)?.texture.dispose(),this.captions.set(e,{sprite:p,texture:h,rank:o})}declutter(e){if(!this.shown)return 0;const t=[...this.captions.values()].sort((o,l)=>l.rank-o.rank),s=[],i=new F,r=e.projectionMatrix.elements[0]??1,a=e.projectionMatrix.elements[5]??1;for(const o of t){if(o.sprite.getWorldPosition(i).project(e),i.z>1){o.sprite.visible=!1;continue}const l=o.sprite.scale.x*r/2,c={left:i.x-l,right:i.x+l,bottom:i.y,top:i.y+o.sprite.scale.y*a},d=s.some(u=>c.left<u.right&&u.left<c.right&&c.bottom<u.top&&u.bottom<c.top);o.sprite.visible=!d,d||s.push(c)}return s.length}shown_set(e){if(this.shown=e,!e)for(const t of this.captions.values())t.sprite.visible=!1}shown_get(){return this.shown}clear(){for(const e of this.captions.values())e.texture.dispose();this.captions=new Map}}const I1=.0022,T1=.006,G1=.0035,R1=1e4,Yf=700,Kf=new F(0,1,0),B1={minDistance:8,margin:1.15,stance:"axis",farFloor:200,farScale:2};function N1(n){return n*n*(3-2*n)}class C1{camera;world;clock;focus=new F;flight=null;home=null;holding=!1;touched=!1;spinIdleUntil=0;tumbleAxis=new F(0,1,0);tumblePhase;constructor(e,t,s=Date.now,i=Math.random()*Math.PI*2){this.camera=e,this.world=t,this.clock=s,this.tumblePhase=i}flying(){return this.flight!==null}holding_get(){return this.holding}touched_get(){return this.touched}touch_note(){this.touched=!0}spin_pause(){this.spinIdleUntil=this.clock()+R1}eyeDistance(){return this.camera.position.distanceTo(this.focus)}turn_about(e,t){const s=new rr().setFromAxisAngle(e,t);this.world.position.sub(this.focus).applyQuaternion(s).add(this.focus),this.world.quaternion.premultiply(s)}orbit(e,t){this.turn_about(Kf,e*.005),this.turn_about(new F().setFromMatrixColumn(this.camera.matrixWorld,0).normalize(),t*.005)}dolly(e,t=!1){if(this.spin_pause(),this.touched=!0,t){const a=this.camera.getWorldDirection(new F),o=Math.max(4,this.camera.position.length())*.0012;this.camera.position.addScaledVector(a,-e*o);return}const s=this.camera.position.clone().sub(this.focus),i=s.length(),r=Math.min(Math.max(i*Math.exp(e*.001),1.5),Math.max(40,this.camera.far*.45));this.camera.position.copy(this.focus).addScaledVector(s,r/Math.max(1e-4,i))}pan(e,t){const s=this.camera.position.distanceTo(this.focus)*.0016,i=new F().setFromMatrixColumn(this.camera.matrixWorld,0).multiplyScalar(-e*s).add(new F().setFromMatrixColumn(this.camera.matrixWorld,1).multiplyScalar(t*s));this.camera.position.add(i),this.focus.add(i)}frame(e,t,s={}){const i={...B1,...s},r=Math.max(i.minDistance,this.fitDistance(t)*i.margin);this.world.position.copy(e).applyQuaternion(this.world.quaternion).negate(),this.focus.set(0,0,0),i.stance==="threeQuarter"?this.camera.position.set(r*.5,r*.4,r*.85):this.camera.position.set(0,0,r),this.camera.far=Math.max(i.farFloor,(r+t)*i.farScale),this.camera.updateProjectionMatrix(),this.camera.lookAt(0,0,0)}touch_clear(){this.touched=!1}flyToFit(e,t,s,i=1,r=1.15){if(e.length===0){s();return}let a=0;const o=new F;for(const h of e)o.add(h.position),a=Math.max(a,h.radius);o.divideScalar(e.length);const l=e.map(h=>o.distanceTo(h.position)).sort((h,g)=>h-g),c=Math.max(1,Math.min(l.length,Math.ceil(l.length*Math.min(1,Math.max(.1,i))))),d=Math.max(1,(l[c-1]??1)+a),u=Math.max(3,this.fitDistance(d)*r);this.camera.far=Math.max(this.camera.far,(u+d)*2),this.camera.updateProjectionMatrix(),this.flyAlongLine(o,u,t,s)}flyToward(e,t,s,i){this.flyAlongLine(e.position,Math.max(t,e.radius*4),s,i)}flyInto(e,t){if(this.flight!==null||this.holding)return!1;this.holding=!0,this.home={position:this.camera.position.clone(),quaternion:this.camera.quaternion.clone()};const s=e.clone().add(this.camera.position.clone().sub(e).normalize().multiplyScalar(.4));return this.flight_begin(s,this.aim_from(this.camera.position,e),Yf,t),!0}flyBack(e){const t=this.home;if(t===null){this.holding=!1,e();return}this.flight_begin(t.position.clone(),t.quaternion.clone(),Yf,()=>{this.home=null,this.holding=!1,this.spin_pause(),e()})}flight_step(){const e=this.flight;if(e===null)return;const t=Math.min(1,(this.clock()-e.startedAt)/e.durationMs),s=N1(t);this.camera.position.lerpVectors(e.fromPos,e.toPos,s),this.camera.quaternion.slerpQuaternions(e.fromQuat,e.toQuat,s),t>=1&&(this.flight=null,e.onDone())}spin_step(e){!e||this.holding||this.flight!==null||this.clock()<this.spinIdleUntil||this.turn_about(Kf,I1)}tumble_step(){this.tumblePhase+=G1,this.tumbleAxis.set(Math.sin(this.tumblePhase*.7),Math.cos(this.tumblePhase*.4)+.6,Math.sin(this.tumblePhase*.3)*.8).normalize(),this.world.rotateOnWorldAxis(this.tumbleAxis,T1)}fitDistance(e){const t=this.camera.fov*Math.PI/180,s=e/Math.tan(t/2),i=e/(Math.tan(t/2)*Math.max(.1,this.camera.aspect));return Math.max(s,i)}aim_from(e,t){const s=this.camera.clone();return s.position.copy(e),s.lookAt(t),s.quaternion.clone()}flyAlongLine(e,t,s,i){const r=this.camera.position.clone().sub(e);r.lengthSq()<1e-4&&r.set(0,0,1),r.normalize();const a=e.clone().add(r.multiplyScalar(t));this.focus.copy(e),this.flight_begin(a,this.aim_from(a,e),s,i)}flight_begin(e,t,s,i){this.flight={fromPos:this.camera.position.clone(),toPos:e,fromQuat:this.camera.quaternion.clone(),toQuat:t,startedAt:this.clock(),durationMs:s,onDone:i}}}const Bg=4,P1=350,L1=30,W1=600,k1=400;class U1{element;rig;target;mode;clock;touches=new Map;pinch=null;gestureHeld=!1;lastTap=null;kind="mouse";tapActivatedAt=0;suppressClick=!1;viewDrag=null;grabbing=!1;over=!1;detachers=[];constructor(e,t,s,i,r=Date.now){this.element=e,this.rig=t,this.target=s,this.mode=i,this.clock=r,e.style.touchAction="none",this.listen("click",a=>this.click_handle(a)),this.listen("dblclick",a=>{this.clock()-this.tapActivatedAt<W1||this.target.tap(a,"activate")}),this.listen("pointerdown",a=>this.down_handle(a)),this.listen("pointerup",a=>this.up_handle(a)),this.listen("pointercancel",a=>this.up_handle(a)),this.listen("pointermove",a=>this.move_handle(a)),this.listen("pointerleave",a=>{this.over=!1,this.target.leave(a)}),this.listen("wheel",a=>{a.preventDefault(),this.rig.dolly(a.deltaY,this.mode.untethered())},{passive:!1}),this.listen("contextmenu",a=>a.preventDefault())}pointerOver(){return this.over}pressKind(){return this.kind}fingersDown(){return this.touches.size}detach(){for(const e of this.detachers.splice(0))e()}listen(e,t,s){this.element.addEventListener(e,t,s),this.detachers.push(()=>this.element.removeEventListener(e,t,s))}click_handle(e){if(this.suppressClick){this.suppressClick=!1;return}if(this.kind==="touch"){const t=this.clock(),s=this.lastTap;if(s!==null&&t-s.at<=P1&&Math.hypot(e.clientX-s.x,e.clientY-s.y)<=L1){this.lastTap=null,this.tapActivatedAt=t,this.target.tap(e,"activate");return}this.lastTap={at:t,x:e.clientX,y:e.clientY}}this.target.tap(e,"select")}down_handle(e){if(this.kind=e.pointerType,e.pointerType==="touch"){if(e.isPrimary&&(this.touches.clear(),this.pinch=null,this.gestureHeld=!1),this.touches.set(e.pointerId,{x:e.clientX,y:e.clientY}),this.touches.size===2){this.gesture_begin();return}if(this.touches.size>2||this.gestureHeld)return;this.press(e),this.hover(e);return}this.press(e)}up_handle(e){if(e.pointerType==="touch"&&(this.touches.delete(e.pointerId),this.touches.size<2&&(this.pinch=null),this.touches.size===0&&this.gestureHeld)){this.gestureHeld=!1,this.suppressClick=!0,setTimeout(()=>{this.suppressClick=!1},k1),this.release(),this.target.gesture_end?.();return}this.release()}move_handle(e){if(e.pointerType==="touch"&&this.touches.has(e.pointerId)){if(this.touches.set(e.pointerId,{x:e.clientX,y:e.clientY}),this.pinch!==null){this.gesture_move();return}if(this.gestureHeld)return}this.grabbing?this.target.grab_move(e):this.viewDrag!==null?this.view_move(e):this.hover(e)}hover(e){this.over=!0,this.target.hover(e)}press(e){if(!(this.rig.holding_get()||this.rig.flying())){this.rig.spin_pause(),this.target.grab_begin(e)?this.grabbing=!0:this.viewDrag={lastX:e.clientX,lastY:e.clientY,startX:e.clientX,startY:e.clientY,pan:e.shiftKey||e.button===2||e.button===1,moved:!1};try{this.element.setPointerCapture(e.pointerId)}catch{}this.target.tip_hide()}}release(){this.viewDrag!==null&&(this.viewDrag.moved&&(this.suppressClick=!0),this.viewDrag=null,this.rig.spin_pause()),this.grabbing&&(this.grabbing=!1,this.rig.spin_pause(),this.target.grab_end()&&(this.suppressClick=!0))}view_move(e){const t=this.viewDrag;if(t===null)return;this.rig.spin_pause();const s=e.clientX-t.lastX,i=e.clientY-t.lastY;t.lastX=e.clientX,t.lastY=e.clientY,!t.moved&&Math.abs(e.clientX-t.startX)+Math.abs(e.clientY-t.startY)>Bg&&(t.moved=!0,this.rig.touch_note()),t.moved&&(t.pan||this.mode.flat()?this.rig.pan(s,i):this.rig.orbit(s,i))}fingers_read(){const[e,t]=[...this.touches.values()];return e===void 0||t===void 0?null:{spread:Math.hypot(e.x-t.x,e.y-t.y),midX:(e.x+t.x)/2,midY:(e.y+t.y)/2}}gesture_begin(){this.release(),this.gestureHeld=!0,this.pinch=this.fingers_read(),this.rig.spin_pause(),this.target.tip_hide()}gesture_move(){const e=this.fingers_read();e===null||this.pinch===null||(e.spread>0&&this.pinch.spread>0&&this.rig.dolly(Math.log(this.pinch.spread/e.spread)/.001,this.mode.untethered()),(this.mode.flat()||!this.mode.untethered())&&this.rig.pan(e.midX-this.pinch.midX,e.midY-this.pinch.midY),this.pinch=e)}}const F1=14,j1=4;class $1{camera;world;element;sources;starGlow;raycaster=new p_;constructor(e,t,s,i,r){this.camera=e,this.world=t,this.element=s,this.sources=i,this.starGlow=r}ray_aim(e){const t=this.element.getBoundingClientRect(),s=new lt((e.clientX-t.left)/t.width*2-1,-((e.clientY-t.top)/t.height)*2+1);return this.world.updateMatrixWorld(!0),this.raycaster.setFromCamera(s,this.camera),this.raycaster}mesh_under(e){const t=this.ray_aim(e).intersectObjects([...this.sources.meshes()]).filter(r=>r.object.userData.dim!==!0),i=(t.find(r=>r.object.userData.halo!==!0)??t[0])?.object;return i instanceof Us?i:null}meshNode_under(e){const t=this.mesh_under(e)?.userData.nodeId;return typeof t=="string"?t:null}node_under(e,t){const s=this.meshNode_under(e);if(s!==null)return s;const i=this.sources.census();return i!==null?i.pick(this.ray_aim(e)):this.star_under(e,t)}star_under(e,t){const s=this.sources.stars(),i=this.sources.nebulae(),r=this.element.getBoundingClientRect(),a=e.clientX-r.left,o=e.clientY-r.top;this.world.updateMatrixWorld(!0),this.camera.updateMatrixWorld();const l=r.height/(2*Math.tan(this.camera.fov*Math.PI/360)),c=new Gt().multiplyMatrices(this.camera.matrixWorldInverse,this.world.matrixWorld),u=new Gt().multiplyMatrices(this.camera.projectionMatrix,c).elements,h=c.elements,g=f=>{const _=-(h[2]*f.x+h[6]*f.y+h[10]*f.z+h[14]);if(_<=0)return null;const O=u[3]*f.x+u[7]*f.y+u[11]*f.z+u[15],w=(u[0]*f.x+u[4]*f.y+u[8]*f.z+u[12])/O,x=(u[1]*f.x+u[5]*f.y+u[9]*f.z+u[13])/O;return{x:(w+1)/2*r.width,y:(1-x)/2*r.height,depth:_}},p=t?F1:j1;let z=null,m=1/0;for(const f of s){if(f.dim)continue;const _=g(f.position);if(_===null)continue;const O=Math.max(p,this.starGlow*f.radius*l/_.depth),w=Math.hypot(_.x-a,_.y-o);if(w>O)continue;const x=w/O;x<m&&(m=x,z=f.id)}if(z!==null)return z;for(const f of i){const _=g(f.position);if(_!==null&&Math.hypot(_.x-a,_.y-o)<=f.radius*l/_.depth)return f.id}return null}}const V1=3e4,H1=900;class q1{clock;order;first;last;shown=0;moment;speed=1;running=!1;lastWall;flashes=new Map;constructor(e,t=Date.now){this.clock=t,this.order=[...e].map(([s,i])=>({id:s,at:i})).sort((s,i)=>s.at-i.at||(s.id<i.id?-1:1)),this.first=this.order[0]?.at??0,this.last=this.order[this.order.length-1]?.at??0,this.moment=this.first,this.lastWall=t()}span(){return[this.first,this.last]}ids(){return this.order.map(e=>e.id)}playing(){return this.running}at(){return this.moment}play(e=this.speed){this.speed=Math.max(.05,e),this.moment>=this.last&&this.shown>=this.order.length&&this.seek(this.first),this.running=!0,this.lastWall=this.clock()}pause(){this.running=!1}seek(e){this.moment=Math.max(this.first,Math.min(this.last,e));const t=[],s=[];for(;this.shown<this.order.length&&this.order[this.shown].at<=this.moment;)t.push(this.order[this.shown].id),this.shown+=1;for(;this.shown>0&&this.order[this.shown-1].at>this.moment;){this.shown-=1;const i=this.order[this.shown].id;s.push(i),this.flashes.delete(i)}return{at:this.moment,arrived:t,departed:s,done:this.moment>=this.last}}step(){const e=this.clock(),t=e-this.lastWall;if(this.lastWall=e,!this.running)return{at:this.moment,arrived:[],departed:[],done:this.moment>=this.last};const s=(this.last-this.first)/V1*this.speed,i=this.seek(s>0?this.moment+t*s:this.last);for(const r of i.arrived)this.flashes.set(r,e);return i.done&&(this.running=!1),i}flashing(){const e=this.clock(),t=new Map;for(const[s,i]of this.flashes){const r=(e-i)/H1;r>=1?(this.flashes.delete(s),t.set(s,0)):t.set(s,1-r)}return t}}const va=700,Zf=2500,X1=1500;function Y1(){return{running:new Ye("#ff7700"),done:new Ye("#ffeecc"),error:new Ye("#ff2222"),template:new Ye("#ffaa44"),unknown:new Ye("#555555"),edge:new Ye("#cc5500"),join:new Ye("#ffcc99"),root:new Ye("#6fbfae"),pulse:new Ye("#48d8f0")}}function Ng(n){const e={id:n.id,parents:[...n.parentIds,...n.joinParentIds]};return n.metric!==void 0&&(e.metric=n.metric),e}function K1(n){const e=xg(n.map(t=>{const s={id:t.id,parentIds:t.parentIds};return t.metric!==void 0&&(s.metric=t.metric),s}));return n.map((t,s)=>{const i=e[s];return{node:t,position:new F(...i?.position??[0,0,0]),radius:i?.radius??jt}})}function Qf(n){return zg(n.map(Ng))}function Z1(n,e=3,t=new Map,s=tr,i=new Set){const r=new Map([...t].map(([o,l])=>[o,[l.x,l.y,l.z]])),a=_g(n.map(Ng),e,r,s,i);return{total:a.total,moving:a.moving,step:a.step,place:()=>a.place().map((o,l)=>({node:n[l],position:new F(...o.position),radius:o.radius}))}}const Q1=90*400,J1=12;class eA{container;handlers;paletteOf;replay=null;layoutWorkerOf;ambient;renderer;scene;camera;group=new Da;picker;spheres=new w1(this.group);get meshes(){return this.spheres.map}starField=new _1(this.group);labels=new D1(this.group);tubes=new O1({parent:this.group,node:e=>this.tubeNode_of(e),sphere:e=>this.meshes.get(e),palette:()=>this.palette_read()});handoffField=new x1({spheres:this.spheres,stars:this.starField,tubes:this.tubes,look:e=>this.handoffLook_of(e)});censusField=new S1({parent:this.group,stars:this.starField,tubes:this.tubes,starsView:()=>({pixelRatio:window.devicePixelRatio,heightPx:this.renderer.domElement.height,fovDeg:this.camera.fov})});lastPositions=new Map;frozen=new Set;physicsOnce=void 0;census=!1;physics={...tr};physics_set(e,t=!0){this.physics={...this.physics,...e},t&&this.rebuild()}physics_get(){return{...this.physics}}census_set(e){this.census!==e&&(this.census=e,this.rebuild(!0,"hold"))}census_get(){return this.census}graph={nodes:[]};drag=null;pull=null;waveTimes=new Map;waveStartAt=null;rig;drawMode="spheres";placedById=new Map;gestures=null;tapTipTimer=null;hovered=null;fits=0;strategy="ranked";selectedId=null;frameHandle=null;disposed=!1;tip=null;pulseColor=new Ye("#48d8f0");constructor(e,t={},s={}){this.container=e,this.handlers=t,this.paletteOf=s.palette??Y1,this.layoutWorkerOf=s.layoutWorker,this.ambient=s.ambient===!0,this.renderer=new dx({antialias:!0,alpha:!0}),this.renderer.setPixelRatio(window.devicePixelRatio),this.renderer.domElement.classList.add("dag-scene-canvas"),this.scene=new kz,this.camera=new nn(50,1,.1,200),this.camera.position.set(0,0,14),this.rig=new C1(this.camera,this.group),this.picker=new $1(this.camera,this.group,this.renderer.domElement,{meshes:()=>this.meshes.values(),stars:()=>this.starField.list(),nebulae:()=>this.starField.nebulae(),census:()=>this.census&&this.censusField.drawn()?this.censusField:null},Dg),this.scene.add(new u_(16777215,.9));const i=new d_(16777215,1.2);i.position.set(4,6,8),this.scene.add(i),this.scene.add(this.group),e.appendChild(this.renderer.domElement),this.size_fit(),this.ambient||(this.tip=document.createElement("div"),this.tip.className="dag-node-tip",this.tip.hidden=!0,e.appendChild(this.tip),this.gestures=new U1(this.renderer.domElement,this.rig,{grab_begin:a=>this.grab_begin(a),grab_move:a=>this.drag_move(a),grab_end:()=>this.grab_end(),hover:a=>this.hover_handle(a),leave:a=>this.leave_handle(a),tap:(a,o)=>this.pick_handle(a,o),tip_hide:()=>{this.tip&&(this.tip.hidden=!0)},gesture_end:()=>this.handlers.gesture_end?.()},{flat:()=>this.projection==="2d",untethered:()=>this.census})),new ResizeObserver(()=>this.size_fit()).observe(e);const r=()=>{if(!this.disposed){if(this.ambient)this.rig.tumble_step(),this.wave_animate();else{if(this.rig.spin_step(!(this.gestures?.pointerOver()??!1)&&this.projection==="3d"),this.pull!==null&&(this.pull.step(this.drag!==null)?this.positions_sync():this.pull=null),this.dragReturns.length>0){const a=Date.now();this.dragReturns=this.dragReturns.filter(o=>{const l=Math.min(1,(a-o.startedAt)/300),c=l*l*(3-2*l);return o.mesh.position.lerpVectors(o.from,o.to,c),l<1}),this.positions_sync()}this.wave_animate(),this.rig.flight_step()}this.starField.scale_update(this.renderer.domElement.height,this.camera.fov),this.handoff_step(),this.replay_step(),this.tubes.frame(performance.now()),this.labels.declutter(this.camera),this.renderer.render(this.scene,this.camera),this.frameHandle=window.requestAnimationFrame(r)}};r()}graph_set(e,t={}){this.graph=e,this.frozen=new Set(t.frozen??[]),this.physicsOnce=t.physics,this.rebuild(t.fit!==!1,t.settle??"full"),t.wave!==!1&&this.wave_start()}waveLooping=!1;waveLoop_set(e){this.waveLooping=e,e&&this.wave_start()}waveLoop_get(){return this.waveLooping}positions_get(){const e={};for(const[t,s]of this.lastPositions)e[t]=[Math.round(s.x*100)/100,Math.round(s.y*100)/100,Math.round(s.z*100)/100];return e}positions_seed(e){this.lastPositions=new Map(Object.entries(e).map(([t,[s,i,r]])=>[t,new F(s,i,r)]))}wave_start(){this.waveTimes=this.waveSchedule_compute(),this.waveStartAt=this.waveTimes.size>0?Date.now():null}flight_into(e,t){const s=this.meshes.get(e),i=s===void 0?this.censusField.ids().indexOf(e):-1;if(s===void 0&&i<0||this.rig.flying()||this.rig.holding_get())return;this.group.updateMatrixWorld(!0);const r=s!==void 0?s.getWorldPosition(new F):this.group.localToWorld((this.censusField.positions()[i]??new F).clone());this.rig.flyInto(r,t)}camera_flyToFit(e,t,s,i=1,r=1.15){const a=new Set(e),o=[];this.group.updateMatrixWorld(!0);for(const l of this.drawnIds()){if(a.size>0&&!a.has(l))continue;const c=this.nodeWorld_of(l);c!==null&&o.push(c)}this.rig.flyToFit(o,t,s,i,r)}camera_distance(){return this.rig.eyeDistance()}camera_touched(){return this.rig.touched_get()}draw_set(e){e!==this.drawMode&&(this.drawMode=e,this.rebuild(!1,"hold"))}captions_set(e){this.labels.shown_set(e)}draw_get(){return this.drawMode}state_get(){const e=this.graph.nodes.filter(s=>s.solid===!0).map(s=>s.id),t=e.filter(s=>this.meshes.has(s)).length;return{draw:this.drawMode,arrangement:this.arrangement,captions:this.labels.shown_get()?this.labels.count():"off",known:this.lastPositions.size,census:this.census,nodes:this.graph.nodes.length,meshes:this.meshes.size,stars:this.starField.count(),solidMarked:e.length,solidDrawn:t,tubes:this.tubes.materialCount(),censusTubes:this.tubes.censusCount(),handoffGroups:this.handoffField.size(),handoffSolid:this.handoffField.solidCount(),camera:this.rig.eyeDistance().toFixed(1),settling:this.slicing}}camera_flyToward(e,t,s,i){const r=this.nodeWorld_of(e);if(r===null){i();return}this.rig.flyToward(r,t,s,i)}holding_get(){return this.rig.holding_get()}flight_back(e){this.rig.flyBack(e)}waveSchedule_compute(){const e=new Map,t=new Set(this.graph.nodes.map(r=>r.id)),s=r=>r.look.waved;let i=!1;for(;!i;){i=!0;for(const r of this.graph.nodes){if(e.has(r.id)||!s(r))continue;const a=[...r.parentIds,...r.joinParentIds].filter(l=>t.has(l));if(!a.every(l=>e.has(l)))continue;const o=a.reduce((l,c)=>Math.max(l,e.get(c)??0),-Wr);e.set(r.id,o+Wr),i=!1}}return e}wave_animate(){if(this.waveStartAt===null)return;const e=Date.now()-this.waveStartAt;let t=0;if(this.census&&this.censusField.drawn()){t=this.censusField.flare(s=>this.waveTimes.get(s),e,this.pulseColor,va),e>t+va&&(this.waveStartAt=this.ambient||this.waveLooping?Date.now()+Zf:null);return}for(const[s,i]of this.waveTimes){t=Math.max(t,i);const r=this.meshes.get(s);if(r===void 0||!(r.material instanceof Vi))continue;const a=e-i,o=a>=0&&a<=va?Math.sin(a/va*Math.PI):0;r.scale.setScalar(1+o*.45),o>0?(r.material.emissive.copy(this.pulseColor),r.material.emissiveIntensity=o*1.2):(r.material.emissive.setScalar(s===this.selectedId?1:0),r.material.emissiveIntensity=s===this.selectedId?.35:0)}e>t+va&&(this.waveStartAt=this.ambient||this.waveLooping?Date.now()+Zf:null)}strategy_set(e){this.strategy=e,this.rebuild()}selection_clear(){this.selectedId=null,this.selection_paint()}selection_paint(){this.spheres.select(this.selectedId)}strategy_get(){return this.strategy}projection="3d";projection_set(e){this.projection=e,e==="2d"&&this.group.quaternion.identity(),this.rebuild()}projection_get(){return this.projection}look_update(e,t){const s=this.graph.nodes.find(i=>i.id===e);s&&(s.look=t,this.spheres.recolor(e,Ir(t.paint,this.palette_read())),this.tubes.holds(e)&&this.tubes.stale_mark())}palette_read(){return this.paletteOf()}palette_refresh(){this.rebuild(!0,"hold")}size_fit(){const e=Math.max(1,this.container.clientWidth),t=Math.max(1,this.container.clientHeight);this.renderer.setSize(e,t,!1),this.camera.aspect=e/t,this.camera.updateProjectionMatrix()}dispose(){this.disposed=!0,this.layoutWorker?.terminate(),this.layoutWorker=null,this.frameHandle!==null&&window.cancelAnimationFrame(this.frameHandle),this.gestures?.detach(),this.renderer.dispose(),this.renderer.domElement.remove(),this.spheres.dispose()}censusBuild(e,t,s=!0){const i=e.map(l=>{const c=l.node;return{id:c.id,position:l.position,radius:l.radius,count:Math.max(1,c.count??1),color:Ir(c.look.paint,t),dim:c.dim===!0,ember:c.look.ember,state:c.look.state,parents:c.parentIds,ghost:c.ghost===!0}}),r=this.censusField.build(i,this.drawMode==="stars",t),a=r.center,o=r.radius;!this.ambient&&s&&this.rig.frame(a,o,{stance:"threeQuarter",farScale:2.5})}camera_fit(e){if(e.length===0)return;this.rig.touch_clear(),this.fits+=1,this.renderer.domElement.dataset.fits=String(this.fits);const t=new F;for(const a of e)t.add(a.position);t.divideScalar(e.length);const s=e.map(a=>t.distanceTo(a.position)+a.radius).sort((a,o)=>a-o),i=this.handlers.handoffKey!==void 0?.95:1,r=Math.max(1,s[Math.max(0,Math.ceil(s.length*i)-1)]??1);this.rig.frame(t,r)}rebuildGen=0;slicing=!1;rebuild(e=!0,t="full"){const s=++this.rebuildGen;if(this.slicing&&(this.slicing=!1,this.handlers.progress?.(1,1,0)),this.strategy!=="molecule"){this.draw(K1(this.graph.nodes),e);return}let i=this.frozen;if(t!=="full"&&i.size===0){const u=this.graph.nodes.map(h=>h.id).filter(h=>this.lastPositions.has(h));u.length>0&&(i=new Set(u))}const r=Z1(this.graph.nodes,this.projection==="2d"?2:3,this.lastPositions,this.physicsOnce!==void 0?{...this.physics,...this.physicsOnce}:this.physics,i);if(r.moving===0){this.draw(r.place(),e);return}const a=this.graph.nodes.length,o=this.handlers.progress,l=r.total*r.moving<Q1;if((!l||this.arrangement!=="galaxy")&&o!==void 0&&this.handlers.handoffKey!==void 0&&this.frozen.size===0){this.hierarchy_run(s,e,i,o);return}if(o===void 0||l){r.step(r.total),this.draw(r.place(),e);return}let c=0;this.slicing=!0,o(0,r.total,a);const d=()=>{if(s!==this.rebuildGen||this.disposed)return;const u=performance.now();for(;c<r.total&&performance.now()-u<J1;)r.step(1),c+=1;if(c<r.total){o(c,r.total,a),window.requestAnimationFrame(d);return}this.slicing=!1,this.draw(r.place(),e),o(r.total,r.total,a)};window.requestAnimationFrame(d)}layoutWorker=null;arrangement="galaxy";arrangementMemory=new Map;arrangement_set(e,t,s=!0){if(e===this.arrangement)return;this.arrangementMemory.set(this.arrangement,new Map(this.lastPositions)),this.arrangement=e;let i=this.arrangementMemory.get(e);i===void 0&&t!==void 0&&Object.keys(t).length>0&&(i=new Map(Object.entries(t).map(([r,[a,o,l]])=>[r,new F(a,o,l)]))),this.lastPositions=i??new Map,s&&this.rebuild(!0,i===void 0?"full":"hold")}arrangement_get(){return this.arrangement}hierarchy_run(e,t,s,i){const r=this.handlers.handoffKey;if(r===void 0)return;const a=Qf(this.graph.nodes),o=new Map([...this.lastPositions].map(([p,z])=>[p,[z.x,z.y,z.z]])),l=TS(this.graph.nodes,r,o,s),c=1e3,d=l.length;this.slicing=!0,i(0,c,d);const u=this.physicsOnce!==void 0?{...this.physics,...this.physicsOnce}:this.physics,h=p=>{const z=this.graph.nodes.map(m=>{const f=p[m.id]??[0,0,0];return{node:m,position:new F(f[0],f[1],f[2]),radius:a.get(m.id)??jt}});this.slicing=!1,this.draw(z,t),i(c,c,d)};if(this.layoutWorker===null){const p=this.layoutWorkerOf;if(p===void 0){const z=i1(this.arrangement);if(z===void 0){console.error(`layout: no engine named ${this.arrangement}`),this.slicing=!1,i(c,c,d);return}h(z.run({nodes:l,physics:u},m=>i(Math.min(c-1,Math.floor(m*c)),c,d)).positions);return}this.layoutWorker=p()}const g=this.layoutWorker;g.onmessage=p=>{const z=p.data;if(!(z.generation!==this.rebuildGen||this.disposed)){if(z.type==="progress"){i(Math.min(c-1,Math.floor((z.fraction??0)*c)),c,d);return}if(z.type==="failed"){console.error(`layout: ${z.reason??"the engine failed"}`),this.slicing=!1,i(c,c,d);return}h(z.positions??{})}},g.postMessage({generation:e,nodes:l,physics:u,arrangement:this.arrangement})}draw(e,t){this.group.clear(),this.spheres.clear(),this.censusField.clear(),this.pull=null,this.drag=null,this.starField.clear(),this.labels.clear(),this.handoffField.clear(),this.placedById=new Map,this.tubes.clear();const s=this.palette_read();if(this.pulseColor=s.pulse,this.lastPositions=new Map(e.map(z=>[z.node.id,z.position.clone()])),this.projection==="2d")for(const z of e)z.position.z=0;if(this.census){const z=e.filter(m=>m.node.solid===!0&&m.node.ghost!==!0);this.censusBuild(e.filter(m=>m.node.solid!==!0),s,t),z.length>0&&this.solid_draw(z,s);return}!this.ambient&&t&&this.camera_fit(e);const i=new Map(e.map(z=>[z.node.id,z])),r=new Map;for(const z of e)for(const m of z.node.parentIds)r.set(m,[...r.get(m)??[],z]);const a=z=>{const m=r.get(z)??[];if(m.length===0)return null;const f=new F;for(const _ of m)f.add(_.position);return f.divideScalar(m.length)},o=this.drawMode==="stars",l=[],c=o&&this.replay===null?this.handlers.handoffKey:void 0;for(const{node:z,position:m,radius:f}of e){if(z.caption!==void 0){const _=z.ghost===!0?a(z.id):null,O=_!==null?0:z.halo===!0?Dc(z.count??1):f;this.labels.caption_add(z.id,z.caption,_??m,O,s.done,z.dim===!0,z.count??1)}if(!(z.ghost===!0&&z.halo!==!0)){if(o&&z.solid!==!0){if(z.halo===!0){this.nebula_add(z,m,s);continue}l.push({id:z.id,position:m.clone(),radius:f,color:Ir(z.look.paint,s).clone(),dim:z.dim===!0,ember:z.look.ember,...z.ring===!0?{ring:!0}:{}});continue}if(z.halo===!0){this.spheres.halo_add(z.id,m,Dc(z.count??1),s.edge,z.dim===!0);continue}this.spheres.sphere_add(z.id,m,f,{color:Ir(z.look.paint,s),dim:z.dim===!0,selected:z.id===this.selectedId,flat:this.projection==="2d"})}}l.length>0&&this.starField.draw(l,window.devicePixelRatio,this.renderer.domElement.height,this.camera.fov);for(const z of e)this.placedById.set(z.node.id,z);if(c!==void 0){const z=new Map(this.graph.nodes.map(m=>[m.id,m]));this.handoffField.gather(l,m=>{const f=z.get(m);return f===void 0?null:c(f)})}const d=[],u=[],h=z=>!o||z.node.solid===!0,g=[],p=(z,m,f,_,O,w)=>{const x=_?.35:1,S=d.length/6;d.push(z.x,z.y,z.z,m.x,m.y,m.z),g.push(w,O.id),u.push(f.r*x,f.g*x,f.b*x,f.r*x,f.g*x,f.b*x);const I=_||c===void 0?null:c(O);I!==null&&this.handoffField.thread_note(I,S)};for(const z of e){const{node:m,position:f}=z;if(m.ghost!==!0){for(const _ of m.parentIds){const O=i.get(_);if(!O||O.node.ghost===!0)continue;const w=m.dim===!0||O.node.dim===!0;h(z)&&h(O)?!o&&w&&this.spheres.edge_add(_,m.id,O.position,f,s.edge,!1,w):p(O.position,f,s.edge,w,m,_)}for(const _ of m.joinParentIds){const O=i.get(_);if(!O)continue;if(m.joinFaint===!0){p(O.position,f,s.join,!0,m,_);continue}const w=m.dim===!0||O.node.dim===!0;h(z)&&h(O)?!o&&w&&this.spheres.edge_add(_,m.id,O.position,f,s.join,!0,w):p(O.position,f,s.join,w,m,_)}}}{const z=e.filter(m=>m.node.ghost!==!0&&m.node.halo!==!0&&(o?m.node.solid===!0:m.node.dim!==!0)).map(m=>m.node.id);if(z.length>0){const m={tubes:null,mix:1};this.tubes.build(m,z,new Set(z))}}this.starField.threads_draw(d,u,g),this.replay!==null&&this.replay_paintAll()}replay_begin(e,t=1){const s=new q1(e);this.replay={clock:s,arrivals:e,shown:new Set},this.rebuild(!1,"hold"),this.replay_paintAll(),s.play(t)}replay_play(e){this.replay?.clock.play(e)}replay_pause(){this.replay?.clock.pause()}replay_seek(e){this.replay!==null&&this.replay_apply(this.replay.clock.seek(e))}replay_stop(){this.replay!==null&&(this.replay=null,this.rebuild(!1,"hold"))}replay_state(){return this.replay===null?null:{playing:this.replay.clock.playing(),at:this.replay.clock.at(),span:this.replay.clock.span()}}replay_step(){const e=this.replay;if(e===null)return;const t=e.clock.playing(),s=e.clock.step();this.replay_apply(s);for(const[i,r]of e.clock.flashing())this.starField.flash_set(i,r);this.starField.flush(),(t||s.arrived.length>0)&&this.handlers.replay?.(s.at,e.clock.playing())}replay_apply(e){const t=this.replay;if(!(t===null||e.arrived.length===0&&e.departed.length===0)){for(const s of e.arrived)t.shown.add(s);for(const s of e.departed)t.shown.delete(s),this.starField.flash_set(s,0);this.starField.presence_set(e.arrived,1),this.starField.presence_set(e.departed,0),this.starField.threads_present(s=>t.shown.has(s)||!t.arrivals.has(s)),this.starField.flush()}}replay_paintAll(){const e=this.replay;if(e===null)return;const t=[...e.arrivals.keys()].filter(s=>!e.shown.has(s));this.starField.presence_set(t,0),this.starField.presence_set(e.shown,1),this.starField.threads_present(s=>e.shown.has(s)||!e.arrivals.has(s)),this.starField.flush()}handoff_step(){if(this.handoffField.size()===0)return;const t=(this.renderer.domElement.clientHeight||1)/(2*Math.tan(this.camera.fov*Math.PI/360));this.group.updateMatrixWorld(!0),this.camera.updateMatrixWorld();const s=new Gt().multiplyMatrices(this.camera.matrixWorldInverse,this.group.matrixWorld);this.handoffField.step(s,t,performance.now())}handoffLook_of(e){const t=this.placedById.get(e);if(t!==void 0)return{position:t.position,radius:t.radius,color:Ir(t.node.look.paint,this.palette_read())}}tubeNode_of(e){const t=this.placedById.get(e);if(t!==void 0)return{position:t.position,radius:t.radius,parents:t.node.parentIds,joins:t.node.joinFaint===!0?[]:t.node.joinParentIds,state:t.node.look.state}}nebula_add(e,t,s){this.starField.nebula_add(e.id,t,Dc(e.count??1),s.edge,e.dim===!0)}nodeWorld_of(e){const t=this.meshes.get(e);if(t!==void 0){const i=t.geometry;return i.boundingSphere===null&&i.computeBoundingSphere(),{position:t.getWorldPosition(new F),radius:i.boundingSphere?.radius??jt}}const s=this.starField.entry(e);return s!==void 0?{position:this.group.localToWorld(s.position.clone()),radius:s.radius}:null}drawnIds(){return[...this.meshes.keys(),...this.starField.ids()]}positions_sync(){for(const{id:e,position:t}of this.pull?.positions()??[])this.meshes.get(e)?.position.set(...t),this.lastPositions.set(e,new F(...t));this.tubes.follow(),this.spheres.edges_follow()}grab_begin(e){const t=this.picker.mesh_under(e),s=t?.userData.nodeId;if(t===null||typeof s!="string")return!1;const i=this.camera.getWorldDirection(new F).negate();this.group.updateMatrixWorld(!0);const r=new gi().setFromNormalAndCoplanarPoint(i,t.getWorldPosition(new F));return this.drag={nodeId:s,plane:r,startX:e.clientX,startY:e.clientY,moved:!1,solo:this.strategy==="ranked",home:t.position.clone()},!0}dragSim_begin(e){const t=Qf(this.graph.nodes),s=[...this.meshes].map(([r,a])=>({id:r,position:[a.position.x,a.position.y,a.position.z],radius:t.get(r)??jt,dim:a.userData.dim===!0,halo:a.userData.halo===!0})),i=[];for(const r of this.graph.nodes)for(const a of[...r.parentIds,...r.joinParentIds])i.push({from:a,to:r.id});this.pull=new XS({grabbed:e,nodes:s,edges:i,dimensions:this.projection==="2d"?2:3,baseRadius:jt})}drag_move(e){if(this.drag===null||(this.rig.spin_pause(),!this.drag.moved&&Math.abs(e.clientX-this.drag.startX)+Math.abs(e.clientY-this.drag.startY)>Bg&&(this.drag.moved=!0,this.drag.solo||this.dragSim_begin(this.drag.nodeId)),!this.drag.moved))return;const t=new F;if(this.picker.ray_aim(e).ray.intersectPlane(this.drag.plane,t)!==null){if(this.group.worldToLocal(t),this.drag.solo){const s=this.meshes.get(this.drag.nodeId);s!==void 0&&(s.position.copy(t),this.positions_sync());return}this.pull?.pin([t.x,t.y,t.z])}}dragReturns=[];grab_end(){if(this.drag===null)return!1;const e=this.drag.moved;if(this.drag.solo&&this.drag.moved){const t=this.meshes.get(this.drag.nodeId);t!==void 0&&this.dragReturns.push({mesh:t,from:t.position.clone(),to:this.drag.home.clone(),startedAt:Date.now()})}return this.pull?.release(),this.drag=null,e}solid_draw(e,t){for(const r of e)this.placedById.set(r.node.id,r),this.spheres.sphere_add(r.node.id,r.position,r.radius,{color:Ir(r.node.look.paint,t)});const s=e.map(r=>r.node.id),i={tubes:null,mix:1};this.tubes.build(i,s,new Set(s))}leave_handle(e){if(this.hovered=null,e.pointerType==="touch"&&this.tip!==null&&!this.tip.hidden){this.tapTipTimer!==null&&window.clearTimeout(this.tapTipTimer),this.tapTipTimer=window.setTimeout(()=>{this.tapTipTimer=null,this.tip!==null&&(this.gestures?.fingersDown()??0)===0&&(this.tip.hidden=!0)},X1);return}this.tip&&(this.tip.hidden=!0)}hover_handle(e){if(this.tip===null)return;const t=this.picker.node_under(e,this.gestures?.pressKind()==="touch"),s=typeof t=="string"?this.graph.nodes.find(r=>r.id===t):void 0;if(s===void 0){this.tip.hidden=!0,this.renderer.domElement.style.cursor="",this.hovered=null;return}this.hovered={id:s.id,x:e.clientX,y:e.clientY};const i=this.renderer.domElement.getBoundingClientRect();this.tip.textContent=this.handlers.tip?.(s)??s.label,this.tip.style.left=`${e.clientX-i.left+14}px`,this.tip.style.top=`${e.clientY-i.top+10}px`,this.tip.hidden=!1,this.renderer.domElement.style.cursor="pointer"}pick_handle(e,t){const s=this.hovered,i=s!==null&&Math.hypot(e.clientX-s.x,e.clientY-s.y)<=6?s.id:this.picker.node_under(e,this.gestures?.pressKind()==="touch");if(i===null){t==="select"&&this.selectedId!==null&&(this.selection_clear(),this.handlers.deselect?.());return}const r=this.graph.nodes.find(a=>a.id===i);r&&(t==="select"?(this.selectedId=i,this.census||this.selection_paint(),this.handlers.select?.(r)):this.handlers.activate?.(r))}}const Cg=new Set(["created","waiting","scheduled","started","registeringFiles"]);function tA(n){return n.status!==void 0&&Cg.has(n.status)?"live":n.status==="finishedWithError"||n.share!==void 0&&n.share>=1?"failed":n.status==="finishedSuccessfully"||n.share!==void 0&&n.status!==void 0?"done":"rest"}function sA(n){return n.share!==void 0&&n.status!=="cancelled"?n.share>=1?{token:"error"}:{blend:["done","error"],share:Math.sqrt(Math.max(0,n.share))}:n.status==="finishedWithError"||n.status==="cancelled"?{token:"error"}:n.hue!==void 0?{hue:n.hue}:n.parentIds.length===0&&n.joinParentIds.length===0?{token:"root"}:n.status===void 0?{token:"template"}:n.status==="finishedSuccessfully"?{token:"done"}:Cg.has(n.status)?{token:"running"}:{token:"unknown"}}function Jf(n){return{state:tA(n),paint:sA(n),ember:n.share!==void 0&&n.share>0||n.status==="finishedWithError",waved:n.status===void 0||n.status==="finishedSuccessfully"||n.status==="finishedWithError"}}function nA(){const n=getComputedStyle(document.documentElement),e=(t,s)=>new Ye(n.getPropertyValue(t).trim()||s);return{running:e("--orange","#f70"),done:e("--butter","#fec"),error:new Ye("#f22"),template:e("--harvestgold","#fa4"),unknown:new Ye("#555"),edge:e("--pumpkin-pie","#c50"),join:e("--honey","#fc9"),root:e("--dag-root","#6fbfae"),pulse:e("--dag-pulse","#48d8f0")}}class Rl extends eA{byId=new Map;constructor(e,t={},s={}){const i={palette:nA,layoutWorker:()=>new Worker(new URL(""+new URL("layoutWorker-CfJVM55D.js",import.meta.url).href,import.meta.url),{type:"module"})};s.ambient!==void 0&&(i.ambient=s.ambient),super(e,t,i)}graph_set(e,t={}){const s=e.nodes.map(i=>Object.assign(i,{look:Jf(i)}));this.byId=new Map(s.map(i=>[i.id,i])),super.graph_set({nodes:s},t)}status_update(e,t){const s=this.byId.get(e);s===void 0||s.status===t||(s.status=t,this.look_update(e,Jf(s)))}}const Pg=24,ru="argus.dormant";class iA{constructor(e=Pg,t){this.cap=e,this.store=t,this.rehydrate()}cap;store;groups=new Map;add(e){for(this.groups.delete(e.id),this.groups.set(e.id,e);this.groups.size>this.cap;){const t=this.oldest_id();if(t===void 0)break;this.groups.delete(t)}this.persist()}list(){return[...this.groups.values()].sort((e,t)=>t.lastTouched-e.lastTouched)}get(e){return this.groups.get(e)}has(e){return this.groups.has(e)}dismiss(e){const t=this.groups.delete(e);return t&&this.persist(),t}oldest_id(){let e;for(const t of this.groups.values())(e===void 0||t.lastTouched<e.lastTouched)&&(e=t);return e?.id}persist(){if(this.store!==void 0)try{this.store.setItem(ru,JSON.stringify([...this.groups.values()]))}catch{}}rehydrate(){if(this.store!==void 0)try{const e=this.store.getItem(ru);if(e===null)return;const t=JSON.parse(e);if(!Array.isArray(t))return;for(const s of t)s!==null&&typeof s=="object"&&typeof s.id=="string"&&this.groups.set(s.id,s)}catch{}}}function ep(){try{const n=globalThis.localStorage;return n===void 0?void 0:(n.getItem(ru),n)}catch{return}}class rA{constructor(e,t){this.host=t,this.grid=e.querySelector(".panes-grid"),this.empty=e.querySelector(".panes-empty"),this.grid.addEventListener("click",this.click_handle)}host;grid;empty;render(){const e=this.host.list();this.empty.hidden=e.length>0,this.grid.replaceChildren(...e.map(t=>this.card_build(t)))}card_build(e){const t=document.createElement("button");t.className="panes-card",t.dataset.restore=e.id,t.title=`restore ${e.label}`;const s=document.createElement("span");if(s.className="panes-card-figure",e.thumbnail!==void 0){const o=document.createElement("img");o.src=e.thumbnail,o.alt="",s.appendChild(o)}else s.classList.add("panes-card-glyph"),s.textContent=e.members.includes("files")&&!e.members.includes("viewer")?"▤":"▣";t.appendChild(s);const i=document.createElement("span");i.className="panes-card-label",i.textContent=e.label,t.appendChild(i);const r=document.createElement("span");r.className="panes-card-badges";for(const o of aA(e.members)){const l=document.createElement("span");l.className="panes-card-badge",l.textContent=o.toUpperCase(),r.appendChild(l)}t.appendChild(r);const a=document.createElement("button");return a.className="panes-card-dismiss",a.dataset.dismiss=e.id,a.title=`forget ${e.label}`,a.textContent="DISMISS",t.appendChild(a),t}click_handle=e=>{const t=e.target,s=t.closest("[data-dismiss]");if(s!==null){e.stopPropagation();const r=s.dataset.dismiss??"";this.host.dismiss(r),this.render();return}const i=t.closest("[data-restore]");i!==null&&this.host.restore(i.dataset.restore??"")}}function aA(n){return[...new Set(n)]}const Sn=["#000000","#f24444","#33cc66","#ffaa44","#5599ff","#cc88ff","#44cccc","#ffeecc","#777777","#ff6666","#66ee99","#ffcc66","#77bbff","#dd99ff","#66dddd","#ffffff"],oA={yellow:Sn[3],white:Sn[7],cyan:Sn[6],green:Sn[2],magenta:Sn[5]};function Lg(){return{fg:null,bg:null,bold:!1,dim:!1,italic:!1,inverse:!1,underline:!1}}function lA(n){if(n<16)return Sn[n]??"#ffeecc";if(n<232){const t=n-16,s=[0,95,135,175,215,255],i=s[Math.floor(t/36)%6]??0,r=s[Math.floor(t/6)%6]??0,a=s[t%6]??0;return`#${(i<<16|r<<8|a).toString(16).padStart(6,"0")}`}const e=8+(n-232)*10;return`#${(e<<16|e<<8|e).toString(16).padStart(6,"0")}`}function cA(n,e){for(let t=0;t<e.length;t++){const s=e[t]??0;if(s===0)Object.assign(n,Lg());else if(s===1)n.bold=!0;else if(s===2)n.dim=!0;else if(s===3)n.italic=!0;else if(s===4)n.underline=!0;else if(s===7)n.inverse=!0;else if(s===27)n.inverse=!1;else if(s===22)n.bold=!1,n.dim=!1;else if(s===23)n.italic=!1;else if(s===24)n.underline=!1;else if(s>=30&&s<=37)n.fg=Sn[s-30]??null;else if(s>=90&&s<=97)n.fg=Sn[s-90+8]??null;else if(s===39)n.fg=null;else if(s>=40&&s<=47)n.bg=Sn[s-40]??null;else if(s>=100&&s<=107)n.bg=Sn[s-100+8]??null;else if(s===49)n.bg=null;else if(s===38||s===48){const i=e[t+1]??0;let r=null;if(i===5)r=lA(e[t+2]??0),t+=2;else if(i===2){const a=e[t+2]??0,o=e[t+3]??0,l=e[t+4]??0;r=`#${(a<<16|o<<8|l).toString(16).padStart(6,"0")}`,t+=4}s===38?n.fg=r:n.bg=r}}}function dA(n){const e=[],t=n.inverse?n.bg??"#000":n.fg,s=n.inverse?n.fg??"var(--daybreak)":n.bg;return t!==null&&e.push(`color:${t}`),s!==null&&e.push(`background-color:${s}`),n.bold&&e.push("font-weight:bold"),n.dim&&e.push("opacity:0.55"),n.italic&&e.push("font-style:italic"),n.underline&&e.push("text-decoration:underline"),e.join(";")}function Ks(n){return n.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}const Tc=/\x1b(?:\[([0-?]*)[ -/]*([@-~])|\][^\x07\x1b]*(?:\x07|\x1b\\)|[@-Z\\-_])/g;function jn(n){const e=Lg();let t="",s=0;const i=a=>{if(a.length===0)return;const o=dA(e),l=Ks(a.replace(/\r/g,""));t+=o.length>0?`<span style="${o}">${l}</span>`:l};Tc.lastIndex=0;let r=Tc.exec(n);for(;r!==null;){if(i(n.slice(s,r.index)),s=r.index+r[0].length,r[2]==="m"){const a=(r[1]??"").split(/[;:]/).map(o=>o.length>0?Number(o):0);cA(e,a)}r=Tc.exec(n)}return i(n.slice(s)),t}function uA(n){for(const[e,t]of Object.entries(oA))n.style.setProperty(`--console-${e}`,t)}const hA="G1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MTsxbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MTsxbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtChtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzE7MW0gG1swbRtbMzg7MjswOzE7Mm0gG1swbRtbMzg7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A7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MTsxbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzE7MjszbSAbWzBtG1szODsyOzE7MjszbSAbWzBtG1szODsyOzE7MjszbSAbWzBtG1szODsyOzE7MjszbSAbWzBtG1szODsyOzE7MjsybSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtChtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzE7MW0gG1swbRtbMzg7MjsxOzI7M20gG1swbRtbMzg7MjsxOzI7M20gG1swbRtbMzg7MjsxOzI7M20gG1swbRtbMzg7MjswOzE7Mm0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjsxOzI7M20gG1swb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zM4OzI7MDswOzBtIBtbMG0bWzM4OzI7MDswOzBtIBtbMG0bWzM4OzI7MDswOzBtIBtbMG0bWzM4OzI7MDswOzBtIBtbMG0bWzM4OzI7MDswOzBtIBtbMG0bWzM4OzI7MDswOzBtIBtbMG0bWzM4OzI7MDswOzBtIBtbMG0KG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtCg==",fA=/\x1b\[[0-9;]*m/g,tp="\x1B[0m",sp="\x1B[7m",Wg=atob(hA).trimEnd().split(`
4207
4207
  `);Wg.map(n=>n.replace(fA,""));function pA(n){const e=n.replace(/\x1b\[0m/g,`${tp}${sp}`);return`${sp}${e}${tp}`}function mA(n,e=!1){const t=Wg;return e?t.map(pA):t}function kg(n){const e=n.lastIndexOf("/");return e<=0?"/":n.slice(0,e+1)}function gA(n){const e=new URLSearchParams(n.search).get("ws");return e!==null&&e.length>0?e:`${n.protocol==="https:"?"wss":"ws"}://${n.host}${kg(n.pathname)}`}function OI(n,e){return new URL(n,e).href}function $u(n,e){const t=`path=${encodeURIComponent(n)}`;return e.length>0?`vfs?${t}&token=${encodeURIComponent(e)}`:`vfs?${t}`}function MA(n,e){return`${$u(n,e)}&download=1`}function Ug(n){return new URLSearchParams(n).has("door")}function np(n,e){const s=kg(n).split("/").filter(i=>i.length>0).slice(0,-2);return`/${s.length>0?`${s.join("/")}/`:""}${e}`}const bA="daemon";class Vu{socket;handlers;token;pending=new Map;pendingCompletions=new Map;silentIds=new Set;nextId=0;constructor(e,t,s){this.socket=e,this.handlers=t,this.token=s,this.socket.onmessage=i=>this.message_handle(String(i.data)),this.socket.onclose=()=>this.handlers.close_handle?.()}static session_attach(e,t,s){return new Promise((i,r)=>{const a=new WebSocket(e);a.onerror=()=>r(new Error(`cannot reach the daemon at ${e}`)),a.onopen=()=>{a.send(JSON.stringify({type:"attach",protocolVersion:Vc,token:t,capabilities:{shellCommands:!1,color:!0,hiddenInput:!0,fileDelivery:!0,localFilesystem:!1}}))},a.onmessage=o=>{const l=ip(String(o.data));if(!l){r(new Error("invalid attach response")),a.close();return}if(l.type==="error"){r(new Error(l.reason)),a.close();return}if(l.type!=="attached"){r(new Error(`unexpected attach response: ${l.type}`)),a.close();return}const c=new Vu(a,s,t);i({client:c,attach:{session:l.session,protocolVersion:l.protocolVersion,...l.stack!==void 0?{stack:l.stack}:{},...l.hostControl!==void 0?{hostControl:l.hostControl}:{}}})}})}line_execute(e,t){const s=`argus-${this.nextId++}`;return t?.silent===!0&&this.silentIds.add(s),new Promise((i,r)=>{this.pending.set(s,{resolve:i,reject:r,liveChannels:new Set,observed:t?.observe!==!1}),this.socket.send(JSON.stringify({type:"execute",id:s,line:e,...t?.silent===!0?{instrument:!0}:{}}))})}line_complete(e){const t=`argus-c-${this.nextId++}`;return new Promise((s,i)=>{this.pendingCompletions.set(t,{resolve:s,reject:i}),this.socket.send(JSON.stringify({type:"complete",id:t,prefix:e}))})}regard_send(e){this.socket.send(JSON.stringify({type:"regard",regard:e}))}watch_send(e){this.socket.send(JSON.stringify({type:"watch",subject:e}))}unwatch_send(e){this.socket.send(JSON.stringify({type:"unwatch",subject:e}))}connection_close(){this.socket.close()}message_handle(e){const t=ip(e);if(t)switch(t.type){case"result":{this.silentIds.delete(t.id);const s=this.pending.get(t.id);if(s&&(this.pending.delete(t.id),s.resolve({envelopes:t.envelopes,liveChannels:s.liveChannels})),s===void 0||s.observed)for(const i of t.envelopes)this.handlers.envelope_observe?.(i);break}case"complete":{const s=this.pendingCompletions.get(t.id);s&&(this.pendingCompletions.delete(t.id),s.resolve({candidates:t.candidates,prefix:t.prefix}));break}case"output":{(t.channel==="data"||t.channel==="err")&&this.pending.get(t.id)?.liveChannels.add(t.channel),this.silentIds.has(t.id)||this.handlers.output_receive?.(t.channel,t.chunk);break}case"progress":{this.handlers.progress_receive?.(t);break}case"session":{if(t.surface===bA){this.handlers.ambient_receive?.(t.envelope);break}this.handlers.session_receive?.(t.surface,t.envelope),this.handlers.envelope_observe?.(t.envelope);break}case"watched":{this.handlers.watched_receive?.(t.subject,t.state);break}case"numbered":{this.handlers.numbered_receive?.({id:t.id,source:t.source,rows:t.rows,handles:t.handles});break}case"promptline":{this.handlers.promptline_receive?.(t.context);break}case"telemetry":{this.handlers.telemetry_receive?.(t.index,{lane:t.lane,cube:t.cube,state:t.state});break}case"regard":{this.handlers.regard_receive?.(t.regard);break}case"error":{if(t.id!==void 0){const s=this.pending.get(t.id);s&&(this.pending.delete(t.id),s.reject(new Error(t.reason)));const i=this.pendingCompletions.get(t.id);i&&(this.pendingCompletions.delete(t.id),i.reject(new Error(t.reason)))}break}case"prompt":{const s=this.handlers.ask_receive;if(s===void 0){this.reply_send({type:"promptError",promptId:t.promptId,reason:"this surface has no way to ask"});break}const i=t.promptId;s({message:t.message,kind:jb(t),...t.path?.suggest===void 0?{}:{suggest:t.path.suggest},...t.path===void 0?{}:{path:t.path},...t.commit===void 0?{}:{commit:t.commit}}).then(r=>{if(r===null){this.reply_send({type:"promptError",promptId:i,reason:"the operator abandoned the question"});return}this.reply_send({type:"promptAnswer",promptId:i,answer:r})}).catch(r=>{const a=r instanceof Error?r.message:"the question could not be answered";this.reply_send({type:"promptError",promptId:i,reason:a})});break}case"pipe":{this.reply_send({type:"pipeError",pipeId:t.pipeId,reason:"the argus surface cannot run pipeline segments"});break}case"shell":{this.reply_send({type:"shellError",shellId:t.shellId,reason:"the argus surface cannot run shell commands"});break}case"edit":{this.reply_send({type:"editError",editId:t.editId,reason:"the argus surface cannot open an editor"});break}case"deliver":{this.deliver_run(t);break}}}async deliver_run(e){try{const t=$u(e.path,this.token),s=await fetch(t);if(!s.ok)throw new Error(`calypso refused to serve this file (HTTP ${s.status})`);const i=await s.blob(),r=URL.createObjectURL(i),a=document.createElement("a");a.href=r,a.download=e.filename,document.body.appendChild(a),a.click(),a.remove(),setTimeout(()=>URL.revokeObjectURL(r),0),this.reply_send({type:"deliverResult",deliverId:e.deliverId,location:e.filename,bytes:i.size})}catch(t){const s=t instanceof Error?t.message:String(t);this.reply_send({type:"deliverError",deliverId:e.deliverId,reason:s})}}reply_send(e){this.socket.send(JSON.stringify(e))}}function ip(n){try{const e=Jb(JSON.parse(n));return e.ok&&e.value!==void 0?e.value:null}catch{return null}}const Ni={pacs:{bg:"#875FFF",fg:"#FFFFFF"},host:{bg:"#00AFFF",fg:"#001018"},user:{bg:"#00D787",fg:"#00140C"},dir:{bg:"#FFD75F",fg:"#201800"},physical:{bg:"#FF5F5F",fg:"#1B0000"},duration:{bg:"#FF8700",fg:"#201000"},status:{bg:"#FF005F",fg:"#FFFFFF"}},zA={cold:{icon:"",label:"proc cold",color:{bg:"#FF8700",fg:"#201000"}},cached:{icon:"",label:"proc cached, refreshing",color:{bg:"#5F5F87",fg:"#FFFFFF"}},failed:{icon:"",label:"proc failed",color:{bg:"#FF005F",fg:"#FFFFFF"}}},Wn={powerline:"",cube:"",database:"",user:"",folder:"",microscope:"",bolt:"",error:""},_A=3e3,wA=200;class yA{output;splashGreeting=null;progressRegion;promptBar;inputGlyph;input;submit;complete;promptContext=null;busy=!0;pendingAsk=null;queuedLines=[];questionOpen=!1;history=[];historyIndex=0;streamBlock=null;streamPendingElement=null;streamPendingText="";streamPendingChannel="data";constructor(e,t,s){this.submit=t,this.complete=s,e.innerHTML=`
4208
4208
  <div class="argus-screen">
4209
4209
  <div class="argus-output"></div>
@@ -4224,11 +4224,11 @@ void main() {
4224
4224
  <span class="argus-progress-label"></span>
4225
4225
  <span class="argus-progress-elapsed"></span>`,this.region.appendChild(i);const r={element:i,labelElement:i.querySelector(".argus-progress-label"),barFill:i.querySelector(".argus-progress-fill"),startedAt:performance.now()};return this.rows.set(e,r),r}row_paint(e,t){const s=t.label??t.operation,i=t.current!==void 0&&t.total!==void 0&&t.total>0?` ${ap(t.current,t.unit)}/${ap(t.total,t.unit)}`:"";if(e.labelElement.innerHTML=`${rp(s)}<span class="argus-progress-counts">${rp(i)}</span>`,e.barFill!==null){const r=t.percent??(t.current!==void 0&&t.total!==void 0&&t.total>0?t.current/t.total*100:0);e.barFill.style.width=`${Math.max(0,Math.min(100,r))}%`}}row_remove(e){const t=this.rows.get(e);t!==void 0&&(t.element.remove(),this.rows.delete(e),this.rows.size===0&&this.elapsedTimer!==null&&(clearInterval(this.elapsedTimer),this.elapsedTimer=null))}elapsed_ensure(){this.elapsedTimer===null&&(this.elapsed_paint(),this.elapsedTimer=window.setInterval(()=>this.elapsed_paint(),xA))}elapsed_paint(){const e=performance.now();for(const t of this.rows.values()){const s=t.element.querySelector(".argus-progress-elapsed");s!==null&&(s.textContent=`${((e-t.startedAt)/1e3).toFixed(1)}s`)}}}class AA{root;capsRows=[];strip;input;columns;value_of;onChange;leadingCells;state={sortKey:null,sortDir:"asc",filter:""};changeQueued=!1;change_emit(){this.changeQueued||(this.changeQueued=!0,window.requestAnimationFrame(()=>{this.changeQueued=!1,this.onChange()}))}host_prepare(e){this.root.parentElement!==e&&e.prepend(this.root);for(const t of[...e.children])t!==this.root&&t.remove()}shown=0;total=0;constructor(e,t,s,i,r=0,a=!0){this.columns=e,this.value_of=t,this.onChange=s,i!==void 0&&(this.state={...this.state,sortKey:i.key,sortDir:i.dir}),this.leadingCells=r,this.root=document.createElement("div"),this.root.className="roster-order",this.strip=document.createElement("div"),this.strip.className="roster-filter",this.strip.hidden=!0;const o=document.createElement("span");o.className="roster-filter-glyph",o.textContent="FILTER :",this.input=document.createElement("input"),this.input.className="roster-filter-input",this.input.placeholder="text, or column:text (e.g. owner:<user> status:error)",this.input.setAttribute("autocomplete","off"),this.input.addEventListener("input",()=>this.filter_set(this.input.value,!1)),this.input.addEventListener("keydown",l=>{l.key==="Escape"&&(l.stopPropagation(),this.strip_toggle(!1))}),this.strip.append(o,this.input),a&&this.root.appendChild(this.caps_mint()),this.root.appendChild(this.strip),this.caps_paint()}caps_mint(){const e=document.createElement("div");e.className="roster-caps";for(let t=0;t<this.leadingCells;t++)e.appendChild(document.createElement("span"));for(const t of this.columns){const s=document.createElement("button");s.className="roster-cap",s.dataset.key=t.key,s.title=`sort by ${t.label.toLowerCase()} (again to reverse)`,s.addEventListener("click",()=>this.sort_toggle(t.key)),e.appendChild(s)}return this.capsRows.push(e),this.caps_paint(),e}state_get(){return{...this.state}}sort_toggle(e){this.state.sortKey===e?this.sort_set(e,this.state.sortDir==="asc"?"desc":"asc"):this.sort_set(e,"asc")}sort_set(e,t){this.columns.some(s=>s.key===e)&&(this.state={...this.state,sortKey:e,sortDir:t},this.caps_paint(),this.change_emit())}onFilter=null;filterChange_observe(e){this.onFilter=e}filterText_get(){return this.state.filter}filter_set(e,t=!0){this.state={...this.state,filter:e},this.onFilter?.(e),t&&(this.input.value=e),e.length>0&&this.strip.hidden&&(this.strip.hidden=!1,this.onStrip?.()),this.change_emit()}strip_toggle(e){const t=e??this.strip.hidden;this.strip.hidden=!t,t?this.input.focus():this.state.filter.length>0&&this.filter_set(""),this.onStrip?.()}strip_isOpen(){return!this.strip.hidden}onStrip=null;stripChange_observe(e){this.onStrip=e}matches(e){return this.terms_parse().every(t=>(t.key!==null?String(this.value_of(e,t.key)).toLowerCase():this.columns.map(i=>String(this.value_of(e,i.key))).join(" ").toLowerCase()).includes(t.text))}sorted(e){const t=[...e],s=this.state.sortKey;if(s===null)return t;const i=this.state.sortDir==="asc"?1:-1;return t.sort((r,a)=>{const o=this.value_of(r,s),l=this.value_of(a,s);return typeof o=="number"&&typeof l=="number"?(o-l)*i:String(o).localeCompare(String(l),void 0,{numeric:!0,sensitivity:"base"})*i}),t}counts_set(e,t){this.shown=e,this.total=t}terms_parse(){return this.state.filter.toLowerCase().split(/\s+/).filter(e=>e.length>0).map(e=>{const t=e.indexOf(":");if(t>0){const s=e.slice(0,t);if(this.columns.some(i=>i.key===s))return{key:s,text:e.slice(t+1)}}return{key:null,text:e}})}apply(e){const t=this.sorted(e.filter(s=>this.matches(s)));return this.shown=t.length,this.total=e.length,t}summary(){const e=[];return this.state.filter.length>0&&e.push(`FILTERED ${this.shown}/${this.total}`),e.join(" · ")}caps_paint(){const e=this.capsRows.filter(t=>t.parentElement===null||t.isConnected);this.capsRows.length=0,this.capsRows.push(...e);for(const t of this.capsRows)for(const s of t.querySelectorAll(".roster-cap")){const i=s.dataset.key??"",r=this.columns.find(o=>o.key===i),a=i===this.state.sortKey;s.classList.toggle("roster-active",a),s.textContent=`${r?.label??i}${a?this.state.sortDir==="asc"?" ▲":" ▼":""}`}}}class EA{container;order;field=null;constructor(e,t){this.container=e,this.order=t}field_open(){this.order.host_prepare(this.container);const e=document.createElement("div");return e.className="listing-field",this.container.appendChild(e),this.field=e,e}field_get(){return this.field}}function DA(n){return n.map(e=>({key:e.key,label:e.label}))}function IA(n){const e=new Map(n.map(t=>[t.key,t]));return(t,s)=>{const i=e.get(s);if(i===void 0)return"";if(i.compare!==void 0)return i.compare(t);const r=i.cell(t);return typeof r=="string"?r:r.textContent??""}}function TA(n,e,t){const s=document.createElement("div");s.className=t.className(n);for(const i of t.leading?.(n)??[])s.appendChild(i);for(const i of e){const r=i.cell(n);if(typeof r!="string"){s.appendChild(r);continue}const a=document.createElement("span");a.className=i.className,a.textContent=r,s.appendChild(a)}return t.decorate?.(s,n),s}function So(n){let e=0,t=0,s=!1;for(const i of n)e+=i.done,t+=i.total,s=s||i.failed===!0;return{done:e,total:t,...s?{failed:!0}:{}}}function Vo(n){const e=document.createElement("span");if(e.className="listing-progress",n===null||n.total===0)return e.classList.add("listing-progress-idle"),e.title=n===null?"no work":"nothing scheduled yet",e;const t=n.failed===!0,s=n.done>=n.total,i=t&&n.succeeded!==void 0?n.succeeded:n.done,r=Math.min(1,Math.max(0,i/n.total));e.classList.add(t?"listing-progress-failed":s?"listing-progress-done":"listing-progress-running"),e.title=t&&n.succeeded!==void 0?`${n.succeeded}/${n.total} succeeded — errored`:`${n.done}/${n.total}`;const a=document.createElement("span");return a.className="listing-progress-fill",a.style.width=`${Math.round(r*100)}%`,e.appendChild(a),e}function Ho(n,e){const t=document.createElement("span");t.className="listing-actions";for(const s of e){if(s.offered!==void 0&&!s.offered(n))continue;const i=document.createElement("button");i.className="listing-action",i.textContent=s.label,s.disabled?.(n)===!0&&(i.disabled=!0),s.selected?.(n)===!0&&i.classList.add("listing-action-selected"),i.addEventListener("click",r=>{r.stopPropagation(),s.run(n)}),t.appendChild(i)}return t}function GA(n,e){return n.mode==="fold"&&n.open.has(e)}function RA(n,e){return n.mode!=="fold"||n.open.delete(e)?!1:(n.open.add(e),!0)}function kr(n,e){return{level_visit(t){return t(n,e)}}}function op(n,e){const t=[];let s=!1;for(const i of n){if(i.width===void 0||i.width.trim()==="")throw new Error(`listing trait '${i.key}' declares no width`);if(!lp(i.width))throw new Error(`listing trait '${i.key}' declares a content-sized track '${i.width.trim()}': a row is its own grid, so a track sized to its content sizes per row and jogs every column after it`);if(i.capped===!1){if(s)throw new Error(`uncapped listing trait '${i.key}' must lead the traits`)}else s=!0;t.push(i.width.trim())}if(e!==void 0){if(e.width===void 0||e.width.trim()==="")throw new Error("listing actions on the row declare no track; declare a width, or a row zone for the verbs to ride");if(!lp(e.width))throw new Error(`listing actions declare a content-sized track '${e.width.trim()}'`);t.push(e.width.trim())}return t.join(" ")}function lp(n){const e=n.trim();if(/^(auto|min-content|max-content)$/.test(e)||/^fit-content\(/.test(e))return!1;const t=/^minmax\(\s*([^,]+?)\s*,\s*([^)]+?)\s*\)$/.exec(e);if(t!==null){const s=t[1]??"";return/^(?:[1-9]\d*|0*\.\d*[1-9]\d*|[1-9]\d*\.\d+)(px|em|rem|ch|vw|vh|%)$/.test(s)}return/^(?:\d+\.?\d*|\.\d+)(px|em|rem|ch|vw|vh|%|fr)$/.test(e)}function BA(n){let e=0;for(const t of n){if(t.capped!==!1)break;e+=1}return e}let Ba=new Map,qo=new Map;function NA(n){if(Ba=new Map,qo=new Map,n!==null)for(const e of n.handles)Ba.has(e.address)||Ba.set(e.address,e),qo.set(e.kind,Math.max(qo.get(e.kind)??0,`${e.ordinal}`.length));jg()}function Fg(n){const e=Math.max(3,qo.get(n.kind)??0);return`${n.kind}${`${n.ordinal}`.padStart(e,"0")}`}function jg(){const n=new Map;for(const e of document.querySelectorAll(".listing-index")){const t=e.closest(".listing-row"),s=t?.parentElement??null;if(t===null||s===null)continue;if(t.classList.contains("listing-lead")){e.textContent="",e.classList.remove("numbered");continue}const i=n.get(s);i===void 0?n.set(s,[t]):i.push(t)}for(const e of n.values()){const t=`${Math.max(e.length,1)}`.length;e.forEach((s,i)=>{const r=s.querySelector(".listing-index");if(r===null)return;const a=r.dataset.address,o=a===void 0?void 0:Ba.get(a);r.textContent=o===void 0?`${i+1}`.padStart(t,"0"):Fg(o),r.classList.toggle("numbered",o!==void 0)})}}function CA(n){return{key:"index",label:"",className:"listing-index-cell",width:"5.2rem",capped:!1,cell:e=>{const t=document.createElement("span");t.className="listing-index";const s=n?.(e);s!==void 0&&(t.dataset.address=s);const i=s===void 0?void 0:Ba.get(s);return i!==void 0&&(t.textContent=Fg(i),t.classList.add("numbered")),t}}}class Hu{declaration;host;select;order;template;child;expansion;rowsByKey=new Map;dataByKey=new Map;cellsByKey=new Map;leadKeys=new Set;indicated=null;depth;constructor(e,t,s,i,r=0){e={...e,traits:[CA(e.address),...e.traits]},this.declaration=e,this.host=t,this.select=i,this.depth=r,this.template=op(e.traits,this.trackActions_get());const a=e.traits.filter(o=>o.capped!==!1);if(this.order=new AA(DA(a),IA(e.traits),()=>this.host.repaint(),e.defaultSort,BA(e.traits),s),this.expansion={mode:e.child===void 0?"replace":"fold",open:new Set},this.child=e.child===void 0?null:this.childSeat_build(e.child),this.child!==null){const o=this.child;this.order.filterChange_observe(l=>o.filter_set(l))}}childSeat_build(e){return e.level_visit((t,s)=>{const i=new Hu(s,this.host,!1,null,this.depth+1);return{filter_set:r=>i.filter_set(r),sort_set:(r,a)=>i.sort_set(r,a),survives:r=>i.anyMatch(t(r)),render:(r,a,o)=>{const l=document.createElement("div");l.className="listing-level",l.dataset.depth=String(this.depth+1),l.style.setProperty("--roster-cols",i.template),l.appendChild(i.order.caps_mint()),i.rows_draw(t(r),[],l,o),a.appendChild(l)},forget:()=>i.forget(),open_set:(r,a)=>i.open_set(r,a),open_clear:()=>i.open_clear(),template_at:r=>i.template_at(r)}})}actions_set(e){this.declaration={...this.declaration,...e===null?{actions:void 0}:{actions:e}},this.template=op(this.declaration.traits,this.trackActions_get())}trackActions_get(){return this.host.framed()?void 0:this.declaration.actions}filter_set(e){this.order.filter_set(e,!1)}sort_set(e,t){this.order.sort_set(e,t),this.child?.sort_set(e,t)}open_set(e,t){if(e===0){if(this.expansion.open.clear(),this.expansion.mode==="fold")for(const s of t)this.expansion.open.add(s);return}this.child?.open_set(e-1,t)}open_clear(){this.expansion.open.clear(),this.child?.open_clear()}template_at(e){if(e===0)return this.template;if(this.child===null)throw new Error(`no listing level at depth ${this.depth+e}`);return this.child.template_at(e-1)}anyMatch(e){return e.some(t=>this.order.matches(t)||(this.child?.survives(t)??!1))}filter_isEmpty(){return this.order.state_get().filter.length===0}rows_keep(e,t){const s=t?[...e]:e.filter(i=>this.order.matches(i)||(this.child?.survives(i)??!1));return this.order.sorted(s)}forget(){this.rowsByKey.clear(),this.dataByKey.clear(),this.cellsByKey.clear(),this.leadKeys.clear(),this.indicated=null,this.child?.forget()}rows_draw(e,t,s,i){for(const a of t)s.appendChild(this.row_build(a,!0));const r=this.rows_keep(e,i);for(const a of r){const o=this.row_build(a,!1);if(this.child===null){s.appendChild(o);continue}const l=this.declaration.key(a),c=this.order.filterText_get()!==""&&!this.order.matches(a)&&(this.child?.survives(a)??!1),d=GA(this.expansion,l)||c,u=document.createElement("div"),h=this.declaration.row?.groupClassName?.(a);u.className=`listing-group${d?" listing-open":""}${h===void 0||h===""?"":` ${h}`}`,u.appendChild(o),d&&(o.classList.add("listing-open"),this.child.render(a,u,i||this.order.matches(a))),s.appendChild(u)}return r.length}row_build(e,t){const s=this.declaration,i=s.key(e),r=this.host.framed(),a=TA(e,s.traits,{className:d=>{const u=s.row?.className?.(d);return u===void 0||u===""?"listing-row":`listing-row ${u}`},decorate:(d,u)=>{if(d.dataset.key=i,s.actions!==void 0&&!r){const h=document.createElement("span");h.className="listing-actions",!t&&s.actions.always===!0&&h.replaceChildren(...Ho(u,s.actions.of(u)).childNodes),d.appendChild(h),this.cellsByKey.set(i,h)}s.row?.decorate?.(d,u)}});if(this.rowsByKey.set(i,a),this.dataByKey.set(i,e),t&&(this.leadKeys.add(i),a.classList.add("listing-lead")),s.activatable?.(e)===!1)return a;a.classList.add("listing-activatable");const o=s.actions!==void 0&&s.actions.always!==!0&&s.actions.of(e).length>0,l=!t&&this.child!==null,c=this.controlCell_of(a);return a.addEventListener("click",d=>{if(!(!t&&this.select!==null&&this.select(i,e))){if(c!==null&&d.target instanceof Node&&c.contains(d.target)){l||this.row_indicate(null),this.row_activate(e,i,t);return}if(!o){this.row_activate(e,i,t);return}this.row_indicate(i),l&&c===null&&this.row_activate(e,i,!1)}}),o&&!l&&a.addEventListener("dblclick",()=>{this.row_indicate(null),this.row_activate(e,i,t)}),a}controlCell_of(e){const t=this.declaration.control;if(t===void 0)return null;const s=this.declaration.traits.findIndex(r=>r.key===t);if(s<0)throw new Error(`listing level declares control '${t}', which names no trait`);const i=e.children[s];return i instanceof HTMLElement?(i.classList.add("listing-control"),i):null}row_activate(e,t,s){!s&&this.child!==null&&(RA(this.expansion,t),this.host.repaint()),this.declaration.activate?.(e)}row_indicate(e,t=!1){const s=this.host.framed();if(this.indication_drop(),e===null){this.host.indication_release(this);return}const i=this.dataByKey.get(e),r=this.rowsByKey.get(e);if(i===void 0||r===void 0){this.host.indication_release(this);return}this.indicated=e,r.classList.add("listing-indicated");const a=this.declaration.actions?.of(i)??[];if(this.host.indication_claim({level:this,key:e,drop:()=>this.indication_drop(),restore:()=>this.rowsByKey.has(e)?(this.row_indicate(e,!0),!0):!1}),s)this.host.zoneVerbs_set([...Ho(i,a).childNodes]);else{const o=this.cellsByKey.get(e);o!==void 0&&a.length>0&&o.replaceChildren(...Ho(i,a).childNodes)}t||this.declaration.indicated?.(i)}indication_drop(){this.indicated!==null&&(this.cellsByKey.get(this.indicated)?.replaceChildren(),this.rowsByKey.get(this.indicated)?.classList.remove("listing-indicated"),this.indicated=null)}indicated_get(){return this.indicated}readout_show(e,t){if(this.indicated!==e)return;if(this.host.framed()){this.host.zoneReadout_set(t);return}const s=this.cellsByKey.get(e);if(s===void 0)return;const i=document.createElement("span");i.className="listing-readout",i.textContent=t,s.querySelector(".listing-readout")?.remove(),s.appendChild(i)}row_element(e){return this.rowsByKey.get(e)??null}keys_onStage(){return[...this.rowsByKey.keys()].filter(e=>!this.leadKeys.has(e))}}class Qr{declaration;level;host;gridHost;stateSpan;filterBlock;selectBlock;zone;wired=!1;zonePane_get(){return this.zone?.closest(".workspace-pane, [data-frame-host]")??null}zoneOpened=!1;claim=null;blocks=[];field=null;painter=null;selecting=!1;selection=new Map;repaintQueued=!1;constructor(e){if(this.declaration=e,this.gridHost=e.gridHost??e.mount,this.zone=e.rowZone??PA(e.mount,e.chrome?.prefix),e.selection!==void 0&&this.zone===null)throw new Error("a listing that selects declares a row zone: a selection's verbs ride the frame");this.level=new Hu(e,{repaint:()=>this.repaint_queue(),framed:()=>this.zone!==null,zoneVerbs_set:s=>this.zoneVerbs_set(s),zoneReadout_set:s=>this.zoneReadout_set(s),indication_claim:s=>{this.claim!==null&&this.claim.level!==s.level&&this.claim.drop(),this.claim=s},indication_release:s=>{this.claim===null||this.claim.level!==s||(this.claim=null,this.zoneVerbs_set([]))}},e.caps!=="each",e.selection===void 0?null:(s,i)=>this.selection_gather(s,i)),this.host=new EA(e.mount,this.level.order),this.gridHost.style.setProperty("--roster-cols",this.level.template),this.zone!==null&&(this.zone.classList.add("listing-zone"),this.zone.hidden=!0,e.mount.classList.add("listing-framed"),this.zone_wire());const t=e.chrome;this.stateSpan=t?.root.querySelector(".pane-state")??null,this.filterBlock=t?.root.querySelector(`.${t.prefix}-filter`)??null,this.selectBlock=t?.root.querySelector(`.${t.prefix}-select`)??null,this.filterBlock?.classList.add("rail-off"),this.filterBlock?.addEventListener("click",()=>this.filter_toggle()),this.level.order.stripChange_observe(()=>this.filterBlock_sync()),this.selectBlock?.addEventListener("click",()=>this.select_toggle()),t?.root.addEventListener("argus:roster",s=>{const i=s.detail;i.op==="sort"?this.level.sort_set(i.key,i.dir??"asc"):i.text===""?this.level.order.strip_toggle(!1):this.level.order.filter_set(i.text)}),this.filterBlock_sync()}rows_set(e,t){this.field!==null&&t.field!==this.field&&(this.selection.clear(),this.claim?.drop(),this.claim=null),this.field=t.field,this.blocks=e,this.render()}repaint_queue(){this.repaintQueued||(this.repaintQueued=!0,window.requestAnimationFrame(()=>{this.repaintQueued=!1,this.render()}))}render(){this.level.forget();const e=this.host.field_open(),t=this.level.filter_isEmpty();let s=0,i=0;const r=this.blocks.reduce((a,o)=>a+o.rows.length,0);this.blocks.length>0&&r===0&&this.declaration.empty!==void 0&&e.appendChild(this.declaration.empty());for(const a of this.blocks){const o=document.createElement("section");if(o.className="listing-block",o.dataset.key=a.key,a.header!==void 0&&o.appendChild(a.header),this.declaration.caps==="each"&&o.appendChild(this.level.order.caps_mint()),i+=a.rows.length,this.painter!==null){const l=this.level.rows_keep(a.rows,t);s+=l.length,this.painter({...a,rows:l},o)}else{const l=document.createElement("div");l.className="listing-rows",s+=this.level.rows_draw(a.rows,a.lead??[],l,t),o.appendChild(l)}e.appendChild(o)}this.level.order.counts_set(s,i),jg(),this.claim!==null&&!this.claim.restore()&&(this.claim=null,this.zoneVerbs_set([])),this.selection_render(),this.state_render()}row_indicate(e){if(e===null){this.claim?.drop();const t=this.claim;this.claim=null,t!==null&&this.zoneVerbs_set([]);return}this.level.row_indicate(e)}indicated_get(){return this.claim?.key??null}indication_refresh(){this.claim!==null&&(this.claim.restore()||(this.claim=null,this.zoneVerbs_set([])))}readout_show(e,t){this.level.readout_show(e,t)}row_element(e){return this.level.row_element(e)}template_get(e=0){return this.level.template_at(e)}field_get(){return this.host.field_get()}open_set(e,t){this.level.open_set(e,t),this.field!==null&&this.render()}open_clear(){this.level.open_clear()}painter_set(e){this.painter=e}actions_declare(e){this.level.actions_set(e),this.gridHost.style.setProperty("--roster-cols",this.level.template),this.field!==null&&this.render()}filter_toggle(e){this.level.order.strip_toggle(e)}filter_set(e){this.level.order.filter_set(e)}filterText_get(){return this.level.order.filterText_get()}filterBlock_sync(){if(this.filterBlock===null)return;const e=this.level.order.strip_isOpen();this.filterBlock.textContent=e?"FILTER ON":"FILTER OFF",this.filterBlock.classList.toggle("rail-off",!e)}select_toggle(e){this.declaration.selection!==void 0&&(this.selecting=e??!this.selecting,this.zoneOpened=!1,this.claim!==null&&this.row_indicate(null),this.declaration.mount.classList.toggle("listing-selecting",this.selecting),this.selectBlock?.classList.toggle("rail-off",!this.selecting),this.selectBlock!==null&&(this.selectBlock.textContent=this.selecting?"SELECT ON":"SELECT OFF"),this.selection_render(),this.state_render())}select_isOn(){return this.selecting}selection_get(){return[...this.selection.keys()]}selection_gather(e,t){return this.selecting?(this.selection.has(e)?this.selection.delete(e):this.selection.set(e,t),this.selection_render(),this.state_render(),!0):!1}selection_render(){for(const s of this.level.keys_onStage())this.level.row_element(s)?.classList.toggle("listing-selected",this.selection.has(s));if(this.zone===null)return;if(!this.selecting){this.claim===null&&this.zoneVerbs_set([]);return}const e=[...this.selection.entries()],t=e.length>0?this.declaration.selection?.verbs(e)??[]:[];this.zoneVerbs_set(t.length===0?[]:[...Ho(void 0,t).childNodes])}zone_wire(){const e=this.zone,t=this.zonePane_get();if(e===null||t===null||this.wired)return;this.wired=!0,e.closest(".mode-frame")?.addEventListener("click",i=>{i.target instanceof Node&&e.contains(i.target)||(this.zoneOpened=!1)},!0),new MutationObserver(()=>{t.dataset.modes!=="open"&&(this.zoneOpened=!1,this.claim!==null&&this.row_indicate(null))}).observe(t,{attributes:!0,attributeFilter:["data-modes"]})}zoneVerbs_set(e){const t=this.zone;if(t===null)return;t.replaceChildren(...e),t.hidden=e.length===0,this.wired||this.zone_wire();const s=this.zonePane_get();if(s!==null){if(e.length>0){s.dataset.modes!=="open"&&(s.dataset.modes="open",this.zoneOpened=!0);return}this.zoneOpened&&(this.zoneOpened=!1,delete s.dataset.modes)}}zoneReadout_set(e){const t=this.zone;if(t===null)return;t.querySelector(".listing-readout")?.remove();const s=document.createElement("span");s.className="listing-readout",s.textContent=e,t.appendChild(s),t.hidden=!1}selectionShown_count(){let e=0;for(const t of this.selection.keys())this.level.row_element(t)!==null&&(e+=1);return e}state_refresh(){this.state_render()}state_render(){if(this.stateSpan===null)return;const e={filter:this.level.order.summary(),selecting:this.selecting,selected:this.selection.size,shown:this.selectionShown_count()},t=this.declaration.state!==void 0?this.declaration.state(e):LA(e);t!==null&&(this.stateSpan.textContent=t)}}function PA(n,e){const t=n.parentElement?.querySelector(":scope > .mode-frame")??null;if(t===null)return null;const s=document.createElement("span");s.className=e===void 0?"listing-zone":`listing-zone ${e}-row-zone`,s.hidden=!0;const i=t.querySelector(":scope > .mode-fill");return i!==null?t.insertBefore(s,i):t.appendChild(s),s}function LA(n){const e=[];return n.selecting&&e.push("SELECT"),n.filter!==""&&e.push(n.filter),n.selected>0&&e.push(n.shown===n.selected?`${n.selected} SELECTED`:`${n.selected} SELECTED · ${n.shown} SHOWN`),e.join(" · ")}const WA=256*1024*1024;function kA(n,e){const t=e.split("/").filter(a=>a.length>0).pop()??"download";if(n===null)return t;const s=/filename\*\s*=\s*UTF-8''([^;]+)/i.exec(n);if(s!==null)try{const a=decodeURIComponent((s[1]??"").trim());if(a.length>0)return a}catch{}const r=/filename\s*=\s*"([^"]*)"/i.exec(n)?.[1]??"";return r.length>0?r:t}function UA(n){return n.redirected?"the session asked to log in again — nothing was saved":n.ok?n.headers.get("content-disposition")===null?"the session answered with something other than the file — nothing was saved":null:n.status===404?"the session could not read that file — nothing was saved":`the session refused the file (HTTP ${n.status}) — nothing was saved`}function cp(n,e){const t=document.createElement("a");t.href=n,t.download=e,t.rel="noopener",document.body.append(t),t.click(),t.remove()}async function FA(n,e,t=fetch){const s=new AbortController;let i;try{i=await t(n,{credentials:"same-origin",signal:s.signal})}catch(d){return{ok:!1,reason:`the session did not answer (${d instanceof Error?d.message:String(d)}) — nothing was saved`}}const r=UA(i);if(r!==null)return s.abort(),{ok:!1,reason:r};const a=kA(i.headers.get("content-disposition"),e),o=Number(i.headers.get("content-length")??NaN);if(Number.isFinite(o)&&o>WA)return s.abort(),cp(n,a),{ok:!0,name:a,bytes:o,streamed:!0};const l=await i.blob(),c=URL.createObjectURL(l);return cp(c,a),setTimeout(()=>URL.revokeObjectURL(c),6e4),{ok:!0,name:a,bytes:l.size,streamed:!1}}const jA=["single","mpr","3d","slab"],dp=["wl","zoom","pan","length","angle","probe"],Xo=["gray","hot","jet","cool"],$g=[{name:"brain",lower:0,upper:80,modalities:["CT"]},{name:"bone",lower:-500,upper:1300,modalities:["CT"]},{name:"lung",lower:-1400,upper:200,modalities:["CT"]},{name:"soft",lower:-160,upper:240,modalities:["CT"]},{name:"liver",lower:-10,upper:140,modalities:["CT"]}],Gc=/\.(nii|nii\.gz|mgz|mgh)$/i,Yo=/\.dcm$/i,Vg=/^\d+-.*-[0-9a-f]{7}$/,up="/SERVICES/PACS/",$A=4;function Rc(n,e){if(Vg.test(e))return!0;if(!n.startsWith(up))return!1;const t=n.slice(up.length).replace(/\/+$/,"");return t!==""&&t.split("/").length===$A}function VA(n,e){const t=n.toLowerCase();return $g.find(s=>s.name===t&&(s.modalities.length===0||s.modalities.includes(e.toUpperCase())))}function HA(n,e){const t=[];let s="",i=[],r=!1,a=0,o=!1;const l=()=>{i.push(s),s="",o=!0},c=()=>{t.push(i),i=[],o=!1};for(;a<n.length;){const d=n[a];if(r){if(d==='"'){if(n[a+1]==='"'){s+='"',a+=2;continue}r=!1,a+=1;continue}s+=d,a+=1;continue}if(d==='"'&&s===""){r=!0,a+=1;continue}if(d===e){l(),a+=1;continue}if(d==="\r"&&n[a+1]===`
4226
4226
  `){l(),c(),a+=2;continue}if(d===`
4227
- `||d==="\r"){l(),c(),a+=1;continue}s+=d,a+=1}return(s!==""||o||i.length>0)&&(l(),c()),t}function qA(n){if(n.length===0)return!1;const e=new Set;for(const t of n){const s=t.trim();if(s===""||e.has(s.toLowerCase())||s!==""&&Number.isFinite(Number(s)))return!1;e.add(s.toLowerCase())}return!0}function XA(n,e){const t=/\.tsv$/i.test(e)?" ":",",s=HA(n,t);if(s.length===0)return{caps:[],rows:[],headed:!1};const i=s[0],r=qA(i),a=r?s.slice(1):s,o=s.reduce((d,u)=>Math.max(d,u.length),0),l=r?Array.from({length:o},(d,u)=>(i[u]??`COLUMN ${u+1}`).trim()):Array.from({length:o},(d,u)=>`COLUMN ${u+1}`),c=a.map(d=>Array.from({length:o},(u,h)=>d[h]??""));return{caps:l,rows:c,headed:r}}function hp(n){return/-v(\d+(?:\.\d+)*)$/.exec(n)?.[1]??""}const fp="",YA="/bin",pp="/bin/recent",Ao={dir:"",file:"",link:"",plugin:"",pipeline:"",vfs:"",job:""},Bc=["list","cards","preview"],KA=5e3,ZA=new Set(["png","jpg","jpeg","gif","svg","webp","bmp"]),QA=new Set(["txt","md","adoc","rst","json","csv","tsv","log","yaml","yml","toml","ini","cfg","xml","html","py","sh","ts","js","mjs","r","c","h","cpp","java","go","rs","sql","tex","bib"]),mp=160,gp=100,Eo=10,JA=30,eE=256*1024,tE=4e3,sE=12*1024*1024,nE=400;function Ko(n){return ZA.has(Hg(n))}function Hg(n){const e=n.split("/").pop()??"",t=e.lastIndexOf(".");return t>0?e.slice(t+1).toLowerCase():""}function iE(n){if(n.includes("\0"))return!0;const e=(n.match(/\uFFFD/g)??[]).length;return e>0&&e/n.length>.02}const rE=80;function Mp(n,e){if(n===null)return[];const t=document.createElement("button");return t.className="files-close-pill files-download-pill",t.textContent="DOWNLOAD",t.title="save this file to your disk",t.addEventListener("click",()=>n.download(e)),[t]}function bp(n){const e="http://www.w3.org/2000/svg",t=document.createElementNS(e,"svg");t.setAttribute("viewBox",`0 0 ${mp} ${gp}`),t.setAttribute("preserveAspectRatio","xMidYMid meet");const s=Og(n),i=Math.max(s.width,1),r=Math.max(s.tierCount-1,1),a=new Map;for(const o of s.placements)a.set(o.id,{x:Eo+o.x/i*(mp-2*Eo),y:Eo+o.tier/r*(gp-2*Eo)});for(const o of n){const l=a.get(o.id);if(l)for(const c of o.parentIds){const d=a.get(c);if(!d)continue;const u=document.createElementNS(e,"line");u.setAttribute("x1",String(d.x)),u.setAttribute("y1",String(d.y)),u.setAttribute("x2",String(l.x)),u.setAttribute("y2",String(l.y)),u.setAttribute("stroke","currentColor"),u.setAttribute("stroke-width","1"),u.setAttribute("opacity","0.6"),t.appendChild(u)}}for(const[,o]of a){const l=document.createElementNS(e,"circle");l.setAttribute("cx",String(o.x)),l.setAttribute("cy",String(o.y)),l.setAttribute("r",n.length>JA?"2.2":"4"),l.setAttribute("fill","currentColor"),t.appendChild(l)}return t}function Do(n){return n.type==="dir"||n.type==="vfs"||n.type==="link"||n.type==="job"?"dir":n.type==="file"?"file":n.type==="plugin"||n.type==="pipeline"?n.type:null}class zp{container;recent=null;activate;listing;lastListings=[];contentShown=!1;denied=new Set;following=!1;viewMode="list";viewPill;modeSpan;preview;catalogue;runStrip=null;feedOpen=null;headCache=new Map;thumbObserver=null;frameTopObserver=null;stale=!1;home=null;stateSpan;indicate=null;selectionVerbs=null;constructor(e,t,s=null,i={}){this.container=e,this.activate=t,this.preview=s,this.catalogue=i.catalogue===!0,this.catalogue&&e.parentElement?.classList.add("files-catalogue");const r=e.closest(".pane-files")??e.parentElement;this.viewPill=e.parentElement?.querySelector(".files-view")??null,this.modeSpan=e.closest(".pane-files")?.querySelector(".pane-mode")??null,this.stateSpan=r?.querySelector(".pane-state")??null,this.viewPill?.addEventListener("click",()=>{this.view_set(Bc[(Bc.indexOf(this.viewMode)+1)%Bc.length]??"list")});const a=e.parentElement?.querySelector(":scope > .mode-frame")!==null;this.listing=new Qr({mount:e,traits:this.traits_declare(),key:o=>o.home===!0?"~":o.path,address:o=>o.path,chrome:r===null?void 0:{root:r,prefix:"files"},control:"control",activate:o=>this.row_activate(o),activatable:o=>o.updir||Do(o.entry)!==null,indicated:o=>this.indicate?.(o.entry,o.path),row:{className:o=>`files-row files-type-${o.entry.type}${o.home===!0?" files-lead-home":o.updir?" files-lead-up":""}${!o.updir&&this.denied.has(o.path)?" files-denied":""}`,decorate:(o,l)=>{o.dataset.path=l.path,!l.updir&&this.denied.has(l.path)&&(o.title="listed but not readable — CUBE refused this identity access to the contents")}},...a?{selection:{verbs:o=>this.selectionVerbs?.(o.map(([l,c])=>[l,c.entry]))??[]}}:{},state:o=>this.stateLine_compose(o),defaultSort:{key:"name",dir:"asc"}}),this.empty_render()}traits_declare(){return this.catalogue?this.catalogueTraits_declare():this.browserTraits_declare()}browserTraits_declare(){return[{key:"control",label:"",className:"files-control",capped:!1,width:"2.4em",cell:e=>{const t=document.createElement("span"),s=e.updir?"dir":e.entry.type,i=e.updir||Do(e.entry)!==null;return t.className=`files-control files-glyph files-glyph-${s}${i?" files-capsule":""}`,t.textContent=e.home===!0?fp:!e.updir&&this.denied.has(e.path)?"⃠":Ao[s],t}},{key:"name",label:"NAME",className:"files-name",width:"minmax(12em, 1fr)",cell:e=>{const t=document.createElement("span");if(t.className="files-name",t.textContent=e.home===!0?"~":e.updir?"..":e.entry.name,e.home===!0){const s=document.createElement("span");s.className="files-target",s.textContent=e.path,t.appendChild(s),t.title=`home: ${e.path}`}if(!e.updir&&e.entry.type==="link"&&e.entry.target!==void 0){const s=document.createElement("span");s.className="files-target",s.textContent=`→ ${e.entry.target}`,t.appendChild(s),t.title=e.entry.target}return t},compare:e=>e.entry.name},{key:"type",label:"TYPE",className:"files-type",width:"6em",cell:e=>e.updir?"":e.entry.type},{key:"size",label:"SIZE",className:"files-size",width:"6em",cell:e=>e.updir||e.entry.type==="dir"?"":wp(e.entry.size),compare:e=>e.entry.size},{key:"date",label:"DATE",className:"files-date",width:"7em",cell:e=>e.updir?"":e.entry.date.slice(0,10),compare:e=>e.entry.date},{key:"owner",label:"OWNER",className:"files-owner",width:"10em",cell:e=>e.updir?"":e.entry.owner}]}row_activate(e){if(e.updir){this.activate({kind:"dir",path:e.path});return}const t=Do(e.entry);t!==null&&this.activate({kind:t,path:e.path})}envelope_observe(e){if(e.model?.kind!=="fs.listing")return;const t=_p(e.model.data);if(t===null||t.length===0)return;this.lastListings=t;const s=t[0]?.path??"";this.container.closest(".workspace-pane")?.classList.toggle("files-projection",/^\/(proc|net|etc|usr)(\/|$)/.test(s)),!this.contentShown&&this.listings_render(t)}ambient_observe(e){if(e.model?.kind!=="fs.listing")return;const t=_p(e.model.data);if(t===null||this.lastListings.length===0)return;let s=!1;const i=this.lastListings.map(r=>{const a=t.find(o=>o.path===r.path);return a===void 0?r:(s=!0,a)});if(s){if(this.contentShown){this.lastListings=i;return}this.listings_render(i)}}contentTable_show(e,t){const s=XA(t,e);if(s.caps.length===0){this.content_show(e,t);return}const i=s.rows.slice(0,KA),r=s.rows.length>i.length;this.contentRelease?.(),this.contentShown=!0,this.container.parentElement?.classList.add("content-view"),this.container.replaceChildren(),this.diagram_declare(!1);const a=document.createElement("section");a.className="files-content-view files-table-view";const o=document.createElement("header");o.className="files-path files-content-header";const l=document.createElement("span");l.textContent=e;const c=document.createElement("span");c.className="pane-state",o.append(l,c);const d=document.createElement("div");d.className="files-table-field";const u=document.createElement("span");u.className="field-rule";const h=document.createElement("button");h.className="mode-strip",h.title="display modes";const g=document.createElement("span");g.className="mode-elbow";const p=document.createElement("aside");p.className="mode-frame";const z=document.createElement("button");z.className="strategy-pill csv-filter rail-off",z.textContent="FILTER OFF",z.title="filter the table";const m=document.createElement("button");m.className="strategy-pill csv-raw",m.textContent="RAW",m.title="the bytes as written",m.addEventListener("click",()=>this.content_show(e,t));const f=document.createElement("button");f.className="strategy-pill csv-close",f.textContent="CLOSE",f.title="leave the table; the listing beneath returns",f.addEventListener("click",()=>this.listing_restore());const _=document.createElement("span");_.className="mode-fill",p.append(z,m,_);const O=this.preview;if(O!==null){const I=document.createElement("button");I.className="strategy-pill csv-download",I.textContent="DOWNLOAD",I.title="save this file to your disk",I.addEventListener("click",()=>O.download(e)),p.append(I)}p.append(f);const w=document.createElement("div");w.className="files-table-rows",d.append(u,h,g,p,w),a.append(o,d),this.container.appendChild(a);const x=s.caps.map((I,b)=>({key:`c${b}`,label:I.toUpperCase(),className:"files-table-cell",cell:A=>A.cells[b]??"",width:"minmax(6em, 1fr)"}));new Qr({mount:w,traits:x,key:I=>String(I.index),chrome:{root:a,prefix:"csv"},state:I=>{const b=[];return I.filter!==""?b.push(`${I.filter} ROWS`):b.push(r?`SHOWING ${i.length} OF ${s.rows.length} ROWS`:`${s.rows.length} ROWS`),s.headed||b.push("NO HEADER: COLUMNS NUMBERED"),b.join(" · ")},empty:()=>{const I=document.createElement("div");return I.className="files-note",I.textContent="NO ROWS",I}}).rows_set([{key:e,rows:i.map((I,b)=>({index:b,cells:I}))}],{field:e}),this.contentRelease=()=>{w.replaceChildren()}}content_show(e,t){this.diagram_declare(!1),this.contentShown=!0,this.container.parentElement?.classList.add("content-view"),this.container.replaceChildren();const s=document.createElement("header");s.className="files-path files-content-header";const i=document.createElement("span");i.textContent=e;const r=document.createElement("button");r.className="files-close-pill",r.textContent="CLOSE",r.addEventListener("click",()=>this.listing_restore()),s.append(i,...Mp(this.preview,e),r);const a=document.createElement("pre");a.className="files-content",a.textContent=t,this.container.append(s,a)}contentRefused_show(e,t){this.diagram_declare(!1),this.denied.add(e),this.contentShown=!0,this.container.parentElement?.classList.add("content-view"),this.container.replaceChildren();const s=document.createElement("header");s.className="files-path files-content-header files-content-refused";const i=document.createElement("span");i.textContent=e;const r=document.createElement("button");r.className="files-close-pill",r.textContent="CLOSE",r.addEventListener("click",()=>this.listing_restore()),s.append(i,r);const a=document.createElement("div");a.className="files-refused";const o=document.createElement("p");o.className="files-refused-lede",o.textContent="READ REFUSED";const l=document.createElement("pre");l.className="files-refused-said",l.textContent=t,a.append(o,l),this.container.append(s,a)}contentImage_show(e,t){this.contentShown=!0,this.container.parentElement?.classList.add("content-view"),this.container.replaceChildren();const s=document.createElement("header");s.className="files-path files-content-header";const i=document.createElement("span");i.textContent=e;const r=document.createElement("button");r.className="files-close-pill",r.textContent="CLOSE",r.addEventListener("click",()=>this.listing_restore()),s.append(i,...Mp(this.preview,e),r);const a=document.createElement("img");a.className="files-image",a.src=t,a.alt=e,this.container.append(s,a)}rowVerbs_declare(e,t){this.indicate=t??null,this.listing.actions_declare({of:s=>s.updir?[]:e(s.entry,s.path).map(i=>({label:i.label,run:()=>i.run(s.entry),...i.offered!==void 0?{offered:()=>i.offered(s.entry)}:{},...i.disabled!==void 0?{disabled:()=>i.disabled(s.entry)}:{}}))})}catalogueTraits_declare(){return[...this.browserTraits_declare().filter(s=>s.key==="control"||s.key==="name"),{key:"type",label:"TYPE",className:"files-type",width:"6em",cell:s=>s.updir?"":s.entry.type},{key:"version",label:"VERSION",className:"files-version",width:"7em",cell:s=>s.updir?"":hp(s.entry.name),compare:s=>hp(s.entry.name)}]}catalogue_is(){return this.catalogue}binding_set(e){if(this.runStrip===null){const s=document.createElement("div");s.className="files-run-strip";const i=document.createElement("span");i.className="files-binding";const r=document.createElement("input");r.className="files-command",r.spellcheck=!1,r.autocomplete="off",r.placeholder="the line RUN will run",s.append(i,r),this.container.parentElement?.insertBefore(s,this.container),this.runStrip=s;const a=this.container.closest(".pane-files")?.querySelector(".pane-title");a!=null&&(a.textContent="CATALOGUE")}const t=this.runStrip.querySelector(".files-binding");t!==null&&(t.textContent=`INPUT ${e.input} → ${e.place}`),this.frameTop_track()}commandLine_get(){return this.runStrip?.querySelector(".files-command")?.value.trim()??""}commandLine_set(e){const t=this.runStrip?.querySelector(".files-command")??null;t!==null&&(t.value=e)}indicated_get(){return this.listing.indicated_get()}feedOpen_declare(e){this.feedOpen=e}run_show(e){if(this.runStrip===null)return;this.runStrip.querySelector(".files-feed")?.remove();const t=document.createElement("button");t.className="files-feed listing-capsule listing-action-selected",t.textContent=`FEED ${e}`,t.title="open this run's graph beside the catalogue",t.addEventListener("click",()=>this.feedOpen?.(e)),this.runStrip.appendChild(t)}row_indicate(e){this.listing.row_indicate(e)}rowReadout_show(e,t){this.listing.readout_show(e,t)}selectionVerbs_declare(e){this.selectionVerbs=e}select_toggle(e){this.listing.select_toggle(e)}select_isOn(){return this.listing.select_isOn()}selection_get(){return this.listing.selection_get()}path_current(){return this.lastListings[0]?.path??null}content_isShown(){return this.contentShown}contentRelease=null;contentHtml_show(e,t,s={}){this.contentRelease?.(),this.contentRelease=s.release??null,this.contentShown=!0,this.container.parentElement?.classList.add("content-view"),this.container.replaceChildren();const i=document.createElement("section");i.className="files-content-view";const r=document.createElement("header");r.className="files-path files-content-header";const a=document.createElement("span");a.textContent=e;const o=document.createElement("button");if(o.className="files-close-pill",o.textContent="CLOSE",o.addEventListener("click",()=>this.listing_restore()),r.append(a,o),i.appendChild(r),t!==""){const c=document.createElement("pre");c.className="files-content",c.innerHTML=t,i.appendChild(c)}let l=null;return s.diagram===!0&&(l=document.createElement("div"),l.className="files-diagram",i.appendChild(l)),this.diagram_declare(s.diagram===!0),this.container.appendChild(i),l}contentText_set(e){const t=this.container.querySelector(".files-content-view");if(t===null)return;const s=t.querySelector(".files-content"),i=s??document.createElement("pre");i.className="files-content",i.innerHTML=e,s===null&&t.querySelector(".files-content-header")?.after(i)}recent_set(e){this.recent=e===null?null:[...e],this.lastListings.length>0&&!this.contentShown&&this.listings_render(this.lastListings)}listing_restore(){this.contentRelease?.(),this.contentRelease=null,this.lastListings.length>0?this.listings_render(this.lastListings):this.empty_render()}empty_render(){this.diagram_declare(!1),this.container.replaceChildren();const e=document.createElement("p");e.className="files-empty",e.textContent="AWAITING LISTING — TYPE ls IN THE CONSOLE",this.container.appendChild(e)}listings_render(e){this.diagram_declare(!1),this.contentShown=!1,this.container.parentElement?.classList.remove("content-view"),this.lastListings=e,this.thumbObserver?.disconnect(),this.thumbObserver=null,this.stale=e.some(i=>i.fresh===!1),this.stateSpan?.classList.toggle("state-stale",this.stale),this.listing.painter_set(this.viewMode==="list"?null:(i,r)=>this.cards_paint(i,r));const t=e.map(i=>this.block_of(i)),s=e.find(i=>i.path===YA);if(this.recent!==null&&this.recent.length>0&&s!==void 0){const i=this.recentBlock_of(s);i!==null&&t.unshift(i)}this.listing.rows_set(t,{field:e[0]?.path??""}),this.frameTop_track()}crumbs_build(e){const t=document.createElement("header");t.className="files-path files-crumbs";const s=[],i=this.home;let r;i!==null&&(e===i||e.startsWith(`${i}/`))?(s.push({label:"~",path:i}),r=e.slice(i.length)):(s.push({label:"/",path:"/"}),r=e);let a=s[0]?.path??"/";for(const o of r.split("/").filter(l=>l.length>0))a=a==="/"?`/${o}`:`${a}/${o}`,s.push({label:o,path:a});return s.forEach((o,l)=>{l>0&&s[l-1]?.label!=="/"&&t.append("/");const c=l===s.length-1,d=document.createElement(c?"span":"button");d.className=c?"files-crumb files-crumb-here":"files-crumb",d.textContent=o.label,d.dataset.path=o.path,c||(d.title=`go to ${o.path}`,d.addEventListener("click",u=>{u.stopPropagation(),this.activate({kind:"dir",path:o.path})})),t.appendChild(d)}),t}home_set(e){e!==this.home&&(this.home=e,!this.contentShown&&this.lastListings.length>0&&this.listings_render(this.lastListings))}block_of(e){const t=this.crumbs_build(e.path),s=e.items.map(r=>({entry:r,path:Io(e.path,r.name),updir:!1})),i=[];return!this.catalogue&&this.home!==null&&e.path!==this.home&&i.push({entry:{name:"~",type:"dir",size:0,owner:"",date:""},path:this.home,updir:!0,home:!0}),e.path!=="/"&&i.push({entry:{name:"..",type:"dir",size:0,owner:"",date:""},path:aE(e.path),updir:!0}),{key:e.path,header:t,lead:i,rows:s}}recentBlock_of(e){const t=new Map(e.items.map(r=>[r.name,r])),s=[];for(const r of this.recent??[]){const a=t.get(r);a!==void 0&&s.push({entry:a,path:Io(pp,r),updir:!1})}if(s.length===0)return null;const i=document.createElement("header");return i.className="files-path files-recent",i.textContent="RECENT",{key:pp,header:i,lead:[],rows:s}}cards_paint(e,t){const s=this.viewMode==="preview",i=document.createElement("div");i.className=s?"files-cards files-previews":"files-cards";for(const a of e.lead??[]){const o=document.createElement("article");o.className=a.home===!0?"files-card files-card-up files-card-home files-activatable":"files-card files-card-up files-activatable",o.textContent=a.home===!0?`${fp} ~`:"▴ ..",o.addEventListener("click",()=>this.activate({kind:"dir",path:a.path})),i.appendChild(o)}const r=e.key;for(const a of e.rows)i.appendChild(this.card_build(r,a.entry,s));t.appendChild(i)}frameTop_track(){const e=this.container.parentElement,t=this.container.querySelector(".roster-order"),s=this.container.querySelector(".files-path");if(this.frameTopObserver?.disconnect(),this.frameTopObserver=null,e===null)return;if(t===null||s===null){e.style.removeProperty("--mode-frame-top"),e.style.removeProperty("--roster-frame-h");return}const i=()=>{const r=e.getBoundingClientRect().top,a=Math.ceil(t.getBoundingClientRect().bottom-r);e.style.setProperty("--roster-frame-h",`${a}px`),e.style.setProperty("--mode-frame-top",`${Math.ceil(s.getBoundingClientRect().bottom-r)}px`)};i(),this.frameTopObserver=new ResizeObserver(i),this.frameTopObserver.observe(t),this.frameTopObserver.observe(s)}follow_set(e){this.following=e,this.listing.state_refresh()}follow_get(){return this.following}view_set(e){this.viewMode=e,this.viewPill!==null&&(this.viewPill.textContent=e.toUpperCase()),this.modeSpan!==null&&(this.modeSpan.textContent=e==="list"?"":e.toUpperCase()),this.lastListings.length>0&&!this.contentShown&&this.listings_render(this.lastListings)}view_get(){return this.viewMode}body_get(){return this.container.closest(".files-body")}diagram_declare(e){this.body_get()?.classList.toggle("diagram-shown",e),e||this.mode_annunciate(this.viewMode==="list"?"":this.viewMode.toUpperCase())}mode_annunciate(e){this.modeSpan!==null&&(this.modeSpan.textContent=e)}stateLine_compose(e){const t=[];return this.following&&t.push("CWD"),e.selecting&&t.push("SELECT"),t.push(this.stale?"STALE":e.filter),e.selected>0&&t.push(e.shown===e.selected?`${e.selected} SELECTED`:`${e.selected} SELECTED · ${e.shown} SHOWN`),t.filter(s=>s!=="").join(" · ")}card_build(e,t,s=!1){const i=document.createElement("article");i.className=`files-card files-type-${t.type}`,s&&i.appendChild(this.thumb_build(Io(e,t.name),t));const r=document.createElement("div");r.className="files-card-head";const a=document.createElement("span");a.className="files-card-badge",a.textContent=t.type.toUpperCase();const o=document.createElement("span");o.className="files-card-size",o.textContent=t.type==="dir"||t.size===0?"":wp(t.size),r.append(a,o);const l=document.createElement("div");l.className="files-card-title",l.textContent=t.name;const c=document.createElement("div");c.className="files-card-meta";const d=document.createElement("span");d.textContent=t.owner;const u=document.createElement("span");if(u.textContent=t.date.slice(0,10),c.append(d,u),i.append(r,l,c),t.type==="link"&&t.target!==void 0){const p=document.createElement("div");p.className="files-card-target",p.textContent=`→ ${t.target}`,p.title=t.target,i.appendChild(p)}const h=Io(e,t.name),g=Do(t);return g!==null&&(i.classList.add("files-activatable"),i.addEventListener("click",()=>this.activate({kind:g,path:h}))),i}thumb_build(e,t){const s=document.createElement("div");s.className="files-card-thumb";const i=()=>{s.textContent=Ao[t.type]};if(Vg.test(t.name)||Yo.test(t.name)){s.classList.add("thumb-series");const u=document.createElement("span");u.className="thumb-series-mark",u.textContent="DCM";const h=/^\d+-(.*)-[0-9a-f]{7}$/.exec(t.name)?.[1];if(s.replaceChildren(u),h!==void 0){const g=document.createElement("span");g.className="thumb-series-text",g.textContent=h.replace(/_/g," "),s.appendChild(g)}return s}if(this.preview===null||!(t.type==="file"||t.type==="plugin"||t.type==="pipeline"))return i(),s;if(t.type==="plugin")return s.replaceChildren(bp([{id:e,parentIds:[]}])),s;if(t.type==="pipeline"){const u=this.preview;s.classList.add("thumb-wait"),s.textContent=Ao[t.type];const h=()=>{u.pipelineGlimpse(e).then(g=>{if(s.classList.remove("thumb-wait"),g===null||g.length===0){i();return}if(g.length>rE){s.textContent=`${g.length} NODES`,s.classList.add("thumb-count");return}s.replaceChildren(bp(g))}).catch(()=>{s.classList.remove("thumb-wait"),i()})};return this.thumbObserver_get().observe(s),s.addEventListener("files:thumb-seen",h,{once:!0}),s}const r=this.headCache.get(e);if(r!==void 0){const u=document.createElement("pre");return u.textContent=r,s.appendChild(u),s}const a=Ko(e)&&t.size<=sE,o=Hg(e),l=(o===""||QA.has(o))&&t.size<=eE;if(!a&&!l)return i(),s;s.classList.add("thumb-wait"),s.textContent=Ao.file;const c=this.preview,d=()=>{if(a){const u=document.createElement("img");u.alt=t.name,u.addEventListener("load",()=>{s.classList.remove("thumb-wait")}),u.addEventListener("error",()=>{s.classList.remove("thumb-wait"),i()}),u.src=c.imageUrl(e),s.replaceChildren(u);return}c.textHead(e,tE).then(u=>{if(this.headCache.size>=nE&&this.headCache.clear(),this.headCache.set(e,u),s.classList.remove("thumb-wait"),u.trim()===""||iE(u)){i();return}const h=document.createElement("pre");h.textContent=u,s.replaceChildren(h)}).catch(()=>{s.classList.remove("thumb-wait"),i()})};return this.thumbObserver_get().observe(s),s.addEventListener("files:thumb-seen",d,{once:!0}),s}thumbObserver_get(){return this.thumbObserver===null&&(this.thumbObserver=new IntersectionObserver(e=>{for(const t of e)t.isIntersecting&&(this.thumbObserver?.unobserve(t.target),t.target.dispatchEvent(new CustomEvent("files:thumb-seen")))},{root:this.container,rootMargin:"25%"})),this.thumbObserver}filter_toggle(e){this.listing.filter_toggle(e)}}function _p(n){if(!Array.isArray(n))return null;for(const e of n){if(typeof e!="object"||e===null)return null;const t=e;if(typeof t.path!="string"||!Array.isArray(t.items))return null}return n}function Io(n,e){return n.endsWith("/")?`${n}${e}`:`${n}/${e}`}function aE(n){const e=n.endsWith("/")?n.slice(0,-1):n,t=e.lastIndexOf("/");return t<=0?"/":e.slice(0,t)}function wp(n){if(n<1024)return String(n);const e=["K","M","G","T"];let t=n,s=-1;for(;t>=1024&&s<e.length-1;)t=t/1024,s=s+1;return`${t<10?t.toFixed(1):Math.round(t)}${e[s]}`}const qg={listing:"files.row",rules:[{name:"image",label:()=>"IMAGE",offered:n=>n.kind==="seriesFolder"},{name:"gather",label:()=>"GATHER",offered:n=>n.kind!=="catalogue"&&n.projection!==!0},{name:"process",label:()=>"PROCESS",offered:n=>(n.kind==="directory"||n.kind==="seriesFolder")&&(n.feed===null||(n.node??null)!==null)},{name:"run",label:()=>"RUN",offered:n=>n.kind==="catalogue"&&n.bound===!0},{name:"download",label:()=>"DOWNLOAD",offered:n=>n.kind==="file"},{name:"move",label:()=>"MOVE",offered:n=>n.kind!=="catalogue"&&n.projection!==!0},{name:"copy",label:()=>"COPY",offered:n=>n.kind!=="catalogue"&&n.projection!==!0},{name:"delete",label:()=>"DELETE",offered:n=>n.kind!=="catalogue"&&n.projection!==!0},{name:"share",label:n=>`SHARE FEED ${n.feed??""}`,offered:n=>n.kind!=="catalogue"&&n.feed!==null&&n.projection!==!0}],states:[{name:"a plain file outside a feed",facts:{kind:"file",feed:null}},{name:"a file inside a feed",facts:{kind:"file",feed:12}},{name:"a directory",facts:{kind:"directory",feed:null}},{name:"a directory inside a feed that is not a node",facts:{kind:"directory",feed:12,node:null}},{name:"a node's data inside a feed",facts:{kind:"directory",feed:12,node:456}},{name:"a DICOM series folder",facts:{kind:"seriesFolder",feed:null}},{name:"a catalogue entry",facts:{kind:"catalogue",feed:null}},{name:"a catalogue entry in a bound catalogue",facts:{kind:"catalogue",feed:null,bound:!0}},{name:"a node's data seen through /proc",facts:{kind:"directory",feed:12,node:456,projection:!0}},{name:"a file seen through /proc",facts:{kind:"file",feed:12,projection:!0}}]},Xg={listing:"files.selection",rules:[{name:"delete",label:n=>`DELETE ${n.count}`,offered:()=>!0},{name:"move",label:n=>`MOVE ${n.count}`,offered:()=>!0},{name:"copy",label:n=>`COPY ${n.count}`,offered:()=>!0},{name:"share",label:n=>n.feeds.length===1?`SHARE FEED ${n.feeds[0]}`:`SHARE ${n.feeds.length} FEEDS`,offered:n=>n.feeds.length>0}],states:[{name:"a selection outside any feed",facts:{count:3,feeds:[]}},{name:"a selection in one feed",facts:{count:2,feeds:[12]}},{name:"a selection spanning feeds",facts:{count:5,feeds:[12,13]}}]},Yg={listing:"runs.row",rules:[{name:"share",label:()=>"SHARE",offered:()=>!0},{name:"delete",label:()=>"DELETE",offered:()=>!0}],states:[{name:"any feed",facts:{feedId:12}}]},Ra={listing:"pacs.study",rules:[{name:"pullStudy",label:()=>"PULL STUDY",offered:n=>n.addressable},{name:"gather",label:()=>"GATHER",offered:n=>n.addressable},{name:"process",label:()=>"PROCESS",offered:n=>n.allInCube}],states:[{name:"a study with a path",facts:{addressable:!0,allInCube:!1}},{name:"a study with none",facts:{addressable:!1,allInCube:!1}},{name:"a study wholly home",facts:{addressable:!0,allInCube:!0,anyInCube:!0}},{name:"a study partly home",facts:{addressable:!0,allInCube:!1,anyInCube:!0}}]},Ui={listing:"pacs.series",rules:[{name:"gather",label:()=>"GATHER",offered:n=>n.addressable||n.inCube},{name:"image",label:()=>"IMAGE",offered:n=>n.inCube&&n.folderKnown},{name:"dir",label:()=>"DIR",offered:n=>n.inCube&&n.folderKnown},{name:"process",label:()=>"PROCESS",offered:n=>n.inCube&&n.folderKnown},{name:"pull",label:()=>"PULL",offered:n=>!n.inCube}],states:[{name:"not yet retrieved",facts:{inCube:!1,folderKnown:!1,addressable:!0}},{name:"not retrieved and unaddressable",facts:{inCube:!1,folderKnown:!1,addressable:!1}},{name:"home, folder not yet named",facts:{inCube:!0,folderKnown:!1,addressable:!0}},{name:"home, folder named",facts:{inCube:!0,folderKnown:!0,addressable:!0}}]},Kg={listing:"gather.series",rules:[{name:"remove",label:()=>"REMOVE",offered:()=>!0},{name:"pull",label:()=>"PULL",offered:n=>n.pullable===!0},{name:"image",label:()=>"IMAGE",offered:n=>n.folderKnown&&n.imagery!==!1},{name:"process",label:()=>"PROCESS",offered:()=>!0}],states:[{name:"folder named",facts:{folderKnown:!0}},{name:"a place that is not imagery",facts:{folderKnown:!0,imagery:!1}},{name:"folder not yet named",facts:{folderKnown:!1}},{name:"not retrieved yet",facts:{folderKnown:!1,pullable:!0}}]},Zg={listing:"gather.cohort",rules:[{name:"save",label:()=>"SAVE",offered:n=>n.count>0},{name:"export",label:()=>"EXPORT CSV",offered:n=>n.count>0},{name:"feed",label:()=>"CREATE FEED",offered:n=>n.count>0&&n.feed===null},{name:"process",label:()=>"PROCESS",offered:n=>n.count>0},{name:"dismiss",label:()=>"DISMISS",offered:()=>!0}],states:[{name:"holding series",facts:{count:2,feed:null}},{name:"holding series, rooted in a feed",facts:{count:2,feed:4501}},{name:"emptied",facts:{count:0,feed:null}}]};function Ci(n){return{listing:n.listing,visit(e){return e(n)}}}Ci(qg),Ci(Xg),Ci(Yg),Ci(Ra),Ci(Ui),Ci(Zg),Ci(Kg);function vn(n,e){const t=n.rules.find(s=>s.name===e);if(t===void 0)throw new Error(`${n.listing} declares no verb '${e}'`);return t}function oE(n){return{inCube:n.pulled===!0,folderKnown:n.folderPath!==void 0,addressable:n.vfsPath!==void 0}}function yp(n){if(n.series.length===0)return null;const e=[];for(const s of n.series){if(s.pulled!==!0||s.folderPath===void 0)return null;e.push(s.folderPath.replace(/\/[^/]+\/?$/,""))}const t=e[0]??"";return e.every(s=>s===t)&&t!==""?t:null}function kn(n){const e=oE(n),t=s=>vn(Ui,s).offered(e);return{gather:t("gather"),image:t("image"),dir:t("dir"),pull:t("pull")}}function lE(n,e,t,s){let i=!1;for(const r of n.studies)for(const a of r.series)a.seriesUID===e&&(s!==void 0&&a.folderPath!==s&&(a.folderPath=s,i=!0),a.pulled!==!0&&(a.pulled=!0,t!==void 0&&t>0&&(a.pulledFiles=t),i=!0));return i}const vp=[{id:"pacs-f-name",term:"PatientName"},{id:"pacs-f-mrn",term:"PatientID"},{id:"pacs-f-date",term:"StudyDate"},{id:"pacs-f-accession",term:"AccessionNumber"},{id:"pacs-f-modality",term:"Modality"}],To={running:"RETRIEVING",done:"✓ PULLED",error:"✗ ERROR",unconfirmed:"? UNCONFIRMED",stalled:"STALLED",queued:"QUEUED",idle:"NOT RETRIEVED"},cE="--fresh",Op="--anon",dE=/\s*--anon\b/,uE=["pacs-f-name","pacs-f-mrn","pacs-f-accession","pacs-f-date"],xp=/\s*--fresh\b/;function Sp(n){const e=Date.parse(n);if(Number.isNaN(e))return null;const t=Math.max(0,Math.round((Date.now()-e)/1e3)),s=[{limit:60,size:1,name:"SECOND"},{limit:3600,size:60,name:"MINUTE"},{limit:86400,size:3600,name:"HOUR"},{limit:2592e3,size:86400,name:"DAY"},{limit:31536e3,size:2592e3,name:"MONTH"},{limit:1/0,size:31536e3,name:"YEAR"}];for(const i of s){if(t>=i.limit)continue;const r=Math.max(1,Math.floor(t/i.size));return`${r} ${i.name}${r===1?"":"S"} AGO`}return null}const zl=new Map;function Qg(n,e){const t=zl.get(n)??new Set;t.add(e),zl.set(n,t)}function hE(n,e){const t=zl.get(n);if(t!==void 0){for(const s of[...t]){if(!s.isConnected){t.delete(s);continue}e(s)}t.size===0&&zl.delete(n)}}function fE(n){const e=document.createElement("span");if(e.className="pacs-badge",n.pulled===!0){const i=document.createElement("span");i.className="pacs-bar-full";const r=document.createElement("span");return r.className="pacs-badge-note",r.textContent=n.pulledFiles!==void 0?`✓ ${n.pulledFiles} IN CUBE`:"✓ IN CUBE",e.append(i,r),e.dataset.state="done",e}const t=document.createElement("span");t.className="pacs-bar";const s=document.createElement("span");return s.className="pacs-badge-note",s.textContent="NOT RETRIEVED",e.append(t,s),e.dataset.state="idle",Qg(n.seriesUID,e),e}function Jg(n,e){return[{key:"series",label:"SERIES",className:"pacs-series-desc",width:"35.5em",cell:t=>n(t).description},{key:"state",label:"STATE",className:"pacs-badge",width:"1fr",cell:t=>e(n(t)),compare:t=>n(t).pulled===!0?"done":"idle"},{key:"modality",label:"MODALITY",className:"pacs-series-modality",width:"4em",cell:t=>n(t).modality},{key:"files",label:"FILES",className:"pacs-series-files",width:"6em",cell:t=>{const s=n(t).fileCount;return s!==void 0?`${s} FILES`:""},compare:t=>n(t).fileCount??-1}]}class pE{root;command;results;handlers;litFolders=new Map;badgeStates=new Map;seriesProgress=new Map;studyTracks=new Map;traits;actions;studyTraits;studyActions;patientTraits;listing;patientTracks=new Map;provenance;run;model=null;anon=!1;revealed=!1;anonPill;revealPill;replayed=!1;serverCell;serverStrip;servers=[];chosen=new Set;constructor(e,t){this.root=e,this.handlers=t,this.command=Go(e,"#pacs-command"),this.results=mn(e,"#pacs-results"),this.traits=this.traits_declare(),this.actions=this.actions_declare(),this.studyTraits=this.studyTraits_declare(),this.studyActions=this.studyActions_declare(),this.patientTraits=this.patientTraits_declare(),this.listing=new Qr({mount:this.results,traits:this.patientTraits,key:s=>s.key,chrome:{root:e,prefix:"pacs"},activatable:s=>s.studies.length>0,address:s=>s.studies.length>0?S0(s.patient):void 0,control:"fold",row:{className:()=>"pacs-patient-row",groupClassName:s=>s.patient.status==="unasked"?"pacs-patient pacs-patient-unasked":"pacs-patient",decorate:(s,i)=>{i.studies.length>0&&(s.title="unfold this patient's studies (the patient keeps its place)")}},child:kr(s=>s.studies.map((i,r)=>({study:i,key:Ap(i,r)})),{traits:this.studyTraits,key:s=>s.key,address:s=>s.study.vfsPath,control:"fold",actions:{of:()=>this.studyActions},row:{className:()=>"pacs-study-row",groupClassName:()=>"pacs-study",decorate:s=>{s.title="unfold this study's series (the study keeps its place)"}},child:kr(s=>s.study.series.map(i=>({study:s.study,studyKey:s.key,series:i})),{traits:this.traits,key:s=>s.series.seriesUID,address:s=>s.series.vfsPath,actions:{of:()=>this.actions},row:{className:()=>"pacs-series",decorate:(s,i)=>{s.dataset.seriesuid=i.series.seriesUID}}})}),state:s=>this.stateLine_compose(s),empty:()=>Dp("NO STUDIES FOUND")}),e.style.setProperty("--roster-cols",this.listing.template_get(1)),this.listing.rows_set([],{field:"pacs"});for(const{id:s}of vp){const i=Go(e,`#${s}`);i.addEventListener("input",()=>this.command_regenerate()),i.addEventListener("keydown",r=>{r.key==="Enter"&&(r.preventDefault(),this.query_run())})}this.serverCell=mn(e,"#pacs-f-server"),this.serverStrip=mn(e,"#pacs-server-strip"),this.serverCell.addEventListener("click",()=>this.serverStrip_toggle()),this.serverCell_sync(),this.provenance=mn(e,"#pacs-provenance"),this.anonPill=mn(e,"#pacs-anon"),this.revealPill=mn(e,"#pacs-reveal"),this.anonPill.addEventListener("click",()=>this.anon_set(!this.anon)),this.revealPill.addEventListener("click",()=>this.reveal_set(!this.revealed)),this.run=mn(e,"#pacs-run"),this.run.addEventListener("click",()=>this.query_run(this.replayed)),this.command.addEventListener("keydown",s=>{s.key==="Enter"&&this.query_run()}),mn(e,"#pacs-export").addEventListener("click",()=>this.answer_export()),mn(e,"#pacs-gather-shown").addEventListener("click",()=>this.shown_gather()),mn(e,"#pacs-pull-shown").addEventListener("click",()=>this.shown_pull())}patientTraits_declare(){return[{key:"fold",label:"",className:"pacs-fold",capped:!1,width:"5.2em",cell:e=>{const t=document.createElement("span");return t.className=e.studies.length===0?"pacs-fold pacs-fold-none":"pacs-fold",t}},{key:"patient",label:"PATIENT",className:"pacs-patient-name",width:"13em",cell:e=>e.patient.patientName||"(unknown)"},{key:"mrn",label:"MRN",className:"pacs-patient-mrn",width:"7.5em",cell:e=>e.patient.patientId||"—"},{key:"answered",label:"ANSWERED",className:"pacs-patient-answered",width:"12em",cell:e=>{const t=document.createElement("span");if(t.className=e.patient.status==="unasked"?"pacs-patient-answered pacs-unasked":"pacs-patient-answered",e.patient.status==="unasked")return t.textContent="UNASKED",e.patient.error!==void 0&&(t.title=e.patient.error),t;const s=e.patient.provenance?.answeredAt;return t.textContent=s===void 0?"—":Sp(s)??"—",s!==void 0&&(t.title=s),t},compare:e=>{const t=e.patient.provenance?.answeredAt;if(t===void 0)return Number.MAX_SAFE_INTEGER;const s=Date.parse(t);return Number.isNaN(s)?Number.MAX_SAFE_INTEGER:s}},{key:"progress",label:"PROGRESS",className:"pacs-patient-progress",width:"1fr",cell:e=>{const t=document.createElement("span");return t.className="pacs-patient-progress",this.patientTracks.set(e.key,{mount:t,uids:e.studies.flatMap(s=>s.series.map(i=>i.seriesUID))}),this.patientTrack_paint(e.key),t},compare:e=>{const t=this.patientProgress_of(e);return t.total===0?-1:t.done/t.total}},{key:"studies",label:"STUDIES",className:"pacs-patient-count",width:"6em",cell:e=>e.patient.status==="unasked"?"—":String(e.patient.studyCount),compare:e=>e.patient.status==="unasked"?-1:e.patient.studyCount},{key:"series",label:"SERIES",className:"pacs-patient-count",width:"5em",cell:e=>e.patient.status==="unasked"?"—":String(e.patient.seriesCount),compare:e=>e.patient.status==="unasked"?-1:e.patient.seriesCount},{key:"server",label:"SERVER",className:"pacs-patient-server",width:"9em",cell:e=>e.patient.server??this.model?.pacsName??"—"}]}patientProgress_of(e){return So(e.studies.flatMap(t=>t.series.map(s=>this.seriesProgress.get(s.seriesUID)??{done:0,total:0})))}patientTrack_paint(e){const t=this.patientTracks.get(e);if(t===void 0)return;const s=t.uids.map(i=>this.seriesProgress.get(i)??{done:0,total:0});t.mount.replaceChildren(Vo(So(s)))}patientRows_build(e){const t=(r,a)=>e.studies.filter(o=>o.patientId===r&&(a===void 0||o.server===void 0||o.server===a));if(e.patients!==void 0&&e.patients.length>0)return e.patients.map((r,a)=>({patient:r,key:`${r.patientId}::${r.server??""}::${a}`,studies:t(r.patientId,r.server)}));const s=[],i=new Map;for(const r of e.studies){const a=r.patientId;i.has(a)||(i.set(a,[]),s.push(a)),i.get(a).push(r)}return s.map((r,a)=>{const o=i.get(r)??[];return{key:`${r}::${a}`,studies:o,patient:{patientId:r,...o[0]?.patientName?{patientName:o[0].patientName}:{},status:"found",studyCount:o.length,seriesCount:o.reduce((l,c)=>l+c.series.length,0),...e.provenance===void 0?{}:{provenance:e.provenance}}}})}studyTraits_declare(){return[{key:"fold",label:"",className:"pacs-fold",capped:!1,width:"5.2em",cell:()=>{const e=document.createElement("span");return e.className="pacs-fold",e}},{key:"patient",label:"PATIENT",className:"pacs-study-patient",width:"13em",cell:e=>e.study.patientName||"(unknown)"},{key:"mrn",label:"MRN",className:"pacs-study-mrn",width:"7.5em",cell:e=>e.study.patientId||"—"},{key:"study",label:"STUDY",className:"pacs-study-desc",width:"12em",cell:e=>e.study.description||"(no description)"},{key:"progress",label:"PROGRESS",className:"pacs-study-progress",width:"1fr",cell:e=>{const t=document.createElement("span");return t.className="pacs-study-progress",this.studyTracks.set(e.key,{mount:t,uids:e.study.series.map(s=>s.seriesUID)}),this.studyTrack_paint(e.key),t},compare:e=>{const t=this.studyProgress_of(e);return t.total===0?-1:t.done/t.total}},{key:"date",label:"DATE",className:"pacs-study-date",width:"7.5em",cell:e=>e.study.date},{key:"accession",label:"ACCESSION",className:"pacs-study-accession",width:"9em",cell:e=>e.study.accession||"—"},{key:"modality",label:"MODALITY",className:"pacs-study-modalities",width:"6.5em",cell:e=>e.study.modalities},{key:"server",label:"SERVER",className:"pacs-study-server",width:"9em",cell:e=>e.study.server??this.model?.pacsName??"—"},{key:"series",label:"SERIES",className:"pacs-study-count",width:"6.5em",cell:e=>String(e.study.series.length),compare:e=>e.study.series.length}]}studyActions_declare(){return[{label:vn(Ra,"pullStudy").label({addressable:!0,allInCube:!1}),offered:e=>vn(Ra,"pullStudy").offered({addressable:e.study.vfsPath!==void 0,allInCube:!1}),run:e=>{const t=e.study.vfsPath;if(t!==void 0){this.handlers.command_run(`pull ${t}`);for(const s of e.study.series)s.vfsPath!==void 0&&s.pulled!==!0&&this.badgeState_set(s.seriesUID,{status:"queued"})}}},{label:vn(Ra,"gather").label({addressable:!0,allInCube:!1,anyInCube:!0}),offered:e=>e.study.series.some(t=>kn(t).gather),run:e=>{const t=e.study.series.filter(i=>kn(i).gather);for(const i of t)this.gather_note(e.study,i);const s=e.study.series.length-t.length;this.handlers.note(`gather: ${t.length} series gathered${s>0?`, ${s} not in CUBE (pull them first)`:""}`)}},{label:vn(Ra,"process").label({addressable:!0,allInCube:!0}),offered:e=>yp(e.study)!==null,run:e=>{const t=yp(e.study);t!==null&&this.handlers.process_open(t)}}]}studyProgress_of(e){return So(e.study.series.map(t=>this.seriesProgress.get(t.seriesUID)??{done:0,total:0}))}traits_declare(){return Jg(e=>e.series,e=>this.badge_build(e))}actions_declare(){return[{label:vn(Ui,"gather").label({inCube:!0,folderKnown:!0,addressable:!0}),offered:e=>kn(e.series).gather,selected:e=>this.handlers.gathered_is(e.series.seriesUID),run:e=>this.gather_note(e.study,e.series)},{label:vn(Ui,"image").label({inCube:!0,folderKnown:!0,addressable:!0}),offered:e=>kn(e.series).image,selected:e=>e.series.folderPath!==void 0&&(this.litFolders.get(Ep(e.series.folderPath))?.viewer??!1),run:e=>{e.series.folderPath!==void 0&&this.handlers.image_open(e.series.folderPath)}},{label:vn(Ui,"dir").label({inCube:!0,folderKnown:!0,addressable:!0}),offered:e=>kn(e.series).dir,selected:e=>e.series.folderPath!==void 0&&(this.litFolders.get(Ep(e.series.folderPath))?.browser??!1),run:e=>{e.series.folderPath!==void 0&&this.handlers.dir_open(e.series.folderPath)}},{label:vn(Ui,"process").label({inCube:!0,folderKnown:!0,addressable:!0}),offered:e=>kn(e.series).image,run:e=>{e.series.folderPath!==void 0&&this.handlers.process_open(e.series.folderPath)}},{label:vn(Ui,"pull").label({inCube:!1,folderKnown:!1,addressable:!0}),offered:e=>kn(e.series).pull,disabled:e=>e.series.vfsPath===void 0,run:e=>{const t=e.series.vfsPath;t!==void 0&&(this.handlers.command_run(`pull ${t}`),this.badgeState_set(e.series.seriesUID,{status:"queued"}))}}]}state_name(e){return e.pulled===!0?"pulled":this.badgeStates.get(e.seriesUID)?.status??"idle"}command_regenerate(){const e=[];for(const{id:i,term:r}of vp){const a=Go(this.root,`#${i}`).value.trim();a.length>0&&e.push(`${r}:${a}`)}const t=this.chosen.size>1?` --pacsserver ${[...this.chosen].join(",")}`:"",s=this.anon?` ${Op}`:"";this.command.value=e.length>0||t!==""?`pacs query ${e.join(",")}${t}${s}`:""}anon_set(e){e!==this.anon&&(this.anon=e,this.revealed=!1,this.anonPill.textContent=e?"ANON ON":"ANON OFF",this.anonPill.classList.toggle("pacs-capsule-off",!e),this.revealPill.hidden=!e,this.model=null,this.listing.rows_set([],{field:"pending"}),this.provenance_show(void 0),this.command.value=e?`${this.command.value.trim()} ${Op}`.trim():this.command.value.replace(dE,"").trimEnd(),this.masking_apply())}reveal_set(e){this.revealed=e,this.revealPill.textContent=e?"HIDE":"REVEAL",this.revealPill.classList.toggle("pacs-capsule-off",!e),this.masking_apply()}masking_apply(){const e=this.anon&&!this.revealed;for(const t of uE)Go(this.root,`#${t}`).type=e?"password":"text";this.command.type=e?"password":"text"}serverStrip_toggle(e){const t=e??this.serverStrip.hidden;this.serverStrip.hidden=!t,this.serverCell.classList.toggle("pacs-server-open",t),t&&this.servers.length===0&&this.servers_ask(),t&&this.serverStrip_paint()}query_get(){return this.model===null?null:`pacs query ${this.model.expression}`}serverStrip_isOpen(){return!this.serverStrip.hidden}serverStrip_close(){this.serverStrip_toggle(!1)}servers_ask(){this.handlers.command_run("pacs list")}servers_take(e){this.servers=e,this.serverStrip_paint(),this.serverCell_sync()}serverStrip_paint(){if(this.serverStrip.replaceChildren(),this.servers.length===0){this.serverStrip.appendChild(Dp("ASKING THE SESSION FOR REGISTERED SERVERS"));return}for(const e of this.servers){const t=document.createElement("button");t.className=this.chosen.has(e.identifier)?"pacs-server-segment pacs-server-chosen":"pacs-server-segment",t.dataset.server=e.identifier,t.textContent=e.identifier,e.active&&(t.title="the session is connected to this server"),t.addEventListener("click",()=>this.server_choose(e.identifier)),this.serverStrip.appendChild(t)}}server_choose(e){if(this.chosen.has(e)?this.chosen.delete(e):this.chosen.add(e),this.chosen.size===1){const t=[...this.chosen][0];this.handlers.command_show(`pacs connect ${t}`)}this.serverStrip_paint(),this.serverCell_sync(),this.command_regenerate()}serverCell_sync(){const e=[...this.chosen];if(e.length===0){const t=this.servers.find(s=>s.active);this.serverCell.textContent=t?.identifier??"—",this.serverCell.classList.remove("pacs-server-many");return}this.serverCell.textContent=e.length===1?e[0]:`${e[0]} +${e.length-1}`,this.serverCell.classList.toggle("pacs-server-many",e.length>1)}wrote_show(e){const t=this.root.querySelector("#pacs-wrote");t!==null&&(t.textContent=`WROTE ${e}`,t.title="open the folder this landed in",t.classList.add("pacs-wrote-opens"),t.onclick=()=>{const s=e.lastIndexOf("/");this.handlers.dir_open(s<=0?e:e.slice(0,s))},t.hidden=!1)}answer_export(){if(this.model===null)return;const e=this.command.value.trim(),t=e===""?`pacs query ${this.model.expression}`:e;this.handlers.command_show(`${t} --csv-to`)}query_run(e=!1){e&&!xp.test(this.command.value)&&(this.command.value=`${this.command.value.trim()} ${cE}`);const t=this.command.value.trim();t.length!==0&&(this.model=null,this.listing.rows_set([],{field:"pending"}),this.listing.field_get()?.appendChild(this.waiting_build()),this.handlers.command_run(t))}provenance_show(e){if(this.replayed=e?.replayed===!0,this.run.textContent=this.replayed?"RE-QUERY":"QUERY",this.run.classList.toggle("pacs-capsule-requery",this.replayed),this.provenance.hidden=!this.replayed,!this.replayed){this.provenance.textContent="",this.command.value=this.command.value.replace(xp,"").trimEnd();return}const t=e?.answeredAt??"",s=Sp(t),i=t.slice(0,10);this.provenance.textContent=s===null?`RESULTS ${i}`:`RESULTS ${i} · ${s}`,this.provenance.title=t}waiting_build(){const e=document.createElement("div");e.className="pacs-waiting";const t=document.createElement("span");t.className="pacs-bar pacs-bar-pacing";const s=document.createElement("span");s.className="pacs-bar-fill",t.appendChild(s);const i=document.createElement("span");return i.className="pacs-waiting-note",i.textContent="QUERYING THE PACS…",e.append(t,i),e}envelope_observe(e){const t=/✓ wrote (\S+)/.exec((e.rendered??"").replace(/\x1b\[[0-9;]*m/g,""));if(t!==null&&this.wrote_show(t[1]),e.model?.kind===O0){const i=v0.safeParse(e.model.data);i.success&&this.servers_take(i.data.servers);return}if(e.model?.kind!==x0)return;const s=w0.safeParse(e.model.data);s.success&&this.results_render(s.data)}progress_observe(e){if(e.operation!=="pull"||e.itemId===void 0)return;const t=e.status??"running",s={status:t};e.current!==void 0&&(s.current=e.current),e.total!==void 0&&(s.total=e.total),this.badgeState_set(e.itemId,s),t==="done"&&this.model!==null&&lE(this.model,e.itemId,e.current??e.total,e.path)&&this.results_repaint()}badgeState_set(e,t){this.badgeStates.set(e,t),this.seriesProgress.set(e,gE(t,this.seriesProgress.get(e))),hE(e,s=>this.badge_paint(s,t));for(const[s,i]of this.studyTracks)i.uids.includes(e)&&this.studyTrack_paint(s);for(const[s,i]of this.patientTracks)i.uids.includes(e)&&this.patientTrack_paint(s)}badge_build(e){const t=document.createElement("span");if(t.className="pacs-badge",e.pulled===!0){const s=document.createElement("span");s.className="pacs-bar-full";const i=document.createElement("span");return i.className="pacs-badge-note",i.textContent=e.pulledFiles!==void 0?`✓ ${e.pulledFiles} IN CUBE`:"✓ IN CUBE",t.append(s,i),t.dataset.state="done",t}return Qg(e.seriesUID,t),this.badge_paint(t,this.badgeStates.get(e.seriesUID)??{status:"idle"}),t}badge_paint(e,t){e.replaceChildren(),e.dataset.state=t.status;const s=document.createElement("span");if(s.className="pacs-badge-note",t.status==="idle"){s.textContent=To.idle,e.append(Vo({done:0,total:0}),s);return}if(t.status!=="running"&&t.status!=="queued"){e.textContent=To[t.status]??t.status.toUpperCase();return}const i=t.total!==void 0?` ${t.current??0}/${t.total}`:"",r=t.status==="queued"||t.total===void 0||t.total===0?null:Math.min(1,(t.current??0)/t.total),a=document.createElement("span");a.className=r===null?"pacs-bar pacs-bar-pacing":"pacs-bar";const o=document.createElement("span");o.className="pacs-bar-fill",r!==null&&(o.style.width=`${Math.round(r*100)}%`),a.appendChild(o),s.textContent=t.status==="queued"?To.queued:`${To.running}${i}`,e.append(a,s)}results_render(e){const t=this.model!==null&&this.model.queryId===e.queryId;if(this.model=e,this.provenance_show(e.provenance),!t){this.listing.open_clear(),this.badgeStates.clear();const s=this.patientRows_build(e),i=s.length===1?s[0]:void 0;i!==void 0&&i.studies.length>0&&this.listing.open_set(0,[i.key]),e.studies.length===1&&this.listing.open_set(1,[Ap(e.studies[0],0)])}for(const s of e.studies)for(const i of s.series)t&&this.badgeStates.has(i.seriesUID)||this.seriesProgress.set(i.seriesUID,mE(i));this.results_repaint()}results_repaint(){const e=this.model;if(this.studyTracks.clear(),this.patientTracks.clear(),e===null){this.listing.rows_set([],{field:"pacs"});return}this.listing.rows_set([{key:String(e.queryId),rows:this.patientRows_build(e)}],{field:String(e.queryId)})}studyTrack_paint(e){const t=this.studyTracks.get(e);if(t===void 0)return;const s=t.uids.map(i=>this.seriesProgress.get(i)??{done:0,total:0});t.mount.replaceChildren(Vo(So(s)))}stateLine_compose(e){queueMicrotask(()=>{this.shownGather_render(),this.shownPull_render()});const t=[],s=this.model?.patients??[];if(s.length>0){const i=r=>s.filter(a=>a.status===r).length;t.push(`FOUND ${i("found")} · NONE ${i("none")} · UNASKED ${i("unasked")}`)}return e.filter!==""&&t.push(e.filter),t.join(" · ")}filter_toggle(e){this.listing.filter_toggle(e)}shown_candidates(){const e=[];if(!this.filtering()){for(const t of this.model?.studies??[])for(const s of t.series)e.push({study:t,series:s});return e}for(const t of this.root.querySelectorAll("#pacs-results .pacs-series")){const s=t.dataset.seriesuid;if(s!==void 0)for(const i of this.model?.studies??[]){const r=i.series.find(a=>a.seriesUID===s);r!==void 0&&e.push({study:i,series:r})}}return e}filtering(){return this.listing.filterText_get()!==""}shown_gatherable(){return this.shown_candidates().filter(({series:e})=>kn(e).gather&&!this.handlers.gathered_is(e.seriesUID))}shownGather_render(){const e=this.root.querySelector("#pacs-gather-shown");if(e===null)return;const t=this.shown_gatherable().length;e.hidden=t===0,e.textContent=this.filtering()?`GATHER ${t} SHOWN`:`GATHER ${t}`}shown_pullable(){return this.shown_candidates().map(({series:e})=>e).filter(e=>kn(e).pull&&e.vfsPath!==void 0)}shownPull_render(){const e=this.root.querySelector("#pacs-pull-shown");if(e===null)return;const t=this.shown_pullable().length;e.hidden=t===0,e.textContent=this.filtering()?`PULL ${t} SHOWN`:`PULL ${t}`}shown_pull(){const e=this.shown_pullable();if(e.length===0)return;const t=e.map(s=>`"${s.vfsPath}"`).join(" ");this.handlers.command_show(`pull ${t}`);for(const s of e)this.badgeState_set(s.seriesUID,{status:"queued"});this.handlers.note(`pull: ${e.length} series asked for`),this.shownPull_render()}shown_gather(){const e=this.shown_gatherable();if(e.length!==0){for(const{study:t,series:s}of e)this.gather_note(t,s);this.handlers.note(this.filtering()?`gather: ${e.length} series gathered from what the filter left showing`:`gather: ${e.length} series gathered from the whole answer`),this.shownGather_render()}}gather_note(e,t){t.vfsPath!==void 0&&(this.handlers.gather_add({seriesUID:t.seriesUID,description:t.description,modality:t.modality,series:t,patient:e.patientId||e.patientName,...e.description===void 0||e.description===""?{}:{study:e.description},vfsPath:t.vfsPath,...t.folderPath!==void 0?{folderPath:t.folderPath}:{},...t.fileCount!==void 0?{files:t.fileCount}:{}}),this.selected_refresh())}stage_lit(e){this.litFolders=e,this.selected_refresh()}selected_refresh(){this.listing.indication_refresh()}}function Ap(n,e){return n.studyUID??`study-${e}`}function Ep(n){return n.replace(/\/$/,"")}function mE(n){const e=n.pulledFiles??0,t=Math.max(n.fileCount??0,e);return n.pulled===!0?{done:t,total:t}:{done:e,total:t}}function gE(n,e){const t=n.total??e?.total??0;return n.status==="error"?{done:n.current??e?.done??0,total:t,failed:!0}:n.status==="done"?{done:t,total:t}:{done:n.current??e?.done??0,total:t}}function mn(n,e){const t=n.querySelector(e);if(t===null)throw new Error(`PACS workspace is missing '${e}'`);return t}function Go(n,e){const t=mn(n,e);if(!(t instanceof HTMLInputElement))throw new Error(`'${e}' is not an input`);return t}function Dp(n){const e=document.createElement("p");return e.className="files-empty",e.textContent=n,e}function Ip(n){return(n.kind??"series")==="series"?void 0:n.vfsPath}const Nc="cohort";function ME(n){return/[",\n\r]/.test(n)?`"${n.split('"').join('""')}"`:n}function bE(n){const e=document.createElement("p");return e.className="files-empty",e.textContent=n,e}class Tp{handlers;title;cohort;greeted=!1;listing;cohortActions;seriesActions;constructor(e,t,s,i){this.handlers=s,this.cohort=i,i.watch(()=>{this.unsaved=!0,this.render()}),this.title=e.querySelector(".gather-title"),this.cohortActions=this.cohortActions_declare(),this.seriesActions=this.seriesActions_declare(),this.listing=new Qr({mount:t,traits:this.cohortTraits_declare(),key:r=>r.key,chrome:{root:e,prefix:"gather"},control:"fold",actions:{of:()=>this.cohortActions},row:{className:()=>"gather-cohort-row",groupClassName:()=>"gather-cohort",decorate:r=>{r.title="the cohort: click for its verbs, the fold cell folds its series"}},child:kr(()=>[...this.cohort.members_get()].map(r=>({entry:r})),{traits:this.seriesTraits_declare(),key:r=>r.entry.seriesUID,address:r=>r.entry.vfsPath,actions:{of:()=>this.seriesActions},row:{className:()=>"gather-series",decorate:(r,a)=>{r.dataset.seriesuid=a.entry.seriesUID}}}),state:r=>this.stateLine_compose(r),empty:()=>bE("NOTHING GATHERED")}),this.pullBlock=e.querySelector(".gather-pull"),this.pullBlock?.addEventListener("click",()=>this.cohort_pull()),this.emptyBlock=e.querySelector(".gather-remove"),this.emptyBlock?.addEventListener("click",()=>{this.cohort_clear()}),this.processBlock=e.querySelector(".gather-process"),this.processBlock?.addEventListener("click",()=>{this.cohort_process()}),this.render()}pullBlock=null;emptyBlock=null;unsaved=!1;processBlock=null;cohort_empty(){this.cohort.size()!==0&&(this.cohort.clear(),this.handlers.changed(),this.render())}async cohort_clear(){if(this.cohort.size()!==0){if(this.unsaved){const e=await this.handlers.confirm_ask(`Save the cohort first? (${this.cohort.size()} ${this.cohort.size()===1?"member":"members"}, unsaved)`);if(e===null||e==="y"&&!await this.manifest_save())return}this.handlers.command_show("gather clear"),this.cohort_empty()}}away(){return[...this.cohort.members_get()].filter(e=>e.folderPath===void 0&&e.series?.pulled!==!0)}cohort_pull(){const e=this.away();if(e.length===0)return;const t=e.map(s=>`"${s.vfsPath}"`).join(" ");this.handlers.command_show(`pull ${t}`)}render_now(){this.render()}has(e){return this.cohort.has(e)}entries_get(){return[...this.cohort.members_get()]}name_get(){return this.cohort.name_get()}feed_get(){return this.cohort.feed_get()}feed_set(e){e!==null&&this.cohort.feed_set(e),this.render()}name_set(e){e!==null&&this.cohort.name_set(e),this.render()}series_add(e){this.cohort.take(e),this.render(),this.handlers.changed()}series_remove(e){this.cohort.drop(e)&&(this.render(),this.handlers.changed())}render(){if(this.title!==null&&(this.title.textContent=this.cohort.name_get()===null?"GATHER":`GATHER · ${this.cohort.name_get()??""}`.toUpperCase()),this.listing.rows_set([{key:"gather",rows:[{key:Nc}]}],{field:"gather"}),this.cohort.size()>0&&this.listing.open_set(0,[Nc]),this.pullBlock!==null){const e=this.away().length;this.pullBlock.hidden=e===0,this.pullBlock.textContent=`PULL ${e}`}this.emptyBlock!==null&&(this.emptyBlock.hidden=this.cohort.size()===0,this.emptyBlock.textContent=`CLEAR ${this.cohort.size()}`),this.processBlock!==null&&(this.processBlock.hidden=this.cohort.size()===0),this.greeted||(this.greeted=!0,this.listing.row_indicate(Nc))}cohortTraits_declare(){return[{key:"fold",label:"",className:"pacs-fold",capped:!1,width:"5.2em",cell:()=>{const e=document.createElement("span");return e.className="pacs-fold",e}},{key:"name",label:"COHORT",className:"gather-cohort-name",width:"1fr",cell:()=>this.cohort.name_get()??"(unnamed — SAVE names it)"},{key:"series",label:"SERIES",className:"gather-cohort-count",width:"6em",cell:()=>String(this.series_count()),compare:()=>this.series_count()},{key:"patients",label:"PATIENTS",className:"gather-cohort-patients",width:"7em",cell:()=>String(this.patients_count()),compare:()=>this.patients_count()},{key:"feed",label:"FEED",className:"gather-cohort-feed",width:"7em",cell:()=>{if(this.cohort.feed_get()===null)return"—";const e=document.createElement("button");e.className="gather-feed listing-capsule listing-action-selected",e.textContent=`FEED ${this.cohort.feed_get()?.feedId??0}`,e.title="open the feed's graph beside the cohort";const t=this.cohort.feed_get()?.feedId??0;return e.addEventListener("click",s=>{s.stopPropagation(),this.handlers.feed_open(t)}),e},compare:()=>this.cohort.feed_get()?.feedId??-1}]}seriesTraits_declare(){const e=Jg(i=>i.entry.series??{seriesUID:i.entry.seriesUID,description:i.entry.description,modality:i.entry.modality,...i.entry.files===void 0?{}:{fileCount:i.entry.files},...i.entry.folderPath===void 0?{}:{pulled:!0,folderPath:i.entry.folderPath}},fE),t={key:"patient",label:"MRN",className:"gather-series-patient",width:"8em",cell:i=>i.entry.patient||"—"},s={key:"study",label:"STUDY",className:"gather-series-study",width:"14em",cell:i=>i.entry.study??"—"};return[...e.slice(0,1),s,t,...e.slice(1)]}cohortActions_declare(){const e=()=>({count:this.cohort.size(),feed:this.cohort.feed_get()?.feedId??null}),t={save:()=>{this.manifest_save()},export:()=>{this.cohort_export()},feed:()=>{this.feed_ensure()},process:()=>{this.cohort_process()},dismiss:()=>this.handlers.dismiss()};return Zg.rules.map(s=>({label:s.label(e()),offered:()=>s.offered(e()),run:()=>t[s.name]?.()}))}seriesActions_declare(){const e=s=>({folderKnown:(s.entry.kind??"series")!=="series"||s.entry.folderPath!==void 0,imagery:(s.entry.kind??"series")==="series"||s.entry.imagery===!0,pullable:(s.entry.kind??"series")==="series"&&s.entry.folderPath===void 0&&s.entry.series?.pulled!==!0&&s.entry.vfsPath!==""}),t={remove:s=>this.series_remove(s.entry.seriesUID),pull:s=>this.handlers.command_show(`pull "${s.entry.vfsPath}"`),image:s=>{const i=s.entry.folderPath??Ip(s.entry);i!==void 0&&this.handlers.image_open(i)},process:s=>{const i=s.entry.folderPath??Ip(s.entry);if(i!==void 0){this.handlers.process_open(i);return}this.handlers.note(`gather: ${s.entry.description||s.entry.seriesUID} is not in CUBE yet — PULL it first, then PROCESS it.`)}};return Kg.rules.map(s=>({label:s.label({folderKnown:!0,pullable:!0}),offered:i=>s.offered(e(i)),run:i=>t[s.name]?.(i)}))}patients_count(){return new Set(this.cohort.members_get().filter(e=>(e.kind??"series")==="series").map(e=>e.patient)).size}series_count(){return this.cohort.members_get().filter(e=>(e.kind??"series")==="series").length}stateLine_compose(e){const t=this.cohort.members_get(),s=t.filter(o=>(o.kind??"series")!=="series").length,i=t.length-s,r=[];(i>0||s===0)&&r.push(`${i} SERIES`),s>0&&r.push(`${s} ${s===1?"PLACE":"PLACES"}`),s===0&&r.push(`${this.patients_count()} PATIENTS`);const a=[r.join(" · ")];return e.filter!==""&&a.push(e.filter),a.join(" · ")}async name_ensure(){if(this.cohort.name_get()!==null)return this.cohort.name_get();const t=(await this.handlers.name_ask(`gather-${new Date().toISOString().slice(0,10)}`)??"").trim();return t===""?null:(this.cohort.name_set(t),this.render(),t)}async manifest_save(){if(this.cohort.size()===0)return!1;const e=await this.name_ensure();if(e===null)return!1;const t=JSON.stringify({name:e,gatheredAt:new Date().toISOString(),series:[...this.cohort.members_get()].map(s=>({seriesUID:s.seriesUID,description:s.description,modality:s.modality,patient:s.patient,vfsPath:s.vfsPath}))});return this.handlers.command_run("mkdir -p ~/gather"),this.handlers.command_show(`touch --withContents '${t}' ~/gather/${e}.json`),this.unsaved=!1,!0}async cohort_export(){if(this.cohort.size()===0)return;const e=await this.name_ensure();if(e===null)return;const t=[["patient","series","modality","seriesUID","path"].join(","),...[...this.cohort.members_get()].map(s=>[s.patient,s.description,s.modality,s.seriesUID,s.vfsPath].map(ME).join(","))];this.handlers.command_run("mkdir -p ~/gather"),this.handlers.command_show(`touch --withContents '${t.join(`
4227
+ `||d==="\r"){l(),c(),a+=1;continue}s+=d,a+=1}return(s!==""||o||i.length>0)&&(l(),c()),t}function qA(n){if(n.length===0)return!1;const e=new Set;for(const t of n){const s=t.trim();if(s===""||e.has(s.toLowerCase())||s!==""&&Number.isFinite(Number(s)))return!1;e.add(s.toLowerCase())}return!0}function XA(n,e){const t=/\.tsv$/i.test(e)?" ":",",s=HA(n,t);if(s.length===0)return{caps:[],rows:[],headed:!1};const i=s[0],r=qA(i),a=r?s.slice(1):s,o=s.reduce((d,u)=>Math.max(d,u.length),0),l=r?Array.from({length:o},(d,u)=>(i[u]??`COLUMN ${u+1}`).trim()):Array.from({length:o},(d,u)=>`COLUMN ${u+1}`),c=a.map(d=>Array.from({length:o},(u,h)=>d[h]??""));return{caps:l,rows:c,headed:r}}function hp(n){return/-v(\d+(?:\.\d+)*)$/.exec(n)?.[1]??""}const fp="",YA="/bin",pp="/bin/recent",Ao={dir:"",file:"",link:"",plugin:"",pipeline:"",vfs:"",job:""},Bc=["list","cards","preview"],KA=5e3,ZA=new Set(["png","jpg","jpeg","gif","svg","webp","bmp"]),QA=new Set(["txt","md","adoc","rst","json","csv","tsv","log","yaml","yml","toml","ini","cfg","xml","html","py","sh","ts","js","mjs","r","c","h","cpp","java","go","rs","sql","tex","bib"]),mp=160,gp=100,Eo=10,JA=30,eE=256*1024,tE=4e3,sE=12*1024*1024,nE=400;function Ko(n){return ZA.has(Hg(n))}function Hg(n){const e=n.split("/").pop()??"",t=e.lastIndexOf(".");return t>0?e.slice(t+1).toLowerCase():""}function iE(n){if(n.includes("\0"))return!0;const e=(n.match(/\uFFFD/g)??[]).length;return e>0&&e/n.length>.02}const rE=80;function Mp(n,e){if(n===null)return[];const t=document.createElement("button");return t.className="files-close-pill files-download-pill",t.textContent="DOWNLOAD",t.title="save this file to your disk",t.addEventListener("click",()=>n.download(e)),[t]}function bp(n){const e="http://www.w3.org/2000/svg",t=document.createElementNS(e,"svg");t.setAttribute("viewBox",`0 0 ${mp} ${gp}`),t.setAttribute("preserveAspectRatio","xMidYMid meet");const s=Og(n),i=Math.max(s.width,1),r=Math.max(s.tierCount-1,1),a=new Map;for(const o of s.placements)a.set(o.id,{x:Eo+o.x/i*(mp-2*Eo),y:Eo+o.tier/r*(gp-2*Eo)});for(const o of n){const l=a.get(o.id);if(l)for(const c of o.parentIds){const d=a.get(c);if(!d)continue;const u=document.createElementNS(e,"line");u.setAttribute("x1",String(d.x)),u.setAttribute("y1",String(d.y)),u.setAttribute("x2",String(l.x)),u.setAttribute("y2",String(l.y)),u.setAttribute("stroke","currentColor"),u.setAttribute("stroke-width","1"),u.setAttribute("opacity","0.6"),t.appendChild(u)}}for(const[,o]of a){const l=document.createElementNS(e,"circle");l.setAttribute("cx",String(o.x)),l.setAttribute("cy",String(o.y)),l.setAttribute("r",n.length>JA?"2.2":"4"),l.setAttribute("fill","currentColor"),t.appendChild(l)}return t}function Do(n){return n.type==="dir"||n.type==="vfs"||n.type==="link"||n.type==="job"?"dir":n.type==="file"?"file":n.type==="plugin"||n.type==="pipeline"?n.type:null}class zp{container;recent=null;activate;listing;lastListings=[];contentShown=!1;denied=new Set;following=!1;viewMode="list";viewPill;modeSpan;preview;catalogue;runStrip=null;feedOpen=null;headCache=new Map;thumbObserver=null;frameTopObserver=null;stale=!1;home=null;ceiling=null;stateSpan;indicate=null;selectionVerbs=null;constructor(e,t,s=null,i={}){this.container=e,this.activate=t,this.preview=s,this.catalogue=i.catalogue===!0,this.catalogue&&e.parentElement?.classList.add("files-catalogue");const r=e.closest(".pane-files")??e.parentElement;this.viewPill=e.parentElement?.querySelector(".files-view")??null,this.modeSpan=e.closest(".pane-files")?.querySelector(".pane-mode")??null,this.stateSpan=r?.querySelector(".pane-state")??null,this.viewPill?.addEventListener("click",()=>{this.view_set(Bc[(Bc.indexOf(this.viewMode)+1)%Bc.length]??"list")});const a=e.parentElement?.querySelector(":scope > .mode-frame")!==null;this.listing=new Qr({mount:e,traits:this.traits_declare(),key:o=>o.home===!0?"~":o.path,address:o=>o.path,chrome:r===null?void 0:{root:r,prefix:"files"},control:"control",activate:o=>this.row_activate(o),activatable:o=>o.updir||Do(o.entry)!==null,indicated:o=>this.indicate?.(o.entry,o.path),row:{className:o=>`files-row files-type-${o.entry.type}${o.home===!0?" files-lead-home":o.updir?" files-lead-up":""}${!o.updir&&this.denied.has(o.path)?" files-denied":""}`,decorate:(o,l)=>{o.dataset.path=l.path,!l.updir&&this.denied.has(l.path)&&(o.title="listed but not readable — CUBE refused this identity access to the contents")}},...a?{selection:{verbs:o=>this.selectionVerbs?.(o.map(([l,c])=>[l,c.entry]))??[]}}:{},state:o=>this.stateLine_compose(o),defaultSort:{key:"name",dir:"asc"}}),this.empty_render()}traits_declare(){return this.catalogue?this.catalogueTraits_declare():this.browserTraits_declare()}browserTraits_declare(){return[{key:"control",label:"",className:"files-control",capped:!1,width:"2.4em",cell:e=>{const t=document.createElement("span"),s=e.updir?"dir":e.entry.type,i=e.updir||Do(e.entry)!==null;return t.className=`files-control files-glyph files-glyph-${s}${i?" files-capsule":""}`,t.textContent=e.home===!0?fp:!e.updir&&this.denied.has(e.path)?"⃠":Ao[s],t}},{key:"name",label:"NAME",className:"files-name",width:"minmax(12em, 1fr)",cell:e=>{const t=document.createElement("span");if(t.className="files-name",t.textContent=e.home===!0?"~":e.entry.name,e.home===!0){const s=document.createElement("span");s.className="files-target",s.textContent=e.path,t.appendChild(s),t.title=`home: ${e.path}`}if(!e.updir&&e.entry.type==="link"&&e.entry.target!==void 0){const s=document.createElement("span");s.className="files-target",s.textContent=`→ ${e.entry.target}`,t.appendChild(s),t.title=e.entry.target}return t},compare:e=>e.entry.name},{key:"type",label:"TYPE",className:"files-type",width:"6em",cell:e=>e.updir?"":e.entry.type},{key:"size",label:"SIZE",className:"files-size",width:"6em",cell:e=>e.updir||e.entry.type==="dir"?"":wp(e.entry.size),compare:e=>e.entry.size},{key:"date",label:"DATE",className:"files-date",width:"7em",cell:e=>e.updir?"":e.entry.date.slice(0,10),compare:e=>e.entry.date},{key:"owner",label:"OWNER",className:"files-owner",width:"10em",cell:e=>e.updir?"":e.entry.owner}]}row_activate(e){if(e.updir){this.activate({kind:"dir",path:e.path});return}const t=Do(e.entry);t!==null&&this.activate({kind:t,path:e.path})}envelope_observe(e){if(e.model?.kind!=="fs.listing")return;const t=_p(e.model.data);if(t===null||t.length===0)return;this.lastListings=t;const s=t[0]?.path??"";this.container.closest(".workspace-pane")?.classList.toggle("files-projection",/^\/(proc|net|etc|usr)(\/|$)/.test(s)),!this.contentShown&&this.listings_render(t)}ambient_observe(e){if(e.model?.kind!=="fs.listing")return;const t=_p(e.model.data);if(t===null||this.lastListings.length===0)return;let s=!1;const i=this.lastListings.map(r=>{const a=t.find(o=>o.path===r.path);return a===void 0?r:(s=!0,a)});if(s){if(this.contentShown){this.lastListings=i;return}this.listings_render(i)}}contentTable_show(e,t){const s=XA(t,e);if(s.caps.length===0){this.content_show(e,t);return}const i=s.rows.slice(0,KA),r=s.rows.length>i.length;this.contentRelease?.(),this.contentShown=!0,this.container.parentElement?.classList.add("content-view"),this.container.replaceChildren(),this.diagram_declare(!1);const a=document.createElement("section");a.className="files-content-view files-table-view";const o=document.createElement("header");o.className="files-path files-content-header";const l=document.createElement("span");l.textContent=e;const c=document.createElement("span");c.className="pane-state",o.append(l,c);const d=document.createElement("div");d.className="files-table-field";const u=document.createElement("span");u.className="field-rule";const h=document.createElement("button");h.className="mode-strip",h.title="display modes";const g=document.createElement("span");g.className="mode-elbow";const p=document.createElement("aside");p.className="mode-frame";const z=document.createElement("button");z.className="strategy-pill csv-filter rail-off",z.textContent="FILTER OFF",z.title="filter the table";const m=document.createElement("button");m.className="strategy-pill csv-raw",m.textContent="RAW",m.title="the bytes as written",m.addEventListener("click",()=>this.content_show(e,t));const f=document.createElement("button");f.className="strategy-pill csv-close",f.textContent="CLOSE",f.title="leave the table; the listing beneath returns",f.addEventListener("click",()=>this.listing_restore());const _=document.createElement("span");_.className="mode-fill",p.append(z,m,_);const O=this.preview;if(O!==null){const I=document.createElement("button");I.className="strategy-pill csv-download",I.textContent="DOWNLOAD",I.title="save this file to your disk",I.addEventListener("click",()=>O.download(e)),p.append(I)}p.append(f);const w=document.createElement("div");w.className="files-table-rows",d.append(u,h,g,p,w),a.append(o,d),this.container.appendChild(a);const x=s.caps.map((I,b)=>({key:`c${b}`,label:I.toUpperCase(),className:"files-table-cell",cell:A=>A.cells[b]??"",width:"minmax(6em, 1fr)"}));new Qr({mount:w,traits:x,key:I=>String(I.index),chrome:{root:a,prefix:"csv"},state:I=>{const b=[];return I.filter!==""?b.push(`${I.filter} ROWS`):b.push(r?`SHOWING ${i.length} OF ${s.rows.length} ROWS`:`${s.rows.length} ROWS`),s.headed||b.push("NO HEADER: COLUMNS NUMBERED"),b.join(" · ")},empty:()=>{const I=document.createElement("div");return I.className="files-note",I.textContent="NO ROWS",I}}).rows_set([{key:e,rows:i.map((I,b)=>({index:b,cells:I}))}],{field:e}),this.contentRelease=()=>{w.replaceChildren()}}content_show(e,t){this.diagram_declare(!1),this.contentShown=!0,this.container.parentElement?.classList.add("content-view"),this.container.replaceChildren();const s=document.createElement("header");s.className="files-path files-content-header";const i=document.createElement("span");i.textContent=e;const r=document.createElement("button");r.className="files-close-pill",r.textContent="CLOSE",r.addEventListener("click",()=>this.listing_restore()),s.append(i,...Mp(this.preview,e),r);const a=document.createElement("pre");a.className="files-content",a.textContent=t,this.container.append(s,a)}contentRefused_show(e,t){this.diagram_declare(!1),this.denied.add(e),this.contentShown=!0,this.container.parentElement?.classList.add("content-view"),this.container.replaceChildren();const s=document.createElement("header");s.className="files-path files-content-header files-content-refused";const i=document.createElement("span");i.textContent=e;const r=document.createElement("button");r.className="files-close-pill",r.textContent="CLOSE",r.addEventListener("click",()=>this.listing_restore()),s.append(i,r);const a=document.createElement("div");a.className="files-refused";const o=document.createElement("p");o.className="files-refused-lede",o.textContent="READ REFUSED";const l=document.createElement("pre");l.className="files-refused-said",l.textContent=t,a.append(o,l),this.container.append(s,a)}contentImage_show(e,t){this.contentShown=!0,this.container.parentElement?.classList.add("content-view"),this.container.replaceChildren();const s=document.createElement("header");s.className="files-path files-content-header";const i=document.createElement("span");i.textContent=e;const r=document.createElement("button");r.className="files-close-pill",r.textContent="CLOSE",r.addEventListener("click",()=>this.listing_restore()),s.append(i,...Mp(this.preview,e),r);const a=document.createElement("img");a.className="files-image",a.src=t,a.alt=e,this.container.append(s,a)}rowVerbs_declare(e,t){this.indicate=t??null,this.listing.actions_declare({of:s=>s.updir?[]:e(s.entry,s.path).map(i=>({label:i.label,run:()=>i.run(s.entry),...i.offered!==void 0?{offered:()=>i.offered(s.entry)}:{},...i.disabled!==void 0?{disabled:()=>i.disabled(s.entry)}:{}}))})}catalogueTraits_declare(){return[...this.browserTraits_declare().filter(s=>s.key==="control"||s.key==="name"),{key:"type",label:"TYPE",className:"files-type",width:"6em",cell:s=>s.updir?"":s.entry.type},{key:"version",label:"VERSION",className:"files-version",width:"7em",cell:s=>s.updir?"":hp(s.entry.name),compare:s=>hp(s.entry.name)}]}catalogue_is(){return this.catalogue}binding_set(e){if(this.runStrip===null){const s=document.createElement("div");s.className="files-run-strip";const i=document.createElement("span");i.className="files-binding";const r=document.createElement("input");r.className="files-command",r.spellcheck=!1,r.autocomplete="off",r.placeholder="the line RUN will run",s.append(i,r),this.container.parentElement?.insertBefore(s,this.container),this.runStrip=s;const a=this.container.closest(".pane-files")?.querySelector(".pane-title");a!=null&&(a.textContent="CATALOGUE")}const t=this.runStrip.querySelector(".files-binding");t!==null&&(t.textContent=`INPUT ${e.input} → ${e.place}`),this.frameTop_track()}commandLine_get(){return this.runStrip?.querySelector(".files-command")?.value.trim()??""}commandLine_set(e){const t=this.runStrip?.querySelector(".files-command")??null;t!==null&&(t.value=e)}indicated_get(){return this.listing.indicated_get()}feedOpen_declare(e){this.feedOpen=e}run_show(e){if(this.runStrip===null)return;this.runStrip.querySelector(".files-feed")?.remove();const t=document.createElement("button");t.className="files-feed listing-capsule listing-action-selected",t.textContent=`FEED ${e}`,t.title="open this run's graph beside the catalogue",t.addEventListener("click",()=>this.feedOpen?.(e)),this.runStrip.appendChild(t)}row_indicate(e){this.listing.row_indicate(e)}rowReadout_show(e,t){this.listing.readout_show(e,t)}selectionVerbs_declare(e){this.selectionVerbs=e}select_toggle(e){this.listing.select_toggle(e)}select_isOn(){return this.listing.select_isOn()}selection_get(){return this.listing.selection_get()}path_current(){return this.lastListings[0]?.path??null}content_isShown(){return this.contentShown}contentRelease=null;contentHtml_show(e,t,s={}){this.contentRelease?.(),this.contentRelease=s.release??null,this.contentShown=!0,this.container.parentElement?.classList.add("content-view"),this.container.replaceChildren();const i=document.createElement("section");i.className="files-content-view";const r=document.createElement("header");r.className="files-path files-content-header";const a=document.createElement("span");a.textContent=e;const o=document.createElement("button");if(o.className="files-close-pill",o.textContent="CLOSE",o.addEventListener("click",()=>this.listing_restore()),r.append(a,o),i.appendChild(r),t!==""){const c=document.createElement("pre");c.className="files-content",c.innerHTML=t,i.appendChild(c)}let l=null;return s.diagram===!0&&(l=document.createElement("div"),l.className="files-diagram",i.appendChild(l)),this.diagram_declare(s.diagram===!0),this.container.appendChild(i),l}contentText_set(e){const t=this.container.querySelector(".files-content-view");if(t===null)return;const s=t.querySelector(".files-content"),i=s??document.createElement("pre");i.className="files-content",i.innerHTML=e,s===null&&t.querySelector(".files-content-header")?.after(i)}recent_set(e){this.recent=e===null?null:[...e],this.lastListings.length>0&&!this.contentShown&&this.listings_render(this.lastListings)}listing_restore(){this.contentRelease?.(),this.contentRelease=null,this.lastListings.length>0?this.listings_render(this.lastListings):this.empty_render()}empty_render(){this.diagram_declare(!1),this.container.replaceChildren();const e=document.createElement("p");e.className="files-empty",e.textContent="AWAITING LISTING — TYPE ls IN THE CONSOLE",this.container.appendChild(e)}listings_render(e){this.diagram_declare(!1),this.contentShown=!1,this.container.parentElement?.classList.remove("content-view"),this.lastListings=e,this.thumbObserver?.disconnect(),this.thumbObserver=null,this.stale=e.some(i=>i.fresh===!1),this.stateSpan?.classList.toggle("state-stale",this.stale),this.listing.painter_set(this.viewMode==="list"?null:(i,r)=>this.cards_paint(i,r));const t=e.map(i=>this.block_of(i)),s=e.find(i=>i.path===YA);if(this.recent!==null&&this.recent.length>0&&s!==void 0){const i=this.recentBlock_of(s);i!==null&&t.unshift(i)}this.listing.rows_set(t,{field:e[0]?.path??""}),this.frameTop_track()}crumbs_build(e){const t=document.createElement("header");t.className="files-path files-crumbs";const s=[],i=this.home;let r;i!==null&&(e===i||e.startsWith(`${i}/`))?(s.push({label:"~",path:i}),r=e.slice(i.length)):(s.push({label:"/",path:"/"}),r=e);let a=s[0]?.path??"/";for(const o of r.split("/").filter(l=>l.length>0))a=a==="/"?`/${o}`:`${a}/${o}`,s.push({label:o,path:a});return s.forEach((o,l)=>{l>0&&s[l-1]?.label!=="/"&&t.append("/");const c=l===s.length-1,d=document.createElement(c?"span":"button");d.className=c?"files-crumb files-crumb-here":"files-crumb",d.textContent=o.label,d.dataset.path=o.path,c||(d.title=`go to ${o.path}`,d.addEventListener("click",u=>{u.stopPropagation(),this.activate({kind:"dir",path:o.path})})),t.appendChild(d)}),t}ceiling_set(e,t=".."){this.ceiling=e===null?null:{path:e.replace(/\/+$/,"")||"/",word:t}}home_set(e){e!==this.home&&(this.home=e,!this.contentShown&&this.lastListings.length>0&&this.listings_render(this.lastListings))}block_of(e){const t=this.crumbs_build(e.path),s=e.items.map(r=>({entry:r,path:Io(e.path,r.name),updir:!1})),i=[];if(!this.catalogue&&this.home!==null&&e.path!==this.home&&i.push({entry:{name:"~",type:"dir",size:0,owner:"",date:""},path:this.home,updir:!0,home:!0}),e.path!=="/"){const r=this.ceiling!==null&&this.ceiling.path===e.path?this.ceiling.word:"..";i.push({entry:{name:r,type:"dir",size:0,owner:"",date:""},path:aE(e.path),updir:!0})}return{key:e.path,header:t,lead:i,rows:s}}recentBlock_of(e){const t=new Map(e.items.map(r=>[r.name,r])),s=[];for(const r of this.recent??[]){const a=t.get(r);a!==void 0&&s.push({entry:a,path:Io(pp,r),updir:!1})}if(s.length===0)return null;const i=document.createElement("header");return i.className="files-path files-recent",i.textContent="RECENT",{key:pp,header:i,lead:[],rows:s}}cards_paint(e,t){const s=this.viewMode==="preview",i=document.createElement("div");i.className=s?"files-cards files-previews":"files-cards";for(const a of e.lead??[]){const o=document.createElement("article");o.className=a.home===!0?"files-card files-card-up files-card-home files-activatable":"files-card files-card-up files-activatable",o.textContent=a.home===!0?`${fp} ~`:"▴ ..",o.addEventListener("click",()=>this.activate({kind:"dir",path:a.path})),i.appendChild(o)}const r=e.key;for(const a of e.rows)i.appendChild(this.card_build(r,a.entry,s));t.appendChild(i)}frameTop_track(){const e=this.container.parentElement,t=this.container.querySelector(".roster-order"),s=this.container.querySelector(".files-path");if(this.frameTopObserver?.disconnect(),this.frameTopObserver=null,e===null)return;if(t===null||s===null){e.style.removeProperty("--mode-frame-top"),e.style.removeProperty("--roster-frame-h");return}const i=()=>{const r=e.getBoundingClientRect().top,a=Math.ceil(t.getBoundingClientRect().bottom-r);e.style.setProperty("--roster-frame-h",`${a}px`),e.style.setProperty("--mode-frame-top",`${Math.ceil(s.getBoundingClientRect().bottom-r)}px`)};i(),this.frameTopObserver=new ResizeObserver(i),this.frameTopObserver.observe(t),this.frameTopObserver.observe(s)}follow_set(e){this.following=e,this.listing.state_refresh()}follow_get(){return this.following}view_set(e){this.viewMode=e,this.viewPill!==null&&(this.viewPill.textContent=e.toUpperCase()),this.modeSpan!==null&&(this.modeSpan.textContent=e==="list"?"":e.toUpperCase()),this.lastListings.length>0&&!this.contentShown&&this.listings_render(this.lastListings)}view_get(){return this.viewMode}body_get(){return this.container.closest(".files-body")}diagram_declare(e){this.body_get()?.classList.toggle("diagram-shown",e),e||this.mode_annunciate(this.viewMode==="list"?"":this.viewMode.toUpperCase())}mode_annunciate(e){this.modeSpan!==null&&(this.modeSpan.textContent=e)}stateLine_compose(e){const t=[];return this.following&&t.push("CWD"),e.selecting&&t.push("SELECT"),t.push(this.stale?"STALE":e.filter),e.selected>0&&t.push(e.shown===e.selected?`${e.selected} SELECTED`:`${e.selected} SELECTED · ${e.shown} SHOWN`),t.filter(s=>s!=="").join(" · ")}card_build(e,t,s=!1){const i=document.createElement("article");i.className=`files-card files-type-${t.type}`,s&&i.appendChild(this.thumb_build(Io(e,t.name),t));const r=document.createElement("div");r.className="files-card-head";const a=document.createElement("span");a.className="files-card-badge",a.textContent=t.type.toUpperCase();const o=document.createElement("span");o.className="files-card-size",o.textContent=t.type==="dir"||t.size===0?"":wp(t.size),r.append(a,o);const l=document.createElement("div");l.className="files-card-title",l.textContent=t.name;const c=document.createElement("div");c.className="files-card-meta";const d=document.createElement("span");d.textContent=t.owner;const u=document.createElement("span");if(u.textContent=t.date.slice(0,10),c.append(d,u),i.append(r,l,c),t.type==="link"&&t.target!==void 0){const p=document.createElement("div");p.className="files-card-target",p.textContent=`→ ${t.target}`,p.title=t.target,i.appendChild(p)}const h=Io(e,t.name),g=Do(t);return g!==null&&(i.classList.add("files-activatable"),i.addEventListener("click",()=>this.activate({kind:g,path:h}))),i}thumb_build(e,t){const s=document.createElement("div");s.className="files-card-thumb";const i=()=>{s.textContent=Ao[t.type]};if(Vg.test(t.name)||Yo.test(t.name)){s.classList.add("thumb-series");const u=document.createElement("span");u.className="thumb-series-mark",u.textContent="DCM";const h=/^\d+-(.*)-[0-9a-f]{7}$/.exec(t.name)?.[1];if(s.replaceChildren(u),h!==void 0){const g=document.createElement("span");g.className="thumb-series-text",g.textContent=h.replace(/_/g," "),s.appendChild(g)}return s}if(this.preview===null||!(t.type==="file"||t.type==="plugin"||t.type==="pipeline"))return i(),s;if(t.type==="plugin")return s.replaceChildren(bp([{id:e,parentIds:[]}])),s;if(t.type==="pipeline"){const u=this.preview;s.classList.add("thumb-wait"),s.textContent=Ao[t.type];const h=()=>{u.pipelineGlimpse(e).then(g=>{if(s.classList.remove("thumb-wait"),g===null||g.length===0){i();return}if(g.length>rE){s.textContent=`${g.length} NODES`,s.classList.add("thumb-count");return}s.replaceChildren(bp(g))}).catch(()=>{s.classList.remove("thumb-wait"),i()})};return this.thumbObserver_get().observe(s),s.addEventListener("files:thumb-seen",h,{once:!0}),s}const r=this.headCache.get(e);if(r!==void 0){const u=document.createElement("pre");return u.textContent=r,s.appendChild(u),s}const a=Ko(e)&&t.size<=sE,o=Hg(e),l=(o===""||QA.has(o))&&t.size<=eE;if(!a&&!l)return i(),s;s.classList.add("thumb-wait"),s.textContent=Ao.file;const c=this.preview,d=()=>{if(a){const u=document.createElement("img");u.alt=t.name,u.addEventListener("load",()=>{s.classList.remove("thumb-wait")}),u.addEventListener("error",()=>{s.classList.remove("thumb-wait"),i()}),u.src=c.imageUrl(e),s.replaceChildren(u);return}c.textHead(e,tE).then(u=>{if(this.headCache.size>=nE&&this.headCache.clear(),this.headCache.set(e,u),s.classList.remove("thumb-wait"),u.trim()===""||iE(u)){i();return}const h=document.createElement("pre");h.textContent=u,s.replaceChildren(h)}).catch(()=>{s.classList.remove("thumb-wait"),i()})};return this.thumbObserver_get().observe(s),s.addEventListener("files:thumb-seen",d,{once:!0}),s}thumbObserver_get(){return this.thumbObserver===null&&(this.thumbObserver=new IntersectionObserver(e=>{for(const t of e)t.isIntersecting&&(this.thumbObserver?.unobserve(t.target),t.target.dispatchEvent(new CustomEvent("files:thumb-seen")))},{root:this.container,rootMargin:"25%"})),this.thumbObserver}filter_toggle(e){this.listing.filter_toggle(e)}}function _p(n){if(!Array.isArray(n))return null;for(const e of n){if(typeof e!="object"||e===null)return null;const t=e;if(typeof t.path!="string"||!Array.isArray(t.items))return null}return n}function Io(n,e){return n.endsWith("/")?`${n}${e}`:`${n}/${e}`}function aE(n){const e=n.endsWith("/")?n.slice(0,-1):n,t=e.lastIndexOf("/");return t<=0?"/":e.slice(0,t)}function wp(n){if(n<1024)return String(n);const e=["K","M","G","T"];let t=n,s=-1;for(;t>=1024&&s<e.length-1;)t=t/1024,s=s+1;return`${t<10?t.toFixed(1):Math.round(t)}${e[s]}`}const qg={listing:"files.row",rules:[{name:"image",label:()=>"IMAGE",offered:n=>n.kind==="seriesFolder"},{name:"gather",label:()=>"GATHER",offered:n=>n.kind!=="catalogue"&&n.projection!==!0},{name:"process",label:()=>"PROCESS",offered:n=>(n.kind==="directory"||n.kind==="seriesFolder")&&(n.feed===null||(n.node??null)!==null)},{name:"run",label:()=>"RUN",offered:n=>n.kind==="catalogue"&&n.bound===!0},{name:"download",label:()=>"DOWNLOAD",offered:n=>n.kind==="file"},{name:"move",label:()=>"MOVE",offered:n=>n.kind!=="catalogue"&&n.projection!==!0},{name:"copy",label:()=>"COPY",offered:n=>n.kind!=="catalogue"&&n.projection!==!0},{name:"delete",label:()=>"DELETE",offered:n=>n.kind!=="catalogue"&&n.projection!==!0},{name:"share",label:n=>`SHARE FEED ${n.feed??""}`,offered:n=>n.kind!=="catalogue"&&n.feed!==null&&n.projection!==!0}],states:[{name:"a plain file outside a feed",facts:{kind:"file",feed:null}},{name:"a file inside a feed",facts:{kind:"file",feed:12}},{name:"a directory",facts:{kind:"directory",feed:null}},{name:"a directory inside a feed that is not a node",facts:{kind:"directory",feed:12,node:null}},{name:"a node's data inside a feed",facts:{kind:"directory",feed:12,node:456}},{name:"a DICOM series folder",facts:{kind:"seriesFolder",feed:null}},{name:"a catalogue entry",facts:{kind:"catalogue",feed:null}},{name:"a catalogue entry in a bound catalogue",facts:{kind:"catalogue",feed:null,bound:!0}},{name:"a node's data seen through /proc",facts:{kind:"directory",feed:12,node:456,projection:!0}},{name:"a file seen through /proc",facts:{kind:"file",feed:12,projection:!0}}]},Xg={listing:"files.selection",rules:[{name:"delete",label:n=>`DELETE ${n.count}`,offered:()=>!0},{name:"move",label:n=>`MOVE ${n.count}`,offered:()=>!0},{name:"copy",label:n=>`COPY ${n.count}`,offered:()=>!0},{name:"share",label:n=>n.feeds.length===1?`SHARE FEED ${n.feeds[0]}`:`SHARE ${n.feeds.length} FEEDS`,offered:n=>n.feeds.length>0}],states:[{name:"a selection outside any feed",facts:{count:3,feeds:[]}},{name:"a selection in one feed",facts:{count:2,feeds:[12]}},{name:"a selection spanning feeds",facts:{count:5,feeds:[12,13]}}]},Yg={listing:"runs.row",rules:[{name:"share",label:()=>"SHARE",offered:()=>!0},{name:"delete",label:()=>"DELETE",offered:()=>!0}],states:[{name:"any feed",facts:{feedId:12}}]},Ra={listing:"pacs.study",rules:[{name:"pullStudy",label:()=>"PULL STUDY",offered:n=>n.addressable},{name:"gather",label:()=>"GATHER",offered:n=>n.addressable},{name:"process",label:()=>"PROCESS",offered:n=>n.allInCube}],states:[{name:"a study with a path",facts:{addressable:!0,allInCube:!1}},{name:"a study with none",facts:{addressable:!1,allInCube:!1}},{name:"a study wholly home",facts:{addressable:!0,allInCube:!0,anyInCube:!0}},{name:"a study partly home",facts:{addressable:!0,allInCube:!1,anyInCube:!0}}]},Ui={listing:"pacs.series",rules:[{name:"gather",label:()=>"GATHER",offered:n=>n.addressable||n.inCube},{name:"image",label:()=>"IMAGE",offered:n=>n.inCube&&n.folderKnown},{name:"dir",label:()=>"DIR",offered:n=>n.inCube&&n.folderKnown},{name:"process",label:()=>"PROCESS",offered:n=>n.inCube&&n.folderKnown},{name:"pull",label:()=>"PULL",offered:n=>!n.inCube}],states:[{name:"not yet retrieved",facts:{inCube:!1,folderKnown:!1,addressable:!0}},{name:"not retrieved and unaddressable",facts:{inCube:!1,folderKnown:!1,addressable:!1}},{name:"home, folder not yet named",facts:{inCube:!0,folderKnown:!1,addressable:!0}},{name:"home, folder named",facts:{inCube:!0,folderKnown:!0,addressable:!0}}]},Kg={listing:"gather.series",rules:[{name:"remove",label:()=>"REMOVE",offered:()=>!0},{name:"pull",label:()=>"PULL",offered:n=>n.pullable===!0},{name:"image",label:()=>"IMAGE",offered:n=>n.folderKnown&&n.imagery!==!1},{name:"process",label:()=>"PROCESS",offered:()=>!0}],states:[{name:"folder named",facts:{folderKnown:!0}},{name:"a place that is not imagery",facts:{folderKnown:!0,imagery:!1}},{name:"folder not yet named",facts:{folderKnown:!1}},{name:"not retrieved yet",facts:{folderKnown:!1,pullable:!0}}]},Zg={listing:"gather.cohort",rules:[{name:"save",label:()=>"SAVE",offered:n=>n.count>0},{name:"export",label:()=>"EXPORT CSV",offered:n=>n.count>0},{name:"feed",label:()=>"CREATE FEED",offered:n=>n.count>0&&n.feed===null},{name:"process",label:()=>"PROCESS",offered:n=>n.count>0},{name:"dismiss",label:()=>"DISMISS",offered:()=>!0}],states:[{name:"holding series",facts:{count:2,feed:null}},{name:"holding series, rooted in a feed",facts:{count:2,feed:4501}},{name:"emptied",facts:{count:0,feed:null}}]};function Ci(n){return{listing:n.listing,visit(e){return e(n)}}}Ci(qg),Ci(Xg),Ci(Yg),Ci(Ra),Ci(Ui),Ci(Zg),Ci(Kg);function vn(n,e){const t=n.rules.find(s=>s.name===e);if(t===void 0)throw new Error(`${n.listing} declares no verb '${e}'`);return t}function oE(n){return{inCube:n.pulled===!0,folderKnown:n.folderPath!==void 0,addressable:n.vfsPath!==void 0}}function yp(n){if(n.series.length===0)return null;const e=[];for(const s of n.series){if(s.pulled!==!0||s.folderPath===void 0)return null;e.push(s.folderPath.replace(/\/[^/]+\/?$/,""))}const t=e[0]??"";return e.every(s=>s===t)&&t!==""?t:null}function kn(n){const e=oE(n),t=s=>vn(Ui,s).offered(e);return{gather:t("gather"),image:t("image"),dir:t("dir"),pull:t("pull")}}function lE(n,e,t,s){let i=!1;for(const r of n.studies)for(const a of r.series)a.seriesUID===e&&(s!==void 0&&a.folderPath!==s&&(a.folderPath=s,i=!0),a.pulled!==!0&&(a.pulled=!0,t!==void 0&&t>0&&(a.pulledFiles=t),i=!0));return i}const vp=[{id:"pacs-f-name",term:"PatientName"},{id:"pacs-f-mrn",term:"PatientID"},{id:"pacs-f-date",term:"StudyDate"},{id:"pacs-f-accession",term:"AccessionNumber"},{id:"pacs-f-modality",term:"Modality"}],To={running:"RETRIEVING",done:"✓ PULLED",error:"✗ ERROR",unconfirmed:"? UNCONFIRMED",stalled:"STALLED",queued:"QUEUED",idle:"NOT RETRIEVED"},cE="--fresh",Op="--anon",dE=/\s*--anon\b/,uE=["pacs-f-name","pacs-f-mrn","pacs-f-accession","pacs-f-date"],xp=/\s*--fresh\b/;function Sp(n){const e=Date.parse(n);if(Number.isNaN(e))return null;const t=Math.max(0,Math.round((Date.now()-e)/1e3)),s=[{limit:60,size:1,name:"SECOND"},{limit:3600,size:60,name:"MINUTE"},{limit:86400,size:3600,name:"HOUR"},{limit:2592e3,size:86400,name:"DAY"},{limit:31536e3,size:2592e3,name:"MONTH"},{limit:1/0,size:31536e3,name:"YEAR"}];for(const i of s){if(t>=i.limit)continue;const r=Math.max(1,Math.floor(t/i.size));return`${r} ${i.name}${r===1?"":"S"} AGO`}return null}const zl=new Map;function Qg(n,e){const t=zl.get(n)??new Set;t.add(e),zl.set(n,t)}function hE(n,e){const t=zl.get(n);if(t!==void 0){for(const s of[...t]){if(!s.isConnected){t.delete(s);continue}e(s)}t.size===0&&zl.delete(n)}}function fE(n){const e=document.createElement("span");if(e.className="pacs-badge",n.pulled===!0){const i=document.createElement("span");i.className="pacs-bar-full";const r=document.createElement("span");return r.className="pacs-badge-note",r.textContent=n.pulledFiles!==void 0?`✓ ${n.pulledFiles} IN CUBE`:"✓ IN CUBE",e.append(i,r),e.dataset.state="done",e}const t=document.createElement("span");t.className="pacs-bar";const s=document.createElement("span");return s.className="pacs-badge-note",s.textContent="NOT RETRIEVED",e.append(t,s),e.dataset.state="idle",Qg(n.seriesUID,e),e}function Jg(n,e){return[{key:"series",label:"SERIES",className:"pacs-series-desc",width:"35.5em",cell:t=>n(t).description},{key:"state",label:"STATE",className:"pacs-badge",width:"1fr",cell:t=>e(n(t)),compare:t=>n(t).pulled===!0?"done":"idle"},{key:"modality",label:"MODALITY",className:"pacs-series-modality",width:"4em",cell:t=>n(t).modality},{key:"files",label:"FILES",className:"pacs-series-files",width:"6em",cell:t=>{const s=n(t).fileCount;return s!==void 0?`${s} FILES`:""},compare:t=>n(t).fileCount??-1}]}class pE{root;command;results;handlers;litFolders=new Map;badgeStates=new Map;seriesProgress=new Map;studyTracks=new Map;traits;actions;studyTraits;studyActions;patientTraits;listing;patientTracks=new Map;provenance;run;model=null;anon=!1;revealed=!1;anonPill;revealPill;replayed=!1;serverCell;serverStrip;servers=[];chosen=new Set;constructor(e,t){this.root=e,this.handlers=t,this.command=Go(e,"#pacs-command"),this.results=mn(e,"#pacs-results"),this.traits=this.traits_declare(),this.actions=this.actions_declare(),this.studyTraits=this.studyTraits_declare(),this.studyActions=this.studyActions_declare(),this.patientTraits=this.patientTraits_declare(),this.listing=new Qr({mount:this.results,traits:this.patientTraits,key:s=>s.key,chrome:{root:e,prefix:"pacs"},activatable:s=>s.studies.length>0,address:s=>s.studies.length>0?S0(s.patient):void 0,control:"fold",row:{className:()=>"pacs-patient-row",groupClassName:s=>s.patient.status==="unasked"?"pacs-patient pacs-patient-unasked":"pacs-patient",decorate:(s,i)=>{i.studies.length>0&&(s.title="unfold this patient's studies (the patient keeps its place)")}},child:kr(s=>s.studies.map((i,r)=>({study:i,key:Ap(i,r)})),{traits:this.studyTraits,key:s=>s.key,address:s=>s.study.vfsPath,control:"fold",actions:{of:()=>this.studyActions},row:{className:()=>"pacs-study-row",groupClassName:()=>"pacs-study",decorate:s=>{s.title="unfold this study's series (the study keeps its place)"}},child:kr(s=>s.study.series.map(i=>({study:s.study,studyKey:s.key,series:i})),{traits:this.traits,key:s=>s.series.seriesUID,address:s=>s.series.vfsPath,actions:{of:()=>this.actions},row:{className:()=>"pacs-series",decorate:(s,i)=>{s.dataset.seriesuid=i.series.seriesUID}}})}),state:s=>this.stateLine_compose(s),empty:()=>Dp("NO STUDIES FOUND")}),e.style.setProperty("--roster-cols",this.listing.template_get(1)),this.listing.rows_set([],{field:"pacs"});for(const{id:s}of vp){const i=Go(e,`#${s}`);i.addEventListener("input",()=>this.command_regenerate()),i.addEventListener("keydown",r=>{r.key==="Enter"&&(r.preventDefault(),this.query_run())})}this.serverCell=mn(e,"#pacs-f-server"),this.serverStrip=mn(e,"#pacs-server-strip"),this.serverCell.addEventListener("click",()=>this.serverStrip_toggle()),this.serverCell_sync(),this.provenance=mn(e,"#pacs-provenance"),this.anonPill=mn(e,"#pacs-anon"),this.revealPill=mn(e,"#pacs-reveal"),this.anonPill.addEventListener("click",()=>this.anon_set(!this.anon)),this.revealPill.addEventListener("click",()=>this.reveal_set(!this.revealed)),this.run=mn(e,"#pacs-run"),this.run.addEventListener("click",()=>this.query_run(this.replayed)),this.command.addEventListener("keydown",s=>{s.key==="Enter"&&this.query_run()}),mn(e,"#pacs-export").addEventListener("click",()=>this.answer_export()),mn(e,"#pacs-gather-shown").addEventListener("click",()=>this.shown_gather()),mn(e,"#pacs-pull-shown").addEventListener("click",()=>this.shown_pull())}patientTraits_declare(){return[{key:"fold",label:"",className:"pacs-fold",capped:!1,width:"5.2em",cell:e=>{const t=document.createElement("span");return t.className=e.studies.length===0?"pacs-fold pacs-fold-none":"pacs-fold",t}},{key:"patient",label:"PATIENT",className:"pacs-patient-name",width:"13em",cell:e=>e.patient.patientName||"(unknown)"},{key:"mrn",label:"MRN",className:"pacs-patient-mrn",width:"7.5em",cell:e=>e.patient.patientId||"—"},{key:"answered",label:"ANSWERED",className:"pacs-patient-answered",width:"12em",cell:e=>{const t=document.createElement("span");if(t.className=e.patient.status==="unasked"?"pacs-patient-answered pacs-unasked":"pacs-patient-answered",e.patient.status==="unasked")return t.textContent="UNASKED",e.patient.error!==void 0&&(t.title=e.patient.error),t;const s=e.patient.provenance?.answeredAt;return t.textContent=s===void 0?"—":Sp(s)??"—",s!==void 0&&(t.title=s),t},compare:e=>{const t=e.patient.provenance?.answeredAt;if(t===void 0)return Number.MAX_SAFE_INTEGER;const s=Date.parse(t);return Number.isNaN(s)?Number.MAX_SAFE_INTEGER:s}},{key:"progress",label:"PROGRESS",className:"pacs-patient-progress",width:"1fr",cell:e=>{const t=document.createElement("span");return t.className="pacs-patient-progress",this.patientTracks.set(e.key,{mount:t,uids:e.studies.flatMap(s=>s.series.map(i=>i.seriesUID))}),this.patientTrack_paint(e.key),t},compare:e=>{const t=this.patientProgress_of(e);return t.total===0?-1:t.done/t.total}},{key:"studies",label:"STUDIES",className:"pacs-patient-count",width:"6em",cell:e=>e.patient.status==="unasked"?"—":String(e.patient.studyCount),compare:e=>e.patient.status==="unasked"?-1:e.patient.studyCount},{key:"series",label:"SERIES",className:"pacs-patient-count",width:"5em",cell:e=>e.patient.status==="unasked"?"—":String(e.patient.seriesCount),compare:e=>e.patient.status==="unasked"?-1:e.patient.seriesCount},{key:"server",label:"SERVER",className:"pacs-patient-server",width:"9em",cell:e=>e.patient.server??this.model?.pacsName??"—"}]}patientProgress_of(e){return So(e.studies.flatMap(t=>t.series.map(s=>this.seriesProgress.get(s.seriesUID)??{done:0,total:0})))}patientTrack_paint(e){const t=this.patientTracks.get(e);if(t===void 0)return;const s=t.uids.map(i=>this.seriesProgress.get(i)??{done:0,total:0});t.mount.replaceChildren(Vo(So(s)))}patientRows_build(e){const t=(r,a)=>e.studies.filter(o=>o.patientId===r&&(a===void 0||o.server===void 0||o.server===a));if(e.patients!==void 0&&e.patients.length>0)return e.patients.map((r,a)=>({patient:r,key:`${r.patientId}::${r.server??""}::${a}`,studies:t(r.patientId,r.server)}));const s=[],i=new Map;for(const r of e.studies){const a=r.patientId;i.has(a)||(i.set(a,[]),s.push(a)),i.get(a).push(r)}return s.map((r,a)=>{const o=i.get(r)??[];return{key:`${r}::${a}`,studies:o,patient:{patientId:r,...o[0]?.patientName?{patientName:o[0].patientName}:{},status:"found",studyCount:o.length,seriesCount:o.reduce((l,c)=>l+c.series.length,0),...e.provenance===void 0?{}:{provenance:e.provenance}}}})}studyTraits_declare(){return[{key:"fold",label:"",className:"pacs-fold",capped:!1,width:"5.2em",cell:()=>{const e=document.createElement("span");return e.className="pacs-fold",e}},{key:"patient",label:"PATIENT",className:"pacs-study-patient",width:"13em",cell:e=>e.study.patientName||"(unknown)"},{key:"mrn",label:"MRN",className:"pacs-study-mrn",width:"7.5em",cell:e=>e.study.patientId||"—"},{key:"study",label:"STUDY",className:"pacs-study-desc",width:"12em",cell:e=>e.study.description||"(no description)"},{key:"progress",label:"PROGRESS",className:"pacs-study-progress",width:"1fr",cell:e=>{const t=document.createElement("span");return t.className="pacs-study-progress",this.studyTracks.set(e.key,{mount:t,uids:e.study.series.map(s=>s.seriesUID)}),this.studyTrack_paint(e.key),t},compare:e=>{const t=this.studyProgress_of(e);return t.total===0?-1:t.done/t.total}},{key:"date",label:"DATE",className:"pacs-study-date",width:"7.5em",cell:e=>e.study.date},{key:"accession",label:"ACCESSION",className:"pacs-study-accession",width:"9em",cell:e=>e.study.accession||"—"},{key:"modality",label:"MODALITY",className:"pacs-study-modalities",width:"6.5em",cell:e=>e.study.modalities},{key:"server",label:"SERVER",className:"pacs-study-server",width:"9em",cell:e=>e.study.server??this.model?.pacsName??"—"},{key:"series",label:"SERIES",className:"pacs-study-count",width:"6.5em",cell:e=>String(e.study.series.length),compare:e=>e.study.series.length}]}studyActions_declare(){return[{label:vn(Ra,"pullStudy").label({addressable:!0,allInCube:!1}),offered:e=>vn(Ra,"pullStudy").offered({addressable:e.study.vfsPath!==void 0,allInCube:!1}),run:e=>{const t=e.study.vfsPath;if(t!==void 0){this.handlers.command_run(`pull ${t}`);for(const s of e.study.series)s.vfsPath!==void 0&&s.pulled!==!0&&this.badgeState_set(s.seriesUID,{status:"queued"})}}},{label:vn(Ra,"gather").label({addressable:!0,allInCube:!1,anyInCube:!0}),offered:e=>e.study.series.some(t=>kn(t).gather),run:e=>{const t=e.study.series.filter(i=>kn(i).gather);for(const i of t)this.gather_note(e.study,i);const s=e.study.series.length-t.length;this.handlers.note(`gather: ${t.length} series gathered${s>0?`, ${s} not in CUBE (pull them first)`:""}`)}},{label:vn(Ra,"process").label({addressable:!0,allInCube:!0}),offered:e=>yp(e.study)!==null,run:e=>{const t=yp(e.study);t!==null&&this.handlers.process_open(t)}}]}studyProgress_of(e){return So(e.study.series.map(t=>this.seriesProgress.get(t.seriesUID)??{done:0,total:0}))}traits_declare(){return Jg(e=>e.series,e=>this.badge_build(e))}actions_declare(){return[{label:vn(Ui,"gather").label({inCube:!0,folderKnown:!0,addressable:!0}),offered:e=>kn(e.series).gather,selected:e=>this.handlers.gathered_is(e.series.seriesUID),run:e=>this.gather_note(e.study,e.series)},{label:vn(Ui,"image").label({inCube:!0,folderKnown:!0,addressable:!0}),offered:e=>kn(e.series).image,selected:e=>e.series.folderPath!==void 0&&(this.litFolders.get(Ep(e.series.folderPath))?.viewer??!1),run:e=>{e.series.folderPath!==void 0&&this.handlers.image_open(e.series.folderPath)}},{label:vn(Ui,"dir").label({inCube:!0,folderKnown:!0,addressable:!0}),offered:e=>kn(e.series).dir,selected:e=>e.series.folderPath!==void 0&&(this.litFolders.get(Ep(e.series.folderPath))?.browser??!1),run:e=>{e.series.folderPath!==void 0&&this.handlers.dir_open(e.series.folderPath)}},{label:vn(Ui,"process").label({inCube:!0,folderKnown:!0,addressable:!0}),offered:e=>kn(e.series).image,run:e=>{e.series.folderPath!==void 0&&this.handlers.process_open(e.series.folderPath)}},{label:vn(Ui,"pull").label({inCube:!1,folderKnown:!1,addressable:!0}),offered:e=>kn(e.series).pull,disabled:e=>e.series.vfsPath===void 0,run:e=>{const t=e.series.vfsPath;t!==void 0&&(this.handlers.command_run(`pull ${t}`),this.badgeState_set(e.series.seriesUID,{status:"queued"}))}}]}state_name(e){return e.pulled===!0?"pulled":this.badgeStates.get(e.seriesUID)?.status??"idle"}command_regenerate(){const e=[];for(const{id:i,term:r}of vp){const a=Go(this.root,`#${i}`).value.trim();a.length>0&&e.push(`${r}:${a}`)}const t=this.chosen.size>1?` --pacsserver ${[...this.chosen].join(",")}`:"",s=this.anon?` ${Op}`:"";this.command.value=e.length>0||t!==""?`pacs query ${e.join(",")}${t}${s}`:""}anon_set(e){e!==this.anon&&(this.anon=e,this.revealed=!1,this.anonPill.textContent=e?"ANON ON":"ANON OFF",this.anonPill.classList.toggle("pacs-capsule-off",!e),this.revealPill.hidden=!e,this.model=null,this.listing.rows_set([],{field:"pending"}),this.provenance_show(void 0),this.command.value=e?`${this.command.value.trim()} ${Op}`.trim():this.command.value.replace(dE,"").trimEnd(),this.masking_apply())}reveal_set(e){this.revealed=e,this.revealPill.textContent=e?"HIDE":"REVEAL",this.revealPill.classList.toggle("pacs-capsule-off",!e),this.masking_apply()}masking_apply(){const e=this.anon&&!this.revealed;for(const t of uE)Go(this.root,`#${t}`).type=e?"password":"text";this.command.type=e?"password":"text"}serverStrip_toggle(e){const t=e??this.serverStrip.hidden;this.serverStrip.hidden=!t,this.serverCell.classList.toggle("pacs-server-open",t),t&&this.servers.length===0&&this.servers_ask(),t&&this.serverStrip_paint()}query_get(){return this.model===null?null:`pacs query ${this.model.expression}`}serverStrip_isOpen(){return!this.serverStrip.hidden}serverStrip_close(){this.serverStrip_toggle(!1)}servers_ask(){this.handlers.command_run("pacs list")}servers_take(e){this.servers=e,this.serverStrip_paint(),this.serverCell_sync()}serverStrip_paint(){if(this.serverStrip.replaceChildren(),this.servers.length===0){this.serverStrip.appendChild(Dp("ASKING THE SESSION FOR REGISTERED SERVERS"));return}for(const e of this.servers){const t=document.createElement("button");t.className=this.chosen.has(e.identifier)?"pacs-server-segment pacs-server-chosen":"pacs-server-segment",t.dataset.server=e.identifier,t.textContent=e.identifier,e.active&&(t.title="the session is connected to this server"),t.addEventListener("click",()=>this.server_choose(e.identifier)),this.serverStrip.appendChild(t)}}server_choose(e){if(this.chosen.has(e)?this.chosen.delete(e):this.chosen.add(e),this.chosen.size===1){const t=[...this.chosen][0];this.handlers.command_show(`pacs connect ${t}`)}this.serverStrip_paint(),this.serverCell_sync(),this.command_regenerate()}serverCell_sync(){const e=[...this.chosen];if(e.length===0){const t=this.servers.find(s=>s.active);this.serverCell.textContent=t?.identifier??"—",this.serverCell.classList.remove("pacs-server-many");return}this.serverCell.textContent=e.length===1?e[0]:`${e[0]} +${e.length-1}`,this.serverCell.classList.toggle("pacs-server-many",e.length>1)}wrote_show(e){const t=this.root.querySelector("#pacs-wrote");t!==null&&(t.textContent=`WROTE ${e}`,t.title="open the folder this landed in",t.classList.add("pacs-wrote-opens"),t.onclick=()=>{const s=e.lastIndexOf("/");this.handlers.dir_open(s<=0?e:e.slice(0,s))},t.hidden=!1)}answer_export(){if(this.model===null)return;const e=this.command.value.trim(),t=e===""?`pacs query ${this.model.expression}`:e;this.handlers.command_show(`${t} --csv-to`)}query_run(e=!1){e&&!xp.test(this.command.value)&&(this.command.value=`${this.command.value.trim()} ${cE}`);const t=this.command.value.trim();t.length!==0&&(this.model=null,this.listing.rows_set([],{field:"pending"}),this.listing.field_get()?.appendChild(this.waiting_build()),this.handlers.command_run(t))}provenance_show(e){if(this.replayed=e?.replayed===!0,this.run.textContent=this.replayed?"RE-QUERY":"QUERY",this.run.classList.toggle("pacs-capsule-requery",this.replayed),this.provenance.hidden=!this.replayed,!this.replayed){this.provenance.textContent="",this.command.value=this.command.value.replace(xp,"").trimEnd();return}const t=e?.answeredAt??"",s=Sp(t),i=t.slice(0,10);this.provenance.textContent=s===null?`RESULTS ${i}`:`RESULTS ${i} · ${s}`,this.provenance.title=t}waiting_build(){const e=document.createElement("div");e.className="pacs-waiting";const t=document.createElement("span");t.className="pacs-bar pacs-bar-pacing";const s=document.createElement("span");s.className="pacs-bar-fill",t.appendChild(s);const i=document.createElement("span");return i.className="pacs-waiting-note",i.textContent="QUERYING THE PACS…",e.append(t,i),e}envelope_observe(e){const t=/✓ wrote (\S+)/.exec((e.rendered??"").replace(/\x1b\[[0-9;]*m/g,""));if(t!==null&&this.wrote_show(t[1]),e.model?.kind===O0){const i=v0.safeParse(e.model.data);i.success&&this.servers_take(i.data.servers);return}if(e.model?.kind!==x0)return;const s=w0.safeParse(e.model.data);s.success&&this.results_render(s.data)}progress_observe(e){if(e.operation!=="pull"||e.itemId===void 0)return;const t=e.status??"running",s={status:t};e.current!==void 0&&(s.current=e.current),e.total!==void 0&&(s.total=e.total),this.badgeState_set(e.itemId,s),t==="done"&&this.model!==null&&lE(this.model,e.itemId,e.current??e.total,e.path)&&this.results_repaint()}badgeState_set(e,t){this.badgeStates.set(e,t),this.seriesProgress.set(e,gE(t,this.seriesProgress.get(e))),hE(e,s=>this.badge_paint(s,t));for(const[s,i]of this.studyTracks)i.uids.includes(e)&&this.studyTrack_paint(s);for(const[s,i]of this.patientTracks)i.uids.includes(e)&&this.patientTrack_paint(s)}badge_build(e){const t=document.createElement("span");if(t.className="pacs-badge",e.pulled===!0){const s=document.createElement("span");s.className="pacs-bar-full";const i=document.createElement("span");return i.className="pacs-badge-note",i.textContent=e.pulledFiles!==void 0?`✓ ${e.pulledFiles} IN CUBE`:"✓ IN CUBE",t.append(s,i),t.dataset.state="done",t}return Qg(e.seriesUID,t),this.badge_paint(t,this.badgeStates.get(e.seriesUID)??{status:"idle"}),t}badge_paint(e,t){e.replaceChildren(),e.dataset.state=t.status;const s=document.createElement("span");if(s.className="pacs-badge-note",t.status==="idle"){s.textContent=To.idle,e.append(Vo({done:0,total:0}),s);return}if(t.status!=="running"&&t.status!=="queued"){e.textContent=To[t.status]??t.status.toUpperCase();return}const i=t.total!==void 0?` ${t.current??0}/${t.total}`:"",r=t.status==="queued"||t.total===void 0||t.total===0?null:Math.min(1,(t.current??0)/t.total),a=document.createElement("span");a.className=r===null?"pacs-bar pacs-bar-pacing":"pacs-bar";const o=document.createElement("span");o.className="pacs-bar-fill",r!==null&&(o.style.width=`${Math.round(r*100)}%`),a.appendChild(o),s.textContent=t.status==="queued"?To.queued:`${To.running}${i}`,e.append(a,s)}results_render(e){const t=this.model!==null&&this.model.queryId===e.queryId;if(this.model=e,this.provenance_show(e.provenance),!t){this.listing.open_clear(),this.badgeStates.clear();const s=this.patientRows_build(e),i=s.length===1?s[0]:void 0;i!==void 0&&i.studies.length>0&&this.listing.open_set(0,[i.key]),e.studies.length===1&&this.listing.open_set(1,[Ap(e.studies[0],0)])}for(const s of e.studies)for(const i of s.series)t&&this.badgeStates.has(i.seriesUID)||this.seriesProgress.set(i.seriesUID,mE(i));this.results_repaint()}results_repaint(){const e=this.model;if(this.studyTracks.clear(),this.patientTracks.clear(),e===null){this.listing.rows_set([],{field:"pacs"});return}this.listing.rows_set([{key:String(e.queryId),rows:this.patientRows_build(e)}],{field:String(e.queryId)})}studyTrack_paint(e){const t=this.studyTracks.get(e);if(t===void 0)return;const s=t.uids.map(i=>this.seriesProgress.get(i)??{done:0,total:0});t.mount.replaceChildren(Vo(So(s)))}stateLine_compose(e){queueMicrotask(()=>{this.shownGather_render(),this.shownPull_render()});const t=[],s=this.model?.patients??[];if(s.length>0){const i=r=>s.filter(a=>a.status===r).length;t.push(`FOUND ${i("found")} · NONE ${i("none")} · UNASKED ${i("unasked")}`)}return e.filter!==""&&t.push(e.filter),t.join(" · ")}filter_toggle(e){this.listing.filter_toggle(e)}shown_candidates(){const e=[];if(!this.filtering()){for(const t of this.model?.studies??[])for(const s of t.series)e.push({study:t,series:s});return e}for(const t of this.root.querySelectorAll("#pacs-results .pacs-series")){const s=t.dataset.seriesuid;if(s!==void 0)for(const i of this.model?.studies??[]){const r=i.series.find(a=>a.seriesUID===s);r!==void 0&&e.push({study:i,series:r})}}return e}filtering(){return this.listing.filterText_get()!==""}shown_gatherable(){return this.shown_candidates().filter(({series:e})=>kn(e).gather&&!this.handlers.gathered_is(e.seriesUID))}shownGather_render(){const e=this.root.querySelector("#pacs-gather-shown");if(e===null)return;const t=this.shown_gatherable().length;e.hidden=t===0,e.textContent=this.filtering()?`GATHER ${t} SHOWN`:`GATHER ${t}`}shown_pullable(){return this.shown_candidates().map(({series:e})=>e).filter(e=>kn(e).pull&&e.vfsPath!==void 0)}shownPull_render(){const e=this.root.querySelector("#pacs-pull-shown");if(e===null)return;const t=this.shown_pullable().length;e.hidden=t===0,e.textContent=this.filtering()?`PULL ${t} SHOWN`:`PULL ${t}`}shown_pull(){const e=this.shown_pullable();if(e.length===0)return;const t=e.map(s=>`"${s.vfsPath}"`).join(" ");this.handlers.command_show(`pull ${t}`);for(const s of e)this.badgeState_set(s.seriesUID,{status:"queued"});this.handlers.note(`pull: ${e.length} series asked for`),this.shownPull_render()}shown_gather(){const e=this.shown_gatherable();if(e.length!==0){for(const{study:t,series:s}of e)this.gather_note(t,s);this.handlers.note(this.filtering()?`gather: ${e.length} series gathered from what the filter left showing`:`gather: ${e.length} series gathered from the whole answer`),this.shownGather_render()}}gather_note(e,t){t.vfsPath!==void 0&&(this.handlers.gather_add({seriesUID:t.seriesUID,description:t.description,modality:t.modality,series:t,patient:e.patientId||e.patientName,...e.description===void 0||e.description===""?{}:{study:e.description},vfsPath:t.vfsPath,...t.folderPath!==void 0?{folderPath:t.folderPath}:{},...t.fileCount!==void 0?{files:t.fileCount}:{}}),this.selected_refresh())}stage_lit(e){this.litFolders=e,this.selected_refresh()}selected_refresh(){this.listing.indication_refresh()}}function Ap(n,e){return n.studyUID??`study-${e}`}function Ep(n){return n.replace(/\/$/,"")}function mE(n){const e=n.pulledFiles??0,t=Math.max(n.fileCount??0,e);return n.pulled===!0?{done:t,total:t}:{done:e,total:t}}function gE(n,e){const t=n.total??e?.total??0;return n.status==="error"?{done:n.current??e?.done??0,total:t,failed:!0}:n.status==="done"?{done:t,total:t}:{done:n.current??e?.done??0,total:t}}function mn(n,e){const t=n.querySelector(e);if(t===null)throw new Error(`PACS workspace is missing '${e}'`);return t}function Go(n,e){const t=mn(n,e);if(!(t instanceof HTMLInputElement))throw new Error(`'${e}' is not an input`);return t}function Dp(n){const e=document.createElement("p");return e.className="files-empty",e.textContent=n,e}function Ip(n){return(n.kind??"series")==="series"?void 0:n.vfsPath}const Nc="cohort";function ME(n){return/[",\n\r]/.test(n)?`"${n.split('"').join('""')}"`:n}function bE(n){const e=document.createElement("p");return e.className="files-empty",e.textContent=n,e}class Tp{handlers;title;cohort;greeted=!1;listing;cohortActions;seriesActions;constructor(e,t,s,i){this.handlers=s,this.cohort=i,i.watch(()=>{this.unsaved=!0,this.render()}),this.title=e.querySelector(".gather-title"),this.cohortActions=this.cohortActions_declare(),this.seriesActions=this.seriesActions_declare(),this.listing=new Qr({mount:t,traits:this.cohortTraits_declare(),key:r=>r.key,chrome:{root:e,prefix:"gather"},control:"fold",actions:{of:()=>this.cohortActions},row:{className:()=>"gather-cohort-row",groupClassName:()=>"gather-cohort",decorate:r=>{r.title="the cohort: click for its verbs, the fold cell folds its series"}},child:kr(()=>[...this.cohort.members_get()].map(r=>({entry:r})),{traits:this.seriesTraits_declare(),key:r=>r.entry.seriesUID,address:r=>r.entry.vfsPath,actions:{of:()=>this.seriesActions},row:{className:()=>"gather-series",decorate:(r,a)=>{r.dataset.seriesuid=a.entry.seriesUID}}}),state:r=>this.stateLine_compose(r),empty:()=>bE("NOTHING GATHERED")}),this.pullBlock=e.querySelector(".gather-pull"),this.pullBlock?.addEventListener("click",()=>this.cohort_pull()),this.emptyBlock=e.querySelector(".gather-remove"),this.emptyBlock?.addEventListener("click",()=>{this.cohort_clear()}),this.processBlock=e.querySelector(".gather-process"),this.processBlock?.addEventListener("click",()=>{this.cohort_process()}),this.render()}pullBlock=null;emptyBlock=null;unsaved=!1;processBlock=null;cohort_empty(){this.cohort.size()!==0&&(this.cohort.clear(),this.handlers.changed(),this.render())}async cohort_clear(){if(this.cohort.size()!==0){if(this.unsaved){const e=await this.handlers.confirm_ask(`Save the cohort first? (${this.cohort.size()} ${this.cohort.size()===1?"member":"members"}, unsaved)`);if(e===null||e==="y"&&!await this.manifest_save())return}this.handlers.command_show("gather clear"),this.cohort_empty()}}away(){return[...this.cohort.members_get()].filter(e=>e.folderPath===void 0&&e.series?.pulled!==!0)}cohort_pull(){const e=this.away();if(e.length===0)return;const t=e.map(s=>`"${s.vfsPath}"`).join(" ");this.handlers.command_show(`pull ${t}`)}render_now(){this.render()}has(e){return this.cohort.has(e)}entries_get(){return[...this.cohort.members_get()]}name_get(){return this.cohort.name_get()}feed_get(){return this.cohort.feed_get()}feed_set(e){e!==null&&this.cohort.feed_set(e),this.render()}name_set(e){e!==null&&this.cohort.name_set(e),this.render()}series_add(e){this.cohort.take(e),this.render(),this.handlers.changed()}series_remove(e){this.cohort.drop(e)&&(this.render(),this.handlers.changed())}render(){if(this.title!==null&&(this.title.textContent=this.cohort.name_get()===null?"GATHER":`GATHER · ${this.cohort.name_get()??""}`.toUpperCase()),this.listing.rows_set([{key:"gather",rows:[{key:Nc}]}],{field:"gather"}),this.cohort.size()>0&&this.listing.open_set(0,[Nc]),this.pullBlock!==null){const e=this.away().length;this.pullBlock.hidden=e===0,this.pullBlock.textContent=`PULL ${e}`}this.emptyBlock!==null&&(this.emptyBlock.hidden=this.cohort.size()===0,this.emptyBlock.textContent=`CLEAR ${this.cohort.size()}`),this.processBlock!==null&&(this.processBlock.hidden=this.cohort.size()===0),this.greeted||(this.greeted=!0,this.listing.row_indicate(Nc))}cohortTraits_declare(){return[{key:"fold",label:"",className:"pacs-fold",capped:!1,width:"5.2em",cell:()=>{const e=document.createElement("span");return e.className="pacs-fold",e}},{key:"name",label:"COHORT",className:"gather-cohort-name",width:"1fr",cell:()=>this.cohort.name_get()??"(unnamed — SAVE names it)"},{key:"series",label:"SERIES",className:"gather-cohort-count",width:"6em",cell:()=>String(this.series_count()),compare:()=>this.series_count()},{key:"patients",label:"PATIENTS",className:"gather-cohort-patients",width:"7em",cell:()=>String(this.patients_count()),compare:()=>this.patients_count()},{key:"feed",label:"FEED",className:"gather-cohort-feed",width:"7em",cell:()=>{if(this.cohort.feed_get()===null)return"—";const e=document.createElement("button");e.className="gather-feed listing-capsule listing-action-selected",e.textContent=`FEED ${this.cohort.feed_get()?.feedId??0}`,e.title="open the feed's graph beside the cohort";const t=this.cohort.feed_get()?.feedId??0;return e.addEventListener("click",s=>{s.stopPropagation(),this.handlers.feed_open(t)}),e},compare:()=>this.cohort.feed_get()?.feedId??-1}]}seriesTraits_declare(){const e=Jg(i=>i.entry.series??{seriesUID:i.entry.seriesUID,description:i.entry.description,modality:i.entry.modality,...i.entry.files===void 0?{}:{fileCount:i.entry.files},...i.entry.folderPath===void 0?{}:{pulled:!0,folderPath:i.entry.folderPath}},fE),t={key:"patient",label:"MRN",className:"gather-series-patient",width:"8em",cell:i=>i.entry.patient||"—"},s={key:"study",label:"STUDY",className:"gather-series-study",width:"14em",cell:i=>i.entry.study??"—"};return[...e.slice(0,1),s,t,...e.slice(1)]}cohortActions_declare(){const e=()=>({count:this.cohort.size(),feed:this.cohort.feed_get()?.feedId??null}),t={save:()=>{this.manifest_save()},export:()=>{this.cohort_export()},feed:()=>{this.feed_ensure()},process:()=>{this.cohort_process()},dismiss:()=>this.handlers.dismiss()};return Zg.rules.map(s=>({label:s.label(e()),offered:()=>s.offered(e()),run:()=>t[s.name]?.()}))}seriesActions_declare(){const e=s=>({folderKnown:(s.entry.kind??"series")!=="series"||s.entry.folderPath!==void 0,imagery:(s.entry.kind??"series")==="series"||s.entry.imagery===!0,pullable:(s.entry.kind??"series")==="series"&&s.entry.folderPath===void 0&&s.entry.series?.pulled!==!0&&s.entry.vfsPath!==""}),t={remove:s=>this.series_remove(s.entry.seriesUID),pull:s=>this.handlers.command_show(`pull "${s.entry.vfsPath}"`),image:s=>{const i=s.entry.folderPath??Ip(s.entry);i!==void 0&&this.handlers.image_open(i)},process:s=>{const i=s.entry.folderPath??Ip(s.entry);if(i!==void 0){this.handlers.process_open(i);return}this.handlers.note(`gather: ${s.entry.description||s.entry.seriesUID} is not in CUBE yet — PULL it first, then PROCESS it.`)}};return Kg.rules.map(s=>({label:s.label({folderKnown:!0,pullable:!0}),offered:i=>s.offered(e(i)),run:i=>t[s.name]?.(i)}))}patients_count(){return new Set(this.cohort.members_get().filter(e=>(e.kind??"series")==="series").map(e=>e.patient)).size}series_count(){return this.cohort.members_get().filter(e=>(e.kind??"series")==="series").length}stateLine_compose(e){const t=this.cohort.members_get(),s=t.filter(o=>(o.kind??"series")!=="series").length,i=t.length-s,r=[];(i>0||s===0)&&r.push(`${i} SERIES`),s>0&&r.push(`${s} ${s===1?"PLACE":"PLACES"}`),s===0&&r.push(`${this.patients_count()} PATIENTS`);const a=[r.join(" · ")];return e.filter!==""&&a.push(e.filter),a.join(" · ")}async name_ensure(){if(this.cohort.name_get()!==null)return this.cohort.name_get();const t=(await this.handlers.name_ask(`gather-${new Date().toISOString().slice(0,10)}`)??"").trim();return t===""?null:(this.cohort.name_set(t),this.render(),t)}async manifest_save(){if(this.cohort.size()===0)return!1;const e=await this.name_ensure();if(e===null)return!1;const t=JSON.stringify({name:e,gatheredAt:new Date().toISOString(),series:[...this.cohort.members_get()].map(s=>({seriesUID:s.seriesUID,description:s.description,modality:s.modality,patient:s.patient,vfsPath:s.vfsPath}))});return this.handlers.command_run("mkdir -p ~/gather"),this.handlers.command_show(`touch --withContents '${t}' ~/gather/${e}.json`),this.unsaved=!1,!0}async cohort_export(){if(this.cohort.size()===0)return;const e=await this.name_ensure();if(e===null)return;const t=[["patient","series","modality","seriesUID","path"].join(","),...[...this.cohort.members_get()].map(s=>[s.patient,s.description,s.modality,s.seriesUID,s.vfsPath].map(ME).join(","))];this.handlers.command_run("mkdir -p ~/gather"),this.handlers.command_show(`touch --withContents '${t.join(`
4228
4228
  `)}' ~/gather/${e}.csv`)}async feed_ensure(){const e=this.cohort.feed_get();if(e!==null)return e;if(this.cohort.size()===0)return null;const t=this.cohort.members_get().filter(a=>(a.kind??"series")!=="series");if(t.length>0)return this.handlers.note(`gather: this cohort holds ${t.length} ${t.length===1?"place":"places"} as well as series, and a feed is rooted by pulling its members — a place is already in ChRIS. PROCESS one place from its own row, or remove them to make a feed of the series. (Rooting a feed on the whole cohort, places included, is coming: CUBE takes the list.)`),null;const s=await this.name_ensure();if(s===null)return null;const i=[...this.cohort.members_get()].map(a=>a.vfsPath).join(" "),r=await this.handlers.feed_create(`pull --new-feed "${s}" ${i}`);return r!==null&&this.feed_set(r),r}async cohort_process(){const e=await this.feed_ensure();e!==null&&this.handlers.cohort_process({input:e.path,feed:e.feedId,node:e.rootInstanceId})}}class zE{members=new Map;title=null;landed=null;watchers=new Set;watch(e){return this.watchers.add(e),()=>{this.watchers.delete(e)}}changed(){for(const e of[...this.watchers])e()}members_get(){return[...this.members.values()]}size(){return this.members.size}has(e){return this.members.has(e)}take(e){const t=this.members.get(e.seriesUID);this.members.set(e.seriesUID,t===void 0?e:{...t,...e}),this.changed()}drop(e){const t=this.members.delete(e);return t&&this.changed(),t}clear(){this.members.size!==0&&(this.members.clear(),this.changed())}name_get(){return this.title}name_set(e){this.title=e,this.changed()}feed_get(){return this.landed}feed_set(e){this.landed=e,this.changed()}}class _E{grid;startHere;host;paintId=0;constructor(e,t){this.host=t,this.grid=e.querySelector(".launcher-grid"),this.startHere=e.querySelector(".launcher-start"),this.startHere.addEventListener("click",()=>{this.host.startHere_set(!this.host.startHere_get()),this.startHere_render()}),this.startHere_render()}render(){const e=++this.paintId;this.host.tiles().then(t=>{e!==this.paintId||!this.grid.isConnected||(this.grid.replaceChildren(...t.map((s,i)=>this.tile_build(s,i===0))),this.startHere_render())}).catch(()=>{e!==this.paintId||!this.grid.isConnected||this.grid.replaceChildren()})}numeral_press(e){const t=this.grid.querySelector(`[data-numeral="${e}"]`);return t===null?!1:(t.click(),!0)}startHere_render(){const e=this.host.startHere_get();this.startHere.textContent=e?"START HERE · ON":"START HERE · OFF",this.startHere.classList.toggle("pacs-capsule-off",!e)}tile_build(e,t){const s=document.createElement("button");s.className=`launcher-tile${t?" launcher-tile-wide":""}`,s.style.setProperty("--tile-hue",`var(${e.hue})`),s.dataset.numeral=e.numeral,s.title=e.verb,s.addEventListener("click",d=>{d.target instanceof Element&&d.target.closest(".launcher-row, .launcher-figure")!==null||e.enter()});const i=document.createElement("span");i.className="launcher-head";const r=document.createElement("span");r.className="launcher-name",r.textContent=e.name;const a=document.createElement("span");a.className="launcher-numeral",a.textContent=e.numeral,i.append(r);for(const d of e.figures){const u=document.createElement(d.open===void 0?"span":"button");if(u.className=`launcher-figure${d.errored===!0?" launcher-figure-errored":""}`,u.textContent=d.text,d.open!==void 0){const h=d.open;u.addEventListener("click",g=>{g.stopPropagation(),h()})}i.appendChild(u)}i.appendChild(a);const o=document.createElement("span");o.className="launcher-rule";const l=document.createElement("span");l.className="launcher-rows";for(const d of e.rows){const u=document.createElement(d.open===void 0?"span":"button");u.className=`launcher-row${d.arrived===!0?" launcher-row-arrived":""}`;const h=document.createElement("span");h.className=`launcher-dot${d.errored===!0?" launcher-dot-errored":""}`;const g=document.createElement("span");if(g.className="launcher-row-text",g.textContent=d.text,u.append(h,g),d.open!==void 0){const p=d.open,z=document.createElement("span");z.className="launcher-go",z.textContent="›",u.appendChild(z),u.addEventListener("click",m=>{m.stopPropagation(),p()})}l.appendChild(u)}const c=document.createElement("span");return c.className="launcher-verb",c.textContent=e.verb,s.append(i,o,l,c),s}}const wE=/\s--(?:\s|$)/;function Bl(n){const e=wE.exec(n),t=e===null?n:n.slice(0,e.index),s=e===null?"":n.slice(e.index),i=t.lastIndexOf(";"),r=i===-1?0:i+1,a=t.slice(r),o=/^\s*\S+/.exec(a),l=r+(o===null?a.length:o[0].length);return{head:t.slice(0,l),args:t.slice(l),tail:s}}function Gp(n,e){return`cd "${n}"; ${e}`}function yE(n){return/^[A-Za-z0-9_./:@+=,-]+$/.test(n)?n:`"${n.replace(/(["\\])/g,"\\$1")}"`}function eM(n){const e=[],t=/"(?:[^"\\]|\\.)*"|\S+/g;let s=t.exec(n);for(;s!==null;)e.push(s[0]),s=t.exec(n);return e}function Rp(n){return n.length>=2&&n.startsWith('"')&&n.endsWith('"')?n.slice(1,-1).replace(/\\(["\\])/g,"$1"):n}function tM(n){return n.startsWith("-")&&n!=="-"&&!/^-\d/.test(n)}function vE(n,e){const t=eM(Bl(n).args);for(let s=0;s<t.length;s++){const i=t[s]??"";if(i===e){const r=t[s+1];return r===void 0||tM(r)?!0:Rp(r)}if(i.startsWith(`${e}=`))return Rp(i.slice(e.length+1))}return null}function Bp(n,e,t){const s=Bl(n),i=eM(s.args),r=[];let a=!1;const o=t===null||t===""?[]:t===!0?[e]:[e,yE(t)];for(let c=0;c<i.length;c++){const d=i[c]??"";if(d===e||d.startsWith(`${e}=`)){if(d===e){const u=i[c+1];u!==void 0&&!tM(u)&&c++}a||(r.push(...o),a=!0);continue}r.push(d)}a||r.push(...o);const l=r.length===0?"":` ${r.join(" ")}`;return`${s.head}${l}${s.tail}`}function OE(n){return/\bfeed_title=/.test(Bl(n).tail)}function xE(n,e){return`${n} -- feed_title="${e.replace(/(["\\])/g,"\\$1")}"`}function Np(n){return Bl(n).head.replace(/^.*;\s*/,"").trim()}function SE(n,e,t){return/^[A-Za-z0-9_-]+$/.test(n)&&t.filter(i=>i===n).length===1?n:`@${e}`}function AE(n){return(n.replace(/\[[0-9;]*m/g,"").split(`
4229
4229
  `).find(s=>s.trim().length>0)?.trim()??"").replace(/\s*\((?:[\d,]+\/[\d,]+(?:,\s*\d+%)?|initializing)\)(?=\.?$)/,"")}function Cc(n,e){const t=sd(n);if(t===null)return null;let s=0,i=0,r=0;for(const o of e.all()){const l=o.groups.filter(c=>c.plugin===t);if(l.length!==0){s+=1;for(const c of l)i+=c.count,r+=c.errored}}const a=i===0?0:Math.round(r/i*100);return`${t} · ${s.toLocaleString("en-US")} feed${s===1?"":"s"} · ${a}% errored`}class sM{byId=new Map;take(e){let t=!1;for(const s of e){const i=this.byId.get(s.id);i!==void 0&&i.status===s.status&&i.jobs===s.jobs&&JSON.stringify(i.groups)===JSON.stringify(s.groups)||(this.byId.set(s.id,{...s,chain:[...s.chain],groups:s.groups.map(r=>({...r}))}),t=!0)}return t}size(){return this.byId.size}shapes(){return new Set([...this.byId.values()].map(Es)).size}all(){return[...this.byId.values()]}get(e){return this.byId.get(e)}clear(){this.byId.clear()}}function nM(n,e){const t=n.match(/^feed:(\d+):(\d+)$/);if(t===null)return null;const s=e.get(Number(t[1])),i=s?.groups[Number(t[2])];if(s===void 0||i===void 0)return null;const r=i.count>1?` ×${i.count.toLocaleString("en-US")}`:"",a=s.title.length>0?` · ${s.title}`:"",o=i.errored>0&&i.count>1?`${i.errored.toLocaleString("en-US")} errored`:i.status;return`${i.plugin}${r} · ${o} · feed ${s.id}${a}`}function EE(n,e){return`argus.universe.${n}@${e}`}const Mi={draw:"stars",view:"feeds",scale:"jobs",density:"shape",arrangement:"galaxy",captions:!0};function DE(n,e,t,s,i=Mi.arrangement,r=Mi.captions){return{draw:n,view:e,scale:t,density:s,arrangement:i,captions:r}}function IE(n){let e={};try{const s=n===null?null:JSON.parse(n);s!==null&&typeof s=="object"&&!Array.isArray(s)&&(e=s)}catch{}const t=(s,i,r)=>typeof s=="string"&&i.includes(s)?s:r;return{draw:t(e.draw,["stars","spheres"],Mi.draw),view:t(e.view,["feeds","shapes"],Mi.view),scale:t(e.scale,["jobs","feeds"],Mi.scale),density:t(e.density,["shape","census"],Mi.density),arrangement:t(e.arrangement,["galaxy","spokes","clumps","constellations","data","accretion"],Mi.arrangement),captions:typeof e.captions=="boolean"?e.captions:Mi.captions}}function Cp(n){if(n===null||n.length===0)return{};try{const e=JSON.parse(n);if(e===null||typeof e!="object"||Array.isArray(e))return{};const t={};for(const[s,i]of Object.entries(e))Array.isArray(i)&&i.length===3&&i.every(r=>typeof r=="number"&&Number.isFinite(r))&&(t[s]=[i[0],i[1],i[2]]);return t}catch{return{}}}function Pc(n,e){return`inst:${n}:${e}`}function TE(n){const e=new Set(n.nodes.map(i=>i.id)),t=[],s=new Map;for(const i of n.nodes){const r=Pc(n.feedId,i.id),a=i.parentIds.filter(d=>e.has(d)).map(d=>Pc(n.feedId,d)),o=i.tally?.count??1,l=i.tally?.error??(i.status==="finishedWithError"?1:0),c=l>0&&o>0?Math.min(1,l/o):void 0;t.push({id:r,label:i.pluginName,parentIds:a,joinParentIds:i.joinParentIds.filter(d=>e.has(d)).map(d=>Pc(n.feedId,d)),status:i.status,metric:jr(o),...o>1?{count:o}:{},...c!==void 0?{share:c}:{}}),s.set(r,i)}return{nodes:t,payloads:s}}function GE(n,e,t,s="jobs",i=!1,r){const a=r??(i?hu(n,s):Fa(n,s)),o=`feed:${e}:`;return{nodes:[...a.nodes.filter(c=>!c.id.startsWith(o)).map(c=>({...c,dim:!0})),...t.nodes]}}function iM(n,e){return e.groups.map((t,s)=>wi(n,s))}function rM(n,e=3){const t=vl(n).split(" > ");return t.length<=e?t.join(" > "):`${t.slice(0,e).join(" > ")} … +${t.length-e}`}function RE(n,e){if(!n.startsWith("shape:"))return null;const t=n.slice(6),s=e.all().filter(i=>Es(i)===t).length;return`${vl(t)} · ${s} feed${s===1?"":"s"}`}function BE(n,e){const t=[];for(const s of e.all())Es(s)===n&&t.push(...iM(s.id,s));return t}function NE(n,e,t="jobs"){const s=Fa(n,t),i=new Set(n.filter(a=>Es(a)===e).map(a=>a.id));return{nodes:s.nodes.map(a=>{if(a.ghost===!0)return a.id===ym(e)?a:{...a,dim:!0};const o=a.id.match(/^feed:(\d+):/);return o!==null&&i.has(Number(o[1]))?a:{...a,dim:!0}})}}function aM(n,e="jobs"){const t=new Map;for(const i of[...n].sort((r,a)=>r.id-a.id)){if(i.groups.length===0)continue;const r=Es(i),a=t.get(r)??[];a.push(i),t.set(r,a)}const s=[];for(const[i,r]of t)r[0].groups.forEach((o,l)=>{let c=0,d=0;for(const h of r){const g=h.groups[l];g!==void 0&&(c+=g.count,g.errored>0&&(d+=1))}const u=d>0?Math.min(1,d/r.length):void 0;s.push({id:ad(i,l),label:o.plugin,parentIds:o.parent===null?[]:[ad(i,o.parent)],joinParentIds:[],status:d===r.length?"finishedWithError":"finishedSuccessfully",metric:jr(e==="feeds"?r.length:c),...r.length>1?{count:r.length}:{},...u!==void 0?{share:u}:{}})});return{nodes:s}}function CE(n,e){const t=n.match(/^fold:(.+):(\d+)$/);if(t===null)return null;const s=t[1],i=Number(t[2]),r=e.all().filter(d=>Es(d)===s),a=r[0]?.groups[i]?.plugin;if(a===void 0)return null;const o=r.filter(d=>(d.groups[i]?.errored??0)>0).length,l=`${r.length.toLocaleString("en-US")} feed${r.length===1?"":"s"}`,c=o>0?` · ${o.toLocaleString("en-US")} with errors`:"";return`${a} · ${l}${c} · ${rM(s)}`}function Pp(n,e){const t=e.all().find(s=>Es(s)===n);return t===void 0?[]:t.groups.map((s,i)=>ad(n,i))}function Lp(n,e,t="jobs"){const s=n.filter(l=>Es(l)===e),i=n.filter(l=>Es(l)!==e),r=aM(i,t),a=Fa(s,t),o=a.nodes.filter(l=>l.ghost!==!0).map(l=>l.id);return{graph:{nodes:[...r.nodes.map(l=>({...l,dim:!0})),...a.nodes]},memberIds:o}}const PE=6e4,Wp=1e4,LE=new Set(["running","scheduled","created","started"]),WE=[/\/proc\/jobs\/feed_(\d+)(?:\/|$)/,/\/feeds?\/feed_(\d+)(?:\/|$)/],kE={running:"started",done:"finishedSuccessfully",error:"finishedWithError"};function kp(n){if(n.jobsTotal===void 0||n.jobsDone===void 0)return null;const e=n.status==="finishedWithError"||n.status==="cancelled",t=n.jobsErrored===void 0?void 0:n.jobsDone-n.jobsErrored;return{done:n.jobsDone,total:n.jobsTotal,...e?{failed:!0}:{},...t!==void 0?{succeeded:t}:{}}}function UE(n){const e=[];return n.layout==="molecule"&&e.push("dag layout molecule"),n.projection==="2d"&&e.push("dag projection 2d"),n.scale==="size"&&e.push("dag scale size"),n.hue==="compute"&&e.push("dag hue compute"),n.census==="census"&&e.push("dag census"),e}const FE=[{key:"control",label:"",className:"feedlist-control",capped:!1,width:"5.2em",cell:()=>{const n=document.createElement("span");return n.className="feedlist-control listing-capsule",n.textContent="OPEN",n}},{key:"id",label:"ID",className:"feedlist-id",width:"4em",cell:n=>String(n.id),compare:n=>n.id},{key:"title",label:"TITLE",className:"feedlist-title",width:"24em",cell:n=>n.title||"(untitled)",compare:n=>n.title},{key:"progress",label:"PROGRESS",className:"feedlist-progress",width:"1fr",cell:n=>Vo(kp(n)),compare:n=>{const e=kp(n);return e===null||e.total===0?-1:e.done/e.total}},{key:"status",label:"STATUS",className:"feedlist-status",width:"8em",cell:n=>n.status.toUpperCase(),compare:n=>n.status},{key:"nodes",label:"NODES",className:"feedlist-nodes",width:"4em",cell:n=>n.jobsTotal===void 0?"—":String(n.jobsTotal),compare:n=>n.jobsTotal??-1},{key:"sizeBytes",label:"SIZE",className:"feedlist-size",width:"5.5em",cell:n=>n.sizeBytes===void 0?"—":lM(n.sizeBytes),compare:n=>n.sizeBytes??-1},{key:"wallSeconds",label:"TIME",className:"feedlist-time",width:"6em",cell:n=>n.wallSeconds===void 0?"—":oM(n.wallSeconds),compare:n=>n.wallSeconds??-1},{key:"owner",label:"OWNER",className:"feedlist-owner",width:"7em",cell:n=>n.owner},{key:"createdAt",label:"CREATED",className:"feedlist-created",width:"7em",cell:n=>n.createdAt.slice(0,10),compare:n=>n.createdAt}];function Up(n,e){return n.nodes.length===e.nodes.length&&e.nodes.every((t,s)=>{const i=n.nodes[s];return i!==void 0&&i.id===t.id&&(i.tally?.count??1)===(t.tally?.count??1)&&i.parentIds.length===t.parentIds.length&&i.joinParentIds.length===t.joinParentIds.length})}class jE{scene;canvas;title;facts;empty;strategyPill;feedList;handlers;rosterTimer=null;shownFeedId=null;pinnedFeedId=null;requestedFeedId=null;defaultTitle;metricMode="time";lastModel=null;lastRoster=[];arrivals=new Set;arrivalsKey="";listing;stateSpan;watchedFeedId=null;liveState=null;pendingFeedId=null;lastCwd=null;constructor(e,t,s,i,r,a,o){this.feedList=a,this.canvas=e,e.style.display="none",this.title=t,this.defaultTitle=t.textContent??"",this.facts=s,this.empty=i,this.strategyPill=r,this.handlers=o;const l=r.closest(".pane-dag");this.stateSpan=l?.querySelector(".pane-state")??null,this.modeSpan=l?.querySelector(".pane-mode")??null;const c=o.feed_verbs;this.listing=new Qr({mount:this.feedList,traits:FE,key:f=>String(f.id),chrome:l===null?void 0:{root:l,prefix:"runs"},actions:c===void 0?void 0:{of:f=>c(f)},control:"control",activate:f=>this.feed_activate(f),indicated:f=>this.handlers.feed_indicated?.(f),row:{className:f=>`feedlist-row feedlist-${f.status}${this.arrivals.has(f.id)?" feedlist-arrived":""}`,decorate:(f,_)=>{f.dataset.feed=String(_.id),f.title=c===void 0?"enter the feed (Esc returns to this list)":"click to indicate, double-click to enter (Esc returns to this list)"}},state:f=>this.canvas.style.display==="block"?null:f.filter,defaultSort:{key:"createdAt",dir:"desc"}}),this.rosterTimer=setInterval(()=>{if(!this.feedList.isConnected||!this.rosterShown||this.rosterPending||document.visibilityState!=="visible")return;const _=this.lastRoster.some(O=>LE.has(O.status))?Wp:PE;Date.now()-this.rosterAskedAt<_||(this.rosterAskedAt=Date.now(),this.handlers.command_run("proc feeds"))},Wp),this.scene=new Rl(e,{select:f=>this.facts_show(f),activate:f=>this.node_activate(f),deselect:()=>this.facts.replaceChildren(),tip:f=>this.universeShown?nM(f.id,this.landed):null}),r.addEventListener("click",()=>{const f=this.scene.strategy_get()==="ranked"?"molecule":"ranked";this.scene.strategy_set(f),r.textContent=f.toUpperCase(),this.modes_render()});const d=r.parentElement?.querySelector(".dag-projection")??null;d?.addEventListener("click",()=>{const f=this.scene.projection_get()==="3d"?"2d":"3d";this.scene.projection_set(f),d.textContent=f.toUpperCase(),this.modes_render()});const u=r.parentElement?.querySelector(".dag-pulse")??null;u?.classList.add("rail-off"),u?.addEventListener("click",()=>{const f=!this.scene.waveLoop_get();this.scene.waveLoop_set(f),u.textContent=f?"PULSE ON":"PULSE OFF",u.classList.toggle("rail-off",!f),this.modes_render()});const h=r.parentElement?.querySelector(".dag-scale")??null;h?.addEventListener("click",()=>{this.metricMode=this.metricMode==="time"?"size":"time",h.textContent=this.metricMode==="time"?"TIME":"SIZE",this.lastModel!==null&&this.graph_show(this.lastModel,!1),this.modes_render()}),this.scalePill=h;const g=r.parentElement?.querySelector(".dag-census")??null;g?.addEventListener("click",()=>{const f=!this.scene.census_get();this.scene.census_set(f),g.textContent=f?"CENSUS":"SHAPE",this.modes_render()});const p=r.parentElement?.querySelector(".dag-gravity")??null;p?.classList.add("rail-off"),p?.addEventListener("click",()=>{const f=!this.scene.physics_get().gravity;this.scene.physics_set({gravity:f}),p.textContent=f?"GRAVITY ON":"GRAVITY OFF",p.classList.toggle("rail-off",!f),this.modes_render()});const z=r.parentElement?.querySelector(".dag-hue")??null;z?.addEventListener("click",()=>{this.hueMode=this.hueMode==="status"?"compute":"status",z.textContent=this.hueMode.toUpperCase(),this.lastModel!==null&&this.graph_show(this.lastModel,!1),this.hueMode==="compute"&&!this.computeKnown&&this.shownFeedId!==null&&this.canvas.style.display!=="none"&&(this.computeRereading=!0,this.handlers.command_run(`proc refresh ${this.shownFeedId}`),this.refresh()),this.modes_render()}),this.huePill=z,r.closest(".pane-dag")?.addEventListener("argus:dag-physics",f=>{const _=f.detail;if(_==="reset"){this.scene.physics_set({charge:!0,link:!0,collide:!0});return}if(_.term==="gravity"){this.scene.physics_get().gravity!==_.on&&p?.click();return}this.scene.physics_set({[_.term]:_.on})}),new MutationObserver(()=>this.scene.palette_refresh()).observe(document.documentElement,{attributes:!0,attributeFilter:["data-theme"]}),window.addEventListener("resize",()=>this.scene.size_fit()),new MutationObserver(()=>{window.setTimeout(()=>this.scene.size_fit(),600)}).observe(document.body,{attributes:!0,attributeFilter:["data-zoom"]})}envelope_observe(e){if(e.model?.kind===bm){const r=Mm.safeParse(e.model.data);r.success&&this.universe_show(r.data);return}if(e.model?.kind===gm){this.rosterPending=!1;const r=mm.safeParse(e.model.data);r.success&&(this.universe_end(!0),this.chooser_show(r.data.feeds));return}if(this.pendingFeedId!==null&&e.status==="error"&&e.model===void 0){this.feedRequest_refuse(e.renderedErr??e.rendered??"");return}if(this.rosterPending&&e.status==="error"){this.rosterPending=!1,this.rosterRefusal_show(e),this.universe_request();return}if(e.model?.kind===zi.feedIndexing){const r=a0.safeParse(e.model.data);if(!r.success)return;this.requestedFeedId===r.data.feedId?this.requestedFeedId=null:this.pendingFeedId!==r.data.feedId&&(this.pinnedFeedId=r.data.feedId,this.pendingFeedId=r.data.feedId),this.feedIndexing_show(r.data);return}if(e.model?.kind!==zi.feedDag)return;const t=ed.safeParse(e.model.data);if(!t.success)return;const s=t.data;this.requestedFeedId===s.feedId?this.requestedFeedId=null:this.pinnedFeedId=s.feedId,this.universe_end(!1),this.shownFeedId=s.feedId,this.pendingFeedId=null,this.stateSpan?.classList.remove("state-wait"),this.title.textContent=`DAG · FEED ${s.feedId} — ${s.feedName}`.toUpperCase(),this.empty.style.display="none",this.roster_show(!1),this.canvas.style.display="block",this.lastModel!==null&&this.lastModel.feedId!==s.feedId&&(this.facts.replaceChildren(),this.scene.selection_clear());const i=this.lastModel;this.lastModel=s,i!==null&&i.feedId===s.feedId&&Up(i,s)?this.statuses_patch(s):this.graph_show(s),this.watch_open(s.feedId),this.handlers.feed_shown?.()}watch_open(e){this.watchedFeedId!==e&&(this.watch_release(),this.watchedFeedId=e,this.liveState_show(null),this.handlers.watch_set?.(`/proc/jobs/feed_${e}`,!0))}watch_release(){this.watchedFeedId!==null&&(this.handlers.watch_set?.(`/proc/jobs/feed_${this.watchedFeedId}`,!1),this.watchedFeedId=null,this.liveState_show(null))}modeSpan=null;hueMode="status";huePill=null;hueLegend=new Map;computeKnown=!1;computeRereading=!1;hueLegend_build(e){const t=getComputedStyle(document.documentElement),s=["--harvestgold","--daybreak","--orange","--honey","--butter","--october-sunset"].map(r=>t.getPropertyValue(r).trim()).filter(r=>r!==""),i=new Map;for(const r of e.nodes){const a=r.computeResource;a===void 0||a==="mixed"||i.has(a)||i.set(a,s[i.size%Math.max(1,s.length)]??"#888")}return i}modes_render(){if(this.modeSpan===null)return;const e=[];if(this.scene.strategy_get()!=="ranked"&&e.push("MOLECULE"),this.scene.projection_get()!=="3d"&&e.push("2D"),this.metricMode!=="time"&&e.push("SIZE"),this.scene.census_get()&&e.push("CENSUS"),this.scene.waveLoop_get()&&e.push("PULSE"),this.scene.physics_get().gravity&&e.push("GRAVITY"),this.modeSpan.replaceChildren(document.createTextNode(e.join(" · "))),this.hueMode==="compute"){const t=document.createElement("span");t.className="pane-legend",t.append(document.createTextNode(e.length>0?" · COMPUTE":"COMPUTE"));for(const[s,i]of this.hueLegend){const r=document.createElement("span");r.className="legend-swatch",r.style.backgroundColor=i;const a=document.createElement("span");a.textContent=s,t.append(document.createTextNode(" "),r,a)}this.hueLegend.size===0&&t.append(document.createTextNode(this.computeRereading?" (re-reading the feed…)":" (none reported)")),this.modeSpan.appendChild(t)}}liveState_show(e){if(this.liveState=e,this.stateSpan!==null){if(this.stateSpan.classList.remove("state-live","state-settled","state-stale"),e===null){this.canvas.style.display!=="none"&&(this.stateSpan.textContent="");return}this.stateSpan.textContent=e.toUpperCase(),this.stateSpan.classList.add(`state-${e}`)}}liveState_get(){return this.liveState}feed_get(){return this.pendingFeedId??this.shownFeedId}graph_isShown(){return this.canvas.style.display==="block"}feedTitle_get(){return(this.title.textContent??"").replace(/^DAG\s*·\s*/i,"").trim()}view_lines(){const e=this.strategyPill.parentElement,t=s=>e?.querySelector(s)?.textContent?.trim().toLowerCase()??"";return UE({layout:t(".dag-strategy"),projection:t(".dag-projection"),scale:t(".dag-scale"),hue:t(".dag-hue"),census:t(".dag-census")})}watched_observe(e,t){const s=/feed_(\d+)$/.exec(e);!s||Number(s[1])!==this.watchedFeedId||this.liveState_show(t)}model_refresh(e){if(this.pendingFeedId===e.feedId&&this.canvas.style.display==="none"){this.envelope_observe({status:"ok",rendered:"",model:{kind:zi.feedDag,data:e}});return}if(this.shownFeedId!==e.feedId||this.canvas.style.display==="none")return;const t=this.lastModel;if(this.lastModel=e,t!==null&&Up(t,e)){this.statuses_patch(e);return}this.graph_show(e,!1)}statuses_patch(e){for(const t of e.nodes)this.scene.status_update(t.id,t.status),this.factsPayloads.set(t.id,t);this.factsShown!==null&&this.facts_show(this.factsShown)}refresh(){this.shownFeedId===null||this.canvas.style.display==="none"||(this.requestedFeedId=this.shownFeedId,this.handlers.command_run(`feed diagram feed_${this.shownFeedId}`))}scalePill=null;graph_show(e,t=!0){const s=o=>this.metricMode==="time"?o.metrics?.computeSeconds:o.metrics?.dataBytes,i=e.nodes.some(o=>s(o)!==void 0);this.scalePill?.classList.toggle("rail-na",!i),this.scalePill!==null&&(this.scalePill.title=i?"molecule node size: wall time or output bytes":`no ${this.metricMode==="time"?"wall-time":"output-size"} data in this feed's cache yet`),this.hueLegend=this.hueLegend_build(e);const r=e.nodes.some(o=>o.computeResource!==void 0);this.computeKnown=r,r&&(this.computeRereading=!1),this.huePill?.classList.toggle("rail-na",!r),this.huePill!==null&&(this.huePill.title=r?"what colors a node: its status, or the compute resource it ran on":"no compute resource reported for this feed's nodes yet");const a=o=>{if(this.hueMode==="compute")return o.computeResource===void 0?"#555":this.hueLegend.get(o.computeResource)??"#555"};this.scene.graph_set({nodes:e.nodes.map(o=>{const l=a(o);return{id:o.id,label:o.label,parentIds:o.parentIds,joinParentIds:o.joinParentIds,status:o.status,metric:s(o),count:o.tally?.count,...l!==void 0?{hue:l}:{}}})},{wave:t}),this.scene.size_fit(),this.hueMode==="compute"&&this.modes_render(),this.factsPayloads.clear();for(const o of e.nodes)this.factsPayloads.set(o.id,o);this.factsShown!==null&&(this.factsPayloads.has(this.factsShown.id)?this.facts_show(this.factsShown):this.factsShown=null)}factsPayloads=new Map;factsShown=null;promptContext_observe(e){const t=e.procWarmup?.landed??[];if(t.length>0&&this.universeLandings_take(t),this.universeShown&&this.universeLive){const o=e.procWarmup;if(o?.total!==void 0&&o.total>0&&o.sweeping!==!1){const l=Math.floor(o.loaded/o.total*100),c=`INDEX WARMING ${o.loaded.toLocaleString()}/${o.total.toLocaleString()} (${l}%)`;c!==this.universeWarming&&(this.universeWarming=c,this.universeTitle_paint())}else(o===void 0||o.sweeping===!1||o.state==="cached")&&(this.universeLive=!1,this.universeWarming="",this.universe_request())}if(this.rosterProgress!==null&&this.rosterProgress.isConnected){const o=e.procWarmup;if(o?.total!==void 0&&o.total>0&&o.sweeping!==!1){const l=Math.floor(o.loaded/o.total*100);this.rosterProgress.textContent=`INDEX WARMING — ${o.loaded}/${o.total} (${l}%). The roster opens when the index is whole.`}(o===void 0||o.sweeping===!1||o.state==="cached")&&(this.rosterProgress=null,this.feedsChooser_request())}this.arrivals_observe(e.procWarmup?.arrived??[]);const i=(e.procWarmup?.feeds??(e.procWarmup?.feed!==void 0?[e.procWarmup.feed]:[])).find(o=>o.id===this.pendingFeedId);if(i!==void 0&&this.feedIndexing_show({feedId:i.id,loaded:i.loaded,total:i.total,...i.failed!==void 0?{failed:i.failed}:{}}),!this.canvas.isConnected||this.rosterShown||this.pendingFeedId!==null)return;const r=this.lastCwd!==null&&e.cwd!==this.lastCwd;if(this.lastCwd=e.cwd,!r)return;const a=VE(e.cwd);a!==null&&a!==this.shownFeedId&&(this.pinnedFeedId!==null&&a===this.pinnedFeedId||(this.pinnedFeedId=null,this.requestedFeedId=a,this.handlers.command_run(`feed diagram feed_${a}`)))}progress_observe(e){if(e.itemId===void 0)return;const t=e.status!==void 0?kE[e.status]:void 0;t!==void 0&&this.scene.status_update(String(e.itemId),t)}size_fit(){this.scene.size_fit()}dispose(){this.watch_release(),this.rosterTimer!==null&&clearInterval(this.rosterTimer),this.scene.dispose()}feed_enter(e){this.pinnedFeedId=e,this.requestedFeedId=null,this.feedRequest_show(e),this.handlers.command_run(`feed diagram feed_${e}`)}feedRequest_show(e){this.pendingFeedId=e,this.roster_show(!1),this.canvas.style.display="none",this.facts.replaceChildren(),this.title.textContent=`DAG · FEED ${e}`,this.empty.textContent=`RETRIEVING FEED ${e}…`,this.empty.style.display="block",this.stateSpan!==null&&(this.stateSpan.classList.remove("state-live","state-settled","state-stale"),this.stateSpan.classList.add("state-wait"),this.stateSpan.textContent="LOADING")}feedIndexing_show(e){this.pendingFeedId===null&&(this.pendingFeedId=e.feedId),this.roster_show(!1),this.canvas.style.display="none",this.title.textContent=`DAG · FEED ${e.feedId}`;const t=e.total>0?`${e.loaded.toLocaleString()} / ${e.total.toLocaleString()}`:`${e.loaded.toLocaleString()} / ?`;this.empty.textContent=e.failed!==void 0?`INDEXING FEED ${e.feedId} FAILED AT ${t} — ${e.failed.toUpperCase()} — REFRESH RETRIES`:`INDEXING FEED ${e.feedId} — ${t}`,this.empty.style.display="block",this.stateSpan!==null&&(this.stateSpan.classList.remove("state-live","state-settled","state-stale"),this.stateSpan.classList.add("state-wait"),this.stateSpan.textContent=e.failed!==void 0?"FAILED":"LOADING"),e.failed===void 0&&this.watch_open(e.feedId)}feedRequest_refuse(e){const t=this.pendingFeedId;this.pendingFeedId=null,this.empty.textContent=`FEED ${t??"?"}: ${e.trim()||"not available"}`.toUpperCase(),this.empty.style.display="block",this.roster_show(!0),this.title.textContent=this.defaultTitle,this.stateSpan?.classList.remove("state-wait"),this.listing.state_refresh()}feedsChooser_request(){const e=document.createElement("div");e.className="feedlist-loading",e.textContent="RETRIEVING FEED ROSTER…",this.feedList.replaceChildren(e),this.roster_show(!0),this.rosterPending=!0,this.rosterAskedAt=Date.now(),this.handlers.command_run("proc feeds")}rosterPending=!1;rosterShown=!1;rosterAskedAt=0;rosterProgress=null;landed=new sM;universeShown=!1;universeLive=!1;universeRepaint=null;universeStrategyWas=null;universeWarming="";universe_request(){this.handlers.command_run("proc universe")}universe_show(e){this.landed.clear(),this.landed.take(e.feeds),this.universeLive=!e.whole,this.universeShown||(this.universeShown=!0,this.universeStrategyWas=this.scene.strategy_get(),this.scene.strategy_set("molecule"),this.scene.physics_set({gravity:!0})),this.roster_show(!1),this.pendingFeedId=null,this.pinnedFeedId=null,this.empty.style.display="none",this.canvas.style.display="block",this.universe_paint()}universe_paint(){this.lastModel=null,this.scene.graph_set(Fa(this.landed.all()),{wave:!1}),this.universeTitle_paint()}universeTitle_paint(){const e=`${this.landed.size()} FEEDS · ${this.landed.shapes()} SHAPES`;this.title.textContent=this.universeLive?`UNIVERSE — ${e}${this.universeWarming.length>0?` · ${this.universeWarming}`:" · INDEX WARMING"}`:`UNIVERSE — ${e}`,this.stateSpan!==null&&(this.stateSpan.classList.remove("state-live","state-settled","state-stale","state-wait"),this.stateSpan.classList.add(this.universeLive?"state-wait":"state-settled"),this.stateSpan.textContent=this.universeLive?"LANDING":"WHOLE")}universeLandings_take(e){!this.universeShown||!this.universeLive||!this.landed.take(e)||this.universeRepaint!==null||(this.universeRepaint=window.setTimeout(()=>{this.universeRepaint=null,this.universeShown&&this.universe_paint()},1e3))}universe_end(e){this.universeShown&&(this.universeShown=!1,this.universeLive=!1,this.universeWarming="",this.universeRepaint!==null&&(window.clearTimeout(this.universeRepaint),this.universeRepaint=null),this.landed.clear(),this.universeStrategyWas!==null&&(this.scene.strategy_set(this.universeStrategyWas),this.universeStrategyWas=null),this.scene.selection_clear(),e&&(this.canvas.style.display="none"))}rosterRefusal_show(e){const t=AE(e.renderedErr||e.rendered||""),s=t.length>0?t:"the roster request was refused",i=document.createElement("div");i.className="feedlist-refusal",i.textContent=s;const r=document.createElement("div");r.className="feedlist-warming",r.textContent="INDEX WARMING… the roster opens when the index is whole.",this.feedList.replaceChildren(i,r),this.roster_show(!0),this.rosterProgress=r}list_reset(){this.pendingFeedId=null,this.stateSpan?.classList.remove("state-wait"),this.watch_release(),this.facts.replaceChildren(),this.scene.selection_clear(),this.canvas.style.display="none",this.pinnedFeedId=null,this.requestedFeedId=null,this.title.textContent=this.defaultTitle,this.empty.style.display="none"}nav_pop(){return this.pendingFeedId!==null&&this.feedList.childElementCount>0?(this.pendingFeedId=null,this.pinnedFeedId=null,this.requestedFeedId=null,this.empty.style.display="none",this.roster_show(!0),this.title.textContent=this.defaultTitle,this.stateSpan?.classList.remove("state-wait"),this.listing.state_refresh(),!0):this.canvas.style.display==="none"||this.feedList.childElementCount===0?!1:(this.watch_release(),this.canvas.style.display="none",this.pinnedFeedId=null,this.requestedFeedId=null,this.title.textContent=this.defaultTitle,this.facts.replaceChildren(),this.scene.selection_clear(),this.roster_show(!0),this.listing.state_refresh(),!0)}arrivals_observe(e){const t=e.join(",");if(t===this.arrivalsKey)return;this.arrivalsKey=t,this.arrivals=new Set(e);for(const r of this.lastRoster)this.listing.row_element(String(r.id))?.classList.toggle("feedlist-arrived",this.arrivals.has(r.id));const s=new Set(this.lastRoster.map(r=>r.id));e.some(r=>!s.has(r))&&this.rosterShown&&this.feedsChooser_request()}chooser_show(e){this.lastRoster=e,this.empty.style.display="none",this.roster_show(!0),this.listing.rows_set([{key:"roster",rows:e}],{field:"roster"}),this.rosterFrame_track()}feed_activate(e){this.pinnedFeedId=e.id,this.requestedFeedId=null,this.handlers.feed_regard?.(`/proc/jobs/feed_${e.id}`),this.feedRequest_show(e.id),this.handlers.command_run(`feed diagram feed_${e.id}`)}row_indicate(e){this.listing.row_indicate(e===null?null:String(e.id))}rowReadout_show(e,t){this.listing.readout_show(String(e),t)}filter_toggle(e){this.listing.filter_toggle(e)}roster_filter(e){this.listing.filter_toggle(e!==""),this.listing.filter_set(e)}rosterFrameObserver=null;rosterFrame_track(){const e=this.feedList.parentElement,t=this.feedList.querySelector(".roster-order");if(this.rosterFrameObserver?.disconnect(),this.rosterFrameObserver=null,e===null)return;if(t===null){e.style.removeProperty("--mode-frame-top");return}const s=()=>{e.style.setProperty("--mode-frame-top",`${Math.ceil(t.getBoundingClientRect().bottom-e.getBoundingClientRect().top)}px`)};s(),this.rosterFrameObserver=new ResizeObserver(s),this.rosterFrameObserver.observe(t)}roster_show(e){this.rosterShown=e,this.feedList.style.display=e?"flex":"none",this.feedList.parentElement?.classList.toggle("roster-shown",e)}facts_show(e){this.factsShown=e;const t=this.factsPayloads.get(e.id);if(!t){this.facts.textContent=e.label;return}this.handlers.node_regard?.(t.vfsPath),this.facts.replaceChildren();const i=t.status==="finishedSuccessfully"||t.status==="finishedWithError"||t.status==="cancelled"?"awaiting warmup":"in flight",r=t.tally,a=[["PLUGIN",t.pluginName],[r?"REP. INSTANCE":"INSTANCE",String(t.instanceId)],["STATUS",t.status],...r?[["COUNT",`×${r.count} — ${r.done} done, ${r.error} err, ${r.running} live, ${r.other} other`]]:[],...r?.anomalies!==void 0&&r.anomalies.length>0?[["FAULTS",r.anomalies.map(o=>o.id).join(" ")+(r.count>r.done+r.anomalies.length?" …":"")]]:[],["WALL",t.metrics?.computeSeconds!==void 0?oM(t.metrics.computeSeconds):i],["SIZE",t.metrics?.dataBytes!==void 0?lM(t.metrics.dataBytes):i],["DATA",t.vfsPath]];for(const[o,l]of a){const c=document.createElement("div");c.className="telemetry-row";const d=document.createElement("span");d.className="telemetry-label",d.textContent=o;const u=document.createElement("span");u.className="telemetry-value",u.textContent=l,c.append(d,u),this.facts.appendChild(c)}if(this.facts.appendChild($E(t.status)),this.handlers.node_process!==void 0){const o=this.handlers.node_process,l=document.createElement("button");l.className="pacs-capsule dag-process",r!==void 0?(l.textContent="PROCESS",l.disabled=!0,l.title=`${r.count} instances stand here: open one to process it`,l.classList.add("pacs-capsule-off")):(l.textContent="PROCESS",l.title=`open /bin bound to ${t.label} — a run appends to this node`,l.addEventListener("click",()=>o({vfsPath:t.vfsPath,instanceId:t.instanceId,label:t.label}))),this.facts.appendChild(l)}}node_activate(e){const t=this.factsPayloads.get(e.id);if(t)if(this.handlers.node_dive!==void 0){const s=this.handlers.node_dive;this.scene.flight_into(e.id,()=>s(t.vfsPath))}else this.handlers.node_enter(t.vfsPath)}detail_clear(){this.scene.selection_clear(),this.facts.replaceChildren()}wave_start(){this.scene.wave_start()}inside_isHeld(){return this.scene.holding_get()}flight_back(e){this.scene.flight_back(e)}node_flyTo(e){for(const[t,s]of this.factsPayloads){if(s.instanceId!==e)continue;if(this.handlers.node_dive===void 0)return!1;const i=this.handlers.node_dive;return this.facts_show({id:t,label:s.label,parentIds:[],joinParentIds:[]}),this.scene.flight_into(t,()=>i(s.vfsPath)),!0}return!1}}function oM(n){const e=Math.round(n);return e<60?`${e}s`:e<3600?`${Math.floor(e/60)}m ${String(e%60).padStart(2,"0")}s`:`${Math.floor(e/3600)}h ${String(Math.floor(e%3600/60)).padStart(2,"0")}m`}function lM(n){if(n<1024)return`${n}B`;const e=["K","M","G","T"];let t=n,s=-1;for(;t>=1024&&s<e.length-1;)t=t/1024,s=s+1;return`${t<10?t.toFixed(1):Math.round(t)}${e[s]}`}const Lc=[{key:"created",label:"CREATED"},{key:"waiting",label:"WAITING"},{key:"scheduled",label:"SCHEDULED"},{key:"started",label:"STARTED"},{key:"registeringFiles",label:"REGISTERING"}];function $E(n){const e=document.createElement("div");e.className="dag-subway";const t=n==="finishedSuccessfully",s=n==="finishedWithError"||n==="cancelled",i=Lc.findIndex(l=>l.key===n),r=t||s?Lc.length:i;!t&&!s&&e.classList.add("dag-subway-live");const a=(l,c,d)=>{const u=document.createElement("span");u.className=`subway-step${d?" subway-step-here":""}`;const h=document.createElement("span");h.className=c;const g=document.createElement("span");return g.className="subway-label",g.textContent=l,u.append(h,g),u};Lc.forEach((l,c)=>{if(c>0){const u=document.createElement("span");u.className="subway-link"+(c<=r?" subway-passed":""),e.appendChild(u)}const d=c===i&&!t&&!s;e.appendChild(a(l.label,"subway-stop"+(c<r?" subway-passed":"")+(d?" subway-here":""),d))});const o=document.createElement("span");return o.className="subway-link"+(t||s?" subway-passed":""),e.appendChild(o),e.appendChild(a(t?"FINISHED":s?n==="cancelled"?"CANCELLED":"ERROR":"FINISHED","subway-stop subway-terminal"+(t?" subway-done":"")+(s?" subway-failed":""),!1)),e}function VE(n){for(const e of WE){const t=n.match(e);if(t?.[1]!==void 0)return parseInt(t[1],10)}return null}class HE{root;label;fill;constructor(e){this.root=document.createElement("div"),this.root.className="wait-progress",this.root.hidden=!0,this.root.setAttribute("role","progressbar"),this.root.setAttribute("aria-valuemin","0"),this.root.setAttribute("aria-valuemax","100"),this.label=document.createElement("span"),this.label.className="wait-progress-label";const t=document.createElement("span");t.className="wait-progress-track",this.fill=document.createElement("span"),this.fill.className="wait-progress-fill",t.appendChild(this.fill),this.root.append(this.label,t),e.appendChild(this.root)}show(e,t){this.root.hidden=!1,this.label.textContent=t===null?e:`${e} · ${Math.floor(t*100)}%`,this.root.classList.toggle("wait-progress-indeterminate",t===null),this.fill.style.width=t===null?"":`${Math.max(0,Math.min(1,t))*100}%`,t===null?this.root.removeAttribute("aria-valuenow"):this.root.setAttribute("aria-valuenow",String(Math.floor(t*100)))}hide(){this.root.hidden=!0}shown(){return!this.root.hidden}}function qE(n){const e={...tr,gravity:!0};return n.charge===e.charge&&n.link===e.link&&n.collide===e.collide&&n.gravity===e.gravity}function Fp(n){let e=0;for(const t of Object.values(n))e+=t[0]*1.3+t[1]*1.7+t[2]*1.9;return`${Object.keys(n).length}:${e.toFixed(2)}`}function Wc(n){return n==="constellations"||n==="data"||n==="accretion"}const XE=18e4,YE=1500,KE=1e3,ZE=5e3,QE=3e3,Tr=650,JE=650,eD=1.5;class tD{scene;wait;asking=!1;spaceKey="";landed=new sM;canvas;title;state;empty;handlers;store;whole=!1;shown=!1;warming="";repaintTimer=null;lastReask=0;rememberTimer=null;putSignatures=new Map;sessionPlaces=new Map;sessionWait=null;storeKey=null;arrivalsKey="";feedsCount=null;disposed=!1;scale="jobs";view="feeds";inside=null;cluster=null;flying=!1;framedAt=null;entering=null;facts;viewPill=null;gravityPill=null;densityPill=null;density="shape";drawMode="stars";drawPill=null;captionsPill=null;captions=!0;arrangement="galaxy";arrangementPill=null;scalePill=null;physics={...tr,gravity:!0};backPill;openPill;pane;escape_listen;lit=null;dataHubs=new Map;litHub=null;replayPill=null;replayDay="";reach=null;constructor(e,t,s){this.canvas=e.canvas,this.title=e.title,this.state=e.state,this.empty=e.empty,this.handlers=t,this.store=s,this.facts=e.facts,this.backPill=e.backPill,this.openPill=e.openPill,this.pane=e.canvas.closest(".workspace-pane"),this.wait=new HE(e.canvas),this.scene=new Rl(e.canvas,{progress:(i,r,a)=>this.settle_progress(i,r,a),handoffKey:i=>j0(i.id),tip:i=>this.inside===null?k0(i.id,this.dataHubs)??Cc(i.id,this.landed)??CE(i.id,this.landed)??nM(i.id,this.landed)??RE(i.id,this.landed):null,select:i=>this.node_select(i),activate:i=>{const r=this.inside===null?sd(i.id):null;r!==null?this.plugin_frame(r):this.node_dive(i)},deselect:()=>{this.facts_clear(),this.lit!==null&&this.plugin_light(null)},replay:()=>this.replay_paint(),gesture_end:()=>this.pinch_leave()}),e.backPill?.addEventListener("click",()=>this.ascend()),e.openPill?.addEventListener("click",()=>{this.inside!==null&&this.handlers.feed_open?.(this.inside.feedId)}),this.escape_listen=i=>{if(i.key==="Escape"&&this.scene.replay_state()!==null&&(this.pane===null||this.pane.offsetParent!==null)){this.replay_end();return}i.key!=="Escape"||this.inside===null&&this.cluster===null||this.flying||this.scene.holding_get()||this.pane!==null&&this.pane.offsetParent===null||this.ascend()},window.addEventListener("keydown",this.escape_listen),this.scene.strategy_set("molecule"),this.scene.physics_set(this.physics),e.projectionPill?.addEventListener("click",()=>{const i=this.scene.projection_get()==="3d"?"2d":"3d";this.scene.projection_set(i),e.projectionPill!==null&&(e.projectionPill.textContent=i.toUpperCase())}),e.refreshPill?.addEventListener("click",()=>this.request()),this.replayPill=e.replayPill??null,e.replayPill?.addEventListener("click",()=>{const i=this.scene.replay_state();i===null?this.handlers.note?.(this.replay_start(1)):i.playing?this.scene.replay_pause():this.scene.replay_play(),this.replay_paint()}),e.scalePill?.addEventListener("click",()=>{this.scale=this.scale==="jobs"?"feeds":"jobs",e.scalePill!==null&&(e.scalePill.textContent=this.scale==="jobs"?"JOBS":"ALIKE"),this.shown&&this.paint(!0,"full"),this.settings_save()}),e.viewPill?.addEventListener("click",()=>this.view_set(this.view==="feeds"?"shapes":"feeds")),this.viewPill=e.viewPill,this.gravityPill=e.gravityPill,e.gravityPill?.addEventListener("click",()=>{this.physics_set("gravity",!this.physics.gravity)}),this.densityPill=e.densityPill,e.densityPill?.addEventListener("click",()=>{this.density_set(this.density==="shape"?"census":"shape")}),this.drawPill=e.drawPill??null,this.scalePill=e.scalePill,e.drawPill?.addEventListener("click",()=>{this.draw_set(this.drawMode==="stars"?"spheres":"stars")}),this.captionsPill=e.captionsPill??null,e.captionsPill?.addEventListener("click",()=>{this.handlers.note?.(this.captions_set(!this.captions))}),this.arrangementPill=e.arrangementPill??null,e.arrangementPill?.addEventListener("click",()=>{const i=["galaxy","spokes","clumps","constellations","data","accretion"];this.handlers.note?.(this.arrangement_set(i[(i.indexOf(this.arrangement)+1)%i.length]))}),this.scene.draw_set(this.drawMode),this.canvas.style.display="none",this.title_paint()}request(){this.asking=!0,this.shown||this.wait.show("ASKING THE SESSION FOR THE SPACE",null),this.title_paint(),this.shown||this.handlers.command_run(`proc layout ${this.sessionLayoutName_of(this.arrangement)}`),this.handlers.command_run("proc universe")}settle_progress(e,t,s){if(e>=t){this.wait.hide(),this.remember_later();return}this.wait.show(`SETTLING ${s.toLocaleString("en-US")} SPHERES`,t===0?1:e/t)}envelope_observe(e){if(e.model?.kind===h0){const s=u0.safeParse(e.model.data);s.success&&this.sessionLayout_take(s.data.name,s.data.positions,s.data.laying??null);return}if(e.model?.kind!==bm)return;const t=Mm.safeParse(e.model.data);t.success&&this.space_show(t.data)}promptContext_observe(e){if(this.disposed)return;this.identity_note(e.user,e.uri);const t=e.procWarmup?.landed??[];t.length>0&&this.shown&&this.landings_take(t);const s=e.procWarmup;if(s?.total!==void 0&&s.total>0&&s.sweeping!==!1&&!this.whole){const i=Math.floor(s.loaded/s.total*100),r=`INDEX WARMING ${s.loaded.toLocaleString()}/${s.total.toLocaleString()} (${i}%)`;r!==this.warming&&(this.warming=r,this.title_paint())}else this.shown&&!this.whole&&(s===void 0||s.sweeping===!1||s.state==="cached")&&(this.warming="",this.request());if(this.shown&&this.whole){const i=(s?.arrived??[]).join(","),r=e.procIndex?.feeds??null,a=i.length>0&&i!==this.arrivalsKey||r!==null&&this.feedsCount!==null&&r!==this.feedsCount;this.arrivalsKey=i,r!==null&&(this.feedsCount=r),a&&Date.now()-this.lastReask>ZE&&(this.lastReask=Date.now(),this.request())}}size_fit(){this.scene.size_fit()}control(e,t){if(e==="enter"){const s=parseInt(t[0]??"",10);return Number.isFinite(s)?this.landed.get(s)===void 0?`universe enter: feed ${s} has not landed here`:this.inside!==null?`universe enter: already inside feed ${this.inside.feedId}; universe back first`:(this.descend(s),`entering feed ${s}`):"universe enter <feed id>"}if(e==="node"){const s=parseInt(t[0]??"",10);return Number.isFinite(s)?this.inside===null?"universe node: not inside a feed (universe enter <feed> first)":this.node_flyTo(s)?`flying into instance ${s}`:`universe node: no node of feed ${this.inside.feedId} hosts instance ${s}`:"universe node <instance id>: fly into the entered feed's node that hosts it"}if(e==="state"){const s=this.scene.state_get(),i=(()=>{const r=this.settingsKey_get();try{return r===null||this.store===void 0?null:this.store.getItem(r)}catch{return null}})();return[`universe: ${this.inside!==null?`inside feed ${this.inside.feedId}`:this.cluster!==null?"in a cluster":"the whole space"}; view ${this.view}, scale ${this.scale}, density ${this.density}`,`scene: ${Object.entries(s).map(([r,a])=>`${r}=${String(a)}`).join(" ")}`,`kept settings: ${i??"(none)"}`,`lit: ${this.lit??"none"}`,`captions: ${this.captions?"on":"off"}`,`session layout: ${(()=>{const r=this.sessionPlaces.get(this.sessionLayoutName_of(this.arrangement));return r===void 0?"not asked":r===null?"none kept":`${r} places kept`})()}`,`replay: ${(()=>{const r=this.scene.replay_state();return r===null?"none":`${r.playing?"playing":"paused"} at ${new Date(r.at).toISOString().slice(0,10)} of ${new Date(r.span[0]).toISOString().slice(0,10)}..${new Date(r.span[1]).toISOString().slice(0,10)}`})()}`].join(`
4230
4230
  `)}if(e==="plugin"){const s=t[0]??"";return s===""?"universe plugin <name> | off":this.arrangement!=="constellations"||this.inside!==null||this.cluster!==null?"universe plugin: the CONSTELLATIONS layout only (universe layout constellations)":s.toLowerCase()==="off"?(this.plugin_light(null),"no plugin lit"):this.landed.all().some(i=>i.groups.some(r=>r.plugin===s))?(this.plugin_light(s),Cc(`plugin:${s}`,this.landed)??s):`universe plugin: no feed here ran ${s}`}if(e==="replay"){const s=(t[0]??"").toLowerCase();if(s==="stop")return this.scene.replay_state()===null?"universe replay: none is running":(this.replay_end(),"replay stopped; the space is whole");if(s==="pause")return this.scene.replay_state()===null?"universe replay: none is running":(this.scene.replay_pause(),this.replay_paint(),"replay paused");if(s==="at"){if(this.scene.replay_state()===null)return"universe replay: none is running (universe replay first)";const r=Date.parse(t[1]??"");return Number.isFinite(r)?(this.scene.replay_pause(),this.scene.replay_seek(r),this.replay_paint(),`replay at ${new Date(this.scene.replay_state()?.at??r).toISOString().slice(0,10)}`):"universe replay at <YYYY-MM-DD>"}const i=s===""?1:Number(s);return!Number.isFinite(i)||i<=0?"universe replay [speed] | pause | stop | at <YYYY-MM-DD>":this.scene.replay_state()!==null?(this.scene.replay_play(i),this.replay_paint(),`replaying at ×${i}`):this.replay_start(i)}if(e==="layout"){const s=(t[0]??"").toLowerCase();return s!=="galaxy"&&s!=="spokes"&&s!=="clumps"&&s!=="constellations"&&s!=="data"&&s!=="accretion"?"universe layout galaxy|spokes|clumps|constellations|data|accretion":this.arrangement_set(s)}if(e==="draw"){const s=(t[0]??"").toLowerCase();return s!=="stars"&&s!=="spheres"?"universe draw stars|spheres":this.draw_set(s)}if(e==="regrow"){if(this.arrangement!=="accretion"||this.inside!==null||this.cluster!==null)return"universe regrow: the ACCRETION layout only (universe layout accretion)";this.replay_end();const s=this.positionsKey_of("accretion");try{s!==null&&this.store?.setItem(s,"{}")}catch{}return this.paint(!0,"full"),"the space regrown from its first feed"}if(e==="captions"){const s=(t[0]??"").toLowerCase();return s!=="on"&&s!=="off"?"universe captions on|off":this.captions_set(s==="on")}if(e==="density"){const s=(t[0]??"").toLowerCase();return s!=="shape"&&s!=="census"?"universe density shape|census":this.density_set(s)}if(e==="physics"){const s=(t[0]??"").toLowerCase();if(s==="reset")return this.physics_reset();if(!["charge","link","collide","gravity"].includes(s))return"universe physics charge|link|collide|gravity [on|off] | reset";const i=(t[1]??"on").toLowerCase()!=="off";return this.physics_set(s,i)}if(e==="view"){const s=(t[0]??"").toLowerCase();return s!=="feeds"&&s!=="shapes"?"universe view feeds|shapes":this.inside!==null||this.cluster!==null?"universe view: climb out first (universe back)":(this.view_set(s),s==="feeds"?"every feed its own molecule":"the shapes folded, one molecule each")}if(this.flying&&(e==="enter"||e==="cluster"||e==="back"))return"universe: still moving; ask again";if(e==="cluster"){const s=parseInt(t[0]??"",10),i=Number.isFinite(s)?this.landed.get(s):void 0;return i===void 0?"universe cluster <feed id>: the cluster of a feed that landed here":this.inside!==null?`universe cluster: inside feed ${this.inside.feedId}; universe back first`:(this.cluster_enter(Es(i)),`viewing the cluster of feed ${s}: ${vl(Es(i))}`)}return e==="back"?this.inside===null&&this.cluster===null?"universe back: not inside a feed or a cluster":(this.ascend(),"climbing out"):e==="open"?this.inside===null?"universe open: not inside a feed":(this.handlers.feed_open?.(this.inside.feedId),`opening feed ${this.inside.feedId}`):"universe enter <feed>|node <instance>|cluster <feed>|view feeds|shapes|density shape|census|draw stars|spheres|captions on|off|layout galaxy|spokes|clumps|constellations|data|accretion|regrow|plugin <name>|off|replay [speed]|pause|stop|at <date>|state|physics <term> on|off|reset|back|open"}physics_set(e,t){return this.inside!==null||this.cluster!==null?"universe physics: climb out first (universe back)":e==="reach"?"universe physics: reach is the pane's own":(this.physics={...this.physics,[e]:t},this.physics_apply(),`physics ${e} ${t?"on":"off"}`)}draw_set(e){return this.replay_end(),this.drawMode=e,this.drawPill!==null&&(this.drawPill.textContent=e.toUpperCase()),this.scene.draw_set(e),this.settings_save(),e==="stars"?"every sphere a point of light":"every sphere lit and solid"}captions_set(e){return this.captions=e,this.captionsPill!==null&&(this.captionsPill.textContent=e?"CAPTIONS ON":"CAPTIONS OFF"),this.scene.captions_set(e),this.settings_save(),e?"captions on: each hub names itself and its count":"captions off: a hub names itself on hover"}arrangement_set(e){if(Wc(e)&&this.view!=="feeds")return`universe layout ${e}: the FEEDS view only (universe view feeds)`;this.replay_end();const t=i=>Wc(i)?i:"hubs",s=t(e)!==t(this.arrangement);return this.litHub=null,this.remember_now(),this.arrangement=e,this.arrangementPill!==null&&(this.arrangementPill.textContent=e.toUpperCase()),this.positions_recalled(e)===void 0&&this.handlers.command_run(`proc layout ${this.sessionLayoutName_of(e)}`),this.inside===null&&this.cluster===null&&(this.scene.arrangement_set(e==="data"?"hubs":e,this.positions_recalled(e),!s),s&&this.paint(!0,this.positions_recalled(e)===void 0?"full":"hold")),this.settings_save(),e==="galaxy"?"the space finds its own shape: every sphere pushing, every edge holding":e==="spokes"?"each molecule a spoke round its hub":e==="clumps"?"molecules packed round their hub":e==="constellations"?"every plugin a star, placed by what runs with what; every feed pulled to the stars it ran":e==="data"?"every feed hung from what it began from: its format, its modality, its series":"the space grown in the order it was made: each feed wandering until it sticks, to its kin more readily than to strangers"}settingsKey_get(){return this.storeKey===null?null:this.storeKey.replace(/^argus\.universe\./,"argus.universe.settings.")}settings_save(){const e=this.settingsKey_get();if(!(this.store===void 0||e===null))try{this.store.setItem(e,JSON.stringify(DE(this.drawMode,this.view,this.scale,this.density,this.arrangement,this.captions)))}catch{}}settings_recall(){const e=this.settingsKey_get();if(this.store===void 0||e===null)return!1;let t=null;try{t=this.store.getItem(e)}catch{return!1}const s=IE(t),i=s.view!==this.view||s.scale!==this.scale;return this.drawMode=s.draw,this.view=s.view,this.scale=s.scale,this.density=s.density,this.arrangement=s.arrangement,this.arrangementPill!==null&&(this.arrangementPill.textContent=s.arrangement.toUpperCase()),this.scene.arrangement_set(s.arrangement==="data"?"hubs":s.arrangement,this.positions_recalled(s.arrangement)),this.drawPill!==null&&(this.drawPill.textContent=s.draw.toUpperCase()),this.viewPill!==null&&(this.viewPill.textContent=s.view.toUpperCase()),this.scalePill!==null&&(this.scalePill.textContent=s.scale==="jobs"?"JOBS":"ALIKE"),this.densityPill!==null&&(this.densityPill.textContent=s.density.toUpperCase()),this.scene.draw_set(s.draw),this.scene.census_set(s.density==="census"),this.captions=s.captions,this.captionsPill!==null&&(this.captionsPill.textContent=s.captions?"CAPTIONS ON":"CAPTIONS OFF"),this.scene.captions_set(s.captions),i}density_set(e){return this.replay_end(),this.density=e,this.densityPill!==null&&(this.densityPill.textContent=e.toUpperCase()),this.scene.census_set(e==="census"),this.settings_save(),e==="census"?"every job its own point":"a stage one sphere, with its count"}physics_reset(){return this.inside!==null||this.cluster!==null?"universe physics: climb out first (universe back)":(this.physics={...tr,gravity:!0},this.physics_apply(),"physics reset")}physics_apply(){this.gravityPill!==null&&(this.gravityPill.textContent=this.physics.gravity?"GRAVITY ON":"GRAVITY OFF"),this.scene.physics_set({...this.physics,reach:this.reach??void 0}),this.title_paint()}view_set(e){if(this.replay_end(),e==="shapes"&&Wc(this.arrangement)&&(this.arrangement="galaxy",this.arrangementPill!==null&&(this.arrangementPill.textContent="GALAXY"),this.scene.arrangement_set("galaxy",this.positions_recalled("galaxy"),!1)),this.remember_now(),this.view=e,this.viewPill!==null&&(this.viewPill.textContent=e.toUpperCase()),this.shown&&this.inside===null&&this.cluster===null){const t=this.positions_recalled(this.arrangement);t!==void 0?(this.scene.positions_seed(t),this.paint(!0,"new")):this.paint(!0,"full")}this.settings_save()}inside_get(){return this.inside?.feedId??null}shown_get(){return this.shown}dispose(){this.disposed=!0,window.removeEventListener("keydown",this.escape_listen),this.repaintTimer!==null&&window.clearTimeout(this.repaintTimer),this.rememberTimer!==null&&window.clearTimeout(this.rememberTimer),this.remember_now(),this.scene.dispose()}space_show(e){this.asking=!1;const t=`${e.whole?"W":"L"}|${e.feeds.map(s=>`${s.id}:${s.jobs}:${s.status}`).join(",")}`;if(this.shown&&t===this.spaceKey){this.title_paint();return}this.spaceKey=t,this.wait.hide(),this.whole=e.whole,this.shown||(this.shown=!0,this.seed_recall()),this.landed.clear(),this.landed.take(e.feeds),this.whole&&(this.warming=""),this.empty.style.display="none",this.canvas.style.display="block",this.inside===null&&this.cluster===null&&this.entering===null&&!this.flying?this.paint(!this.scene.camera_touched()):this.title_paint()}landings_take(e){!this.landed.take(e)||this.repaintTimer!==null||this.inside!==null||this.cluster!==null||this.entering!==null||(this.repaintTimer=window.setTimeout(()=>{this.repaintTimer=null,!(this.disposed||this.entering!==null||this.inside!==null||this.cluster!==null||this.flying)&&this.paint(!this.scene.camera_touched())},KE))}paint(e=!0,t="new"){if(this.sessionWait_holds()){this.title_paint();return}const s=this.view==="shapes"?aM(this.landed.all(),this.scale):this.arrangement==="constellations"?hu(this.landed.all(),this.scale):this.arrangement==="data"?this.dataGraph_paint():this.arrangement==="accretion"?uh(this.landed.all(),this.scale):Fa(this.landed.all(),this.scale),i=this.arrangement==="constellations"?this.lit:null,r=i===null?s:{nodes:s.nodes.map(o=>o.attrs?.kind==="star"||o.attrs?.plugin===i?o:{...o,dim:!0})},a=F0(r.nodes.length);a!==this.reach&&(this.reach=a,this.scene.physics_set({reach:a},!1)),this.scene.graph_set(r,{wave:!1,fit:e,settle:t}),this.title_paint(),this.remember_later()}descend(e,t){this.replay_end();const s=this.landed.get(e),i=this.handlers.feed_dag;if(s===void 0||i===void 0||this.flying||this.inside!==null)return;this.flying=!0,this.facts_clear();const r=iM(e,s);this.entering=e,this.title_paint();const a=Date.now();(l=>{t!==void 0?this.scene.camera_flyToward(t,14,Tr,l):this.scene.camera_flyToFit(r,Tr,l)})(()=>{i(e).then(l=>{if(this.disposed)return;if(this.entering=null,l===null){this.flying=!1,this.title_paint(),this.handlers.note?.(`universe: feed ${e}: the session gave no graph for it (feed diagram feed_${e} refused or answered nothing after ${Math.round((Date.now()-a)/1e3)}s)`);return}const c=TE(l);for(const f of c.nodes)f.solid=!0;const d=this.scene.positions_get(),u=[0,0,0];let h=0;for(const f of[...r,...Pp(Es(s),this.landed)]){const _=d[f];if(_!==void 0&&(u[0]+=_[0],u[1]+=_[1],u[2]+=_[2],h+=1,h===r.length&&r.some(O=>d[O]!==void 0)))break}h>0&&(u[0]/=h,u[1]/=h,u[2]/=h);for(const f of c.nodes)d[f.id]=[u[0]+(Math.random()-.5)*.5,u[1]+(Math.random()-.5)*.5,u[2]+(Math.random()-.5)*.5];this.scene.positions_seed(d);const g=`feed:${e}:`,p=this.view==="feeds"?GE(this.landed.all(),e,c,this.scale,this.arrangement==="constellations",this.arrangement==="data"?hh(this.landed.all(),this.scale).graph:this.arrangement==="accretion"?uh(this.landed.all(),this.scale):void 0):{nodes:[...Lp(this.landed.all(),Es(s),this.scale).graph.nodes.filter(f=>!f.id.startsWith(g)).map(f=>({...f,dim:!0})),...c.nodes]},z=new Set(c.nodes.map(f=>f.id)),m=p.nodes.filter(f=>!z.has(f.id)).map(f=>f.id);this.scene.graph_set(p,{wave:!1,fit:!1,frozen:m,physics:{reach:rd,gravity:!1}}),this.inside={feedId:e,title:l.feedName,entered:c,ids:new Set(c.nodes.map(f=>f.id))},this.pane?.classList.add("universe-inside"),this.title_paint(),this.scene.camera_flyToFit([...this.inside.ids],Tr,()=>this.landed_note(),1,.95)})})}ascend(){if(!this.flying){if(this.framedAt=null,this.inside!==null){if(this.inside=null,this.facts_clear(),this.pane?.classList.remove("universe-inside"),this.cluster!==null){this.cluster_show(this.cluster.shape);return}}else{if(this.cluster===null)return;this.cluster=null,this.pane?.classList.remove("universe-cluster")}this.flying=!0,this.paint(!1),this.scene.camera_flyToFit([],JE,()=>{this.flying=!1})}}cluster_enter(e){this.replay_end(),!(this.flying||this.inside!==null)&&this.cluster_show(e)}cluster_show(e){if(this.view==="feeds"){const d=BE(e,this.landed);if(d.length===0)return;this.flying=!0,this.cluster={shape:e,ids:d},this.pane?.classList.add("universe-cluster");const u=NE(this.landed.all(),e,this.scale);this.scene.graph_set(u,{wave:!1,fit:!1,frozen:u.nodes.map(h=>h.id)}),this.title_paint(),this.scene.camera_flyToFit(d,Tr,()=>this.landed_note());return}const{graph:t,memberIds:s}=Lp(this.landed.all(),e,this.scale);if(s.length===0)return;this.flying=!0,this.cluster={shape:e,ids:s},this.pane?.classList.add("universe-cluster");const i=this.scene.positions_get(),r=Pp(e,this.landed),a=[0,0,0];let o=0;for(const d of r){const u=i[d];u!==void 0&&(a[0]+=u[0],a[1]+=u[1],a[2]+=u[2],o+=1)}o>0&&(a[0]/=o,a[1]/=o,a[2]/=o);const l=new Set(s);for(const d of t.nodes)(l.has(d.id)||d.ghost===!0)&&(i[d.id]=[a[0]+(Math.random()-.5)*.5,a[1]+(Math.random()-.5)*.5,a[2]+(Math.random()-.5)*.5]);this.scene.positions_seed(i);const c=t.nodes.filter(d=>!l.has(d.id)&&d.ghost!==!0).map(d=>d.id);this.scene.graph_set(t,{wave:!1,fit:!1,frozen:c,physics:{reach:rd,gravity:!1}}),this.title_paint(),this.scene.camera_flyToFit(s,Tr,()=>this.landed_note())}landed_note(){this.flying=!1,this.framedAt=this.scene.camera_distance()}pinch_leave(){this.inside===null&&this.cluster===null||this.flying||this.scene.holding_get()||this.framedAt===null||this.scene.camera_distance()<=this.framedAt*eD||this.ascend()}node_dive(e){const t=this.inside?.entered.payloads.get(e.id),s=this.handlers.node_dive;t===void 0||s===void 0||this.flying||this.scene.flight_into(e.id,()=>s(t.vfsPath))}flight_back(e){this.scene.flight_back(e)}node_flyTo(e){if(this.inside===null)return!1;for(const[t,s]of this.inside.entered.payloads){if(s.instanceId!==e)continue;const i=this.handlers.node_dive;return i===void 0?!1:(this.scene.flight_into(t,()=>i(s.vfsPath)),!0)}return!1}node_select(e){if(this.flying)return;if(this.inside===null){const s=sd(e.id);if(s!==null){this.plugin_light(this.lit===s?null:s);return}const i=id(e.id);if(i!==null){this.litHub=this.litHub===i?null:i,this.paint(!1,"hold");return}const r=e.id.match(/^feed:(\d+):\d+$/),a=xm(e.id);r!==null?this.descend(Number(r[1]),e.id):a!==null?this.cluster_enter(a):e.id.startsWith("shape:")&&this.cluster_enter(e.id.slice(6));return}const t=this.inside.entered.payloads.get(e.id);t!==void 0&&this.facts_show(e,t)}facts_show(e,t){if(this.facts===null)return;this.facts.replaceChildren();const s=t.tally,i=[["PLUGIN",t.pluginName],[s?"REP. INSTANCE":"INSTANCE",String(t.instanceId)],["STATUS",t.status],...s?[["COUNT",`×${s.count} — ${s.done} done, ${s.error} err, ${s.running} live`]]:[],["DATA",t.vfsPath]];for(const[l,c]of i){const d=document.createElement("div");d.className="telemetry-row";const u=document.createElement("span");u.className="telemetry-label",u.textContent=l;const h=document.createElement("span");h.className="telemetry-value",h.textContent=c,d.append(u,h),this.facts.append(d)}const r=document.createElement("div");r.className="universe-node-verbs";const a=document.createElement("button");a.className="pacs-capsule universe-node-enter",a.textContent="ENTER NODE",a.title="fly into the node: its data, browsable inside (Esc flies out)",a.addEventListener("click",()=>{this.handlers.node_dive!==void 0?this.node_dive(e):this.handlers.node_enter?.(t.vfsPath)});const o=document.createElement("button");o.className="pacs-capsule universe-node-process",o.textContent="PROCESS",o.title="a catalogue bound to this node's data",o.addEventListener("click",()=>this.handlers.node_process?.({vfsPath:t.vfsPath,instanceId:t.instanceId,label:e.label})),r.append(a,o),this.facts.append(r),this.facts.hidden=!1}facts_clear(){this.facts!==null&&(this.facts.replaceChildren(),this.facts.hidden=!0)}title_paint(){if(this.entering!==null&&this.inside===null){const t=this.landed.get(this.entering);this.title.textContent=`UNIVERSE — ENTERING FEED ${this.entering}${t!==void 0&&t.title.length>0?` · ${t.title}`:""} …`,this.state!==null&&(this.state.classList.remove("state-live","state-settled","state-stale","state-wait"),this.state.classList.add("state-wait"),this.state.textContent="ASKING");return}if(this.inside!==null){const t=this.inside.entered.nodes.reduce((s,i)=>s+(i.count??1),0);this.title.textContent=`UNIVERSE — INSIDE FEED ${this.inside.feedId} · ${this.inside.title} · ${t.toLocaleString("en-US")} JOBS`,this.state!==null&&(this.state.classList.remove("state-live","state-settled","state-stale","state-wait"),this.state.classList.add("state-live"),this.state.textContent="INSIDE");return}if(this.cluster!==null){const t=this.landed.all().filter(s=>Es(s)===this.cluster?.shape).length;this.title.textContent=`UNIVERSE — SHAPE ${rM(this.cluster.shape)} · ${t} FEED${t===1?"":"S"}`,this.state!==null&&(this.state.classList.remove("state-live","state-settled","state-stale","state-wait"),this.state.classList.add("state-live"),this.state.textContent="CLUSTER");return}if(this.asking&&!this.shown){this.title.textContent="UNIVERSE — ASKING THE SESSION …",this.state!==null&&(this.state.classList.remove("state-live","state-settled","state-stale","state-wait"),this.state.classList.add("state-wait"),this.state.textContent="ASKING");return}const e=`${this.landed.size()} FEEDS · ${this.landed.shapes()} SHAPES`;this.title.textContent=this.whole?`UNIVERSE — ${e}`:`UNIVERSE — ${e}${this.warming.length>0?` · ${this.warming}`:" · INDEX WARMING"}`,this.state!==null&&(this.state.classList.remove("state-live","state-settled","state-stale","state-wait"),this.state.classList.add(this.whole?"state-settled":"state-wait"),this.state.textContent=this.whole?"WHOLE":"LANDING"),this.scene.replay_state()!==null&&this.replay_paint()}replay_start(e){if(this.inside!==null||this.cluster!==null)return"universe replay: climb out first (universe back)";if(this.view!=="feeds")return"universe replay: the FEEDS view only (universe view feeds)";if(this.density!=="shape")return"universe replay: SHAPE density only (universe density shape)";if(this.drawMode!=="stars")return"universe replay: it draws stars (universe draw stars)";const t=new Map;for(const o of this.landed.all()){const l=Date.parse(o.createdAt??"");Number.isFinite(l)&&t.set(o.id,l)}if(t.size===0)return"universe replay: the session does not say when its feeds were made (a daemon from before the replay: restart it)";const s=new Map;for(const o of Object.keys(this.scene.positions_get())){const l=o.match(/^feed:(\d+):/),c=l===null?void 0:t.get(Number(l[1]));c!==void 0&&s.set(o,c)}this.facts_clear(),this.replayDay="",this.scene.replay_begin(s,e),this.replay_paint();const i=this.scene.replay_state(),r=new Date(i?.span[0]??0).toISOString().slice(0,10),a=new Date(i?.span[1]??0).toISOString().slice(0,10);return`replaying ${t.size} feeds, ${r} to ${a}, at ×${e} (universe replay pause | stop | at <date>; Esc stops)`}plugin_light(e){this.lit=e,e===null?this.facts_clear():this.pluginFacts_show(e),this.shown&&this.inside===null&&this.cluster===null&&this.paint(!1,"hold")}plugin_frame(e){this.lit!==e&&this.plugin_light(e);const t=[];for(const s of this.landed.all())s.groups.forEach((i,r)=>{i.plugin===e&&t.push(`feed:${s.id}:${r}`)});t.length===0||this.flying||(this.flying=!0,this.scene.camera_flyToFit(t,Tr,()=>{this.flying=!1},.9))}pluginFacts_show(e){if(this.facts===null)return;this.facts.replaceChildren();const t=Cc(`plugin:${e}`,this.landed)??e,[,s="",i=""]=t.split(" · ");for(const[o,l]of[["PLUGIN",e],["FEEDS",s.replace(/ feeds?$/,"")],["ERRORED",i.replace(/ errored$/,"")]]){const c=document.createElement("div");c.className="telemetry-row";const d=document.createElement("span");d.className="telemetry-label",d.textContent=o;const u=document.createElement("span");u.className="telemetry-value",u.textContent=l,c.append(d,u),this.facts.append(c)}const r=document.createElement("div");r.className="universe-node-verbs";const a=document.createElement("button");a.className="pacs-capsule universe-plugin-open",a.textContent="OPEN IN /BIN",a.title="the plugin in the files browser: its one-node graph, its parameters",a.addEventListener("click",()=>this.handlers.plugin_open?.(e)),r.append(a),this.facts.append(r),this.facts.hidden=!1}dataGraph_paint(){const{graph:e,hubs:t}=hh(this.landed.all(),this.scale);this.dataHubs=t;const s=this.litHub;if(s===null)return e;const i=vm(this.landed.all().map(a=>a.data?.seriesDescription).filter(a=>a!==void 0)),r=new Set(this.landed.all().filter(a=>Om(a,i).some(o=>o.key===s)).map(a=>a.id));return{nodes:e.nodes.map(a=>{if(id(a.id)!==null)return a;const o=a.id.match(/^feed:(\d+):/);return o!==null&&r.has(Number(o[1]))?a:{...a,dim:!0}})}}replay_end(){this.scene.replay_state()!==null&&(this.scene.replay_stop(),this.replayDay="",this.title_paint(),this.replay_paint())}replay_paint(){const e=this.scene.replay_state();if(this.replayPill!==null){const s=e!==null&&!e.playing&&e.at>=e.span[1];this.replayPill.textContent=e===null?"REPLAY":e.playing?"PLAYING":s?"REPLAYED":"PAUSED",this.replayPill.classList.toggle("rail-off",e===null)}if(e===null||this.state===null)return;const t=`${e.playing?"REPLAY":"PAUSED"} ${new Date(e.at).toISOString().slice(0,10)}`;t!==this.replayDay&&(this.replayDay=t,this.state.classList.remove("state-live","state-settled","state-stale","state-wait"),this.state.classList.add("state-live"),this.state.textContent=t)}identity_note(e,t){const s=EE(e,t);if(s===this.storeKey)return;this.storeKey=s;const i=this.settings_recall();if(this.shown){const r=this.seed_recall();(i||r)&&this.inside===null&&this.cluster===null&&this.paint(!1)}}positionsKey_of(e){if(this.storeKey===null)return null;const t=e==="galaxy"?this.storeKey:`${this.storeKey}.${e}`;return this.view==="shapes"?`${t}.shapes`:t}positions_recalled(e){const t=this.positionsKey_of(e);if(!(this.store===void 0||t===null))try{const s=Cp(this.store.getItem(t));return Object.keys(s).length>0?s:void 0}catch{return}}seed_recall(){const e=this.positionsKey_of(this.arrangement);if(this.store===void 0||e===null)return!1;const t=Cp(this.store.getItem(e));return Object.keys(t).length===0?!1:(this.scene.positions_seed(t),!0)}remember_later(){this.rememberTimer===null&&(this.rememberTimer=window.setTimeout(()=>{this.rememberTimer=null,this.remember_now()},QE))}remember_now(){if(!(this.store===void 0||this.storeKey===null||!this.shown)&&this.positions_matchView(this.scene.positions_get())){try{const e=this.positionsKey_of(this.arrangement);e!==null&&this.store.setItem(e,JSON.stringify(this.scene.positions_get()))}catch{}this.sessionLayout_put()}}positions_matchView(e){const t=Object.keys(e),s=t.some(r=>r.startsWith("fold:")),i=t.some(r=>r.startsWith("feed:"));return this.view==="shapes"?s&&!i:!s}sessionLayoutName_of(e){return`${e}${this.view==="shapes"?"-shapes":""}${this.scale==="feeds"?"-alike":""}`}sessionLayout_take(e,t,s=null){if((t!==null||!this.sessionPlaces.has(e))&&this.sessionPlaces.set(e,t===null?null:Object.keys(t).length),t===null&&s!==null){this.sessionWait_hold(e,s);return}const i=this.sessionWait?.name===e;if(i&&this.sessionWait_end(),t===null||this.store===void 0){i&&this.shown&&this.paint(!0,"full");return}const r=["galaxy","spokes","clumps","constellations","data","accretion"].find(o=>this.sessionLayoutName_of(o)===e);if(r===void 0||this.positions_recalled(r)!==void 0)return;const a=this.positionsKey_of(r);if(a!==null){try{this.store.setItem(a,JSON.stringify(t))}catch{return}this.putSignatures.set(e,Fp(t)),r===this.arrangement&&this.shown&&this.inside===null&&this.cluster===null&&this.entering===null&&(this.scene.positions_seed(t),this.paint(i,"new"))}}sessionWait_hold(e,t){if(e!==this.sessionLayoutName_of(this.arrangement)||this.positions_recalled(this.arrangement)!==void 0)return;const s=this.sessionWait?.name===e?this.sessionWait.until:Date.now()+XE;if(this.sessionWait?.timer!==void 0&&this.sessionWait?.timer!==null&&window.clearTimeout(this.sessionWait.timer),Date.now()>=s){this.sessionWait_end(),this.shown&&this.paint(!0,"full");return}this.wait.show(`LAYING OUT ${t.nodes.toLocaleString("en-US")} SPHERES · THE SESSION`,t.fraction);const i=window.setTimeout(()=>{this.handlers.command_run(`proc layout ${e}`)},YE);this.sessionWait={name:e,until:s,timer:i}}sessionWait_end(){this.sessionWait?.timer!==void 0&&this.sessionWait?.timer!==null&&window.clearTimeout(this.sessionWait.timer),this.sessionWait=null,this.wait.hide()}sessionWait_holds(){return this.sessionWait!==null&&this.sessionWait.name===this.sessionLayoutName_of(this.arrangement)&&Date.now()<this.sessionWait.until&&this.inside===null&&this.cluster===null}sessionLayout_put(){if(this.inside!==null||this.cluster!==null||this.scene.replay_state()!==null||!this.whole||!qE(this.physics))return;const e={};for(const[i,r]of Object.entries(this.scene.positions_get()))r.every(a=>Number.isFinite(a))&&(e[i]=[Math.round(r[0]*100)/100,Math.round(r[1]*100)/100,Math.round(r[2]*100)/100]);if(Object.keys(e).length===0)return;const t=this.sessionLayoutName_of(this.arrangement),s=Fp(e);this.putSignatures.get(t)!==s&&(this.putSignatures.set(t,s),this.sessionPlaces.set(t,Object.keys(e).length),this.handlers.command_run(`proc layout put ${t} '${JSON.stringify(e).replace(/'/g,"'\\''")}'`))}}const Na=[];function sD(){const n=Na[Na.length-1];return n===void 0?!1:(n(),!0)}function nD(n){const e=n.querySelector(":scope > .pane-drawer");if(e!==null)return e.nextElementSibling;const t=n.querySelector(":scope > .lcars-terminal-header-bar");return t===null?n.firstElementChild:t.nextElementSibling}function kc(n,e){if(n.querySelector(":scope > .ask-bar")!==null)return Promise.resolve(null);const t=document.createElement("div");t.className="ask-bar";const s=document.createElement("span");s.className="ask-bar-glyph",s.textContent="?";const i=document.createElement("span");i.className="ask-bar-caption",i.textContent=e.message.trim(),t.append(s,i);const r=document.createElement("input"),a=document.createElement("button"),o=document.createElement("button"),l=document.createElement("button"),c=document.createElement("button");c.className="pacs-capsule ask-bar-abandon",c.textContent="ABANDON",c.title="abandon the question (Esc)",e.kind==="confirm"?(a.className="pacs-capsule ask-bar-yes",a.textContent="YES",o.className="pacs-capsule ask-bar-no",o.textContent="NO",t.append(a,o,c)):(r.className="ask-bar-field",r.spellcheck=!1,e.kind==="secret"?r.type="password":e.suggest!==void 0&&(r.value=e.suggest),l.className="pacs-capsule ask-bar-commit",l.textContent=e.commit??"ANSWER",t.append(r,l,c));const d=nD(n);return d===null?n.appendChild(t):n.insertBefore(t,d),window.requestAnimationFrame(()=>t.classList.add("ask-bar-shown")),new Promise(u=>{let h=!1;const g=m=>{if(h)return;h=!0;const f=Na.indexOf(p);f>=0&&Na.splice(f,1),t.remove(),u(m)},p=()=>g(null);Na.push(p);const z=()=>{const m=r.value.trim();g(m===""?null:m)};l.addEventListener("click",z),a.addEventListener("click",()=>g("y")),o.addEventListener("click",()=>g("n")),c.addEventListener("click",p),t.addEventListener("keydown",m=>{if(m.key==="Escape"){m.stopPropagation(),p();return}if(e.kind==="confirm"){m.key==="y"||m.key==="Y"?(m.stopPropagation(),g("y")):m.key==="n"||m.key==="N"||m.key==="Enter"&&m.target===o?(m.stopPropagation(),g("n")):m.key==="Enter"&&(m.stopPropagation(),g("y"));return}m.key==="Enter"&&(m.stopPropagation(),z())}),e.kind==="confirm"?a.focus():(r.focus(),r.select())})}const iD={"fs.listing":"files","feed.dag":"dag","feed.list":"dag","pacs.query":"pacs","dicom.series":"image","dicom.tags":"tags"};class rD{result;handlers;constructor(e,t){this.handlers=t,this.result=xa(e,".empty-result");const s=xa(e,".empty-prompt");s.addEventListener("keydown",i=>{i.key==="Enter"&&s.value.trim().length>0&&(this.line_run(s.value.trim()),s.value="")}),xa(e,".empty-go-files").addEventListener("click",()=>{this.line_run("ls .")}),xa(e,".empty-go-dag").addEventListener("click",()=>{this.line_run("proc feeds")}),xa(e,".empty-go-pacs").addEventListener("click",()=>{this.handlers.claim("pacs",[])}),window.setTimeout(()=>s.focus(),0)}async line_run(e){this.result.textContent="…";let t;try{t=await this.handlers.execute(e)}catch(i){this.result.textContent=i instanceof Error?i.message:String(i);return}for(const i of t.envelopes){const r=i.model?.kind!==void 0?iD[i.model.kind]:void 0;if(r!==void 0){this.handlers.claim(r,t.envelopes);return}}const s=t.envelopes.map(i=>i.rendered).join(`
4231
- `);this.result.textContent=aD(s)||"(no output)"}}function xa(n,e){const t=n.querySelector(e);if(t===null)throw new Error(`empty pane template is missing ${e}`);return t}function aD(n){return n.replace(/\x1b\[[0-9;:]*[A-Za-z]/g,"")}class oD{container;title;handlers;currentAddress=null;constructor(e,t,s){this.container=e,this.title=t,this.handlers=s,this.awaiting_render()}regard_show(e){if(this.currentAddress=e.address,this.title.textContent=`VIEWER — ${e.address}`.toUpperCase(),this.handlers.path_isImage(e.address)){this.container.replaceChildren();const t=document.createElement("img");t.className="files-image",t.src=this.handlers.imageUrl_build(e.address),t.alt=e.address,this.container.appendChild(t);return}this.handlers.content_fetch(e.address).then(t=>{if(this.currentAddress!==e.address)return;if(this.container.replaceChildren(),t.trim().length===0){const i=document.createElement("p");i.className="files-empty",i.textContent=`NO PREVIEW — ${e.address.toUpperCase()}`,this.container.appendChild(i);return}const s=document.createElement("pre");s.className="files-content",s.textContent=t,this.container.appendChild(s)})}awaiting_render(){this.container.replaceChildren();const e=document.createElement("p");e.className="files-empty",e.textContent="NO REGARD — INDICATE A FILE OR NODE IN THIS PANE’S GROUP",this.container.appendChild(e)}}const lD="modulepreload",cD=function(n,e){return new URL(n,e).href},jp={},$p=function(e,t,s){let i=Promise.resolve();if(t&&t.length>0){let c=function(d){return Promise.all(d.map(u=>Promise.resolve(u).then(h=>({status:"fulfilled",value:h}),h=>({status:"rejected",reason:h}))))};const a=document.getElementsByTagName("link"),o=document.querySelector("meta[property=csp-nonce]"),l=o?.nonce||o?.getAttribute("nonce");i=c(t.map(d=>{if(d=cD(d,s),d in jp)return;jp[d]=!0;const u=d.endsWith(".css"),h=u?'[rel="stylesheet"]':"";if(s)for(let p=a.length-1;p>=0;p--){const z=a[p];if(z.href===d&&(!u||z.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${d}"]${h}`))return;const g=document.createElement("link");if(g.rel=u?"stylesheet":lD,u||(g.as="script"),g.crossOrigin="",g.href=d,l&&g.setAttribute("nonce",l),document.head.appendChild(g),u)return new Promise((p,z)=>{g.addEventListener("load",p),g.addEventListener("error",()=>z(new Error(`Unable to preload CSS for ${d}`)))})}))}function r(a){const o=new Event("vite:preloadError",{cancelable:!0});if(o.payload=a,window.dispatchEvent(o),!o.defaultPrevented)throw a}return i.then(a=>{for(const o of a||[])o.status==="rejected"&&r(o.reason);return e().catch(r)})},dD=[{label:"",tag:"PatientName"},{label:"MRN",tag:"PatientID"},{label:"ACC",tag:"AccessionNumber"},{label:"",tag:"StudyDescription"},{label:"",tag:"SeriesDescription"},{label:"",tag:"StudyDate"},{label:"",tag:"PatientAge"},{label:"",tag:"PatientSex"}],uD=256*1024*1024;function Ro(n){const e=["B","KB","MB","GB","TB"];let t=n,s=0;for(;t>=1024&&s<e.length-1;)t/=1024,s++;return s===0?`${n} B`:`${t.toFixed(1)} ${e[s]}`}function hD(n){const e=n.toUpperCase();return e==="MR"||e==="CT"||e==="PT"?e:"OT"}class fD{pane;field;title;modeSpan;stateSpan;layoutPills=new Map;overlayPill;colormapPill;savePill;loadPill;retryPill;presetPill;focusMark;guardBytes=uD;forced=!1;pendingLayout=null;progressNote=null;overlayNote=null;probeNote=null;overlay=!1;overlayLines=[];presetIndex=-1;toolPills=new Map;handlers;engine=null;series=null;siblings=[];colormap="gray";tool="wl";constructor(e,t){this.handlers=t,this.pane=e,this.field=Xs(e,".image-field"),this.title=Xs(e,".pane-title"),this.modeSpan=Xs(e,".pane-mode"),this.stateSpan=Xs(e,".pane-state");for(const s of e.querySelectorAll(".image-layout")){const i=s.dataset.layout??"single";this.layoutPills.set(i,s),s.addEventListener("click",()=>{this.layout_set(i)})}this.overlayPill=Xs(e,".image-overlay"),this.overlayPill.addEventListener("click",()=>{this.overlay_set(!this.overlay)}),this.colormapPill=Xs(e,".image-colormap"),this.savePill=Xs(e,".image-save"),this.loadPill=Xs(e,".image-load"),this.retryPill=Xs(e,".image-retry"),this.presetPill=Xs(e,".image-preset"),this.focusMark=Xs(e,".image-focus"),this.field.tabIndex=0,this.colormapPill.addEventListener("click",()=>{this.colormap_cycle()}),this.savePill.addEventListener("click",()=>{this.annotations_save()}),this.loadPill.addEventListener("click",()=>{this.load_press()}),this.retryPill.addEventListener("click",()=>{this.retry_press()}),this.presetPill.addEventListener("click",()=>this.preset_cycle()),Xs(e,".image-tags").addEventListener("click",()=>this.handlers.tags_open());for(const s of dp){const i=Xs(e,`.image-tool[data-tool="${s}"]`);this.toolPills.set(s,i),i.addEventListener("click",()=>{this.tool_set(s)})}this.toolPills_paint(),this.field.addEventListener("mousedown",()=>{this.field.focus(),this.focusMark_paint(!0)}),this.field.addEventListener("focusin",()=>this.focusMark_paint(!0)),this.field.addEventListener("focusout",s=>{(!(s.relatedTarget instanceof Node)||!this.field.contains(s.relatedTarget))&&this.focusMark_paint(!1)}),this.field.addEventListener("keydown",s=>{if(s.key==="Escape"){this.field_release(),s.stopPropagation();return}s.stopPropagation()})}field_hasFocus(){return document.activeElement instanceof Node&&this.field.contains(document.activeElement)}field_release(){return this.field_hasFocus()?(document.activeElement.blur(),this.focusMark_paint(!1),!0):!1}async series_show(e,t={}){if(this.engine_dispose(),this.series=e,this.forced=t.force===!0,this.pendingLayout=null,this.loadPill.hidden=!0,this.retryPill.hidden=!0,this.presets_paint(e.modality),this.siblings=t.siblings??[],this.pane.dataset.modality=hD(e.modality),this.title.textContent=`IMAGE ${e.modality.toUpperCase()} ${e.seriesDescription}`.trim(),this.title.title=this.title.textContent,this.siblings.length>1){const r=this.siblings.findIndex(a=>a.path===e.path)+1;this.handlers.note(`image: series ${r} of ${this.siblings.length} in this study; image series <n> switches`)}const{CornerstoneEngine:s}=await $p(async()=>{const{CornerstoneEngine:r}=await import("./cornerstoneEngine-BIu8DPDK.js").then(a=>a.b2);return{CornerstoneEngine:r}},__vite__mapDeps([0,1]),import.meta.url),i=new s(this.engineHost_get(),e,t.startAt??1);await this.engine_open(i),this.engine===i&&(this.guard_trips()?(this.loadPill.hidden=!1,this.stateSpan.textContent=`SERIES ${Ro(e.bytes)} · LOAD FOR STACK`,this.handlers.note(`image: ${Ro(e.bytes)} to fetch before the stack scrolls; press LOAD, image load, or image --force <path>`)):i.slices_fill(),await this.annotations_reload(i,e))}async annotations_reload(e,t){let s=0;for(const i of t.annotations.filter(r=>/\.dcm$/i.test(r))){if(this.engine!==e)return;const r=i.split("/").pop()??i;try{const a=await fetch(this.handlers.source.url_of(i));if(!a.ok){this.handlers.note(`image: ${r}: HTTP ${a.status}`);continue}const o=await e.annotations_import(await a.arrayBuffer());s+=o,this.handlers.note(o>0?`image: ${o} measurement${o===1?"":"s"} from ${r}`:`image: ${r}: no measurements this engine can place`)}catch(a){this.handlers.note(`image: ${r}: ${a instanceof Error?a.message:String(a)}`)}}this.pane.dataset.annotations=String(s)}async volume_show(e){this.engine_dispose(),this.series=null,this.siblings=[],this.pane.dataset.modality="NIFTI",this.title.textContent=`IMAGE ${e.split("/").pop()??""}`,this.title.title=e,this.forced=!0,this.loadPill.hidden=!0,this.retryPill.hidden=!0,this.presets_paint("NIFTI");const{NiivueEngine:t}=await $p(async()=>{const{NiivueEngine:s}=await import("./niivueEngine-DswitPEw.js");return{NiivueEngine:s}},[],import.meta.url);await this.engine_open(new t(this.engineHost_get(),e))}opening_show(e){const t=e.replace(/\/$/,"").split("/").pop()??e;this.stateSpan.textContent="OPENING",this.progress_show({label:`OPENING ${t}`,done:0,total:0})}opening_fail(e,t){this.stateSpan.textContent=t,this.progress_show({label:t,done:0,total:0});const s=this.progressNote;s!==null&&(s.classList.add("image-working-failed"),s.querySelector(".image-working-count").textContent=e)}siblings_get(){return this.siblings}series_get(){return this.series}state_get(){return this.engine===null?null:{...this.engine.state_get(),colormap:this.colormap,path:this.series?.path??null,guard:this.guardBytes,waiting:this.pendingLayout}}async layout_set(e){if(this.engine===null)return!1;if(e!=="single"&&this.guard_trips())return this.pendingLayout=e,this.loadPill.hidden=!1,this.stateSpan.textContent=`SERIES ${Ro(this.series?.bytes??0)} · LOAD FOR ${e.toUpperCase()}`,this.handlers.note(`image: ${Ro(this.series?.bytes??0)} to fetch for ${e}; press LOAD, image load, or image --force <path>`),!1;const t=this.engine.state_get().layout;return this.layoutPills_paint(e),this.modeSpan.textContent=e==="single"?"":e.toUpperCase(),this.overlay_hide(),await this.engine.layout_set(e)?(this.progress_show(null),this.overlay_paint(),this.toolPills_paint(),!0):(this.progress_show(null),this.layoutPills_paint(t),this.modeSpan.textContent=t==="single"?"":t.toUpperCase(),this.handlers.note(`image: layout ${e}: not offered by ${this.engine.name}`),!1)}layoutPills_paint(e){for(const[t,s]of this.layoutPills)s.classList.toggle("rail-off",t!==e)}guard_trips(){return this.guardBytes!==null&&!this.forced&&this.engine?.name==="cornerstone"&&(this.series?.bytes??0)>this.guardBytes}async load_press(){this.forced=!0,this.loadPill.hidden=!0,this.retryPill.hidden=!0;const e=this.pendingLayout;return this.pendingLayout=null,e!==null?this.layout_set(e):this.engine===null||this.engine.state_get().filled?!1:this.engine.slices_fill()}guard_set(e){this.guardBytes=e}guard_get(){return this.guardBytes}preset_cycle(){const e=this.presets_for(this.series?.modality??"NIFTI");if(e.length===0)return;this.presetIndex=(this.presetIndex+1)%e.length;const t=e[this.presetIndex];t!==void 0&&this.wl_set(t.lower,t.upper)&&(this.presetPill.textContent=t.name.toUpperCase())}presets_for(e){const t=e.toUpperCase();return $g.filter(s=>s.modalities.length===0||s.modalities.includes(t))}presets_paint(e){this.presetIndex=-1;const t=this.presets_for(e);this.presetPill.hidden=t.length===0,this.presetPill.textContent="PRESET"}slice_set(e){if(this.engine===null)return!1;const t=this.engine.slice_set(e);return t||this.handlers.note(`image: slice ${e}: not offered in ${this.engine.state_get().layout} layout by ${this.engine.name}`),t}wl_set(e,t){if(this.engine===null)return!1;const s=this.engine.wl_set(e,t);return s||this.handlers.note(`image: wl: not offered by ${this.engine.name}`),s}ghost_set(e){if(this.engine===null)return!1;const t=this.engine.ghost_set(e);return t||this.handlers.note("image: ghost applies to the SLAB layout"),t}wlPreset_set(e){const t=this.series?.modality??"NIFTI",s=VA(e,t);return s===void 0?(this.handlers.note(`image: wl preset ${e}: none for ${t}`),!1):this.wl_set(s.lower,s.upper)}colormap_set(e){return this.engine===null?!1:this.engine.colormap_set(e)?(this.colormap=e,this.colormapPill.textContent=e.toUpperCase(),!0):(this.handlers.note(`image: colormap ${e}: not offered by ${this.engine.name}`),!1)}tool_set(e){return this.engine===null?!1:this.engine.tool_set(e)?(this.tool=e,this.toolPills_paint(),!0):(this.handlers.note(`image: ${e}: not offered by ${this.engine.name}`),!1)}async annotations_save(){if(this.engine===null)return!1;const e=this.series?.seriesInstanceUID,t=/^(\/home\/[^/]+)\//.exec(this.series?.path??"")?.[1];if(e===void 0||t===void 0)return this.handlers.note("image: save: this series has no UID to file an annotation under"),!1;const s=await this.engine.annotations_export();if(s===null)return this.handlers.note(`image: save: nothing measured, or ${this.engine.name} writes no report`),!1;const i=`${t}/annotations/${e}/measurements.dcm`,r=await this.handlers.file_put(i,s);return this.handlers.note(r===200?`✓ ${i}`:`image: save: ${i}: HTTP ${r}`),r===200}dispose(){this.engine_dispose()}async colormap_cycle(){const e=Xo[(Xo.indexOf(this.colormap)+1)%Xo.length]??"gray";this.colormap_set(e)}async engine_open(e){this.engine=e,this.field.replaceChildren(),this.progressNote=null,this.overlayNote=null,this.probeNote=null,this.layoutPills_paint("single"),this.modeSpan.textContent="",this.colormapPill.textContent=this.colormap.toUpperCase();try{await e.open(this.field)}catch(s){this.stateSpan.textContent="REFUSED",this.handlers.note(`image: ${s instanceof Error?s.message:String(s)}`);return}const t=e.state_get().layout;this.layoutPills_paint(t),this.modeSpan.textContent=t==="single"?"":t.toUpperCase(),e.tool_set(this.tool),this.toolPills_paint(),this.progress_show(null),this.overlay_fill()}engine_dispose(){this.engine?.dispose(),this.engine=null,this.progressNote=null,this.overlayNote=null,this.probeNote=null,this.field.replaceChildren(),this.stateSpan.textContent=""}retryPill_paint(){const e=this.engine===null?0:this.engine.state_get().refused,t=this.engine?.refused_retry!==void 0;this.retryPill.hidden=!t||e===0,this.retryPill.disabled||(this.retryPill.textContent=`RETRY ${e}`)}async retry_press(){if(!(this.engine?.refused_retry===void 0||this.retryPill.disabled)){this.retryPill.disabled=!0,this.retryPill.textContent="ASKING…";try{await this.engine.refused_retry()}finally{this.retryPill.disabled=!1,this.retryPill_paint()}}}engineHost_get(){return{source:this.handlers.source,readout_set:e=>{this.stateSpan.textContent=e,this.retryPill_paint()},progress_set:e=>this.progress_show(e),note:this.handlers.note,regard:e=>{this.handlers.regard(e),this.overlaySlice_paint()},probe_set:e=>this.probe_show(e)}}probe_show(e){if(e===null){this.probeNote?.remove(),this.probeNote=null;return}if(this.probeNote===null||this.probeNote.parentElement===null){const t=document.createElement("div");t.className="image-probe-note",this.field.appendChild(t),this.probeNote=t}this.probeNote.textContent=e}overlaySlice_paint(){const e=this.overlayNote?.querySelector(".image-overlay-slice")??null;if(e===null||this.engine===null)return;const t=this.engine.state_get();e.textContent=t.slices>1?`SLICE ${Math.max(1,t.slice)} OF ${t.slices}`:"",e.hidden=t.slices<=1}progress_show(e){if(e===null){this.progressNote?.remove(),this.progressNote=null;return}if(this.progressNote===null||this.progressNote.parentElement===null){const a=document.createElement("div");a.className="image-working",a.innerHTML='<span class="image-working-label"></span><span class="image-working-track"><span class="image-working-fill"></span></span><span class="image-working-count"></span>',this.field.appendChild(a),this.progressNote=a}const t=this.progressNote;t.classList.remove("image-working-failed");const s=e.total>0,i=s?Math.min(1,e.done/e.total):0;t.querySelector(".image-working-label").textContent=e.label,t.querySelector(".image-working-count").textContent=s?`${e.done} / ${e.total} · ${Math.round(i*100)}%`:"";const r=t.querySelector(".image-working-fill");r.classList.toggle("image-working-pacing",!s),r.style.width=s?`${Math.round(i*100)}%`:""}async overlay_set(e){if(this.overlay=e,this.overlayPill.textContent=e?"OVERLAY ON":"OVERLAY OFF",this.overlayPill.classList.toggle("rail-off",!e),!e){this.overlay_hide();return}await this.overlay_fill()}overlay_hide(){this.overlayNote?.remove(),this.overlayNote=null}async overlay_fill(){if(!this.overlay||this.series===null)return;const e=this.series.files[0]??this.series.path,t=await this.handlers.tags_read(e);if(t===null){this.handlers.note(`image: overlay: ${e}: no header to read`);return}this.overlayLines=dD.flatMap(s=>{const r=(t.constant.find(a=>a.name===s.tag)?.value??"").trim();return r===""?[]:[s.label===""?r:`${s.label} ${r}`]}),this.overlay_paint()}overlay_paint(){if(!this.overlay||this.overlayLines.length===0)return;this.overlay_hide();const e=document.createElement("div");e.className="image-overlay-note";const t=document.createElement("span");t.className="image-overlay-slice",e.appendChild(t);for(const s of this.overlayLines){const i=document.createElement("span");i.textContent=s,e.appendChild(i)}this.field.appendChild(e),this.overlayNote=e,this.overlaySlice_paint()}toolPills_paint(){const e=new Set(this.engine?.toolsOffered_get()??dp),t=this.engine!==null?this.engine.state_get().primaryTool:this.tool;for(const[s,i]of this.toolPills){const r=e.has(s);i.classList.toggle("rail-na",!r),i.classList.toggle("rail-off",r&&s!==t),i.disabled=!r}}focusMark_paint(e){this.focusMark.hidden=!e,this.pane.classList.toggle("image-field-focused",e)}}function Xs(n,e){const t=n.querySelector(e);if(t===null)throw new Error(`image pane: missing ${e}`);return t}const cM=["patient","study","series","image","equipment","meta","private","other","varying"],pD=new Set(["meta","private"]),Vp="••••";class mD{pane;title;modeSpan;redactBlock;listing;handlers;redact=!0;model=null;groups=[];constructor(e,t){this.handlers=t,this.pane=e,this.title=Bo(e,".pane-title"),this.modeSpan=Bo(e,".pane-mode"),this.redactBlock=Bo(e,".tags-redact"),this.redactBlock.addEventListener("click",()=>this.redact_set(!this.redact));const s=Bo(e,".tags-panel");this.listing=new Qr({mount:s,traits:this.groupTraits_declare(),key:i=>i.group,chrome:{root:e,prefix:"tags"},caps:"root",row:{className:()=>"tags-group-row",groupClassName:i=>`tags-group tags-group-${i.group}`,decorate:i=>{i.title="fold this group open or shut (it keeps its place)"}},child:kr(i=>i.rows,{traits:this.tagTraits_declare(),key:i=>i.key,activatable:i=>i.items.length>0,row:{className:i=>`tags-row${i.phi?" tags-phi":""}`,groupClassName:()=>"tags-sequence",decorate:(i,r)=>{i.title=r.items.length>0?`${r.name}: fold the sequence open or shut`:`${r.tag} ${r.name}`}},child:kr(i=>i.items,{traits:this.itemTraits_declare(),key:i=>i.key,row:{className:()=>"tags-item-row",groupClassName:()=>"tags-item"},child:kr(i=>i.rows,{traits:this.tagTraits_declare(),key:i=>i.key,activatable:()=>!1,row:{className:i=>`tags-row tags-row-deep${i.phi?" tags-phi":""}`}})})}),state:i=>this.stateLine_compose(i),empty:()=>zD("NO TAGS")}),this.redactBlock_paint(),this.listing.rows_set([],{field:"tags"})}model_show(e){this.model=e,this.title.textContent=`TAGS ${MD(e)}`,this.pane.dataset.modality=bD(e),this.groups=gD(e),this.listing.rows_set([{key:e.path,rows:this.groups}],{field:e.path}),this.listing.open_set(0,this.groups.map(t=>t.group).filter(t=>!pD.has(t))),this.modeSpan.textContent=e.subject==="folder"?"FOLDER":""}path_get(){return this.model?.path??null}redact_get(){return this.redact}redact_set(e){this.redact=e,this.redactBlock_paint(),this.model!==null&&this.listing.rows_set([{key:this.model.path,rows:this.groups}],{field:this.model.path})}filter_set(e){if(e===null){this.listing.filter_toggle(!1);return}this.listing.filter_toggle(!0),this.listing.filter_set(e)}stateLine_compose(e){const t=this.groups.reduce((i,r)=>i+r.rows.length,0),s=[];return this.model!==null&&this.model.subject==="folder"&&(s.push(this.model.read===this.model.of?`${this.model.read} FILES`:`${this.model.read} OF ${this.model.of} FILES`),this.model.refused.length>0&&s.push(`REFUSED ${this.model.refused.length}`)),s.push(e.filter!==""?e.filter:`${t} TAGS`),this.redact&&s.push("REDACTED"),s.join(" · ")}redactBlock_paint(){this.redactBlock.textContent=this.redact?"REDACT ON":"REDACT OFF",this.redactBlock.classList.toggle("rail-off",!this.redact),this.pane.classList.toggle("tags-redacted",this.redact)}value_cell(e){const t=document.createElement("span");if(t.className="tags-value",e.phi&&this.redact)return t.textContent=Vp,t.title="identifying value, redacted; the REDACT block on the frame reveals it",t;if(t.textContent=e.value,e.decoded!==void 0){const s=document.createElement("span");s.className="tags-decoded",s.textContent=` ${e.decoded}`,t.appendChild(s)}if(e.distinct!==void 0){const s=document.createElement("span");s.className="tags-decoded",s.textContent=` (${e.distinct} distinct)`,t.appendChild(s)}return t}groupTraits_declare(){return[Uc(()=>!0),{key:"group",label:"GROUP",className:"tags-group-name",width:"minmax(12em, 1fr)",cell:e=>e.group.toUpperCase(),compare:e=>cM.indexOf(e.group)},{key:"count",label:"TAGS",className:"tags-group-count",width:"5em",cell:e=>String(e.rows.length),compare:e=>e.rows.length}]}tagTraits_declare(){return[Uc(e=>e.items.length>0),{key:"tag",label:"TAG",className:"tags-tag",width:"7em",cell:e=>e.tag,compare:e=>e.tag},{key:"name",label:"NAME",className:"tags-name",width:"minmax(8em, 1.4fr)",cell:e=>e.name,compare:e=>e.name.toLowerCase()},{key:"vr",label:"VR",className:"tags-vr",width:"2.4em",cell:e=>e.vr,compare:e=>e.vr},{key:"value",label:"VALUE",className:"tags-value-cell",width:"minmax(6em, 2fr)",cell:e=>this.value_cell(e),compare:e=>(e.phi&&this.redact?Vp:`${e.value} ${e.decoded??""}`).toLowerCase()}]}itemTraits_declare(){return[Uc(()=>!0),{key:"item",label:"ITEM",className:"tags-item-name",width:"minmax(12em, 1fr)",cell:e=>`ITEM ${e.index}`,compare:e=>e.index},{key:"count",label:"TAGS",className:"tags-group-count",width:"5em",cell:e=>String(e.rows.length),compare:e=>e.rows.length}]}}function Uc(n){return{key:"fold",label:"",className:"tags-fold",capped:!1,width:"1.4em",cell:e=>{const t=document.createElement("span");return t.className=n(e)?"tags-fold":"tags-fold tags-fold-none",t}}}function gD(n){const e=new Map;for(const t of n.constant){const s=t.group;e.has(s)||e.set(s,[]),e.get(s)?.push(dM(t,`${s}/${t.tag}`))}return n.varying.length>0&&e.set("varying",n.varying.map(t=>({tag:t.tag,name:t.name,vr:t.vr,value:t.distinct===1?t.first:`${t.first} .. ${t.last}`,phi:t.phi,items:[],distinct:t.distinct,key:`varying/${t.tag}`}))),cM.filter(t=>e.has(t)).map(t=>({group:t,rows:e.get(t)??[]}))}function dM(n,e){return{tag:n.tag,name:n.name,vr:n.vr,value:n.value,...n.decoded!==void 0?{decoded:n.decoded}:{},phi:n.phi,items:(n.items??[]).map((t,s)=>({index:s+1,key:`${e}/${s+1}`,rows:t.map(i=>dM(i,`${e}/${s+1}/${i.tag}`))})),key:e}}function MD(n){const e=n.path.replace(/\/$/,"").split("/").pop()??n.path;if(n.subject==="folder")return e.length>24?`${e.slice(0,22)}…`:e;const t=/^(\d+)-/.exec(e)?.[1];return t!==void 0?`INSTANCE ${Number(t)}`:e.length>24?`${e.slice(0,22)}…`:e}function bD(n){const e=(n.constant.find(t=>t.name==="Modality")?.value??"").toUpperCase();return e==="MR"||e==="CT"||e==="PT"?e:"OT"}function zD(n){const e=document.createElement("div");return e.className="tags-note",e.textContent=n,e}function Bo(n,e){const t=n.querySelector(e);if(t===null)throw new Error(`tags pane: missing ${e}`);return t}class _D{groups=new Map;membership=new Map;writeObserver=null;writeObserver_set(e){this.writeObserver=e}pane_join(e,t){this.pane_leave(e),this.membership.set(e,t),this.groups.has(t)||this.groups.set(t,{value:null,subscribers:new Map,viewers:new Set})}pane_leave(e){const t=this.membership.get(e);if(t===void 0)return;this.membership.delete(e);const s=this.groups.get(t);if(s!==void 0){s.subscribers.delete(e),s.viewers.delete(e);for(const i of this.membership.values())if(i===t)return;this.groups.delete(t)}}group_of(e){const t=this.membership.get(e);return t!==void 0?t:(this.pane_join(e,e),e)}viewer_mark(e){this.groups.get(this.group_of(e))?.viewers.add(e)}groupHasViewer(e){const t=this.groups.get(this.group_of(e));return t!==void 0&&t.viewers.size>0}regard_write(e,t){const s=this.group_of(e),i=this.groups.get(s),r={...t,paneId:e};i.value=r;for(const a of i.subscribers.values())a(r);this.writeObserver?.(r,s)}regard_subscribe(e,t){const s=this.groups.get(this.group_of(e));s.subscribers.set(e,t),s.value!==null&&t(s.value)}regard_get(e){return this.groups.get(this.group_of(e))?.value??null}}const Fc=["⣾","⣽","⣻","⢿","⡿","⣟","⣯","⣷"],wD=new Set(["done","error","unconfirmed","stalled","timeout"]);function yD(n,e){const t=`${e.operation}:${e.itemId??""}`;if(e.phase==="complete"||e.phase==="failed"){const s=`${e.operation}:`;for(const i of[...n])(i===t||i.startsWith(s))&&n.delete(i);return}if(e.itemId!==void 0&&e.status!==void 0&&wD.has(e.status)){n.delete(t);return}n.add(t)}const vD=100;class OD{fields;running=new Set;activityTimer=null;activityFrame=0;constructor(e){this.fields={identity:Pi(e,"status-identity"),jobs:Pi(e,"status-jobs"),activity:Pi(e,"status-activity"),latency:Pi(e,"status-latency"),mismatch:Pi(e,"status-mismatch"),lamp:Pi(e,"status-lamp"),host:Pi(e,"status-host")}}attach_show(e){if(e.protocolVersion!==Vc){this.fields.mismatch.textContent=`WIRE V${e.protocolVersion} ≠ V${Vc}`,this.fields.mismatch.title="This surface and the daemon speak different contract versions. Some messages may be dropped.",this.hostControl_show(e.hostControl??[]);return}this.fields.mismatch.textContent="",this.fields.mismatch.title=e.stack!==void 0?`chell ${e.stack.chell} · calypso ${e.stack.calypso} · build ${e.stack.build}`:"",this.hostControl_show(e.hostControl??[])}hostControl_show(e){this.fields.host.textContent=e.length>0?`HOST ${e.join(" ")}`:"",this.fields.host.title=e.length>0?"Calypso was started with --host-control: `!` and pipes run on its host, upload/download reach its disk.":""}promptContext_show(e){const t=e.uri.replace(/^https?:\/\//,"");this.fields.identity.textContent=`${e.user}@${t}`.toUpperCase();const s=e.procWarmup,i=[];if(s!==void 0&&s.sweeping!==!1){const o=s.total!==void 0?`/${s.total}`:"",l=s.state!==void 0?` ${s.state.toUpperCase()}`:"";i.push(`JOBS ${s.loaded}${o}${l}`)}const r=s?.feeds??(s?.feed!==void 0?[s.feed]:[]);for(const o of r){const l=o.total>0?`/${o.total}`:"";i.push(o.failed!==void 0?`FEED ${o.id} FAILED ${o.loaded}${l}`:`FEED ${o.id} ${o.loaded}${l}`)}s?.roster!==void 0&&i.push(s.roster==="full"?"ROSTER WALK":"ROSTER DELTA"),s?.arrived!==void 0&&s.arrived.length>0&&i.push(s.arrived.length<=2?`+FEED ${s.arrived.join(" ")}`:`+${s.arrived.length} FEEDS`);const a=e.warmupFailures??[];a.length>0&&i.push(`WARM-UP FAILED: ${a.map(o=>o.label.toUpperCase()).join(" ")}`),this.fields.jobs.textContent=i.join(" · "),this.fields.jobs.classList.toggle("status-degraded",a.length>0),this.fields.jobs.title=a.length>0?a.map(o=>`${o.label}: ${o.message}`).join(`
4231
+ `);this.result.textContent=aD(s)||"(no output)"}}function xa(n,e){const t=n.querySelector(e);if(t===null)throw new Error(`empty pane template is missing ${e}`);return t}function aD(n){return n.replace(/\x1b\[[0-9;:]*[A-Za-z]/g,"")}class oD{container;title;handlers;currentAddress=null;constructor(e,t,s){this.container=e,this.title=t,this.handlers=s,this.awaiting_render()}regard_show(e){if(this.currentAddress=e.address,this.title.textContent=`VIEWER — ${e.address}`.toUpperCase(),this.handlers.path_isImage(e.address)){this.container.replaceChildren();const t=document.createElement("img");t.className="files-image",t.src=this.handlers.imageUrl_build(e.address),t.alt=e.address,this.container.appendChild(t);return}this.handlers.content_fetch(e.address).then(t=>{if(this.currentAddress!==e.address)return;if(this.container.replaceChildren(),t.trim().length===0){const i=document.createElement("p");i.className="files-empty",i.textContent=`NO PREVIEW — ${e.address.toUpperCase()}`,this.container.appendChild(i);return}const s=document.createElement("pre");s.className="files-content",s.textContent=t,this.container.appendChild(s)})}awaiting_render(){this.container.replaceChildren();const e=document.createElement("p");e.className="files-empty",e.textContent="NO REGARD — INDICATE A FILE OR NODE IN THIS PANE’S GROUP",this.container.appendChild(e)}}const lD="modulepreload",cD=function(n,e){return new URL(n,e).href},jp={},$p=function(e,t,s){let i=Promise.resolve();if(t&&t.length>0){let c=function(d){return Promise.all(d.map(u=>Promise.resolve(u).then(h=>({status:"fulfilled",value:h}),h=>({status:"rejected",reason:h}))))};const a=document.getElementsByTagName("link"),o=document.querySelector("meta[property=csp-nonce]"),l=o?.nonce||o?.getAttribute("nonce");i=c(t.map(d=>{if(d=cD(d,s),d in jp)return;jp[d]=!0;const u=d.endsWith(".css"),h=u?'[rel="stylesheet"]':"";if(s)for(let p=a.length-1;p>=0;p--){const z=a[p];if(z.href===d&&(!u||z.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${d}"]${h}`))return;const g=document.createElement("link");if(g.rel=u?"stylesheet":lD,u||(g.as="script"),g.crossOrigin="",g.href=d,l&&g.setAttribute("nonce",l),document.head.appendChild(g),u)return new Promise((p,z)=>{g.addEventListener("load",p),g.addEventListener("error",()=>z(new Error(`Unable to preload CSS for ${d}`)))})}))}function r(a){const o=new Event("vite:preloadError",{cancelable:!0});if(o.payload=a,window.dispatchEvent(o),!o.defaultPrevented)throw a}return i.then(a=>{for(const o of a||[])o.status==="rejected"&&r(o.reason);return e().catch(r)})},dD=[{label:"",tag:"PatientName"},{label:"MRN",tag:"PatientID"},{label:"ACC",tag:"AccessionNumber"},{label:"",tag:"StudyDescription"},{label:"",tag:"SeriesDescription"},{label:"",tag:"StudyDate"},{label:"",tag:"PatientAge"},{label:"",tag:"PatientSex"}],uD=256*1024*1024;function Ro(n){const e=["B","KB","MB","GB","TB"];let t=n,s=0;for(;t>=1024&&s<e.length-1;)t/=1024,s++;return s===0?`${n} B`:`${t.toFixed(1)} ${e[s]}`}function hD(n){const e=n.toUpperCase();return e==="MR"||e==="CT"||e==="PT"?e:"OT"}class fD{pane;field;title;modeSpan;stateSpan;layoutPills=new Map;overlayPill;colormapPill;savePill;loadPill;retryPill;presetPill;focusMark;guardBytes=uD;forced=!1;pendingLayout=null;progressNote=null;overlayNote=null;probeNote=null;overlay=!1;overlayLines=[];presetIndex=-1;toolPills=new Map;handlers;engine=null;series=null;siblings=[];colormap="gray";tool="wl";constructor(e,t){this.handlers=t,this.pane=e,this.field=Xs(e,".image-field"),this.title=Xs(e,".pane-title"),this.modeSpan=Xs(e,".pane-mode"),this.stateSpan=Xs(e,".pane-state");for(const s of e.querySelectorAll(".image-layout")){const i=s.dataset.layout??"single";this.layoutPills.set(i,s),s.addEventListener("click",()=>{this.layout_set(i)})}this.overlayPill=Xs(e,".image-overlay"),this.overlayPill.addEventListener("click",()=>{this.overlay_set(!this.overlay)}),this.colormapPill=Xs(e,".image-colormap"),this.savePill=Xs(e,".image-save"),this.loadPill=Xs(e,".image-load"),this.retryPill=Xs(e,".image-retry"),this.presetPill=Xs(e,".image-preset"),this.focusMark=Xs(e,".image-focus"),this.field.tabIndex=0,this.colormapPill.addEventListener("click",()=>{this.colormap_cycle()}),this.savePill.addEventListener("click",()=>{this.annotations_save()}),this.loadPill.addEventListener("click",()=>{this.load_press()}),this.retryPill.addEventListener("click",()=>{this.retry_press()}),this.presetPill.addEventListener("click",()=>this.preset_cycle()),Xs(e,".image-tags").addEventListener("click",()=>this.handlers.tags_open());for(const s of dp){const i=Xs(e,`.image-tool[data-tool="${s}"]`);this.toolPills.set(s,i),i.addEventListener("click",()=>{this.tool_set(s)})}this.toolPills_paint(),this.field.addEventListener("mousedown",()=>{this.field.focus(),this.focusMark_paint(!0)}),this.field.addEventListener("focusin",()=>this.focusMark_paint(!0)),this.field.addEventListener("focusout",s=>{(!(s.relatedTarget instanceof Node)||!this.field.contains(s.relatedTarget))&&this.focusMark_paint(!1)}),this.field.addEventListener("keydown",s=>{if(s.key==="Escape"){this.field_release(),s.stopPropagation();return}s.stopPropagation()})}field_hasFocus(){return document.activeElement instanceof Node&&this.field.contains(document.activeElement)}field_release(){return this.field_hasFocus()?(document.activeElement.blur(),this.focusMark_paint(!1),!0):!1}async series_show(e,t={}){if(this.engine_dispose(),this.series=e,this.forced=t.force===!0,this.pendingLayout=null,this.loadPill.hidden=!0,this.retryPill.hidden=!0,this.presets_paint(e.modality),this.siblings=t.siblings??[],this.pane.dataset.modality=hD(e.modality),this.title.textContent=`IMAGE ${e.modality.toUpperCase()} ${e.seriesDescription}`.trim(),this.title.title=this.title.textContent,this.siblings.length>1){const r=this.siblings.findIndex(a=>a.path===e.path)+1;this.handlers.note(`image: series ${r} of ${this.siblings.length} in this study; image series <n> switches`)}const{CornerstoneEngine:s}=await $p(async()=>{const{CornerstoneEngine:r}=await import("./cornerstoneEngine-CS_xx5cA.js").then(a=>a.b2);return{CornerstoneEngine:r}},__vite__mapDeps([0,1]),import.meta.url),i=new s(this.engineHost_get(),e,t.startAt??1);await this.engine_open(i),this.engine===i&&(this.guard_trips()?(this.loadPill.hidden=!1,this.stateSpan.textContent=`SERIES ${Ro(e.bytes)} · LOAD FOR STACK`,this.handlers.note(`image: ${Ro(e.bytes)} to fetch before the stack scrolls; press LOAD, image load, or image --force <path>`)):i.slices_fill(),await this.annotations_reload(i,e))}async annotations_reload(e,t){let s=0;for(const i of t.annotations.filter(r=>/\.dcm$/i.test(r))){if(this.engine!==e)return;const r=i.split("/").pop()??i;try{const a=await fetch(this.handlers.source.url_of(i));if(!a.ok){this.handlers.note(`image: ${r}: HTTP ${a.status}`);continue}const o=await e.annotations_import(await a.arrayBuffer());s+=o,this.handlers.note(o>0?`image: ${o} measurement${o===1?"":"s"} from ${r}`:`image: ${r}: no measurements this engine can place`)}catch(a){this.handlers.note(`image: ${r}: ${a instanceof Error?a.message:String(a)}`)}}this.pane.dataset.annotations=String(s)}async volume_show(e){this.engine_dispose(),this.series=null,this.siblings=[],this.pane.dataset.modality="NIFTI",this.title.textContent=`IMAGE ${e.split("/").pop()??""}`,this.title.title=e,this.forced=!0,this.loadPill.hidden=!0,this.retryPill.hidden=!0,this.presets_paint("NIFTI");const{NiivueEngine:t}=await $p(async()=>{const{NiivueEngine:s}=await import("./niivueEngine-DHYlBzV1.js");return{NiivueEngine:s}},[],import.meta.url);await this.engine_open(new t(this.engineHost_get(),e))}opening_show(e){const t=e.replace(/\/$/,"").split("/").pop()??e;this.stateSpan.textContent="OPENING",this.progress_show({label:`OPENING ${t}`,done:0,total:0})}opening_fail(e,t){this.stateSpan.textContent=t,this.progress_show({label:t,done:0,total:0});const s=this.progressNote;s!==null&&(s.classList.add("image-working-failed"),s.querySelector(".image-working-count").textContent=e)}siblings_get(){return this.siblings}series_get(){return this.series}state_get(){return this.engine===null?null:{...this.engine.state_get(),colormap:this.colormap,path:this.series?.path??null,guard:this.guardBytes,waiting:this.pendingLayout}}async layout_set(e){if(this.engine===null)return!1;if(e!=="single"&&this.guard_trips())return this.pendingLayout=e,this.loadPill.hidden=!1,this.stateSpan.textContent=`SERIES ${Ro(this.series?.bytes??0)} · LOAD FOR ${e.toUpperCase()}`,this.handlers.note(`image: ${Ro(this.series?.bytes??0)} to fetch for ${e}; press LOAD, image load, or image --force <path>`),!1;const t=this.engine.state_get().layout;return this.layoutPills_paint(e),this.modeSpan.textContent=e==="single"?"":e.toUpperCase(),this.overlay_hide(),await this.engine.layout_set(e)?(this.progress_show(null),this.overlay_paint(),this.toolPills_paint(),!0):(this.progress_show(null),this.layoutPills_paint(t),this.modeSpan.textContent=t==="single"?"":t.toUpperCase(),this.handlers.note(`image: layout ${e}: not offered by ${this.engine.name}`),!1)}layoutPills_paint(e){for(const[t,s]of this.layoutPills)s.classList.toggle("rail-off",t!==e)}guard_trips(){return this.guardBytes!==null&&!this.forced&&this.engine?.name==="cornerstone"&&(this.series?.bytes??0)>this.guardBytes}async load_press(){this.forced=!0,this.loadPill.hidden=!0,this.retryPill.hidden=!0;const e=this.pendingLayout;return this.pendingLayout=null,e!==null?this.layout_set(e):this.engine===null||this.engine.state_get().filled?!1:this.engine.slices_fill()}guard_set(e){this.guardBytes=e}guard_get(){return this.guardBytes}preset_cycle(){const e=this.presets_for(this.series?.modality??"NIFTI");if(e.length===0)return;this.presetIndex=(this.presetIndex+1)%e.length;const t=e[this.presetIndex];t!==void 0&&this.wl_set(t.lower,t.upper)&&(this.presetPill.textContent=t.name.toUpperCase())}presets_for(e){const t=e.toUpperCase();return $g.filter(s=>s.modalities.length===0||s.modalities.includes(t))}presets_paint(e){this.presetIndex=-1;const t=this.presets_for(e);this.presetPill.hidden=t.length===0,this.presetPill.textContent="PRESET"}slice_set(e){if(this.engine===null)return!1;const t=this.engine.slice_set(e);return t||this.handlers.note(`image: slice ${e}: not offered in ${this.engine.state_get().layout} layout by ${this.engine.name}`),t}wl_set(e,t){if(this.engine===null)return!1;const s=this.engine.wl_set(e,t);return s||this.handlers.note(`image: wl: not offered by ${this.engine.name}`),s}ghost_set(e){if(this.engine===null)return!1;const t=this.engine.ghost_set(e);return t||this.handlers.note("image: ghost applies to the SLAB layout"),t}wlPreset_set(e){const t=this.series?.modality??"NIFTI",s=VA(e,t);return s===void 0?(this.handlers.note(`image: wl preset ${e}: none for ${t}`),!1):this.wl_set(s.lower,s.upper)}colormap_set(e){return this.engine===null?!1:this.engine.colormap_set(e)?(this.colormap=e,this.colormapPill.textContent=e.toUpperCase(),!0):(this.handlers.note(`image: colormap ${e}: not offered by ${this.engine.name}`),!1)}tool_set(e){return this.engine===null?!1:this.engine.tool_set(e)?(this.tool=e,this.toolPills_paint(),!0):(this.handlers.note(`image: ${e}: not offered by ${this.engine.name}`),!1)}async annotations_save(){if(this.engine===null)return!1;const e=this.series?.seriesInstanceUID,t=/^(\/home\/[^/]+)\//.exec(this.series?.path??"")?.[1];if(e===void 0||t===void 0)return this.handlers.note("image: save: this series has no UID to file an annotation under"),!1;const s=await this.engine.annotations_export();if(s===null)return this.handlers.note(`image: save: nothing measured, or ${this.engine.name} writes no report`),!1;const i=`${t}/annotations/${e}/measurements.dcm`,r=await this.handlers.file_put(i,s);return this.handlers.note(r===200?`✓ ${i}`:`image: save: ${i}: HTTP ${r}`),r===200}dispose(){this.engine_dispose()}async colormap_cycle(){const e=Xo[(Xo.indexOf(this.colormap)+1)%Xo.length]??"gray";this.colormap_set(e)}async engine_open(e){this.engine=e,this.field.replaceChildren(),this.progressNote=null,this.overlayNote=null,this.probeNote=null,this.layoutPills_paint("single"),this.modeSpan.textContent="",this.colormapPill.textContent=this.colormap.toUpperCase();try{await e.open(this.field)}catch(s){this.stateSpan.textContent="REFUSED",this.handlers.note(`image: ${s instanceof Error?s.message:String(s)}`);return}const t=e.state_get().layout;this.layoutPills_paint(t),this.modeSpan.textContent=t==="single"?"":t.toUpperCase(),e.tool_set(this.tool),this.toolPills_paint(),this.progress_show(null),this.overlay_fill()}engine_dispose(){this.engine?.dispose(),this.engine=null,this.progressNote=null,this.overlayNote=null,this.probeNote=null,this.field.replaceChildren(),this.stateSpan.textContent=""}retryPill_paint(){const e=this.engine===null?0:this.engine.state_get().refused,t=this.engine?.refused_retry!==void 0;this.retryPill.hidden=!t||e===0,this.retryPill.disabled||(this.retryPill.textContent=`RETRY ${e}`)}async retry_press(){if(!(this.engine?.refused_retry===void 0||this.retryPill.disabled)){this.retryPill.disabled=!0,this.retryPill.textContent="ASKING…";try{await this.engine.refused_retry()}finally{this.retryPill.disabled=!1,this.retryPill_paint()}}}engineHost_get(){return{source:this.handlers.source,readout_set:e=>{this.stateSpan.textContent=e,this.retryPill_paint()},progress_set:e=>this.progress_show(e),note:this.handlers.note,regard:e=>{this.handlers.regard(e),this.overlaySlice_paint()},probe_set:e=>this.probe_show(e)}}probe_show(e){if(e===null){this.probeNote?.remove(),this.probeNote=null;return}if(this.probeNote===null||this.probeNote.parentElement===null){const t=document.createElement("div");t.className="image-probe-note",this.field.appendChild(t),this.probeNote=t}this.probeNote.textContent=e}overlaySlice_paint(){const e=this.overlayNote?.querySelector(".image-overlay-slice")??null;if(e===null||this.engine===null)return;const t=this.engine.state_get();e.textContent=t.slices>1?`SLICE ${Math.max(1,t.slice)} OF ${t.slices}`:"",e.hidden=t.slices<=1}progress_show(e){if(e===null){this.progressNote?.remove(),this.progressNote=null;return}if(this.progressNote===null||this.progressNote.parentElement===null){const a=document.createElement("div");a.className="image-working",a.innerHTML='<span class="image-working-label"></span><span class="image-working-track"><span class="image-working-fill"></span></span><span class="image-working-count"></span>',this.field.appendChild(a),this.progressNote=a}const t=this.progressNote;t.classList.remove("image-working-failed");const s=e.total>0,i=s?Math.min(1,e.done/e.total):0;t.querySelector(".image-working-label").textContent=e.label,t.querySelector(".image-working-count").textContent=s?`${e.done} / ${e.total} · ${Math.round(i*100)}%`:"";const r=t.querySelector(".image-working-fill");r.classList.toggle("image-working-pacing",!s),r.style.width=s?`${Math.round(i*100)}%`:""}async overlay_set(e){if(this.overlay=e,this.overlayPill.textContent=e?"OVERLAY ON":"OVERLAY OFF",this.overlayPill.classList.toggle("rail-off",!e),!e){this.overlay_hide();return}await this.overlay_fill()}overlay_hide(){this.overlayNote?.remove(),this.overlayNote=null}async overlay_fill(){if(!this.overlay||this.series===null)return;const e=this.series.files[0]??this.series.path,t=await this.handlers.tags_read(e);if(t===null){this.handlers.note(`image: overlay: ${e}: no header to read`);return}this.overlayLines=dD.flatMap(s=>{const r=(t.constant.find(a=>a.name===s.tag)?.value??"").trim();return r===""?[]:[s.label===""?r:`${s.label} ${r}`]}),this.overlay_paint()}overlay_paint(){if(!this.overlay||this.overlayLines.length===0)return;this.overlay_hide();const e=document.createElement("div");e.className="image-overlay-note";const t=document.createElement("span");t.className="image-overlay-slice",e.appendChild(t);for(const s of this.overlayLines){const i=document.createElement("span");i.textContent=s,e.appendChild(i)}this.field.appendChild(e),this.overlayNote=e,this.overlaySlice_paint()}toolPills_paint(){const e=new Set(this.engine?.toolsOffered_get()??dp),t=this.engine!==null?this.engine.state_get().primaryTool:this.tool;for(const[s,i]of this.toolPills){const r=e.has(s);i.classList.toggle("rail-na",!r),i.classList.toggle("rail-off",r&&s!==t),i.disabled=!r}}focusMark_paint(e){this.focusMark.hidden=!e,this.pane.classList.toggle("image-field-focused",e)}}function Xs(n,e){const t=n.querySelector(e);if(t===null)throw new Error(`image pane: missing ${e}`);return t}const cM=["patient","study","series","image","equipment","meta","private","other","varying"],pD=new Set(["meta","private"]),Vp="••••";class mD{pane;title;modeSpan;redactBlock;listing;handlers;redact=!0;model=null;groups=[];constructor(e,t){this.handlers=t,this.pane=e,this.title=Bo(e,".pane-title"),this.modeSpan=Bo(e,".pane-mode"),this.redactBlock=Bo(e,".tags-redact"),this.redactBlock.addEventListener("click",()=>this.redact_set(!this.redact));const s=Bo(e,".tags-panel");this.listing=new Qr({mount:s,traits:this.groupTraits_declare(),key:i=>i.group,chrome:{root:e,prefix:"tags"},caps:"root",row:{className:()=>"tags-group-row",groupClassName:i=>`tags-group tags-group-${i.group}`,decorate:i=>{i.title="fold this group open or shut (it keeps its place)"}},child:kr(i=>i.rows,{traits:this.tagTraits_declare(),key:i=>i.key,activatable:i=>i.items.length>0,row:{className:i=>`tags-row${i.phi?" tags-phi":""}`,groupClassName:()=>"tags-sequence",decorate:(i,r)=>{i.title=r.items.length>0?`${r.name}: fold the sequence open or shut`:`${r.tag} ${r.name}`}},child:kr(i=>i.items,{traits:this.itemTraits_declare(),key:i=>i.key,row:{className:()=>"tags-item-row",groupClassName:()=>"tags-item"},child:kr(i=>i.rows,{traits:this.tagTraits_declare(),key:i=>i.key,activatable:()=>!1,row:{className:i=>`tags-row tags-row-deep${i.phi?" tags-phi":""}`}})})}),state:i=>this.stateLine_compose(i),empty:()=>zD("NO TAGS")}),this.redactBlock_paint(),this.listing.rows_set([],{field:"tags"})}model_show(e){this.model=e,this.title.textContent=`TAGS ${MD(e)}`,this.pane.dataset.modality=bD(e),this.groups=gD(e),this.listing.rows_set([{key:e.path,rows:this.groups}],{field:e.path}),this.listing.open_set(0,this.groups.map(t=>t.group).filter(t=>!pD.has(t))),this.modeSpan.textContent=e.subject==="folder"?"FOLDER":""}path_get(){return this.model?.path??null}redact_get(){return this.redact}redact_set(e){this.redact=e,this.redactBlock_paint(),this.model!==null&&this.listing.rows_set([{key:this.model.path,rows:this.groups}],{field:this.model.path})}filter_set(e){if(e===null){this.listing.filter_toggle(!1);return}this.listing.filter_toggle(!0),this.listing.filter_set(e)}stateLine_compose(e){const t=this.groups.reduce((i,r)=>i+r.rows.length,0),s=[];return this.model!==null&&this.model.subject==="folder"&&(s.push(this.model.read===this.model.of?`${this.model.read} FILES`:`${this.model.read} OF ${this.model.of} FILES`),this.model.refused.length>0&&s.push(`REFUSED ${this.model.refused.length}`)),s.push(e.filter!==""?e.filter:`${t} TAGS`),this.redact&&s.push("REDACTED"),s.join(" · ")}redactBlock_paint(){this.redactBlock.textContent=this.redact?"REDACT ON":"REDACT OFF",this.redactBlock.classList.toggle("rail-off",!this.redact),this.pane.classList.toggle("tags-redacted",this.redact)}value_cell(e){const t=document.createElement("span");if(t.className="tags-value",e.phi&&this.redact)return t.textContent=Vp,t.title="identifying value, redacted; the REDACT block on the frame reveals it",t;if(t.textContent=e.value,e.decoded!==void 0){const s=document.createElement("span");s.className="tags-decoded",s.textContent=` ${e.decoded}`,t.appendChild(s)}if(e.distinct!==void 0){const s=document.createElement("span");s.className="tags-decoded",s.textContent=` (${e.distinct} distinct)`,t.appendChild(s)}return t}groupTraits_declare(){return[Uc(()=>!0),{key:"group",label:"GROUP",className:"tags-group-name",width:"minmax(12em, 1fr)",cell:e=>e.group.toUpperCase(),compare:e=>cM.indexOf(e.group)},{key:"count",label:"TAGS",className:"tags-group-count",width:"5em",cell:e=>String(e.rows.length),compare:e=>e.rows.length}]}tagTraits_declare(){return[Uc(e=>e.items.length>0),{key:"tag",label:"TAG",className:"tags-tag",width:"7em",cell:e=>e.tag,compare:e=>e.tag},{key:"name",label:"NAME",className:"tags-name",width:"minmax(8em, 1.4fr)",cell:e=>e.name,compare:e=>e.name.toLowerCase()},{key:"vr",label:"VR",className:"tags-vr",width:"2.4em",cell:e=>e.vr,compare:e=>e.vr},{key:"value",label:"VALUE",className:"tags-value-cell",width:"minmax(6em, 2fr)",cell:e=>this.value_cell(e),compare:e=>(e.phi&&this.redact?Vp:`${e.value} ${e.decoded??""}`).toLowerCase()}]}itemTraits_declare(){return[Uc(()=>!0),{key:"item",label:"ITEM",className:"tags-item-name",width:"minmax(12em, 1fr)",cell:e=>`ITEM ${e.index}`,compare:e=>e.index},{key:"count",label:"TAGS",className:"tags-group-count",width:"5em",cell:e=>String(e.rows.length),compare:e=>e.rows.length}]}}function Uc(n){return{key:"fold",label:"",className:"tags-fold",capped:!1,width:"1.4em",cell:e=>{const t=document.createElement("span");return t.className=n(e)?"tags-fold":"tags-fold tags-fold-none",t}}}function gD(n){const e=new Map;for(const t of n.constant){const s=t.group;e.has(s)||e.set(s,[]),e.get(s)?.push(dM(t,`${s}/${t.tag}`))}return n.varying.length>0&&e.set("varying",n.varying.map(t=>({tag:t.tag,name:t.name,vr:t.vr,value:t.distinct===1?t.first:`${t.first} .. ${t.last}`,phi:t.phi,items:[],distinct:t.distinct,key:`varying/${t.tag}`}))),cM.filter(t=>e.has(t)).map(t=>({group:t,rows:e.get(t)??[]}))}function dM(n,e){return{tag:n.tag,name:n.name,vr:n.vr,value:n.value,...n.decoded!==void 0?{decoded:n.decoded}:{},phi:n.phi,items:(n.items??[]).map((t,s)=>({index:s+1,key:`${e}/${s+1}`,rows:t.map(i=>dM(i,`${e}/${s+1}/${i.tag}`))})),key:e}}function MD(n){const e=n.path.replace(/\/$/,"").split("/").pop()??n.path;if(n.subject==="folder")return e.length>24?`${e.slice(0,22)}…`:e;const t=/^(\d+)-/.exec(e)?.[1];return t!==void 0?`INSTANCE ${Number(t)}`:e.length>24?`${e.slice(0,22)}…`:e}function bD(n){const e=(n.constant.find(t=>t.name==="Modality")?.value??"").toUpperCase();return e==="MR"||e==="CT"||e==="PT"?e:"OT"}function zD(n){const e=document.createElement("div");return e.className="tags-note",e.textContent=n,e}function Bo(n,e){const t=n.querySelector(e);if(t===null)throw new Error(`tags pane: missing ${e}`);return t}class _D{groups=new Map;membership=new Map;writeObserver=null;writeObserver_set(e){this.writeObserver=e}pane_join(e,t){this.pane_leave(e),this.membership.set(e,t),this.groups.has(t)||this.groups.set(t,{value:null,subscribers:new Map,viewers:new Set})}pane_leave(e){const t=this.membership.get(e);if(t===void 0)return;this.membership.delete(e);const s=this.groups.get(t);if(s!==void 0){s.subscribers.delete(e),s.viewers.delete(e);for(const i of this.membership.values())if(i===t)return;this.groups.delete(t)}}group_of(e){const t=this.membership.get(e);return t!==void 0?t:(this.pane_join(e,e),e)}viewer_mark(e){this.groups.get(this.group_of(e))?.viewers.add(e)}groupHasViewer(e){const t=this.groups.get(this.group_of(e));return t!==void 0&&t.viewers.size>0}regard_write(e,t){const s=this.group_of(e),i=this.groups.get(s),r={...t,paneId:e};i.value=r;for(const a of i.subscribers.values())a(r);this.writeObserver?.(r,s)}regard_subscribe(e,t){const s=this.groups.get(this.group_of(e));s.subscribers.set(e,t),s.value!==null&&t(s.value)}regard_get(e){return this.groups.get(this.group_of(e))?.value??null}}const Fc=["⣾","⣽","⣻","⢿","⡿","⣟","⣯","⣷"],wD=new Set(["done","error","unconfirmed","stalled","timeout"]);function yD(n,e){const t=`${e.operation}:${e.itemId??""}`;if(e.phase==="complete"||e.phase==="failed"){const s=`${e.operation}:`;for(const i of[...n])(i===t||i.startsWith(s))&&n.delete(i);return}if(e.itemId!==void 0&&e.status!==void 0&&wD.has(e.status)){n.delete(t);return}n.add(t)}const vD=100;class OD{fields;running=new Set;activityTimer=null;activityFrame=0;constructor(e){this.fields={identity:Pi(e,"status-identity"),jobs:Pi(e,"status-jobs"),activity:Pi(e,"status-activity"),latency:Pi(e,"status-latency"),mismatch:Pi(e,"status-mismatch"),lamp:Pi(e,"status-lamp"),host:Pi(e,"status-host")}}attach_show(e){if(e.protocolVersion!==Vc){this.fields.mismatch.textContent=`WIRE V${e.protocolVersion} ≠ V${Vc}`,this.fields.mismatch.title="This surface and the daemon speak different contract versions. Some messages may be dropped.",this.hostControl_show(e.hostControl??[]);return}this.fields.mismatch.textContent="",this.fields.mismatch.title=e.stack!==void 0?`chell ${e.stack.chell} · calypso ${e.stack.calypso} · build ${e.stack.build}`:"",this.hostControl_show(e.hostControl??[])}hostControl_show(e){this.fields.host.textContent=e.length>0?`HOST ${e.join(" ")}`:"",this.fields.host.title=e.length>0?"Calypso was started with --host-control: `!` and pipes run on its host, upload/download reach its disk.":""}promptContext_show(e){const t=e.uri.replace(/^https?:\/\//,"");this.fields.identity.textContent=`${e.user}@${t}`.toUpperCase();const s=e.procWarmup,i=[];if(s!==void 0&&s.sweeping!==!1){const o=s.total!==void 0?`/${s.total}`:"",l=s.state!==void 0?` ${s.state.toUpperCase()}`:"";i.push(`JOBS ${s.loaded}${o}${l}`)}const r=s?.feeds??(s?.feed!==void 0?[s.feed]:[]);for(const o of r){const l=o.total>0?`/${o.total}`:"";i.push(o.failed!==void 0?`FEED ${o.id} FAILED ${o.loaded}${l}`:`FEED ${o.id} ${o.loaded}${l}`)}s?.roster!==void 0&&i.push(s.roster==="full"?"ROSTER WALK":"ROSTER DELTA"),s?.arrived!==void 0&&s.arrived.length>0&&i.push(s.arrived.length<=2?`+FEED ${s.arrived.join(" ")}`:`+${s.arrived.length} FEEDS`);const a=e.warmupFailures??[];a.length>0&&i.push(`WARM-UP FAILED: ${a.map(o=>o.label.toUpperCase()).join(" ")}`),this.fields.jobs.textContent=i.join(" · "),this.fields.jobs.classList.toggle("status-degraded",a.length>0),this.fields.jobs.title=a.length>0?a.map(o=>`${o.label}: ${o.message}`).join(`
4232
4232
  `):r.length>0?"A feed is being indexed on its first visit; it opens when the walk completes.":"",this.fields.latency.textContent=e.lastCommandDurationMs>0?`${e.lastCommandDurationMs}MS`:""}progress_observe(e){yD(this.running,e),this.activity_paint()}activity_clear(){this.running.clear(),this.activity_paint()}connection_show(e){this.fields.lamp.textContent=e?"ONLINE":"OFFLINE",this.fields.lamp.classList.toggle("lamp-online",e),this.fields.lamp.classList.toggle("lamp-offline",!e),e||this.activity_clear()}activity_paint(){if(this.running.size===0){this.activityTimer!==null&&(clearInterval(this.activityTimer),this.activityTimer=null),this.fields.activity.textContent="";return}const e=()=>{const t=Fc[this.activityFrame]??Fc[0];this.fields.activity.textContent=`${t} ${this.running.size} RUNNING`};e(),this.activityTimer===null&&(this.activityTimer=window.setInterval(()=>{this.activityFrame=(this.activityFrame+1)%Fc.length,e()},vD))}}function Pi(n,e){const t=n.getElementById(e);if(t===null)throw new Error(`status bar: no element with id '${e}'`);return t}function xD(n){return n>=6e4?`${Math.max(1,Math.round(n/6e4))} MIN`:`${Math.max(1,Math.round(n/1e3))} S`}function tn(n){return n.toLocaleString("en-US")}class SD{mount;counts=null;context=null;msPerPage=null;walkSamples=new Map;clock;acts;state=void 0;constructor(e,t=()=>Date.now(),s={}){this.mount=e,this.clock=t,this.acts=s,this.render()}state_show(e){this.state=e,this.render()}pace_show(e){this.msPerPage=e,this.render()}eta_of(e,t,s){const i=this.clock(),r=this.walkSamples.get(e);let a=r?.rowsPerMs??null;r!==void 0&&t>r.loaded&&i>r.at&&(a=(t-r.loaded)/(i-r.at)),(r===void 0||t!==r.loaded)&&this.walkSamples.set(e,{loaded:t,at:i,rowsPerMs:a});const o=Math.max(0,s-t);return s<=0?null:a!==null&&a>0?o/a:this.msPerPage!==null&&this.msPerPage>0?Math.ceil(o/100/4)*this.msPerPage:null}counts_show(e){this.counts=e,this.render()}promptContext_show(e){this.context=e,e.procIndex!==void 0&&(this.counts={jobs:e.procIndex.jobs,feeds:e.procIndex.feeds}),this.render()}rows_compose(){const e=[],t=this.context?.procWarmup,s=this.context?.warmupFailures??[],i=t!==void 0&&t.sweeping!==!1,r=this.counts!==null?`${tn(this.counts.jobs)} JOBS · ${tn(this.counts.feeds)} FEEDS`:"";if(s.length>0)e.push({label:"INDEX",bar:null,value:`${r}${r?" · ":""}FAILED: ${s.map(l=>l.label.toUpperCase()).join(" ")}`,title:s.map(l=>`${l.label}: ${l.message}`).join(`
4233
4233
  `),degraded:!0});else if(i&&t!==void 0){const l=(t.state??"cold").toUpperCase();e.push({label:"INDEX",bar:{loaded:t.loaded,total:t.total??0,state:t.state==="failed"?"failed":"running"},value:`SWEEP ${tn(t.loaded)} / ${t.total!==void 0?tn(t.total):"?"} · ${l}`,title:"The global topology sweep: every plugin instance CUBE holds, walked page by page.",degraded:t.state==="failed"})}else e.push({label:"INDEX",bar:null,value:r?`${r} · CURRENT`:"CURRENT",title:"Nothing is moving: the process index is whole and current.",degraded:!1});if(this.state!==void 0){const l=this.state;e.push({label:"RUNNING",bar:null,value:`${tn(l.running)} IN ${tn(l.runningFeeds)} FEEDS · SCHEDULED ${tn(l.scheduled)}`,title:"Jobs running and waiting across every feed the index holds, from the roster's own counters.",degraded:!1,verb:this.acts.errored_open!==void 0?{label:`ERRORED ${tn(l.errored)} IN ${tn(l.erroredFeeds)} FEEDS`,title:"Open the runs roster filtered to the feeds with errored jobs.",act:this.acts.errored_open}:null})}const a=t?.feeds??(t?.feed!==void 0?[t.feed]:[]);for(const l of Array.from(this.walkSamples.keys()))a.some(c=>c.id===l)||this.walkSamples.delete(l);for(const l of a){const c=l.total>0?tn(l.total):"?";if(l.failed!==void 0)e.push({label:`FEED ${l.id}`,bar:{loaded:l.loaded,total:l.total,state:"failed"},value:`FAILED AT ${tn(l.loaded)} / ${c} · ${l.failed.toUpperCase()}`,title:"The walk stopped; the next visit to the feed starts it again.",degraded:!0});else{const d=this.eta_of(l.id,l.loaded,l.total);e.push({label:`FEED ${l.id}`,bar:{loaded:l.loaded,total:l.total,state:"running"},value:`INDEXING ${tn(l.loaded)} / ${c}${d!==null?` · ETA ${xD(d)}`:""}`,title:"A feed is being indexed on its first visit; it opens when the walk lands.",degraded:!1})}}t?.roster!==void 0&&e.push({label:"ROSTER",bar:null,value:t.roster==="full"?"FULL WALK · every feed the identity can see":"DELTA · feeds newer than the roster knows",title:"The roster is being brought up to date; the listing answered from the cache and refreshes when arrivals land.",degraded:!1});const o=t?.arrived??[];return o.length>0&&e.push({label:"ARRIVED",bar:null,value:o.length<=3?o.map(l=>`FEED ${l}`).join(" · "):`${o.length} FEEDS`,title:"Feeds the roster gained: created here, or shared with this identity.",degraded:!1}),e}render(){const e=this.rows_compose();this.mount.replaceChildren();for(const t of e){const s=document.createElement("div");s.className="index-row telemetry-row",s.classList.toggle("status-degraded",t.degraded),s.title=t.title;const i=document.createElement("span");if(i.className="telemetry-label",i.textContent=t.label,s.appendChild(i),t.bar!==null){const a=document.createElement("span");a.className=`index-bar listing-progress listing-progress-${t.bar.state}`;const o=document.createElement("span");o.className="listing-progress-fill";const l=t.bar.total>0?Math.min(100,Math.round(t.bar.loaded/t.bar.total*100)):0;o.style.width=`${l}%`,a.appendChild(o),s.appendChild(a)}const r=document.createElement("span");if(r.className="telemetry-value",r.textContent=t.value,s.appendChild(r),t.verb!==void 0&&t.verb!==null){const a=document.createElement("button");a.type="button",a.className="index-verb pacs-capsule",a.textContent=t.verb.label,a.title=t.verb.title,a.addEventListener("click",t.verb.act),s.appendChild(a)}this.mount.appendChild(s)}}}const AD=3e3;class ED{mount;clock;lane=void 0;cube=void 0;beatAt=null;constructor(e,t=()=>Date.now()){this.mount=e,this.clock=t,this.render()}telemetry_show(e={}){this.beatAt=this.clock(),e.lane!==void 0&&(this.lane=e.lane),e.cube!==void 0&&(this.cube=e.cube),this.render()}tick(){this.render()}rows_compose(){const e=[],t=this.lane;if(t===void 0)e.push({label:"LANE",value:"—",title:"The daemon has not said what holds its lane (an older daemon).",degraded:!1});else if(t.running===null)e.push({label:"LANE",value:t.waiting>0?`IDLE · ${t.waiting} WAITING`:"IDLE",title:"The serialized command lane: nothing is executing.",degraded:!1});else{const i=(t.running.sinceMs/1e3).toFixed(1);e.push({label:"LANE",value:`${t.running.line} · ${i} S${t.waiting>0?` · ${t.waiting} WAITING`:""}`,title:`The command holding the lane${t.running.surface?`, from surface ${t.running.surface}`:""}; every other command waits behind it.`,degraded:t.running.sinceMs>=1e4})}if(this.beatAt===null)e.push({label:"BEAT",value:"NONE YET",title:"No telemetry heartbeat has landed.",degraded:!1});else{const i=Math.max(0,this.clock()-this.beatAt);e.push({label:"BEAT",value:`${(i/1e3).toFixed(1)} S AGO`,title:"The age of the last telemetry heartbeat; the daemon beats once a second while a surface is attached.",degraded:i>=AD})}const s=this.cube;if(s===void 0)e.push({label:"CUBE",value:"NO PAGE TIMED",title:"CUBE's pace is known once a page of a list has been fetched.",degraded:!1});else{const i=s.msPerPage>0?Math.round(6e4/s.msPerPage):0;e.push({label:"CUBE",value:`${(s.msPerPage/1e3).toFixed(1)} S/PAGE · ${i} PAGES/MIN`,title:`The median of the last ${s.samples} page fetches (100 rows each).`,degraded:!1})}return e}render(){const e=this.rows_compose();this.mount.replaceChildren();for(const t of e){const s=document.createElement("div");s.className="lane-row telemetry-row",s.classList.toggle("status-degraded",t.degraded),s.title=t.title;const i=document.createElement("span");i.className="telemetry-label",i.textContent=t.label;const r=document.createElement("span");r.className="telemetry-value",r.textContent=t.value,s.append(i,r),this.mount.appendChild(s)}}}const DD=[2,3,3,2,2,11,2,2],ID=4,Hp=300,TD=2600,GD=650;class RD{wrapper;cells=[];bootedAt=Date.now();telemetry={jobsLoaded:0,jobsTotal:0,feeds:0,lastLatencyMs:0,latencySumMs:0,lastExitCode:0,commandsRun:0,opsActive:0,opsDone:0,opsFailed:0,itemsCurrent:0,itemsTotal:0,connected:0};activeOperations=new Set;telemetryRows=[];constructor(e){if(this.wrapper=e,e===null){window.setInterval(()=>this.beat_paint(),Hp);return}const t=this.narrowSources_list(),s=this.wideSources_list();let i=0,r=0;for(const a of DD){const o=document.createElement("div");o.className="data-column";for(let l=1;l<=ID;l++){const c=document.createElement("div");c.className=`dc-row-${l}`;let d;a>=6?(d=s[r%s.length],r++):(d=t[i%t.length],i++);const u={element:c,width:a,source:d??(()=>0)};c.textContent=qp(u.source(),a),o.appendChild(c),this.cells.push(u)}e.appendChild(o)}window.setInterval(()=>this.beat_paint(),Hp),this.sweep_start()}promptContext_observe(e){const t=e.procWarmup;t!==void 0&&(this.telemetry.jobsLoaded=t.loaded,this.telemetry.jobsTotal=t.total??t.loaded);const s=e.procIndex;s!==void 0&&(t===void 0&&(this.telemetry.jobsLoaded=s.jobs,this.telemetry.jobsTotal=s.jobs),this.telemetry.feeds=s.feeds),e.lastCommandDurationMs>0&&(this.telemetry.lastLatencyMs=e.lastCommandDurationMs,this.telemetry.latencySumMs+=e.lastCommandDurationMs,this.telemetry.commandsRun++),this.telemetry.lastExitCode=e.lastExitCode}progress_observe(e){const t=`${e.operation}:${e.itemId??""}`;if(e.phase==="complete"||e.phase==="failed"){const s=`${e.operation}:`;for(const i of[...this.activeOperations])(i===t||i.startsWith(s))&&this.activeOperations.delete(i);e.status==="error"||e.phase==="failed"?this.telemetry.opsFailed++:this.telemetry.opsDone++}else e.itemId!==void 0&&e.status!==void 0&&["done","error","unconfirmed","stalled","timeout"].includes(e.status)?this.activeOperations.delete(t):this.activeOperations.add(t);this.telemetry.opsActive=this.activeOperations.size,e.current!==void 0&&(this.telemetry.itemsCurrent=e.current),e.total!==void 0&&(this.telemetry.itemsTotal=e.total)}index_observe(e){this.telemetry.jobsLoaded=e.jobs,this.telemetry.jobsTotal=e.jobs,this.telemetry.feeds=e.feeds}connection_show(e){this.telemetry.connected=e?1:0,this.wrapper?.classList.toggle("dc-stale",!e)}telemetryPanel_bind(e){const t=this.telemetry,s=[["LINK",()=>t.connected===1?"ONLINE":"OFFLINE"],["JOBS INDEXED",()=>`${t.jobsLoaded} / ${t.jobsTotal}`],["FEEDS VISIBLE",()=>String(t.feeds)],["OPS ACTIVE",()=>String(t.opsActive)],["OPS DONE",()=>String(t.opsDone)],["OPS FAILED",()=>String(t.opsFailed)],["ITEMS",()=>`${t.itemsCurrent} / ${t.itemsTotal}`],["LAST COMMAND",()=>`${t.lastLatencyMs} MS`],["LATENCY SUM",()=>`${t.latencySumMs} MS`],["COMMANDS RUN",()=>String(t.commandsRun)],["LAST EXIT",()=>String(t.lastExitCode)],["UPTIME",()=>`${this.uptimeSeconds_get()} S`]];for(const[i,r]of s){const a=document.createElement("div");a.className="telemetry-row";const o=document.createElement("span");o.className="telemetry-label",o.textContent=i;const l=document.createElement("span");l.className="telemetry-value",l.textContent=r(),a.append(o,l),e.appendChild(a),this.telemetryRows.push({element:l,source:r})}}narrowSources_list(){const e=this.telemetry;return[()=>e.jobsLoaded,()=>e.feeds,()=>e.lastLatencyMs,()=>e.opsActive,()=>e.opsDone,()=>e.jobsTotal,()=>e.itemsCurrent,()=>e.itemsTotal,()=>e.opsFailed,()=>e.commandsRun,()=>e.lastExitCode,()=>new Date().getSeconds(),()=>this.uptimeSeconds_get()]}wideSources_list(){return[()=>Math.floor(Date.now()/1e3),()=>this.uptimeSeconds_get(),()=>this.telemetry.latencySumMs,()=>BD()]}uptimeSeconds_get(){return Math.floor((Date.now()-this.bootedAt)/1e3)}beat_paint(){for(const e of this.cells){const t=qp(e.source(),e.width);e.element.textContent!==t&&(e.element.textContent=t)}for(const e of this.telemetryRows){const t=e.source();e.element.textContent!==t&&(e.element.textContent=t)}}sweep_start(){if(this.wrapper===null)return;const e=Array.from(this.wrapper.querySelectorAll(".data-column"));window.setInterval(()=>{const t=e[Math.floor(Math.random()*e.length)];t!==void 0&&(t.classList.add("dc-sweep"),window.setTimeout(()=>t.classList.remove("dc-sweep"),GD))},TD)}}function qp(n,e){const t=String(Math.max(0,Math.floor(n)));return t.length>e?t.slice(t.length-e):t.padStart(e,"0")}function BD(){const n=new Date;return n.getHours()*1e4+n.getMinutes()*100+n.getSeconds()}const ND=2e4;class CD{scene;nameplate;command_run;names=[];cursor=0;timer=null;seen=new Map;constructor(e,t,s){this.nameplate=t,this.command_run=s,this.scene=new Rl(e,{},{ambient:!0}),new MutationObserver(()=>this.scene.palette_refresh()).observe(document.documentElement,{attributes:!0,attributeFilter:["data-theme"]}),new MutationObserver(()=>{window.setTimeout(()=>this.scene.size_fit(),60)}).observe(document.body,{attributes:!0,attributeFilter:["data-header"]}),window.addEventListener("resize",()=>this.scene.size_fit())}names_set(e){this.names=e,this.cursor=0,this.timer!==null&&(window.clearInterval(this.timer),this.timer=null),e.length!==0&&(this.next_request(),e.length>1&&(this.timer=window.setInterval(()=>this.next_request(),ND)))}envelope_observe(e){if(e.model?.kind!==zi.pipelineDiagram)return;const t=Jc.safeParse(e.model.data);if(!t.success)return;const s=t.data;this.seen.set(s.name,s),this.model_stage(s)}model_stage(e){this.nameplate.textContent=e.name,this.scene.graph_set({nodes:e.nodes.map(t=>({id:t.id,label:t.label,parentIds:t.parentIds,joinParentIds:t.joinParentIds}))}),this.scene.size_fit()}next_request(){const e=this.names[this.cursor%this.names.length];if(this.cursor++,e===void 0)return;const t=this.seen.get(e);if(t!==void 0){this.model_stage(t);return}this.command_run(`pipeline diagram ${e}`)}}const PD=new Set(["pane","view","runs","node","dag","universe","file","pacs","image","tags","header","console","back","desktop","dashboard","launcher","attach","argus"]),uM=new Set(["layout","slice","series","wl","colormap","save","tags","load","guard","ghost","state"]),LD={pacs:new Set(["sort","filter"]),tags:new Set(["redact","filter"]),image:uM};let qn=null;const Gr="argus.desktop.",Xp="~/.config/argus/desktops";function WD(n){const e=n.trim().split(/\s+/),t=(e[0]??"").toLowerCase();if(!PD.has(t))return null;const s=LD[t];if(s!==void 0&&!s.has((e[1]??"").toLowerCase()))return null;let i=null,r=e.slice(1);return(r[0]?.startsWith("@")||r[0]?.startsWith("%"))&&(i=r[0],r=r.slice(1)),{subject:t,target:i,words:r}}function Yp(n,e){if(e===null)return n.focused_get();if(e.startsWith("@"))return e.slice(1);const t=parseInt(e.slice(1),10);return qn===null?null:qn[t-1]??null}function $n(n,e,t){const i=n.paneMount_get(e)?.querySelector(t)??null;return i===null?!1:(i.click(),!0)}function No(n,e,t){const s=n.paneMount_get(e);if(s===null)return!1;for(const i of s.querySelectorAll(".drawer-child"))if(i.textContent?.trim().toUpperCase()===t)return i.click(),!0;return!1}function kD(n,e,t){return $n(n,e,`.drawer-cwdbind[data-follow="${t?"on":"off"}"]`)}function Sa(n,e,t,s){const r=n.paneMount_get(e)?.querySelector(t)??null;if(r===null)return!1;for(let a=0;a<4;a++){if(r.textContent?.trim().toUpperCase()===s)return!0;r.click()}return r.textContent?.trim().toUpperCase()===s}function UD(n,e){const t=n.focused_get(),s=t!==null?n.paneRect_get(t):null;if(s===null)return null;const i=s.x+s.width/2,r=s.y+s.height/2;let a=null;for(const o of n.panes_shown()){if(o===t)continue;const l=n.paneRect_get(o);if(l===null)continue;const c=l.x+l.width/2-i,d=l.y+l.height/2-r,u=e==="left"?-c:e==="right"?c:e==="up"?-d:d;if(u<=1)continue;const h=Math.abs(e==="left"||e==="right"?d:c),g=u+h*2;(a===null||g<a.score)&&(a={id:o,score:g})}return a===null?null:(n.focus_set(a.id),a.id)}const FD={left:{split:"col",place:"before"},right:{split:"col",place:"after"},above:{split:"row",place:"before"},below:{split:"row",place:"after"}},jD=["pane [@id|%n] split left|right|above|below · zoom · close · bind unlinked|fs|viewer","pane [@id|%n] claim files|runs|pacs · focus left|right|up|down|@id","view files|runs|pacs (the gutter givens, workspace scope)","runs enter <feedId> · sort <col> [asc|desc] · filter <text>|off","node enter · immerse · back · clear (the indicated node)","dag [@id] layout ranked|molecule · projection 2d|3d · scale time|size · hue status|compute · pulse · census · physics charge|link|collide|gravity on|off · physics reset · refresh","file [@id] home|back|download|delete · follow · root · list|cards|preview · sort <col> [asc|desc] · filter <text>|off","pacs sort <col> [asc|desc] · filter <text>|off (the results listing; every other pacs verb is the session's)","image [@id] [--force] <path> · layout single|mpr|3d|slab · slice <n> · series <n> · wl <lo> <hi> · wl preset <name> · colormap gray|hot|jet|cool · save · tags · load · guard <bytes>|off · ghost <0..1>|off · state","tags [@id] redact on|off · filter <text>|off (the pane that follows an image pane's slice)","header stats|dag|away|restore","console open|close|toggle|zoom|height <px>","back (contextual back — exactly Esc)","desktop save|load|show|list|delete [name]","attach [--reveal] (how to reach THIS session from a terminal or another browser)","argus verbs (this table; the long form is docs/argus-lang.adoc)"].join(`
4234
4234
  `);function $D(n,e){const t=new URL(window.location.href),s=t.searchParams.get("token")??"",i=s===""?"":e?s:"•".repeat(8),r=s===""?t.origin+t.pathname:`${t.origin}${t.pathname}?token=${i}`,a=n.identity_get(),o=/^(127\.|\[?::1\]?$|localhost$)/.test(t.hostname),l=["attach — this session, from anywhere that can reach it"];return a!==null&&a!==""&&l.push(` identity ${a}`),l.push(""),l.push(" this machine chell --remote"),l.push(` another machine chell --remote --attach "${r}"`),l.push(` another browser ${r}`),l.push(""),o&&(l.push(" bound to loopback — another machine cannot reach this session;"),l.push(" relaunch the daemon with CALYPSO_BIND=0.0.0.0 to change that")),s===""?(l.push(" this page carries no token: it was opened without one, and a"),l.push(" second surface cannot attach with what is on screen")):e?l.push(" revealed — anyone who reads this line holds the session"):(l.push(" the token is masked — `attach --reveal` prints it. It is a bearer"),l.push(" credential with no expiry: treat the line like a password")),l.join(`
@@ -4237,19 +4237,19 @@ void main() {
4237
4237
  `)[0]})`}if(e==="delete")return window.localStorage.removeItem(Gr+t),`deleted '${t}' (local; a CFS copy, if any, is yours to rm)`;if(e==="load"){let s=window.localStorage.getItem(Gr+t);if(s===null){const r=await n.session_run(`cat ${Xp}/${t}.desk`);r.trim().length>0&&!r.includes("No such")&&!r.toLowerCase().includes("error")&&(s=r)}if(s===null)return`(no desktop '${t}')`;qn=[];const i=[];try{for(const r of s.split(`
4238
4238
  `)){const a=r.trim();if(a===""||a.startsWith("#"))continue;const o=await au(n,a);i.push(`${a} → ${o??"(session line?)"}`),await new Promise(l=>{window.setTimeout(l,60)})}}finally{qn=null}return`loaded '${t}'
4239
4239
  ${i.join(`
4240
- `)}`}return"desktop save|load|show|list|delete [name]"}const hM=new Map,Jr=new Map;let HD=0;function Un(n,e){hM.set(n,e)}function qD(n){const e=hM.get(n);if(e===void 0)throw new Error(`no pane factory registered for kind '${n}'`);const t=e(`${n}-${HD++}`);return Jr.set(t.id,t),t}function Rr(n){Jr.set(n.id,n)}function gn(n){return Jr.get(n)}function Co(){return[...Jr.values()]}function Ys(n){const e=Jr.get(n);e!==void 0&&(Jr.delete(n),e.dispose?.(),e.mount.remove())}const Kp="argus-layout";class XD{root;mounts;presets=new Map;prefs={};activePreset="";tree=null;focusedPane=null;renderObserver=null;constructor(e,t){this.root=e,this.mounts=t;try{const s=window.localStorage.getItem(Kp);this.prefs=s!==null?JSON.parse(s):{}}catch{this.prefs={}}}renderObserver_set(e){this.renderObserver=e}preset_register(e,t){this.presets.set(e,t)}mount_register(e,t){this.mounts.set(e,t)}mount_remove(e){this.mounts.delete(e),this.focusedPane===e&&(this.focusedPane=null)}leaf_split(e,t,s,i=!1){if(this.tree===null)return!1;const r=_l(this.tree,e,{dir:t,ratio:.5,first:i?{pane:s}:{pane:e},second:i?{pane:e}:{pane:s}});return r===null?!1:(this.tree=r,this.focusedPane=s,this.render(),!0)}leaf_replace(e,t){if(this.tree===null)return!1;const s=_l(this.tree,e,{pane:t});return s===null?!1:(this.tree=s,this.focusedPane===e&&(this.focusedPane=t),this.render(),!0)}leaf_close(e){if(this.tree===null||"pane"in this.tree)return!1;const t=ou(this.tree,e);return t===null?!1:(this.tree=t,this.focusedPane===e&&(this.focusedPane=null),this.render(),!0)}focused_get(){return this.focusedPane}savedPreset_get(){return this.prefs.preset!==void 0&&this.presets.has(this.prefs.preset)?this.prefs.preset:null}activePreset_get(){return this.activePreset}preset_apply(e){const t=this.presets.get(e);t!==void 0&&(this.activePreset=e,this.prefs.preset=e,this.prefs_save(),this.tree=this.ratios_restore(t(),e,""),this.render(),this.root.classList.remove("layout-arrive"),this.root.offsetWidth,this.root.classList.add("layout-arrive"))}tree_get(){return this.tree===null?null:JSON.parse(JSON.stringify(this.tree))}tree_set(e){this.tree=this.ratios_restore(e,this.activePreset,""),this.render()}panes_shown(){const e=[],t=s=>{if(s!==null){if("pane"in s){e.push(s.pane);return}t(s.first),t(s.second)}};return t(this.tree),e}render(){if(this.tree!==null){for(const e of this.mounts.values())e.remove();this.root.replaceChildren(this.node_render(this.tree,"")),this.renderObserver?.()}}node_render(e,t){if("pane"in e){const o=document.createElement("div");o.className="layout-leaf",o.dataset.leaf=e.pane;const l=this.mounts.get(e.pane);return l!==void 0&&(o.appendChild(l),l.style.display="",o.addEventListener("mousedown",()=>this.focus_set(e.pane),{capture:!0}),e.pane===this.focusedPane&&o.classList.add("pane-focused")),o}const s=document.createElement("div");s.className=`layout-split layout-${e.dir}`;const i=this.node_render(e.first,`${t}0`),r=this.node_render(e.second,`${t}1`);i.style.flex=`${e.ratio} 1 0`,r.style.flex=`${1-e.ratio} 1 0`;const a=document.createElement("div");return a.className="layout-divider",this.divider_wire(a,s,e,i,r,t),s.append(i,a,r),s}divider_wire(e,t,s,i,r,a){let o=!1;e.addEventListener("mousedown",l=>{o=!0,l.preventDefault()}),window.addEventListener("mousemove",l=>{if(!o)return;const c=t.getBoundingClientRect(),d=s.dir==="col"?(l.clientX-c.left)/c.width:(l.clientY-c.top)/c.height;s.ratio=Math.min(.85,Math.max(.15,d)),i.style.flex=`${s.ratio} 1 0`,r.style.flex=`${1-s.ratio} 1 0`}),window.addEventListener("mouseup",()=>{o&&(o=!1,this.ratio_remember(a,s.ratio),this.renderObserver?.())})}focus_set(e){if(this.focusedPane===e)return;this.focusedPane=e,document.body.dataset.focus=e;for(const s of this.root.querySelectorAll(".layout-leaf"))s.classList.remove("pane-focused");this.mounts.get(e)?.parentElement?.classList.add("pane-focused")}ratios_restore(e,t,s){if("pane"in e)return e;const i=this.prefs.ratios?.[`${t}:${s}`];return{...e,ratio:i??e.ratio,first:this.ratios_restore(e.first,t,`${s}0`),second:this.ratios_restore(e.second,t,`${s}1`)}}ratio_remember(e,t){this.prefs.ratios={...this.prefs.ratios??{},[`${this.activePreset}:${e}`]:t},this.prefs_save()}prefs_save(){try{window.localStorage.setItem(Kp,JSON.stringify(this.prefs))}catch{}}}function _l(n,e,t){if("pane"in n)return n.pane===e?t:null;const s=_l(n.first,e,t);if(s!==null)return{...n,first:s};const i=_l(n.second,e,t);return i!==null?{...n,second:i}:null}function ou(n,e){if("pane"in n)return null;if("pane"in n.first&&n.first.pane===e)return n.second;if("pane"in n.second&&n.second.pane===e)return n.first;const t=ou(n.first,e);if(t!==null)return{...n,first:t};const s=ou(n.second,e);return s!==null?{...n,second:s}:null}const YD=/Failed to fetch dynamically imported module|error loading dynamically imported module|Importing a module script failed/i;function KD(n){const e=n instanceof Error?n.message:String(n??"");return YD.test(e)}function ZD(n,e=document.body){let t=!1;const s=()=>{if(t)return;t=!0,n("argus: the server has a newer argus than this page — reload to continue (what failed to load was part of the old one)");const i=document.createElement("div");i.className="stale-page",i.setAttribute("role","alert");const r=document.createElement("span");r.className="stale-page-words",r.textContent="ARGUS WAS UPDATED ON THE SERVER — THIS PAGE IS OLDER";const a=document.createElement("button");a.className="pacs-capsule stale-page-reload",a.textContent="RELOAD",a.title="load the argus the server has now",a.addEventListener("click",()=>{window.location.reload()}),i.append(r,a),e.appendChild(i)};window.addEventListener("vite:preloadError",i=>{i.preventDefault(),s()}),window.addEventListener("unhandledrejection",i=>{KD(i.reason)&&s()})}let fM=()=>{};function QD(){fM(document.body.dataset.zoom==="console"?null:"console")}const JD=mA(),eI="ARGUS",Zp="argus-audio",tI=.4;let Li=!1;function Wt(n){if(Li)return;const e=document.getElementById(n);e instanceof HTMLAudioElement&&(e.currentTime=0,e.volume=tI,e.play().catch(()=>{}))}function sI(){const n=rt("head-menu-pill"),e=t=>{t?document.body.dataset.headMenu="open":delete document.body.dataset.headMenu,n.setAttribute("aria-expanded",String(t))};n.addEventListener("click",t=>{t.stopPropagation(),e(document.body.dataset.headMenu!=="open")}),document.addEventListener("click",t=>{if(document.body.dataset.headMenu!=="open")return;t.target instanceof Element&&t.target.closest("#header-dag-info")!==null||e(!1)})}function nI(){const n=rt("audio-pill");try{Li=window.localStorage.getItem(Zp)==="off"}catch{Li=!1}const e=()=>{n.classList.toggle("audio-off",Li)};e(),n.addEventListener("click",()=>{Li=!Li;try{window.localStorage.setItem(Zp,Li?"off":"on")}catch{}e(),Wt("audio2")})}function rt(n){const e=document.getElementById(n);if(e===null)throw new Error(`required element #${n} is missing`);return e}function fn(n){const e=rt(n);if(!(e instanceof HTMLTemplateElement))throw new Error(`#${n} is not a template`);const t=e.content.firstElementChild;if(!(t instanceof HTMLElement))throw new Error(`template #${n} is empty`);return t.cloneNode(!0)}function Rs(n,e){const t=n.querySelector(e);if(t===null)throw new Error(`pane template is missing ${e}`);return t}function iI(){return gA(window.location)}const Qp=/\.(csv|tsv)$/i;let jc=null,wl=0;function pM(n,e){const t=()=>{e.dataset.zoom!==void 0||e.dataset.header==="away"||(wl=Math.ceil(n.getBoundingClientRect().bottom),e.style.setProperty("--zoom-header-height",`${wl}px`))};t(),jc===null&&(jc=new ResizeObserver(t),jc.observe(n))}const rI=2200,Jp=120,aI=96;function oI(n,e,t,s){let i="";const r=c=>{c?(i=n.style.height,n.style.height=""):i!==""&&(n.style.height=i),n.classList.toggle("drawer-closed",c),Wt("audio3"),c||(s.size_fit(),s.focus_take())};t.addEventListener("click",()=>r(!n.classList.contains("drawer-closed")));let a=0,o=0,l=!1;return e.addEventListener("mousedown",c=>{l=!0,a=c.clientY,o=n.getBoundingClientRect().height,n.classList.add("drawer-dragging"),c.preventDefault()}),window.addEventListener("mousemove",c=>{if(!l)return;const d=Math.max(Jp,window.innerHeight-aI),u=o+(c.clientY-a),h=Math.min(Math.max(Jp,u),d);n.style.height=`${h}px`,s.size_fit()}),window.addEventListener("mouseup",()=>{l=!1,n.classList.remove("drawer-dragging")}),r}function lI(n){const e=document.body,t=document.querySelector(".wrap:not(#gap)");let s;const i=r=>{for(const a of document.querySelectorAll(".pane-zoomed, .pane-zoomed-path"))a.classList.remove("pane-zoomed","pane-zoomed-path");if(r===null)delete e.dataset.zoom,s!==void 0&&(e.dataset.header=s,s=void 0);else{window.scrollTo(0,0),e.dataset.header==="away"?(s="away",delete e.dataset.header,wl>0&&e.style.setProperty("--zoom-header-height",`${wl}px`)):t!==null&&pM(t,e),e.dataset.zoom=r;const o=gn(r)?.mount?.parentElement??null;o?.classList.add("pane-zoomed");let l=o?.parentElement??null;for(;l!==null&&l.id!=="layout-root";)l.classList.add("pane-zoomed-path"),l=l.parentElement}for(const a of document.querySelectorAll(".drawer-zoom"))a.textContent=r!==null&&a.dataset.pane===r?"RESTORE":"ZOOM";Wt("audio3")};return rt("header-restore").addEventListener("click",()=>{e.dataset.zoom!==void 0&&i(null)}),document.addEventListener("click",r=>{const a=r.target;if(!(a instanceof Element))return;const o=a.closest("[data-pane]");if(o===null)return;const l=o.dataset.pane??"";l!==""&&i(e.dataset.zoom===l?null:l)}),window.addEventListener("keydown",r=>{r.key==="Escape"&&e.dataset.zoom!==void 0&&(i(null),r.stopImmediatePropagation())}),rt("drawer").addEventListener("transitionend",r=>{r.propertyName==="height"&&n.size_fit()}),i}function cI(){const n=new RD(document.getElementById("data-cascade")),e=document.getElementById("header-telemetry");return e!==null&&n.telemetryPanel_bind(e),n}const $c=96,dI=220,em="argus.headerBand.height";function uI(){const n=document.documentElement,e=document.getElementById("header-strip"),t=document.querySelector(".wrap:not(#gap)");if(e===null||t===null)return;const s=c=>{const d=Math.max($c,window.innerHeight-dI),u=Math.min(Math.max($c,c),d);n.style.setProperty("--header-band-h",`${u}px`);try{window.localStorage.setItem(em,String(u))}catch{}},i=(()=>{try{return window.localStorage.getItem(em)}catch{return null}})();i!==null&&Number.isFinite(Number(i))&&s(Number(i));const r=()=>{const c=t.getBoundingClientRect();e.style.top=`${Math.max(0,c.bottom-5)}px`};r(),window.addEventListener("resize",r),new MutationObserver(r).observe(document.body,{attributes:!0,attributeFilter:["data-header"]}),window.setInterval(r,500);let a=!1,o=0,l=0;e.addEventListener("mousedown",c=>{const d=document.querySelector(".header-face");a=!0,o=c.clientY,l=d===null?$c:d.getBoundingClientRect().height,c.preventDefault()}),window.addEventListener("mousemove",c=>{a&&(s(l+(c.clientY-o)),r())}),window.addEventListener("mouseup",()=>{a=!1,r()})}let mM=null;function hI(){const n=document.body,e=document.querySelector(".wrap:not(#gap)"),t=r=>{n.dataset.header===r?(e!==null&&pM(e,n),n.dataset.header="away"):n.dataset.header=r};document.querySelector(".panel-1")?.addEventListener("click",()=>t("stats")),document.querySelector(".panel-2")?.addEventListener("click",()=>t("dag")),document.querySelector(".panel-gather")?.addEventListener("click",()=>t("gather"));const s=document.querySelector(".header-gather-field");s?.querySelector(".gather-stage")?.addEventListener("click",r=>{r.stopPropagation(),mM?.()}),s?.querySelector(".mode-strip")?.addEventListener("click",()=>{s!==null&&(s.dataset.modes==="open"?delete s.dataset.modes:s.dataset.modes="open")});const i=()=>{n.dataset.zoom===void 0&&(delete n.dataset.header,Wt("audio3"))};rt("header-restore").addEventListener("click",i),window.addEventListener("keydown",r=>{r.key==="Escape"&&n.dataset.header==="away"&&n.dataset.zoom===void 0&&n.dataset.gutter!=="away"&&i()})}const Br=[{key:"lower-decks",label:"LOWER DECKS"},{key:"gold",label:"CERRITOS GOLD"},{key:"medical",label:"MEDICAL"},{key:"nemesis",label:"NEMESIS"},{key:"pharos",label:"PHAROS"}],gM="argus-landing",fI=15e3;function tm(){try{return(window.localStorage.getItem(gM)??"launcher")==="launcher"}catch{return!0}}function pI(n){try{window.localStorage.setItem(gM,n?"launcher":"last")}catch{}}const sm="argus-theme",mI="argus-lcars",gI="medical",MI={sickbay:"medical"};function bI(){const n=rt("theme-pill"),e=Math.max(Br.findIndex(r=>r.key===gI),0);let t=e;try{const r=window.localStorage.getItem(sm)??window.localStorage.getItem(mI),a=r===null?null:MI[r]??r,o=Br.findIndex(l=>l.key===a);t=o>=0?o:e}catch{t=e}const s=document.documentElement,i=()=>{const r=Br[t]??Br[0];r.key==="lower-decks"?delete s.dataset.theme:s.dataset.theme=r.key,n.textContent=r.label};i(),n.addEventListener("click",()=>{t=(t+1)%Br.length,i();try{window.localStorage.setItem(sm,Br[t]?.key??"lower-decks")}catch{}Wt("audio2")})}function zI(n){const e=document.getElementById("about-rows");if(e===null)return;e.replaceChildren();const t={cumin:n.stack?.cumin,salsa:n.stack?.salsa,chili:n.stack?.chili,brasa:n.stack?.brasa,calypso:n.stack?.calypso,chell:n.stack?.chell},s=[];for(const[i,r]of Object.entries(t))r!==void 0&&s.push([i.toUpperCase(),r]);s.push(["MENU","0.13.0"],["ARGUS","a1a7cf9 · 2026-09-27 01:53Z"],["WIRE",`V${n.protocolVersion}`]),n.stack?.build!==void 0&&s.push(["BUILD",n.stack.build]);for(const[i,r]of s){const a=document.createElement("div");a.className="telemetry-row";const o=document.createElement("span");o.className="telemetry-label",o.textContent=i;const l=document.createElement("span");l.className="telemetry-value",l.textContent=r,l.title=r,a.append(o,l),e.appendChild(a)}}function nm(n){return n.replace(/\x1b\[[0-9;:]*[A-Za-z]/g,"")}function _I(){for(const n of document.querySelectorAll(".left-frame button, .left-frame-top button"))n.addEventListener("click",()=>Wt("audio2"))}let Cr=null;async function wI(n){const e=new OD(document),t=new SD(rt("index-instrument"),()=>Date.now(),{errored_open:()=>Et("status:error")}),s=new ED(rt("lane-instrument"));window.setInterval(()=>s.tick(),500);const i=new Map,r=new Map,a=new Map,o=new Map,l=new _D;l.writeObserver_set((M,v)=>{Mt.regard_send({address:M.address,...M.modelKind!==void 0?{modelKind:M.modelKind}:{},groupId:v,paneId:M.paneId}),_n()});const c=M=>$u(M,n),d=M=>MA(M,n),u=M=>{FA(d(M),M).then(v=>{Oe.line_note(v.ok?`download: ${v.name}${v.streamed?" — large; the browser fetches it itself":""}`:`download: ${M}: ${v.reason}`)})},p={imageUrl:c,download:u,textHead:async(M,v)=>{const D=await fetch(c(M));if(!D.ok||D.body===null)return(await z(M)).text.slice(0,v);const G=D.body.getReader(),T=new TextDecoder;let C="";for(;C.length<v;){const{done:$,value:j}=await G.read();if($)break;C+=T.decode(j,{stream:!0})}return G.cancel().catch(()=>{}),C.slice(0,v)},pipelineGlimpse:async M=>{const v=/_id(\d+)$/.exec(M)?.[1]??M.replace(/^.*\//,""),D=await Mt.line_execute(`pipeline diagram ${v}`,{silent:!0,observe:!1});for(const G of D.envelopes){if(G.model?.kind!==zi.pipelineDiagram)continue;const T=Jc.safeParse(G.model.data);if(T.success)return T.data.nodes.map(C=>({id:C.id,parentIds:[...C.parentIds,...C.joinParentIds??[]]}))}return null}},z=M=>Mt.line_execute(`cat "${M}"`,{silent:!0,observe:!1}).then(v=>{if(!v.envelopes.some(T=>T.status==="error"))return{ok:!0,text:nm(v.envelopes.map(T=>T.rendered).join(`
4240
+ `)}`}return"desktop save|load|show|list|delete [name]"}const hM=new Map,Jr=new Map;let HD=0;function Un(n,e){hM.set(n,e)}function qD(n){const e=hM.get(n);if(e===void 0)throw new Error(`no pane factory registered for kind '${n}'`);const t=e(`${n}-${HD++}`);return Jr.set(t.id,t),t}function Rr(n){Jr.set(n.id,n)}function gn(n){return Jr.get(n)}function Co(){return[...Jr.values()]}function Ys(n){const e=Jr.get(n);e!==void 0&&(Jr.delete(n),e.dispose?.(),e.mount.remove())}const Kp="argus-layout";class XD{root;mounts;presets=new Map;prefs={};activePreset="";tree=null;focusedPane=null;renderObserver=null;constructor(e,t){this.root=e,this.mounts=t;try{const s=window.localStorage.getItem(Kp);this.prefs=s!==null?JSON.parse(s):{}}catch{this.prefs={}}}renderObserver_set(e){this.renderObserver=e}preset_register(e,t){this.presets.set(e,t)}mount_register(e,t){this.mounts.set(e,t)}mount_remove(e){this.mounts.delete(e),this.focusedPane===e&&(this.focusedPane=null)}leaf_split(e,t,s,i=!1){if(this.tree===null)return!1;const r=_l(this.tree,e,{dir:t,ratio:.5,first:i?{pane:s}:{pane:e},second:i?{pane:e}:{pane:s}});return r===null?!1:(this.tree=r,this.focusedPane=s,this.render(),!0)}leaf_replace(e,t){if(this.tree===null)return!1;const s=_l(this.tree,e,{pane:t});return s===null?!1:(this.tree=s,this.focusedPane===e&&(this.focusedPane=t),this.render(),!0)}leaf_close(e){if(this.tree===null||"pane"in this.tree)return!1;const t=ou(this.tree,e);return t===null?!1:(this.tree=t,this.focusedPane===e&&(this.focusedPane=null),this.render(),!0)}focused_get(){return this.focusedPane}savedPreset_get(){return this.prefs.preset!==void 0&&this.presets.has(this.prefs.preset)?this.prefs.preset:null}activePreset_get(){return this.activePreset}preset_apply(e){const t=this.presets.get(e);t!==void 0&&(this.activePreset=e,this.prefs.preset=e,this.prefs_save(),this.tree=this.ratios_restore(t(),e,""),this.render(),this.root.classList.remove("layout-arrive"),this.root.offsetWidth,this.root.classList.add("layout-arrive"))}tree_get(){return this.tree===null?null:JSON.parse(JSON.stringify(this.tree))}tree_set(e){this.tree=this.ratios_restore(e,this.activePreset,""),this.render()}panes_shown(){const e=[],t=s=>{if(s!==null){if("pane"in s){e.push(s.pane);return}t(s.first),t(s.second)}};return t(this.tree),e}render(){if(this.tree!==null){for(const e of this.mounts.values())e.remove();this.root.replaceChildren(this.node_render(this.tree,"")),this.renderObserver?.()}}node_render(e,t){if("pane"in e){const o=document.createElement("div");o.className="layout-leaf",o.dataset.leaf=e.pane;const l=this.mounts.get(e.pane);return l!==void 0&&(o.appendChild(l),l.style.display="",o.addEventListener("mousedown",()=>this.focus_set(e.pane),{capture:!0}),e.pane===this.focusedPane&&o.classList.add("pane-focused")),o}const s=document.createElement("div");s.className=`layout-split layout-${e.dir}`;const i=this.node_render(e.first,`${t}0`),r=this.node_render(e.second,`${t}1`);i.style.flex=`${e.ratio} 1 0`,r.style.flex=`${1-e.ratio} 1 0`;const a=document.createElement("div");return a.className="layout-divider",this.divider_wire(a,s,e,i,r,t),s.append(i,a,r),s}divider_wire(e,t,s,i,r,a){let o=!1;e.addEventListener("mousedown",l=>{o=!0,l.preventDefault()}),window.addEventListener("mousemove",l=>{if(!o)return;const c=t.getBoundingClientRect(),d=s.dir==="col"?(l.clientX-c.left)/c.width:(l.clientY-c.top)/c.height;s.ratio=Math.min(.85,Math.max(.15,d)),i.style.flex=`${s.ratio} 1 0`,r.style.flex=`${1-s.ratio} 1 0`}),window.addEventListener("mouseup",()=>{o&&(o=!1,this.ratio_remember(a,s.ratio),this.renderObserver?.())})}focus_set(e){if(this.focusedPane===e)return;this.focusedPane=e,document.body.dataset.focus=e;for(const s of this.root.querySelectorAll(".layout-leaf"))s.classList.remove("pane-focused");this.mounts.get(e)?.parentElement?.classList.add("pane-focused")}ratios_restore(e,t,s){if("pane"in e)return e;const i=this.prefs.ratios?.[`${t}:${s}`];return{...e,ratio:i??e.ratio,first:this.ratios_restore(e.first,t,`${s}0`),second:this.ratios_restore(e.second,t,`${s}1`)}}ratio_remember(e,t){this.prefs.ratios={...this.prefs.ratios??{},[`${this.activePreset}:${e}`]:t},this.prefs_save()}prefs_save(){try{window.localStorage.setItem(Kp,JSON.stringify(this.prefs))}catch{}}}function _l(n,e,t){if("pane"in n)return n.pane===e?t:null;const s=_l(n.first,e,t);if(s!==null)return{...n,first:s};const i=_l(n.second,e,t);return i!==null?{...n,second:i}:null}function ou(n,e){if("pane"in n)return null;if("pane"in n.first&&n.first.pane===e)return n.second;if("pane"in n.second&&n.second.pane===e)return n.first;const t=ou(n.first,e);if(t!==null)return{...n,first:t};const s=ou(n.second,e);return s!==null?{...n,second:s}:null}const YD=/Failed to fetch dynamically imported module|error loading dynamically imported module|Importing a module script failed/i;function KD(n){const e=n instanceof Error?n.message:String(n??"");return YD.test(e)}function ZD(n,e=document.body){let t=!1;const s=()=>{if(t)return;t=!0,n("argus: the server has a newer argus than this page — reload to continue (what failed to load was part of the old one)");const i=document.createElement("div");i.className="stale-page",i.setAttribute("role","alert");const r=document.createElement("span");r.className="stale-page-words",r.textContent="ARGUS WAS UPDATED ON THE SERVER — THIS PAGE IS OLDER";const a=document.createElement("button");a.className="pacs-capsule stale-page-reload",a.textContent="RELOAD",a.title="load the argus the server has now",a.addEventListener("click",()=>{window.location.reload()}),i.append(r,a),e.appendChild(i)};window.addEventListener("vite:preloadError",i=>{i.preventDefault(),s()}),window.addEventListener("unhandledrejection",i=>{KD(i.reason)&&s()})}let fM=()=>{};function QD(){fM(document.body.dataset.zoom==="console"?null:"console")}const JD=mA(),eI="ARGUS",Zp="argus-audio",tI=.4;let Li=!1;function Lt(n){if(Li)return;const e=document.getElementById(n);e instanceof HTMLAudioElement&&(e.currentTime=0,e.volume=tI,e.play().catch(()=>{}))}function sI(){const n=rt("head-menu-pill"),e=t=>{t?document.body.dataset.headMenu="open":delete document.body.dataset.headMenu,n.setAttribute("aria-expanded",String(t))};n.addEventListener("click",t=>{t.stopPropagation(),e(document.body.dataset.headMenu!=="open")}),document.addEventListener("click",t=>{if(document.body.dataset.headMenu!=="open")return;t.target instanceof Element&&t.target.closest("#header-dag-info")!==null||e(!1)})}function nI(){const n=rt("audio-pill");try{Li=window.localStorage.getItem(Zp)==="off"}catch{Li=!1}const e=()=>{n.classList.toggle("audio-off",Li)};e(),n.addEventListener("click",()=>{Li=!Li;try{window.localStorage.setItem(Zp,Li?"off":"on")}catch{}e(),Lt("audio2")})}function rt(n){const e=document.getElementById(n);if(e===null)throw new Error(`required element #${n} is missing`);return e}function fn(n){const e=rt(n);if(!(e instanceof HTMLTemplateElement))throw new Error(`#${n} is not a template`);const t=e.content.firstElementChild;if(!(t instanceof HTMLElement))throw new Error(`template #${n} is empty`);return t.cloneNode(!0)}function Rs(n,e){const t=n.querySelector(e);if(t===null)throw new Error(`pane template is missing ${e}`);return t}function iI(){return gA(window.location)}const Qp=/\.(csv|tsv)$/i;let jc=null,wl=0;function pM(n,e){const t=()=>{e.dataset.zoom!==void 0||e.dataset.header==="away"||(wl=Math.ceil(n.getBoundingClientRect().bottom),e.style.setProperty("--zoom-header-height",`${wl}px`))};t(),jc===null&&(jc=new ResizeObserver(t),jc.observe(n))}const rI=2200,Jp=120,aI=96;function oI(n,e,t,s){let i="";const r=c=>{c?(i=n.style.height,n.style.height=""):i!==""&&(n.style.height=i),n.classList.toggle("drawer-closed",c),Lt("audio3"),c||(s.size_fit(),s.focus_take())};t.addEventListener("click",()=>r(!n.classList.contains("drawer-closed")));let a=0,o=0,l=!1;return e.addEventListener("mousedown",c=>{l=!0,a=c.clientY,o=n.getBoundingClientRect().height,n.classList.add("drawer-dragging"),c.preventDefault()}),window.addEventListener("mousemove",c=>{if(!l)return;const d=Math.max(Jp,window.innerHeight-aI),u=o+(c.clientY-a),h=Math.min(Math.max(Jp,u),d);n.style.height=`${h}px`,s.size_fit()}),window.addEventListener("mouseup",()=>{l=!1,n.classList.remove("drawer-dragging")}),r}function lI(n){const e=document.body,t=document.querySelector(".wrap:not(#gap)");let s;const i=r=>{for(const a of document.querySelectorAll(".pane-zoomed, .pane-zoomed-path"))a.classList.remove("pane-zoomed","pane-zoomed-path");if(r===null)delete e.dataset.zoom,s!==void 0&&(e.dataset.header=s,s=void 0);else{window.scrollTo(0,0),e.dataset.header==="away"?(s="away",delete e.dataset.header,wl>0&&e.style.setProperty("--zoom-header-height",`${wl}px`)):t!==null&&pM(t,e),e.dataset.zoom=r;const o=gn(r)?.mount?.parentElement??null;o?.classList.add("pane-zoomed");let l=o?.parentElement??null;for(;l!==null&&l.id!=="layout-root";)l.classList.add("pane-zoomed-path"),l=l.parentElement}for(const a of document.querySelectorAll(".drawer-zoom"))a.textContent=r!==null&&a.dataset.pane===r?"RESTORE":"ZOOM";Lt("audio3")};return rt("header-restore").addEventListener("click",()=>{e.dataset.zoom!==void 0&&i(null)}),document.addEventListener("click",r=>{const a=r.target;if(!(a instanceof Element))return;const o=a.closest("[data-pane]");if(o===null)return;const l=o.dataset.pane??"";l!==""&&i(e.dataset.zoom===l?null:l)}),window.addEventListener("keydown",r=>{r.key==="Escape"&&e.dataset.zoom!==void 0&&(i(null),r.stopImmediatePropagation())}),rt("drawer").addEventListener("transitionend",r=>{r.propertyName==="height"&&n.size_fit()}),i}function cI(){const n=new RD(document.getElementById("data-cascade")),e=document.getElementById("header-telemetry");return e!==null&&n.telemetryPanel_bind(e),n}const $c=96,dI=220,em="argus.headerBand.height";function uI(){const n=document.documentElement,e=document.getElementById("header-strip"),t=document.querySelector(".wrap:not(#gap)");if(e===null||t===null)return;const s=c=>{const d=Math.max($c,window.innerHeight-dI),u=Math.min(Math.max($c,c),d);n.style.setProperty("--header-band-h",`${u}px`);try{window.localStorage.setItem(em,String(u))}catch{}},i=(()=>{try{return window.localStorage.getItem(em)}catch{return null}})();i!==null&&Number.isFinite(Number(i))&&s(Number(i));const r=()=>{const c=t.getBoundingClientRect();e.style.top=`${Math.max(0,c.bottom-5)}px`};r(),window.addEventListener("resize",r),new MutationObserver(r).observe(document.body,{attributes:!0,attributeFilter:["data-header"]}),window.setInterval(r,500);let a=!1,o=0,l=0;e.addEventListener("mousedown",c=>{const d=document.querySelector(".header-face");a=!0,o=c.clientY,l=d===null?$c:d.getBoundingClientRect().height,c.preventDefault()}),window.addEventListener("mousemove",c=>{a&&(s(l+(c.clientY-o)),r())}),window.addEventListener("mouseup",()=>{a=!1,r()})}let mM=null;function hI(){const n=document.body,e=document.querySelector(".wrap:not(#gap)"),t=r=>{n.dataset.header===r?(e!==null&&pM(e,n),n.dataset.header="away"):n.dataset.header=r};document.querySelector(".panel-1")?.addEventListener("click",()=>t("stats")),document.querySelector(".panel-2")?.addEventListener("click",()=>t("dag")),document.querySelector(".panel-gather")?.addEventListener("click",()=>t("gather"));const s=document.querySelector(".header-gather-field");s?.querySelector(".gather-stage")?.addEventListener("click",r=>{r.stopPropagation(),mM?.()}),s?.querySelector(".mode-strip")?.addEventListener("click",()=>{s!==null&&(s.dataset.modes==="open"?delete s.dataset.modes:s.dataset.modes="open")});const i=()=>{n.dataset.zoom===void 0&&(delete n.dataset.header,Lt("audio3"))};rt("header-restore").addEventListener("click",i),window.addEventListener("keydown",r=>{r.key==="Escape"&&n.dataset.header==="away"&&n.dataset.zoom===void 0&&n.dataset.gutter!=="away"&&i()})}const Br=[{key:"lower-decks",label:"LOWER DECKS"},{key:"gold",label:"CERRITOS GOLD"},{key:"medical",label:"MEDICAL"},{key:"nemesis",label:"NEMESIS"},{key:"pharos",label:"PHAROS"}],gM="argus-landing",fI=15e3;function tm(){try{return(window.localStorage.getItem(gM)??"launcher")==="launcher"}catch{return!0}}function pI(n){try{window.localStorage.setItem(gM,n?"launcher":"last")}catch{}}const sm="argus-theme",mI="argus-lcars",gI="medical",MI={sickbay:"medical"};function bI(){const n=rt("theme-pill"),e=Math.max(Br.findIndex(r=>r.key===gI),0);let t=e;try{const r=window.localStorage.getItem(sm)??window.localStorage.getItem(mI),a=r===null?null:MI[r]??r,o=Br.findIndex(l=>l.key===a);t=o>=0?o:e}catch{t=e}const s=document.documentElement,i=()=>{const r=Br[t]??Br[0];r.key==="lower-decks"?delete s.dataset.theme:s.dataset.theme=r.key,n.textContent=r.label};i(),n.addEventListener("click",()=>{t=(t+1)%Br.length,i();try{window.localStorage.setItem(sm,Br[t]?.key??"lower-decks")}catch{}Lt("audio2")})}function zI(n){const e=document.getElementById("about-rows");if(e===null)return;e.replaceChildren();const t={cumin:n.stack?.cumin,salsa:n.stack?.salsa,chili:n.stack?.chili,brasa:n.stack?.brasa,calypso:n.stack?.calypso,chell:n.stack?.chell},s=[];for(const[i,r]of Object.entries(t))r!==void 0&&s.push([i.toUpperCase(),r]);s.push(["MENU","0.13.0"],["ARGUS","84522ad · 2026-09-27 17:39Z"],["WIRE",`V${n.protocolVersion}`]),n.stack?.build!==void 0&&s.push(["BUILD",n.stack.build]);for(const[i,r]of s){const a=document.createElement("div");a.className="telemetry-row";const o=document.createElement("span");o.className="telemetry-label",o.textContent=i;const l=document.createElement("span");l.className="telemetry-value",l.textContent=r,l.title=r,a.append(o,l),e.appendChild(a)}}function nm(n){return n.replace(/\x1b\[[0-9;:]*[A-Za-z]/g,"")}function _I(){for(const n of document.querySelectorAll(".left-frame button, .left-frame-top button"))n.addEventListener("click",()=>Lt("audio2"))}let Cr=null;async function wI(n){const e=new OD(document),t=new SD(rt("index-instrument"),()=>Date.now(),{errored_open:()=>Et("status:error")}),s=new ED(rt("lane-instrument"));window.setInterval(()=>s.tick(),500);const i=new Map,r=new Map,a=new Map,o=new Map,l=new _D;l.writeObserver_set((M,v)=>{Mt.regard_send({address:M.address,...M.modelKind!==void 0?{modelKind:M.modelKind}:{},groupId:v,paneId:M.paneId}),_n()});const c=M=>$u(M,n),d=M=>MA(M,n),u=M=>{FA(d(M),M).then(v=>{ve.line_note(v.ok?`download: ${v.name}${v.streamed?" — large; the browser fetches it itself":""}`:`download: ${M}: ${v.reason}`)})},p={imageUrl:c,download:u,textHead:async(M,v)=>{const D=await fetch(c(M));if(!D.ok||D.body===null)return(await z(M)).text.slice(0,v);const G=D.body.getReader(),T=new TextDecoder;let C="";for(;C.length<v;){const{done:$,value:U}=await G.read();if($)break;C+=T.decode(U,{stream:!0})}return G.cancel().catch(()=>{}),C.slice(0,v)},pipelineGlimpse:async M=>{const v=/_id(\d+)$/.exec(M)?.[1]??M.replace(/^.*\//,""),D=await Mt.line_execute(`pipeline diagram ${v}`,{silent:!0,observe:!1});for(const G of D.envelopes){if(G.model?.kind!==zi.pipelineDiagram)continue;const T=Jc.safeParse(G.model.data);if(T.success)return T.data.nodes.map(C=>({id:C.id,parentIds:[...C.parentIds,...C.joinParentIds??[]]}))}return null}},z=M=>Mt.line_execute(`cat "${M}"`,{silent:!0,observe:!1}).then(v=>{if(!v.envelopes.some(T=>T.status==="error"))return{ok:!0,text:nm(v.envelopes.map(T=>T.rendered).join(`
4241
4241
  `))};const G=v.envelopes.flatMap(T=>(T.errors??[]).map(C=>C.message)).concat(v.envelopes.map(T=>T.renderedErr??"")).map(T=>nm(T).trim()).filter(T=>T!=="").join(`
4242
- `);return{ok:!1,text:G===""?"the session refused this read and said nothing further":G}}),m=new Map,f=new Map,_=new Map,O=(M,v)=>{_.set(M,v)},w=M=>{_.get(M)?.()},x=(M,v)=>{f.set(M,v),w(M);const D=i.get(M);D?.follow_set(v),v&&D!==void 0&&Mt.line_execute("ls",{silent:!0,observe:!1}).then(G=>{for(const T of G.envelopes)D.envelope_observe(T)})},S=async(M,v,D)=>{for(const G of D){const T=`${v}/${G.name}`;Oe.line_note(`putting ${G.name} in ${v}…`);try{const C=await fetch(c(T),{method:"POST",body:G});if(!C.ok){Oe.line_note(`upload: ${G.name}: ${(await C.text()).trim()||C.statusText}`);continue}Oe.line_note(`✓ ${T}`)}catch(C){Oe.line_note(`upload: ${G.name}: ${C instanceof Error?C.message:String(C)}`)}}I(M,v)},I=(M,v)=>{const D=i.get(M);D!==void 0&&(f.get(M)===!0?Oe.line_run("ls"):A(M,D,v))},b=(M,v)=>{zn(M,{message:`New directory in ${v}: `,kind:"text",commit:"MAKE IT"}).then(D=>{const G=(D??"").trim();G!==""&&(Oe.line_run(`mkdir "${v}/${G}"`),I(M,v))})},A=(M,v,D)=>{const G=D==="~"?"ls ~":`ls "${D}"`;Mt.line_execute(G,{silent:!0,observe:!1}).then(T=>{for(const C of T.envelopes)v.envelope_observe(C)})},B=M=>/\x1b\[/.test(M)?jn(M):Ks(M).replace(/(&quot;[^&]*&quot;)/g,'<span class="man-str">$1</span>').replace(/(^|\s)(--?[a-zA-Z][\w-]*)/g,'$1<span class="man-flag">$2</span>').replace(/^(\s{0,2})([A-Za-z_ ]+):(\s)/gm,'$1<span class="man-key">$2:</span>$3').replace(/^([A-Z][A-Z ]{2,})$/gm,'<span class="man-head">$1</span>'),N=(M,v,D,G)=>{let T=null,C=null;const $=M.contentHtml_show(v,"",{diagram:!0,release:()=>{W=null,C?.(),C=null,M.mode_annunciate(""),T?.dispose(),T=null}});$!==null&&D().then(j=>{if(!$.isConnected)return;if(j===null||j.nodes.length===0){$.textContent="NOTHING TO DRAW FOR THIS ENTRY",$.classList.add("files-diagram-empty");return}j.text!==""&&M.contentText_set(j.text);const Z=document.createElement("div");Z.className="dag-facts",$.appendChild(Z);const ne=new Rl($,{select:ge=>j.facts_show(Z,ge.id,!1,G),activate:ge=>de(ge),deselect:()=>Z.replaceChildren()},{}),de=ge=>{ne.flight_into(ge.id,()=>{W={scene:ne,facts:Z},j.facts_show(Z,ge.id,!0,G)})};T=ne,ne.graph_set({nodes:j.nodes},{wave:!1}),ne.size_fit(),C=ae($,ne,M,G===null?void 0:G.run);const ze=j.nodes.length===1?j.nodes[0]:void 0;ze!==void 0&&de(ze)})},k=async M=>{const v=/_id(\d+)$/.exec(M)?.[1]??M.replace(/^.*\//,""),[D,G]=await Promise.all([Mt.line_execute(`cat "${M}"`,{silent:!0,observe:!1}),Mt.line_execute(`pipeline diagram ${v}`,{silent:!0,observe:!1})]),T=D.envelopes.map(C=>C.rendered).join(`
4243
- `);for(const C of G.envelopes){if(C.model?.kind!==zi.pipelineDiagram)continue;const $=Jc.safeParse(C.model.data);if(!$.success)continue;const j=new Map($.data.nodes.map(Z=>[Z.id,Z]));return{text:B(T),nodes:$.data.nodes.map(Z=>({id:Z.id,label:Z.label,parentIds:Z.parentIds,joinParentIds:Z.joinParentIds})),facts_show:(Z,ne,de,ze)=>{const ge=$.data.nodes.map(je=>je.label);Q(Z,ie(j.get(ne),de,ze!==null,ge),de,ze)}}}return null},L=async M=>{const v=M.replace(/^.*\//,""),D=await Mt.line_execute(`plugin info "${v}"`,{silent:!0,observe:!1});for(const G of D.envelopes){if(G.model?.kind!==m0)continue;const T=p0.safeParse(G.model.data);if(!T.success)continue;const C=T.data;return{text:"",nodes:[{id:v,label:C.name,parentIds:[],joinParentIds:[]}],facts_show:($,j,Z,ne)=>{Q($,be(C,Z,ne!==null),Z,ne)}}}return null},F=(M,v,D,G)=>{N(v,D,()=>G==="plugin"?L(D):k(D),P(M,v,D,G))},P=(M,v,D,G)=>{const T=fe.get(M);if(T===void 0)return null;const C=D.replace(/^.*\//,"");return Np(v.commandLine_get())!==C&&v.commandLine_set(Gp(T.input,C)),{line_get:()=>v.commandLine_get(),line_set:$=>v.commandLine_set($),run:()=>{Ae(M,C,G)}}};let W=null;function X(){const M=W;return M===null?!1:(W=null,M.scene.flight_back(()=>{M.facts.classList.remove("dag-facts-immersed"),M.facts.replaceChildren()}),!0)}function Q(M,v,D,G){M.replaceChildren(),M.classList.toggle("dag-facts-immersed",D);for(const{label:T,value:C,edit:$}of v){const j=document.createElement("div");j.className="telemetry-row";const Z=document.createElement("span");if(Z.className="telemetry-label",Z.textContent=T,j.appendChild(Z),$===void 0||G===null){const ne=document.createElement("span");ne.className="telemetry-value",ne.textContent=C,j.appendChild(ne)}else{const ne=vE(G.line_get(),$.flag),de=document.createElement("input");de.className="telemetry-input",de.spellcheck=!1,de.autocomplete="off",de.title=`${$.flag} — ${C}`,$.type==="boolean"?(de.type="checkbox",de.checked=ne===!0,de.addEventListener("change",()=>{G.line_set(Bp(G.line_get(),$.flag,de.checked?!0:null))})):(de.type="text",de.placeholder=$.placeholder,de.value=ne===null||ne===!0?"":ne,de.addEventListener("input",()=>{G.line_set(Bp(G.line_get(),$.flag,de.value))}));const ze=document.createElement("span");ze.className="telemetry-hint",ze.textContent=C,j.append(de,ze)}M.appendChild(j)}}function ie(M,v,D,G){if(M===void 0)return[];const T=M.arguments??[],C=[{label:"NODE",value:`${M.label} · @${M.id}`},{label:"PLUGIN",value:M.pluginName},...M.pluginVersion!==void 0?[{label:"VERSION",value:M.pluginVersion}]:[]];if(v){const $=SE(M.label,M.id,G);C.push(...T.length===0?[{label:"ARGUMENTS",value:"none — this node runs on the plugin's defaults"}]:T.map(j=>({label:j.name,value:String(j.value??""),...D?{edit:{flag:`--${$}.${j.name}`,type:typeof j.value=="boolean"?"boolean":"string",placeholder:String(j.value??"")}}:{}})))}else C.push({label:"ARGUMENTS",value:T.length===0?"none":`${T.length} — open the node to read them`});return C}function be(M,v,D){const G=[{label:"PLUGIN",value:M.name},{label:"VERSION",value:M.version},{label:"TYPE",value:M.type.toUpperCase()}],T=M.parameters;if(!v)return G.push({label:"PARAMETERS",value:T.length===0?"none":`${T.length} — open the node to read them`}),G;if(T.length===0)return G.push({label:"PARAMETERS",value:"none — this plugin takes no arguments"}),G;for(const C of T){const $=[C.type];C.optional||$.push("required");const j=C.default===void 0||C.default===null?"":String(C.default);j!==""&&$.push(`default ${j}`);const Z=$.join(" · ");G.push({label:C.flag,value:C.help===void 0?Z:`${Z} — ${C.help}`,...D?{edit:{flag:C.flag,type:C.type,placeholder:j}}:{}})}return G}function ae(M,v,D,G){const T=M.closest(".files-body"),C=T?.querySelector(".diagram-strategy")??null,$=T?.querySelector(".diagram-projection")??null,j=T?.querySelector(".diagram-pulse")??null,Z=G===void 0?null:T?.querySelector(".diagram-run")??null,ne=()=>G?.(),de=()=>{const $e=[];v.strategy_get()!=="ranked"&&$e.push("MOLECULE"),v.projection_get()!=="3d"&&$e.push("2D"),D.mode_annunciate($e.join(" · "))},ze=()=>{v.strategy_set(v.strategy_get()==="ranked"?"molecule":"ranked"),C!==null&&(C.textContent=v.strategy_get().toUpperCase()),de()},ge=()=>{v.projection_set(v.projection_get()==="3d"?"2d":"3d"),$!==null&&($.textContent=v.projection_get().toUpperCase()),de()},je=()=>{v.wave_start(),j?.classList.add("pulse-running"),window.setTimeout(()=>j?.classList.remove("pulse-running"),rI)};return C!==null&&(C.textContent=v.strategy_get().toUpperCase()),$!==null&&($.textContent=v.projection_get().toUpperCase()),C?.addEventListener("click",ze),$?.addEventListener("click",ge),j?.addEventListener("click",je),Z?.addEventListener("click",ne),de(),()=>{C?.removeEventListener("click",ze),$?.removeEventListener("click",ge),j?.removeEventListener("click",je),Z?.removeEventListener("click",ne),j?.classList.remove("pulse-running")}}const xe=(M,v,D)=>{if(D.kind==="dir"){if(f.get(M)===!0)Oe.line_run(`cd "${D.path}"`);else{const G=v.path_current();G!==null&&m.get(M)?.push(G),A(M,v,D.path)}return}if(D.kind==="plugin"||D.kind==="pipeline"){F(M,v,D.path,D.kind);return}if(Ze(D.path)){R(M,D.path).then(G=>Oe.line_note(G));return}if(l.regard_write(M,{address:D.path,modelKind:"fs.file"}),!l.groupHasViewer(M)){if(Ko(D.path)){v.contentImage_show(D.path,c(D.path));return}z(D.path).then(G=>{if(!G.ok){v.contentRefused_show(D.path,G.text);return}Qp.test(D.path)?v.contentTable_show(D.path,G.text):v.content_show(D.path,G.text)})}},Ze=M=>Gc.test(M)||Yo.test(M),nt=()=>{const M=fn("tpl-pane-files").querySelector(".files-body");if(M===null)throw new Error("tpl-pane-files has no files-body");return M};let Ve=null,le=null;const ue=M=>{const v=/_(\d+)\/data\/?$/.exec(M);return v===null?null:parseInt(v[1]??"",10)},fe=new Map,et=M=>{const v=M.match(/\/(?:feeds|jobs)\/feed_(\d+)(?:\/|$)/);return v===null?null:Number(v[1])},ct=M=>/^\/(proc|net|etc|usr)(\/|$)/.test(M),Qe=(M,v,D)=>{const G=`"${D}"`,T=v.type==="dir"||v.type==="vfs"||v.type==="job",C=et(D),$={kind:v.type==="plugin"||v.type==="pipeline"?"catalogue":T&&Rc(D,v.name)?"seriesFolder":v.type==="file"?"file":"directory",feed:C,node:C===null?null:ue(D),bound:fe.has(M),projection:ct(D)},j={image:()=>{R(M,D).then(Z=>Oe.line_note(Z))},download:()=>u(D),process:()=>y(M,{input:D,feed:C,node:C===null?null:ue(D)}),gather:()=>Te([{kind:T?"dir":"file",seriesUID:D,description:v.name,imagery:Rc(D,v.name),modality:Rc(D,v.name)?"MR":"—",patient:Ve??"",vfsPath:D,folderPath:D}]),run:()=>{Ae(M,v.name,v.type==="pipeline"?"pipeline":"plugin")},move:()=>oi(M,`mv ${G}`),copy:()=>oi(M,`cp ${G}`),delete:()=>oi(M,`rm ${T?"-ri":"-i"} ${G}`),share:()=>oi(M,`setfacl ${G}`)};return qg.rules.filter(Z=>Z.offered($)).map(Z=>({label:Z.label($),run:()=>j[Z.name]?.()}))},Zt=M=>{for(const v of M.envelopes){const D=v.model;if(typeof D!="object"||D===null)continue;const G=D.data;if(D.kind!=="fs.acl"||!Array.isArray(G))continue;const T=[];for(const C of G)Array.isArray(C.usernames)&&T.push(...C.usernames.map(String));return T.length===0?"SHARED WITH NOBODY":`SHARED WITH ${T.join(", ")}`}return"ACCESS UNREAD"},gt=(M,v,D=!1)=>{const G=fn("tpl-pane-files"),T=new zp(Rs(G,".files-panel"),C=>xe(M,T,C),p,{catalogue:D});return T.selectionVerbs_declare(C=>{const $=C.map(([ze])=>ze),j=$.map(ze=>`"${ze}"`).join(" ");C.every(([,ze])=>ze.type==="file");const Z=[];for(const ze of $){const ge=et(ze);ge!==null&&!Z.includes(ge)&&Z.push(ge)}const ne={count:$.length,feeds:Z},de={delete:()=>oi(M,`rm -rI ${j}`),move:()=>Oe.line_run(`mv -t ${j}`),copy:()=>Oe.line_run(`cp -t ${j}`),share:()=>Oe.line_run(`setfacl ${Z.map(ze=>`feed_${ze}`).join(" ")}`)};return Xg.rules.filter(ze=>ze.offered(ne)).map(ze=>({label:ze.label(ne),run:()=>de[ze.name]?.()}))}),T.rowVerbs_declare((C,$)=>Qe(M,C,$),(C,$)=>{l.regard_write(M,{address:$,modelKind:"fs.file"}),et($)!==null&&Mt.line_execute(`getfacl "${$}"`,{silent:!0,observe:!1}).then(j=>{T.rowReadout_show($,Zt(j))}).catch(()=>{T.rowReadout_show($,"ACCESS UNREAD")})}),i.set(M,T),Ve!==null&&Ve!==""&&T.home_set(`/home/${Ve}`),m.set(M,[]),f.set(M,v),w(M),T.follow_set(v),{id:M,kind:"files",mount:G,dispose:()=>{i.delete(M),m.delete(M),l.pane_leave(M)}}},Rt=new Map,it=new Map,yt=M=>{const v=fn("tpl-pane-universe"),D=new tD({canvas:Rs(v,".universe-canvas"),title:Rs(v,".universe-title"),state:v.querySelector(".pane-state"),empty:Rs(v,".universe-empty"),projectionPill:v.querySelector(".universe-projection"),refreshPill:v.querySelector(".universe-refresh"),replayPill:v.querySelector(".universe-replay"),scalePill:v.querySelector(".universe-scale"),viewPill:v.querySelector(".universe-view"),gravityPill:v.querySelector(".universe-gravity"),densityPill:v.querySelector(".universe-density"),drawPill:v.querySelector(".universe-draw"),captionsPill:v.querySelector(".universe-captions"),arrangementPill:v.querySelector(".universe-arrangement"),facts:v.querySelector(".universe-facts"),backPill:v.querySelector(".universe-back"),openPill:v.querySelector(".universe-open")},{command_run:G=>{Mt.line_execute(G,{silent:!0,observe:!1}).then(T=>{for(const C of T.envelopes)D.envelope_observe(C)})},feed_dag:async G=>{const T=await Mt.line_execute(`feed diagram feed_${G}`,{silent:!0,observe:!1});for(const C of T.envelopes){if(C.model?.kind!==zi.feedDag)continue;const $=ed.safeParse(C.model.data);if($.success)return $.data}return null},node_enter:G=>{Oe.line_run(`cd "${G}"`)},node_dive:G=>{Vt(M,G.replace(/\/data$/,""))},node_process:G=>{const T=et(G.vfsPath)??(/\/feed_(\d+)(?:\/|$)/.exec(G.vfsPath)===null?null:Number(/\/feed_(\d+)(?:\/|$)/.exec(G.vfsPath)[1])),C=Ve===null?G.vfsPath:G.vfsPath.replace(/^\/proc\/jobs\//,`/home/${Ve}/feeds/`);y(M,{input:C,feed:T,node:G.instanceId})},feed_open:G=>{Et(),$s.feed_enter(G)},plugin_open:G=>{(async()=>{const T=await Mt.line_execute("ls /bin",{silent:!0,observe:!1}),C=[];for(const j of T.envelopes){if(j.model?.kind!=="fs.listing")continue;const Z=j.model.data,ne=Array.isArray(Z)?Z:[Z];for(const de of ne)for(const ze of de.items??[])C.push(ze.name)}const $=C.filter(j=>j.startsWith(`${G}-v`)).sort((j,Z)=>j.localeCompare(Z,void 0,{numeric:!0})).pop();if($===void 0){Oe.line_note(`universe: ${G} is not in /bin`);return}rt("gutter-files").click(),F("files",i.get("files"),`/bin/${$}`,"plugin")})().catch(T=>{Oe.line_note(`universe: could not open ${G} in /bin: ${T instanceof Error?T.message:String(T)}`)})},note:G=>Oe.line_note(G)},ep());return o.set(M,D),{id:M,kind:"universe",mount:v,dispose:()=>{o.delete(M),l.pane_leave(M),D.dispose()}}},ns=M=>{const v=fn("tpl-pane-image"),D=new fD(v,{source:{url_of:c},note:G=>Oe.line_note(G),regard:G=>l.regard_write(M,{address:G,modelKind:"dicom.instance"}),file_put:async(G,T)=>{try{return(await fetch(c(G),{method:"POST",body:T})).status}catch{return 0}},tags_read:G=>as(G),tags_open:()=>{Oe.line_note(es(M))}});return it.set(M,D),{id:M,kind:"image",mount:v,dispose:()=>{D.dispose(),it.delete(M),l.pane_leave(M)}}},Ut=new Map,rs=M=>{const v=fn("tpl-pane-tags"),D=new mD(v,{note:G=>Oe.line_note(G)});return Ut.set(M,D),{id:M,kind:"tags",mount:v,dispose:()=>{Ut.delete(M),l.pane_leave(M)}}},as=async M=>{try{const v=await Mt.line_execute(`dcm tags "${M}"`,{silent:!0,observe:!1});for(const D of v.envelopes){if(D.model?.kind!==Ha.tags)continue;const G=ch.safeParse(D.model.data);if(G.success)return G.data}}catch{}return null},Qt=(M,v)=>{const D=Ut.get(M);D===void 0||D.path_get()===v||as(v).then(G=>{if(G===null){Oe.line_note(`tags: ${v}: not a readable DICOM file`);return}Ut.get(M)?.model_show(G)})},es=M=>{const v=new Set(_e.panes_shown()),D=l.group_of(M);for(const T of Ut.keys())if(v.has(T)&&l.group_of(T)===D)return _e.focus_set(T),"image tags";if(!v.has(M))return"image tags: the image pane is not on stage";const G=qt("tags",M);return _e.leaf_split(M,me?.dir??"col",G.id,me?.before??!1)?(E(G.id,M,me?.dir??"col",me?.before??!1),"image tags"):(Ys(G.id),_e.mount_remove(G.id),"image tags: could not open beside the image pane")},q=async M=>{try{const v=await Mt.line_execute(`dcm series "${M}"`,{silent:!0,observe:!1});for(const D of v.envelopes){if(D.model?.kind!==Ha.series)continue;const G=dh.safeParse(D.model.data);if(G.success)return G.data}}catch{}return null},Os=async M=>{try{const v=await Mt.line_execute(`ls "${M}"`,{silent:!0,observe:!1});for(const D of v.envelopes){if(D.model?.kind!=="fs.listing")continue;const G=D.model.data,T=(Array.isArray(G)?G[0]:G)??{},C=(T.path??M).replace(/\/$/,"");return(T.items??[]).filter($=>$.type==="dir").map($=>`${C}/${$.name}`)}}catch{}return[]},Bt=(M,v)=>{const D=j=>{v!==void 0&&l.regard_write(j,v)};if(M!==null&&it.has(M))return D(M),it.get(M)??null;const G=new Set(_e.panes_shown());if(v!==void 0){for(const[j,Z]of it)if(G.has(j)&&l.regard_get(j)?.address===v.address)return D(j),Z}const T=M!==null?l.group_of(M):null;for(const[j,Z]of it)if(G.has(j)&&T!==null&&l.group_of(j)===T)return Z;const C=M!==null&&G.has(M)?M:xs();if(C===null)return null;const $=qt("image",M??void 0);return _e.leaf_split(C,me?.dir??"col",$.id,me?.before??!1)?(E($.id,C,me?.dir??"col",me?.before??!1),D($.id),it.get($.id)??null):(Ys($.id),_e.mount_remove($.id),null)},R=async(M,v,D={},G)=>{Ht();const T=M!==null?void 0:Gc.test(v)?{address:v,modelKind:"image.volume"}:{address:Yo.test(v)?v.slice(0,v.lastIndexOf("/")):v.replace(/\/$/,""),modelKind:"dicom.series"},C=Bt(M,T);if(C===null)return"image: no pane to open beside";const $=ft(C);if($!==null&&G?.($),Gc.test(v))return C.opening_show(v),C.volume_show(v),`image ${v}`;const j=Yo.test(v),Z=j?v.slice(0,v.lastIndexOf("/")):v.replace(/\/$/,"");C.opening_show(Z);let ne=await q(Z),de=[];if(ne===null&&!j){const ge=(await Os(Z)).slice(0,32);for(const je of ge){const $e=await q(je);if($e!==null){de=ge.map(_t=>({path:_t,label:_t.split("/").pop()??_t})),ne=$e;break}}}if(ne===null)return C.opening_fail(v,"NOT A READABLE SERIES"),`image: ${v}: not a readable DICOM series, study, or volume`;const ze=j?Math.max(1,ne.files.indexOf(v)+1):1;return C.series_show(ne,{siblings:de,startAt:ze,...D.force===!0?{force:!0}:{}}),`image ${ne.path}${de.length>1?` (1 of ${de.length} series)`:""}`},y=(M,v)=>{Ht();const D=new Set(_e.panes_shown());for(const[$,j]of fe)if(D.has($)&&j.input===v.input){_e.focus_set($);return}const G=D.has(M)?M:xs()??M,T=qt("catalogue",M);if(!_e.leaf_split(G,me?.dir??"col",T.id,me?.before??!1)){Ys(T.id),_e.mount_remove(T.id);return}E(T.id,G,me?.dir??"col",me?.before??!1),fe.set(T.id,v);const C=i.get(T.id);C!==void 0&&(C.binding_set({input:v.input,place:v.feed===null?"new feed":`feed ${v.feed}${v.node===null?"":` · node ${v.node}`}`}),C.feedOpen_declare($=>ve(T.id,$)),A(T.id,C,"/bin"),re(C),_e.focus_set(T.id))},K=5,se=40,re=M=>{Mt.line_execute(`plugininstance list --limit ${se} --fields id,plugin_name,plugin_version,owner_username`,{silent:!0,observe:!1}).then(D=>{const G=[];for(const T of D.envelopes)if(!(T.model?.kind!=="plugininstance.list"||!Array.isArray(T.model.data)))for(const C of T.model.data){if(typeof C.pluginName!="string"||typeof C.pluginVersion!="string"||Ve!==null&&typeof C.owner=="string"&&C.owner!==Ve||C.pluginName==="pl-dircopy")continue;const $=`${C.pluginName}-v${C.pluginVersion}`;if(G.includes($)||G.push($),G.length>=K)break}M.recent_set(G.length===0?null:G)}).catch(()=>{})},ve=(M,v)=>{Ht();const D=new Set(_e.panes_shown());for(const[C,$]of a)if(C!=="dag"&&D.has(C)&&$.feed_get()===v){_e.focus_set(C);return}const G=D.has(M)?M:xs()??M,T=qt("dag",M);if(!_e.leaf_split(G,me?.dir??"col",T.id,me?.before??!1)){Ys(T.id),_e.mount_remove(T.id);return}E(T.id,G,me?.dir??"col",me?.before??!1),a.get(T.id)?.feed_enter(v)},Ae=async(M,v,D)=>{const G=fe.get(M),T=i.get(M);if(G===void 0||T===void 0)return;const C=ge=>{Oe.output_write("err",`\x1B[31m${ge}\x1B[0m
4244
- `);const je=T.indicated_get();je!==null&&T.rowReadout_show(je,ge.toUpperCase().slice(0,80))};if(D==="pipeline"&&G.node===null){C(`${v}: a pipeline runs on a node — PROCESS a node of a feed`);return}let $=T.commandLine_get();if(($===""||Np($)!==v)&&($=Gp(G.input,v)),G.feed===null&&!OE($)){const ge=G.input.split("/").filter(Boolean).pop()??"feed",$e=(await zn(M,{message:"Feed title: ",kind:"text",suggest:ge,commit:"RUN"})??"").trim();if($e==="")return;$=xE($,$e)}T.commandLine_set($),Oe.line_echo($);let j;try{j=await Mt.line_execute($,{silent:!0})}catch(ge){C(ge instanceof Error?ge.message:String(ge));return}Oe.outcome_write(j),j.envelopes.some(ge=>ge.model?.kind==="fs.cwd")&&Mt.line_execute("ls",{silent:!0});const ne=j.envelopes.find(ge=>ge.model?.kind==="run.scheduled")?.model?.data;if(typeof ne?.feedId=="number"){T.run_show(ne.feedId);return}const de=j.envelopes.map(ge=>ge.renderedErr??"").join(" ").replace(/\x1b\[[0-9;]*m/g,"").trim().split(`
4245
- `)[0]??"",ze=T.indicated_get();ze!==null&&T.rowReadout_show(ze,de===""?"NOT SCHEDULED":de.toUpperCase().slice(0,80))},oe=M=>{Ht();const v=new Set(_e.panes_shown());for(const[$]of i)if(v.has($)&&l.regard_get($)?.address===M){_e.focus_set($);return}let D;for(const[$,j]of it)if(v.has($)&&(l.regard_get($)?.address===M||j.state_get()?.path===M)){D=$;break}const G=xs();if(G===null)return;const T=qt("files",D);if(!_e.leaf_split(G,me?.dir??"col",T.id,me?.before??!1)){Ys(T.id),_e.mount_remove(T.id);return}E(T.id,G,me?.dir??"col",me?.before??!1),D===void 0&&l.regard_write(T.id,{address:M,modelKind:"dicom.series"});const C=i.get(T.id);C!==void 0&&A(T.id,C,M)},he=M=>{const v=fn("tpl-pane-gather"),D=new Tp(v,Rs(v,".gather-rows"),{command_run:G=>{Mt.line_execute(G,{silent:!0})},command_show:G=>Oe.line_run(G),note:G=>Oe.line_note(G),image_open:G=>{R(M,G).then(T=>Oe.line_note(T))},process_open:G=>y(M,{input:G,feed:null,node:null}),name_ask:G=>zn(M,{message:"Cohort name: ",kind:"text",suggest:G,commit:"NAME IT"}),confirm_ask:async G=>{const T=await zn(M,{message:G,kind:"confirm"});return T==="y"||T==="n"?T:null},changed:()=>_n(),dismiss:()=>{_e.leaf_close(M)||tt(),Fe(),_n()},feed_create:async G=>{Oe.line_echo(G);let T;try{T=await Mt.line_execute(G,{silent:!0})}catch(C){return Oe.output_write("err",`\x1B[31m${C instanceof Error?C.message:String(C)}\x1B[0m
4246
- `),null}Oe.outcome_write(T);for(const C of T.envelopes){if(C.model?.kind!=="feed.created")continue;const $=C.model.data;if(typeof $.feedId=="number"&&typeof $.rootInstanceId=="number"&&typeof $.path=="string")return{feedId:$.feedId,rootInstanceId:$.rootInstanceId,path:$.path}}return null},cohort_process:G=>y(M,G),feed_open:G=>ve(M,G)},He);return r.set(M,D),{id:M,kind:"gather",mount:v,dispose:()=>{r.delete(M),l.pane_leave(M)}}};let Se=null;const He=new zE;let De=!1;const Ie="~/gather/current.json";let Xe=null;const Je=()=>{Xe!==null&&window.clearTimeout(Xe),Xe=window.setTimeout(()=>{Xe=null;const M=Se?.entries_get()??[],v=JSON.stringify({version:1,name:Se?.name_get()??null,feed:Se?.feed_get()??null,series:M});Mt.line_execute("mkdir -p ~/gather",{silent:!0,observe:!1}),Mt.line_execute(`touch --withContents '${v.replace(/'/g,"'\\''")}' ${Ie}`,{silent:!0,observe:!1})},1200)},dt=async()=>{const M=await z(Ie);if(M.ok)try{const v=JSON.parse(M.text);if(!Array.isArray(v.series)||v.series.length===0)return;Se===null&&(Se=V());for(const D of v.series)Se.series_add(D);ce(),_n()}catch{}},V=()=>{const M=rt("header-gather"),v=()=>xs()??"pacs";return new Tp(M,Rs(M,".gather-rows"),{command_run:D=>{Mt.line_execute(D,{silent:!0})},command_show:D=>Oe.line_run(D),note:D=>Oe.line_note(D),image_open:D=>{R(v(),D).then(G=>Oe.line_note(G))},process_open:D=>y(v(),{input:D,feed:null,node:null}),name_ask:async D=>{const G=rt("header-gather"),T=Oe.ask_note("Cohort name: "),C=await kc(G,{message:"Cohort name: ",kind:"text",suggest:D,commit:"NAME IT"});return T(C),C},confirm_ask:async D=>{const G=rt("header-gather"),T=Oe.ask_note(`${D} `),C=await kc(G,{message:D,kind:"confirm"});return T(C),C==="y"||C==="n"?C:null},changed:()=>{_n(),ce(),Je()},dismiss:()=>{document.body.dataset.header="away",De=!0,ce()},feed_create:async D=>{Oe.line_echo(D);let G;try{G=await Mt.line_execute(D,{silent:!0})}catch(T){return Oe.output_write("err",`\x1B[31m${T instanceof Error?T.message:String(T)}\x1B[0m
4247
- `),null}Oe.outcome_write(G);for(const T of G.envelopes){if(T.model?.kind!=="feed.created")continue;const C=T.model.data;if(typeof C.feedId=="number"&&typeof C.rootInstanceId=="number"&&typeof C.path=="string")return{feedId:C.feedId,rootInstanceId:C.rootInstanceId,path:C.path}}return null},cohort_process:D=>y(v(),D),feed_open:D=>ve(v(),D)},He)},Ee=()=>{const M=new Set(_e.panes_shown()),v=[...r.keys()].find(D=>M.has(D))??null;if(v!==null)_e.focus_set(v);else{const D=xs()??"pacs",G=qt("gather","pacs");if(!_e.leaf_split(D,"col",G.id,!1)){Ys(G.id),_e.mount_remove(G.id);return}E(G.id,D,"col",!1),r.get(G.id)?.render_now()}document.body.dataset.header="away",De=!0},ce=()=>{const M=document.querySelector("#header-gather-pill");if(M===null)return;const v=Se?.entries_get().length??0;M.classList.toggle("panel-gather-empty",v===0)},Te=M=>{Se===null&&(Se=V());for(const D of M)Se.series_add(D);const v=document.body.dataset.header==="away";(!De||!v)&&(document.body.dataset.header="gather",De=!1),ce(),Je()},Ne=(M,v="pacs")=>{const D=new Set(_e.panes_shown());let G=[...r.keys()].find(C=>D.has(C))??null;if(G===null){const C=D.has(v)?v:xs()??v,$=qt("gather","pacs");if(!_e.leaf_split(C,me?.dir??"row",$.id,me?.before??!1))return Ys($.id),_e.mount_remove($.id),null;E($.id,C,me?.dir??"row",me?.before??!1),G=$.id}const T=r.get(G);if(T===void 0)return null;for(const C of M)T.series_add(C);return G},pe=M=>{const v=fn("tpl-pane-view"),D=new oD(Rs(v,".view-body"),Rs(v,".view-title"),{content_fetch:async G=>(await z(G)).text,imageUrl_build:c,path_isImage:Ko});return Rt.set(M,D),{id:M,kind:"view",mount:v,dispose:()=>{Rt.delete(M),l.pane_leave(M)}}},Pe=new Map,Ue=M=>a.get(M)??o.get(M),Vt=(M,v)=>{const G=gn(M)?.mount?.querySelector(".dag-canvas, .universe-canvas")??null,T=Pe.get(M);if(T!==void 0&&!T.element.isConnected&&Pe.delete(M),G===null||Pe.has(M)){Oe.line_note(`dag: ${v}: ${G===null?"this pane has no scene to fly in":"a node is already open here"} — flew back out`),Ue(M)?.flight_back(()=>{});return}const C=document.createElement("div");C.className="node-overlay";const $=document.createElement("header");$.className="node-overlay-header";const j=document.createElement("span");j.textContent=`INSIDE ${v}`.toUpperCase();const Z=document.createElement("span");Z.className="node-overlay-hint",Z.textContent="ESC EXITS NODE",$.append(j,Z);const ne=nt();ne.classList.add("node-overlay-body"),C.append($,ne);const de=[],ze=new zp(Rs(ne,".files-panel"),ge=>{if(ge.kind==="dir"){const je=ge.path.startsWith("/proc/jobs/")?(ge.path.split("/").pop()??"").match(/_(\d+)$/):null;if(je!==null){const _t=parseInt(je[1]??"",10);Pt(M,()=>{Ue(M)?.node_flyTo(_t)!==!0&&Vt(M,ge.path)});return}const $e=ze.path_current();$e!==null&&de.push($e),A(M,ze,ge.path);return}if(l.regard_write(M,{address:ge.path,modelKind:"fs.file"}),!l.groupHasViewer(M)){if(Ze(ge.path)){R(M,ge.path).then(je=>Oe.line_note(je));return}if(Ko(ge.path)){ze.contentImage_show(ge.path,c(ge.path));return}z(ge.path).then(je=>{if(!je.ok){ze.contentRefused_show(ge.path,je.text);return}Qp.test(ge.path)?ze.contentTable_show(ge.path,je.text):ze.content_show(ge.path,je.text)})}},p);ze.rowVerbs_declare((ge,je)=>Qe(M,ge,je),(ge,je)=>{l.regard_write(M,{address:je,modelKind:"fs.file"})}),Pe.set(M,{element:C,panel:ze,history:de}),G.appendChild(C),window.requestAnimationFrame(()=>C.classList.add("node-overlay-open")),A(M,ze,v)},Pt=(M,v)=>{const D=Pe.get(M);if(D===void 0){v?.();return}Pe.delete(M),D.element.classList.remove("node-overlay-open");const G=()=>{D.element.remove(),v?.()},T=Ue(M);T!==void 0?T.flight_back(G):G()},js=(M,v)=>{const D=fn("tpl-pane-dag"),G=new jE(Rs(D,".dag-canvas"),Rs(D,".dag-title"),Rs(D,".dag-facts"),Rs(D,".dag-empty"),Rs(D,".dag-strategy"),Rs(D,".dag-feedlist"),{command_run:T=>{Mt.line_execute(T,{silent:!0,observe:!1}).then(C=>{for(const $ of C.envelopes)G.envelope_observe($)})},watch_set:(T,C)=>{C?Mt.watch_send(T):Mt.unwatch_send(T)},node_enter:T=>{Oe.line_run(`cd "${T}"`)},node_dive:T=>{Vt(M,T.replace(/\/data$/,""))},node_regard:T=>{l.regard_write(M,{address:T,modelKind:"feed.node"})},node_process:T=>{const C=et(T.vfsPath)??(/\/feed_(\d+)(?:\/|$)/.exec(T.vfsPath)===null?null:Number(/\/feed_(\d+)(?:\/|$)/.exec(T.vfsPath)[1])),$=Ve===null?T.vfsPath:T.vfsPath.replace(/^\/proc\/jobs\//,`/home/${Ve}/feeds/`);y(M,{input:$,feed:C,node:T.instanceId})},feed_regard:T=>{l.regard_write(M,{address:T,modelKind:"feed"})},feed_verbs:T=>{const C={feedId:T.id},$={share:()=>Oe.line_run(`setfacl feed_${T.id}`),delete:()=>Oe.line_run(`feed rm feed_${T.id}`)};return Yg.rules.filter(j=>j.offered(C)).map(j=>({label:j.label(C),run:()=>$[j.name]?.()}))},feed_indicated:T=>{l.regard_write(M,{address:`/proc/jobs/feed_${T.id}`,modelKind:"feed"}),Mt.line_execute(`getfacl feed_${T.id}`,{silent:!0,observe:!1}).then(C=>{a.get(M)?.rowReadout_show(T.id,Zt(C))}).catch(()=>{a.get(M)?.rowReadout_show(T.id,"ACCESS UNREAD")})},...v?{feed_shown:()=>Le()}:{}});return a.set(M,G),{id:M,kind:"dag",mount:D,dispose:()=>{Pe.get(M)?.element.remove(),Pe.delete(M),a.delete(M),l.pane_leave(M),G.dispose()}}},Ls=gt("files",!0);Rr(Ls);const ta=js("dag",!0);Rr(ta);const sa=yt("universe");Rr(sa);const ii=fn("tpl-pane-launcher");Rr({id:"launcher",kind:"launcher",mount:ii});const ri=fn("tpl-pane-panes");Rr({id:"panes",kind:"panes",mount:ri});const Nl=i.get("files"),$s=a.get("dag"),na=new CD(rt("pipeline-cycler"),rt("pipeline-cycler-name"),M=>{Mt.line_execute(M,{silent:!0})}),xs=()=>{const M=_e.tree_get();if(M===null)return null;const v=[],D=T=>{if("pane"in T){v.push(T.pane);return}D(T.first),D(T.second)};D(M);const G=_e.focused_get();return G!==null&&v.includes(G)?G:v[0]??null},ia=async M=>{const v=xs();if(v===null)return null;const D=qt("files");if(!_e.leaf_split(v,me?.dir??"col",D.id,me?.before??!1))return Ys(D.id),_e.mount_remove(D.id),null;E(D.id,v,me?.dir??"col",me?.before??!1);const G=i.get(D.id),T=M.path?.anchor??"~";G!==void 0&&A(D.id,G,T);const C=D.mount.querySelector(".files-body");if(C===null)return Ys(D.id),_e.mount_remove(D.id),null;const $=document.createElement("div");$.className="errand-bar",C.insertBefore($,C.firstChild);const j=document.createElement("span");j.className="errand-caption",j.textContent=M.message.trim();const Z=document.createElement("input");Z.className="errand-path",Z.spellcheck=!1;const ne=document.createElement("button");ne.className="pacs-capsule errand-commit",ne.textContent=M.commit??"USE THIS",$.append(j,Z,ne);const de=()=>{const je=G?.path_current()??T,$e=M.path?.suggest;Z.value=M.path?.wantsDirectory===!0||$e===void 0?je:`${je.replace(/\/$/,"")}/${$e}`};de();let ze=!1;Z.addEventListener("input",()=>{ze=!0});const ge=()=>{ze||de()};return D.mount.addEventListener("click",ge),Oe.question_set(!0),new Promise(je=>{const $e=_t=>{D.mount.removeEventListener("click",ge),Oe.question_set(!1),Ii=null,_e.leaf_close(D.id),Ys(D.id),_e.mount_remove(D.id),je(_t)};Ii=()=>$e(null),ne.addEventListener("click",()=>$e(Z.value.trim()===""?null:Z.value.trim())),Z.addEventListener("keydown",_t=>{_t.key==="Enter"&&$e(Z.value.trim()===""?null:Z.value.trim())})})};let Ii=null,lr=null,ai=null;const oi=(M,v)=>{ai=M,Oe.line_run(v)},zn=async(M,v)=>{const D=gn(M)?.mount;if(D===void 0)return lr?.(!1),Oe.ask_open({message:v.message,kind:v.kind,...v.suggest===void 0?{}:{suggest:v.suggest}});const G=Oe.ask_note(v.message),T=await kc(D,v);return G(v.kind==="secret"&&T!==null?"••••••":T),T},Qs=new pE(rt("pacs-workspace"),{command_run:M=>{/^(pacs query|pull )/.test(M)&&Oe.line_echo(M),Mt.line_execute(M,{silent:!0}).then(v=>{for(const D of v.envelopes)Qs.envelope_observe(D)})},command_show:M=>{Oe.line_run(M)},note:M=>Oe.line_note(M),image_open:M=>{R(null,M).then(v=>Oe.line_note(v))},dir_open:M=>oe(M),process_open:M=>y("pacs",{input:M,feed:null,node:null}),gather_add:M=>Te([M]),gathered_is:M=>Se?.has(M)===!0,workspace_close:()=>tt()});Rr({id:"pacs",kind:"pacs",mount:rt("pacs-workspace")});const _n=()=>{const M=new Set(_e.panes_shown()),v=new Map;for(const D of Co()){if(!M.has(D.id))continue;const G=l.regard_get(D.id)?.address;if(G===void 0)continue;const T=Ts(D.id);if(T!=="image"&&T!=="files")continue;const C=G.replace(/\/$/,""),$=v.get(C)??{viewer:!1,browser:!1};T==="image"?$.viewer=!0:$.browser=!0,v.set(C,$)}Qs.stage_lit(v)},_e=new XD(rt("layout-root"),new Map([["dag",ta.mount],["universe",sa.mount],["files",Ls.mount],["pacs",rt("pacs-workspace")],["launcher",ii],["panes",ri]]));let ln=!1;const Cl=()=>ln?{dir:"col",ratio:.45,first:{pane:"files"},second:{pane:"dag"}}:{pane:"files"};_e.preset_register("files",Cl),_e.preset_register("pacs",()=>({pane:"pacs"})),_e.preset_register("dag",()=>({pane:"dag"})),_e.preset_register("universe",()=>({pane:"universe"})),_e.preset_register("panes",()=>({pane:"panes"})),_e.preset_register("launcher",()=>({pane:"launcher"})),_e.renderObserver_set(()=>{window.requestAnimationFrame(()=>{for(const M of a.values())M.size_fit()})});const $a=new Map,E=(M,v,D,G,T)=>{$a.set(M,{parent:v,dir:D,before:G,...T!==void 0?{binding:T}:{}})},Y=(M,v,D,G)=>{const T=v==="view"?qt("view",M):v==="fs"?qt("files",M):qt("empty");if(!_e.leaf_split(M,D,T.id,G))return Ys(T.id),_e.mount_remove(T.id),null;if(E(T.id,M,D,G,v),v==="fs"){const C=j=>{const Z=i.get(T.id);if(Z===void 0)return;const ne=j.modelKind==="fs.file"?j.address.replace(/\/[^/]*$/,"")||"/":j.address;A(T.id,Z,ne)};l.regard_subscribe(T.id,C);const $=l.regard_get(M);$!==null&&C($)}return T.id},te=new iA(Pg,ep());Object.assign(globalThis,{__argusDormant:{list:()=>te.list(),get:M=>te.get(M),dismiss:M=>te.dismiss(M)}});const J=M=>{if(M==="pacs")return"⊞";if(M==="dag")return"⋔";const v=Ts(M);return v==="image"?"▣":v==="tags"?"≣":"▤"},ee=M=>{if(M.length===0)return;const v=[];for(const ne of M){const de=gn(ne)?.mount;if(de===void 0)continue;const ze=de.getBoundingClientRect();ze.width>0&&ze.height>0&&v.push({id:ne,left:ze.left,top:ze.top,width:ze.width,height:ze.height})}if(v.length===0)return;const D=Math.min(...v.map(ne=>ne.left)),G=Math.min(...v.map(ne=>ne.top)),T=Math.max(...v.map(ne=>ne.left+ne.width))-D,C=Math.max(...v.map(ne=>ne.top+ne.height))-G;if(T<=0||C<=0)return;const $=240,j=$/T,Z=Math.max(40,Math.min(260,Math.round(C*j)));try{const ne=document.createElement("canvas");ne.width=$,ne.height=Z;const de=ne.getContext("2d");if(de===null)return;const ge=getComputedStyle(document.documentElement).getPropertyValue("--harvestgold").trim()||"#c9a15a";de.fillStyle="#05070a",de.fillRect(0,0,$,Z);for(const je of v){const $e=Math.round((je.left-D)*j),_t=Math.round((je.top-G)*j),Kt=Math.max(6,Math.round(je.width*j)),wt=Math.max(6,Math.round(je.height*j)),ht=gn(je.id)?.mount.querySelector("canvas");if(ht!=null&&ht.width>0){const gs=Math.min(Kt/ht.width,wt/ht.height),bt=Math.round(ht.width*gs),Ct=Math.round(ht.height*gs);de.fillStyle="#000",de.fillRect($e,_t,Kt,wt),de.drawImage(ht,$e+Math.round((Kt-bt)/2),_t+Math.round((wt-Ct)/2),bt,Ct)}else de.fillStyle="rgba(255,255,255,0.05)",de.fillRect($e,_t,Kt,wt),de.fillStyle=ge,de.font=`${Math.max(9,Math.min(28,Math.round(Math.min(Kt,wt)*.5)))}px serif`,de.textAlign="center",de.textBaseline="middle",de.fillText(J(je.id),$e+Kt/2,_t+wt/2+1);de.strokeStyle="rgba(255,255,255,0.22)",de.lineWidth=1,de.strokeRect($e+.5,_t+.5,Kt-1,wt-1)}return ne.toDataURL("image/png")}catch{return}};let Ge=!1,me=null;const Re=()=>{if(Ge)return;const M=new Set(_e.panes_shown()),v=_e.activePreset_get();if(v==="panes"||v==="launcher")return;const D=Co().map($e=>$e.id).filter($e=>M.has($e)),G=new Map;let T,C;const $=[];for(const $e of D){const _t=Ts($e),Kt=$a.get($e),wt=G.get(Kt?.parent??"")??0,ht={dir:Kt?.dir??"col",side:Kt?.before?"before":"after"},gs=bt=>{G.set($e,$.length),$.push(bt)};if($e==="pacs"||$e==="files"||$e==="dag"){const bt=v==="dag"?"runs":v,Ct=v==="pacs"?Qs.query_get():null,Ms=v==="dag"?a.get("dag"):void 0,Js=Ms!==void 0&&Ms.graph_isShown()?Ms.feed_get():null,la=Js!==null&&Ms!==void 0?Ms.view_lines():[];Js!==null&&C===void 0&&(C=Ms?.feedTitle_get()),gs({op:"domain",domain:bt,...Ct!==null?{query:Ct}:{},...Js!==null?{feed:Js}:{},...la.length>0?{view:la}:{}})}else if(Kt?.binding==="fs"||Kt?.binding==="view"||Kt?.binding==="empty")gs({op:Kt.binding,target:wt,...ht});else if(_t==="image"){const bt=it.get($e),Ct=bt?.state_get()??null;if(bt===void 0||Ct===null||Ct.path===null)continue;const Ms=[];if(Ct.layout!=="single"&&Ms.push(`image layout ${Ct.layout}`),Ct.colormap!==void 0&&Ct.colormap!=="gray"&&Ms.push(`image colormap ${Ct.colormap}`),Ct.voi!==void 0&&Ct.voi!==null&&Ms.push(`image wl ${Ct.voi.lower} ${Ct.voi.upper}`),Ct.slice>1&&Ms.push(`image slice ${Ct.slice}`),Ct.ghost!==void 0&&Ct.ghost!==null&&Ct.layout==="slab"&&Ms.push(`image ghost ${Ct.ghost}`),gs({op:"image",path:Ct.path,target:wt,...ht,...Ms.length>0?{view:Ms}:{}}),T===void 0){T=Ct.path;const Js=bt.series_get(),la=[Js?.seriesDescription??"",Js?.modality??""].filter(zM=>zM!=="");la.length>0&&(C=la.join(" · "))}}else if(fe.has($e)){const bt=fe.get($e);if(bt===void 0)continue;const Ct=i.get($e)?.commandLine_get()??"";gs({op:"catalogue",input:bt.input,target:wt,...ht,...bt.feed!==null?{feed:bt.feed}:{},...bt.node!==null?{node:bt.node}:{},...Ct!==""?{line:Ct}:{}}),C===void 0&&(C=`PROCESS ${bt.input.split("/").filter(Boolean).pop()??bt.input}`)}else if(_t==="files"){const bt=i.get($e)?.path_current()??null;if(typeof bt!="string"||bt.length===0)continue;gs({op:"dir",path:bt,target:wt,...ht})}else if(_t==="gather"){const bt=r.get($e);if(bt===void 0)continue;const Ct=[...bt.entries_get()],Ms=bt.name_get(),Js=bt.feed_get();gs({op:"gather",series:Ct,target:wt,...ht,...Ms!==null?{name:Ms}:{},...Js!==null?{feed:Js.feedId,root:{instance:Js.rootInstanceId,path:Js.path}}:{}}),C===void 0&&(C=Ms??`GATHER · ${Ct.length} series`)}else if(_t==="dag"){const bt=a.get($e)?.feed_get()??null;if(bt===null)continue;gs({op:"graph",feed:bt,target:wt,...ht})}else _t==="tags"&&gs({op:"tags",target:wt,...ht})}const j=$.filter($e=>$e.op!=="domain"||$e.feed!==void 0);if(j.length===0)return;const Z=ee(D),ne={image:"viewer",view:"viewer",dir:"files",fs:"files",tags:"tags",empty:"pane",domain:"dag",catalogue:"catalogue",graph:"dag",gather:"gather"},de=[...new Set(j.map($e=>ne[$e.op]??"pane"))];let ze,ge,je;if(T!==void 0)ze=T,ge=C??T.split("/").pop()??T,je={address:T,modelKind:"dicom.series"};else{const $e=j.map(wt=>wt.path).find(wt=>wt!==void 0),_t=j.map(wt=>wt.path??(wt.input!==void 0?`catalogue:${wt.input}`:wt.series!==void 0?`gather:${wt.series.map(ht=>ht.seriesUID).join(",")}`:wt.feed!==void 0?`feed:${wt.feed}`:wt.op)).sort().join("|"),Kt=v==="dag"?"RUNS":v.toUpperCase();ze=`${v}:${_t}`,ge=C!==void 0&&C!==""?C:$e!==void 0?$e.split("/").pop()??$e:`${Kt} · ${j.length+1} panes`,je={address:ze,modelKind:"argus.desktop"}}te.add({id:ze,label:ge,regard:je,members:de,actions:$,...Z===void 0?{}:{thumbnail:Z},lastTouched:Date.now()})},Fe=()=>{const M=new Set(_e.panes_shown());for(const v of Co())M.has(v.id)||v.id==="files"||v.id==="dag"||v.id==="pacs"||v.id==="panes"||v.id==="launcher"||v.id==="universe"||(Ys(v.id),_e.mount_remove(v.id));_n()},We=M=>{Re(),_e.preset_apply(M),Fe()},tt=()=>{We("files"),$s.size_fit()},ft=M=>[...it.entries()].find(([,v])=>v===M)?.[0]??null,Ye=async M=>{const v=te.get(M);if(v===void 0||v.actions===void 0)return;te.dismiss(M);const D=G=>Co().filter(T=>_e.panes_shown().includes(T.id)&&Ts(T.id)===G).map(T=>T.id);Ge=!0;try{const G=[];for(const T of v.actions){const C=G[T.target??0]??null,$={dir:T.dir??"col",before:T.side==="before"};if(T.op==="domain"){const j=T.domain==="runs"?"dag":T.domain==="pacs"?"pacs":"files";if(We(j),T.query!==void 0&&Oe.line_run(T.query),T.feed!==void 0){const Z=T.feed,ne=T.view??[],de=a.get("dag");if(de?.feed_enter(Z),ne.length>0&&de!==void 0){const ze=ge=>{if(de.graph_isShown()&&de.feed_get()===Z){for(const je of ne)Oe.line_run(je);return}ge>0&&window.setTimeout(()=>ze(ge-1),250)};ze(240)}}G.push(j)}else if(T.op==="image"&&T.path!==void 0){C!==null&&_e.focus_set(C);let j=null;me=$;const Z=R(null,T.path,{},ze=>{j=ze});me=null,G.push(j);const ne=T.view,de=j;ne!==void 0&&ne.length>0&&de!==null&&Z.then(()=>{for(const ze of ne)_e.focus_set(de),Oe.line_run(ze)}).catch(()=>{})}else if(T.op==="dir"&&T.path!==void 0){C!==null&&_e.focus_set(C);const j=new Set(D("files"));me=$,oe(T.path),me=null,G.push(D("files").find(Z=>!j.has(Z))??null)}else if(T.op==="tags"){C!==null&&_e.focus_set(C);const j=new Set(D("tags"));me=$,Oe.line_run("image tags"),me=null,G.push(D("tags").find(Z=>!j.has(Z))??null)}else if(T.op==="catalogue"&&T.input!==void 0){C!==null&&_e.focus_set(C);const j=()=>[...fe.keys()].filter(de=>_e.panes_shown().includes(de)),Z=new Set(j());me=$,y(C??"files",{input:T.input,feed:T.feed??null,node:T.node??null}),me=null;const ne=j().find(de=>!Z.has(de))??null;ne!==null&&T.line!==void 0&&i.get(ne)?.commandLine_set(T.line),G.push(ne)}else if(T.op==="gather"&&T.series!==void 0){C!==null&&_e.focus_set(C),me=$;const j=Ne([...T.series],C??"pacs");me=null,j!==null&&T.name!==void 0&&r.get(j)?.name_set(T.name),j!==null&&T.feed!==void 0&&T.root!==void 0&&r.get(j)?.feed_set({feedId:T.feed,rootInstanceId:T.root.instance,path:T.root.path}),G.push(j)}else if(T.op==="graph"&&T.feed!==void 0){C!==null&&_e.focus_set(C);const j=new Set(D("dag"));me=$,ve(C??"files",T.feed),me=null,G.push(D("dag").find(Z=>!j.has(Z))??null)}else if(T.op==="fs"||T.op==="view"||T.op==="empty"){if(C===null){G.push(null);continue}_e.focus_set(C),G.push(Y(C,T.op,$.dir,$.before))}else G.push(null)}}finally{Ge=!1,_n()}},Nt=()=>{We("launcher"),Tt.render(),_e.focus_set("launcher")},Ht=()=>{_e.activePreset_get()==="launcher"&&(ln=!1,tt())},Jt=async()=>{const[M,v]=await Promise.all([Mt.line_execute("proc feeds",{silent:!0,observe:!1}),Mt.line_execute("ls ~",{silent:!0,observe:!1})]);let D=[];for(const ht of M.envelopes){const gs=ht.model;if(gs===void 0||gs.kind!==gm)continue;const bt=mm.safeParse(gs.data);bt.success&&(D=bt.data.feeds)}const T=D.length===0&&M.envelopes.some(ht=>ht.status==="error")?"INDEX WARMING":`${D.length} FEEDS`,C=D.filter(ht=>/error/i.test(ht.status)).length,$=D.filter(ht=>/running|scheduled|created|started/i.test(ht.status)).length;let j=[],Z="~";for(const ht of v.envelopes){if(ht.model?.kind!=="fs.listing")continue;const bt=ht.model.data[0];bt!==void 0&&Array.isArray(bt.items)&&(j=bt.items,typeof bt.path=="string"&&(Z=bt.path))}const ne=j.filter(ht=>ht.type==="dir"),de=te.list(),ze={key:"universe",name:"UNIVERSE",hue:"--honey",numeral:"",figures:[{text:T}],rows:[{text:"every feed as it landed — branches by pipeline, feeds as leaves",open:()=>cn()}],verb:"SEE THE SPACE",enter:()=>cn()},ge={key:"analyses",name:"ANALYSES",hue:"--october-sunset",numeral:"3",figures:[{text:T},...$>0?[{text:`${$} RUNNING`}]:[],...C>0?[{text:`${C} ERRORED`,errored:!0,open:()=>Et("status:error")}]:[]],rows:D.slice(0,6).map(ht=>({text:`${ht.id} ${ht.title}`,errored:/error/i.test(ht.status),open:()=>{Et(),a.get("dag")?.feed_enter(ht.id)}})),verb:"OPEN THE ROSTER",enter:()=>Et()},je={key:"files",name:"FILES",hue:"--harvestgold",numeral:"2",figures:[{text:`${j.length} ENTRIES`}],rows:ne.slice(0,5).map(ht=>({text:ht.name,open:()=>{ln=!1,tt();const gs=Z.endsWith("/")?`${Z}${ht.name}`:`${Z}/${ht.name}`;Oe.line_run(`cd "${gs}"`)}})),verb:"OPEN HOME",enter:()=>{ln=!1,tt(),_e.focus_set("files")}},$e=Qs.query_get()??"",_t={key:"pacs",name:"PACS",hue:"--daybreak",numeral:"4",figures:[{text:$e===""?"NO ANSWER":"ANSWERED"}],rows:$e===""?[{text:"pacs query PatientID:…",open:()=>Oe.line_offer("pacs query PatientID:")},{text:"pacs query AccessionNumber:…",open:()=>Oe.line_offer("pacs query AccessionNumber:")}]:[{text:$e.slice(0,48)}],verb:"ASK A PACS",enter:()=>{We("pacs"),_e.focus_set("pacs")}},Kt={key:"panes",name:"PANES",hue:"--butter",numeral:"6",figures:[{text:de.length===0?"EMPTY":`${de.length} DESKTOPS`}],rows:de.slice(0,5).map(ht=>({text:ht.label,open:()=>{Ye(ht.id)}})),verb:"SEE DESKTOPS",enter:()=>{We("panes"),us.render(),_e.focus_set("panes")}},wt=[je,_t,Kt,ze];return D.length>=j.length?[ge,...wt]:[je,ge,_t,Kt,ze]},Tt=new _E(ii,{tiles:Jt,startHere_get:tm,startHere_set:pI});setInterval(()=>{_e.activePreset_get()==="launcher"&&(!ii.isConnected||document.visibilityState!=="visible"||Tt.render())},fI);const us=new rA(ri,{list:()=>te.list(),restore:M=>{Ye(M)},dismiss:M=>{te.dismiss(M)}}),Le=()=>{const M=_e.activePreset_get();if(M==="pacs"||M==="dag"||M==="launcher"){ln=!0;return}ln&&M==="files"||(ln=!0,tt())},qt=(M,v)=>{const D=qD(M);return l.pane_join(D.id,v!==void 0?l.group_of(v):D.id),M==="tags"&&l.regard_subscribe(D.id,G=>{G.modelKind==="dicom.instance"&&Qt(D.id,G.address)}),M==="view"&&(l.viewer_mark(D.id),l.regard_subscribe(D.id,G=>{G.modelKind!=="dicom.instance"&&Rt.get(D.id)?.regard_show(G)})),_e.mount_register(D.id,D.mount),pt(D.id,M,D.mount),D},pt=(M,v,D)=>{const G=D.querySelector(".pane-drawer"),T=D.querySelector(".pane-handle");if(G===null||T===null)return;T.addEventListener("click",Z=>{Z.target instanceof Element&&Z.target.closest("button")!==null||(G.hidden=!G.hidden,G.hidden||G.querySelector("button")?.focus(),Wt("audio3"))});const C=G.querySelector(".drawer-zoom");C!==null&&(C.dataset.pane=M);for(const Z of G.querySelectorAll(".drawer-bind"))Z.addEventListener("click",()=>{for(const ne of G.querySelectorAll(".drawer-bind"))ne.classList.remove("drawer-bind-selected");Z.classList.add("drawer-bind-selected"),Wt("audio3")});for(const Z of G.querySelectorAll("[data-split]"))Z.addEventListener("click",()=>{const ne=Z.dataset.split==="row"?"row":"col",de=Z.dataset.place==="before",ze=G.querySelector(".drawer-bind-selected")?.dataset.bind??"unlinked";Y(M,ze==="viewer"?"view":ze==="fs"?"fs":"empty",ne,de)!==null&&(G.hidden=!0,Wt("audio3"))});G.querySelector(".drawer-close")?.addEventListener("click",()=>{if(M==="dag"){ln=!1,tt();return}_e.leaf_close(M)||tt(),Fe(),Wt("audio3")});const $=G.querySelector(".drawer-children");if($===null)return;const j=(Z,ne,de,ze="")=>{const ge=document.createElement("button");ge.className=`pacs-capsule drawer-child${ze===""?"":` ${ze}`}`,ge.textContent=Z,ge.title=ne,ge.addEventListener("click",()=>{de(),G.hidden=!0,Wt("audio3")}),$.appendChild(ge)};if(v==="files"||v==="catalogue"){const Z=G.querySelector(".drawer-binding");if(Z!==null){const ge=document.createElement("span");ge.className="drawer-label drawer-label-cwd",ge.textContent="CWD",Z.appendChild(ge);const je=($e,_t,Kt)=>{const wt=document.createElement("button");return wt.className="pacs-capsule drawer-cwdbind",wt.dataset.follow=_t?"on":"off",wt.textContent=$e,wt.title=Kt,wt.addEventListener("click",()=>{f.get(M)===!0!==_t&&x(M,_t),Wt("audio3")}),Z.appendChild(wt),wt};je("FOLLOW CWD",!0,"bind this browser to the session cwd (the console's browser)"),je("ROOT HERE",!1,"unbind from the cwd: this browser keeps its own place"),O(M,()=>{const $e=f.get(M)===!0;for(const _t of Z.querySelectorAll(".drawer-cwdbind"))_t.classList.toggle("drawer-bind-selected",_t.dataset.follow==="on"===$e)}),w(M)}const ne=()=>f.get(M)===!0;D.querySelector(".files-home")?.addEventListener("click",()=>{if(ne()){Oe.line_run("cd ~");return}const ge=i.get(M);if(ge===void 0)return;const je=ge.path_current();je!==null&&m.get(M)?.push(je),A(M,ge,"~")}),D.querySelector(".files-back")?.addEventListener("click",()=>{if(ne()){Oe.line_run("cd -");return}const ge=i.get(M),je=m.get(M)?.pop();ge!==void 0&&je!==void 0&&A(M,ge,je)});const de=()=>i.get(M)?.path_current()??null;D.querySelector(".files-mkdir")?.addEventListener("click",()=>{const ge=de();ge!==null&&b(M,ge)}),D.querySelector(".files-refresh")?.addEventListener("click",()=>{const ge=de();ge!==null&&I(M,ge)});const ze=D.querySelector(".files-upload-input");D.querySelector(".files-upload")?.addEventListener("click",()=>{de()!==null&&ze?.click()}),ze?.addEventListener("change",()=>{const ge=de(),je=ze.files;ge===null||je===null||je.length===0||(S(M,ge,Array.from(je)),ze.value="")})}v==="dag"&&(j("ENTER NODE","move the session into the indicated node (its data directory)",()=>{const Z=l.regard_get(M),ne=a.get(M)?.feed_get()??null,de=Z===null?ne===null?null:`/proc/jobs/feed_${ne}`:Z.modelKind==="fs.file"?Z.address.replace(/\/[^/]*$/,"")||"/":Z.address;de!==null&&Oe.line_run(`cd "${de}"`)}),j("PROCESS NODE","run an executable on the indicated node's output (a catalogue opens beside)",()=>{const Z=l.regard_get(M),ne=a.get(M)?.feed_get()??null;if(Z===null||ne===null)return;const de=Z.modelKind==="fs.file"?Z.address.replace(/\/[^/]*$/,"")||"/":Z.address,ze=ue(de)??(/_(\d+)\/?$/.exec(de)===null?null:parseInt(/_(\d+)\/?$/.exec(de)?.[1]??"",10));ze!==null&&y(M,{input:de.replace(/\/data\/?$/,"")+"/data",feed:ne,node:ze})}),j("ENTER FEED","move the session into the feed on stage (or the one picked in the roster)",()=>{const Z=a.get(M)?.feed_get()??null;Z!==null&&Oe.line_run(`cd "/proc/jobs/feed_${Z}"`)}),j("BACK","return to the previous listing inside the node",()=>{const Z=Pe.get(M),ne=Z?.history.pop();Z!==void 0&&ne!==void 0&&A(M,Z.panel,ne)}),j("CLEAR DETAIL","dismiss the node facts (a click on empty space does too)",()=>{a.get(M)?.detail_clear()}),j("REFRESH","revisit the feed now (a watch keeps sampling it while it runs)",()=>{a.get(M)?.refresh()}))};pt("files","files",Ls.mount),pt("dag","dag",ta.mount),pt("universe","universe",sa.mount),pt("pacs","pacs",rt("pacs-workspace")),pt("launcher","launcher",ii),pt("panes","panes",ri);let zs=!1;const _s=M=>{zs=M};for(const M of["click","focusin"])document.addEventListener(M,v=>{v.target instanceof Element&&(v.target.closest("#drawer")!==null?zs=!0:v.target.closest("#layout-root")!==null&&(zs=!1))});const Vs=()=>{let M=!1;for(const v of document.querySelectorAll(".pane-drawer:not([hidden])"))v.hidden=!0,M=!0;return M},Rn=()=>{let M=!1;for(const v of document.querySelectorAll('.workspace-pane[data-modes="open"]'))delete v.dataset.modes,M=!0;return Qs.serverStrip_isOpen()&&(Qs.serverStrip_close(),M=!0),M};document.addEventListener("click",M=>{if(!(M.target instanceof Element)||M.target.closest(".mode-frame")!==null&&M.target.closest(".mode-fill")===null||M.target.closest("#pacs-server-strip")!==null||M.target.closest("#pacs-f-server")!==null||M.target.closest(".listing-framed .listing-row")!==null)return;const v=M.target.closest(".mode-strip"),D=v?.closest(".workspace-pane")??null,G=D?.dataset.modes==="open",T=Rn();if(v!==null&&D!==null&&!G){D.dataset.modes="open",Wt("audio3");return}T&&Wt("audio3")}),window.addEventListener("keydown",M=>{if(M.key==="Escape"){if(!Va.hidden){aa(),M.stopImmediatePropagation();return}if(Oe.ask_abandon()){M.stopImmediatePropagation(),Wt("audio3");return}if(sD()){M.stopImmediatePropagation(),Wt("audio3");return}if(Ii!==null){Ii(),M.stopImmediatePropagation(),Wt("audio3");return}for(const ne of it.values())if(ne.field_release()){M.stopImmediatePropagation(),Wt("audio3");return}let v=!1;for(const ne of Oe.ask_isOpen()?[]:i.values())ne.select_isOn()&&(ne.select_toggle(!1),v=!0);if(v){M.stopImmediatePropagation(),Wt("audio3");return}const D=Vs(),G=Rn();if(D||G){M.stopImmediatePropagation(),Wt("audio3");return}if(document.body.dataset.zoom!==void 0)return;if(X()){M.stopImmediatePropagation(),Wt("audio3");return}const T=[...Pe.keys()].pop();if(T!==void 0){const ne=Pe.get(T);ne!==void 0&&ne.panel.content_isShown()?ne.panel.listing_restore():Pt(T),M.stopImmediatePropagation(),Wt("audio3");return}const C=[...a.entries()].find(([,ne])=>ne.inside_isHeld());if(C!==void 0){C[1].flight_back(()=>{}),M.stopImmediatePropagation(),Wt("audio3");return}const $=_e.focused_get(),Z=[...i.entries()].filter(([,ne])=>ne.content_isShown()).sort(([ne],[de])=>ne===$?-1:de===$?1:0)[0];if(Z!==void 0){Z[1].listing_restore(),M.stopImmediatePropagation(),Wt("audio3");return}for(const ne of a.values())if(ne.nav_pop()){M.stopImmediatePropagation(),Wt("audio3");return}return}if((M.key==="ArrowRight"||M.key==="ArrowLeft"||M.key==="ArrowDown"||M.key==="ArrowUp")&&document.activeElement instanceof HTMLButtonElement){const v=document.activeElement.closest(".pane-drawer");if(v!==null&&!v.hidden){const D=[...v.querySelectorAll("button")],G=D.indexOf(document.activeElement),T=M.key==="ArrowRight"||M.key==="ArrowDown";D[(G+(T?1:D.length-1))%D.length]?.focus(),M.preventDefault(),M.stopImmediatePropagation()}return}if(M.key===":"&&document.querySelector(".pane-drawer:not([hidden])")!==null){Vs(),Wl(),M.preventDefault(),M.stopImmediatePropagation();return}if(M.key==="b"&&M.ctrlKey&&!M.altKey&&!M.metaKey){if(document.querySelector(".pane-drawer:not([hidden])")!==null){Vs(),Wl(),M.preventDefault();return}M.preventDefault();const v=document.body.dataset.zoom,D=v==="console"||v===void 0&&zs,G=v!==void 0&&v!=="console"?v:_e.focused_get()??"files",T=D?rt("console-drawer"):gn(G)?.mount?.querySelector(".pane-drawer")??null;if(T===null)return;M.preventDefault(),T.hidden=!T.hidden,T.hidden||T.querySelector("button")?.focus(),Wt("audio3")}},{capture:!0});const Lt=(M,v,D)=>{if(v==="pacs"){_e.preset_apply("pacs"),Fe();for(const C of D)Qs.envelope_observe(C);return}const G=qt(v);if(_e.leaf_replace(M,G.id),Ys(M),_e.mount_remove(M),v==="tags"){const C=Ut.get(G.id);for(const $ of D){if($.model?.kind!==Ha.tags)continue;const j=ch.safeParse($.model.data);j.success&&C?.model_show(j.data)}return}if(v==="image"){const C=it.get(G.id);for(const $ of D){if($.model?.kind!==Ha.series)continue;const j=dh.safeParse($.model.data);j.success&&C?.series_show(j.data)}return}const T=v==="files"||v==="catalogue"?i.get(G.id):a.get(G.id);for(const C of D)T?.envelope_observe(C)};Un("files",M=>gt(M,!1)),Un("catalogue",M=>gt(M,!1,!0)),Un("dag",M=>js(M,!1)),Un("universe",yt),Un("view",pe),Un("image",ns),Un("tags",rs),Un("gather",he),Un("empty",M=>{const v=fn("tpl-pane-empty");return new rD(v,{execute:D=>Mt.line_execute(D,{silent:!0,observe:!1}),claim:(D,G)=>Lt(M,D,G)}),{id:M,kind:"empty",mount:v}});const Yt=M=>{M?document.body.dataset.gutter="away":delete document.body.dataset.gutter,Wt("audio3")},Ws=(M,v)=>{if(_e.activePreset_get()===M){Yt(!0);return}document.body.dataset.gutter==="away"&&delete document.body.dataset.gutter,v()};rt("gutter-restore").addEventListener("click",()=>Yt(!1)),window.addEventListener("keydown",M=>{M.key==="Escape"&&document.body.dataset.gutter==="away"&&document.body.dataset.zoom===void 0&&Yt(!1)}),rt("gutter-files").addEventListener("click",()=>{Ws("files",()=>{ln=!1,tt(),_e.focus_set("files"),_s(!1)})});const Et=(M="")=>{We("dag"),$s.list_reset(),$s.roster_filter(M),$s.feedsChooser_request(),_e.focus_set("dag"),_s(!1)},cn=()=>{We("universe");const M=o.get("universe");M!==void 0&&!M.shown_get()&&M.request(),_e.focus_set("universe"),_s(!1)};rt("gutter-runs").addEventListener("click",()=>Ws("dag",()=>Et())),rt("gutter-console").addEventListener("click",()=>{rt("drawer").classList.contains("drawer-closed")&&rt("drawer-toggle").click(),Oe.focus_take(),_s(!0)}),rt("gutter-tools").addEventListener("click",()=>{Ws("pacs",()=>{We("pacs"),_e.focus_set("pacs"),_s(!1)})}),rt("gutter-dashboard").addEventListener("click",()=>{Ws("launcher",Nt)}),rt("gutter-panes").addEventListener("click",()=>{Ws("panes",()=>{We("panes"),us.render(),_e.focus_set("panes"),_s(!1)})});const Ts=M=>gn(M)?.kind??null,ra={focused_get:()=>{const M=document.body.dataset.zoom;return M!==void 0&&M!=="console"?M:_e.focused_get()??_e.panes_shown()[0]??null},focus_set:M=>gn(M)===void 0?!1:(_e.focus_set(M),!0),panes_shown:()=>_e.panes_shown(),paneRect_get:M=>document.querySelector(`.layout-leaf[data-leaf="${M}"]`)?.getBoundingClientRect()??null,paneMount_get:M=>gn(M)?.mount??null,paneKind_get:Ts,paneLinked_get:M=>l.group_of(M)!==M,feed_enter:M=>$s.feed_enter(M),consoleZoom_toggle:QD,launcher_enter:Nt,identity_get:()=>le,node_immerse:M=>{const D=l.regard_get(M)?.address.match(/_(\d+)(?:\/data)?\/?$/)??null;return D===null?!1:a.get(M)?.node_flyTo(parseInt(D[1]??"",10))??!1},file_download:M=>{const v=l.regard_get(M);return v===null||v.modelKind!=="fs.file"?!1:(u(v.address),!0)},image_open:(M,v,D)=>R(M,v,D??{}),image_control:async(M,v,D)=>{const G=new Set(_e.panes_shown()),T=l.group_of(M),C=[...it.entries()].filter(([j])=>G.has(j)),$=it.get(M)??C.find(([j])=>l.group_of(j)===T)?.[1]??(C.length===1?C[0]?.[1]:void 0);if($===void 0)return`image ${v}: no image pane on stage for '${M}'`;if(v==="state"){const j=$.state_get();if(j===null)return"image state: no image on the field";const Z=(j.viewports??[]).map(ne=>`${ne.id.replace(/^.*-/,"")} scale=${ne.scale.toFixed(3)} focus=${ne.focus.map(de=>de.toFixed(2)).join(",")} voi=${ne.voi===null?"-":`${ne.voi.lower.toFixed(1)}..${ne.voi.upper.toFixed(1)}`}`).join(" | ");return`image: layout=${j.layout} tool=${j.tool} primary=${j.primaryTool??"-"} slice=${j.slice}/${j.slices} refused=${j.refused} annotations=${j.annotations} filled=${j.filled}
4248
- viewports: ${Z||"(none)"}`}if(v==="layout"){const j=D[0]??"";return jA.includes(j)?await $.layout_set(j)?`image layout ${j}`:$.state_get()?.waiting===j?`image layout ${j}: waiting for LOAD`:`image layout ${j}: not offered`:"image layout single|mpr|3d|slab"}if(v==="slice"){const j=Number(D[0]);return!Number.isInteger(j)||j<1?"image slice <n>":$.slice_set(j)?`image slice ${j}`:`image slice ${j}: not offered`}if(v==="series"){const j=Number(D[0]),Z=$.siblings_get();if(Z.length===0)return"image series: this pane holds one series, not a study";const ne=Z[j-1];if(ne===void 0)return`image series <1..${Z.length}>: ${Z.map((ze,ge)=>`${ge+1} ${ze.label}`).join(" · ")}`;const de=await q(ne.path);return de===null?`image series ${j}: ${ne.path}: not a readable DICOM series`:($.series_show(de,{siblings:[...Z]}),`image series ${j} ${ne.label}`)}if(v==="wl"){if((D[0]??"").toLowerCase()==="preset"){const ne=D[1]??"";return ne===""?"image wl preset <brain|bone|lung|soft|liver>":$.wlPreset_set(ne)?`image wl preset ${ne}`:`image wl preset ${ne}: none for this modality`}const j=Number(D[0]),Z=Number(D[1]);return!Number.isFinite(j)||!Number.isFinite(Z)||j>=Z?"image wl <lower> <upper> | image wl preset <name>":$.wl_set(j,Z)?`image wl ${j} ${Z}`:"image wl: not offered"}if(v==="colormap"){const j=(D[0]??"").toLowerCase();return Xo.includes(j)?$.colormap_set(j)?`image colormap ${j}`:`image colormap ${j}: not offered`:"image colormap gray|hot|jet|cool"}if(v==="save")return await $.annotations_save()?"image save":"image save: nothing saved (the console says why)";if(v==="load")return await $.load_press()?"image load":"image load: nothing was waiting";if(v==="guard"){if((D[0]??"").toLowerCase()==="off")return $.guard_set(null),"image guard off";const Z=Number(D[0]);return!Number.isFinite(Z)||Z<0?`image guard <bytes>|off (now ${$.guard_get()===null?"off":$.guard_get()})`:($.guard_set(Z),`image guard ${Z}`)}if(v==="ghost"){const Z=(D[0]??"").toLowerCase()==="off"?null:Number(D[0]);return Z!==null&&(!Number.isFinite(Z)||Z<0||Z>1)?"image ghost <0..1>|off (SLAB layout)":$.ghost_set(Z)?`image ghost ${Z===null?"off":Z}`:"image ghost: SLAB layout only"}if(v==="tags"){const j=[...it.entries()].find(([,Z])=>Z===$)?.[0];return j===void 0?"image tags: no image pane":es(j)}return"image <path> · layout single|mpr|3d · slice <n> · series <n> · wl <lo> <hi> | wl preset <name> · colormap <name> · save"},universe_control:(M,v,D)=>{const G=new Set(_e.panes_shown()),T=(M!==null?o.get(M):void 0)??[...o.entries()].find(([C])=>G.has(C))?.[1];return T===void 0?"universe: no universe pane on stage (press the dashboard tile)":T.control(v,D)},tags_control:(M,v,D)=>{const G=new Set(_e.panes_shown()),T=l.group_of(M),C=[...Ut.entries()].filter(([j])=>G.has(j)),$=Ut.get(M)??C.find(([j])=>l.group_of(j)===T)?.[1]??(C.length===1?C[0]?.[1]:void 0);if($===void 0)return`tags ${v}: no tags pane on stage for '${M}'`;if(v==="redact"){const j=(D[0]??"").toLowerCase();return j!=="on"&&j!=="off"?"tags redact on|off":($.redact_set(j==="on"),`tags redact ${j}`)}if(v==="filter"){const j=D.join(" ");return j===""||j.toLowerCase()==="off"?($.filter_set(null),"tags filter off"):($.filter_set(j),`tags filter ${j}`)}return"tags redact on|off · filter <text>|off"},file_delete:M=>{const v=l.regard_get(M);return v===null||v.modelKind!=="fs.file"?!1:(Oe.line_run(`rm "${v.address}"`),!0)},session_run:async M=>{try{return(await Mt.line_execute(M,{silent:!0,observe:!1})).envelopes.map(D=>D.renderedErr??D.rendered).join(`
4249
- `)}catch(v){return v instanceof Error?v.message:String(v)}},desktop_serialize:()=>{const M=_e.tree_get();if(M===null)return"# empty desktop";const v=[],D=de=>"pane"in de?de.pane:D(de.first),G=D(M),T=Ts(G);v.push(`view ${T==="dag"?"runs":T==="pacs"?"pacs":"files"}`);let C=1;const $=(de,ze)=>{const ge=Ts(de);if(ge==="dag"&&de!==G&&v.push(`pane %${ze} claim runs`),ge==="files"&&de!==G&&l.group_of(de)===de&&v.push(`pane %${ze} claim files`),ge==="dag"){const je=gn(de)?.mount,$e=je?.querySelector(".dag-strategy")?.textContent?.toLowerCase()??"ranked",_t=je?.querySelector(".dag-projection")?.textContent?.toLowerCase()??"3d",Kt=je?.querySelector(".dag-hue")?.textContent?.toLowerCase()??"status";$e!=="ranked"&&v.push(`dag %${ze} layout ${$e}`),_t!=="3d"&&v.push(`dag %${ze} projection ${_t}`),Kt!=="status"&&v.push(`dag %${ze} hue ${Kt}`)}},j=(de,ze)=>{if("pane"in de){$(de.pane,ze);return}const ge=D(de.second),je=Ts(ge),$e=je==="view"?"viewer":je==="files"&&l.group_of(ge)!==ge?"fs":"unlinked";v.push(`pane %${ze} bind ${$e}`),v.push(`pane %${ze} split ${de.dir==="col"?"right":"below"}`);const _t=++C;j(de.first,ze),j(de.second,_t)};j(M,C);const Z=document.body.dataset.header;return Z!==void 0&&v.push(`header ${Z}`),document.getElementById("drawer")?.classList.contains("drawer-closed")&&v.push("console close"),v.join(`
4250
- `)}},Va=rt("lang-palette"),li=rt("lang-input"),Pl=rt("lang-result"),Ll=rt("lang-pill"),Wl=()=>{Vs(),Va.hidden=!1,Ll.classList.add("lang-live"),Pl.textContent="",li.value="",li.focus(),Wt("audio3")},aa=()=>{Va.hidden=!0,Ll.classList.remove("lang-live"),Pl.textContent=""};Ll.addEventListener("click",()=>{Va.hidden?Wl():aa()});const MM=["pane","view","runs","node","dag","file","pacs","header","console","back","desktop","argus"],Qu={pane:["split","zoom","close","bind","claim","focus"],view:["files","runs","pacs"],runs:["enter","sort","filter"],node:["enter","immerse","back","clear"],dag:["layout","projection","scale","hue","pulse","census","physics","refresh"],physics:["charge","link","collide","gravity","reset"],file:["home","back","download","delete","sort","filter","follow","root","list","cards","preview"],pacs:["sort","filter","connect","disconnect","list","query","pull","status"],header:["stats","dag","away","restore"],console:["open","close","toggle","zoom","height"],desktop:["save","load","show","list","delete"],split:["left","right","above","below"],bind:["unlinked","fs","viewer"],claim:["files","runs","pacs"],layout:["ranked","molecule"],projection:["2d","3d"],scale:["time","size"],hue:["status","compute"],argus:["verbs"]};li.addEventListener("keydown",M=>{if(M.key==="Escape"){M.stopPropagation(),aa();return}if(M.key==="Tab"){M.preventDefault();const v=li.value.split(/\s+/),D=v[v.length-1]??"",G=v.length<=1?"":v[v.length-2]??"",C=(v.length<=1?MM:Qu[G]??Qu[v[0]??""]??[]).find($=>$.startsWith(D.toLowerCase()));C!==void 0&&(v[v.length-1]=C,li.value=`${v.join(" ")} `);return}if(M.key==="Enter"){const v=li.value.trim();if(v.length===0){aa();return}au(ra,v).then(D=>{D!==null?(Pl.textContent=D,Oe.output_write("data",`: ${v}
4242
+ `);return{ok:!1,text:G===""?"the session refused this read and said nothing further":G}}),m=new Map,f=new Map,_=new Map,O=(M,v)=>{_.set(M,v)},w=M=>{_.get(M)?.()},x=(M,v)=>{f.set(M,v),w(M);const D=i.get(M);D?.follow_set(v),v&&D!==void 0&&Mt.line_execute("ls",{silent:!0,observe:!1}).then(G=>{for(const T of G.envelopes)D.envelope_observe(T)})},S=async(M,v,D)=>{for(const G of D){const T=`${v}/${G.name}`;ve.line_note(`putting ${G.name} in ${v}…`);try{const C=await fetch(c(T),{method:"POST",body:G});if(!C.ok){ve.line_note(`upload: ${G.name}: ${(await C.text()).trim()||C.statusText}`);continue}ve.line_note(`✓ ${T}`)}catch(C){ve.line_note(`upload: ${G.name}: ${C instanceof Error?C.message:String(C)}`)}}I(M,v)},I=(M,v)=>{const D=i.get(M);D!==void 0&&(f.get(M)===!0?ve.line_run("ls"):A(M,D,v))},b=(M,v)=>{zn(M,{message:`New directory in ${v}: `,kind:"text",commit:"MAKE IT"}).then(D=>{const G=(D??"").trim();G!==""&&(ve.line_run(`mkdir "${v}/${G}"`),I(M,v))})},A=(M,v,D)=>{const G=D==="~"?"ls ~":`ls "${D}"`;Mt.line_execute(G,{silent:!0,observe:!1}).then(T=>{for(const C of T.envelopes)v.envelope_observe(C)})},B=M=>/\x1b\[/.test(M)?jn(M):Ks(M).replace(/(&quot;[^&]*&quot;)/g,'<span class="man-str">$1</span>').replace(/(^|\s)(--?[a-zA-Z][\w-]*)/g,'$1<span class="man-flag">$2</span>').replace(/^(\s{0,2})([A-Za-z_ ]+):(\s)/gm,'$1<span class="man-key">$2:</span>$3').replace(/^([A-Z][A-Z ]{2,})$/gm,'<span class="man-head">$1</span>'),N=(M,v,D,G)=>{let T=null,C=null;const $=M.contentHtml_show(v,"",{diagram:!0,release:()=>{W=null,C?.(),C=null,M.mode_annunciate(""),T?.dispose(),T=null}});$!==null&&D().then(U=>{if(!$.isConnected)return;if(U===null||U.nodes.length===0){$.textContent="NOTHING TO DRAW FOR THIS ENTRY",$.classList.add("files-diagram-empty");return}U.text!==""&&M.contentText_set(U.text);const Z=document.createElement("div");Z.className="dag-facts",$.appendChild(Z);const ne=new Rl($,{select:Se=>U.facts_show(Z,Se.id,!1,G),activate:Se=>ie(Se),deselect:()=>Z.replaceChildren()},{}),ie=Se=>{ne.flight_into(Se.id,()=>{W={scene:ne,facts:Z},U.facts_show(Z,Se.id,!0,G)})};T=ne,ne.graph_set({nodes:U.nodes},{wave:!1}),ne.size_fit(),C=oe($,ne,M,G===null?void 0:G.run);const be=U.nodes.length===1?U.nodes[0]:void 0;be!==void 0&&ie(be)})},k=async M=>{const v=/_id(\d+)$/.exec(M)?.[1]??M.replace(/^.*\//,""),[D,G]=await Promise.all([Mt.line_execute(`cat "${M}"`,{silent:!0,observe:!1}),Mt.line_execute(`pipeline diagram ${v}`,{silent:!0,observe:!1})]),T=D.envelopes.map(C=>C.rendered).join(`
4243
+ `);for(const C of G.envelopes){if(C.model?.kind!==zi.pipelineDiagram)continue;const $=Jc.safeParse(C.model.data);if(!$.success)continue;const U=new Map($.data.nodes.map(Z=>[Z.id,Z]));return{text:B(T),nodes:$.data.nodes.map(Z=>({id:Z.id,label:Z.label,parentIds:Z.parentIds,joinParentIds:Z.joinParentIds})),facts_show:(Z,ne,ie,be)=>{const Se=$.data.nodes.map(Ze=>Ze.label);Q(Z,re(U.get(ne),ie,be!==null,Se),ie,be)}}}return null},L=async M=>{const v=M.replace(/^.*\//,""),D=await Mt.line_execute(`plugin info "${v}"`,{silent:!0,observe:!1});for(const G of D.envelopes){if(G.model?.kind!==m0)continue;const T=p0.safeParse(G.model.data);if(!T.success)continue;const C=T.data;return{text:"",nodes:[{id:v,label:C.name,parentIds:[],joinParentIds:[]}],facts_show:($,U,Z,ne)=>{Q($,Me(C,Z,ne!==null),Z,ne)}}}return null},j=(M,v,D,G)=>{N(v,D,()=>G==="plugin"?L(D):k(D),P(M,v,D,G))},P=(M,v,D,G)=>{const T=fe.get(M);if(T===void 0)return null;const C=D.replace(/^.*\//,"");return Np(v.commandLine_get())!==C&&v.commandLine_set(Gp(T.input,C)),{line_get:()=>v.commandLine_get(),line_set:$=>v.commandLine_set($),run:()=>{Ae(M,C,G)}}};let W=null;function X(){const M=W;return M===null?!1:(W=null,M.scene.flight_back(()=>{M.facts.classList.remove("dag-facts-immersed"),M.facts.replaceChildren()}),!0)}function Q(M,v,D,G){M.replaceChildren(),M.classList.toggle("dag-facts-immersed",D);for(const{label:T,value:C,edit:$}of v){const U=document.createElement("div");U.className="telemetry-row";const Z=document.createElement("span");if(Z.className="telemetry-label",Z.textContent=T,U.appendChild(Z),$===void 0||G===null){const ne=document.createElement("span");ne.className="telemetry-value",ne.textContent=C,U.appendChild(ne)}else{const ne=vE(G.line_get(),$.flag),ie=document.createElement("input");ie.className="telemetry-input",ie.spellcheck=!1,ie.autocomplete="off",ie.title=`${$.flag} — ${C}`,$.type==="boolean"?(ie.type="checkbox",ie.checked=ne===!0,ie.addEventListener("change",()=>{G.line_set(Bp(G.line_get(),$.flag,ie.checked?!0:null))})):(ie.type="text",ie.placeholder=$.placeholder,ie.value=ne===null||ne===!0?"":ne,ie.addEventListener("input",()=>{G.line_set(Bp(G.line_get(),$.flag,ie.value))}));const be=document.createElement("span");be.className="telemetry-hint",be.textContent=C,U.append(ie,be)}M.appendChild(U)}}function re(M,v,D,G){if(M===void 0)return[];const T=M.arguments??[],C=[{label:"NODE",value:`${M.label} · @${M.id}`},{label:"PLUGIN",value:M.pluginName},...M.pluginVersion!==void 0?[{label:"VERSION",value:M.pluginVersion}]:[]];if(v){const $=SE(M.label,M.id,G);C.push(...T.length===0?[{label:"ARGUMENTS",value:"none — this node runs on the plugin's defaults"}]:T.map(U=>({label:U.name,value:String(U.value??""),...D?{edit:{flag:`--${$}.${U.name}`,type:typeof U.value=="boolean"?"boolean":"string",placeholder:String(U.value??"")}}:{}})))}else C.push({label:"ARGUMENTS",value:T.length===0?"none":`${T.length} — open the node to read them`});return C}function Me(M,v,D){const G=[{label:"PLUGIN",value:M.name},{label:"VERSION",value:M.version},{label:"TYPE",value:M.type.toUpperCase()}],T=M.parameters;if(!v)return G.push({label:"PARAMETERS",value:T.length===0?"none":`${T.length} — open the node to read them`}),G;if(T.length===0)return G.push({label:"PARAMETERS",value:"none — this plugin takes no arguments"}),G;for(const C of T){const $=[C.type];C.optional||$.push("required");const U=C.default===void 0||C.default===null?"":String(C.default);U!==""&&$.push(`default ${U}`);const Z=$.join(" · ");G.push({label:C.flag,value:C.help===void 0?Z:`${Z} — ${C.help}`,...D?{edit:{flag:C.flag,type:C.type,placeholder:U}}:{}})}return G}function oe(M,v,D,G){const T=M.closest(".files-body"),C=T?.querySelector(".diagram-strategy")??null,$=T?.querySelector(".diagram-projection")??null,U=T?.querySelector(".diagram-pulse")??null,Z=G===void 0?null:T?.querySelector(".diagram-run")??null,ne=()=>G?.(),ie=()=>{const $e=[];v.strategy_get()!=="ranked"&&$e.push("MOLECULE"),v.projection_get()!=="3d"&&$e.push("2D"),D.mode_annunciate($e.join(" · "))},be=()=>{v.strategy_set(v.strategy_get()==="ranked"?"molecule":"ranked"),C!==null&&(C.textContent=v.strategy_get().toUpperCase()),ie()},Se=()=>{v.projection_set(v.projection_get()==="3d"?"2d":"3d"),$!==null&&($.textContent=v.projection_get().toUpperCase()),ie()},Ze=()=>{v.wave_start(),U?.classList.add("pulse-running"),window.setTimeout(()=>U?.classList.remove("pulse-running"),rI)};return C!==null&&(C.textContent=v.strategy_get().toUpperCase()),$!==null&&($.textContent=v.projection_get().toUpperCase()),C?.addEventListener("click",be),$?.addEventListener("click",Se),U?.addEventListener("click",Ze),Z?.addEventListener("click",ne),ie(),()=>{C?.removeEventListener("click",be),$?.removeEventListener("click",Se),U?.removeEventListener("click",Ze),Z?.removeEventListener("click",ne),U?.classList.remove("pulse-running")}}const Oe=(M,v,D)=>{if(D.kind==="dir"){if(f.get(M)===!0)ve.line_run(`cd "${D.path}"`);else{const G=v.path_current();G!==null&&m.get(M)?.push(G),A(M,v,D.path)}return}if(D.kind==="plugin"||D.kind==="pipeline"){j(M,v,D.path,D.kind);return}if(Ke(D.path)){R(M,D.path).then(G=>ve.line_note(G));return}if(l.regard_write(M,{address:D.path,modelKind:"fs.file"}),!l.groupHasViewer(M)){if(Ko(D.path)){v.contentImage_show(D.path,c(D.path));return}z(D.path).then(G=>{if(!G.ok){v.contentRefused_show(D.path,G.text);return}Qp.test(D.path)?v.contentTable_show(D.path,G.text):v.content_show(D.path,G.text)})}},Ke=M=>Gc.test(M)||Yo.test(M),nt=()=>{const M=fn("tpl-pane-files").querySelector(".files-body");if(M===null)throw new Error("tpl-pane-files has no files-body");return M};let je=null,ce=null;const ue=M=>{const v=/_(\d+)\/data\/?$/.exec(M);return v===null?null:parseInt(v[1]??"",10)},fe=new Map,et=M=>{const v=M.match(/\/(?:feeds|jobs)\/feed_(\d+)(?:\/|$)/);return v===null?null:Number(v[1])},ct=M=>/^\/(proc|net|etc|usr)(\/|$)/.test(M),Qe=(M,v,D)=>{const G=`"${D}"`,T=v.type==="dir"||v.type==="vfs"||v.type==="job",C=et(D),$={kind:v.type==="plugin"||v.type==="pipeline"?"catalogue":T&&Rc(D,v.name)?"seriesFolder":v.type==="file"?"file":"directory",feed:C,node:C===null?null:ue(D),bound:fe.has(M),projection:ct(D)},U={image:()=>{R(M,D).then(Z=>ve.line_note(Z))},download:()=>u(D),process:()=>y(M,{input:D,feed:C,node:C===null?null:ue(D)}),gather:()=>Te([{kind:T?"dir":"file",seriesUID:D,description:v.name,imagery:Rc(D,v.name),modality:Rc(D,v.name)?"MR":"—",patient:je??"",vfsPath:D,folderPath:D}]),run:()=>{Ae(M,v.name,v.type==="pipeline"?"pipeline":"plugin")},move:()=>oi(M,`mv ${G}`),copy:()=>oi(M,`cp ${G}`),delete:()=>oi(M,`rm ${T?"-ri":"-i"} ${G}`),share:()=>oi(M,`setfacl ${G}`)};return qg.rules.filter(Z=>Z.offered($)).map(Z=>({label:Z.label($),run:()=>U[Z.name]?.()}))},Zt=M=>{for(const v of M.envelopes){const D=v.model;if(typeof D!="object"||D===null)continue;const G=D.data;if(D.kind!=="fs.acl"||!Array.isArray(G))continue;const T=[];for(const C of G)Array.isArray(C.usernames)&&T.push(...C.usernames.map(String));return T.length===0?"SHARED WITH NOBODY":`SHARED WITH ${T.join(", ")}`}return"ACCESS UNREAD"},gt=(M,v,D=!1)=>{const G=fn("tpl-pane-files"),T=new zp(Rs(G,".files-panel"),C=>Oe(M,T,C),p,{catalogue:D});return T.selectionVerbs_declare(C=>{const $=C.map(([be])=>be),U=$.map(be=>`"${be}"`).join(" ");C.every(([,be])=>be.type==="file");const Z=[];for(const be of $){const Se=et(be);Se!==null&&!Z.includes(Se)&&Z.push(Se)}const ne={count:$.length,feeds:Z},ie={delete:()=>oi(M,`rm -rI ${U}`),move:()=>ve.line_run(`mv -t ${U}`),copy:()=>ve.line_run(`cp -t ${U}`),share:()=>ve.line_run(`setfacl ${Z.map(be=>`feed_${be}`).join(" ")}`)};return Xg.rules.filter(be=>be.offered(ne)).map(be=>({label:be.label(ne),run:()=>ie[be.name]?.()}))}),T.rowVerbs_declare((C,$)=>Qe(M,C,$),(C,$)=>{l.regard_write(M,{address:$,modelKind:"fs.file"}),et($)!==null&&Mt.line_execute(`getfacl "${$}"`,{silent:!0,observe:!1}).then(U=>{T.rowReadout_show($,Zt(U))}).catch(()=>{T.rowReadout_show($,"ACCESS UNREAD")})}),i.set(M,T),je!==null&&je!==""&&T.home_set(`/home/${je}`),m.set(M,[]),f.set(M,v),w(M),T.follow_set(v),{id:M,kind:"files",mount:G,dispose:()=>{i.delete(M),m.delete(M),l.pane_leave(M)}}},Rt=new Map,it=new Map,wt=M=>{const v=fn("tpl-pane-universe"),D=new tD({canvas:Rs(v,".universe-canvas"),title:Rs(v,".universe-title"),state:v.querySelector(".pane-state"),empty:Rs(v,".universe-empty"),projectionPill:v.querySelector(".universe-projection"),refreshPill:v.querySelector(".universe-refresh"),replayPill:v.querySelector(".universe-replay"),scalePill:v.querySelector(".universe-scale"),viewPill:v.querySelector(".universe-view"),gravityPill:v.querySelector(".universe-gravity"),densityPill:v.querySelector(".universe-density"),drawPill:v.querySelector(".universe-draw"),captionsPill:v.querySelector(".universe-captions"),arrangementPill:v.querySelector(".universe-arrangement"),facts:v.querySelector(".universe-facts"),backPill:v.querySelector(".universe-back"),openPill:v.querySelector(".universe-open")},{command_run:G=>{Mt.line_execute(G,{silent:!0,observe:!1}).then(T=>{for(const C of T.envelopes)D.envelope_observe(C)})},feed_dag:async G=>{const T=await Mt.line_execute(`feed diagram feed_${G}`,{silent:!0,observe:!1});for(const C of T.envelopes){if(C.model?.kind!==zi.feedDag)continue;const $=ed.safeParse(C.model.data);if($.success)return $.data}return null},node_enter:G=>{ve.line_run(`cd "${G}"`)},node_dive:G=>{Vt(M,G.replace(/\/data$/,""))},node_process:G=>{const T=et(G.vfsPath)??(/\/feed_(\d+)(?:\/|$)/.exec(G.vfsPath)===null?null:Number(/\/feed_(\d+)(?:\/|$)/.exec(G.vfsPath)[1])),C=je===null?G.vfsPath:G.vfsPath.replace(/^\/proc\/jobs\//,`/home/${je}/feeds/`);y(M,{input:C,feed:T,node:G.instanceId})},feed_open:G=>{Et(),$s.feed_enter(G)},plugin_open:G=>{(async()=>{const T=await Mt.line_execute("ls /bin",{silent:!0,observe:!1}),C=[];for(const U of T.envelopes){if(U.model?.kind!=="fs.listing")continue;const Z=U.model.data,ne=Array.isArray(Z)?Z:[Z];for(const ie of ne)for(const be of ie.items??[])C.push(be.name)}const $=C.filter(U=>U.startsWith(`${G}-v`)).sort((U,Z)=>U.localeCompare(Z,void 0,{numeric:!0})).pop();if($===void 0){ve.line_note(`universe: ${G} is not in /bin`);return}rt("gutter-files").click(),j("files",i.get("files"),`/bin/${$}`,"plugin")})().catch(T=>{ve.line_note(`universe: could not open ${G} in /bin: ${T instanceof Error?T.message:String(T)}`)})},note:G=>ve.line_note(G)},ep());return o.set(M,D),{id:M,kind:"universe",mount:v,dispose:()=>{o.delete(M),l.pane_leave(M),D.dispose()}}},ns=M=>{const v=fn("tpl-pane-image"),D=new fD(v,{source:{url_of:c},note:G=>ve.line_note(G),regard:G=>l.regard_write(M,{address:G,modelKind:"dicom.instance"}),file_put:async(G,T)=>{try{return(await fetch(c(G),{method:"POST",body:T})).status}catch{return 0}},tags_read:G=>as(G),tags_open:()=>{ve.line_note(es(M))}});return it.set(M,D),{id:M,kind:"image",mount:v,dispose:()=>{D.dispose(),it.delete(M),l.pane_leave(M)}}},Ut=new Map,rs=M=>{const v=fn("tpl-pane-tags"),D=new mD(v,{note:G=>ve.line_note(G)});return Ut.set(M,D),{id:M,kind:"tags",mount:v,dispose:()=>{Ut.delete(M),l.pane_leave(M)}}},as=async M=>{try{const v=await Mt.line_execute(`dcm tags "${M}"`,{silent:!0,observe:!1});for(const D of v.envelopes){if(D.model?.kind!==Ha.tags)continue;const G=ch.safeParse(D.model.data);if(G.success)return G.data}}catch{}return null},Qt=(M,v)=>{const D=Ut.get(M);D===void 0||D.path_get()===v||as(v).then(G=>{if(G===null){ve.line_note(`tags: ${v}: not a readable DICOM file`);return}Ut.get(M)?.model_show(G)})},es=M=>{const v=new Set(ze.panes_shown()),D=l.group_of(M);for(const T of Ut.keys())if(v.has(T)&&l.group_of(T)===D)return ze.focus_set(T),"image tags";if(!v.has(M))return"image tags: the image pane is not on stage";const G=qt("tags",M);return ze.leaf_split(M,me?.dir??"col",G.id,me?.before??!1)?(E(G.id,M,me?.dir??"col",me?.before??!1),"image tags"):(Ys(G.id),ze.mount_remove(G.id),"image tags: could not open beside the image pane")},q=async M=>{try{const v=await Mt.line_execute(`dcm series "${M}"`,{silent:!0,observe:!1});for(const D of v.envelopes){if(D.model?.kind!==Ha.series)continue;const G=dh.safeParse(D.model.data);if(G.success)return G.data}}catch{}return null},Os=async M=>{try{const v=await Mt.line_execute(`ls "${M}"`,{silent:!0,observe:!1});for(const D of v.envelopes){if(D.model?.kind!=="fs.listing")continue;const G=D.model.data,T=(Array.isArray(G)?G[0]:G)??{},C=(T.path??M).replace(/\/$/,"");return(T.items??[]).filter($=>$.type==="dir").map($=>`${C}/${$.name}`)}}catch{}return[]},Bt=(M,v)=>{const D=U=>{v!==void 0&&l.regard_write(U,v)};if(M!==null&&it.has(M))return D(M),it.get(M)??null;const G=new Set(ze.panes_shown());if(v!==void 0){for(const[U,Z]of it)if(G.has(U)&&l.regard_get(U)?.address===v.address)return D(U),Z}const T=M!==null?l.group_of(M):null;for(const[U,Z]of it)if(G.has(U)&&T!==null&&l.group_of(U)===T)return Z;const C=M!==null&&G.has(M)?M:xs();if(C===null)return null;const $=qt("image",M??void 0);return ze.leaf_split(C,me?.dir??"col",$.id,me?.before??!1)?(E($.id,C,me?.dir??"col",me?.before??!1),D($.id),it.get($.id)??null):(Ys($.id),ze.mount_remove($.id),null)},R=async(M,v,D={},G)=>{Ht();const T=M!==null?void 0:Gc.test(v)?{address:v,modelKind:"image.volume"}:{address:Yo.test(v)?v.slice(0,v.lastIndexOf("/")):v.replace(/\/$/,""),modelKind:"dicom.series"},C=Bt(M,T);if(C===null)return"image: no pane to open beside";const $=ft(C);if($!==null&&G?.($),Gc.test(v))return C.opening_show(v),C.volume_show(v),`image ${v}`;const U=Yo.test(v),Z=U?v.slice(0,v.lastIndexOf("/")):v.replace(/\/$/,"");C.opening_show(Z);let ne=await q(Z),ie=[];if(ne===null&&!U){const Se=(await Os(Z)).slice(0,32);for(const Ze of Se){const $e=await q(Ze);if($e!==null){ie=Se.map(yt=>({path:yt,label:yt.split("/").pop()??yt})),ne=$e;break}}}if(ne===null)return C.opening_fail(v,"NOT A READABLE SERIES"),`image: ${v}: not a readable DICOM series, study, or volume`;const be=U?Math.max(1,ne.files.indexOf(v)+1):1;return C.series_show(ne,{siblings:ie,startAt:be,...D.force===!0?{force:!0}:{}}),`image ${ne.path}${ie.length>1?` (1 of ${ie.length} series)`:""}`},y=(M,v)=>{Ht();const D=new Set(ze.panes_shown());for(const[$,U]of fe)if(D.has($)&&U.input===v.input){ze.focus_set($);return}const G=D.has(M)?M:xs()??M,T=qt("catalogue",M);if(!ze.leaf_split(G,me?.dir??"col",T.id,me?.before??!1)){Ys(T.id),ze.mount_remove(T.id);return}E(T.id,G,me?.dir??"col",me?.before??!1),fe.set(T.id,v);const C=i.get(T.id);C!==void 0&&(C.binding_set({input:v.input,place:v.feed===null?"new feed":`feed ${v.feed}${v.node===null?"":` · node ${v.node}`}`}),C.feedOpen_declare($=>ye(T.id,$)),A(T.id,C,"/bin"),ae(C),ze.focus_set(T.id))},K=5,se=40,ae=M=>{Mt.line_execute(`plugininstance list --limit ${se} --fields id,plugin_name,plugin_version,owner_username`,{silent:!0,observe:!1}).then(D=>{const G=[];for(const T of D.envelopes)if(!(T.model?.kind!=="plugininstance.list"||!Array.isArray(T.model.data)))for(const C of T.model.data){if(typeof C.pluginName!="string"||typeof C.pluginVersion!="string"||je!==null&&typeof C.owner=="string"&&C.owner!==je||C.pluginName==="pl-dircopy")continue;const $=`${C.pluginName}-v${C.pluginVersion}`;if(G.includes($)||G.push($),G.length>=K)break}M.recent_set(G.length===0?null:G)}).catch(()=>{})},ye=(M,v)=>{Ht();const D=new Set(ze.panes_shown());for(const[C,$]of a)if(C!=="dag"&&D.has(C)&&$.feed_get()===v){ze.focus_set(C);return}const G=D.has(M)?M:xs()??M,T=qt("dag",M);if(!ze.leaf_split(G,me?.dir??"col",T.id,me?.before??!1)){Ys(T.id),ze.mount_remove(T.id);return}E(T.id,G,me?.dir??"col",me?.before??!1),a.get(T.id)?.feed_enter(v)},Ae=async(M,v,D)=>{const G=fe.get(M),T=i.get(M);if(G===void 0||T===void 0)return;const C=Se=>{ve.output_write("err",`\x1B[31m${Se}\x1B[0m
4244
+ `);const Ze=T.indicated_get();Ze!==null&&T.rowReadout_show(Ze,Se.toUpperCase().slice(0,80))};if(D==="pipeline"&&G.node===null){C(`${v}: a pipeline runs on a node — PROCESS a node of a feed`);return}let $=T.commandLine_get();if(($===""||Np($)!==v)&&($=Gp(G.input,v)),G.feed===null&&!OE($)){const Se=G.input.split("/").filter(Boolean).pop()??"feed",$e=(await zn(M,{message:"Feed title: ",kind:"text",suggest:Se,commit:"RUN"})??"").trim();if($e==="")return;$=xE($,$e)}T.commandLine_set($),ve.line_echo($);let U;try{U=await Mt.line_execute($,{silent:!0})}catch(Se){C(Se instanceof Error?Se.message:String(Se));return}ve.outcome_write(U),U.envelopes.some(Se=>Se.model?.kind==="fs.cwd")&&Mt.line_execute("ls",{silent:!0});const ne=U.envelopes.find(Se=>Se.model?.kind==="run.scheduled")?.model?.data;if(typeof ne?.feedId=="number"){T.run_show(ne.feedId);return}const ie=U.envelopes.map(Se=>Se.renderedErr??"").join(" ").replace(/\x1b\[[0-9;]*m/g,"").trim().split(`
4245
+ `)[0]??"",be=T.indicated_get();be!==null&&T.rowReadout_show(be,ie===""?"NOT SCHEDULED":ie.toUpperCase().slice(0,80))},le=M=>{Ht();const v=new Set(ze.panes_shown());for(const[$]of i)if(v.has($)&&l.regard_get($)?.address===M){ze.focus_set($);return}let D;for(const[$,U]of it)if(v.has($)&&(l.regard_get($)?.address===M||U.state_get()?.path===M)){D=$;break}const G=xs();if(G===null)return;const T=qt("files",D);if(!ze.leaf_split(G,me?.dir??"col",T.id,me?.before??!1)){Ys(T.id),ze.mount_remove(T.id);return}E(T.id,G,me?.dir??"col",me?.before??!1),D===void 0&&l.regard_write(T.id,{address:M,modelKind:"dicom.series"});const C=i.get(T.id);C!==void 0&&A(T.id,C,M)},he=M=>{const v=fn("tpl-pane-gather"),D=new Tp(v,Rs(v,".gather-rows"),{command_run:G=>{Mt.line_execute(G,{silent:!0})},command_show:G=>ve.line_run(G),note:G=>ve.line_note(G),image_open:G=>{R(M,G).then(T=>ve.line_note(T))},process_open:G=>y(M,{input:G,feed:null,node:null}),name_ask:G=>zn(M,{message:"Cohort name: ",kind:"text",suggest:G,commit:"NAME IT"}),confirm_ask:async G=>{const T=await zn(M,{message:G,kind:"confirm"});return T==="y"||T==="n"?T:null},changed:()=>_n(),dismiss:()=>{ze.leaf_close(M)||tt(),Fe(),_n()},feed_create:async G=>{ve.line_echo(G);let T;try{T=await Mt.line_execute(G,{silent:!0})}catch(C){return ve.output_write("err",`\x1B[31m${C instanceof Error?C.message:String(C)}\x1B[0m
4246
+ `),null}ve.outcome_write(T);for(const C of T.envelopes){if(C.model?.kind!=="feed.created")continue;const $=C.model.data;if(typeof $.feedId=="number"&&typeof $.rootInstanceId=="number"&&typeof $.path=="string")return{feedId:$.feedId,rootInstanceId:$.rootInstanceId,path:$.path}}return null},cohort_process:G=>y(M,G),feed_open:G=>ye(M,G)},Ve);return r.set(M,D),{id:M,kind:"gather",mount:v,dispose:()=>{r.delete(M),l.pane_leave(M)}}};let xe=null;const Ve=new zE;let De=!1;const Ie="~/gather/current.json";let qe=null;const Je=()=>{qe!==null&&window.clearTimeout(qe),qe=window.setTimeout(()=>{qe=null;const M=xe?.entries_get()??[],v=JSON.stringify({version:1,name:xe?.name_get()??null,feed:xe?.feed_get()??null,series:M});Mt.line_execute("mkdir -p ~/gather",{silent:!0,observe:!1}),Mt.line_execute(`touch --withContents '${v.replace(/'/g,"'\\''")}' ${Ie}`,{silent:!0,observe:!1})},1200)},dt=async()=>{const M=await z(Ie);if(M.ok)try{const v=JSON.parse(M.text);if(!Array.isArray(v.series)||v.series.length===0)return;xe===null&&(xe=V());for(const D of v.series)xe.series_add(D);de(),_n()}catch{}},V=()=>{const M=rt("header-gather"),v=()=>xs()??"pacs";return new Tp(M,Rs(M,".gather-rows"),{command_run:D=>{Mt.line_execute(D,{silent:!0})},command_show:D=>ve.line_run(D),note:D=>ve.line_note(D),image_open:D=>{R(v(),D).then(G=>ve.line_note(G))},process_open:D=>y(v(),{input:D,feed:null,node:null}),name_ask:async D=>{const G=rt("header-gather"),T=ve.ask_note("Cohort name: "),C=await kc(G,{message:"Cohort name: ",kind:"text",suggest:D,commit:"NAME IT"});return T(C),C},confirm_ask:async D=>{const G=rt("header-gather"),T=ve.ask_note(`${D} `),C=await kc(G,{message:D,kind:"confirm"});return T(C),C==="y"||C==="n"?C:null},changed:()=>{_n(),de(),Je()},dismiss:()=>{document.body.dataset.header="away",De=!0,de()},feed_create:async D=>{ve.line_echo(D);let G;try{G=await Mt.line_execute(D,{silent:!0})}catch(T){return ve.output_write("err",`\x1B[31m${T instanceof Error?T.message:String(T)}\x1B[0m
4247
+ `),null}ve.outcome_write(G);for(const T of G.envelopes){if(T.model?.kind!=="feed.created")continue;const C=T.model.data;if(typeof C.feedId=="number"&&typeof C.rootInstanceId=="number"&&typeof C.path=="string")return{feedId:C.feedId,rootInstanceId:C.rootInstanceId,path:C.path}}return null},cohort_process:D=>y(v(),D),feed_open:D=>ye(v(),D)},Ve)},Ee=()=>{const M=new Set(ze.panes_shown()),v=[...r.keys()].find(D=>M.has(D))??null;if(v!==null)ze.focus_set(v);else{const D=xs()??"pacs",G=qt("gather","pacs");if(!ze.leaf_split(D,"col",G.id,!1)){Ys(G.id),ze.mount_remove(G.id);return}E(G.id,D,"col",!1),r.get(G.id)?.render_now()}document.body.dataset.header="away",De=!0},de=()=>{const M=document.querySelector("#header-gather-pill");if(M===null)return;const v=xe?.entries_get().length??0;M.classList.toggle("panel-gather-empty",v===0)},Te=M=>{xe===null&&(xe=V());for(const D of M)xe.series_add(D);const v=document.body.dataset.header==="away";(!De||!v)&&(document.body.dataset.header="gather",De=!1),de(),Je()},Ne=(M,v="pacs")=>{const D=new Set(ze.panes_shown());let G=[...r.keys()].find(C=>D.has(C))??null;if(G===null){const C=D.has(v)?v:xs()??v,$=qt("gather","pacs");if(!ze.leaf_split(C,me?.dir??"row",$.id,me?.before??!1))return Ys($.id),ze.mount_remove($.id),null;E($.id,C,me?.dir??"row",me?.before??!1),G=$.id}const T=r.get(G);if(T===void 0)return null;for(const C of M)T.series_add(C);return G},pe=M=>{const v=fn("tpl-pane-view"),D=new oD(Rs(v,".view-body"),Rs(v,".view-title"),{content_fetch:async G=>(await z(G)).text,imageUrl_build:c,path_isImage:Ko});return Rt.set(M,D),{id:M,kind:"view",mount:v,dispose:()=>{Rt.delete(M),l.pane_leave(M)}}},Pe=new Map,Ue=M=>a.get(M)??o.get(M),Vt=(M,v)=>{const G=gn(M)?.mount?.querySelector(".dag-canvas, .universe-canvas")??null,T=Pe.get(M);if(T!==void 0&&!T.element.isConnected&&Pe.delete(M),G===null||Pe.has(M)){ve.line_note(`dag: ${v}: ${G===null?"this pane has no scene to fly in":"a node is already open here"} — flew back out`),Ue(M)?.flight_back(()=>{});return}const C=document.createElement("div");C.className="node-overlay",C.setAttribute("aria-label",`inside ${v}`);const $=nt();$.classList.add("node-overlay-body");const U=document.createElement("button");U.type="button",U.className="strategy-pill node-overlay-exit",U.title="leave the node (Esc)",U.textContent="EXIT NODE",$.querySelector(".mode-frame")?.prepend(U),C.append($);const Z=[],ne=new zp(Rs($,".files-panel"),ie=>{if(ie.kind==="dir"){const be=v.replace(/\/+$/,"");if(ie.path!==be&&!ie.path.startsWith(`${be}/`)){Nt(M),Lt("audio3");return}const Se=ie.path.startsWith("/proc/jobs/")?(ie.path.split("/").pop()??"").match(/_(\d+)$/):null;if(Se!==null){const $e=parseInt(Se[1]??"",10);Nt(M,()=>{Ue(M)?.node_flyTo($e)!==!0&&Vt(M,ie.path)});return}const Ze=ne.path_current();Ze!==null&&Z.push(Ze),A(M,ne,ie.path);return}if(l.regard_write(M,{address:ie.path,modelKind:"fs.file"}),!l.groupHasViewer(M)){if(Ke(ie.path)){R(M,ie.path).then(be=>ve.line_note(be));return}if(Ko(ie.path)){ne.contentImage_show(ie.path,c(ie.path));return}z(ie.path).then(be=>{if(!be.ok){ne.contentRefused_show(ie.path,be.text);return}Qp.test(ie.path)?ne.contentTable_show(ie.path,be.text):ne.content_show(ie.path,be.text)})}},p);ne.rowVerbs_declare((ie,be)=>Qe(M,ie,be),(ie,be)=>{l.regard_write(M,{address:be,modelKind:"fs.file"})}),Pe.set(M,{element:C,panel:ne,history:Z}),ne.ceiling_set(v,"EXIT NODE"),U.addEventListener("click",()=>{Nt(M),Lt("audio3")}),G.appendChild(C),window.requestAnimationFrame(()=>C.classList.add("node-overlay-open")),A(M,ne,v)},Nt=(M,v)=>{const D=Pe.get(M);if(D===void 0){v?.();return}Pe.delete(M),D.element.classList.remove("node-overlay-open");const G=()=>{D.element.remove(),v?.()},T=Ue(M);T!==void 0?T.flight_back(G):G()},js=(M,v)=>{const D=fn("tpl-pane-dag"),G=new jE(Rs(D,".dag-canvas"),Rs(D,".dag-title"),Rs(D,".dag-facts"),Rs(D,".dag-empty"),Rs(D,".dag-strategy"),Rs(D,".dag-feedlist"),{command_run:T=>{Mt.line_execute(T,{silent:!0,observe:!1}).then(C=>{for(const $ of C.envelopes)G.envelope_observe($)})},watch_set:(T,C)=>{C?Mt.watch_send(T):Mt.unwatch_send(T)},node_enter:T=>{ve.line_run(`cd "${T}"`)},node_dive:T=>{Vt(M,T.replace(/\/data$/,""))},node_regard:T=>{l.regard_write(M,{address:T,modelKind:"feed.node"})},node_process:T=>{const C=et(T.vfsPath)??(/\/feed_(\d+)(?:\/|$)/.exec(T.vfsPath)===null?null:Number(/\/feed_(\d+)(?:\/|$)/.exec(T.vfsPath)[1])),$=je===null?T.vfsPath:T.vfsPath.replace(/^\/proc\/jobs\//,`/home/${je}/feeds/`);y(M,{input:$,feed:C,node:T.instanceId})},feed_regard:T=>{l.regard_write(M,{address:T,modelKind:"feed"})},feed_verbs:T=>{const C={feedId:T.id},$={share:()=>ve.line_run(`setfacl feed_${T.id}`),delete:()=>ve.line_run(`feed rm feed_${T.id}`)};return Yg.rules.filter(U=>U.offered(C)).map(U=>({label:U.label(C),run:()=>$[U.name]?.()}))},feed_indicated:T=>{l.regard_write(M,{address:`/proc/jobs/feed_${T.id}`,modelKind:"feed"}),Mt.line_execute(`getfacl feed_${T.id}`,{silent:!0,observe:!1}).then(C=>{a.get(M)?.rowReadout_show(T.id,Zt(C))}).catch(()=>{a.get(M)?.rowReadout_show(T.id,"ACCESS UNREAD")})},...v?{feed_shown:()=>Le()}:{}});return a.set(M,G),{id:M,kind:"dag",mount:D,dispose:()=>{Pe.get(M)?.element.remove(),Pe.delete(M),a.delete(M),l.pane_leave(M),G.dispose()}}},Ls=gt("files",!0);Rr(Ls);const ta=js("dag",!0);Rr(ta);const sa=wt("universe");Rr(sa);const ii=fn("tpl-pane-launcher");Rr({id:"launcher",kind:"launcher",mount:ii});const ri=fn("tpl-pane-panes");Rr({id:"panes",kind:"panes",mount:ri});const Nl=i.get("files"),$s=a.get("dag"),na=new CD(rt("pipeline-cycler"),rt("pipeline-cycler-name"),M=>{Mt.line_execute(M,{silent:!0})}),xs=()=>{const M=ze.tree_get();if(M===null)return null;const v=[],D=T=>{if("pane"in T){v.push(T.pane);return}D(T.first),D(T.second)};D(M);const G=ze.focused_get();return G!==null&&v.includes(G)?G:v[0]??null},ia=async M=>{const v=xs();if(v===null)return null;const D=qt("files");if(!ze.leaf_split(v,me?.dir??"col",D.id,me?.before??!1))return Ys(D.id),ze.mount_remove(D.id),null;E(D.id,v,me?.dir??"col",me?.before??!1);const G=i.get(D.id),T=M.path?.anchor??"~";G!==void 0&&A(D.id,G,T);const C=D.mount.querySelector(".files-body");if(C===null)return Ys(D.id),ze.mount_remove(D.id),null;const $=document.createElement("div");$.className="errand-bar",C.insertBefore($,C.firstChild);const U=document.createElement("span");U.className="errand-caption",U.textContent=M.message.trim();const Z=document.createElement("input");Z.className="errand-path",Z.spellcheck=!1;const ne=document.createElement("button");ne.className="pacs-capsule errand-commit",ne.textContent=M.commit??"USE THIS",$.append(U,Z,ne);const ie=()=>{const Ze=G?.path_current()??T,$e=M.path?.suggest;Z.value=M.path?.wantsDirectory===!0||$e===void 0?Ze:`${Ze.replace(/\/$/,"")}/${$e}`};ie();let be=!1;Z.addEventListener("input",()=>{be=!0});const Se=()=>{be||ie()};return D.mount.addEventListener("click",Se),ve.question_set(!0),new Promise(Ze=>{const $e=yt=>{D.mount.removeEventListener("click",Se),ve.question_set(!1),Ii=null,ze.leaf_close(D.id),Ys(D.id),ze.mount_remove(D.id),Ze(yt)};Ii=()=>$e(null),ne.addEventListener("click",()=>$e(Z.value.trim()===""?null:Z.value.trim())),Z.addEventListener("keydown",yt=>{yt.key==="Enter"&&$e(Z.value.trim()===""?null:Z.value.trim())})})};let Ii=null,lr=null,ai=null;const oi=(M,v)=>{ai=M,ve.line_run(v)},zn=async(M,v)=>{const D=gn(M)?.mount;if(D===void 0)return lr?.(!1),ve.ask_open({message:v.message,kind:v.kind,...v.suggest===void 0?{}:{suggest:v.suggest}});const G=ve.ask_note(v.message),T=await kc(D,v);return G(v.kind==="secret"&&T!==null?"••••••":T),T},Qs=new pE(rt("pacs-workspace"),{command_run:M=>{/^(pacs query|pull )/.test(M)&&ve.line_echo(M),Mt.line_execute(M,{silent:!0}).then(v=>{for(const D of v.envelopes)Qs.envelope_observe(D)})},command_show:M=>{ve.line_run(M)},note:M=>ve.line_note(M),image_open:M=>{R(null,M).then(v=>ve.line_note(v))},dir_open:M=>le(M),process_open:M=>y("pacs",{input:M,feed:null,node:null}),gather_add:M=>Te([M]),gathered_is:M=>xe?.has(M)===!0,workspace_close:()=>tt()});Rr({id:"pacs",kind:"pacs",mount:rt("pacs-workspace")});const _n=()=>{const M=new Set(ze.panes_shown()),v=new Map;for(const D of Co()){if(!M.has(D.id))continue;const G=l.regard_get(D.id)?.address;if(G===void 0)continue;const T=Ts(D.id);if(T!=="image"&&T!=="files")continue;const C=G.replace(/\/$/,""),$=v.get(C)??{viewer:!1,browser:!1};T==="image"?$.viewer=!0:$.browser=!0,v.set(C,$)}Qs.stage_lit(v)},ze=new XD(rt("layout-root"),new Map([["dag",ta.mount],["universe",sa.mount],["files",Ls.mount],["pacs",rt("pacs-workspace")],["launcher",ii],["panes",ri]]));let ln=!1;const Cl=()=>ln?{dir:"col",ratio:.45,first:{pane:"files"},second:{pane:"dag"}}:{pane:"files"};ze.preset_register("files",Cl),ze.preset_register("pacs",()=>({pane:"pacs"})),ze.preset_register("dag",()=>({pane:"dag"})),ze.preset_register("universe",()=>({pane:"universe"})),ze.preset_register("panes",()=>({pane:"panes"})),ze.preset_register("launcher",()=>({pane:"launcher"})),ze.renderObserver_set(()=>{window.requestAnimationFrame(()=>{for(const M of a.values())M.size_fit()})});const $a=new Map,E=(M,v,D,G,T)=>{$a.set(M,{parent:v,dir:D,before:G,...T!==void 0?{binding:T}:{}})},Y=(M,v,D,G)=>{const T=v==="view"?qt("view",M):v==="fs"?qt("files",M):qt("empty");if(!ze.leaf_split(M,D,T.id,G))return Ys(T.id),ze.mount_remove(T.id),null;if(E(T.id,M,D,G,v),v==="fs"){const C=U=>{const Z=i.get(T.id);if(Z===void 0)return;const ne=U.modelKind==="fs.file"?U.address.replace(/\/[^/]*$/,"")||"/":U.address;A(T.id,Z,ne)};l.regard_subscribe(T.id,C);const $=l.regard_get(M);$!==null&&C($)}return T.id},te=new iA(Pg,ep());Object.assign(globalThis,{__argusDormant:{list:()=>te.list(),get:M=>te.get(M),dismiss:M=>te.dismiss(M)}});const J=M=>{if(M==="pacs")return"⊞";if(M==="dag")return"⋔";const v=Ts(M);return v==="image"?"▣":v==="tags"?"≣":"▤"},ee=M=>{if(M.length===0)return;const v=[];for(const ne of M){const ie=gn(ne)?.mount;if(ie===void 0)continue;const be=ie.getBoundingClientRect();be.width>0&&be.height>0&&v.push({id:ne,left:be.left,top:be.top,width:be.width,height:be.height})}if(v.length===0)return;const D=Math.min(...v.map(ne=>ne.left)),G=Math.min(...v.map(ne=>ne.top)),T=Math.max(...v.map(ne=>ne.left+ne.width))-D,C=Math.max(...v.map(ne=>ne.top+ne.height))-G;if(T<=0||C<=0)return;const $=240,U=$/T,Z=Math.max(40,Math.min(260,Math.round(C*U)));try{const ne=document.createElement("canvas");ne.width=$,ne.height=Z;const ie=ne.getContext("2d");if(ie===null)return;const Se=getComputedStyle(document.documentElement).getPropertyValue("--harvestgold").trim()||"#c9a15a";ie.fillStyle="#05070a",ie.fillRect(0,0,$,Z);for(const Ze of v){const $e=Math.round((Ze.left-D)*U),yt=Math.round((Ze.top-G)*U),Kt=Math.max(6,Math.round(Ze.width*U)),_t=Math.max(6,Math.round(Ze.height*U)),ht=gn(Ze.id)?.mount.querySelector("canvas");if(ht!=null&&ht.width>0){const gs=Math.min(Kt/ht.width,_t/ht.height),bt=Math.round(ht.width*gs),Pt=Math.round(ht.height*gs);ie.fillStyle="#000",ie.fillRect($e,yt,Kt,_t),ie.drawImage(ht,$e+Math.round((Kt-bt)/2),yt+Math.round((_t-Pt)/2),bt,Pt)}else ie.fillStyle="rgba(255,255,255,0.05)",ie.fillRect($e,yt,Kt,_t),ie.fillStyle=Se,ie.font=`${Math.max(9,Math.min(28,Math.round(Math.min(Kt,_t)*.5)))}px serif`,ie.textAlign="center",ie.textBaseline="middle",ie.fillText(J(Ze.id),$e+Kt/2,yt+_t/2+1);ie.strokeStyle="rgba(255,255,255,0.22)",ie.lineWidth=1,ie.strokeRect($e+.5,yt+.5,Kt-1,_t-1)}return ne.toDataURL("image/png")}catch{return}};let Ge=!1,me=null;const Re=()=>{if(Ge)return;const M=new Set(ze.panes_shown()),v=ze.activePreset_get();if(v==="panes"||v==="launcher")return;const D=Co().map($e=>$e.id).filter($e=>M.has($e)),G=new Map;let T,C;const $=[];for(const $e of D){const yt=Ts($e),Kt=$a.get($e),_t=G.get(Kt?.parent??"")??0,ht={dir:Kt?.dir??"col",side:Kt?.before?"before":"after"},gs=bt=>{G.set($e,$.length),$.push(bt)};if($e==="pacs"||$e==="files"||$e==="dag"){const bt=v==="dag"?"runs":v,Pt=v==="pacs"?Qs.query_get():null,Ms=v==="dag"?a.get("dag"):void 0,Js=Ms!==void 0&&Ms.graph_isShown()?Ms.feed_get():null,la=Js!==null&&Ms!==void 0?Ms.view_lines():[];Js!==null&&C===void 0&&(C=Ms?.feedTitle_get()),gs({op:"domain",domain:bt,...Pt!==null?{query:Pt}:{},...Js!==null?{feed:Js}:{},...la.length>0?{view:la}:{}})}else if(Kt?.binding==="fs"||Kt?.binding==="view"||Kt?.binding==="empty")gs({op:Kt.binding,target:_t,...ht});else if(yt==="image"){const bt=it.get($e),Pt=bt?.state_get()??null;if(bt===void 0||Pt===null||Pt.path===null)continue;const Ms=[];if(Pt.layout!=="single"&&Ms.push(`image layout ${Pt.layout}`),Pt.colormap!==void 0&&Pt.colormap!=="gray"&&Ms.push(`image colormap ${Pt.colormap}`),Pt.voi!==void 0&&Pt.voi!==null&&Ms.push(`image wl ${Pt.voi.lower} ${Pt.voi.upper}`),Pt.slice>1&&Ms.push(`image slice ${Pt.slice}`),Pt.ghost!==void 0&&Pt.ghost!==null&&Pt.layout==="slab"&&Ms.push(`image ghost ${Pt.ghost}`),gs({op:"image",path:Pt.path,target:_t,...ht,...Ms.length>0?{view:Ms}:{}}),T===void 0){T=Pt.path;const Js=bt.series_get(),la=[Js?.seriesDescription??"",Js?.modality??""].filter(zM=>zM!=="");la.length>0&&(C=la.join(" · "))}}else if(fe.has($e)){const bt=fe.get($e);if(bt===void 0)continue;const Pt=i.get($e)?.commandLine_get()??"";gs({op:"catalogue",input:bt.input,target:_t,...ht,...bt.feed!==null?{feed:bt.feed}:{},...bt.node!==null?{node:bt.node}:{},...Pt!==""?{line:Pt}:{}}),C===void 0&&(C=`PROCESS ${bt.input.split("/").filter(Boolean).pop()??bt.input}`)}else if(yt==="files"){const bt=i.get($e)?.path_current()??null;if(typeof bt!="string"||bt.length===0)continue;gs({op:"dir",path:bt,target:_t,...ht})}else if(yt==="gather"){const bt=r.get($e);if(bt===void 0)continue;const Pt=[...bt.entries_get()],Ms=bt.name_get(),Js=bt.feed_get();gs({op:"gather",series:Pt,target:_t,...ht,...Ms!==null?{name:Ms}:{},...Js!==null?{feed:Js.feedId,root:{instance:Js.rootInstanceId,path:Js.path}}:{}}),C===void 0&&(C=Ms??`GATHER · ${Pt.length} series`)}else if(yt==="dag"){const bt=a.get($e)?.feed_get()??null;if(bt===null)continue;gs({op:"graph",feed:bt,target:_t,...ht})}else yt==="tags"&&gs({op:"tags",target:_t,...ht})}const U=$.filter($e=>$e.op!=="domain"||$e.feed!==void 0);if(U.length===0)return;const Z=ee(D),ne={image:"viewer",view:"viewer",dir:"files",fs:"files",tags:"tags",empty:"pane",domain:"dag",catalogue:"catalogue",graph:"dag",gather:"gather"},ie=[...new Set(U.map($e=>ne[$e.op]??"pane"))];let be,Se,Ze;if(T!==void 0)be=T,Se=C??T.split("/").pop()??T,Ze={address:T,modelKind:"dicom.series"};else{const $e=U.map(_t=>_t.path).find(_t=>_t!==void 0),yt=U.map(_t=>_t.path??(_t.input!==void 0?`catalogue:${_t.input}`:_t.series!==void 0?`gather:${_t.series.map(ht=>ht.seriesUID).join(",")}`:_t.feed!==void 0?`feed:${_t.feed}`:_t.op)).sort().join("|"),Kt=v==="dag"?"RUNS":v.toUpperCase();be=`${v}:${yt}`,Se=C!==void 0&&C!==""?C:$e!==void 0?$e.split("/").pop()??$e:`${Kt} · ${U.length+1} panes`,Ze={address:be,modelKind:"argus.desktop"}}te.add({id:be,label:Se,regard:Ze,members:ie,actions:$,...Z===void 0?{}:{thumbnail:Z},lastTouched:Date.now()})},Fe=()=>{const M=new Set(ze.panes_shown());for(const v of Co())M.has(v.id)||v.id==="files"||v.id==="dag"||v.id==="pacs"||v.id==="panes"||v.id==="launcher"||v.id==="universe"||(Ys(v.id),ze.mount_remove(v.id));_n()},We=M=>{Re(),ze.preset_apply(M),Fe()},tt=()=>{We("files"),$s.size_fit()},ft=M=>[...it.entries()].find(([,v])=>v===M)?.[0]??null,Xe=async M=>{const v=te.get(M);if(v===void 0||v.actions===void 0)return;te.dismiss(M);const D=G=>Co().filter(T=>ze.panes_shown().includes(T.id)&&Ts(T.id)===G).map(T=>T.id);Ge=!0;try{const G=[];for(const T of v.actions){const C=G[T.target??0]??null,$={dir:T.dir??"col",before:T.side==="before"};if(T.op==="domain"){const U=T.domain==="runs"?"dag":T.domain==="pacs"?"pacs":"files";if(We(U),T.query!==void 0&&ve.line_run(T.query),T.feed!==void 0){const Z=T.feed,ne=T.view??[],ie=a.get("dag");if(ie?.feed_enter(Z),ne.length>0&&ie!==void 0){const be=Se=>{if(ie.graph_isShown()&&ie.feed_get()===Z){for(const Ze of ne)ve.line_run(Ze);return}Se>0&&window.setTimeout(()=>be(Se-1),250)};be(240)}}G.push(U)}else if(T.op==="image"&&T.path!==void 0){C!==null&&ze.focus_set(C);let U=null;me=$;const Z=R(null,T.path,{},be=>{U=be});me=null,G.push(U);const ne=T.view,ie=U;ne!==void 0&&ne.length>0&&ie!==null&&Z.then(()=>{for(const be of ne)ze.focus_set(ie),ve.line_run(be)}).catch(()=>{})}else if(T.op==="dir"&&T.path!==void 0){C!==null&&ze.focus_set(C);const U=new Set(D("files"));me=$,le(T.path),me=null,G.push(D("files").find(Z=>!U.has(Z))??null)}else if(T.op==="tags"){C!==null&&ze.focus_set(C);const U=new Set(D("tags"));me=$,ve.line_run("image tags"),me=null,G.push(D("tags").find(Z=>!U.has(Z))??null)}else if(T.op==="catalogue"&&T.input!==void 0){C!==null&&ze.focus_set(C);const U=()=>[...fe.keys()].filter(ie=>ze.panes_shown().includes(ie)),Z=new Set(U());me=$,y(C??"files",{input:T.input,feed:T.feed??null,node:T.node??null}),me=null;const ne=U().find(ie=>!Z.has(ie))??null;ne!==null&&T.line!==void 0&&i.get(ne)?.commandLine_set(T.line),G.push(ne)}else if(T.op==="gather"&&T.series!==void 0){C!==null&&ze.focus_set(C),me=$;const U=Ne([...T.series],C??"pacs");me=null,U!==null&&T.name!==void 0&&r.get(U)?.name_set(T.name),U!==null&&T.feed!==void 0&&T.root!==void 0&&r.get(U)?.feed_set({feedId:T.feed,rootInstanceId:T.root.instance,path:T.root.path}),G.push(U)}else if(T.op==="graph"&&T.feed!==void 0){C!==null&&ze.focus_set(C);const U=new Set(D("dag"));me=$,ye(C??"files",T.feed),me=null,G.push(D("dag").find(Z=>!U.has(Z))??null)}else if(T.op==="fs"||T.op==="view"||T.op==="empty"){if(C===null){G.push(null);continue}ze.focus_set(C),G.push(Y(C,T.op,$.dir,$.before))}else G.push(null)}}finally{Ge=!1,_n()}},Ct=()=>{We("launcher"),Tt.render(),ze.focus_set("launcher")},Ht=()=>{ze.activePreset_get()==="launcher"&&(ln=!1,tt())},Jt=async()=>{const[M,v]=await Promise.all([Mt.line_execute("proc feeds",{silent:!0,observe:!1}),Mt.line_execute("ls ~",{silent:!0,observe:!1})]);let D=[];for(const ht of M.envelopes){const gs=ht.model;if(gs===void 0||gs.kind!==gm)continue;const bt=mm.safeParse(gs.data);bt.success&&(D=bt.data.feeds)}const T=D.length===0&&M.envelopes.some(ht=>ht.status==="error")?"INDEX WARMING":`${D.length} FEEDS`,C=D.filter(ht=>/error/i.test(ht.status)).length,$=D.filter(ht=>/running|scheduled|created|started/i.test(ht.status)).length;let U=[],Z="~";for(const ht of v.envelopes){if(ht.model?.kind!=="fs.listing")continue;const bt=ht.model.data[0];bt!==void 0&&Array.isArray(bt.items)&&(U=bt.items,typeof bt.path=="string"&&(Z=bt.path))}const ne=U.filter(ht=>ht.type==="dir"),ie=te.list(),be={key:"universe",name:"UNIVERSE",hue:"--honey",numeral:"",figures:[{text:T}],rows:[{text:"every feed as it landed — branches by pipeline, feeds as leaves",open:()=>cn()}],verb:"SEE THE SPACE",enter:()=>cn()},Se={key:"analyses",name:"ANALYSES",hue:"--october-sunset",numeral:"3",figures:[{text:T},...$>0?[{text:`${$} RUNNING`}]:[],...C>0?[{text:`${C} ERRORED`,errored:!0,open:()=>Et("status:error")}]:[]],rows:D.slice(0,6).map(ht=>({text:`${ht.id} ${ht.title}`,errored:/error/i.test(ht.status),open:()=>{Et(),a.get("dag")?.feed_enter(ht.id)}})),verb:"OPEN THE ROSTER",enter:()=>Et()},Ze={key:"files",name:"FILES",hue:"--harvestgold",numeral:"2",figures:[{text:`${U.length} ENTRIES`}],rows:ne.slice(0,5).map(ht=>({text:ht.name,open:()=>{ln=!1,tt();const gs=Z.endsWith("/")?`${Z}${ht.name}`:`${Z}/${ht.name}`;ve.line_run(`cd "${gs}"`)}})),verb:"OPEN HOME",enter:()=>{ln=!1,tt(),ze.focus_set("files")}},$e=Qs.query_get()??"",yt={key:"pacs",name:"PACS",hue:"--daybreak",numeral:"4",figures:[{text:$e===""?"NO ANSWER":"ANSWERED"}],rows:$e===""?[{text:"pacs query PatientID:…",open:()=>ve.line_offer("pacs query PatientID:")},{text:"pacs query AccessionNumber:…",open:()=>ve.line_offer("pacs query AccessionNumber:")}]:[{text:$e.slice(0,48)}],verb:"ASK A PACS",enter:()=>{We("pacs"),ze.focus_set("pacs")}},Kt={key:"panes",name:"PANES",hue:"--butter",numeral:"6",figures:[{text:ie.length===0?"EMPTY":`${ie.length} DESKTOPS`}],rows:ie.slice(0,5).map(ht=>({text:ht.label,open:()=>{Xe(ht.id)}})),verb:"SEE DESKTOPS",enter:()=>{We("panes"),us.render(),ze.focus_set("panes")}},_t=[Ze,yt,Kt,be];return D.length>=U.length?[Se,..._t]:[Ze,Se,yt,Kt,be]},Tt=new _E(ii,{tiles:Jt,startHere_get:tm,startHere_set:pI});setInterval(()=>{ze.activePreset_get()==="launcher"&&(!ii.isConnected||document.visibilityState!=="visible"||Tt.render())},fI);const us=new rA(ri,{list:()=>te.list(),restore:M=>{Xe(M)},dismiss:M=>{te.dismiss(M)}}),Le=()=>{const M=ze.activePreset_get();if(M==="pacs"||M==="dag"||M==="launcher"){ln=!0;return}ln&&M==="files"||(ln=!0,tt())},qt=(M,v)=>{const D=qD(M);return l.pane_join(D.id,v!==void 0?l.group_of(v):D.id),M==="tags"&&l.regard_subscribe(D.id,G=>{G.modelKind==="dicom.instance"&&Qt(D.id,G.address)}),M==="view"&&(l.viewer_mark(D.id),l.regard_subscribe(D.id,G=>{G.modelKind!=="dicom.instance"&&Rt.get(D.id)?.regard_show(G)})),ze.mount_register(D.id,D.mount),pt(D.id,M,D.mount),D},pt=(M,v,D)=>{const G=D.querySelector(".pane-drawer"),T=D.querySelector(".pane-handle");if(G===null||T===null)return;T.addEventListener("click",Z=>{Z.target instanceof Element&&Z.target.closest("button")!==null||(G.hidden=!G.hidden,G.hidden||G.querySelector("button")?.focus(),Lt("audio3"))});const C=G.querySelector(".drawer-zoom");C!==null&&(C.dataset.pane=M);for(const Z of G.querySelectorAll(".drawer-bind"))Z.addEventListener("click",()=>{for(const ne of G.querySelectorAll(".drawer-bind"))ne.classList.remove("drawer-bind-selected");Z.classList.add("drawer-bind-selected"),Lt("audio3")});for(const Z of G.querySelectorAll("[data-split]"))Z.addEventListener("click",()=>{const ne=Z.dataset.split==="row"?"row":"col",ie=Z.dataset.place==="before",be=G.querySelector(".drawer-bind-selected")?.dataset.bind??"unlinked";Y(M,be==="viewer"?"view":be==="fs"?"fs":"empty",ne,ie)!==null&&(G.hidden=!0,Lt("audio3"))});G.querySelector(".drawer-close")?.addEventListener("click",()=>{if(M==="dag"){ln=!1,tt();return}ze.leaf_close(M)||tt(),Fe(),Lt("audio3")});const $=G.querySelector(".drawer-children");if($===null)return;const U=(Z,ne,ie,be="")=>{const Se=document.createElement("button");Se.className=`pacs-capsule drawer-child${be===""?"":` ${be}`}`,Se.textContent=Z,Se.title=ne,Se.addEventListener("click",()=>{ie(),G.hidden=!0,Lt("audio3")}),$.appendChild(Se)};if(v==="files"||v==="catalogue"){const Z=G.querySelector(".drawer-binding");if(Z!==null){const Se=document.createElement("span");Se.className="drawer-label drawer-label-cwd",Se.textContent="CWD",Z.appendChild(Se);const Ze=($e,yt,Kt)=>{const _t=document.createElement("button");return _t.className="pacs-capsule drawer-cwdbind",_t.dataset.follow=yt?"on":"off",_t.textContent=$e,_t.title=Kt,_t.addEventListener("click",()=>{f.get(M)===!0!==yt&&x(M,yt),Lt("audio3")}),Z.appendChild(_t),_t};Ze("FOLLOW CWD",!0,"bind this browser to the session cwd (the console's browser)"),Ze("ROOT HERE",!1,"unbind from the cwd: this browser keeps its own place"),O(M,()=>{const $e=f.get(M)===!0;for(const yt of Z.querySelectorAll(".drawer-cwdbind"))yt.classList.toggle("drawer-bind-selected",yt.dataset.follow==="on"===$e)}),w(M)}const ne=()=>f.get(M)===!0;D.querySelector(".files-home")?.addEventListener("click",()=>{if(ne()){ve.line_run("cd ~");return}const Se=i.get(M);if(Se===void 0)return;const Ze=Se.path_current();Ze!==null&&m.get(M)?.push(Ze),A(M,Se,"~")}),D.querySelector(".files-back")?.addEventListener("click",()=>{if(ne()){ve.line_run("cd -");return}const Se=i.get(M),Ze=m.get(M)?.pop();Se!==void 0&&Ze!==void 0&&A(M,Se,Ze)});const ie=()=>i.get(M)?.path_current()??null;D.querySelector(".files-mkdir")?.addEventListener("click",()=>{const Se=ie();Se!==null&&b(M,Se)}),D.querySelector(".files-refresh")?.addEventListener("click",()=>{const Se=ie();Se!==null&&I(M,Se)});const be=D.querySelector(".files-upload-input");D.querySelector(".files-upload")?.addEventListener("click",()=>{ie()!==null&&be?.click()}),be?.addEventListener("change",()=>{const Se=ie(),Ze=be.files;Se===null||Ze===null||Ze.length===0||(S(M,Se,Array.from(Ze)),be.value="")})}v==="dag"&&(U("ENTER NODE","move the session into the indicated node (its data directory)",()=>{const Z=l.regard_get(M),ne=a.get(M)?.feed_get()??null,ie=Z===null?ne===null?null:`/proc/jobs/feed_${ne}`:Z.modelKind==="fs.file"?Z.address.replace(/\/[^/]*$/,"")||"/":Z.address;ie!==null&&ve.line_run(`cd "${ie}"`)}),U("PROCESS NODE","run an executable on the indicated node's output (a catalogue opens beside)",()=>{const Z=l.regard_get(M),ne=a.get(M)?.feed_get()??null;if(Z===null||ne===null)return;const ie=Z.modelKind==="fs.file"?Z.address.replace(/\/[^/]*$/,"")||"/":Z.address,be=ue(ie)??(/_(\d+)\/?$/.exec(ie)===null?null:parseInt(/_(\d+)\/?$/.exec(ie)?.[1]??"",10));be!==null&&y(M,{input:ie.replace(/\/data\/?$/,"")+"/data",feed:ne,node:be})}),U("ENTER FEED","move the session into the feed on stage (or the one picked in the roster)",()=>{const Z=a.get(M)?.feed_get()??null;Z!==null&&ve.line_run(`cd "/proc/jobs/feed_${Z}"`)}),U("BACK","return to the previous listing inside the node",()=>{const Z=Pe.get(M),ne=Z?.history.pop();Z!==void 0&&ne!==void 0&&A(M,Z.panel,ne)}),U("CLEAR DETAIL","dismiss the node facts (a click on empty space does too)",()=>{a.get(M)?.detail_clear()}),U("REFRESH","revisit the feed now (a watch keeps sampling it while it runs)",()=>{a.get(M)?.refresh()}))};pt("files","files",Ls.mount),pt("dag","dag",ta.mount),pt("universe","universe",sa.mount),pt("pacs","pacs",rt("pacs-workspace")),pt("launcher","launcher",ii),pt("panes","panes",ri);let zs=!1;const _s=M=>{zs=M};for(const M of["click","focusin"])document.addEventListener(M,v=>{v.target instanceof Element&&(v.target.closest("#drawer")!==null?zs=!0:v.target.closest("#layout-root")!==null&&(zs=!1))});const Vs=()=>{let M=!1;for(const v of document.querySelectorAll(".pane-drawer:not([hidden])"))v.hidden=!0,M=!0;return M},Rn=()=>{let M=!1;for(const v of document.querySelectorAll('.workspace-pane[data-modes="open"]'))delete v.dataset.modes,M=!0;return Qs.serverStrip_isOpen()&&(Qs.serverStrip_close(),M=!0),M};document.addEventListener("click",M=>{if(!(M.target instanceof Element)||M.target.closest(".mode-frame")!==null&&M.target.closest(".mode-fill")===null||M.target.closest("#pacs-server-strip")!==null||M.target.closest("#pacs-f-server")!==null||M.target.closest(".listing-framed .listing-row")!==null)return;const v=M.target.closest(".mode-strip"),D=v?.closest(".workspace-pane")??null,G=D?.dataset.modes==="open",T=Rn();if(v!==null&&D!==null&&!G){D.dataset.modes="open",Lt("audio3");return}T&&Lt("audio3")}),window.addEventListener("keydown",M=>{if(M.key==="Escape"){if(!Va.hidden){aa(),M.stopImmediatePropagation();return}if(ve.ask_abandon()){M.stopImmediatePropagation(),Lt("audio3");return}if(sD()){M.stopImmediatePropagation(),Lt("audio3");return}if(Ii!==null){Ii(),M.stopImmediatePropagation(),Lt("audio3");return}for(const ne of it.values())if(ne.field_release()){M.stopImmediatePropagation(),Lt("audio3");return}let v=!1;for(const ne of ve.ask_isOpen()?[]:i.values())ne.select_isOn()&&(ne.select_toggle(!1),v=!0);if(v){M.stopImmediatePropagation(),Lt("audio3");return}const D=Vs(),G=Rn();if(D||G){M.stopImmediatePropagation(),Lt("audio3");return}if(document.body.dataset.zoom!==void 0)return;if(X()){M.stopImmediatePropagation(),Lt("audio3");return}const T=[...Pe.keys()].pop();if(T!==void 0){const ne=Pe.get(T);ne!==void 0&&ne.panel.content_isShown()?ne.panel.listing_restore():Nt(T),M.stopImmediatePropagation(),Lt("audio3");return}const C=[...a.entries()].find(([,ne])=>ne.inside_isHeld());if(C!==void 0){C[1].flight_back(()=>{}),M.stopImmediatePropagation(),Lt("audio3");return}const $=ze.focused_get(),Z=[...i.entries()].filter(([,ne])=>ne.content_isShown()).sort(([ne],[ie])=>ne===$?-1:ie===$?1:0)[0];if(Z!==void 0){Z[1].listing_restore(),M.stopImmediatePropagation(),Lt("audio3");return}for(const ne of a.values())if(ne.nav_pop()){M.stopImmediatePropagation(),Lt("audio3");return}return}if((M.key==="ArrowRight"||M.key==="ArrowLeft"||M.key==="ArrowDown"||M.key==="ArrowUp")&&document.activeElement instanceof HTMLButtonElement){const v=document.activeElement.closest(".pane-drawer");if(v!==null&&!v.hidden){const D=[...v.querySelectorAll("button")],G=D.indexOf(document.activeElement),T=M.key==="ArrowRight"||M.key==="ArrowDown";D[(G+(T?1:D.length-1))%D.length]?.focus(),M.preventDefault(),M.stopImmediatePropagation()}return}if(M.key===":"&&document.querySelector(".pane-drawer:not([hidden])")!==null){Vs(),Wl(),M.preventDefault(),M.stopImmediatePropagation();return}if(M.key==="b"&&M.ctrlKey&&!M.altKey&&!M.metaKey){if(document.querySelector(".pane-drawer:not([hidden])")!==null){Vs(),Wl(),M.preventDefault();return}M.preventDefault();const v=document.body.dataset.zoom,D=v==="console"||v===void 0&&zs,G=v!==void 0&&v!=="console"?v:ze.focused_get()??"files",T=D?rt("console-drawer"):gn(G)?.mount?.querySelector(".pane-drawer")??null;if(T===null)return;M.preventDefault(),T.hidden=!T.hidden,T.hidden||T.querySelector("button")?.focus(),Lt("audio3")}},{capture:!0});const Wt=(M,v,D)=>{if(v==="pacs"){ze.preset_apply("pacs"),Fe();for(const C of D)Qs.envelope_observe(C);return}const G=qt(v);if(ze.leaf_replace(M,G.id),Ys(M),ze.mount_remove(M),v==="tags"){const C=Ut.get(G.id);for(const $ of D){if($.model?.kind!==Ha.tags)continue;const U=ch.safeParse($.model.data);U.success&&C?.model_show(U.data)}return}if(v==="image"){const C=it.get(G.id);for(const $ of D){if($.model?.kind!==Ha.series)continue;const U=dh.safeParse($.model.data);U.success&&C?.series_show(U.data)}return}const T=v==="files"||v==="catalogue"?i.get(G.id):a.get(G.id);for(const C of D)T?.envelope_observe(C)};Un("files",M=>gt(M,!1)),Un("catalogue",M=>gt(M,!1,!0)),Un("dag",M=>js(M,!1)),Un("universe",wt),Un("view",pe),Un("image",ns),Un("tags",rs),Un("gather",he),Un("empty",M=>{const v=fn("tpl-pane-empty");return new rD(v,{execute:D=>Mt.line_execute(D,{silent:!0,observe:!1}),claim:(D,G)=>Wt(M,D,G)}),{id:M,kind:"empty",mount:v}});const Yt=M=>{M?document.body.dataset.gutter="away":delete document.body.dataset.gutter,Lt("audio3")},Ws=(M,v)=>{if(ze.activePreset_get()===M){Yt(!0);return}document.body.dataset.gutter==="away"&&delete document.body.dataset.gutter,v()};rt("gutter-restore").addEventListener("click",()=>Yt(!1)),window.addEventListener("keydown",M=>{M.key==="Escape"&&document.body.dataset.gutter==="away"&&document.body.dataset.zoom===void 0&&Yt(!1)}),rt("gutter-files").addEventListener("click",()=>{Ws("files",()=>{ln=!1,tt(),ze.focus_set("files"),_s(!1)})});const Et=(M="")=>{We("dag"),$s.list_reset(),$s.roster_filter(M),$s.feedsChooser_request(),ze.focus_set("dag"),_s(!1)},cn=()=>{We("universe");const M=o.get("universe");M!==void 0&&!M.shown_get()&&M.request(),ze.focus_set("universe"),_s(!1)};rt("gutter-runs").addEventListener("click",()=>Ws("dag",()=>Et())),rt("gutter-console").addEventListener("click",()=>{rt("drawer").classList.contains("drawer-closed")&&rt("drawer-toggle").click(),ve.focus_take(),_s(!0)}),rt("gutter-tools").addEventListener("click",()=>{Ws("pacs",()=>{We("pacs"),ze.focus_set("pacs"),_s(!1)})}),rt("gutter-dashboard").addEventListener("click",()=>{Ws("launcher",Ct)}),rt("gutter-panes").addEventListener("click",()=>{Ws("panes",()=>{We("panes"),us.render(),ze.focus_set("panes"),_s(!1)})});const Ts=M=>gn(M)?.kind??null,ra={focused_get:()=>{const M=document.body.dataset.zoom;return M!==void 0&&M!=="console"?M:ze.focused_get()??ze.panes_shown()[0]??null},focus_set:M=>gn(M)===void 0?!1:(ze.focus_set(M),!0),panes_shown:()=>ze.panes_shown(),paneRect_get:M=>document.querySelector(`.layout-leaf[data-leaf="${M}"]`)?.getBoundingClientRect()??null,paneMount_get:M=>gn(M)?.mount??null,paneKind_get:Ts,paneLinked_get:M=>l.group_of(M)!==M,feed_enter:M=>$s.feed_enter(M),consoleZoom_toggle:QD,launcher_enter:Ct,identity_get:()=>ce,node_immerse:M=>{const D=l.regard_get(M)?.address.match(/_(\d+)(?:\/data)?\/?$/)??null;return D===null?!1:a.get(M)?.node_flyTo(parseInt(D[1]??"",10))??!1},file_download:M=>{const v=l.regard_get(M);return v===null||v.modelKind!=="fs.file"?!1:(u(v.address),!0)},image_open:(M,v,D)=>R(M,v,D??{}),image_control:async(M,v,D)=>{const G=new Set(ze.panes_shown()),T=l.group_of(M),C=[...it.entries()].filter(([U])=>G.has(U)),$=it.get(M)??C.find(([U])=>l.group_of(U)===T)?.[1]??(C.length===1?C[0]?.[1]:void 0);if($===void 0)return`image ${v}: no image pane on stage for '${M}'`;if(v==="state"){const U=$.state_get();if(U===null)return"image state: no image on the field";const Z=(U.viewports??[]).map(ne=>`${ne.id.replace(/^.*-/,"")} scale=${ne.scale.toFixed(3)} focus=${ne.focus.map(ie=>ie.toFixed(2)).join(",")} voi=${ne.voi===null?"-":`${ne.voi.lower.toFixed(1)}..${ne.voi.upper.toFixed(1)}`}`).join(" | ");return`image: layout=${U.layout} tool=${U.tool} primary=${U.primaryTool??"-"} slice=${U.slice}/${U.slices} refused=${U.refused} annotations=${U.annotations} filled=${U.filled}
4248
+ viewports: ${Z||"(none)"}`}if(v==="layout"){const U=D[0]??"";return jA.includes(U)?await $.layout_set(U)?`image layout ${U}`:$.state_get()?.waiting===U?`image layout ${U}: waiting for LOAD`:`image layout ${U}: not offered`:"image layout single|mpr|3d|slab"}if(v==="slice"){const U=Number(D[0]);return!Number.isInteger(U)||U<1?"image slice <n>":$.slice_set(U)?`image slice ${U}`:`image slice ${U}: not offered`}if(v==="series"){const U=Number(D[0]),Z=$.siblings_get();if(Z.length===0)return"image series: this pane holds one series, not a study";const ne=Z[U-1];if(ne===void 0)return`image series <1..${Z.length}>: ${Z.map((be,Se)=>`${Se+1} ${be.label}`).join(" · ")}`;const ie=await q(ne.path);return ie===null?`image series ${U}: ${ne.path}: not a readable DICOM series`:($.series_show(ie,{siblings:[...Z]}),`image series ${U} ${ne.label}`)}if(v==="wl"){if((D[0]??"").toLowerCase()==="preset"){const ne=D[1]??"";return ne===""?"image wl preset <brain|bone|lung|soft|liver>":$.wlPreset_set(ne)?`image wl preset ${ne}`:`image wl preset ${ne}: none for this modality`}const U=Number(D[0]),Z=Number(D[1]);return!Number.isFinite(U)||!Number.isFinite(Z)||U>=Z?"image wl <lower> <upper> | image wl preset <name>":$.wl_set(U,Z)?`image wl ${U} ${Z}`:"image wl: not offered"}if(v==="colormap"){const U=(D[0]??"").toLowerCase();return Xo.includes(U)?$.colormap_set(U)?`image colormap ${U}`:`image colormap ${U}: not offered`:"image colormap gray|hot|jet|cool"}if(v==="save")return await $.annotations_save()?"image save":"image save: nothing saved (the console says why)";if(v==="load")return await $.load_press()?"image load":"image load: nothing was waiting";if(v==="guard"){if((D[0]??"").toLowerCase()==="off")return $.guard_set(null),"image guard off";const Z=Number(D[0]);return!Number.isFinite(Z)||Z<0?`image guard <bytes>|off (now ${$.guard_get()===null?"off":$.guard_get()})`:($.guard_set(Z),`image guard ${Z}`)}if(v==="ghost"){const Z=(D[0]??"").toLowerCase()==="off"?null:Number(D[0]);return Z!==null&&(!Number.isFinite(Z)||Z<0||Z>1)?"image ghost <0..1>|off (SLAB layout)":$.ghost_set(Z)?`image ghost ${Z===null?"off":Z}`:"image ghost: SLAB layout only"}if(v==="tags"){const U=[...it.entries()].find(([,Z])=>Z===$)?.[0];return U===void 0?"image tags: no image pane":es(U)}return"image <path> · layout single|mpr|3d · slice <n> · series <n> · wl <lo> <hi> | wl preset <name> · colormap <name> · save"},universe_control:(M,v,D)=>{const G=new Set(ze.panes_shown()),T=(M!==null?o.get(M):void 0)??[...o.entries()].find(([C])=>G.has(C))?.[1];return T===void 0?"universe: no universe pane on stage (press the dashboard tile)":T.control(v,D)},tags_control:(M,v,D)=>{const G=new Set(ze.panes_shown()),T=l.group_of(M),C=[...Ut.entries()].filter(([U])=>G.has(U)),$=Ut.get(M)??C.find(([U])=>l.group_of(U)===T)?.[1]??(C.length===1?C[0]?.[1]:void 0);if($===void 0)return`tags ${v}: no tags pane on stage for '${M}'`;if(v==="redact"){const U=(D[0]??"").toLowerCase();return U!=="on"&&U!=="off"?"tags redact on|off":($.redact_set(U==="on"),`tags redact ${U}`)}if(v==="filter"){const U=D.join(" ");return U===""||U.toLowerCase()==="off"?($.filter_set(null),"tags filter off"):($.filter_set(U),`tags filter ${U}`)}return"tags redact on|off · filter <text>|off"},file_delete:M=>{const v=l.regard_get(M);return v===null||v.modelKind!=="fs.file"?!1:(ve.line_run(`rm "${v.address}"`),!0)},session_run:async M=>{try{return(await Mt.line_execute(M,{silent:!0,observe:!1})).envelopes.map(D=>D.renderedErr??D.rendered).join(`
4249
+ `)}catch(v){return v instanceof Error?v.message:String(v)}},desktop_serialize:()=>{const M=ze.tree_get();if(M===null)return"# empty desktop";const v=[],D=ie=>"pane"in ie?ie.pane:D(ie.first),G=D(M),T=Ts(G);v.push(`view ${T==="dag"?"runs":T==="pacs"?"pacs":"files"}`);let C=1;const $=(ie,be)=>{const Se=Ts(ie);if(Se==="dag"&&ie!==G&&v.push(`pane %${be} claim runs`),Se==="files"&&ie!==G&&l.group_of(ie)===ie&&v.push(`pane %${be} claim files`),Se==="dag"){const Ze=gn(ie)?.mount,$e=Ze?.querySelector(".dag-strategy")?.textContent?.toLowerCase()??"ranked",yt=Ze?.querySelector(".dag-projection")?.textContent?.toLowerCase()??"3d",Kt=Ze?.querySelector(".dag-hue")?.textContent?.toLowerCase()??"status";$e!=="ranked"&&v.push(`dag %${be} layout ${$e}`),yt!=="3d"&&v.push(`dag %${be} projection ${yt}`),Kt!=="status"&&v.push(`dag %${be} hue ${Kt}`)}},U=(ie,be)=>{if("pane"in ie){$(ie.pane,be);return}const Se=D(ie.second),Ze=Ts(Se),$e=Ze==="view"?"viewer":Ze==="files"&&l.group_of(Se)!==Se?"fs":"unlinked";v.push(`pane %${be} bind ${$e}`),v.push(`pane %${be} split ${ie.dir==="col"?"right":"below"}`);const yt=++C;U(ie.first,be),U(ie.second,yt)};U(M,C);const Z=document.body.dataset.header;return Z!==void 0&&v.push(`header ${Z}`),document.getElementById("drawer")?.classList.contains("drawer-closed")&&v.push("console close"),v.join(`
4250
+ `)}},Va=rt("lang-palette"),li=rt("lang-input"),Pl=rt("lang-result"),Ll=rt("lang-pill"),Wl=()=>{Vs(),Va.hidden=!1,Ll.classList.add("lang-live"),Pl.textContent="",li.value="",li.focus(),Lt("audio3")},aa=()=>{Va.hidden=!0,Ll.classList.remove("lang-live"),Pl.textContent=""};Ll.addEventListener("click",()=>{Va.hidden?Wl():aa()});const MM=["pane","view","runs","node","dag","file","pacs","header","console","back","desktop","argus"],Qu={pane:["split","zoom","close","bind","claim","focus"],view:["files","runs","pacs"],runs:["enter","sort","filter"],node:["enter","immerse","back","clear"],dag:["layout","projection","scale","hue","pulse","census","physics","refresh"],physics:["charge","link","collide","gravity","reset"],file:["home","back","download","delete","sort","filter","follow","root","list","cards","preview"],pacs:["sort","filter","connect","disconnect","list","query","pull","status"],header:["stats","dag","away","restore"],console:["open","close","toggle","zoom","height"],desktop:["save","load","show","list","delete"],split:["left","right","above","below"],bind:["unlinked","fs","viewer"],claim:["files","runs","pacs"],layout:["ranked","molecule"],projection:["2d","3d"],scale:["time","size"],hue:["status","compute"],argus:["verbs"]};li.addEventListener("keydown",M=>{if(M.key==="Escape"){M.stopPropagation(),aa();return}if(M.key==="Tab"){M.preventDefault();const v=li.value.split(/\s+/),D=v[v.length-1]??"",G=v.length<=1?"":v[v.length-2]??"",C=(v.length<=1?MM:Qu[G]??Qu[v[0]??""]??[]).find($=>$.startsWith(D.toLowerCase()));C!==void 0&&(v[v.length-1]=C,li.value=`${v.join(" ")} `);return}if(M.key==="Enter"){const v=li.value.trim();if(v.length===0){aa();return}au(ra,v).then(D=>{D!==null?(Pl.textContent=D,ve.output_write("data",`: ${v}
4251
4251
  ${D}
4252
- `),li.value="",li.select()):(aa(),Oe.line_run(v))})}}),tm()?(_e.preset_apply("launcher"),Tt.render()):_e.preset_apply(_e.savedPreset_get()??"files");const bM=rt("drawer-status"),oa=M=>{bM.textContent=`MODE: [${M}]`};uA(document.documentElement);const Oe=new yA(rt("terminal"),async M=>{const v=await au(ra,M);if(v!==null){Oe.output_write("data",`${v}
4253
- `),Oe.prompt_draw(),oa("READY");return}oa("BUSY");const D=performance.now();try{const G=await Mt.line_execute(M);Oe.outcome_write(G),G.envelopes.some(T=>T.model?.kind==="fs.cwd")&&Mt.line_execute("ls",{silent:!0})}catch(G){const T=G instanceof Error?G.message:String(G);Oe.output_write("err",`\x1B[31m${T}\x1B[0m
4254
- `)}Ju.clear(),e.activity_clear(),oa(`READY ${Math.round(performance.now()-D)}ms`),Oe.prompt_draw()},M=>Mt.line_complete(M));ZD(M=>Oe.line_note(M));const Ju=new SA(Oe.progressRegion_get(),M=>Oe.output_write("err",M)),kl=await Vu.session_attach(iI(),n,{output_receive:(M,v)=>Oe.output_write(M,v),progress_receive:M=>{Ju.write(M),e.progress_observe(M),Cr?.progress_observe(M);for(const v of a.values())v.progress_observe(M);Qs.progress_observe(M)},ask_receive:async M=>{if(M.kind!=="path"){const G=ai;return ai=null,G!==null&&gn(G)!==void 0?zn(G,{message:M.message,kind:M.kind==="secret"?"secret":M.kind==="confirm"?"confirm":"text",...M.suggest===void 0?{}:{suggest:M.suggest}}):(lr?.(!1),Oe.ask_open({message:M.message,kind:M.kind,...M.suggest===void 0?{}:{suggest:M.suggest}}))}const v=Oe.ask_note(M.message),D=await ia(M);return v(D),D},promptline_receive:M=>{Ve=M.user,le=M.uri===""?M.user:`${M.user}@${M.uri}`,Object.assign(globalThis,{__argusPromptContext:M,__argusPromptContext_show:v=>e.promptContext_show(v)}),Oe.promptContext_set(M),e.promptContext_show(M),t.promptContext_show(M),Cr?.promptContext_observe(M),$s.promptContext_observe(M);for(const v of o.values())v.promptContext_observe(M);for(const v of i.values())v.home_set(M.user===""?null:`/home/${M.user}`)},telemetry_receive:(M,v)=>{t.counts_show(M),v?.state!==void 0&&t.state_show(v.state),s.telemetry_show(v??{}),v?.cube!==void 0&&t.pace_show(v.cube.msPerPage),Cr?.index_observe(M)},session_receive:(M,v)=>Oe.session_write(M,v),ambient_receive:M=>{if(M.model?.kind==="fs.listing"){Nl.ambient_observe(M);for(const D of i.values())D.ambient_observe(M);return}if(M.model?.kind!=="feed.dag")return;const v=ed.safeParse(M.model.data);if(v.success){$s.model_refresh(v.data);for(const D of a.values())D.model_refresh(v.data)}},watched_receive:(M,v)=>{$s.watched_observe(M,v);for(const D of a.values())D.watched_observe(M,v)},numbered_receive:M=>{NA({source:M.source,handles:M.handles})},envelope_observe:M=>{const v=M.model?.kind;if(v===T0.view){const D=I0.safeParse(M.model?.data);D.success&&R(_e.focused_get(),D.data.path,D.data.force===!0?{force:!0}:{}).then(G=>Oe.line_note(G));return}if(v==="feed.dag"||v==="feed.list"||v===zi.feedIndexing){const D=_e.focused_get();(D!==null&&a.has(D)?a.get(D):$s).envelope_observe(M)}else{for(const[D,G]of i)f.get(D)===!0&&G.envelope_observe(M);if(Qs.envelope_observe(M),v==="fs.rm"||v==="fs.mv"||v==="fs.cp")for(const[D,G]of i){const T=G.path_current();T!==null&&I(D,T)}}na.envelope_observe(M)},close_handle:()=>{e.connection_show(!1),Cr?.connection_show(!1),oa("OFFLINE")}}),Mt=kl.client;e.attach_show(kl.attach),e.connection_show(!0),Cr?.connection_show(!0),zI(kl.attach),Mt.line_execute("ls /bin",{silent:!0,observe:!1}).then(M=>{const G=(M.envelopes.find(T=>T.model?.kind==="fs.listing")?.model?.data??[]).flatMap(T=>T.items).filter(T=>T.type==="pipeline").map(T=>T.name);na.names_set(G)}),Mt.line_execute("ls",{silent:!0}),_e.activePreset_get()==="launcher"&&Tt.render(),mM=Ee,ce(),dt(),oa("READY"),Oe.splash_write(JD),Oe.prompt_draw(),Oe.focus_take(),Mt.line_execute(`motd ${eI}`,{silent:!0,observe:!1}).then(M=>{const v=M.envelopes.filter(D=>D.status==="ok").map(D=>D.rendered).join("").trimEnd();v.length>0&&Oe.greeting_write(v.split(`
4255
- `))}).catch(()=>{}),lr=oI(rt("drawer"),rt("drawer-strip"),rt("drawer-toggle"),Oe);const cr=rt("console-drawer");rt("console-handle").addEventListener("click",M=>{M.target instanceof Element&&M.target.closest("button")!==null||(cr.hidden=!cr.hidden,cr.hidden||cr.querySelector("button")?.focus(),Wt("audio3"))}),cr.querySelector(".console-retract")?.addEventListener("click",()=>{cr.hidden=!0,rt("drawer-toggle").click()}),fM=lI(Oe),_I(),window.addEventListener("resize",()=>Oe.size_fit())}function yI(){const n=rt("door-pill");Ug(window.location.search)&&(n.hidden=!1,n.addEventListener("click",()=>{const e=np(window.location.pathname,"logout"),t=np(window.location.pathname,"login");fetch(e,{method:"POST",headers:{accept:"application/json"}}).catch(()=>{}).then(()=>{window.location.assign(t)})}))}function vI(){Cr=cI(),hI(),uI(),sI(),nI(),bI(),yI();const e=new URLSearchParams(window.location.search).get("token"),t=Ug(window.location.search),s=rt("attach-form"),i=rt("attach-error"),r=o=>{wI(o).then(()=>{s.classList.add("attach-hidden")},l=>{s.classList.remove("attach-hidden"),i.textContent=l instanceof Error?l.message:String(l)})},a=rt("attach-token");rt("attach-submit").addEventListener("click",()=>{a.value.trim().length>0&&r(a.value.trim())}),a.addEventListener("keydown",o=>{o.key==="Enter"&&a.value.trim().length>0&&r(a.value.trim())}),e!==null&&e.length>0?(s.classList.add("attach-hidden"),r(e)):t&&(s.classList.add("attach-hidden"),r(""))}vI();export{dp as I,$p as _,OI as b};
4252
+ `),li.value="",li.select()):(aa(),ve.line_run(v))})}}),tm()?(ze.preset_apply("launcher"),Tt.render()):ze.preset_apply(ze.savedPreset_get()??"files");const bM=rt("drawer-status"),oa=M=>{bM.textContent=`MODE: [${M}]`};uA(document.documentElement);const ve=new yA(rt("terminal"),async M=>{const v=await au(ra,M);if(v!==null){ve.output_write("data",`${v}
4253
+ `),ve.prompt_draw(),oa("READY");return}oa("BUSY");const D=performance.now();try{const G=await Mt.line_execute(M);ve.outcome_write(G),G.envelopes.some(T=>T.model?.kind==="fs.cwd")&&Mt.line_execute("ls",{silent:!0})}catch(G){const T=G instanceof Error?G.message:String(G);ve.output_write("err",`\x1B[31m${T}\x1B[0m
4254
+ `)}Ju.clear(),e.activity_clear(),oa(`READY ${Math.round(performance.now()-D)}ms`),ve.prompt_draw()},M=>Mt.line_complete(M));ZD(M=>ve.line_note(M));const Ju=new SA(ve.progressRegion_get(),M=>ve.output_write("err",M)),kl=await Vu.session_attach(iI(),n,{output_receive:(M,v)=>ve.output_write(M,v),progress_receive:M=>{Ju.write(M),e.progress_observe(M),Cr?.progress_observe(M);for(const v of a.values())v.progress_observe(M);Qs.progress_observe(M)},ask_receive:async M=>{if(M.kind!=="path"){const G=ai;return ai=null,G!==null&&gn(G)!==void 0?zn(G,{message:M.message,kind:M.kind==="secret"?"secret":M.kind==="confirm"?"confirm":"text",...M.suggest===void 0?{}:{suggest:M.suggest}}):(lr?.(!1),ve.ask_open({message:M.message,kind:M.kind,...M.suggest===void 0?{}:{suggest:M.suggest}}))}const v=ve.ask_note(M.message),D=await ia(M);return v(D),D},promptline_receive:M=>{je=M.user,ce=M.uri===""?M.user:`${M.user}@${M.uri}`,Object.assign(globalThis,{__argusPromptContext:M,__argusPromptContext_show:v=>e.promptContext_show(v)}),ve.promptContext_set(M),e.promptContext_show(M),t.promptContext_show(M),Cr?.promptContext_observe(M),$s.promptContext_observe(M);for(const v of o.values())v.promptContext_observe(M);for(const v of i.values())v.home_set(M.user===""?null:`/home/${M.user}`)},telemetry_receive:(M,v)=>{t.counts_show(M),v?.state!==void 0&&t.state_show(v.state),s.telemetry_show(v??{}),v?.cube!==void 0&&t.pace_show(v.cube.msPerPage),Cr?.index_observe(M)},session_receive:(M,v)=>ve.session_write(M,v),ambient_receive:M=>{if(M.model?.kind==="fs.listing"){Nl.ambient_observe(M);for(const D of i.values())D.ambient_observe(M);return}if(M.model?.kind!=="feed.dag")return;const v=ed.safeParse(M.model.data);if(v.success){$s.model_refresh(v.data);for(const D of a.values())D.model_refresh(v.data)}},watched_receive:(M,v)=>{$s.watched_observe(M,v);for(const D of a.values())D.watched_observe(M,v)},numbered_receive:M=>{NA({source:M.source,handles:M.handles})},envelope_observe:M=>{const v=M.model?.kind;if(v===T0.view){const D=I0.safeParse(M.model?.data);D.success&&R(ze.focused_get(),D.data.path,D.data.force===!0?{force:!0}:{}).then(G=>ve.line_note(G));return}if(v==="feed.dag"||v==="feed.list"||v===zi.feedIndexing){const D=ze.focused_get();(D!==null&&a.has(D)?a.get(D):$s).envelope_observe(M)}else{for(const[D,G]of i)f.get(D)===!0&&G.envelope_observe(M);if(Qs.envelope_observe(M),v==="fs.rm"||v==="fs.mv"||v==="fs.cp")for(const[D,G]of i){const T=G.path_current();T!==null&&I(D,T)}}na.envelope_observe(M)},close_handle:()=>{e.connection_show(!1),Cr?.connection_show(!1),oa("OFFLINE")}}),Mt=kl.client;e.attach_show(kl.attach),e.connection_show(!0),Cr?.connection_show(!0),zI(kl.attach),Mt.line_execute("ls /bin",{silent:!0,observe:!1}).then(M=>{const G=(M.envelopes.find(T=>T.model?.kind==="fs.listing")?.model?.data??[]).flatMap(T=>T.items).filter(T=>T.type==="pipeline").map(T=>T.name);na.names_set(G)}),Mt.line_execute("ls",{silent:!0}),ze.activePreset_get()==="launcher"&&Tt.render(),mM=Ee,de(),dt(),oa("READY"),ve.splash_write(JD),ve.prompt_draw(),ve.focus_take(),Mt.line_execute(`motd ${eI}`,{silent:!0,observe:!1}).then(M=>{const v=M.envelopes.filter(D=>D.status==="ok").map(D=>D.rendered).join("").trimEnd();v.length>0&&ve.greeting_write(v.split(`
4255
+ `))}).catch(()=>{}),lr=oI(rt("drawer"),rt("drawer-strip"),rt("drawer-toggle"),ve);const cr=rt("console-drawer");rt("console-handle").addEventListener("click",M=>{M.target instanceof Element&&M.target.closest("button")!==null||(cr.hidden=!cr.hidden,cr.hidden||cr.querySelector("button")?.focus(),Lt("audio3"))}),cr.querySelector(".console-retract")?.addEventListener("click",()=>{cr.hidden=!0,rt("drawer-toggle").click()}),fM=lI(ve),_I(),window.addEventListener("resize",()=>ve.size_fit())}function yI(){const n=rt("door-pill");Ug(window.location.search)&&(n.hidden=!1,n.addEventListener("click",()=>{const e=np(window.location.pathname,"logout"),t=np(window.location.pathname,"login");fetch(e,{method:"POST",headers:{accept:"application/json"}}).catch(()=>{}).then(()=>{window.location.assign(t)})}))}function vI(){Cr=cI(),hI(),uI(),sI(),nI(),bI(),yI();const e=new URLSearchParams(window.location.search).get("token"),t=Ug(window.location.search),s=rt("attach-form"),i=rt("attach-error"),r=o=>{wI(o).then(()=>{s.classList.add("attach-hidden")},l=>{s.classList.remove("attach-hidden"),i.textContent=l instanceof Error?l.message:String(l)})},a=rt("attach-token");rt("attach-submit").addEventListener("click",()=>{a.value.trim().length>0&&r(a.value.trim())}),a.addEventListener("keydown",o=>{o.key==="Enter"&&a.value.trim().length>0&&r(a.value.trim())}),e!==null&&e.length>0?(s.classList.add("attach-hidden"),r(e)):t&&(s.classList.add("attach-hidden"),r(""))}vI();export{dp as I,$p as _,OI as b};