@fnndsc/argus 0.27.0 → 0.27.2

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.
Files changed (25) hide show
  1. package/dist/assets/{Settings-BsyHRBMA.js → Settings-x3f_1HYI.js} +1 -1
  2. package/dist/assets/{Texture-CiZr2UG4.js → Texture-CI5ekX-f.js} +1 -1
  3. package/dist/assets/{addVolumesToViewports-BKbY2vPF.js → addVolumesToViewports-BTCPRCf6.js} +1 -1
  4. package/dist/assets/{cornerstoneEngine-Dnrud_dx.js → cornerstoneEngine-BJeodQK9.js} +2 -2
  5. package/dist/assets/{field-DWrxyyw1.js → field-CEOZA9qR.js} +3 -3
  6. package/dist/assets/{index-NUPtdBez.js → index-B0iQ9uc_.js} +1 -1
  7. package/dist/assets/{index-BLWOfThz.js → index-B5KaOEuQ.js} +1 -1
  8. package/dist/assets/{index-CDua97bq.js → index-BFhsAqmg.js} +1 -1
  9. package/dist/assets/{index-D5qIQ_Ho.js → index-BQ85ct1J.js} +1 -1
  10. package/dist/assets/{index-BrIgCGng.js → index-BU2Q5wYb.js} +1 -1
  11. package/dist/assets/{index-Z1bm0M_F.js → index-CX1tDZRf.js} +1 -1
  12. package/dist/assets/{index-Cn5l0vla.js → index-Cka9uhEt.js} +1 -1
  13. package/dist/assets/{index-BcXaBoGQ.js → index-ClxDq7yM.js} +1 -1
  14. package/dist/assets/{index-Dc5JdMxv.js → index-CnsitFKa.js} +1 -1
  15. package/dist/assets/{index-Cv2EUZ4w.js → index-DRH8ICci.js} +1 -1
  16. package/dist/assets/{index-BnjJzHlA.js → index-DUBHV1d9.js} +21 -21
  17. package/dist/assets/{index-B1M4l8-b.js → index-DWcCmGrg.js} +1 -1
  18. package/dist/assets/{index-BqK3olVi.js → index-JqC5AksR.js} +1 -1
  19. package/dist/assets/{index-ChcEno1H.js → index-h7YrezbS.js} +1 -1
  20. package/dist/assets/{niivueEngine-CwVnap6o.js → niivueEngine-BuUczFAb.js} +2 -2
  21. package/dist/assets/{slabScene-D8kcGEOT.js → slabScene-LtSlsdC0.js} +1 -1
  22. package/dist/build.json +1 -1
  23. package/dist/index.html +1 -1
  24. package/dist/notes.json +1 -1
  25. package/package.json +2 -2
@@ -1,5 +1,5 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./cornerstoneEngine-Dnrud_dx.js","./refusal-DOpm8I8L.js","./_commonjsHelpers-CE1G-McA.js","./niivueEngine-CwVnap6o.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 cb=450,ph=12;function Hi(n,e,t=Date.now()){const s=Number(n.dataset.edgeAt??0);return n.dataset.edge===e&&t-s<cb?!1:(delete n.dataset.edge,n.offsetWidth,n.dataset.edge=e,n.dataset.edgeAt=String(t),!0)}function db(n,e){return e?"▲ TOP":`▼ ${n} MORE`}function ub(n,e){const t=n.getBoundingClientRect().bottom;let s=0;for(const i of n.querySelectorAll(e)){const r=i.getBoundingClientRect();r.height>0&&r.top>=t-2&&(s+=1)}return s}function hb(n){const e=parseFloat(getComputedStyle(n).lineHeight)||16;return Math.max(0,Math.ceil((n.scrollHeight-n.scrollTop-n.clientHeight)/e))}function Hs(n,e={}){n.dataset.more="wired",n.classList.add("holds-more");const t=document.createElement("button");t.type="button",t.className=`more-chip${e.className!==void 0?` ${e.className}`:""}`,t.hidden=!0;const s=e.label??db,i=()=>n.scrollTop+n.clientHeight>=n.scrollHeight-2;t.addEventListener("click",l=>{if(l.stopPropagation(),e.press!==void 0){e.press();return}n.scrollBy({top:i()?-n.scrollHeight:Math.max(1,n.clientHeight-t.offsetHeight),behavior:"smooth"})});const r=e.mount??n;r.appendChild(t);let a=!1;const o=()=>{if(!a){a=!0;try{r===n&&n.lastElementChild!==t&&n.appendChild(t);const l=(e.scrolls?.()??!0)&&n.scrollHeight>n.clientHeight+2;if(t.hidden!==!l&&(t.hidden=!l),!l)return;const c=e.rows!==void 0?ub(n,e.rows):hb(n),d=s(c,i());t.textContent!==d&&(t.textContent=d)}finally{a=!1}}};return n.addEventListener("scroll",o,{passive:!0}),fb(n,i),typeof ResizeObserver<"u"&&new ResizeObserver(o).observe(n),new MutationObserver(o).observe(n,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["hidden","class","style"]}),o(),t}function fb(n,e){const t=()=>n.scrollHeight>n.clientHeight+2,s=()=>n.scrollTop<=0;let i=n.scrollTop;n.addEventListener("scrollend",()=>{const a=n.scrollTop!==i;i=n.scrollTop,!(!a||!t())&&(s()?Hi(n,"top"):e()&&Hi(n,"bottom"))}),n.addEventListener("wheel",a=>{!t()||a.deltaY===0||(a.deltaY<0&&s()?Hi(n,"top"):a.deltaY>0&&e()&&Hi(n,"bottom"))},{passive:!0});let r=null;n.addEventListener("touchstart",a=>{r=a.touches[0]?.clientY??null},{passive:!0}),n.addEventListener("touchmove",a=>{const o=a.touches[0]?.clientY;r===null||o===void 0||!t()||(o-r>ph&&s()?(Hi(n,"top"),r=null):r-o>ph&&e()&&(Hi(n,"bottom"),r=null))},{passive:!0}),n.addEventListener("animationend",a=>{a.target===n&&a.animationName.startsWith("edge-flare")&&delete n.dataset.edge})}const pb=["cold","cached","failed"];function mb(n){return n.state??(n.restored===!0?"cached":"cold")}const gb=["upload","download","pull","workflow","pipeline","group","task"],Mb=["transfer","retrieve","workflow","inspection"],bb=["scanning","transferring","watching","retrying","reading","working","complete","failed"],_b=["files","bytes","series","jobs","nodes"],zb=["running","done","unconfirmed","stalled","timeout","error","unknown"],jc=1,wb=new Set([".dcm",".png",".jpg",".jpeg",".gif",".bmp",".webp",".ico",".pdf",".zip",".tar",".gz",".bz2",".xz",".7z",".exe",".dll",".so",".bin",".mp3",".mp4",".avi",".wav",".nii",".mgz"]),yb=1024*1024;function Im(n){const e=n.split("/").pop()??n,t=e.lastIndexOf(".");return t>0?e.slice(t).toLowerCase():""}function vb(n){return!wb.has(Im(n))}var _t;(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})(_t||(_t={}));var mh;(function(n){n.mergeShapes=(e,t)=>({...e,...t})})(mh||(mh={}));const Ie=_t.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),$n=n=>{switch(typeof n){case"undefined":return Ie.undefined;case"string":return Ie.string;case"number":return Number.isNaN(n)?Ie.nan:Ie.number;case"boolean":return Ie.boolean;case"function":return Ie.function;case"bigint":return Ie.bigint;case"symbol":return Ie.symbol;case"object":return Array.isArray(n)?Ie.array:n===null?Ie.null:n.then&&typeof n.then=="function"&&n.catch&&typeof n.catch=="function"?Ie.promise:typeof Map<"u"&&n instanceof Map?Ie.map:typeof Set<"u"&&n instanceof Set?Ie.set:typeof Date<"u"&&n instanceof Date?Ie.date:Ie.object;default:return Ie.unknown}},me=_t.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 An 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 An))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,_t.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()}}An.create=n=>new An(n);const $c=(n,e)=>{let t;switch(n.code){case me.invalid_type:n.received===Ie.undefined?t="Required":t=`Expected ${n.expected}, received ${n.received}`;break;case me.invalid_literal:t=`Invalid literal value, expected ${JSON.stringify(n.expected,_t.jsonStringifyReplacer)}`;break;case me.unrecognized_keys:t=`Unrecognized key(s) in object: ${_t.joinValues(n.keys,", ")}`;break;case me.invalid_union:t="Invalid input";break;case me.invalid_union_discriminator:t=`Invalid discriminator value. Expected ${_t.joinValues(n.options)}`;break;case me.invalid_enum_value:t=`Invalid enum value. Expected ${_t.joinValues(n.options)}, received '${n.received}'`;break;case me.invalid_arguments:t="Invalid function arguments";break;case me.invalid_return_type:t="Invalid function return type";break;case me.invalid_date:t="Invalid date";break;case me.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}"`:_t.assertNever(n.validation):n.validation!=="regex"?t=`Invalid ${n.validation}`:t="Invalid";break;case me.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 me.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 me.custom:t="Invalid input";break;case me.invalid_intersection_types:t="Intersection results could not be merged";break;case me.not_multiple_of:t=`Number must be a multiple of ${n.multipleOf}`;break;case me.not_finite:t="Number must be finite";break;default:t=e.defaultError,_t.assertNever(n)}return{message:t}};let Ob=$c;function xb(){return Ob}const Sb=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 Ae(n,e){const t=xb(),s=Sb({issueData:e,data:n.data,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,t,t===$c?void 0:$c].filter(i=>!!i)});n.common.issues.push(s)}class fs{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 Qe;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 fs.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 Qe;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 Qe=Object.freeze({status:"aborted"}),la=n=>({status:"dirty",value:n}),Cs=n=>({status:"valid",value:n}),gh=n=>n.status==="aborted",Mh=n=>n.status==="dirty",Sr=n=>n.status==="valid",No=n=>typeof Promise<"u"&&n instanceof Promise;var Le;(function(n){n.errToObj=e=>typeof e=="string"?{message:e}:e||{},n.toString=e=>typeof e=="string"?e:e?.message})(Le||(Le={}));class an{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 bh=(n,e)=>{if(Sr(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 An(n.common.issues);return this._error=t,this._error}}};function rt(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 ct{get description(){return this._def.description}_getType(e){return $n(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:$n(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new fs,ctx:{common:e.parent.common,data:e.data,parsedType:$n(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if(No(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:$n(e)},i=this._parseSync({data:e,path:s.path,parent:s});return bh(s,i)}"~validate"(e){const t={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:$n(e)};if(!this["~standard"].async)try{const s=this._parseSync({data:e,path:[],parent:t});return Sr(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=>Sr(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:$n(e)},i=this._parse({data:e,path:s.path,parent:s}),r=await(No(i)?i:Promise.resolve(i));return bh(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:me.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 Gi({schema:this,typeName:Je.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 On.create(this,this._def)}nullable(){return Ri.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return sn.create(this)}promise(){return Uo.create(this,this._def)}or(e){return Co.create([this,e],this._def)}and(e){return Po.create(this,e,this._def)}transform(e){return new Gi({...rt(this._def),schema:this,typeName:Je.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t=typeof e=="function"?e:()=>e;return new Fo({...rt(this._def),innerType:this,defaultValue:t,typeName:Je.ZodDefault})}brand(){return new Bm({typeName:Je.ZodBranded,type:this,...rt(this._def)})}catch(e){const t=typeof e=="function"?e:()=>e;return new jo({...rt(this._def),innerType:this,catchValue:t,typeName:Je.ZodCatch})}describe(e){const t=this.constructor;return new t({...this._def,description:e})}pipe(e){return fu.create(this,e)}readonly(){return $o.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const Eb=/^c[^\s-]{8,}$/i,Ab=/^[0-9a-z]+$/,Db=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Tb=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,Ib=/^[a-z0-9_-]{21}$/i,Gb=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,Rb=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H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3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,Wb=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((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])|([0-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])$/,kb=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Ub=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Gm="((\\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])))",Fb=new RegExp(`^${Gm}$`);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 jb(n){return new RegExp(`^${Rm(n)}$`)}function $b(n){let e=`${Gm}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 Vb(n,e){return!!((e==="v4"||!e)&&Cb.test(n)||(e==="v6"||!e)&&Lb.test(n))}function Hb(n,e){if(!Gb.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 qb(n,e){return!!((e==="v4"||!e)&&Pb.test(n)||(e==="v6"||!e)&&Wb.test(n))}class wn extends ct{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==Ie.string){const r=this._getOrReturnCtx(e);return Ae(r,{code:me.invalid_type,expected:Ie.string,received:r.parsedType}),Qe}const s=new fs;let i;for(const r of this._def.checks)if(r.kind==="min")e.data.length<r.value&&(i=this._getOrReturnCtx(e,i),Ae(i,{code:me.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),Ae(i,{code:me.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?Ae(i,{code:me.too_big,maximum:r.value,type:"string",inclusive:!0,exact:!0,message:r.message}):o&&Ae(i,{code:me.too_small,minimum:r.value,type:"string",inclusive:!0,exact:!0,message:r.message}),s.dirty())}else if(r.kind==="email")Nb.test(e.data)||(i=this._getOrReturnCtx(e,i),Ae(i,{validation:"email",code:me.invalid_string,message:r.message}),s.dirty());else if(r.kind==="emoji")Rl||(Rl=new RegExp(Bb,"u")),Rl.test(e.data)||(i=this._getOrReturnCtx(e,i),Ae(i,{validation:"emoji",code:me.invalid_string,message:r.message}),s.dirty());else if(r.kind==="uuid")Tb.test(e.data)||(i=this._getOrReturnCtx(e,i),Ae(i,{validation:"uuid",code:me.invalid_string,message:r.message}),s.dirty());else if(r.kind==="nanoid")Ib.test(e.data)||(i=this._getOrReturnCtx(e,i),Ae(i,{validation:"nanoid",code:me.invalid_string,message:r.message}),s.dirty());else if(r.kind==="cuid")Eb.test(e.data)||(i=this._getOrReturnCtx(e,i),Ae(i,{validation:"cuid",code:me.invalid_string,message:r.message}),s.dirty());else if(r.kind==="cuid2")Ab.test(e.data)||(i=this._getOrReturnCtx(e,i),Ae(i,{validation:"cuid2",code:me.invalid_string,message:r.message}),s.dirty());else if(r.kind==="ulid")Db.test(e.data)||(i=this._getOrReturnCtx(e,i),Ae(i,{validation:"ulid",code:me.invalid_string,message:r.message}),s.dirty());else if(r.kind==="url")try{new URL(e.data)}catch{i=this._getOrReturnCtx(e,i),Ae(i,{validation:"url",code:me.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),Ae(i,{validation:"regex",code:me.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),Ae(i,{code:me.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),Ae(i,{code:me.invalid_string,validation:{startsWith:r.value},message:r.message}),s.dirty()):r.kind==="endsWith"?e.data.endsWith(r.value)||(i=this._getOrReturnCtx(e,i),Ae(i,{code:me.invalid_string,validation:{endsWith:r.value},message:r.message}),s.dirty()):r.kind==="datetime"?$b(r).test(e.data)||(i=this._getOrReturnCtx(e,i),Ae(i,{code:me.invalid_string,validation:"datetime",message:r.message}),s.dirty()):r.kind==="date"?Fb.test(e.data)||(i=this._getOrReturnCtx(e,i),Ae(i,{code:me.invalid_string,validation:"date",message:r.message}),s.dirty()):r.kind==="time"?jb(r).test(e.data)||(i=this._getOrReturnCtx(e,i),Ae(i,{code:me.invalid_string,validation:"time",message:r.message}),s.dirty()):r.kind==="duration"?Rb.test(e.data)||(i=this._getOrReturnCtx(e,i),Ae(i,{validation:"duration",code:me.invalid_string,message:r.message}),s.dirty()):r.kind==="ip"?Vb(e.data,r.version)||(i=this._getOrReturnCtx(e,i),Ae(i,{validation:"ip",code:me.invalid_string,message:r.message}),s.dirty()):r.kind==="jwt"?Hb(e.data,r.alg)||(i=this._getOrReturnCtx(e,i),Ae(i,{validation:"jwt",code:me.invalid_string,message:r.message}),s.dirty()):r.kind==="cidr"?qb(e.data,r.version)||(i=this._getOrReturnCtx(e,i),Ae(i,{validation:"cidr",code:me.invalid_string,message:r.message}),s.dirty()):r.kind==="base64"?kb.test(e.data)||(i=this._getOrReturnCtx(e,i),Ae(i,{validation:"base64",code:me.invalid_string,message:r.message}),s.dirty()):r.kind==="base64url"?Ub.test(e.data)||(i=this._getOrReturnCtx(e,i),Ae(i,{validation:"base64url",code:me.invalid_string,message:r.message}),s.dirty()):_t.assertNever(r);return{status:s.value,value:e.data}}_regex(e,t,s){return this.refinement(i=>e.test(i),{validation:t,code:me.invalid_string,...Le.errToObj(s)})}_addCheck(e){return new wn({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...Le.errToObj(e)})}url(e){return this._addCheck({kind:"url",...Le.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...Le.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...Le.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...Le.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...Le.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...Le.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...Le.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...Le.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...Le.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...Le.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...Le.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...Le.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,...Le.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,...Le.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...Le.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...Le.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t?.position,...Le.errToObj(t?.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...Le.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...Le.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...Le.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...Le.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...Le.errToObj(t)})}nonempty(e){return this.min(1,Le.errToObj(e))}trim(){return new wn({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new wn({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new wn({...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}}wn.create=n=>new wn({checks:[],typeName:Je.ZodString,coerce:n?.coerce??!1,...rt(n)});function Xb(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 Er extends ct{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)!==Ie.number){const r=this._getOrReturnCtx(e);return Ae(r,{code:me.invalid_type,expected:Ie.number,received:r.parsedType}),Qe}let s;const i=new fs;for(const r of this._def.checks)r.kind==="int"?_t.isInteger(e.data)||(s=this._getOrReturnCtx(e,s),Ae(s,{code:me.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),Ae(s,{code:me.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),Ae(s,{code:me.too_big,maximum:r.value,type:"number",inclusive:r.inclusive,exact:!1,message:r.message}),i.dirty()):r.kind==="multipleOf"?Xb(e.data,r.value)!==0&&(s=this._getOrReturnCtx(e,s),Ae(s,{code:me.not_multiple_of,multipleOf:r.value,message:r.message}),i.dirty()):r.kind==="finite"?Number.isFinite(e.data)||(s=this._getOrReturnCtx(e,s),Ae(s,{code:me.not_finite,message:r.message}),i.dirty()):_t.assertNever(r);return{status:i.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,Le.toString(t))}gt(e,t){return this.setLimit("min",e,!1,Le.toString(t))}lte(e,t){return this.setLimit("max",e,!0,Le.toString(t))}lt(e,t){return this.setLimit("max",e,!1,Le.toString(t))}setLimit(e,t,s,i){return new Er({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:s,message:Le.toString(i)}]})}_addCheck(e){return new Er({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:Le.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:Le.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:Le.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:Le.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:Le.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:Le.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:Le.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:Le.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:Le.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"&&_t.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)}}Er.create=n=>new Er({checks:[],typeName:Je.ZodNumber,coerce:n?.coerce||!1,...rt(n)});class ba extends ct{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)!==Ie.bigint)return this._getInvalidInput(e);let s;const i=new fs;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),Ae(s,{code:me.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),Ae(s,{code:me.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),Ae(s,{code:me.not_multiple_of,multipleOf:r.value,message:r.message}),i.dirty()):_t.assertNever(r);return{status:i.value,value:e.data}}_getInvalidInput(e){const t=this._getOrReturnCtx(e);return Ae(t,{code:me.invalid_type,expected:Ie.bigint,received:t.parsedType}),Qe}gte(e,t){return this.setLimit("min",e,!0,Le.toString(t))}gt(e,t){return this.setLimit("min",e,!1,Le.toString(t))}lte(e,t){return this.setLimit("max",e,!0,Le.toString(t))}lt(e,t){return this.setLimit("max",e,!1,Le.toString(t))}setLimit(e,t,s,i){return new ba({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:s,message:Le.toString(i)}]})}_addCheck(e){return new ba({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:Le.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:Le.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:Le.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:Le.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:Le.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}}ba.create=n=>new ba({checks:[],typeName:Je.ZodBigInt,coerce:n?.coerce??!1,...rt(n)});class Vc extends ct{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==Ie.boolean){const s=this._getOrReturnCtx(e);return Ae(s,{code:me.invalid_type,expected:Ie.boolean,received:s.parsedType}),Qe}return Cs(e.data)}}Vc.create=n=>new Vc({typeName:Je.ZodBoolean,coerce:n?.coerce||!1,...rt(n)});class Bo extends ct{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==Ie.date){const r=this._getOrReturnCtx(e);return Ae(r,{code:me.invalid_type,expected:Ie.date,received:r.parsedType}),Qe}if(Number.isNaN(e.data.getTime())){const r=this._getOrReturnCtx(e);return Ae(r,{code:me.invalid_date}),Qe}const s=new fs;let i;for(const r of this._def.checks)r.kind==="min"?e.data.getTime()<r.value&&(i=this._getOrReturnCtx(e,i),Ae(i,{code:me.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),Ae(i,{code:me.too_big,message:r.message,inclusive:!0,exact:!1,maximum:r.value,type:"date"}),s.dirty()):_t.assertNever(r);return{status:s.value,value:new Date(e.data.getTime())}}_addCheck(e){return new Bo({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:Le.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:Le.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}}Bo.create=n=>new Bo({checks:[],coerce:n?.coerce||!1,typeName:Je.ZodDate,...rt(n)});class _h extends ct{_parse(e){if(this._getType(e)!==Ie.symbol){const s=this._getOrReturnCtx(e);return Ae(s,{code:me.invalid_type,expected:Ie.symbol,received:s.parsedType}),Qe}return Cs(e.data)}}_h.create=n=>new _h({typeName:Je.ZodSymbol,...rt(n)});class Hc extends ct{_parse(e){if(this._getType(e)!==Ie.undefined){const s=this._getOrReturnCtx(e);return Ae(s,{code:me.invalid_type,expected:Ie.undefined,received:s.parsedType}),Qe}return Cs(e.data)}}Hc.create=n=>new Hc({typeName:Je.ZodUndefined,...rt(n)});class qc extends ct{_parse(e){if(this._getType(e)!==Ie.null){const s=this._getOrReturnCtx(e);return Ae(s,{code:me.invalid_type,expected:Ie.null,received:s.parsedType}),Qe}return Cs(e.data)}}qc.create=n=>new qc({typeName:Je.ZodNull,...rt(n)});class zh extends ct{constructor(){super(...arguments),this._any=!0}_parse(e){return Cs(e.data)}}zh.create=n=>new zh({typeName:Je.ZodAny,...rt(n)});class Xc extends ct{constructor(){super(...arguments),this._unknown=!0}_parse(e){return Cs(e.data)}}Xc.create=n=>new Xc({typeName:Je.ZodUnknown,...rt(n)});class si extends ct{_parse(e){const t=this._getOrReturnCtx(e);return Ae(t,{code:me.invalid_type,expected:Ie.never,received:t.parsedType}),Qe}}si.create=n=>new si({typeName:Je.ZodNever,...rt(n)});class wh extends ct{_parse(e){if(this._getType(e)!==Ie.undefined){const s=this._getOrReturnCtx(e);return Ae(s,{code:me.invalid_type,expected:Ie.void,received:s.parsedType}),Qe}return Cs(e.data)}}wh.create=n=>new wh({typeName:Je.ZodVoid,...rt(n)});class sn extends ct{_parse(e){const{ctx:t,status:s}=this._processInputParams(e),i=this._def;if(t.parsedType!==Ie.array)return Ae(t,{code:me.invalid_type,expected:Ie.array,received:t.parsedType}),Qe;if(i.exactLength!==null){const a=t.data.length>i.exactLength.value,o=t.data.length<i.exactLength.value;(a||o)&&(Ae(t,{code:a?me.too_big:me.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&&(Ae(t,{code:me.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&&(Ae(t,{code:me.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 an(t,a,t.path,o)))).then(a=>fs.mergeArray(s,a));const r=[...t.data].map((a,o)=>i.type._parseSync(new an(t,a,t.path,o)));return fs.mergeArray(s,r)}get element(){return this._def.type}min(e,t){return new sn({...this._def,minLength:{value:e,message:Le.toString(t)}})}max(e,t){return new sn({...this._def,maxLength:{value:e,message:Le.toString(t)}})}length(e,t){return new sn({...this._def,exactLength:{value:e,message:Le.toString(t)}})}nonempty(e){return this.min(1,e)}}sn.create=(n,e)=>new sn({type:n,minLength:null,maxLength:null,exactLength:null,typeName:Je.ZodArray,...rt(e)});function br(n){if(n instanceof Ht){const e={};for(const t in n.shape){const s=n.shape[t];e[t]=On.create(br(s))}return new Ht({...n._def,shape:()=>e})}else return n instanceof sn?new sn({...n._def,type:br(n.element)}):n instanceof On?On.create(br(n.unwrap())):n instanceof Ri?Ri.create(br(n.unwrap())):n instanceof Ti?Ti.create(n.items.map(e=>br(e))):n}class Ht extends ct{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=_t.objectKeys(e);return this._cached={shape:e,keys:t},this._cached}_parse(e){if(this._getType(e)!==Ie.object){const c=this._getOrReturnCtx(e);return Ae(c,{code:me.invalid_type,expected:Ie.object,received:c.parsedType}),Qe}const{status:s,ctx:i}=this._processInputParams(e),{shape:r,keys:a}=this._getCached(),o=[];if(!(this._def.catchall instanceof si&&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 an(i,u,i.path,c)),alwaysSet:c in i.data})}if(this._def.catchall instanceof si){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&&(Ae(i,{code:me.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 an(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=>fs.mergeObjectSync(s,c)):fs.mergeObjectSync(s,l)}get shape(){return this._def.shape()}strict(e){return Le.errToObj,new Ht({...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:Le.errToObj(e).message??i}:{message:i}}}:{}})}strip(){return new Ht({...this._def,unknownKeys:"strip"})}passthrough(){return new Ht({...this._def,unknownKeys:"passthrough"})}extend(e){return new Ht({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new Ht({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:Je.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new Ht({...this._def,catchall:e})}pick(e){const t={};for(const s of _t.objectKeys(e))e[s]&&this.shape[s]&&(t[s]=this.shape[s]);return new Ht({...this._def,shape:()=>t})}omit(e){const t={};for(const s of _t.objectKeys(this.shape))e[s]||(t[s]=this.shape[s]);return new Ht({...this._def,shape:()=>t})}deepPartial(){return br(this)}partial(e){const t={};for(const s of _t.objectKeys(this.shape)){const i=this.shape[s];e&&!e[s]?t[s]=i:t[s]=i.optional()}return new Ht({...this._def,shape:()=>t})}required(e){const t={};for(const s of _t.objectKeys(this.shape))if(e&&!e[s])t[s]=this.shape[s];else{let r=this.shape[s];for(;r instanceof On;)r=r._def.innerType;t[s]=r}return new Ht({...this._def,shape:()=>t})}keyof(){return Nm(_t.objectKeys(this.shape))}}Ht.create=(n,e)=>new Ht({shape:()=>n,unknownKeys:"strip",catchall:si.create(),typeName:Je.ZodObject,...rt(e)});Ht.strictCreate=(n,e)=>new Ht({shape:()=>n,unknownKeys:"strict",catchall:si.create(),typeName:Je.ZodObject,...rt(e)});Ht.lazycreate=(n,e)=>new Ht({shape:n,unknownKeys:"strip",catchall:si.create(),typeName:Je.ZodObject,...rt(e)});class Co extends ct{_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 An(o.ctx.common.issues));return Ae(t,{code:me.invalid_union,unionErrors:a}),Qe}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 An(l));return Ae(t,{code:me.invalid_union,unionErrors:o}),Qe}}get options(){return this._def.options}}Co.create=(n,e)=>new Co({options:n,typeName:Je.ZodUnion,...rt(e)});const Mn=n=>n instanceof Wo?Mn(n.schema):n instanceof Gi?Mn(n.innerType()):n instanceof ko?[n.value]:n instanceof Ii?n.options:n instanceof Yc?_t.objectValues(n.enum):n instanceof Fo?Mn(n._def.innerType):n instanceof Hc?[void 0]:n instanceof qc?[null]:n instanceof On?[void 0,...Mn(n.unwrap())]:n instanceof Ri?[null,...Mn(n.unwrap())]:n instanceof Bm||n instanceof $o?Mn(n.unwrap()):n instanceof jo?Mn(n._def.innerType):[];class hu extends ct{_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==Ie.object)return Ae(t,{code:me.invalid_type,expected:Ie.object,received:t.parsedType}),Qe;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}):(Ae(t,{code:me.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[s]}),Qe)}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=Mn(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 hu({typeName:Je.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:i,...rt(s)})}}function Kc(n,e){const t=$n(n),s=$n(e);if(n===e)return{valid:!0,data:n};if(t===Ie.object&&s===Ie.object){const i=_t.objectKeys(e),r=_t.objectKeys(n).filter(o=>i.indexOf(o)!==-1),a={...n,...e};for(const o of r){const l=Kc(n[o],e[o]);if(!l.valid)return{valid:!1};a[o]=l.data}return{valid:!0,data:a}}else if(t===Ie.array&&s===Ie.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=Kc(a,o);if(!l.valid)return{valid:!1};i.push(l.data)}return{valid:!0,data:i}}else return t===Ie.date&&s===Ie.date&&+n==+e?{valid:!0,data:n}:{valid:!1}}class Po extends ct{_parse(e){const{status:t,ctx:s}=this._processInputParams(e),i=(r,a)=>{if(gh(r)||gh(a))return Qe;const o=Kc(r.value,a.value);return o.valid?((Mh(r)||Mh(a))&&t.dirty(),{status:t.value,value:o.data}):(Ae(s,{code:me.invalid_intersection_types}),Qe)};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}))}}Po.create=(n,e,t)=>new Po({left:n,right:e,typeName:Je.ZodIntersection,...rt(t)});class Ti extends ct{_parse(e){const{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==Ie.array)return Ae(s,{code:me.invalid_type,expected:Ie.array,received:s.parsedType}),Qe;if(s.data.length<this._def.items.length)return Ae(s,{code:me.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),Qe;!this._def.rest&&s.data.length>this._def.items.length&&(Ae(s,{code:me.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 an(s,a,s.path,o)):null}).filter(a=>!!a);return s.common.async?Promise.all(r).then(a=>fs.mergeArray(t,a)):fs.mergeArray(t,r)}get items(){return this._def.items}rest(e){return new Ti({...this._def,rest:e})}}Ti.create=(n,e)=>{if(!Array.isArray(n))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Ti({items:n,typeName:Je.ZodTuple,rest:null,...rt(e)})};class Lo extends ct{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!==Ie.object)return Ae(s,{code:me.invalid_type,expected:Ie.object,received:s.parsedType}),Qe;const i=[],r=this._def.keyType,a=this._def.valueType;for(const o in s.data)i.push({key:r._parse(new an(s,o,s.path,o)),value:a._parse(new an(s,s.data[o],s.path,o)),alwaysSet:o in s.data});return s.common.async?fs.mergeObjectAsync(t,i):fs.mergeObjectSync(t,i)}get element(){return this._def.valueType}static create(e,t,s){return t instanceof ct?new Lo({keyType:e,valueType:t,typeName:Je.ZodRecord,...rt(s)}):new Lo({keyType:wn.create(),valueType:e,typeName:Je.ZodRecord,...rt(t)})}}class yh extends ct{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!==Ie.map)return Ae(s,{code:me.invalid_type,expected:Ie.map,received:s.parsedType}),Qe;const i=this._def.keyType,r=this._def.valueType,a=[...s.data.entries()].map(([o,l],c)=>({key:i._parse(new an(s,o,s.path,[c,"key"])),value:r._parse(new an(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 Qe;(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 Qe;(c.status==="dirty"||d.status==="dirty")&&t.dirty(),o.set(c.value,d.value)}return{status:t.value,value:o}}}}yh.create=(n,e,t)=>new yh({valueType:e,keyType:n,typeName:Je.ZodMap,...rt(t)});class _a extends ct{_parse(e){const{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==Ie.set)return Ae(s,{code:me.invalid_type,expected:Ie.set,received:s.parsedType}),Qe;const i=this._def;i.minSize!==null&&s.data.size<i.minSize.value&&(Ae(s,{code:me.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&&(Ae(s,{code:me.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 Qe;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 an(s,l,s.path,c)));return s.common.async?Promise.all(o).then(l=>a(l)):a(o)}min(e,t){return new _a({...this._def,minSize:{value:e,message:Le.toString(t)}})}max(e,t){return new _a({...this._def,maxSize:{value:e,message:Le.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}_a.create=(n,e)=>new _a({valueType:n,minSize:null,maxSize:null,typeName:Je.ZodSet,...rt(e)});class Wo extends ct{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})}}Wo.create=(n,e)=>new Wo({getter:n,typeName:Je.ZodLazy,...rt(e)});class ko extends ct{_parse(e){if(e.data!==this._def.value){const t=this._getOrReturnCtx(e);return Ae(t,{received:t.data,code:me.invalid_literal,expected:this._def.value}),Qe}return{status:"valid",value:e.data}}get value(){return this._def.value}}ko.create=(n,e)=>new ko({value:n,typeName:Je.ZodLiteral,...rt(e)});function Nm(n,e){return new Ii({values:n,typeName:Je.ZodEnum,...rt(e)})}class Ii extends ct{_parse(e){if(typeof e.data!="string"){const t=this._getOrReturnCtx(e),s=this._def.values;return Ae(t,{expected:_t.joinValues(s),received:t.parsedType,code:me.invalid_type}),Qe}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 Ae(t,{received:t.data,code:me.invalid_enum_value,options:s}),Qe}return Cs(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 Ii.create(e,{...this._def,...t})}exclude(e,t=this._def){return Ii.create(this.options.filter(s=>!e.includes(s)),{...this._def,...t})}}Ii.create=Nm;class Yc extends ct{_parse(e){const t=_t.getValidEnumValues(this._def.values),s=this._getOrReturnCtx(e);if(s.parsedType!==Ie.string&&s.parsedType!==Ie.number){const i=_t.objectValues(t);return Ae(s,{expected:_t.joinValues(i),received:s.parsedType,code:me.invalid_type}),Qe}if(this._cache||(this._cache=new Set(_t.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){const i=_t.objectValues(t);return Ae(s,{received:s.data,code:me.invalid_enum_value,options:i}),Qe}return Cs(e.data)}get enum(){return this._def.values}}Yc.create=(n,e)=>new Yc({values:n,typeName:Je.ZodNativeEnum,...rt(e)});class Uo extends ct{unwrap(){return this._def.type}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==Ie.promise&&t.common.async===!1)return Ae(t,{code:me.invalid_type,expected:Ie.promise,received:t.parsedType}),Qe;const s=t.parsedType===Ie.promise?t.data:Promise.resolve(t.data);return Cs(s.then(i=>this._def.type.parseAsync(i,{path:t.path,errorMap:t.common.contextualErrorMap})))}}Uo.create=(n,e)=>new Uo({type:n,typeName:Je.ZodPromise,...rt(e)});class Gi extends ct{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Je.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=>{Ae(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 Qe;const l=await this._def.schema._parseAsync({data:o,path:s.path,parent:s});return l.status==="aborted"?Qe:l.status==="dirty"||t.value==="dirty"?la(l.value):l});{if(t.value==="aborted")return Qe;const o=this._def.schema._parseSync({data:a,path:s.path,parent:s});return o.status==="aborted"?Qe:o.status==="dirty"||t.value==="dirty"?la(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"?Qe:(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"?Qe:(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(!Sr(a))return Qe;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=>Sr(a)?Promise.resolve(i.transform(a.value,r)).then(o=>({status:t.value,value:o})):Qe);_t.assertNever(i)}}Gi.create=(n,e,t)=>new Gi({schema:n,typeName:Je.ZodEffects,effect:e,...rt(t)});Gi.createWithPreprocess=(n,e,t)=>new Gi({schema:e,effect:{type:"preprocess",transform:n},typeName:Je.ZodEffects,...rt(t)});class On extends ct{_parse(e){return this._getType(e)===Ie.undefined?Cs(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}On.create=(n,e)=>new On({innerType:n,typeName:Je.ZodOptional,...rt(e)});class Ri extends ct{_parse(e){return this._getType(e)===Ie.null?Cs(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}Ri.create=(n,e)=>new Ri({innerType:n,typeName:Je.ZodNullable,...rt(e)});class Fo extends ct{_parse(e){const{ctx:t}=this._processInputParams(e);let s=t.data;return t.parsedType===Ie.undefined&&(s=this._def.defaultValue()),this._def.innerType._parse({data:s,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}Fo.create=(n,e)=>new Fo({innerType:n,typeName:Je.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...rt(e)});class jo extends ct{_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 No(i)?i.then(r=>({status:"valid",value:r.status==="valid"?r.value:this._def.catchValue({get error(){return new An(s.common.issues)},input:s.data})})):{status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new An(s.common.issues)},input:s.data})}}removeCatch(){return this._def.innerType}}jo.create=(n,e)=>new jo({innerType:n,typeName:Je.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...rt(e)});class vh extends ct{_parse(e){if(this._getType(e)!==Ie.nan){const s=this._getOrReturnCtx(e);return Ae(s,{code:me.invalid_type,expected:Ie.nan,received:s.parsedType}),Qe}return{status:"valid",value:e.data}}}vh.create=n=>new vh({typeName:Je.ZodNaN,...rt(n)});class Bm extends ct{_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 fu extends ct{_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"?Qe:r.status==="dirty"?(t.dirty(),la(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"?Qe: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 fu({in:e,out:t,typeName:Je.ZodPipeline})}}class $o extends ct{_parse(e){const t=this._def.innerType._parse(e),s=i=>(Sr(i)&&(i.value=Object.freeze(i.value)),i);return No(t)?t.then(i=>s(i)):s(t)}unwrap(){return this._def.innerType}}$o.create=(n,e)=>new $o({innerType:n,typeName:Je.ZodReadonly,...rt(e)});var Je;(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"})(Je||(Je={}));const k=wn.create,le=Er.create,Nt=Vc.create,pu=Xc.create;si.create;const it=sn.create,fe=Ht.create;Co.create;const Cm=hu.create;Po.create;const Pm=Ti.create,Lm=Lo.create,Kb=Wo.create,dt=ko.create,Ut=Ii.create;Uo.create;On.create;Ri.create;const Yb=Ut(["ok","error"]),Zb=fe({type:Ut(["error","warning"]),message:k()}),Qb=fe({kind:k(),data:pu()}),Jb=fe({input:k(),proposed:k(),validated:Nt(),executed:k().optional()}),Wm=fe({status:Yb,rendered:k(),renderedErr:k().optional(),model:Qb.optional(),errors:it(Zb).optional(),trace:Jb.optional()}),e_=Ut(["data","err","status"]),t_=fe({shellCommands:Nt(),hiddenInput:Nt().optional(),color:Nt().optional(),fileDelivery:Nt().optional(),localFilesystem:Nt().optional()}),s_=fe({type:dt("attach"),protocolVersion:le().int(),token:k(),session:k().optional(),capabilities:t_.optional()}),n_=fe({type:dt("execute"),id:k(),line:k(),instrument:Nt().optional()}),i_=fe({type:dt("cancel"),id:k()}),r_=fe({type:dt("complete"),id:k(),prefix:k()}),a_=fe({type:dt("promptAnswer"),promptId:k(),answer:k()}),o_=fe({type:dt("promptError"),promptId:k(),reason:k()}),l_=fe({type:dt("pipeResult"),pipeId:k(),output:k()}),c_=fe({type:dt("pipeError"),pipeId:k(),reason:k()}),d_=fe({type:dt("shellResult"),shellId:k(),exitCode:le().int()}),u_=fe({type:dt("shellError"),shellId:k(),reason:k()}),h_=fe({type:dt("editResult"),editId:k(),content:k(),changed:Nt(),opened:Nt().optional()}),f_=fe({type:dt("editError"),editId:k(),reason:k()}),p_=fe({type:dt("deliverResult"),deliverId:k(),location:k(),bytes:le().nonnegative()}),m_=fe({type:dt("deliverError"),deliverId:k(),reason:k()}),g_=fe({address:k(),modelKind:k().optional(),groupId:k(),paneId:k()}),km=fe({type:dt("regard"),regard:g_}),M_=fe({type:dt("watch"),subject:k()}),b_=fe({type:dt("unwatch"),subject:k()}),__=["live","settled","stale"],z_=Ut(__),w_=fe({type:dt("stale"),stale:Nt()}),y_=["restart","end","stop"],v_=fe({type:dt("closing"),cause:Ut(y_)}),O_=fe({type:dt("watched"),subject:k(),state:z_}),x_=fe({type:dt("numbered"),id:le(),source:k(),rows:le(),handles:it(fe({kind:k(),ordinal:le(),address:k()}))});Cm("type",[s_,n_,i_,r_,a_,o_,l_,c_,d_,u_,h_,f_,p_,m_,km,M_,b_]);const S_=fe({type:dt("attached"),session:k(),surface:k().optional(),protocolVersion:le().int(),stack:fe({chell:k(),calypso:k(),build:k(),surface:fe({git:k(),built:k()}).optional(),brasa:k().optional(),chili:k().optional(),salsa:k().optional(),cumin:k().optional()}).optional(),hostControl:it(k()).optional(),stale:Nt().optional()}),E_=fe({type:dt("result"),id:k(),envelopes:it(Wm)}),A_=fe({type:dt("complete"),id:k(),prefix:k(),candidates:it(k())}),D_=fe({type:dt("output"),id:k(),channel:e_,chunk:k()}),T_=Ut(gb).catch("task"),I_=Ut(Mb).catch(void 0),G_=Ut(bb).catch("working"),R_=Ut(_b).catch(void 0),N_=Ut(zb).catch("unknown"),B_=fe({type:dt("progress"),id:k(),operation:T_,kind:I_.optional(),phase:G_,label:k().optional(),itemId:k().optional(),current:le().nonnegative().optional(),total:le().nonnegative().optional(),percent:le().min(0).max(100).optional(),unit:R_.optional(),status:N_.optional(),path:k().optional(),reason:k().optional()}),C_=fe({type:dt("session"),surface:k(),envelope:Wm}),P_=fe({type:dt("error"),id:k().optional(),reason:k()}),L_=["text","secret","confirm","path"],W_=Ut(L_).catch("text"),k_=fe({anchor:k().optional(),wantsDirectory:Nt(),suggest:k().optional()}),U_=fe({type:dt("prompt"),promptId:k(),message:k(),hidden:Nt(),wants:W_.optional(),path:k_.optional(),commit:k().optional()});function F_(n){return n.wants!==void 0?n.wants:n.hidden===!0?"secret":"text"}const j_=fe({user:k(),uri:k(),cwd:k(),pacsserver:k().nullable(),physicalMode:Nt(),lastExitCode:le(),lastCommandDurationMs:le(),procWarmup:fe({loaded:le(),total:le().optional(),restored:Nt().optional(),state:Ut(pb).optional(),sweeping:Nt().optional(),feed:fe({id:le(),loaded:le(),total:le(),failed:k().optional()}).optional(),feeds:it(fe({id:le(),loaded:le(),total:le(),failed:k().optional()})).optional(),arrived:it(le()).optional(),landed:it(fe({id:le(),title:k().default(""),jobs:le(),status:k(),chain:it(k()),groups:it(fe({plugin:k(),count:le(),errored:le().default(0),status:k(),parent:le().nullable()})).default([])})).optional(),roster:Ut(["delta","full"]).optional()}).optional(),procIndex:fe({jobs:le(),feeds:le()}).optional(),warmupFailures:it(fe({label:k(),message:k()})).optional()}),$_=fe({type:dt("promptline"),context:j_}),V_=fe({type:dt("pipe"),pipeId:k(),command:k(),input:k()}),H_=fe({type:dt("shell"),shellId:k(),command:k()}),q_=fe({type:dt("edit"),editId:k(),content:k(),extension:k().optional(),path:k().optional()}),X_=fe({type:dt("deliver"),deliverId:k(),path:k(),filename:k(),destination:k().optional(),size:le().nonnegative().optional(),contentType:k().optional()}),K_=fe({type:dt("telemetry"),index:fe({jobs:le(),feeds:le()}),lane:fe({running:fe({line:k(),sinceMs:le(),surface:k()}).nullable(),waiting:le()}).optional(),surfaces:it(fe({id:k(),kind:Ut(["chell","browser"])})).optional(),cube:fe({msPerPage:le(),samples:le()}).optional(),state:fe({running:le(),runningFeeds:le(),scheduled:le(),errored:le(),erroredFeeds:le()}).optional()}),Um=Cm("type",[S_,E_,A_,D_,B_,C_,P_,U_,$_,K_,V_,H_,q_,X_,km,O_,w_,v_,x_]);new Set(Um.options.map(n=>n.shape.type.value));function Y_(n){return n.issues.map(e=>{const t=e.path.join(".");return t?`${t}: ${e.message}`:e.message}).join("; ")}function Z_(n,e){const t=n.safeParse(e);return t.success?{ok:!0,value:t.data}:{ok:!1,error:Y_(t.error)}}function Q_(n){return Z_(Um,n)}const Fm=fe({id:k(),label:k(),parentIds:it(k()),joinParentIds:it(k())}),J_=fe({name:k(),value:pu()}),e0=Fm.extend({pluginName:k(),pluginVersion:k().optional(),arguments:it(J_).optional()}),mu=fe({name:k(),pipelineId:le().optional(),nodes:it(e0)}),t0=["created","waiting","scheduled","started","registeringFiles","finishedSuccessfully","finishedWithError","cancelled","unknown"],jm=Ut(t0).catch("unknown"),s0=fe({count:le(),done:le(),error:le(),running:le(),other:le(),anomalies:it(fe({id:k(),status:jm})).optional()}),n0=fe({computeSeconds:le().optional(),dataBytes:le().optional()}),i0=Fm.extend({instanceId:le(),pluginName:k(),pluginVersion:k().optional(),status:jm,vfsPath:k(),metrics:n0.optional(),tally:s0.optional(),computeResource:k().optional()}),Zc=fe({feedId:le(),feedName:k(),nodes:it(i0)}),r0=fe({feedId:le(),loaded:le(),total:le(),failed:k().optional()}),Kn={pipelineDiagram:"pipeline.diagram",feedDag:"feed.dag",feedIndexing:"feed.indexing"},a0=fe({id:le(),title:k(),owner:k(),status:k(),createdAt:k(),sizeBytes:le().optional(),wallSeconds:le().optional(),jobsDone:le().optional(),jobsTotal:le().optional(),jobsErrored:le().optional(),tags:it(k()).optional()}),$m=fe({feeds:it(a0)}),Vm="feed.list",o0=fe({plugin:k(),count:le(),errored:le().default(0),status:k(),parent:le().nullable()}),l0=fe({format:Ut(["dicom","nifti","mgz","jpeg","png","other","unknown"]),modality:k().optional(),seriesDescription:k().optional(),reason:k().optional(),sourceFeed:le().optional()}),c0=fe({id:le(),title:k().default(""),jobs:le(),status:k(),chain:it(k()),groups:it(o0).default([]),createdAt:k().default(""),data:l0.optional()}),d0=fe({feeds:it(c0),whole:Nt()}),u0="proc.universe",h0=fe({name:k(),positions:Lm(k(),Pm([le(),le(),le()])).nullable(),writtenAt:k().nullable(),laying:fe({nodes:le(),fraction:le()}).nullable().optional()}),f0="proc.layout",p0=fe({name:k(),type:k(),optional:Nt(),default:pu().optional(),help:k().optional(),flag:k()}),m0=fe({id:le().optional(),name:k(),version:k(),type:k(),title:k().optional(),description:k().optional(),authors:k().optional(),documentation:k().optional(),category:k().optional(),parameters:it(p0),command:k().optional()}),g0="plugin.info",M0=fe({seriesUID:k(),description:k(),modality:k(),fileCount:le().optional(),vfsPath:k().optional(),pulled:Nt().optional(),pulledFiles:le().optional(),folderPath:k().optional()}),b0=fe({studyUID:k().optional(),server:k().optional(),vfsPath:k().optional(),description:k(),patientName:k(),patientId:k(),date:k(),modalities:k(),accession:k(),series:it(M0)}),Hm=fe({replayed:Nt(),answeredAt:k()}),_0=["found","none","unasked"],z0=Ut(_0).catch("unasked"),w0=fe({patientId:k(),server:k().optional(),patientName:k().optional(),status:z0,studyCount:le(),seriesCount:le(),queryId:le().optional(),provenance:Hm.optional(),error:k().optional()}),y0=fe({queryId:le(),vfsPath:k(),pacsName:k(),expression:k(),studies:it(b0),provenance:Hm.optional(),patients:it(w0).optional()}),v0=fe({id:le(),identifier:k(),active:Nt()}),O0=fe({servers:it(v0)}),x0="pacs.servers",S0="pacs.query";function E0(n){return`pacs:patient:${n.server??"-"}:${n.patientId}`}const A0=["patient","study","series","image","equipment","meta","private","other"],qm=Ut(A0).catch("other"),Xm=Kb(()=>fe({tag:k(),name:k(),vr:k(),value:k(),group:qm,phi:Nt(),decoded:k().optional(),items:it(it(Xm)).optional()})),D0=fe({tag:k(),name:k(),vr:k(),group:qm,phi:Nt(),distinct:le(),first:k(),last:k(),values:it(fe({path:k(),value:k().nullable()}))}),Oh=fe({path:k(),subject:Ut(["file","folder"]),read:le(),of:le(),refused:it(k()),constant:it(Xm),varying:it(D0)}),T0=fe({rows:le(),columns:le(),pixelSpacing:Pm([le(),le()]).optional(),sliceThickness:le().optional(),spacingBetweenSlices:le().optional()}),xh=fe({path:k(),seriesInstanceUID:k().optional(),studyInstanceUID:k().optional(),modality:k(),seriesDescription:k(),seriesNumber:le().optional(),instances:le(),frames:le(),order:Ut(["filename","unknown"]),geometry:T0.optional(),transferSyntax:fe({uid:k(),name:k().optional()}).optional(),bytes:le(),header:k(),files:it(k()),annotations:it(k())}),Da={tags:"dicom.tags",series:"dicom.series"},I0=fe({path:k(),target:Ut(["series","volume"]),force:Nt().optional(),startAt:le().int().positive().optional()}),G0={view:"image.view"},R0=fe({state:Ut(["cold","warming","current"]),loaded:le(),total:le()});fe({user:k(),surface:k(),feeds:fe({total:le(),own:le(),shared:le(),public:le()}),jobs:fe({total:le(),finished:le(),errored:le(),cancelled:le(),running:le(),scheduled:le()}),failureRate:le().nullable(),index:R0,fortune:k()});const N0="session.notes",B0=fe({package:k(),headline:k(),body:k(),internal:Nt()}),C0=fe({package:k(),version:k(),bump:Ut(["major","minor","patch"]),changes:it(B0)}),P0=fe({date:k().nullable(),merge:k().nullable(),entries:it(C0)}),L0=fe({source:dt("daemon"),installed:Lm(k(),k()),releases:it(P0),total:le(),all:Nt()});function as(n){return n.groups.map(e=>`${e.parent??"r"}:${e.plugin}`).join(">")}function Yn(n,e){return`feed:${n}:${e}`}function Km(n){return`shape:${n}`}function za(n){return Math.log2(Math.max(1,n)+1)}function gu(n){if(!(n.errored<=0||n.count<=0))return Math.min(1,n.errored/n.count)}function fl(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=as(a);r.set(o,(r.get(o)??0)+1)}for(const a of i){if(a.groups.length===0)continue;const o=as(a),l=Km(o);s.has(o)||(s.add(o),t.push({id:l,label:pl(o),parentIds:[],joinParentIds:[],ghost:!0,halo:!0,metric:1,count:r.get(o)??1})),a.groups.forEach((c,d)=>{const u=gu(c);t.push({id:Yn(a.id,d),label:c.plugin,parentIds:[c.parent===null?l:Yn(a.id,c.parent)],joinParentIds:[],status:c.status,metric:e==="jobs"?za(c.count):1,...c.count>1?{count:c.count}:{},...u!==void 0?{share:u}:{}})})}return{nodes:t}}const Qc="plugin:";function W0(n){return`${Qc}${n}`}function Jc(n){return n.startsWith(Qc)?n.slice(Qc.length):null}function Mu(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=gu(a);t.push({id:Yn(r.id,o),label:a.plugin,parentIds:a.parent===null?[]:[Yn(r.id,a.parent)],joinParentIds:[],status:a.status,metric:e==="jobs"?za(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:W0(r),label:r,parentIds:[],joinParentIds:[],metric:1+Math.log(a),hue:"#e8f4ff",ring:!0,attrs:{kind:"star",plugin:r}});return{nodes:t}}function Sh(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:Mu(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 pl(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 k0=.5,U0=5,F0=.02,ed="data:",j0={dicom:"DICOM",nifti:"NIfTI",mgz:"MGZ",jpeg:"JPEG",png:"PNG",other:"OTHER",unknown:"UNREADABLE",unread:"NOT YET READ"};function $0(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 V0(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 Ym(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=$0(r),o=a.length===0?void 0:s.find(l=>V0(l.words,a)>=k0);if(o!==void 0){i.set(r,o.name);continue}s.push({name:r,words:a}),i.set(r,r)}return i}function Zm(n,e){const t=n.data?.format??"unread",s=[{key:t,label:j0[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 Nl(n){return`${ed}${n}`}function td(n){return n.startsWith(ed)?n.slice(ed.length):null}function Eh(n,e="jobs"){const t=[...n].filter(d=>d.groups.length>0).sort((d,u)=>d.id-u.id),s=Ym(t.map(d=>d.data?.seriesDescription).filter(d=>d!==void 0)),i=new Map,r=[];for(const d of t){const u=Zm(d,s);let h=null;for(const f of u){const M=i.get(f.key);M===void 0?i.set(f.key,{label:f.label,feeds:1,parent:h}):M.feeds+=1,h=f.key}const p=Nl(h);d.groups.forEach((f,M)=>{const g=gu(f);r.push({id:Yn(d.id,M),label:f.plugin,parentIds:[f.parent===null?p:Yn(d.id,f.parent)],joinParentIds:[],status:f.status,metric:e==="jobs"?za(f.count):1,...f.count>1?{count:f.count}:{},...g!==void 0?{share:g}:{}})})}const a=new Map;for(const d of t){const u=d.groups.findIndex(h=>h.parent===null);u>=0&&a.set(d.id,Yn(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),p=a.get(d.id);if(h===void 0||p===void 0)continue;const f=o.get(p);f!==void 0&&(f.joinParentIds=[...f.joinParentIds,h],f.joinFaint=!0)}const l=(d,u)=>d.split("/").length<3||u>=Math.max(U0,F0*t.length);return{graph:{nodes:[...[...i].map(([d,u])=>({id:Nl(d),label:u.label,parentIds:u.parent===null?[]:[Nl(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 H0(n,e){const t=td(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 sd=12,q0=240;function X0(n){return n<=q0?sd:void 0}function nd(n,e){return`fold:${n}:${e}`}function Qm(n){const e=n.match(/^fold:(.+):\d+$/);return e===null?null:e[1]}function K0(n){const e=n.match(/^feed:(\d+):/);if(e!==null)return`feed:${e[1]}`;const t=Qm(n);return t===null?null:`fold:${t}`}const Y0=fe({at:le(),method:k(),family:k(),path:k(),status:le(),ms:le()}),Z0=fe({family:k(),count:le(),ms:le()});fe({since:k(),total:le(),ms:le(),families:it(Z0),last:it(Y0)});const Jm=24,id="argus.dormant";class Q0{constructor(e=Jm,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(id,JSON.stringify([...this.groups.values()]))}catch{}}rehydrate(){if(this.store!==void 0)try{const e=this.store.getItem(id);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 Ah(){try{const n=globalThis.localStorage;return n===void 0?void 0:(n.getItem(id),n)}catch{return}}class J0{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 ez(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 ez(n){return[...new Set(n)]}const tz="G1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MTsxbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MTsxbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtChtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzE7MW0gG1swbRtbMzg7MjswO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s0N20uG1swbRtbMzg7Mjs5OzE2OzE5bSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MTsxbSAbWzBtG1szODsyOzA7MTsxbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtChtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzI7M20gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjsyOzU7OG0gG1swbRtbMzg7MjszNzs3NjsxMTVtOhtbMG0bWzM4OzI7Mjg7NTg7ODhtOhtbMG0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zBtIBtbMG0KG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MTsxbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzE7MjszbSAbWzBtG1szODsyOzE7MjszbSAbWzBtG1szODsyOzE7MjszbSAbWzBtG1szODsyOzE7MjszbSAbWzBtG1szODsyOzE7MjsybSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtChtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzE7MW0gG1swbRtbMzg7MjsxOzI7M20gG1swbRtbMzg7MjsxOzI7M20gG1swbRtbMzg7MjsxOzI7M20gG1swbRtbMzg7MjswOzE7Mm0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtb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zI7MDswOzBtIBtbMG0bWzM4OzI7MDswOzBtIBtbMG0bWzM4OzI7MDswOzBtIBtbMG0bWzM4OzI7MDswOzBtIBtbMG0bWzM4OzI7MDswOzBtIBtbMG0bWzM4OzI7MDswOzBtIBtbMG0bWzM4OzI7MDswOzBtIBtbMG0bWzM4OzI7MDswOzBtIBtbMG0KG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtCg==",sz=/\x1b\[[0-9;]*m/g,Dh="\x1B[0m",Th="\x1B[7m",eg=atob(tz).trimEnd().split(`
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./cornerstoneEngine-BJeodQK9.js","./refusal-DOpm8I8L.js","./_commonjsHelpers-CE1G-McA.js","./niivueEngine-BuUczFAb.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 cb=450,ph=12;function Hi(n,e,t=Date.now()){const s=Number(n.dataset.edgeAt??0);return n.dataset.edge===e&&t-s<cb?!1:(delete n.dataset.edge,n.offsetWidth,n.dataset.edge=e,n.dataset.edgeAt=String(t),!0)}function db(n,e){return e?"▲ TOP":`▼ ${n} MORE`}function ub(n,e){const t=n.getBoundingClientRect().bottom;let s=0;for(const i of n.querySelectorAll(e)){const r=i.getBoundingClientRect();r.height>0&&r.top>=t-2&&(s+=1)}return s}function hb(n){const e=parseFloat(getComputedStyle(n).lineHeight)||16;return Math.max(0,Math.ceil((n.scrollHeight-n.scrollTop-n.clientHeight)/e))}function Hs(n,e={}){n.dataset.more="wired",n.classList.add("holds-more");const t=document.createElement("button");t.type="button",t.className=`more-chip${e.className!==void 0?` ${e.className}`:""}`,t.hidden=!0;const s=e.label??db,i=()=>n.scrollTop+n.clientHeight>=n.scrollHeight-2;t.addEventListener("click",l=>{if(l.stopPropagation(),e.press!==void 0){e.press();return}n.scrollBy({top:i()?-n.scrollHeight:Math.max(1,n.clientHeight-t.offsetHeight),behavior:"smooth"})});const r=e.mount??n;r.appendChild(t);let a=!1;const o=()=>{if(!a){a=!0;try{r===n&&n.lastElementChild!==t&&n.appendChild(t);const l=(e.scrolls?.()??!0)&&n.scrollHeight>n.clientHeight+2;if(t.hidden!==!l&&(t.hidden=!l),!l)return;const c=e.rows!==void 0?ub(n,e.rows):hb(n),d=s(c,i());t.textContent!==d&&(t.textContent=d)}finally{a=!1}}};return n.addEventListener("scroll",o,{passive:!0}),fb(n,i),typeof ResizeObserver<"u"&&new ResizeObserver(o).observe(n),new MutationObserver(o).observe(n,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["hidden","class","style"]}),o(),t}function fb(n,e){const t=()=>n.scrollHeight>n.clientHeight+2,s=()=>n.scrollTop<=0;let i=n.scrollTop;n.addEventListener("scrollend",()=>{const a=n.scrollTop!==i;i=n.scrollTop,!(!a||!t())&&(s()?Hi(n,"top"):e()&&Hi(n,"bottom"))}),n.addEventListener("wheel",a=>{!t()||a.deltaY===0||(a.deltaY<0&&s()?Hi(n,"top"):a.deltaY>0&&e()&&Hi(n,"bottom"))},{passive:!0});let r=null;n.addEventListener("touchstart",a=>{r=a.touches[0]?.clientY??null},{passive:!0}),n.addEventListener("touchmove",a=>{const o=a.touches[0]?.clientY;r===null||o===void 0||!t()||(o-r>ph&&s()?(Hi(n,"top"),r=null):r-o>ph&&e()&&(Hi(n,"bottom"),r=null))},{passive:!0}),n.addEventListener("animationend",a=>{a.target===n&&a.animationName.startsWith("edge-flare")&&delete n.dataset.edge})}const pb=["cold","cached","failed"];function mb(n){return n.state??(n.restored===!0?"cached":"cold")}const gb=["upload","download","pull","workflow","pipeline","group","task"],Mb=["transfer","retrieve","workflow","inspection"],bb=["scanning","transferring","watching","retrying","reading","working","complete","failed"],_b=["files","bytes","series","jobs","nodes"],zb=["running","done","unconfirmed","stalled","timeout","error","unknown"],jc=1;var _t;(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})(_t||(_t={}));var mh;(function(n){n.mergeShapes=(e,t)=>({...e,...t})})(mh||(mh={}));const Ie=_t.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),$n=n=>{switch(typeof n){case"undefined":return Ie.undefined;case"string":return Ie.string;case"number":return Number.isNaN(n)?Ie.nan:Ie.number;case"boolean":return Ie.boolean;case"function":return Ie.function;case"bigint":return Ie.bigint;case"symbol":return Ie.symbol;case"object":return Array.isArray(n)?Ie.array:n===null?Ie.null:n.then&&typeof n.then=="function"&&n.catch&&typeof n.catch=="function"?Ie.promise:typeof Map<"u"&&n instanceof Map?Ie.map:typeof Set<"u"&&n instanceof Set?Ie.set:typeof Date<"u"&&n instanceof Date?Ie.date:Ie.object;default:return Ie.unknown}},me=_t.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 An 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 An))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,_t.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()}}An.create=n=>new An(n);const $c=(n,e)=>{let t;switch(n.code){case me.invalid_type:n.received===Ie.undefined?t="Required":t=`Expected ${n.expected}, received ${n.received}`;break;case me.invalid_literal:t=`Invalid literal value, expected ${JSON.stringify(n.expected,_t.jsonStringifyReplacer)}`;break;case me.unrecognized_keys:t=`Unrecognized key(s) in object: ${_t.joinValues(n.keys,", ")}`;break;case me.invalid_union:t="Invalid input";break;case me.invalid_union_discriminator:t=`Invalid discriminator value. Expected ${_t.joinValues(n.options)}`;break;case me.invalid_enum_value:t=`Invalid enum value. Expected ${_t.joinValues(n.options)}, received '${n.received}'`;break;case me.invalid_arguments:t="Invalid function arguments";break;case me.invalid_return_type:t="Invalid function return type";break;case me.invalid_date:t="Invalid date";break;case me.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}"`:_t.assertNever(n.validation):n.validation!=="regex"?t=`Invalid ${n.validation}`:t="Invalid";break;case me.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 me.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 me.custom:t="Invalid input";break;case me.invalid_intersection_types:t="Intersection results could not be merged";break;case me.not_multiple_of:t=`Number must be a multiple of ${n.multipleOf}`;break;case me.not_finite:t="Number must be finite";break;default:t=e.defaultError,_t.assertNever(n)}return{message:t}};let wb=$c;function yb(){return wb}const vb=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 Ae(n,e){const t=yb(),s=vb({issueData:e,data:n.data,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,t,t===$c?void 0:$c].filter(i=>!!i)});n.common.issues.push(s)}class fs{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 Qe;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 fs.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 Qe;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 Qe=Object.freeze({status:"aborted"}),la=n=>({status:"dirty",value:n}),Cs=n=>({status:"valid",value:n}),gh=n=>n.status==="aborted",Mh=n=>n.status==="dirty",Sr=n=>n.status==="valid",No=n=>typeof Promise<"u"&&n instanceof Promise;var Le;(function(n){n.errToObj=e=>typeof e=="string"?{message:e}:e||{},n.toString=e=>typeof e=="string"?e:e?.message})(Le||(Le={}));class an{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 bh=(n,e)=>{if(Sr(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 An(n.common.issues);return this._error=t,this._error}}};function rt(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 ct{get description(){return this._def.description}_getType(e){return $n(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:$n(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new fs,ctx:{common:e.parent.common,data:e.data,parsedType:$n(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if(No(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:$n(e)},i=this._parseSync({data:e,path:s.path,parent:s});return bh(s,i)}"~validate"(e){const t={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:$n(e)};if(!this["~standard"].async)try{const s=this._parseSync({data:e,path:[],parent:t});return Sr(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=>Sr(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:$n(e)},i=this._parse({data:e,path:s.path,parent:s}),r=await(No(i)?i:Promise.resolve(i));return bh(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:me.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 Gi({schema:this,typeName:Je.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 On.create(this,this._def)}nullable(){return Ri.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return sn.create(this)}promise(){return Uo.create(this,this._def)}or(e){return Co.create([this,e],this._def)}and(e){return Po.create(this,e,this._def)}transform(e){return new Gi({...rt(this._def),schema:this,typeName:Je.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t=typeof e=="function"?e:()=>e;return new Fo({...rt(this._def),innerType:this,defaultValue:t,typeName:Je.ZodDefault})}brand(){return new Nm({typeName:Je.ZodBranded,type:this,...rt(this._def)})}catch(e){const t=typeof e=="function"?e:()=>e;return new jo({...rt(this._def),innerType:this,catchValue:t,typeName:Je.ZodCatch})}describe(e){const t=this.constructor;return new t({...this._def,description:e})}pipe(e){return fu.create(this,e)}readonly(){return $o.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const Ob=/^c[^\s-]{8,}$/i,xb=/^[0-9a-z]+$/,Sb=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Eb=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,Ab=/^[a-z0-9_-]{21}$/i,Db=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,Tb=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,Ib=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Gb="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let Rl;const Rb=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Nb=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,Bb=/^(([0-9a-fA-F]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}){0,1}:){0,1}((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])|([0-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])$/,Pb=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Lb=/^([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])))",Wb=new RegExp(`^${Im}$`);function Gm(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 kb(n){return new RegExp(`^${Gm(n)}$`)}function Ub(n){let e=`${Im}T${Gm(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 Fb(n,e){return!!((e==="v4"||!e)&&Rb.test(n)||(e==="v6"||!e)&&Bb.test(n))}function jb(n,e){if(!Db.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 $b(n,e){return!!((e==="v4"||!e)&&Nb.test(n)||(e==="v6"||!e)&&Cb.test(n))}class wn extends ct{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==Ie.string){const r=this._getOrReturnCtx(e);return Ae(r,{code:me.invalid_type,expected:Ie.string,received:r.parsedType}),Qe}const s=new fs;let i;for(const r of this._def.checks)if(r.kind==="min")e.data.length<r.value&&(i=this._getOrReturnCtx(e,i),Ae(i,{code:me.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),Ae(i,{code:me.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?Ae(i,{code:me.too_big,maximum:r.value,type:"string",inclusive:!0,exact:!0,message:r.message}):o&&Ae(i,{code:me.too_small,minimum:r.value,type:"string",inclusive:!0,exact:!0,message:r.message}),s.dirty())}else if(r.kind==="email")Ib.test(e.data)||(i=this._getOrReturnCtx(e,i),Ae(i,{validation:"email",code:me.invalid_string,message:r.message}),s.dirty());else if(r.kind==="emoji")Rl||(Rl=new RegExp(Gb,"u")),Rl.test(e.data)||(i=this._getOrReturnCtx(e,i),Ae(i,{validation:"emoji",code:me.invalid_string,message:r.message}),s.dirty());else if(r.kind==="uuid")Eb.test(e.data)||(i=this._getOrReturnCtx(e,i),Ae(i,{validation:"uuid",code:me.invalid_string,message:r.message}),s.dirty());else if(r.kind==="nanoid")Ab.test(e.data)||(i=this._getOrReturnCtx(e,i),Ae(i,{validation:"nanoid",code:me.invalid_string,message:r.message}),s.dirty());else if(r.kind==="cuid")Ob.test(e.data)||(i=this._getOrReturnCtx(e,i),Ae(i,{validation:"cuid",code:me.invalid_string,message:r.message}),s.dirty());else if(r.kind==="cuid2")xb.test(e.data)||(i=this._getOrReturnCtx(e,i),Ae(i,{validation:"cuid2",code:me.invalid_string,message:r.message}),s.dirty());else if(r.kind==="ulid")Sb.test(e.data)||(i=this._getOrReturnCtx(e,i),Ae(i,{validation:"ulid",code:me.invalid_string,message:r.message}),s.dirty());else if(r.kind==="url")try{new URL(e.data)}catch{i=this._getOrReturnCtx(e,i),Ae(i,{validation:"url",code:me.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),Ae(i,{validation:"regex",code:me.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),Ae(i,{code:me.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),Ae(i,{code:me.invalid_string,validation:{startsWith:r.value},message:r.message}),s.dirty()):r.kind==="endsWith"?e.data.endsWith(r.value)||(i=this._getOrReturnCtx(e,i),Ae(i,{code:me.invalid_string,validation:{endsWith:r.value},message:r.message}),s.dirty()):r.kind==="datetime"?Ub(r).test(e.data)||(i=this._getOrReturnCtx(e,i),Ae(i,{code:me.invalid_string,validation:"datetime",message:r.message}),s.dirty()):r.kind==="date"?Wb.test(e.data)||(i=this._getOrReturnCtx(e,i),Ae(i,{code:me.invalid_string,validation:"date",message:r.message}),s.dirty()):r.kind==="time"?kb(r).test(e.data)||(i=this._getOrReturnCtx(e,i),Ae(i,{code:me.invalid_string,validation:"time",message:r.message}),s.dirty()):r.kind==="duration"?Tb.test(e.data)||(i=this._getOrReturnCtx(e,i),Ae(i,{validation:"duration",code:me.invalid_string,message:r.message}),s.dirty()):r.kind==="ip"?Fb(e.data,r.version)||(i=this._getOrReturnCtx(e,i),Ae(i,{validation:"ip",code:me.invalid_string,message:r.message}),s.dirty()):r.kind==="jwt"?jb(e.data,r.alg)||(i=this._getOrReturnCtx(e,i),Ae(i,{validation:"jwt",code:me.invalid_string,message:r.message}),s.dirty()):r.kind==="cidr"?$b(e.data,r.version)||(i=this._getOrReturnCtx(e,i),Ae(i,{validation:"cidr",code:me.invalid_string,message:r.message}),s.dirty()):r.kind==="base64"?Pb.test(e.data)||(i=this._getOrReturnCtx(e,i),Ae(i,{validation:"base64",code:me.invalid_string,message:r.message}),s.dirty()):r.kind==="base64url"?Lb.test(e.data)||(i=this._getOrReturnCtx(e,i),Ae(i,{validation:"base64url",code:me.invalid_string,message:r.message}),s.dirty()):_t.assertNever(r);return{status:s.value,value:e.data}}_regex(e,t,s){return this.refinement(i=>e.test(i),{validation:t,code:me.invalid_string,...Le.errToObj(s)})}_addCheck(e){return new wn({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...Le.errToObj(e)})}url(e){return this._addCheck({kind:"url",...Le.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...Le.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...Le.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...Le.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...Le.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...Le.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...Le.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...Le.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...Le.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...Le.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...Le.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...Le.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,...Le.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,...Le.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...Le.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...Le.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t?.position,...Le.errToObj(t?.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...Le.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...Le.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...Le.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...Le.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...Le.errToObj(t)})}nonempty(e){return this.min(1,Le.errToObj(e))}trim(){return new wn({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new wn({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new wn({...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}}wn.create=n=>new wn({checks:[],typeName:Je.ZodString,coerce:n?.coerce??!1,...rt(n)});function Vb(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 Er extends ct{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)!==Ie.number){const r=this._getOrReturnCtx(e);return Ae(r,{code:me.invalid_type,expected:Ie.number,received:r.parsedType}),Qe}let s;const i=new fs;for(const r of this._def.checks)r.kind==="int"?_t.isInteger(e.data)||(s=this._getOrReturnCtx(e,s),Ae(s,{code:me.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),Ae(s,{code:me.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),Ae(s,{code:me.too_big,maximum:r.value,type:"number",inclusive:r.inclusive,exact:!1,message:r.message}),i.dirty()):r.kind==="multipleOf"?Vb(e.data,r.value)!==0&&(s=this._getOrReturnCtx(e,s),Ae(s,{code:me.not_multiple_of,multipleOf:r.value,message:r.message}),i.dirty()):r.kind==="finite"?Number.isFinite(e.data)||(s=this._getOrReturnCtx(e,s),Ae(s,{code:me.not_finite,message:r.message}),i.dirty()):_t.assertNever(r);return{status:i.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,Le.toString(t))}gt(e,t){return this.setLimit("min",e,!1,Le.toString(t))}lte(e,t){return this.setLimit("max",e,!0,Le.toString(t))}lt(e,t){return this.setLimit("max",e,!1,Le.toString(t))}setLimit(e,t,s,i){return new Er({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:s,message:Le.toString(i)}]})}_addCheck(e){return new Er({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:Le.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:Le.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:Le.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:Le.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:Le.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:Le.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:Le.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:Le.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:Le.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"&&_t.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)}}Er.create=n=>new Er({checks:[],typeName:Je.ZodNumber,coerce:n?.coerce||!1,...rt(n)});class ba extends ct{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)!==Ie.bigint)return this._getInvalidInput(e);let s;const i=new fs;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),Ae(s,{code:me.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),Ae(s,{code:me.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),Ae(s,{code:me.not_multiple_of,multipleOf:r.value,message:r.message}),i.dirty()):_t.assertNever(r);return{status:i.value,value:e.data}}_getInvalidInput(e){const t=this._getOrReturnCtx(e);return Ae(t,{code:me.invalid_type,expected:Ie.bigint,received:t.parsedType}),Qe}gte(e,t){return this.setLimit("min",e,!0,Le.toString(t))}gt(e,t){return this.setLimit("min",e,!1,Le.toString(t))}lte(e,t){return this.setLimit("max",e,!0,Le.toString(t))}lt(e,t){return this.setLimit("max",e,!1,Le.toString(t))}setLimit(e,t,s,i){return new ba({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:s,message:Le.toString(i)}]})}_addCheck(e){return new ba({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:Le.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:Le.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:Le.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:Le.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:Le.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}}ba.create=n=>new ba({checks:[],typeName:Je.ZodBigInt,coerce:n?.coerce??!1,...rt(n)});class Vc extends ct{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==Ie.boolean){const s=this._getOrReturnCtx(e);return Ae(s,{code:me.invalid_type,expected:Ie.boolean,received:s.parsedType}),Qe}return Cs(e.data)}}Vc.create=n=>new Vc({typeName:Je.ZodBoolean,coerce:n?.coerce||!1,...rt(n)});class Bo extends ct{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==Ie.date){const r=this._getOrReturnCtx(e);return Ae(r,{code:me.invalid_type,expected:Ie.date,received:r.parsedType}),Qe}if(Number.isNaN(e.data.getTime())){const r=this._getOrReturnCtx(e);return Ae(r,{code:me.invalid_date}),Qe}const s=new fs;let i;for(const r of this._def.checks)r.kind==="min"?e.data.getTime()<r.value&&(i=this._getOrReturnCtx(e,i),Ae(i,{code:me.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),Ae(i,{code:me.too_big,message:r.message,inclusive:!0,exact:!1,maximum:r.value,type:"date"}),s.dirty()):_t.assertNever(r);return{status:s.value,value:new Date(e.data.getTime())}}_addCheck(e){return new Bo({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:Le.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:Le.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}}Bo.create=n=>new Bo({checks:[],coerce:n?.coerce||!1,typeName:Je.ZodDate,...rt(n)});class _h extends ct{_parse(e){if(this._getType(e)!==Ie.symbol){const s=this._getOrReturnCtx(e);return Ae(s,{code:me.invalid_type,expected:Ie.symbol,received:s.parsedType}),Qe}return Cs(e.data)}}_h.create=n=>new _h({typeName:Je.ZodSymbol,...rt(n)});class Hc extends ct{_parse(e){if(this._getType(e)!==Ie.undefined){const s=this._getOrReturnCtx(e);return Ae(s,{code:me.invalid_type,expected:Ie.undefined,received:s.parsedType}),Qe}return Cs(e.data)}}Hc.create=n=>new Hc({typeName:Je.ZodUndefined,...rt(n)});class qc extends ct{_parse(e){if(this._getType(e)!==Ie.null){const s=this._getOrReturnCtx(e);return Ae(s,{code:me.invalid_type,expected:Ie.null,received:s.parsedType}),Qe}return Cs(e.data)}}qc.create=n=>new qc({typeName:Je.ZodNull,...rt(n)});class zh extends ct{constructor(){super(...arguments),this._any=!0}_parse(e){return Cs(e.data)}}zh.create=n=>new zh({typeName:Je.ZodAny,...rt(n)});class Xc extends ct{constructor(){super(...arguments),this._unknown=!0}_parse(e){return Cs(e.data)}}Xc.create=n=>new Xc({typeName:Je.ZodUnknown,...rt(n)});class si extends ct{_parse(e){const t=this._getOrReturnCtx(e);return Ae(t,{code:me.invalid_type,expected:Ie.never,received:t.parsedType}),Qe}}si.create=n=>new si({typeName:Je.ZodNever,...rt(n)});class wh extends ct{_parse(e){if(this._getType(e)!==Ie.undefined){const s=this._getOrReturnCtx(e);return Ae(s,{code:me.invalid_type,expected:Ie.void,received:s.parsedType}),Qe}return Cs(e.data)}}wh.create=n=>new wh({typeName:Je.ZodVoid,...rt(n)});class sn extends ct{_parse(e){const{ctx:t,status:s}=this._processInputParams(e),i=this._def;if(t.parsedType!==Ie.array)return Ae(t,{code:me.invalid_type,expected:Ie.array,received:t.parsedType}),Qe;if(i.exactLength!==null){const a=t.data.length>i.exactLength.value,o=t.data.length<i.exactLength.value;(a||o)&&(Ae(t,{code:a?me.too_big:me.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&&(Ae(t,{code:me.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&&(Ae(t,{code:me.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 an(t,a,t.path,o)))).then(a=>fs.mergeArray(s,a));const r=[...t.data].map((a,o)=>i.type._parseSync(new an(t,a,t.path,o)));return fs.mergeArray(s,r)}get element(){return this._def.type}min(e,t){return new sn({...this._def,minLength:{value:e,message:Le.toString(t)}})}max(e,t){return new sn({...this._def,maxLength:{value:e,message:Le.toString(t)}})}length(e,t){return new sn({...this._def,exactLength:{value:e,message:Le.toString(t)}})}nonempty(e){return this.min(1,e)}}sn.create=(n,e)=>new sn({type:n,minLength:null,maxLength:null,exactLength:null,typeName:Je.ZodArray,...rt(e)});function br(n){if(n instanceof Ht){const e={};for(const t in n.shape){const s=n.shape[t];e[t]=On.create(br(s))}return new Ht({...n._def,shape:()=>e})}else return n instanceof sn?new sn({...n._def,type:br(n.element)}):n instanceof On?On.create(br(n.unwrap())):n instanceof Ri?Ri.create(br(n.unwrap())):n instanceof Ti?Ti.create(n.items.map(e=>br(e))):n}class Ht extends ct{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=_t.objectKeys(e);return this._cached={shape:e,keys:t},this._cached}_parse(e){if(this._getType(e)!==Ie.object){const c=this._getOrReturnCtx(e);return Ae(c,{code:me.invalid_type,expected:Ie.object,received:c.parsedType}),Qe}const{status:s,ctx:i}=this._processInputParams(e),{shape:r,keys:a}=this._getCached(),o=[];if(!(this._def.catchall instanceof si&&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 an(i,u,i.path,c)),alwaysSet:c in i.data})}if(this._def.catchall instanceof si){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&&(Ae(i,{code:me.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 an(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=>fs.mergeObjectSync(s,c)):fs.mergeObjectSync(s,l)}get shape(){return this._def.shape()}strict(e){return Le.errToObj,new Ht({...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:Le.errToObj(e).message??i}:{message:i}}}:{}})}strip(){return new Ht({...this._def,unknownKeys:"strip"})}passthrough(){return new Ht({...this._def,unknownKeys:"passthrough"})}extend(e){return new Ht({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new Ht({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:Je.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new Ht({...this._def,catchall:e})}pick(e){const t={};for(const s of _t.objectKeys(e))e[s]&&this.shape[s]&&(t[s]=this.shape[s]);return new Ht({...this._def,shape:()=>t})}omit(e){const t={};for(const s of _t.objectKeys(this.shape))e[s]||(t[s]=this.shape[s]);return new Ht({...this._def,shape:()=>t})}deepPartial(){return br(this)}partial(e){const t={};for(const s of _t.objectKeys(this.shape)){const i=this.shape[s];e&&!e[s]?t[s]=i:t[s]=i.optional()}return new Ht({...this._def,shape:()=>t})}required(e){const t={};for(const s of _t.objectKeys(this.shape))if(e&&!e[s])t[s]=this.shape[s];else{let r=this.shape[s];for(;r instanceof On;)r=r._def.innerType;t[s]=r}return new Ht({...this._def,shape:()=>t})}keyof(){return Rm(_t.objectKeys(this.shape))}}Ht.create=(n,e)=>new Ht({shape:()=>n,unknownKeys:"strip",catchall:si.create(),typeName:Je.ZodObject,...rt(e)});Ht.strictCreate=(n,e)=>new Ht({shape:()=>n,unknownKeys:"strict",catchall:si.create(),typeName:Je.ZodObject,...rt(e)});Ht.lazycreate=(n,e)=>new Ht({shape:n,unknownKeys:"strip",catchall:si.create(),typeName:Je.ZodObject,...rt(e)});class Co extends ct{_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 An(o.ctx.common.issues));return Ae(t,{code:me.invalid_union,unionErrors:a}),Qe}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 An(l));return Ae(t,{code:me.invalid_union,unionErrors:o}),Qe}}get options(){return this._def.options}}Co.create=(n,e)=>new Co({options:n,typeName:Je.ZodUnion,...rt(e)});const Mn=n=>n instanceof Wo?Mn(n.schema):n instanceof Gi?Mn(n.innerType()):n instanceof ko?[n.value]:n instanceof Ii?n.options:n instanceof Yc?_t.objectValues(n.enum):n instanceof Fo?Mn(n._def.innerType):n instanceof Hc?[void 0]:n instanceof qc?[null]:n instanceof On?[void 0,...Mn(n.unwrap())]:n instanceof Ri?[null,...Mn(n.unwrap())]:n instanceof Nm||n instanceof $o?Mn(n.unwrap()):n instanceof jo?Mn(n._def.innerType):[];class hu extends ct{_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==Ie.object)return Ae(t,{code:me.invalid_type,expected:Ie.object,received:t.parsedType}),Qe;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}):(Ae(t,{code:me.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[s]}),Qe)}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=Mn(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 hu({typeName:Je.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:i,...rt(s)})}}function Kc(n,e){const t=$n(n),s=$n(e);if(n===e)return{valid:!0,data:n};if(t===Ie.object&&s===Ie.object){const i=_t.objectKeys(e),r=_t.objectKeys(n).filter(o=>i.indexOf(o)!==-1),a={...n,...e};for(const o of r){const l=Kc(n[o],e[o]);if(!l.valid)return{valid:!1};a[o]=l.data}return{valid:!0,data:a}}else if(t===Ie.array&&s===Ie.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=Kc(a,o);if(!l.valid)return{valid:!1};i.push(l.data)}return{valid:!0,data:i}}else return t===Ie.date&&s===Ie.date&&+n==+e?{valid:!0,data:n}:{valid:!1}}class Po extends ct{_parse(e){const{status:t,ctx:s}=this._processInputParams(e),i=(r,a)=>{if(gh(r)||gh(a))return Qe;const o=Kc(r.value,a.value);return o.valid?((Mh(r)||Mh(a))&&t.dirty(),{status:t.value,value:o.data}):(Ae(s,{code:me.invalid_intersection_types}),Qe)};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}))}}Po.create=(n,e,t)=>new Po({left:n,right:e,typeName:Je.ZodIntersection,...rt(t)});class Ti extends ct{_parse(e){const{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==Ie.array)return Ae(s,{code:me.invalid_type,expected:Ie.array,received:s.parsedType}),Qe;if(s.data.length<this._def.items.length)return Ae(s,{code:me.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),Qe;!this._def.rest&&s.data.length>this._def.items.length&&(Ae(s,{code:me.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 an(s,a,s.path,o)):null}).filter(a=>!!a);return s.common.async?Promise.all(r).then(a=>fs.mergeArray(t,a)):fs.mergeArray(t,r)}get items(){return this._def.items}rest(e){return new Ti({...this._def,rest:e})}}Ti.create=(n,e)=>{if(!Array.isArray(n))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Ti({items:n,typeName:Je.ZodTuple,rest:null,...rt(e)})};class Lo extends ct{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!==Ie.object)return Ae(s,{code:me.invalid_type,expected:Ie.object,received:s.parsedType}),Qe;const i=[],r=this._def.keyType,a=this._def.valueType;for(const o in s.data)i.push({key:r._parse(new an(s,o,s.path,o)),value:a._parse(new an(s,s.data[o],s.path,o)),alwaysSet:o in s.data});return s.common.async?fs.mergeObjectAsync(t,i):fs.mergeObjectSync(t,i)}get element(){return this._def.valueType}static create(e,t,s){return t instanceof ct?new Lo({keyType:e,valueType:t,typeName:Je.ZodRecord,...rt(s)}):new Lo({keyType:wn.create(),valueType:e,typeName:Je.ZodRecord,...rt(t)})}}class yh extends ct{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!==Ie.map)return Ae(s,{code:me.invalid_type,expected:Ie.map,received:s.parsedType}),Qe;const i=this._def.keyType,r=this._def.valueType,a=[...s.data.entries()].map(([o,l],c)=>({key:i._parse(new an(s,o,s.path,[c,"key"])),value:r._parse(new an(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 Qe;(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 Qe;(c.status==="dirty"||d.status==="dirty")&&t.dirty(),o.set(c.value,d.value)}return{status:t.value,value:o}}}}yh.create=(n,e,t)=>new yh({valueType:e,keyType:n,typeName:Je.ZodMap,...rt(t)});class _a extends ct{_parse(e){const{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==Ie.set)return Ae(s,{code:me.invalid_type,expected:Ie.set,received:s.parsedType}),Qe;const i=this._def;i.minSize!==null&&s.data.size<i.minSize.value&&(Ae(s,{code:me.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&&(Ae(s,{code:me.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 Qe;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 an(s,l,s.path,c)));return s.common.async?Promise.all(o).then(l=>a(l)):a(o)}min(e,t){return new _a({...this._def,minSize:{value:e,message:Le.toString(t)}})}max(e,t){return new _a({...this._def,maxSize:{value:e,message:Le.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}_a.create=(n,e)=>new _a({valueType:n,minSize:null,maxSize:null,typeName:Je.ZodSet,...rt(e)});class Wo extends ct{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})}}Wo.create=(n,e)=>new Wo({getter:n,typeName:Je.ZodLazy,...rt(e)});class ko extends ct{_parse(e){if(e.data!==this._def.value){const t=this._getOrReturnCtx(e);return Ae(t,{received:t.data,code:me.invalid_literal,expected:this._def.value}),Qe}return{status:"valid",value:e.data}}get value(){return this._def.value}}ko.create=(n,e)=>new ko({value:n,typeName:Je.ZodLiteral,...rt(e)});function Rm(n,e){return new Ii({values:n,typeName:Je.ZodEnum,...rt(e)})}class Ii extends ct{_parse(e){if(typeof e.data!="string"){const t=this._getOrReturnCtx(e),s=this._def.values;return Ae(t,{expected:_t.joinValues(s),received:t.parsedType,code:me.invalid_type}),Qe}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 Ae(t,{received:t.data,code:me.invalid_enum_value,options:s}),Qe}return Cs(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 Ii.create(e,{...this._def,...t})}exclude(e,t=this._def){return Ii.create(this.options.filter(s=>!e.includes(s)),{...this._def,...t})}}Ii.create=Rm;class Yc extends ct{_parse(e){const t=_t.getValidEnumValues(this._def.values),s=this._getOrReturnCtx(e);if(s.parsedType!==Ie.string&&s.parsedType!==Ie.number){const i=_t.objectValues(t);return Ae(s,{expected:_t.joinValues(i),received:s.parsedType,code:me.invalid_type}),Qe}if(this._cache||(this._cache=new Set(_t.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){const i=_t.objectValues(t);return Ae(s,{received:s.data,code:me.invalid_enum_value,options:i}),Qe}return Cs(e.data)}get enum(){return this._def.values}}Yc.create=(n,e)=>new Yc({values:n,typeName:Je.ZodNativeEnum,...rt(e)});class Uo extends ct{unwrap(){return this._def.type}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==Ie.promise&&t.common.async===!1)return Ae(t,{code:me.invalid_type,expected:Ie.promise,received:t.parsedType}),Qe;const s=t.parsedType===Ie.promise?t.data:Promise.resolve(t.data);return Cs(s.then(i=>this._def.type.parseAsync(i,{path:t.path,errorMap:t.common.contextualErrorMap})))}}Uo.create=(n,e)=>new Uo({type:n,typeName:Je.ZodPromise,...rt(e)});class Gi extends ct{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Je.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=>{Ae(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 Qe;const l=await this._def.schema._parseAsync({data:o,path:s.path,parent:s});return l.status==="aborted"?Qe:l.status==="dirty"||t.value==="dirty"?la(l.value):l});{if(t.value==="aborted")return Qe;const o=this._def.schema._parseSync({data:a,path:s.path,parent:s});return o.status==="aborted"?Qe:o.status==="dirty"||t.value==="dirty"?la(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"?Qe:(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"?Qe:(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(!Sr(a))return Qe;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=>Sr(a)?Promise.resolve(i.transform(a.value,r)).then(o=>({status:t.value,value:o})):Qe);_t.assertNever(i)}}Gi.create=(n,e,t)=>new Gi({schema:n,typeName:Je.ZodEffects,effect:e,...rt(t)});Gi.createWithPreprocess=(n,e,t)=>new Gi({schema:e,effect:{type:"preprocess",transform:n},typeName:Je.ZodEffects,...rt(t)});class On extends ct{_parse(e){return this._getType(e)===Ie.undefined?Cs(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}On.create=(n,e)=>new On({innerType:n,typeName:Je.ZodOptional,...rt(e)});class Ri extends ct{_parse(e){return this._getType(e)===Ie.null?Cs(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}Ri.create=(n,e)=>new Ri({innerType:n,typeName:Je.ZodNullable,...rt(e)});class Fo extends ct{_parse(e){const{ctx:t}=this._processInputParams(e);let s=t.data;return t.parsedType===Ie.undefined&&(s=this._def.defaultValue()),this._def.innerType._parse({data:s,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}Fo.create=(n,e)=>new Fo({innerType:n,typeName:Je.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...rt(e)});class jo extends ct{_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 No(i)?i.then(r=>({status:"valid",value:r.status==="valid"?r.value:this._def.catchValue({get error(){return new An(s.common.issues)},input:s.data})})):{status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new An(s.common.issues)},input:s.data})}}removeCatch(){return this._def.innerType}}jo.create=(n,e)=>new jo({innerType:n,typeName:Je.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...rt(e)});class vh extends ct{_parse(e){if(this._getType(e)!==Ie.nan){const s=this._getOrReturnCtx(e);return Ae(s,{code:me.invalid_type,expected:Ie.nan,received:s.parsedType}),Qe}return{status:"valid",value:e.data}}}vh.create=n=>new vh({typeName:Je.ZodNaN,...rt(n)});class Nm extends ct{_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 fu extends ct{_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"?Qe:r.status==="dirty"?(t.dirty(),la(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"?Qe: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 fu({in:e,out:t,typeName:Je.ZodPipeline})}}class $o extends ct{_parse(e){const t=this._def.innerType._parse(e),s=i=>(Sr(i)&&(i.value=Object.freeze(i.value)),i);return No(t)?t.then(i=>s(i)):s(t)}unwrap(){return this._def.innerType}}$o.create=(n,e)=>new $o({innerType:n,typeName:Je.ZodReadonly,...rt(e)});var Je;(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"})(Je||(Je={}));const L=wn.create,le=Er.create,Nt=Vc.create,pu=Xc.create;si.create;const it=sn.create,fe=Ht.create;Co.create;const Bm=hu.create;Po.create;const Cm=Ti.create,Pm=Lo.create,Hb=Wo.create,dt=ko.create,Ut=Ii.create;Uo.create;On.create;Ri.create;fe({name:L(),type:L(),size:le(),owner:L(),date:L(),target:L().optional(),version:L().optional(),title:L().optional(),tags:it(L()).optional(),id:le().optional(),status:L().optional()}).passthrough();const qb=new Set([".dcm",".png",".jpg",".jpeg",".gif",".bmp",".webp",".ico",".pdf",".zip",".tar",".gz",".bz2",".xz",".7z",".exe",".dll",".so",".bin",".mp3",".mp4",".avi",".wav",".nii",".mgz"]),Xb=1024*1024;function Lm(n){const e=n.split("/").pop()??n,t=e.lastIndexOf(".");return t>0?e.slice(t).toLowerCase():""}function Kb(n){return!qb.has(Lm(n))}const Yb=Ut(["ok","error"]),Zb=fe({type:Ut(["error","warning"]),message:L()}),Qb=fe({kind:L(),data:pu()}),Jb=fe({input:L(),proposed:L(),validated:Nt(),executed:L().optional()}),Wm=fe({status:Yb,rendered:L(),renderedErr:L().optional(),model:Qb.optional(),errors:it(Zb).optional(),trace:Jb.optional()}),e_=Ut(["data","err","status"]),t_=fe({shellCommands:Nt(),hiddenInput:Nt().optional(),color:Nt().optional(),fileDelivery:Nt().optional(),localFilesystem:Nt().optional()}),s_=fe({type:dt("attach"),protocolVersion:le().int(),token:L(),session:L().optional(),capabilities:t_.optional()}),n_=fe({type:dt("execute"),id:L(),line:L(),instrument:Nt().optional()}),i_=fe({type:dt("cancel"),id:L()}),r_=fe({type:dt("complete"),id:L(),prefix:L()}),a_=fe({type:dt("promptAnswer"),promptId:L(),answer:L()}),o_=fe({type:dt("promptError"),promptId:L(),reason:L()}),l_=fe({type:dt("pipeResult"),pipeId:L(),output:L()}),c_=fe({type:dt("pipeError"),pipeId:L(),reason:L()}),d_=fe({type:dt("shellResult"),shellId:L(),exitCode:le().int()}),u_=fe({type:dt("shellError"),shellId:L(),reason:L()}),h_=fe({type:dt("editResult"),editId:L(),content:L(),changed:Nt(),opened:Nt().optional()}),f_=fe({type:dt("editError"),editId:L(),reason:L()}),p_=fe({type:dt("deliverResult"),deliverId:L(),location:L(),bytes:le().nonnegative()}),m_=fe({type:dt("deliverError"),deliverId:L(),reason:L()}),g_=fe({address:L(),modelKind:L().optional(),groupId:L(),paneId:L()}),km=fe({type:dt("regard"),regard:g_}),M_=fe({type:dt("watch"),subject:L()}),b_=fe({type:dt("unwatch"),subject:L()}),__=["live","settled","stale"],z_=Ut(__),w_=fe({type:dt("stale"),stale:Nt()}),y_=["restart","end","stop"],v_=fe({type:dt("closing"),cause:Ut(y_)}),O_=fe({type:dt("watched"),subject:L(),state:z_}),x_=fe({type:dt("numbered"),id:le(),source:L(),rows:le(),handles:it(fe({kind:L(),ordinal:le(),address:L()}))});Bm("type",[s_,n_,i_,r_,a_,o_,l_,c_,d_,u_,h_,f_,p_,m_,km,M_,b_]);const S_=fe({type:dt("attached"),session:L(),surface:L().optional(),protocolVersion:le().int(),stack:fe({chell:L(),calypso:L(),build:L(),surface:fe({git:L(),built:L()}).optional(),brasa:L().optional(),chili:L().optional(),salsa:L().optional(),cumin:L().optional()}).optional(),hostControl:it(L()).optional(),stale:Nt().optional()}),E_=fe({type:dt("result"),id:L(),envelopes:it(Wm)}),A_=fe({type:dt("complete"),id:L(),prefix:L(),candidates:it(L())}),D_=fe({type:dt("output"),id:L(),channel:e_,chunk:L()}),T_=Ut(gb).catch("task"),I_=Ut(Mb).catch(void 0),G_=Ut(bb).catch("working"),R_=Ut(_b).catch(void 0),N_=Ut(zb).catch("unknown"),B_=fe({type:dt("progress"),id:L(),operation:T_,kind:I_.optional(),phase:G_,label:L().optional(),itemId:L().optional(),current:le().nonnegative().optional(),total:le().nonnegative().optional(),percent:le().min(0).max(100).optional(),unit:R_.optional(),status:N_.optional(),path:L().optional(),reason:L().optional()}),C_=fe({type:dt("session"),surface:L(),envelope:Wm}),P_=fe({type:dt("error"),id:L().optional(),reason:L()}),L_=["text","secret","confirm","path"],W_=Ut(L_).catch("text"),k_=fe({anchor:L().optional(),wantsDirectory:Nt(),suggest:L().optional()}),U_=fe({type:dt("prompt"),promptId:L(),message:L(),hidden:Nt(),wants:W_.optional(),path:k_.optional(),commit:L().optional()});function F_(n){return n.wants!==void 0?n.wants:n.hidden===!0?"secret":"text"}const j_=fe({user:L(),uri:L(),cwd:L(),pacsserver:L().nullable(),physicalMode:Nt(),lastExitCode:le(),lastCommandDurationMs:le(),procWarmup:fe({loaded:le(),total:le().optional(),restored:Nt().optional(),state:Ut(pb).optional(),sweeping:Nt().optional(),feed:fe({id:le(),loaded:le(),total:le(),failed:L().optional()}).optional(),feeds:it(fe({id:le(),loaded:le(),total:le(),failed:L().optional()})).optional(),arrived:it(le()).optional(),landed:it(fe({id:le(),title:L().default(""),jobs:le(),status:L(),chain:it(L()),groups:it(fe({plugin:L(),count:le(),errored:le().default(0),status:L(),parent:le().nullable()})).default([])})).optional(),roster:Ut(["delta","full"]).optional()}).optional(),procIndex:fe({jobs:le(),feeds:le()}).optional(),warmupFailures:it(fe({label:L(),message:L()})).optional()}),$_=fe({type:dt("promptline"),context:j_}),V_=fe({type:dt("pipe"),pipeId:L(),command:L(),input:L()}),H_=fe({type:dt("shell"),shellId:L(),command:L()}),q_=fe({type:dt("edit"),editId:L(),content:L(),extension:L().optional(),path:L().optional()}),X_=fe({type:dt("deliver"),deliverId:L(),path:L(),filename:L(),destination:L().optional(),size:le().nonnegative().optional(),contentType:L().optional()}),K_=fe({type:dt("telemetry"),index:fe({jobs:le(),feeds:le()}),lane:fe({running:fe({line:L(),sinceMs:le(),surface:L()}).nullable(),waiting:le()}).optional(),surfaces:it(fe({id:L(),kind:Ut(["chell","browser"])})).optional(),cube:fe({msPerPage:le(),samples:le()}).optional(),state:fe({running:le(),runningFeeds:le(),scheduled:le(),errored:le(),erroredFeeds:le()}).optional()}),Um=Bm("type",[S_,E_,A_,D_,B_,C_,P_,U_,$_,K_,V_,H_,q_,X_,km,O_,w_,v_,x_]);new Set(Um.options.map(n=>n.shape.type.value));function Y_(n){return n.issues.map(e=>{const t=e.path.join(".");return t?`${t}: ${e.message}`:e.message}).join("; ")}function Z_(n,e){const t=n.safeParse(e);return t.success?{ok:!0,value:t.data}:{ok:!1,error:Y_(t.error)}}function Q_(n){return Z_(Um,n)}const Fm=fe({id:L(),label:L(),parentIds:it(L()),joinParentIds:it(L())}),J_=fe({name:L(),value:pu()}),e0=Fm.extend({pluginName:L(),pluginVersion:L().optional(),arguments:it(J_).optional()}),mu=fe({name:L(),pipelineId:le().optional(),nodes:it(e0)}),t0=["created","waiting","scheduled","started","registeringFiles","finishedSuccessfully","finishedWithError","cancelled","unknown"],jm=Ut(t0).catch("unknown"),s0=fe({count:le(),done:le(),error:le(),running:le(),other:le(),anomalies:it(fe({id:L(),status:jm})).optional()}),n0=fe({computeSeconds:le().optional(),dataBytes:le().optional()}),i0=Fm.extend({instanceId:le(),pluginName:L(),pluginVersion:L().optional(),status:jm,vfsPath:L(),metrics:n0.optional(),tally:s0.optional(),computeResource:L().optional()}),Zc=fe({feedId:le(),feedName:L(),nodes:it(i0)}),r0=fe({feedId:le(),loaded:le(),total:le(),failed:L().optional()}),Kn={pipelineDiagram:"pipeline.diagram",feedDag:"feed.dag",feedIndexing:"feed.indexing"},a0=fe({id:le(),title:L(),owner:L(),status:L(),createdAt:L(),sizeBytes:le().optional(),wallSeconds:le().optional(),jobsDone:le().optional(),jobsTotal:le().optional(),jobsErrored:le().optional(),tags:it(L()).optional()}),$m=fe({feeds:it(a0)}),Vm="feed.list",o0=fe({plugin:L(),count:le(),errored:le().default(0),status:L(),parent:le().nullable()}),l0=fe({format:Ut(["dicom","nifti","mgz","jpeg","png","other","unknown"]),modality:L().optional(),seriesDescription:L().optional(),reason:L().optional(),sourceFeed:le().optional()}),c0=fe({id:le(),title:L().default(""),jobs:le(),status:L(),chain:it(L()),groups:it(o0).default([]),createdAt:L().default(""),data:l0.optional()}),d0=fe({feeds:it(c0),whole:Nt()}),u0="proc.universe",h0=fe({name:L(),positions:Pm(L(),Cm([le(),le(),le()])).nullable(),writtenAt:L().nullable(),laying:fe({nodes:le(),fraction:le()}).nullable().optional()}),f0="proc.layout",p0=fe({name:L(),type:L(),optional:Nt(),default:pu().optional(),help:L().optional(),flag:L()}),m0=fe({id:le().optional(),name:L(),version:L(),type:L(),title:L().optional(),description:L().optional(),authors:L().optional(),documentation:L().optional(),category:L().optional(),parameters:it(p0),command:L().optional()}),g0="plugin.info",M0=fe({seriesUID:L(),description:L(),modality:L(),fileCount:le().optional(),vfsPath:L().optional(),pulled:Nt().optional(),pulledFiles:le().optional(),folderPath:L().optional()}),b0=fe({studyUID:L().optional(),server:L().optional(),vfsPath:L().optional(),description:L(),patientName:L(),patientId:L(),date:L(),modalities:L(),accession:L(),series:it(M0)}),Hm=fe({replayed:Nt(),answeredAt:L()}),_0=["found","none","unasked"],z0=Ut(_0).catch("unasked"),w0=fe({patientId:L(),server:L().optional(),patientName:L().optional(),status:z0,studyCount:le(),seriesCount:le(),queryId:le().optional(),provenance:Hm.optional(),error:L().optional()}),y0=fe({queryId:le(),vfsPath:L(),pacsName:L(),expression:L(),studies:it(b0),provenance:Hm.optional(),patients:it(w0).optional()}),v0=fe({id:le(),identifier:L(),active:Nt()}),O0=fe({servers:it(v0)}),x0="pacs.servers",S0="pacs.query";function E0(n){return`pacs:patient:${n.server??"-"}:${n.patientId}`}const A0=["patient","study","series","image","equipment","meta","private","other"],qm=Ut(A0).catch("other"),Xm=Hb(()=>fe({tag:L(),name:L(),vr:L(),value:L(),group:qm,phi:Nt(),decoded:L().optional(),items:it(it(Xm)).optional()})),D0=fe({tag:L(),name:L(),vr:L(),group:qm,phi:Nt(),distinct:le(),first:L(),last:L(),values:it(fe({path:L(),value:L().nullable()}))}),Oh=fe({path:L(),subject:Ut(["file","folder"]),read:le(),of:le(),refused:it(L()),constant:it(Xm),varying:it(D0)}),T0=fe({rows:le(),columns:le(),pixelSpacing:Cm([le(),le()]).optional(),sliceThickness:le().optional(),spacingBetweenSlices:le().optional()}),xh=fe({path:L(),seriesInstanceUID:L().optional(),studyInstanceUID:L().optional(),modality:L(),seriesDescription:L(),seriesNumber:le().optional(),instances:le(),frames:le(),order:Ut(["filename","unknown"]),geometry:T0.optional(),transferSyntax:fe({uid:L(),name:L().optional()}).optional(),bytes:le(),header:L(),files:it(L()),annotations:it(L())}),Da={tags:"dicom.tags",series:"dicom.series"},I0=fe({path:L(),target:Ut(["series","volume"]),force:Nt().optional(),startAt:le().int().positive().optional()}),G0={view:"image.view"},R0=fe({state:Ut(["cold","warming","current"]),loaded:le(),total:le()});fe({user:L(),surface:L(),feeds:fe({total:le(),own:le(),shared:le(),public:le()}),jobs:fe({total:le(),finished:le(),errored:le(),cancelled:le(),running:le(),scheduled:le()}),failureRate:le().nullable(),index:R0,fortune:L()});const N0="session.notes",B0=fe({package:L(),headline:L(),body:L(),internal:Nt()}),C0=fe({package:L(),version:L(),bump:Ut(["major","minor","patch"]),changes:it(B0)}),P0=fe({date:L().nullable(),merge:L().nullable(),entries:it(C0)}),L0=fe({source:dt("daemon"),installed:Pm(L(),L()),releases:it(P0),total:le(),all:Nt()});function as(n){return n.groups.map(e=>`${e.parent??"r"}:${e.plugin}`).join(">")}function Yn(n,e){return`feed:${n}:${e}`}function Km(n){return`shape:${n}`}function za(n){return Math.log2(Math.max(1,n)+1)}function gu(n){if(!(n.errored<=0||n.count<=0))return Math.min(1,n.errored/n.count)}function fl(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=as(a);r.set(o,(r.get(o)??0)+1)}for(const a of i){if(a.groups.length===0)continue;const o=as(a),l=Km(o);s.has(o)||(s.add(o),t.push({id:l,label:pl(o),parentIds:[],joinParentIds:[],ghost:!0,halo:!0,metric:1,count:r.get(o)??1})),a.groups.forEach((c,d)=>{const u=gu(c);t.push({id:Yn(a.id,d),label:c.plugin,parentIds:[c.parent===null?l:Yn(a.id,c.parent)],joinParentIds:[],status:c.status,metric:e==="jobs"?za(c.count):1,...c.count>1?{count:c.count}:{},...u!==void 0?{share:u}:{}})})}return{nodes:t}}const Qc="plugin:";function W0(n){return`${Qc}${n}`}function Jc(n){return n.startsWith(Qc)?n.slice(Qc.length):null}function Mu(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=gu(a);t.push({id:Yn(r.id,o),label:a.plugin,parentIds:a.parent===null?[]:[Yn(r.id,a.parent)],joinParentIds:[],status:a.status,metric:e==="jobs"?za(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:W0(r),label:r,parentIds:[],joinParentIds:[],metric:1+Math.log(a),hue:"#e8f4ff",ring:!0,attrs:{kind:"star",plugin:r}});return{nodes:t}}function Sh(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:Mu(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 pl(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 k0=.5,U0=5,F0=.02,ed="data:",j0={dicom:"DICOM",nifti:"NIfTI",mgz:"MGZ",jpeg:"JPEG",png:"PNG",other:"OTHER",unknown:"UNREADABLE",unread:"NOT YET READ"};function $0(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 V0(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 Ym(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=$0(r),o=a.length===0?void 0:s.find(l=>V0(l.words,a)>=k0);if(o!==void 0){i.set(r,o.name);continue}s.push({name:r,words:a}),i.set(r,r)}return i}function Zm(n,e){const t=n.data?.format??"unread",s=[{key:t,label:j0[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 Nl(n){return`${ed}${n}`}function td(n){return n.startsWith(ed)?n.slice(ed.length):null}function Eh(n,e="jobs"){const t=[...n].filter(d=>d.groups.length>0).sort((d,u)=>d.id-u.id),s=Ym(t.map(d=>d.data?.seriesDescription).filter(d=>d!==void 0)),i=new Map,r=[];for(const d of t){const u=Zm(d,s);let h=null;for(const f of u){const M=i.get(f.key);M===void 0?i.set(f.key,{label:f.label,feeds:1,parent:h}):M.feeds+=1,h=f.key}const p=Nl(h);d.groups.forEach((f,M)=>{const g=gu(f);r.push({id:Yn(d.id,M),label:f.plugin,parentIds:[f.parent===null?p:Yn(d.id,f.parent)],joinParentIds:[],status:f.status,metric:e==="jobs"?za(f.count):1,...f.count>1?{count:f.count}:{},...g!==void 0?{share:g}:{}})})}const a=new Map;for(const d of t){const u=d.groups.findIndex(h=>h.parent===null);u>=0&&a.set(d.id,Yn(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),p=a.get(d.id);if(h===void 0||p===void 0)continue;const f=o.get(p);f!==void 0&&(f.joinParentIds=[...f.joinParentIds,h],f.joinFaint=!0)}const l=(d,u)=>d.split("/").length<3||u>=Math.max(U0,F0*t.length);return{graph:{nodes:[...[...i].map(([d,u])=>({id:Nl(d),label:u.label,parentIds:u.parent===null?[]:[Nl(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 H0(n,e){const t=td(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 sd=12,q0=240;function X0(n){return n<=q0?sd:void 0}function nd(n,e){return`fold:${n}:${e}`}function Qm(n){const e=n.match(/^fold:(.+):\d+$/);return e===null?null:e[1]}function K0(n){const e=n.match(/^feed:(\d+):/);if(e!==null)return`feed:${e[1]}`;const t=Qm(n);return t===null?null:`fold:${t}`}const Y0=fe({at:le(),method:L(),family:L(),path:L(),status:le(),ms:le()}),Z0=fe({family:L(),count:le(),ms:le()});fe({since:L(),total:le(),ms:le(),families:it(Z0),last:it(Y0)});const Jm=24,id="argus.dormant";class Q0{constructor(e=Jm,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(id,JSON.stringify([...this.groups.values()]))}catch{}}rehydrate(){if(this.store!==void 0)try{const e=this.store.getItem(id);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 Ah(){try{const n=globalThis.localStorage;return n===void 0?void 0:(n.getItem(id),n)}catch{return}}class J0{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 ez(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 ez(n){return[...new Set(n)]}const tz="G1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MTsxbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MTsxbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbS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bWzBtG1szODsyOzA7MTsxbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzE7MjszbSAbWzBtG1szODsyOzE7MjszbSAbWzBtG1szODsyOzE7MjszbSAbWzBtG1szODsyOzE7MjszbSAbWzBtG1szODsyOzE7MjsybSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtChtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzE7MW0gG1swbRtbMzg7MjsxOzI7M20gG1swbRtbMzg7MjsxOzI7M20gG1swbRtbMzg7MjsxOzI7M20gG1swbRtbMzg7MjswOzE7Mm0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjsxOzI7M20gG1swbRtbMzg7MjswOzE7Mm0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjsxOzI7M20gG1swbRtbMzg7MjswOzE7Mm0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjsxOzI7M20gG1sw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bMG0KG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtCg==",sz=/\x1b\[[0-9;]*m/g,Dh="\x1B[0m",Th="\x1B[7m",eg=atob(tz).trimEnd().split(`
3
3
  `);eg.map(n=>n.replace(sz,""));function nz(n){const e=n.replace(/\x1b\[0m/g,`${Dh}${Th}`);return`${Th}${e}${Dh}`}function iz(n,e=!1){const t=eg;return e?t.map(nz):t}function tg(n){const e=n.lastIndexOf("/");return e<=0?"/":n.slice(0,e+1)}function rz(n){const e=new URLSearchParams(n.search).get("ws");return e!==null&&e.length>0?e:`${n.protocol==="https:"?"wss":"ws"}://${n.host}${tg(n.pathname)}`}function l7(n,e){return new URL(n,e).href}function bu(n,e){const t=`path=${encodeURIComponent(n)}`;return e.length>0?`vfs?${t}&token=${encodeURIComponent(e)}`:`vfs?${t}`}function az(n,e){return`${bu(n,e)}&download=1`}function ml(n){return new URLSearchParams(n).has("door")}function Vo(n,e){const s=tg(n).split("/").filter(i=>i.length>0).slice(0,-2);return`/${s.length>0?`${s.join("/")}/`:""}${e}`}const oz="daemon";class _u{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:jc,token:t,capabilities:{shellCommands:!1,color:!0,hiddenInput:!0,fileDelivery:!0,localFilesystem:!1}}))},a.onmessage=o=>{const l=Ih(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 _u(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}:{},...l.stale!==void 0?{stale:l.stale}:{},...l.surface!==void 0?{surface:l.surface}:{}}})}})}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&&t.operator!==!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=Ih(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===oz){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"stale":this.handlers.stale_receive?.(t.stale);break;case"closing":this.handlers.closing_receive?.(t.cause);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,surfaces:t.surfaces});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:F_(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.edit_run(t);break}case"deliver":{this.deliver_run(t);break}}}edit_run(e){const t=this.handlers.edit_receive;let s=!1,i="the argus surface cannot open an editor";if(t!==void 0)try{s=t({content:e.content,...e.path===void 0?{}:{path:e.path},...e.extension===void 0?{}:{extension:e.extension}}),i="the editor pane did not open"}catch(r){i=r instanceof Error?r.message:String(r)}if(s){this.reply_send({type:"editResult",editId:e.editId,content:e.content,changed:!1,opened:!0});return}this.reply_send({type:"editError",editId:e.editId,reason:i})}async deliver_run(e){try{const t=bu(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 Ih(n){try{const e=Q_(JSON.parse(n));return e.ok&&e.value!==void 0?e.value:null}catch{return null}}const Js=["#000000","#f24444","#33cc66","#ffaa44","#5599ff","#cc88ff","#44cccc","#ffeecc","#777777","#ff6666","#66ee99","#ffcc66","#77bbff","#dd99ff","#66dddd","#ffffff"],lz={yellow:Js[3],white:Js[7],cyan:Js[6],green:Js[2],magenta:Js[5]};function sg(){return{fg:null,bg:null,bold:!1,dim:!1,italic:!1,inverse:!1,underline:!1}}function cz(n){if(n<16)return Js[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 dz(n,e){for(let t=0;t<e.length;t++){const s=e[t]??0;if(s===0)Object.assign(n,sg());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=Js[s-30]??null;else if(s>=90&&s<=97)n.fg=Js[s-90+8]??null;else if(s===39)n.fg=null;else if(s>=40&&s<=47)n.bg=Js[s-40]??null;else if(s>=100&&s<=107)n.bg=Js[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=cz(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 uz(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 xs(n){return n.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}const Bl=/\x1b(?:\[([0-?]*)[ -/]*([@-~])|\][^\x07\x1b]*(?:\x07|\x1b\\)|[@-Z\\-_])/g;function bn(n){const e=sg();let t="",s=0;const i=a=>{if(a.length===0)return;const o=uz(e),l=xs(a.replace(/\r/g,""));t+=o.length>0?`<span style="${o}">${l}</span>`:l};Bl.lastIndex=0;let r=Bl.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);dz(e,a)}r=Bl.exec(n)}return i(n.slice(s)),t}function hz(n){for(const[e,t]of Object.entries(lz))n.style.setProperty(`--console-${e}`,t)}const di={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"}},fz={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"}}},dn={powerline:"",cube:"",database:"",user:"",folder:"",microscope:"",bolt:"",error:""},pz=3e3,mz=200;class gz{output;splashGreeting=null;progressRegion;promptBar;inputGlyph;input;submit;complete;promptContext=null;busy=!0;container;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,this.container=e,e.innerHTML=`
4
4
  <div class="argus-screen">
5
5
  <div class="argus-output"></div>
@@ -18,7 +18,7 @@ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./cornerstoneEngine-Dn
18
18
  <span class="argus-progress-bar"><span class="argus-progress-fill"></span></span>
19
19
  <span class="argus-progress-elapsed"></span>`:`<span class="argus-progress-spin" aria-hidden="true"></span>
20
20
  <span class="argus-progress-label"></span>
21
- <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?` ${Rh(t.current,t.unit)}/${Rh(t.total,t.unit)}`:"";if(e.labelElement.innerHTML=`${Gh(s)}<span class="argus-progress-counts">${Gh(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(),_z))}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`)}}}function zu(n){return/\dfr\b/.test(n)}function Nh(n){const e=n.trim().match(/^minmax\(\s*([^,]+?)\s*,/);return e!==null?(e[1]??"3em").trim():"3em"}const Ho="argus.columns";function Cl(){try{const n=globalThis.localStorage;return n===void 0?null:(n.getItem(`${Ho}.probe`),n)}catch{return null}}function wz(n,e,t){const s=new Map;if(n===null)return s;for(const i of t)try{const r=n.getItem(`${Ho}.${e}.${i}`),a=r===null?Number.NaN:Number(r);Number.isFinite(a)&&a>0&&s.set(i,Math.round(a))}catch{}return s}function yz(n,e,t,s){if(n!==null)try{s===null?n.removeItem(`${Ho}.${e}.${t}`):n.setItem(`${Ho}.${e}.${t}`,String(Math.round(s)))}catch{}}function vz(n){const e=getComputedStyle(n);return n.getBoundingClientRect().width+(Number.parseFloat(e.marginLeft)||0)+(Number.parseFloat(e.marginRight)||0)}function Oz(n,e,t,s=0,i=!1){if(i&&!n.expanse){const c=t>=0?t:Math.min(0,Math.max(n.floor-n.width,t));return c===0?{left:null,right:null,moved:c}:{left:Math.round(n.width+c),right:null,moved:c}}let r,a;const o=c=>t>=0?Math.max(0,Math.min(a,c)):Math.min(0,Math.max(r,c));if(e===null){r=n.floor-n.width,a=s;const c=o(t);return{left:Math.round(n.width+c),right:null,moved:c}}if(n.expanse){r=n.floor-n.width,a=e.width-e.floor;const c=o(t);return c===0?{left:null,right:null,moved:c}:{left:null,right:Math.round(e.width-c),moved:c}}if(e.expanse){r=n.floor-n.width,a=e.width-e.floor;const c=o(t);return{left:Math.round(n.width+c),right:null,moved:c}}r=n.floor-n.width,a=e.width-e.floor;const l=o(t);return l===0?{left:null,right:null,moved:l}:{left:Math.round(n.width+l),right:Math.round(e.width-l),moved:l}}const xz="roster-grip";function Sz(n,e){for(const t of n.querySelectorAll(`.${xz}`)){if(t.dataset.wired==="1")continue;t.dataset.wired="1";const s=t.closest(".roster-cap");if(s===null)continue;t.addEventListener("click",r=>{r.stopPropagation()});const i=()=>{let r=s.nextElementSibling;for(;r!==null&&!r.classList.contains("roster-cap");)r=r.nextElementSibling;if(!(r instanceof HTMLElement))return null;const a=e.key_of(r);return a===null?null:{cap:r,key:a}};t.addEventListener("dblclick",r=>{r.stopPropagation();const a=e.key_of(s),o=i();a!==null&&e.reset(a),o!==null&&e.reset(o.key)}),t.addEventListener("pointerdown",r=>{const a=e.key_of(s);if(a===null||r.button!==0)return;r.preventDefault(),r.stopPropagation();try{t.setPointerCapture(r.pointerId)}catch{}const o=r.clientX,l=(g,m)=>{const _=vz(g),w=e.floor_of(m);return{width:_,floor:w,expanse:e.expanse_is(m)&&_>w+1}},c=l(s,a),d=i(),u=d===null?null:l(d.cap,d.key);if(c.expanse&&u===null)return;const h=e.expanseSlack(),p=n.scrollWidth>n.clientWidth+1;n.classList.add("roster-sizing");const f=g=>{const m=Oz(c,u,g.clientX-o,h,p);m.left!==null&&e.size(a,m.left),m.right!==null&&d!==null&&e.size(d.key,m.right)},M=()=>{n.classList.remove("roster-sizing"),window.removeEventListener("pointermove",f),window.removeEventListener("pointerup",M),window.removeEventListener("pointercancel",M)};window.addEventListener("pointermove",f),window.addEventListener("pointerup",M),window.addEventListener("pointercancel",M)})}}function Bh(n,e){const t=n.trim().match(/^([\d.]+)\s*(px|em|rem)$/);if(t===null)return 0;const s=Number(t[1]);if(t[2]==="px")return s;const i=t[2]==="rem"?document.documentElement:e,r=Number.parseFloat(getComputedStyle(i).fontSize)||16;return s*r}class Ez{root;capsRows=[];strip;input;columns;value_of;onChange;leadingCells;terms;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,o=[]){this.terms=o,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 l=document.createElement("span");l.className="roster-filter-glyph",l.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",c=>{c.key==="Escape"&&(c.stopPropagation(),this.strip_toggle(!1))}),this.strip.append(l,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");if(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)),t!==this.columns[this.columns.length-1]){const i=document.createElement("span");i.className="roster-grip",i.title="drag to size the column; press twice to give it back",s.appendChild(i)}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=>{const s=t.key===null?void 0:this.terms.find(r=>r.key===t.key);return(s!==void 0?s.value(e).toLowerCase():t.key!==null?String(this.value_of(e,t.key)).toLowerCase():[...this.columns.map(r=>String(this.value_of(e,r.key))),...this.terms.map(r=>r.value(e))].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)||this.terms.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(l=>l.key===i),a=i===this.state.sortKey;s.classList.toggle("roster-active",a);let o=s.querySelector(".roster-cap-words");o===null&&(o=document.createElement("span"),o.className="roster-cap-words",s.prepend(o)),o.textContent=`${r?.label??i}${a?this.state.sortDir==="asc"?" ▲":" ▼":""}`}}}const Az=["state-live","state-settled","state-stale","state-wait","state-note","state-refused"];function Jt(n,e,t){n!==null&&(n.classList.remove(...Az),e!==null&&n.classList.add(`state-${e}`),t!==void 0&&(n.textContent=t))}function zr(n,e){n?.classList.remove(`state-${e}`)}function Dz(n,e,t){n?.classList.toggle(`state-${e}`,t)}class Tz{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,Hs(e,{rows:".listing-row"}),e}field_get(){return this.field}}function Iz(n){return n.map(e=>({key:e.key,label:e.label}))}function Gz(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 r instanceof Node?r.textContent??"":r==null?"":String(r)}}function Rz(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(r instanceof Node){s.appendChild(r);continue}const a=document.createElement("span");a.className=i.className,a.textContent=r==null?"":String(r),s.appendChild(a)}return t.decorate?.(s,n),s}function Ta(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 qo(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 zo(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 Nz(n,e){return n.mode==="fold"&&n.open.has(e)}function Bz(n,e){return n.mode!=="fold"||n.open.delete(e)?!1:(n.open.add(e),!0)}function Ch(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 Cz(n){let e=0;for(const t of n){if(t.capped!==!1)break;e+=1}return e}function wr(n,e){return{level_visit(t){return t(n,e)}}}function Pl(n,e,t){const s=[];let i=!1;for(const r of n){if(r.width===void 0||r.width.trim()==="")throw new Error(`listing trait '${r.key}' declares no width`);if(!Ch(r.width))throw new Error(`listing trait '${r.key}' declares a content-sized track '${r.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(r.capped===!1){if(i)throw new Error(`uncapped listing trait '${r.key}' must lead the traits`)}else i=!0;const a=t?.get(r.key);a===void 0?s.push(r.width.trim()):s.push(zu(r.width)?`minmax(${a}px, 1fr)`:`${a}px`)}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(!Ch(e.width))throw new Error(`listing actions declare a content-sized track '${e.width.trim()}'`);s.push(e.width.trim())}return s.join(" ")}let ma=new Map,wo=new Map;function Pz(n){if(ma=new Map,wo=new Map,n!==null)for(const e of n.handles)ma.has(e.address)||ma.set(e.address,e),wo.set(e.kind,Math.max(wo.get(e.kind)??0,`${e.ordinal}`.length));ig()}function ng(n){const e=Math.max(3,wo.get(n.kind)??0);return`${n.kind}${`${n.ordinal}`.padStart(e,"0")}`}function ig(){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:ma.get(a);r.textContent=o===void 0?`${i+1}`.padStart(t,"0"):ng(o),r.classList.toggle("numbered",o!==void 0)})}}function Lz(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:ma.get(s);return i!==void 0&&(t.textContent=ng(i),t.classList.add("numbered")),t}}}class wu{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:[Lz(e.address),...e.traits]},this.declaration=e,this.host=t,this.select=i,this.depth=r,this.template=Pl(e.traits,this.trackActions_get(),this.sized);const a=e.traits.filter(o=>o.capped!==!1);if(this.order=new Ez(Iz(a),Gz(e.traits),()=>this.host.repaint(),e.defaultSort,Cz(e.traits),s,e.terms??[]),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 wu(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=Pl(this.declaration.traits,this.trackActions_get(),this.sized)}sized=new Map;column_size(e,t){t===null?this.sized.delete(e):this.sized.set(e,t),this.template=Pl(this.declaration.traits,this.trackActions_get(),this.sized)}track_of(e){return this.declaration.traits.find(t=>t.key===e)?.width??null}traitKeys(){return this.declaration.traits.map(e=>e.key)}expanse_of(){const e=this.declaration.traits.find(t=>zu(t.width??""));return e===void 0?null:{key:e.key,width:e.width??""}}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=Nz(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=Rz(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(...zo(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){if(!s&&this.child!==null){Bz(this.expansion,t),this.host.repaint(),this.declaration.activate?.(e);return}this.host.activating_is(t)||(this.host.activation_begin(t,this.rowsByKey.get(t)??null,kz(t)),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([...zo(i,a).childNodes]);else{const o=this.cellsByKey.get(e);o!==void 0&&a.length>0&&o.replaceChildren(...zo(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.append(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 ni{declaration;level;host;gridHost;stateSpan;activating=null;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??Wz(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 wu(e,{repaint:()=>this.repaint_queue(),framed:()=>this.zone!==null,activating_is:s=>this.activating?.key===s,activation_begin:(s,i,r)=>this.activation_begin(s,i,r),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 Tz(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.columns_wire(t),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.activation_settle(),this.render(),this.grips_ensure()}activation_begin(e,t,s){this.activating?.element?.classList.remove("listing-activating"),this.activating={key:e,element:t},t?.classList.add("listing-activating"),Jt(this.stateSpan,"wait",`OPENING ${s}`)}activation_settle(){this.activating!==null&&(this.activating.element?.classList.remove("listing-activating"),this.activating=null,zr(this.stateSpan,"wait"))}activation_refuse(e){this.activating!==null&&(this.activation_settle(),Jt(this.stateSpan,"refused",e.toUpperCase()))}activating_get(){return this.activating?.key??null}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),ig(),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()}columnsBlock=null;columnsPrefix=null;columns_wire(e){if(this.columnsPrefix=e?.prefix??null,this.columnsBlock=e?.root.querySelector(`.${e.prefix}-columns`)??null,this.columnsBlock?.addEventListener("click",()=>this.columns_reset()),this.columnsPrefix!==null){for(const[t,s]of wz(Cl(),this.columnsPrefix,this.level.traitKeys()))this.level.column_size(t,s);this.gridHost.style.setProperty("--roster-cols",this.level.template)}this.columnsBlock_paint(),this.grips_ensure()}grips_ensure(){const e=this.declaration.mount.querySelector(".roster-order .roster-caps");if(e===null)return;const t=Cl();Sz(e,{key_of:s=>s.dataset.key??null,expanse_is:s=>zu(this.level.track_of(s)??""),floor_of:s=>Bh(Nh(this.level.track_of(s)??"3em"),e),expanseSlack:()=>{const s=this.level.expanse_of(),i=s===null?null:e.querySelector(`.roster-cap[data-key="${s.key}"]`);return i===null||s===null?0:Math.max(0,i.getBoundingClientRect().width-Bh(Nh(s.width),e))},size:(s,i)=>this.column_size(s,i,t),reset:s=>this.column_size(s,null,t)})}column_size(e,t,s){this.level.column_size(e,t),this.gridHost.style.setProperty("--roster-cols",this.level.template),this.columnsPrefix!==null&&yz(s,this.columnsPrefix,e,t),this.columnsBlock_paint()}columns_reset(){const e=Cl();for(const t of[...this.level.sized.keys()])this.column_size(t,null,e)}columns_sized(){return[...this.level.sized.keys()]}columnsBlock_paint(){if(this.columnsBlock===null)return;const e=this.level.sized.size>0;this.columnsBlock.textContent=e?"COLUMNS · SIZED":"COLUMNS",this.columnsBlock.classList.toggle("rail-off",!e),this.columnsBlock.title=e?"columns sized by hand; press to give them all back":"drag a cap's edge to size its column; a double-press gives one back"}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?[]:[...zo(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.append(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):Uz(e);t!==null&&(this.stateSpan.textContent=t)}}function Wz(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 kz(n){return n.split("/").filter(e=>e!=="").pop()??n}function Uz(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 Fz=["single","mpr","3d","slab"],Ph=["wl","zoom","pan","length","angle","probe"],yo=["gray","hot","jet","cool"],rg=[{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"]}],rd=/\.(nii|nii\.gz|mgz|mgh)$/i,Xo=/\.dcm$/i,ag=/^\d+-.*-[0-9a-f]{7}$/,Lh="/SERVICES/PACS/",jz=4;function Ll(n,e){if(ag.test(e))return!0;if(!n.startsWith(Lh))return!1;const t=n.slice(Lh.length).replace(/\/+$/,"");return t!==""&&t.split("/").length===jz}function $z(n,e){const t=n.toLowerCase();return rg.find(s=>s.name===t&&(s.modalities.length===0||s.modalities.includes(e.toUpperCase())))}const ii={charge:!0,link:!0,collide:!0,gravity:!1},Tt=.55;function xi(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 Vz(n){const e=+this._x.call(null,n);return og(this.cover(e),e,n)}function og(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 Hz(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)og(this,t[r],n[r]);return this}function qz(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 Xz(){var n=[];return this.visit(function(e){if(!e.length)do n.push(e.data);while(e=e.next)}),n}function Kz(n){return arguments.length?this.cover(+n[0][0]).cover(+n[1][0]):isNaN(this._x0)?void 0:[[this._x0],[this._x1]]}function xn(n,e,t){this.node=n,this.x0=e,this.x1=t}function Yz(n,e){var t,s=this._x0,i,r,a=this._x1,o=[],l=this._root,c,d;for(l&&o.push(new xn(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 xn(l[1],u,r),new xn(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 Zz(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 Qz(n){for(var e=0,t=n.length;e<t;++e)this.remove(n[e]);return this}function Jz(){return this._root}function ew(){var n=0;return this.visit(function(e){if(!e.length)do++n;while(e=e.next)}),n}function tw(n){var e=[],t,s=this._root,i,r,a;for(s&&e.push(new xn(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 xn(i,o,a)),(i=s[0])&&e.push(new xn(i,r,o))}return this}function sw(n){var e=[],t=[],s;for(this._root&&e.push(new xn(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 xn(r,a,l)),(r=i[1])&&e.push(new xn(r,l,o))}t.push(s)}for(;s=t.pop();)n(s.node,s.x0,s.x1);return this}function nw(n){return n[0]}function iw(n){return arguments.length?(this._x=n,this):this._x}function yu(n,e){var t=new vu(e??nw,NaN,NaN);return n==null?t:t.addAll(n)}function vu(n,e,t){this._x=n,this._x0=e,this._x1=t,this._root=void 0}function Wh(n){for(var e={data:n.data},t=e;n=n.next;)t=t.next={data:n.data};return e}var bs=yu.prototype=vu.prototype;bs.copy=function(){var n=new vu(this._x,this._x0,this._x1),e=this._root,t,s;if(!e)return n;if(!e.length)return n._root=Wh(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]=Wh(s));return n};bs.add=Vz;bs.addAll=Hz;bs.cover=qz;bs.data=Xz;bs.extent=Kz;bs.find=Yz;bs.remove=Zz;bs.removeAll=Qz;bs.root=Jz;bs.size=ew;bs.visit=tw;bs.visitAfter=sw;bs.x=iw;function rw(n){const e=+this._x.call(null,n),t=+this._y.call(null,n);return lg(this.cover(e,t),e,t,n)}function lg(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,p,f,M,g,m,_;if(!r)return n._root=a,n;for(;r.length;)if((M=e>=(u=(o+c)/2))?o=u:c=u,(g=t>=(h=(l+d)/2))?l=h:d=h,i=r,!(r=r[m=g<<1|M]))return i[m]=a,n;if(p=+n._x.call(null,r.data),f=+n._y.call(null,r.data),e===p&&t===f)return a.next=r,i?i[m]=a:n._root=a,n;do i=i?i[m]=new Array(4):n._root=new Array(4),(M=e>=(u=(o+c)/2))?o=u:c=u,(g=t>=(h=(l+d)/2))?l=h:d=h;while((m=g<<1|M)===(_=(f>=h)<<1|p>=u));return i[_]=r,i[m]=a,n}function aw(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)lg(this,a[t],o[t],n[t]);return this}function ow(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 lw(){var n=[];return this.visit(function(e){if(!e.length)do n.push(e.data);while(e=e.next)}),n}function cw(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 hs(n,e,t,s,i){this.node=n,this.x0=e,this.y0=t,this.x1=s,this.y1=i}function dw(n,e,t){var s,i=this._x0,r=this._y0,a,o,l,c,d=this._x1,u=this._y1,h=[],p=this._root,f,M;for(p&&h.push(new hs(p,i,r,d,u)),t==null?t=1/0:(i=n-t,r=e-t,d=n+t,u=e+t,t*=t);f=h.pop();)if(!(!(p=f.node)||(a=f.x0)>d||(o=f.y0)>u||(l=f.x1)<i||(c=f.y1)<r))if(p.length){var g=(a+l)/2,m=(o+c)/2;h.push(new hs(p[3],g,m,l,c),new hs(p[2],a,m,g,c),new hs(p[1],g,o,l,m),new hs(p[0],a,o,g,m)),(M=(e>=m)<<1|n>=g)&&(f=h[h.length-1],h[h.length-1]=h[h.length-1-M],h[h.length-1-M]=f)}else{var _=n-+this._x.call(null,p.data),w=e-+this._y.call(null,p.data),z=_*_+w*w;if(z<t){var y=Math.sqrt(t=z);i=n-y,r=e-y,d=n+y,u=e+y,s=p.data}}return s}function uw(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,p,f,M,g,m;if(!t)return this;if(t.length)for(;;){if((f=d>=(h=(a+l)/2))?a=h:l=h,(M=u>=(p=(o+c)/2))?o=p:c=p,e=t,!(t=t[g=M<<1|f]))return this;if(!t.length)break;(e[g+1&3]||e[g+2&3]||e[g+3&3])&&(s=e,m=g)}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[g]=r:delete e[g],(t=e[0]||e[1]||e[2]||e[3])&&t===(e[3]||e[2]||e[1]||e[0])&&!t.length&&(s?s[m]=t:this._root=t),this):(this._root=r,this)}function hw(n){for(var e=0,t=n.length;e<t;++e)this.remove(n[e]);return this}function fw(){return this._root}function pw(){var n=0;return this.visit(function(e){if(!e.length)do++n;while(e=e.next)}),n}function mw(n){var e=[],t,s=this._root,i,r,a,o,l;for(s&&e.push(new hs(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 hs(i,c,d,o,l)),(i=s[2])&&e.push(new hs(i,r,d,c,l)),(i=s[1])&&e.push(new hs(i,c,a,o,d)),(i=s[0])&&e.push(new hs(i,r,a,c,d))}return this}function gw(n){var e=[],t=[],s;for(this._root&&e.push(new hs(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 hs(r,a,o,d,u)),(r=i[1])&&e.push(new hs(r,d,o,l,u)),(r=i[2])&&e.push(new hs(r,a,u,d,c)),(r=i[3])&&e.push(new hs(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 Mw(n){return n[0]}function bw(n){return arguments.length?(this._x=n,this):this._x}function _w(n){return n[1]}function zw(n){return arguments.length?(this._y=n,this):this._y}function Ou(n,e,t){var s=new xu(e??Mw,t??_w,NaN,NaN,NaN,NaN);return n==null?s:s.addAll(n)}function xu(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 kh(n){for(var e={data:n.data},t=e;n=n.next;)t=t.next={data:n.data};return e}var ps=Ou.prototype=xu.prototype;ps.copy=function(){var n=new xu(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=kh(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]=kh(s));return n};ps.add=rw;ps.addAll=aw;ps.cover=ow;ps.data=lw;ps.extent=cw;ps.find=dw;ps.remove=uw;ps.removeAll=hw;ps.root=fw;ps.size=pw;ps.visit=mw;ps.visitAfter=gw;ps.x=bw;ps.y=zw;function ww(n){const e=+this._x.call(null,n),t=+this._y.call(null,n),s=+this._z.call(null,n);return cg(this.cover(e,t,s),e,t,s,n)}function cg(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,p=n._z1,f,M,g,m,_,w,z,y,O,S,b;if(!a)return n._root=o,n;for(;a.length;)if((z=e>=(f=(l+u)/2))?l=f:u=f,(y=t>=(M=(c+h)/2))?c=M:h=M,(O=s>=(g=(d+p)/2))?d=g:p=g,r=a,!(a=a[S=O<<2|y<<1|z]))return r[S]=o,n;if(m=+n._x.call(null,a.data),_=+n._y.call(null,a.data),w=+n._z.call(null,a.data),e===m&&t===_&&s===w)return o.next=a,r?r[S]=o:n._root=o,n;do r=r?r[S]=new Array(8):n._root=new Array(8),(z=e>=(f=(l+u)/2))?l=f:u=f,(y=t>=(M=(c+h)/2))?c=M:h=M,(O=s>=(g=(d+p)/2))?d=g:p=g;while((S=O<<2|y<<1|z)===(b=(w>=g)<<2|(_>=M)<<1|m>=f));return r[b]=a,r[S]=o,n}function yw(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,p,f,M;u<e;++u)isNaN(p=+this._x.call(null,h=n[u]))||isNaN(f=+this._y.call(null,h))||isNaN(M=+this._z.call(null,h))||(t[u]=p,s[u]=f,i[u]=M,p<r&&(r=p),p>l&&(l=p),f<a&&(a=f),f>c&&(c=f),M<o&&(o=M),M>d&&(d=M));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)cg(this,t[u],s[u],i[u],n[u]);return this}function vw(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 Ow(){var n=[];return this.visit(function(e){if(!e.length)do n.push(e.data);while(e=e.next)}),n}function xw(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 It(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 Sw(n,e,t,s){var i,r=this._x0,a=this._y0,o=this._z0,l,c,d,u,h,p,f=this._x1,M=this._y1,g=this._z1,m=[],_=this._root,w,z;for(_&&m.push(new It(_,r,a,o,f,M,g)),s==null?s=1/0:(r=n-s,a=e-s,o=t-s,f=n+s,M=e+s,g=t+s,s*=s);w=m.pop();)if(!(!(_=w.node)||(l=w.x0)>f||(c=w.y0)>M||(d=w.z0)>g||(u=w.x1)<r||(h=w.y1)<a||(p=w.z1)<o))if(_.length){var y=(l+u)/2,O=(c+h)/2,S=(d+p)/2;m.push(new It(_[7],y,O,S,u,h,p),new It(_[6],l,O,S,y,h,p),new It(_[5],y,c,S,u,O,p),new It(_[4],l,c,S,y,O,p),new It(_[3],y,O,d,u,h,S),new It(_[2],l,O,d,y,h,S),new It(_[1],y,c,d,u,O,S),new It(_[0],l,c,d,y,O,S)),(z=(t>=S)<<2|(e>=O)<<1|n>=y)&&(w=m[m.length-1],m[m.length-1]=m[m.length-1-z],m[m.length-1-z]=w)}else{var b=n-+this._x.call(null,_.data),v=e-+this._y.call(null,_.data),E=t-+this._z.call(null,_.data),A=b*b+v*v+E*E;if(A<s){var I=Math.sqrt(s=A);r=n-I,a=e-I,o=t-I,f=n+I,M=e+I,g=t+I,i=_.data}}return i}const Ew=(n,e,t,s,i,r)=>Math.sqrt((n-s)**2+(e-i)**2+(t-r)**2);function Aw(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,p,f,M,g,m)=>{if(!u.length)do{const _=u.data;Ew(n,e,t,this._x(_),this._y(_),this._z(_))<=s&&i.push(_)}while(u=u.next);return h>l||p>c||f>d||M<r||g<a||m<o}),i}function Dw(n){if(isNaN(h=+this._x.call(null,n))||isNaN(p=+this._y.call(null,n))||isNaN(f=+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,p,f,M,g,m,_,w,z,y,O;if(!t)return this;if(t.length)for(;;){if((_=h>=(M=(a+c)/2))?a=M:c=M,(w=p>=(g=(o+d)/2))?o=g:d=g,(z=f>=(m=(l+u)/2))?l=m:u=m,e=t,!(t=t[y=z<<2|w<<1|_]))return this;if(!t.length)break;(e[y+1&7]||e[y+2&7]||e[y+3&7]||e[y+4&7]||e[y+5&7]||e[y+6&7]||e[y+7&7])&&(s=e,O=y)}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[y]=r:delete e[y],(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[O]=t:this._root=t),this):(this._root=r,this)}function Tw(n){for(var e=0,t=n.length;e<t;++e)this.remove(n[e]);return this}function Iw(){return this._root}function Gw(){var n=0;return this.visit(function(e){if(!e.length)do++n;while(e=e.next)}),n}function Rw(n){var e=[],t,s=this._root,i,r,a,o,l,c,d;for(s&&e.push(new It(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,p=(o+d)/2;(i=s[7])&&e.push(new It(i,u,h,p,l,c,d)),(i=s[6])&&e.push(new It(i,r,h,p,u,c,d)),(i=s[5])&&e.push(new It(i,u,a,p,l,h,d)),(i=s[4])&&e.push(new It(i,r,a,p,u,h,d)),(i=s[3])&&e.push(new It(i,u,h,o,l,c,p)),(i=s[2])&&e.push(new It(i,r,h,o,u,c,p)),(i=s[1])&&e.push(new It(i,u,a,o,l,h,p)),(i=s[0])&&e.push(new It(i,r,a,o,u,h,p))}return this}function Nw(n){var e=[],t=[],s;for(this._root&&e.push(new It(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,p=(o+d)/2,f=(l+u)/2;(r=i[0])&&e.push(new It(r,a,o,l,h,p,f)),(r=i[1])&&e.push(new It(r,h,o,l,c,p,f)),(r=i[2])&&e.push(new It(r,a,p,l,h,d,f)),(r=i[3])&&e.push(new It(r,h,p,l,c,d,f)),(r=i[4])&&e.push(new It(r,a,o,f,h,p,u)),(r=i[5])&&e.push(new It(r,h,o,f,c,p,u)),(r=i[6])&&e.push(new It(r,a,p,f,h,d,u)),(r=i[7])&&e.push(new It(r,h,p,f,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 Bw(n){return n[0]}function Cw(n){return arguments.length?(this._x=n,this):this._x}function Pw(n){return n[1]}function Lw(n){return arguments.length?(this._y=n,this):this._y}function Ww(n){return n[2]}function kw(n){return arguments.length?(this._z=n,this):this._z}function Su(n,e,t,s){var i=new Eu(e??Bw,t??Pw,s??Ww,NaN,NaN,NaN,NaN,NaN,NaN);return n==null?i:i.addAll(n)}function Eu(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 Uh(n){for(var e={data:n.data},t=e;n=n.next;)t=t.next={data:n.data};return e}var ns=Su.prototype=Eu.prototype;ns.copy=function(){var n=new Eu(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=Uh(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]=Uh(s));return n};ns.add=ww;ns.addAll=yw;ns.cover=vw;ns.data=Ow;ns.extent=xw;ns.find=Sw;ns.findAllWithinRadius=Aw;ns.remove=Dw;ns.removeAll=Tw;ns.root=Iw;ns.size=Gw;ns.visit=Rw;ns.visitAfter=Nw;ns.x=Cw;ns.y=Lw;ns.z=kw;function Xt(n){return function(){return n}}function Gs(n){return(n()-.5)*1e-6}function Wl(n){return n.x+n.vx}function Fh(n){return n.y+n.vy}function Uw(n){return n.z+n.vz}function Zn(n){var e,t,s,i,r=1,a=1;typeof n!="function"&&(n=Xt(n==null?1:+n));function o(){for(var d,u=e.length,h,p,f,M,g,m,_,w=0;w<a;++w)for(h=(t===1?yu(e,Wl):t===2?Ou(e,Wl,Fh):t===3?Su(e,Wl,Fh,Uw):null).visitAfter(l),d=0;d<u;++d)p=e[d],m=s[p.index],_=m*m,f=p.x+p.vx,t>1&&(M=p.y+p.vy),t>2&&(g=p.z+p.vz),h.visit(z);function z(y,O,S,b,v,E,A){var I=[O,S,b,v,E,A],G=I[0],C=I[1],B=I[2],P=I[t],L=I[t+1],H=I[t+2],X=y.data,oe=y.r,J=m+oe;if(X){if(X.index>p.index){var ce=f-X.x-X.vx,We=t>1?M-X.y-X.vy:0,qe=t>2?g-X.z-X.vz:0,Pe=ce*ce+We*We+qe*qe;Pe<J*J&&(ce===0&&(ce=Gs(i),Pe+=ce*ce),t>1&&We===0&&(We=Gs(i),Pe+=We*We),t>2&&qe===0&&(qe=Gs(i),Pe+=qe*qe),Pe=(J-(Pe=Math.sqrt(Pe)))/Pe*r,p.vx+=(ce*=Pe)*(J=(oe*=oe)/(_+oe)),t>1&&(p.vy+=(We*=Pe)*J),t>2&&(p.vz+=(qe*=Pe)*J),X.vx-=ce*(J=1-J),t>1&&(X.vy-=We*J),t>2&&(X.vz-=qe*J))}return}return G>f+J||P<f-J||t>1&&(C>M+J||L<M-J)||t>2&&(B>g+J||H<g-J)}}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:Xt(+d),c(),o):n},o}function Fw(n){return n.index}function jh(n,e){var t=n.get(e);if(!t)throw new Error("node not found: "+e);return t}function Ni(n){var e=Fw,t=h,s,i=Xt(30),r,a,o,l,c,d,u=1;n==null&&(n=[]);function h(m){return 1/Math.min(l[m.source.index],l[m.target.index])}function p(m){for(var _=0,w=n.length;_<u;++_)for(var z=0,y,O,S,b=0,v=0,E=0,A,I;z<w;++z)y=n[z],O=y.source,S=y.target,b=S.x+S.vx-O.x-O.vx||Gs(d),o>1&&(v=S.y+S.vy-O.y-O.vy||Gs(d)),o>2&&(E=S.z+S.vz-O.z-O.vz||Gs(d)),A=Math.sqrt(b*b+v*v+E*E),A=(A-r[z])/A*m*s[z],b*=A,v*=A,E*=A,S.vx-=b*(I=c[z]),o>1&&(S.vy-=v*I),o>2&&(S.vz-=E*I),O.vx+=b*(I=1-I),o>1&&(O.vy+=v*I),o>2&&(O.vz+=E*I)}function f(){if(a){var m,_=a.length,w=n.length,z=new Map(a.map((O,S)=>[e(O,S,a),O])),y;for(m=0,l=new Array(_);m<w;++m)y=n[m],y.index=m,typeof y.source!="object"&&(y.source=jh(z,y.source)),typeof y.target!="object"&&(y.target=jh(z,y.target)),l[y.source.index]=(l[y.source.index]||0)+1,l[y.target.index]=(l[y.target.index]||0)+1;for(m=0,c=new Array(w);m<w;++m)y=n[m],c[m]=l[y.source.index]/(l[y.source.index]+l[y.target.index]);s=new Array(w),M(),r=new Array(w),g()}}function M(){if(a)for(var m=0,_=n.length;m<_;++m)s[m]=+t(n[m],m,n)}function g(){if(a)for(var m=0,_=n.length;m<_;++m)r[m]=+i(n[m],m,n)}return p.initialize=function(m,..._){a=m,d=_.find(w=>typeof w=="function")||Math.random,o=_.find(w=>[1,2,3].includes(w))||2,f()},p.links=function(m){return arguments.length?(n=m,f(),p):n},p.id=function(m){return arguments.length?(e=m,p):e},p.iterations=function(m){return arguments.length?(u=+m,p):u},p.strength=function(m){return arguments.length?(t=typeof m=="function"?m:Xt(+m),M(),p):t},p.distance=function(m){return arguments.length?(i=typeof m=="function"?m:Xt(+m),g(),p):i},p}var jw={value:()=>{}};function dg(){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 vo(t)}function vo(n){this._=n}function $w(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}})}vo.prototype=dg.prototype={constructor:vo,on:function(n,e){var t=this._,s=$w(n+"",t),i,r=-1,a=s.length;if(arguments.length<2){for(;++r<a;)if((i=(n=s[r]).type)&&(i=Vw(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]=$h(t[i],n.name,e);else if(e==null)for(i in t)t[i]=$h(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 vo(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 Vw(n,e){for(var t=0,s=n.length,i;t<s;++t)if((i=n[t]).name===e)return i.value}function $h(n,e,t){for(var s=0,i=n.length;s<i;++s)if(n[s].name===e){n[s]=jw,n=n.slice(0,s).concat(n.slice(s+1));break}return t!=null&&n.push({name:e,value:t}),n}var Ar=0,ca=0,$r=0,ug=1e3,Ko,da,Yo=0,Bi=0,gl=0,wa=typeof performance=="object"&&performance.now?performance:Date,hg=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(n){setTimeout(n,17)};function fg(){return Bi||(hg(Hw),Bi=wa.now()+gl)}function Hw(){Bi=0}function ad(){this._call=this._time=this._next=null}ad.prototype=pg.prototype={constructor:ad,restart:function(n,e,t){if(typeof n!="function")throw new TypeError("callback is not a function");t=(t==null?fg():+t)+(e==null?0:+e),!this._next&&da!==this&&(da?da._next=this:Ko=this,da=this),this._call=n,this._time=t,od()},stop:function(){this._call&&(this._call=null,this._time=1/0,od())}};function pg(n,e,t){var s=new ad;return s.restart(n,e,t),s}function qw(){fg(),++Ar;for(var n=Ko,e;n;)(e=Bi-n._time)>=0&&n._call.call(void 0,e),n=n._next;--Ar}function Vh(){Bi=(Yo=wa.now())+gl,Ar=ca=0;try{qw()}finally{Ar=0,Kw(),Bi=0}}function Xw(){var n=wa.now(),e=n-Yo;e>ug&&(gl-=e,Yo=n)}function Kw(){for(var n,e=Ko,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:Ko=t);da=n,od(s)}function od(n){if(!Ar){ca&&(ca=clearTimeout(ca));var e=n-Bi;e>24?(n<1/0&&(ca=setTimeout(Vh,n-wa.now()-gl)),$r&&($r=clearInterval($r))):($r||(Yo=wa.now(),$r=setInterval(Xw,ug)),Ar=1,hg(Vh))}}const Yw=1664525,Zw=1013904223,Hh=4294967296;function Qw(){let n=1;return()=>(n=(Yw*n+Zw)%Hh)/Hh}var qh=3;function kl(n){return n.x}function Xh(n){return n.y}function Jw(n){return n.z}var ey=10,ty=Math.PI*(3-Math.sqrt(5)),sy=Math.PI*20/(9+Math.sqrt(221));function Qn(n,e){e=e||2;var t=Math.min(qh,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=pg(p),u=dg("tick","end"),h=Qw();n==null&&(n=[]);function p(){f(),u.call("tick",s),i<r&&(d.stop(),u.call("end",s))}function f(m){var _,w=n.length,z;m===void 0&&(m=1);for(var y=0;y<m;++y)for(i+=(o-i)*a,c.forEach(function(O){O(i)}),_=0;_<w;++_)z=n[_],z.fx==null?z.x+=z.vx*=l:(z.x=z.fx,z.vx=0),t>1&&(z.fy==null?z.y+=z.vy*=l:(z.y=z.fy,z.vy=0)),t>2&&(z.fz==null?z.z+=z.vz*=l:(z.z=z.fz,z.vz=0));return s}function M(){for(var m=0,_=n.length,w;m<_;++m){if(w=n[m],w.index=m,w.fx!=null&&(w.x=w.fx),w.fy!=null&&(w.y=w.fy),w.fz!=null&&(w.z=w.fz),isNaN(w.x)||t>1&&isNaN(w.y)||t>2&&isNaN(w.z)){var z=ey*(t>2?Math.cbrt(.5+m):t>1?Math.sqrt(.5+m):m),y=m*ty,O=m*sy;t===1?w.x=z:t===2?(w.x=z*Math.cos(y),w.y=z*Math.sin(y)):(w.x=z*Math.sin(y)*Math.cos(O),w.y=z*Math.cos(y),w.z=z*Math.sin(y)*Math.sin(O))}(isNaN(w.vx)||t>1&&isNaN(w.vy)||t>2&&isNaN(w.vz))&&(w.vx=0,t>1&&(w.vy=0),t>2&&(w.vz=0))}}function g(m){return m.initialize&&m.initialize(n,h,t),m}return M(),s={tick:f,restart:function(){return d.restart(p),s},stop:function(){return d.stop(),s},numDimensions:function(m){return arguments.length?(t=Math.min(qh,Math.max(1,Math.round(m))),c.forEach(g),s):t},nodes:function(m){return arguments.length?(n=m,M(),c.forEach(g),s):n},alpha:function(m){return arguments.length?(i=+m,s):i},alphaMin:function(m){return arguments.length?(r=+m,s):r},alphaDecay:function(m){return arguments.length?(a=+m,s):+a},alphaTarget:function(m){return arguments.length?(o=+m,s):o},velocityDecay:function(m){return arguments.length?(l=1-m,s):1-l},randomSource:function(m){return arguments.length?(h=m,c.forEach(g),s):h},force:function(m,_){return arguments.length>1?(_==null?c.delete(m):c.set(m,g(_)),s):c.get(m)},find:function(){var m=Array.prototype.slice.call(arguments),_=m.shift()||0,w=(t>1?m.shift():null)||0,z=(t>2?m.shift():null)||0,y=m.shift()||1/0,O=0,S=n.length,b,v,E,A,I,G;for(y*=y,O=0;O<S;++O)I=n[O],b=_-I.x,v=w-(I.y||0),E=z-(I.z||0),A=b*b+v*v+E*E,A<y&&(G=I,y=A);return G},on:function(m,_){return arguments.length>1?(u.on(m,_),s):u.on(m)}}}function Jn(){var n,e,t,s,i,r=Xt(-30),a,o=1,l=1/0,c=.81;function d(f){var M,g=n.length,m=(e===1?yu(n,kl):e===2?Ou(n,kl,Xh):e===3?Su(n,kl,Xh,Jw):null).visitAfter(h);for(i=f,M=0;M<g;++M)t=n[M],m.visit(p)}function u(){if(n){var f,M=n.length,g;for(a=new Array(M),f=0;f<M;++f)g=n[f],a[g.index]=+r(g,f,n)}}function h(f){var M=0,g,m,_=0,w,z,y,O,S=f.length;if(S){for(w=z=y=O=0;O<S;++O)(g=f[O])&&(m=Math.abs(g.value))&&(M+=g.value,_+=m,w+=m*(g.x||0),z+=m*(g.y||0),y+=m*(g.z||0));M*=Math.sqrt(4/S),f.x=w/_,e>1&&(f.y=z/_),e>2&&(f.z=y/_)}else{g=f,g.x=g.data.x,e>1&&(g.y=g.data.y),e>2&&(g.z=g.data.z);do M+=a[g.data.index];while(g=g.next)}f.value=M}function p(f,M,g,m,_){if(!f.value)return!0;var w=[g,m,_][e-1],z=f.x-t.x,y=e>1?f.y-t.y:0,O=e>2?f.z-t.z:0,S=w-M,b=z*z+y*y+O*O;if(S*S/c<b)return b<l&&(z===0&&(z=Gs(s),b+=z*z),e>1&&y===0&&(y=Gs(s),b+=y*y),e>2&&O===0&&(O=Gs(s),b+=O*O),b<o&&(b=Math.sqrt(o*b)),t.vx+=z*f.value*i/b,e>1&&(t.vy+=y*f.value*i/b),e>2&&(t.vz+=O*f.value*i/b)),!0;if(f.length||b>=l)return;(f.data!==t||f.next)&&(z===0&&(z=Gs(s),b+=z*z),e>1&&y===0&&(y=Gs(s),b+=y*y),e>2&&O===0&&(O=Gs(s),b+=O*O),b<o&&(b=Math.sqrt(o*b)));do f.data!==t&&(S=a[f.data.index]*i/b,t.vx+=z*S,e>1&&(t.vy+=y*S),e>2&&(t.vz+=O*S));while(f=f.next)}return d.initialize=function(f,...M){n=f,s=M.find(g=>typeof g=="function")||Math.random,e=M.find(g=>[1,2,3].includes(g))||2,u()},d.strength=function(f){return arguments.length?(r=typeof f=="function"?f:Xt(+f),u(),d):r},d.distanceMin=function(f){return arguments.length?(o=f*f,d):Math.sqrt(o)},d.distanceMax=function(f){return arguments.length?(l=f*f,d):Math.sqrt(l)},d.theta=function(f){return arguments.length?(c=f*f,d):Math.sqrt(c)},d}function Au(n){var e=Xt(.1),t,s,i;typeof n!="function"&&(n=Xt(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:Xt(+o),a(),r):e},r.x=function(o){return arguments.length?(n=typeof o=="function"?o:Xt(+o),a(),r):n},r}function Du(n){var e=Xt(.1),t,s,i;typeof n!="function"&&(n=Xt(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:Xt(+o),a(),r):e},r.y=function(o){return arguments.length?(n=typeof o=="function"?o:Xt(+o),a(),r):n},r}function Tu(n){var e=Xt(.1),t,s,i;typeof n!="function"&&(n=Xt(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:Xt(+o),a(),r):e},r.z=function(o){return arguments.length?(n=typeof o=="function"?o:Xt(+o),a(),r):n},r}function ny(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 iy(n){let e=n>>>0;return()=>(e=Math.imul(e,1664525)+1013904223>>>0,e/4294967296)}function Dr(n){return iy(ny(n))}const Us=.55,ry=12,ay=60,Ul=60;function oy(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 ly(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 cy(n,e,t){const s=f=>Math.hypot(f[0],f[1],f[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],p=[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+p[0]*c+u[0]*h*(1-d),n[1]*d+p[1]*c+u[1]*h*(1-d),n[2]*d+p[2]*c+u[2]*h*(1-d)]}function Kh(n,e,t){if(e.length===0)return n;let s=0;for(const i of e)s+=t.get(i.id.slice(6))??Us;return s/=e.length,Math.max(n+2,Math.sqrt(e.length)*s*1.6)}function Fl(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 Iu(n,e,t=()=>{},s="clumps",i=Dr){const r=new Map(n.map(G=>[G.id,G])),a=new Map,o=[];for(const G of n)G.group===null?o.push(G):a.set(G.group,[...a.get(G.group)??[],G]);const l=new Map,c=new Map,d=new Map,u=new Set;let h=0;const p=Math.max(1,a.size),f=new Map;for(const[G,C]of a){const B=C.filter(J=>J.seed!==void 0),P=[0,0,0];for(const J of B)P[0]+=J.seed[0],P[1]+=J.seed[1],P[2]+=J.seed[2];B.length>0&&(P[0]/=B.length,P[1]/=B.length,P[2]/=B.length,d.set(G,P)),C.every(J=>J.frozen===!0&&J.seed!==void 0)&&u.add(G);const L=new Map,H=B.length===0?oy(C):null,X=H===null?void 0:f.get(H);if(B.length===C.length)for(const J of C)L.set(J.id,[J.seed[0]-P[0],J.seed[1]-P[1],J.seed[2]-P[2]]);else if(X!==void 0){const J=i(G),ce=J()*Math.PI*2,We=(J()-.5)*Math.PI;C.forEach((qe,Pe)=>{L.set(qe.id,ly(X[Pe]??[0,0,0],ce,We))})}else{const J=C.map(ae=>{const ue={id:ae.id,r:ae.radius};return ae.seed!==void 0&&(ue.x=ae.seed[0]-P[0],ue.y=ae.seed[1]-P[1],ue.z=ae.seed[2]-P[2],ae.frozen===!0&&(ue.fx=ue.x,ue.fy=ue.y,ue.fz=ue.z)),ue}),ce=new Set(C.map(ae=>ae.id)),We=[];for(const ae of C)for(const ue of ae.parents)ce.has(ue)&&We.push({source:ue,target:ae.id});const qe=new Map(C.map(ae=>[ae.id,ae.radius])),Pe=Qn(J,3).force("link",Ni(We).id(ae=>ae.id).distance(e.link?ae=>(qe.get(ae.source.id)??Us)+(qe.get(ae.target.id)??Us)+1.4:2.2)).force("charge",Jn().strength(ae=>e.charge?-6*(ae.r/Us)**2:-6).distanceMax(ry)).force("center",xi(0,0,0)).stop();e.collide&&Pe.force("collide",Zn().radius(ae=>ae.r*1.2));for(let ae=0;ae<ay;ae++)Pe.tick();const ne=[0,0,0];for(const ae of J)ne[0]+=ae.x??0,ne[1]+=ae.y??0,ne[2]+=ae.z??0;ne[0]/=J.length,ne[1]/=J.length,ne[2]/=J.length;for(const ae of J)L.set(ae.id,[(ae.x??0)-ne[0],(ae.y??0)-ne[1],(ae.z??0)-ne[2]]);H!==null&&f.set(H,C.map(ae=>L.get(ae.id)??[0,0,0]))}let oe=Us;for(const J of C){const ce=L.get(J.id)??[0,0,0];l.set(J.id,ce),oe=Math.max(oe,Math.hypot(ce[0],ce[1],ce[2])+J.radius)}c.set(G,oe),h+=1,h%50===0&&t(.3*(h/p))}t(.3);const M=G=>{const C=r.get(G);return C!==void 0&&C.group!==null?`group:${C.group}`:G},g=[],m=new Map;let _=!1;for(const[G]of a){const C=`group:${G}`,B=c.get(G)??Us,P={id:C,r:B},L=d.get(G);L!==void 0&&(P.x=L[0],P.y=L[1],P.z=L[2],u.has(G)&&(P.fx=L[0],P.fy=L[1],P.fz=L[2],_=!0)),m.set(C,B),g.push(P)}for(const G of o){const C={id:G.id,r:G.radius};G.seed!==void 0&&(C.x=G.seed[0],C.y=G.seed[1],C.z=G.seed[2],G.frozen===!0&&(C.fx=G.seed[0],C.fy=G.seed[1],C.fz=G.seed[2],_=!0)),m.set(G.id,G.radius),g.push(C)}const w=new Set,z=[];for(const G of n)for(const C of G.parents){if(!r.has(C))continue;const B=M(C),P=M(G.id);if(B===P)continue;const L=`${B}\0${P}`;w.has(L)||(w.add(L),z.push({source:B,target:P}))}const y=new Map;for(const G of z)if(G.source.startsWith("group:")!==G.target.startsWith("group:")){const C=G.source.startsWith("group:")?G.source:G.target,B=G.source.startsWith("group:")?G.target:G.source;y.has(C)||y.set(C,B)}const O=new Map;for(const G of g){const C=y.get(G.id);C!==void 0&&O.set(C,[...O.get(C)??[],G])}const S=g.reduce((G,C)=>G+C.r*C.r,0),b=g.filter(G=>!G.id.startsWith("group:"));b.forEach((G,C)=>{if(G.x!==void 0)return;const[B,P,L]=Fl(C,b.length,Math.sqrt(S)*1.2+10);G.x=B,G.y=P,G.z=L});for(const[G,C]of O){const B=g.find(L=>L.id===G),P=Math.sqrt(C.reduce((L,H)=>L+H.r*H.r,0))*1.4+2;C.forEach((L,H)=>{if(L.x!==void 0)return;const[X,oe,J]=Fl(H,C.length,P);L.x=(B?.x??0)+X,L.y=(B?.y??0)+oe,L.z=(B?.z??0)+J})}const v=new Set;if(s==="spokes"){const G=B=>{const P=a.get(B)??[],L=new Set(P.map(X=>X.id)),H=P.find(X=>X.parents.some(oe=>!L.has(oe)))??P[0];return H===void 0?[0,0,0]:l.get(H.id)??[0,0,0]},C=[];for(const B of g){if(B.id.startsWith("group:")&&y.has(B.id)){v.add(B.id);continue}if(B.id.startsWith("group:"))C.push(B);else{const P=O.get(B.id)??[];let L=B.r;const H=Kh(B.r,P,c);for(const X of P){const oe=X.id.slice(6),J=G(oe);L=Math.max(L,H+Math.hypot(J[0],J[1],J[2])+2*(c.get(oe)??Us))}C.push({id:B.id,r:L,x:B.x,y:B.y,z:B.z,...B.fx!==void 0?{fx:B.fx,fy:B.fy,fz:B.fz}:{}})}}if(!C.every(B=>B.fx!==void 0)){const B=Qn(C,3).force("charge",Jn().strength(P=>-1.5*P.r)).force("collide",Zn().radius(P=>P.r*.9)).stop();_||B.force("center",xi(0,0,0));for(let P=0;P<Ul;P++)B.tick(),P%5===0&&t(.3+.7*(P/Ul))}for(const B of C){const P=g.find(L=>L.id===B.id);P!==void 0&&P!==B&&(P.x=B.x,P.y=B.y,P.z=B.z)}for(const B of g){if(B.id.startsWith("group:")||!O.has(B.id))continue;const P=O.get(B.id)??[],L=Kh(B.r,P,c);P.forEach((H,X)=>{if(H.fx!==void 0||d.has(H.id.slice(6)))return;const oe=G(H.id.slice(6)),J=Fl(X,P.length,1),ce=.35+.65*(X*.6180339887%1),We=B.r+1.4+L*ce+Math.hypot(oe[0],oe[1],oe[2]);H.x=(B.x??0)+J[0]*We,H.y=(B.y??0)+J[1]*We,H.z=(B.z??0)+J[2]*We})}}if(!g.every(G=>G.fx!==void 0)&&s!=="spokes"){const G=Qn(g,3).force("link",Ni(z).id(P=>P.id).distance(e.link?P=>(m.get(P.source.id)??Us)+(m.get(P.target.id)??Us)+1.4:2.2)).stop(),C=Jn().strength(P=>e.charge?-6*(P.r/Us)**2:-6);if(e.reach!==void 0&&C.distanceMax(e.reach),G.force("charge",C),_||G.force("center",xi(0,0,0)),e.collide&&G.force("collide",Zn().radius(P=>P.r*1.05)),e.gravity){const P=L=>Math.min(1,(L.r/Us)**2*.08);G.force("gx",Au(0).strength(P)).force("gy",Du(0).strength(P)).force("gz",Tu(0).strength(P))}const B=Ul;for(let P=0;P<B;P++)G.tick(),P%5===0&&t(.3+.7*(P/B))}const A=new Map(g.map(G=>[G.id,G]));if(s==="spokes")for(const[G,C]of a){if(C.some(qe=>qe.seed!==void 0))continue;const B=`group:${G}`,P=A.get(B),L=y.get(B),H=L===void 0?void 0:A.get(L);if(P===void 0||H===void 0)continue;const X=[(P.x??0)-(H.x??0),(P.y??0)-(H.y??0),(P.z??0)-(H.z??0)],oe=new Set(C.map(qe=>qe.id)),J=C.find(qe=>qe.parents.some(Pe=>!oe.has(Pe)))??C[0],ce=l.get(J.id)??[0,0,0],We=[-ce[0],-ce[1],-ce[2]];for(const qe of C){const Pe=l.get(qe.id)??[0,0,0];l.set(qe.id,cy(Pe,We,X))}}const I={};for(const G of n){const C=A.get(M(G.id)),B=[C?.x??0,C?.y??0,C?.z??0],P=G.group===null?[0,0,0]:l.get(G.id)??[0,0,0];I[G.id]=[B[0]+P[0],B[1]+P[1],B[2]+P[2]]}return t(1),I}const Yh=80;function mg(n,e,t=()=>{},s=Dr){const i=n.some(h=>h.seed===void 0),r=i?Iu(n,e,h=>t(.05*h),"spokes",s):{};t(.05);const a=n.map(h=>{const p=h.seed??r[h.id],f={id:h.id,r:h.radius};return p!==void 0&&(f.x=p[0],f.y=p[1],f.z=p[2],h.frozen===!0&&h.seed!==void 0&&(f.fx=p[0],f.fy=p[1],f.fz=p[2])),f}),o=new Set(n.map(h=>h.id)),l=[];for(const h of n)for(const p of h.parents)o.has(p)&&l.push({source:p,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=Qn(a,3).force("link",Ni(l).id(f=>f.id).distance(e.link?f=>(c.get(f.source.id)??Tt)+(c.get(f.target.id)??Tt)+1.4:2.2)).stop(),p=Jn().strength(f=>e.charge?-6*(f.r/Tt)**2:-6);if(e.reach!==void 0&&p.distanceMax(e.reach),h.force("charge",p),d||h.force("center",xi(0,0,0)),e.collide&&h.force("collide",Zn().radius(f=>f.r*1.2)),e.gravity){const f=M=>(M.r/Tt)**2*.08;h.force("gx",Au(0).strength(f)).force("gy",Du(0).strength(f)).force("gz",Tu(0).strength(f))}i&&h.alpha(.6);for(let f=0;f<Yh;f++)h.tick(),f%2===0&&t(.05+.95*(f/Yh))}const u={};for(const h of a)u[h.id]=[h.x??0,h.y??0,h.z??0];return t(1),u}function gg(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 Mg(n){const e=gg(n),t=Math.max(...e,1);return new Map(n.map((s,i)=>[s.id,Tt*(.5+(e[i]??1)/t*1.2)]))}function bg(n,e=3,t=new Map,s=ii,i=new Set){const r=[];for(const _ of n)for(const w of _.parents)r.push({source:w,target:_.id});const a=gg(n),o=Math.max(...a,1),l=a.map(_=>Tt*(.5+_/o*1.2)),c=new Map(n.map((_,w)=>[_.id,l[w]??Tt])),d=n.map(_=>{const w=t.get(_.id);return w===void 0?{id:_.id}:i.has(_.id)?{id:_.id,x:w[0],y:w[1],z:w[2],fx:w[0],fy:w[1],fz:w[2]}:{id:_.id,x:w[0],y:w[1],z:w[2]}}),u=_=>i.has(_.id)&&_.fx!==void 0;let h=d,p=r;if(i.size>0){const _=new Set(d.filter(y=>!u(y)).map(y=>y.id));p=r.filter(y=>_.has(y.source)||_.has(y.target));const w=new Set(_);for(const y of p)w.add(y.source),w.add(y.target);h=d.filter(y=>w.has(y.id));const z=new Set(h.map(y=>y.id));p=p.filter(y=>z.has(y.source)&&z.has(y.target))}const f=Jn().strength(s.charge?_=>i.has(_.id)?0:-6*((c.get(_.id)??Tt)/Tt)**2:_=>i.has(_.id)?0:-6);s.reach!==void 0&&f.distanceMax(s.reach);const M=Qn(h,e).force("link",Ni(p).id(_=>_.id).distance(s.link?_=>(c.get(_.source.id)??Tt)+(c.get(_.target.id)??Tt)+1.4:2.2)).force("charge",f).stop();if(i.size===0&&M.force("center",e===2?xi(0,0):xi(0,0,0)),s.collide&&M.force("collide",Zn().radius(_=>(c.get(_.id)??Tt)*1.2)),s.gravity){const _=w=>((c.get(w.id)??Tt)/Tt)**2*.08;M.force("gx",Au(0).strength(_)).force("gy",Du(0).strength(_)),e===3&&M.force("gz",Tu(0).strength(_))}const g=h.length===0?0:t.size>0?90:150;let m=0;return{total:g,moving:h.length,step:_=>{for(let w=0;w<_&&m<g;w++,m++)M.tick()},place:()=>n.map((_,w)=>{const z=d[w];return{id:_.id,position:[z?.x??0,z?.y??0,z?.z??0],radius:l[w]??Tt}})}}function dy(n,e=3,t=new Map,s=ii,i=new Set){const r=bg(n,e,t,s,i);return r.step(r.total),r.place()}function uy(n,e,t=new Map,s=new Set){const i=Mg(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)??Tt,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 Zh=160,Qh=120,Jh=5,hy=.9,ef=.3,fy=.9;function _g(n,e){const t=new Map;for(const[s,i]of n)t.set(s,e===0||i/e>fy?0:Math.log(e/Math.max(1,i)));return t}function py(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 v=s(b);b.group===null||v===null||!a.has(v)||l.set(b.group,(l.get(b.group)??new Set).add(v))}const c=new Map;for(const b of l.values())for(const v of b)c.set(v,(c.get(v)??0)+1);const d=_g(c,l.size),u=Math.max(1e-9,...d.values()),h=new Map;for(const b of l.values()){const v=[...b].sort();for(let E=0;E<v.length;E++)for(let A=E+1;A<v.length;A++){const I=`${v[E]}\0${v[A]}`;h.set(I,(h.get(I)??0)+1)}}const p=Math.max(6,Math.sqrt(r.length)*4,Math.sqrt(o.length)*1.6),f=r.map(b=>tf(b,p,Dr(`star:${b.id}`))),M=[];for(const[b,v]of h){const[E,A]=b.split("\0"),I=Math.min(c.get(E)??1,c.get(A)??1);M.push({source:a.get(E).id,target:a.get(A).id,share:v/Math.max(1,I)})}if(f.length>0&&f.some(b=>b.fx===void 0)){const b=Qn(f,3).force("link",Ni(M).id(v=>v.id).distance(v=>p*(1.1-Number(v.share))).strength(v=>.05+.6*Number(v.share))).force("charge",Jn().strength(-30).distanceMax(p*3)).force("collide",Zn().radius(v=>v.r*3)).force("center",xi(0,0,0)).stop();for(let v=0;v<Zh;v++)b.tick(),v%4===0&&t(.4*(v/Zh))}const g=new Map(f.map(b=>[b.id,[b.x??0,b.y??0,b.z??0]]));t(.4);const m=[...f.map(b=>({...b,fx:b.x??0,fy:b.y??0,fz:b.z??0})),...o.map(b=>{const v=s(b),E=v===null?void 0:a.get(v),A=E===void 0?void 0:g.get(E.id);return tf(b,2,Dr(`stage:${b.id}`),A)})],_=new Set(n.map(b=>b.id)),w=new Map(n.map(b=>[b.id,b.radius])),z=[];for(const b of o){for(const G of b.parents)_.has(G)&&z.push({source:G,target:b.id,strength:1,length:(w.get(G)??Tt)+b.radius+1.4});const v=s(b),E=v===null?void 0:a.get(v),A=v===null?0:d.get(v)??0,I=b.group===null?1:Math.max(1,l.get(b.group)?.size??1);if(E!==void 0&&A>0){const G=A/u,C=(ef+(hy-ef)*G)/Math.sqrt(I);z.push({source:E.id,target:b.id,strength:C,length:E.radius+b.radius+1})}}const y=Qn(m,3).force("link",Ni(z).id(b=>b.id).distance(b=>Number(b.length)).strength(b=>Number(b.strength))).stop();if(e.charge){const b=Jn().strength(v=>-6*(v.r/Tt)**2);b.distanceMax(Math.min(e.reach??Jh,Jh)),y.force("charge",b)}e.collide&&y.force("collide",Zn().radius(b=>b.r*1.2));const O=m.some(b=>b.fx===void 0);for(let b=0;O&&b<Qh;b++)y.tick(),b%4===0&&t(.4+.6*(b/Qh));const S={};for(const b of m)S[b.id]=[b.x??0,b.y??0,b.z??0];return t(1),S}function tf(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 Tr=.4,my=400,qi=.35,gy=.01,My=3;function sf(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 nf=1.4,by=Math.PI/3;function _y(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=Si(e),p=u===0?0:d.radius*2+nf;t.set(d.id,[h[0]*p,h[1]*p,h[2]*p]),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 p of i.get(d.id)??[]){if(t.has(p.id))continue;const f=e()*by,M=zy(h,e),g=zg([h[0]*Math.cos(f)+M[0]*Math.sin(f),h[1]*Math.cos(f)+M[1]*Math.sin(f),h[2]*Math.cos(f)+M[2]*Math.sin(f)]),m=d.radius+p.radius+nf;t.set(p.id,[u[0]+g[0]*m,u[1]+g[1]*m,u[2]+g[2]*m]),a.set(p.id,g),o.push(p)}}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=Tt;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 zg(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 zy(n,e){const t=Math.abs(n[0])<.9?[1,0,0]:[0,1,0],s=zg([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 Si(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 wy{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+Tr;Math.hypot(e[0]-d.centre[0],e[1]-d.centre[1],e[2]-d.centre[2])<u&&s.push(d)}return s}}function rf(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?Si(s):[i[0]/r,i[1]/r,i[2]/r];const a=t+n.particle.radius+Tr;return[n.centre[0]+i[0]*a,n.centre[1]+i[1]*a,n.centre[2]+i[2]*a]}function yy(n,e,t=()=>{}){const s={},i={};if(n.length>0&&n.every(f=>f.frozen===!0&&f.seed!==void 0)){for(const f of n)s[f.id]=f.seed;return t(1),{positions:s,arrival:i}}const r=new Map;for(const f of n){if(f.group===null){s[f.id]=[0,0,0];continue}r.set(f.group,[...r.get(f.group)??[],f])}const a=[...r].map(([f,M])=>{const g=new Set;let m=Number.POSITIVE_INFINITY;for(const z of M){const y=z.attrs?.plugin;typeof y=="string"&&g.add(y);const O=z.attrs?.createdAt;typeof O=="number"&&O<m&&(m=O)}if(M.every(z=>z.frozen===!0&&z.seed!==void 0)){const z=M.map(b=>b.seed),y=[0,1,2].map(b=>z.reduce((v,E)=>v+E[b],0)/z.length),O=new Map;let S=Tt;for(const b of M){const v=b.seed,E=[v[0]-y[0],v[1]-y[1],v[2]-y[2]];O.set(b.id,E),S=Math.max(S,Math.hypot(E[0],E[1],E[2])+b.radius)}return{key:f,nodes:M,plugins:g,created:m,local:O,radius:S,held:!0,centre:y}}const{local:_,radius:w}=_y(M,Dr(`turn:${f}`));return{key:f,nodes:M,plugins:g,created:m,local:_,radius:w,held:!1}});a.sort((f,M)=>f.created-M.created||(f.key<M.key?-1:f.key>M.key?1:0));const o=new Map;for(const f of a)for(const M of f.plugins)o.set(M,(o.get(M)??0)+1);const l=_g(o,a.length),c=Math.max(Tt,...a.map(f=>f.radius)),d=new wy(2*c+Tr),u=[];let h=0;const p=(f,M,g)=>{const m={particle:f,centre:g};u.push(m),d.add(m),h=Math.max(h,Math.hypot(g[0],g[1],g[2])+f.radius);for(const _ of f.nodes){const w=f.local.get(_.id)??[0,0,0];s[_.id]=f.held&&_.seed!==void 0?_.seed:[g[0]+w[0],g[1]+w[1],g[2]+w[2]],i[_.id]=M}};return a.forEach((f,M)=>{f.held&&f.centre!==void 0&&p(f,M,f.centre)}),a.forEach((f,M)=>{if(f.held)return;const g=Dr(`accrete:${f.key}`);let m;if(u.length===0)m=[0,0,0];else{let _=u[u.length-1],w=-1;for(const v of u){const E=sf(f.plugins,v.particle.plugins,l);E>=w&&(_=v,w=E)}const z=h+My*f.radius+c,y=Math.max(.5,f.radius*.5),O=Si(g);let S=[O[0]*z,O[1]*z,O[2]*z],b=null;for(let v=0;v<my&&b===null;v++){const E=Si(g),A=[_.centre[0]-S[0],_.centre[1]-S[1],_.centre[2]-S[2]],I=Math.max(1e-9,Math.hypot(A[0],A[1],A[2])),G=[E[0]*(1-qi)+A[0]/I*qi,E[1]*(1-qi)+A[1]/I*qi,E[2]*(1-qi)+A[2]/I*qi],C=[S[0]+G[0]*y,S[1]+G[1]*y,S[2]+G[2]*y],B=d.touching(C,f.radius);if(B.length===0){if(Math.hypot(C[0],C[1],C[2])>z*2){const H=Si(g);S=[H[0]*z,H[1]*z,H[2]*z]}else S=C;continue}let P=B[0],L=-1;for(const H of B){const X=sf(f.plugins,H.particle.plugins,l);X>L&&(P=H,L=X)}if(g()<Math.max(gy,L)&&(b=rf(P,S,f.radius,g),d.touching(b,f.radius-1e-6).some(H=>H!==P&&wg(b,f.radius,H))&&(b=null)),b===null){const H=rf(P,S,f.radius,g),X=[H[0]-P.centre[0],H[1]-P.centre[1],H[2]-P.centre[2]],oe=Math.max(1e-9,Math.hypot(X[0],X[1],X[2]));S=[H[0]+X[0]/oe*y,H[1]+X[1]/oe*y,H[2]+X[2]/oe*y]}}m=b??vy(_,f.radius,d,g)}p(f,M,m),M%8===0&&t(M/Math.max(1,a.length))}),t(1),{positions:s,arrival:i}}function wg(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+Tr*.5}function vy(n,e,t,s){for(let a=0;a<8;a++)for(let o=0;o<24;o++){const l=Si(s),c=e+n.particle.radius+Tr+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=>wg(d,e,u)))return d}const i=Si(s),r=e+n.particle.radius+Tr+8*e;return[n.centre[0]+i[0]*r,n.centre[1]+i[1]*r,n.centre[2]+i[2]*r]}function yg(n){const e=new Map(n.map(f=>[f.id,f])),t=new Map,s=(f,M)=>{const g=t.get(f.id);if(g!==void 0)return g;if(M.has(f.id)||f.parentIds.length===0)return t.set(f.id,0),0;M.add(f.id);let m=0;for(const _ of f.parentIds){const w=e.get(_);w&&(m=Math.max(m,s(w,M)+1))}return t.set(f.id,m),m};for(const f of n)s(f,new Set);const i=new Map,r=[],a=(f,M)=>f.id.localeCompare(M.id,void 0,{numeric:!0});for(const f of n){const M=f.parentIds.find(m=>e.has(m));if(M===void 0){r.push(f);continue}const g=i.get(M)??[];g.push(f),i.set(M,g)}r.sort(a);for(const f of i.values())f.sort(a);const o=new Map;let l=0;const c=new Set,d=f=>{c.add(f.id);const M=(i.get(f.id)??[]).filter(w=>!c.has(w.id));if(M.length===0){const w=l++;return o.set(f.id,w),[w,w]}let g=Number.POSITIVE_INFINITY,m=Number.NEGATIVE_INFINITY;for(const w of M){const[z,y]=d(w);g=Math.min(g,z),m=Math.max(m,y)}const _=(g+m)/2;return o.set(f.id,_),[g,m]};for(const f of r)d(f);for(const f of n)o.has(f.id)||d(f);const u=Math.max(...Array.from(t.values()),0)+1,h=Math.max(l-1,0);return{placements:n.map(f=>({id:f.id,x:o.get(f.id)??0,tier:t.get(f.id)??0})),width:h,tierCount:u}}const Oy=2.6,xy=2;function Gu(n){const e=n.map(r=>r.metric??0),t=Math.max(...e,0),s=yg(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)*xy,l=((s.tierCount-1)/2-(a?.tier??0))*Oy,c=r.metric??0,d=t>0?.55+c/t*1:1,u=[o,l,0];return{id:r.id,position:u,radius:Tt*d}})}const Sy=.02;function Ey(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 Ay{nodes;grabbed;sim;constructor(e){const{ids:t,links:s}=Ey(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=Qn(this.nodes,e.dimensions).force("link",Ni(s).id(o=>o.id).distance(o=>r(o.source.id)+r(o.target.id)+1.4)).force("charge",Jn().strength(o=>-6*(r(o.id)/e.baseRadius)**2).distanceMax(12)).force("collide",Zn().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()<=Sy?!1:(this.sim.tick(),!0)}positions(){return this.nodes.map(e=>({id:e.id,position:[e.x,e.y,e.z]}))}}function Ml(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 vg(n){const e=n.attrs?.metric;return typeof e=="number"?e:void 0}function Og(n){const e={};for(const t of n)e[t.id]=t.position;return e}const Dy={id:"galaxy",label:"GALAXY",needs:[],run:(n,e)=>({positions:mg(n.nodes.map(Ml),n.physics,e)})},Ty={id:"spokes",label:"SPOKES",needs:[],run:(n,e)=>({positions:Iu(n.nodes.map(Ml),n.physics,e,"spokes")})},Iy={id:"clumps",label:"CLUMPS",needs:[],run:(n,e)=>({positions:Iu(n.nodes.map(Ml),n.physics,e,"clumps")})},Gy={id:"ranked",label:"RANKED",needs:[],run:(n,e)=>{const t=n.nodes.map(i=>{const r={id:i.id,parentIds:i.parents},a=vg(i);return a!==void 0&&(r.metric=a),r}),s=Og(Gu(t));return e(1),{positions:s}}},Ry={id:"molecule",label:"MOLECULE",needs:[],run:(n,e)=>{const t=n.nodes.map(a=>{const o={id:a.id,parents:a.parents},l=vg(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=Og(dy(t,3,s,n.physics,i));return e(1),{positions:r}}},Ny={id:"constellations",label:"CONSTELLATIONS",needs:["plugin"],run:(n,e)=>({positions:py(n.nodes,n.physics,e)})},By={id:"hubs",label:"HUBS",needs:[],run:(n,e)=>({positions:mg(n.nodes.map(Ml),n.physics,e)})},Cy={id:"accretion",label:"ACCRETION",needs:["plugin"],run:(n,e)=>yy(n.nodes,n.physics,e)},Py=[Dy,Ty,Iy,Ny,By,Cy,Gy,Ry];function Ly(n){return Py.find(e=>e.id===n)}function Wy(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]===`
21
+ <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?` ${Rh(t.current,t.unit)}/${Rh(t.total,t.unit)}`:"";if(e.labelElement.innerHTML=`${Gh(s)}<span class="argus-progress-counts">${Gh(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(),_z))}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`)}}}function zu(n){return/\dfr\b/.test(n)}function Nh(n){const e=n.trim().match(/^minmax\(\s*([^,]+?)\s*,/);return e!==null?(e[1]??"3em").trim():"3em"}const Ho="argus.columns";function Cl(){try{const n=globalThis.localStorage;return n===void 0?null:(n.getItem(`${Ho}.probe`),n)}catch{return null}}function wz(n,e,t){const s=new Map;if(n===null)return s;for(const i of t)try{const r=n.getItem(`${Ho}.${e}.${i}`),a=r===null?Number.NaN:Number(r);Number.isFinite(a)&&a>0&&s.set(i,Math.round(a))}catch{}return s}function yz(n,e,t,s){if(n!==null)try{s===null?n.removeItem(`${Ho}.${e}.${t}`):n.setItem(`${Ho}.${e}.${t}`,String(Math.round(s)))}catch{}}function vz(n){const e=getComputedStyle(n);return n.getBoundingClientRect().width+(Number.parseFloat(e.marginLeft)||0)+(Number.parseFloat(e.marginRight)||0)}function Oz(n,e,t,s=0,i=!1){if(i&&!n.expanse){const c=t>=0?t:Math.min(0,Math.max(n.floor-n.width,t));return c===0?{left:null,right:null,moved:c}:{left:Math.round(n.width+c),right:null,moved:c}}let r,a;const o=c=>t>=0?Math.max(0,Math.min(a,c)):Math.min(0,Math.max(r,c));if(e===null){r=n.floor-n.width,a=s;const c=o(t);return{left:Math.round(n.width+c),right:null,moved:c}}if(n.expanse){r=n.floor-n.width,a=e.width-e.floor;const c=o(t);return c===0?{left:null,right:null,moved:c}:{left:null,right:Math.round(e.width-c),moved:c}}if(e.expanse){r=n.floor-n.width,a=e.width-e.floor;const c=o(t);return{left:Math.round(n.width+c),right:null,moved:c}}r=n.floor-n.width,a=e.width-e.floor;const l=o(t);return l===0?{left:null,right:null,moved:l}:{left:Math.round(n.width+l),right:Math.round(e.width-l),moved:l}}const xz="roster-grip";function Sz(n,e){for(const t of n.querySelectorAll(`.${xz}`)){if(t.dataset.wired==="1")continue;t.dataset.wired="1";const s=t.closest(".roster-cap");if(s===null)continue;t.addEventListener("click",r=>{r.stopPropagation()});const i=()=>{let r=s.nextElementSibling;for(;r!==null&&!r.classList.contains("roster-cap");)r=r.nextElementSibling;if(!(r instanceof HTMLElement))return null;const a=e.key_of(r);return a===null?null:{cap:r,key:a}};t.addEventListener("dblclick",r=>{r.stopPropagation();const a=e.key_of(s),o=i();a!==null&&e.reset(a),o!==null&&e.reset(o.key)}),t.addEventListener("pointerdown",r=>{const a=e.key_of(s);if(a===null||r.button!==0)return;r.preventDefault(),r.stopPropagation();try{t.setPointerCapture(r.pointerId)}catch{}const o=r.clientX,l=(g,m)=>{const _=vz(g),w=e.floor_of(m);return{width:_,floor:w,expanse:e.expanse_is(m)&&_>w+1}},c=l(s,a),d=i(),u=d===null?null:l(d.cap,d.key);if(c.expanse&&u===null)return;const h=e.expanseSlack(),p=n.scrollWidth>n.clientWidth+1;n.classList.add("roster-sizing");const f=g=>{const m=Oz(c,u,g.clientX-o,h,p);m.left!==null&&e.size(a,m.left),m.right!==null&&d!==null&&e.size(d.key,m.right)},M=()=>{n.classList.remove("roster-sizing"),window.removeEventListener("pointermove",f),window.removeEventListener("pointerup",M),window.removeEventListener("pointercancel",M)};window.addEventListener("pointermove",f),window.addEventListener("pointerup",M),window.addEventListener("pointercancel",M)})}}function Bh(n,e){const t=n.trim().match(/^([\d.]+)\s*(px|em|rem)$/);if(t===null)return 0;const s=Number(t[1]);if(t[2]==="px")return s;const i=t[2]==="rem"?document.documentElement:e,r=Number.parseFloat(getComputedStyle(i).fontSize)||16;return s*r}class Ez{root;capsRows=[];strip;input;columns;value_of;onChange;leadingCells;terms;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,o=[]){this.terms=o,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 l=document.createElement("span");l.className="roster-filter-glyph",l.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",c=>{c.key==="Escape"&&(c.stopPropagation(),this.strip_toggle(!1))}),this.strip.append(l,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");if(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)),t!==this.columns[this.columns.length-1]){const i=document.createElement("span");i.className="roster-grip",i.title="drag to size the column; press twice to give it back",s.appendChild(i)}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=>{const s=t.key===null?void 0:this.terms.find(r=>r.key===t.key);return(s!==void 0?s.value(e).toLowerCase():t.key!==null?String(this.value_of(e,t.key)).toLowerCase():[...this.columns.map(r=>String(this.value_of(e,r.key))),...this.terms.map(r=>r.value(e))].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)||this.terms.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(l=>l.key===i),a=i===this.state.sortKey;s.classList.toggle("roster-active",a);let o=s.querySelector(".roster-cap-words");o===null&&(o=document.createElement("span"),o.className="roster-cap-words",s.prepend(o)),o.textContent=`${r?.label??i}${a?this.state.sortDir==="asc"?" ▲":" ▼":""}`}}}const Az=["state-live","state-settled","state-stale","state-wait","state-note","state-refused"];function Jt(n,e,t){n!==null&&(n.classList.remove(...Az),e!==null&&n.classList.add(`state-${e}`),t!==void 0&&(n.textContent=t))}function zr(n,e){n?.classList.remove(`state-${e}`)}function Dz(n,e,t){n?.classList.toggle(`state-${e}`,t)}class Tz{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,Hs(e,{rows:".listing-row"}),e}field_get(){return this.field}}function Iz(n){return n.map(e=>({key:e.key,label:e.label}))}function Gz(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 r instanceof Node?r.textContent??"":r==null?"":String(r)}}function Rz(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(r instanceof Node){s.appendChild(r);continue}const a=document.createElement("span");a.className=i.className,a.textContent=r==null?"":String(r),s.appendChild(a)}return t.decorate?.(s,n),s}function Ta(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 qo(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 zo(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 Nz(n,e){return n.mode==="fold"&&n.open.has(e)}function Bz(n,e){return n.mode!=="fold"||n.open.delete(e)?!1:(n.open.add(e),!0)}function Ch(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 Cz(n){let e=0;for(const t of n){if(t.capped!==!1)break;e+=1}return e}function wr(n,e){return{level_visit(t){return t(n,e)}}}function Pl(n,e,t){const s=[];let i=!1;for(const r of n){if(r.width===void 0||r.width.trim()==="")throw new Error(`listing trait '${r.key}' declares no width`);if(!Ch(r.width))throw new Error(`listing trait '${r.key}' declares a content-sized track '${r.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(r.capped===!1){if(i)throw new Error(`uncapped listing trait '${r.key}' must lead the traits`)}else i=!0;const a=t?.get(r.key);a===void 0?s.push(r.width.trim()):s.push(zu(r.width)?`minmax(${a}px, 1fr)`:`${a}px`)}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(!Ch(e.width))throw new Error(`listing actions declare a content-sized track '${e.width.trim()}'`);s.push(e.width.trim())}return s.join(" ")}let ma=new Map,wo=new Map;function Pz(n){if(ma=new Map,wo=new Map,n!==null)for(const e of n.handles)ma.has(e.address)||ma.set(e.address,e),wo.set(e.kind,Math.max(wo.get(e.kind)??0,`${e.ordinal}`.length));ig()}function ng(n){const e=Math.max(3,wo.get(n.kind)??0);return`${n.kind}${`${n.ordinal}`.padStart(e,"0")}`}function ig(){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:ma.get(a);r.textContent=o===void 0?`${i+1}`.padStart(t,"0"):ng(o),r.classList.toggle("numbered",o!==void 0)})}}function Lz(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:ma.get(s);return i!==void 0&&(t.textContent=ng(i),t.classList.add("numbered")),t}}}class wu{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:[Lz(e.address),...e.traits]},this.declaration=e,this.host=t,this.select=i,this.depth=r,this.template=Pl(e.traits,this.trackActions_get(),this.sized);const a=e.traits.filter(o=>o.capped!==!1);if(this.order=new Ez(Iz(a),Gz(e.traits),()=>this.host.repaint(),e.defaultSort,Cz(e.traits),s,e.terms??[]),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 wu(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=Pl(this.declaration.traits,this.trackActions_get(),this.sized)}sized=new Map;column_size(e,t){t===null?this.sized.delete(e):this.sized.set(e,t),this.template=Pl(this.declaration.traits,this.trackActions_get(),this.sized)}track_of(e){return this.declaration.traits.find(t=>t.key===e)?.width??null}traitKeys(){return this.declaration.traits.map(e=>e.key)}expanse_of(){const e=this.declaration.traits.find(t=>zu(t.width??""));return e===void 0?null:{key:e.key,width:e.width??""}}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=Nz(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=Rz(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(...zo(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){if(!s&&this.child!==null){Bz(this.expansion,t),this.host.repaint(),this.declaration.activate?.(e);return}this.host.activating_is(t)||(this.host.activation_begin(t,this.rowsByKey.get(t)??null,kz(t)),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([...zo(i,a).childNodes]);else{const o=this.cellsByKey.get(e);o!==void 0&&a.length>0&&o.replaceChildren(...zo(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.append(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 ni{declaration;level;host;gridHost;stateSpan;activating=null;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??Wz(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 wu(e,{repaint:()=>this.repaint_queue(),framed:()=>this.zone!==null,activating_is:s=>this.activating?.key===s,activation_begin:(s,i,r)=>this.activation_begin(s,i,r),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 Tz(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.columns_wire(t),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.activation_settle(),this.render(),this.grips_ensure()}activation_begin(e,t,s){this.activating?.element?.classList.remove("listing-activating"),this.activating={key:e,element:t},t?.classList.add("listing-activating"),Jt(this.stateSpan,"wait",`OPENING ${s}`)}activation_settle(){this.activating!==null&&(this.activating.element?.classList.remove("listing-activating"),this.activating=null,zr(this.stateSpan,"wait"))}activation_refuse(e){this.activating!==null&&(this.activation_settle(),Jt(this.stateSpan,"refused",e.toUpperCase()))}activating_get(){return this.activating?.key??null}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),ig(),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()}columnsBlock=null;columnsPrefix=null;columns_wire(e){if(this.columnsPrefix=e?.prefix??null,this.columnsBlock=e?.root.querySelector(`.${e.prefix}-columns`)??null,this.columnsBlock?.addEventListener("click",()=>this.columns_reset()),this.columnsPrefix!==null){for(const[t,s]of wz(Cl(),this.columnsPrefix,this.level.traitKeys()))this.level.column_size(t,s);this.gridHost.style.setProperty("--roster-cols",this.level.template)}this.columnsBlock_paint(),this.grips_ensure()}grips_ensure(){const e=this.declaration.mount.querySelector(".roster-order .roster-caps");if(e===null)return;const t=Cl();Sz(e,{key_of:s=>s.dataset.key??null,expanse_is:s=>zu(this.level.track_of(s)??""),floor_of:s=>Bh(Nh(this.level.track_of(s)??"3em"),e),expanseSlack:()=>{const s=this.level.expanse_of(),i=s===null?null:e.querySelector(`.roster-cap[data-key="${s.key}"]`);return i===null||s===null?0:Math.max(0,i.getBoundingClientRect().width-Bh(Nh(s.width),e))},size:(s,i)=>this.column_size(s,i,t),reset:s=>this.column_size(s,null,t)})}column_size(e,t,s){this.level.column_size(e,t),this.gridHost.style.setProperty("--roster-cols",this.level.template),this.columnsPrefix!==null&&yz(s,this.columnsPrefix,e,t),this.columnsBlock_paint()}columns_reset(){const e=Cl();for(const t of[...this.level.sized.keys()])this.column_size(t,null,e)}columns_sized(){return[...this.level.sized.keys()]}columnsBlock_paint(){if(this.columnsBlock===null)return;const e=this.level.sized.size>0;this.columnsBlock.textContent=e?"COLUMNS · SIZED":"COLUMNS",this.columnsBlock.classList.toggle("rail-off",!e),this.columnsBlock.title=e?"columns sized by hand; press to give them all back":"drag a cap's edge to size its column; a double-press gives one back"}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?[]:[...zo(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.append(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):Uz(e);t!==null&&(this.stateSpan.textContent=t)}}function Wz(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 kz(n){return n.split("/").filter(e=>e!=="").pop()??n}function Uz(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 Fz=["single","mpr","3d","slab"],Ph=["wl","zoom","pan","length","angle","probe"],yo=["gray","hot","jet","cool"],rg=[{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"]}],rd=/\.(nii|nii\.gz|mgz|mgh)$/i,Xo=/\.dcm$/i,ag=/^\d+-.*-[0-9a-f]{7}$/,Lh="/SERVICES/PACS/",jz=4;function Ll(n,e){if(ag.test(e))return!0;if(!n.startsWith(Lh))return!1;const t=n.slice(Lh.length).replace(/\/+$/,"");return t!==""&&t.split("/").length===jz}function $z(n,e){const t=n.toLowerCase();return rg.find(s=>s.name===t&&(s.modalities.length===0||s.modalities.includes(e.toUpperCase())))}const ii={charge:!0,link:!0,collide:!0,gravity:!1},Tt=.55;function xi(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 Vz(n){const e=+this._x.call(null,n);return og(this.cover(e),e,n)}function og(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 Hz(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)og(this,t[r],n[r]);return this}function qz(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 Xz(){var n=[];return this.visit(function(e){if(!e.length)do n.push(e.data);while(e=e.next)}),n}function Kz(n){return arguments.length?this.cover(+n[0][0]).cover(+n[1][0]):isNaN(this._x0)?void 0:[[this._x0],[this._x1]]}function xn(n,e,t){this.node=n,this.x0=e,this.x1=t}function Yz(n,e){var t,s=this._x0,i,r,a=this._x1,o=[],l=this._root,c,d;for(l&&o.push(new xn(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 xn(l[1],u,r),new xn(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 Zz(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 Qz(n){for(var e=0,t=n.length;e<t;++e)this.remove(n[e]);return this}function Jz(){return this._root}function ew(){var n=0;return this.visit(function(e){if(!e.length)do++n;while(e=e.next)}),n}function tw(n){var e=[],t,s=this._root,i,r,a;for(s&&e.push(new xn(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 xn(i,o,a)),(i=s[0])&&e.push(new xn(i,r,o))}return this}function sw(n){var e=[],t=[],s;for(this._root&&e.push(new xn(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 xn(r,a,l)),(r=i[1])&&e.push(new xn(r,l,o))}t.push(s)}for(;s=t.pop();)n(s.node,s.x0,s.x1);return this}function nw(n){return n[0]}function iw(n){return arguments.length?(this._x=n,this):this._x}function yu(n,e){var t=new vu(e??nw,NaN,NaN);return n==null?t:t.addAll(n)}function vu(n,e,t){this._x=n,this._x0=e,this._x1=t,this._root=void 0}function Wh(n){for(var e={data:n.data},t=e;n=n.next;)t=t.next={data:n.data};return e}var bs=yu.prototype=vu.prototype;bs.copy=function(){var n=new vu(this._x,this._x0,this._x1),e=this._root,t,s;if(!e)return n;if(!e.length)return n._root=Wh(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]=Wh(s));return n};bs.add=Vz;bs.addAll=Hz;bs.cover=qz;bs.data=Xz;bs.extent=Kz;bs.find=Yz;bs.remove=Zz;bs.removeAll=Qz;bs.root=Jz;bs.size=ew;bs.visit=tw;bs.visitAfter=sw;bs.x=iw;function rw(n){const e=+this._x.call(null,n),t=+this._y.call(null,n);return lg(this.cover(e,t),e,t,n)}function lg(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,p,f,M,g,m,_;if(!r)return n._root=a,n;for(;r.length;)if((M=e>=(u=(o+c)/2))?o=u:c=u,(g=t>=(h=(l+d)/2))?l=h:d=h,i=r,!(r=r[m=g<<1|M]))return i[m]=a,n;if(p=+n._x.call(null,r.data),f=+n._y.call(null,r.data),e===p&&t===f)return a.next=r,i?i[m]=a:n._root=a,n;do i=i?i[m]=new Array(4):n._root=new Array(4),(M=e>=(u=(o+c)/2))?o=u:c=u,(g=t>=(h=(l+d)/2))?l=h:d=h;while((m=g<<1|M)===(_=(f>=h)<<1|p>=u));return i[_]=r,i[m]=a,n}function aw(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)lg(this,a[t],o[t],n[t]);return this}function ow(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 lw(){var n=[];return this.visit(function(e){if(!e.length)do n.push(e.data);while(e=e.next)}),n}function cw(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 hs(n,e,t,s,i){this.node=n,this.x0=e,this.y0=t,this.x1=s,this.y1=i}function dw(n,e,t){var s,i=this._x0,r=this._y0,a,o,l,c,d=this._x1,u=this._y1,h=[],p=this._root,f,M;for(p&&h.push(new hs(p,i,r,d,u)),t==null?t=1/0:(i=n-t,r=e-t,d=n+t,u=e+t,t*=t);f=h.pop();)if(!(!(p=f.node)||(a=f.x0)>d||(o=f.y0)>u||(l=f.x1)<i||(c=f.y1)<r))if(p.length){var g=(a+l)/2,m=(o+c)/2;h.push(new hs(p[3],g,m,l,c),new hs(p[2],a,m,g,c),new hs(p[1],g,o,l,m),new hs(p[0],a,o,g,m)),(M=(e>=m)<<1|n>=g)&&(f=h[h.length-1],h[h.length-1]=h[h.length-1-M],h[h.length-1-M]=f)}else{var _=n-+this._x.call(null,p.data),w=e-+this._y.call(null,p.data),z=_*_+w*w;if(z<t){var y=Math.sqrt(t=z);i=n-y,r=e-y,d=n+y,u=e+y,s=p.data}}return s}function uw(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,p,f,M,g,m;if(!t)return this;if(t.length)for(;;){if((f=d>=(h=(a+l)/2))?a=h:l=h,(M=u>=(p=(o+c)/2))?o=p:c=p,e=t,!(t=t[g=M<<1|f]))return this;if(!t.length)break;(e[g+1&3]||e[g+2&3]||e[g+3&3])&&(s=e,m=g)}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[g]=r:delete e[g],(t=e[0]||e[1]||e[2]||e[3])&&t===(e[3]||e[2]||e[1]||e[0])&&!t.length&&(s?s[m]=t:this._root=t),this):(this._root=r,this)}function hw(n){for(var e=0,t=n.length;e<t;++e)this.remove(n[e]);return this}function fw(){return this._root}function pw(){var n=0;return this.visit(function(e){if(!e.length)do++n;while(e=e.next)}),n}function mw(n){var e=[],t,s=this._root,i,r,a,o,l;for(s&&e.push(new hs(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 hs(i,c,d,o,l)),(i=s[2])&&e.push(new hs(i,r,d,c,l)),(i=s[1])&&e.push(new hs(i,c,a,o,d)),(i=s[0])&&e.push(new hs(i,r,a,c,d))}return this}function gw(n){var e=[],t=[],s;for(this._root&&e.push(new hs(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 hs(r,a,o,d,u)),(r=i[1])&&e.push(new hs(r,d,o,l,u)),(r=i[2])&&e.push(new hs(r,a,u,d,c)),(r=i[3])&&e.push(new hs(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 Mw(n){return n[0]}function bw(n){return arguments.length?(this._x=n,this):this._x}function _w(n){return n[1]}function zw(n){return arguments.length?(this._y=n,this):this._y}function Ou(n,e,t){var s=new xu(e??Mw,t??_w,NaN,NaN,NaN,NaN);return n==null?s:s.addAll(n)}function xu(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 kh(n){for(var e={data:n.data},t=e;n=n.next;)t=t.next={data:n.data};return e}var ps=Ou.prototype=xu.prototype;ps.copy=function(){var n=new xu(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=kh(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]=kh(s));return n};ps.add=rw;ps.addAll=aw;ps.cover=ow;ps.data=lw;ps.extent=cw;ps.find=dw;ps.remove=uw;ps.removeAll=hw;ps.root=fw;ps.size=pw;ps.visit=mw;ps.visitAfter=gw;ps.x=bw;ps.y=zw;function ww(n){const e=+this._x.call(null,n),t=+this._y.call(null,n),s=+this._z.call(null,n);return cg(this.cover(e,t,s),e,t,s,n)}function cg(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,p=n._z1,f,M,g,m,_,w,z,y,O,S,b;if(!a)return n._root=o,n;for(;a.length;)if((z=e>=(f=(l+u)/2))?l=f:u=f,(y=t>=(M=(c+h)/2))?c=M:h=M,(O=s>=(g=(d+p)/2))?d=g:p=g,r=a,!(a=a[S=O<<2|y<<1|z]))return r[S]=o,n;if(m=+n._x.call(null,a.data),_=+n._y.call(null,a.data),w=+n._z.call(null,a.data),e===m&&t===_&&s===w)return o.next=a,r?r[S]=o:n._root=o,n;do r=r?r[S]=new Array(8):n._root=new Array(8),(z=e>=(f=(l+u)/2))?l=f:u=f,(y=t>=(M=(c+h)/2))?c=M:h=M,(O=s>=(g=(d+p)/2))?d=g:p=g;while((S=O<<2|y<<1|z)===(b=(w>=g)<<2|(_>=M)<<1|m>=f));return r[b]=a,r[S]=o,n}function yw(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,p,f,M;u<e;++u)isNaN(p=+this._x.call(null,h=n[u]))||isNaN(f=+this._y.call(null,h))||isNaN(M=+this._z.call(null,h))||(t[u]=p,s[u]=f,i[u]=M,p<r&&(r=p),p>l&&(l=p),f<a&&(a=f),f>c&&(c=f),M<o&&(o=M),M>d&&(d=M));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)cg(this,t[u],s[u],i[u],n[u]);return this}function vw(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 Ow(){var n=[];return this.visit(function(e){if(!e.length)do n.push(e.data);while(e=e.next)}),n}function xw(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 It(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 Sw(n,e,t,s){var i,r=this._x0,a=this._y0,o=this._z0,l,c,d,u,h,p,f=this._x1,M=this._y1,g=this._z1,m=[],_=this._root,w,z;for(_&&m.push(new It(_,r,a,o,f,M,g)),s==null?s=1/0:(r=n-s,a=e-s,o=t-s,f=n+s,M=e+s,g=t+s,s*=s);w=m.pop();)if(!(!(_=w.node)||(l=w.x0)>f||(c=w.y0)>M||(d=w.z0)>g||(u=w.x1)<r||(h=w.y1)<a||(p=w.z1)<o))if(_.length){var y=(l+u)/2,O=(c+h)/2,S=(d+p)/2;m.push(new It(_[7],y,O,S,u,h,p),new It(_[6],l,O,S,y,h,p),new It(_[5],y,c,S,u,O,p),new It(_[4],l,c,S,y,O,p),new It(_[3],y,O,d,u,h,S),new It(_[2],l,O,d,y,h,S),new It(_[1],y,c,d,u,O,S),new It(_[0],l,c,d,y,O,S)),(z=(t>=S)<<2|(e>=O)<<1|n>=y)&&(w=m[m.length-1],m[m.length-1]=m[m.length-1-z],m[m.length-1-z]=w)}else{var b=n-+this._x.call(null,_.data),v=e-+this._y.call(null,_.data),E=t-+this._z.call(null,_.data),A=b*b+v*v+E*E;if(A<s){var I=Math.sqrt(s=A);r=n-I,a=e-I,o=t-I,f=n+I,M=e+I,g=t+I,i=_.data}}return i}const Ew=(n,e,t,s,i,r)=>Math.sqrt((n-s)**2+(e-i)**2+(t-r)**2);function Aw(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,p,f,M,g,m)=>{if(!u.length)do{const _=u.data;Ew(n,e,t,this._x(_),this._y(_),this._z(_))<=s&&i.push(_)}while(u=u.next);return h>l||p>c||f>d||M<r||g<a||m<o}),i}function Dw(n){if(isNaN(h=+this._x.call(null,n))||isNaN(p=+this._y.call(null,n))||isNaN(f=+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,p,f,M,g,m,_,w,z,y,O;if(!t)return this;if(t.length)for(;;){if((_=h>=(M=(a+c)/2))?a=M:c=M,(w=p>=(g=(o+d)/2))?o=g:d=g,(z=f>=(m=(l+u)/2))?l=m:u=m,e=t,!(t=t[y=z<<2|w<<1|_]))return this;if(!t.length)break;(e[y+1&7]||e[y+2&7]||e[y+3&7]||e[y+4&7]||e[y+5&7]||e[y+6&7]||e[y+7&7])&&(s=e,O=y)}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[y]=r:delete e[y],(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[O]=t:this._root=t),this):(this._root=r,this)}function Tw(n){for(var e=0,t=n.length;e<t;++e)this.remove(n[e]);return this}function Iw(){return this._root}function Gw(){var n=0;return this.visit(function(e){if(!e.length)do++n;while(e=e.next)}),n}function Rw(n){var e=[],t,s=this._root,i,r,a,o,l,c,d;for(s&&e.push(new It(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,p=(o+d)/2;(i=s[7])&&e.push(new It(i,u,h,p,l,c,d)),(i=s[6])&&e.push(new It(i,r,h,p,u,c,d)),(i=s[5])&&e.push(new It(i,u,a,p,l,h,d)),(i=s[4])&&e.push(new It(i,r,a,p,u,h,d)),(i=s[3])&&e.push(new It(i,u,h,o,l,c,p)),(i=s[2])&&e.push(new It(i,r,h,o,u,c,p)),(i=s[1])&&e.push(new It(i,u,a,o,l,h,p)),(i=s[0])&&e.push(new It(i,r,a,o,u,h,p))}return this}function Nw(n){var e=[],t=[],s;for(this._root&&e.push(new It(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,p=(o+d)/2,f=(l+u)/2;(r=i[0])&&e.push(new It(r,a,o,l,h,p,f)),(r=i[1])&&e.push(new It(r,h,o,l,c,p,f)),(r=i[2])&&e.push(new It(r,a,p,l,h,d,f)),(r=i[3])&&e.push(new It(r,h,p,l,c,d,f)),(r=i[4])&&e.push(new It(r,a,o,f,h,p,u)),(r=i[5])&&e.push(new It(r,h,o,f,c,p,u)),(r=i[6])&&e.push(new It(r,a,p,f,h,d,u)),(r=i[7])&&e.push(new It(r,h,p,f,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 Bw(n){return n[0]}function Cw(n){return arguments.length?(this._x=n,this):this._x}function Pw(n){return n[1]}function Lw(n){return arguments.length?(this._y=n,this):this._y}function Ww(n){return n[2]}function kw(n){return arguments.length?(this._z=n,this):this._z}function Su(n,e,t,s){var i=new Eu(e??Bw,t??Pw,s??Ww,NaN,NaN,NaN,NaN,NaN,NaN);return n==null?i:i.addAll(n)}function Eu(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 Uh(n){for(var e={data:n.data},t=e;n=n.next;)t=t.next={data:n.data};return e}var ns=Su.prototype=Eu.prototype;ns.copy=function(){var n=new Eu(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=Uh(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]=Uh(s));return n};ns.add=ww;ns.addAll=yw;ns.cover=vw;ns.data=Ow;ns.extent=xw;ns.find=Sw;ns.findAllWithinRadius=Aw;ns.remove=Dw;ns.removeAll=Tw;ns.root=Iw;ns.size=Gw;ns.visit=Rw;ns.visitAfter=Nw;ns.x=Cw;ns.y=Lw;ns.z=kw;function Xt(n){return function(){return n}}function Gs(n){return(n()-.5)*1e-6}function Wl(n){return n.x+n.vx}function Fh(n){return n.y+n.vy}function Uw(n){return n.z+n.vz}function Zn(n){var e,t,s,i,r=1,a=1;typeof n!="function"&&(n=Xt(n==null?1:+n));function o(){for(var d,u=e.length,h,p,f,M,g,m,_,w=0;w<a;++w)for(h=(t===1?yu(e,Wl):t===2?Ou(e,Wl,Fh):t===3?Su(e,Wl,Fh,Uw):null).visitAfter(l),d=0;d<u;++d)p=e[d],m=s[p.index],_=m*m,f=p.x+p.vx,t>1&&(M=p.y+p.vy),t>2&&(g=p.z+p.vz),h.visit(z);function z(y,O,S,b,v,E,A){var I=[O,S,b,v,E,A],G=I[0],C=I[1],B=I[2],P=I[t],W=I[t+1],H=I[t+2],X=y.data,oe=y.r,J=m+oe;if(X){if(X.index>p.index){var ce=f-X.x-X.vx,We=t>1?M-X.y-X.vy:0,qe=t>2?g-X.z-X.vz:0,Pe=ce*ce+We*We+qe*qe;Pe<J*J&&(ce===0&&(ce=Gs(i),Pe+=ce*ce),t>1&&We===0&&(We=Gs(i),Pe+=We*We),t>2&&qe===0&&(qe=Gs(i),Pe+=qe*qe),Pe=(J-(Pe=Math.sqrt(Pe)))/Pe*r,p.vx+=(ce*=Pe)*(J=(oe*=oe)/(_+oe)),t>1&&(p.vy+=(We*=Pe)*J),t>2&&(p.vz+=(qe*=Pe)*J),X.vx-=ce*(J=1-J),t>1&&(X.vy-=We*J),t>2&&(X.vz-=qe*J))}return}return G>f+J||P<f-J||t>1&&(C>M+J||W<M-J)||t>2&&(B>g+J||H<g-J)}}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:Xt(+d),c(),o):n},o}function Fw(n){return n.index}function jh(n,e){var t=n.get(e);if(!t)throw new Error("node not found: "+e);return t}function Ni(n){var e=Fw,t=h,s,i=Xt(30),r,a,o,l,c,d,u=1;n==null&&(n=[]);function h(m){return 1/Math.min(l[m.source.index],l[m.target.index])}function p(m){for(var _=0,w=n.length;_<u;++_)for(var z=0,y,O,S,b=0,v=0,E=0,A,I;z<w;++z)y=n[z],O=y.source,S=y.target,b=S.x+S.vx-O.x-O.vx||Gs(d),o>1&&(v=S.y+S.vy-O.y-O.vy||Gs(d)),o>2&&(E=S.z+S.vz-O.z-O.vz||Gs(d)),A=Math.sqrt(b*b+v*v+E*E),A=(A-r[z])/A*m*s[z],b*=A,v*=A,E*=A,S.vx-=b*(I=c[z]),o>1&&(S.vy-=v*I),o>2&&(S.vz-=E*I),O.vx+=b*(I=1-I),o>1&&(O.vy+=v*I),o>2&&(O.vz+=E*I)}function f(){if(a){var m,_=a.length,w=n.length,z=new Map(a.map((O,S)=>[e(O,S,a),O])),y;for(m=0,l=new Array(_);m<w;++m)y=n[m],y.index=m,typeof y.source!="object"&&(y.source=jh(z,y.source)),typeof y.target!="object"&&(y.target=jh(z,y.target)),l[y.source.index]=(l[y.source.index]||0)+1,l[y.target.index]=(l[y.target.index]||0)+1;for(m=0,c=new Array(w);m<w;++m)y=n[m],c[m]=l[y.source.index]/(l[y.source.index]+l[y.target.index]);s=new Array(w),M(),r=new Array(w),g()}}function M(){if(a)for(var m=0,_=n.length;m<_;++m)s[m]=+t(n[m],m,n)}function g(){if(a)for(var m=0,_=n.length;m<_;++m)r[m]=+i(n[m],m,n)}return p.initialize=function(m,..._){a=m,d=_.find(w=>typeof w=="function")||Math.random,o=_.find(w=>[1,2,3].includes(w))||2,f()},p.links=function(m){return arguments.length?(n=m,f(),p):n},p.id=function(m){return arguments.length?(e=m,p):e},p.iterations=function(m){return arguments.length?(u=+m,p):u},p.strength=function(m){return arguments.length?(t=typeof m=="function"?m:Xt(+m),M(),p):t},p.distance=function(m){return arguments.length?(i=typeof m=="function"?m:Xt(+m),g(),p):i},p}var jw={value:()=>{}};function dg(){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 vo(t)}function vo(n){this._=n}function $w(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}})}vo.prototype=dg.prototype={constructor:vo,on:function(n,e){var t=this._,s=$w(n+"",t),i,r=-1,a=s.length;if(arguments.length<2){for(;++r<a;)if((i=(n=s[r]).type)&&(i=Vw(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]=$h(t[i],n.name,e);else if(e==null)for(i in t)t[i]=$h(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 vo(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 Vw(n,e){for(var t=0,s=n.length,i;t<s;++t)if((i=n[t]).name===e)return i.value}function $h(n,e,t){for(var s=0,i=n.length;s<i;++s)if(n[s].name===e){n[s]=jw,n=n.slice(0,s).concat(n.slice(s+1));break}return t!=null&&n.push({name:e,value:t}),n}var Ar=0,ca=0,$r=0,ug=1e3,Ko,da,Yo=0,Bi=0,gl=0,wa=typeof performance=="object"&&performance.now?performance:Date,hg=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(n){setTimeout(n,17)};function fg(){return Bi||(hg(Hw),Bi=wa.now()+gl)}function Hw(){Bi=0}function ad(){this._call=this._time=this._next=null}ad.prototype=pg.prototype={constructor:ad,restart:function(n,e,t){if(typeof n!="function")throw new TypeError("callback is not a function");t=(t==null?fg():+t)+(e==null?0:+e),!this._next&&da!==this&&(da?da._next=this:Ko=this,da=this),this._call=n,this._time=t,od()},stop:function(){this._call&&(this._call=null,this._time=1/0,od())}};function pg(n,e,t){var s=new ad;return s.restart(n,e,t),s}function qw(){fg(),++Ar;for(var n=Ko,e;n;)(e=Bi-n._time)>=0&&n._call.call(void 0,e),n=n._next;--Ar}function Vh(){Bi=(Yo=wa.now())+gl,Ar=ca=0;try{qw()}finally{Ar=0,Kw(),Bi=0}}function Xw(){var n=wa.now(),e=n-Yo;e>ug&&(gl-=e,Yo=n)}function Kw(){for(var n,e=Ko,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:Ko=t);da=n,od(s)}function od(n){if(!Ar){ca&&(ca=clearTimeout(ca));var e=n-Bi;e>24?(n<1/0&&(ca=setTimeout(Vh,n-wa.now()-gl)),$r&&($r=clearInterval($r))):($r||(Yo=wa.now(),$r=setInterval(Xw,ug)),Ar=1,hg(Vh))}}const Yw=1664525,Zw=1013904223,Hh=4294967296;function Qw(){let n=1;return()=>(n=(Yw*n+Zw)%Hh)/Hh}var qh=3;function kl(n){return n.x}function Xh(n){return n.y}function Jw(n){return n.z}var ey=10,ty=Math.PI*(3-Math.sqrt(5)),sy=Math.PI*20/(9+Math.sqrt(221));function Qn(n,e){e=e||2;var t=Math.min(qh,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=pg(p),u=dg("tick","end"),h=Qw();n==null&&(n=[]);function p(){f(),u.call("tick",s),i<r&&(d.stop(),u.call("end",s))}function f(m){var _,w=n.length,z;m===void 0&&(m=1);for(var y=0;y<m;++y)for(i+=(o-i)*a,c.forEach(function(O){O(i)}),_=0;_<w;++_)z=n[_],z.fx==null?z.x+=z.vx*=l:(z.x=z.fx,z.vx=0),t>1&&(z.fy==null?z.y+=z.vy*=l:(z.y=z.fy,z.vy=0)),t>2&&(z.fz==null?z.z+=z.vz*=l:(z.z=z.fz,z.vz=0));return s}function M(){for(var m=0,_=n.length,w;m<_;++m){if(w=n[m],w.index=m,w.fx!=null&&(w.x=w.fx),w.fy!=null&&(w.y=w.fy),w.fz!=null&&(w.z=w.fz),isNaN(w.x)||t>1&&isNaN(w.y)||t>2&&isNaN(w.z)){var z=ey*(t>2?Math.cbrt(.5+m):t>1?Math.sqrt(.5+m):m),y=m*ty,O=m*sy;t===1?w.x=z:t===2?(w.x=z*Math.cos(y),w.y=z*Math.sin(y)):(w.x=z*Math.sin(y)*Math.cos(O),w.y=z*Math.cos(y),w.z=z*Math.sin(y)*Math.sin(O))}(isNaN(w.vx)||t>1&&isNaN(w.vy)||t>2&&isNaN(w.vz))&&(w.vx=0,t>1&&(w.vy=0),t>2&&(w.vz=0))}}function g(m){return m.initialize&&m.initialize(n,h,t),m}return M(),s={tick:f,restart:function(){return d.restart(p),s},stop:function(){return d.stop(),s},numDimensions:function(m){return arguments.length?(t=Math.min(qh,Math.max(1,Math.round(m))),c.forEach(g),s):t},nodes:function(m){return arguments.length?(n=m,M(),c.forEach(g),s):n},alpha:function(m){return arguments.length?(i=+m,s):i},alphaMin:function(m){return arguments.length?(r=+m,s):r},alphaDecay:function(m){return arguments.length?(a=+m,s):+a},alphaTarget:function(m){return arguments.length?(o=+m,s):o},velocityDecay:function(m){return arguments.length?(l=1-m,s):1-l},randomSource:function(m){return arguments.length?(h=m,c.forEach(g),s):h},force:function(m,_){return arguments.length>1?(_==null?c.delete(m):c.set(m,g(_)),s):c.get(m)},find:function(){var m=Array.prototype.slice.call(arguments),_=m.shift()||0,w=(t>1?m.shift():null)||0,z=(t>2?m.shift():null)||0,y=m.shift()||1/0,O=0,S=n.length,b,v,E,A,I,G;for(y*=y,O=0;O<S;++O)I=n[O],b=_-I.x,v=w-(I.y||0),E=z-(I.z||0),A=b*b+v*v+E*E,A<y&&(G=I,y=A);return G},on:function(m,_){return arguments.length>1?(u.on(m,_),s):u.on(m)}}}function Jn(){var n,e,t,s,i,r=Xt(-30),a,o=1,l=1/0,c=.81;function d(f){var M,g=n.length,m=(e===1?yu(n,kl):e===2?Ou(n,kl,Xh):e===3?Su(n,kl,Xh,Jw):null).visitAfter(h);for(i=f,M=0;M<g;++M)t=n[M],m.visit(p)}function u(){if(n){var f,M=n.length,g;for(a=new Array(M),f=0;f<M;++f)g=n[f],a[g.index]=+r(g,f,n)}}function h(f){var M=0,g,m,_=0,w,z,y,O,S=f.length;if(S){for(w=z=y=O=0;O<S;++O)(g=f[O])&&(m=Math.abs(g.value))&&(M+=g.value,_+=m,w+=m*(g.x||0),z+=m*(g.y||0),y+=m*(g.z||0));M*=Math.sqrt(4/S),f.x=w/_,e>1&&(f.y=z/_),e>2&&(f.z=y/_)}else{g=f,g.x=g.data.x,e>1&&(g.y=g.data.y),e>2&&(g.z=g.data.z);do M+=a[g.data.index];while(g=g.next)}f.value=M}function p(f,M,g,m,_){if(!f.value)return!0;var w=[g,m,_][e-1],z=f.x-t.x,y=e>1?f.y-t.y:0,O=e>2?f.z-t.z:0,S=w-M,b=z*z+y*y+O*O;if(S*S/c<b)return b<l&&(z===0&&(z=Gs(s),b+=z*z),e>1&&y===0&&(y=Gs(s),b+=y*y),e>2&&O===0&&(O=Gs(s),b+=O*O),b<o&&(b=Math.sqrt(o*b)),t.vx+=z*f.value*i/b,e>1&&(t.vy+=y*f.value*i/b),e>2&&(t.vz+=O*f.value*i/b)),!0;if(f.length||b>=l)return;(f.data!==t||f.next)&&(z===0&&(z=Gs(s),b+=z*z),e>1&&y===0&&(y=Gs(s),b+=y*y),e>2&&O===0&&(O=Gs(s),b+=O*O),b<o&&(b=Math.sqrt(o*b)));do f.data!==t&&(S=a[f.data.index]*i/b,t.vx+=z*S,e>1&&(t.vy+=y*S),e>2&&(t.vz+=O*S));while(f=f.next)}return d.initialize=function(f,...M){n=f,s=M.find(g=>typeof g=="function")||Math.random,e=M.find(g=>[1,2,3].includes(g))||2,u()},d.strength=function(f){return arguments.length?(r=typeof f=="function"?f:Xt(+f),u(),d):r},d.distanceMin=function(f){return arguments.length?(o=f*f,d):Math.sqrt(o)},d.distanceMax=function(f){return arguments.length?(l=f*f,d):Math.sqrt(l)},d.theta=function(f){return arguments.length?(c=f*f,d):Math.sqrt(c)},d}function Au(n){var e=Xt(.1),t,s,i;typeof n!="function"&&(n=Xt(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:Xt(+o),a(),r):e},r.x=function(o){return arguments.length?(n=typeof o=="function"?o:Xt(+o),a(),r):n},r}function Du(n){var e=Xt(.1),t,s,i;typeof n!="function"&&(n=Xt(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:Xt(+o),a(),r):e},r.y=function(o){return arguments.length?(n=typeof o=="function"?o:Xt(+o),a(),r):n},r}function Tu(n){var e=Xt(.1),t,s,i;typeof n!="function"&&(n=Xt(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:Xt(+o),a(),r):e},r.z=function(o){return arguments.length?(n=typeof o=="function"?o:Xt(+o),a(),r):n},r}function ny(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 iy(n){let e=n>>>0;return()=>(e=Math.imul(e,1664525)+1013904223>>>0,e/4294967296)}function Dr(n){return iy(ny(n))}const Us=.55,ry=12,ay=60,Ul=60;function oy(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 ly(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 cy(n,e,t){const s=f=>Math.hypot(f[0],f[1],f[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],p=[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+p[0]*c+u[0]*h*(1-d),n[1]*d+p[1]*c+u[1]*h*(1-d),n[2]*d+p[2]*c+u[2]*h*(1-d)]}function Kh(n,e,t){if(e.length===0)return n;let s=0;for(const i of e)s+=t.get(i.id.slice(6))??Us;return s/=e.length,Math.max(n+2,Math.sqrt(e.length)*s*1.6)}function Fl(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 Iu(n,e,t=()=>{},s="clumps",i=Dr){const r=new Map(n.map(G=>[G.id,G])),a=new Map,o=[];for(const G of n)G.group===null?o.push(G):a.set(G.group,[...a.get(G.group)??[],G]);const l=new Map,c=new Map,d=new Map,u=new Set;let h=0;const p=Math.max(1,a.size),f=new Map;for(const[G,C]of a){const B=C.filter(J=>J.seed!==void 0),P=[0,0,0];for(const J of B)P[0]+=J.seed[0],P[1]+=J.seed[1],P[2]+=J.seed[2];B.length>0&&(P[0]/=B.length,P[1]/=B.length,P[2]/=B.length,d.set(G,P)),C.every(J=>J.frozen===!0&&J.seed!==void 0)&&u.add(G);const W=new Map,H=B.length===0?oy(C):null,X=H===null?void 0:f.get(H);if(B.length===C.length)for(const J of C)W.set(J.id,[J.seed[0]-P[0],J.seed[1]-P[1],J.seed[2]-P[2]]);else if(X!==void 0){const J=i(G),ce=J()*Math.PI*2,We=(J()-.5)*Math.PI;C.forEach((qe,Pe)=>{W.set(qe.id,ly(X[Pe]??[0,0,0],ce,We))})}else{const J=C.map(ae=>{const ue={id:ae.id,r:ae.radius};return ae.seed!==void 0&&(ue.x=ae.seed[0]-P[0],ue.y=ae.seed[1]-P[1],ue.z=ae.seed[2]-P[2],ae.frozen===!0&&(ue.fx=ue.x,ue.fy=ue.y,ue.fz=ue.z)),ue}),ce=new Set(C.map(ae=>ae.id)),We=[];for(const ae of C)for(const ue of ae.parents)ce.has(ue)&&We.push({source:ue,target:ae.id});const qe=new Map(C.map(ae=>[ae.id,ae.radius])),Pe=Qn(J,3).force("link",Ni(We).id(ae=>ae.id).distance(e.link?ae=>(qe.get(ae.source.id)??Us)+(qe.get(ae.target.id)??Us)+1.4:2.2)).force("charge",Jn().strength(ae=>e.charge?-6*(ae.r/Us)**2:-6).distanceMax(ry)).force("center",xi(0,0,0)).stop();e.collide&&Pe.force("collide",Zn().radius(ae=>ae.r*1.2));for(let ae=0;ae<ay;ae++)Pe.tick();const ne=[0,0,0];for(const ae of J)ne[0]+=ae.x??0,ne[1]+=ae.y??0,ne[2]+=ae.z??0;ne[0]/=J.length,ne[1]/=J.length,ne[2]/=J.length;for(const ae of J)W.set(ae.id,[(ae.x??0)-ne[0],(ae.y??0)-ne[1],(ae.z??0)-ne[2]]);H!==null&&f.set(H,C.map(ae=>W.get(ae.id)??[0,0,0]))}let oe=Us;for(const J of C){const ce=W.get(J.id)??[0,0,0];l.set(J.id,ce),oe=Math.max(oe,Math.hypot(ce[0],ce[1],ce[2])+J.radius)}c.set(G,oe),h+=1,h%50===0&&t(.3*(h/p))}t(.3);const M=G=>{const C=r.get(G);return C!==void 0&&C.group!==null?`group:${C.group}`:G},g=[],m=new Map;let _=!1;for(const[G]of a){const C=`group:${G}`,B=c.get(G)??Us,P={id:C,r:B},W=d.get(G);W!==void 0&&(P.x=W[0],P.y=W[1],P.z=W[2],u.has(G)&&(P.fx=W[0],P.fy=W[1],P.fz=W[2],_=!0)),m.set(C,B),g.push(P)}for(const G of o){const C={id:G.id,r:G.radius};G.seed!==void 0&&(C.x=G.seed[0],C.y=G.seed[1],C.z=G.seed[2],G.frozen===!0&&(C.fx=G.seed[0],C.fy=G.seed[1],C.fz=G.seed[2],_=!0)),m.set(G.id,G.radius),g.push(C)}const w=new Set,z=[];for(const G of n)for(const C of G.parents){if(!r.has(C))continue;const B=M(C),P=M(G.id);if(B===P)continue;const W=`${B}\0${P}`;w.has(W)||(w.add(W),z.push({source:B,target:P}))}const y=new Map;for(const G of z)if(G.source.startsWith("group:")!==G.target.startsWith("group:")){const C=G.source.startsWith("group:")?G.source:G.target,B=G.source.startsWith("group:")?G.target:G.source;y.has(C)||y.set(C,B)}const O=new Map;for(const G of g){const C=y.get(G.id);C!==void 0&&O.set(C,[...O.get(C)??[],G])}const S=g.reduce((G,C)=>G+C.r*C.r,0),b=g.filter(G=>!G.id.startsWith("group:"));b.forEach((G,C)=>{if(G.x!==void 0)return;const[B,P,W]=Fl(C,b.length,Math.sqrt(S)*1.2+10);G.x=B,G.y=P,G.z=W});for(const[G,C]of O){const B=g.find(W=>W.id===G),P=Math.sqrt(C.reduce((W,H)=>W+H.r*H.r,0))*1.4+2;C.forEach((W,H)=>{if(W.x!==void 0)return;const[X,oe,J]=Fl(H,C.length,P);W.x=(B?.x??0)+X,W.y=(B?.y??0)+oe,W.z=(B?.z??0)+J})}const v=new Set;if(s==="spokes"){const G=B=>{const P=a.get(B)??[],W=new Set(P.map(X=>X.id)),H=P.find(X=>X.parents.some(oe=>!W.has(oe)))??P[0];return H===void 0?[0,0,0]:l.get(H.id)??[0,0,0]},C=[];for(const B of g){if(B.id.startsWith("group:")&&y.has(B.id)){v.add(B.id);continue}if(B.id.startsWith("group:"))C.push(B);else{const P=O.get(B.id)??[];let W=B.r;const H=Kh(B.r,P,c);for(const X of P){const oe=X.id.slice(6),J=G(oe);W=Math.max(W,H+Math.hypot(J[0],J[1],J[2])+2*(c.get(oe)??Us))}C.push({id:B.id,r:W,x:B.x,y:B.y,z:B.z,...B.fx!==void 0?{fx:B.fx,fy:B.fy,fz:B.fz}:{}})}}if(!C.every(B=>B.fx!==void 0)){const B=Qn(C,3).force("charge",Jn().strength(P=>-1.5*P.r)).force("collide",Zn().radius(P=>P.r*.9)).stop();_||B.force("center",xi(0,0,0));for(let P=0;P<Ul;P++)B.tick(),P%5===0&&t(.3+.7*(P/Ul))}for(const B of C){const P=g.find(W=>W.id===B.id);P!==void 0&&P!==B&&(P.x=B.x,P.y=B.y,P.z=B.z)}for(const B of g){if(B.id.startsWith("group:")||!O.has(B.id))continue;const P=O.get(B.id)??[],W=Kh(B.r,P,c);P.forEach((H,X)=>{if(H.fx!==void 0||d.has(H.id.slice(6)))return;const oe=G(H.id.slice(6)),J=Fl(X,P.length,1),ce=.35+.65*(X*.6180339887%1),We=B.r+1.4+W*ce+Math.hypot(oe[0],oe[1],oe[2]);H.x=(B.x??0)+J[0]*We,H.y=(B.y??0)+J[1]*We,H.z=(B.z??0)+J[2]*We})}}if(!g.every(G=>G.fx!==void 0)&&s!=="spokes"){const G=Qn(g,3).force("link",Ni(z).id(P=>P.id).distance(e.link?P=>(m.get(P.source.id)??Us)+(m.get(P.target.id)??Us)+1.4:2.2)).stop(),C=Jn().strength(P=>e.charge?-6*(P.r/Us)**2:-6);if(e.reach!==void 0&&C.distanceMax(e.reach),G.force("charge",C),_||G.force("center",xi(0,0,0)),e.collide&&G.force("collide",Zn().radius(P=>P.r*1.05)),e.gravity){const P=W=>Math.min(1,(W.r/Us)**2*.08);G.force("gx",Au(0).strength(P)).force("gy",Du(0).strength(P)).force("gz",Tu(0).strength(P))}const B=Ul;for(let P=0;P<B;P++)G.tick(),P%5===0&&t(.3+.7*(P/B))}const A=new Map(g.map(G=>[G.id,G]));if(s==="spokes")for(const[G,C]of a){if(C.some(qe=>qe.seed!==void 0))continue;const B=`group:${G}`,P=A.get(B),W=y.get(B),H=W===void 0?void 0:A.get(W);if(P===void 0||H===void 0)continue;const X=[(P.x??0)-(H.x??0),(P.y??0)-(H.y??0),(P.z??0)-(H.z??0)],oe=new Set(C.map(qe=>qe.id)),J=C.find(qe=>qe.parents.some(Pe=>!oe.has(Pe)))??C[0],ce=l.get(J.id)??[0,0,0],We=[-ce[0],-ce[1],-ce[2]];for(const qe of C){const Pe=l.get(qe.id)??[0,0,0];l.set(qe.id,cy(Pe,We,X))}}const I={};for(const G of n){const C=A.get(M(G.id)),B=[C?.x??0,C?.y??0,C?.z??0],P=G.group===null?[0,0,0]:l.get(G.id)??[0,0,0];I[G.id]=[B[0]+P[0],B[1]+P[1],B[2]+P[2]]}return t(1),I}const Yh=80;function mg(n,e,t=()=>{},s=Dr){const i=n.some(h=>h.seed===void 0),r=i?Iu(n,e,h=>t(.05*h),"spokes",s):{};t(.05);const a=n.map(h=>{const p=h.seed??r[h.id],f={id:h.id,r:h.radius};return p!==void 0&&(f.x=p[0],f.y=p[1],f.z=p[2],h.frozen===!0&&h.seed!==void 0&&(f.fx=p[0],f.fy=p[1],f.fz=p[2])),f}),o=new Set(n.map(h=>h.id)),l=[];for(const h of n)for(const p of h.parents)o.has(p)&&l.push({source:p,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=Qn(a,3).force("link",Ni(l).id(f=>f.id).distance(e.link?f=>(c.get(f.source.id)??Tt)+(c.get(f.target.id)??Tt)+1.4:2.2)).stop(),p=Jn().strength(f=>e.charge?-6*(f.r/Tt)**2:-6);if(e.reach!==void 0&&p.distanceMax(e.reach),h.force("charge",p),d||h.force("center",xi(0,0,0)),e.collide&&h.force("collide",Zn().radius(f=>f.r*1.2)),e.gravity){const f=M=>(M.r/Tt)**2*.08;h.force("gx",Au(0).strength(f)).force("gy",Du(0).strength(f)).force("gz",Tu(0).strength(f))}i&&h.alpha(.6);for(let f=0;f<Yh;f++)h.tick(),f%2===0&&t(.05+.95*(f/Yh))}const u={};for(const h of a)u[h.id]=[h.x??0,h.y??0,h.z??0];return t(1),u}function gg(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 Mg(n){const e=gg(n),t=Math.max(...e,1);return new Map(n.map((s,i)=>[s.id,Tt*(.5+(e[i]??1)/t*1.2)]))}function bg(n,e=3,t=new Map,s=ii,i=new Set){const r=[];for(const _ of n)for(const w of _.parents)r.push({source:w,target:_.id});const a=gg(n),o=Math.max(...a,1),l=a.map(_=>Tt*(.5+_/o*1.2)),c=new Map(n.map((_,w)=>[_.id,l[w]??Tt])),d=n.map(_=>{const w=t.get(_.id);return w===void 0?{id:_.id}:i.has(_.id)?{id:_.id,x:w[0],y:w[1],z:w[2],fx:w[0],fy:w[1],fz:w[2]}:{id:_.id,x:w[0],y:w[1],z:w[2]}}),u=_=>i.has(_.id)&&_.fx!==void 0;let h=d,p=r;if(i.size>0){const _=new Set(d.filter(y=>!u(y)).map(y=>y.id));p=r.filter(y=>_.has(y.source)||_.has(y.target));const w=new Set(_);for(const y of p)w.add(y.source),w.add(y.target);h=d.filter(y=>w.has(y.id));const z=new Set(h.map(y=>y.id));p=p.filter(y=>z.has(y.source)&&z.has(y.target))}const f=Jn().strength(s.charge?_=>i.has(_.id)?0:-6*((c.get(_.id)??Tt)/Tt)**2:_=>i.has(_.id)?0:-6);s.reach!==void 0&&f.distanceMax(s.reach);const M=Qn(h,e).force("link",Ni(p).id(_=>_.id).distance(s.link?_=>(c.get(_.source.id)??Tt)+(c.get(_.target.id)??Tt)+1.4:2.2)).force("charge",f).stop();if(i.size===0&&M.force("center",e===2?xi(0,0):xi(0,0,0)),s.collide&&M.force("collide",Zn().radius(_=>(c.get(_.id)??Tt)*1.2)),s.gravity){const _=w=>((c.get(w.id)??Tt)/Tt)**2*.08;M.force("gx",Au(0).strength(_)).force("gy",Du(0).strength(_)),e===3&&M.force("gz",Tu(0).strength(_))}const g=h.length===0?0:t.size>0?90:150;let m=0;return{total:g,moving:h.length,step:_=>{for(let w=0;w<_&&m<g;w++,m++)M.tick()},place:()=>n.map((_,w)=>{const z=d[w];return{id:_.id,position:[z?.x??0,z?.y??0,z?.z??0],radius:l[w]??Tt}})}}function dy(n,e=3,t=new Map,s=ii,i=new Set){const r=bg(n,e,t,s,i);return r.step(r.total),r.place()}function uy(n,e,t=new Map,s=new Set){const i=Mg(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)??Tt,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 Zh=160,Qh=120,Jh=5,hy=.9,ef=.3,fy=.9;function _g(n,e){const t=new Map;for(const[s,i]of n)t.set(s,e===0||i/e>fy?0:Math.log(e/Math.max(1,i)));return t}function py(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 v=s(b);b.group===null||v===null||!a.has(v)||l.set(b.group,(l.get(b.group)??new Set).add(v))}const c=new Map;for(const b of l.values())for(const v of b)c.set(v,(c.get(v)??0)+1);const d=_g(c,l.size),u=Math.max(1e-9,...d.values()),h=new Map;for(const b of l.values()){const v=[...b].sort();for(let E=0;E<v.length;E++)for(let A=E+1;A<v.length;A++){const I=`${v[E]}\0${v[A]}`;h.set(I,(h.get(I)??0)+1)}}const p=Math.max(6,Math.sqrt(r.length)*4,Math.sqrt(o.length)*1.6),f=r.map(b=>tf(b,p,Dr(`star:${b.id}`))),M=[];for(const[b,v]of h){const[E,A]=b.split("\0"),I=Math.min(c.get(E)??1,c.get(A)??1);M.push({source:a.get(E).id,target:a.get(A).id,share:v/Math.max(1,I)})}if(f.length>0&&f.some(b=>b.fx===void 0)){const b=Qn(f,3).force("link",Ni(M).id(v=>v.id).distance(v=>p*(1.1-Number(v.share))).strength(v=>.05+.6*Number(v.share))).force("charge",Jn().strength(-30).distanceMax(p*3)).force("collide",Zn().radius(v=>v.r*3)).force("center",xi(0,0,0)).stop();for(let v=0;v<Zh;v++)b.tick(),v%4===0&&t(.4*(v/Zh))}const g=new Map(f.map(b=>[b.id,[b.x??0,b.y??0,b.z??0]]));t(.4);const m=[...f.map(b=>({...b,fx:b.x??0,fy:b.y??0,fz:b.z??0})),...o.map(b=>{const v=s(b),E=v===null?void 0:a.get(v),A=E===void 0?void 0:g.get(E.id);return tf(b,2,Dr(`stage:${b.id}`),A)})],_=new Set(n.map(b=>b.id)),w=new Map(n.map(b=>[b.id,b.radius])),z=[];for(const b of o){for(const G of b.parents)_.has(G)&&z.push({source:G,target:b.id,strength:1,length:(w.get(G)??Tt)+b.radius+1.4});const v=s(b),E=v===null?void 0:a.get(v),A=v===null?0:d.get(v)??0,I=b.group===null?1:Math.max(1,l.get(b.group)?.size??1);if(E!==void 0&&A>0){const G=A/u,C=(ef+(hy-ef)*G)/Math.sqrt(I);z.push({source:E.id,target:b.id,strength:C,length:E.radius+b.radius+1})}}const y=Qn(m,3).force("link",Ni(z).id(b=>b.id).distance(b=>Number(b.length)).strength(b=>Number(b.strength))).stop();if(e.charge){const b=Jn().strength(v=>-6*(v.r/Tt)**2);b.distanceMax(Math.min(e.reach??Jh,Jh)),y.force("charge",b)}e.collide&&y.force("collide",Zn().radius(b=>b.r*1.2));const O=m.some(b=>b.fx===void 0);for(let b=0;O&&b<Qh;b++)y.tick(),b%4===0&&t(.4+.6*(b/Qh));const S={};for(const b of m)S[b.id]=[b.x??0,b.y??0,b.z??0];return t(1),S}function tf(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 Tr=.4,my=400,qi=.35,gy=.01,My=3;function sf(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 nf=1.4,by=Math.PI/3;function _y(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=Si(e),p=u===0?0:d.radius*2+nf;t.set(d.id,[h[0]*p,h[1]*p,h[2]*p]),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 p of i.get(d.id)??[]){if(t.has(p.id))continue;const f=e()*by,M=zy(h,e),g=zg([h[0]*Math.cos(f)+M[0]*Math.sin(f),h[1]*Math.cos(f)+M[1]*Math.sin(f),h[2]*Math.cos(f)+M[2]*Math.sin(f)]),m=d.radius+p.radius+nf;t.set(p.id,[u[0]+g[0]*m,u[1]+g[1]*m,u[2]+g[2]*m]),a.set(p.id,g),o.push(p)}}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=Tt;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 zg(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 zy(n,e){const t=Math.abs(n[0])<.9?[1,0,0]:[0,1,0],s=zg([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 Si(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 wy{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+Tr;Math.hypot(e[0]-d.centre[0],e[1]-d.centre[1],e[2]-d.centre[2])<u&&s.push(d)}return s}}function rf(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?Si(s):[i[0]/r,i[1]/r,i[2]/r];const a=t+n.particle.radius+Tr;return[n.centre[0]+i[0]*a,n.centre[1]+i[1]*a,n.centre[2]+i[2]*a]}function yy(n,e,t=()=>{}){const s={},i={};if(n.length>0&&n.every(f=>f.frozen===!0&&f.seed!==void 0)){for(const f of n)s[f.id]=f.seed;return t(1),{positions:s,arrival:i}}const r=new Map;for(const f of n){if(f.group===null){s[f.id]=[0,0,0];continue}r.set(f.group,[...r.get(f.group)??[],f])}const a=[...r].map(([f,M])=>{const g=new Set;let m=Number.POSITIVE_INFINITY;for(const z of M){const y=z.attrs?.plugin;typeof y=="string"&&g.add(y);const O=z.attrs?.createdAt;typeof O=="number"&&O<m&&(m=O)}if(M.every(z=>z.frozen===!0&&z.seed!==void 0)){const z=M.map(b=>b.seed),y=[0,1,2].map(b=>z.reduce((v,E)=>v+E[b],0)/z.length),O=new Map;let S=Tt;for(const b of M){const v=b.seed,E=[v[0]-y[0],v[1]-y[1],v[2]-y[2]];O.set(b.id,E),S=Math.max(S,Math.hypot(E[0],E[1],E[2])+b.radius)}return{key:f,nodes:M,plugins:g,created:m,local:O,radius:S,held:!0,centre:y}}const{local:_,radius:w}=_y(M,Dr(`turn:${f}`));return{key:f,nodes:M,plugins:g,created:m,local:_,radius:w,held:!1}});a.sort((f,M)=>f.created-M.created||(f.key<M.key?-1:f.key>M.key?1:0));const o=new Map;for(const f of a)for(const M of f.plugins)o.set(M,(o.get(M)??0)+1);const l=_g(o,a.length),c=Math.max(Tt,...a.map(f=>f.radius)),d=new wy(2*c+Tr),u=[];let h=0;const p=(f,M,g)=>{const m={particle:f,centre:g};u.push(m),d.add(m),h=Math.max(h,Math.hypot(g[0],g[1],g[2])+f.radius);for(const _ of f.nodes){const w=f.local.get(_.id)??[0,0,0];s[_.id]=f.held&&_.seed!==void 0?_.seed:[g[0]+w[0],g[1]+w[1],g[2]+w[2]],i[_.id]=M}};return a.forEach((f,M)=>{f.held&&f.centre!==void 0&&p(f,M,f.centre)}),a.forEach((f,M)=>{if(f.held)return;const g=Dr(`accrete:${f.key}`);let m;if(u.length===0)m=[0,0,0];else{let _=u[u.length-1],w=-1;for(const v of u){const E=sf(f.plugins,v.particle.plugins,l);E>=w&&(_=v,w=E)}const z=h+My*f.radius+c,y=Math.max(.5,f.radius*.5),O=Si(g);let S=[O[0]*z,O[1]*z,O[2]*z],b=null;for(let v=0;v<my&&b===null;v++){const E=Si(g),A=[_.centre[0]-S[0],_.centre[1]-S[1],_.centre[2]-S[2]],I=Math.max(1e-9,Math.hypot(A[0],A[1],A[2])),G=[E[0]*(1-qi)+A[0]/I*qi,E[1]*(1-qi)+A[1]/I*qi,E[2]*(1-qi)+A[2]/I*qi],C=[S[0]+G[0]*y,S[1]+G[1]*y,S[2]+G[2]*y],B=d.touching(C,f.radius);if(B.length===0){if(Math.hypot(C[0],C[1],C[2])>z*2){const H=Si(g);S=[H[0]*z,H[1]*z,H[2]*z]}else S=C;continue}let P=B[0],W=-1;for(const H of B){const X=sf(f.plugins,H.particle.plugins,l);X>W&&(P=H,W=X)}if(g()<Math.max(gy,W)&&(b=rf(P,S,f.radius,g),d.touching(b,f.radius-1e-6).some(H=>H!==P&&wg(b,f.radius,H))&&(b=null)),b===null){const H=rf(P,S,f.radius,g),X=[H[0]-P.centre[0],H[1]-P.centre[1],H[2]-P.centre[2]],oe=Math.max(1e-9,Math.hypot(X[0],X[1],X[2]));S=[H[0]+X[0]/oe*y,H[1]+X[1]/oe*y,H[2]+X[2]/oe*y]}}m=b??vy(_,f.radius,d,g)}p(f,M,m),M%8===0&&t(M/Math.max(1,a.length))}),t(1),{positions:s,arrival:i}}function wg(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+Tr*.5}function vy(n,e,t,s){for(let a=0;a<8;a++)for(let o=0;o<24;o++){const l=Si(s),c=e+n.particle.radius+Tr+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=>wg(d,e,u)))return d}const i=Si(s),r=e+n.particle.radius+Tr+8*e;return[n.centre[0]+i[0]*r,n.centre[1]+i[1]*r,n.centre[2]+i[2]*r]}function yg(n){const e=new Map(n.map(f=>[f.id,f])),t=new Map,s=(f,M)=>{const g=t.get(f.id);if(g!==void 0)return g;if(M.has(f.id)||f.parentIds.length===0)return t.set(f.id,0),0;M.add(f.id);let m=0;for(const _ of f.parentIds){const w=e.get(_);w&&(m=Math.max(m,s(w,M)+1))}return t.set(f.id,m),m};for(const f of n)s(f,new Set);const i=new Map,r=[],a=(f,M)=>f.id.localeCompare(M.id,void 0,{numeric:!0});for(const f of n){const M=f.parentIds.find(m=>e.has(m));if(M===void 0){r.push(f);continue}const g=i.get(M)??[];g.push(f),i.set(M,g)}r.sort(a);for(const f of i.values())f.sort(a);const o=new Map;let l=0;const c=new Set,d=f=>{c.add(f.id);const M=(i.get(f.id)??[]).filter(w=>!c.has(w.id));if(M.length===0){const w=l++;return o.set(f.id,w),[w,w]}let g=Number.POSITIVE_INFINITY,m=Number.NEGATIVE_INFINITY;for(const w of M){const[z,y]=d(w);g=Math.min(g,z),m=Math.max(m,y)}const _=(g+m)/2;return o.set(f.id,_),[g,m]};for(const f of r)d(f);for(const f of n)o.has(f.id)||d(f);const u=Math.max(...Array.from(t.values()),0)+1,h=Math.max(l-1,0);return{placements:n.map(f=>({id:f.id,x:o.get(f.id)??0,tier:t.get(f.id)??0})),width:h,tierCount:u}}const Oy=2.6,xy=2;function Gu(n){const e=n.map(r=>r.metric??0),t=Math.max(...e,0),s=yg(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)*xy,l=((s.tierCount-1)/2-(a?.tier??0))*Oy,c=r.metric??0,d=t>0?.55+c/t*1:1,u=[o,l,0];return{id:r.id,position:u,radius:Tt*d}})}const Sy=.02;function Ey(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 Ay{nodes;grabbed;sim;constructor(e){const{ids:t,links:s}=Ey(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=Qn(this.nodes,e.dimensions).force("link",Ni(s).id(o=>o.id).distance(o=>r(o.source.id)+r(o.target.id)+1.4)).force("charge",Jn().strength(o=>-6*(r(o.id)/e.baseRadius)**2).distanceMax(12)).force("collide",Zn().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()<=Sy?!1:(this.sim.tick(),!0)}positions(){return this.nodes.map(e=>({id:e.id,position:[e.x,e.y,e.z]}))}}function Ml(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 vg(n){const e=n.attrs?.metric;return typeof e=="number"?e:void 0}function Og(n){const e={};for(const t of n)e[t.id]=t.position;return e}const Dy={id:"galaxy",label:"GALAXY",needs:[],run:(n,e)=>({positions:mg(n.nodes.map(Ml),n.physics,e)})},Ty={id:"spokes",label:"SPOKES",needs:[],run:(n,e)=>({positions:Iu(n.nodes.map(Ml),n.physics,e,"spokes")})},Iy={id:"clumps",label:"CLUMPS",needs:[],run:(n,e)=>({positions:Iu(n.nodes.map(Ml),n.physics,e,"clumps")})},Gy={id:"ranked",label:"RANKED",needs:[],run:(n,e)=>{const t=n.nodes.map(i=>{const r={id:i.id,parentIds:i.parents},a=vg(i);return a!==void 0&&(r.metric=a),r}),s=Og(Gu(t));return e(1),{positions:s}}},Ry={id:"molecule",label:"MOLECULE",needs:[],run:(n,e)=>{const t=n.nodes.map(a=>{const o={id:a.id,parents:a.parents},l=vg(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=Og(dy(t,3,s,n.physics,i));return e(1),{positions:r}}},Ny={id:"constellations",label:"CONSTELLATIONS",needs:["plugin"],run:(n,e)=>({positions:py(n.nodes,n.physics,e)})},By={id:"hubs",label:"HUBS",needs:[],run:(n,e)=>({positions:mg(n.nodes.map(Ml),n.physics,e)})},Cy={id:"accretion",label:"ACCRETION",needs:["plugin"],run:(n,e)=>yy(n.nodes,n.physics,e)},Py=[Dy,Ty,Iy,Ny,By,Cy,Gy,Ry];function Ly(n){return Py.find(e=>e.id===n)}function Wy(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]===`
22
22
  `){l(),c(),a+=2;continue}if(d===`
23
23
  `||d==="\r"){l(),c(),a+=1;continue}s+=d,a+=1}return(s!==""||o||i.length>0)&&(l(),c()),t}function ky(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 Uy(n,e){const t=/\.tsv$/i.test(e)?" ":",",s=Wy(n,t);if(s.length===0)return{caps:[],rows:[],headed:!1};const i=s[0],r=ky(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}}const af=/\.json$/i,Fy=4*1024*1024,jl=/("(?:\\.|[^"\\])*")(\s*:)?|(-?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)|\b(true|false|null)\b/g;function of(n){if(n.length>Fy)return null;let e;try{e=JSON.parse(n)}catch{return null}const t=JSON.stringify(e,null,2),s=document.createDocumentFragment();let i=0;jl.lastIndex=0;for(let r=jl.exec(t);r!==null;r=jl.exec(t)){r.index>i&&s.append(t.slice(i,r.index));const a=document.createElement("span"),[o,l,c,d,u]=r;l!==void 0?(a.className=c!==void 0?"json-key":"json-string",a.textContent=l,s.append(a),c!==void 0&&s.append(c)):d!==void 0?(a.className="json-number",a.textContent=d,s.append(a)):(a.className="json-literal",a.textContent=u??o,s.append(a)),i=r.index+o.length}return i<t.length&&s.append(t.slice(i)),s}function jy(n){return n.model?.kind==="fs.listing"&&Array.isArray(n.model.data)&&n.model.data.length>0}function $y(n){const e=(n.renderedErr??n.rendered??"").replace(/\x1b\[[0-9;]*m/g,"").split(`
24
24
  `).map(s=>s.trim()).filter(s=>s.length>0).join(" · "),t=[...n.errors??[]].reverse().find(s=>s.type==="error")?.message?.replace(/^\[[^\]]*\]\s*\|\s*/,"")??"";return e||t||"refused"}function lf(n){return/-v(\d+(?:\.\d+)*)$/.exec(n)?.[1]??""}const cf="",Vy="/bin",df="/bin/recent",Ia={dir:"",file:"",link:"",plugin:"",pipeline:"",vfs:"",job:""},$l=["list","cards","preview"],Hy=5e3,qy=new Set(["png","jpg","jpeg","gif","svg","webp","bmp"]),Xy=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"]),uf=160,hf=100,Ga=10,Ky=30,Yy=256*1024,Zy=4e3,Qy=12*1024*1024,Jy=400;function bl(n){return qy.has(xg(n))}function xg(n){const e=n.split("/").pop()??"",t=e.lastIndexOf(".");return t>0?e.slice(t+1).toLowerCase():""}function ev(n){if(n.includes("\0"))return!0;const e=(n.match(/\uFFFD/g)??[]).length;return e>0&&e/n.length>.02}const tv=80;function ff(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 pf(n){const e="http://www.w3.org/2000/svg",t=document.createElementNS(e,"svg");t.setAttribute("viewBox",`0 0 ${uf} ${hf}`),t.setAttribute("preserveAspectRatio","xMidYMid meet");const s=yg(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:Ga+o.x/i*(uf-2*Ga),y:Ga+o.tier/r*(hf-2*Ga)});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>Ky?"2.2":"4"),l.setAttribute("fill","currentColor"),t.appendChild(l)}return t}function Ra(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 Sg{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($l[($l.indexOf(this.viewMode)+1)%$l.length]??"list")});const a=e.parentElement?.querySelector(":scope > .mode-frame")!==null;this.listing=new ni({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||Ra(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||Ra(e.entry)!==null;return t.className=`files-control files-glyph files-glyph-${s}${i?" files-capsule":""}`,t.textContent=e.home===!0?cf:!e.updir&&this.denied.has(e.path)?"⃠":Ia[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"?"":gf(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=Ra(e.entry);t!==null&&this.activate({kind:t,path:e.path})}envelope_observe(e){if(e.status==="error"&&!jy(e)){this.listing.activation_refuse($y(e));return}if(e.model?.kind!=="fs.listing")return;const t=mf(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=mf(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=Uy(t,e);if(s.caps.length===0){this.content_show(e,t);return}const i=s.rows.slice(0,Hy),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 p=document.createElement("span");p.className="mode-elbow";const f=document.createElement("aside");f.className="mode-frame";const M=document.createElement("button");M.className="strategy-pill csv-filter rail-off",M.textContent="FILTER OFF",M.title="filter the table";const g=document.createElement("button");g.className="strategy-pill csv-raw",g.textContent="RAW",g.title="the bytes as written",g.addEventListener("click",()=>this.content_show(e,t));const m=document.createElement("button");m.className="strategy-pill csv-close",m.textContent="CLOSE",m.title="leave the table; the listing beneath returns",m.addEventListener("click",()=>this.listing_restore());const _=document.createElement("span");_.className="mode-fill",f.append(M,g,_);const w=this.preview;if(w!==null){const S=document.createElement("button");S.className="strategy-pill csv-download",S.textContent="DOWNLOAD",S.title="save this file to your disk",S.addEventListener("click",()=>w.download(e)),f.append(S)}f.append(m);const z=document.createElement("div");z.className="files-table-rows",d.append(u,h,p,f,z),a.append(o,d),this.container.appendChild(a);const y=s.caps.map((S,b)=>({key:`c${b}`,label:S.toUpperCase(),className:"files-table-cell",cell:v=>v.cells[b]??"",width:"minmax(6em, 1fr)"}));new ni({mount:z,traits:y,key:S=>String(S.index),chrome:{root:a,prefix:"csv"},state:S=>{const b=[];return S.filter!==""?b.push(`${S.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 S=document.createElement("div");return S.className="files-note",S.textContent="NO ROWS",S}}).rows_set([{key:e,rows:i.map((S,b)=>({index:b,cells:S}))}],{field:e}),this.contentRelease=()=>{z.replaceChildren()}}content_show(e,t,s=!1){this.diagram_declare(!1),this.contentShown=!0,this.container.parentElement?.classList.add("content-view"),this.container.replaceChildren();const i=document.createElement("header");i.className="files-path files-content-header";const r=document.createElement("span");r.textContent=e;const a=document.createElement("button");a.className="files-close-pill",a.textContent="CLOSE",a.addEventListener("click",()=>this.listing_restore());const o=document.createElement("pre");o.className="files-content";const l=s||!af.test(e)?null:of(t),c=[];if(l!==null||s&&af.test(e)&&of(t)!==null){const d=document.createElement("button");d.className="files-close-pill",d.textContent=l!==null?"RAW":"PRETTY",d.addEventListener("click",()=>this.content_show(e,t,l!==null)),c.push(d)}i.append(r,...ff(this.preview,e),...c,a),l!==null?(o.classList.add("files-json"),o.append(l)):o.textContent=t,this.container.append(i,o),Hs(o)}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,...ff(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?"":lf(s.entry.name),compare:s=>lf(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),Dz(this.stateSpan,"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===Vy);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:Na(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:sv(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:Na(df,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:df,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?`${cf} ~`:"▴ ..",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(Na(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?"":gf(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 f=document.createElement("div");f.className="files-card-target",f.textContent=`→ ${t.target}`,f.title=t.target,i.appendChild(f)}const h=Na(e,t.name),p=Ra(t);return p!==null&&(i.classList.add("files-activatable"),i.addEventListener("click",()=>this.activate({kind:p,path:h}))),i}thumb_build(e,t){const s=document.createElement("div");s.className="files-card-thumb";const i=()=>{s.textContent=Ia[t.type]};if(ag.test(t.name)||Xo.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 p=document.createElement("span");p.className="thumb-series-text",p.textContent=h.replace(/_/g," "),s.appendChild(p)}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(pf([{id:e,parentIds:[]}])),s;if(t.type==="pipeline"){const u=this.preview;s.classList.add("thumb-wait"),s.textContent=Ia[t.type];const h=()=>{u.pipelineGlimpse(e).then(p=>{if(s.classList.remove("thumb-wait"),p===null||p.length===0){i();return}if(p.length>tv){s.textContent=`${p.length} NODES`,s.classList.add("thumb-count");return}s.replaceChildren(pf(p))}).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=bl(e)&&t.size<=Qy,o=xg(e),l=(o===""||Xy.has(o))&&t.size<=Yy;if(!a&&!l)return i(),s;s.classList.add("thumb-wait"),s.textContent=Ia.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,Zy).then(u=>{if(this.headCache.size>=Jy&&this.headCache.clear(),this.headCache.set(e,u),s.classList.remove("thumb-wait"),u.trim()===""||ev(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 mf(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 Na(n,e){return n.endsWith("/")?`${n}${e}`:`${n}/${e}`}function sv(n){const e=n.endsWith("/")?n.slice(0,-1):n,t=e.lastIndexOf("/");return t<=0?"/":e.slice(0,t)}function gf(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]}`}class nv{grid;startHere;host;paintId=0;constructor(e,t){this.host=t,this.grid=e.querySelector(".launcher-grid"),Hs(this.grid,{rows:".launcher-tile",mount:this.grid.parentElement??this.grid});const s=e.querySelector(".launcher-body");s!==null&&Hs(s,{rows:".launcher-tile",scrolls:()=>/auto|scroll/.test(getComputedStyle(s).overflowY)}),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||s.wide===!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||(this.host.leave?.(),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",p=>{p.stopPropagation(),this.host.leave?.(),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 p=document.createElement("span");if(p.className="launcher-row-text",p.textContent=d.text,u.append(h,p),d.open!==void 0){const f=d.open,M=document.createElement("span");M.className="launcher-go",M.textContent="›",u.appendChild(M),u.addEventListener("click",g=>{g.stopPropagation(),this.host.leave?.(),f()})}l.appendChild(u)}const c=document.createElement("span");return c.className="launcher-verb",c.textContent=e.verb,s.append(i,o),e.about!==void 0&&s.appendChild(iv(e.about)),s.append(l,c),s}}function iv(n){const e=document.createElement("span");e.className="launcher-about";const t=document.createElement("span");if(t.className="launcher-about-text",t.textContent=n.text,e.appendChild(t),n.list!==void 0&&n.list.length>0){const s=document.createElement("span");s.className="launcher-about-list";for(const i of n.list){const r=document.createElement("span");r.className="launcher-about-item",r.textContent=i,s.appendChild(r)}e.appendChild(s)}if(n.tail!==void 0){const s=document.createElement("span");s.className="launcher-about-text",s.textContent=n.tail,e.appendChild(s)}return e}const ms={left:{axis:"col",place:"before",focusWord:"left",arrow:"ArrowLeft",edge:"leftmost"},right:{axis:"col",place:"after",focusWord:"right",arrow:"ArrowRight",edge:"rightmost"},above:{axis:"row",place:"before",focusWord:"up",arrow:"ArrowUp",edge:"topmost"},below:{axis:"row",place:"after",focusWord:"down",arrow:"ArrowDown",edge:"bottommost"}},Ru=["left","right","above","below"];function Mf(n){return n==="left"||n==="right"||n==="above"||n==="below"}function rv(n,e){return n==="row"?e?"above":"below":e?"left":"right"}function av(n,e){return n!=="row"&&n!=="col"||e!=="before"&&e!=="after"?null:rv(n,e==="before")}function ov(n){return Ru.find(e=>ms[e].focusWord===n)??null}function lv(n){return Ru.find(e=>ms[e].arrow===n)??null}function cv(n){return n?"before":"after"}function Ts(n){return`[data-split="${ms[n].axis}"][data-place="${ms[n].place}"]`}const dv=new Set(["pane","view","runs","node","dag","universe","file","pacs","image","tags","header","console","back","desktop","dashboard","help","notes","launcher","attach","argus"]),Eg=new Set(["layout","slice","series","wl","colormap","save","tags","load","guard","ghost","state"]),uv={pacs:new Set(["sort","filter"]),help:new Set(["pane","keys","verbs"]),notes:new Set(["pane"]),file:new Set(["home","back","download","delete","follow","root","list","cards","preview","sort","filter"]),tags:new Set(["redact","filter"]),image:Eg};let _n=null;const Xi="argus.desktop.",bf="~/.config/argus/desktops";function hv(n){const e=n.trim().split(/\s+/),t=(e[0]??"").toLowerCase();if(!dv.has(t))return null;const s=uv[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 _f(n,e){if(e===null)return n.focused_get();if(e.startsWith("@"))return e.slice(1);const t=parseInt(e.slice(1),10);return _n===null?null:_n[t-1]??null}function fv(n,e,t){return e!==null&&t.includes(n.paneKind_get(e)??"")?e:n.panes_shown().find(s=>t.includes(n.paneKind_get(s)??""))??null}function Zs(n,e,t){const i=n.paneMount_get(e)?.querySelector(t)??null;return i===null?!1:(i.click(),!0)}function Ba(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 pv(n,e,t){return Zs(n,e,`.drawer-cwdbind[data-follow="${t?"on":"off"}"]`)}function Vr(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 Ag(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),p=u+h*2;(a===null||p<a.score)&&(a={id:o,score:p})}return a===null?null:(n.focus_set(a.id),a.id)}const Ci=[{key:"%",topic:"pane",selector:Ts("right"),does:"split right (tmux)"},{key:'"',topic:"pane",selector:Ts("below"),does:"split below (tmux)"},{key:"h",topic:"pane",selector:Ts("left"),does:"split left"},{key:"j",topic:"pane",selector:Ts("below"),does:"split below"},{key:"k",topic:"pane",selector:Ts("above"),does:"split above"},{key:"l",topic:"pane",selector:Ts("right"),does:"split right"},{key:"H",topic:"pane",selector:Ts("left"),does:"move this pane left",move:!0},{key:"J",topic:"pane",selector:Ts("below"),does:"move this pane below",move:!0},{key:"K",topic:"pane",selector:Ts("above"),does:"move this pane above",move:!0},{key:"L",topic:"pane",selector:Ts("right"),does:"move this pane right",move:!0},{key:"m",topic:"pane",selector:'.drawer-mode[data-mode="move"]',does:"arm MOVE (then a direction)"},{key:"z",topic:"pane",selector:".drawer-zoom",does:"zoom (tmux), or double-click the pane's header"},{key:"x",topic:"pane",selector:".drawer-close",does:"close (tmux)"},{key:"u",topic:"binding",selector:'.drawer-bind[data-bind="unlinked"]',does:"the next split is unlinked"},{key:"f",topic:"binding",selector:'.drawer-bind[data-bind="fs"]',does:"the next split is a linked filesystem"},{key:"v",topic:"binding",selector:'.drawer-bind[data-bind="viewer"]',does:"the next split is a linked viewer"},{key:"1",topic:"claim",selector:".empty-go-files",does:"claim an empty pane as FILES"},{key:"2",topic:"claim",selector:".empty-go-dag",does:"claim an empty pane as RUNS"},{key:"3",topic:"claim",selector:".empty-go-pacs",does:"claim an empty pane as PACS"},{key:"o",topic:"focus",selector:null,does:"focus the next pane (tmux)"},{key:";",topic:"focus",selector:null,does:"focus the last pane (tmux)"},{key:"q",topic:"focus",selector:null,does:"show every pane's @id on its bar (tmux)"},{key:"Space",topic:"pane",selector:null,does:"flip this pane's split: beside becomes above (tmux next layout)"},{key:"!",topic:"pane",selector:null,does:"break this pane out: alone on stage, the rest a PANES card (tmux)"},{key:"Ctrl-←↑↓→",topic:"pane",selector:null,does:"move the boundary beside this pane a step (tmux)"},{key:"w",topic:"stage",selector:null,does:"PANES, the desktops (tmux window chooser)"},{key:"r",topic:"focus",selector:null,does:"the keys into this pane's frame: Tab or ↑↓ walk its verbs, Enter presses, ← or Esc leaves"},{key:"&",topic:"pane",selector:null,does:"close every pane on the stage (tmux kill-window)"},{key:"[",topic:"console",selector:null,does:"the console's scrollback takes the keys (tmux)"},{key:"O",topic:"focus",selector:null,does:"focus the previous pane"},{key:"←↑↓→",topic:"focus",selector:null,does:"focus the pane in that direction (tmux)"},{key:":",topic:"console",selector:null,does:"the command line (tmux)"},{key:"?",topic:"console",selector:null,does:"this table"}];function mv(n){let e=0;for(const t of n.panes_shown())Zs(n,t,".drawer-close")&&(e+=1);return`closed ${e} pane${e===1?"":"s"}`}const Dg=["prefix chords — Ctrl-B opens the focused pane's drawer; one key then presses one capsule",...Ci.map(n=>` ${n.key.padEnd(6)} ${n.does}`)," Tab walks the verbs; Enter fires; Esc closes the drawer","in a pane holding a listing, no prefix needed:"," ↑↓ move the row cursor (Home/End: first/last)"," Enter indicates the row (its verbs ride the frame); Enter again goes (opens, enters, folds open)"," → the keys into the frame, as Ctrl-B r"].join(`
@@ -29,11 +29,11 @@ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./cornerstoneEngine-Dn
29
29
  `)[0]})`}if(e==="delete")return window.localStorage.removeItem(Xi+t),`deleted '${t}' (local; a CFS copy, if any, is yours to rm)`;if(e==="load"){let s=window.localStorage.getItem(Xi+t);if(s===null){const r=await n.session_run(`cat ${bf}/${t}.desk`);r.trim().length>0&&!r.includes("No such")&&!r.toLowerCase().includes("error")&&(s=r)}if(s===null)return`(no desktop '${t}')`;_n=[];const i=[];try{for(const r of s.split(`
30
30
  `)){const a=r.trim();if(a===""||a.startsWith("#"))continue;const o=await ld(n,a);i.push(`${a} → ${o??"(session line?)"}`),await new Promise(l=>{window.setTimeout(l,60)})}}finally{_n=null}return`loaded '${t}'
31
31
  ${i.join(`
32
- `)}`}return"desktop save|load|show|list|delete [name]"}const Pn={universe:{text:"Every analysis, drawn as a galaxy. Alike analyses cluster; failures glow red. Rearrange it:",list:["GALAXY: grouped by pipeline (the default)","SPOKES · CLUMPS: the same groups, tidier","CONSTELLATIONS: grouped by the tools they used","DATA: hung from the data they began with (format, modality, series)","ACCRETION: grown oldest-first, like next to like"],tail:"Replay its history, or fly in to any one analysis to see its steps."},analyses:{text:"Your analyses, newest first. Open one to follow it, read its logs and browse its results."},files:{text:"Your ChRIS home: uploads, results and what others shared with you."},pacs:{text:"Find studies in the hospital PACS and pull the series you need into ChRIS."},panes:{text:"Saved workspaces: return to a piece of work as you left it."},keys:{text:"Keyboard shortcuts and the commands ARGUS understands."},notes:{text:"A list of updates since the previous release."},console:{text:"A command line into the same session; what you do here shows in the panes, and the other way round."}};function _v(n){return async()=>{const[e,t,s]=await Promise.all([n.ask("proc feeds"),n.ask("ls ~"),n.notes_latest()]);let i=[];for(const v of e.envelopes){const E=v.model;if(E===void 0||E.kind!==Vm)continue;const A=$m.safeParse(E.data);A.success&&(i=A.data.feeds)}const a=i.length===0&&e.envelopes.some(v=>v.status==="error")?"INDEX WARMING":`${i.length} FEEDS`,o=i.filter(v=>/error/i.test(v.status)).length,l=i.filter(v=>/running|scheduled|created|started/i.test(v.status)).length;let c=[],d="~";for(const v of t.envelopes){if(v.model?.kind!=="fs.listing")continue;const A=v.model.data[0];A!==void 0&&Array.isArray(A.items)&&(c=A.items,typeof A.path=="string"&&(d=A.path))}const u=c.filter(v=>v.type==="dir"),h=n.desktops(),p={key:"universe",name:"UNIVERSE",hue:"--honey",numeral:"",figures:[{text:a}],rows:[],verb:"SEE THE SPACE",about:Pn.universe,enter:()=>n.universe_show()},f={key:"analyses",name:"ANALYSES",hue:"--october-sunset",numeral:"3",figures:[{text:a},...l>0?[{text:`${l} RUNNING`}]:[],...o>0?[{text:`${o} ERRORED`,errored:!0,open:()=>n.runs_show("status:error")}]:[]],rows:i.slice(0,6).map(v=>({text:`${v.id} ${v.title}`,errored:/error/i.test(v.status),open:()=>n.feed_enter(v.id)})),verb:"OPEN THE ROSTER",about:Pn.analyses,enter:()=>n.runs_show()},M={key:"files",name:"FILES",hue:"--harvestgold",numeral:"2",figures:[{text:`${c.length} ENTRIES`}],rows:u.slice(0,5).map(v=>({text:v.name,open:()=>n.home_cd(d.endsWith("/")?`${d}${v.name}`:`${d}/${v.name}`)})),verb:"OPEN HOME",about:Pn.files,enter:()=>n.home_open()},g=n.pacs_query(),m={key:"pacs",name:"PACS",hue:"--daybreak",numeral:"4",figures:[{text:g===""?"NO ANSWER":"ANSWERED"}],rows:g===""?[{text:"pacs query PatientID:…",open:()=>n.line_offer("pacs query PatientID:")},{text:"pacs query AccessionNumber:…",open:()=>n.line_offer("pacs query AccessionNumber:")}]:[{text:g.slice(0,48)}],verb:"ASK A PACS",about:Pn.pacs,enter:()=>n.pacs_open()},_={key:"panes",name:"PANES",hue:"--butter",numeral:"6",figures:[{text:h.length===0?"EMPTY":`${h.length} DESKTOPS`}],rows:h.slice(0,5).map(v=>({text:v.label,open:()=>n.desktop_restore(v.id)})),verb:"SEE DESKTOPS",about:Pn.panes,enter:()=>n.panes_open()},w={key:"help",name:"KEYS",hue:"--butter",numeral:"",figures:[{text:`${Ci.length} KEYS`},{text:`${Nu.length} VERBS`}],rows:Ci.slice(0,5).map(v=>({text:`${v.key.padEnd(6)} ${v.does}`,open:()=>n.keys_open()})),verb:"OPEN THE KEYS",about:Pn.keys,enter:()=>n.keys_open()},z=s?.releases[0],y=z?.entries.flatMap(v=>v.changes.filter(E=>!E.internal))??[],O={key:"notes",name:"WHAT'S NEW",hue:"--butter",numeral:"",figures:z===void 0?[{text:"NO NOTES"}]:[{text:n.daemon_stale()?"AFTER RESTART":z.date??"UNDATED"},{text:`${y.length} CHANGE${y.length===1?"":"S"}`}],rows:y.slice(0,3).map(v=>({text:`${v.package.padEnd(7)} ${v.headline}`,open:()=>n.notes_open()})),verb:"OPEN THE NOTES",about:Pn.notes,enter:()=>n.notes_open()},S={key:"console",name:"CONSOLE",hue:"--daybreak",numeral:"5",figures:[],rows:[],verb:"OPEN THE CONSOLE",about:Pn.console,enter:()=>n.console_open()},b=[M,m,_,p,w,O,S];return i.length>=c.length?[f,...b]:[M,f,m,_,p,w,O,S]}}const zv=/\s--(?:\s|$)/;function _l(n){const e=zv.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 Ig(n,e){return`cd "${n}"; ${e}`}function wv(n){return/^[A-Za-z0-9_./:@+=,-]+$/.test(n)?n:`"${n.replace(/(["\\])/g,"\\$1")}"`}function Gg(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 zf(n){return n.length>=2&&n.startsWith('"')&&n.endsWith('"')?n.slice(1,-1).replace(/\\(["\\])/g,"$1"):n}function Rg(n){return n.startsWith("-")&&n!=="-"&&!/^-\d/.test(n)}function yv(n,e){const t=Gg(_l(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||Rg(r)?!0:zf(r)}if(i.startsWith(`${e}=`))return zf(i.slice(e.length+1))}return null}function wf(n,e,t){const s=_l(n),i=Gg(s.args),r=[];let a=!1;const o=t===null||t===""?[]:t===!0?[e]:[e,wv(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&&!Rg(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 vv(n){return/\bfeed_title=/.test(_l(n).tail)}function Ov(n,e){return`${n} -- feed_title="${e.replace(/(["\\])/g,"\\$1")}"`}function Ng(n){return _l(n).head.replace(/^.*;\s*/,"").trim()}function xv(n,e,t){return/^[A-Za-z0-9_-]+$/.test(n)&&t.filter(i=>i===n).length===1?n:`@${e}`}const Bu="185",Sv=0,yf=1,Ev=2,Oo=1,Av=2,ua=3,ri=0,gs=1,zn=2,Sn=0,Ei=1,Pi=2,vf=3,Of=4,Dv=5,_i=100,Tv=101,Iv=102,Gv=103,Rv=104,Nv=200,Bv=201,Cv=202,Pv=203,cd=204,dd=205,Lv=206,Wv=207,kv=208,Uv=209,Fv=210,jv=211,$v=212,Vv=213,Hv=214,ud=0,hd=1,fd=2,Ir=3,pd=4,md=5,gd=6,Md=7,Bg=0,qv=1,Xv=2,nn=0,Cg=1,Pg=2,Lg=3,Wg=4,kg=5,Ug=6,Fg=7,jg=300,Li=301,Gr=302,Vl=303,Hl=304,zl=306,bd=1e3,yn=1001,_d=1002,ss=1003,Kv=1004,Ca=1005,os=1006,ql=1007,yi=1008,Ss=1009,$g=1010,Vg=1011,ya=1012,Cu=1013,on=1014,$s=1015,Dn=1016,Pu=1017,Lu=1018,va=1020,Hg=35902,qg=35899,Xg=1021,Kg=1022,Vs=1023,Tn=1026,vi=1027,Wu=1028,ku=1029,Wi=1030,Uu=1031,Fu=1033,xo=33776,So=33777,Eo=33778,Ao=33779,zd=35840,wd=35841,yd=35842,vd=35843,Od=36196,xd=37492,Sd=37496,Ed=37488,Ad=37489,Zo=37490,Dd=37491,Td=37808,Id=37809,Gd=37810,Rd=37811,Nd=37812,Bd=37813,Cd=37814,Pd=37815,Ld=37816,Wd=37817,kd=37818,Ud=37819,Fd=37820,jd=37821,$d=36492,Vd=36494,Hd=36495,qd=36283,Xd=36284,Qo=36285,Kd=36286,Yv=3200,Yd=0,Zv=1,qn="",Is="srgb",Jo="srgb-linear",el="linear",St="srgb",Ki=7680,xf=519,Qv=512,Jv=513,eO=514,ju=515,tO=516,sO=517,$u=518,nO=519,Zd=35044,Sf="300 es",tn=2e3,Oa=2001;function iO(n){for(let e=n.length-1;e>=0;--e)if(n[e]>=65535)return!0;return!1}function tl(n){return document.createElementNS("http://www.w3.org/1999/xhtml",n)}function rO(){const n=tl("canvas");return n.style.display="block",n}const Ef={};function sl(...n){const e="THREE."+n.shift();console.log(e,...n)}function Yg(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 He(...n){n=Yg(n);const e="THREE."+n.shift();{const t=n[0];t&&t.isStackTrace?console.warn(t.getError(e)):console.warn(e,...n)}}function pt(...n){n=Yg(n);const e="THREE."+n.shift();{const t=n[0];t&&t.isStackTrace?console.error(t.getError(e)):console.error(e,...n)}}function yr(...n){const e=n.join(" ");e in Ef||(Ef[e]=!0,He(...n))}function aO(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 oO={[ud]:hd,[fd]:gd,[pd]:Md,[Ir]:md,[hd]:ud,[gd]:fd,[Md]:pd,[md]:Ir};class Ui{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 is=["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"],Xl=Math.PI/180,Qd=180/Math.PI;function ei(){const n=Math.random()*4294967295|0,e=Math.random()*4294967295|0,t=Math.random()*4294967295|0,s=Math.random()*4294967295|0;return(is[n&255]+is[n>>8&255]+is[n>>16&255]+is[n>>24&255]+"-"+is[e&255]+is[e>>8&255]+"-"+is[e>>16&15|64]+is[e>>24&255]+"-"+is[t&63|128]+is[t>>8&255]+"-"+is[t>>16&255]+is[t>>24&255]+is[s&255]+is[s>>8&255]+is[s>>16&255]+is[s>>24&255]).toLowerCase()}function gt(n,e,t){return Math.max(e,Math.min(t,n))}function lO(n,e){return(n%e+e)%e}function Kl(n,e,t){return(1-t)*n+t*e}function en(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 Dt(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 ch=class ch{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=gt(this.x,e.x,t.x),this.y=gt(this.y,e.y,t.y),this}clampScalar(e,t){return this.x=gt(this.x,e,t),this.y=gt(this.y,e,t),this}clampLength(e,t){const s=this.length();return this.divideScalar(s||1).multiplyScalar(gt(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(gt(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}};ch.prototype.isVector2=!0;let et=ch;class Fi{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],p=r[a+1],f=r[a+2],M=r[a+3];if(u!==M||l!==h||c!==p||d!==f){let g=l*h+c*p+d*f+u*M;g<0&&(h=-h,p=-p,f=-f,M=-M,g=-g);let m=1-o;if(g<.9995){const _=Math.acos(g),w=Math.sin(_);m=Math.sin(m*_)/w,o=Math.sin(o*_)/w,l=l*m+h*o,c=c*m+p*o,d=d*m+f*o,u=u*m+M*o}else{l=l*m+h*o,c=c*m+p*o,d=d*m+f*o,u=u*m+M*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],p=r[a+2],f=r[a+3];return e[t]=o*f+d*u+l*p-c*h,e[t+1]=l*f+d*h+c*u-o*p,e[t+2]=c*f+d*p+o*h-l*u,e[t+3]=d*f-o*u-l*h-c*p,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),p=l(i/2),f=l(r/2);switch(a){case"XYZ":this._x=h*d*u+c*p*f,this._y=c*p*u-h*d*f,this._z=c*d*f+h*p*u,this._w=c*d*u-h*p*f;break;case"YXZ":this._x=h*d*u+c*p*f,this._y=c*p*u-h*d*f,this._z=c*d*f-h*p*u,this._w=c*d*u+h*p*f;break;case"ZXY":this._x=h*d*u-c*p*f,this._y=c*p*u+h*d*f,this._z=c*d*f+h*p*u,this._w=c*d*u-h*p*f;break;case"ZYX":this._x=h*d*u-c*p*f,this._y=c*p*u+h*d*f,this._z=c*d*f-h*p*u,this._w=c*d*u+h*p*f;break;case"YZX":this._x=h*d*u+c*p*f,this._y=c*p*u+h*d*f,this._z=c*d*f-h*p*u,this._w=c*d*u-h*p*f;break;case"XZY":this._x=h*d*u-c*p*f,this._y=c*p*u-h*d*f,this._z=c*d*f+h*p*u,this._w=c*d*u+h*p*f;break;default:He("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 p=.5/Math.sqrt(h+1);this._w=.25/p,this._x=(d-l)*p,this._y=(r-c)*p,this._z=(a-i)*p}else if(s>o&&s>u){const p=2*Math.sqrt(1+s-o-u);this._w=(d-l)/p,this._x=.25*p,this._y=(i+a)/p,this._z=(r+c)/p}else if(o>u){const p=2*Math.sqrt(1+o-s-u);this._w=(r-c)/p,this._x=(i+a)/p,this._y=.25*p,this._z=(l+d)/p}else{const p=2*Math.sqrt(1+u-s-o);this._w=(a-i)/p,this._x=(r+c)/p,this._y=(l+d)/p,this._z=.25*p}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(gt(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 dh=class dh{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(Af.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(Af.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=gt(this.x,e.x,t.x),this.y=gt(this.y,e.y,t.y),this.z=gt(this.z,e.z,t.z),this}clampScalar(e,t){return this.x=gt(this.x,e,t),this.y=gt(this.y,e,t),this.z=gt(this.z,e,t),this}clampLength(e,t){const s=this.length();return this.divideScalar(s||1).multiplyScalar(gt(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 Yl.copy(this).projectOnVector(e),this.sub(Yl)}reflect(e){return this.sub(Yl.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(gt(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}};dh.prototype.isVector3=!0;let W=dh;const Yl=new W,Af=new Fi,uh=class uh{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],p=s[5],f=s[8],M=i[0],g=i[3],m=i[6],_=i[1],w=i[4],z=i[7],y=i[2],O=i[5],S=i[8];return r[0]=a*M+o*_+l*y,r[3]=a*g+o*w+l*O,r[6]=a*m+o*z+l*S,r[1]=c*M+d*_+u*y,r[4]=c*g+d*w+u*O,r[7]=c*m+d*z+u*S,r[2]=h*M+p*_+f*y,r[5]=h*g+p*w+f*O,r[8]=h*m+p*z+f*S,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,p=c*r-a*l,f=t*u+s*h+i*p;if(f===0)return this.set(0,0,0,0,0,0,0,0,0);const M=1/f;return e[0]=u*M,e[1]=(i*c-d*s)*M,e[2]=(o*s-i*a)*M,e[3]=h*M,e[4]=(d*t-i*l)*M,e[5]=(i*r-o*t)*M,e[6]=p*M,e[7]=(s*l-c*t)*M,e[8]=(a*t-s*r)*M,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 yr("Matrix3: .scale() is deprecated. Use .makeScale() instead."),this.premultiply(Zl.makeScale(e,t)),this}rotate(e){return yr("Matrix3: .rotate() is deprecated. Use .makeRotation() instead."),this.premultiply(Zl.makeRotation(-e)),this}translate(e,t){return yr("Matrix3: .translate() is deprecated. Use .makeTranslation() instead."),this.premultiply(Zl.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)}};uh.prototype.isMatrix3=!0;let st=uh;const Zl=new st,Df=new st().set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),Tf=new st().set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715);function cO(){const n={enabled:!0,workingColorSpace:Jo,spaces:{},convert:function(i,r,a){return this.enabled===!1||r===a||!r||!a||(this.spaces[r].transfer===St&&(i.r=En(i.r),i.g=En(i.g),i.b=En(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===St&&(i.r=vr(i.r),i.g=vr(i.g),i.b=vr(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===qn?el: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 yr("ColorManagement: .fromWorkingColorSpace() has been renamed to .workingToColorSpace()."),n.workingToColorSpace(i,r)},toWorkingColorSpace:function(i,r){return yr("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({[Jo]:{primaries:e,whitePoint:s,transfer:el,toXYZ:Df,fromXYZ:Tf,luminanceCoefficients:t,workingColorSpaceConfig:{unpackColorSpace:Is},outputColorSpaceConfig:{drawingBufferColorSpace:Is}},[Is]:{primaries:e,whitePoint:s,transfer:St,toXYZ:Df,fromXYZ:Tf,luminanceCoefficients:t,outputColorSpaceConfig:{drawingBufferColorSpace:Is}}}),n}const mt=cO();function En(n){return n<.04045?n*.0773993808:Math.pow(n*.9478672986+.0521327014,2.4)}function vr(n){return n<.0031308?n*12.92:1.055*Math.pow(n,.41666)-.055}let Yi;class dO{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{Yi===void 0&&(Yi=tl("canvas")),Yi.width=e.width,Yi.height=e.height;const i=Yi.getContext("2d");e instanceof ImageData?i.putImageData(e,0,0):i.drawImage(e,0,0,e.width,e.height),s=Yi}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=tl("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]=En(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(En(t[s]/255)*255):t[s]=En(t[s]);return{data:t,width:e.width,height:e.height}}else return He("ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),e}}let uO=0;class Vu{constructor(e=null){this.isSource=!0,Object.defineProperty(this,"id",{value:uO++}),this.uuid=ei(),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(Ql(i[a].image)):r.push(Ql(i[a]))}else r=Ql(i);s.url=r}return t||(e.images[this.uuid]=s),s}}function Ql(n){return typeof HTMLImageElement<"u"&&n instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&n instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&n instanceof ImageBitmap?dO.getDataURL(n):n.data?{data:Array.from(n.data),width:n.width,height:n.height,type:n.data.constructor.name}:(He("Texture: Unable to serialize Texture."),{})}let hO=0;const Jl=new W;class ls extends Ui{constructor(e=ls.DEFAULT_IMAGE,t=ls.DEFAULT_MAPPING,s=yn,i=yn,r=os,a=yi,o=Vs,l=Ss,c=ls.DEFAULT_ANISOTROPY,d=qn){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:hO++}),this.uuid=ei(),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 et(0,0),this.repeat=new et(1,1),this.center=new et(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new st,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(Jl).x}get height(){return this.source.getSize(Jl).y}get depth(){return this.source.getSize(Jl).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){He(`Texture.setValues(): parameter '${t}' has value of undefined.`);continue}const i=this[t];if(i===void 0){He(`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!==jg)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case bd:e.x=e.x-Math.floor(e.x);break;case yn:e.x=e.x<0?0:1;break;case _d: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 bd:e.y=e.y-Math.floor(e.y);break;case yn:e.y=e.y<0?0:1;break;case _d: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++}}ls.DEFAULT_IMAGE=null;ls.DEFAULT_MAPPING=jg;ls.DEFAULT_ANISOTROPY=1;const hh=class hh{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],p=l[5],f=l[9],M=l[2],g=l[6],m=l[10];if(Math.abs(d-h)<.01&&Math.abs(u-M)<.01&&Math.abs(f-g)<.01){if(Math.abs(d+h)<.1&&Math.abs(u+M)<.1&&Math.abs(f+g)<.1&&Math.abs(c+p+m-3)<.1)return this.set(1,0,0,0),this;t=Math.PI;const w=(c+1)/2,z=(p+1)/2,y=(m+1)/2,O=(d+h)/4,S=(u+M)/4,b=(f+g)/4;return w>z&&w>y?w<.01?(s=0,i=.707106781,r=.707106781):(s=Math.sqrt(w),i=O/s,r=S/s):z>y?z<.01?(s=.707106781,i=0,r=.707106781):(i=Math.sqrt(z),s=O/i,r=b/i):y<.01?(s=.707106781,i=.707106781,r=0):(r=Math.sqrt(y),s=S/r,i=b/r),this.set(s,i,r,t),this}let _=Math.sqrt((g-f)*(g-f)+(u-M)*(u-M)+(h-d)*(h-d));return Math.abs(_)<.001&&(_=1),this.x=(g-f)/_,this.y=(u-M)/_,this.z=(h-d)/_,this.w=Math.acos((c+p+m-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=gt(this.x,e.x,t.x),this.y=gt(this.y,e.y,t.y),this.z=gt(this.z,e.z,t.z),this.w=gt(this.w,e.w,t.w),this}clampScalar(e,t){return this.x=gt(this.x,e,t),this.y=gt(this.y,e,t),this.z=gt(this.z,e,t),this.w=gt(this.w,e,t),this}clampLength(e,t){const s=this.length();return this.divideScalar(s||1).multiplyScalar(gt(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}};hh.prototype.isVector4=!0;let Wt=hh;class fO extends Ui{constructor(e=1,t=1,s={}){super(),s=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:os,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 Wt(0,0,e,t),this.scissorTest=!1,this.viewport=new Wt(0,0,e,t),this.textures=[];const i={width:e,height:t,depth:s.depth},r=new ls(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:os,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 rn extends fO{constructor(e=1,t=1,s={}){super(e,t,s),this.isWebGLRenderTarget=!0}}class Zg extends ls{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=ss,this.minFilter=ss,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 pO extends ls{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=ss,this.minFilter=ss,this.wrapR=yn,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}const hl=class hl{constructor(e,t,s,i,r,a,o,l,c,d,u,h,p,f,M,g){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,p,f,M,g)}set(e,t,s,i,r,a,o,l,c,d,u,h,p,f,M,g){const m=this.elements;return m[0]=e,m[4]=t,m[8]=s,m[12]=i,m[1]=r,m[5]=a,m[9]=o,m[13]=l,m[2]=c,m[6]=d,m[10]=u,m[14]=h,m[3]=p,m[7]=f,m[11]=M,m[15]=g,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 hl().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/Zi.setFromMatrixColumn(e,0).length(),r=1/Zi.setFromMatrixColumn(e,1).length(),a=1/Zi.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,p=a*u,f=o*d,M=o*u;t[0]=l*d,t[4]=-l*u,t[8]=c,t[1]=p+f*c,t[5]=h-M*c,t[9]=-o*l,t[2]=M-h*c,t[6]=f+p*c,t[10]=a*l}else if(e.order==="YXZ"){const h=l*d,p=l*u,f=c*d,M=c*u;t[0]=h+M*o,t[4]=f*o-p,t[8]=a*c,t[1]=a*u,t[5]=a*d,t[9]=-o,t[2]=p*o-f,t[6]=M+h*o,t[10]=a*l}else if(e.order==="ZXY"){const h=l*d,p=l*u,f=c*d,M=c*u;t[0]=h-M*o,t[4]=-a*u,t[8]=f+p*o,t[1]=p+f*o,t[5]=a*d,t[9]=M-h*o,t[2]=-a*c,t[6]=o,t[10]=a*l}else if(e.order==="ZYX"){const h=a*d,p=a*u,f=o*d,M=o*u;t[0]=l*d,t[4]=f*c-p,t[8]=h*c+M,t[1]=l*u,t[5]=M*c+h,t[9]=p*c-f,t[2]=-c,t[6]=o*l,t[10]=a*l}else if(e.order==="YZX"){const h=a*l,p=a*c,f=o*l,M=o*c;t[0]=l*d,t[4]=M-h*u,t[8]=f*u+p,t[1]=u,t[5]=a*d,t[9]=-o*d,t[2]=-c*d,t[6]=p*u+f,t[10]=h-M*u}else if(e.order==="XZY"){const h=a*l,p=a*c,f=o*l,M=o*c;t[0]=l*d,t[4]=-u,t[8]=c*d,t[1]=h*u+M,t[5]=a*d,t[9]=p*u-f,t[2]=f*u-p,t[6]=o*d,t[10]=M*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(mO,e,gO)}lookAt(e,t,s){const i=this.elements;return ws.subVectors(e,t),ws.lengthSq()===0&&(ws.z=1),ws.normalize(),Ln.crossVectors(s,ws),Ln.lengthSq()===0&&(Math.abs(s.z)===1?ws.x+=1e-4:ws.z+=1e-4,ws.normalize(),Ln.crossVectors(s,ws)),Ln.normalize(),Pa.crossVectors(ws,Ln),i[0]=Ln.x,i[4]=Pa.x,i[8]=ws.x,i[1]=Ln.y,i[5]=Pa.y,i[9]=ws.y,i[2]=Ln.z,i[6]=Pa.z,i[10]=ws.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],p=s[13],f=s[2],M=s[6],g=s[10],m=s[14],_=s[3],w=s[7],z=s[11],y=s[15],O=i[0],S=i[4],b=i[8],v=i[12],E=i[1],A=i[5],I=i[9],G=i[13],C=i[2],B=i[6],P=i[10],L=i[14],H=i[3],X=i[7],oe=i[11],J=i[15];return r[0]=a*O+o*E+l*C+c*H,r[4]=a*S+o*A+l*B+c*X,r[8]=a*b+o*I+l*P+c*oe,r[12]=a*v+o*G+l*L+c*J,r[1]=d*O+u*E+h*C+p*H,r[5]=d*S+u*A+h*B+p*X,r[9]=d*b+u*I+h*P+p*oe,r[13]=d*v+u*G+h*L+p*J,r[2]=f*O+M*E+g*C+m*H,r[6]=f*S+M*A+g*B+m*X,r[10]=f*b+M*I+g*P+m*oe,r[14]=f*v+M*G+g*L+m*J,r[3]=_*O+w*E+z*C+y*H,r[7]=_*S+w*A+z*B+y*X,r[11]=_*b+w*I+z*P+y*oe,r[15]=_*v+w*G+z*L+y*J,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],p=e[14],f=e[3],M=e[7],g=e[11],m=e[15],_=l*p-c*h,w=o*p-c*u,z=o*h-l*u,y=a*p-c*d,O=a*h-l*d,S=a*u-o*d;return t*(M*_-g*w+m*z)-s*(f*_-g*y+m*O)+i*(f*w-M*y+m*S)-r*(f*z-M*O+g*S)}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],p=e[11],f=e[12],M=e[13],g=e[14],m=e[15],_=t*o-s*a,w=t*l-i*a,z=t*c-r*a,y=s*l-i*o,O=s*c-r*o,S=i*c-r*l,b=d*M-u*f,v=d*g-h*f,E=d*m-p*f,A=u*g-h*M,I=u*m-p*M,G=h*m-p*g,C=_*G-w*I+z*A+y*E-O*v+S*b;if(C===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const B=1/C;return e[0]=(o*G-l*I+c*A)*B,e[1]=(i*I-s*G-r*A)*B,e[2]=(M*S-g*O+m*y)*B,e[3]=(h*O-u*S-p*y)*B,e[4]=(l*E-a*G-c*v)*B,e[5]=(t*G-i*E+r*v)*B,e[6]=(g*z-f*S-m*w)*B,e[7]=(d*S-h*z+p*w)*B,e[8]=(a*I-o*E+c*b)*B,e[9]=(s*E-t*I-r*b)*B,e[10]=(f*O-M*z+m*_)*B,e[11]=(u*z-d*O-p*_)*B,e[12]=(o*v-a*A-l*b)*B,e[13]=(t*A-s*v+i*b)*B,e[14]=(M*w-f*y-g*_)*B,e[15]=(d*y-u*w+h*_)*B,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,p=r*d,f=r*u,M=a*d,g=a*u,m=o*u,_=l*c,w=l*d,z=l*u,y=s.x,O=s.y,S=s.z;return i[0]=(1-(M+m))*y,i[1]=(p+z)*y,i[2]=(f-w)*y,i[3]=0,i[4]=(p-z)*O,i[5]=(1-(h+m))*O,i[6]=(g+_)*O,i[7]=0,i[8]=(f+w)*S,i[9]=(g-_)*S,i[10]=(1-(h+M))*S,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=Zi.set(i[0],i[1],i[2]).length();const o=Zi.set(i[4],i[5],i[6]).length(),l=Zi.set(i[8],i[9],i[10]).length();r<0&&(a=-a),Ps.copy(this);const c=1/a,d=1/o,u=1/l;return Ps.elements[0]*=c,Ps.elements[1]*=c,Ps.elements[2]*=c,Ps.elements[4]*=d,Ps.elements[5]*=d,Ps.elements[6]*=d,Ps.elements[8]*=u,Ps.elements[9]*=u,Ps.elements[10]*=u,t.setFromRotationMatrix(Ps),s.x=a,s.y=o,s.z=l,this}makePerspective(e,t,s,i,r,a,o=tn,l=!1){const c=this.elements,d=2*r/(t-e),u=2*r/(s-i),h=(t+e)/(t-e),p=(s+i)/(s-i);let f,M;if(l)f=r/(a-r),M=a*r/(a-r);else if(o===tn)f=-(a+r)/(a-r),M=-2*a*r/(a-r);else if(o===Oa)f=-a/(a-r),M=-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]=p,c[13]=0,c[2]=0,c[6]=0,c[10]=f,c[14]=M,c[3]=0,c[7]=0,c[11]=-1,c[15]=0,this}makeOrthographic(e,t,s,i,r,a,o=tn,l=!1){const c=this.elements,d=2/(t-e),u=2/(s-i),h=-(t+e)/(t-e),p=-(s+i)/(s-i);let f,M;if(l)f=1/(a-r),M=a/(a-r);else if(o===tn)f=-2/(a-r),M=-(a+r)/(a-r);else if(o===Oa)f=-1/(a-r),M=-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]=p,c[2]=0,c[6]=0,c[10]=f,c[14]=M,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}};hl.prototype.isMatrix4=!0;let wt=hl;const Zi=new W,Ps=new wt,mO=new W(0,0,0),gO=new W(1,1,1),Ln=new W,Pa=new W,ws=new W,If=new wt,Gf=new Fi;class ai{constructor(e=0,t=0,s=0,i=ai.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],p=i[10];switch(t){case"XYZ":this._y=Math.asin(gt(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(-d,p),this._z=Math.atan2(-a,r)):(this._x=Math.atan2(h,c),this._z=0);break;case"YXZ":this._x=Math.asin(-gt(d,-1,1)),Math.abs(d)<.9999999?(this._y=Math.atan2(o,p),this._z=Math.atan2(l,c)):(this._y=Math.atan2(-u,r),this._z=0);break;case"ZXY":this._x=Math.asin(gt(h,-1,1)),Math.abs(h)<.9999999?(this._y=Math.atan2(-u,p),this._z=Math.atan2(-a,c)):(this._y=0,this._z=Math.atan2(l,r));break;case"ZYX":this._y=Math.asin(-gt(u,-1,1)),Math.abs(u)<.9999999?(this._x=Math.atan2(h,p),this._z=Math.atan2(l,r)):(this._x=0,this._z=Math.atan2(-a,c));break;case"YZX":this._z=Math.asin(gt(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,p));break;case"XZY":this._z=Math.asin(-gt(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(h,c),this._y=Math.atan2(o,r)):(this._x=Math.atan2(-d,p),this._y=0);break;default:He("Euler: .setFromRotationMatrix() encountered an unknown order: "+t)}return this._order=t,s===!0&&this._onChangeCallback(),this}setFromQuaternion(e,t,s){return If.makeRotationFromQuaternion(e),this.setFromRotationMatrix(If,t,s)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return Gf.setFromEuler(this),this.setFromQuaternion(Gf,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}}ai.DEFAULT_ORDER="XYZ";class Hu{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 MO=0;const Rf=new W,Qi=new Fi,un=new wt,La=new W,Hr=new W,bO=new W,_O=new Fi,Nf=new W(1,0,0),Bf=new W(0,1,0),Cf=new W(0,0,1),Pf={type:"added"},zO={type:"removed"},Ji={type:"childadded",child:null},ec={type:"childremoved",child:null};class kt extends Ui{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:MO++}),this.uuid=ei(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=kt.DEFAULT_UP.clone();const e=new W,t=new ai,s=new Fi,i=new W(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 wt},normalMatrix:{value:new st}}),this.matrix=new wt,this.matrixWorld=new wt,this.matrixAutoUpdate=kt.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=kt.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new Hu,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 Qi.setFromAxisAngle(e,t),this.quaternion.multiply(Qi),this}rotateOnWorldAxis(e,t){return Qi.setFromAxisAngle(e,t),this.quaternion.premultiply(Qi),this}rotateX(e){return this.rotateOnAxis(Nf,e)}rotateY(e){return this.rotateOnAxis(Bf,e)}rotateZ(e){return this.rotateOnAxis(Cf,e)}translateOnAxis(e,t){return Rf.copy(e).applyQuaternion(this.quaternion),this.position.add(Rf.multiplyScalar(t)),this}translateX(e){return this.translateOnAxis(Nf,e)}translateY(e){return this.translateOnAxis(Bf,e)}translateZ(e){return this.translateOnAxis(Cf,e)}localToWorld(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(this.matrixWorld)}worldToLocal(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(un.copy(this.matrixWorld).invert())}lookAt(e,t,s){e.isVector3?La.copy(e):La.set(e,t,s);const i=this.parent;this.updateWorldMatrix(!0,!1),Hr.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?un.lookAt(Hr,La,this.up):un.lookAt(La,Hr,this.up),this.quaternion.setFromRotationMatrix(un),i&&(un.extractRotation(i.matrixWorld),Qi.setFromRotationMatrix(un),this.quaternion.premultiply(Qi.invert()))}add(e){if(arguments.length>1){for(let t=0;t<arguments.length;t++)this.add(arguments[t]);return this}return e===this?(pt("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(Pf),Ji.child=e,this.dispatchEvent(Ji),Ji.child=null):pt("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(zO),ec.child=e,this.dispatchEvent(ec),ec.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),un.copy(this.matrixWorld).invert(),e.parent!==null&&(e.parent.updateWorldMatrix(!0,!1),un.multiply(e.parent.matrixWorld)),e.applyMatrix4(un),e.removeFromParent(),e.parent=this,this.children.push(e),e.updateWorldMatrix(!1,!0),e.dispatchEvent(Pf),Ji.child=e,this.dispatchEvent(Ji),Ji.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(Hr,e,bO),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Hr,_O,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),p=a(e.animations),f=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),p.length>0&&(s.animations=p),f.length>0&&(s.nodes=f)}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}}kt.DEFAULT_UP=new W(0,1,0);kt.DEFAULT_MATRIX_AUTO_UPDATE=!0;kt.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;class ha extends kt{constructor(){super(),this.isGroup=!0,this.type="Group"}}const wO={type:"move"};class tc{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new ha,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 ha,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new W,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new W),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new ha,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new W,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new W,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 M of e.hand.values()){const g=t.getJointPose(M,s),m=this._getHandJoint(c,M);g!==null&&(m.matrix.fromArray(g.transform.matrix),m.matrix.decompose(m.position,m.rotation,m.scale),m.matrixWorldNeedsUpdate=!0,m.jointRadius=g.radius),m.visible=g!==null}const d=c.joints["index-finger-tip"],u=c.joints["thumb-tip"],h=d.position.distanceTo(u.position),p=.02,f=.005;c.inputState.pinching&&h>p+f?(c.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!c.inputState.pinching&&h<=p-f&&(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(wO)))}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 ha;s.matrixAutoUpdate=!1,s.visible=!1,e.joints[t.jointName]=s,e.add(s)}return e.joints[t.jointName]}}const Qg={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},Wn={h:0,s:0,l:0},Wa={h:0,s:0,l:0};function sc(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=Is){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,mt.colorSpaceToWorking(this,t),this}setRGB(e,t,s,i=mt.workingColorSpace){return this.r=e,this.g=t,this.b=s,mt.colorSpaceToWorking(this,i),this}setHSL(e,t,s,i=mt.workingColorSpace){if(e=lO(e,1),t=gt(t,0,1),s=gt(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=sc(a,r,e+1/3),this.g=sc(a,r,e),this.b=sc(a,r,e-1/3)}return mt.colorSpaceToWorking(this,i),this}setStyle(e,t=Is){function s(r){r!==void 0&&parseFloat(r)<1&&He("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:He("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);He("Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,t);return this}setColorName(e,t=Is){const s=Qg[e.toLowerCase()];return s!==void 0?this.setHex(s,t):He("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=En(e.r),this.g=En(e.g),this.b=En(e.b),this}copyLinearToSRGB(e){return this.r=vr(e.r),this.g=vr(e.g),this.b=vr(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=Is){return mt.workingToColorSpace(rs.copy(this),e),Math.round(gt(rs.r*255,0,255))*65536+Math.round(gt(rs.g*255,0,255))*256+Math.round(gt(rs.b*255,0,255))}getHexString(e=Is){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=mt.workingColorSpace){mt.workingToColorSpace(rs.copy(this),t);const s=rs.r,i=rs.g,r=rs.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=mt.workingColorSpace){return mt.workingToColorSpace(rs.copy(this),t),e.r=rs.r,e.g=rs.g,e.b=rs.b,e}getStyle(e=Is){mt.workingToColorSpace(rs.copy(this),e);const t=rs.r,s=rs.g,i=rs.b;return e!==Is?`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(Wn),this.setHSL(Wn.h+e,Wn.s+t,Wn.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(Wn),e.getHSL(Wa);const s=Kl(Wn.h,Wa.h,t),i=Kl(Wn.s,Wa.s,t),r=Kl(Wn.l,Wa.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 rs=new ke;ke.NAMES=Qg;class yO extends kt{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 ai,this.environmentIntensity=1,this.environmentRotation=new ai,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 Ls=new W,hn=new W,nc=new W,fn=new W,er=new W,tr=new W,Lf=new W,ic=new W,rc=new W,ac=new W,oc=new Wt,lc=new Wt,cc=new Wt;class Bs{constructor(e=new W,t=new W,s=new W){this.a=e,this.b=t,this.c=s}static getNormal(e,t,s,i){i.subVectors(s,t),Ls.subVectors(e,t),i.cross(Ls);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){Ls.subVectors(i,t),hn.subVectors(s,t),nc.subVectors(e,t);const a=Ls.dot(Ls),o=Ls.dot(hn),l=Ls.dot(nc),c=hn.dot(hn),d=hn.dot(nc),u=a*c-o*o;if(u===0)return r.set(0,0,0),null;const h=1/u,p=(c*l-o*d)*h,f=(a*d-o*l)*h;return r.set(1-p-f,f,p)}static containsPoint(e,t,s,i){return this.getBarycoord(e,t,s,i,fn)===null?!1:fn.x>=0&&fn.y>=0&&fn.x+fn.y<=1}static getInterpolation(e,t,s,i,r,a,o,l){return this.getBarycoord(e,t,s,i,fn)===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,fn.x),l.addScaledVector(a,fn.y),l.addScaledVector(o,fn.z),l)}static getInterpolatedAttribute(e,t,s,i,r,a){return oc.setScalar(0),lc.setScalar(0),cc.setScalar(0),oc.fromBufferAttribute(e,t),lc.fromBufferAttribute(e,s),cc.fromBufferAttribute(e,i),a.setScalar(0),a.addScaledVector(oc,r.x),a.addScaledVector(lc,r.y),a.addScaledVector(cc,r.z),a}static isFrontFacing(e,t,s,i){return Ls.subVectors(s,t),hn.subVectors(e,t),Ls.cross(hn).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 Ls.subVectors(this.c,this.b),hn.subVectors(this.a,this.b),Ls.cross(hn).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return Bs.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return Bs.getBarycoord(e,this.a,this.b,this.c,t)}getInterpolation(e,t,s,i,r){return Bs.getInterpolation(e,this.a,this.b,this.c,t,s,i,r)}containsPoint(e){return Bs.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return Bs.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;er.subVectors(i,s),tr.subVectors(r,s),ic.subVectors(e,s);const l=er.dot(ic),c=tr.dot(ic);if(l<=0&&c<=0)return t.copy(s);rc.subVectors(e,i);const d=er.dot(rc),u=tr.dot(rc);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(er,a);ac.subVectors(e,r);const p=er.dot(ac),f=tr.dot(ac);if(f>=0&&p<=f)return t.copy(r);const M=p*c-l*f;if(M<=0&&c>=0&&f<=0)return o=c/(c-f),t.copy(s).addScaledVector(tr,o);const g=d*f-p*u;if(g<=0&&u-d>=0&&p-f>=0)return Lf.subVectors(r,i),o=(u-d)/(u-d+(p-f)),t.copy(i).addScaledVector(Lf,o);const m=1/(g+M+h);return a=M*m,o=h*m,t.copy(s).addScaledVector(er,a).addScaledVector(tr,o)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}class ji{constructor(e=new W(1/0,1/0,1/0),t=new W(-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(Ws.fromArray(e,t));return this}setFromBufferAttribute(e){this.makeEmpty();for(let t=0,s=e.count;t<s;t++)this.expandByPoint(Ws.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=Ws.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,Ws):Ws.fromBufferAttribute(r,a),Ws.applyMatrix4(e.matrixWorld),this.expandByPoint(Ws);else e.boundingBox!==void 0?(e.boundingBox===null&&e.computeBoundingBox(),ka.copy(e.boundingBox)):(s.boundingBox===null&&s.computeBoundingBox(),ka.copy(s.boundingBox)),ka.applyMatrix4(e.matrixWorld),this.union(ka)}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,Ws),Ws.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(qr),Ua.subVectors(this.max,qr),sr.subVectors(e.a,qr),nr.subVectors(e.b,qr),ir.subVectors(e.c,qr),kn.subVectors(nr,sr),Un.subVectors(ir,nr),ui.subVectors(sr,ir);let t=[0,-kn.z,kn.y,0,-Un.z,Un.y,0,-ui.z,ui.y,kn.z,0,-kn.x,Un.z,0,-Un.x,ui.z,0,-ui.x,-kn.y,kn.x,0,-Un.y,Un.x,0,-ui.y,ui.x,0];return!dc(t,sr,nr,ir,Ua)||(t=[1,0,0,0,1,0,0,0,1],!dc(t,sr,nr,ir,Ua))?!1:(Fa.crossVectors(kn,Un),t=[Fa.x,Fa.y,Fa.z],dc(t,sr,nr,ir,Ua))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,Ws).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(Ws).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 W,new W,new W,new W,new W,new W,new W,new W],Ws=new W,ka=new ji,sr=new W,nr=new W,ir=new W,kn=new W,Un=new W,ui=new W,qr=new W,Ua=new W,Fa=new W,hi=new W;function dc(n,e,t,s,i){for(let r=0,a=n.length-3;r<=a;r+=3){hi.fromArray(n,r);const o=i.x*Math.abs(hi.x)+i.y*Math.abs(hi.y)+i.z*Math.abs(hi.z),l=e.dot(hi),c=t.dot(hi),d=s.dot(hi);if(Math.max(-Math.max(l,c,d),Math.min(l,c,d))>o)return!1}return!0}const Vt=new W,ja=new et;let vO=0;class ts extends Ui{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:vO++}),this.name="",this.array=e,this.itemSize=t,this.count=e!==void 0?e.length/t:0,this.normalized=s,this.usage=Zd,this.updateRanges=[],this.gpuType=$s,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++)ja.fromBufferAttribute(this,t),ja.applyMatrix3(e),this.setXY(t,ja.x,ja.y);else if(this.itemSize===3)for(let t=0,s=this.count;t<s;t++)Vt.fromBufferAttribute(this,t),Vt.applyMatrix3(e),this.setXYZ(t,Vt.x,Vt.y,Vt.z);return this}applyMatrix4(e){for(let t=0,s=this.count;t<s;t++)Vt.fromBufferAttribute(this,t),Vt.applyMatrix4(e),this.setXYZ(t,Vt.x,Vt.y,Vt.z);return this}applyNormalMatrix(e){for(let t=0,s=this.count;t<s;t++)Vt.fromBufferAttribute(this,t),Vt.applyNormalMatrix(e),this.setXYZ(t,Vt.x,Vt.y,Vt.z);return this}transformDirection(e){for(let t=0,s=this.count;t<s;t++)Vt.fromBufferAttribute(this,t),Vt.transformDirection(e),this.setXYZ(t,Vt.x,Vt.y,Vt.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=en(s,this.array)),s}setComponent(e,t,s){return this.normalized&&(s=Dt(s,this.array)),this.array[e*this.itemSize+t]=s,this}getX(e){let t=this.array[e*this.itemSize];return this.normalized&&(t=en(t,this.array)),t}setX(e,t){return this.normalized&&(t=Dt(t,this.array)),this.array[e*this.itemSize]=t,this}getY(e){let t=this.array[e*this.itemSize+1];return this.normalized&&(t=en(t,this.array)),t}setY(e,t){return this.normalized&&(t=Dt(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=en(t,this.array)),t}setZ(e,t){return this.normalized&&(t=Dt(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=en(t,this.array)),t}setW(e,t){return this.normalized&&(t=Dt(t,this.array)),this.array[e*this.itemSize+3]=t,this}setXY(e,t,s){return e*=this.itemSize,this.normalized&&(t=Dt(t,this.array),s=Dt(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=Dt(t,this.array),s=Dt(s,this.array),i=Dt(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=Dt(t,this.array),s=Dt(s,this.array),i=Dt(i,this.array),r=Dt(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!==Zd&&(e.usage=this.usage),e}dispose(){this.dispatchEvent({type:"dispose"})}}class Jg extends ts{constructor(e,t,s){super(new Uint16Array(e),t,s)}}class eM extends ts{constructor(e,t,s){super(new Uint32Array(e),t,s)}}class Ot extends ts{constructor(e,t,s){super(new Float32Array(e),t,s)}}const OO=new ji,Xr=new W,uc=new W;class $i{constructor(e=new W,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):OO.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;Xr.subVectors(e,this.center);const t=Xr.lengthSq();if(t>this.radius*this.radius){const s=Math.sqrt(t),i=(s-this.radius)*.5;this.center.addScaledVector(Xr,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):(uc.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(Xr.copy(e.center).add(uc)),this.expandByPoint(Xr.copy(e.center).sub(uc))),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 xO=0;const As=new wt,hc=new kt,rr=new W,ys=new ji,Kr=new ji,Qt=new W;class qt extends Ui{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:xO++}),this.uuid=ei(),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(iO(e)?eM:Jg)(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 st().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 As.makeRotationFromQuaternion(e),this.applyMatrix4(As),this}rotateX(e){return As.makeRotationX(e),this.applyMatrix4(As),this}rotateY(e){return As.makeRotationY(e),this.applyMatrix4(As),this}rotateZ(e){return As.makeRotationZ(e),this.applyMatrix4(As),this}translate(e,t,s){return As.makeTranslation(e,t,s),this.applyMatrix4(As),this}scale(e,t,s){return As.makeScale(e,t,s),this.applyMatrix4(As),this}lookAt(e){return hc.lookAt(e),hc.updateMatrix(),this.applyMatrix4(hc.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(rr).negate(),this.translate(rr.x,rr.y,rr.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 Ot(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&&He("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 ji);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){pt("BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),this.boundingBox.set(new W(-1/0,-1/0,-1/0),new W(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];ys.setFromBufferAttribute(r),this.morphTargetsRelative?(Qt.addVectors(this.boundingBox.min,ys.min),this.boundingBox.expandByPoint(Qt),Qt.addVectors(this.boundingBox.max,ys.max),this.boundingBox.expandByPoint(Qt)):(this.boundingBox.expandByPoint(ys.min),this.boundingBox.expandByPoint(ys.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&pt('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 $i);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){pt("BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere.",this),this.boundingSphere.set(new W,1/0);return}if(e){const s=this.boundingSphere.center;if(ys.setFromBufferAttribute(e),t)for(let r=0,a=t.length;r<a;r++){const o=t[r];Kr.setFromBufferAttribute(o),this.morphTargetsRelative?(Qt.addVectors(ys.min,Kr.min),ys.expandByPoint(Qt),Qt.addVectors(ys.max,Kr.max),ys.expandByPoint(Qt)):(ys.expandByPoint(Kr.min),ys.expandByPoint(Kr.max))}ys.getCenter(s);let i=0;for(let r=0,a=e.count;r<a;r++)Qt.fromBufferAttribute(e,r),i=Math.max(i,s.distanceToSquared(Qt));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++)Qt.fromBufferAttribute(o,c),l&&(rr.fromBufferAttribute(e,c),Qt.add(rr)),i=Math.max(i,s.distanceToSquared(Qt))}this.boundingSphere.radius=Math.sqrt(i),isNaN(this.boundingSphere.radius)&&pt('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){pt("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 ts(new Float32Array(4*s.count),4),this.setAttribute("tangent",a));const o=[],l=[];for(let b=0;b<s.count;b++)o[b]=new W,l[b]=new W;const c=new W,d=new W,u=new W,h=new et,p=new et,f=new et,M=new W,g=new W;function m(b,v,E){c.fromBufferAttribute(s,b),d.fromBufferAttribute(s,v),u.fromBufferAttribute(s,E),h.fromBufferAttribute(r,b),p.fromBufferAttribute(r,v),f.fromBufferAttribute(r,E),d.sub(c),u.sub(c),p.sub(h),f.sub(h);const A=1/(p.x*f.y-f.x*p.y);isFinite(A)&&(M.copy(d).multiplyScalar(f.y).addScaledVector(u,-p.y).multiplyScalar(A),g.copy(u).multiplyScalar(p.x).addScaledVector(d,-f.x).multiplyScalar(A),o[b].add(M),o[v].add(M),o[E].add(M),l[b].add(g),l[v].add(g),l[E].add(g))}let _=this.groups;_.length===0&&(_=[{start:0,count:e.count}]);for(let b=0,v=_.length;b<v;++b){const E=_[b],A=E.start,I=E.count;for(let G=A,C=A+I;G<C;G+=3)m(e.getX(G+0),e.getX(G+1),e.getX(G+2))}const w=new W,z=new W,y=new W,O=new W;function S(b){y.fromBufferAttribute(i,b),O.copy(y);const v=o[b];w.copy(v),w.sub(y.multiplyScalar(y.dot(v))).normalize(),z.crossVectors(O,v);const A=z.dot(l[b])<0?-1:1;a.setXYZW(b,w.x,w.y,w.z,A)}for(let b=0,v=_.length;b<v;++b){const E=_[b],A=E.start,I=E.count;for(let G=A,C=A+I;G<C;G+=3)S(e.getX(G+0)),S(e.getX(G+1)),S(e.getX(G+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 ts(new Float32Array(t.count*3),3),this.setAttribute("normal",s);else for(let h=0,p=s.count;h<p;h++)s.setXYZ(h,0,0,0);const i=new W,r=new W,a=new W,o=new W,l=new W,c=new W,d=new W,u=new W;if(e)for(let h=0,p=e.count;h<p;h+=3){const f=e.getX(h+0),M=e.getX(h+1),g=e.getX(h+2);i.fromBufferAttribute(t,f),r.fromBufferAttribute(t,M),a.fromBufferAttribute(t,g),d.subVectors(a,r),u.subVectors(i,r),d.cross(u),o.fromBufferAttribute(s,f),l.fromBufferAttribute(s,M),c.fromBufferAttribute(s,g),o.add(d),l.add(d),c.add(d),s.setXYZ(f,o.x,o.y,o.z),s.setXYZ(M,l.x,l.y,l.z),s.setXYZ(g,c.x,c.y,c.z)}else for(let h=0,p=t.count;h<p;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++)Qt.fromBufferAttribute(e,t),Qt.normalize(),e.setXYZ(t,Qt.x,Qt.y,Qt.z)}toNonIndexed(){function e(o,l){const c=o.array,d=o.itemSize,u=o.normalized,h=new c.constructor(l.length*d);let p=0,f=0;for(let M=0,g=l.length;M<g;M++){o.isInterleavedBufferAttribute?p=l[M]*o.data.stride+o.offset:p=l[M]*d;for(let m=0;m<d;m++)h[f++]=c[p++]}return new ts(h,d,u)}if(this.index===null)return He("BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;const t=new qt,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],p=e(h,s);l.push(p)}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 p=c[u];d.push(p.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,p=u.length;h<p;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 SO{constructor(e,t){this.isInterleavedBuffer=!0,this.array=e,this.stride=t,this.count=e!==void 0?e.length/t:0,this.usage=Zd,this.updateRanges=[],this.version=0,this.uuid=ei()}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=ei()),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=ei()),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 cs=new W;class nl{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++)cs.fromBufferAttribute(this,t),cs.applyMatrix4(e),this.setXYZ(t,cs.x,cs.y,cs.z);return this}applyNormalMatrix(e){for(let t=0,s=this.count;t<s;t++)cs.fromBufferAttribute(this,t),cs.applyNormalMatrix(e),this.setXYZ(t,cs.x,cs.y,cs.z);return this}transformDirection(e){for(let t=0,s=this.count;t<s;t++)cs.fromBufferAttribute(this,t),cs.transformDirection(e),this.setXYZ(t,cs.x,cs.y,cs.z);return this}getComponent(e,t){let s=this.array[e*this.data.stride+this.offset+t];return this.normalized&&(s=en(s,this.array)),s}setComponent(e,t,s){return this.normalized&&(s=Dt(s,this.array)),this.data.array[e*this.data.stride+this.offset+t]=s,this}setX(e,t){return this.normalized&&(t=Dt(t,this.array)),this.data.array[e*this.data.stride+this.offset]=t,this}setY(e,t){return this.normalized&&(t=Dt(t,this.array)),this.data.array[e*this.data.stride+this.offset+1]=t,this}setZ(e,t){return this.normalized&&(t=Dt(t,this.array)),this.data.array[e*this.data.stride+this.offset+2]=t,this}setW(e,t){return this.normalized&&(t=Dt(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=en(t,this.array)),t}getY(e){let t=this.data.array[e*this.data.stride+this.offset+1];return this.normalized&&(t=en(t,this.array)),t}getZ(e){let t=this.data.array[e*this.data.stride+this.offset+2];return this.normalized&&(t=en(t,this.array)),t}getW(e){let t=this.data.array[e*this.data.stride+this.offset+3];return this.normalized&&(t=en(t,this.array)),t}setXY(e,t,s){return e=e*this.data.stride+this.offset,this.normalized&&(t=Dt(t,this.array),s=Dt(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=Dt(t,this.array),s=Dt(s,this.array),i=Dt(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=Dt(t,this.array),s=Dt(s,this.array),i=Dt(i,this.array),r=Dt(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){sl("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 ts(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 nl(e.interleavedBuffers[this.data.uuid],this.itemSize,this.offset,this.normalized)}toJSON(e){if(e===void 0){sl("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 EO=0;class In extends Ui{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:EO++}),this.uuid=ei(),this.name="",this.type="Material",this.blending=Ei,this.side=ri,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=cd,this.blendDst=dd,this.blendEquation=_i,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new ke(0,0,0),this.blendAlpha=0,this.depthFunc=Ir,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=xf,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=Ki,this.stencilZFail=Ki,this.stencilZPass=Ki,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){He(`Material: parameter '${t}' has value of undefined.`);continue}const i=this[t];if(i===void 0){He(`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!==Ei&&(s.blending=this.blending),this.side!==ri&&(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!==cd&&(s.blendSrc=this.blendSrc),this.blendDst!==dd&&(s.blendDst=this.blendDst),this.blendEquation!==_i&&(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!==Ir&&(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!==xf&&(s.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(s.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(s.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==Ki&&(s.stencilFail=this.stencilFail),this.stencilZFail!==Ki&&(s.stencilZFail=this.stencilZFail),this.stencilZPass!==Ki&&(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 et().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 et().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 wl extends In{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 ar;const Yr=new W,or=new W,lr=new W,cr=new et,Zr=new et,tM=new wt,$a=new W,Qr=new W,Va=new W,Wf=new et,fc=new et,kf=new et;class qu extends kt{constructor(e=new wl){if(super(),this.isSprite=!0,this.type="Sprite",ar===void 0){ar=new qt;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 SO(t,5);ar.setIndex([0,1,2,0,2,3]),ar.setAttribute("position",new nl(s,3,0,!1)),ar.setAttribute("uv",new nl(s,2,3,!1))}this.geometry=ar,this.material=e,this.center=new et(.5,.5),this.count=1}raycast(e,t){e.camera===null&&pt('Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.'),or.setFromMatrixScale(this.matrixWorld),tM.copy(e.camera.matrixWorld),this.modelViewMatrix.multiplyMatrices(e.camera.matrixWorldInverse,this.matrixWorld),lr.setFromMatrixPosition(this.modelViewMatrix),e.camera.isPerspectiveCamera&&this.material.sizeAttenuation===!1&&or.multiplyScalar(-lr.z);const s=this.material.rotation;let i,r;s!==0&&(r=Math.cos(s),i=Math.sin(s));const a=this.center;Ha($a.set(-.5,-.5,0),lr,a,or,i,r),Ha(Qr.set(.5,-.5,0),lr,a,or,i,r),Ha(Va.set(.5,.5,0),lr,a,or,i,r),Wf.set(0,0),fc.set(1,0),kf.set(1,1);let o=e.ray.intersectTriangle($a,Qr,Va,!1,Yr);if(o===null&&(Ha(Qr.set(-.5,.5,0),lr,a,or,i,r),fc.set(0,1),o=e.ray.intersectTriangle($a,Va,Qr,!1,Yr),o===null))return;const l=e.ray.origin.distanceTo(Yr);l<e.near||l>e.far||t.push({distance:l,point:Yr.clone(),uv:Bs.getInterpolation(Yr,$a,Qr,Va,Wf,fc,kf,new et),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 Ha(n,e,t,s,i,r){cr.subVectors(n,t).addScalar(.5).multiply(s),i!==void 0?(Zr.x=r*cr.x-i*cr.y,Zr.y=i*cr.x+r*cr.y):Zr.copy(cr),n.copy(e),n.x+=Zr.x,n.y+=Zr.y,n.applyMatrix4(tM)}const mn=new W,pc=new W,qa=new W,Fn=new W,mc=new W,Xa=new W,gc=new W;class yl{constructor(e=new W,t=new W(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,mn)),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=mn.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(mn.copy(this.origin).addScaledVector(this.direction,t),mn.distanceToSquared(e))}distanceSqToSegment(e,t,s,i){pc.copy(e).add(t).multiplyScalar(.5),qa.copy(t).sub(e).normalize(),Fn.copy(this.origin).sub(pc);const r=e.distanceTo(t)*.5,a=-this.direction.dot(qa),o=Fn.dot(this.direction),l=-Fn.dot(qa),c=Fn.lengthSq(),d=Math.abs(1-a*a);let u,h,p,f;if(d>0)if(u=a*l-o,h=a*o-l,f=r*d,u>=0)if(h>=-f)if(h<=f){const M=1/d;u*=M,h*=M,p=u*(u+a*h+2*o)+h*(a*u+h+2*l)+c}else h=r,u=Math.max(0,-(a*h+o)),p=-u*u+h*(h+2*l)+c;else h=-r,u=Math.max(0,-(a*h+o)),p=-u*u+h*(h+2*l)+c;else h<=-f?(u=Math.max(0,-(-a*r+o)),h=u>0?-r:Math.min(Math.max(-r,-l),r),p=-u*u+h*(h+2*l)+c):h<=f?(u=0,h=Math.min(Math.max(-r,-l),r),p=h*(h+2*l)+c):(u=Math.max(0,-(a*r+o)),h=u>0?r:Math.min(Math.max(-r,-l),r),p=-u*u+h*(h+2*l)+c);else h=a>0?-r:r,u=Math.max(0,-(a*h+o)),p=-u*u+h*(h+2*l)+c;return s&&s.copy(this.origin).addScaledVector(this.direction,u),i&&i.copy(pc).addScaledVector(qa,h),p}intersectSphere(e,t){mn.subVectors(e.center,this.origin);const s=mn.dot(this.direction),i=mn.dot(mn)-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,mn)!==null}intersectTriangle(e,t,s,i,r){mc.subVectors(t,e),Xa.subVectors(s,e),gc.crossVectors(mc,Xa);let a=this.direction.dot(gc),o;if(a>0){if(i)return null;o=1}else if(a<0)o=-1,a=-a;else return null;Fn.subVectors(this.origin,e);const l=o*this.direction.dot(Xa.crossVectors(Fn,Xa));if(l<0)return null;const c=o*this.direction.dot(mc.cross(Fn));if(c<0||l+c>a)return null;const d=-o*Fn.dot(gc);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 Xu extends In{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 ai,this.combine=Bg,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 Uf=new wt,fi=new yl,Ka=new $i,Ff=new W,Ya=new W,Za=new W,Qa=new W,Mc=new W,Ja=new W,jf=new W,eo=new W;class Ms extends kt{constructor(e=new qt,t=new Xu){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){Ja.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?Ja.addScaledVector(Mc,d):Ja.addScaledVector(Mc.sub(t),d))}t.add(Ja)}return t}raycast(e,t){const s=this.geometry,i=this.material,r=this.matrixWorld;i!==void 0&&(s.boundingSphere===null&&s.computeBoundingSphere(),Ka.copy(s.boundingSphere),Ka.applyMatrix4(r),fi.copy(e.ray).recast(e.near),!(Ka.containsPoint(fi.origin)===!1&&(fi.intersectSphere(Ka,Ff)===null||fi.origin.distanceToSquared(Ff)>(e.far-e.near)**2))&&(Uf.copy(r).invert(),fi.copy(e.ray).applyMatrix4(Uf),!(s.boundingBox!==null&&fi.intersectsBox(s.boundingBox)===!1)&&this._computeIntersections(e,t,fi)))}_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,p=r.drawRange;if(o!==null)if(Array.isArray(a))for(let f=0,M=h.length;f<M;f++){const g=h[f],m=a[g.materialIndex],_=Math.max(g.start,p.start),w=Math.min(o.count,Math.min(g.start+g.count,p.start+p.count));for(let z=_,y=w;z<y;z+=3){const O=o.getX(z),S=o.getX(z+1),b=o.getX(z+2);i=to(this,m,e,s,c,d,u,O,S,b),i&&(i.faceIndex=Math.floor(z/3),i.face.materialIndex=g.materialIndex,t.push(i))}}else{const f=Math.max(0,p.start),M=Math.min(o.count,p.start+p.count);for(let g=f,m=M;g<m;g+=3){const _=o.getX(g),w=o.getX(g+1),z=o.getX(g+2);i=to(this,a,e,s,c,d,u,_,w,z),i&&(i.faceIndex=Math.floor(g/3),t.push(i))}}else if(l!==void 0)if(Array.isArray(a))for(let f=0,M=h.length;f<M;f++){const g=h[f],m=a[g.materialIndex],_=Math.max(g.start,p.start),w=Math.min(l.count,Math.min(g.start+g.count,p.start+p.count));for(let z=_,y=w;z<y;z+=3){const O=z,S=z+1,b=z+2;i=to(this,m,e,s,c,d,u,O,S,b),i&&(i.faceIndex=Math.floor(z/3),i.face.materialIndex=g.materialIndex,t.push(i))}}else{const f=Math.max(0,p.start),M=Math.min(l.count,p.start+p.count);for(let g=f,m=M;g<m;g+=3){const _=g,w=g+1,z=g+2;i=to(this,a,e,s,c,d,u,_,w,z),i&&(i.faceIndex=Math.floor(g/3),t.push(i))}}}}function AO(n,e,t,s,i,r,a,o){let l;if(e.side===gs?l=s.intersectTriangle(a,r,i,!0,o):l=s.intersectTriangle(i,r,a,e.side===ri,o),l===null)return null;eo.copy(o),eo.applyMatrix4(n.matrixWorld);const c=t.ray.origin.distanceTo(eo);return c<t.near||c>t.far?null:{distance:c,point:eo.clone(),object:n}}function to(n,e,t,s,i,r,a,o,l,c){n.getVertexPosition(o,Ya),n.getVertexPosition(l,Za),n.getVertexPosition(c,Qa);const d=AO(n,e,t,s,Ya,Za,Qa,jf);if(d){const u=new W;Bs.getBarycoord(jf,Ya,Za,Qa,u),i&&(d.uv=Bs.getInterpolatedAttribute(i,o,l,c,u,new et)),r&&(d.uv1=Bs.getInterpolatedAttribute(r,o,l,c,u,new et)),a&&(d.normal=Bs.getInterpolatedAttribute(a,o,l,c,u,new W),d.normal.dot(s.direction)>0&&d.normal.multiplyScalar(-1));const h={a:o,b:l,c,normal:new W,materialIndex:0};Bs.getNormal(Ya,Za,Qa,h.normal),d.face=h,d.barycoord=u}return d}class sM extends ls{constructor(e=null,t=1,s=1,i,r,a,o,l,c=ss,d=ss,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 ti extends ts{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 dr=new wt,$f=new wt,so=[],Vf=new ji,DO=new wt,Jr=new Ms,ea=new $i;class Ku extends Ms{constructor(e,t,s){super(e,t),this.isInstancedMesh=!0,this.instanceMatrix=new ti(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,DO)}computeBoundingBox(){const e=this.geometry,t=this.count;this.boundingBox===null&&(this.boundingBox=new ji),e.boundingBox===null&&e.computeBoundingBox(),this.boundingBox.makeEmpty();for(let s=0;s<t;s++)this.getMatrixAt(s,dr),Vf.copy(e.boundingBox).applyMatrix4(dr),this.boundingBox.union(Vf)}computeBoundingSphere(){const e=this.geometry,t=this.count;this.boundingSphere===null&&(this.boundingSphere=new $i),e.boundingSphere===null&&e.computeBoundingSphere(),this.boundingSphere.makeEmpty();for(let s=0;s<t;s++)this.getMatrixAt(s,dr),ea.copy(e.boundingSphere).applyMatrix4(dr),this.boundingSphere.union(ea)}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(Jr.geometry=this.geometry,Jr.material=this.material,Jr.material!==void 0&&(this.boundingSphere===null&&this.computeBoundingSphere(),ea.copy(this.boundingSphere),ea.applyMatrix4(s),e.ray.intersectsSphere(ea)!==!1))for(let r=0;r<i;r++){this.getMatrixAt(r,dr),$f.multiplyMatrices(s,dr),Jr.matrixWorld=$f,Jr.raycast(e,so);for(let a=0,o=so.length;a<o;a++){const l=so[a];l.instanceId=r,l.object=this,t.push(l)}so.length=0}}setColorAt(e,t){return this.instanceColor===null&&(this.instanceColor=new ti(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 sM(new Float32Array(i*this.count),i,this.count,Wu,$s));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 bc=new W,TO=new W,IO=new st;class Vn{constructor(e=new W(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=bc.subVectors(s,t).cross(TO.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(bc),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||IO.getNormalMatrix(e),i=this.coplanarPoint(bc).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 pi=new $i,GO=new et(.5,.5),no=new W;class Yu{constructor(e=new Vn,t=new Vn,s=new Vn,i=new Vn,r=new Vn,a=new Vn){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=tn,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],p=r[7],f=r[8],M=r[9],g=r[10],m=r[11],_=r[12],w=r[13],z=r[14],y=r[15];if(i[0].setComponents(c-a,p-d,m-f,y-_).normalize(),i[1].setComponents(c+a,p+d,m+f,y+_).normalize(),i[2].setComponents(c+o,p+u,m+M,y+w).normalize(),i[3].setComponents(c-o,p-u,m-M,y-w).normalize(),s)i[4].setComponents(l,h,g,z).normalize(),i[5].setComponents(c-l,p-h,m-g,y-z).normalize();else if(i[4].setComponents(c-l,p-h,m-g,y-z).normalize(),t===tn)i[5].setComponents(c+l,p+h,m+g,y+z).normalize();else if(t===Oa)i[5].setComponents(l,h,g,z).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(),pi.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{const t=e.geometry;t.boundingSphere===null&&t.computeBoundingSphere(),pi.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(pi)}intersectsSprite(e){pi.center.set(0,0,0);const t=GO.distanceTo(e.center);return pi.radius=.7071067811865476+t,pi.applyMatrix4(e.matrixWorld),this.intersectsSphere(pi)}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(no.x=i.normal.x>0?e.max.x:e.min.x,no.y=i.normal.y>0?e.max.y:e.min.y,no.z=i.normal.z>0?e.max.z:e.min.z,i.distanceToPoint(no)<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 vl extends In{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 il=new W,rl=new W,Hf=new wt,ta=new yl,io=new $i,_c=new W,qf=new W;class Jd extends kt{constructor(e=new qt,t=new vl){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++)il.fromBufferAttribute(t,i-1),rl.fromBufferAttribute(t,i),s[i]=s[i-1],s[i]+=il.distanceTo(rl);e.setAttribute("lineDistance",new Ot(s,1))}else He("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(),io.copy(s.boundingSphere),io.applyMatrix4(i),io.radius+=r,e.ray.intersectsSphere(io)===!1)return;Hf.copy(i).invert(),ta.copy(e.ray).applyMatrix4(Hf);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 p=Math.max(0,a.start),f=Math.min(d.count,a.start+a.count);for(let M=p,g=f-1;M<g;M+=c){const m=d.getX(M),_=d.getX(M+1),w=ro(this,e,ta,l,m,_,M);w&&t.push(w)}if(this.isLineLoop){const M=d.getX(f-1),g=d.getX(p),m=ro(this,e,ta,l,M,g,f-1);m&&t.push(m)}}else{const p=Math.max(0,a.start),f=Math.min(h.count,a.start+a.count);for(let M=p,g=f-1;M<g;M+=c){const m=ro(this,e,ta,l,M,M+1,M);m&&t.push(m)}if(this.isLineLoop){const M=ro(this,e,ta,l,f-1,p,f-1);M&&t.push(M)}}}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 ro(n,e,t,s,i,r,a){const o=n.geometry.attributes.position;if(il.fromBufferAttribute(o,i),rl.fromBufferAttribute(o,r),t.distanceSqToSegment(il,rl,_c,qf)>s)return;_c.applyMatrix4(n.matrixWorld);const c=e.ray.origin.distanceTo(_c);if(!(c<e.near||c>e.far))return{distance:c,point:qf.clone().applyMatrix4(n.matrixWorld),index:a,face:null,faceIndex:null,barycoord:null,object:n}}const Xf=new W,Kf=new W;class eu extends Jd{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)Xf.fromBufferAttribute(t,i),Kf.fromBufferAttribute(t,i+1),s[i]=i===0?0:s[i-1],s[i+1]=s[i]+Xf.distanceTo(Kf);e.setAttribute("lineDistance",new Ot(s,1))}else He("LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}}class RO extends In{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 Yf=new wt,tu=new yl,ao=new $i,oo=new W;class NO extends kt{constructor(e=new qt,t=new RO){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(),ao.copy(s.boundingSphere),ao.applyMatrix4(i),ao.radius+=r,e.ray.intersectsSphere(ao)===!1)return;Yf.copy(i).invert(),tu.copy(e.ray).applyMatrix4(Yf);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),p=Math.min(c.count,a.start+a.count);for(let f=h,M=p;f<M;f++){const g=c.getX(f);oo.fromBufferAttribute(u,g),Zf(oo,g,l,i,e,t,this)}}else{const h=Math.max(0,a.start),p=Math.min(u.count,a.start+a.count);for(let f=h,M=p;f<M;f++)oo.fromBufferAttribute(u,f),Zf(oo,f,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 Zf(n,e,t,s,i,r,a){const o=tu.distanceSqToPoint(n);if(o<t){const l=new W;tu.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 nM extends ls{constructor(e=[],t=Li,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 iM extends ls{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 Rr extends ls{constructor(e,t,s=on,i,r,a,o=ss,l=ss,c,d=Tn,u=1){if(d!==Tn&&d!==vi)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 BO extends Rr{constructor(e,t=on,s=Li,i,r,a=ss,o=ss,l,c=Tn){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 rM extends ls{constructor(e=null){super(),this.sourceTexture=e,this.isExternalTexture=!0}copy(e){return super.copy(e),this.sourceTexture=e.sourceTexture,this}}class Ea extends qt{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,p=0;f("z","y","x",-1,-1,s,t,e,a,r,0),f("z","y","x",1,-1,s,t,-e,a,r,1),f("x","z","y",1,1,e,s,t,i,a,2),f("x","z","y",1,-1,e,s,-t,i,a,3),f("x","y","z",1,-1,e,t,s,i,r,4),f("x","y","z",-1,-1,e,t,-s,i,r,5),this.setIndex(l),this.setAttribute("position",new Ot(c,3)),this.setAttribute("normal",new Ot(d,3)),this.setAttribute("uv",new Ot(u,2));function f(M,g,m,_,w,z,y,O,S,b,v){const E=z/S,A=y/b,I=z/2,G=y/2,C=O/2,B=S+1,P=b+1;let L=0,H=0;const X=new W;for(let oe=0;oe<P;oe++){const J=oe*A-G;for(let ce=0;ce<B;ce++){const We=ce*E-I;X[M]=We*_,X[g]=J*w,X[m]=C,c.push(X.x,X.y,X.z),X[M]=0,X[g]=0,X[m]=O>0?1:-1,d.push(X.x,X.y,X.z),u.push(ce/S),u.push(1-oe/b),L+=1}}for(let oe=0;oe<b;oe++)for(let J=0;J<S;J++){const ce=h+J+B*oe,We=h+J+B*(oe+1),qe=h+(J+1)+B*(oe+1),Pe=h+(J+1)+B*oe;l.push(ce,We,Pe),l.push(We,qe,Pe),H+=6}o.addGroup(p,H,v),p+=H,h+=L}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Ea(e.width,e.height,e.depth,e.widthSegments,e.heightSegments,e.depthSegments)}}class Zu extends qt{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 W,d=new et;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 p=s+u/t*i;c.x=e*Math.cos(p),c.y=e*Math.sin(p),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 Ot(a,3)),this.setAttribute("normal",new Ot(o,3)),this.setAttribute("uv",new Ot(l,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Zu(e.radius,e.segments,e.thetaStart,e.thetaLength)}}class Qu extends qt{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=[],p=[];let f=0;const M=[],g=s/2;let m=0;_(),a===!1&&(e>0&&w(!0),t>0&&w(!1)),this.setIndex(d),this.setAttribute("position",new Ot(u,3)),this.setAttribute("normal",new Ot(h,3)),this.setAttribute("uv",new Ot(p,2));function _(){const z=new W,y=new W;let O=0;const S=(t-e)/s;for(let b=0;b<=r;b++){const v=[],E=b/r,A=E*(t-e)+e;for(let I=0;I<=i;I++){const G=I/i,C=G*l+o,B=Math.sin(C),P=Math.cos(C);y.x=A*B,y.y=-E*s+g,y.z=A*P,u.push(y.x,y.y,y.z),z.set(B,S,P).normalize(),h.push(z.x,z.y,z.z),p.push(G,1-E),v.push(f++)}M.push(v)}for(let b=0;b<i;b++)for(let v=0;v<r;v++){const E=M[v][b],A=M[v+1][b],I=M[v+1][b+1],G=M[v][b+1];(e>0||v!==0)&&(d.push(E,A,G),O+=3),(t>0||v!==r-1)&&(d.push(A,I,G),O+=3)}c.addGroup(m,O,0),m+=O}function w(z){const y=f,O=new et,S=new W;let b=0;const v=z===!0?e:t,E=z===!0?1:-1;for(let I=1;I<=i;I++)u.push(0,g*E,0),h.push(0,E,0),p.push(.5,.5),f++;const A=f;for(let I=0;I<=i;I++){const C=I/i*l+o,B=Math.cos(C),P=Math.sin(C);S.x=v*P,S.y=g*E,S.z=v*B,u.push(S.x,S.y,S.z),h.push(0,E,0),O.x=B*.5+.5,O.y=P*.5*E+.5,p.push(O.x,O.y),f++}for(let I=0;I<i;I++){const G=y+I,C=A+I;z===!0?d.push(C,C+1,G):d.push(C+1,C,G),b+=3}c.addGroup(m,b,z===!0?1:2),m+=b}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Qu(e.radiusTop,e.radiusBottom,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}}class Ju extends qt{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 Ot(r,3)),this.setAttribute("normal",new Ot(r.slice(),3)),this.setAttribute("uv",new Ot(a,2)),i===0?this.computeVertexNormals():this.normalizeNormals();function o(_){const w=new W,z=new W,y=new W;for(let O=0;O<t.length;O+=3)p(t[O+0],w),p(t[O+1],z),p(t[O+2],y),l(w,z,y,_)}function l(_,w,z,y){const O=y+1,S=[];for(let b=0;b<=O;b++){S[b]=[];const v=_.clone().lerp(z,b/O),E=w.clone().lerp(z,b/O),A=O-b;for(let I=0;I<=A;I++)I===0&&b===O?S[b][I]=v:S[b][I]=v.clone().lerp(E,I/A)}for(let b=0;b<O;b++)for(let v=0;v<2*(O-b)-1;v++){const E=Math.floor(v/2);v%2===0?(h(S[b][E+1]),h(S[b+1][E]),h(S[b][E])):(h(S[b][E+1]),h(S[b+1][E+1]),h(S[b+1][E]))}}function c(_){const w=new W;for(let z=0;z<r.length;z+=3)w.x=r[z+0],w.y=r[z+1],w.z=r[z+2],w.normalize().multiplyScalar(_),r[z+0]=w.x,r[z+1]=w.y,r[z+2]=w.z}function d(){const _=new W;for(let w=0;w<r.length;w+=3){_.x=r[w+0],_.y=r[w+1],_.z=r[w+2];const z=g(_)/2/Math.PI+.5,y=m(_)/Math.PI+.5;a.push(z,1-y)}f(),u()}function u(){for(let _=0;_<a.length;_+=6){const w=a[_+0],z=a[_+2],y=a[_+4],O=Math.max(w,z,y),S=Math.min(w,z,y);O>.9&&S<.1&&(w<.2&&(a[_+0]+=1),z<.2&&(a[_+2]+=1),y<.2&&(a[_+4]+=1))}}function h(_){r.push(_.x,_.y,_.z)}function p(_,w){const z=_*3;w.x=e[z+0],w.y=e[z+1],w.z=e[z+2]}function f(){const _=new W,w=new W,z=new W,y=new W,O=new et,S=new et,b=new et;for(let v=0,E=0;v<r.length;v+=9,E+=6){_.set(r[v+0],r[v+1],r[v+2]),w.set(r[v+3],r[v+4],r[v+5]),z.set(r[v+6],r[v+7],r[v+8]),O.set(a[E+0],a[E+1]),S.set(a[E+2],a[E+3]),b.set(a[E+4],a[E+5]),y.copy(_).add(w).add(z).divideScalar(3);const A=g(y);M(O,E+0,_,A),M(S,E+2,w,A),M(b,E+4,z,A)}}function M(_,w,z,y){y<0&&_.x===1&&(a[w]=_.x-1),z.x===0&&z.z===0&&(a[w]=y/2/Math.PI+.5)}function g(_){return Math.atan2(_.z,-_.x)}function m(_){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 Ju(e.vertices,e.indices,e.radius,e.detail)}}class eh extends Ju{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 eh(e.radius,e.detail)}}class Ol extends qt{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,p=[],f=[],M=[],g=[];for(let m=0;m<d;m++){const _=m*h-a;for(let w=0;w<c;w++){const z=w*u-r;f.push(z,-_,0),M.push(0,0,1),g.push(w/o),g.push(1-m/l)}}for(let m=0;m<l;m++)for(let _=0;_<o;_++){const w=_+c*m,z=_+c*(m+1),y=_+1+c*(m+1),O=_+1+c*m;p.push(w,z,O),p.push(z,y,O)}this.setIndex(p),this.setAttribute("position",new Ot(f,3)),this.setAttribute("normal",new Ot(M,3)),this.setAttribute("uv",new Ot(g,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Ol(e.width,e.height,e.widthSegments,e.heightSegments)}}class xl extends qt{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 W,h=new W,p=[],f=[],M=[],g=[];for(let m=0;m<=s;m++){const _=[],w=m/s,z=a+w*o,y=e*Math.cos(z),O=Math.sqrt(e*e-y*y);let S=0;m===0&&a===0?S=.5/t:m===s&&l===Math.PI&&(S=-.5/t);for(let b=0;b<=t;b++){const v=b/t,E=i+v*r;u.x=-O*Math.cos(E),u.y=y,u.z=O*Math.sin(E),f.push(u.x,u.y,u.z),h.copy(u).normalize(),M.push(h.x,h.y,h.z),g.push(v+S,1-w),_.push(c++)}d.push(_)}for(let m=0;m<s;m++)for(let _=0;_<t;_++){const w=d[m][_+1],z=d[m][_],y=d[m+1][_],O=d[m+1][_+1];(m!==0||a>0)&&p.push(w,z,O),(m!==s-1||l<Math.PI)&&p.push(z,y,O)}this.setIndex(p),this.setAttribute("position",new Ot(f,3)),this.setAttribute("normal",new Ot(M,3)),this.setAttribute("uv",new Ot(g,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new xl(e.radius,e.widthSegments,e.heightSegments,e.phiStart,e.phiLength,e.thetaStart,e.thetaLength)}}function Nr(n){const e={};for(const t in n){e[t]={};for(const s in n[t]){const i=n[t][s];if(Qf(i))i.isRenderTargetTexture?(He("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(Qf(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 us(n){const e={};for(let t=0;t<n.length;t++){const s=Nr(n[t]);for(const i in s)e[i]=s[i]}return e}function Qf(n){return n&&(n.isColor||n.isMatrix3||n.isMatrix4||n.isVector2||n.isVector3||n.isVector4||n.isTexture||n.isQuaternion)}function CO(n){const e=[];for(let t=0;t<n.length;t++)e.push(n[t].clone());return e}function aM(n){const e=n.getRenderTarget();return e===null?n.outputColorSpace:e.isXRRenderTarget===!0?e.texture.colorSpace:mt.workingColorSpace}const PO={clone:Nr,merge:us};var LO=`void main() {
32
+ `)}`}return"desktop save|load|show|list|delete [name]"}const Pn={universe:{text:"Every analysis, drawn as a galaxy. Alike analyses cluster; failures glow red. Rearrange it:",list:["GALAXY: grouped by pipeline (the default)","SPOKES · CLUMPS: the same groups, tidier","CONSTELLATIONS: grouped by the tools they used","DATA: hung from the data they began with (format, modality, series)","ACCRETION: grown oldest-first, like next to like"],tail:"Replay its history, or fly in to any one analysis to see its steps."},analyses:{text:"Your analyses, newest first. Open one to follow it, read its logs and browse its results."},files:{text:"Your ChRIS home: uploads, results and what others shared with you."},pacs:{text:"Find studies in the hospital PACS and pull the series you need into ChRIS."},panes:{text:"Saved workspaces: return to a piece of work as you left it."},keys:{text:"Keyboard shortcuts and the commands ARGUS understands."},notes:{text:"A list of updates since the previous release."},console:{text:"A command line into the same session; what you do here shows in the panes, and the other way round."}};function _v(n){return async()=>{const[e,t,s]=await Promise.all([n.ask("proc feeds"),n.ask("ls ~"),n.notes_latest()]);let i=[];for(const v of e.envelopes){const E=v.model;if(E===void 0||E.kind!==Vm)continue;const A=$m.safeParse(E.data);A.success&&(i=A.data.feeds)}const a=i.length===0&&e.envelopes.some(v=>v.status==="error")?"INDEX WARMING":`${i.length} FEEDS`,o=i.filter(v=>/error/i.test(v.status)).length,l=i.filter(v=>/running|scheduled|created|started/i.test(v.status)).length;let c=[],d="~";for(const v of t.envelopes){if(v.model?.kind!=="fs.listing")continue;const A=v.model.data[0];A!==void 0&&Array.isArray(A.items)&&(c=A.items,typeof A.path=="string"&&(d=A.path))}const u=c.filter(v=>v.type==="dir"),h=n.desktops(),p={key:"universe",name:"UNIVERSE",hue:"--honey",numeral:"",figures:[{text:a}],rows:[],verb:"SEE THE SPACE",about:Pn.universe,enter:()=>n.universe_show()},f={key:"analyses",name:"ANALYSES",hue:"--october-sunset",numeral:"3",figures:[{text:a},...l>0?[{text:`${l} RUNNING`}]:[],...o>0?[{text:`${o} ERRORED`,errored:!0,open:()=>n.runs_show("status:error")}]:[]],rows:i.slice(0,6).map(v=>({text:`${v.id} ${v.title}`,errored:/error/i.test(v.status),open:()=>n.feed_enter(v.id)})),verb:"OPEN THE ROSTER",about:Pn.analyses,enter:()=>n.runs_show()},M={key:"files",name:"FILES",hue:"--harvestgold",numeral:"2",figures:[{text:`${c.length} ENTRIES`}],rows:u.slice(0,5).map(v=>({text:v.name,open:()=>n.home_cd(d.endsWith("/")?`${d}${v.name}`:`${d}/${v.name}`)})),verb:"OPEN HOME",about:Pn.files,enter:()=>n.home_open()},g=n.pacs_query(),m={key:"pacs",name:"PACS",hue:"--daybreak",numeral:"4",figures:[{text:g===""?"NO ANSWER":"ANSWERED"}],rows:g===""?[{text:"pacs query PatientID:…",open:()=>n.line_offer("pacs query PatientID:")},{text:"pacs query AccessionNumber:…",open:()=>n.line_offer("pacs query AccessionNumber:")}]:[{text:g.slice(0,48)}],verb:"ASK A PACS",about:Pn.pacs,enter:()=>n.pacs_open()},_={key:"panes",name:"PANES",hue:"--butter",numeral:"6",figures:[{text:h.length===0?"EMPTY":`${h.length} DESKTOPS`}],rows:h.slice(0,5).map(v=>({text:v.label,open:()=>n.desktop_restore(v.id)})),verb:"SEE DESKTOPS",about:Pn.panes,enter:()=>n.panes_open()},w={key:"help",name:"KEYS",hue:"--butter",numeral:"",figures:[{text:`${Ci.length} KEYS`},{text:`${Nu.length} VERBS`}],rows:Ci.slice(0,5).map(v=>({text:`${v.key.padEnd(6)} ${v.does}`,open:()=>n.keys_open()})),verb:"OPEN THE KEYS",about:Pn.keys,enter:()=>n.keys_open()},z=s?.releases[0],y=z?.entries.flatMap(v=>v.changes.filter(E=>!E.internal))??[],O={key:"notes",name:"WHAT'S NEW",hue:"--butter",numeral:"",figures:z===void 0?[{text:"NO NOTES"}]:[{text:n.daemon_stale()?"AFTER RESTART":z.date??"UNDATED"},{text:`${y.length} CHANGE${y.length===1?"":"S"}`}],rows:y.slice(0,3).map(v=>({text:`${v.package.padEnd(7)} ${v.headline}`,open:()=>n.notes_open()})),verb:"OPEN THE NOTES",about:Pn.notes,enter:()=>n.notes_open()},S={key:"console",name:"CONSOLE",hue:"--daybreak",numeral:"5",figures:[],rows:[],verb:"OPEN THE CONSOLE",about:Pn.console,enter:()=>n.console_open()},b=[M,m,_,p,w,O,S];return i.length>=c.length?[f,...b]:[M,f,m,_,p,w,O,S]}}const zv=/\s--(?:\s|$)/;function _l(n){const e=zv.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 Ig(n,e){return`cd "${n}"; ${e}`}function wv(n){return/^[A-Za-z0-9_./:@+=,-]+$/.test(n)?n:`"${n.replace(/(["\\])/g,"\\$1")}"`}function Gg(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 zf(n){return n.length>=2&&n.startsWith('"')&&n.endsWith('"')?n.slice(1,-1).replace(/\\(["\\])/g,"$1"):n}function Rg(n){return n.startsWith("-")&&n!=="-"&&!/^-\d/.test(n)}function yv(n,e){const t=Gg(_l(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||Rg(r)?!0:zf(r)}if(i.startsWith(`${e}=`))return zf(i.slice(e.length+1))}return null}function wf(n,e,t){const s=_l(n),i=Gg(s.args),r=[];let a=!1;const o=t===null||t===""?[]:t===!0?[e]:[e,wv(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&&!Rg(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 vv(n){return/\bfeed_title=/.test(_l(n).tail)}function Ov(n,e){return`${n} -- feed_title="${e.replace(/(["\\])/g,"\\$1")}"`}function Ng(n){return _l(n).head.replace(/^.*;\s*/,"").trim()}function xv(n,e,t){return/^[A-Za-z0-9_-]+$/.test(n)&&t.filter(i=>i===n).length===1?n:`@${e}`}const Bu="185",Sv=0,yf=1,Ev=2,Oo=1,Av=2,ua=3,ri=0,gs=1,zn=2,Sn=0,Ei=1,Pi=2,vf=3,Of=4,Dv=5,_i=100,Tv=101,Iv=102,Gv=103,Rv=104,Nv=200,Bv=201,Cv=202,Pv=203,cd=204,dd=205,Lv=206,Wv=207,kv=208,Uv=209,Fv=210,jv=211,$v=212,Vv=213,Hv=214,ud=0,hd=1,fd=2,Ir=3,pd=4,md=5,gd=6,Md=7,Bg=0,qv=1,Xv=2,nn=0,Cg=1,Pg=2,Lg=3,Wg=4,kg=5,Ug=6,Fg=7,jg=300,Li=301,Gr=302,Vl=303,Hl=304,zl=306,bd=1e3,yn=1001,_d=1002,ss=1003,Kv=1004,Ca=1005,os=1006,ql=1007,yi=1008,Ss=1009,$g=1010,Vg=1011,ya=1012,Cu=1013,on=1014,$s=1015,Dn=1016,Pu=1017,Lu=1018,va=1020,Hg=35902,qg=35899,Xg=1021,Kg=1022,Vs=1023,Tn=1026,vi=1027,Wu=1028,ku=1029,Wi=1030,Uu=1031,Fu=1033,xo=33776,So=33777,Eo=33778,Ao=33779,zd=35840,wd=35841,yd=35842,vd=35843,Od=36196,xd=37492,Sd=37496,Ed=37488,Ad=37489,Zo=37490,Dd=37491,Td=37808,Id=37809,Gd=37810,Rd=37811,Nd=37812,Bd=37813,Cd=37814,Pd=37815,Ld=37816,Wd=37817,kd=37818,Ud=37819,Fd=37820,jd=37821,$d=36492,Vd=36494,Hd=36495,qd=36283,Xd=36284,Qo=36285,Kd=36286,Yv=3200,Yd=0,Zv=1,qn="",Is="srgb",Jo="srgb-linear",el="linear",St="srgb",Ki=7680,xf=519,Qv=512,Jv=513,eO=514,ju=515,tO=516,sO=517,$u=518,nO=519,Zd=35044,Sf="300 es",tn=2e3,Oa=2001;function iO(n){for(let e=n.length-1;e>=0;--e)if(n[e]>=65535)return!0;return!1}function tl(n){return document.createElementNS("http://www.w3.org/1999/xhtml",n)}function rO(){const n=tl("canvas");return n.style.display="block",n}const Ef={};function sl(...n){const e="THREE."+n.shift();console.log(e,...n)}function Yg(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 He(...n){n=Yg(n);const e="THREE."+n.shift();{const t=n[0];t&&t.isStackTrace?console.warn(t.getError(e)):console.warn(e,...n)}}function pt(...n){n=Yg(n);const e="THREE."+n.shift();{const t=n[0];t&&t.isStackTrace?console.error(t.getError(e)):console.error(e,...n)}}function yr(...n){const e=n.join(" ");e in Ef||(Ef[e]=!0,He(...n))}function aO(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 oO={[ud]:hd,[fd]:gd,[pd]:Md,[Ir]:md,[hd]:ud,[gd]:fd,[Md]:pd,[md]:Ir};class Ui{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 is=["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"],Xl=Math.PI/180,Qd=180/Math.PI;function ei(){const n=Math.random()*4294967295|0,e=Math.random()*4294967295|0,t=Math.random()*4294967295|0,s=Math.random()*4294967295|0;return(is[n&255]+is[n>>8&255]+is[n>>16&255]+is[n>>24&255]+"-"+is[e&255]+is[e>>8&255]+"-"+is[e>>16&15|64]+is[e>>24&255]+"-"+is[t&63|128]+is[t>>8&255]+"-"+is[t>>16&255]+is[t>>24&255]+is[s&255]+is[s>>8&255]+is[s>>16&255]+is[s>>24&255]).toLowerCase()}function gt(n,e,t){return Math.max(e,Math.min(t,n))}function lO(n,e){return(n%e+e)%e}function Kl(n,e,t){return(1-t)*n+t*e}function en(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 Dt(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 ch=class ch{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=gt(this.x,e.x,t.x),this.y=gt(this.y,e.y,t.y),this}clampScalar(e,t){return this.x=gt(this.x,e,t),this.y=gt(this.y,e,t),this}clampLength(e,t){const s=this.length();return this.divideScalar(s||1).multiplyScalar(gt(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(gt(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}};ch.prototype.isVector2=!0;let et=ch;class Fi{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],p=r[a+1],f=r[a+2],M=r[a+3];if(u!==M||l!==h||c!==p||d!==f){let g=l*h+c*p+d*f+u*M;g<0&&(h=-h,p=-p,f=-f,M=-M,g=-g);let m=1-o;if(g<.9995){const _=Math.acos(g),w=Math.sin(_);m=Math.sin(m*_)/w,o=Math.sin(o*_)/w,l=l*m+h*o,c=c*m+p*o,d=d*m+f*o,u=u*m+M*o}else{l=l*m+h*o,c=c*m+p*o,d=d*m+f*o,u=u*m+M*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],p=r[a+2],f=r[a+3];return e[t]=o*f+d*u+l*p-c*h,e[t+1]=l*f+d*h+c*u-o*p,e[t+2]=c*f+d*p+o*h-l*u,e[t+3]=d*f-o*u-l*h-c*p,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),p=l(i/2),f=l(r/2);switch(a){case"XYZ":this._x=h*d*u+c*p*f,this._y=c*p*u-h*d*f,this._z=c*d*f+h*p*u,this._w=c*d*u-h*p*f;break;case"YXZ":this._x=h*d*u+c*p*f,this._y=c*p*u-h*d*f,this._z=c*d*f-h*p*u,this._w=c*d*u+h*p*f;break;case"ZXY":this._x=h*d*u-c*p*f,this._y=c*p*u+h*d*f,this._z=c*d*f+h*p*u,this._w=c*d*u-h*p*f;break;case"ZYX":this._x=h*d*u-c*p*f,this._y=c*p*u+h*d*f,this._z=c*d*f-h*p*u,this._w=c*d*u+h*p*f;break;case"YZX":this._x=h*d*u+c*p*f,this._y=c*p*u+h*d*f,this._z=c*d*f-h*p*u,this._w=c*d*u-h*p*f;break;case"XZY":this._x=h*d*u-c*p*f,this._y=c*p*u-h*d*f,this._z=c*d*f+h*p*u,this._w=c*d*u+h*p*f;break;default:He("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 p=.5/Math.sqrt(h+1);this._w=.25/p,this._x=(d-l)*p,this._y=(r-c)*p,this._z=(a-i)*p}else if(s>o&&s>u){const p=2*Math.sqrt(1+s-o-u);this._w=(d-l)/p,this._x=.25*p,this._y=(i+a)/p,this._z=(r+c)/p}else if(o>u){const p=2*Math.sqrt(1+o-s-u);this._w=(r-c)/p,this._x=(i+a)/p,this._y=.25*p,this._z=(l+d)/p}else{const p=2*Math.sqrt(1+u-s-o);this._w=(a-i)/p,this._x=(r+c)/p,this._y=(l+d)/p,this._z=.25*p}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(gt(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 dh=class dh{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(Af.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(Af.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=gt(this.x,e.x,t.x),this.y=gt(this.y,e.y,t.y),this.z=gt(this.z,e.z,t.z),this}clampScalar(e,t){return this.x=gt(this.x,e,t),this.y=gt(this.y,e,t),this.z=gt(this.z,e,t),this}clampLength(e,t){const s=this.length();return this.divideScalar(s||1).multiplyScalar(gt(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 Yl.copy(this).projectOnVector(e),this.sub(Yl)}reflect(e){return this.sub(Yl.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(gt(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}};dh.prototype.isVector3=!0;let k=dh;const Yl=new k,Af=new Fi,uh=class uh{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],p=s[5],f=s[8],M=i[0],g=i[3],m=i[6],_=i[1],w=i[4],z=i[7],y=i[2],O=i[5],S=i[8];return r[0]=a*M+o*_+l*y,r[3]=a*g+o*w+l*O,r[6]=a*m+o*z+l*S,r[1]=c*M+d*_+u*y,r[4]=c*g+d*w+u*O,r[7]=c*m+d*z+u*S,r[2]=h*M+p*_+f*y,r[5]=h*g+p*w+f*O,r[8]=h*m+p*z+f*S,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,p=c*r-a*l,f=t*u+s*h+i*p;if(f===0)return this.set(0,0,0,0,0,0,0,0,0);const M=1/f;return e[0]=u*M,e[1]=(i*c-d*s)*M,e[2]=(o*s-i*a)*M,e[3]=h*M,e[4]=(d*t-i*l)*M,e[5]=(i*r-o*t)*M,e[6]=p*M,e[7]=(s*l-c*t)*M,e[8]=(a*t-s*r)*M,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 yr("Matrix3: .scale() is deprecated. Use .makeScale() instead."),this.premultiply(Zl.makeScale(e,t)),this}rotate(e){return yr("Matrix3: .rotate() is deprecated. Use .makeRotation() instead."),this.premultiply(Zl.makeRotation(-e)),this}translate(e,t){return yr("Matrix3: .translate() is deprecated. Use .makeTranslation() instead."),this.premultiply(Zl.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)}};uh.prototype.isMatrix3=!0;let st=uh;const Zl=new st,Df=new st().set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),Tf=new st().set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715);function cO(){const n={enabled:!0,workingColorSpace:Jo,spaces:{},convert:function(i,r,a){return this.enabled===!1||r===a||!r||!a||(this.spaces[r].transfer===St&&(i.r=En(i.r),i.g=En(i.g),i.b=En(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===St&&(i.r=vr(i.r),i.g=vr(i.g),i.b=vr(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===qn?el: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 yr("ColorManagement: .fromWorkingColorSpace() has been renamed to .workingToColorSpace()."),n.workingToColorSpace(i,r)},toWorkingColorSpace:function(i,r){return yr("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({[Jo]:{primaries:e,whitePoint:s,transfer:el,toXYZ:Df,fromXYZ:Tf,luminanceCoefficients:t,workingColorSpaceConfig:{unpackColorSpace:Is},outputColorSpaceConfig:{drawingBufferColorSpace:Is}},[Is]:{primaries:e,whitePoint:s,transfer:St,toXYZ:Df,fromXYZ:Tf,luminanceCoefficients:t,outputColorSpaceConfig:{drawingBufferColorSpace:Is}}}),n}const mt=cO();function En(n){return n<.04045?n*.0773993808:Math.pow(n*.9478672986+.0521327014,2.4)}function vr(n){return n<.0031308?n*12.92:1.055*Math.pow(n,.41666)-.055}let Yi;class dO{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{Yi===void 0&&(Yi=tl("canvas")),Yi.width=e.width,Yi.height=e.height;const i=Yi.getContext("2d");e instanceof ImageData?i.putImageData(e,0,0):i.drawImage(e,0,0,e.width,e.height),s=Yi}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=tl("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]=En(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(En(t[s]/255)*255):t[s]=En(t[s]);return{data:t,width:e.width,height:e.height}}else return He("ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),e}}let uO=0;class Vu{constructor(e=null){this.isSource=!0,Object.defineProperty(this,"id",{value:uO++}),this.uuid=ei(),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(Ql(i[a].image)):r.push(Ql(i[a]))}else r=Ql(i);s.url=r}return t||(e.images[this.uuid]=s),s}}function Ql(n){return typeof HTMLImageElement<"u"&&n instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&n instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&n instanceof ImageBitmap?dO.getDataURL(n):n.data?{data:Array.from(n.data),width:n.width,height:n.height,type:n.data.constructor.name}:(He("Texture: Unable to serialize Texture."),{})}let hO=0;const Jl=new k;class ls extends Ui{constructor(e=ls.DEFAULT_IMAGE,t=ls.DEFAULT_MAPPING,s=yn,i=yn,r=os,a=yi,o=Vs,l=Ss,c=ls.DEFAULT_ANISOTROPY,d=qn){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:hO++}),this.uuid=ei(),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 et(0,0),this.repeat=new et(1,1),this.center=new et(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new st,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(Jl).x}get height(){return this.source.getSize(Jl).y}get depth(){return this.source.getSize(Jl).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){He(`Texture.setValues(): parameter '${t}' has value of undefined.`);continue}const i=this[t];if(i===void 0){He(`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!==jg)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case bd:e.x=e.x-Math.floor(e.x);break;case yn:e.x=e.x<0?0:1;break;case _d: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 bd:e.y=e.y-Math.floor(e.y);break;case yn:e.y=e.y<0?0:1;break;case _d: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++}}ls.DEFAULT_IMAGE=null;ls.DEFAULT_MAPPING=jg;ls.DEFAULT_ANISOTROPY=1;const hh=class hh{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],p=l[5],f=l[9],M=l[2],g=l[6],m=l[10];if(Math.abs(d-h)<.01&&Math.abs(u-M)<.01&&Math.abs(f-g)<.01){if(Math.abs(d+h)<.1&&Math.abs(u+M)<.1&&Math.abs(f+g)<.1&&Math.abs(c+p+m-3)<.1)return this.set(1,0,0,0),this;t=Math.PI;const w=(c+1)/2,z=(p+1)/2,y=(m+1)/2,O=(d+h)/4,S=(u+M)/4,b=(f+g)/4;return w>z&&w>y?w<.01?(s=0,i=.707106781,r=.707106781):(s=Math.sqrt(w),i=O/s,r=S/s):z>y?z<.01?(s=.707106781,i=0,r=.707106781):(i=Math.sqrt(z),s=O/i,r=b/i):y<.01?(s=.707106781,i=.707106781,r=0):(r=Math.sqrt(y),s=S/r,i=b/r),this.set(s,i,r,t),this}let _=Math.sqrt((g-f)*(g-f)+(u-M)*(u-M)+(h-d)*(h-d));return Math.abs(_)<.001&&(_=1),this.x=(g-f)/_,this.y=(u-M)/_,this.z=(h-d)/_,this.w=Math.acos((c+p+m-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=gt(this.x,e.x,t.x),this.y=gt(this.y,e.y,t.y),this.z=gt(this.z,e.z,t.z),this.w=gt(this.w,e.w,t.w),this}clampScalar(e,t){return this.x=gt(this.x,e,t),this.y=gt(this.y,e,t),this.z=gt(this.z,e,t),this.w=gt(this.w,e,t),this}clampLength(e,t){const s=this.length();return this.divideScalar(s||1).multiplyScalar(gt(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}};hh.prototype.isVector4=!0;let Wt=hh;class fO extends Ui{constructor(e=1,t=1,s={}){super(),s=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:os,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 Wt(0,0,e,t),this.scissorTest=!1,this.viewport=new Wt(0,0,e,t),this.textures=[];const i={width:e,height:t,depth:s.depth},r=new ls(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:os,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 rn extends fO{constructor(e=1,t=1,s={}){super(e,t,s),this.isWebGLRenderTarget=!0}}class Zg extends ls{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=ss,this.minFilter=ss,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 pO extends ls{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=ss,this.minFilter=ss,this.wrapR=yn,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}const hl=class hl{constructor(e,t,s,i,r,a,o,l,c,d,u,h,p,f,M,g){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,p,f,M,g)}set(e,t,s,i,r,a,o,l,c,d,u,h,p,f,M,g){const m=this.elements;return m[0]=e,m[4]=t,m[8]=s,m[12]=i,m[1]=r,m[5]=a,m[9]=o,m[13]=l,m[2]=c,m[6]=d,m[10]=u,m[14]=h,m[3]=p,m[7]=f,m[11]=M,m[15]=g,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 hl().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/Zi.setFromMatrixColumn(e,0).length(),r=1/Zi.setFromMatrixColumn(e,1).length(),a=1/Zi.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,p=a*u,f=o*d,M=o*u;t[0]=l*d,t[4]=-l*u,t[8]=c,t[1]=p+f*c,t[5]=h-M*c,t[9]=-o*l,t[2]=M-h*c,t[6]=f+p*c,t[10]=a*l}else if(e.order==="YXZ"){const h=l*d,p=l*u,f=c*d,M=c*u;t[0]=h+M*o,t[4]=f*o-p,t[8]=a*c,t[1]=a*u,t[5]=a*d,t[9]=-o,t[2]=p*o-f,t[6]=M+h*o,t[10]=a*l}else if(e.order==="ZXY"){const h=l*d,p=l*u,f=c*d,M=c*u;t[0]=h-M*o,t[4]=-a*u,t[8]=f+p*o,t[1]=p+f*o,t[5]=a*d,t[9]=M-h*o,t[2]=-a*c,t[6]=o,t[10]=a*l}else if(e.order==="ZYX"){const h=a*d,p=a*u,f=o*d,M=o*u;t[0]=l*d,t[4]=f*c-p,t[8]=h*c+M,t[1]=l*u,t[5]=M*c+h,t[9]=p*c-f,t[2]=-c,t[6]=o*l,t[10]=a*l}else if(e.order==="YZX"){const h=a*l,p=a*c,f=o*l,M=o*c;t[0]=l*d,t[4]=M-h*u,t[8]=f*u+p,t[1]=u,t[5]=a*d,t[9]=-o*d,t[2]=-c*d,t[6]=p*u+f,t[10]=h-M*u}else if(e.order==="XZY"){const h=a*l,p=a*c,f=o*l,M=o*c;t[0]=l*d,t[4]=-u,t[8]=c*d,t[1]=h*u+M,t[5]=a*d,t[9]=p*u-f,t[2]=f*u-p,t[6]=o*d,t[10]=M*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(mO,e,gO)}lookAt(e,t,s){const i=this.elements;return ws.subVectors(e,t),ws.lengthSq()===0&&(ws.z=1),ws.normalize(),Ln.crossVectors(s,ws),Ln.lengthSq()===0&&(Math.abs(s.z)===1?ws.x+=1e-4:ws.z+=1e-4,ws.normalize(),Ln.crossVectors(s,ws)),Ln.normalize(),Pa.crossVectors(ws,Ln),i[0]=Ln.x,i[4]=Pa.x,i[8]=ws.x,i[1]=Ln.y,i[5]=Pa.y,i[9]=ws.y,i[2]=Ln.z,i[6]=Pa.z,i[10]=ws.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],p=s[13],f=s[2],M=s[6],g=s[10],m=s[14],_=s[3],w=s[7],z=s[11],y=s[15],O=i[0],S=i[4],b=i[8],v=i[12],E=i[1],A=i[5],I=i[9],G=i[13],C=i[2],B=i[6],P=i[10],W=i[14],H=i[3],X=i[7],oe=i[11],J=i[15];return r[0]=a*O+o*E+l*C+c*H,r[4]=a*S+o*A+l*B+c*X,r[8]=a*b+o*I+l*P+c*oe,r[12]=a*v+o*G+l*W+c*J,r[1]=d*O+u*E+h*C+p*H,r[5]=d*S+u*A+h*B+p*X,r[9]=d*b+u*I+h*P+p*oe,r[13]=d*v+u*G+h*W+p*J,r[2]=f*O+M*E+g*C+m*H,r[6]=f*S+M*A+g*B+m*X,r[10]=f*b+M*I+g*P+m*oe,r[14]=f*v+M*G+g*W+m*J,r[3]=_*O+w*E+z*C+y*H,r[7]=_*S+w*A+z*B+y*X,r[11]=_*b+w*I+z*P+y*oe,r[15]=_*v+w*G+z*W+y*J,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],p=e[14],f=e[3],M=e[7],g=e[11],m=e[15],_=l*p-c*h,w=o*p-c*u,z=o*h-l*u,y=a*p-c*d,O=a*h-l*d,S=a*u-o*d;return t*(M*_-g*w+m*z)-s*(f*_-g*y+m*O)+i*(f*w-M*y+m*S)-r*(f*z-M*O+g*S)}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],p=e[11],f=e[12],M=e[13],g=e[14],m=e[15],_=t*o-s*a,w=t*l-i*a,z=t*c-r*a,y=s*l-i*o,O=s*c-r*o,S=i*c-r*l,b=d*M-u*f,v=d*g-h*f,E=d*m-p*f,A=u*g-h*M,I=u*m-p*M,G=h*m-p*g,C=_*G-w*I+z*A+y*E-O*v+S*b;if(C===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const B=1/C;return e[0]=(o*G-l*I+c*A)*B,e[1]=(i*I-s*G-r*A)*B,e[2]=(M*S-g*O+m*y)*B,e[3]=(h*O-u*S-p*y)*B,e[4]=(l*E-a*G-c*v)*B,e[5]=(t*G-i*E+r*v)*B,e[6]=(g*z-f*S-m*w)*B,e[7]=(d*S-h*z+p*w)*B,e[8]=(a*I-o*E+c*b)*B,e[9]=(s*E-t*I-r*b)*B,e[10]=(f*O-M*z+m*_)*B,e[11]=(u*z-d*O-p*_)*B,e[12]=(o*v-a*A-l*b)*B,e[13]=(t*A-s*v+i*b)*B,e[14]=(M*w-f*y-g*_)*B,e[15]=(d*y-u*w+h*_)*B,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,p=r*d,f=r*u,M=a*d,g=a*u,m=o*u,_=l*c,w=l*d,z=l*u,y=s.x,O=s.y,S=s.z;return i[0]=(1-(M+m))*y,i[1]=(p+z)*y,i[2]=(f-w)*y,i[3]=0,i[4]=(p-z)*O,i[5]=(1-(h+m))*O,i[6]=(g+_)*O,i[7]=0,i[8]=(f+w)*S,i[9]=(g-_)*S,i[10]=(1-(h+M))*S,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=Zi.set(i[0],i[1],i[2]).length();const o=Zi.set(i[4],i[5],i[6]).length(),l=Zi.set(i[8],i[9],i[10]).length();r<0&&(a=-a),Ps.copy(this);const c=1/a,d=1/o,u=1/l;return Ps.elements[0]*=c,Ps.elements[1]*=c,Ps.elements[2]*=c,Ps.elements[4]*=d,Ps.elements[5]*=d,Ps.elements[6]*=d,Ps.elements[8]*=u,Ps.elements[9]*=u,Ps.elements[10]*=u,t.setFromRotationMatrix(Ps),s.x=a,s.y=o,s.z=l,this}makePerspective(e,t,s,i,r,a,o=tn,l=!1){const c=this.elements,d=2*r/(t-e),u=2*r/(s-i),h=(t+e)/(t-e),p=(s+i)/(s-i);let f,M;if(l)f=r/(a-r),M=a*r/(a-r);else if(o===tn)f=-(a+r)/(a-r),M=-2*a*r/(a-r);else if(o===Oa)f=-a/(a-r),M=-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]=p,c[13]=0,c[2]=0,c[6]=0,c[10]=f,c[14]=M,c[3]=0,c[7]=0,c[11]=-1,c[15]=0,this}makeOrthographic(e,t,s,i,r,a,o=tn,l=!1){const c=this.elements,d=2/(t-e),u=2/(s-i),h=-(t+e)/(t-e),p=-(s+i)/(s-i);let f,M;if(l)f=1/(a-r),M=a/(a-r);else if(o===tn)f=-2/(a-r),M=-(a+r)/(a-r);else if(o===Oa)f=-1/(a-r),M=-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]=p,c[2]=0,c[6]=0,c[10]=f,c[14]=M,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}};hl.prototype.isMatrix4=!0;let wt=hl;const Zi=new k,Ps=new wt,mO=new k(0,0,0),gO=new k(1,1,1),Ln=new k,Pa=new k,ws=new k,If=new wt,Gf=new Fi;class ai{constructor(e=0,t=0,s=0,i=ai.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],p=i[10];switch(t){case"XYZ":this._y=Math.asin(gt(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(-d,p),this._z=Math.atan2(-a,r)):(this._x=Math.atan2(h,c),this._z=0);break;case"YXZ":this._x=Math.asin(-gt(d,-1,1)),Math.abs(d)<.9999999?(this._y=Math.atan2(o,p),this._z=Math.atan2(l,c)):(this._y=Math.atan2(-u,r),this._z=0);break;case"ZXY":this._x=Math.asin(gt(h,-1,1)),Math.abs(h)<.9999999?(this._y=Math.atan2(-u,p),this._z=Math.atan2(-a,c)):(this._y=0,this._z=Math.atan2(l,r));break;case"ZYX":this._y=Math.asin(-gt(u,-1,1)),Math.abs(u)<.9999999?(this._x=Math.atan2(h,p),this._z=Math.atan2(l,r)):(this._x=0,this._z=Math.atan2(-a,c));break;case"YZX":this._z=Math.asin(gt(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,p));break;case"XZY":this._z=Math.asin(-gt(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(h,c),this._y=Math.atan2(o,r)):(this._x=Math.atan2(-d,p),this._y=0);break;default:He("Euler: .setFromRotationMatrix() encountered an unknown order: "+t)}return this._order=t,s===!0&&this._onChangeCallback(),this}setFromQuaternion(e,t,s){return If.makeRotationFromQuaternion(e),this.setFromRotationMatrix(If,t,s)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return Gf.setFromEuler(this),this.setFromQuaternion(Gf,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}}ai.DEFAULT_ORDER="XYZ";class Hu{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 MO=0;const Rf=new k,Qi=new Fi,un=new wt,La=new k,Hr=new k,bO=new k,_O=new Fi,Nf=new k(1,0,0),Bf=new k(0,1,0),Cf=new k(0,0,1),Pf={type:"added"},zO={type:"removed"},Ji={type:"childadded",child:null},ec={type:"childremoved",child:null};class kt extends Ui{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:MO++}),this.uuid=ei(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=kt.DEFAULT_UP.clone();const e=new k,t=new ai,s=new Fi,i=new k(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 wt},normalMatrix:{value:new st}}),this.matrix=new wt,this.matrixWorld=new wt,this.matrixAutoUpdate=kt.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=kt.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new Hu,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 Qi.setFromAxisAngle(e,t),this.quaternion.multiply(Qi),this}rotateOnWorldAxis(e,t){return Qi.setFromAxisAngle(e,t),this.quaternion.premultiply(Qi),this}rotateX(e){return this.rotateOnAxis(Nf,e)}rotateY(e){return this.rotateOnAxis(Bf,e)}rotateZ(e){return this.rotateOnAxis(Cf,e)}translateOnAxis(e,t){return Rf.copy(e).applyQuaternion(this.quaternion),this.position.add(Rf.multiplyScalar(t)),this}translateX(e){return this.translateOnAxis(Nf,e)}translateY(e){return this.translateOnAxis(Bf,e)}translateZ(e){return this.translateOnAxis(Cf,e)}localToWorld(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(this.matrixWorld)}worldToLocal(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(un.copy(this.matrixWorld).invert())}lookAt(e,t,s){e.isVector3?La.copy(e):La.set(e,t,s);const i=this.parent;this.updateWorldMatrix(!0,!1),Hr.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?un.lookAt(Hr,La,this.up):un.lookAt(La,Hr,this.up),this.quaternion.setFromRotationMatrix(un),i&&(un.extractRotation(i.matrixWorld),Qi.setFromRotationMatrix(un),this.quaternion.premultiply(Qi.invert()))}add(e){if(arguments.length>1){for(let t=0;t<arguments.length;t++)this.add(arguments[t]);return this}return e===this?(pt("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(Pf),Ji.child=e,this.dispatchEvent(Ji),Ji.child=null):pt("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(zO),ec.child=e,this.dispatchEvent(ec),ec.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),un.copy(this.matrixWorld).invert(),e.parent!==null&&(e.parent.updateWorldMatrix(!0,!1),un.multiply(e.parent.matrixWorld)),e.applyMatrix4(un),e.removeFromParent(),e.parent=this,this.children.push(e),e.updateWorldMatrix(!1,!0),e.dispatchEvent(Pf),Ji.child=e,this.dispatchEvent(Ji),Ji.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(Hr,e,bO),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Hr,_O,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),p=a(e.animations),f=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),p.length>0&&(s.animations=p),f.length>0&&(s.nodes=f)}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}}kt.DEFAULT_UP=new k(0,1,0);kt.DEFAULT_MATRIX_AUTO_UPDATE=!0;kt.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;class ha extends kt{constructor(){super(),this.isGroup=!0,this.type="Group"}}const wO={type:"move"};class tc{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new ha,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 ha,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new k,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new k),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new ha,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new k,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new k,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 M of e.hand.values()){const g=t.getJointPose(M,s),m=this._getHandJoint(c,M);g!==null&&(m.matrix.fromArray(g.transform.matrix),m.matrix.decompose(m.position,m.rotation,m.scale),m.matrixWorldNeedsUpdate=!0,m.jointRadius=g.radius),m.visible=g!==null}const d=c.joints["index-finger-tip"],u=c.joints["thumb-tip"],h=d.position.distanceTo(u.position),p=.02,f=.005;c.inputState.pinching&&h>p+f?(c.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!c.inputState.pinching&&h<=p-f&&(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(wO)))}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 ha;s.matrixAutoUpdate=!1,s.visible=!1,e.joints[t.jointName]=s,e.add(s)}return e.joints[t.jointName]}}const Qg={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},Wn={h:0,s:0,l:0},Wa={h:0,s:0,l:0};function sc(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=Is){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,mt.colorSpaceToWorking(this,t),this}setRGB(e,t,s,i=mt.workingColorSpace){return this.r=e,this.g=t,this.b=s,mt.colorSpaceToWorking(this,i),this}setHSL(e,t,s,i=mt.workingColorSpace){if(e=lO(e,1),t=gt(t,0,1),s=gt(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=sc(a,r,e+1/3),this.g=sc(a,r,e),this.b=sc(a,r,e-1/3)}return mt.colorSpaceToWorking(this,i),this}setStyle(e,t=Is){function s(r){r!==void 0&&parseFloat(r)<1&&He("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:He("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);He("Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,t);return this}setColorName(e,t=Is){const s=Qg[e.toLowerCase()];return s!==void 0?this.setHex(s,t):He("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=En(e.r),this.g=En(e.g),this.b=En(e.b),this}copyLinearToSRGB(e){return this.r=vr(e.r),this.g=vr(e.g),this.b=vr(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=Is){return mt.workingToColorSpace(rs.copy(this),e),Math.round(gt(rs.r*255,0,255))*65536+Math.round(gt(rs.g*255,0,255))*256+Math.round(gt(rs.b*255,0,255))}getHexString(e=Is){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=mt.workingColorSpace){mt.workingToColorSpace(rs.copy(this),t);const s=rs.r,i=rs.g,r=rs.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=mt.workingColorSpace){return mt.workingToColorSpace(rs.copy(this),t),e.r=rs.r,e.g=rs.g,e.b=rs.b,e}getStyle(e=Is){mt.workingToColorSpace(rs.copy(this),e);const t=rs.r,s=rs.g,i=rs.b;return e!==Is?`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(Wn),this.setHSL(Wn.h+e,Wn.s+t,Wn.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(Wn),e.getHSL(Wa);const s=Kl(Wn.h,Wa.h,t),i=Kl(Wn.s,Wa.s,t),r=Kl(Wn.l,Wa.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 rs=new ke;ke.NAMES=Qg;class yO extends kt{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 ai,this.environmentIntensity=1,this.environmentRotation=new ai,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 Ls=new k,hn=new k,nc=new k,fn=new k,er=new k,tr=new k,Lf=new k,ic=new k,rc=new k,ac=new k,oc=new Wt,lc=new Wt,cc=new Wt;class Bs{constructor(e=new k,t=new k,s=new k){this.a=e,this.b=t,this.c=s}static getNormal(e,t,s,i){i.subVectors(s,t),Ls.subVectors(e,t),i.cross(Ls);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){Ls.subVectors(i,t),hn.subVectors(s,t),nc.subVectors(e,t);const a=Ls.dot(Ls),o=Ls.dot(hn),l=Ls.dot(nc),c=hn.dot(hn),d=hn.dot(nc),u=a*c-o*o;if(u===0)return r.set(0,0,0),null;const h=1/u,p=(c*l-o*d)*h,f=(a*d-o*l)*h;return r.set(1-p-f,f,p)}static containsPoint(e,t,s,i){return this.getBarycoord(e,t,s,i,fn)===null?!1:fn.x>=0&&fn.y>=0&&fn.x+fn.y<=1}static getInterpolation(e,t,s,i,r,a,o,l){return this.getBarycoord(e,t,s,i,fn)===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,fn.x),l.addScaledVector(a,fn.y),l.addScaledVector(o,fn.z),l)}static getInterpolatedAttribute(e,t,s,i,r,a){return oc.setScalar(0),lc.setScalar(0),cc.setScalar(0),oc.fromBufferAttribute(e,t),lc.fromBufferAttribute(e,s),cc.fromBufferAttribute(e,i),a.setScalar(0),a.addScaledVector(oc,r.x),a.addScaledVector(lc,r.y),a.addScaledVector(cc,r.z),a}static isFrontFacing(e,t,s,i){return Ls.subVectors(s,t),hn.subVectors(e,t),Ls.cross(hn).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 Ls.subVectors(this.c,this.b),hn.subVectors(this.a,this.b),Ls.cross(hn).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return Bs.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return Bs.getBarycoord(e,this.a,this.b,this.c,t)}getInterpolation(e,t,s,i,r){return Bs.getInterpolation(e,this.a,this.b,this.c,t,s,i,r)}containsPoint(e){return Bs.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return Bs.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;er.subVectors(i,s),tr.subVectors(r,s),ic.subVectors(e,s);const l=er.dot(ic),c=tr.dot(ic);if(l<=0&&c<=0)return t.copy(s);rc.subVectors(e,i);const d=er.dot(rc),u=tr.dot(rc);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(er,a);ac.subVectors(e,r);const p=er.dot(ac),f=tr.dot(ac);if(f>=0&&p<=f)return t.copy(r);const M=p*c-l*f;if(M<=0&&c>=0&&f<=0)return o=c/(c-f),t.copy(s).addScaledVector(tr,o);const g=d*f-p*u;if(g<=0&&u-d>=0&&p-f>=0)return Lf.subVectors(r,i),o=(u-d)/(u-d+(p-f)),t.copy(i).addScaledVector(Lf,o);const m=1/(g+M+h);return a=M*m,o=h*m,t.copy(s).addScaledVector(er,a).addScaledVector(tr,o)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}class ji{constructor(e=new k(1/0,1/0,1/0),t=new k(-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(Ws.fromArray(e,t));return this}setFromBufferAttribute(e){this.makeEmpty();for(let t=0,s=e.count;t<s;t++)this.expandByPoint(Ws.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=Ws.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,Ws):Ws.fromBufferAttribute(r,a),Ws.applyMatrix4(e.matrixWorld),this.expandByPoint(Ws);else e.boundingBox!==void 0?(e.boundingBox===null&&e.computeBoundingBox(),ka.copy(e.boundingBox)):(s.boundingBox===null&&s.computeBoundingBox(),ka.copy(s.boundingBox)),ka.applyMatrix4(e.matrixWorld),this.union(ka)}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,Ws),Ws.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(qr),Ua.subVectors(this.max,qr),sr.subVectors(e.a,qr),nr.subVectors(e.b,qr),ir.subVectors(e.c,qr),kn.subVectors(nr,sr),Un.subVectors(ir,nr),ui.subVectors(sr,ir);let t=[0,-kn.z,kn.y,0,-Un.z,Un.y,0,-ui.z,ui.y,kn.z,0,-kn.x,Un.z,0,-Un.x,ui.z,0,-ui.x,-kn.y,kn.x,0,-Un.y,Un.x,0,-ui.y,ui.x,0];return!dc(t,sr,nr,ir,Ua)||(t=[1,0,0,0,1,0,0,0,1],!dc(t,sr,nr,ir,Ua))?!1:(Fa.crossVectors(kn,Un),t=[Fa.x,Fa.y,Fa.z],dc(t,sr,nr,ir,Ua))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,Ws).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(Ws).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 k,new k,new k,new k,new k,new k,new k,new k],Ws=new k,ka=new ji,sr=new k,nr=new k,ir=new k,kn=new k,Un=new k,ui=new k,qr=new k,Ua=new k,Fa=new k,hi=new k;function dc(n,e,t,s,i){for(let r=0,a=n.length-3;r<=a;r+=3){hi.fromArray(n,r);const o=i.x*Math.abs(hi.x)+i.y*Math.abs(hi.y)+i.z*Math.abs(hi.z),l=e.dot(hi),c=t.dot(hi),d=s.dot(hi);if(Math.max(-Math.max(l,c,d),Math.min(l,c,d))>o)return!1}return!0}const Vt=new k,ja=new et;let vO=0;class ts extends Ui{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:vO++}),this.name="",this.array=e,this.itemSize=t,this.count=e!==void 0?e.length/t:0,this.normalized=s,this.usage=Zd,this.updateRanges=[],this.gpuType=$s,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++)ja.fromBufferAttribute(this,t),ja.applyMatrix3(e),this.setXY(t,ja.x,ja.y);else if(this.itemSize===3)for(let t=0,s=this.count;t<s;t++)Vt.fromBufferAttribute(this,t),Vt.applyMatrix3(e),this.setXYZ(t,Vt.x,Vt.y,Vt.z);return this}applyMatrix4(e){for(let t=0,s=this.count;t<s;t++)Vt.fromBufferAttribute(this,t),Vt.applyMatrix4(e),this.setXYZ(t,Vt.x,Vt.y,Vt.z);return this}applyNormalMatrix(e){for(let t=0,s=this.count;t<s;t++)Vt.fromBufferAttribute(this,t),Vt.applyNormalMatrix(e),this.setXYZ(t,Vt.x,Vt.y,Vt.z);return this}transformDirection(e){for(let t=0,s=this.count;t<s;t++)Vt.fromBufferAttribute(this,t),Vt.transformDirection(e),this.setXYZ(t,Vt.x,Vt.y,Vt.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=en(s,this.array)),s}setComponent(e,t,s){return this.normalized&&(s=Dt(s,this.array)),this.array[e*this.itemSize+t]=s,this}getX(e){let t=this.array[e*this.itemSize];return this.normalized&&(t=en(t,this.array)),t}setX(e,t){return this.normalized&&(t=Dt(t,this.array)),this.array[e*this.itemSize]=t,this}getY(e){let t=this.array[e*this.itemSize+1];return this.normalized&&(t=en(t,this.array)),t}setY(e,t){return this.normalized&&(t=Dt(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=en(t,this.array)),t}setZ(e,t){return this.normalized&&(t=Dt(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=en(t,this.array)),t}setW(e,t){return this.normalized&&(t=Dt(t,this.array)),this.array[e*this.itemSize+3]=t,this}setXY(e,t,s){return e*=this.itemSize,this.normalized&&(t=Dt(t,this.array),s=Dt(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=Dt(t,this.array),s=Dt(s,this.array),i=Dt(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=Dt(t,this.array),s=Dt(s,this.array),i=Dt(i,this.array),r=Dt(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!==Zd&&(e.usage=this.usage),e}dispose(){this.dispatchEvent({type:"dispose"})}}class Jg extends ts{constructor(e,t,s){super(new Uint16Array(e),t,s)}}class eM extends ts{constructor(e,t,s){super(new Uint32Array(e),t,s)}}class Ot extends ts{constructor(e,t,s){super(new Float32Array(e),t,s)}}const OO=new ji,Xr=new k,uc=new k;class $i{constructor(e=new k,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):OO.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;Xr.subVectors(e,this.center);const t=Xr.lengthSq();if(t>this.radius*this.radius){const s=Math.sqrt(t),i=(s-this.radius)*.5;this.center.addScaledVector(Xr,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):(uc.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(Xr.copy(e.center).add(uc)),this.expandByPoint(Xr.copy(e.center).sub(uc))),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 xO=0;const As=new wt,hc=new kt,rr=new k,ys=new ji,Kr=new ji,Qt=new k;class qt extends Ui{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:xO++}),this.uuid=ei(),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(iO(e)?eM:Jg)(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 st().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 As.makeRotationFromQuaternion(e),this.applyMatrix4(As),this}rotateX(e){return As.makeRotationX(e),this.applyMatrix4(As),this}rotateY(e){return As.makeRotationY(e),this.applyMatrix4(As),this}rotateZ(e){return As.makeRotationZ(e),this.applyMatrix4(As),this}translate(e,t,s){return As.makeTranslation(e,t,s),this.applyMatrix4(As),this}scale(e,t,s){return As.makeScale(e,t,s),this.applyMatrix4(As),this}lookAt(e){return hc.lookAt(e),hc.updateMatrix(),this.applyMatrix4(hc.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(rr).negate(),this.translate(rr.x,rr.y,rr.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 Ot(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&&He("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 ji);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){pt("BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),this.boundingBox.set(new k(-1/0,-1/0,-1/0),new k(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];ys.setFromBufferAttribute(r),this.morphTargetsRelative?(Qt.addVectors(this.boundingBox.min,ys.min),this.boundingBox.expandByPoint(Qt),Qt.addVectors(this.boundingBox.max,ys.max),this.boundingBox.expandByPoint(Qt)):(this.boundingBox.expandByPoint(ys.min),this.boundingBox.expandByPoint(ys.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&pt('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 $i);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){pt("BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere.",this),this.boundingSphere.set(new k,1/0);return}if(e){const s=this.boundingSphere.center;if(ys.setFromBufferAttribute(e),t)for(let r=0,a=t.length;r<a;r++){const o=t[r];Kr.setFromBufferAttribute(o),this.morphTargetsRelative?(Qt.addVectors(ys.min,Kr.min),ys.expandByPoint(Qt),Qt.addVectors(ys.max,Kr.max),ys.expandByPoint(Qt)):(ys.expandByPoint(Kr.min),ys.expandByPoint(Kr.max))}ys.getCenter(s);let i=0;for(let r=0,a=e.count;r<a;r++)Qt.fromBufferAttribute(e,r),i=Math.max(i,s.distanceToSquared(Qt));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++)Qt.fromBufferAttribute(o,c),l&&(rr.fromBufferAttribute(e,c),Qt.add(rr)),i=Math.max(i,s.distanceToSquared(Qt))}this.boundingSphere.radius=Math.sqrt(i),isNaN(this.boundingSphere.radius)&&pt('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){pt("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 ts(new Float32Array(4*s.count),4),this.setAttribute("tangent",a));const o=[],l=[];for(let b=0;b<s.count;b++)o[b]=new k,l[b]=new k;const c=new k,d=new k,u=new k,h=new et,p=new et,f=new et,M=new k,g=new k;function m(b,v,E){c.fromBufferAttribute(s,b),d.fromBufferAttribute(s,v),u.fromBufferAttribute(s,E),h.fromBufferAttribute(r,b),p.fromBufferAttribute(r,v),f.fromBufferAttribute(r,E),d.sub(c),u.sub(c),p.sub(h),f.sub(h);const A=1/(p.x*f.y-f.x*p.y);isFinite(A)&&(M.copy(d).multiplyScalar(f.y).addScaledVector(u,-p.y).multiplyScalar(A),g.copy(u).multiplyScalar(p.x).addScaledVector(d,-f.x).multiplyScalar(A),o[b].add(M),o[v].add(M),o[E].add(M),l[b].add(g),l[v].add(g),l[E].add(g))}let _=this.groups;_.length===0&&(_=[{start:0,count:e.count}]);for(let b=0,v=_.length;b<v;++b){const E=_[b],A=E.start,I=E.count;for(let G=A,C=A+I;G<C;G+=3)m(e.getX(G+0),e.getX(G+1),e.getX(G+2))}const w=new k,z=new k,y=new k,O=new k;function S(b){y.fromBufferAttribute(i,b),O.copy(y);const v=o[b];w.copy(v),w.sub(y.multiplyScalar(y.dot(v))).normalize(),z.crossVectors(O,v);const A=z.dot(l[b])<0?-1:1;a.setXYZW(b,w.x,w.y,w.z,A)}for(let b=0,v=_.length;b<v;++b){const E=_[b],A=E.start,I=E.count;for(let G=A,C=A+I;G<C;G+=3)S(e.getX(G+0)),S(e.getX(G+1)),S(e.getX(G+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 ts(new Float32Array(t.count*3),3),this.setAttribute("normal",s);else for(let h=0,p=s.count;h<p;h++)s.setXYZ(h,0,0,0);const i=new k,r=new k,a=new k,o=new k,l=new k,c=new k,d=new k,u=new k;if(e)for(let h=0,p=e.count;h<p;h+=3){const f=e.getX(h+0),M=e.getX(h+1),g=e.getX(h+2);i.fromBufferAttribute(t,f),r.fromBufferAttribute(t,M),a.fromBufferAttribute(t,g),d.subVectors(a,r),u.subVectors(i,r),d.cross(u),o.fromBufferAttribute(s,f),l.fromBufferAttribute(s,M),c.fromBufferAttribute(s,g),o.add(d),l.add(d),c.add(d),s.setXYZ(f,o.x,o.y,o.z),s.setXYZ(M,l.x,l.y,l.z),s.setXYZ(g,c.x,c.y,c.z)}else for(let h=0,p=t.count;h<p;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++)Qt.fromBufferAttribute(e,t),Qt.normalize(),e.setXYZ(t,Qt.x,Qt.y,Qt.z)}toNonIndexed(){function e(o,l){const c=o.array,d=o.itemSize,u=o.normalized,h=new c.constructor(l.length*d);let p=0,f=0;for(let M=0,g=l.length;M<g;M++){o.isInterleavedBufferAttribute?p=l[M]*o.data.stride+o.offset:p=l[M]*d;for(let m=0;m<d;m++)h[f++]=c[p++]}return new ts(h,d,u)}if(this.index===null)return He("BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;const t=new qt,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],p=e(h,s);l.push(p)}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 p=c[u];d.push(p.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,p=u.length;h<p;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 SO{constructor(e,t){this.isInterleavedBuffer=!0,this.array=e,this.stride=t,this.count=e!==void 0?e.length/t:0,this.usage=Zd,this.updateRanges=[],this.version=0,this.uuid=ei()}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=ei()),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=ei()),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 cs=new k;class nl{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++)cs.fromBufferAttribute(this,t),cs.applyMatrix4(e),this.setXYZ(t,cs.x,cs.y,cs.z);return this}applyNormalMatrix(e){for(let t=0,s=this.count;t<s;t++)cs.fromBufferAttribute(this,t),cs.applyNormalMatrix(e),this.setXYZ(t,cs.x,cs.y,cs.z);return this}transformDirection(e){for(let t=0,s=this.count;t<s;t++)cs.fromBufferAttribute(this,t),cs.transformDirection(e),this.setXYZ(t,cs.x,cs.y,cs.z);return this}getComponent(e,t){let s=this.array[e*this.data.stride+this.offset+t];return this.normalized&&(s=en(s,this.array)),s}setComponent(e,t,s){return this.normalized&&(s=Dt(s,this.array)),this.data.array[e*this.data.stride+this.offset+t]=s,this}setX(e,t){return this.normalized&&(t=Dt(t,this.array)),this.data.array[e*this.data.stride+this.offset]=t,this}setY(e,t){return this.normalized&&(t=Dt(t,this.array)),this.data.array[e*this.data.stride+this.offset+1]=t,this}setZ(e,t){return this.normalized&&(t=Dt(t,this.array)),this.data.array[e*this.data.stride+this.offset+2]=t,this}setW(e,t){return this.normalized&&(t=Dt(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=en(t,this.array)),t}getY(e){let t=this.data.array[e*this.data.stride+this.offset+1];return this.normalized&&(t=en(t,this.array)),t}getZ(e){let t=this.data.array[e*this.data.stride+this.offset+2];return this.normalized&&(t=en(t,this.array)),t}getW(e){let t=this.data.array[e*this.data.stride+this.offset+3];return this.normalized&&(t=en(t,this.array)),t}setXY(e,t,s){return e=e*this.data.stride+this.offset,this.normalized&&(t=Dt(t,this.array),s=Dt(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=Dt(t,this.array),s=Dt(s,this.array),i=Dt(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=Dt(t,this.array),s=Dt(s,this.array),i=Dt(i,this.array),r=Dt(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){sl("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 ts(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 nl(e.interleavedBuffers[this.data.uuid],this.itemSize,this.offset,this.normalized)}toJSON(e){if(e===void 0){sl("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 EO=0;class In extends Ui{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:EO++}),this.uuid=ei(),this.name="",this.type="Material",this.blending=Ei,this.side=ri,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=cd,this.blendDst=dd,this.blendEquation=_i,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new ke(0,0,0),this.blendAlpha=0,this.depthFunc=Ir,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=xf,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=Ki,this.stencilZFail=Ki,this.stencilZPass=Ki,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){He(`Material: parameter '${t}' has value of undefined.`);continue}const i=this[t];if(i===void 0){He(`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!==Ei&&(s.blending=this.blending),this.side!==ri&&(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!==cd&&(s.blendSrc=this.blendSrc),this.blendDst!==dd&&(s.blendDst=this.blendDst),this.blendEquation!==_i&&(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!==Ir&&(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!==xf&&(s.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(s.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(s.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==Ki&&(s.stencilFail=this.stencilFail),this.stencilZFail!==Ki&&(s.stencilZFail=this.stencilZFail),this.stencilZPass!==Ki&&(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 et().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 et().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 wl extends In{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 ar;const Yr=new k,or=new k,lr=new k,cr=new et,Zr=new et,tM=new wt,$a=new k,Qr=new k,Va=new k,Wf=new et,fc=new et,kf=new et;class qu extends kt{constructor(e=new wl){if(super(),this.isSprite=!0,this.type="Sprite",ar===void 0){ar=new qt;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 SO(t,5);ar.setIndex([0,1,2,0,2,3]),ar.setAttribute("position",new nl(s,3,0,!1)),ar.setAttribute("uv",new nl(s,2,3,!1))}this.geometry=ar,this.material=e,this.center=new et(.5,.5),this.count=1}raycast(e,t){e.camera===null&&pt('Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.'),or.setFromMatrixScale(this.matrixWorld),tM.copy(e.camera.matrixWorld),this.modelViewMatrix.multiplyMatrices(e.camera.matrixWorldInverse,this.matrixWorld),lr.setFromMatrixPosition(this.modelViewMatrix),e.camera.isPerspectiveCamera&&this.material.sizeAttenuation===!1&&or.multiplyScalar(-lr.z);const s=this.material.rotation;let i,r;s!==0&&(r=Math.cos(s),i=Math.sin(s));const a=this.center;Ha($a.set(-.5,-.5,0),lr,a,or,i,r),Ha(Qr.set(.5,-.5,0),lr,a,or,i,r),Ha(Va.set(.5,.5,0),lr,a,or,i,r),Wf.set(0,0),fc.set(1,0),kf.set(1,1);let o=e.ray.intersectTriangle($a,Qr,Va,!1,Yr);if(o===null&&(Ha(Qr.set(-.5,.5,0),lr,a,or,i,r),fc.set(0,1),o=e.ray.intersectTriangle($a,Va,Qr,!1,Yr),o===null))return;const l=e.ray.origin.distanceTo(Yr);l<e.near||l>e.far||t.push({distance:l,point:Yr.clone(),uv:Bs.getInterpolation(Yr,$a,Qr,Va,Wf,fc,kf,new et),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 Ha(n,e,t,s,i,r){cr.subVectors(n,t).addScalar(.5).multiply(s),i!==void 0?(Zr.x=r*cr.x-i*cr.y,Zr.y=i*cr.x+r*cr.y):Zr.copy(cr),n.copy(e),n.x+=Zr.x,n.y+=Zr.y,n.applyMatrix4(tM)}const mn=new k,pc=new k,qa=new k,Fn=new k,mc=new k,Xa=new k,gc=new k;class yl{constructor(e=new k,t=new k(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,mn)),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=mn.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(mn.copy(this.origin).addScaledVector(this.direction,t),mn.distanceToSquared(e))}distanceSqToSegment(e,t,s,i){pc.copy(e).add(t).multiplyScalar(.5),qa.copy(t).sub(e).normalize(),Fn.copy(this.origin).sub(pc);const r=e.distanceTo(t)*.5,a=-this.direction.dot(qa),o=Fn.dot(this.direction),l=-Fn.dot(qa),c=Fn.lengthSq(),d=Math.abs(1-a*a);let u,h,p,f;if(d>0)if(u=a*l-o,h=a*o-l,f=r*d,u>=0)if(h>=-f)if(h<=f){const M=1/d;u*=M,h*=M,p=u*(u+a*h+2*o)+h*(a*u+h+2*l)+c}else h=r,u=Math.max(0,-(a*h+o)),p=-u*u+h*(h+2*l)+c;else h=-r,u=Math.max(0,-(a*h+o)),p=-u*u+h*(h+2*l)+c;else h<=-f?(u=Math.max(0,-(-a*r+o)),h=u>0?-r:Math.min(Math.max(-r,-l),r),p=-u*u+h*(h+2*l)+c):h<=f?(u=0,h=Math.min(Math.max(-r,-l),r),p=h*(h+2*l)+c):(u=Math.max(0,-(a*r+o)),h=u>0?r:Math.min(Math.max(-r,-l),r),p=-u*u+h*(h+2*l)+c);else h=a>0?-r:r,u=Math.max(0,-(a*h+o)),p=-u*u+h*(h+2*l)+c;return s&&s.copy(this.origin).addScaledVector(this.direction,u),i&&i.copy(pc).addScaledVector(qa,h),p}intersectSphere(e,t){mn.subVectors(e.center,this.origin);const s=mn.dot(this.direction),i=mn.dot(mn)-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,mn)!==null}intersectTriangle(e,t,s,i,r){mc.subVectors(t,e),Xa.subVectors(s,e),gc.crossVectors(mc,Xa);let a=this.direction.dot(gc),o;if(a>0){if(i)return null;o=1}else if(a<0)o=-1,a=-a;else return null;Fn.subVectors(this.origin,e);const l=o*this.direction.dot(Xa.crossVectors(Fn,Xa));if(l<0)return null;const c=o*this.direction.dot(mc.cross(Fn));if(c<0||l+c>a)return null;const d=-o*Fn.dot(gc);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 Xu extends In{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 ai,this.combine=Bg,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 Uf=new wt,fi=new yl,Ka=new $i,Ff=new k,Ya=new k,Za=new k,Qa=new k,Mc=new k,Ja=new k,jf=new k,eo=new k;class Ms extends kt{constructor(e=new qt,t=new Xu){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){Ja.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?Ja.addScaledVector(Mc,d):Ja.addScaledVector(Mc.sub(t),d))}t.add(Ja)}return t}raycast(e,t){const s=this.geometry,i=this.material,r=this.matrixWorld;i!==void 0&&(s.boundingSphere===null&&s.computeBoundingSphere(),Ka.copy(s.boundingSphere),Ka.applyMatrix4(r),fi.copy(e.ray).recast(e.near),!(Ka.containsPoint(fi.origin)===!1&&(fi.intersectSphere(Ka,Ff)===null||fi.origin.distanceToSquared(Ff)>(e.far-e.near)**2))&&(Uf.copy(r).invert(),fi.copy(e.ray).applyMatrix4(Uf),!(s.boundingBox!==null&&fi.intersectsBox(s.boundingBox)===!1)&&this._computeIntersections(e,t,fi)))}_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,p=r.drawRange;if(o!==null)if(Array.isArray(a))for(let f=0,M=h.length;f<M;f++){const g=h[f],m=a[g.materialIndex],_=Math.max(g.start,p.start),w=Math.min(o.count,Math.min(g.start+g.count,p.start+p.count));for(let z=_,y=w;z<y;z+=3){const O=o.getX(z),S=o.getX(z+1),b=o.getX(z+2);i=to(this,m,e,s,c,d,u,O,S,b),i&&(i.faceIndex=Math.floor(z/3),i.face.materialIndex=g.materialIndex,t.push(i))}}else{const f=Math.max(0,p.start),M=Math.min(o.count,p.start+p.count);for(let g=f,m=M;g<m;g+=3){const _=o.getX(g),w=o.getX(g+1),z=o.getX(g+2);i=to(this,a,e,s,c,d,u,_,w,z),i&&(i.faceIndex=Math.floor(g/3),t.push(i))}}else if(l!==void 0)if(Array.isArray(a))for(let f=0,M=h.length;f<M;f++){const g=h[f],m=a[g.materialIndex],_=Math.max(g.start,p.start),w=Math.min(l.count,Math.min(g.start+g.count,p.start+p.count));for(let z=_,y=w;z<y;z+=3){const O=z,S=z+1,b=z+2;i=to(this,m,e,s,c,d,u,O,S,b),i&&(i.faceIndex=Math.floor(z/3),i.face.materialIndex=g.materialIndex,t.push(i))}}else{const f=Math.max(0,p.start),M=Math.min(l.count,p.start+p.count);for(let g=f,m=M;g<m;g+=3){const _=g,w=g+1,z=g+2;i=to(this,a,e,s,c,d,u,_,w,z),i&&(i.faceIndex=Math.floor(g/3),t.push(i))}}}}function AO(n,e,t,s,i,r,a,o){let l;if(e.side===gs?l=s.intersectTriangle(a,r,i,!0,o):l=s.intersectTriangle(i,r,a,e.side===ri,o),l===null)return null;eo.copy(o),eo.applyMatrix4(n.matrixWorld);const c=t.ray.origin.distanceTo(eo);return c<t.near||c>t.far?null:{distance:c,point:eo.clone(),object:n}}function to(n,e,t,s,i,r,a,o,l,c){n.getVertexPosition(o,Ya),n.getVertexPosition(l,Za),n.getVertexPosition(c,Qa);const d=AO(n,e,t,s,Ya,Za,Qa,jf);if(d){const u=new k;Bs.getBarycoord(jf,Ya,Za,Qa,u),i&&(d.uv=Bs.getInterpolatedAttribute(i,o,l,c,u,new et)),r&&(d.uv1=Bs.getInterpolatedAttribute(r,o,l,c,u,new et)),a&&(d.normal=Bs.getInterpolatedAttribute(a,o,l,c,u,new k),d.normal.dot(s.direction)>0&&d.normal.multiplyScalar(-1));const h={a:o,b:l,c,normal:new k,materialIndex:0};Bs.getNormal(Ya,Za,Qa,h.normal),d.face=h,d.barycoord=u}return d}class sM extends ls{constructor(e=null,t=1,s=1,i,r,a,o,l,c=ss,d=ss,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 ti extends ts{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 dr=new wt,$f=new wt,so=[],Vf=new ji,DO=new wt,Jr=new Ms,ea=new $i;class Ku extends Ms{constructor(e,t,s){super(e,t),this.isInstancedMesh=!0,this.instanceMatrix=new ti(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,DO)}computeBoundingBox(){const e=this.geometry,t=this.count;this.boundingBox===null&&(this.boundingBox=new ji),e.boundingBox===null&&e.computeBoundingBox(),this.boundingBox.makeEmpty();for(let s=0;s<t;s++)this.getMatrixAt(s,dr),Vf.copy(e.boundingBox).applyMatrix4(dr),this.boundingBox.union(Vf)}computeBoundingSphere(){const e=this.geometry,t=this.count;this.boundingSphere===null&&(this.boundingSphere=new $i),e.boundingSphere===null&&e.computeBoundingSphere(),this.boundingSphere.makeEmpty();for(let s=0;s<t;s++)this.getMatrixAt(s,dr),ea.copy(e.boundingSphere).applyMatrix4(dr),this.boundingSphere.union(ea)}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(Jr.geometry=this.geometry,Jr.material=this.material,Jr.material!==void 0&&(this.boundingSphere===null&&this.computeBoundingSphere(),ea.copy(this.boundingSphere),ea.applyMatrix4(s),e.ray.intersectsSphere(ea)!==!1))for(let r=0;r<i;r++){this.getMatrixAt(r,dr),$f.multiplyMatrices(s,dr),Jr.matrixWorld=$f,Jr.raycast(e,so);for(let a=0,o=so.length;a<o;a++){const l=so[a];l.instanceId=r,l.object=this,t.push(l)}so.length=0}}setColorAt(e,t){return this.instanceColor===null&&(this.instanceColor=new ti(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 sM(new Float32Array(i*this.count),i,this.count,Wu,$s));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 bc=new k,TO=new k,IO=new st;class Vn{constructor(e=new k(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=bc.subVectors(s,t).cross(TO.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(bc),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||IO.getNormalMatrix(e),i=this.coplanarPoint(bc).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 pi=new $i,GO=new et(.5,.5),no=new k;class Yu{constructor(e=new Vn,t=new Vn,s=new Vn,i=new Vn,r=new Vn,a=new Vn){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=tn,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],p=r[7],f=r[8],M=r[9],g=r[10],m=r[11],_=r[12],w=r[13],z=r[14],y=r[15];if(i[0].setComponents(c-a,p-d,m-f,y-_).normalize(),i[1].setComponents(c+a,p+d,m+f,y+_).normalize(),i[2].setComponents(c+o,p+u,m+M,y+w).normalize(),i[3].setComponents(c-o,p-u,m-M,y-w).normalize(),s)i[4].setComponents(l,h,g,z).normalize(),i[5].setComponents(c-l,p-h,m-g,y-z).normalize();else if(i[4].setComponents(c-l,p-h,m-g,y-z).normalize(),t===tn)i[5].setComponents(c+l,p+h,m+g,y+z).normalize();else if(t===Oa)i[5].setComponents(l,h,g,z).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(),pi.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{const t=e.geometry;t.boundingSphere===null&&t.computeBoundingSphere(),pi.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(pi)}intersectsSprite(e){pi.center.set(0,0,0);const t=GO.distanceTo(e.center);return pi.radius=.7071067811865476+t,pi.applyMatrix4(e.matrixWorld),this.intersectsSphere(pi)}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(no.x=i.normal.x>0?e.max.x:e.min.x,no.y=i.normal.y>0?e.max.y:e.min.y,no.z=i.normal.z>0?e.max.z:e.min.z,i.distanceToPoint(no)<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 vl extends In{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 il=new k,rl=new k,Hf=new wt,ta=new yl,io=new $i,_c=new k,qf=new k;class Jd extends kt{constructor(e=new qt,t=new vl){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++)il.fromBufferAttribute(t,i-1),rl.fromBufferAttribute(t,i),s[i]=s[i-1],s[i]+=il.distanceTo(rl);e.setAttribute("lineDistance",new Ot(s,1))}else He("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(),io.copy(s.boundingSphere),io.applyMatrix4(i),io.radius+=r,e.ray.intersectsSphere(io)===!1)return;Hf.copy(i).invert(),ta.copy(e.ray).applyMatrix4(Hf);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 p=Math.max(0,a.start),f=Math.min(d.count,a.start+a.count);for(let M=p,g=f-1;M<g;M+=c){const m=d.getX(M),_=d.getX(M+1),w=ro(this,e,ta,l,m,_,M);w&&t.push(w)}if(this.isLineLoop){const M=d.getX(f-1),g=d.getX(p),m=ro(this,e,ta,l,M,g,f-1);m&&t.push(m)}}else{const p=Math.max(0,a.start),f=Math.min(h.count,a.start+a.count);for(let M=p,g=f-1;M<g;M+=c){const m=ro(this,e,ta,l,M,M+1,M);m&&t.push(m)}if(this.isLineLoop){const M=ro(this,e,ta,l,f-1,p,f-1);M&&t.push(M)}}}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 ro(n,e,t,s,i,r,a){const o=n.geometry.attributes.position;if(il.fromBufferAttribute(o,i),rl.fromBufferAttribute(o,r),t.distanceSqToSegment(il,rl,_c,qf)>s)return;_c.applyMatrix4(n.matrixWorld);const c=e.ray.origin.distanceTo(_c);if(!(c<e.near||c>e.far))return{distance:c,point:qf.clone().applyMatrix4(n.matrixWorld),index:a,face:null,faceIndex:null,barycoord:null,object:n}}const Xf=new k,Kf=new k;class eu extends Jd{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)Xf.fromBufferAttribute(t,i),Kf.fromBufferAttribute(t,i+1),s[i]=i===0?0:s[i-1],s[i+1]=s[i]+Xf.distanceTo(Kf);e.setAttribute("lineDistance",new Ot(s,1))}else He("LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}}class RO extends In{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 Yf=new wt,tu=new yl,ao=new $i,oo=new k;class NO extends kt{constructor(e=new qt,t=new RO){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(),ao.copy(s.boundingSphere),ao.applyMatrix4(i),ao.radius+=r,e.ray.intersectsSphere(ao)===!1)return;Yf.copy(i).invert(),tu.copy(e.ray).applyMatrix4(Yf);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),p=Math.min(c.count,a.start+a.count);for(let f=h,M=p;f<M;f++){const g=c.getX(f);oo.fromBufferAttribute(u,g),Zf(oo,g,l,i,e,t,this)}}else{const h=Math.max(0,a.start),p=Math.min(u.count,a.start+a.count);for(let f=h,M=p;f<M;f++)oo.fromBufferAttribute(u,f),Zf(oo,f,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 Zf(n,e,t,s,i,r,a){const o=tu.distanceSqToPoint(n);if(o<t){const l=new k;tu.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 nM extends ls{constructor(e=[],t=Li,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 iM extends ls{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 Rr extends ls{constructor(e,t,s=on,i,r,a,o=ss,l=ss,c,d=Tn,u=1){if(d!==Tn&&d!==vi)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 BO extends Rr{constructor(e,t=on,s=Li,i,r,a=ss,o=ss,l,c=Tn){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 rM extends ls{constructor(e=null){super(),this.sourceTexture=e,this.isExternalTexture=!0}copy(e){return super.copy(e),this.sourceTexture=e.sourceTexture,this}}class Ea extends qt{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,p=0;f("z","y","x",-1,-1,s,t,e,a,r,0),f("z","y","x",1,-1,s,t,-e,a,r,1),f("x","z","y",1,1,e,s,t,i,a,2),f("x","z","y",1,-1,e,s,-t,i,a,3),f("x","y","z",1,-1,e,t,s,i,r,4),f("x","y","z",-1,-1,e,t,-s,i,r,5),this.setIndex(l),this.setAttribute("position",new Ot(c,3)),this.setAttribute("normal",new Ot(d,3)),this.setAttribute("uv",new Ot(u,2));function f(M,g,m,_,w,z,y,O,S,b,v){const E=z/S,A=y/b,I=z/2,G=y/2,C=O/2,B=S+1,P=b+1;let W=0,H=0;const X=new k;for(let oe=0;oe<P;oe++){const J=oe*A-G;for(let ce=0;ce<B;ce++){const We=ce*E-I;X[M]=We*_,X[g]=J*w,X[m]=C,c.push(X.x,X.y,X.z),X[M]=0,X[g]=0,X[m]=O>0?1:-1,d.push(X.x,X.y,X.z),u.push(ce/S),u.push(1-oe/b),W+=1}}for(let oe=0;oe<b;oe++)for(let J=0;J<S;J++){const ce=h+J+B*oe,We=h+J+B*(oe+1),qe=h+(J+1)+B*(oe+1),Pe=h+(J+1)+B*oe;l.push(ce,We,Pe),l.push(We,qe,Pe),H+=6}o.addGroup(p,H,v),p+=H,h+=W}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Ea(e.width,e.height,e.depth,e.widthSegments,e.heightSegments,e.depthSegments)}}class Zu extends qt{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 k,d=new et;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 p=s+u/t*i;c.x=e*Math.cos(p),c.y=e*Math.sin(p),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 Ot(a,3)),this.setAttribute("normal",new Ot(o,3)),this.setAttribute("uv",new Ot(l,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Zu(e.radius,e.segments,e.thetaStart,e.thetaLength)}}class Qu extends qt{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=[],p=[];let f=0;const M=[],g=s/2;let m=0;_(),a===!1&&(e>0&&w(!0),t>0&&w(!1)),this.setIndex(d),this.setAttribute("position",new Ot(u,3)),this.setAttribute("normal",new Ot(h,3)),this.setAttribute("uv",new Ot(p,2));function _(){const z=new k,y=new k;let O=0;const S=(t-e)/s;for(let b=0;b<=r;b++){const v=[],E=b/r,A=E*(t-e)+e;for(let I=0;I<=i;I++){const G=I/i,C=G*l+o,B=Math.sin(C),P=Math.cos(C);y.x=A*B,y.y=-E*s+g,y.z=A*P,u.push(y.x,y.y,y.z),z.set(B,S,P).normalize(),h.push(z.x,z.y,z.z),p.push(G,1-E),v.push(f++)}M.push(v)}for(let b=0;b<i;b++)for(let v=0;v<r;v++){const E=M[v][b],A=M[v+1][b],I=M[v+1][b+1],G=M[v][b+1];(e>0||v!==0)&&(d.push(E,A,G),O+=3),(t>0||v!==r-1)&&(d.push(A,I,G),O+=3)}c.addGroup(m,O,0),m+=O}function w(z){const y=f,O=new et,S=new k;let b=0;const v=z===!0?e:t,E=z===!0?1:-1;for(let I=1;I<=i;I++)u.push(0,g*E,0),h.push(0,E,0),p.push(.5,.5),f++;const A=f;for(let I=0;I<=i;I++){const C=I/i*l+o,B=Math.cos(C),P=Math.sin(C);S.x=v*P,S.y=g*E,S.z=v*B,u.push(S.x,S.y,S.z),h.push(0,E,0),O.x=B*.5+.5,O.y=P*.5*E+.5,p.push(O.x,O.y),f++}for(let I=0;I<i;I++){const G=y+I,C=A+I;z===!0?d.push(C,C+1,G):d.push(C+1,C,G),b+=3}c.addGroup(m,b,z===!0?1:2),m+=b}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Qu(e.radiusTop,e.radiusBottom,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}}class Ju extends qt{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 Ot(r,3)),this.setAttribute("normal",new Ot(r.slice(),3)),this.setAttribute("uv",new Ot(a,2)),i===0?this.computeVertexNormals():this.normalizeNormals();function o(_){const w=new k,z=new k,y=new k;for(let O=0;O<t.length;O+=3)p(t[O+0],w),p(t[O+1],z),p(t[O+2],y),l(w,z,y,_)}function l(_,w,z,y){const O=y+1,S=[];for(let b=0;b<=O;b++){S[b]=[];const v=_.clone().lerp(z,b/O),E=w.clone().lerp(z,b/O),A=O-b;for(let I=0;I<=A;I++)I===0&&b===O?S[b][I]=v:S[b][I]=v.clone().lerp(E,I/A)}for(let b=0;b<O;b++)for(let v=0;v<2*(O-b)-1;v++){const E=Math.floor(v/2);v%2===0?(h(S[b][E+1]),h(S[b+1][E]),h(S[b][E])):(h(S[b][E+1]),h(S[b+1][E+1]),h(S[b+1][E]))}}function c(_){const w=new k;for(let z=0;z<r.length;z+=3)w.x=r[z+0],w.y=r[z+1],w.z=r[z+2],w.normalize().multiplyScalar(_),r[z+0]=w.x,r[z+1]=w.y,r[z+2]=w.z}function d(){const _=new k;for(let w=0;w<r.length;w+=3){_.x=r[w+0],_.y=r[w+1],_.z=r[w+2];const z=g(_)/2/Math.PI+.5,y=m(_)/Math.PI+.5;a.push(z,1-y)}f(),u()}function u(){for(let _=0;_<a.length;_+=6){const w=a[_+0],z=a[_+2],y=a[_+4],O=Math.max(w,z,y),S=Math.min(w,z,y);O>.9&&S<.1&&(w<.2&&(a[_+0]+=1),z<.2&&(a[_+2]+=1),y<.2&&(a[_+4]+=1))}}function h(_){r.push(_.x,_.y,_.z)}function p(_,w){const z=_*3;w.x=e[z+0],w.y=e[z+1],w.z=e[z+2]}function f(){const _=new k,w=new k,z=new k,y=new k,O=new et,S=new et,b=new et;for(let v=0,E=0;v<r.length;v+=9,E+=6){_.set(r[v+0],r[v+1],r[v+2]),w.set(r[v+3],r[v+4],r[v+5]),z.set(r[v+6],r[v+7],r[v+8]),O.set(a[E+0],a[E+1]),S.set(a[E+2],a[E+3]),b.set(a[E+4],a[E+5]),y.copy(_).add(w).add(z).divideScalar(3);const A=g(y);M(O,E+0,_,A),M(S,E+2,w,A),M(b,E+4,z,A)}}function M(_,w,z,y){y<0&&_.x===1&&(a[w]=_.x-1),z.x===0&&z.z===0&&(a[w]=y/2/Math.PI+.5)}function g(_){return Math.atan2(_.z,-_.x)}function m(_){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 Ju(e.vertices,e.indices,e.radius,e.detail)}}class eh extends Ju{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 eh(e.radius,e.detail)}}class Ol extends qt{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,p=[],f=[],M=[],g=[];for(let m=0;m<d;m++){const _=m*h-a;for(let w=0;w<c;w++){const z=w*u-r;f.push(z,-_,0),M.push(0,0,1),g.push(w/o),g.push(1-m/l)}}for(let m=0;m<l;m++)for(let _=0;_<o;_++){const w=_+c*m,z=_+c*(m+1),y=_+1+c*(m+1),O=_+1+c*m;p.push(w,z,O),p.push(z,y,O)}this.setIndex(p),this.setAttribute("position",new Ot(f,3)),this.setAttribute("normal",new Ot(M,3)),this.setAttribute("uv",new Ot(g,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Ol(e.width,e.height,e.widthSegments,e.heightSegments)}}class xl extends qt{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 k,h=new k,p=[],f=[],M=[],g=[];for(let m=0;m<=s;m++){const _=[],w=m/s,z=a+w*o,y=e*Math.cos(z),O=Math.sqrt(e*e-y*y);let S=0;m===0&&a===0?S=.5/t:m===s&&l===Math.PI&&(S=-.5/t);for(let b=0;b<=t;b++){const v=b/t,E=i+v*r;u.x=-O*Math.cos(E),u.y=y,u.z=O*Math.sin(E),f.push(u.x,u.y,u.z),h.copy(u).normalize(),M.push(h.x,h.y,h.z),g.push(v+S,1-w),_.push(c++)}d.push(_)}for(let m=0;m<s;m++)for(let _=0;_<t;_++){const w=d[m][_+1],z=d[m][_],y=d[m+1][_],O=d[m+1][_+1];(m!==0||a>0)&&p.push(w,z,O),(m!==s-1||l<Math.PI)&&p.push(z,y,O)}this.setIndex(p),this.setAttribute("position",new Ot(f,3)),this.setAttribute("normal",new Ot(M,3)),this.setAttribute("uv",new Ot(g,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new xl(e.radius,e.widthSegments,e.heightSegments,e.phiStart,e.phiLength,e.thetaStart,e.thetaLength)}}function Nr(n){const e={};for(const t in n){e[t]={};for(const s in n[t]){const i=n[t][s];if(Qf(i))i.isRenderTargetTexture?(He("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(Qf(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 us(n){const e={};for(let t=0;t<n.length;t++){const s=Nr(n[t]);for(const i in s)e[i]=s[i]}return e}function Qf(n){return n&&(n.isColor||n.isMatrix3||n.isMatrix4||n.isVector2||n.isVector3||n.isVector4||n.isTexture||n.isQuaternion)}function CO(n){const e=[];for(let t=0;t<n.length;t++)e.push(n[t].clone());return e}function aM(n){const e=n.getRenderTarget();return e===null?n.outputColorSpace:e.isXRRenderTarget===!0?e.texture.colorSpace:mt.workingColorSpace}const PO={clone:Nr,merge:us};var LO=`void main() {
33
33
  gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
34
34
  }`,WO=`void main() {
35
35
  gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );
36
- }`;class jt extends In{constructor(e){super(),this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader=LO,this.fragmentShader=WO,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=Nr(e.uniforms),this.uniformsGroups=CO(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 et().fromArray(i.value);break;case"v3":this.uniforms[s].value=new W().fromArray(i.value);break;case"v4":this.uniforms[s].value=new Wt().fromArray(i.value);break;case"m3":this.uniforms[s].value=new st().fromArray(i.value);break;case"m4":this.uniforms[s].value=new wt().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 kO extends jt{constructor(e){super(e),this.isRawShaderMaterial=!0,this.type="RawShaderMaterial"}}class Ai extends In{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=Yd,this.normalScale=new et(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 ai,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 UO extends In{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=Yv,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 FO extends In{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 jO extends vl{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 oM extends kt{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 zc=new wt,Jf=new W,ep=new W;class $O{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 et(512,512),this.mapType=Ss,this.map=null,this.mapPass=null,this.matrix=new wt,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new Yu,this._frameExtents=new et(1,1),this._viewportCount=1,this._viewports=[new Wt(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(e){const t=this.camera,s=this.matrix;Jf.setFromMatrixPosition(e.matrixWorld),t.position.copy(Jf),ep.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(ep),t.updateMatrixWorld(),zc.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this._frustum.setFromProjectionMatrix(zc,t.coordinateSystem,t.reversedDepth),t.coordinateSystem===Oa||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(zc)}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 lo=new W,co=new Fi,Xs=new W;class lM extends kt{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new wt,this.projectionMatrix=new wt,this.projectionMatrixInverse=new wt,this.coordinateSystem=tn,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(lo,co,Xs),Xs.x===1&&Xs.y===1&&Xs.z===1?this.matrixWorldInverse.copy(this.matrixWorld).invert():this.matrixWorldInverse.compose(lo,co,Xs.set(1,1,1)).invert()}updateWorldMatrix(e,t,s=!1){super.updateWorldMatrix(e,t,s),this.matrixWorld.decompose(lo,co,Xs),Xs.x===1&&Xs.y===1&&Xs.z===1?this.matrixWorldInverse.copy(this.matrixWorld).invert():this.matrixWorldInverse.compose(lo,co,Xs.set(1,1,1)).invert()}clone(){return new this.constructor().copy(this)}}const jn=new W,tp=new et,sp=new et;class Rs extends lM{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=Qd*2*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){const e=Math.tan(Xl*.5*this.fov);return .5*this.getFilmHeight()/e}getEffectiveFOV(){return Qd*2*Math.atan(Math.tan(Xl*.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){jn.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),t.set(jn.x,jn.y).multiplyScalar(-e/jn.z),jn.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),s.set(jn.x,jn.y).multiplyScalar(-e/jn.z)}getViewSize(e,t){return this.getViewBounds(e,tp,sp),t.subVectors(sp,tp)}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(Xl*.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 th extends lM{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 VO extends $O{constructor(){super(new th(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}}class HO extends oM{constructor(e,t){super(e,t),this.isDirectionalLight=!0,this.type="DirectionalLight",this.position.copy(kt.DEFAULT_UP),this.updateMatrix(),this.target=new kt,this.shadow=new VO}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 qO extends oM{constructor(e,t){super(e,t),this.isAmbientLight=!0,this.type="AmbientLight"}}const ur=-90,hr=1;class XO extends kt{constructor(e,t,s){super(),this.type="CubeCamera",this.renderTarget=s,this.coordinateSystem=null,this.activeMipmapLevel=0;const i=new Rs(ur,hr,e,t);i.layers=this.layers,this.add(i);const r=new Rs(ur,hr,e,t);r.layers=this.layers,this.add(r);const a=new Rs(ur,hr,e,t);a.layers=this.layers,this.add(a);const o=new Rs(ur,hr,e,t);o.layers=this.layers,this.add(o);const l=new Rs(ur,hr,e,t);l.layers=this.layers,this.add(l);const c=new Rs(ur,hr,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===tn)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===Oa)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(),p=e.getActiveMipmapLevel(),f=e.xr.enabled;e.xr.enabled=!1;const M=s.texture.generateMipmaps;s.texture.generateMipmaps=!1;let g=!1;e.isWebGLRenderer===!0?g=e.state.buffers.depth.getReversed():g=e.reversedDepthBuffer,e.setRenderTarget(s,0,i),g&&e.autoClear===!1&&e.clearDepth(),e.render(t,r),e.setRenderTarget(s,1,i),g&&e.autoClear===!1&&e.clearDepth(),e.render(t,a),e.setRenderTarget(s,2,i),g&&e.autoClear===!1&&e.clearDepth(),e.render(t,o),e.setRenderTarget(s,3,i),g&&e.autoClear===!1&&e.clearDepth(),e.render(t,l),e.setRenderTarget(s,4,i),g&&e.autoClear===!1&&e.clearDepth(),e.render(t,c),s.texture.generateMipmaps=M,e.setRenderTarget(s,5,i),g&&e.autoClear===!1&&e.clearDepth(),e.render(t,d),e.setRenderTarget(u,h,p),e.xr.enabled=f,s.texture.needsPMREMUpdate=!0}}class KO extends Rs{constructor(e=[]){super(),this.isArrayCamera=!0,this.isMultiViewCamera=!1,this.cameras=e}}const np=new wt;class YO{constructor(e,t,s=0,i=1/0){this.ray=new yl(e,t),this.near=s,this.far=i,this.camera=null,this.layers=new Hu,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):pt("Raycaster: Unsupported camera type: "+t.type)}setFromXRController(e){return np.identity().extractRotation(e.matrixWorld),this.ray.origin.setFromMatrixPosition(e.matrixWorld),this.ray.direction.set(0,0,-1).applyMatrix4(np),this}intersectObject(e,t=!0,s=[]){return su(e,this,s,t),s.sort(ip),s}intersectObjects(e,t=!0,s=[]){for(let i=0,r=e.length;i<r;i++)su(e[i],this,s,t);return s.sort(ip),s}}function ip(n,e){return n.distance-e.distance}function su(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++)su(r[a],e,t,!0)}}const fh=class fh{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}};fh.prototype.isMatrix2=!0;let rp=fh;function ap(n,e,t,s){const i=ZO(s);switch(t){case Xg:return n*e;case Wu:return n*e/i.components*i.byteLength;case ku:return n*e/i.components*i.byteLength;case Wi:return n*e*2/i.components*i.byteLength;case Uu:return n*e*2/i.components*i.byteLength;case Kg:return n*e*3/i.components*i.byteLength;case Vs:return n*e*4/i.components*i.byteLength;case Fu:return n*e*4/i.components*i.byteLength;case xo:case So:return Math.floor((n+3)/4)*Math.floor((e+3)/4)*8;case Eo:case Ao:return Math.floor((n+3)/4)*Math.floor((e+3)/4)*16;case wd:case vd:return Math.max(n,16)*Math.max(e,8)/4;case zd:case yd:return Math.max(n,8)*Math.max(e,8)/2;case Od:case xd:case Ed:case Ad:return Math.floor((n+3)/4)*Math.floor((e+3)/4)*8;case Sd:case Zo:case Dd:return Math.floor((n+3)/4)*Math.floor((e+3)/4)*16;case Td:return Math.floor((n+3)/4)*Math.floor((e+3)/4)*16;case Id:return Math.floor((n+4)/5)*Math.floor((e+3)/4)*16;case Gd:return Math.floor((n+4)/5)*Math.floor((e+4)/5)*16;case Rd:return Math.floor((n+5)/6)*Math.floor((e+4)/5)*16;case Nd:return Math.floor((n+5)/6)*Math.floor((e+5)/6)*16;case Bd:return Math.floor((n+7)/8)*Math.floor((e+4)/5)*16;case Cd:return Math.floor((n+7)/8)*Math.floor((e+5)/6)*16;case Pd:return Math.floor((n+7)/8)*Math.floor((e+7)/8)*16;case Ld:return Math.floor((n+9)/10)*Math.floor((e+4)/5)*16;case Wd:return Math.floor((n+9)/10)*Math.floor((e+5)/6)*16;case kd:return Math.floor((n+9)/10)*Math.floor((e+7)/8)*16;case Ud:return Math.floor((n+9)/10)*Math.floor((e+9)/10)*16;case Fd:return Math.floor((n+11)/12)*Math.floor((e+9)/10)*16;case jd:return Math.floor((n+11)/12)*Math.floor((e+11)/12)*16;case $d:case Vd:case Hd:return Math.ceil(n/4)*Math.ceil(e/4)*16;case qd:case Xd:return Math.ceil(n/4)*Math.ceil(e/4)*8;case Qo:case Kd:return Math.ceil(n/4)*Math.ceil(e/4)*16}throw new Error(`Unable to determine texture byte length for ${t} format.`)}function ZO(n){switch(n){case Ss:case $g:return{byteLength:1,components:1};case ya:case Vg:case Dn:return{byteLength:2,components:1};case Pu:case Lu:return{byteLength:2,components:4};case on:case Cu:case $s:return{byteLength:4,components:1};case Hg:case qg: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:Bu}}));typeof window<"u"&&(window.__THREE__?He("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=Bu);function cM(){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 QO(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 p;if(c instanceof Float32Array)p=n.FLOAT;else if(typeof Float16Array<"u"&&c instanceof Float16Array)p=n.HALF_FLOAT;else if(c instanceof Uint16Array)o.isFloat16BufferAttribute?p=n.HALF_FLOAT:p=n.UNSIGNED_SHORT;else if(c instanceof Int16Array)p=n.SHORT;else if(c instanceof Uint32Array)p=n.UNSIGNED_INT;else if(c instanceof Int32Array)p=n.INT;else if(c instanceof Int8Array)p=n.BYTE;else if(c instanceof Uint8Array)p=n.UNSIGNED_BYTE;else if(c instanceof Uint8ClampedArray)p=n.UNSIGNED_BYTE;else throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+c);return{buffer:h,type:p,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((p,f)=>p.start-f.start);let h=0;for(let p=1;p<u.length;p++){const f=u[h],M=u[p];M.start<=f.start+f.count+1?f.count=Math.max(f.count,M.start+M.count-f.start):(++h,u[h]=M)}u.length=h+1;for(let p=0,f=u.length;p<f;p++){const M=u[p];n.bufferSubData(c,M.start*d.BYTES_PER_ELEMENT,d,M.start,M.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 JO=`#ifdef USE_ALPHAHASH
36
+ }`;class jt extends In{constructor(e){super(),this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader=LO,this.fragmentShader=WO,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=Nr(e.uniforms),this.uniformsGroups=CO(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 et().fromArray(i.value);break;case"v3":this.uniforms[s].value=new k().fromArray(i.value);break;case"v4":this.uniforms[s].value=new Wt().fromArray(i.value);break;case"m3":this.uniforms[s].value=new st().fromArray(i.value);break;case"m4":this.uniforms[s].value=new wt().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 kO extends jt{constructor(e){super(e),this.isRawShaderMaterial=!0,this.type="RawShaderMaterial"}}class Ai extends In{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=Yd,this.normalScale=new et(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 ai,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 UO extends In{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=Yv,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 FO extends In{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 jO extends vl{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 oM extends kt{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 zc=new wt,Jf=new k,ep=new k;class $O{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 et(512,512),this.mapType=Ss,this.map=null,this.mapPass=null,this.matrix=new wt,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new Yu,this._frameExtents=new et(1,1),this._viewportCount=1,this._viewports=[new Wt(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(e){const t=this.camera,s=this.matrix;Jf.setFromMatrixPosition(e.matrixWorld),t.position.copy(Jf),ep.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(ep),t.updateMatrixWorld(),zc.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this._frustum.setFromProjectionMatrix(zc,t.coordinateSystem,t.reversedDepth),t.coordinateSystem===Oa||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(zc)}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 lo=new k,co=new Fi,Xs=new k;class lM extends kt{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new wt,this.projectionMatrix=new wt,this.projectionMatrixInverse=new wt,this.coordinateSystem=tn,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(lo,co,Xs),Xs.x===1&&Xs.y===1&&Xs.z===1?this.matrixWorldInverse.copy(this.matrixWorld).invert():this.matrixWorldInverse.compose(lo,co,Xs.set(1,1,1)).invert()}updateWorldMatrix(e,t,s=!1){super.updateWorldMatrix(e,t,s),this.matrixWorld.decompose(lo,co,Xs),Xs.x===1&&Xs.y===1&&Xs.z===1?this.matrixWorldInverse.copy(this.matrixWorld).invert():this.matrixWorldInverse.compose(lo,co,Xs.set(1,1,1)).invert()}clone(){return new this.constructor().copy(this)}}const jn=new k,tp=new et,sp=new et;class Rs extends lM{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=Qd*2*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){const e=Math.tan(Xl*.5*this.fov);return .5*this.getFilmHeight()/e}getEffectiveFOV(){return Qd*2*Math.atan(Math.tan(Xl*.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){jn.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),t.set(jn.x,jn.y).multiplyScalar(-e/jn.z),jn.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),s.set(jn.x,jn.y).multiplyScalar(-e/jn.z)}getViewSize(e,t){return this.getViewBounds(e,tp,sp),t.subVectors(sp,tp)}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(Xl*.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 th extends lM{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 VO extends $O{constructor(){super(new th(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}}class HO extends oM{constructor(e,t){super(e,t),this.isDirectionalLight=!0,this.type="DirectionalLight",this.position.copy(kt.DEFAULT_UP),this.updateMatrix(),this.target=new kt,this.shadow=new VO}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 qO extends oM{constructor(e,t){super(e,t),this.isAmbientLight=!0,this.type="AmbientLight"}}const ur=-90,hr=1;class XO extends kt{constructor(e,t,s){super(),this.type="CubeCamera",this.renderTarget=s,this.coordinateSystem=null,this.activeMipmapLevel=0;const i=new Rs(ur,hr,e,t);i.layers=this.layers,this.add(i);const r=new Rs(ur,hr,e,t);r.layers=this.layers,this.add(r);const a=new Rs(ur,hr,e,t);a.layers=this.layers,this.add(a);const o=new Rs(ur,hr,e,t);o.layers=this.layers,this.add(o);const l=new Rs(ur,hr,e,t);l.layers=this.layers,this.add(l);const c=new Rs(ur,hr,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===tn)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===Oa)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(),p=e.getActiveMipmapLevel(),f=e.xr.enabled;e.xr.enabled=!1;const M=s.texture.generateMipmaps;s.texture.generateMipmaps=!1;let g=!1;e.isWebGLRenderer===!0?g=e.state.buffers.depth.getReversed():g=e.reversedDepthBuffer,e.setRenderTarget(s,0,i),g&&e.autoClear===!1&&e.clearDepth(),e.render(t,r),e.setRenderTarget(s,1,i),g&&e.autoClear===!1&&e.clearDepth(),e.render(t,a),e.setRenderTarget(s,2,i),g&&e.autoClear===!1&&e.clearDepth(),e.render(t,o),e.setRenderTarget(s,3,i),g&&e.autoClear===!1&&e.clearDepth(),e.render(t,l),e.setRenderTarget(s,4,i),g&&e.autoClear===!1&&e.clearDepth(),e.render(t,c),s.texture.generateMipmaps=M,e.setRenderTarget(s,5,i),g&&e.autoClear===!1&&e.clearDepth(),e.render(t,d),e.setRenderTarget(u,h,p),e.xr.enabled=f,s.texture.needsPMREMUpdate=!0}}class KO extends Rs{constructor(e=[]){super(),this.isArrayCamera=!0,this.isMultiViewCamera=!1,this.cameras=e}}const np=new wt;class YO{constructor(e,t,s=0,i=1/0){this.ray=new yl(e,t),this.near=s,this.far=i,this.camera=null,this.layers=new Hu,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):pt("Raycaster: Unsupported camera type: "+t.type)}setFromXRController(e){return np.identity().extractRotation(e.matrixWorld),this.ray.origin.setFromMatrixPosition(e.matrixWorld),this.ray.direction.set(0,0,-1).applyMatrix4(np),this}intersectObject(e,t=!0,s=[]){return su(e,this,s,t),s.sort(ip),s}intersectObjects(e,t=!0,s=[]){for(let i=0,r=e.length;i<r;i++)su(e[i],this,s,t);return s.sort(ip),s}}function ip(n,e){return n.distance-e.distance}function su(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++)su(r[a],e,t,!0)}}const fh=class fh{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}};fh.prototype.isMatrix2=!0;let rp=fh;function ap(n,e,t,s){const i=ZO(s);switch(t){case Xg:return n*e;case Wu:return n*e/i.components*i.byteLength;case ku:return n*e/i.components*i.byteLength;case Wi:return n*e*2/i.components*i.byteLength;case Uu:return n*e*2/i.components*i.byteLength;case Kg:return n*e*3/i.components*i.byteLength;case Vs:return n*e*4/i.components*i.byteLength;case Fu:return n*e*4/i.components*i.byteLength;case xo:case So:return Math.floor((n+3)/4)*Math.floor((e+3)/4)*8;case Eo:case Ao:return Math.floor((n+3)/4)*Math.floor((e+3)/4)*16;case wd:case vd:return Math.max(n,16)*Math.max(e,8)/4;case zd:case yd:return Math.max(n,8)*Math.max(e,8)/2;case Od:case xd:case Ed:case Ad:return Math.floor((n+3)/4)*Math.floor((e+3)/4)*8;case Sd:case Zo:case Dd:return Math.floor((n+3)/4)*Math.floor((e+3)/4)*16;case Td:return Math.floor((n+3)/4)*Math.floor((e+3)/4)*16;case Id:return Math.floor((n+4)/5)*Math.floor((e+3)/4)*16;case Gd:return Math.floor((n+4)/5)*Math.floor((e+4)/5)*16;case Rd:return Math.floor((n+5)/6)*Math.floor((e+4)/5)*16;case Nd:return Math.floor((n+5)/6)*Math.floor((e+5)/6)*16;case Bd:return Math.floor((n+7)/8)*Math.floor((e+4)/5)*16;case Cd:return Math.floor((n+7)/8)*Math.floor((e+5)/6)*16;case Pd:return Math.floor((n+7)/8)*Math.floor((e+7)/8)*16;case Ld:return Math.floor((n+9)/10)*Math.floor((e+4)/5)*16;case Wd:return Math.floor((n+9)/10)*Math.floor((e+5)/6)*16;case kd:return Math.floor((n+9)/10)*Math.floor((e+7)/8)*16;case Ud:return Math.floor((n+9)/10)*Math.floor((e+9)/10)*16;case Fd:return Math.floor((n+11)/12)*Math.floor((e+9)/10)*16;case jd:return Math.floor((n+11)/12)*Math.floor((e+11)/12)*16;case $d:case Vd:case Hd:return Math.ceil(n/4)*Math.ceil(e/4)*16;case qd:case Xd:return Math.ceil(n/4)*Math.ceil(e/4)*8;case Qo:case Kd:return Math.ceil(n/4)*Math.ceil(e/4)*16}throw new Error(`Unable to determine texture byte length for ${t} format.`)}function ZO(n){switch(n){case Ss:case $g:return{byteLength:1,components:1};case ya:case Vg:case Dn:return{byteLength:2,components:1};case Pu:case Lu:return{byteLength:2,components:4};case on:case Cu:case $s:return{byteLength:4,components:1};case Hg:case qg: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:Bu}}));typeof window<"u"&&(window.__THREE__?He("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=Bu);function cM(){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 QO(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 p;if(c instanceof Float32Array)p=n.FLOAT;else if(typeof Float16Array<"u"&&c instanceof Float16Array)p=n.HALF_FLOAT;else if(c instanceof Uint16Array)o.isFloat16BufferAttribute?p=n.HALF_FLOAT:p=n.UNSIGNED_SHORT;else if(c instanceof Int16Array)p=n.SHORT;else if(c instanceof Uint32Array)p=n.UNSIGNED_INT;else if(c instanceof Int32Array)p=n.INT;else if(c instanceof Int8Array)p=n.BYTE;else if(c instanceof Uint8Array)p=n.UNSIGNED_BYTE;else if(c instanceof Uint8ClampedArray)p=n.UNSIGNED_BYTE;else throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+c);return{buffer:h,type:p,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((p,f)=>p.start-f.start);let h=0;for(let p=1;p<u.length;p++){const f=u[h],M=u[p];M.start<=f.start+f.count+1?f.count=Math.max(f.count,M.start+M.count-f.start):(++h,u[h]=M)}u.length=h+1;for(let p=0,f=u.length;p<f;p++){const M=u[p];n.bufferSubData(c,M.start*d.BYTES_PER_ELEMENT,d,M.start,M.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 JO=`#ifdef USE_ALPHAHASH
37
37
  if ( diffuseColor.a < getAlphaHashThreshold( vPosition ) ) discard;
38
38
  #endif`,ex=`#ifdef USE_ALPHAHASH
39
39
  const float ALPHA_HASH_SCALE = 0.05;
@@ -3699,7 +3699,7 @@ void main() {
3699
3699
  #include <tonemapping_fragment>
3700
3700
  #include <colorspace_fragment>
3701
3701
  #include <fog_fragment>
3702
- }`,at={alphahash_fragment:JO,alphahash_pars_fragment:ex,alphamap_fragment:tx,alphamap_pars_fragment:sx,alphatest_fragment:nx,alphatest_pars_fragment:ix,aomap_fragment:rx,aomap_pars_fragment:ax,batching_pars_vertex:ox,batching_vertex:lx,begin_vertex:cx,beginnormal_vertex:dx,bsdfs:ux,iridescence_fragment:hx,bumpmap_pars_fragment:fx,clipping_planes_fragment:px,clipping_planes_pars_fragment:mx,clipping_planes_pars_vertex:gx,clipping_planes_vertex:Mx,color_fragment:bx,color_pars_fragment:_x,color_pars_vertex:zx,color_vertex:wx,common:yx,cube_uv_reflection_fragment:vx,defaultnormal_vertex:Ox,displacementmap_pars_vertex:xx,displacementmap_vertex:Sx,emissivemap_fragment:Ex,emissivemap_pars_fragment:Ax,colorspace_fragment:Dx,colorspace_pars_fragment:Tx,envmap_fragment:Ix,envmap_common_pars_fragment:Gx,envmap_pars_fragment:Rx,envmap_pars_vertex:Nx,envmap_physical_pars_fragment:Vx,envmap_vertex:Bx,fog_vertex:Cx,fog_pars_vertex:Px,fog_fragment:Lx,fog_pars_fragment:Wx,gradientmap_pars_fragment:kx,lightmap_pars_fragment:Ux,lights_lambert_fragment:Fx,lights_lambert_pars_fragment:jx,lights_pars_begin:$x,lights_toon_fragment:Hx,lights_toon_pars_fragment:qx,lights_phong_fragment:Xx,lights_phong_pars_fragment:Kx,lights_physical_fragment:Yx,lights_physical_pars_fragment:Zx,lights_fragment_begin:Qx,lights_fragment_maps:Jx,lights_fragment_end:eS,lightprobes_pars_fragment:tS,logdepthbuf_fragment:sS,logdepthbuf_pars_fragment:nS,logdepthbuf_pars_vertex:iS,logdepthbuf_vertex:rS,map_fragment:aS,map_pars_fragment:oS,map_particle_fragment:lS,map_particle_pars_fragment:cS,metalnessmap_fragment:dS,metalnessmap_pars_fragment:uS,morphinstance_vertex:hS,morphcolor_vertex:fS,morphnormal_vertex:pS,morphtarget_pars_vertex:mS,morphtarget_vertex:gS,normal_fragment_begin:MS,normal_fragment_maps:bS,normal_pars_fragment:_S,normal_pars_vertex:zS,normal_vertex:wS,normalmap_pars_fragment:yS,clearcoat_normal_fragment_begin:vS,clearcoat_normal_fragment_maps:OS,clearcoat_pars_fragment:xS,iridescence_pars_fragment:SS,opaque_fragment:ES,packing:AS,premultiplied_alpha_fragment:DS,project_vertex:TS,dithering_fragment:IS,dithering_pars_fragment:GS,roughnessmap_fragment:RS,roughnessmap_pars_fragment:NS,shadowmap_pars_fragment:BS,shadowmap_pars_vertex:CS,shadowmap_vertex:PS,shadowmask_pars_fragment:LS,skinbase_vertex:WS,skinning_pars_vertex:kS,skinning_vertex:US,skinnormal_vertex:FS,specularmap_fragment:jS,specularmap_pars_fragment:$S,tonemapping_fragment:VS,tonemapping_pars_fragment:HS,transmission_fragment:qS,transmission_pars_fragment:XS,uv_pars_fragment:KS,uv_pars_vertex:YS,uv_vertex:ZS,worldpos_vertex:QS,background_vert:JS,background_frag:eE,backgroundCube_vert:tE,backgroundCube_frag:sE,cube_vert:nE,cube_frag:iE,depth_vert:rE,depth_frag:aE,distance_vert:oE,distance_frag:lE,equirect_vert:cE,equirect_frag:dE,linedashed_vert:uE,linedashed_frag:hE,meshbasic_vert:fE,meshbasic_frag:pE,meshlambert_vert:mE,meshlambert_frag:gE,meshmatcap_vert:ME,meshmatcap_frag:bE,meshnormal_vert:_E,meshnormal_frag:zE,meshphong_vert:wE,meshphong_frag:yE,meshphysical_vert:vE,meshphysical_frag:OE,meshtoon_vert:xE,meshtoon_frag:SE,points_vert:EE,points_frag:AE,shadow_vert:DE,shadow_frag:TE,sprite_vert:IE,sprite_frag:GE},Se={common:{diffuse:{value:new ke(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new st},alphaMap:{value:null},alphaMapTransform:{value:new st},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new st}},envmap:{envMap:{value:null},envMapRotation:{value:new st},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98},dfgLUT:{value:null}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new st}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new st}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new st},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new st},normalScale:{value:new et(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new st},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new st}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new st}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new st}},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 W},probesMax:{value:new W},probesResolution:{value:new W}},points:{diffuse:{value:new ke(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new st},alphaTest:{value:0},uvTransform:{value:new st}},sprite:{diffuse:{value:new ke(16777215)},opacity:{value:1},center:{value:new et(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new st},alphaMap:{value:null},alphaMapTransform:{value:new st},alphaTest:{value:0}}},Qs={basic:{uniforms:us([Se.common,Se.specularmap,Se.envmap,Se.aomap,Se.lightmap,Se.fog]),vertexShader:at.meshbasic_vert,fragmentShader:at.meshbasic_frag},lambert:{uniforms:us([Se.common,Se.specularmap,Se.envmap,Se.aomap,Se.lightmap,Se.emissivemap,Se.bumpmap,Se.normalmap,Se.displacementmap,Se.fog,Se.lights,{emissive:{value:new ke(0)},envMapIntensity:{value:1}}]),vertexShader:at.meshlambert_vert,fragmentShader:at.meshlambert_frag},phong:{uniforms:us([Se.common,Se.specularmap,Se.envmap,Se.aomap,Se.lightmap,Se.emissivemap,Se.bumpmap,Se.normalmap,Se.displacementmap,Se.fog,Se.lights,{emissive:{value:new ke(0)},specular:{value:new ke(1118481)},shininess:{value:30},envMapIntensity:{value:1}}]),vertexShader:at.meshphong_vert,fragmentShader:at.meshphong_frag},standard:{uniforms:us([Se.common,Se.envmap,Se.aomap,Se.lightmap,Se.emissivemap,Se.bumpmap,Se.normalmap,Se.displacementmap,Se.roughnessmap,Se.metalnessmap,Se.fog,Se.lights,{emissive:{value:new ke(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:at.meshphysical_vert,fragmentShader:at.meshphysical_frag},toon:{uniforms:us([Se.common,Se.aomap,Se.lightmap,Se.emissivemap,Se.bumpmap,Se.normalmap,Se.displacementmap,Se.gradientmap,Se.fog,Se.lights,{emissive:{value:new ke(0)}}]),vertexShader:at.meshtoon_vert,fragmentShader:at.meshtoon_frag},matcap:{uniforms:us([Se.common,Se.bumpmap,Se.normalmap,Se.displacementmap,Se.fog,{matcap:{value:null}}]),vertexShader:at.meshmatcap_vert,fragmentShader:at.meshmatcap_frag},points:{uniforms:us([Se.points,Se.fog]),vertexShader:at.points_vert,fragmentShader:at.points_frag},dashed:{uniforms:us([Se.common,Se.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:at.linedashed_vert,fragmentShader:at.linedashed_frag},depth:{uniforms:us([Se.common,Se.displacementmap]),vertexShader:at.depth_vert,fragmentShader:at.depth_frag},normal:{uniforms:us([Se.common,Se.bumpmap,Se.normalmap,Se.displacementmap,{opacity:{value:1}}]),vertexShader:at.meshnormal_vert,fragmentShader:at.meshnormal_frag},sprite:{uniforms:us([Se.sprite,Se.fog]),vertexShader:at.sprite_vert,fragmentShader:at.sprite_frag},background:{uniforms:{uvTransform:{value:new st},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:at.background_vert,fragmentShader:at.background_frag},backgroundCube:{uniforms:{envMap:{value:null},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new st}},vertexShader:at.backgroundCube_vert,fragmentShader:at.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:at.cube_vert,fragmentShader:at.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:at.equirect_vert,fragmentShader:at.equirect_frag},distance:{uniforms:us([Se.common,Se.displacementmap,{referencePosition:{value:new W},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:at.distance_vert,fragmentShader:at.distance_frag},shadow:{uniforms:us([Se.lights,Se.fog,{color:{value:new ke(0)},opacity:{value:1}}]),vertexShader:at.shadow_vert,fragmentShader:at.shadow_frag}};Qs.physical={uniforms:us([Qs.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new st},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new st},clearcoatNormalScale:{value:new et(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new st},dispersion:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new st},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new st},sheen:{value:0},sheenColor:{value:new ke(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new st},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new st},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new st},transmissionSamplerSize:{value:new et},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new st},attenuationDistance:{value:0},attenuationColor:{value:new ke(0)},specularColor:{value:new ke(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new st},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new st},anisotropyVector:{value:new et},anisotropyMap:{value:null},anisotropyMapTransform:{value:new st}}]),vertexShader:at.meshphysical_vert,fragmentShader:at.meshphysical_frag};const uo={r:0,b:0,g:0},RE=new wt,dM=new st;dM.set(-1,0,0,0,1,0,0,0,1);function NE(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 p(_){let w=_.isScene===!0?_.background:null;if(w&&w.isTexture){const z=_.backgroundBlurriness>0;w=e.get(w,z)}return w}function f(_){let w=!1;const z=p(_);z===null?g(a,o):z&&z.isColor&&(g(z,1),w=!0);const y=n.xr.getEnvironmentBlendMode();y==="additive"?t.buffers.color.setClear(0,0,0,1,r):y==="alpha-blend"&&t.buffers.color.setClear(0,0,0,0,r),(n.autoClear||w)&&(t.buffers.depth.setTest(!0),t.buffers.depth.setMask(!0),t.buffers.color.setMask(!0),n.clear(n.autoClearColor,n.autoClearDepth,n.autoClearStencil))}function M(_,w){const z=p(w);z&&(z.isCubeTexture||z.mapping===zl)?(c===void 0&&(c=new Ms(new Ea(1,1,1),new jt({name:"BackgroundCubeMaterial",uniforms:Nr(Qs.backgroundCube.uniforms),vertexShader:Qs.backgroundCube.vertexShader,fragmentShader:Qs.backgroundCube.fragmentShader,side:gs,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),c.geometry.deleteAttribute("normal"),c.geometry.deleteAttribute("uv"),c.onBeforeRender=function(y,O,S){this.matrixWorld.copyPosition(S.matrixWorld)},Object.defineProperty(c.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),s.update(c)),c.material.uniforms.envMap.value=z,c.material.uniforms.backgroundBlurriness.value=w.backgroundBlurriness,c.material.uniforms.backgroundIntensity.value=w.backgroundIntensity,c.material.uniforms.backgroundRotation.value.setFromMatrix4(RE.makeRotationFromEuler(w.backgroundRotation)).transpose(),z.isCubeTexture&&z.isRenderTargetTexture===!1&&c.material.uniforms.backgroundRotation.value.premultiply(dM),c.material.toneMapped=mt.getTransfer(z.colorSpace)!==St,(d!==z||u!==z.version||h!==n.toneMapping)&&(c.material.needsUpdate=!0,d=z,u=z.version,h=n.toneMapping),c.layers.enableAll(),_.unshift(c,c.geometry,c.material,0,0,null)):z&&z.isTexture&&(l===void 0&&(l=new Ms(new Ol(2,2),new jt({name:"BackgroundMaterial",uniforms:Nr(Qs.background.uniforms),vertexShader:Qs.background.vertexShader,fragmentShader:Qs.background.fragmentShader,side:ri,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=z,l.material.uniforms.backgroundIntensity.value=w.backgroundIntensity,l.material.toneMapped=mt.getTransfer(z.colorSpace)!==St,z.matrixAutoUpdate===!0&&z.updateMatrix(),l.material.uniforms.uvTransform.value.copy(z.matrix),(d!==z||u!==z.version||h!==n.toneMapping)&&(l.material.needsUpdate=!0,d=z,u=z.version,h=n.toneMapping),l.layers.enableAll(),_.unshift(l,l.geometry,l.material,0,0,null))}function g(_,w){_.getRGB(uo,aM(n)),t.buffers.color.setClear(uo.r,uo.g,uo.b,w,r)}function m(){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(_,w=1){a.set(_),o=w,g(a,o)},getClearAlpha:function(){return o},setClearAlpha:function(_){o=_,g(a,o)},render:f,addToRenderList:M,dispose:m}}function BE(n,e){const t=n.getParameter(n.MAX_VERTEX_ATTRIBS),s={},i=h(null);let r=i,a=!1;function o(A,I,G,C,B){let P=!1;const L=u(A,C,G,I);r!==L&&(r=L,c(r.object)),P=p(A,C,G,B),P&&f(A,C,G,B),B!==null&&e.update(B,n.ELEMENT_ARRAY_BUFFER),(P||a)&&(a=!1,z(A,I,G,C),B!==null&&n.bindBuffer(n.ELEMENT_ARRAY_BUFFER,e.get(B).buffer))}function l(){return n.createVertexArray()}function c(A){return n.bindVertexArray(A)}function d(A){return n.deleteVertexArray(A)}function u(A,I,G,C){const B=C.wireframe===!0;let P=s[I.id];P===void 0&&(P={},s[I.id]=P);const L=A.isInstancedMesh===!0?A.id:0;let H=P[L];H===void 0&&(H={},P[L]=H);let X=H[G.id];X===void 0&&(X={},H[G.id]=X);let oe=X[B];return oe===void 0&&(oe=h(l()),X[B]=oe),oe}function h(A){const I=[],G=[],C=[];for(let B=0;B<t;B++)I[B]=0,G[B]=0,C[B]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:I,enabledAttributes:G,attributeDivisors:C,object:A,attributes:{},index:null}}function p(A,I,G,C){const B=r.attributes,P=I.attributes;let L=0;const H=G.getAttributes();for(const X in H)if(H[X].location>=0){const J=B[X];let ce=P[X];if(ce===void 0&&(X==="instanceMatrix"&&A.instanceMatrix&&(ce=A.instanceMatrix),X==="instanceColor"&&A.instanceColor&&(ce=A.instanceColor)),J===void 0||J.attribute!==ce||ce&&J.data!==ce.data)return!0;L++}return r.attributesNum!==L||r.index!==C}function f(A,I,G,C){const B={},P=I.attributes;let L=0;const H=G.getAttributes();for(const X in H)if(H[X].location>=0){let J=P[X];J===void 0&&(X==="instanceMatrix"&&A.instanceMatrix&&(J=A.instanceMatrix),X==="instanceColor"&&A.instanceColor&&(J=A.instanceColor));const ce={};ce.attribute=J,J&&J.data&&(ce.data=J.data),B[X]=ce,L++}r.attributes=B,r.attributesNum=L,r.index=C}function M(){const A=r.newAttributes;for(let I=0,G=A.length;I<G;I++)A[I]=0}function g(A){m(A,0)}function m(A,I){const G=r.newAttributes,C=r.enabledAttributes,B=r.attributeDivisors;G[A]=1,C[A]===0&&(n.enableVertexAttribArray(A),C[A]=1),B[A]!==I&&(n.vertexAttribDivisor(A,I),B[A]=I)}function _(){const A=r.newAttributes,I=r.enabledAttributes;for(let G=0,C=I.length;G<C;G++)I[G]!==A[G]&&(n.disableVertexAttribArray(G),I[G]=0)}function w(A,I,G,C,B,P,L){L===!0?n.vertexAttribIPointer(A,I,G,B,P):n.vertexAttribPointer(A,I,G,C,B,P)}function z(A,I,G,C){M();const B=C.attributes,P=G.getAttributes(),L=I.defaultAttributeValues;for(const H in P){const X=P[H];if(X.location>=0){let oe=B[H];if(oe===void 0&&(H==="instanceMatrix"&&A.instanceMatrix&&(oe=A.instanceMatrix),H==="instanceColor"&&A.instanceColor&&(oe=A.instanceColor)),oe!==void 0){const J=oe.normalized,ce=oe.itemSize,We=e.get(oe);if(We===void 0)continue;const qe=We.buffer,Pe=We.type,ne=We.bytesPerElement,ae=Pe===n.INT||Pe===n.UNSIGNED_INT||oe.gpuType===Cu;if(oe.isInterleavedBufferAttribute){const ue=oe.data,Xe=ue.stride,Ze=oe.offset;if(ue.isInstancedInterleavedBuffer){for(let Fe=0;Fe<X.locationSize;Fe++)m(X.location+Fe,ue.meshPerAttribute);A.isInstancedMesh!==!0&&C._maxInstanceCount===void 0&&(C._maxInstanceCount=ue.meshPerAttribute*ue.count)}else for(let Fe=0;Fe<X.locationSize;Fe++)g(X.location+Fe);n.bindBuffer(n.ARRAY_BUFFER,qe);for(let Fe=0;Fe<X.locationSize;Fe++)w(X.location+Fe,ce/X.locationSize,Pe,J,Xe*ne,(Ze+ce/X.locationSize*Fe)*ne,ae)}else{if(oe.isInstancedBufferAttribute){for(let ue=0;ue<X.locationSize;ue++)m(X.location+ue,oe.meshPerAttribute);A.isInstancedMesh!==!0&&C._maxInstanceCount===void 0&&(C._maxInstanceCount=oe.meshPerAttribute*oe.count)}else for(let ue=0;ue<X.locationSize;ue++)g(X.location+ue);n.bindBuffer(n.ARRAY_BUFFER,qe);for(let ue=0;ue<X.locationSize;ue++)w(X.location+ue,ce/X.locationSize,Pe,J,ce*ne,ce/X.locationSize*ue*ne,ae)}}else if(L!==void 0){const J=L[H];if(J!==void 0)switch(J.length){case 2:n.vertexAttrib2fv(X.location,J);break;case 3:n.vertexAttrib3fv(X.location,J);break;case 4:n.vertexAttrib4fv(X.location,J);break;default:n.vertexAttrib1fv(X.location,J)}}}}_()}function y(){v();for(const A in s){const I=s[A];for(const G in I){const C=I[G];for(const B in C){const P=C[B];for(const L in P)d(P[L].object),delete P[L];delete C[B]}}delete s[A]}}function O(A){if(s[A.id]===void 0)return;const I=s[A.id];for(const G in I){const C=I[G];for(const B in C){const P=C[B];for(const L in P)d(P[L].object),delete P[L];delete C[B]}}delete s[A.id]}function S(A){for(const I in s){const G=s[I];for(const C in G){const B=G[C];if(B[A.id]===void 0)continue;const P=B[A.id];for(const L in P)d(P[L].object),delete P[L];delete B[A.id]}}}function b(A){for(const I in s){const G=s[I],C=A.isInstancedMesh===!0?A.id:0,B=G[C];if(B!==void 0){for(const P in B){const L=B[P];for(const H in L)d(L[H].object),delete L[H];delete B[P]}delete G[C],Object.keys(G).length===0&&delete s[I]}}}function v(){E(),a=!0,r!==i&&(r=i,c(r.object))}function E(){i.geometry=null,i.program=null,i.wireframe=!1}return{setup:o,reset:v,resetDefaultState:E,dispose:y,releaseStatesOfGeometry:O,releaseStatesOfObject:b,releaseStatesOfProgram:S,initAttributes:M,enableAttribute:g,disableUnusedAttributes:_}}function CE(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 p=0;p<d;p++)h+=c[p];t.update(h,s,1)}this.setMode=i,this.render=r,this.renderInstances=a,this.renderMultiDraw=o}function PE(n,e,t,s){let i;function r(){if(i!==void 0)return i;if(e.has("EXT_texture_filter_anisotropic")===!0){const S=e.get("EXT_texture_filter_anisotropic");i=n.getParameter(S.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else i=0;return i}function a(S){return!(S!==Vs&&s.convert(S)!==n.getParameter(n.IMPLEMENTATION_COLOR_READ_FORMAT))}function o(S){const b=S===Dn&&(e.has("EXT_color_buffer_half_float")||e.has("EXT_color_buffer_float"));return!(S!==Ss&&s.convert(S)!==n.getParameter(n.IMPLEMENTATION_COLOR_READ_TYPE)&&S!==$s&&!b)}function l(S){if(S==="highp"){if(n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.HIGH_FLOAT).precision>0&&n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.HIGH_FLOAT).precision>0)return"highp";S="mediump"}return S==="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&&(He("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&&He("WebGLRenderer: Unable to use reversed depth buffer due to missing EXT_clip_control extension. Fallback to default depth buffer.");const p=n.getParameter(n.MAX_TEXTURE_IMAGE_UNITS),f=n.getParameter(n.MAX_VERTEX_TEXTURE_IMAGE_UNITS),M=n.getParameter(n.MAX_TEXTURE_SIZE),g=n.getParameter(n.MAX_CUBE_MAP_TEXTURE_SIZE),m=n.getParameter(n.MAX_VERTEX_ATTRIBS),_=n.getParameter(n.MAX_VERTEX_UNIFORM_VECTORS),w=n.getParameter(n.MAX_VARYING_VECTORS),z=n.getParameter(n.MAX_FRAGMENT_UNIFORM_VECTORS),y=n.getParameter(n.MAX_SAMPLES),O=n.getParameter(n.SAMPLES);return{isWebGL2:!0,getMaxAnisotropy:r,getMaxPrecision:l,textureFormatReadable:a,textureTypeReadable:o,precision:c,logarithmicDepthBuffer:u,reversedDepthBuffer:h,maxTextures:p,maxVertexTextures:f,maxTextureSize:M,maxCubemapSize:g,maxAttributes:m,maxVertexUniforms:_,maxVaryings:w,maxFragmentUniforms:z,maxSamples:y,samples:O}}function LE(n){const e=this;let t=null,s=0,i=!1,r=!1;const a=new Vn,o=new st,l={value:null,needsUpdate:!1};this.uniform=l,this.numPlanes=0,this.numIntersection=0,this.init=function(u,h){const p=u.length!==0||h||s!==0||i;return i=h,s=u.length,p},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,p){const f=u.clippingPlanes,M=u.clipIntersection,g=u.clipShadows,m=n.get(u);if(!i||f===null||f.length===0||r&&!g)r?d(null):c();else{const _=r?0:s,w=_*4;let z=m.clippingState||null;l.value=z,z=d(f,h,w,p);for(let y=0;y!==w;++y)z[y]=t[y];m.clippingState=z,this.numIntersection=M?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,p,f){const M=u!==null?u.length:0;let g=null;if(M!==0){if(g=l.value,f!==!0||g===null){const m=p+M*4,_=h.matrixWorldInverse;o.getNormalMatrix(_),(g===null||g.length<m)&&(g=new Float32Array(m));for(let w=0,z=p;w!==M;++w,z+=4)a.copy(u[w]).applyMatrix4(_,o),a.normal.toArray(g,z),g[z+3]=a.constant}l.value=g,l.needsUpdate=!0}return e.numPlanes=M,e.numIntersection=0,g}}const Xn=4,op=[.125,.215,.35,.446,.526,.582],zi=20,WE=256,sa=new th,lp=new ke;let wc=null,yc=0,vc=0,Oc=!1;const kE=new W;class cp{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=kE}=r;wc=this._renderer.getRenderTarget(),yc=this._renderer.getActiveCubeFace(),vc=this._renderer.getActiveMipmapLevel(),Oc=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=hp(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=up(),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(wc,yc,vc),this._renderer.xr.enabled=Oc,e.scissorTest=!1,fr(e,0,0,e.width,e.height)}_fromTexture(e,t){e.mapping===Li||e.mapping===Gr?this._setSize(e.image.length===0?16:e.image[0].width||e.image[0].image.width):this._setSize(e.image.width/4),wc=this._renderer.getRenderTarget(),yc=this._renderer.getActiveCubeFace(),vc=this._renderer.getActiveMipmapLevel(),Oc=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:os,minFilter:os,generateMipmaps:!1,type:Dn,format:Vs,colorSpace:Jo,depthBuffer:!1},i=dp(e,t,s);if(this._pingPongRenderTarget===null||this._pingPongRenderTarget.width!==e||this._pingPongRenderTarget.height!==t){this._pingPongRenderTarget!==null&&this._dispose(),this._pingPongRenderTarget=dp(e,t,s);const{_lodMax:r}=this;({lodMeshes:this._lodMeshes,sizeLods:this._sizeLods,sigmas:this._sigmas}=UE(r)),this._blurMaterial=jE(r,e,t),this._ggxMaterial=FE(r,e,t)}return i}_compileMaterial(e){const t=new Ms(new qt,e);this._renderer.compile(t,sa)}_sceneToCubeUV(e,t,s,i,r){const l=new Rs(90,1,t,s),c=[1,-1,1,1,1,1],d=[1,1,1,-1,-1,-1],u=this._renderer,h=u.autoClear,p=u.toneMapping;u.getClearColor(lp),u.toneMapping=nn,u.autoClear=!1,u.state.buffers.depth.getReversed()&&(u.setRenderTarget(i),u.clearDepth(),u.setRenderTarget(null)),this._backgroundBox===null&&(this._backgroundBox=new Ms(new Ea,new Xu({name:"PMREM.Background",side:gs,depthWrite:!1,depthTest:!1})));const M=this._backgroundBox,g=M.material;let m=!1;const _=e.background;_?_.isColor&&(g.color.copy(_),e.background=null,m=!0):(g.color.copy(lp),m=!0);for(let w=0;w<6;w++){const z=w%3;z===0?(l.up.set(0,c[w],0),l.position.set(r.x,r.y,r.z),l.lookAt(r.x+d[w],r.y,r.z)):z===1?(l.up.set(0,0,c[w]),l.position.set(r.x,r.y,r.z),l.lookAt(r.x,r.y+d[w],r.z)):(l.up.set(0,c[w],0),l.position.set(r.x,r.y,r.z),l.lookAt(r.x,r.y,r.z+d[w]));const y=this._cubeSize;fr(i,z*y,w>2?y:0,y,y),u.setRenderTarget(i),m&&u.render(M,l),u.render(e,l)}u.toneMapping=p,u.autoClear=h,e.background=_}_textureToCubeUV(e,t){const s=this._renderer,i=e.mapping===Li||e.mapping===Gr;i?(this._cubemapMaterial===null&&(this._cubemapMaterial=hp()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=up());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;fr(t,0,0,3*l,2*l),s.setRenderTarget(t),s.render(a,sa)}_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,p=u*h,{_lodMax:f}=this,M=this._sizeLods[s],g=3*M*(s>f-Xn?s-f+Xn:0),m=4*(this._cubeSize-M);l.envMap.value=e.texture,l.roughness.value=p,l.mipInt.value=f-t,fr(r,g,m,3*M,2*M),i.setRenderTarget(r),i.render(o,sa),l.envMap.value=r.texture,l.roughness.value=0,l.mipInt.value=f-s,fr(e,g,m,3*M,2*M),i.setRenderTarget(e),i.render(o,sa)}_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"&&pt("blur direction must be either latitudinal or longitudinal!");const d=3,u=this._lodMeshes[i];u.material=c;const h=c.uniforms,p=this._sizeLods[s]-1,f=isFinite(r)?Math.PI/(2*p):2*Math.PI/(2*zi-1),M=r/f,g=isFinite(r)?1+Math.floor(d*M):zi;g>zi&&He(`sigmaRadians, ${r}, is too large and will clip, as it requested ${g} samples when the maximum is set to ${zi}`);const m=[];let _=0;for(let S=0;S<zi;++S){const b=S/M,v=Math.exp(-b*b/2);m.push(v),S===0?_+=v:S<g&&(_+=2*v)}for(let S=0;S<m.length;S++)m[S]=m[S]/_;h.envMap.value=e.texture,h.samples.value=g,h.weights.value=m,h.latitudinal.value=a==="latitudinal",o&&(h.poleAxis.value=o);const{_lodMax:w}=this;h.dTheta.value=f,h.mipInt.value=w-s;const z=this._sizeLods[i],y=3*z*(i>w-Xn?i-w+Xn:0),O=4*(this._cubeSize-z);fr(t,y,O,3*z,2*z),l.setRenderTarget(t),l.render(u,sa)}}function UE(n){const e=[],t=[],s=[];let i=n;const r=n-Xn+1+op.length;for(let a=0;a<r;a++){const o=Math.pow(2,i);e.push(o);let l=1/o;a>n-Xn?l=op[a-n+Xn-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],p=6,f=6,M=3,g=2,m=1,_=new Float32Array(M*f*p),w=new Float32Array(g*f*p),z=new Float32Array(m*f*p);for(let O=0;O<p;O++){const S=O%3*2/3-1,b=O>2?0:-1,v=[S,b,0,S+2/3,b,0,S+2/3,b+1,0,S,b,0,S+2/3,b+1,0,S,b+1,0];_.set(v,M*f*O),w.set(h,g*f*O);const E=[O,O,O,O,O,O];z.set(E,m*f*O)}const y=new qt;y.setAttribute("position",new ts(_,M)),y.setAttribute("uv",new ts(w,g)),y.setAttribute("faceIndex",new ts(z,m)),s.push(new Ms(y,null)),i>Xn&&i--}return{lodMeshes:s,sizeLods:e,sigmas:t}}function dp(n,e,t){const s=new rn(n,e,t);return s.texture.mapping=zl,s.texture.name="PMREM.cubeUv",s.scissorTest=!0,s}function fr(n,e,t,s,i){n.viewport.set(e,t,s,i),n.scissor.set(e,t,s,i)}function FE(n,e,t){return new jt({name:"PMREMGGXConvolution",defines:{GGX_SAMPLES:WE,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:Sl(),fragmentShader:`
3702
+ }`,at={alphahash_fragment:JO,alphahash_pars_fragment:ex,alphamap_fragment:tx,alphamap_pars_fragment:sx,alphatest_fragment:nx,alphatest_pars_fragment:ix,aomap_fragment:rx,aomap_pars_fragment:ax,batching_pars_vertex:ox,batching_vertex:lx,begin_vertex:cx,beginnormal_vertex:dx,bsdfs:ux,iridescence_fragment:hx,bumpmap_pars_fragment:fx,clipping_planes_fragment:px,clipping_planes_pars_fragment:mx,clipping_planes_pars_vertex:gx,clipping_planes_vertex:Mx,color_fragment:bx,color_pars_fragment:_x,color_pars_vertex:zx,color_vertex:wx,common:yx,cube_uv_reflection_fragment:vx,defaultnormal_vertex:Ox,displacementmap_pars_vertex:xx,displacementmap_vertex:Sx,emissivemap_fragment:Ex,emissivemap_pars_fragment:Ax,colorspace_fragment:Dx,colorspace_pars_fragment:Tx,envmap_fragment:Ix,envmap_common_pars_fragment:Gx,envmap_pars_fragment:Rx,envmap_pars_vertex:Nx,envmap_physical_pars_fragment:Vx,envmap_vertex:Bx,fog_vertex:Cx,fog_pars_vertex:Px,fog_fragment:Lx,fog_pars_fragment:Wx,gradientmap_pars_fragment:kx,lightmap_pars_fragment:Ux,lights_lambert_fragment:Fx,lights_lambert_pars_fragment:jx,lights_pars_begin:$x,lights_toon_fragment:Hx,lights_toon_pars_fragment:qx,lights_phong_fragment:Xx,lights_phong_pars_fragment:Kx,lights_physical_fragment:Yx,lights_physical_pars_fragment:Zx,lights_fragment_begin:Qx,lights_fragment_maps:Jx,lights_fragment_end:eS,lightprobes_pars_fragment:tS,logdepthbuf_fragment:sS,logdepthbuf_pars_fragment:nS,logdepthbuf_pars_vertex:iS,logdepthbuf_vertex:rS,map_fragment:aS,map_pars_fragment:oS,map_particle_fragment:lS,map_particle_pars_fragment:cS,metalnessmap_fragment:dS,metalnessmap_pars_fragment:uS,morphinstance_vertex:hS,morphcolor_vertex:fS,morphnormal_vertex:pS,morphtarget_pars_vertex:mS,morphtarget_vertex:gS,normal_fragment_begin:MS,normal_fragment_maps:bS,normal_pars_fragment:_S,normal_pars_vertex:zS,normal_vertex:wS,normalmap_pars_fragment:yS,clearcoat_normal_fragment_begin:vS,clearcoat_normal_fragment_maps:OS,clearcoat_pars_fragment:xS,iridescence_pars_fragment:SS,opaque_fragment:ES,packing:AS,premultiplied_alpha_fragment:DS,project_vertex:TS,dithering_fragment:IS,dithering_pars_fragment:GS,roughnessmap_fragment:RS,roughnessmap_pars_fragment:NS,shadowmap_pars_fragment:BS,shadowmap_pars_vertex:CS,shadowmap_vertex:PS,shadowmask_pars_fragment:LS,skinbase_vertex:WS,skinning_pars_vertex:kS,skinning_vertex:US,skinnormal_vertex:FS,specularmap_fragment:jS,specularmap_pars_fragment:$S,tonemapping_fragment:VS,tonemapping_pars_fragment:HS,transmission_fragment:qS,transmission_pars_fragment:XS,uv_pars_fragment:KS,uv_pars_vertex:YS,uv_vertex:ZS,worldpos_vertex:QS,background_vert:JS,background_frag:eE,backgroundCube_vert:tE,backgroundCube_frag:sE,cube_vert:nE,cube_frag:iE,depth_vert:rE,depth_frag:aE,distance_vert:oE,distance_frag:lE,equirect_vert:cE,equirect_frag:dE,linedashed_vert:uE,linedashed_frag:hE,meshbasic_vert:fE,meshbasic_frag:pE,meshlambert_vert:mE,meshlambert_frag:gE,meshmatcap_vert:ME,meshmatcap_frag:bE,meshnormal_vert:_E,meshnormal_frag:zE,meshphong_vert:wE,meshphong_frag:yE,meshphysical_vert:vE,meshphysical_frag:OE,meshtoon_vert:xE,meshtoon_frag:SE,points_vert:EE,points_frag:AE,shadow_vert:DE,shadow_frag:TE,sprite_vert:IE,sprite_frag:GE},Se={common:{diffuse:{value:new ke(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new st},alphaMap:{value:null},alphaMapTransform:{value:new st},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new st}},envmap:{envMap:{value:null},envMapRotation:{value:new st},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98},dfgLUT:{value:null}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new st}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new st}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new st},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new st},normalScale:{value:new et(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new st},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new st}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new st}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new st}},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 k},probesMax:{value:new k},probesResolution:{value:new k}},points:{diffuse:{value:new ke(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new st},alphaTest:{value:0},uvTransform:{value:new st}},sprite:{diffuse:{value:new ke(16777215)},opacity:{value:1},center:{value:new et(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new st},alphaMap:{value:null},alphaMapTransform:{value:new st},alphaTest:{value:0}}},Qs={basic:{uniforms:us([Se.common,Se.specularmap,Se.envmap,Se.aomap,Se.lightmap,Se.fog]),vertexShader:at.meshbasic_vert,fragmentShader:at.meshbasic_frag},lambert:{uniforms:us([Se.common,Se.specularmap,Se.envmap,Se.aomap,Se.lightmap,Se.emissivemap,Se.bumpmap,Se.normalmap,Se.displacementmap,Se.fog,Se.lights,{emissive:{value:new ke(0)},envMapIntensity:{value:1}}]),vertexShader:at.meshlambert_vert,fragmentShader:at.meshlambert_frag},phong:{uniforms:us([Se.common,Se.specularmap,Se.envmap,Se.aomap,Se.lightmap,Se.emissivemap,Se.bumpmap,Se.normalmap,Se.displacementmap,Se.fog,Se.lights,{emissive:{value:new ke(0)},specular:{value:new ke(1118481)},shininess:{value:30},envMapIntensity:{value:1}}]),vertexShader:at.meshphong_vert,fragmentShader:at.meshphong_frag},standard:{uniforms:us([Se.common,Se.envmap,Se.aomap,Se.lightmap,Se.emissivemap,Se.bumpmap,Se.normalmap,Se.displacementmap,Se.roughnessmap,Se.metalnessmap,Se.fog,Se.lights,{emissive:{value:new ke(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:at.meshphysical_vert,fragmentShader:at.meshphysical_frag},toon:{uniforms:us([Se.common,Se.aomap,Se.lightmap,Se.emissivemap,Se.bumpmap,Se.normalmap,Se.displacementmap,Se.gradientmap,Se.fog,Se.lights,{emissive:{value:new ke(0)}}]),vertexShader:at.meshtoon_vert,fragmentShader:at.meshtoon_frag},matcap:{uniforms:us([Se.common,Se.bumpmap,Se.normalmap,Se.displacementmap,Se.fog,{matcap:{value:null}}]),vertexShader:at.meshmatcap_vert,fragmentShader:at.meshmatcap_frag},points:{uniforms:us([Se.points,Se.fog]),vertexShader:at.points_vert,fragmentShader:at.points_frag},dashed:{uniforms:us([Se.common,Se.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:at.linedashed_vert,fragmentShader:at.linedashed_frag},depth:{uniforms:us([Se.common,Se.displacementmap]),vertexShader:at.depth_vert,fragmentShader:at.depth_frag},normal:{uniforms:us([Se.common,Se.bumpmap,Se.normalmap,Se.displacementmap,{opacity:{value:1}}]),vertexShader:at.meshnormal_vert,fragmentShader:at.meshnormal_frag},sprite:{uniforms:us([Se.sprite,Se.fog]),vertexShader:at.sprite_vert,fragmentShader:at.sprite_frag},background:{uniforms:{uvTransform:{value:new st},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:at.background_vert,fragmentShader:at.background_frag},backgroundCube:{uniforms:{envMap:{value:null},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new st}},vertexShader:at.backgroundCube_vert,fragmentShader:at.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:at.cube_vert,fragmentShader:at.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:at.equirect_vert,fragmentShader:at.equirect_frag},distance:{uniforms:us([Se.common,Se.displacementmap,{referencePosition:{value:new k},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:at.distance_vert,fragmentShader:at.distance_frag},shadow:{uniforms:us([Se.lights,Se.fog,{color:{value:new ke(0)},opacity:{value:1}}]),vertexShader:at.shadow_vert,fragmentShader:at.shadow_frag}};Qs.physical={uniforms:us([Qs.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new st},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new st},clearcoatNormalScale:{value:new et(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new st},dispersion:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new st},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new st},sheen:{value:0},sheenColor:{value:new ke(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new st},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new st},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new st},transmissionSamplerSize:{value:new et},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new st},attenuationDistance:{value:0},attenuationColor:{value:new ke(0)},specularColor:{value:new ke(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new st},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new st},anisotropyVector:{value:new et},anisotropyMap:{value:null},anisotropyMapTransform:{value:new st}}]),vertexShader:at.meshphysical_vert,fragmentShader:at.meshphysical_frag};const uo={r:0,b:0,g:0},RE=new wt,dM=new st;dM.set(-1,0,0,0,1,0,0,0,1);function NE(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 p(_){let w=_.isScene===!0?_.background:null;if(w&&w.isTexture){const z=_.backgroundBlurriness>0;w=e.get(w,z)}return w}function f(_){let w=!1;const z=p(_);z===null?g(a,o):z&&z.isColor&&(g(z,1),w=!0);const y=n.xr.getEnvironmentBlendMode();y==="additive"?t.buffers.color.setClear(0,0,0,1,r):y==="alpha-blend"&&t.buffers.color.setClear(0,0,0,0,r),(n.autoClear||w)&&(t.buffers.depth.setTest(!0),t.buffers.depth.setMask(!0),t.buffers.color.setMask(!0),n.clear(n.autoClearColor,n.autoClearDepth,n.autoClearStencil))}function M(_,w){const z=p(w);z&&(z.isCubeTexture||z.mapping===zl)?(c===void 0&&(c=new Ms(new Ea(1,1,1),new jt({name:"BackgroundCubeMaterial",uniforms:Nr(Qs.backgroundCube.uniforms),vertexShader:Qs.backgroundCube.vertexShader,fragmentShader:Qs.backgroundCube.fragmentShader,side:gs,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),c.geometry.deleteAttribute("normal"),c.geometry.deleteAttribute("uv"),c.onBeforeRender=function(y,O,S){this.matrixWorld.copyPosition(S.matrixWorld)},Object.defineProperty(c.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),s.update(c)),c.material.uniforms.envMap.value=z,c.material.uniforms.backgroundBlurriness.value=w.backgroundBlurriness,c.material.uniforms.backgroundIntensity.value=w.backgroundIntensity,c.material.uniforms.backgroundRotation.value.setFromMatrix4(RE.makeRotationFromEuler(w.backgroundRotation)).transpose(),z.isCubeTexture&&z.isRenderTargetTexture===!1&&c.material.uniforms.backgroundRotation.value.premultiply(dM),c.material.toneMapped=mt.getTransfer(z.colorSpace)!==St,(d!==z||u!==z.version||h!==n.toneMapping)&&(c.material.needsUpdate=!0,d=z,u=z.version,h=n.toneMapping),c.layers.enableAll(),_.unshift(c,c.geometry,c.material,0,0,null)):z&&z.isTexture&&(l===void 0&&(l=new Ms(new Ol(2,2),new jt({name:"BackgroundMaterial",uniforms:Nr(Qs.background.uniforms),vertexShader:Qs.background.vertexShader,fragmentShader:Qs.background.fragmentShader,side:ri,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=z,l.material.uniforms.backgroundIntensity.value=w.backgroundIntensity,l.material.toneMapped=mt.getTransfer(z.colorSpace)!==St,z.matrixAutoUpdate===!0&&z.updateMatrix(),l.material.uniforms.uvTransform.value.copy(z.matrix),(d!==z||u!==z.version||h!==n.toneMapping)&&(l.material.needsUpdate=!0,d=z,u=z.version,h=n.toneMapping),l.layers.enableAll(),_.unshift(l,l.geometry,l.material,0,0,null))}function g(_,w){_.getRGB(uo,aM(n)),t.buffers.color.setClear(uo.r,uo.g,uo.b,w,r)}function m(){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(_,w=1){a.set(_),o=w,g(a,o)},getClearAlpha:function(){return o},setClearAlpha:function(_){o=_,g(a,o)},render:f,addToRenderList:M,dispose:m}}function BE(n,e){const t=n.getParameter(n.MAX_VERTEX_ATTRIBS),s={},i=h(null);let r=i,a=!1;function o(A,I,G,C,B){let P=!1;const W=u(A,C,G,I);r!==W&&(r=W,c(r.object)),P=p(A,C,G,B),P&&f(A,C,G,B),B!==null&&e.update(B,n.ELEMENT_ARRAY_BUFFER),(P||a)&&(a=!1,z(A,I,G,C),B!==null&&n.bindBuffer(n.ELEMENT_ARRAY_BUFFER,e.get(B).buffer))}function l(){return n.createVertexArray()}function c(A){return n.bindVertexArray(A)}function d(A){return n.deleteVertexArray(A)}function u(A,I,G,C){const B=C.wireframe===!0;let P=s[I.id];P===void 0&&(P={},s[I.id]=P);const W=A.isInstancedMesh===!0?A.id:0;let H=P[W];H===void 0&&(H={},P[W]=H);let X=H[G.id];X===void 0&&(X={},H[G.id]=X);let oe=X[B];return oe===void 0&&(oe=h(l()),X[B]=oe),oe}function h(A){const I=[],G=[],C=[];for(let B=0;B<t;B++)I[B]=0,G[B]=0,C[B]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:I,enabledAttributes:G,attributeDivisors:C,object:A,attributes:{},index:null}}function p(A,I,G,C){const B=r.attributes,P=I.attributes;let W=0;const H=G.getAttributes();for(const X in H)if(H[X].location>=0){const J=B[X];let ce=P[X];if(ce===void 0&&(X==="instanceMatrix"&&A.instanceMatrix&&(ce=A.instanceMatrix),X==="instanceColor"&&A.instanceColor&&(ce=A.instanceColor)),J===void 0||J.attribute!==ce||ce&&J.data!==ce.data)return!0;W++}return r.attributesNum!==W||r.index!==C}function f(A,I,G,C){const B={},P=I.attributes;let W=0;const H=G.getAttributes();for(const X in H)if(H[X].location>=0){let J=P[X];J===void 0&&(X==="instanceMatrix"&&A.instanceMatrix&&(J=A.instanceMatrix),X==="instanceColor"&&A.instanceColor&&(J=A.instanceColor));const ce={};ce.attribute=J,J&&J.data&&(ce.data=J.data),B[X]=ce,W++}r.attributes=B,r.attributesNum=W,r.index=C}function M(){const A=r.newAttributes;for(let I=0,G=A.length;I<G;I++)A[I]=0}function g(A){m(A,0)}function m(A,I){const G=r.newAttributes,C=r.enabledAttributes,B=r.attributeDivisors;G[A]=1,C[A]===0&&(n.enableVertexAttribArray(A),C[A]=1),B[A]!==I&&(n.vertexAttribDivisor(A,I),B[A]=I)}function _(){const A=r.newAttributes,I=r.enabledAttributes;for(let G=0,C=I.length;G<C;G++)I[G]!==A[G]&&(n.disableVertexAttribArray(G),I[G]=0)}function w(A,I,G,C,B,P,W){W===!0?n.vertexAttribIPointer(A,I,G,B,P):n.vertexAttribPointer(A,I,G,C,B,P)}function z(A,I,G,C){M();const B=C.attributes,P=G.getAttributes(),W=I.defaultAttributeValues;for(const H in P){const X=P[H];if(X.location>=0){let oe=B[H];if(oe===void 0&&(H==="instanceMatrix"&&A.instanceMatrix&&(oe=A.instanceMatrix),H==="instanceColor"&&A.instanceColor&&(oe=A.instanceColor)),oe!==void 0){const J=oe.normalized,ce=oe.itemSize,We=e.get(oe);if(We===void 0)continue;const qe=We.buffer,Pe=We.type,ne=We.bytesPerElement,ae=Pe===n.INT||Pe===n.UNSIGNED_INT||oe.gpuType===Cu;if(oe.isInterleavedBufferAttribute){const ue=oe.data,Xe=ue.stride,Ze=oe.offset;if(ue.isInstancedInterleavedBuffer){for(let Fe=0;Fe<X.locationSize;Fe++)m(X.location+Fe,ue.meshPerAttribute);A.isInstancedMesh!==!0&&C._maxInstanceCount===void 0&&(C._maxInstanceCount=ue.meshPerAttribute*ue.count)}else for(let Fe=0;Fe<X.locationSize;Fe++)g(X.location+Fe);n.bindBuffer(n.ARRAY_BUFFER,qe);for(let Fe=0;Fe<X.locationSize;Fe++)w(X.location+Fe,ce/X.locationSize,Pe,J,Xe*ne,(Ze+ce/X.locationSize*Fe)*ne,ae)}else{if(oe.isInstancedBufferAttribute){for(let ue=0;ue<X.locationSize;ue++)m(X.location+ue,oe.meshPerAttribute);A.isInstancedMesh!==!0&&C._maxInstanceCount===void 0&&(C._maxInstanceCount=oe.meshPerAttribute*oe.count)}else for(let ue=0;ue<X.locationSize;ue++)g(X.location+ue);n.bindBuffer(n.ARRAY_BUFFER,qe);for(let ue=0;ue<X.locationSize;ue++)w(X.location+ue,ce/X.locationSize,Pe,J,ce*ne,ce/X.locationSize*ue*ne,ae)}}else if(W!==void 0){const J=W[H];if(J!==void 0)switch(J.length){case 2:n.vertexAttrib2fv(X.location,J);break;case 3:n.vertexAttrib3fv(X.location,J);break;case 4:n.vertexAttrib4fv(X.location,J);break;default:n.vertexAttrib1fv(X.location,J)}}}}_()}function y(){v();for(const A in s){const I=s[A];for(const G in I){const C=I[G];for(const B in C){const P=C[B];for(const W in P)d(P[W].object),delete P[W];delete C[B]}}delete s[A]}}function O(A){if(s[A.id]===void 0)return;const I=s[A.id];for(const G in I){const C=I[G];for(const B in C){const P=C[B];for(const W in P)d(P[W].object),delete P[W];delete C[B]}}delete s[A.id]}function S(A){for(const I in s){const G=s[I];for(const C in G){const B=G[C];if(B[A.id]===void 0)continue;const P=B[A.id];for(const W in P)d(P[W].object),delete P[W];delete B[A.id]}}}function b(A){for(const I in s){const G=s[I],C=A.isInstancedMesh===!0?A.id:0,B=G[C];if(B!==void 0){for(const P in B){const W=B[P];for(const H in W)d(W[H].object),delete W[H];delete B[P]}delete G[C],Object.keys(G).length===0&&delete s[I]}}}function v(){E(),a=!0,r!==i&&(r=i,c(r.object))}function E(){i.geometry=null,i.program=null,i.wireframe=!1}return{setup:o,reset:v,resetDefaultState:E,dispose:y,releaseStatesOfGeometry:O,releaseStatesOfObject:b,releaseStatesOfProgram:S,initAttributes:M,enableAttribute:g,disableUnusedAttributes:_}}function CE(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 p=0;p<d;p++)h+=c[p];t.update(h,s,1)}this.setMode=i,this.render=r,this.renderInstances=a,this.renderMultiDraw=o}function PE(n,e,t,s){let i;function r(){if(i!==void 0)return i;if(e.has("EXT_texture_filter_anisotropic")===!0){const S=e.get("EXT_texture_filter_anisotropic");i=n.getParameter(S.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else i=0;return i}function a(S){return!(S!==Vs&&s.convert(S)!==n.getParameter(n.IMPLEMENTATION_COLOR_READ_FORMAT))}function o(S){const b=S===Dn&&(e.has("EXT_color_buffer_half_float")||e.has("EXT_color_buffer_float"));return!(S!==Ss&&s.convert(S)!==n.getParameter(n.IMPLEMENTATION_COLOR_READ_TYPE)&&S!==$s&&!b)}function l(S){if(S==="highp"){if(n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.HIGH_FLOAT).precision>0&&n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.HIGH_FLOAT).precision>0)return"highp";S="mediump"}return S==="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&&(He("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&&He("WebGLRenderer: Unable to use reversed depth buffer due to missing EXT_clip_control extension. Fallback to default depth buffer.");const p=n.getParameter(n.MAX_TEXTURE_IMAGE_UNITS),f=n.getParameter(n.MAX_VERTEX_TEXTURE_IMAGE_UNITS),M=n.getParameter(n.MAX_TEXTURE_SIZE),g=n.getParameter(n.MAX_CUBE_MAP_TEXTURE_SIZE),m=n.getParameter(n.MAX_VERTEX_ATTRIBS),_=n.getParameter(n.MAX_VERTEX_UNIFORM_VECTORS),w=n.getParameter(n.MAX_VARYING_VECTORS),z=n.getParameter(n.MAX_FRAGMENT_UNIFORM_VECTORS),y=n.getParameter(n.MAX_SAMPLES),O=n.getParameter(n.SAMPLES);return{isWebGL2:!0,getMaxAnisotropy:r,getMaxPrecision:l,textureFormatReadable:a,textureTypeReadable:o,precision:c,logarithmicDepthBuffer:u,reversedDepthBuffer:h,maxTextures:p,maxVertexTextures:f,maxTextureSize:M,maxCubemapSize:g,maxAttributes:m,maxVertexUniforms:_,maxVaryings:w,maxFragmentUniforms:z,maxSamples:y,samples:O}}function LE(n){const e=this;let t=null,s=0,i=!1,r=!1;const a=new Vn,o=new st,l={value:null,needsUpdate:!1};this.uniform=l,this.numPlanes=0,this.numIntersection=0,this.init=function(u,h){const p=u.length!==0||h||s!==0||i;return i=h,s=u.length,p},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,p){const f=u.clippingPlanes,M=u.clipIntersection,g=u.clipShadows,m=n.get(u);if(!i||f===null||f.length===0||r&&!g)r?d(null):c();else{const _=r?0:s,w=_*4;let z=m.clippingState||null;l.value=z,z=d(f,h,w,p);for(let y=0;y!==w;++y)z[y]=t[y];m.clippingState=z,this.numIntersection=M?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,p,f){const M=u!==null?u.length:0;let g=null;if(M!==0){if(g=l.value,f!==!0||g===null){const m=p+M*4,_=h.matrixWorldInverse;o.getNormalMatrix(_),(g===null||g.length<m)&&(g=new Float32Array(m));for(let w=0,z=p;w!==M;++w,z+=4)a.copy(u[w]).applyMatrix4(_,o),a.normal.toArray(g,z),g[z+3]=a.constant}l.value=g,l.needsUpdate=!0}return e.numPlanes=M,e.numIntersection=0,g}}const Xn=4,op=[.125,.215,.35,.446,.526,.582],zi=20,WE=256,sa=new th,lp=new ke;let wc=null,yc=0,vc=0,Oc=!1;const kE=new k;class cp{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=kE}=r;wc=this._renderer.getRenderTarget(),yc=this._renderer.getActiveCubeFace(),vc=this._renderer.getActiveMipmapLevel(),Oc=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=hp(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=up(),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(wc,yc,vc),this._renderer.xr.enabled=Oc,e.scissorTest=!1,fr(e,0,0,e.width,e.height)}_fromTexture(e,t){e.mapping===Li||e.mapping===Gr?this._setSize(e.image.length===0?16:e.image[0].width||e.image[0].image.width):this._setSize(e.image.width/4),wc=this._renderer.getRenderTarget(),yc=this._renderer.getActiveCubeFace(),vc=this._renderer.getActiveMipmapLevel(),Oc=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:os,minFilter:os,generateMipmaps:!1,type:Dn,format:Vs,colorSpace:Jo,depthBuffer:!1},i=dp(e,t,s);if(this._pingPongRenderTarget===null||this._pingPongRenderTarget.width!==e||this._pingPongRenderTarget.height!==t){this._pingPongRenderTarget!==null&&this._dispose(),this._pingPongRenderTarget=dp(e,t,s);const{_lodMax:r}=this;({lodMeshes:this._lodMeshes,sizeLods:this._sizeLods,sigmas:this._sigmas}=UE(r)),this._blurMaterial=jE(r,e,t),this._ggxMaterial=FE(r,e,t)}return i}_compileMaterial(e){const t=new Ms(new qt,e);this._renderer.compile(t,sa)}_sceneToCubeUV(e,t,s,i,r){const l=new Rs(90,1,t,s),c=[1,-1,1,1,1,1],d=[1,1,1,-1,-1,-1],u=this._renderer,h=u.autoClear,p=u.toneMapping;u.getClearColor(lp),u.toneMapping=nn,u.autoClear=!1,u.state.buffers.depth.getReversed()&&(u.setRenderTarget(i),u.clearDepth(),u.setRenderTarget(null)),this._backgroundBox===null&&(this._backgroundBox=new Ms(new Ea,new Xu({name:"PMREM.Background",side:gs,depthWrite:!1,depthTest:!1})));const M=this._backgroundBox,g=M.material;let m=!1;const _=e.background;_?_.isColor&&(g.color.copy(_),e.background=null,m=!0):(g.color.copy(lp),m=!0);for(let w=0;w<6;w++){const z=w%3;z===0?(l.up.set(0,c[w],0),l.position.set(r.x,r.y,r.z),l.lookAt(r.x+d[w],r.y,r.z)):z===1?(l.up.set(0,0,c[w]),l.position.set(r.x,r.y,r.z),l.lookAt(r.x,r.y+d[w],r.z)):(l.up.set(0,c[w],0),l.position.set(r.x,r.y,r.z),l.lookAt(r.x,r.y,r.z+d[w]));const y=this._cubeSize;fr(i,z*y,w>2?y:0,y,y),u.setRenderTarget(i),m&&u.render(M,l),u.render(e,l)}u.toneMapping=p,u.autoClear=h,e.background=_}_textureToCubeUV(e,t){const s=this._renderer,i=e.mapping===Li||e.mapping===Gr;i?(this._cubemapMaterial===null&&(this._cubemapMaterial=hp()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=up());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;fr(t,0,0,3*l,2*l),s.setRenderTarget(t),s.render(a,sa)}_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,p=u*h,{_lodMax:f}=this,M=this._sizeLods[s],g=3*M*(s>f-Xn?s-f+Xn:0),m=4*(this._cubeSize-M);l.envMap.value=e.texture,l.roughness.value=p,l.mipInt.value=f-t,fr(r,g,m,3*M,2*M),i.setRenderTarget(r),i.render(o,sa),l.envMap.value=r.texture,l.roughness.value=0,l.mipInt.value=f-s,fr(e,g,m,3*M,2*M),i.setRenderTarget(e),i.render(o,sa)}_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"&&pt("blur direction must be either latitudinal or longitudinal!");const d=3,u=this._lodMeshes[i];u.material=c;const h=c.uniforms,p=this._sizeLods[s]-1,f=isFinite(r)?Math.PI/(2*p):2*Math.PI/(2*zi-1),M=r/f,g=isFinite(r)?1+Math.floor(d*M):zi;g>zi&&He(`sigmaRadians, ${r}, is too large and will clip, as it requested ${g} samples when the maximum is set to ${zi}`);const m=[];let _=0;for(let S=0;S<zi;++S){const b=S/M,v=Math.exp(-b*b/2);m.push(v),S===0?_+=v:S<g&&(_+=2*v)}for(let S=0;S<m.length;S++)m[S]=m[S]/_;h.envMap.value=e.texture,h.samples.value=g,h.weights.value=m,h.latitudinal.value=a==="latitudinal",o&&(h.poleAxis.value=o);const{_lodMax:w}=this;h.dTheta.value=f,h.mipInt.value=w-s;const z=this._sizeLods[i],y=3*z*(i>w-Xn?i-w+Xn:0),O=4*(this._cubeSize-z);fr(t,y,O,3*z,2*z),l.setRenderTarget(t),l.render(u,sa)}}function UE(n){const e=[],t=[],s=[];let i=n;const r=n-Xn+1+op.length;for(let a=0;a<r;a++){const o=Math.pow(2,i);e.push(o);let l=1/o;a>n-Xn?l=op[a-n+Xn-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],p=6,f=6,M=3,g=2,m=1,_=new Float32Array(M*f*p),w=new Float32Array(g*f*p),z=new Float32Array(m*f*p);for(let O=0;O<p;O++){const S=O%3*2/3-1,b=O>2?0:-1,v=[S,b,0,S+2/3,b,0,S+2/3,b+1,0,S,b,0,S+2/3,b+1,0,S,b+1,0];_.set(v,M*f*O),w.set(h,g*f*O);const E=[O,O,O,O,O,O];z.set(E,m*f*O)}const y=new qt;y.setAttribute("position",new ts(_,M)),y.setAttribute("uv",new ts(w,g)),y.setAttribute("faceIndex",new ts(z,m)),s.push(new Ms(y,null)),i>Xn&&i--}return{lodMeshes:s,sizeLods:e,sigmas:t}}function dp(n,e,t){const s=new rn(n,e,t);return s.texture.mapping=zl,s.texture.name="PMREM.cubeUv",s.scissorTest=!0,s}function fr(n,e,t,s,i){n.viewport.set(e,t,s,i),n.scissor.set(e,t,s,i)}function FE(n,e,t){return new jt({name:"PMREMGGXConvolution",defines:{GGX_SAMPLES:WE,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:Sl(),fragmentShader:`
3703
3703
 
3704
3704
  precision highp float;
3705
3705
  precision highp int;
@@ -3803,7 +3803,7 @@ void main() {
3803
3803
 
3804
3804
  gl_FragColor = vec4(prefilteredColor, 1.0);
3805
3805
  }
3806
- `,blending:Sn,depthTest:!1,depthWrite:!1})}function jE(n,e,t){const s=new Float32Array(zi),i=new W(0,1,0);return new jt({name:"SphericalGaussianBlur",defines:{n:zi,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:Sl(),fragmentShader:`
3806
+ `,blending:Sn,depthTest:!1,depthWrite:!1})}function jE(n,e,t){const s=new Float32Array(zi),i=new k(0,1,0);return new jt({name:"SphericalGaussianBlur",defines:{n:zi,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:Sl(),fragmentShader:`
3807
3807
 
3808
3808
  precision mediump float;
3809
3809
  precision mediump int;
@@ -4041,7 +4041,7 @@ void main() {
4041
4041
  `+r+`
4042
4042
 
4043
4043
  `+V1(n.getShaderSource(e),o)}else return r}function q1(n,e){const t=H1(e);return[`vec4 ${n}( vec4 value ) {`,` return ${t[1]}( vec4( value.rgb * ${t[0]}, value.a ) );`,"}"].join(`
4044
- `)}const X1={[Cg]:"Linear",[Pg]:"Reinhard",[Lg]:"Cineon",[Wg]:"ACESFilmic",[Ug]:"AgX",[Fg]:"Neutral",[kg]:"Custom"};function K1(n,e){const t=X1[e];return t===void 0?(He("WebGLProgram: Unsupported toneMapping:",e),"vec3 "+n+"( vec3 color ) { return LinearToneMapping( color ); }"):"vec3 "+n+"( vec3 color ) { return "+t+"ToneMapping( color ); }"}const ho=new W;function Y1(){mt.getLuminanceCoefficients(ho);const n=ho.x.toFixed(4),e=ho.y.toFixed(4),t=ho.z.toFixed(4);return["float luminance( const in vec3 rgb ) {",` const vec3 weights = vec3( ${n}, ${e}, ${t} );`," return dot( weights, rgb );","}"].join(`
4044
+ `)}const X1={[Cg]:"Linear",[Pg]:"Reinhard",[Lg]:"Cineon",[Wg]:"ACESFilmic",[Ug]:"AgX",[Fg]:"Neutral",[kg]:"Custom"};function K1(n,e){const t=X1[e];return t===void 0?(He("WebGLProgram: Unsupported toneMapping:",e),"vec3 "+n+"( vec3 color ) { return LinearToneMapping( color ); }"):"vec3 "+n+"( vec3 color ) { return "+t+"ToneMapping( color ); }"}const ho=new k;function Y1(){mt.getLuminanceCoefficients(ho);const n=ho.x.toFixed(4),e=ho.y.toFixed(4),t=ho.z.toFixed(4);return["float luminance( const in vec3 rgb ) {",` const vec3 weights = vec3( ${n}, ${e}, ${t} );`," return dot( weights, rgb );","}"].join(`
4045
4045
  `)}function Z1(n){return[n.extensionClipCullDistance?"#extension GL_ANGLE_clip_cull_distance : require":"",n.extensionMultiDraw?"#extension GL_ANGLE_multi_draw : require":""].filter(fa).join(`
4046
4046
  `)}function Q1(n){const e=[];for(const t in n){const s=n[t];s!==!1&&e.push("#define "+t+" "+s)}return e.join(`
4047
4047
  `)}function J1(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 fa(n){return n!==""}function yp(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 vp(n,e){return n.replace(/NUM_CLIPPING_PLANES/g,e.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,e.numClippingPlanes-e.numClipIntersection)}const eA=/^[ \t]*#include +<([\w\d./]+)>/gm;function iu(n){return n.replace(eA,sA)}const tA=new Map;function sA(n,e){let t=at[e];if(t===void 0){const s=tA.get(e);if(s!==void 0)t=at[s],He('WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',e,s);else throw new Error("THREE.WebGLProgram: Can not resolve #include <"+e+">")}return iu(t)}const nA=/#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 Op(n){return n.replace(nA,iA)}function iA(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 xp(n){let e=`precision ${n.precision} float;
@@ -4078,14 +4078,14 @@ void main() {
4078
4078
  `)+`
4079
4079
  `+g,m=["#define varying in",t.glslVersion===Sf?"":"layout(location = 0) out highp vec4 pc_fragColor;",t.glslVersion===Sf?"":"#define gl_FragColor pc_fragColor","#define gl_FragDepthEXT gl_FragDepth","#define texture2D texture","#define textureCube texture","#define texture2DProj textureProj","#define texture2DLodEXT textureLod","#define texture2DProjLodEXT textureProjLod","#define textureCubeLodEXT textureLod","#define texture2DGradEXT textureGrad","#define texture2DProjGradEXT textureProjGrad","#define textureCubeGradEXT textureGrad"].join(`
4080
4080
  `)+`
4081
- `+m);const w=_+g+a,z=_+m+o,y=_p(i,i.VERTEX_SHADER,w),O=_p(i,i.FRAGMENT_SHADER,z);i.attachShader(M,y),i.attachShader(M,O),t.index0AttributeName!==void 0?i.bindAttribLocation(M,0,t.index0AttributeName):t.hasPositionAttribute===!0&&i.bindAttribLocation(M,0,"position"),i.linkProgram(M);function S(A){if(n.debug.checkShaderErrors){const I=i.getProgramInfoLog(M)||"",G=i.getShaderInfoLog(y)||"",C=i.getShaderInfoLog(O)||"",B=I.trim(),P=G.trim(),L=C.trim();let H=!0,X=!0;if(i.getProgramParameter(M,i.LINK_STATUS)===!1)if(H=!1,typeof n.debug.onShaderError=="function")n.debug.onShaderError(i,M,y,O);else{const oe=wp(i,y,"vertex"),J=wp(i,O,"fragment");pt("WebGLProgram: Shader Error "+i.getError()+" - VALIDATE_STATUS "+i.getProgramParameter(M,i.VALIDATE_STATUS)+`
4081
+ `+m);const w=_+g+a,z=_+m+o,y=_p(i,i.VERTEX_SHADER,w),O=_p(i,i.FRAGMENT_SHADER,z);i.attachShader(M,y),i.attachShader(M,O),t.index0AttributeName!==void 0?i.bindAttribLocation(M,0,t.index0AttributeName):t.hasPositionAttribute===!0&&i.bindAttribLocation(M,0,"position"),i.linkProgram(M);function S(A){if(n.debug.checkShaderErrors){const I=i.getProgramInfoLog(M)||"",G=i.getShaderInfoLog(y)||"",C=i.getShaderInfoLog(O)||"",B=I.trim(),P=G.trim(),W=C.trim();let H=!0,X=!0;if(i.getProgramParameter(M,i.LINK_STATUS)===!1)if(H=!1,typeof n.debug.onShaderError=="function")n.debug.onShaderError(i,M,y,O);else{const oe=wp(i,y,"vertex"),J=wp(i,O,"fragment");pt("WebGLProgram: Shader Error "+i.getError()+" - VALIDATE_STATUS "+i.getProgramParameter(M,i.VALIDATE_STATUS)+`
4082
4082
 
4083
4083
  Material Name: `+A.name+`
4084
4084
  Material Type: `+A.type+`
4085
4085
 
4086
4086
  Program Info Log: `+B+`
4087
4087
  `+oe+`
4088
- `+J)}else B!==""?He("WebGLProgram: Program Info Log:",B):(P===""||L==="")&&(X=!1);X&&(A.diagnostics={runnable:H,programLog:B,vertexShader:{log:P,prefix:g},fragmentShader:{log:L,prefix:m}})}i.deleteShader(y),i.deleteShader(O),b=new Do(i,M),v=J1(i,M)}let b;this.getUniforms=function(){return b===void 0&&S(this),b};let v;this.getAttributes=function(){return v===void 0&&S(this),v};let E=t.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return E===!1&&(E=i.getProgramParameter(M,j1)),E},this.destroy=function(){s.releaseStatesOfProgram(this),i.deleteProgram(M),this.program=void 0},this.type=t.shaderType,this.name=t.shaderName,this.id=$1++,this.cacheKey=e,this.usedTimes=1,this.program=M,this.vertexShader=y,this.fragmentShader=O,this}let mA=0;class gA{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 MA(e),t.set(e,s)),s}}class MA{constructor(e){this.id=mA++,this.code=e,this.usedTimes=0}}function bA(n){return n===Wi||n===Zo||n===Qo}function _A(n,e,t,s,i,r){const a=new Hu,o=new gA,l=new Set,c=[],d=new Map,u=s.logarithmicDepthBuffer;let h=s.precision;const p={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 f(b){return l.add(b),b===0?"uv":`uv${b}`}function M(b,v,E,A,I,G){const C=A.fog,B=I.geometry,P=b.isMeshStandardMaterial||b.isMeshLambertMaterial||b.isMeshPhongMaterial?A.environment:null,L=b.isMeshStandardMaterial||b.isMeshLambertMaterial&&!b.envMap||b.isMeshPhongMaterial&&!b.envMap,H=e.get(b.envMap||P,L),X=H&&H.mapping===zl?H.image.height:null,oe=p[b.type];b.precision!==null&&(h=s.getMaxPrecision(b.precision),h!==b.precision&&He("WebGLProgram.getParameters:",b.precision,"not supported, using",h,"instead."));const J=B.morphAttributes.position||B.morphAttributes.normal||B.morphAttributes.color,ce=J!==void 0?J.length:0;let We=0;B.morphAttributes.position!==void 0&&(We=1),B.morphAttributes.normal!==void 0&&(We=2),B.morphAttributes.color!==void 0&&(We=3);let qe,Pe,ne,ae;if(oe){const Ge=Qs[oe];qe=Ge.vertexShader,Pe=Ge.fragmentShader}else{qe=b.vertexShader,Pe=b.fragmentShader;const Ge=o.getVertexShaderStage(b),ht=o.getFragmentShaderStage(b);o.update(b,Ge,ht),ne=Ge.id,ae=ht.id}const ue=n.getRenderTarget(),Xe=n.state.buffers.depth.getReversed(),Ze=I.isInstancedMesh===!0,Fe=I.isBatchedMesh===!0,Lt=!!b.map,ot=!!b.matcap,yt=!!H,ut=!!b.aoMap,lt=!!b.lightMap,Gt=!!b.bumpMap&&b.wireframe===!1,Bt=!!b.normalMap,$t=!!b.displacementMap,xt=!!b.emissiveMap,Ct=!!b.metalnessMap,Pt=!!b.roughnessMap,j=b.anisotropy>0,Ft=b.clearcoat>0,vt=b.dispersion>0,N=b.iridescence>0,x=b.sheen>0,V=b.transmission>0,Z=j&&!!b.anisotropyMap,$=Ft&&!!b.clearcoatMap,pe=Ft&&!!b.clearcoatNormalMap,ye=Ft&&!!b.clearcoatRoughnessMap,te=N&&!!b.iridescenceMap,ie=N&&!!b.iridescenceThicknessMap,he=x&&!!b.sheenColorMap,Te=x&&!!b.sheenRoughnessMap,Me=!!b.specularMap,_e=!!b.specularColorMap,Ue=!!b.specularIntensityMap,je=V&&!!b.transmissionMap,$e=V&&!!b.thicknessMap,U=!!b.gradientMap,ze=!!b.alphaMap,re=b.alphaTest>0,we=!!b.alphaHash,Ee=!!b.extensions;let de=nn;b.toneMapped&&(ue===null||ue.isXRRenderTarget===!0)&&(de=n.toneMapping);const Be={shaderID:oe,shaderType:b.type,shaderName:b.name,vertexShader:qe,fragmentShader:Pe,defines:b.defines,customVertexShaderID:ne,customFragmentShaderID:ae,isRawShaderMaterial:b.isRawShaderMaterial===!0,glslVersion:b.glslVersion,precision:h,batching:Fe,batchingColor:Fe&&I._colorsTexture!==null,instancing:Ze,instancingColor:Ze&&I.instanceColor!==null,instancingMorph:Ze&&I.morphTexture!==null,outputColorSpace:ue===null?n.outputColorSpace:ue.isXRRenderTarget===!0?ue.texture.colorSpace:mt.workingColorSpace,alphaToCoverage:!!b.alphaToCoverage,map:Lt,matcap:ot,envMap:yt,envMapMode:yt&&H.mapping,envMapCubeUVHeight:X,aoMap:ut,lightMap:lt,bumpMap:Gt,normalMap:Bt,displacementMap:$t,emissiveMap:xt,normalMapObjectSpace:Bt&&b.normalMapType===Zv,normalMapTangentSpace:Bt&&b.normalMapType===Yd,packedNormalMap:Bt&&b.normalMapType===Yd&&bA(b.normalMap.format),metalnessMap:Ct,roughnessMap:Pt,anisotropy:j,anisotropyMap:Z,clearcoat:Ft,clearcoatMap:$,clearcoatNormalMap:pe,clearcoatRoughnessMap:ye,dispersion:vt,iridescence:N,iridescenceMap:te,iridescenceThicknessMap:ie,sheen:x,sheenColorMap:he,sheenRoughnessMap:Te,specularMap:Me,specularColorMap:_e,specularIntensityMap:Ue,transmission:V,transmissionMap:je,thicknessMap:$e,gradientMap:U,opaque:b.transparent===!1&&b.blending===Ei&&b.alphaToCoverage===!1,alphaMap:ze,alphaTest:re,alphaHash:we,combine:b.combine,mapUv:Lt&&f(b.map.channel),aoMapUv:ut&&f(b.aoMap.channel),lightMapUv:lt&&f(b.lightMap.channel),bumpMapUv:Gt&&f(b.bumpMap.channel),normalMapUv:Bt&&f(b.normalMap.channel),displacementMapUv:$t&&f(b.displacementMap.channel),emissiveMapUv:xt&&f(b.emissiveMap.channel),metalnessMapUv:Ct&&f(b.metalnessMap.channel),roughnessMapUv:Pt&&f(b.roughnessMap.channel),anisotropyMapUv:Z&&f(b.anisotropyMap.channel),clearcoatMapUv:$&&f(b.clearcoatMap.channel),clearcoatNormalMapUv:pe&&f(b.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:ye&&f(b.clearcoatRoughnessMap.channel),iridescenceMapUv:te&&f(b.iridescenceMap.channel),iridescenceThicknessMapUv:ie&&f(b.iridescenceThicknessMap.channel),sheenColorMapUv:he&&f(b.sheenColorMap.channel),sheenRoughnessMapUv:Te&&f(b.sheenRoughnessMap.channel),specularMapUv:Me&&f(b.specularMap.channel),specularColorMapUv:_e&&f(b.specularColorMap.channel),specularIntensityMapUv:Ue&&f(b.specularIntensityMap.channel),transmissionMapUv:je&&f(b.transmissionMap.channel),thicknessMapUv:$e&&f(b.thicknessMap.channel),alphaMapUv:ze&&f(b.alphaMap.channel),vertexTangents:!!B.attributes.tangent&&(Bt||j),vertexNormals:!!B.attributes.normal,vertexColors:b.vertexColors,vertexAlphas:b.vertexColors===!0&&!!B.attributes.color&&B.attributes.color.itemSize===4,pointsUvs:I.isPoints===!0&&!!B.attributes.uv&&(Lt||ze),fog:!!C,useFog:b.fog===!0,fogExp2:!!C&&C.isFogExp2,flatShading:b.wireframe===!1&&(b.flatShading===!0||B.attributes.normal===void 0&&Bt===!1&&(b.isMeshLambertMaterial||b.isMeshPhongMaterial||b.isMeshStandardMaterial||b.isMeshPhysicalMaterial)),sizeAttenuation:b.sizeAttenuation===!0,logarithmicDepthBuffer:u,reversedDepthBuffer:Xe,skinning:I.isSkinnedMesh===!0,hasPositionAttribute:B.attributes.position!==void 0,morphTargets:B.morphAttributes.position!==void 0,morphNormals:B.morphAttributes.normal!==void 0,morphColors:B.morphAttributes.color!==void 0,morphTargetsCount:ce,morphTextureStride:We,numDirLights:v.directional.length,numPointLights:v.point.length,numSpotLights:v.spot.length,numSpotLightMaps:v.spotLightMap.length,numRectAreaLights:v.rectArea.length,numHemiLights:v.hemi.length,numDirLightShadows:v.directionalShadowMap.length,numPointLightShadows:v.pointShadowMap.length,numSpotLightShadows:v.spotShadowMap.length,numSpotLightShadowsWithMaps:v.numSpotLightShadowsWithMaps,numLightProbes:v.numLightProbes,numLightProbeGrids:G.length,numClippingPlanes:r.numPlanes,numClipIntersection:r.numIntersection,dithering:b.dithering,shadowMapEnabled:n.shadowMap.enabled&&E.length>0,shadowMapType:n.shadowMap.type,toneMapping:de,decodeVideoTexture:Lt&&b.map.isVideoTexture===!0&&mt.getTransfer(b.map.colorSpace)===St,decodeVideoTextureEmissive:xt&&b.emissiveMap.isVideoTexture===!0&&mt.getTransfer(b.emissiveMap.colorSpace)===St,premultipliedAlpha:b.premultipliedAlpha,doubleSided:b.side===zn,flipSided:b.side===gs,useDepthPacking:b.depthPacking>=0,depthPacking:b.depthPacking||0,index0AttributeName:b.index0AttributeName,extensionClipCullDistance:Ee&&b.extensions.clipCullDistance===!0&&t.has("WEBGL_clip_cull_distance"),extensionMultiDraw:(Ee&&b.extensions.multiDraw===!0||Fe)&&t.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:t.has("KHR_parallel_shader_compile"),customProgramCacheKey:b.customProgramCacheKey()};return Be.vertexUv1s=l.has(1),Be.vertexUv2s=l.has(2),Be.vertexUv3s=l.has(3),l.clear(),Be}function g(b){const v=[];if(b.shaderID?v.push(b.shaderID):(v.push(b.customVertexShaderID),v.push(b.customFragmentShaderID)),b.defines!==void 0)for(const E in b.defines)v.push(E),v.push(b.defines[E]);return b.isRawShaderMaterial===!1&&(m(v,b),_(v,b),v.push(n.outputColorSpace)),v.push(b.customProgramCacheKey),v.join()}function m(b,v){b.push(v.precision),b.push(v.outputColorSpace),b.push(v.envMapMode),b.push(v.envMapCubeUVHeight),b.push(v.mapUv),b.push(v.alphaMapUv),b.push(v.lightMapUv),b.push(v.aoMapUv),b.push(v.bumpMapUv),b.push(v.normalMapUv),b.push(v.displacementMapUv),b.push(v.emissiveMapUv),b.push(v.metalnessMapUv),b.push(v.roughnessMapUv),b.push(v.anisotropyMapUv),b.push(v.clearcoatMapUv),b.push(v.clearcoatNormalMapUv),b.push(v.clearcoatRoughnessMapUv),b.push(v.iridescenceMapUv),b.push(v.iridescenceThicknessMapUv),b.push(v.sheenColorMapUv),b.push(v.sheenRoughnessMapUv),b.push(v.specularMapUv),b.push(v.specularColorMapUv),b.push(v.specularIntensityMapUv),b.push(v.transmissionMapUv),b.push(v.thicknessMapUv),b.push(v.combine),b.push(v.fogExp2),b.push(v.sizeAttenuation),b.push(v.morphTargetsCount),b.push(v.morphAttributeCount),b.push(v.numDirLights),b.push(v.numPointLights),b.push(v.numSpotLights),b.push(v.numSpotLightMaps),b.push(v.numHemiLights),b.push(v.numRectAreaLights),b.push(v.numDirLightShadows),b.push(v.numPointLightShadows),b.push(v.numSpotLightShadows),b.push(v.numSpotLightShadowsWithMaps),b.push(v.numLightProbes),b.push(v.shadowMapType),b.push(v.toneMapping),b.push(v.numClippingPlanes),b.push(v.numClipIntersection),b.push(v.depthPacking)}function _(b,v){a.disableAll(),v.instancing&&a.enable(0),v.instancingColor&&a.enable(1),v.instancingMorph&&a.enable(2),v.matcap&&a.enable(3),v.envMap&&a.enable(4),v.normalMapObjectSpace&&a.enable(5),v.normalMapTangentSpace&&a.enable(6),v.clearcoat&&a.enable(7),v.iridescence&&a.enable(8),v.alphaTest&&a.enable(9),v.vertexColors&&a.enable(10),v.vertexAlphas&&a.enable(11),v.vertexUv1s&&a.enable(12),v.vertexUv2s&&a.enable(13),v.vertexUv3s&&a.enable(14),v.vertexTangents&&a.enable(15),v.anisotropy&&a.enable(16),v.alphaHash&&a.enable(17),v.batching&&a.enable(18),v.dispersion&&a.enable(19),v.batchingColor&&a.enable(20),v.gradientMap&&a.enable(21),v.packedNormalMap&&a.enable(22),v.vertexNormals&&a.enable(23),b.push(a.mask),a.disableAll(),v.fog&&a.enable(0),v.useFog&&a.enable(1),v.flatShading&&a.enable(2),v.logarithmicDepthBuffer&&a.enable(3),v.reversedDepthBuffer&&a.enable(4),v.skinning&&a.enable(5),v.morphTargets&&a.enable(6),v.morphNormals&&a.enable(7),v.morphColors&&a.enable(8),v.premultipliedAlpha&&a.enable(9),v.shadowMapEnabled&&a.enable(10),v.doubleSided&&a.enable(11),v.flipSided&&a.enable(12),v.useDepthPacking&&a.enable(13),v.dithering&&a.enable(14),v.transmission&&a.enable(15),v.sheen&&a.enable(16),v.opaque&&a.enable(17),v.pointsUvs&&a.enable(18),v.decodeVideoTexture&&a.enable(19),v.decodeVideoTextureEmissive&&a.enable(20),v.alphaToCoverage&&a.enable(21),v.numLightProbeGrids>0&&a.enable(22),v.hasPositionAttribute&&a.enable(23),b.push(a.mask)}function w(b){const v=p[b.type];let E;if(v){const A=Qs[v];E=PO.clone(A.uniforms)}else E=b.uniforms;return E}function z(b,v){let E=d.get(v);return E!==void 0?++E.usedTimes:(E=new pA(n,v,b,i),c.push(E),d.set(v,E)),E}function y(b){if(--b.usedTimes===0){const v=c.indexOf(b);c[v]=c[c.length-1],c.pop(),d.delete(b.cacheKey),b.destroy()}}function O(b){o.remove(b)}function S(){o.dispose()}return{getParameters:M,getProgramCacheKey:g,getUniforms:w,acquireProgram:z,releaseProgram:y,releaseShaderCache:O,programs:c,dispose:S}}function zA(){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 wA(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 Sp(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 Ep(){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 p=0;return h.isInstancedMesh&&(p+=2),h.isSkinnedMesh&&(p+=1),p}function o(h,p,f,M,g,m){let _=n[e];return _===void 0?(_={id:h.id,object:h,geometry:p,material:f,materialVariant:a(h),groupOrder:M,renderOrder:h.renderOrder,z:g,group:m},n[e]=_):(_.id=h.id,_.object=h,_.geometry=p,_.material=f,_.materialVariant=a(h),_.groupOrder=M,_.renderOrder=h.renderOrder,_.z=g,_.group=m),e++,_}function l(h,p,f,M,g,m){const _=o(h,p,f,M,g,m);f.transmission>0?s.push(_):f.transparent===!0?i.push(_):t.push(_)}function c(h,p,f,M,g,m){const _=o(h,p,f,M,g,m);f.transmission>0?s.unshift(_):f.transparent===!0?i.unshift(_):t.unshift(_)}function d(h,p,f){t.length>1&&t.sort(h||wA),s.length>1&&s.sort(p||Sp),i.length>1&&i.sort(p||Sp),f&&(t.reverse(),s.reverse(),i.reverse())}function u(){for(let h=e,p=n.length;h<p;h++){const f=n[h];if(f.id===null)break;f.id=null,f.object=null,f.geometry=null,f.material=null,f.group=null}}return{opaque:t,transmissive:s,transparent:i,init:r,push:l,unshift:c,finish:u,sort:d}}function yA(){let n=new WeakMap;function e(s,i){const r=n.get(s);let a;return r===void 0?(a=new Ep,n.set(s,[a])):i>=r.length?(a=new Ep,r.push(a)):a=r[i],a}function t(){n=new WeakMap}return{get:e,dispose:t}}function vA(){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 W,color:new ke};break;case"SpotLight":t={position:new W,direction:new W,color:new ke,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":t={position:new W,color:new ke,distance:0,decay:0};break;case"HemisphereLight":t={direction:new W,skyColor:new ke,groundColor:new ke};break;case"RectAreaLight":t={color:new ke,position:new W,halfWidth:new W,halfHeight:new W};break}return n[e.id]=t,t}}}function OA(){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 et};break;case"SpotLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new et};break;case"PointLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new et,shadowCameraNear:1,shadowCameraFar:1e3};break}return n[e.id]=t,t}}}let xA=0;function SA(n,e){return(e.castShadow?2:0)-(n.castShadow?2:0)+(e.map?1:0)-(n.map?1:0)}function EA(n){const e=new vA,t=OA(),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 W);const i=new W,r=new wt,a=new wt;function o(c){let d=0,u=0,h=0;for(let v=0;v<9;v++)s.probe[v].set(0,0,0);let p=0,f=0,M=0,g=0,m=0,_=0,w=0,z=0,y=0,O=0,S=0;c.sort(SA);for(let v=0,E=c.length;v<E;v++){const A=c[v],I=A.color,G=A.intensity,C=A.distance;let B=null;if(A.shadow&&A.shadow.map&&(A.shadow.map.texture.format===Wi?B=A.shadow.map.texture:B=A.shadow.map.depthTexture||A.shadow.map.texture),A.isAmbientLight)d+=I.r*G,u+=I.g*G,h+=I.b*G;else if(A.isLightProbe){for(let P=0;P<9;P++)s.probe[P].addScaledVector(A.sh.coefficients[P],G);S++}else if(A.isDirectionalLight){const P=e.get(A);if(P.color.copy(A.color).multiplyScalar(A.intensity),A.castShadow){const L=A.shadow,H=t.get(A);H.shadowIntensity=L.intensity,H.shadowBias=L.bias,H.shadowNormalBias=L.normalBias,H.shadowRadius=L.radius,H.shadowMapSize=L.mapSize,s.directionalShadow[p]=H,s.directionalShadowMap[p]=B,s.directionalShadowMatrix[p]=A.shadow.matrix,_++}s.directional[p]=P,p++}else if(A.isSpotLight){const P=e.get(A);P.position.setFromMatrixPosition(A.matrixWorld),P.color.copy(I).multiplyScalar(G),P.distance=C,P.coneCos=Math.cos(A.angle),P.penumbraCos=Math.cos(A.angle*(1-A.penumbra)),P.decay=A.decay,s.spot[M]=P;const L=A.shadow;if(A.map&&(s.spotLightMap[y]=A.map,y++,L.updateMatrices(A),A.castShadow&&O++),s.spotLightMatrix[M]=L.matrix,A.castShadow){const H=t.get(A);H.shadowIntensity=L.intensity,H.shadowBias=L.bias,H.shadowNormalBias=L.normalBias,H.shadowRadius=L.radius,H.shadowMapSize=L.mapSize,s.spotShadow[M]=H,s.spotShadowMap[M]=B,z++}M++}else if(A.isRectAreaLight){const P=e.get(A);P.color.copy(I).multiplyScalar(G),P.halfWidth.set(A.width*.5,0,0),P.halfHeight.set(0,A.height*.5,0),s.rectArea[g]=P,g++}else if(A.isPointLight){const P=e.get(A);if(P.color.copy(A.color).multiplyScalar(A.intensity),P.distance=A.distance,P.decay=A.decay,A.castShadow){const L=A.shadow,H=t.get(A);H.shadowIntensity=L.intensity,H.shadowBias=L.bias,H.shadowNormalBias=L.normalBias,H.shadowRadius=L.radius,H.shadowMapSize=L.mapSize,H.shadowCameraNear=L.camera.near,H.shadowCameraFar=L.camera.far,s.pointShadow[f]=H,s.pointShadowMap[f]=B,s.pointShadowMatrix[f]=A.shadow.matrix,w++}s.point[f]=P,f++}else if(A.isHemisphereLight){const P=e.get(A);P.skyColor.copy(A.color).multiplyScalar(G),P.groundColor.copy(A.groundColor).multiplyScalar(G),s.hemi[m]=P,m++}}g>0&&(n.has("OES_texture_float_linear")===!0?(s.rectAreaLTC1=Se.LTC_FLOAT_1,s.rectAreaLTC2=Se.LTC_FLOAT_2):(s.rectAreaLTC1=Se.LTC_HALF_1,s.rectAreaLTC2=Se.LTC_HALF_2)),s.ambient[0]=d,s.ambient[1]=u,s.ambient[2]=h;const b=s.hash;(b.directionalLength!==p||b.pointLength!==f||b.spotLength!==M||b.rectAreaLength!==g||b.hemiLength!==m||b.numDirectionalShadows!==_||b.numPointShadows!==w||b.numSpotShadows!==z||b.numSpotMaps!==y||b.numLightProbes!==S)&&(s.directional.length=p,s.spot.length=M,s.rectArea.length=g,s.point.length=f,s.hemi.length=m,s.directionalShadow.length=_,s.directionalShadowMap.length=_,s.pointShadow.length=w,s.pointShadowMap.length=w,s.spotShadow.length=z,s.spotShadowMap.length=z,s.directionalShadowMatrix.length=_,s.pointShadowMatrix.length=w,s.spotLightMatrix.length=z+y-O,s.spotLightMap.length=y,s.numSpotLightShadowsWithMaps=O,s.numLightProbes=S,b.directionalLength=p,b.pointLength=f,b.spotLength=M,b.rectAreaLength=g,b.hemiLength=m,b.numDirectionalShadows=_,b.numPointShadows=w,b.numSpotShadows=z,b.numSpotMaps=y,b.numLightProbes=S,s.version=xA++)}function l(c,d){let u=0,h=0,p=0,f=0,M=0;const g=d.matrixWorldInverse;for(let m=0,_=c.length;m<_;m++){const w=c[m];if(w.isDirectionalLight){const z=s.directional[u];z.direction.setFromMatrixPosition(w.matrixWorld),i.setFromMatrixPosition(w.target.matrixWorld),z.direction.sub(i),z.direction.transformDirection(g),u++}else if(w.isSpotLight){const z=s.spot[p];z.position.setFromMatrixPosition(w.matrixWorld),z.position.applyMatrix4(g),z.direction.setFromMatrixPosition(w.matrixWorld),i.setFromMatrixPosition(w.target.matrixWorld),z.direction.sub(i),z.direction.transformDirection(g),p++}else if(w.isRectAreaLight){const z=s.rectArea[f];z.position.setFromMatrixPosition(w.matrixWorld),z.position.applyMatrix4(g),a.identity(),r.copy(w.matrixWorld),r.premultiply(g),a.extractRotation(r),z.halfWidth.set(w.width*.5,0,0),z.halfHeight.set(0,w.height*.5,0),z.halfWidth.applyMatrix4(a),z.halfHeight.applyMatrix4(a),f++}else if(w.isPointLight){const z=s.point[h];z.position.setFromMatrixPosition(w.matrixWorld),z.position.applyMatrix4(g),h++}else if(w.isHemisphereLight){const z=s.hemi[M];z.direction.setFromMatrixPosition(w.matrixWorld),z.direction.transformDirection(g),M++}}}return{setup:o,setupView:l,state:s}}function Ap(n){const e=new EA(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 AA(n){let e=new WeakMap;function t(i,r=0){const a=e.get(i);let o;return a===void 0?(o=new Ap(n),e.set(i,[o])):r>=a.length?(o=new Ap(n),a.push(o)):o=a[r],o}function s(){e=new WeakMap}return{get:t,dispose:s}}const DA=`void main() {
4088
+ `+J)}else B!==""?He("WebGLProgram: Program Info Log:",B):(P===""||W==="")&&(X=!1);X&&(A.diagnostics={runnable:H,programLog:B,vertexShader:{log:P,prefix:g},fragmentShader:{log:W,prefix:m}})}i.deleteShader(y),i.deleteShader(O),b=new Do(i,M),v=J1(i,M)}let b;this.getUniforms=function(){return b===void 0&&S(this),b};let v;this.getAttributes=function(){return v===void 0&&S(this),v};let E=t.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return E===!1&&(E=i.getProgramParameter(M,j1)),E},this.destroy=function(){s.releaseStatesOfProgram(this),i.deleteProgram(M),this.program=void 0},this.type=t.shaderType,this.name=t.shaderName,this.id=$1++,this.cacheKey=e,this.usedTimes=1,this.program=M,this.vertexShader=y,this.fragmentShader=O,this}let mA=0;class gA{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 MA(e),t.set(e,s)),s}}class MA{constructor(e){this.id=mA++,this.code=e,this.usedTimes=0}}function bA(n){return n===Wi||n===Zo||n===Qo}function _A(n,e,t,s,i,r){const a=new Hu,o=new gA,l=new Set,c=[],d=new Map,u=s.logarithmicDepthBuffer;let h=s.precision;const p={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 f(b){return l.add(b),b===0?"uv":`uv${b}`}function M(b,v,E,A,I,G){const C=A.fog,B=I.geometry,P=b.isMeshStandardMaterial||b.isMeshLambertMaterial||b.isMeshPhongMaterial?A.environment:null,W=b.isMeshStandardMaterial||b.isMeshLambertMaterial&&!b.envMap||b.isMeshPhongMaterial&&!b.envMap,H=e.get(b.envMap||P,W),X=H&&H.mapping===zl?H.image.height:null,oe=p[b.type];b.precision!==null&&(h=s.getMaxPrecision(b.precision),h!==b.precision&&He("WebGLProgram.getParameters:",b.precision,"not supported, using",h,"instead."));const J=B.morphAttributes.position||B.morphAttributes.normal||B.morphAttributes.color,ce=J!==void 0?J.length:0;let We=0;B.morphAttributes.position!==void 0&&(We=1),B.morphAttributes.normal!==void 0&&(We=2),B.morphAttributes.color!==void 0&&(We=3);let qe,Pe,ne,ae;if(oe){const Ge=Qs[oe];qe=Ge.vertexShader,Pe=Ge.fragmentShader}else{qe=b.vertexShader,Pe=b.fragmentShader;const Ge=o.getVertexShaderStage(b),ht=o.getFragmentShaderStage(b);o.update(b,Ge,ht),ne=Ge.id,ae=ht.id}const ue=n.getRenderTarget(),Xe=n.state.buffers.depth.getReversed(),Ze=I.isInstancedMesh===!0,Fe=I.isBatchedMesh===!0,Lt=!!b.map,ot=!!b.matcap,yt=!!H,ut=!!b.aoMap,lt=!!b.lightMap,Gt=!!b.bumpMap&&b.wireframe===!1,Bt=!!b.normalMap,$t=!!b.displacementMap,xt=!!b.emissiveMap,Ct=!!b.metalnessMap,Pt=!!b.roughnessMap,j=b.anisotropy>0,Ft=b.clearcoat>0,vt=b.dispersion>0,N=b.iridescence>0,x=b.sheen>0,V=b.transmission>0,Z=j&&!!b.anisotropyMap,$=Ft&&!!b.clearcoatMap,pe=Ft&&!!b.clearcoatNormalMap,ye=Ft&&!!b.clearcoatRoughnessMap,te=N&&!!b.iridescenceMap,ie=N&&!!b.iridescenceThicknessMap,he=x&&!!b.sheenColorMap,Te=x&&!!b.sheenRoughnessMap,Me=!!b.specularMap,_e=!!b.specularColorMap,Ue=!!b.specularIntensityMap,je=V&&!!b.transmissionMap,$e=V&&!!b.thicknessMap,U=!!b.gradientMap,ze=!!b.alphaMap,re=b.alphaTest>0,we=!!b.alphaHash,Ee=!!b.extensions;let de=nn;b.toneMapped&&(ue===null||ue.isXRRenderTarget===!0)&&(de=n.toneMapping);const Be={shaderID:oe,shaderType:b.type,shaderName:b.name,vertexShader:qe,fragmentShader:Pe,defines:b.defines,customVertexShaderID:ne,customFragmentShaderID:ae,isRawShaderMaterial:b.isRawShaderMaterial===!0,glslVersion:b.glslVersion,precision:h,batching:Fe,batchingColor:Fe&&I._colorsTexture!==null,instancing:Ze,instancingColor:Ze&&I.instanceColor!==null,instancingMorph:Ze&&I.morphTexture!==null,outputColorSpace:ue===null?n.outputColorSpace:ue.isXRRenderTarget===!0?ue.texture.colorSpace:mt.workingColorSpace,alphaToCoverage:!!b.alphaToCoverage,map:Lt,matcap:ot,envMap:yt,envMapMode:yt&&H.mapping,envMapCubeUVHeight:X,aoMap:ut,lightMap:lt,bumpMap:Gt,normalMap:Bt,displacementMap:$t,emissiveMap:xt,normalMapObjectSpace:Bt&&b.normalMapType===Zv,normalMapTangentSpace:Bt&&b.normalMapType===Yd,packedNormalMap:Bt&&b.normalMapType===Yd&&bA(b.normalMap.format),metalnessMap:Ct,roughnessMap:Pt,anisotropy:j,anisotropyMap:Z,clearcoat:Ft,clearcoatMap:$,clearcoatNormalMap:pe,clearcoatRoughnessMap:ye,dispersion:vt,iridescence:N,iridescenceMap:te,iridescenceThicknessMap:ie,sheen:x,sheenColorMap:he,sheenRoughnessMap:Te,specularMap:Me,specularColorMap:_e,specularIntensityMap:Ue,transmission:V,transmissionMap:je,thicknessMap:$e,gradientMap:U,opaque:b.transparent===!1&&b.blending===Ei&&b.alphaToCoverage===!1,alphaMap:ze,alphaTest:re,alphaHash:we,combine:b.combine,mapUv:Lt&&f(b.map.channel),aoMapUv:ut&&f(b.aoMap.channel),lightMapUv:lt&&f(b.lightMap.channel),bumpMapUv:Gt&&f(b.bumpMap.channel),normalMapUv:Bt&&f(b.normalMap.channel),displacementMapUv:$t&&f(b.displacementMap.channel),emissiveMapUv:xt&&f(b.emissiveMap.channel),metalnessMapUv:Ct&&f(b.metalnessMap.channel),roughnessMapUv:Pt&&f(b.roughnessMap.channel),anisotropyMapUv:Z&&f(b.anisotropyMap.channel),clearcoatMapUv:$&&f(b.clearcoatMap.channel),clearcoatNormalMapUv:pe&&f(b.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:ye&&f(b.clearcoatRoughnessMap.channel),iridescenceMapUv:te&&f(b.iridescenceMap.channel),iridescenceThicknessMapUv:ie&&f(b.iridescenceThicknessMap.channel),sheenColorMapUv:he&&f(b.sheenColorMap.channel),sheenRoughnessMapUv:Te&&f(b.sheenRoughnessMap.channel),specularMapUv:Me&&f(b.specularMap.channel),specularColorMapUv:_e&&f(b.specularColorMap.channel),specularIntensityMapUv:Ue&&f(b.specularIntensityMap.channel),transmissionMapUv:je&&f(b.transmissionMap.channel),thicknessMapUv:$e&&f(b.thicknessMap.channel),alphaMapUv:ze&&f(b.alphaMap.channel),vertexTangents:!!B.attributes.tangent&&(Bt||j),vertexNormals:!!B.attributes.normal,vertexColors:b.vertexColors,vertexAlphas:b.vertexColors===!0&&!!B.attributes.color&&B.attributes.color.itemSize===4,pointsUvs:I.isPoints===!0&&!!B.attributes.uv&&(Lt||ze),fog:!!C,useFog:b.fog===!0,fogExp2:!!C&&C.isFogExp2,flatShading:b.wireframe===!1&&(b.flatShading===!0||B.attributes.normal===void 0&&Bt===!1&&(b.isMeshLambertMaterial||b.isMeshPhongMaterial||b.isMeshStandardMaterial||b.isMeshPhysicalMaterial)),sizeAttenuation:b.sizeAttenuation===!0,logarithmicDepthBuffer:u,reversedDepthBuffer:Xe,skinning:I.isSkinnedMesh===!0,hasPositionAttribute:B.attributes.position!==void 0,morphTargets:B.morphAttributes.position!==void 0,morphNormals:B.morphAttributes.normal!==void 0,morphColors:B.morphAttributes.color!==void 0,morphTargetsCount:ce,morphTextureStride:We,numDirLights:v.directional.length,numPointLights:v.point.length,numSpotLights:v.spot.length,numSpotLightMaps:v.spotLightMap.length,numRectAreaLights:v.rectArea.length,numHemiLights:v.hemi.length,numDirLightShadows:v.directionalShadowMap.length,numPointLightShadows:v.pointShadowMap.length,numSpotLightShadows:v.spotShadowMap.length,numSpotLightShadowsWithMaps:v.numSpotLightShadowsWithMaps,numLightProbes:v.numLightProbes,numLightProbeGrids:G.length,numClippingPlanes:r.numPlanes,numClipIntersection:r.numIntersection,dithering:b.dithering,shadowMapEnabled:n.shadowMap.enabled&&E.length>0,shadowMapType:n.shadowMap.type,toneMapping:de,decodeVideoTexture:Lt&&b.map.isVideoTexture===!0&&mt.getTransfer(b.map.colorSpace)===St,decodeVideoTextureEmissive:xt&&b.emissiveMap.isVideoTexture===!0&&mt.getTransfer(b.emissiveMap.colorSpace)===St,premultipliedAlpha:b.premultipliedAlpha,doubleSided:b.side===zn,flipSided:b.side===gs,useDepthPacking:b.depthPacking>=0,depthPacking:b.depthPacking||0,index0AttributeName:b.index0AttributeName,extensionClipCullDistance:Ee&&b.extensions.clipCullDistance===!0&&t.has("WEBGL_clip_cull_distance"),extensionMultiDraw:(Ee&&b.extensions.multiDraw===!0||Fe)&&t.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:t.has("KHR_parallel_shader_compile"),customProgramCacheKey:b.customProgramCacheKey()};return Be.vertexUv1s=l.has(1),Be.vertexUv2s=l.has(2),Be.vertexUv3s=l.has(3),l.clear(),Be}function g(b){const v=[];if(b.shaderID?v.push(b.shaderID):(v.push(b.customVertexShaderID),v.push(b.customFragmentShaderID)),b.defines!==void 0)for(const E in b.defines)v.push(E),v.push(b.defines[E]);return b.isRawShaderMaterial===!1&&(m(v,b),_(v,b),v.push(n.outputColorSpace)),v.push(b.customProgramCacheKey),v.join()}function m(b,v){b.push(v.precision),b.push(v.outputColorSpace),b.push(v.envMapMode),b.push(v.envMapCubeUVHeight),b.push(v.mapUv),b.push(v.alphaMapUv),b.push(v.lightMapUv),b.push(v.aoMapUv),b.push(v.bumpMapUv),b.push(v.normalMapUv),b.push(v.displacementMapUv),b.push(v.emissiveMapUv),b.push(v.metalnessMapUv),b.push(v.roughnessMapUv),b.push(v.anisotropyMapUv),b.push(v.clearcoatMapUv),b.push(v.clearcoatNormalMapUv),b.push(v.clearcoatRoughnessMapUv),b.push(v.iridescenceMapUv),b.push(v.iridescenceThicknessMapUv),b.push(v.sheenColorMapUv),b.push(v.sheenRoughnessMapUv),b.push(v.specularMapUv),b.push(v.specularColorMapUv),b.push(v.specularIntensityMapUv),b.push(v.transmissionMapUv),b.push(v.thicknessMapUv),b.push(v.combine),b.push(v.fogExp2),b.push(v.sizeAttenuation),b.push(v.morphTargetsCount),b.push(v.morphAttributeCount),b.push(v.numDirLights),b.push(v.numPointLights),b.push(v.numSpotLights),b.push(v.numSpotLightMaps),b.push(v.numHemiLights),b.push(v.numRectAreaLights),b.push(v.numDirLightShadows),b.push(v.numPointLightShadows),b.push(v.numSpotLightShadows),b.push(v.numSpotLightShadowsWithMaps),b.push(v.numLightProbes),b.push(v.shadowMapType),b.push(v.toneMapping),b.push(v.numClippingPlanes),b.push(v.numClipIntersection),b.push(v.depthPacking)}function _(b,v){a.disableAll(),v.instancing&&a.enable(0),v.instancingColor&&a.enable(1),v.instancingMorph&&a.enable(2),v.matcap&&a.enable(3),v.envMap&&a.enable(4),v.normalMapObjectSpace&&a.enable(5),v.normalMapTangentSpace&&a.enable(6),v.clearcoat&&a.enable(7),v.iridescence&&a.enable(8),v.alphaTest&&a.enable(9),v.vertexColors&&a.enable(10),v.vertexAlphas&&a.enable(11),v.vertexUv1s&&a.enable(12),v.vertexUv2s&&a.enable(13),v.vertexUv3s&&a.enable(14),v.vertexTangents&&a.enable(15),v.anisotropy&&a.enable(16),v.alphaHash&&a.enable(17),v.batching&&a.enable(18),v.dispersion&&a.enable(19),v.batchingColor&&a.enable(20),v.gradientMap&&a.enable(21),v.packedNormalMap&&a.enable(22),v.vertexNormals&&a.enable(23),b.push(a.mask),a.disableAll(),v.fog&&a.enable(0),v.useFog&&a.enable(1),v.flatShading&&a.enable(2),v.logarithmicDepthBuffer&&a.enable(3),v.reversedDepthBuffer&&a.enable(4),v.skinning&&a.enable(5),v.morphTargets&&a.enable(6),v.morphNormals&&a.enable(7),v.morphColors&&a.enable(8),v.premultipliedAlpha&&a.enable(9),v.shadowMapEnabled&&a.enable(10),v.doubleSided&&a.enable(11),v.flipSided&&a.enable(12),v.useDepthPacking&&a.enable(13),v.dithering&&a.enable(14),v.transmission&&a.enable(15),v.sheen&&a.enable(16),v.opaque&&a.enable(17),v.pointsUvs&&a.enable(18),v.decodeVideoTexture&&a.enable(19),v.decodeVideoTextureEmissive&&a.enable(20),v.alphaToCoverage&&a.enable(21),v.numLightProbeGrids>0&&a.enable(22),v.hasPositionAttribute&&a.enable(23),b.push(a.mask)}function w(b){const v=p[b.type];let E;if(v){const A=Qs[v];E=PO.clone(A.uniforms)}else E=b.uniforms;return E}function z(b,v){let E=d.get(v);return E!==void 0?++E.usedTimes:(E=new pA(n,v,b,i),c.push(E),d.set(v,E)),E}function y(b){if(--b.usedTimes===0){const v=c.indexOf(b);c[v]=c[c.length-1],c.pop(),d.delete(b.cacheKey),b.destroy()}}function O(b){o.remove(b)}function S(){o.dispose()}return{getParameters:M,getProgramCacheKey:g,getUniforms:w,acquireProgram:z,releaseProgram:y,releaseShaderCache:O,programs:c,dispose:S}}function zA(){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 wA(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 Sp(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 Ep(){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 p=0;return h.isInstancedMesh&&(p+=2),h.isSkinnedMesh&&(p+=1),p}function o(h,p,f,M,g,m){let _=n[e];return _===void 0?(_={id:h.id,object:h,geometry:p,material:f,materialVariant:a(h),groupOrder:M,renderOrder:h.renderOrder,z:g,group:m},n[e]=_):(_.id=h.id,_.object=h,_.geometry=p,_.material=f,_.materialVariant=a(h),_.groupOrder=M,_.renderOrder=h.renderOrder,_.z=g,_.group=m),e++,_}function l(h,p,f,M,g,m){const _=o(h,p,f,M,g,m);f.transmission>0?s.push(_):f.transparent===!0?i.push(_):t.push(_)}function c(h,p,f,M,g,m){const _=o(h,p,f,M,g,m);f.transmission>0?s.unshift(_):f.transparent===!0?i.unshift(_):t.unshift(_)}function d(h,p,f){t.length>1&&t.sort(h||wA),s.length>1&&s.sort(p||Sp),i.length>1&&i.sort(p||Sp),f&&(t.reverse(),s.reverse(),i.reverse())}function u(){for(let h=e,p=n.length;h<p;h++){const f=n[h];if(f.id===null)break;f.id=null,f.object=null,f.geometry=null,f.material=null,f.group=null}}return{opaque:t,transmissive:s,transparent:i,init:r,push:l,unshift:c,finish:u,sort:d}}function yA(){let n=new WeakMap;function e(s,i){const r=n.get(s);let a;return r===void 0?(a=new Ep,n.set(s,[a])):i>=r.length?(a=new Ep,r.push(a)):a=r[i],a}function t(){n=new WeakMap}return{get:e,dispose:t}}function vA(){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 k,color:new ke};break;case"SpotLight":t={position:new k,direction:new k,color:new ke,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":t={position:new k,color:new ke,distance:0,decay:0};break;case"HemisphereLight":t={direction:new k,skyColor:new ke,groundColor:new ke};break;case"RectAreaLight":t={color:new ke,position:new k,halfWidth:new k,halfHeight:new k};break}return n[e.id]=t,t}}}function OA(){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 et};break;case"SpotLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new et};break;case"PointLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new et,shadowCameraNear:1,shadowCameraFar:1e3};break}return n[e.id]=t,t}}}let xA=0;function SA(n,e){return(e.castShadow?2:0)-(n.castShadow?2:0)+(e.map?1:0)-(n.map?1:0)}function EA(n){const e=new vA,t=OA(),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 k);const i=new k,r=new wt,a=new wt;function o(c){let d=0,u=0,h=0;for(let v=0;v<9;v++)s.probe[v].set(0,0,0);let p=0,f=0,M=0,g=0,m=0,_=0,w=0,z=0,y=0,O=0,S=0;c.sort(SA);for(let v=0,E=c.length;v<E;v++){const A=c[v],I=A.color,G=A.intensity,C=A.distance;let B=null;if(A.shadow&&A.shadow.map&&(A.shadow.map.texture.format===Wi?B=A.shadow.map.texture:B=A.shadow.map.depthTexture||A.shadow.map.texture),A.isAmbientLight)d+=I.r*G,u+=I.g*G,h+=I.b*G;else if(A.isLightProbe){for(let P=0;P<9;P++)s.probe[P].addScaledVector(A.sh.coefficients[P],G);S++}else if(A.isDirectionalLight){const P=e.get(A);if(P.color.copy(A.color).multiplyScalar(A.intensity),A.castShadow){const W=A.shadow,H=t.get(A);H.shadowIntensity=W.intensity,H.shadowBias=W.bias,H.shadowNormalBias=W.normalBias,H.shadowRadius=W.radius,H.shadowMapSize=W.mapSize,s.directionalShadow[p]=H,s.directionalShadowMap[p]=B,s.directionalShadowMatrix[p]=A.shadow.matrix,_++}s.directional[p]=P,p++}else if(A.isSpotLight){const P=e.get(A);P.position.setFromMatrixPosition(A.matrixWorld),P.color.copy(I).multiplyScalar(G),P.distance=C,P.coneCos=Math.cos(A.angle),P.penumbraCos=Math.cos(A.angle*(1-A.penumbra)),P.decay=A.decay,s.spot[M]=P;const W=A.shadow;if(A.map&&(s.spotLightMap[y]=A.map,y++,W.updateMatrices(A),A.castShadow&&O++),s.spotLightMatrix[M]=W.matrix,A.castShadow){const H=t.get(A);H.shadowIntensity=W.intensity,H.shadowBias=W.bias,H.shadowNormalBias=W.normalBias,H.shadowRadius=W.radius,H.shadowMapSize=W.mapSize,s.spotShadow[M]=H,s.spotShadowMap[M]=B,z++}M++}else if(A.isRectAreaLight){const P=e.get(A);P.color.copy(I).multiplyScalar(G),P.halfWidth.set(A.width*.5,0,0),P.halfHeight.set(0,A.height*.5,0),s.rectArea[g]=P,g++}else if(A.isPointLight){const P=e.get(A);if(P.color.copy(A.color).multiplyScalar(A.intensity),P.distance=A.distance,P.decay=A.decay,A.castShadow){const W=A.shadow,H=t.get(A);H.shadowIntensity=W.intensity,H.shadowBias=W.bias,H.shadowNormalBias=W.normalBias,H.shadowRadius=W.radius,H.shadowMapSize=W.mapSize,H.shadowCameraNear=W.camera.near,H.shadowCameraFar=W.camera.far,s.pointShadow[f]=H,s.pointShadowMap[f]=B,s.pointShadowMatrix[f]=A.shadow.matrix,w++}s.point[f]=P,f++}else if(A.isHemisphereLight){const P=e.get(A);P.skyColor.copy(A.color).multiplyScalar(G),P.groundColor.copy(A.groundColor).multiplyScalar(G),s.hemi[m]=P,m++}}g>0&&(n.has("OES_texture_float_linear")===!0?(s.rectAreaLTC1=Se.LTC_FLOAT_1,s.rectAreaLTC2=Se.LTC_FLOAT_2):(s.rectAreaLTC1=Se.LTC_HALF_1,s.rectAreaLTC2=Se.LTC_HALF_2)),s.ambient[0]=d,s.ambient[1]=u,s.ambient[2]=h;const b=s.hash;(b.directionalLength!==p||b.pointLength!==f||b.spotLength!==M||b.rectAreaLength!==g||b.hemiLength!==m||b.numDirectionalShadows!==_||b.numPointShadows!==w||b.numSpotShadows!==z||b.numSpotMaps!==y||b.numLightProbes!==S)&&(s.directional.length=p,s.spot.length=M,s.rectArea.length=g,s.point.length=f,s.hemi.length=m,s.directionalShadow.length=_,s.directionalShadowMap.length=_,s.pointShadow.length=w,s.pointShadowMap.length=w,s.spotShadow.length=z,s.spotShadowMap.length=z,s.directionalShadowMatrix.length=_,s.pointShadowMatrix.length=w,s.spotLightMatrix.length=z+y-O,s.spotLightMap.length=y,s.numSpotLightShadowsWithMaps=O,s.numLightProbes=S,b.directionalLength=p,b.pointLength=f,b.spotLength=M,b.rectAreaLength=g,b.hemiLength=m,b.numDirectionalShadows=_,b.numPointShadows=w,b.numSpotShadows=z,b.numSpotMaps=y,b.numLightProbes=S,s.version=xA++)}function l(c,d){let u=0,h=0,p=0,f=0,M=0;const g=d.matrixWorldInverse;for(let m=0,_=c.length;m<_;m++){const w=c[m];if(w.isDirectionalLight){const z=s.directional[u];z.direction.setFromMatrixPosition(w.matrixWorld),i.setFromMatrixPosition(w.target.matrixWorld),z.direction.sub(i),z.direction.transformDirection(g),u++}else if(w.isSpotLight){const z=s.spot[p];z.position.setFromMatrixPosition(w.matrixWorld),z.position.applyMatrix4(g),z.direction.setFromMatrixPosition(w.matrixWorld),i.setFromMatrixPosition(w.target.matrixWorld),z.direction.sub(i),z.direction.transformDirection(g),p++}else if(w.isRectAreaLight){const z=s.rectArea[f];z.position.setFromMatrixPosition(w.matrixWorld),z.position.applyMatrix4(g),a.identity(),r.copy(w.matrixWorld),r.premultiply(g),a.extractRotation(r),z.halfWidth.set(w.width*.5,0,0),z.halfHeight.set(0,w.height*.5,0),z.halfWidth.applyMatrix4(a),z.halfHeight.applyMatrix4(a),f++}else if(w.isPointLight){const z=s.point[h];z.position.setFromMatrixPosition(w.matrixWorld),z.position.applyMatrix4(g),h++}else if(w.isHemisphereLight){const z=s.hemi[M];z.direction.setFromMatrixPosition(w.matrixWorld),z.direction.transformDirection(g),M++}}}return{setup:o,setupView:l,state:s}}function Ap(n){const e=new EA(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 AA(n){let e=new WeakMap;function t(i,r=0){const a=e.get(i);let o;return a===void 0?(o=new Ap(n),e.set(i,[o])):r>=a.length?(o=new Ap(n),a.push(o)):o=a[r],o}function s(){e=new WeakMap}return{get:t,dispose:s}}const DA=`void main() {
4089
4089
  gl_Position = vec4( position, 1.0 );
4090
4090
  }`,TA=`uniform sampler2D shadow_pass;
4091
4091
  uniform vec2 resolution;
@@ -4112,7 +4112,7 @@ void main() {
4112
4112
  squared_mean = squared_mean / samples;
4113
4113
  float std_dev = sqrt( max( 0.0, squared_mean - mean * mean ) );
4114
4114
  gl_FragColor = vec4( mean, std_dev, 0.0, 1.0 );
4115
- }`,IA=[new W(1,0,0),new W(-1,0,0),new W(0,1,0),new W(0,-1,0),new W(0,0,1),new W(0,0,-1)],GA=[new W(0,-1,0),new W(0,-1,0),new W(0,0,1),new W(0,0,-1),new W(0,-1,0),new W(0,-1,0)],Dp=new wt,na=new W,Sc=new W;function RA(n,e,t){let s=new Yu;const i=new et,r=new et,a=new Wt,o=new UO,l=new FO,c={},d=t.maxTextureSize,u={[ri]:gs,[gs]:ri,[zn]:zn},h=new jt({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new et},radius:{value:4}},vertexShader:DA,fragmentShader:TA}),p=h.clone();p.defines.HORIZONTAL_PASS=1;const f=new qt;f.setAttribute("position",new ts(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const M=new Ms(f,h),g=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=Oo;let m=this.type;this.render=function(O,S,b){if(g.enabled===!1||g.autoUpdate===!1&&g.needsUpdate===!1||O.length===0)return;this.type===Av&&(He("WebGLShadowMap: PCFSoftShadowMap has been deprecated. Using PCFShadowMap instead."),this.type=Oo);const v=n.getRenderTarget(),E=n.getActiveCubeFace(),A=n.getActiveMipmapLevel(),I=n.state;I.setBlending(Sn),I.buffers.depth.getReversed()===!0?I.buffers.color.setClear(0,0,0,0):I.buffers.color.setClear(1,1,1,1),I.buffers.depth.setTest(!0),I.setScissorTest(!1);const G=m!==this.type;G&&S.traverse(function(C){C.material&&(Array.isArray(C.material)?C.material.forEach(B=>B.needsUpdate=!0):C.material.needsUpdate=!0)});for(let C=0,B=O.length;C<B;C++){const P=O[C],L=P.shadow;if(L===void 0){He("WebGLShadowMap:",P,"has no shadow.");continue}if(L.autoUpdate===!1&&L.needsUpdate===!1)continue;i.copy(L.mapSize);const H=L.getFrameExtents();i.multiply(H),r.copy(L.mapSize),(i.x>d||i.y>d)&&(i.x>d&&(r.x=Math.floor(d/H.x),i.x=r.x*H.x,L.mapSize.x=r.x),i.y>d&&(r.y=Math.floor(d/H.y),i.y=r.y*H.y,L.mapSize.y=r.y));const X=n.state.buffers.depth.getReversed();if(L.camera._reversedDepth=X,L.map===null||G===!0){if(L.map!==null&&(L.map.depthTexture!==null&&(L.map.depthTexture.dispose(),L.map.depthTexture=null),L.map.dispose()),this.type===ua){if(P.isPointLight){He("WebGLShadowMap: VSM shadow maps are not supported for PointLights. Use PCF or BasicShadowMap instead.");continue}L.map=new rn(i.x,i.y,{format:Wi,type:Dn,minFilter:os,magFilter:os,generateMipmaps:!1}),L.map.texture.name=P.name+".shadowMap",L.map.depthTexture=new Rr(i.x,i.y,$s),L.map.depthTexture.name=P.name+".shadowMapDepth",L.map.depthTexture.format=Tn,L.map.depthTexture.compareFunction=null,L.map.depthTexture.minFilter=ss,L.map.depthTexture.magFilter=ss}else P.isPointLight?(L.map=new uM(i.x),L.map.depthTexture=new BO(i.x,on)):(L.map=new rn(i.x,i.y),L.map.depthTexture=new Rr(i.x,i.y,on)),L.map.depthTexture.name=P.name+".shadowMap",L.map.depthTexture.format=Tn,this.type===Oo?(L.map.depthTexture.compareFunction=X?$u:ju,L.map.depthTexture.minFilter=os,L.map.depthTexture.magFilter=os):(L.map.depthTexture.compareFunction=null,L.map.depthTexture.minFilter=ss,L.map.depthTexture.magFilter=ss);L.camera.updateProjectionMatrix()}const oe=L.map.isWebGLCubeRenderTarget?6:1;for(let J=0;J<oe;J++){if(L.map.isWebGLCubeRenderTarget)n.setRenderTarget(L.map,J),n.clear();else{J===0&&(n.setRenderTarget(L.map),n.clear());const ce=L.getViewport(J);a.set(r.x*ce.x,r.y*ce.y,r.x*ce.z,r.y*ce.w),I.viewport(a)}if(P.isPointLight){const ce=L.camera,We=L.matrix,qe=P.distance||ce.far;qe!==ce.far&&(ce.far=qe,ce.updateProjectionMatrix()),na.setFromMatrixPosition(P.matrixWorld),ce.position.copy(na),Sc.copy(ce.position),Sc.add(IA[J]),ce.up.copy(GA[J]),ce.lookAt(Sc),ce.updateMatrixWorld(),We.makeTranslation(-na.x,-na.y,-na.z),Dp.multiplyMatrices(ce.projectionMatrix,ce.matrixWorldInverse),L._frustum.setFromProjectionMatrix(Dp,ce.coordinateSystem,ce.reversedDepth)}else L.updateMatrices(P);s=L.getFrustum(),z(S,b,L.camera,P,this.type)}L.isPointLightShadow!==!0&&this.type===ua&&_(L,b),L.needsUpdate=!1}m=this.type,g.needsUpdate=!1,n.setRenderTarget(v,E,A)};function _(O,S){const b=e.update(M);h.defines.VSM_SAMPLES!==O.blurSamples&&(h.defines.VSM_SAMPLES=O.blurSamples,p.defines.VSM_SAMPLES=O.blurSamples,h.needsUpdate=!0,p.needsUpdate=!0),O.mapPass===null&&(O.mapPass=new rn(i.x,i.y,{format:Wi,type:Dn})),h.uniforms.shadow_pass.value=O.map.depthTexture,h.uniforms.resolution.value=O.mapSize,h.uniforms.radius.value=O.radius,n.setRenderTarget(O.mapPass),n.clear(),n.renderBufferDirect(S,null,b,h,M,null),p.uniforms.shadow_pass.value=O.mapPass.texture,p.uniforms.resolution.value=O.mapSize,p.uniforms.radius.value=O.radius,n.setRenderTarget(O.map),n.clear(),n.renderBufferDirect(S,null,b,p,M,null)}function w(O,S,b,v){let E=null;const A=b.isPointLight===!0?O.customDistanceMaterial:O.customDepthMaterial;if(A!==void 0)E=A;else if(E=b.isPointLight===!0?l:o,n.localClippingEnabled&&S.clipShadows===!0&&Array.isArray(S.clippingPlanes)&&S.clippingPlanes.length!==0||S.displacementMap&&S.displacementScale!==0||S.alphaMap&&S.alphaTest>0||S.map&&S.alphaTest>0||S.alphaToCoverage===!0){const I=E.uuid,G=S.uuid;let C=c[I];C===void 0&&(C={},c[I]=C);let B=C[G];B===void 0&&(B=E.clone(),C[G]=B,S.addEventListener("dispose",y)),E=B}if(E.visible=S.visible,E.wireframe=S.wireframe,v===ua?E.side=S.shadowSide!==null?S.shadowSide:S.side:E.side=S.shadowSide!==null?S.shadowSide:u[S.side],E.alphaMap=S.alphaMap,E.alphaTest=S.alphaToCoverage===!0?.5:S.alphaTest,E.map=S.map,E.clipShadows=S.clipShadows,E.clippingPlanes=S.clippingPlanes,E.clipIntersection=S.clipIntersection,E.displacementMap=S.displacementMap,E.displacementScale=S.displacementScale,E.displacementBias=S.displacementBias,E.wireframeLinewidth=S.wireframeLinewidth,E.linewidth=S.linewidth,b.isPointLight===!0&&E.isMeshDistanceMaterial===!0){const I=n.properties.get(E);I.light=b}return E}function z(O,S,b,v,E){if(O.visible===!1)return;if(O.layers.test(S.layers)&&(O.isMesh||O.isLine||O.isPoints)&&(O.castShadow||O.receiveShadow&&E===ua)&&(!O.frustumCulled||s.intersectsObject(O))){O.modelViewMatrix.multiplyMatrices(b.matrixWorldInverse,O.matrixWorld);const G=e.update(O),C=O.material;if(Array.isArray(C)){const B=G.groups;for(let P=0,L=B.length;P<L;P++){const H=B[P],X=C[H.materialIndex];if(X&&X.visible){const oe=w(O,X,v,E);O.onBeforeShadow(n,O,S,b,G,oe,H),n.renderBufferDirect(b,null,G,oe,O,H),O.onAfterShadow(n,O,S,b,G,oe,H)}}}else if(C.visible){const B=w(O,C,v,E);O.onBeforeShadow(n,O,S,b,G,B,null),n.renderBufferDirect(b,null,G,B,O,null),O.onAfterShadow(n,O,S,b,G,B,null)}}const I=O.children;for(let G=0,C=I.length;G<C;G++)z(I[G],S,b,v,E)}function y(O){O.target.removeEventListener("dispose",y);for(const b in c){const v=c[b],E=O.target.uuid;E in v&&(v[E].dispose(),delete v[E])}}}function NA(n,e){function t(){let U=!1;const ze=new Wt;let re=null;const we=new Wt(0,0,0,0);return{setMask:function(Ee){re!==Ee&&!U&&(n.colorMask(Ee,Ee,Ee,Ee),re=Ee)},setLocked:function(Ee){U=Ee},setClear:function(Ee,de,Be,Ge,ht){ht===!0&&(Ee*=Ge,de*=Ge,Be*=Ge),ze.set(Ee,de,Be,Ge),we.equals(ze)===!1&&(n.clearColor(Ee,de,Be,Ge),we.copy(ze))},reset:function(){U=!1,re=null,we.set(-1,0,0,0)}}}function s(){let U=!1,ze=!1,re=null,we=null,Ee=null;return{setReversed:function(de){if(ze!==de){const Be=e.get("EXT_clip_control");de?Be.clipControlEXT(Be.LOWER_LEFT_EXT,Be.ZERO_TO_ONE_EXT):Be.clipControlEXT(Be.LOWER_LEFT_EXT,Be.NEGATIVE_ONE_TO_ONE_EXT),ze=de;const Ge=Ee;Ee=null,this.setClear(Ge)}},getReversed:function(){return ze},setTest:function(de){de?ue(n.DEPTH_TEST):Xe(n.DEPTH_TEST)},setMask:function(de){re!==de&&!U&&(n.depthMask(de),re=de)},setFunc:function(de){if(ze&&(de=oO[de]),we!==de){switch(de){case ud:n.depthFunc(n.NEVER);break;case hd:n.depthFunc(n.ALWAYS);break;case fd:n.depthFunc(n.LESS);break;case Ir:n.depthFunc(n.LEQUAL);break;case pd:n.depthFunc(n.EQUAL);break;case md:n.depthFunc(n.GEQUAL);break;case gd:n.depthFunc(n.GREATER);break;case Md:n.depthFunc(n.NOTEQUAL);break;default:n.depthFunc(n.LEQUAL)}we=de}},setLocked:function(de){U=de},setClear:function(de){Ee!==de&&(Ee=de,ze&&(de=1-de),n.clearDepth(de))},reset:function(){U=!1,re=null,we=null,Ee=null,ze=!1}}}function i(){let U=!1,ze=null,re=null,we=null,Ee=null,de=null,Be=null,Ge=null,ht=null;return{setTest:function(Et){U||(Et?ue(n.STENCIL_TEST):Xe(n.STENCIL_TEST))},setMask:function(Et){ze!==Et&&!U&&(n.stencilMask(Et),ze=Et)},setFunc:function(Et,_s,zs){(re!==Et||we!==_s||Ee!==zs)&&(n.stencilFunc(Et,_s,zs),re=Et,we=_s,Ee=zs)},setOp:function(Et,_s,zs){(de!==Et||Be!==_s||Ge!==zs)&&(n.stencilOp(Et,_s,zs),de=Et,Be=_s,Ge=zs)},setLocked:function(Et){U=Et},setClear:function(Et){ht!==Et&&(n.clearStencil(Et),ht=Et)},reset:function(){U=!1,ze=null,re=null,we=null,Ee=null,de=null,Be=null,Ge=null,ht=null}}}const r=new t,a=new s,o=new i,l=new WeakMap,c=new WeakMap;let d={},u={},h={},p=new WeakMap,f=[],M=null,g=!1,m=null,_=null,w=null,z=null,y=null,O=null,S=null,b=new ke(0,0,0),v=0,E=!1,A=null,I=null,G=null,C=null,B=null;const P=n.getParameter(n.MAX_COMBINED_TEXTURE_IMAGE_UNITS);let L=!1,H=0;const X=n.getParameter(n.VERSION);X.indexOf("WebGL")!==-1?(H=parseFloat(/^WebGL (\d)/.exec(X)[1]),L=H>=1):X.indexOf("OpenGL ES")!==-1&&(H=parseFloat(/^OpenGL ES (\d)/.exec(X)[1]),L=H>=2);let oe=null,J={};const ce=n.getParameter(n.SCISSOR_BOX),We=n.getParameter(n.VIEWPORT),qe=new Wt().fromArray(ce),Pe=new Wt().fromArray(We);function ne(U,ze,re,we){const Ee=new Uint8Array(4),de=n.createTexture();n.bindTexture(U,de),n.texParameteri(U,n.TEXTURE_MIN_FILTER,n.NEAREST),n.texParameteri(U,n.TEXTURE_MAG_FILTER,n.NEAREST);for(let Be=0;Be<re;Be++)U===n.TEXTURE_3D||U===n.TEXTURE_2D_ARRAY?n.texImage3D(ze,0,n.RGBA,1,1,we,0,n.RGBA,n.UNSIGNED_BYTE,Ee):n.texImage2D(ze+Be,0,n.RGBA,1,1,0,n.RGBA,n.UNSIGNED_BYTE,Ee);return de}const ae={};ae[n.TEXTURE_2D]=ne(n.TEXTURE_2D,n.TEXTURE_2D,1),ae[n.TEXTURE_CUBE_MAP]=ne(n.TEXTURE_CUBE_MAP,n.TEXTURE_CUBE_MAP_POSITIVE_X,6),ae[n.TEXTURE_2D_ARRAY]=ne(n.TEXTURE_2D_ARRAY,n.TEXTURE_2D_ARRAY,1,1),ae[n.TEXTURE_3D]=ne(n.TEXTURE_3D,n.TEXTURE_3D,1,1),r.setClear(0,0,0,1),a.setClear(1),o.setClear(0),ue(n.DEPTH_TEST),a.setFunc(Ir),Gt(!1),Bt(yf),ue(n.CULL_FACE),ut(Sn);function ue(U){d[U]!==!0&&(n.enable(U),d[U]=!0)}function Xe(U){d[U]!==!1&&(n.disable(U),d[U]=!1)}function Ze(U,ze){return h[U]!==ze?(n.bindFramebuffer(U,ze),h[U]=ze,U===n.DRAW_FRAMEBUFFER&&(h[n.FRAMEBUFFER]=ze),U===n.FRAMEBUFFER&&(h[n.DRAW_FRAMEBUFFER]=ze),!0):!1}function Fe(U,ze){let re=f,we=!1;if(U){re=p.get(ze),re===void 0&&(re=[],p.set(ze,re));const Ee=U.textures;if(re.length!==Ee.length||re[0]!==n.COLOR_ATTACHMENT0){for(let de=0,Be=Ee.length;de<Be;de++)re[de]=n.COLOR_ATTACHMENT0+de;re.length=Ee.length,we=!0}}else re[0]!==n.BACK&&(re[0]=n.BACK,we=!0);we&&n.drawBuffers(re)}function Lt(U){return M!==U?(n.useProgram(U),M=U,!0):!1}const ot={[_i]:n.FUNC_ADD,[Tv]:n.FUNC_SUBTRACT,[Iv]:n.FUNC_REVERSE_SUBTRACT};ot[Gv]=n.MIN,ot[Rv]=n.MAX;const yt={[Nv]:n.ZERO,[Bv]:n.ONE,[Cv]:n.SRC_COLOR,[cd]:n.SRC_ALPHA,[Fv]:n.SRC_ALPHA_SATURATE,[kv]:n.DST_COLOR,[Lv]:n.DST_ALPHA,[Pv]:n.ONE_MINUS_SRC_COLOR,[dd]:n.ONE_MINUS_SRC_ALPHA,[Uv]:n.ONE_MINUS_DST_COLOR,[Wv]:n.ONE_MINUS_DST_ALPHA,[jv]:n.CONSTANT_COLOR,[$v]:n.ONE_MINUS_CONSTANT_COLOR,[Vv]:n.CONSTANT_ALPHA,[Hv]:n.ONE_MINUS_CONSTANT_ALPHA};function ut(U,ze,re,we,Ee,de,Be,Ge,ht,Et){if(U===Sn){g===!0&&(Xe(n.BLEND),g=!1);return}if(g===!1&&(ue(n.BLEND),g=!0),U!==Dv){if(U!==m||Et!==E){if((_!==_i||y!==_i)&&(n.blendEquation(n.FUNC_ADD),_=_i,y=_i),Et)switch(U){case Ei:n.blendFuncSeparate(n.ONE,n.ONE_MINUS_SRC_ALPHA,n.ONE,n.ONE_MINUS_SRC_ALPHA);break;case Pi:n.blendFunc(n.ONE,n.ONE);break;case vf:n.blendFuncSeparate(n.ZERO,n.ONE_MINUS_SRC_COLOR,n.ZERO,n.ONE);break;case Of:n.blendFuncSeparate(n.DST_COLOR,n.ONE_MINUS_SRC_ALPHA,n.ZERO,n.ONE);break;default:pt("WebGLState: Invalid blending: ",U);break}else switch(U){case Ei:n.blendFuncSeparate(n.SRC_ALPHA,n.ONE_MINUS_SRC_ALPHA,n.ONE,n.ONE_MINUS_SRC_ALPHA);break;case Pi:n.blendFuncSeparate(n.SRC_ALPHA,n.ONE,n.ONE,n.ONE);break;case vf:pt("WebGLState: SubtractiveBlending requires material.premultipliedAlpha = true");break;case Of:pt("WebGLState: MultiplyBlending requires material.premultipliedAlpha = true");break;default:pt("WebGLState: Invalid blending: ",U);break}w=null,z=null,O=null,S=null,b.set(0,0,0),v=0,m=U,E=Et}return}Ee=Ee||ze,de=de||re,Be=Be||we,(ze!==_||Ee!==y)&&(n.blendEquationSeparate(ot[ze],ot[Ee]),_=ze,y=Ee),(re!==w||we!==z||de!==O||Be!==S)&&(n.blendFuncSeparate(yt[re],yt[we],yt[de],yt[Be]),w=re,z=we,O=de,S=Be),(Ge.equals(b)===!1||ht!==v)&&(n.blendColor(Ge.r,Ge.g,Ge.b,ht),b.copy(Ge),v=ht),m=U,E=!1}function lt(U,ze){U.side===zn?Xe(n.CULL_FACE):ue(n.CULL_FACE);let re=U.side===gs;ze&&(re=!re),Gt(re),U.blending===Ei&&U.transparent===!1?ut(Sn):ut(U.blending,U.blendEquation,U.blendSrc,U.blendDst,U.blendEquationAlpha,U.blendSrcAlpha,U.blendDstAlpha,U.blendColor,U.blendAlpha,U.premultipliedAlpha),a.setFunc(U.depthFunc),a.setTest(U.depthTest),a.setMask(U.depthWrite),r.setMask(U.colorWrite);const we=U.stencilWrite;o.setTest(we),we&&(o.setMask(U.stencilWriteMask),o.setFunc(U.stencilFunc,U.stencilRef,U.stencilFuncMask),o.setOp(U.stencilFail,U.stencilZFail,U.stencilZPass)),xt(U.polygonOffset,U.polygonOffsetFactor,U.polygonOffsetUnits),U.alphaToCoverage===!0?ue(n.SAMPLE_ALPHA_TO_COVERAGE):Xe(n.SAMPLE_ALPHA_TO_COVERAGE)}function Gt(U){A!==U&&(U?n.frontFace(n.CW):n.frontFace(n.CCW),A=U)}function Bt(U){U!==Sv?(ue(n.CULL_FACE),U!==I&&(U===yf?n.cullFace(n.BACK):U===Ev?n.cullFace(n.FRONT):n.cullFace(n.FRONT_AND_BACK))):Xe(n.CULL_FACE),I=U}function $t(U){U!==G&&(L&&n.lineWidth(U),G=U)}function xt(U,ze,re){U?(ue(n.POLYGON_OFFSET_FILL),(C!==ze||B!==re)&&(C=ze,B=re,a.getReversed()&&(ze=-ze),n.polygonOffset(ze,re))):Xe(n.POLYGON_OFFSET_FILL)}function Ct(U){U?ue(n.SCISSOR_TEST):Xe(n.SCISSOR_TEST)}function Pt(U){U===void 0&&(U=n.TEXTURE0+P-1),oe!==U&&(n.activeTexture(U),oe=U)}function j(U,ze,re){re===void 0&&(oe===null?re=n.TEXTURE0+P-1:re=oe);let we=J[re];we===void 0&&(we={type:void 0,texture:void 0},J[re]=we),(we.type!==U||we.texture!==ze)&&(oe!==re&&(n.activeTexture(re),oe=re),n.bindTexture(U,ze||ae[U]),we.type=U,we.texture=ze)}function Ft(){const U=J[oe];U!==void 0&&U.type!==void 0&&(n.bindTexture(U.type,null),U.type=void 0,U.texture=void 0)}function vt(){try{n.compressedTexImage2D(...arguments)}catch(U){pt("WebGLState:",U)}}function N(){try{n.compressedTexImage3D(...arguments)}catch(U){pt("WebGLState:",U)}}function x(){try{n.texSubImage2D(...arguments)}catch(U){pt("WebGLState:",U)}}function V(){try{n.texSubImage3D(...arguments)}catch(U){pt("WebGLState:",U)}}function Z(){try{n.compressedTexSubImage2D(...arguments)}catch(U){pt("WebGLState:",U)}}function $(){try{n.compressedTexSubImage3D(...arguments)}catch(U){pt("WebGLState:",U)}}function pe(){try{n.texStorage2D(...arguments)}catch(U){pt("WebGLState:",U)}}function ye(){try{n.texStorage3D(...arguments)}catch(U){pt("WebGLState:",U)}}function te(){try{n.texImage2D(...arguments)}catch(U){pt("WebGLState:",U)}}function ie(){try{n.texImage3D(...arguments)}catch(U){pt("WebGLState:",U)}}function he(U){return u[U]!==void 0?u[U]:n.getParameter(U)}function Te(U,ze){u[U]!==ze&&(n.pixelStorei(U,ze),u[U]=ze)}function Me(U){qe.equals(U)===!1&&(n.scissor(U.x,U.y,U.z,U.w),qe.copy(U))}function _e(U){Pe.equals(U)===!1&&(n.viewport(U.x,U.y,U.z,U.w),Pe.copy(U))}function Ue(U,ze){let re=c.get(ze);re===void 0&&(re=new WeakMap,c.set(ze,re));let we=re.get(U);we===void 0&&(we=n.getUniformBlockIndex(ze,U.name),re.set(U,we))}function je(U,ze){const we=c.get(ze).get(U);l.get(ze)!==we&&(n.uniformBlockBinding(ze,we,U.__bindingPointIndex),l.set(ze,we))}function $e(){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={},oe=null,J={},h={},p=new WeakMap,f=[],M=null,g=!1,m=null,_=null,w=null,z=null,y=null,O=null,S=null,b=new ke(0,0,0),v=0,E=!1,A=null,I=null,G=null,C=null,B=null,qe.set(0,0,n.canvas.width,n.canvas.height),Pe.set(0,0,n.canvas.width,n.canvas.height),r.reset(),a.reset(),o.reset()}return{buffers:{color:r,depth:a,stencil:o},enable:ue,disable:Xe,bindFramebuffer:Ze,drawBuffers:Fe,useProgram:Lt,setBlending:ut,setMaterial:lt,setFlipSided:Gt,setCullFace:Bt,setLineWidth:$t,setPolygonOffset:xt,setScissorTest:Ct,activeTexture:Pt,bindTexture:j,unbindTexture:Ft,compressedTexImage2D:vt,compressedTexImage3D:N,texImage2D:te,texImage3D:ie,pixelStorei:Te,getParameter:he,updateUBOMapping:Ue,uniformBlockBinding:je,texStorage2D:pe,texStorage3D:ye,texSubImage2D:x,texSubImage3D:V,compressedTexSubImage2D:Z,compressedTexSubImage3D:$,scissor:Me,viewport:_e,reset:$e}}function BA(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 et,d=new WeakMap,u=new Set;let h;const p=new WeakMap;let f=!1;try{f=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function M(N,x){return f?new OffscreenCanvas(N,x):tl("canvas")}function g(N,x,V){let Z=1;const $=vt(N);if(($.width>V||$.height>V)&&(Z=V/Math.max($.width,$.height)),Z<1)if(typeof HTMLImageElement<"u"&&N instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&N instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&N instanceof ImageBitmap||typeof VideoFrame<"u"&&N instanceof VideoFrame){const pe=Math.floor(Z*$.width),ye=Math.floor(Z*$.height);h===void 0&&(h=M(pe,ye));const te=x?M(pe,ye):h;return te.width=pe,te.height=ye,te.getContext("2d").drawImage(N,0,0,pe,ye),He("WebGLRenderer: Texture has been resized from ("+$.width+"x"+$.height+") to ("+pe+"x"+ye+")."),te}else return"data"in N&&He("WebGLRenderer: Image in DataTexture is too big ("+$.width+"x"+$.height+")."),N;return N}function m(N){return N.generateMipmaps}function _(N){n.generateMipmap(N)}function w(N){return N.isWebGLCubeRenderTarget?n.TEXTURE_CUBE_MAP:N.isWebGL3DRenderTarget?n.TEXTURE_3D:N.isWebGLArrayRenderTarget||N.isCompressedArrayTexture?n.TEXTURE_2D_ARRAY:n.TEXTURE_2D}function z(N,x,V,Z,$,pe=!1){if(N!==null){if(n[N]!==void 0)return n[N];He("WebGLRenderer: Attempt to use non-existing WebGL internal format '"+N+"'")}let ye;Z&&(ye=e.get("EXT_texture_norm16"),ye||He("WebGLRenderer: Unable to use normalized textures without EXT_texture_norm16 extension"));let te=x;if(x===n.RED&&(V===n.FLOAT&&(te=n.R32F),V===n.HALF_FLOAT&&(te=n.R16F),V===n.UNSIGNED_BYTE&&(te=n.R8),V===n.UNSIGNED_SHORT&&ye&&(te=ye.R16_EXT),V===n.SHORT&&ye&&(te=ye.R16_SNORM_EXT)),x===n.RED_INTEGER&&(V===n.UNSIGNED_BYTE&&(te=n.R8UI),V===n.UNSIGNED_SHORT&&(te=n.R16UI),V===n.UNSIGNED_INT&&(te=n.R32UI),V===n.BYTE&&(te=n.R8I),V===n.SHORT&&(te=n.R16I),V===n.INT&&(te=n.R32I)),x===n.RG&&(V===n.FLOAT&&(te=n.RG32F),V===n.HALF_FLOAT&&(te=n.RG16F),V===n.UNSIGNED_BYTE&&(te=n.RG8),V===n.UNSIGNED_SHORT&&ye&&(te=ye.RG16_EXT),V===n.SHORT&&ye&&(te=ye.RG16_SNORM_EXT)),x===n.RG_INTEGER&&(V===n.UNSIGNED_BYTE&&(te=n.RG8UI),V===n.UNSIGNED_SHORT&&(te=n.RG16UI),V===n.UNSIGNED_INT&&(te=n.RG32UI),V===n.BYTE&&(te=n.RG8I),V===n.SHORT&&(te=n.RG16I),V===n.INT&&(te=n.RG32I)),x===n.RGB_INTEGER&&(V===n.UNSIGNED_BYTE&&(te=n.RGB8UI),V===n.UNSIGNED_SHORT&&(te=n.RGB16UI),V===n.UNSIGNED_INT&&(te=n.RGB32UI),V===n.BYTE&&(te=n.RGB8I),V===n.SHORT&&(te=n.RGB16I),V===n.INT&&(te=n.RGB32I)),x===n.RGBA_INTEGER&&(V===n.UNSIGNED_BYTE&&(te=n.RGBA8UI),V===n.UNSIGNED_SHORT&&(te=n.RGBA16UI),V===n.UNSIGNED_INT&&(te=n.RGBA32UI),V===n.BYTE&&(te=n.RGBA8I),V===n.SHORT&&(te=n.RGBA16I),V===n.INT&&(te=n.RGBA32I)),x===n.RGB&&(V===n.UNSIGNED_SHORT&&ye&&(te=ye.RGB16_EXT),V===n.SHORT&&ye&&(te=ye.RGB16_SNORM_EXT),V===n.UNSIGNED_INT_5_9_9_9_REV&&(te=n.RGB9_E5),V===n.UNSIGNED_INT_10F_11F_11F_REV&&(te=n.R11F_G11F_B10F)),x===n.RGBA){const ie=pe?el:mt.getTransfer($);V===n.FLOAT&&(te=n.RGBA32F),V===n.HALF_FLOAT&&(te=n.RGBA16F),V===n.UNSIGNED_BYTE&&(te=ie===St?n.SRGB8_ALPHA8:n.RGBA8),V===n.UNSIGNED_SHORT&&ye&&(te=ye.RGBA16_EXT),V===n.SHORT&&ye&&(te=ye.RGBA16_SNORM_EXT),V===n.UNSIGNED_SHORT_4_4_4_4&&(te=n.RGBA4),V===n.UNSIGNED_SHORT_5_5_5_1&&(te=n.RGB5_A1)}return(te===n.R16F||te===n.R32F||te===n.RG16F||te===n.RG32F||te===n.RGBA16F||te===n.RGBA32F)&&e.get("EXT_color_buffer_float"),te}function y(N,x){let V;return N?x===null||x===on||x===va?V=n.DEPTH24_STENCIL8:x===$s?V=n.DEPTH32F_STENCIL8:x===ya&&(V=n.DEPTH24_STENCIL8,He("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.")):x===null||x===on||x===va?V=n.DEPTH_COMPONENT24:x===$s?V=n.DEPTH_COMPONENT32F:x===ya&&(V=n.DEPTH_COMPONENT16),V}function O(N,x){return m(N)===!0||N.isFramebufferTexture&&N.minFilter!==ss&&N.minFilter!==os?Math.log2(Math.max(x.width,x.height))+1:N.mipmaps!==void 0&&N.mipmaps.length>0?N.mipmaps.length:N.isCompressedTexture&&Array.isArray(N.image)?x.mipmaps.length:1}function S(N){const x=N.target;x.removeEventListener("dispose",S),v(x),x.isVideoTexture&&d.delete(x),x.isHTMLTexture&&u.delete(x)}function b(N){const x=N.target;x.removeEventListener("dispose",b),A(x)}function v(N){const x=s.get(N);if(x.__webglInit===void 0)return;const V=N.source,Z=p.get(V);if(Z){const $=Z[x.__cacheKey];$.usedTimes--,$.usedTimes===0&&E(N),Object.keys(Z).length===0&&p.delete(V)}s.remove(N)}function E(N){const x=s.get(N);n.deleteTexture(x.__webglTexture);const V=N.source,Z=p.get(V);delete Z[x.__cacheKey],a.memory.textures--}function A(N){const x=s.get(N);if(N.depthTexture&&(N.depthTexture.dispose(),s.remove(N.depthTexture)),N.isWebGLCubeRenderTarget)for(let Z=0;Z<6;Z++){if(Array.isArray(x.__webglFramebuffer[Z]))for(let $=0;$<x.__webglFramebuffer[Z].length;$++)n.deleteFramebuffer(x.__webglFramebuffer[Z][$]);else n.deleteFramebuffer(x.__webglFramebuffer[Z]);x.__webglDepthbuffer&&n.deleteRenderbuffer(x.__webglDepthbuffer[Z])}else{if(Array.isArray(x.__webglFramebuffer))for(let Z=0;Z<x.__webglFramebuffer.length;Z++)n.deleteFramebuffer(x.__webglFramebuffer[Z]);else n.deleteFramebuffer(x.__webglFramebuffer);if(x.__webglDepthbuffer&&n.deleteRenderbuffer(x.__webglDepthbuffer),x.__webglMultisampledFramebuffer&&n.deleteFramebuffer(x.__webglMultisampledFramebuffer),x.__webglColorRenderbuffer)for(let Z=0;Z<x.__webglColorRenderbuffer.length;Z++)x.__webglColorRenderbuffer[Z]&&n.deleteRenderbuffer(x.__webglColorRenderbuffer[Z]);x.__webglDepthRenderbuffer&&n.deleteRenderbuffer(x.__webglDepthRenderbuffer)}const V=N.textures;for(let Z=0,$=V.length;Z<$;Z++){const pe=s.get(V[Z]);pe.__webglTexture&&(n.deleteTexture(pe.__webglTexture),a.memory.textures--),s.remove(V[Z])}s.remove(N)}let I=0;function G(){I=0}function C(){return I}function B(N){I=N}function P(){const N=I;return N>=i.maxTextures&&He("WebGLTextures: Trying to use "+N+" texture units while this GPU supports only "+i.maxTextures),I+=1,N}function L(N){const x=[];return x.push(N.wrapS),x.push(N.wrapT),x.push(N.wrapR||0),x.push(N.magFilter),x.push(N.minFilter),x.push(N.anisotropy),x.push(N.internalFormat),x.push(N.format),x.push(N.type),x.push(N.generateMipmaps),x.push(N.premultiplyAlpha),x.push(N.flipY),x.push(N.unpackAlignment),x.push(N.colorSpace),x.join()}function H(N,x){const V=s.get(N);if(N.isVideoTexture&&j(N),N.isRenderTargetTexture===!1&&N.isExternalTexture!==!0&&N.version>0&&V.__version!==N.version){const Z=N.image;if(Z===null)He("WebGLRenderer: Texture marked for update but no image data found.");else if(Z.complete===!1)He("WebGLRenderer: Texture marked for update but image is incomplete");else{Xe(V,N,x);return}}else N.isExternalTexture&&(V.__webglTexture=N.sourceTexture?N.sourceTexture:null);t.bindTexture(n.TEXTURE_2D,V.__webglTexture,n.TEXTURE0+x)}function X(N,x){const V=s.get(N);if(N.isRenderTargetTexture===!1&&N.version>0&&V.__version!==N.version){Xe(V,N,x);return}else N.isExternalTexture&&(V.__webglTexture=N.sourceTexture?N.sourceTexture:null);t.bindTexture(n.TEXTURE_2D_ARRAY,V.__webglTexture,n.TEXTURE0+x)}function oe(N,x){const V=s.get(N);if(N.isRenderTargetTexture===!1&&N.version>0&&V.__version!==N.version){Xe(V,N,x);return}t.bindTexture(n.TEXTURE_3D,V.__webglTexture,n.TEXTURE0+x)}function J(N,x){const V=s.get(N);if(N.isCubeDepthTexture!==!0&&N.version>0&&V.__version!==N.version){Ze(V,N,x);return}t.bindTexture(n.TEXTURE_CUBE_MAP,V.__webglTexture,n.TEXTURE0+x)}const ce={[bd]:n.REPEAT,[yn]:n.CLAMP_TO_EDGE,[_d]:n.MIRRORED_REPEAT},We={[ss]:n.NEAREST,[Kv]:n.NEAREST_MIPMAP_NEAREST,[Ca]:n.NEAREST_MIPMAP_LINEAR,[os]:n.LINEAR,[ql]:n.LINEAR_MIPMAP_NEAREST,[yi]:n.LINEAR_MIPMAP_LINEAR},qe={[Qv]:n.NEVER,[nO]:n.ALWAYS,[Jv]:n.LESS,[ju]:n.LEQUAL,[eO]:n.EQUAL,[$u]:n.GEQUAL,[tO]:n.GREATER,[sO]:n.NOTEQUAL};function Pe(N,x){if(x.type===$s&&e.has("OES_texture_float_linear")===!1&&(x.magFilter===os||x.magFilter===ql||x.magFilter===Ca||x.magFilter===yi||x.minFilter===os||x.minFilter===ql||x.minFilter===Ca||x.minFilter===yi)&&He("WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."),n.texParameteri(N,n.TEXTURE_WRAP_S,ce[x.wrapS]),n.texParameteri(N,n.TEXTURE_WRAP_T,ce[x.wrapT]),(N===n.TEXTURE_3D||N===n.TEXTURE_2D_ARRAY)&&n.texParameteri(N,n.TEXTURE_WRAP_R,ce[x.wrapR]),n.texParameteri(N,n.TEXTURE_MAG_FILTER,We[x.magFilter]),n.texParameteri(N,n.TEXTURE_MIN_FILTER,We[x.minFilter]),x.compareFunction&&(n.texParameteri(N,n.TEXTURE_COMPARE_MODE,n.COMPARE_REF_TO_TEXTURE),n.texParameteri(N,n.TEXTURE_COMPARE_FUNC,qe[x.compareFunction])),e.has("EXT_texture_filter_anisotropic")===!0){if(x.magFilter===ss||x.minFilter!==Ca&&x.minFilter!==yi||x.type===$s&&e.has("OES_texture_float_linear")===!1)return;if(x.anisotropy>1||s.get(x).__currentAnisotropy){const V=e.get("EXT_texture_filter_anisotropic");n.texParameterf(N,V.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(x.anisotropy,i.getMaxAnisotropy())),s.get(x).__currentAnisotropy=x.anisotropy}}}function ne(N,x){let V=!1;N.__webglInit===void 0&&(N.__webglInit=!0,x.addEventListener("dispose",S));const Z=x.source;let $=p.get(Z);$===void 0&&($={},p.set(Z,$));const pe=L(x);if(pe!==N.__cacheKey){$[pe]===void 0&&($[pe]={texture:n.createTexture(),usedTimes:0},a.memory.textures++,V=!0),$[pe].usedTimes++;const ye=$[N.__cacheKey];ye!==void 0&&($[N.__cacheKey].usedTimes--,ye.usedTimes===0&&E(x)),N.__cacheKey=pe,N.__webglTexture=$[pe].texture}return V}function ae(N,x,V){return Math.floor(Math.floor(N/V)/x)}function ue(N,x,V,Z){const pe=N.updateRanges;if(pe.length===0)t.texSubImage2D(n.TEXTURE_2D,0,0,0,x.width,x.height,V,Z,x.data);else{pe.sort((Te,Me)=>Te.start-Me.start);let ye=0;for(let Te=1;Te<pe.length;Te++){const Me=pe[ye],_e=pe[Te],Ue=Me.start+Me.count,je=ae(_e.start,x.width,4),$e=ae(Me.start,x.width,4);_e.start<=Ue+1&&je===$e&&ae(_e.start+_e.count-1,x.width,4)===je?Me.count=Math.max(Me.count,_e.start+_e.count-Me.start):(++ye,pe[ye]=_e)}pe.length=ye+1;const te=t.getParameter(n.UNPACK_ROW_LENGTH),ie=t.getParameter(n.UNPACK_SKIP_PIXELS),he=t.getParameter(n.UNPACK_SKIP_ROWS);t.pixelStorei(n.UNPACK_ROW_LENGTH,x.width);for(let Te=0,Me=pe.length;Te<Me;Te++){const _e=pe[Te],Ue=Math.floor(_e.start/4),je=Math.ceil(_e.count/4),$e=Ue%x.width,U=Math.floor(Ue/x.width),ze=je,re=1;t.pixelStorei(n.UNPACK_SKIP_PIXELS,$e),t.pixelStorei(n.UNPACK_SKIP_ROWS,U),t.texSubImage2D(n.TEXTURE_2D,0,$e,U,ze,re,V,Z,x.data)}N.clearUpdateRanges(),t.pixelStorei(n.UNPACK_ROW_LENGTH,te),t.pixelStorei(n.UNPACK_SKIP_PIXELS,ie),t.pixelStorei(n.UNPACK_SKIP_ROWS,he)}}function Xe(N,x,V){let Z=n.TEXTURE_2D;(x.isDataArrayTexture||x.isCompressedArrayTexture)&&(Z=n.TEXTURE_2D_ARRAY),x.isData3DTexture&&(Z=n.TEXTURE_3D);const $=ne(N,x),pe=x.source;t.bindTexture(Z,N.__webglTexture,n.TEXTURE0+V);const ye=s.get(pe);if(pe.version!==ye.__version||$===!0){if(t.activeTexture(n.TEXTURE0+V),(typeof ImageBitmap<"u"&&x.image instanceof ImageBitmap)===!1){const re=mt.getPrimaries(mt.workingColorSpace),we=x.colorSpace===qn?null:mt.getPrimaries(x.colorSpace),Ee=x.colorSpace===qn||re===we?n.NONE:n.BROWSER_DEFAULT_WEBGL;t.pixelStorei(n.UNPACK_FLIP_Y_WEBGL,x.flipY),t.pixelStorei(n.UNPACK_PREMULTIPLY_ALPHA_WEBGL,x.premultiplyAlpha),t.pixelStorei(n.UNPACK_COLORSPACE_CONVERSION_WEBGL,Ee)}t.pixelStorei(n.UNPACK_ALIGNMENT,x.unpackAlignment);let ie=g(x.image,!1,i.maxTextureSize);ie=Ft(x,ie);const he=r.convert(x.format,x.colorSpace),Te=r.convert(x.type);let Me=z(x.internalFormat,he,Te,x.normalized,x.colorSpace,x.isVideoTexture);Pe(Z,x);let _e;const Ue=x.mipmaps,je=x.isVideoTexture!==!0,$e=ye.__version===void 0||$===!0,U=pe.dataReady,ze=O(x,ie);if(x.isDepthTexture)Me=y(x.format===vi,x.type),$e&&(je?t.texStorage2D(n.TEXTURE_2D,1,Me,ie.width,ie.height):t.texImage2D(n.TEXTURE_2D,0,Me,ie.width,ie.height,0,he,Te,null));else if(x.isDataTexture)if(Ue.length>0){je&&$e&&t.texStorage2D(n.TEXTURE_2D,ze,Me,Ue[0].width,Ue[0].height);for(let re=0,we=Ue.length;re<we;re++)_e=Ue[re],je?U&&t.texSubImage2D(n.TEXTURE_2D,re,0,0,_e.width,_e.height,he,Te,_e.data):t.texImage2D(n.TEXTURE_2D,re,Me,_e.width,_e.height,0,he,Te,_e.data);x.generateMipmaps=!1}else je?($e&&t.texStorage2D(n.TEXTURE_2D,ze,Me,ie.width,ie.height),U&&ue(x,ie,he,Te)):t.texImage2D(n.TEXTURE_2D,0,Me,ie.width,ie.height,0,he,Te,ie.data);else if(x.isCompressedTexture)if(x.isCompressedArrayTexture){je&&$e&&t.texStorage3D(n.TEXTURE_2D_ARRAY,ze,Me,Ue[0].width,Ue[0].height,ie.depth);for(let re=0,we=Ue.length;re<we;re++)if(_e=Ue[re],x.format!==Vs)if(he!==null)if(je){if(U)if(x.layerUpdates.size>0){const Ee=ap(_e.width,_e.height,x.format,x.type);for(const de of x.layerUpdates){const Be=_e.data.subarray(de*Ee/_e.data.BYTES_PER_ELEMENT,(de+1)*Ee/_e.data.BYTES_PER_ELEMENT);t.compressedTexSubImage3D(n.TEXTURE_2D_ARRAY,re,0,0,de,_e.width,_e.height,1,he,Be)}x.clearLayerUpdates()}else t.compressedTexSubImage3D(n.TEXTURE_2D_ARRAY,re,0,0,0,_e.width,_e.height,ie.depth,he,_e.data)}else t.compressedTexImage3D(n.TEXTURE_2D_ARRAY,re,Me,_e.width,_e.height,ie.depth,0,_e.data,0,0);else He("WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");else je?U&&t.texSubImage3D(n.TEXTURE_2D_ARRAY,re,0,0,0,_e.width,_e.height,ie.depth,he,Te,_e.data):t.texImage3D(n.TEXTURE_2D_ARRAY,re,Me,_e.width,_e.height,ie.depth,0,he,Te,_e.data)}else{je&&$e&&t.texStorage2D(n.TEXTURE_2D,ze,Me,Ue[0].width,Ue[0].height);for(let re=0,we=Ue.length;re<we;re++)_e=Ue[re],x.format!==Vs?he!==null?je?U&&t.compressedTexSubImage2D(n.TEXTURE_2D,re,0,0,_e.width,_e.height,he,_e.data):t.compressedTexImage2D(n.TEXTURE_2D,re,Me,_e.width,_e.height,0,_e.data):He("WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):je?U&&t.texSubImage2D(n.TEXTURE_2D,re,0,0,_e.width,_e.height,he,Te,_e.data):t.texImage2D(n.TEXTURE_2D,re,Me,_e.width,_e.height,0,he,Te,_e.data)}else if(x.isDataArrayTexture)if(je){if($e&&t.texStorage3D(n.TEXTURE_2D_ARRAY,ze,Me,ie.width,ie.height,ie.depth),U)if(x.layerUpdates.size>0){const re=ap(ie.width,ie.height,x.format,x.type);for(const we of x.layerUpdates){const Ee=ie.data.subarray(we*re/ie.data.BYTES_PER_ELEMENT,(we+1)*re/ie.data.BYTES_PER_ELEMENT);t.texSubImage3D(n.TEXTURE_2D_ARRAY,0,0,0,we,ie.width,ie.height,1,he,Te,Ee)}x.clearLayerUpdates()}else t.texSubImage3D(n.TEXTURE_2D_ARRAY,0,0,0,0,ie.width,ie.height,ie.depth,he,Te,ie.data)}else t.texImage3D(n.TEXTURE_2D_ARRAY,0,Me,ie.width,ie.height,ie.depth,0,he,Te,ie.data);else if(x.isData3DTexture)je?($e&&t.texStorage3D(n.TEXTURE_3D,ze,Me,ie.width,ie.height,ie.depth),U&&t.texSubImage3D(n.TEXTURE_3D,0,0,0,0,ie.width,ie.height,ie.depth,he,Te,ie.data)):t.texImage3D(n.TEXTURE_3D,0,Me,ie.width,ie.height,ie.depth,0,he,Te,ie.data);else if(x.isFramebufferTexture){if($e)if(je)t.texStorage2D(n.TEXTURE_2D,ze,Me,ie.width,ie.height);else{let re=ie.width,we=ie.height;for(let Ee=0;Ee<ze;Ee++)t.texImage2D(n.TEXTURE_2D,Ee,Me,re,we,0,he,Te,null),re>>=1,we>>=1}}else if(x.isHTMLTexture){if("texElementImage2D"in n){const re=n.canvas;if(re.hasAttribute("layoutsubtree")||re.setAttribute("layoutsubtree","true"),ie.parentNode!==re){re.appendChild(ie),u.add(x),re.onpaint=we=>{const Ee=we.changedElements;for(const de of u)Ee.includes(de.image)&&(de.needsUpdate=!0)},re.requestPaint();return}if(n.texElementImage2D.length===3)n.texElementImage2D(n.TEXTURE_2D,n.RGBA8,ie);else{const Ee=n.RGBA,de=n.RGBA,Be=n.UNSIGNED_BYTE;n.texElementImage2D(n.TEXTURE_2D,0,Ee,de,Be,ie)}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(Ue.length>0){if(je&&$e){const re=vt(Ue[0]);t.texStorage2D(n.TEXTURE_2D,ze,Me,re.width,re.height)}for(let re=0,we=Ue.length;re<we;re++)_e=Ue[re],je?U&&t.texSubImage2D(n.TEXTURE_2D,re,0,0,he,Te,_e):t.texImage2D(n.TEXTURE_2D,re,Me,he,Te,_e);x.generateMipmaps=!1}else if(je){if($e){const re=vt(ie);t.texStorage2D(n.TEXTURE_2D,ze,Me,re.width,re.height)}U&&t.texSubImage2D(n.TEXTURE_2D,0,0,0,he,Te,ie)}else t.texImage2D(n.TEXTURE_2D,0,Me,he,Te,ie);m(x)&&_(Z),ye.__version=pe.version,x.onUpdate&&x.onUpdate(x)}N.__version=x.version}function Ze(N,x,V){if(x.image.length!==6)return;const Z=ne(N,x),$=x.source;t.bindTexture(n.TEXTURE_CUBE_MAP,N.__webglTexture,n.TEXTURE0+V);const pe=s.get($);if($.version!==pe.__version||Z===!0){t.activeTexture(n.TEXTURE0+V);const ye=mt.getPrimaries(mt.workingColorSpace),te=x.colorSpace===qn?null:mt.getPrimaries(x.colorSpace),ie=x.colorSpace===qn||ye===te?n.NONE:n.BROWSER_DEFAULT_WEBGL;t.pixelStorei(n.UNPACK_FLIP_Y_WEBGL,x.flipY),t.pixelStorei(n.UNPACK_PREMULTIPLY_ALPHA_WEBGL,x.premultiplyAlpha),t.pixelStorei(n.UNPACK_ALIGNMENT,x.unpackAlignment),t.pixelStorei(n.UNPACK_COLORSPACE_CONVERSION_WEBGL,ie);const he=x.isCompressedTexture||x.image[0].isCompressedTexture,Te=x.image[0]&&x.image[0].isDataTexture,Me=[];for(let de=0;de<6;de++)!he&&!Te?Me[de]=g(x.image[de],!0,i.maxCubemapSize):Me[de]=Te?x.image[de].image:x.image[de],Me[de]=Ft(x,Me[de]);const _e=Me[0],Ue=r.convert(x.format,x.colorSpace),je=r.convert(x.type),$e=z(x.internalFormat,Ue,je,x.normalized,x.colorSpace),U=x.isVideoTexture!==!0,ze=pe.__version===void 0||Z===!0,re=$.dataReady;let we=O(x,_e);Pe(n.TEXTURE_CUBE_MAP,x);let Ee;if(he){U&&ze&&t.texStorage2D(n.TEXTURE_CUBE_MAP,we,$e,_e.width,_e.height);for(let de=0;de<6;de++){Ee=Me[de].mipmaps;for(let Be=0;Be<Ee.length;Be++){const Ge=Ee[Be];x.format!==Vs?Ue!==null?U?re&&t.compressedTexSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+de,Be,0,0,Ge.width,Ge.height,Ue,Ge.data):t.compressedTexImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+de,Be,$e,Ge.width,Ge.height,0,Ge.data):He("WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):U?re&&t.texSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+de,Be,0,0,Ge.width,Ge.height,Ue,je,Ge.data):t.texImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+de,Be,$e,Ge.width,Ge.height,0,Ue,je,Ge.data)}}}else{if(Ee=x.mipmaps,U&&ze){Ee.length>0&&we++;const de=vt(Me[0]);t.texStorage2D(n.TEXTURE_CUBE_MAP,we,$e,de.width,de.height)}for(let de=0;de<6;de++)if(Te){U?re&&t.texSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+de,0,0,0,Me[de].width,Me[de].height,Ue,je,Me[de].data):t.texImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+de,0,$e,Me[de].width,Me[de].height,0,Ue,je,Me[de].data);for(let Be=0;Be<Ee.length;Be++){const ht=Ee[Be].image[de].image;U?re&&t.texSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+de,Be+1,0,0,ht.width,ht.height,Ue,je,ht.data):t.texImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+de,Be+1,$e,ht.width,ht.height,0,Ue,je,ht.data)}}else{U?re&&t.texSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+de,0,0,0,Ue,je,Me[de]):t.texImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+de,0,$e,Ue,je,Me[de]);for(let Be=0;Be<Ee.length;Be++){const Ge=Ee[Be];U?re&&t.texSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+de,Be+1,0,0,Ue,je,Ge.image[de]):t.texImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+de,Be+1,$e,Ue,je,Ge.image[de])}}}m(x)&&_(n.TEXTURE_CUBE_MAP),pe.__version=$.version,x.onUpdate&&x.onUpdate(x)}N.__version=x.version}function Fe(N,x,V,Z,$,pe){const ye=r.convert(V.format,V.colorSpace),te=r.convert(V.type),ie=z(V.internalFormat,ye,te,V.normalized,V.colorSpace),he=s.get(x),Te=s.get(V);if(Te.__renderTarget=x,!he.__hasExternalTextures){const Me=Math.max(1,x.width>>pe),_e=Math.max(1,x.height>>pe);$===n.TEXTURE_3D||$===n.TEXTURE_2D_ARRAY?t.texImage3D($,pe,ie,Me,_e,x.depth,0,ye,te,null):t.texImage2D($,pe,ie,Me,_e,0,ye,te,null)}t.bindFramebuffer(n.FRAMEBUFFER,N),Pt(x)?o.framebufferTexture2DMultisampleEXT(n.FRAMEBUFFER,Z,$,Te.__webglTexture,0,Ct(x)):($===n.TEXTURE_2D||$>=n.TEXTURE_CUBE_MAP_POSITIVE_X&&$<=n.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&n.framebufferTexture2D(n.FRAMEBUFFER,Z,$,Te.__webglTexture,pe),t.bindFramebuffer(n.FRAMEBUFFER,null)}function Lt(N,x,V){if(n.bindRenderbuffer(n.RENDERBUFFER,N),x.depthBuffer){const Z=x.depthTexture,$=Z&&Z.isDepthTexture?Z.type:null,pe=y(x.stencilBuffer,$),ye=x.stencilBuffer?n.DEPTH_STENCIL_ATTACHMENT:n.DEPTH_ATTACHMENT;Pt(x)?o.renderbufferStorageMultisampleEXT(n.RENDERBUFFER,Ct(x),pe,x.width,x.height):V?n.renderbufferStorageMultisample(n.RENDERBUFFER,Ct(x),pe,x.width,x.height):n.renderbufferStorage(n.RENDERBUFFER,pe,x.width,x.height),n.framebufferRenderbuffer(n.FRAMEBUFFER,ye,n.RENDERBUFFER,N)}else{const Z=x.textures;for(let $=0;$<Z.length;$++){const pe=Z[$],ye=r.convert(pe.format,pe.colorSpace),te=r.convert(pe.type),ie=z(pe.internalFormat,ye,te,pe.normalized,pe.colorSpace);Pt(x)?o.renderbufferStorageMultisampleEXT(n.RENDERBUFFER,Ct(x),ie,x.width,x.height):V?n.renderbufferStorageMultisample(n.RENDERBUFFER,Ct(x),ie,x.width,x.height):n.renderbufferStorage(n.RENDERBUFFER,ie,x.width,x.height)}}n.bindRenderbuffer(n.RENDERBUFFER,null)}function ot(N,x,V){const Z=x.isWebGLCubeRenderTarget===!0;if(t.bindFramebuffer(n.FRAMEBUFFER,N),!(x.depthTexture&&x.depthTexture.isDepthTexture))throw new Error("THREE.WebGLTextures: renderTarget.depthTexture must be an instance of THREE.DepthTexture.");const $=s.get(x.depthTexture);if($.__renderTarget=x,(!$.__webglTexture||x.depthTexture.image.width!==x.width||x.depthTexture.image.height!==x.height)&&(x.depthTexture.image.width=x.width,x.depthTexture.image.height=x.height,x.depthTexture.needsUpdate=!0),Z){if($.__webglInit===void 0&&($.__webglInit=!0,x.depthTexture.addEventListener("dispose",S)),$.__webglTexture===void 0){$.__webglTexture=n.createTexture(),t.bindTexture(n.TEXTURE_CUBE_MAP,$.__webglTexture),Pe(n.TEXTURE_CUBE_MAP,x.depthTexture);const he=r.convert(x.depthTexture.format),Te=r.convert(x.depthTexture.type);let Me;x.depthTexture.format===Tn?Me=n.DEPTH_COMPONENT24:x.depthTexture.format===vi&&(Me=n.DEPTH24_STENCIL8);for(let _e=0;_e<6;_e++)n.texImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+_e,0,Me,x.width,x.height,0,he,Te,null)}}else H(x.depthTexture,0);const pe=$.__webglTexture,ye=Ct(x),te=Z?n.TEXTURE_CUBE_MAP_POSITIVE_X+V:n.TEXTURE_2D,ie=x.depthTexture.format===vi?n.DEPTH_STENCIL_ATTACHMENT:n.DEPTH_ATTACHMENT;if(x.depthTexture.format===Tn)Pt(x)?o.framebufferTexture2DMultisampleEXT(n.FRAMEBUFFER,ie,te,pe,0,ye):n.framebufferTexture2D(n.FRAMEBUFFER,ie,te,pe,0);else if(x.depthTexture.format===vi)Pt(x)?o.framebufferTexture2DMultisampleEXT(n.FRAMEBUFFER,ie,te,pe,0,ye):n.framebufferTexture2D(n.FRAMEBUFFER,ie,te,pe,0);else throw new Error("THREE.WebGLTextures: Unknown depthTexture format.")}function yt(N){const x=s.get(N),V=N.isWebGLCubeRenderTarget===!0;if(x.__boundDepthTexture!==N.depthTexture){const Z=N.depthTexture;if(x.__depthDisposeCallback&&x.__depthDisposeCallback(),Z){const $=()=>{delete x.__boundDepthTexture,delete x.__depthDisposeCallback,Z.removeEventListener("dispose",$)};Z.addEventListener("dispose",$),x.__depthDisposeCallback=$}x.__boundDepthTexture=Z}if(N.depthTexture&&!x.__autoAllocateDepthBuffer)if(V)for(let Z=0;Z<6;Z++)ot(x.__webglFramebuffer[Z],N,Z);else{const Z=N.texture.mipmaps;Z&&Z.length>0?ot(x.__webglFramebuffer[0],N,0):ot(x.__webglFramebuffer,N,0)}else if(V){x.__webglDepthbuffer=[];for(let Z=0;Z<6;Z++)if(t.bindFramebuffer(n.FRAMEBUFFER,x.__webglFramebuffer[Z]),x.__webglDepthbuffer[Z]===void 0)x.__webglDepthbuffer[Z]=n.createRenderbuffer(),Lt(x.__webglDepthbuffer[Z],N,!1);else{const $=N.stencilBuffer?n.DEPTH_STENCIL_ATTACHMENT:n.DEPTH_ATTACHMENT,pe=x.__webglDepthbuffer[Z];n.bindRenderbuffer(n.RENDERBUFFER,pe),n.framebufferRenderbuffer(n.FRAMEBUFFER,$,n.RENDERBUFFER,pe)}}else{const Z=N.texture.mipmaps;if(Z&&Z.length>0?t.bindFramebuffer(n.FRAMEBUFFER,x.__webglFramebuffer[0]):t.bindFramebuffer(n.FRAMEBUFFER,x.__webglFramebuffer),x.__webglDepthbuffer===void 0)x.__webglDepthbuffer=n.createRenderbuffer(),Lt(x.__webglDepthbuffer,N,!1);else{const $=N.stencilBuffer?n.DEPTH_STENCIL_ATTACHMENT:n.DEPTH_ATTACHMENT,pe=x.__webglDepthbuffer;n.bindRenderbuffer(n.RENDERBUFFER,pe),n.framebufferRenderbuffer(n.FRAMEBUFFER,$,n.RENDERBUFFER,pe)}}t.bindFramebuffer(n.FRAMEBUFFER,null)}function ut(N,x,V){const Z=s.get(N);x!==void 0&&Fe(Z.__webglFramebuffer,N,N.texture,n.COLOR_ATTACHMENT0,n.TEXTURE_2D,0),V!==void 0&&yt(N)}function lt(N){const x=N.texture,V=s.get(N),Z=s.get(x);N.addEventListener("dispose",b);const $=N.textures,pe=N.isWebGLCubeRenderTarget===!0,ye=$.length>1;if(ye||(Z.__webglTexture===void 0&&(Z.__webglTexture=n.createTexture()),Z.__version=x.version,a.memory.textures++),pe){V.__webglFramebuffer=[];for(let te=0;te<6;te++)if(x.mipmaps&&x.mipmaps.length>0){V.__webglFramebuffer[te]=[];for(let ie=0;ie<x.mipmaps.length;ie++)V.__webglFramebuffer[te][ie]=n.createFramebuffer()}else V.__webglFramebuffer[te]=n.createFramebuffer()}else{if(x.mipmaps&&x.mipmaps.length>0){V.__webglFramebuffer=[];for(let te=0;te<x.mipmaps.length;te++)V.__webglFramebuffer[te]=n.createFramebuffer()}else V.__webglFramebuffer=n.createFramebuffer();if(ye)for(let te=0,ie=$.length;te<ie;te++){const he=s.get($[te]);he.__webglTexture===void 0&&(he.__webglTexture=n.createTexture(),a.memory.textures++)}if(N.samples>0&&Pt(N)===!1){V.__webglMultisampledFramebuffer=n.createFramebuffer(),V.__webglColorRenderbuffer=[],t.bindFramebuffer(n.FRAMEBUFFER,V.__webglMultisampledFramebuffer);for(let te=0;te<$.length;te++){const ie=$[te];V.__webglColorRenderbuffer[te]=n.createRenderbuffer(),n.bindRenderbuffer(n.RENDERBUFFER,V.__webglColorRenderbuffer[te]);const he=r.convert(ie.format,ie.colorSpace),Te=r.convert(ie.type),Me=z(ie.internalFormat,he,Te,ie.normalized,ie.colorSpace,N.isXRRenderTarget===!0),_e=Ct(N);n.renderbufferStorageMultisample(n.RENDERBUFFER,_e,Me,N.width,N.height),n.framebufferRenderbuffer(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0+te,n.RENDERBUFFER,V.__webglColorRenderbuffer[te])}n.bindRenderbuffer(n.RENDERBUFFER,null),N.depthBuffer&&(V.__webglDepthRenderbuffer=n.createRenderbuffer(),Lt(V.__webglDepthRenderbuffer,N,!0)),t.bindFramebuffer(n.FRAMEBUFFER,null)}}if(pe){t.bindTexture(n.TEXTURE_CUBE_MAP,Z.__webglTexture),Pe(n.TEXTURE_CUBE_MAP,x);for(let te=0;te<6;te++)if(x.mipmaps&&x.mipmaps.length>0)for(let ie=0;ie<x.mipmaps.length;ie++)Fe(V.__webglFramebuffer[te][ie],N,x,n.COLOR_ATTACHMENT0,n.TEXTURE_CUBE_MAP_POSITIVE_X+te,ie);else Fe(V.__webglFramebuffer[te],N,x,n.COLOR_ATTACHMENT0,n.TEXTURE_CUBE_MAP_POSITIVE_X+te,0);m(x)&&_(n.TEXTURE_CUBE_MAP),t.unbindTexture()}else if(ye){for(let te=0,ie=$.length;te<ie;te++){const he=$[te],Te=s.get(he);let Me=n.TEXTURE_2D;(N.isWebGL3DRenderTarget||N.isWebGLArrayRenderTarget)&&(Me=N.isWebGL3DRenderTarget?n.TEXTURE_3D:n.TEXTURE_2D_ARRAY),t.bindTexture(Me,Te.__webglTexture),Pe(Me,he),Fe(V.__webglFramebuffer,N,he,n.COLOR_ATTACHMENT0+te,Me,0),m(he)&&_(Me)}t.unbindTexture()}else{let te=n.TEXTURE_2D;if((N.isWebGL3DRenderTarget||N.isWebGLArrayRenderTarget)&&(te=N.isWebGL3DRenderTarget?n.TEXTURE_3D:n.TEXTURE_2D_ARRAY),t.bindTexture(te,Z.__webglTexture),Pe(te,x),x.mipmaps&&x.mipmaps.length>0)for(let ie=0;ie<x.mipmaps.length;ie++)Fe(V.__webglFramebuffer[ie],N,x,n.COLOR_ATTACHMENT0,te,ie);else Fe(V.__webglFramebuffer,N,x,n.COLOR_ATTACHMENT0,te,0);m(x)&&_(te),t.unbindTexture()}N.depthBuffer&&yt(N)}function Gt(N){const x=N.textures;for(let V=0,Z=x.length;V<Z;V++){const $=x[V];if(m($)){const pe=w(N),ye=s.get($).__webglTexture;t.bindTexture(pe,ye),_(pe),t.unbindTexture()}}}const Bt=[],$t=[];function xt(N){if(N.samples>0){if(Pt(N)===!1){const x=N.textures,V=N.width,Z=N.height;let $=n.COLOR_BUFFER_BIT;const pe=N.stencilBuffer?n.DEPTH_STENCIL_ATTACHMENT:n.DEPTH_ATTACHMENT,ye=s.get(N),te=x.length>1;if(te)for(let he=0;he<x.length;he++)t.bindFramebuffer(n.FRAMEBUFFER,ye.__webglMultisampledFramebuffer),n.framebufferRenderbuffer(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0+he,n.RENDERBUFFER,null),t.bindFramebuffer(n.FRAMEBUFFER,ye.__webglFramebuffer),n.framebufferTexture2D(n.DRAW_FRAMEBUFFER,n.COLOR_ATTACHMENT0+he,n.TEXTURE_2D,null,0);t.bindFramebuffer(n.READ_FRAMEBUFFER,ye.__webglMultisampledFramebuffer);const ie=N.texture.mipmaps;ie&&ie.length>0?t.bindFramebuffer(n.DRAW_FRAMEBUFFER,ye.__webglFramebuffer[0]):t.bindFramebuffer(n.DRAW_FRAMEBUFFER,ye.__webglFramebuffer);for(let he=0;he<x.length;he++){if(N.resolveDepthBuffer&&(N.depthBuffer&&($|=n.DEPTH_BUFFER_BIT),N.stencilBuffer&&N.resolveStencilBuffer&&($|=n.STENCIL_BUFFER_BIT)),te){n.framebufferRenderbuffer(n.READ_FRAMEBUFFER,n.COLOR_ATTACHMENT0,n.RENDERBUFFER,ye.__webglColorRenderbuffer[he]);const Te=s.get(x[he]).__webglTexture;n.framebufferTexture2D(n.DRAW_FRAMEBUFFER,n.COLOR_ATTACHMENT0,n.TEXTURE_2D,Te,0)}n.blitFramebuffer(0,0,V,Z,0,0,V,Z,$,n.NEAREST),l===!0&&(Bt.length=0,$t.length=0,Bt.push(n.COLOR_ATTACHMENT0+he),N.depthBuffer&&N.resolveDepthBuffer===!1&&(Bt.push(pe),$t.push(pe),n.invalidateFramebuffer(n.DRAW_FRAMEBUFFER,$t)),n.invalidateFramebuffer(n.READ_FRAMEBUFFER,Bt))}if(t.bindFramebuffer(n.READ_FRAMEBUFFER,null),t.bindFramebuffer(n.DRAW_FRAMEBUFFER,null),te)for(let he=0;he<x.length;he++){t.bindFramebuffer(n.FRAMEBUFFER,ye.__webglMultisampledFramebuffer),n.framebufferRenderbuffer(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0+he,n.RENDERBUFFER,ye.__webglColorRenderbuffer[he]);const Te=s.get(x[he]).__webglTexture;t.bindFramebuffer(n.FRAMEBUFFER,ye.__webglFramebuffer),n.framebufferTexture2D(n.DRAW_FRAMEBUFFER,n.COLOR_ATTACHMENT0+he,n.TEXTURE_2D,Te,0)}t.bindFramebuffer(n.DRAW_FRAMEBUFFER,ye.__webglMultisampledFramebuffer)}else if(N.depthBuffer&&N.resolveDepthBuffer===!1&&l){const x=N.stencilBuffer?n.DEPTH_STENCIL_ATTACHMENT:n.DEPTH_ATTACHMENT;n.invalidateFramebuffer(n.DRAW_FRAMEBUFFER,[x])}}}function Ct(N){return Math.min(i.maxSamples,N.samples)}function Pt(N){const x=s.get(N);return N.samples>0&&e.has("WEBGL_multisampled_render_to_texture")===!0&&x.__useRenderToTexture!==!1}function j(N){const x=a.render.frame;d.get(N)!==x&&(d.set(N,x),N.update())}function Ft(N,x){const V=N.colorSpace,Z=N.format,$=N.type;return N.isCompressedTexture===!0||N.isVideoTexture===!0||V!==Jo&&V!==qn&&(mt.getTransfer(V)===St?(Z!==Vs||$!==Ss)&&He("WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):pt("WebGLTextures: Unsupported texture color space:",V)),x}function vt(N){return typeof HTMLImageElement<"u"&&N instanceof HTMLImageElement?(c.width=N.naturalWidth||N.width,c.height=N.naturalHeight||N.height):typeof VideoFrame<"u"&&N instanceof VideoFrame?(c.width=N.displayWidth,c.height=N.displayHeight):(c.width=N.width,c.height=N.height),c}this.allocateTextureUnit=P,this.resetTextureUnits=G,this.getTextureUnits=C,this.setTextureUnits=B,this.setTexture2D=H,this.setTexture2DArray=X,this.setTexture3D=oe,this.setTextureCube=J,this.rebindTextures=ut,this.setupRenderTarget=lt,this.updateRenderTargetMipmap=Gt,this.updateMultisampleRenderTarget=xt,this.setupDepthRenderbuffer=yt,this.setupFrameBufferTexture=Fe,this.useMultisampledRTT=Pt,this.isReversedDepthBuffer=function(){return t.buffers.depth.getReversed()}}function CA(n,e){function t(s,i=qn){let r;const a=mt.getTransfer(i);if(s===Ss)return n.UNSIGNED_BYTE;if(s===Pu)return n.UNSIGNED_SHORT_4_4_4_4;if(s===Lu)return n.UNSIGNED_SHORT_5_5_5_1;if(s===Hg)return n.UNSIGNED_INT_5_9_9_9_REV;if(s===qg)return n.UNSIGNED_INT_10F_11F_11F_REV;if(s===$g)return n.BYTE;if(s===Vg)return n.SHORT;if(s===ya)return n.UNSIGNED_SHORT;if(s===Cu)return n.INT;if(s===on)return n.UNSIGNED_INT;if(s===$s)return n.FLOAT;if(s===Dn)return n.HALF_FLOAT;if(s===Xg)return n.ALPHA;if(s===Kg)return n.RGB;if(s===Vs)return n.RGBA;if(s===Tn)return n.DEPTH_COMPONENT;if(s===vi)return n.DEPTH_STENCIL;if(s===Wu)return n.RED;if(s===ku)return n.RED_INTEGER;if(s===Wi)return n.RG;if(s===Uu)return n.RG_INTEGER;if(s===Fu)return n.RGBA_INTEGER;if(s===xo||s===So||s===Eo||s===Ao)if(a===St)if(r=e.get("WEBGL_compressed_texture_s3tc_srgb"),r!==null){if(s===xo)return r.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(s===So)return r.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(s===Eo)return r.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(s===Ao)return r.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(r=e.get("WEBGL_compressed_texture_s3tc"),r!==null){if(s===xo)return r.COMPRESSED_RGB_S3TC_DXT1_EXT;if(s===So)return r.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(s===Eo)return r.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(s===Ao)return r.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(s===zd||s===wd||s===yd||s===vd)if(r=e.get("WEBGL_compressed_texture_pvrtc"),r!==null){if(s===zd)return r.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(s===wd)return r.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(s===yd)return r.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(s===vd)return r.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(s===Od||s===xd||s===Sd||s===Ed||s===Ad||s===Zo||s===Dd)if(r=e.get("WEBGL_compressed_texture_etc"),r!==null){if(s===Od||s===xd)return a===St?r.COMPRESSED_SRGB8_ETC2:r.COMPRESSED_RGB8_ETC2;if(s===Sd)return a===St?r.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:r.COMPRESSED_RGBA8_ETC2_EAC;if(s===Ed)return r.COMPRESSED_R11_EAC;if(s===Ad)return r.COMPRESSED_SIGNED_R11_EAC;if(s===Zo)return r.COMPRESSED_RG11_EAC;if(s===Dd)return r.COMPRESSED_SIGNED_RG11_EAC}else return null;if(s===Td||s===Id||s===Gd||s===Rd||s===Nd||s===Bd||s===Cd||s===Pd||s===Ld||s===Wd||s===kd||s===Ud||s===Fd||s===jd)if(r=e.get("WEBGL_compressed_texture_astc"),r!==null){if(s===Td)return a===St?r.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:r.COMPRESSED_RGBA_ASTC_4x4_KHR;if(s===Id)return a===St?r.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:r.COMPRESSED_RGBA_ASTC_5x4_KHR;if(s===Gd)return a===St?r.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:r.COMPRESSED_RGBA_ASTC_5x5_KHR;if(s===Rd)return a===St?r.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:r.COMPRESSED_RGBA_ASTC_6x5_KHR;if(s===Nd)return a===St?r.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:r.COMPRESSED_RGBA_ASTC_6x6_KHR;if(s===Bd)return a===St?r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:r.COMPRESSED_RGBA_ASTC_8x5_KHR;if(s===Cd)return a===St?r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:r.COMPRESSED_RGBA_ASTC_8x6_KHR;if(s===Pd)return a===St?r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:r.COMPRESSED_RGBA_ASTC_8x8_KHR;if(s===Ld)return a===St?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:r.COMPRESSED_RGBA_ASTC_10x5_KHR;if(s===Wd)return a===St?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:r.COMPRESSED_RGBA_ASTC_10x6_KHR;if(s===kd)return a===St?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:r.COMPRESSED_RGBA_ASTC_10x8_KHR;if(s===Ud)return a===St?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:r.COMPRESSED_RGBA_ASTC_10x10_KHR;if(s===Fd)return a===St?r.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:r.COMPRESSED_RGBA_ASTC_12x10_KHR;if(s===jd)return a===St?r.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:r.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(s===$d||s===Vd||s===Hd)if(r=e.get("EXT_texture_compression_bptc"),r!==null){if(s===$d)return a===St?r.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:r.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(s===Vd)return r.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(s===Hd)return r.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(s===qd||s===Xd||s===Qo||s===Kd)if(r=e.get("EXT_texture_compression_rgtc"),r!==null){if(s===qd)return r.COMPRESSED_RED_RGTC1_EXT;if(s===Xd)return r.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(s===Qo)return r.COMPRESSED_RED_GREEN_RGTC2_EXT;if(s===Kd)return r.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return s===va?n.UNSIGNED_INT_24_8:n[s]!==void 0?n[s]:null}return{convert:t}}const PA=`
4115
+ }`,IA=[new k(1,0,0),new k(-1,0,0),new k(0,1,0),new k(0,-1,0),new k(0,0,1),new k(0,0,-1)],GA=[new k(0,-1,0),new k(0,-1,0),new k(0,0,1),new k(0,0,-1),new k(0,-1,0),new k(0,-1,0)],Dp=new wt,na=new k,Sc=new k;function RA(n,e,t){let s=new Yu;const i=new et,r=new et,a=new Wt,o=new UO,l=new FO,c={},d=t.maxTextureSize,u={[ri]:gs,[gs]:ri,[zn]:zn},h=new jt({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new et},radius:{value:4}},vertexShader:DA,fragmentShader:TA}),p=h.clone();p.defines.HORIZONTAL_PASS=1;const f=new qt;f.setAttribute("position",new ts(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const M=new Ms(f,h),g=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=Oo;let m=this.type;this.render=function(O,S,b){if(g.enabled===!1||g.autoUpdate===!1&&g.needsUpdate===!1||O.length===0)return;this.type===Av&&(He("WebGLShadowMap: PCFSoftShadowMap has been deprecated. Using PCFShadowMap instead."),this.type=Oo);const v=n.getRenderTarget(),E=n.getActiveCubeFace(),A=n.getActiveMipmapLevel(),I=n.state;I.setBlending(Sn),I.buffers.depth.getReversed()===!0?I.buffers.color.setClear(0,0,0,0):I.buffers.color.setClear(1,1,1,1),I.buffers.depth.setTest(!0),I.setScissorTest(!1);const G=m!==this.type;G&&S.traverse(function(C){C.material&&(Array.isArray(C.material)?C.material.forEach(B=>B.needsUpdate=!0):C.material.needsUpdate=!0)});for(let C=0,B=O.length;C<B;C++){const P=O[C],W=P.shadow;if(W===void 0){He("WebGLShadowMap:",P,"has no shadow.");continue}if(W.autoUpdate===!1&&W.needsUpdate===!1)continue;i.copy(W.mapSize);const H=W.getFrameExtents();i.multiply(H),r.copy(W.mapSize),(i.x>d||i.y>d)&&(i.x>d&&(r.x=Math.floor(d/H.x),i.x=r.x*H.x,W.mapSize.x=r.x),i.y>d&&(r.y=Math.floor(d/H.y),i.y=r.y*H.y,W.mapSize.y=r.y));const X=n.state.buffers.depth.getReversed();if(W.camera._reversedDepth=X,W.map===null||G===!0){if(W.map!==null&&(W.map.depthTexture!==null&&(W.map.depthTexture.dispose(),W.map.depthTexture=null),W.map.dispose()),this.type===ua){if(P.isPointLight){He("WebGLShadowMap: VSM shadow maps are not supported for PointLights. Use PCF or BasicShadowMap instead.");continue}W.map=new rn(i.x,i.y,{format:Wi,type:Dn,minFilter:os,magFilter:os,generateMipmaps:!1}),W.map.texture.name=P.name+".shadowMap",W.map.depthTexture=new Rr(i.x,i.y,$s),W.map.depthTexture.name=P.name+".shadowMapDepth",W.map.depthTexture.format=Tn,W.map.depthTexture.compareFunction=null,W.map.depthTexture.minFilter=ss,W.map.depthTexture.magFilter=ss}else P.isPointLight?(W.map=new uM(i.x),W.map.depthTexture=new BO(i.x,on)):(W.map=new rn(i.x,i.y),W.map.depthTexture=new Rr(i.x,i.y,on)),W.map.depthTexture.name=P.name+".shadowMap",W.map.depthTexture.format=Tn,this.type===Oo?(W.map.depthTexture.compareFunction=X?$u:ju,W.map.depthTexture.minFilter=os,W.map.depthTexture.magFilter=os):(W.map.depthTexture.compareFunction=null,W.map.depthTexture.minFilter=ss,W.map.depthTexture.magFilter=ss);W.camera.updateProjectionMatrix()}const oe=W.map.isWebGLCubeRenderTarget?6:1;for(let J=0;J<oe;J++){if(W.map.isWebGLCubeRenderTarget)n.setRenderTarget(W.map,J),n.clear();else{J===0&&(n.setRenderTarget(W.map),n.clear());const ce=W.getViewport(J);a.set(r.x*ce.x,r.y*ce.y,r.x*ce.z,r.y*ce.w),I.viewport(a)}if(P.isPointLight){const ce=W.camera,We=W.matrix,qe=P.distance||ce.far;qe!==ce.far&&(ce.far=qe,ce.updateProjectionMatrix()),na.setFromMatrixPosition(P.matrixWorld),ce.position.copy(na),Sc.copy(ce.position),Sc.add(IA[J]),ce.up.copy(GA[J]),ce.lookAt(Sc),ce.updateMatrixWorld(),We.makeTranslation(-na.x,-na.y,-na.z),Dp.multiplyMatrices(ce.projectionMatrix,ce.matrixWorldInverse),W._frustum.setFromProjectionMatrix(Dp,ce.coordinateSystem,ce.reversedDepth)}else W.updateMatrices(P);s=W.getFrustum(),z(S,b,W.camera,P,this.type)}W.isPointLightShadow!==!0&&this.type===ua&&_(W,b),W.needsUpdate=!1}m=this.type,g.needsUpdate=!1,n.setRenderTarget(v,E,A)};function _(O,S){const b=e.update(M);h.defines.VSM_SAMPLES!==O.blurSamples&&(h.defines.VSM_SAMPLES=O.blurSamples,p.defines.VSM_SAMPLES=O.blurSamples,h.needsUpdate=!0,p.needsUpdate=!0),O.mapPass===null&&(O.mapPass=new rn(i.x,i.y,{format:Wi,type:Dn})),h.uniforms.shadow_pass.value=O.map.depthTexture,h.uniforms.resolution.value=O.mapSize,h.uniforms.radius.value=O.radius,n.setRenderTarget(O.mapPass),n.clear(),n.renderBufferDirect(S,null,b,h,M,null),p.uniforms.shadow_pass.value=O.mapPass.texture,p.uniforms.resolution.value=O.mapSize,p.uniforms.radius.value=O.radius,n.setRenderTarget(O.map),n.clear(),n.renderBufferDirect(S,null,b,p,M,null)}function w(O,S,b,v){let E=null;const A=b.isPointLight===!0?O.customDistanceMaterial:O.customDepthMaterial;if(A!==void 0)E=A;else if(E=b.isPointLight===!0?l:o,n.localClippingEnabled&&S.clipShadows===!0&&Array.isArray(S.clippingPlanes)&&S.clippingPlanes.length!==0||S.displacementMap&&S.displacementScale!==0||S.alphaMap&&S.alphaTest>0||S.map&&S.alphaTest>0||S.alphaToCoverage===!0){const I=E.uuid,G=S.uuid;let C=c[I];C===void 0&&(C={},c[I]=C);let B=C[G];B===void 0&&(B=E.clone(),C[G]=B,S.addEventListener("dispose",y)),E=B}if(E.visible=S.visible,E.wireframe=S.wireframe,v===ua?E.side=S.shadowSide!==null?S.shadowSide:S.side:E.side=S.shadowSide!==null?S.shadowSide:u[S.side],E.alphaMap=S.alphaMap,E.alphaTest=S.alphaToCoverage===!0?.5:S.alphaTest,E.map=S.map,E.clipShadows=S.clipShadows,E.clippingPlanes=S.clippingPlanes,E.clipIntersection=S.clipIntersection,E.displacementMap=S.displacementMap,E.displacementScale=S.displacementScale,E.displacementBias=S.displacementBias,E.wireframeLinewidth=S.wireframeLinewidth,E.linewidth=S.linewidth,b.isPointLight===!0&&E.isMeshDistanceMaterial===!0){const I=n.properties.get(E);I.light=b}return E}function z(O,S,b,v,E){if(O.visible===!1)return;if(O.layers.test(S.layers)&&(O.isMesh||O.isLine||O.isPoints)&&(O.castShadow||O.receiveShadow&&E===ua)&&(!O.frustumCulled||s.intersectsObject(O))){O.modelViewMatrix.multiplyMatrices(b.matrixWorldInverse,O.matrixWorld);const G=e.update(O),C=O.material;if(Array.isArray(C)){const B=G.groups;for(let P=0,W=B.length;P<W;P++){const H=B[P],X=C[H.materialIndex];if(X&&X.visible){const oe=w(O,X,v,E);O.onBeforeShadow(n,O,S,b,G,oe,H),n.renderBufferDirect(b,null,G,oe,O,H),O.onAfterShadow(n,O,S,b,G,oe,H)}}}else if(C.visible){const B=w(O,C,v,E);O.onBeforeShadow(n,O,S,b,G,B,null),n.renderBufferDirect(b,null,G,B,O,null),O.onAfterShadow(n,O,S,b,G,B,null)}}const I=O.children;for(let G=0,C=I.length;G<C;G++)z(I[G],S,b,v,E)}function y(O){O.target.removeEventListener("dispose",y);for(const b in c){const v=c[b],E=O.target.uuid;E in v&&(v[E].dispose(),delete v[E])}}}function NA(n,e){function t(){let U=!1;const ze=new Wt;let re=null;const we=new Wt(0,0,0,0);return{setMask:function(Ee){re!==Ee&&!U&&(n.colorMask(Ee,Ee,Ee,Ee),re=Ee)},setLocked:function(Ee){U=Ee},setClear:function(Ee,de,Be,Ge,ht){ht===!0&&(Ee*=Ge,de*=Ge,Be*=Ge),ze.set(Ee,de,Be,Ge),we.equals(ze)===!1&&(n.clearColor(Ee,de,Be,Ge),we.copy(ze))},reset:function(){U=!1,re=null,we.set(-1,0,0,0)}}}function s(){let U=!1,ze=!1,re=null,we=null,Ee=null;return{setReversed:function(de){if(ze!==de){const Be=e.get("EXT_clip_control");de?Be.clipControlEXT(Be.LOWER_LEFT_EXT,Be.ZERO_TO_ONE_EXT):Be.clipControlEXT(Be.LOWER_LEFT_EXT,Be.NEGATIVE_ONE_TO_ONE_EXT),ze=de;const Ge=Ee;Ee=null,this.setClear(Ge)}},getReversed:function(){return ze},setTest:function(de){de?ue(n.DEPTH_TEST):Xe(n.DEPTH_TEST)},setMask:function(de){re!==de&&!U&&(n.depthMask(de),re=de)},setFunc:function(de){if(ze&&(de=oO[de]),we!==de){switch(de){case ud:n.depthFunc(n.NEVER);break;case hd:n.depthFunc(n.ALWAYS);break;case fd:n.depthFunc(n.LESS);break;case Ir:n.depthFunc(n.LEQUAL);break;case pd:n.depthFunc(n.EQUAL);break;case md:n.depthFunc(n.GEQUAL);break;case gd:n.depthFunc(n.GREATER);break;case Md:n.depthFunc(n.NOTEQUAL);break;default:n.depthFunc(n.LEQUAL)}we=de}},setLocked:function(de){U=de},setClear:function(de){Ee!==de&&(Ee=de,ze&&(de=1-de),n.clearDepth(de))},reset:function(){U=!1,re=null,we=null,Ee=null,ze=!1}}}function i(){let U=!1,ze=null,re=null,we=null,Ee=null,de=null,Be=null,Ge=null,ht=null;return{setTest:function(Et){U||(Et?ue(n.STENCIL_TEST):Xe(n.STENCIL_TEST))},setMask:function(Et){ze!==Et&&!U&&(n.stencilMask(Et),ze=Et)},setFunc:function(Et,_s,zs){(re!==Et||we!==_s||Ee!==zs)&&(n.stencilFunc(Et,_s,zs),re=Et,we=_s,Ee=zs)},setOp:function(Et,_s,zs){(de!==Et||Be!==_s||Ge!==zs)&&(n.stencilOp(Et,_s,zs),de=Et,Be=_s,Ge=zs)},setLocked:function(Et){U=Et},setClear:function(Et){ht!==Et&&(n.clearStencil(Et),ht=Et)},reset:function(){U=!1,ze=null,re=null,we=null,Ee=null,de=null,Be=null,Ge=null,ht=null}}}const r=new t,a=new s,o=new i,l=new WeakMap,c=new WeakMap;let d={},u={},h={},p=new WeakMap,f=[],M=null,g=!1,m=null,_=null,w=null,z=null,y=null,O=null,S=null,b=new ke(0,0,0),v=0,E=!1,A=null,I=null,G=null,C=null,B=null;const P=n.getParameter(n.MAX_COMBINED_TEXTURE_IMAGE_UNITS);let W=!1,H=0;const X=n.getParameter(n.VERSION);X.indexOf("WebGL")!==-1?(H=parseFloat(/^WebGL (\d)/.exec(X)[1]),W=H>=1):X.indexOf("OpenGL ES")!==-1&&(H=parseFloat(/^OpenGL ES (\d)/.exec(X)[1]),W=H>=2);let oe=null,J={};const ce=n.getParameter(n.SCISSOR_BOX),We=n.getParameter(n.VIEWPORT),qe=new Wt().fromArray(ce),Pe=new Wt().fromArray(We);function ne(U,ze,re,we){const Ee=new Uint8Array(4),de=n.createTexture();n.bindTexture(U,de),n.texParameteri(U,n.TEXTURE_MIN_FILTER,n.NEAREST),n.texParameteri(U,n.TEXTURE_MAG_FILTER,n.NEAREST);for(let Be=0;Be<re;Be++)U===n.TEXTURE_3D||U===n.TEXTURE_2D_ARRAY?n.texImage3D(ze,0,n.RGBA,1,1,we,0,n.RGBA,n.UNSIGNED_BYTE,Ee):n.texImage2D(ze+Be,0,n.RGBA,1,1,0,n.RGBA,n.UNSIGNED_BYTE,Ee);return de}const ae={};ae[n.TEXTURE_2D]=ne(n.TEXTURE_2D,n.TEXTURE_2D,1),ae[n.TEXTURE_CUBE_MAP]=ne(n.TEXTURE_CUBE_MAP,n.TEXTURE_CUBE_MAP_POSITIVE_X,6),ae[n.TEXTURE_2D_ARRAY]=ne(n.TEXTURE_2D_ARRAY,n.TEXTURE_2D_ARRAY,1,1),ae[n.TEXTURE_3D]=ne(n.TEXTURE_3D,n.TEXTURE_3D,1,1),r.setClear(0,0,0,1),a.setClear(1),o.setClear(0),ue(n.DEPTH_TEST),a.setFunc(Ir),Gt(!1),Bt(yf),ue(n.CULL_FACE),ut(Sn);function ue(U){d[U]!==!0&&(n.enable(U),d[U]=!0)}function Xe(U){d[U]!==!1&&(n.disable(U),d[U]=!1)}function Ze(U,ze){return h[U]!==ze?(n.bindFramebuffer(U,ze),h[U]=ze,U===n.DRAW_FRAMEBUFFER&&(h[n.FRAMEBUFFER]=ze),U===n.FRAMEBUFFER&&(h[n.DRAW_FRAMEBUFFER]=ze),!0):!1}function Fe(U,ze){let re=f,we=!1;if(U){re=p.get(ze),re===void 0&&(re=[],p.set(ze,re));const Ee=U.textures;if(re.length!==Ee.length||re[0]!==n.COLOR_ATTACHMENT0){for(let de=0,Be=Ee.length;de<Be;de++)re[de]=n.COLOR_ATTACHMENT0+de;re.length=Ee.length,we=!0}}else re[0]!==n.BACK&&(re[0]=n.BACK,we=!0);we&&n.drawBuffers(re)}function Lt(U){return M!==U?(n.useProgram(U),M=U,!0):!1}const ot={[_i]:n.FUNC_ADD,[Tv]:n.FUNC_SUBTRACT,[Iv]:n.FUNC_REVERSE_SUBTRACT};ot[Gv]=n.MIN,ot[Rv]=n.MAX;const yt={[Nv]:n.ZERO,[Bv]:n.ONE,[Cv]:n.SRC_COLOR,[cd]:n.SRC_ALPHA,[Fv]:n.SRC_ALPHA_SATURATE,[kv]:n.DST_COLOR,[Lv]:n.DST_ALPHA,[Pv]:n.ONE_MINUS_SRC_COLOR,[dd]:n.ONE_MINUS_SRC_ALPHA,[Uv]:n.ONE_MINUS_DST_COLOR,[Wv]:n.ONE_MINUS_DST_ALPHA,[jv]:n.CONSTANT_COLOR,[$v]:n.ONE_MINUS_CONSTANT_COLOR,[Vv]:n.CONSTANT_ALPHA,[Hv]:n.ONE_MINUS_CONSTANT_ALPHA};function ut(U,ze,re,we,Ee,de,Be,Ge,ht,Et){if(U===Sn){g===!0&&(Xe(n.BLEND),g=!1);return}if(g===!1&&(ue(n.BLEND),g=!0),U!==Dv){if(U!==m||Et!==E){if((_!==_i||y!==_i)&&(n.blendEquation(n.FUNC_ADD),_=_i,y=_i),Et)switch(U){case Ei:n.blendFuncSeparate(n.ONE,n.ONE_MINUS_SRC_ALPHA,n.ONE,n.ONE_MINUS_SRC_ALPHA);break;case Pi:n.blendFunc(n.ONE,n.ONE);break;case vf:n.blendFuncSeparate(n.ZERO,n.ONE_MINUS_SRC_COLOR,n.ZERO,n.ONE);break;case Of:n.blendFuncSeparate(n.DST_COLOR,n.ONE_MINUS_SRC_ALPHA,n.ZERO,n.ONE);break;default:pt("WebGLState: Invalid blending: ",U);break}else switch(U){case Ei:n.blendFuncSeparate(n.SRC_ALPHA,n.ONE_MINUS_SRC_ALPHA,n.ONE,n.ONE_MINUS_SRC_ALPHA);break;case Pi:n.blendFuncSeparate(n.SRC_ALPHA,n.ONE,n.ONE,n.ONE);break;case vf:pt("WebGLState: SubtractiveBlending requires material.premultipliedAlpha = true");break;case Of:pt("WebGLState: MultiplyBlending requires material.premultipliedAlpha = true");break;default:pt("WebGLState: Invalid blending: ",U);break}w=null,z=null,O=null,S=null,b.set(0,0,0),v=0,m=U,E=Et}return}Ee=Ee||ze,de=de||re,Be=Be||we,(ze!==_||Ee!==y)&&(n.blendEquationSeparate(ot[ze],ot[Ee]),_=ze,y=Ee),(re!==w||we!==z||de!==O||Be!==S)&&(n.blendFuncSeparate(yt[re],yt[we],yt[de],yt[Be]),w=re,z=we,O=de,S=Be),(Ge.equals(b)===!1||ht!==v)&&(n.blendColor(Ge.r,Ge.g,Ge.b,ht),b.copy(Ge),v=ht),m=U,E=!1}function lt(U,ze){U.side===zn?Xe(n.CULL_FACE):ue(n.CULL_FACE);let re=U.side===gs;ze&&(re=!re),Gt(re),U.blending===Ei&&U.transparent===!1?ut(Sn):ut(U.blending,U.blendEquation,U.blendSrc,U.blendDst,U.blendEquationAlpha,U.blendSrcAlpha,U.blendDstAlpha,U.blendColor,U.blendAlpha,U.premultipliedAlpha),a.setFunc(U.depthFunc),a.setTest(U.depthTest),a.setMask(U.depthWrite),r.setMask(U.colorWrite);const we=U.stencilWrite;o.setTest(we),we&&(o.setMask(U.stencilWriteMask),o.setFunc(U.stencilFunc,U.stencilRef,U.stencilFuncMask),o.setOp(U.stencilFail,U.stencilZFail,U.stencilZPass)),xt(U.polygonOffset,U.polygonOffsetFactor,U.polygonOffsetUnits),U.alphaToCoverage===!0?ue(n.SAMPLE_ALPHA_TO_COVERAGE):Xe(n.SAMPLE_ALPHA_TO_COVERAGE)}function Gt(U){A!==U&&(U?n.frontFace(n.CW):n.frontFace(n.CCW),A=U)}function Bt(U){U!==Sv?(ue(n.CULL_FACE),U!==I&&(U===yf?n.cullFace(n.BACK):U===Ev?n.cullFace(n.FRONT):n.cullFace(n.FRONT_AND_BACK))):Xe(n.CULL_FACE),I=U}function $t(U){U!==G&&(W&&n.lineWidth(U),G=U)}function xt(U,ze,re){U?(ue(n.POLYGON_OFFSET_FILL),(C!==ze||B!==re)&&(C=ze,B=re,a.getReversed()&&(ze=-ze),n.polygonOffset(ze,re))):Xe(n.POLYGON_OFFSET_FILL)}function Ct(U){U?ue(n.SCISSOR_TEST):Xe(n.SCISSOR_TEST)}function Pt(U){U===void 0&&(U=n.TEXTURE0+P-1),oe!==U&&(n.activeTexture(U),oe=U)}function j(U,ze,re){re===void 0&&(oe===null?re=n.TEXTURE0+P-1:re=oe);let we=J[re];we===void 0&&(we={type:void 0,texture:void 0},J[re]=we),(we.type!==U||we.texture!==ze)&&(oe!==re&&(n.activeTexture(re),oe=re),n.bindTexture(U,ze||ae[U]),we.type=U,we.texture=ze)}function Ft(){const U=J[oe];U!==void 0&&U.type!==void 0&&(n.bindTexture(U.type,null),U.type=void 0,U.texture=void 0)}function vt(){try{n.compressedTexImage2D(...arguments)}catch(U){pt("WebGLState:",U)}}function N(){try{n.compressedTexImage3D(...arguments)}catch(U){pt("WebGLState:",U)}}function x(){try{n.texSubImage2D(...arguments)}catch(U){pt("WebGLState:",U)}}function V(){try{n.texSubImage3D(...arguments)}catch(U){pt("WebGLState:",U)}}function Z(){try{n.compressedTexSubImage2D(...arguments)}catch(U){pt("WebGLState:",U)}}function $(){try{n.compressedTexSubImage3D(...arguments)}catch(U){pt("WebGLState:",U)}}function pe(){try{n.texStorage2D(...arguments)}catch(U){pt("WebGLState:",U)}}function ye(){try{n.texStorage3D(...arguments)}catch(U){pt("WebGLState:",U)}}function te(){try{n.texImage2D(...arguments)}catch(U){pt("WebGLState:",U)}}function ie(){try{n.texImage3D(...arguments)}catch(U){pt("WebGLState:",U)}}function he(U){return u[U]!==void 0?u[U]:n.getParameter(U)}function Te(U,ze){u[U]!==ze&&(n.pixelStorei(U,ze),u[U]=ze)}function Me(U){qe.equals(U)===!1&&(n.scissor(U.x,U.y,U.z,U.w),qe.copy(U))}function _e(U){Pe.equals(U)===!1&&(n.viewport(U.x,U.y,U.z,U.w),Pe.copy(U))}function Ue(U,ze){let re=c.get(ze);re===void 0&&(re=new WeakMap,c.set(ze,re));let we=re.get(U);we===void 0&&(we=n.getUniformBlockIndex(ze,U.name),re.set(U,we))}function je(U,ze){const we=c.get(ze).get(U);l.get(ze)!==we&&(n.uniformBlockBinding(ze,we,U.__bindingPointIndex),l.set(ze,we))}function $e(){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={},oe=null,J={},h={},p=new WeakMap,f=[],M=null,g=!1,m=null,_=null,w=null,z=null,y=null,O=null,S=null,b=new ke(0,0,0),v=0,E=!1,A=null,I=null,G=null,C=null,B=null,qe.set(0,0,n.canvas.width,n.canvas.height),Pe.set(0,0,n.canvas.width,n.canvas.height),r.reset(),a.reset(),o.reset()}return{buffers:{color:r,depth:a,stencil:o},enable:ue,disable:Xe,bindFramebuffer:Ze,drawBuffers:Fe,useProgram:Lt,setBlending:ut,setMaterial:lt,setFlipSided:Gt,setCullFace:Bt,setLineWidth:$t,setPolygonOffset:xt,setScissorTest:Ct,activeTexture:Pt,bindTexture:j,unbindTexture:Ft,compressedTexImage2D:vt,compressedTexImage3D:N,texImage2D:te,texImage3D:ie,pixelStorei:Te,getParameter:he,updateUBOMapping:Ue,uniformBlockBinding:je,texStorage2D:pe,texStorage3D:ye,texSubImage2D:x,texSubImage3D:V,compressedTexSubImage2D:Z,compressedTexSubImage3D:$,scissor:Me,viewport:_e,reset:$e}}function BA(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 et,d=new WeakMap,u=new Set;let h;const p=new WeakMap;let f=!1;try{f=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function M(N,x){return f?new OffscreenCanvas(N,x):tl("canvas")}function g(N,x,V){let Z=1;const $=vt(N);if(($.width>V||$.height>V)&&(Z=V/Math.max($.width,$.height)),Z<1)if(typeof HTMLImageElement<"u"&&N instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&N instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&N instanceof ImageBitmap||typeof VideoFrame<"u"&&N instanceof VideoFrame){const pe=Math.floor(Z*$.width),ye=Math.floor(Z*$.height);h===void 0&&(h=M(pe,ye));const te=x?M(pe,ye):h;return te.width=pe,te.height=ye,te.getContext("2d").drawImage(N,0,0,pe,ye),He("WebGLRenderer: Texture has been resized from ("+$.width+"x"+$.height+") to ("+pe+"x"+ye+")."),te}else return"data"in N&&He("WebGLRenderer: Image in DataTexture is too big ("+$.width+"x"+$.height+")."),N;return N}function m(N){return N.generateMipmaps}function _(N){n.generateMipmap(N)}function w(N){return N.isWebGLCubeRenderTarget?n.TEXTURE_CUBE_MAP:N.isWebGL3DRenderTarget?n.TEXTURE_3D:N.isWebGLArrayRenderTarget||N.isCompressedArrayTexture?n.TEXTURE_2D_ARRAY:n.TEXTURE_2D}function z(N,x,V,Z,$,pe=!1){if(N!==null){if(n[N]!==void 0)return n[N];He("WebGLRenderer: Attempt to use non-existing WebGL internal format '"+N+"'")}let ye;Z&&(ye=e.get("EXT_texture_norm16"),ye||He("WebGLRenderer: Unable to use normalized textures without EXT_texture_norm16 extension"));let te=x;if(x===n.RED&&(V===n.FLOAT&&(te=n.R32F),V===n.HALF_FLOAT&&(te=n.R16F),V===n.UNSIGNED_BYTE&&(te=n.R8),V===n.UNSIGNED_SHORT&&ye&&(te=ye.R16_EXT),V===n.SHORT&&ye&&(te=ye.R16_SNORM_EXT)),x===n.RED_INTEGER&&(V===n.UNSIGNED_BYTE&&(te=n.R8UI),V===n.UNSIGNED_SHORT&&(te=n.R16UI),V===n.UNSIGNED_INT&&(te=n.R32UI),V===n.BYTE&&(te=n.R8I),V===n.SHORT&&(te=n.R16I),V===n.INT&&(te=n.R32I)),x===n.RG&&(V===n.FLOAT&&(te=n.RG32F),V===n.HALF_FLOAT&&(te=n.RG16F),V===n.UNSIGNED_BYTE&&(te=n.RG8),V===n.UNSIGNED_SHORT&&ye&&(te=ye.RG16_EXT),V===n.SHORT&&ye&&(te=ye.RG16_SNORM_EXT)),x===n.RG_INTEGER&&(V===n.UNSIGNED_BYTE&&(te=n.RG8UI),V===n.UNSIGNED_SHORT&&(te=n.RG16UI),V===n.UNSIGNED_INT&&(te=n.RG32UI),V===n.BYTE&&(te=n.RG8I),V===n.SHORT&&(te=n.RG16I),V===n.INT&&(te=n.RG32I)),x===n.RGB_INTEGER&&(V===n.UNSIGNED_BYTE&&(te=n.RGB8UI),V===n.UNSIGNED_SHORT&&(te=n.RGB16UI),V===n.UNSIGNED_INT&&(te=n.RGB32UI),V===n.BYTE&&(te=n.RGB8I),V===n.SHORT&&(te=n.RGB16I),V===n.INT&&(te=n.RGB32I)),x===n.RGBA_INTEGER&&(V===n.UNSIGNED_BYTE&&(te=n.RGBA8UI),V===n.UNSIGNED_SHORT&&(te=n.RGBA16UI),V===n.UNSIGNED_INT&&(te=n.RGBA32UI),V===n.BYTE&&(te=n.RGBA8I),V===n.SHORT&&(te=n.RGBA16I),V===n.INT&&(te=n.RGBA32I)),x===n.RGB&&(V===n.UNSIGNED_SHORT&&ye&&(te=ye.RGB16_EXT),V===n.SHORT&&ye&&(te=ye.RGB16_SNORM_EXT),V===n.UNSIGNED_INT_5_9_9_9_REV&&(te=n.RGB9_E5),V===n.UNSIGNED_INT_10F_11F_11F_REV&&(te=n.R11F_G11F_B10F)),x===n.RGBA){const ie=pe?el:mt.getTransfer($);V===n.FLOAT&&(te=n.RGBA32F),V===n.HALF_FLOAT&&(te=n.RGBA16F),V===n.UNSIGNED_BYTE&&(te=ie===St?n.SRGB8_ALPHA8:n.RGBA8),V===n.UNSIGNED_SHORT&&ye&&(te=ye.RGBA16_EXT),V===n.SHORT&&ye&&(te=ye.RGBA16_SNORM_EXT),V===n.UNSIGNED_SHORT_4_4_4_4&&(te=n.RGBA4),V===n.UNSIGNED_SHORT_5_5_5_1&&(te=n.RGB5_A1)}return(te===n.R16F||te===n.R32F||te===n.RG16F||te===n.RG32F||te===n.RGBA16F||te===n.RGBA32F)&&e.get("EXT_color_buffer_float"),te}function y(N,x){let V;return N?x===null||x===on||x===va?V=n.DEPTH24_STENCIL8:x===$s?V=n.DEPTH32F_STENCIL8:x===ya&&(V=n.DEPTH24_STENCIL8,He("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.")):x===null||x===on||x===va?V=n.DEPTH_COMPONENT24:x===$s?V=n.DEPTH_COMPONENT32F:x===ya&&(V=n.DEPTH_COMPONENT16),V}function O(N,x){return m(N)===!0||N.isFramebufferTexture&&N.minFilter!==ss&&N.minFilter!==os?Math.log2(Math.max(x.width,x.height))+1:N.mipmaps!==void 0&&N.mipmaps.length>0?N.mipmaps.length:N.isCompressedTexture&&Array.isArray(N.image)?x.mipmaps.length:1}function S(N){const x=N.target;x.removeEventListener("dispose",S),v(x),x.isVideoTexture&&d.delete(x),x.isHTMLTexture&&u.delete(x)}function b(N){const x=N.target;x.removeEventListener("dispose",b),A(x)}function v(N){const x=s.get(N);if(x.__webglInit===void 0)return;const V=N.source,Z=p.get(V);if(Z){const $=Z[x.__cacheKey];$.usedTimes--,$.usedTimes===0&&E(N),Object.keys(Z).length===0&&p.delete(V)}s.remove(N)}function E(N){const x=s.get(N);n.deleteTexture(x.__webglTexture);const V=N.source,Z=p.get(V);delete Z[x.__cacheKey],a.memory.textures--}function A(N){const x=s.get(N);if(N.depthTexture&&(N.depthTexture.dispose(),s.remove(N.depthTexture)),N.isWebGLCubeRenderTarget)for(let Z=0;Z<6;Z++){if(Array.isArray(x.__webglFramebuffer[Z]))for(let $=0;$<x.__webglFramebuffer[Z].length;$++)n.deleteFramebuffer(x.__webglFramebuffer[Z][$]);else n.deleteFramebuffer(x.__webglFramebuffer[Z]);x.__webglDepthbuffer&&n.deleteRenderbuffer(x.__webglDepthbuffer[Z])}else{if(Array.isArray(x.__webglFramebuffer))for(let Z=0;Z<x.__webglFramebuffer.length;Z++)n.deleteFramebuffer(x.__webglFramebuffer[Z]);else n.deleteFramebuffer(x.__webglFramebuffer);if(x.__webglDepthbuffer&&n.deleteRenderbuffer(x.__webglDepthbuffer),x.__webglMultisampledFramebuffer&&n.deleteFramebuffer(x.__webglMultisampledFramebuffer),x.__webglColorRenderbuffer)for(let Z=0;Z<x.__webglColorRenderbuffer.length;Z++)x.__webglColorRenderbuffer[Z]&&n.deleteRenderbuffer(x.__webglColorRenderbuffer[Z]);x.__webglDepthRenderbuffer&&n.deleteRenderbuffer(x.__webglDepthRenderbuffer)}const V=N.textures;for(let Z=0,$=V.length;Z<$;Z++){const pe=s.get(V[Z]);pe.__webglTexture&&(n.deleteTexture(pe.__webglTexture),a.memory.textures--),s.remove(V[Z])}s.remove(N)}let I=0;function G(){I=0}function C(){return I}function B(N){I=N}function P(){const N=I;return N>=i.maxTextures&&He("WebGLTextures: Trying to use "+N+" texture units while this GPU supports only "+i.maxTextures),I+=1,N}function W(N){const x=[];return x.push(N.wrapS),x.push(N.wrapT),x.push(N.wrapR||0),x.push(N.magFilter),x.push(N.minFilter),x.push(N.anisotropy),x.push(N.internalFormat),x.push(N.format),x.push(N.type),x.push(N.generateMipmaps),x.push(N.premultiplyAlpha),x.push(N.flipY),x.push(N.unpackAlignment),x.push(N.colorSpace),x.join()}function H(N,x){const V=s.get(N);if(N.isVideoTexture&&j(N),N.isRenderTargetTexture===!1&&N.isExternalTexture!==!0&&N.version>0&&V.__version!==N.version){const Z=N.image;if(Z===null)He("WebGLRenderer: Texture marked for update but no image data found.");else if(Z.complete===!1)He("WebGLRenderer: Texture marked for update but image is incomplete");else{Xe(V,N,x);return}}else N.isExternalTexture&&(V.__webglTexture=N.sourceTexture?N.sourceTexture:null);t.bindTexture(n.TEXTURE_2D,V.__webglTexture,n.TEXTURE0+x)}function X(N,x){const V=s.get(N);if(N.isRenderTargetTexture===!1&&N.version>0&&V.__version!==N.version){Xe(V,N,x);return}else N.isExternalTexture&&(V.__webglTexture=N.sourceTexture?N.sourceTexture:null);t.bindTexture(n.TEXTURE_2D_ARRAY,V.__webglTexture,n.TEXTURE0+x)}function oe(N,x){const V=s.get(N);if(N.isRenderTargetTexture===!1&&N.version>0&&V.__version!==N.version){Xe(V,N,x);return}t.bindTexture(n.TEXTURE_3D,V.__webglTexture,n.TEXTURE0+x)}function J(N,x){const V=s.get(N);if(N.isCubeDepthTexture!==!0&&N.version>0&&V.__version!==N.version){Ze(V,N,x);return}t.bindTexture(n.TEXTURE_CUBE_MAP,V.__webglTexture,n.TEXTURE0+x)}const ce={[bd]:n.REPEAT,[yn]:n.CLAMP_TO_EDGE,[_d]:n.MIRRORED_REPEAT},We={[ss]:n.NEAREST,[Kv]:n.NEAREST_MIPMAP_NEAREST,[Ca]:n.NEAREST_MIPMAP_LINEAR,[os]:n.LINEAR,[ql]:n.LINEAR_MIPMAP_NEAREST,[yi]:n.LINEAR_MIPMAP_LINEAR},qe={[Qv]:n.NEVER,[nO]:n.ALWAYS,[Jv]:n.LESS,[ju]:n.LEQUAL,[eO]:n.EQUAL,[$u]:n.GEQUAL,[tO]:n.GREATER,[sO]:n.NOTEQUAL};function Pe(N,x){if(x.type===$s&&e.has("OES_texture_float_linear")===!1&&(x.magFilter===os||x.magFilter===ql||x.magFilter===Ca||x.magFilter===yi||x.minFilter===os||x.minFilter===ql||x.minFilter===Ca||x.minFilter===yi)&&He("WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."),n.texParameteri(N,n.TEXTURE_WRAP_S,ce[x.wrapS]),n.texParameteri(N,n.TEXTURE_WRAP_T,ce[x.wrapT]),(N===n.TEXTURE_3D||N===n.TEXTURE_2D_ARRAY)&&n.texParameteri(N,n.TEXTURE_WRAP_R,ce[x.wrapR]),n.texParameteri(N,n.TEXTURE_MAG_FILTER,We[x.magFilter]),n.texParameteri(N,n.TEXTURE_MIN_FILTER,We[x.minFilter]),x.compareFunction&&(n.texParameteri(N,n.TEXTURE_COMPARE_MODE,n.COMPARE_REF_TO_TEXTURE),n.texParameteri(N,n.TEXTURE_COMPARE_FUNC,qe[x.compareFunction])),e.has("EXT_texture_filter_anisotropic")===!0){if(x.magFilter===ss||x.minFilter!==Ca&&x.minFilter!==yi||x.type===$s&&e.has("OES_texture_float_linear")===!1)return;if(x.anisotropy>1||s.get(x).__currentAnisotropy){const V=e.get("EXT_texture_filter_anisotropic");n.texParameterf(N,V.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(x.anisotropy,i.getMaxAnisotropy())),s.get(x).__currentAnisotropy=x.anisotropy}}}function ne(N,x){let V=!1;N.__webglInit===void 0&&(N.__webglInit=!0,x.addEventListener("dispose",S));const Z=x.source;let $=p.get(Z);$===void 0&&($={},p.set(Z,$));const pe=W(x);if(pe!==N.__cacheKey){$[pe]===void 0&&($[pe]={texture:n.createTexture(),usedTimes:0},a.memory.textures++,V=!0),$[pe].usedTimes++;const ye=$[N.__cacheKey];ye!==void 0&&($[N.__cacheKey].usedTimes--,ye.usedTimes===0&&E(x)),N.__cacheKey=pe,N.__webglTexture=$[pe].texture}return V}function ae(N,x,V){return Math.floor(Math.floor(N/V)/x)}function ue(N,x,V,Z){const pe=N.updateRanges;if(pe.length===0)t.texSubImage2D(n.TEXTURE_2D,0,0,0,x.width,x.height,V,Z,x.data);else{pe.sort((Te,Me)=>Te.start-Me.start);let ye=0;for(let Te=1;Te<pe.length;Te++){const Me=pe[ye],_e=pe[Te],Ue=Me.start+Me.count,je=ae(_e.start,x.width,4),$e=ae(Me.start,x.width,4);_e.start<=Ue+1&&je===$e&&ae(_e.start+_e.count-1,x.width,4)===je?Me.count=Math.max(Me.count,_e.start+_e.count-Me.start):(++ye,pe[ye]=_e)}pe.length=ye+1;const te=t.getParameter(n.UNPACK_ROW_LENGTH),ie=t.getParameter(n.UNPACK_SKIP_PIXELS),he=t.getParameter(n.UNPACK_SKIP_ROWS);t.pixelStorei(n.UNPACK_ROW_LENGTH,x.width);for(let Te=0,Me=pe.length;Te<Me;Te++){const _e=pe[Te],Ue=Math.floor(_e.start/4),je=Math.ceil(_e.count/4),$e=Ue%x.width,U=Math.floor(Ue/x.width),ze=je,re=1;t.pixelStorei(n.UNPACK_SKIP_PIXELS,$e),t.pixelStorei(n.UNPACK_SKIP_ROWS,U),t.texSubImage2D(n.TEXTURE_2D,0,$e,U,ze,re,V,Z,x.data)}N.clearUpdateRanges(),t.pixelStorei(n.UNPACK_ROW_LENGTH,te),t.pixelStorei(n.UNPACK_SKIP_PIXELS,ie),t.pixelStorei(n.UNPACK_SKIP_ROWS,he)}}function Xe(N,x,V){let Z=n.TEXTURE_2D;(x.isDataArrayTexture||x.isCompressedArrayTexture)&&(Z=n.TEXTURE_2D_ARRAY),x.isData3DTexture&&(Z=n.TEXTURE_3D);const $=ne(N,x),pe=x.source;t.bindTexture(Z,N.__webglTexture,n.TEXTURE0+V);const ye=s.get(pe);if(pe.version!==ye.__version||$===!0){if(t.activeTexture(n.TEXTURE0+V),(typeof ImageBitmap<"u"&&x.image instanceof ImageBitmap)===!1){const re=mt.getPrimaries(mt.workingColorSpace),we=x.colorSpace===qn?null:mt.getPrimaries(x.colorSpace),Ee=x.colorSpace===qn||re===we?n.NONE:n.BROWSER_DEFAULT_WEBGL;t.pixelStorei(n.UNPACK_FLIP_Y_WEBGL,x.flipY),t.pixelStorei(n.UNPACK_PREMULTIPLY_ALPHA_WEBGL,x.premultiplyAlpha),t.pixelStorei(n.UNPACK_COLORSPACE_CONVERSION_WEBGL,Ee)}t.pixelStorei(n.UNPACK_ALIGNMENT,x.unpackAlignment);let ie=g(x.image,!1,i.maxTextureSize);ie=Ft(x,ie);const he=r.convert(x.format,x.colorSpace),Te=r.convert(x.type);let Me=z(x.internalFormat,he,Te,x.normalized,x.colorSpace,x.isVideoTexture);Pe(Z,x);let _e;const Ue=x.mipmaps,je=x.isVideoTexture!==!0,$e=ye.__version===void 0||$===!0,U=pe.dataReady,ze=O(x,ie);if(x.isDepthTexture)Me=y(x.format===vi,x.type),$e&&(je?t.texStorage2D(n.TEXTURE_2D,1,Me,ie.width,ie.height):t.texImage2D(n.TEXTURE_2D,0,Me,ie.width,ie.height,0,he,Te,null));else if(x.isDataTexture)if(Ue.length>0){je&&$e&&t.texStorage2D(n.TEXTURE_2D,ze,Me,Ue[0].width,Ue[0].height);for(let re=0,we=Ue.length;re<we;re++)_e=Ue[re],je?U&&t.texSubImage2D(n.TEXTURE_2D,re,0,0,_e.width,_e.height,he,Te,_e.data):t.texImage2D(n.TEXTURE_2D,re,Me,_e.width,_e.height,0,he,Te,_e.data);x.generateMipmaps=!1}else je?($e&&t.texStorage2D(n.TEXTURE_2D,ze,Me,ie.width,ie.height),U&&ue(x,ie,he,Te)):t.texImage2D(n.TEXTURE_2D,0,Me,ie.width,ie.height,0,he,Te,ie.data);else if(x.isCompressedTexture)if(x.isCompressedArrayTexture){je&&$e&&t.texStorage3D(n.TEXTURE_2D_ARRAY,ze,Me,Ue[0].width,Ue[0].height,ie.depth);for(let re=0,we=Ue.length;re<we;re++)if(_e=Ue[re],x.format!==Vs)if(he!==null)if(je){if(U)if(x.layerUpdates.size>0){const Ee=ap(_e.width,_e.height,x.format,x.type);for(const de of x.layerUpdates){const Be=_e.data.subarray(de*Ee/_e.data.BYTES_PER_ELEMENT,(de+1)*Ee/_e.data.BYTES_PER_ELEMENT);t.compressedTexSubImage3D(n.TEXTURE_2D_ARRAY,re,0,0,de,_e.width,_e.height,1,he,Be)}x.clearLayerUpdates()}else t.compressedTexSubImage3D(n.TEXTURE_2D_ARRAY,re,0,0,0,_e.width,_e.height,ie.depth,he,_e.data)}else t.compressedTexImage3D(n.TEXTURE_2D_ARRAY,re,Me,_e.width,_e.height,ie.depth,0,_e.data,0,0);else He("WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");else je?U&&t.texSubImage3D(n.TEXTURE_2D_ARRAY,re,0,0,0,_e.width,_e.height,ie.depth,he,Te,_e.data):t.texImage3D(n.TEXTURE_2D_ARRAY,re,Me,_e.width,_e.height,ie.depth,0,he,Te,_e.data)}else{je&&$e&&t.texStorage2D(n.TEXTURE_2D,ze,Me,Ue[0].width,Ue[0].height);for(let re=0,we=Ue.length;re<we;re++)_e=Ue[re],x.format!==Vs?he!==null?je?U&&t.compressedTexSubImage2D(n.TEXTURE_2D,re,0,0,_e.width,_e.height,he,_e.data):t.compressedTexImage2D(n.TEXTURE_2D,re,Me,_e.width,_e.height,0,_e.data):He("WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):je?U&&t.texSubImage2D(n.TEXTURE_2D,re,0,0,_e.width,_e.height,he,Te,_e.data):t.texImage2D(n.TEXTURE_2D,re,Me,_e.width,_e.height,0,he,Te,_e.data)}else if(x.isDataArrayTexture)if(je){if($e&&t.texStorage3D(n.TEXTURE_2D_ARRAY,ze,Me,ie.width,ie.height,ie.depth),U)if(x.layerUpdates.size>0){const re=ap(ie.width,ie.height,x.format,x.type);for(const we of x.layerUpdates){const Ee=ie.data.subarray(we*re/ie.data.BYTES_PER_ELEMENT,(we+1)*re/ie.data.BYTES_PER_ELEMENT);t.texSubImage3D(n.TEXTURE_2D_ARRAY,0,0,0,we,ie.width,ie.height,1,he,Te,Ee)}x.clearLayerUpdates()}else t.texSubImage3D(n.TEXTURE_2D_ARRAY,0,0,0,0,ie.width,ie.height,ie.depth,he,Te,ie.data)}else t.texImage3D(n.TEXTURE_2D_ARRAY,0,Me,ie.width,ie.height,ie.depth,0,he,Te,ie.data);else if(x.isData3DTexture)je?($e&&t.texStorage3D(n.TEXTURE_3D,ze,Me,ie.width,ie.height,ie.depth),U&&t.texSubImage3D(n.TEXTURE_3D,0,0,0,0,ie.width,ie.height,ie.depth,he,Te,ie.data)):t.texImage3D(n.TEXTURE_3D,0,Me,ie.width,ie.height,ie.depth,0,he,Te,ie.data);else if(x.isFramebufferTexture){if($e)if(je)t.texStorage2D(n.TEXTURE_2D,ze,Me,ie.width,ie.height);else{let re=ie.width,we=ie.height;for(let Ee=0;Ee<ze;Ee++)t.texImage2D(n.TEXTURE_2D,Ee,Me,re,we,0,he,Te,null),re>>=1,we>>=1}}else if(x.isHTMLTexture){if("texElementImage2D"in n){const re=n.canvas;if(re.hasAttribute("layoutsubtree")||re.setAttribute("layoutsubtree","true"),ie.parentNode!==re){re.appendChild(ie),u.add(x),re.onpaint=we=>{const Ee=we.changedElements;for(const de of u)Ee.includes(de.image)&&(de.needsUpdate=!0)},re.requestPaint();return}if(n.texElementImage2D.length===3)n.texElementImage2D(n.TEXTURE_2D,n.RGBA8,ie);else{const Ee=n.RGBA,de=n.RGBA,Be=n.UNSIGNED_BYTE;n.texElementImage2D(n.TEXTURE_2D,0,Ee,de,Be,ie)}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(Ue.length>0){if(je&&$e){const re=vt(Ue[0]);t.texStorage2D(n.TEXTURE_2D,ze,Me,re.width,re.height)}for(let re=0,we=Ue.length;re<we;re++)_e=Ue[re],je?U&&t.texSubImage2D(n.TEXTURE_2D,re,0,0,he,Te,_e):t.texImage2D(n.TEXTURE_2D,re,Me,he,Te,_e);x.generateMipmaps=!1}else if(je){if($e){const re=vt(ie);t.texStorage2D(n.TEXTURE_2D,ze,Me,re.width,re.height)}U&&t.texSubImage2D(n.TEXTURE_2D,0,0,0,he,Te,ie)}else t.texImage2D(n.TEXTURE_2D,0,Me,he,Te,ie);m(x)&&_(Z),ye.__version=pe.version,x.onUpdate&&x.onUpdate(x)}N.__version=x.version}function Ze(N,x,V){if(x.image.length!==6)return;const Z=ne(N,x),$=x.source;t.bindTexture(n.TEXTURE_CUBE_MAP,N.__webglTexture,n.TEXTURE0+V);const pe=s.get($);if($.version!==pe.__version||Z===!0){t.activeTexture(n.TEXTURE0+V);const ye=mt.getPrimaries(mt.workingColorSpace),te=x.colorSpace===qn?null:mt.getPrimaries(x.colorSpace),ie=x.colorSpace===qn||ye===te?n.NONE:n.BROWSER_DEFAULT_WEBGL;t.pixelStorei(n.UNPACK_FLIP_Y_WEBGL,x.flipY),t.pixelStorei(n.UNPACK_PREMULTIPLY_ALPHA_WEBGL,x.premultiplyAlpha),t.pixelStorei(n.UNPACK_ALIGNMENT,x.unpackAlignment),t.pixelStorei(n.UNPACK_COLORSPACE_CONVERSION_WEBGL,ie);const he=x.isCompressedTexture||x.image[0].isCompressedTexture,Te=x.image[0]&&x.image[0].isDataTexture,Me=[];for(let de=0;de<6;de++)!he&&!Te?Me[de]=g(x.image[de],!0,i.maxCubemapSize):Me[de]=Te?x.image[de].image:x.image[de],Me[de]=Ft(x,Me[de]);const _e=Me[0],Ue=r.convert(x.format,x.colorSpace),je=r.convert(x.type),$e=z(x.internalFormat,Ue,je,x.normalized,x.colorSpace),U=x.isVideoTexture!==!0,ze=pe.__version===void 0||Z===!0,re=$.dataReady;let we=O(x,_e);Pe(n.TEXTURE_CUBE_MAP,x);let Ee;if(he){U&&ze&&t.texStorage2D(n.TEXTURE_CUBE_MAP,we,$e,_e.width,_e.height);for(let de=0;de<6;de++){Ee=Me[de].mipmaps;for(let Be=0;Be<Ee.length;Be++){const Ge=Ee[Be];x.format!==Vs?Ue!==null?U?re&&t.compressedTexSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+de,Be,0,0,Ge.width,Ge.height,Ue,Ge.data):t.compressedTexImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+de,Be,$e,Ge.width,Ge.height,0,Ge.data):He("WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):U?re&&t.texSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+de,Be,0,0,Ge.width,Ge.height,Ue,je,Ge.data):t.texImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+de,Be,$e,Ge.width,Ge.height,0,Ue,je,Ge.data)}}}else{if(Ee=x.mipmaps,U&&ze){Ee.length>0&&we++;const de=vt(Me[0]);t.texStorage2D(n.TEXTURE_CUBE_MAP,we,$e,de.width,de.height)}for(let de=0;de<6;de++)if(Te){U?re&&t.texSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+de,0,0,0,Me[de].width,Me[de].height,Ue,je,Me[de].data):t.texImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+de,0,$e,Me[de].width,Me[de].height,0,Ue,je,Me[de].data);for(let Be=0;Be<Ee.length;Be++){const ht=Ee[Be].image[de].image;U?re&&t.texSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+de,Be+1,0,0,ht.width,ht.height,Ue,je,ht.data):t.texImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+de,Be+1,$e,ht.width,ht.height,0,Ue,je,ht.data)}}else{U?re&&t.texSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+de,0,0,0,Ue,je,Me[de]):t.texImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+de,0,$e,Ue,je,Me[de]);for(let Be=0;Be<Ee.length;Be++){const Ge=Ee[Be];U?re&&t.texSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+de,Be+1,0,0,Ue,je,Ge.image[de]):t.texImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+de,Be+1,$e,Ue,je,Ge.image[de])}}}m(x)&&_(n.TEXTURE_CUBE_MAP),pe.__version=$.version,x.onUpdate&&x.onUpdate(x)}N.__version=x.version}function Fe(N,x,V,Z,$,pe){const ye=r.convert(V.format,V.colorSpace),te=r.convert(V.type),ie=z(V.internalFormat,ye,te,V.normalized,V.colorSpace),he=s.get(x),Te=s.get(V);if(Te.__renderTarget=x,!he.__hasExternalTextures){const Me=Math.max(1,x.width>>pe),_e=Math.max(1,x.height>>pe);$===n.TEXTURE_3D||$===n.TEXTURE_2D_ARRAY?t.texImage3D($,pe,ie,Me,_e,x.depth,0,ye,te,null):t.texImage2D($,pe,ie,Me,_e,0,ye,te,null)}t.bindFramebuffer(n.FRAMEBUFFER,N),Pt(x)?o.framebufferTexture2DMultisampleEXT(n.FRAMEBUFFER,Z,$,Te.__webglTexture,0,Ct(x)):($===n.TEXTURE_2D||$>=n.TEXTURE_CUBE_MAP_POSITIVE_X&&$<=n.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&n.framebufferTexture2D(n.FRAMEBUFFER,Z,$,Te.__webglTexture,pe),t.bindFramebuffer(n.FRAMEBUFFER,null)}function Lt(N,x,V){if(n.bindRenderbuffer(n.RENDERBUFFER,N),x.depthBuffer){const Z=x.depthTexture,$=Z&&Z.isDepthTexture?Z.type:null,pe=y(x.stencilBuffer,$),ye=x.stencilBuffer?n.DEPTH_STENCIL_ATTACHMENT:n.DEPTH_ATTACHMENT;Pt(x)?o.renderbufferStorageMultisampleEXT(n.RENDERBUFFER,Ct(x),pe,x.width,x.height):V?n.renderbufferStorageMultisample(n.RENDERBUFFER,Ct(x),pe,x.width,x.height):n.renderbufferStorage(n.RENDERBUFFER,pe,x.width,x.height),n.framebufferRenderbuffer(n.FRAMEBUFFER,ye,n.RENDERBUFFER,N)}else{const Z=x.textures;for(let $=0;$<Z.length;$++){const pe=Z[$],ye=r.convert(pe.format,pe.colorSpace),te=r.convert(pe.type),ie=z(pe.internalFormat,ye,te,pe.normalized,pe.colorSpace);Pt(x)?o.renderbufferStorageMultisampleEXT(n.RENDERBUFFER,Ct(x),ie,x.width,x.height):V?n.renderbufferStorageMultisample(n.RENDERBUFFER,Ct(x),ie,x.width,x.height):n.renderbufferStorage(n.RENDERBUFFER,ie,x.width,x.height)}}n.bindRenderbuffer(n.RENDERBUFFER,null)}function ot(N,x,V){const Z=x.isWebGLCubeRenderTarget===!0;if(t.bindFramebuffer(n.FRAMEBUFFER,N),!(x.depthTexture&&x.depthTexture.isDepthTexture))throw new Error("THREE.WebGLTextures: renderTarget.depthTexture must be an instance of THREE.DepthTexture.");const $=s.get(x.depthTexture);if($.__renderTarget=x,(!$.__webglTexture||x.depthTexture.image.width!==x.width||x.depthTexture.image.height!==x.height)&&(x.depthTexture.image.width=x.width,x.depthTexture.image.height=x.height,x.depthTexture.needsUpdate=!0),Z){if($.__webglInit===void 0&&($.__webglInit=!0,x.depthTexture.addEventListener("dispose",S)),$.__webglTexture===void 0){$.__webglTexture=n.createTexture(),t.bindTexture(n.TEXTURE_CUBE_MAP,$.__webglTexture),Pe(n.TEXTURE_CUBE_MAP,x.depthTexture);const he=r.convert(x.depthTexture.format),Te=r.convert(x.depthTexture.type);let Me;x.depthTexture.format===Tn?Me=n.DEPTH_COMPONENT24:x.depthTexture.format===vi&&(Me=n.DEPTH24_STENCIL8);for(let _e=0;_e<6;_e++)n.texImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+_e,0,Me,x.width,x.height,0,he,Te,null)}}else H(x.depthTexture,0);const pe=$.__webglTexture,ye=Ct(x),te=Z?n.TEXTURE_CUBE_MAP_POSITIVE_X+V:n.TEXTURE_2D,ie=x.depthTexture.format===vi?n.DEPTH_STENCIL_ATTACHMENT:n.DEPTH_ATTACHMENT;if(x.depthTexture.format===Tn)Pt(x)?o.framebufferTexture2DMultisampleEXT(n.FRAMEBUFFER,ie,te,pe,0,ye):n.framebufferTexture2D(n.FRAMEBUFFER,ie,te,pe,0);else if(x.depthTexture.format===vi)Pt(x)?o.framebufferTexture2DMultisampleEXT(n.FRAMEBUFFER,ie,te,pe,0,ye):n.framebufferTexture2D(n.FRAMEBUFFER,ie,te,pe,0);else throw new Error("THREE.WebGLTextures: Unknown depthTexture format.")}function yt(N){const x=s.get(N),V=N.isWebGLCubeRenderTarget===!0;if(x.__boundDepthTexture!==N.depthTexture){const Z=N.depthTexture;if(x.__depthDisposeCallback&&x.__depthDisposeCallback(),Z){const $=()=>{delete x.__boundDepthTexture,delete x.__depthDisposeCallback,Z.removeEventListener("dispose",$)};Z.addEventListener("dispose",$),x.__depthDisposeCallback=$}x.__boundDepthTexture=Z}if(N.depthTexture&&!x.__autoAllocateDepthBuffer)if(V)for(let Z=0;Z<6;Z++)ot(x.__webglFramebuffer[Z],N,Z);else{const Z=N.texture.mipmaps;Z&&Z.length>0?ot(x.__webglFramebuffer[0],N,0):ot(x.__webglFramebuffer,N,0)}else if(V){x.__webglDepthbuffer=[];for(let Z=0;Z<6;Z++)if(t.bindFramebuffer(n.FRAMEBUFFER,x.__webglFramebuffer[Z]),x.__webglDepthbuffer[Z]===void 0)x.__webglDepthbuffer[Z]=n.createRenderbuffer(),Lt(x.__webglDepthbuffer[Z],N,!1);else{const $=N.stencilBuffer?n.DEPTH_STENCIL_ATTACHMENT:n.DEPTH_ATTACHMENT,pe=x.__webglDepthbuffer[Z];n.bindRenderbuffer(n.RENDERBUFFER,pe),n.framebufferRenderbuffer(n.FRAMEBUFFER,$,n.RENDERBUFFER,pe)}}else{const Z=N.texture.mipmaps;if(Z&&Z.length>0?t.bindFramebuffer(n.FRAMEBUFFER,x.__webglFramebuffer[0]):t.bindFramebuffer(n.FRAMEBUFFER,x.__webglFramebuffer),x.__webglDepthbuffer===void 0)x.__webglDepthbuffer=n.createRenderbuffer(),Lt(x.__webglDepthbuffer,N,!1);else{const $=N.stencilBuffer?n.DEPTH_STENCIL_ATTACHMENT:n.DEPTH_ATTACHMENT,pe=x.__webglDepthbuffer;n.bindRenderbuffer(n.RENDERBUFFER,pe),n.framebufferRenderbuffer(n.FRAMEBUFFER,$,n.RENDERBUFFER,pe)}}t.bindFramebuffer(n.FRAMEBUFFER,null)}function ut(N,x,V){const Z=s.get(N);x!==void 0&&Fe(Z.__webglFramebuffer,N,N.texture,n.COLOR_ATTACHMENT0,n.TEXTURE_2D,0),V!==void 0&&yt(N)}function lt(N){const x=N.texture,V=s.get(N),Z=s.get(x);N.addEventListener("dispose",b);const $=N.textures,pe=N.isWebGLCubeRenderTarget===!0,ye=$.length>1;if(ye||(Z.__webglTexture===void 0&&(Z.__webglTexture=n.createTexture()),Z.__version=x.version,a.memory.textures++),pe){V.__webglFramebuffer=[];for(let te=0;te<6;te++)if(x.mipmaps&&x.mipmaps.length>0){V.__webglFramebuffer[te]=[];for(let ie=0;ie<x.mipmaps.length;ie++)V.__webglFramebuffer[te][ie]=n.createFramebuffer()}else V.__webglFramebuffer[te]=n.createFramebuffer()}else{if(x.mipmaps&&x.mipmaps.length>0){V.__webglFramebuffer=[];for(let te=0;te<x.mipmaps.length;te++)V.__webglFramebuffer[te]=n.createFramebuffer()}else V.__webglFramebuffer=n.createFramebuffer();if(ye)for(let te=0,ie=$.length;te<ie;te++){const he=s.get($[te]);he.__webglTexture===void 0&&(he.__webglTexture=n.createTexture(),a.memory.textures++)}if(N.samples>0&&Pt(N)===!1){V.__webglMultisampledFramebuffer=n.createFramebuffer(),V.__webglColorRenderbuffer=[],t.bindFramebuffer(n.FRAMEBUFFER,V.__webglMultisampledFramebuffer);for(let te=0;te<$.length;te++){const ie=$[te];V.__webglColorRenderbuffer[te]=n.createRenderbuffer(),n.bindRenderbuffer(n.RENDERBUFFER,V.__webglColorRenderbuffer[te]);const he=r.convert(ie.format,ie.colorSpace),Te=r.convert(ie.type),Me=z(ie.internalFormat,he,Te,ie.normalized,ie.colorSpace,N.isXRRenderTarget===!0),_e=Ct(N);n.renderbufferStorageMultisample(n.RENDERBUFFER,_e,Me,N.width,N.height),n.framebufferRenderbuffer(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0+te,n.RENDERBUFFER,V.__webglColorRenderbuffer[te])}n.bindRenderbuffer(n.RENDERBUFFER,null),N.depthBuffer&&(V.__webglDepthRenderbuffer=n.createRenderbuffer(),Lt(V.__webglDepthRenderbuffer,N,!0)),t.bindFramebuffer(n.FRAMEBUFFER,null)}}if(pe){t.bindTexture(n.TEXTURE_CUBE_MAP,Z.__webglTexture),Pe(n.TEXTURE_CUBE_MAP,x);for(let te=0;te<6;te++)if(x.mipmaps&&x.mipmaps.length>0)for(let ie=0;ie<x.mipmaps.length;ie++)Fe(V.__webglFramebuffer[te][ie],N,x,n.COLOR_ATTACHMENT0,n.TEXTURE_CUBE_MAP_POSITIVE_X+te,ie);else Fe(V.__webglFramebuffer[te],N,x,n.COLOR_ATTACHMENT0,n.TEXTURE_CUBE_MAP_POSITIVE_X+te,0);m(x)&&_(n.TEXTURE_CUBE_MAP),t.unbindTexture()}else if(ye){for(let te=0,ie=$.length;te<ie;te++){const he=$[te],Te=s.get(he);let Me=n.TEXTURE_2D;(N.isWebGL3DRenderTarget||N.isWebGLArrayRenderTarget)&&(Me=N.isWebGL3DRenderTarget?n.TEXTURE_3D:n.TEXTURE_2D_ARRAY),t.bindTexture(Me,Te.__webglTexture),Pe(Me,he),Fe(V.__webglFramebuffer,N,he,n.COLOR_ATTACHMENT0+te,Me,0),m(he)&&_(Me)}t.unbindTexture()}else{let te=n.TEXTURE_2D;if((N.isWebGL3DRenderTarget||N.isWebGLArrayRenderTarget)&&(te=N.isWebGL3DRenderTarget?n.TEXTURE_3D:n.TEXTURE_2D_ARRAY),t.bindTexture(te,Z.__webglTexture),Pe(te,x),x.mipmaps&&x.mipmaps.length>0)for(let ie=0;ie<x.mipmaps.length;ie++)Fe(V.__webglFramebuffer[ie],N,x,n.COLOR_ATTACHMENT0,te,ie);else Fe(V.__webglFramebuffer,N,x,n.COLOR_ATTACHMENT0,te,0);m(x)&&_(te),t.unbindTexture()}N.depthBuffer&&yt(N)}function Gt(N){const x=N.textures;for(let V=0,Z=x.length;V<Z;V++){const $=x[V];if(m($)){const pe=w(N),ye=s.get($).__webglTexture;t.bindTexture(pe,ye),_(pe),t.unbindTexture()}}}const Bt=[],$t=[];function xt(N){if(N.samples>0){if(Pt(N)===!1){const x=N.textures,V=N.width,Z=N.height;let $=n.COLOR_BUFFER_BIT;const pe=N.stencilBuffer?n.DEPTH_STENCIL_ATTACHMENT:n.DEPTH_ATTACHMENT,ye=s.get(N),te=x.length>1;if(te)for(let he=0;he<x.length;he++)t.bindFramebuffer(n.FRAMEBUFFER,ye.__webglMultisampledFramebuffer),n.framebufferRenderbuffer(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0+he,n.RENDERBUFFER,null),t.bindFramebuffer(n.FRAMEBUFFER,ye.__webglFramebuffer),n.framebufferTexture2D(n.DRAW_FRAMEBUFFER,n.COLOR_ATTACHMENT0+he,n.TEXTURE_2D,null,0);t.bindFramebuffer(n.READ_FRAMEBUFFER,ye.__webglMultisampledFramebuffer);const ie=N.texture.mipmaps;ie&&ie.length>0?t.bindFramebuffer(n.DRAW_FRAMEBUFFER,ye.__webglFramebuffer[0]):t.bindFramebuffer(n.DRAW_FRAMEBUFFER,ye.__webglFramebuffer);for(let he=0;he<x.length;he++){if(N.resolveDepthBuffer&&(N.depthBuffer&&($|=n.DEPTH_BUFFER_BIT),N.stencilBuffer&&N.resolveStencilBuffer&&($|=n.STENCIL_BUFFER_BIT)),te){n.framebufferRenderbuffer(n.READ_FRAMEBUFFER,n.COLOR_ATTACHMENT0,n.RENDERBUFFER,ye.__webglColorRenderbuffer[he]);const Te=s.get(x[he]).__webglTexture;n.framebufferTexture2D(n.DRAW_FRAMEBUFFER,n.COLOR_ATTACHMENT0,n.TEXTURE_2D,Te,0)}n.blitFramebuffer(0,0,V,Z,0,0,V,Z,$,n.NEAREST),l===!0&&(Bt.length=0,$t.length=0,Bt.push(n.COLOR_ATTACHMENT0+he),N.depthBuffer&&N.resolveDepthBuffer===!1&&(Bt.push(pe),$t.push(pe),n.invalidateFramebuffer(n.DRAW_FRAMEBUFFER,$t)),n.invalidateFramebuffer(n.READ_FRAMEBUFFER,Bt))}if(t.bindFramebuffer(n.READ_FRAMEBUFFER,null),t.bindFramebuffer(n.DRAW_FRAMEBUFFER,null),te)for(let he=0;he<x.length;he++){t.bindFramebuffer(n.FRAMEBUFFER,ye.__webglMultisampledFramebuffer),n.framebufferRenderbuffer(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0+he,n.RENDERBUFFER,ye.__webglColorRenderbuffer[he]);const Te=s.get(x[he]).__webglTexture;t.bindFramebuffer(n.FRAMEBUFFER,ye.__webglFramebuffer),n.framebufferTexture2D(n.DRAW_FRAMEBUFFER,n.COLOR_ATTACHMENT0+he,n.TEXTURE_2D,Te,0)}t.bindFramebuffer(n.DRAW_FRAMEBUFFER,ye.__webglMultisampledFramebuffer)}else if(N.depthBuffer&&N.resolveDepthBuffer===!1&&l){const x=N.stencilBuffer?n.DEPTH_STENCIL_ATTACHMENT:n.DEPTH_ATTACHMENT;n.invalidateFramebuffer(n.DRAW_FRAMEBUFFER,[x])}}}function Ct(N){return Math.min(i.maxSamples,N.samples)}function Pt(N){const x=s.get(N);return N.samples>0&&e.has("WEBGL_multisampled_render_to_texture")===!0&&x.__useRenderToTexture!==!1}function j(N){const x=a.render.frame;d.get(N)!==x&&(d.set(N,x),N.update())}function Ft(N,x){const V=N.colorSpace,Z=N.format,$=N.type;return N.isCompressedTexture===!0||N.isVideoTexture===!0||V!==Jo&&V!==qn&&(mt.getTransfer(V)===St?(Z!==Vs||$!==Ss)&&He("WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):pt("WebGLTextures: Unsupported texture color space:",V)),x}function vt(N){return typeof HTMLImageElement<"u"&&N instanceof HTMLImageElement?(c.width=N.naturalWidth||N.width,c.height=N.naturalHeight||N.height):typeof VideoFrame<"u"&&N instanceof VideoFrame?(c.width=N.displayWidth,c.height=N.displayHeight):(c.width=N.width,c.height=N.height),c}this.allocateTextureUnit=P,this.resetTextureUnits=G,this.getTextureUnits=C,this.setTextureUnits=B,this.setTexture2D=H,this.setTexture2DArray=X,this.setTexture3D=oe,this.setTextureCube=J,this.rebindTextures=ut,this.setupRenderTarget=lt,this.updateRenderTargetMipmap=Gt,this.updateMultisampleRenderTarget=xt,this.setupDepthRenderbuffer=yt,this.setupFrameBufferTexture=Fe,this.useMultisampledRTT=Pt,this.isReversedDepthBuffer=function(){return t.buffers.depth.getReversed()}}function CA(n,e){function t(s,i=qn){let r;const a=mt.getTransfer(i);if(s===Ss)return n.UNSIGNED_BYTE;if(s===Pu)return n.UNSIGNED_SHORT_4_4_4_4;if(s===Lu)return n.UNSIGNED_SHORT_5_5_5_1;if(s===Hg)return n.UNSIGNED_INT_5_9_9_9_REV;if(s===qg)return n.UNSIGNED_INT_10F_11F_11F_REV;if(s===$g)return n.BYTE;if(s===Vg)return n.SHORT;if(s===ya)return n.UNSIGNED_SHORT;if(s===Cu)return n.INT;if(s===on)return n.UNSIGNED_INT;if(s===$s)return n.FLOAT;if(s===Dn)return n.HALF_FLOAT;if(s===Xg)return n.ALPHA;if(s===Kg)return n.RGB;if(s===Vs)return n.RGBA;if(s===Tn)return n.DEPTH_COMPONENT;if(s===vi)return n.DEPTH_STENCIL;if(s===Wu)return n.RED;if(s===ku)return n.RED_INTEGER;if(s===Wi)return n.RG;if(s===Uu)return n.RG_INTEGER;if(s===Fu)return n.RGBA_INTEGER;if(s===xo||s===So||s===Eo||s===Ao)if(a===St)if(r=e.get("WEBGL_compressed_texture_s3tc_srgb"),r!==null){if(s===xo)return r.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(s===So)return r.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(s===Eo)return r.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(s===Ao)return r.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(r=e.get("WEBGL_compressed_texture_s3tc"),r!==null){if(s===xo)return r.COMPRESSED_RGB_S3TC_DXT1_EXT;if(s===So)return r.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(s===Eo)return r.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(s===Ao)return r.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(s===zd||s===wd||s===yd||s===vd)if(r=e.get("WEBGL_compressed_texture_pvrtc"),r!==null){if(s===zd)return r.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(s===wd)return r.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(s===yd)return r.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(s===vd)return r.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(s===Od||s===xd||s===Sd||s===Ed||s===Ad||s===Zo||s===Dd)if(r=e.get("WEBGL_compressed_texture_etc"),r!==null){if(s===Od||s===xd)return a===St?r.COMPRESSED_SRGB8_ETC2:r.COMPRESSED_RGB8_ETC2;if(s===Sd)return a===St?r.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:r.COMPRESSED_RGBA8_ETC2_EAC;if(s===Ed)return r.COMPRESSED_R11_EAC;if(s===Ad)return r.COMPRESSED_SIGNED_R11_EAC;if(s===Zo)return r.COMPRESSED_RG11_EAC;if(s===Dd)return r.COMPRESSED_SIGNED_RG11_EAC}else return null;if(s===Td||s===Id||s===Gd||s===Rd||s===Nd||s===Bd||s===Cd||s===Pd||s===Ld||s===Wd||s===kd||s===Ud||s===Fd||s===jd)if(r=e.get("WEBGL_compressed_texture_astc"),r!==null){if(s===Td)return a===St?r.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:r.COMPRESSED_RGBA_ASTC_4x4_KHR;if(s===Id)return a===St?r.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:r.COMPRESSED_RGBA_ASTC_5x4_KHR;if(s===Gd)return a===St?r.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:r.COMPRESSED_RGBA_ASTC_5x5_KHR;if(s===Rd)return a===St?r.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:r.COMPRESSED_RGBA_ASTC_6x5_KHR;if(s===Nd)return a===St?r.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:r.COMPRESSED_RGBA_ASTC_6x6_KHR;if(s===Bd)return a===St?r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:r.COMPRESSED_RGBA_ASTC_8x5_KHR;if(s===Cd)return a===St?r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:r.COMPRESSED_RGBA_ASTC_8x6_KHR;if(s===Pd)return a===St?r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:r.COMPRESSED_RGBA_ASTC_8x8_KHR;if(s===Ld)return a===St?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:r.COMPRESSED_RGBA_ASTC_10x5_KHR;if(s===Wd)return a===St?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:r.COMPRESSED_RGBA_ASTC_10x6_KHR;if(s===kd)return a===St?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:r.COMPRESSED_RGBA_ASTC_10x8_KHR;if(s===Ud)return a===St?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:r.COMPRESSED_RGBA_ASTC_10x10_KHR;if(s===Fd)return a===St?r.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:r.COMPRESSED_RGBA_ASTC_12x10_KHR;if(s===jd)return a===St?r.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:r.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(s===$d||s===Vd||s===Hd)if(r=e.get("EXT_texture_compression_bptc"),r!==null){if(s===$d)return a===St?r.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:r.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(s===Vd)return r.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(s===Hd)return r.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(s===qd||s===Xd||s===Qo||s===Kd)if(r=e.get("EXT_texture_compression_rgtc"),r!==null){if(s===qd)return r.COMPRESSED_RED_RGTC1_EXT;if(s===Xd)return r.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(s===Qo)return r.COMPRESSED_RED_GREEN_RGTC2_EXT;if(s===Kd)return r.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return s===va?n.UNSIGNED_INT_24_8:n[s]!==void 0?n[s]:null}return{convert:t}}const PA=`
4116
4116
  void main() {
4117
4117
 
4118
4118
  gl_Position = vec4( position, 1.0 );
@@ -4136,7 +4136,7 @@ void main() {
4136
4136
 
4137
4137
  }
4138
4138
 
4139
- }`;class WA{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(e,t){if(this.texture===null){const s=new rM(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 jt({vertexShader:PA,fragmentShader:LA,uniforms:{depthColor:{value:this.texture},depthWidth:{value:t.z},depthHeight:{value:t.w}}});this.mesh=new Ms(new Ol(20,20),s)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}}class kA extends Ui{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,p=null,f=null;const M=typeof XRWebGLBinding<"u",g=new WA,m={},_=t.getContextAttributes();let w=null,z=null;const y=[],O=[],S=new et;let b=null;const v=new Rs;v.viewport=new Wt;const E=new Rs;E.viewport=new Wt;const A=[v,E],I=new KO;let G=null,C=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(ne){let ae=y[ne];return ae===void 0&&(ae=new tc,y[ne]=ae),ae.getTargetRaySpace()},this.getControllerGrip=function(ne){let ae=y[ne];return ae===void 0&&(ae=new tc,y[ne]=ae),ae.getGripSpace()},this.getHand=function(ne){let ae=y[ne];return ae===void 0&&(ae=new tc,y[ne]=ae),ae.getHandSpace()};function B(ne){const ae=O.indexOf(ne.inputSource);if(ae===-1)return;const ue=y[ae];ue!==void 0&&(ue.update(ne.inputSource,ne.frame,c||a),ue.dispatchEvent({type:ne.type,data:ne.inputSource}))}function P(){i.removeEventListener("select",B),i.removeEventListener("selectstart",B),i.removeEventListener("selectend",B),i.removeEventListener("squeeze",B),i.removeEventListener("squeezestart",B),i.removeEventListener("squeezeend",B),i.removeEventListener("end",P),i.removeEventListener("inputsourceschange",L);for(let ne=0;ne<y.length;ne++){const ae=O[ne];ae!==null&&(O[ne]=null,y[ne].disconnect(ae))}G=null,C=null,g.reset();for(const ne in m)delete m[ne];e.setRenderTarget(w),p=null,h=null,u=null,i=null,z=null,Pe.stop(),s.isPresenting=!1,e.setPixelRatio(b),e.setSize(S.width,S.height,!1),s.dispatchEvent({type:"sessionend"})}this.setFramebufferScaleFactor=function(ne){r=ne,s.isPresenting===!0&&He("WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(ne){o=ne,s.isPresenting===!0&&He("WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return c||a},this.setReferenceSpace=function(ne){c=ne},this.getBaseLayer=function(){return h!==null?h:p},this.getBinding=function(){return u===null&&M&&(u=new XRWebGLBinding(i,t)),u},this.getFrame=function(){return f},this.getSession=function(){return i},this.setSession=async function(ne){if(i=ne,i!==null){if(w=e.getRenderTarget(),i.addEventListener("select",B),i.addEventListener("selectstart",B),i.addEventListener("selectend",B),i.addEventListener("squeeze",B),i.addEventListener("squeezestart",B),i.addEventListener("squeezeend",B),i.addEventListener("end",P),i.addEventListener("inputsourceschange",L),_.xrCompatible!==!0&&await t.makeXRCompatible(),b=e.getPixelRatio(),e.getSize(S),M&&"createProjectionLayer"in XRWebGLBinding.prototype){let ue=null,Xe=null,Ze=null;_.depth&&(Ze=_.stencil?t.DEPTH24_STENCIL8:t.DEPTH_COMPONENT24,ue=_.stencil?vi:Tn,Xe=_.stencil?va:on);const Fe={colorFormat:t.RGBA8,depthFormat:Ze,scaleFactor:r};u=this.getBinding(),h=u.createProjectionLayer(Fe),i.updateRenderState({layers:[h]}),e.setPixelRatio(1),e.setSize(h.textureWidth,h.textureHeight,!1),z=new rn(h.textureWidth,h.textureHeight,{format:Vs,type:Ss,depthTexture:new Rr(h.textureWidth,h.textureHeight,Xe,void 0,void 0,void 0,void 0,void 0,void 0,ue),stencilBuffer:_.stencil,colorSpace:e.outputColorSpace,samples:_.antialias?4:0,resolveDepthBuffer:h.ignoreDepthValues===!1,resolveStencilBuffer:h.ignoreDepthValues===!1})}else{const ue={antialias:_.antialias,alpha:!0,depth:_.depth,stencil:_.stencil,framebufferScaleFactor:r};p=new XRWebGLLayer(i,t,ue),i.updateRenderState({baseLayer:p}),e.setPixelRatio(1),e.setSize(p.framebufferWidth,p.framebufferHeight,!1),z=new rn(p.framebufferWidth,p.framebufferHeight,{format:Vs,type:Ss,colorSpace:e.outputColorSpace,stencilBuffer:_.stencil,resolveDepthBuffer:p.ignoreDepthValues===!1,resolveStencilBuffer:p.ignoreDepthValues===!1})}z.isXRRenderTarget=!0,this.setFoveation(l),c=null,a=await i.requestReferenceSpace(o),Pe.setContext(i),Pe.start(),s.isPresenting=!0,s.dispatchEvent({type:"sessionstart"})}},this.getEnvironmentBlendMode=function(){if(i!==null)return i.environmentBlendMode},this.getDepthTexture=function(){return g.getDepthTexture()};function L(ne){for(let ae=0;ae<ne.removed.length;ae++){const ue=ne.removed[ae],Xe=O.indexOf(ue);Xe>=0&&(O[Xe]=null,y[Xe].disconnect(ue))}for(let ae=0;ae<ne.added.length;ae++){const ue=ne.added[ae];let Xe=O.indexOf(ue);if(Xe===-1){for(let Fe=0;Fe<y.length;Fe++)if(Fe>=O.length){O.push(ue),Xe=Fe;break}else if(O[Fe]===null){O[Fe]=ue,Xe=Fe;break}if(Xe===-1)break}const Ze=y[Xe];Ze&&Ze.connect(ue)}}const H=new W,X=new W;function oe(ne,ae,ue){H.setFromMatrixPosition(ae.matrixWorld),X.setFromMatrixPosition(ue.matrixWorld);const Xe=H.distanceTo(X),Ze=ae.projectionMatrix.elements,Fe=ue.projectionMatrix.elements,Lt=Ze[14]/(Ze[10]-1),ot=Ze[14]/(Ze[10]+1),yt=(Ze[9]+1)/Ze[5],ut=(Ze[9]-1)/Ze[5],lt=(Ze[8]-1)/Ze[0],Gt=(Fe[8]+1)/Fe[0],Bt=Lt*lt,$t=Lt*Gt,xt=Xe/(-lt+Gt),Ct=xt*-lt;if(ae.matrixWorld.decompose(ne.position,ne.quaternion,ne.scale),ne.translateX(Ct),ne.translateZ(xt),ne.matrixWorld.compose(ne.position,ne.quaternion,ne.scale),ne.matrixWorldInverse.copy(ne.matrixWorld).invert(),Ze[10]===-1)ne.projectionMatrix.copy(ae.projectionMatrix),ne.projectionMatrixInverse.copy(ae.projectionMatrixInverse);else{const Pt=Lt+xt,j=ot+xt,Ft=Bt-Ct,vt=$t+(Xe-Ct),N=yt*ot/j*Pt,x=ut*ot/j*Pt;ne.projectionMatrix.makePerspective(Ft,vt,N,x,Pt,j),ne.projectionMatrixInverse.copy(ne.projectionMatrix).invert()}}function J(ne,ae){ae===null?ne.matrixWorld.copy(ne.matrix):ne.matrixWorld.multiplyMatrices(ae.matrixWorld,ne.matrix),ne.matrixWorldInverse.copy(ne.matrixWorld).invert()}this.updateCamera=function(ne){if(i===null)return;let ae=ne.near,ue=ne.far;g.texture!==null&&(g.depthNear>0&&(ae=g.depthNear),g.depthFar>0&&(ue=g.depthFar)),I.near=E.near=v.near=ae,I.far=E.far=v.far=ue,(G!==I.near||C!==I.far)&&(i.updateRenderState({depthNear:I.near,depthFar:I.far}),G=I.near,C=I.far),I.layers.mask=ne.layers.mask|6,v.layers.mask=I.layers.mask&-5,E.layers.mask=I.layers.mask&-3;const Xe=ne.parent,Ze=I.cameras;J(I,Xe);for(let Fe=0;Fe<Ze.length;Fe++)J(Ze[Fe],Xe);Ze.length===2?oe(I,v,E):I.projectionMatrix.copy(v.projectionMatrix),ce(ne,I,Xe)};function ce(ne,ae,ue){ue===null?ne.matrix.copy(ae.matrixWorld):(ne.matrix.copy(ue.matrixWorld),ne.matrix.invert(),ne.matrix.multiply(ae.matrixWorld)),ne.matrix.decompose(ne.position,ne.quaternion,ne.scale),ne.updateMatrixWorld(!0),ne.projectionMatrix.copy(ae.projectionMatrix),ne.projectionMatrixInverse.copy(ae.projectionMatrixInverse),ne.isPerspectiveCamera&&(ne.fov=Qd*2*Math.atan(1/ne.projectionMatrix.elements[5]),ne.zoom=1)}this.getCamera=function(){return I},this.getFoveation=function(){if(!(h===null&&p===null))return l},this.setFoveation=function(ne){l=ne,h!==null&&(h.fixedFoveation=ne),p!==null&&p.fixedFoveation!==void 0&&(p.fixedFoveation=ne)},this.hasDepthSensing=function(){return g.texture!==null},this.getDepthSensingMesh=function(){return g.getMesh(I)},this.getCameraTexture=function(ne){return m[ne]};let We=null;function qe(ne,ae){if(d=ae.getViewerPose(c||a),f=ae,d!==null){const ue=d.views;p!==null&&(e.setRenderTargetFramebuffer(z,p.framebuffer),e.setRenderTarget(z));let Xe=!1;ue.length!==I.cameras.length&&(I.cameras.length=0,Xe=!0);for(let ot=0;ot<ue.length;ot++){const yt=ue[ot];let ut=null;if(p!==null)ut=p.getViewport(yt);else{const Gt=u.getViewSubImage(h,yt);ut=Gt.viewport,ot===0&&(e.setRenderTargetTextures(z,Gt.colorTexture,Gt.depthStencilTexture),e.setRenderTarget(z))}let lt=A[ot];lt===void 0&&(lt=new Rs,lt.layers.enable(ot),lt.viewport=new Wt,A[ot]=lt),lt.matrix.fromArray(yt.transform.matrix),lt.matrix.decompose(lt.position,lt.quaternion,lt.scale),lt.projectionMatrix.fromArray(yt.projectionMatrix),lt.projectionMatrixInverse.copy(lt.projectionMatrix).invert(),lt.viewport.set(ut.x,ut.y,ut.width,ut.height),ot===0&&(I.matrix.copy(lt.matrix),I.matrix.decompose(I.position,I.quaternion,I.scale)),Xe===!0&&I.cameras.push(lt)}const Ze=i.enabledFeatures;if(Ze&&Ze.includes("depth-sensing")&&i.depthUsage=="gpu-optimized"&&M){u=s.getBinding();const ot=u.getDepthInformation(ue[0]);ot&&ot.isValid&&ot.texture&&g.init(ot,i.renderState)}if(Ze&&Ze.includes("camera-access")&&M){e.state.unbindTexture(),u=s.getBinding();for(let ot=0;ot<ue.length;ot++){const yt=ue[ot].camera;if(yt){let ut=m[yt];ut||(ut=new rM,m[yt]=ut);const lt=u.getCameraImage(yt);ut.sourceTexture=lt}}}}for(let ue=0;ue<y.length;ue++){const Xe=O[ue],Ze=y[ue];Xe!==null&&Ze!==void 0&&Ze.update(Xe,ae,c||a)}We&&We(ne,ae),ae.detectedPlanes&&s.dispatchEvent({type:"planesdetected",data:ae}),f=null}const Pe=new cM;Pe.setAnimationLoop(qe),this.setAnimationLoop=function(ne){We=ne},this.dispose=function(){}}}const UA=new wt,gM=new st;gM.set(-1,0,0,0,1,0,0,0,1);function FA(n,e){function t(g,m){g.matrixAutoUpdate===!0&&g.updateMatrix(),m.value.copy(g.matrix)}function s(g,m){m.color.getRGB(g.fogColor.value,aM(n)),m.isFog?(g.fogNear.value=m.near,g.fogFar.value=m.far):m.isFogExp2&&(g.fogDensity.value=m.density)}function i(g,m,_,w,z){m.isNodeMaterial?m.uniformsNeedUpdate=!1:m.isMeshBasicMaterial?r(g,m):m.isMeshLambertMaterial?(r(g,m),m.envMap&&(g.envMapIntensity.value=m.envMapIntensity)):m.isMeshToonMaterial?(r(g,m),u(g,m)):m.isMeshPhongMaterial?(r(g,m),d(g,m),m.envMap&&(g.envMapIntensity.value=m.envMapIntensity)):m.isMeshStandardMaterial?(r(g,m),h(g,m),m.isMeshPhysicalMaterial&&p(g,m,z)):m.isMeshMatcapMaterial?(r(g,m),f(g,m)):m.isMeshDepthMaterial?r(g,m):m.isMeshDistanceMaterial?(r(g,m),M(g,m)):m.isMeshNormalMaterial?r(g,m):m.isLineBasicMaterial?(a(g,m),m.isLineDashedMaterial&&o(g,m)):m.isPointsMaterial?l(g,m,_,w):m.isSpriteMaterial?c(g,m):m.isShadowMaterial?(g.color.value.copy(m.color),g.opacity.value=m.opacity):m.isShaderMaterial&&(m.uniformsNeedUpdate=!1)}function r(g,m){g.opacity.value=m.opacity,m.color&&g.diffuse.value.copy(m.color),m.emissive&&g.emissive.value.copy(m.emissive).multiplyScalar(m.emissiveIntensity),m.map&&(g.map.value=m.map,t(m.map,g.mapTransform)),m.alphaMap&&(g.alphaMap.value=m.alphaMap,t(m.alphaMap,g.alphaMapTransform)),m.bumpMap&&(g.bumpMap.value=m.bumpMap,t(m.bumpMap,g.bumpMapTransform),g.bumpScale.value=m.bumpScale,m.side===gs&&(g.bumpScale.value*=-1)),m.normalMap&&(g.normalMap.value=m.normalMap,t(m.normalMap,g.normalMapTransform),g.normalScale.value.copy(m.normalScale),m.side===gs&&g.normalScale.value.negate()),m.displacementMap&&(g.displacementMap.value=m.displacementMap,t(m.displacementMap,g.displacementMapTransform),g.displacementScale.value=m.displacementScale,g.displacementBias.value=m.displacementBias),m.emissiveMap&&(g.emissiveMap.value=m.emissiveMap,t(m.emissiveMap,g.emissiveMapTransform)),m.specularMap&&(g.specularMap.value=m.specularMap,t(m.specularMap,g.specularMapTransform)),m.alphaTest>0&&(g.alphaTest.value=m.alphaTest);const _=e.get(m),w=_.envMap,z=_.envMapRotation;w&&(g.envMap.value=w,g.envMapRotation.value.setFromMatrix4(UA.makeRotationFromEuler(z)).transpose(),w.isCubeTexture&&w.isRenderTargetTexture===!1&&g.envMapRotation.value.premultiply(gM),g.reflectivity.value=m.reflectivity,g.ior.value=m.ior,g.refractionRatio.value=m.refractionRatio),m.lightMap&&(g.lightMap.value=m.lightMap,g.lightMapIntensity.value=m.lightMapIntensity,t(m.lightMap,g.lightMapTransform)),m.aoMap&&(g.aoMap.value=m.aoMap,g.aoMapIntensity.value=m.aoMapIntensity,t(m.aoMap,g.aoMapTransform))}function a(g,m){g.diffuse.value.copy(m.color),g.opacity.value=m.opacity,m.map&&(g.map.value=m.map,t(m.map,g.mapTransform))}function o(g,m){g.dashSize.value=m.dashSize,g.totalSize.value=m.dashSize+m.gapSize,g.scale.value=m.scale}function l(g,m,_,w){g.diffuse.value.copy(m.color),g.opacity.value=m.opacity,g.size.value=m.size*_,g.scale.value=w*.5,m.map&&(g.map.value=m.map,t(m.map,g.uvTransform)),m.alphaMap&&(g.alphaMap.value=m.alphaMap,t(m.alphaMap,g.alphaMapTransform)),m.alphaTest>0&&(g.alphaTest.value=m.alphaTest)}function c(g,m){g.diffuse.value.copy(m.color),g.opacity.value=m.opacity,g.rotation.value=m.rotation,m.map&&(g.map.value=m.map,t(m.map,g.mapTransform)),m.alphaMap&&(g.alphaMap.value=m.alphaMap,t(m.alphaMap,g.alphaMapTransform)),m.alphaTest>0&&(g.alphaTest.value=m.alphaTest)}function d(g,m){g.specular.value.copy(m.specular),g.shininess.value=Math.max(m.shininess,1e-4)}function u(g,m){m.gradientMap&&(g.gradientMap.value=m.gradientMap)}function h(g,m){g.metalness.value=m.metalness,m.metalnessMap&&(g.metalnessMap.value=m.metalnessMap,t(m.metalnessMap,g.metalnessMapTransform)),g.roughness.value=m.roughness,m.roughnessMap&&(g.roughnessMap.value=m.roughnessMap,t(m.roughnessMap,g.roughnessMapTransform)),m.envMap&&(g.envMapIntensity.value=m.envMapIntensity)}function p(g,m,_){g.ior.value=m.ior,m.sheen>0&&(g.sheenColor.value.copy(m.sheenColor).multiplyScalar(m.sheen),g.sheenRoughness.value=m.sheenRoughness,m.sheenColorMap&&(g.sheenColorMap.value=m.sheenColorMap,t(m.sheenColorMap,g.sheenColorMapTransform)),m.sheenRoughnessMap&&(g.sheenRoughnessMap.value=m.sheenRoughnessMap,t(m.sheenRoughnessMap,g.sheenRoughnessMapTransform))),m.clearcoat>0&&(g.clearcoat.value=m.clearcoat,g.clearcoatRoughness.value=m.clearcoatRoughness,m.clearcoatMap&&(g.clearcoatMap.value=m.clearcoatMap,t(m.clearcoatMap,g.clearcoatMapTransform)),m.clearcoatRoughnessMap&&(g.clearcoatRoughnessMap.value=m.clearcoatRoughnessMap,t(m.clearcoatRoughnessMap,g.clearcoatRoughnessMapTransform)),m.clearcoatNormalMap&&(g.clearcoatNormalMap.value=m.clearcoatNormalMap,t(m.clearcoatNormalMap,g.clearcoatNormalMapTransform),g.clearcoatNormalScale.value.copy(m.clearcoatNormalScale),m.side===gs&&g.clearcoatNormalScale.value.negate())),m.dispersion>0&&(g.dispersion.value=m.dispersion),m.iridescence>0&&(g.iridescence.value=m.iridescence,g.iridescenceIOR.value=m.iridescenceIOR,g.iridescenceThicknessMinimum.value=m.iridescenceThicknessRange[0],g.iridescenceThicknessMaximum.value=m.iridescenceThicknessRange[1],m.iridescenceMap&&(g.iridescenceMap.value=m.iridescenceMap,t(m.iridescenceMap,g.iridescenceMapTransform)),m.iridescenceThicknessMap&&(g.iridescenceThicknessMap.value=m.iridescenceThicknessMap,t(m.iridescenceThicknessMap,g.iridescenceThicknessMapTransform))),m.transmission>0&&(g.transmission.value=m.transmission,g.transmissionSamplerMap.value=_.texture,g.transmissionSamplerSize.value.set(_.width,_.height),m.transmissionMap&&(g.transmissionMap.value=m.transmissionMap,t(m.transmissionMap,g.transmissionMapTransform)),g.thickness.value=m.thickness,m.thicknessMap&&(g.thicknessMap.value=m.thicknessMap,t(m.thicknessMap,g.thicknessMapTransform)),g.attenuationDistance.value=m.attenuationDistance,g.attenuationColor.value.copy(m.attenuationColor)),m.anisotropy>0&&(g.anisotropyVector.value.set(m.anisotropy*Math.cos(m.anisotropyRotation),m.anisotropy*Math.sin(m.anisotropyRotation)),m.anisotropyMap&&(g.anisotropyMap.value=m.anisotropyMap,t(m.anisotropyMap,g.anisotropyMapTransform))),g.specularIntensity.value=m.specularIntensity,g.specularColor.value.copy(m.specularColor),m.specularColorMap&&(g.specularColorMap.value=m.specularColorMap,t(m.specularColorMap,g.specularColorMapTransform)),m.specularIntensityMap&&(g.specularIntensityMap.value=m.specularIntensityMap,t(m.specularIntensityMap,g.specularIntensityMapTransform))}function f(g,m){m.matcap&&(g.matcap.value=m.matcap)}function M(g,m){const _=e.get(m).light;g.referencePosition.value.setFromMatrixPosition(_.matrixWorld),g.nearDistance.value=_.shadow.camera.near,g.farDistance.value=_.shadow.camera.far}return{refreshFogUniforms:s,refreshMaterialUniforms:i}}function jA(n,e,t,s){let i={},r={},a=[];const o=n.getParameter(n.MAX_UNIFORM_BUFFER_BINDINGS);function l(z,y){const O=y.program;s.uniformBlockBinding(z,O)}function c(z,y){let O=i[z.id];O===void 0&&(g(z),O=d(z),i[z.id]=O,z.addEventListener("dispose",_));const S=y.program;s.updateUBOMapping(z,S);const b=e.render.frame;r[z.id]!==b&&(h(z),r[z.id]=b)}function d(z){const y=u();z.__bindingPointIndex=y;const O=n.createBuffer(),S=z.__size,b=z.usage;return n.bindBuffer(n.UNIFORM_BUFFER,O),n.bufferData(n.UNIFORM_BUFFER,S,b),n.bindBuffer(n.UNIFORM_BUFFER,null),n.bindBufferBase(n.UNIFORM_BUFFER,y,O),O}function u(){for(let z=0;z<o;z++)if(a.indexOf(z)===-1)return a.push(z),z;return pt("WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}function h(z){const y=i[z.id],O=z.uniforms,S=z.__cache;n.bindBuffer(n.UNIFORM_BUFFER,y);for(let b=0,v=O.length;b<v;b++){const E=O[b];if(Array.isArray(E))for(let A=0,I=E.length;A<I;A++)p(E[A],b,A,S);else p(E,b,0,S)}n.bindBuffer(n.UNIFORM_BUFFER,null)}function p(z,y,O,S){if(M(z,y,O,S)===!0){const b=z.__offset,v=z.value;if(Array.isArray(v)){let E=0;for(let A=0;A<v.length;A++){const I=v[A],G=m(I);f(I,z.__data,E),typeof I!="number"&&typeof I!="boolean"&&!I.isMatrix3&&!ArrayBuffer.isView(I)&&(E+=G.storage/Float32Array.BYTES_PER_ELEMENT)}}else f(v,z.__data,0);n.bufferSubData(n.UNIFORM_BUFFER,b,z.__data)}}function f(z,y,O){typeof z=="number"||typeof z=="boolean"?y[0]=z:z.isMatrix3?(y[0]=z.elements[0],y[1]=z.elements[1],y[2]=z.elements[2],y[3]=0,y[4]=z.elements[3],y[5]=z.elements[4],y[6]=z.elements[5],y[7]=0,y[8]=z.elements[6],y[9]=z.elements[7],y[10]=z.elements[8],y[11]=0):ArrayBuffer.isView(z)?y.set(new z.constructor(z.buffer,z.byteOffset,y.length)):z.toArray(y,O)}function M(z,y,O,S){const b=z.value,v=y+"_"+O;if(S[v]===void 0)return typeof b=="number"||typeof b=="boolean"?S[v]=b:ArrayBuffer.isView(b)?S[v]=b.slice():S[v]=b.clone(),!0;{const E=S[v];if(typeof b=="number"||typeof b=="boolean"){if(E!==b)return S[v]=b,!0}else{if(ArrayBuffer.isView(b))return!0;if(E.equals(b)===!1)return E.copy(b),!0}}return!1}function g(z){const y=z.uniforms;let O=0;const S=16;for(let v=0,E=y.length;v<E;v++){const A=Array.isArray(y[v])?y[v]:[y[v]];for(let I=0,G=A.length;I<G;I++){const C=A[I],B=Array.isArray(C.value)?C.value:[C.value];for(let P=0,L=B.length;P<L;P++){const H=B[P],X=m(H),oe=O%S,J=oe%X.boundary,ce=oe+J;O+=J,ce!==0&&S-ce<X.storage&&(O+=S-ce),C.__data=new Float32Array(X.storage/Float32Array.BYTES_PER_ELEMENT),C.__offset=O,O+=X.storage}}}const b=O%S;return b>0&&(O+=S-b),z.__size=O,z.__cache={},this}function m(z){const y={boundary:0,storage:0};return typeof z=="number"||typeof z=="boolean"?(y.boundary=4,y.storage=4):z.isVector2?(y.boundary=8,y.storage=8):z.isVector3||z.isColor?(y.boundary=16,y.storage=12):z.isVector4?(y.boundary=16,y.storage=16):z.isMatrix3?(y.boundary=48,y.storage=48):z.isMatrix4?(y.boundary=64,y.storage=64):z.isTexture?He("WebGLRenderer: Texture samplers can not be part of an uniforms group."):ArrayBuffer.isView(z)?(y.boundary=16,y.storage=z.byteLength):He("WebGLRenderer: Unsupported uniform value type.",z),y}function _(z){const y=z.target;y.removeEventListener("dispose",_);const O=a.indexOf(y.__bindingPointIndex);a.splice(O,1),n.deleteBuffer(i[y.id]),delete i[y.id],delete r[y.id]}function w(){for(const z in i)n.deleteBuffer(i[z]);a=[],i={},r={}}return{bind:l,update:c,dispose:w}}const $A=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 Ks=null;function VA(){return Ks===null&&(Ks=new sM($A,16,16,Wi,Dn),Ks.name="DFG_LUT",Ks.minFilter=os,Ks.magFilter=os,Ks.wrapS=yn,Ks.wrapT=yn,Ks.generateMipmaps=!1,Ks.needsUpdate=!0),Ks}class HA{constructor(e={}){const{canvas:t=rO(),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:p=Ss}=e;this.isWebGLRenderer=!0;let f;if(s!==null){if(typeof WebGLRenderingContext<"u"&&s instanceof WebGLRenderingContext)throw new Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");f=s.getContextAttributes().alpha}else f=a;const M=p,g=new Set([Fu,Uu,ku]),m=new Set([Ss,on,ya,va,Pu,Lu]),_=new Uint32Array(4),w=new Int32Array(4),z=new W;let y=null,O=null;const S=[],b=[];let v=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=nn,this.toneMappingExposure=1,this.transmissionResolutionScale=1;const E=this;let A=!1,I=null,G=null,C=null,B=null;this._outputColorSpace=Is;let P=0,L=0,H=null,X=-1,oe=null;const J=new Wt,ce=new Wt;let We=null;const qe=new ke(0);let Pe=0,ne=t.width,ae=t.height,ue=1,Xe=null,Ze=null;const Fe=new Wt(0,0,ne,ae),Lt=new Wt(0,0,ne,ae);let ot=!1;const yt=new Yu;let ut=!1,lt=!1;const Gt=new wt,Bt=new W,$t=new Wt,xt={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};let Ct=!1;function Pt(){return H===null?ue:1}let j=s;function Ft(T,F){return t.getContext(T,F)}try{const T={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${Bu}`),t.addEventListener("webglcontextlost",ht,!1),t.addEventListener("webglcontextrestored",Et,!1),t.addEventListener("webglcontextcreationerror",_s,!1),j===null){const F="webgl2";if(j=Ft(F,T),j===null)throw Ft(F)?new Error("THREE.WebGLRenderer: Error creating WebGL context with your selected attributes."):new Error("THREE.WebGLRenderer: Error creating WebGL context.")}}catch(T){throw pt("WebGLRenderer: "+T.message),T}let vt,N,x,V,Z,$,pe,ye,te,ie,he,Te,Me,_e,Ue,je,$e,U,ze,re,we,Ee,de;function Be(){vt=new VE(j),vt.init(),we=new CA(j,vt),N=new PE(j,vt,e,we),x=new NA(j,vt),N.reversedDepthBuffer&&h&&x.buffers.depth.setReversed(!0),G=j.createFramebuffer(),C=j.createFramebuffer(),B=j.createFramebuffer(),V=new XE(j),Z=new zA,$=new BA(j,vt,x,Z,N,we,V),pe=new $E(E),ye=new QO(j),Ee=new BE(j,ye),te=new HE(j,ye,V,Ee),ie=new YE(j,te,ye,Ee,V),U=new KE(j,N,$),Ue=new LE(Z),he=new _A(E,pe,vt,N,Ee,Ue),Te=new FA(E,Z),Me=new yA,_e=new AA(vt),$e=new NE(E,pe,x,ie,f,l),je=new RA(E,ie,N),de=new jA(j,V,N,x),ze=new CE(j,vt,V),re=new qE(j,vt,V),V.programs=he.programs,E.capabilities=N,E.extensions=vt,E.properties=Z,E.renderLists=Me,E.shadowMap=je,E.state=x,E.info=V}Be(),M!==Ss&&(v=new QE(M,t.width,t.height,o,i,r));const Ge=new kA(E,j);this.xr=Ge,this.getContext=function(){return j},this.getContextAttributes=function(){return j.getContextAttributes()},this.forceContextLoss=function(){const T=vt.get("WEBGL_lose_context");T&&T.loseContext()},this.forceContextRestore=function(){const T=vt.get("WEBGL_lose_context");T&&T.restoreContext()},this.getPixelRatio=function(){return ue},this.setPixelRatio=function(T){T!==void 0&&(ue=T,this.setSize(ne,ae,!1))},this.getSize=function(T){return T.set(ne,ae)},this.setSize=function(T,F,Q=!0){if(Ge.isPresenting){He("WebGLRenderer: Can't change size while VR device is presenting.");return}ne=T,ae=F,t.width=Math.floor(T*ue),t.height=Math.floor(F*ue),Q===!0&&(t.style.width=T+"px",t.style.height=F+"px"),v!==null&&v.setSize(t.width,t.height),this.setViewport(0,0,T,F)},this.getDrawingBufferSize=function(T){return T.set(ne*ue,ae*ue).floor()},this.setDrawingBufferSize=function(T,F,Q){ne=T,ae=F,ue=Q,t.width=Math.floor(T*Q),t.height=Math.floor(F*Q),this.setViewport(0,0,T,F)},this.setEffects=function(T){if(M===Ss){pt("WebGLRenderer: setEffects() requires outputBufferType set to HalfFloatType or FloatType.");return}if(T){for(let F=0;F<T.length;F++)if(T[F].isOutputPass===!0){He("WebGLRenderer: OutputPass is not needed in setEffects(). Tone mapping and color space conversion are applied automatically.");break}}v.setEffects(T||[])},this.getCurrentViewport=function(T){return T.copy(J)},this.getViewport=function(T){return T.copy(Fe)},this.setViewport=function(T,F,Q,K){T.isVector4?Fe.set(T.x,T.y,T.z,T.w):Fe.set(T,F,Q,K),x.viewport(J.copy(Fe).multiplyScalar(ue).round())},this.getScissor=function(T){return T.copy(Lt)},this.setScissor=function(T,F,Q,K){T.isVector4?Lt.set(T.x,T.y,T.z,T.w):Lt.set(T,F,Q,K),x.scissor(ce.copy(Lt).multiplyScalar(ue).round())},this.getScissorTest=function(){return ot},this.setScissorTest=function(T){x.setScissorTest(ot=T)},this.setOpaqueSort=function(T){Xe=T},this.setTransparentSort=function(T){Ze=T},this.getClearColor=function(T){return T.copy($e.getClearColor())},this.setClearColor=function(){$e.setClearColor(...arguments)},this.getClearAlpha=function(){return $e.getClearAlpha()},this.setClearAlpha=function(){$e.setClearAlpha(...arguments)},this.clear=function(T=!0,F=!0,Q=!0){let K=0;if(T){let Y=!1;if(H!==null){const ve=H.texture.format;Y=g.has(ve)}if(Y){const ve=H.texture.type,De=m.has(ve),Oe=$e.getClearColor(),Ne=$e.getClearAlpha(),Re=Oe.r,ge=Oe.g,nt=Oe.b;De?(_[0]=Re,_[1]=ge,_[2]=nt,_[3]=Ne,j.clearBufferuiv(j.COLOR,0,_)):(w[0]=Re,w[1]=ge,w[2]=nt,w[3]=Ne,j.clearBufferiv(j.COLOR,0,w))}else K|=j.COLOR_BUFFER_BIT}F&&(K|=j.DEPTH_BUFFER_BIT,this.state.buffers.depth.setMask(!0)),Q&&(K|=j.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),K!==0&&j.clear(K)},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(T){T.setRenderer(this),I=T},this.dispose=function(){t.removeEventListener("webglcontextlost",ht,!1),t.removeEventListener("webglcontextrestored",Et,!1),t.removeEventListener("webglcontextcreationerror",_s,!1),$e.dispose(),Me.dispose(),_e.dispose(),Z.dispose(),pe.dispose(),ie.dispose(),Ee.dispose(),de.dispose(),he.dispose(),Ge.dispose(),Ge.removeEventListener("sessionstart",Lr),Ge.removeEventListener("sessionend",Wr),cn.stop()};function ht(T){T.preventDefault(),sl("WebGLRenderer: Context Lost."),A=!0}function Et(){sl("WebGLRenderer: Context Restored."),A=!1;const T=V.autoReset,F=je.enabled,Q=je.autoUpdate,K=je.needsUpdate,Y=je.type;Be(),V.autoReset=T,je.enabled=F,je.autoUpdate=Q,je.needsUpdate=K,je.type=Y}function _s(T){pt("WebGLRenderer: A WebGL context could not be created. Reason: ",T.statusMessage)}function zs(T){const F=T.target;F.removeEventListener("dispose",zs),Aa(F)}function Aa(T){Dl(T),Z.remove(T)}function Dl(T){const F=Z.get(T).programs;F!==void 0&&(F.forEach(function(Q){he.releaseProgram(Q)}),T.isShaderMaterial&&he.releaseShaderCache(T))}this.renderBufferDirect=function(T,F,Q,K,Y,ve){F===null&&(F=xt);const De=Y.isMesh&&Y.matrixWorld.determinantAffine()<0,Oe=Tl(T,F,Q,K,Y);x.setMaterial(K,De);let Ne=Q.index,Re=1;if(K.wireframe===!0){if(Ne=te.getWireframeAttribute(Q),Ne===void 0)return;Re=2}const ge=Q.drawRange,nt=Q.attributes.position;let Ce=ge.start*Re,zt=(ge.start+ge.count)*Re;ve!==null&&(Ce=Math.max(Ce,ve.start*Re),zt=Math.min(zt,(ve.start+ve.count)*Re)),Ne!==null?(Ce=Math.max(Ce,0),zt=Math.min(zt,Ne.count)):nt!=null&&(Ce=Math.max(Ce,0),zt=Math.min(zt,nt.count));const At=zt-Ce;if(At<0||At===1/0)return;Ee.setup(Y,K,Oe,Q,Ne);let Ve,Mt=ze;if(Ne!==null&&(Ve=ye.get(Ne),Mt=re,Mt.setIndex(Ve)),Y.isMesh)K.wireframe===!0?(x.setLineWidth(K.wireframeLinewidth*Pt()),Mt.setMode(j.LINES)):Mt.setMode(j.TRIANGLES);else if(Y.isLine){let D=K.linewidth;D===void 0&&(D=1),x.setLineWidth(D*Pt()),Y.isLineSegments?Mt.setMode(j.LINES):Y.isLineLoop?Mt.setMode(j.LINE_LOOP):Mt.setMode(j.LINE_STRIP)}else Y.isPoints?Mt.setMode(j.POINTS):Y.isSprite&&Mt.setMode(j.TRIANGLES);if(Y.isBatchedMesh)if(vt.get("WEBGL_multi_draw"))Mt.renderMultiDraw(Y._multiDrawStarts,Y._multiDrawCounts,Y._multiDrawCount);else{const D=Y._multiDrawStarts,R=Y._multiDrawCounts,ee=Y._multiDrawCount,q=Ne?ye.get(Ne).bytesPerElement:1,se=Z.get(K).currentProgram.getUniforms();for(let be=0;be<ee;be++)se.setValue(j,"_gl_DrawID",be),Mt.render(D[be]/q,R[be])}else if(Y.isInstancedMesh)Mt.renderInstances(Ce,At,Y.count);else if(Q.isInstancedBufferGeometry){const D=Q._maxInstanceCount!==void 0?Q._maxInstanceCount:1/0,R=Math.min(Q.instanceCount,D);Mt.renderInstances(Ce,At,R)}else Mt.render(Ce,At)};function qs(T,F,Q){T.transparent===!0&&T.side===zn&&T.forceSinglePass===!1?(T.side=gs,T.needsUpdate=!0,Nn(T,F,Q),T.side=ri,T.needsUpdate=!0,Nn(T,F,Q),T.side=zn):Nn(T,F,Q)}this.compile=function(T,F,Q=null){Q===null&&(Q=T),O=_e.get(Q),O.init(F),b.push(O),Q.traverseVisible(function(Y){Y.isLight&&Y.layers.test(F.layers)&&(O.pushLight(Y),Y.castShadow&&O.pushShadow(Y))}),T!==Q&&T.traverseVisible(function(Y){Y.isLight&&Y.layers.test(F.layers)&&(O.pushLight(Y),Y.castShadow&&O.pushShadow(Y))}),O.setupLights();const K=new Set;return T.traverse(function(Y){if(!(Y.isMesh||Y.isPoints||Y.isLine||Y.isSprite))return;const ve=Y.material;if(ve)if(Array.isArray(ve))for(let De=0;De<ve.length;De++){const Oe=ve[De];qs(Oe,Q,Y),K.add(Oe)}else qs(ve,Q,Y),K.add(ve)}),O=b.pop(),K},this.compileAsync=function(T,F,Q=null){const K=this.compile(T,F,Q);return new Promise(Y=>{function ve(){if(K.forEach(function(De){Z.get(De).currentProgram.isReady()&&K.delete(De)}),K.size===0){Y(T);return}setTimeout(ve,10)}vt.get("KHR_parallel_shader_compile")!==null?ve():setTimeout(ve,10)})};let Gn=null;function ln(T){Gn&&Gn(T)}function Lr(){cn.stop()}function Wr(){cn.start()}const cn=new cM;cn.setAnimationLoop(ln),typeof self<"u"&&cn.setContext(self),this.setAnimationLoop=function(T){Gn=T,Ge.setAnimationLoop(T),T===null?cn.stop():cn.start()},Ge.addEventListener("sessionstart",Lr),Ge.addEventListener("sessionend",Wr),this.render=function(T,F){if(F!==void 0&&F.isCamera!==!0){pt("WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(A===!0)return;I!==null&&I.renderStart(T,F);const Q=Ge.enabled===!0&&Ge.isPresenting===!0,K=v!==null&&(H===null||Q)&&v.begin(E,H);if(T.matrixWorldAutoUpdate===!0&&T.updateMatrixWorld(),F.parent===null&&F.matrixWorldAutoUpdate===!0&&F.updateMatrixWorld(),Ge.enabled===!0&&Ge.isPresenting===!0&&(v===null||v.isCompositing()===!1)&&(Ge.cameraAutoUpdate===!0&&Ge.updateCamera(F),F=Ge.getCamera()),T.isScene===!0&&T.onBeforeRender(E,T,F,H),O=_e.get(T,b.length),O.init(F),O.state.textureUnits=$.getTextureUnits(),b.push(O),Gt.multiplyMatrices(F.projectionMatrix,F.matrixWorldInverse),yt.setFromProjectionMatrix(Gt,tn,F.reversedDepth),lt=this.localClippingEnabled,ut=Ue.init(this.clippingPlanes,lt),y=Me.get(T,S.length),y.init(),S.push(y),Ge.enabled===!0&&Ge.isPresenting===!0){const De=E.xr.getDepthSensingMesh();De!==null&&Rn(De,F,-1/0,E.sortObjects)}Rn(T,F,0,E.sortObjects),y.finish(),E.sortObjects===!0&&y.sort(Xe,Ze,F.reversedDepth),Ct=Ge.enabled===!1||Ge.isPresenting===!1||Ge.hasDepthSensing()===!1,Ct&&$e.addToRenderList(y,T),this.info.render.frame++,this.info.autoReset===!0&&this.info.reset(),ut===!0&&Ue.beginShadows();const Y=O.state.shadowsArray;if(je.render(Y,T,F),ut===!0&&Ue.endShadows(),(K&&v.hasRenderPass())===!1){const De=y.opaque,Oe=y.transmissive;if(O.setupLights(),F.isArrayCamera){const Ne=F.cameras;if(Oe.length>0)for(let Re=0,ge=Ne.length;Re<ge;Re++){const nt=Ne[Re];Ur(De,Oe,T,nt)}Ct&&$e.render(T);for(let Re=0,ge=Ne.length;Re<ge;Re++){const nt=Ne[Re];kr(y,T,nt,nt.viewport)}}else Oe.length>0&&Ur(De,Oe,T,F),Ct&&$e.render(T),kr(y,T,F)}H!==null&&L===0&&($.updateMultisampleRenderTarget(H),$.updateRenderTargetMipmap(H)),K&&v.end(E),T.isScene===!0&&T.onAfterRender(E,T,F),Ee.resetDefaultState(),X=-1,oe=null,b.pop(),b.length>0?(O=b[b.length-1],$.setTextureUnits(O.state.textureUnits),ut===!0&&Ue.setGlobalState(E.clippingPlanes,O.state.camera)):O=null,S.pop(),S.length>0?y=S[S.length-1]:y=null,I!==null&&I.renderEnd()};function Rn(T,F,Q,K){if(T.visible===!1)return;if(T.layers.test(F.layers)){if(T.isGroup)Q=T.renderOrder;else if(T.isLOD)T.autoUpdate===!0&&T.update(F);else if(T.isLightProbeGrid)O.pushLightProbeGrid(T);else if(T.isLight)O.pushLight(T),T.castShadow&&O.pushShadow(T);else if(T.isSprite){if(!T.frustumCulled||yt.intersectsSprite(T)){K&&$t.setFromMatrixPosition(T.matrixWorld).applyMatrix4(Gt);const De=ie.update(T),Oe=T.material;Oe.visible&&y.push(T,De,Oe,Q,$t.z,null)}}else if((T.isMesh||T.isLine||T.isPoints)&&(!T.frustumCulled||yt.intersectsObject(T))){const De=ie.update(T),Oe=T.material;if(K&&(T.boundingSphere!==void 0?(T.boundingSphere===null&&T.computeBoundingSphere(),$t.copy(T.boundingSphere.center)):(De.boundingSphere===null&&De.computeBoundingSphere(),$t.copy(De.boundingSphere.center)),$t.applyMatrix4(T.matrixWorld).applyMatrix4(Gt)),Array.isArray(Oe)){const Ne=De.groups;for(let Re=0,ge=Ne.length;Re<ge;Re++){const nt=Ne[Re],Ce=Oe[nt.materialIndex];Ce&&Ce.visible&&y.push(T,De,Ce,Q,$t.z,nt)}}else Oe.visible&&y.push(T,De,Oe,Q,$t.z,null)}}const ve=T.children;for(let De=0,Oe=ve.length;De<Oe;De++)Rn(ve[De],F,Q,K)}function kr(T,F,Q,K){const{opaque:Y,transmissive:ve,transparent:De}=T;O.setupLightsView(Q),ut===!0&&Ue.setGlobalState(E.clippingPlanes,Q),K&&x.viewport(J.copy(K)),Y.length>0&&oi(Y,F,Q),ve.length>0&&oi(ve,F,Q),De.length>0&&oi(De,F,Q),x.buffers.depth.setTest(!0),x.buffers.depth.setMask(!0),x.buffers.color.setMask(!0),x.setPolygonOffset(!1)}function Ur(T,F,Q,K){if((Q.isScene===!0?Q.overrideMaterial:null)!==null)return;if(O.state.transmissionRenderTarget[K.id]===void 0){const Ce=vt.has("EXT_color_buffer_half_float")||vt.has("EXT_color_buffer_float");O.state.transmissionRenderTarget[K.id]=new rn(1,1,{generateMipmaps:!0,type:Ce?Dn:Ss,minFilter:yi,samples:Math.max(4,N.samples),stencilBuffer:r,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:mt.workingColorSpace})}const ve=O.state.transmissionRenderTarget[K.id],De=K.viewport||J;ve.setSize(De.z*E.transmissionResolutionScale,De.w*E.transmissionResolutionScale);const Oe=E.getRenderTarget(),Ne=E.getActiveCubeFace(),Re=E.getActiveMipmapLevel();E.setRenderTarget(ve),E.getClearColor(qe),Pe=E.getClearAlpha(),Pe<1&&E.setClearColor(16777215,.5),E.clear(),Ct&&$e.render(Q);const ge=E.toneMapping;E.toneMapping=nn;const nt=K.viewport;if(K.viewport!==void 0&&(K.viewport=void 0),O.setupLightsView(K),ut===!0&&Ue.setGlobalState(E.clippingPlanes,K),oi(T,Q,K),$.updateMultisampleRenderTarget(ve),$.updateRenderTargetMipmap(ve),vt.has("WEBGL_multisampled_render_to_texture")===!1){let Ce=!1;for(let zt=0,At=F.length;zt<At;zt++){const Ve=F[zt],{object:Mt,geometry:D,material:R,group:ee}=Ve;if(R.side===zn&&Mt.layers.test(K.layers)){const q=R.side;R.side=gs,R.needsUpdate=!0,li(Mt,Q,K,D,R,ee),R.side=q,R.needsUpdate=!0,Ce=!0}}Ce===!0&&($.updateMultisampleRenderTarget(ve),$.updateRenderTargetMipmap(ve))}E.setRenderTarget(Oe,Ne,Re),E.setClearColor(qe,Pe),nt!==void 0&&(K.viewport=nt),E.toneMapping=ge}function oi(T,F,Q){const K=F.isScene===!0?F.overrideMaterial:null;for(let Y=0,ve=T.length;Y<ve;Y++){const De=T[Y],{object:Oe,geometry:Ne,group:Re}=De;let ge=De.material;ge.allowOverride===!0&&K!==null&&(ge=K),Oe.layers.test(Q.layers)&&li(Oe,F,Q,Ne,ge,Re)}}function li(T,F,Q,K,Y,ve){T.onBeforeRender(E,F,Q,K,Y,ve),T.modelViewMatrix.multiplyMatrices(Q.matrixWorldInverse,T.matrixWorld),T.normalMatrix.getNormalMatrix(T.modelViewMatrix),Y.onBeforeRender(E,F,Q,K,T,ve),Y.transparent===!0&&Y.side===zn&&Y.forceSinglePass===!1?(Y.side=gs,Y.needsUpdate=!0,E.renderBufferDirect(Q,F,K,Y,T,ve),Y.side=ri,Y.needsUpdate=!0,E.renderBufferDirect(Q,F,K,Y,T,ve),Y.side=zn):E.renderBufferDirect(Q,F,K,Y,T,ve),T.onAfterRender(E,F,Q,K,Y,ve)}function Nn(T,F,Q){F.isScene!==!0&&(F=xt);const K=Z.get(T),Y=O.state.lights,ve=O.state.shadowsArray,De=Y.state.version,Oe=he.getParameters(T,Y.state,ve,F,Q,O.state.lightProbeGridArray),Ne=he.getProgramCacheKey(Oe);let Re=K.programs;K.environment=T.isMeshStandardMaterial||T.isMeshLambertMaterial||T.isMeshPhongMaterial?F.environment:null,K.fog=F.fog;const ge=T.isMeshStandardMaterial||T.isMeshLambertMaterial&&!T.envMap||T.isMeshPhongMaterial&&!T.envMap;K.envMap=pe.get(T.envMap||K.environment,ge),K.envMapRotation=K.environment!==null&&T.envMap===null?F.environmentRotation:T.envMapRotation,Re===void 0&&(T.addEventListener("dispose",zs),Re=new Map,K.programs=Re);let nt=Re.get(Ne);if(nt!==void 0){if(K.currentProgram===nt&&K.lightsStateVersion===De)return Bn(T,Oe),nt}else Oe.uniforms=he.getUniforms(T),I!==null&&T.isNodeMaterial&&I.build(T,Q,Oe),T.onBeforeCompile(Oe,E),nt=he.acquireProgram(Oe,Ne),Re.set(Ne,nt),K.uniforms=Oe.uniforms;const Ce=K.uniforms;return(!T.isShaderMaterial&&!T.isRawShaderMaterial||T.clipping===!0)&&(Ce.clippingPlanes=Ue.uniform),Bn(T,Oe),K.needsLights=Fr(T),K.lightsStateVersion=De,K.needsLights&&(Ce.ambientLightColor.value=Y.state.ambient,Ce.lightProbe.value=Y.state.probe,Ce.directionalLights.value=Y.state.directional,Ce.directionalLightShadows.value=Y.state.directionalShadow,Ce.spotLights.value=Y.state.spot,Ce.spotLightShadows.value=Y.state.spotShadow,Ce.rectAreaLights.value=Y.state.rectArea,Ce.ltc_1.value=Y.state.rectAreaLTC1,Ce.ltc_2.value=Y.state.rectAreaLTC2,Ce.pointLights.value=Y.state.point,Ce.pointLightShadows.value=Y.state.pointShadow,Ce.hemisphereLights.value=Y.state.hemi,Ce.directionalShadowMatrix.value=Y.state.directionalShadowMatrix,Ce.spotLightMatrix.value=Y.state.spotLightMatrix,Ce.spotLightMap.value=Y.state.spotLightMap,Ce.pointShadowMatrix.value=Y.state.pointShadowMatrix),K.lightProbeGrid=O.state.lightProbeGridArray.length>0,K.currentProgram=nt,K.uniformsList=null,nt}function Vi(T){if(T.uniformsList===null){const F=T.currentProgram.getUniforms();T.uniformsList=Do.seqWithValue(F.seq,T.uniforms)}return T.uniformsList}function Bn(T,F){const Q=Z.get(T);Q.outputColorSpace=F.outputColorSpace,Q.batching=F.batching,Q.batchingColor=F.batchingColor,Q.instancing=F.instancing,Q.instancingColor=F.instancingColor,Q.instancingMorph=F.instancingMorph,Q.skinning=F.skinning,Q.morphTargets=F.morphTargets,Q.morphNormals=F.morphNormals,Q.morphColors=F.morphColors,Q.morphTargetsCount=F.morphTargetsCount,Q.numClippingPlanes=F.numClippingPlanes,Q.numIntersection=F.numClipIntersection,Q.vertexAlphas=F.vertexAlphas,Q.vertexTangents=F.vertexTangents,Q.toneMapping=F.toneMapping}function ci(T,F){if(T.length===0)return null;if(T.length===1)return T[0].texture!==null?T[0]:null;z.setFromMatrixPosition(F.matrixWorld);for(let Q=0,K=T.length;Q<K;Q++){const Y=T[Q];if(Y.texture!==null&&Y.boundingBox.containsPoint(z))return Y}return null}function Tl(T,F,Q,K,Y){F.isScene!==!0&&(F=xt),$.resetTextureUnits();const ve=F.fog,De=K.isMeshStandardMaterial||K.isMeshLambertMaterial||K.isMeshPhongMaterial?F.environment:null,Oe=H===null?E.outputColorSpace:H.isXRRenderTarget===!0?H.texture.colorSpace:mt.workingColorSpace,Ne=K.isMeshStandardMaterial||K.isMeshLambertMaterial&&!K.envMap||K.isMeshPhongMaterial&&!K.envMap,Re=pe.get(K.envMap||De,Ne),ge=K.vertexColors===!0&&!!Q.attributes.color&&Q.attributes.color.itemSize===4,nt=!!Q.attributes.tangent&&(!!K.normalMap||K.anisotropy>0),Ce=!!Q.morphAttributes.position,zt=!!Q.morphAttributes.normal,At=!!Q.morphAttributes.color;let Ve=nn;K.toneMapped&&(H===null||H.isXRRenderTarget===!0)&&(Ve=E.toneMapping);const Mt=Q.morphAttributes.position||Q.morphAttributes.normal||Q.morphAttributes.color,D=Mt!==void 0?Mt.length:0,R=Z.get(K),ee=O.state.lights;if(ut===!0&&(lt===!0||T!==oe)){const bt=T===oe&&K.id===X;Ue.setState(K,T,bt)}let q=!1;K.version===R.__version?(R.needsLights&&R.lightsStateVersion!==ee.state.version||R.outputColorSpace!==Oe||Y.isBatchedMesh&&R.batching===!1||!Y.isBatchedMesh&&R.batching===!0||Y.isBatchedMesh&&R.batchingColor===!0&&Y.colorTexture===null||Y.isBatchedMesh&&R.batchingColor===!1&&Y.colorTexture!==null||Y.isInstancedMesh&&R.instancing===!1||!Y.isInstancedMesh&&R.instancing===!0||Y.isSkinnedMesh&&R.skinning===!1||!Y.isSkinnedMesh&&R.skinning===!0||Y.isInstancedMesh&&R.instancingColor===!0&&Y.instanceColor===null||Y.isInstancedMesh&&R.instancingColor===!1&&Y.instanceColor!==null||Y.isInstancedMesh&&R.instancingMorph===!0&&Y.morphTexture===null||Y.isInstancedMesh&&R.instancingMorph===!1&&Y.morphTexture!==null||R.envMap!==Re||K.fog===!0&&R.fog!==ve||R.numClippingPlanes!==void 0&&(R.numClippingPlanes!==Ue.numPlanes||R.numIntersection!==Ue.numIntersection)||R.vertexAlphas!==ge||R.vertexTangents!==nt||R.morphTargets!==Ce||R.morphNormals!==zt||R.morphColors!==At||R.toneMapping!==Ve||R.morphTargetsCount!==D||!!R.lightProbeGrid!=O.state.lightProbeGridArray.length>0)&&(q=!0):(q=!0,R.__version=K.version);let se=R.currentProgram;q===!0&&(se=Nn(K,F,Y),I&&K.isNodeMaterial&&I.onUpdateProgram(K,se,R));let be=!1,xe=!1,Ke=!1;const tt=se.getUniforms(),ft=R.uniforms;if(x.useProgram(se.program)&&(be=!0,xe=!0,Ke=!0),K.id!==X&&(X=K.id,xe=!0),R.needsLights){const bt=ci(O.state.lightProbeGridArray,Y);R.lightProbeGrid!==bt&&(R.lightProbeGrid=bt,xe=!0)}if(be||oe!==T){x.buffers.depth.getReversed()&&T.reversedDepth!==!0&&(T._reversedDepth=!0,T.updateProjectionMatrix()),tt.setValue(j,"projectionMatrix",T.projectionMatrix),tt.setValue(j,"viewMatrix",T.matrixWorldInverse);const Rt=tt.map.cameraPosition;Rt!==void 0&&Rt.setValue(j,Bt.setFromMatrixPosition(T.matrixWorld)),N.logarithmicDepthBuffer&&tt.setValue(j,"logDepthBufFC",2/(Math.log(T.far+1)/Math.LN2)),(K.isMeshPhongMaterial||K.isMeshToonMaterial||K.isMeshLambertMaterial||K.isMeshBasicMaterial||K.isMeshStandardMaterial||K.isShaderMaterial)&&tt.setValue(j,"isOrthographic",T.isOrthographicCamera===!0),oe!==T&&(oe=T,xe=!0,Ke=!0)}if(R.needsLights&&(ee.state.directionalShadowMap.length>0&&tt.setValue(j,"directionalShadowMap",ee.state.directionalShadowMap,$),ee.state.spotShadowMap.length>0&&tt.setValue(j,"spotShadowMap",ee.state.spotShadowMap,$),ee.state.pointShadowMap.length>0&&tt.setValue(j,"pointShadowMap",ee.state.pointShadowMap,$)),Y.isSkinnedMesh){tt.setOptional(j,Y,"bindMatrix"),tt.setOptional(j,Y,"bindMatrixInverse");const bt=Y.skeleton;bt&&(bt.boneTexture===null&&bt.computeBoneTexture(),tt.setValue(j,"boneTexture",bt.boneTexture,$))}Y.isBatchedMesh&&(tt.setOptional(j,Y,"batchingTexture"),tt.setValue(j,"batchingTexture",Y._matricesTexture,$),tt.setOptional(j,Y,"batchingIdTexture"),tt.setValue(j,"batchingIdTexture",Y._indirectTexture,$),tt.setOptional(j,Y,"batchingColorTexture"),Y._colorsTexture!==null&&tt.setValue(j,"batchingColorTexture",Y._colorsTexture,$));const Zt=Q.morphAttributes;if((Zt.position!==void 0||Zt.normal!==void 0||Zt.color!==void 0)&&U.update(Y,Q,se),(xe||R.receiveShadow!==Y.receiveShadow)&&(R.receiveShadow=Y.receiveShadow,tt.setValue(j,"receiveShadow",Y.receiveShadow)),(K.isMeshStandardMaterial||K.isMeshLambertMaterial||K.isMeshPhongMaterial)&&K.envMap===null&&F.environment!==null&&(ft.envMapIntensity.value=F.environmentIntensity),ft.dfgLUT!==void 0&&(ft.dfgLUT.value=VA()),xe){if(tt.setValue(j,"toneMappingExposure",E.toneMappingExposure),R.needsLights&&Il(ft,Ke),ve&&K.fog===!0&&Te.refreshFogUniforms(ft,ve),Te.refreshMaterialUniforms(ft,K,ue,ae,O.state.transmissionRenderTarget[T.id]),R.needsLights&&R.lightProbeGrid){const bt=R.lightProbeGrid;ft.probesSH.value=bt.texture,ft.probesMin.value.copy(bt.boundingBox.min),ft.probesMax.value.copy(bt.boundingBox.max),ft.probesResolution.value.copy(bt.resolution)}Do.upload(j,Vi(R),ft,$)}if(K.isShaderMaterial&&K.uniformsNeedUpdate===!0&&(Do.upload(j,Vi(R),ft,$),K.uniformsNeedUpdate=!1),K.isSpriteMaterial&&tt.setValue(j,"center",Y.center),tt.setValue(j,"modelViewMatrix",Y.modelViewMatrix),tt.setValue(j,"normalMatrix",Y.normalMatrix),tt.setValue(j,"modelMatrix",Y.matrixWorld),K.uniformsGroups!==void 0){const bt=K.uniformsGroups;for(let Rt=0,Es=bt.length;Rt<Es;Rt++){const Cn=bt[Rt];de.update(Cn,se),de.bind(Cn,se)}}return se}function Il(T,F){T.ambientLightColor.needsUpdate=F,T.lightProbe.needsUpdate=F,T.directionalLights.needsUpdate=F,T.directionalLightShadows.needsUpdate=F,T.pointLights.needsUpdate=F,T.pointLightShadows.needsUpdate=F,T.spotLights.needsUpdate=F,T.spotLightShadows.needsUpdate=F,T.rectAreaLights.needsUpdate=F,T.hemisphereLights.needsUpdate=F}function Fr(T){return T.isMeshLambertMaterial||T.isMeshToonMaterial||T.isMeshPhongMaterial||T.isMeshStandardMaterial||T.isShadowMaterial||T.isShaderMaterial&&T.lights===!0}this.getActiveCubeFace=function(){return P},this.getActiveMipmapLevel=function(){return L},this.getRenderTarget=function(){return H},this.setRenderTargetTextures=function(T,F,Q){const K=Z.get(T);K.__autoAllocateDepthBuffer=T.resolveDepthBuffer===!1,K.__autoAllocateDepthBuffer===!1&&(K.__useRenderToTexture=!1),Z.get(T.texture).__webglTexture=F,Z.get(T.depthTexture).__webglTexture=K.__autoAllocateDepthBuffer?void 0:Q,K.__hasExternalTextures=!0},this.setRenderTargetFramebuffer=function(T,F){const Q=Z.get(T);Q.__webglFramebuffer=F,Q.__useDefaultFramebuffer=F===void 0},this.setRenderTarget=function(T,F=0,Q=0){H=T,P=F,L=Q;let K=null,Y=!1,ve=!1;if(T){const Oe=Z.get(T);if(Oe.__useDefaultFramebuffer!==void 0){x.bindFramebuffer(j.FRAMEBUFFER,Oe.__webglFramebuffer),J.copy(T.viewport),ce.copy(T.scissor),We=T.scissorTest,x.viewport(J),x.scissor(ce),x.setScissorTest(We),X=-1;return}else if(Oe.__webglFramebuffer===void 0)$.setupRenderTarget(T);else if(Oe.__hasExternalTextures)$.rebindTextures(T,Z.get(T.texture).__webglTexture,Z.get(T.depthTexture).__webglTexture);else if(T.depthBuffer){const ge=T.depthTexture;if(Oe.__boundDepthTexture!==ge){if(ge!==null&&Z.has(ge)&&(T.width!==ge.image.width||T.height!==ge.image.height))throw new Error("THREE.WebGLRenderer: Attached DepthTexture is initialized to the incorrect size.");$.setupDepthRenderbuffer(T)}}const Ne=T.texture;(Ne.isData3DTexture||Ne.isDataArrayTexture||Ne.isCompressedArrayTexture)&&(ve=!0);const Re=Z.get(T).__webglFramebuffer;T.isWebGLCubeRenderTarget?(Array.isArray(Re[F])?K=Re[F][Q]:K=Re[F],Y=!0):T.samples>0&&$.useMultisampledRTT(T)===!1?K=Z.get(T).__webglMultisampledFramebuffer:Array.isArray(Re)?K=Re[Q]:K=Re,J.copy(T.viewport),ce.copy(T.scissor),We=T.scissorTest}else J.copy(Fe).multiplyScalar(ue).floor(),ce.copy(Lt).multiplyScalar(ue).floor(),We=ot;if(Q!==0&&(K=G),x.bindFramebuffer(j.FRAMEBUFFER,K)&&x.drawBuffers(T,K),x.viewport(J),x.scissor(ce),x.setScissorTest(We),Y){const Oe=Z.get(T.texture);j.framebufferTexture2D(j.FRAMEBUFFER,j.COLOR_ATTACHMENT0,j.TEXTURE_CUBE_MAP_POSITIVE_X+F,Oe.__webglTexture,Q)}else if(ve){const Oe=F;for(let Ne=0;Ne<T.textures.length;Ne++){const Re=Z.get(T.textures[Ne]);j.framebufferTextureLayer(j.FRAMEBUFFER,j.COLOR_ATTACHMENT0+Ne,Re.__webglTexture,Q,Oe)}}else if(T!==null&&Q!==0){const Oe=Z.get(T.texture);j.framebufferTexture2D(j.FRAMEBUFFER,j.COLOR_ATTACHMENT0,j.TEXTURE_2D,Oe.__webglTexture,Q)}X=-1},this.readRenderTargetPixels=function(T,F,Q,K,Y,ve,De,Oe=0){if(!(T&&T.isWebGLRenderTarget)){pt("WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let Ne=Z.get(T).__webglFramebuffer;if(T.isWebGLCubeRenderTarget&&De!==void 0&&(Ne=Ne[De]),Ne){x.bindFramebuffer(j.FRAMEBUFFER,Ne);try{const Re=T.textures[Oe],ge=Re.format,nt=Re.type;if(T.textures.length>1&&j.readBuffer(j.COLOR_ATTACHMENT0+Oe),!N.textureFormatReadable(ge)){pt("WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}if(!N.textureTypeReadable(nt)){pt("WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}F>=0&&F<=T.width-K&&Q>=0&&Q<=T.height-Y&&j.readPixels(F,Q,K,Y,we.convert(ge),we.convert(nt),ve)}finally{const Re=H!==null?Z.get(H).__webglFramebuffer:null;x.bindFramebuffer(j.FRAMEBUFFER,Re)}}},this.readRenderTargetPixelsAsync=async function(T,F,Q,K,Y,ve,De,Oe=0){if(!(T&&T.isWebGLRenderTarget))throw new Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let Ne=Z.get(T).__webglFramebuffer;if(T.isWebGLCubeRenderTarget&&De!==void 0&&(Ne=Ne[De]),Ne)if(F>=0&&F<=T.width-K&&Q>=0&&Q<=T.height-Y){x.bindFramebuffer(j.FRAMEBUFFER,Ne);const Re=T.textures[Oe],ge=Re.format,nt=Re.type;if(T.textures.length>1&&j.readBuffer(j.COLOR_ATTACHMENT0+Oe),!N.textureFormatReadable(ge))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(!N.textureTypeReadable(nt))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");const Ce=j.createBuffer();j.bindBuffer(j.PIXEL_PACK_BUFFER,Ce),j.bufferData(j.PIXEL_PACK_BUFFER,ve.byteLength,j.STREAM_READ),j.readPixels(F,Q,K,Y,we.convert(ge),we.convert(nt),0);const zt=H!==null?Z.get(H).__webglFramebuffer:null;x.bindFramebuffer(j.FRAMEBUFFER,zt);const At=j.fenceSync(j.SYNC_GPU_COMMANDS_COMPLETE,0);return j.flush(),await aO(j,At,4),j.bindBuffer(j.PIXEL_PACK_BUFFER,Ce),j.getBufferSubData(j.PIXEL_PACK_BUFFER,0,ve),j.deleteBuffer(Ce),j.deleteSync(At),ve}else throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.")},this.copyFramebufferToTexture=function(T,F=null,Q=0){const K=Math.pow(2,-Q),Y=Math.floor(T.image.width*K),ve=Math.floor(T.image.height*K),De=F!==null?F.x:0,Oe=F!==null?F.y:0;$.setTexture2D(T,0),j.copyTexSubImage2D(j.TEXTURE_2D,Q,0,0,De,Oe,Y,ve),x.unbindTexture()},this.copyTextureToTexture=function(T,F,Q=null,K=null,Y=0,ve=0){let De,Oe,Ne,Re,ge,nt,Ce,zt,At;const Ve=T.isCompressedTexture?T.mipmaps[ve]:T.image;if(Q!==null)De=Q.max.x-Q.min.x,Oe=Q.max.y-Q.min.y,Ne=Q.isBox3?Q.max.z-Q.min.z:1,Re=Q.min.x,ge=Q.min.y,nt=Q.isBox3?Q.min.z:0;else{const ft=Math.pow(2,-Y);De=Math.floor(Ve.width*ft),Oe=Math.floor(Ve.height*ft),T.isDataArrayTexture?Ne=Ve.depth:T.isData3DTexture?Ne=Math.floor(Ve.depth*ft):Ne=1,Re=0,ge=0,nt=0}K!==null?(Ce=K.x,zt=K.y,At=K.z):(Ce=0,zt=0,At=0);const Mt=we.convert(F.format),D=we.convert(F.type);let R;F.isData3DTexture?($.setTexture3D(F,0),R=j.TEXTURE_3D):F.isDataArrayTexture||F.isCompressedArrayTexture?($.setTexture2DArray(F,0),R=j.TEXTURE_2D_ARRAY):($.setTexture2D(F,0),R=j.TEXTURE_2D),x.activeTexture(j.TEXTURE0),x.pixelStorei(j.UNPACK_FLIP_Y_WEBGL,F.flipY),x.pixelStorei(j.UNPACK_PREMULTIPLY_ALPHA_WEBGL,F.premultiplyAlpha),x.pixelStorei(j.UNPACK_ALIGNMENT,F.unpackAlignment);const ee=x.getParameter(j.UNPACK_ROW_LENGTH),q=x.getParameter(j.UNPACK_IMAGE_HEIGHT),se=x.getParameter(j.UNPACK_SKIP_PIXELS),be=x.getParameter(j.UNPACK_SKIP_ROWS),xe=x.getParameter(j.UNPACK_SKIP_IMAGES);x.pixelStorei(j.UNPACK_ROW_LENGTH,Ve.width),x.pixelStorei(j.UNPACK_IMAGE_HEIGHT,Ve.height),x.pixelStorei(j.UNPACK_SKIP_PIXELS,Re),x.pixelStorei(j.UNPACK_SKIP_ROWS,ge),x.pixelStorei(j.UNPACK_SKIP_IMAGES,nt);const Ke=T.isDataArrayTexture||T.isData3DTexture,tt=F.isDataArrayTexture||F.isData3DTexture;if(T.isDepthTexture){const ft=Z.get(T),Zt=Z.get(F),bt=Z.get(ft.__renderTarget),Rt=Z.get(Zt.__renderTarget);x.bindFramebuffer(j.READ_FRAMEBUFFER,bt.__webglFramebuffer),x.bindFramebuffer(j.DRAW_FRAMEBUFFER,Rt.__webglFramebuffer);for(let Es=0;Es<Ne;Es++)Ke&&(j.framebufferTextureLayer(j.READ_FRAMEBUFFER,j.COLOR_ATTACHMENT0,Z.get(T).__webglTexture,Y,nt+Es),j.framebufferTextureLayer(j.DRAW_FRAMEBUFFER,j.COLOR_ATTACHMENT0,Z.get(F).__webglTexture,ve,At+Es)),j.blitFramebuffer(Re,ge,De,Oe,Ce,zt,De,Oe,j.DEPTH_BUFFER_BIT,j.NEAREST);x.bindFramebuffer(j.READ_FRAMEBUFFER,null),x.bindFramebuffer(j.DRAW_FRAMEBUFFER,null)}else if(Y!==0||T.isRenderTargetTexture||Z.has(T)){const ft=Z.get(T),Zt=Z.get(F);x.bindFramebuffer(j.READ_FRAMEBUFFER,C),x.bindFramebuffer(j.DRAW_FRAMEBUFFER,B);for(let bt=0;bt<Ne;bt++)Ke?j.framebufferTextureLayer(j.READ_FRAMEBUFFER,j.COLOR_ATTACHMENT0,ft.__webglTexture,Y,nt+bt):j.framebufferTexture2D(j.READ_FRAMEBUFFER,j.COLOR_ATTACHMENT0,j.TEXTURE_2D,ft.__webglTexture,Y),tt?j.framebufferTextureLayer(j.DRAW_FRAMEBUFFER,j.COLOR_ATTACHMENT0,Zt.__webglTexture,ve,At+bt):j.framebufferTexture2D(j.DRAW_FRAMEBUFFER,j.COLOR_ATTACHMENT0,j.TEXTURE_2D,Zt.__webglTexture,ve),Y!==0?j.blitFramebuffer(Re,ge,De,Oe,Ce,zt,De,Oe,j.COLOR_BUFFER_BIT,j.NEAREST):tt?j.copyTexSubImage3D(R,ve,Ce,zt,At+bt,Re,ge,De,Oe):j.copyTexSubImage2D(R,ve,Ce,zt,Re,ge,De,Oe);x.bindFramebuffer(j.READ_FRAMEBUFFER,null),x.bindFramebuffer(j.DRAW_FRAMEBUFFER,null)}else tt?T.isDataTexture||T.isData3DTexture?j.texSubImage3D(R,ve,Ce,zt,At,De,Oe,Ne,Mt,D,Ve.data):F.isCompressedArrayTexture?j.compressedTexSubImage3D(R,ve,Ce,zt,At,De,Oe,Ne,Mt,Ve.data):j.texSubImage3D(R,ve,Ce,zt,At,De,Oe,Ne,Mt,D,Ve):T.isDataTexture?j.texSubImage2D(j.TEXTURE_2D,ve,Ce,zt,De,Oe,Mt,D,Ve.data):T.isCompressedTexture?j.compressedTexSubImage2D(j.TEXTURE_2D,ve,Ce,zt,Ve.width,Ve.height,Mt,Ve.data):j.texSubImage2D(j.TEXTURE_2D,ve,Ce,zt,De,Oe,Mt,D,Ve);x.pixelStorei(j.UNPACK_ROW_LENGTH,ee),x.pixelStorei(j.UNPACK_IMAGE_HEIGHT,q),x.pixelStorei(j.UNPACK_SKIP_PIXELS,se),x.pixelStorei(j.UNPACK_SKIP_ROWS,be),x.pixelStorei(j.UNPACK_SKIP_IMAGES,xe),ve===0&&F.generateMipmaps&&j.generateMipmap(R),x.unbindTexture()},this.initRenderTarget=function(T){Z.get(T).__webglFramebuffer===void 0&&$.setupRenderTarget(T)},this.initTexture=function(T){T.isCubeTexture?$.setTextureCube(T,0):T.isData3DTexture?$.setTexture3D(T,0):T.isDataArrayTexture||T.isCompressedArrayTexture?$.setTexture2DArray(T,0):$.setTexture2D(T,0),x.unbindTexture()},this.resetState=function(){P=0,L=0,H=null,x.reset(),Ee.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return tn}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(e){this._outputColorSpace=e;const t=this.getContext();t.drawingBufferColorSpace=mt._getDrawingBufferColorSpace(e),t.unpackColorSpace=mt._getUnpackColorSpace()}}const To=.16,Tp=.09,ru=.1,Ip=.2,vn=450,js=1200,Io=1800,qA=7,XA=5,KA=300,Gp=.18,fo=1e3,YA=9,ZA=500,Rp=new ke("#ffffff"),Np=new Map;function Br(n,e){if("token"in n)return e[n.token];if("hue"in n){let i=Np.get(n.hue);return i===void 0&&(i=new ke(n.hue),Np.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 Ec(n){return 1.6+.45*Math.sqrt(Math.max(1,n))}function QA(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 W(Math.cos(a)*r*t,i*t,Math.sin(a)*r*t)}class JA{byKey=new Map;of(e){const t=Math.round(e*1e3);let s=this.byKey.get(t);return s===void 0&&(s=new xl(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 eD=2,tD=28,MM=1.8,sD=`
4139
+ }`;class WA{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(e,t){if(this.texture===null){const s=new rM(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 jt({vertexShader:PA,fragmentShader:LA,uniforms:{depthColor:{value:this.texture},depthWidth:{value:t.z},depthHeight:{value:t.w}}});this.mesh=new Ms(new Ol(20,20),s)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}}class kA extends Ui{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,p=null,f=null;const M=typeof XRWebGLBinding<"u",g=new WA,m={},_=t.getContextAttributes();let w=null,z=null;const y=[],O=[],S=new et;let b=null;const v=new Rs;v.viewport=new Wt;const E=new Rs;E.viewport=new Wt;const A=[v,E],I=new KO;let G=null,C=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(ne){let ae=y[ne];return ae===void 0&&(ae=new tc,y[ne]=ae),ae.getTargetRaySpace()},this.getControllerGrip=function(ne){let ae=y[ne];return ae===void 0&&(ae=new tc,y[ne]=ae),ae.getGripSpace()},this.getHand=function(ne){let ae=y[ne];return ae===void 0&&(ae=new tc,y[ne]=ae),ae.getHandSpace()};function B(ne){const ae=O.indexOf(ne.inputSource);if(ae===-1)return;const ue=y[ae];ue!==void 0&&(ue.update(ne.inputSource,ne.frame,c||a),ue.dispatchEvent({type:ne.type,data:ne.inputSource}))}function P(){i.removeEventListener("select",B),i.removeEventListener("selectstart",B),i.removeEventListener("selectend",B),i.removeEventListener("squeeze",B),i.removeEventListener("squeezestart",B),i.removeEventListener("squeezeend",B),i.removeEventListener("end",P),i.removeEventListener("inputsourceschange",W);for(let ne=0;ne<y.length;ne++){const ae=O[ne];ae!==null&&(O[ne]=null,y[ne].disconnect(ae))}G=null,C=null,g.reset();for(const ne in m)delete m[ne];e.setRenderTarget(w),p=null,h=null,u=null,i=null,z=null,Pe.stop(),s.isPresenting=!1,e.setPixelRatio(b),e.setSize(S.width,S.height,!1),s.dispatchEvent({type:"sessionend"})}this.setFramebufferScaleFactor=function(ne){r=ne,s.isPresenting===!0&&He("WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(ne){o=ne,s.isPresenting===!0&&He("WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return c||a},this.setReferenceSpace=function(ne){c=ne},this.getBaseLayer=function(){return h!==null?h:p},this.getBinding=function(){return u===null&&M&&(u=new XRWebGLBinding(i,t)),u},this.getFrame=function(){return f},this.getSession=function(){return i},this.setSession=async function(ne){if(i=ne,i!==null){if(w=e.getRenderTarget(),i.addEventListener("select",B),i.addEventListener("selectstart",B),i.addEventListener("selectend",B),i.addEventListener("squeeze",B),i.addEventListener("squeezestart",B),i.addEventListener("squeezeend",B),i.addEventListener("end",P),i.addEventListener("inputsourceschange",W),_.xrCompatible!==!0&&await t.makeXRCompatible(),b=e.getPixelRatio(),e.getSize(S),M&&"createProjectionLayer"in XRWebGLBinding.prototype){let ue=null,Xe=null,Ze=null;_.depth&&(Ze=_.stencil?t.DEPTH24_STENCIL8:t.DEPTH_COMPONENT24,ue=_.stencil?vi:Tn,Xe=_.stencil?va:on);const Fe={colorFormat:t.RGBA8,depthFormat:Ze,scaleFactor:r};u=this.getBinding(),h=u.createProjectionLayer(Fe),i.updateRenderState({layers:[h]}),e.setPixelRatio(1),e.setSize(h.textureWidth,h.textureHeight,!1),z=new rn(h.textureWidth,h.textureHeight,{format:Vs,type:Ss,depthTexture:new Rr(h.textureWidth,h.textureHeight,Xe,void 0,void 0,void 0,void 0,void 0,void 0,ue),stencilBuffer:_.stencil,colorSpace:e.outputColorSpace,samples:_.antialias?4:0,resolveDepthBuffer:h.ignoreDepthValues===!1,resolveStencilBuffer:h.ignoreDepthValues===!1})}else{const ue={antialias:_.antialias,alpha:!0,depth:_.depth,stencil:_.stencil,framebufferScaleFactor:r};p=new XRWebGLLayer(i,t,ue),i.updateRenderState({baseLayer:p}),e.setPixelRatio(1),e.setSize(p.framebufferWidth,p.framebufferHeight,!1),z=new rn(p.framebufferWidth,p.framebufferHeight,{format:Vs,type:Ss,colorSpace:e.outputColorSpace,stencilBuffer:_.stencil,resolveDepthBuffer:p.ignoreDepthValues===!1,resolveStencilBuffer:p.ignoreDepthValues===!1})}z.isXRRenderTarget=!0,this.setFoveation(l),c=null,a=await i.requestReferenceSpace(o),Pe.setContext(i),Pe.start(),s.isPresenting=!0,s.dispatchEvent({type:"sessionstart"})}},this.getEnvironmentBlendMode=function(){if(i!==null)return i.environmentBlendMode},this.getDepthTexture=function(){return g.getDepthTexture()};function W(ne){for(let ae=0;ae<ne.removed.length;ae++){const ue=ne.removed[ae],Xe=O.indexOf(ue);Xe>=0&&(O[Xe]=null,y[Xe].disconnect(ue))}for(let ae=0;ae<ne.added.length;ae++){const ue=ne.added[ae];let Xe=O.indexOf(ue);if(Xe===-1){for(let Fe=0;Fe<y.length;Fe++)if(Fe>=O.length){O.push(ue),Xe=Fe;break}else if(O[Fe]===null){O[Fe]=ue,Xe=Fe;break}if(Xe===-1)break}const Ze=y[Xe];Ze&&Ze.connect(ue)}}const H=new k,X=new k;function oe(ne,ae,ue){H.setFromMatrixPosition(ae.matrixWorld),X.setFromMatrixPosition(ue.matrixWorld);const Xe=H.distanceTo(X),Ze=ae.projectionMatrix.elements,Fe=ue.projectionMatrix.elements,Lt=Ze[14]/(Ze[10]-1),ot=Ze[14]/(Ze[10]+1),yt=(Ze[9]+1)/Ze[5],ut=(Ze[9]-1)/Ze[5],lt=(Ze[8]-1)/Ze[0],Gt=(Fe[8]+1)/Fe[0],Bt=Lt*lt,$t=Lt*Gt,xt=Xe/(-lt+Gt),Ct=xt*-lt;if(ae.matrixWorld.decompose(ne.position,ne.quaternion,ne.scale),ne.translateX(Ct),ne.translateZ(xt),ne.matrixWorld.compose(ne.position,ne.quaternion,ne.scale),ne.matrixWorldInverse.copy(ne.matrixWorld).invert(),Ze[10]===-1)ne.projectionMatrix.copy(ae.projectionMatrix),ne.projectionMatrixInverse.copy(ae.projectionMatrixInverse);else{const Pt=Lt+xt,j=ot+xt,Ft=Bt-Ct,vt=$t+(Xe-Ct),N=yt*ot/j*Pt,x=ut*ot/j*Pt;ne.projectionMatrix.makePerspective(Ft,vt,N,x,Pt,j),ne.projectionMatrixInverse.copy(ne.projectionMatrix).invert()}}function J(ne,ae){ae===null?ne.matrixWorld.copy(ne.matrix):ne.matrixWorld.multiplyMatrices(ae.matrixWorld,ne.matrix),ne.matrixWorldInverse.copy(ne.matrixWorld).invert()}this.updateCamera=function(ne){if(i===null)return;let ae=ne.near,ue=ne.far;g.texture!==null&&(g.depthNear>0&&(ae=g.depthNear),g.depthFar>0&&(ue=g.depthFar)),I.near=E.near=v.near=ae,I.far=E.far=v.far=ue,(G!==I.near||C!==I.far)&&(i.updateRenderState({depthNear:I.near,depthFar:I.far}),G=I.near,C=I.far),I.layers.mask=ne.layers.mask|6,v.layers.mask=I.layers.mask&-5,E.layers.mask=I.layers.mask&-3;const Xe=ne.parent,Ze=I.cameras;J(I,Xe);for(let Fe=0;Fe<Ze.length;Fe++)J(Ze[Fe],Xe);Ze.length===2?oe(I,v,E):I.projectionMatrix.copy(v.projectionMatrix),ce(ne,I,Xe)};function ce(ne,ae,ue){ue===null?ne.matrix.copy(ae.matrixWorld):(ne.matrix.copy(ue.matrixWorld),ne.matrix.invert(),ne.matrix.multiply(ae.matrixWorld)),ne.matrix.decompose(ne.position,ne.quaternion,ne.scale),ne.updateMatrixWorld(!0),ne.projectionMatrix.copy(ae.projectionMatrix),ne.projectionMatrixInverse.copy(ae.projectionMatrixInverse),ne.isPerspectiveCamera&&(ne.fov=Qd*2*Math.atan(1/ne.projectionMatrix.elements[5]),ne.zoom=1)}this.getCamera=function(){return I},this.getFoveation=function(){if(!(h===null&&p===null))return l},this.setFoveation=function(ne){l=ne,h!==null&&(h.fixedFoveation=ne),p!==null&&p.fixedFoveation!==void 0&&(p.fixedFoveation=ne)},this.hasDepthSensing=function(){return g.texture!==null},this.getDepthSensingMesh=function(){return g.getMesh(I)},this.getCameraTexture=function(ne){return m[ne]};let We=null;function qe(ne,ae){if(d=ae.getViewerPose(c||a),f=ae,d!==null){const ue=d.views;p!==null&&(e.setRenderTargetFramebuffer(z,p.framebuffer),e.setRenderTarget(z));let Xe=!1;ue.length!==I.cameras.length&&(I.cameras.length=0,Xe=!0);for(let ot=0;ot<ue.length;ot++){const yt=ue[ot];let ut=null;if(p!==null)ut=p.getViewport(yt);else{const Gt=u.getViewSubImage(h,yt);ut=Gt.viewport,ot===0&&(e.setRenderTargetTextures(z,Gt.colorTexture,Gt.depthStencilTexture),e.setRenderTarget(z))}let lt=A[ot];lt===void 0&&(lt=new Rs,lt.layers.enable(ot),lt.viewport=new Wt,A[ot]=lt),lt.matrix.fromArray(yt.transform.matrix),lt.matrix.decompose(lt.position,lt.quaternion,lt.scale),lt.projectionMatrix.fromArray(yt.projectionMatrix),lt.projectionMatrixInverse.copy(lt.projectionMatrix).invert(),lt.viewport.set(ut.x,ut.y,ut.width,ut.height),ot===0&&(I.matrix.copy(lt.matrix),I.matrix.decompose(I.position,I.quaternion,I.scale)),Xe===!0&&I.cameras.push(lt)}const Ze=i.enabledFeatures;if(Ze&&Ze.includes("depth-sensing")&&i.depthUsage=="gpu-optimized"&&M){u=s.getBinding();const ot=u.getDepthInformation(ue[0]);ot&&ot.isValid&&ot.texture&&g.init(ot,i.renderState)}if(Ze&&Ze.includes("camera-access")&&M){e.state.unbindTexture(),u=s.getBinding();for(let ot=0;ot<ue.length;ot++){const yt=ue[ot].camera;if(yt){let ut=m[yt];ut||(ut=new rM,m[yt]=ut);const lt=u.getCameraImage(yt);ut.sourceTexture=lt}}}}for(let ue=0;ue<y.length;ue++){const Xe=O[ue],Ze=y[ue];Xe!==null&&Ze!==void 0&&Ze.update(Xe,ae,c||a)}We&&We(ne,ae),ae.detectedPlanes&&s.dispatchEvent({type:"planesdetected",data:ae}),f=null}const Pe=new cM;Pe.setAnimationLoop(qe),this.setAnimationLoop=function(ne){We=ne},this.dispose=function(){}}}const UA=new wt,gM=new st;gM.set(-1,0,0,0,1,0,0,0,1);function FA(n,e){function t(g,m){g.matrixAutoUpdate===!0&&g.updateMatrix(),m.value.copy(g.matrix)}function s(g,m){m.color.getRGB(g.fogColor.value,aM(n)),m.isFog?(g.fogNear.value=m.near,g.fogFar.value=m.far):m.isFogExp2&&(g.fogDensity.value=m.density)}function i(g,m,_,w,z){m.isNodeMaterial?m.uniformsNeedUpdate=!1:m.isMeshBasicMaterial?r(g,m):m.isMeshLambertMaterial?(r(g,m),m.envMap&&(g.envMapIntensity.value=m.envMapIntensity)):m.isMeshToonMaterial?(r(g,m),u(g,m)):m.isMeshPhongMaterial?(r(g,m),d(g,m),m.envMap&&(g.envMapIntensity.value=m.envMapIntensity)):m.isMeshStandardMaterial?(r(g,m),h(g,m),m.isMeshPhysicalMaterial&&p(g,m,z)):m.isMeshMatcapMaterial?(r(g,m),f(g,m)):m.isMeshDepthMaterial?r(g,m):m.isMeshDistanceMaterial?(r(g,m),M(g,m)):m.isMeshNormalMaterial?r(g,m):m.isLineBasicMaterial?(a(g,m),m.isLineDashedMaterial&&o(g,m)):m.isPointsMaterial?l(g,m,_,w):m.isSpriteMaterial?c(g,m):m.isShadowMaterial?(g.color.value.copy(m.color),g.opacity.value=m.opacity):m.isShaderMaterial&&(m.uniformsNeedUpdate=!1)}function r(g,m){g.opacity.value=m.opacity,m.color&&g.diffuse.value.copy(m.color),m.emissive&&g.emissive.value.copy(m.emissive).multiplyScalar(m.emissiveIntensity),m.map&&(g.map.value=m.map,t(m.map,g.mapTransform)),m.alphaMap&&(g.alphaMap.value=m.alphaMap,t(m.alphaMap,g.alphaMapTransform)),m.bumpMap&&(g.bumpMap.value=m.bumpMap,t(m.bumpMap,g.bumpMapTransform),g.bumpScale.value=m.bumpScale,m.side===gs&&(g.bumpScale.value*=-1)),m.normalMap&&(g.normalMap.value=m.normalMap,t(m.normalMap,g.normalMapTransform),g.normalScale.value.copy(m.normalScale),m.side===gs&&g.normalScale.value.negate()),m.displacementMap&&(g.displacementMap.value=m.displacementMap,t(m.displacementMap,g.displacementMapTransform),g.displacementScale.value=m.displacementScale,g.displacementBias.value=m.displacementBias),m.emissiveMap&&(g.emissiveMap.value=m.emissiveMap,t(m.emissiveMap,g.emissiveMapTransform)),m.specularMap&&(g.specularMap.value=m.specularMap,t(m.specularMap,g.specularMapTransform)),m.alphaTest>0&&(g.alphaTest.value=m.alphaTest);const _=e.get(m),w=_.envMap,z=_.envMapRotation;w&&(g.envMap.value=w,g.envMapRotation.value.setFromMatrix4(UA.makeRotationFromEuler(z)).transpose(),w.isCubeTexture&&w.isRenderTargetTexture===!1&&g.envMapRotation.value.premultiply(gM),g.reflectivity.value=m.reflectivity,g.ior.value=m.ior,g.refractionRatio.value=m.refractionRatio),m.lightMap&&(g.lightMap.value=m.lightMap,g.lightMapIntensity.value=m.lightMapIntensity,t(m.lightMap,g.lightMapTransform)),m.aoMap&&(g.aoMap.value=m.aoMap,g.aoMapIntensity.value=m.aoMapIntensity,t(m.aoMap,g.aoMapTransform))}function a(g,m){g.diffuse.value.copy(m.color),g.opacity.value=m.opacity,m.map&&(g.map.value=m.map,t(m.map,g.mapTransform))}function o(g,m){g.dashSize.value=m.dashSize,g.totalSize.value=m.dashSize+m.gapSize,g.scale.value=m.scale}function l(g,m,_,w){g.diffuse.value.copy(m.color),g.opacity.value=m.opacity,g.size.value=m.size*_,g.scale.value=w*.5,m.map&&(g.map.value=m.map,t(m.map,g.uvTransform)),m.alphaMap&&(g.alphaMap.value=m.alphaMap,t(m.alphaMap,g.alphaMapTransform)),m.alphaTest>0&&(g.alphaTest.value=m.alphaTest)}function c(g,m){g.diffuse.value.copy(m.color),g.opacity.value=m.opacity,g.rotation.value=m.rotation,m.map&&(g.map.value=m.map,t(m.map,g.mapTransform)),m.alphaMap&&(g.alphaMap.value=m.alphaMap,t(m.alphaMap,g.alphaMapTransform)),m.alphaTest>0&&(g.alphaTest.value=m.alphaTest)}function d(g,m){g.specular.value.copy(m.specular),g.shininess.value=Math.max(m.shininess,1e-4)}function u(g,m){m.gradientMap&&(g.gradientMap.value=m.gradientMap)}function h(g,m){g.metalness.value=m.metalness,m.metalnessMap&&(g.metalnessMap.value=m.metalnessMap,t(m.metalnessMap,g.metalnessMapTransform)),g.roughness.value=m.roughness,m.roughnessMap&&(g.roughnessMap.value=m.roughnessMap,t(m.roughnessMap,g.roughnessMapTransform)),m.envMap&&(g.envMapIntensity.value=m.envMapIntensity)}function p(g,m,_){g.ior.value=m.ior,m.sheen>0&&(g.sheenColor.value.copy(m.sheenColor).multiplyScalar(m.sheen),g.sheenRoughness.value=m.sheenRoughness,m.sheenColorMap&&(g.sheenColorMap.value=m.sheenColorMap,t(m.sheenColorMap,g.sheenColorMapTransform)),m.sheenRoughnessMap&&(g.sheenRoughnessMap.value=m.sheenRoughnessMap,t(m.sheenRoughnessMap,g.sheenRoughnessMapTransform))),m.clearcoat>0&&(g.clearcoat.value=m.clearcoat,g.clearcoatRoughness.value=m.clearcoatRoughness,m.clearcoatMap&&(g.clearcoatMap.value=m.clearcoatMap,t(m.clearcoatMap,g.clearcoatMapTransform)),m.clearcoatRoughnessMap&&(g.clearcoatRoughnessMap.value=m.clearcoatRoughnessMap,t(m.clearcoatRoughnessMap,g.clearcoatRoughnessMapTransform)),m.clearcoatNormalMap&&(g.clearcoatNormalMap.value=m.clearcoatNormalMap,t(m.clearcoatNormalMap,g.clearcoatNormalMapTransform),g.clearcoatNormalScale.value.copy(m.clearcoatNormalScale),m.side===gs&&g.clearcoatNormalScale.value.negate())),m.dispersion>0&&(g.dispersion.value=m.dispersion),m.iridescence>0&&(g.iridescence.value=m.iridescence,g.iridescenceIOR.value=m.iridescenceIOR,g.iridescenceThicknessMinimum.value=m.iridescenceThicknessRange[0],g.iridescenceThicknessMaximum.value=m.iridescenceThicknessRange[1],m.iridescenceMap&&(g.iridescenceMap.value=m.iridescenceMap,t(m.iridescenceMap,g.iridescenceMapTransform)),m.iridescenceThicknessMap&&(g.iridescenceThicknessMap.value=m.iridescenceThicknessMap,t(m.iridescenceThicknessMap,g.iridescenceThicknessMapTransform))),m.transmission>0&&(g.transmission.value=m.transmission,g.transmissionSamplerMap.value=_.texture,g.transmissionSamplerSize.value.set(_.width,_.height),m.transmissionMap&&(g.transmissionMap.value=m.transmissionMap,t(m.transmissionMap,g.transmissionMapTransform)),g.thickness.value=m.thickness,m.thicknessMap&&(g.thicknessMap.value=m.thicknessMap,t(m.thicknessMap,g.thicknessMapTransform)),g.attenuationDistance.value=m.attenuationDistance,g.attenuationColor.value.copy(m.attenuationColor)),m.anisotropy>0&&(g.anisotropyVector.value.set(m.anisotropy*Math.cos(m.anisotropyRotation),m.anisotropy*Math.sin(m.anisotropyRotation)),m.anisotropyMap&&(g.anisotropyMap.value=m.anisotropyMap,t(m.anisotropyMap,g.anisotropyMapTransform))),g.specularIntensity.value=m.specularIntensity,g.specularColor.value.copy(m.specularColor),m.specularColorMap&&(g.specularColorMap.value=m.specularColorMap,t(m.specularColorMap,g.specularColorMapTransform)),m.specularIntensityMap&&(g.specularIntensityMap.value=m.specularIntensityMap,t(m.specularIntensityMap,g.specularIntensityMapTransform))}function f(g,m){m.matcap&&(g.matcap.value=m.matcap)}function M(g,m){const _=e.get(m).light;g.referencePosition.value.setFromMatrixPosition(_.matrixWorld),g.nearDistance.value=_.shadow.camera.near,g.farDistance.value=_.shadow.camera.far}return{refreshFogUniforms:s,refreshMaterialUniforms:i}}function jA(n,e,t,s){let i={},r={},a=[];const o=n.getParameter(n.MAX_UNIFORM_BUFFER_BINDINGS);function l(z,y){const O=y.program;s.uniformBlockBinding(z,O)}function c(z,y){let O=i[z.id];O===void 0&&(g(z),O=d(z),i[z.id]=O,z.addEventListener("dispose",_));const S=y.program;s.updateUBOMapping(z,S);const b=e.render.frame;r[z.id]!==b&&(h(z),r[z.id]=b)}function d(z){const y=u();z.__bindingPointIndex=y;const O=n.createBuffer(),S=z.__size,b=z.usage;return n.bindBuffer(n.UNIFORM_BUFFER,O),n.bufferData(n.UNIFORM_BUFFER,S,b),n.bindBuffer(n.UNIFORM_BUFFER,null),n.bindBufferBase(n.UNIFORM_BUFFER,y,O),O}function u(){for(let z=0;z<o;z++)if(a.indexOf(z)===-1)return a.push(z),z;return pt("WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}function h(z){const y=i[z.id],O=z.uniforms,S=z.__cache;n.bindBuffer(n.UNIFORM_BUFFER,y);for(let b=0,v=O.length;b<v;b++){const E=O[b];if(Array.isArray(E))for(let A=0,I=E.length;A<I;A++)p(E[A],b,A,S);else p(E,b,0,S)}n.bindBuffer(n.UNIFORM_BUFFER,null)}function p(z,y,O,S){if(M(z,y,O,S)===!0){const b=z.__offset,v=z.value;if(Array.isArray(v)){let E=0;for(let A=0;A<v.length;A++){const I=v[A],G=m(I);f(I,z.__data,E),typeof I!="number"&&typeof I!="boolean"&&!I.isMatrix3&&!ArrayBuffer.isView(I)&&(E+=G.storage/Float32Array.BYTES_PER_ELEMENT)}}else f(v,z.__data,0);n.bufferSubData(n.UNIFORM_BUFFER,b,z.__data)}}function f(z,y,O){typeof z=="number"||typeof z=="boolean"?y[0]=z:z.isMatrix3?(y[0]=z.elements[0],y[1]=z.elements[1],y[2]=z.elements[2],y[3]=0,y[4]=z.elements[3],y[5]=z.elements[4],y[6]=z.elements[5],y[7]=0,y[8]=z.elements[6],y[9]=z.elements[7],y[10]=z.elements[8],y[11]=0):ArrayBuffer.isView(z)?y.set(new z.constructor(z.buffer,z.byteOffset,y.length)):z.toArray(y,O)}function M(z,y,O,S){const b=z.value,v=y+"_"+O;if(S[v]===void 0)return typeof b=="number"||typeof b=="boolean"?S[v]=b:ArrayBuffer.isView(b)?S[v]=b.slice():S[v]=b.clone(),!0;{const E=S[v];if(typeof b=="number"||typeof b=="boolean"){if(E!==b)return S[v]=b,!0}else{if(ArrayBuffer.isView(b))return!0;if(E.equals(b)===!1)return E.copy(b),!0}}return!1}function g(z){const y=z.uniforms;let O=0;const S=16;for(let v=0,E=y.length;v<E;v++){const A=Array.isArray(y[v])?y[v]:[y[v]];for(let I=0,G=A.length;I<G;I++){const C=A[I],B=Array.isArray(C.value)?C.value:[C.value];for(let P=0,W=B.length;P<W;P++){const H=B[P],X=m(H),oe=O%S,J=oe%X.boundary,ce=oe+J;O+=J,ce!==0&&S-ce<X.storage&&(O+=S-ce),C.__data=new Float32Array(X.storage/Float32Array.BYTES_PER_ELEMENT),C.__offset=O,O+=X.storage}}}const b=O%S;return b>0&&(O+=S-b),z.__size=O,z.__cache={},this}function m(z){const y={boundary:0,storage:0};return typeof z=="number"||typeof z=="boolean"?(y.boundary=4,y.storage=4):z.isVector2?(y.boundary=8,y.storage=8):z.isVector3||z.isColor?(y.boundary=16,y.storage=12):z.isVector4?(y.boundary=16,y.storage=16):z.isMatrix3?(y.boundary=48,y.storage=48):z.isMatrix4?(y.boundary=64,y.storage=64):z.isTexture?He("WebGLRenderer: Texture samplers can not be part of an uniforms group."):ArrayBuffer.isView(z)?(y.boundary=16,y.storage=z.byteLength):He("WebGLRenderer: Unsupported uniform value type.",z),y}function _(z){const y=z.target;y.removeEventListener("dispose",_);const O=a.indexOf(y.__bindingPointIndex);a.splice(O,1),n.deleteBuffer(i[y.id]),delete i[y.id],delete r[y.id]}function w(){for(const z in i)n.deleteBuffer(i[z]);a=[],i={},r={}}return{bind:l,update:c,dispose:w}}const $A=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 Ks=null;function VA(){return Ks===null&&(Ks=new sM($A,16,16,Wi,Dn),Ks.name="DFG_LUT",Ks.minFilter=os,Ks.magFilter=os,Ks.wrapS=yn,Ks.wrapT=yn,Ks.generateMipmaps=!1,Ks.needsUpdate=!0),Ks}class HA{constructor(e={}){const{canvas:t=rO(),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:p=Ss}=e;this.isWebGLRenderer=!0;let f;if(s!==null){if(typeof WebGLRenderingContext<"u"&&s instanceof WebGLRenderingContext)throw new Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");f=s.getContextAttributes().alpha}else f=a;const M=p,g=new Set([Fu,Uu,ku]),m=new Set([Ss,on,ya,va,Pu,Lu]),_=new Uint32Array(4),w=new Int32Array(4),z=new k;let y=null,O=null;const S=[],b=[];let v=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=nn,this.toneMappingExposure=1,this.transmissionResolutionScale=1;const E=this;let A=!1,I=null,G=null,C=null,B=null;this._outputColorSpace=Is;let P=0,W=0,H=null,X=-1,oe=null;const J=new Wt,ce=new Wt;let We=null;const qe=new ke(0);let Pe=0,ne=t.width,ae=t.height,ue=1,Xe=null,Ze=null;const Fe=new Wt(0,0,ne,ae),Lt=new Wt(0,0,ne,ae);let ot=!1;const yt=new Yu;let ut=!1,lt=!1;const Gt=new wt,Bt=new k,$t=new Wt,xt={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};let Ct=!1;function Pt(){return H===null?ue:1}let j=s;function Ft(T,F){return t.getContext(T,F)}try{const T={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${Bu}`),t.addEventListener("webglcontextlost",ht,!1),t.addEventListener("webglcontextrestored",Et,!1),t.addEventListener("webglcontextcreationerror",_s,!1),j===null){const F="webgl2";if(j=Ft(F,T),j===null)throw Ft(F)?new Error("THREE.WebGLRenderer: Error creating WebGL context with your selected attributes."):new Error("THREE.WebGLRenderer: Error creating WebGL context.")}}catch(T){throw pt("WebGLRenderer: "+T.message),T}let vt,N,x,V,Z,$,pe,ye,te,ie,he,Te,Me,_e,Ue,je,$e,U,ze,re,we,Ee,de;function Be(){vt=new VE(j),vt.init(),we=new CA(j,vt),N=new PE(j,vt,e,we),x=new NA(j,vt),N.reversedDepthBuffer&&h&&x.buffers.depth.setReversed(!0),G=j.createFramebuffer(),C=j.createFramebuffer(),B=j.createFramebuffer(),V=new XE(j),Z=new zA,$=new BA(j,vt,x,Z,N,we,V),pe=new $E(E),ye=new QO(j),Ee=new BE(j,ye),te=new HE(j,ye,V,Ee),ie=new YE(j,te,ye,Ee,V),U=new KE(j,N,$),Ue=new LE(Z),he=new _A(E,pe,vt,N,Ee,Ue),Te=new FA(E,Z),Me=new yA,_e=new AA(vt),$e=new NE(E,pe,x,ie,f,l),je=new RA(E,ie,N),de=new jA(j,V,N,x),ze=new CE(j,vt,V),re=new qE(j,vt,V),V.programs=he.programs,E.capabilities=N,E.extensions=vt,E.properties=Z,E.renderLists=Me,E.shadowMap=je,E.state=x,E.info=V}Be(),M!==Ss&&(v=new QE(M,t.width,t.height,o,i,r));const Ge=new kA(E,j);this.xr=Ge,this.getContext=function(){return j},this.getContextAttributes=function(){return j.getContextAttributes()},this.forceContextLoss=function(){const T=vt.get("WEBGL_lose_context");T&&T.loseContext()},this.forceContextRestore=function(){const T=vt.get("WEBGL_lose_context");T&&T.restoreContext()},this.getPixelRatio=function(){return ue},this.setPixelRatio=function(T){T!==void 0&&(ue=T,this.setSize(ne,ae,!1))},this.getSize=function(T){return T.set(ne,ae)},this.setSize=function(T,F,Q=!0){if(Ge.isPresenting){He("WebGLRenderer: Can't change size while VR device is presenting.");return}ne=T,ae=F,t.width=Math.floor(T*ue),t.height=Math.floor(F*ue),Q===!0&&(t.style.width=T+"px",t.style.height=F+"px"),v!==null&&v.setSize(t.width,t.height),this.setViewport(0,0,T,F)},this.getDrawingBufferSize=function(T){return T.set(ne*ue,ae*ue).floor()},this.setDrawingBufferSize=function(T,F,Q){ne=T,ae=F,ue=Q,t.width=Math.floor(T*Q),t.height=Math.floor(F*Q),this.setViewport(0,0,T,F)},this.setEffects=function(T){if(M===Ss){pt("WebGLRenderer: setEffects() requires outputBufferType set to HalfFloatType or FloatType.");return}if(T){for(let F=0;F<T.length;F++)if(T[F].isOutputPass===!0){He("WebGLRenderer: OutputPass is not needed in setEffects(). Tone mapping and color space conversion are applied automatically.");break}}v.setEffects(T||[])},this.getCurrentViewport=function(T){return T.copy(J)},this.getViewport=function(T){return T.copy(Fe)},this.setViewport=function(T,F,Q,K){T.isVector4?Fe.set(T.x,T.y,T.z,T.w):Fe.set(T,F,Q,K),x.viewport(J.copy(Fe).multiplyScalar(ue).round())},this.getScissor=function(T){return T.copy(Lt)},this.setScissor=function(T,F,Q,K){T.isVector4?Lt.set(T.x,T.y,T.z,T.w):Lt.set(T,F,Q,K),x.scissor(ce.copy(Lt).multiplyScalar(ue).round())},this.getScissorTest=function(){return ot},this.setScissorTest=function(T){x.setScissorTest(ot=T)},this.setOpaqueSort=function(T){Xe=T},this.setTransparentSort=function(T){Ze=T},this.getClearColor=function(T){return T.copy($e.getClearColor())},this.setClearColor=function(){$e.setClearColor(...arguments)},this.getClearAlpha=function(){return $e.getClearAlpha()},this.setClearAlpha=function(){$e.setClearAlpha(...arguments)},this.clear=function(T=!0,F=!0,Q=!0){let K=0;if(T){let Y=!1;if(H!==null){const ve=H.texture.format;Y=g.has(ve)}if(Y){const ve=H.texture.type,De=m.has(ve),Oe=$e.getClearColor(),Ne=$e.getClearAlpha(),Re=Oe.r,ge=Oe.g,nt=Oe.b;De?(_[0]=Re,_[1]=ge,_[2]=nt,_[3]=Ne,j.clearBufferuiv(j.COLOR,0,_)):(w[0]=Re,w[1]=ge,w[2]=nt,w[3]=Ne,j.clearBufferiv(j.COLOR,0,w))}else K|=j.COLOR_BUFFER_BIT}F&&(K|=j.DEPTH_BUFFER_BIT,this.state.buffers.depth.setMask(!0)),Q&&(K|=j.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),K!==0&&j.clear(K)},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(T){T.setRenderer(this),I=T},this.dispose=function(){t.removeEventListener("webglcontextlost",ht,!1),t.removeEventListener("webglcontextrestored",Et,!1),t.removeEventListener("webglcontextcreationerror",_s,!1),$e.dispose(),Me.dispose(),_e.dispose(),Z.dispose(),pe.dispose(),ie.dispose(),Ee.dispose(),de.dispose(),he.dispose(),Ge.dispose(),Ge.removeEventListener("sessionstart",Lr),Ge.removeEventListener("sessionend",Wr),cn.stop()};function ht(T){T.preventDefault(),sl("WebGLRenderer: Context Lost."),A=!0}function Et(){sl("WebGLRenderer: Context Restored."),A=!1;const T=V.autoReset,F=je.enabled,Q=je.autoUpdate,K=je.needsUpdate,Y=je.type;Be(),V.autoReset=T,je.enabled=F,je.autoUpdate=Q,je.needsUpdate=K,je.type=Y}function _s(T){pt("WebGLRenderer: A WebGL context could not be created. Reason: ",T.statusMessage)}function zs(T){const F=T.target;F.removeEventListener("dispose",zs),Aa(F)}function Aa(T){Dl(T),Z.remove(T)}function Dl(T){const F=Z.get(T).programs;F!==void 0&&(F.forEach(function(Q){he.releaseProgram(Q)}),T.isShaderMaterial&&he.releaseShaderCache(T))}this.renderBufferDirect=function(T,F,Q,K,Y,ve){F===null&&(F=xt);const De=Y.isMesh&&Y.matrixWorld.determinantAffine()<0,Oe=Tl(T,F,Q,K,Y);x.setMaterial(K,De);let Ne=Q.index,Re=1;if(K.wireframe===!0){if(Ne=te.getWireframeAttribute(Q),Ne===void 0)return;Re=2}const ge=Q.drawRange,nt=Q.attributes.position;let Ce=ge.start*Re,zt=(ge.start+ge.count)*Re;ve!==null&&(Ce=Math.max(Ce,ve.start*Re),zt=Math.min(zt,(ve.start+ve.count)*Re)),Ne!==null?(Ce=Math.max(Ce,0),zt=Math.min(zt,Ne.count)):nt!=null&&(Ce=Math.max(Ce,0),zt=Math.min(zt,nt.count));const At=zt-Ce;if(At<0||At===1/0)return;Ee.setup(Y,K,Oe,Q,Ne);let Ve,Mt=ze;if(Ne!==null&&(Ve=ye.get(Ne),Mt=re,Mt.setIndex(Ve)),Y.isMesh)K.wireframe===!0?(x.setLineWidth(K.wireframeLinewidth*Pt()),Mt.setMode(j.LINES)):Mt.setMode(j.TRIANGLES);else if(Y.isLine){let D=K.linewidth;D===void 0&&(D=1),x.setLineWidth(D*Pt()),Y.isLineSegments?Mt.setMode(j.LINES):Y.isLineLoop?Mt.setMode(j.LINE_LOOP):Mt.setMode(j.LINE_STRIP)}else Y.isPoints?Mt.setMode(j.POINTS):Y.isSprite&&Mt.setMode(j.TRIANGLES);if(Y.isBatchedMesh)if(vt.get("WEBGL_multi_draw"))Mt.renderMultiDraw(Y._multiDrawStarts,Y._multiDrawCounts,Y._multiDrawCount);else{const D=Y._multiDrawStarts,R=Y._multiDrawCounts,ee=Y._multiDrawCount,q=Ne?ye.get(Ne).bytesPerElement:1,se=Z.get(K).currentProgram.getUniforms();for(let be=0;be<ee;be++)se.setValue(j,"_gl_DrawID",be),Mt.render(D[be]/q,R[be])}else if(Y.isInstancedMesh)Mt.renderInstances(Ce,At,Y.count);else if(Q.isInstancedBufferGeometry){const D=Q._maxInstanceCount!==void 0?Q._maxInstanceCount:1/0,R=Math.min(Q.instanceCount,D);Mt.renderInstances(Ce,At,R)}else Mt.render(Ce,At)};function qs(T,F,Q){T.transparent===!0&&T.side===zn&&T.forceSinglePass===!1?(T.side=gs,T.needsUpdate=!0,Nn(T,F,Q),T.side=ri,T.needsUpdate=!0,Nn(T,F,Q),T.side=zn):Nn(T,F,Q)}this.compile=function(T,F,Q=null){Q===null&&(Q=T),O=_e.get(Q),O.init(F),b.push(O),Q.traverseVisible(function(Y){Y.isLight&&Y.layers.test(F.layers)&&(O.pushLight(Y),Y.castShadow&&O.pushShadow(Y))}),T!==Q&&T.traverseVisible(function(Y){Y.isLight&&Y.layers.test(F.layers)&&(O.pushLight(Y),Y.castShadow&&O.pushShadow(Y))}),O.setupLights();const K=new Set;return T.traverse(function(Y){if(!(Y.isMesh||Y.isPoints||Y.isLine||Y.isSprite))return;const ve=Y.material;if(ve)if(Array.isArray(ve))for(let De=0;De<ve.length;De++){const Oe=ve[De];qs(Oe,Q,Y),K.add(Oe)}else qs(ve,Q,Y),K.add(ve)}),O=b.pop(),K},this.compileAsync=function(T,F,Q=null){const K=this.compile(T,F,Q);return new Promise(Y=>{function ve(){if(K.forEach(function(De){Z.get(De).currentProgram.isReady()&&K.delete(De)}),K.size===0){Y(T);return}setTimeout(ve,10)}vt.get("KHR_parallel_shader_compile")!==null?ve():setTimeout(ve,10)})};let Gn=null;function ln(T){Gn&&Gn(T)}function Lr(){cn.stop()}function Wr(){cn.start()}const cn=new cM;cn.setAnimationLoop(ln),typeof self<"u"&&cn.setContext(self),this.setAnimationLoop=function(T){Gn=T,Ge.setAnimationLoop(T),T===null?cn.stop():cn.start()},Ge.addEventListener("sessionstart",Lr),Ge.addEventListener("sessionend",Wr),this.render=function(T,F){if(F!==void 0&&F.isCamera!==!0){pt("WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(A===!0)return;I!==null&&I.renderStart(T,F);const Q=Ge.enabled===!0&&Ge.isPresenting===!0,K=v!==null&&(H===null||Q)&&v.begin(E,H);if(T.matrixWorldAutoUpdate===!0&&T.updateMatrixWorld(),F.parent===null&&F.matrixWorldAutoUpdate===!0&&F.updateMatrixWorld(),Ge.enabled===!0&&Ge.isPresenting===!0&&(v===null||v.isCompositing()===!1)&&(Ge.cameraAutoUpdate===!0&&Ge.updateCamera(F),F=Ge.getCamera()),T.isScene===!0&&T.onBeforeRender(E,T,F,H),O=_e.get(T,b.length),O.init(F),O.state.textureUnits=$.getTextureUnits(),b.push(O),Gt.multiplyMatrices(F.projectionMatrix,F.matrixWorldInverse),yt.setFromProjectionMatrix(Gt,tn,F.reversedDepth),lt=this.localClippingEnabled,ut=Ue.init(this.clippingPlanes,lt),y=Me.get(T,S.length),y.init(),S.push(y),Ge.enabled===!0&&Ge.isPresenting===!0){const De=E.xr.getDepthSensingMesh();De!==null&&Rn(De,F,-1/0,E.sortObjects)}Rn(T,F,0,E.sortObjects),y.finish(),E.sortObjects===!0&&y.sort(Xe,Ze,F.reversedDepth),Ct=Ge.enabled===!1||Ge.isPresenting===!1||Ge.hasDepthSensing()===!1,Ct&&$e.addToRenderList(y,T),this.info.render.frame++,this.info.autoReset===!0&&this.info.reset(),ut===!0&&Ue.beginShadows();const Y=O.state.shadowsArray;if(je.render(Y,T,F),ut===!0&&Ue.endShadows(),(K&&v.hasRenderPass())===!1){const De=y.opaque,Oe=y.transmissive;if(O.setupLights(),F.isArrayCamera){const Ne=F.cameras;if(Oe.length>0)for(let Re=0,ge=Ne.length;Re<ge;Re++){const nt=Ne[Re];Ur(De,Oe,T,nt)}Ct&&$e.render(T);for(let Re=0,ge=Ne.length;Re<ge;Re++){const nt=Ne[Re];kr(y,T,nt,nt.viewport)}}else Oe.length>0&&Ur(De,Oe,T,F),Ct&&$e.render(T),kr(y,T,F)}H!==null&&W===0&&($.updateMultisampleRenderTarget(H),$.updateRenderTargetMipmap(H)),K&&v.end(E),T.isScene===!0&&T.onAfterRender(E,T,F),Ee.resetDefaultState(),X=-1,oe=null,b.pop(),b.length>0?(O=b[b.length-1],$.setTextureUnits(O.state.textureUnits),ut===!0&&Ue.setGlobalState(E.clippingPlanes,O.state.camera)):O=null,S.pop(),S.length>0?y=S[S.length-1]:y=null,I!==null&&I.renderEnd()};function Rn(T,F,Q,K){if(T.visible===!1)return;if(T.layers.test(F.layers)){if(T.isGroup)Q=T.renderOrder;else if(T.isLOD)T.autoUpdate===!0&&T.update(F);else if(T.isLightProbeGrid)O.pushLightProbeGrid(T);else if(T.isLight)O.pushLight(T),T.castShadow&&O.pushShadow(T);else if(T.isSprite){if(!T.frustumCulled||yt.intersectsSprite(T)){K&&$t.setFromMatrixPosition(T.matrixWorld).applyMatrix4(Gt);const De=ie.update(T),Oe=T.material;Oe.visible&&y.push(T,De,Oe,Q,$t.z,null)}}else if((T.isMesh||T.isLine||T.isPoints)&&(!T.frustumCulled||yt.intersectsObject(T))){const De=ie.update(T),Oe=T.material;if(K&&(T.boundingSphere!==void 0?(T.boundingSphere===null&&T.computeBoundingSphere(),$t.copy(T.boundingSphere.center)):(De.boundingSphere===null&&De.computeBoundingSphere(),$t.copy(De.boundingSphere.center)),$t.applyMatrix4(T.matrixWorld).applyMatrix4(Gt)),Array.isArray(Oe)){const Ne=De.groups;for(let Re=0,ge=Ne.length;Re<ge;Re++){const nt=Ne[Re],Ce=Oe[nt.materialIndex];Ce&&Ce.visible&&y.push(T,De,Ce,Q,$t.z,nt)}}else Oe.visible&&y.push(T,De,Oe,Q,$t.z,null)}}const ve=T.children;for(let De=0,Oe=ve.length;De<Oe;De++)Rn(ve[De],F,Q,K)}function kr(T,F,Q,K){const{opaque:Y,transmissive:ve,transparent:De}=T;O.setupLightsView(Q),ut===!0&&Ue.setGlobalState(E.clippingPlanes,Q),K&&x.viewport(J.copy(K)),Y.length>0&&oi(Y,F,Q),ve.length>0&&oi(ve,F,Q),De.length>0&&oi(De,F,Q),x.buffers.depth.setTest(!0),x.buffers.depth.setMask(!0),x.buffers.color.setMask(!0),x.setPolygonOffset(!1)}function Ur(T,F,Q,K){if((Q.isScene===!0?Q.overrideMaterial:null)!==null)return;if(O.state.transmissionRenderTarget[K.id]===void 0){const Ce=vt.has("EXT_color_buffer_half_float")||vt.has("EXT_color_buffer_float");O.state.transmissionRenderTarget[K.id]=new rn(1,1,{generateMipmaps:!0,type:Ce?Dn:Ss,minFilter:yi,samples:Math.max(4,N.samples),stencilBuffer:r,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:mt.workingColorSpace})}const ve=O.state.transmissionRenderTarget[K.id],De=K.viewport||J;ve.setSize(De.z*E.transmissionResolutionScale,De.w*E.transmissionResolutionScale);const Oe=E.getRenderTarget(),Ne=E.getActiveCubeFace(),Re=E.getActiveMipmapLevel();E.setRenderTarget(ve),E.getClearColor(qe),Pe=E.getClearAlpha(),Pe<1&&E.setClearColor(16777215,.5),E.clear(),Ct&&$e.render(Q);const ge=E.toneMapping;E.toneMapping=nn;const nt=K.viewport;if(K.viewport!==void 0&&(K.viewport=void 0),O.setupLightsView(K),ut===!0&&Ue.setGlobalState(E.clippingPlanes,K),oi(T,Q,K),$.updateMultisampleRenderTarget(ve),$.updateRenderTargetMipmap(ve),vt.has("WEBGL_multisampled_render_to_texture")===!1){let Ce=!1;for(let zt=0,At=F.length;zt<At;zt++){const Ve=F[zt],{object:Mt,geometry:D,material:R,group:ee}=Ve;if(R.side===zn&&Mt.layers.test(K.layers)){const q=R.side;R.side=gs,R.needsUpdate=!0,li(Mt,Q,K,D,R,ee),R.side=q,R.needsUpdate=!0,Ce=!0}}Ce===!0&&($.updateMultisampleRenderTarget(ve),$.updateRenderTargetMipmap(ve))}E.setRenderTarget(Oe,Ne,Re),E.setClearColor(qe,Pe),nt!==void 0&&(K.viewport=nt),E.toneMapping=ge}function oi(T,F,Q){const K=F.isScene===!0?F.overrideMaterial:null;for(let Y=0,ve=T.length;Y<ve;Y++){const De=T[Y],{object:Oe,geometry:Ne,group:Re}=De;let ge=De.material;ge.allowOverride===!0&&K!==null&&(ge=K),Oe.layers.test(Q.layers)&&li(Oe,F,Q,Ne,ge,Re)}}function li(T,F,Q,K,Y,ve){T.onBeforeRender(E,F,Q,K,Y,ve),T.modelViewMatrix.multiplyMatrices(Q.matrixWorldInverse,T.matrixWorld),T.normalMatrix.getNormalMatrix(T.modelViewMatrix),Y.onBeforeRender(E,F,Q,K,T,ve),Y.transparent===!0&&Y.side===zn&&Y.forceSinglePass===!1?(Y.side=gs,Y.needsUpdate=!0,E.renderBufferDirect(Q,F,K,Y,T,ve),Y.side=ri,Y.needsUpdate=!0,E.renderBufferDirect(Q,F,K,Y,T,ve),Y.side=zn):E.renderBufferDirect(Q,F,K,Y,T,ve),T.onAfterRender(E,F,Q,K,Y,ve)}function Nn(T,F,Q){F.isScene!==!0&&(F=xt);const K=Z.get(T),Y=O.state.lights,ve=O.state.shadowsArray,De=Y.state.version,Oe=he.getParameters(T,Y.state,ve,F,Q,O.state.lightProbeGridArray),Ne=he.getProgramCacheKey(Oe);let Re=K.programs;K.environment=T.isMeshStandardMaterial||T.isMeshLambertMaterial||T.isMeshPhongMaterial?F.environment:null,K.fog=F.fog;const ge=T.isMeshStandardMaterial||T.isMeshLambertMaterial&&!T.envMap||T.isMeshPhongMaterial&&!T.envMap;K.envMap=pe.get(T.envMap||K.environment,ge),K.envMapRotation=K.environment!==null&&T.envMap===null?F.environmentRotation:T.envMapRotation,Re===void 0&&(T.addEventListener("dispose",zs),Re=new Map,K.programs=Re);let nt=Re.get(Ne);if(nt!==void 0){if(K.currentProgram===nt&&K.lightsStateVersion===De)return Bn(T,Oe),nt}else Oe.uniforms=he.getUniforms(T),I!==null&&T.isNodeMaterial&&I.build(T,Q,Oe),T.onBeforeCompile(Oe,E),nt=he.acquireProgram(Oe,Ne),Re.set(Ne,nt),K.uniforms=Oe.uniforms;const Ce=K.uniforms;return(!T.isShaderMaterial&&!T.isRawShaderMaterial||T.clipping===!0)&&(Ce.clippingPlanes=Ue.uniform),Bn(T,Oe),K.needsLights=Fr(T),K.lightsStateVersion=De,K.needsLights&&(Ce.ambientLightColor.value=Y.state.ambient,Ce.lightProbe.value=Y.state.probe,Ce.directionalLights.value=Y.state.directional,Ce.directionalLightShadows.value=Y.state.directionalShadow,Ce.spotLights.value=Y.state.spot,Ce.spotLightShadows.value=Y.state.spotShadow,Ce.rectAreaLights.value=Y.state.rectArea,Ce.ltc_1.value=Y.state.rectAreaLTC1,Ce.ltc_2.value=Y.state.rectAreaLTC2,Ce.pointLights.value=Y.state.point,Ce.pointLightShadows.value=Y.state.pointShadow,Ce.hemisphereLights.value=Y.state.hemi,Ce.directionalShadowMatrix.value=Y.state.directionalShadowMatrix,Ce.spotLightMatrix.value=Y.state.spotLightMatrix,Ce.spotLightMap.value=Y.state.spotLightMap,Ce.pointShadowMatrix.value=Y.state.pointShadowMatrix),K.lightProbeGrid=O.state.lightProbeGridArray.length>0,K.currentProgram=nt,K.uniformsList=null,nt}function Vi(T){if(T.uniformsList===null){const F=T.currentProgram.getUniforms();T.uniformsList=Do.seqWithValue(F.seq,T.uniforms)}return T.uniformsList}function Bn(T,F){const Q=Z.get(T);Q.outputColorSpace=F.outputColorSpace,Q.batching=F.batching,Q.batchingColor=F.batchingColor,Q.instancing=F.instancing,Q.instancingColor=F.instancingColor,Q.instancingMorph=F.instancingMorph,Q.skinning=F.skinning,Q.morphTargets=F.morphTargets,Q.morphNormals=F.morphNormals,Q.morphColors=F.morphColors,Q.morphTargetsCount=F.morphTargetsCount,Q.numClippingPlanes=F.numClippingPlanes,Q.numIntersection=F.numClipIntersection,Q.vertexAlphas=F.vertexAlphas,Q.vertexTangents=F.vertexTangents,Q.toneMapping=F.toneMapping}function ci(T,F){if(T.length===0)return null;if(T.length===1)return T[0].texture!==null?T[0]:null;z.setFromMatrixPosition(F.matrixWorld);for(let Q=0,K=T.length;Q<K;Q++){const Y=T[Q];if(Y.texture!==null&&Y.boundingBox.containsPoint(z))return Y}return null}function Tl(T,F,Q,K,Y){F.isScene!==!0&&(F=xt),$.resetTextureUnits();const ve=F.fog,De=K.isMeshStandardMaterial||K.isMeshLambertMaterial||K.isMeshPhongMaterial?F.environment:null,Oe=H===null?E.outputColorSpace:H.isXRRenderTarget===!0?H.texture.colorSpace:mt.workingColorSpace,Ne=K.isMeshStandardMaterial||K.isMeshLambertMaterial&&!K.envMap||K.isMeshPhongMaterial&&!K.envMap,Re=pe.get(K.envMap||De,Ne),ge=K.vertexColors===!0&&!!Q.attributes.color&&Q.attributes.color.itemSize===4,nt=!!Q.attributes.tangent&&(!!K.normalMap||K.anisotropy>0),Ce=!!Q.morphAttributes.position,zt=!!Q.morphAttributes.normal,At=!!Q.morphAttributes.color;let Ve=nn;K.toneMapped&&(H===null||H.isXRRenderTarget===!0)&&(Ve=E.toneMapping);const Mt=Q.morphAttributes.position||Q.morphAttributes.normal||Q.morphAttributes.color,D=Mt!==void 0?Mt.length:0,R=Z.get(K),ee=O.state.lights;if(ut===!0&&(lt===!0||T!==oe)){const bt=T===oe&&K.id===X;Ue.setState(K,T,bt)}let q=!1;K.version===R.__version?(R.needsLights&&R.lightsStateVersion!==ee.state.version||R.outputColorSpace!==Oe||Y.isBatchedMesh&&R.batching===!1||!Y.isBatchedMesh&&R.batching===!0||Y.isBatchedMesh&&R.batchingColor===!0&&Y.colorTexture===null||Y.isBatchedMesh&&R.batchingColor===!1&&Y.colorTexture!==null||Y.isInstancedMesh&&R.instancing===!1||!Y.isInstancedMesh&&R.instancing===!0||Y.isSkinnedMesh&&R.skinning===!1||!Y.isSkinnedMesh&&R.skinning===!0||Y.isInstancedMesh&&R.instancingColor===!0&&Y.instanceColor===null||Y.isInstancedMesh&&R.instancingColor===!1&&Y.instanceColor!==null||Y.isInstancedMesh&&R.instancingMorph===!0&&Y.morphTexture===null||Y.isInstancedMesh&&R.instancingMorph===!1&&Y.morphTexture!==null||R.envMap!==Re||K.fog===!0&&R.fog!==ve||R.numClippingPlanes!==void 0&&(R.numClippingPlanes!==Ue.numPlanes||R.numIntersection!==Ue.numIntersection)||R.vertexAlphas!==ge||R.vertexTangents!==nt||R.morphTargets!==Ce||R.morphNormals!==zt||R.morphColors!==At||R.toneMapping!==Ve||R.morphTargetsCount!==D||!!R.lightProbeGrid!=O.state.lightProbeGridArray.length>0)&&(q=!0):(q=!0,R.__version=K.version);let se=R.currentProgram;q===!0&&(se=Nn(K,F,Y),I&&K.isNodeMaterial&&I.onUpdateProgram(K,se,R));let be=!1,xe=!1,Ke=!1;const tt=se.getUniforms(),ft=R.uniforms;if(x.useProgram(se.program)&&(be=!0,xe=!0,Ke=!0),K.id!==X&&(X=K.id,xe=!0),R.needsLights){const bt=ci(O.state.lightProbeGridArray,Y);R.lightProbeGrid!==bt&&(R.lightProbeGrid=bt,xe=!0)}if(be||oe!==T){x.buffers.depth.getReversed()&&T.reversedDepth!==!0&&(T._reversedDepth=!0,T.updateProjectionMatrix()),tt.setValue(j,"projectionMatrix",T.projectionMatrix),tt.setValue(j,"viewMatrix",T.matrixWorldInverse);const Rt=tt.map.cameraPosition;Rt!==void 0&&Rt.setValue(j,Bt.setFromMatrixPosition(T.matrixWorld)),N.logarithmicDepthBuffer&&tt.setValue(j,"logDepthBufFC",2/(Math.log(T.far+1)/Math.LN2)),(K.isMeshPhongMaterial||K.isMeshToonMaterial||K.isMeshLambertMaterial||K.isMeshBasicMaterial||K.isMeshStandardMaterial||K.isShaderMaterial)&&tt.setValue(j,"isOrthographic",T.isOrthographicCamera===!0),oe!==T&&(oe=T,xe=!0,Ke=!0)}if(R.needsLights&&(ee.state.directionalShadowMap.length>0&&tt.setValue(j,"directionalShadowMap",ee.state.directionalShadowMap,$),ee.state.spotShadowMap.length>0&&tt.setValue(j,"spotShadowMap",ee.state.spotShadowMap,$),ee.state.pointShadowMap.length>0&&tt.setValue(j,"pointShadowMap",ee.state.pointShadowMap,$)),Y.isSkinnedMesh){tt.setOptional(j,Y,"bindMatrix"),tt.setOptional(j,Y,"bindMatrixInverse");const bt=Y.skeleton;bt&&(bt.boneTexture===null&&bt.computeBoneTexture(),tt.setValue(j,"boneTexture",bt.boneTexture,$))}Y.isBatchedMesh&&(tt.setOptional(j,Y,"batchingTexture"),tt.setValue(j,"batchingTexture",Y._matricesTexture,$),tt.setOptional(j,Y,"batchingIdTexture"),tt.setValue(j,"batchingIdTexture",Y._indirectTexture,$),tt.setOptional(j,Y,"batchingColorTexture"),Y._colorsTexture!==null&&tt.setValue(j,"batchingColorTexture",Y._colorsTexture,$));const Zt=Q.morphAttributes;if((Zt.position!==void 0||Zt.normal!==void 0||Zt.color!==void 0)&&U.update(Y,Q,se),(xe||R.receiveShadow!==Y.receiveShadow)&&(R.receiveShadow=Y.receiveShadow,tt.setValue(j,"receiveShadow",Y.receiveShadow)),(K.isMeshStandardMaterial||K.isMeshLambertMaterial||K.isMeshPhongMaterial)&&K.envMap===null&&F.environment!==null&&(ft.envMapIntensity.value=F.environmentIntensity),ft.dfgLUT!==void 0&&(ft.dfgLUT.value=VA()),xe){if(tt.setValue(j,"toneMappingExposure",E.toneMappingExposure),R.needsLights&&Il(ft,Ke),ve&&K.fog===!0&&Te.refreshFogUniforms(ft,ve),Te.refreshMaterialUniforms(ft,K,ue,ae,O.state.transmissionRenderTarget[T.id]),R.needsLights&&R.lightProbeGrid){const bt=R.lightProbeGrid;ft.probesSH.value=bt.texture,ft.probesMin.value.copy(bt.boundingBox.min),ft.probesMax.value.copy(bt.boundingBox.max),ft.probesResolution.value.copy(bt.resolution)}Do.upload(j,Vi(R),ft,$)}if(K.isShaderMaterial&&K.uniformsNeedUpdate===!0&&(Do.upload(j,Vi(R),ft,$),K.uniformsNeedUpdate=!1),K.isSpriteMaterial&&tt.setValue(j,"center",Y.center),tt.setValue(j,"modelViewMatrix",Y.modelViewMatrix),tt.setValue(j,"normalMatrix",Y.normalMatrix),tt.setValue(j,"modelMatrix",Y.matrixWorld),K.uniformsGroups!==void 0){const bt=K.uniformsGroups;for(let Rt=0,Es=bt.length;Rt<Es;Rt++){const Cn=bt[Rt];de.update(Cn,se),de.bind(Cn,se)}}return se}function Il(T,F){T.ambientLightColor.needsUpdate=F,T.lightProbe.needsUpdate=F,T.directionalLights.needsUpdate=F,T.directionalLightShadows.needsUpdate=F,T.pointLights.needsUpdate=F,T.pointLightShadows.needsUpdate=F,T.spotLights.needsUpdate=F,T.spotLightShadows.needsUpdate=F,T.rectAreaLights.needsUpdate=F,T.hemisphereLights.needsUpdate=F}function Fr(T){return T.isMeshLambertMaterial||T.isMeshToonMaterial||T.isMeshPhongMaterial||T.isMeshStandardMaterial||T.isShadowMaterial||T.isShaderMaterial&&T.lights===!0}this.getActiveCubeFace=function(){return P},this.getActiveMipmapLevel=function(){return W},this.getRenderTarget=function(){return H},this.setRenderTargetTextures=function(T,F,Q){const K=Z.get(T);K.__autoAllocateDepthBuffer=T.resolveDepthBuffer===!1,K.__autoAllocateDepthBuffer===!1&&(K.__useRenderToTexture=!1),Z.get(T.texture).__webglTexture=F,Z.get(T.depthTexture).__webglTexture=K.__autoAllocateDepthBuffer?void 0:Q,K.__hasExternalTextures=!0},this.setRenderTargetFramebuffer=function(T,F){const Q=Z.get(T);Q.__webglFramebuffer=F,Q.__useDefaultFramebuffer=F===void 0},this.setRenderTarget=function(T,F=0,Q=0){H=T,P=F,W=Q;let K=null,Y=!1,ve=!1;if(T){const Oe=Z.get(T);if(Oe.__useDefaultFramebuffer!==void 0){x.bindFramebuffer(j.FRAMEBUFFER,Oe.__webglFramebuffer),J.copy(T.viewport),ce.copy(T.scissor),We=T.scissorTest,x.viewport(J),x.scissor(ce),x.setScissorTest(We),X=-1;return}else if(Oe.__webglFramebuffer===void 0)$.setupRenderTarget(T);else if(Oe.__hasExternalTextures)$.rebindTextures(T,Z.get(T.texture).__webglTexture,Z.get(T.depthTexture).__webglTexture);else if(T.depthBuffer){const ge=T.depthTexture;if(Oe.__boundDepthTexture!==ge){if(ge!==null&&Z.has(ge)&&(T.width!==ge.image.width||T.height!==ge.image.height))throw new Error("THREE.WebGLRenderer: Attached DepthTexture is initialized to the incorrect size.");$.setupDepthRenderbuffer(T)}}const Ne=T.texture;(Ne.isData3DTexture||Ne.isDataArrayTexture||Ne.isCompressedArrayTexture)&&(ve=!0);const Re=Z.get(T).__webglFramebuffer;T.isWebGLCubeRenderTarget?(Array.isArray(Re[F])?K=Re[F][Q]:K=Re[F],Y=!0):T.samples>0&&$.useMultisampledRTT(T)===!1?K=Z.get(T).__webglMultisampledFramebuffer:Array.isArray(Re)?K=Re[Q]:K=Re,J.copy(T.viewport),ce.copy(T.scissor),We=T.scissorTest}else J.copy(Fe).multiplyScalar(ue).floor(),ce.copy(Lt).multiplyScalar(ue).floor(),We=ot;if(Q!==0&&(K=G),x.bindFramebuffer(j.FRAMEBUFFER,K)&&x.drawBuffers(T,K),x.viewport(J),x.scissor(ce),x.setScissorTest(We),Y){const Oe=Z.get(T.texture);j.framebufferTexture2D(j.FRAMEBUFFER,j.COLOR_ATTACHMENT0,j.TEXTURE_CUBE_MAP_POSITIVE_X+F,Oe.__webglTexture,Q)}else if(ve){const Oe=F;for(let Ne=0;Ne<T.textures.length;Ne++){const Re=Z.get(T.textures[Ne]);j.framebufferTextureLayer(j.FRAMEBUFFER,j.COLOR_ATTACHMENT0+Ne,Re.__webglTexture,Q,Oe)}}else if(T!==null&&Q!==0){const Oe=Z.get(T.texture);j.framebufferTexture2D(j.FRAMEBUFFER,j.COLOR_ATTACHMENT0,j.TEXTURE_2D,Oe.__webglTexture,Q)}X=-1},this.readRenderTargetPixels=function(T,F,Q,K,Y,ve,De,Oe=0){if(!(T&&T.isWebGLRenderTarget)){pt("WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let Ne=Z.get(T).__webglFramebuffer;if(T.isWebGLCubeRenderTarget&&De!==void 0&&(Ne=Ne[De]),Ne){x.bindFramebuffer(j.FRAMEBUFFER,Ne);try{const Re=T.textures[Oe],ge=Re.format,nt=Re.type;if(T.textures.length>1&&j.readBuffer(j.COLOR_ATTACHMENT0+Oe),!N.textureFormatReadable(ge)){pt("WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}if(!N.textureTypeReadable(nt)){pt("WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}F>=0&&F<=T.width-K&&Q>=0&&Q<=T.height-Y&&j.readPixels(F,Q,K,Y,we.convert(ge),we.convert(nt),ve)}finally{const Re=H!==null?Z.get(H).__webglFramebuffer:null;x.bindFramebuffer(j.FRAMEBUFFER,Re)}}},this.readRenderTargetPixelsAsync=async function(T,F,Q,K,Y,ve,De,Oe=0){if(!(T&&T.isWebGLRenderTarget))throw new Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let Ne=Z.get(T).__webglFramebuffer;if(T.isWebGLCubeRenderTarget&&De!==void 0&&(Ne=Ne[De]),Ne)if(F>=0&&F<=T.width-K&&Q>=0&&Q<=T.height-Y){x.bindFramebuffer(j.FRAMEBUFFER,Ne);const Re=T.textures[Oe],ge=Re.format,nt=Re.type;if(T.textures.length>1&&j.readBuffer(j.COLOR_ATTACHMENT0+Oe),!N.textureFormatReadable(ge))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(!N.textureTypeReadable(nt))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");const Ce=j.createBuffer();j.bindBuffer(j.PIXEL_PACK_BUFFER,Ce),j.bufferData(j.PIXEL_PACK_BUFFER,ve.byteLength,j.STREAM_READ),j.readPixels(F,Q,K,Y,we.convert(ge),we.convert(nt),0);const zt=H!==null?Z.get(H).__webglFramebuffer:null;x.bindFramebuffer(j.FRAMEBUFFER,zt);const At=j.fenceSync(j.SYNC_GPU_COMMANDS_COMPLETE,0);return j.flush(),await aO(j,At,4),j.bindBuffer(j.PIXEL_PACK_BUFFER,Ce),j.getBufferSubData(j.PIXEL_PACK_BUFFER,0,ve),j.deleteBuffer(Ce),j.deleteSync(At),ve}else throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.")},this.copyFramebufferToTexture=function(T,F=null,Q=0){const K=Math.pow(2,-Q),Y=Math.floor(T.image.width*K),ve=Math.floor(T.image.height*K),De=F!==null?F.x:0,Oe=F!==null?F.y:0;$.setTexture2D(T,0),j.copyTexSubImage2D(j.TEXTURE_2D,Q,0,0,De,Oe,Y,ve),x.unbindTexture()},this.copyTextureToTexture=function(T,F,Q=null,K=null,Y=0,ve=0){let De,Oe,Ne,Re,ge,nt,Ce,zt,At;const Ve=T.isCompressedTexture?T.mipmaps[ve]:T.image;if(Q!==null)De=Q.max.x-Q.min.x,Oe=Q.max.y-Q.min.y,Ne=Q.isBox3?Q.max.z-Q.min.z:1,Re=Q.min.x,ge=Q.min.y,nt=Q.isBox3?Q.min.z:0;else{const ft=Math.pow(2,-Y);De=Math.floor(Ve.width*ft),Oe=Math.floor(Ve.height*ft),T.isDataArrayTexture?Ne=Ve.depth:T.isData3DTexture?Ne=Math.floor(Ve.depth*ft):Ne=1,Re=0,ge=0,nt=0}K!==null?(Ce=K.x,zt=K.y,At=K.z):(Ce=0,zt=0,At=0);const Mt=we.convert(F.format),D=we.convert(F.type);let R;F.isData3DTexture?($.setTexture3D(F,0),R=j.TEXTURE_3D):F.isDataArrayTexture||F.isCompressedArrayTexture?($.setTexture2DArray(F,0),R=j.TEXTURE_2D_ARRAY):($.setTexture2D(F,0),R=j.TEXTURE_2D),x.activeTexture(j.TEXTURE0),x.pixelStorei(j.UNPACK_FLIP_Y_WEBGL,F.flipY),x.pixelStorei(j.UNPACK_PREMULTIPLY_ALPHA_WEBGL,F.premultiplyAlpha),x.pixelStorei(j.UNPACK_ALIGNMENT,F.unpackAlignment);const ee=x.getParameter(j.UNPACK_ROW_LENGTH),q=x.getParameter(j.UNPACK_IMAGE_HEIGHT),se=x.getParameter(j.UNPACK_SKIP_PIXELS),be=x.getParameter(j.UNPACK_SKIP_ROWS),xe=x.getParameter(j.UNPACK_SKIP_IMAGES);x.pixelStorei(j.UNPACK_ROW_LENGTH,Ve.width),x.pixelStorei(j.UNPACK_IMAGE_HEIGHT,Ve.height),x.pixelStorei(j.UNPACK_SKIP_PIXELS,Re),x.pixelStorei(j.UNPACK_SKIP_ROWS,ge),x.pixelStorei(j.UNPACK_SKIP_IMAGES,nt);const Ke=T.isDataArrayTexture||T.isData3DTexture,tt=F.isDataArrayTexture||F.isData3DTexture;if(T.isDepthTexture){const ft=Z.get(T),Zt=Z.get(F),bt=Z.get(ft.__renderTarget),Rt=Z.get(Zt.__renderTarget);x.bindFramebuffer(j.READ_FRAMEBUFFER,bt.__webglFramebuffer),x.bindFramebuffer(j.DRAW_FRAMEBUFFER,Rt.__webglFramebuffer);for(let Es=0;Es<Ne;Es++)Ke&&(j.framebufferTextureLayer(j.READ_FRAMEBUFFER,j.COLOR_ATTACHMENT0,Z.get(T).__webglTexture,Y,nt+Es),j.framebufferTextureLayer(j.DRAW_FRAMEBUFFER,j.COLOR_ATTACHMENT0,Z.get(F).__webglTexture,ve,At+Es)),j.blitFramebuffer(Re,ge,De,Oe,Ce,zt,De,Oe,j.DEPTH_BUFFER_BIT,j.NEAREST);x.bindFramebuffer(j.READ_FRAMEBUFFER,null),x.bindFramebuffer(j.DRAW_FRAMEBUFFER,null)}else if(Y!==0||T.isRenderTargetTexture||Z.has(T)){const ft=Z.get(T),Zt=Z.get(F);x.bindFramebuffer(j.READ_FRAMEBUFFER,C),x.bindFramebuffer(j.DRAW_FRAMEBUFFER,B);for(let bt=0;bt<Ne;bt++)Ke?j.framebufferTextureLayer(j.READ_FRAMEBUFFER,j.COLOR_ATTACHMENT0,ft.__webglTexture,Y,nt+bt):j.framebufferTexture2D(j.READ_FRAMEBUFFER,j.COLOR_ATTACHMENT0,j.TEXTURE_2D,ft.__webglTexture,Y),tt?j.framebufferTextureLayer(j.DRAW_FRAMEBUFFER,j.COLOR_ATTACHMENT0,Zt.__webglTexture,ve,At+bt):j.framebufferTexture2D(j.DRAW_FRAMEBUFFER,j.COLOR_ATTACHMENT0,j.TEXTURE_2D,Zt.__webglTexture,ve),Y!==0?j.blitFramebuffer(Re,ge,De,Oe,Ce,zt,De,Oe,j.COLOR_BUFFER_BIT,j.NEAREST):tt?j.copyTexSubImage3D(R,ve,Ce,zt,At+bt,Re,ge,De,Oe):j.copyTexSubImage2D(R,ve,Ce,zt,Re,ge,De,Oe);x.bindFramebuffer(j.READ_FRAMEBUFFER,null),x.bindFramebuffer(j.DRAW_FRAMEBUFFER,null)}else tt?T.isDataTexture||T.isData3DTexture?j.texSubImage3D(R,ve,Ce,zt,At,De,Oe,Ne,Mt,D,Ve.data):F.isCompressedArrayTexture?j.compressedTexSubImage3D(R,ve,Ce,zt,At,De,Oe,Ne,Mt,Ve.data):j.texSubImage3D(R,ve,Ce,zt,At,De,Oe,Ne,Mt,D,Ve):T.isDataTexture?j.texSubImage2D(j.TEXTURE_2D,ve,Ce,zt,De,Oe,Mt,D,Ve.data):T.isCompressedTexture?j.compressedTexSubImage2D(j.TEXTURE_2D,ve,Ce,zt,Ve.width,Ve.height,Mt,Ve.data):j.texSubImage2D(j.TEXTURE_2D,ve,Ce,zt,De,Oe,Mt,D,Ve);x.pixelStorei(j.UNPACK_ROW_LENGTH,ee),x.pixelStorei(j.UNPACK_IMAGE_HEIGHT,q),x.pixelStorei(j.UNPACK_SKIP_PIXELS,se),x.pixelStorei(j.UNPACK_SKIP_ROWS,be),x.pixelStorei(j.UNPACK_SKIP_IMAGES,xe),ve===0&&F.generateMipmaps&&j.generateMipmap(R),x.unbindTexture()},this.initRenderTarget=function(T){Z.get(T).__webglFramebuffer===void 0&&$.setupRenderTarget(T)},this.initTexture=function(T){T.isCubeTexture?$.setTextureCube(T,0):T.isData3DTexture?$.setTexture3D(T,0):T.isDataArrayTexture||T.isCompressedArrayTexture?$.setTexture2DArray(T,0):$.setTexture2D(T,0),x.unbindTexture()},this.resetState=function(){P=0,W=0,H=null,x.reset(),Ee.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return tn}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(e){this._outputColorSpace=e;const t=this.getContext();t.drawingBufferColorSpace=mt._getDrawingBufferColorSpace(e),t.unpackColorSpace=mt._getUnpackColorSpace()}}const To=.16,Tp=.09,ru=.1,Ip=.2,vn=450,js=1200,Io=1800,qA=7,XA=5,KA=300,Gp=.18,fo=1e3,YA=9,ZA=500,Rp=new ke("#ffffff"),Np=new Map;function Br(n,e){if("token"in n)return e[n.token];if("hue"in n){let i=Np.get(n.hue);return i===void 0&&(i=new ke(n.hue),Np.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 Ec(n){return 1.6+.45*Math.sqrt(Math.max(1,n))}function QA(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 k(Math.cos(a)*r*t,i*t,Math.sin(a)*r*t)}class JA{byKey=new Map;of(e){const t=Math.round(e*1e3);let s=this.byKey.get(t);return s===void 0&&(s=new xl(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 eD=2,tD=28,MM=1.8,sD=`
4140
4140
  attribute float radius;
4141
4141
  attribute float alpha;
4142
4142
  attribute vec3 tint;
@@ -4264,27 +4264,27 @@ void main() {
4264
4264
  float lit = smoothstep(0.0, 0.04, max(vColor.r, max(vColor.g, vColor.b)));
4265
4265
  float pulse = pulse_at(vAlong, vMode, vStart) * lit;
4266
4266
  gl_FragColor = vec4(vColor + vec3(1.0, 0.95, 0.8) * pulse * 1.3, min(1.0, opacity + pulse));
4267
- }`;function yM(n,e){const t=performance.now();return new jt({uniforms:{time:{value:t},opacity:{value:e.opacity},born:{value:t},cycle:{value:n}},vertexShader:cD,fragmentShader:dD,transparent:!0,depthWrite:!e.additive,...e.additive?{blending:Pi}:{}})}function vM(n,e,t){const s=e.length,i=new Float32Array(s*2),r=new Float32Array(s*2),a=new Float32Array(s*2);for(let o=0;o<s;o++)i[o*2]=e[o]??0,i[o*2+1]=e[o]??0,r[o*2]=t[o]??0,r[o*2+1]=t[o]??0,a[o*2+1]=1;n.setAttribute("aMode",new Ot(i,1)),n.setAttribute("aStart",new Ot(r,1)),n.setAttribute("aAlong",new Ot(a,1))}let Ac=null;function au(){return Ac===null&&(Ac=new Qu(1,1,1,10,1,!0)),Ac}function uD(n,e){const t=performance.now(),s=new jt({uniforms:{time:{value:t},opacity:{value:1},born:{value:t},cycle:{value:e}},vertexShader:_M,fragmentShader:wM,transparent:!0}),i=au().clone(),r=new Float32Array(n.length*3),a=new Float32Array(n.length),o=new Float32Array(n.length),l=new Ku(i,s,n.length),c=new W(0,1,0),d=new kt;return n.forEach((u,h)=>{const p=u.to.clone().sub(u.from),f=p.length();d.position.copy(u.from).addScaledVector(p,.5),d.quaternion.setFromUnitVectors(c,f>0?p.divideScalar(f):c),d.scale.set(u.width,f,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 ti(r,3)),i.setAttribute("aMode",new ti(a,1)),i.setAttribute("aStart",new ti(o,1)),l.instanceMatrix.needsUpdate=!0,l.frustumCulled=!1,l}function hD(n,e,t){const s=new Float32Array(n.length*6),i=new Float32Array(n.length*6);n.forEach((o,l)=>{s.set([o.from.x,o.from.y,o.from.z,o.to.x,o.to.y,o.to.z],l*6);const c=o.color.r*t.tint,d=o.color.g*t.tint,u=o.color.b*t.tint;i.set([c,d,u,c,d,u],l*6)});const r=new qt;r.setAttribute("position",new Ot(s,3)),r.setAttribute("aColor",new Ot(i,3)),vM(r,n.map(o=>o.mode),n.map(o=>o.start));const a=new eu(r,yM(e,t));return a.frustumCulled=!1,a}class fD{parent;stars=[];index=new Map;nebulaList=[];materials=[];layers=[];threads=null;threadMaterial=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=aD(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=oD(e,t);for(const i of this.materials){const r=i.uniforms.scale;r!==void 0&&(r.value=s)}}threads_draw(e,t,s=[],i){if(e.length===0)return;const r=new qt;r.setAttribute("position",new Ot(e,3));const a=new Ot(t,3);if(this.threads={attribute:a,base:Float32Array.from(t),ends:s},i===void 0){r.setAttribute("color",a),this.parent.add(new eu(r,new vl({vertexColors:!0,transparent:!0,opacity:ru,blending:Pi,depthWrite:!1})));return}r.setAttribute("aColor",a),vM(r,i.modes,i.starts),this.threadMaterial=yM(i.cycle,{opacity:ru,additive:!0});const o=new eu(r,this.threadMaterial);o.frustumCulled=!1,this.parent.add(o)}frame(e){const t=this.threadMaterial?.uniforms.time;t!==void 0&&(t.value=e)}threadsCarryWave(){return this.threadMaterial!==null}nebula_add(e,t,s,i,r){const a=new qu(new wl({map:bM(),color:i,transparent:!0,opacity:r?Ip/3:Ip,blending:Pi,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.threadMaterial=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 pD{parent;geometries=new JA;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 Zu(s,36):this.geometries.of(s),a=new Ai({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:To}:{},...i.fade!==void 0?{transparent:!0,opacity:i.fade}:{}}),o=new Ms(r,a);return i.flat===!0&&(a.transparent=!0,a.depthTest=!1,o.renderOrder=2),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 Ms(new xl(s,24,18),new Xu({color:i,transparent:!0,opacity:r?Tp*.4:Tp,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 qt().setFromPoints([s,i]);let c;a?(c=new Jd(l,new jO({color:r,dashSize:.25,gapSize:.18,transparent:!0,opacity:o?To:.9})),c.computeLineDistances()):c=new Jd(l,new vl({color:r,transparent:!0,opacity:o?To:.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 Ai)||(s.material.color=t,delete s.userData.lampBase)}select(e){for(const[t,s]of this.byId){if(!(s.material instanceof Ai))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 In&&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()}}function sh(n){return n==="live"?1:n==="done"||n==="failed"?2:0}class mD{host;sets=[];materials=[];glows=new Map;stale=!1;census=0;censusLines=0;constructor(e){this.host=e}materialCount(){return this.materials.length}censusCount(){return this.census}censusLineCount(){return this.censusLines}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 O of t){const S=this.host.node(O);if(S!==void 0){for(const b of S.parents){const v=this.host.node(b);v!==void 0&&s.has(b)&&a.push({fromId:b,from:v,toId:O,to:S,join:!1})}for(const b of S.joins){const v=this.host.node(b);v!==void 0&&s.has(b)&&a.push({fromId:b,from:v,toId:O,to:S,join:!0})}}}if(a.length===0)return;const o=new Map,l=(O,S=new Set)=>{const b=o.get(O);if(b!==void 0)return b;if(S.has(O))return 0;S.add(O);const v=this.host.node(O),E=v===void 0?[]:[...v.parents,...v.joins].filter(I=>s.has(I)),A=E.length===0?0:1+Math.max(...E.map(I=>l(I,S)));return o.set(O,A),A},c=performance.now(),d=new Float32Array(a.length*3),u=new Float32Array(a.length),h=new Float32Array(a.length),p=r.edge.clone().lerp(new ke("#ffffff"),.45),f=new Ku(au(),new jt({uniforms:{time:{value:c},opacity:{value:i},born:{value:c},cycle:{value:1}},vertexShader:_M,fragmentShader:wM,transparent:!0}),a.length),M=new W(0,1,0),g=new kt;let m=0;const _=[],w=new Map,z=new Set;a.forEach(({fromId:O,from:S,toId:b,to:v,join:E},A)=>{const I=v.position.clone().sub(S.position),G=I.length(),C=Math.max(.06,Math.min(S.radius,v.radius)*.34)*(e.thickness??1);g.position.copy(S.position).addScaledVector(I,.5),g.quaternion.setFromUnitVectors(M,G>0?I.clone().divideScalar(G):M),g.scale.set(C,G,C),g.updateMatrix(),f.setMatrixAt(A,g.matrix),_.push({from:O,to:b,width:C});const B=v.state==="failed"?r.error:E?r.join:p;d.set([B.r,B.g,B.b],A*3),u[A]=sh(v.state);const P=l(O);if(m=Math.max(m,P),h[A]=P*vn,u[A]===1&&z.add(b),u[A]===2){const L=h[A]+js/2;w.set(b,Math.min(w.get(b)??1/0,L)),P===0&&w.set(O,0)}}),f.instanceMatrix.needsUpdate=!0;const y=au().clone();if(y.setAttribute("aColor",new ti(d,3)),y.setAttribute("aMode",new ti(u,1)),y.setAttribute("aStart",new ti(h,1)),f.geometry=y,f.frustumCulled=!1,this.host.parent.add(f),e.tubes=f,f.material instanceof jt){this.materials.push(f.material);const O=f.material.uniforms.cycle;O!==void 0&&(O.value=(m+1)*vn+js/2+Io)}this.sets.push({mesh:f,edges:_,lamps:w,blinks:z,owner:e,entries:t,members:s})}census_build(e,t){if(e.length===0)return;const s=uD(e,(t+1)*vn+js/2+Io);this.host.parent.add(s),s.material instanceof jt&&this.materials.push(s.material),this.census=e.length}censusLines_build(e,t,s){if(e.length===0)return;const i=hD(e,(t+1)*vn+js/2+Io,s);this.host.parent.add(i),i.material instanceof jt&&this.materials.push(i.material),this.censusLines=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 W(0,1,0),t=new kt;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 jt){const t=e.material;this.materials=this.materials.filter(s=>s!==t),t.dispose()}}clear(){this.materials=[],this.census=0,this.censusLines=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 jt){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 jt))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)/ZA));for(const[u,h]of i){const p=l-h;this.lamp_paint(u,p<0?0:c,p>=0&&p<fo?p/fo:-1,t)}const d=(e%js+js)%js;for(const u of r){if(i.has(u))continue;const h=Math.max(0,1-d/(js*.8));this.lamp_paint(u,h*h,d<fo?d/fo:-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 Ai))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(Gp+(1-Gp)*Math.max(t,o)).lerp(Rp,Math.min(1,.22*t+.7*o)),s<0)return;let l=this.glows.get(e);l===void 0&&(l=new qu(new wl({map:bM(),color:a.clone().lerp(Rp,.35),transparent:!0,blending:Pi,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+YA*d)*r.scale.x),l.material.opacity=.9*(1-s)**1.5,l.visible=!0,i.add(e)}}class gD{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 W,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>qA?a.target=1:a.target===1&&l<XA&&(a.target=0),a.mix===a.target)continue;const c=i===0?1:i/KA;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 Ai&&(d.material.opacity=a.mix);if(a.tubes!==null&&a.tubes.material instanceof jt){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 MD{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 eh(1,1),a=new Ai({color:"#ffffff",roughness:.5,metalness:.1}),o=[],l=new Ku(r,a,t?1:i),c=new ke,d=new kt,u=new Map,h=new Map;let p=0,f=1;const M=new W;for(const _ of e)M.add(_.position);M.divideScalar(Math.max(1,e.length));for(const _ of e){if(_.ghost===!0)continue;const w=Math.max(1,_.count),z=w===1?0:_.radius*(1.6+.55*Math.cbrt(w)),y=w===1?_.radius:Math.max(.06,Math.min(_.radius*.5,2.2*z/Math.sqrt(w))),O=[];for(let S=0;S<w;S++){const b=w===1?_.position.clone():QA(S,w,z).add(_.position);O.push(b),c.set(_.color),t?o.push({id:_.id,position:b,radius:y,color:c.clone(),dim:_.dim,ember:_.ember}):(d.position.copy(b),d.scale.setScalar(y),d.updateMatrix(),l.setMatrixAt(p,d.matrix),l.setColorAt(p,c)),this.memberIds.push(_.id),this.memberPositions.push(b),p+=1,f=Math.max(f,M.distanceTo(b)+y)}u.set(_.id,O),h.set(_.id,y)}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{specs:g,deepest:m}=bD(e,u,h,s);return!t&&g.length>0&&g.length<=lD?this.host.tubes.census_build(g,m):g.length>0&&this.host.tubes.censusLines_build(g,m,t?{tint:1,opacity:ru,additive:!0}:{tint:1,opacity:.35,additive:!1}),{center:M,radius:f}}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=[]}}function bD(n,e,t,s){const i=new Map(n.map(d=>[d.id,d])),r=new Map,a=(d,u=new Set)=>{const h=r.get(d);if(h!==void 0)return h;if(u.has(d))return 0;u.add(d);const p=(i.get(d)?.parents??[]).filter(M=>i.has(M)),f=p.length===0?0:1+Math.max(...p.map(M=>a(M,u)));return r.set(d,f),f},o=s.edge.clone().lerp(new ke("#ffffff"),.45),l=[];let c=0;for(const d of n){const u=e.get(d.id)??[];for(const h of d.parents){const p=e.get(h);if(!p||p.length===0)continue;const f=Math.max(.02,Math.min(t.get(d.id)??.1,t.get(h)??.1)*.34),M=a(h)*vn;c=Math.max(c,a(h));for(let g=0;g<u.length;g++){const m=u[g],_=p.length===u.length?p[g]:p[g%p.length];_===void 0||m===void 0||l.push({from:_,to:m,width:f,color:d.state==="failed"?s.error:o,mode:sh(d.state),start:M})}}}return{specs:l,deepest:c}}const Bp=.028,_D=.25,zD="rgba(0, 0, 0, 0.7)",ia=48;class wD{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 ${ia}px sans-serif`;let u=t.length*ia*.6;if(c!==null&&(c.font=d,u=Math.ceil(c.measureText(t).width)),l.width=Math.max(1,u+ia),l.height=Math.round(ia*1.5),c!==null){c.font=d,c.textBaseline="middle";const M=l.height/4;c.fillStyle=zD,c.beginPath(),c.roundRect(0,0,l.width,l.height,M),c.fill(),c.fillStyle=`#${r.getHexString()}`,c.fillText(t,ia/2,l.height/2)}const h=new iM(l),p=new wl({map:h,transparent:!0,depthWrite:!1,depthTest:!1,sizeAttenuation:!1,opacity:a?_D:.9}),f=new qu(p);f.scale.set(Bp*(l.width/l.height),Bp,1),f.center.set(.5,0),f.position.set(s.x,s.y+i,s.z),f.renderOrder=4,f.visible=this.shown,this.parent.add(f),this.captions.get(e)?.texture.dispose(),this.captions.set(e,{sprite:f,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 W,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 yD=.0022,vD=.006,OD=.0035,xD=1e4,Cp=700,Pp=new W(0,1,0),SD={minDistance:8,margin:1.15,stance:"axis",farFloor:200,farScale:2};function ED(n){return n*n*(3-2*n)}class AD{camera;world;clock;focus=new W;flight=null;home=null;holding=!1;touched=!1;spinIdleUntil=0;tumbleAxis=new W(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()+xD}eyeDistance(){return this.camera.position.distanceTo(this.focus)}turn_about(e,t){const s=new Fi().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(Pp,e*.005),this.turn_about(new W().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 W),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 W().setFromMatrixColumn(this.camera.matrixWorld,0).multiplyScalar(-e*s).add(new W().setFromMatrixColumn(this.camera.matrixWorld,1).multiplyScalar(t*s));this.camera.position.add(i),this.focus.add(i)}frame(e,t,s={}){const i={...SD,...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 W;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,p)=>h-p),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),Cp,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(),Cp,()=>{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=ED(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(Pp,yD)}tumble_step(){this.tumblePhase+=OD,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,vD)}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 OM=4,DD=350,TD=30,ID=600,GD=400;class RD{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<ID||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<=DD&&Math.hypot(e.clientX-s.x,e.clientY-s.y)<=TD){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},GD),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)>OM&&(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 ND=14,BD=4;class CD{camera;world;element;sources;starGlow;raycaster=new YO;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 et((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 Ms?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 wt().multiplyMatrices(this.camera.matrixWorldInverse,this.world.matrixWorld),u=new wt().multiplyMatrices(this.camera.projectionMatrix,c).elements,h=c.elements,p=m=>{const _=-(h[2]*m.x+h[6]*m.y+h[10]*m.z+h[14]);if(_<=0)return null;const w=u[3]*m.x+u[7]*m.y+u[11]*m.z+u[15],z=(u[0]*m.x+u[4]*m.y+u[8]*m.z+u[12])/w,y=(u[1]*m.x+u[5]*m.y+u[9]*m.z+u[13])/w;return{x:(z+1)/2*r.width,y:(1-y)/2*r.height,depth:_}},f=t?ND:BD;let M=null,g=1/0;for(const m of s){if(m.dim)continue;const _=p(m.position);if(_===null)continue;const w=Math.max(f,this.starGlow*m.radius*l/_.depth),z=Math.hypot(_.x-a,_.y-o);if(z>w)continue;const y=z/w;y<g&&(g=y,M=m.id)}if(M!==null)return M;for(const m of i){const _=p(m.position);if(_!==null&&Math.hypot(_.x-a,_.y-o)<=m.radius*l/_.depth)return m.id}return null}}const PD=3e4,LD=900;class WD{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)/PD*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)/LD;r>=1?(this.flashes.delete(s),t.set(s,0)):t.set(s,1-r)}return t}}function kD(n){const e=new Set(n.map(o=>o.id)),t=o=>!o.parentIds.some(l=>e.has(l)),s=n.filter(t),i=n.filter(o=>!t(o));if(s.length===0||i.length===0)return!1;const r=Math.min(...s.map(o=>o.y)),a=Math.max(...i.map(o=>o.y));return r>=a-1e-6}function UD(n,e){const t=new Set(n.filter(r=>r.ghost===!0||r.halo===!0).map(r=>r.id)),s=[];let i=null;for(const r of n){if(t.has(r.id))continue;const a=e.get(r.id);if(a!==void 0)for(const o of r.parentIds){if(t.has(o))continue;const l=e.get(o);if(l===void 0)continue;const c=Math.hypot(a.x-l.x,a.y-l.y,a.z-l.z);s.push(c),(i===null||c>i.length)&&(i={length:c,from:o,to:r.id})}}return s.length===0||i===null?{}:(s.sort((r,a)=>r-a),{edgeMedian:(s[Math.floor(s.length/2)]??0).toFixed(1),edgeLongest:`${i.length.toFixed(1)}(${i.from}->${i.to})`})}const FD=90*400,jD=12;function xM(n){const e={id:n.id,parents:[...n.parentIds,...n.joinParentIds]};return n.metric!==void 0&&(e.metric=n.metric),e}function $D(n){const e=Gu(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 W(...i?.position??[0,0,0]),radius:i?.radius??Tt}})}function SM(n){return Mg(n.map(xM))}function EM(n,e=3,t=new Map,s=ii,i=new Set){const r=new Map([...t].map(([o,l])=>[o,[l.x,l.y,l.z]])),a=bg(n.map(xM),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 W(...o.position),radius:o.radius}))}}function VD(n,e=3,t=new Map,s=ii,i=new Set){const r=EM(n,e,t,s,i);return r.step(r.total),r.place()}function HD(n,e,t){const s=new Map(n.map(o=>[o.node.id,o])),i=new Map;for(const o of n)for(const l of o.node.parentIds)i.set(l,[...i.get(l)??[],o]);const r=o=>{const l=i.get(o)??[];if(l.length===0)return null;const c=new W;for(const d of l)c.add(d.position);return c.divideScalar(l.length)},a=[];for(const{node:o,position:l,radius:c}of n){if(o.caption!==void 0){const d=o.ghost===!0?r(o.id):null,u=d!==null?0:o.halo===!0?Ec(o.count??1):c;t.labels.caption_add(o.id,o.caption,d??l,u,e.done,o.dim===!0,o.count??1)}if(!(o.ghost===!0&&o.halo!==!0)){if(t.starring&&o.solid!==!0){if(o.halo===!0){t.stars.nebula_add(o.id,l,Ec(o.count??1),e.edge,o.dim===!0);continue}a.push({id:o.id,position:l.clone(),radius:c,color:Br(o.look.paint,e).clone(),dim:o.dim===!0,ember:o.look.ember,...o.ring===!0?{ring:!0}:{}});continue}if(o.halo===!0){t.spheres.halo_add(o.id,l,Ec(o.count??1),e.edge,o.dim===!0);continue}t.spheres.sphere_add(o.id,l,c,{color:Br(o.look.paint,e),dim:o.dim===!0,selected:o.id===t.selected,flat:t.flat})}}return{starred:a,byId:s}}function qD(n,e,t,s){const i=[],r=[],a=f=>!s.starring||f.node.solid===!0,o=[],l=[],c=[];let d=0;const u=new Map,h=(f,M=new Set)=>{const g=u.get(f);if(g!==void 0)return g;if(M.has(f))return 0;M.add(f);const m=e.get(f)?.node,_=m===void 0?[]:[...m.parentIds,...m.joinParentIds].filter(z=>e.get(z)?.node.ghost!==!0&&e.has(z)),w=_.length===0?0:1+Math.max(..._.map(z=>h(z,M)));return u.set(f,w),w},p=(f,M,g,m,_,w)=>{const z=m?.35:1,y=i.length/6;i.push(f.x,f.y,f.z,M.x,M.y,M.z),o.push(w,_.id),r.push(g.r*z,g.g*z,g.b*z,g.r*z,g.g*z,g.b*z);const O=m?0:sh(_.look.state),S=O===0?0:h(w);d=Math.max(d,S),l.push(O),c.push(S*vn);const b=m||s.handoffKey===void 0?null:s.handoffKey(_);b!==null&&s.handoff.thread_note(b,y)};for(const f of n){const{node:M,position:g}=f;if(M.ghost!==!0){for(const m of M.parentIds){const _=e.get(m);if(!_||_.node.ghost===!0)continue;const w=M.dim===!0||_.node.dim===!0;a(f)&&a(_)?!s.starring&&w&&s.spheres.edge_add(m,M.id,_.position,g,t.edge,!1,w):p(_.position,g,t.edge,w,M,m)}for(const m of M.joinParentIds){const _=e.get(m);if(!_)continue;if(M.joinFaint===!0){p(_.position,g,t.join,!0,M,m);continue}const w=M.dim===!0||_.node.dim===!0;a(f)&&a(_)?!s.starring&&w&&s.spheres.edge_add(m,M.id,_.position,g,t.join,!0,w):p(_.position,g,t.join,w,M,m)}}}s.stars.threads_draw(i,r,o,{modes:l,starts:c,cycle:(d+1)*vn+js/2+Io})}function XD(n,e,t,s,i){const r=n.filter(z=>e.has(z.id)),a=new Map;if(r.length===0)return a;const o=new W;for(const z of r)o.add(e.get(z.id));o.divideScalar(r.length);const l=t.clone().normalize(),c=new W().crossVectors(s,l);c.lengthSq()<1e-9&&c.set(1,0,0).cross(l),c.normalize();const d=new W().crossVectors(l,c).normalize(),u=new Map;for(const z of r){const y=e.get(z.id).clone().sub(o);u.set(z.id,new W(y.dot(c),y.dot(d),0))}const h=new Set(r.map(z=>z.id)),p=r.map(z=>({...z,parentIds:z.parentIds.filter(y=>h.has(y)),joinParentIds:z.joinParentIds.filter(y=>h.has(y))})),f=VD(p,2,u,{...i,gravity:!1}),M=new W;for(const z of f)M.add(z.position);M.divideScalar(f.length);const g=z=>Math.sqrt(z.reduce((y,O)=>y+O*O,0)/Math.max(1,z.length)),m=g(r.map(z=>e.get(z.id).distanceTo(o))),_=g(f.map(z=>Math.hypot(z.position.x-M.x,z.position.y-M.y))),w=_>1e-9&&m>1e-9?m/_:1;for(const z of f){const y=(z.position.x-M.x)*w,O=(z.position.y-M.y)*w;a.set(z.node.id,o.clone().addScaledVector(c,y).addScaledVector(d,O))}return a}class KD{restore=null;active(){return this.restore!==null}clear(){this.restore=null}set(e,t,s,i,r){if(e===null||e.length===0){if(this.restore===null)return!1;for(const[u,h]of this.restore)s.set(u,h);return this.restore=null,!0}if(this.restore!==null)return!1;const a=new Set(e),o=i.world.quaternion.clone().invert(),l=i.camera.position.clone().sub(i.focus).normalize().applyQuaternion(o),c=new W(0,1,0).applyQuaternion(i.camera.quaternion).applyQuaternion(o),d=XD(t.filter(u=>a.has(u.id)),s,l,c,r);if(d.size===0)return!1;this.restore=new Map([...d.keys()].map(u=>[u,s.get(u).clone()]));for(const[u,h]of d)s.set(u,h);return!0}}class YD{ports;constructor(e){this.ports=e}ids(){return[...this.ports.meshes().keys(),...this.ports.stars.ids()]}world_of(e){const t=this.ports.meshes().get(e);if(t!==void 0){const i=t.geometry;return i.boundingSphere===null&&i.computeBoundingSphere(),{position:t.getWorldPosition(new W),radius:i.boundingSphere?.radius??Tt}}const s=this.ports.stars.entry(e);return s!==void 0?{position:this.ports.group.localToWorld(s.position.clone()),radius:s.radius}:null}diveTarget_of(e){const t=this.ports.meshes().get(e),s=t===void 0?this.ports.census.ids().indexOf(e):-1;return t===void 0&&s<0?null:(this.ports.group.updateMatrixWorld(!0),t!==void 0?t.getWorldPosition(new W):this.ports.group.localToWorld((this.ports.census.positions()[s]??new W).clone()))}reaches_of(e){const t=new Set(e),s=[];this.ports.group.updateMatrixWorld(!0);for(const i of this.ids()){if(t.size>0&&!t.has(i))continue;const r=this.world_of(i);r!==null&&s.push(r)}return s}}function ZD(n,e){return n.map(t=>{const s=t.node;return{id:s.id,position:t.position,radius:t.radius,count:Math.max(1,s.count??1),color:Br(s.look.paint,e),dim:s.dim===!0,ember:s.look.ember,state:s.look.state,parents:s.parentIds,ghost:s.ghost===!0}})}function QD(n,e){return{position:n.position,radius:n.radius,color:Br(n.node.look.paint,e)}}function JD(n){return{position:n.position,radius:n.radius,parents:n.node.parentIds,joins:n.node.joinFaint===!0?[]:n.node.joinParentIds,state:n.node.look.state}}function eT(n,e){return e.updateMatrixWorld(!0),n.updateMatrixWorld(),new wt().multiplyMatrices(n.matrixWorldInverse,e.matrixWorld)}function tT(n,e){return n/(2*Math.tan(e*Math.PI/360))}const Dc=.5;class sT{ports;busy=!1;constructor(e){this.ports=e}moving(){return this.busy}frame(e,t,s,i,r){this.busy=!0,this.ports.flyToFit(e,t,()=>{this.busy=!1,s()},i,r)}relight(e,t,s,i,r){this.busy=!0,this.ports.graph_set(e,{wave:!1,fit:!1,frozen:e.nodes.map(a=>a.id)}),r?.(),this.ports.flyToFit(t,s,()=>{this.busy=!1,i()})}unfold(e,t){this.busy=!0;const s=this.ports.positions_get(),i=nT(s,e.from),r=this.ports.random??(()=>Math.random()-.5);for(const l of e.unfolding){const c=e.placed?.[l];s[l]=c!==void 0?[i[0]+c[0],i[1]+c[1],i[2]+c[2]]:[i[0]+r()*Dc,i[1]+r()*Dc,i[2]+r()*Dc]}this.ports.positions_seed(s);const a=new Set(e.unfolding.filter(l=>e.placed?.[l]===void 0)),o=e.graph.nodes.filter(l=>!a.has(l.id)).map(l=>l.id);this.ports.graph_set(e.graph,{wave:!1,fit:!1,frozen:o,...e.physics!==void 0?{physics:e.physics}:{}}),e.drawn?.(),this.ports.flyToFit(e.frame,e.durationMs,()=>{this.busy=!1,t()},e.bulk,e.margin)}descent(e,t,s,i){this.busy=!0;const r=()=>{t().then(a=>{if(this.ports.alive()){if(a===null){this.busy=!1,i();return}this.unfold(a,s)}})};"toward"in e?this.ports.flyToward(e.toward,e.distance,e.durationMs,r):this.ports.flyToFit(e.fit,e.durationMs,r)}}function nT(n,e){for(const t of e){const s=[0,0,0];let i=0;for(const r of t){const a=n[r];a!==void 0&&(s[0]+=a[0],s[1]+=a[1],s[2]+=a[2],i+=1)}if(i>0)return[s[0]/i,s[1]/i,s[2]/i]}return[0,0,0]}const iT=1e3;class rT{workerOf;generation;worker=null;disposed=!1;constructor(e,t){this.workerOf=e,this.generation=t}dispose(){this.disposed=!0,this.worker?.terminate(),this.worker=null}run(e){const t=SM(e.nodes),s=new Map([...e.seeds].map(([d,u])=>[d,[u.x,u.y,u.z]])),i=uy(e.nodes,e.keyOf,s,e.frozen),r=iT,a=i.length;e.progress(0,r,a);const o=d=>{e.placed(e.nodes.map(u=>{const h=d[u.id]??[0,0,0];return{node:u,position:new W(h[0],h[1],h[2]),radius:t.get(u.id)??Tt}})),e.progress(r,r,a)},l=d=>e.progress(Math.min(r-1,Math.floor(d*r)),r,a);if(this.worker===null){if(this.workerOf===void 0){const d=Ly(e.arrangement);if(d===void 0){console.error(`layout: no engine named ${e.arrangement}`),e.progress(r,r,a);return}o(d.run({nodes:i,physics:e.physics},l).positions);return}this.worker=this.workerOf()}const c=this.worker;c.onmessage=d=>{const u=d.data;if(!(u.generation!==this.generation()||this.disposed)){if(u.type==="progress"){l(u.fraction??0);return}if(u.type==="failed"){console.error(`layout: ${u.reason??"the engine failed"}`),e.progress(r,r,a);return}o(u.positions??{})}},c.postMessage({generation:e.generation,nodes:i,physics:e.physics,arrangement:e.arrangement})}}const ra=700,aT=2500;function oT(n){const e=new Map,t=new Set(n.map(r=>r.id)),s=r=>r.look.waved;let i=!1;for(;!i;){i=!0;for(const r of n){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),-vn);e.set(r.id,o+vn),i=!1}}return e}class lT{ports;color=new ke("#48d8f0");times=new Map;startAt=null;looping=!1;constructor(e){this.ports=e}start(){this.times=oT(this.ports.nodes()),this.startAt=this.times.size>0?this.now():null}loop_set(e){this.looping=e,e&&this.start()}loop_get(){return this.looping}animate(){if(this.startAt===null)return;const e=this.now()-this.startAt;let t=0;const s=this.ports.census();if(s!==null){t=s.flare(r=>this.times.get(r),e,this.color,ra),e>t+ra&&(this.startAt=this.renewal());return}const i=this.ports.selected();for(const[r,a]of this.times){t=Math.max(t,a);const o=this.ports.mesh(r);if(o===void 0||!(o.material instanceof Ai))continue;const l=e-a,c=l>=0&&l<=ra?Math.sin(l/ra*Math.PI):0;o.scale.setScalar(1+c*.45),c>0?(o.material.emissive.copy(this.color),o.material.emissiveIntensity=c*1.2):(o.material.emissive.setScalar(r===i?1:0),o.material.emissiveIntensity=r===i?.35:0)}e>t+ra&&(this.startAt=this.renewal())}now(){return(this.ports.now??Date.now)()}renewal(){return this.ports.ambient||this.looping?this.now()+aT:null}}class cT{ports;running=null;constructor(e){this.ports=e}active(){return this.running!==null}begin(e,t=1){const s=new WD(e,this.ports.now??Date.now);this.running={clock:s,arrivals:e,shown:new Set},this.ports.redraw(),this.paintAll(),s.play(t)}play(e){this.running?.clock.play(e)}pause(){this.running?.clock.pause()}seek(e){this.running!==null&&this.apply(this.running.clock.seek(e))}stop(){this.running!==null&&(this.running=null,this.ports.redraw())}state(){return this.running===null?null:{playing:this.running.clock.playing(),at:this.running.clock.at(),span:this.running.clock.span()}}step(){const e=this.running;if(e===null)return;const t=e.clock.playing(),s=e.clock.step();this.apply(s);for(const[i,r]of e.clock.flashing())this.ports.stars.flash_set(i,r);this.ports.stars.flush(),(t||s.arrived.length>0)&&this.ports.moved?.(s.at,e.clock.playing())}paintAll(){const e=this.running;if(e===null)return;const t=[...e.arrivals.keys()].filter(s=>!e.shown.has(s));this.ports.stars.presence_set(t,0),this.ports.stars.presence_set(e.shown,1),this.ports.stars.threads_present(s=>e.shown.has(s)||!e.arrivals.has(s)),this.ports.stars.flush()}apply(e){const t=this.running;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.ports.stars.flash_set(s,0);this.ports.stars.presence_set(e.arrived,1),this.ports.stars.presence_set(e.departed,0),this.ports.stars.threads_present(s=>t.shown.has(s)||!t.arrivals.has(s)),this.ports.stars.flush()}}}class dT{ports;drag=null;pull=null;returns=[];constructor(e){this.ports=e}dragging(){return this.drag!==null}clear(){this.drag=null,this.pull=null}positions(){return this.pull?.positions()??[]}begin(e){const t=this.ports.picker.mesh_under(e),s=t?.userData.nodeId;if(t===null||typeof s!="string")return!1;const i=this.ports.camera.getWorldDirection(new W).negate();this.ports.group.updateMatrixWorld(!0);const r=new Vn().setFromNormalAndCoplanarPoint(i,t.getWorldPosition(new W));return this.drag={nodeId:s,plane:r,startX:e.clientX,startY:e.clientY,moved:!1,solo:this.ports.solo(),home:t.position.clone()},!0}move(e){if(this.drag===null||(this.ports.spin_pause(),!this.drag.moved&&Math.abs(e.clientX-this.drag.startX)+Math.abs(e.clientY-this.drag.startY)>OM&&(this.drag.moved=!0,this.drag.solo||this.simulation_begin(this.drag.nodeId)),!this.drag.moved))return!1;const t=new W;if(this.ports.picker.ray_aim(e).ray.intersectPlane(this.drag.plane,t)===null)return!1;if(this.ports.group.worldToLocal(t),this.drag.solo){const s=this.ports.meshes().get(this.drag.nodeId);return s===void 0?!1:(s.position.copy(t),!0)}return this.pull?.pin([t.x,t.y,t.z]),!1}end(){if(this.drag===null)return!1;const e=this.drag.moved;if(this.drag.solo&&this.drag.moved){const t=this.ports.meshes().get(this.drag.nodeId);t!==void 0&&this.returns.push({mesh:t,from:t.position.clone(),to:this.drag.home.clone(),startedAt:this.now()})}return this.pull?.release(),this.drag=null,e}step(){const e=this.now();let t=!1;return this.pull!==null&&(this.pull.step(this.drag!==null)?t=!0:this.pull=null),this.returns.length>0&&(this.returns=this.returns.filter(s=>{const i=Math.min(1,(e-s.startedAt)/300),r=i*i*(3-2*i);return s.mesh.position.lerpVectors(s.from,s.to,r),i<1}),t=!0),t}now(){return(this.ports.now??Date.now)()}simulation_begin(e){const t=this.ports.nodes(),s=SM(t),i=[...this.ports.meshes()].map(([a,o])=>({id:a,position:[o.position.x,o.position.y,o.position.z],radius:s.get(a)??Tt,dim:o.userData.dim===!0,halo:o.userData.halo===!0})),r=[];for(const a of t)for(const o of[...a.parentIds,...a.joinParentIds])r.push({from:o,to:a.id});this.pull=new Ay({grabbed:e,nodes:i,edges:r,dimensions:this.ports.dimensions(),baseRadius:Tt})}}const uT=1500;class hT{ports;tip;hovered=null;tapTimer=null;constructor(e,t){this.ports=t,this.tip=document.createElement("div"),this.tip.className="dag-node-tip",this.tip.hidden=!0,e.appendChild(this.tip)}hide(){this.tip.hidden=!0}leave(e){if(this.hovered=null,e.pointerType==="touch"&&!this.tip.hidden){this.tapTimer!==null&&window.clearTimeout(this.tapTimer),this.tapTimer=window.setTimeout(()=>{this.tapTimer=null,this.ports.fingersDown()===0&&(this.tip.hidden=!0)},uT);return}this.tip.hidden=!0}hover(e){const t=this.ports.picker.node_under(e,this.ports.pressKind()==="touch"),s=t===null?void 0:this.ports.nodes().find(r=>r.id===t);if(s===void 0){this.tip.hidden=!0,this.ports.canvas.style.cursor="",this.hovered=null;return}this.hovered={id:s.id,x:e.clientX,y:e.clientY};const i=this.ports.canvas.getBoundingClientRect();this.tip.textContent=this.ports.words(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.ports.canvas.style.cursor="pointer"}pick(e,t){const s=this.hovered,i=s!==null&&Math.hypot(e.clientX-s.x,e.clientY-s.y)<=6?s.id:this.ports.picker.node_under(e,this.ports.pressKind()==="touch");if(i===null){t==="select"&&this.ports.selected_get()!==null&&(this.ports.selected_set(null),this.ports.selection_paint(),this.ports.deselect?.());return}const r=this.ports.nodes().find(a=>a.id===i);r&&(t==="select"?(this.ports.selected_set(i),this.ports.census()||this.ports.selection_paint(),this.ports.select?.(r)):this.ports.activate?.(r))}}function fT(){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")}}class pT{container;handlers;paletteOf;ambient;renderer;scene;camera;group=new ha;picker;spheres=new pD(this.group);get meshes(){return this.spheres.map}starField=new fD(this.group);labels=new wD(this.group);tubes=new mD({parent:this.group,node:e=>this.tubeNode_of(e),sphere:e=>this.meshes.get(e),palette:()=>this.palette_read()});handoffField=new gD({spheres:this.spheres,stars:this.starField,tubes:this.tubes,look:e=>this.handoffLook_of(e)});censusField=new MD({parent:this.group,stars:this.starField,tubes:this.tubes,starsView:()=>({pixelRatio:window.devicePixelRatio,heightPx:this.renderer.domElement.height,fovDeg:this.camera.fov})});drawn=new YD({meshes:()=>this.meshes,stars:this.starField,census:this.censusField,group:this.group});flights=new sT({positions_get:()=>this.positions_get(),positions_seed:e=>this.positions_seed(e),graph_set:(e,t)=>this.graph_set(e,t),flyToFit:(e,t,s,i,r)=>this.camera_flyToFit(e,t,s,i,r),flyToward:(e,t,s,i)=>this.camera_flyToward(e,t,s,i),alive:()=>!this.disposed});hierarchy;wave;replay;grab;hover=null;rig;gestures=null;lastPositions=new Map;frozen=new Set;physicsOnce=void 0;census=!1;physics={...ii};graph={nodes:[]};drawMode="spheres";placedById=new Map;fits=0;strategy="ranked";selectedId=null;frameHandle=null;disposed=!1;projection="3d";flat=new KD;rebuildGen=0;slicing=!1;arrangement="galaxy";arrangementMemory=new Map;constructor(e,t={},s={}){this.container=e,this.handlers=t,this.paletteOf=s.palette??fT,this.hierarchy=new rT(s.layoutWorker,()=>this.rebuildGen),this.ambient=s.ambient===!0,this.renderer=new HA({antialias:!0,alpha:!0}),this.renderer.setPixelRatio(window.devicePixelRatio),this.renderer.domElement.classList.add("dag-scene-canvas"),this.scene=new yO,this.camera=new Rs(50,1,.1,200),this.camera.position.set(0,0,14),this.rig=new AD(this.camera,this.group),this.picker=new CD(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},MM),this.wave=new lT({nodes:()=>this.graph.nodes,mesh:r=>this.meshes.get(r),census:()=>this.census&&this.censusField.drawn()?this.censusField:null,selected:()=>this.selectedId,ambient:this.ambient}),this.replay=new cT({stars:this.starField,redraw:()=>this.rebuild(!1,"hold"),...t.replay!==void 0?{moved:t.replay}:{}}),this.grab=new dT({picker:this.picker,camera:this.camera,group:this.group,meshes:()=>this.meshes,nodes:()=>this.graph.nodes,solo:()=>this.strategy==="ranked",dimensions:()=>this.projection==="2d"?2:3,spin_pause:()=>this.rig.spin_pause()}),this.scene.add(new qO(16777215,.9));const i=new HO(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.hover=this.pointer_wire(e)),new ResizeObserver(()=>this.size_fit()).observe(e),this.tick()}pointer_wire(e){const t=new hT(e,{picker:this.picker,canvas:this.renderer.domElement,nodes:()=>this.graph.nodes,pressKind:()=>this.gestures?.pressKind(),fingersDown:()=>this.gestures?.fingersDown()??0,words:s=>this.handlers.tip?.(s)??null,census:()=>this.census,selected_get:()=>this.selectedId,selected_set:s=>{this.selectedId=s},selection_paint:()=>this.selection_paint(),...this.handlers.select!==void 0?{select:this.handlers.select}:{},...this.handlers.activate!==void 0?{activate:this.handlers.activate}:{},...this.handlers.deselect!==void 0?{deselect:this.handlers.deselect}:{}});return this.gestures=new RD(this.renderer.domElement,this.rig,{grab_begin:s=>this.grab.begin(s),grab_move:s=>{this.grab.move(s)&&this.positions_sync()},grab_end:()=>this.grab.end(),hover:s=>t.hover(s),leave:s=>t.leave(s),tap:(s,i)=>t.pick(s,i),tip_hide:()=>t.hide(),gesture_end:()=>this.handlers.gesture_end?.()},{flat:()=>this.projection==="2d",untethered:()=>this.census}),t}tick(){if(this.disposed)return;this.ambient?(this.rig.tumble_step(),this.wave.animate()):(this.rig.spin_step(!(this.gestures?.pointerOver()??!1)&&this.projection==="3d"&&!this.flat.active()),this.grab.step()&&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();const e=performance.now();this.tubes.frame(e),this.starField.frame(e),this.labels.declutter(this.camera),this.renderer.render(this.scene,this.camera),this.frameHandle=window.requestAnimationFrame(()=>this.tick())}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_set(e,t={}){this.graph=e,this.flat.clear(),this.frozen=new Set(t.frozen??[]),this.physicsOnce=t.physics,this.rebuild(t.fit!==!1,t.settle??"full"),t.wave!==!1&&this.wave.start()}waveLoop_set(e){this.wave.loop_set(e)}waveLoop_get(){return this.wave.loop_get()}wave_start(){this.wave.start()}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 W(s,i,r)]))}flight_into(e,t){if(this.rig.flying()||this.rig.holding_get())return;const s=this.drawn.diveTarget_of(e);s!==null&&this.rig.flyInto(s,t)}camera_flyToFit(e,t,s,i=1,r=1.15){this.rig.flyToFit(this.drawn.reaches_of(e),t,s,i,r)}camera_distance(){return this.rig.eyeDistance()}camera_touched(){return this.rig.touched_get()}moving(){return this.flights.moving()}frame(e,t,s=()=>{},i,r){this.flights.frame(e,t,s,i,r)}relight(e,t,s,i=()=>{},r){this.flights.relight(e,t,s,i,r)}unfold(e,t=()=>{}){this.flights.unfold(e,t)}descent(e,t,s=()=>{},i=()=>{}){this.flights.descent(e,t,s,i)}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(),censusLines:this.tubes.censusLineCount(),censusMembers:this.census?this.censusField.ids().length:0,handoffGroups:this.handoffField.size(),handoffSolid:this.handoffField.solidCount(),camera:this.rig.eyeDistance().toFixed(1),settling:this.slicing,...UD(this.graph.nodes,this.lastPositions)}}camera_flyToward(e,t,s,i){const r=this.drawn.world_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)}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_set(e){this.projection=e,e==="2d"&&this.group.quaternion.identity(),this.rebuild()}projection_get(){return this.projection}flat_set(e){this.flat.set(e,this.graph.nodes,this.lastPositions,{camera:this.camera,focus:this.rig.focus,world:this.group},this.physics)&&this.rebuild(!1,"hold")}flat_get(){return this.flat.active()}look_update(e,t){const s=this.graph.nodes.find(i=>i.id===e);s&&(s.look=t,this.spheres.recolor(e,Br(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.hierarchy.dispose(),this.frameHandle!==null&&window.cancelAnimationFrame(this.frameHandle),this.gestures?.detach(),this.renderer.dispose(),this.renderer.domElement.remove(),this.spheres.dispose()}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 W(a,o,l)]))),this.lastPositions=i??new Map,s&&this.rebuild(!0,i===void 0?"full":"hold")}arrangement_get(){return this.arrangement}replay_begin(e,t=1){this.replay.begin(e,t)}replay_play(e){this.replay.play(e)}replay_pause(){this.replay.pause()}replay_seek(e){this.replay.seek(e)}replay_stop(){this.replay.stop()}replay_state(){return this.replay.state()}censusBuild(e,t,s=!0){const i=ZD(e,t),r=this.censusField.build(i,this.drawMode==="stars",t);this.renderer.domElement.dataset.census=String(this.censusField.ids().length);const 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 W;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)}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($D(this.graph.nodes),e);return}let i=this.frozen;if(t!=="full"&&i.size===0){const l=this.graph.nodes.map(c=>c.id).filter(c=>this.lastPositions.has(c));l.length>0&&(i=new Set(l))}const r=EM(this.graph.nodes,this.projection==="2d"?2:3,this.lastPositions,this.physics_current(),i);if(r.moving===0){this.draw(r.place(),e);return}const a=this.handlers.progress,o=r.total*r.moving<FD;if((!o||this.arrangement!=="galaxy")&&a!==void 0&&this.handlers.handoffKey!==void 0&&this.frozen.size===0){this.hierarchy_run(s,e,i,a);return}if(a===void 0||o){r.step(r.total),this.draw(r.place(),e);return}this.settle_slice(r,s,e,a)}physics_current(){return this.physicsOnce!==void 0?{...this.physics,...this.physicsOnce}:this.physics}settle_slice(e,t,s,i){const r=this.graph.nodes.length;let a=0;this.slicing=!0,i(0,e.total,r);const o=()=>{if(t!==this.rebuildGen||this.disposed)return;const l=performance.now();for(;a<e.total&&performance.now()-l<jD;)e.step(1),a+=1;if(a<e.total){i(a,e.total,r),window.requestAnimationFrame(o);return}this.slicing=!1,this.draw(e.place(),s),i(e.total,e.total,r)};window.requestAnimationFrame(o)}hierarchy_run(e,t,s,i){const r=this.handlers.handoffKey;r!==void 0&&(this.slicing=!0,this.hierarchy.run({generation:e,nodes:this.graph.nodes,keyOf:r,seeds:this.lastPositions,frozen:s,physics:this.physics_current(),arrangement:this.arrangement,progress:(a,o,l)=>{a===o&&(this.slicing=!1),i(a,o,l)},placed:a=>{this.slicing=!1,this.draw(a,t)}}))}draw(e,t){const s=this.drawn_clear(e);if(this.census){const c=e.filter(d=>d.node.solid===!0&&d.node.ghost!==!0);this.censusBuild(e.filter(d=>d.node.solid!==!0),s,t),c.length>0&&this.solid_draw(c,s);return}!this.ambient&&t&&this.camera_fit(e);const i=this.drawMode==="stars",r=i&&!this.replay.active()?this.handlers.handoffKey:void 0,a={spheres:this.spheres,labels:this.labels,stars:this.starField,handoff:this.handoffField,selected:this.selectedId,flat:this.projection==="2d",starring:i,handoffKey:r},o=HD(e,s,a);o.starred.length>0&&this.starField.draw(o.starred,window.devicePixelRatio,this.renderer.domElement.height,this.camera.fov);for(const c of e)this.placedById.set(c.node.id,c);if(r!==void 0){const c=new Map(this.graph.nodes.map(d=>[d.id,d]));this.handoffField.gather(o.starred,d=>{const u=c.get(d);return u===void 0?null:r(u)})}qD(e,o.byId,s,a);const l=e.filter(c=>c.node.ghost!==!0&&c.node.halo!==!0&&(i?c.node.solid===!0||c.node.tubed===!0:c.node.dim!==!0)).map(c=>c.node.id);if(l.length>0){const d={tubes:null,mix:1,...!i||e.some(u=>u.node.solid===!0&&l.includes(u.node.id))?{}:{thickness:.25}};this.tubes.build(d,l,new Set(l))}this.renderer.domElement.dataset.rootsTop=kD(e.filter(c=>c.node.dim!==!0&&c.node.ghost!==!0&&c.node.halo!==!0).map(c=>({id:c.node.id,parentIds:c.node.parentIds,y:c.position.y})))?"yes":"no",this.replay.active()&&this.replay.paintAll()}drawn_clear(e){this.group.clear(),this.spheres.clear(),this.censusField.clear(),this.renderer.domElement.dataset.census="0",this.grab.clear(),this.starField.clear(),this.labels.clear(),this.handoffField.clear(),this.placedById=new Map,this.tubes.clear();const t=this.palette_read();if(this.wave.color=t.pulse,this.lastPositions=new Map(e.map(s=>[s.node.id,s.position.clone()])),this.projection==="2d")for(const s of e)s.position.z=0;return t}handoff_step(){if(this.handoffField.size()===0)return;const e=this.renderer.domElement.clientHeight||1;this.handoffField.step(eT(this.camera,this.group),tT(e,this.camera.fov),performance.now())}handoffLook_of(e){const t=this.placedById.get(e);return t===void 0?void 0:QD(t,this.palette_read())}tubeNode_of(e){const t=this.placedById.get(e);return t===void 0?void 0:JD(t)}positions_sync(){for(const{id:e,position:t}of this.grab.positions())this.meshes.get(e)?.position.set(...t),this.lastPositions.set(e,new W(...t));this.tubes.follow(),this.spheres.edges_follow()}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:Br(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))}}const AM=new Set(["created","waiting","scheduled","started","registeringFiles"]);function mT(n){return n.status!==void 0&&AM.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 gT(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"}:AM.has(n.status)?{token:"running"}:{token:"unknown"}}function Lp(n){return{state:mT(n),paint:gT(n),ember:n.share!==void 0&&n.share>0||n.status==="finishedWithError",waved:n.status===void 0||n.status==="finishedSuccessfully"||n.status==="finishedWithError"}}function MT(){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 Al extends pT{byId=new Map;constructor(e,t={},s={}){const i={palette:MT,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:Lp(i)}));this.byId=new Map(s.map(i=>[i.id,i])),super.graph_set({nodes:s},t)}relight(e,t,s,i,r){super.relight(e,t,s,i,r)}unfold(e,t){super.unfold(e,t)}descent(e,t,s,i){super.descent(e,t,s,i)}status_update(e,t){const s=this.byId.get(e);s===void 0||s.status===t||(s.status=t,this.look_update(e,Lp(s)))}}function Wp(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 bT(n){const e=n.title||"(untitled)",t=n.tags??[];if(t.length===0)return e;const s=document.createElement("span");s.className="feedlist-title feedlist-titled";const i=document.createElement("span");i.className="feedlist-title-text",i.textContent=e,s.append(i);for(const r of t){const a=document.createElement("span");a.className="feedlist-tag",a.dataset.tag=r,a.title=`tag:${r} — press to filter the roster by it`,a.textContent=`#${r}`;const o=document.createElement("span");o.className="feedlist-tag-x",o.title=`take ${r} off this feed (setfattr -x)`,o.textContent="×",a.append(o),s.append(a)}return s}const _T=[{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:"minmax(12em, 24em)",cell:n=>bT(n),compare:n=>n.title},{key:"progress",label:"PROGRESS",className:"feedlist-progress",width:"minmax(8em, 1fr)",cell:n=>qo(Wp(n)),compare:n=>{const e=Wp(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?"—":TM(n.sizeBytes),compare:n=>n.sizeBytes??-1},{key:"wallSeconds",label:"TIME",className:"feedlist-time",width:"6em",cell:n=>n.wallSeconds===void 0?"—":DM(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 DM(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 TM(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]}`}function zT(n){const t=n.status==="finishedSuccessfully"||n.status==="finishedWithError"||n.status==="cancelled"?"awaiting warmup":"in flight",s=n.tally;return[["PLUGIN",n.pluginName],[s?"REP. INSTANCE":"INSTANCE",String(n.instanceId)],["STATUS",n.status],...s?[["COUNT",`×${s.count} — ${s.done} done, ${s.error} err, ${s.running} live, ${s.other} other`]]:[],...s?.anomalies!==void 0&&s.anomalies.length>0?[["FAULTS",s.anomalies.map(i=>i.id).join(" ")+(s.count>s.done+s.anomalies.length?" …":"")]]:[],["WALL",n.metrics?.computeSeconds!==void 0?DM(n.metrics.computeSeconds):t],["SIZE",n.metrics?.dataBytes!==void 0?TM(n.metrics.dataBytes):t],["DATA",n.vfsPath]]}function IM(n,e,t){n.replaceChildren();for(const[i,r]of zT(e)){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),n.appendChild(a)}n.appendChild(wT(e.status));const s=document.createElement("div");if(s.className="feed-node-verbs",t.enter!==void 0){const i=document.createElement("button");i.className="pacs-capsule feed-node-enter",i.textContent="ENTER NODE",i.title="fly into the node: its data, browsable inside (Esc flies out)",i.addEventListener("click",t.enter),s.appendChild(i)}if(t.process!==void 0){const i=t.process,r=document.createElement("button");r.className="pacs-capsule dag-process",r.textContent="PROCESS",e.tally!==void 0?(r.disabled=!0,r.title=`${e.tally.count} instances stand here: open one to process it`,r.classList.add("pacs-capsule-off")):(r.title=`open /bin bound to ${e.label} — a run appends to this node`,r.addEventListener("click",()=>i({vfsPath:e.vfsPath,instanceId:e.instanceId,label:e.label}))),s.appendChild(r)}s.childElementCount>0&&n.appendChild(s)}const Tc=[{key:"created",label:"CREATED"},{key:"waiting",label:"WAITING"},{key:"scheduled",label:"SCHEDULED"},{key:"started",label:"STARTED"},{key:"registeringFiles",label:"REGISTERING"}];function wT(n){const e=document.createElement("div");e.className="dag-subway";const t=n==="finishedSuccessfully",s=n==="finishedWithError"||n==="cancelled",i=Tc.findIndex(l=>l.key===n),r=t||s?Tc.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 p=document.createElement("span");return p.className="subway-label",p.textContent=l,u.append(h,p),u};Tc.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}class GM{notePill;tagPill;renamePill;marks;handlers;readFeedId=null;tags=[];constructor(e,t){this.handlers=t,this.notePill=e?.querySelector(".dag-note")??null,this.tagPill=e?.querySelector(".dag-tag")??null,this.renamePill=e?.querySelector(".dag-rename")??null,this.marks=e?.querySelector(".dag-marks")??null;const s=(i,r)=>{i?.addEventListener("click",()=>{const a=t.shown();a!==null&&r(a)})};s(this.notePill,i=>t.feed_note?.(i)),s(this.tagPill,i=>t.feed_tag?.(i,this.tags)),s(this.renamePill,i=>t.feed_rename?.(i,t.name()))}shown_set(e){for(const t of[this.notePill,this.tagPill,this.renamePill,this.marks])t!==null&&(t.hidden=!e);e||(this.readFeedId=null)}arrived(e){this.readFeedId!==e&&this.refresh()}refresh(){const e=this.handlers.shown();e!==null&&(this.readFeedId=e,this.handlers.feed_entered?.(e))}show(e,t){if(e!==this.handlers.shown()||this.marks===null)return;t.title!==void 0&&t.title!==""&&this.handlers.renamed(e,t.title),this.tags=[...t.tags];const s=(t.note??"").trim();this.notePill!==null&&(this.notePill.textContent=t.note===null?"NOTE":s===""?"ADD NOTE":"EDIT NOTE"),this.marks.replaceChildren();for(const i of t.tags){const r=document.createElement("span");r.className="feedlist-tag dag-mark",r.dataset.tag=i,r.textContent=`#${i}`;const a=document.createElement("span");a.className="feedlist-tag-x",a.title=`take ${i} off this feed (setfattr -x)`,a.textContent="×",a.addEventListener("click",()=>this.handlers.feed_untag?.(e,i)),r.append(a),this.marks.append(r)}if(s!==""){const i=document.createElement("span");i.className="dag-note-line",i.textContent=s.split(`
4267
+ }`;function yM(n,e){const t=performance.now();return new jt({uniforms:{time:{value:t},opacity:{value:e.opacity},born:{value:t},cycle:{value:n}},vertexShader:cD,fragmentShader:dD,transparent:!0,depthWrite:!e.additive,...e.additive?{blending:Pi}:{}})}function vM(n,e,t){const s=e.length,i=new Float32Array(s*2),r=new Float32Array(s*2),a=new Float32Array(s*2);for(let o=0;o<s;o++)i[o*2]=e[o]??0,i[o*2+1]=e[o]??0,r[o*2]=t[o]??0,r[o*2+1]=t[o]??0,a[o*2+1]=1;n.setAttribute("aMode",new Ot(i,1)),n.setAttribute("aStart",new Ot(r,1)),n.setAttribute("aAlong",new Ot(a,1))}let Ac=null;function au(){return Ac===null&&(Ac=new Qu(1,1,1,10,1,!0)),Ac}function uD(n,e){const t=performance.now(),s=new jt({uniforms:{time:{value:t},opacity:{value:1},born:{value:t},cycle:{value:e}},vertexShader:_M,fragmentShader:wM,transparent:!0}),i=au().clone(),r=new Float32Array(n.length*3),a=new Float32Array(n.length),o=new Float32Array(n.length),l=new Ku(i,s,n.length),c=new k(0,1,0),d=new kt;return n.forEach((u,h)=>{const p=u.to.clone().sub(u.from),f=p.length();d.position.copy(u.from).addScaledVector(p,.5),d.quaternion.setFromUnitVectors(c,f>0?p.divideScalar(f):c),d.scale.set(u.width,f,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 ti(r,3)),i.setAttribute("aMode",new ti(a,1)),i.setAttribute("aStart",new ti(o,1)),l.instanceMatrix.needsUpdate=!0,l.frustumCulled=!1,l}function hD(n,e,t){const s=new Float32Array(n.length*6),i=new Float32Array(n.length*6);n.forEach((o,l)=>{s.set([o.from.x,o.from.y,o.from.z,o.to.x,o.to.y,o.to.z],l*6);const c=o.color.r*t.tint,d=o.color.g*t.tint,u=o.color.b*t.tint;i.set([c,d,u,c,d,u],l*6)});const r=new qt;r.setAttribute("position",new Ot(s,3)),r.setAttribute("aColor",new Ot(i,3)),vM(r,n.map(o=>o.mode),n.map(o=>o.start));const a=new eu(r,yM(e,t));return a.frustumCulled=!1,a}class fD{parent;stars=[];index=new Map;nebulaList=[];materials=[];layers=[];threads=null;threadMaterial=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=aD(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=oD(e,t);for(const i of this.materials){const r=i.uniforms.scale;r!==void 0&&(r.value=s)}}threads_draw(e,t,s=[],i){if(e.length===0)return;const r=new qt;r.setAttribute("position",new Ot(e,3));const a=new Ot(t,3);if(this.threads={attribute:a,base:Float32Array.from(t),ends:s},i===void 0){r.setAttribute("color",a),this.parent.add(new eu(r,new vl({vertexColors:!0,transparent:!0,opacity:ru,blending:Pi,depthWrite:!1})));return}r.setAttribute("aColor",a),vM(r,i.modes,i.starts),this.threadMaterial=yM(i.cycle,{opacity:ru,additive:!0});const o=new eu(r,this.threadMaterial);o.frustumCulled=!1,this.parent.add(o)}frame(e){const t=this.threadMaterial?.uniforms.time;t!==void 0&&(t.value=e)}threadsCarryWave(){return this.threadMaterial!==null}nebula_add(e,t,s,i,r){const a=new qu(new wl({map:bM(),color:i,transparent:!0,opacity:r?Ip/3:Ip,blending:Pi,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.threadMaterial=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 pD{parent;geometries=new JA;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 Zu(s,36):this.geometries.of(s),a=new Ai({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:To}:{},...i.fade!==void 0?{transparent:!0,opacity:i.fade}:{}}),o=new Ms(r,a);return i.flat===!0&&(a.transparent=!0,a.depthTest=!1,o.renderOrder=2),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 Ms(new xl(s,24,18),new Xu({color:i,transparent:!0,opacity:r?Tp*.4:Tp,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 qt().setFromPoints([s,i]);let c;a?(c=new Jd(l,new jO({color:r,dashSize:.25,gapSize:.18,transparent:!0,opacity:o?To:.9})),c.computeLineDistances()):c=new Jd(l,new vl({color:r,transparent:!0,opacity:o?To:.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 Ai)||(s.material.color=t,delete s.userData.lampBase)}select(e){for(const[t,s]of this.byId){if(!(s.material instanceof Ai))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 In&&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()}}function sh(n){return n==="live"?1:n==="done"||n==="failed"?2:0}class mD{host;sets=[];materials=[];glows=new Map;stale=!1;census=0;censusLines=0;constructor(e){this.host=e}materialCount(){return this.materials.length}censusCount(){return this.census}censusLineCount(){return this.censusLines}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 O of t){const S=this.host.node(O);if(S!==void 0){for(const b of S.parents){const v=this.host.node(b);v!==void 0&&s.has(b)&&a.push({fromId:b,from:v,toId:O,to:S,join:!1})}for(const b of S.joins){const v=this.host.node(b);v!==void 0&&s.has(b)&&a.push({fromId:b,from:v,toId:O,to:S,join:!0})}}}if(a.length===0)return;const o=new Map,l=(O,S=new Set)=>{const b=o.get(O);if(b!==void 0)return b;if(S.has(O))return 0;S.add(O);const v=this.host.node(O),E=v===void 0?[]:[...v.parents,...v.joins].filter(I=>s.has(I)),A=E.length===0?0:1+Math.max(...E.map(I=>l(I,S)));return o.set(O,A),A},c=performance.now(),d=new Float32Array(a.length*3),u=new Float32Array(a.length),h=new Float32Array(a.length),p=r.edge.clone().lerp(new ke("#ffffff"),.45),f=new Ku(au(),new jt({uniforms:{time:{value:c},opacity:{value:i},born:{value:c},cycle:{value:1}},vertexShader:_M,fragmentShader:wM,transparent:!0}),a.length),M=new k(0,1,0),g=new kt;let m=0;const _=[],w=new Map,z=new Set;a.forEach(({fromId:O,from:S,toId:b,to:v,join:E},A)=>{const I=v.position.clone().sub(S.position),G=I.length(),C=Math.max(.06,Math.min(S.radius,v.radius)*.34)*(e.thickness??1);g.position.copy(S.position).addScaledVector(I,.5),g.quaternion.setFromUnitVectors(M,G>0?I.clone().divideScalar(G):M),g.scale.set(C,G,C),g.updateMatrix(),f.setMatrixAt(A,g.matrix),_.push({from:O,to:b,width:C});const B=v.state==="failed"?r.error:E?r.join:p;d.set([B.r,B.g,B.b],A*3),u[A]=sh(v.state);const P=l(O);if(m=Math.max(m,P),h[A]=P*vn,u[A]===1&&z.add(b),u[A]===2){const W=h[A]+js/2;w.set(b,Math.min(w.get(b)??1/0,W)),P===0&&w.set(O,0)}}),f.instanceMatrix.needsUpdate=!0;const y=au().clone();if(y.setAttribute("aColor",new ti(d,3)),y.setAttribute("aMode",new ti(u,1)),y.setAttribute("aStart",new ti(h,1)),f.geometry=y,f.frustumCulled=!1,this.host.parent.add(f),e.tubes=f,f.material instanceof jt){this.materials.push(f.material);const O=f.material.uniforms.cycle;O!==void 0&&(O.value=(m+1)*vn+js/2+Io)}this.sets.push({mesh:f,edges:_,lamps:w,blinks:z,owner:e,entries:t,members:s})}census_build(e,t){if(e.length===0)return;const s=uD(e,(t+1)*vn+js/2+Io);this.host.parent.add(s),s.material instanceof jt&&this.materials.push(s.material),this.census=e.length}censusLines_build(e,t,s){if(e.length===0)return;const i=hD(e,(t+1)*vn+js/2+Io,s);this.host.parent.add(i),i.material instanceof jt&&this.materials.push(i.material),this.censusLines=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 k(0,1,0),t=new kt;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 jt){const t=e.material;this.materials=this.materials.filter(s=>s!==t),t.dispose()}}clear(){this.materials=[],this.census=0,this.censusLines=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 jt){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 jt))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)/ZA));for(const[u,h]of i){const p=l-h;this.lamp_paint(u,p<0?0:c,p>=0&&p<fo?p/fo:-1,t)}const d=(e%js+js)%js;for(const u of r){if(i.has(u))continue;const h=Math.max(0,1-d/(js*.8));this.lamp_paint(u,h*h,d<fo?d/fo:-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 Ai))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(Gp+(1-Gp)*Math.max(t,o)).lerp(Rp,Math.min(1,.22*t+.7*o)),s<0)return;let l=this.glows.get(e);l===void 0&&(l=new qu(new wl({map:bM(),color:a.clone().lerp(Rp,.35),transparent:!0,blending:Pi,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+YA*d)*r.scale.x),l.material.opacity=.9*(1-s)**1.5,l.visible=!0,i.add(e)}}class gD{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 k,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>qA?a.target=1:a.target===1&&l<XA&&(a.target=0),a.mix===a.target)continue;const c=i===0?1:i/KA;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 Ai&&(d.material.opacity=a.mix);if(a.tubes!==null&&a.tubes.material instanceof jt){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 MD{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 eh(1,1),a=new Ai({color:"#ffffff",roughness:.5,metalness:.1}),o=[],l=new Ku(r,a,t?1:i),c=new ke,d=new kt,u=new Map,h=new Map;let p=0,f=1;const M=new k;for(const _ of e)M.add(_.position);M.divideScalar(Math.max(1,e.length));for(const _ of e){if(_.ghost===!0)continue;const w=Math.max(1,_.count),z=w===1?0:_.radius*(1.6+.55*Math.cbrt(w)),y=w===1?_.radius:Math.max(.06,Math.min(_.radius*.5,2.2*z/Math.sqrt(w))),O=[];for(let S=0;S<w;S++){const b=w===1?_.position.clone():QA(S,w,z).add(_.position);O.push(b),c.set(_.color),t?o.push({id:_.id,position:b,radius:y,color:c.clone(),dim:_.dim,ember:_.ember}):(d.position.copy(b),d.scale.setScalar(y),d.updateMatrix(),l.setMatrixAt(p,d.matrix),l.setColorAt(p,c)),this.memberIds.push(_.id),this.memberPositions.push(b),p+=1,f=Math.max(f,M.distanceTo(b)+y)}u.set(_.id,O),h.set(_.id,y)}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{specs:g,deepest:m}=bD(e,u,h,s);return!t&&g.length>0&&g.length<=lD?this.host.tubes.census_build(g,m):g.length>0&&this.host.tubes.censusLines_build(g,m,t?{tint:1,opacity:ru,additive:!0}:{tint:1,opacity:.35,additive:!1}),{center:M,radius:f}}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=[]}}function bD(n,e,t,s){const i=new Map(n.map(d=>[d.id,d])),r=new Map,a=(d,u=new Set)=>{const h=r.get(d);if(h!==void 0)return h;if(u.has(d))return 0;u.add(d);const p=(i.get(d)?.parents??[]).filter(M=>i.has(M)),f=p.length===0?0:1+Math.max(...p.map(M=>a(M,u)));return r.set(d,f),f},o=s.edge.clone().lerp(new ke("#ffffff"),.45),l=[];let c=0;for(const d of n){const u=e.get(d.id)??[];for(const h of d.parents){const p=e.get(h);if(!p||p.length===0)continue;const f=Math.max(.02,Math.min(t.get(d.id)??.1,t.get(h)??.1)*.34),M=a(h)*vn;c=Math.max(c,a(h));for(let g=0;g<u.length;g++){const m=u[g],_=p.length===u.length?p[g]:p[g%p.length];_===void 0||m===void 0||l.push({from:_,to:m,width:f,color:d.state==="failed"?s.error:o,mode:sh(d.state),start:M})}}}return{specs:l,deepest:c}}const Bp=.028,_D=.25,zD="rgba(0, 0, 0, 0.7)",ia=48;class wD{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 ${ia}px sans-serif`;let u=t.length*ia*.6;if(c!==null&&(c.font=d,u=Math.ceil(c.measureText(t).width)),l.width=Math.max(1,u+ia),l.height=Math.round(ia*1.5),c!==null){c.font=d,c.textBaseline="middle";const M=l.height/4;c.fillStyle=zD,c.beginPath(),c.roundRect(0,0,l.width,l.height,M),c.fill(),c.fillStyle=`#${r.getHexString()}`,c.fillText(t,ia/2,l.height/2)}const h=new iM(l),p=new wl({map:h,transparent:!0,depthWrite:!1,depthTest:!1,sizeAttenuation:!1,opacity:a?_D:.9}),f=new qu(p);f.scale.set(Bp*(l.width/l.height),Bp,1),f.center.set(.5,0),f.position.set(s.x,s.y+i,s.z),f.renderOrder=4,f.visible=this.shown,this.parent.add(f),this.captions.get(e)?.texture.dispose(),this.captions.set(e,{sprite:f,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 k,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 yD=.0022,vD=.006,OD=.0035,xD=1e4,Cp=700,Pp=new k(0,1,0),SD={minDistance:8,margin:1.15,stance:"axis",farFloor:200,farScale:2};function ED(n){return n*n*(3-2*n)}class AD{camera;world;clock;focus=new k;flight=null;home=null;holding=!1;touched=!1;spinIdleUntil=0;tumbleAxis=new k(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()+xD}eyeDistance(){return this.camera.position.distanceTo(this.focus)}turn_about(e,t){const s=new Fi().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(Pp,e*.005),this.turn_about(new k().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 k),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 k().setFromMatrixColumn(this.camera.matrixWorld,0).multiplyScalar(-e*s).add(new k().setFromMatrixColumn(this.camera.matrixWorld,1).multiplyScalar(t*s));this.camera.position.add(i),this.focus.add(i)}frame(e,t,s={}){const i={...SD,...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 k;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,p)=>h-p),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),Cp,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(),Cp,()=>{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=ED(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(Pp,yD)}tumble_step(){this.tumblePhase+=OD,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,vD)}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 OM=4,DD=350,TD=30,ID=600,GD=400;class RD{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<ID||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<=DD&&Math.hypot(e.clientX-s.x,e.clientY-s.y)<=TD){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},GD),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)>OM&&(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 ND=14,BD=4;class CD{camera;world;element;sources;starGlow;raycaster=new YO;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 et((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 Ms?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 wt().multiplyMatrices(this.camera.matrixWorldInverse,this.world.matrixWorld),u=new wt().multiplyMatrices(this.camera.projectionMatrix,c).elements,h=c.elements,p=m=>{const _=-(h[2]*m.x+h[6]*m.y+h[10]*m.z+h[14]);if(_<=0)return null;const w=u[3]*m.x+u[7]*m.y+u[11]*m.z+u[15],z=(u[0]*m.x+u[4]*m.y+u[8]*m.z+u[12])/w,y=(u[1]*m.x+u[5]*m.y+u[9]*m.z+u[13])/w;return{x:(z+1)/2*r.width,y:(1-y)/2*r.height,depth:_}},f=t?ND:BD;let M=null,g=1/0;for(const m of s){if(m.dim)continue;const _=p(m.position);if(_===null)continue;const w=Math.max(f,this.starGlow*m.radius*l/_.depth),z=Math.hypot(_.x-a,_.y-o);if(z>w)continue;const y=z/w;y<g&&(g=y,M=m.id)}if(M!==null)return M;for(const m of i){const _=p(m.position);if(_!==null&&Math.hypot(_.x-a,_.y-o)<=m.radius*l/_.depth)return m.id}return null}}const PD=3e4,LD=900;class WD{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)/PD*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)/LD;r>=1?(this.flashes.delete(s),t.set(s,0)):t.set(s,1-r)}return t}}function kD(n){const e=new Set(n.map(o=>o.id)),t=o=>!o.parentIds.some(l=>e.has(l)),s=n.filter(t),i=n.filter(o=>!t(o));if(s.length===0||i.length===0)return!1;const r=Math.min(...s.map(o=>o.y)),a=Math.max(...i.map(o=>o.y));return r>=a-1e-6}function UD(n,e){const t=new Set(n.filter(r=>r.ghost===!0||r.halo===!0).map(r=>r.id)),s=[];let i=null;for(const r of n){if(t.has(r.id))continue;const a=e.get(r.id);if(a!==void 0)for(const o of r.parentIds){if(t.has(o))continue;const l=e.get(o);if(l===void 0)continue;const c=Math.hypot(a.x-l.x,a.y-l.y,a.z-l.z);s.push(c),(i===null||c>i.length)&&(i={length:c,from:o,to:r.id})}}return s.length===0||i===null?{}:(s.sort((r,a)=>r-a),{edgeMedian:(s[Math.floor(s.length/2)]??0).toFixed(1),edgeLongest:`${i.length.toFixed(1)}(${i.from}->${i.to})`})}const FD=90*400,jD=12;function xM(n){const e={id:n.id,parents:[...n.parentIds,...n.joinParentIds]};return n.metric!==void 0&&(e.metric=n.metric),e}function $D(n){const e=Gu(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 k(...i?.position??[0,0,0]),radius:i?.radius??Tt}})}function SM(n){return Mg(n.map(xM))}function EM(n,e=3,t=new Map,s=ii,i=new Set){const r=new Map([...t].map(([o,l])=>[o,[l.x,l.y,l.z]])),a=bg(n.map(xM),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 k(...o.position),radius:o.radius}))}}function VD(n,e=3,t=new Map,s=ii,i=new Set){const r=EM(n,e,t,s,i);return r.step(r.total),r.place()}function HD(n,e,t){const s=new Map(n.map(o=>[o.node.id,o])),i=new Map;for(const o of n)for(const l of o.node.parentIds)i.set(l,[...i.get(l)??[],o]);const r=o=>{const l=i.get(o)??[];if(l.length===0)return null;const c=new k;for(const d of l)c.add(d.position);return c.divideScalar(l.length)},a=[];for(const{node:o,position:l,radius:c}of n){if(o.caption!==void 0){const d=o.ghost===!0?r(o.id):null,u=d!==null?0:o.halo===!0?Ec(o.count??1):c;t.labels.caption_add(o.id,o.caption,d??l,u,e.done,o.dim===!0,o.count??1)}if(!(o.ghost===!0&&o.halo!==!0)){if(t.starring&&o.solid!==!0){if(o.halo===!0){t.stars.nebula_add(o.id,l,Ec(o.count??1),e.edge,o.dim===!0);continue}a.push({id:o.id,position:l.clone(),radius:c,color:Br(o.look.paint,e).clone(),dim:o.dim===!0,ember:o.look.ember,...o.ring===!0?{ring:!0}:{}});continue}if(o.halo===!0){t.spheres.halo_add(o.id,l,Ec(o.count??1),e.edge,o.dim===!0);continue}t.spheres.sphere_add(o.id,l,c,{color:Br(o.look.paint,e),dim:o.dim===!0,selected:o.id===t.selected,flat:t.flat})}}return{starred:a,byId:s}}function qD(n,e,t,s){const i=[],r=[],a=f=>!s.starring||f.node.solid===!0,o=[],l=[],c=[];let d=0;const u=new Map,h=(f,M=new Set)=>{const g=u.get(f);if(g!==void 0)return g;if(M.has(f))return 0;M.add(f);const m=e.get(f)?.node,_=m===void 0?[]:[...m.parentIds,...m.joinParentIds].filter(z=>e.get(z)?.node.ghost!==!0&&e.has(z)),w=_.length===0?0:1+Math.max(..._.map(z=>h(z,M)));return u.set(f,w),w},p=(f,M,g,m,_,w)=>{const z=m?.35:1,y=i.length/6;i.push(f.x,f.y,f.z,M.x,M.y,M.z),o.push(w,_.id),r.push(g.r*z,g.g*z,g.b*z,g.r*z,g.g*z,g.b*z);const O=m?0:sh(_.look.state),S=O===0?0:h(w);d=Math.max(d,S),l.push(O),c.push(S*vn);const b=m||s.handoffKey===void 0?null:s.handoffKey(_);b!==null&&s.handoff.thread_note(b,y)};for(const f of n){const{node:M,position:g}=f;if(M.ghost!==!0){for(const m of M.parentIds){const _=e.get(m);if(!_||_.node.ghost===!0)continue;const w=M.dim===!0||_.node.dim===!0;a(f)&&a(_)?!s.starring&&w&&s.spheres.edge_add(m,M.id,_.position,g,t.edge,!1,w):p(_.position,g,t.edge,w,M,m)}for(const m of M.joinParentIds){const _=e.get(m);if(!_)continue;if(M.joinFaint===!0){p(_.position,g,t.join,!0,M,m);continue}const w=M.dim===!0||_.node.dim===!0;a(f)&&a(_)?!s.starring&&w&&s.spheres.edge_add(m,M.id,_.position,g,t.join,!0,w):p(_.position,g,t.join,w,M,m)}}}s.stars.threads_draw(i,r,o,{modes:l,starts:c,cycle:(d+1)*vn+js/2+Io})}function XD(n,e,t,s,i){const r=n.filter(z=>e.has(z.id)),a=new Map;if(r.length===0)return a;const o=new k;for(const z of r)o.add(e.get(z.id));o.divideScalar(r.length);const l=t.clone().normalize(),c=new k().crossVectors(s,l);c.lengthSq()<1e-9&&c.set(1,0,0).cross(l),c.normalize();const d=new k().crossVectors(l,c).normalize(),u=new Map;for(const z of r){const y=e.get(z.id).clone().sub(o);u.set(z.id,new k(y.dot(c),y.dot(d),0))}const h=new Set(r.map(z=>z.id)),p=r.map(z=>({...z,parentIds:z.parentIds.filter(y=>h.has(y)),joinParentIds:z.joinParentIds.filter(y=>h.has(y))})),f=VD(p,2,u,{...i,gravity:!1}),M=new k;for(const z of f)M.add(z.position);M.divideScalar(f.length);const g=z=>Math.sqrt(z.reduce((y,O)=>y+O*O,0)/Math.max(1,z.length)),m=g(r.map(z=>e.get(z.id).distanceTo(o))),_=g(f.map(z=>Math.hypot(z.position.x-M.x,z.position.y-M.y))),w=_>1e-9&&m>1e-9?m/_:1;for(const z of f){const y=(z.position.x-M.x)*w,O=(z.position.y-M.y)*w;a.set(z.node.id,o.clone().addScaledVector(c,y).addScaledVector(d,O))}return a}class KD{restore=null;active(){return this.restore!==null}clear(){this.restore=null}set(e,t,s,i,r){if(e===null||e.length===0){if(this.restore===null)return!1;for(const[u,h]of this.restore)s.set(u,h);return this.restore=null,!0}if(this.restore!==null)return!1;const a=new Set(e),o=i.world.quaternion.clone().invert(),l=i.camera.position.clone().sub(i.focus).normalize().applyQuaternion(o),c=new k(0,1,0).applyQuaternion(i.camera.quaternion).applyQuaternion(o),d=XD(t.filter(u=>a.has(u.id)),s,l,c,r);if(d.size===0)return!1;this.restore=new Map([...d.keys()].map(u=>[u,s.get(u).clone()]));for(const[u,h]of d)s.set(u,h);return!0}}class YD{ports;constructor(e){this.ports=e}ids(){return[...this.ports.meshes().keys(),...this.ports.stars.ids()]}world_of(e){const t=this.ports.meshes().get(e);if(t!==void 0){const i=t.geometry;return i.boundingSphere===null&&i.computeBoundingSphere(),{position:t.getWorldPosition(new k),radius:i.boundingSphere?.radius??Tt}}const s=this.ports.stars.entry(e);return s!==void 0?{position:this.ports.group.localToWorld(s.position.clone()),radius:s.radius}:null}diveTarget_of(e){const t=this.ports.meshes().get(e),s=t===void 0?this.ports.census.ids().indexOf(e):-1;return t===void 0&&s<0?null:(this.ports.group.updateMatrixWorld(!0),t!==void 0?t.getWorldPosition(new k):this.ports.group.localToWorld((this.ports.census.positions()[s]??new k).clone()))}reaches_of(e){const t=new Set(e),s=[];this.ports.group.updateMatrixWorld(!0);for(const i of this.ids()){if(t.size>0&&!t.has(i))continue;const r=this.world_of(i);r!==null&&s.push(r)}return s}}function ZD(n,e){return n.map(t=>{const s=t.node;return{id:s.id,position:t.position,radius:t.radius,count:Math.max(1,s.count??1),color:Br(s.look.paint,e),dim:s.dim===!0,ember:s.look.ember,state:s.look.state,parents:s.parentIds,ghost:s.ghost===!0}})}function QD(n,e){return{position:n.position,radius:n.radius,color:Br(n.node.look.paint,e)}}function JD(n){return{position:n.position,radius:n.radius,parents:n.node.parentIds,joins:n.node.joinFaint===!0?[]:n.node.joinParentIds,state:n.node.look.state}}function eT(n,e){return e.updateMatrixWorld(!0),n.updateMatrixWorld(),new wt().multiplyMatrices(n.matrixWorldInverse,e.matrixWorld)}function tT(n,e){return n/(2*Math.tan(e*Math.PI/360))}const Dc=.5;class sT{ports;busy=!1;constructor(e){this.ports=e}moving(){return this.busy}frame(e,t,s,i,r){this.busy=!0,this.ports.flyToFit(e,t,()=>{this.busy=!1,s()},i,r)}relight(e,t,s,i,r){this.busy=!0,this.ports.graph_set(e,{wave:!1,fit:!1,frozen:e.nodes.map(a=>a.id)}),r?.(),this.ports.flyToFit(t,s,()=>{this.busy=!1,i()})}unfold(e,t){this.busy=!0;const s=this.ports.positions_get(),i=nT(s,e.from),r=this.ports.random??(()=>Math.random()-.5);for(const l of e.unfolding){const c=e.placed?.[l];s[l]=c!==void 0?[i[0]+c[0],i[1]+c[1],i[2]+c[2]]:[i[0]+r()*Dc,i[1]+r()*Dc,i[2]+r()*Dc]}this.ports.positions_seed(s);const a=new Set(e.unfolding.filter(l=>e.placed?.[l]===void 0)),o=e.graph.nodes.filter(l=>!a.has(l.id)).map(l=>l.id);this.ports.graph_set(e.graph,{wave:!1,fit:!1,frozen:o,...e.physics!==void 0?{physics:e.physics}:{}}),e.drawn?.(),this.ports.flyToFit(e.frame,e.durationMs,()=>{this.busy=!1,t()},e.bulk,e.margin)}descent(e,t,s,i){this.busy=!0;const r=()=>{t().then(a=>{if(this.ports.alive()){if(a===null){this.busy=!1,i();return}this.unfold(a,s)}})};"toward"in e?this.ports.flyToward(e.toward,e.distance,e.durationMs,r):this.ports.flyToFit(e.fit,e.durationMs,r)}}function nT(n,e){for(const t of e){const s=[0,0,0];let i=0;for(const r of t){const a=n[r];a!==void 0&&(s[0]+=a[0],s[1]+=a[1],s[2]+=a[2],i+=1)}if(i>0)return[s[0]/i,s[1]/i,s[2]/i]}return[0,0,0]}const iT=1e3;class rT{workerOf;generation;worker=null;disposed=!1;constructor(e,t){this.workerOf=e,this.generation=t}dispose(){this.disposed=!0,this.worker?.terminate(),this.worker=null}run(e){const t=SM(e.nodes),s=new Map([...e.seeds].map(([d,u])=>[d,[u.x,u.y,u.z]])),i=uy(e.nodes,e.keyOf,s,e.frozen),r=iT,a=i.length;e.progress(0,r,a);const o=d=>{e.placed(e.nodes.map(u=>{const h=d[u.id]??[0,0,0];return{node:u,position:new k(h[0],h[1],h[2]),radius:t.get(u.id)??Tt}})),e.progress(r,r,a)},l=d=>e.progress(Math.min(r-1,Math.floor(d*r)),r,a);if(this.worker===null){if(this.workerOf===void 0){const d=Ly(e.arrangement);if(d===void 0){console.error(`layout: no engine named ${e.arrangement}`),e.progress(r,r,a);return}o(d.run({nodes:i,physics:e.physics},l).positions);return}this.worker=this.workerOf()}const c=this.worker;c.onmessage=d=>{const u=d.data;if(!(u.generation!==this.generation()||this.disposed)){if(u.type==="progress"){l(u.fraction??0);return}if(u.type==="failed"){console.error(`layout: ${u.reason??"the engine failed"}`),e.progress(r,r,a);return}o(u.positions??{})}},c.postMessage({generation:e.generation,nodes:i,physics:e.physics,arrangement:e.arrangement})}}const ra=700,aT=2500;function oT(n){const e=new Map,t=new Set(n.map(r=>r.id)),s=r=>r.look.waved;let i=!1;for(;!i;){i=!0;for(const r of n){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),-vn);e.set(r.id,o+vn),i=!1}}return e}class lT{ports;color=new ke("#48d8f0");times=new Map;startAt=null;looping=!1;constructor(e){this.ports=e}start(){this.times=oT(this.ports.nodes()),this.startAt=this.times.size>0?this.now():null}loop_set(e){this.looping=e,e&&this.start()}loop_get(){return this.looping}animate(){if(this.startAt===null)return;const e=this.now()-this.startAt;let t=0;const s=this.ports.census();if(s!==null){t=s.flare(r=>this.times.get(r),e,this.color,ra),e>t+ra&&(this.startAt=this.renewal());return}const i=this.ports.selected();for(const[r,a]of this.times){t=Math.max(t,a);const o=this.ports.mesh(r);if(o===void 0||!(o.material instanceof Ai))continue;const l=e-a,c=l>=0&&l<=ra?Math.sin(l/ra*Math.PI):0;o.scale.setScalar(1+c*.45),c>0?(o.material.emissive.copy(this.color),o.material.emissiveIntensity=c*1.2):(o.material.emissive.setScalar(r===i?1:0),o.material.emissiveIntensity=r===i?.35:0)}e>t+ra&&(this.startAt=this.renewal())}now(){return(this.ports.now??Date.now)()}renewal(){return this.ports.ambient||this.looping?this.now()+aT:null}}class cT{ports;running=null;constructor(e){this.ports=e}active(){return this.running!==null}begin(e,t=1){const s=new WD(e,this.ports.now??Date.now);this.running={clock:s,arrivals:e,shown:new Set},this.ports.redraw(),this.paintAll(),s.play(t)}play(e){this.running?.clock.play(e)}pause(){this.running?.clock.pause()}seek(e){this.running!==null&&this.apply(this.running.clock.seek(e))}stop(){this.running!==null&&(this.running=null,this.ports.redraw())}state(){return this.running===null?null:{playing:this.running.clock.playing(),at:this.running.clock.at(),span:this.running.clock.span()}}step(){const e=this.running;if(e===null)return;const t=e.clock.playing(),s=e.clock.step();this.apply(s);for(const[i,r]of e.clock.flashing())this.ports.stars.flash_set(i,r);this.ports.stars.flush(),(t||s.arrived.length>0)&&this.ports.moved?.(s.at,e.clock.playing())}paintAll(){const e=this.running;if(e===null)return;const t=[...e.arrivals.keys()].filter(s=>!e.shown.has(s));this.ports.stars.presence_set(t,0),this.ports.stars.presence_set(e.shown,1),this.ports.stars.threads_present(s=>e.shown.has(s)||!e.arrivals.has(s)),this.ports.stars.flush()}apply(e){const t=this.running;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.ports.stars.flash_set(s,0);this.ports.stars.presence_set(e.arrived,1),this.ports.stars.presence_set(e.departed,0),this.ports.stars.threads_present(s=>t.shown.has(s)||!t.arrivals.has(s)),this.ports.stars.flush()}}}class dT{ports;drag=null;pull=null;returns=[];constructor(e){this.ports=e}dragging(){return this.drag!==null}clear(){this.drag=null,this.pull=null}positions(){return this.pull?.positions()??[]}begin(e){const t=this.ports.picker.mesh_under(e),s=t?.userData.nodeId;if(t===null||typeof s!="string")return!1;const i=this.ports.camera.getWorldDirection(new k).negate();this.ports.group.updateMatrixWorld(!0);const r=new Vn().setFromNormalAndCoplanarPoint(i,t.getWorldPosition(new k));return this.drag={nodeId:s,plane:r,startX:e.clientX,startY:e.clientY,moved:!1,solo:this.ports.solo(),home:t.position.clone()},!0}move(e){if(this.drag===null||(this.ports.spin_pause(),!this.drag.moved&&Math.abs(e.clientX-this.drag.startX)+Math.abs(e.clientY-this.drag.startY)>OM&&(this.drag.moved=!0,this.drag.solo||this.simulation_begin(this.drag.nodeId)),!this.drag.moved))return!1;const t=new k;if(this.ports.picker.ray_aim(e).ray.intersectPlane(this.drag.plane,t)===null)return!1;if(this.ports.group.worldToLocal(t),this.drag.solo){const s=this.ports.meshes().get(this.drag.nodeId);return s===void 0?!1:(s.position.copy(t),!0)}return this.pull?.pin([t.x,t.y,t.z]),!1}end(){if(this.drag===null)return!1;const e=this.drag.moved;if(this.drag.solo&&this.drag.moved){const t=this.ports.meshes().get(this.drag.nodeId);t!==void 0&&this.returns.push({mesh:t,from:t.position.clone(),to:this.drag.home.clone(),startedAt:this.now()})}return this.pull?.release(),this.drag=null,e}step(){const e=this.now();let t=!1;return this.pull!==null&&(this.pull.step(this.drag!==null)?t=!0:this.pull=null),this.returns.length>0&&(this.returns=this.returns.filter(s=>{const i=Math.min(1,(e-s.startedAt)/300),r=i*i*(3-2*i);return s.mesh.position.lerpVectors(s.from,s.to,r),i<1}),t=!0),t}now(){return(this.ports.now??Date.now)()}simulation_begin(e){const t=this.ports.nodes(),s=SM(t),i=[...this.ports.meshes()].map(([a,o])=>({id:a,position:[o.position.x,o.position.y,o.position.z],radius:s.get(a)??Tt,dim:o.userData.dim===!0,halo:o.userData.halo===!0})),r=[];for(const a of t)for(const o of[...a.parentIds,...a.joinParentIds])r.push({from:o,to:a.id});this.pull=new Ay({grabbed:e,nodes:i,edges:r,dimensions:this.ports.dimensions(),baseRadius:Tt})}}const uT=1500;class hT{ports;tip;hovered=null;tapTimer=null;constructor(e,t){this.ports=t,this.tip=document.createElement("div"),this.tip.className="dag-node-tip",this.tip.hidden=!0,e.appendChild(this.tip)}hide(){this.tip.hidden=!0}leave(e){if(this.hovered=null,e.pointerType==="touch"&&!this.tip.hidden){this.tapTimer!==null&&window.clearTimeout(this.tapTimer),this.tapTimer=window.setTimeout(()=>{this.tapTimer=null,this.ports.fingersDown()===0&&(this.tip.hidden=!0)},uT);return}this.tip.hidden=!0}hover(e){const t=this.ports.picker.node_under(e,this.ports.pressKind()==="touch"),s=t===null?void 0:this.ports.nodes().find(r=>r.id===t);if(s===void 0){this.tip.hidden=!0,this.ports.canvas.style.cursor="",this.hovered=null;return}this.hovered={id:s.id,x:e.clientX,y:e.clientY};const i=this.ports.canvas.getBoundingClientRect();this.tip.textContent=this.ports.words(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.ports.canvas.style.cursor="pointer"}pick(e,t){const s=this.hovered,i=s!==null&&Math.hypot(e.clientX-s.x,e.clientY-s.y)<=6?s.id:this.ports.picker.node_under(e,this.ports.pressKind()==="touch");if(i===null){t==="select"&&this.ports.selected_get()!==null&&(this.ports.selected_set(null),this.ports.selection_paint(),this.ports.deselect?.());return}const r=this.ports.nodes().find(a=>a.id===i);r&&(t==="select"?(this.ports.selected_set(i),this.ports.census()||this.ports.selection_paint(),this.ports.select?.(r)):this.ports.activate?.(r))}}function fT(){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")}}class pT{container;handlers;paletteOf;ambient;renderer;scene;camera;group=new ha;picker;spheres=new pD(this.group);get meshes(){return this.spheres.map}starField=new fD(this.group);labels=new wD(this.group);tubes=new mD({parent:this.group,node:e=>this.tubeNode_of(e),sphere:e=>this.meshes.get(e),palette:()=>this.palette_read()});handoffField=new gD({spheres:this.spheres,stars:this.starField,tubes:this.tubes,look:e=>this.handoffLook_of(e)});censusField=new MD({parent:this.group,stars:this.starField,tubes:this.tubes,starsView:()=>({pixelRatio:window.devicePixelRatio,heightPx:this.renderer.domElement.height,fovDeg:this.camera.fov})});drawn=new YD({meshes:()=>this.meshes,stars:this.starField,census:this.censusField,group:this.group});flights=new sT({positions_get:()=>this.positions_get(),positions_seed:e=>this.positions_seed(e),graph_set:(e,t)=>this.graph_set(e,t),flyToFit:(e,t,s,i,r)=>this.camera_flyToFit(e,t,s,i,r),flyToward:(e,t,s,i)=>this.camera_flyToward(e,t,s,i),alive:()=>!this.disposed});hierarchy;wave;replay;grab;hover=null;rig;gestures=null;lastPositions=new Map;frozen=new Set;physicsOnce=void 0;census=!1;physics={...ii};graph={nodes:[]};drawMode="spheres";placedById=new Map;fits=0;strategy="ranked";selectedId=null;frameHandle=null;disposed=!1;projection="3d";flat=new KD;rebuildGen=0;slicing=!1;arrangement="galaxy";arrangementMemory=new Map;constructor(e,t={},s={}){this.container=e,this.handlers=t,this.paletteOf=s.palette??fT,this.hierarchy=new rT(s.layoutWorker,()=>this.rebuildGen),this.ambient=s.ambient===!0,this.renderer=new HA({antialias:!0,alpha:!0}),this.renderer.setPixelRatio(window.devicePixelRatio),this.renderer.domElement.classList.add("dag-scene-canvas"),this.scene=new yO,this.camera=new Rs(50,1,.1,200),this.camera.position.set(0,0,14),this.rig=new AD(this.camera,this.group),this.picker=new CD(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},MM),this.wave=new lT({nodes:()=>this.graph.nodes,mesh:r=>this.meshes.get(r),census:()=>this.census&&this.censusField.drawn()?this.censusField:null,selected:()=>this.selectedId,ambient:this.ambient}),this.replay=new cT({stars:this.starField,redraw:()=>this.rebuild(!1,"hold"),...t.replay!==void 0?{moved:t.replay}:{}}),this.grab=new dT({picker:this.picker,camera:this.camera,group:this.group,meshes:()=>this.meshes,nodes:()=>this.graph.nodes,solo:()=>this.strategy==="ranked",dimensions:()=>this.projection==="2d"?2:3,spin_pause:()=>this.rig.spin_pause()}),this.scene.add(new qO(16777215,.9));const i=new HO(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.hover=this.pointer_wire(e)),new ResizeObserver(()=>this.size_fit()).observe(e),this.tick()}pointer_wire(e){const t=new hT(e,{picker:this.picker,canvas:this.renderer.domElement,nodes:()=>this.graph.nodes,pressKind:()=>this.gestures?.pressKind(),fingersDown:()=>this.gestures?.fingersDown()??0,words:s=>this.handlers.tip?.(s)??null,census:()=>this.census,selected_get:()=>this.selectedId,selected_set:s=>{this.selectedId=s},selection_paint:()=>this.selection_paint(),...this.handlers.select!==void 0?{select:this.handlers.select}:{},...this.handlers.activate!==void 0?{activate:this.handlers.activate}:{},...this.handlers.deselect!==void 0?{deselect:this.handlers.deselect}:{}});return this.gestures=new RD(this.renderer.domElement,this.rig,{grab_begin:s=>this.grab.begin(s),grab_move:s=>{this.grab.move(s)&&this.positions_sync()},grab_end:()=>this.grab.end(),hover:s=>t.hover(s),leave:s=>t.leave(s),tap:(s,i)=>t.pick(s,i),tip_hide:()=>t.hide(),gesture_end:()=>this.handlers.gesture_end?.()},{flat:()=>this.projection==="2d",untethered:()=>this.census}),t}tick(){if(this.disposed)return;this.ambient?(this.rig.tumble_step(),this.wave.animate()):(this.rig.spin_step(!(this.gestures?.pointerOver()??!1)&&this.projection==="3d"&&!this.flat.active()),this.grab.step()&&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();const e=performance.now();this.tubes.frame(e),this.starField.frame(e),this.labels.declutter(this.camera),this.renderer.render(this.scene,this.camera),this.frameHandle=window.requestAnimationFrame(()=>this.tick())}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_set(e,t={}){this.graph=e,this.flat.clear(),this.frozen=new Set(t.frozen??[]),this.physicsOnce=t.physics,this.rebuild(t.fit!==!1,t.settle??"full"),t.wave!==!1&&this.wave.start()}waveLoop_set(e){this.wave.loop_set(e)}waveLoop_get(){return this.wave.loop_get()}wave_start(){this.wave.start()}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 k(s,i,r)]))}flight_into(e,t){if(this.rig.flying()||this.rig.holding_get())return;const s=this.drawn.diveTarget_of(e);s!==null&&this.rig.flyInto(s,t)}camera_flyToFit(e,t,s,i=1,r=1.15){this.rig.flyToFit(this.drawn.reaches_of(e),t,s,i,r)}camera_distance(){return this.rig.eyeDistance()}camera_touched(){return this.rig.touched_get()}moving(){return this.flights.moving()}frame(e,t,s=()=>{},i,r){this.flights.frame(e,t,s,i,r)}relight(e,t,s,i=()=>{},r){this.flights.relight(e,t,s,i,r)}unfold(e,t=()=>{}){this.flights.unfold(e,t)}descent(e,t,s=()=>{},i=()=>{}){this.flights.descent(e,t,s,i)}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(),censusLines:this.tubes.censusLineCount(),censusMembers:this.census?this.censusField.ids().length:0,handoffGroups:this.handoffField.size(),handoffSolid:this.handoffField.solidCount(),camera:this.rig.eyeDistance().toFixed(1),settling:this.slicing,...UD(this.graph.nodes,this.lastPositions)}}camera_flyToward(e,t,s,i){const r=this.drawn.world_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)}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_set(e){this.projection=e,e==="2d"&&this.group.quaternion.identity(),this.rebuild()}projection_get(){return this.projection}flat_set(e){this.flat.set(e,this.graph.nodes,this.lastPositions,{camera:this.camera,focus:this.rig.focus,world:this.group},this.physics)&&this.rebuild(!1,"hold")}flat_get(){return this.flat.active()}look_update(e,t){const s=this.graph.nodes.find(i=>i.id===e);s&&(s.look=t,this.spheres.recolor(e,Br(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.hierarchy.dispose(),this.frameHandle!==null&&window.cancelAnimationFrame(this.frameHandle),this.gestures?.detach(),this.renderer.dispose(),this.renderer.domElement.remove(),this.spheres.dispose()}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 k(a,o,l)]))),this.lastPositions=i??new Map,s&&this.rebuild(!0,i===void 0?"full":"hold")}arrangement_get(){return this.arrangement}replay_begin(e,t=1){this.replay.begin(e,t)}replay_play(e){this.replay.play(e)}replay_pause(){this.replay.pause()}replay_seek(e){this.replay.seek(e)}replay_stop(){this.replay.stop()}replay_state(){return this.replay.state()}censusBuild(e,t,s=!0){const i=ZD(e,t),r=this.censusField.build(i,this.drawMode==="stars",t);this.renderer.domElement.dataset.census=String(this.censusField.ids().length);const 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 k;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)}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($D(this.graph.nodes),e);return}let i=this.frozen;if(t!=="full"&&i.size===0){const l=this.graph.nodes.map(c=>c.id).filter(c=>this.lastPositions.has(c));l.length>0&&(i=new Set(l))}const r=EM(this.graph.nodes,this.projection==="2d"?2:3,this.lastPositions,this.physics_current(),i);if(r.moving===0){this.draw(r.place(),e);return}const a=this.handlers.progress,o=r.total*r.moving<FD;if((!o||this.arrangement!=="galaxy")&&a!==void 0&&this.handlers.handoffKey!==void 0&&this.frozen.size===0){this.hierarchy_run(s,e,i,a);return}if(a===void 0||o){r.step(r.total),this.draw(r.place(),e);return}this.settle_slice(r,s,e,a)}physics_current(){return this.physicsOnce!==void 0?{...this.physics,...this.physicsOnce}:this.physics}settle_slice(e,t,s,i){const r=this.graph.nodes.length;let a=0;this.slicing=!0,i(0,e.total,r);const o=()=>{if(t!==this.rebuildGen||this.disposed)return;const l=performance.now();for(;a<e.total&&performance.now()-l<jD;)e.step(1),a+=1;if(a<e.total){i(a,e.total,r),window.requestAnimationFrame(o);return}this.slicing=!1,this.draw(e.place(),s),i(e.total,e.total,r)};window.requestAnimationFrame(o)}hierarchy_run(e,t,s,i){const r=this.handlers.handoffKey;r!==void 0&&(this.slicing=!0,this.hierarchy.run({generation:e,nodes:this.graph.nodes,keyOf:r,seeds:this.lastPositions,frozen:s,physics:this.physics_current(),arrangement:this.arrangement,progress:(a,o,l)=>{a===o&&(this.slicing=!1),i(a,o,l)},placed:a=>{this.slicing=!1,this.draw(a,t)}}))}draw(e,t){const s=this.drawn_clear(e);if(this.census){const c=e.filter(d=>d.node.solid===!0&&d.node.ghost!==!0);this.censusBuild(e.filter(d=>d.node.solid!==!0),s,t),c.length>0&&this.solid_draw(c,s);return}!this.ambient&&t&&this.camera_fit(e);const i=this.drawMode==="stars",r=i&&!this.replay.active()?this.handlers.handoffKey:void 0,a={spheres:this.spheres,labels:this.labels,stars:this.starField,handoff:this.handoffField,selected:this.selectedId,flat:this.projection==="2d",starring:i,handoffKey:r},o=HD(e,s,a);o.starred.length>0&&this.starField.draw(o.starred,window.devicePixelRatio,this.renderer.domElement.height,this.camera.fov);for(const c of e)this.placedById.set(c.node.id,c);if(r!==void 0){const c=new Map(this.graph.nodes.map(d=>[d.id,d]));this.handoffField.gather(o.starred,d=>{const u=c.get(d);return u===void 0?null:r(u)})}qD(e,o.byId,s,a);const l=e.filter(c=>c.node.ghost!==!0&&c.node.halo!==!0&&(i?c.node.solid===!0||c.node.tubed===!0:c.node.dim!==!0)).map(c=>c.node.id);if(l.length>0){const d={tubes:null,mix:1,...!i||e.some(u=>u.node.solid===!0&&l.includes(u.node.id))?{}:{thickness:.25}};this.tubes.build(d,l,new Set(l))}this.renderer.domElement.dataset.rootsTop=kD(e.filter(c=>c.node.dim!==!0&&c.node.ghost!==!0&&c.node.halo!==!0).map(c=>({id:c.node.id,parentIds:c.node.parentIds,y:c.position.y})))?"yes":"no",this.replay.active()&&this.replay.paintAll()}drawn_clear(e){this.group.clear(),this.spheres.clear(),this.censusField.clear(),this.renderer.domElement.dataset.census="0",this.grab.clear(),this.starField.clear(),this.labels.clear(),this.handoffField.clear(),this.placedById=new Map,this.tubes.clear();const t=this.palette_read();if(this.wave.color=t.pulse,this.lastPositions=new Map(e.map(s=>[s.node.id,s.position.clone()])),this.projection==="2d")for(const s of e)s.position.z=0;return t}handoff_step(){if(this.handoffField.size()===0)return;const e=this.renderer.domElement.clientHeight||1;this.handoffField.step(eT(this.camera,this.group),tT(e,this.camera.fov),performance.now())}handoffLook_of(e){const t=this.placedById.get(e);return t===void 0?void 0:QD(t,this.palette_read())}tubeNode_of(e){const t=this.placedById.get(e);return t===void 0?void 0:JD(t)}positions_sync(){for(const{id:e,position:t}of this.grab.positions())this.meshes.get(e)?.position.set(...t),this.lastPositions.set(e,new k(...t));this.tubes.follow(),this.spheres.edges_follow()}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:Br(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))}}const AM=new Set(["created","waiting","scheduled","started","registeringFiles"]);function mT(n){return n.status!==void 0&&AM.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 gT(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"}:AM.has(n.status)?{token:"running"}:{token:"unknown"}}function Lp(n){return{state:mT(n),paint:gT(n),ember:n.share!==void 0&&n.share>0||n.status==="finishedWithError",waved:n.status===void 0||n.status==="finishedSuccessfully"||n.status==="finishedWithError"}}function MT(){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 Al extends pT{byId=new Map;constructor(e,t={},s={}){const i={palette:MT,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:Lp(i)}));this.byId=new Map(s.map(i=>[i.id,i])),super.graph_set({nodes:s},t)}relight(e,t,s,i,r){super.relight(e,t,s,i,r)}unfold(e,t){super.unfold(e,t)}descent(e,t,s,i){super.descent(e,t,s,i)}status_update(e,t){const s=this.byId.get(e);s===void 0||s.status===t||(s.status=t,this.look_update(e,Lp(s)))}}function Wp(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 bT(n){const e=n.title||"(untitled)",t=n.tags??[];if(t.length===0)return e;const s=document.createElement("span");s.className="feedlist-title feedlist-titled";const i=document.createElement("span");i.className="feedlist-title-text",i.textContent=e,s.append(i);for(const r of t){const a=document.createElement("span");a.className="feedlist-tag",a.dataset.tag=r,a.title=`tag:${r} — press to filter the roster by it`,a.textContent=`#${r}`;const o=document.createElement("span");o.className="feedlist-tag-x",o.title=`take ${r} off this feed (setfattr -x)`,o.textContent="×",a.append(o),s.append(a)}return s}const _T=[{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:"minmax(12em, 24em)",cell:n=>bT(n),compare:n=>n.title},{key:"progress",label:"PROGRESS",className:"feedlist-progress",width:"minmax(8em, 1fr)",cell:n=>qo(Wp(n)),compare:n=>{const e=Wp(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?"—":TM(n.sizeBytes),compare:n=>n.sizeBytes??-1},{key:"wallSeconds",label:"TIME",className:"feedlist-time",width:"6em",cell:n=>n.wallSeconds===void 0?"—":DM(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 DM(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 TM(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]}`}function zT(n){const t=n.status==="finishedSuccessfully"||n.status==="finishedWithError"||n.status==="cancelled"?"awaiting warmup":"in flight",s=n.tally;return[["PLUGIN",n.pluginName],[s?"REP. INSTANCE":"INSTANCE",String(n.instanceId)],["STATUS",n.status],...s?[["COUNT",`×${s.count} — ${s.done} done, ${s.error} err, ${s.running} live, ${s.other} other`]]:[],...s?.anomalies!==void 0&&s.anomalies.length>0?[["FAULTS",s.anomalies.map(i=>i.id).join(" ")+(s.count>s.done+s.anomalies.length?" …":"")]]:[],["WALL",n.metrics?.computeSeconds!==void 0?DM(n.metrics.computeSeconds):t],["SIZE",n.metrics?.dataBytes!==void 0?TM(n.metrics.dataBytes):t],["DATA",n.vfsPath]]}function IM(n,e,t){n.replaceChildren();for(const[i,r]of zT(e)){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),n.appendChild(a)}n.appendChild(wT(e.status));const s=document.createElement("div");if(s.className="feed-node-verbs",t.enter!==void 0){const i=document.createElement("button");i.className="pacs-capsule feed-node-enter",i.textContent="ENTER NODE",i.title="fly into the node: its data, browsable inside (Esc flies out)",i.addEventListener("click",t.enter),s.appendChild(i)}if(t.process!==void 0){const i=t.process,r=document.createElement("button");r.className="pacs-capsule dag-process",r.textContent="PROCESS",e.tally!==void 0?(r.disabled=!0,r.title=`${e.tally.count} instances stand here: open one to process it`,r.classList.add("pacs-capsule-off")):(r.title=`open /bin bound to ${e.label} — a run appends to this node`,r.addEventListener("click",()=>i({vfsPath:e.vfsPath,instanceId:e.instanceId,label:e.label}))),s.appendChild(r)}s.childElementCount>0&&n.appendChild(s)}const Tc=[{key:"created",label:"CREATED"},{key:"waiting",label:"WAITING"},{key:"scheduled",label:"SCHEDULED"},{key:"started",label:"STARTED"},{key:"registeringFiles",label:"REGISTERING"}];function wT(n){const e=document.createElement("div");e.className="dag-subway";const t=n==="finishedSuccessfully",s=n==="finishedWithError"||n==="cancelled",i=Tc.findIndex(l=>l.key===n),r=t||s?Tc.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 p=document.createElement("span");return p.className="subway-label",p.textContent=l,u.append(h,p),u};Tc.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}class GM{notePill;tagPill;renamePill;marks;handlers;readFeedId=null;tags=[];constructor(e,t){this.handlers=t,this.notePill=e?.querySelector(".dag-note")??null,this.tagPill=e?.querySelector(".dag-tag")??null,this.renamePill=e?.querySelector(".dag-rename")??null,this.marks=e?.querySelector(".dag-marks")??null;const s=(i,r)=>{i?.addEventListener("click",()=>{const a=t.shown();a!==null&&r(a)})};s(this.notePill,i=>t.feed_note?.(i)),s(this.tagPill,i=>t.feed_tag?.(i,this.tags)),s(this.renamePill,i=>t.feed_rename?.(i,t.name()))}shown_set(e){for(const t of[this.notePill,this.tagPill,this.renamePill,this.marks])t!==null&&(t.hidden=!e);e||(this.readFeedId=null)}arrived(e){this.readFeedId!==e&&this.refresh()}refresh(){const e=this.handlers.shown();e!==null&&(this.readFeedId=e,this.handlers.feed_entered?.(e))}show(e,t){if(e!==this.handlers.shown()||this.marks===null)return;t.title!==void 0&&t.title!==""&&this.handlers.renamed(e,t.title),this.tags=[...t.tags];const s=(t.note??"").trim();this.notePill!==null&&(this.notePill.textContent=t.note===null?"NOTE":s===""?"ADD NOTE":"EDIT NOTE"),this.marks.replaceChildren();for(const i of t.tags){const r=document.createElement("span");r.className="feedlist-tag dag-mark",r.dataset.tag=i,r.textContent=`#${i}`;const a=document.createElement("span");a.className="feedlist-tag-x",a.title=`take ${i} off this feed (setfattr -x)`,a.textContent="×",a.addEventListener("click",()=>this.handlers.feed_untag?.(e,i)),r.append(a),this.marks.append(r)}if(s!==""){const i=document.createElement("span");i.className="dag-note-line",i.textContent=s.split(`
4268
4268
  `)[0]??"",i.title=s,this.marks.append(i)}}}const kp="#555";function RM(n,e){return e==="time"?n.metrics?.computeSeconds:n.metrics?.dataBytes}function yT(n,e){const t=new Map;for(const s of n.nodes){const i=s.computeResource;i===void 0||i==="mixed"||t.has(i)||t.set(i,e[t.size%Math.max(1,e.length)]??"#888")}return t}function NM(n,e){const t=e.id_of??(o=>o),s=new Set(n.nodes.map(o=>o.id)),i=o=>{if(e.hue==="compute")return o.computeResource===void 0?kp:e.legend.get(o.computeResource)??kp},r=[],a=new Map;for(const o of n.nodes){const l=t(o.id),c=o.tally?.count??1,d=o.tally?.error??(o.status==="finishedWithError"?1:0),u=d>0&&c>1?Math.min(1,d/c):void 0,h=i(o);r.push({id:l,label:o.label,parentIds:o.parentIds.filter(p=>s.has(p)).map(t),joinParentIds:o.joinParentIds.filter(p=>s.has(p)).map(t),status:o.status,metric:RM(o,e.metric),tubed:!0,...c>1?{count:c}:{},...u!==void 0?{share:u}:{},...h!==void 0?{hue:h}:{}}),a.set(l,o)}return{nodes:r,payloads:a}}const al={strategy:"ranked",projection:"3d",pulse:!1,metric:"time",hue:"status",census:!1,gravity:!1,draw:"spheres"},nh="argus.feedview";function vT(){try{const n=globalThis.localStorage;return n===void 0?null:(n.getItem(nh),n)}catch{return null}}function Up(n){let e={};try{const i=n?.getItem(nh)??null,r=i===null?null:JSON.parse(i);r!==null&&typeof r=="object"&&(e=r)}catch{}const t=(i,r)=>r.includes(e[i])?e[i]:al[i],s=i=>typeof e[i]=="boolean"?e[i]:al[i];return{strategy:t("strategy",["ranked","molecule"]),projection:t("projection",["3d","2d"]),pulse:s("pulse"),metric:t("metric",["time","size"]),hue:t("hue",["status","compute"]),census:s("census"),gravity:s("gravity"),draw:t("draw",["spheres","stars"])}}function Fp(n,e){try{n?.setItem(nh,JSON.stringify(e))}catch{}}function OT(n,e){switch(n){case"strategy":return e.strategy.toUpperCase();case"projection":return e.projection.toUpperCase();case"pulse":return e.pulse?"PULSE ON":"PULSE OFF";case"metric":return e.metric==="time"?"TIME":"SIZE";case"hue":return e.hue.toUpperCase();case"census":return e.census?"CENSUS":"SHAPE";case"gravity":return e.gravity?"GRAVITY ON":"GRAVITY OFF";case"draw":return e.draw.toUpperCase()}}function xT(n,e){switch(n){case"strategy":return{...e,strategy:e.strategy==="ranked"?"molecule":"ranked"};case"projection":return{...e,projection:e.projection==="3d"?"2d":"3d"};case"pulse":return{...e,pulse:!e.pulse};case"metric":return{...e,metric:e.metric==="time"?"size":"time"};case"hue":return{...e,hue:e.hue==="status"?"compute":"status"};case"census":return{...e,census:!e.census};case"gravity":return{...e,gravity:!e.gravity};case"draw":return{...e,draw:e.draw==="spheres"?"stars":"spheres"}}}const ST=new Set(["pulse","gravity"]);function BM(n){const e=getComputedStyle(document.documentElement),t=["--harvestgold","--daybreak","--orange","--honey","--butter","--october-sunset"].map(s=>e.getPropertyValue(s).trim()).filter(s=>s!=="");return yT(n,t)}function ou(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})}function CM(n,e,t=s=>s){for(const s of e.nodes)n.status_update(t(s.id),s.status)}class PM{constructor(e,t,s=vT()){this.hooks=t,this.store=s,this.modes=Up(s);for(const i of e?.querySelectorAll("[data-feed-verb]")??[]){const r=i.dataset.feedVerb;this.pills.set(r,i),i.addEventListener("click",()=>this.press(r))}this.paint()}hooks;store;modes;pills=new Map;recall(){return this.modes=Up(this.store),this.paint(),this.modes_get()}modes_get(){return{...this.modes}}pill_of(e){return this.pills.get(e)??null}press(e){this.modes=xT(e,this.modes),Fp(this.store,this.modes),this.paint(),this.hooks.changed(e,this.modes_get())}set(e,t){this.modes={...this.modes,[e]:t},Fp(this.store,this.modes),this.paint()}paint(){for(const[e,t]of this.pills)t.textContent=OT(e,this.modes),ST.has(e)&&t.classList.toggle("rail-off",e==="pulse"?!this.modes.pulse:!this.modes.gravity)}}class ET{abandoned=null;pick(e,t){this.abandoned=e!==null&&e!==t?e:null}drops(e,t){return this.abandoned!==e||t===null||t===e?!1:(this.abandoned=null,!0)}}function AT(n){return(n.replace(/\[[0-9;]*m/g,"").split(`
4269
4269
  `).find(s=>s.trim().length>0)?.trim()??"").replace(/\s*\((?:[\d,]+\/[\d,]+(?:,\s*\d+%)?|initializing)\)(?=\.?$)/,"")}const DT=6e4,jp=1e4,TT=new Set(["running","scheduled","created","started"]),IT=[/\/proc\/jobs\/feed_(\d+)(?:\/|$)/,/\/feeds?\/feed_(\d+)(?:\/|$)/];function GT(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 RT={running:"started",done:"finishedSuccessfully",error:"finishedWithError"};class NT{scene;canvas;title;facts;empty;strategyPill;backPill=null;feedFrame;feedList;handlers;rosterTimer=null;shownFeedId=null;pinnedFeedId=null;requestedFeedId=null;follow=new ET;defaultTitle;metricMode="time";feedView;modesApplied=null;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 ni({mount:this.feedList,traits:_T,key:u=>String(u.id),chrome:l===null?void 0:{root:l,prefix:"runs"},actions:c===void 0?void 0:{of:u=>c(u)},control:"control",terms:[{key:"tag",value:u=>(u.tags??[]).join(" ")}],activate:u=>this.feed_activate(u),indicated:u=>this.handlers.feed_indicated?.(u),row:{className:u=>`feedlist-row feedlist-${u.status}${this.arrivals.has(u.id)?" feedlist-arrived":""}`,decorate:(u,h)=>{u.dataset.feed=String(h.id),u.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:u=>this.canvas.style.display==="block"?null:u.filter,defaultSort:{key:"createdAt",dir:"desc"}}),this.feedList.addEventListener("click",u=>this.tagMark_press(u),{capture:!0}),this.feedList.addEventListener("dblclick",u=>{u.target instanceof Element&&u.target.closest(".feedlist-tag")!==null&&u.stopPropagation()},{capture:!0}),this.rosterTimer=setInterval(()=>{if(!this.feedList.isConnected||!this.rosterShown||this.rosterPending||document.visibilityState!=="visible")return;const h=this.lastRoster.some(p=>TT.has(p.status))?jp:DT;Date.now()-this.rosterAskedAt<h||(this.rosterAskedAt=Date.now(),this.handlers.command_run("proc feeds"))},jp),this.scene=new Al(e,{select:u=>this.facts_show(u),activate:u=>this.node_activate(u),deselect:()=>this.facts.replaceChildren()}),this.backPill=r.parentElement?.querySelector(".dag-back")??null,this.feedFrame=new GM(r.parentElement,{...o,shown:()=>this.shownFeedId,name:()=>this.lastModel?.feedName??"",renamed:(u,h)=>{this.lastModel!==null&&(this.lastModel={...this.lastModel,feedName:h}),this.title.textContent=`DAG · FEED ${u} — ${h}`.toUpperCase()}}),this.backPill?.addEventListener("click",()=>{this.nav_pop()||this.feedsChooser_request()}),this.facts.addEventListener("click",u=>{u.target instanceof Element&&u.target.closest("button, a, input")===null&&(this.facts.classList.contains("dag-facts-immersed")||(this.scene.selection_clear(),this.factsShown=null,this.facts.replaceChildren()))}),this.feedView=new PM(r.parentElement,{changed:(u,h)=>this.feedMode_apply(u,h)}),this.metricMode=this.feedView.modes_get().metric,this.hueMode=this.feedView.modes_get().hue,this.scalePill=this.feedView.pill_of("metric"),this.huePill=this.feedView.pill_of("hue"),this.feedModes_recall(),r.closest(".pane-dag")?.addEventListener("argus:dag-physics",u=>{const h=u.detail;if(h==="reset"){this.scene.physics_set({charge:!0,link:!0,collide:!0});return}if(h.term==="gravity"){this.scene.physics_get().gravity!==h.on&&this.feedView.press("gravity");return}this.scene.physics_set({[h.term]:h.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===Vm){const t=this.rosterPending||this.rosterShown;this.rosterPending=!1;const s=$m.safeParse(e.model.data);s.success&&(t||this.canvas.style.display==="none")&&this.chooser_show(s.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);return}if(e.model?.kind===Kn.feedIndexing){this.feedIndexing_take(e.model.data);return}e.model?.kind===Kn.feedDag&&this.feedDag_take(e.model.data)}feedIndexing_take(e){const t=r0.safeParse(e);!t.success||this.follow.drops(t.data.feedId,this.pinnedFeedId)||(this.requestedFeedId===t.data.feedId?this.requestedFeedId=null:this.pendingFeedId!==t.data.feedId&&(this.pinnedFeedId=t.data.feedId,this.pendingFeedId=t.data.feedId),this.feedIndexing_show(t.data))}feedDag_take(e){const t=Zc.safeParse(e);if(!t.success)return;const s=t.data;if(this.follow.drops(s.feedId,this.pinnedFeedId))return;this.requestedFeedId===s.feedId?this.requestedFeedId=null:this.pinnedFeedId=s.feedId,this.shownFeedId=s.feedId,this.pendingFeedId=null,this.listing.activation_settle(),zr(this.stateSpan,"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,this.feedModes_recall(),i!==null&&i.feedId===s.feedId&&ou(i,s)?this.statuses_patch(s):this.graph_show(s),this.watch_open(s.feedId),this.feedFrame.arrived(s.feedId),this.handlers.feed_shown?.()}feedModes_recall(){const e=this.feedView.recall(),t=this.modesApplied;return this.modesApplied=e,(t===null||t.strategy!==e.strategy)&&this.scene.strategy_set(e.strategy),(t===null||t.projection!==e.projection)&&this.scene.projection_set(e.projection),(t===null||t.draw!==e.draw)&&this.scene.draw_set(e.draw),(t===null||t.pulse!==e.pulse)&&this.scene.waveLoop_set(e.pulse),(t===null||t.census!==e.census)&&this.scene.census_set(e.census),(t===null||t.gravity!==e.gravity)&&this.scene.physics_set({gravity:e.gravity}),this.metricMode=e.metric,this.hueMode=e.hue,this.modes_render(),t!==null&&(t.metric!==e.metric||t.hue!==e.hue||t.draw!==e.draw)}stage_returned(){this.feedModes_recall()&&this.lastModel!==null&&this.canvas.style.display!=="none"&&this.graph_show(this.lastModel,!1)}feedMode_apply(e,t){switch(this.modesApplied=t,e){case"strategy":this.scene.strategy_set(t.strategy);break;case"projection":this.scene.projection_set(t.projection);break;case"draw":this.scene.draw_set(t.draw),this.lastModel!==null&&this.graph_show(this.lastModel,!1);break;case"pulse":this.scene.waveLoop_set(t.pulse);break;case"census":this.scene.census_set(t.census);break;case"gravity":this.scene.physics_set({gravity:t.gravity});break;case"metric":this.metricMode=t.metric,this.lastModel!==null&&this.graph_show(this.lastModel,!1);break;case"hue":this.hueMode=t.hue,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());break}this.modes_render()}marks_refresh(){this.feedFrame.refresh()}feedMarks_show(e,t){this.feedFrame.show(e,t)}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){return BM(e)}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(e===null){Jt(this.stateSpan,null,this.canvas.style.display!=="none"?"":void 0);return}Jt(this.stateSpan,e,e.toUpperCase())}}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 GT({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:Kn.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&&ou(t,e)){this.statuses_patch(e);return}this.graph_show(e,!1)}statuses_patch(e){CM(this.scene,e);for(const t of e.nodes)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=e.nodes.some(r=>RM(r,this.metricMode)!==void 0);this.scalePill?.classList.toggle("rail-na",!s),this.scalePill!==null&&(this.scalePill.title=s?"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 i=e.nodes.some(r=>r.computeResource!==void 0);this.computeKnown=i,i&&(this.computeRereading=!1),this.huePill?.classList.toggle("rail-na",!i),this.huePill!==null&&(this.huePill.title=i?"what colors a node: its status, or the compute resource it ran on":"no compute resource reported for this feed's nodes yet"),this.scene.graph_set({nodes:NM(e,{metric:this.metricMode,hue:this.hueMode,legend:this.hueLegend,draw:this.feedView.modes_get().draw}).nodes},{wave:t}),this.scene.size_fit(),this.hueMode==="compute"&&this.modes_render(),this.factsPayloads.clear();for(const r of e.nodes)this.factsPayloads.set(r.id,r);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){if(this.rosterProgress!==null&&this.rosterProgress.isConnected){const a=e.procWarmup;if(a?.total!==void 0&&a.total>0&&a.sweeping!==!1){const o=Math.floor(a.loaded/a.total*100);this.rosterProgress.textContent=`INDEX WARMING — ${a.loaded}/${a.total} (${o}%). The roster opens when the index is whole.`}(a===void 0||a.sweeping===!1||a.state==="cached")&&(this.rosterProgress=null,this.feedsChooser_request())}this.arrivals_observe(e.procWarmup?.arrived??[]);const s=(e.procWarmup?.feeds??(e.procWarmup?.feed!==void 0?[e.procWarmup.feed]:[])).find(a=>a.id===this.pendingFeedId);s!==void 0&&this.feedIndexing_show({feedId:s.id,loaded:s.loaded,total:s.total,...s.failed!==void 0?{failed:s.failed}:{}});const i=this.lastCwd!==null&&e.cwd!==this.lastCwd;if(this.lastCwd=e.cwd,!this.canvas.isConnected||this.rosterShown||this.pendingFeedId!==null||!i)return;const r=BT(e.cwd);r!==null&&r!==this.shownFeedId&&(this.pinnedFeedId!==null&&r===this.pinnedFeedId||(this.pinnedFeedId=null,this.requestedFeedId=r,this.handlers.command_run(`feed diagram feed_${r}`)))}progress_observe(e){if(e.itemId===void 0)return;const t=e.status!==void 0?RT[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.follow.pick(this.requestedFeedId,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",Jt(this.stateSpan,"wait","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",Jt(this.stateSpan,"wait",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.listing.activation_settle(),this.empty.textContent=`FEED ${t??"?"}: ${e.trim()||"not available"}`.toUpperCase(),this.empty.style.display="block",this.roster_show(!0),this.title.textContent=this.defaultTitle,zr(this.stateSpan,"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.canvas.style.display!=="none"&&this.graph_leave(),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;rosterRefusal_show(e){const t=AT(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,zr(this.stateSpan,"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.listing.activation_settle(),this.empty.style.display="none",this.roster_show(!0),this.title.textContent=this.defaultTitle,zr(this.stateSpan,"wait"),this.listing.state_refresh(),!0):this.canvas.style.display==="none"||this.feedList.childElementCount===0?!1:(this.graph_leave(),this.roster_show(!0),this.listing.state_refresh(),!0)}graph_leave(){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()}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.follow.pick(this.requestedFeedId,e.id),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))}indicated_refresh(){const e=this.listing.indicated_get(),t=e===null?void 0:this.lastRoster.find(s=>String(s.id)===e);t!==void 0&&this.handlers.feed_indicated?.(t)}roster_ask(){this.rosterAskedAt=Date.now(),this.handlers.command_run("proc feeds")}tagMark_press(e){const t=e.target instanceof Element?e.target:null,s=t?.closest(".feedlist-tag")??null;if(s===null)return;e.stopPropagation(),e.preventDefault();const i=s.dataset.tag??"",r=Number(s.closest("[data-feed]")?.dataset.feed);if(t?.closest(".feedlist-tag-x")!==null&&Number.isFinite(r)){this.handlers.feed_untag?.(r,i);return}this.roster_filter(`tag:${i}`)}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.backPill!==null&&(this.backPill.hidden=e),this.feedFrame.shown_set(!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),IM(this.facts,t,{...this.handlers.node_dive!==void 0||this.handlers.node_enter!==void 0?{enter:()=>this.node_activate(e)}:{},...this.handlers.node_process!==void 0?{process:this.handlers.node_process}:{}})}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 BT(n){for(const e of IT){const t=n.match(e);if(t?.[1]!==void 0)return parseInt(t[1],10)}return null}function Ic(n,e){const t=Jc(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 CT{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(as)).size}all(){return[...this.byId.values()]}get(e){return this.byId.get(e)}clear(){this.byId.clear()}}function PT(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 LT(n,e){return`argus.universe.${n}@${e}`}const Hn={draw:"stars",view:"feeds",scale:"jobs",density:"shape",arrangement:"galaxy",captions:!0};function WT(n,e,t,s,i=Hn.arrangement,r=Hn.captions){return{draw:n,view:e,scale:t,density:s,arrangement:i,captions:r}}function kT(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"],Hn.draw),view:t(e.view,["feeds","shapes"],Hn.view),scale:t(e.scale,["jobs","feeds"],Hn.scale),density:t(e.density,["shape","census"],Hn.density),arrangement:t(e.arrangement,["galaxy","spokes","clumps","constellations","data","accretion"],Hn.arrangement),captions:typeof e.captions=="boolean"?e.captions:Hn.captions}}function $p(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 Gc(n,e){return`inst:${n}:${e}`}function UT(n,e,t,s="jobs",i=!1,r){const a=r??(i?Mu(n,s):fl(n,s)),o=`feed:${e}:`;return{nodes:[...a.nodes.filter(c=>!c.id.startsWith(o)).map(c=>({...c,dim:!0})),...t.nodes]}}function LM(n,e){return e.groups.map((t,s)=>Yn(n,s))}function WM(n,e=3){const t=pl(n).split(" > ");return t.length<=e?t.join(" > "):`${t.slice(0,e).join(" > ")} … +${t.length-e}`}function FT(n,e){if(!n.startsWith("shape:"))return null;const t=n.slice(6),s=e.all().filter(i=>as(i)===t).length;return`${pl(t)} · ${s} feed${s===1?"":"s"}`}function jT(n,e){const t=[];for(const s of e.all())as(s)===n&&t.push(...LM(s.id,s));return t}function $T(n,e,t="jobs"){const s=fl(n,t),i=new Set(n.filter(a=>as(a)===e).map(a=>a.id));return{nodes:s.nodes.map(a=>{if(a.ghost===!0)return a.id===Km(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 kM(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=as(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 p=h.groups[l];p!==void 0&&(c+=p.count,p.errored>0&&(d+=1))}const u=d>0?Math.min(1,d/r.length):void 0;s.push({id:nd(i,l),label:o.plugin,parentIds:o.parent===null?[]:[nd(i,o.parent)],joinParentIds:[],status:d===r.length?"finishedWithError":"finishedSuccessfully",metric:za(e==="feeds"?r.length:c),...r.length>1?{count:r.length}:{},...u!==void 0?{share:u}:{}})});return{nodes:s}}function VT(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=>as(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} · ${WM(s)}`}function Vp(n,e){const t=e.all().find(s=>as(s)===n);return t===void 0?[]:t.groups.map((s,i)=>nd(n,i))}function Hp(n,e,t="jobs"){const s=n.filter(l=>as(l)===e),i=n.filter(l=>as(l)!==e),r=kM(i,t),a=fl(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}}class HT{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}}const qT=600;function XT(n,e){if(e===null)return n.projection_set(n.projection_get()==="3d"?"2d":"3d"),null;if(n.projection_get()==="2d")return"universe: the whole space is 2D; BACK and press 2D to stand it up";const t=[...e];return n.flat_set(n.flat_get()?null:t),n.camera_flyToFit(t,qT,()=>{},1,.95),null}function KT(n,e){return n.projection_get()==="2d"||e&&n.flat_get()?"2D":"3D"}function lu(n,e,t){const s=n?.querySelector(".universe-projection");s!=null&&(s.textContent=KT(e,t))}function YT(n,e,t,s){const i=XT(e,t);i!==null&&s(i),lu(n,e,t!==null)}const ZT=4e3;function QT(n){const e={...ii,gravity:!0};return n.charge===e.charge&&n.link===e.link&&n.collide===e.collide&&n.gravity===e.gravity}function qp(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 Rc(n){return n==="constellations"||n==="data"||n==="accretion"}const JT=18e4,eI=1500,tI=1e3,sI=5e3,nI=3e3,pr=650,iI=650,rI=1.5;class aI{scene;wait;asking=!1;spaceKey="";landed=new CT;canvas;title;state;noteTimer=null;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;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={...ii,gravity:!0};backPill;openPill;pane;feedFrame=null;feedView=null;insideModel=null;insideEntered=null;insideModes=null;watchedFeedId=null;liveState=null;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 HT(e.canvas),this.scene=new Al(e.canvas,{progress:(i,r,a)=>this.settle_progress(i,r,a),handoffKey:i=>K0(i.id),tip:i=>this.inside===null?H0(i.id,this.dataHubs)??Ic(i.id,this.landed)??VT(i.id,this.landed)??PT(i.id,this.landed)??FT(i.id,this.landed):null,select:i=>this.node_select(i),activate:i=>{const r=this.inside===null?Jc(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()}),this.scene.strategy_set("molecule"),this.scene.physics_set(this.physics),this.frame_wire(e),this.feedFrame=new GM(e.frame??null,{...t.feed_entered!==void 0?{feed_entered:t.feed_entered}:{},...t.feed_note!==void 0?{feed_note:t.feed_note}:{},...t.feed_tag!==void 0?{feed_tag:t.feed_tag}:{},...t.feed_rename!==void 0?{feed_rename:t.feed_rename}:{},...t.feed_untag!==void 0?{feed_untag:t.feed_untag}:{},shown:()=>this.inside?.feedId??null,name:()=>this.inside?.title??"",renamed:(i,r)=>{this.inside?.feedId===i&&(this.inside={...this.inside,title:r},this.title_paint())}}),this.feedView=new PM(e.frame??null,{changed:(i,r)=>this.feedMode_apply(i,r)}),this.escape_listen=this.escape_wire(),this.scene.draw_set(this.drawMode),this.canvas.style.display="none",this.title_paint()}frame_wire(e){e.backPill?.addEventListener("click",()=>this.ascend()),e.openPill?.addEventListener("click",()=>{this.inside!==null&&this.handlers.feed_open?.(this.inside.feedId)}),e.projectionPill?.addEventListener("click",()=>YT(this.pane,this.scene,this.inside?.ids??null,t=>this.bar_note(t))),e.refreshPill?.addEventListener("click",()=>this.request()),this.replayPill=e.replayPill??null,e.replayPill?.addEventListener("click",()=>{const t=this.scene.replay_state();t===null?this.bar_note(this.replay_start(1)):t.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",()=>{if(this.inside!==null){this.feedView?.press("draw");return}this.draw_set(this.drawMode==="stars"?"spheres":"stars")}),this.captionsPill=e.captionsPill??null,e.captionsPill?.addEventListener("click",()=>{this.bar_note(this.captions_set(!this.captions))}),this.arrangementPill=e.arrangementPill??null,e.arrangementPill?.addEventListener("click",()=>{const t=["galaxy","spokes","clumps","constellations","data","accretion"];this.bar_note(this.arrangement_set(t[(t.indexOf(this.arrangement)+1)%t.length]))})}escape_wire(){const e=t=>{if(t.key==="Escape"&&this.scene.replay_state()!==null&&(this.pane===null||this.pane.offsetParent!==null)){this.replay_end();return}t.key!=="Escape"||this.inside===null&&this.cluster===null||this.scene.moving()||this.scene.holding_get()||this.pane!==null&&this.pane.offsetParent===null||this.ascend()};return window.addEventListener("keydown",e),e}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===f0){const s=h0.safeParse(e.model.data);s.success&&this.sessionLayout_take(s.data.name,s.data.positions,s.data.laying??null);return}if(e.model?.kind!==u0)return;const t=d0.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>sI&&(this.lastReask=Date.now(),this.request())}}size_fit(){this.scene.size_fit()}verbs_get(){return{enter:e=>this.verb_enter(e),node:e=>this.verb_node(e),state:()=>this.verb_state(),plugin:e=>this.verb_plugin(e),replay:e=>this.verb_replay(e),layout:e=>this.verb_layout(e),draw:e=>this.verb_draw(e),regrow:()=>this.verb_regrow(),captions:e=>this.verb_captions(e),density:e=>this.verb_density(e),physics:e=>this.verb_physics(e),view:e=>this.verb_view(e),cluster:e=>this.verb_cluster(e),back:()=>this.verb_back(),open:()=>this.verb_open()}}control(e,t){if(this.scene.moving()&&(e==="cluster"||e==="back"))return"universe: still moving; ask again";const s=this.verbs_get()[e];return s===void 0?"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":s(t)}verb_enter(e){const t=parseInt(e[0]??"",10);return Number.isFinite(t)?this.landed.get(t)===void 0?`universe enter: feed ${t} has not landed here`:this.inside!==null?`universe enter: already inside feed ${this.inside.feedId}; universe back first`:(this.descend(t),`entering feed ${t}`):"universe enter <feed id>"}verb_node(e){const t=parseInt(e[0]??"",10);return Number.isFinite(t)?this.inside===null?"universe node: not inside a feed (universe enter <feed> first)":this.node_flyTo(t)?`flying into instance ${t}`:`universe node: no node of feed ${this.inside.feedId} hosts instance ${t}`:"universe node <instance id>: fly into the entered feed's node that hosts it"}verb_state(){const e=this.scene.state_get(),t=(()=>{const s=this.settingsKey_get();try{return s===null||this.store===void 0?null:this.store.getItem(s)}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(e).map(([s,i])=>`${s}=${String(i)}`).join(" ")}`,`kept settings: ${t??"(none)"}`,`lit: ${this.lit??"none"}`,`captions: ${this.captions?"on":"off"}`,`session layout: ${(()=>{const s=this.sessionPlaces.get(this.sessionLayoutName_of(this.arrangement));return s===void 0?"not asked":s===null?"none kept":`${s} places kept`})()}`,`replay: ${(()=>{const s=this.scene.replay_state();return s===null?"none":`${s.playing?"playing":"paused"} at ${new Date(s.at).toISOString().slice(0,10)} of ${new Date(s.span[0]).toISOString().slice(0,10)}..${new Date(s.span[1]).toISOString().slice(0,10)}`})()}`].join(`
4270
4270
  `)}verb_plugin(e){const t=e[0]??"";return t===""?"universe plugin <name> | off":this.arrangement!=="constellations"||this.inside!==null||this.cluster!==null?"universe plugin: the CONSTELLATIONS layout only (universe layout constellations)":t.toLowerCase()==="off"?(this.plugin_light(null),"no plugin lit"):this.landed.all().some(s=>s.groups.some(i=>i.plugin===t))?(this.plugin_light(t),Ic(`plugin:${t}`,this.landed)??t):`universe plugin: no feed here ran ${t}`}verb_replay(e){const t=(e[0]??"").toLowerCase();if(t==="stop")return this.scene.replay_state()===null?"universe replay: none is running":(this.replay_end(),"replay stopped; the space is whole");if(t==="pause")return this.scene.replay_state()===null?"universe replay: none is running":(this.scene.replay_pause(),this.replay_paint(),"replay paused");if(t==="at"){if(this.scene.replay_state()===null)return"universe replay: none is running (universe replay first)";const i=Date.parse(e[1]??"");return Number.isFinite(i)?(this.scene.replay_pause(),this.scene.replay_seek(i),this.replay_paint(),`replay at ${new Date(this.scene.replay_state()?.at??i).toISOString().slice(0,10)}`):"universe replay at <YYYY-MM-DD>"}const s=t===""?1:Number(t);return!Number.isFinite(s)||s<=0?"universe replay [speed] | pause | stop | at <YYYY-MM-DD>":this.scene.replay_state()!==null?(this.scene.replay_play(s),this.replay_paint(),`replaying at ×${s}`):this.replay_start(s)}verb_layout(e){const t=(e[0]??"").toLowerCase();return t!=="galaxy"&&t!=="spokes"&&t!=="clumps"&&t!=="constellations"&&t!=="data"&&t!=="accretion"?"universe layout galaxy|spokes|clumps|constellations|data|accretion":this.arrangement_set(t)}verb_draw(e){const t=(e[0]??"").toLowerCase();return t!=="stars"&&t!=="spheres"?"universe draw stars|spheres":this.draw_set(t)}verb_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 e=this.positionsKey_of("accretion");try{e!==null&&this.store?.setItem(e,"{}")}catch{}return this.paint(!0,"full"),"the space regrown from its first feed"}verb_captions(e){const t=(e[0]??"").toLowerCase();return t!=="on"&&t!=="off"?"universe captions on|off":this.captions_set(t==="on")}verb_density(e){const t=(e[0]??"").toLowerCase();return t!=="shape"&&t!=="census"?"universe density shape|census":this.density_set(t)}verb_physics(e){const t=(e[0]??"").toLowerCase();if(t==="reset")return this.physics_reset();if(!["charge","link","collide","gravity"].includes(t))return"universe physics charge|link|collide|gravity [on|off] | reset";const s=(e[1]??"on").toLowerCase()!=="off";return this.physics_set(t,s)}verb_view(e){const t=(e[0]??"").toLowerCase();return t!=="feeds"&&t!=="shapes"?"universe view feeds|shapes":this.inside!==null||this.cluster!==null?"universe view: climb out first (universe back)":(this.view_set(t),t==="feeds"?"every feed its own molecule":"the shapes folded, one molecule each")}verb_cluster(e){const t=parseInt(e[0]??"",10),s=Number.isFinite(t)?this.landed.get(t):void 0;return s===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(as(s)),`viewing the cluster of feed ${t}: ${pl(as(s))}`)}verb_back(){return this.inside===null&&this.cluster===null?"universe back: not inside a feed or a cluster":(this.ascend(),"climbing out")}verb_open(){return this.inside===null?"universe open: not inside a feed":(this.handlers.feed_open?.(this.inside.feedId),`opening feed ${this.inside.feedId}`)}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(Rc(e)&&this.view!=="feeds")return`universe layout ${e}: the FEEDS view only (universe view feeds)`;this.replay_end();const t=i=>Rc(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(WT(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=kT(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={...ii,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"&&Rc(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,this.watch_hold(null),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.scene.moving()?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.scene.moving())&&this.paint(!this.scene.camera_touched())},tI))}paint(e=!0,t="new"){if(this.sessionWait_holds()){this.title_paint();return}const s=this.view==="shapes"?kM(this.landed.all(),this.scale):this.arrangement==="constellations"?Mu(this.landed.all(),this.scale):this.arrangement==="data"?this.dataGraph_paint():this.arrangement==="accretion"?Sh(this.landed.all(),this.scale):fl(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=X0(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.scene.moving()||this.inside!==null)return;this.facts_clear(),this.feedView?.recall();const r=LM(e,s);this.entering=e,this.title_paint();const a=Date.now(),o=t!==void 0?{toward:t,distance:14,durationMs:pr}:{fit:r,durationMs:pr};this.scene.descent(o,async()=>{const l=await i(e);if(this.disposed)return null;if(this.entering=null,l===null)return 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)`),null;const c=this.insidePlan_of(e,s,l,[r,Vp(as(s),this.landed)],pr);return{...c,drawn:()=>{const d=new Set(c.unfolding);this.inside={feedId:e,title:l.feedName,entered:this.insideEntered,ids:d},this.insideModel=l,this.pane?.classList.add("universe-inside"),lu(this.pane,this.scene,this.inside!==null);const u=this.feedView?.modes_get()??{...al};this.insideModes=u,this.scene.draw_set(u.draw),this.drawPill!==null&&(this.drawPill.textContent=u.draw.toUpperCase()),this.scene.waveLoop_set(u.pulse),this.feedFrame?.shown_set(!0),this.feedFrame?.arrived(e),this.watch_hold(e),this.title_paint()}}},()=>this.landed_note())}insidePlan_of(e,t,s,i,r){const a=this.feedView?.modes_get()??{...al},o=NM(s,{metric:a.metric,hue:a.hue,legend:a.hue==="compute"?BM(s):new Map,draw:a.draw,id_of:h=>Gc(e,h)});this.insideEntered=o;let l;if(a.strategy==="ranked"){l={};for(const h of Gu(o.nodes.map(p=>({id:p.id,parentIds:p.parentIds,...p.metric!==void 0?{metric:p.metric}:{}}))))l[h.id]=[h.position[0],h.position[1],h.position[2]]}const c=`feed:${e}:`,d=this.view==="feeds"?UT(this.landed.all(),e,o,this.scale,this.arrangement==="constellations",this.arrangement==="data"?Eh(this.landed.all(),this.scale).graph:this.arrangement==="accretion"?Sh(this.landed.all(),this.scale):void 0):{nodes:[...Hp(this.landed.all(),as(t),this.scale).graph.nodes.filter(h=>!h.id.startsWith(c)).map(h=>({...h,dim:!0})),...o.nodes]},u=o.nodes.map(h=>h.id);return{graph:d,unfolding:u,from:i,physics:{reach:sd,gravity:!1},...l!==void 0?{placed:l}:{},frame:u,durationMs:r,bulk:1,margin:.95}}feedMode_apply(e,t){if(this.inside===null)return;if(this.insideModes=t,e==="pulse"){this.scene.waveLoop_set(t.pulse);return}e==="draw"&&(this.scene.draw_set(t.draw),this.drawPill!==null&&(this.drawPill.textContent=t.draw.toUpperCase()));const s=this.landed.get(this.inside.feedId);if(s===void 0||this.insideModel===null||this.scene.moving())return;const i=this.inside,r=this.insidePlan_of(i.feedId,s,this.insideModel,[[...i.ids]],400);this.scene.unfold({...r,drawn:()=>{this.inside={...i,entered:this.insideEntered}}})}stage_returned(){if(this.inside===null||this.feedView===null)return;const e=this.insideModes,t=this.feedView.recall();e===null||JSON.stringify(e)===JSON.stringify(t)||(e.draw!==t.draw&&this.feedMode_apply("draw",t),e.pulse!==t.pulse&&this.feedMode_apply("pulse",t),(e.strategy!==t.strategy||e.metric!==t.metric||e.hue!==t.hue)&&this.feedMode_apply("strategy",t),this.insideModes=t)}watch_hold(e){this.watchedFeedId!==e&&(this.watchedFeedId!==null&&this.handlers.watch_set?.(`/proc/jobs/feed_${this.watchedFeedId}`,!1),this.watchedFeedId=e,this.liveState=null,e!==null&&this.handlers.watch_set?.(`/proc/jobs/feed_${e}`,!0))}watched_observe(e,t){const s=/feed_(\d+)$/.exec(e);s===null||Number(s[1])!==this.watchedFeedId||(this.liveState=t,this.title_paint())}model_refresh(e){const t=this.inside;if(t===null||t.feedId!==e.feedId||this.insideModel===null)return;const s=this.insideModel;if(this.insideModel=e,ou(s,e)){CM(this.scene,e,o=>Gc(e.feedId,o));for(const o of e.nodes)this.insideEntered?.payloads.set(Gc(e.feedId,o.id),o);return}const i=this.landed.get(e.feedId);if(i===void 0||this.scene.moving())return;const r=this.insidePlan_of(e.feedId,i,e,[[...t.ids]],400),a=new Set(r.unfolding);this.scene.unfold({...r,drawn:()=>{this.inside={...t,entered:this.insideEntered,ids:a},this.title_paint()}})}feedMarks_show(e,t){this.feedFrame?.show(e,t)}ascend(){if(!this.scene.moving()){if(this.framedAt=null,this.inside!==null){if(this.inside=null,this.insideModel=null,this.facts_clear(),this.pane?.classList.remove("universe-inside"),this.scene.waveLoop_set(!1),this.scene.draw_set(this.drawMode),this.drawPill!==null&&(this.drawPill.textContent=this.drawMode.toUpperCase()),this.feedFrame?.shown_set(!1),this.watch_hold(null),lu(this.pane,this.scene,this.inside!==null),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.paint(!1),this.scene.frame([],iI)}}cluster_enter(e){this.replay_end(),!(this.scene.moving()||this.inside!==null)&&this.cluster_show(e)}cluster_show(e){if(this.view==="feeds"){const r=jT(e,this.landed);if(r.length===0)return;this.cluster={shape:e,ids:r},this.pane?.classList.add("universe-cluster"),this.scene.relight($T(this.landed.all(),e,this.scale),r,pr,()=>this.landed_note(),()=>this.title_paint());return}const{graph:t,memberIds:s}=Hp(this.landed.all(),e,this.scale);if(s.length===0)return;this.cluster={shape:e,ids:s},this.pane?.classList.add("universe-cluster");const i=new Set(s);this.scene.unfold({graph:t,unfolding:t.nodes.filter(r=>i.has(r.id)||r.ghost===!0).map(r=>r.id),from:[Vp(e,this.landed)],physics:{reach:sd,gravity:!1},frame:s,durationMs:pr,drawn:()=>this.title_paint()},()=>this.landed_note())}landed_note(){this.framedAt=this.scene.camera_distance()}pinch_leave(){this.inside===null&&this.cluster===null||this.scene.moving()||this.scene.holding_get()||this.framedAt===null||this.scene.camera_distance()<=this.framedAt*rI||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.scene.moving()||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.scene.moving())return;if(this.inside===null){const s=Jc(e.id);if(s!==null){this.plugin_light(this.lit===s?null:s);return}const i=td(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=Qm(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){this.facts!==null&&(IM(this.facts,t,{enter:()=>{this.handlers.node_dive!==void 0?this.node_dive(e):this.handlers.node_enter?.(t.vfsPath)},...this.handlers.node_process!==void 0?{process:this.handlers.node_process}:{}}),this.facts.hidden=!1)}facts_clear(){this.facts!==null&&(this.facts.replaceChildren(),this.facts.hidden=!0)}state_stand(e,t){this.state!==null&&this.noteTimer===null&&Jt(this.state,e,t)}bar_note(e){this.state!==null&&(this.noteTimer!==null&&clearTimeout(this.noteTimer),this.noteTimer=null,Jt(this.state,"note",e),this.noteTimer=setTimeout(()=>{this.noteTimer=null,zr(this.state,"note"),this.title_paint()},ZT))}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_stand("wait","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_stand(this.liveState==="stale"?"stale":"live",this.liveState===null?"INSIDE":`INSIDE · ${this.liveState.toUpperCase()}`);return}if(this.cluster!==null){const t=this.landed.all().filter(s=>as(s)===this.cluster?.shape).length;this.title.textContent=`UNIVERSE — SHAPE ${WM(this.cluster.shape)} · ${t} FEED${t===1?"":"S"}`,this.state_stand("live","CLUSTER");return}if(this.asking&&!this.shown){this.title.textContent="UNIVERSE — ASKING THE SESSION …",this.state_stand("wait","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_stand(this.whole?"settled":"wait",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.scene.moving()||this.scene.frame(t,pr,void 0,.9)}pluginFacts_show(e){if(this.facts===null)return;this.facts.replaceChildren();const t=Ic(`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}=Eh(this.landed.all(),this.scale);this.dataHubs=t;const s=this.litHub;if(s===null)return e;const i=Ym(this.landed.all().map(a=>a.data?.seriesDescription).filter(a=>a!==void 0)),r=new Set(this.landed.all().filter(a=>Zm(a,i).some(o=>o.key===s)).map(a=>a.id));return{nodes:e.nodes.map(a=>{if(td(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_stand("live",t))}identity_note(e,t){const s=LT(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=$p(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=$p(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()},nI))}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,qp(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()+JT;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}`)},eI);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||!QT(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=qp(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 UM={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:"edit",label:()=>"EDIT",offered:n=>n.kind==="file"&&n.editable===!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}},{name:"a text file",facts:{kind:"file",feed:null,editable:!0}},{name:"a feed's note seen through /proc",facts:{kind:"file",feed:12,projection:!0,editable:!0}}]},FM={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]}}]},jM={listing:"runs.row",rules:[{name:"note",label:()=>"NOTE",offered:()=>!0},{name:"tag",label:()=>"TAG",offered:()=>!0},{name:"rename",label:()=>"RENAME",offered:()=>!0},{name:"share",label:()=>"SHARE",offered:()=>!0},{name:"delete",label:()=>"DELETE",offered:()=>!0}],states:[{name:"any feed",facts:{feedId:12}}]},pa={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}}]},wi={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}}]},$M={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}}]},VM={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 mi(n){return{listing:n.listing,visit(e){return e(n)}}}mi(UM),mi(FM),mi(jM),mi(pa),mi(wi),mi(VM),mi($M);function Ys(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}const mr={fold:"5.2em",patient:"13em",mrn:"7.5em"};function oI(n){return{inCube:n.pulled===!0,folderKnown:n.folderPath!==void 0,addressable:n.vfsPath!==void 0}}function Xp(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 gn(n){const e=oI(n),t=s=>Ys(wi,s).offered(e);return{gather:t("gather"),image:t("image"),dir:t("dir"),pull:t("pull")}}function lI(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 Kp=[{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"}],mo={running:"RETRIEVING",done:"✓ PULLED",error:"✗ ERROR",unconfirmed:"? UNCONFIRMED",stalled:"STALLED",queued:"QUEUED",idle:"NOT RETRIEVED"},cI="--fresh",Yp="--anon",dI=/\s*--anon\b/,uI=["pacs-f-name","pacs-f-mrn","pacs-f-accession","pacs-f-date"],Zp=/\s*--fresh\b/;function Qp(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 ol=new Map;function HM(n,e){const t=ol.get(n)??new Set;t.add(e),ol.set(n,t)}const qM=new Map;function XM(n,e){n.replaceChildren(),n.dataset.state=e.status,e.reason!==void 0?n.title=e.reason:n.removeAttribute("title");const t=document.createElement("span");if(t.className="pacs-badge-note",e.status==="idle"){t.textContent=mo.idle,n.append(qo({done:0,total:0}),t);return}if(e.status==="done"){const o=document.createElement("span");o.className="pacs-bar-full",t.textContent=e.total!==void 0&&e.total>0?`✓ ${e.total} IN CUBE`:"✓ IN CUBE",n.append(o,t);return}if(e.status!=="running"&&e.status!=="queued"){n.textContent=mo[e.status]??e.status.toUpperCase();return}const s=e.total!==void 0?` ${e.current??0}/${e.total}`:"",i=hI(e),r=document.createElement("span");r.className=i===null?"pacs-bar pacs-bar-pacing":"pacs-bar";const a=document.createElement("span");a.className="pacs-bar-fill",i!==null&&(a.style.width=`${Math.round(i*100)}%`),r.appendChild(a),t.textContent=e.status==="queued"?mo.queued:`${mo.running}${s}`,n.append(r,t)}function hI(n){return n.status==="queued"||n.total===void 0||n.total===0||(n.current??0)===0?null:Math.min(1,(n.current??0)/n.total)}function fI(n,e){return n.pulled===!0&&e.status!=="done"&&e.status!=="running"&&e.status!=="queued"}function pI(n,e){const t=ol.get(n);if(t!==void 0){for(const s of[...t]){if(!s.isConnected){t.delete(s);continue}e(s)}t.size===0&&ol.delete(n)}}function mI(n){const e=document.createElement("span");if(e.className="pacs-badge",n.pulled===!0){const r=document.createElement("span");r.className="pacs-bar-full";const a=document.createElement("span");return a.className="pacs-badge-note",a.textContent=n.pulledFiles!==void 0?`✓ ${n.pulledFiles} IN CUBE`:"✓ IN CUBE",e.append(r,a),e.dataset.state="done",e}const t=document.createElement("span");t.className="pacs-bar";const s=document.createElement("span");s.className="pacs-badge-note",s.textContent="NOT RETRIEVED",e.append(t,s),e.dataset.state="idle",HM(n.seriesUID,e);const i=qM.get(n.seriesUID);return i!==void 0&&XM(e,i),e}function KM(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 gI{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=Fs(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 ni({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?E0(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:wr(s=>s.studies.map((i,r)=>({study:i,key:Jp(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:wr(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:()=>tm("NO STUDIES FOUND")}),e.style.setProperty("--roster-cols",this.listing.template_get(1)),this.listing.rows_set([],{field:"pacs"});for(const{id:s}of Kp){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=Fs(e,"#pacs-f-server"),this.serverStrip=Fs(e,"#pacs-server-strip"),this.serverCell.addEventListener("click",()=>this.serverStrip_toggle()),this.serverCell_sync(),this.provenance=Fs(e,"#pacs-provenance"),this.anonPill=Fs(e,"#pacs-anon"),this.revealPill=Fs(e,"#pacs-reveal"),this.anonPill.addEventListener("click",()=>this.anon_set(!this.anon)),this.revealPill.addEventListener("click",()=>this.reveal_set(!this.revealed)),this.run=Fs(e,"#pacs-run"),this.run.addEventListener("click",()=>this.query_run(this.replayed)),this.command.addEventListener("keydown",s=>{s.key==="Enter"&&this.query_run()}),Fs(e,"#pacs-export").addEventListener("click",()=>this.answer_export()),Fs(e,"#pacs-gather-shown").addEventListener("click",()=>this.shown_gather()),Fs(e,"#pacs-pull-shown").addEventListener("click",()=>this.shown_pull())}patientTraits_declare(){return[{key:"fold",label:"",className:"pacs-fold",capped:!1,width:mr.fold,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:mr.patient,cell:e=>e.patient.patientName||"(unknown)"},{key:"mrn",label:"MRN",className:"pacs-patient-mrn",width:mr.mrn,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?"—":Qp(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 Ta(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(qo(Ta(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:mr.fold,cell:()=>{const e=document.createElement("span");return e.className="pacs-fold",e}},{key:"patient",label:"PATIENT",className:"pacs-study-patient",width:mr.patient,cell:e=>e.study.patientName||"(unknown)"},{key:"mrn",label:"MRN",className:"pacs-study-mrn",width:mr.mrn,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:Ys(pa,"pullStudy").label({addressable:!0,allInCube:!1}),offered:e=>Ys(pa,"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:Ys(pa,"gather").label({addressable:!0,allInCube:!1,anyInCube:!0}),offered:e=>e.study.series.some(t=>gn(t).gather),run:e=>{const t=e.study.series.filter(i=>gn(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:Ys(pa,"process").label({addressable:!0,allInCube:!0}),offered:e=>Xp(e.study)!==null,run:e=>{const t=Xp(e.study);t!==null&&this.handlers.process_open(t)}}]}studyProgress_of(e){return Ta(e.study.series.map(t=>this.seriesProgress.get(t.seriesUID)??{done:0,total:0}))}traits_declare(){return KM(e=>e.series,e=>this.badge_build(e))}actions_declare(){return[{label:Ys(wi,"gather").label({inCube:!0,folderKnown:!0,addressable:!0}),offered:e=>gn(e.series).gather,selected:e=>this.handlers.gathered_is(e.series.seriesUID),run:e=>this.gather_note(e.study,e.series)},{label:Ys(wi,"image").label({inCube:!0,folderKnown:!0,addressable:!0}),offered:e=>gn(e.series).image,selected:e=>e.series.folderPath!==void 0&&(this.litFolders.get(em(e.series.folderPath))?.viewer??!1),run:e=>{e.series.folderPath!==void 0&&this.handlers.image_open(e.series.folderPath)}},{label:Ys(wi,"dir").label({inCube:!0,folderKnown:!0,addressable:!0}),offered:e=>gn(e.series).dir,selected:e=>e.series.folderPath!==void 0&&(this.litFolders.get(em(e.series.folderPath))?.browser??!1),run:e=>{e.series.folderPath!==void 0&&this.handlers.dir_open(e.series.folderPath)}},{label:Ys(wi,"process").label({inCube:!0,folderKnown:!0,addressable:!0}),offered:e=>gn(e.series).image,run:e=>{e.series.folderPath!==void 0&&this.handlers.process_open(e.series.folderPath)}},{label:Ys(wi,"pull").label({inCube:!1,folderKnown:!1,addressable:!0}),offered:e=>gn(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 Kp){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?` ${Yp}`:"";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()} ${Yp}`.trim():this.command.value.replace(dI,"").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 uI)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(tm("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&&!Zp.test(this.command.value)&&(this.command.value=`${this.command.value.trim()} ${cI}`);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(Zp,"").trimEnd();return}const t=e?.answeredAt??"",s=Qp(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===x0){const i=O0.safeParse(e.model.data);i.success&&this.servers_take(i.data.servers);return}if(e.model?.kind!==S0)return;const s=y0.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),e.reason!==void 0&&(s.reason=e.reason),this.badgeState_set(e.itemId,s),t==="done"&&this.model!==null&&lI(this.model,e.itemId,e.current??e.total,e.path)&&this.results_repaint()}badgeState_set(e,t){this.badgeStates.set(e,t),qM.set(e,t),this.seriesProgress.set(e,bI(t,this.seriesProgress.get(e))),pI(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 HM(e.seriesUID,t),this.badge_paint(t,this.badgeStates.get(e.seriesUID)??{status:"idle"}),t}badge_paint(e,t){XM(e,t)}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,[Jp(e.studies[0],0)])}for(const s of e.studies)for(const i of s.series){const r=this.badgeStates.get(i.seriesUID);if(r!==void 0&&fI(i,r)){this.badgeState_set(i.seriesUID,{status:"done",...i.pulledFiles!==void 0?{total:i.pulledFiles}:{}});continue}t&&r!==void 0||this.seriesProgress.set(i.seriesUID,MI(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(qo(Ta(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})=>gn(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=>gn(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 Jp(n,e){return n.studyUID??`study-${e}`}function em(n){return n.replace(/\/$/,"")}function MI(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 bI(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 Fs(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=Fs(n,e);if(!(t instanceof HTMLInputElement))throw new Error(`'${e}' is not an input`);return t}function tm(n){const e=document.createElement("p");return e.className="files-empty",e.textContent=n,e}const _I={"fs.listing":"files","feed.dag":"dag","feed.list":"dag","pacs.query":"pacs","dicom.series":"image","dicom.tags":"tags"};class zI{result;handlers;constructor(e,t){this.handlers=t,this.result=aa(e,".empty-result"),Hs(this.result);const s=aa(e,".empty-prompt");s.addEventListener("keydown",i=>{i.key==="Enter"&&s.value.trim().length>0&&(this.line_run(s.value.trim()),s.value="")}),aa(e,".empty-go-files").addEventListener("click",()=>{this.line_run("ls .")}),aa(e,".empty-go-dag").addEventListener("click",()=>{this.line_run("proc feeds")}),aa(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?_I[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(`
4271
- `);this.result.textContent=wI(s)||"(no output)"}}function aa(n,e){const t=n.querySelector(e);if(t===null)throw new Error(`empty pane template is missing ${e}`);return t}function wI(n){return n.replace(/\x1b\[[0-9;:]*[A-Za-z]/g,"")}class yI{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 vI="modulepreload",OI=function(n,e){return new URL(n,e).href},sm={},cu=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=OI(d,s),d in sm)return;sm[d]=!0;const u=d.endsWith(".css"),h=u?'[rel="stylesheet"]':"";if(s)for(let f=a.length-1;f>=0;f--){const M=a[f];if(M.href===d&&(!u||M.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${d}"]${h}`))return;const p=document.createElement("link");if(p.rel=u?"stylesheet":vI,u||(p.as="script"),p.crossOrigin="",p.href=d,l&&p.setAttribute("nonce",l),document.head.appendChild(p),u)return new Promise((f,M)=>{p.addEventListener("load",f),p.addEventListener("error",()=>M(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)})},xI=/Failed to fetch dynamically imported module|error loading dynamically imported module|Importing a module script failed/i;function ih(n){const e=n instanceof Error?n.message:String(n??"");return xI.test(e)}const Or={before:"ARGUS has been updated in the background — ",refresh:"refresh",after:" this page"},SI=`${Or.before}${Or.refresh}${Or.after}`,ll="ARGUS UPDATED IN THE BACKGROUND · REFRESH THIS PAGE";function EI(n,e=document.body){let t=!1;const s=()=>{if(t)return;t=!0,n(`argus: ${SI} (what failed to load was part of the old build)`);const i=document.createElement("div");i.className="stale-page",i.setAttribute("role","alert");const r=document.createElement("span");r.className="stale-page-words";const a=document.createElement("button");a.type="button",a.className="stale-page-reload",a.textContent=Or.refresh,a.title="load the argus the server has now",a.addEventListener("click",()=>{window.location.reload()}),r.append(document.createTextNode(Or.before),a,document.createTextNode(Or.after)),i.append(r),e.appendChild(i)};window.addEventListener("vite:preloadError",()=>{s()}),window.addEventListener("unhandledrejection",i=>{ih(i.reason)&&s()})}const AI=[{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"}],DI=256*1024*1024;function Mo(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 TI(n){const e=n.toUpperCase();return e==="MR"||e==="CT"||e==="PT"?e:"OT"}class II{pane;field;title;modeSpan;stateSpan;layoutPills=new Map;overlayPill;colormapPill;savePill;loadPill;retryPill;presetPill;focusMark;guardBytes=DI;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=vs(e,".image-field"),this.title=vs(e,".pane-title"),this.modeSpan=vs(e,".pane-mode"),this.stateSpan=vs(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=vs(e,".image-overlay"),this.overlayPill.addEventListener("click",()=>{this.overlay_set(!this.overlay)}),this.colormapPill=vs(e,".image-colormap"),this.savePill=vs(e,".image-save"),this.loadPill=vs(e,".image-load"),this.retryPill=vs(e,".image-retry"),this.presetPill=vs(e,".image-preset"),this.focusMark=vs(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()),vs(e,".image-tags").addEventListener("click",()=>this.handlers.tags_open());for(const s of Ph){const i=vs(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=TI(e.modality),this.title.textContent=`IMAGE ${e.modality.toUpperCase()} ${e.seriesDescription}`.trim(),this.title.title=this.title.textContent,this.siblings.length>1){const a=this.siblings.findIndex(o=>o.path===e.path)+1;this.handlers.note(`image: series ${a} of ${this.siblings.length} in this study; image series <n> switches`)}const s=await this.chunk_import(()=>cu(()=>import("./cornerstoneEngine-Dnrud_dx.js").then(a=>a.b2),__vite__mapDeps([0,1,2]),import.meta.url));if(s===null)return;const{CornerstoneEngine:i}=s,r=new i(this.engineHost_get(),e,t.startAt??1);await this.engine_open(r),this.engine===r&&(this.guard_trips()?(this.loadPill.hidden=!1,this.stateSpan.textContent=`SERIES ${Mo(e.bytes)} · LOAD FOR STACK`,this.handlers.note(`image: ${Mo(e.bytes)} to fetch before the stack scrolls; press LOAD, image load, or image --force <path>`)):r.slices_fill(),await this.annotations_reload(r,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 t=await this.chunk_import(()=>cu(()=>import("./niivueEngine-CwVnap6o.js"),__vite__mapDeps([3,1]),import.meta.url));if(t===null)return;const{NiivueEngine:s}=t;await this.engine_open(new s(this.engineHost_get(),e))}async chunk_import(e){try{const t=await e();if(t!==void 0)return t}catch(t){if(!ih(t))throw t}return Jt(this.stateSpan,"stale",ll),this.handlers.note(`image: ${ll.toLowerCase()} — the viewer's code is of an older build than the server has`),null}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 ${Mo(this.series?.bytes??0)} · LOAD FOR ${e.toUpperCase()}`,this.handlers.note(`image: ${Mo(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 rg.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=$z(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=yo[(yo.indexOf(this.colormap)+1)%yo.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=AI.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()??Ph),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 vs(n,e){const t=n.querySelector(e);if(t===null)throw new Error(`image pane: missing ${e}`);return t}const YM=["patient","study","series","image","equipment","meta","private","other","varying"],GI=new Set(["meta","private"]),nm="••••";class RI{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 ni({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:wr(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:wr(i=>i.items,{traits:this.itemTraits_declare(),key:i=>i.key,row:{className:()=>"tags-item-row",groupClassName:()=>"tags-item"},child:wr(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:()=>PI("NO TAGS")}),this.redactBlock_paint(),this.listing.rows_set([],{field:"tags"})}model_show(e){this.model=e,this.title.textContent=`TAGS ${BI(e)}`,this.pane.dataset.modality=CI(e),this.groups=NI(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=>!GI.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=nm,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[Nc(()=>!0),{key:"group",label:"GROUP",className:"tags-group-name",width:"minmax(12em, 1fr)",cell:e=>e.group.toUpperCase(),compare:e=>YM.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[Nc(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?nm:`${e.value} ${e.decoded??""}`).toLowerCase()}]}itemTraits_declare(){return[Nc(()=>!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 Nc(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 NI(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(ZM(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}`}))),YM.filter(t=>e.has(t)).map(t=>({group:t,rows:e.get(t)??[]}))}function ZM(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=>ZM(i,`${e}/${s+1}/${i.tag}`))})),key:e}}function BI(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 CI(n){const e=(n.constant.find(t=>t.name==="Modality")?.value??"").toUpperCase();return e==="MR"||e==="CT"||e==="PT"?e:"OT"}function PI(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 LI{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 Bc=["⣾","⣽","⣻","⢿","⡿","⣟","⣯","⣷"],WI=new Set(["done","error","unconfirmed","stalled","timeout"]);function kI(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&&WI.has(e.status)){n.delete(t);return}n.add(t)}const UI=100;class FI{fields;buildShown=!1;running=new Set;activityTimer=null;activityFrame=0;constructor(e){this.fields={identity:gi(e,"status-identity"),jobs:gi(e,"status-jobs"),activity:gi(e,"status-activity"),latency:gi(e,"status-latency"),mismatch:gi(e,"status-mismatch"),lamp:gi(e,"status-lamp"),host:gi(e,"status-host")}}attach_show(e){if(e.protocolVersion!==jc){this.fields.mismatch.textContent=`WIRE V${e.protocolVersion} ≠ V${jc}`,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??[])}build_show(e,t=""){this.fields.mismatch.textContent!==""&&!this.buildShown||(this.buildShown=e!==null,this.fields.mismatch.textContent=e??"",this.fields.mismatch.title=t)}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(`
4271
+ `);this.result.textContent=wI(s)||"(no output)"}}function aa(n,e){const t=n.querySelector(e);if(t===null)throw new Error(`empty pane template is missing ${e}`);return t}function wI(n){return n.replace(/\x1b\[[0-9;:]*[A-Za-z]/g,"")}class yI{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 vI="modulepreload",OI=function(n,e){return new URL(n,e).href},sm={},cu=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=OI(d,s),d in sm)return;sm[d]=!0;const u=d.endsWith(".css"),h=u?'[rel="stylesheet"]':"";if(s)for(let f=a.length-1;f>=0;f--){const M=a[f];if(M.href===d&&(!u||M.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${d}"]${h}`))return;const p=document.createElement("link");if(p.rel=u?"stylesheet":vI,u||(p.as="script"),p.crossOrigin="",p.href=d,l&&p.setAttribute("nonce",l),document.head.appendChild(p),u)return new Promise((f,M)=>{p.addEventListener("load",f),p.addEventListener("error",()=>M(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)})},xI=/Failed to fetch dynamically imported module|error loading dynamically imported module|Importing a module script failed/i;function ih(n){const e=n instanceof Error?n.message:String(n??"");return xI.test(e)}const Or={before:"ARGUS has been updated in the background — ",refresh:"refresh",after:" this page"},SI=`${Or.before}${Or.refresh}${Or.after}`,ll="ARGUS UPDATED IN THE BACKGROUND · REFRESH THIS PAGE";function EI(n,e=document.body){let t=!1;const s=()=>{if(t)return;t=!0,n(`argus: ${SI} (what failed to load was part of the old build)`);const i=document.createElement("div");i.className="stale-page",i.setAttribute("role","alert");const r=document.createElement("span");r.className="stale-page-words";const a=document.createElement("button");a.type="button",a.className="stale-page-reload",a.textContent=Or.refresh,a.title="load the argus the server has now",a.addEventListener("click",()=>{window.location.reload()}),r.append(document.createTextNode(Or.before),a,document.createTextNode(Or.after)),i.append(r),e.appendChild(i)};window.addEventListener("vite:preloadError",()=>{s()}),window.addEventListener("unhandledrejection",i=>{ih(i.reason)&&s()})}const AI=[{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"}],DI=256*1024*1024;function Mo(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 TI(n){const e=n.toUpperCase();return e==="MR"||e==="CT"||e==="PT"?e:"OT"}class II{pane;field;title;modeSpan;stateSpan;layoutPills=new Map;overlayPill;colormapPill;savePill;loadPill;retryPill;presetPill;focusMark;guardBytes=DI;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=vs(e,".image-field"),this.title=vs(e,".pane-title"),this.modeSpan=vs(e,".pane-mode"),this.stateSpan=vs(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=vs(e,".image-overlay"),this.overlayPill.addEventListener("click",()=>{this.overlay_set(!this.overlay)}),this.colormapPill=vs(e,".image-colormap"),this.savePill=vs(e,".image-save"),this.loadPill=vs(e,".image-load"),this.retryPill=vs(e,".image-retry"),this.presetPill=vs(e,".image-preset"),this.focusMark=vs(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()),vs(e,".image-tags").addEventListener("click",()=>this.handlers.tags_open());for(const s of Ph){const i=vs(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=TI(e.modality),this.title.textContent=`IMAGE ${e.modality.toUpperCase()} ${e.seriesDescription}`.trim(),this.title.title=this.title.textContent,this.siblings.length>1){const a=this.siblings.findIndex(o=>o.path===e.path)+1;this.handlers.note(`image: series ${a} of ${this.siblings.length} in this study; image series <n> switches`)}const s=await this.chunk_import(()=>cu(()=>import("./cornerstoneEngine-BJeodQK9.js").then(a=>a.b2),__vite__mapDeps([0,1,2]),import.meta.url));if(s===null)return;const{CornerstoneEngine:i}=s,r=new i(this.engineHost_get(),e,t.startAt??1);await this.engine_open(r),this.engine===r&&(this.guard_trips()?(this.loadPill.hidden=!1,this.stateSpan.textContent=`SERIES ${Mo(e.bytes)} · LOAD FOR STACK`,this.handlers.note(`image: ${Mo(e.bytes)} to fetch before the stack scrolls; press LOAD, image load, or image --force <path>`)):r.slices_fill(),await this.annotations_reload(r,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 t=await this.chunk_import(()=>cu(()=>import("./niivueEngine-BuUczFAb.js"),__vite__mapDeps([3,1]),import.meta.url));if(t===null)return;const{NiivueEngine:s}=t;await this.engine_open(new s(this.engineHost_get(),e))}async chunk_import(e){try{const t=await e();if(t!==void 0)return t}catch(t){if(!ih(t))throw t}return Jt(this.stateSpan,"stale",ll),this.handlers.note(`image: ${ll.toLowerCase()} — the viewer's code is of an older build than the server has`),null}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 ${Mo(this.series?.bytes??0)} · LOAD FOR ${e.toUpperCase()}`,this.handlers.note(`image: ${Mo(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 rg.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=$z(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=yo[(yo.indexOf(this.colormap)+1)%yo.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=AI.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()??Ph),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 vs(n,e){const t=n.querySelector(e);if(t===null)throw new Error(`image pane: missing ${e}`);return t}const YM=["patient","study","series","image","equipment","meta","private","other","varying"],GI=new Set(["meta","private"]),nm="••••";class RI{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 ni({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:wr(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:wr(i=>i.items,{traits:this.itemTraits_declare(),key:i=>i.key,row:{className:()=>"tags-item-row",groupClassName:()=>"tags-item"},child:wr(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:()=>PI("NO TAGS")}),this.redactBlock_paint(),this.listing.rows_set([],{field:"tags"})}model_show(e){this.model=e,this.title.textContent=`TAGS ${BI(e)}`,this.pane.dataset.modality=CI(e),this.groups=NI(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=>!GI.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=nm,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[Nc(()=>!0),{key:"group",label:"GROUP",className:"tags-group-name",width:"minmax(12em, 1fr)",cell:e=>e.group.toUpperCase(),compare:e=>YM.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[Nc(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?nm:`${e.value} ${e.decoded??""}`).toLowerCase()}]}itemTraits_declare(){return[Nc(()=>!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 Nc(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 NI(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(ZM(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}`}))),YM.filter(t=>e.has(t)).map(t=>({group:t,rows:e.get(t)??[]}))}function ZM(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=>ZM(i,`${e}/${s+1}/${i.tag}`))})),key:e}}function BI(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 CI(n){const e=(n.constant.find(t=>t.name==="Modality")?.value??"").toUpperCase();return e==="MR"||e==="CT"||e==="PT"?e:"OT"}function PI(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 LI{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 Bc=["⣾","⣽","⣻","⢿","⡿","⣟","⣯","⣷"],WI=new Set(["done","error","unconfirmed","stalled","timeout"]);function kI(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&&WI.has(e.status)){n.delete(t);return}n.add(t)}const UI=100;class FI{fields;buildShown=!1;running=new Set;activityTimer=null;activityFrame=0;constructor(e){this.fields={identity:gi(e,"status-identity"),jobs:gi(e,"status-jobs"),activity:gi(e,"status-activity"),latency:gi(e,"status-latency"),mismatch:gi(e,"status-mismatch"),lamp:gi(e,"status-lamp"),host:gi(e,"status-host")}}attach_show(e){if(e.protocolVersion!==jc){this.fields.mismatch.textContent=`WIRE V${e.protocolVersion} ≠ V${jc}`,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??[])}build_show(e,t=""){this.fields.mismatch.textContent!==""&&!this.buildShown||(this.buildShown=e!==null,this.fields.mismatch.textContent=e??"",this.fields.mismatch.title=t)}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(`
4272
4272
  `):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){kI(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=Bc[this.activityFrame]??Bc[0];this.fields.activity.textContent=`${t} ${this.running.size} RUNNING`};e(),this.activityTimer===null&&(this.activityTimer=window.setInterval(()=>{this.activityFrame=(this.activityFrame+1)%Bc.length,e()},UI))}}function gi(n,e){const t=n.getElementById(e);if(t===null)throw new Error(`status bar: no element with id '${e}'`);return t}function jI(n){return n>=6e4?`${Math.max(1,Math.round(n/6e4))} MIN`:`${Math.max(1,Math.round(n/1e3))} S`}function Ds(n){return n.toLocaleString("en-US")}class $I{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?`${Ds(this.counts.jobs)} JOBS · ${Ds(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(`
4273
- `),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 ${Ds(t.loaded)} / ${t.total!==void 0?Ds(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:`${Ds(l.running)} IN ${Ds(l.runningFeeds)} FEEDS · SCHEDULED ${Ds(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 ${Ds(l.errored)} IN ${Ds(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?Ds(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 ${Ds(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 ${Ds(l.loaded)} / ${c}${d!==null?` · ETA ${jI(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 VI=3e3;class HI{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>=VI})}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 qI=[2,3,3,2,2,11,2,2],XI=4,im=300,KI=2600,YI=650;class ZI{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(),im);return}const t=this.narrowSources_list(),s=this.wideSources_list();let i=0,r=0;for(const a of qI){const o=document.createElement("div");o.className="data-column";for(let l=1;l<=XI;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=rm(u.source(),a),o.appendChild(c),this.cells.push(u)}e.appendChild(o)}window.setInterval(()=>this.beat_paint(),im),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,()=>QI()]}uptimeSeconds_get(){return Math.floor((Date.now()-this.bootedAt)/1e3)}beat_paint(){for(const e of this.cells){const t=rm(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"),YI))},KI)}}function rm(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 QI(){const n=new Date;return n.getHours()*1e4+n.getMinutes()*100+n.getSeconds()}const JI=2e4;class eG{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 Al(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(),JI)))}envelope_observe(e){if(e.model?.kind!==Kn.pipelineDiagram)return;const t=mu.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}`)}}function tG(n,e){n.line_execute("ls /bin",{silent:!0,observe:!1}).then(t=>{const r=(t.envelopes.find(a=>a.model?.kind==="fs.listing")?.model?.data??[]).flatMap(a=>a.items).filter(a=>a.type==="pipeline").map(a=>a.name);e.names_set(r)})}const sG=new Set(["files","dag","pacs"]);function am(n){return sG.has(n)}const QM=new Map,Cr=new Map;let nG=0;function Os(n,e){QM.set(n,e)}function iG(n){const e=QM.get(n);if(e===void 0)throw new Error(`no pane factory registered for kind '${n}'`);const t=e(`${n}-${nG++}`);return Cr.set(t.id,t),t}function gr(n){Cr.set(n.id,n)}function Go(n){return Cr.get(n)}function Ro(){return[...Cr.values()]}function es(n){const e=Cr.get(n);e!==void 0&&(Cr.delete(n),e.dispose?.(),e.mount.remove())}class rG{byId=new Map;set(e,t,s){this.byId.set(t,{kind:e,panel:s})}get(e,t){const s=this.byId.get(t);return s!==void 0&&s.kind===e?s.panel:void 0}has(e,t){return this.byId.get(t)?.kind===e}delete(e){return this.byId.delete(e)}ids(e){return this.entries(e).map(([t])=>t)}entries(e){const t=[];for(const[s,i]of this.byId)i.kind===e&&t.push([s,i.panel]);return t}values(e){return this.entries(e).map(([,t])=>t)}idOf(e,t){for(const[s,i]of this.byId)if(i.kind===e&&i.panel===t)return s;return null}}function xa(n,e){if("pane"in n)return n.pane===e?[]:null;const t=xa(n.first,e);if(t!==null)return[{node:n,side:"first"},...t];const s=xa(n.second,e);return s!==null?[{node:n,side:"second"},...s]:null}function Sa(n,e,t){if(n===e)return t;if("pane"in n)return null;const s=Sa(n.first,e,t);if(s!==null)return{...n,first:s};const i=Sa(n.second,e,t);return i!==null?{...n,second:i}:null}function om(n,e,t){const s=xa(n,e);if(s===null||s.length===0)return"lone";const i=ms[t].axis,r=ms[t].place==="after"?"first":"second",a=s[s.length-1];let o=null;for(let u=s.length-1;u>=0;u-=1){const h=s[u];if(h.node.dir===i&&h.side===r){o=h.side==="first"?h.node.second:h.node.first;break}}if(o===null){if(a.node.dir===i)return"edge";o=a.side==="first"?a.node.second:a.node.first}const l=dl(n,e);if(l===null)return"lone";const c={pane:e};return Sa(l,o,r==="first"?{dir:i,ratio:.5,first:o,second:c}:{dir:i,ratio:.5,first:c,second:o})??"edge"}const lm="argus-layout";class aG{root;mounts;presets=new Map;prefs={};activePreset="";tree=null;focusedPane=null;renderObserver=null;previousFocus=null;constructor(e,t){this.root=e,this.mounts=t;try{const s=window.localStorage.getItem(lm);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=cl(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_move(e,t){if(this.tree===null)return"lone";const s=om(this.tree,e,t);return typeof s=="string"?s:(this.tree=s,this.focusedPane=e,this.render(),!0)}focus_last(){const e=this.previousFocus;return e===null||!this.panes_shown().includes(e)?null:(this.focus_set(e),e)}leaf_flip(e){if(this.tree===null)return!1;const t=xa(this.tree,e);if(t===null||t.length===0)return!1;const s=t[t.length-1],i={...s.node,dir:s.node.dir==="col"?"row":"col"},r=Sa(this.tree,s.node,i);return r===null?!1:(this.tree=r,this.render(),!0)}leaf_resize(e,t,s=.05){if(this.tree===null)return!1;const i=xa(this.tree,e);if(i===null||i.length===0)return!1;const r=ms[t].axis;for(let a=i.length-1;a>=0;a-=1){const o=i[a];if(o.node.dir!==r)continue;const l=ms[t].place==="after",c=Math.min(.85,Math.max(.15,o.node.ratio+(l?s:-s))),d={...o.node,ratio:c},u=Sa(this.tree,o.node,d);return u===null?!1:(this.tree=u,this.ratio_remember(i.slice(0,a).map(h=>h.side==="first"?"0":"1").join(""),c),this.render(),!0)}return!1}move_possible(e,t){return this.tree!==null&&typeof om(this.tree,e,t)!="string"}leaf_replace(e,t){if(this.tree===null)return!1;const s=cl(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=dl(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.focus_reconcile(),this.renderObserver?.()}}focus_reconcile(){const e=this.panes_shown();if(this.focusedPane!==null&&e.includes(this.focusedPane))return;const t=e[0];if(t===void 0)return;const s=this.focusedPane;this.focusedPane=null,this.focus_set(t),s!==null&&(this.previousFocus=s)}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!==null&&(this.previousFocus=this.focusedPane),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(lm,JSON.stringify(this.prefs))}catch{}}}function cl(n,e,t){if("pane"in n)return n.pane===e?t:null;const s=cl(n.first,e,t);if(s!==null)return{...n,first:s};const i=cl(n.second,e,t);return i!==null?{...n,second:i}:null}function dl(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=dl(n.first,e);if(t!==null)return{...n,first:t};const s=dl(n.second,e);return s!==null?{...n,second:s}:null}const oG=4e3;function lG(n){const e=new WeakMap,t=(o,l)=>{const c=n.paneInstance_get(o)?.mount.querySelector(".pane-state")??null;if(c===null)return;const d=e.get(c);d!==void 0&&clearTimeout(d);const u={text:c.textContent??"",className:c.className};Jt(c,"note",l),e.set(c,setTimeout(()=>{e.delete(c),c.textContent===l&&(c.className=u.className,c.textContent=u.text)},oG))};return{bar_note:t,move:(o,l)=>{const c=n.layout.leaf_move(o,l);return c==="lone"?"pane move: the only pane on stage":c==="edge"?`pane move ${l}: already ${ms[l].edge}`:(t(o,`MOVED ${l.toUpperCase()}`),n.sound("audio3"),`moved ${l}`)},flip:o=>n.layout.leaf_flip(o)?(t(o,"FLIPPED"),n.sound("audio3"),"flipped"):"pane flip: the only pane on stage",resize:(o,l,c)=>n.layout.leaf_resize(o,l,c)?`resized ${ms[l].focusWord}`:`pane resize ${ms[l].focusWord}: no boundary that way`,chordKeys_of:(o,l)=>{const c=Ci.filter(d=>d.selector===o&&d.move===!0===l).map(d=>d.key);return c.length===0?"":` [keys ${c.join(" ")}]`}}}const cG={image:"viewer",view:"viewer",dir:"files",fs:"files",tags:"tags",empty:"pane",domain:"dag",catalogue:"catalogue",graph:"dag",gather:"gather",edit:"editor"},Cc=240;function dG(n,e){const{layout:t,panels:s,paneInstance_get:i,dormant:r}=n,a=new Map;let o=!1,l=null;const c=w=>i(w)?.kind??null,d=(w,z,y,O,S)=>{a.set(w,{parent:z,dir:y,before:O,...S!==void 0?{binding:S}:{}})},u=w=>{if(w==="pacs")return"⊞";if(w==="dag")return"⋔";const z=c(w);return z==="image"?"▣":z==="tags"?"≣":z==="edit"?"✎":"▤"},h=w=>{if(w.length===0)return;const z=[];for(const A of w){const I=i(A)?.mount;if(I===void 0)continue;const G=I.getBoundingClientRect();G.width>0&&G.height>0&&z.push({id:A,left:G.left,top:G.top,width:G.width,height:G.height})}if(z.length===0)return;const y=Math.min(...z.map(A=>A.left)),O=Math.min(...z.map(A=>A.top)),S=Math.max(...z.map(A=>A.left+A.width))-y,b=Math.max(...z.map(A=>A.top+A.height))-O;if(S<=0||b<=0)return;const v=Cc/S,E=Math.max(40,Math.min(260,Math.round(b*v)));try{const A=document.createElement("canvas");A.width=Cc,A.height=E;const I=A.getContext("2d");if(I===null)return;const C=getComputedStyle(document.documentElement).getPropertyValue("--harvestgold").trim()||"#c9a15a";I.fillStyle="#05070a",I.fillRect(0,0,Cc,E);for(const B of z){const P=Math.round((B.left-y)*v),L=Math.round((B.top-O)*v),H=Math.max(6,Math.round(B.width*v)),X=Math.max(6,Math.round(B.height*v)),oe=i(B.id)?.mount.querySelector("canvas");if(oe!=null&&oe.width>0){const J=Math.min(H/oe.width,X/oe.height),ce=Math.round(oe.width*J),We=Math.round(oe.height*J);I.fillStyle="#000",I.fillRect(P,L,H,X),I.drawImage(oe,P+Math.round((H-ce)/2),L+Math.round((X-We)/2),ce,We)}else I.fillStyle="rgba(255,255,255,0.05)",I.fillRect(P,L,H,X),I.fillStyle=C,I.font=`${Math.max(9,Math.min(28,Math.round(Math.min(H,X)*.5)))}px serif`,I.textAlign="center",I.textBaseline="middle",I.fillText(u(B.id),P+H/2,L+X/2+1);I.strokeStyle="rgba(255,255,255,0.22)",I.lineWidth=1,I.strokeRect(P+.5,L+.5,H-1,X-1)}return A.toDataURL("image/png")}catch{return}},p=(w,z,y)=>{const O=c(w),S=a.get(w),b={dir:S?.dir??"col",side:cv(S?.before??!1)};if(am(w)){const E=z==="dag"?"runs":z,A=z==="pacs"?e.pacsQuery_get():null,I=z==="dag"?s.get("dag","dag"):void 0,G=I!==void 0&&I.graph_isShown()?I.feed_get():null,C=G!==null&&I!==void 0?I.view_lines():[],B=G!==null?I?.feedTitle_get():void 0;return{action:{op:"domain",domain:E,...A!==null?{query:A}:{},...G!==null?{feed:G}:{},...C.length>0?{view:C}:{}},...B!==void 0?{label:B}:{}}}if(S?.binding==="fs"||S?.binding==="view"||S?.binding==="empty")return{action:{op:S.binding,target:y,...b}};if(O==="image"){const E=s.get("image",w),A=E?.state_get()??null;if(E===void 0||A===null||A.path===null)return null;const I=[];A.layout!=="single"&&I.push(`image layout ${A.layout}`),A.colormap!==void 0&&A.colormap!=="gray"&&I.push(`image colormap ${A.colormap}`),A.voi!==void 0&&A.voi!==null&&I.push(`image wl ${A.voi.lower} ${A.voi.upper}`),A.slice>1&&I.push(`image slice ${A.slice}`),A.ghost!==void 0&&A.ghost!==null&&A.layout==="slab"&&I.push(`image ghost ${A.ghost}`);const G=E.series_get(),C=[G?.seriesDescription??"",G?.modality??""].filter(B=>B!=="");return{action:{op:"image",path:A.path,target:y,...b,...I.length>0?{view:I}:{}},anchor:A.path,...C.length>0?{label:C.join(" · ")}:{}}}const v=e.catalogue_of(w);if(v!==void 0){const E=s.get("files",w)?.commandLine_get()??"";return{action:{op:"catalogue",input:v.input,target:y,...b,...v.feed!==null?{feed:v.feed}:{},...v.node!==null?{node:v.node}:{},...E!==""?{line:E}:{}},label:`PROCESS ${v.input.split("/").filter(Boolean).pop()??v.input}`}}if(O==="files"){const E=s.get("files",w)?.path_current()??null;return typeof E!="string"||E.length===0?null:{action:{op:"dir",path:E,target:y,...b}}}if(O==="gather"){const E=s.get("gather",w);if(E===void 0)return null;const A=[...E.entries_get()],I=E.name_get(),G=E.feed_get();return{action:{op:"gather",series:A,target:y,...b,...I!==null?{name:I}:{},...G!==null?{feed:G.feedId,root:{instance:G.rootInstanceId,path:G.path}}:{}},label:I??`GATHER · ${A.length} series`}}if(O==="dag"){const E=s.get("dag",w)?.feed_get()??null;return E===null?null:{action:{op:"graph",feed:E,target:y,...b}}}if(O==="tags")return{action:{op:"tags",target:y,...b}};if(O==="edit"){const E=s.get("edit",w)?.path_get()??null;return E===null?null:{action:{op:"edit",path:E,target:y,...b},label:`EDIT ${E.split("/").pop()??E}`}}return null},f=()=>{if(o)return;const w=new Set(t.panes_shown()),z=t.activePreset_get();if(z==="panes"||z==="launcher")return;const y=Ro().map(X=>X.id).filter(X=>w.has(X)),O=new Map;let S,b;const v=[];for(const X of y){const oe=O.get(a.get(X)?.parent??"")??0,J=p(X,z,oe);J!==null&&(O.set(X,v.length),v.push(J.action),J.anchor!==void 0?S===void 0&&(S=J.anchor,J.label!==void 0&&(b=J.label)):J.label!==void 0&&b===void 0&&(b=J.label))}const E=v.filter(X=>X.op!=="domain"||X.feed!==void 0);if(E.length===0)return;const A=h(y),I=X=>{if("pane"in X){const ce=O.get(X.pane);return ce===void 0?null:{leaf:ce}}const oe=I(X.first),J=I(X.second);return oe===null?J:J===null?oe:{dir:X.dir,ratio:X.ratio,first:oe,second:J}},G=t.tree_get(),C=G===null?null:I(G),B=[...new Set(E.map(X=>cG[X.op]??"pane"))];let P,L,H;if(S!==void 0)P=S,L=b??S.split("/").pop()??S,H={address:S,modelKind:"dicom.series"};else{const X=E.map(ce=>ce.path).find(ce=>ce!==void 0),oe=E.map(ce=>ce.path??(ce.input!==void 0?`catalogue:${ce.input}`:ce.series!==void 0?`gather:${ce.series.map(We=>We.seriesUID).join(",")}`:ce.feed!==void 0?`feed:${ce.feed}`:ce.op)).sort().join("|"),J=z==="dag"?"RUNS":z.toUpperCase();P=`${z}:${oe}`,L=b!==void 0&&b!==""?b:X!==void 0?X.split("/").pop()??X:`${J} · ${E.length+1} panes`,H={address:P,modelKind:"argus.desktop"}}r.add({id:P,label:L,regard:H,members:B,actions:v,...C===null?{}:{shape:C},...A===void 0?{}:{thumbnail:A},lastTouched:Date.now()})},M=()=>{const w=new Set(t.panes_shown());for(const z of Ro())w.has(z.id)||am(z.id)||z.id==="panes"||z.id==="launcher"||z.id==="universe"||(es(z.id),t.mount_remove(z.id));e.stage_relight()},g=w=>{f(),t.preset_apply(w),M()},m=(w,z)=>{const y=v=>Ro().filter(E=>t.panes_shown().includes(E.id)&&c(E.id)===v).map(E=>E.id),O={dir:w.dir??"col",before:w.side==="before"},S=v=>{l=O;try{return v()}finally{l=null}},b=(v,E)=>y(v).find(A=>!E.has(A))??null;if(w.op==="domain"){const v=w.domain==="runs"?"dag":w.domain==="pacs"?"pacs":"files";if(g(v),w.query!==void 0&&n.terminal.line_run(w.query),w.feed!==void 0){const E=w.feed,A=w.view??[],I=s.get("dag","dag");if(I?.feed_enter(E),A.length>0&&I!==void 0){const G=C=>{if(I.graph_isShown()&&I.feed_get()===E){for(const B of A)n.terminal.line_run(B);return}C>0&&window.setTimeout(()=>G(C-1),250)};G(240)}}return v}if(z!==null&&t.focus_set(z),w.op==="image"&&w.path!==void 0){let v=null;const E=w.path,A=S(()=>e.image_open(null,E,{},C=>{v=C})),I=w.view,G=v;return I!==void 0&&I.length>0&&G!==null&&A.then(()=>{for(const C of I)t.focus_set(G),n.terminal.line_run(C)}).catch(()=>{}),v}if(w.op==="dir"&&w.path!==void 0){const v=new Set(y("files")),E=w.path;return S(()=>e.dir_open(E)),b("files",v)}if(w.op==="tags"){const v=new Set(y("tags"));return S(()=>n.terminal.line_run("image tags")),b("tags",v)}if(w.op==="catalogue"&&w.input!==void 0){const v=()=>e.catalogueIds().filter(G=>t.panes_shown().includes(G)),E=new Set(v()),A=w.input;S(()=>e.process_open(z??"files",{input:A,feed:w.feed??null,node:w.node??null}));const I=v().find(G=>!E.has(G))??null;return I!==null&&w.line!==void 0&&s.get("files",I)?.commandLine_set(w.line),I}if(w.op==="gather"&&w.series!==void 0){const v=[...w.series],E=S(()=>e.gather_open(v,z??"pacs"));return E!==null&&w.name!==void 0&&s.get("gather",E)?.name_set(w.name),E!==null&&w.feed!==void 0&&w.root!==void 0&&s.get("gather",E)?.feed_set({feedId:w.feed,rootInstanceId:w.root.instance,path:w.root.path}),E}if(w.op==="graph"&&w.feed!==void 0){const v=new Set(y("dag")),E=w.feed;return S(()=>e.feed_open(z??"files",E)),b("dag",v)}if(w.op==="edit"&&w.path!==void 0){const v=w.path;return S(()=>e.edit_open(v))}return w.op==="fs"||w.op==="view"||w.op==="empty"?z===null?null:e.pillPane_spawn(z,w.op,O.dir,O.before):null};return{birth_record:d,replayPlace_get:()=>l,replaying:()=>o,strip_capture:h,capture:f,orphans_dispose:M,domain_enter:g,restore:async w=>{const z=r.get(w);if(!(z===void 0||z.actions===void 0)){r.dismiss(w),o=!0;try{const y=[];for(const O of z.actions){const S=y[O.target??0]??null;y.push(m(O,S))}if(z.shape!==void 0){const O=b=>{if("leaf"in b){const A=y[b.leaf]??null;return A===null?null:{pane:A}}const v=O(b.first),E=O(b.second);return v===null?E:E===null?v:{dir:b.dir,ratio:b.ratio,first:v,second:E}},S=O(z.shape);S!==null&&!("pane"in S)&&t.tree_set(S)}}finally{o=!1,e.stage_relight()}}}}}const uG=2200;function hG(n){return/\x1b\[/.test(n)?bn(n):xs(n).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>')}function fG(n,e,t,s){if(n===void 0)return[];const i=n.arguments??[],r=[{label:"NODE",value:`${n.label} · @${n.id}`},{label:"PLUGIN",value:n.pluginName},...n.pluginVersion!==void 0?[{label:"VERSION",value:n.pluginVersion}]:[]];if(e){const a=xv(n.label,n.id,s);r.push(...i.length===0?[{label:"ARGUMENTS",value:"none — this node runs on the plugin's defaults"}]:i.map(o=>({label:o.name,value:String(o.value??""),...t?{edit:{flag:`--${a}.${o.name}`,type:typeof o.value=="boolean"?"boolean":"string",placeholder:String(o.value??"")}}:{}})))}else r.push({label:"ARGUMENTS",value:i.length===0?"none":`${i.length} — open the node to read them`});return r}function pG(n,e,t){const s=[{label:"PLUGIN",value:n.name},{label:"VERSION",value:n.version},{label:"TYPE",value:n.type.toUpperCase()}],i=n.parameters;if(!e)return s.push({label:"PARAMETERS",value:i.length===0?"none":`${i.length} — open the node to read them`}),s;if(i.length===0)return s.push({label:"PARAMETERS",value:"none — this plugin takes no arguments"}),s;for(const r of i){const a=[r.type];r.optional||a.push("required");const o=r.default===void 0||r.default===null?"":String(r.default);o!==""&&a.push(`default ${o}`);const l=a.join(" · ");s.push({label:r.flag,value:r.help===void 0?l:`${l} — ${r.help}`,...t?{edit:{flag:r.flag,type:r.type,placeholder:o}}:{}})}return s}function cm(n,e,t,s){n.replaceChildren(),n.classList.toggle("dag-facts-immersed",t);for(const{label:i,value:r,edit:a}of e){const o=document.createElement("div");o.className="telemetry-row";const l=document.createElement("span");if(l.className="telemetry-label",l.textContent=i,o.appendChild(l),a===void 0||s===null){const c=document.createElement("span");c.className="telemetry-value",c.textContent=r,o.appendChild(c)}else{const c=yv(s.line_get(),a.flag),d=document.createElement("input");d.className="telemetry-input",d.spellcheck=!1,d.autocomplete="off",d.title=`${a.flag} — ${r}`,a.type==="boolean"?(d.type="checkbox",d.checked=c===!0,d.addEventListener("change",()=>{s.line_set(wf(s.line_get(),a.flag,d.checked?!0:null))})):(d.type="text",d.placeholder=a.placeholder,d.value=c===null||c===!0?"":c,d.addEventListener("input",()=>{s.line_set(wf(s.line_get(),a.flag,d.value))}));const u=document.createElement("span");u.className="telemetry-hint",u.textContent=r,o.append(d,u)}n.appendChild(o)}}function mG(n,e,t,s){const i=n.closest(".files-body"),r=i?.querySelector(".diagram-strategy")??null,a=i?.querySelector(".diagram-projection")??null,o=i?.querySelector(".diagram-pulse")??null,l=s===void 0?null:i?.querySelector(".diagram-run")??null,c=()=>s?.(),d=()=>{const f=[];e.strategy_get()!=="ranked"&&f.push("MOLECULE"),e.projection_get()!=="3d"&&f.push("2D"),t.mode_annunciate(f.join(" · "))},u=()=>{e.strategy_set(e.strategy_get()==="ranked"?"molecule":"ranked"),r!==null&&(r.textContent=e.strategy_get().toUpperCase()),d()},h=()=>{e.projection_set(e.projection_get()==="3d"?"2d":"3d"),a!==null&&(a.textContent=e.projection_get().toUpperCase()),d()},p=()=>{e.wave_start(),o?.classList.add("pulse-running"),window.setTimeout(()=>o?.classList.remove("pulse-running"),uG)};return r!==null&&(r.textContent=e.strategy_get().toUpperCase()),a!==null&&(a.textContent=e.projection_get().toUpperCase()),r?.addEventListener("click",u),a?.addEventListener("click",h),o?.addEventListener("click",p),l?.addEventListener("click",c),d(),()=>{r?.removeEventListener("click",u),a?.removeEventListener("click",h),o?.removeEventListener("click",p),l?.removeEventListener("click",c),o?.classList.remove("pulse-running")}}function gG(n,e){let t=null;const s=(c,d,u,h)=>{let p=null,f=null;const M=c.contentHtml_show(d,"",{diagram:!0,release:()=>{t=null,f?.(),f=null,c.mode_annunciate(""),p?.dispose(),p=null}});M!==null&&u().then(g=>{if(!M.isConnected)return;if(g===null||g.nodes.length===0){M.textContent="NOTHING TO DRAW FOR THIS ENTRY",M.classList.add("files-diagram-empty");return}g.text!==""&&c.contentText_set(g.text);const m=document.createElement("div");m.className="dag-facts",Hs(m),M.appendChild(m);const _=new Al(M,{select:y=>g.facts_show(m,y.id,!1,h),activate:y=>w(y),deselect:()=>m.replaceChildren()},{}),w=y=>{_.flight_into(y.id,()=>{t={scene:_,facts:m},g.facts_show(m,y.id,!0,h)})};p=_,_.graph_set({nodes:g.nodes},{wave:!1}),_.size_fit(),f=mG(M,_,c,h===null?void 0:h.run);const z=g.nodes.length===1?g.nodes[0]:void 0;z!==void 0&&w(z)})},i=async c=>{const d=/_id(\d+)$/.exec(c)?.[1]??c.replace(/^.*\//,""),[u,h]=await Promise.all([n.client.line_execute(`cat "${c}"`,{silent:!0,observe:!1}),n.client.line_execute(`pipeline diagram ${d}`,{silent:!0,observe:!1})]),p=u.envelopes.map(f=>f.rendered).join(`
4273
+ `),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 ${Ds(t.loaded)} / ${t.total!==void 0?Ds(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:`${Ds(l.running)} IN ${Ds(l.runningFeeds)} FEEDS · SCHEDULED ${Ds(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 ${Ds(l.errored)} IN ${Ds(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?Ds(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 ${Ds(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 ${Ds(l.loaded)} / ${c}${d!==null?` · ETA ${jI(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 VI=3e3;class HI{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>=VI})}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 qI=[2,3,3,2,2,11,2,2],XI=4,im=300,KI=2600,YI=650;class ZI{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(),im);return}const t=this.narrowSources_list(),s=this.wideSources_list();let i=0,r=0;for(const a of qI){const o=document.createElement("div");o.className="data-column";for(let l=1;l<=XI;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=rm(u.source(),a),o.appendChild(c),this.cells.push(u)}e.appendChild(o)}window.setInterval(()=>this.beat_paint(),im),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,()=>QI()]}uptimeSeconds_get(){return Math.floor((Date.now()-this.bootedAt)/1e3)}beat_paint(){for(const e of this.cells){const t=rm(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"),YI))},KI)}}function rm(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 QI(){const n=new Date;return n.getHours()*1e4+n.getMinutes()*100+n.getSeconds()}const JI=2e4;class eG{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 Al(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(),JI)))}envelope_observe(e){if(e.model?.kind!==Kn.pipelineDiagram)return;const t=mu.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}`)}}function tG(n,e){n.line_execute("ls /bin",{silent:!0,observe:!1}).then(t=>{const r=(t.envelopes.find(a=>a.model?.kind==="fs.listing")?.model?.data??[]).flatMap(a=>a.items).filter(a=>a.type==="pipeline").map(a=>a.name);e.names_set(r)})}const sG=new Set(["files","dag","pacs"]);function am(n){return sG.has(n)}const QM=new Map,Cr=new Map;let nG=0;function Os(n,e){QM.set(n,e)}function iG(n){const e=QM.get(n);if(e===void 0)throw new Error(`no pane factory registered for kind '${n}'`);const t=e(`${n}-${nG++}`);return Cr.set(t.id,t),t}function gr(n){Cr.set(n.id,n)}function Go(n){return Cr.get(n)}function Ro(){return[...Cr.values()]}function es(n){const e=Cr.get(n);e!==void 0&&(Cr.delete(n),e.dispose?.(),e.mount.remove())}class rG{byId=new Map;set(e,t,s){this.byId.set(t,{kind:e,panel:s})}get(e,t){const s=this.byId.get(t);return s!==void 0&&s.kind===e?s.panel:void 0}has(e,t){return this.byId.get(t)?.kind===e}delete(e){return this.byId.delete(e)}ids(e){return this.entries(e).map(([t])=>t)}entries(e){const t=[];for(const[s,i]of this.byId)i.kind===e&&t.push([s,i.panel]);return t}values(e){return this.entries(e).map(([,t])=>t)}idOf(e,t){for(const[s,i]of this.byId)if(i.kind===e&&i.panel===t)return s;return null}}function xa(n,e){if("pane"in n)return n.pane===e?[]:null;const t=xa(n.first,e);if(t!==null)return[{node:n,side:"first"},...t];const s=xa(n.second,e);return s!==null?[{node:n,side:"second"},...s]:null}function Sa(n,e,t){if(n===e)return t;if("pane"in n)return null;const s=Sa(n.first,e,t);if(s!==null)return{...n,first:s};const i=Sa(n.second,e,t);return i!==null?{...n,second:i}:null}function om(n,e,t){const s=xa(n,e);if(s===null||s.length===0)return"lone";const i=ms[t].axis,r=ms[t].place==="after"?"first":"second",a=s[s.length-1];let o=null;for(let u=s.length-1;u>=0;u-=1){const h=s[u];if(h.node.dir===i&&h.side===r){o=h.side==="first"?h.node.second:h.node.first;break}}if(o===null){if(a.node.dir===i)return"edge";o=a.side==="first"?a.node.second:a.node.first}const l=dl(n,e);if(l===null)return"lone";const c={pane:e};return Sa(l,o,r==="first"?{dir:i,ratio:.5,first:o,second:c}:{dir:i,ratio:.5,first:c,second:o})??"edge"}const lm="argus-layout";class aG{root;mounts;presets=new Map;prefs={};activePreset="";tree=null;focusedPane=null;renderObserver=null;previousFocus=null;constructor(e,t){this.root=e,this.mounts=t;try{const s=window.localStorage.getItem(lm);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=cl(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_move(e,t){if(this.tree===null)return"lone";const s=om(this.tree,e,t);return typeof s=="string"?s:(this.tree=s,this.focusedPane=e,this.render(),!0)}focus_last(){const e=this.previousFocus;return e===null||!this.panes_shown().includes(e)?null:(this.focus_set(e),e)}leaf_flip(e){if(this.tree===null)return!1;const t=xa(this.tree,e);if(t===null||t.length===0)return!1;const s=t[t.length-1],i={...s.node,dir:s.node.dir==="col"?"row":"col"},r=Sa(this.tree,s.node,i);return r===null?!1:(this.tree=r,this.render(),!0)}leaf_resize(e,t,s=.05){if(this.tree===null)return!1;const i=xa(this.tree,e);if(i===null||i.length===0)return!1;const r=ms[t].axis;for(let a=i.length-1;a>=0;a-=1){const o=i[a];if(o.node.dir!==r)continue;const l=ms[t].place==="after",c=Math.min(.85,Math.max(.15,o.node.ratio+(l?s:-s))),d={...o.node,ratio:c},u=Sa(this.tree,o.node,d);return u===null?!1:(this.tree=u,this.ratio_remember(i.slice(0,a).map(h=>h.side==="first"?"0":"1").join(""),c),this.render(),!0)}return!1}move_possible(e,t){return this.tree!==null&&typeof om(this.tree,e,t)!="string"}leaf_replace(e,t){if(this.tree===null)return!1;const s=cl(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=dl(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.focus_reconcile(),this.renderObserver?.()}}focus_reconcile(){const e=this.panes_shown();if(this.focusedPane!==null&&e.includes(this.focusedPane))return;const t=e[0];if(t===void 0)return;const s=this.focusedPane;this.focusedPane=null,this.focus_set(t),s!==null&&(this.previousFocus=s)}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!==null&&(this.previousFocus=this.focusedPane),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(lm,JSON.stringify(this.prefs))}catch{}}}function cl(n,e,t){if("pane"in n)return n.pane===e?t:null;const s=cl(n.first,e,t);if(s!==null)return{...n,first:s};const i=cl(n.second,e,t);return i!==null?{...n,second:i}:null}function dl(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=dl(n.first,e);if(t!==null)return{...n,first:t};const s=dl(n.second,e);return s!==null?{...n,second:s}:null}const oG=4e3;function lG(n){const e=new WeakMap,t=(o,l)=>{const c=n.paneInstance_get(o)?.mount.querySelector(".pane-state")??null;if(c===null)return;const d=e.get(c);d!==void 0&&clearTimeout(d);const u={text:c.textContent??"",className:c.className};Jt(c,"note",l),e.set(c,setTimeout(()=>{e.delete(c),c.textContent===l&&(c.className=u.className,c.textContent=u.text)},oG))};return{bar_note:t,move:(o,l)=>{const c=n.layout.leaf_move(o,l);return c==="lone"?"pane move: the only pane on stage":c==="edge"?`pane move ${l}: already ${ms[l].edge}`:(t(o,`MOVED ${l.toUpperCase()}`),n.sound("audio3"),`moved ${l}`)},flip:o=>n.layout.leaf_flip(o)?(t(o,"FLIPPED"),n.sound("audio3"),"flipped"):"pane flip: the only pane on stage",resize:(o,l,c)=>n.layout.leaf_resize(o,l,c)?`resized ${ms[l].focusWord}`:`pane resize ${ms[l].focusWord}: no boundary that way`,chordKeys_of:(o,l)=>{const c=Ci.filter(d=>d.selector===o&&d.move===!0===l).map(d=>d.key);return c.length===0?"":` [keys ${c.join(" ")}]`}}}const cG={image:"viewer",view:"viewer",dir:"files",fs:"files",tags:"tags",empty:"pane",domain:"dag",catalogue:"catalogue",graph:"dag",gather:"gather",edit:"editor"},Cc=240;function dG(n,e){const{layout:t,panels:s,paneInstance_get:i,dormant:r}=n,a=new Map;let o=!1,l=null;const c=w=>i(w)?.kind??null,d=(w,z,y,O,S)=>{a.set(w,{parent:z,dir:y,before:O,...S!==void 0?{binding:S}:{}})},u=w=>{if(w==="pacs")return"⊞";if(w==="dag")return"⋔";const z=c(w);return z==="image"?"▣":z==="tags"?"≣":z==="edit"?"✎":"▤"},h=w=>{if(w.length===0)return;const z=[];for(const A of w){const I=i(A)?.mount;if(I===void 0)continue;const G=I.getBoundingClientRect();G.width>0&&G.height>0&&z.push({id:A,left:G.left,top:G.top,width:G.width,height:G.height})}if(z.length===0)return;const y=Math.min(...z.map(A=>A.left)),O=Math.min(...z.map(A=>A.top)),S=Math.max(...z.map(A=>A.left+A.width))-y,b=Math.max(...z.map(A=>A.top+A.height))-O;if(S<=0||b<=0)return;const v=Cc/S,E=Math.max(40,Math.min(260,Math.round(b*v)));try{const A=document.createElement("canvas");A.width=Cc,A.height=E;const I=A.getContext("2d");if(I===null)return;const C=getComputedStyle(document.documentElement).getPropertyValue("--harvestgold").trim()||"#c9a15a";I.fillStyle="#05070a",I.fillRect(0,0,Cc,E);for(const B of z){const P=Math.round((B.left-y)*v),W=Math.round((B.top-O)*v),H=Math.max(6,Math.round(B.width*v)),X=Math.max(6,Math.round(B.height*v)),oe=i(B.id)?.mount.querySelector("canvas");if(oe!=null&&oe.width>0){const J=Math.min(H/oe.width,X/oe.height),ce=Math.round(oe.width*J),We=Math.round(oe.height*J);I.fillStyle="#000",I.fillRect(P,W,H,X),I.drawImage(oe,P+Math.round((H-ce)/2),W+Math.round((X-We)/2),ce,We)}else I.fillStyle="rgba(255,255,255,0.05)",I.fillRect(P,W,H,X),I.fillStyle=C,I.font=`${Math.max(9,Math.min(28,Math.round(Math.min(H,X)*.5)))}px serif`,I.textAlign="center",I.textBaseline="middle",I.fillText(u(B.id),P+H/2,W+X/2+1);I.strokeStyle="rgba(255,255,255,0.22)",I.lineWidth=1,I.strokeRect(P+.5,W+.5,H-1,X-1)}return A.toDataURL("image/png")}catch{return}},p=(w,z,y)=>{const O=c(w),S=a.get(w),b={dir:S?.dir??"col",side:cv(S?.before??!1)};if(am(w)){const E=z==="dag"?"runs":z,A=z==="pacs"?e.pacsQuery_get():null,I=z==="dag"?s.get("dag","dag"):void 0,G=I!==void 0&&I.graph_isShown()?I.feed_get():null,C=G!==null&&I!==void 0?I.view_lines():[],B=G!==null?I?.feedTitle_get():void 0;return{action:{op:"domain",domain:E,...A!==null?{query:A}:{},...G!==null?{feed:G}:{},...C.length>0?{view:C}:{}},...B!==void 0?{label:B}:{}}}if(S?.binding==="fs"||S?.binding==="view"||S?.binding==="empty")return{action:{op:S.binding,target:y,...b}};if(O==="image"){const E=s.get("image",w),A=E?.state_get()??null;if(E===void 0||A===null||A.path===null)return null;const I=[];A.layout!=="single"&&I.push(`image layout ${A.layout}`),A.colormap!==void 0&&A.colormap!=="gray"&&I.push(`image colormap ${A.colormap}`),A.voi!==void 0&&A.voi!==null&&I.push(`image wl ${A.voi.lower} ${A.voi.upper}`),A.slice>1&&I.push(`image slice ${A.slice}`),A.ghost!==void 0&&A.ghost!==null&&A.layout==="slab"&&I.push(`image ghost ${A.ghost}`);const G=E.series_get(),C=[G?.seriesDescription??"",G?.modality??""].filter(B=>B!=="");return{action:{op:"image",path:A.path,target:y,...b,...I.length>0?{view:I}:{}},anchor:A.path,...C.length>0?{label:C.join(" · ")}:{}}}const v=e.catalogue_of(w);if(v!==void 0){const E=s.get("files",w)?.commandLine_get()??"";return{action:{op:"catalogue",input:v.input,target:y,...b,...v.feed!==null?{feed:v.feed}:{},...v.node!==null?{node:v.node}:{},...E!==""?{line:E}:{}},label:`PROCESS ${v.input.split("/").filter(Boolean).pop()??v.input}`}}if(O==="files"){const E=s.get("files",w)?.path_current()??null;return typeof E!="string"||E.length===0?null:{action:{op:"dir",path:E,target:y,...b}}}if(O==="gather"){const E=s.get("gather",w);if(E===void 0)return null;const A=[...E.entries_get()],I=E.name_get(),G=E.feed_get();return{action:{op:"gather",series:A,target:y,...b,...I!==null?{name:I}:{},...G!==null?{feed:G.feedId,root:{instance:G.rootInstanceId,path:G.path}}:{}},label:I??`GATHER · ${A.length} series`}}if(O==="dag"){const E=s.get("dag",w)?.feed_get()??null;return E===null?null:{action:{op:"graph",feed:E,target:y,...b}}}if(O==="tags")return{action:{op:"tags",target:y,...b}};if(O==="edit"){const E=s.get("edit",w)?.path_get()??null;return E===null?null:{action:{op:"edit",path:E,target:y,...b},label:`EDIT ${E.split("/").pop()??E}`}}return null},f=()=>{if(o)return;const w=new Set(t.panes_shown()),z=t.activePreset_get();if(z==="panes"||z==="launcher")return;const y=Ro().map(X=>X.id).filter(X=>w.has(X)),O=new Map;let S,b;const v=[];for(const X of y){const oe=O.get(a.get(X)?.parent??"")??0,J=p(X,z,oe);J!==null&&(O.set(X,v.length),v.push(J.action),J.anchor!==void 0?S===void 0&&(S=J.anchor,J.label!==void 0&&(b=J.label)):J.label!==void 0&&b===void 0&&(b=J.label))}const E=v.filter(X=>X.op!=="domain"||X.feed!==void 0);if(E.length===0)return;const A=h(y),I=X=>{if("pane"in X){const ce=O.get(X.pane);return ce===void 0?null:{leaf:ce}}const oe=I(X.first),J=I(X.second);return oe===null?J:J===null?oe:{dir:X.dir,ratio:X.ratio,first:oe,second:J}},G=t.tree_get(),C=G===null?null:I(G),B=[...new Set(E.map(X=>cG[X.op]??"pane"))];let P,W,H;if(S!==void 0)P=S,W=b??S.split("/").pop()??S,H={address:S,modelKind:"dicom.series"};else{const X=E.map(ce=>ce.path).find(ce=>ce!==void 0),oe=E.map(ce=>ce.path??(ce.input!==void 0?`catalogue:${ce.input}`:ce.series!==void 0?`gather:${ce.series.map(We=>We.seriesUID).join(",")}`:ce.feed!==void 0?`feed:${ce.feed}`:ce.op)).sort().join("|"),J=z==="dag"?"RUNS":z.toUpperCase();P=`${z}:${oe}`,W=b!==void 0&&b!==""?b:X!==void 0?X.split("/").pop()??X:`${J} · ${E.length+1} panes`,H={address:P,modelKind:"argus.desktop"}}r.add({id:P,label:W,regard:H,members:B,actions:v,...C===null?{}:{shape:C},...A===void 0?{}:{thumbnail:A},lastTouched:Date.now()})},M=()=>{const w=new Set(t.panes_shown());for(const z of Ro())w.has(z.id)||am(z.id)||z.id==="panes"||z.id==="launcher"||z.id==="universe"||(es(z.id),t.mount_remove(z.id));e.stage_relight()},g=w=>{f(),t.preset_apply(w),M()},m=(w,z)=>{const y=v=>Ro().filter(E=>t.panes_shown().includes(E.id)&&c(E.id)===v).map(E=>E.id),O={dir:w.dir??"col",before:w.side==="before"},S=v=>{l=O;try{return v()}finally{l=null}},b=(v,E)=>y(v).find(A=>!E.has(A))??null;if(w.op==="domain"){const v=w.domain==="runs"?"dag":w.domain==="pacs"?"pacs":"files";if(g(v),w.query!==void 0&&n.terminal.line_run(w.query),w.feed!==void 0){const E=w.feed,A=w.view??[],I=s.get("dag","dag");if(I?.feed_enter(E),A.length>0&&I!==void 0){const G=C=>{if(I.graph_isShown()&&I.feed_get()===E){for(const B of A)n.terminal.line_run(B);return}C>0&&window.setTimeout(()=>G(C-1),250)};G(240)}}return v}if(z!==null&&t.focus_set(z),w.op==="image"&&w.path!==void 0){let v=null;const E=w.path,A=S(()=>e.image_open(null,E,{},C=>{v=C})),I=w.view,G=v;return I!==void 0&&I.length>0&&G!==null&&A.then(()=>{for(const C of I)t.focus_set(G),n.terminal.line_run(C)}).catch(()=>{}),v}if(w.op==="dir"&&w.path!==void 0){const v=new Set(y("files")),E=w.path;return S(()=>e.dir_open(E)),b("files",v)}if(w.op==="tags"){const v=new Set(y("tags"));return S(()=>n.terminal.line_run("image tags")),b("tags",v)}if(w.op==="catalogue"&&w.input!==void 0){const v=()=>e.catalogueIds().filter(G=>t.panes_shown().includes(G)),E=new Set(v()),A=w.input;S(()=>e.process_open(z??"files",{input:A,feed:w.feed??null,node:w.node??null}));const I=v().find(G=>!E.has(G))??null;return I!==null&&w.line!==void 0&&s.get("files",I)?.commandLine_set(w.line),I}if(w.op==="gather"&&w.series!==void 0){const v=[...w.series],E=S(()=>e.gather_open(v,z??"pacs"));return E!==null&&w.name!==void 0&&s.get("gather",E)?.name_set(w.name),E!==null&&w.feed!==void 0&&w.root!==void 0&&s.get("gather",E)?.feed_set({feedId:w.feed,rootInstanceId:w.root.instance,path:w.root.path}),E}if(w.op==="graph"&&w.feed!==void 0){const v=new Set(y("dag")),E=w.feed;return S(()=>e.feed_open(z??"files",E)),b("dag",v)}if(w.op==="edit"&&w.path!==void 0){const v=w.path;return S(()=>e.edit_open(v))}return w.op==="fs"||w.op==="view"||w.op==="empty"?z===null?null:e.pillPane_spawn(z,w.op,O.dir,O.before):null};return{birth_record:d,replayPlace_get:()=>l,replaying:()=>o,strip_capture:h,capture:f,orphans_dispose:M,domain_enter:g,restore:async w=>{const z=r.get(w);if(!(z===void 0||z.actions===void 0)){r.dismiss(w),o=!0;try{const y=[];for(const O of z.actions){const S=y[O.target??0]??null;y.push(m(O,S))}if(z.shape!==void 0){const O=b=>{if("leaf"in b){const A=y[b.leaf]??null;return A===null?null:{pane:A}}const v=O(b.first),E=O(b.second);return v===null?E:E===null?v:{dir:b.dir,ratio:b.ratio,first:v,second:E}},S=O(z.shape);S!==null&&!("pane"in S)&&t.tree_set(S)}}finally{o=!1,e.stage_relight()}}}}}const uG=2200;function hG(n){return/\x1b\[/.test(n)?bn(n):xs(n).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>')}function fG(n,e,t,s){if(n===void 0)return[];const i=n.arguments??[],r=[{label:"NODE",value:`${n.label} · @${n.id}`},{label:"PLUGIN",value:n.pluginName},...n.pluginVersion!==void 0?[{label:"VERSION",value:n.pluginVersion}]:[]];if(e){const a=xv(n.label,n.id,s);r.push(...i.length===0?[{label:"ARGUMENTS",value:"none — this node runs on the plugin's defaults"}]:i.map(o=>({label:o.name,value:String(o.value??""),...t?{edit:{flag:`--${a}.${o.name}`,type:typeof o.value=="boolean"?"boolean":"string",placeholder:String(o.value??"")}}:{}})))}else r.push({label:"ARGUMENTS",value:i.length===0?"none":`${i.length} — open the node to read them`});return r}function pG(n,e,t){const s=[{label:"PLUGIN",value:n.name},{label:"VERSION",value:n.version},{label:"TYPE",value:n.type.toUpperCase()}],i=n.parameters;if(!e)return s.push({label:"PARAMETERS",value:i.length===0?"none":`${i.length} — open the node to read them`}),s;if(i.length===0)return s.push({label:"PARAMETERS",value:"none — this plugin takes no arguments"}),s;for(const r of i){const a=[r.type];r.optional||a.push("required");const o=r.default===void 0||r.default===null?"":String(r.default);o!==""&&a.push(`default ${o}`);const l=a.join(" · ");s.push({label:r.flag,value:r.help===void 0?l:`${l} — ${r.help}`,...t?{edit:{flag:r.flag,type:r.type,placeholder:o}}:{}})}return s}function cm(n,e,t,s){n.replaceChildren(),n.classList.toggle("dag-facts-immersed",t);for(const{label:i,value:r,edit:a}of e){const o=document.createElement("div");o.className="telemetry-row";const l=document.createElement("span");if(l.className="telemetry-label",l.textContent=i,o.appendChild(l),a===void 0||s===null){const c=document.createElement("span");c.className="telemetry-value",c.textContent=r,o.appendChild(c)}else{const c=yv(s.line_get(),a.flag),d=document.createElement("input");d.className="telemetry-input",d.spellcheck=!1,d.autocomplete="off",d.title=`${a.flag} — ${r}`,a.type==="boolean"?(d.type="checkbox",d.checked=c===!0,d.addEventListener("change",()=>{s.line_set(wf(s.line_get(),a.flag,d.checked?!0:null))})):(d.type="text",d.placeholder=a.placeholder,d.value=c===null||c===!0?"":c,d.addEventListener("input",()=>{s.line_set(wf(s.line_get(),a.flag,d.value))}));const u=document.createElement("span");u.className="telemetry-hint",u.textContent=r,o.append(d,u)}n.appendChild(o)}}function mG(n,e,t,s){const i=n.closest(".files-body"),r=i?.querySelector(".diagram-strategy")??null,a=i?.querySelector(".diagram-projection")??null,o=i?.querySelector(".diagram-pulse")??null,l=s===void 0?null:i?.querySelector(".diagram-run")??null,c=()=>s?.(),d=()=>{const f=[];e.strategy_get()!=="ranked"&&f.push("MOLECULE"),e.projection_get()!=="3d"&&f.push("2D"),t.mode_annunciate(f.join(" · "))},u=()=>{e.strategy_set(e.strategy_get()==="ranked"?"molecule":"ranked"),r!==null&&(r.textContent=e.strategy_get().toUpperCase()),d()},h=()=>{e.projection_set(e.projection_get()==="3d"?"2d":"3d"),a!==null&&(a.textContent=e.projection_get().toUpperCase()),d()},p=()=>{e.wave_start(),o?.classList.add("pulse-running"),window.setTimeout(()=>o?.classList.remove("pulse-running"),uG)};return r!==null&&(r.textContent=e.strategy_get().toUpperCase()),a!==null&&(a.textContent=e.projection_get().toUpperCase()),r?.addEventListener("click",u),a?.addEventListener("click",h),o?.addEventListener("click",p),l?.addEventListener("click",c),d(),()=>{r?.removeEventListener("click",u),a?.removeEventListener("click",h),o?.removeEventListener("click",p),l?.removeEventListener("click",c),o?.classList.remove("pulse-running")}}function gG(n,e){let t=null;const s=(c,d,u,h)=>{let p=null,f=null;const M=c.contentHtml_show(d,"",{diagram:!0,release:()=>{t=null,f?.(),f=null,c.mode_annunciate(""),p?.dispose(),p=null}});M!==null&&u().then(g=>{if(!M.isConnected)return;if(g===null||g.nodes.length===0){M.textContent="NOTHING TO DRAW FOR THIS ENTRY",M.classList.add("files-diagram-empty");return}g.text!==""&&c.contentText_set(g.text);const m=document.createElement("div");m.className="dag-facts",Hs(m),M.appendChild(m);const _=new Al(M,{select:y=>g.facts_show(m,y.id,!1,h),activate:y=>w(y),deselect:()=>m.replaceChildren()},{}),w=y=>{_.flight_into(y.id,()=>{t={scene:_,facts:m},g.facts_show(m,y.id,!0,h)})};p=_,_.graph_set({nodes:g.nodes},{wave:!1}),_.size_fit(),f=mG(M,_,c,h===null?void 0:h.run);const z=g.nodes.length===1?g.nodes[0]:void 0;z!==void 0&&w(z)})},i=async c=>{const d=/_id(\d+)$/.exec(c)?.[1]??c.replace(/^.*\//,""),[u,h]=await Promise.all([n.client.line_execute(`cat "${c}"`,{silent:!0,observe:!1}),n.client.line_execute(`pipeline diagram ${d}`,{silent:!0,observe:!1})]),p=u.envelopes.map(f=>f.rendered).join(`
4274
4274
  `);for(const f of h.envelopes){if(f.model?.kind!==Kn.pipelineDiagram)continue;const M=mu.safeParse(f.model.data);if(!M.success)continue;const g=new Map(M.data.nodes.map(m=>[m.id,m]));return{text:hG(p),nodes:M.data.nodes.map(m=>({id:m.id,label:m.label,parentIds:m.parentIds,joinParentIds:m.joinParentIds})),facts_show:(m,_,w,z)=>{const y=M.data.nodes.map(O=>O.label);cm(m,fG(g.get(_),w,z!==null,y),w,z)}}}return null},r=async c=>{const d=c.replace(/^.*\//,""),u=await n.client.line_execute(`plugin info "${d}"`,{silent:!0,observe:!1});for(const h of u.envelopes){if(h.model?.kind!==g0)continue;const p=m0.safeParse(h.model.data);if(!p.success)continue;const f=p.data;return{text:"",nodes:[{id:d,label:f.name,parentIds:[],joinParentIds:[]}],facts_show:(M,g,m,_)=>{cm(M,pG(f,m,_!==null),m,_)}}}return null},a=(c,d,u,h)=>{const p=e.catalogue_of(c);if(p===void 0)return null;const f=u.replace(/^.*\//,"");return Ng(d.commandLine_get())!==f&&d.commandLine_set(Ig(p.input,f)),{line_get:()=>d.commandLine_get(),line_set:M=>d.commandLine_set(M),run:()=>e.run_press(c,f,h)}};return{entry_show:(c,d,u,h)=>{s(d,u,()=>h==="plugin"?r(u):i(u),a(c,d,u,h))},dive_leave:()=>{const c=t;return c===null?!1:(t=null,c.scene.flight_back(()=>{c.facts.classList.remove("dag-facts-immersed"),c.facts.replaceChildren()}),!0)}}}function MG(n,e){const{panels:t,paneInstance_get:s,subjects:i}=n,r=new Map,a=p=>t.get("dag",p)??t.get("universe",p),o=(p,f)=>{const M=r.get(p);if(M===void 0){f?.();return}r.delete(p),M.element.classList.remove("node-overlay-open");const g=()=>{M.element.remove(),f?.()},m=a(p);m!==void 0?m.flight_back(g):g()},l=(p,f,M,g,m)=>{if(m.kind==="dir"){const _=f.replace(/\/+$/,"");if(m.path!==_&&!m.path.startsWith(`${_}/`)){o(p),n.sound("audio3");return}const w=m.path.startsWith("/proc/jobs/")?(m.path.split("/").pop()??"").match(/_(\d+)$/):null;if(w!==null){const y=parseInt(w[1]??"",10);o(p,()=>{a(p)?.node_flyTo(y)!==!0&&c(p,m.path)});return}const z=M.path_current();z!==null&&g.push(z),e.rootedListing_show(p,M,m.path);return}if(i.regard_write(p,{address:m.path,modelKind:"fs.file"}),!i.groupHasViewer(p)){if(e.imagery_is(m.path)){e.image_open(p,m.path).then(_=>n.terminal.line_note(_));return}if(bl(m.path)){M.contentImage_show(m.path,e.vfsUrl_build(m.path));return}e.fileText_fetch(m.path).then(_=>{if(!_.ok){M.contentRefused_show(m.path,_.text);return}e.tableFile_is(m.path)?M.contentTable_show(m.path,_.text):M.content_show(m.path,_.text)})}},c=(p,f)=>{const g=s(p)?.mount?.querySelector(".dag-canvas, .universe-canvas")??null,m=r.get(p);if(m!==void 0&&!m.element.isConnected&&r.delete(p),g===null||r.has(p)){n.terminal.line_note(`dag: ${f}: ${g===null?"this pane has no scene to fly in":"a node is already open here"} — flew back out`),a(p)?.flight_back(()=>{});return}const _=document.createElement("div");_.className="node-overlay",_.setAttribute("aria-label",`inside ${f}`);const w=e.filesBody_stamp();w.classList.add("node-overlay-body");const z=document.createElement("button");z.type="button",z.className="strategy-pill node-overlay-exit",z.title="leave the node (Esc)",z.textContent="EXIT NODE",w.querySelector(".mode-frame")?.prepend(z),_.append(w);const y=w.querySelector(".files-panel");if(y===null)throw new Error("pane template is missing .files-panel");const O=[],S=new Sg(y,b=>l(p,f,S,O,b),e.previewProvider);S.rowVerbs_declare((b,v)=>e.rowVerbs_of(p,b,v),(b,v)=>{i.regard_write(p,{address:v,modelKind:"fs.file"})}),r.set(p,{element:_,panel:S,history:O}),S.ceiling_set(f,"EXIT NODE"),z.addEventListener("click",()=>{o(p),n.sound("audio3")}),g.appendChild(_),window.requestAnimationFrame(()=>_.classList.add("node-overlay-open")),e.rootedListing_show(p,S,f)};return{open:c,close:o,back:p=>{const f=r.get(p),M=f?.history.pop();f!==void 0&&M!==void 0&&e.rootedListing_show(p,f.panel,M)},escape:()=>{const p=[...r.keys()].pop();if(p===void 0)return!1;const f=r.get(p);return f!==void 0&&f.panel.content_isShown()?f.panel.listing_restore():o(p),!0},dispose:p=>{r.get(p)?.element.remove(),r.delete(p)}}}const ga=[];function JM(){const n=ga[ga.length-1];return n===void 0?!1:(n(),!0)}function bG(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 dm(n,e){if(n.querySelector(":scope > .ask-bar")!==null)return Promise.resolve(null);const t=document.createElement("div");t.className=e.kind==="choose"?"ask-bar ask-bar-choose":"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");if(c.className="pacs-capsule ask-bar-abandon",c.textContent=e.close??"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);else{for(const u of e.choices??[]){const h=document.createElement("button");h.className=`pacs-capsule ask-bar-choice${u.held===!0?" ask-bar-held":""}`,h.textContent=u.label??u.value,h.dataset.value=u.value,h.disabled=u.held===!0,t.append(h)}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=bG(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 p=g=>{if(h)return;h=!0;const m=ga.indexOf(f);m>=0&&ga.splice(m,1),t.remove(),u(g)},f=()=>p(null);ga.push(f);const M=()=>{const g=r.value.trim();p(g===""?null:g)};l.addEventListener("click",M);for(const g of t.querySelectorAll(".ask-bar-choice"))g.addEventListener("click",()=>p(g.dataset.value??null));a.addEventListener("click",()=>p("y")),o.addEventListener("click",()=>p("n")),c.addEventListener("click",f),t.addEventListener("keydown",g=>{if(g.key==="Escape"){g.stopPropagation(),f();return}if(e.kind==="confirm"){g.key==="y"||g.key==="Y"?(g.stopPropagation(),p("y")):g.key==="n"||g.key==="N"||g.key==="Enter"&&g.target===o?(g.stopPropagation(),p("n")):g.key==="Enter"&&(g.stopPropagation(),p("y"));return}g.key==="Enter"&&(g.stopPropagation(),M())}),e.kind==="confirm"?a.focus():(r.focus(),r.select())})}async function eb(n,e,t){if(n.ask_isOpen()){const a=n.ask_note(t.message),o=await dm(e,t);return a(t.kind==="secret"&&o!==null?"••••••":o),o}const s=dm(e,t).then(a=>({from:"pane",answer:a})),i=n.ask_open({message:t.message,kind:t.kind==="choose"?"text":t.kind,focus:!1,...t.suggest===void 0?{}:{suggest:t.suggest}}).then(a=>({from:"console",answer:a})),r=await Promise.race([s,i]);return r.from==="console"?JM():n.ask_settle(r.answer),r.answer}function _G(n,e){const{panels:t,paneInstance_get:s}=n;let i=null,r=null;const a=()=>{const{layout:h}=n,p=h.tree_get();if(p===null)return null;const f=[],M=m=>{if("pane"in m){f.push(m.pane);return}M(m.first),M(m.second)};M(p);const g=h.focused_get();return g!==null&&f.includes(g)?g:f[0]??null};return{errandHost_find:a,errand_open:async h=>{const{layout:p,terminal:f}=n,M=a();if(M===null)return null;const g=e.instance_spawn("files"),m=e.replayPlace_get();if(!p.leaf_split(M,m?.dir??"col",g.id,m?.before??!1))return es(g.id),p.mount_remove(g.id),null;e.birth_record(g.id,M,m?.dir??"col",m?.before??!1);const _=t.get("files",g.id),w=h.path?.anchor??"~";_!==void 0&&e.rootedListing_show(g.id,_,w);const z=g.mount.querySelector(".files-body");if(z===null)return es(g.id),p.mount_remove(g.id),null;const y=document.createElement("div");y.className="errand-bar",z.insertBefore(y,z.firstChild);const O=document.createElement("span");O.className="errand-caption",O.textContent=h.message.trim();const S=document.createElement("input");S.className="errand-path",S.spellcheck=!1;const b=document.createElement("button");b.className="pacs-capsule errand-commit",b.textContent=h.commit??"USE THIS",y.append(O,S,b);const v=()=>{const I=_?.path_current()??w,G=h.path?.suggest;S.value=h.path?.wantsDirectory===!0||G===void 0?I:`${I.replace(/\/$/,"")}/${G}`};v();let E=!1;S.addEventListener("input",()=>{E=!0});const A=()=>{E||v()};return g.mount.addEventListener("click",A),f.question_set(!0),new Promise(I=>{const G=C=>{g.mount.removeEventListener("click",A),f.question_set(!1),i=null,p.leaf_close(g.id),es(g.id),p.mount_remove(g.id),I(C)};i=()=>G(null),b.addEventListener("click",()=>G(S.value.trim()===""?null:S.value.trim())),S.addEventListener("keydown",C=>{C.key==="Enter"&&G(S.value.trim()===""?null:S.value.trim())})})},errand_abandon:()=>i===null?!1:(i(),!0),verbLine_run:(h,p)=>{r=h,n.terminal.line_run(p)},askingPane_take:()=>{const h=r;return r=null,h},ask_onPane:async(h,p)=>{const{terminal:f}=n,M=s(h)?.mount;return M===void 0?(e.console_expose(),f.ask_open({message:p.message,kind:p.kind==="choose"?"text":p.kind,...p.suggest===void 0?{}:{suggest:p.suggest}})):eb(f,M,p)}}}class zG{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()}}function um(n){return(n.kind??"series")==="series"?void 0:n.vfsPath}const Pc="cohort";function wG(n){return/[",\n\r]/.test(n)?`"${n.split('"').join('""')}"`:n}function yG(n){const e=document.createElement("p");return e.className="files-empty",e.textContent=n,e}class hm{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 ni({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:wr(()=>[...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:()=>yG("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:Pc}]}],{field:"gather"}),this.cohort.size()>0&&this.listing.open_set(0,[Pc]),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(Pc))}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=KM(i=>i.entry.series??{seriesUID:i.entry.seriesUID,description:i.entry.description??i.entry.vfsPath??"",modality:i.entry.modality,...i.entry.files===void 0?{}:{fileCount:i.entry.files},...i.entry.folderPath===void 0?{}:{pulled:!0,folderPath:i.entry.folderPath}},mI),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 VM.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??um(s.entry);i!==void 0&&this.handlers.image_open(i)},process:s=>{const i=s.entry.folderPath??um(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 $M.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(wG).join(","))];this.handlers.command_run("mkdir -p ~/gather"),this.handlers.command_show(`touch --withContents '${t.join(`
4275
4275
  `)}' ~/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})}}const fm="~/gather/current.json",vG=1200;function OG(n,e){const{panels:t,subjects:s}=n,i=new zG;let r=null,a=!1,o=null;const l=async _=>{const{terminal:w,client:z}=n;w.line_echo(_);let y;try{y=await z.line_execute(_,{silent:!0})}catch(O){return w.output_write("err",`\x1B[31m${O instanceof Error?O.message:String(O)}\x1B[0m
4276
4276
  `),null}w.outcome_write(y);for(const O of y.envelopes){if(O.model?.kind!=="feed.created")continue;const S=O.model.data;if(typeof S.feedId=="number"&&typeof S.rootInstanceId=="number"&&typeof S.path=="string")return{feedId:S.feedId,rootInstanceId:S.rootInstanceId,path:S.path}}return null},c=(_,w,z)=>({command_run:y=>{n.client.line_execute(y,{silent:!0})},command_show:y=>n.terminal.line_run(y),note:y=>n.terminal.line_note(y),image_open:y=>{e.image_open(_(),y).then(O=>n.terminal.line_note(O))},process_open:y=>e.process_open(_(),{input:y,feed:null,node:null}),...w,...z,feed_create:l,cohort_process:y=>e.process_open(_(),y),feed_open:y=>e.feed_open(_(),y)}),d=()=>{o!==null&&window.clearTimeout(o),o=window.setTimeout(()=>{o=null;const _=r?.entries_get()??[],w=JSON.stringify({version:1,name:r?.name_get()??null,feed:r?.feed_get()??null,series:_});n.client.line_execute("mkdir -p ~/gather",{silent:!0,observe:!1}),n.client.line_execute(`touch --withContents '${w.replace(/'/g,"'\\''")}' ${fm}`,{silent:!0,observe:!1})},vG)},u=()=>{const _=document.querySelector("#header-gather-pill");_!==null&&_.classList.toggle("panel-gather-empty",(r?.entries_get().length??0)===0)},h=()=>{const _=e.element_require("header-gather"),w=()=>e.errandHost_find()??"pacs",z=y=>eb(n.terminal,e.element_require("header-gather"),y);return new hm(_,e.pane_find(_,".gather-rows"),c(w,{name_ask:y=>z({message:"Cohort name: ",kind:"text",suggest:y,commit:"NAME IT"}),confirm_ask:async y=>{const O=await z({message:y,kind:"confirm"});return O==="y"||O==="n"?O:null}},{changed:()=>{e.stage_relight(),u(),d()},dismiss:()=>{document.body.dataset.header="away",a=!0,u()}}),i)};return{cohort:i,instance_build:_=>{const w=e.template_stamp("tpl-pane-gather"),z=new hm(w,e.pane_find(w,".gather-rows"),c(()=>_,{name_ask:y=>e.ask_onPane(_,{message:"Cohort name: ",kind:"text",suggest:y,commit:"NAME IT"}),confirm_ask:async y=>{const O=await e.ask_onPane(_,{message:y,kind:"confirm"});return O==="y"||O==="n"?O:null}},{changed:()=>e.stage_relight(),dismiss:()=>{n.layout.leaf_close(_)||e.home_apply(),e.orphans_dispose(),e.stage_relight()}}),i);return t.set("gather",_,z),{id:_,kind:"gather",mount:w,dispose:()=>{t.delete(_),s.pane_leave(_)}}},has:_=>r?.has(_)===!0,gather:_=>{r===null&&(r=h());for(const z of _)r.series_add(z);const w=document.body.dataset.header==="away";(!a||!w)&&(document.body.dataset.header="gather",a=!1),u(),d()},open:(_,w="pacs")=>{const{layout:z}=n,y=new Set(z.panes_shown());let O=t.ids("gather").find(b=>y.has(b))??null;if(O===null){const b=y.has(w)?w:e.errandHost_find()??w,v=e.instance_spawn("gather","pacs"),E=e.replayPlace_get();if(!z.leaf_split(b,E?.dir??"row",v.id,E?.before??!1))return es(v.id),z.mount_remove(v.id),null;e.birth_record(v.id,b,E?.dir??"row",E?.before??!1),O=v.id}const S=t.get("gather",O);if(S===void 0)return null;for(const b of _)S.series_add(b);return O},stage:()=>{const{layout:_}=n,w=new Set(_.panes_shown()),z=t.ids("gather").find(y=>w.has(y))??null;if(z!==null)_.focus_set(z);else{const y=e.errandHost_find()??"pacs",O=e.instance_spawn("gather","pacs");if(!_.leaf_split(y,"col",O.id,!1)){es(O.id),_.mount_remove(O.id);return}e.birth_record(O.id,y,"col",!1),t.get("gather",O.id)?.render_now()}document.body.dataset.header="away",a=!0},annunciate:u,restore:async()=>{const _=await e.fileText_fetch(fm);if(_.ok)try{const w=JSON.parse(_.text);if(!Array.isArray(w.series)||w.series.length===0)return;r===null&&(r=h());for(const z of w.series)r.series_add(z);u(),e.stage_relight()}catch{}}}}async function xr(n,e){const{terminal:t,client:s}=n;t.line_echo(e);let i;try{i=await s.line_execute(e)}catch(r){return t.output_write("err",`\x1B[31m${r instanceof Error?r.message:String(r)}\x1B[0m
4277
- `),!1}return t.outcome_write(i),i.envelopes.length>0&&i.envelopes.every(r=>r.status==="ok")}class xG{mount;handlers;titleSpan;stateSpan;fieldSection;savePill;revertPill;focusMark;field=null;path=null;original="";saving=!1;fieldBuild=null;constructor(e,t){this.mount=e,this.handlers=t,this.titleSpan=e.querySelector(".pane-title"),this.stateSpan=e.querySelector(".pane-state"),this.fieldSection=this.element_require(".edit-field"),this.savePill=this.element_require(".edit-save"),this.revertPill=this.element_require(".edit-revert"),this.focusMark=e.querySelector(".edit-focus"),this.savePill.addEventListener("click",()=>{this.save()}),this.revertPill.addEventListener("click",()=>this.revert()),e.addEventListener("keydown",s=>{(s.ctrlKey||s.metaKey)&&!s.altKey&&s.key.toLowerCase()==="s"&&(s.preventDefault(),s.stopPropagation(),this.save())},{capture:!0}),this.fieldSection.addEventListener("mousedown",()=>this.focusMark_set(!0)),this.fieldSection.addEventListener("focusin",()=>this.focusMark_set(!0)),this.fieldSection.addEventListener("focusout",s=>{(!(s.relatedTarget instanceof Node)||!this.fieldSection.contains(s.relatedTarget))&&this.focusMark_set(!1)}),this.controls_sync()}opening_show(e){this.path=e,this.title_set(e),Jt(this.stateSpan,"wait","OPENING")}async content_show(e){this.path=e.path,this.original=e.content,this.title_set(e.path),this.fieldBuild??=this.field_build(e);const t=await this.fieldBuild;t!==null&&(t.text_get()!==this.original&&t.text_set(this.original),this.controls_sync(),t.focus(),this.focusMark_set(!0))}async field_build(e){let t;try{t=await cu(()=>import("./field-DWrxyyw1.js").then(s=>s.Q),[],import.meta.url)}catch(s){if(!ih(s))throw s;return Jt(this.stateSpan,"stale",ll),this.handlers.note(`edit: ${ll.toLowerCase()} — the editor's code is of an older build than the server has`),null}return this.field=await t.editField_create(this.fieldSection,e.content,e.extension,()=>this.controls_sync()),this.field}opening_fail(e){Jt(this.stateSpan,"refused",`NOT OPENED · ${e.toUpperCase()}`)}async save(){if(this.field===null||this.path===null||this.saving)return!1;const e=this.field.text_get();if(e===this.original)return!0;this.saving=!0,this.controls_sync();let t=!1;try{t=await this.handlers.save(this.path,e)}finally{this.saving=!1}return t&&(this.original=e),this.controls_sync(),t||Jt(this.stateSpan,"refused","NOT SAVED · THE CONSOLE SAYS WHY"),t}revert(){this.field===null||!this.dirty_is()||(this.field.text_set(this.original),this.controls_sync())}dirty_is(){return this.field!==null&&this.field.text_get()!==this.original}path_get(){return this.path}field_release(){return this.field===null||!this.field.hasFocus()?!1:(this.field.blur(),this.focusMark_set(!1),!0)}dispose(){this.field?.destroy(),this.field=null}controls_sync(){const e=this.dirty_is();this.savePill.disabled=!e||this.saving,this.revertPill.disabled=!e||this.saving,this.mount.dataset.dirty=e?"yes":"no",this.field!==null&&(this.saving?Jt(this.stateSpan,"wait","SAVING"):e?Jt(this.stateSpan,"note","DIRTY"):Jt(this.stateSpan,"settled","SAVED"))}title_set(e){this.titleSpan!==null&&(this.titleSpan.textContent=`EDIT ${e.split("/").pop()??e}`.toUpperCase()),this.mount.title=e}focusMark_set(e){this.focusMark!==null&&(this.focusMark.hidden=!e)}element_require(e){const t=this.mount.querySelector(e);if(t===null)throw new Error(`edit pane: no ${e} in its template`);return t}}function ki(n){return`'${n.replace(/\\/g,"\\\\").replace(/'/g,"\\'")}'`}function tb(n,e){return`touch --withContents=${ki(e)} ${ki(n)}`}function sb(n){return`edit ${ki(n)}`}function SG(n,e,t){return e<t?null:`edit: ${n} is ${(e/(1024*1024)).toFixed(1)} MB; open it in the editor? `}function EG(n,e){const{layout:t,panels:s,subjects:i}=n,r=async(u,h)=>{const p=await xr(n,tb(u,h));return p&&e.saved?.(u),p},a=u=>{const h=e.template_stamp("tpl-pane-edit"),p=new xG(h,{save:r,note:f=>n.terminal.line_note(f)});return s.set("edit",u,p),{id:u,kind:"edit",mount:h,dispose:()=>{p.dispose(),s.delete(u),i.pane_leave(u)}}},o=u=>{const h=new Set(t.panes_shown());for(const[p,f]of s.entries("edit"))if(h.has(p)&&f.path_get()===u)return p;return null},l=()=>{e.launcher_yield();const u=new Set(t.panes_shown()),h=t.focused_get(),p=h!==null&&u.has(h)?h:e.errandHost_find();if(p===null)return null;const f=e.instance_spawn("edit"),M=e.replayPlace_get();return t.leaf_split(p,M?.dir??"col",f.id,M?.before??!1)?(e.birth_record(f.id,p,M?.dir??"col",M?.before??!1),f.id):(es(f.id),t.mount_remove(f.id),null)};return{instance_build:a,edit_receive:u=>{const h=u.path??"";if(h==="")throw new Error("the editor pane needs the file it edits, and the request named none");const p=o(h)??l();if(p===null)return!1;const f=s.get("edit",p);return f===void 0?!1:(t.focus_set(p),f.dirty_is()?(n.terminal.line_note(`edit: ${h}: its pane has unsaved changes; they stand (REVERT reads the file again)`),!0):(f.content_show({path:h,content:u.content,extension:u.extension??Im(h)}),!0))},edit_open:(u,h={})=>{const p=o(u)??l();if(p===null)return null;const f=s.get("edit",p);if(f===void 0)return null;t.focus_set(p),f.dirty_is()||f.opening_show(u);const M=sb(u);return h.visible===!0?(n.terminal.line_run(M),p):(n.client.line_execute(M,{silent:!0,observe:!1}).then(g=>{const m=g.envelopes.find(_=>_.status!=="ok");m!==void 0&&f.opening_fail((m.renderedErr??"").replace(/\x1b\[[0-9;]*m/g,"").trim()||"the kernel refused")}).catch(g=>f.opening_fail(g instanceof Error?g.message:String(g))),p)}}}function AG(n){for(const e of n.envelopes){if(e.model?.kind!=="fs.acl")continue;const t=e.model.data[0];return t===void 0?null:{users:t.usernames??[],groups:t.groups??[],public:t.public===!0}}return null}function DG(n,e){return n.split(`
4277
+ `),!1}return t.outcome_write(i),i.envelopes.length>0&&i.envelopes.every(r=>r.status==="ok")}class xG{mount;handlers;titleSpan;stateSpan;fieldSection;savePill;revertPill;focusMark;field=null;path=null;original="";saving=!1;fieldBuild=null;constructor(e,t){this.mount=e,this.handlers=t,this.titleSpan=e.querySelector(".pane-title"),this.stateSpan=e.querySelector(".pane-state"),this.fieldSection=this.element_require(".edit-field"),this.savePill=this.element_require(".edit-save"),this.revertPill=this.element_require(".edit-revert"),this.focusMark=e.querySelector(".edit-focus"),this.savePill.addEventListener("click",()=>{this.save()}),this.revertPill.addEventListener("click",()=>this.revert()),e.addEventListener("keydown",s=>{(s.ctrlKey||s.metaKey)&&!s.altKey&&s.key.toLowerCase()==="s"&&(s.preventDefault(),s.stopPropagation(),this.save())},{capture:!0}),this.fieldSection.addEventListener("mousedown",()=>this.focusMark_set(!0)),this.fieldSection.addEventListener("focusin",()=>this.focusMark_set(!0)),this.fieldSection.addEventListener("focusout",s=>{(!(s.relatedTarget instanceof Node)||!this.fieldSection.contains(s.relatedTarget))&&this.focusMark_set(!1)}),this.controls_sync()}opening_show(e){this.path=e,this.title_set(e),Jt(this.stateSpan,"wait","OPENING")}async content_show(e){this.path=e.path,this.original=e.content,this.title_set(e.path),this.fieldBuild??=this.field_build(e);const t=await this.fieldBuild;t!==null&&(t.text_get()!==this.original&&t.text_set(this.original),this.controls_sync(),t.focus(),this.focusMark_set(!0))}async field_build(e){let t;try{t=await cu(()=>import("./field-CEOZA9qR.js").then(s=>s.Q),[],import.meta.url)}catch(s){if(!ih(s))throw s;return Jt(this.stateSpan,"stale",ll),this.handlers.note(`edit: ${ll.toLowerCase()} — the editor's code is of an older build than the server has`),null}return this.field=await t.editField_create(this.fieldSection,e.content,e.extension,()=>this.controls_sync()),this.field}opening_fail(e){Jt(this.stateSpan,"refused",`NOT OPENED · ${e.toUpperCase()}`)}async save(){if(this.field===null||this.path===null||this.saving)return!1;const e=this.field.text_get();if(e===this.original)return!0;this.saving=!0,this.controls_sync();let t=!1;try{t=await this.handlers.save(this.path,e)}finally{this.saving=!1}return t&&(this.original=e),this.controls_sync(),t||Jt(this.stateSpan,"refused","NOT SAVED · THE CONSOLE SAYS WHY"),t}revert(){this.field===null||!this.dirty_is()||(this.field.text_set(this.original),this.controls_sync())}dirty_is(){return this.field!==null&&this.field.text_get()!==this.original}path_get(){return this.path}field_release(){return this.field===null||!this.field.hasFocus()?!1:(this.field.blur(),this.focusMark_set(!1),!0)}dispose(){this.field?.destroy(),this.field=null}controls_sync(){const e=this.dirty_is();this.savePill.disabled=!e||this.saving,this.revertPill.disabled=!e||this.saving,this.mount.dataset.dirty=e?"yes":"no",this.field!==null&&(this.saving?Jt(this.stateSpan,"wait","SAVING"):e?Jt(this.stateSpan,"note","DIRTY"):Jt(this.stateSpan,"settled","SAVED"))}title_set(e){this.titleSpan!==null&&(this.titleSpan.textContent=`EDIT ${e.split("/").pop()??e}`.toUpperCase()),this.mount.title=e}focusMark_set(e){this.focusMark!==null&&(this.focusMark.hidden=!e)}element_require(e){const t=this.mount.querySelector(e);if(t===null)throw new Error(`edit pane: no ${e} in its template`);return t}}function ki(n){return`'${n.replace(/\\/g,"\\\\").replace(/'/g,"\\'")}'`}function tb(n,e){return`touch --withContents=${ki(e)} ${ki(n)}`}function sb(n){return`edit ${ki(n)}`}function SG(n,e,t){return e<t?null:`edit: ${n} is ${(e/(1024*1024)).toFixed(1)} MB; open it in the editor? `}function EG(n,e){const{layout:t,panels:s,subjects:i}=n,r=async(u,h)=>{const p=await xr(n,tb(u,h));return p&&e.saved?.(u),p},a=u=>{const h=e.template_stamp("tpl-pane-edit"),p=new xG(h,{save:r,note:f=>n.terminal.line_note(f)});return s.set("edit",u,p),{id:u,kind:"edit",mount:h,dispose:()=>{p.dispose(),s.delete(u),i.pane_leave(u)}}},o=u=>{const h=new Set(t.panes_shown());for(const[p,f]of s.entries("edit"))if(h.has(p)&&f.path_get()===u)return p;return null},l=()=>{e.launcher_yield();const u=new Set(t.panes_shown()),h=t.focused_get(),p=h!==null&&u.has(h)?h:e.errandHost_find();if(p===null)return null;const f=e.instance_spawn("edit"),M=e.replayPlace_get();return t.leaf_split(p,M?.dir??"col",f.id,M?.before??!1)?(e.birth_record(f.id,p,M?.dir??"col",M?.before??!1),f.id):(es(f.id),t.mount_remove(f.id),null)};return{instance_build:a,edit_receive:u=>{const h=u.path??"";if(h==="")throw new Error("the editor pane needs the file it edits, and the request named none");const p=o(h)??l();if(p===null)return!1;const f=s.get("edit",p);return f===void 0?!1:(t.focus_set(p),f.dirty_is()?(n.terminal.line_note(`edit: ${h}: its pane has unsaved changes; they stand (REVERT reads the file again)`),!0):(f.content_show({path:h,content:u.content,extension:u.extension??Lm(h)}),!0))},edit_open:(u,h={})=>{const p=o(u)??l();if(p===null)return null;const f=s.get("edit",p);if(f===void 0)return null;t.focus_set(p),f.dirty_is()||f.opening_show(u);const M=sb(u);return h.visible===!0?(n.terminal.line_run(M),p):(n.client.line_execute(M,{silent:!0,observe:!1}).then(g=>{const m=g.envelopes.find(_=>_.status!=="ok");m!==void 0&&f.opening_fail((m.renderedErr??"").replace(/\x1b\[[0-9;]*m/g,"").trim()||"the kernel refused")}).catch(g=>f.opening_fail(g instanceof Error?g.message:String(g))),p)}}}function AG(n){for(const e of n.envelopes){if(e.model?.kind!=="fs.acl")continue;const t=e.model.data[0];return t===void 0?null:{users:t.usernames??[],groups:t.groups??[],public:t.public===!0}}return null}function DG(n,e){return n.split(`
4278
4278
  `).map(t=>t.trim().split(":")).filter(t=>t.length>=4&&(t[3]??"").split(",").includes(e)).map(t=>t[0]??"").filter(t=>t!=="")}function TG(n){return/^(u|user|g|group|o|other):/.test(n)?n:`u:${n}:r`}function IG(n,e){return e.kind==="public"?`setfacl -m o::- feed_${n}`:`setfacl -x ${e.kind==="user"?"u":"g"}:${ki(e.name)} feed_${n}`}function _o(n){return n.kind==="public"?"PUBLIC":n.kind==="group"?`group ${n.name}`:n.name}function GG(n,e){const t={silent:!0,observe:!1},s=async c=>{try{return AG(await n.client.line_execute(`getfacl feed_${c}`,t))}catch{return null}},i=async()=>{const c=e.promptUser();if(c===null)return[];try{const d=await n.client.line_execute("cat /etc/group",t);return DG(d.envelopes.map(u=>u.rendered).join(""),c)}catch{return[]}},r=async(c,d,u)=>{await e.ask_onPane(c,{kind:"confirm",message:`Stop sharing feed_${d} with ${_o(u)}? `})==="y"&&await xr(n,IG(d,u))&&e.changed(d)};return{holders_read:s,holders_build:(c,d,u)=>{const h=document.createElement("span");h.className="holder-marks";const p=[...u.users.map(f=>({kind:"user",name:f})),...u.groups.map(f=>({kind:"group",name:f})),...u.public?[{kind:"public"}]:[]];if(p.length===0)return h.textContent="SHARED WITH NOBODY",h;h.append("SHARED WITH ");for(const f of p){const M=document.createElement("span");M.className=`holder-mark holder-${f.kind}`,M.title=_o(f);const g=document.createElement("span");g.className="holder-mark-name",g.textContent=_o(f),M.append(g);const m=document.createElement("span");m.className="holder-mark-x",m.title=`stop sharing with ${_o(f)} (asks first)`,m.textContent="×",m.addEventListener("click",_=>{_.stopPropagation(),r(c,d,f)}),M.append(m),h.append(M)}return h},share_choose:async(c,d)=>{for(;;){const[u,h]=await Promise.all([s(d),i()]),p=u??{groups:[],public:!1},f=[{value:"o::r",label:"EVERYONE",held:p.public},...h.map(g=>({value:`g:${g}:r`,label:g,held:p.groups.includes(g)}))],M=(await e.ask_onPane(c,{kind:"choose",message:`Share feed_${d} with a group, everyone, or a user: `,choices:f,commit:"SHARE",close:"DONE"})??"").trim();if(M===""||!await xr(n,`setfacl -m ${TG(M)} feed_${d}`))return;e.changed(d)}},rename:async(c,d,u)=>{const h=(await e.ask_onPane(c,{kind:"text",message:`Rename feed_${d} to: `,suggest:u,commit:"RENAME"})??"").trim();h===""||h===u||await xr(n,tb(`/proc/jobs/feed_${d}/title`,h))&&e.changed(d)}}}function RG(n){for(const e of n.envelopes){if(e.model?.kind!=="fs.listing")continue;return(e.model.data[0]?.items??[]).map(s=>String(s.name??"")).filter(s=>s!=="")}return[]}function NG(n,e,t){const s=`setfattr -n tag -v ${ki(e)} feed_${n}`;return t.includes(e)?[s]:[`mkdir ${ki(`/proc/tags/${e}`)}`,s]}function BG(n,e){const t=async()=>{try{return RG(await n.client.line_execute("ls /proc/tags",{silent:!0,observe:!1}))}catch{return[]}};return{tag_choose:async(r,a,o)=>{const l=new Set(o);for(;;){const c=await t(),d=c.map(M=>({value:M,held:l.has(M)})),u=c.filter(M=>!l.has(M)).join(", "),p=(await e.ask_onPane(r,{kind:"choose",message:`Tag feed_${a}${u===""?"":` (${u})`}, or a new tag: `,choices:d,commit:"TAG",close:"DONE"})??"").trim();if(p===""||p.includes("/"))return;if(l.has(p))continue;let f=!0;for(const M of NG(a,p,c))if(f=await xr(n,M),!f)break;if(!f)return;l.add(p),e.tags_changed(a)}},tag_remove:async(r,a)=>{const o=await xr(n,`setfattr -x tag -v ${ki(a)} feed_${r}`);return o&&e.tags_changed(r),o}}}function CG(n,e){return{tags:BG(n,{ask_onPane:e.ask_onPane,tags_changed:e.changed}),access:GG(n,e)}}function PG(n){for(const e of n.envelopes){if(e.model?.kind!=="fs.xattr")continue;return e.model.data[0]?.tags??[]}return[]}function pm(n,e,t){const{panels:s,subjects:i}=n,{tags:r,access:a}=t;return{feed_verbs:o=>{const l={feedId:o.id},c={note:()=>n.terminal.line_run(`edit /proc/jobs/feed_${o.id}/note`),tag:()=>{r.tag_choose(e,o.id,o.tags??[])},rename:()=>{a.rename(e,o.id,o.title)},share:()=>{a.share_choose(e,o.id)},delete:()=>n.terminal.line_run(`feed rm feed_${o.id}`)};return jM.rules.filter(d=>d.offered(l)).map(d=>({label:d.label(l),run:()=>c[d.name]?.()}))},feed_indicated:o=>{i.regard_write(e,{address:`/proc/jobs/feed_${o.id}`,modelKind:"feed"}),a.holders_read(o.id).then(l=>{s.get("dag",e)?.rowReadout_show(o.id,l===null?"ACCESS UNREAD":a.holders_build(e,o.id,l))})},feed_untag:(o,l)=>{r.tag_remove(o,l)},feed_entered:o=>{const l={silent:!0,observe:!1},c=d=>d!==null&&d.envelopes.every(u=>u.status==="ok")?d.envelopes.map(u=>u.rendered).join("").replace(/\x1b\[[0-9;]*m/g,""):null;Promise.all([n.client.line_execute(`cat /proc/jobs/feed_${o}/note`,l).catch(()=>null),n.client.line_execute(`getfattr feed_${o}`,l).catch(()=>null),n.client.line_execute(`cat /proc/jobs/feed_${o}/title`,l).catch(()=>null)]).then(([d,u,h])=>{(s.get("dag",e)??s.get("universe",e))?.feedMarks_show(o,{note:c(d),tags:u===null?[]:PG(u),title:(c(h)??"").trim()})})},feed_note:o=>n.terminal.line_run(`edit /proc/jobs/feed_${o}/note`),feed_tag:(o,l)=>{r.tag_choose(e,o,l)},feed_rename:(o,l)=>{a.rename(e,o,l)}}}class LG{listing;constructor(e){const t=e.querySelector(".help-panel");if(t===null)throw new Error("help pane: no .help-panel in its template");this.listing=new ni({mount:t,traits:this.traits_declare(),key:s=>s.key,chrome:{root:e,prefix:"help"},caps:"root",activatable:()=>!1,row:{className:s=>`help-row help-${s.topic}`}}),this.render()}traits_declare(){return[{key:"name",label:"KEY · VERB",className:"help-key",width:"minmax(9em, 12em)",cell:e=>e.name},{key:"does",label:"DOES",className:"help-does",width:"minmax(16em, 1fr)",cell:e=>e.does}]}render(){const e=a=>{const o=document.createElement("header");return o.className="files-path help-block-head",o.textContent=a,o},t=Ci.map(a=>({key:`k:${a.key}`,name:a.key,does:a.does,topic:a.topic})),s=Nu.map((a,o)=>{const l=a.indexOf(" ");return{key:`v:${o}`,name:l<0?a:a.slice(0,l),does:l<0?"":a.slice(l+1).trim(),topic:"verb"}}),i=[{key:"g:games",name:"help games",does:"the /usr/games shelf — fortune, cal, weather and their kin, by category (type it in the console)",topic:"verb"}],r=[{key:"n:notes",name:"notes",does:"what the installed releases changed (notes pane opens it as a listing; the dashboard's WHAT'S NEW block too)",topic:"verb"}];this.listing.rows_set([{key:"keys",header:e("KEYS — Ctrl-B opens the focused pane's drawer; then one key presses one of its verbs"),rows:t},{key:"verbs",header:e("VERBS — the console language; the long form is docs/argus-lang.adoc"),rows:s},{key:"games",header:e("GAMES — the small pleasures, kept apart from the tools as BSD kept them"),rows:i},{key:"notes",header:e("NOTES — what changed, release by release"),rows:r}],{field:"help"})}}function WG(n,e){const{layout:t,panels:s,subjects:i}=n;return{instance_build:o=>{const l=e.template_stamp("tpl-pane-help");return s.set("help",o,new LG(l)),{id:o,kind:"help",mount:l,dispose:()=>{s.delete(o),i.pane_leave(o)}}},open:()=>{const o=s.ids("help").find(u=>t.panes_shown().includes(u));if(o!==void 0)return t.focus_set(o),"help: on stage";const l=e.launcher_active();e.launcher_yield();const c=t.focused_get()??"files",d=e.instance_spawn("help");return l&&t.leaf_replace("files",d.id)?(t.focus_set(d.id),"help: the keys and the verbs, as a pane (help keys, help verbs print them here)"):t.leaf_split(c,"col",d.id,!1)?(e.birth_record(d.id,c,"col",!1),"help: the keys and the verbs, as a pane (help keys, help verbs print them here)"):(es(d.id),t.mount_remove(d.id),"help: could not open a pane")}}}const Lc=["___________________ _-_ ","\\__(==========/_=_/ ____.---'---`---.____"," \\_ \\ \\----._________.----/"," \\ \\ / / `-_-' "," __,--`.`-'..'-_ "," /____ || "," `--.____,-' "];function kG(){const n=Lc[0].length;let e=Number.NaN,t=0;return{title:"SL",tick:60,step:s=>{Number.isNaN(e)&&(e=-n),e+=1,t+=1,e>s.cols+6&&(e=-n)},draw:(s,i)=>{const r=Math.max(0,Math.floor((s.rows-Lc.length)/2));Lc.forEach((o,l)=>s.text(Math.round(e),r+l,o,i.lit));const a=t%2===0?"-~=":"-=~";s.text(Math.round(e)-a.length,r+1,a,i.cool)}}}const mm="ハミヒーウシナモニサワツオリアホテマケメエカキムユラセネスタヌヘ0123456789Z:・.=*+-<>¦|";function UG(){const n=new Map;let e=0;return{title:"CMATRIX",tick:50,step:(t,s)=>{e+=1;for(let i=0;i<t.cols;i++){const r=n.get(i);if(r===void 0){s()<.02&&n.set(i,{row:-1,speed:1+Math.floor(s()*2),length:4+Math.floor(s()*12),glyphs:[]});continue}e%r.speed===0&&(r.row+=1,r.glyphs.unshift(mm[Math.floor(s()*mm.length)]),r.glyphs.length>r.length&&r.glyphs.pop(),r.row-r.length>t.rows&&n.delete(i))}},draw:(t,s)=>{for(const[i,r]of n)r.glyphs.forEach((a,o)=>{const l=o===0?"#ffffff":o<r.length/2?s.lit:s.dim;t.put(i,r.row-o,a,l)})}}}function FG(){const n=[];return{title:"RAIN",tick:70,step:(e,t)=>{t()<.9&&n.push({col:Math.floor(t()*e.cols),row:0,splash:0});for(const s of n)s.row<e.rows-1?s.row+=1:s.splash+=1;for(let s=n.length-1;s>=0;s--)n[s].splash>3&&n.splice(s,1)},draw:(e,t)=>{for(const s of n){if(s.splash===0){e.put(s.col,s.row,"|",t.cool);continue}const i=["o","O","( )"][s.splash-1];e.text(s.col-(i.length>>1),e.rows-1,i,t.dim)}}}}function jG(){const n=[],e=[];let t=0;return{title:"ASCIIQUARIUM",tick:90,step:(s,i)=>{if(t+=1,n.length<Math.max(3,s.cols/12)&&i()<.08){const r=i()<.5;n.push({col:r?-4:s.cols+1,row:2+Math.floor(i()*Math.max(1,s.rows-5)),right:r,speed:1+Math.floor(i()*2),hue:Math.floor(i()*3)})}for(const r of n)t%r.speed===0&&(r.col+=r.right?1:-1);for(let r=n.length-1;r>=0;r--){const a=n[r];(a.col<-5||a.col>s.cols+2)&&n.splice(r,1)}if(i()<.3){const r=n[Math.floor(i()*n.length)];r!==void 0&&e.push({col:r.col+(r.right?4:-1),row:r.row-1})}for(const r of e)r.row-=1;for(let r=e.length-1;r>=0;r--)e[r].row<1&&e.splice(r,1)},draw:(s,i)=>{const r=(t%4<2?"~^":"^~").repeat(s.cols>>1);s.text(0,0,r,i.cool);const a=[i.lit,i.cool,i.warn];for(const o of n)s.text(o.col,o.row,o.right?"><>":"<><",a[o.hue]);for(const o of e)s.put(o.col,o.row,o.row%2===0?"o":".",i.dim);for(let o=2;o<s.cols;o+=7){const l=(t>>2)%2===0?0:1;for(let c=0;c<3;c++)s.put(o+(c+l)%2,s.rows-2-c,c%2===0?"(":")",i.dim)}s.text(0,s.rows-1,"^".repeat(s.cols),i.dim)}}}const gm=[[[0,0],[1,0],[2,0],[3,0]],[[0,0],[1,0],[0,1],[1,1]],[[1,0],[0,1],[1,1],[2,1]],[[0,0],[1,0],[1,1],[2,1]],[[1,0],[2,0],[0,1],[1,1]],[[0,0],[0,1],[1,1],[2,1]],[[2,0],[0,1],[1,1],[2,1]]],Oi=10,Di=20;function $G(){return{well:Array.from({length:Di},()=>Array(Oi).fill(0)),piece:null,score:0,lines:0,over:!1}}function rh(n,e){return e.cells.every(([t,s])=>{const i=e.x+t,r=e.y+s;return i>=0&&i<Oi&&r<Di&&(r<0||n[r][i]===0)})}function Wc(n){const e=Math.max(...n.cells.flat())+1;return{...n,cells:n.cells.map(([t,s])=>[e-1-s,t])}}function VG(n,e){const t=Math.floor(e()*gm.length),s={cells:gm[t].map(i=>[i[0],i[1]]),x:3,y:0,kind:t+1};if(!rh(n.well,s)){n.over=!0;return}n.piece=s}function HG(n){const e=n.piece;if(e===null)return;e.cells.some(([,i])=>e.y+i<0)&&(n.over=!0);for(const[i,r]of e.cells){const a=e.y+r;a>=0&&(n.well[a][e.x+i]=e.kind)}const t=n.well.filter(i=>i.some(r=>r===0)),s=Di-t.length;for(;t.length<Di;)t.unshift(Array(Oi).fill(0));n.well=t,n.lines+=s,n.score+=[0,100,300,500,800][s]??800,n.piece=null}function du(n,e){if(n.over)return;if(n.piece===null){VG(n,e);return}const t={...n.piece,y:n.piece.y+1};rh(n.well,t)?n.piece=t:HG(n)}function qG(n,e,t){if(n.over||n.piece===null)return!1;const s=n.piece,i=r=>rh(n.well,r)?(n.piece=r,!0):!1;switch(e){case"ArrowLeft":case"h":case"a":return i({...s,x:s.x-1}),!0;case"ArrowRight":case"l":case"d":return i({...s,x:s.x+1}),!0;case"ArrowUp":case"k":case"w":return i(Wc(s))||i({...Wc(s),x:s.x-1})||i({...Wc(s),x:s.x+1}),!0;case"ArrowDown":case"j":case"s":return du(n,t),!0;case" ":{for(;n.piece!==null;)du(n,t);return!0}default:return!1}}function XG(){const n=$G();let e=Math.random;return{title:"TETRIS",tick:500,step:(t,s)=>{e=s,du(n,s)},draw:(t,s)=>{const i=Math.max(0,Math.floor((t.cols-(Oi*2+2))/2)),r=Math.max(0,Math.floor((t.rows-Di-1)/2)),a=["",s.cool,s.lit,s.warn,s.dim,s.lit,s.cool,s.warn];for(let o=0;o<Di;o++){t.put(i,r+o,"|",s.dim),t.put(i+Oi*2+1,r+o,"|",s.dim);for(let l=0;l<Oi;l++){const c=n.well[o][l];c!==0&&t.text(i+1+l*2,r+o,"[]",a[c])}}if(t.text(i,r+Di,"+"+"-".repeat(Oi*2)+"+",s.dim),n.piece!==null)for(const[o,l]of n.piece.cells){const c=n.piece.y+l;c>=0&&t.text(i+1+(n.piece.x+o)*2,r+c,"[]",a[n.piece.kind])}n.over&&t.text(i+2,r+9," GAME OVER ",s.warn)},key:t=>qG(n,t,e),status:()=>`${n.score} · ${n.lines} lines${n.over?" · OVER":""}`,over:()=>n.over}}function KG(n,e,t){const s=n>>1,i=e>>1,r={body:[[s,i],[s-1,i],[s-2,i]],food:[0,0],heading:"right",next:"right",score:0,over:!1,cols:n,rows:e};return nb(r,t),r}function nb(n,e){for(let t=0;t<1e3;t++){const s=[Math.floor(e()*n.cols),Math.floor(e()*n.rows)];if(!n.body.some(([i,r])=>i===s[0]&&r===s[1])){n.food=s;return}}}const YG={up:"down",down:"up",left:"right",right:"left"};function ZG(n,e){YG[e]!==n.heading&&(n.next=e)}function QG(n,e){if(n.over)return;n.heading=n.next;const[t,s]=n.body[0],i=n.heading==="up"?[t,s-1]:n.heading==="down"?[t,s+1]:n.heading==="left"?[t-1,s]:[t+1,s],r=i[0]<0||i[1]<0||i[0]>=n.cols||i[1]>=n.rows,a=n.body.some(([o,l])=>o===i[0]&&l===i[1]);if(r||a){n.over=!0;return}n.body.unshift(i),i[0]===n.food[0]&&i[1]===n.food[1]?(n.score+=10,nb(n,e)):n.body.pop()}const JG={...Object.fromEntries(Ru.map(n=>[ms[n].arrow,ms[n].focusWord])),k:"up",w:"up",j:"down",s:"down",h:"left",a:"left",l:"right",d:"right"};function eR(){let n=null;return{title:"SNAKE",tick:140,step:(e,t)=>{n===null&&(n=KG(Math.max(8,e.cols>>1),Math.max(6,e.rows-1),t)),QG(n,t)},draw:(e,t)=>{n!==null&&(e.text(0,n.rows,"-".repeat(n.cols*2),t.dim),e.text(n.food[0]*2,n.food[1],"**",t.warn),n.body.forEach(([s,i],r)=>e.text(s*2,i,r===0?"@@":"oo",r===0?t.lit:t.cool)),n.over&&e.text(Math.max(0,n.cols-6),n.rows>>1," GAME OVER ",t.warn))},key:e=>{const t=JG[e];return t===void 0||n===null?!1:(ZG(n,t),!0)},status:()=>n===null?"":`${n.score}${n.over?" · OVER":""}`,over:()=>n?.over??!1}}const ib={sl:kG,cmatrix:UG,rain:FG,aquarium:jG,tetris:XG,snake:eR};function tR(n){return n in ib}const sR=8,nR=26,kc=1.8,iR=100,Mm=24;function bm(n,e){let t=Math.floor(n/iR);return e/(t*kc)<Mm&&(t=Math.floor(e/Mm/kc)),t=Math.max(sR,Math.min(nR,t)),{w:t,h:Math.round(t*kc)}}class rR{pane;field;canvas;state;focusMark;pausePill;program=null;name=null;paused=!1;timer=null;frame=null;observer;constructor(e){this.pane=e,this.field=oa(e,".games-field"),this.canvas=oa(e,".games-canvas"),this.state=e.querySelector(".pane-state"),this.focusMark=oa(e,".games-focus"),this.pausePill=oa(e,".games-pause"),this.field.tabIndex=0,this.pausePill.addEventListener("click",()=>this.pause_toggle()),oa(e,".games-restart").addEventListener("click",()=>{this.name!==null&&this.program_run(this.name)}),this.field.addEventListener("mousedown",()=>{this.field.focus(),this.focusMark_paint(!0)}),this.field.addEventListener("focusin",()=>this.focusMark_paint(!0)),this.field.addEventListener("focusout",t=>{(!(t.relatedTarget instanceof Node)||!this.field.contains(t.relatedTarget))&&this.focusMark_paint(!1)}),this.field.addEventListener("keydown",t=>this.key_handle(t)),this.observer=typeof ResizeObserver>"u"?null:new ResizeObserver(()=>this.draw()),this.observer?.observe(this.field)}program_run(e){this.name=e,this.program=ib[e](),this.paused=!1,this.pausePill.textContent="PAUSE",this.clock_start(),this.program.key!==void 0&&(this.field.focus(),this.focusMark_paint(!0)),this.draw()}program_name(){return this.name}paused_is(){return this.paused}pause_toggle(){this.program!==null&&(this.paused=!this.paused,this.pausePill.textContent=this.paused?"RESUME":"PAUSE",this.paused?this.clock_stop():this.clock_start(),this.state_paint())}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}dispose(){this.clock_stop(),this.observer?.disconnect()}key_handle(e){if(e.key==="Escape"){this.field_release(),e.stopPropagation();return}if(this.program!==null){if(e.key===" "&&this.program.key===void 0){this.pause_toggle(),e.preventDefault(),e.stopPropagation();return}this.program.key?.(e.key)===!0&&(e.preventDefault(),this.draw()),e.stopPropagation()}}clock_start(){this.clock_stop();const e=this.program;e!==null&&(this.timer=setInterval(()=>{this.field.offsetParent!==null&&(e.step(this.size_of(),Math.random),this.draw(),e.over?.()===!0&&this.clock_stop())},e.tick))}clock_stop(){this.timer!==null&&clearInterval(this.timer),this.timer=null}size_of(){const e=this.field.getBoundingClientRect(),t=bm(e.width,e.height);return{cols:Math.max(10,Math.floor(e.width/t.w)),rows:Math.max(6,Math.floor(e.height/t.h))}}palette_read(){const e=getComputedStyle(this.pane),t=(s,i)=>e.getPropertyValue(s).trim()||i;return{lit:t("--harvestgold","#ffcc66"),dim:t("--butter","#ffff99"),warn:t("--tomato","#ff7766"),cool:t("--daybreak","#55aaff")}}draw(){this.frame===null&&(this.frame=requestAnimationFrame(()=>{this.frame=null,this.paint()}))}paint(){const e=this.program,t=this.canvas.getContext("2d");if(e===null||t===null)return;const s=this.field.getBoundingClientRect(),i=window.devicePixelRatio||1;(this.canvas.width!==Math.floor(s.width*i)||this.canvas.height!==Math.floor(s.height*i))&&(this.canvas.width=Math.floor(s.width*i),this.canvas.height=Math.floor(s.height*i)),t.setTransform(i,0,0,i,0,0),t.clearRect(0,0,s.width,s.height);const r=bm(s.width,s.height);t.font=`${r.h-2}px 'Share Tech Mono', monospace`,t.textBaseline="top";const a=this.size_of(),o=(c,d,u,h)=>{c<0||d<0||c>=a.cols||d>=a.rows||(t.fillStyle=h,t.fillText(u,c*r.w,d*r.h))},l={cols:a.cols,rows:a.rows,put:o,text:(c,d,u,h)=>{[...u].forEach((p,f)=>{p!==" "&&o(c+f,d,p,h)})}};e.draw(l,this.palette_read()),this.state_paint()}state_paint(){if(this.state===null||this.program===null)return;const e=this.program.status?.()??"";this.state.textContent=[this.program.title,e,this.paused?"PAUSED":""].filter(t=>t!=="").join(" · ")}focusMark_paint(e){this.focusMark.hidden=!e,this.pane.classList.toggle("games-field-focused",e)}}function oa(n,e){const t=n.querySelector(e);if(t===null)throw new Error(`games pane: missing ${e}`);return t}function aR(n,e){const{layout:t,panels:s,subjects:i}=n;return{instance_build:o=>{const l=e.template_stamp("tpl-pane-games"),c=new rR(l);return s.set("games",o,c),{id:o,kind:"games",mount:l,dispose:()=>{c.dispose(),s.delete(o),i.pane_leave(o)}}},show:o=>{const l=typeof o=="object"&&o!==null?o.program:void 0;if(typeof l!="string"||!tR(l))return`games: no program named ${String(l)}`;const c=s.ids("games").find(f=>t.panes_shown().includes(f));if(c!==void 0)return t.focus_set(c),s.get("games",c)?.program_run(l),`games: ${l} on the GAMES pane`;const d=e.launcher_active();e.launcher_yield();const u=t.focused_get()??"files",h=e.instance_spawn("games");return(d?t.leaf_replace("files",h.id):t.leaf_split(u,"col",h.id,!1))?(d?t.focus_set(h.id):e.birth_record(h.id,u,"col",!1),s.get("games",h.id)?.program_run(l),`games: ${l} in a GAMES pane (Esc gives the keyboard back; its PAUSE and RESTART pills on the frame)`):(es(h.id),t.mount_remove(h.id),"games: could not open a pane")}}}function oR(n){return`${n.date??"undated"} · ${n.entries.map(e=>`${e.package} ${e.version}`).join(" · ")}`}function lR(n,e){return n.releases.map(t=>{const s=t.merge??t.date??"undated",i=[];for(const r of t.entries)r.changes.forEach((a,o)=>{const l=`${s}:${r.package}:${o}`,c=a.body!=="";i.push({key:l,tag:r.package,text:a.headline,body:!1,more:c,internal:a.internal,of:l}),c&&e.has(l)&&i.push({key:`${l}:body`,tag:"",text:a.body,body:!0,more:!1,internal:a.internal,of:l})});return{key:s,title:oR(t),rows:i}})}class cR{constructor(e,t){this.hooks=t;const s=e.querySelector(".notes-panel");if(s===null)throw new Error("notes pane: no .notes-panel in its template");this.state=e.querySelector(".pane-state"),this.sincePill=e.querySelector(".notes-since"),this.internalPill=e.querySelector(".notes-internal"),this.listing=new ni({mount:s,traits:this.traits_declare(),key:i=>i.key,chrome:{root:e,prefix:"notes"},caps:"root",activatable:i=>i.more,activate:i=>this.unfold_toggle(i.of),row:{className:i=>`notes-row${i.body?" notes-row-body":""}${i.internal?" notes-row-internal":""}${i.more?" notes-row-more":""}`}}),this.sincePill?.addEventListener("click",()=>{this.since_cycle()}),this.internalPill?.addEventListener("click",()=>{this.internal_toggle()}),this.pills_paint()}hooks;listing;state;sincePill;internalPill;model=null;unfolded=new Set;ask={since:1,all:!1};traits_declare(){return[{key:"tag",label:"PACKAGE",className:"notes-tag",width:"minmax(5em, 7em)",cell:e=>e.tag},{key:"text",label:"CHANGE",className:"notes-text",width:"minmax(16em, 1fr)",cell:e=>e.more&&!e.body?`${e.text} ▸`:e.text}]}model_show(e){this.model=e,this.ask={since:e.releases.length>1?e.releases.length>=e.total?"all":e.releases.length:1,all:e.all},this.render()}releases_shown(){return this.model?.releases.length??0}unfolded_is(e){return this.unfolded.has(e)}unfold_toggle(e){this.unfolded.has(e)?this.unfolded.delete(e):this.unfolded.add(e),this.render()}async since_cycle(){const e=this.ask.since===1?5:this.ask.since===5?"all":1;await this.ask_again({...this.ask,since:e})}async internal_toggle(){await this.ask_again({...this.ask,all:!this.ask.all})}async ask_again(e){const t=e.since==="all"?"9999":String(e.since),s=await this.hooks.ask(`notes --since ${t}${e.all?" --all":""}`);s!==null&&(this.ask=e,this.model_show(s))}pills_paint(){this.sincePill!==null&&(this.sincePill.textContent=this.ask.since==="all"?"ALL RELEASES":this.ask.since===1?"LATEST RELEASE":`LAST ${this.ask.since} RELEASES`),this.internalPill!==null&&(this.internalPill.textContent=this.ask.all?"INTERNAL ON":"INTERNAL OFF",this.internalPill.classList.toggle("rail-off",!this.ask.all))}render(){const e=this.model;if(e===null)return;const t=i=>{const r=document.createElement("header");return r.className="files-path notes-block-head",r.textContent=i,r},s=lR(e,this.unfolded).map(i=>({key:i.key,header:t(i.title),rows:i.rows}));if(this.listing.rows_set(s,{field:"notes"}),this.state!==null){const i=Object.entries(e.installed).map(([r,a])=>`${r} ${a}`).join(" · ");this.state.textContent=`${e.source.toUpperCase()} · ${i}`}this.pills_paint()}}function dR(n){for(const e of n.envelopes){if(e.model?.kind!==N0)continue;const t=L0.safeParse(e.model.data);if(t.success)return t.data}return null}function uR(n,e){const{layout:t,panels:s,subjects:i}=n,r=async c=>dR(await e.ask(c)),a=c=>{const d=e.template_stamp("tpl-pane-notes");return s.set("notes",c,new cR(d,{ask:r})),{id:c,kind:"notes",mount:d,dispose:()=>{s.delete(c),i.pane_leave(c)}}},o=c=>{r("notes").then(d=>{d!==null&&s.get("notes",c)?.model_show(d)})};return{instance_build:a,open:()=>{const c=s.ids("notes").find(f=>t.panes_shown().includes(f));if(c!==void 0)return t.focus_set(c),o(c),"notes: on stage";const d=e.launcher_active();e.launcher_yield();const u=t.focused_get()??"files",h=e.instance_spawn("notes");return(d?t.leaf_replace("files",h.id):t.leaf_split(u,"col",h.id,!1))?(d?t.focus_set(h.id):e.birth_record(h.id,u,"col",!1),o(h.id),"notes: what the installed releases changed, as a pane (notes in the console prints it)"):(es(h.id),t.mount_remove(h.id),"notes: could not open a pane")},latest:()=>r("notes")}}function _m(n){return[...n.querySelectorAll(".mode-frame button")].filter(e=>!e.disabled&&!e.hidden&&e.offsetParent!==null)}function hR(n){return[...n.querySelectorAll(".listing-row")].filter(e=>e.offsetParent!==null)}function fR(n,e,t){if(e===0)return null;switch(t){case"ArrowDown":return n<0?0:Math.min(e-1,n+1);case"ArrowUp":return n<0?e-1:Math.max(0,n-1);case"Home":return 0;case"End":return e-1;default:return null}}function pR(n,e){const{layout:t,panels:s,paneInstance_get:i}=n,r=[()=>e.palette_isOpen()?(e.palette_close(),"claimed"):"passed",()=>n.terminal.ask_abandon()?"claimed":"passed",()=>JM()?"claimed":"passed",()=>e.errand_abandon()?"claimed":"passed",()=>{const f=document.activeElement;return!(f instanceof HTMLInputElement||f instanceof HTMLTextAreaElement)||f.closest(".workspace-pane")===null||f.closest("#terminal")!==null?"passed":(f.blur(),"claimed")},()=>s.values("image").some(f=>f.field_release())?"claimed":"passed",()=>s.values("edit").some(f=>f.field_release())?"claimed":"passed",()=>s.values("games").some(f=>f.field_release())?"claimed":"passed",()=>{if(n.terminal.ask_isOpen())return"passed";let f=!1;for(const M of s.values("files"))M.select_isOn()&&(M.select_toggle(!1),f=!0);return f?"claimed":"passed"},()=>{const f=e.drawers_close(),M=e.modeFrames_close();return f||M?"claimed":"passed"},()=>document.body.dataset.zoom!==void 0?"yielded":"passed",()=>e.dive_leave()?"claimed":"passed",()=>e.overlay_escape()?"claimed":"passed",()=>{const f=s.entries("dag").find(([,M])=>M.inside_isHeld());return f===void 0?"passed":(f[1].flight_back(()=>{}),"claimed")},()=>{const f=t.focused_get(),M=s.entries("files").filter(([,g])=>g.content_isShown()).sort(([g],[m])=>g===f?-1:m===f?1:0)[0];return M===void 0?"passed":(M[1].listing_restore(),"claimed")},()=>s.values("dag").some(f=>f.nav_pop())?"claimed":"passed"],a=f=>{if(document.body.dataset.zoom!=="launcher")for(const M of r){const g=M();if(g==="yielded")return;if(g==="claimed"){f.stopImmediatePropagation(),M!==r[0]&&n.sound("audio3");return}}},o=(f,M)=>{const g=()=>{f.preventDefault(),f.stopImmediatePropagation()},m=lv(f.key);if(f.ctrlKey&&!f.metaKey&&!f.altKey&&m!==null){const y=t.focused_get();return y!==null&&e.verbs.resize(y,m,.05),g(),!0}if(f.ctrlKey||f.metaKey||f.altKey)return!1;const _=y=>(e.drawers_close(),y(),g(),!0);if(m!==null)return _(()=>{l(),Ag(e.host(),ms[m].focusWord)!==null&&n.sound("audio3")});switch(f.key){case"o":case"O":{const y=t.panes_shown(),O=y.indexOf(t.focused_get()??""),S=y[(O+(f.key==="o"?1:y.length-1))%y.length];return _(()=>{l(),S!==void 0&&(t.focus_set(S),n.sound("audio3"))})}case"?":return _(()=>n.terminal.line_run("argus keys"));case";":return _(()=>{l(),t.focus_last()!==null&&n.sound("audio3")});case"q":return _(()=>{for(const y of t.panes_shown())e.verbs.bar_note(y,`@${y}`)});case" ":{const y=t.focused_get();return _(()=>{y!==null&&e.verbs.flip(y)})}case"!":{const y=t.focused_get();return _(()=>{y!==null&&t.panes_shown().length>1&&(e.stage_alone(y),e.verbs.bar_note(y,"ALONE ON STAGE"),n.sound("audio3"))})}case"w":return _(()=>e.element_require("gutter-panes").click());case"r":return _(()=>{l();const y=c();y!==null&&d(y)});case"&":return _(()=>n.terminal.line_run("pane close all"));case"[":return _(()=>{const y=document.querySelector(".argus-output");y!==null&&(y.tabIndex=-1,y.focus())})}const w=Ci.find(y=>y.key===f.key&&y.selector!==null);if(w===void 0||w.selector===null)return!1;w.move===!0&&M.querySelector('.drawer-mode[data-mode="move"]')?.click();const z=M.querySelector(w.selector);return z===null||z.disabled?w.move===!0&&M.querySelector('.drawer-mode[data-mode="split"]')?.click():z.click(),g(),!0},l=()=>{const f=document.activeElement;f instanceof HTMLElement&&f.closest("#drawer")!==null&&f.blur(),e.console_release()},c=()=>{const f=document.body.dataset.zoom;if(f==="console"||f==="launcher")return null;const M=f!==void 0?f:t.focused_get();if(M===null)return null;const g=i(M)?.mount??null;return g?.closest(".workspace-pane")??g},d=f=>{f.classList.contains("workspace-pane")&&(f.dataset.modes="open");let M=0;const g=()=>{M+=1;const m=document.activeElement;!(m instanceof HTMLButtonElement&&m.closest(".mode-frame")!==null&&f.contains(m))&&(m===null||m===document.body)&&_m(f)[0]?.focus(),M<30&&window.requestAnimationFrame(g)};return g(),n.sound("audio3"),!0},u=f=>{if(f.ctrlKey||f.metaKey||f.altKey||f.shiftKey)return!1;const M=c();if(M===null)return!1;const g=()=>(f.preventDefault(),f.stopImmediatePropagation(),!0),m=document.activeElement;if(m instanceof HTMLButtonElement&&m.closest(".mode-frame")!==null&&M.contains(m)){const S=_m(M),b=S.indexOf(m);return f.key==="ArrowLeft"?(m.blur(),g()):f.key==="ArrowDown"||f.key==="ArrowUp"?(S[f.key==="ArrowDown"?Math.min(S.length-1,b+1):Math.max(0,b-1)]?.focus(),g()):!1}if(m!==null&&m!==document.body&&!m.classList.contains("listing-row"))return!1;const _=hR(M);if(_.length===0)return!1;const w=_.findIndex(S=>S.classList.contains("listing-cursor")),z=w>=0?w:_.findIndex(S=>S.classList.contains("listing-indicated"));if(f.key==="ArrowRight")return d(M)&&g();if(f.key==="Enter"){const S=_[z];if(S===void 0)return!1;if(S.classList.contains("listing-indicated")){const b=S.querySelector(".listing-control");b!==null?b.click():S.dispatchEvent(new MouseEvent("dblclick",{bubbles:!0,cancelable:!0}))}else S.dispatchEvent(new MouseEvent("click",{bubbles:!0,cancelable:!0}));return g()}const y=fR(z,_.length,f.key);if(y===null)return!1;for(const S of _)S.classList.remove("listing-cursor");const O=_[y];return O?.classList.add("listing-cursor"),O?.scrollIntoView({block:"nearest"}),g()},h=f=>{const M=document.querySelector(".pane-drawer:not([hidden])")!==null;if(f.key===":"&&M){e.drawers_close(),e.palette_open(),f.preventDefault(),f.stopImmediatePropagation();return}if(!(f.key==="b"&&f.ctrlKey&&!f.altKey&&!f.metaKey))return;if(f.preventDefault(),M){e.drawers_close(),e.palette_open();return}const g=document.body.dataset.zoom,m=g==="console"||g===void 0&&e.consoleFocused(),_=g!==void 0&&g!=="console"?g:t.focused_get()??"files",w=m?e.element_require("console-drawer"):i(_)?.mount?.querySelector(".pane-drawer")??null;w!==null&&(w.hidden=!w.hidden,w.hidden||w.querySelector("button")?.focus(),n.sound("audio3"))},p=f=>{if(f.key==="Escape"){a(f);return}const M=document.querySelector(".pane-drawer:not([hidden])"),g=f.target instanceof HTMLInputElement||f.target instanceof HTMLTextAreaElement||f.target instanceof HTMLElement&&f.target.isContentEditable;M!==null&&!g&&o(f,M)||M===null&&!g&&!e.palette_isOpen()&&u(f)||h(f)};return window.addEventListener("keydown",p,{capture:!0}),()=>window.removeEventListener("keydown",p,{capture:!0})}const mR=256*1024*1024;function gR(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 MR(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 zm(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 bR(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=MR(i);if(r!==null)return s.abort(),{ok:!1,reason:r};const a=gR(i.headers.get("content-disposition"),e),o=Number(i.headers.get("content-length")??NaN);if(Number.isFinite(o)&&o>mR)return s.abort(),zm(n,a),{ok:!0,name:a,bytes:o,streamed:!0};const l=await i.blob(),c=URL.createObjectURL(l);return zm(c,a),setTimeout(()=>URL.revokeObjectURL(c),6e4),{ok:!0,name:a,bytes:l.size,streamed:!1}}const rb=/\.(csv|tsv)$/i;function wm(n){return n.replace(/\x1b\[[0-9;:]*[A-Za-z]/g,"")}function ab(n){return rd.test(n)||Xo.test(n)}function uu(n){const e=/_(\d+)\/data\/?$/.exec(n);return e===null?null:parseInt(e[1]??"",10)}function Ma(n){const e=n.match(/\/(?:feeds|jobs)\/feed_(\d+)(?:\/|$)/);return e===null?null:Number(e[1])}function _R(n){return/^\/(proc|net|etc|usr)(\/|$)/.test(n)}function zR(n){for(const e of n.envelopes){const t=e.model;if(typeof t!="object"||t===null)continue;const s=t.data;if(t.kind!=="fs.acl"||!Array.isArray(s))continue;const i=[];for(const r of s)Array.isArray(r.usernames)&&i.push(...r.usernames.map(String)),Array.isArray(r.groups)&&i.push(...r.groups.map(a=>`group ${String(a)}`)),r.public===!0&&i.push("PUBLIC");return i.length===0?"SHARED WITH NOBODY":`SHARED WITH ${i.join(", ")}`}return"ACCESS UNREAD"}function wR(n,e){const{panels:t,subjects:s}=n,i=new Map,r=new Map,a=new Map,o=v=>{bR(e.downloadUrl_build(v),v).then(E=>{n.terminal.line_note(E.ok?`download: ${E.name}${E.streamed?" — large; the browser fetches it itself":""}`:`download: ${v}: ${E.reason}`)})},l=v=>n.client.line_execute(`cat "${v}"`,{silent:!0,observe:!1}).then(E=>{if(!E.envelopes.some(G=>G.status==="error"))return{ok:!0,text:wm(E.envelopes.map(G=>G.rendered).join(`
4279
4279
  `))};const I=E.envelopes.flatMap(G=>(G.errors??[]).map(C=>C.message)).concat(E.envelopes.map(G=>G.renderedErr??"")).map(G=>wm(G).trim()).filter(G=>G!=="").join(`
4280
- `);return{ok:!1,text:I===""?"the session refused this read and said nothing further":I}}),c=async(v,E)=>{const A=await fetch(e.vfsUrl_build(v));if(!A.ok||A.body===null)return(await l(v)).text.slice(0,E);const I=A.body.getReader(),G=new TextDecoder;let C="";for(;C.length<E;){const{done:B,value:P}=await I.read();if(B)break;C+=G.decode(P,{stream:!0})}return I.cancel().catch(()=>{}),C.slice(0,E)},d=async v=>{const E=/_id(\d+)$/.exec(v)?.[1]??v.replace(/^.*\//,""),A=await n.client.line_execute(`pipeline diagram ${E}`,{silent:!0,observe:!1});for(const I of A.envelopes){if(I.model?.kind!==Kn.pipelineDiagram)continue;const G=mu.safeParse(I.model.data);if(G.success)return G.data.nodes.map(C=>({id:C.id,parentIds:[...C.parentIds,...C.joinParentIds??[]]}))}return null},u={imageUrl:e.vfsUrl_build,download:o,textHead:c,pipelineGlimpse:d},h=(v,E,A)=>{const I=A==="~"?"ls ~":`ls "${A}"`;n.client.line_execute(I,{silent:!0,observe:!1}).then(G=>{for(const C of G.envelopes)E.envelope_observe(C)})},p=(v,E,A)=>{const I=E.path_current();I!==null&&i.get(v)?.push(I),h(v,E,A)},f=(v,E)=>{const A=i.get(v)?.pop();A!==void 0&&h(v,E,A)},M=v=>{a.get(v)?.()},g=(v,E)=>{r.set(v,E),M(v);const A=t.get("files",v);A?.follow_set(E),E&&A!==void 0&&n.client.line_execute("ls",{silent:!0,observe:!1}).then(I=>{for(const G of I.envelopes)A.envelope_observe(G)})},m=(v,E)=>{const A=t.get("files",v);A!==void 0&&(r.get(v)===!0?n.terminal.line_run("ls"):h(v,A,E))},_=(v,E)=>{e.ask_onPane(v,{message:`New directory in ${E}: `,kind:"text",commit:"MAKE IT"}).then(A=>{const I=(A??"").trim();I!==""&&(n.terminal.line_run(`mkdir "${E}/${I}"`),m(v,E))})},w=async(v,E,A)=>{for(const I of A){const G=`${E}/${I.name}`;n.terminal.line_note(`putting ${I.name} in ${E}…`);try{const C=await fetch(e.vfsUrl_build(G),{method:"POST",body:I});if(!C.ok){n.terminal.line_note(`upload: ${I.name}: ${(await C.text()).trim()||C.statusText}`);continue}n.terminal.line_note(`✓ ${G}`)}catch(C){n.terminal.line_note(`upload: ${I.name}: ${C instanceof Error?C.message:String(C)}`)}}m(v,E)},z=(v,E,A)=>{if(A.kind==="dir"){r.get(v)===!0?n.terminal.line_run(`cd "${A.path}"`):p(v,E,A.path);return}if(A.kind==="plugin"||A.kind==="pipeline"){e.binEntry_show(v,E,A.path,A.kind);return}if(ab(A.path)){e.image_open(v,A.path).then(I=>n.terminal.line_note(I));return}if(s.regard_write(v,{address:A.path,modelKind:"fs.file"}),!s.groupHasViewer(v)){if(bl(A.path)){E.contentImage_show(A.path,e.vfsUrl_build(A.path));return}l(A.path).then(I=>{if(!I.ok){E.contentRefused_show(A.path,I.text);return}rb.test(A.path)?E.contentTable_show(A.path,I.text):E.content_show(A.path,I.text)})}},y=()=>{const v=e.template_stamp("tpl-pane-files").querySelector(".files-body");if(v===null)throw new Error("tpl-pane-files has no files-body");return v},O=(v,E,A)=>{const I=`"${A}"`,G=E.type==="dir"||E.type==="vfs"||E.type==="job",C=Ma(A),B={kind:E.type==="plugin"||E.type==="pipeline"?"catalogue":G&&Ll(A,E.name)?"seriesFolder":E.type==="file"?"file":"directory",feed:C,node:C===null?null:uu(A),bound:e.catalogue_of(v)!==void 0,projection:_R(A),editable:E.type==="file"&&vb(A)},P={image:()=>{e.image_open(v,A).then(L=>n.terminal.line_note(L))},download:()=>o(A),process:()=>e.process_open(v,{input:A,feed:C,node:C===null?null:uu(A)}),gather:()=>e.cohort_gather([{kind:G?"dir":"file",seriesUID:A,description:E.name,imagery:Ll(A,E.name),modality:Ll(A,E.name)?"MR":"—",patient:e.promptUser()??"",vfsPath:A,folderPath:A}]),run:()=>e.run_press(v,E.name,E.type==="pipeline"?"pipeline":"plugin"),edit:()=>{const L=sb(A),H=SG(E.name,E.size,yb);if(H===null){e.verbLine_run(v,L);return}e.ask_onPane(v,{kind:"confirm",message:H}).then(X=>{X==="y"&&e.verbLine_run(v,L)})},move:()=>e.verbLine_run(v,`mv ${I}`),copy:()=>e.verbLine_run(v,`cp ${I}`),delete:()=>e.verbLine_run(v,`rm ${G?"-ri":"-i"} ${I}`),share:()=>e.verbLine_run(v,`setfacl ${I}`)};return UM.rules.filter(L=>L.offered(B)).map(L=>({label:L.label(B),run:()=>P[L.name]?.()}))},S=(v,E)=>{const A=E.map(([P])=>P),I=A.map(P=>`"${P}"`).join(" "),G=[];for(const P of A){const L=Ma(P);L!==null&&!G.includes(L)&&G.push(L)}const C={count:A.length,feeds:G},B={delete:()=>e.verbLine_run(v,`rm -rI ${I}`),move:()=>n.terminal.line_run(`mv -t ${I}`),copy:()=>n.terminal.line_run(`cp -t ${I}`),share:()=>n.terminal.line_run(`setfacl ${G.map(P=>`feed_${P}`).join(" ")}`)};return FM.rules.filter(P=>P.offered(C)).map(P=>({label:P.label(C),run:()=>B[P.name]?.()}))};return{previewProvider:u,fileText_fetch:l,file_save:o,rootedListing_show:h,listing_refresh:m,directory_make:_,files_deliver:w,follows:v=>r.get(v)===!0,follow_set:g,cwdBind_sync_register:(v,E)=>{a.set(v,E)},cwdBind_sync:M,rooted_walk:p,rooted_back:f,filesBody_stamp:y,rowVerbs_of:O,instance_build:(v,E,A=!1)=>{const I=e.template_stamp("tpl-pane-files"),G=new Sg(e.pane_find(I,".files-panel"),B=>z(v,G,B),u,{catalogue:A});G.selectionVerbs_declare(B=>S(v,B)),G.rowVerbs_declare((B,P)=>O(v,B,P),(B,P)=>{s.regard_write(v,{address:P,modelKind:"fs.file"}),Ma(P)!==null&&n.client.line_execute(`getfacl "${P}"`,{silent:!0,observe:!1}).then(L=>{G.rowReadout_show(P,zR(L))}).catch(()=>{G.rowReadout_show(P,"ACCESS UNREAD")})}),t.set("files",v,G);const C=e.promptUser();return C!==null&&C!==""&&G.home_set(`/home/${C}`),i.set(v,[]),r.set(v,E),M(v),G.follow_set(E),{id:v,kind:"files",mount:I,dispose:()=>{t.delete(v),i.delete(v),s.pane_leave(v)}}}}}function yR(n,e){const{layout:t,panels:s,subjects:i}=n,r=(l,c,d)=>{d.addEventListener("click",M=>{M.target instanceof Element&&M.target.closest("button")!==null||(c.hidden=!c.hidden,c.hidden||c.querySelector("button")?.focus(),n.sound("audio3"))});const u=c.querySelector(".drawer-zoom");u!==null&&(u.dataset.pane=l),d.addEventListener("dblclick",M=>{M.target instanceof Element&&M.target.closest("button")!==null||(window.getSelection()?.removeAllRanges(),u?.click())});for(const M of c.querySelectorAll(".drawer-bind"))M.addEventListener("click",()=>{for(const g of c.querySelectorAll(".drawer-bind"))g.classList.remove("drawer-bind-selected");M.classList.add("drawer-bind-selected"),n.sound("audio3")});const h=[...c.querySelectorAll("[data-split]")],p=M=>av(M.dataset.split,M.dataset.place)??"right",f=M=>{c.dataset.mode=M;for(const g of c.querySelectorAll(".drawer-mode"))g.classList.toggle("drawer-mode-selected",g.dataset.mode===M);for(const g of h){const m=p(g);g.disabled=M==="move"&&!t.move_possible(l,m);const _=Ts(m);g.title=M==="move"?`this pane moves ${m}${e.verbs.chordKeys_of(_,!0)}`:`new pane opens ${m}${e.verbs.chordKeys_of(_,!1)}`}};for(const M of c.querySelectorAll(".drawer-mode"))M.addEventListener("click",()=>{const g=M.dataset.mode==="move"?"move":"split";f(g==="move"&&c.dataset.mode==="move"?"split":g),n.sound("audio3")});for(const M of h)M.addEventListener("click",()=>{if(c.dataset.mode==="move"){e.verbs.move(l,p(M)),f("split"),c.hidden=!0;return}const g=M.dataset.split==="row"?"row":"col",m=M.dataset.place==="before",_=c.querySelector(".drawer-bind-selected")?.dataset.bind??"unlinked",w=_==="viewer"?"view":_==="fs"?"fs":"empty";e.pillPane_spawn(l,w,g,m)!==null&&(c.hidden=!0,n.sound("audio3"))});for(const M of new Set(Ci.filter(g=>g.selector!==null&&g.move!==!0).map(g=>g.selector??""))){const g=c.querySelector(M);g!==null&&!g.title.includes("[keys ")&&(g.title=`${g.title}${e.verbs.chordKeys_of(M,!1)}`)}c.querySelector(".drawer-close")?.addEventListener("click",()=>{if(l==="dag"){e.dag_dismiss(),e.home_apply();return}t.leaf_close(l)||e.home_apply(),e.orphans_dispose(),n.sound("audio3")})},a=(l,c,d)=>{const{browser:u}=e,h=c.querySelector(".drawer-binding");if(h!==null){const g=document.createElement("span");g.className="drawer-label drawer-label-cwd",g.textContent="CWD",h.appendChild(g);const m=(_,w,z)=>{const y=document.createElement("button");y.className="pacs-capsule drawer-cwdbind",y.dataset.follow=w?"on":"off",y.textContent=_,y.title=z,y.addEventListener("click",()=>{u.follows(l)!==w&&u.follow_set(l,w),n.sound("audio3")}),h.appendChild(y)};m("FOLLOW CWD",!0,"bind this browser to the session cwd (the console's browser)"),m("ROOT HERE",!1,"unbind from the cwd: this browser keeps its own place"),u.cwdBind_sync_register(l,()=>{const _=u.follows(l);for(const w of h.querySelectorAll(".drawer-cwdbind"))w.classList.toggle("drawer-bind-selected",w.dataset.follow==="on"===_)}),u.cwdBind_sync(l)}const p=()=>s.get("files",l);d.querySelector(".files-home")?.addEventListener("click",()=>{if(u.follows(l)){n.terminal.line_run("cd ~");return}const g=p();g!==void 0&&u.rooted_walk(l,g,"~")}),d.querySelector(".files-back")?.addEventListener("click",()=>{if(u.follows(l)){n.terminal.line_run("cd -");return}const g=p();g!==void 0&&u.rooted_back(l,g)});const f=()=>p()?.path_current()??null;d.querySelector(".files-mkdir")?.addEventListener("click",()=>{const g=f();g!==null&&u.directory_make(l,g)}),d.querySelector(".files-refresh")?.addEventListener("click",()=>{const g=f();g!==null&&u.listing_refresh(l,g)});const M=d.querySelector(".files-upload-input");d.querySelector(".files-upload")?.addEventListener("click",()=>{f()!==null&&M?.click()}),M?.addEventListener("change",()=>{const g=f(),m=M.files;g===null||m===null||m.length===0||(u.files_deliver(l,g,Array.from(m)),M.value="")})},o=(l,c)=>{const d=u=>u.modelKind==="fs.file"?u.address.replace(/\/[^/]*$/,"")||"/":u.address;c("ENTER NODE","move the session into the indicated node (its data directory)",()=>{const u=i.regard_get(l),h=s.get("dag",l)?.feed_get()??null,p=u===null?h===null?null:`/proc/jobs/feed_${h}`:d(u);p!==null&&n.terminal.line_run(`cd "${p}"`)}),c("PROCESS NODE","run an executable on the indicated node's output (a catalogue opens beside)",()=>{const u=i.regard_get(l),h=s.get("dag",l)?.feed_get()??null;if(u===null||h===null)return;const p=d(u),f=uu(p)??(/_(\d+)\/?$/.exec(p)===null?null:parseInt(/_(\d+)\/?$/.exec(p)?.[1]??"",10));f!==null&&e.process_open(l,{input:p.replace(/\/data\/?$/,"")+"/data",feed:h,node:f})}),c("ENTER FEED","move the session into the feed on stage (or the one picked in the roster)",()=>{const u=s.get("dag",l)?.feed_get()??null;u!==null&&n.terminal.line_run(`cd "/proc/jobs/feed_${u}"`)}),c("BACK","return to the previous listing inside the node",()=>e.overlay_back(l)),c("CLEAR DETAIL","dismiss the node facts (a click on empty space does too)",()=>{s.get("dag",l)?.detail_clear()}),c("REFRESH","revisit the feed now (a watch keeps sampling it while it runs)",()=>{s.get("dag",l)?.refresh()})};return(l,c,d)=>{const u=d.querySelector(".pane-drawer"),h=d.querySelector(".pane-handle");if(u===null||h===null)return;r(l,u,h);const p=u.querySelector(".drawer-children");if(p===null)return;const f=(M,g,m)=>{const _=document.createElement("button");_.className="pacs-capsule drawer-child",_.textContent=M,_.title=g,_.addEventListener("click",()=>{m(),u.hidden=!0,n.sound("audio3")}),p.appendChild(_)};(c==="files"||c==="catalogue")&&a(l,u,d),c==="dag"&&o(l,f)}}function vR(n,e){const{layout:t,panels:s,paneInstance_get:i,subjects:r}=n,a=u=>i(u)?.kind??null,o=(u,h)=>{const p=new Set(t.panes_shown()),f=r.group_of(h),M=s.entries(u).filter(([g])=>p.has(g));return s.get(u,h)??M.find(([g])=>r.group_of(g)===f)?.[1]??(M.length===1?M[0]?.[1]:void 0)},l=async(u,h,p)=>{if(h==="state"){const f=u.state_get();if(f===null)return"image state: no image on the field";const M=(f.viewports??[]).map(g=>`${g.id.replace(/^.*-/,"")} scale=${g.scale.toFixed(3)} focus=${g.focus.map(m=>m.toFixed(2)).join(",")} voi=${g.voi===null?"-":`${g.voi.lower.toFixed(1)}..${g.voi.upper.toFixed(1)}`}`).join(" | ");return`image: layout=${f.layout} tool=${f.tool} primary=${f.primaryTool??"-"} slice=${f.slice}/${f.slices} refused=${f.refused} annotations=${f.annotations} filled=${f.filled}
4280
+ `);return{ok:!1,text:I===""?"the session refused this read and said nothing further":I}}),c=async(v,E)=>{const A=await fetch(e.vfsUrl_build(v));if(!A.ok||A.body===null)return(await l(v)).text.slice(0,E);const I=A.body.getReader(),G=new TextDecoder;let C="";for(;C.length<E;){const{done:B,value:P}=await I.read();if(B)break;C+=G.decode(P,{stream:!0})}return I.cancel().catch(()=>{}),C.slice(0,E)},d=async v=>{const E=/_id(\d+)$/.exec(v)?.[1]??v.replace(/^.*\//,""),A=await n.client.line_execute(`pipeline diagram ${E}`,{silent:!0,observe:!1});for(const I of A.envelopes){if(I.model?.kind!==Kn.pipelineDiagram)continue;const G=mu.safeParse(I.model.data);if(G.success)return G.data.nodes.map(C=>({id:C.id,parentIds:[...C.parentIds,...C.joinParentIds??[]]}))}return null},u={imageUrl:e.vfsUrl_build,download:o,textHead:c,pipelineGlimpse:d},h=(v,E,A)=>{const I=A==="~"?"ls ~":`ls "${A}"`;n.client.line_execute(I,{silent:!0,observe:!1}).then(G=>{for(const C of G.envelopes)E.envelope_observe(C)})},p=(v,E,A)=>{const I=E.path_current();I!==null&&i.get(v)?.push(I),h(v,E,A)},f=(v,E)=>{const A=i.get(v)?.pop();A!==void 0&&h(v,E,A)},M=v=>{a.get(v)?.()},g=(v,E)=>{r.set(v,E),M(v);const A=t.get("files",v);A?.follow_set(E),E&&A!==void 0&&n.client.line_execute("ls",{silent:!0,observe:!1}).then(I=>{for(const G of I.envelopes)A.envelope_observe(G)})},m=(v,E)=>{const A=t.get("files",v);A!==void 0&&(r.get(v)===!0?n.terminal.line_run("ls"):h(v,A,E))},_=(v,E)=>{e.ask_onPane(v,{message:`New directory in ${E}: `,kind:"text",commit:"MAKE IT"}).then(A=>{const I=(A??"").trim();I!==""&&(n.terminal.line_run(`mkdir "${E}/${I}"`),m(v,E))})},w=async(v,E,A)=>{for(const I of A){const G=`${E}/${I.name}`;n.terminal.line_note(`putting ${I.name} in ${E}…`);try{const C=await fetch(e.vfsUrl_build(G),{method:"POST",body:I});if(!C.ok){n.terminal.line_note(`upload: ${I.name}: ${(await C.text()).trim()||C.statusText}`);continue}n.terminal.line_note(`✓ ${G}`)}catch(C){n.terminal.line_note(`upload: ${I.name}: ${C instanceof Error?C.message:String(C)}`)}}m(v,E)},z=(v,E,A)=>{if(A.kind==="dir"){r.get(v)===!0?n.terminal.line_run(`cd "${A.path}"`):p(v,E,A.path);return}if(A.kind==="plugin"||A.kind==="pipeline"){e.binEntry_show(v,E,A.path,A.kind);return}if(ab(A.path)){e.image_open(v,A.path).then(I=>n.terminal.line_note(I));return}if(s.regard_write(v,{address:A.path,modelKind:"fs.file"}),!s.groupHasViewer(v)){if(bl(A.path)){E.contentImage_show(A.path,e.vfsUrl_build(A.path));return}l(A.path).then(I=>{if(!I.ok){E.contentRefused_show(A.path,I.text);return}rb.test(A.path)?E.contentTable_show(A.path,I.text):E.content_show(A.path,I.text)})}},y=()=>{const v=e.template_stamp("tpl-pane-files").querySelector(".files-body");if(v===null)throw new Error("tpl-pane-files has no files-body");return v},O=(v,E,A)=>{const I=`"${A}"`,G=E.type==="dir"||E.type==="vfs"||E.type==="job",C=Ma(A),B={kind:E.type==="plugin"||E.type==="pipeline"?"catalogue":G&&Ll(A,E.name)?"seriesFolder":E.type==="file"?"file":"directory",feed:C,node:C===null?null:uu(A),bound:e.catalogue_of(v)!==void 0,projection:_R(A),editable:E.type==="file"&&Kb(A)},P={image:()=>{e.image_open(v,A).then(W=>n.terminal.line_note(W))},download:()=>o(A),process:()=>e.process_open(v,{input:A,feed:C,node:C===null?null:uu(A)}),gather:()=>e.cohort_gather([{kind:G?"dir":"file",seriesUID:A,description:E.name,imagery:Ll(A,E.name),modality:Ll(A,E.name)?"MR":"—",patient:e.promptUser()??"",vfsPath:A,folderPath:A}]),run:()=>e.run_press(v,E.name,E.type==="pipeline"?"pipeline":"plugin"),edit:()=>{const W=sb(A),H=SG(E.name,E.size,Xb);if(H===null){e.verbLine_run(v,W);return}e.ask_onPane(v,{kind:"confirm",message:H}).then(X=>{X==="y"&&e.verbLine_run(v,W)})},move:()=>e.verbLine_run(v,`mv ${I}`),copy:()=>e.verbLine_run(v,`cp ${I}`),delete:()=>e.verbLine_run(v,`rm ${G?"-ri":"-i"} ${I}`),share:()=>e.verbLine_run(v,`setfacl ${I}`)};return UM.rules.filter(W=>W.offered(B)).map(W=>({label:W.label(B),run:()=>P[W.name]?.()}))},S=(v,E)=>{const A=E.map(([P])=>P),I=A.map(P=>`"${P}"`).join(" "),G=[];for(const P of A){const W=Ma(P);W!==null&&!G.includes(W)&&G.push(W)}const C={count:A.length,feeds:G},B={delete:()=>e.verbLine_run(v,`rm -rI ${I}`),move:()=>n.terminal.line_run(`mv -t ${I}`),copy:()=>n.terminal.line_run(`cp -t ${I}`),share:()=>n.terminal.line_run(`setfacl ${G.map(P=>`feed_${P}`).join(" ")}`)};return FM.rules.filter(P=>P.offered(C)).map(P=>({label:P.label(C),run:()=>B[P.name]?.()}))};return{previewProvider:u,fileText_fetch:l,file_save:o,rootedListing_show:h,listing_refresh:m,directory_make:_,files_deliver:w,follows:v=>r.get(v)===!0,follow_set:g,cwdBind_sync_register:(v,E)=>{a.set(v,E)},cwdBind_sync:M,rooted_walk:p,rooted_back:f,filesBody_stamp:y,rowVerbs_of:O,instance_build:(v,E,A=!1)=>{const I=e.template_stamp("tpl-pane-files"),G=new Sg(e.pane_find(I,".files-panel"),B=>z(v,G,B),u,{catalogue:A});G.selectionVerbs_declare(B=>S(v,B)),G.rowVerbs_declare((B,P)=>O(v,B,P),(B,P)=>{s.regard_write(v,{address:P,modelKind:"fs.file"}),Ma(P)!==null&&n.client.line_execute(`getfacl "${P}"`,{silent:!0,observe:!1}).then(W=>{G.rowReadout_show(P,zR(W))}).catch(()=>{G.rowReadout_show(P,"ACCESS UNREAD")})}),t.set("files",v,G);const C=e.promptUser();return C!==null&&C!==""&&G.home_set(`/home/${C}`),i.set(v,[]),r.set(v,E),M(v),G.follow_set(E),{id:v,kind:"files",mount:I,dispose:()=>{t.delete(v),i.delete(v),s.pane_leave(v)}}}}}function yR(n,e){const{layout:t,panels:s,subjects:i}=n,r=(l,c,d)=>{d.addEventListener("click",M=>{M.target instanceof Element&&M.target.closest("button")!==null||(c.hidden=!c.hidden,c.hidden||c.querySelector("button")?.focus(),n.sound("audio3"))});const u=c.querySelector(".drawer-zoom");u!==null&&(u.dataset.pane=l),d.addEventListener("dblclick",M=>{M.target instanceof Element&&M.target.closest("button")!==null||(window.getSelection()?.removeAllRanges(),u?.click())});for(const M of c.querySelectorAll(".drawer-bind"))M.addEventListener("click",()=>{for(const g of c.querySelectorAll(".drawer-bind"))g.classList.remove("drawer-bind-selected");M.classList.add("drawer-bind-selected"),n.sound("audio3")});const h=[...c.querySelectorAll("[data-split]")],p=M=>av(M.dataset.split,M.dataset.place)??"right",f=M=>{c.dataset.mode=M;for(const g of c.querySelectorAll(".drawer-mode"))g.classList.toggle("drawer-mode-selected",g.dataset.mode===M);for(const g of h){const m=p(g);g.disabled=M==="move"&&!t.move_possible(l,m);const _=Ts(m);g.title=M==="move"?`this pane moves ${m}${e.verbs.chordKeys_of(_,!0)}`:`new pane opens ${m}${e.verbs.chordKeys_of(_,!1)}`}};for(const M of c.querySelectorAll(".drawer-mode"))M.addEventListener("click",()=>{const g=M.dataset.mode==="move"?"move":"split";f(g==="move"&&c.dataset.mode==="move"?"split":g),n.sound("audio3")});for(const M of h)M.addEventListener("click",()=>{if(c.dataset.mode==="move"){e.verbs.move(l,p(M)),f("split"),c.hidden=!0;return}const g=M.dataset.split==="row"?"row":"col",m=M.dataset.place==="before",_=c.querySelector(".drawer-bind-selected")?.dataset.bind??"unlinked",w=_==="viewer"?"view":_==="fs"?"fs":"empty";e.pillPane_spawn(l,w,g,m)!==null&&(c.hidden=!0,n.sound("audio3"))});for(const M of new Set(Ci.filter(g=>g.selector!==null&&g.move!==!0).map(g=>g.selector??""))){const g=c.querySelector(M);g!==null&&!g.title.includes("[keys ")&&(g.title=`${g.title}${e.verbs.chordKeys_of(M,!1)}`)}c.querySelector(".drawer-close")?.addEventListener("click",()=>{if(l==="dag"){e.dag_dismiss(),e.home_apply();return}t.leaf_close(l)||e.home_apply(),e.orphans_dispose(),n.sound("audio3")})},a=(l,c,d)=>{const{browser:u}=e,h=c.querySelector(".drawer-binding");if(h!==null){const g=document.createElement("span");g.className="drawer-label drawer-label-cwd",g.textContent="CWD",h.appendChild(g);const m=(_,w,z)=>{const y=document.createElement("button");y.className="pacs-capsule drawer-cwdbind",y.dataset.follow=w?"on":"off",y.textContent=_,y.title=z,y.addEventListener("click",()=>{u.follows(l)!==w&&u.follow_set(l,w),n.sound("audio3")}),h.appendChild(y)};m("FOLLOW CWD",!0,"bind this browser to the session cwd (the console's browser)"),m("ROOT HERE",!1,"unbind from the cwd: this browser keeps its own place"),u.cwdBind_sync_register(l,()=>{const _=u.follows(l);for(const w of h.querySelectorAll(".drawer-cwdbind"))w.classList.toggle("drawer-bind-selected",w.dataset.follow==="on"===_)}),u.cwdBind_sync(l)}const p=()=>s.get("files",l);d.querySelector(".files-home")?.addEventListener("click",()=>{if(u.follows(l)){n.terminal.line_run("cd ~");return}const g=p();g!==void 0&&u.rooted_walk(l,g,"~")}),d.querySelector(".files-back")?.addEventListener("click",()=>{if(u.follows(l)){n.terminal.line_run("cd -");return}const g=p();g!==void 0&&u.rooted_back(l,g)});const f=()=>p()?.path_current()??null;d.querySelector(".files-mkdir")?.addEventListener("click",()=>{const g=f();g!==null&&u.directory_make(l,g)}),d.querySelector(".files-refresh")?.addEventListener("click",()=>{const g=f();g!==null&&u.listing_refresh(l,g)});const M=d.querySelector(".files-upload-input");d.querySelector(".files-upload")?.addEventListener("click",()=>{f()!==null&&M?.click()}),M?.addEventListener("change",()=>{const g=f(),m=M.files;g===null||m===null||m.length===0||(u.files_deliver(l,g,Array.from(m)),M.value="")})},o=(l,c)=>{const d=u=>u.modelKind==="fs.file"?u.address.replace(/\/[^/]*$/,"")||"/":u.address;c("ENTER NODE","move the session into the indicated node (its data directory)",()=>{const u=i.regard_get(l),h=s.get("dag",l)?.feed_get()??null,p=u===null?h===null?null:`/proc/jobs/feed_${h}`:d(u);p!==null&&n.terminal.line_run(`cd "${p}"`)}),c("PROCESS NODE","run an executable on the indicated node's output (a catalogue opens beside)",()=>{const u=i.regard_get(l),h=s.get("dag",l)?.feed_get()??null;if(u===null||h===null)return;const p=d(u),f=uu(p)??(/_(\d+)\/?$/.exec(p)===null?null:parseInt(/_(\d+)\/?$/.exec(p)?.[1]??"",10));f!==null&&e.process_open(l,{input:p.replace(/\/data\/?$/,"")+"/data",feed:h,node:f})}),c("ENTER FEED","move the session into the feed on stage (or the one picked in the roster)",()=>{const u=s.get("dag",l)?.feed_get()??null;u!==null&&n.terminal.line_run(`cd "/proc/jobs/feed_${u}"`)}),c("BACK","return to the previous listing inside the node",()=>e.overlay_back(l)),c("CLEAR DETAIL","dismiss the node facts (a click on empty space does too)",()=>{s.get("dag",l)?.detail_clear()}),c("REFRESH","revisit the feed now (a watch keeps sampling it while it runs)",()=>{s.get("dag",l)?.refresh()})};return(l,c,d)=>{const u=d.querySelector(".pane-drawer"),h=d.querySelector(".pane-handle");if(u===null||h===null)return;r(l,u,h);const p=u.querySelector(".drawer-children");if(p===null)return;const f=(M,g,m)=>{const _=document.createElement("button");_.className="pacs-capsule drawer-child",_.textContent=M,_.title=g,_.addEventListener("click",()=>{m(),u.hidden=!0,n.sound("audio3")}),p.appendChild(_)};(c==="files"||c==="catalogue")&&a(l,u,d),c==="dag"&&o(l,f)}}function vR(n,e){const{layout:t,panels:s,paneInstance_get:i,subjects:r}=n,a=u=>i(u)?.kind??null,o=(u,h)=>{const p=new Set(t.panes_shown()),f=r.group_of(h),M=s.entries(u).filter(([g])=>p.has(g));return s.get(u,h)??M.find(([g])=>r.group_of(g)===f)?.[1]??(M.length===1?M[0]?.[1]:void 0)},l=async(u,h,p)=>{if(h==="state"){const f=u.state_get();if(f===null)return"image state: no image on the field";const M=(f.viewports??[]).map(g=>`${g.id.replace(/^.*-/,"")} scale=${g.scale.toFixed(3)} focus=${g.focus.map(m=>m.toFixed(2)).join(",")} voi=${g.voi===null?"-":`${g.voi.lower.toFixed(1)}..${g.voi.upper.toFixed(1)}`}`).join(" | ");return`image: layout=${f.layout} tool=${f.tool} primary=${f.primaryTool??"-"} slice=${f.slice}/${f.slices} refused=${f.refused} annotations=${f.annotations} filled=${f.filled}
4281
4281
  viewports: ${M||"(none)"}`}if(h==="layout"){const f=p[0]??"";return Fz.includes(f)?await u.layout_set(f)?`image layout ${f}`:u.state_get()?.waiting===f?`image layout ${f}: waiting for LOAD`:`image layout ${f}: not offered`:"image layout single|mpr|3d|slab"}if(h==="slice"){const f=Number(p[0]);return!Number.isInteger(f)||f<1?"image slice <n>":u.slice_set(f)?`image slice ${f}`:`image slice ${f}: not offered`}if(h==="series"){const f=Number(p[0]),M=u.siblings_get();if(M.length===0)return"image series: this pane holds one series, not a study";const g=M[f-1];if(g===void 0)return`image series <1..${M.length}>: ${M.map((_,w)=>`${w+1} ${_.label}`).join(" · ")}`;const m=await e.series_ask(g.path);return m===null?`image series ${f}: ${g.path}: not a readable DICOM series`:(u.series_show(m,{siblings:[...M]}),`image series ${f} ${g.label}`)}if(h==="wl"){if((p[0]??"").toLowerCase()==="preset"){const g=p[1]??"";return g===""?"image wl preset <brain|bone|lung|soft|liver>":u.wlPreset_set(g)?`image wl preset ${g}`:`image wl preset ${g}: none for this modality`}const f=Number(p[0]),M=Number(p[1]);return!Number.isFinite(f)||!Number.isFinite(M)||f>=M?"image wl <lower> <upper> | image wl preset <name>":u.wl_set(f,M)?`image wl ${f} ${M}`:"image wl: not offered"}if(h==="colormap"){const f=(p[0]??"").toLowerCase();return yo.includes(f)?u.colormap_set(f)?`image colormap ${f}`:`image colormap ${f}: not offered`:"image colormap gray|hot|jet|cool"}if(h==="save")return await u.annotations_save()?"image save":"image save: nothing saved (the console says why)";if(h==="load")return await u.load_press()?"image load":"image load: nothing was waiting";if(h==="guard"){if((p[0]??"").toLowerCase()==="off")return u.guard_set(null),"image guard off";const M=Number(p[0]);return!Number.isFinite(M)||M<0?`image guard <bytes>|off (now ${u.guard_get()===null?"off":u.guard_get()})`:(u.guard_set(M),`image guard ${M}`)}if(h==="ghost"){const M=(p[0]??"").toLowerCase()==="off"?null:Number(p[0]);return M!==null&&(!Number.isFinite(M)||M<0||M>1)?"image ghost <0..1>|off (SLAB layout)":u.ghost_set(M)?`image ghost ${M===null?"off":M}`:"image ghost: SLAB layout only"}if(h==="tags"){const f=s.idOf("image",u);return f===null?"image tags: no image pane":e.tagsPane_open(f)}return"image <path> · layout single|mpr|3d · slice <n> · series <n> · wl <lo> <hi> | wl preset <name> · colormap <name> · save"},c=(u,h,p)=>{if(h==="redact"){const f=(p[0]??"").toLowerCase();return f!=="on"&&f!=="off"?"tags redact on|off":(u.redact_set(f==="on"),`tags redact ${f}`)}if(h==="filter"){const f=p.join(" ");return f===""||f.toLowerCase()==="off"?(u.filter_set(null),"tags filter off"):(u.filter_set(f),`tags filter ${f}`)}return"tags redact on|off · filter <text>|off"},d=()=>{const u=t.tree_get();if(u===null)return"# empty desktop";const h=[],p=y=>"pane"in y?y.pane:p(y.first),f=p(u),M=a(f);h.push(`view ${M==="dag"?"runs":M==="pacs"?"pacs":"files"}`);let g=1;const m=(y,O)=>{const S=a(y);if(S==="dag"&&y!==f&&h.push(`pane %${O} claim runs`),S==="files"&&y!==f&&r.group_of(y)===y&&h.push(`pane %${O} claim files`),S==="dag"){const b=i(y)?.mount,v=b?.querySelector(".dag-strategy")?.textContent?.toLowerCase()??"ranked",E=b?.querySelector(".dag-projection")?.textContent?.toLowerCase()??"3d",A=b?.querySelector(".dag-hue")?.textContent?.toLowerCase()??"status";v!=="ranked"&&h.push(`dag %${O} layout ${v}`),E!=="3d"&&h.push(`dag %${O} projection ${E}`),A!=="status"&&h.push(`dag %${O} hue ${A}`)}},_=(y,O)=>{if("pane"in y){m(y.pane,O);return}const S=p(y.second),b=a(S),v=b==="view"?"viewer":b==="files"&&r.group_of(S)!==S?"fs":"unlinked";h.push(`pane %${O} bind ${v}`),h.push(`pane %${O} split ${y.dir==="col"?"right":"below"}`);const E=++g;_(y.first,O),_(y.second,E)};_(u,g);const w=document.body.dataset.header;return w!==void 0&&h.push(`header ${w}`),document.getElementById("drawer")?.classList.contains("drawer-closed")&&h.push("console close"),h.join(`
4282
4282
  `)};return{focused_get:()=>{const u=document.body.dataset.zoom;return u!==void 0&&u!=="console"?u:t.focused_get()??t.panes_shown()[0]??null},focus_set:u=>i(u)===void 0?!1:(t.focus_set(u),!0),panes_shown:()=>t.panes_shown(),pane_move:e.verbs.move,pane_flip:e.verbs.flip,pane_resize:e.verbs.resize,help_open:e.help_open,notes_open:e.notes_open,focus_last:()=>{const u=t.focus_last();return u!==null&&n.sound("audio3"),u===null?null:`focused ${u}`},paneRect_get:u=>document.querySelector(`.layout-leaf[data-leaf="${u}"]`)?.getBoundingClientRect()??null,paneMount_get:u=>i(u)?.mount??null,paneKind_get:a,paneLinked_get:u=>r.group_of(u)!==u,feed_enter:e.feed_enter,consoleZoom_toggle:e.consoleZoom_toggle,launcher_enter:e.launcher_enter,identity_get:e.identity_get,node_immerse:u=>{const p=r.regard_get(u)?.address.match(/_(\d+)(?:\/data)?\/?$/)??null;return p===null?!1:s.get("dag",u)?.node_flyTo(parseInt(p[1]??"",10))??!1},file_download:u=>{const h=r.regard_get(u);return h===null||h.modelKind!=="fs.file"?!1:(e.file_save(h.address),!0)},image_open:(u,h,p)=>e.image_open(u,h,p??{}),image_control:async(u,h,p)=>{const f=o("image",u);return f===void 0?`image ${h}: no image pane on stage for '${u}'`:l(f,h,p)},universe_control:(u,h,p)=>{const f=new Set(t.panes_shown()),M=(u!==null?s.get("universe",u):void 0)??s.entries("universe").find(([g])=>f.has(g))?.[1];return M===void 0?"universe: no universe pane on stage (press the dashboard tile)":M.control(h,p)},tags_control:(u,h,p)=>{const f=o("tags",u);return f===void 0?`tags ${h}: no tags pane on stage for '${u}'`:c(f,h,p)},file_delete:u=>{const h=r.regard_get(u);return h===null||h.modelKind!=="fs.file"?!1:(n.terminal.line_run(`rm "${h.address}"`),!0)},session_run:async u=>{try{return(await n.client.line_execute(u,{silent:!0,observe:!1})).envelopes.map(p=>p.renderedErr??p.rendered).join(`
4283
- `)}catch(h){return h instanceof Error?h.message:String(h)}},desktop_serialize:d}}function OR(n,e,t){if(t===!0)return"daemon-older";if(e===void 0)return null;const s=e.surface;return t===!1?s!==void 0&&n.built<s.built?"argus-older":null:s===void 0?"daemon-older":s.git===n.git&&s.built===n.built?null:n.built>=s.built?"daemon-older":"argus-older"}const ah={"daemon-older":{readout:"CALYPSO DAEMON OUT OF DATE",before:"The calypso daemon has been updated and should be restarted; some controls may not work until then. ",cure:"Restart the calypso daemon",after:"."},"argus-older":{readout:"ARGUS OUT OF DATE",before:"ARGUS is older than the calypso daemon. ",cure:"Refresh",after:" to load the new ARGUS."}};function ob(n){const e=ah[n];return`${e.before}${e.cure}${e.after}`}async function xR(n){try{const e=n??(typeof globalThis.fetch=="function"?globalThis.fetch.bind(globalThis):void 0);if(e===void 0)return null;const t=await e("notes.json",{cache:"no-store"});if(!t.ok)return null;const s=await t.json(),r=s.releases?.[0]?.changes?.find(a=>a.internal!==!0)?.headline;return typeof r!="string"||typeof s.version!="string"?null:{version:s.version,headline:r}}catch{return null}}const ym=96;function SR(n){const e=n.headline.length>ym?`${n.headline.slice(0,ym-1).trimEnd()}…`:n.headline;return`argus ${n.version} · ${e} — WHAT'S NEW after restart`}function ER(n,e,t,s,i=document.body,r){i.querySelector(".build-mismatch")?.remove();const a=t.surface!==void 0?`ARGUS ${t.surface.git} built ${t.surface.built}Z`:"an ARGUS too old to say its build";s(`argus: ${ob(n)}`);const o=t.surface!==void 0&&t.surface.git===e.git&&t.surface.built===e.built;s(o?`argus: the calypso daemon's own code on disk has changed since it started (ARGUS ${e.git} built ${e.built}Z)`:`argus: ARGUS ${e.git} built ${e.built}Z · calypso daemon started with ${a}`);const l=ah[n],c=document.createElement("div");c.className="stale-page build-mismatch",c.dataset.mismatch=n,c.setAttribute("role","alert");const d=document.createElement("span");d.className="stale-page-words";let u=document.createTextNode(l.cure);if(n==="argus-older"){const p=document.createElement("button");p.type="button",p.className="stale-page-reload",p.textContent=l.cure,p.title="reload this tab to load the new ARGUS",p.addEventListener("click",()=>{window.location.reload()}),u=p}else if(r!==void 0){const p=document.createElement("button");p.type="button",p.className="stale-page-reload build-mismatch-restart",p.textContent=l.cure,p.title="restart the calypso daemon (asks first; you stay logged in)",p.addEventListener("click",r),u=p}d.append(document.createTextNode(l.before),u,document.createTextNode(l.after));const h=document.createElement("button");h.type="button",h.className="build-mismatch-dismiss",h.textContent="×",h.title="dismiss (the status strip keeps saying it)",h.addEventListener("click",()=>{c.remove()}),c.append(d,h),i.appendChild(c),n==="daemon-older"&&xR().then(p=>{if(p===null||!c.isConnected)return;const f=document.createElement("span");f.className="build-mismatch-news",f.textContent=SR(p),d.appendChild(f)})}function AR(n,e,t,s=document.body){const i={git:"834ea59d",built:"2026-10-08 18:06"};let r=[],a,o=null;const l=d=>{r!==null?r.push(d):e(d)},c=d=>{if(a===void 0)return;const u=OR(i,a,d);if(u!==o){if(o=u,u===null){n.build_show(null),s.querySelector(".build-mismatch")?.remove();return}n.build_show(ah[u].readout,ob(u)),ER(u,i,a,l,s,ml(window.location.search)?t:void 0)}};return{attach_take:d=>{a=d.stack,c(d.stale)},stale_take:d=>c(d),release:()=>{const d=r??[];r=null;for(const u of d)e(u)}}}function DR(n=document.getElementById("door-pill")){n===null||!ml(window.location.search)||(n.hidden=!1,n.addEventListener("click",()=>{const e=Vo(window.location.pathname,"logout"),t=Vo(window.location.pathname,"login");fetch(e,{method:"POST",headers:{accept:"application/json"}}).catch(()=>{}).then(()=>{window.location.assign(t)})}))}const TR="Restart the calypso daemon? You'll stay logged in; the page reloads when the new daemon is up.";function IR(n){const e=[];n.running!==null&&e.push(`the running command: ${n.running}`);for(const r of n.unsaved)e.push(`an unsaved edit in ${r}`);const t=n.others.filter(r=>r.kind==="browser").length,s=n.others.length-t,i=[];return t>0&&i.push(t===1?"1 other browser":`${t} other browsers`),s>0&&i.push(s===1?"1 chell":`${s} chells`),i.length>0&&e.push(`${i.join(" and ")}, which will be disconnected`),e}function GR(n){return n==="restart"?"The calypso daemon is restarting (asked from another browser or surface). Following it…":n==="end"?"The calypso daemon was ended by an administrator.":"The calypso daemon stopped."}function RR(n,e){const t=document.createElement("div");t.className="stale-page restart-question",t.setAttribute("role","alertdialog");const s=document.createElement("div");s.className="stale-page-words";const i=document.createElement("div");if(i.textContent=TR,s.append(i),n.length>0){const d=document.createElement("ul");d.className="restart-cuts";const u=document.createElement("li");u.className="restart-cuts-lead",u.textContent="This will cut off:",d.append(u);for(const h of n){const p=document.createElement("li");p.textContent=h,d.append(p)}s.append(d)}const r=document.createElement("button");r.type="button",r.className="restart-yes",r.textContent="YES";const a=document.createElement("button");a.type="button",a.className="restart-no",a.textContent="NO";let o=!1;const l=d=>{o||(o=!0,t.remove(),e(d))};r.addEventListener("click",()=>l(!0)),a.addEventListener("click",()=>l(!1)),t.addEventListener("keydown",d=>{d.key!=="Enter"&&d.key!=="Escape"||(d.preventDefault(),d.stopPropagation(),l(d.key==="Enter"))});const c=document.createElement("div");return c.className="restart-answers",c.append(r,a),t.append(s,c),t}function NR(n,e=document.body){const t=ml(window.location.search);let s=null,i=null,r=[],a=!1;const o=h=>{e.querySelector(".restart-said")?.remove();const p=document.createElement("div");p.className="stale-page restart-said",p.setAttribute("role","alert"),p.textContent=h,e.appendChild(p)},l=h=>{window.location.assign(`${Vo(window.location.pathname,"greet")}/${encodeURIComponent(h)}`)},c=async()=>{a=!0,o("Restarting the calypso daemon…");try{const h=await fetch(Vo(window.location.pathname,"restart"),{method:"POST",headers:{accept:"application/json"}}),p=await h.json();if(!h.ok||p.key===void 0)throw new Error(p.error??`the door answered ${h.status}`);l(p.key)}catch(h){a=!1,o(`The calypso daemon could not be restarted: ${h instanceof Error?h.message:String(h)}`)}},d=()=>{if(!t||e.querySelector(".restart-question")!==null)return;const h={running:i,unsaved:n.unsaved(),others:r.filter(f=>f.id!==s)},p=RR(IR(h),f=>{f&&c()});e.querySelector(".build-mismatch")?.remove(),e.appendChild(p),p.querySelector(".restart-yes")?.focus()},u=document.getElementById("restart-pill");return u!==null&&t&&(u.hidden=!1,u.addEventListener("click",d)),{ask:d,attach_take:h=>{s=h.surface??null},telemetry_take:h=>{h?.lane!==void 0&&(i=h.lane.running?.line??null),h?.surfaces!==void 0&&(r=h.surfaces)},closing_take:h=>{if(a||(o(GR(h)),h!=="restart"||!t))return;const p=window.location.pathname.split("/").filter(f=>f.length>0).at(-1);p!==void 0&&setTimeout(()=>l(p),1200)}}}function BR(n,e,t,s){n.line_execute(`motd ${t}`,{silent:!0,observe:!1}).then(i=>{const r=i.envelopes.filter(a=>a.status==="ok").map(a=>a.rendered).join("").trimEnd();r.length>0&&e.greeting_write(r.split(`
4284
- `))}).catch(()=>{}).finally(s)}let Mi=()=>{};function vm(){Mi(document.body.dataset.zoom==="console"?null:"console")}const CR=iz(),PR="ARGUS",Om="argus-audio",LR=.4;let bi=!1;function Ns(n){if(bi)return;const e=document.getElementById(n);e instanceof HTMLAudioElement&&(e.currentTime=0,e.volume=LR,e.play().catch(()=>{}))}function WR(){const n=Ye("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 kR(){const n=Ye("audio-pill");try{bi=window.localStorage.getItem(Om)==="off"}catch{bi=!1}const e=()=>{n.classList.toggle("audio-off",bi)};e(),n.addEventListener("click",()=>{bi=!bi;try{window.localStorage.setItem(Om,bi?"off":"on")}catch{}e(),Ns("audio2")})}function Ye(n){const e=document.getElementById(n);if(e===null)throw new Error(`required element #${n} is missing`);return e}function ks(n){const e=Ye(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 ds(n,e){const t=n.querySelector(e);if(t===null)throw new Error(`pane template is missing ${e}`);return t}function UR(){return rz(window.location)}let Uc=null,ul=0;function oh(n,e){const t=()=>{e.dataset.zoom!==void 0||e.dataset.header==="away"||(ul=Math.ceil(n.offsetTop+n.offsetHeight),e.style.setProperty("--zoom-header-height",`${ul}px`))};t(),Uc===null&&(Uc=new ResizeObserver(t),Uc.observe(n))}const xm=120,FR=96;function jR(n,e,t,s){let i="";const r=d=>{d?(i=n.style.height,n.style.height=""):i!==""&&(n.style.height=i),n.classList.toggle("drawer-closed",d),Ns("audio3"),d||(s.size_fit(),s.focus_take())};t.addEventListener("click",()=>r(!n.classList.contains("drawer-closed")));let a=0,o=0,l=!1;e.addEventListener("pointerdown",d=>{l=!0,a=d.clientY,o=n.getBoundingClientRect().height,n.classList.add("drawer-dragging"),e.setPointerCapture(d.pointerId),d.preventDefault()}),e.addEventListener("pointermove",d=>{if(!l)return;const u=Math.max(xm,window.innerHeight-FR),h=o+(d.clientY-a),p=Math.min(Math.max(xm,h),u);n.style.height=`${p}px`,s.size_fit()});const c=()=>{l=!1,n.classList.remove("drawer-dragging")};return e.addEventListener("pointerup",c),e.addEventListener("pointercancel",c),r}function $R(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,ul>0&&e.style.setProperty("--zoom-header-height",`${ul}px`)):t!==null&&oh(t,e),e.dataset.zoom=r;const o=Go(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";Ns("audio3")};return Ye("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())}),Ye("drawer").addEventListener("transitionend",r=>{r.propertyName==="height"&&n.size_fit()}),i}function VR(){const n=new ZI(document.getElementById("data-cascade")),e=document.getElementById("header-telemetry");return e!==null&&n.telemetryPanel_bind(e),n}const Fc=96,HR=220,Sm="argus.headerBand.height",qR=52;function XR(){const n=document.documentElement,e=document.getElementById("header-strip"),t=document.querySelector(".wrap:not(#gap)");if(e===null||t===null)return;const s=d=>{const u=Math.max(Fc,window.innerHeight-HR),h=Math.min(Math.max(Fc,d),u);n.style.setProperty("--header-band-h",`${h}px`);try{window.localStorage.setItem(Sm,String(h))}catch{}},i=(()=>{try{return window.localStorage.getItem(Sm)}catch{return null}})();i!==null&&Number.isFinite(Number(i))&&s(Number(i));const r=()=>{const d=t.getBoundingClientRect();e.style.top=`${Math.max(0,d.bottom-qR)}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("pointerdown",d=>{const u=document.querySelector(".header-face");a=!0,o=d.clientY,l=u===null?Fc:u.getBoundingClientRect().height,e.setPointerCapture(d.pointerId),d.preventDefault()}),e.addEventListener("pointermove",d=>{a&&(s(l+(d.clientY-o)),r())});const c=()=>{a=!1,r()};e.addEventListener("pointerup",c),e.addEventListener("pointercancel",c)}let lh=null;function KR(n){const e=n.querySelector(".gather-rows");if(e===null)return;const t=Hs(e,{rows:".listing-row",label:s=>`+${s} MORE · ON STAGE`,press:()=>{lh?.()},className:"strategy-pill gather-more",mount:n});t.title="the whole cohort as a pane on the main panel"}function Em(n){Hs(n,{rows:".strategy-pill, .listing-action, .holder-mark",className:"frame-more"})}function YR(){const n=e=>{for(const t of e.querySelectorAll(".mode-frame:not([data-more])"))Em(t)};new MutationObserver(e=>{for(const t of e)for(const s of t.addedNodes)s instanceof HTMLElement&&(s.matches(".mode-frame")&&s.dataset.more===void 0&&Em(s),n(s))}).observe(document.body,{childList:!0,subtree:!0}),n(document)}function Am(n){const e=n?.text;if(typeof e!="string"||e.length===0||typeof window.speechSynthesis>"u")return;const t=new SpeechSynthesisUtterance(e);t.rate=1,window.speechSynthesis.speak(t)}function ZR(){const n=document.body,e=document.querySelector(".wrap:not(#gap)"),t=r=>{n.dataset.header===r?(e!==null&&oh(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(),lh?.()}),s!==null&&KR(s),YR();const i=()=>{n.dataset.zoom===void 0&&(delete n.dataset.header,Ns("audio3"))};Ye("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 Mr=[{key:"lower-decks",label:"LOWER DECKS"},{key:"gold",label:"CERRITOS GOLD"},{key:"medical",label:"MEDICAL"},{key:"nemesis",label:"NEMESIS"},{key:"pharos",label:"PHAROS"}],lb="argus-landing",QR=15e3;function Dm(){try{return(window.localStorage.getItem(lb)??"launcher")==="launcher"}catch{return!0}}function JR(n){try{window.localStorage.setItem(lb,n?"launcher":"last")}catch{}}const Tm="argus-theme",e7="argus-lcars",t7="medical",s7={sickbay:"medical"};function n7(){const n=Ye("theme-pill"),e=Math.max(Mr.findIndex(r=>r.key===t7),0);let t=e;try{const r=window.localStorage.getItem(Tm)??window.localStorage.getItem(e7),a=r===null?null:s7[r]??r,o=Mr.findIndex(l=>l.key===a);t=o>=0?o:e}catch{t=e}const s=document.documentElement,i=()=>{const r=Mr[t]??Mr[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)%Mr.length,i();try{window.localStorage.setItem(Tm,Mr[t]?.key??"lower-decks")}catch{}Ns("audio2")})}function i7(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.19.0"],["ARGUS","834ea59d · 2026-10-08 18:06Z"],["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 r7(){for(const n of document.querySelectorAll(".left-frame button, .left-frame-top button"))n.addEventListener("click",()=>Ns("audio2"))}let _r=null;async function a7(n){const e=new FI(document),t=new $I(Ye("index-instrument"),()=>Date.now(),{errored_open:()=>ci("status:error")}),s=new HI(Ye("lane-instrument"));window.setInterval(()=>s.tick(),500);const i=new rG,r=new LI;r.writeObserver_set((D,R)=>{Ve.regard_send({address:D.address,...D.modelKind!==void 0?{modelKind:D.modelKind}:{},groupId:R,paneId:D.paneId}),Z()});const a={get layout(){return $},panels:i,paneInstance_get:Go,subjects:r,get dormant(){return ie},sound:Ns,get terminal(){return ge},get client(){return Ve}},o=gG(a,{catalogue_of:D=>S.get(D),run_press:(D,R,ee)=>{We(D,R,ee)}}),l=o.entry_show,c=D=>bu(D,n),d=wR(a,{vfsUrl_build:c,downloadUrl_build:D=>az(D,n),image_open:(D,R)=>L(D,R),process_open:(D,R)=>H(D,R),run_press:(D,R,ee)=>{We(D,R,ee)},cohort_gather:D=>ae(D),verbLine_run:(D,R)=>N(D,R),ask_onPane:(D,R)=>x(D,R),binEntry_show:l,catalogue_of:D=>S.get(D),promptUser:()=>y,template_stamp:ks,pane_find:ds}),{previewProvider:u,fileText_fetch:h,file_save:p,rootedListing_show:f,listing_refresh:M,directory_make:g,files_deliver:m,filesBody_stamp:_,rowVerbs_of:w}=d,z=d.instance_build;let y=null,O=null;const S=new Map,b=D=>{const R=ks("tpl-pane-universe"),ee=new aI({canvas:ds(R,".universe-canvas"),title:ds(R,".universe-title"),state:R.querySelector(".pane-state"),empty:ds(R,".universe-empty"),projectionPill:R.querySelector(".universe-projection"),refreshPill:R.querySelector(".universe-refresh"),replayPill:R.querySelector(".universe-replay"),scalePill:R.querySelector(".universe-scale"),viewPill:R.querySelector(".universe-view"),gravityPill:R.querySelector(".universe-gravity"),densityPill:R.querySelector(".universe-density"),drawPill:R.querySelector(".universe-draw"),captionsPill:R.querySelector(".universe-captions"),arrangementPill:R.querySelector(".universe-arrangement"),facts:R.querySelector(".universe-facts"),backPill:R.querySelector(".universe-back"),openPill:R.querySelector(".universe-open"),frame:R.querySelector(".mode-frame")},{watch_set:(q,se)=>{se?Ve.watch_send(q):Ve.unwatch_send(q)},...(({feed_entered:q,feed_note:se,feed_tag:be,feed_rename:xe,feed_untag:Ke})=>({feed_entered:q,feed_note:se,feed_tag:be,feed_rename:xe,feed_untag:Ke}))(pm(a,D,ot)),command_run:q=>{Ve.line_execute(q,{silent:!0,observe:!1}).then(se=>{for(const be of se.envelopes)ee.envelope_observe(be)})},feed_dag:async q=>{const se=await Ve.line_execute(`feed diagram feed_${q}`,{silent:!0,observe:!1});for(const be of se.envelopes){if(be.model?.kind!==Kn.feedDag)continue;const xe=Zc.safeParse(be.model.data);if(xe.success)return xe.data}return null},node_enter:q=>{ge.line_run(`cd "${q}"`)},node_dive:q=>{Fe(D,q.replace(/\/data$/,""))},node_process:q=>{const se=Ma(q.vfsPath)??(/\/feed_(\d+)(?:\/|$)/.exec(q.vfsPath)===null?null:Number(/\/feed_(\d+)(?:\/|$)/.exec(q.vfsPath)[1])),be=y===null?q.vfsPath:q.vfsPath.replace(/^\/proc\/jobs\//,`/home/${y}/feeds/`);H(D,{input:be,feed:se,node:q.instanceId})},feed_open:q=>{ci(),xt.feed_enter(q)},plugin_open:q=>{(async()=>{const se=await Ve.line_execute("ls /bin",{silent:!0,observe:!1}),be=[];for(const Ke of se.envelopes){if(Ke.model?.kind!=="fs.listing")continue;const tt=Ke.model.data,ft=Array.isArray(tt)?tt:[tt];for(const Zt of ft)for(const bt of Zt.items??[])be.push(bt.name)}const xe=be.filter(Ke=>Ke.startsWith(`${q}-v`)).sort((Ke,tt)=>Ke.localeCompare(tt,void 0,{numeric:!0})).pop();if(xe===void 0){ge.line_note(`universe: ${q} is not in /bin`);return}Ye("gutter-files").click(),l("files",i.get("files","files"),`/bin/${xe}`,"plugin")})().catch(se=>{ge.line_note(`universe: could not open ${q} in /bin: ${se instanceof Error?se.message:String(se)}`)})},note:q=>ge.line_note(q)},Ah());return i.set("universe",D,ee),{id:D,kind:"universe",mount:R,dispose:()=>{i.delete(D),r.pane_leave(D),ee.dispose()}}},v=D=>{const R=ks("tpl-pane-image"),ee=new II(R,{source:{url_of:c},note:q=>ge.line_note(q),regard:q=>r.regard_write(D,{address:q,modelKind:"dicom.instance"}),file_put:async(q,se)=>{try{return(await fetch(c(q),{method:"POST",body:se})).status}catch{return 0}},tags_read:q=>A(q),tags_open:()=>{ge.line_note(G(D))}});return i.set("image",D,ee),{id:D,kind:"image",mount:R,dispose:()=>{ee.dispose(),i.delete(D),r.pane_leave(D)}}},E=D=>{const R=ks("tpl-pane-tags"),ee=new RI(R,{note:q=>ge.line_note(q)});return i.set("tags",D,ee),{id:D,kind:"tags",mount:R,dispose:()=>{i.delete(D),r.pane_leave(D)}}},A=async D=>{try{const R=await Ve.line_execute(`dcm tags "${D}"`,{silent:!0,observe:!1});for(const ee of R.envelopes){if(ee.model?.kind!==Da.tags)continue;const q=Oh.safeParse(ee.model.data);if(q.success)return q.data}}catch{}return null},I=(D,R)=>{const ee=i.get("tags",D);ee===void 0||ee.path_get()===R||A(R).then(q=>{if(q===null){ge.line_note(`tags: ${R}: not a readable DICOM file`);return}i.get("tags",D)?.model_show(q)})},G=D=>{const R=new Set($.panes_shown()),ee=r.group_of(D);for(const se of i.ids("tags"))if(R.has(se)&&r.group_of(se)===ee)return $.focus_set(se),"image tags";if(!R.has(D))return"image tags: the image pane is not on stage";const q=ht("tags",D);return $.leaf_split(D,he.replayPlace_get()?.dir??"col",q.id,he.replayPlace_get()?.before??!1)?(Te(q.id,D,he.replayPlace_get()?.dir??"col",he.replayPlace_get()?.before??!1),"image tags"):(es(q.id),$.mount_remove(q.id),"image tags: could not open beside the image pane")},C=async D=>{try{const R=await Ve.line_execute(`dcm series "${D}"`,{silent:!0,observe:!1});for(const ee of R.envelopes){if(ee.model?.kind!==Da.series)continue;const q=xh.safeParse(ee.model.data);if(q.success)return q.data}}catch{}return null},B=async D=>{try{const R=await Ve.line_execute(`ls "${D}"`,{silent:!0,observe:!1});for(const ee of R.envelopes){if(ee.model?.kind!=="fs.listing")continue;const q=ee.model.data,se=(Array.isArray(q)?q[0]:q)??{},be=(se.path??D).replace(/\/$/,"");return(se.items??[]).filter(xe=>xe.type==="dir").map(xe=>`${be}/${xe.name}`)}}catch{}return[]},P=(D,R)=>{const ee=Ke=>{R!==void 0&&r.regard_write(Ke,R)};if(D!==null&&i.has("image",D))return ee(D),i.get("image",D)??null;const q=new Set($.panes_shown());if(R!==void 0){for(const[Ke,tt]of i.entries("image"))if(q.has(Ke)&&r.regard_get(Ke)?.address===R.address)return ee(Ke),tt}const se=D!==null?r.group_of(D):null;for(const[Ke,tt]of i.entries("image"))if(q.has(Ke)&&se!==null&&r.group_of(Ke)===se)return tt;const be=D!==null&&q.has(D)?D:Ft();if(be===null)return null;const xe=ht("image",D??void 0);return $.leaf_split(be,he.replayPlace_get()?.dir??"col",xe.id,he.replayPlace_get()?.before??!1)?(Te(xe.id,be,he.replayPlace_get()?.dir??"col",he.replayPlace_get()?.before??!1),ee(xe.id),i.get("image",xe.id)??null):(es(xe.id),$.mount_remove(xe.id),null)},L=async(D,R,ee={},q)=>{re();const se=D!==null?void 0:rd.test(R)?{address:R,modelKind:"image.volume"}:{address:Xo.test(R)?R.slice(0,R.lastIndexOf("/")):R.replace(/\/$/,""),modelKind:"dicom.series"},be=P(D,se);if(be===null)return"image: no pane to open beside";const xe=i.idOf("image",be);if(xe!==null&&q?.(xe),rd.test(R))return be.opening_show(R),be.volume_show(R),`image ${R}`;const Ke=Xo.test(R),tt=Ke?R.slice(0,R.lastIndexOf("/")):R.replace(/\/$/,"");be.opening_show(tt);let ft=await C(tt),Zt=[];if(ft===null&&!Ke){const Rt=(await B(tt)).slice(0,32);for(const Es of Rt){const Cn=await C(Es);if(Cn!==null){Zt=Rt.map(Gl=>({path:Gl,label:Gl.split("/").pop()??Gl})),ft=Cn;break}}}if(ft===null)return be.opening_fail(R,"NOT A READABLE SERIES"),`image: ${R}: not a readable DICOM series, study, or volume`;const bt=Ke?Math.max(1,ft.files.indexOf(R)+1):1;return be.series_show(ft,{siblings:Zt,startAt:bt,...ee.force===!0?{force:!0}:{}}),`image ${ft.path}${Zt.length>1?` (1 of ${Zt.length} series)`:""}`},H=(D,R)=>{re();const ee=new Set($.panes_shown());for(const[xe,Ke]of S)if(ee.has(xe)&&Ke.input===R.input){$.focus_set(xe);return}const q=ee.has(D)?D:Ft()??D,se=ht("catalogue",D);if(!$.leaf_split(q,he.replayPlace_get()?.dir??"col",se.id,he.replayPlace_get()?.before??!1)){es(se.id),$.mount_remove(se.id);return}Te(se.id,q,he.replayPlace_get()?.dir??"col",he.replayPlace_get()?.before??!1),S.set(se.id,R);const be=i.get("files",se.id);be!==void 0&&(be.binding_set({input:R.input,place:R.feed===null?"new feed":`feed ${R.feed}${R.node===null?"":` · node ${R.node}`}`}),be.feedOpen_declare(xe=>ce(se.id,xe)),f(se.id,be,"/bin"),J(be),$.focus_set(se.id))},X=5,oe=40,J=D=>{Ve.line_execute(`plugininstance list --limit ${oe} --fields id,plugin_name,plugin_version,owner_username`,{silent:!0,observe:!1}).then(ee=>{const q=[];for(const se of ee.envelopes)if(!(se.model?.kind!=="plugininstance.list"||!Array.isArray(se.model.data)))for(const be of se.model.data){if(typeof be.pluginName!="string"||typeof be.pluginVersion!="string"||y!==null&&typeof be.owner=="string"&&be.owner!==y||be.pluginName==="pl-dircopy")continue;const xe=`${be.pluginName}-v${be.pluginVersion}`;if(q.includes(xe)||q.push(xe),q.length>=X)break}D.recent_set(q.length===0?null:q)}).catch(()=>{})},ce=(D,R)=>{re();const ee=new Set($.panes_shown());for(const[be,xe]of i.entries("dag"))if(be!=="dag"&&ee.has(be)&&xe.feed_get()===R){$.focus_set(be);return}const q=ee.has(D)?D:Ft()??D,se=ht("dag",D);if(!$.leaf_split(q,he.replayPlace_get()?.dir??"col",se.id,he.replayPlace_get()?.before??!1)){es(se.id),$.mount_remove(se.id);return}Te(se.id,q,he.replayPlace_get()?.dir??"col",he.replayPlace_get()?.before??!1),i.get("dag",se.id)?.feed_enter(R)},We=async(D,R,ee)=>{const q=S.get(D),se=i.get("files",D);if(q===void 0||se===void 0)return;const be=Rt=>{ge.output_write("err",`\x1B[31m${Rt}\x1B[0m
4283
+ `)}catch(h){return h instanceof Error?h.message:String(h)}},desktop_serialize:d}}function OR(n,e,t){if(t===!0)return"daemon-older";if(e===void 0)return null;const s=e.surface;return t===!1?s!==void 0&&n.built<s.built?"argus-older":null:s===void 0?"daemon-older":s.git===n.git&&s.built===n.built?null:n.built>=s.built?"daemon-older":"argus-older"}const ah={"daemon-older":{readout:"CALYPSO DAEMON OUT OF DATE",before:"The calypso daemon has been updated and should be restarted; some controls may not work until then. ",cure:"Restart the calypso daemon",after:"."},"argus-older":{readout:"ARGUS OUT OF DATE",before:"ARGUS is older than the calypso daemon. ",cure:"Refresh",after:" to load the new ARGUS."}};function ob(n){const e=ah[n];return`${e.before}${e.cure}${e.after}`}async function xR(n){try{const e=n??(typeof globalThis.fetch=="function"?globalThis.fetch.bind(globalThis):void 0);if(e===void 0)return null;const t=await e("notes.json",{cache:"no-store"});if(!t.ok)return null;const s=await t.json(),r=s.releases?.[0]?.changes?.find(a=>a.internal!==!0)?.headline;return typeof r!="string"||typeof s.version!="string"?null:{version:s.version,headline:r}}catch{return null}}const ym=96;function SR(n){const e=n.headline.length>ym?`${n.headline.slice(0,ym-1).trimEnd()}…`:n.headline;return`argus ${n.version} · ${e} — WHAT'S NEW after restart`}function ER(n,e,t,s,i=document.body,r){i.querySelector(".build-mismatch")?.remove();const a=t.surface!==void 0?`ARGUS ${t.surface.git} built ${t.surface.built}Z`:"an ARGUS too old to say its build";s(`argus: ${ob(n)}`);const o=t.surface!==void 0&&t.surface.git===e.git&&t.surface.built===e.built;s(o?`argus: the calypso daemon's own code on disk has changed since it started (ARGUS ${e.git} built ${e.built}Z)`:`argus: ARGUS ${e.git} built ${e.built}Z · calypso daemon started with ${a}`);const l=ah[n],c=document.createElement("div");c.className="stale-page build-mismatch",c.dataset.mismatch=n,c.setAttribute("role","alert");const d=document.createElement("span");d.className="stale-page-words";let u=document.createTextNode(l.cure);if(n==="argus-older"){const p=document.createElement("button");p.type="button",p.className="stale-page-reload",p.textContent=l.cure,p.title="reload this tab to load the new ARGUS",p.addEventListener("click",()=>{window.location.reload()}),u=p}else if(r!==void 0){const p=document.createElement("button");p.type="button",p.className="stale-page-reload build-mismatch-restart",p.textContent=l.cure,p.title="restart the calypso daemon (asks first; you stay logged in)",p.addEventListener("click",r),u=p}d.append(document.createTextNode(l.before),u,document.createTextNode(l.after));const h=document.createElement("button");h.type="button",h.className="build-mismatch-dismiss",h.textContent="×",h.title="dismiss (the status strip keeps saying it)",h.addEventListener("click",()=>{c.remove()}),c.append(d,h),i.appendChild(c),n==="daemon-older"&&xR().then(p=>{if(p===null||!c.isConnected)return;const f=document.createElement("span");f.className="build-mismatch-news",f.textContent=SR(p),d.appendChild(f)})}function AR(n,e,t,s=document.body){const i={git:"85eca2dd",built:"2026-10-09 01:04"};let r=[],a,o=null;const l=d=>{r!==null?r.push(d):e(d)},c=d=>{if(a===void 0)return;const u=OR(i,a,d);if(u!==o){if(o=u,u===null){n.build_show(null),s.querySelector(".build-mismatch")?.remove();return}n.build_show(ah[u].readout,ob(u)),ER(u,i,a,l,s,ml(window.location.search)?t:void 0)}};return{attach_take:d=>{a=d.stack,c(d.stale)},stale_take:d=>c(d),release:()=>{const d=r??[];r=null;for(const u of d)e(u)}}}function DR(n=document.getElementById("door-pill")){n===null||!ml(window.location.search)||(n.hidden=!1,n.addEventListener("click",()=>{const e=Vo(window.location.pathname,"logout"),t=Vo(window.location.pathname,"login");fetch(e,{method:"POST",headers:{accept:"application/json"}}).catch(()=>{}).then(()=>{window.location.assign(t)})}))}const TR="Restart the calypso daemon? You'll stay logged in; the page reloads when the new daemon is up.";function IR(n){const e=[];n.running!==null&&e.push(`the running command: ${n.running}`);for(const r of n.unsaved)e.push(`an unsaved edit in ${r}`);const t=n.others.filter(r=>r.kind==="browser").length,s=n.others.length-t,i=[];return t>0&&i.push(t===1?"1 other browser":`${t} other browsers`),s>0&&i.push(s===1?"1 chell":`${s} chells`),i.length>0&&e.push(`${i.join(" and ")}, which will be disconnected`),e}function GR(n){return n==="restart"?"The calypso daemon is restarting (asked from another browser or surface). Following it…":n==="end"?"The calypso daemon was ended by an administrator.":"The calypso daemon stopped."}function RR(n,e){const t=document.createElement("div");t.className="stale-page restart-question",t.setAttribute("role","alertdialog");const s=document.createElement("div");s.className="stale-page-words";const i=document.createElement("div");if(i.textContent=TR,s.append(i),n.length>0){const d=document.createElement("ul");d.className="restart-cuts";const u=document.createElement("li");u.className="restart-cuts-lead",u.textContent="This will cut off:",d.append(u);for(const h of n){const p=document.createElement("li");p.textContent=h,d.append(p)}s.append(d)}const r=document.createElement("button");r.type="button",r.className="restart-yes",r.textContent="YES";const a=document.createElement("button");a.type="button",a.className="restart-no",a.textContent="NO";let o=!1;const l=d=>{o||(o=!0,t.remove(),e(d))};r.addEventListener("click",()=>l(!0)),a.addEventListener("click",()=>l(!1)),t.addEventListener("keydown",d=>{d.key!=="Enter"&&d.key!=="Escape"||(d.preventDefault(),d.stopPropagation(),l(d.key==="Enter"))});const c=document.createElement("div");return c.className="restart-answers",c.append(r,a),t.append(s,c),t}function NR(n,e=document.body){const t=ml(window.location.search);let s=null,i=null,r=[],a=!1;const o=h=>{e.querySelector(".restart-said")?.remove();const p=document.createElement("div");p.className="stale-page restart-said",p.setAttribute("role","alert"),p.textContent=h,e.appendChild(p)},l=h=>{window.location.assign(`${Vo(window.location.pathname,"greet")}/${encodeURIComponent(h)}`)},c=async()=>{a=!0,o("Restarting the calypso daemon…");try{const h=await fetch(Vo(window.location.pathname,"restart"),{method:"POST",headers:{accept:"application/json"}}),p=await h.json();if(!h.ok||p.key===void 0)throw new Error(p.error??`the door answered ${h.status}`);l(p.key)}catch(h){a=!1,o(`The calypso daemon could not be restarted: ${h instanceof Error?h.message:String(h)}`)}},d=()=>{if(!t||e.querySelector(".restart-question")!==null)return;const h={running:i,unsaved:n.unsaved(),others:r.filter(f=>f.id!==s)},p=RR(IR(h),f=>{f&&c()});e.querySelector(".build-mismatch")?.remove(),e.appendChild(p),p.querySelector(".restart-yes")?.focus()},u=document.getElementById("restart-pill");return u!==null&&t&&(u.hidden=!1,u.addEventListener("click",d)),{ask:d,attach_take:h=>{s=h.surface??null},telemetry_take:h=>{h?.lane!==void 0&&(i=h.lane.running?.line??null),h?.surfaces!==void 0&&(r=h.surfaces)},closing_take:h=>{if(a||(o(GR(h)),h!=="restart"||!t))return;const p=window.location.pathname.split("/").filter(f=>f.length>0).at(-1);p!==void 0&&setTimeout(()=>l(p),1200)}}}function BR(n,e,t,s){n.line_execute(`motd ${t}`,{silent:!0,observe:!1}).then(i=>{const r=i.envelopes.filter(a=>a.status==="ok").map(a=>a.rendered).join("").trimEnd();r.length>0&&e.greeting_write(r.split(`
4284
+ `))}).catch(()=>{}).finally(s)}let Mi=()=>{};function vm(){Mi(document.body.dataset.zoom==="console"?null:"console")}const CR=iz(),PR="ARGUS",Om="argus-audio",LR=.4;let bi=!1;function Ns(n){if(bi)return;const e=document.getElementById(n);e instanceof HTMLAudioElement&&(e.currentTime=0,e.volume=LR,e.play().catch(()=>{}))}function WR(){const n=Ye("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 kR(){const n=Ye("audio-pill");try{bi=window.localStorage.getItem(Om)==="off"}catch{bi=!1}const e=()=>{n.classList.toggle("audio-off",bi)};e(),n.addEventListener("click",()=>{bi=!bi;try{window.localStorage.setItem(Om,bi?"off":"on")}catch{}e(),Ns("audio2")})}function Ye(n){const e=document.getElementById(n);if(e===null)throw new Error(`required element #${n} is missing`);return e}function ks(n){const e=Ye(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 ds(n,e){const t=n.querySelector(e);if(t===null)throw new Error(`pane template is missing ${e}`);return t}function UR(){return rz(window.location)}let Uc=null,ul=0;function oh(n,e){const t=()=>{e.dataset.zoom!==void 0||e.dataset.header==="away"||(ul=Math.ceil(n.offsetTop+n.offsetHeight),e.style.setProperty("--zoom-header-height",`${ul}px`))};t(),Uc===null&&(Uc=new ResizeObserver(t),Uc.observe(n))}const xm=120,FR=96;function jR(n,e,t,s){let i="";const r=d=>{d?(i=n.style.height,n.style.height=""):i!==""&&(n.style.height=i),n.classList.toggle("drawer-closed",d),Ns("audio3"),d||(s.size_fit(),s.focus_take())};t.addEventListener("click",()=>r(!n.classList.contains("drawer-closed")));let a=0,o=0,l=!1;e.addEventListener("pointerdown",d=>{l=!0,a=d.clientY,o=n.getBoundingClientRect().height,n.classList.add("drawer-dragging"),e.setPointerCapture(d.pointerId),d.preventDefault()}),e.addEventListener("pointermove",d=>{if(!l)return;const u=Math.max(xm,window.innerHeight-FR),h=o+(d.clientY-a),p=Math.min(Math.max(xm,h),u);n.style.height=`${p}px`,s.size_fit()});const c=()=>{l=!1,n.classList.remove("drawer-dragging")};return e.addEventListener("pointerup",c),e.addEventListener("pointercancel",c),r}function $R(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,ul>0&&e.style.setProperty("--zoom-header-height",`${ul}px`)):t!==null&&oh(t,e),e.dataset.zoom=r;const o=Go(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";Ns("audio3")};return Ye("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())}),Ye("drawer").addEventListener("transitionend",r=>{r.propertyName==="height"&&n.size_fit()}),i}function VR(){const n=new ZI(document.getElementById("data-cascade")),e=document.getElementById("header-telemetry");return e!==null&&n.telemetryPanel_bind(e),n}const Fc=96,HR=220,Sm="argus.headerBand.height",qR=52;function XR(){const n=document.documentElement,e=document.getElementById("header-strip"),t=document.querySelector(".wrap:not(#gap)");if(e===null||t===null)return;const s=d=>{const u=Math.max(Fc,window.innerHeight-HR),h=Math.min(Math.max(Fc,d),u);n.style.setProperty("--header-band-h",`${h}px`);try{window.localStorage.setItem(Sm,String(h))}catch{}},i=(()=>{try{return window.localStorage.getItem(Sm)}catch{return null}})();i!==null&&Number.isFinite(Number(i))&&s(Number(i));const r=()=>{const d=t.getBoundingClientRect();e.style.top=`${Math.max(0,d.bottom-qR)}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("pointerdown",d=>{const u=document.querySelector(".header-face");a=!0,o=d.clientY,l=u===null?Fc:u.getBoundingClientRect().height,e.setPointerCapture(d.pointerId),d.preventDefault()}),e.addEventListener("pointermove",d=>{a&&(s(l+(d.clientY-o)),r())});const c=()=>{a=!1,r()};e.addEventListener("pointerup",c),e.addEventListener("pointercancel",c)}let lh=null;function KR(n){const e=n.querySelector(".gather-rows");if(e===null)return;const t=Hs(e,{rows:".listing-row",label:s=>`+${s} MORE · ON STAGE`,press:()=>{lh?.()},className:"strategy-pill gather-more",mount:n});t.title="the whole cohort as a pane on the main panel"}function Em(n){Hs(n,{rows:".strategy-pill, .listing-action, .holder-mark",className:"frame-more"})}function YR(){const n=e=>{for(const t of e.querySelectorAll(".mode-frame:not([data-more])"))Em(t)};new MutationObserver(e=>{for(const t of e)for(const s of t.addedNodes)s instanceof HTMLElement&&(s.matches(".mode-frame")&&s.dataset.more===void 0&&Em(s),n(s))}).observe(document.body,{childList:!0,subtree:!0}),n(document)}function Am(n){const e=n?.text;if(typeof e!="string"||e.length===0||typeof window.speechSynthesis>"u")return;const t=new SpeechSynthesisUtterance(e);t.rate=1,window.speechSynthesis.speak(t)}function ZR(){const n=document.body,e=document.querySelector(".wrap:not(#gap)"),t=r=>{n.dataset.header===r?(e!==null&&oh(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(),lh?.()}),s!==null&&KR(s),YR();const i=()=>{n.dataset.zoom===void 0&&(delete n.dataset.header,Ns("audio3"))};Ye("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 Mr=[{key:"lower-decks",label:"LOWER DECKS"},{key:"gold",label:"CERRITOS GOLD"},{key:"medical",label:"MEDICAL"},{key:"nemesis",label:"NEMESIS"},{key:"pharos",label:"PHAROS"}],lb="argus-landing",QR=15e3;function Dm(){try{return(window.localStorage.getItem(lb)??"launcher")==="launcher"}catch{return!0}}function JR(n){try{window.localStorage.setItem(lb,n?"launcher":"last")}catch{}}const Tm="argus-theme",e7="argus-lcars",t7="medical",s7={sickbay:"medical"};function n7(){const n=Ye("theme-pill"),e=Math.max(Mr.findIndex(r=>r.key===t7),0);let t=e;try{const r=window.localStorage.getItem(Tm)??window.localStorage.getItem(e7),a=r===null?null:s7[r]??r,o=Mr.findIndex(l=>l.key===a);t=o>=0?o:e}catch{t=e}const s=document.documentElement,i=()=>{const r=Mr[t]??Mr[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)%Mr.length,i();try{window.localStorage.setItem(Tm,Mr[t]?.key??"lower-decks")}catch{}Ns("audio2")})}function i7(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.21.0"],["ARGUS","85eca2dd · 2026-10-09 01:04Z"],["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 r7(){for(const n of document.querySelectorAll(".left-frame button, .left-frame-top button"))n.addEventListener("click",()=>Ns("audio2"))}let _r=null;async function a7(n){const e=new FI(document),t=new $I(Ye("index-instrument"),()=>Date.now(),{errored_open:()=>ci("status:error")}),s=new HI(Ye("lane-instrument"));window.setInterval(()=>s.tick(),500);const i=new rG,r=new LI;r.writeObserver_set((D,R)=>{Ve.regard_send({address:D.address,...D.modelKind!==void 0?{modelKind:D.modelKind}:{},groupId:R,paneId:D.paneId}),Z()});const a={get layout(){return $},panels:i,paneInstance_get:Go,subjects:r,get dormant(){return ie},sound:Ns,get terminal(){return ge},get client(){return Ve}},o=gG(a,{catalogue_of:D=>S.get(D),run_press:(D,R,ee)=>{We(D,R,ee)}}),l=o.entry_show,c=D=>bu(D,n),d=wR(a,{vfsUrl_build:c,downloadUrl_build:D=>az(D,n),image_open:(D,R)=>W(D,R),process_open:(D,R)=>H(D,R),run_press:(D,R,ee)=>{We(D,R,ee)},cohort_gather:D=>ae(D),verbLine_run:(D,R)=>N(D,R),ask_onPane:(D,R)=>x(D,R),binEntry_show:l,catalogue_of:D=>S.get(D),promptUser:()=>y,template_stamp:ks,pane_find:ds}),{previewProvider:u,fileText_fetch:h,file_save:p,rootedListing_show:f,listing_refresh:M,directory_make:g,files_deliver:m,filesBody_stamp:_,rowVerbs_of:w}=d,z=d.instance_build;let y=null,O=null;const S=new Map,b=D=>{const R=ks("tpl-pane-universe"),ee=new aI({canvas:ds(R,".universe-canvas"),title:ds(R,".universe-title"),state:R.querySelector(".pane-state"),empty:ds(R,".universe-empty"),projectionPill:R.querySelector(".universe-projection"),refreshPill:R.querySelector(".universe-refresh"),replayPill:R.querySelector(".universe-replay"),scalePill:R.querySelector(".universe-scale"),viewPill:R.querySelector(".universe-view"),gravityPill:R.querySelector(".universe-gravity"),densityPill:R.querySelector(".universe-density"),drawPill:R.querySelector(".universe-draw"),captionsPill:R.querySelector(".universe-captions"),arrangementPill:R.querySelector(".universe-arrangement"),facts:R.querySelector(".universe-facts"),backPill:R.querySelector(".universe-back"),openPill:R.querySelector(".universe-open"),frame:R.querySelector(".mode-frame")},{watch_set:(q,se)=>{se?Ve.watch_send(q):Ve.unwatch_send(q)},...(({feed_entered:q,feed_note:se,feed_tag:be,feed_rename:xe,feed_untag:Ke})=>({feed_entered:q,feed_note:se,feed_tag:be,feed_rename:xe,feed_untag:Ke}))(pm(a,D,ot)),command_run:q=>{Ve.line_execute(q,{silent:!0,observe:!1}).then(se=>{for(const be of se.envelopes)ee.envelope_observe(be)})},feed_dag:async q=>{const se=await Ve.line_execute(`feed diagram feed_${q}`,{silent:!0,observe:!1});for(const be of se.envelopes){if(be.model?.kind!==Kn.feedDag)continue;const xe=Zc.safeParse(be.model.data);if(xe.success)return xe.data}return null},node_enter:q=>{ge.line_run(`cd "${q}"`)},node_dive:q=>{Fe(D,q.replace(/\/data$/,""))},node_process:q=>{const se=Ma(q.vfsPath)??(/\/feed_(\d+)(?:\/|$)/.exec(q.vfsPath)===null?null:Number(/\/feed_(\d+)(?:\/|$)/.exec(q.vfsPath)[1])),be=y===null?q.vfsPath:q.vfsPath.replace(/^\/proc\/jobs\//,`/home/${y}/feeds/`);H(D,{input:be,feed:se,node:q.instanceId})},feed_open:q=>{ci(),xt.feed_enter(q)},plugin_open:q=>{(async()=>{const se=await Ve.line_execute("ls /bin",{silent:!0,observe:!1}),be=[];for(const Ke of se.envelopes){if(Ke.model?.kind!=="fs.listing")continue;const tt=Ke.model.data,ft=Array.isArray(tt)?tt:[tt];for(const Zt of ft)for(const bt of Zt.items??[])be.push(bt.name)}const xe=be.filter(Ke=>Ke.startsWith(`${q}-v`)).sort((Ke,tt)=>Ke.localeCompare(tt,void 0,{numeric:!0})).pop();if(xe===void 0){ge.line_note(`universe: ${q} is not in /bin`);return}Ye("gutter-files").click(),l("files",i.get("files","files"),`/bin/${xe}`,"plugin")})().catch(se=>{ge.line_note(`universe: could not open ${q} in /bin: ${se instanceof Error?se.message:String(se)}`)})},note:q=>ge.line_note(q)},Ah());return i.set("universe",D,ee),{id:D,kind:"universe",mount:R,dispose:()=>{i.delete(D),r.pane_leave(D),ee.dispose()}}},v=D=>{const R=ks("tpl-pane-image"),ee=new II(R,{source:{url_of:c},note:q=>ge.line_note(q),regard:q=>r.regard_write(D,{address:q,modelKind:"dicom.instance"}),file_put:async(q,se)=>{try{return(await fetch(c(q),{method:"POST",body:se})).status}catch{return 0}},tags_read:q=>A(q),tags_open:()=>{ge.line_note(G(D))}});return i.set("image",D,ee),{id:D,kind:"image",mount:R,dispose:()=>{ee.dispose(),i.delete(D),r.pane_leave(D)}}},E=D=>{const R=ks("tpl-pane-tags"),ee=new RI(R,{note:q=>ge.line_note(q)});return i.set("tags",D,ee),{id:D,kind:"tags",mount:R,dispose:()=>{i.delete(D),r.pane_leave(D)}}},A=async D=>{try{const R=await Ve.line_execute(`dcm tags "${D}"`,{silent:!0,observe:!1});for(const ee of R.envelopes){if(ee.model?.kind!==Da.tags)continue;const q=Oh.safeParse(ee.model.data);if(q.success)return q.data}}catch{}return null},I=(D,R)=>{const ee=i.get("tags",D);ee===void 0||ee.path_get()===R||A(R).then(q=>{if(q===null){ge.line_note(`tags: ${R}: not a readable DICOM file`);return}i.get("tags",D)?.model_show(q)})},G=D=>{const R=new Set($.panes_shown()),ee=r.group_of(D);for(const se of i.ids("tags"))if(R.has(se)&&r.group_of(se)===ee)return $.focus_set(se),"image tags";if(!R.has(D))return"image tags: the image pane is not on stage";const q=ht("tags",D);return $.leaf_split(D,he.replayPlace_get()?.dir??"col",q.id,he.replayPlace_get()?.before??!1)?(Te(q.id,D,he.replayPlace_get()?.dir??"col",he.replayPlace_get()?.before??!1),"image tags"):(es(q.id),$.mount_remove(q.id),"image tags: could not open beside the image pane")},C=async D=>{try{const R=await Ve.line_execute(`dcm series "${D}"`,{silent:!0,observe:!1});for(const ee of R.envelopes){if(ee.model?.kind!==Da.series)continue;const q=xh.safeParse(ee.model.data);if(q.success)return q.data}}catch{}return null},B=async D=>{try{const R=await Ve.line_execute(`ls "${D}"`,{silent:!0,observe:!1});for(const ee of R.envelopes){if(ee.model?.kind!=="fs.listing")continue;const q=ee.model.data,se=(Array.isArray(q)?q[0]:q)??{},be=(se.path??D).replace(/\/$/,"");return(se.items??[]).filter(xe=>xe.type==="dir").map(xe=>`${be}/${xe.name}`)}}catch{}return[]},P=(D,R)=>{const ee=Ke=>{R!==void 0&&r.regard_write(Ke,R)};if(D!==null&&i.has("image",D))return ee(D),i.get("image",D)??null;const q=new Set($.panes_shown());if(R!==void 0){for(const[Ke,tt]of i.entries("image"))if(q.has(Ke)&&r.regard_get(Ke)?.address===R.address)return ee(Ke),tt}const se=D!==null?r.group_of(D):null;for(const[Ke,tt]of i.entries("image"))if(q.has(Ke)&&se!==null&&r.group_of(Ke)===se)return tt;const be=D!==null&&q.has(D)?D:Ft();if(be===null)return null;const xe=ht("image",D??void 0);return $.leaf_split(be,he.replayPlace_get()?.dir??"col",xe.id,he.replayPlace_get()?.before??!1)?(Te(xe.id,be,he.replayPlace_get()?.dir??"col",he.replayPlace_get()?.before??!1),ee(xe.id),i.get("image",xe.id)??null):(es(xe.id),$.mount_remove(xe.id),null)},W=async(D,R,ee={},q)=>{re();const se=D!==null?void 0:rd.test(R)?{address:R,modelKind:"image.volume"}:{address:Xo.test(R)?R.slice(0,R.lastIndexOf("/")):R.replace(/\/$/,""),modelKind:"dicom.series"},be=P(D,se);if(be===null)return"image: no pane to open beside";const xe=i.idOf("image",be);if(xe!==null&&q?.(xe),rd.test(R))return be.opening_show(R),be.volume_show(R),`image ${R}`;const Ke=Xo.test(R),tt=Ke?R.slice(0,R.lastIndexOf("/")):R.replace(/\/$/,"");be.opening_show(tt);let ft=await C(tt),Zt=[];if(ft===null&&!Ke){const Rt=(await B(tt)).slice(0,32);for(const Es of Rt){const Cn=await C(Es);if(Cn!==null){Zt=Rt.map(Gl=>({path:Gl,label:Gl.split("/").pop()??Gl})),ft=Cn;break}}}if(ft===null)return be.opening_fail(R,"NOT A READABLE SERIES"),`image: ${R}: not a readable DICOM series, study, or volume`;const bt=Ke?Math.max(1,ft.files.indexOf(R)+1):1;return be.series_show(ft,{siblings:Zt,startAt:bt,...ee.force===!0?{force:!0}:{}}),`image ${ft.path}${Zt.length>1?` (1 of ${Zt.length} series)`:""}`},H=(D,R)=>{re();const ee=new Set($.panes_shown());for(const[xe,Ke]of S)if(ee.has(xe)&&Ke.input===R.input){$.focus_set(xe);return}const q=ee.has(D)?D:Ft()??D,se=ht("catalogue",D);if(!$.leaf_split(q,he.replayPlace_get()?.dir??"col",se.id,he.replayPlace_get()?.before??!1)){es(se.id),$.mount_remove(se.id);return}Te(se.id,q,he.replayPlace_get()?.dir??"col",he.replayPlace_get()?.before??!1),S.set(se.id,R);const be=i.get("files",se.id);be!==void 0&&(be.binding_set({input:R.input,place:R.feed===null?"new feed":`feed ${R.feed}${R.node===null?"":` · node ${R.node}`}`}),be.feedOpen_declare(xe=>ce(se.id,xe)),f(se.id,be,"/bin"),J(be),$.focus_set(se.id))},X=5,oe=40,J=D=>{Ve.line_execute(`plugininstance list --limit ${oe} --fields id,plugin_name,plugin_version,owner_username`,{silent:!0,observe:!1}).then(ee=>{const q=[];for(const se of ee.envelopes)if(!(se.model?.kind!=="plugininstance.list"||!Array.isArray(se.model.data)))for(const be of se.model.data){if(typeof be.pluginName!="string"||typeof be.pluginVersion!="string"||y!==null&&typeof be.owner=="string"&&be.owner!==y||be.pluginName==="pl-dircopy")continue;const xe=`${be.pluginName}-v${be.pluginVersion}`;if(q.includes(xe)||q.push(xe),q.length>=X)break}D.recent_set(q.length===0?null:q)}).catch(()=>{})},ce=(D,R)=>{re();const ee=new Set($.panes_shown());for(const[be,xe]of i.entries("dag"))if(be!=="dag"&&ee.has(be)&&xe.feed_get()===R){$.focus_set(be);return}const q=ee.has(D)?D:Ft()??D,se=ht("dag",D);if(!$.leaf_split(q,he.replayPlace_get()?.dir??"col",se.id,he.replayPlace_get()?.before??!1)){es(se.id),$.mount_remove(se.id);return}Te(se.id,q,he.replayPlace_get()?.dir??"col",he.replayPlace_get()?.before??!1),i.get("dag",se.id)?.feed_enter(R)},We=async(D,R,ee)=>{const q=S.get(D),se=i.get("files",D);if(q===void 0||se===void 0)return;const be=Rt=>{ge.output_write("err",`\x1B[31m${Rt}\x1B[0m
4285
4285
  `);const Es=se.indicated_get();Es!==null&&se.rowReadout_show(Es,Rt.toUpperCase().slice(0,80))};if(ee==="pipeline"&&q.node===null){be(`${R}: a pipeline runs on a node — PROCESS a node of a feed`);return}let xe=se.commandLine_get();if((xe===""||Ng(xe)!==R)&&(xe=Ig(q.input,R)),q.feed===null&&!vv(xe)){const Rt=q.input.split("/").filter(Boolean).pop()??"feed",Cn=(await x(D,{message:"Feed title: ",kind:"text",suggest:Rt,commit:"RUN"})??"").trim();if(Cn==="")return;xe=Ov(xe,Cn)}se.commandLine_set(xe),ge.line_echo(xe);let Ke;try{Ke=await Ve.line_execute(xe,{silent:!0})}catch(Rt){be(Rt instanceof Error?Rt.message:String(Rt));return}ge.outcome_write(Ke),Ke.envelopes.some(Rt=>Rt.model?.kind==="fs.cwd")&&Ve.line_execute("ls",{silent:!0});const ft=Ke.envelopes.find(Rt=>Rt.model?.kind==="run.scheduled")?.model?.data;if(typeof ft?.feedId=="number"){se.run_show(ft.feedId);return}const Zt=Ke.envelopes.map(Rt=>Rt.renderedErr??"").join(" ").replace(/\x1b\[[0-9;]*m/g,"").trim().split(`
4286
- `)[0]??"",bt=se.indicated_get();bt!==null&&se.rowReadout_show(bt,Zt===""?"NOT SCHEDULED":Zt.toUpperCase().slice(0,80))},qe=D=>{re();const R=new Set($.panes_shown());for(const[xe]of i.entries("files"))if(R.has(xe)&&r.regard_get(xe)?.address===D){$.focus_set(xe);return}let ee;for(const[xe,Ke]of i.entries("image"))if(R.has(xe)&&(r.regard_get(xe)?.address===D||Ke.state_get()?.path===D)){ee=xe;break}const q=Ft();if(q===null)return;const se=ht("files",ee);if(!$.leaf_split(q,he.replayPlace_get()?.dir??"col",se.id,he.replayPlace_get()?.before??!1)){es(se.id),$.mount_remove(se.id);return}Te(se.id,q,he.replayPlace_get()?.dir??"col",he.replayPlace_get()?.before??!1),ee===void 0&&r.regard_write(se.id,{address:D,modelKind:"dicom.series"});const be=i.get("files",se.id);be!==void 0&&f(se.id,be,D)},Pe=OG(a,{image_open:(D,R)=>L(D,R),process_open:(D,R)=>H(D,R),feed_open:(D,R)=>ce(D,R),ask_onPane:(D,R)=>x(D,R),errandHost_find:()=>Ft(),instance_spawn:(D,R)=>ht(D,R),birth_record:(D,R,ee,q)=>Te(D,R,ee,q),replayPlace_get:()=>he.replayPlace_get(),stage_relight:()=>Z(),home_apply:()=>$e(),orphans_dispose:()=>_e(),fileText_fetch:h,template_stamp:ks,pane_find:ds,element_require:Ye}),ne=Pe.instance_build,ae=Pe.gather,ue=Pe.open,Xe=D=>{const R=ks("tpl-pane-view");Hs(ds(R,".view-body"));const ee=new yI(ds(R,".view-body"),ds(R,".view-title"),{content_fetch:async q=>(await h(q)).text,imageUrl_build:c,path_isImage:bl});return i.set("view",D,ee),{id:D,kind:"view",mount:R,dispose:()=>{i.delete(D),r.pane_leave(D)}}},Ze=MG(a,{filesBody_stamp:_,rootedListing_show:f,rowVerbs_of:w,image_open:(D,R)=>L(D,R),imagery_is:ab,tableFile_is:D=>rb.test(D),vfsUrl_build:c,fileText_fetch:h,previewProvider:u}),Fe=Ze.open,Lt=(D,R)=>{const ee=ks("tpl-pane-dag"),q=new NT(ds(ee,".dag-canvas"),ds(ee,".dag-title"),ds(ee,".dag-facts"),ds(ee,".dag-empty"),ds(ee,".dag-strategy"),ds(ee,".dag-feedlist"),{command_run:se=>{Ve.line_execute(se,{silent:!0,observe:!1}).then(be=>{for(const xe of be.envelopes)q.envelope_observe(xe)})},watch_set:(se,be)=>{be?Ve.watch_send(se):Ve.unwatch_send(se)},node_enter:se=>{ge.line_run(`cd "${se}"`)},node_dive:se=>{Fe(D,se.replace(/\/data$/,""))},node_regard:se=>{r.regard_write(D,{address:se,modelKind:"feed.node"})},node_process:se=>{const be=Ma(se.vfsPath)??(/\/feed_(\d+)(?:\/|$)/.exec(se.vfsPath)===null?null:Number(/\/feed_(\d+)(?:\/|$)/.exec(se.vfsPath)[1])),xe=y===null?se.vfsPath:se.vfsPath.replace(/^\/proc\/jobs\//,`/home/${y}/feeds/`);H(D,{input:xe,feed:be,node:se.instanceId})},feed_regard:se=>{r.regard_write(D,{address:se,modelKind:"feed"})},...pm(a,D,ot),...R?{feed_shown:()=>Ge()}:{}});return i.set("dag",D,q),{id:D,kind:"dag",mount:ee,dispose:()=>{Ze.dispose(D),i.delete(D),r.pane_leave(D),q.dispose()}}},ot=CG(a,{ask_onPane:(D,R)=>x(D,R),promptUser:()=>y,changed:()=>{for(const D of i.values("dag"))D.roster_ask(),D.marks_refresh(),D.indicated_refresh()}}),yt=z("files",!0);gr(yt);const ut=Lt("dag",!0);gr(ut);const lt=b("universe");gr(lt);const Gt=ks("tpl-pane-launcher");gr({id:"launcher",kind:"launcher",mount:Gt});const Bt=ks("tpl-pane-panes");gr({id:"panes",kind:"panes",mount:Bt});const $t=i.get("files","files"),xt=i.get("dag","dag"),Ct=new eG(Ye("pipeline-cycler"),Ye("pipeline-cycler-name"),D=>{Ve.line_execute(D,{silent:!0})});let Pt=null;const j=_G(a,{instance_spawn:(D,R)=>ht(D,R),birth_record:(D,R,ee,q)=>Te(D,R,ee,q),replayPlace_get:()=>he.replayPlace_get(),rootedListing_show:f,console_expose:()=>Pt?.(!1)}),{errandHost_find:Ft,errand_open:vt,verbLine_run:N,ask_onPane:x}=j;Hs(Ye("pacs-workspace"),{rows:".listing-row"});const V=new gI(Ye("pacs-workspace"),{command_run:D=>{const R=/^(pacs query|pull )/.test(D);R&&ge.line_echo(D),Ve.line_execute(D,{silent:!0,operator:R}).then(ee=>{for(const q of ee.envelopes)V.envelope_observe(q)})},command_show:D=>{ge.line_run(D)},note:D=>ge.line_note(D),image_open:D=>{L(null,D).then(R=>ge.line_note(R))},dir_open:D=>qe(D),process_open:D=>H("pacs",{input:D,feed:null,node:null}),gather_add:D=>ae([D]),gathered_is:D=>Pe.has(D),workspace_close:()=>$e()});gr({id:"pacs",kind:"pacs",mount:Ye("pacs-workspace")});const Z=()=>{const D=new Set($.panes_shown()),R=new Map;for(const ee of Ro()){if(!D.has(ee.id))continue;const q=r.regard_get(ee.id)?.address;if(q===void 0)continue;const se=Il(ee.id);if(se!=="image"&&se!=="files")continue;const be=q.replace(/\/$/,""),xe=R.get(be)??{viewer:!1,browser:!1};se==="image"?xe.viewer=!0:xe.browser=!0,R.set(be,xe)}V.stage_lit(R)},$=new aG(Ye("layout-root"),new Map([["dag",ut.mount],["universe",lt.mount],["files",yt.mount],["pacs",Ye("pacs-workspace")],["launcher",Gt],["panes",Bt]]));let pe=!1;const ye=()=>pe?{dir:"col",ratio:.45,first:{pane:"files"},second:{pane:"dag"}}:{pane:"files"};$.preset_register("files",ye),$.preset_register("pacs",()=>({pane:"pacs"})),$.preset_register("dag",()=>({pane:"dag"})),$.preset_register("universe",()=>({pane:"universe"})),$.preset_register("panes",()=>({pane:"panes"})),$.preset_register("launcher",()=>({pane:"launcher"})),$.renderObserver_set(()=>{document.body.dataset.zoom==="launcher"&&!$.panes_shown().includes("launcher")&&Mi(null),window.requestAnimationFrame(()=>{for(const D of i.values("dag"))D.size_fit()})});const te=(D,R,ee,q)=>{const se=R==="view"?ht("view",D):R==="fs"?ht("files",D):ht("empty");if(!$.leaf_split(D,ee,se.id,q))return es(se.id),$.mount_remove(se.id),null;if(Te(se.id,D,ee,q,R),R==="fs"){const be=Ke=>{const tt=i.get("files",se.id);if(tt===void 0)return;const ft=Ke.modelKind==="fs.file"?Ke.address.replace(/\/[^/]*$/,"")||"/":Ke.address;f(se.id,tt,ft)};r.regard_subscribe(se.id,be);const xe=r.regard_get(D);xe!==null&&be(xe)}return se.id},ie=new Q0(Jm,Ah());Object.assign(globalThis,{__argusDormant:{list:()=>ie.list(),get:D=>ie.get(D),dismiss:D=>ie.dismiss(D)}});const he=dG(a,{image_open:L,dir_open:qe,process_open:H,gather_open:ue,feed_open:ce,edit_open:D=>Nn.edit_open(D),pillPane_spawn:te,pacsQuery_get:()=>V.query_get(),catalogue_of:D=>S.get(D),catalogueIds:()=>[...S.keys()],stage_relight:()=>Z()}),{birth_record:Te,domain_enter:Me,orphans_dispose:_e}=he,Ue=he.capture,je=he.restore,$e=()=>{Me("files"),xt.size_fit()},U=()=>{Me("launcher"),de.render(),$.focus_set("launcher"),Mi("launcher")},ze=(D=!1)=>{if(document.body.dataset.zoom!=="launcher"||(Mi(null),!D))return;const R=document.querySelector(".wrap:not(#gap)");R!==null&&oh(R,document.body),document.body.dataset.header="away",Pt?.(!0)},re=()=>{ze(),$.activePreset_get()==="launcher"&&(pe=!1,$e())};let we=!1;const Ee=_v({ask:D=>Ve.line_execute(D,{silent:!0,observe:!1}),universe_show:()=>Tl(),runs_show:D=>ci(D),feed_enter:D=>{ci(),i.get("dag","dag")?.feed_enter(D)},home_open:()=>{pe=!1,$e(),$.focus_set("files")},home_cd:D=>{pe=!1,$e(),ge.line_run(`cd "${D}"`)},line_offer:D=>ge.line_offer(D),pacs_query:()=>V.query_get()??"",pacs_open:()=>{Me("pacs"),$.focus_set("pacs")},desktops:()=>ie.list(),desktop_restore:D=>{je(D)},panes_open:()=>{Me("panes"),Be.render(),$.focus_set("panes")},keys_open:()=>{Ur()},notes_open:()=>{li.open()},notes_latest:()=>li.latest(),daemon_stale:()=>we,console_open:()=>Ye("gutter-console").click()}),de=new nv(Gt,{tiles:Ee,leave:()=>ze(!0),startHere_get:Dm,startHere_set:JR});setInterval(()=>{$.activePreset_get()==="launcher"&&(!Gt.isConnected||document.visibilityState!=="visible"||de.render())},QR),Hs(ds(Bt,".panes-body"),{rows:".panes-card"});const Be=new J0(Bt,{list:()=>ie.list(),restore:D=>{je(D)},dismiss:D=>{ie.dismiss(D)}}),Ge=()=>{const D=$.activePreset_get();if(D==="pacs"||D==="dag"||D==="launcher"){pe=!0;return}pe&&D==="files"||(pe=!0,$e())},ht=(D,R)=>{const ee=iG(D);return r.pane_join(ee.id,R!==void 0?r.group_of(R):ee.id),D==="tags"&&r.regard_subscribe(ee.id,q=>{q.modelKind==="dicom.instance"&&I(ee.id,q.address)}),D==="view"&&(r.viewer_mark(ee.id),r.regard_subscribe(ee.id,q=>{q.modelKind!=="dicom.instance"&&i.get("view",ee.id)?.regard_show(q)})),$.mount_register(ee.id,ee.mount),qs(ee.id,D,ee.mount),ee},{bar_note:Et,move:_s,flip:zs,resize:Aa,chordKeys_of:Dl}=lG(a),qs=yR(a,{verbs:{move:_s,chordKeys_of:Dl},browser:d,pillPane_spawn:te,process_open:(D,R)=>H(D,R),overlay_back:D=>Ze.back(D),home_apply:()=>$e(),orphans_dispose:()=>_e(),dag_dismiss:()=>{pe=!1}});qs("files","files",yt.mount),qs("dag","dag",ut.mount),qs("universe","universe",lt.mount),qs("pacs","pacs",Ye("pacs-workspace")),qs("launcher","launcher",Gt),qs("panes","panes",Bt);let Gn=!1;const ln=D=>{Gn=D};for(const D of["click","focusin"])document.addEventListener(D,R=>{R.target instanceof Element&&(R.target.closest("#drawer")!==null?Gn=!0:R.target.closest("#layout-root")!==null&&(Gn=!1))});const Lr=()=>{let D=!1;for(const R of document.querySelectorAll(".pane-drawer:not([hidden])"))R.hidden=!0,D=!0;return D},Wr=()=>{let D=!1;for(const R of document.querySelectorAll('.workspace-pane[data-modes="open"], [data-frame-host][data-modes="open"]'))delete R.dataset.modes,D=!0;return V.serverStrip_isOpen()&&(V.serverStrip_close(),D=!0),D};document.addEventListener("click",D=>{if(!(D.target instanceof Element)||D.target.closest(".mode-frame")!==null&&D.target.closest(".mode-fill")===null||D.target.closest("#pacs-server-strip")!==null||D.target.closest("#pacs-f-server")!==null||D.target.closest(".listing-framed .listing-row, .ask-bar")!==null)return;const R=D.target.closest(".mode-strip"),ee=R?.closest(".workspace-pane, [data-frame-host]")??null,q=ee?.dataset.modes==="open",se=Wr();if(R!==null&&ee!==null&&!q){ee.dataset.modes="open",Ns("audio3");return}se&&Ns("audio3")}),pR(a,{palette_isOpen:()=>!T.hidden,palette_open:()=>Y(),palette_close:()=>ve(),errand_abandon:()=>j.errand_abandon(),dive_leave:()=>o.dive_leave(),overlay_escape:()=>Ze.escape(),drawers_close:Lr,modeFrames_close:Wr,consoleFocused:()=>Gn,console_release:()=>ln(!1),verbs:{bar_note:Et,flip:zs,resize:Aa},host:()=>Fr,stage_alone:D=>{Ue(),$.tree_set({pane:D}),_e()},element_require:Ye});const cn=(D,R,ee)=>{if(R==="pacs"){$.preset_apply("pacs"),_e();for(const be of ee)V.envelope_observe(be);return}const q=ht(R);if($.leaf_replace(D,q.id),es(D),$.mount_remove(D),R==="tags"){const be=i.get("tags",q.id);for(const xe of ee){if(xe.model?.kind!==Da.tags)continue;const Ke=Oh.safeParse(xe.model.data);Ke.success&&be?.model_show(Ke.data)}return}if(R==="image"){const be=i.get("image",q.id);for(const xe of ee){if(xe.model?.kind!==Da.series)continue;const Ke=xh.safeParse(xe.model.data);Ke.success&&be?.series_show(Ke.data)}return}const se=R==="files"?i.get("files",q.id):i.get("dag",q.id);for(const be of ee)se?.envelope_observe(be)},Rn={instance_spawn:ht,birth_record:Te,launcher_yield:re,launcher_active:()=>$.activePreset_get()==="launcher",template_stamp:ks},kr=WG(a,Rn),Ur=kr.open,oi=aR(a,Rn),li=uR(a,{...Rn,ask:D=>Ve.line_execute(D,{silent:!0})}),Nn=EG(a,{...Rn,replayPlace_get:he.replayPlace_get,errandHost_find:Ft,saved:()=>{for(const D of i.values("dag"))D.marks_refresh()}});Os("files",D=>z(D,!1)),Os("catalogue",D=>z(D,!1,!0)),Os("dag",D=>Lt(D,!1)),Os("universe",b),Os("view",Xe),Os("image",v),Os("tags",E),Os("help",kr.instance_build),Os("games",oi.instance_build),Os("notes",li.instance_build),Os("edit",Nn.instance_build),Os("gather",ne),Os("empty",D=>{const R=ks("tpl-pane-empty");return new zI(R,{execute:ee=>Ve.line_execute(ee,{silent:!0,observe:!1}),claim:(ee,q)=>cn(D,ee,q)}),{id:D,kind:"empty",mount:R}});const Vi=D=>{D?document.body.dataset.gutter="away":delete document.body.dataset.gutter,Ns("audio3")},Bn=(D,R)=>{if($.activePreset_get()===D&&$.panes_shown().includes(D)){Vi(!0);return}document.body.dataset.gutter==="away"&&delete document.body.dataset.gutter,R()};Ye("gutter-restore").addEventListener("click",()=>Vi(!1)),window.addEventListener("keydown",D=>{D.key==="Escape"&&document.body.dataset.gutter==="away"&&document.body.dataset.zoom===void 0&&Vi(!1)}),Ye("gutter-files").addEventListener("click",()=>{Bn("files",()=>{pe=!1,$e(),$.focus_set("files"),ln(!1)})});const ci=(D="")=>{Me("dag"),xt.stage_returned(),xt.list_reset(),xt.roster_filter(D),xt.feedsChooser_request(),$.focus_set("dag"),ln(!1)},Tl=()=>{Me("universe");const D=i.get("universe","universe");D!==void 0&&!D.shown_get()&&D.request(),D?.stage_returned(),$.focus_set("universe"),ln(!1)};Ye("gutter-runs").addEventListener("click",()=>Bn("dag",()=>ci())),Ye("gutter-console").addEventListener("click",()=>{Ye("drawer").classList.contains("drawer-closed")&&Ye("drawer-toggle").click(),ge.focus_take(),ln(!0)}),Ye("gutter-tools").addEventListener("click",()=>{Bn("pacs",()=>{Me("pacs"),$.focus_set("pacs"),ln(!1)})}),Ye("gutter-dashboard").addEventListener("click",()=>{Bn("launcher",U)}),Ye("gutter-panes").addEventListener("click",()=>{Bn("panes",()=>{Me("panes"),Be.render(),$.focus_set("panes"),ln(!1)})});const Il=D=>Go(D)?.kind??null,Fr=vR(a,{verbs:{move:_s,flip:zs,resize:Aa},help_open:Ur,notes_open:li.open,launcher_enter:U,identity_get:()=>O,consoleZoom_toggle:vm,feed_enter:D=>xt.feed_enter(D),file_save:p,image_open:(D,R,ee)=>L(D,R,ee),series_ask:C,tagsPane_open:G}),T=Ye("lang-palette"),F=Ye("lang-input"),Q=Ye("lang-result"),K=Ye("lang-pill"),Y=()=>{Lr(),T.hidden=!1,K.classList.add("lang-live"),Q.textContent="",F.value="",F.focus(),Ns("audio3")},ve=()=>{T.hidden=!0,K.classList.remove("lang-live"),Q.textContent=""};K.addEventListener("click",()=>{T.hidden?Y():ve()});const De=["pane","view","runs","node","dag","file","pacs","header","console","back","desktop","argus","help","notes"],Oe={pane:["split","zoom","close","bind","claim","focus","flip","resize"],resize:["left","right","up","down"],help:["keys","verbs"],notes:["pane"],focus:["left","right","up","down","last"],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"]};F.addEventListener("keydown",D=>{if(D.key==="Escape"){D.stopPropagation(),ve();return}if(D.key==="Tab"){D.preventDefault();const R=F.value.split(/\s+/),ee=R[R.length-1]??"",q=R.length<=1?"":R[R.length-2]??"",be=(R.length<=1?De:Oe[q]??Oe[R[0]??""]??[]).find(xe=>xe.startsWith(ee.toLowerCase()));be!==void 0&&(R[R.length-1]=be,F.value=`${R.join(" ")} `);return}if(D.key==="Enter"){const R=F.value.trim();if(R.length===0){ve();return}ld(Fr,R).then(ee=>{ee!==null?(Q.textContent=ee,ge.output_write("data",`: ${R}
4286
+ `)[0]??"",bt=se.indicated_get();bt!==null&&se.rowReadout_show(bt,Zt===""?"NOT SCHEDULED":Zt.toUpperCase().slice(0,80))},qe=D=>{re();const R=new Set($.panes_shown());for(const[xe]of i.entries("files"))if(R.has(xe)&&r.regard_get(xe)?.address===D){$.focus_set(xe);return}let ee;for(const[xe,Ke]of i.entries("image"))if(R.has(xe)&&(r.regard_get(xe)?.address===D||Ke.state_get()?.path===D)){ee=xe;break}const q=Ft();if(q===null)return;const se=ht("files",ee);if(!$.leaf_split(q,he.replayPlace_get()?.dir??"col",se.id,he.replayPlace_get()?.before??!1)){es(se.id),$.mount_remove(se.id);return}Te(se.id,q,he.replayPlace_get()?.dir??"col",he.replayPlace_get()?.before??!1),ee===void 0&&r.regard_write(se.id,{address:D,modelKind:"dicom.series"});const be=i.get("files",se.id);be!==void 0&&f(se.id,be,D)},Pe=OG(a,{image_open:(D,R)=>W(D,R),process_open:(D,R)=>H(D,R),feed_open:(D,R)=>ce(D,R),ask_onPane:(D,R)=>x(D,R),errandHost_find:()=>Ft(),instance_spawn:(D,R)=>ht(D,R),birth_record:(D,R,ee,q)=>Te(D,R,ee,q),replayPlace_get:()=>he.replayPlace_get(),stage_relight:()=>Z(),home_apply:()=>$e(),orphans_dispose:()=>_e(),fileText_fetch:h,template_stamp:ks,pane_find:ds,element_require:Ye}),ne=Pe.instance_build,ae=Pe.gather,ue=Pe.open,Xe=D=>{const R=ks("tpl-pane-view");Hs(ds(R,".view-body"));const ee=new yI(ds(R,".view-body"),ds(R,".view-title"),{content_fetch:async q=>(await h(q)).text,imageUrl_build:c,path_isImage:bl});return i.set("view",D,ee),{id:D,kind:"view",mount:R,dispose:()=>{i.delete(D),r.pane_leave(D)}}},Ze=MG(a,{filesBody_stamp:_,rootedListing_show:f,rowVerbs_of:w,image_open:(D,R)=>W(D,R),imagery_is:ab,tableFile_is:D=>rb.test(D),vfsUrl_build:c,fileText_fetch:h,previewProvider:u}),Fe=Ze.open,Lt=(D,R)=>{const ee=ks("tpl-pane-dag"),q=new NT(ds(ee,".dag-canvas"),ds(ee,".dag-title"),ds(ee,".dag-facts"),ds(ee,".dag-empty"),ds(ee,".dag-strategy"),ds(ee,".dag-feedlist"),{command_run:se=>{Ve.line_execute(se,{silent:!0,observe:!1}).then(be=>{for(const xe of be.envelopes)q.envelope_observe(xe)})},watch_set:(se,be)=>{be?Ve.watch_send(se):Ve.unwatch_send(se)},node_enter:se=>{ge.line_run(`cd "${se}"`)},node_dive:se=>{Fe(D,se.replace(/\/data$/,""))},node_regard:se=>{r.regard_write(D,{address:se,modelKind:"feed.node"})},node_process:se=>{const be=Ma(se.vfsPath)??(/\/feed_(\d+)(?:\/|$)/.exec(se.vfsPath)===null?null:Number(/\/feed_(\d+)(?:\/|$)/.exec(se.vfsPath)[1])),xe=y===null?se.vfsPath:se.vfsPath.replace(/^\/proc\/jobs\//,`/home/${y}/feeds/`);H(D,{input:xe,feed:be,node:se.instanceId})},feed_regard:se=>{r.regard_write(D,{address:se,modelKind:"feed"})},...pm(a,D,ot),...R?{feed_shown:()=>Ge()}:{}});return i.set("dag",D,q),{id:D,kind:"dag",mount:ee,dispose:()=>{Ze.dispose(D),i.delete(D),r.pane_leave(D),q.dispose()}}},ot=CG(a,{ask_onPane:(D,R)=>x(D,R),promptUser:()=>y,changed:()=>{for(const D of i.values("dag"))D.roster_ask(),D.marks_refresh(),D.indicated_refresh()}}),yt=z("files",!0);gr(yt);const ut=Lt("dag",!0);gr(ut);const lt=b("universe");gr(lt);const Gt=ks("tpl-pane-launcher");gr({id:"launcher",kind:"launcher",mount:Gt});const Bt=ks("tpl-pane-panes");gr({id:"panes",kind:"panes",mount:Bt});const $t=i.get("files","files"),xt=i.get("dag","dag"),Ct=new eG(Ye("pipeline-cycler"),Ye("pipeline-cycler-name"),D=>{Ve.line_execute(D,{silent:!0})});let Pt=null;const j=_G(a,{instance_spawn:(D,R)=>ht(D,R),birth_record:(D,R,ee,q)=>Te(D,R,ee,q),replayPlace_get:()=>he.replayPlace_get(),rootedListing_show:f,console_expose:()=>Pt?.(!1)}),{errandHost_find:Ft,errand_open:vt,verbLine_run:N,ask_onPane:x}=j;Hs(Ye("pacs-workspace"),{rows:".listing-row"});const V=new gI(Ye("pacs-workspace"),{command_run:D=>{const R=/^(pacs query|pull )/.test(D);R&&ge.line_echo(D),Ve.line_execute(D,{silent:!0,operator:R}).then(ee=>{for(const q of ee.envelopes)V.envelope_observe(q)})},command_show:D=>{ge.line_run(D)},note:D=>ge.line_note(D),image_open:D=>{W(null,D).then(R=>ge.line_note(R))},dir_open:D=>qe(D),process_open:D=>H("pacs",{input:D,feed:null,node:null}),gather_add:D=>ae([D]),gathered_is:D=>Pe.has(D),workspace_close:()=>$e()});gr({id:"pacs",kind:"pacs",mount:Ye("pacs-workspace")});const Z=()=>{const D=new Set($.panes_shown()),R=new Map;for(const ee of Ro()){if(!D.has(ee.id))continue;const q=r.regard_get(ee.id)?.address;if(q===void 0)continue;const se=Il(ee.id);if(se!=="image"&&se!=="files")continue;const be=q.replace(/\/$/,""),xe=R.get(be)??{viewer:!1,browser:!1};se==="image"?xe.viewer=!0:xe.browser=!0,R.set(be,xe)}V.stage_lit(R)},$=new aG(Ye("layout-root"),new Map([["dag",ut.mount],["universe",lt.mount],["files",yt.mount],["pacs",Ye("pacs-workspace")],["launcher",Gt],["panes",Bt]]));let pe=!1;const ye=()=>pe?{dir:"col",ratio:.45,first:{pane:"files"},second:{pane:"dag"}}:{pane:"files"};$.preset_register("files",ye),$.preset_register("pacs",()=>({pane:"pacs"})),$.preset_register("dag",()=>({pane:"dag"})),$.preset_register("universe",()=>({pane:"universe"})),$.preset_register("panes",()=>({pane:"panes"})),$.preset_register("launcher",()=>({pane:"launcher"})),$.renderObserver_set(()=>{document.body.dataset.zoom==="launcher"&&!$.panes_shown().includes("launcher")&&Mi(null),window.requestAnimationFrame(()=>{for(const D of i.values("dag"))D.size_fit()})});const te=(D,R,ee,q)=>{const se=R==="view"?ht("view",D):R==="fs"?ht("files",D):ht("empty");if(!$.leaf_split(D,ee,se.id,q))return es(se.id),$.mount_remove(se.id),null;if(Te(se.id,D,ee,q,R),R==="fs"){const be=Ke=>{const tt=i.get("files",se.id);if(tt===void 0)return;const ft=Ke.modelKind==="fs.file"?Ke.address.replace(/\/[^/]*$/,"")||"/":Ke.address;f(se.id,tt,ft)};r.regard_subscribe(se.id,be);const xe=r.regard_get(D);xe!==null&&be(xe)}return se.id},ie=new Q0(Jm,Ah());Object.assign(globalThis,{__argusDormant:{list:()=>ie.list(),get:D=>ie.get(D),dismiss:D=>ie.dismiss(D)}});const he=dG(a,{image_open:W,dir_open:qe,process_open:H,gather_open:ue,feed_open:ce,edit_open:D=>Nn.edit_open(D),pillPane_spawn:te,pacsQuery_get:()=>V.query_get(),catalogue_of:D=>S.get(D),catalogueIds:()=>[...S.keys()],stage_relight:()=>Z()}),{birth_record:Te,domain_enter:Me,orphans_dispose:_e}=he,Ue=he.capture,je=he.restore,$e=()=>{Me("files"),xt.size_fit()},U=()=>{Me("launcher"),de.render(),$.focus_set("launcher"),Mi("launcher")},ze=(D=!1)=>{if(document.body.dataset.zoom!=="launcher"||(Mi(null),!D))return;const R=document.querySelector(".wrap:not(#gap)");R!==null&&oh(R,document.body),document.body.dataset.header="away",Pt?.(!0)},re=()=>{ze(),$.activePreset_get()==="launcher"&&(pe=!1,$e())};let we=!1;const Ee=_v({ask:D=>Ve.line_execute(D,{silent:!0,observe:!1}),universe_show:()=>Tl(),runs_show:D=>ci(D),feed_enter:D=>{ci(),i.get("dag","dag")?.feed_enter(D)},home_open:()=>{pe=!1,$e(),$.focus_set("files")},home_cd:D=>{pe=!1,$e(),ge.line_run(`cd "${D}"`)},line_offer:D=>ge.line_offer(D),pacs_query:()=>V.query_get()??"",pacs_open:()=>{Me("pacs"),$.focus_set("pacs")},desktops:()=>ie.list(),desktop_restore:D=>{je(D)},panes_open:()=>{Me("panes"),Be.render(),$.focus_set("panes")},keys_open:()=>{Ur()},notes_open:()=>{li.open()},notes_latest:()=>li.latest(),daemon_stale:()=>we,console_open:()=>Ye("gutter-console").click()}),de=new nv(Gt,{tiles:Ee,leave:()=>ze(!0),startHere_get:Dm,startHere_set:JR});setInterval(()=>{$.activePreset_get()==="launcher"&&(!Gt.isConnected||document.visibilityState!=="visible"||de.render())},QR),Hs(ds(Bt,".panes-body"),{rows:".panes-card"});const Be=new J0(Bt,{list:()=>ie.list(),restore:D=>{je(D)},dismiss:D=>{ie.dismiss(D)}}),Ge=()=>{const D=$.activePreset_get();if(D==="pacs"||D==="dag"||D==="launcher"){pe=!0;return}pe&&D==="files"||(pe=!0,$e())},ht=(D,R)=>{const ee=iG(D);return r.pane_join(ee.id,R!==void 0?r.group_of(R):ee.id),D==="tags"&&r.regard_subscribe(ee.id,q=>{q.modelKind==="dicom.instance"&&I(ee.id,q.address)}),D==="view"&&(r.viewer_mark(ee.id),r.regard_subscribe(ee.id,q=>{q.modelKind!=="dicom.instance"&&i.get("view",ee.id)?.regard_show(q)})),$.mount_register(ee.id,ee.mount),qs(ee.id,D,ee.mount),ee},{bar_note:Et,move:_s,flip:zs,resize:Aa,chordKeys_of:Dl}=lG(a),qs=yR(a,{verbs:{move:_s,chordKeys_of:Dl},browser:d,pillPane_spawn:te,process_open:(D,R)=>H(D,R),overlay_back:D=>Ze.back(D),home_apply:()=>$e(),orphans_dispose:()=>_e(),dag_dismiss:()=>{pe=!1}});qs("files","files",yt.mount),qs("dag","dag",ut.mount),qs("universe","universe",lt.mount),qs("pacs","pacs",Ye("pacs-workspace")),qs("launcher","launcher",Gt),qs("panes","panes",Bt);let Gn=!1;const ln=D=>{Gn=D};for(const D of["click","focusin"])document.addEventListener(D,R=>{R.target instanceof Element&&(R.target.closest("#drawer")!==null?Gn=!0:R.target.closest("#layout-root")!==null&&(Gn=!1))});const Lr=()=>{let D=!1;for(const R of document.querySelectorAll(".pane-drawer:not([hidden])"))R.hidden=!0,D=!0;return D},Wr=()=>{let D=!1;for(const R of document.querySelectorAll('.workspace-pane[data-modes="open"], [data-frame-host][data-modes="open"]'))delete R.dataset.modes,D=!0;return V.serverStrip_isOpen()&&(V.serverStrip_close(),D=!0),D};document.addEventListener("click",D=>{if(!(D.target instanceof Element)||D.target.closest(".mode-frame")!==null&&D.target.closest(".mode-fill")===null||D.target.closest("#pacs-server-strip")!==null||D.target.closest("#pacs-f-server")!==null||D.target.closest(".listing-framed .listing-row, .ask-bar")!==null)return;const R=D.target.closest(".mode-strip"),ee=R?.closest(".workspace-pane, [data-frame-host]")??null,q=ee?.dataset.modes==="open",se=Wr();if(R!==null&&ee!==null&&!q){ee.dataset.modes="open",Ns("audio3");return}se&&Ns("audio3")}),pR(a,{palette_isOpen:()=>!T.hidden,palette_open:()=>Y(),palette_close:()=>ve(),errand_abandon:()=>j.errand_abandon(),dive_leave:()=>o.dive_leave(),overlay_escape:()=>Ze.escape(),drawers_close:Lr,modeFrames_close:Wr,consoleFocused:()=>Gn,console_release:()=>ln(!1),verbs:{bar_note:Et,flip:zs,resize:Aa},host:()=>Fr,stage_alone:D=>{Ue(),$.tree_set({pane:D}),_e()},element_require:Ye});const cn=(D,R,ee)=>{if(R==="pacs"){$.preset_apply("pacs"),_e();for(const be of ee)V.envelope_observe(be);return}const q=ht(R);if($.leaf_replace(D,q.id),es(D),$.mount_remove(D),R==="tags"){const be=i.get("tags",q.id);for(const xe of ee){if(xe.model?.kind!==Da.tags)continue;const Ke=Oh.safeParse(xe.model.data);Ke.success&&be?.model_show(Ke.data)}return}if(R==="image"){const be=i.get("image",q.id);for(const xe of ee){if(xe.model?.kind!==Da.series)continue;const Ke=xh.safeParse(xe.model.data);Ke.success&&be?.series_show(Ke.data)}return}const se=R==="files"?i.get("files",q.id):i.get("dag",q.id);for(const be of ee)se?.envelope_observe(be)},Rn={instance_spawn:ht,birth_record:Te,launcher_yield:re,launcher_active:()=>$.activePreset_get()==="launcher",template_stamp:ks},kr=WG(a,Rn),Ur=kr.open,oi=aR(a,Rn),li=uR(a,{...Rn,ask:D=>Ve.line_execute(D,{silent:!0})}),Nn=EG(a,{...Rn,replayPlace_get:he.replayPlace_get,errandHost_find:Ft,saved:()=>{for(const D of i.values("dag"))D.marks_refresh()}});Os("files",D=>z(D,!1)),Os("catalogue",D=>z(D,!1,!0)),Os("dag",D=>Lt(D,!1)),Os("universe",b),Os("view",Xe),Os("image",v),Os("tags",E),Os("help",kr.instance_build),Os("games",oi.instance_build),Os("notes",li.instance_build),Os("edit",Nn.instance_build),Os("gather",ne),Os("empty",D=>{const R=ks("tpl-pane-empty");return new zI(R,{execute:ee=>Ve.line_execute(ee,{silent:!0,observe:!1}),claim:(ee,q)=>cn(D,ee,q)}),{id:D,kind:"empty",mount:R}});const Vi=D=>{D?document.body.dataset.gutter="away":delete document.body.dataset.gutter,Ns("audio3")},Bn=(D,R)=>{if($.activePreset_get()===D&&$.panes_shown().includes(D)){Vi(!0);return}document.body.dataset.gutter==="away"&&delete document.body.dataset.gutter,R()};Ye("gutter-restore").addEventListener("click",()=>Vi(!1)),window.addEventListener("keydown",D=>{D.key==="Escape"&&document.body.dataset.gutter==="away"&&document.body.dataset.zoom===void 0&&Vi(!1)}),Ye("gutter-files").addEventListener("click",()=>{Bn("files",()=>{pe=!1,$e(),$.focus_set("files"),ln(!1)})});const ci=(D="")=>{Me("dag"),xt.stage_returned(),xt.list_reset(),xt.roster_filter(D),xt.feedsChooser_request(),$.focus_set("dag"),ln(!1)},Tl=()=>{Me("universe");const D=i.get("universe","universe");D!==void 0&&!D.shown_get()&&D.request(),D?.stage_returned(),$.focus_set("universe"),ln(!1)};Ye("gutter-runs").addEventListener("click",()=>Bn("dag",()=>ci())),Ye("gutter-console").addEventListener("click",()=>{Ye("drawer").classList.contains("drawer-closed")&&Ye("drawer-toggle").click(),ge.focus_take(),ln(!0)}),Ye("gutter-tools").addEventListener("click",()=>{Bn("pacs",()=>{Me("pacs"),$.focus_set("pacs"),ln(!1)})}),Ye("gutter-dashboard").addEventListener("click",()=>{Bn("launcher",U)}),Ye("gutter-panes").addEventListener("click",()=>{Bn("panes",()=>{Me("panes"),Be.render(),$.focus_set("panes"),ln(!1)})});const Il=D=>Go(D)?.kind??null,Fr=vR(a,{verbs:{move:_s,flip:zs,resize:Aa},help_open:Ur,notes_open:li.open,launcher_enter:U,identity_get:()=>O,consoleZoom_toggle:vm,feed_enter:D=>xt.feed_enter(D),file_save:p,image_open:(D,R,ee)=>W(D,R,ee),series_ask:C,tagsPane_open:G}),T=Ye("lang-palette"),F=Ye("lang-input"),Q=Ye("lang-result"),K=Ye("lang-pill"),Y=()=>{Lr(),T.hidden=!1,K.classList.add("lang-live"),Q.textContent="",F.value="",F.focus(),Ns("audio3")},ve=()=>{T.hidden=!0,K.classList.remove("lang-live"),Q.textContent=""};K.addEventListener("click",()=>{T.hidden?Y():ve()});const De=["pane","view","runs","node","dag","file","pacs","header","console","back","desktop","argus","help","notes"],Oe={pane:["split","zoom","close","bind","claim","focus","flip","resize"],resize:["left","right","up","down"],help:["keys","verbs"],notes:["pane"],focus:["left","right","up","down","last"],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"]};F.addEventListener("keydown",D=>{if(D.key==="Escape"){D.stopPropagation(),ve();return}if(D.key==="Tab"){D.preventDefault();const R=F.value.split(/\s+/),ee=R[R.length-1]??"",q=R.length<=1?"":R[R.length-2]??"",be=(R.length<=1?De:Oe[q]??Oe[R[0]??""]??[]).find(xe=>xe.startsWith(ee.toLowerCase()));be!==void 0&&(R[R.length-1]=be,F.value=`${R.join(" ")} `);return}if(D.key==="Enter"){const R=F.value.trim();if(R.length===0){ve();return}ld(Fr,R).then(ee=>{ee!==null?(Q.textContent=ee,ge.output_write("data",`: ${R}
4287
4287
  ${ee}
4288
4288
  `),F.value="",F.select()):(ve(),ge.line_run(R))})}}),Dm()?($.preset_apply("launcher"),de.render()):$.preset_apply($.savedPreset_get()??"files");const Ne=Ye("drawer-status"),Re=D=>{Ne.textContent=`MODE: [${D}]`};hz(document.documentElement);const ge=new gz(Ye("terminal"),async D=>{const R=await ld(Fr,D);if(R!==null){ge.output_write("data",`${R}
4289
4289
  `),ge.prompt_draw(),Re("READY");return}Re("BUSY");const ee=performance.now();try{const q=await Ve.line_execute(D);ge.outcome_write(q);for(const se of q.envelopes)se.model?.kind==="games.say"&&Am(se.model.data),se.model?.kind==="games.show"&&ge.line_note(oi.show(se.model.data));q.envelopes.some(se=>se.model?.kind==="fs.cwd")&&Ve.line_execute("ls",{silent:!0})}catch(q){const se=q instanceof Error?q.message:String(q);ge.output_write("err",`\x1B[31m${se}\x1B[0m
4290
- `)}nt.clear(),e.activity_clear(),Re(`READY ${Math.round(performance.now()-ee)}ms`),ge.prompt_draw()},D=>Ve.line_complete(D));EI(D=>ge.line_note(D));const nt=new zz(ge.progressRegion_get(),D=>ge.output_write("err",D)),Ce=NR({unsaved:()=>[...i.values("edit")].filter(D=>D.dirty_is()).map(D=>D.path_get()??"?")}),zt=AR(e,D=>ge.line_note(D),Ce.ask),At=await _u.session_attach(UR(),n,{output_receive:(D,R)=>ge.output_write(D,R),progress_receive:D=>{nt.write(D),e.progress_observe(D),_r?.progress_observe(D);for(const R of i.values("dag"))R.progress_observe(D);V.progress_observe(D)},ask_receive:async D=>{if(D.kind!=="path"){const q=j.askingPane_take();return q!==null&&Go(q)!==void 0?x(q,{message:D.message,kind:D.kind==="secret"?"secret":D.kind==="confirm"?"confirm":"text",...D.suggest===void 0?{}:{suggest:D.suggest}}):(Pt?.(!1),ge.ask_open({message:D.message,kind:D.kind,...D.suggest===void 0?{}:{suggest:D.suggest}}))}const R=ge.ask_note(D.message),ee=await vt(D);return R(ee),ee},edit_receive:D=>Nn.edit_receive(D),promptline_receive:D=>{y=D.user,O=D.uri===""?D.user:`${D.user}@${D.uri}`,Object.assign(globalThis,{__argusPromptContext:D,__argusPromptContext_show:R=>e.promptContext_show(R)}),ge.promptContext_set(D),e.promptContext_show(D),t.promptContext_show(D),_r?.promptContext_observe(D),xt.promptContext_observe(D);for(const R of i.values("universe"))R.promptContext_observe(D);for(const R of i.values("files"))R.home_set(D.user===""?null:`/home/${D.user}`)},telemetry_receive:(D,R)=>{t.counts_show(D),R?.state!==void 0&&t.state_show(R.state),s.telemetry_show(R??{}),Ce.telemetry_take(R),R?.cube!==void 0&&t.pace_show(R.cube.msPerPage),_r?.index_observe(D)},session_receive:(D,R)=>ge.session_write(D,R),ambient_receive:D=>{if(D.model?.kind==="games.chime"){const ee=D.model.data?.text;typeof ee=="string"&&(ge.line_note(`🔔 ${ee}`),Am({text:ee}));return}if(D.model?.kind==="fs.listing"){$t.ambient_observe(D);for(const ee of i.values("files"))ee.ambient_observe(D);return}if(D.model?.kind!=="feed.dag")return;const R=Zc.safeParse(D.model.data);if(R.success){xt.model_refresh(R.data);for(const ee of i.values("dag"))ee.model_refresh(R.data);for(const ee of i.values("universe"))ee.model_refresh(R.data)}},stale_receive:D=>{we=D,zt.stale_take(D)},closing_receive:D=>Ce.closing_take(D),watched_receive:(D,R)=>{xt.watched_observe(D,R);for(const ee of i.values("dag"))ee.watched_observe(D,R);for(const ee of i.values("universe"))ee.watched_observe(D,R)},numbered_receive:D=>{Pz({source:D.source,handles:D.handles})},envelope_observe:D=>{const R=D.model?.kind;if(R===G0.view){const ee=I0.safeParse(D.model?.data);ee.success&&L($.focused_get(),ee.data.path,ee.data.force===!0?{force:!0}:{}).then(q=>ge.line_note(q));return}if(R==="feed.dag"||R==="feed.list"||R===Kn.feedIndexing){const ee=$.focused_get();(ee!==null&&i.has("dag",ee)?i.get("dag",ee):xt).envelope_observe(D)}else{for(const[ee,q]of i.entries("files"))d.follows(ee)&&q.envelope_observe(D);if(V.envelope_observe(D),R==="fs.rm"||R==="fs.mv"||R==="fs.cp")for(const[ee,q]of i.entries("files")){const se=q.path_current();se!==null&&M(ee,se)}}Ct.envelope_observe(D)},close_handle:()=>{e.connection_show(!1),_r?.connection_show(!1),Re("OFFLINE")}}),Ve=At.client;e.attach_show(At.attach),we=At.attach.stale===!0,zt.attach_take(At.attach),Ce.attach_take(At.attach),e.connection_show(!0),_r?.connection_show(!0),i7(At.attach),tG(Ve,Ct),Ve.line_execute("ls",{silent:!0}),$.activePreset_get()==="launcher"&&de.render(),lh=Pe.stage,Pe.annunciate(),Pe.restore(),Re("READY"),ge.splash_write(CR),ge.prompt_draw(),ge.focus_take(),BR(Ve,ge,PR,zt.release),Pt=jR(Ye("drawer"),Ye("drawer-strip"),Ye("drawer-toggle"),ge);const Mt=Ye("console-drawer");Ye("console-handle").addEventListener("click",D=>{D.target instanceof Element&&D.target.closest("button")!==null||(Mt.hidden=!Mt.hidden,Mt.hidden||Mt.querySelector("button")?.focus(),Ns("audio3"))}),Mt.querySelector(".console-retract")?.addEventListener("click",()=>{Mt.hidden=!0,Ye("drawer-toggle").click()}),Mi=$R(ge),Ye("console-handle").addEventListener("dblclick",D=>{D.target instanceof Element&&D.target.closest("button")!==null||(window.getSelection()?.removeAllRanges(),vm())}),Ye("drawer-toggle").addEventListener("click",()=>{document.body.dataset.zoom==="console"&&Mi(null)},{capture:!0}),$.activePreset_get()==="launcher"&&Mi("launcher"),r7(),window.addEventListener("resize",()=>ge.size_fit())}function o7(){_r=VR(),ZR(),XR(),WR(),kR(),n7(),DR();const e=new URLSearchParams(window.location.search).get("token"),t=ml(window.location.search),s=Ye("attach-form"),i=Ye("attach-error"),r=o=>{a7(o).then(()=>{s.classList.add("attach-hidden")},l=>{s.classList.remove("attach-hidden"),i.textContent=l instanceof Error?l.message:String(l)})},a=Ye("attach-token");Ye("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(""))}o7();export{Ph as I,cu as _,l7 as b};
4290
+ `)}nt.clear(),e.activity_clear(),Re(`READY ${Math.round(performance.now()-ee)}ms`),ge.prompt_draw()},D=>Ve.line_complete(D));EI(D=>ge.line_note(D));const nt=new zz(ge.progressRegion_get(),D=>ge.output_write("err",D)),Ce=NR({unsaved:()=>[...i.values("edit")].filter(D=>D.dirty_is()).map(D=>D.path_get()??"?")}),zt=AR(e,D=>ge.line_note(D),Ce.ask),At=await _u.session_attach(UR(),n,{output_receive:(D,R)=>ge.output_write(D,R),progress_receive:D=>{nt.write(D),e.progress_observe(D),_r?.progress_observe(D);for(const R of i.values("dag"))R.progress_observe(D);V.progress_observe(D)},ask_receive:async D=>{if(D.kind!=="path"){const q=j.askingPane_take();return q!==null&&Go(q)!==void 0?x(q,{message:D.message,kind:D.kind==="secret"?"secret":D.kind==="confirm"?"confirm":"text",...D.suggest===void 0?{}:{suggest:D.suggest}}):(Pt?.(!1),ge.ask_open({message:D.message,kind:D.kind,...D.suggest===void 0?{}:{suggest:D.suggest}}))}const R=ge.ask_note(D.message),ee=await vt(D);return R(ee),ee},edit_receive:D=>Nn.edit_receive(D),promptline_receive:D=>{y=D.user,O=D.uri===""?D.user:`${D.user}@${D.uri}`,Object.assign(globalThis,{__argusPromptContext:D,__argusPromptContext_show:R=>e.promptContext_show(R)}),ge.promptContext_set(D),e.promptContext_show(D),t.promptContext_show(D),_r?.promptContext_observe(D),xt.promptContext_observe(D);for(const R of i.values("universe"))R.promptContext_observe(D);for(const R of i.values("files"))R.home_set(D.user===""?null:`/home/${D.user}`)},telemetry_receive:(D,R)=>{t.counts_show(D),R?.state!==void 0&&t.state_show(R.state),s.telemetry_show(R??{}),Ce.telemetry_take(R),R?.cube!==void 0&&t.pace_show(R.cube.msPerPage),_r?.index_observe(D)},session_receive:(D,R)=>ge.session_write(D,R),ambient_receive:D=>{if(D.model?.kind==="games.chime"){const ee=D.model.data?.text;typeof ee=="string"&&(ge.line_note(`🔔 ${ee}`),Am({text:ee}));return}if(D.model?.kind==="fs.listing"){$t.ambient_observe(D);for(const ee of i.values("files"))ee.ambient_observe(D);return}if(D.model?.kind!=="feed.dag")return;const R=Zc.safeParse(D.model.data);if(R.success){xt.model_refresh(R.data);for(const ee of i.values("dag"))ee.model_refresh(R.data);for(const ee of i.values("universe"))ee.model_refresh(R.data)}},stale_receive:D=>{we=D,zt.stale_take(D)},closing_receive:D=>Ce.closing_take(D),watched_receive:(D,R)=>{xt.watched_observe(D,R);for(const ee of i.values("dag"))ee.watched_observe(D,R);for(const ee of i.values("universe"))ee.watched_observe(D,R)},numbered_receive:D=>{Pz({source:D.source,handles:D.handles})},envelope_observe:D=>{const R=D.model?.kind;if(R===G0.view){const ee=I0.safeParse(D.model?.data);ee.success&&W($.focused_get(),ee.data.path,ee.data.force===!0?{force:!0}:{}).then(q=>ge.line_note(q));return}if(R==="feed.dag"||R==="feed.list"||R===Kn.feedIndexing){const ee=$.focused_get();(ee!==null&&i.has("dag",ee)?i.get("dag",ee):xt).envelope_observe(D)}else{for(const[ee,q]of i.entries("files"))d.follows(ee)&&q.envelope_observe(D);if(V.envelope_observe(D),R==="fs.rm"||R==="fs.mv"||R==="fs.cp")for(const[ee,q]of i.entries("files")){const se=q.path_current();se!==null&&M(ee,se)}}Ct.envelope_observe(D)},close_handle:()=>{e.connection_show(!1),_r?.connection_show(!1),Re("OFFLINE")}}),Ve=At.client;e.attach_show(At.attach),we=At.attach.stale===!0,zt.attach_take(At.attach),Ce.attach_take(At.attach),e.connection_show(!0),_r?.connection_show(!0),i7(At.attach),tG(Ve,Ct),Ve.line_execute("ls",{silent:!0}),$.activePreset_get()==="launcher"&&de.render(),lh=Pe.stage,Pe.annunciate(),Pe.restore(),Re("READY"),ge.splash_write(CR),ge.prompt_draw(),ge.focus_take(),BR(Ve,ge,PR,zt.release),Pt=jR(Ye("drawer"),Ye("drawer-strip"),Ye("drawer-toggle"),ge);const Mt=Ye("console-drawer");Ye("console-handle").addEventListener("click",D=>{D.target instanceof Element&&D.target.closest("button")!==null||(Mt.hidden=!Mt.hidden,Mt.hidden||Mt.querySelector("button")?.focus(),Ns("audio3"))}),Mt.querySelector(".console-retract")?.addEventListener("click",()=>{Mt.hidden=!0,Ye("drawer-toggle").click()}),Mi=$R(ge),Ye("console-handle").addEventListener("dblclick",D=>{D.target instanceof Element&&D.target.closest("button")!==null||(window.getSelection()?.removeAllRanges(),vm())}),Ye("drawer-toggle").addEventListener("click",()=>{document.body.dataset.zoom==="console"&&Mi(null)},{capture:!0}),$.activePreset_get()==="launcher"&&Mi("launcher"),r7(),window.addEventListener("resize",()=>ge.size_fit())}function o7(){_r=VR(),ZR(),XR(),WR(),kR(),n7(),DR();const e=new URLSearchParams(window.location.search).get("token"),t=ml(window.location.search),s=Ye("attach-form"),i=Ye("attach-error"),r=o=>{a7(o).then(()=>{s.classList.add("attach-hidden")},l=>{s.classList.remove("attach-hidden"),i.textContent=l instanceof Error?l.message:String(l)})},a=Ye("attach-token");Ye("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(""))}o7();export{Ph as I,cu as _,l7 as b};