@liveroom-tech/react-immersive 6.0.2 → 6.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (67) hide show
  1. package/README.md +24 -0
  2. package/dist/AnimationsTab-NUJTEMZ5.mjs +1 -0
  3. package/dist/AnnotationsTab-OHRVWRKI.mjs +1 -0
  4. package/dist/CinematicTab-IJAY2BS6.mjs +1 -0
  5. package/dist/ConfigureTab-UQRRATCY.mjs +6 -0
  6. package/dist/RulesTab-YVBZGJZX.mjs +1 -0
  7. package/dist/SequencesTab-IC5LWQ6N.css +1 -0
  8. package/dist/SequencesTab-RPJAG26Z.mjs +1 -0
  9. package/dist/binding-builder.css +1 -1
  10. package/dist/binding-builder.d.mts +3 -3
  11. package/dist/binding-builder.d.ts +3 -3
  12. package/dist/binding-builder.js +76 -23
  13. package/dist/binding-builder.mjs +1 -1
  14. package/dist/chunk-2DV2UCQH.mjs +1 -0
  15. package/dist/chunk-37YITTIK.mjs +1 -0
  16. package/dist/chunk-5FLX45O5.mjs +2 -0
  17. package/dist/chunk-6CTCV2Q5.mjs +1 -0
  18. package/dist/chunk-7JCFNZJM.mjs +1 -0
  19. package/dist/chunk-7OWHW66D.mjs +1 -0
  20. package/dist/chunk-AL6UIGWP.mjs +1 -0
  21. package/dist/chunk-BNKTI3CY.mjs +1 -0
  22. package/dist/chunk-CCBFMNAU.mjs +1 -0
  23. package/dist/chunk-E24EFHB5.mjs +1 -0
  24. package/dist/chunk-EV6THDXD.mjs +1 -0
  25. package/dist/chunk-F5QSXMME.mjs +1 -0
  26. package/dist/chunk-FGAJ2UT7.mjs +1 -0
  27. package/dist/chunk-FXV4CLAK.mjs +1 -0
  28. package/dist/chunk-GV4ZRXL6.mjs +1 -0
  29. package/dist/chunk-KHN55ZM7.mjs +3 -0
  30. package/dist/chunk-LX3GXQNU.mjs +1 -0
  31. package/dist/chunk-OPZJDP7T.mjs +1 -0
  32. package/dist/chunk-OREKYGO3.mjs +83 -0
  33. package/dist/chunk-PBVBZYOG.mjs +47 -0
  34. package/dist/chunk-T6AYLPCC.mjs +1 -0
  35. package/dist/hosted.css +1 -1
  36. package/dist/hosted.d.mts +22 -6
  37. package/dist/hosted.d.ts +22 -6
  38. package/dist/hosted.js +75 -22
  39. package/dist/hosted.mjs +1 -1
  40. package/dist/index.css +1 -1
  41. package/dist/index.d.mts +66 -6
  42. package/dist/index.d.ts +66 -6
  43. package/dist/index.js +69 -21
  44. package/dist/index.mjs +1 -1
  45. package/dist/{modelFileResolver-Co7j1tdQ.d.mts → modelFileResolver-BEW_95id.d.mts} +52 -7
  46. package/dist/{modelFileResolver-Co7j1tdQ.d.ts → modelFileResolver-BEW_95id.d.ts} +52 -7
  47. package/dist/{modelViewerProps-BibuMND7.d.ts → modelViewerProps-C7saa0i2.d.mts} +173 -3
  48. package/dist/{modelViewerProps-Ce4-wb57.d.mts → modelViewerProps-CbK_4uZj.d.ts} +173 -3
  49. package/dist/{publicProps-BaJHCDa_.d.mts → publicProps-NKTiohZO.d.mts} +1 -1
  50. package/dist/{publicProps-CP18d_mt.d.ts → publicProps-z7cJhUH8.d.ts} +1 -1
  51. package/dist/simple-model-viewer.css +1 -1
  52. package/dist/simple-model-viewer.d.mts +25 -3
  53. package/dist/simple-model-viewer.d.ts +25 -3
  54. package/dist/simple-model-viewer.js +49 -3
  55. package/dist/simple-model-viewer.mjs +1 -1
  56. package/dist/utils.d.mts +47 -4
  57. package/dist/utils.d.ts +47 -4
  58. package/dist/utils.js +2 -2
  59. package/dist/utils.mjs +1 -1
  60. package/package.json +5 -1
  61. package/dist/chunk-33SUWPXC.mjs +0 -3
  62. package/dist/chunk-4JMJALRO.mjs +0 -2
  63. package/dist/chunk-EIBW7ZJE.mjs +0 -81
  64. package/dist/chunk-KFTJMFYF.mjs +0 -1
  65. package/dist/chunk-OTSCPJWF.mjs +0 -1
  66. package/dist/chunk-P2JZ5Z7I.mjs +0 -1
  67. package/dist/chunk-V7WZUWJ5.mjs +0 -1
@@ -1 +0,0 @@
1
- import{a as i}from"./chunk-MMO7KCYU.mjs";import{H as n}from"./chunk-EIBW7ZJE.mjs";var a={licenseKey:!0,arHandoff:!0,mobileHandoffUrl:!0,dracoDecoderPath:!0,ktx2TranscoderPath:!0,meshopt:!0,hideLicenseCheckingOverlay:!0},d={licenseValidationUrl:!0,onObjectEditLeaseChange:!0,onSelectionClear:!0,onSceneLoaded:!0,onTexturePositioningChange:!0,endTexturePositioningRef:!0};function f(e,t){let o={};for(let r of Object.keys(t))r in e&&(o[r]=e[r]);return o}function s(e,t){let o={...e};for(let r of Object.keys(t))delete o[r];return o}import{jsx as c}from"react/jsx-runtime";function l(e){return i("model-viewer","ModelViewer"),c(n,{...s(e,d)})}export{a,f as b,l as c};
@@ -1 +0,0 @@
1
- import{F as w,N as ne,O as se,P as oe,a as Y,e as K,k as q,l as J,m as E,o as Q,p as ee,t as te,u as re}from"./chunk-V7WZUWJ5.mjs";import{createContext as nt,useContext as st,useMemo as ot}from"react";import{jsx as at}from"react/jsx-runtime";var ae=nt(void 0);function Hr({labels:e,children:t}){return at(ae.Provider,{value:e,children:t})}function ie(){let e=st(ae);return ot(()=>Object.assign((t,r)=>q(e,t,r),{message:t=>J(e,t)}),[e])}import{strFromU8 as it,strToU8 as ut,unzip as lt}from"fflate";var ue;function le(e){ue=e}function v(e){ue?.(e)}var ct=[".glb",".gltf",".obj",".fbx",".usdz",".stl",".ply",".zip"],pt=["model/gltf-binary","model/gltf+json","model/vnd.usdz+zip","application/vnd.usdz+zip","application/zip","application/x-zip-compressed"],y=1024*1024,ce=128*y,pe=1024,de=128*y,fe=256*y,me=200,dt=y,b=new Map,Jr=".glb,.gltf,.obj,.fbx,.usdz,.stl,.ply,.zip,model/gltf-binary,model/gltf+json,model/vnd.usdz+zip,application/vnd.usdz+zip,application/zip";function k(e){let t=e.split(/[?#]/,1)[0].toLowerCase();return t.endsWith(".obj")?"obj":t.endsWith(".fbx")?"fbx":t.endsWith(".usdz")?"usdz":t.endsWith(".stl")?"stl":t.endsWith(".ply")?"ply":t.endsWith(".gltf")?"gltf":"glb"}function ve(e){return b.get(e)??{format:k(e)}}function ft(e){let t=e.name.toLowerCase();return ct.some(r=>t.endsWith(r))||pt.includes(e.type)}async function Qr(e){if(!ft(e))throw new Error("Unsupported model file. Please upload a .glb, .gltf, .obj, .fbx, .usdz, .stl, .ply, or .zip asset.");let t=e.name.toLowerCase();if(t.endsWith(".usdz")||e.type==="model/vnd.usdz+zip"||e.type==="application/vnd.usdz+zip")return be(e,"usdz");if(t.endsWith(".zip")||mt(e.type))return bt(e);if(t.endsWith(".gltf")||e.type==="model/gltf+json")return he(e);let r=k(e.name);return r==="gltf"?he(e):be(e,r)}function be(e,t){let r=URL.createObjectURL(e);return b.set(r,{format:t,entryPath:e.name,sourceBytes:e.size}),{url:r,name:e.name,format:t,cleanup:()=>{v(r),b.delete(r),URL.revokeObjectURL(r)}}}function mt(e){return e==="application/zip"||e==="application/x-zip-compressed"}async function he(e){let t=await e.text(),r=ye(t,e.name);for(let s of Me(r))if(!C(s))throw new Error(`${e.name} references external assets. Upload a .zip containing the .gltf file and its dependencies.`);let n=URL.createObjectURL(e);return b.set(n,{format:"gltf",entryPath:e.name,sourceBytes:e.size}),{url:n,name:e.name,format:"gltf",cleanup:()=>{v(n),b.delete(n),URL.revokeObjectURL(n)}}}async function bt(e){if(e.size>ce)throw new Error(`Model zip is too large. The compressed archive must be ${T(ce)} or smaller.`);let t=await ht(new Uint8Array(await e.arrayBuffer())),r=new Map;for(let[a,i]of Object.entries(t)){let u=U(a);!u||we(u)||r.set(u,i)}let n=[...r.keys()].filter(a=>/\.(gltf|obj|fbx|stl|ply)$/i.test(a));if(n.length===0)throw new Error("Invalid model zip: no .gltf, .obj, .fbx, .stl, or .ply file found.");if(n.length>1)throw new Error("Invalid model zip: multiple model entry files found.");let s=n[0],o=k(s);if(o==="gltf")return vt(e,s,r);if(o==="obj"||o==="fbx"||o==="stl"||o==="ply")return gt(e,s,o,r);throw new Error(`Unsupported model entry ${s}.`)}function ht(e){return new Promise((t,r)=>{let n=0,s=0,o=null,a=u=>(o??(o=new Error(`Invalid model zip: ${u}`)),!1);lt(e,{filter:u=>{if(o)return!1;if(n+=1,n>pe)return a(`archive contains more than ${pe.toLocaleString()} entries.`);if(u.originalSize>de)return a(`${u.name} expands beyond the ${T(de)} per-file limit.`);if(s+=u.originalSize,s>fe)return a(`expanded contents exceed ${T(fe)}.`);if(u.originalSize>=dt&&(u.size===0||u.originalSize/u.size>me))return a(`${u.name} exceeds the ${me}:1 compression-ratio limit.`);let l=U(u.name);return!!l&&!we(l)}},(u,l)=>{o?r(o):u?r(new Error(`Invalid model zip: ${u.message}`)):t(l)})})}function T(e){return`${e/y} MiB`}function gt(e,t,r,n){let s=[],o={};for(let[i,u]of n){let l=URL.createObjectURL(new Blob([u],{type:xe(i)}));s.push(l),o[i]=l}let a=o[t];if(!a)throw s.forEach(i=>URL.revokeObjectURL(i)),new Error(`Invalid model zip: could not read ${t}.`);return b.set(a,{format:r,entryPath:t,resourceUrls:o}),{url:a,name:e.name,format:r,cleanup:()=>{v(a),b.delete(a),s.forEach(i=>URL.revokeObjectURL(i))}}}function vt(e,t,r){let n=r.get(t);if(!n)throw new Error("Invalid GLTF zip: no .gltf found.");let s=ye(it(n),t);yt(s,t);let o=Mt(t),a=[];try{ge(s.buffers,o,r,a),ge(s.images,o,r,a);let i=new Blob([ut(JSON.stringify(s))],{type:"model/gltf+json"}),u=URL.createObjectURL(i);return a.push(u),b.set(u,{format:"gltf",entryPath:t}),{url:u,name:e.name,format:"gltf",cleanup:()=>{v(u),b.delete(u),a.forEach(l=>URL.revokeObjectURL(l))}}}catch(i){throw a.forEach(u=>URL.revokeObjectURL(u)),i}}function ge(e,t,r,n){for(let s of e??[]){if(typeof s.uri!="string"||C(s.uri))continue;let o=wt(t,s.uri),a=r.get(o);if(!a)throw new Error(`Invalid GLTF zip: missing referenced asset ${s.uri}.`);let i=URL.createObjectURL(new Blob([a],{type:xe(o)}));n.push(i),s.uri=i}}function ye(e,t){try{return JSON.parse(e)}catch{throw new Error(`${t} is not a valid .gltf JSON file.`)}}function Me(e){return[...e.buffers??[],...e.images??[]].map(t=>t.uri).filter(t=>typeof t=="string"&&t.length>0)}function yt(e,t){for(let r of Me(e)){if(C(r))continue;let n=/^[a-z][a-z0-9+.-]*:/i.test(r),s=r.startsWith("/")||r.startsWith("\\");if(n||s)throw new Error(`${t} references external assets. Include every dependency inside the uploaded .zip.`)}}function C(e){return e.startsWith("data:")}function U(e){let t=[];for(let r of e.replace(/\\/g,"/").replace(/^\/+/,"").split("/").filter(n=>n&&n!==".")){if(r===".."){t.pop();continue}t.push(r)}return t.join("/")}function we(e){let t=e.split("/");return e.endsWith("/")||t.includes("__MACOSX")||t.some(r=>r===".DS_Store"||r.startsWith("._"))}function Mt(e){let t=e.lastIndexOf("/");return t===-1?"":e.slice(0,t)}function wt(e,t){let r=t.split(/[?#]/)[0],n=xt(r);return U(e?`${e}/${n}`:n)}function xt(e){try{return decodeURI(e)}catch{return e}}function xe(e){let t=e.toLowerCase();return t.endsWith(".obj")||t.endsWith(".mtl")?"text/plain":t.endsWith(".fbx")?"application/octet-stream":t.endsWith(".usdz")?"model/vnd.usdz+zip":t.endsWith(".bin")?"application/octet-stream":t.endsWith(".png")?"image/png":t.endsWith(".jpg")||t.endsWith(".jpeg")?"image/jpeg":t.endsWith(".webp")?"image/webp":t.endsWith(".avif")?"image/avif":t.endsWith(".ktx2")?"image/ktx2":"application/octet-stream"}import{Box3 as St,BufferAttribute as Pt,Mesh as Lt}from"three";import{acceleratedRaycast as Rt,computeBoundsTree as At,disposeBoundsTree as Bt,MeshBVH as Dt}from"three-mesh-bvh";var Se=!1,h=new WeakMap,M=new WeakMap;function Et(){Se||(Lt.prototype.raycast=Rt,Se=!0)}function Tt(e){let t=new Set;return e.traverse(r=>{let n=r.geometry;!n||!n.attributes?.position||t.add(n)}),[...t]}function Pe(e){let t=0;for(let r of e){let n=r.index?r.index.count:r.attributes.position.count;t+=n/3}return t}var Le=12e6;function nn(e){return kt(e)>Le}function kt(e){let t=new Set;return e.traverse(r=>{let n=r.geometry;n?.attributes?.position&&t.add(n)}),Pe([...t])}function Ct(e,t){return new Promise((r,n)=>{let s=l=>{let c=l.data;if(!c||!c.error&&!c.serialized)return;if(e.removeEventListener("message",s),e.removeEventListener("error",o),c.error){n(new Error(String(c.error)));return}let{serialized:p}=c,d=Dt.deserialize(p,t,{setIndex:!1});p.index&&(t.index?t.index.array=p.index:t.setIndex(new Pt(p.index,1,!1))),t.boundingBox=d.getBoundingBox(new St),r(d)},o=l=>{e.removeEventListener("message",s),e.removeEventListener("error",o),n(new Error(l.message||"BVH worker error"))};e.addEventListener("message",s),e.addEventListener("error",o);let a=t.index?t.index.array.slice():null,i=t.attributes.position.array.slice(),u=[i,...a?[a]:[]].map(l=>l.buffer);e.postMessage({index:a,position:i,options:{groups:[...t.groups]}},u)})}async function Ut(){if(typeof window>"u"||typeof Worker>"u")return null;try{let{bvhWorkerCode:e}=await import("./bvhWorkerCode-6366A3UC.mjs"),t=new Blob([e],{type:"text/javascript"}),r=URL.createObjectURL(t),n=new Worker(r);return{worker:n,dispose:()=>{n.terminate(),URL.revokeObjectURL(r)}}}catch{return null}}async function Ot(e,t){if(t)try{return await Ct(t,e)}catch{}let r=At.call(e);return e.boundsTree=void 0,await new Promise(n=>setTimeout(n,0)),r}async function Gt(e,t,r){if(e.boundsTree)return;if(t.buildPromise)return t.buildPromise;let n=(async()=>{let s=await r();t.references>0&&!e.boundsTree&&(e.boundsTree=s,t.ownedTree=s)})();return t.buildPromise=n.finally(()=>{t.buildPromise=void 0,t.references===0&&h.delete(e)}),t.buildPromise}async function sn(e,t){if(t?.aborted)return;let r=M.get(e);if(!r){if(r=Tt(e),Pe(r)>Le){M.set(e,[]);return}M.set(e,r);for(let s of r){let o=h.get(s)??{references:0};o.references+=1,h.set(s,o)}}if(r.length===0)return;Et();let n=await Ut();if(t?.aborted){n?.dispose();return}try{for(let s of r){if(t?.aborted)return;let o=h.get(s);o&&await Gt(s,o,()=>Ot(s,n?.worker))}}finally{n?.dispose()}}function on(e){let t=M.get(e);if(t){M.delete(e);for(let r of t){let n=h.get(r);n&&(n.references=Math.max(0,n.references-1),!(n.references>0)&&(n.ownedTree&&r.boundsTree===n.ownedTree&&(Bt.call(r),r.boundsTree=void 0),n.ownedTree=void 0,n.buildPromise||h.delete(r)))}}}import{useThree as O}from"@react-three/fiber";import{useEffect as Be}from"react";import{useEffect as zt,useState as It}from"react";function x(e){return!!e?.isWebGPURenderer}var Re;function Ft(){return Re??(Re=(async()=>{let e=typeof navigator>"u"?void 0:navigator.gpu;if(!e)return!1;try{return!!await e.requestAdapter()}catch{return!1}})()),Re}var Ae=!1;function ln(e){let[t,r]=It(null);return zt(()=>{if(!e)return;let n=!1;return Ft().then(s=>{n||(!s&&!Ae&&(Ae=!0,console.info("[react-immersive] WebGPU isn't available in this browser; using WebGL.")),r(s))}),()=>{n=!0}},[e]),e?t===null?null:t?"webgpu":"webgl":"webgl"}async function cn(e){let{WebGPURenderer:t}=await import("three/webgpu"),r=new t({canvas:e.canvas,antialias:e.antialias??!0,alpha:e.alpha??!0});return await r.init(),r}function bn({captureRef:e}){let{gl:t,scene:r,camera:n,invalidate:s,get:o}=O();return Be(()=>{if(!e)return;let a=()=>{let i=o();i.advance(i.frameloop==="never"?i.clock.elapsedTime:performance.now())};return e.current={gl:t,scene:r,camera:n,invalidate:s,drawNow:a},()=>{e.current=null}},[e,t,r,n,s,o]),null}function hn(){let e=O(r=>r.frameloop),t=O(r=>r.invalidate);return Be(()=>{e!=="never"&&t()},[e,t]),null}function gn(e){e.dispose(),"forceContextLoss"in e&&!x(e)&&(e.forceContextLoss(),e.forceContextLoss=()=>{})}function vn(e){if(!e)return Promise.resolve(null);try{e.drawNow();let t=e.gl.domElement;return new Promise(r=>{t.toBlob(n=>r(n?URL.createObjectURL(n):null),"image/webp",.85)})}catch{return Promise.resolve(null)}}import{useEffect as Yt,useState as Kt}from"react";import{useEffect as Wt,useState as De}from"react";var Vt="200px",Ee=new Map;function Te(e,t,r){let n=Ee.get(t);if(!n){let a=new Map;n={observer:new IntersectionObserver(u=>{for(let l of u)a.get(l.target)?.(l.isIntersecting)},{rootMargin:t}),watchers:a},Ee.set(t,n)}let{observer:s,watchers:o}=n;return o.set(e,r),s.observe(e),()=>{o.delete(e),s.unobserve(e)}}function ke(e){let t=typeof IntersectionObserver<"u",[r,n]=De(!t),[s,o]=De(!t);return Wt(()=>{let a=e.current;if(!a||!t)return;let i=Te(a,Vt,n),u=Te(a,"0px",o);return()=>{i(),u()}},[e,t]),{near:r,visible:s}}import{useEffect as Ce,useRef as Ue,useState as Nt}from"react";function G(){return typeof navigator>"u"?!1:/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)}function _t(){if(typeof navigator>"u")return!1;let e=navigator.userAgent;return/iPhone|iPad|iPod/i.test(e)?!0:navigator.platform==="MacIntel"&&typeof navigator.maxTouchPoints=="number"&&navigator.maxTouchPoints>1}function xn(){return G()||_t()}function jt(){if(typeof window>"u"||typeof navigator>"u")return!1;let e=a=>typeof window.matchMedia=="function"&&window.matchMedia(a).matches,t=e("(pointer: coarse)")||e("(any-pointer: coarse)"),r=e("(hover: none)")||e("(any-hover: none)"),n=navigator.maxTouchPoints>0,s=typeof window.screen<"u"&&Math.min(window.screen.width,window.screen.height)<=1024,o=G();return t||o||n&&r||n&&s}function z(){if(!jt())return!1;if(G())return!0;let e=navigator.deviceMemory;return!(typeof e=="number"&&e>=8)}function Sn(e="auto"){switch(e){case"high":return!1;case"low":return!0;default:return z()}}function $t(e,t){let r=new Set,n=s=>{for(let o of s){if(r.size>=t)return;r.add(o.id)}};return n(e.filter(s=>s.wanted).sort((s,o)=>Number(o.visible)-Number(s.visible)||Number(o.live)-Number(s.live)||s.since-o.since)),n(e.filter(s=>!s.wanted&&s.live).sort((s,o)=>o.since-s.since)),r}var Ht=12,Zt=6,S=new Map,Xt=1,I=!1,Oe;function Ge(){I||(I=!0,queueMicrotask(()=>{I=!1,Oe??(Oe=z()?Zt:Ht);let e=$t([...S.values()],Oe);for(let t of S.values()){let r=e.has(t.id);r!==t.live&&(t.live=r,t.onLiveChange(r))}}))}function ze({managed:e,wanted:t,visible:r,onPark:n}){let[s,o]=Nt(!1),a=Ue(n);a.current=n;let i=Ue(null);return Ce(()=>{if(!e)return;let u={id:Xt++,wanted:!1,visible:!1,live:!1,since:performance.now(),onLiveChange:l=>{l||a.current?.(),o(l)}};return S.set(u.id,u),i.current=u,()=>{S.delete(u.id),i.current=null,o(!1),Ge()}},[e]),Ce(()=>{let u=i.current;!u||u.wanted===t&&u.visible===r||(u.wanted!==t&&(u.since=performance.now()),u.wanted=t,u.visible=r,Ge())},[e,t,r]),e?s:t}function Tn({loading:e="lazy",reveal:t="auto",rootRef:r,onPark:n}){let{near:s,visible:o}=ke(r),[a,i]=Kt(t==="auto");return Yt(()=>{t==="auto"&&i(!0)},[t]),{live:ze({managed:e==="lazy",wanted:a&&(e==="eager"||s),visible:o,onPark:n}),visible:o,awaitingReveal:!a,reveal:()=>i(!0)}}import{Box as qt}from"lucide-react";import{jsx as F,jsxs as Ie}from"react/jsx-runtime";function Jt({src:e,hidden:t=!1}){return e?F("img",{className:`ri-poster${t?" ri-poster--hidden":""}`,src:e,alt:"","aria-hidden":"true",draggable:!1,decoding:"async"}):null}function In({className:e,background:t,poster:r,onReveal:n}){let s=ie();return Ie("div",{className:`${e} ri-viewerPlaceholder`,style:{background:t},children:[F(Jt,{src:r}),n?Ie("button",{type:"button",className:"ri-revealButton",onClick:n,children:[F(qt,{size:16,"aria-hidden":"true"}),s("viewIn3D")]}):null]})}import{BufferGeometry as Qt,Float32BufferAttribute as er,Group as We,Mesh as W,MeshStandardMaterial as tr}from"three";import{STLLoader as rr}from"three/examples/jsm/loaders/STLLoader.js";import{PLYLoader as nr}from"three/examples/jsm/loaders/PLYLoader.js";var sr=12106948,Ve="This PLY file is a point cloud: it has vertices but no faces.",P=class extends Error{constructor(){super(Ve),this.name="PointCloudError"}};function Nn(e){return e instanceof P||e instanceof Error&&e.message.includes(Ve)}function _e(e,t){let r=e.split(/[?#]/,1)[0],n=r.slice(r.lastIndexOf("/")+1);try{n=decodeURIComponent(n)}catch{}return n.replace(/\.[^.]*$/,"").trim()||t}function V(e){return new tr({color:e?16777215:sr,vertexColors:e,metalness:0,roughness:.6})}function Fe(e,t,r){let n=e.itemSize;return new er(e.array.slice(t*n,(t+r)*n),n)}function je(e,t){let r=new rr().parse(e),n=!!r.hasColors,s=new We;if(r.groups.length>1){let i=r.userData.groupNames??[],u=r.getAttribute("position"),l=r.getAttribute("normal");return r.groups.forEach((c,p)=>{let d=new Qt;d.setAttribute("position",Fe(u,c.start,c.count)),l&&d.setAttribute("normal",Fe(l,c.start,c.count));let f=new W(d,V(!1));f.name=i[p]?.trim()||`${t} ${p+1}`,s.add(f)}),r.dispose(),s}r.clearGroups();let o=V(n);n&&r.alpha!==void 0&&r.alpha<1&&(o.opacity=r.alpha,o.transparent=!0);let a=new W(r,o);return a.name=t,s.add(a),s}function or(e){let r=new TextDecoder().decode(new Uint8Array(e,0,Math.min(e.byteLength,65536))).split("end_header",1)[0],n=/^\s*element\s+face\s+(\d+)/m.exec(r);return!!(n&&Number(n[1])>0)}function Ne(e,t){if(!or(e))throw new P;let r=new nr().parse(e);r.getAttribute("normal")||r.computeVertexNormals();let n=new W(r,V(!!r.getAttribute("color")));n.name=t;let s=new We;return s.add(n),s}import{useLoader as Ze,useThree as mr}from"@react-three/fiber";import{FileLoader as Xe,Loader as br,LoadingManager as hr}from"three";import{FBXLoader as gr,GLTFLoader as vr,MTLLoader as yr,OBJLoader as Mr}from"three-stdlib";import{USDLoader as wr}from"three/examples/jsm/loaders/USDLoader.js";import{useGLTF as Zn}from"@react-three/drei";import{useThree as Yn}from"@react-three/fiber";import{useMemo as qn}from"react";import{SRGBColorSpace as ar}from"three";import{DRACOLoader as ir,KTX2Loader as ur,MeshoptDecoder as lr}from"three-stdlib";function cr(e){return{name:"RI_unlit_emissive_texture",async afterRoot(t){let r=e.json.materials??[],n=new Map;if(r.forEach(o=>{let a=!!o?.extensions?.KHR_materials_unlit,i=!!o?.pbrMetallicRoughness?.baseColorTexture;a&&!i&&o?.emissiveTexture&&o.name&&n.set(o.name,o.emissiveTexture.index)}),n.size===0||!t.scene)return;let s=new Map;await Promise.all([...n].map(async([o,a])=>{let i=await e.getDependency("texture",a);i&&(i.colorSpace=ar,s.set(o,i))})),t.scene.traverse(o=>{let a=Array.isArray(o.material)?o.material:o.material?[o.material]:[];for(let i of a){let u=i.name?s.get(i.name):void 0;u&&!i.map&&(i.map=u,i.needsUpdate=!0)}})}}}var pr="https://assets.react-immersive.liveroom.dev/three-r184/draco/",dr="https://assets.react-immersive.liveroom.dev/three-r184/basis/";function fr(e,t){if(!x(t))return e.detectSupport(t);let r=t,n=s=>r.hasFeature(s);return e.workerConfig={astcSupported:n("texture-compression-astc"),etc1Supported:n("texture-compression-etc1"),etc2Supported:n("texture-compression-etc2"),dxtSupported:n("texture-compression-s3tc"),bptcSupported:n("texture-compression-bc"),pvrtcSupported:n("texture-compression-pvrtc")},e}function $e(e,t={},r){let{dracoDecoderPath:n=pr,ktx2TranscoderPath:s=dr,meshopt:o=!0}=t;if(n){let a=new ir;a.setDecoderPath(n),e.setDRACOLoader(a)}if(o&&e.setMeshoptDecoder(lr),s&&r){let a=fr(new ur().setTranscoderPath(s),r);e.setKTX2Loader(a)}e.register((a=>cr(a)))}var R=class extends br{constructor(){super(...arguments);this.options={source:{format:"glb"}}}configure(r){return this.options=r,this}load(r,n,s,o){let a=performance.now(),i={format:this.options.source.format,name:this.options.source.entryPath??Q(r),sourceBytes:this.options.source.sourceBytes??null,failedResources:[]},u=l=>{i.sourceBytes===null&&l.lengthComputable&&l.total>0&&(i.sourceBytes=l.total),s?.(l)};this.loadAsset(r,u,i).then(l=>{i.loadDurationMs=Math.max(0,performance.now()-a),E(l.scene,i),n(l)}).catch(l=>{i.loadDurationMs=Math.max(0,performance.now()-a),l&&typeof l=="object"&&E(l,i),o?.(l)})}async loadAsset(r,n,s){let o=Pr(this.options.source);o.onError=l=>{let c=Object.entries(this.options.source.resourceUrls??{}).find(([,d])=>d===l)?.[0],p=ee(c??l);s.failedResources.includes(p)||s.failedResources.push(p)};let{format:a}=this.options.source;if(a==="obj")return xr(r,o,this.options.source,n);if(a==="fbx"){let l=_(this,new gr(o)),c=Ar(r,this.options.source);c&&l.setResourcePath(c);let p=await l.loadAsync(r,n);return L(p,"FBXMesh",!1),{scene:p,animations:p.animations??[]}}if(a==="stl"||a==="ply"){let l=await Sr(r,o,n),c=_e(this.options.source.entryPath??r,a==="stl"?"STL model":"PLY model"),p=a==="stl"?je(l,c):Ne(l,c);return L(p,a==="stl"?"STLMesh":"PLYMesh",!0),{scene:p,animations:[]}}if(a==="usdz"){let c=await _(this,new wr(o)).loadAsync(r,n);return L(c,"USDZMesh",!1),{scene:c,animations:c.animations??[]}}let i=_(this,new vr(o));$e(i,this.options.decoderConfig,this.options.renderer),i.register(l=>{let c=l.json,p=d=>Array.isArray(d)?d.filter(f=>typeof f=="string"):[];return s.extensionsUsed=p(c.extensionsUsed),s.extensionsRequired=p(c.extensionsRequired),{name:"RI_asset_diagnostics",beforeRoot:()=>null}});let u=await i.loadAsync(r,n);return{scene:u.scene,animations:u.animations??[],materialVariants:ne(u)}}};le(e=>{Ze.clear(R,e)});function ds(e,t={},r,n){let s=mr(i=>i.gl),o=ve(e),a=r?{...o,format:r}:o;return Ze(R,e,i=>{i.configure({source:a,decoderConfig:t,renderer:s})},n)}async function xr(e,t,r,n){let s=await He(e,t,n),o=new Mr(t),a=Lr(s);if(a){let u=Rr(a,e,r);if(u)try{let l=await He(u.url,t),p=new yr(t).parse(l,u.basePath);p.preload(),o.setMaterials(p)}catch(l){console.warn(`[react-immersive] Could not load OBJ material ${a}; rendering geometry with fallback materials.`,l)}}let i=o.parse(s);return L(i,"OBJMesh",!0),{scene:i,animations:[]}}function L(e,t,r){let n=new Set,s=0;e.traverse(o=>{if(!("isMesh"in o&&o.isMesh===!0)){o.name&&n.add(o.name);return}let i=o.name||`${t}_${++s}`;if(!r&&o.name){n.add(o.name);return}let u=i,l=2;for(;n.has(u);)u=`${i}_${l++}`;o.name=u,n.add(u)})}function He(e,t,r){let n=new Xe(t);return n.setResponseType("text"),n.loadAsync(e,r)}function Sr(e,t,r){let n=new Xe(t);return n.setResponseType("arraybuffer"),n.loadAsync(e,r)}function _(e,t){return t.setCrossOrigin(e.crossOrigin),t.setWithCredentials(e.withCredentials),t.setRequestHeader(e.requestHeader),t}function Pr(e){let t=new hr,r=e.resourceUrls;return r&&t.setURLModifier(n=>{if(/^(?:blob:|data:)/i.test(n))return n;let s=B(Ke(n).split(/[?#]/)[0]),o=r[s];if(o)return o;let a=A(e.entryPath??""),i=B(a?`${a}/${s}`:s);return r[i]??n}),t}function Lr(e){return/^\s*mtllib\s+(.+?)\s*$/im.exec(e)?.[1]?.trim()||null}function Rr(e,t,r){if(r.resourceUrls&&r.entryPath){let n=B(`${A(r.entryPath)}/${Ke(e)}`),s=r.resourceUrls[n];if(!s)return null;let o=A(n);return{url:s,basePath:o?`${o}/`:""}}try{let n=new URL(e,t).href;return{url:n,basePath:Ye(n)}}catch{return null}}function Ar(e,t){if(t.resourceUrls&&t.entryPath){let r=A(t.entryPath);return r?`${r}/`:""}return Ye(e)}function Ye(e){let t=e.lastIndexOf("/");return t===-1?"":e.slice(0,t+1)}function A(e){let t=B(e),r=t.lastIndexOf("/");return r===-1?"":t.slice(0,r)}function B(e){let t=[];for(let r of e.replace(/\\/g,"/").replace(/^\/+/,"").split("/").filter(n=>n&&n!=="."))r===".."?t.pop():t.push(r);return t.join("/")}function Ke(e){try{return decodeURI(e)}catch{return e}}import{Color as j,MeshPhysicalMaterial as Br,MeshStandardMaterial as Dr,Texture as N}from"three";function hs(e){if(te(e))return e;if(!e||typeof e!="object")return null;let t=e,r=new Dr;typeof t.name=="string"&&(r.name=t.name),r.metalness=0,r.roughness=1,t.type==="MeshBasicMaterial"||t.isMeshBasicMaterial===!0?(r.color.set(0),r.emissiveIntensity=1,t.map instanceof N?(r.emissiveMap=t.map,r.emissive.set(16777215)):t.color instanceof j&&r.emissive.copy(t.color)):(t.color instanceof j&&r.color.copy(t.color),t.map instanceof N&&(r.map=t.map),t.emissive instanceof j&&r.emissive.copy(t.emissive),t.emissiveMap instanceof N&&(r.emissiveMap=t.emissiveMap));let s=["aoMap","aoMapIntensity","lightMap","lightMapIntensity","alphaMap","opacity","transparent","alphaTest","side","vertexColors","wireframe","depthTest","depthWrite","visible","toneMapped","fog"];for(let o of s)t[o]!==void 0&&(r[o]=t[o]);return r.needsUpdate=!0,r}function gs(e){if(re(e))return e.clone();let t=new Br;return t.name=e.name,t.color.copy(e.color),t.map=e.map,t.lightMap=e.lightMap,t.lightMapIntensity=e.lightMapIntensity,t.aoMap=e.aoMap,t.aoMapIntensity=e.aoMapIntensity,t.emissive.copy(e.emissive),t.emissiveIntensity=e.emissiveIntensity,t.emissiveMap=e.emissiveMap,t.bumpMap=e.bumpMap,t.bumpScale=e.bumpScale,t.normalMap=e.normalMap,t.normalMapType=e.normalMapType,t.normalScale.copy(w(e.normalScale)),t.displacementMap=e.displacementMap,t.displacementScale=e.displacementScale,t.displacementBias=e.displacementBias,t.roughness=e.roughness,t.roughnessMap=e.roughnessMap,t.metalness=e.metalness,t.metalnessMap=e.metalnessMap,t.alphaMap=e.alphaMap,t.envMap=e.envMap,t.envMapRotation.copy(e.envMapRotation),t.envMapIntensity=e.envMapIntensity,t.wireframe=e.wireframe,t.wireframeLinewidth=e.wireframeLinewidth,t.flatShading=e.flatShading,t.fog=e.fog,t.opacity=e.opacity,t.transparent=e.transparent,t.alphaHash=e.alphaHash,t.blendSrc=e.blendSrc,t.blendDst=e.blendDst,t.blendEquation=e.blendEquation,t.blendSrcAlpha=e.blendSrcAlpha,t.blendDstAlpha=e.blendDstAlpha,t.blendEquationAlpha=e.blendEquationAlpha,t.blending=e.blending,t.premultipliedAlpha=e.premultipliedAlpha,t.dithering=e.dithering,t.alphaTest=e.alphaTest,t.depthTest=e.depthTest,t.depthWrite=e.depthWrite,t.colorWrite=e.colorWrite,t.stencilWrite=e.stencilWrite,t.stencilWriteMask=e.stencilWriteMask,t.stencilFunc=e.stencilFunc,t.stencilRef=e.stencilRef,t.stencilFuncMask=e.stencilFuncMask,t.stencilFail=e.stencilFail,t.stencilZFail=e.stencilZFail,t.stencilZPass=e.stencilZPass,t.side=e.side,t.shadowSide=e.shadowSide,t.toneMapped=e.toneMapped,t.vertexColors=e.vertexColors,t.visible=e.visible,t.clippingPlanes=e.clippingPlanes,t.clipIntersection=e.clipIntersection,t.clipShadows=e.clipShadows,t.forceSinglePass=e.forceSinglePass,t.polygonOffset=e.polygonOffset,t.polygonOffsetFactor=e.polygonOffsetFactor,t.polygonOffsetUnits=e.polygonOffsetUnits,t}function vs(e){e.userData.baseColor=e.color.clone(),e.userData.baseMap=e.map??null,e.userData.baseVertexColors=e.vertexColors,e.userData.baseMetalness=e.metalness,e.userData.baseMetalnessMap=e.metalnessMap??null,e.userData.baseRoughness=e.roughness,e.userData.baseRoughnessMap=e.roughnessMap??null,e.userData.baseEmissive=e.emissive.clone(),e.userData.baseEmissiveIntensity=e.emissiveIntensity,e.userData.baseEmissiveMap=e.emissiveMap??null,e.userData.baseOpacity=e.opacity,e.userData.baseTransparent=e.transparent,e.userData.baseAlphaMap=e.alphaMap??null,e.userData.baseAlphaTest=e.alphaTest,e.userData.baseAlphaHash=e.alphaHash,e.userData.baseDithering=e.dithering,e.userData.baseBlending=e.blending,e.userData.baseDepthWrite=e.depthWrite,e.userData.baseSide=e.side,e.userData.baseNormalMap=e.normalMap??null,e.userData.baseNormalScale=w(e.normalScale),e.userData.baseBumpMap=e.bumpMap??null,e.userData.baseBumpScale=e.bumpScale,e.userData.baseAoMap=e.aoMap??null,e.userData.baseAoMapIntensity=e.aoMapIntensity,e.userData.baseDisplacementMap=e.displacementMap??null,e.userData.baseDisplacementScale=e.displacementScale,e.userData.baseDisplacementBias=e.displacementBias,e.userData.baseClearcoat=e.clearcoat,e.userData.baseClearcoatMap=e.clearcoatMap??null,e.userData.baseClearcoatRoughness=e.clearcoatRoughness,e.userData.baseClearcoatRoughnessMap=e.clearcoatRoughnessMap??null,e.userData.baseClearcoatNormalMap=e.clearcoatNormalMap??null,e.userData.baseClearcoatNormalScale=w(e.clearcoatNormalScale),e.userData.baseSheen=e.sheen,e.userData.baseSheenColor=e.sheenColor.clone(),e.userData.baseSheenColorMap=e.sheenColorMap??null,e.userData.baseSheenRoughness=e.sheenRoughness,e.userData.baseSheenRoughnessMap=e.sheenRoughnessMap??null,e.userData.baseAnisotropy=e.anisotropy,e.userData.baseAnisotropyRotation=e.anisotropyRotation,e.userData.baseAnisotropyMap=e.anisotropyMap??null,e.userData.baseTransmission=e.transmission,e.userData.baseTransmissionMap=e.transmissionMap??null,e.userData.baseThickness=e.thickness,e.userData.baseThicknessMap=e.thicknessMap??null,e.userData.baseAttenuationColor=e.attenuationColor.clone(),e.userData.baseAttenuationDistance=e.attenuationDistance,e.userData.baseReflectivity=e.reflectivity,e.userData.baseSpecularIntensity=e.specularIntensity,e.userData.baseSpecularIntensityMap=e.specularIntensityMap??null,e.userData.baseSpecularColor=e.specularColor.clone(),e.userData.baseSpecularColorMap=e.specularColorMap??null,e.userData.baseFlatShading=e.flatShading,e.userData.baseEnvMapIntensity=e.envMapIntensity}import{Box3 as $,Matrix4 as Er,Sphere as Tr,Vector3 as H}from"three";var qe=new WeakMap,Je=new H,kr=new H,Cr=new H,Ur=new $,Qe=new Er;function g(e){return"data"in e?e.data.version:e.version}function Or(e){var u;let{geometry:t,skeleton:r}=e,n=t.getAttribute("position"),s=t.getAttribute("skinIndex"),o=t.getAttribute("skinWeight"),a=qe.get(e);if(a?.geometry===t&&a.position===n&&a.indices===s&&a.weights===o&&a.skeleton===r&&a.bindMatrix.equals(e.bindMatrix)&&a.versions[0]===g(n)&&a.versions[1]===g(s)&&a.versions[2]===g(o)&&a.inverses.length===r.boneInverses.length&&a.inverses.every((l,c)=>l.equals(r.boneInverses[c])))return a;let i={geometry:t,position:n,indices:s,weights:o,skeleton:r,versions:[g(n),g(s),g(o)],bindMatrix:e.bindMatrix.clone(),inverses:r.boneInverses.map(l=>l.clone()),bones:[],weightDeviation:0};e:for(let l=0;l<n.count;l++){Je.fromBufferAttribute(n,l).applyMatrix4(e.bindMatrix);let c=0;for(let d=0;d<4;d++){let f=o.getComponent(l,d);if(f===0)continue;let m=s.getComponent(l,d);if(!Number.isFinite(f)||f<0||!Number.isInteger(m)||!r.bones[m]||!i.inverses[m]){i.bones=null;break e}c+=f,((u=i.bones)[m]??(u[m]=new $)).expandByPoint(kr.copy(Je).applyMatrix4(i.inverses[m]))}let p=Math.abs(c-1);if(p>1e-4){i.bones=null;break}i.weightDeviation=Math.max(i.weightDeviation,p)}return qe.set(e,i),i}function xs(e,{precise:t=!1,updateFallbacks:r=!0}={}){e.updateMatrixWorld(!0),e.traverse(n=>{if(!Y(n))return;let s=n;if(!s.skeleton)return;let o=K(s);o&&s.bindMatrixInverse.copy(o);let i=!!s.geometry.morphAttributes.position?.length?null:Or(s);if(!t&&!i?.bones&&!r&&s.boundingBox&&s.boundingSphere)return;let u=s.boundingBox??(s.boundingBox=new $),l=s.boundingSphere??(s.boundingSphere=new Tr);if(u.makeEmpty(),t||!i?.bones){let c=s.geometry.getAttribute("position");for(let p=0;p<c.count;p++)u.expandByPoint(s.getVertexPosition(p,Cr))}else{for(let c=0;c<i.bones.length;c++){let p=i.bones[c];p&&(Qe.multiplyMatrices(s.bindMatrixInverse,s.skeleton.bones[c].matrixWorld),u.union(Ur.copy(p).applyMatrix4(Qe)))}if(!u.isEmpty()){let c=u.min,p=u.max,d=s.bindMatrixInverse.elements,f=Math.max(1,Math.abs(c.x),Math.abs(c.y),Math.abs(c.z),Math.abs(p.x),Math.abs(p.y),Math.abs(p.z)),m=Math.max(Math.abs(c.x-d[12]),Math.abs(p.x-d[12]),Math.abs(c.y-d[13]),Math.abs(p.y-d[13]),Math.abs(c.z-d[14]),Math.abs(p.z-d[14]));u.expandByScalar(i.weightDeviation*m+f*1e-10)}}u.getBoundingSphere(l)})}import{useCallback as et,useEffect as Gr,useRef as zr}from"react";import{useThree as Ir}from"@react-three/fiber";function Rs(){let e=Ir(s=>s.gl.domElement),t=zr(void 0),r=et(s=>{t.current===void 0&&(t.current=e.style.cursor),e.style.cursor=s},[e]),n=et(()=>{let s=t.current;s!==void 0&&(e.style.cursor=s,t.current=void 0)},[e]);return Gr(()=>()=>{n()},[n]),{setCanvasCursor:r,restoreCanvasCursor:n}}import{Box3 as Fr,Vector3 as tt}from"three";function D(e){return[e.x,e.y,e.z]}function Es(e){let t=new Fr().setFromObject(e),r=0;return e.traverse(n=>{n.isMesh&&(r+=1)}),{bounds:{min:D(t.min),max:D(t.max),center:D(t.getCenter(new tt)),size:D(t.getSize(new tt))},objectCount:r,materialVariants:se(e),materialVariantGroups:oe(e)}}import{useSyncExternalStore as Wr}from"react";var rt="(prefers-reduced-motion: reduce)";function Vr(e){if(typeof window>"u"||!window.matchMedia)return()=>{};let t=window.matchMedia(rt);return t.addEventListener("change",e),()=>t.removeEventListener("change",e)}var _r=()=>typeof window<"u"&&!!window.matchMedia?.(rt).matches;function Cs(e="user"){let t=Wr(Vr,_r,()=>!1);return e==="always"?!0:e==="never"?!1:t}import{jsx as Z,jsxs as X}from"react/jsx-runtime";function Is({visible:e,message:t,tone:r="default",progress:n}){if(!e)return null;let s=typeof n=="number"&&Number.isFinite(n),o=s?Math.min(Math.max(n,0),100):0,a=Math.round(o);return X("div",{className:"bb-loadingOverlay",role:"status","aria-live":"polite",children:[s&&X("div",{className:"bb-loadingProgressRow",children:[Z("div",{className:"bb-loadingProgress",role:"progressbar","aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":a,children:Z("div",{className:"bb-loadingProgress__bar",style:{width:`${a}%`}})}),X("span",{className:"bb-loadingProgress__label",children:[a,"%"]})]}),r!=="success"&&Z("span",{className:`bb-loadingMessage bb-status--${r}`,children:t})]})}export{Hr as a,ie as b,_t as c,xn as d,z as e,Sn as f,Jr as g,k as h,ve as i,Qr as j,Le as k,nn as l,kt as m,sn as n,on as o,x as p,ln as q,cn as r,bn as s,hn as t,gn as u,vn as v,Tn as w,Jt as x,In as y,Nn as z,pr as A,dr as B,ds as C,hs as D,gs as E,vs as F,xs as G,Rs as H,Es as I,Cs as J,Is as K};
@@ -1 +0,0 @@
1
- import{Ha as p}from"./chunk-4JMJALRO.mjs";function c(n){if(typeof n!="object"||n===null)return!1;let e=Object.getPrototypeOf(n);return e===Object.prototype||e===null}function o(n,e){if(!c(e))return e;let i=c(n)?{...n}:{};for(let r of Object.keys(e)){let t=e[r];i[r]=c(t)?o(i[r],t):t}return i}function f(n){return Array.isArray(n)&&n.length>0&&typeof n[0]!="string"}function O(n,e,i){let r=f(e)?e:[{ids:e,patch:i??{}}],t=n;for(let d of r)for(let g of p(t,d.ids)){let s=t[g];if(!s)continue;let a=o(s,d.patch);t===n&&(t={...n}),t[g]=a}return t}function u(n){return{style:{material:n}}}function x(n,e){return o(n,e)}var B={type:"point",color:"#ffffff",intensity:1,position:[0,0,0],distance:0,decay:2,attachedToCamera:!1,castShadow:!1,shadowBias:-5e-4,visible:!0};function h(n){return{...B,...n}}function P(n){return n}export{O as a,u as b,x as c,h as d,P as e};
@@ -1 +0,0 @@
1
- var F={verifyingLicense:"Verifying License",checkingYourLicenseKey:"Checking your license key...",invalidLicense:"Invalid License",licenseHasBeenRevokedOrHasExpired:"License has been revoked or has expired",failedToLoadPleaseContactTheSiteAdministrator:"Failed to load. Please contact the site administrator.",contextRestoringTitle:"Reloading viewer\u2026",contextLostTitle:"3D view interrupted",contextRestoringMessage:"Rebuilding the 3D view. Please wait\u2026",contextLostMessage:"The graphics connection was interrupted. The viewer will rebuild when it returns, or you can reload it now.",reloadViewer:"Reload viewer",texturePositioningHint:"Drag to move \xB7 Scroll to zoom \xB7 Click elsewhere to finish",texturePositioningStartHint:"Double-click to move or zoom",dismiss:"Dismiss",missingUVsAreShownInMagenta:"Missing UVs are shown in magenta.",viewThisModelInARWithAppleQuickLook:"View this model in AR with Apple Quick Look",sequencePlayer:"Sequence player",sequenceSelect:"Sequence",sequencePlay:"Play sequence",sequencePause:"Pause sequence",sequenceStop:"Stop and restore scene",sequencePlayhead:"Sequence playhead",sequenceTime:"Sequence time",sequenceIssues:"Unavailable sequence targets",arConfiguredButton:"AR handoff",arConfiguredTitle:"Take this configuration to AR",arConfiguredDescription:"Your current materials, visible models and placements are included.",arSnapshotStale:"Updating AR to include your latest changes\u2026",arPreparing:"Preparing your scene\u2026",arRefresh:"Refresh AR",arRetry:"Try again",arExportDetails:"Export details",arPrepare:"Prepare AR",arPrepareAgain:"Prepare again",arDownloadUSDZ:"Download USDZ for iPhone/iPad",arScanConfigured:"Scan to open this configuration on your phone.",arOpenConfiguredLink:"Open configuration link",viewInAR:"View in AR",openThisExperienceOnAPhoneForAR:"Open this experience on a phone for AR",openOnPhone:"Open on phone",viewThisModelInYourSpace:"View this model in your space",viewThisModelInVR:"View this model in VR",closePhoneHandoff:"Close phone handoff",arScanCode:"Scan the code and choose AR.",qrCodeToOpenThisModelOnAPhone:"QR code to open this model on a phone",disableUVChecker:"Disable UV checker",enableUVChecker:"Enable UV checker",explodedView:"Exploded view",explodeAmount:"Explode amount",removeSectionCut:"Remove section cut",sectionCut:"Section cut",sectionAxis:"Section axis",sectionPosition:"Section position",keepTheOtherSide:"Keep the other side",pauseCinematic:"Pause cinematic",playCinematic:"Play cinematic",stopCinematicAndResetCamera:"Stop cinematic and reset camera",cancel:"Cancel",annotationCategories:"Annotation categories",annotations:"Annotations",all:"All",uncategorized:"Uncategorized",decalDragHint:"Drag the decal on the object. Release to save; Escape to cancel.",showAll:"Show all",materialVariants:"Material variants",startGuidedTour:"Start guided tour",guidedTour:"Guided Tour",previousAnnotation:"Previous annotation",previous:"Prev",stopGuidedTour:"Stop guided tour",nextAnnotation:"Next annotation",next:"Next",exitFullscreen:"Exit fullscreen",enterFullscreen:"Enter fullscreen",resetCameraView:"Reset camera view",orbitControl:"Orbit Control",pointLock:"Point Lock",cameraController:"Camera controller",cameraControllerSettings:"Camera controller settings",downloadGLB:"Download GLB",downloadGLBDescription:"All visible models, material edits and animations in one file. No annotations or separate editor model slots. Duplicate mesh names may change on reimport.",downloadCombinedGLB:"Download as one GLB",downloadSeparateGLBs:"Download separate GLBs",downloadSeparateGLBsDescription:"One GLB file per model",downloadPNG:"Download PNG",downloadUVLayout:"Download UV Layout",videoFormat:"Video format",auto:"Auto",recordTurntableVideo:"Record turntable video",recordCinematicVideo:"Record cinematic video",videoUnsupported:"Video recording is not supported in this browser.",downloadOptions:"Download options",exporting:"Exporting\u2026",download:"Download",annotationTitlePlaceholder:"Title *",description:"Description",ok:"OK",arRelocate:"Relocate",tapToPlace:"Tap to place",closeAnnotation:"Close annotation",learnMore:"Learn more",stopMeasuring:"Stop measuring",startMeasuring:"Start measuring",toggleBoundingDimensions:"Toggle bounding dimensions",measurementTool:"Measurement tool",distance:"Distance",angle:"Angle",area:"Area",pointToPlane:"Point to plane",wrap:"Circumference (Edge)",wrapHorizontal:"Circumference (Horizontal)",measurementSnapping:"Measurement snapping",noSnapping:"No snapping",snapAuto:"Snap: auto",snapVertex:"Snap: vertex",snapEdge:"Snap: edge",undoMeasurementPoint:"Undo measurement point",clearMeasurements:"Clear measurements",finishArea:"Finish area",savedMeasurements:"Saved measurements ({count})",noSavedMeasurements:"No saved measurements yet. Pick points in the preview, then save a measurement here.",measurementFiles:"Import / export",measurementSourceUnit:"Model units",measurementDisplayUnit:"Display units",measurementName:"Measurement name",measurementNamePlaceholder:"e.g. Door width",saveMeasurement:"Save measurement",knownMeasurementDistance:"Known distance",calibrationUnit:"Calibration unit",calibrateMeasurement:"Calibrate",measurementCalibrationHint:"Pick two distance points, enter their known length, then calibrate.",measurementCalibratedScale:"Calibrated: 1 model unit = {scale} m",resetMeasurementCalibration:"Reset calibration",showSavedMeasurement:"Show {name}",renameSavedMeasurement:"Rename {name}",deleteSavedMeasurement:"Delete {name}",exportMeasurementJson:"Export JSON",exportMeasurementCsv:"Export CSV",importMeasurementJson:"Import JSON",measurementReady:"Ready",measurementApproximate:"Approximate LOD",measurementModelChanged:"Different model",measurementObjectMissing:"Object unavailable",measurementGeometryChanged:"Geometry changed \u2014 measure again",measurementPoseChanged:"Pose changed \u2014 measure again",measurementObjectHidden:"Object hidden",measurementInvalid:"Invalid measurement",measurementWaiting:"Waiting for model",openSceneObjectsPanel:"Open scene objects panel",sceneObjects:"SCENE OBJECTS",searchNodesLabels:"Search nodes, labels",closeSceneObjectsPanel:"Close scene objects panel",objectNavigator:"Objects in the 3D view",compareBefore:"Before",compareAfter:"After",compareDivider:"Comparison divider",viewIn3D:"View in 3D",objectNavigatorHint:"Arrow keys browse \xB7 Enter selects \xB7 Esc clears",selectionCleared:"Selection cleared",cameraKeyboardHelp:"3D view. Arrow keys orbit, Shift with Up or Down zooms, and W, A, S, D, Space and C move the camera.",isolate:"Isolate",hide:"Hide",show:"Show",closePanel:"Close panel",actions:"Actions",openPanel:"Open panel",close:"Close",position:"Position",decalNudgeHint:"Click to fine-tune \xB7 Hold to move",decalNudgeControls:"Move decal in small steps",text:"Text",yourText:"Your text",textToAdd:"Text to add",textColour:"Text colour",addText:"Add text",image:"Image",chooseImage:"Choose image",imageToAdd:"Image to add",added:"Added",colour:"Colour",size:"Size",turn:"Turn",rotation:"Rotation",dragTheDecalAcrossTheObjectsSurface:"Drag the decal across the object's surface",move:"Move",remove:"Remove",noneAddedYet:"None added yet",done:"Done",moveForward:"Move forward",moveLeft:"Move left",moveRight:"Move right",moveBackward:"Move backward",sceneSettings:"Scene Settings",background:"Background",backgroundColor:"Background Color",environment:"Environment",autoRotate:"Auto Rotate",lighting:"Lighting",exposure:"Exposure",ambientLightIntensity:"Ambient Light Intensity",ambientLightColor:"Ambient Light Color",directLightIntensity:"Direct Light Intensity",directLightColor:"Direct Light Color",searchObjects:"Search objects",uploadedModel:"Uploaded model",clear:"Clear",chooseModel:"Choose model",loadingModel:"Loading model...",releaseToLoadYourModel:"Release to load your model",arFindSurface:"Move your device over a flat surface",arReleaseToPlace:"Release to place",arGestureHint:"Pinch to resize \xB7 Twist to rotate",angleFirstArmHint:"Pick the first arm",angleVertexHint:"Pick the angle's vertex",angleSecondArmHint:"Pick the second arm",angleNewHint:"Pick a point to start a new angle",areaNewHint:"Pick a point to start a new area",areaCornersHint:"Pick polygon corners in order, then Finish area",pointToPlaneFaceHint:"Pick the reference face",pointToPlanePointHint:"Pick a point to measure its perpendicular distance",pointToPlaneNewHint:"Pick a face to start a new measurement",distanceHint:"Pick points on the model to measure distances",wrapHint:"Click a point on the surface to measure its circumference, following the surface (best for limbs)",wrapHorizontalHint:"Click a point to measure a level circumference around it (best for the torso/waist)",visibleEntries:"{count} visible entries",objectCount:"{count} objects",annotationMarker:"Annotation {id}: {title}",recordingVideo:"Recording video \xB7 {progress}%",isolatedObjects:"Isolated: {count} objects",largeModelWarning:"Very large model ({millions}M triangles) \u2014 it may render and move slowly on this device, and click/hover selection on the model is disabled. Use the objects panel to select parts.",preparingLargeModel:"Preparing large model ({millions}M triangles) \u2014 the first display can take a while on this device...",enterAR:"Enter AR",enterVR:"Enter VR",decalImage:"Image {index}",decalText:"Text {index}",decalAdded:"{count} added",up:"up",down:"down",left:"left",right:"right",moveDecal:"Move decal {direction}",moveDecalOnSurface:"Move {direction} on the visible surface",showAllObject:"Show all {name}",isolateObject:"Isolate {name}",isolatedObject:"Isolated: {name}",hideObject:"Hide {name}",showObject:"Show {name}",objectSelected:"{name} selected",objectNavigatorPosition:"{position} of {count}",compareDividerValue:"{before} {percent}%, {after} {rest}%",bindingMismatchOne:"1 object binding doesn't match this model",bindingMismatchMany:"{count} object bindings don't match this model",simpleLargeModelWarning:"Very large model detected ({millions}M triangles) \u2014 it may render and move slowly on this device, and click/hover selection on the model is disabled. Use the scene objects panel to select parts.",dropModelHint:"Drag and drop {formats} here",loadErrorTitle:"This model couldn't be loaded",loadErrorNotFound:"Nothing was found at this address ({status}). Check that modelUrl points to the file.",loadErrorDenied:"The server refused access to the file ({status}). Check that the file is public, or that a signed URL hasn't expired.",loadErrorStatus:"The server responded with {status} when the file was requested.",loadErrorNetwork:"The download was blocked or failed. Check that the URL is correct and, if the file is on another domain, that its server allows cross-origin requests (CORS) from this site.",loadErrorHtml:"The server sent back a web page instead of a model. There's probably no file at this path: many servers answer a missing file with their index.html.",loadErrorInvalidFile:"The file couldn't be read as {format}. Check that it's a valid {format} file.",loadErrorInvalidExplicitFormat:"The file couldn't be read as {format}. Check that it's a valid {format} file and that modelFormat matches it.",loadErrorMissingFormat:"The file couldn't be read as {format}. The URL has no file extension, so set modelFormat to the file's format.",loadErrorPointCloud:"This PLY file is a point cloud: it has points but no faces, and the viewer shows meshes. Turn it into a mesh first, for example with MeshLab or Blender.",measurementReferenceFaceRequired:"Pick a triangle face to define the reference plane.",measurementTooManyPoints:"Finish or clear this measurement before adding more points.",measurementAngleDistinct:"Pick a point away from the angle's vertex.",areaMinimumPoints:"Pick at least three points to finish the area.",areaDistinctPoints:"Area points must be distinct.",areaStraightLine:"Area points must not lie on one straight line.",areaNotPlanar:"Area points must lie on one plane.",areaEdgesCross:"Area edges must not cross or touch each other.",areaZero:"The polygon has no measurable area.",decalSurfaceMissing:"Could not find a surface on this object for the decal.",decalDirectionMissing:"No visible surface in that direction. Try another arrow or rotate the view.",fullscreenExitFailed:"Could not exit fullscreen. Press Escape to exit.",fullscreenEnterFailed:"Could not enter fullscreen. Check your browser or iframe fullscreen permissions and try again.",uvCoordinatesMissing:"This model does not contain UV coordinates.",uvExportFailed:"Could not create the UV layout archive.",videoExportFailed:"Could not export the video.",videoNotReady:"Viewer not ready for video export.",videoExitXR:"Exit the XR session before recording a video.",videoAlreadyRecording:"A video export is already in progress.",videoPathRequired:"Enable a cinematic camera path before recording it.",videoDurationInvalid:"Video duration must be greater than 0 and at most 300 seconds.",videoFrameRateInvalid:"Video frame rate must be between 1 and 60.",videoBitrateInvalid:"Video bitrate must be a positive number.",videoContextLost:"Video export stopped because the WebGL context was lost.",videoTimedOut:"Video export timed out. Keep the viewer tab visible while recording.",videoEncodingFailed:"The browser could not encode the video.",videoEmpty:"The browser produced an empty video.",videoDidNotStart:"Video recording did not start.",videoWebMUnsupported:"Video recording as WEBM is not supported in this browser.",videoMP4Unsupported:"Video recording as MP4 is not supported in this browser.",videoGIFUnsupported:"Video recording as GIF is not supported in this browser.",videoGifWidthInvalid:"GIF width must be a whole number of pixels from 16 to 4096.",environmentApartment:"apartment",environmentCity:"city",environmentDawn:"dawn",environmentForest:"forest",environmentLobby:"lobby",environmentNight:"night",environmentPark:"park",environmentStudio:"studio",environmentSunset:"sunset",environmentWarehouse:"warehouse",color:"Color",material:"Material",texturePreview:"texture preview",noTextureApplied:"No texture applied",noTextureCoordinates:"This part has no texture coordinates, so an image can't be placed on it.",replaceImage:"Replace image",uploadImage:"Upload image",removeTexture:"Remove texture",texturePosition:"Texture position",offsetX:"Offset X",offsetY:"Offset Y",confirmTexturePosition:"Confirm this texture position and exit positioning mode",donePositioning:"Done positioning",textureOffsetHint:"Double-click the object in the preview to drag its texture directly (scroll to zoom), or edit its offset numerically.",actionToggleLight:"Toggle Light",actionChangeLightColor:"Change Light Color",actionSetBrightness:"Set Brightness",actionChangeColor:"Change Color",actionChangeMaterial:"Change Material",actionToggleVisibility:"Toggle Visibility"};function X(e,t,n={}){return(e?.[t]??F[t]).replace(/\{(\w+)\}/g,(o,a)=>Object.prototype.hasOwnProperty.call(n,a)?String(n[a]):o)}var $=new Map(Object.entries(F).map(([e,t])=>[t,e]));function ye(e,t){let n=$.get(t);return n?X(e,n):t}import{Box3 as U,Vector3 as B}from"three";var Z=new Set(["KHR_binary_glTF","KHR_draco_mesh_compression","KHR_lights_punctual","KHR_materials_clearcoat","KHR_materials_dispersion","KHR_materials_ior","KHR_materials_sheen","KHR_materials_specular","KHR_materials_transmission","KHR_materials_iridescence","KHR_materials_anisotropy","KHR_materials_unlit","KHR_materials_volume","KHR_texture_basisu","KHR_texture_transform","KHR_mesh_quantization","KHR_materials_emissive_strength","KHR_materials_variants","EXT_materials_bump","EXT_texture_webp","EXT_texture_avif","EXT_meshopt_compression","EXT_mesh_gpu_instancing"]),H=new WeakMap;function we(e,t){H.set(e,structuredClone(t))}function J(e){let t=H.get(e);return t?structuredClone(t):void 0}function z(e){if(/^(blob|data):/i.test(e))return"Local resource";let t=e.split(/[?#]/,1)[0].replace(/\\/g,"/");return t.slice(t.lastIndexOf("/")+1).slice(0,300)||"Resource"}function Q(e){return/^(blob|data):/i.test(e)?"Local resource":e.split(/[?#]/,1)[0].replace(/\\/g,"/").replace(/^[a-z][a-z0-9+.-]*:\/\/[^/]*/i,"").replace(/^\/+/,"").slice(0,500)||"Resource"}function G(e){let t=n=>typeof n=="number"&&Number.isFinite(n)&&n>=0?n:null;return{...e.format?{format:e.format}:{},...e.name?{name:z(e.name)}:{},sourceBytes:t(e.sourceBytes),loadDurationMs:t(e.loadDurationMs),extensionsUsed:[...new Set(e.extensionsUsed??[])].sort(),extensionsRequired:[...new Set(e.extensionsRequired??[])].sort(),failedResources:[...new Set((e.failedResources??[]).map(Q))].slice(0,50)}}function K(e){let t=new Set(e.extensionsRequired);return[...new Set([...e.extensionsUsed??[],...t])].sort().map(n=>({name:n,required:t.has(n),recognized:Z.has(n)}))}function ee(e,t){let n=e.image,r=b=>typeof b=="number"&&Number.isSafeInteger(b)&&b>0?b:null,o=r(n?.naturalWidth??n?.width),a=r(n?.naturalHeight??n?.height),s=!!e.isCompressedTexture,M=e.mipmaps.reduce((b,d)=>b+(d.data?.byteLength??0),0),x=o&&a?Math.ceil(o*a*4*(e.generateMipmaps?4/3:1)):null;return{name:e.name?z(e.name):t,width:o,height:a,compressed:s,estimatedBytes:s?M||null:x!==null&&Number.isSafeInteger(x)?x:null}}function Se(e,t={}){let n=G({...J(e),...t.source}),r=[],o=new Set,a=new Map,s=new Set,M=new Map,x=new Map,b=new Set,d=new Map,T=0,V=0,l=0,c=0,f=0,h=(i,u)=>{let p=d.get(i)??{count:0,names:[]};p.count++,p.names.length<20&&p.names.push(u||"Unnamed object"),d.set(i,p)},m=i=>{let u=i?.array??i?.data?.array;u?.buffer&&!b.has(u.buffer)&&(b.add(u.buffer),f+=u.buffer.byteLength)};e.traverse(i=>{let u=i;if(!u.isMesh||!u.geometry)return;T++,V+=u.isInstancedMesh?Number.isSafeInteger(u.count)?Math.max(0,u.count??0):0:1;let p=u.geometry,v=p.getAttribute("position"),I=p.getAttribute("uv"),O=u.material?Array.isArray(u.material)?u.material:[u.material]:[];if(!a.has(p)){let S=!!v&&(!Number.isSafeInteger(v.count)||v.count<0);for(let A=0;!S&&v&&A<v.count;A++)if(!Number.isFinite(v.getX(A))||!Number.isFinite(v.getY(A))||!Number.isFinite(v.getZ(A))){S=!0;break}a.set(p,S)}if(a.get(p)&&h("invalid-positions",i.name),v?.count||h("empty-geometry",i.name),I||h("missing-uv",i.name),p.getAttribute("normal")||h("missing-normals",i.name),p.boundingBox&&[...p.boundingBox.min.toArray(),...p.boundingBox.max.toArray()].some(S=>!Number.isFinite(S))&&h("invalid-bounds",i.name),!o.has(p)){o.add(p),l+=Number.isSafeInteger(v?.count)?Math.max(0,v?.count??0):0;let S=p.index?.count??v?.count??0;c+=Number.isSafeInteger(S)?Math.floor(Math.max(0,S)/3):0,Object.values(p.attributes).forEach(m),Object.values(p.morphAttributes).flat().forEach(m),m(p.index)}let j=!1;for(let S of O){s.add(S);let A=M.get(S);if(!A){A=Object.values(S).filter(D=>!!D&&D.isTexture===!0),M.set(S,A);for(let D of A)x.has(D)||x.set(D,`Texture ${x.size+1}`)}for(let D of A){let _=D.channel??0;p.getAttribute(_===0?"uv":`uv${_}`)||(j=!0)}}j&&h("textured-missing-uv",i.name)});let g=(i,u,p,v,I)=>{let O=d.get(i);O&&r.push({code:i,severity:u,title:p,detail:v,suggestion:I,count:O.count,objects:O.names})};g("empty-geometry","error","Empty mesh geometry","Some meshes have no position data.","Remove empty meshes or export their geometry again."),g("invalid-positions","error","Invalid vertex coordinates","Some vertices contain non-finite coordinates.","Repair NaN or infinite vertex positions in the source application, then re-export."),g("invalid-bounds","error","Invalid geometry bounds","Some cached bounds contain non-finite values.","Repair invalid coordinates in the source application and re-export."),g("textured-missing-uv","warning","Textures have no matching UV coordinates","A texture references a UV channel that its mesh does not contain.","Unwrap the affected meshes and export the UV channel used by each texture."),g("missing-uv","info","Meshes without UVs","Solid colors can work without UVs; image textures and surface decals need them.","Add a UV map before applying image textures or decals."),g("missing-normals","info","Meshes without normals","Some loaded meshes lack vertex normals; generated shading may differ from the source.","Export vertex normals to preserve hard edges and smooth surfaces."),T||r.push({code:"no-meshes",severity:"warning",title:"No mesh geometry found",detail:"This scene contains no loaded meshes.",suggestion:"Check that meshes were included in the export. Streamed scenes may still be loading."});let R=[...x].map(([i,u])=>ee(i,u)),C=R.filter(i=>(i.width??0)>4096||(i.height??0)>4096);C.length&&r.push({code:"large-textures",severity:"warning",title:"Large texture dimensions",detail:"Some textures exceed 4096 pixels on one side.",suggestion:"Resize textures for the visible detail needed; use KTX2/Basis where appropriate.",count:C.length,objects:C.slice(0,20).map(i=>i.name)}),c>1e6&&r.push({code:"high-triangle-count",severity:"warning",title:"High geometry count",detail:"The loaded geometry contains more than one million unique triangles.",suggestion:"Simplify hidden detail, create lower-detail exports, or use streamed assets for large scenes."}),s.size>100&&r.push({code:"many-materials",severity:"warning",title:"Many material definitions",detail:"More than 100 materials can increase rendering work.",suggestion:"Reuse materials and atlas compatible textures; inspect runtime draw calls to confirm the cost."});let L=K(n);for(let i of L.filter(u=>!u.recognized))r.push({code:"unrecognized-extension",severity:i.required?"error":"warning",title:`${i.required?"Required":"Optional"} extension not recognized`,detail:i.name,suggestion:"Export with extensions supported by the bundled loader, or verify the asset's fallback appearance."});n.failedResources?.length&&r.push({code:"failed-resources",severity:"error",title:"Some resources failed to load",detail:"The model may be missing textures or other referenced resources.",suggestion:"Include sidecar files in the ZIP, correct their paths, and check HTTP access and CORS.",count:n.failedResources.length,objects:n.failedResources.slice(0,20)});let k=null,w=[...a.values()].some(Boolean)?new U:new U().setFromObject(e);!w.isEmpty()&&[...w.min.toArray(),...w.max.toArray(),...w.getSize(new B).toArray()].every(Number.isFinite)&&(k={min:w.min.toArray(),max:w.max.toArray(),center:w.getCenter(new B).toArray(),size:w.getSize(new B).toArray()}),t.scope==="resident-tiles"&&r.unshift({code:"partial-stream",severity:"info",title:"Loaded tiles only",detail:"Geometry and texture counts cover the current resident tiles, not the entire source asset.",suggestion:"Use the live cache/detail statistics to inspect streaming pressure. Rescan after moving the camera."});let E=i=>i.code==="partial-stream"?-1:i.severity==="error"?0:i.severity==="warning"?1:2;return r.sort((i,u)=>E(i)-E(u)),{version:1,status:"ready",scope:t.scope??"asset",source:n,units:n.format==="glb"||n.format==="gltf"?"meters (glTF convention)":"unknown",bounds:k,statistics:{meshes:T,instances:V,geometries:o.size,materials:s.size,textures:x.size,vertices:l,triangles:c,geometryBytes:f,estimatedTextureBytes:R.reduce((i,u)=>i+(u.estimatedBytes??0),0),unknownTextureSizes:R.filter(i=>i.estimatedBytes===null).length,meshesWithoutUvs:d.get("missing-uv")?.count??0,meshesWithoutNormals:d.get("missing-normals")?.count??0},textures:R,extensions:L,issues:r}}function Ae(e={}){return{version:1,status:"failed",scope:"asset",source:G(e),units:"unknown",bounds:null,statistics:null,textures:[],extensions:K(e),issues:[{code:"load-failed",severity:"error",title:"Asset could not be loaded",detail:"Geometry and textures could not be inspected.",suggestion:"Check the file format, required decoders, sidecar paths, HTTP access and CORS, then reload the asset."}]}}var N="KHR_materials_variants",q="riMaterialVariants",W="riMaterialVariantGroups";function y(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function te(e){if(!y(e)||!y(e.extensions))return[];let t=e.extensions[N];if(!y(t)||!Array.isArray(t.variants))return[];let n=new Set;return t.variants.map((r,o)=>{let a=y(r)&&typeof r.name=="string"&&r.name?r.name:`Variant ${o+1}`,s=a;for(let M=2;n.has(s);M+=1)s=`${a} (${M})`;return n.add(s),s})}function Re(e){let t=e.userData?.gltfExtensions;if(!y(t))return[];let n=t[N];return!y(n)||!Array.isArray(n.mappings)?[]:n.mappings.filter(r=>y(r)&&Number.isInteger(r.material)&&Array.isArray(r.variants)&&r.variants.every(Number.isInteger))}function ke(e,t){for(let n=t.length-1;n>=0;n-=1){let r=t[n];if(r<0)continue;let o=e.find(a=>a.variants.includes(r));if(o)return o.material}return null}var ne=/^\s*(.+?)\s*(?::|\s\/\s)\s*(.+?)\s*$/;function re(e){let t=Math.min(Math.max(e,0),1),n=t<=.0031308?t*12.92:1.055*t**(1/2.4)-.055;return Math.round(n*255)}function ie(e){if(!y(e))return;let t=y(e.pbrMetallicRoughness)?e.pbrMetallicRoughness:{};if(t.baseColorTexture!==void 0)return;let n=Array.isArray(t.baseColorFactor)?t.baseColorFactor:[1,1,1,1];if(n.slice(0,3).every(r=>typeof r=="number"))return`#${n.slice(0,3).map(r=>re(r).toString(16).padStart(2,"0")).join("")}`}function oe(e,t){if(t.length===0)return[];let n=y(e)?e:{},r=Array.isArray(n.meshes)?n.meshes:[],o=Array.isArray(n.accessors)?n.accessors:[],a=Array.isArray(n.materials)?n.materials:[],s=t.map(()=>new Set),M=t.map(()=>new Map);r.forEach((l,c)=>{(y(l)&&Array.isArray(l.primitives)?l.primitives:[]).forEach((h,m)=>{if(!y(h))return;let g=y(h.extensions)?h.extensions[N]:void 0;if(!y(g)||!Array.isArray(g.mappings))return;let R=y(h.attributes)?h.attributes.POSITION:void 0,C=typeof R=="number"?o[R]:void 0,L=y(C)&&typeof C.count=="number"?C.count:1;for(let k of g.mappings)if(!(!y(k)||!Number.isInteger(k.material)||!Array.isArray(k.variants)))for(let w of k.variants){if(!Number.isInteger(w)||!s[w])continue;s[w].add(`${c}/${m}`);let E=M[w],i=k.material;E.set(i,(E.get(i)??0)+L)}})});let x=t.map((l,c)=>{let f=null;for(let[m,g]of M[c])(f===null||g>(M[c].get(f)??0))&&(f=m);let h=f===null?void 0:ie(a[f]);return{name:l,label:l,...h?{swatch:h}:{}}}),b=t.map(()=>-1),d=[],T=new Map;return t.forEach((l,c)=>{let f=ne.exec(l);if(!f)return;let[,h,m]=f;T.has(h)||(T.set(h,d.length),d.push({name:h,members:[]})),b[c]=T.get(h),d[b[c]].members.push(c),x[c].label=m}),t.map((l,c)=>c).filter(l=>b[l]<0).sort((l,c)=>+(s[l].size===0)-+(s[c].size===0)).forEach(l=>{let c=d.map((m,g)=>({group:m,groupIndex:g})).filter(({group:m})=>m.name===null&&m.members.some(g=>s[l].size===0||s[g].size===0?!1:[...s[l]].some(R=>s[g].has(R)))).map(({groupIndex:m})=>m);if(c.length===0&&s[l].size===0){let m=d.findIndex(g=>g.name===null);m>=0&&c.push(m)}if(c.length===0){b[l]=d.length,d.push({name:null,members:[l]});return}let[f,...h]=c;for(let m of h){for(let g of d[m].members)b[g]=f;d[f].members.push(...d[m].members),d[m].members=[]}b[l]=f,d[f].members.push(l)}),d.filter(l=>l.members.length>0).sort((l,c)=>Math.min(...l.members)-Math.min(...c.members)).map(l=>({name:l.name,variants:[...l.members].sort((c,f)=>c-f).map(c=>x[c])}))}function Ce(e,t,n){let r=n.find(a=>a.variants.some(s=>s.name===t)),o=new Set(r?.variants.map(a=>a.name)??[t]);return[...e.filter(a=>!o.has(a)),t]}function De(e){if(Array.isArray(e.activeVariants))return e.activeVariants.filter(n=>typeof n=="string");let t=e.materialVariant;return typeof t=="string"&&t?[t]:[]}function Pe(e){let t=e.parser,n=te(t?.json);if(!(!t||n.length===0))return e.scene.userData[q]=n,e.scene.userData[W]=oe(t.json,n),{names:n,resolveMaterial:async(r,o)=>{let a={geometry:o.geometry,material:await t.getDependency("material",r),isPoints:o.isPoints,isLine:o.isLine};return t.assignFinalMaterial(a),a.material}}}function ae(e){let t=e.userData?.[q];return Array.isArray(t)&&t.every(n=>typeof n=="string")?t:[]}function Ve(e){let t=e.userData?.[W];if(Array.isArray(t))return t;let n=ae(e);return n.length>0?[{name:null,variants:n.map(r=>({name:r,label:r}))}]:[]}function Ee(e,t){let{materialVariant:n,...r}=e;return{...r,activeVariants:t}}import{Matrix4 as se,Vector3 as le}from"three";function ce(e){return e.isSkinnedMesh===!0}function Ne(e){let t=[];return e.traverse(n=>{ce(n)&&t.push(n)}),t}var P="reactImmersiveSkinFreeze";function je(e){return!!e.userData[P]}function _e(e,t,n=[t]){let r=e.userData,o=new se().copy(t).invert(),a=r[P];if(a){a.frozenInverse.copy(o),a.restWorldTransforms=n.map(M=>M.clone()),e.bindMatrixInverse.copy(o);return}let s={frozenInverse:o,restWorldTransforms:n.map(M=>M.clone()),previousOnBeforeRender:e.onBeforeRender};e.bindMatrixInverse.copy(o),e.onBeforeRender=function(M,x,b,d,T,V){s.previousOnBeforeRender.call(this,M,x,b,d,T,V),e.bindMatrixInverse.copy(s.frozenInverse)},r[P]=s}function ue(e){return e.userData[P]?.frozenInverse??null}function Fe(e){return e.userData[P]?.restWorldTransforms??null}function Ue(e){let t=e.userData,n=t[P];n&&(e.onBeforeRender=n.previousOnBeforeRender,delete t[P],e.updateMatrixWorld(!0))}function He(e){let t=e,n=ue(e);n&&t.bindMatrixInverse.copy(n),t.skeleton?.update?.();let r=t.geometry.clone(),o=r.getAttribute("position");if(o){let a=new le;for(let s=0;s<o.count;s++)t.getVertexPosition(s,a),o.setXYZ(s,a.x,a.y,a.z);o.needsUpdate=!0}return r.deleteAttribute("skinIndex"),r.deleteAttribute("skinWeight"),r.morphAttributes={},r.morphTargetsRelative=!1,r.computeVertexNormals(),r.computeBoundingBox(),r.computeBoundingSphere(),r}function ze(e){return e.matrixWorld.clone()}import{AdditiveBlending as de,BackSide as me,DoubleSide as pe,FrontSide as he,NoColorSpace as ge,NormalBlending as fe,SRGBColorSpace as be,Vector2 as Y}from"three";function Qe(e){let t=!0;return e?.traverse(n=>{let r=n.isMesh?n.geometry:null;r&&!r.getAttribute("uv")&&(t=!1)}),t}function et(e){return!!(e&&typeof e=="object"&&"clone"in e&&"color"in e&&"metalness"in e&&"roughness"in e)}function tt(e){return!!(e&&typeof e=="object"&&"isMeshPhysicalMaterial"in e&&e.isMeshPhysicalMaterial)}function nt(e){return!!(e&&"isMesh"in e&&e.isMesh)}var rt=["texture","metalnessMap","roughnessMap","emissiveMap","alphaMap","normalMap","bumpMap","aoMap","displacementMap","clearcoatMap","clearcoatRoughnessMap","clearcoatNormalMap","anisotropyMap","transmissionMap","thicknessMap","sheenColorMap","sheenRoughnessMap","specularIntensityMap","specularColorMap"],it={texture:"map",metalnessMap:"metalnessMap",roughnessMap:"roughnessMap",emissiveMap:"emissiveMap",alphaMap:"alphaMap",normalMap:"normalMap",bumpMap:"bumpMap",aoMap:"aoMap",displacementMap:"displacementMap",clearcoatMap:"clearcoatMap",clearcoatRoughnessMap:"clearcoatRoughnessMap",clearcoatNormalMap:"clearcoatNormalMap",anisotropyMap:"anisotropyMap",transmissionMap:"transmissionMap",thicknessMap:"thicknessMap",sheenColorMap:"sheenColorMap",sheenRoughnessMap:"sheenRoughnessMap",specularIntensityMap:"specularIntensityMap",specularColorMap:"specularColorMap"},Me=new Set(["texture","emissiveMap","sheenColorMap","specularColorMap"]);function ot(e){return Me.has(e)?be:ge}function at(e,t){return e?.[t]?.path}function st(e,t){let n=e?.[t]?.offset;if(!n)return;let[r,o]=n;if(!(!Number.isFinite(r)||!Number.isFinite(o)))return r===0&&o===0?void 0:[r,o]}function lt(e,t){let n=e?.[t]?.scale;if(!(!Number.isFinite(n)||!n))return n===1?void 0:n}function ct(e,t){let n=e?.[t]?.rotation;if(!(!Number.isFinite(n)||!n))return n}function ut(e){return e==="back"?me:e==="double"?pe:he}function dt(e){return e==="additive"?de:fe}function mt(e,t=1,n=t){if(e&&typeof e=="object"){let r=e;if(typeof r.x=="number"&&Number.isFinite(r.x)&&typeof r.y=="number"&&Number.isFinite(r.y))return new Y(r.x,r.y)}return new Y(t,n)}function pt(e){return Number.isFinite(e)&&e>0?e:1}function ht(e,t){return e?.animations.clips.find(n=>n.sourceName===t)}function gt(e){return e?.loopMode??"repeat"}export{ce as a,Ne as b,je as c,_e as d,ue as e,Fe as f,Ue as g,He as h,ze as i,F as j,X as k,ye as l,we as m,J as n,z as o,Q as p,Se as q,Ae as r,Qe as s,et as t,tt as u,nt as v,rt as w,it as x,ot as y,at as z,st as A,lt as B,ct as C,ut as D,dt as E,mt as F,pt as G,ht as H,gt as I,Re as J,ke as K,Ce as L,De as M,Pe as N,ae as O,Ve as P,Ee as Q};