@liveroom-tech/react-immersive 6.1.1 → 6.1.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.
- package/dist/{SequencesTab-LWGOVQ6Y.mjs → SequencesTab-JTIVIZJD.mjs} +1 -1
- package/dist/binding-builder.css +1 -1
- package/dist/binding-builder.d.mts +3 -3
- package/dist/binding-builder.d.ts +3 -3
- package/dist/binding-builder.js +34 -27
- package/dist/binding-builder.mjs +1 -1
- package/dist/chunk-35UERL2D.mjs +83 -0
- package/dist/{chunk-DEFZEXTA.mjs → chunk-5XII5XCD.mjs} +1 -1
- package/dist/{chunk-EV6THDXD.mjs → chunk-6Q6YZ7O5.mjs} +1 -1
- package/dist/{chunk-KNCABWVN.mjs → chunk-DS5XNP7A.mjs} +2 -2
- package/dist/chunk-M4LVNNVP.mjs +1 -0
- package/dist/chunk-Q4QPI5GG.mjs +9 -0
- package/dist/{chunk-MLT4JQAY.mjs → chunk-W7M2YD65.mjs} +1 -1
- package/dist/{chunk-Z2VQGUC2.mjs → chunk-WJIICFV4.mjs} +2 -2
- package/dist/{chunk-5PJ5MLKE.mjs → chunk-XBVAZFXW.mjs} +1 -1
- package/dist/hosted.css +1 -1
- package/dist/hosted.d.mts +3 -3
- package/dist/hosted.d.ts +3 -3
- package/dist/hosted.js +33 -26
- package/dist/hosted.mjs +1 -1
- package/dist/index.css +1 -1
- package/dist/index.d.mts +4 -4
- package/dist/index.d.ts +4 -4
- package/dist/index.js +31 -24
- package/dist/index.mjs +1 -1
- package/dist/{modelFileResolver-B8ADn9Nl.d.mts → modelFileResolver-pPzMl63D.d.mts} +6 -0
- package/dist/{modelFileResolver-B8ADn9Nl.d.ts → modelFileResolver-pPzMl63D.d.ts} +6 -0
- package/dist/{modelViewerProps-BE4D56Ti.d.ts → modelViewerProps-07WgBVqm.d.ts} +4 -2
- package/dist/{modelViewerProps-DBwh-fmu.d.mts → modelViewerProps-CGgtm4Zb.d.mts} +4 -2
- package/dist/{publicProps-Clr1nSE6.d.mts → publicProps-BylAVwPu.d.mts} +1 -1
- package/dist/{publicProps-3LNTAskZ.d.ts → publicProps-CEt3hxQU.d.ts} +1 -1
- package/dist/simple-model-viewer.d.mts +2 -2
- package/dist/simple-model-viewer.d.ts +2 -2
- package/dist/simple-model-viewer.js +1 -1
- package/dist/simple-model-viewer.mjs +1 -1
- package/dist/utils.d.mts +4 -4
- package/dist/utils.d.ts +4 -4
- package/dist/utils.js +9 -2
- package/dist/utils.mjs +1 -1
- package/package.json +1 -1
- package/dist/chunk-5FLX45O5.mjs +0 -2
- package/dist/chunk-644OGSQJ.mjs +0 -83
- package/dist/chunk-OPDRK3GS.mjs +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as o,c as t}from"./chunk-
|
|
1
|
+
import{b as o,c as t}from"./chunk-M4LVNNVP.mjs";import{createContext as l,useContext as n,useMemo as a}from"react";import{jsx as d}from"react/jsx-runtime";var i=l(void 0);function V({labels:e,children:r}){return d(i.Provider,{value:e,children:r})}function u(){let e=n(i);return a(()=>Object.assign((r,s)=>o(e,r,s),{message:r=>t(e,r)}),[e])}export{V as a,u as b};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{Box3 as F,Vector3 as O}from"three";var P=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"]),K=new WeakMap;function ae(e,n){K.set(e,structuredClone(n))}function G(e){let n=K.get(e);return n?structuredClone(n):void 0}function U(e){if(/^(blob|data):/i.test(e))return"Local resource";let n=e.split(/[?#]/,1)[0].replace(/\\/g,"/");return n.slice(n.lastIndexOf("/")+1).slice(0,300)||"Resource"}function V(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 H(e){let n=t=>typeof t=="number"&&Number.isFinite(t)&&t>=0?t:null;return{...e.format?{format:e.format}:{},...e.name?{name:U(e.name)}:{},sourceBytes:n(e.sourceBytes),loadDurationMs:n(e.loadDurationMs),extensionsUsed:[...new Set(e.extensionsUsed??[])].sort(),extensionsRequired:[...new Set(e.extensionsRequired??[])].sort(),failedResources:[...new Set((e.failedResources??[]).map(V))].slice(0,50)}}function L(e){let n=new Set(e.extensionsRequired);return[...new Set([...e.extensionsUsed??[],...n])].sort().map(t=>({name:t,required:n.has(t),recognized:P.has(t)}))}function X(e,n){let t=e.image,r=m=>typeof m=="number"&&Number.isSafeInteger(m)&&m>0?m:null,a=r(t?.naturalWidth??t?.width),u=r(t?.naturalHeight??t?.height),l=!!e.isCompressedTexture,y=e.mipmaps.reduce((m,g)=>m+(g.data?.byteLength??0),0),c=a&&u?Math.ceil(a*u*4*(e.generateMipmaps?4/3:1)):null;return{name:e.name?U(e.name):n,width:a,height:u,compressed:l,estimatedBytes:l?y||null:c!==null&&Number.isSafeInteger(c)?c:null}}function ue(e,n={}){let t=H({...G(e),...n.source}),r=[],a=new Set,u=new Map,l=new Set,y=new Map,c=new Map,m=new Set,g=new Map,v=0,R=0,T=0,B=0,I=0,b=(s,i)=>{let o=g.get(s)??{count:0,names:[]};o.count++,o.names.length<20&&o.names.push(i||"Unnamed object"),g.set(s,o)},w=s=>{let i=s?.array??s?.data?.array;i?.buffer&&!m.has(i.buffer)&&(m.add(i.buffer),I+=i.buffer.byteLength)};e.traverse(s=>{let i=s;if(!i.isMesh||!i.geometry)return;v++,R+=i.isInstancedMesh?Number.isSafeInteger(i.count)?Math.max(0,i.count??0):0:1;let o=i.geometry,d=o.getAttribute("position"),D=o.getAttribute("uv"),k=i.material?Array.isArray(i.material)?i.material:[i.material]:[];if(!u.has(o)){let p=!!d&&(!Number.isSafeInteger(d.count)||d.count<0);for(let f=0;!p&&d&&f<d.count;f++)if(!Number.isFinite(d.getX(f))||!Number.isFinite(d.getY(f))||!Number.isFinite(d.getZ(f))){p=!0;break}u.set(o,p)}if(u.get(o)&&b("invalid-positions",s.name),d?.count||b("empty-geometry",s.name),D||b("missing-uv",s.name),o.getAttribute("normal")||b("missing-normals",s.name),o.boundingBox&&[...o.boundingBox.min.toArray(),...o.boundingBox.max.toArray()].some(p=>!Number.isFinite(p))&&b("invalid-bounds",s.name),!a.has(o)){a.add(o),T+=Number.isSafeInteger(d?.count)?Math.max(0,d?.count??0):0;let p=o.index?.count??d?.count??0;B+=Number.isSafeInteger(p)?Math.floor(Math.max(0,p)/3):0,Object.values(o.attributes).forEach(w),Object.values(o.morphAttributes).flat().forEach(w),w(o.index)}let j=!1;for(let p of k){l.add(p);let f=y.get(p);if(!f){f=Object.values(p).filter(h=>!!h&&h.isTexture===!0),y.set(p,f);for(let h of f)c.has(h)||c.set(h,`Texture ${c.size+1}`)}for(let h of f){let E=h.channel??0;o.getAttribute(E===0?"uv":`uv${E}`)||(j=!0)}}j&&b("textured-missing-uv",s.name)});let S=(s,i,o,d,D)=>{let k=g.get(s);k&&r.push({code:s,severity:i,title:o,detail:d,suggestion:D,count:k.count,objects:k.names})};S("empty-geometry","error","Empty mesh geometry","Some meshes have no position data.","Remove empty meshes or export their geometry again."),S("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."),S("invalid-bounds","error","Invalid geometry bounds","Some cached bounds contain non-finite values.","Repair invalid coordinates in the source application and re-export."),S("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."),S("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."),S("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."),v||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 A=[...c].map(([s,i])=>X(s,i)),_=A.filter(s=>(s.width??0)>4096||(s.height??0)>4096);_.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:_.length,objects:_.slice(0,20).map(s=>s.name)}),B>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."}),l.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 N=L(t);for(let s of N.filter(i=>!i.recognized))r.push({code:"unrecognized-extension",severity:s.required?"error":"warning",title:`${s.required?"Required":"Optional"} extension not recognized`,detail:s.name,suggestion:"Export with extensions supported by the bundled loader, or verify the asset's fallback appearance."});t.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:t.failedResources.length,objects:t.failedResources.slice(0,20)});let z=null,M=[...u.values()].some(Boolean)?new F:new F().setFromObject(e);!M.isEmpty()&&[...M.min.toArray(),...M.max.toArray(),...M.getSize(new O).toArray()].every(Number.isFinite)&&(z={min:M.min.toArray(),max:M.max.toArray(),center:M.getCenter(new O).toArray(),size:M.getSize(new O).toArray()}),n.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 C=s=>s.code==="partial-stream"?-1:s.severity==="error"?0:s.severity==="warning"?1:2;return r.sort((s,i)=>C(s)-C(i)),{version:1,status:"ready",scope:n.scope??"asset",source:t,units:t.format==="glb"||t.format==="gltf"?"meters (glTF convention)":"unknown",bounds:z,statistics:{meshes:v,instances:R,geometries:a.size,materials:l.size,textures:c.size,vertices:T,triangles:B,geometryBytes:I,estimatedTextureBytes:A.reduce((s,i)=>s+(i.estimatedBytes??0),0),unknownTextureSizes:A.filter(s=>s.estimatedBytes===null).length,meshesWithoutUvs:g.get("missing-uv")?.count??0,meshesWithoutNormals:g.get("missing-normals")?.count??0},textures:A,extensions:N,issues:r}}function ce(e={}){return{version:1,status:"failed",scope:"asset",source:H(e),units:"unknown",bounds:null,statistics:null,textures:[],extensions:L(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."}]}}import{Matrix4 as q,Vector3 as Y}from"three";function Z(e){return e.isSkinnedMesh===!0}function fe(e){let n=[];return e.traverse(t=>{Z(t)&&n.push(t)}),n}var x="reactImmersiveSkinFreeze";function ge(e){return!!e.userData[x]}function Me(e,n,t=[n]){let r=e.userData,a=new q().copy(n).invert(),u=r[x];if(u){u.frozenInverse.copy(a),u.restWorldTransforms=t.map(c=>c.clone()),e.bindMatrixInverse.copy(a);return}let l={frozenInverse:a,restWorldTransforms:t.map(c=>c.clone()),previousOnBeforeRender:e.onBeforeRender,previousUpdateMatrixWorld:Object.prototype.hasOwnProperty.call(e,"updateMatrixWorld")?e.updateMatrixWorld:void 0};e.bindMatrixInverse.copy(a);let y=e.updateMatrixWorld;e.updateMatrixWorld=function(c){y.call(this,c),e.bindMatrixInverse.copy(l.frozenInverse)},e.onBeforeRender=function(c,m,g,v,R,T){l.previousOnBeforeRender.call(this,c,m,g,v,R,T),e.bindMatrixInverse.copy(l.frozenInverse)},r[x]=l}function $(e){return e.userData[x]?.frozenInverse??null}function he(e){return e.userData[x]?.restWorldTransforms??null}function xe(e){let n=e.userData,t=n[x];t&&(e.onBeforeRender=t.previousOnBeforeRender,t.previousUpdateMatrixWorld?e.updateMatrixWorld=t.previousUpdateMatrixWorld:delete e.updateMatrixWorld,delete n[x],e.updateMatrixWorld(!0))}function ye(e){let n=e,t=$(e);t&&n.bindMatrixInverse.copy(t),n.skeleton?.update?.();let r=n.geometry.clone(),a=r.getAttribute("position");if(a){let u=new Y;for(let l=0;l<a.count;l++)n.getVertexPosition(l,u),a.setXYZ(l,u.x,u.y,u.z);a.needsUpdate=!0}return r.deleteAttribute("skinIndex"),r.deleteAttribute("skinWeight"),r.morphAttributes={},r.morphTargetsRelative=!1,r.computeVertexNormals(),r.computeBoundingBox(),r.computeBoundingSphere(),r}function be(e){return e.matrixWorld.clone()}import{AdditiveBlending as J,BackSide as Q,DoubleSide as ee,FrontSide as te,NoColorSpace as ne,NormalBlending as re,SRGBColorSpace as se,Vector2 as W}from"three";function De(e){let n=!0;return e?.traverse(t=>{let r=t.isMesh?t.geometry:null;r&&!r.getAttribute("uv")&&(n=!1)}),n}function Oe(e){return!!(e&&typeof e=="object"&&"clone"in e&&"color"in e&&"metalness"in e&&"roughness"in e)}function Ie(e){return!!(e&&typeof e=="object"&&"isMeshPhysicalMaterial"in e&&e.isMeshPhysicalMaterial)}function Ne(e){return!!(e&&"isMesh"in e&&e.isMesh)}var ze=["texture","metalnessMap","roughnessMap","emissiveMap","alphaMap","normalMap","bumpMap","aoMap","displacementMap","clearcoatMap","clearcoatRoughnessMap","clearcoatNormalMap","anisotropyMap","transmissionMap","thicknessMap","sheenColorMap","sheenRoughnessMap","specularIntensityMap","specularColorMap"],Ce={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"},ie=new Set(["texture","emissiveMap","sheenColorMap","specularColorMap"]);function je(e){return ie.has(e)?se:ne}function Ee(e,n){return e?.[n]?.path}function Fe(e,n){let t=e?.[n]?.offset;if(!t)return;let[r,a]=t;if(!(!Number.isFinite(r)||!Number.isFinite(a)))return r===0&&a===0?void 0:[r,a]}function Ke(e,n){let t=e?.[n]?.scale;if(!(!Number.isFinite(t)||!t))return t===1?void 0:t}function Ue(e,n){let t=e?.[n]?.rotation;if(!(!Number.isFinite(t)||!t))return t}function He(e){return e==="back"?Q:e==="double"?ee:te}function Le(e){return e==="additive"?J:re}function We(e,n=1,t=n){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 W(r.x,r.y)}return new W(n,t)}function Pe(e){return Number.isFinite(e)&&e>0?e:1}function Ge(e,n){return e?.animations.clips.find(t=>t.sourceName===n)}function Ve(e){return e?.loopMode??"repeat"}export{Z as a,fe as b,ge as c,Me as d,$ as e,he as f,xe as g,ye as h,be as i,ae as j,G as k,U as l,V as m,ue as n,ce as o,De as p,Oe as q,Ie as r,Ne as s,ze as t,Ce as u,je as v,Ee as w,Fe as x,Ke as y,Ue as z,He as A,Le as B,We as C,Pe as D,Ge as E,Ve as F};
|
|
1
|
+
import{Box3 as F,Vector3 as O}from"three";var P=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"]),K=new WeakMap;function ae(e,n){K.set(e,structuredClone(n))}function G(e){let n=K.get(e);return n?structuredClone(n):void 0}function U(e){if(/^(blob|data):/i.test(e))return"Local resource";let n=e.split(/[?#]/,1)[0].replace(/\\/g,"/");return n.slice(n.lastIndexOf("/")+1).slice(0,300)||"Resource"}function V(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 H(e){let n=t=>typeof t=="number"&&Number.isFinite(t)&&t>=0?t:null;return{...e.format?{format:e.format}:{},...e.name?{name:U(e.name)}:{},sourceBytes:n(e.sourceBytes),loadDurationMs:n(e.loadDurationMs),extensionsUsed:[...new Set(e.extensionsUsed??[])].sort(),extensionsRequired:[...new Set(e.extensionsRequired??[])].sort(),failedResources:[...new Set((e.failedResources??[]).map(V))].slice(0,50)}}function L(e){let n=new Set(e.extensionsRequired);return[...new Set([...e.extensionsUsed??[],...n])].sort().map(t=>({name:t,required:n.has(t),recognized:P.has(t)}))}function X(e,n){let t=e.image,r=m=>typeof m=="number"&&Number.isSafeInteger(m)&&m>0?m:null,a=r(t?.naturalWidth??t?.width),u=r(t?.naturalHeight??t?.height),l=!!e.isCompressedTexture,y=e.mipmaps.reduce((m,g)=>m+(g.data?.byteLength??0),0),c=a&&u?Math.ceil(a*u*4*(e.generateMipmaps?4/3:1)):null;return{name:e.name?U(e.name):n,width:a,height:u,compressed:l,estimatedBytes:l?y||null:c!==null&&Number.isSafeInteger(c)?c:null}}function ue(e,n={}){let t=H({...G(e),...n.source}),r=[],a=new Set,u=new Map,l=new Set,y=new Map,c=new Map,m=new Set,g=new Map,v=0,R=0,T=0,B=0,I=0,b=(s,i)=>{let o=g.get(s)??{count:0,names:[]};o.count++,o.names.length<20&&o.names.push(i||"Unnamed object"),g.set(s,o)},w=s=>{let i=s?.array??s?.data?.array;i?.buffer&&!m.has(i.buffer)&&(m.add(i.buffer),I+=i.buffer.byteLength)};e.traverse(s=>{let i=s;if(!i.isMesh||!i.geometry)return;v++,R+=i.isInstancedMesh?Number.isSafeInteger(i.count)?Math.max(0,i.count??0):0:1;let o=i.geometry,d=o.getAttribute("position"),D=o.getAttribute("uv"),k=i.material?Array.isArray(i.material)?i.material:[i.material]:[];if(!u.has(o)){let p=!!d&&(!Number.isSafeInteger(d.count)||d.count<0);for(let f=0;!p&&d&&f<d.count;f++)if(!Number.isFinite(d.getX(f))||!Number.isFinite(d.getY(f))||!Number.isFinite(d.getZ(f))){p=!0;break}u.set(o,p)}if(u.get(o)&&b("invalid-positions",s.name),d?.count||b("empty-geometry",s.name),D||b("missing-uv",s.name),o.getAttribute("normal")||b("missing-normals",s.name),o.boundingBox&&[...o.boundingBox.min.toArray(),...o.boundingBox.max.toArray()].some(p=>!Number.isFinite(p))&&b("invalid-bounds",s.name),!a.has(o)){a.add(o),T+=Number.isSafeInteger(d?.count)?Math.max(0,d?.count??0):0;let p=o.index?.count??d?.count??0;B+=Number.isSafeInteger(p)?Math.floor(Math.max(0,p)/3):0,Object.values(o.attributes).forEach(w),Object.values(o.morphAttributes).flat().forEach(w),w(o.index)}let j=!1;for(let p of k){l.add(p);let f=y.get(p);if(!f){f=Object.values(p).filter(h=>!!h&&h.isTexture===!0),y.set(p,f);for(let h of f)c.has(h)||c.set(h,`Texture ${c.size+1}`)}for(let h of f){let E=h.channel??0;o.getAttribute(E===0?"uv":`uv${E}`)||(j=!0)}}j&&b("textured-missing-uv",s.name)});let S=(s,i,o,d,D)=>{let k=g.get(s);k&&r.push({code:s,severity:i,title:o,detail:d,suggestion:D,count:k.count,objects:k.names})};S("empty-geometry","error","Empty mesh geometry","Some meshes have no position data.","Remove empty meshes or export their geometry again."),S("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."),S("invalid-bounds","error","Invalid geometry bounds","Some cached bounds contain non-finite values.","Repair invalid coordinates in the source application and re-export."),S("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."),S("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."),S("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."),v||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 A=[...c].map(([s,i])=>X(s,i)),_=A.filter(s=>(s.width??0)>4096||(s.height??0)>4096);_.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:_.length,objects:_.slice(0,20).map(s=>s.name)}),B>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."}),l.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 N=L(t);for(let s of N.filter(i=>!i.recognized))r.push({code:"unrecognized-extension",severity:s.required?"error":"warning",title:`${s.required?"Required":"Optional"} extension not recognized`,detail:s.name,suggestion:"Export with extensions supported by the bundled loader, or verify the asset's fallback appearance."});t.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:t.failedResources.length,objects:t.failedResources.slice(0,20)});let z=null,M=[...u.values()].some(Boolean)?new F:new F().setFromObject(e);!M.isEmpty()&&[...M.min.toArray(),...M.max.toArray(),...M.getSize(new O).toArray()].every(Number.isFinite)&&(z={min:M.min.toArray(),max:M.max.toArray(),center:M.getCenter(new O).toArray(),size:M.getSize(new O).toArray()}),n.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 C=s=>s.code==="partial-stream"?-1:s.severity==="error"?0:s.severity==="warning"?1:2;return r.sort((s,i)=>C(s)-C(i)),{version:1,status:"ready",scope:n.scope??"asset",source:t,units:t.format==="glb"||t.format==="gltf"?"meters (glTF convention)":"unknown",bounds:z,statistics:{meshes:v,instances:R,geometries:a.size,materials:l.size,textures:c.size,vertices:T,triangles:B,geometryBytes:I,estimatedTextureBytes:A.reduce((s,i)=>s+(i.estimatedBytes??0),0),unknownTextureSizes:A.filter(s=>s.estimatedBytes===null).length,meshesWithoutUvs:g.get("missing-uv")?.count??0,meshesWithoutNormals:g.get("missing-normals")?.count??0},textures:A,extensions:N,issues:r}}function ce(e={}){return{version:1,status:"failed",scope:"asset",source:H(e),units:"unknown",bounds:null,statistics:null,textures:[],extensions:L(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."}]}}import{Matrix4 as q,Vector3 as Y}from"three";function Z(e){return e.isSkinnedMesh===!0}function fe(e){let n=[];return e.traverse(t=>{Z(t)&&n.push(t)}),n}var x="reactImmersiveSkinFreeze";function ge(e){return!!e.userData[x]}function Me(e,n,t=[n]){let r=e.userData,a=new q().copy(n).invert(),u=r[x];if(u){u.frozenInverse.copy(a),u.restWorldTransforms=t.map(c=>c.clone()),e.bindMatrixInverse.copy(a);return}let l={frozenInverse:a,restWorldTransforms:t.map(c=>c.clone()),previousOnBeforeRender:e.onBeforeRender,previousUpdateMatrixWorld:Object.prototype.hasOwnProperty.call(e,"updateMatrixWorld")?e.updateMatrixWorld:void 0};e.bindMatrixInverse.copy(a);let y=e.updateMatrixWorld;e.updateMatrixWorld=function(c){y.call(this,c),e.bindMatrixInverse.copy(l.frozenInverse)},e.onBeforeRender=function(c,m,g,v,R,T){l.previousOnBeforeRender.call(this,c,m,g,v,R,T),e.bindMatrixInverse.copy(l.frozenInverse)},r[x]=l}function $(e){return e.userData[x]?.frozenInverse??null}function he(e){return e.userData[x]?.restWorldTransforms??null}function xe(e){let n=e.userData,t=n[x];t&&(e.onBeforeRender=t.previousOnBeforeRender,t.previousUpdateMatrixWorld?e.updateMatrixWorld=t.previousUpdateMatrixWorld:delete e.updateMatrixWorld,delete n[x],e.updateMatrixWorld(!0))}function ye(e){let n=e,t=$(e);t&&n.bindMatrixInverse.copy(t),n.skeleton?.update?.();let r=n.geometry.clone(),a=r.getAttribute("position");if(a){let u=new Y;for(let l=0;l<a.count;l++)n.getVertexPosition(l,u),a.setXYZ(l,u.x,u.y,u.z);a.needsUpdate=!0}return r.deleteAttribute("skinIndex"),r.deleteAttribute("skinWeight"),r.morphAttributes={},r.morphTargetsRelative=!1,r.computeVertexNormals(),r.computeBoundingBox(),r.computeBoundingSphere(),r}function be(e){return e.matrixWorld.clone()}import{AdditiveBlending as J,BackSide as Q,DoubleSide as ee,FrontSide as te,NoColorSpace as ne,NormalBlending as re,SRGBColorSpace as se,Vector2 as W}from"three";function De(e){let n=!0;return e?.traverse(t=>{let r=t.isMesh?t.geometry:null;r&&!r.getAttribute("uv")&&(n=!1)}),n}function Oe(e){return!!(e&&typeof e=="object"&&"clone"in e&&"color"in e&&"metalness"in e&&"roughness"in e)}function Ie(e){return!!(e&&typeof e=="object"&&"isMeshPhysicalMaterial"in e&&e.isMeshPhysicalMaterial)}function Ne(e){return!!(e&&"isMesh"in e&&e.isMesh)}var ze=["texture","metalnessMap","roughnessMap","emissiveMap","alphaMap","normalMap","bumpMap","aoMap","displacementMap","clearcoatMap","clearcoatRoughnessMap","clearcoatNormalMap","anisotropyMap","transmissionMap","thicknessMap","sheenColorMap","sheenRoughnessMap","specularIntensityMap","specularColorMap"],Ce={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"},ie=new Set(["texture","emissiveMap","sheenColorMap","specularColorMap"]);function je(e){return ie.has(e)?se:ne}function Ee(e,n){return e?.[n]?.path}function Fe(e,n){let t=e?.[n]?.offset;if(!t)return;let[r,a]=t;if(!(!Number.isFinite(r)||!Number.isFinite(a)))return r===0&&a===0?void 0:[r,a]}function Ke(e,n){let t=e?.[n]?.scale;if(!(!Number.isFinite(t)||!t))return t===1?void 0:t}function Ue(e,n){let t=e?.[n]?.rotation;if(!(!Number.isFinite(t)||!t))return t}function He(e){return e==="back"?Q:e==="double"?ee:te}function Le(e){return e==="additive"?J:re}function We(e,n=1,t=n){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 W(r.x,r.y)}return new W(n,t)}function Pe(e){return Number.isFinite(e)&&e>0?e:1}function Ge(e,n){return e?.animations.clips.find(t=>t.sourceName===n)}function Ve(e){return e?.loopMode??"repeat"}export{Z as a,fe as b,ge as c,Me as d,$ as e,he as f,xe as g,ye as h,be as i,De as j,Oe as k,Ie as l,Ne as m,ze as n,Ce as o,je as p,Ee as q,Fe as r,Ke as s,Ue as t,He as u,Le as v,We as w,Pe as x,Ge as y,Ve as z,ae as A,G as B,U as C,V as D,ue as E,ce as F};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{b as oe}from"./chunk-
|
|
1
|
+
import{b as oe}from"./chunk-5XII5XCD.mjs";import{A as z,C as de,D as pe,a as ne,e as se,k as le,l as ce,w as P}from"./chunk-6Q6YZ7O5.mjs";import{e as ae,f as ie,g as ue}from"./chunk-BNKTI3CY.mjs";import{strFromU8 as vt,strToU8 as gt,unzip as yt}from"fflate";var fe;function me(e){fe=e}function M(e){fe?.(e)}var Mt=[".glb",".gltf",".obj",".fbx",".usdz",".stl",".ply",".zip"],wt=["model/gltf-binary","model/gltf+json","model/vnd.usdz+zip","application/vnd.usdz+zip","application/zip","application/x-zip-compressed"],w=1024*1024,be=128*w,he=1024,ve=128*w,ge=256*w,ye=200,xt=w,b=new Map,Pn=".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 U(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 Se(e){return b.get(e)??{format:U(e)}}function St(e){let t=e.name.toLowerCase();return Mt.some(r=>t.endsWith(r))||wt.includes(e.type)}async function Rn(e){if(!St(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 Me(e,"usdz");if(t.endsWith(".zip")||Lt(e.type))return Pt(e);if(t.endsWith(".gltf")||e.type==="model/gltf+json")return we(e);let r=U(e.name);return r==="gltf"?we(e):Me(e,r)}function Me(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:()=>{M(r),b.delete(r),URL.revokeObjectURL(r)}}}function Lt(e){return e==="application/zip"||e==="application/x-zip-compressed"}async function we(e){let t=await e.text(),r=Le(t,e.name);for(let s of Pe(r))if(!I(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:()=>{M(n),b.delete(n),URL.revokeObjectURL(n)}}}async function Pt(e){if(e.size>be)throw new Error(`Model zip is too large. The compressed archive must be ${G(be)} or smaller.`);let t=await Rt(new Uint8Array(await e.arrayBuffer())),r=new Map;for(let[i,a]of Object.entries(t)){let u=F(i);!u||Re(u)||r.set(u,a)}let n=[...r.keys()].filter(i=>/\.(gltf|obj|fbx|stl|ply)$/i.test(i));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=U(s);if(o==="gltf")return Dt(e,s,r);if(o==="obj"||o==="fbx"||o==="stl"||o==="ply")return At(e,s,o,r);throw new Error(`Unsupported model entry ${s}.`)}function Rt(e){return new Promise((t,r)=>{let n=0,s=0,o=null,i=u=>(o??(o=new Error(`Invalid model zip: ${u}`)),!1);yt(e,{filter:u=>{if(o)return!1;if(n+=1,n>he)return i(`archive contains more than ${he.toLocaleString()} entries.`);if(u.originalSize>ve)return i(`${u.name} expands beyond the ${G(ve)} per-file limit.`);if(s+=u.originalSize,s>ge)return i(`expanded contents exceed ${G(ge)}.`);if(u.originalSize>=xt&&(u.size===0||u.originalSize/u.size>ye))return i(`${u.name} exceeds the ${ye}:1 compression-ratio limit.`);let l=F(u.name);return!!l&&!Re(l)}},(u,l)=>{o?r(o):u?r(new Error(`Invalid model zip: ${u.message}`)):t(l)})})}function G(e){return`${e/w} MiB`}function At(e,t,r,n){let s=[],o={};for(let[a,u]of n){let l=URL.createObjectURL(new Blob([u],{type:Ae(a)}));s.push(l),o[a]=l}let i=o[t];if(!i)throw s.forEach(a=>URL.revokeObjectURL(a)),new Error(`Invalid model zip: could not read ${t}.`);return b.set(i,{format:r,entryPath:t,resourceUrls:o}),{url:i,name:e.name,format:r,cleanup:()=>{M(i),b.delete(i),s.forEach(a=>URL.revokeObjectURL(a))}}}function Dt(e,t,r){let n=r.get(t);if(!n)throw new Error("Invalid GLTF zip: no .gltf found.");let s=Le(vt(n),t);Et(s,t);let o=Bt(t),i=[];try{xe(s.buffers,o,r,i),xe(s.images,o,r,i);let a=new Blob([gt(JSON.stringify(s))],{type:"model/gltf+json"}),u=URL.createObjectURL(a);return i.push(u),b.set(u,{format:"gltf",entryPath:t}),{url:u,name:e.name,format:"gltf",cleanup:()=>{M(u),b.delete(u),i.forEach(l=>URL.revokeObjectURL(l))}}}catch(a){throw i.forEach(u=>URL.revokeObjectURL(u)),a}}function xe(e,t,r,n){for(let s of e??[]){if(typeof s.uri!="string"||I(s.uri))continue;let o=Tt(t,s.uri),i=r.get(o);if(!i)throw new Error(`Invalid GLTF zip: missing referenced asset ${s.uri}.`);let a=URL.createObjectURL(new Blob([i],{type:Ae(o)}));n.push(a),s.uri=a}}function Le(e,t){try{return JSON.parse(e)}catch{throw new Error(`${t} is not a valid .gltf JSON file.`)}}function Pe(e){return[...e.buffers??[],...e.images??[]].map(t=>t.uri).filter(t=>typeof t=="string"&&t.length>0)}function Et(e,t){for(let r of Pe(e)){if(I(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 I(e){return e.startsWith("data:")}function F(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 Re(e){let t=e.split("/");return e.endsWith("/")||t.includes("__MACOSX")||t.some(r=>r===".DS_Store"||r.startsWith("._"))}function Bt(e){let t=e.lastIndexOf("/");return t===-1?"":e.slice(0,t)}function Tt(e,t){let r=t.split(/[?#]/)[0],n=Ct(r);return F(e?`${e}/${n}`:n)}function Ct(e){try{return decodeURI(e)}catch{return e}}function Ae(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 kt,BufferAttribute as Ot,Mesh as zt}from"three";import{acceleratedRaycast as Gt,computeBoundsTree as Ut,disposeBoundsTree as It,MeshBVH as Ft}from"three-mesh-bvh";var De=!1,v=new WeakMap,x=new WeakMap;function jt(){De||(zt.prototype.raycast=Gt,De=!0)}function Wt(e){let t=new Set;return e.traverse(r=>{let n=r.geometry;!n||!n.attributes?.position||t.add(n)}),[...t]}function Ee(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 Be=12e6;function Bn(e){return _t(e)>Be}function _t(e){let t=new Set;return e.traverse(r=>{let n=r.geometry;n?.attributes?.position&&t.add(n)}),Ee([...t])}function Nt(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:d}=c,p=Ft.deserialize(d,t,{setIndex:!1});d.index&&(t.index?t.index.array=d.index:t.setIndex(new Ot(d.index,1,!1))),t.boundingBox=p.getBoundingBox(new kt),r(p)},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 i=t.index?t.index.array.slice():null,a=t.attributes.position.array.slice(),u=[a,...i?[i]:[]].map(l=>l.buffer);e.postMessage({index:i,position:a,options:{groups:[...t.groups]}},u)})}async function Vt(){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 $t(e,t){if(t)try{return await Nt(t,e)}catch{}let r=Ut.call(e);return e.boundsTree=void 0,await new Promise(n=>setTimeout(n,0)),r}async function Ht(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&&v.delete(e)}),t.buildPromise}async function Tn(e,t){if(t?.aborted)return;let r=x.get(e);if(!r){if(r=Wt(e),Ee(r)>Be){x.set(e,[]);return}x.set(e,r);for(let s of r){let o=v.get(s)??{references:0};o.references+=1,v.set(s,o)}}if(r.length===0)return;jt();let n=await Vt();if(t?.aborted){n?.dispose();return}try{for(let s of r){if(t?.aborted)return;let o=v.get(s);o&&await Ht(s,o,()=>$t(s,n?.worker))}}finally{n?.dispose()}}function Cn(e){let t=x.get(e);if(t){x.delete(e);for(let r of t){let n=v.get(r);n&&(n.references=Math.max(0,n.references-1),!(n.references>0)&&(n.ownedTree&&r.boundsTree===n.ownedTree&&(It.call(r),r.boundsTree=void 0),n.ownedTree=void 0,n.buildPromise||v.delete(r)))}}}import{useEffect as W,useMemo as Xt,useRef as Zt,useState as Kt}from"react";import{Box3 as Oe,Color as _,DoubleSide as Yt,ShaderMaterial as Jt,Vector3 as qt}from"three";import{useThree as Qt}from"@react-three/fiber";var Te="riEditorGizmo",j=new WeakMap;function Ce(e){return e.userData[Te]=!0,e}function Gn(e,t){let r=j.get(e);return r||(r=new Set,j.set(e,r)),r.add(t),()=>{r.delete(t)}}function Un(e){let t=[],r=n=>{n.visible=!1,t.push(n)};return e.traverse(n=>{n.visible&&n.userData[Te]&&r(n)}),j.get(e)?.forEach(n=>{n.visible&&r(n)}),()=>{for(let n of t)n.visible=!0}}function ke(e){return!Number.isFinite(e)||e<=0?1:10**Math.floor(Math.log10(e/10))}import{jsx as ze}from"react/jsx-runtime";var er=`
|
|
2
2
|
varying vec3 vWorld;
|
|
3
3
|
void main() {
|
|
4
4
|
vec4 world = modelMatrix * vec4(position, 1.0);
|
|
@@ -44,4 +44,4 @@ import{b as oe}from"./chunk-DEFZEXTA.mjs";import{C as P,a as ne,e as se,j as z,l
|
|
|
44
44
|
gl_FragColor = vec4(color, uLinearTarget ? pow(alpha, 2.2) : alpha);
|
|
45
45
|
#include <colorspace_fragment>
|
|
46
46
|
}
|
|
47
|
-
`,rr=()=>{};function Hn({getTarget:e,revision:t,lineColor:r}){let n=Qt(c=>c.invalidate),[s,o]=Kt({y:0,size:10}),i=Zt(null);W(()=>{i.current&&Ce(i.current)},[]),W(()=>{let c=e();if(!c)return;let d=c instanceof Oe?c:new Oe().setFromObject(c);if(d.isEmpty())return;let p=d.getSize(new qt);o({y:d.min.y,size:Math.max(p.x,p.y,p.z)}),n()},[e,t,n]);let a=Xt(()=>new Jt({vertexShader:er,fragmentShader:tr,transparent:!0,depthWrite:!1,side:Yt,uniforms:{uCell:{value:1},uMajor:{value:5},uFade:{value:100},uLinearTarget:{value:!1},uLine:{value:new _},uAxisX:{value:new _("#e5484d")},uAxisZ:{value:new _("#3e8bff")}}}),[]);W(()=>()=>a.dispose(),[a]);let u=ke(s.size);a.uniforms.uCell.value=u,a.uniforms.uMajor.value=u*5,a.uniforms.uFade.value=s.size*12,a.uniforms.uLine.value.set(r);let l=s.size*40;return ze("mesh",{ref:i,rotation:[-Math.PI/2,0,0],position:[0,s.y-s.size*5e-4,0],raycast:rr,renderOrder:-1,frustumCulled:!1,material:a,onBeforeRender:c=>{let d=c.getRenderTarget()!==null;a.uniforms.uLinearTarget.value!==d&&(a.uniforms.uLinearTarget.value=d,a.uniformsNeedUpdate=!0)},children:ze("planeGeometry",{args:[l,l]})})}import{useThree as N}from"@react-three/fiber";import{useEffect as Ie}from"react";import{useEffect as nr,useState as sr}from"react";function R(e){return!!e?.isWebGPURenderer}var Ge;function or(){return Ge??(Ge=(async()=>{let e=typeof navigator>"u"?void 0:navigator.gpu;if(!e)return!1;try{return!!await e.requestAdapter()}catch{return!1}})()),Ge}var Ue=!1;function Yn(e){let[t,r]=sr(null);return nr(()=>{if(!e)return;let n=!1;return or().then(s=>{n||(!s&&!Ue&&(Ue=!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 Jn(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 rs({captureRef:e}){let{gl:t,scene:r,camera:n,invalidate:s,get:o}=N();return Ie(()=>{if(!e)return;let i=()=>{let a=o();a.advance(a.frameloop==="never"?a.clock.elapsedTime:performance.now())};return e.current={gl:t,scene:r,camera:n,invalidate:s,drawNow:i},()=>{e.current=null}},[e,t,r,n,s,o]),null}function ns(){let e=N(r=>r.frameloop),t=N(r=>r.invalidate);return Ie(()=>{e!=="never"&&t()},[e,t]),null}function ss(e){e.dispose(),"forceContextLoss"in e&&!R(e)&&(e.forceContextLoss(),e.forceContextLoss=()=>{})}function os(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 br,useState as hr}from"react";import{useEffect as ar,useState as Fe}from"react";var ir="200px",je=new Map;function We(e,t,r){let n=je.get(t);if(!n){let i=new Map;n={observer:new IntersectionObserver(u=>{for(let l of u)i.get(l.target)?.(l.isIntersecting)},{rootMargin:t}),watchers:i},je.set(t,n)}let{observer:s,watchers:o}=n;return o.set(e,r),s.observe(e),()=>{o.delete(e),s.unobserve(e)}}function _e(e){let t=typeof IntersectionObserver<"u",[r,n]=Fe(!t),[s,o]=Fe(!t);return ar(()=>{let i=e.current;if(!i||!t)return;let a=We(i,ir,n),u=We(i,"0px",o);return()=>{a(),u()}},[e,t]),{near:r,visible:s}}import{useEffect as Ne,useRef as Ve,useState as cr}from"react";function V(){return typeof navigator>"u"?!1:/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)}function ur(){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 ls(){return V()||ur()}function lr(){if(typeof window>"u"||typeof navigator>"u")return!1;let e=i=>typeof window.matchMedia=="function"&&window.matchMedia(i).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=V();return t||o||n&&r||n&&s}function $(){if(!lr())return!1;if(V())return!0;let e=navigator.deviceMemory;return!(typeof e=="number"&&e>=8)}function cs(e="auto"){switch(e){case"high":return!1;case"low":return!0;default:return $()}}function dr(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 pr=12,fr=6,A=new Map,mr=1,H=!1,$e;function He(){H||(H=!0,queueMicrotask(()=>{H=!1,$e??($e=$()?fr:pr);let e=dr([...A.values()],$e);for(let t of A.values()){let r=e.has(t.id);r!==t.live&&(t.live=r,t.onLiveChange(r))}}))}function Xe({managed:e,wanted:t,visible:r,onPark:n}){let[s,o]=cr(!1),i=Ve(n);i.current=n;let a=Ve(null);return Ne(()=>{if(!e)return;let u={id:mr++,wanted:!1,visible:!1,live:!1,since:performance.now(),onLiveChange:l=>{l||i.current?.(),o(l)}};return A.set(u.id,u),a.current=u,()=>{A.delete(u.id),a.current=null,o(!1),He()}},[e]),Ne(()=>{let u=a.current;!u||u.wanted===t&&u.visible===r||(u.wanted!==t&&(u.since=performance.now()),u.wanted=t,u.visible=r,He())},[e,t,r]),e?s:t}function gs({loading:e="lazy",reveal:t="auto",rootRef:r,onPark:n}){let{near:s,visible:o}=_e(r),[i,a]=hr(t==="auto");return br(()=>{t==="auto"&&a(!0)},[t]),{live:Xe({managed:e==="lazy",wanted:i&&(e==="eager"||s),visible:o,onPark:n}),visible:o,awaitingReveal:!i,reveal:()=>a(!0)}}import{Box as vr}from"lucide-react";import{jsx as X,jsxs as Ze}from"react/jsx-runtime";function gr({src:e,hidden:t=!1}){return e?X("img",{className:`ri-poster${t?" ri-poster--hidden":""}`,src:e,alt:"","aria-hidden":"true",draggable:!1,decoding:"async"}):null}function Ps({className:e,background:t,poster:r,onReveal:n}){let s=oe();return Ze("div",{className:`${e} ri-viewerPlaceholder`,style:{background:t},children:[X(gr,{src:r}),n?Ze("button",{type:"button",className:"ri-revealButton",onClick:n,children:[X(vr,{size:16,"aria-hidden":"true"}),s("viewIn3D")]}):null]})}import{BufferGeometry as yr,Float32BufferAttribute as Mr,Group as Ye,Mesh as Z,MeshStandardMaterial as wr}from"three";import{STLLoader as xr}from"three/examples/jsm/loaders/STLLoader.js";import{PLYLoader as Sr}from"three/examples/jsm/loaders/PLYLoader.js";var Lr=12106948,Je="This PLY file is a point cloud: it has vertices but no faces.",D=class extends Error{constructor(){super(Je),this.name="PointCloudError"}};function Ts(e){return e instanceof D||e instanceof Error&&e.message.includes(Je)}function qe(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 K(e){return new wr({color:e?16777215:Lr,vertexColors:e,metalness:0,roughness:.6})}function Ke(e,t,r){let n=e.itemSize;return new Mr(e.array.slice(t*n,(t+r)*n),n)}function Qe(e,t){let r=new xr().parse(e),n=!!r.hasColors,s=new Ye;if(r.groups.length>1){let a=r.userData.groupNames??[],u=r.getAttribute("position"),l=r.getAttribute("normal");return r.groups.forEach((c,d)=>{let p=new yr;p.setAttribute("position",Ke(u,c.start,c.count)),l&&p.setAttribute("normal",Ke(l,c.start,c.count));let f=new Z(p,K(!1));f.name=a[d]?.trim()||`${t} ${d+1}`,s.add(f)}),r.dispose(),s}r.clearGroups();let o=K(n);n&&r.alpha!==void 0&&r.alpha<1&&(o.opacity=r.alpha,o.transparent=!0);let i=new Z(r,o);return i.name=t,s.add(i),s}function Pr(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 et(e,t){if(!Pr(e))throw new D;let r=new Sr().parse(e);r.getAttribute("normal")||r.computeVertexNormals();let n=new Z(r,K(!!r.getAttribute("color")));n.name=t;let s=new Ye;return s.add(n),s}import{useEffect as Rr,useState as Ar}from"react";var Y=80,Dr=99,Er=6e3,Br=200;function Tr(e,t=0){let r=Math.min(Math.max(e,0),100);return r<100?r/100*Y:Y+(Dr-Y)*(1-Math.exp(-t/Er))}function Os(e,t=!1){let r=e!==null&&e>=100&&!t,[n,s]=Ar(0);return Rr(()=>{if(!r){s(0);return}let o=performance.now(),i=setInterval(()=>s(performance.now()-o),Br);return()=>clearInterval(i)},[r]),e===null?null:t?100:Tr(e,n)}import{useFrame as S,useThree as h}from"@react-three/fiber";import{ContactShadows as Cr}from"@react-three/drei";import{useXR as tt}from"@react-three/xr";import{Color as kr,PerspectiveCamera as Or}from"three";import{useEffect as g,useLayoutEffect as nt,useRef as E}from"react";import{Fragment as Gr,jsx as rt,jsxs as Ur}from"react/jsx-runtime";function _s({renderMode:e,suspended:t=!1}){let{scene:r}=h(),n=h(a=>a.setFrameloop),s=tt(a=>a.session!=null),o=tt(a=>a.mode==="immersive-ar"),i=E(void 0);return g(()=>{n(t?"never":s?"always":e)},[s,e,t,n]),g(()=>{o?(i.current=r.background,r.background=null):i.current!==void 0&&(r.background=i.current,i.current=void 0)},[o,r]),S(()=>{o&&r.background!==null&&(r.background=null)}),null}function Ns({onPresentingChange:e}){let t=h(s=>s.gl),r=E(null);g(()=>{let s=t.xr;if(!s)return;let o=u=>{u?(r.current=t.shadowMap.enabled,t.shadowMap.enabled=!1):r.current!==null&&(t.shadowMap.enabled=r.current,r.current=null),e(u)},i=()=>o(!0),a=()=>o(!1);return s.addEventListener("sessionstart",i),s.addEventListener("sessionend",a),o(s.isPresenting),()=>{s.removeEventListener("sessionstart",i),s.removeEventListener("sessionend",a)}},[t,e]);let n=E(0);return S(()=>{if(!t.xr.isPresenting)return;let s=performance.now();if(s-n.current<1e3)return;n.current=s;let o=t.xr}),null}function Vs({active:e}){let t=h(r=>r.invalidate);return g(()=>{e&&t()},[e,t]),S(()=>{e&&t()}),null}function $s(e){let t=h(n=>n.gl),r=E(t.autoClear);return S(()=>{r.current=t.autoClear,t.autoClear=!0},-1),Ur(Gr,{children:[rt(Cr,{...e}),rt(zr,{saved:r})]})}function zr({saved:e}){let t=h(r=>r.gl);return S(()=>{t.autoClear=e.current}),null}function Hs({color:e}){let{scene:t,invalidate:r}=h();return nt(()=>(t.background=e?new kr(e):null,r(),()=>{t.background=null}),[t,e,r]),null}function Xs({rotation:e}){let{scene:t,invalidate:r}=h();return nt(()=>{let n=e*Math.PI/180;t.environmentRotation.set(0,n,0),t.backgroundRotation.set(0,n,0)}),g(()=>{r()},[e,r]),null}function Zs({cameraConfig:e}){let{camera:t,invalidate:r}=h();return g(()=>{if(!(t instanceof Or))return;let n=e?.fov;typeof n=="number"&&t.fov!==n&&(t.fov=n,t.updateProjectionMatrix(),r())},[t,e,r]),null}import{useLoader as ut,useThree as Zr}from"@react-three/fiber";import{FileLoader as lt,Loader as Kr,LoadingManager as Yr}from"three";import{FBXLoader as Jr,GLTFLoader as qr,MTLLoader as Qr,OBJLoader as en}from"three-stdlib";import{USDLoader as tn}from"three/examples/jsm/loaders/USDLoader.js";import{useGLTF as qs}from"@react-three/drei";import{useThree as eo}from"@react-three/fiber";import{useMemo as ro}from"react";import{SRGBColorSpace as Ir}from"three";import{DRACOLoader as Fr,KTX2Loader as jr,MeshoptDecoder as Wr}from"three-stdlib";function _r(e){return{name:"RI_unlit_emissive_texture",async afterRoot(t){let r=e.json.materials??[],n=new Map;if(r.forEach(o=>{let i=!!o?.extensions?.KHR_materials_unlit,a=!!o?.pbrMetallicRoughness?.baseColorTexture;i&&!a&&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,i])=>{let a=await e.getDependency("texture",i);a&&(a.colorSpace=Ir,s.set(o,a))})),t.scene.traverse(o=>{let i=Array.isArray(o.material)?o.material:o.material?[o.material]:[];for(let a of i){let u=a.name?s.get(a.name):void 0;u&&!a.map&&(a.map=u,a.needsUpdate=!0)}})}}}var Nr="https://assets.react-immersive.liveroom.dev/three-r184/draco/",Vr="https://assets.react-immersive.liveroom.dev/three-r184/basis/";function $r(e,t){if(!R(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}var st=new Map,ot=new WeakMap;function Hr(e){let t=st.get(e);return t||(t=new Fr,t.setDecoderPath(e),st.set(e,t)),t}function Xr(e,t){let r=ot.get(t);r||(r=new Map,ot.set(t,r));let n=r.get(e);return n||(n=$r(new jr().setTranscoderPath(e),t),r.set(e,n)),n}function at(e,t={},r){let{dracoDecoderPath:n=Nr,ktx2TranscoderPath:s=Vr,meshopt:o=!0}=t;n&&e.setDRACOLoader(Hr(n)),o&&e.setMeshoptDecoder(Wr),s&&r&&e.setKTX2Loader(Xr(s,r)),e.register((i=>_r(i)))}var T=class extends Kr{constructor(){super(...arguments);this.options={source:{format:"glb"}}}configure(r){return this.options=r,this}load(r,n,s,o){let i=performance.now(),a={format:this.options.source.format,name:this.options.source.entryPath??le(r),sourceBytes:this.options.source.sourceBytes??null,failedResources:[]},u=l=>{a.sourceBytes===null&&l.lengthComputable&&l.total>0&&(a.sourceBytes=l.total),s?.(l)};this.loadAsset(r,u,a).then(l=>{a.loadDurationMs=Math.max(0,performance.now()-i),z(l.scene,a),n(l)}).catch(l=>{a.loadDurationMs=Math.max(0,performance.now()-i),l&&typeof l=="object"&&z(l,a),o?.(l)})}async loadAsset(r,n,s){let o=sn(this.options.source);o.onError=l=>{let c=Object.entries(this.options.source.resourceUrls??{}).find(([,p])=>p===l)?.[0],d=ce(c??l);s.failedResources.includes(d)||s.failedResources.push(d)};let{format:i}=this.options.source;if(i==="obj")return rn(r,o,this.options.source,n);if(i==="fbx"){let l=J(this,new Jr(o)),c=un(r,this.options.source);c&&l.setResourcePath(c);let d=await l.loadAsync(r,n);return B(d,"FBXMesh",!1),{scene:d,animations:d.animations??[]}}if(i==="stl"||i==="ply"){let l=await nn(r,o,n),c=qe(this.options.source.entryPath??r,i==="stl"?"STL model":"PLY model"),d=i==="stl"?Qe(l,c):et(l,c);return B(d,i==="stl"?"STLMesh":"PLYMesh",!0),{scene:d,animations:[]}}if(i==="usdz"){let c=await J(this,new tn(o)).loadAsync(r,n);return B(c,"USDZMesh",!1),{scene:c,animations:c.animations??[]}}let a=J(this,new qr(o));at(a,this.options.decoderConfig,this.options.renderer),a.register(l=>{let c=l.json,d=p=>Array.isArray(p)?p.filter(f=>typeof f=="string"):[];return s.extensionsUsed=d(c.extensionsUsed),s.extensionsRequired=d(c.extensionsRequired),{name:"RI_asset_diagnostics",beforeRoot:()=>null}});let u=await a.loadAsync(r,n);return{scene:u.scene,animations:u.animations??[],materialVariants:ae(u)}}};me(e=>{ut.clear(T,e)});function go(e,t={},r,n){let s=Zr(a=>a.gl),o=Se(e),i=r?{...o,format:r}:o;return ut(T,e,a=>{a.configure({source:i,decoderConfig:t,renderer:s})},n)}async function rn(e,t,r,n){let s=await it(e,t,n),o=new en(t),i=on(s);if(i){let u=an(i,e,r);if(u)try{let l=await it(u.url,t),d=new Qr(t).parse(l,u.basePath);d.preload(),o.setMaterials(d)}catch(l){console.warn(`[react-immersive] Could not load OBJ material ${i}; rendering geometry with fallback materials.`,l)}}let a=o.parse(s);return B(a,"OBJMesh",!0),{scene:a,animations:[]}}function B(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 a=o.name||`${t}_${++s}`;if(!r&&o.name){n.add(o.name);return}let u=a,l=2;for(;n.has(u);)u=`${a}_${l++}`;o.name=u,n.add(u)})}function it(e,t,r){let n=new lt(t);return n.setResponseType("text"),n.loadAsync(e,r)}function nn(e,t,r){let n=new lt(t);return n.setResponseType("arraybuffer"),n.loadAsync(e,r)}function J(e,t){return t.setCrossOrigin(e.crossOrigin),t.setWithCredentials(e.withCredentials),t.setRequestHeader(e.requestHeader),t}function sn(e){let t=new Yr,r=e.resourceUrls;return r&&t.setURLModifier(n=>{if(/^(?:blob:|data:)/i.test(n))return n;let s=k(dt(n).split(/[?#]/)[0]),o=r[s];if(o)return o;let i=C(e.entryPath??""),a=k(i?`${i}/${s}`:s);return r[a]??n}),t}function on(e){return/^\s*mtllib\s+(.+?)\s*$/im.exec(e)?.[1]?.trim()||null}function an(e,t,r){if(r.resourceUrls&&r.entryPath){let n=k(`${C(r.entryPath)}/${dt(e)}`),s=r.resourceUrls[n];if(!s)return null;let o=C(n);return{url:s,basePath:o?`${o}/`:""}}try{let n=new URL(e,t).href;return{url:n,basePath:ct(n)}}catch{return null}}function un(e,t){if(t.resourceUrls&&t.entryPath){let r=C(t.entryPath);return r?`${r}/`:""}return ct(e)}function ct(e){let t=e.lastIndexOf("/");return t===-1?"":e.slice(0,t+1)}function C(e){let t=k(e),r=t.lastIndexOf("/");return r===-1?"":t.slice(0,r)}function k(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 dt(e){try{return decodeURI(e)}catch{return e}}import{Color as q,MeshPhysicalMaterial as ln,MeshStandardMaterial as cn,Texture as Q}from"three";function xo(e){if(de(e))return e;if(!e||typeof e!="object")return null;let t=e,r=new cn;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 Q?(r.emissiveMap=t.map,r.emissive.set(16777215)):t.color instanceof q&&r.emissive.copy(t.color)):(t.color instanceof q&&r.color.copy(t.color),t.map instanceof Q&&(r.map=t.map),t.emissive instanceof q&&r.emissive.copy(t.emissive),t.emissiveMap instanceof Q&&(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 So(e){if(pe(e))return e.clone();let t=new ln;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(P(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 Lo(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=P(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=P(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 ee,Matrix4 as dn,Sphere as pn,Vector3 as te}from"three";var pt=new WeakMap,ft=new te,fn=new te,mn=new te,bn=new ee,mt=new dn;function y(e){return"data"in e?e.data.version:e.version}function hn(e){var u;let{geometry:t,skeleton:r}=e,n=t.getAttribute("position"),s=t.getAttribute("skinIndex"),o=t.getAttribute("skinWeight"),i=pt.get(e);if(i?.geometry===t&&i.position===n&&i.indices===s&&i.weights===o&&i.skeleton===r&&i.bindMatrix.equals(e.bindMatrix)&&i.versions[0]===y(n)&&i.versions[1]===y(s)&&i.versions[2]===y(o)&&i.inverses.length===r.boneInverses.length&&i.inverses.every((l,c)=>l.equals(r.boneInverses[c])))return i;let a={geometry:t,position:n,indices:s,weights:o,skeleton:r,versions:[y(n),y(s),y(o)],bindMatrix:e.bindMatrix.clone(),inverses:r.boneInverses.map(l=>l.clone()),bones:[],weightDeviation:0};e:for(let l=0;l<n.count;l++){ft.fromBufferAttribute(n,l).applyMatrix4(e.bindMatrix);let c=0;for(let p=0;p<4;p++){let f=o.getComponent(l,p);if(f===0)continue;let m=s.getComponent(l,p);if(!Number.isFinite(f)||f<0||!Number.isInteger(m)||!r.bones[m]||!a.inverses[m]){a.bones=null;break e}c+=f,((u=a.bones)[m]??(u[m]=new ee)).expandByPoint(fn.copy(ft).applyMatrix4(a.inverses[m]))}let d=Math.abs(c-1);if(d>1e-4){a.bones=null;break}a.weightDeviation=Math.max(a.weightDeviation,d)}return pt.set(e,a),a}function Do(e,{precise:t=!1,updateFallbacks:r=!0}={}){e.updateMatrixWorld(!0),e.traverse(n=>{if(!ne(n))return;let s=n;if(!s.skeleton)return;let o=se(s);o&&s.bindMatrixInverse.copy(o);let a=!!s.geometry.morphAttributes.position?.length?null:hn(s);if(!t&&!a?.bones&&!r&&s.boundingBox&&s.boundingSphere)return;let u=s.boundingBox??(s.boundingBox=new ee),l=s.boundingSphere??(s.boundingSphere=new pn);if(u.makeEmpty(),t||!a?.bones){let c=s.geometry.getAttribute("position");for(let d=0;d<c.count;d++)u.expandByPoint(s.getVertexPosition(d,mn))}else{for(let c=0;c<a.bones.length;c++){let d=a.bones[c];d&&(mt.multiplyMatrices(s.bindMatrixInverse,s.skeleton.bones[c].matrixWorld),u.union(bn.copy(d).applyMatrix4(mt)))}if(!u.isEmpty()){let c=u.min,d=u.max,p=s.bindMatrixInverse.elements,f=Math.max(1,Math.abs(c.x),Math.abs(c.y),Math.abs(c.z),Math.abs(d.x),Math.abs(d.y),Math.abs(d.z)),m=Math.max(Math.abs(c.x-p[12]),Math.abs(d.x-p[12]),Math.abs(c.y-p[13]),Math.abs(d.y-p[13]),Math.abs(c.z-p[14]),Math.abs(d.z-p[14]));u.expandByScalar(a.weightDeviation*m+f*1e-10)}}u.getBoundingSphere(l)})}import{useCallback as bt,useEffect as vn,useRef as gn}from"react";import{useThree as yn}from"@react-three/fiber";function Co(){let e=yn(s=>s.gl.domElement),t=gn(void 0),r=bt(s=>{t.current===void 0&&(t.current=e.style.cursor),e.style.cursor=s},[e]),n=bt(()=>{let s=t.current;s!==void 0&&(e.style.cursor=s,t.current=void 0)},[e]);return vn(()=>()=>{n()},[n]),{setCanvasCursor:r,restoreCanvasCursor:n}}import{Box3 as Mn,Vector3 as ht}from"three";function O(e){return[e.x,e.y,e.z]}function Go(e){let t=new Mn().setFromObject(e),r=0;return e.traverse(n=>{n.isMesh&&(r+=1)}),{bounds:{min:O(t.min),max:O(t.max),center:O(t.getCenter(new ht)),size:O(t.getSize(new ht))},objectCount:r,materialVariants:ie(e),materialVariantGroups:ue(e)}}import{jsx as L,jsxs as re}from"react/jsx-runtime";function Wo({visible:e,title:t,message:r,progress:n}){if(!e)return null;let s=typeof n=="number"&&Number.isFinite(n),o=s?Math.round(Math.min(Math.max(n,0),100)):0;return L("div",{className:"bb-loadingOverlay",role:"status","aria-live":"polite",children:re("div",{className:"bb-loadingCard",children:[re("div",{className:"bb-loadingHeader",children:[L("span",{className:"bb-loadingTitle",title:t??r,children:t??r}),s?re("span",{className:"bb-loadingPercent",children:[o,"%"]}):null]}),L("div",{className:`bb-loadingProgress ${s?"":"bb-loadingProgress--unknown"}`,role:"progressbar","aria-label":t??r,"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":s?o:void 0,children:L("div",{className:"bb-loadingProgress__bar",style:s?{width:`${o}%`}:void 0})}),t?L("span",{className:"bb-loadingMessage",children:r}):null]})})}export{Ce as a,Gn as b,Un as c,ur as d,ls as e,$ as f,cs as g,Pn as h,U as i,Se as j,Rn as k,Be as l,Bn as m,_t as n,Tn as o,Cn as p,R as q,Yn as r,Jn as s,Hn as t,rs as u,ns as v,ss as w,os as x,gs as y,gr as z,Ps as A,Ts as B,Os as C,_s as D,Ns as E,Vs as F,$s as G,Hs as H,Xs as I,Zs as J,Nr as K,Vr as L,go as M,xo as N,So as O,Lo as P,Do as Q,Co as R,Go as S,Wo as T};
|
|
47
|
+
`,rr=()=>{};function Hn({getTarget:e,revision:t,lineColor:r}){let n=Qt(c=>c.invalidate),[s,o]=Kt({y:0,size:10}),i=Zt(null);W(()=>{i.current&&Ce(i.current)},[]),W(()=>{let c=e();if(!c)return;let d=c instanceof Oe?c:new Oe().setFromObject(c);if(d.isEmpty())return;let p=d.getSize(new qt);o({y:d.min.y,size:Math.max(p.x,p.y,p.z)}),n()},[e,t,n]);let a=Xt(()=>new Jt({vertexShader:er,fragmentShader:tr,transparent:!0,depthWrite:!1,side:Yt,uniforms:{uCell:{value:1},uMajor:{value:5},uFade:{value:100},uLinearTarget:{value:!1},uLine:{value:new _},uAxisX:{value:new _("#e5484d")},uAxisZ:{value:new _("#3e8bff")}}}),[]);W(()=>()=>a.dispose(),[a]);let u=ke(s.size);a.uniforms.uCell.value=u,a.uniforms.uMajor.value=u*5,a.uniforms.uFade.value=s.size*12,a.uniforms.uLine.value.set(r);let l=s.size*40;return ze("mesh",{ref:i,rotation:[-Math.PI/2,0,0],position:[0,s.y-s.size*5e-4,0],raycast:rr,renderOrder:-1,frustumCulled:!1,material:a,onBeforeRender:c=>{let d=c.getRenderTarget()!==null;a.uniforms.uLinearTarget.value!==d&&(a.uniforms.uLinearTarget.value=d,a.uniformsNeedUpdate=!0)},children:ze("planeGeometry",{args:[l,l]})})}import{useThree as N}from"@react-three/fiber";import{useEffect as Ie}from"react";import{useEffect as nr,useState as sr}from"react";function R(e){return!!e?.isWebGPURenderer}var Ge;function or(){return Ge??(Ge=(async()=>{let e=typeof navigator>"u"?void 0:navigator.gpu;if(!e)return!1;try{return!!await e.requestAdapter()}catch{return!1}})()),Ge}var Ue=!1;function Yn(e){let[t,r]=sr(null);return nr(()=>{if(!e)return;let n=!1;return or().then(s=>{n||(!s&&!Ue&&(Ue=!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 Jn(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 rs({captureRef:e}){let{gl:t,scene:r,camera:n,invalidate:s,get:o}=N();return Ie(()=>{if(!e)return;let i=()=>{let a=o();a.advance(a.frameloop==="never"?a.clock.elapsedTime:performance.now())};return e.current={gl:t,scene:r,camera:n,invalidate:s,drawNow:i},()=>{e.current=null}},[e,t,r,n,s,o]),null}function ns(){let e=N(r=>r.frameloop),t=N(r=>r.invalidate);return Ie(()=>{e!=="never"&&t()},[e,t]),null}function ss(e){e.dispose(),"forceContextLoss"in e&&!R(e)&&(e.forceContextLoss(),e.forceContextLoss=()=>{})}function os(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 br,useState as hr}from"react";import{useEffect as ar,useState as Fe}from"react";var ir="200px",je=new Map;function We(e,t,r){let n=je.get(t);if(!n){let i=new Map;n={observer:new IntersectionObserver(u=>{for(let l of u)i.get(l.target)?.(l.isIntersecting)},{rootMargin:t}),watchers:i},je.set(t,n)}let{observer:s,watchers:o}=n;return o.set(e,r),s.observe(e),()=>{o.delete(e),s.unobserve(e)}}function _e(e){let t=typeof IntersectionObserver<"u",[r,n]=Fe(!t),[s,o]=Fe(!t);return ar(()=>{let i=e.current;if(!i||!t)return;let a=We(i,ir,n),u=We(i,"0px",o);return()=>{a(),u()}},[e,t]),{near:r,visible:s}}import{useEffect as Ne,useRef as Ve,useState as cr}from"react";function V(){return typeof navigator>"u"?!1:/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)}function ur(){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 ls(){return V()||ur()}function lr(){if(typeof window>"u"||typeof navigator>"u")return!1;let e=i=>typeof window.matchMedia=="function"&&window.matchMedia(i).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=V();return t||o||n&&r||n&&s}function $(){if(!lr())return!1;if(V())return!0;let e=navigator.deviceMemory;return!(typeof e=="number"&&e>=8)}function cs(e="auto"){switch(e){case"high":return!1;case"low":return!0;default:return $()}}function dr(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 pr=12,fr=6,A=new Map,mr=1,H=!1,$e;function He(){H||(H=!0,queueMicrotask(()=>{H=!1,$e??($e=$()?fr:pr);let e=dr([...A.values()],$e);for(let t of A.values()){let r=e.has(t.id);r!==t.live&&(t.live=r,t.onLiveChange(r))}}))}function Xe({managed:e,wanted:t,visible:r,onPark:n}){let[s,o]=cr(!1),i=Ve(n);i.current=n;let a=Ve(null);return Ne(()=>{if(!e)return;let u={id:mr++,wanted:!1,visible:!1,live:!1,since:performance.now(),onLiveChange:l=>{l||i.current?.(),o(l)}};return A.set(u.id,u),a.current=u,()=>{A.delete(u.id),a.current=null,o(!1),He()}},[e]),Ne(()=>{let u=a.current;!u||u.wanted===t&&u.visible===r||(u.wanted!==t&&(u.since=performance.now()),u.wanted=t,u.visible=r,He())},[e,t,r]),e?s:t}function gs({loading:e="lazy",reveal:t="auto",rootRef:r,onPark:n}){let{near:s,visible:o}=_e(r),[i,a]=hr(t==="auto");return br(()=>{t==="auto"&&a(!0)},[t]),{live:Xe({managed:e==="lazy",wanted:i&&(e==="eager"||s),visible:o,onPark:n}),visible:o,awaitingReveal:!i,reveal:()=>a(!0)}}import{Box as vr}from"lucide-react";import{jsx as X,jsxs as Ze}from"react/jsx-runtime";function gr({src:e,hidden:t=!1}){return e?X("img",{className:`ri-poster${t?" ri-poster--hidden":""}`,src:e,alt:"","aria-hidden":"true",draggable:!1,decoding:"async"}):null}function Ps({className:e,background:t,poster:r,onReveal:n}){let s=oe();return Ze("div",{className:`${e} ri-viewerPlaceholder`,style:{background:t},children:[X(gr,{src:r}),n?Ze("button",{type:"button",className:"ri-revealButton",onClick:n,children:[X(vr,{size:16,"aria-hidden":"true"}),s("viewIn3D")]}):null]})}import{BufferGeometry as yr,Float32BufferAttribute as Mr,Group as Ye,Mesh as Z,MeshStandardMaterial as wr}from"three";import{STLLoader as xr}from"three/examples/jsm/loaders/STLLoader.js";import{PLYLoader as Sr}from"three/examples/jsm/loaders/PLYLoader.js";var Lr=12106948,Je="This PLY file is a point cloud: it has vertices but no faces.",D=class extends Error{constructor(){super(Je),this.name="PointCloudError"}};function Ts(e){return e instanceof D||e instanceof Error&&e.message.includes(Je)}function qe(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 K(e){return new wr({color:e?16777215:Lr,vertexColors:e,metalness:0,roughness:.6})}function Ke(e,t,r){let n=e.itemSize;return new Mr(e.array.slice(t*n,(t+r)*n),n)}function Qe(e,t){let r=new xr().parse(e),n=!!r.hasColors,s=new Ye;if(r.groups.length>1){let a=r.userData.groupNames??[],u=r.getAttribute("position"),l=r.getAttribute("normal");return r.groups.forEach((c,d)=>{let p=new yr;p.setAttribute("position",Ke(u,c.start,c.count)),l&&p.setAttribute("normal",Ke(l,c.start,c.count));let f=new Z(p,K(!1));f.name=a[d]?.trim()||`${t} ${d+1}`,s.add(f)}),r.dispose(),s}r.clearGroups();let o=K(n);n&&r.alpha!==void 0&&r.alpha<1&&(o.opacity=r.alpha,o.transparent=!0);let i=new Z(r,o);return i.name=t,s.add(i),s}function Pr(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 et(e,t){if(!Pr(e))throw new D;let r=new Sr().parse(e);r.getAttribute("normal")||r.computeVertexNormals();let n=new Z(r,K(!!r.getAttribute("color")));n.name=t;let s=new Ye;return s.add(n),s}import{useEffect as Rr,useState as Ar}from"react";var Y=80,Dr=99,Er=6e3,Br=200;function Tr(e,t=0){let r=Math.min(Math.max(e,0),100);return r<100?r/100*Y:Y+(Dr-Y)*(1-Math.exp(-t/Er))}function Os(e,t=!1){let r=e!==null&&e>=100&&!t,[n,s]=Ar(0);return Rr(()=>{if(!r){s(0);return}let o=performance.now(),i=setInterval(()=>s(performance.now()-o),Br);return()=>clearInterval(i)},[r]),e===null?null:t?100:Tr(e,n)}import{useFrame as S,useThree as h}from"@react-three/fiber";import{ContactShadows as Cr}from"@react-three/drei";import{useXR as tt}from"@react-three/xr";import{Color as kr,PerspectiveCamera as Or}from"three";import{useEffect as g,useLayoutEffect as nt,useRef as E}from"react";import{Fragment as Gr,jsx as rt,jsxs as Ur}from"react/jsx-runtime";function _s({renderMode:e,suspended:t=!1}){let{scene:r}=h(),n=h(a=>a.setFrameloop),s=tt(a=>a.session!=null),o=tt(a=>a.mode==="immersive-ar"),i=E(void 0);return g(()=>{n(t?"never":s?"always":e)},[s,e,t,n]),g(()=>{o?(i.current=r.background,r.background=null):i.current!==void 0&&(r.background=i.current,i.current=void 0)},[o,r]),S(()=>{o&&r.background!==null&&(r.background=null)}),null}function Ns({onPresentingChange:e}){let t=h(s=>s.gl),r=E(null);g(()=>{let s=t.xr;if(!s)return;let o=u=>{u?(r.current=t.shadowMap.enabled,t.shadowMap.enabled=!1):r.current!==null&&(t.shadowMap.enabled=r.current,r.current=null),e(u)},i=()=>o(!0),a=()=>o(!1);return s.addEventListener("sessionstart",i),s.addEventListener("sessionend",a),o(s.isPresenting),()=>{s.removeEventListener("sessionstart",i),s.removeEventListener("sessionend",a)}},[t,e]);let n=E(0);return S(()=>{if(!t.xr.isPresenting)return;let s=performance.now();if(s-n.current<1e3)return;n.current=s;let o=t.xr}),null}function Vs({active:e}){let t=h(r=>r.invalidate);return g(()=>{e&&t()},[e,t]),S(()=>{e&&t()}),null}function $s(e){let t=h(n=>n.gl),r=E(t.autoClear);return S(()=>{r.current=t.autoClear,t.autoClear=!0},-1),Ur(Gr,{children:[rt(Cr,{...e}),rt(zr,{saved:r})]})}function zr({saved:e}){let t=h(r=>r.gl);return S(()=>{t.autoClear=e.current}),null}function Hs({color:e}){let{scene:t,invalidate:r}=h();return nt(()=>(t.background=e?new kr(e):null,r(),()=>{t.background=null}),[t,e,r]),null}function Xs({rotation:e}){let{scene:t,invalidate:r}=h();return nt(()=>{let n=e*Math.PI/180;t.environmentRotation.set(0,n,0),t.backgroundRotation.set(0,n,0)}),g(()=>{r()},[e,r]),null}function Zs({cameraConfig:e}){let{camera:t,invalidate:r}=h();return g(()=>{if(!(t instanceof Or))return;let n=e?.fov;typeof n=="number"&&t.fov!==n&&(t.fov=n,t.updateProjectionMatrix(),r())},[t,e,r]),null}import{useLoader as ut,useThree as Zr}from"@react-three/fiber";import{FileLoader as lt,Loader as Kr,LoadingManager as Yr}from"three";import{FBXLoader as Jr,GLTFLoader as qr,MTLLoader as Qr,OBJLoader as en}from"three-stdlib";import{USDLoader as tn}from"three/examples/jsm/loaders/USDLoader.js";import{useGLTF as qs}from"@react-three/drei";import{useThree as eo}from"@react-three/fiber";import{useMemo as ro}from"react";import{SRGBColorSpace as Ir}from"three";import{DRACOLoader as Fr,KTX2Loader as jr,MeshoptDecoder as Wr}from"three-stdlib";function _r(e){return{name:"RI_unlit_emissive_texture",async afterRoot(t){let r=e.json.materials??[],n=new Map;if(r.forEach(o=>{let i=!!o?.extensions?.KHR_materials_unlit,a=!!o?.pbrMetallicRoughness?.baseColorTexture;i&&!a&&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,i])=>{let a=await e.getDependency("texture",i);a&&(a.colorSpace=Ir,s.set(o,a))})),t.scene.traverse(o=>{let i=Array.isArray(o.material)?o.material:o.material?[o.material]:[];for(let a of i){let u=a.name?s.get(a.name):void 0;u&&!a.map&&(a.map=u,a.needsUpdate=!0)}})}}}var Nr="https://assets.react-immersive.liveroom.dev/three-r184/draco/",Vr="https://assets.react-immersive.liveroom.dev/three-r184/basis/";function $r(e,t){if(!R(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}var st=new Map,ot=new WeakMap;function Hr(e){let t=st.get(e);return t||(t=new Fr,t.setDecoderPath(e),st.set(e,t)),t}function Xr(e,t){let r=ot.get(t);r||(r=new Map,ot.set(t,r));let n=r.get(e);return n||(n=$r(new jr().setTranscoderPath(e),t),r.set(e,n)),n}function at(e,t={},r){let{dracoDecoderPath:n=Nr,ktx2TranscoderPath:s=Vr,meshopt:o=!0}=t;n&&e.setDRACOLoader(Hr(n)),o&&e.setMeshoptDecoder(Wr),s&&r&&e.setKTX2Loader(Xr(s,r)),e.register((i=>_r(i)))}var T=class extends Kr{constructor(){super(...arguments);this.options={source:{format:"glb"}}}configure(r){return this.options=r,this}load(r,n,s,o){let i=performance.now(),a={format:this.options.source.format,name:this.options.source.entryPath??de(r),sourceBytes:this.options.source.sourceBytes??null,failedResources:[]},u=l=>{a.sourceBytes===null&&l.lengthComputable&&l.total>0&&(a.sourceBytes=l.total),s?.(l)};this.loadAsset(r,u,a).then(l=>{a.loadDurationMs=Math.max(0,performance.now()-i),z(l.scene,a),n(l)}).catch(l=>{a.loadDurationMs=Math.max(0,performance.now()-i),l&&typeof l=="object"&&z(l,a),o?.(l)})}async loadAsset(r,n,s){let o=sn(this.options.source);o.onError=l=>{let c=Object.entries(this.options.source.resourceUrls??{}).find(([,p])=>p===l)?.[0],d=pe(c??l);s.failedResources.includes(d)||s.failedResources.push(d)};let{format:i}=this.options.source;if(i==="obj")return rn(r,o,this.options.source,n);if(i==="fbx"){let l=J(this,new Jr(o)),c=un(r,this.options.source);c&&l.setResourcePath(c);let d=await l.loadAsync(r,n);return B(d,"FBXMesh",!1),{scene:d,animations:d.animations??[]}}if(i==="stl"||i==="ply"){let l=await nn(r,o,n),c=qe(this.options.source.entryPath??r,i==="stl"?"STL model":"PLY model"),d=i==="stl"?Qe(l,c):et(l,c);return B(d,i==="stl"?"STLMesh":"PLYMesh",!0),{scene:d,animations:[]}}if(i==="usdz"){let c=await J(this,new tn(o)).loadAsync(r,n);return B(c,"USDZMesh",!1),{scene:c,animations:c.animations??[]}}let a=J(this,new qr(o));at(a,this.options.decoderConfig,this.options.renderer),a.register(l=>{let c=l.json,d=p=>Array.isArray(p)?p.filter(f=>typeof f=="string"):[];return s.extensionsUsed=d(c.extensionsUsed),s.extensionsRequired=d(c.extensionsRequired),{name:"RI_asset_diagnostics",beforeRoot:()=>null}});let u=await a.loadAsync(r,n);return{scene:u.scene,animations:u.animations??[],materialVariants:ae(u)}}};me(e=>{ut.clear(T,e)});function go(e,t={},r,n){let s=Zr(a=>a.gl),o=Se(e),i=r?{...o,format:r}:o;return ut(T,e,a=>{a.configure({source:i,decoderConfig:t,renderer:s})},n)}async function rn(e,t,r,n){let s=await it(e,t,n),o=new en(t),i=on(s);if(i){let u=an(i,e,r);if(u)try{let l=await it(u.url,t),d=new Qr(t).parse(l,u.basePath);d.preload(),o.setMaterials(d)}catch(l){console.warn(`[react-immersive] Could not load OBJ material ${i}; rendering geometry with fallback materials.`,l)}}let a=o.parse(s);return B(a,"OBJMesh",!0),{scene:a,animations:[]}}function B(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 a=o.name||`${t}_${++s}`;if(!r&&o.name){n.add(o.name);return}let u=a,l=2;for(;n.has(u);)u=`${a}_${l++}`;o.name=u,n.add(u)})}function it(e,t,r){let n=new lt(t);return n.setResponseType("text"),n.loadAsync(e,r)}function nn(e,t,r){let n=new lt(t);return n.setResponseType("arraybuffer"),n.loadAsync(e,r)}function J(e,t){return t.setCrossOrigin(e.crossOrigin),t.setWithCredentials(e.withCredentials),t.setRequestHeader(e.requestHeader),t}function sn(e){let t=new Yr,r=e.resourceUrls;return r&&t.setURLModifier(n=>{if(/^(?:blob:|data:)/i.test(n))return n;let s=k(dt(n).split(/[?#]/)[0]),o=r[s];if(o)return o;let i=C(e.entryPath??""),a=k(i?`${i}/${s}`:s);return r[a]??n}),t}function on(e){return/^\s*mtllib\s+(.+?)\s*$/im.exec(e)?.[1]?.trim()||null}function an(e,t,r){if(r.resourceUrls&&r.entryPath){let n=k(`${C(r.entryPath)}/${dt(e)}`),s=r.resourceUrls[n];if(!s)return null;let o=C(n);return{url:s,basePath:o?`${o}/`:""}}try{let n=new URL(e,t).href;return{url:n,basePath:ct(n)}}catch{return null}}function un(e,t){if(t.resourceUrls&&t.entryPath){let r=C(t.entryPath);return r?`${r}/`:""}return ct(e)}function ct(e){let t=e.lastIndexOf("/");return t===-1?"":e.slice(0,t+1)}function C(e){let t=k(e),r=t.lastIndexOf("/");return r===-1?"":t.slice(0,r)}function k(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 dt(e){try{return decodeURI(e)}catch{return e}}import{Color as q,MeshPhysicalMaterial as ln,MeshStandardMaterial as cn,Texture as Q}from"three";function xo(e){if(le(e))return e;if(!e||typeof e!="object")return null;let t=e,r=new cn;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 Q?(r.emissiveMap=t.map,r.emissive.set(16777215)):t.color instanceof q&&r.emissive.copy(t.color)):(t.color instanceof q&&r.color.copy(t.color),t.map instanceof Q&&(r.map=t.map),t.emissive instanceof q&&r.emissive.copy(t.emissive),t.emissiveMap instanceof Q&&(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 So(e){if(ce(e))return e.clone();let t=new ln;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(P(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 Lo(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=P(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=P(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 ee,Matrix4 as dn,Sphere as pn,Vector3 as te}from"three";var pt=new WeakMap,ft=new te,fn=new te,mn=new te,bn=new ee,mt=new dn;function y(e){return"data"in e?e.data.version:e.version}function hn(e){var u;let{geometry:t,skeleton:r}=e,n=t.getAttribute("position"),s=t.getAttribute("skinIndex"),o=t.getAttribute("skinWeight"),i=pt.get(e);if(i?.geometry===t&&i.position===n&&i.indices===s&&i.weights===o&&i.skeleton===r&&i.bindMatrix.equals(e.bindMatrix)&&i.versions[0]===y(n)&&i.versions[1]===y(s)&&i.versions[2]===y(o)&&i.inverses.length===r.boneInverses.length&&i.inverses.every((l,c)=>l.equals(r.boneInverses[c])))return i;let a={geometry:t,position:n,indices:s,weights:o,skeleton:r,versions:[y(n),y(s),y(o)],bindMatrix:e.bindMatrix.clone(),inverses:r.boneInverses.map(l=>l.clone()),bones:[],weightDeviation:0};e:for(let l=0;l<n.count;l++){ft.fromBufferAttribute(n,l).applyMatrix4(e.bindMatrix);let c=0;for(let p=0;p<4;p++){let f=o.getComponent(l,p);if(f===0)continue;let m=s.getComponent(l,p);if(!Number.isFinite(f)||f<0||!Number.isInteger(m)||!r.bones[m]||!a.inverses[m]){a.bones=null;break e}c+=f,((u=a.bones)[m]??(u[m]=new ee)).expandByPoint(fn.copy(ft).applyMatrix4(a.inverses[m]))}let d=Math.abs(c-1);if(d>1e-4){a.bones=null;break}a.weightDeviation=Math.max(a.weightDeviation,d)}return pt.set(e,a),a}function Do(e,{precise:t=!1,updateFallbacks:r=!0}={}){e.updateMatrixWorld(!0),e.traverse(n=>{if(!ne(n))return;let s=n;if(!s.skeleton)return;let o=se(s);o&&s.bindMatrixInverse.copy(o);let a=!!s.geometry.morphAttributes.position?.length?null:hn(s);if(!t&&!a?.bones&&!r&&s.boundingBox&&s.boundingSphere)return;let u=s.boundingBox??(s.boundingBox=new ee),l=s.boundingSphere??(s.boundingSphere=new pn);if(u.makeEmpty(),t||!a?.bones){let c=s.geometry.getAttribute("position");for(let d=0;d<c.count;d++)u.expandByPoint(s.getVertexPosition(d,mn))}else{for(let c=0;c<a.bones.length;c++){let d=a.bones[c];d&&(mt.multiplyMatrices(s.bindMatrixInverse,s.skeleton.bones[c].matrixWorld),u.union(bn.copy(d).applyMatrix4(mt)))}if(!u.isEmpty()){let c=u.min,d=u.max,p=s.bindMatrixInverse.elements,f=Math.max(1,Math.abs(c.x),Math.abs(c.y),Math.abs(c.z),Math.abs(d.x),Math.abs(d.y),Math.abs(d.z)),m=Math.max(Math.abs(c.x-p[12]),Math.abs(d.x-p[12]),Math.abs(c.y-p[13]),Math.abs(d.y-p[13]),Math.abs(c.z-p[14]),Math.abs(d.z-p[14]));u.expandByScalar(a.weightDeviation*m+f*1e-10)}}u.getBoundingSphere(l)})}import{useCallback as bt,useEffect as vn,useRef as gn}from"react";import{useThree as yn}from"@react-three/fiber";function Co(){let e=yn(s=>s.gl.domElement),t=gn(void 0),r=bt(s=>{t.current===void 0&&(t.current=e.style.cursor),e.style.cursor=s},[e]),n=bt(()=>{let s=t.current;s!==void 0&&(e.style.cursor=s,t.current=void 0)},[e]);return vn(()=>()=>{n()},[n]),{setCanvasCursor:r,restoreCanvasCursor:n}}import{Box3 as Mn,Vector3 as ht}from"three";function O(e){return[e.x,e.y,e.z]}function Go(e){let t=new Mn().setFromObject(e),r=0;return e.traverse(n=>{n.isMesh&&(r+=1)}),{bounds:{min:O(t.min),max:O(t.max),center:O(t.getCenter(new ht)),size:O(t.getSize(new ht))},objectCount:r,materialVariants:ie(e),materialVariantGroups:ue(e)}}import{jsx as L,jsxs as re}from"react/jsx-runtime";function Wo({visible:e,title:t,message:r,progress:n}){if(!e)return null;let s=typeof n=="number"&&Number.isFinite(n),o=s?Math.round(Math.min(Math.max(n,0),100)):0;return L("div",{className:"bb-loadingOverlay",role:"status","aria-live":"polite",children:re("div",{className:"bb-loadingCard",children:[re("div",{className:"bb-loadingHeader",children:[L("span",{className:"bb-loadingTitle",title:t??r,children:t??r}),s?re("span",{className:"bb-loadingPercent",children:[o,"%"]}):null]}),L("div",{className:`bb-loadingProgress ${s?"":"bb-loadingProgress--unknown"}`,role:"progressbar","aria-label":t??r,"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":s?o:void 0,children:L("div",{className:"bb-loadingProgress__bar",style:s?{width:`${o}%`}:void 0})}),t?L("span",{className:"bb-loadingMessage",children:r}):null]})})}export{Ce as a,Gn as b,Un as c,ur as d,ls as e,$ as f,cs as g,Pn as h,U as i,Se as j,Rn as k,Be as l,Bn as m,_t as n,Tn as o,Cn as p,R as q,Yn as r,Jn as s,Hn as t,rs as u,ns as v,ss as w,os as x,gs as y,gr as z,Ps as A,Ts as B,Os as C,_s as D,Ns as E,Vs as F,$s as G,Hs as H,Xs as I,Zs as J,Nr as K,Vr as L,go as M,xo as N,So as O,Lo as P,Do as Q,Co as R,Go as S,Wo as T};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var i={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",arStart:"Start AR",arStarting:"Starting AR\u2026",arCheckingSupport:"Checking AR support\u2026",arUnavailable:"AR is unavailable in this browser. Open this link in an AR-capable browser on your phone.",arStartFailed:"Could not start AR. Check camera permissions and try again.",arAnimations:"AR animations",arAnimationSelect:"Animation",arAnimationClips:"Model clips",arAnimationSequences:"Sequences",arAnimationPlay:"Play animation",arAnimationPause:"Pause animation",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:"Pointer 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:"Name",measurementNamePlaceholder:"e.g. Door width",saveMeasurement:"Save",knownMeasurementDistance:"Known length",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 color",addText:"Add text",image:"Image",chooseImage:"Choose image",imageToAdd:"Image to add",added:"Added",colour:"Color",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",productOptions:"Options",productOptionsFor:"{product} options",productReset:"Reset",productOptional:"optional",productNone:"None",productAlsoChanges:"Also changes: {changes}",productUnavailable:"Currently unavailable.",productQuantity:"Quantity",productCheckingPrice:"Checking price and availability\u2026",productTotal:"Total",productAddToCart:"Add to cart",productAddingToCart:"Adding\u2026",productRequestQuote:"Request quote",productRequestingQuote:"Requesting\u2026",productRefresh:"Refresh",productBuy:"Buy now",productCopyLink:"Copy link",productLinkCopied:"Link copied",productShowOptions:"Show options",productHideOptions:"Hide options",productIssues:"Configuration issues",productRequestDone:"Request completed.",productSaved:"Saved: {id}",sceneSettings:"Scene Settings",background:"Background",backgroundColor:"Background Color",showEnvironmentAsBackground:"Show as background",backgroundBlur:"Background Blur",environmentPreset:"Preset",environmentIntensity:"Intensity",toneMapping:"Tone Mapping",toneMappingAces:"ACES Filmic",toneMappingAgx:"AgX",toneMappingNeutral:"Neutral",toneMappingNone:"None",ground:"Ground",groundShadow:"Ground Shadow",groundShadowOpacity:"Shadow Opacity",floorGrid:"Floor Grid",display:"Display",wireframe:"Wireframe",autoRotateSpeed:"Rotation Speed",fieldOfView:"Field of View",modelInfo:"Model",modelInfoObjects:"Objects",modelInfoTriangles:"Triangles",modelInfoMaterials:"Materials",resetSettings:"Reset Settings",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 r(o,e,t={}){return(o?.[e]??i[e]).replace(/\{(\w+)\}/g,(a,n)=>Object.prototype.hasOwnProperty.call(t,n)?String(t[n]):a)}var s=new Map(Object.entries(i).map(([o,e])=>[e,o]));function l(o,e){let t=s.get(e);return t?r(o,t):e}export{i as a,r as b,l as c};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import{f as ct,h as lt}from"./chunk-7OWHW66D.mjs";import{e as xe,f as at}from"./chunk-LX3GXQNU.mjs";import{p as bt}from"./chunk-7JCFNZJM.mjs";import{a as st,b as Ce}from"./chunk-GV4ZRXL6.mjs";import{a as we,b as ut,c as dt,d as mt,e as ft,g as pt,h as gt,j as yt,x as Ae,z as ht}from"./chunk-6Q6YZ7O5.mjs";import{useCallback as H,useRef as se,useState as At}from"react";import{Vector3 as Mt}from"three";var Le=new WeakSet;function ae(e){Le.add(e)}function Ko(e){let t=Le.has(e);return t&&Le.delete(e),t}var De=new WeakSet;function Yo(e,t){t?De.add(e):De.delete(e)}function St(e,t){return De.has(e)?0:t}import{Box3 as xt,Matrix4 as Bn,PerspectiveCamera as wt,Vector3 as Ue}from"three";function er(e,t){let n=ct(e);if(!(e.camera instanceof wt)||!t)return n;let o=t instanceof xt?t:new xt().setFromObject(t);return o.isEmpty()||(n.framing={aspect:e.camera.aspect,min:o.min.toArray(),max:o.max.toArray()}),n}function Ct(e,t){let n=t.camera,o=e.framing;if(!(n instanceof wt)||!o||!(n.aspect>0)||Math.abs(n.aspect-o.aspect)<1e-6)return[...e.position];let r=new Ue(...e.position),i=new Ue(...e.target),s=r.clone().sub(i).normalize(),a=new Bn().lookAt(r,i,n.up).invert(),c=Math.tan((e.fov??n.fov)*Math.PI/360)/(e.zoom??n.zoom);if(!(c>0)||!Number.isFinite(c))return[...e.position];let l=0;for(let p of[o.min[0],o.max[0]])for(let m of[o.min[1],o.max[1]])for(let u of[o.min[2],o.max[2]]){let f=new Ue(p,m,u).sub(r).applyMatrix4(a);l=Math.max(l,Math.abs(f.x)/(c*n.aspect)+f.z,Math.abs(f.y)/c+f.z)}return r.addScaledVector(s,l*1.02).toArray()}function Ot(e){return[e.x,e.y,e.z]}function Q(e,t){let n=new Mt,o=new Mt;return t.getPosition(n),t.getTarget(o),{position:Ot(n),target:Ot(o),fov:"fov"in e&&typeof e.fov=="number"?e.fov:null,zoom:"zoom"in e&&typeof e.zoom=="number"?e.zoom:1,azimuthAngle:t.azimuthAngle,polarAngle:t.polarAngle}}function Pn(e,t){return e?e.position[0]===t.position[0]&&e.position[1]===t.position[1]&&e.position[2]===t.position[2]&&e.target[0]===t.target[0]&&e.target[1]===t.target[1]&&e.target[2]===t.target[2]&&e.fov===t.fov&&e.zoom===t.zoom&&e.azimuthAngle===t.azimuthAngle&&e.polarAngle===t.polarAngle:!1}async function de(e,t,n=.6){let o=e.smoothTime;e.smoothTime=St(e,n);try{return await t()}finally{e.smoothTime=o}}function dr(e={}){let t=se(e);t.current=e;let n=se(null),[o,r]=At(null),[i,s]=At(()=>({...e.presets})),a=se(i);a.current=i;let c=H(g=>{r(d=>Pn(d,g)?d:g)},[]),l=H(g=>{c(g)},[c]),p=se(null),m=se(null),u=se(null),f=H(g=>{n.current=g;let d=Q(g.raw.controls.camera,g.raw.controls);c(d),g.raw.scene!==m.current&&(m.current=g.raw.scene,p.current=null,u.current=null),g.homeCameraState&&!p.current&&(p.current=g.homeCameraState);let{initialPosition:h,initialTarget:A,initialTransition:T=!1}=t.current;if((h||A)&&g.raw.scene&&(h||g.homeCameraState)&&u.current!==g.raw.controls){u.current=g.raw.controls,g.homeCameraState||ae(g.raw.controls);let E=h??d.position,D=A??d.target;g.raw.controls.setLookAt(E[0],E[1],E[2],D[0],D[1],D[2],T).then(()=>{if(n.current?.raw.controls!==g.raw.controls)return;let V=Q(g.raw.controls.camera,g.raw.controls);p.current={position:V.position,target:V.target},c(V)}).catch(()=>{})}},[c]),y=H(async()=>{let g=n.current,d=g?.raw.controls;if(!d)return!1;try{let h=p.current;if(h){lt(d,h);let A=Ct(h,d);await de(d,()=>d.setLookAt(A[0],A[1],A[2],h.target[0],h.target[1],h.target[2],!0))}else g?.raw.scene?await de(d,()=>d.fitToBox(g.raw.scene,!0,{paddingTop:.5,paddingBottom:.5,paddingLeft:.5,paddingRight:.5})):await de(d,()=>d.reset(!0));return!0}catch{return!1}},[]),M=H(async()=>{let g=n.current;if(!g?.raw.controls||!g.raw.scene)return!1;try{return await de(g.raw.controls,()=>g.raw.controls.fitToBox(g.raw.scene,!0,{paddingTop:.5,paddingBottom:.5,paddingLeft:.5,paddingRight:.5})),!0}catch{return!1}},[]),S=H(async g=>{let d=n.current;if(!d?.raw.controls)return!1;let h=st(d.objectBindings,g);if(!h)return!1;let A=d.raw.nodes[h];if(!A)return!1;try{return await de(d.raw.controls,()=>d.raw.controls.fitToBox(A,!0,{paddingTop:.5,paddingBottom:.5,paddingLeft:.5,paddingRight:.5})),!0}catch{return!1}},[]),x=H(async(g,d=!0)=>{let h=n.current?.raw.controls;if(!h)return!1;try{return n.current?.homeCameraState||ae(h),await h.setTarget(g[0],g[1],g[2],d),c(Q(h.camera,h)),!0}catch{return!1}},[c]),w=H(async(g,d=!0)=>{let h=n.current?.raw.controls;if(!h)return!1;try{n.current?.homeCameraState||ae(h);let A=[h.setLookAt(g.position[0],g.position[1],g.position[2],g.target[0],g.target[1],g.target[2],d)];g.azimuthAngle!=null&&g.polarAngle!=null&&A.push(h.rotateTo(g.azimuthAngle,g.polarAngle,d)),await Promise.all(A);let T=h.camera,E=!1;return g.fov!=null&&"fov"in T&&typeof T.fov=="number"&&(T.fov=g.fov,E=!0),g.zoom!=null&&"zoom"in T&&typeof T.zoom=="number"&&(T.zoom=g.zoom,E=!0),E&&"updateProjectionMatrix"in T&&T.updateProjectionMatrix(),c(Q(T,h)),!0}catch{return!1}},[c]),b=H((g,d=!0)=>w(g,d),[w]),C=H((g,d,h=!0)=>w({position:g,target:d},h),[w]),O=H(async(g,d,h=!0)=>{let A=n.current?.raw.controls;if(!A)return!1;try{return n.current?.homeCameraState||ae(A),await A.rotateTo(g*Math.PI/180,d*Math.PI/180,h),c(Q(A.camera,A)),!0}catch{return!1}},[c]),k=H(async(g,d=!0)=>{let h=n.current?.raw.controls;if(!h)return!1;try{return n.current?.homeCameraState||ae(h),await h.dollyTo(g,d),c(Q(h.camera,h)),!0}catch{return!1}},[c]),I=H(g=>{let d=n.current?.raw.controls,h=g.trim();if(!d||!h)return null;let A=Q(d.camera,d);return a.current={...a.current,[h]:A},s(T=>({...T,[h]:A})),c(A),A},[c]),R=H((g,d=!0)=>{let h=a.current[g];return h?w(h,d):Promise.resolve(!1)},[w]);return{cameraState:o,cameraPresets:i,resetView:y,focusObject:S,fitScene:M,setCameraTarget:x,setCameraState:b,lookAt:C,orbitTo:O,dollyTo:k,savePreset:I,goToPreset:R,handleCameraChange:l,handleViewerReady:f}}function fr(e){let t=e.trim();return t?/\.(hdr|exr|jpg|jpeg|png|webp)(?:[?#].*)?$/i.test(t):!1}var pr=["none","directional","point","spot","hemisphere"],gr=["pbr","matcap","uv-checker"],br=["apartment","city","dawn","forest","lobby","night","park","studio","sunset","warehouse"];var yr=["sporadic","constantMild","constantWild"],hr=["linear","radial","mirroredLinear"],Sr=["verySmall","small","medium","large","veryLarge","huge"];var _e={enabled:!1,axis:"y",position:.5,flip:!1},Vn={clips:[],autoplayClip:null},Nn={autofocus:{enabled:!1,focusDistance:5,focusRange:5,focalLength:.02,bokehScale:6,target:[0,0,0],mouse:!0,debug:0,manual:!1,smoothTime:.25},toneMapping:{enabled:!1,mode:"aces",exposure:1,resolution:256,whitePoint:4,middleGrey:.6,minLuminance:.01,averageLuminance:1,adaptationRate:1},brightnessContrast:{enabled:!1,brightness:0,contrast:0},hueSaturation:{enabled:!1,hue:0,saturation:0},colorAverage:{enabled:!1},dotScreen:{enabled:!1,angle:Math.PI/2,scale:1},glitch:{enabled:!1,mode:"sporadic",delay:[1.5,3.5],duration:[.6,1],strength:[.3,1],chromaticAberrationOffset:[0,0],columns:.05,ratio:.85},ssao:{enabled:!1,samples:30,rings:4,intensity:8,radius:.25,bias:.025,luminanceInfluence:.6,fade:.01,minRadiusScale:.33,worldDistanceThreshold:20,worldDistanceFalloff:5,worldProximityThreshold:6,worldProximityFalloff:3},bloom:{enabled:!1,intensity:.3,luminanceThreshold:.9,luminanceSmoothing:.2,mipmapBlur:!0,radius:0,levels:8},godRays:{enabled:!1,sunPosition:[5,10,5],samples:60,density:.96,decay:.9,weight:.4,exposure:.6,clampMax:1,blur:!0,kernelSize:"small"},grid:{enabled:!1,scale:1,lineWidth:0},noise:{enabled:!1,opacity:1,premultiply:!1},depthOfField:{enabled:!1,focusDistance:5,focusRange:5,focalLength:.02,bokehScale:6},chromaticAberration:{enabled:!1,offsetX:.002,offsetY:.002,radialModulation:!1,modulationOffset:.15},lensflare:{enabled:!1,lensPosition:[-25,6,-60],smoothTime:.07,glareSize:.2,flareSize:.01,flareSpeed:.01,flareShape:.01,animated:!0,anamorphic:!1,colorGain:"#141414",haloScale:.5,secondaryGhosts:!0,aditionalStreaks:!0,ghostScale:0,opacity:1,starBurst:!1},vignette:{enabled:!1,offset:.3,darkness:.3,eskil:!1},smaa:{enabled:!1},sepia:{enabled:!1,intensity:0},scanline:{enabled:!1,density:1.25},pixelation:{enabled:!1,granularity:5},outline:{enabled:!1,selectionLayer:10,edgeStrength:2.5,pulseSpeed:0,visibleEdgeColor:"#ffffff",hiddenEdgeColor:"#22090a",kernelSize:"large",blur:!1,xRay:!0},selectiveBloom:{enabled:!1,selectionLayer:10,intensity:1,luminanceThreshold:.9,luminanceSmoothing:.025,kernelSize:"large",mipmapBlur:!0,inverted:!1,ignoreBackground:!1},ramp:{enabled:!1,rampType:"linear",rampStart:[.5,.5],rampEnd:[1,1],startColor:"#000000",endColor:"#ffffff",opacity:.5,rampBias:.5,rampGain:.5,rampMask:!1,rampInvert:!1}},ce={model:{rotation:[0,0,0],showAdvancedRotation:!1,renderer:"pbr",shading:"lit",autoRotate:!1,autoRotateSpeed:1},camera:{fieldOfView:50,showAdvancedSettings:!1},lighting:{ambient:{intensity:.25,color:"#ffffff"},lights:[{id:"light-hemi",type:"hemisphere",color:"#ffffff",intensity:.3,position:[0,1,0],attachedToCamera:!1,castShadow:!1,shadowBias:-5e-4,visible:!0},{id:"light-key",type:"directional",color:"#ffffff",intensity:2.5,position:[6,12,6],attachedToCamera:!1,castShadow:!0,shadowBias:-5e-4,visible:!0},{id:"light-fill",type:"directional",color:"#ffffff",intensity:0,position:[-6,8,-6],attachedToCamera:!1,castShadow:!1,shadowBias:-5e-4,visible:!0}]},shadows:{enabled:!0,mapSize:2048,bias:-5e-4,normalBias:.02,radius:3},environment:{source:"preset",preset:"apartment",customEnvironmentUrl:"",intensity:.25,rotation:0,shadowLight:{enabled:!1,intensity:2.5,bias:-5e-4}},wireframe:{enabled:!1,color:"#000000",opacity:1},background:{enabled:!1,type:"color",color:"#1c1c1d",imageUrl:""},groundShadows:{enabled:!1,mode:"shadowCatcher",intensity:.7,borderFade:1,height:0,size:10},postProcessing:Nn,animations:Vn,annotations:[]};function me(e){let t=p=>{throw new Error(`Invalid section: ${p}`)},n=p=>p&&typeof p=="object"&&!Array.isArray(p)?p:t("expected an object"),o=p=>typeof p=="string"&&p.trim().length>0&&p.length<=200?p:t("expected a nonempty name or id (up to 200 characters)"),r=p=>typeof p=="number"&&Number.isFinite(p)&&p>=0&&p<=1?p:t("position must be between 0 and 1"),i=p=>!Array.isArray(p)||p.length!==3||!p.every(m=>typeof m=="number"&&Number.isFinite(m))||Math.hypot(...p)<1e-8?t("normal must be a finite, nonzero vector"):[...p],s=p=>{let m=n(p);return!["x","y","z"].includes(m.axis)||typeof m.enabled!="boolean"||typeof m.flip!="boolean"?t("invalid plane"):{enabled:m.enabled,axis:m.axis,position:r(m.position),flip:m.flip,...m.normal!==void 0?{normal:i(m.normal)}:{}}},a=p=>{let m=n(p),u=s(m);if(m.mode!==void 0){if(!["plane","planes","box"].includes(m.mode))return t("invalid mode");u.mode=m.mode}if(m.planes!==void 0){if(!Array.isArray(m.planes)||m.planes.length>6)return t("at most six planes are supported");let f=new Set;u.planes=m.planes.map(y=>{let M=n(y),S=o(M.id);return f.has(S)?t("duplicate plane id"):(f.add(S),{...s(M),id:S,name:o(M.name)})})}if(m.activePlaneId!==void 0&&(u.activePlaneId=o(m.activePlaneId)),m.invertBox!==void 0){if(typeof m.invertBox!="boolean")return t("invalid box inversion");u.invertBox=m.invertBox}if(m.box!==void 0){let f=n(m.box),y=x=>!Array.isArray(x)||x.length!==3?t("invalid box bounds"):x.map(r),M=y(f.min),S=y(f.max);if(M.some((x,w)=>x>=S[w]))return t("box minimum must be below its maximum on every axis");u.box={min:M,max:S}}return u},c=n(e),l=a(c);if(c.presets!==void 0){if(!Array.isArray(c.presets)||c.presets.length>32)return t("at most 32 presets are supported");let p=new Set;l.presets=c.presets.map(m=>{let u=n(m),f=o(u.id);return p.has(f)?t("duplicate preset id"):(p.add(f),{id:f,name:o(u.name),settings:a(u.settings)})})}return l}function Cr(e){let{presets:t,...n}=me(e);return n}function Ar(e){try{return me(e)}catch{return _e}}function Mr(e,t){if(!t||typeof t!="object"||Array.isArray(t))throw new Error("Invalid section: expected an object");let n=["enabled","axis","position","flip"].every(o=>Object.prototype.hasOwnProperty.call(t,o));return me(n?t:{..._e,...e,...t})}import{Box3 as jt,Matrix4 as Oe,Quaternion as zn,Vector3 as Me,Euler as Ln}from"three";var vr={version:1,placements:{},gridSize:1};function $e(e){return e.id??e.url}function fe(e){if(!e||typeof e!="object"||Array.isArray(e))throw new Error("Expected an asset transform object.");let t={};for(let n of["position","rotation","scale"]){let o=e[n];if(o!==void 0){if(!Array.isArray(o)||o.length!==3||!o.every(r=>typeof r=="number"&&Number.isFinite(r))||n==="scale"&&o.some(r=>r===0))throw new Error(`Invalid asset ${n}: expected three finite ${n==="scale"?"nonzero ":""}numbers.`);t[n]=[...o]}}return t}function Tr(e){if(!e||typeof e!="object"||Array.isArray(e))throw new Error("Invalid scene composition.");let t=e;if(t.version!==1||!Number.isFinite(t.gridSize)||t.gridSize<=0||!t.placements||typeof t.placements!="object"||Array.isArray(t.placements)||Object.keys(t.placements).length>256)throw new Error("Invalid scene composition version, grid size or placements (maximum 256).");let n={};for(let[o,r]of Object.entries(t.placements)){if(!o||["__proto__","constructor","prototype"].includes(o))throw new Error("Invalid asset instance ID.");let i=fe(r);if(r.label!==void 0&&(typeof r.label!="string"||r.label.length>512))throw new Error("Invalid asset label.");for(let s of["visible","deleted"])if(r[s]!==void 0&&typeof r[s]!="boolean")throw new Error(`Invalid asset ${s}.`);n[o]={...i,...r.label!==void 0?{label:r.label}:{},...r.visible!==void 0?{visible:r.visible}:{},...r.deleted!==void 0?{deleted:r.deleted}:{}}}return{version:1,gridSize:t.gridSize,placements:n}}function Ir(e,t){if(!Number.isFinite(t)||t<=0)throw new Error("Grid size must be positive.");let n=fe(e),[o,r,i]=n.position??[0,0,0];return{...n,position:[Math.round(o/t)*t,r,Math.round(i/t)*t]}}function kr(e,t){let n=fe(e),o=n.position??[0,0,0],r=new Oe().compose(new Me(...o),new zn().setFromEuler(new Ln(...n.rotation??[0,0,0])),new Me(...n.scale??[1,1,1])),i=new jt(new Me(...t.min),new Me(...t.max)).applyMatrix4(r);if(!Number.isFinite(i.min.y))throw new Error("Cannot place an asset with empty bounds.");return{...n,position:[o[0],o[1]-i.min.y,o[2]]}}function Rr(e){e.updateWorldMatrix(!0,!0);let t=new Oe().copy(e.parent?.parent?.matrixWorld??new Oe).invert(),n=new jt;return e.traverse(o=>{let r=o;r.geometry&&(r.geometry.computeBoundingBox(),r.geometry.boundingBox&&n.union(r.geometry.boundingBox.clone().applyMatrix4(new Oe().multiplyMatrices(t,r.matrixWorld))))}),n.isEmpty()||![...n.min.toArray(),...n.max.toArray()].every(Number.isFinite)?null:{min:n.min.toArray(),max:n.max.toArray()}}import{BufferGeometry as Dn,Float32BufferAttribute as Un,Matrix4 as Tt,Mesh as Fe,ShapeUtils as _n,Vector2 as It,Vector3 as q,Vector4 as $n}from"three";function kt(e){if(e.length!==3)return null;let t=new q(...e[0]).sub(new q(...e[1])),n=new q(...e[2]).sub(new q(...e[1]));return t.lengthSq()===0||n.lengthSq()===0?null:Math.acos(Math.max(-1,Math.min(1,t.normalize().dot(n.normalize()))))*180/Math.PI}function Rt(e,t){if(!e.normal)return null;let n=new q(...e.normal);if(n.lengthSq()===0)return null;n.normalize();let o=new q(...t),r=o.clone().sub(new q(...e.position)).dot(n);return{distance:Math.abs(r),projection:o.addScaledVector(n,-r).toArray()}}function Et(e){if(e.length<3)return{error:"Pick at least three points to finish the area."};let t=new q(...e[0]),n=e.map(S=>new q(...S).sub(t)),o=Math.max(...n.map(S=>S.length()));if(o===0)return{error:"Area points must be distinct."};let r=new q;for(let S=1;S<n.length-1;S+=1){let x=n[S].clone().cross(n[S+1]);x.lengthSq()>r.lengthSq()&&r.copy(x)}if(r.length()<=o*o*1e-10)return{error:"Area points must not lie on one straight line."};r.normalize();let i=Math.max(o*1e-5,Number.EPSILON*Math.max(...e.flat().map(Math.abs))*32);if(n.some(S=>Math.abs(S.dot(r))>i))return{error:"Area points must lie on one plane."};let s=n.find(S=>S.length()>o*1e-10).clone().normalize(),a=r.clone().cross(s).normalize(),c=n.map(S=>new It(S.dot(s),S.dot(a))),l=(S,x,w)=>(x.x-S.x)*(w.y-S.y)-(x.y-S.y)*(w.x-S.x),p=o*o*1e-10,m=(S,x,w)=>Math.abs(l(S,x,w))<=p&&w.x>=Math.min(S.x,x.x)-o*1e-10&&w.x<=Math.max(S.x,x.x)+o*1e-10&&w.y>=Math.min(S.y,x.y)-o*1e-10&&w.y<=Math.max(S.y,x.y)+o*1e-10;for(let S=0;S<c.length;S+=1){let x=c[S],w=c[(S+1)%c.length];if(x.distanceTo(w)<=o*1e-10)return{error:"Area points must be distinct."};for(let b=S+1;b<c.length;b+=1){if(b===S+1||S===0&&b===c.length-1)continue;let C=c[b],O=c[(b+1)%c.length],k=l(x,w,C),I=l(x,w,O),R=l(C,O,x),g=l(C,O,w);if(k*I<0&&R*g<0||m(x,w,C)||m(x,w,O)||m(C,O,x)||m(C,O,w))return{error:"Area edges must not cross or touch each other."}}}let u=0,f=0,y=0;for(let S=0;S<c.length;S+=1){let x=c[S],w=c[(S+1)%c.length],b=x.x*w.y-w.x*x.y;u+=b,f+=(x.x+w.x)*b,y+=(x.y+w.y)*b}if(Math.abs(u)<=p)return{error:"The polygon has no measurable area."};let M=t.clone().addScaledVector(s,f/(3*u)).addScaledVector(a,y/(3*u));return{area:Math.abs(u)/2,center:M.toArray(),triangles:_n.triangulateShape(c,[])}}function qe(e,t){if(e.length<2)return 0;let n=0;for(let o=1;o<e.length;o+=1)n+=new q(...e[o]).distanceTo(new q(...e[o-1]));return t&&(n+=new q(...e[e.length-1]).distanceTo(new q(...e[0]))),n}var Fn=1e-5;function qn(e,t){let n=e.getAttribute("position"),o=e.getIndex(),r=n.count,i=Math.max(t,1e-9),s=(y,M,S)=>`${Math.round(y/i)}_${Math.round(M/i)}_${Math.round(S/i)}`,a=new Int32Array(r),c=[],l=new Map;for(let y=0;y<r;y+=1){let M=n.getX(y),S=n.getY(y),x=n.getZ(y),w=s(M,S,x),b=l.get(w);b===void 0&&(b=c.length,c.push(new q(M,S,x)),l.set(w,b)),a[y]=b}let p=c.map(()=>new Map),m=(y,M)=>{if(y===M)return;let S=c[y].distanceTo(c[M]);p[y].has(M)||p[y].set(M,S),p[M].has(y)||p[M].set(y,S)},u=(o?o.count:r)/3,f=y=>o?o.getX(y):y;for(let y=0;y<u;y+=1)m(a[f(y*3)],a[f(y*3+1)]),m(a[f(y*3+1)],a[f(y*3+2)]),m(a[f(y*3+2)],a[f(y*3)]);return{weldedId:a,weldedPosition:c,neighbors:p}}function Wn(e,t,n){let o=new Map([[t,0]]),r=[t];for(let i=0;i<n&&r.length>0;i+=1){let s=[];for(let a of r){let c=o.get(a)??0;for(let[l,p]of e[a]??[])o.has(l)||(o.set(l,c+p),s.push(l))}r=s}return o}function Gn(e){let n=(Math.abs(e.y)<.9?new q(0,1,0):new q(1,0,0)).clone().cross(e).normalize(),o=e.clone().cross(n).normalize();return[n,o]}function Hn(e,t,n){let[o,r]=Gn(t),i=0,s=0,a=0;for(let M of n){let S=M.clone().sub(e),x=S.dot(o),w=S.dot(r);i+=x*x,s+=x*w,a+=w*w}let c=i+a,l=i*a-s*s,p=Math.sqrt(Math.max(0,c*c/4-l)),m=c/2+p,u=1,f=0;Math.abs(s)>1e-12?(u=m-a,f=s):a>i&&(u=0,f=1);let y=Math.hypot(u,f)||1;return o.clone().multiplyScalar(u/y).add(r.clone().multiplyScalar(f/y)).normalize()}function Kn(e,t,n,o){let r=e.getAttribute("position"),i=e.getIndex(),s=r.count,a=(i?i.count:s)/3,c=u=>i?i.getX(u):u,l=u=>new q(r.getX(u),r.getY(u),r.getZ(u)).applyMatrix4(t),p=u=>u.clone().sub(n).dot(o),m=[];for(let u=0;u<a;u+=1){let f=l(c(u*3)),y=l(c(u*3+1)),M=l(c(u*3+2)),S=p(f),x=p(y),w=p(M),b=[],C=(O,k,I,R)=>{k>0!=R>0&&b.push(O.clone().lerp(I,k/(k-R)))};C(f,S,y,x),C(y,x,M,w),C(M,w,f,S),b.length===2&&m.push([b[0],b[1]])}return m}function Xn(e,t){let n=Math.max(t,1e-9),o=u=>`${Math.round(u.x/n)}_${Math.round(u.y/n)}_${Math.round(u.z/n)}`,r=new Map,i=[],s=u=>{let f=o(u),y=r.get(f);return y===void 0&&(y=i.length,i.push(u),r.set(f,y)),y},a=[],c=u=>{for(;a.length<=u;)a.push(new Map)};for(let[u,f]of e){let y=s(u),M=s(f);y!==M&&(c(y),c(M),a[y].set(M,(a[y].get(M)??0)+1),a[M].set(y,(a[M].get(y)??0)+1))}let l=(u,f)=>u<f?`${u}_${f}`:`${f}_${u}`,p=new Set,m=[];for(let u=0;u<a.length;u+=1)for(let f of a[u]?.keys()??[]){if(p.has(l(u,f)))continue;let y=[u],M=u,S=f;p.add(l(M,S));let x=0;for(;S!==u&&S>=0&&x<a.length+4;){y.push(S);let w=[...a[S].keys()].filter(C=>C!==M),b;if(w.length<=1)b=w[0];else{let C=i[S].clone().sub(i[M]).normalize(),O=-1/0;for(let k of w){let I=i[k].clone().sub(i[S]).normalize(),R=C.dot(I);R>O&&(O=R,b=k)}}if(b===void 0){S=-1;break}p.add(l(S,b)),M=S,S=b,x+=1}S===u&&y.length>=3&&m.push(y.map(w=>i[w]))}return m}function vt(e,t){let n=1/0;for(let o of e)n=Math.min(n,o.distanceTo(t));return n}function Yn(e,t){let n=0,o=1/0;return e.forEach((r,i)=>{let s=r.distanceTo(t);s<o&&(o=s,n=i)}),[...e.slice(n),...e.slice(0,n)]}function Bt(e,t,n,o,r){let i=Kn(e,t,o,r);if(i.length===0)return{error:"Couldn't trace a loop around this point."};let s=Xn(i,n*t.getMaxScaleOnAxis());if(s.length===0)return{error:"The surface here doesn't form a closed loop around this point (it may be near an open edge)."};let a=s[0],c=vt(a,o);for(let p of s.slice(1)){let m=vt(p,o);m<c&&(c=m,a=p)}let l=Yn(a,o).map(p=>p.toArray());return{points:l,length:qe(l,!0)}}function Pt(e){if(!(e.object instanceof Fe)||!e.face)return null;let t=e.object,n=t.geometry;if(t.isSkinnedMesh||t.morphTargetInfluences?.some(i=>i!==0)){let i=n.getAttribute("position"),s=new Un(new Float32Array(i.count*3),3),a=new q;for(let c=0;c<i.count;c++)t.getVertexPosition(c,a),s.setXYZ(c,a.x,a.y,a.z);n=new Dn().setAttribute("position",s).setIndex(n.getIndex())}let o=t.matrixWorld.clone();if(e.instanceId!==void 0&&"getMatrixAt"in t){let i=new Tt;t.getMatrixAt(e.instanceId,i),o.multiply(i)}n.computeBoundingSphere();let r=n.boundingSphere&&n.boundingSphere.radius>0?n.boundingSphere.radius:1;return{face:e.face,geometry:n,matrix:o,weldTolerance:r*Fn}}function Pr(e,t=6){let n=Pt(e);if(!n)return{error:"Pick a point on the mesh surface to trace a loop around it."};let{face:o,geometry:r,matrix:i,weldTolerance:s}=n,a=Vt(e);if(!a)return{error:"Pick a point on the mesh surface to trace a loop around it."};let c=a[1].clone().sub(a[0]).cross(a[2].clone().sub(a[0]));if(c.lengthSq()===0)return{error:"Couldn't determine the surface direction at this point."};c.normalize();let{weldedId:l,weldedPosition:p,neighbors:m}=qn(r,s),u=r.getAttribute("position"),f=e.point.clone().applyMatrix4(i.clone().invert()),y=[o.a,o.b,o.c],M=y[0],S=1/0;for(let k of y){let R=new q(u.getX(k),u.getY(k),u.getZ(k)).distanceTo(f);R<S&&(S=R,M=k)}let x=l[M],w=p[x].clone().applyMatrix4(i),b=Wn(m,x,t),C=[];for(let k of b.keys())C.push(p[k].clone().applyMatrix4(i));if(C.length<6)return{error:"Not enough surface detail near this point to trace a loop. Try a different spot."};let O=Hn(w,c,C);return Bt(r,i,s,e.point.clone(),O)}function Vr(e,t=new q(0,1,0)){let n=Pt(e);if(!n)return{error:"Pick a point on the mesh surface to trace a loop around it."};let{geometry:o,matrix:r,weldTolerance:i}=n,s=t.clone().normalize();return s.lengthSq()===0?{error:"Couldn't determine a horizontal direction."}:Bt(o,r,i,e.point.clone(),s)}function Vt(e){if(!(e.object instanceof Fe)||!e.face)return null;let t=e.object,n=t.matrixWorld.clone();if(e.instanceId!==void 0&&"getMatrixAt"in t){let o=new Tt;t.getMatrixAt(e.instanceId,o),n.multiply(o)}return[e.face.a,e.face.b,e.face.c].map(o=>t.getVertexPosition(o,new q).applyMatrix4(n))}function Nr(e){if(!(e.object instanceof Fe))return!1;for(let n=e.object;n;n=n.parent)if(!n.visible||n.userData.riEditorGizmo||n.userData.riDecal)return!1;return(Array.isArray(e.object.material)?e.object.material:[e.object.material])[e.face?.materialIndex??0]?.visible!==!1}function zr(e,t,n,o,r,i=12){let s=Vt(e),a=s?s[1].clone().sub(s[0]).cross(s[2].clone().sub(s[0])).normalize():null,c={position:e.point.toArray(),...a&&a.lengthSq()>0?{normal:a.toArray()}:{},...s?{faceVertices:s.map(u=>u.toArray())}:{}};if(!s||r==="none")return c;let l=u=>{let f=new $n(u.x,u.y,u.z,1).applyMatrix4(t.matrixWorldInverse).applyMatrix4(t.projectionMatrix);return f.w<=0||f.z/f.w<-1||f.z/f.w>1?null:{screen:new It((f.x/f.w+1)*o.width/2,(1-f.y/f.w)*o.height/2),w:f.w}},p=s.map(l),m=i;if((r==="vertex"||r==="auto")&&(p.forEach((u,f)=>{let y=u?.screen.distanceTo(n)??1/0;y<=m&&(m=y,c.position=s[f].toArray(),c.snapped="vertex")}),c.snapped))return c;if(r==="edge"||r==="auto")for(let u=0;u<3;u+=1){let f=(u+1)%3,y=p[u],M=p[f];if(!y||!M)continue;let S=M.screen.clone().sub(y.screen);if(S.lengthSq()===0)continue;let x=Math.max(0,Math.min(1,n.clone().sub(y.screen).dot(S)/S.lengthSq())),w=y.screen.clone().addScaledVector(S,x).distanceTo(n);if(w<=m){m=w;let b=x*y.w/((1-x)*M.w+x*y.w);c.position=s[u].clone().lerp(s[f],b).toArray(),c.snapped="edge"}}return c}var Zn=["m","cm","mm","in","ft"],We={m:1,cm:.01,mm:.001,in:.0254,ft:.3048},Jn=["distance","angle","area","pointToPlane","wrap","wrapHorizontal"];function Ge(e){return Zn.includes(e)}function Qn(e={},t="m"){let n=e.displayUnit??t,o=e.metersPerUnit??We[e.sourceUnit??"m"];if(!Number.isFinite(o)||o<=0)throw new Error("Measurement scale must be a positive finite number.");return{displayUnit:n,metersPerUnit:o,factor:Ge(n)?o/We[n]:1}}function Ur(e){try{return new URL(e,typeof window<"u"?window.location?.href:void 0).href}catch{return e}}function _r(e,t,n,o={}){if(!Ge(n)||!Number.isFinite(e)||e<=0||!Number.isFinite(t)||t<=0)throw new Error("Calibration needs two distinct points and a positive known distance.");let r=t*We[n]/e;if(!Number.isFinite(r)||r<=0)throw new Error("Calibration scale is outside the supported range.");return{...o,metersPerUnit:r}}function Nt(e,t){let n=t.map(o=>o.position);if(e==="angle"){let o=kt(n);return o===null?null:{value:o,dimension:0}}if(e==="area"){let o=Et(n);return"error"in o?null:{value:o.area,dimension:2}}if(e==="pointToPlane"){let o=t.length===2?Rt(t[0],t[1].position):null;return o?{value:o.distance,dimension:1}:null}return t.length<(e==="distance"?2:3)?null:{value:qe(n,e!=="distance"),dimension:1}}function eo(e,t={},n="m",o=e.points,r=e.approximate?"approximate":"ready"){let i=Nt(e.tool,o),{factor:s,displayUnit:a}=Qn(t,n),c=r==="ready"||r==="approximate",l=c&&i?i.value*s**i.dimension:null;return{id:e.id,status:c?i&&l!==null&&Number.isFinite(l)?r:"invalid":r,rawValue:c&&i&&Number.isFinite(i.value)?i.value:null,value:l!==null&&Number.isFinite(l)?l:null,unit:e.tool==="angle"?"\xB0":e.tool==="area"?`${a}\xB2`:a}}function pe(e){function t(){throw new Error("Invalid measurements: expected settings and valid named measurements with finite points.")}let n=a=>!!a&&typeof a=="object"&&!Array.isArray(a),o=a=>Array.isArray(a)&&a.length===3&&a.every(c=>typeof c=="number"&&Number.isFinite(c));typeof e=="string"&&(e.length>5*1024*1024&&t(),e=JSON.parse(e)),(!n(e)||e.version!==void 0&&e.version!==1||!n(e.settings)||!Array.isArray(e.items)||e.items.length>256)&&t();let r={};for(let a of["sourceUnit","displayUnit"])e.settings[a]!==void 0&&(Ge(e.settings[a])||t(),r[a]=e.settings[a]);e.settings.metersPerUnit!==void 0&&((typeof e.settings.metersPerUnit!="number"||!Number.isFinite(e.settings.metersPerUnit)||e.settings.metersPerUnit<=0)&&t(),r.metersPerUnit=e.settings.metersPerUnit);let i=new Set,s=e.items.map(a=>{(!n(a)||typeof a.id!="string"||!a.id||i.has(a.id)||typeof a.name!="string"||!a.name.trim()||typeof a.modelId!="string"||!a.modelId||!Jn.includes(a.tool)||!Array.isArray(a.points)||a.points.length>8192||typeof a.createdAt!="string"||!Number.isFinite(Date.parse(a.createdAt)))&&t(),i.add(a.id),a.tilesetUrl!==void 0&&a.tilesetUrl!==null&&typeof a.tilesetUrl!="string"&&t(),(a.visible!==void 0&&typeof a.visible!="boolean"||a.approximate!==void 0&&typeof a.approximate!="boolean")&&t();let c=new Set,l=a.points.map(m=>{if((!n(m)||typeof m.id!="number"||!Number.isFinite(m.id)||!o(m.position))&&t(),c.has(m.id)&&t(),c.add(m.id),m.normal!==void 0&&!o(m.normal)&&t(),m.faceVertices!==void 0&&(!Array.isArray(m.faceVertices)||m.faceVertices.length!==3||!m.faceVertices.every(o))&&t(),m.snapped!==void 0&&!["vertex","edge"].includes(m.snapped)&&t(),m.anchor!==void 0){let f=m.anchor;(!n(f)||typeof f.nodeId!="string"||!f.nodeId||!o(f.localPosition)||typeof f.geometrySignature!="string"||typeof f.poseSignature!="string")&&t(),f.localNormal!==void 0&&!o(f.localNormal)&&t(),f.localFaceVertices!==void 0&&(!Array.isArray(f.localFaceVertices)||f.localFaceVertices.length!==3||!f.localFaceVertices.every(o))&&t(),f.instanceId!==void 0&&(!Number.isInteger(f.instanceId)||f.instanceId<0)&&t()}let u=m.anchor;return{id:m.id,position:[...m.position],...m.normal?{normal:[...m.normal]}:{},...m.faceVertices?{faceVertices:m.faceVertices.map(f=>[...f])}:{},...m.snapped?{snapped:m.snapped}:{},...u?{anchor:{nodeId:u.nodeId,localPosition:[...u.localPosition],geometrySignature:u.geometrySignature,poseSignature:u.poseSignature,...u.localNormal?{localNormal:[...u.localNormal]}:{},...u.localFaceVertices?{localFaceVertices:u.localFaceVertices.map(f=>[...f])}:{},...u.instanceId!==void 0?{instanceId:u.instanceId}:{}}}:{}}}),p={id:a.id,name:a.name,modelId:a.modelId,tool:a.tool,points:l,createdAt:a.createdAt,...a.tilesetUrl!==void 0?{tilesetUrl:a.tilesetUrl}:{},...a.visible!==void 0?{visible:a.visible}:{},...a.approximate!==void 0?{approximate:a.approximate}:{}};return Nt(p.tool,l)||t(),p});return{settings:r,items:s}}function $r(e){return JSON.stringify({version:1,...pe(e)},null,2)}function Fr(e,t,n="m"){let o=pe(e),r=new Map(t?.map(s=>[s.id,s])),i=s=>{let a=String(s??"");return/^[=+@-]/.test(a)&&(a=`'${a}`),`"${a.replace(/"/g,'""')}"`};return[["id","name","modelId","type","status","value","unit","createdAt"],...o.items.map(s=>{let a=r.get(s.id)??eo(s,o.settings,n);return[s.id,s.name,s.modelId,s.tool,a.status,a.value,a.unit,s.createdAt]})].map(s=>s.map(i).join(",")).join(`\r
|
|
2
|
+
`)}function zt(e){if(!Array.isArray(e)||e.length>128)throw new Error("Invalid selections: expected up to 128 named selection sets.");let t=new Set;return e.map(n=>{if(!n||typeof n!="object"||typeof n.id!="string"||!n.id||t.has(n.id)||typeof n.name!="string"||!n.name.trim()||n.name.length>200||!Array.isArray(n.objectIds)||n.objectIds.length>1e5||n.objectIds.some(o=>typeof o!="string"||!o))throw new Error("Invalid selections: each set needs a unique id, a name, and model object ids.");return t.add(n.id),{id:n.id,name:n.name.trim(),objectIds:[...new Set(n.objectIds)]}})}import{CanvasTexture as Lt,Color as Dt,ImageLoader as to,NoColorSpace as ve,RepeatWrapping as je,SRGBColorSpace as Ze,Texture as no}from"three";var te=new Map,Xe={color:"#93c5fd",intensity:.07},Hr=new Dt(Xe.color).multiplyScalar(Xe.intensity),Kr=new Dt(Xe.color),Xr=.28,le=new Map,Ye=new Map;function oo(e){return`${e.name}|${e.size}|${e.lastModified}`}function Yr(e){let t=oo(e),n=e.name.lastIndexOf("."),o=n>0?e.name.slice(0,n):e.name,r=n>0?e.name.slice(n):"",i=`materials/${e.name}`,s=2;for(;;){let a=Ye.get(i);if(a===void 0||a===t)return Ye.set(i,t),i;i=`materials/${o}-${s}${r}`,s+=1}}function Te(e){return le.get(e)}function Ut(e,t){let n=++e.loadGeneration;e.loaded=!1,e.failed=!1;let o=()=>{if(e.loadGeneration!==n)return;e.loaded=!0;let r=e.pending;e.pending=[];for(let i of r)i()};new to().load(t,r=>{e.loadGeneration===n&&(e.texture.image=r,e.texture.needsUpdate=!0,o())},void 0,()=>{e.loadGeneration===n&&(e.failed=!0,console.warn(`Failed to load texture: ${t}`),o())})}function _t(e,t){for(let n of[Ze,ve]){let o=te.get(ge(e,n));o&&Ut(o,t)}}function Zr(e,t){let n=le.get(e);n&&n!==t&&n.startsWith("blob:")&&URL.revokeObjectURL(n),le.set(e,t),_t(e,t)}function Jr(e){let t=le.get(e);t&&(t.startsWith("blob:")&&URL.revokeObjectURL(t),le.delete(e),Ye.delete(e),_t(e,e))}function ge(e,t){return`${t}|${e}`}function ro(e,t=ve,n){let o=ge(e,t),r=te.get(o);if(r)return n&&!r.loaded&&r.pending.push(n),r.texture;let i=le.get(e)??e,s={texture:new no,refCount:0,loaded:!1,pending:n?[n]:[],loadGeneration:0};return s.texture.flipY=!1,s.texture.colorSpace=t,te.set(o,s),Ut(s,i),s.texture}function Qr(e,t=ve,n){let o=ro(e,t,n);return te.get(ge(e,t)).refCount+=1,o}function ei(e,t=ve){let n=te.get(ge(e,t));n&&(n.refCount-=1,n.refCount<=0&&(n.loadGeneration+=1,n.pending=[],n.texture.dispose(),te.delete(ge(e,t))))}function ti(e,t,n,o,r,i=1,s=0){let a=e.offsetTextures??(e.offsetTextures={}),c=a[t],l=c;if(!l||l.sourcePath!==o||l.base!==n){c?.texture.dispose();let m=n.clone();m.wrapS=je,m.wrapT=je,m.center.set(.5,.5),m.needsUpdate=!0,l={texture:m,sourcePath:o,base:n},a[t]=l}let p=i>0?i:1;return l.texture.offset.set(r[0],r[1]),l.texture.repeat.set(1/p,1/p),l.texture.rotation=s,l.texture}function ni(e,t){let n=e.offsetTextures,o=n?.[t];o&&(o.texture.dispose(),delete n[t])}function oi(e){let t=e.offsetTextures;if(t){for(let n of Object.values(t))n.texture.dispose();delete e.offsetTextures}}var He=null;function ri(){if(He)return He;let e=256,t=document.createElement("canvas");t.width=e,t.height=e;let n=t.getContext("2d"),o=n.createRadialGradient(e*.35,e*.35,e*.02,e*.5,e*.5,e*.55);o.addColorStop(0,"#ffffff"),o.addColorStop(.4,"#b5b5b5"),o.addColorStop(1,"#3a3a3a"),n.fillStyle=o,n.fillRect(0,0,e,e);let r=new Lt(t);return r.colorSpace=Ze,He=r,r}var Ke=null;function ii(){if(Ke)return Ke;let e=1024,t=8,n=e/t,o=["#ef4444","#f59e0b","#22c55e","#6366f1"],r=document.createElement("canvas");r.width=e,r.height=e;let i=r.getContext("2d");i.textAlign="center",i.textBaseline="middle";for(let a=0;a<t;a+=1)for(let c=0;c<t;c+=1){let l=c*n,p=a*n,m=(Math.floor(c/2)+Math.floor(a/2))%4;i.fillStyle=o[m],i.fillRect(l,p,n,n),i.strokeStyle="rgba(0, 0, 0, 0.28)",i.lineWidth=2;for(let w=1;w<4;w+=1){let b=w*n/4;i.beginPath(),i.moveTo(l+b,p),i.lineTo(l+b,p+n),i.moveTo(l,p+b),i.lineTo(l+n,p+b),i.stroke()}i.strokeStyle="#09090b",i.lineWidth=7,i.strokeRect(l,p,n,n);let u=l+n*.23,f=p+n*.72,y=l+n*.72,M=p+n*.23;i.lineCap="round",i.lineJoin="round",i.beginPath(),i.moveTo(u,f),i.lineTo(y,M),i.lineTo(y-n*.2,M),i.moveTo(y,M),i.lineTo(y,M+n*.2),i.stroke();let S=a*t+c+1;i.font=`700 ${Math.round(n*.2)}px ui-monospace, SFMono-Regular, Menlo, monospace`,i.fillStyle="#ffffff",i.strokeStyle="rgba(0, 0, 0, 0.85)",i.lineWidth=6;let x=String(S).padStart(2,"0");i.strokeText(x,l+n/2,p+n*.82),i.fillText(x,l+n/2,p+n*.82)}let s=new Lt(r);return s.colorSpace=Ze,s.wrapS=je,s.wrapT=je,s.flipY=!1,s.anisotropy=8,s.needsUpdate=!0,Ke=s,s}function $t(e){for(let t of te.values())if(t.texture.source===e.source&&(!t.loaded||t.failed))return!0;return!1}var ne=5*1024*1024,io=["activeModelId","modelUrl","modelFormat","tilesetUrl","models","mergeModels","sceneConfig","isolation","multiSelectedKeys","activeAnnotation","annotationCategories","backgroundColor","shadows","cinematic","cameraControllerType","objectTransformSpace","arScaleMode","usdzUrl","measurements","measurementSettings","measurementUnit","measurementModelId"];function v(e,t){throw new Error(`Invalid viewer state at ${e}: ${t}`)}function W(e,t){(!e||typeof e!="object"||Array.isArray(e))&&v(t,"expected an object.")}function be(e,t){(!Array.isArray(e)||!e.every(n=>typeof n=="string"))&&v(t,"expected strings.")}function Y(e,t,n){(!Array.isArray(e)||e.length!==t||!e.every(o=>typeof o=="number"&&Number.isFinite(o)))&&v(n,`expected ${t} finite numbers.`)}function ao(e){let t=new Set,n=0;function o(r,i,s){if((++n>2e5||s>64)&&v(i,"configuration is too complex."),r===null||typeof r=="string"||typeof r=="boolean"||typeof r=="number"&&Number.isFinite(r))return r;(typeof r!="object"||!r)&&v(i,"expected JSON data (finite numbers, no functions)."),t.has(r)&&v(i,"cyclic data."),!Array.isArray(r)&&Object.getPrototypeOf(r)!==Object.prototype&&Object.getPrototypeOf(r)!==null&&v(i,"expected plain JSON data."),t.add(r);let a=Array.isArray(r)?[]:{};for(let[c,l]of Object.entries(r))["__proto__","constructor","prototype"].includes(c)&&v(`${i}.${c}`,"reserved property."),l!==void 0?a[c]=o(l,`${i}.${c}`,s+1):Array.isArray(r)&&v(i,"undefined array entry.");return t.delete(r),a}return o(e,"state",0)}function Z(e,t,n,o,r=!1,i){let s=e[t];if(s==null||s==="")return;typeof s!="string"&&v(n,"expected a URL.");let a=r?Te(s)??s:s;if(a.trim().startsWith("blob:")){if(r&&i){i.set(s,{source:a,path:n});return}v(n,r?"this image is temporary. Use getStateAsync() for JSON or createShareUrl() to include it.":"upload this model/environment asset to a durable URL before saving or sharing.")}if(a!==s&&(s=a,e[t]=a),r&&/^data:image\//i.test(s))return;let c;try{c=new URL(s,o??"https://relative.invalid/")}catch{v(n,"invalid asset URL.")}["http:","https:"].includes(c.protocol)||v(n,"use an HTTP(S) asset URL."),o&&(e[t]=c.href)}function so(e,t){W(e,t),Y(e.position,3,`${t}.position`),Y(e.target,3,`${t}.target`),(typeof e.zoom!="number"||e.zoom<=0)&&v(t,"zoom must be positive."),e.fov!==null&&(typeof e.fov!="number"||e.fov<=0||e.fov>=180)&&v(t,"fov must be null or between 0 and 180.");for(let n of["azimuthAngle","polarAngle"])e[n]!==void 0&&typeof e[n]!="number"&&v(t,`${n} must be a number.`)}function Wt(e,t,n,o){W(e,t),(typeof e.id!="number"||typeof e.title!="string"||typeof e.description!="string")&&v(t,"expected an annotation id, title and description.");for(let r of["worldPosition","localPosition"])Y(e[r],3,`${t}.${r}`);e.images!==void 0&&(Array.isArray(e.images)||v(t,"images must be an array."),e.images.forEach(r=>{W(r,t),Z(r,"src",t,n,!0,o)})),e.links!==void 0&&(Array.isArray(e.links)||v(t,"links must be an array."),e.links.forEach(r=>{W(r,t),Z(r,"href",t,n,!1,o)}))}function Gt(e,t){W(e,t),e.waypoints!==void 0&&(Array.isArray(e.waypoints)||v(t,"expected waypoints."),e.waypoints.forEach(n=>{W(n,t),Y(n.position,3,t),Y(n.target,3,t)}));for(let n of["enabled","loop","autoPlay"])e[n]!==void 0&&typeof e[n]!="boolean"&&v(t,`${n} must be boolean.`);e.duration!==void 0&&(typeof e.duration!="number"||e.duration<=0)&&v(t,"duration must be positive.")}function Je(e,t,n){if(t!==null)if(Array.isArray(t))Array.isArray(e)||v(n,"expected an array."),t.length&&e.forEach(o=>Je(o,t[0],n));else if(typeof t=="object"){W(e,n);for(let[o,r]of Object.entries(t))Je(e[o],r,`${n}.${o}`)}else typeof e!=typeof t&&v(n,`expected ${typeof t}.`)}function Ft(e,t,n,o){if(Je(e,ce,t),e.measurements!==void 0&&(e.measurements=pe(e.measurements)),e.sequences!==void 0&&(e.sequences=xe(e.sequences)),e.selectionSets!==void 0&&(e.selectionSets=zt(e.selectionSets)),e.product!==void 0&&(e.product=bt(e.product),e.product.definition.groups.forEach(r=>r.options.forEach(i=>i.appearance?.forEach(s=>{for(let[a,c]of Object.entries(s.material??{}))c&&typeof c=="object"&&!Array.isArray(c)&&"path"in c&&Z(c,"path",`${t}.product.material.${a}.path`,n,!0,o)})))),Y(e.model.rotation,3,`${t}.model.rotation`),e.lighting.lights.forEach(r=>Y(r.position,3,`${t}.lighting.lights`)),e.annotations.forEach(r=>Wt(r,`${t}.annotations`,n,o)),e.animations.autoplayClip!==null&&typeof e.animations.autoplayClip!="string"&&v(t,"invalid autoplay clip."),e.animations.clips.forEach(r=>{W(r,t),(typeof r.sourceName!="string"||typeof r.displayName!="string"||typeof r.hidden!="boolean"||typeof r.speed!="number"||!["repeat","once","ping-pong"].includes(r.loopMode))&&v(t,"invalid animation clip settings.")}),e.cinematic!==void 0&&Gt(e.cinematic,`${t}.cinematic`),e.styleRules!==void 0&&!Array.isArray(e.styleRules)&&v(t,"styleRules must be an array."),Z(e.environment,"customEnvironmentUrl",`${t}.environment`,n,!1,o),Z(e.background,"imageUrl",`${t}.background`,n,!0,o),e.model.activeVariants!==void 0&&be(e.model.activeVariants,t),e.section!==void 0)try{e.section=me(e.section)}catch(r){v(`${t}.section`,r.message)}}function Ht(e,t,n,o){W(e,t);for(let[r,i]of Object.entries(e)){let s=`${t}.${r}`;W(i,s),(typeof i.id!="string"||typeof i.modelObjectId!="string")&&v(s,"expected binding id and modelObjectId.");for(let a of["label","group","type","status"])i[a]!==void 0&&typeof i[a]!="string"&&v(s,`${a} must be a string.`);i.tags!==void 0&&be(i.tags,s),i.metadata!==void 0&&W(i.metadata,`${s}.metadata`),i.metrics!==void 0&&(W(i.metrics,s),Object.values(i.metrics).some(a=>typeof a!="number")&&v(s,"metrics must be numbers.")),i.actions!==void 0&&(Array.isArray(i.actions)||v(s,"actions must be an array."),i.actions.forEach(a=>{W(a,s),(typeof a.id!="string"||typeof a.label!="string"||a.type!=="command"||a.effects!==void 0&&!Array.isArray(a.effects))&&v(s,"invalid action.")}));for(let a of["visible","removed","selectable","hoverable"])i[a]!==void 0&&typeof i[a]!="boolean"&&v(s,`${a} must be boolean.`);if(i.transform!==void 0){W(i.transform,s);for(let a of["position","rotation","scale","shear"])i.transform[a]!==void 0&&Y(i.transform[a],3,`${s}.transform.${a}`);i.transform.pivot!==void 0&&(W(i.transform.pivot,s),Y(i.transform.pivot.point,3,s),Y(i.transform.pivot.offset,3,s))}if(i.style!==void 0&&(W(i.style,s),i.style.material!==void 0)){W(i.style.material,s);for(let[a,c]of Object.entries(i.style.material))c&&typeof c=="object"&&!Array.isArray(c)&&"path"in c&&Z(c,"path",`${s}.style.material.${a}.path`,n,!0,o)}i.decals!==void 0&&(Array.isArray(i.decals)||v(s,"decals must be an array."),i.decals.forEach(a=>{W(a,s),(typeof a.id!="string"||typeof a.size!="number"||a.size<=0)&&v(s,"invalid decal."),Y(a.position,3,s),Y(a.normal,3,s),Z(a,"image",s,n,!0,o)}))}}function qt(e,t,n,o){Array.isArray(e)||v(t,"expected merge sources."),e.forEach(r=>{W(r,t),(typeof r.url!="string"||!r.url||typeof r.namePrefix!="string")&&v(t,"expected source URL and prefix."),Z(r,"url",t,n,!1,o)})}function co(e,t,n){W(e,"configuration");let o=Object.fromEntries(io.filter(r=>e[r]!==void 0).map(r=>[r,e[r]]));(typeof o.modelUrl!="string"||!o.modelUrl)&&v("configuration.modelUrl","expected the active model URL.");for(let r of["modelUrl","tilesetUrl","usdzUrl"])Z(o,r,`configuration.${r}`,t,!1,n);if(o.sceneConfig!==void 0&&Ft(o.sceneConfig,"configuration.sceneConfig",t,n),o.mergeModels!==void 0&&qt(o.mergeModels,"configuration.mergeModels",t,n),o.models!==void 0){(!Array.isArray(o.models)||o.models.length===0)&&v("configuration.models","expected model entries.");let r=new Set,i=new Set;o.models.forEach(s=>{W(s,"model"),(typeof s.url!="string"||!s.url)&&v("model.url","expected a URL."),Z(s,"url","model.url",t,!1,n),s.id!==void 0&&(typeof s.id!="string"||!s.id.trim())&&v("model.id","expected a nonempty instance ID.");let a=$e({id:s.id,url:s.url});i.has(a)&&v("configuration.models","instance identities must be unique; assign IDs when reusing a URL."),i.add(a),s.transform!==void 0&&(s.transform=fe(s.transform)),s.visible!==void 0&&typeof s.visible!="boolean"&&v("model.visible","expected boolean."),r.add(s.url),Ht(s.objectBindings,"model.objectBindings",t,n),s.sceneConfig!==void 0&&Ft(s.sceneConfig,"model.sceneConfig",t,n),s.mergeModels!==void 0&&qt(s.mergeModels,"model.mergeModels",t,n)}),o.activeModelId!==void 0&&(typeof o.activeModelId!="string"||!i.has(o.activeModelId))&&v("configuration.activeModelId","active instance is not in models."),o.activeModelId!==void 0&&o.models.find(s=>$e(s)===o.activeModelId)?.url!==o.modelUrl&&v("configuration.modelUrl","source does not match the active instance."),r.has(o.modelUrl)||v("configuration.modelUrl","active model is not in models.")}if(o.multiSelectedKeys!==void 0&&be(o.multiSelectedKeys,"configuration.multiSelectedKeys"),o.annotationCategories!==void 0&&o.annotationCategories!==null&&be(o.annotationCategories,"configuration.annotationCategories"),o.activeAnnotation!==void 0&&o.activeAnnotation!==null&&Wt(o.activeAnnotation,"configuration.activeAnnotation",t,n),o.measurements!==void 0||o.measurementSettings!==void 0){let r=pe({items:o.measurements??[],settings:o.measurementSettings??{}});o.measurements!==void 0&&(o.measurements=r.items),o.measurementSettings!==void 0&&(o.measurementSettings=r.settings)}o.measurementModelId!==void 0&&typeof o.measurementModelId!="string"&&v("configuration.measurementModelId","expected a stable id."),o.measurementUnit!==void 0&&typeof o.measurementUnit!="string"&&v("configuration.measurementUnit","expected a unit label.");for(let r of["backgroundColor"])o[r]!==void 0&&typeof o[r]!="string"&&v(r,"expected a string.");o.shadows!==void 0&&typeof o.shadows!="boolean"&&v("shadows","expected boolean.");for(let[r,i]of Object.entries({modelFormat:["glb","gltf","obj","fbx","usdz","stl","ply"],cameraControllerType:["orbit","pointerLock"],objectTransformSpace:["world","local"],arScaleMode:["normalized","real-world"]}))o[r]!==void 0&&!i.includes(o[r])&&v(r,"unsupported value.");if(o.cinematic!==void 0&&Gt(o.cinematic,"cinematic"),o.isolation!==void 0&&o.isolation!==null){let{target:r,mode:i,ghostOpacity:s}=o.isolation;typeof r=="string"||Array.isArray(r)&&r.every(a=>typeof a=="string")||r&&typeof r=="object"&&["group","tag","type"].some(a=>typeof r[a]=="string")||v("configuration.isolation","invalid target."),i!==void 0&&!["ghost","hide"].includes(i)&&v("configuration.isolation","invalid mode."),s!==void 0&&(typeof s!="number"||s<0||s>1)&&v("configuration.isolation","opacity must be between 0 and 1.")}return o}function Kt(e,t,n,o){if(!(!e||typeof e!="object"))for(let[r,i]of Object.entries(e))r!=="metadata"&&(typeof i=="string"&&["url","modelUrl","tilesetUrl","usdzUrl","path","image","src","href","imageUrl","customEnvironmentUrl"].includes(r)?Z(e,r,`${t}.${r}`,n,["path","image","src","imageUrl"].includes(r),o):Kt(i,`${t}.${r}`,n,o))}function Xt(e,t,n){typeof e=="string"&&(new TextEncoder().encode(e).length>ne&&v("state","exceeds the 5 MiB limit."),e=JSON.parse(e));let o=ao(e);W(o,"state"),new TextEncoder().encode(JSON.stringify(o)).length>ne&&v("state","exceeds the 5 MiB limit."),o.version!==void 0&&o.version!==1&&v("version","unsupported version."),o.version===void 0&&(o.objectBindings!==void 0||o.configuration!==void 0)&&v("version","full configurations require version 1.");let r={};return o.version!==void 0&&(r.version=1),o.camera!==void 0&&(so(o.camera,"camera"),r.camera=o.camera),o.hidden!==void 0&&(be(o.hidden,"hidden"),r.hidden=o.hidden),o.selected!==void 0&&(o.selected!==null&&typeof o.selected!="string"&&v("selected","expected an object id or null."),r.selected=o.selected),o.objectBindings!==void 0&&(Ht(o.objectBindings,"objectBindings",t,n),r.objectBindings=o.objectBindings),o.configuration!==void 0&&(r.configuration=co(o.configuration,t,n)),Kt(r,"state",t,n),new TextEncoder().encode(JSON.stringify(r)).length>ne&&v("state","exceeds the 5 MiB limit."),r}function gi(e,t){return JSON.stringify(Ie(e,t))}function Ie(e,t){return Xt(e,t)}async function Yt(e,t){let n=new Map,o=Xt(e,t,n),r=new Map,i=new Map;for(let[a,{source:c,path:l}]of n){let p=r.get(c);p||(p=(async()=>{let m;try{m=await fetch(c)}catch{v(l,"this temporary image is no longer available. Reload or reselect it before saving.")}m.ok||v(l,"could not read the temporary image. Reload or reselect it before saving.");let u=await m.blob();u.size>ne*3/4&&v(l,"embedded image exceeds the 5 MiB configuration limit. Use a hosted image URL.");let f=new Uint8Array(await u.arrayBuffer()),y=u.type.split(";")[0].toLowerCase(),M=y.startsWith("image/")?y:lo(f);M||v(l,"temporary asset is not a supported image. Use a hosted asset URL.");let S="";for(let x=0;x<f.length;x+=32768)S+=String.fromCharCode(...f.subarray(x,x+32768));return`data:${M};base64,${btoa(S)}`})(),r.set(c,p)),i.set(a,await p)}function s(a){if(!(!a||typeof a!="object"))for(let[c,l]of Object.entries(a))c!=="metadata"&&(["path","image","src","imageUrl"].includes(c)&&typeof l=="string"&&i.has(l)?a[c]=i.get(l):s(l))}return s(o),Ie(o,t)}function lo(e){let t=(n,o)=>String.fromCharCode(...e.subarray(n,o));if(e[0]===137&&t(1,4)==="PNG")return"image/png";if(e[0]===255&&e[1]===216&&e[2]===255)return"image/jpeg";if(t(0,3)==="GIF")return"image/gif";if(t(0,4)==="RIFF"&&t(8,12)==="WEBP")return"image/webp";if(t(4,8)==="ftyp"&&["avif","avis"].includes(t(8,12)))return"image/avif";if(/<svg[\s>]/i.test(new TextDecoder().decode(e.subarray(0,1024))))return"image/svg+xml"}import{strFromU8 as uo,strToU8 as Zt,unzlibSync as mo,zlibSync as fo}from"fflate";var ke="ri-ar",Re="ri-ar-id",Jt=4096,po=2200,go=Zt(JSON.stringify(ce)).byteLength;function Qt(e){return e==="localhost"||e.endsWith(".localhost")||/^127\./.test(e)||e==="[::1]"||e==="0.0.0.0"}function en(e){if(typeof e=="string"&&/^https?:\/\//i.test(e)&&Qt(new URL(e).hostname))throw new Error("An asset URL points to this computer. Use model and texture URLs reachable from the phone.");if(e&&typeof e=="object")for(let t of Object.values(e))en(t)}function wi(e){return e&&typeof e=="object"?e:void 0}function Ci(e){let t=new URLSearchParams(new URL(e,"https://viewer.invalid/").hash.slice(1));return t.has(ke)||t.has(Re)}function bo(e,t){let n=new URL(e,t);if(!["https:","http:"].includes(n.protocol))throw new Error("AR handoff requires an HTTP(S) URL.");return n.toString()}function Ai(e,t="",n=2048){let o=new Set,r=i=>{if(typeof i=="string")return Te(i)??i;if(i===null||typeof i!="object")return i;if(o.has(i))throw new Error("AR configuration cannot contain cycles.");o.add(i);let s=Array.isArray(i)?i.map(r):Object.fromEntries(Object.keys(i).sort().map(a=>[a,r(i[a])]));return o.delete(i),s};return JSON.stringify([t,n,r({...e,camera:void 0})])}function tn(e,t){if(JSON.stringify(e)!==JSON.stringify(t))return e&&t&&typeof e=="object"&&typeof t=="object"&&!Array.isArray(e)&&!Array.isArray(t)?Object.fromEntries(Object.entries(e).map(([n,o])=>[n,tn(o,t[n])]).filter(([,n])=>n!==void 0)):e}function nn(e,t,n=0){if(n>64)throw new Error("AR configuration is too deeply nested.");if(e&&t&&typeof e=="object"&&typeof t=="object"&&!Array.isArray(e)&&!Array.isArray(t)){let o=e,r=t;return Object.fromEntries([...new Set([...Object.keys(r),...Object.keys(o)])].map(i=>[i,Object.prototype.hasOwnProperty.call(o,i)?nn(o[i],r[i],n+1):r[i]]))}return e}function on(e,t){let n=structuredClone(e);if(n.configuration){n.configuration.sceneConfig&&(n.configuration.sceneConfig=t(n.configuration.sceneConfig));for(let o of n.configuration.models??[])o.sceneConfig&&(o.sceneConfig=t(o.sceneConfig))}return n}function ye(e){e?.throwIfAborted()}async function Mi(e,t,n,o){ye(o);let r=new URL(bo(t));if(Qt(r.hostname))throw new Error("Phone links need a viewer URL reachable from your phone. Download the USDZ for local uploads, or provide a public viewer URL.");let i=await Yt(e,r.toString());ye(o),en(i);let s=new URLSearchParams(r.hash.slice(1));if(s.delete(ke),s.delete(Re),s.delete("view"),s.delete("viewId"),s.delete("view-id"),n){let a=await n.save(i);if(ye(o),typeof a!="string"||!a||a.length>512)throw new Error("AR storage returned an invalid configuration ID.");s.set(Re,a)}else{let a=fo(Zt(JSON.stringify({ar:1,state:on(i,l=>tn(l,ce)??{})})),{level:9});if(a.byteLength>Jt)throw new Error("This configuration needs an AR storage adapter to share on a phone. The USDZ download is still available.");let c="";for(let l of a)c+=String.fromCharCode(l);s.set(ke,btoa(c).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,""))}if(r.hash=s.toString(),r.toString().length>po)throw new Error("This configuration is too large for a reliable QR code. Use an AR storage adapter or download the USDZ.");return r.toString()}async function Oi(e,t,n){let o=new URL(e),r=new URLSearchParams(o.hash.slice(1)),i=r.get(Re),s=r.get(ke);if(i!==null&&s!==null)throw new Error("AR link contains conflicting configurations.");if(i===null&&s===null)return null;ye(n);let a;if(i!==null){if(!t)throw new Error("This AR link requires the application's configuration storage adapter.");if(!i||i.length>512)throw new Error("Invalid AR configuration ID.");a=await t.load(i)}else{if(!s||s.length>Math.ceil(Jt*4/3)||!/^[\w-]+$/.test(s))throw new Error("Invalid or oversized AR link.");let l=atob(s.replace(/-/g,"+").replace(/_/g,"/")),p=Uint8Array.from(l,f=>f.charCodeAt(0)),m=mo(p);if(m.byteLength>ne)throw new Error("AR configuration exceeds the 5 MiB limit.");let u=JSON.parse(uo(m));if(u?.ar===1&&u.state){let f=u.state.configuration,y=(f?.sceneConfig?1:0)+(Array.isArray(f?.models)?f.models.filter(M=>M?.sceneConfig).length:0);if(m.byteLength+y*go>ne)throw new Error("Expanded AR configuration exceeds the 5 MiB limit.");a=on(u.state,M=>nn(M,ce))}else a=u}ye(n);let c=Ie(a,o.toString());if(c.version!==1||!c.configuration)throw new Error("AR handoff requires a complete versioned viewer configuration.");return c}var Qe=new WeakMap;function vi(e,t){t?Qe.set(e,t):Qe.delete(e)}function rn(e){e.traverse(t=>{let n=Qe.get(t);if(n)throw new Error(n)})}import{Box3 as Bo,BufferAttribute as wn,BufferGeometry as Cn,Color as Po,DoubleSide as Vo,FrontSide as rt,Group as An,Matrix4 as No,Mesh as zo,Vector3 as Be}from"three";import{PropertyBinding as et}from"three";var tt=Symbol("react-immersive.model-node-id");function yo(e,t){Object.defineProperty(e,tt,{value:t,configurable:!0})}function oe(e){let t=new Map;e.traverse(c=>{if(!c.name)return;let l=t.get(c.name);l?l.push(c):t.set(c.name,[c])});let n=Object.create(null),o=new WeakMap,r=new Map,i=new Set(Array.from(t,([c,l])=>l.length===1?c:null).filter(c=>c!==null)),s=new Set,a=(c,l)=>{yo(c,l),n[l]=c,o.set(c,l),s.add(l)};for(let[c,l]of t)l.length===1&&a(l[0],c);for(let[c,l]of t){if(l.length<2)continue;let p=[];l.forEach((m,u)=>{let f=`${c} [${u+1}]`,y=f,M=2;for(;i.has(y)||s.has(y);)y=`${f}.${M++}`;a(m,y),p.push(y)}),r.set(c,p)}return{nodesById:n,idByNode:o,duplicateNames:r}}function he(e){return e[tt]??e.name??null}function ki(e,t){let n=t.replace(/\.[^./\\]+$/,"");e.traverse(o=>{o.name&&(o.name=et.sanitizeNodeName(`${n}_${o.name}`))})}function Ri(e,t){let n=t.replace(/\.[^./\\]+$/,""),o=e.clone();for(let r of o.tracks){let s=et.parseTrackName(r.name).nodeName??"",a=et.sanitizeNodeName(`${n}_${s}`);r.name=a+r.name.slice(s.length)}return o}function an(e,t){let n=null,o=[];return e.traverse(r=>{r[tt]===t&&(n=r),r.name===t&&o.push(r)}),n??(o.length===1?o[0]:null)}import{AnimationClip as Mo,Group as Oo,Matrix4 as jo,PropertyBinding as bn}from"three";import{clone as vo}from"three/examples/jsm/utils/SkeletonUtils.js";import{strFromU8 as To,strToU8 as yn,unzipSync as Io,zipSync as ko}from"fflate";import{AnimationMixer as ho,LoopOnce as So,LoopPingPong as sn,LoopRepeat as xo}from"three";function cn(e){let t=e._loopCount;return e.loop===sn&&(t&1)===1}function wo(e){return cn(e)?e.getClip().duration-e.time:e.time}function ln({root:e,clips:t,getClipConfig:n,onChange:o}){let r=new ho(e),i=new Map;for(let{clip:d,sourceName:h}of t)i.set(h,r.clipAction(d));let s=new Map,a=new Set,c=new Map,l=1,p=d=>typeof d=="string",m=d=>p(d)?s.has(d)?[d]:[]:[...s.keys()],u=(d,h)=>{let A=ht(n(h));A==="once"?d.setLoop(So,1):A==="ping-pong"?d.setLoop(sn,1/0):d.setLoop(xo,1/0),d.clampWhenFinished=A==="once"},f=d=>{d.action.setEffectiveTimeScale(d.reverse?-d.speed:d.speed)},y=d=>{let h=s.get(d);h&&(h.action.stop(),s.delete(d))},M=(d,h={})=>{let A=i.get(d);if(!A||n(d)?.hidden)return;let T=Number.isFinite(h.fade)&&h.fade>0?h.fade:0,E=h.reverse??!1;if(!h.alongside)for(let[j,N]of[...s])j!==d&&(T>0?(s.delete(j),N.action.fadeOut(T),a.add(N.action)):y(j));a.delete(A)&&A.stop();let D=A.getClip().duration,V=s.get(d),F=()=>{A.reset(),E&&(A.time=D),A.play()};if(!V)F(),T>0&&A.fadeIn(T);else{let j=E?A.time<=0:A.time>=D;V.finished&&j&&F(),A.paused=!1,A.enabled=!0,s.delete(d)}u(A,d),V={action:A,speed:n(d)?.speed??c.get(d)??l,reverse:E,finished:!1},V.speed=Ae(V.speed),f(V),s.set(d,V),o()},S=d=>{for(let h of m(d))s.get(h).action.paused=!0;o()},x=d=>{for(let h of m(d))y(h);if(!p(d)){for(let h of a)h.stop();a.clear()}o()},w=(d,h)=>{let A=Ae(d);p(h)?c.set(h,A):l=A;for(let T of m(h)){let E=s.get(T);c.set(T,A),E.speed=A,f(E)}o()},b=(d,h)=>{for(let A of m(h)){let T=s.get(A),E=T.action.getClip().duration,D=Math.min(Math.max(d,0),E);T.action.time=cn(T.action)?E-D:D,T.finished&&(T.finished=!1,T.action.paused=!0)}r.update(0),o()},C=()=>{for(let[d,h]of[...s]){let A=n(d);if(A?.hidden){y(d);continue}u(h.action,d),A?.speed!==void 0&&(h.speed=Ae(A.speed),f(h))}o()},O=d=>{for(let h of s.values())h.action===d.action&&(h.finished=!0);o()};return r.addEventListener("finished",O),{play:M,pause:S,stop:x,setSpeed:w,seek:b,getState:()=>{let d=[...s].map(([A,T])=>({clip:A,status:T.finished?"finished":T.action.paused?"paused":"playing",time:wo(T.action),duration:T.action.getClip().duration,speed:T.speed,reverse:T.reverse})),h=d[d.length-1];return{currentClip:h?.clip??null,isPlaying:d.some(A=>A.status==="playing"),speed:h?.speed??l,time:h?.time??0,duration:h?.duration??0,active:d}},applyClipConfigs:C,isRunning:()=>{if(a.size>0)return!0;for(let{action:d}of s.values())if(!d.paused&&d.enabled)return!0;return!1},update:d=>{r.update(d);for(let h of a)(!h.enabled||h.getEffectiveWeight()<=0)&&(h.stop(),a.delete(h))},dispose:()=>{r.removeEventListener("finished",O),r.stopAllAction(),r.uncacheRoot(e),s.clear(),a.clear()}}}import{Color as mn}from"three";import{Matrix4 as un,Quaternion as Co,Vector3 as Ee}from"three";function Ao(e){return new un().set(1,e[0],e[1],0,0,1,e[2],0,0,0,1,0,0,0,0,1)}function nt(e,t){e.matrixAutoUpdate=!t,e.updateMatrix(),t&&(e.matrix.makeRotationFromQuaternion(e.quaternion).multiply(Ao(t)).scale(e.scale).setPosition(e.position),e.matrixWorldNeedsUpdate=!0)}function dn(e,t,n){let o=new Ee().setFromMatrixColumn(e,0),r=new Ee().setFromMatrixColumn(e,1),i=new Ee().setFromMatrixColumn(e,2),s=(y,M)=>{let S=y*(M<0?-1:1);return Math.abs(S-M)<1e-10?M:S},a=s(o.length(),t.x);if(Math.abs(a)<1e-12)return{rotation:n.clone(),scale:t.clone(),shear:void 0};o.divideScalar(a);let c=o.dot(r);r.addScaledVector(o,-c);let l=s(r.length(),t.y);if(Math.abs(l)<1e-12)return{rotation:n.clone(),scale:t.clone(),shear:void 0};r.divideScalar(l);let p=o.dot(i);i.addScaledVector(o,-p);let m=r.dot(i);i.addScaledVector(r,-m);let u=s(i.length(),t.z);if(Math.abs(u)<1e-12)return{rotation:n.clone(),scale:t.clone(),shear:void 0};i.divideScalar(u);let f=[c/l,p/u,m/u].map(y=>Math.abs(y)<1e-10?0:y);return{rotation:new Co().setFromRotationMatrix(new un().makeBasis(o,r,i)).normalize(),scale:new Ee(a,l,u),shear:f.some(Boolean)?f:void 0}}var ot=e=>e==="baseColor"?"color":e;function fn(e){let t=new Set;return e.traverse(n=>{let o=n;if(o.isMesh)for(let r of Array.isArray(o.material)?o.material:[o.material])r&&t.add(r)}),[...t]}function pn({root:e,controls:t,animations:n,invalidate:o,cameraEnabled:r=()=>!0}){let i=new Map,s=new Map,a=new Map,c=new Set,l=new Map,p=null,m="",u=b=>e()?an(e(),b):null,f=b=>{if(b.kind==="camera"){let R=t();if(!R)return null;let g=Q(R.camera,R);return{position:g.position,target:g.target,fov:g.fov,zoom:g.zoom}}if(b.kind==="clip"){let R=n();return R?.clips.includes(b.clip)?R.getState?.().active.find(g=>g.clip===b.clip)?.time??0:null}let C=u(b.objectId);if(!C)return null;let O=b.property;if(O==="position"||O==="rotation"||O==="scale")return[C[O].x,C[O].y,C[O].z];if(O==="visible")return C.visible;let k=fn(C).find(R=>R[ot(O)]!==void 0),I=k?k[ot(O)]:void 0;return I?.isColor?`#${I.getHexString()}`:typeof I=="number"?I:null},y=b=>{if(!r())return;let C=t();C&&(C.stop(),C.setLookAt(...b.position,...b.target,!1),b.fov!==null&&"fov"in C.camera&&(C.camera.fov=b.fov,C.camera.updateProjectionMatrix()),C.zoomTo(b.zoom,!1),C.update(0))},M=b=>{if(i.has(b))return;b.updateWorldMatrix(!0,!0);let C=b.matrixAutoUpdate?void 0:dn(b.matrix,b.scale,b.quaternion).shear;i.set(b,{position:b.position.toArray(),rotation:[b.rotation.x,b.rotation.y,b.rotation.z],scale:b.scale.toArray(),matrix:b.matrix.clone(),auto:b.matrixAutoUpdate,shear:C});for(let O of ut(b))dt(O)||(mt(O,O.matrixWorld),c.add(O))},S=(b,C)=>{let O=n();O?.stop(b),C&&O&&(O.play(b,{alongside:!0,reverse:C.reverse}),O.setSpeed(C.speed,b),O.seek?.(C.time,b),C.status!=="playing"&&O.pause(b))};return{capture:f,restore:()=>{for(let[b,C]of l)S(b,C);l.clear();for(let[b,C]of i)b.position.fromArray(C.position),b.rotation.set(...C.rotation),b.scale.fromArray(C.scale),b.matrix.copy(C.matrix),b.matrixAutoUpdate=C.auto,b.matrixWorldNeedsUpdate=!0;i.clear(),s.forEach((b,C)=>C.visible=b),s.clear(),a.forEach((b,C)=>{b.forEach((O,k)=>{O instanceof mn?C[k].copy(O):C[k]=O}),C.needsUpdate=!0}),a.clear(),c.forEach(pt),c.clear(),p&&y(p),p=null,m="",e()?.updateWorldMatrix(!0,!0),o()},inspect:b=>b.tracks.filter(C=>!C.muted&&C.keyframes.length&&(C.target.kind!=="camera"||r())&&f(C.target)===null).map(C=>`Unavailable target: ${C.name}.`),invalidate:o,apply:({sequence:b,time:C,playing:O})=>{let k=b.tracks.filter(g=>g.target.kind!=="camera"||r()).map(g=>({track:g,value:at(g,C)})).filter(g=>g.value!==null);for(let[g,d]of l)k.some(({track:h})=>h.target.kind==="clip"&&h.target.clip===g)||(S(g,d),l.delete(g));for(let{track:g}of k)if(g.target.kind==="object"&&["position","rotation","scale"].includes(g.target.property)){let d=u(g.target.objectId);d&&M(d)}let I=new Map([...a.keys()].map(g=>[g,g.transparent]));s.forEach((g,d)=>d.visible=g),i.forEach((g,d)=>{d.position.fromArray(g.position),d.rotation.set(...g.rotation),d.scale.fromArray(g.scale),nt(d,g.shear)}),a.forEach((g,d)=>g.forEach((h,A)=>{h instanceof mn?d[A].copy(h):d[A]=h}));let R=n();for(let{track:g,value:d}of k){if(g.target.kind!=="clip"||!R?.seek||!R.clips.includes(g.target.clip))continue;let h=g.target.clip;l.has(h)||(l.set(h,R.getState?.().active.find(A=>A.clip===h)),R.play(h,{alongside:!0}),R.pause(h)),R.seek(d,h)}for(let{track:g,value:d}of k){let h=g.target;if(h.kind==="clip")continue;if(h.kind==="camera"){p||(p=f(h));let E=JSON.stringify(d);(O||E!==m)&&(y(d),m=E);continue}let A=u(h.objectId);if(!A)continue;let T=h.property;if(T==="visible")s.has(A)||s.set(A,A.visible),A.visible=d;else if(T==="position"||T==="rotation"||T==="scale")T==="rotation"?A.rotation.set(...d):A[T].fromArray(d),nt(A,i.get(A)?.shear);else for(let E of fn(A)){let D=ot(T),V=E[D];if(V===void 0)continue;let F=a.get(E);if(F||(F=new Map,a.set(E,F)),I.has(E)||I.set(E,E.transparent),F.has(D)||F.set(D,V?.isColor?V.clone():V),V?.isColor?V.set(d):E[D]=d,T==="opacity"){F.has("transparent")||F.set("transparent",E.transparent);let j=d<1||F.get("transparent")===!0;E.transparent=j}}}p&&!k.some(({track:g})=>g.target.kind==="camera")&&(y(p),m=""),I.forEach((g,d)=>{g!==d.transparent&&(d.needsUpdate=!0)}),e()?.updateWorldMatrix(!0,!0)}}}function gn(e){let t=new Map;return e.map((n,o)=>{let i=n.name.trim()||`Animation ${o+1}`,s=t.get(i)??0;return t.set(i,s+1),{clip:n,sourceName:s===0?i:`${i} (${s+1})`,duration:n.duration}})}var ue=30,Ro=12e4,hn=new Set(["position","quaternion","rotation","scale"]);function Eo(e){let t=xe(e.sceneConfig?.sequences??[]).find(l=>l.autoPlay),n=e.sceneConfig?.animations.autoplayClip,o=gn(e.scene.animations),r=o.find(l=>l.sourceName===n),i=e.sceneConfig?.animations.clips.find(l=>l.sourceName===n),s=i?.speed??1,a=Number.isFinite(s)&&s>0?s:1,c=r&&!i?.hidden?r.duration*(i?.loopMode==="ping-pong"?2:1)/a:0;return{sequence:t,autoplay:n,clips:o,duration:Math.max(c,t?.duration??0)}}function Sn(e,t,n){let o=new Set,r=new Map,i=0,s=0,a=e.map(Eo),c=Math.max(0,...a.map(l=>l.duration));for(let[l,p]of e.entries()){n?.throwIfAborted();let{sequence:m,autoplay:u}=a[l];if(!m&&!u)continue;let f=vo(p.scene),y=[],M=[];p.scene.traverse(j=>y.push(j)),f.traverse(j=>M.push(j));let S=new Map;y.forEach((j,N)=>{M[N].uuid=j.uuid,S.set(j,M[N])});let x=oe(f),w=new Oo;w.matrixAutoUpdate=!1,w.matrix.copy(p.scene.parent?.matrixWorld??new jo),w.add(f);let b=new Set(m?.tracks.filter(j=>!j.muted&&j.target.kind==="clip").map(j=>j.target.kind==="clip"?j.target.clip:"")??[]);u&&b.add(u);let C=a[l].clips.map(j=>{if(!b.has(j.sourceName))return j;let N=j.clip.tracks.filter(_=>{let L=bn.parseTrackName(_.name),K=bn.findNode(f,L.nodeName),$=!!K&&hn.has(L.propertyName)&&K?.type!=="Bone"&&!L.objectName;return $||o.add("Quick Look exports object motion. Skeletal, morph and other clip tracks keep their captured pose."),$});return{...j,clip:new Mo(j.clip.name,j.duration,N)}}),O=j=>p.sceneConfig?.animations.clips.find(N=>N.sourceName===j),k=ln({root:f,clips:C,getClipConfig:O,onChange(){}}),I={...k,clips:C.map(j=>j.sourceName)},R=pn({root:()=>f,controls:()=>null,animations:()=>I,invalidate(){},cameraEnabled:()=>!1}),g=m?.tracks.filter(j=>{if(j.target.kind==="object"&&x.nodesById[j.target.objectId]?.type==="Bone")return j.muted||o.add("Quick Look keeps skeletal deformation at its captured pose."),!1;let N=j.target.kind==="clip"||j.target.kind==="object"&&hn.has(j.target.property);return!N&&!j.muted&&o.add("Quick Look exports sequence object motion. Camera, visibility and appearance tracks stay in WebXR."),N}),d=m?{...m,tracks:g??[]}:void 0;d&&R.inspect(d).forEach(j=>o.add(j));let h=C.some(j=>b.has(j.sourceName)&&j.clip.tracks.length&&!O(j.sourceName)?.hidden),A=g?.some(j=>!j.muted&&j.keyframes.length&&j.target.kind==="object");if(!h&&!A){k.dispose();continue}let T=c,E=t.filter(j=>j.sourceIndex===l),D=Math.ceil(T*ue);if(s+=(D+1)*E.length,!Number.isFinite(T)||s>Ro)throw k.dispose(),new Error("This animation is too large for browser USDZ conversion. Use arHandoff.createUSDZ for this model.");let V=Object.entries(p.objectBindings??{}).flatMap(([j,N])=>{if(!N.transform)return[];let _=x.nodesById[N.modelObjectId??j];return _?[{node:_,matrix:_.matrix.clone(),position:_.position.clone(),quaternion:_.quaternion.clone(),scale:_.scale.clone()}]:[]}),F=E.map(j=>({target:j,node:S.get(j.source),inverse:j.bakedMatrix.clone().invert(),frames:[]}));try{u&&k.play(u);let j=0;for(let N=0;N<=D;N++){n?.throwIfAborted();let _=Math.min(N/ue,T);k.update(_-j),j=_;for(let L of V)L.node.position.copy(L.position),L.node.quaternion.copy(L.quaternion),L.node.scale.copy(L.scale),L.node.matrix.copy(L.matrix);if(d){let L=d.loop&&_>d.duration?_%d.duration:Math.min(_,d.duration);R.apply({sequence:d,time:L,playing:!1})}w.updateMatrixWorld(!0);for(let L of F){let K=L.node.matrixWorld.clone().multiply(L.target.instanceMatrix).multiply(L.inverse);if(!K.elements.every(Number.isFinite)||K.determinant()<=0)throw new Error("Quick Look animation cannot preserve a reflected or zero-scale transform. Use arHandoff.createUSDZ.");L.frames.push({time:_*ue,matrix:K.toArray()})}}for(let N of F){let _=N.frames[0]?.matrix;_&&N.frames.some(L=>L.matrix.some((K,$)=>Math.abs(K-_[$])>1e-8))&&(r.set(N.target.exported.name,N.frames),i=Math.max(i,T))}}finally{R.restore(),k.dispose()}}return{samples:r,duration:i,warnings:[...o]}}function xn(e,t){if(!t.samples.size)return e;let n=Io(e),o=To(n["model.usda"]);o=o.replace(" metersPerUnit = 1",` startTimeCode = 0
|
|
3
|
+
endTimeCode = ${t.duration*ue}
|
|
4
|
+
timeCodesPerSecond = ${ue}
|
|
5
|
+
framesPerSecond = ${ue}
|
|
6
|
+
metersPerUnit = 1`);for(let[s,a]of t.samples){let c=new RegExp(`(def Xform "${s}"[\\s\\S]*?\\n[\\t ]*)matrix4d xformOp:transform = [^\\n]+`);if(!c.test(o))throw new Error("The USDZ exporter produced an unsupported animation layout.");let l=a.map(p=>{let m=[0,4,8,12].map(u=>`(${p.matrix.slice(u,u+4).join(", ")})`);return`${p.time}: (${m.join(", ")})`}).join(`,
|
|
7
|
+
`);o=o.replace(c,(p,m)=>`${m}matrix4d xformOp:transform.timeSamples = {
|
|
8
|
+
${l}
|
|
9
|
+
}`)}n["model.usda"]=yn(o);let r={},i=0;for(let[s,a]of Object.entries(n)){i+=34+yn(s).length;let c=i&63;r[s]=c===4?a:[a,{extra:{12345:new Uint8Array(64-c)}}],i=a.length}return ko(r,{level:0})}function Lo(e,t={}){t.signal?.throwIfAborted();let n=new An,o=new An;n.add(o);let r=new Set,i=[],s=[],a=[],c=new Map,l=[],p=0,m=0,u=()=>{i.forEach(f=>f.dispose()),s.forEach(f=>f.dispose()),a.forEach(f=>f.dispose())};try{for(let[x,{scene:w,objectBindings:b={},materialOverrides:C={}}]of e.entries()){rn(w),w.updateWorldMatrix(!0,!0);let O=new Map(Object.entries(b).map(([k,I])=>[I.modelObjectId??k,k]));w.traverse(k=>{let I=k;if(!I.isMesh||!I.geometry)return;for(let T=k;T;T=T.parent){let E=he(T)??T.name??T.uuid;if(!T.visible||b[O.get(E)??E]?.visible===!1||b[O.get(E)??E]?.removed)return}let R=he(I)??I.name??I.uuid,g=C[O.get(R)??R]??I.material;if(!g)throw new Error(`Material for ${R} is not ready. Wait for the model to finish loading.`);let d=Array.isArray(g)?g:[g],h=I.isInstancedMesh?I.count:1;if(I.userData.riDecal&&we(I)&&I.parent){let T=ft(I.parent);T&&I.bindMatrixInverse.copy(T)}let A=we(I)?gt(I):I.geometry.clone();try{if(!we(I)&&I.morphTargetInfluences?.some(D=>D!==0)){let D=A.getAttribute("position"),V=new Be;for(let F=0;F<D.count;F++)I.getVertexPosition(F,V),D.setXYZ(F,V.x,V.y,V.z);A.morphAttributes={},A.computeVertexNormals()}if(!A.getAttribute("position"))throw new Error(`Mesh ${R} has no positions.`);let T=A.index?.count??A.getAttribute("position").count,E=Array.isArray(g)?A.groups:[{start:0,count:T,materialIndex:0}];if(!E.length)throw new Error(`Mesh ${R} has multiple materials without geometry groups.`);for(let D=0;D<h;D++){let V=I.matrixWorld.clone(),F=new No;I.isInstancedMesh&&(I.getMatrixAt(D,F),V.multiply(F));for(let j of E){let N=d[j.materialIndex??0];if(!N)throw new Error(`A material group on ${R} is missing its material.`);if(!N.visible)continue;let _=N;if(!_.isMeshStandardMaterial||_.wireframe||_.vertexColors)throw new Error(`AR snapshot cannot preserve ${N.type}${_.wireframe?" wireframe":_.vertexColors?" vertex colors":""} on ${R}. Use a PBR material or provide arHandoff.createUSDZ.`);let L=Math.max(j.start,A.drawRange.start),K=Math.min(T,j.start+j.count,A.drawRange.start+A.drawRange.count);if(K<=L)continue;if(L%3||(K-L)%3)throw new Error(`Mesh ${R} has an incomplete triangle range.`);let $=new Cn;i.push($);let J=Array.from({length:K-L},(B,z)=>A.index?A.index.getX(L+z):L+z);if(V.determinant()<0)for(let B=0;B<J.length;B+=3)[J[B+1],J[B+2]]=[J[B+2],J[B+1]];for(let[B,z]of Object.entries(A.attributes)){let P=new Float32Array(J.length*z.itemSize);for(let U=0;U<J.length;U++)for(let X=0;X<z.itemSize;X++)P[U*z.itemSize+X]=z.getComponent(J[U],X);$.setAttribute(B,new wn(P,z.itemSize))}$.setIndex(J.map((B,z)=>z)),$.applyMatrix4(V);let Se=$.getAttribute("position");for(let B=0;B<Se.count;B++)if(![Se.getX(B),Se.getY(B),Se.getZ(B)].every(Number.isFinite))throw new Error(`Mesh ${R} contains invalid coordinates.`);$.getAttribute("normal")||$.computeVertexNormals();let G=_.clone();s.push(G);let it=_.userData.reactImmersiveConfiguredEmissive;if(it?.isColor&&G.emissive.copy(it),G.side===Vo){let B=$.toNonIndexed();i.push(B);let z=B.getAttribute("position").count,P=new Cn;i.push(P);for(let[U,X]of Object.entries(B.attributes)){let ze=new Float32Array(z*X.itemSize*2);for(let ee=0;ee<z;ee++)for(let ie=0;ie<X.itemSize;ie++){ze[ee*X.itemSize+ie]=X.getComponent(ee,ie);let En=Math.floor(ee/3)*3+(2-ee%3);ze[(z+ee)*X.itemSize+ie]=X.getComponent(En,ie)*(U==="normal"?-1:1)}P.setAttribute(U,new wn(ze,X.itemSize))}G.side=rt,$.copy(P)}else if(G.side!==rt){let B=$.getIndex();for(let P=0;P<B.count;P+=3){let U=B.getX(P+1);B.setX(P+1,B.getX(P+2)),B.setX(P+2,U)}let z=$.getAttribute("normal");for(let P=0;P<z.count;P++)z.setXYZ(P,-z.getX(P),-z.getY(P),-z.getZ(P));G.side=rt}if(I.isInstancedMesh&&I.instanceColor){let B=new Po;I.getColorAt(D,B),G.color.multiply(B)}for(let[B,z]of Object.entries(G)){if(!z?.isTexture)continue;let P=z;if($t(P)||!P.image||P.image.complete===!1)throw new Error(`Texture on ${R} is not ready. Wait for image loading or replace failed textures before preparing AR.`);let U=c.get(P);if(U||(U=P.clone(),c.set(P,U),a.push(U)),G[B]=U,!$.getAttribute(U.channel?`uv${U.channel}`:"uv"))throw new Error(`Texture on ${R} needs UV coordinates missing from this geometry.`)}if(I.userData.riDecal){$.computeBoundingBox();let B=Math.max(1e-6,$.boundingBox.getSize(new Be).length()*1e-4),z=$.getAttribute("position"),P=$.getAttribute("normal");for(let U=0;U<z.count;U++)z.setXYZ(U,z.getX(U)+P.getX(U)*B,z.getY(U)+P.getY(U)*B,z.getZ(U)+P.getZ(U)*B)}let Ne=new zo($,G);Ne.name=`AR_${p++}`,o.add(Ne),l.push({sourceIndex:x,source:I,exported:Ne,bakedMatrix:V.clone(),instanceMatrix:F}),m+=($.index?.count??$.getAttribute("position").count)/3,(G.clearcoat||G.transmission||G.iridescence||G.anisotropy)&&r.add("Advanced PBR effects may look different in Quick Look.")}}}finally{A.dispose()}})}if(!p||!m)throw new Error("There is no visible model geometry to send to AR.");let f=new Bo().setFromObject(o),y=f.getSize(new Be),M=f.getCenter(new Be),S=t.scaleMode==="real-world"?1:1/Math.max(y.x,y.y,y.z,1e-9);return o.position.set(-M.x*S,-f.min.y*S,-M.z*S),o.scale.setScalar(S),n.updateMatrixWorld(!0),r.add("Viewer lighting, background, post-processing, annotations and measurement overlays stay in the web viewer."),{root:n,meshCount:p,triangleCount:m,scale:S,warnings:[...r],textures:a,motionMeshes:l,dispose:u}}catch(f){throw u(),f}}async function fa(e,t={}){let n=t.maxTextureSize??2048;if(!Number.isInteger(n)||n<256||n>4096)throw new Error("AR maxTextureSize must be an integer from 256 to 4096.");let o=Lo(e,t),r=[];try{let i=Sn(e,o.motionMeshes,t.signal),{USDZExporter:s}=await import("three/examples/jsm/exporters/USDZExporter.js");t.signal?.throwIfAborted();for(let l of o.textures){if(!l.isCompressedTexture)continue;let{decompress:p}=await import("three/examples/jsm/utils/WebGLTextureUtils.js"),m=p(l,n);r.push(m),o.root.traverse(u=>{let f=u.material;if(f)for(let y of Object.keys(f))f[y]===l&&(f[y]=m)})}let a=await new s().parseAsync(o.root,{onlyVisible:!0,quickLookCompatible:!0,maxTextureSize:n});t.signal?.throwIfAborted();let c=xn(a,i);return{blob:new Blob([new Uint8Array(c)],{type:"model/vnd.usdz+zip"}),meshCount:o.meshCount,triangleCount:o.triangleCount,scale:o.scale,warnings:[...o.warnings,...i.warnings]}}catch(i){if(t.signal?.aborted)throw i;let s=i instanceof Error&&i.name==="SecurityError"?" Textures must allow cross-origin canvas access.":"";throw new Error(`Could not prepare the configured USDZ: ${i instanceof Error?i.message:"export failed"}${s}`)}finally{o.dispose(),r.forEach(i=>i.dispose())}}var Pe=Object.freeze([{id:"change-color",label:"Change Color",handling:"viewer",description:"Opens a color picker docked under the action and commits the result to style.material.baseColor."},{id:"change-material",label:"Change Material",handling:"viewer",description:"Opens the material picker so the viewer can swap the object's texture."},{id:"add-text",label:"Add Text",handling:"viewer",description:"Opens a text box docked under the action; the viewer's user types, clicks the object to place it, and can resize, turn, move, or remove it. Saved to the binding's decals."},{id:"add-image",label:"Add Image",handling:"viewer",description:"Lets the viewer's user choose an image, click the object to place it, and resize, turn, move, or remove it. Saved to the binding's decals."},{id:"toggle-visibility",label:"Toggle Visibility",handling:"viewer",description:"Flips the binding's visible flag."},{id:"toggle-light",label:"Toggle Light",handling:"viewer",description:"Turns the scene lights attached to this object on or off, or the object's own glow when none is attached."},{id:"change-light-color",label:"Change Light Color",handling:"viewer",description:"Opens a color picker docked under the action for the scene lights attached to this object, or the object's own glow."},{id:"set-brightness",label:"Set Brightness",handling:"viewer",description:"Opens a brightness slider docked under the action for the scene lights attached to this object, or the object's own glow."}]),ga="__custom__";function Do(e){return Pe.find(t=>t.id===e)}var On=Pe.filter(e=>e.handling==="viewer").map(e=>e.id),Uo=new Set(["","New Action",...Pe.map(e=>e.label)]);function ba(e){return Uo.has(e.trim())}function Mn(e,t){let n=Array.from({length:t.length+1},(o,r)=>r);for(let o=1;o<=e.length;o+=1){let r=[o];for(let i=1;i<=t.length;i+=1){let s=n[i-1]+(e[o-1]===t[i-1]?0:1);r[i]=Math.min(r[i-1]+1,n[i]+1,s)}n=r}return n[t.length]}function ya(e){if(Do(e))return null;let t=e.trim().toLowerCase();if(!t)return null;let n=t.replace(/[^a-z0-9]/g,""),o=null;for(let r of Pe){let i=Math.min(Mn(t,r.id),Mn(n,r.id.replace(/[^a-z0-9]/g,"")));(!o||i<o.distance)&&(o={id:r.id,distance:i})}return o&&o.distance<=2?o.id:null}var _o=.12,jn=new Set;function $o(e,t){return t?new Set(Ce(e,t.target)):jn}function xa(e,t){let n=$o(e.bindings,t);if(!t||n.size===0)return{...e,setAside:jn};let o=Math.min(Math.max(t.ghostOpacity??_o,0),1),r={...e.bindings},i=new WeakMap,s=new Set;for(let[a,c]of Object.entries(e.bindings)){if(n.has(a))continue;s.add(a);let l=t.mode==="hide"?{...c,visible:!1}:{...c,style:{...c.style,material:{...c.style?.material,opacity:Math.min(c.style?.material?.opacity??1,o)}}};r[a]=l,i.set(l,e.sourceOf(c))}return{bindings:r,pulses:e.pulses,sourceOf:a=>i.get(a)??e.sourceOf(a),setAside:s}}function Fo(e){return e.trim().replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/[_\s]+/g,"-").replace(/[^a-zA-Z0-9-]/g,"-").replace(/-+/g,"-").replace(/^-|-$/g,"").toLowerCase()}function qo(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1 $2").replace(/[_-]+/g," ").replace(/\s+/g," ").trim().replace(/\b\w/g,t=>t.toUpperCase())}function Wo(e){let t=e.toLowerCase();return t.includes("light")?"light":t.includes("wheel")||t.includes("rim")||t.includes("tire")?"wheel":t.includes("glass")||t.includes("window")||t.includes("windshield")||t.includes("sunroof")?"glass":t.includes("seat")||t.includes("dashboard")||t.includes("console")||t.includes("doorpanel")?"interior":t.includes("floor")?"floor":t.includes("wall")?"wall":t.includes("door")?"door":t.includes("chair")||t.includes("table")||t.includes("sofa")||t.includes("bed")?"furniture":"other"}function vn(e,t=!0){return e==="light"||e.endsWith("light")?[{id:"toggle-light",label:"Toggle Light",type:"command"},{id:"change-light-color",label:"Change Light Color",type:"command"},{id:"set-brightness",label:"Set Brightness",type:"command"}]:[{id:"change-color",label:"Change Color",type:"command"},...t?[{id:"change-material",label:"Change Material",type:"command"}]:[],{id:"toggle-visibility",label:"Toggle Visibility",type:"command"}]}function Tn(e,t=!0){let n=Wo(e);return{id:Fo(e),modelObjectId:e,type:n,label:qo(e),status:"normal",selectable:!0,hoverable:!0,visible:!0,style:{},actions:vn(n,t),metrics:{},metadata:{}}}function Oa(e,t){return Object.fromEntries(e.map(n=>[n,Tn(n,!t?.has(n))]))}function ja(e,t){let n=new Set,o={};for(let r of e){let i=Tn(r,!t?.has(r)),s=i.id||"object",a=s;for(let l=2;n.has(a);l++)a=`${s}-${l}`;n.add(a),i.id=a;let c=(i.actions??[]).filter(l=>On.includes(l.id));i.actions=c.length>0?c:vn("other",!t?.has(r)),o[r]=i}return o}function va(e){let t=new Set;for(let[n,o]of Object.entries(oe(e).nodesById))yt(o)||t.add(n);return t}function Ta(e){let{nodesById:t}=oe(e),n=[];for(let[o,r]of Object.entries(t)){let i=r;i.isMesh&&i.geometry&&r.name&&n.push(o)}return n.sort((o,r)=>o.localeCompare(r))}var Rn={id:"identity",modelObjectId:"identity",label:"identity",type:"identity",group:"identity",tags:"identity",style:"appearance",decals:"appearance",transform:"transform",visible:"visibility",removed:"visibility",status:"visibility",selectable:"behavior",hoverable:"behavior",actions:"behavior",cameraState:"behavior",metadata:"data",metrics:"data"},Go=Object.keys(Rn),Ho=new Set(["__proto__","prototype","constructor"]);function re(e,t=new Set){if(e==null||typeof e=="string"||typeof e=="boolean")return e;if(typeof e=="number"){if(!Number.isFinite(e))throw new Error("Comparison values must be finite JSON data");return e}if(typeof e!="object"||t.has(e))throw new Error("Comparison values must be acyclic JSON data");t.add(e);let n=Array.isArray(e)?e.map(o=>re(o,t)):Object.fromEntries(Object.entries(e).filter(([o,r])=>!Ho.has(o)&&r!==void 0).map(([o,r])=>[o,re(r,t)]));return t.delete(e),n}var In=e=>e&&typeof e=="object"&&!Array.isArray(e)&&!Object.keys(e).length;function kn(e,t){let n=re(e);n.visible=e.visible??!0,n.selectable=e.selectable??!0,n.hoverable=e.hoverable??!0,n.status=e.status??"normal",n.type=e.type??"other",n.tags=[...new Set(e.tags??[])].sort(),In(n.transform)&&delete n.transform,n.metadata=Object.fromEntries(Object.entries(e.metadata??{}).filter(([o])=>!t.includes(o)));for(let o of["metrics","style","metadata"])In(n[o])&&delete n[o];for(let o of["actions","decals"])Array.isArray(n[o])&&!n[o].length&&delete n[o];return n}function Ve(e,t,n,o,r,i){let s=c=>c===void 0||Array.isArray(c)&&c.length===0;if(Object.is(e,t)||s(e)&&s(t)||typeof e=="number"&&typeof t=="number"&&Math.abs(e-t)<=r)return;let a=c=>!!c&&typeof c=="object"&&!Array.isArray(c);if(a(e)&&a(t)){for(let c of[...new Set([...Object.keys(e),...Object.keys(t)])].sort())Ve(e[c],t[c],`${n}.${c}`,o,r,i);return}if(Array.isArray(e)&&Array.isArray(t)&&e.length===t.length){for(let c=0;c<e.length;c++)Ve(e[c],t[c],`${n}[${c}]`,o,r,i);return}i.push({path:n,category:o,...e!==void 0?{before:re(e)}:{},...t!==void 0?{after:re(t)}:{}})}function ka(e,t,n={}){let o=n.tolerance??1e-6;if(!Number.isFinite(o)||o<0)throw new Error("Comparison tolerance must be finite and nonnegative");let r=Object.entries(e.objectBindings).filter(([,x])=>!x.removed),i=Object.entries(t.objectBindings).filter(([,x])=>!x.removed),s=new Map(r),a=new Map(i),c=new Set,l=new Set,p=[],m=x=>{let w=n.matchBy??"modelObjectId",b=typeof w=="object"?x.metadata?.[w.metadataKey]:x[w];return typeof b=="string"&&b.length>0||typeof b=="number"?`${typeof b}:${b}`:null};function u(x,w,b){let C=x===void 0?void 0:s.get(x),O=w===void 0?void 0:a.get(w),k=[];if(C||O){let R=C?kn(C,n.ignoreMetadataKeys??[]):{},g=O?kn(O,n.ignoreMetadataKeys??[]):{};for(let d of Go)Ve(R[d],g[d],d,Rn[d],o,k)}let I=C?O?k.length?"modified":"unchanged":"removed":"added";p.push({id:JSON.stringify([x??null,w??null]),identity:b,label:O?.label??C?.label??O?.modelObjectId??C?.modelObjectId??b,status:I,beforeKey:x,afterKey:w,beforeObjectId:C?.modelObjectId,afterObjectId:O?.modelObjectId,changes:k}),x!==void 0&&c.add(x),w!==void 0&&l.add(w)}let f=new Set;for(let[x,w]of Object.entries(n.mapping??{})){if(!s.has(x)||!a.has(w)||f.has(w))throw new Error("Comparison mapping must reference existing, unique binding keys");f.add(w),u(x,w,`mapped:${x}`)}let y=new Map;for(let[x,w,b]of[[r,c,"a"],[i,l,"b"]])for(let[C,O]of x){if(w.has(C))continue;let k=m(O);if(k===null){p.push({id:JSON.stringify([b,C]),identity:"",label:O.label??O.modelObjectId,status:"ambiguous",...b==="a"?{beforeKey:C,beforeObjectId:O.modelObjectId}:{afterKey:C,afterObjectId:O.modelObjectId},changes:[],message:"Missing match identity. Supply an explicit mapping or another match field."});continue}let I=y.get(k)??{a:[],b:[]};I[b].push(C),y.set(k,I)}for(let[x,w]of y){if(w.a.length<=1&&w.b.length<=1){u(w.a[0],w.b[0],x);continue}for(let b of["a","b"])for(let C of w[b]){let O=(b==="a"?s:a).get(C);p.push({id:JSON.stringify([b,C]),identity:x,label:O.label??O.modelObjectId,status:"ambiguous",...b==="a"?{beforeKey:C,beforeObjectId:O.modelObjectId}:{afterKey:C,afterObjectId:O.modelObjectId},changes:[],message:"Duplicate match identity. Supply an explicit one-to-one mapping."})}}p.sort((x,w)=>x.label.localeCompare(w.label)||x.id.localeCompare(w.id));let M=[];Ve(re(e.sceneConfig??{}),re(t.sceneConfig??{}),"sceneConfig","scene",o,M);let S={added:0,removed:0,modified:0,unchanged:0,ambiguous:0};for(let x of p)S[x.status]++;return{version:1,objects:p,counts:S,sceneChanges:M}}function Ra(e,t,n){let o={added:"#22c55e",removed:"#f87171",modified:"#fbbf24",unchanged:"#94a3b8",ambiguous:"#c084fc"};return e.objects.flatMap(r=>{let i=t==="before"?r.beforeObjectId:r.afterObjectId;return i&&(r.status!=="unchanged"||r.id===n)?[{objectId:i,color:r.id===n?"#22d3ee":o[r.status]}]:[]})}var Ba=["front","back","double"],Pa=["normal","additive"];function za(e){oe(e);let t=[],n=[{node:e,path:"0",parentId:null}];for(;n.length;){let{node:r,path:i,parentId:s}=n.pop(),a=`node:${i}`,c=r.isMesh&&r.name?he(r):null;t.push({id:a,parentId:s,name:r.name||r.type||"Group",...c?{objectId:c}:{}});for(let l=r.children.length-1;l>=0;l--)n.push({node:r.children[l],path:`${i}/${l}`,parentId:a})}let o=new Set;for(let r=t.length-1;r>=0;r--){let i=t[r];(i.objectId||o.has(i.id))&&(o.add(i.id),i.parentId&&o.add(i.parentId))}return t.filter(r=>o.has(r.id))}function Ua(e){return structuredClone(e.style??{})}function _a(e,t,n){let o=Ce(e,t).filter(i=>!e[i].removed);if(!o.length)return e;let r={...e};for(let i of o)r[i]={...e[i],style:structuredClone(n)};return r}export{oe as a,he as b,ki as c,Ri as d,an as e,Ko as f,Yo as g,St as h,er as i,Ct as j,Q as k,dr as l,Ao as m,nt as n,dn as o,pn as p,Xe as q,Hr as r,Kr as s,Xr as t,Yr as u,Te as v,Zr as w,Jr as x,ro as y,Qr as z,ei as A,ti as B,ni as C,oi as D,ri as E,ii as F,fr as G,pr as H,gr as I,br as J,yr as K,hr as L,Sr as M,_e as N,ce as O,me as P,Cr as Q,Ar as R,Mr as S,vr as T,$e as U,fe as V,Tr as W,Ir as X,kr as Y,Rr as Z,kt as _,Rt as $,Et as aa,qe as ba,Pr as ca,Vr as da,Nr as ea,zr as fa,Zn as ga,Ge as ha,Qn as ia,Ur as ja,_r as ka,Nt as la,eo as ma,pe as na,$r as oa,Fr as pa,zt as qa,ne as ra,gi as sa,Ie as ta,Yt as ua,wi as va,Ci as wa,bo as xa,Ai as ya,Mi as za,Oi as Aa,vi as Ba,rn as Ca,ln as Da,gn as Ea,fa as Fa,Pe as Ga,ga as Ha,Do as Ia,On as Ja,ba as Ka,ya as La,$o as Ma,xa as Na,Wo as Oa,Tn as Pa,Oa as Qa,ja as Ra,va as Sa,Ta,ka as Ua,Ra as Va,Ba as Wa,Pa as Xa,za as Ya,Ua as Za,_a};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as o}from"./chunk-
|
|
1
|
+
import{b as o}from"./chunk-5XII5XCD.mjs";import{useSyncExternalStore as m}from"react";import{Pause as q,Play as S,Square as b}from"lucide-react";import{jsx as a,jsxs as l}from"react/jsx-runtime";var y={sequenceId:null,time:0,duration:0,status:"stopped",previewing:!1,ready:!1,issues:[]},c=()=>y,g=()=>()=>{};function p(t){return m(t?.subscribe??g,t?.getState??c,c)}function P({controls:t,duration:n,showScrubber:i=!0,hasTracks:s=!0}){let e=o(),u=p(t),r=u.status==="playing";return l("div",{className:"ri-sequenceTransport",children:[a("button",{type:"button",onClick:()=>r?t?.pause():t?.play(),disabled:!u.ready||!n||!s,"aria-label":e(r?"sequencePause":"sequencePlay"),title:e(r?"sequencePause":"sequencePlay"),children:a("span",{"aria-hidden":"true",children:r?a(q,{size:15}):a(S,{size:15})})}),a("button",{type:"button",onClick:()=>t?.stop(),disabled:!u.previewing,"aria-label":e("sequenceStop"),title:e("sequenceStop"),children:a(b,{size:14,"aria-hidden":"true"})}),i&&a("input",{"aria-label":e("sequencePlayhead"),type:"range",min:0,max:n||1,step:.01,value:Math.min(u.time,n),disabled:!u.ready||!n,onChange:d=>{t?.pause(),t?.seek(Number(d.target.value))}}),l("output",{"aria-label":e("sequenceTime"),children:[u.time.toFixed(2)," / ",n.toFixed(2),"s"]})]})}function v({controls:t,sequences:n}){let i=o(),s=p(t);return n.length?l("section",{className:"ri-sequencePlayer","aria-label":i("sequencePlayer"),onPointerDown:e=>e.stopPropagation(),children:[a("select",{"aria-label":i("sequenceSelect"),value:s.sequenceId??"",onChange:e=>t.select(e.target.value),children:n.map(e=>a("option",{value:e.id,children:e.name},e.id))}),a(P,{controls:t,duration:s.duration,hasTracks:n.find(e=>e.id===s.sequenceId)?.tracks.some(e=>!e.muted&&e.keyframes.length>0)??!1}),!!s.issues.length&&l("details",{children:[a("summary",{children:i("sequenceIssues")}),s.issues.map(e=>a("p",{children:e},e))]})]}):null}export{p as a,P as b,v as c};
|