1import{i as e}from"./rolldown-runtime-Dd_uD5pT.js";import{j as t,n,t as r}from"./vendor-react-runtime-xR29vowS.js";import{Er as i,Qn as a,Y as o,v as s}from"./vendor-shared-CWpFGpMq.js";import{Ft as c,Lt as l}from"./vendor-ui-Be_6HKLx.js";import{u}from"./viewer-defaults-D305pOfE.js";import{i as d,o as f,r as p}from"./react-DN1BcdJy.js";import{i as m,s as h}from"./scene-settings-store-CSKh119S.js";import{i as g,n as _,o as v}from"./scene-camera-iXtoz6Ge.js";var y=Symbol(``);function b(e){let t=f(e,(n,r,i)=>{let a=typeof i==`function`?i(n(t)):i;r(t,a===y?e:a)});return t}var x=(e,t,n)=>(t.has(n)?t:t.set(n,e())).get(n),S=new WeakMap,C=(e,t,n,r)=>x(e,x(()=>new WeakMap,x(()=>new WeakMap,S,t),n),r);function w(e,t,n=Object.is){return C(()=>{let r=Symbol(),i=([e,i])=>{if(i===r)return t(e);let a=t(e,i);return n(i,a)?i:a},a=f(t=>{let n=t(a),r=t(e);return i([r,n])});return a.init=r,a},e,t,n)}var T=e=>typeof e?.then==`function`;function E(e=()=>{try{return window.localStorage}catch{return}},t){let n,r,i={getItem:(i,a)=>{let o=e=>{if(e||=``,n!==e){try{r=JSON.parse(e,t?.reviver)}catch{return a}n=e}return r},s=e()?.getItem(i)??null;return T(s)?s.then(o):o(s)},setItem:(n,r)=>e()?.setItem(n,JSON.stringify(r,t?.replacer)),removeItem:t=>e()?.removeItem(t)},a=e=>(n,r,i)=>e(n,e=>{let n;try{n=JSON.parse(e||``,t?.reviver)}catch{n=i}r(n)}),o;try{o=e()?.subscribe}catch{}return!o&&typeof window<`u`&&typeof window.addEventListener==`function`&&window.Storage&&(o=(t,n)=>{if(!(e()instanceof window.Storage))return()=>{};let r=r=>{r.storageArea===e()&&r.key===t&&n(r.newValue)};return window.addEventListener(`storage`,r),()=>{window.removeEventListener(`storage`,r)}}),o&&(i.subscribe=a(o)),i}E();var D=e(t(),1),O=n(),k=r(),A=e=>`${e||`Unnamed Hotspot`} Camera`;function ee(e,t){let n={id:t.hotspotId,name:`New Hotspot`,worldPosition:[0,0,0],visible:!0,internalOnly:!1,occlusionEnabled:!0,stylePreset:`dot`,linkedCameraId:t.cameraId};return{camera:{...e.camera,cameras:[...e.camera.cameras??[],{cameraId:t.cameraId,kind:`hotspot`,name:A(n.name),fov:60}]},hotspots:[...e.hotspots,n]}}var j=(e,t,n)=>{if(n&&t?.find(e=>e.cameraId===n)?.kind===`hotspot`)return e.some(e=>e.linkedCameraId===n)?void 0:n},M=(e,t,n)=>j(e.filter(e=>e.id!==n),t,e.find(e=>e.id===n)?.linkedCameraId),te=(e,t,n)=>{let r=j(e,t,n);if(!r)return;let i=t?.find(e=>e.cameraId===r);return i?.position!==void 0||i?.rotation!==void 0||i?.target!==void 0?void 0:r};function N(e,t){let n=e.camera.cameras??[];return n.length<=1||g(n,t)?null:{camera:{...e.camera,cameras:_(n.filter(e=>e.cameraId!==t))},hotspots:e.hotspots.map(e=>e.linkedCameraId===t?{...e,linkedCameraId:void 0}:e)}}function ne(e,t){let n=M(e.hotspots,e.camera.cameras,t),r={camera:e.camera,hotspots:e.hotspots.filter(e=>e.id!==t)};return n?N(r,n)??r:r}function re(e,t,n){let r=e.hotspots.find(e=>e.id===t)?.linkedCameraId,i={camera:e.camera,hotspots:e.hotspots.map(e=>e.id===t?{...e,linkedCameraId:n}:e)},a=te(i.hotspots,e.camera.cameras,r);return a?N(i,a)??i:i}function P(e,t,n){let r=e.hotspots.map(e=>e.id===t?{...e,worldPosition:n}:e),i=M(e.hotspots,e.camera.cameras,t);return i?{camera:{...e.camera,cameras:(e.camera.cameras??[]).map(e=>e.cameraId===i?{...e,target:n}:e)},hotspots:r}:{camera:e.camera,hotspots:r}}function ie(e,t,n){let r=e.hotspots.map(e=>e.id===t?{...e,name:n}:e),i=M(e.hotspots,e.camera.cameras,t);return i?{camera:{...e.camera,cameras:(e.camera.cameras??[]).map(e=>e.cameraId===i?{...e,name:A(n)}:e)},hotspots:r}:{camera:e.camera,hotspots:r}}function ae(e,t,n){return e.map(e=>e.linkedCameraId===t?{...e,linkedCameraId:n}:e)}var oe={mode:`optimize`,activeComposeTool:`environment`,showSidebar:!1,showPublishPanel:!1,isSaving:!1,hasUnsavedChanges:!1},F={name:``,description:``,thumbnailUrl:``},I=f(oe),L=f(F),se=f(null),R=f(null),z=f(null),B=f(null),V=f({targetProjectId:void 0,targetFolderId:null}),H=f({projectId:null,projectName:null,folderId:null,folderName:null}),U=f(null),W=w(I,e=>e.showSidebar),G=w(I,e=>({activeComposeTool:e.activeComposeTool,mode:e.mode,showSidebar:e.showSidebar}),(e,t)=>e.activeComposeTool===t.activeComposeTool&&e.mode===t.mode&&e.showSidebar===t.showSidebar),ce=w(I,e=>e.mode===`compose`&&e.showSidebar?e.activeComposeTool:null),le=w(I,e=>e.showPublishPanel),ue=w(I,e=>e.isSaving),de=w(I,e=>e.hasUnsavedChanges),K=f(!1),fe=f(!1),q=f(e=>e(K)),pe=f(e=>!e(q)),J=[`Preparing the Publisher...`,`Adjusting the lighting...`,`Cleaning the lenses...`,`Loading geometry data...`,`Calibrating the viewer...`],me=(0,D.memo)(()=>{let e=(0,k.c)(11),[t,n]=(0,D.useState)(0),r=c(),i,u;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=()=>{let e,t=setTimeout(()=>{e=setInterval(()=>{n(he)},6e3)},3e3);return()=>{e&&clearInterval(e),clearTimeout(t)}},u=[],e[0]=i,e[1]=u):(i=e[0],u=e[1]),(0,D.useEffect)(i,u);let d=J[t],f;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,O.jsx)(o,{}),e[2]=f):f=e[2];let p,m,h;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(p={opacity:0}
1,m={opacity:1},h={opacity:0},e[3]=p,e[4]=m,e[5]=h):(p=e[3],m=e[4],h=e[5]);let g=r?0:.5,_;e[6]===g?_=e[7]:(_={duration:g},e[6]=g,e[7]=_);let v;return e[8]!==d||e[9]!==_?(v=(0,O.jsxs)(s,{children:[f,(0,O.jsx)(l,{mode:`wait`,initial:!1,children:(0,O.jsx)(a.p,{className:`text-muted-foreground mt-4 text-center`,initial:p,animate:m,exit:h,transition:_,children:d},d)})]}),e[8]=d,e[9]=_,e[10]=v):v=e[10],v});function he(e){return(e+1)%J.length}var Y=(0,D.createContext)(null);function ge(e){let t=(0,k.c)(11),{children:n}=e,r=(0,D.useRef)(null),i=(0,D.useRef)(null),a=(0,D.useRef)(null),o=(0,D.useRef)(null),s;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(s=e=>{r.current=e},t[0]=s):s=t[0];let c=s,l;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(l=async e=>r.current?r.current(e):null,t[1]=l):l=t[1];let u=l,d;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(d=e=>{i.current=e},t[2]=d):d=t[2];let f=d,p;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(p=async()=>i.current?i.current():null,t[3]=p):p=t[3];let m=p,h=(0,D.useRef)(null),g;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(g=e=>{h.current=e},t[4]=g):g=t[4];let _=g,v;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(v=async()=>h.current?h.current():null,t[5]=v):v=t[5];let y=v,b;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(b=e=>{a.current=e},t[6]=b):b=t[6];let x=b,S;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(S=e=>{o.current=e},t[7]=S):S=t[7];let C=S,w;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(w={registerSceneScreenshotCapture:c,requestSceneScreenshot:u,registerSceneCameraSnapshotCapture:f,requestSceneCameraSnapshot:m,registerShadowBakeCapture:_,requestShadowBake:y,registerCommandExecutor:x,commandExecutor:a,registerHotspotPositionSetter:C,hotspotPositionSetter:o},t[8]=w):w=t[8];let T=w,E;return t[9]===n?E=t[10]:(E=(0,O.jsx)(Y.Provider,{value:T,children:n}),t[9]=n,t[10]=E),E}function X(){let e=(0,D.useContext)(Y);if(!e)throw Error(`usePublisherViewerCapture must be used within PublisherViewerCaptureProvider`);return e}var Z={width:1280,height:720,mimeType:`image/webp`,quality:.86,mode:`viewport`};function Q(){let{requestSceneScreenshot:e,requestSceneCameraSnapshot:t}=X(),n=d(L),r=d(m),[a,o]=(0,D.useState)(!1);return{setOpeningView:(0,D.useCallback)(async({announce:s=!0}={})=>{if(!a){o(!0);try{let[a,o]=await Promise.all([t(),e(Z)]);if(!o){s&&i.error(`Could not capture the viewport. Try again once the scene has finished loading.`);return}a&&r(e=>{let t=v(e.cameras);return t?{...e,cameras:e.cameras?.map(e=>e.cameraId===t?{...e,position:a.position,rotation:a.rotation,target:a.target,fov:a.fov}:e)}:e}),n(e=>({...e,thumbnailUrl:o})),s&&i.success(`Opening view updated. Save to keep it.`)}catch(e){console.error(`Opening view capture failed:`,e),s&&i.error(`Could not capture the viewport.`)}finally{o(!1)}}},[a,t,e,r,n]),isCapturing:a}}function $(){let e=(0,k.c)(5),{file:t,source:n}=u(),{thumbnailUrl:r}=p(L),{setOpeningView:i}=Q(),a=(0,D.useRef)(null),o;return e[0]!==t||e[1]!==i||e[2]!==n||e[3]!==r?(o=e=>{e.type===`initial_framing_completed`&&t&&n===`files`&&!r&&a.current!==t&&(a.current=t,i({announce:!1}))},e[0]=t,e[1]=i,e[2]=n,e[3]=r,e[4]=o):o=e[4],o}function _e(e,t,n){let r=P({camera:e.get(m),hotspots:e.get(h)},t,n);e.set(h,r.hotspots),e.set(m,r.camera)}export{re as A,L as C,G as D,W as E,b as F,ne as M,ie as N,ee as O,ae as P,V as S,le as T,R as _,ge as a,ce as b,q as c,B as d,de as f,z as g,ue as h,Q as i,N as j,P as k,pe as l,K as m,Z as n,X as o,fe as p,$ as r,me as s,_e as t,H as u,se as v,F as w,I as x,U as y};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.