@liveroom-tech/react-immersive 6.0.1 → 6.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/dist/binding-builder.js +18 -18
- package/dist/binding-builder.mjs +1 -1
- package/dist/{chunk-VQGYZOMX.mjs → chunk-33SUWPXC.mjs} +2 -2
- package/dist/{chunk-UGPR4EPP.mjs → chunk-EIBW7ZJE.mjs} +1 -1
- package/dist/{chunk-2JFUMJUP.mjs → chunk-KFTJMFYF.mjs} +1 -1
- package/dist/hosted.js +17 -17
- package/dist/hosted.mjs +1 -1
- package/dist/index.js +1 -1
- package/dist/index.mjs +1 -1
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{A as Cy,B as Ty,C as Qa,D as ec,E as tc,F as rc,G as nc,H as Ry,I as ky,J as Iy,K as By,a as _b,b as de,c as Kl,d as Jb,e as Zb,f as ey,h as iy,i as Tp,k as Pp,l as oy,m as ay,n as Ql,o as Ya,p as ui,q as sy,r as ly,s as cy,t as uy,u as dy,v as py,w as my,x as _p,y as hy,z as fy}from"./chunk-OTSCPJWF.mjs";import{$ as jb,A as Rb,Aa as Qb,B as Gl,C as kb,D as Db,Ea as Ep,K as qa,L as Ob,La as Dy,Ma as Oy,N as xp,Na as Ly,O as Lb,R as Ee,Ra as jy,Sa as Ny,Ta as zy,X as Hl,Y as Ib,Z as Wl,_ as Bb,a as si,aa as Nb,b as li,ba as zb,c as vb,ca as Vb,d as xb,da as ql,e as on,ea as Fb,fa as Xl,ga as Xa,ha as Ub,ia as wp,j as Nl,ja as $l,k as wb,ka as Gb,la as Hb,m as zo,ma as Wb,n as Fo,o as Qi,p as Eb,q as Ab,ra as qb,s as zl,sa as Yl,ua as Mp,v as Vl,va as Xb,w as Uo,wa as $b,x as Cn,xa as Yb,y as Fl,ya as Sp,z as Ul,za as Kb}from"./chunk-4JMJALRO.mjs";import{A as by,B as yy,C as vy,D as xy,E as wy,F as Ka,G as Zl,H as My,I as Sy,J as Py,K as _y,L as Ey,M as Go,P as Ay,Q as Ap,a as nr,b as an,c as Vo,d as ci,e as Mb,f as Sb,g as Fr,h as Cb,i as Tb,k as Pb,m as ty,n as $a,o as Cp,q as ry,r as ny,s as gy,v as Ft,w as di,x as Jl,y as Ur,z as vt}from"./chunk-V7WZUWJ5.mjs";import{a as vp}from"./chunk-JR557W27.mjs";import{useCallback as lr,useRef as Xo,useState as $y}from"react";import{Vector3 as Yy}from"three";var Rp=new WeakSet;function Ho(e){Rp.add(e)}function Vy(e){let t=Rp.has(e);return t&&Rp.delete(e),t}var kp=new WeakSet;function Fy(e,t){t?kp.add(e):kp.delete(e)}function Wo(e,t){return kp.has(e)?0:t}import{Box3 as Wy,Matrix4 as nP,PerspectiveCamera as qy,Vector3 as Lp}from"three";import{Vector3 as Uy}from"three";function Dp(e){if(!e?.trim()||/[\u0000-\u001f\u007f]/.test(e))return null;try{let t=new URL(e.trim(),"https://annotation.invalid/");return t.protocol==="https:"||t.protocol==="http:"?e.trim():null}catch{return null}}function Op(e){return e.category?.trim()??""}function Gy(e,t){if(t===null)return e;let r=new Set(t.map(n=>n.trim()));return e.filter(n=>r.has(Op(n)))}function Hy(e,t){let r=Number.isFinite(e.minDistance)?Math.max(0,e.minDistance):0,n=Number.isFinite(e.maxDistance)?Math.max(0,e.maxDistance):1/0;return t>=r&&t<=n}function ic(e){return!!e&&[e.position,e.target].every(t=>Array.isArray(t)&&t.length===3&&t.every(Number.isFinite))}function qo(e){let t=e.camera;return{position:e.getPosition(new Uy,!1).toArray(),target:e.getTarget(new Uy,!1).toArray(),azimuthAngle:e.azimuthAngle,polarAngle:e.polarAngle,fov:"fov"in t?Number(t.fov):null,zoom:t.zoom}}function Ja(e,t){ic(t)&&(e.setLookAt(...t.position,...t.target,!0),Number.isFinite(t.azimuthAngle)&&Number.isFinite(t.polarAngle)&&e.rotateTo(t.azimuthAngle,t.polarAngle,!0),Ji(e,t))}function Ji(e,t){let r=!1;t.fov!=null&&Number.isFinite(t.fov)&&t.fov>0&&t.fov<180&&"fov"in e.camera&&(e.camera.fov=t.fov,e.camera.updateProjectionMatrix(),r=!0),t.zoom!=null&&Number.isFinite(t.zoom)&&t.zoom>0&&e.zoomTo(t.zoom,!0),r&&e.dispatchEvent({type:"update"})}function Xy(e,t){let r=qo(e);if(!(e.camera instanceof qy)||!t)return r;let n=t instanceof Wy?t:new Wy().setFromObject(t);return n.isEmpty()||(r.framing={aspect:e.camera.aspect,min:n.min.toArray(),max:n.max.toArray()}),r}function oc(e,t){let r=t.camera,n=e.framing;if(!(r instanceof qy)||!n||!(r.aspect>0)||Math.abs(r.aspect-n.aspect)<1e-6)return[...e.position];let i=new Lp(...e.position),o=new Lp(...e.target),a=i.clone().sub(o).normalize(),s=new nP().lookAt(i,o,r.up).invert(),l=Math.tan((e.fov??r.fov)*Math.PI/360)/(e.zoom??r.zoom);if(!(l>0)||!Number.isFinite(l))return[...e.position];let u=0;for(let d of[n.min[0],n.max[0]])for(let p of[n.min[1],n.max[1]])for(let c of[n.min[2],n.max[2]]){let h=new Lp(d,p,c).sub(i).applyMatrix4(s);u=Math.max(u,Math.abs(h.x)/(l*r.aspect)+h.z,Math.abs(h.y)/l+h.z)}return i.addScaledVector(a,u*1.02).toArray()}function Ky(e){return[e.x,e.y,e.z]}function Gr(e,t){let r=new Yy,n=new Yy;return t.getPosition(r),t.getTarget(n),{position:Ky(r),target:Ky(n),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 iP(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 Za(e,t,r=.6){let n=e.smoothTime;e.smoothTime=Wo(e,r);try{return await t()}finally{e.smoothTime=n}}function NB(e={}){let t=Xo(e);t.current=e;let r=Xo(null),[n,i]=$y(null),[o,a]=$y(()=>({...e.presets})),s=Xo(o);s.current=o;let l=lr(S=>{i(C=>iP(C,S)?C:S)},[]),u=lr(S=>{l(S)},[l]),d=Xo(null),p=Xo(null),c=Xo(null),h=lr(S=>{r.current=S;let C=Gr(S.raw.controls.camera,S.raw.controls);l(C),S.raw.scene!==p.current&&(p.current=S.raw.scene,d.current=null,c.current=null),S.homeCameraState&&!d.current&&(d.current=S.homeCameraState);let{initialPosition:T,initialTarget:A,initialTransition:R=!1}=t.current;if((T||A)&&S.raw.scene&&(T||S.homeCameraState)&&c.current!==S.raw.controls){c.current=S.raw.controls,S.homeCameraState||Ho(S.raw.controls);let L=T??C.position,N=A??C.target;S.raw.controls.setLookAt(L[0],L[1],L[2],N[0],N[1],N[2],R).then(()=>{if(r.current?.raw.controls!==S.raw.controls)return;let I=Gr(S.raw.controls.camera,S.raw.controls);d.current={position:I.position,target:I.target},l(I)}).catch(()=>{})}},[l]),m=lr(async()=>{let S=r.current,C=S?.raw.controls;if(!C)return!1;try{let T=d.current;if(T){Ji(C,T);let A=oc(T,C);await Za(C,()=>C.setLookAt(A[0],A[1],A[2],T.target[0],T.target[1],T.target[2],!0))}else S?.raw.scene?await Za(C,()=>C.fitToBox(S.raw.scene,!0,{paddingTop:.5,paddingBottom:.5,paddingLeft:.5,paddingRight:.5})):await Za(C,()=>C.reset(!0));return!0}catch{return!1}},[]),y=lr(async()=>{let S=r.current;if(!S?.raw.controls||!S.raw.scene)return!1;try{return await Za(S.raw.controls,()=>S.raw.controls.fitToBox(S.raw.scene,!0,{paddingTop:.5,paddingBottom:.5,paddingLeft:.5,paddingRight:.5})),!0}catch{return!1}},[]),v=lr(async S=>{let C=r.current;if(!C?.raw.controls)return!1;let T=zo(C.objectBindings,S);if(!T)return!1;let A=C.raw.nodes[T];if(!A)return!1;try{return await Za(C.raw.controls,()=>C.raw.controls.fitToBox(A,!0,{paddingTop:.5,paddingBottom:.5,paddingLeft:.5,paddingRight:.5})),!0}catch{return!1}},[]),M=lr(async(S,C=!0)=>{let T=r.current?.raw.controls;if(!T)return!1;try{return r.current?.homeCameraState||Ho(T),await T.setTarget(S[0],S[1],S[2],C),l(Gr(T.camera,T)),!0}catch{return!1}},[l]),g=lr(async(S,C=!0)=>{let T=r.current?.raw.controls;if(!T)return!1;try{r.current?.homeCameraState||Ho(T);let A=[T.setLookAt(S.position[0],S.position[1],S.position[2],S.target[0],S.target[1],S.target[2],C)];S.azimuthAngle!=null&&S.polarAngle!=null&&A.push(T.rotateTo(S.azimuthAngle,S.polarAngle,C)),await Promise.all(A);let R=T.camera,L=!1;return S.fov!=null&&"fov"in R&&typeof R.fov=="number"&&(R.fov=S.fov,L=!0),S.zoom!=null&&"zoom"in R&&typeof R.zoom=="number"&&(R.zoom=S.zoom,L=!0),L&&"updateProjectionMatrix"in R&&R.updateProjectionMatrix(),l(Gr(R,T)),!0}catch{return!1}},[l]),f=lr((S,C=!0)=>g(S,C),[g]),x=lr((S,C,T=!0)=>g({position:S,target:C},T),[g]),P=lr(async(S,C,T=!0)=>{let A=r.current?.raw.controls;if(!A)return!1;try{return r.current?.homeCameraState||Ho(A),await A.rotateTo(S*Math.PI/180,C*Math.PI/180,T),l(Gr(A.camera,A)),!0}catch{return!1}},[l]),b=lr(async(S,C=!0)=>{let T=r.current?.raw.controls;if(!T)return!1;try{return r.current?.homeCameraState||Ho(T),await T.dollyTo(S,C),l(Gr(T.camera,T)),!0}catch{return!1}},[l]),E=lr(S=>{let C=r.current?.raw.controls,T=S.trim();if(!C||!T)return null;let A=Gr(C.camera,C);return s.current={...s.current,[T]:A},a(R=>({...R,[T]:A})),l(A),A},[l]),_=lr((S,C=!0)=>{let T=s.current[S];return T?g(T,C):Promise.resolve(!1)},[g]);return{cameraState:n,cameraPresets:o,resetView:m,focusObject:v,fitScene:y,setCameraTarget:M,setCameraState:f,lookAt:x,orbitTo:P,dollyTo:b,savePreset:E,goToPreset:_,handleCameraChange:u,handleViewerReady:h}}var Qy={showObjectBindingDataPanel:!1,showSceneObjectsPanel:!1,showDownloadButton:!1,showResetButton:!1,showAnnotationNavigation:!1,showMaterialVariants:!1},oP=Object.freeze({minimal:Object.freeze({...Qy}),showcase:Object.freeze({...Qy,autoRotate:!0}),configurator:Object.freeze({showObjectBindingDataPanel:!0,showSceneObjectsPanel:!1,showDownloadButton:!1,showResetButton:!0,showMaterialVariants:!0}),inspector:Object.freeze({showObjectBindingDataPanel:!0,showSceneObjectsPanel:!0,showDownloadButton:!0,showResetButton:!0,showViewGizmo:!0,showMeasureTools:!0,showUvCheckerButton:!0,showExplodeControls:!0,showSectionTools:!0,showIsolateControls:!0,enableKeyboardNavigation:!0})}),aP=["preset","ui","tools","controls","perf","tiles","xr","decoders"];function Jy(e){let t={};for(let r of Object.keys(e))e[r]!==void 0&&(t[r]=e[r]);return t}function sP({ui:e,tools:t,controls:r,perf:n,tiles:i,xr:o,decoders:a}){let s=e?.download,l=e?.mouseController,u=t?.measure,d=r?.autoRotate;return{showObjectBindingDataPanel:e?.objectPanel,showSceneObjectsPanel:e?.sceneObjects,showDownloadButton:s===void 0?void 0:s!==!1,downloadFilename:typeof s=="string"?s:void 0,showResetButton:e?.reset,showFullscreenButton:e?.fullscreen,showLoadingOverlay:e?.loadingOverlay,showViewGizmo:e?.viewGizmo,showMouseController:l===void 0?void 0:l!==!1,mouseControllerPosition:typeof l=="object"?l.position:void 0,mouseControllerOpacity:typeof l=="object"?l.opacity:void 0,showAnnotationNavigation:e?.annotationNavigation,showAnnotationOnHover:e?.annotationOnHover,showAnnotationFilters:e?.annotationFilters,highlightOnHover:e?.highlightOnHover,showMaterialVariants:e?.materialVariants,showObjectNavigator:e?.objectNavigator,showMeasureTools:u===void 0?void 0:u!==!1,measurementUnit:typeof u=="object"?u.unit:void 0,showUvCheckerButton:t?.uvChecker,showExplodeControls:t?.explode,showSectionTools:t?.section,showSequenceControls:t?.sequences,showIsolateControls:t?.isolate,texturePositioning:t?.texturePositioning,enableCameraControls:r?.enabled,enableKeyboardNavigation:r?.keyboard,reducedMotion:r?.reducedMotion,disableZoom:r?.zoom===void 0?void 0:!r.zoom,zoomOnSelected:r?.zoomOnSelect,autoRotate:d===void 0?void 0:d!==!1,autoRotateSpeed:typeof d=="number"?d:void 0,refitOnResize:r?.refitOnResize,cameraLimits:r?.limits,moveSensitivity:r?.moveSensitivity,zoomSensitivity:r?.zoomSensitivity,renderMode:n?.renderMode,maxDpr:n?.maxDpr,performanceProfile:n?.profile,preserveDrawingBuffer:n?.preserveDrawingBuffer,webgpu:n?.webgpu,tilesetUrl:i?.url,tilesErrorTarget:i?.errorTarget,tilesCacheSize:i?.cacheSize,enableXR:o?.enabled,usdzUrl:o?.usdzUrl,arScaleMode:o?.scaleMode,mobileHandoffUrl:o?.mobileHandoffUrl,arHandoff:o?.arHandoff,dracoDecoderPath:a?.draco,ktx2TranscoderPath:a?.ktx2,meshopt:a?.meshopt}}function Zy(e){let t={...e};for(let r of aP)delete t[r];return{...e.preset?oP[e.preset]:void 0,...Jy(t),...Jy(sP(e))}}import{useCallback as pi,useEffect as lP,useRef as ev,useState as Ip}from"react";var Bp={currentClip:null,isPlaying:!1,speed:1,time:0,duration:0,active:[]};function UB(){let e=ev(null),t=ev(null),[r,n]=Ip([]),[i,o]=Ip([]),[a,s]=Ip(Bp);lP(()=>()=>{t.current?.()},[]);let l=pi(v=>{t.current?.(),e.current=v,n(v.clips),o(v.clipDetails??v.clips.map(M=>({sourceName:M,duration:0}))),s(v.getState?.()??Bp),t.current=v.subscribe?.(s)??null},[]),u=pi(()=>{t.current?.(),t.current=null,e.current=null,n([]),o([]),s(Bp)},[]),d=pi(v=>{let M=e.current;M&&(v(M),!M.subscribe&&M.getState&&s(M.getState()))},[]),p=pi((v,M)=>d(g=>g.play(v,M)),[d]),c=pi(v=>d(M=>M.pause(v)),[d]),h=pi(v=>d(M=>M.stop(v)),[d]),m=pi((v,M)=>d(g=>g.setSpeed(v,M)),[d]),y=pi((v,M)=>d(g=>g.seek?.(v,M)),[d]);return{clips:r,clipDetails:i,...a,play:p,pause:c,stop:h,setSpeed:m,seek:y,handleAnimationsReady:l,clearAnimations:u}}function sn(e,t){let r=URL.createObjectURL(e),n=document.createElement("a");n.href=r,n.download=t,n.style.display="none";try{document.body.appendChild(n),n.click()}finally{n.remove(),window.setTimeout(()=>{URL.revokeObjectURL(r)},1e3)}}import{Fragment as ac,jsx as ue,jsxs as le}from"react/jsx-runtime";var Tn=e=>e.toLocaleString(),$o=e=>e==null?"Unknown":e>=1024*1024?`${(e/1024/1024).toFixed(1)} MiB`:`${(e/1024).toFixed(1)} KiB`,jp=e=>e===null?"Unavailable":Tn(e);function cP({report:e,runtimeStats:t,onRefresh:r,onSelectObject:n}){return le("div",{className:"ri-assetDiagnostics",children:[le("div",{className:"ri-diagnosticsActions",children:[r&&ue("button",{type:"button",disabled:!e||e.status==="failed",onClick:r,children:"Rescan asset"}),ue("button",{type:"button",disabled:!e,onClick:()=>{sn(new Blob([JSON.stringify({asset:e,runtime:t??null},null,2)],{type:"application/json"}),"asset-diagnostics.json")},children:"Download report"})]}),e?le(ac,{children:[le("div",{className:`ri-diagnosticsSummary ri-diagnosticsSummary--${e.issues.some(i=>i.severity==="error")?"error":e.issues.some(i=>i.severity==="warning")?"warning":"info"}`,children:[ue("strong",{children:e.status==="failed"?"Asset could not be inspected":e.issues.some(i=>i.severity==="error")?"Issues need attention":e.issues.some(i=>i.severity==="warning")?"Review recommended":"No blocking issues found"}),le("span",{children:[e.issues.filter(i=>i.severity==="error").length," errors \xB7 ",e.issues.filter(i=>i.severity==="warning").length," warnings \xB7 ",e.issues.filter(i=>i.severity==="info").length," notes"]})]}),le("p",{className:"ri-diagnosticsSource",children:[e.source.name??"Loaded asset"," ",ue("span",{children:e.source.format?.toUpperCase()})]}),le("details",{className:"ri-diagnosticsDetail",children:[ue("summary",{children:"Asset statistics"}),le("dl",{className:"ri-diagnosticsMetrics",children:[le("div",{children:[ue("dt",{children:"Source"}),ue("dd",{children:e.source.name??"Loaded asset"})]}),le("div",{children:[ue("dt",{children:"Format"}),ue("dd",{children:e.source.format?.toUpperCase()??"Unknown"})]}),le("div",{children:[ue("dt",{children:"Source file size"}),ue("dd",{children:$o(e.source.sourceBytes)})]}),le("div",{children:[ue("dt",{children:"Initial asset load"}),ue("dd",{children:e.source.loadDurationMs==null?"Unknown":`${(e.source.loadDurationMs/1e3).toFixed(2)} s`})]}),le("div",{children:[ue("dt",{children:"Units"}),ue("dd",{children:e.units==="unknown"?"Unknown \u2014 verify scale":e.units})]}),e.bounds&&le("div",{children:[ue("dt",{children:"Bounds (scene units)"}),ue("dd",{children:e.bounds.size.map(i=>Number(i.toPrecision(4))).join(" \xD7 ")})]}),e.statistics&&le(ac,{children:[le("div",{children:[ue("dt",{children:"Meshes / instances"}),le("dd",{children:[Tn(e.statistics.meshes)," / ",Tn(e.statistics.instances)]})]}),le("div",{children:[ue("dt",{children:"Unique triangles"}),ue("dd",{children:Tn(e.statistics.triangles)})]}),le("div",{children:[ue("dt",{children:"Unique vertices"}),ue("dd",{children:Tn(e.statistics.vertices)})]}),le("div",{children:[ue("dt",{children:"Materials / textures"}),le("dd",{children:[Tn(e.statistics.materials)," / ",Tn(e.statistics.textures)]})]}),le("div",{children:[ue("dt",{children:"Geometry buffers"}),ue("dd",{children:$o(e.statistics.geometryBytes)})]}),le("div",{children:[ue("dt",{children:"Texture memory estimate"}),le("dd",{children:[$o(e.statistics.estimatedTextureBytes),e.statistics.unknownTextureSizes?` + ${e.statistics.unknownTextureSizes} unknown`:""]})]})]})]}),le("p",{className:"ri-diagnosticsNote",children:[e.scope==="resident-tiles"?"Counts cover loaded tiles only. ":"Counts include loaded hidden meshes. ","Buffer sizes and texture memory are estimates, not a GPU memory budget. Units do not verify physical scale."]})]}),ue("div",{className:"ri-diagnosticsIssues",children:e.issues.map((i,o)=>le("details",{className:`ri-diagnosticsIssue ri-diagnosticsIssue--${i.severity}`,children:[le("summary",{children:[ue("span",{className:"ri-diagnosticsSeverity",children:i.severity}),i.title,i.count!==void 0&&ue("span",{className:"ri-diagnosticsCount",children:Tn(i.count)})]}),le("div",{children:[ue("p",{children:i.detail}),ue("p",{className:"ri-diagnosticsFix",children:i.suggestion}),!!i.objects?.length&&ue("ul",{"aria-label":`Affected objects: ${i.title}`,children:i.objects.map((a,s)=>ue("li",{children:n&&!["failed-resources","large-textures"].includes(i.code)?ue("button",{type:"button",onClick:()=>n(a),children:a}):a},`${a}-${s}`))}),i.count&&i.count>(i.objects?.length??0)&&i.objects&&le("small",{children:["Showing the first ",i.objects.length," of ",Tn(i.count),"."]})]})]},`${i.code}-${o}`))}),!!e.textures.length&&le("details",{className:"ri-diagnosticsDetail",children:[le("summary",{children:["Texture dimensions (",e.textures.length,")"]}),ue("ul",{children:e.textures.map((i,o)=>le("li",{children:[ue("strong",{children:i.name}),le("span",{children:[i.width??"?"," \xD7 ",i.height??"?",i.compressed?" \xB7 compressed":""," \xB7 ",$o(i.estimatedBytes)]})]},o))})]}),!!e.extensions.length&&le("details",{className:"ri-diagnosticsDetail",children:[le("summary",{children:["glTF extensions (",e.extensions.length,")"]}),ue("ul",{children:e.extensions.map(i=>le("li",{children:[ue("strong",{children:i.name}),le("span",{children:[i.recognized?"Recognized":"Not recognized",i.required?" \xB7 required":" \xB7 optional"]})]},i.name))}),ue("p",{className:"ri-diagnosticsNote",children:"Recognized by the bundled loader; compressed formats still require configured decoders and device support."})]})]}):ue("p",{className:"ri-diagnosticsNote",role:"status",children:"Waiting for the active asset to load\u2026"}),le("details",{className:"ri-diagnosticsDetail ri-diagnosticsRuntimeDetail",children:[ue("summary",{children:"Runtime statistics \xB7 live"}),le("section",{className:"ri-diagnosticsRuntime","aria-label":"Runtime statistics",children:[le("h4",{children:["Runtime statistics ",ue("span",{children:"Live \xB7 this canvas"})]}),t?le(ac,{children:[le("dl",{className:"ri-diagnosticsMetrics",children:[le("div",{children:[ue("dt",{children:"Renderer / render loop"}),le("dd",{children:[t.renderer.toUpperCase()," / ",t.renderMode]})]}),le("div",{children:[ue("dt",{children:"Draw calls (last pass)"}),ue("dd",{children:jp(t.drawCalls)})]}),le("div",{children:[ue("dt",{children:"Triangles (last pass)"}),ue("dd",{children:jp(t.triangles)})]}),le("div",{children:[ue("dt",{children:"Frame interval / FPS"}),ue("dd",{children:t.frameIntervalMs===null?"Idle / no active frame sample":`${t.frameIntervalMs.toFixed(1)} ms / ${t.fps?.toFixed(0)}`})]}),le("div",{children:[ue("dt",{children:"Quality profile"}),le("dd",{children:[t.quality.profile," \xB7 ",t.quality.reducedGpuLoad?"reduced GPU load":"full quality"]})]}),le("div",{children:[ue("dt",{children:"Pixel ratio"}),ue("dd",{children:t.quality.dpr.toFixed(2)})]}),le("div",{children:[ue("dt",{children:"Shadows / post FX"}),le("dd",{children:[t.quality.shadows?"On":"Off"," / ",t.quality.postProcessing?"Allowed":"Skipped"]})]}),t.streaming&&le(ac,{children:[le("div",{children:[ue("dt",{children:"Tile cache / base budget"}),le("dd",{children:[$o(t.streaming.cachedBytes)," / ",$o(t.streaming.budgetBytes)]})]}),le("div",{children:[ue("dt",{children:"Cached / loading / parsing tiles"}),le("dd",{children:[jp(t.streaming.cachedTiles)," / ",t.streaming.downloading," / ",t.streaming.parsing]})]}),le("div",{children:[ue("dt",{children:"Detail / error target"}),le("dd",{children:["\xD7",t.streaming.detailFactor.toFixed(1)," / ",t.streaming.errorTarget.toFixed(1)]})]})]})]}),t.streaming&&(t.streaming.cacheFull||t.streaming.detailFactor>1)&&le("p",{className:"ri-diagnosticsPressure",children:[t.streaming.cacheFull?"Tile cache is full. ":"",t.streaming.detailFactor>1?"Detail was reduced by the existing memory-pressure safeguard. ":"","Try smaller textures or a larger cache budget when the device can support it."]}),ue("p",{className:"ri-diagnosticsNote",children:"Frame intervals describe active frame callbacks, not CPU/GPU execution time. Long demand-loop idle gaps are excluded. Draw counts may reflect a post-processing pass. Sampling does not keep rendering awake."})]}):ue("p",{className:"ri-diagnosticsNote",children:"Collecting a sample\u2026"})]})]})]})}import{AlertTriangle as uP}from"lucide-react";import{jsx as sc,jsxs as tv}from"react/jsx-runtime";function lc({title:e,message:t,tone:r="default"}){return tv("div",{className:`ri-license-overlay${r==="error"?" ri-license-overlay--error":""}`,children:[tv("div",{className:"ri-license-overlay__header",children:[r==="error"?sc(uP,{size:16,className:"ri-license-overlay__icon","aria-hidden":"true"}):sc("span",{className:"ri-license-overlay__statusDot","aria-hidden":"true"}),sc("span",{className:"ri-license-overlay__title",children:e})]}),sc("p",{className:"ri-license-overlay__message",children:t})]})}function Np(e,t){if(e)return e;let r=t?.background;return r?.enabled&&r.type==="color"?r.color:"#1c1c1d"}var dP={glb:"GLB",gltf:"glTF",obj:"OBJ",fbx:"FBX",usdz:"USDZ",stl:"STL",ply:"PLY"},pP=/\.(glb|gltf|obj|fbx|usdz|stl|ply|zip)$/i;function mP(e,t){let r=e?.response?.status;if(typeof r=="number")return r;let n=/responded with (\d{3})/.exec(t);return n?Number(n[1]):null}function rv(e,t,r,n){let i=e instanceof Error?e.message:e==null?"":String(e),o=(c,h)=>Pb(n,c,h),a=o("loadErrorTitle"),s=i||null;if(fy(e))return{title:a,detail:o("loadErrorPointCloud"),technical:s};let l=mP(e,i);if(l===404||l===410)return{title:a,detail:o("loadErrorNotFound",{status:l}),technical:s};if(l===401||l===403)return{title:a,detail:o("loadErrorDenied",{status:l}),technical:s};if(l!==null)return{title:a,detail:o("loadErrorStatus",{status:l}),technical:s};if(/failed to fetch|networkerror|load failed|network error/i.test(i))return{title:a,detail:o("loadErrorNetwork"),technical:s};if(/<!doctype|<html/i.test(i))return{title:a,detail:o("loadErrorHtml"),technical:s};let u=t.split(/[?#]/,1)[0],d=dP[r??iy(t)],p=pP.test(u);return{title:a,detail:p||r?o(r?"loadErrorInvalidExplicitFormat":"loadErrorInvalidFile",{format:d}):o("loadErrorMissingFormat",{format:d}),technical:s}}var nv={free:0,starter:1,growth:2};function l5(e){return e==="starter"||e==="growth"?e:"free"}function iv(e,t){return nv[e]>=nv[t]}var ov={free:"Free",starter:"Starter",growth:"Growth"};var hP={advancedMaterials:"starter",materialVariants:"starter",customEnvironment:"starter",backgroundImages:"starter",environmentBackground:"free",sectionPlanes:"starter",calibratedMeasurements:"starter",animationConfig:"starter",sceneBundle:"starter",cinematic:"starter",rules:"growth",postLighting:"starter",postSelection:"growth",postStylize:"growth"};function cc(e,t){return iv(e,hP[t])}var fP={decalsPerObject:{free:1,starter:1/0,growth:1/0},lights:{free:3,starter:1/0,growth:1/0},annotations:{free:3,starter:1/0,growth:1/0},sequences:{free:1,starter:1/0,growth:1/0},selectionSets:{free:3,starter:1/0,growth:1/0},models:{free:1,starter:3,growth:1/0}};function gP(e,t,r){return r<fP[t][e]}function d5(e,t){return["free","starter","growth"].find(r=>gP(r,e,t))??"growth"}import{createContext as bP,useContext as yP}from"react";var vP=bP({isInsideEditor:!1,activeTab:"object",activeSubTab:"General",tier:"free"});var mi=()=>yP(vP);import{useEffect as CP,useState as TP}from"react";var xP="ri:license-grant:v1",wP={"260cd89ea13f":"MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEwjr3ofKTkkcxOM0GYl/RlJj9JsuyjSF8sYmCd2YqsHJCEO8EvlNDrO2Kl4agFKo6dRhyR2/oWeiU6P9WIqRbvw=="},av=new Map;function lv(e){let t=atob(e);return Uint8Array.from(t,r=>r.charCodeAt(0)).buffer}function sv(e){let t=e.replace(/-/g,"+").replace(/_/g,"/");return lv(t.padEnd(Math.ceil(t.length/4)*4,"="))}function MP(e){if(!e||typeof e!="object")return!1;let t=e;return t.version===1&&typeof t.licenseKeyHash=="string"&&typeof t.domain=="string"&&(t.environment==="development"||t.environment==="production")&&typeof t.tier=="string"&&t.tier.length>0&&typeof t.issuedAt=="number"&&Number.isInteger(t.issuedAt)&&typeof t.expiresAt=="number"&&Number.isInteger(t.expiresAt)}async function uc(e){let t=await crypto.subtle.digest("SHA-256",new TextEncoder().encode(e.trim())),r=String.fromCharCode(...new Uint8Array(t));return btoa(r).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}function zp(e,t){return`${xP}:${t}:${e}`}function SP(e,t){let r=av.get(e);if(r)return r;let n=crypto.subtle.importKey("spki",lv(t),{name:"ECDSA",namedCurve:"P-256"},!1,["verify"]);return av.set(e,n),n}async function Vp(e,t,r){if(!globalThis.crypto?.subtle)return null;try{let[n,i,o,a,...s]=e.split("."),l=wP[i];if(n!=="ri1"||!l||!o||!a||s.length>0)return null;let u=JSON.parse(new TextDecoder().decode(sv(o)));if(!MP(u)||!await crypto.subtle.verify({name:"ECDSA",hash:"SHA-256"},await SP(i,l),sv(a),new TextEncoder().encode(`${n}.${i}.${o}`)))return null;let p=Math.floor(Date.now()/1e3),c=u.expiresAt-u.issuedAt;return u.licenseKeyHash!==t||u.domain!==r||u.expiresAt<=p||u.issuedAt>p+300||c<=0||c>43200?null:{environment:u.environment,tier:u.tier,expiresAt:u.expiresAt}}catch{return null}}async function cv(e,t,r){try{return await Vp(e,await uc(t),r)}catch{return null}}async function uv(e,t,r){try{let n=await uc(t);return await Vp(e,n,r)?(localStorage.setItem(zp(n,r),e),!0):!1}catch{return!1}}async function dv(e,t){try{let r=await uc(e),n=zp(r,t),i=localStorage.getItem(n);if(!i)return null;let o=await Vp(i,r,t);return o||localStorage.removeItem(n),o}catch{return null}}async function Fp(e,t){try{let r=await uc(e);localStorage.removeItem(zp(r,t))}catch{}}var PP=["localhost","127.0.0.1","0.0.0.0"],_P=e=>PP.includes(e)||e.endsWith(".local")||e.endsWith(".localhost"),hv="https://react-immersive.liveroom.dev/api/validate-license",fv=()=>typeof window<"u",EP=300*1e3,AP=5e3,RP=400,Gp=new Map,Up=new Map,hi=class extends Error{},gv=async(e,t,r)=>{let n=await dv(e,t);return n?(console.warn("[react-immersive] License server unreachable \u2014 using a previously verified, time-limited offline grant."),{status:"valid",reason:"Previously verified offline grant",environment:n.environment,tier:n.tier,isLocalDomain:r}):null},pv=async(e,t,r)=>{let n=await gv(e,t,r);return n||(console.warn("[react-immersive] License server unreachable and no valid offline grant is available \u2014 license validation failed."),{status:"invalid",reason:"Could not reach license server",isLocalDomain:r})},kP=e=>e instanceof hi||e instanceof TypeError,DP=()=>new Promise(e=>setTimeout(e,RP)),OP=e=>e==="development"||e==="production",LP=e=>{if(!e||typeof e!="object")return!1;let t=e;return!(typeof t.valid!="boolean"||t.reason!==void 0&&typeof t.reason!="string"||t.environment!==void 0&&!OP(t.environment)||t.tier!==void 0&&typeof t.tier!="string"||t.offlineGrant!==void 0&&typeof t.offlineGrant!="string")},IP=e=>{if(!e||typeof e!="object")return null;let t=e,r=t.reason??t.error;return typeof r=="string"&&r.trim()?r:null},bv=(e,t,r)=>`${r}::${e}::${t}`,yv=e=>{let t=Gp.get(e);return t?Date.now()-t.timestamp>EP?(Gp.delete(e),null):t.result:null},BP=(e,t)=>({status:e.valid?"valid":"invalid",reason:e.reason,environment:e.environment,tier:e.tier,isLocalDomain:t}),jP=(e,t)=>({status:"invalid",reason:e,isLocalDomain:t});async function NP(e,t,r,n){let i=bv(e,t,n),o=yv(i);if(o)return o;let a=Up.get(i);if(a)return a;let s=(async()=>{for(let l=0;l<2;l+=1)try{return await zP(e,t,r,i,n)}catch(u){if(!kP(u))throw u;if(l===0){let d=await gv(e,t,r);if(d)return d;await DP();continue}return pv(e,t,r)}return pv(e,t,r)})().finally(()=>{Up.delete(i)});return Up.set(i,s),s}async function zP(e,t,r,n,i){let o=new AbortController,a=setTimeout(()=>o.abort(),AP),s;try{s=await fetch(i,{method:"POST",headers:{"Content-Type":"application/json"},cache:"no-store",signal:o.signal,body:JSON.stringify({licenseKey:e,domain:t})})}catch(d){throw o.signal.aborted?new hi("License validation timed out"):d}finally{clearTimeout(a)}let l;try{l=await s.json()}catch{throw new hi(`License server returned a non-JSON response${s.status?` (${s.status})`:""}`)}if(!s.ok){if(s.status===429||s.status>=500)throw new hi(`License server error (${s.status})`);let d=IP(l)??`License validation failed${s.status?` (${s.status})`:""}`;return await Fp(e,t),jP(d,r)}if(!LP(l))throw new hi("License server returned an unexpected payload");let u=BP(l,r);if(u.status==="valid"&&i!==hv){let d=l.offlineGrant?await cv(l.offlineGrant,e,t):null;if(!d)throw new hi("License validation endpoint did not return a verifiable signed grant");u={...u,environment:d.environment,tier:d.tier}}return u.status==="valid"?(Gp.set(n,{result:u,timestamp:Date.now()}),l.offlineGrant&&(await uv(l.offlineGrant,e,t)||console.warn("[react-immersive] The license server returned an invalid offline grant; it was not cached."))):await Fp(e,t),u}var mv=(e,t)=>{let r=e.trim();return!fv()||!r?null:yv(bv(r,window.location.hostname.toLowerCase(),t))},vv=(e,t=hv)=>{let[r,n]=TP(()=>mv(e,t)??{status:"checking",isLocalDomain:!1});return CP(()=>{if(!fv())return;let i=!1,o=p=>{i||n(p)},a=e.trim(),s=window.location.hostname.toLowerCase(),l=_P(s),u=mv(e,t);return u?(o(u),()=>{i=!0}):(o({status:"checking",isLocalDomain:l}),a?((async()=>{try{o(await NP(a,s,l,t))}catch(p){let c=p instanceof TypeError?"Could not reach license server":p instanceof Error?p.message:"License validation failed";o({status:"invalid",reason:c,isLocalDomain:l})}})(),()=>{i=!0}):(o({status:"invalid",reason:"No license key provided",isLocalDomain:l}),()=>{i=!0}))},[e,t]),r};import{Box3 as qP,Mesh as XP,Raycaster as $P,Triangle as YP,Vector3 as ln}from"three";import{useCallback as dc,useEffect as VP,useRef as pc}from"react";import{Matrix4 as FP,Triangle as xv,Vector3 as es}from"three";var UP=500,GP=10,HP=5;function mc(e,t,r){let n=pc({resolve:e,onContextMenu:t,anchorOf:r});n.current={resolve:e,onContextMenu:t,anchorOf:r};let i=pc(null),o=pc(!1),a=pc(null),s=dc(()=>{let p=i.current;p?.timer&&clearTimeout(p.timer),i.current=null,a.current?.(),a.current=null},[]),l=dc(()=>{let p=i.current;p&&(s(),p.kind==="touch"&&(o.current=!0,setTimeout(()=>o.current=!1,800)),n.current.onContextMenu?.(p.target,p.pointer))},[s]),u=dc(p=>{let c=p.nativeEvent,h=c.pointerType!=="touch"&&c.button===2,m=c.pointerType==="touch"&&c.button===0;if(!n.current.onContextMenu||!h&&!m)return;let y=n.current.resolve(p.object);if(y===null)return;s();let v={target:y,kind:h?"right":"touch",pointerId:c.pointerId,pointer:Yo(p,n.current.anchorOf?.(p.object)),timer:m?setTimeout(l,UP):null};i.current=v;let M=h?HP:GP,g=b=>Math.hypot(b.clientX-v.pointer.clientX,b.clientY-v.pointer.clientY)>M,f=b=>{b.pointerId===v.pointerId&&g(b)&&s()},x=b=>{b.pointerId===v.pointerId&&(v.kind==="right"&&!g(b)?l():s())},P=b=>{b.pointerId!==v.pointerId&&s()};window.addEventListener("pointermove",f),window.addEventListener("pointerup",x),window.addEventListener("pointercancel",s),window.addEventListener("pointerdown",P),a.current=()=>{window.removeEventListener("pointermove",f),window.removeEventListener("pointerup",x),window.removeEventListener("pointercancel",s),window.removeEventListener("pointerdown",P)}},[s,l]);VP(()=>s,[s]);let d=dc(()=>o.current?(o.current=!1,!0):!1,[]);return{onPointerDown:u,consumeClick:d}}function WP(e,t){let r=e.face,n=t.geometry.getAttribute("position");if(!r||!n)return null;let i=e.barycoord??null;if(!i){let[p,c,h]=[r.a,r.b,r.c].map(m=>t.getVertexPosition(m,new es));if(i=xv.getBarycoord(t.worldToLocal(e.point.clone()),p,c,h,new es),!i)return null}let[o,a,s]=[r.a,r.b,r.c].map(p=>new es().fromBufferAttribute(n,p)),l=new es().addScaledVector(o,i.x).addScaledVector(a,i.y).addScaledVector(s,i.z),u=new xv(o,a,s).getNormal(new es);return r.normal.clone().transformDirection(t.matrixWorld).dot(e.ray.direction)>0&&u.negate(),{position:[l.x,l.y,l.z],normal:[u.x,u.y,u.z]}}function Zi(e,t){if(t.updateWorldMatrix(!0,!1),e.object===t&&t.isSkinnedMesh===!0){let i=WP(e,t);if(i)return i}let r=t.worldToLocal(e.point.clone()),n=e.face?e.face.normal.clone().transformDirection(e.object.matrixWorld):e.ray.direction.clone().negate();return n.dot(e.ray.direction)>0&&n.negate(),n.transformDirection(new FP().copy(t.matrixWorld).invert()),{position:[r.x,r.y,r.z],normal:[n.x,n.y,n.z]}}function Yo(e,t){let r=e.nativeEvent;return{clientX:r.clientX,clientY:r.clientY,pointerType:"pointerType"in r?r.pointerType:"mouse",...t?{surface:Zi(e,t)}:{}}}function wv(e,t){if(!(e instanceof XP)||!t)return null;let r=e.geometry.getAttribute("position");if(!r?.count)return null;e.updateWorldMatrix(!0,!1),t.updateWorldMatrix(!0,!1);let n=new qP,i=new ln;if(nr(e)){let b=e;b.computeBoundingBox(),b.computeBoundingSphere();for(let E=0;E<r.count;E++)n.expandByPoint(e.getVertexPosition(E,i))}else e.geometry.boundingBox||e.geometry.computeBoundingBox(),n.copy(e.geometry.boundingBox);if(n.applyMatrix4(e.matrixWorld),n.isEmpty())return null;let o=n.getCenter(new ln),a=t.getWorldPosition(new ln),s=t.getWorldDirection(new ln),l=t.isOrthographicCamera,u=new $P,d=b=>{if(l){let _=a.distanceTo(o)+n.getSize(i).length()+1;u.set(b.clone().addScaledVector(s,-_),s)}else u.set(a,b.clone().sub(a).normalize());let E=u.intersectObject(e,!1)[0];return E?Zi({...E,ray:u.ray},e):null},p=d(o);if(p)return p;let c=e.geometry.index,h=c?.count??r.count,m=new ln,y=new ln,v=new ln,M=new ln,g=new ln,f=new ln,x=null,P=1/0;for(let b=0;b+2<h;b+=3){if(e.getVertexPosition(c?c.getX(b):b,m).applyMatrix4(e.matrixWorld),e.getVertexPosition(c?c.getX(b+1):b+1,y).applyMatrix4(e.matrixWorld),e.getVertexPosition(c?c.getX(b+2):b+2,v).applyMatrix4(e.matrixWorld),M.copy(m).add(y).add(v).multiplyScalar(1/3),YP.getNormal(m,y,v,g),l?f.copy(s).negate():f.copy(a).sub(M),g.dot(f)<=0)continue;let E=M.distanceToSquared(o);E<P&&(P=E,x=M.clone())}return x?d(x):null}import{Mesh as KP,Raycaster as QP,Triangle as JP,Vector2 as Mv,Vector3 as Pn}from"three";function Sv(e,t,r,n){if(!(e instanceof KP)||!t)return null;e.updateWorldMatrix(!0,!1),t.updateWorldMatrix(!0,!1);let i=new Pn().fromArray(r.position);if(nr(e)){let u=e;u.computeBoundingBox(),u.computeBoundingSphere();let d=u.geometry.getAttribute("position");if(!d)return null;let p=u.geometry.index,c=p?.count??d.count,h=new JP,m=new Pn,y=new Pn,v=1/0,M=null;for(let g=0;g+2<c;g+=3){let f=[0,1,2].map(P=>p?p.getX(g+P):g+P);h.a.fromBufferAttribute(d,f[0]),h.b.fromBufferAttribute(d,f[1]),h.c.fromBufferAttribute(d,f[2]),h.closestPointToPoint(i,m);let x=m.distanceToSquared(i);if(!(x>=v||!h.getBarycoord(m,y))&&(v=x,M=new Pn().addScaledVector(u.getVertexPosition(f[0],new Pn),y.x).addScaledVector(u.getVertexPosition(f[1],new Pn),y.y).addScaledVector(u.getVertexPosition(f[2],new Pn),y.z),v<1e-12))break}if(!M)return null;i.copy(M)}if(i.applyMatrix4(e.matrixWorld).project(t),!Number.isFinite(i.x)||i.z<-1||i.z>1)return null;let o=new Mv(n==="left"?-.0035:n==="right"?.0035:0,n==="down"?-.0035:n==="up"?.0035:0),a=new QP,s=r.size*.01,l=new Pn().fromArray(r.position);for(let u=1;u>=1/1024;u/=2){a.setFromCamera(new Mv(i.x,i.y).addScaledVector(o,u),t);let d=a.intersectObject(e,!1)[0];if(d){let p=Zi({...d,ray:a.ray},e);if(new Pn().fromArray(p.position).distanceTo(l)<=s)return p}}return null}import{Box3 as ts,PerspectiveCamera as Cv,Sphere as ZP,Vector3 as Ko}from"three";function Tv(e,t,r,n,i){return!!(e?.usesSlots&&t.usesSlots&&e.url!==t.url&&r.includes(e.url)&&r.includes(t.url)&&n[e.url]&&n[t.url]&&i[e.url]&&i[t.url])}function Pv(e,t,r){let n=t?.camera;if(!(n instanceof Cv))return null;let o=(e instanceof ts?e:new ts().setFromObject(e)).getSize(new Ko).length();return!Number.isFinite(o)||o<=0?null:(n.near=o/100,n.far=o*100,n.updateProjectionMatrix(),t&&r===void 0&&(t.maxDistance=o*10),o)}function _v(e,t){let r=e.camera;if(!(r instanceof Cv)||!(t>0))return;let n=Math.min(Math.max(e.distance/200,t/1e5),t/100);Math.abs(n-r.near)<=r.near*.01||(r.near=n,r.updateProjectionMatrix())}var hc={paddingTop:.5,paddingBottom:.5,paddingLeft:.5,paddingRight:.5},rs={kind:"model"};function Ev(e,t){let r=new ts().setFromObject(t);return r.isEmpty()?!1:(r.expandByScalar(r.getSize(new Ko).length()*.05),r.containsPoint(e.getTarget(new Ko)))}function Av(e,t){return e.getTarget(new Ko).distanceTo(t)<=Math.max(e.distance,1)*.001}async function Hp(e,t,r=.6){let n=e.smoothTime;e.smoothTime=Wo(e,r);try{return await t()}finally{e.smoothTime=n}}async function Rv(e,t,{flyIn:r,onStart:n,invalidate:i}){if(r){let o=(t instanceof ts?t:new ts().setFromObject(t)).getBoundingSphere(new ZP),a=o.center.clone(),l=e.getPosition(new Ko).clone().sub(e.getTarget(new Ko));l.lengthSq()<1e-6&&l.set(0,0,1),l.normalize();let u=Math.max(o.radius*10,20),d=a.clone().add(l.multiplyScalar(u));await e.setLookAt(d.x,d.y,d.z,a.x,a.y,a.z,!1)}n(),await Hp(e,()=>e.fitToBox(t,!0,{paddingTop:.5,paddingBottom:.5,paddingLeft:.5,paddingRight:.5})),await new Promise(o=>{let a=performance.now(),s=()=>{e.active===!1||performance.now()-a>8e3?(e.dispatchEvent({type:"update"}),i(),o()):(i(),setTimeout(s,100))};setTimeout(s,100)})}import{useEffect as e_,useMemo as Dv,useRef as t_}from"react";import{useFrame as r_,useThree as n_}from"@react-three/fiber";import{Box3 as i_,Box3Helper as o_,Group as a_}from"three";var kv="riEditorGizmo";function Qo(e){return e.userData[kv]=!0,e}function fc(e){let t=[];return e.traverse(r=>{r.visible&&r.userData[kv]&&(r.visible=!1,t.push(r))}),()=>{for(let r of t)r.visible=!0}}import{jsx as s_}from"react/jsx-runtime";function Ov({source:e,highlights:t}){let r=n_(a=>a.invalidate),n=Dv(()=>new a_,[]),i=Dv(()=>t.map(a=>{let s=new o_(new i_,a.color);s.raycast=()=>{};let l=s.material;return l.depthTest=!1,l.transparent=!0,l.opacity=.85,s.renderOrder=1e3,Qo(s),{helper:s,id:a.objectId}}),[t]);e_(()=>{for(let{helper:a}of i)n.add(a);return r(),()=>{for(let{helper:a}of i)n.remove(a),a.geometry.dispose(),a.material.dispose();r()}},[n,i,r]);let o=t_(null);return r_(()=>{let a=e.current;if(!a){n.visible=!1;return}n.visible=!0,(o.current?.root!==a||o.current.helpers!==i)&&(o.current={root:a,helpers:i,nodes:si(a).nodesById});let s=o.current.nodes;for(let{helper:l,id:u}of i){let d=s[u];l.visible=!!d,d&&l.box.setFromObject(d)}}),s_("primitive",{object:n})}function Lv(e){let t=[],r="",n=null,i=null,o=0,a="stopped",s=!1,l=[],u=0,d=!1,p=!1,c={sequenceId:null,time:0,duration:0,status:a,previewing:s,ready:!1,issues:[]},h=new Set,m=()=>t.find(x=>x.id===i),y=()=>{c={sequenceId:i,time:o,duration:m()?.duration??0,status:a,previewing:s,ready:!!n,issues:l},h.forEach(x=>x())},v=()=>{n?.restore(),o=0,a="stopped",s=!1,y(),n?.invalidate()},M=x=>t.some(P=>P.id===x)?(i===x||(n?.restore(),i=x,o=0,a="stopped",s=!1,l=n?.inspect(m())??[],y(),n?.invalidate()),!0):!1,g=x=>{if(x&&!M(x))return!1;let P=m();return!n||!P?.tracks.some(b=>!b.muted&&b.keyframes.length)?!1:(e?.(),p=!0,o>=P.duration&&(o=0),a="playing",s=!0,l=n.inspect(P),y(),n.invalidate(),!0)},f=()=>{if(!n||!d||p)return;let x=t.find(P=>P.autoPlay);x&&g(x.id)};return{getState:()=>c,subscribe:x=>(h.add(x),()=>{h.delete(x)}),select:M,play:g,stop:v,pause:()=>{a==="playing"&&(a="paused",y())},seek:x=>{let P=m();return!n||!P||!Number.isFinite(x)?!1:(e?.(),o=Math.max(0,Math.min(P.duration,x)),s=!0,a!=="playing"&&(a="paused"),l=n.inspect(P),y(),n.invalidate(),!0)},capture:x=>n?.capture(x)??null,configure:(x,P)=>{d=P;try{let b=Nl(x??[]),E=JSON.stringify(b);if(r===E){f();return}n?.restore(),t=b,r=E,m()||(i=t[0]?.id??null,o=0,s=!1),o=Math.min(o,m()?.duration??0),a=s?"paused":"stopped",l=m()?n?.inspect(m())??[]:[],y(),n?.invalidate(),f()}catch(b){v(),t=[],r="",i=null,l=[b instanceof Error?b.message:"Invalid sequence configuration."],y()}},connect:x=>{n?.restore(),n=x,x||(a="stopped",s=!1,o=0),l=m()?n?.inspect(m())??[]:[],y(),f()},advance:x=>{let P=m();if(!P||!n||a!=="playing"||!Number.isFinite(x)||x<0)return;let b=Math.min(x,.1);o+=b,u+=b,o>=P.duration&&(P.loop?o%=P.duration:(o=P.duration,a="finished")),(u>=1/30||a==="finished")&&(u=0,y())},frame:()=>{let x=m();return s&&x?{sequence:x,time:o,playing:a==="playing"}:null},destroy:()=>{n?.restore(),n=null,a="stopped",s=!1,o=0,y()}}}import{useLayoutEffect as yc,useMemo as c_,useRef as u_}from"react";import{useFrame as d_,useThree as p_}from"@react-three/fiber";import{Color as Bv}from"three";import{Matrix4 as Iv,Quaternion as l_,Vector3 as gc}from"three";function Jo(e){return new Iv().set(1,e[0],e[1],0,0,1,e[2],0,0,0,1,0,0,0,0,1)}function cn(e,t){e.matrixAutoUpdate=!t,e.updateMatrix(),t&&(e.matrix.makeRotationFromQuaternion(e.quaternion).multiply(Jo(t)).scale(e.scale).setPosition(e.position),e.matrixWorldNeedsUpdate=!0)}function bc(e,t,r){let n=new gc().setFromMatrixColumn(e,0),i=new gc().setFromMatrixColumn(e,1),o=new gc().setFromMatrixColumn(e,2),a=(m,y)=>{let v=m*(y<0?-1:1);return Math.abs(v-y)<1e-10?y:v},s=a(n.length(),t.x);if(Math.abs(s)<1e-12)return{rotation:r.clone(),scale:t.clone(),shear:void 0};n.divideScalar(s);let l=n.dot(i);i.addScaledVector(n,-l);let u=a(i.length(),t.y);if(Math.abs(u)<1e-12)return{rotation:r.clone(),scale:t.clone(),shear:void 0};i.divideScalar(u);let d=n.dot(o);o.addScaledVector(n,-d);let p=i.dot(o);o.addScaledVector(i,-p);let c=a(o.length(),t.z);if(Math.abs(c)<1e-12)return{rotation:r.clone(),scale:t.clone(),shear:void 0};o.divideScalar(c);let h=[l/u,d/c,p/c].map(m=>Math.abs(m)<1e-10?0:m);return{rotation:new l_().setFromRotationMatrix(new Iv().makeBasis(n,i,o)).normalize(),scale:new gc(s,u,c),shear:h.some(Boolean)?h:void 0}}var Wp=e=>e==="baseColor"?"color":e;function jv(e){let t=new Set;return e.traverse(r=>{let n=r;if(n.isMesh)for(let i of Array.isArray(n.material)?n.material:[n.material])i&&t.add(i)}),[...t]}function Nv({root:e,controls:t,animations:r,invalidate:n}){let i=new Map,o=new Map,a=new Map,s=new Set,l=new Map,u=null,d="",p=g=>e()?on(e(),g):null,c=g=>{if(g.kind==="camera"){let E=t();if(!E)return null;let _=Gr(E.camera,E);return{position:_.position,target:_.target,fov:_.fov,zoom:_.zoom}}if(g.kind==="clip"){let E=r();return E?.clips.includes(g.clip)?E.getState?.().active.find(_=>_.clip===g.clip)?.time??0:null}let f=p(g.objectId);if(!f)return null;let x=g.property;if(x==="position"||x==="rotation"||x==="scale")return[f[x].x,f[x].y,f[x].z];if(x==="visible")return f.visible;let P=jv(f).find(E=>E[Wp(x)]!==void 0),b=P?P[Wp(x)]:void 0;return b?.isColor?`#${b.getHexString()}`:typeof b=="number"?b:null},h=g=>{let f=t();f&&(f.stop(),f.setLookAt(...g.position,...g.target,!1),g.fov!==null&&"fov"in f.camera&&(f.camera.fov=g.fov,f.camera.updateProjectionMatrix()),f.zoomTo(g.zoom,!1),f.update(0))},m=g=>{if(i.has(g))return;g.updateWorldMatrix(!0,!0);let f=g.matrixAutoUpdate?void 0:bc(g.matrix,g.scale,g.quaternion).shear;i.set(g,{position:g.position.toArray(),rotation:[g.rotation.x,g.rotation.y,g.rotation.z],scale:g.scale.toArray(),matrix:g.matrix.clone(),auto:g.matrixAutoUpdate,shear:f});for(let x of an(g))Vo(x)||(ci(x,x.matrixWorld),s.add(x))},y=(g,f)=>{let x=r();x?.stop(g),f&&x&&(x.play(g,{alongside:!0,reverse:f.reverse}),x.setSpeed(f.speed,g),x.seek?.(f.time,g),f.status!=="playing"&&x.pause(g))};return{capture:c,restore:()=>{for(let[g,f]of l)y(g,f);l.clear();for(let[g,f]of i)g.position.fromArray(f.position),g.rotation.set(...f.rotation),g.scale.fromArray(f.scale),g.matrix.copy(f.matrix),g.matrixAutoUpdate=f.auto,g.matrixWorldNeedsUpdate=!0;i.clear(),o.forEach((g,f)=>f.visible=g),o.clear(),a.forEach((g,f)=>{g.forEach((x,P)=>{x instanceof Bv?f[P].copy(x):f[P]=x}),f.needsUpdate=!0}),a.clear(),s.forEach(Fr),s.clear(),u&&h(u),u=null,d="",e()?.updateWorldMatrix(!0,!0),n()},inspect:g=>g.tracks.filter(f=>!f.muted&&f.keyframes.length&&c(f.target)===null).map(f=>`Unavailable target: ${f.name}.`),invalidate:n,apply:({sequence:g,time:f,playing:x})=>{let P=g.tracks.map(_=>({track:_,value:wb(_,f)})).filter(_=>_.value!==null);for(let[_,S]of l)P.some(({track:C})=>C.target.kind==="clip"&&C.target.clip===_)||(y(_,S),l.delete(_));for(let{track:_}of P)if(_.target.kind==="object"&&["position","rotation","scale"].includes(_.target.property)){let S=p(_.target.objectId);S&&m(S)}let b=new Map([...a.keys()].map(_=>[_,_.transparent]));o.forEach((_,S)=>S.visible=_),i.forEach((_,S)=>{S.position.fromArray(_.position),S.rotation.set(..._.rotation),S.scale.fromArray(_.scale),cn(S,_.shear)}),a.forEach((_,S)=>_.forEach((C,T)=>{C instanceof Bv?S[T].copy(C):S[T]=C}));let E=r();for(let{track:_,value:S}of P){if(_.target.kind!=="clip"||!E?.seek||!E.clips.includes(_.target.clip))continue;let C=_.target.clip;l.has(C)||(l.set(C,E.getState?.().active.find(T=>T.clip===C)),E.play(C,{alongside:!0}),E.pause(C)),E.seek(S,C)}for(let{track:_,value:S}of P){let C=_.target;if(C.kind==="clip")continue;if(C.kind==="camera"){u||(u=c(C));let R=JSON.stringify(S);(x||R!==d)&&(h(S),d=R);continue}let T=p(C.objectId);if(!T)continue;let A=C.property;if(A==="visible")o.has(T)||o.set(T,T.visible),T.visible=S;else if(A==="position"||A==="rotation"||A==="scale")A==="rotation"?T.rotation.set(...S):T[A].fromArray(S),cn(T,i.get(T)?.shear);else for(let R of jv(T)){let L=Wp(A),N=R[L];if(N===void 0)continue;let I=a.get(R);if(I||(I=new Map,a.set(R,I)),b.has(R)||b.set(R,R.transparent),I.has(L)||I.set(L,N?.isColor?N.clone():N),N?.isColor?N.set(S):R[L]=S,A==="opacity"){I.has("transparent")||I.set("transparent",R.transparent);let z=S<1||I.get("transparent")===!0;R.transparent=z}}}u&&!P.some(({track:_})=>_.target.kind==="camera")&&(h(u),d=""),b.forEach((_,S)=>{_!==S.transparent&&(S.needsUpdate=!0)}),e()?.updateWorldMatrix(!0,!0)}}}function zv({controller:e,source:t,controls:r,animations:n,ready:i,sequences:o,autoPlay:a,authoredRevision:s}){let l=p_(p=>p.invalidate),u=u_({source:t,controls:r,animations:n});u.current={source:t,controls:r,animations:n};let d=c_(()=>Nv({root:()=>u.current.source.current,controls:()=>u.current.controls.current,animations:()=>u.current.animations.current,invalidate:l}),[e,l]);return yc(()=>(l(),()=>d.restore()),[d,s,o,l]),yc(()=>{e.configure(o,a)},[e,o,a]),yc(()=>(e.connect(i?d:null),()=>e.connect(null)),[e,d,i]),yc(()=>{let p=r.current,c=()=>e.pause();return p?.addEventListener("controlstart",c),()=>p?.removeEventListener("controlstart",c)},[e,r,i]),d_((p,c)=>{if(!i)return;e.advance(c);let h=e.frame();h&&d.apply(h),h?.playing&&l()}),null}import{useSyncExternalStore as m_}from"react";import{Pause as h_,Play as f_,Square as g_}from"lucide-react";import{jsx as Tr,jsxs as vc}from"react/jsx-runtime";var b_={sequenceId:null,time:0,duration:0,status:"stopped",previewing:!1,ready:!1,issues:[]},Vv=()=>b_,y_=()=>()=>{};function Fv(e){return m_(e?.subscribe??y_,e?.getState??Vv,Vv)}function v_({controls:e,duration:t,showScrubber:r=!0,hasTracks:n=!0}){let i=de(),o=Fv(e),a=o.status==="playing";return vc("div",{className:"ri-sequenceTransport",children:[Tr("button",{type:"button",onClick:()=>a?e?.pause():e?.play(),disabled:!o.ready||!t||!n,"aria-label":i(a?"sequencePause":"sequencePlay"),title:i(a?"sequencePause":"sequencePlay"),children:Tr("span",{"aria-hidden":"true",children:a?Tr(h_,{size:15}):Tr(f_,{size:15})})}),Tr("button",{type:"button",onClick:()=>e?.stop(),disabled:!o.previewing,"aria-label":i("sequenceStop"),title:i("sequenceStop"),children:Tr(g_,{size:14,"aria-hidden":"true"})}),r&&Tr("input",{"aria-label":i("sequencePlayhead"),type:"range",min:0,max:t||1,step:.01,value:Math.min(o.time,t),disabled:!o.ready||!t,onChange:s=>{e?.pause(),e?.seek(Number(s.target.value))}}),vc("output",{"aria-label":i("sequenceTime"),children:[o.time.toFixed(2)," / ",t.toFixed(2),"s"]})]})}function Uv({controls:e,sequences:t}){let r=de(),n=Fv(e);return t.length?vc("section",{className:"ri-sequencePlayer","aria-label":r("sequencePlayer"),onPointerDown:i=>i.stopPropagation(),children:[Tr("select",{"aria-label":r("sequenceSelect"),value:n.sequenceId??"",onChange:i=>e.select(i.target.value),children:t.map(i=>Tr("option",{value:i.id,children:i.name},i.id))}),Tr(v_,{controls:e,duration:n.duration,hasTracks:t.find(i=>i.id===n.sequenceId)?.tracks.some(i=>!i.muted&&i.keyframes.length>0)??!1}),!!n.issues.length&&vc("details",{children:[Tr("summary",{children:r("sequenceIssues")}),n.issues.map(i=>Tr("p",{children:i},i))]})]}):null}import{useEffect as Gv,useRef as Hv,useState as Wv}from"react";function qv(e,t){if(!e?.configuration)return e;let r=e.configuration,n=r.models?.find(o=>Ee(o)===t||o.url===t);if(!n)return e;let i=r.activeModelId??r.modelUrl;return{...e,objectBindings:n.objectBindings,configuration:{...r,models:r.models?.map(o=>Ee(o)===i?{...o,sceneConfig:r.sceneConfig,objectBindings:e.objectBindings??o.objectBindings}:o),activeModelId:Ee(n),modelUrl:n.url,sceneConfig:n.sceneConfig??r.sceneConfig}}}function Xv(e){let[t,r]=Wv(null),[n,i]=Wv(null),o=Yl(e.arHandoff),a=!!e.arHandoff&&o?.autoRestore!==!1,s=o?.storage,l=`${e.modelUrl}
|
|
1
|
+
import{A as Cy,B as Ty,C as Qa,D as ec,E as tc,F as rc,G as nc,H as Ry,I as ky,J as Iy,K as By,a as _b,b as de,c as Kl,d as Jb,e as Zb,f as ey,h as iy,i as Tp,k as Pp,l as oy,m as ay,n as Ql,o as Ya,p as ui,q as sy,r as ly,s as cy,t as uy,u as dy,v as py,w as my,x as _p,y as hy,z as fy}from"./chunk-OTSCPJWF.mjs";import{$ as jb,A as Rb,Aa as Qb,B as Gl,C as kb,D as Db,Ea as Ep,K as qa,L as Ob,La as Dy,Ma as Oy,N as xp,Na as Ly,O as Lb,R as Ee,Ra as jy,Sa as Ny,Ta as zy,X as Hl,Y as Ib,Z as Wl,_ as Bb,a as si,aa as Nb,b as li,ba as zb,c as vb,ca as Vb,d as xb,da as ql,e as on,ea as Fb,fa as Xl,ga as Xa,ha as Ub,ia as wp,j as Nl,ja as $l,k as wb,ka as Gb,la as Hb,m as zo,ma as Wb,n as Fo,o as Qi,p as Eb,q as Ab,ra as qb,s as zl,sa as Yl,ua as Mp,v as Vl,va as Xb,w as Uo,wa as $b,x as Cn,xa as Yb,y as Fl,ya as Sp,z as Ul,za as Kb}from"./chunk-4JMJALRO.mjs";import{A as by,B as yy,C as vy,D as xy,E as wy,F as Ka,G as Zl,H as My,I as Sy,J as Py,K as _y,L as Ey,M as Go,P as Ay,Q as Ap,a as nr,b as an,c as Vo,d as ci,e as Mb,f as Sb,g as Fr,h as Cb,i as Tb,k as Pb,m as ty,n as $a,o as Cp,q as ry,r as ny,s as gy,v as Ft,w as di,x as Jl,y as Ur,z as vt}from"./chunk-V7WZUWJ5.mjs";import{a as vp}from"./chunk-JR557W27.mjs";import{useCallback as lr,useRef as Xo,useState as $y}from"react";import{Vector3 as Yy}from"three";var Rp=new WeakSet;function Ho(e){Rp.add(e)}function Vy(e){let t=Rp.has(e);return t&&Rp.delete(e),t}var kp=new WeakSet;function Fy(e,t){t?kp.add(e):kp.delete(e)}function Wo(e,t){return kp.has(e)?0:t}import{Box3 as Wy,Matrix4 as nP,PerspectiveCamera as qy,Vector3 as Lp}from"three";import{Vector3 as Uy}from"three";function Dp(e){if(!e?.trim()||/[\u0000-\u001f\u007f]/.test(e))return null;try{let t=new URL(e.trim(),"https://annotation.invalid/");return t.protocol==="https:"||t.protocol==="http:"?e.trim():null}catch{return null}}function Op(e){return e.category?.trim()??""}function Gy(e,t){if(t===null)return e;let r=new Set(t.map(n=>n.trim()));return e.filter(n=>r.has(Op(n)))}function Hy(e,t){let r=Number.isFinite(e.minDistance)?Math.max(0,e.minDistance):0,n=Number.isFinite(e.maxDistance)?Math.max(0,e.maxDistance):1/0;return t>=r&&t<=n}function ic(e){return!!e&&[e.position,e.target].every(t=>Array.isArray(t)&&t.length===3&&t.every(Number.isFinite))}function qo(e){let t=e.camera;return{position:e.getPosition(new Uy,!1).toArray(),target:e.getTarget(new Uy,!1).toArray(),azimuthAngle:e.azimuthAngle,polarAngle:e.polarAngle,fov:"fov"in t?Number(t.fov):null,zoom:t.zoom}}function Ja(e,t){ic(t)&&(e.setLookAt(...t.position,...t.target,!0),Number.isFinite(t.azimuthAngle)&&Number.isFinite(t.polarAngle)&&e.rotateTo(t.azimuthAngle,t.polarAngle,!0),Ji(e,t))}function Ji(e,t){let r=!1;t.fov!=null&&Number.isFinite(t.fov)&&t.fov>0&&t.fov<180&&"fov"in e.camera&&(e.camera.fov=t.fov,e.camera.updateProjectionMatrix(),r=!0),t.zoom!=null&&Number.isFinite(t.zoom)&&t.zoom>0&&e.zoomTo(t.zoom,!0),r&&e.dispatchEvent({type:"update"})}function Xy(e,t){let r=qo(e);if(!(e.camera instanceof qy)||!t)return r;let n=t instanceof Wy?t:new Wy().setFromObject(t);return n.isEmpty()||(r.framing={aspect:e.camera.aspect,min:n.min.toArray(),max:n.max.toArray()}),r}function oc(e,t){let r=t.camera,n=e.framing;if(!(r instanceof qy)||!n||!(r.aspect>0)||Math.abs(r.aspect-n.aspect)<1e-6)return[...e.position];let i=new Lp(...e.position),o=new Lp(...e.target),a=i.clone().sub(o).normalize(),s=new nP().lookAt(i,o,r.up).invert(),l=Math.tan((e.fov??r.fov)*Math.PI/360)/(e.zoom??r.zoom);if(!(l>0)||!Number.isFinite(l))return[...e.position];let u=0;for(let d of[n.min[0],n.max[0]])for(let p of[n.min[1],n.max[1]])for(let c of[n.min[2],n.max[2]]){let h=new Lp(d,p,c).sub(i).applyMatrix4(s);u=Math.max(u,Math.abs(h.x)/(l*r.aspect)+h.z,Math.abs(h.y)/l+h.z)}return i.addScaledVector(a,u*1.02).toArray()}function Ky(e){return[e.x,e.y,e.z]}function Gr(e,t){let r=new Yy,n=new Yy;return t.getPosition(r),t.getTarget(n),{position:Ky(r),target:Ky(n),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 iP(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 Za(e,t,r=.6){let n=e.smoothTime;e.smoothTime=Wo(e,r);try{return await t()}finally{e.smoothTime=n}}function NB(e={}){let t=Xo(e);t.current=e;let r=Xo(null),[n,i]=$y(null),[o,a]=$y(()=>({...e.presets})),s=Xo(o);s.current=o;let l=lr(S=>{i(C=>iP(C,S)?C:S)},[]),u=lr(S=>{l(S)},[l]),d=Xo(null),p=Xo(null),c=Xo(null),h=lr(S=>{r.current=S;let C=Gr(S.raw.controls.camera,S.raw.controls);l(C),S.raw.scene!==p.current&&(p.current=S.raw.scene,d.current=null,c.current=null),S.homeCameraState&&!d.current&&(d.current=S.homeCameraState);let{initialPosition:T,initialTarget:A,initialTransition:R=!1}=t.current;if((T||A)&&S.raw.scene&&(T||S.homeCameraState)&&c.current!==S.raw.controls){c.current=S.raw.controls,S.homeCameraState||Ho(S.raw.controls);let L=T??C.position,N=A??C.target;S.raw.controls.setLookAt(L[0],L[1],L[2],N[0],N[1],N[2],R).then(()=>{if(r.current?.raw.controls!==S.raw.controls)return;let I=Gr(S.raw.controls.camera,S.raw.controls);d.current={position:I.position,target:I.target},l(I)}).catch(()=>{})}},[l]),m=lr(async()=>{let S=r.current,C=S?.raw.controls;if(!C)return!1;try{let T=d.current;if(T){Ji(C,T);let A=oc(T,C);await Za(C,()=>C.setLookAt(A[0],A[1],A[2],T.target[0],T.target[1],T.target[2],!0))}else S?.raw.scene?await Za(C,()=>C.fitToBox(S.raw.scene,!0,{paddingTop:.5,paddingBottom:.5,paddingLeft:.5,paddingRight:.5})):await Za(C,()=>C.reset(!0));return!0}catch{return!1}},[]),y=lr(async()=>{let S=r.current;if(!S?.raw.controls||!S.raw.scene)return!1;try{return await Za(S.raw.controls,()=>S.raw.controls.fitToBox(S.raw.scene,!0,{paddingTop:.5,paddingBottom:.5,paddingLeft:.5,paddingRight:.5})),!0}catch{return!1}},[]),v=lr(async S=>{let C=r.current;if(!C?.raw.controls)return!1;let T=zo(C.objectBindings,S);if(!T)return!1;let A=C.raw.nodes[T];if(!A)return!1;try{return await Za(C.raw.controls,()=>C.raw.controls.fitToBox(A,!0,{paddingTop:.5,paddingBottom:.5,paddingLeft:.5,paddingRight:.5})),!0}catch{return!1}},[]),M=lr(async(S,C=!0)=>{let T=r.current?.raw.controls;if(!T)return!1;try{return r.current?.homeCameraState||Ho(T),await T.setTarget(S[0],S[1],S[2],C),l(Gr(T.camera,T)),!0}catch{return!1}},[l]),g=lr(async(S,C=!0)=>{let T=r.current?.raw.controls;if(!T)return!1;try{r.current?.homeCameraState||Ho(T);let A=[T.setLookAt(S.position[0],S.position[1],S.position[2],S.target[0],S.target[1],S.target[2],C)];S.azimuthAngle!=null&&S.polarAngle!=null&&A.push(T.rotateTo(S.azimuthAngle,S.polarAngle,C)),await Promise.all(A);let R=T.camera,L=!1;return S.fov!=null&&"fov"in R&&typeof R.fov=="number"&&(R.fov=S.fov,L=!0),S.zoom!=null&&"zoom"in R&&typeof R.zoom=="number"&&(R.zoom=S.zoom,L=!0),L&&"updateProjectionMatrix"in R&&R.updateProjectionMatrix(),l(Gr(R,T)),!0}catch{return!1}},[l]),f=lr((S,C=!0)=>g(S,C),[g]),x=lr((S,C,T=!0)=>g({position:S,target:C},T),[g]),P=lr(async(S,C,T=!0)=>{let A=r.current?.raw.controls;if(!A)return!1;try{return r.current?.homeCameraState||Ho(A),await A.rotateTo(S*Math.PI/180,C*Math.PI/180,T),l(Gr(A.camera,A)),!0}catch{return!1}},[l]),b=lr(async(S,C=!0)=>{let T=r.current?.raw.controls;if(!T)return!1;try{return r.current?.homeCameraState||Ho(T),await T.dollyTo(S,C),l(Gr(T.camera,T)),!0}catch{return!1}},[l]),E=lr(S=>{let C=r.current?.raw.controls,T=S.trim();if(!C||!T)return null;let A=Gr(C.camera,C);return s.current={...s.current,[T]:A},a(R=>({...R,[T]:A})),l(A),A},[l]),_=lr((S,C=!0)=>{let T=s.current[S];return T?g(T,C):Promise.resolve(!1)},[g]);return{cameraState:n,cameraPresets:o,resetView:m,focusObject:v,fitScene:y,setCameraTarget:M,setCameraState:f,lookAt:x,orbitTo:P,dollyTo:b,savePreset:E,goToPreset:_,handleCameraChange:u,handleViewerReady:h}}var Qy={showObjectBindingDataPanel:!1,showSceneObjectsPanel:!1,showDownloadButton:!1,showResetButton:!1,showAnnotationNavigation:!1,showMaterialVariants:!1},oP=Object.freeze({minimal:Object.freeze({...Qy}),showcase:Object.freeze({...Qy,autoRotate:!0}),configurator:Object.freeze({showObjectBindingDataPanel:!0,showSceneObjectsPanel:!1,showDownloadButton:!1,showResetButton:!0,showMaterialVariants:!0}),inspector:Object.freeze({showObjectBindingDataPanel:!0,showSceneObjectsPanel:!0,showDownloadButton:!0,showResetButton:!0,showViewGizmo:!0,showMeasureTools:!0,showUvCheckerButton:!0,showExplodeControls:!0,showSectionTools:!0,showIsolateControls:!0,enableKeyboardNavigation:!0})}),aP=["preset","ui","tools","controls","perf","tiles","xr","decoders"];function Jy(e){let t={};for(let r of Object.keys(e))e[r]!==void 0&&(t[r]=e[r]);return t}function sP({ui:e,tools:t,controls:r,perf:n,tiles:i,xr:o,decoders:a}){let s=e?.download,l=e?.mouseController,u=t?.measure,d=r?.autoRotate;return{showObjectBindingDataPanel:e?.objectPanel,showSceneObjectsPanel:e?.sceneObjects,showDownloadButton:s===void 0?void 0:s!==!1,downloadFilename:typeof s=="string"?s:void 0,showResetButton:e?.reset,showFullscreenButton:e?.fullscreen,showLoadingOverlay:e?.loadingOverlay,showViewGizmo:e?.viewGizmo,showMouseController:l===void 0?void 0:l!==!1,mouseControllerPosition:typeof l=="object"?l.position:void 0,mouseControllerOpacity:typeof l=="object"?l.opacity:void 0,showAnnotationNavigation:e?.annotationNavigation,showAnnotationOnHover:e?.annotationOnHover,showAnnotationFilters:e?.annotationFilters,highlightOnHover:e?.highlightOnHover,showMaterialVariants:e?.materialVariants,showObjectNavigator:e?.objectNavigator,showMeasureTools:u===void 0?void 0:u!==!1,measurementUnit:typeof u=="object"?u.unit:void 0,showUvCheckerButton:t?.uvChecker,showExplodeControls:t?.explode,showSectionTools:t?.section,showSequenceControls:t?.sequences,showIsolateControls:t?.isolate,texturePositioning:t?.texturePositioning,enableCameraControls:r?.enabled,enableKeyboardNavigation:r?.keyboard,reducedMotion:r?.reducedMotion,disableZoom:r?.zoom===void 0?void 0:!r.zoom,zoomOnSelected:r?.zoomOnSelect,autoRotate:d===void 0?void 0:d!==!1,autoRotateSpeed:typeof d=="number"?d:void 0,refitOnResize:r?.refitOnResize,cameraLimits:r?.limits,moveSensitivity:r?.moveSensitivity,zoomSensitivity:r?.zoomSensitivity,renderMode:n?.renderMode,maxDpr:n?.maxDpr,performanceProfile:n?.profile,preserveDrawingBuffer:n?.preserveDrawingBuffer,webgpu:n?.webgpu,tilesetUrl:i?.url,tilesErrorTarget:i?.errorTarget,tilesCacheSize:i?.cacheSize,enableXR:o?.enabled,usdzUrl:o?.usdzUrl,arScaleMode:o?.scaleMode,mobileHandoffUrl:o?.mobileHandoffUrl,arHandoff:o?.arHandoff,dracoDecoderPath:a?.draco,ktx2TranscoderPath:a?.ktx2,meshopt:a?.meshopt}}function Zy(e){let t={...e};for(let r of aP)delete t[r];return{...e.preset?oP[e.preset]:void 0,...Jy(t),...Jy(sP(e))}}import{useCallback as pi,useEffect as lP,useRef as ev,useState as Ip}from"react";var Bp={currentClip:null,isPlaying:!1,speed:1,time:0,duration:0,active:[]};function UB(){let e=ev(null),t=ev(null),[r,n]=Ip([]),[i,o]=Ip([]),[a,s]=Ip(Bp);lP(()=>()=>{t.current?.()},[]);let l=pi(v=>{t.current?.(),e.current=v,n(v.clips),o(v.clipDetails??v.clips.map(M=>({sourceName:M,duration:0}))),s(v.getState?.()??Bp),t.current=v.subscribe?.(s)??null},[]),u=pi(()=>{t.current?.(),t.current=null,e.current=null,n([]),o([]),s(Bp)},[]),d=pi(v=>{let M=e.current;M&&(v(M),!M.subscribe&&M.getState&&s(M.getState()))},[]),p=pi((v,M)=>d(g=>g.play(v,M)),[d]),c=pi(v=>d(M=>M.pause(v)),[d]),h=pi(v=>d(M=>M.stop(v)),[d]),m=pi((v,M)=>d(g=>g.setSpeed(v,M)),[d]),y=pi((v,M)=>d(g=>g.seek?.(v,M)),[d]);return{clips:r,clipDetails:i,...a,play:p,pause:c,stop:h,setSpeed:m,seek:y,handleAnimationsReady:l,clearAnimations:u}}function sn(e,t){let r=URL.createObjectURL(e),n=document.createElement("a");n.href=r,n.download=t,n.style.display="none";try{document.body.appendChild(n),n.click()}finally{n.remove(),window.setTimeout(()=>{URL.revokeObjectURL(r)},1e3)}}import{Fragment as ac,jsx as ue,jsxs as le}from"react/jsx-runtime";var Tn=e=>e.toLocaleString(),$o=e=>e==null?"Unknown":e>=1024*1024?`${(e/1024/1024).toFixed(1)} MiB`:`${(e/1024).toFixed(1)} KiB`,jp=e=>e===null?"Unavailable":Tn(e);function cP({report:e,runtimeStats:t,onRefresh:r,onSelectObject:n}){return le("div",{className:"ri-assetDiagnostics",children:[le("div",{className:"ri-diagnosticsActions",children:[r&&ue("button",{type:"button",disabled:!e||e.status==="failed",onClick:r,children:"Rescan asset"}),ue("button",{type:"button",disabled:!e,onClick:()=>{sn(new Blob([JSON.stringify({asset:e,runtime:t??null},null,2)],{type:"application/json"}),"asset-diagnostics.json")},children:"Download report"})]}),e?le(ac,{children:[le("div",{className:`ri-diagnosticsSummary ri-diagnosticsSummary--${e.issues.some(i=>i.severity==="error")?"error":e.issues.some(i=>i.severity==="warning")?"warning":"info"}`,children:[ue("strong",{children:e.status==="failed"?"Asset could not be inspected":e.issues.some(i=>i.severity==="error")?"Issues need attention":e.issues.some(i=>i.severity==="warning")?"Review recommended":"No blocking issues found"}),le("span",{children:[e.issues.filter(i=>i.severity==="error").length," errors \xB7 ",e.issues.filter(i=>i.severity==="warning").length," warnings \xB7 ",e.issues.filter(i=>i.severity==="info").length," notes"]})]}),le("p",{className:"ri-diagnosticsSource",children:[e.source.name??"Loaded asset"," ",ue("span",{children:e.source.format?.toUpperCase()})]}),le("details",{className:"ri-diagnosticsDetail",children:[ue("summary",{children:"Asset statistics"}),le("dl",{className:"ri-diagnosticsMetrics",children:[le("div",{children:[ue("dt",{children:"Source"}),ue("dd",{children:e.source.name??"Loaded asset"})]}),le("div",{children:[ue("dt",{children:"Format"}),ue("dd",{children:e.source.format?.toUpperCase()??"Unknown"})]}),le("div",{children:[ue("dt",{children:"Source file size"}),ue("dd",{children:$o(e.source.sourceBytes)})]}),le("div",{children:[ue("dt",{children:"Initial asset load"}),ue("dd",{children:e.source.loadDurationMs==null?"Unknown":`${(e.source.loadDurationMs/1e3).toFixed(2)} s`})]}),le("div",{children:[ue("dt",{children:"Units"}),ue("dd",{children:e.units==="unknown"?"Unknown \u2014 verify scale":e.units})]}),e.bounds&&le("div",{children:[ue("dt",{children:"Bounds (scene units)"}),ue("dd",{children:e.bounds.size.map(i=>Number(i.toPrecision(4))).join(" \xD7 ")})]}),e.statistics&&le(ac,{children:[le("div",{children:[ue("dt",{children:"Meshes / instances"}),le("dd",{children:[Tn(e.statistics.meshes)," / ",Tn(e.statistics.instances)]})]}),le("div",{children:[ue("dt",{children:"Unique triangles"}),ue("dd",{children:Tn(e.statistics.triangles)})]}),le("div",{children:[ue("dt",{children:"Unique vertices"}),ue("dd",{children:Tn(e.statistics.vertices)})]}),le("div",{children:[ue("dt",{children:"Materials / textures"}),le("dd",{children:[Tn(e.statistics.materials)," / ",Tn(e.statistics.textures)]})]}),le("div",{children:[ue("dt",{children:"Geometry buffers"}),ue("dd",{children:$o(e.statistics.geometryBytes)})]}),le("div",{children:[ue("dt",{children:"Texture memory estimate"}),le("dd",{children:[$o(e.statistics.estimatedTextureBytes),e.statistics.unknownTextureSizes?` + ${e.statistics.unknownTextureSizes} unknown`:""]})]})]})]}),le("p",{className:"ri-diagnosticsNote",children:[e.scope==="resident-tiles"?"Counts cover loaded tiles only. ":"Counts include loaded hidden meshes. ","Buffer sizes and texture memory are estimates, not a GPU memory budget. Units do not verify physical scale."]})]}),ue("div",{className:"ri-diagnosticsIssues",children:e.issues.map((i,o)=>le("details",{className:`ri-diagnosticsIssue ri-diagnosticsIssue--${i.severity}`,children:[le("summary",{children:[ue("span",{className:"ri-diagnosticsSeverity",children:i.severity}),i.title,i.count!==void 0&&ue("span",{className:"ri-diagnosticsCount",children:Tn(i.count)})]}),le("div",{children:[ue("p",{children:i.detail}),ue("p",{className:"ri-diagnosticsFix",children:i.suggestion}),!!i.objects?.length&&ue("ul",{"aria-label":`Affected objects: ${i.title}`,children:i.objects.map((a,s)=>ue("li",{children:n&&!["failed-resources","large-textures"].includes(i.code)?ue("button",{type:"button",onClick:()=>n(a),children:a}):a},`${a}-${s}`))}),i.count&&i.count>(i.objects?.length??0)&&i.objects&&le("small",{children:["Showing the first ",i.objects.length," of ",Tn(i.count),"."]})]})]},`${i.code}-${o}`))}),!!e.textures.length&&le("details",{className:"ri-diagnosticsDetail",children:[le("summary",{children:["Texture dimensions (",e.textures.length,")"]}),ue("ul",{children:e.textures.map((i,o)=>le("li",{children:[ue("strong",{children:i.name}),le("span",{children:[i.width??"?"," \xD7 ",i.height??"?",i.compressed?" \xB7 compressed":""," \xB7 ",$o(i.estimatedBytes)]})]},o))})]}),!!e.extensions.length&&le("details",{className:"ri-diagnosticsDetail",children:[le("summary",{children:["glTF extensions (",e.extensions.length,")"]}),ue("ul",{children:e.extensions.map(i=>le("li",{children:[ue("strong",{children:i.name}),le("span",{children:[i.recognized?"Recognized":"Not recognized",i.required?" \xB7 required":" \xB7 optional"]})]},i.name))}),ue("p",{className:"ri-diagnosticsNote",children:"Recognized by the bundled loader; compressed formats still require configured decoders and device support."})]})]}):ue("p",{className:"ri-diagnosticsNote",role:"status",children:"Waiting for the active asset to load\u2026"}),le("details",{className:"ri-diagnosticsDetail ri-diagnosticsRuntimeDetail",children:[ue("summary",{children:"Runtime statistics \xB7 live"}),le("section",{className:"ri-diagnosticsRuntime","aria-label":"Runtime statistics",children:[le("h4",{children:["Runtime statistics ",ue("span",{children:"Live \xB7 this canvas"})]}),t?le(ac,{children:[le("dl",{className:"ri-diagnosticsMetrics",children:[le("div",{children:[ue("dt",{children:"Renderer / render loop"}),le("dd",{children:[t.renderer.toUpperCase()," / ",t.renderMode]})]}),le("div",{children:[ue("dt",{children:"Draw calls (last pass)"}),ue("dd",{children:jp(t.drawCalls)})]}),le("div",{children:[ue("dt",{children:"Triangles (last pass)"}),ue("dd",{children:jp(t.triangles)})]}),le("div",{children:[ue("dt",{children:"Frame interval / FPS"}),ue("dd",{children:t.frameIntervalMs===null?"Idle / no active frame sample":`${t.frameIntervalMs.toFixed(1)} ms / ${t.fps?.toFixed(0)}`})]}),le("div",{children:[ue("dt",{children:"Quality profile"}),le("dd",{children:[t.quality.profile," \xB7 ",t.quality.reducedGpuLoad?"reduced GPU load":"full quality"]})]}),le("div",{children:[ue("dt",{children:"Pixel ratio"}),ue("dd",{children:t.quality.dpr.toFixed(2)})]}),le("div",{children:[ue("dt",{children:"Shadows / post FX"}),le("dd",{children:[t.quality.shadows?"On":"Off"," / ",t.quality.postProcessing?"Allowed":"Skipped"]})]}),t.streaming&&le(ac,{children:[le("div",{children:[ue("dt",{children:"Tile cache / base budget"}),le("dd",{children:[$o(t.streaming.cachedBytes)," / ",$o(t.streaming.budgetBytes)]})]}),le("div",{children:[ue("dt",{children:"Cached / loading / parsing tiles"}),le("dd",{children:[jp(t.streaming.cachedTiles)," / ",t.streaming.downloading," / ",t.streaming.parsing]})]}),le("div",{children:[ue("dt",{children:"Detail / error target"}),le("dd",{children:["\xD7",t.streaming.detailFactor.toFixed(1)," / ",t.streaming.errorTarget.toFixed(1)]})]})]})]}),t.streaming&&(t.streaming.cacheFull||t.streaming.detailFactor>1)&&le("p",{className:"ri-diagnosticsPressure",children:[t.streaming.cacheFull?"Tile cache is full. ":"",t.streaming.detailFactor>1?"Detail was reduced by the existing memory-pressure safeguard. ":"","Try smaller textures or a larger cache budget when the device can support it."]}),ue("p",{className:"ri-diagnosticsNote",children:"Frame intervals describe active frame callbacks, not CPU/GPU execution time. Long demand-loop idle gaps are excluded. Draw counts may reflect a post-processing pass. Sampling does not keep rendering awake."})]}):ue("p",{className:"ri-diagnosticsNote",children:"Collecting a sample\u2026"})]})]})]})}import{AlertTriangle as uP}from"lucide-react";import{jsx as sc,jsxs as tv}from"react/jsx-runtime";function lc({title:e,message:t,tone:r="default"}){return tv("div",{className:`ri-license-overlay${r==="error"?" ri-license-overlay--error":""}`,children:[tv("div",{className:"ri-license-overlay__header",children:[r==="error"?sc(uP,{size:16,className:"ri-license-overlay__icon","aria-hidden":"true"}):sc("span",{className:"ri-license-overlay__statusDot","aria-hidden":"true"}),sc("span",{className:"ri-license-overlay__title",children:e})]}),sc("p",{className:"ri-license-overlay__message",children:t})]})}function Np(e,t){if(e)return e;let r=t?.background;return r?.enabled&&r.type==="color"?r.color:"#1c1c1d"}var dP={glb:"GLB",gltf:"glTF",obj:"OBJ",fbx:"FBX",usdz:"USDZ",stl:"STL",ply:"PLY"},pP=/\.(glb|gltf|obj|fbx|usdz|stl|ply|zip)$/i;function mP(e,t){let r=e?.response?.status;if(typeof r=="number")return r;let n=/responded with (\d{3})/.exec(t);return n?Number(n[1]):null}function rv(e,t,r,n){let i=e instanceof Error?e.message:e==null?"":String(e),o=(c,h)=>Pb(n,c,h),a=o("loadErrorTitle"),s=i||null;if(fy(e))return{title:a,detail:o("loadErrorPointCloud"),technical:s};let l=mP(e,i);if(l===404||l===410)return{title:a,detail:o("loadErrorNotFound",{status:l}),technical:s};if(l===401||l===403)return{title:a,detail:o("loadErrorDenied",{status:l}),technical:s};if(l!==null)return{title:a,detail:o("loadErrorStatus",{status:l}),technical:s};if(/failed to fetch|networkerror|load failed|network error/i.test(i))return{title:a,detail:o("loadErrorNetwork"),technical:s};if(/<!doctype|<html/i.test(i))return{title:a,detail:o("loadErrorHtml"),technical:s};let u=t.split(/[?#]/,1)[0],d=dP[r??iy(t)],p=pP.test(u);return{title:a,detail:p||r?o(r?"loadErrorInvalidExplicitFormat":"loadErrorInvalidFile",{format:d}):o("loadErrorMissingFormat",{format:d}),technical:s}}var nv={free:0,starter:1,growth:2};function l5(e){return e==="starter"||e==="growth"?e:"free"}function iv(e,t){return nv[e]>=nv[t]}var ov={free:"Free",starter:"Starter",growth:"Growth"};var hP={advancedMaterials:"starter",materialVariants:"starter",customEnvironment:"starter",backgroundImages:"starter",sectionPlanes:"starter",calibratedMeasurements:"starter",animationConfig:"starter",sceneBundle:"starter",cinematic:"starter",rules:"growth",postLighting:"starter",postSelection:"growth"};function cc(e,t){return iv(e,hP[t])}var fP={decalsPerObject:{free:1,starter:1/0,growth:1/0},lights:{free:3,starter:1/0,growth:1/0},annotations:{free:3,starter:1/0,growth:1/0},sequences:{free:1,starter:1/0,growth:1/0},selectionSets:{free:3,starter:1/0,growth:1/0},models:{free:1,starter:3,growth:1/0}};function gP(e,t,r){return r<fP[t][e]}function d5(e,t){return["free","starter","growth"].find(r=>gP(r,e,t))??"growth"}import{createContext as bP,useContext as yP}from"react";var vP=bP({isInsideEditor:!1,activeTab:"object",activeSubTab:"General",tier:"free"});var mi=()=>yP(vP);import{useEffect as CP,useState as TP}from"react";var xP="ri:license-grant:v1",wP={"260cd89ea13f":"MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEwjr3ofKTkkcxOM0GYl/RlJj9JsuyjSF8sYmCd2YqsHJCEO8EvlNDrO2Kl4agFKo6dRhyR2/oWeiU6P9WIqRbvw=="},av=new Map;function lv(e){let t=atob(e);return Uint8Array.from(t,r=>r.charCodeAt(0)).buffer}function sv(e){let t=e.replace(/-/g,"+").replace(/_/g,"/");return lv(t.padEnd(Math.ceil(t.length/4)*4,"="))}function MP(e){if(!e||typeof e!="object")return!1;let t=e;return t.version===1&&typeof t.licenseKeyHash=="string"&&typeof t.domain=="string"&&(t.environment==="development"||t.environment==="production")&&typeof t.tier=="string"&&t.tier.length>0&&typeof t.issuedAt=="number"&&Number.isInteger(t.issuedAt)&&typeof t.expiresAt=="number"&&Number.isInteger(t.expiresAt)}async function uc(e){let t=await crypto.subtle.digest("SHA-256",new TextEncoder().encode(e.trim())),r=String.fromCharCode(...new Uint8Array(t));return btoa(r).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}function zp(e,t){return`${xP}:${t}:${e}`}function SP(e,t){let r=av.get(e);if(r)return r;let n=crypto.subtle.importKey("spki",lv(t),{name:"ECDSA",namedCurve:"P-256"},!1,["verify"]);return av.set(e,n),n}async function Vp(e,t,r){if(!globalThis.crypto?.subtle)return null;try{let[n,i,o,a,...s]=e.split("."),l=wP[i];if(n!=="ri1"||!l||!o||!a||s.length>0)return null;let u=JSON.parse(new TextDecoder().decode(sv(o)));if(!MP(u)||!await crypto.subtle.verify({name:"ECDSA",hash:"SHA-256"},await SP(i,l),sv(a),new TextEncoder().encode(`${n}.${i}.${o}`)))return null;let p=Math.floor(Date.now()/1e3),c=u.expiresAt-u.issuedAt;return u.licenseKeyHash!==t||u.domain!==r||u.expiresAt<=p||u.issuedAt>p+300||c<=0||c>43200?null:{environment:u.environment,tier:u.tier,expiresAt:u.expiresAt}}catch{return null}}async function cv(e,t,r){try{return await Vp(e,await uc(t),r)}catch{return null}}async function uv(e,t,r){try{let n=await uc(t);return await Vp(e,n,r)?(localStorage.setItem(zp(n,r),e),!0):!1}catch{return!1}}async function dv(e,t){try{let r=await uc(e),n=zp(r,t),i=localStorage.getItem(n);if(!i)return null;let o=await Vp(i,r,t);return o||localStorage.removeItem(n),o}catch{return null}}async function Fp(e,t){try{let r=await uc(e);localStorage.removeItem(zp(r,t))}catch{}}var PP=["localhost","127.0.0.1","0.0.0.0"],_P=e=>PP.includes(e)||e.endsWith(".local")||e.endsWith(".localhost"),hv="https://react-immersive.liveroom.dev/api/validate-license",fv=()=>typeof window<"u",EP=300*1e3,AP=5e3,RP=400,Gp=new Map,Up=new Map,hi=class extends Error{},gv=async(e,t,r)=>{let n=await dv(e,t);return n?(console.warn("[react-immersive] License server unreachable \u2014 using a previously verified, time-limited offline grant."),{status:"valid",reason:"Previously verified offline grant",environment:n.environment,tier:n.tier,isLocalDomain:r}):null},pv=async(e,t,r)=>{let n=await gv(e,t,r);return n||(console.warn("[react-immersive] License server unreachable and no valid offline grant is available \u2014 license validation failed."),{status:"invalid",reason:"Could not reach license server",isLocalDomain:r})},kP=e=>e instanceof hi||e instanceof TypeError,DP=()=>new Promise(e=>setTimeout(e,RP)),OP=e=>e==="development"||e==="production",LP=e=>{if(!e||typeof e!="object")return!1;let t=e;return!(typeof t.valid!="boolean"||t.reason!==void 0&&typeof t.reason!="string"||t.environment!==void 0&&!OP(t.environment)||t.tier!==void 0&&typeof t.tier!="string"||t.offlineGrant!==void 0&&typeof t.offlineGrant!="string")},IP=e=>{if(!e||typeof e!="object")return null;let t=e,r=t.reason??t.error;return typeof r=="string"&&r.trim()?r:null},bv=(e,t,r)=>`${r}::${e}::${t}`,yv=e=>{let t=Gp.get(e);return t?Date.now()-t.timestamp>EP?(Gp.delete(e),null):t.result:null},BP=(e,t)=>({status:e.valid?"valid":"invalid",reason:e.reason,environment:e.environment,tier:e.tier,isLocalDomain:t}),jP=(e,t)=>({status:"invalid",reason:e,isLocalDomain:t});async function NP(e,t,r,n){let i=bv(e,t,n),o=yv(i);if(o)return o;let a=Up.get(i);if(a)return a;let s=(async()=>{for(let l=0;l<2;l+=1)try{return await zP(e,t,r,i,n)}catch(u){if(!kP(u))throw u;if(l===0){let d=await gv(e,t,r);if(d)return d;await DP();continue}return pv(e,t,r)}return pv(e,t,r)})().finally(()=>{Up.delete(i)});return Up.set(i,s),s}async function zP(e,t,r,n,i){let o=new AbortController,a=setTimeout(()=>o.abort(),AP),s;try{s=await fetch(i,{method:"POST",headers:{"Content-Type":"application/json"},cache:"no-store",signal:o.signal,body:JSON.stringify({licenseKey:e,domain:t})})}catch(d){throw o.signal.aborted?new hi("License validation timed out"):d}finally{clearTimeout(a)}let l;try{l=await s.json()}catch{throw new hi(`License server returned a non-JSON response${s.status?` (${s.status})`:""}`)}if(!s.ok){if(s.status===429||s.status>=500)throw new hi(`License server error (${s.status})`);let d=IP(l)??`License validation failed${s.status?` (${s.status})`:""}`;return await Fp(e,t),jP(d,r)}if(!LP(l))throw new hi("License server returned an unexpected payload");let u=BP(l,r);if(u.status==="valid"&&i!==hv){let d=l.offlineGrant?await cv(l.offlineGrant,e,t):null;if(!d)throw new hi("License validation endpoint did not return a verifiable signed grant");u={...u,environment:d.environment,tier:d.tier}}return u.status==="valid"?(Gp.set(n,{result:u,timestamp:Date.now()}),l.offlineGrant&&(await uv(l.offlineGrant,e,t)||console.warn("[react-immersive] The license server returned an invalid offline grant; it was not cached."))):await Fp(e,t),u}var mv=(e,t)=>{let r=e.trim();return!fv()||!r?null:yv(bv(r,window.location.hostname.toLowerCase(),t))},vv=(e,t=hv)=>{let[r,n]=TP(()=>mv(e,t)??{status:"checking",isLocalDomain:!1});return CP(()=>{if(!fv())return;let i=!1,o=p=>{i||n(p)},a=e.trim(),s=window.location.hostname.toLowerCase(),l=_P(s),u=mv(e,t);return u?(o(u),()=>{i=!0}):(o({status:"checking",isLocalDomain:l}),a?((async()=>{try{o(await NP(a,s,l,t))}catch(p){let c=p instanceof TypeError?"Could not reach license server":p instanceof Error?p.message:"License validation failed";o({status:"invalid",reason:c,isLocalDomain:l})}})(),()=>{i=!0}):(o({status:"invalid",reason:"No license key provided",isLocalDomain:l}),()=>{i=!0}))},[e,t]),r};import{Box3 as qP,Mesh as XP,Raycaster as $P,Triangle as YP,Vector3 as ln}from"three";import{useCallback as dc,useEffect as VP,useRef as pc}from"react";import{Matrix4 as FP,Triangle as xv,Vector3 as es}from"three";var UP=500,GP=10,HP=5;function mc(e,t,r){let n=pc({resolve:e,onContextMenu:t,anchorOf:r});n.current={resolve:e,onContextMenu:t,anchorOf:r};let i=pc(null),o=pc(!1),a=pc(null),s=dc(()=>{let p=i.current;p?.timer&&clearTimeout(p.timer),i.current=null,a.current?.(),a.current=null},[]),l=dc(()=>{let p=i.current;p&&(s(),p.kind==="touch"&&(o.current=!0,setTimeout(()=>o.current=!1,800)),n.current.onContextMenu?.(p.target,p.pointer))},[s]),u=dc(p=>{let c=p.nativeEvent,h=c.pointerType!=="touch"&&c.button===2,m=c.pointerType==="touch"&&c.button===0;if(!n.current.onContextMenu||!h&&!m)return;let y=n.current.resolve(p.object);if(y===null)return;s();let v={target:y,kind:h?"right":"touch",pointerId:c.pointerId,pointer:Yo(p,n.current.anchorOf?.(p.object)),timer:m?setTimeout(l,UP):null};i.current=v;let M=h?HP:GP,g=b=>Math.hypot(b.clientX-v.pointer.clientX,b.clientY-v.pointer.clientY)>M,f=b=>{b.pointerId===v.pointerId&&g(b)&&s()},x=b=>{b.pointerId===v.pointerId&&(v.kind==="right"&&!g(b)?l():s())},P=b=>{b.pointerId!==v.pointerId&&s()};window.addEventListener("pointermove",f),window.addEventListener("pointerup",x),window.addEventListener("pointercancel",s),window.addEventListener("pointerdown",P),a.current=()=>{window.removeEventListener("pointermove",f),window.removeEventListener("pointerup",x),window.removeEventListener("pointercancel",s),window.removeEventListener("pointerdown",P)}},[s,l]);VP(()=>s,[s]);let d=dc(()=>o.current?(o.current=!1,!0):!1,[]);return{onPointerDown:u,consumeClick:d}}function WP(e,t){let r=e.face,n=t.geometry.getAttribute("position");if(!r||!n)return null;let i=e.barycoord??null;if(!i){let[p,c,h]=[r.a,r.b,r.c].map(m=>t.getVertexPosition(m,new es));if(i=xv.getBarycoord(t.worldToLocal(e.point.clone()),p,c,h,new es),!i)return null}let[o,a,s]=[r.a,r.b,r.c].map(p=>new es().fromBufferAttribute(n,p)),l=new es().addScaledVector(o,i.x).addScaledVector(a,i.y).addScaledVector(s,i.z),u=new xv(o,a,s).getNormal(new es);return r.normal.clone().transformDirection(t.matrixWorld).dot(e.ray.direction)>0&&u.negate(),{position:[l.x,l.y,l.z],normal:[u.x,u.y,u.z]}}function Zi(e,t){if(t.updateWorldMatrix(!0,!1),e.object===t&&t.isSkinnedMesh===!0){let i=WP(e,t);if(i)return i}let r=t.worldToLocal(e.point.clone()),n=e.face?e.face.normal.clone().transformDirection(e.object.matrixWorld):e.ray.direction.clone().negate();return n.dot(e.ray.direction)>0&&n.negate(),n.transformDirection(new FP().copy(t.matrixWorld).invert()),{position:[r.x,r.y,r.z],normal:[n.x,n.y,n.z]}}function Yo(e,t){let r=e.nativeEvent;return{clientX:r.clientX,clientY:r.clientY,pointerType:"pointerType"in r?r.pointerType:"mouse",...t?{surface:Zi(e,t)}:{}}}function wv(e,t){if(!(e instanceof XP)||!t)return null;let r=e.geometry.getAttribute("position");if(!r?.count)return null;e.updateWorldMatrix(!0,!1),t.updateWorldMatrix(!0,!1);let n=new qP,i=new ln;if(nr(e)){let b=e;b.computeBoundingBox(),b.computeBoundingSphere();for(let E=0;E<r.count;E++)n.expandByPoint(e.getVertexPosition(E,i))}else e.geometry.boundingBox||e.geometry.computeBoundingBox(),n.copy(e.geometry.boundingBox);if(n.applyMatrix4(e.matrixWorld),n.isEmpty())return null;let o=n.getCenter(new ln),a=t.getWorldPosition(new ln),s=t.getWorldDirection(new ln),l=t.isOrthographicCamera,u=new $P,d=b=>{if(l){let _=a.distanceTo(o)+n.getSize(i).length()+1;u.set(b.clone().addScaledVector(s,-_),s)}else u.set(a,b.clone().sub(a).normalize());let E=u.intersectObject(e,!1)[0];return E?Zi({...E,ray:u.ray},e):null},p=d(o);if(p)return p;let c=e.geometry.index,h=c?.count??r.count,m=new ln,y=new ln,v=new ln,M=new ln,g=new ln,f=new ln,x=null,P=1/0;for(let b=0;b+2<h;b+=3){if(e.getVertexPosition(c?c.getX(b):b,m).applyMatrix4(e.matrixWorld),e.getVertexPosition(c?c.getX(b+1):b+1,y).applyMatrix4(e.matrixWorld),e.getVertexPosition(c?c.getX(b+2):b+2,v).applyMatrix4(e.matrixWorld),M.copy(m).add(y).add(v).multiplyScalar(1/3),YP.getNormal(m,y,v,g),l?f.copy(s).negate():f.copy(a).sub(M),g.dot(f)<=0)continue;let E=M.distanceToSquared(o);E<P&&(P=E,x=M.clone())}return x?d(x):null}import{Mesh as KP,Raycaster as QP,Triangle as JP,Vector2 as Mv,Vector3 as Pn}from"three";function Sv(e,t,r,n){if(!(e instanceof KP)||!t)return null;e.updateWorldMatrix(!0,!1),t.updateWorldMatrix(!0,!1);let i=new Pn().fromArray(r.position);if(nr(e)){let u=e;u.computeBoundingBox(),u.computeBoundingSphere();let d=u.geometry.getAttribute("position");if(!d)return null;let p=u.geometry.index,c=p?.count??d.count,h=new JP,m=new Pn,y=new Pn,v=1/0,M=null;for(let g=0;g+2<c;g+=3){let f=[0,1,2].map(P=>p?p.getX(g+P):g+P);h.a.fromBufferAttribute(d,f[0]),h.b.fromBufferAttribute(d,f[1]),h.c.fromBufferAttribute(d,f[2]),h.closestPointToPoint(i,m);let x=m.distanceToSquared(i);if(!(x>=v||!h.getBarycoord(m,y))&&(v=x,M=new Pn().addScaledVector(u.getVertexPosition(f[0],new Pn),y.x).addScaledVector(u.getVertexPosition(f[1],new Pn),y.y).addScaledVector(u.getVertexPosition(f[2],new Pn),y.z),v<1e-12))break}if(!M)return null;i.copy(M)}if(i.applyMatrix4(e.matrixWorld).project(t),!Number.isFinite(i.x)||i.z<-1||i.z>1)return null;let o=new Mv(n==="left"?-.0035:n==="right"?.0035:0,n==="down"?-.0035:n==="up"?.0035:0),a=new QP,s=r.size*.01,l=new Pn().fromArray(r.position);for(let u=1;u>=1/1024;u/=2){a.setFromCamera(new Mv(i.x,i.y).addScaledVector(o,u),t);let d=a.intersectObject(e,!1)[0];if(d){let p=Zi({...d,ray:a.ray},e);if(new Pn().fromArray(p.position).distanceTo(l)<=s)return p}}return null}import{Box3 as ts,PerspectiveCamera as Cv,Sphere as ZP,Vector3 as Ko}from"three";function Tv(e,t,r,n,i){return!!(e?.usesSlots&&t.usesSlots&&e.url!==t.url&&r.includes(e.url)&&r.includes(t.url)&&n[e.url]&&n[t.url]&&i[e.url]&&i[t.url])}function Pv(e,t,r){let n=t?.camera;if(!(n instanceof Cv))return null;let o=(e instanceof ts?e:new ts().setFromObject(e)).getSize(new Ko).length();return!Number.isFinite(o)||o<=0?null:(n.near=o/100,n.far=o*100,n.updateProjectionMatrix(),t&&r===void 0&&(t.maxDistance=o*10),o)}function _v(e,t){let r=e.camera;if(!(r instanceof Cv)||!(t>0))return;let n=Math.min(Math.max(e.distance/200,t/1e5),t/100);Math.abs(n-r.near)<=r.near*.01||(r.near=n,r.updateProjectionMatrix())}var hc={paddingTop:.5,paddingBottom:.5,paddingLeft:.5,paddingRight:.5},rs={kind:"model"};function Ev(e,t){let r=new ts().setFromObject(t);return r.isEmpty()?!1:(r.expandByScalar(r.getSize(new Ko).length()*.05),r.containsPoint(e.getTarget(new Ko)))}function Av(e,t){return e.getTarget(new Ko).distanceTo(t)<=Math.max(e.distance,1)*.001}async function Hp(e,t,r=.6){let n=e.smoothTime;e.smoothTime=Wo(e,r);try{return await t()}finally{e.smoothTime=n}}async function Rv(e,t,{flyIn:r,onStart:n,invalidate:i}){if(r){let o=(t instanceof ts?t:new ts().setFromObject(t)).getBoundingSphere(new ZP),a=o.center.clone(),l=e.getPosition(new Ko).clone().sub(e.getTarget(new Ko));l.lengthSq()<1e-6&&l.set(0,0,1),l.normalize();let u=Math.max(o.radius*10,20),d=a.clone().add(l.multiplyScalar(u));await e.setLookAt(d.x,d.y,d.z,a.x,a.y,a.z,!1)}n(),await Hp(e,()=>e.fitToBox(t,!0,{paddingTop:.5,paddingBottom:.5,paddingLeft:.5,paddingRight:.5})),await new Promise(o=>{let a=performance.now(),s=()=>{e.active===!1||performance.now()-a>8e3?(e.dispatchEvent({type:"update"}),i(),o()):(i(),setTimeout(s,100))};setTimeout(s,100)})}import{useEffect as e_,useMemo as Dv,useRef as t_}from"react";import{useFrame as r_,useThree as n_}from"@react-three/fiber";import{Box3 as i_,Box3Helper as o_,Group as a_}from"three";var kv="riEditorGizmo";function Qo(e){return e.userData[kv]=!0,e}function fc(e){let t=[];return e.traverse(r=>{r.visible&&r.userData[kv]&&(r.visible=!1,t.push(r))}),()=>{for(let r of t)r.visible=!0}}import{jsx as s_}from"react/jsx-runtime";function Ov({source:e,highlights:t}){let r=n_(a=>a.invalidate),n=Dv(()=>new a_,[]),i=Dv(()=>t.map(a=>{let s=new o_(new i_,a.color);s.raycast=()=>{};let l=s.material;return l.depthTest=!1,l.transparent=!0,l.opacity=.85,s.renderOrder=1e3,Qo(s),{helper:s,id:a.objectId}}),[t]);e_(()=>{for(let{helper:a}of i)n.add(a);return r(),()=>{for(let{helper:a}of i)n.remove(a),a.geometry.dispose(),a.material.dispose();r()}},[n,i,r]);let o=t_(null);return r_(()=>{let a=e.current;if(!a){n.visible=!1;return}n.visible=!0,(o.current?.root!==a||o.current.helpers!==i)&&(o.current={root:a,helpers:i,nodes:si(a).nodesById});let s=o.current.nodes;for(let{helper:l,id:u}of i){let d=s[u];l.visible=!!d,d&&l.box.setFromObject(d)}}),s_("primitive",{object:n})}function Lv(e){let t=[],r="",n=null,i=null,o=0,a="stopped",s=!1,l=[],u=0,d=!1,p=!1,c={sequenceId:null,time:0,duration:0,status:a,previewing:s,ready:!1,issues:[]},h=new Set,m=()=>t.find(x=>x.id===i),y=()=>{c={sequenceId:i,time:o,duration:m()?.duration??0,status:a,previewing:s,ready:!!n,issues:l},h.forEach(x=>x())},v=()=>{n?.restore(),o=0,a="stopped",s=!1,y(),n?.invalidate()},M=x=>t.some(P=>P.id===x)?(i===x||(n?.restore(),i=x,o=0,a="stopped",s=!1,l=n?.inspect(m())??[],y(),n?.invalidate()),!0):!1,g=x=>{if(x&&!M(x))return!1;let P=m();return!n||!P?.tracks.some(b=>!b.muted&&b.keyframes.length)?!1:(e?.(),p=!0,o>=P.duration&&(o=0),a="playing",s=!0,l=n.inspect(P),y(),n.invalidate(),!0)},f=()=>{if(!n||!d||p)return;let x=t.find(P=>P.autoPlay);x&&g(x.id)};return{getState:()=>c,subscribe:x=>(h.add(x),()=>{h.delete(x)}),select:M,play:g,stop:v,pause:()=>{a==="playing"&&(a="paused",y())},seek:x=>{let P=m();return!n||!P||!Number.isFinite(x)?!1:(e?.(),o=Math.max(0,Math.min(P.duration,x)),s=!0,a!=="playing"&&(a="paused"),l=n.inspect(P),y(),n.invalidate(),!0)},capture:x=>n?.capture(x)??null,configure:(x,P)=>{d=P;try{let b=Nl(x??[]),E=JSON.stringify(b);if(r===E){f();return}n?.restore(),t=b,r=E,m()||(i=t[0]?.id??null,o=0,s=!1),o=Math.min(o,m()?.duration??0),a=s?"paused":"stopped",l=m()?n?.inspect(m())??[]:[],y(),n?.invalidate(),f()}catch(b){v(),t=[],r="",i=null,l=[b instanceof Error?b.message:"Invalid sequence configuration."],y()}},connect:x=>{n?.restore(),n=x,x||(a="stopped",s=!1,o=0),l=m()?n?.inspect(m())??[]:[],y(),f()},advance:x=>{let P=m();if(!P||!n||a!=="playing"||!Number.isFinite(x)||x<0)return;let b=Math.min(x,.1);o+=b,u+=b,o>=P.duration&&(P.loop?o%=P.duration:(o=P.duration,a="finished")),(u>=1/30||a==="finished")&&(u=0,y())},frame:()=>{let x=m();return s&&x?{sequence:x,time:o,playing:a==="playing"}:null},destroy:()=>{n?.restore(),n=null,a="stopped",s=!1,o=0,y()}}}import{useLayoutEffect as yc,useMemo as c_,useRef as u_}from"react";import{useFrame as d_,useThree as p_}from"@react-three/fiber";import{Color as Bv}from"three";import{Matrix4 as Iv,Quaternion as l_,Vector3 as gc}from"three";function Jo(e){return new Iv().set(1,e[0],e[1],0,0,1,e[2],0,0,0,1,0,0,0,0,1)}function cn(e,t){e.matrixAutoUpdate=!t,e.updateMatrix(),t&&(e.matrix.makeRotationFromQuaternion(e.quaternion).multiply(Jo(t)).scale(e.scale).setPosition(e.position),e.matrixWorldNeedsUpdate=!0)}function bc(e,t,r){let n=new gc().setFromMatrixColumn(e,0),i=new gc().setFromMatrixColumn(e,1),o=new gc().setFromMatrixColumn(e,2),a=(m,y)=>{let v=m*(y<0?-1:1);return Math.abs(v-y)<1e-10?y:v},s=a(n.length(),t.x);if(Math.abs(s)<1e-12)return{rotation:r.clone(),scale:t.clone(),shear:void 0};n.divideScalar(s);let l=n.dot(i);i.addScaledVector(n,-l);let u=a(i.length(),t.y);if(Math.abs(u)<1e-12)return{rotation:r.clone(),scale:t.clone(),shear:void 0};i.divideScalar(u);let d=n.dot(o);o.addScaledVector(n,-d);let p=i.dot(o);o.addScaledVector(i,-p);let c=a(o.length(),t.z);if(Math.abs(c)<1e-12)return{rotation:r.clone(),scale:t.clone(),shear:void 0};o.divideScalar(c);let h=[l/u,d/c,p/c].map(m=>Math.abs(m)<1e-10?0:m);return{rotation:new l_().setFromRotationMatrix(new Iv().makeBasis(n,i,o)).normalize(),scale:new gc(s,u,c),shear:h.some(Boolean)?h:void 0}}var Wp=e=>e==="baseColor"?"color":e;function jv(e){let t=new Set;return e.traverse(r=>{let n=r;if(n.isMesh)for(let i of Array.isArray(n.material)?n.material:[n.material])i&&t.add(i)}),[...t]}function Nv({root:e,controls:t,animations:r,invalidate:n}){let i=new Map,o=new Map,a=new Map,s=new Set,l=new Map,u=null,d="",p=g=>e()?on(e(),g):null,c=g=>{if(g.kind==="camera"){let E=t();if(!E)return null;let _=Gr(E.camera,E);return{position:_.position,target:_.target,fov:_.fov,zoom:_.zoom}}if(g.kind==="clip"){let E=r();return E?.clips.includes(g.clip)?E.getState?.().active.find(_=>_.clip===g.clip)?.time??0:null}let f=p(g.objectId);if(!f)return null;let x=g.property;if(x==="position"||x==="rotation"||x==="scale")return[f[x].x,f[x].y,f[x].z];if(x==="visible")return f.visible;let P=jv(f).find(E=>E[Wp(x)]!==void 0),b=P?P[Wp(x)]:void 0;return b?.isColor?`#${b.getHexString()}`:typeof b=="number"?b:null},h=g=>{let f=t();f&&(f.stop(),f.setLookAt(...g.position,...g.target,!1),g.fov!==null&&"fov"in f.camera&&(f.camera.fov=g.fov,f.camera.updateProjectionMatrix()),f.zoomTo(g.zoom,!1),f.update(0))},m=g=>{if(i.has(g))return;g.updateWorldMatrix(!0,!0);let f=g.matrixAutoUpdate?void 0:bc(g.matrix,g.scale,g.quaternion).shear;i.set(g,{position:g.position.toArray(),rotation:[g.rotation.x,g.rotation.y,g.rotation.z],scale:g.scale.toArray(),matrix:g.matrix.clone(),auto:g.matrixAutoUpdate,shear:f});for(let x of an(g))Vo(x)||(ci(x,x.matrixWorld),s.add(x))},y=(g,f)=>{let x=r();x?.stop(g),f&&x&&(x.play(g,{alongside:!0,reverse:f.reverse}),x.setSpeed(f.speed,g),x.seek?.(f.time,g),f.status!=="playing"&&x.pause(g))};return{capture:c,restore:()=>{for(let[g,f]of l)y(g,f);l.clear();for(let[g,f]of i)g.position.fromArray(f.position),g.rotation.set(...f.rotation),g.scale.fromArray(f.scale),g.matrix.copy(f.matrix),g.matrixAutoUpdate=f.auto,g.matrixWorldNeedsUpdate=!0;i.clear(),o.forEach((g,f)=>f.visible=g),o.clear(),a.forEach((g,f)=>{g.forEach((x,P)=>{x instanceof Bv?f[P].copy(x):f[P]=x}),f.needsUpdate=!0}),a.clear(),s.forEach(Fr),s.clear(),u&&h(u),u=null,d="",e()?.updateWorldMatrix(!0,!0),n()},inspect:g=>g.tracks.filter(f=>!f.muted&&f.keyframes.length&&c(f.target)===null).map(f=>`Unavailable target: ${f.name}.`),invalidate:n,apply:({sequence:g,time:f,playing:x})=>{let P=g.tracks.map(_=>({track:_,value:wb(_,f)})).filter(_=>_.value!==null);for(let[_,S]of l)P.some(({track:C})=>C.target.kind==="clip"&&C.target.clip===_)||(y(_,S),l.delete(_));for(let{track:_}of P)if(_.target.kind==="object"&&["position","rotation","scale"].includes(_.target.property)){let S=p(_.target.objectId);S&&m(S)}let b=new Map([...a.keys()].map(_=>[_,_.transparent]));o.forEach((_,S)=>S.visible=_),i.forEach((_,S)=>{S.position.fromArray(_.position),S.rotation.set(..._.rotation),S.scale.fromArray(_.scale),cn(S,_.shear)}),a.forEach((_,S)=>_.forEach((C,T)=>{C instanceof Bv?S[T].copy(C):S[T]=C}));let E=r();for(let{track:_,value:S}of P){if(_.target.kind!=="clip"||!E?.seek||!E.clips.includes(_.target.clip))continue;let C=_.target.clip;l.has(C)||(l.set(C,E.getState?.().active.find(T=>T.clip===C)),E.play(C,{alongside:!0}),E.pause(C)),E.seek(S,C)}for(let{track:_,value:S}of P){let C=_.target;if(C.kind==="clip")continue;if(C.kind==="camera"){u||(u=c(C));let R=JSON.stringify(S);(x||R!==d)&&(h(S),d=R);continue}let T=p(C.objectId);if(!T)continue;let A=C.property;if(A==="visible")o.has(T)||o.set(T,T.visible),T.visible=S;else if(A==="position"||A==="rotation"||A==="scale")A==="rotation"?T.rotation.set(...S):T[A].fromArray(S),cn(T,i.get(T)?.shear);else for(let R of jv(T)){let L=Wp(A),N=R[L];if(N===void 0)continue;let I=a.get(R);if(I||(I=new Map,a.set(R,I)),b.has(R)||b.set(R,R.transparent),I.has(L)||I.set(L,N?.isColor?N.clone():N),N?.isColor?N.set(S):R[L]=S,A==="opacity"){I.has("transparent")||I.set("transparent",R.transparent);let z=S<1||I.get("transparent")===!0;R.transparent=z}}}u&&!P.some(({track:_})=>_.target.kind==="camera")&&(h(u),d=""),b.forEach((_,S)=>{_!==S.transparent&&(S.needsUpdate=!0)}),e()?.updateWorldMatrix(!0,!0)}}}function zv({controller:e,source:t,controls:r,animations:n,ready:i,sequences:o,autoPlay:a,authoredRevision:s}){let l=p_(p=>p.invalidate),u=u_({source:t,controls:r,animations:n});u.current={source:t,controls:r,animations:n};let d=c_(()=>Nv({root:()=>u.current.source.current,controls:()=>u.current.controls.current,animations:()=>u.current.animations.current,invalidate:l}),[e,l]);return yc(()=>(l(),()=>d.restore()),[d,s,o,l]),yc(()=>{e.configure(o,a)},[e,o,a]),yc(()=>(e.connect(i?d:null),()=>e.connect(null)),[e,d,i]),yc(()=>{let p=r.current,c=()=>e.pause();return p?.addEventListener("controlstart",c),()=>p?.removeEventListener("controlstart",c)},[e,r,i]),d_((p,c)=>{if(!i)return;e.advance(c);let h=e.frame();h&&d.apply(h),h?.playing&&l()}),null}import{useSyncExternalStore as m_}from"react";import{Pause as h_,Play as f_,Square as g_}from"lucide-react";import{jsx as Tr,jsxs as vc}from"react/jsx-runtime";var b_={sequenceId:null,time:0,duration:0,status:"stopped",previewing:!1,ready:!1,issues:[]},Vv=()=>b_,y_=()=>()=>{};function Fv(e){return m_(e?.subscribe??y_,e?.getState??Vv,Vv)}function v_({controls:e,duration:t,showScrubber:r=!0,hasTracks:n=!0}){let i=de(),o=Fv(e),a=o.status==="playing";return vc("div",{className:"ri-sequenceTransport",children:[Tr("button",{type:"button",onClick:()=>a?e?.pause():e?.play(),disabled:!o.ready||!t||!n,"aria-label":i(a?"sequencePause":"sequencePlay"),title:i(a?"sequencePause":"sequencePlay"),children:Tr("span",{"aria-hidden":"true",children:a?Tr(h_,{size:15}):Tr(f_,{size:15})})}),Tr("button",{type:"button",onClick:()=>e?.stop(),disabled:!o.previewing,"aria-label":i("sequenceStop"),title:i("sequenceStop"),children:Tr(g_,{size:14,"aria-hidden":"true"})}),r&&Tr("input",{"aria-label":i("sequencePlayhead"),type:"range",min:0,max:t||1,step:.01,value:Math.min(o.time,t),disabled:!o.ready||!t,onChange:s=>{e?.pause(),e?.seek(Number(s.target.value))}}),vc("output",{"aria-label":i("sequenceTime"),children:[o.time.toFixed(2)," / ",t.toFixed(2),"s"]})]})}function Uv({controls:e,sequences:t}){let r=de(),n=Fv(e);return t.length?vc("section",{className:"ri-sequencePlayer","aria-label":r("sequencePlayer"),onPointerDown:i=>i.stopPropagation(),children:[Tr("select",{"aria-label":r("sequenceSelect"),value:n.sequenceId??"",onChange:i=>e.select(i.target.value),children:t.map(i=>Tr("option",{value:i.id,children:i.name},i.id))}),Tr(v_,{controls:e,duration:n.duration,hasTracks:t.find(i=>i.id===n.sequenceId)?.tracks.some(i=>!i.muted&&i.keyframes.length>0)??!1}),!!n.issues.length&&vc("details",{children:[Tr("summary",{children:r("sequenceIssues")}),n.issues.map(i=>Tr("p",{children:i},i))]})]}):null}import{useEffect as Gv,useRef as Hv,useState as Wv}from"react";function qv(e,t){if(!e?.configuration)return e;let r=e.configuration,n=r.models?.find(o=>Ee(o)===t||o.url===t);if(!n)return e;let i=r.activeModelId??r.modelUrl;return{...e,objectBindings:n.objectBindings,configuration:{...r,models:r.models?.map(o=>Ee(o)===i?{...o,sceneConfig:r.sceneConfig,objectBindings:e.objectBindings??o.objectBindings}:o),activeModelId:Ee(n),modelUrl:n.url,sceneConfig:n.sceneConfig??r.sceneConfig}}}function Xv(e){let[t,r]=Wv(null),[n,i]=Wv(null),o=Yl(e.arHandoff),a=!!e.arHandoff&&o?.autoRestore!==!1,s=o?.storage,l=`${e.modelUrl}
|
|
2
2
|
${e.activeModelId??""}`,u=Hv(l);u.current=l;let d=Hv(l);if(Gv(()=>{l!==d.current&&(d.current=l,r(null))},[l]),Gv(()=>{if(!a||typeof window>"u"){r(null),i(null);return}let c,h=()=>{c?.abort(),c=new AbortController;let m=c.signal,y=u.current;i(null),Yb(window.location.href,s,m).then(v=>{!m.aborted&&u.current===y&&r(v)}).catch(v=>{!m.aborted&&u.current===y&&(r(null),i(v instanceof Error?v.message:"Could not restore the AR configuration."))})};return h(),window.addEventListener("hashchange",h),()=>{c?.abort(),window.removeEventListener("hashchange",h)}},[a,s]),!t?.configuration)return{props:e,error:n};let p=t.configuration;return{error:n,props:{...e,...p,objectBindings:t.objectBindings??e.objectBindings,onObjectBindingsChange:c=>{r(h=>h?.configuration?{...h,objectBindings:c,configuration:{...h.configuration,models:h.configuration.models?.map(m=>Ee(m)===(h.configuration?.activeModelId??h.configuration?.modelUrl)?{...m,objectBindings:c}:m)}}:h),e.onObjectBindingsChange?.(c)},onSceneConfigChange:c=>{r(h=>h?.configuration?{...h,configuration:{...h.configuration,sceneConfig:c}}:h),e.onSceneConfigChange?.(c)},onIsolationChange:c=>{r(h=>h?.configuration?{...h,configuration:{...h.configuration,isolation:c}}:h),e.onIsolationChange?.(c)},onActiveModelChange:c=>{r(h=>qv(h,c)),e.onActiveModelChange?.(c)},onModelChange:c=>{r(h=>qv(h,c)),e.onModelChange?.(c)}}}}import{useCallback as qp,useEffect as xc,useRef as ns,useState as Xp}from"react";function $v({enabled:e,options:t,state:r,getSources:n,baseUrl:i,revision:o=""}){let a,s=!1;try{a=e?Xb(r,t?.assetVersion,t?.maxTextureSize)+(i??"")+o:"disabled"}catch{s=!0,a="invalid-configuration"+(t?.assetVersion??"")+o}let[l,u]=Xp(!1),[d,p]=Xp(!1),[c,h]=Xp(null),m=ns(null),y=ns(!1),v=ns(null),M=ns(null),g=ns({key:a,state:r,options:t,getSources:n,baseUrl:i,enabled:e,invalidConfiguration:s});g.current={key:a,state:r,options:t,getSources:n,baseUrl:i,enabled:e,invalidConfiguration:s};let f=qp(()=>{v.current&&URL.revokeObjectURL(v.current),v.current=null},[]);xc(()=>{m.current?.abort(),y.current=!1,p(!1),f(),h(S=>e&&S?{key:S.key,invalidated:!0,warnings:[]}:null),e||u(!1)},[a,e,f]),xc(()=>()=>{m.current?.abort(),f()},[f]);let x=e&&!c?.invalidated&&c?.key===a,P=x&&!!(c.usdzUrl||c.phoneUrl),b=d?"preparing":e?c&&!x?"stale":x?P?"ready":"error":"idle":"idle";xc(()=>{g.current.options?.onStatusChange?.(b)},[b]);let E=qp(()=>{m.current?.abort(),y.current&&(h(null),f()),y.current=!1,p(!1),u(!1)},[f]),_=qp(async()=>{let S=g.current;if(!S.enabled)return;m.current?.abort(),f(),h(null),p(!0),y.current=!0;let C=new AbortController;m.current=C;let T=()=>!C.signal.aborted&&g.current.key===S.key&&g.current.enabled,A=k=>{T()&&h(U=>({...U?.key===S.key&&!U.invalidated?U:{key:S.key,warnings:[]},...k}))},R;try{if(S.invalidConfiguration)throw new Error("Invalid configuration");R=structuredClone(S.state)}catch{let k=new Error("Configuration contains data that cannot be copied for AR. Use JSON-compatible binding metadata.");y.current=!1,p(!1),A({exportError:k.message}),S.options?.onError?.(k);return}let L,N={configurationKey:S.key,state:R,signal:C.signal,exportUSDZ:()=>L??(L=Promise.resolve().then(()=>Qb(S.getSources(),{scaleMode:S.state.configuration?.arScaleMode,maxTextureSize:S.options?.maxTextureSize,signal:C.signal})))},I=[],z=async()=>{try{let k=S.options?.createUSDZ?await S.options.createUSDZ(N):(await N.exportUSDZ()).blob,U=L?await L.then(re=>re.warnings,()=>[]):[];if(!T())return;let ee;if(typeof k=="string")ee=Mp(k,window.location.href);else if(k instanceof Blob&&k.size>0)ee=URL.createObjectURL(k),v.current=ee;else throw new Error("The USDZ adapter returned an empty asset.");A({usdzUrl:ee,warnings:U})}catch(k){let U=k instanceof Error?k.message:String(k);I.push(U),A({exportError:U})}},D=async()=>{try{let k=S.options?.createMobileUrl?await S.options.createMobileUrl(N):await qb(N.state,window.location.href).then(ee=>$b(ee,S.baseUrl||window.location.href,S.options?.storage,C.signal));if(!T())return;let U=Mp(k,window.location.href);if(U.length>2200)throw new Error("The phone link is too long for a reliable QR code.");A({phoneUrl:U})}catch(k){let U=k instanceof Error?k.message:String(k);!S.options?.createMobileUrl&&U.includes("durable URL")&&(U="QR sharing isn\u2019t available for local uploads. Download the USDZ and send it to your phone."),!S.options?.createMobileUrl&&(U.includes("reachable from your phone")||U.includes("asset URL points to this computer"))&&(U="QR sharing needs a viewer page and model files your phone can reach. Use an online viewer, or download the USDZ."),I.push(U),A({linkError:U})}};await Promise.all([z(),D()]),T()&&(y.current=!1,p(!1),I.length&&S.options?.onError?.(new Error(I.join(`
|
|
3
3
|
`))))},[f]);return xc(()=>{if(!e||!l){M.current=null;return}P||d||M.current===a||(M.current=a,_())},[e,l,a,P,d,_]),{open:e&&l,show:()=>u(!0),close:E,prepare:_,status:b,busy:d,prepared:x?c:null}}import{useEffect as x_,useId as w_,useRef as M_}from"react";import{QRCodeSVG as S_}from"qrcode.react";import{Download as C_,LoaderCircle as T_,RefreshCw as P_,Smartphone as __,X as E_}from"lucide-react";import{Fragment as A_,jsx as jt,jsxs as fi}from"react/jsx-runtime";function Yv({handoff:e,filename:t,onQuickLook:r}){let n=de(),i=w_(),o=M_(null),a=e.close;x_(()=>{let l=document.activeElement;o.current?.focus();let u=d=>{if(d.key==="Escape"&&(d.preventDefault(),a()),d.key!=="Tab")return;let p=Array.from(o.current.querySelectorAll("button:not(:disabled), a[href], summary")),c=p[0],h=p[p.length-1];d.shiftKey&&(document.activeElement===c||document.activeElement===o.current)?(d.preventDefault(),h?.focus()):!d.shiftKey&&(document.activeElement===h||document.activeElement===o.current)&&(d.preventDefault(),c?.focus())};return document.addEventListener("keydown",u),()=>{document.removeEventListener("keydown",u),l?.focus()}},[a]);let s=e.prepared;return jt("div",{className:"ri-mobileHandoffBackdrop",onMouseDown:l=>{l.target===l.currentTarget&&a()},children:fi("section",{ref:o,tabIndex:-1,className:"ri-mobileHandoffDialog ri-configuredARDialog",role:"dialog","aria-modal":"true","aria-labelledby":i,"aria-busy":e.busy&&!s?.phoneUrl&&!s?.usdzUrl,children:[jt("button",{type:"button",className:"ri-mobileHandoffClose",onClick:a,"aria-label":n("closePhoneHandoff"),children:jt(E_,{size:18})}),jt(__,{size:22,"aria-hidden":"true"}),jt("h2",{id:i,children:n("arConfiguredTitle")}),jt("p",{children:n("arConfiguredDescription")}),jt("div",{role:"status","aria-live":"polite",className:"ri-configuredARProgress",children:(e.busy||e.status==="idle"||e.status==="stale")&&fi("p",{children:[jt(T_,{size:16,"aria-hidden":"true"}),n("arPreparing")]})}),s?.phoneUrl&&fi(A_,{children:[jt("p",{children:n("arScanConfigured")}),jt("div",{className:"ri-mobileHandoffQr",children:jt(S_,{value:s.phoneUrl,size:208,level:"M",marginSize:4,title:n("qrCodeToOpenThisModelOnAPhone")})}),jt("a",{href:s.phoneUrl,target:"_blank",rel:"noopener noreferrer",children:n("arOpenConfiguredLink")})]}),s?.usdzUrl&&fi("div",{className:"ri-configuredARActions",children:[Kl()&&fi("a",{rel:"ar",className:"ri-configuredARLaunch",href:s.usdzUrl,onClick:r,children:[jt("img",{alt:"",width:"1",height:"1",src:"data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///ywAAAAAAQABAAACAUwAOw=="}),n("viewInAR")]}),fi("a",{href:s.usdzUrl,download:`${t}-configured.usdz`,children:[jt(C_,{size:14}),n("arDownloadUSDZ")]})]}),s?.exportError&&jt("p",{role:"alert",children:s.exportError}),s?.linkError&&jt("p",{role:"status",children:s.linkError}),!e.busy&&(e.status==="ready"||e.status==="error")&&fi("button",{type:"button",className:"ri-configuredARRefresh",onClick:()=>{e.prepare()},children:[jt(P_,{size:14,"aria-hidden":"true"}),e.status==="error"?n("arRetry"):n("arRefresh")]}),!!s?.warnings.length&&fi("details",{className:"ri-configuredARDetails",children:[jt("summary",{children:n("arExportDetails")}),s.warnings.map(l=>jt("p",{className:"ri-configuredARNote",children:l},l))]})]})})}import{useRef as me,useState as Me,useEffect as Xe,useCallback as he,useMemo as _t,Suspense as FS}from"react";import{GizmoHelper as ZI,GizmoViewport as eB}from"@react-three/drei";import{Box3 as tB,Raycaster as rB,Vector2 as nB,Vector3 as df}from"three";import{Component as R_}from"react";var un=class extends R_{constructor(){super(...arguments);this.state={hasError:!1}}static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(r,n){this.props.onLoadError?.(r)}render(){return this.state.hasError?null:this.props.children}};import{useCallback as Kv,useEffect as Qv,useState as k_}from"react";function Jv({enabled:e,activeUrl:t,models:r,errorsRef:n,activeFailed:i,activeError:o,onActiveError:a,onExtraError:s}){let[l,u]=k_(0),d=Kv((c,h)=>{n.current.set(c,h),u(m=>m+1),c!==t&&s?.(c,h)},[t,n,s]),p=Kv(c=>{n.current.delete(c)&&u(h=>h+1)},[n]);return Qv(()=>{let c=new Set(e?r?.map(Ee):[]);for(let h of n.current.keys())c.has(h)||n.current.delete(h)},[e,r,n]),Qv(()=>{if(!e||!n.current.has(t))return;let c=n.current.get(t);i&&Object.is(o,c)||a(c)},[e,t,r,n,l,i,o,a]),{reportError:d,clearError:p}}import{useCallback as D_,useEffect as Zv,useRef as wc}from"react";function ex(e,t){let r=wc({}),n=wc({}),i=wc({}),o=wc(0),a=D_(s=>{var l;return(l=i.current)[s]??(l[s]={current:{}})},[]);return Zv(()=>{let s=new Set(e?t?.map(Ee):[]);for(let l of Object.keys(r.current))s.has(l)||delete r.current[l];for(let l of Object.keys(n.current))s.has(l)||delete n.current[l];for(let l of Object.keys(i.current))s.has(l)||(i.current[l].current={},delete i.current[l])},[e,t]),Zv(()=>{let s=++o.current;return()=>{queueMicrotask(()=>{o.current===s&&(r.current={},n.current={},Object.values(i.current).forEach(l=>{l.current={}}),i.current={})})}},[]),{scenesByUrlRef:r,cameraHomesByUrlRef:n,materialRefsByUrlRef:i,getMaterialRefsForUrl:a}}import{useCallback as tx,useEffect as I_,useState as rx}from"react";import{useEffect as O_,useRef as L_}from"react";function _n(e,t){let r=L_(t);O_(()=>{let n=r.current;r.current=t,t.some((i,o)=>!Object.is(i,n[o]))&&e()},t)}var B_={};function nx({modelUrl:e,activeModelId:t,tilesetUrl:r,models:n,objectBindings:i="auto",onChange:o,initialBindings:a,initialModelEdits:s}){let l=t??e,u=!!(n?.length&&!r),d=i==="auto"&&!u,p=!d&&o!==void 0,c=i==="auto"?B_:i,[h,m]=rx(()=>a??c),[y,v]=rx(()=>{let P=new Map(s),b=u?n?.find(E=>Ee(E)===l):void 0;return b&&a&&s===void 0&&P.set(l,{source:b.objectBindings,bindings:a}),P});_n(()=>{p||m(c)},[p,c]),I_(()=>{let P=new Map(u?n?.map(b=>[Ee(b),b.objectBindings]):[]);v(b=>{let E=[...b].filter(([_,S])=>!p&&P.get(_)===S.source);return E.length===b.size?b:new Map(E)})},[u,n,p]);let M=tx(P=>{let b=p?void 0:y.get(Ee(P));return b?.source===P.objectBindings?b.bindings:P.objectBindings},[p,y]),g=u?n?.find(P=>Ee(P)===l):void 0,f=g?M(g):p?c:h,x=tx(P=>{p||(g?v(b=>new Map(b).set(Ee(g),{source:g.objectBindings,bindings:P})):m(P)),o?.(P)},[p,g,o]);return{autoBindings:d,controlled:p,currentBindings:f,applyBindings:x,bindingsForModel:M,modelEdits:y}}import{PerspectiveCamera as $p,Vector2 as j_}from"three";function Mc(e,t={}){if(!e)return Promise.reject(new Error("Viewer not ready"));let{gl:r,scene:n,camera:i,invalidate:o}=e,a=ui(r);if(!a&&!r.getContextAttributes().preserveDrawingBuffer)return Promise.reject(new Error("Screenshot capture is disabled. Set preserveDrawingBuffer on ModelViewer to enable it."));let{transparent:s=!1}=t,l=r.getSize(new j_),u=r.getPixelRatio(),d=i instanceof $p?i.aspect:null,p=n.background,c=t.width??l.x,h=t.height??l.y,m=c!==l.x||h!==l.y,y=fc(n);s&&(n.background=null),m&&(r.setPixelRatio(1),r.setSize(c,h,!1),i instanceof $p&&(i.aspect=c/h,i.updateProjectionMatrix()));let v=()=>{y(),s&&(n.background=p),m&&(r.setPixelRatio(u),r.setSize(l.x,l.y,!1),i instanceof $p&&d!==null&&(i.aspect=d,i.updateProjectionMatrix())),o()};if(a)try{return r.render(n,i),Promise.resolve(r.domElement.toDataURL("image/png"))}catch(M){return Promise.reject(M)}finally{v()}return o(),new Promise((M,g)=>{requestAnimationFrame(()=>{requestAnimationFrame(()=>{let f,x;try{f=r.domElement.toDataURL("image/png")}catch(P){x=P}v(),x?g(x):M(f)})})})}import{useCallback as Cc,useEffect as H_,useRef as lx,useState as cx}from"react";import{Vector3 as ux}from"three";import{useEffect as Sc,useMemo as En,useRef as An}from"react";import{useFrame as N_,useThree as z_}from"@react-three/fiber";import{Box3 as V_,CatmullRomCurve3 as ix,Sphere as F_,Spherical as U_,Vector3 as gi}from"three";function Yp(e){if(e.duration!==void 0)return e.duration;let t=e.waypoints??[];if(t.length<2)return 24;let r=e.loop===!1?t.slice(0,-1):t;return Math.max(r.reduce((n,i)=>n+(i.segmentDuration??3.5),0),4)}var G_=1.2;function Zo({controlsRef:e,sceneRef:t,config:r,playing:n,resetOnPlay:i=!1,onFinished:o,onUserInteract:a,onStop:s,playOnce:l=!1,startAtPath:u=!1,onStarted:d,onProgress:p}){let c=z_(D=>D.invalidate),h=En(()=>r.waypoints??[],[r.waypoints]),m=h.length>=2,y=r.loop??!0,v=Yp(r),M=En(()=>h.map(D=>[...D.position,...D.target,D.azimuthAngle??"",D.polarAngle??"",D.segmentDuration??""].join(",")).join(";"),[h]),g=En(()=>{let D=[];if(h.length<2)return D;let k=0;for(let U=0;U<h.length-1;U++)k+=h[U].segmentDuration??3.5,D.push(k);return y&&h.length>1&&(k+=h[h.length-1].segmentDuration??3.5,D.push(k)),D},[h,y]),f=En(()=>D=>{if(h.length<2||g.length===0)return D/v;let k=g[g.length-1],U=y?D%v:Math.min(D,v),ee=v>0?U/v*k:0;for(let re=0;re<g.length;re++)if(ee<=g[re]){let Oe=re===0?0:g[re-1],Ve=g[re]-Oe,H=Ve>0?(ee-Oe)/Ve:0,q=y?h.length:h.length-1,xe=re/q,fe=1/q;return xe+H*fe}return 1},[h.length,g,v,y]),x=En(()=>m?{position:new ix(h.map(D=>new gi(...D.position)),y,"catmullrom",.5),target:new ix(h.map(D=>new gi(...D.target)),y,"catmullrom",.5)}:null,[M,m,y]),P=En(()=>{if(!m||!h.every(k=>Number.isFinite(k.azimuthAngle)&&Number.isFinite(k.polarAngle)))return null;let D=h.map(k=>({azimuth:k.azimuthAngle,polar:k.polarAngle,distance:new gi(...k.position).distanceTo(new gi(...k.target))}));for(let k=1;k<D.length;k+=1){let U=D[k-1].azimuth,ee=D[k].azimuth;D[k].azimuth=ee+Math.round((U-ee)/(Math.PI*2))*Math.PI*2}return D},[M,m]),b=An(0),E=An(0),_=An(new gi),S=An(new gi),C=An(!1),T=An(!0),A=An(0),R=An(!1),L=An(null),N=En(()=>new gi,[]),I=En(()=>new gi,[]),z=En(()=>new U_,[]);return Sc(()=>{b.current=0,A.current=0,E.current=0,R.current=!1},[M,y,v]),Sc(()=>{i&&(A.current=0,b.current=0,R.current=!1)},[i]),Sc(()=>{if(!n){C.current=!1,b.current>0&&!i?A.current=b.current:i&&(A.current=0),(b.current>0||R.current)&&s?.();return}b.current>=v&&!y&&(b.current=0,A.current=0,R.current=!1);let D=e.current;if(D&&(D.getPosition(_.current),D.getTarget(S.current)),i||R.current||A.current===0?(b.current=0,A.current=0,R.current=!1):A.current>0&&A.current<v?b.current=A.current:(b.current=0,A.current=0),E.current=0,!m){let k=t.current;if(k){let U=new V_().setFromObject(k).getBoundingSphere(new F_);L.current={center:U.center.clone(),radius:U.radius>0?U.radius:1}}}C.current=!0,T.current=!0,c()},[n,m,e,t,c,v,y,M,i,s]),Sc(()=>{if(!n||!a)return;let D=e.current;if(!D)return;let k=()=>{R.current||a()};return D.addEventListener("controlstart",k),()=>D.removeEventListener("controlstart",k)},[n,e,a]),N_((D,k)=>{if(!n||!C.current)return;let U=e.current;if(!U)return;let ee=T.current;T.current=!1,(!ee||!u)&&(b.current+=k,E.current+=k);let re=(!y||l)&&b.current>=v,Oe=re&&y?0:f(b.current);if(Oe=y?Oe%1:Math.min(Oe,1),x)if(x.target.getPoint(Oe,I),P){let H=y?P.length:P.length-1,q=Math.min(Oe,1)*H,xe=Math.min(Math.floor(q),H-1),fe=(xe+1)%P.length,Ae=Oe>=1?1:q-xe,K=Ae*Ae*(3-2*Ae),ne=P[xe],Le=P[fe],Ie=Le.azimuth+Math.round((ne.azimuth-Le.azimuth)/(Math.PI*2))*Math.PI*2,Ye=ne.azimuth+(Ie-ne.azimuth)*K,J=ne.polar+(Le.polar-ne.polar)*K,dt=ne.distance+(Le.distance-ne.distance)*K;z.set(Math.max(dt,1e-6),Math.min(Math.max(J,1e-6),Math.PI-1e-6),Ye),N.setFromSpherical(z).add(I)}else x.position.getPoint(Oe,N);else{let H=L.current;if(!H)return;let q=Oe*Math.PI*2,xe=H.radius*2.2;N.set(H.center.x+Math.cos(q)*xe,H.center.y+H.radius*.6,H.center.z+Math.sin(q)*xe),I.copy(H.center)}let Ve=u?1:Math.min(E.current/G_,1);if(Ve<1){let H=Ve*Ve*(3-2*Ve);N.lerpVectors(_.current,N,H),I.lerpVectors(S.current,I,H)}if(U.setLookAt(N.x,N.y,N.z,I.x,I.y,I.z,!1),ee&&d?.(),p?.(Math.min(b.current/v,1)),re){C.current=!1,R.current=!0,b.current=0,A.current=0,o?.();return}c()}),null}function ox(){return typeof document<"u"&&typeof HTMLCanvasElement<"u"&&typeof HTMLCanvasElement.prototype.captureStream=="function"}function ax(e,t={}){let{fps:r=15,gifWidth:n=480,signal:i}=t;if(!Number.isFinite(r)||r<1||r>60)throw new Error("Video frame rate must be between 1 and 60.");if(!Number.isInteger(n)||n<16||n>4096)throw new Error("GIF width must be a whole number of pixels from 16 to 4096.");if(i?.aborted)throw new DOMException("Video export cancelled.","AbortError");if(typeof e.captureStream!="function"||typeof document>"u")throw new Error("Video recording as GIF is not supported in this browser.");let o=1e3/r,a,s,l,u=null,d,p=0,c=0,h=0,m=null,y=0,v=0,M=0,g=!1,f=!1,x,P,b,E,_,S,C=new Promise((k,U)=>{_=k,S=U}),T=()=>{clearTimeout(x),clearInterval(P),b!==void 0&&cancelAnimationFrame(b),E!==void 0&&cancelAnimationFrame(E),i?.removeEventListener("abort",R),e.removeEventListener("webglcontextlost",L),l&&(l.pause(),l.srcObject=null),s?.getTracks().forEach(k=>k.stop())},A=(k=new DOMException("Video export cancelled.","AbortError"))=>{g||(g=!0,T(),S(k))},R=()=>A(),L=()=>A(new Error("Video export stopped because the WebGL context was lost.")),N=()=>A(new Error("Video export timed out. Keep the viewer tab visible while recording."));i?.addEventListener("abort",R,{once:!0}),e.addEventListener("webglcontextlost",L),x=setTimeout(N,3e4);let I=(async()=>{if(a=await import("gifenc"),!g&&(s=e.captureStream(r),l=document.createElement("video"),l.muted=!0,l.playsInline=!0,l.srcObject=s,await l.play(),!g)){if(u=document.createElement("canvas").getContext("2d",{willReadFrequently:!0}),!u)throw new Error("Video recording as GIF is not supported in this browser.");d=a.GIFEncoder()}})().catch(k=>A(k)),z=k=>{if(!m||!d)return;let U=Math.max(2,Math.round((k-y)/10)-M);M+=U,d.writeFrame(m.index,p,c,{palette:m.palette,delay:U*10}),m=null},D=()=>{if(g||!a||!l||!u||!d||l.readyState<2||!l.videoWidth)return;let k=performance.now();if(!(h>0&&k-v<o/2)){p||(p=Math.min(n,l.videoWidth),c=Math.max(1,Math.round(p*l.videoHeight/l.videoWidth)),u.canvas.width=p,u.canvas.height=c);try{u.drawImage(l,0,0,p,c);let{data:U}=u.getImageData(0,0,p,c),ee=a.quantize(U,256),re=a.applyPalette(U,ee);h===0&&(y=k),z(k),m={index:re,palette:ee},v=k,h+=1}catch(U){A(U)}}};return{result:C,cancel:A,start(k){g||b!==void 0||(b=requestAnimationFrame(()=>{I.then(()=>{g||(D(),P=setInterval(D,o),clearTimeout(x),x=setTimeout(N,(k+30)*1e3))})}))},finish(){g||f||(f=!0,E=requestAnimationFrame(()=>{I.then(()=>{if(g||(D(),g))return;if(!d||h===0){A(new Error("The browser produced an empty video."));return}z(v+o),d.finish();let k=new Blob([d.bytes()],{type:"image/gif"});g=!0,T(),_(k)})}))}}}var Kp={webm:["video/webm;codecs=vp9","video/webm;codecs=vp8","video/webm"],mp4:["video/mp4;codecs=avc1.42E01E","video/mp4"]};function Rn(e="auto"){return e==="gif"?ox()?"image/gif":null:typeof MediaRecorder>"u"?null:(e==="auto"?[...Kp.webm,...Kp.mp4]:Kp[e]).find(r=>MediaRecorder.isTypeSupported(r))??null}function sx(e,t={}){if(t.format==="gif")return ax(e,t);let{fps:r=30,videoBitsPerSecond:n=8e6,signal:i}=t;if(!Number.isFinite(r)||r<1||r>60)throw new Error("Video frame rate must be between 1 and 60.");if(!Number.isFinite(n)||n<=0)throw new Error("Video bitrate must be a positive number.");if(i?.aborted)throw new DOMException("Video export cancelled.","AbortError");let o=Rn(t.format);if(!o||typeof e.captureStream!="function"){let b=t.format&&t.format!=="auto"?` as ${t.format.toUpperCase()}`:"";throw new Error(`Video recording${b} is not supported in this browser.`)}let a,s,l=!1,u=!1,d,p,c,h=[],m,y,v=new Promise((b,E)=>{m=b,y=E}),M=()=>{clearTimeout(d),p!==void 0&&cancelAnimationFrame(p),c!==void 0&&cancelAnimationFrame(c),i?.removeEventListener("abort",f),e.removeEventListener("webglcontextlost",x),s&&(s.ondataavailable=null,s.onstop=null,s.onerror=null),a?.getTracks().forEach(b=>b.stop())},g=(b=new DOMException("Video export cancelled.","AbortError"))=>{if(!l){if(l=!0,M(),s&&s.state!=="inactive")try{s.stop()}catch{}y(b)}},f=()=>g(),x=()=>g(new Error("Video export stopped because the WebGL context was lost.")),P=()=>g(new Error("Video export timed out. Keep the viewer tab visible while recording."));return i?.addEventListener("abort",f,{once:!0}),e.addEventListener("webglcontextlost",x),d=setTimeout(P,3e4),{result:v,cancel:g,start(b){l||p!==void 0||(p=requestAnimationFrame(()=>{if(!l)try{a=e.captureStream(r);let E=new MediaRecorder(a,{mimeType:o,videoBitsPerSecond:n});s=E,E.ondataavailable=({data:_})=>{_.size>0&&h.push(_)},E.onerror=()=>g(new Error("The browser could not encode the video.")),E.onstop=()=>{if(l)return;l=!0,M();let _=new Blob(h,{type:E.mimeType||o});_.size===0?y(new Error("The browser produced an empty video.")):m(_)},E.start(1e3),clearTimeout(d),d=setTimeout(P,(b+30)*1e3)}catch(E){g(E)}}))},finish(){l||u||(u=!0,c=requestAnimationFrame(()=>{if(!l)try{if(!s)throw new Error("Video recording did not start.");s.stop()}catch(b){g(b)}}))}}}function dx(e){let t=lx(e);t.current=e;let r=lx(null),[n,i]=cx(null),[o,a]=cx(0),s=Cc(()=>r.current?.cancel(),[]),l=Cc(()=>r.current!==null,[]);H_(()=>s,[e.modelUrl,s]);let u=Cc(async(p={})=>{let{rendererCaptureRef:c,controlsRef:h,cinematicConfig:m,ready:y,onCaptureStart:v}=t.current,M=c.current,g=h.current;if(!y||!M||!g)throw new Error("Viewer not ready for video export.");if(M.gl.xr.isPresenting)throw new Error("Exit the XR session before recording a video.");if(r.current)throw new Error("A video export is already in progress.");let f=p.mode??(m?"cinematic":"turntable");if(f==="cinematic"&&!m)throw new Error("Enable a cinematic camera path before recording it.");let x=f==="cinematic"?m:{loop:!0},P=p.duration??(f==="turntable"&&p.format==="gif"?8:Yp(x));if(!Number.isFinite(P)||P<=0||P>300)throw new Error("Video duration must be greater than 0 and at most 300 seconds.");let b=sx(M.gl.domElement,p);r.current=b;let E=g.getPosition(new ux),_=g.getTarget(new ux),S=g.enabled,C=fc(M.scene);g.stop(),g.enabled=!1,a(0),v(),i({config:{...x,duration:P,autoPlay:!1},onStarted:()=>b.start(P),onFinished:b.finish});try{return await b.result}finally{C(),g.enabled=S,g.setLookAt(E.x,E.y,E.z,_.x,_.y,_.z,!1),M.invalidate(),r.current=null,i(null)}},[]),d=Cc(p=>{let c=Math.floor(p*100);a(h=>h===c?h:c)},[]);return{captureVideo:u,cancelVideo:s,isRecording:l,recording:n,progress:o,onProgress:d}}import{useCallback as W_,useEffect as q_,useRef as X_,useState as is}from"react";function px(e){let[t,r]=is(null),[n,i]=is(!1),[o,a]=is(!1),[s,l]=is(!1),[u,d]=is(null),p=X_(!1);q_(()=>{if(!t||!e){i(!1),a(!1),d(null);return}let h=t.ownerDocument;i(h.fullscreenEnabled===!0&&typeof t.requestFullscreen=="function"&&typeof h.exitFullscreen=="function");let m=()=>{a(h.fullscreenElement===t),d(null)};return m(),h.addEventListener("fullscreenchange",m),()=>h.removeEventListener("fullscreenchange",m)},[t,e]);let c=W_(async()=>{if(!t||!e||!n||p.current)return;let h=t.ownerDocument,m=h.fullscreenElement===t;p.current=!0,l(!0),d(null);try{m?await h.exitFullscreen():await t.requestFullscreen(),a(h.fullscreenElement===t)}catch{d(m?"Could not exit fullscreen. Press Escape to exit.":"Could not enter fullscreen. Check your browser or iframe fullscreen permissions and try again.")}finally{p.current=!1,l(!1)}},[t,e,n]);return{rootRef:r,supported:n,active:o,pending:s,error:u,toggle:c}}import{useCallback as Tc,useEffect as hx,useRef as os,useState as Qp}from"react";function mx(e,{onLost:t,onRestored:r,initiallyLost:n=!1}){let i=n,o=s=>{s.preventDefault(),!i&&(i=!0,t())},a=()=>{i&&(i=!1,r())};return e.addEventListener("webglcontextlost",o),e.addEventListener("webglcontextrestored",a),n&&t(),()=>{e.removeEventListener("webglcontextlost",o),e.removeEventListener("webglcontextrestored",a)}}function fx(e){let t=os(e);t.current=e;let[r,n]=Qp(null),[i,o]=Qp(0),[a,s]=Qp("ready"),l=os(null),u=os(!1),d=os(null),p=os(null),c=Tc(v=>{p.current?.dispose(),p.current=null,d.current=v,n(v)},[]),h=Tc(()=>{u.current||(u.current=!0,t.current?.(),l.current?.(),l.current=null,d.current&&(p.current=d.current),d.current=null,n(null),s("rebuilding"),o(v=>v+1))},[]),m=Tc(()=>{l.current?.(),l.current=null;let v=d.current;d.current=null,n(null),v&&dy(v)},[]),y=Tc(()=>{u.current=!1,s("lost")},[]);return hx(()=>()=>{p.current?.dispose(),p.current=null},[]),hx(()=>{if(!r)return;if(u.current=!1,s("ready"),ui(r)){let M=r,g=M.onDeviceLost;return M.onDeviceLost=f=>{console.warn("[react-immersive] The WebGPU device was lost.",f),y()},()=>{M.onDeviceLost=g}}let v=mx(r.domElement,{initiallyLost:r.getContext().isContextLost(),onLost:y,onRestored:h});return l.current=v,()=>{v(),l.current===v&&(l.current=null)}},[r,y,h]),{generation:i,status:a,reload:h,fail:y,release:m,onRendererCreated:c}}function Pc(e,t){return t||e}async function gx(e,t){await e.setLookAt(...t.position,...t.target,!1);let r=e.camera;t.fov!=null&&Number.isFinite(t.fov)&&t.fov>0&&t.fov<180&&"fov"in r&&(r.fov=t.fov,r.updateProjectionMatrix()),t.zoom!=null&&Number.isFinite(t.zoom)&&t.zoom>0&&await e.zoomTo(t.zoom,!1)}import{Component as $_}from"react";var ea=class extends $_{constructor(){super(...arguments);this.state={hasError:!1}}static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(r,n){this.props.onError?.(r)}render(){return this.state.hasError?this.props.fallback??null:this.props.children}};import{useEffect as Y_,useMemo as K_,useRef as Q_}from"react";function bx({modelUrl:e,tilesetUrl:t=null,getOptions:r,now:n=()=>performance.now(),timestamp:i=()=>new Date().toISOString(),sessionId:o=typeof crypto<"u"&&crypto.randomUUID?crypto.randomUUID():`viewer-${Date.now().toString(36)}-${Math.random().toString(36).slice(2)}`,log:a=l=>console.info("[react-immersive engagement]",l),warn:s=l=>console.warn("[react-immersive] onEngagement callback failed:",l)}){let l=n(),u=()=>{let T=r();return!!(T.onEngagement||T.debugEngagement)},d=T=>Math.max(0,Math.round(n()-T)),p=T=>{let{onEngagement:A,debugEngagement:R}=r();if(!A&&!R)return;let L={...T,sessionId:o,timestamp:i(),elapsedMs:d(l),modelUrl:e,tilesetUrl:t};R&&a(L);try{Promise.resolve(A?.(L)).catch(s)}catch(N){s(N)}},c=null,h=null,m="[]",y=null,v=null,M=T=>{c=T},g=T=>{!u()||c===T.objectKey||(c=T.objectKey,p({type:"part-viewed",...T}))},f=(T,A,R=null)=>{let L=JSON.stringify([R,A,T]);!u()||T===A||L===h||(h=L,p({type:"variant-chosen",variant:T,previousVariant:A,group:R}))},x=T=>{let A=JSON.stringify(T);A!==m&&(m=A,h=null)},P=()=>{!u()||y!==null||(y=n(),p({type:"ar-started"}))},b=(T="session-ended")=>{if(y===null)return;let A=d(y);y=null,p({type:"ar-ended",durationMs:A,reason:T})},E=(T="stopped")=>{if(!v)return;let{startedAt:A,annotationCount:R}=v;v=null,p({type:"tour-stopped",annotationCount:R,durationMs:d(A),reason:T})};return{setSelectedPart:M,viewPart:g,setActiveVariants:x,chooseVariant:f,startAR:P,endAR:b,startTour:T=>{!u()||T<=0||(E("restarted"),v={startedAt:n(),annotationCount:T},p({type:"tour-started",annotationCount:T}))},stopTour:E,completeTour:()=>{if(!v)return;let{startedAt:T,annotationCount:A}=v;v=null,p({type:"tour-completed",annotationCount:A,durationMs:d(T)})},interrupt:()=>{b("interrupted"),E("interrupted")},requestARLaunch:T=>p({type:"ar-launch-requested",channel:T})}}function yx(e){let t=Q_(e);t.current=e;let r=!!(e.onEngagement||e.debugEngagement),n=K_(()=>bx({modelUrl:e.modelUrl,tilesetUrl:e.tilesetUrl,getOptions:()=>t.current}),[e.modelUrl,e.tilesetUrl,r]);return Y_(()=>()=>n.interrupt(),[n]),n}import{Color as J_}from"three";function vx(e,t,r){let n=t[r]?.modelObjectId;return e.lighting.lights.filter(i=>{let o=i.attachment?.objectId;return o?zo(t,o)===r||o===n:!1})}function Jp(e,t){return e.lighting.lights.some(r=>t[r.id])?{...e,lighting:{...e.lighting,lights:e.lighting.lights.map(r=>t[r.id]?{...r,...t[r.id]}:r)}}:e}function xx(e){let t=null;if(e?.traverse(i=>{if(t)return;let o=i.material;for(let a of Array.isArray(o)?o:o?[o]:[])if(a.emissive instanceof J_){t=a;return}}),!t)return{color:"#000000",intensity:0,on:!1};let r=`#${t.emissive.getHexString()}`,n=t.emissiveIntensity??1;return{color:r,intensity:n,on:r!=="#000000"&&n>0}}import{HexColorPicker as Z_}from"react-colorful";import{Fragment as wx,jsx as bi,jsxs as as}from"react/jsx-runtime";function Mx({kind:e,color:t,brightness:r,onColorChange:n,onBrightnessChange:i,onClose:o}){return bi("div",{className:"ri-popover ri-popover--inline",style:{padding:12},onPointerDown:a=>a.stopPropagation(),children:e==="change-light-color"?as(wx,{children:[bi("p",{className:"ri-popoverLabel",children:"Light color"}),bi(Z_,{color:t,onChange:n}),as("div",{className:"ri-inlineRow",children:[bi("span",{className:"ri-colorCode",children:t}),bi("button",{className:"ri-secondaryButton",onClick:o,children:"Done"})]})]}):as(wx,{children:[bi("p",{className:"ri-popoverLabel",children:"Brightness"}),bi("input",{type:"range",min:0,max:200,step:1,value:r,"aria-label":"Brightness",style:{width:"100%"},onChange:a=>i(Number(a.target.value))}),as("div",{className:"ri-inlineRow",children:[as("span",{className:"ri-colorCode",children:[r,"%"]}),bi("button",{className:"ri-secondaryButton",onClick:o,children:"Done"})]})]})})}import{useRef as o2,useState as Px}from"react";import{ArrowDown as e2,ArrowLeft as t2,ArrowRight as r2,ArrowUp as n2}from"lucide-react";import{useEffect as i2,useRef as Zp}from"react";function Sx(e){let t=!1,r,n=()=>{t||(e(),t||(r=setTimeout(n,70)))};return e(),r=setTimeout(n,300),()=>{t=!0,clearTimeout(r)}}import{jsx as ss,jsxs as Cx}from"react/jsx-runtime";function Tx({onNudge:e}){let t=de(),r=Zp(e);r.current=e;let n=Zp(null),i=Zp(null),o=()=>{n.current?.(),n.current=null,i.current=null};return i2(()=>{let a=l=>{l.pointerId===i.current&&o()},s=l=>{l.key==="Escape"&&o()};return window.addEventListener("pointerup",a,!0),window.addEventListener("pointercancel",a,!0),window.addEventListener("blur",o),window.addEventListener("keydown",s),()=>{o(),window.removeEventListener("pointerup",a,!0),window.removeEventListener("pointercancel",a,!0),window.removeEventListener("blur",o),window.removeEventListener("keydown",s)}},[]),Cx("div",{className:"ri-decalPosition",children:[Cx("div",{children:[ss("div",{className:"ri-decalPosition__label",children:t("position")}),ss("div",{className:"ri-decalPosition__hint",children:t("decalNudgeHint")})]}),ss("div",{className:"ri-decalPosition__pad",role:"group","aria-label":t("decalNudgeControls"),children:[["up",n2],["left",t2],["right",r2],["down",e2]].map(([a,s])=>ss("button",{type:"button",className:`ri-decalPosition__button ri-decalPosition__button--${a}`,"aria-label":t("moveDecal",{direction:t(a)}),title:t("moveDecalOnSurface",{direction:t(a)}),onPointerDown:l=>{l.button===0&&(l.preventDefault(),l.currentTarget.focus({preventScroll:!0}),o(),i.current=l.pointerId,n.current=Sx(()=>r.current(a)))},onClick:l=>{l.detail===0&&r.current(a)},children:ss(s,{size:16})},a))})]})}import{Fragment as _x,jsx as Tt,jsxs as dn}from"react/jsx-runtime";var a2=e=>Math.round(e*180/Math.PI);function Ex({kind:e,decals:t,activeId:r,error:n,moving:i,defaultSize:o,onSelect:a,onAddText:s,onAddImage:l,onChange:u,onMove:d,onNudge:p,onRemove:c,onClose:h}){let m=de(),[y,v]=Px(""),[M,g]=Px("#ffffff"),f=o2(null),x=t.find(b=>b.id===r)??null;return dn("div",{className:"ri-popover ri-popover--inline ri-decalControl",onPointerDown:b=>b.stopPropagation(),children:[e==="add-text"?dn(_x,{children:[Tt("p",{className:"ri-popoverLabel",children:m("text")}),dn("div",{className:"ri-decalControl__row",children:[Tt("input",{className:"ri-decalControl__input",value:y,placeholder:m("yourText"),"aria-label":m("textToAdd"),onChange:b=>v(b.target.value)}),Tt("input",{type:"color",className:"ri-decalControl__color",value:M,"aria-label":m("textColour"),onChange:b=>g(b.target.value)})]}),Tt("button",{type:"button",className:"ri-uploadButton",disabled:!y.trim(),onClick:()=>{s(y.trim(),M)&&v("")},children:m("addText")})]}):dn(_x,{children:[Tt("p",{className:"ri-popoverLabel",children:m("image")}),Tt("button",{type:"button",className:"ri-uploadButton",onClick:()=>f.current?.click(),children:m("chooseImage")}),Tt("input",{ref:f,type:"file",accept:"image/png,image/jpeg,image/webp,image/svg+xml",className:"ri-hiddenInput","aria-label":m("imageToAdd"),onChange:b=>{let E=b.target.files?.[0];b.target.value="",E&&l(E)}})]}),n?Tt("div",{className:"ri-decalControl__hint",role:"alert",children:n}):null,t.length>0?Tt("div",{className:"ri-decalControl__list",role:"group","aria-label":m("added"),children:t.map((b,E)=>Tt("button",{type:"button",className:`ri-decalControl__chip ${b.id===r?"ri-decalControl__chip--active":""}`,"aria-pressed":b.id===r,onClick:()=>a(b.id),children:b.image?m("decalImage",{index:E+1}):b.text||m("decalText",{index:E+1})},b.id))}):null,x?dn("div",{className:"ri-decalControl__editor",children:[Tt(Tx,{onNudge:b=>p(x.id,b)}),x.image?null:dn("div",{className:"ri-decalControl__row",children:[Tt("input",{className:"ri-decalControl__input",value:x.text??"","aria-label":m("text"),onChange:b=>u(x.id,{text:b.target.value})}),Tt("input",{type:"color",className:"ri-decalControl__color",value:x.color??"#ffffff","aria-label":m("colour"),onChange:b=>u(x.id,{color:b.target.value})})]}),dn("label",{className:"ri-decalControl__slider",children:[Tt("span",{children:m("size")}),Tt("input",{type:"range",min:o/10,max:o*4,step:o/50,value:x.size,"aria-label":m("size"),onChange:b=>u(x.id,{size:Number(b.target.value)})})]}),dn("label",{className:"ri-decalControl__slider",children:[Tt("span",{children:m("turn")}),Tt("input",{type:"range",min:-180,max:180,step:1,value:a2(x.rotation??0),"aria-label":m("rotation"),onChange:b=>u(x.id,{rotation:Number(b.target.value)*Math.PI/180})})]}),dn("div",{className:"ri-inlineRow",children:[Tt("button",{type:"button",className:"ri-secondaryButton","aria-pressed":i,title:m("dragTheDecalAcrossTheObjectsSurface"),onClick:()=>d(x.id),children:m("move")}),Tt("button",{type:"button",className:"ri-removeButton",onClick:()=>c(x.id),children:m("remove")})]})]}):null,dn("div",{className:"ri-inlineRow",children:[Tt("span",{className:"ri-colorCode",children:t.length===0?m("noneAddedYet"):m("decalAdded",{count:t.length})}),Tt("button",{type:"button",className:"ri-secondaryButton",onClick:h,children:m("done")})]})]})}import{useEffect as T2,useRef as P2}from"react";import{useThree as _2}from"@react-three/fiber";import{Mesh as E2,Raycaster as A2,Vector2 as im,Vector3 as Nx}from"three";import{BufferGeometry as s2,CanvasTexture as l2,Float32BufferAttribute as _c,Matrix4 as c2,Object3D as u2,SRGBColorSpace as d2,Uint16BufferAttribute as p2,Vector3 as kn}from"three";var m2=.5,ls=4;function h2(e,t=0){let r=new kn(...e);r.lengthSq()<1e-12&&r.set(0,0,1),r.normalize();let n=new u2;return Math.abs(r.y)>.999&&n.up.set(0,0,-Math.sign(r.y)),n.lookAt(r),n.rotateZ(t),n.rotation.clone()}function f2(e,t,r){let n=null;if(e.bones&&t.bones){n=new Map;for(let[i,o]of e.bones)n.set(i,o*(1-r));for(let[i,o]of t.bones)n.set(i,(n.get(i)??0)+o*r)}return{position:e.position.clone().lerp(t.position,r),normal:e.normal.clone().lerp(t.normal,r),bones:n}}function Ax(e,t,r,n){let i=a=>n?a.position[t]<=r:a.position[t]>=r,o=[];for(let a=0;a<e.length;a++){let s=e[a],l=e[(a+1)%e.length],u=i(s);if(u&&o.push(s),u!==i(l)){let d=l.position[t]-s.position[t];o.push(f2(s,l,(r-s.position[t])/d))}}return o}function Ec(e,t,r){let n=e.geometry,i=n.getAttribute("position");if(!i)return null;let o=n.getAttribute("normal"),a=n.getAttribute("skinIndex"),s=n.getAttribute("skinWeight"),l=!!(a&&s),u=n.getIndex(),d=Math.max(t.size,1e-6),p=d/(r>0&&Number.isFinite(r)?r:1),c=Math.max(d,p)*m2,h={x:d/2,y:p/2,z:c/2},m=new c2().makeRotationFromEuler(h2(t.normal,t.rotation)).setPosition(...t.position),y=m.clone().invert(),v=(N,I)=>{let z=null;if(l){z=new Map;for(let D=0;D<ls;D++){let k=s.getComponent(N,D);if(k<=0)continue;let U=a.getComponent(N,D);z.set(U,(z.get(U)??0)+k)}}return{position:I.clone(),normal:o?new kn().fromBufferAttribute(o,N):new kn,bones:z}},M=[],g=[],f=[],x=[],P=[],b=new kn,E=new kn,_=new kn,S=N=>{if(f.push(.5+N.position.x/d,.5-N.position.y/p),b.copy(N.position).applyMatrix4(m),M.push(b.x,b.y,b.z),g.push(N.normal.x,N.normal.y,N.normal.z),!N.bones)return;let I=[...N.bones].sort((D,k)=>k[1]-D[1]).slice(0,ls),z=I.reduce((D,[,k])=>D+k,0)||1;for(let D=0;D<ls;D++)x.push(I[D]?.[0]??0),P.push((I[D]?.[1]??0)/z)},C=["x","y","z"],T=[new kn,new kn,new kn],A=[0,0,0],R=(u?u.count:i.count)/3;for(let N=0;N<R;N++){for(let D=0;D<3;D++){let k=N*3+D;A[D]=u?u.getX(k):k,T[D].fromBufferAttribute(i,A[D]).applyMatrix4(y)}if(C.some(D=>T[0][D]>h[D]&&T[1][D]>h[D]&&T[2][D]>h[D]||T[0][D]<-h[D]&&T[1][D]<-h[D]&&T[2][D]<-h[D]))continue;let I=T.map((D,k)=>v(A[k],D));if(!o){E.copy(I[1].position).sub(I[0].position),_.copy(I[2].position).sub(I[0].position);let D=E.cross(_).transformDirection(m);for(let k of I)k.normal.copy(D)}let z=I;for(let D of C)if(z=Ax(z,D,h[D],!0),z=Ax(z,D,-h[D],!1),z.length<3)break;for(let D=1;D+1<z.length;D++)S(z[0]),S(z[D]),S(z[D+1])}if(M.length===0)return null;let L=new s2;return L.setAttribute("position",new _c(M,3)),L.setAttribute("normal",new _c(g,3)),L.setAttribute("uv",new _c(f,2)),l&&(L.setAttribute("skinIndex",new p2(x,ls)),L.setAttribute("skinWeight",new _c(P,ls))),L}function kx(e){return JSON.stringify([e.image??null,e.image?null:[e.text??"",e.color,e.fontFamily,e.fontWeight],e.position,e.normal,e.size,e.rotation??0])}var Rx=256,em=24;function Dx(e){let t=`${e.fontWeight??"bold"} ${Rx-em*2}px ${e.fontFamily||"sans-serif"}`,r=document.createElement("canvas"),n=r.getContext("2d");n.font=t;let i=e.text||" ";r.width=Math.min(Math.max(Math.ceil(n.measureText(i).width)+em*2,8),4096),r.height=Rx,n.font=t,n.textAlign="center",n.textBaseline="middle",n.fillStyle=e.color??"#ffffff",n.fillText(i,r.width/2,r.height/2,r.width-em);let o=new l2(r);return o.flipY=!1,o.colorSpace=d2,{texture:o,aspect:r.width/r.height}}import{useEffect as Ox,useRef as g2}from"react";import{BufferGeometry as b2,Float32BufferAttribute as y2,Mesh as v2,MeshStandardMaterial as x2,SkinnedMesh as w2,SRGBColorSpace as Ix}from"three";var eo="riDecal",nm="riDecalId";function tm(){return new b2().setAttribute("position",new y2([],3))}function Lx(e){let t=e.image;return t?.width&&t.height?t.width/t.height:1}function rm(e){e.disposed=!0,e.node.remove(e.mesh),e.mesh.geometry.dispose(),e.mesh.material.dispose(),e.imagePath&&Cn(e.imagePath,Ix),e.ownTexture?.dispose()}function M2(e,t,r,n){let i=new x2({transparent:!0,polygonOffset:!0,polygonOffsetFactor:-4,depthWrite:!1,metalness:0,roughness:.7}),o=nr(e)&&e.skeleton?e:null,a=o?new w2(tm(),i):new v2(tm(),i);if(o){let u=a;u.bind(o.skeleton,o.bindMatrix),u.frustumCulled=!1,u.onBeforeRender=()=>{let d=Mb(o);d&&u.bindMatrixInverse.copy(d)}}a.userData[eo]=!0,a.userData[nm]=t.id,a.raycast=()=>{},a.castShadow=!1,a.receiveShadow=!0,a.renderOrder=1;let s={node:e,mesh:a,signature:r,disposed:!1},l=u=>{let d=Ec(e,t,u);a.geometry.dispose(),a.geometry=d??tm(),a.visible=d!==null};if(t.image){s.imagePath=t.image;let u=Uo(t.image,Ix,()=>{s.disposed||(l(Lx(u)),i.needsUpdate=!0,n())});i.map=u,l(Lx(u))}else{let{texture:u,aspect:d}=Dx(t);s.ownTexture=u,i.map=u,l(d)}return e.add(a),s}function Bx({objectBindings:e,nodeMap:t,invalidate:r}){let n=g2(new Map);Ox(()=>{let i=n.current,o=new Set;for(let[a,s]of Object.entries(e)){if(!s.decals?.length)continue;let l=t[s.modelObjectId??a];if(Ft(l))for(let u of s.decals){if(!u.image&&!u.text)continue;let d=`${a}
|
|
4
4
|
${u.id}`,p=kx(u),c=i.get(d);c&&(c.node!==l||c.signature!==p)&&(rm(c),c=void 0),c||(c=M2(l,u,p,r),i.set(d,c)),c.mesh.material.opacity=(u.opacity??1)*(s.style?.material?.opacity??1),o.add(d)}}for(let[a,s]of i)o.has(a)||(rm(s),i.delete(a));r()},[e,t,r]),Ox(()=>{let i=n.current;return()=>{for(let o of i.values())rm(o);i.clear()}},[])}import{Mesh as S2,SkinnedMesh as C2}from"three";function jx(e,t){let r=[];if(nr(e)){let n=e;n.computeBoundingSphere(),n.computeBoundingBox(),C2.prototype.raycast.call(n,t,r)}else S2.prototype.raycast.call(e,t,r);return r.sort((n,i)=>n.distance-i.distance)[0]}function zx({target:e,nodes:t,controls:r}){let{camera:n,gl:i,invalidate:o}=_2(),a=P2(e);return a.current=e,T2(()=>{let s=i.domElement,l=new A2,u=new im,d=s.style.cursor,p=s.style.touchAction;s.style.cursor="grab",s.style.touchAction="none";let c=0,h=null,m=null,y=(E,_=new im)=>{let S=s.getBoundingClientRect();u.set((E.clientX-S.left-_.x)/S.width*2-1,-((E.clientY-S.top-_.y)/S.height)*2+1),l.setFromCamera(u,n)},v=E=>{if(!m)return;y(E,m.offset),m.node.updateWorldMatrix(!0,!1);let _=l.intersectObject(m.node,!1)[0];if(!_)return;let S=Zi({..._,ray:l.ray},m.node),C=Ec(m.node,{...m.decal,...S},m.aspect);C&&(m.mesh.geometry!==m.geometry&&m.mesh.geometry.dispose(),m.mesh.geometry=C,m.surface=S,o())},M=E=>{if(!m)return;cancelAnimationFrame(c),c=0,h=null;let _=m;m=null,_.mesh.geometry!==_.geometry&&(E&&_.surface?_.geometry.dispose():(_.mesh.geometry.dispose(),_.mesh.geometry=_.geometry)),_.controller&&(_.controller.enabled=_.controlsEnabled),s.hasPointerCapture(_.pointerId)&&s.releasePointerCapture(_.pointerId),s.style.cursor="grab",o();let S=()=>{window.removeEventListener("click",C,!0),window.removeEventListener("pointerdown",S,!0),clearTimeout(T)},C=A=>{A.target===s&&(A.preventDefault(),A.stopImmediatePropagation()),S()},T=setTimeout(S,300);window.addEventListener("click",C,!0),window.addEventListener("pointerdown",S,!0),E&&_.surface&&a.current.onCommit(_.surface)},g=E=>{if(E.button!==0||m)return;let _=a.current,S=t.current[_.objectId];if(!(S instanceof E2)||!S.visible)return;let C=S.children.find(D=>D.userData[eo]&&D.userData[nm]===_.decal.id);if(!C?.visible)return;S.updateWorldMatrix(!0,!0),y(E);let T=jx(C,l),A=l.intersectObject(S,!1)[0];if(!T||!A||T.distance>A.distance+1e-4)return;let R=new Nx;if(nr(C)){let D=new Nx,k=C.geometry.getAttribute("position").count;if(!k)return;for(let U=0;U<k;U++)R.add(C.getVertexPosition(U,D));R.divideScalar(k).applyMatrix4(C.matrixWorld)}else R.fromArray(_.decal.position).applyMatrix4(S.matrixWorld);R.project(n);let L=s.getBoundingClientRect(),N=new im(E.clientX-(L.left+(R.x+1)/2*L.width),E.clientY-(L.top+(1-R.y)/2*L.height)),I=C.material.map?.image,z=r.current;m={pointerId:E.pointerId,node:S,mesh:C,geometry:C.geometry,decal:_.decal,surface:null,offset:N,aspect:I?.width&&I.height?I.width/I.height:1,controller:z,controlsEnabled:z?.enabled??!1},z&&(z.enabled=!1),E.preventDefault(),E.stopImmediatePropagation(),s.setPointerCapture(E.pointerId),s.style.cursor="grabbing"},f=E=>{!m||E.pointerId!==m.pointerId||(E.preventDefault(),E.stopImmediatePropagation(),h=E,c||(c=requestAnimationFrame(()=>{c=0,h&&v(h)})))},x=E=>{!m||E.pointerId!==m.pointerId||(E.preventDefault(),E.stopImmediatePropagation(),h&&v(h),M(!0))},P=()=>M(!1),b=E=>{E.key==="Escape"&&(M(!1),a.current.onCancel())};return s.addEventListener("pointerdown",g,!0),window.addEventListener("pointermove",f,{capture:!0,passive:!1}),window.addEventListener("pointerup",x,!0),window.addEventListener("pointercancel",P),window.addEventListener("blur",P),window.addEventListener("keydown",b),s.addEventListener("lostpointercapture",P),()=>{M(!1),s.style.cursor=d,s.style.touchAction=p,s.removeEventListener("pointerdown",g,!0),window.removeEventListener("pointermove",f,!0),window.removeEventListener("pointerup",x,!0),window.removeEventListener("pointercancel",P),window.removeEventListener("blur",P),window.removeEventListener("keydown",b),s.removeEventListener("lostpointercapture",P)}},[n,i,o,t,r,e.objectId,e.decal]),null}import{useCallback as ta,useEffect as Q2,useState as us}from"react";import{AnimationClip as R2,Group as yi,Mesh as k2,PropertyBinding as sm}from"three";import{GLTFExporter as D2,SkeletonUtils as O2}from"three-stdlib";var om=new WeakMap;function am(e){e.traverse(t=>{if(om.has(t))return;let r=t.morphTargetInfluences;om.set(t,{position:t.position.clone(),quaternion:t.quaternion.clone(),scale:t.scale.clone(),morphTargetInfluences:r?[...r]:void 0})})}function Vx(e){return om.get(e)}var L2="reactImmersiveSkinFreeze",I2=new Set(["position","quaternion","scale","morphTargetInfluences"]);function Ac({sources:e,downloadFilename:t,filenameSuffix:r="",onComplete:n}){let i=new yi,o=[];try{for(let s of e){let l=B2(s,e.length>1);i.add(l.root),o.push(...l.animations)}}catch(s){console.error("GLB export failed:",s),n();return}new D2().parse(i,s=>{let l=s instanceof ArrayBuffer?new Blob([s],{type:"model/gltf-binary"}):new Blob([JSON.stringify(s)],{type:"model/gltf+json"}),u=s instanceof ArrayBuffer?".glb":".gltf";sn(l,`${t}${r}${u}`),n()},s=>{console.error("GLTFExporter error:",s),n()},{binary:!0,onlyVisible:!0,animations:o})}function B2({scene:e,objectBindings:t,matRefs:r,label:n},i){let o=new yi;o.name=n??e.name??"";let a=new Map;for(let[g,f]of Object.entries(t))a.set(f.modelObjectId??g,g);let s=g=>{let f=g.name||g.uuid;return a.get(f)??f},l=g=>{let f=t[s(g)];return f?f.visible===!1:g.visible===!1};for(let g=e;g;g=g.parent)if(l(g))return{root:o,animations:[]};e.updateWorldMatrix(!0,!0);let u=O2.clone(e),d=new Map,p=[],c=[];e.traverse(g=>p.push(g)),u.traverse(g=>c.push(g)),p.forEach((g,f)=>d.set(g,c[f]));let h=[];for(let g=e.parent;g;g=g.parent)h.unshift(g);let m=o;for(let g of h){let f=lm(g);m.add(f),m=f}m.add(u);let y=[],v=new Set;for(let g of p){let f=d.get(g);if(g.userData?.isWireframeOverlay){y.push(f);continue}delete f.userData[L2];let x=f;if(x.isMesh){let P=r[s(g)];P&&(x.material=P)}(l(g)||g.parent&&v.has(g.parent))&&v.add(g),f.visible=!0}y.forEach(g=>g.removeFromParent());for(let g of v){let f=d.get(g);if(Rc(f,o)){if(!z2(f)){f.removeFromParent();continue}if(f.isMesh){let x=lm(f);x.name=f.name,x.userData=f.userData;for(let P of[...f.children])x.add(P);f.parent.add(x),f.removeFromParent(),d.set(g,x)}}}let M=V2(e,o,d,i&&n?`${n}: `:"");return M.length===0?N2(p,d,o):j2(p,d,o,M),{root:o,animations:M}}function lm(e){let t=new yi;return t.position.copy(e.position),t.quaternion.copy(e.quaternion),t.scale.copy(e.scale),t.matrix.copy(e.matrix),t.matrixAutoUpdate=e.matrixAutoUpdate,t}function j2(e,t,r,n){let i=n.map(o=>[...o.tracks]);for(let o of e){let a=Sb(o),s=t.get(o);if(!a||!nr(s)||!Rc(s,r))continue;let l=s,u=new Set;for(let y of l.skeleton.bones)for(let v=y;v&&(u.add(v),v!==r);v=v.parent);let d=new Map,p=y=>{let v=y.isBone?y.clone(!1):lm(y);d.set(y.uuid,v);for(let M of y.children)u.has(M)&&v.add(p(M));return v},c=p(r),h=new yi,m=h;for(let y of[...a].reverse()){let v=new yi;y.decompose(v.position,v.quaternion,v.scale);let M=new yi;M.scale.set(1/v.scale.x,1/v.scale.y,1/v.scale.z);let g=new yi;g.quaternion.copy(v.quaternion).invert();let f=new yi;f.position.copy(v.position).negate(),m.add(M),M.add(g),g.add(f),m=f}m.add(c),l.add(h),l.skeleton.bones=l.skeleton.bones.map(y=>d.get(y.uuid)),n.forEach((y,v)=>{for(let M of i[v]){let g=sm.parseTrackName(M.name);if(g.propertyName==="morphTargetInfluences")continue;let f=d.get(g.nodeName);if(!f)continue;let x=M.clone();x.name=Fx(f.uuid,g),y.tracks.push(x)}})}}function N2(e,t,r){r.updateWorldMatrix(!0,!0);for(let n of e){let i=t.get(n);if(!nr(n)||!nr(i)||!i.parent||!Rc(i,r))continue;let o=i,a=new k2(Cb(n),o.material);a.name=o.name,a.userData=o.userData,a.matrix.copy(i.parent.matrixWorld).invert().multiply(Tb(n)),a.matrixAutoUpdate=!1,a.matrix.decompose(a.position,a.quaternion,a.scale);let s=i.parent;s.children.splice(s.children.indexOf(i),1,a),a.parent=s,i.parent=null,a.updateMatrixWorld(!0);for(let l of[...i.children])a.attach(l)}}function z2(e){let t=!1;return e.traverse(r=>{r.isBone&&(t=!0)}),t}function Rc(e,t){for(let r=e;r;r=r.parent)if(r===t)return!0;return!1}function V2(e,t,r,n){let i=[];for(let o of e.animations??[]){let a=[];for(let s of o.tracks){let l=sm.parseTrackName(s.name);if(!I2.has(l.propertyName))continue;let u=sm.findNode(e,l.nodeName);if(l.objectName){if(l.objectName!=="bones"||!u||!nr(u))continue;u=u.skeleton.getBoneByName(l.objectIndex)??null,l.objectName="",l.objectIndex=""}let d=u?r.get(u):void 0;if(!d||!Rc(d,t)||l.propertyName==="morphTargetInfluences"&&!d.morphTargetInfluences)continue;F2(u,d,l.propertyName);let p=s.clone();p.name=Fx(d.uuid,l),a.push(p)}a.length!==0&&i.push(new R2(`${n}${o.name}`,o.duration,a,o.blendMode))}return i}function F2(e,t,r){let n=Vx(e);n&&(r==="position"?t.position.copy(n.position):r==="quaternion"?t.quaternion.copy(n.quaternion):r==="scale"?t.scale.copy(n.scale):r==="morphTargetInfluences"&&n.morphTargetInfluences&&t.morphTargetInfluences?.length===n.morphTargetInfluences.length&&(t.morphTargetInfluences=[...n.morphTargetInfluences]))}function Fx(e,t){let r=t.objectName?`.${t.objectName}${t.objectIndex!==void 0?`[${t.objectIndex}]`:""}`:"",n=t.propertyIndex!==void 0?`[${t.propertyIndex}]`:"";return`${e}${r}.${t.propertyName}${n}`}import{strToU8 as G2}from"fflate";import{zip as U2}from"fflate";function Ux(e,t=6){return new Promise((r,n)=>{U2(e,{level:t},(i,o)=>{i?n(i):r(o)})})}var cs=2048,Gx=["#00e5ff","#ff4fd8","#ffe45e","#7cff6b","#ff784f","#a78bfa","#38bdf8","#fb7185"];function Hx(e){return e.split("&").join("&").split("<").join("<").split(">").join(">").split('"').join(""").split("'").join("'")}function dm(e,t){return e.normalize("NFKD").replace(/[\u0300-\u036f]/g,"").toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")||t}function qx(e){return dm(e,"model")}function cm(e,t){return e.index?Math.round(e.index.getX(t)):t}function H2(e,t,r){let n=cm(e,r),i=cm(e,r+1),o=cm(e,r+2);if(n>=t.count||i>=t.count||o>=t.count)return null;let a=[{index:n,u:t.getX(n),v:t.getY(n)},{index:i,u:t.getX(i),v:t.getY(i)},{index:o,u:t.getX(o),v:t.getY(o)}];return a.every(s=>Number.isFinite(s.u)&&Number.isFinite(s.v))?a:null}function Wx(e){return`${e.u.toFixed(6)},${e.v.toFixed(6)}`}function um(e,t,r,n){let i,o;n?(i=t.index,o=r.index):(i=Wx(t),o=Wx(r));let a=i<o?`${i}|${o}`:`${o}|${i}`,s=e.get(a);s?s.count+=1:e.set(a,{count:1,start:t,end:r})}function W2(e,t,r){um(e,t[0],t[1],r),um(e,t[1],t[2],r),um(e,t[2],t[0],r)}function q2(e,t){return Array.isArray(e)?e[t]??null:e}function X2(e){let t=new Map,r=0,n=0,i=0;return e.traverse(o=>{let a=o;if(!a.isMesh||!a.geometry||!a.material)return;let s=a.geometry,l=s.getAttribute("uv");if(!l||l.itemSize<2||l.count<3)return;r+=1;let u=a.name||`Mesh ${r}`,d=s.index?.count??l.count,p=s.groups.length>0?s.groups:[{start:0,count:d,materialIndex:0}];for(let c of p){let h=c.materialIndex??0,m=q2(a.material,h);if(!m)continue;let y=t.get(m.uuid);y||(n+=1,y={name:m.name||`Material ${n}`,layers:new Map},t.set(m.uuid,y));let v=y.layers.get(a.uuid);v||(v={name:u,color:Gx[i%Gx.length],edges:new Map},i+=1,y.layers.set(a.uuid,v));let M=Math.max(0,c.start),g=Math.min(d,M+c.count);for(let f=M;f+2<g;f+=3){let x=H2(s,l,f);x&&W2(v.edges,x,!!s.index)}}}),[...t.values()].filter(o=>[...o.layers.values()].some(a=>a.edges.size>0))}function kc(e){return(e*cs).toFixed(2)}function $2(e){return`M${kc(e.start.u)} ${kc(1-e.start.v)}L${kc(e.end.u)} ${kc(1-e.end.v)}`}function Y2(e){let t=Hx(e.name),r=[...e.layers.values()].filter(n=>n.edges.size>0).map((n,i)=>{let o=Hx(n.name),a=`${dm(n.name,"mesh")}-${i+1}`,s=[...n.edges.values()],l=s.filter(p=>p.count===1),d=(l.length>0?l:s).map($2).join("");return[` <g id="${a}" data-mesh="${o}" fill="none" stroke="${n.color}"`,' stroke-width="1" stroke-linejoin="round" vector-effect="non-scaling-stroke">',` <title>${o}</title>`,` <path d="${d}"/>`," </g>"].join(`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as i}from"./chunk-MMO7KCYU.mjs";import{H as n}from"./chunk-
|
|
1
|
+
import{a as i}from"./chunk-MMO7KCYU.mjs";import{H as n}from"./chunk-EIBW7ZJE.mjs";var a={licenseKey:!0,arHandoff:!0,mobileHandoffUrl:!0,dracoDecoderPath:!0,ktx2TranscoderPath:!0,meshopt:!0,hideLicenseCheckingOverlay:!0},d={licenseValidationUrl:!0,onObjectEditLeaseChange:!0,onSelectionClear:!0,onSceneLoaded:!0,onTexturePositioningChange:!0,endTexturePositioningRef:!0};function f(e,t){let o={};for(let r of Object.keys(t))r in e&&(o[r]=e[r]);return o}function s(e,t){let o={...e};for(let r of Object.keys(t))delete o[r];return o}import{jsx as c}from"react/jsx-runtime";function l(e){return i("model-viewer","ModelViewer"),c(n,{...s(e,d)})}export{a,f as b,l as c};
|