@liveroom-tech/react-immersive 6.1.2 → 6.1.3
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-JTIVIZJD.mjs → SequencesTab-66VBWTO5.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 +75 -34
- package/dist/binding-builder.mjs +1 -1
- package/dist/{chunk-DS5XNP7A.mjs → chunk-4RYMXBK6.mjs} +1 -1
- package/dist/chunk-5P7ETEAN.mjs +50 -0
- package/dist/{chunk-W7M2YD65.mjs → chunk-B75URXOE.mjs} +1 -1
- package/dist/chunk-EC542N4J.mjs +1 -0
- package/dist/{chunk-XBVAZFXW.mjs → chunk-JK7GRGRG.mjs} +1 -1
- package/dist/{chunk-5XII5XCD.mjs → chunk-LKKH4PO7.mjs} +1 -1
- package/dist/{chunk-35UERL2D.mjs → chunk-U3BQMOC3.mjs} +19 -19
- package/dist/{chunk-WJIICFV4.mjs → chunk-VMYNX63T.mjs} +2 -2
- package/dist/hosted.css +1 -1
- package/dist/hosted.d.mts +3 -3
- package/dist/hosted.d.ts +3 -3
- package/dist/hosted.js +74 -33
- 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 +72 -31
- package/dist/index.mjs +1 -1
- package/dist/{modelFileResolver-pPzMl63D.d.mts → modelFileResolver-B2B3F3d1.d.mts} +1 -0
- package/dist/{modelFileResolver-pPzMl63D.d.ts → modelFileResolver-B2B3F3d1.d.ts} +1 -0
- package/dist/{modelViewerProps-07WgBVqm.d.ts → modelViewerProps-Bo48RDq6.d.ts} +1 -1
- package/dist/{modelViewerProps-CGgtm4Zb.d.mts → modelViewerProps-DkvYb1GH.d.mts} +1 -1
- package/dist/{publicProps-CEt3hxQU.d.ts → publicProps-DJSccx3b.d.ts} +1 -1
- package/dist/{publicProps-BylAVwPu.d.mts → publicProps-DN0-8tBm.d.mts} +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 +50 -9
- package/dist/utils.mjs +1 -1
- package/package.json +1 -1
- package/dist/chunk-M4LVNNVP.mjs +0 -1
- package/dist/chunk-Q4QPI5GG.mjs +0 -9
package/dist/binding-builder.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{a as o,b as t,c as a}from"./chunk-
|
|
1
|
+
"use client";import{a as o,b as t,c as a}from"./chunk-JK7GRGRG.mjs";import{a as d}from"./chunk-MMO7KCYU.mjs";import{c as f}from"./chunk-VMYNX63T.mjs";import"./chunk-E24EFHB5.mjs";import"./chunk-FXV4CLAK.mjs";import"./chunk-AL6UIGWP.mjs";import"./chunk-U3BQMOC3.mjs";import"./chunk-B75URXOE.mjs";import"./chunk-FGAJ2UT7.mjs";import"./chunk-4RYMXBK6.mjs";import"./chunk-LKKH4PO7.mjs";import"./chunk-37YITTIK.mjs";import{va as i,wa as r}from"./chunk-5P7ETEAN.mjs";import"./chunk-CCBFMNAU.mjs";import"./chunk-7OWHW66D.mjs";import"./chunk-LX3GXQNU.mjs";import"./chunk-7JCFNZJM.mjs";import"./chunk-GV4ZRXL6.mjs";import"./chunk-6Q6YZ7O5.mjs";import"./chunk-EC542N4J.mjs";import"./chunk-BNKTI3CY.mjs";import"./chunk-JR557W27.mjs";import{useEffect as h,useState as m}from"react";import{jsx as l}from"react/jsx-runtime";function c(e){d("binding-builder","BindingBuilder");let[s,u]=m(!1);return h(()=>{let n=()=>u(e.arHandoff!==!1&&i(e.arHandoff)?.autoRestore!==!1&&r(window.location.href));return n(),window.addEventListener("hashchange",n),()=>window.removeEventListener("hashchange",n)},[e.arHandoff]),s?l(a,{modelUrl:"",licenseKey:e.licenseKey,enableXR:!0,arHandoff:e.arHandoff??!0,mobileHandoffUrl:e.mobileHandoffUrl,dracoDecoderPath:e.dracoDecoderPath,ktx2TranscoderPath:e.ktx2TranscoderPath,meshopt:e.meshopt,hideLicenseCheckingOverlay:e.hideLicenseCheckingOverlay}):l(f,{...t(e,o)})}export{c as BindingBuilder};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{b as oe}from"./chunk-
|
|
1
|
+
import{b as oe}from"./chunk-LKKH4PO7.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);
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import{f as yt,h as St}from"./chunk-7OWHW66D.mjs";import{e as Ce,f as bt}from"./chunk-LX3GXQNU.mjs";import{p as jt}from"./chunk-7JCFNZJM.mjs";import{a as ht,b as ve}from"./chunk-GV4ZRXL6.mjs";import{a as ge,b as xt,c as wt,d as je,e as ke,f as At,g as Mt,h as Ct,j as kt,x as Oe,z as vt}from"./chunk-6Q6YZ7O5.mjs";import{useCallback as X,useRef as ue,useState as Et}from"react";import{Vector3 as Bt}from"three";var Fe=new WeakSet;function le(e){Fe.add(e)}function gr(e){let t=Fe.has(e);return t&&Fe.delete(e),t}var We=new WeakSet;function hr(e,t){t?We.add(e):We.delete(e)}function Ot(e,t){return We.has(e)?0:t}import{Box3 as Tt,Matrix4 as Hn,PerspectiveCamera as It,Vector3 as qe}from"three";function wr(e,t){let n=yt(e);if(!(e.camera instanceof It)||!t)return n;let o=t instanceof Tt?t:new Tt().setFromObject(t);return o.isEmpty()||(n.framing={aspect:e.camera.aspect,min:o.min.toArray(),max:o.max.toArray()}),n}function Rt(e,t){let n=t.camera,o=e.framing;if(!(n instanceof It)||!o||!(n.aspect>0)||Math.abs(n.aspect-o.aspect)<1e-6)return[...e.position];let r=new qe(...e.position),i=new qe(...e.target),a=r.clone().sub(i).normalize(),s=new Hn().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 d of[o.min[0],o.max[0]])for(let f of[o.min[1],o.max[1]])for(let u of[o.min[2],o.max[2]]){let p=new qe(d,f,u).sub(r).applyMatrix4(s);l=Math.max(l,Math.abs(p.x)/(c*n.aspect)+p.z,Math.abs(p.y)/c+p.z)}return r.addScaledVector(a,l*1.02).toArray()}function Pt(e){return[e.x,e.y,e.z]}function te(e,t){let n=new Bt,o=new Bt;return t.getPosition(n),t.getTarget(o),{position:Pt(n),target:Pt(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 Xn(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 be(e,t,n=.6){let o=e.smoothTime;e.smoothTime=Ot(e,n);try{return await t()}finally{e.smoothTime=o}}function Er(e={}){let t=ue(e);t.current=e;let n=ue(null),[o,r]=Et(null),[i,a]=Et(()=>({...e.presets})),s=ue(i);s.current=i;let c=X(g=>{r(m=>Xn(m,g)?m:g)},[]),l=X(g=>{c(g)},[c]),d=ue(null),f=ue(null),u=ue(null),p=X(g=>{n.current=g;let m=te(g.raw.controls.camera,g.raw.controls);c(m),g.raw.scene!==f.current&&(f.current=g.raw.scene,d.current=null,u.current=null),g.homeCameraState&&!d.current&&(d.current=g.homeCameraState);let{initialPosition:b,initialTarget:x,initialTransition:k=!1}=t.current;if((b||x)&&g.raw.scene&&(b||g.homeCameraState)&&u.current!==g.raw.controls){u.current=g.raw.controls,g.homeCameraState||le(g.raw.controls);let R=b??m.position,N=x??m.target;g.raw.controls.setLookAt(R[0],R[1],R[2],N[0],N[1],N[2],k).then(()=>{if(n.current?.raw.controls!==g.raw.controls)return;let E=te(g.raw.controls.camera,g.raw.controls);d.current={position:E.position,target:E.target},c(E)}).catch(()=>{})}},[c]),h=X(async()=>{let g=n.current,m=g?.raw.controls;if(!m)return!1;try{let b=d.current;if(b){St(m,b);let x=Rt(b,m);await be(m,()=>m.setLookAt(x[0],x[1],x[2],b.target[0],b.target[1],b.target[2],!0))}else g?.raw.scene?await be(m,()=>m.fitToBox(g.raw.scene,!0,{paddingTop:.5,paddingBottom:.5,paddingLeft:.5,paddingRight:.5})):await be(m,()=>m.reset(!0));return!0}catch{return!1}},[]),C=X(async()=>{let g=n.current;if(!g?.raw.controls||!g.raw.scene)return!1;try{return await be(g.raw.controls,()=>g.raw.controls.fitToBox(g.raw.scene,!0,{paddingTop:.5,paddingBottom:.5,paddingLeft:.5,paddingRight:.5})),!0}catch{return!1}},[]),S=X(async g=>{let m=n.current;if(!m?.raw.controls)return!1;let b=ht(m.objectBindings,g);if(!b)return!1;let x=m.raw.nodes[b];if(!x)return!1;try{return await be(m.raw.controls,()=>m.raw.controls.fitToBox(x,!0,{paddingTop:.5,paddingBottom:.5,paddingLeft:.5,paddingRight:.5})),!0}catch{return!1}},[]),w=X(async(g,m=!0)=>{let b=n.current?.raw.controls;if(!b)return!1;try{return n.current?.homeCameraState||le(b),await b.setTarget(g[0],g[1],g[2],m),c(te(b.camera,b)),!0}catch{return!1}},[c]),A=X(async(g,m=!0)=>{let b=n.current?.raw.controls;if(!b)return!1;try{n.current?.homeCameraState||le(b);let x=[b.setLookAt(g.position[0],g.position[1],g.position[2],g.target[0],g.target[1],g.target[2],m)];g.azimuthAngle!=null&&g.polarAngle!=null&&x.push(b.rotateTo(g.azimuthAngle,g.polarAngle,m)),await Promise.all(x);let k=b.camera,R=!1;return g.fov!=null&&"fov"in k&&typeof k.fov=="number"&&(k.fov=g.fov,R=!0),g.zoom!=null&&"zoom"in k&&typeof k.zoom=="number"&&(k.zoom=g.zoom,R=!0),R&&"updateProjectionMatrix"in k&&k.updateProjectionMatrix(),c(te(k,b)),!0}catch{return!1}},[c]),y=X((g,m=!0)=>A(g,m),[A]),M=X((g,m,b=!0)=>A({position:g,target:m},b),[A]),j=X(async(g,m,b=!0)=>{let x=n.current?.raw.controls;if(!x)return!1;try{return n.current?.homeCameraState||le(x),await x.rotateTo(g*Math.PI/180,m*Math.PI/180,b),c(te(x.camera,x)),!0}catch{return!1}},[c]),I=X(async(g,m=!0)=>{let b=n.current?.raw.controls;if(!b)return!1;try{return n.current?.homeCameraState||le(b),await b.dollyTo(g,m),c(te(b.camera,b)),!0}catch{return!1}},[c]),T=X(g=>{let m=n.current?.raw.controls,b=g.trim();if(!m||!b)return null;let x=te(m.camera,m);return s.current={...s.current,[b]:x},a(k=>({...k,[b]:x})),c(x),x},[c]),B=X((g,m=!0)=>{let b=s.current[g];return b?A(b,m):Promise.resolve(!1)},[A]);return{cameraState:o,cameraPresets:i,resetView:h,focusObject:S,fitScene:C,setCameraTarget:w,setCameraState:y,lookAt:M,orbitTo:j,dollyTo:I,savePreset:T,goToPreset:B,handleCameraChange:l,handleViewerReady:p}}function Pr(e){let t=e.trim();return t?/\.(hdr|exr|jpg|jpeg|png|webp)(?:[?#].*)?$/i.test(t):!1}var Vr=["none","directional","point","spot","hemisphere"],Nr=["pbr","matcap","uv-checker"],zr=["apartment","city","dawn","forest","lobby","night","park","studio","sunset","warehouse"];var Dr=["sporadic","constantMild","constantWild"],$r=["linear","radial","mirroredLinear"],Lr=["verySmall","small","medium","large","veryLarge","huge"];var Ge={enabled:!1,axis:"y",position:.5,flip:!1},Kn={clips:[],autoplayClip:null},Yn={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}},de={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:Yn,animations:Kn,annotations:[]};function he(e){let t=d=>{throw new Error(`Invalid section: ${d}`)},n=d=>d&&typeof d=="object"&&!Array.isArray(d)?d:t("expected an object"),o=d=>typeof d=="string"&&d.trim().length>0&&d.length<=200?d:t("expected a nonempty name or id (up to 200 characters)"),r=d=>typeof d=="number"&&Number.isFinite(d)&&d>=0&&d<=1?d:t("position must be between 0 and 1"),i=d=>!Array.isArray(d)||d.length!==3||!d.every(f=>typeof f=="number"&&Number.isFinite(f))||Math.hypot(...d)<1e-8?t("normal must be a finite, nonzero vector"):[...d],a=d=>{let f=n(d);return!["x","y","z"].includes(f.axis)||typeof f.enabled!="boolean"||typeof f.flip!="boolean"?t("invalid plane"):{enabled:f.enabled,axis:f.axis,position:r(f.position),flip:f.flip,...f.normal!==void 0?{normal:i(f.normal)}:{}}},s=d=>{let f=n(d),u=a(f);if(f.mode!==void 0){if(!["plane","planes","box"].includes(f.mode))return t("invalid mode");u.mode=f.mode}if(f.planes!==void 0){if(!Array.isArray(f.planes)||f.planes.length>6)return t("at most six planes are supported");let p=new Set;u.planes=f.planes.map(h=>{let C=n(h),S=o(C.id);return p.has(S)?t("duplicate plane id"):(p.add(S),{...a(C),id:S,name:o(C.name)})})}if(f.activePlaneId!==void 0&&(u.activePlaneId=o(f.activePlaneId)),f.invertBox!==void 0){if(typeof f.invertBox!="boolean")return t("invalid box inversion");u.invertBox=f.invertBox}if(f.box!==void 0){let p=n(f.box),h=w=>!Array.isArray(w)||w.length!==3?t("invalid box bounds"):w.map(r),C=h(p.min),S=h(p.max);if(C.some((w,A)=>w>=S[A]))return t("box minimum must be below its maximum on every axis");u.box={min:C,max:S}}return u},c=n(e),l=s(c);if(c.presets!==void 0){if(!Array.isArray(c.presets)||c.presets.length>32)return t("at most 32 presets are supported");let d=new Set;l.presets=c.presets.map(f=>{let u=n(f),p=o(u.id);return d.has(p)?t("duplicate preset id"):(d.add(p),{id:p,name:o(u.name),settings:s(u.settings)})})}return l}function Fr(e){let{presets:t,...n}=he(e);return n}function Wr(e){try{return he(e)}catch{return Ge}}function qr(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 he(n?t:{...Ge,...e,...t})}import{Box3 as Vt,Matrix4 as Ie,Quaternion as Zn,Vector3 as Te,Euler as Jn}from"three";var Xr={version:1,placements:{},gridSize:1};function He(e){return e.id??e.url}function ye(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 Kr(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=ye(r);if(r.label!==void 0&&(typeof r.label!="string"||r.label.length>512))throw new Error("Invalid asset label.");for(let a of["visible","deleted"])if(r[a]!==void 0&&typeof r[a]!="boolean")throw new Error(`Invalid asset ${a}.`);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 Yr(e,t){if(!Number.isFinite(t)||t<=0)throw new Error("Grid size must be positive.");let n=ye(e),[o,r,i]=n.position??[0,0,0];return{...n,position:[Math.round(o/t)*t,r,Math.round(i/t)*t]}}function Zr(e,t){let n=ye(e),o=n.position??[0,0,0],r=new Ie().compose(new Te(...o),new Zn().setFromEuler(new Jn(...n.rotation??[0,0,0])),new Te(...n.scale??[1,1,1])),i=new Vt(new Te(...t.min),new Te(...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 Jr(e){e.updateWorldMatrix(!0,!0);let t=new Ie().copy(e.parent?.parent?.matrixWorld??new Ie).invert(),n=new Vt;return e.traverse(o=>{let r=o;r.geometry&&(r.geometry.computeBoundingBox(),r.geometry.boundingBox&&n.union(r.geometry.boundingBox.clone().applyMatrix4(new Ie().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 Qn,Float32BufferAttribute as eo,Matrix4 as zt,Mesh as Xe,ShapeUtils as to,Vector2 as Dt,Vector3 as W,Vector4 as no}from"three";function $t(e){if(e.length!==3)return null;let t=new W(...e[0]).sub(new W(...e[1])),n=new W(...e[2]).sub(new W(...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 Lt(e,t){if(!e.normal)return null;let n=new W(...e.normal);if(n.lengthSq()===0)return null;n.normalize();let o=new W(...t),r=o.clone().sub(new W(...e.position)).dot(n);return{distance:Math.abs(r),projection:o.addScaledVector(n,-r).toArray()}}function Ut(e){if(e.length<3)return{error:"Pick at least three points to finish the area."};let t=new W(...e[0]),n=e.map(S=>new W(...S).sub(t)),o=Math.max(...n.map(S=>S.length()));if(o===0)return{error:"Area points must be distinct."};let r=new W;for(let S=1;S<n.length-1;S+=1){let w=n[S].clone().cross(n[S+1]);w.lengthSq()>r.lengthSq()&&r.copy(w)}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 a=n.find(S=>S.length()>o*1e-10).clone().normalize(),s=r.clone().cross(a).normalize(),c=n.map(S=>new Dt(S.dot(a),S.dot(s))),l=(S,w,A)=>(w.x-S.x)*(A.y-S.y)-(w.y-S.y)*(A.x-S.x),d=o*o*1e-10,f=(S,w,A)=>Math.abs(l(S,w,A))<=d&&A.x>=Math.min(S.x,w.x)-o*1e-10&&A.x<=Math.max(S.x,w.x)+o*1e-10&&A.y>=Math.min(S.y,w.y)-o*1e-10&&A.y<=Math.max(S.y,w.y)+o*1e-10;for(let S=0;S<c.length;S+=1){let w=c[S],A=c[(S+1)%c.length];if(w.distanceTo(A)<=o*1e-10)return{error:"Area points must be distinct."};for(let y=S+1;y<c.length;y+=1){if(y===S+1||S===0&&y===c.length-1)continue;let M=c[y],j=c[(y+1)%c.length],I=l(w,A,M),T=l(w,A,j),B=l(M,j,w),g=l(M,j,A);if(I*T<0&&B*g<0||f(w,A,M)||f(w,A,j)||f(M,j,w)||f(M,j,A))return{error:"Area edges must not cross or touch each other."}}}let u=0,p=0,h=0;for(let S=0;S<c.length;S+=1){let w=c[S],A=c[(S+1)%c.length],y=w.x*A.y-A.x*w.y;u+=y,p+=(w.x+A.x)*y,h+=(w.y+A.y)*y}if(Math.abs(u)<=d)return{error:"The polygon has no measurable area."};let C=t.clone().addScaledVector(a,p/(3*u)).addScaledVector(s,h/(3*u));return{area:Math.abs(u)/2,center:C.toArray(),triangles:to.triangulateShape(c,[])}}function Ke(e,t){if(e.length<2)return 0;let n=0;for(let o=1;o<e.length;o+=1)n+=new W(...e[o]).distanceTo(new W(...e[o-1]));return t&&(n+=new W(...e[e.length-1]).distanceTo(new W(...e[0]))),n}var oo=1e-5;function ro(e,t){let n=e.getAttribute("position"),o=e.getIndex(),r=n.count,i=Math.max(t,1e-9),a=(h,C,S)=>`${Math.round(h/i)}_${Math.round(C/i)}_${Math.round(S/i)}`,s=new Int32Array(r),c=[],l=new Map;for(let h=0;h<r;h+=1){let C=n.getX(h),S=n.getY(h),w=n.getZ(h),A=a(C,S,w),y=l.get(A);y===void 0&&(y=c.length,c.push(new W(C,S,w)),l.set(A,y)),s[h]=y}let d=c.map(()=>new Map),f=(h,C)=>{if(h===C)return;let S=c[h].distanceTo(c[C]);d[h].has(C)||d[h].set(C,S),d[C].has(h)||d[C].set(h,S)},u=(o?o.count:r)/3,p=h=>o?o.getX(h):h;for(let h=0;h<u;h+=1)f(s[p(h*3)],s[p(h*3+1)]),f(s[p(h*3+1)],s[p(h*3+2)]),f(s[p(h*3+2)],s[p(h*3)]);return{weldedId:s,weldedPosition:c,neighbors:d}}function io(e,t,n){let o=new Map([[t,0]]),r=[t];for(let i=0;i<n&&r.length>0;i+=1){let a=[];for(let s of r){let c=o.get(s)??0;for(let[l,d]of e[s]??[])o.has(l)||(o.set(l,c+d),a.push(l))}r=a}return o}function so(e){let n=(Math.abs(e.y)<.9?new W(0,1,0):new W(1,0,0)).clone().cross(e).normalize(),o=e.clone().cross(n).normalize();return[n,o]}function ao(e,t,n){let[o,r]=so(t),i=0,a=0,s=0;for(let C of n){let S=C.clone().sub(e),w=S.dot(o),A=S.dot(r);i+=w*w,a+=w*A,s+=A*A}let c=i+s,l=i*s-a*a,d=Math.sqrt(Math.max(0,c*c/4-l)),f=c/2+d,u=1,p=0;Math.abs(a)>1e-12?(u=f-s,p=a):s>i&&(u=0,p=1);let h=Math.hypot(u,p)||1;return o.clone().multiplyScalar(u/h).add(r.clone().multiplyScalar(p/h)).normalize()}function co(e,t,n,o){let r=e.getAttribute("position"),i=e.getIndex(),a=r.count,s=(i?i.count:a)/3,c=u=>i?i.getX(u):u,l=u=>new W(r.getX(u),r.getY(u),r.getZ(u)).applyMatrix4(t),d=u=>u.clone().sub(n).dot(o),f=[];for(let u=0;u<s;u+=1){let p=l(c(u*3)),h=l(c(u*3+1)),C=l(c(u*3+2)),S=d(p),w=d(h),A=d(C),y=[],M=(j,I,T,B)=>{I>0!=B>0&&y.push(j.clone().lerp(T,I/(I-B)))};M(p,S,h,w),M(h,w,C,A),M(C,A,p,S),y.length===2&&f.push([y[0],y[1]])}return f}function lo(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=[],a=u=>{let p=o(u),h=r.get(p);return h===void 0&&(h=i.length,i.push(u),r.set(p,h)),h},s=[],c=u=>{for(;s.length<=u;)s.push(new Map)};for(let[u,p]of e){let h=a(u),C=a(p);h!==C&&(c(h),c(C),s[h].set(C,(s[h].get(C)??0)+1),s[C].set(h,(s[C].get(h)??0)+1))}let l=(u,p)=>u<p?`${u}_${p}`:`${p}_${u}`,d=new Set,f=[];for(let u=0;u<s.length;u+=1)for(let p of s[u]?.keys()??[]){if(d.has(l(u,p)))continue;let h=[u],C=u,S=p;d.add(l(C,S));let w=0;for(;S!==u&&S>=0&&w<s.length+4;){h.push(S);let A=[...s[S].keys()].filter(M=>M!==C),y;if(A.length<=1)y=A[0];else{let M=i[S].clone().sub(i[C]).normalize(),j=-1/0;for(let I of A){let T=i[I].clone().sub(i[S]).normalize(),B=M.dot(T);B>j&&(j=B,y=I)}}if(y===void 0){S=-1;break}d.add(l(S,y)),C=S,S=y,w+=1}S===u&&h.length>=3&&f.push(h.map(A=>i[A]))}return f}function Nt(e,t){let n=1/0;for(let o of e)n=Math.min(n,o.distanceTo(t));return n}function uo(e,t){let n=0,o=1/0;return e.forEach((r,i)=>{let a=r.distanceTo(t);a<o&&(o=a,n=i)}),[...e.slice(n),...e.slice(0,n)]}function _t(e,t,n,o,r){let i=co(e,t,o,r);if(i.length===0)return{error:"Couldn't trace a loop around this point."};let a=lo(i,n*t.getMaxScaleOnAxis());if(a.length===0)return{error:"The surface here doesn't form a closed loop around this point (it may be near an open edge)."};let s=a[0],c=Nt(s,o);for(let d of a.slice(1)){let f=Nt(d,o);f<c&&(c=f,s=d)}let l=uo(s,o).map(d=>d.toArray());return{points:l,length:Ke(l,!0)}}function Ft(e){if(!(e.object instanceof Xe)||!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"),a=new eo(new Float32Array(i.count*3),3),s=new W;for(let c=0;c<i.count;c++)t.getVertexPosition(c,s),a.setXYZ(c,s.x,s.y,s.z);n=new Qn().setAttribute("position",a).setIndex(n.getIndex())}let o=t.matrixWorld.clone();if(e.instanceId!==void 0&&"getMatrixAt"in t){let i=new zt;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*oo}}function ti(e,t=6){let n=Ft(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:a}=n,s=Wt(e);if(!s)return{error:"Pick a point on the mesh surface to trace a loop around it."};let c=s[1].clone().sub(s[0]).cross(s[2].clone().sub(s[0]));if(c.lengthSq()===0)return{error:"Couldn't determine the surface direction at this point."};c.normalize();let{weldedId:l,weldedPosition:d,neighbors:f}=ro(r,a),u=r.getAttribute("position"),p=e.point.clone().applyMatrix4(i.clone().invert()),h=[o.a,o.b,o.c],C=h[0],S=1/0;for(let I of h){let B=new W(u.getX(I),u.getY(I),u.getZ(I)).distanceTo(p);B<S&&(S=B,C=I)}let w=l[C],A=d[w].clone().applyMatrix4(i),y=io(f,w,t),M=[];for(let I of y.keys())M.push(d[I].clone().applyMatrix4(i));if(M.length<6)return{error:"Not enough surface detail near this point to trace a loop. Try a different spot."};let j=ao(A,c,M);return _t(r,i,a,e.point.clone(),j)}function ni(e,t=new W(0,1,0)){let n=Ft(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,a=t.clone().normalize();return a.lengthSq()===0?{error:"Couldn't determine a horizontal direction."}:_t(o,r,i,e.point.clone(),a)}function Wt(e){if(!(e.object instanceof Xe)||!e.face)return null;let t=e.object,n=t.matrixWorld.clone();if(e.instanceId!==void 0&&"getMatrixAt"in t){let o=new zt;t.getMatrixAt(e.instanceId,o),n.multiply(o)}return[e.face.a,e.face.b,e.face.c].map(o=>t.getVertexPosition(o,new W).applyMatrix4(n))}function oi(e){if(!(e.object instanceof Xe))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 ri(e,t,n,o,r,i=12){let a=Wt(e),s=a?a[1].clone().sub(a[0]).cross(a[2].clone().sub(a[0])).normalize():null,c={position:e.point.toArray(),...s&&s.lengthSq()>0?{normal:s.toArray()}:{},...a?{faceVertices:a.map(u=>u.toArray())}:{}};if(!a||r==="none")return c;let l=u=>{let p=new no(u.x,u.y,u.z,1).applyMatrix4(t.matrixWorldInverse).applyMatrix4(t.projectionMatrix);return p.w<=0||p.z/p.w<-1||p.z/p.w>1?null:{screen:new Dt((p.x/p.w+1)*o.width/2,(1-p.y/p.w)*o.height/2),w:p.w}},d=a.map(l),f=i;if((r==="vertex"||r==="auto")&&(d.forEach((u,p)=>{let h=u?.screen.distanceTo(n)??1/0;h<=f&&(f=h,c.position=a[p].toArray(),c.snapped="vertex")}),c.snapped))return c;if(r==="edge"||r==="auto")for(let u=0;u<3;u+=1){let p=(u+1)%3,h=d[u],C=d[p];if(!h||!C)continue;let S=C.screen.clone().sub(h.screen);if(S.lengthSq()===0)continue;let w=Math.max(0,Math.min(1,n.clone().sub(h.screen).dot(S)/S.lengthSq())),A=h.screen.clone().addScaledVector(S,w).distanceTo(n);if(A<=f){f=A;let y=w*h.w/((1-w)*C.w+w*h.w);c.position=a[u].clone().lerp(a[p],y).toArray(),c.snapped="edge"}}return c}var mo=["m","cm","mm","in","ft"],Ye={m:1,cm:.01,mm:.001,in:.0254,ft:.3048},fo=["distance","angle","area","pointToPlane","wrap","wrapHorizontal"];function Ze(e){return mo.includes(e)}function po(e={},t="m"){let n=e.displayUnit??t,o=e.metersPerUnit??Ye[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:Ze(n)?o/Ye[n]:1}}function ai(e){try{return new URL(e,typeof window<"u"?window.location?.href:void 0).href}catch{return e}}function ci(e,t,n,o={}){if(!Ze(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*Ye[n]/e;if(!Number.isFinite(r)||r<=0)throw new Error("Calibration scale is outside the supported range.");return{...o,metersPerUnit:r}}function qt(e,t){let n=t.map(o=>o.position);if(e==="angle"){let o=$t(n);return o===null?null:{value:o,dimension:0}}if(e==="area"){let o=Ut(n);return"error"in o?null:{value:o.area,dimension:2}}if(e==="pointToPlane"){let o=t.length===2?Lt(t[0],t[1].position):null;return o?{value:o.distance,dimension:1}:null}return t.length<(e==="distance"?2:3)?null:{value:Ke(n,e!=="distance"),dimension:1}}function go(e,t={},n="m",o=e.points,r=e.approximate?"approximate":"ready"){let i=qt(e.tool,o),{factor:a,displayUnit:s}=po(t,n),c=r==="ready"||r==="approximate",l=c&&i?i.value*a**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"?`${s}\xB2`:s}}function Se(e){function t(){throw new Error("Invalid measurements: expected settings and valid named measurements with finite points.")}let n=s=>!!s&&typeof s=="object"&&!Array.isArray(s),o=s=>Array.isArray(s)&&s.length===3&&s.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 s of["sourceUnit","displayUnit"])e.settings[s]!==void 0&&(Ze(e.settings[s])||t(),r[s]=e.settings[s]);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,a=e.items.map(s=>{(!n(s)||typeof s.id!="string"||!s.id||i.has(s.id)||typeof s.name!="string"||!s.name.trim()||typeof s.modelId!="string"||!s.modelId||!fo.includes(s.tool)||!Array.isArray(s.points)||s.points.length>8192||typeof s.createdAt!="string"||!Number.isFinite(Date.parse(s.createdAt)))&&t(),i.add(s.id),s.tilesetUrl!==void 0&&s.tilesetUrl!==null&&typeof s.tilesetUrl!="string"&&t(),(s.visible!==void 0&&typeof s.visible!="boolean"||s.approximate!==void 0&&typeof s.approximate!="boolean")&&t();let c=new Set,l=s.points.map(f=>{if((!n(f)||typeof f.id!="number"||!Number.isFinite(f.id)||!o(f.position))&&t(),c.has(f.id)&&t(),c.add(f.id),f.normal!==void 0&&!o(f.normal)&&t(),f.faceVertices!==void 0&&(!Array.isArray(f.faceVertices)||f.faceVertices.length!==3||!f.faceVertices.every(o))&&t(),f.snapped!==void 0&&!["vertex","edge"].includes(f.snapped)&&t(),f.anchor!==void 0){let p=f.anchor;(!n(p)||typeof p.nodeId!="string"||!p.nodeId||!o(p.localPosition)||typeof p.geometrySignature!="string"||typeof p.poseSignature!="string")&&t(),p.localNormal!==void 0&&!o(p.localNormal)&&t(),p.localFaceVertices!==void 0&&(!Array.isArray(p.localFaceVertices)||p.localFaceVertices.length!==3||!p.localFaceVertices.every(o))&&t(),p.instanceId!==void 0&&(!Number.isInteger(p.instanceId)||p.instanceId<0)&&t()}let u=f.anchor;return{id:f.id,position:[...f.position],...f.normal?{normal:[...f.normal]}:{},...f.faceVertices?{faceVertices:f.faceVertices.map(p=>[...p])}:{},...f.snapped?{snapped:f.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(p=>[...p])}:{},...u.instanceId!==void 0?{instanceId:u.instanceId}:{}}}:{}}}),d={id:s.id,name:s.name,modelId:s.modelId,tool:s.tool,points:l,createdAt:s.createdAt,...s.tilesetUrl!==void 0?{tilesetUrl:s.tilesetUrl}:{},...s.visible!==void 0?{visible:s.visible}:{},...s.approximate!==void 0?{approximate:s.approximate}:{}};return qt(d.tool,l)||t(),d});return{settings:r,items:a}}function li(e){return JSON.stringify({version:1,...Se(e)},null,2)}function ui(e,t,n="m"){let o=Se(e),r=new Map(t?.map(a=>[a.id,a])),i=a=>{let s=String(a??"");return/^[=+@-]/.test(s)&&(s=`'${s}`),`"${s.replace(/"/g,'""')}"`};return[["id","name","modelId","type","status","value","unit","createdAt"],...o.items.map(a=>{let s=r.get(a.id)??go(a,o.settings,n);return[a.id,a.name,a.modelId,a.tool,s.status,s.value,s.unit,a.createdAt]})].map(a=>a.map(i).join(",")).join(`\r
|
|
2
|
+
`)}function Gt(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 Ht,Color as Xt,ImageLoader as bo,NoColorSpace as Ee,RepeatWrapping as Re,SRGBColorSpace as nt,Texture as ho}from"three";var oe=new Map,et={color:"#93c5fd",intensity:.07},pi=new Xt(et.color).multiplyScalar(et.intensity),gi=new Xt(et.color),bi=.28,me=new Map,tt=new Map;function yo(e){return`${e.name}|${e.size}|${e.lastModified}`}function hi(e){let t=yo(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}`,a=2;for(;;){let s=tt.get(i);if(s===void 0||s===t)return tt.set(i,t),i;i=`materials/${o}-${a}${r}`,a+=1}}function Be(e){return me.get(e)}function Kt(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 bo().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 Yt(e,t){for(let n of[nt,Ee]){let o=oe.get(xe(e,n));o&&Kt(o,t)}}function yi(e,t){let n=me.get(e);n&&n!==t&&n.startsWith("blob:")&&URL.revokeObjectURL(n),me.set(e,t),Yt(e,t)}function Si(e){let t=me.get(e);t&&(t.startsWith("blob:")&&URL.revokeObjectURL(t),me.delete(e),tt.delete(e),Yt(e,e))}function xe(e,t){return`${t}|${e}`}function So(e,t=Ee,n){let o=xe(e,t),r=oe.get(o);if(r)return n&&!r.loaded&&r.pending.push(n),r.texture;let i=me.get(e)??e,a={texture:new ho,refCount:0,loaded:!1,pending:n?[n]:[],loadGeneration:0};return a.texture.flipY=!1,a.texture.colorSpace=t,oe.set(o,a),Kt(a,i),a.texture}function xi(e,t=Ee,n){let o=So(e,t,n);return oe.get(xe(e,t)).refCount+=1,o}function wi(e,t=Ee){let n=oe.get(xe(e,t));n&&(n.refCount-=1,n.refCount<=0&&(n.loadGeneration+=1,n.pending=[],n.texture.dispose(),oe.delete(xe(e,t))))}function Ai(e,t,n,o,r,i=1,a=0){let s=e.offsetTextures??(e.offsetTextures={}),c=s[t],l=c;if(!l||l.sourcePath!==o||l.base!==n){c?.texture.dispose();let f=n.clone();f.wrapS=Re,f.wrapT=Re,f.center.set(.5,.5),f.needsUpdate=!0,l={texture:f,sourcePath:o,base:n},s[t]=l}let d=i>0?i:1;return l.texture.offset.set(r[0],r[1]),l.texture.repeat.set(1/d,1/d),l.texture.rotation=a,l.texture}function Mi(e,t){let n=e.offsetTextures,o=n?.[t];o&&(o.texture.dispose(),delete n[t])}function Ci(e){let t=e.offsetTextures;if(t){for(let n of Object.values(t))n.texture.dispose();delete e.offsetTextures}}var Je=null;function ji(){if(Je)return Je;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 Ht(t);return r.colorSpace=nt,Je=r,r}var Qe=null;function ki(){if(Qe)return Qe;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 s=0;s<t;s+=1)for(let c=0;c<t;c+=1){let l=c*n,d=s*n,f=(Math.floor(c/2)+Math.floor(s/2))%4;i.fillStyle=o[f],i.fillRect(l,d,n,n),i.strokeStyle="rgba(0, 0, 0, 0.28)",i.lineWidth=2;for(let A=1;A<4;A+=1){let y=A*n/4;i.beginPath(),i.moveTo(l+y,d),i.lineTo(l+y,d+n),i.moveTo(l,d+y),i.lineTo(l+n,d+y),i.stroke()}i.strokeStyle="#09090b",i.lineWidth=7,i.strokeRect(l,d,n,n);let u=l+n*.23,p=d+n*.72,h=l+n*.72,C=d+n*.23;i.lineCap="round",i.lineJoin="round",i.beginPath(),i.moveTo(u,p),i.lineTo(h,C),i.lineTo(h-n*.2,C),i.moveTo(h,C),i.lineTo(h,C+n*.2),i.stroke();let S=s*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 w=String(S).padStart(2,"0");i.strokeText(w,l+n/2,d+n*.82),i.fillText(w,l+n/2,d+n*.82)}let a=new Ht(r);return a.colorSpace=nt,a.wrapS=Re,a.wrapT=Re,a.flipY=!1,a.anisotropy=8,a.needsUpdate=!0,Qe=a,a}function Zt(e){for(let t of oe.values())if(t.texture.source===e.source&&(!t.loaded||t.failed))return!0;return!1}var re=5*1024*1024,xo=["activeModelId","modelUrl","modelFormat","tilesetUrl","models","mergeModels","sceneConfig","isolation","multiSelectedKeys","activeAnnotation","annotationCategories","backgroundColor","shadows","cinematic","cameraControllerType","objectTransformSpace","arScaleMode","usdzUrl","measurements","measurementSettings","measurementUnit","measurementModelId"];function O(e,t){throw new Error(`Invalid viewer state at ${e}: ${t}`)}function q(e,t){(!e||typeof e!="object"||Array.isArray(e))&&O(t,"expected an object.")}function we(e,t){(!Array.isArray(e)||!e.every(n=>typeof n=="string"))&&O(t,"expected strings.")}function Z(e,t,n){(!Array.isArray(e)||e.length!==t||!e.every(o=>typeof o=="number"&&Number.isFinite(o)))&&O(n,`expected ${t} finite numbers.`)}function wo(e){let t=new Set,n=0;function o(r,i,a){if((++n>2e5||a>64)&&O(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)&&O(i,"expected JSON data (finite numbers, no functions)."),t.has(r)&&O(i,"cyclic data."),!Array.isArray(r)&&Object.getPrototypeOf(r)!==Object.prototype&&Object.getPrototypeOf(r)!==null&&O(i,"expected plain JSON data."),t.add(r);let s=Array.isArray(r)?[]:{};for(let[c,l]of Object.entries(r))["__proto__","constructor","prototype"].includes(c)&&O(`${i}.${c}`,"reserved property."),l!==void 0?s[c]=o(l,`${i}.${c}`,a+1):Array.isArray(r)&&O(i,"undefined array entry.");return t.delete(r),s}return o(e,"state",0)}function J(e,t,n,o,r=!1,i){let a=e[t];if(a==null||a==="")return;typeof a!="string"&&O(n,"expected a URL.");let s=r?Be(a)??a:a;if(s.trim().startsWith("blob:")){if(r&&i){i.set(a,{source:s,path:n});return}O(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(s!==a&&(a=s,e[t]=s),r&&/^data:image\//i.test(a))return;let c;try{c=new URL(a,o??"https://relative.invalid/")}catch{O(n,"invalid asset URL.")}["http:","https:"].includes(c.protocol)||O(n,"use an HTTP(S) asset URL."),o&&(e[t]=c.href)}function Ao(e,t){q(e,t),Z(e.position,3,`${t}.position`),Z(e.target,3,`${t}.target`),(typeof e.zoom!="number"||e.zoom<=0)&&O(t,"zoom must be positive."),e.fov!==null&&(typeof e.fov!="number"||e.fov<=0||e.fov>=180)&&O(t,"fov must be null or between 0 and 180.");for(let n of["azimuthAngle","polarAngle"])e[n]!==void 0&&typeof e[n]!="number"&&O(t,`${n} must be a number.`)}function en(e,t,n,o){q(e,t),(typeof e.id!="number"||typeof e.title!="string"||typeof e.description!="string")&&O(t,"expected an annotation id, title and description.");for(let r of["worldPosition","localPosition"])Z(e[r],3,`${t}.${r}`);e.images!==void 0&&(Array.isArray(e.images)||O(t,"images must be an array."),e.images.forEach(r=>{q(r,t),J(r,"src",t,n,!0,o)})),e.links!==void 0&&(Array.isArray(e.links)||O(t,"links must be an array."),e.links.forEach(r=>{q(r,t),J(r,"href",t,n,!1,o)}))}function tn(e,t){q(e,t),e.waypoints!==void 0&&(Array.isArray(e.waypoints)||O(t,"expected waypoints."),e.waypoints.forEach(n=>{q(n,t),Z(n.position,3,t),Z(n.target,3,t)}));for(let n of["enabled","loop","autoPlay"])e[n]!==void 0&&typeof e[n]!="boolean"&&O(t,`${n} must be boolean.`);e.duration!==void 0&&(typeof e.duration!="number"||e.duration<=0)&&O(t,"duration must be positive.")}function ot(e,t,n){if(t!==null)if(Array.isArray(t))Array.isArray(e)||O(n,"expected an array."),t.length&&e.forEach(o=>ot(o,t[0],n));else if(typeof t=="object"){q(e,n);for(let[o,r]of Object.entries(t))ot(e[o],r,`${n}.${o}`)}else typeof e!=typeof t&&O(n,`expected ${typeof t}.`)}function Jt(e,t,n,o){if(ot(e,de,t),e.measurements!==void 0&&(e.measurements=Se(e.measurements)),e.sequences!==void 0&&(e.sequences=Ce(e.sequences)),e.selectionSets!==void 0&&(e.selectionSets=Gt(e.selectionSets)),e.product!==void 0&&(e.product=jt(e.product),e.product.definition.groups.forEach(r=>r.options.forEach(i=>i.appearance?.forEach(a=>{for(let[s,c]of Object.entries(a.material??{}))c&&typeof c=="object"&&!Array.isArray(c)&&"path"in c&&J(c,"path",`${t}.product.material.${s}.path`,n,!0,o)})))),Z(e.model.rotation,3,`${t}.model.rotation`),e.lighting.lights.forEach(r=>Z(r.position,3,`${t}.lighting.lights`)),e.annotations.forEach(r=>en(r,`${t}.annotations`,n,o)),e.animations.autoplayClip!==null&&typeof e.animations.autoplayClip!="string"&&O(t,"invalid autoplay clip."),e.animations.clips.forEach(r=>{q(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))&&O(t,"invalid animation clip settings.")}),e.cinematic!==void 0&&tn(e.cinematic,`${t}.cinematic`),e.styleRules!==void 0&&!Array.isArray(e.styleRules)&&O(t,"styleRules must be an array."),J(e.environment,"customEnvironmentUrl",`${t}.environment`,n,!1,o),J(e.background,"imageUrl",`${t}.background`,n,!0,o),e.model.activeVariants!==void 0&&we(e.model.activeVariants,t),e.section!==void 0)try{e.section=he(e.section)}catch(r){O(`${t}.section`,r.message)}}function nn(e,t,n,o){q(e,t);for(let[r,i]of Object.entries(e)){let a=`${t}.${r}`;q(i,a),(typeof i.id!="string"||typeof i.modelObjectId!="string")&&O(a,"expected binding id and modelObjectId.");for(let s of["label","group","type","status"])i[s]!==void 0&&typeof i[s]!="string"&&O(a,`${s} must be a string.`);i.tags!==void 0&&we(i.tags,a),i.metadata!==void 0&&q(i.metadata,`${a}.metadata`),i.metrics!==void 0&&(q(i.metrics,a),Object.values(i.metrics).some(s=>typeof s!="number")&&O(a,"metrics must be numbers.")),i.actions!==void 0&&(Array.isArray(i.actions)||O(a,"actions must be an array."),i.actions.forEach(s=>{q(s,a),(typeof s.id!="string"||typeof s.label!="string"||s.type!=="command"||s.effects!==void 0&&!Array.isArray(s.effects))&&O(a,"invalid action.")}));for(let s of["visible","removed","selectable","hoverable"])i[s]!==void 0&&typeof i[s]!="boolean"&&O(a,`${s} must be boolean.`);if(i.transform!==void 0){q(i.transform,a);for(let s of["position","rotation","scale","shear"])i.transform[s]!==void 0&&Z(i.transform[s],3,`${a}.transform.${s}`);i.transform.pivot!==void 0&&(q(i.transform.pivot,a),Z(i.transform.pivot.point,3,a),Z(i.transform.pivot.offset,3,a))}if(i.style!==void 0&&(q(i.style,a),i.style.material!==void 0)){q(i.style.material,a);for(let[s,c]of Object.entries(i.style.material))c&&typeof c=="object"&&!Array.isArray(c)&&"path"in c&&J(c,"path",`${a}.style.material.${s}.path`,n,!0,o)}i.decals!==void 0&&(Array.isArray(i.decals)||O(a,"decals must be an array."),i.decals.forEach(s=>{q(s,a),(typeof s.id!="string"||typeof s.size!="number"||s.size<=0)&&O(a,"invalid decal."),Z(s.position,3,a),Z(s.normal,3,a),J(s,"image",a,n,!0,o)}))}}function Qt(e,t,n,o){Array.isArray(e)||O(t,"expected merge sources."),e.forEach(r=>{q(r,t),(typeof r.url!="string"||!r.url||typeof r.namePrefix!="string")&&O(t,"expected source URL and prefix."),J(r,"url",t,n,!1,o)})}function Mo(e,t,n){q(e,"configuration");let o=Object.fromEntries(xo.filter(r=>e[r]!==void 0).map(r=>[r,e[r]]));(typeof o.modelUrl!="string"||!o.modelUrl)&&O("configuration.modelUrl","expected the active model URL.");for(let r of["modelUrl","tilesetUrl","usdzUrl"])J(o,r,`configuration.${r}`,t,!1,n);if(o.sceneConfig!==void 0&&Jt(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)&&O("configuration.models","expected model entries.");let r=new Set,i=new Set;o.models.forEach(a=>{q(a,"model"),(typeof a.url!="string"||!a.url)&&O("model.url","expected a URL."),J(a,"url","model.url",t,!1,n),a.id!==void 0&&(typeof a.id!="string"||!a.id.trim())&&O("model.id","expected a nonempty instance ID.");let s=He({id:a.id,url:a.url});i.has(s)&&O("configuration.models","instance identities must be unique; assign IDs when reusing a URL."),i.add(s),a.transform!==void 0&&(a.transform=ye(a.transform)),a.visible!==void 0&&typeof a.visible!="boolean"&&O("model.visible","expected boolean."),r.add(a.url),nn(a.objectBindings,"model.objectBindings",t,n),a.sceneConfig!==void 0&&Jt(a.sceneConfig,"model.sceneConfig",t,n),a.mergeModels!==void 0&&Qt(a.mergeModels,"model.mergeModels",t,n)}),o.activeModelId!==void 0&&(typeof o.activeModelId!="string"||!i.has(o.activeModelId))&&O("configuration.activeModelId","active instance is not in models."),o.activeModelId!==void 0&&o.models.find(a=>He(a)===o.activeModelId)?.url!==o.modelUrl&&O("configuration.modelUrl","source does not match the active instance."),r.has(o.modelUrl)||O("configuration.modelUrl","active model is not in models.")}if(o.multiSelectedKeys!==void 0&&we(o.multiSelectedKeys,"configuration.multiSelectedKeys"),o.annotationCategories!==void 0&&o.annotationCategories!==null&&we(o.annotationCategories,"configuration.annotationCategories"),o.activeAnnotation!==void 0&&o.activeAnnotation!==null&&en(o.activeAnnotation,"configuration.activeAnnotation",t,n),o.measurements!==void 0||o.measurementSettings!==void 0){let r=Se({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"&&O("configuration.measurementModelId","expected a stable id."),o.measurementUnit!==void 0&&typeof o.measurementUnit!="string"&&O("configuration.measurementUnit","expected a unit label.");for(let r of["backgroundColor"])o[r]!==void 0&&typeof o[r]!="string"&&O(r,"expected a string.");o.shadows!==void 0&&typeof o.shadows!="boolean"&&O("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])&&O(r,"unsupported value.");if(o.cinematic!==void 0&&tn(o.cinematic,"cinematic"),o.isolation!==void 0&&o.isolation!==null){let{target:r,mode:i,ghostOpacity:a}=o.isolation;typeof r=="string"||Array.isArray(r)&&r.every(s=>typeof s=="string")||r&&typeof r=="object"&&["group","tag","type"].some(s=>typeof r[s]=="string")||O("configuration.isolation","invalid target."),i!==void 0&&!["ghost","hide"].includes(i)&&O("configuration.isolation","invalid mode."),a!==void 0&&(typeof a!="number"||a<0||a>1)&&O("configuration.isolation","opacity must be between 0 and 1.")}return o}function on(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)?J(e,r,`${t}.${r}`,n,["path","image","src","imageUrl"].includes(r),o):on(i,`${t}.${r}`,n,o))}function rn(e,t,n){typeof e=="string"&&(new TextEncoder().encode(e).length>re&&O("state","exceeds the 5 MiB limit."),e=JSON.parse(e));let o=wo(e);q(o,"state"),new TextEncoder().encode(JSON.stringify(o)).length>re&&O("state","exceeds the 5 MiB limit."),o.version!==void 0&&o.version!==1&&O("version","unsupported version."),o.version===void 0&&(o.objectBindings!==void 0||o.configuration!==void 0)&&O("version","full configurations require version 1.");let r={};return o.version!==void 0&&(r.version=1),o.camera!==void 0&&(Ao(o.camera,"camera"),r.camera=o.camera),o.hidden!==void 0&&(we(o.hidden,"hidden"),r.hidden=o.hidden),o.selected!==void 0&&(o.selected!==null&&typeof o.selected!="string"&&O("selected","expected an object id or null."),r.selected=o.selected),o.objectBindings!==void 0&&(nn(o.objectBindings,"objectBindings",t,n),r.objectBindings=o.objectBindings),o.configuration!==void 0&&(r.configuration=Mo(o.configuration,t,n)),on(r,"state",t,n),new TextEncoder().encode(JSON.stringify(r)).length>re&&O("state","exceeds the 5 MiB limit."),r}function Ni(e,t){return JSON.stringify(Pe(e,t))}function Pe(e,t){return rn(e,t)}async function sn(e,t){let n=new Map,o=rn(e,t,n),r=new Map,i=new Map;for(let[s,{source:c,path:l}]of n){let d=r.get(c);d||(d=(async()=>{let f;try{f=await fetch(c)}catch{O(l,"this temporary image is no longer available. Reload or reselect it before saving.")}f.ok||O(l,"could not read the temporary image. Reload or reselect it before saving.");let u=await f.blob();u.size>re*3/4&&O(l,"embedded image exceeds the 5 MiB configuration limit. Use a hosted image URL.");let p=new Uint8Array(await u.arrayBuffer()),h=u.type.split(";")[0].toLowerCase(),C=h.startsWith("image/")?h:Co(p);C||O(l,"temporary asset is not a supported image. Use a hosted asset URL.");let S="";for(let w=0;w<p.length;w+=32768)S+=String.fromCharCode(...p.subarray(w,w+32768));return`data:${C};base64,${btoa(S)}`})(),r.set(c,d)),i.set(s,await d)}function a(s){if(!(!s||typeof s!="object"))for(let[c,l]of Object.entries(s))c!=="metadata"&&(["path","image","src","imageUrl"].includes(c)&&typeof l=="string"&&i.has(l)?s[c]=i.get(l):a(l))}return a(o),Pe(o,t)}function Co(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 jo,strToU8 as an,unzlibSync as ko,zlibSync as vo}from"fflate";var Ve="ri-ar",Ne="ri-ar-id",cn=4096,Oo=2200,To=an(JSON.stringify(de)).byteLength;function ln(e){return e==="localhost"||e.endsWith(".localhost")||/^127\./.test(e)||e==="[::1]"||e==="0.0.0.0"}function un(e){if(typeof e=="string"&&/^https?:\/\//i.test(e)&&ln(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))un(t)}function _i(e){return e&&typeof e=="object"?e:void 0}function Fi(e){let t=new URLSearchParams(new URL(e,"https://viewer.invalid/").hash.slice(1));return t.has(Ve)||t.has(Ne)}function Io(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 Wi(e,t="",n=2048){let o=new Set,r=i=>{if(typeof i=="string")return Be(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 a=Array.isArray(i)?i.map(r):Object.fromEntries(Object.keys(i).sort().map(s=>[s,r(i[s])]));return o.delete(i),a};return JSON.stringify([t,n,r({...e,camera:void 0})])}function dn(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,dn(o,t[n])]).filter(([,n])=>n!==void 0)):e}function mn(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)?mn(o[i],r[i],n+1):r[i]]))}return e}function fn(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 Ae(e){e?.throwIfAborted()}async function qi(e,t,n,o){Ae(o);let r=new URL(Io(t));if(ln(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 sn(e,r.toString());Ae(o),un(i);let a=new URLSearchParams(r.hash.slice(1));if(a.delete(Ve),a.delete(Ne),a.delete("view"),a.delete("viewId"),a.delete("view-id"),n){let s=await n.save(i);if(Ae(o),typeof s!="string"||!s||s.length>512)throw new Error("AR storage returned an invalid configuration ID.");a.set(Ne,s)}else{let s=vo(an(JSON.stringify({ar:1,state:fn(i,l=>dn(l,de)??{})})),{level:9});if(s.byteLength>cn)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 s)c+=String.fromCharCode(l);a.set(Ve,btoa(c).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,""))}if(r.hash=a.toString(),r.toString().length>Oo)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 Gi(e,t,n){let o=new URL(e),r=new URLSearchParams(o.hash.slice(1)),i=r.get(Ne),a=r.get(Ve);if(i!==null&&a!==null)throw new Error("AR link contains conflicting configurations.");if(i===null&&a===null)return null;Ae(n);let s;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.");s=await t.load(i)}else{if(!a||a.length>Math.ceil(cn*4/3)||!/^[\w-]+$/.test(a))throw new Error("Invalid or oversized AR link.");let l=atob(a.replace(/-/g,"+").replace(/_/g,"/")),d=Uint8Array.from(l,p=>p.charCodeAt(0)),f=ko(d);if(f.byteLength>re)throw new Error("AR configuration exceeds the 5 MiB limit.");let u=JSON.parse(jo(f));if(u?.ar===1&&u.state){let p=u.state.configuration,h=(p?.sceneConfig?1:0)+(Array.isArray(p?.models)?p.models.filter(C=>C?.sceneConfig).length:0);if(f.byteLength+h*To>re)throw new Error("Expanded AR configuration exceeds the 5 MiB limit.");s=fn(u.state,C=>mn(C,de))}else s=u}Ae(n);let c=Pe(s,o.toString());if(c.version!==1||!c.configuration)throw new Error("AR handoff requires a complete versioned viewer configuration.");return c}var rt=new WeakMap;function Xi(e,t){t?rt.set(e,t):rt.delete(e)}function pn(e){e.traverse(t=>{let n=rt.get(t);if(n)throw new Error(n)})}import{Box3 as er,BufferAttribute as De,BufferGeometry as Nn,Color as tr,DoubleSide as nr,FrontSide as gt,Group as zn,Matrix4 as or,Mesh as rr,Vector3 as $e}from"three";import{PropertyBinding as it}from"three";var st=Symbol("react-immersive.model-node-id");function Ro(e,t){Object.defineProperty(e,st,{value:t,configurable:!0})}function ie(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)),a=new Set,s=(c,l)=>{Ro(c,l),n[l]=c,o.set(c,l),a.add(l)};for(let[c,l]of t)l.length===1&&s(l[0],c);for(let[c,l]of t){if(l.length<2)continue;let d=[];l.forEach((f,u)=>{let p=`${c} [${u+1}]`,h=p,C=2;for(;i.has(h)||a.has(h);)h=`${p}.${C++}`;s(f,h),d.push(h)}),r.set(c,d)}return{nodesById:n,idByNode:o,duplicateNames:r}}function Me(e){return e[st]??e.name??null}function Zi(e,t){let n=t.replace(/\.[^./\\]+$/,"");e.traverse(o=>{o.name&&(o.name=it.sanitizeNodeName(`${n}_${o.name}`))})}function Ji(e,t){let n=t.replace(/\.[^./\\]+$/,""),o=e.clone();for(let r of o.tracks){let a=it.parseTrackName(r.name).nodeName??"",s=it.sanitizeNodeName(`${n}_${a}`);r.name=s+r.name.slice(a.length)}return o}function gn(e,t){let n=null,o=[];return e.traverse(r=>{r[st]===t&&(n=r),r.name===t&&o.push(r)}),n??(o.length===1?o[0]:null)}import{AnimationClip as Fo,Group as Wo,Matrix4 as qo,Vector3 as Go,PropertyBinding as En}from"three";import{clone as Ho}from"three/examples/jsm/utils/SkeletonUtils.js";import{strFromU8 as Xo,strToU8 as pt,unzipSync as Ko,zipSync as Yo}from"fflate";import{AnimationMixer as Eo,LoopOnce as Bo,LoopPingPong as bn,LoopRepeat as Po}from"three";function hn(e){let t=e._loopCount;return e.loop===bn&&(t&1)===1}function Vo(e){return hn(e)?e.getClip().duration-e.time:e.time}function yn({root:e,clips:t,getClipConfig:n,onChange:o}){let r=new Eo(e),i=new Map;for(let{clip:m,sourceName:b}of t)i.set(b,r.clipAction(m));let a=new Map,s=new Set,c=new Map,l=1,d=m=>typeof m=="string",f=m=>d(m)?a.has(m)?[m]:[]:[...a.keys()],u=(m,b)=>{let x=vt(n(b));x==="once"?m.setLoop(Bo,1):x==="ping-pong"?m.setLoop(bn,1/0):m.setLoop(Po,1/0),m.clampWhenFinished=x==="once"},p=m=>{m.action.setEffectiveTimeScale(m.reverse?-m.speed:m.speed)},h=m=>{let b=a.get(m);b&&(b.action.stop(),a.delete(m))},C=(m,b={})=>{let x=i.get(m);if(!x||n(m)?.hidden)return;let k=Number.isFinite(b.fade)&&b.fade>0?b.fade:0,R=b.reverse??!1;if(!b.alongside)for(let[G,ee]of[...a])G!==m&&(k>0?(a.delete(G),ee.action.fadeOut(k),s.add(ee.action)):h(G));s.delete(x)&&x.stop();let N=x.getClip().duration,E=a.get(m),D=()=>{x.reset(),R&&(x.time=N),x.play()};if(!E)D(),k>0&&x.fadeIn(k);else{let G=R?x.time<=0:x.time>=N;E.finished&&G&&D(),x.paused=!1,x.enabled=!0,a.delete(m)}u(x,m),E={action:x,speed:n(m)?.speed??c.get(m)??l,reverse:R,finished:!1},E.speed=Oe(E.speed),p(E),a.set(m,E),o()},S=m=>{for(let b of f(m))a.get(b).action.paused=!0;o()},w=m=>{for(let b of f(m))h(b);if(!d(m)){for(let b of s)b.stop();s.clear()}o()},A=(m,b)=>{let x=Oe(m);d(b)?c.set(b,x):l=x;for(let k of f(b)){let R=a.get(k);c.set(k,x),R.speed=x,p(R)}o()},y=(m,b)=>{for(let x of f(b)){let k=a.get(x),R=k.action.getClip().duration,N=Math.min(Math.max(m,0),R);k.action.time=hn(k.action)?R-N:N,k.finished&&(k.finished=!1,k.action.paused=!0)}r.update(0),o()},M=()=>{for(let[m,b]of[...a]){let x=n(m);if(x?.hidden){h(m);continue}u(b.action,m),x?.speed!==void 0&&(b.speed=Oe(x.speed),p(b))}o()},j=m=>{for(let b of a.values())b.action===m.action&&(b.finished=!0);o()};return r.addEventListener("finished",j),{play:C,pause:S,stop:w,setSpeed:A,seek:y,getState:()=>{let m=[...a].map(([x,k])=>({clip:x,status:k.finished?"finished":k.action.paused?"paused":"playing",time:Vo(k.action),duration:k.action.getClip().duration,speed:k.speed,reverse:k.reverse})),b=m[m.length-1];return{currentClip:b?.clip??null,isPlaying:m.some(x=>x.status==="playing"),speed:b?.speed??l,time:b?.time??0,duration:b?.duration??0,active:m}},applyClipConfigs:M,isRunning:()=>{if(s.size>0)return!0;for(let{action:m}of a.values())if(!m.paused&&m.enabled)return!0;return!1},update:m=>{r.update(m);for(let b of s)(!b.enabled||b.getEffectiveWeight()<=0)&&(b.stop(),s.delete(b))},dispose:()=>{r.removeEventListener("finished",j),r.stopAllAction(),r.uncacheRoot(e),a.clear(),s.clear()}}}import{Color as wn}from"three";import{Matrix4 as Sn,Quaternion as No,Vector3 as ze}from"three";function zo(e){return new Sn().set(1,e[0],e[1],0,0,1,e[2],0,0,0,1,0,0,0,0,1)}function at(e,t){e.matrixAutoUpdate=!t,e.updateMatrix(),t&&(e.matrix.makeRotationFromQuaternion(e.quaternion).multiply(zo(t)).scale(e.scale).setPosition(e.position),e.matrixWorldNeedsUpdate=!0)}function xn(e,t,n){let o=new ze().setFromMatrixColumn(e,0),r=new ze().setFromMatrixColumn(e,1),i=new ze().setFromMatrixColumn(e,2),a=(h,C)=>{let S=h*(C<0?-1:1);return Math.abs(S-C)<1e-10?C:S},s=a(o.length(),t.x);if(Math.abs(s)<1e-12)return{rotation:n.clone(),scale:t.clone(),shear:void 0};o.divideScalar(s);let c=o.dot(r);r.addScaledVector(o,-c);let l=a(r.length(),t.y);if(Math.abs(l)<1e-12)return{rotation:n.clone(),scale:t.clone(),shear:void 0};r.divideScalar(l);let d=o.dot(i);i.addScaledVector(o,-d);let f=r.dot(i);i.addScaledVector(r,-f);let u=a(i.length(),t.z);if(Math.abs(u)<1e-12)return{rotation:n.clone(),scale:t.clone(),shear:void 0};i.divideScalar(u);let p=[c/l,d/u,f/u].map(h=>Math.abs(h)<1e-10?0:h);return{rotation:new No().setFromRotationMatrix(new Sn().makeBasis(o,r,i)).normalize(),scale:new ze(s,l,u),shear:p.some(Boolean)?p:void 0}}var ct=e=>e==="baseColor"?"color":e;function An(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 Mn({root:e,controls:t,animations:n,invalidate:o,cameraEnabled:r=()=>!0}){let i=new Map,a=new Map,s=new Map,c=new Set,l=new Map,d=null,f="",u=y=>e()?gn(e(),y):null,p=y=>{if(y.kind==="camera"){let B=t();if(!B)return null;let g=te(B.camera,B);return{position:g.position,target:g.target,fov:g.fov,zoom:g.zoom}}if(y.kind==="clip"){let B=n();return B?.clips.includes(y.clip)?B.getState?.().active.find(g=>g.clip===y.clip)?.time??0:null}let M=u(y.objectId);if(!M)return null;let j=y.property;if(j==="position"||j==="rotation"||j==="scale")return[M[j].x,M[j].y,M[j].z];if(j==="visible")return M.visible;let I=An(M).find(B=>B[ct(j)]!==void 0),T=I?I[ct(j)]:void 0;return T?.isColor?`#${T.getHexString()}`:typeof T=="number"?T:null},h=y=>{if(!r())return;let M=t();M&&(M.stop(),M.setLookAt(...y.position,...y.target,!1),y.fov!==null&&"fov"in M.camera&&(M.camera.fov=y.fov,M.camera.updateProjectionMatrix()),M.zoomTo(y.zoom,!1),M.update(0))},C=y=>{if(i.has(y))return;y.updateWorldMatrix(!0,!0);let M=y.matrixAutoUpdate?void 0:xn(y.matrix,y.scale,y.quaternion).shear;i.set(y,{position:y.position.toArray(),rotation:[y.rotation.x,y.rotation.y,y.rotation.z],scale:y.scale.toArray(),matrix:y.matrix.clone(),auto:y.matrixAutoUpdate,shear:M});for(let j of xt(y))wt(j)||(je(j,j.matrixWorld),c.add(j))},S=(y,M)=>{let j=n();j?.stop(y),M&&j&&(j.play(y,{alongside:!0,reverse:M.reverse}),j.setSpeed(M.speed,y),j.seek?.(M.time,y),M.status!=="playing"&&j.pause(y))};return{capture:p,restore:()=>{for(let[y,M]of l)S(y,M);l.clear();for(let[y,M]of i)y.position.fromArray(M.position),y.rotation.set(...M.rotation),y.scale.fromArray(M.scale),y.matrix.copy(M.matrix),y.matrixAutoUpdate=M.auto,y.matrixWorldNeedsUpdate=!0;i.clear(),a.forEach((y,M)=>M.visible=y),a.clear(),s.forEach((y,M)=>{y.forEach((j,I)=>{j instanceof wn?M[I].copy(j):M[I]=j}),M.needsUpdate=!0}),s.clear(),c.forEach(Mt),c.clear(),d&&h(d),d=null,f="",e()?.updateWorldMatrix(!0,!0),o()},inspect:y=>y.tracks.filter(M=>!M.muted&&M.keyframes.length&&(M.target.kind!=="camera"||r())&&p(M.target)===null).map(M=>`Unavailable target: ${M.name}.`),invalidate:o,apply:({sequence:y,time:M,playing:j})=>{let I=y.tracks.filter(g=>g.target.kind!=="camera"||r()).map(g=>({track:g,value:bt(g,M)})).filter(g=>g.value!==null);for(let[g,m]of l)I.some(({track:b})=>b.target.kind==="clip"&&b.target.clip===g)||(S(g,m),l.delete(g));for(let{track:g}of I)if(g.target.kind==="object"&&["position","rotation","scale"].includes(g.target.property)){let m=u(g.target.objectId);m&&C(m)}let T=new Map([...s.keys()].map(g=>[g,g.transparent]));a.forEach((g,m)=>m.visible=g),i.forEach((g,m)=>{m.position.fromArray(g.position),m.rotation.set(...g.rotation),m.scale.fromArray(g.scale),at(m,g.shear)}),s.forEach((g,m)=>g.forEach((b,x)=>{b instanceof wn?m[x].copy(b):m[x]=b}));let B=n();for(let{track:g,value:m}of I){if(g.target.kind!=="clip"||!B?.seek||!B.clips.includes(g.target.clip))continue;let b=g.target.clip;l.has(b)||(l.set(b,B.getState?.().active.find(x=>x.clip===b)),B.play(b,{alongside:!0}),B.pause(b)),B.seek(m,b)}for(let{track:g,value:m}of I){let b=g.target;if(b.kind==="clip")continue;if(b.kind==="camera"){d||(d=p(b));let R=JSON.stringify(m);(j||R!==f)&&(h(m),f=R);continue}let x=u(b.objectId);if(!x)continue;let k=b.property;if(k==="visible")a.has(x)||a.set(x,x.visible),x.visible=m;else if(k==="position"||k==="rotation"||k==="scale")k==="rotation"?x.rotation.set(...m):x[k].fromArray(m),at(x,i.get(x)?.shear);else for(let R of An(x)){let N=ct(k),E=R[N];if(E===void 0)continue;let D=s.get(R);if(D||(D=new Map,s.set(R,D)),T.has(R)||T.set(R,R.transparent),D.has(N)||D.set(N,E?.isColor?E.clone():E),E?.isColor?E.set(m):R[N]=m,k==="opacity"){D.has("transparent")||D.set("transparent",R.transparent);let G=m<1||D.get("transparent")===!0;R.transparent=G}}}d&&!I.some(({track:g})=>g.target.kind==="camera")&&(h(d),f=""),T.forEach((g,m)=>{g!==m.transparent&&(m.needsUpdate=!0)}),e()?.updateWorldMatrix(!0,!0)}}}function Cn(e){let t=new Map;return e.map((n,o)=>{let i=n.name.trim()||`Animation ${o+1}`,a=t.get(i)??0;return t.set(i,a+1),{clip:n,sourceName:a===0?i:`${i} (${a+1})`,duration:n.duration}})}import{Box3 as lt,Group as Do,BufferAttribute as $o,Matrix4 as jn,Mesh as Lo,Quaternion as Uo,Vector3 as fe}from"three";function _o(e){let t=e.getAttribute("arSourceVertex"),n=e.getAttribute("arNormalSign");if(!t)return;let o=new Map,r=[],i=[];for(let s=0;s<t.count;s++){let c=`${t.getX(s)}:${n?.getX(s)??1}`,l=o.get(c);l===void 0&&(l=r.length,r.push(s),o.set(c,l)),i.push(l)}let a=e.index?Array.from(e.index.array,s=>i[s]):i;for(let[s,c]of Object.entries(e.attributes)){let l=new Float32Array(r.length*c.itemSize);r.forEach((d,f)=>{for(let u=0;u<c.itemSize;u++)l[f*c.itemSize+u]=c.getComponent(d,u)}),e.setAttribute(s,new $o(l,c.itemSize))}e.setIndex(a)}function kn(e,t,n,o){let r=[],i=[],a=new Map;for(let s of e){let c=s.source;if(!c.isSkinnedMesh)continue;let l=t.get(c),d=c.skeleton,f=JSON.stringify(d.bones.map((g,m)=>[g.uuid,d.boneInverses[m].elements])),u=a.get(f);if(!u){let g=new Map(d.bones.map((E,D)=>[E,D])),m=d.bones.map(E=>{for(let D=E.parent;D;D=D.parent)if(g.has(D))return g.get(D);return-1}),b=[],x=E=>{b.includes(E)||(m[E]>=0&&x(m[E]),b.push(E))};d.bones.forEach((E,D)=>x(D));let k=b.map(E=>b.indexOf(m[E])),R=[];b.forEach((E,D)=>R.push(`${k[D]<0?"":R[k[D]]+"/"}J_${E}`));let N={name:`${o}_${r.length}`,joints:R,parents:k,bones:b.map(E=>t.get(d.bones[E])),bindTransforms:b.map(E=>d.boneInverses[E].clone().invert()),restTransforms:[],worlds:b.map(()=>new jn),referenceInverse:n.clone().invert(),frames:[]};if(N.bones.some(E=>!E))throw new Error("The AR skeleton has joints outside the exported scene.");u={rig:N,order:b},a.set(f,u),r.push(N)}_o(s.exported.geometry);let p=s.exported.geometry.getAttribute("arSourceVertex"),h=c.geometry.getAttribute("skinIndex"),C=c.geometry.getAttribute("skinWeight");if(!p||!h||!C||h.itemSize!==4||C.itemSize!==4)throw new Error("AR skeletal animation needs four joint indices and weights per vertex.");let S={target:s,node:l,rig:u.rig,reference:n,geomBind:c.bindMatrix.clone(),jointIndices:[],jointWeights:[],jointBounds:u.order.map(()=>new lt),extent:new lt},w=s.exported.geometry.getAttribute("position"),A=s.exported.geometry.getAttribute("normal"),y=c.geometry.getAttribute("normal"),M=s.exported.geometry.getAttribute("arNormalSign"),j=new fe,I=new fe,T=new Map(u.order.map((g,m)=>[g,m])),B=S.rig.bindTransforms.map(g=>g.clone().invert().multiply(c.bindMatrix));for(let g=0;g<p.count;g++){let m=p.getX(g);if(Lo.prototype.getVertexPosition.call(c,m,j),w.setXYZ(g,j.x,j.y,j.z),y&&A){I.fromBufferAttribute(y,m);let x=I.clone();c.geometry.morphAttributes.normal?.forEach((k,R)=>{let N=c.morphTargetInfluences?.[R]??0;N&&I.addScaledVector(new fe().fromBufferAttribute(k,m).sub(c.geometry.morphTargetsRelative?new fe:x),N)}),I.normalize().multiplyScalar(M?.getX(g)??1),A.setXYZ(g,I.x,I.y,I.z)}let b=[0,1,2,3].reduce((x,k)=>x+C.getComponent(m,k),0);if(!Number.isFinite(b)||b<=0)throw new Error("The AR skin has a vertex without valid joint weights.");for(let x=0;x<4;x++){let k=C.getComponent(m,x)/b,R=k?T.get(h.getComponent(m,x))??-1:0;if(R<0||!Number.isFinite(k)||k<0)throw new Error("The AR skin has invalid joint indices or weights.");S.jointIndices.push(R),S.jointWeights.push(k),k&&S.jointBounds[R].expandByPoint(j.clone().applyMatrix4(B[R]))}}w.needsUpdate=!0,A?A.needsUpdate=!0:s.exported.geometry.computeVertexNormals(),s.exported.geometry.computeBoundingBox(),s.exported.matrixAutoUpdate=!1,s.exported.matrix.copy(mt(S)),i.push(S)}return{rigs:r,skins:i}}function mt(e){return e.node.matrixWorld.clone().multiply(e.node.bindMatrixInverse).multiply(e.reference)}function vn(e,t,n){let o=new fe,r=new Uo,i=new fe,a=new jn;for(let s of e){let c={time:n,translations:[],rotations:[],scales:[]};s.bones.forEach((l,d)=>s.worlds[d].multiplyMatrices(s.referenceInverse,l.matrixWorld)),s.worlds.forEach((l,d)=>{let f=s.parents[d],u=f<0?l.clone():s.worlds[f].clone().invert().multiply(l);u.decompose(o,r,i),r.normalize(),a.compose(o,r,i);let p=1e-5*Math.max(1,...u.elements.map(Math.abs));if(!u.elements.every(Number.isFinite)||u.elements.some((h,C)=>Math.abs(h-a.elements[C])>p)||Math.abs(u.determinant())<1e-15)throw new Error("The AR skeleton contains a sheared or zero-scale joint that Quick Look cannot preserve. Use arHandoff.createUSDZ for this rig.");c.translations.push(...o.toArray()),c.rotations.push(r.w,r.x,r.y,r.z),c.scales.push(...i.toArray()),s.frames.length||s.restTransforms.push(u)}),s.frames.push(c)}for(let s of t)s.jointBounds.forEach((c,l)=>{c.isEmpty()||s.extent.union(c.clone().applyMatrix4(s.rig.worlds[l]))})}var ft=e=>String(Number(e.toPrecision(9))),ut=e=>{let t=Array.isArray(e)?e:e.elements;return`(${[0,4,8,12].map(n=>`(${t.slice(n,n+4).map(ft).join(", ")})`).join(", ")})`},dt=(e,t)=>Array.from({length:e.length/t},(n,o)=>`(${e.slice(o*t,(o+1)*t).map(ft).join(", ")})`).join(", ");function On(e){let t=(a,s,c=1e-7)=>Math.abs(a-s)>c*Math.max(1,Math.abs(a),Math.abs(s)),n=[["translations",3,"float3"],["rotations",4,"quatf"],["scales",3,"half3"]],o=e.frames[0],r=e.joints.map((a,s)=>s).filter(a=>n.some(([s,c])=>e.frames.some(l=>l[s].slice(a*c,(a+1)*c).some((d,f)=>t(d,o[s][a*c+f])))));r.length||(r=e.joints.map((a,s)=>s));let i=n.map(([a,s,c])=>{let l=e.frames.map(f=>r.flatMap(u=>f[a].slice(u*s,(u+1)*s)));return l.some(f=>f.some((u,p)=>t(u,l[0][p],c==="half3"?1e-4:1e-7)))?`${c}[] ${a}.timeSamples = {${e.frames.map((f,u)=>`${f.time}: [${dt(l[u],s)}]`).join(`,
|
|
3
|
+
`)}}`:`${c}[] ${a} = [${dt(l[0],s)}]`}).join(`
|
|
4
|
+
`);return`#usda 1.0
|
|
5
|
+
(
|
|
6
|
+
defaultPrim = "Skeleton"
|
|
7
|
+
metersPerUnit = 1
|
|
8
|
+
upAxis = "Y"
|
|
9
|
+
timeCodesPerSecond = 30
|
|
10
|
+
framesPerSecond = 30
|
|
11
|
+
)
|
|
12
|
+
def Skeleton "Skeleton" (prepend apiSchemas = ["SkelBindingAPI"]) {
|
|
13
|
+
uniform token[] joints = ${JSON.stringify(e.joints)}
|
|
14
|
+
uniform matrix4d[] bindTransforms = [${e.bindTransforms.map(ut).join(", ")}]
|
|
15
|
+
uniform matrix4d[] restTransforms = [${e.restTransforms.map(ut).join(", ")}]
|
|
16
|
+
rel skel:animationSource = <Animation>
|
|
17
|
+
def SkelAnimation "Animation" {
|
|
18
|
+
uniform token[] joints = ${JSON.stringify(r.map(a=>e.joints[a]))}
|
|
19
|
+
${i}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
`}function Tn(e,t){let n=new Map;for(let o of e){let r=o.target.exported,i=t.get(r.name),a=l=>Math.round(l*1e7)/1e7,s=JSON.stringify([o.rig.name,i?.map(l=>l.matrix.map(a))??r.matrix.elements.map(a)]),c=n.get(s);if(!c){let l=new Do;l.name=`AR_Rig_${n.size}`,l.matrixAutoUpdate=!1,l.matrix.copy(r.matrix),r.parent.add(l),c={node:l,rig:o.rig,skins:[],extent:new lt},n.set(s,c),i&&t.set(l.name,i)}c.node.add(r),r.matrix.identity(),t.delete(r.name),c.skins.push(o),c.extent.union(o.extent)}return[...n.values()]}function In(e){return`
|
|
23
|
+
rel skel:skeleton = <Skeleton>
|
|
24
|
+
rel skel:animationSource = <Skeleton/Animation>
|
|
25
|
+
float3[] extent = [${dt([...e.extent.min.toArray(),...e.extent.max.toArray()],3)}]
|
|
26
|
+
def Skeleton "Skeleton" (prepend references = @./rigs/${e.rig.name}.usda@</Skeleton>) {}
|
|
27
|
+
`}function Rn(e){return`
|
|
28
|
+
over "Geometry" (prepend apiSchemas = ["SkelBindingAPI"]) {
|
|
29
|
+
rel skel:skeleton = <../../Skeleton>
|
|
30
|
+
uniform token[] skel:joints = ${JSON.stringify(e.rig.joints)}
|
|
31
|
+
uniform token primvars:skel:skinningMethod = "classicLinear"
|
|
32
|
+
matrix4d primvars:skel:geomBindTransform = ${ut(e.geomBind)}
|
|
33
|
+
int[] primvars:skel:jointIndices = [${e.jointIndices.join(", ")}] (
|
|
34
|
+
interpolation = "vertex"
|
|
35
|
+
elementSize = 4
|
|
36
|
+
)
|
|
37
|
+
float[] primvars:skel:jointWeights = [${e.jointWeights.map(ft).join(", ")}] (
|
|
38
|
+
interpolation = "vertex"
|
|
39
|
+
elementSize = 4
|
|
40
|
+
)
|
|
41
|
+
}
|
|
42
|
+
`}var se=30,Zo=12e4,Jo=1e6,Bn=new Set(["position","quaternion","rotation","scale"]);function Qo(e){let t=Ce(e.sceneConfig?.sequences??[]).find(l=>l.autoPlay),n=e.sceneConfig?.animations.autoplayClip,o=Cn(e.scene.animations),r=o.find(l=>l.sourceName===n),i=e.sceneConfig?.animations.clips.find(l=>l.sourceName===n),a=i?.speed??1,s=Number.isFinite(a)&&a>0?a:1,c=r&&!i?.hidden?r.duration*(i?.loopMode==="ping-pong"?2:1)/s:0;return{sequence:t,autoplay:n,clips:o,duration:Math.max(c,t?.duration??0)}}function Pn(e,t,n){let o=new Set,r=new Map,i=0,a=0,s=0,c=[],l=[],d=e.map(Qo),f=Math.max(0,...d.map(u=>u.duration));for(let[u,p]of e.entries()){n?.throwIfAborted();let{sequence:h,autoplay:C}=d[u];if(!h&&!C)continue;let S=Ho(p.scene),w=[],A=[];p.scene.traverse(v=>w.push(v)),S.traverse(v=>A.push(v));let y=new Map;w.forEach((v,$)=>{A[$].uuid=v.uuid,y.set(v,A[$]);let z=ke(v);z&&v.isSkinnedMesh&&(delete A[$].userData.reactImmersiveSkinFreeze,je(A[$],z.clone().invert(),At(v)??void 0))});let M=ie(S),j=new Wo;j.matrixAutoUpdate=!1,j.matrix.copy(p.scene.parent?.matrixWorld??new qo),j.add(S),j.updateMatrixWorld(!0);let I=t.filter(v=>v.sourceIndex===u),T=I.some(v=>v.source.isSkinnedMesh),B=new Set(h?.tracks.filter(v=>!v.muted&&v.target.kind==="clip").map(v=>v.target.kind==="clip"?v.target.clip:"")??[]);C&&B.add(C);let g=d[u].clips.map(v=>{if(!B.has(v.sourceName))return v;let $=v.clip.tracks.filter(z=>{let _=En.parseTrackName(z.name),Y=En.findNode(S,_.nodeName),V=!!Y&&Bn.has(_.propertyName)&&(Y?.type!=="Bone"||T)&&!_.objectName;return V||o.add(Y?.type==="Bone"?"Skeletal tracks without an exported skinned mesh are omitted.":"Quick Look exports object and skeletal motion. Morph and other unsupported clip tracks keep their captured pose."),V});return{...v,clip:new Fo(v.clip.name,v.duration,$)}}),m=v=>p.sceneConfig?.animations.clips.find($=>$.sourceName===v),b=yn({root:S,clips:g,getClipConfig:m,onChange(){}}),x={...b,clips:g.map(v=>v.sourceName)},k=Mn({root:()=>S,controls:()=>null,animations:()=>x,invalidate(){},cameraEnabled:()=>!1}),R=h?.tracks.filter(v=>{if(!T&&v.target.kind==="object"&&M.nodesById[v.target.objectId]?.type==="Bone")return v.muted||o.add("Quick Look keeps skeletal deformation at its captured pose."),!1;let $=v.target.kind==="clip"||v.target.kind==="object"&&Bn.has(v.target.property);return!$&&!v.muted&&o.add("Quick Look exports sequence object motion. Camera, visibility and appearance tracks stay in WebXR."),$}),N=h?{...h,tracks:R??[]}:void 0;N&&k.inspect(N).forEach(v=>o.add(v));let E=g.some(v=>B.has(v.sourceName)&&v.clip.tracks.length&&!m(v.sourceName)?.hidden),D=R?.some(v=>!v.muted&&v.keyframes.length&&v.target.kind==="object");if(!E&&!D){b.dispose();continue}let G=kn(I,y,j.matrix,`Skin_${u}`),ee=new Map(G.skins.map(v=>[v.target,v])),K=f,Q=Math.ceil(K*se);if(a+=(Q+1)*I.length,s+=(Q+1)*G.rigs.reduce((v,$)=>v+$.joints.length,0),!Number.isFinite(K)||a>Zo||s>Jo)throw b.dispose(),new Error("This animation is too large for browser USDZ conversion. Use arHandoff.createUSDZ for this model.");let pe=Object.entries(p.objectBindings??{}).flatMap(([v,$])=>{if(!$.transform)return[];let z=M.nodesById[$.modelObjectId??v];return z?[{node:z,matrix:z.matrix.clone(),position:z.position.clone(),quaternion:z.quaternion.clone(),scale:z.scale.clone()}]:[]}),U=I.map(v=>({target:v,node:y.get(v.source),inverse:v.bakedMatrix.clone().invert(),frames:[]}));try{C&&b.play(C);let v=0;for(let $=0;$<=Q;$++){n?.throwIfAborted();let z=Math.min($/se,K);b.update(z-v),v=z;for(let _ of pe)_.node.position.copy(_.position),_.node.quaternion.copy(_.quaternion),_.node.scale.copy(_.scale),_.node.matrix.copy(_.matrix);if(N){let _=N.loop&&z>N.duration?z%N.duration:Math.min(z,N.duration);k.apply({sequence:N,time:_,playing:!1})}j.updateMatrixWorld(!0),vn(G.rigs,G.skins,z*se);for(let _ of U){let Y=ee.get(_.target),V=Y?mt(Y):_.node.matrixWorld.clone().multiply(_.target.instanceMatrix).multiply(_.inverse);if(!V.elements.every(Number.isFinite)||V.determinant()<=0)throw new Error("Quick Look animation cannot preserve a reflected or zero-scale transform. Use arHandoff.createUSDZ.");_.frames.push({time:z*se,matrix:V.toArray()})}}for(let $ of U){let z=$.frames[0]?.matrix;z&&$.frames.some(_=>_.matrix.some((Y,V)=>Math.abs(Y-z[V])>1e-8))&&(r.set($.target.exported.name,$.frames),i=Math.max(i,K))}if(G.skins.length){for(let $ of G.skins)$.extent.expandByScalar(Math.max(1e-6,$.extent.getSize(new Go).length()*.001));c.push(...G.rigs),l.push(...G.skins),i=Math.max(i,K)}}finally{k.restore(),b.dispose()}}return{samples:r,rigs:c,skins:l,duration:i,warnings:[...o]}}function Vn(e,t,n){if(!t.samples.size&&!t.skins.length)return e;let o=Ko(e),r=Xo(o["model.usda"]);r=r.replace(" metersPerUnit = 1",` startTimeCode = 0
|
|
43
|
+
endTimeCode = ${t.duration*se}
|
|
44
|
+
timeCodesPerSecond = ${se}
|
|
45
|
+
framesPerSecond = ${se}
|
|
46
|
+
autoPlay = true
|
|
47
|
+
metersPerUnit = 1`);for(let[s,c]of t.samples){let l=new RegExp(`(def Xform "${s}"[\\s\\S]*?\\n[\\t ]*)matrix4d xformOp:transform = [^\\n]+`);if(!l.test(r))throw new Error("The USDZ exporter produced an unsupported animation layout.");let d=c.map(f=>{let u=[0,4,8,12].map(p=>`(${f.matrix.slice(p,p+4).join(", ")})`);return`${f.time}: (${u.join(", ")})`}).join(`,
|
|
48
|
+
`);r=r.replace(l,(f,u)=>`${u}matrix4d xformOp:transform.timeSamples = {
|
|
49
|
+
${d}
|
|
50
|
+
}`)}for(let s of t.rigs)o[`rigs/${s.name}.usda`]=pt(On(s));for(let s of n){let c=new RegExp(`def Xform "${s.node.name}"(\\s*\\{)`);if(!c.test(r))throw new Error("The USDZ exporter produced an unsupported skeleton root layout.");r=r.replace(c,`def SkelRoot "${s.node.name}" (prepend apiSchemas = ["SkelBindingAPI"]) $1${In(s)}`)}for(let s of t.skins){let c=new RegExp(`def Xform "${s.target.exported.name}"(\\s*\\([\\s\\S]*?\\)\\s*\\{)`);if(!c.test(r))throw new Error("The USDZ exporter produced an unsupported skeleton layout.");r=r.replace(c,(l,d)=>`def Xform "${s.target.exported.name}"${d}${Rn(s)}`)}o["model.usda"]=pt(r);let i={},a=0;for(let[s,c]of Object.entries(o)){a+=34+pt(s).length;let l=a&63;i[s]=l===4?c:[c,{extra:{12345:new Uint8Array(64-l)}}],a=c.length}return Yo(i,{level:0})}function ir(e,t={}){t.signal?.throwIfAborted();let n=new zn,o=new zn;n.add(o);let r=new Set,i=[],a=[],s=[],c=new Map,l=[],d=0,f=0,u=()=>{i.forEach(p=>p.dispose()),a.forEach(p=>p.dispose()),s.forEach(p=>p.dispose())};try{for(let[w,{scene:A,objectBindings:y={},materialOverrides:M={}}]of e.entries()){pn(A),A.updateWorldMatrix(!0,!0);let j=new Map(Object.entries(y).map(([I,T])=>[T.modelObjectId??I,I]));A.traverse(I=>{let T=I;if(!T.isMesh||!T.geometry)return;for(let k=I;k;k=k.parent){let R=Me(k)??k.name??k.uuid;if(!k.visible||y[j.get(R)??R]?.visible===!1||y[j.get(R)??R]?.removed)return}let B=Me(T)??T.name??T.uuid,g=M[j.get(B)??B]??T.material;if(!g)throw new Error(`Material for ${B} is not ready. Wait for the model to finish loading.`);let m=Array.isArray(g)?g:[g],b=T.isInstancedMesh?T.count:1;if(T.userData.riDecal&&ge(T)&&T.parent){let k=ke(T.parent);k&&T.bindMatrixInverse.copy(k)}let x=ge(T)?Ct(T):T.geometry.clone();try{if(!ge(T)&&T.morphTargetInfluences?.some(N=>N!==0)){let N=x.getAttribute("position"),E=new $e;for(let D=0;D<N.count;D++)T.getVertexPosition(D,E),N.setXYZ(D,E.x,E.y,E.z);x.morphAttributes={},x.computeVertexNormals()}if(!x.getAttribute("position"))throw new Error(`Mesh ${B} has no positions.`);let k=x.index?.count??x.getAttribute("position").count,R=Array.isArray(g)?x.groups:[{start:0,count:k,materialIndex:0}];if(!R.length)throw new Error(`Mesh ${B} has multiple materials without geometry groups.`);for(let N=0;N<b;N++){let E=T.matrixWorld.clone(),D=new or;T.isInstancedMesh&&(T.getMatrixAt(N,D),E.multiply(D));for(let G of R){let ee=m[G.materialIndex??0];if(!ee)throw new Error(`A material group on ${B} is missing its material.`);if(!ee.visible)continue;let K=ee;if(!K.isMeshStandardMaterial||K.wireframe||K.vertexColors)throw new Error(`AR snapshot cannot preserve ${ee.type}${K.wireframe?" wireframe":K.vertexColors?" vertex colors":""} on ${B}. Use a PBR material or provide arHandoff.createUSDZ.`);let Q=Math.max(G.start,x.drawRange.start),pe=Math.min(k,G.start+G.count,x.drawRange.start+x.drawRange.count);if(pe<=Q)continue;if(Q%3||(pe-Q)%3)throw new Error(`Mesh ${B} has an incomplete triangle range.`);let U=new Nn;i.push(U);let v=Array.from({length:pe-Q},(V,L)=>x.index?x.index.getX(Q+L):Q+L);if(E.determinant()<0)for(let V=0;V<v.length;V+=3)[v[V+1],v[V+2]]=[v[V+2],v[V+1]];for(let[V,L]of Object.entries(x.attributes)){let F=new Float32Array(v.length*L.itemSize);for(let P=0;P<v.length;P++)for(let H=0;H<L.itemSize;H++)F[P*L.itemSize+H]=L.getComponent(v[P],H);U.setAttribute(V,new De(F,L.itemSize))}ge(T)&&(U.setAttribute("arSourceVertex",new De(new Float32Array(v),1)),U.setAttribute("arNormalSign",new De(new Float32Array(v.length).fill(1),1))),U.setIndex(v.map((V,L)=>L)),U.applyMatrix4(E);let $=U.getAttribute("position");for(let V=0;V<$.count;V++)if(![$.getX(V),$.getY(V),$.getZ(V)].every(Number.isFinite))throw new Error(`Mesh ${B} contains invalid coordinates.`);U.getAttribute("normal")||U.computeVertexNormals();let z=K.clone();a.push(z);let _=K.userData.reactImmersiveConfiguredEmissive;if(_?.isColor&&z.emissive.copy(_),z.side===nr){let V=U.toNonIndexed();i.push(V);let L=V.getAttribute("position").count,F=new Nn;i.push(F);for(let[P,H]of Object.entries(V.attributes)){let _e=new Float32Array(L*H.itemSize*2);for(let ne=0;ne<L;ne++)for(let ce=0;ce<H.itemSize;ce++){_e[ne*H.itemSize+ce]=H.getComponent(ne,ce);let Gn=Math.floor(ne/3)*3+(2-ne%3);_e[(L+ne)*H.itemSize+ce]=H.getComponent(Gn,ce)*(P==="normal"||P==="arNormalSign"?-1:1)}F.setAttribute(P,new De(_e,H.itemSize))}z.side=gt,U.copy(F)}else if(z.side!==gt){let V=U.getIndex();for(let P=0;P<V.count;P+=3){let H=V.getX(P+1);V.setX(P+1,V.getX(P+2)),V.setX(P+2,H)}let L=U.getAttribute("normal");for(let P=0;P<L.count;P++)L.setXYZ(P,-L.getX(P),-L.getY(P),-L.getZ(P));let F=U.getAttribute("arNormalSign");if(F)for(let P=0;P<F.count;P++)F.setX(P,-F.getX(P));z.side=gt}if(T.isInstancedMesh&&T.instanceColor){let V=new tr;T.getColorAt(N,V),z.color.multiply(V)}for(let[V,L]of Object.entries(z)){if(!L?.isTexture)continue;let F=L;if(Zt(F)||!F.image||F.image.complete===!1)throw new Error(`Texture on ${B} is not ready. Wait for image loading or replace failed textures before preparing AR.`);let P=c.get(F);if(P||(P=F.clone(),c.set(F,P),s.push(P)),z[V]=P,!U.getAttribute(P.channel?`uv${P.channel}`:"uv"))throw new Error(`Texture on ${B} needs UV coordinates missing from this geometry.`)}if(T.userData.riDecal){U.computeBoundingBox();let V=Math.max(1e-6,U.boundingBox.getSize(new $e).length()*1e-4),L=U.getAttribute("position"),F=U.getAttribute("normal");for(let P=0;P<L.count;P++)L.setXYZ(P,L.getX(P)+F.getX(P)*V,L.getY(P)+F.getY(P)*V,L.getZ(P)+F.getZ(P)*V)}let Y=new rr(U,z);Y.name=`AR_${d++}`,o.add(Y),l.push({sourceIndex:w,source:T,exported:Y,bakedMatrix:E.clone(),instanceMatrix:D}),f+=(U.index?.count??U.getAttribute("position").count)/3,(z.clearcoat||z.transmission||z.iridescence||z.anisotropy)&&r.add("Advanced PBR effects may look different in Quick Look.")}}}finally{x.dispose()}})}if(!d||!f)throw new Error("There is no visible model geometry to send to AR.");let p=new er().setFromObject(o),h=p.getSize(new $e),C=p.getCenter(new $e),S=t.scaleMode==="real-world"?1:1/Math.max(h.x,h.y,h.z,1e-9);return o.position.set(-C.x*S,-p.min.y*S,-C.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:d,triangleCount:f,scale:S,warnings:[...r],textures:s,motionMeshes:l,dispose:u}}catch(p){throw u(),p}}async function $s(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=ir(e,t),r=[];try{let i=Pn(e,o.motionMeshes,t.signal),a=Tn(i.skins,i.samples);o.root.updateMatrixWorld(!0);let{USDZExporter:s}=await import("three/examples/jsm/exporters/USDZExporter.js");t.signal?.throwIfAborted();for(let d of o.textures){if(!d.isCompressedTexture)continue;let{decompress:f}=await import("three/examples/jsm/utils/WebGLTextureUtils.js"),u=f(d,n);r.push(u),o.root.traverse(p=>{let h=p.material;if(h)for(let C of Object.keys(h))h[C]===d&&(h[C]=u)})}let c=await new s().parseAsync(o.root,{onlyVisible:!0,quickLookCompatible:!0,maxTextureSize:n});t.signal?.throwIfAborted();let l=Vn(c,i,a);return{blob:new Blob([new Uint8Array(l)],{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 a=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"}${a}`)}finally{o.dispose(),r.forEach(i=>i.dispose())}}var Le=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."}]),Us="__custom__";function sr(e){return Le.find(t=>t.id===e)}var $n=Le.filter(e=>e.handling==="viewer").map(e=>e.id),ar=new Set(["","New Action",...Le.map(e=>e.label)]);function _s(e){return ar.has(e.trim())}function Dn(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 a=n[i-1]+(e[o-1]===t[i-1]?0:1);r[i]=Math.min(r[i-1]+1,n[i]+1,a)}n=r}return n[t.length]}function Fs(e){if(sr(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 Le){let i=Math.min(Dn(t,r.id),Dn(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 cr=.12,Ln=new Set;function lr(e,t){return t?new Set(ve(e,t.target)):Ln}function Gs(e,t){let n=lr(e.bindings,t);if(!t||n.size===0)return{...e,setAside:Ln};let o=Math.min(Math.max(t.ghostOpacity??cr,0),1),r={...e.bindings},i=new WeakMap,a=new Set;for(let[s,c]of Object.entries(e.bindings)){if(n.has(s))continue;a.add(s);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[s]=l,i.set(l,e.sourceOf(c))}return{bindings:r,pulses:e.pulses,sourceOf:s=>i.get(s)??e.sourceOf(s),setAside:a}}function ur(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 dr(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 mr(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 Un(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 _n(e,t=!0){let n=mr(e);return{id:ur(e),modelObjectId:e,type:n,label:dr(e),status:"normal",selectable:!0,hoverable:!0,visible:!0,style:{},actions:Un(n,t),metrics:{},metadata:{}}}function Zs(e,t){return Object.fromEntries(e.map(n=>[n,_n(n,!t?.has(n))]))}function Js(e,t){let n=new Set,o={};for(let r of e){let i=_n(r,!t?.has(r)),a=i.id||"object",s=a;for(let l=2;n.has(s);l++)s=`${a}-${l}`;n.add(s),i.id=s;let c=(i.actions??[]).filter(l=>$n.includes(l.id));i.actions=c.length>0?c:Un("other",!t?.has(r)),o[r]=i}return o}function Qs(e){let t=new Set;for(let[n,o]of Object.entries(ie(e).nodesById))kt(o)||t.add(n);return t}function ea(e){let{nodesById:t}=ie(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 qn={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"},fr=Object.keys(qn),pr=new Set(["__proto__","prototype","constructor"]);function ae(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=>ae(o,t)):Object.fromEntries(Object.entries(e).filter(([o,r])=>!pr.has(o)&&r!==void 0).map(([o,r])=>[o,ae(r,t)]));return t.delete(e),n}var Fn=e=>e&&typeof e=="object"&&!Array.isArray(e)&&!Object.keys(e).length;function Wn(e,t){let n=ae(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(),Fn(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"])Fn(n[o])&&delete n[o];for(let o of["actions","decals"])Array.isArray(n[o])&&!n[o].length&&delete n[o];return n}function Ue(e,t,n,o,r,i){let a=c=>c===void 0||Array.isArray(c)&&c.length===0;if(Object.is(e,t)||a(e)&&a(t)||typeof e=="number"&&typeof t=="number"&&Math.abs(e-t)<=r)return;let s=c=>!!c&&typeof c=="object"&&!Array.isArray(c);if(s(e)&&s(t)){for(let c of[...new Set([...Object.keys(e),...Object.keys(t)])].sort())Ue(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++)Ue(e[c],t[c],`${n}[${c}]`,o,r,i);return}i.push({path:n,category:o,...e!==void 0?{before:ae(e)}:{},...t!==void 0?{after:ae(t)}:{}})}function na(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(([,w])=>!w.removed),i=Object.entries(t.objectBindings).filter(([,w])=>!w.removed),a=new Map(r),s=new Map(i),c=new Set,l=new Set,d=[],f=w=>{let A=n.matchBy??"modelObjectId",y=typeof A=="object"?w.metadata?.[A.metadataKey]:w[A];return typeof y=="string"&&y.length>0||typeof y=="number"?`${typeof y}:${y}`:null};function u(w,A,y){let M=w===void 0?void 0:a.get(w),j=A===void 0?void 0:s.get(A),I=[];if(M||j){let B=M?Wn(M,n.ignoreMetadataKeys??[]):{},g=j?Wn(j,n.ignoreMetadataKeys??[]):{};for(let m of fr)Ue(B[m],g[m],m,qn[m],o,I)}let T=M?j?I.length?"modified":"unchanged":"removed":"added";d.push({id:JSON.stringify([w??null,A??null]),identity:y,label:j?.label??M?.label??j?.modelObjectId??M?.modelObjectId??y,status:T,beforeKey:w,afterKey:A,beforeObjectId:M?.modelObjectId,afterObjectId:j?.modelObjectId,changes:I}),w!==void 0&&c.add(w),A!==void 0&&l.add(A)}let p=new Set;for(let[w,A]of Object.entries(n.mapping??{})){if(!a.has(w)||!s.has(A)||p.has(A))throw new Error("Comparison mapping must reference existing, unique binding keys");p.add(A),u(w,A,`mapped:${w}`)}let h=new Map;for(let[w,A,y]of[[r,c,"a"],[i,l,"b"]])for(let[M,j]of w){if(A.has(M))continue;let I=f(j);if(I===null){d.push({id:JSON.stringify([y,M]),identity:"",label:j.label??j.modelObjectId,status:"ambiguous",...y==="a"?{beforeKey:M,beforeObjectId:j.modelObjectId}:{afterKey:M,afterObjectId:j.modelObjectId},changes:[],message:"Missing match identity. Supply an explicit mapping or another match field."});continue}let T=h.get(I)??{a:[],b:[]};T[y].push(M),h.set(I,T)}for(let[w,A]of h){if(A.a.length<=1&&A.b.length<=1){u(A.a[0],A.b[0],w);continue}for(let y of["a","b"])for(let M of A[y]){let j=(y==="a"?a:s).get(M);d.push({id:JSON.stringify([y,M]),identity:w,label:j.label??j.modelObjectId,status:"ambiguous",...y==="a"?{beforeKey:M,beforeObjectId:j.modelObjectId}:{afterKey:M,afterObjectId:j.modelObjectId},changes:[],message:"Duplicate match identity. Supply an explicit one-to-one mapping."})}}d.sort((w,A)=>w.label.localeCompare(A.label)||w.id.localeCompare(A.id));let C=[];Ue(ae(e.sceneConfig??{}),ae(t.sceneConfig??{}),"sceneConfig","scene",o,C);let S={added:0,removed:0,modified:0,unchanged:0,ambiguous:0};for(let w of d)S[w.status]++;return{version:1,objects:d,counts:S,sceneChanges:C}}function oa(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 ia=["front","back","double"],sa=["normal","additive"];function la(e){ie(e);let t=[],n=[{node:e,path:"0",parentId:null}];for(;n.length;){let{node:r,path:i,parentId:a}=n.pop(),s=`node:${i}`,c=r.isMesh&&r.name?Me(r):null;t.push({id:s,parentId:a,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:s})}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 ma(e){return structuredClone(e.style??{})}function fa(e,t,n){let o=ve(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{ie as a,Me as b,Zi as c,Ji as d,gn as e,gr as f,hr as g,Ot as h,wr as i,Rt as j,te as k,Er as l,zo as m,at as n,xn as o,Mn as p,et as q,pi as r,gi as s,bi as t,hi as u,Be as v,yi as w,Si as x,So as y,xi as z,wi as A,Ai as B,Mi as C,Ci as D,ji as E,ki as F,Pr as G,Vr as H,Nr as I,zr as J,Dr as K,$r as L,Lr as M,Ge as N,de as O,he as P,Fr as Q,Wr as R,qr as S,Xr as T,He as U,ye as V,Kr as W,Yr as X,Zr as Y,Jr as Z,$t as _,Lt as $,Ut as aa,Ke as ba,ti as ca,ni as da,oi as ea,ri as fa,mo as ga,Ze as ha,po as ia,ai as ja,ci as ka,qt as la,go as ma,Se as na,li as oa,ui as pa,Gt as qa,re as ra,Ni as sa,Pe as ta,sn as ua,_i as va,Fi as wa,Io as xa,Wi as ya,qi as za,Gi as Aa,Xi as Ba,pn as Ca,yn as Da,Cn as Ea,$s as Fa,Le as Ga,Us as Ha,sr as Ia,$n as Ja,_s as Ka,Fs as La,lr as Ma,Gs as Na,mr as Oa,_n as Pa,Zs as Qa,Js as Ra,Qs as Sa,ea as Ta,na as Ua,oa as Va,ia as Wa,sa as Xa,la as Ya,ma as Za,fa as _a};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as o}from"./chunk-
|
|
1
|
+
import{b as o}from"./chunk-LKKH4PO7.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};
|
|
@@ -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",arAnimationSaved:"Project autoplay",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};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as n}from"./chunk-MMO7KCYU.mjs";import{v as i}from"./chunk-
|
|
1
|
+
import{a as n}from"./chunk-MMO7KCYU.mjs";import{v as i}from"./chunk-U3BQMOC3.mjs";var c={licenseKey:!0,arHandoff:!0,mobileHandoffUrl:!0,dracoDecoderPath:!0,ktx2TranscoderPath:!0,meshopt:!0,hideLicenseCheckingOverlay:!0},d={licenseValidationUrl:!0,arLanding:!0,gizmoTool:!0,showFloorGrid:!0,onObjectEditLeaseChange:!0,onSelectionClear:!0,onSceneLoaded:!0,onTexturePositioningChange:!0,endTexturePositioningRef:!0};function f(e,t){let o={};for(let r of Object.keys(t))r in e&&(o[r]=e[r]);return o}function s(e,t){let o={...e};for(let r of Object.keys(t))delete o[r];return o}import{jsx as a}from"react/jsx-runtime";function l(e){return n("model-viewer","ModelViewer"),a(i,{...s(e,d)})}export{c as a,f as b,l as c};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as o,c as t}from"./chunk-
|
|
1
|
+
import{b as o,c as t}from"./chunk-EC542N4J.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};
|